aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Kbuild2
-rw-r--r--include/acpi/acpi_bus.h2
-rw-r--r--include/acpi/acpi_drivers.h13
-rw-r--r--include/acpi/acpixf.h9
-rw-r--r--include/acpi/actypes.h20
-rw-r--r--include/acpi/platform/acgcc.h4
-rw-r--r--include/acpi/platform/aclinux.h63
-rw-r--r--include/acpi/processor.h1
-rw-r--r--include/acpi/video.h4
-rw-r--r--include/asm-generic/Kbuild22
-rw-r--r--include/asm-generic/Kbuild.asm1
-rw-r--r--include/asm-generic/atomic-long.h258
-rw-r--r--include/asm-generic/atomic.h321
-rw-r--r--include/asm-generic/atomic64.h42
-rw-r--r--include/asm-generic/auxvec.h8
-rw-r--r--include/asm-generic/bitops.h24
-rw-r--r--include/asm-generic/bitops/atomic.h1
-rw-r--r--include/asm-generic/bitsperlong.h32
-rw-r--r--include/asm-generic/bugs.h10
-rw-r--r--include/asm-generic/cache.h12
-rw-r--r--include/asm-generic/cacheflush.h30
-rw-r--r--include/asm-generic/checksum.h79
-rw-r--r--include/asm-generic/current.h9
-rw-r--r--include/asm-generic/delay.h9
-rw-r--r--include/asm-generic/dma-mapping-common.h190
-rw-r--r--include/asm-generic/dma.h15
-rw-r--r--include/asm-generic/errno.h2
-rw-r--r--include/asm-generic/fb.h12
-rw-r--r--include/asm-generic/getorder.h24
-rw-r--r--include/asm-generic/hardirq.h21
-rw-r--r--include/asm-generic/hw_irq.h9
-rw-r--r--include/asm-generic/int-l64.h2
-rw-r--r--include/asm-generic/int-ll64.h2
-rw-r--r--include/asm-generic/io.h300
-rw-r--r--include/asm-generic/ioctls.h110
-rw-r--r--include/asm-generic/ipcbuf.h34
-rw-r--r--include/asm-generic/irq.h18
-rw-r--r--include/asm-generic/irqflags.h72
-rw-r--r--include/asm-generic/kmap_types.h35
-rw-r--r--include/asm-generic/linkage.h8
-rw-r--r--include/asm-generic/mman-common.h41
-rw-r--r--include/asm-generic/mman.h51
-rw-r--r--include/asm-generic/mmu.h15
-rw-r--r--include/asm-generic/mmu_context.h45
-rw-r--r--include/asm-generic/module.h22
-rw-r--r--include/asm-generic/msgbuf.h47
-rw-r--r--include/asm-generic/mutex.h9
-rw-r--r--include/asm-generic/page.h109
-rw-r--r--include/asm-generic/param.h24
-rw-r--r--include/asm-generic/parport.h23
-rw-r--r--include/asm-generic/pci.h21
-rw-r--r--include/asm-generic/pgalloc.h12
-rw-r--r--include/asm-generic/pgtable.h25
-rw-r--r--include/asm-generic/posix_types.h165
-rw-r--r--include/asm-generic/rtc.h2
-rw-r--r--include/asm-generic/scatterlist.h43
-rw-r--r--include/asm-generic/sections.h3
-rw-r--r--include/asm-generic/segment.h9
-rw-r--r--include/asm-generic/sembuf.h38
-rw-r--r--include/asm-generic/serial.h13
-rw-r--r--include/asm-generic/setup.h6
-rw-r--r--include/asm-generic/shmbuf.h59
-rw-r--r--include/asm-generic/shmparam.h6
-rw-r--r--include/asm-generic/signal-defs.h28
-rw-r--r--include/asm-generic/signal.h137
-rw-r--r--include/asm-generic/socket.h63
-rw-r--r--include/asm-generic/sockios.h13
-rw-r--r--include/asm-generic/spinlock.h11
-rw-r--r--include/asm-generic/stat.h72
-rw-r--r--include/asm-generic/string.h10
-rw-r--r--include/asm-generic/swab.h18
-rw-r--r--include/asm-generic/syscalls.h60
-rw-r--r--include/asm-generic/system.h161
-rw-r--r--include/asm-generic/termbits.h198
-rw-r--r--include/asm-generic/termios-base.h77
-rw-r--r--include/asm-generic/termios.h105
-rw-r--r--include/asm-generic/timex.h22
-rw-r--r--include/asm-generic/tlbflush.h18
-rw-r--r--include/asm-generic/types.h42
-rw-r--r--include/asm-generic/uaccess-unaligned.h26
-rw-r--r--include/asm-generic/uaccess.h335
-rw-r--r--include/asm-generic/ucontext.h12
-rw-r--r--include/asm-generic/unaligned.h30
-rw-r--r--include/asm-generic/unistd.h859
-rw-r--r--include/asm-generic/user.h8
-rw-r--r--include/asm-generic/vga.h24
-rw-r--r--include/asm-generic/vmlinux.lds.h252
-rw-r--r--include/drm/drmP.h178
-rw-r--r--include/drm/drm_edid.h92
-rw-r--r--include/drm/drm_hashtab.h2
-rw-r--r--include/drm/drm_memory_debug.h309
-rw-r--r--include/drm/drm_mm.h99
-rw-r--r--include/drm/drm_pciids.h9
-rw-r--r--include/drm/radeon_drm.h130
-rw-r--r--include/drm/ttm/ttm_bo_api.h618
-rw-r--r--include/drm/ttm/ttm_bo_driver.h867
-rw-r--r--include/drm/ttm/ttm_memory.h153
-rw-r--r--include/drm/ttm/ttm_module.h58
-rw-r--r--include/drm/ttm/ttm_placement.h92
-rw-r--r--include/linux/Kbuild4
-rw-r--r--include/linux/acpi.h2
-rw-r--r--include/linux/adfs_fs.h13
-rw-r--r--include/linux/adfs_fs_i.h24
-rw-r--r--include/linux/adfs_fs_sb.h38
-rw-r--r--include/linux/agp_backend.h2
-rw-r--r--include/linux/amba/pl022.h264
-rw-r--r--include/linux/amba/pl061.h15
-rw-r--r--include/linux/amba/serial.h3
-rw-r--r--include/linux/ata.h14
-rw-r--r--include/linux/atmel-mci.h2
-rw-r--r--include/linux/bio.h15
-rw-r--r--include/linux/blkdev.h248
-rw-r--r--include/linux/blktrace_api.h45
-rw-r--r--include/linux/bug.h12
-rw-r--r--include/linux/c2port.h3
-rw-r--r--include/linux/can/Kbuild1
-rw-r--r--include/linux/can/dev.h70
-rw-r--r--include/linux/can/netlink.h113
-rw-r--r--include/linux/can/platform/sja1000.h35
-rw-r--r--include/linux/cb710.h231
-rw-r--r--include/linux/cdev.h2
-rw-r--r--include/linux/clk.h13
-rw-r--r--include/linux/clockchips.h9
-rw-r--r--include/linux/clocksource.h10
-rw-r--r--include/linux/compat.h2
-rw-r--r--include/linux/compiler-gcc3.h6
-rw-r--r--include/linux/compiler.h5
-rw-r--r--include/linux/cpu.h5
-rw-r--r--include/linux/cpuset.h13
-rw-r--r--include/linux/cramfs_fs.h3
-rw-r--r--include/linux/cyclades.h37
-rw-r--r--include/linux/dcache.h11
-rw-r--r--include/linux/device-mapper.h2
-rw-r--r--include/linux/device.h10
-rw-r--r--include/linux/dlm.h4
-rw-r--r--include/linux/dma-debug.h7
-rw-r--r--include/linux/dma-mapping.h43
-rw-r--r--include/linux/dma_remapping.h9
-rw-r--r--include/linux/dmar.h12
-rw-r--r--include/linux/dnotify.h29
-rw-r--r--include/linux/efi.h2
-rw-r--r--include/linux/eisa.h4
-rw-r--r--include/linux/elevator.h4
-rw-r--r--include/linux/etherdevice.h27
-rw-r--r--include/linux/ethtool.h23
-rw-r--r--include/linux/fb.h14
-rw-r--r--include/linux/firewire.h445
-rw-r--r--include/linux/firmware-map.h12
-rw-r--r--include/linux/firmware.h1
-rw-r--r--include/linux/fs.h40
-rw-r--r--include/linux/fs_enet_pd.h6
-rw-r--r--include/linux/fsl_devices.h4
-rw-r--r--include/linux/fsnotify.h199
-rw-r--r--include/linux/fsnotify_backend.h387
-rw-r--r--include/linux/ftrace.h21
-rw-r--r--include/linux/ftrace_event.h172
-rw-r--r--include/linux/fuse.h31
-rw-r--r--include/linux/futex.h6
-rw-r--r--include/linux/gameport.h3
-rw-r--r--include/linux/gcd.h8
-rw-r--r--include/linux/genhd.h4
-rw-r--r--include/linux/gfp.h174
-rw-r--r--include/linux/hid.h36
-rw-r--r--include/linux/highmem.h4
-rw-r--r--include/linux/hrtimer.h7
-rw-r--r--include/linux/hugetlb.h11
-rw-r--r--include/linux/i2c-ocores.h2
-rw-r--r--include/linux/i2c.h72
-rw-r--r--include/linux/i2c/lm8323.h46
-rw-r--r--include/linux/i2c/pca953x.h1
-rw-r--r--include/linux/ide.h120
-rw-r--r--include/linux/ieee80211.h61
-rw-r--r--include/linux/if.h3
-rw-r--r--include/linux/if_arp.h2
-rw-r--r--include/linux/if_ether.h2
-rw-r--r--include/linux/if_packet.h21
-rw-r--r--include/linux/if_tun.h1
-rw-r--r--include/linux/if_tunnel.h2
-rw-r--r--include/linux/if_vlan.h6
-rw-r--r--include/linux/ima.h11
-rw-r--r--include/linux/in.h1
-rw-r--r--include/linux/init.h12
-rw-r--r--include/linux/init_task.h27
-rw-r--r--include/linux/input.h2
-rw-r--r--include/linux/intel-iommu.h35
-rw-r--r--include/linux/interrupt.h22
-rw-r--r--include/linux/iocontext.h6
-rw-r--r--include/linux/ioport.h2
-rw-r--r--include/linux/ipc_namespace.h5
-rw-r--r--include/linux/ipv6.h6
-rw-r--r--include/linux/irq.h78
-rw-r--r--include/linux/isdn/capilli.h2
-rw-r--r--include/linux/jbd2.h6
-rw-r--r--include/linux/kernel.h8
-rw-r--r--include/linux/kernel_stat.h17
-rw-r--r--include/linux/keyboard.h1
-rw-r--r--include/linux/kmemcheck.h153
-rw-r--r--include/linux/kmemleak.h96
-rw-r--r--include/linux/kmemtrace.h25
-rw-r--r--include/linux/kvm.h46
-rw-r--r--include/linux/kvm_host.h21
-rw-r--r--include/linux/kvm_types.h27
-rw-r--r--include/linux/lguest.h4
-rw-r--r--include/linux/lguest_launcher.h3
-rw-r--r--include/linux/linux_logo.h16
-rw-r--r--include/linux/lis3lv02d.h39
-rw-r--r--include/linux/list_nulls.h18
-rw-r--r--include/linux/lockd/lockd.h2
-rw-r--r--include/linux/loop.h3
-rw-r--r--include/linux/lsm_audit.h111
-rw-r--r--include/linux/mISDNdsp.h4
-rw-r--r--include/linux/mISDNhw.h12
-rw-r--r--include/linux/mISDNif.h19
-rw-r--r--include/linux/magic.h3
-rw-r--r--include/linux/major.h1
-rw-r--r--include/linux/mdio.h356
-rw-r--r--include/linux/memcontrol.h14
-rw-r--r--include/linux/mfd/ab3100.h103
-rw-r--r--include/linux/mfd/asic3.h236
-rw-r--r--include/linux/mfd/ezx-pcap.h256
-rw-r--r--include/linux/mfd/tmio.h7
-rw-r--r--include/linux/mg_disk.h173
-rw-r--r--include/linux/mii.h34
-rw-r--r--include/linux/miscdevice.h1
-rw-r--r--include/linux/mlx4/device.h1
-rw-r--r--include/linux/mlx4/qp.h1
-rw-r--r--include/linux/mm.h48
-rw-r--r--include/linux/mm_types.h10
-rw-r--r--include/linux/mmc/sdio_ids.h10
-rw-r--r--include/linux/mmiotrace.h2
-rw-r--r--include/linux/mmzone.h36
-rw-r--r--include/linux/mnt_namespace.h10
-rw-r--r--include/linux/module.h32
-rw-r--r--include/linux/moduleparam.h40
-rw-r--r--include/linux/mount.h25
-rw-r--r--include/linux/mtd/nand.h16
-rw-r--r--include/linux/mtd/onenand.h24
-rw-r--r--include/linux/mtd/onenand_regs.h20
-rw-r--r--include/linux/mtd/partitions.h1
-rw-r--r--include/linux/mtd/ubi.h37
-rw-r--r--include/linux/mutex.h1
-rw-r--r--include/linux/namei.h5
-rw-r--r--include/linux/net_dropmon.h8
-rw-r--r--include/linux/netdevice.h239
-rw-r--r--include/linux/netfilter/Kbuild1
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h69
-rw-r--r--include/linux/netfilter/nf_conntrack_tcp.h3
-rw-r--r--include/linux/netfilter/nfnetlink.h5
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h1
-rw-r--r--include/linux/netfilter/x_tables.h6
-rw-r--r--include/linux/netfilter/xt_NFQUEUE.h5
-rw-r--r--include/linux/netfilter/xt_osf.h133
-rw-r--r--include/linux/netfilter/xt_socket.h12
-rw-r--r--include/linux/nfs.h5
-rw-r--r--include/linux/nfs2.h7
-rw-r--r--include/linux/nfs3.h5
-rw-r--r--include/linux/nfs4.h18
-rw-r--r--include/linux/nfs_fs_sb.h67
-rw-r--r--include/linux/nfs_xdr.h171
-rw-r--r--include/linux/nfsd/cache.h3
-rw-r--r--include/linux/nfsd/export.h6
-rw-r--r--include/linux/nfsd/nfsfh.h7
-rw-r--r--include/linux/nfsd/state.h45
-rw-r--r--include/linux/nfsd/xdr4.h28
-rw-r--r--include/linux/nl80211.h178
-rw-r--r--include/linux/nl802154.h119
-rw-r--r--include/linux/nls.h35
-rw-r--r--include/linux/nodemask.h19
-rw-r--r--include/linux/notifier.h1
-rw-r--r--include/linux/of.h3
-rw-r--r--include/linux/of_mdio.h22
-rw-r--r--include/linux/page-flags.h18
-rw-r--r--include/linux/page_cgroup.h18
-rw-r--r--include/linux/pagemap.h12
-rw-r--r--include/linux/pci-acpi.h4
-rw-r--r--include/linux/pci.h45
-rw-r--r--include/linux/pci_hotplug.h24
-rw-r--r--include/linux/pci_ids.h62
-rw-r--r--include/linux/pci_regs.h14
-rw-r--r--include/linux/percpu.h5
-rw-r--r--include/linux/perf_counter.h728
-rw-r--r--include/linux/phy.h10
-rw-r--r--include/linux/pipe_fs_i.h1
-rw-r--r--include/linux/platform_device.h4
-rw-r--r--include/linux/pm.h11
-rw-r--r--include/linux/pnp.h2
-rw-r--r--include/linux/poll.h3
-rw-r--r--include/linux/pps.h122
-rw-r--r--include/linux/pps_kernel.h89
-rw-r--r--include/linux/prctl.h3
-rw-r--r--include/linux/proc_fs.h24
-rw-r--r--include/linux/ptrace.h11
-rw-r--r--include/linux/qnx4_fs.h61
-rw-r--r--include/linux/quotaops.h20
-rw-r--r--include/linux/radix-tree.h2
-rw-r--r--include/linux/raid/md_p.h2
-rw-r--r--include/linux/rational.h19
-rw-r--r--include/linux/rculist.h30
-rw-r--r--include/linux/rcutree.h9
-rw-r--r--include/linux/regulator/lp3971.h51
-rw-r--r--include/linux/regulator/max1586.h63
-rw-r--r--include/linux/regulator/userspace-consumer.h25
-rw-r--r--include/linux/reiserfs_fs.h47
-rw-r--r--include/linux/reiserfs_fs_sb.h2
-rw-r--r--include/linux/res_counter.h2
-rw-r--r--include/linux/rfkill.h410
-rw-r--r--include/linux/ring_buffer.h70
-rw-r--r--include/linux/rmap.h19
-rw-r--r--include/linux/rotary_encoder.h2
-rw-r--r--include/linux/sched.h116
-rw-r--r--include/linux/sctp.h20
-rw-r--r--include/linux/section-names.h6
-rw-r--r--include/linux/security.h2
-rw-r--r--include/linux/seq_file.h1
-rw-r--r--include/linux/serial.h116
-rw-r--r--include/linux/serial_core.h9
-rw-r--r--include/linux/serial_reg.h1
-rw-r--r--include/linux/serial_sci.h3
-rw-r--r--include/linux/serio.h9
-rw-r--r--include/linux/sh_cmt.h13
-rw-r--r--include/linux/sh_timer.h13
-rw-r--r--include/linux/signal.h2
-rw-r--r--include/linux/skbuff.h73
-rw-r--r--include/linux/slab.h11
-rw-r--r--include/linux/slab_def.h83
-rw-r--r--include/linux/slob_def.h5
-rw-r--r--include/linux/slub_def.h4
-rw-r--r--include/linux/smp.h1
-rw-r--r--include/linux/smsc911x.h10
-rw-r--r--include/linux/snmp.h10
-rw-r--r--include/linux/socket.h11
-rw-r--r--include/linux/spi/ads7846.h1
-rw-r--r--include/linux/spi/libertas_spi.h3
-rw-r--r--include/linux/spi/spi.h28
-rw-r--r--include/linux/spi/wl12xx.h31
-rw-r--r--include/linux/spinlock_up.h1
-rw-r--r--include/linux/splice.h3
-rw-r--r--include/linux/stacktrace.h3
-rw-r--r--include/linux/sunrpc/bc_xprt.h49
-rw-r--r--include/linux/sunrpc/clnt.h1
-rw-r--r--include/linux/sunrpc/sched.h3
-rw-r--r--include/linux/sunrpc/svc.h11
-rw-r--r--include/linux/sunrpc/svc_xprt.h7
-rw-r--r--include/linux/sunrpc/svcsock.h9
-rw-r--r--include/linux/sunrpc/xprt.h38
-rw-r--r--include/linux/suspend.h18
-rw-r--r--include/linux/swap.h65
-rw-r--r--include/linux/swiotlb.h3
-rw-r--r--include/linux/syscalls.h8
-rw-r--r--include/linux/tcp.h4
-rw-r--r--include/linux/thread_info.h3
-rw-r--r--include/linux/tick.h3
-rw-r--r--include/linux/time.h15
-rw-r--r--include/linux/timer.h3
-rw-r--r--include/linux/timex.h45
-rw-r--r--include/linux/trace_seq.h94
-rw-r--r--include/linux/tracehook.h2
-rw-r--r--include/linux/tracepoint.h12
-rw-r--r--include/linux/tty.h18
-rw-r--r--include/linux/tty_driver.h6
-rw-r--r--include/linux/types.h2
-rw-r--r--include/linux/ucb1400.h23
-rw-r--r--include/linux/ultrasound.h2
-rw-r--r--include/linux/usb.h37
-rw-r--r--include/linux/usb/audio.h265
-rw-r--r--include/linux/usb/ch9.h17
-rw-r--r--include/linux/usb/composite.h3
-rw-r--r--include/linux/usb/langwell_otg.h177
-rw-r--r--include/linux/usb/langwell_udc.h310
-rw-r--r--include/linux/usb/otg.h4
-rw-r--r--include/linux/usb/r8a66597.h44
-rw-r--r--include/linux/usb/serial.h42
-rw-r--r--include/linux/usb/usbnet.h1
-rw-r--r--include/linux/utsname.h12
-rw-r--r--include/linux/videodev2.h7
-rw-r--r--include/linux/virtio.h15
-rw-r--r--include/linux/virtio_blk.h12
-rw-r--r--include/linux/virtio_config.h49
-rw-r--r--include/linux/virtio_pci.h10
-rw-r--r--include/linux/virtio_ring.h8
-rw-r--r--include/linux/vlynq.h161
-rw-r--r--include/linux/vmstat.h5
-rw-r--r--include/linux/w1-gpio.h1
-rw-r--r--include/linux/wait.h2
-rw-r--r--include/linux/wimax.h7
-rw-r--r--include/linux/wimax/i2400m.h2
-rw-r--r--include/linux/writeback.h1
-rw-r--r--include/media/adv7343.h23
-rw-r--r--include/media/ir-common.h2
-rw-r--r--include/media/ir-kbd-i2c.h10
-rw-r--r--include/media/soc_camera.h10
-rw-r--r--include/media/tuner.h2
-rw-r--r--include/media/v4l2-chip-ident.h6
-rw-r--r--include/media/v4l2-common.h26
-rw-r--r--include/media/v4l2-device.h23
-rw-r--r--include/media/v4l2-i2c-drv.h5
-rw-r--r--include/media/v4l2-subdev.h12
-rw-r--r--include/mtd/Kbuild1
-rw-r--r--include/mtd/jffs2-user.h34
-rw-r--r--include/mtd/mtd-abi.h15
-rw-r--r--include/net/bluetooth/bluetooth.h15
-rw-r--r--include/net/bluetooth/hci_core.h2
-rw-r--r--include/net/bluetooth/l2cap.h71
-rw-r--r--include/net/cfg80211.h1059
-rw-r--r--include/net/dst.h12
-rw-r--r--include/net/fib_rules.h2
-rw-r--r--include/net/genetlink.h2
-rw-r--r--include/net/ieee802154/af_ieee802154.h60
-rw-r--r--include/net/ieee802154/mac_def.h160
-rw-r--r--include/net/ieee802154/netdevice.h115
-rw-r--r--include/net/ieee802154/nl802154.h41
-rw-r--r--include/net/inet6_hashtables.h2
-rw-r--r--include/net/inet_hashtables.h2
-rw-r--r--include/net/inet_sock.h17
-rw-r--r--include/net/inet_timewait_sock.h5
-rw-r--r--include/net/ip.h3
-rw-r--r--include/net/ip6_route.h2
-rw-r--r--include/net/ip_fib.h3
-rw-r--r--include/net/ipip.h7
-rw-r--r--include/net/ipv6.h15
-rw-r--r--include/net/iucv/af_iucv.h11
-rw-r--r--include/net/mac80211.h264
-rw-r--r--include/net/netfilter/ipv4/nf_conntrack_icmp.h11
-rw-r--r--include/net/netfilter/ipv6/nf_conntrack_icmpv6.h7
-rw-r--r--include/net/netfilter/nf_conntrack.h11
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h206
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h2
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h2
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h4
-rw-r--r--include/net/netlink.h9
-rw-r--r--include/net/netns/conntrack.h7
-rw-r--r--include/net/pkt_sched.h11
-rw-r--r--include/net/regulatory.h101
-rw-r--r--include/net/route.h2
-rw-r--r--include/net/sctp/structs.h6
-rw-r--r--include/net/sctp/user.h2
-rw-r--r--include/net/snmp.h19
-rw-r--r--include/net/sock.h41
-rw-r--r--include/net/tcp.h59
-rw-r--r--include/net/wimax.h8
-rw-r--r--include/net/wireless.h472
-rw-r--r--include/net/x25.h2
-rw-r--r--include/net/xfrm.h4
-rw-r--r--include/scsi/Kbuild4
-rw-r--r--include/scsi/fc/fc_fip.h7
-rw-r--r--include/scsi/fc_encode.h2
-rw-r--r--include/scsi/iscsi_if.h49
-rw-r--r--include/scsi/libfc.h78
-rw-r--r--include/scsi/libfcoe.h2
-rw-r--r--include/scsi/libiscsi.h12
-rw-r--r--include/scsi/osd_attributes.h74
-rw-r--r--include/scsi/osd_initiator.h14
-rw-r--r--include/scsi/osd_protocol.h8
-rw-r--r--include/scsi/scsi_bsg_fc.h322
-rw-r--r--include/scsi/scsi_cmnd.h2
-rw-r--r--include/scsi/scsi_driver.h1
-rw-r--r--include/scsi/scsi_host.h9
-rw-r--r--include/scsi/scsi_transport_fc.h52
-rw-r--r--include/scsi/scsi_transport_iscsi.h8
-rw-r--r--include/scsi/scsi_transport_spi.h4
-rw-r--r--include/sound/asound.h1
-rw-r--r--include/sound/core.h11
-rw-r--r--include/sound/driver.h1
-rw-r--r--include/sound/pcm.h76
-rw-r--r--include/sound/soc-dai.h30
-rw-r--r--include/sound/soc-dapm.h24
-rw-r--r--include/sound/soc.h34
-rw-r--r--include/sound/wm9081.h25
-rw-r--r--include/trace/block.h76
-rw-r--r--include/trace/define_trace.h75
-rw-r--r--include/trace/events/block.h493
-rw-r--r--include/trace/events/ext4.h719
-rw-r--r--include/trace/events/irq.h145
-rw-r--r--include/trace/events/jbd2.h168
-rw-r--r--include/trace/events/kmem.h231
-rw-r--r--include/trace/events/lockdep.h96
-rw-r--r--include/trace/events/napi.h11
-rw-r--r--include/trace/events/sched.h (renamed from include/trace/sched_event_types.h)29
-rw-r--r--include/trace/events/skb.h40
-rw-r--r--include/trace/events/workqueue.h100
-rw-r--r--include/trace/ftrace.h591
-rw-r--r--include/trace/irq.h9
-rw-r--r--include/trace/irq_event_types.h55
-rw-r--r--include/trace/kmemtrace.h63
-rw-r--r--include/trace/lockdep.h9
-rw-r--r--include/trace/lockdep_event_types.h44
-rw-r--r--include/trace/sched.h9
-rw-r--r--include/trace/skb.h11
-rw-r--r--include/trace/trace_event_types.h5
-rw-r--r--include/trace/trace_events.h5
-rw-r--r--include/trace/workqueue.h25
-rw-r--r--include/video/pxa168fb.h127
-rw-r--r--include/video/s1d13xxxfb.h9
-rw-r--r--include/xen/Kbuild1
-rw-r--r--include/xen/events.h3
-rw-r--r--include/xen/evtchn.h88
-rw-r--r--include/xen/interface/version.h3
-rw-r--r--include/xen/xenbus.h3
498 files changed, 21786 insertions, 4341 deletions
diff --git a/include/Kbuild b/include/Kbuild
index d8c3e3cbf416..8d226bfa2696 100644
--- a/include/Kbuild
+++ b/include/Kbuild
@@ -8,3 +8,5 @@ header-y += mtd/
8header-y += rdma/ 8header-y += rdma/
9header-y += video/ 9header-y += video/
10header-y += drm/ 10header-y += drm/
11header-y += xen/
12header-y += scsi/
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 0be24101a48f..bf1f43bd9016 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -365,10 +365,10 @@ struct acpi_bus_type {
365int register_acpi_bus_type(struct acpi_bus_type *); 365int register_acpi_bus_type(struct acpi_bus_type *);
366int unregister_acpi_bus_type(struct acpi_bus_type *); 366int unregister_acpi_bus_type(struct acpi_bus_type *);
367struct device *acpi_get_physical_device(acpi_handle); 367struct device *acpi_get_physical_device(acpi_handle);
368struct device *acpi_get_physical_pci_device(acpi_handle);
369 368
370/* helper */ 369/* helper */
371acpi_handle acpi_get_child(acpi_handle, acpi_integer); 370acpi_handle acpi_get_child(acpi_handle, acpi_integer);
371int acpi_is_root_bridge(acpi_handle);
372acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); 372acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
373#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle)) 373#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
374 374
diff --git a/include/acpi/acpi_drivers.h b/include/acpi/acpi_drivers.h
index 0352c8f0b05b..f4906f6568d4 100644
--- a/include/acpi/acpi_drivers.h
+++ b/include/acpi/acpi_drivers.h
@@ -57,8 +57,7 @@
57 */ 57 */
58 58
59#define ACPI_POWER_HID "LNXPOWER" 59#define ACPI_POWER_HID "LNXPOWER"
60#define ACPI_PROCESSOR_OBJECT_HID "ACPI_CPU" 60#define ACPI_PROCESSOR_OBJECT_HID "LNXCPU"
61#define ACPI_PROCESSOR_HID "ACPI0007"
62#define ACPI_SYSTEM_HID "LNXSYSTM" 61#define ACPI_SYSTEM_HID "LNXSYSTM"
63#define ACPI_THERMAL_HID "LNXTHERM" 62#define ACPI_THERMAL_HID "LNXTHERM"
64#define ACPI_BUTTON_HID_POWERF "LNXPWRBN" 63#define ACPI_BUTTON_HID_POWERF "LNXPWRBN"
@@ -91,17 +90,15 @@ int acpi_pci_link_free_irq(acpi_handle handle);
91 90
92/* ACPI PCI Interrupt Routing (pci_irq.c) */ 91/* ACPI PCI Interrupt Routing (pci_irq.c) */
93 92
94int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus); 93int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus);
95void acpi_pci_irq_del_prt(int segment, int bus); 94void acpi_pci_irq_del_prt(struct pci_bus *bus);
96 95
97/* ACPI PCI Device Binding (pci_bind.c) */ 96/* ACPI PCI Device Binding (pci_bind.c) */
98 97
99struct pci_bus; 98struct pci_bus;
100 99
101acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id); 100struct pci_dev *acpi_get_pci_dev(acpi_handle);
102int acpi_pci_bind(struct acpi_device *device); 101int acpi_pci_bind_root(struct acpi_device *device);
103int acpi_pci_bind_root(struct acpi_device *device, struct acpi_pci_id *id,
104 struct pci_bus *bus);
105 102
106/* Arch-defined function to add a bus to the system */ 103/* Arch-defined function to add a bus to the system */
107 104
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 4db89e98535d..82ec6a3c0500 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 0x20090320 50#define ACPI_CA_VERSION 0x20090521
51 51
52#include "actypes.h" 52#include "actypes.h"
53#include "actbl.h" 53#include "actbl.h"
@@ -201,6 +201,8 @@ acpi_evaluate_object_typed(acpi_handle object,
201acpi_status 201acpi_status
202acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer); 202acpi_get_object_info(acpi_handle handle, struct acpi_buffer *return_buffer);
203 203
204acpi_status acpi_install_method(u8 *buffer);
205
204acpi_status 206acpi_status
205acpi_get_next_object(acpi_object_type type, 207acpi_get_next_object(acpi_object_type type,
206 acpi_handle parent, 208 acpi_handle parent,
@@ -375,7 +377,7 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state);
375acpi_status acpi_leave_sleep_state(u8 sleep_state); 377acpi_status acpi_leave_sleep_state(u8 sleep_state);
376 378
377/* 379/*
378 * Debug output 380 * Error/Warning output
379 */ 381 */
380void ACPI_INTERNAL_VAR_XFACE 382void ACPI_INTERNAL_VAR_XFACE
381acpi_error(const char *module_name, 383acpi_error(const char *module_name,
@@ -394,6 +396,9 @@ void ACPI_INTERNAL_VAR_XFACE
394acpi_info(const char *module_name, 396acpi_info(const char *module_name,
395 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3); 397 u32 line_number, const char *format, ...) ACPI_PRINTF_LIKE(3);
396 398
399/*
400 * Debug output
401 */
397#ifdef ACPI_DEBUG_OUTPUT 402#ifdef ACPI_DEBUG_OUTPUT
398 403
399void ACPI_INTERNAL_VAR_XFACE 404void ACPI_INTERNAL_VAR_XFACE
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index f555d927f7c0..37ba576d06e8 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -429,20 +429,12 @@ typedef unsigned long long acpi_integer;
429 429
430/* Data manipulation */ 430/* Data manipulation */
431 431
432#define ACPI_LOWORD(l) ((u16)(u32)(l)) 432#define ACPI_LOBYTE(integer) ((u8) (u16)(integer))
433#define ACPI_HIWORD(l) ((u16)((((u32)(l)) >> 16) & 0xFFFF)) 433#define ACPI_HIBYTE(integer) ((u8) (((u16)(integer)) >> 8))
434#define ACPI_LOBYTE(l) ((u8)(u16)(l)) 434#define ACPI_LOWORD(integer) ((u16) (u32)(integer))
435#define ACPI_HIBYTE(l) ((u8)((((u16)(l)) >> 8) & 0xFF)) 435#define ACPI_HIWORD(integer) ((u16)(((u32)(integer)) >> 16))
436 436#define ACPI_LODWORD(integer64) ((u32) (u64)(integer64))
437/* Full 64-bit integer must be available on both 32-bit and 64-bit platforms */ 437#define ACPI_HIDWORD(integer64) ((u32)(((u64)(integer64)) >> 32))
438
439struct acpi_integer_overlay {
440 u32 lo_dword;
441 u32 hi_dword;
442};
443
444#define ACPI_LODWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->lo_dword)
445#define ACPI_HIDWORD(integer) (ACPI_CAST_PTR (struct acpi_integer_overlay, &integer)->hi_dword)
446 438
447#define ACPI_SET_BIT(target,bit) ((target) |= (bit)) 439#define ACPI_SET_BIT(target,bit) ((target) |= (bit))
448#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit)) 440#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit))
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
index 8e2cdc57b197..935c5d7fc86e 100644
--- a/include/acpi/platform/acgcc.h
+++ b/include/acpi/platform/acgcc.h
@@ -62,4 +62,8 @@
62 */ 62 */
63#define ACPI_UNUSED_VAR __attribute__ ((unused)) 63#define ACPI_UNUSED_VAR __attribute__ ((unused))
64 64
65#ifdef _ANSI
66#define inline
67#endif
68
65#endif /* __ACGCC_H__ */ 69#endif /* __ACGCC_H__ */
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index 6d49b2a498c4..fcb8e4b159b1 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -1,11 +1,11 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Name: aclinux.h - OS specific defines, etc. 3 * Name: aclinux.h - OS specific defines, etc. for Linux
4 * 4 *
5 *****************************************************************************/ 5 *****************************************************************************/
6 6
7/* 7/*
8 * Copyright (C) 2000 - 2008, Intel Corp. 8 * Copyright (C) 2000 - 2009, Intel Corp.
9 * All rights reserved. 9 * All rights reserved.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
@@ -44,10 +44,13 @@
44#ifndef __ACLINUX_H__ 44#ifndef __ACLINUX_H__
45#define __ACLINUX_H__ 45#define __ACLINUX_H__
46 46
47/* Common (in-kernel/user-space) ACPICA configuration */
48
47#define ACPI_USE_SYSTEM_CLIBRARY 49#define ACPI_USE_SYSTEM_CLIBRARY
48#define ACPI_USE_DO_WHILE_0 50#define ACPI_USE_DO_WHILE_0
49#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE 51#define ACPI_MUTEX_TYPE ACPI_BINARY_SEMAPHORE
50 52
53
51#ifdef __KERNEL__ 54#ifdef __KERNEL__
52 55
53#include <linux/string.h> 56#include <linux/string.h>
@@ -63,15 +66,18 @@
63#include <linux/spinlock_types.h> 66#include <linux/spinlock_types.h>
64#include <asm/current.h> 67#include <asm/current.h>
65 68
66/* Host-dependent types and defines */ 69/* Host-dependent types and defines for in-kernel ACPICA */
67 70
68#define ACPI_MACHINE_WIDTH BITS_PER_LONG 71#define ACPI_MACHINE_WIDTH BITS_PER_LONG
69#define acpi_cache_t struct kmem_cache
70#define acpi_spinlock spinlock_t *
71#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); 72#define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol);
72#define strtoul simple_strtoul 73#define strtoul simple_strtoul
73 74
74#else /* !__KERNEL__ */ 75#define acpi_cache_t struct kmem_cache
76#define acpi_spinlock spinlock_t *
77#define acpi_cpu_flags unsigned long
78#define acpi_thread_id struct task_struct *
79
80#else /* !__KERNEL__ */
75 81
76#include <stdarg.h> 82#include <stdarg.h>
77#include <string.h> 83#include <string.h>
@@ -79,6 +85,11 @@
79#include <ctype.h> 85#include <ctype.h>
80#include <unistd.h> 86#include <unistd.h>
81 87
88/* Host-dependent types and defines for user-space ACPICA */
89
90#define ACPI_FLUSH_CPU_CACHE()
91#define acpi_thread_id pthread_t
92
82#if defined(__ia64__) || defined(__x86_64__) 93#if defined(__ia64__) || defined(__x86_64__)
83#define ACPI_MACHINE_WIDTH 64 94#define ACPI_MACHINE_WIDTH 64
84#define COMPILER_DEPENDENT_INT64 long 95#define COMPILER_DEPENDENT_INT64 long
@@ -94,17 +105,17 @@
94#define __cdecl 105#define __cdecl
95#endif 106#endif
96 107
97#define ACPI_FLUSH_CPU_CACHE() 108#endif /* __KERNEL__ */
98#endif /* __KERNEL__ */
99 109
100/* Linux uses GCC */ 110/* Linux uses GCC */
101 111
102#include "acgcc.h" 112#include "acgcc.h"
103 113
104#define acpi_cpu_flags unsigned long
105
106#define acpi_thread_id struct task_struct *
107 114
115#ifdef __KERNEL__
116/*
117 * Overrides for in-kernel ACPICA
118 */
108static inline acpi_thread_id acpi_os_get_thread_id(void) 119static inline acpi_thread_id acpi_os_get_thread_id(void)
109{ 120{
110 return current; 121 return current;
@@ -119,30 +130,32 @@ static inline acpi_thread_id acpi_os_get_thread_id(void)
119#include <acpi/actypes.h> 130#include <acpi/actypes.h>
120static inline void *acpi_os_allocate(acpi_size size) 131static inline void *acpi_os_allocate(acpi_size size)
121{ 132{
122 return kmalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); 133 return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
123} 134}
135
124static inline void *acpi_os_allocate_zeroed(acpi_size size) 136static inline void *acpi_os_allocate_zeroed(acpi_size size)
125{ 137{
126 return kzalloc(size, irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); 138 return kzalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
127} 139}
128 140
129static inline void *acpi_os_acquire_object(acpi_cache_t * cache) 141static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
130{ 142{
131 return kmem_cache_zalloc(cache, 143 return kmem_cache_zalloc(cache,
132 irqs_disabled()? GFP_ATOMIC : GFP_KERNEL); 144 irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
133} 145}
134 146
135#define ACPI_ALLOCATE(a) acpi_os_allocate(a) 147#define ACPI_ALLOCATE(a) acpi_os_allocate(a)
136#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a) 148#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a)
137#define ACPI_FREE(a) kfree(a) 149#define ACPI_FREE(a) kfree(a)
138 150
139/* 151/* Used within ACPICA to show where it is safe to preempt execution */
140 * We need to show where it is safe to preempt execution of ACPICA 152
141 */ 153#define ACPI_PREEMPTION_POINT() \
142#define ACPI_PREEMPTION_POINT() \ 154 do { \
143 do { \ 155 if (!irqs_disabled()) \
144 if (!irqs_disabled()) \ 156 cond_resched(); \
145 cond_resched(); \
146 } while (0) 157 } while (0)
147 158
148#endif /* __ACLINUX_H__ */ 159#endif /* __KERNEL__ */
160
161#endif /* __ACLINUX_H__ */
diff --git a/include/acpi/processor.h b/include/acpi/processor.h
index 4927c063347c..baf1e0a9a7ee 100644
--- a/include/acpi/processor.h
+++ b/include/acpi/processor.h
@@ -258,6 +258,7 @@ DECLARE_PER_CPU(struct acpi_processor *, processors);
258extern struct acpi_processor_errata errata; 258extern struct acpi_processor_errata errata;
259 259
260void arch_acpi_processor_init_pdc(struct acpi_processor *pr); 260void arch_acpi_processor_init_pdc(struct acpi_processor *pr);
261void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr);
261 262
262#ifdef ARCH_HAS_POWER_INIT 263#ifdef ARCH_HAS_POWER_INIT
263void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, 264void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
diff --git a/include/acpi/video.h b/include/acpi/video.h
index af6fe95fd3d0..cf7be3dd157b 100644
--- a/include/acpi/video.h
+++ b/include/acpi/video.h
@@ -3,10 +3,10 @@
3 3
4#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE) 4#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
5extern int acpi_video_register(void); 5extern int acpi_video_register(void);
6extern int acpi_video_exit(void); 6extern void acpi_video_unregister(void);
7#else 7#else
8static inline int acpi_video_register(void) { return 0; } 8static inline int acpi_video_register(void) { return 0; }
9static inline void acpi_video_exit(void) { return; } 9static inline void acpi_video_unregister(void) { return; }
10#endif 10#endif
11 11
12#endif 12#endif
diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
index 4c9932a2503f..eb62334cda29 100644
--- a/include/asm-generic/Kbuild
+++ b/include/asm-generic/Kbuild
@@ -1,11 +1,33 @@
1header-y += auxvec.h
2header-y += bitsperlong.h
1header-y += errno-base.h 3header-y += errno-base.h
2header-y += errno.h 4header-y += errno.h
3header-y += fcntl.h 5header-y += fcntl.h
4header-y += ioctl.h 6header-y += ioctl.h
7header-y += ioctls.h
8header-y += ipcbuf.h
9header-y += mman-common.h
5header-y += mman.h 10header-y += mman.h
11header-y += msgbuf.h
12header-y += param.h
6header-y += poll.h 13header-y += poll.h
14header-y += posix_types.h
15header-y += sembuf.h
16header-y += setup.h
17header-y += shmbuf.h
18header-y += shmparam.h
19header-y += signal-defs.h
7header-y += signal.h 20header-y += signal.h
21header-y += socket.h
22header-y += sockios.h
23header-y += stat.h
8header-y += statfs.h 24header-y += statfs.h
25header-y += swab.h
26header-y += termbits.h
27header-y += termios.h
28header-y += types.h
29header-y += ucontext.h
30header-y += unistd.h
9 31
10unifdef-y += int-l64.h 32unifdef-y += int-l64.h
11unifdef-y += int-ll64.h 33unifdef-y += int-ll64.h
diff --git a/include/asm-generic/Kbuild.asm b/include/asm-generic/Kbuild.asm
index 70d185534b9d..290910e4ede4 100644
--- a/include/asm-generic/Kbuild.asm
+++ b/include/asm-generic/Kbuild.asm
@@ -9,6 +9,7 @@ unifdef-y += a.out.h
9endif 9endif
10unifdef-y += auxvec.h 10unifdef-y += auxvec.h
11unifdef-y += byteorder.h 11unifdef-y += byteorder.h
12unifdef-y += bitsperlong.h
12unifdef-y += errno.h 13unifdef-y += errno.h
13unifdef-y += fcntl.h 14unifdef-y += fcntl.h
14unifdef-y += ioctl.h 15unifdef-y += ioctl.h
diff --git a/include/asm-generic/atomic-long.h b/include/asm-generic/atomic-long.h
new file mode 100644
index 000000000000..b7babf0206b8
--- /dev/null
+++ b/include/asm-generic/atomic-long.h
@@ -0,0 +1,258 @@
1#ifndef _ASM_GENERIC_ATOMIC_LONG_H
2#define _ASM_GENERIC_ATOMIC_LONG_H
3/*
4 * Copyright (C) 2005 Silicon Graphics, Inc.
5 * Christoph Lameter
6 *
7 * Allows to provide arch independent atomic definitions without the need to
8 * edit all arch specific atomic.h files.
9 */
10
11#include <asm/types.h>
12
13/*
14 * Suppport for atomic_long_t
15 *
16 * Casts for parameters are avoided for existing atomic functions in order to
17 * avoid issues with cast-as-lval under gcc 4.x and other limitations that the
18 * macros of a platform may have.
19 */
20
21#if BITS_PER_LONG == 64
22
23typedef atomic64_t atomic_long_t;
24
25#define ATOMIC_LONG_INIT(i) ATOMIC64_INIT(i)
26
27static inline long atomic_long_read(atomic_long_t *l)
28{
29 atomic64_t *v = (atomic64_t *)l;
30
31 return (long)atomic64_read(v);
32}
33
34static inline void atomic_long_set(atomic_long_t *l, long i)
35{
36 atomic64_t *v = (atomic64_t *)l;
37
38 atomic64_set(v, i);
39}
40
41static inline void atomic_long_inc(atomic_long_t *l)
42{
43 atomic64_t *v = (atomic64_t *)l;
44
45 atomic64_inc(v);
46}
47
48static inline void atomic_long_dec(atomic_long_t *l)
49{
50 atomic64_t *v = (atomic64_t *)l;
51
52 atomic64_dec(v);
53}
54
55static inline void atomic_long_add(long i, atomic_long_t *l)
56{
57 atomic64_t *v = (atomic64_t *)l;
58
59 atomic64_add(i, v);
60}
61
62static inline void atomic_long_sub(long i, atomic_long_t *l)
63{
64 atomic64_t *v = (atomic64_t *)l;
65
66 atomic64_sub(i, v);
67}
68
69static inline int atomic_long_sub_and_test(long i, atomic_long_t *l)
70{
71 atomic64_t *v = (atomic64_t *)l;
72
73 return atomic64_sub_and_test(i, v);
74}
75
76static inline int atomic_long_dec_and_test(atomic_long_t *l)
77{
78 atomic64_t *v = (atomic64_t *)l;
79
80 return atomic64_dec_and_test(v);
81}
82
83static inline int atomic_long_inc_and_test(atomic_long_t *l)
84{
85 atomic64_t *v = (atomic64_t *)l;
86
87 return atomic64_inc_and_test(v);
88}
89
90static inline int atomic_long_add_negative(long i, atomic_long_t *l)
91{
92 atomic64_t *v = (atomic64_t *)l;
93
94 return atomic64_add_negative(i, v);
95}
96
97static inline long atomic_long_add_return(long i, atomic_long_t *l)
98{
99 atomic64_t *v = (atomic64_t *)l;
100
101 return (long)atomic64_add_return(i, v);
102}
103
104static inline long atomic_long_sub_return(long i, atomic_long_t *l)
105{
106 atomic64_t *v = (atomic64_t *)l;
107
108 return (long)atomic64_sub_return(i, v);
109}
110
111static inline long atomic_long_inc_return(atomic_long_t *l)
112{
113 atomic64_t *v = (atomic64_t *)l;
114
115 return (long)atomic64_inc_return(v);
116}
117
118static inline long atomic_long_dec_return(atomic_long_t *l)
119{
120 atomic64_t *v = (atomic64_t *)l;
121
122 return (long)atomic64_dec_return(v);
123}
124
125static inline long atomic_long_add_unless(atomic_long_t *l, long a, long u)
126{
127 atomic64_t *v = (atomic64_t *)l;
128
129 return (long)atomic64_add_unless(v, a, u);
130}
131
132#define atomic_long_inc_not_zero(l) atomic64_inc_not_zero((atomic64_t *)(l))
133
134#define atomic_long_cmpxchg(l, old, new) \
135 (atomic64_cmpxchg((atomic64_t *)(l), (old), (new)))
136#define atomic_long_xchg(v, new) \
137 (atomic64_xchg((atomic64_t *)(v), (new)))
138
139#else /* BITS_PER_LONG == 64 */
140
141typedef atomic_t atomic_long_t;
142
143#define ATOMIC_LONG_INIT(i) ATOMIC_INIT(i)
144static inline long atomic_long_read(atomic_long_t *l)
145{
146 atomic_t *v = (atomic_t *)l;
147
148 return (long)atomic_read(v);
149}
150
151static inline void atomic_long_set(atomic_long_t *l, long i)
152{
153 atomic_t *v = (atomic_t *)l;
154
155 atomic_set(v, i);
156}
157
158static inline void atomic_long_inc(atomic_long_t *l)
159{
160 atomic_t *v = (atomic_t *)l;
161
162 atomic_inc(v);
163}
164
165static inline void atomic_long_dec(atomic_long_t *l)
166{
167 atomic_t *v = (atomic_t *)l;
168
169 atomic_dec(v);
170}
171
172static inline void atomic_long_add(long i, atomic_long_t *l)
173{
174 atomic_t *v = (atomic_t *)l;
175
176 atomic_add(i, v);
177}
178
179static inline void atomic_long_sub(long i, atomic_long_t *l)
180{
181 atomic_t *v = (atomic_t *)l;
182
183 atomic_sub(i, v);
184}
185
186static inline int atomic_long_sub_and_test(long i, atomic_long_t *l)
187{
188 atomic_t *v = (atomic_t *)l;
189
190 return atomic_sub_and_test(i, v);
191}
192
193static inline int atomic_long_dec_and_test(atomic_long_t *l)
194{
195 atomic_t *v = (atomic_t *)l;
196
197 return atomic_dec_and_test(v);
198}
199
200static inline int atomic_long_inc_and_test(atomic_long_t *l)
201{
202 atomic_t *v = (atomic_t *)l;
203
204 return atomic_inc_and_test(v);
205}
206
207static inline int atomic_long_add_negative(long i, atomic_long_t *l)
208{
209 atomic_t *v = (atomic_t *)l;
210
211 return atomic_add_negative(i, v);
212}
213
214static inline long atomic_long_add_return(long i, atomic_long_t *l)
215{
216 atomic_t *v = (atomic_t *)l;
217
218 return (long)atomic_add_return(i, v);
219}
220
221static inline long atomic_long_sub_return(long i, atomic_long_t *l)
222{
223 atomic_t *v = (atomic_t *)l;
224
225 return (long)atomic_sub_return(i, v);
226}
227
228static inline long atomic_long_inc_return(atomic_long_t *l)
229{
230 atomic_t *v = (atomic_t *)l;
231
232 return (long)atomic_inc_return(v);
233}
234
235static inline long atomic_long_dec_return(atomic_long_t *l)
236{
237 atomic_t *v = (atomic_t *)l;
238
239 return (long)atomic_dec_return(v);
240}
241
242static inline long atomic_long_add_unless(atomic_long_t *l, long a, long u)
243{
244 atomic_t *v = (atomic_t *)l;
245
246 return (long)atomic_add_unless(v, a, u);
247}
248
249#define atomic_long_inc_not_zero(l) atomic_inc_not_zero((atomic_t *)(l))
250
251#define atomic_long_cmpxchg(l, old, new) \
252 (atomic_cmpxchg((atomic_t *)(l), (old), (new)))
253#define atomic_long_xchg(v, new) \
254 (atomic_xchg((atomic_t *)(v), (new)))
255
256#endif /* BITS_PER_LONG == 64 */
257
258#endif /* _ASM_GENERIC_ATOMIC_LONG_H */
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 3673a13b6703..c99c64dc5f3d 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -1,258 +1,165 @@
1#ifndef _ASM_GENERIC_ATOMIC_H
2#define _ASM_GENERIC_ATOMIC_H
3/* 1/*
4 * Copyright (C) 2005 Silicon Graphics, Inc. 2 * Generic C implementation of atomic counter operations
5 * Christoph Lameter 3 * Originally implemented for MN10300.
6 * 4 *
7 * Allows to provide arch independent atomic definitions without the need to 5 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
8 * edit all arch specific atomic.h files. 6 * Written by David Howells (dhowells@redhat.com)
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public Licence
10 * as published by the Free Software Foundation; either version
11 * 2 of the Licence, or (at your option) any later version.
9 */ 12 */
13#ifndef __ASM_GENERIC_ATOMIC_H
14#define __ASM_GENERIC_ATOMIC_H
10 15
11#include <asm/types.h> 16#ifdef CONFIG_SMP
17#error not SMP safe
18#endif
12 19
13/* 20/*
14 * Suppport for atomic_long_t 21 * Atomic operations that C can't guarantee us. Useful for
15 * 22 * resource counting etc..
16 * Casts for parameters are avoided for existing atomic functions in order to
17 * avoid issues with cast-as-lval under gcc 4.x and other limitations that the
18 * macros of a platform may have.
19 */ 23 */
20 24
21#if BITS_PER_LONG == 64 25#define ATOMIC_INIT(i) { (i) }
22
23typedef atomic64_t atomic_long_t;
24
25#define ATOMIC_LONG_INIT(i) ATOMIC64_INIT(i)
26 26
27static inline long atomic_long_read(atomic_long_t *l) 27#ifdef __KERNEL__
28{
29 atomic64_t *v = (atomic64_t *)l;
30
31 return (long)atomic64_read(v);
32}
33
34static inline void atomic_long_set(atomic_long_t *l, long i)
35{
36 atomic64_t *v = (atomic64_t *)l;
37
38 atomic64_set(v, i);
39}
40
41static inline void atomic_long_inc(atomic_long_t *l)
42{
43 atomic64_t *v = (atomic64_t *)l;
44
45 atomic64_inc(v);
46}
47
48static inline void atomic_long_dec(atomic_long_t *l)
49{
50 atomic64_t *v = (atomic64_t *)l;
51
52 atomic64_dec(v);
53}
54
55static inline void atomic_long_add(long i, atomic_long_t *l)
56{
57 atomic64_t *v = (atomic64_t *)l;
58
59 atomic64_add(i, v);
60}
61
62static inline void atomic_long_sub(long i, atomic_long_t *l)
63{
64 atomic64_t *v = (atomic64_t *)l;
65
66 atomic64_sub(i, v);
67}
68
69static inline int atomic_long_sub_and_test(long i, atomic_long_t *l)
70{
71 atomic64_t *v = (atomic64_t *)l;
72
73 return atomic64_sub_and_test(i, v);
74}
75
76static inline int atomic_long_dec_and_test(atomic_long_t *l)
77{
78 atomic64_t *v = (atomic64_t *)l;
79
80 return atomic64_dec_and_test(v);
81}
82
83static inline int atomic_long_inc_and_test(atomic_long_t *l)
84{
85 atomic64_t *v = (atomic64_t *)l;
86
87 return atomic64_inc_and_test(v);
88}
89
90static inline int atomic_long_add_negative(long i, atomic_long_t *l)
91{
92 atomic64_t *v = (atomic64_t *)l;
93
94 return atomic64_add_negative(i, v);
95}
96
97static inline long atomic_long_add_return(long i, atomic_long_t *l)
98{
99 atomic64_t *v = (atomic64_t *)l;
100
101 return (long)atomic64_add_return(i, v);
102}
103
104static inline long atomic_long_sub_return(long i, atomic_long_t *l)
105{
106 atomic64_t *v = (atomic64_t *)l;
107 28
108 return (long)atomic64_sub_return(i, v); 29/**
109} 30 * atomic_read - read atomic variable
110 31 * @v: pointer of type atomic_t
111static inline long atomic_long_inc_return(atomic_long_t *l) 32 *
112{ 33 * Atomically reads the value of @v. Note that the guaranteed
113 atomic64_t *v = (atomic64_t *)l; 34 * useful range of an atomic_t is only 24 bits.
114 35 */
115 return (long)atomic64_inc_return(v); 36#define atomic_read(v) ((v)->counter)
116}
117
118static inline long atomic_long_dec_return(atomic_long_t *l)
119{
120 atomic64_t *v = (atomic64_t *)l;
121
122 return (long)atomic64_dec_return(v);
123}
124
125static inline long atomic_long_add_unless(atomic_long_t *l, long a, long u)
126{
127 atomic64_t *v = (atomic64_t *)l;
128
129 return (long)atomic64_add_unless(v, a, u);
130}
131
132#define atomic_long_inc_not_zero(l) atomic64_inc_not_zero((atomic64_t *)(l))
133
134#define atomic_long_cmpxchg(l, old, new) \
135 (atomic64_cmpxchg((atomic64_t *)(l), (old), (new)))
136#define atomic_long_xchg(v, new) \
137 (atomic64_xchg((atomic64_t *)(l), (new)))
138
139#else /* BITS_PER_LONG == 64 */
140
141typedef atomic_t atomic_long_t;
142
143#define ATOMIC_LONG_INIT(i) ATOMIC_INIT(i)
144static inline long atomic_long_read(atomic_long_t *l)
145{
146 atomic_t *v = (atomic_t *)l;
147
148 return (long)atomic_read(v);
149}
150 37
151static inline void atomic_long_set(atomic_long_t *l, long i) 38/**
152{ 39 * atomic_set - set atomic variable
153 atomic_t *v = (atomic_t *)l; 40 * @v: pointer of type atomic_t
41 * @i: required value
42 *
43 * Atomically sets the value of @v to @i. Note that the guaranteed
44 * useful range of an atomic_t is only 24 bits.
45 */
46#define atomic_set(v, i) (((v)->counter) = (i))
154 47
155 atomic_set(v, i); 48#include <asm/system.h>
156}
157 49
158static inline void atomic_long_inc(atomic_long_t *l) 50/**
51 * atomic_add_return - add integer to atomic variable
52 * @i: integer value to add
53 * @v: pointer of type atomic_t
54 *
55 * Atomically adds @i to @v and returns the result
56 * Note that the guaranteed useful range of an atomic_t is only 24 bits.
57 */
58static inline int atomic_add_return(int i, atomic_t *v)
159{ 59{
160 atomic_t *v = (atomic_t *)l; 60 unsigned long flags;
161 61 int temp;
162 atomic_inc(v);
163}
164 62
165static inline void atomic_long_dec(atomic_long_t *l) 63 local_irq_save(flags);
166{ 64 temp = v->counter;
167 atomic_t *v = (atomic_t *)l; 65 temp += i;
66 v->counter = temp;
67 local_irq_restore(flags);
168 68
169 atomic_dec(v); 69 return temp;
170} 70}
171 71
172static inline void atomic_long_add(long i, atomic_long_t *l) 72/**
73 * atomic_sub_return - subtract integer from atomic variable
74 * @i: integer value to subtract
75 * @v: pointer of type atomic_t
76 *
77 * Atomically subtracts @i from @v and returns the result
78 * Note that the guaranteed useful range of an atomic_t is only 24 bits.
79 */
80static inline int atomic_sub_return(int i, atomic_t *v)
173{ 81{
174 atomic_t *v = (atomic_t *)l; 82 unsigned long flags;
175 83 int temp;
176 atomic_add(i, v);
177}
178 84
179static inline void atomic_long_sub(long i, atomic_long_t *l) 85 local_irq_save(flags);
180{ 86 temp = v->counter;
181 atomic_t *v = (atomic_t *)l; 87 temp -= i;
88 v->counter = temp;
89 local_irq_restore(flags);
182 90
183 atomic_sub(i, v); 91 return temp;
184} 92}
185 93
186static inline int atomic_long_sub_and_test(long i, atomic_long_t *l) 94static inline int atomic_add_negative(int i, atomic_t *v)
187{ 95{
188 atomic_t *v = (atomic_t *)l; 96 return atomic_add_return(i, v) < 0;
189
190 return atomic_sub_and_test(i, v);
191} 97}
192 98
193static inline int atomic_long_dec_and_test(atomic_long_t *l) 99static inline void atomic_add(int i, atomic_t *v)
194{ 100{
195 atomic_t *v = (atomic_t *)l; 101 atomic_add_return(i, v);
196
197 return atomic_dec_and_test(v);
198} 102}
199 103
200static inline int atomic_long_inc_and_test(atomic_long_t *l) 104static inline void atomic_sub(int i, atomic_t *v)
201{ 105{
202 atomic_t *v = (atomic_t *)l; 106 atomic_sub_return(i, v);
203
204 return atomic_inc_and_test(v);
205} 107}
206 108
207static inline int atomic_long_add_negative(long i, atomic_long_t *l) 109static inline void atomic_inc(atomic_t *v)
208{ 110{
209 atomic_t *v = (atomic_t *)l; 111 atomic_add_return(1, v);
210
211 return atomic_add_negative(i, v);
212} 112}
213 113
214static inline long atomic_long_add_return(long i, atomic_long_t *l) 114static inline void atomic_dec(atomic_t *v)
215{ 115{
216 atomic_t *v = (atomic_t *)l; 116 atomic_sub_return(1, v);
217
218 return (long)atomic_add_return(i, v);
219} 117}
220 118
221static inline long atomic_long_sub_return(long i, atomic_long_t *l) 119#define atomic_dec_return(v) atomic_sub_return(1, (v))
222{ 120#define atomic_inc_return(v) atomic_add_return(1, (v))
223 atomic_t *v = (atomic_t *)l;
224 121
225 return (long)atomic_sub_return(i, v); 122#define atomic_sub_and_test(i, v) (atomic_sub_return((i), (v)) == 0)
226} 123#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
124#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0)
227 125
228static inline long atomic_long_inc_return(atomic_long_t *l) 126#define atomic_add_unless(v, a, u) \
229{ 127({ \
230 atomic_t *v = (atomic_t *)l; 128 int c, old; \
129 c = atomic_read(v); \
130 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \
131 c = old; \
132 c != (u); \
133})
231 134
232 return (long)atomic_inc_return(v); 135#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
233}
234 136
235static inline long atomic_long_dec_return(atomic_long_t *l) 137static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
236{ 138{
237 atomic_t *v = (atomic_t *)l; 139 unsigned long flags;
238 140
239 return (long)atomic_dec_return(v); 141 mask = ~mask;
142 local_irq_save(flags);
143 *addr &= mask;
144 local_irq_restore(flags);
240} 145}
241 146
242static inline long atomic_long_add_unless(atomic_long_t *l, long a, long u) 147#define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v)))
243{ 148#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new)))
244 atomic_t *v = (atomic_t *)l;
245 149
246 return (long)atomic_add_unless(v, a, u); 150#define cmpxchg_local(ptr, o, n) \
247} 151 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
152 (unsigned long)(n), sizeof(*(ptr))))
248 153
249#define atomic_long_inc_not_zero(l) atomic_inc_not_zero((atomic_t *)(l)) 154#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
250 155
251#define atomic_long_cmpxchg(l, old, new) \ 156/* Assume that atomic operations are already serializing */
252 (atomic_cmpxchg((atomic_t *)(l), (old), (new))) 157#define smp_mb__before_atomic_dec() barrier()
253#define atomic_long_xchg(v, new) \ 158#define smp_mb__after_atomic_dec() barrier()
254 (atomic_xchg((atomic_t *)(v), (new))) 159#define smp_mb__before_atomic_inc() barrier()
160#define smp_mb__after_atomic_inc() barrier()
255 161
256#endif /* BITS_PER_LONG == 64 */ 162#include <asm-generic/atomic-long.h>
257 163
258#endif /* _ASM_GENERIC_ATOMIC_H */ 164#endif /* __KERNEL__ */
165#endif /* __ASM_GENERIC_ATOMIC_H */
diff --git a/include/asm-generic/atomic64.h b/include/asm-generic/atomic64.h
new file mode 100644
index 000000000000..b18ce4f9ee3d
--- /dev/null
+++ b/include/asm-generic/atomic64.h
@@ -0,0 +1,42 @@
1/*
2 * Generic implementation of 64-bit atomics using spinlocks,
3 * useful on processors that don't have 64-bit atomic instructions.
4 *
5 * Copyright © 2009 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12#ifndef _ASM_GENERIC_ATOMIC64_H
13#define _ASM_GENERIC_ATOMIC64_H
14
15typedef struct {
16 long long counter;
17} atomic64_t;
18
19#define ATOMIC64_INIT(i) { (i) }
20
21extern long long atomic64_read(const atomic64_t *v);
22extern void atomic64_set(atomic64_t *v, long long i);
23extern void atomic64_add(long long a, atomic64_t *v);
24extern long long atomic64_add_return(long long a, atomic64_t *v);
25extern void atomic64_sub(long long a, atomic64_t *v);
26extern long long atomic64_sub_return(long long a, atomic64_t *v);
27extern long long atomic64_dec_if_positive(atomic64_t *v);
28extern long long atomic64_cmpxchg(atomic64_t *v, long long o, long long n);
29extern long long atomic64_xchg(atomic64_t *v, long long new);
30extern int atomic64_add_unless(atomic64_t *v, long long a, long long u);
31
32#define atomic64_add_negative(a, v) (atomic64_add_return((a), (v)) < 0)
33#define atomic64_inc(v) atomic64_add(1LL, (v))
34#define atomic64_inc_return(v) atomic64_add_return(1LL, (v))
35#define atomic64_inc_and_test(v) (atomic64_inc_return(v) == 0)
36#define atomic64_sub_and_test(a, v) (atomic64_sub_return((a), (v)) == 0)
37#define atomic64_dec(v) atomic64_sub(1LL, (v))
38#define atomic64_dec_return(v) atomic64_sub_return(1LL, (v))
39#define atomic64_dec_and_test(v) (atomic64_dec_return((v)) == 0)
40#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1LL, 0LL)
41
42#endif /* _ASM_GENERIC_ATOMIC64_H */
diff --git a/include/asm-generic/auxvec.h b/include/asm-generic/auxvec.h
new file mode 100644
index 000000000000..b99573b0ad12
--- /dev/null
+++ b/include/asm-generic/auxvec.h
@@ -0,0 +1,8 @@
1#ifndef __ASM_GENERIC_AUXVEC_H
2#define __ASM_GENERIC_AUXVEC_H
3/*
4 * Not all architectures need their own auxvec.h, the most
5 * common definitions are already in linux/auxvec.h.
6 */
7
8#endif /* __ASM_GENERIC_AUXVEC_H */
diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h
index c9f369c4bd7e..a54f4421a24d 100644
--- a/include/asm-generic/bitops.h
+++ b/include/asm-generic/bitops.h
@@ -1,19 +1,29 @@
1#ifndef _ASM_GENERIC_BITOPS_H_ 1#ifndef __ASM_GENERIC_BITOPS_H
2#define _ASM_GENERIC_BITOPS_H_ 2#define __ASM_GENERIC_BITOPS_H
3 3
4/* 4/*
5 * For the benefit of those who are trying to port Linux to another 5 * For the benefit of those who are trying to port Linux to another
6 * architecture, here are some C-language equivalents. You should 6 * architecture, here are some C-language equivalents. You should
7 * recode these in the native assembly language, if at all possible. 7 * recode these in the native assembly language, if at all possible.
8 * 8 *
9 * C language equivalents written by Theodore Ts'o, 9/26/92 9 * C language equivalents written by Theodore Ts'o, 9/26/92
10 */ 10 */
11 11
12#include <asm-generic/bitops/atomic.h> 12#include <linux/irqflags.h>
13#include <asm-generic/bitops/non-atomic.h> 13#include <linux/compiler.h>
14
15/*
16 * clear_bit may not imply a memory barrier
17 */
18#ifndef smp_mb__before_clear_bit
19#define smp_mb__before_clear_bit() smp_mb()
20#define smp_mb__after_clear_bit() smp_mb()
21#endif
22
14#include <asm-generic/bitops/__ffs.h> 23#include <asm-generic/bitops/__ffs.h>
15#include <asm-generic/bitops/ffz.h> 24#include <asm-generic/bitops/ffz.h>
16#include <asm-generic/bitops/fls.h> 25#include <asm-generic/bitops/fls.h>
26#include <asm-generic/bitops/__fls.h>
17#include <asm-generic/bitops/fls64.h> 27#include <asm-generic/bitops/fls64.h>
18#include <asm-generic/bitops/find.h> 28#include <asm-generic/bitops/find.h>
19 29
@@ -26,8 +36,10 @@
26#include <asm-generic/bitops/hweight.h> 36#include <asm-generic/bitops/hweight.h>
27#include <asm-generic/bitops/lock.h> 37#include <asm-generic/bitops/lock.h>
28 38
39#include <asm-generic/bitops/atomic.h>
40#include <asm-generic/bitops/non-atomic.h>
29#include <asm-generic/bitops/ext2-non-atomic.h> 41#include <asm-generic/bitops/ext2-non-atomic.h>
30#include <asm-generic/bitops/ext2-atomic.h> 42#include <asm-generic/bitops/ext2-atomic.h>
31#include <asm-generic/bitops/minix.h> 43#include <asm-generic/bitops/minix.h>
32 44
33#endif /* _ASM_GENERIC_BITOPS_H */ 45#endif /* __ASM_GENERIC_BITOPS_H */
diff --git a/include/asm-generic/bitops/atomic.h b/include/asm-generic/bitops/atomic.h
index 4657f3e410fc..c8946465e63a 100644
--- a/include/asm-generic/bitops/atomic.h
+++ b/include/asm-generic/bitops/atomic.h
@@ -2,6 +2,7 @@
2#define _ASM_GENERIC_BITOPS_ATOMIC_H_ 2#define _ASM_GENERIC_BITOPS_ATOMIC_H_
3 3
4#include <asm/types.h> 4#include <asm/types.h>
5#include <asm/system.h>
5 6
6#ifdef CONFIG_SMP 7#ifdef CONFIG_SMP
7#include <asm/spinlock.h> 8#include <asm/spinlock.h>
diff --git a/include/asm-generic/bitsperlong.h b/include/asm-generic/bitsperlong.h
new file mode 100644
index 000000000000..4ae54e07de83
--- /dev/null
+++ b/include/asm-generic/bitsperlong.h
@@ -0,0 +1,32 @@
1#ifndef __ASM_GENERIC_BITS_PER_LONG
2#define __ASM_GENERIC_BITS_PER_LONG
3
4/*
5 * There seems to be no way of detecting this automatically from user
6 * space, so 64 bit architectures should override this in their
7 * bitsperlong.h. In particular, an architecture that supports
8 * both 32 and 64 bit user space must not rely on CONFIG_64BIT
9 * to decide it, but rather check a compiler provided macro.
10 */
11#ifndef __BITS_PER_LONG
12#define __BITS_PER_LONG 32
13#endif
14
15#ifdef __KERNEL__
16
17#ifdef CONFIG_64BIT
18#define BITS_PER_LONG 64
19#else
20#define BITS_PER_LONG 32
21#endif /* CONFIG_64BIT */
22
23/*
24 * FIXME: The check currently breaks x86-64 build, so it's
25 * temporarily disabled. Please fix x86-64 and reenable
26 */
27#if 0 && BITS_PER_LONG != __BITS_PER_LONG
28#error Inconsistent word size. Check asm/bitsperlong.h
29#endif
30
31#endif /* __KERNEL__ */
32#endif /* __ASM_GENERIC_BITS_PER_LONG */
diff --git a/include/asm-generic/bugs.h b/include/asm-generic/bugs.h
new file mode 100644
index 000000000000..6c4f62ea714d
--- /dev/null
+++ b/include/asm-generic/bugs.h
@@ -0,0 +1,10 @@
1#ifndef __ASM_GENERIC_BUGS_H
2#define __ASM_GENERIC_BUGS_H
3/*
4 * This file is included by 'init/main.c' to check for
5 * architecture-dependent bugs.
6 */
7
8static inline void check_bugs(void) { }
9
10#endif /* __ASM_GENERIC_BUGS_H */
diff --git a/include/asm-generic/cache.h b/include/asm-generic/cache.h
new file mode 100644
index 000000000000..1bfcfe5c2237
--- /dev/null
+++ b/include/asm-generic/cache.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_GENERIC_CACHE_H
2#define __ASM_GENERIC_CACHE_H
3/*
4 * 32 bytes appears to be the most common cache line size,
5 * so make that the default here. Architectures with larger
6 * cache lines need to provide their own cache.h.
7 */
8
9#define L1_CACHE_SHIFT 5
10#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
11
12#endif /* __ASM_GENERIC_CACHE_H */
diff --git a/include/asm-generic/cacheflush.h b/include/asm-generic/cacheflush.h
new file mode 100644
index 000000000000..ba4ec39a1131
--- /dev/null
+++ b/include/asm-generic/cacheflush.h
@@ -0,0 +1,30 @@
1#ifndef __ASM_CACHEFLUSH_H
2#define __ASM_CACHEFLUSH_H
3
4/* Keep includes the same across arches. */
5#include <linux/mm.h>
6
7/*
8 * The cache doesn't need to be flushed when TLB entries change when
9 * the cache is mapped to physical memory, not virtual memory
10 */
11#define flush_cache_all() do { } while (0)
12#define flush_cache_mm(mm) do { } while (0)
13#define flush_cache_dup_mm(mm) do { } while (0)
14#define flush_cache_range(vma, start, end) do { } while (0)
15#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
16#define flush_dcache_page(page) do { } while (0)
17#define flush_dcache_mmap_lock(mapping) do { } while (0)
18#define flush_dcache_mmap_unlock(mapping) do { } while (0)
19#define flush_icache_range(start, end) do { } while (0)
20#define flush_icache_page(vma,pg) do { } while (0)
21#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
22#define flush_cache_vmap(start, end) do { } while (0)
23#define flush_cache_vunmap(start, end) do { } while (0)
24
25#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
26 memcpy(dst, src, len)
27#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
28 memcpy(dst, src, len)
29
30#endif /* __ASM_CACHEFLUSH_H */
diff --git a/include/asm-generic/checksum.h b/include/asm-generic/checksum.h
new file mode 100644
index 000000000000..4647c762d970
--- /dev/null
+++ b/include/asm-generic/checksum.h
@@ -0,0 +1,79 @@
1#ifndef __ASM_GENERIC_CHECKSUM_H
2#define __ASM_GENERIC_CHECKSUM_H
3
4/*
5 * computes the checksum of a memory block at buff, length len,
6 * and adds in "sum" (32-bit)
7 *
8 * returns a 32-bit number suitable for feeding into itself
9 * or csum_tcpudp_magic
10 *
11 * this function must be called with even lengths, except
12 * for the last fragment, which may be odd
13 *
14 * it's best to have buff aligned on a 32-bit boundary
15 */
16extern __wsum csum_partial(const void *buff, int len, __wsum sum);
17
18/*
19 * the same as csum_partial, but copies from src while it
20 * checksums
21 *
22 * here even more important to align src and dst on a 32-bit (or even
23 * better 64-bit) boundary
24 */
25extern __wsum csum_partial_copy(const void *src, void *dst, int len, __wsum sum);
26
27/*
28 * the same as csum_partial_copy, but copies from user space.
29 *
30 * here even more important to align src and dst on a 32-bit (or even
31 * better 64-bit) boundary
32 */
33extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
34 int len, __wsum sum, int *csum_err);
35
36#define csum_partial_copy_nocheck(src, dst, len, sum) \
37 csum_partial_copy((src), (dst), (len), (sum))
38
39/*
40 * This is a version of ip_compute_csum() optimized for IP headers,
41 * which always checksum on 4 octet boundaries.
42 */
43extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
44
45/*
46 * Fold a partial checksum
47 */
48static inline __sum16 csum_fold(__wsum csum)
49{
50 u32 sum = (__force u32)csum;
51 sum = (sum & 0xffff) + (sum >> 16);
52 sum = (sum & 0xffff) + (sum >> 16);
53 return (__force __sum16)~sum;
54}
55
56#ifndef csum_tcpudp_nofold
57/*
58 * computes the checksum of the TCP/UDP pseudo-header
59 * returns a 16-bit checksum, already complemented
60 */
61extern __wsum
62csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
63 unsigned short proto, __wsum sum);
64#endif
65
66static inline __sum16
67csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
68 unsigned short proto, __wsum sum)
69{
70 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
71}
72
73/*
74 * this routine is used for miscellaneous IP-like checksums, mainly
75 * in icmp.c
76 */
77extern __sum16 ip_compute_csum(const void *buff, int len);
78
79#endif /* __ASM_GENERIC_CHECKSUM_H */
diff --git a/include/asm-generic/current.h b/include/asm-generic/current.h
new file mode 100644
index 000000000000..5e86f6ae7cab
--- /dev/null
+++ b/include/asm-generic/current.h
@@ -0,0 +1,9 @@
1#ifndef __ASM_GENERIC_CURRENT_H
2#define __ASM_GENERIC_CURRENT_H
3
4#include <linux/thread_info.h>
5
6#define get_current() (current_thread_info()->task)
7#define current get_current()
8
9#endif /* __ASM_GENERIC_CURRENT_H */
diff --git a/include/asm-generic/delay.h b/include/asm-generic/delay.h
new file mode 100644
index 000000000000..4586fec75ddb
--- /dev/null
+++ b/include/asm-generic/delay.h
@@ -0,0 +1,9 @@
1#ifndef __ASM_GENERIC_DELAY_H
2#define __ASM_GENERIC_DELAY_H
3
4extern void __udelay(unsigned long usecs);
5extern void __delay(unsigned long loops);
6
7#define udelay(n) __udelay(n)
8
9#endif /* __ASM_GENERIC_DELAY_H */
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h
new file mode 100644
index 000000000000..5406a601185c
--- /dev/null
+++ b/include/asm-generic/dma-mapping-common.h
@@ -0,0 +1,190 @@
1#ifndef _ASM_GENERIC_DMA_MAPPING_H
2#define _ASM_GENERIC_DMA_MAPPING_H
3
4#include <linux/kmemcheck.h>
5#include <linux/scatterlist.h>
6#include <linux/dma-debug.h>
7#include <linux/dma-attrs.h>
8
9static inline dma_addr_t dma_map_single_attrs(struct device *dev, void *ptr,
10 size_t size,
11 enum dma_data_direction dir,
12 struct dma_attrs *attrs)
13{
14 struct dma_map_ops *ops = get_dma_ops(dev);
15 dma_addr_t addr;
16
17 kmemcheck_mark_initialized(ptr, size);
18 BUG_ON(!valid_dma_direction(dir));
19 addr = ops->map_page(dev, virt_to_page(ptr),
20 (unsigned long)ptr & ~PAGE_MASK, size,
21 dir, attrs);
22 debug_dma_map_page(dev, virt_to_page(ptr),
23 (unsigned long)ptr & ~PAGE_MASK, size,
24 dir, addr, true);
25 return addr;
26}
27
28static inline void dma_unmap_single_attrs(struct device *dev, dma_addr_t addr,
29 size_t size,
30 enum dma_data_direction dir,
31 struct dma_attrs *attrs)
32{
33 struct dma_map_ops *ops = get_dma_ops(dev);
34
35 BUG_ON(!valid_dma_direction(dir));
36 if (ops->unmap_page)
37 ops->unmap_page(dev, addr, size, dir, attrs);
38 debug_dma_unmap_page(dev, addr, size, dir, true);
39}
40
41static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
42 int nents, enum dma_data_direction dir,
43 struct dma_attrs *attrs)
44{
45 struct dma_map_ops *ops = get_dma_ops(dev);
46 int i, ents;
47 struct scatterlist *s;
48
49 for_each_sg(sg, s, nents, i)
50 kmemcheck_mark_initialized(sg_virt(s), s->length);
51 BUG_ON(!valid_dma_direction(dir));
52 ents = ops->map_sg(dev, sg, nents, dir, attrs);
53 debug_dma_map_sg(dev, sg, nents, ents, dir);
54
55 return ents;
56}
57
58static inline void dma_unmap_sg_attrs(struct device *dev, struct scatterlist *sg,
59 int nents, enum dma_data_direction dir,
60 struct dma_attrs *attrs)
61{
62 struct dma_map_ops *ops = get_dma_ops(dev);
63
64 BUG_ON(!valid_dma_direction(dir));
65 debug_dma_unmap_sg(dev, sg, nents, dir);
66 if (ops->unmap_sg)
67 ops->unmap_sg(dev, sg, nents, dir, attrs);
68}
69
70static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
71 size_t offset, size_t size,
72 enum dma_data_direction dir)
73{
74 struct dma_map_ops *ops = get_dma_ops(dev);
75 dma_addr_t addr;
76
77 kmemcheck_mark_initialized(page_address(page) + offset, size);
78 BUG_ON(!valid_dma_direction(dir));
79 addr = ops->map_page(dev, page, offset, size, dir, NULL);
80 debug_dma_map_page(dev, page, offset, size, dir, addr, false);
81
82 return addr;
83}
84
85static inline void dma_unmap_page(struct device *dev, dma_addr_t addr,
86 size_t size, enum dma_data_direction dir)
87{
88 struct dma_map_ops *ops = get_dma_ops(dev);
89
90 BUG_ON(!valid_dma_direction(dir));
91 if (ops->unmap_page)
92 ops->unmap_page(dev, addr, size, dir, NULL);
93 debug_dma_unmap_page(dev, addr, size, dir, false);
94}
95
96static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t addr,
97 size_t size,
98 enum dma_data_direction dir)
99{
100 struct dma_map_ops *ops = get_dma_ops(dev);
101
102 BUG_ON(!valid_dma_direction(dir));
103 if (ops->sync_single_for_cpu)
104 ops->sync_single_for_cpu(dev, addr, size, dir);
105 debug_dma_sync_single_for_cpu(dev, addr, size, dir);
106 flush_write_buffers();
107}
108
109static inline void dma_sync_single_for_device(struct device *dev,
110 dma_addr_t addr, size_t size,
111 enum dma_data_direction dir)
112{
113 struct dma_map_ops *ops = get_dma_ops(dev);
114
115 BUG_ON(!valid_dma_direction(dir));
116 if (ops->sync_single_for_device)
117 ops->sync_single_for_device(dev, addr, size, dir);
118 debug_dma_sync_single_for_device(dev, addr, size, dir);
119 flush_write_buffers();
120}
121
122static inline void dma_sync_single_range_for_cpu(struct device *dev,
123 dma_addr_t addr,
124 unsigned long offset,
125 size_t size,
126 enum dma_data_direction dir)
127{
128 struct dma_map_ops *ops = get_dma_ops(dev);
129
130 BUG_ON(!valid_dma_direction(dir));
131 if (ops->sync_single_range_for_cpu) {
132 ops->sync_single_range_for_cpu(dev, addr, offset, size, dir);
133 debug_dma_sync_single_range_for_cpu(dev, addr, offset, size, dir);
134
135 flush_write_buffers();
136 } else
137 dma_sync_single_for_cpu(dev, addr, size, dir);
138}
139
140static inline void dma_sync_single_range_for_device(struct device *dev,
141 dma_addr_t addr,
142 unsigned long offset,
143 size_t size,
144 enum dma_data_direction dir)
145{
146 struct dma_map_ops *ops = get_dma_ops(dev);
147
148 BUG_ON(!valid_dma_direction(dir));
149 if (ops->sync_single_range_for_device) {
150 ops->sync_single_range_for_device(dev, addr, offset, size, dir);
151 debug_dma_sync_single_range_for_device(dev, addr, offset, size, dir);
152
153 flush_write_buffers();
154 } else
155 dma_sync_single_for_device(dev, addr, size, dir);
156}
157
158static inline void
159dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
160 int nelems, enum dma_data_direction dir)
161{
162 struct dma_map_ops *ops = get_dma_ops(dev);
163
164 BUG_ON(!valid_dma_direction(dir));
165 if (ops->sync_sg_for_cpu)
166 ops->sync_sg_for_cpu(dev, sg, nelems, dir);
167 debug_dma_sync_sg_for_cpu(dev, sg, nelems, dir);
168 flush_write_buffers();
169}
170
171static inline void
172dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
173 int nelems, enum dma_data_direction dir)
174{
175 struct dma_map_ops *ops = get_dma_ops(dev);
176
177 BUG_ON(!valid_dma_direction(dir));
178 if (ops->sync_sg_for_device)
179 ops->sync_sg_for_device(dev, sg, nelems, dir);
180 debug_dma_sync_sg_for_device(dev, sg, nelems, dir);
181
182 flush_write_buffers();
183}
184
185#define dma_map_single(d, a, s, r) dma_map_single_attrs(d, a, s, r, NULL)
186#define dma_unmap_single(d, a, s, r) dma_unmap_single_attrs(d, a, s, r, NULL)
187#define dma_map_sg(d, s, n, r) dma_map_sg_attrs(d, s, n, r, NULL)
188#define dma_unmap_sg(d, s, n, r) dma_unmap_sg_attrs(d, s, n, r, NULL)
189
190#endif
diff --git a/include/asm-generic/dma.h b/include/asm-generic/dma.h
new file mode 100644
index 000000000000..9dfc3a7f36d2
--- /dev/null
+++ b/include/asm-generic/dma.h
@@ -0,0 +1,15 @@
1#ifndef __ASM_GENERIC_DMA_H
2#define __ASM_GENERIC_DMA_H
3/*
4 * This file traditionally describes the i8237 PC style DMA controller.
5 * Most architectures don't have these any more and can get the minimal
6 * implementation from kernel/dma.c by not defining MAX_DMA_CHANNELS.
7 *
8 * Some code relies on seeing MAX_DMA_ADDRESS though.
9 */
10#define MAX_DMA_ADDRESS PAGE_OFFSET
11
12extern int request_dma(unsigned int dmanr, const char *device_id);
13extern void free_dma(unsigned int dmanr);
14
15#endif /* __ASM_GENERIC_DMA_H */
diff --git a/include/asm-generic/errno.h b/include/asm-generic/errno.h
index e8852c092fea..28cc03bf19e6 100644
--- a/include/asm-generic/errno.h
+++ b/include/asm-generic/errno.h
@@ -106,4 +106,6 @@
106#define EOWNERDEAD 130 /* Owner died */ 106#define EOWNERDEAD 130 /* Owner died */
107#define ENOTRECOVERABLE 131 /* State not recoverable */ 107#define ENOTRECOVERABLE 131 /* State not recoverable */
108 108
109#define ERFKILL 132 /* Operation not possible due to RF-kill */
110
109#endif 111#endif
diff --git a/include/asm-generic/fb.h b/include/asm-generic/fb.h
new file mode 100644
index 000000000000..fe8ca7fcea00
--- /dev/null
+++ b/include/asm-generic/fb.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_GENERIC_FB_H_
2#define __ASM_GENERIC_FB_H_
3#include <linux/fb.h>
4
5#define fb_pgprotect(...) do {} while (0)
6
7static inline int fb_is_primary_device(struct fb_info *info)
8{
9 return 0;
10}
11
12#endif /* __ASM_GENERIC_FB_H_ */
diff --git a/include/asm-generic/getorder.h b/include/asm-generic/getorder.h
new file mode 100644
index 000000000000..67e7245dc9b3
--- /dev/null
+++ b/include/asm-generic/getorder.h
@@ -0,0 +1,24 @@
1#ifndef __ASM_GENERIC_GETORDER_H
2#define __ASM_GENERIC_GETORDER_H
3
4#ifndef __ASSEMBLY__
5
6#include <linux/compiler.h>
7
8/* Pure 2^n version of get_order */
9static inline __attribute_const__ int get_order(unsigned long size)
10{
11 int order;
12
13 size = (size - 1) >> (PAGE_SHIFT - 1);
14 order = -1;
15 do {
16 size >>= 1;
17 order++;
18 } while (size);
19 return order;
20}
21
22#endif /* __ASSEMBLY__ */
23
24#endif /* __ASM_GENERIC_GETORDER_H */
diff --git a/include/asm-generic/hardirq.h b/include/asm-generic/hardirq.h
new file mode 100644
index 000000000000..23bb4dad4962
--- /dev/null
+++ b/include/asm-generic/hardirq.h
@@ -0,0 +1,21 @@
1#ifndef __ASM_GENERIC_HARDIRQ_H
2#define __ASM_GENERIC_HARDIRQ_H
3
4#include <linux/cache.h>
5#include <linux/threads.h>
6#include <linux/irq.h>
7
8typedef struct {
9 unsigned long __softirq_pending;
10} ____cacheline_aligned irq_cpustat_t;
11
12#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
13
14#ifndef ack_bad_irq
15static inline void ack_bad_irq(unsigned int irq)
16{
17 printk(KERN_CRIT "unexpected IRQ trap at vector %02x\n", irq);
18}
19#endif
20
21#endif /* __ASM_GENERIC_HARDIRQ_H */
diff --git a/include/asm-generic/hw_irq.h b/include/asm-generic/hw_irq.h
new file mode 100644
index 000000000000..89036d7b40e0
--- /dev/null
+++ b/include/asm-generic/hw_irq.h
@@ -0,0 +1,9 @@
1#ifndef __ASM_GENERIC_HW_IRQ_H
2#define __ASM_GENERIC_HW_IRQ_H
3/*
4 * hw_irq.h has internal declarations for the low-level interrupt
5 * controller, like the original i8259A.
6 * In general, this is not needed for new architectures.
7 */
8
9#endif /* __ASM_GENERIC_HW_IRQ_H */
diff --git a/include/asm-generic/int-l64.h b/include/asm-generic/int-l64.h
index 2af9b75d77db..1ca3efc976cc 100644
--- a/include/asm-generic/int-l64.h
+++ b/include/asm-generic/int-l64.h
@@ -8,6 +8,8 @@
8#ifndef _ASM_GENERIC_INT_L64_H 8#ifndef _ASM_GENERIC_INT_L64_H
9#define _ASM_GENERIC_INT_L64_H 9#define _ASM_GENERIC_INT_L64_H
10 10
11#include <asm/bitsperlong.h>
12
11#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
12/* 14/*
13 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the 15 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
diff --git a/include/asm-generic/int-ll64.h b/include/asm-generic/int-ll64.h
index f9bc9ac29b36..f394147c0739 100644
--- a/include/asm-generic/int-ll64.h
+++ b/include/asm-generic/int-ll64.h
@@ -8,6 +8,8 @@
8#ifndef _ASM_GENERIC_INT_LL64_H 8#ifndef _ASM_GENERIC_INT_LL64_H
9#define _ASM_GENERIC_INT_LL64_H 9#define _ASM_GENERIC_INT_LL64_H
10 10
11#include <asm/bitsperlong.h>
12
11#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
12/* 14/*
13 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the 15 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
new file mode 100644
index 000000000000..bcee6365dca0
--- /dev/null
+++ b/include/asm-generic/io.h
@@ -0,0 +1,300 @@
1/* Generic I/O port emulation, based on MN10300 code
2 *
3 * Copyright (C) 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 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#ifndef __ASM_GENERIC_IO_H
12#define __ASM_GENERIC_IO_H
13
14#include <asm/page.h> /* I/O is all done through memory accesses */
15#include <asm/cacheflush.h>
16#include <linux/types.h>
17
18#ifdef CONFIG_GENERIC_IOMAP
19#include <asm-generic/iomap.h>
20#endif
21
22#define mmiowb() do {} while (0)
23
24/*****************************************************************************/
25/*
26 * readX/writeX() are used to access memory mapped devices. On some
27 * architectures the memory mapped IO stuff needs to be accessed
28 * differently. On the simple architectures, we just read/write the
29 * memory location directly.
30 */
31static inline u8 __raw_readb(const volatile void __iomem *addr)
32{
33 return *(const volatile u8 __force *) addr;
34}
35
36static inline u16 __raw_readw(const volatile void __iomem *addr)
37{
38 return *(const volatile u16 __force *) addr;
39}
40
41static inline u32 __raw_readl(const volatile void __iomem *addr)
42{
43 return *(const volatile u32 __force *) addr;
44}
45
46#define readb __raw_readb
47#define readw(addr) __le16_to_cpu(__raw_readw(addr))
48#define readl(addr) __le32_to_cpu(__raw_readl(addr))
49
50static inline void __raw_writeb(u8 b, volatile void __iomem *addr)
51{
52 *(volatile u8 __force *) addr = b;
53}
54
55static inline void __raw_writew(u16 b, volatile void __iomem *addr)
56{
57 *(volatile u16 __force *) addr = b;
58}
59
60static inline void __raw_writel(u32 b, volatile void __iomem *addr)
61{
62 *(volatile u32 __force *) addr = b;
63}
64
65#define writeb __raw_writeb
66#define writew(b,addr) __raw_writew(__cpu_to_le16(b),addr)
67#define writel(b,addr) __raw_writel(__cpu_to_le32(b),addr)
68
69#ifdef CONFIG_64BIT
70static inline u64 __raw_readq(const volatile void __iomem *addr)
71{
72 return *(const volatile u64 __force *) addr;
73}
74#define readq(addr) __le64_to_cpu(__raw_readq(addr))
75
76static inline void __raw_writeq(u64 b, volatile void __iomem *addr)
77{
78 *(volatile u64 __force *) addr = b;
79}
80#define writeq(b,addr) __raw_writeq(__cpu_to_le64(b),addr)
81#endif
82
83/*****************************************************************************/
84/*
85 * traditional input/output functions
86 */
87
88static inline u8 inb(unsigned long addr)
89{
90 return readb((volatile void __iomem *) addr);
91}
92
93static inline u16 inw(unsigned long addr)
94{
95 return readw((volatile void __iomem *) addr);
96}
97
98static inline u32 inl(unsigned long addr)
99{
100 return readl((volatile void __iomem *) addr);
101}
102
103static inline void outb(u8 b, unsigned long addr)
104{
105 writeb(b, (volatile void __iomem *) addr);
106}
107
108static inline void outw(u16 b, unsigned long addr)
109{
110 writew(b, (volatile void __iomem *) addr);
111}
112
113static inline void outl(u32 b, unsigned long addr)
114{
115 writel(b, (volatile void __iomem *) addr);
116}
117
118#define inb_p(addr) inb(addr)
119#define inw_p(addr) inw(addr)
120#define inl_p(addr) inl(addr)
121#define outb_p(x, addr) outb((x), (addr))
122#define outw_p(x, addr) outw((x), (addr))
123#define outl_p(x, addr) outl((x), (addr))
124
125static inline void insb(unsigned long addr, void *buffer, int count)
126{
127 if (count) {
128 u8 *buf = buffer;
129 do {
130 u8 x = inb(addr);
131 *buf++ = x;
132 } while (--count);
133 }
134}
135
136static inline void insw(unsigned long addr, void *buffer, int count)
137{
138 if (count) {
139 u16 *buf = buffer;
140 do {
141 u16 x = inw(addr);
142 *buf++ = x;
143 } while (--count);
144 }
145}
146
147static inline void insl(unsigned long addr, void *buffer, int count)
148{
149 if (count) {
150 u32 *buf = buffer;
151 do {
152 u32 x = inl(addr);
153 *buf++ = x;
154 } while (--count);
155 }
156}
157
158static inline void outsb(unsigned long addr, const void *buffer, int count)
159{
160 if (count) {
161 const u8 *buf = buffer;
162 do {
163 outb(*buf++, addr);
164 } while (--count);
165 }
166}
167
168static inline void outsw(unsigned long addr, const void *buffer, int count)
169{
170 if (count) {
171 const u16 *buf = buffer;
172 do {
173 outw(*buf++, addr);
174 } while (--count);
175 }
176}
177
178static inline void outsl(unsigned long addr, const void *buffer, int count)
179{
180 if (count) {
181 const u32 *buf = buffer;
182 do {
183 outl(*buf++, addr);
184 } while (--count);
185 }
186}
187
188#ifndef CONFIG_GENERIC_IOMAP
189#define ioread8(addr) readb(addr)
190#define ioread16(addr) readw(addr)
191#define ioread32(addr) readl(addr)
192
193#define iowrite8(v, addr) writeb((v), (addr))
194#define iowrite16(v, addr) writew((v), (addr))
195#define iowrite32(v, addr) writel((v), (addr))
196
197#define ioread8_rep(p, dst, count) \
198 insb((unsigned long) (p), (dst), (count))
199#define ioread16_rep(p, dst, count) \
200 insw((unsigned long) (p), (dst), (count))
201#define ioread32_rep(p, dst, count) \
202 insl((unsigned long) (p), (dst), (count))
203
204#define iowrite8_rep(p, src, count) \
205 outsb((unsigned long) (p), (src), (count))
206#define iowrite16_rep(p, src, count) \
207 outsw((unsigned long) (p), (src), (count))
208#define iowrite32_rep(p, src, count) \
209 outsl((unsigned long) (p), (src), (count))
210#endif /* CONFIG_GENERIC_IOMAP */
211
212
213#define IO_SPACE_LIMIT 0xffffffff
214
215#ifdef __KERNEL__
216
217#include <linux/vmalloc.h>
218#define __io_virt(x) ((void __force *) (x))
219
220#ifndef CONFIG_GENERIC_IOMAP
221/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
222struct pci_dev;
223extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
224static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
225{
226}
227#endif /* CONFIG_GENERIC_IOMAP */
228
229/*
230 * Change virtual addresses to physical addresses and vv.
231 * These are pretty trivial
232 */
233static inline unsigned long virt_to_phys(volatile void *address)
234{
235 return __pa((unsigned long)address);
236}
237
238static inline void *phys_to_virt(unsigned long address)
239{
240 return __va(address);
241}
242
243/*
244 * Change "struct page" to physical address.
245 */
246static inline void __iomem *ioremap(phys_addr_t offset, unsigned long size)
247{
248 return (void __iomem*) (unsigned long)offset;
249}
250
251#define __ioremap(offset, size, flags) ioremap(offset, size)
252
253#ifndef ioremap_nocache
254#define ioremap_nocache ioremap
255#endif
256
257#ifndef ioremap_wc
258#define ioremap_wc ioremap_nocache
259#endif
260
261static inline void iounmap(void *addr)
262{
263}
264
265#ifndef CONFIG_GENERIC_IOMAP
266static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
267{
268 return (void __iomem *) port;
269}
270
271static inline void ioport_unmap(void __iomem *p)
272{
273}
274#else /* CONFIG_GENERIC_IOMAP */
275extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
276extern void ioport_unmap(void __iomem *p);
277#endif /* CONFIG_GENERIC_IOMAP */
278
279#define xlate_dev_kmem_ptr(p) p
280#define xlate_dev_mem_ptr(p) ((void *) (p))
281
282#ifndef virt_to_bus
283static inline unsigned long virt_to_bus(volatile void *address)
284{
285 return ((unsigned long) address);
286}
287
288static inline void *bus_to_virt(unsigned long address)
289{
290 return (void *) address;
291}
292#endif
293
294#define memset_io(a, b, c) memset(__io_virt(a), (b), (c))
295#define memcpy_fromio(a, b, c) memcpy((a), __io_virt(b), (c))
296#define memcpy_toio(a, b, c) memcpy(__io_virt(a), (b), (c))
297
298#endif /* __KERNEL__ */
299
300#endif /* __ASM_GENERIC_IO_H */
diff --git a/include/asm-generic/ioctls.h b/include/asm-generic/ioctls.h
new file mode 100644
index 000000000000..a799e20a769e
--- /dev/null
+++ b/include/asm-generic/ioctls.h
@@ -0,0 +1,110 @@
1#ifndef __ASM_GENERIC_IOCTLS_H
2#define __ASM_GENERIC_IOCTLS_H
3
4#include <linux/ioctl.h>
5
6/*
7 * These are the most common definitions for tty ioctl numbers.
8 * Most of them do not use the recommended _IOC(), but there is
9 * probably some source code out there hardcoding the number,
10 * so we might as well use them for all new platforms.
11 *
12 * The architectures that use different values here typically
13 * try to be compatible with some Unix variants for the same
14 * architecture.
15 */
16
17/* 0x54 is just a magic number to make these relatively unique ('T') */
18
19#define TCGETS 0x5401
20#define TCSETS 0x5402
21#define TCSETSW 0x5403
22#define TCSETSF 0x5404
23#define TCGETA 0x5405
24#define TCSETA 0x5406
25#define TCSETAW 0x5407
26#define TCSETAF 0x5408
27#define TCSBRK 0x5409
28#define TCXONC 0x540A
29#define TCFLSH 0x540B
30#define TIOCEXCL 0x540C
31#define TIOCNXCL 0x540D
32#define TIOCSCTTY 0x540E
33#define TIOCGPGRP 0x540F
34#define TIOCSPGRP 0x5410
35#define TIOCOUTQ 0x5411
36#define TIOCSTI 0x5412
37#define TIOCGWINSZ 0x5413
38#define TIOCSWINSZ 0x5414
39#define TIOCMGET 0x5415
40#define TIOCMBIS 0x5416
41#define TIOCMBIC 0x5417
42#define TIOCMSET 0x5418
43#define TIOCGSOFTCAR 0x5419
44#define TIOCSSOFTCAR 0x541A
45#define FIONREAD 0x541B
46#define TIOCINQ FIONREAD
47#define TIOCLINUX 0x541C
48#define TIOCCONS 0x541D
49#define TIOCGSERIAL 0x541E
50#define TIOCSSERIAL 0x541F
51#define TIOCPKT 0x5420
52#define FIONBIO 0x5421
53#define TIOCNOTTY 0x5422
54#define TIOCSETD 0x5423
55#define TIOCGETD 0x5424
56#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
57#define TIOCSBRK 0x5427 /* BSD compatibility */
58#define TIOCCBRK 0x5428 /* BSD compatibility */
59#define TIOCGSID 0x5429 /* Return the session ID of FD */
60#define TCGETS2 _IOR('T', 0x2A, struct termios2)
61#define TCSETS2 _IOW('T', 0x2B, struct termios2)
62#define TCSETSW2 _IOW('T', 0x2C, struct termios2)
63#define TCSETSF2 _IOW('T', 0x2D, struct termios2)
64#define TIOCGRS485 0x542E
65#define TIOCSRS485 0x542F
66#define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
67#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */
68#define TCGETX 0x5432 /* SYS5 TCGETX compatibility */
69#define TCSETX 0x5433
70#define TCSETXF 0x5434
71#define TCSETXW 0x5435
72
73#define FIONCLEX 0x5450
74#define FIOCLEX 0x5451
75#define FIOASYNC 0x5452
76#define TIOCSERCONFIG 0x5453
77#define TIOCSERGWILD 0x5454
78#define TIOCSERSWILD 0x5455
79#define TIOCGLCKTRMIOS 0x5456
80#define TIOCSLCKTRMIOS 0x5457
81#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
82#define TIOCSERGETLSR 0x5459 /* Get line status register */
83#define TIOCSERGETMULTI 0x545A /* Get multiport config */
84#define TIOCSERSETMULTI 0x545B /* Set multiport config */
85
86#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
87#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
88
89/*
90 * some architectures define FIOQSIZE as 0x545E, which is used for
91 * TIOCGHAYESESP on others
92 */
93#ifndef FIOQSIZE
94# define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */
95# define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */
96# define FIOQSIZE 0x5460
97#endif
98
99/* Used for packet mode */
100#define TIOCPKT_DATA 0
101#define TIOCPKT_FLUSHREAD 1
102#define TIOCPKT_FLUSHWRITE 2
103#define TIOCPKT_STOP 4
104#define TIOCPKT_START 8
105#define TIOCPKT_NOSTOP 16
106#define TIOCPKT_DOSTOP 32
107
108#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
109
110#endif /* __ASM_GENERIC_IOCTLS_H */
diff --git a/include/asm-generic/ipcbuf.h b/include/asm-generic/ipcbuf.h
new file mode 100644
index 000000000000..76982b2a1b58
--- /dev/null
+++ b/include/asm-generic/ipcbuf.h
@@ -0,0 +1,34 @@
1#ifndef __ASM_GENERIC_IPCBUF_H
2#define __ASM_GENERIC_IPCBUF_H
3
4/*
5 * The generic ipc64_perm structure:
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * ipc64_perm was originally meant to be architecture specific, but
10 * everyone just ended up making identical copies without specific
11 * optimizations, so we may just as well all use the same one.
12 *
13 * Pad space is left for:
14 * - 32-bit mode_t on architectures that only had 16 bit
15 * - 32-bit seq
16 * - 2 miscellaneous 32-bit values
17 */
18
19struct ipc64_perm {
20 __kernel_key_t key;
21 __kernel_uid32_t uid;
22 __kernel_gid32_t gid;
23 __kernel_uid32_t cuid;
24 __kernel_gid32_t cgid;
25 __kernel_mode_t mode;
26 /* pad if mode_t is u16: */
27 unsigned char __pad1[4 - sizeof(__kernel_mode_t)];
28 unsigned short seq;
29 unsigned short __pad2;
30 unsigned long __unused1;
31 unsigned long __unused2;
32};
33
34#endif /* __ASM_GENERIC_IPCBUF_H */
diff --git a/include/asm-generic/irq.h b/include/asm-generic/irq.h
new file mode 100644
index 000000000000..b90ec0bc485f
--- /dev/null
+++ b/include/asm-generic/irq.h
@@ -0,0 +1,18 @@
1#ifndef __ASM_GENERIC_IRQ_H
2#define __ASM_GENERIC_IRQ_H
3
4/*
5 * NR_IRQS is the upper bound of how many interrupts can be handled
6 * in the platform. It is used to size the static irq_map array,
7 * so don't make it too big.
8 */
9#ifndef NR_IRQS
10#define NR_IRQS 64
11#endif
12
13static inline int irq_canonicalize(int irq)
14{
15 return irq;
16}
17
18#endif /* __ASM_GENERIC_IRQ_H */
diff --git a/include/asm-generic/irqflags.h b/include/asm-generic/irqflags.h
new file mode 100644
index 000000000000..9aebf618275a
--- /dev/null
+++ b/include/asm-generic/irqflags.h
@@ -0,0 +1,72 @@
1#ifndef __ASM_GENERIC_IRQFLAGS_H
2#define __ASM_GENERIC_IRQFLAGS_H
3
4/*
5 * All architectures should implement at least the first two functions,
6 * usually inline assembly will be the best way.
7 */
8#ifndef RAW_IRQ_DISABLED
9#define RAW_IRQ_DISABLED 0
10#define RAW_IRQ_ENABLED 1
11#endif
12
13/* read interrupt enabled status */
14#ifndef __raw_local_save_flags
15unsigned long __raw_local_save_flags(void);
16#endif
17
18/* set interrupt enabled status */
19#ifndef raw_local_irq_restore
20void raw_local_irq_restore(unsigned long flags);
21#endif
22
23/* get status and disable interrupts */
24#ifndef __raw_local_irq_save
25static inline unsigned long __raw_local_irq_save(void)
26{
27 unsigned long flags;
28 flags = __raw_local_save_flags();
29 raw_local_irq_restore(RAW_IRQ_DISABLED);
30 return flags;
31}
32#endif
33
34/* test flags */
35#ifndef raw_irqs_disabled_flags
36static inline int raw_irqs_disabled_flags(unsigned long flags)
37{
38 return flags == RAW_IRQ_DISABLED;
39}
40#endif
41
42/* unconditionally enable interrupts */
43#ifndef raw_local_irq_enable
44static inline void raw_local_irq_enable(void)
45{
46 raw_local_irq_restore(RAW_IRQ_ENABLED);
47}
48#endif
49
50/* unconditionally disable interrupts */
51#ifndef raw_local_irq_disable
52static inline void raw_local_irq_disable(void)
53{
54 raw_local_irq_restore(RAW_IRQ_DISABLED);
55}
56#endif
57
58/* test hardware interrupt enable bit */
59#ifndef raw_irqs_disabled
60static inline int raw_irqs_disabled(void)
61{
62 return raw_irqs_disabled_flags(__raw_local_save_flags());
63}
64#endif
65
66#define raw_local_save_flags(flags) \
67 do { (flags) = __raw_local_save_flags(); } while (0)
68
69#define raw_local_irq_save(flags) \
70 do { (flags) = __raw_local_irq_save(); } while (0)
71
72#endif /* __ASM_GENERIC_IRQFLAGS_H */
diff --git a/include/asm-generic/kmap_types.h b/include/asm-generic/kmap_types.h
new file mode 100644
index 000000000000..eddbce0f9fb9
--- /dev/null
+++ b/include/asm-generic/kmap_types.h
@@ -0,0 +1,35 @@
1#ifndef _ASM_GENERIC_KMAP_TYPES_H
2#define _ASM_GENERIC_KMAP_TYPES_H
3
4#ifdef __WITH_KM_FENCE
5# define D(n) __KM_FENCE_##n ,
6#else
7# define D(n)
8#endif
9
10enum km_type {
11D(0) KM_BOUNCE_READ,
12D(1) KM_SKB_SUNRPC_DATA,
13D(2) KM_SKB_DATA_SOFTIRQ,
14D(3) KM_USER0,
15D(4) KM_USER1,
16D(5) KM_BIO_SRC_IRQ,
17D(6) KM_BIO_DST_IRQ,
18D(7) KM_PTE0,
19D(8) KM_PTE1,
20D(9) KM_IRQ0,
21D(10) KM_IRQ1,
22D(11) KM_SOFTIRQ0,
23D(12) KM_SOFTIRQ1,
24D(13) KM_SYNC_ICACHE,
25D(14) KM_SYNC_DCACHE,
26D(15) KM_UML_USERCOPY, /* UML specific, for copy_*_user - used in do_op_one_page */
27D(16) KM_IRQ_PTE,
28D(17) KM_NMI,
29D(18) KM_NMI_PTE,
30D(19) KM_TYPE_NR
31};
32
33#undef D
34
35#endif
diff --git a/include/asm-generic/linkage.h b/include/asm-generic/linkage.h
new file mode 100644
index 000000000000..fef7a01e5415
--- /dev/null
+++ b/include/asm-generic/linkage.h
@@ -0,0 +1,8 @@
1#ifndef __ASM_GENERIC_LINKAGE_H
2#define __ASM_GENERIC_LINKAGE_H
3/*
4 * linux/linkage.h provides reasonable defaults.
5 * an architecture can override them by providing its own version.
6 */
7
8#endif /* __ASM_GENERIC_LINKAGE_H */
diff --git a/include/asm-generic/mman-common.h b/include/asm-generic/mman-common.h
new file mode 100644
index 000000000000..3b69ad34189a
--- /dev/null
+++ b/include/asm-generic/mman-common.h
@@ -0,0 +1,41 @@
1#ifndef __ASM_GENERIC_MMAN_COMMON_H
2#define __ASM_GENERIC_MMAN_COMMON_H
3
4/*
5 Author: Michael S. Tsirkin <mst@mellanox.co.il>, Mellanox Technologies Ltd.
6 Based on: asm-xxx/mman.h
7*/
8
9#define PROT_READ 0x1 /* page can be read */
10#define PROT_WRITE 0x2 /* page can be written */
11#define PROT_EXEC 0x4 /* page can be executed */
12#define PROT_SEM 0x8 /* page may be used for atomic ops */
13#define PROT_NONE 0x0 /* page can not be accessed */
14#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
15#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
16
17#define MAP_SHARED 0x01 /* Share changes */
18#define MAP_PRIVATE 0x02 /* Changes are private */
19#define MAP_TYPE 0x0f /* Mask for type of mapping */
20#define MAP_FIXED 0x10 /* Interpret addr exactly */
21#define MAP_ANONYMOUS 0x20 /* don't use a file */
22
23#define MS_ASYNC 1 /* sync memory asynchronously */
24#define MS_INVALIDATE 2 /* invalidate the caches */
25#define MS_SYNC 4 /* synchronous memory sync */
26
27#define MADV_NORMAL 0 /* no further special treatment */
28#define MADV_RANDOM 1 /* expect random page references */
29#define MADV_SEQUENTIAL 2 /* expect sequential page references */
30#define MADV_WILLNEED 3 /* will need these pages */
31#define MADV_DONTNEED 4 /* don't need these pages */
32
33/* common parameters: try to keep these consistent across architectures */
34#define MADV_REMOVE 9 /* remove these pages & resources */
35#define MADV_DONTFORK 10 /* don't inherit across fork */
36#define MADV_DOFORK 11 /* do inherit across fork */
37
38/* compatibility flags */
39#define MAP_FILE 0
40
41#endif /* __ASM_GENERIC_MMAN_COMMON_H */
diff --git a/include/asm-generic/mman.h b/include/asm-generic/mman.h
index 5e3dde2ee5ad..7cab4de2bca6 100644
--- a/include/asm-generic/mman.h
+++ b/include/asm-generic/mman.h
@@ -1,41 +1,18 @@
1#ifndef _ASM_GENERIC_MMAN_H 1#ifndef __ASM_GENERIC_MMAN_H
2#define _ASM_GENERIC_MMAN_H 2#define __ASM_GENERIC_MMAN_H
3 3
4/* 4#include <asm-generic/mman-common.h>
5 Author: Michael S. Tsirkin <mst@mellanox.co.il>, Mellanox Technologies Ltd.
6 Based on: asm-xxx/mman.h
7*/
8 5
9#define PROT_READ 0x1 /* page can be read */ 6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
10#define PROT_WRITE 0x2 /* page can be written */ 7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
11#define PROT_EXEC 0x4 /* page can be executed */ 8#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
12#define PROT_SEM 0x8 /* page may be used for atomic ops */ 9#define MAP_LOCKED 0x2000 /* pages are locked */
13#define PROT_NONE 0x0 /* page can not be accessed */ 10#define MAP_NORESERVE 0x4000 /* don't check for reservations */
14#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ 11#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
15#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ 12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
13#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
16 14
17#define MAP_SHARED 0x01 /* Share changes */ 15#define MCL_CURRENT 1 /* lock all current mappings */
18#define MAP_PRIVATE 0x02 /* Changes are private */ 16#define MCL_FUTURE 2 /* lock all future mappings */
19#define MAP_TYPE 0x0f /* Mask for type of mapping */
20#define MAP_FIXED 0x10 /* Interpret addr exactly */
21#define MAP_ANONYMOUS 0x20 /* don't use a file */
22 17
23#define MS_ASYNC 1 /* sync memory asynchronously */ 18#endif /* __ASM_GENERIC_MMAN_H */
24#define MS_INVALIDATE 2 /* invalidate the caches */
25#define MS_SYNC 4 /* synchronous memory sync */
26
27#define MADV_NORMAL 0 /* no further special treatment */
28#define MADV_RANDOM 1 /* expect random page references */
29#define MADV_SEQUENTIAL 2 /* expect sequential page references */
30#define MADV_WILLNEED 3 /* will need these pages */
31#define MADV_DONTNEED 4 /* don't need these pages */
32
33/* common parameters: try to keep these consistent across architectures */
34#define MADV_REMOVE 9 /* remove these pages & resources */
35#define MADV_DONTFORK 10 /* don't inherit across fork */
36#define MADV_DOFORK 11 /* do inherit across fork */
37
38/* compatibility flags */
39#define MAP_FILE 0
40
41#endif
diff --git a/include/asm-generic/mmu.h b/include/asm-generic/mmu.h
new file mode 100644
index 000000000000..4f4aa56d6b52
--- /dev/null
+++ b/include/asm-generic/mmu.h
@@ -0,0 +1,15 @@
1#ifndef __ASM_GENERIC_MMU_H
2#define __ASM_GENERIC_MMU_H
3
4/*
5 * This is the mmu.h header for nommu implementations.
6 * Architectures with an MMU need something more complex.
7 */
8#ifndef __ASSEMBLY__
9typedef struct {
10 struct vm_list_struct *vmlist;
11 unsigned long end_brk;
12} mm_context_t;
13#endif
14
15#endif /* __ASM_GENERIC_MMU_H */
diff --git a/include/asm-generic/mmu_context.h b/include/asm-generic/mmu_context.h
new file mode 100644
index 000000000000..a7eec910ba6c
--- /dev/null
+++ b/include/asm-generic/mmu_context.h
@@ -0,0 +1,45 @@
1#ifndef __ASM_GENERIC_MMU_CONTEXT_H
2#define __ASM_GENERIC_MMU_CONTEXT_H
3
4/*
5 * Generic hooks for NOMMU architectures, which do not need to do
6 * anything special here.
7 */
8
9#include <asm-generic/mm_hooks.h>
10
11struct task_struct;
12struct mm_struct;
13
14static inline void enter_lazy_tlb(struct mm_struct *mm,
15 struct task_struct *tsk)
16{
17}
18
19static inline int init_new_context(struct task_struct *tsk,
20 struct mm_struct *mm)
21{
22 return 0;
23}
24
25static inline void destroy_context(struct mm_struct *mm)
26{
27}
28
29static inline void deactivate_mm(struct task_struct *task,
30 struct mm_struct *mm)
31{
32}
33
34static inline void switch_mm(struct mm_struct *prev,
35 struct mm_struct *next,
36 struct task_struct *tsk)
37{
38}
39
40static inline void activate_mm(struct mm_struct *prev_mm,
41 struct mm_struct *next_mm)
42{
43}
44
45#endif /* __ASM_GENERIC_MMU_CONTEXT_H */
diff --git a/include/asm-generic/module.h b/include/asm-generic/module.h
new file mode 100644
index 000000000000..ed5b44de4c91
--- /dev/null
+++ b/include/asm-generic/module.h
@@ -0,0 +1,22 @@
1#ifndef __ASM_GENERIC_MODULE_H
2#define __ASM_GENERIC_MODULE_H
3
4/*
5 * Many architectures just need a simple module
6 * loader without arch specific data.
7 */
8struct mod_arch_specific
9{
10};
11
12#ifdef CONFIG_64BIT
13#define Elf_Shdr Elf64_Shdr
14#define Elf_Sym Elf64_Sym
15#define Elf_Ehdr Elf64_Ehdr
16#else
17#define Elf_Shdr Elf32_Shdr
18#define Elf_Sym Elf32_Sym
19#define Elf_Ehdr Elf32_Ehdr
20#endif
21
22#endif /* __ASM_GENERIC_MODULE_H */
diff --git a/include/asm-generic/msgbuf.h b/include/asm-generic/msgbuf.h
new file mode 100644
index 000000000000..aec850d9159e
--- /dev/null
+++ b/include/asm-generic/msgbuf.h
@@ -0,0 +1,47 @@
1#ifndef __ASM_GENERIC_MSGBUF_H
2#define __ASM_GENERIC_MSGBUF_H
3
4#include <asm/bitsperlong.h>
5/*
6 * generic msqid64_ds structure.
7 *
8 * Note extra padding because this structure is passed back and forth
9 * between kernel and user space.
10 *
11 * msqid64_ds was originally meant to be architecture specific, but
12 * everyone just ended up making identical copies without specific
13 * optimizations, so we may just as well all use the same one.
14 *
15 * 64 bit architectures typically define a 64 bit __kernel_time_t,
16 * so they do not need the first three padding words.
17 * On big-endian systems, the padding is in the wrong place.
18 *
19 * Pad space is left for:
20 * - 64-bit time_t to solve y2038 problem
21 * - 2 miscellaneous 32-bit values
22 */
23
24struct msqid64_ds {
25 struct ipc64_perm msg_perm;
26 __kernel_time_t msg_stime; /* last msgsnd time */
27#if __BITS_PER_LONG != 64
28 unsigned long __unused1;
29#endif
30 __kernel_time_t msg_rtime; /* last msgrcv time */
31#if __BITS_PER_LONG != 64
32 unsigned long __unused2;
33#endif
34 __kernel_time_t msg_ctime; /* last change time */
35#if __BITS_PER_LONG != 64
36 unsigned long __unused3;
37#endif
38 unsigned long msg_cbytes; /* current number of bytes on queue */
39 unsigned long msg_qnum; /* number of messages in queue */
40 unsigned long msg_qbytes; /* max number of bytes on queue */
41 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
42 __kernel_pid_t msg_lrpid; /* last receive pid */
43 unsigned long __unused4;
44 unsigned long __unused5;
45};
46
47#endif /* __ASM_GENERIC_MSGBUF_H */
diff --git a/include/asm-generic/mutex.h b/include/asm-generic/mutex.h
new file mode 100644
index 000000000000..fe91ab502793
--- /dev/null
+++ b/include/asm-generic/mutex.h
@@ -0,0 +1,9 @@
1#ifndef __ASM_GENERIC_MUTEX_H
2#define __ASM_GENERIC_MUTEX_H
3/*
4 * Pull in the generic implementation for the mutex fastpath,
5 * which is a reasonable default on many architectures.
6 */
7
8#include <asm-generic/mutex-dec.h>
9#endif /* __ASM_GENERIC_MUTEX_H */
diff --git a/include/asm-generic/page.h b/include/asm-generic/page.h
index 14db733b8e68..75fec18cdc59 100644
--- a/include/asm-generic/page.h
+++ b/include/asm-generic/page.h
@@ -1,24 +1,99 @@
1#ifndef _ASM_GENERIC_PAGE_H 1#ifndef __ASM_GENERIC_PAGE_H
2#define _ASM_GENERIC_PAGE_H 2#define __ASM_GENERIC_PAGE_H
3/*
4 * Generic page.h implementation, for NOMMU architectures.
5 * This provides the dummy definitions for the memory management.
6 */
7
8#ifdef CONFIG_MMU
9#error need to prove a real asm/page.h
10#endif
11
12
13/* PAGE_SHIFT determines the page size */
14
15#define PAGE_SHIFT 12
16#ifdef __ASSEMBLY__
17#define PAGE_SIZE (1 << PAGE_SHIFT)
18#else
19#define PAGE_SIZE (1UL << PAGE_SHIFT)
20#endif
21#define PAGE_MASK (~(PAGE_SIZE-1))
22
23#include <asm/setup.h>
24
25#ifndef __ASSEMBLY__
26
27#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
28#define free_user_page(page, addr) free_page(addr)
29
30#define clear_page(page) memset((page), 0, PAGE_SIZE)
31#define copy_page(to,from) memcpy((to), (from), PAGE_SIZE)
32
33#define clear_user_page(page, vaddr, pg) clear_page(page)
34#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
35
36/*
37 * These are used to make use of C type-checking..
38 */
39typedef struct {
40 unsigned long pte;
41} pte_t;
42typedef struct {
43 unsigned long pmd[16];
44} pmd_t;
45typedef struct {
46 unsigned long pgd;
47} pgd_t;
48typedef struct {
49 unsigned long pgprot;
50} pgprot_t;
51typedef struct page *pgtable_t;
52
53#define pte_val(x) ((x).pte)
54#define pmd_val(x) ((&x)->pmd[0])
55#define pgd_val(x) ((x).pgd)
56#define pgprot_val(x) ((x).pgprot)
57
58#define __pte(x) ((pte_t) { (x) } )
59#define __pmd(x) ((pmd_t) { (x) } )
60#define __pgd(x) ((pgd_t) { (x) } )
61#define __pgprot(x) ((pgprot_t) { (x) } )
62
63extern unsigned long memory_start;
64extern unsigned long memory_end;
65
66#endif /* !__ASSEMBLY__ */
67
68#ifdef CONFIG_KERNEL_RAM_BASE_ADDRESS
69#define PAGE_OFFSET (CONFIG_KERNEL_RAM_BASE_ADDRESS)
70#else
71#define PAGE_OFFSET (0)
72#endif
3 73
4#ifndef __ASSEMBLY__ 74#ifndef __ASSEMBLY__
5 75
6#include <linux/compiler.h> 76#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET))
77#define __pa(x) ((unsigned long) (x) - PAGE_OFFSET)
78
79#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
80#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
81
82#define virt_to_page(addr) (mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
83#define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
84
85#ifndef page_to_phys
86#define page_to_phys(page) ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
87#endif
88
89#define pfn_valid(pfn) ((pfn) < max_mapnr)
7 90
8/* Pure 2^n version of get_order */ 91#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \
9static __inline__ __attribute_const__ int get_order(unsigned long size) 92 ((void *)(kaddr) < (void *)memory_end))
10{
11 int order;
12 93
13 size = (size - 1) >> (PAGE_SHIFT - 1); 94#endif /* __ASSEMBLY__ */
14 order = -1;
15 do {
16 size >>= 1;
17 order++;
18 } while (size);
19 return order;
20}
21 95
22#endif /* __ASSEMBLY__ */ 96#include <asm-generic/memory_model.h>
97#include <asm-generic/getorder.h>
23 98
24#endif /* _ASM_GENERIC_PAGE_H */ 99#endif /* __ASM_GENERIC_PAGE_H */
diff --git a/include/asm-generic/param.h b/include/asm-generic/param.h
new file mode 100644
index 000000000000..cdf8251bfb6c
--- /dev/null
+++ b/include/asm-generic/param.h
@@ -0,0 +1,24 @@
1#ifndef __ASM_GENERIC_PARAM_H
2#define __ASM_GENERIC_PARAM_H
3
4#ifdef __KERNEL__
5# define HZ CONFIG_HZ /* Internal kernel timer frequency */
6# define USER_HZ 100 /* some user interfaces are */
7# define CLOCKS_PER_SEC (USER_HZ) /* in "ticks" like times() */
8#endif
9
10#ifndef HZ
11#define HZ 100
12#endif
13
14#ifndef EXEC_PAGESIZE
15#define EXEC_PAGESIZE 4096
16#endif
17
18#ifndef NOGROUP
19#define NOGROUP (-1)
20#endif
21
22#define MAXHOSTNAMELEN 64 /* max length of hostname */
23
24#endif /* __ASM_GENERIC_PARAM_H */
diff --git a/include/asm-generic/parport.h b/include/asm-generic/parport.h
new file mode 100644
index 000000000000..40528cb977e8
--- /dev/null
+++ b/include/asm-generic/parport.h
@@ -0,0 +1,23 @@
1#ifndef __ASM_GENERIC_PARPORT_H
2#define __ASM_GENERIC_PARPORT_H
3
4/*
5 * An ISA bus may have i8255 parallel ports at well-known
6 * locations in the I/O space, which are scanned by
7 * parport_pc_find_isa_ports.
8 *
9 * Without ISA support, the driver will only attach
10 * to devices on the PCI bus.
11 */
12
13static int __devinit parport_pc_find_isa_ports(int autoirq, int autodma);
14static int __devinit parport_pc_find_nonpci_ports(int autoirq, int autodma)
15{
16#ifdef CONFIG_ISA
17 return parport_pc_find_isa_ports(autoirq, autodma);
18#else
19 return 0;
20#endif
21}
22
23#endif /* __ASM_GENERIC_PARPORT_H */
diff --git a/include/asm-generic/pci.h b/include/asm-generic/pci.h
index c36a77d3bf44..b4326b5466eb 100644
--- a/include/asm-generic/pci.h
+++ b/include/asm-generic/pci.h
@@ -30,19 +30,6 @@ pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
30 res->end = region->end; 30 res->end = region->end;
31} 31}
32 32
33static inline struct resource *
34pcibios_select_root(struct pci_dev *pdev, struct resource *res)
35{
36 struct resource *root = NULL;
37
38 if (res->flags & IORESOURCE_IO)
39 root = &ioport_resource;
40 if (res->flags & IORESOURCE_MEM)
41 root = &iomem_resource;
42
43 return root;
44}
45
46#define pcibios_scan_all_fns(a, b) 0 33#define pcibios_scan_all_fns(a, b) 0
47 34
48#ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ 35#ifndef HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ
@@ -52,4 +39,12 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
52} 39}
53#endif /* HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ */ 40#endif /* HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ */
54 41
42/*
43 * By default, assume that no iommu is in use and that the PCI
44 * space is mapped to address physical 0.
45 */
46#ifndef PCI_DMA_BUS_IS_PHYS
47#define PCI_DMA_BUS_IS_PHYS (1)
55#endif 48#endif
49
50#endif /* _ASM_GENERIC_PCI_H */
diff --git a/include/asm-generic/pgalloc.h b/include/asm-generic/pgalloc.h
new file mode 100644
index 000000000000..9e429d08b1f8
--- /dev/null
+++ b/include/asm-generic/pgalloc.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_GENERIC_PGALLOC_H
2#define __ASM_GENERIC_PGALLOC_H
3/*
4 * an empty file is enough for a nommu architecture
5 */
6#ifdef CONFIG_MMU
7#error need to implement an architecture specific asm/pgalloc.h
8#endif
9
10#define check_pgt_cache() do { } while (0)
11
12#endif /* __ASM_GENERIC_PGALLOC_H */
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 8e6d0ca70aba..e2bd73e8f9c0 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -129,6 +129,10 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
129#define move_pte(pte, prot, old_addr, new_addr) (pte) 129#define move_pte(pte, prot, old_addr, new_addr) (pte)
130#endif 130#endif
131 131
132#ifndef pgprot_noncached
133#define pgprot_noncached(prot) (prot)
134#endif
135
132#ifndef pgprot_writecombine 136#ifndef pgprot_writecombine
133#define pgprot_writecombine pgprot_noncached 137#define pgprot_writecombine pgprot_noncached
134#endif 138#endif
@@ -280,17 +284,18 @@ static inline void ptep_modify_prot_commit(struct mm_struct *mm,
280#endif 284#endif
281 285
282/* 286/*
283 * A facility to provide batching of the reload of page tables with the 287 * A facility to provide batching of the reload of page tables and
284 * actual context switch code for paravirtualized guests. By convention, 288 * other process state with the actual context switch code for
285 * only one of the lazy modes (CPU, MMU) should be active at any given 289 * paravirtualized guests. By convention, only one of the batched
286 * time, entry should never be nested, and entry and exits should always 290 * update (lazy) modes (CPU, MMU) should be active at any given time,
287 * be paired. This is for sanity of maintaining and reasoning about the 291 * entry should never be nested, and entry and exits should always be
288 * kernel code. 292 * paired. This is for sanity of maintaining and reasoning about the
293 * kernel code. In this case, the exit (end of the context switch) is
294 * in architecture-specific code, and so doesn't need a generic
295 * definition.
289 */ 296 */
290#ifndef __HAVE_ARCH_ENTER_LAZY_CPU_MODE 297#ifndef __HAVE_ARCH_START_CONTEXT_SWITCH
291#define arch_enter_lazy_cpu_mode() do {} while (0) 298#define arch_start_context_switch(prev) do {} while (0)
292#define arch_leave_lazy_cpu_mode() do {} while (0)
293#define arch_flush_lazy_cpu_mode() do {} while (0)
294#endif 299#endif
295 300
296#ifndef __HAVE_PFNMAP_TRACKING 301#ifndef __HAVE_PFNMAP_TRACKING
diff --git a/include/asm-generic/posix_types.h b/include/asm-generic/posix_types.h
new file mode 100644
index 000000000000..3dab00860e71
--- /dev/null
+++ b/include/asm-generic/posix_types.h
@@ -0,0 +1,165 @@
1#ifndef __ASM_GENERIC_POSIX_TYPES_H
2#define __ASM_GENERIC_POSIX_TYPES_H
3
4#include <asm/bitsperlong.h>
5/*
6 * This file is generally used by user-level software, so you need to
7 * be a little careful about namespace pollution etc.
8 *
9 * First the types that are often defined in different ways across
10 * architectures, so that you can override them.
11 */
12
13#ifndef __kernel_ino_t
14typedef unsigned long __kernel_ino_t;
15#endif
16
17#ifndef __kernel_mode_t
18typedef unsigned int __kernel_mode_t;
19#endif
20
21#ifndef __kernel_nlink_t
22typedef unsigned long __kernel_nlink_t;
23#endif
24
25#ifndef __kernel_pid_t
26typedef int __kernel_pid_t;
27#endif
28
29#ifndef __kernel_ipc_pid_t
30typedef int __kernel_ipc_pid_t;
31#endif
32
33#ifndef __kernel_uid_t
34typedef unsigned int __kernel_uid_t;
35typedef unsigned int __kernel_gid_t;
36#endif
37
38#ifndef __kernel_suseconds_t
39typedef long __kernel_suseconds_t;
40#endif
41
42#ifndef __kernel_daddr_t
43typedef int __kernel_daddr_t;
44#endif
45
46#ifndef __kernel_uid32_t
47typedef __kernel_uid_t __kernel_uid32_t;
48typedef __kernel_gid_t __kernel_gid32_t;
49#endif
50
51#ifndef __kernel_old_uid_t
52typedef __kernel_uid_t __kernel_old_uid_t;
53typedef __kernel_gid_t __kernel_old_gid_t;
54#endif
55
56#ifndef __kernel_old_dev_t
57typedef unsigned int __kernel_old_dev_t;
58#endif
59
60/*
61 * Most 32 bit architectures use "unsigned int" size_t,
62 * and all 64 bit architectures use "unsigned long" size_t.
63 */
64#ifndef __kernel_size_t
65#if __BITS_PER_LONG != 64
66typedef unsigned int __kernel_size_t;
67typedef int __kernel_ssize_t;
68typedef int __kernel_ptrdiff_t;
69#else
70typedef unsigned long __kernel_size_t;
71typedef long __kernel_ssize_t;
72typedef long __kernel_ptrdiff_t;
73#endif
74#endif
75
76/*
77 * anything below here should be completely generic
78 */
79typedef long __kernel_off_t;
80typedef long long __kernel_loff_t;
81typedef long __kernel_time_t;
82typedef long __kernel_clock_t;
83typedef int __kernel_timer_t;
84typedef int __kernel_clockid_t;
85typedef char * __kernel_caddr_t;
86typedef unsigned short __kernel_uid16_t;
87typedef unsigned short __kernel_gid16_t;
88
89typedef struct {
90 int val[2];
91} __kernel_fsid_t;
92
93#ifdef __KERNEL__
94
95#undef __FD_SET
96static inline void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
97{
98 unsigned long __tmp = __fd / __NFDBITS;
99 unsigned long __rem = __fd % __NFDBITS;
100 __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
101}
102
103#undef __FD_CLR
104static inline void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
105{
106 unsigned long __tmp = __fd / __NFDBITS;
107 unsigned long __rem = __fd % __NFDBITS;
108 __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
109}
110
111#undef __FD_ISSET
112static inline int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
113{
114 unsigned long __tmp = __fd / __NFDBITS;
115 unsigned long __rem = __fd % __NFDBITS;
116 return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
117}
118
119/*
120 * This will unroll the loop for the normal constant case (8 ints,
121 * for a 256-bit fd_set)
122 */
123#undef __FD_ZERO
124static inline void __FD_ZERO(__kernel_fd_set *__p)
125{
126 unsigned long *__tmp = __p->fds_bits;
127 int __i;
128
129 if (__builtin_constant_p(__FDSET_LONGS)) {
130 switch (__FDSET_LONGS) {
131 case 16:
132 __tmp[ 0] = 0; __tmp[ 1] = 0;
133 __tmp[ 2] = 0; __tmp[ 3] = 0;
134 __tmp[ 4] = 0; __tmp[ 5] = 0;
135 __tmp[ 6] = 0; __tmp[ 7] = 0;
136 __tmp[ 8] = 0; __tmp[ 9] = 0;
137 __tmp[10] = 0; __tmp[11] = 0;
138 __tmp[12] = 0; __tmp[13] = 0;
139 __tmp[14] = 0; __tmp[15] = 0;
140 return;
141
142 case 8:
143 __tmp[ 0] = 0; __tmp[ 1] = 0;
144 __tmp[ 2] = 0; __tmp[ 3] = 0;
145 __tmp[ 4] = 0; __tmp[ 5] = 0;
146 __tmp[ 6] = 0; __tmp[ 7] = 0;
147 return;
148
149 case 4:
150 __tmp[ 0] = 0; __tmp[ 1] = 0;
151 __tmp[ 2] = 0; __tmp[ 3] = 0;
152 return;
153 }
154 }
155 __i = __FDSET_LONGS;
156 while (__i) {
157 __i--;
158 *__tmp = 0;
159 __tmp++;
160 }
161}
162
163#endif /* __KERNEL__ */
164
165#endif /* __ASM_GENERIC_POSIX_TYPES_H */
diff --git a/include/asm-generic/rtc.h b/include/asm-generic/rtc.h
index 763e3b060f43..fa86f240c874 100644
--- a/include/asm-generic/rtc.h
+++ b/include/asm-generic/rtc.h
@@ -202,7 +202,7 @@ static inline unsigned int get_rtc_ss(void)
202{ 202{
203 struct rtc_time h; 203 struct rtc_time h;
204 204
205 __get_rtc_time(&h); 205 get_rtc_time(&h);
206 return h.tm_sec; 206 return h.tm_sec;
207} 207}
208 208
diff --git a/include/asm-generic/scatterlist.h b/include/asm-generic/scatterlist.h
new file mode 100644
index 000000000000..8b9454496a7c
--- /dev/null
+++ b/include/asm-generic/scatterlist.h
@@ -0,0 +1,43 @@
1#ifndef __ASM_GENERIC_SCATTERLIST_H
2#define __ASM_GENERIC_SCATTERLIST_H
3
4#include <linux/types.h>
5
6struct scatterlist {
7#ifdef CONFIG_DEBUG_SG
8 unsigned long sg_magic;
9#endif
10 unsigned long page_link;
11 unsigned int offset;
12 unsigned int length;
13 dma_addr_t dma_address;
14 unsigned int dma_length;
15};
16
17/*
18 * These macros should be used after a dma_map_sg call has been done
19 * to get bus addresses of each of the SG entries and their lengths.
20 * You should only work with the number of sg entries pci_map_sg
21 * returns, or alternatively stop on the first sg_dma_len(sg) which
22 * is 0.
23 */
24#define sg_dma_address(sg) ((sg)->dma_address)
25#ifndef sg_dma_len
26/*
27 * Normally, you have an iommu on 64 bit machines, but not on 32 bit
28 * machines. Architectures that are differnt should override this.
29 */
30#if __BITS_PER_LONG == 64
31#define sg_dma_len(sg) ((sg)->dma_length)
32#else
33#define sg_dma_len(sg) ((sg)->length)
34#endif /* 64 bit */
35#endif /* sg_dma_len */
36
37#ifndef ISA_DMA_THRESHOLD
38#define ISA_DMA_THRESHOLD (~0UL)
39#endif
40
41#define ARCH_HAS_SG_CHAIN
42
43#endif /* __ASM_GENERIC_SCATTERLIST_H */
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index 4ce48e878530..d083561337f2 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -14,6 +14,9 @@ extern char __kprobes_text_start[], __kprobes_text_end[];
14extern char __initdata_begin[], __initdata_end[]; 14extern char __initdata_begin[], __initdata_end[];
15extern char __start_rodata[], __end_rodata[]; 15extern char __start_rodata[], __end_rodata[];
16 16
17/* Start and end of .ctors section - used for constructor calls. */
18extern char __ctors_start[], __ctors_end[];
19
17/* function descriptor handling (if any). Override 20/* function descriptor handling (if any). Override
18 * in asm/sections.h */ 21 * in asm/sections.h */
19#ifndef dereference_function_descriptor 22#ifndef dereference_function_descriptor
diff --git a/include/asm-generic/segment.h b/include/asm-generic/segment.h
new file mode 100644
index 000000000000..5580eace622c
--- /dev/null
+++ b/include/asm-generic/segment.h
@@ -0,0 +1,9 @@
1#ifndef __ASM_GENERIC_SEGMENT_H
2#define __ASM_GENERIC_SEGMENT_H
3/*
4 * Only here because we have some old header files that expect it...
5 *
6 * New architectures probably don't want to have their own version.
7 */
8
9#endif /* __ASM_GENERIC_SEGMENT_H */
diff --git a/include/asm-generic/sembuf.h b/include/asm-generic/sembuf.h
new file mode 100644
index 000000000000..4cb2c13e5090
--- /dev/null
+++ b/include/asm-generic/sembuf.h
@@ -0,0 +1,38 @@
1#ifndef __ASM_GENERIC_SEMBUF_H
2#define __ASM_GENERIC_SEMBUF_H
3
4#include <asm/bitsperlong.h>
5
6/*
7 * The semid64_ds structure for x86 architecture.
8 * Note extra padding because this structure is passed back and forth
9 * between kernel and user space.
10 *
11 * semid64_ds was originally meant to be architecture specific, but
12 * everyone just ended up making identical copies without specific
13 * optimizations, so we may just as well all use the same one.
14 *
15 * 64 bit architectures typically define a 64 bit __kernel_time_t,
16 * so they do not need the first two padding words.
17 * On big-endian systems, the padding is in the wrong place.
18 *
19 * Pad space is left for:
20 * - 64-bit time_t to solve y2038 problem
21 * - 2 miscellaneous 32-bit values
22 */
23struct semid64_ds {
24 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
25 __kernel_time_t sem_otime; /* last semop time */
26#if __BITS_PER_LONG != 64
27 unsigned long __unused1;
28#endif
29 __kernel_time_t sem_ctime; /* last change time */
30#if __BITS_PER_LONG != 64
31 unsigned long __unused2;
32#endif
33 unsigned long sem_nsems; /* no. of semaphores in array */
34 unsigned long __unused3;
35 unsigned long __unused4;
36};
37
38#endif /* __ASM_GENERIC_SEMBUF_H */
diff --git a/include/asm-generic/serial.h b/include/asm-generic/serial.h
new file mode 100644
index 000000000000..5e291090fe04
--- /dev/null
+++ b/include/asm-generic/serial.h
@@ -0,0 +1,13 @@
1#ifndef __ASM_GENERIC_SERIAL_H
2#define __ASM_GENERIC_SERIAL_H
3
4/*
5 * This should not be an architecture specific #define, oh well.
6 *
7 * Traditionally, it just describes i8250 and related serial ports
8 * that have this clock rate.
9 */
10
11#define BASE_BAUD (1843200 / 16)
12
13#endif /* __ASM_GENERIC_SERIAL_H */
diff --git a/include/asm-generic/setup.h b/include/asm-generic/setup.h
new file mode 100644
index 000000000000..6fc26a51003c
--- /dev/null
+++ b/include/asm-generic/setup.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_GENERIC_SETUP_H
2#define __ASM_GENERIC_SETUP_H
3
4#define COMMAND_LINE_SIZE 512
5
6#endif /* __ASM_GENERIC_SETUP_H */
diff --git a/include/asm-generic/shmbuf.h b/include/asm-generic/shmbuf.h
new file mode 100644
index 000000000000..5768fa60ac82
--- /dev/null
+++ b/include/asm-generic/shmbuf.h
@@ -0,0 +1,59 @@
1#ifndef __ASM_GENERIC_SHMBUF_H
2#define __ASM_GENERIC_SHMBUF_H
3
4#include <asm/bitsperlong.h>
5
6/*
7 * The shmid64_ds structure for x86 architecture.
8 * Note extra padding because this structure is passed back and forth
9 * between kernel and user space.
10 *
11 * shmid64_ds was originally meant to be architecture specific, but
12 * everyone just ended up making identical copies without specific
13 * optimizations, so we may just as well all use the same one.
14 *
15 * 64 bit architectures typically define a 64 bit __kernel_time_t,
16 * so they do not need the first two padding words.
17 * On big-endian systems, the padding is in the wrong place.
18 *
19 *
20 * Pad space is left for:
21 * - 64-bit time_t to solve y2038 problem
22 * - 2 miscellaneous 32-bit values
23 */
24
25struct shmid64_ds {
26 struct ipc64_perm shm_perm; /* operation perms */
27 size_t shm_segsz; /* size of segment (bytes) */
28 __kernel_time_t shm_atime; /* last attach time */
29#if __BITS_PER_LONG != 64
30 unsigned long __unused1;
31#endif
32 __kernel_time_t shm_dtime; /* last detach time */
33#if __BITS_PER_LONG != 64
34 unsigned long __unused2;
35#endif
36 __kernel_time_t shm_ctime; /* last change time */
37#if __BITS_PER_LONG != 64
38 unsigned long __unused3;
39#endif
40 __kernel_pid_t shm_cpid; /* pid of creator */
41 __kernel_pid_t shm_lpid; /* pid of last operator */
42 unsigned long shm_nattch; /* no. of current attaches */
43 unsigned long __unused4;
44 unsigned long __unused5;
45};
46
47struct shminfo64 {
48 unsigned long shmmax;
49 unsigned long shmmin;
50 unsigned long shmmni;
51 unsigned long shmseg;
52 unsigned long shmall;
53 unsigned long __unused1;
54 unsigned long __unused2;
55 unsigned long __unused3;
56 unsigned long __unused4;
57};
58
59#endif /* __ASM_GENERIC_SHMBUF_H */
diff --git a/include/asm-generic/shmparam.h b/include/asm-generic/shmparam.h
new file mode 100644
index 000000000000..51a3852de733
--- /dev/null
+++ b/include/asm-generic/shmparam.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_GENERIC_SHMPARAM_H
2#define __ASM_GENERIC_SHMPARAM_H
3
4#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
5
6#endif /* _ASM_GENERIC_SHMPARAM_H */
diff --git a/include/asm-generic/signal-defs.h b/include/asm-generic/signal-defs.h
new file mode 100644
index 000000000000..00f95df54297
--- /dev/null
+++ b/include/asm-generic/signal-defs.h
@@ -0,0 +1,28 @@
1#ifndef __ASM_GENERIC_SIGNAL_DEFS_H
2#define __ASM_GENERIC_SIGNAL_DEFS_H
3
4#include <linux/compiler.h>
5
6#ifndef SIG_BLOCK
7#define SIG_BLOCK 0 /* for blocking signals */
8#endif
9#ifndef SIG_UNBLOCK
10#define SIG_UNBLOCK 1 /* for unblocking signals */
11#endif
12#ifndef SIG_SETMASK
13#define SIG_SETMASK 2 /* for setting the signal mask */
14#endif
15
16#ifndef __ASSEMBLY__
17typedef void __signalfn_t(int);
18typedef __signalfn_t __user *__sighandler_t;
19
20typedef void __restorefn_t(void);
21typedef __restorefn_t __user *__sigrestore_t;
22
23#define SIG_DFL ((__force __sighandler_t)0) /* default signal handling */
24#define SIG_IGN ((__force __sighandler_t)1) /* ignore signal */
25#define SIG_ERR ((__force __sighandler_t)-1) /* error return from signal */
26#endif
27
28#endif /* __ASM_GENERIC_SIGNAL_DEFS_H */
diff --git a/include/asm-generic/signal.h b/include/asm-generic/signal.h
index dae1d8720076..555c0aee8a47 100644
--- a/include/asm-generic/signal.h
+++ b/include/asm-generic/signal.h
@@ -1,28 +1,131 @@
1#ifndef __ASM_GENERIC_SIGNAL_H 1#ifndef __ASM_GENERIC_SIGNAL_H
2#define __ASM_GENERIC_SIGNAL_H 2#define __ASM_GENERIC_SIGNAL_H
3 3
4#include <linux/compiler.h> 4#include <linux/types.h>
5 5
6#ifndef SIG_BLOCK 6#define _NSIG 64
7#define SIG_BLOCK 0 /* for blocking signals */ 7#define _NSIG_BPW __BITS_PER_LONG
8#endif 8#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
9#ifndef SIG_UNBLOCK 9
10#define SIG_UNBLOCK 1 /* for unblocking signals */ 10#define SIGHUP 1
11#endif 11#define SIGINT 2
12#ifndef SIG_SETMASK 12#define SIGQUIT 3
13#define SIG_SETMASK 2 /* for setting the signal mask */ 13#define SIGILL 4
14#define SIGTRAP 5
15#define SIGABRT 6
16#define SIGIOT 6
17#define SIGBUS 7
18#define SIGFPE 8
19#define SIGKILL 9
20#define SIGUSR1 10
21#define SIGSEGV 11
22#define SIGUSR2 12
23#define SIGPIPE 13
24#define SIGALRM 14
25#define SIGTERM 15
26#define SIGSTKFLT 16
27#define SIGCHLD 17
28#define SIGCONT 18
29#define SIGSTOP 19
30#define SIGTSTP 20
31#define SIGTTIN 21
32#define SIGTTOU 22
33#define SIGURG 23
34#define SIGXCPU 24
35#define SIGXFSZ 25
36#define SIGVTALRM 26
37#define SIGPROF 27
38#define SIGWINCH 28
39#define SIGIO 29
40#define SIGPOLL SIGIO
41/*
42#define SIGLOST 29
43*/
44#define SIGPWR 30
45#define SIGSYS 31
46#define SIGUNUSED 31
47
48/* These should not be considered constants from userland. */
49#define SIGRTMIN 32
50#ifndef SIGRTMAX
51#define SIGRTMAX _NSIG
14#endif 52#endif
15 53
54/*
55 * SA_FLAGS values:
56 *
57 * SA_ONSTACK indicates that a registered stack_t will be used.
58 * SA_RESTART flag to get restarting signals (which were the default long ago)
59 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
60 * SA_RESETHAND clears the handler when the signal is delivered.
61 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
62 * SA_NODEFER prevents the current signal from being masked in the handler.
63 *
64 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
65 * Unix names RESETHAND and NODEFER respectively.
66 */
67#define SA_NOCLDSTOP 0x00000001
68#define SA_NOCLDWAIT 0x00000002
69#define SA_SIGINFO 0x00000004
70#define SA_ONSTACK 0x08000000
71#define SA_RESTART 0x10000000
72#define SA_NODEFER 0x40000000
73#define SA_RESETHAND 0x80000000
74
75#define SA_NOMASK SA_NODEFER
76#define SA_ONESHOT SA_RESETHAND
77
78/*
79 * New architectures should not define the obsolete
80 * SA_RESTORER 0x04000000
81 */
82
83/*
84 * sigaltstack controls
85 */
86#define SS_ONSTACK 1
87#define SS_DISABLE 2
88
89#define MINSIGSTKSZ 2048
90#define SIGSTKSZ 8192
91
16#ifndef __ASSEMBLY__ 92#ifndef __ASSEMBLY__
17typedef void __signalfn_t(int); 93typedef struct {
18typedef __signalfn_t __user *__sighandler_t; 94 unsigned long sig[_NSIG_WORDS];
95} sigset_t;
96
97/* not actually used, but required for linux/syscalls.h */
98typedef unsigned long old_sigset_t;
19 99
20typedef void __restorefn_t(void); 100#include <asm-generic/signal-defs.h>
21typedef __restorefn_t __user *__sigrestore_t;
22 101
23#define SIG_DFL ((__force __sighandler_t)0) /* default signal handling */ 102struct sigaction {
24#define SIG_IGN ((__force __sighandler_t)1) /* ignore signal */ 103 __sighandler_t sa_handler;
25#define SIG_ERR ((__force __sighandler_t)-1) /* error return from signal */ 104 unsigned long sa_flags;
105#ifdef SA_RESTORER
106 __sigrestore_t sa_restorer;
26#endif 107#endif
108 sigset_t sa_mask; /* mask last for extensibility */
109};
110
111struct k_sigaction {
112 struct sigaction sa;
113};
114
115typedef struct sigaltstack {
116 void __user *ss_sp;
117 int ss_flags;
118 size_t ss_size;
119} stack_t;
120
121#ifdef __KERNEL__
122
123#include <asm/sigcontext.h>
124#undef __HAVE_ARCH_SIG_BITOPS
125
126#define ptrace_signal_deliver(regs, cookie) do { } while (0)
127
128#endif /* __KERNEL__ */
129#endif /* __ASSEMBLY__ */
27 130
28#endif /* __ASM_GENERIC_SIGNAL_H */ 131#endif /* _ASM_GENERIC_SIGNAL_H */
diff --git a/include/asm-generic/socket.h b/include/asm-generic/socket.h
new file mode 100644
index 000000000000..5d79e409241c
--- /dev/null
+++ b/include/asm-generic/socket.h
@@ -0,0 +1,63 @@
1#ifndef __ASM_GENERIC_SOCKET_H
2#define __ASM_GENERIC_SOCKET_H
3
4#include <asm/sockios.h>
5
6/* For setsockopt(2) */
7#define SOL_SOCKET 1
8
9#define SO_DEBUG 1
10#define SO_REUSEADDR 2
11#define SO_TYPE 3
12#define SO_ERROR 4
13#define SO_DONTROUTE 5
14#define SO_BROADCAST 6
15#define SO_SNDBUF 7
16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
19#define SO_KEEPALIVE 9
20#define SO_OOBINLINE 10
21#define SO_NO_CHECK 11
22#define SO_PRIORITY 12
23#define SO_LINGER 13
24#define SO_BSDCOMPAT 14
25/* To add :#define SO_REUSEPORT 15 */
26
27#ifndef SO_PASSCRED /* powerpc only differs in these */
28#define SO_PASSCRED 16
29#define SO_PEERCRED 17
30#define SO_RCVLOWAT 18
31#define SO_SNDLOWAT 19
32#define SO_RCVTIMEO 20
33#define SO_SNDTIMEO 21
34#endif
35
36/* Security levels - as per NRL IPv6 - don't actually do anything */
37#define SO_SECURITY_AUTHENTICATION 22
38#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
39#define SO_SECURITY_ENCRYPTION_NETWORK 24
40
41#define SO_BINDTODEVICE 25
42
43/* Socket filtering */
44#define SO_ATTACH_FILTER 26
45#define SO_DETACH_FILTER 27
46
47#define SO_PEERNAME 28
48#define SO_TIMESTAMP 29
49#define SCM_TIMESTAMP SO_TIMESTAMP
50
51#define SO_ACCEPTCONN 30
52
53#define SO_PEERSEC 31
54#define SO_PASSSEC 34
55#define SO_TIMESTAMPNS 35
56#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
57
58#define SO_MARK 36
59
60#define SO_TIMESTAMPING 37
61#define SCM_TIMESTAMPING SO_TIMESTAMPING
62
63#endif /* __ASM_GENERIC_SOCKET_H */
diff --git a/include/asm-generic/sockios.h b/include/asm-generic/sockios.h
new file mode 100644
index 000000000000..9a61a369b901
--- /dev/null
+++ b/include/asm-generic/sockios.h
@@ -0,0 +1,13 @@
1#ifndef __ASM_GENERIC_SOCKIOS_H
2#define __ASM_GENERIC_SOCKIOS_H
3
4/* Socket-level I/O control calls. */
5#define FIOSETOWN 0x8901
6#define SIOCSPGRP 0x8902
7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
12
13#endif /* __ASM_GENERIC_SOCKIOS_H */
diff --git a/include/asm-generic/spinlock.h b/include/asm-generic/spinlock.h
new file mode 100644
index 000000000000..1547a03ac50f
--- /dev/null
+++ b/include/asm-generic/spinlock.h
@@ -0,0 +1,11 @@
1#ifndef __ASM_GENERIC_SPINLOCK_H
2#define __ASM_GENERIC_SPINLOCK_H
3/*
4 * You need to implement asm/spinlock.h for SMP support. The generic
5 * version does not handle SMP.
6 */
7#ifdef CONFIG_SMP
8#error need an architecture specific asm/spinlock.h
9#endif
10
11#endif /* __ASM_GENERIC_SPINLOCK_H */
diff --git a/include/asm-generic/stat.h b/include/asm-generic/stat.h
new file mode 100644
index 000000000000..47e64170305d
--- /dev/null
+++ b/include/asm-generic/stat.h
@@ -0,0 +1,72 @@
1#ifndef __ASM_GENERIC_STAT_H
2#define __ASM_GENERIC_STAT_H
3
4/*
5 * Everybody gets this wrong and has to stick with it for all
6 * eternity. Hopefully, this version gets used by new architectures
7 * so they don't fall into the same traps.
8 *
9 * stat64 is copied from powerpc64, with explicit padding added.
10 * stat is the same structure layout on 64-bit, without the 'long long'
11 * types.
12 *
13 * By convention, 64 bit architectures use the stat interface, while
14 * 32 bit architectures use the stat64 interface. Note that we don't
15 * provide an __old_kernel_stat here, which new architecture should
16 * not have to start with.
17 */
18
19#include <asm/bitsperlong.h>
20
21#define STAT_HAVE_NSEC 1
22
23struct stat {
24 unsigned long st_dev; /* Device. */
25 unsigned long st_ino; /* File serial number. */
26 unsigned int st_mode; /* File mode. */
27 unsigned int st_nlink; /* Link count. */
28 unsigned int st_uid; /* User ID of the file's owner. */
29 unsigned int st_gid; /* Group ID of the file's group. */
30 unsigned long st_rdev; /* Device number, if device. */
31 unsigned long __pad1;
32 long st_size; /* Size of file, in bytes. */
33 int st_blksize; /* Optimal block size for I/O. */
34 int __pad2;
35 long st_blocks; /* Number 512-byte blocks allocated. */
36 int st_atime; /* Time of last access. */
37 unsigned int st_atime_nsec;
38 int st_mtime; /* Time of last modification. */
39 unsigned int st_mtime_nsec;
40 int st_ctime; /* Time of last status change. */
41 unsigned int st_ctime_nsec;
42 unsigned int __unused4;
43 unsigned int __unused5;
44};
45
46#if __BITS_PER_LONG != 64
47/* This matches struct stat64 in glibc2.1. Only used for 32 bit. */
48struct stat64 {
49 unsigned long long st_dev; /* Device. */
50 unsigned long long st_ino; /* File serial number. */
51 unsigned int st_mode; /* File mode. */
52 unsigned int st_nlink; /* Link count. */
53 unsigned int st_uid; /* User ID of the file's owner. */
54 unsigned int st_gid; /* Group ID of the file's group. */
55 unsigned long long st_rdev; /* Device number, if device. */
56 unsigned long long __pad1;
57 long long st_size; /* Size of file, in bytes. */
58 int st_blksize; /* Optimal block size for I/O. */
59 int __pad2;
60 long long st_blocks; /* Number 512-byte blocks allocated. */
61 int st_atime; /* Time of last access. */
62 unsigned int st_atime_nsec;
63 int st_mtime; /* Time of last modification. */
64 unsigned int st_mtime_nsec;
65 int st_ctime; /* Time of last status change. */
66 unsigned int st_ctime_nsec;
67 unsigned int __unused4;
68 unsigned int __unused5;
69};
70#endif
71
72#endif /* __ASM_GENERIC_STAT_H */
diff --git a/include/asm-generic/string.h b/include/asm-generic/string.h
new file mode 100644
index 000000000000..de5e0201459f
--- /dev/null
+++ b/include/asm-generic/string.h
@@ -0,0 +1,10 @@
1#ifndef __ASM_GENERIC_STRING_H
2#define __ASM_GENERIC_STRING_H
3/*
4 * The kernel provides all required functions in lib/string.c
5 *
6 * Architectures probably want to provide at least their own optimized
7 * memcpy and memset functions though.
8 */
9
10#endif /* __ASM_GENERIC_STRING_H */
diff --git a/include/asm-generic/swab.h b/include/asm-generic/swab.h
new file mode 100644
index 000000000000..a8e9029d9eba
--- /dev/null
+++ b/include/asm-generic/swab.h
@@ -0,0 +1,18 @@
1#ifndef _ASM_GENERIC_SWAB_H
2#define _ASM_GENERIC_SWAB_H
3
4#include <asm/bitsperlong.h>
5
6/*
7 * 32 bit architectures typically (but not always) want to
8 * set __SWAB_64_THRU_32__. In user space, this is only
9 * valid if the compiler supports 64 bit data types.
10 */
11
12#if __BITS_PER_LONG == 32
13#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
14#define __SWAB_64_THRU_32__
15#endif
16#endif
17
18#endif /* _ASM_GENERIC_SWAB_H */
diff --git a/include/asm-generic/syscalls.h b/include/asm-generic/syscalls.h
new file mode 100644
index 000000000000..df84e3b04555
--- /dev/null
+++ b/include/asm-generic/syscalls.h
@@ -0,0 +1,60 @@
1#ifndef __ASM_GENERIC_SYSCALLS_H
2#define __ASM_GENERIC_SYSCALLS_H
3
4#include <linux/compiler.h>
5#include <linux/linkage.h>
6
7/*
8 * Calling conventions for these system calls can differ, so
9 * it's possible to override them.
10 */
11#ifndef sys_clone
12asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp,
13 void __user *parent_tid, void __user *child_tid,
14 struct pt_regs *regs);
15#endif
16
17#ifndef sys_fork
18asmlinkage long sys_fork(struct pt_regs *regs);
19#endif
20
21#ifndef sys_vfork
22asmlinkage long sys_vfork(struct pt_regs *regs);
23#endif
24
25#ifndef sys_execve
26asmlinkage long sys_execve(char __user *filename, char __user * __user *argv,
27 char __user * __user *envp, struct pt_regs *regs);
28#endif
29
30#ifndef sys_mmap2
31asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
32 unsigned long prot, unsigned long flags,
33 unsigned long fd, unsigned long pgoff);
34#endif
35
36#ifndef sys_mmap
37asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
38 unsigned long prot, unsigned long flags,
39 unsigned long fd, off_t pgoff);
40#endif
41
42#ifndef sys_sigaltstack
43asmlinkage long sys_sigaltstack(const stack_t __user *, stack_t __user *,
44 struct pt_regs *);
45#endif
46
47#ifndef sys_rt_sigreturn
48asmlinkage long sys_rt_sigreturn(struct pt_regs *regs);
49#endif
50
51#ifndef sys_rt_sigsuspend
52asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize);
53#endif
54
55#ifndef sys_rt_sigaction
56asmlinkage long sys_rt_sigaction(int sig, const struct sigaction __user *act,
57 struct sigaction __user *oact, size_t sigsetsize);
58#endif
59
60#endif /* __ASM_GENERIC_SYSCALLS_H */
diff --git a/include/asm-generic/system.h b/include/asm-generic/system.h
new file mode 100644
index 000000000000..efa403b5e121
--- /dev/null
+++ b/include/asm-generic/system.h
@@ -0,0 +1,161 @@
1/* Generic system definitions, based on MN10300 definitions.
2 *
3 * It should be possible to use these on really simple architectures,
4 * but it serves more as a starting point for new ports.
5 *
6 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
7 * Written by David Howells (dhowells@redhat.com)
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public Licence
11 * as published by the Free Software Foundation; either version
12 * 2 of the Licence, or (at your option) any later version.
13 */
14#ifndef __ASM_GENERIC_SYSTEM_H
15#define __ASM_GENERIC_SYSTEM_H
16
17#ifdef __KERNEL__
18#ifndef __ASSEMBLY__
19
20#include <linux/types.h>
21#include <linux/irqflags.h>
22
23#include <asm/cmpxchg-local.h>
24
25struct task_struct;
26
27/* context switching is now performed out-of-line in switch_to.S */
28extern struct task_struct *__switch_to(struct task_struct *,
29 struct task_struct *);
30#define switch_to(prev, next, last) \
31 do { \
32 ((last) = __switch_to((prev), (next))); \
33 } while (0)
34
35#define arch_align_stack(x) (x)
36
37#define nop() asm volatile ("nop")
38
39#endif /* !__ASSEMBLY__ */
40
41/*
42 * Force strict CPU ordering.
43 * And yes, this is required on UP too when we're talking
44 * to devices.
45 *
46 * This implementation only contains a compiler barrier.
47 */
48
49#define mb() asm volatile ("": : :"memory")
50#define rmb() mb()
51#define wmb() asm volatile ("": : :"memory")
52
53#ifdef CONFIG_SMP
54#define smp_mb() mb()
55#define smp_rmb() rmb()
56#define smp_wmb() wmb()
57#else
58#define smp_mb() barrier()
59#define smp_rmb() barrier()
60#define smp_wmb() barrier()
61#endif
62
63#define set_mb(var, value) do { var = value; mb(); } while (0)
64#define set_wmb(var, value) do { var = value; wmb(); } while (0)
65
66#define read_barrier_depends() do {} while (0)
67#define smp_read_barrier_depends() do {} while (0)
68
69/*
70 * we make sure local_irq_enable() doesn't cause priority inversion
71 */
72#ifndef __ASSEMBLY__
73
74/* This function doesn't exist, so you'll get a linker error
75 * if something tries to do an invalid xchg(). */
76extern void __xchg_called_with_bad_pointer(void);
77
78static inline
79unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
80{
81 unsigned long ret, flags;
82
83 switch (size) {
84 case 1:
85#ifdef __xchg_u8
86 return __xchg_u8(x, ptr);
87#else
88 local_irq_save(flags);
89 ret = *(volatile u8 *)ptr;
90 *(volatile u8 *)ptr = x;
91 local_irq_restore(flags);
92 return ret;
93#endif /* __xchg_u8 */
94
95 case 2:
96#ifdef __xchg_u16
97 return __xchg_u16(x, ptr);
98#else
99 local_irq_save(flags);
100 ret = *(volatile u16 *)ptr;
101 *(volatile u16 *)ptr = x;
102 local_irq_restore(flags);
103 return ret;
104#endif /* __xchg_u16 */
105
106 case 4:
107#ifdef __xchg_u32
108 return __xchg_u32(x, ptr);
109#else
110 local_irq_save(flags);
111 ret = *(volatile u32 *)ptr;
112 *(volatile u32 *)ptr = x;
113 local_irq_restore(flags);
114 return ret;
115#endif /* __xchg_u32 */
116
117#ifdef CONFIG_64BIT
118 case 8:
119#ifdef __xchg_u64
120 return __xchg_u64(x, ptr);
121#else
122 local_irq_save(flags);
123 ret = *(volatile u64 *)ptr;
124 *(volatile u64 *)ptr = x;
125 local_irq_restore(flags);
126 return ret;
127#endif /* __xchg_u64 */
128#endif /* CONFIG_64BIT */
129
130 default:
131 __xchg_called_with_bad_pointer();
132 return x;
133 }
134}
135
136#define xchg(ptr, x) \
137 ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
138
139static inline unsigned long __cmpxchg(volatile unsigned long *m,
140 unsigned long old, unsigned long new)
141{
142 unsigned long retval;
143 unsigned long flags;
144
145 local_irq_save(flags);
146 retval = *m;
147 if (retval == old)
148 *m = new;
149 local_irq_restore(flags);
150 return retval;
151}
152
153#define cmpxchg(ptr, o, n) \
154 ((__typeof__(*(ptr))) __cmpxchg((unsigned long *)(ptr), \
155 (unsigned long)(o), \
156 (unsigned long)(n)))
157
158#endif /* !__ASSEMBLY__ */
159
160#endif /* __KERNEL__ */
161#endif /* __ASM_GENERIC_SYSTEM_H */
diff --git a/include/asm-generic/termbits.h b/include/asm-generic/termbits.h
new file mode 100644
index 000000000000..1c9773d48cb0
--- /dev/null
+++ b/include/asm-generic/termbits.h
@@ -0,0 +1,198 @@
1#ifndef __ASM_GENERIC_TERMBITS_H
2#define __ASM_GENERIC_TERMBITS_H
3
4#include <linux/posix_types.h>
5
6typedef unsigned char cc_t;
7typedef unsigned int speed_t;
8typedef unsigned int tcflag_t;
9
10#define NCCS 19
11struct termios {
12 tcflag_t c_iflag; /* input mode flags */
13 tcflag_t c_oflag; /* output mode flags */
14 tcflag_t c_cflag; /* control mode flags */
15 tcflag_t c_lflag; /* local mode flags */
16 cc_t c_line; /* line discipline */
17 cc_t c_cc[NCCS]; /* control characters */
18};
19
20struct termios2 {
21 tcflag_t c_iflag; /* input mode flags */
22 tcflag_t c_oflag; /* output mode flags */
23 tcflag_t c_cflag; /* control mode flags */
24 tcflag_t c_lflag; /* local mode flags */
25 cc_t c_line; /* line discipline */
26 cc_t c_cc[NCCS]; /* control characters */
27 speed_t c_ispeed; /* input speed */
28 speed_t c_ospeed; /* output speed */
29};
30
31struct ktermios {
32 tcflag_t c_iflag; /* input mode flags */
33 tcflag_t c_oflag; /* output mode flags */
34 tcflag_t c_cflag; /* control mode flags */
35 tcflag_t c_lflag; /* local mode flags */
36 cc_t c_line; /* line discipline */
37 cc_t c_cc[NCCS]; /* control characters */
38 speed_t c_ispeed; /* input speed */
39 speed_t c_ospeed; /* output speed */
40};
41
42/* c_cc characters */
43#define VINTR 0
44#define VQUIT 1
45#define VERASE 2
46#define VKILL 3
47#define VEOF 4
48#define VTIME 5
49#define VMIN 6
50#define VSWTC 7
51#define VSTART 8
52#define VSTOP 9
53#define VSUSP 10
54#define VEOL 11
55#define VREPRINT 12
56#define VDISCARD 13
57#define VWERASE 14
58#define VLNEXT 15
59#define VEOL2 16
60
61/* c_iflag bits */
62#define IGNBRK 0000001
63#define BRKINT 0000002
64#define IGNPAR 0000004
65#define PARMRK 0000010
66#define INPCK 0000020
67#define ISTRIP 0000040
68#define INLCR 0000100
69#define IGNCR 0000200
70#define ICRNL 0000400
71#define IUCLC 0001000
72#define IXON 0002000
73#define IXANY 0004000
74#define IXOFF 0010000
75#define IMAXBEL 0020000
76#define IUTF8 0040000
77
78/* c_oflag bits */
79#define OPOST 0000001
80#define OLCUC 0000002
81#define ONLCR 0000004
82#define OCRNL 0000010
83#define ONOCR 0000020
84#define ONLRET 0000040
85#define OFILL 0000100
86#define OFDEL 0000200
87#define NLDLY 0000400
88#define NL0 0000000
89#define NL1 0000400
90#define CRDLY 0003000
91#define CR0 0000000
92#define CR1 0001000
93#define CR2 0002000
94#define CR3 0003000
95#define TABDLY 0014000
96#define TAB0 0000000
97#define TAB1 0004000
98#define TAB2 0010000
99#define TAB3 0014000
100#define XTABS 0014000
101#define BSDLY 0020000
102#define BS0 0000000
103#define BS1 0020000
104#define VTDLY 0040000
105#define VT0 0000000
106#define VT1 0040000
107#define FFDLY 0100000
108#define FF0 0000000
109#define FF1 0100000
110
111/* c_cflag bit meaning */
112#define CBAUD 0010017
113#define B0 0000000 /* hang up */
114#define B50 0000001
115#define B75 0000002
116#define B110 0000003
117#define B134 0000004
118#define B150 0000005
119#define B200 0000006
120#define B300 0000007
121#define B600 0000010
122#define B1200 0000011
123#define B1800 0000012
124#define B2400 0000013
125#define B4800 0000014
126#define B9600 0000015
127#define B19200 0000016
128#define B38400 0000017
129#define EXTA B19200
130#define EXTB B38400
131#define CSIZE 0000060
132#define CS5 0000000
133#define CS6 0000020
134#define CS7 0000040
135#define CS8 0000060
136#define CSTOPB 0000100
137#define CREAD 0000200
138#define PARENB 0000400
139#define PARODD 0001000
140#define HUPCL 0002000
141#define CLOCAL 0004000
142#define CBAUDEX 0010000
143#define BOTHER 0010000
144#define B57600 0010001
145#define B115200 0010002
146#define B230400 0010003
147#define B460800 0010004
148#define B500000 0010005
149#define B576000 0010006
150#define B921600 0010007
151#define B1000000 0010010
152#define B1152000 0010011
153#define B1500000 0010012
154#define B2000000 0010013
155#define B2500000 0010014
156#define B3000000 0010015
157#define B3500000 0010016
158#define B4000000 0010017
159#define CIBAUD 002003600000 /* input baud rate */
160#define CMSPAR 010000000000 /* mark or space (stick) parity */
161#define CRTSCTS 020000000000 /* flow control */
162
163#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
164
165/* c_lflag bits */
166#define ISIG 0000001
167#define ICANON 0000002
168#define XCASE 0000004
169#define ECHO 0000010
170#define ECHOE 0000020
171#define ECHOK 0000040
172#define ECHONL 0000100
173#define NOFLSH 0000200
174#define TOSTOP 0000400
175#define ECHOCTL 0001000
176#define ECHOPRT 0002000
177#define ECHOKE 0004000
178#define FLUSHO 0010000
179#define PENDIN 0040000
180#define IEXTEN 0100000
181
182/* tcflow() and TCXONC use these */
183#define TCOOFF 0
184#define TCOON 1
185#define TCIOFF 2
186#define TCION 3
187
188/* tcflush() and TCFLSH use these */
189#define TCIFLUSH 0
190#define TCOFLUSH 1
191#define TCIOFLUSH 2
192
193/* tcsetattr uses these */
194#define TCSANOW 0
195#define TCSADRAIN 1
196#define TCSAFLUSH 2
197
198#endif /* __ASM_GENERIC_TERMBITS_H */
diff --git a/include/asm-generic/termios-base.h b/include/asm-generic/termios-base.h
new file mode 100644
index 000000000000..0a769feb22b0
--- /dev/null
+++ b/include/asm-generic/termios-base.h
@@ -0,0 +1,77 @@
1/* termios.h: generic termios/termio user copying/translation
2 */
3
4#ifndef _ASM_GENERIC_TERMIOS_BASE_H
5#define _ASM_GENERIC_TERMIOS_BASE_H
6
7#include <asm/uaccess.h>
8
9#ifndef __ARCH_TERMIO_GETPUT
10
11/*
12 * Translate a "termio" structure into a "termios". Ugh.
13 */
14static inline int user_termio_to_kernel_termios(struct ktermios *termios,
15 struct termio __user *termio)
16{
17 unsigned short tmp;
18
19 if (get_user(tmp, &termio->c_iflag) < 0)
20 goto fault;
21 termios->c_iflag = (0xffff0000 & termios->c_iflag) | tmp;
22
23 if (get_user(tmp, &termio->c_oflag) < 0)
24 goto fault;
25 termios->c_oflag = (0xffff0000 & termios->c_oflag) | tmp;
26
27 if (get_user(tmp, &termio->c_cflag) < 0)
28 goto fault;
29 termios->c_cflag = (0xffff0000 & termios->c_cflag) | tmp;
30
31 if (get_user(tmp, &termio->c_lflag) < 0)
32 goto fault;
33 termios->c_lflag = (0xffff0000 & termios->c_lflag) | tmp;
34
35 if (get_user(termios->c_line, &termio->c_line) < 0)
36 goto fault;
37
38 if (copy_from_user(termios->c_cc, termio->c_cc, NCC) != 0)
39 goto fault;
40
41 return 0;
42
43 fault:
44 return -EFAULT;
45}
46
47/*
48 * Translate a "termios" structure into a "termio". Ugh.
49 */
50static inline int kernel_termios_to_user_termio(struct termio __user *termio,
51 struct ktermios *termios)
52{
53 if (put_user(termios->c_iflag, &termio->c_iflag) < 0 ||
54 put_user(termios->c_oflag, &termio->c_oflag) < 0 ||
55 put_user(termios->c_cflag, &termio->c_cflag) < 0 ||
56 put_user(termios->c_lflag, &termio->c_lflag) < 0 ||
57 put_user(termios->c_line, &termio->c_line) < 0 ||
58 copy_to_user(termio->c_cc, termios->c_cc, NCC) != 0)
59 return -EFAULT;
60
61 return 0;
62}
63
64#ifndef user_termios_to_kernel_termios
65#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
66#endif
67
68#ifndef kernel_termios_to_user_termios
69#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
70#endif
71
72#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
73#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
74
75#endif /* __ARCH_TERMIO_GETPUT */
76
77#endif /* _ASM_GENERIC_TERMIOS_BASE_H */
diff --git a/include/asm-generic/termios.h b/include/asm-generic/termios.h
index 7d39ecc92d94..d0922adc56d4 100644
--- a/include/asm-generic/termios.h
+++ b/include/asm-generic/termios.h
@@ -1,18 +1,68 @@
1/* termios.h: generic termios/termio user copying/translation
2 */
3
4#ifndef _ASM_GENERIC_TERMIOS_H 1#ifndef _ASM_GENERIC_TERMIOS_H
5#define _ASM_GENERIC_TERMIOS_H 2#define _ASM_GENERIC_TERMIOS_H
3/*
4 * Most architectures have straight copies of the x86 code, with
5 * varying levels of bug fixes on top. Usually it's a good idea
6 * to use this generic version instead, but be careful to avoid
7 * ABI changes.
8 * New architectures should not provide their own version.
9 */
10
11#include <asm/termbits.h>
12#include <asm/ioctls.h>
13
14struct winsize {
15 unsigned short ws_row;
16 unsigned short ws_col;
17 unsigned short ws_xpixel;
18 unsigned short ws_ypixel;
19};
20
21#define NCC 8
22struct termio {
23 unsigned short c_iflag; /* input mode flags */
24 unsigned short c_oflag; /* output mode flags */
25 unsigned short c_cflag; /* control mode flags */
26 unsigned short c_lflag; /* local mode flags */
27 unsigned char c_line; /* line discipline */
28 unsigned char c_cc[NCC]; /* control characters */
29};
30
31/* modem lines */
32#define TIOCM_LE 0x001
33#define TIOCM_DTR 0x002
34#define TIOCM_RTS 0x004
35#define TIOCM_ST 0x008
36#define TIOCM_SR 0x010
37#define TIOCM_CTS 0x020
38#define TIOCM_CAR 0x040
39#define TIOCM_RNG 0x080
40#define TIOCM_DSR 0x100
41#define TIOCM_CD TIOCM_CAR
42#define TIOCM_RI TIOCM_RNG
43#define TIOCM_OUT1 0x2000
44#define TIOCM_OUT2 0x4000
45#define TIOCM_LOOP 0x8000
46
47/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
48
49#ifdef __KERNEL__
6 50
7#include <asm/uaccess.h> 51#include <asm/uaccess.h>
8 52
9#ifndef __ARCH_TERMIO_GETPUT 53/* intr=^C quit=^\ erase=del kill=^U
54 eof=^D vtime=\0 vmin=\1 sxtc=\0
55 start=^Q stop=^S susp=^Z eol=\0
56 reprint=^R discard=^U werase=^W lnext=^V
57 eol2=\0
58*/
59#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
10 60
11/* 61/*
12 * Translate a "termio" structure into a "termios". Ugh. 62 * Translate a "termio" structure into a "termios". Ugh.
13 */ 63 */
14static inline int user_termio_to_kernel_termios(struct ktermios *termios, 64static inline int user_termio_to_kernel_termios(struct ktermios *termios,
15 struct termio __user *termio) 65 const struct termio __user *termio)
16{ 66{
17 unsigned short tmp; 67 unsigned short tmp;
18 68
@@ -61,17 +111,44 @@ static inline int kernel_termios_to_user_termio(struct termio __user *termio,
61 return 0; 111 return 0;
62} 112}
63 113
64#ifndef user_termios_to_kernel_termios 114#ifdef TCGETS2
65#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) 115static inline int user_termios_to_kernel_termios(struct ktermios *k,
66#endif 116 struct termios2 __user *u)
117{
118 return copy_from_user(k, u, sizeof(struct termios2));
119}
67 120
68#ifndef kernel_termios_to_user_termios 121static inline int kernel_termios_to_user_termios(struct termios2 __user *u,
69#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) 122 struct ktermios *k)
70#endif 123{
124 return copy_to_user(u, k, sizeof(struct termios2));
125}
71 126
72#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) 127static inline int user_termios_to_kernel_termios_1(struct ktermios *k,
73#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) 128 struct termios __user *u)
129{
130 return copy_from_user(k, u, sizeof(struct termios));
131}
132
133static inline int kernel_termios_to_user_termios_1(struct termios __user *u,
134 struct ktermios *k)
135{
136 return copy_to_user(u, k, sizeof(struct termios));
137}
138#else /* TCGETS2 */
139static inline int user_termios_to_kernel_termios(struct ktermios *k,
140 struct termios __user *u)
141{
142 return copy_from_user(k, u, sizeof(struct termios));
143}
144
145static inline int kernel_termios_to_user_termios(struct termios __user *u,
146 struct ktermios *k)
147{
148 return copy_to_user(u, k, sizeof(struct termios));
149}
150#endif /* TCGETS2 */
74 151
75#endif /* __ARCH_TERMIO_GETPUT */ 152#endif /* __KERNEL__ */
76 153
77#endif /* _ASM_GENERIC_TERMIOS_H */ 154#endif /* _ASM_GENERIC_TERMIOS_H */
diff --git a/include/asm-generic/timex.h b/include/asm-generic/timex.h
new file mode 100644
index 000000000000..b2243cb8d6f6
--- /dev/null
+++ b/include/asm-generic/timex.h
@@ -0,0 +1,22 @@
1#ifndef __ASM_GENERIC_TIMEX_H
2#define __ASM_GENERIC_TIMEX_H
3
4/*
5 * If you have a cycle counter, return the value here.
6 */
7typedef unsigned long cycles_t;
8#ifndef get_cycles
9static inline cycles_t get_cycles(void)
10{
11 return 0;
12}
13#endif
14
15/*
16 * Architectures are encouraged to implement read_current_timer
17 * and define this in order to avoid the expensive delay loop
18 * calibration during boot.
19 */
20#undef ARCH_HAS_READ_CURRENT_TIMER
21
22#endif /* __ASM_GENERIC_TIMEX_H */
diff --git a/include/asm-generic/tlbflush.h b/include/asm-generic/tlbflush.h
new file mode 100644
index 000000000000..c7af037024c7
--- /dev/null
+++ b/include/asm-generic/tlbflush.h
@@ -0,0 +1,18 @@
1#ifndef __ASM_GENERIC_TLBFLUSH_H
2#define __ASM_GENERIC_TLBFLUSH_H
3/*
4 * This is a dummy tlbflush implementation that can be used on all
5 * nommu architectures.
6 * If you have an MMU, you need to write your own functions.
7 */
8#ifdef CONFIG_MMU
9#error need to implement an architecture specific asm/tlbflush.h
10#endif
11
12static inline void flush_tlb_mm(struct mm_struct *mm)
13{
14 BUG();
15}
16
17
18#endif /* __ASM_GENERIC_TLBFLUSH_H */
diff --git a/include/asm-generic/types.h b/include/asm-generic/types.h
new file mode 100644
index 000000000000..fba7d33ca3f2
--- /dev/null
+++ b/include/asm-generic/types.h
@@ -0,0 +1,42 @@
1#ifndef _ASM_GENERIC_TYPES_H
2#define _ASM_GENERIC_TYPES_H
3/*
4 * int-ll64 is used practically everywhere now,
5 * so use it as a reasonable default.
6 */
7#include <asm-generic/int-ll64.h>
8
9#ifndef __ASSEMBLY__
10
11typedef unsigned short umode_t;
12
13#endif /* __ASSEMBLY__ */
14
15/*
16 * These aren't exported outside the kernel to avoid name space clashes
17 */
18#ifdef __KERNEL__
19#ifndef __ASSEMBLY__
20/*
21 * DMA addresses may be very different from physical addresses
22 * and pointers. i386 and powerpc may have 64 bit DMA on 32 bit
23 * systems, while sparc64 uses 32 bit DMA addresses for 64 bit
24 * physical addresses.
25 * This default defines dma_addr_t to have the same size as
26 * phys_addr_t, which is the most common way.
27 * Do not define the dma64_addr_t type, which never really
28 * worked.
29 */
30#ifndef dma_addr_t
31#ifdef CONFIG_PHYS_ADDR_T_64BIT
32typedef u64 dma_addr_t;
33#else
34typedef u32 dma_addr_t;
35#endif /* CONFIG_PHYS_ADDR_T_64BIT */
36#endif /* dma_addr_t */
37
38#endif /* __ASSEMBLY__ */
39
40#endif /* __KERNEL__ */
41
42#endif /* _ASM_GENERIC_TYPES_H */
diff --git a/include/asm-generic/uaccess-unaligned.h b/include/asm-generic/uaccess-unaligned.h
new file mode 100644
index 000000000000..67deb898f0c5
--- /dev/null
+++ b/include/asm-generic/uaccess-unaligned.h
@@ -0,0 +1,26 @@
1#ifndef __ASM_GENERIC_UACCESS_UNALIGNED_H
2#define __ASM_GENERIC_UACCESS_UNALIGNED_H
3
4/*
5 * This macro should be used instead of __get_user() when accessing
6 * values at locations that are not known to be aligned.
7 */
8#define __get_user_unaligned(x, ptr) \
9({ \
10 __typeof__ (*(ptr)) __x; \
11 __copy_from_user(&__x, (ptr), sizeof(*(ptr))) ? -EFAULT : 0; \
12 (x) = __x; \
13})
14
15
16/*
17 * This macro should be used instead of __put_user() when accessing
18 * values at locations that are not known to be aligned.
19 */
20#define __put_user_unaligned(x, ptr) \
21({ \
22 __typeof__ (*(ptr)) __x = (x); \
23 __copy_to_user((ptr), &__x, sizeof(*(ptr))) ? -EFAULT : 0; \
24})
25
26#endif /* __ASM_GENERIC_UACCESS_UNALIGNED_H */
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index 549cb3a1640a..b218b8513d04 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -1,26 +1,327 @@
1#ifndef _ASM_GENERIC_UACCESS_H_ 1#ifndef __ASM_GENERIC_UACCESS_H
2#define _ASM_GENERIC_UACCESS_H_ 2#define __ASM_GENERIC_UACCESS_H
3 3
4/* 4/*
5 * This macro should be used instead of __get_user() when accessing 5 * User space memory access functions, these should work
6 * values at locations that are not known to be aligned. 6 * on a ny machine that has kernel and user data in the same
7 * address space, e.g. all NOMMU machines.
7 */ 8 */
8#define __get_user_unaligned(x, ptr) \ 9#include <linux/sched.h>
9({ \ 10#include <linux/mm.h>
10 __typeof__ (*(ptr)) __x; \ 11#include <linux/string.h>
11 __copy_from_user(&__x, (ptr), sizeof(*(ptr))) ? -EFAULT : 0; \ 12
12 (x) = __x; \ 13#include <asm/segment.h>
13}) 14
15#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
16
17#ifndef KERNEL_DS
18#define KERNEL_DS MAKE_MM_SEG(~0UL)
19#endif
20
21#ifndef USER_DS
22#define USER_DS MAKE_MM_SEG(TASK_SIZE - 1)
23#endif
24
25#ifndef get_fs
26#define get_ds() (KERNEL_DS)
27#define get_fs() (current_thread_info()->addr_limit)
28
29static inline void set_fs(mm_segment_t fs)
30{
31 current_thread_info()->addr_limit = fs;
32}
33#endif
14 34
35#define segment_eq(a, b) ((a).seg == (b).seg)
36
37#define VERIFY_READ 0
38#define VERIFY_WRITE 1
39
40#define access_ok(type, addr, size) __access_ok((unsigned long)(addr),(size))
41
42/*
43 * The architecture should really override this if possible, at least
44 * doing a check on the get_fs()
45 */
46#ifndef __access_ok
47static inline int __access_ok(unsigned long addr, unsigned long size)
48{
49 return 1;
50}
51#endif
15 52
16/* 53/*
17 * This macro should be used instead of __put_user() when accessing 54 * The exception table consists of pairs of addresses: the first is the
18 * values at locations that are not known to be aligned. 55 * address of an instruction that is allowed to fault, and the second is
56 * the address at which the program should continue. No registers are
57 * modified, so it is entirely up to the continuation code to figure out
58 * what to do.
59 *
60 * All the routines below use bits of fixup code that are out of line
61 * with the main instruction path. This means when everything is well,
62 * we don't even have to jump over them. Further, they do not intrude
63 * on our cache or tlb entries.
19 */ 64 */
20#define __put_user_unaligned(x, ptr) \ 65
21({ \ 66struct exception_table_entry
22 __typeof__ (*(ptr)) __x = (x); \ 67{
23 __copy_to_user((ptr), &__x, sizeof(*(ptr))) ? -EFAULT : 0; \ 68 unsigned long insn, fixup;
69};
70
71/* Returns 0 if exception not found and fixup otherwise. */
72extern unsigned long search_exception_table(unsigned long);
73
74/*
75 * architectures with an MMU should override these two
76 */
77#ifndef __copy_from_user
78static inline __must_check long __copy_from_user(void *to,
79 const void __user * from, unsigned long n)
80{
81 if (__builtin_constant_p(n)) {
82 switch(n) {
83 case 1:
84 *(u8 *)to = *(u8 __force *)from;
85 return 0;
86 case 2:
87 *(u16 *)to = *(u16 __force *)from;
88 return 0;
89 case 4:
90 *(u32 *)to = *(u32 __force *)from;
91 return 0;
92#ifdef CONFIG_64BIT
93 case 8:
94 *(u64 *)to = *(u64 __force *)from;
95 return 0;
96#endif
97 default:
98 break;
99 }
100 }
101
102 memcpy(to, (const void __force *)from, n);
103 return 0;
104}
105#endif
106
107#ifndef __copy_to_user
108static inline __must_check long __copy_to_user(void __user *to,
109 const void *from, unsigned long n)
110{
111 if (__builtin_constant_p(n)) {
112 switch(n) {
113 case 1:
114 *(u8 __force *)to = *(u8 *)from;
115 return 0;
116 case 2:
117 *(u16 __force *)to = *(u16 *)from;
118 return 0;
119 case 4:
120 *(u32 __force *)to = *(u32 *)from;
121 return 0;
122#ifdef CONFIG_64BIT
123 case 8:
124 *(u64 __force *)to = *(u64 *)from;
125 return 0;
126#endif
127 default:
128 break;
129 }
130 }
131
132 memcpy((void __force *)to, from, n);
133 return 0;
134}
135#endif
136
137/*
138 * These are the main single-value transfer routines. They automatically
139 * use the right size if we just have the right pointer type.
140 * This version just falls back to copy_{from,to}_user, which should
141 * provide a fast-path for small values.
142 */
143#define __put_user(x, ptr) \
144({ \
145 __typeof__(*(ptr)) __x = (x); \
146 int __pu_err = -EFAULT; \
147 __chk_user_ptr(ptr); \
148 switch (sizeof (*(ptr))) { \
149 case 1: \
150 case 2: \
151 case 4: \
152 case 8: \
153 __pu_err = __put_user_fn(sizeof (*(ptr)), \
154 ptr, &__x); \
155 break; \
156 default: \
157 __put_user_bad(); \
158 break; \
159 } \
160 __pu_err; \
161})
162
163#define put_user(x, ptr) \
164({ \
165 might_sleep(); \
166 access_ok(VERIFY_WRITE, ptr, sizeof(*ptr)) ? \
167 __put_user(x, ptr) : \
168 -EFAULT; \
24}) 169})
25 170
26#endif /* _ASM_GENERIC_UACCESS_H */ 171static inline int __put_user_fn(size_t size, void __user *ptr, void *x)
172{
173 size = __copy_to_user(ptr, x, size);
174 return size ? -EFAULT : size;
175}
176
177extern int __put_user_bad(void) __attribute__((noreturn));
178
179#define __get_user(x, ptr) \
180({ \
181 int __gu_err = -EFAULT; \
182 __chk_user_ptr(ptr); \
183 switch (sizeof(*(ptr))) { \
184 case 1: { \
185 unsigned char __x; \
186 __gu_err = __get_user_fn(sizeof (*(ptr)), \
187 ptr, &__x); \
188 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
189 break; \
190 }; \
191 case 2: { \
192 unsigned short __x; \
193 __gu_err = __get_user_fn(sizeof (*(ptr)), \
194 ptr, &__x); \
195 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
196 break; \
197 }; \
198 case 4: { \
199 unsigned int __x; \
200 __gu_err = __get_user_fn(sizeof (*(ptr)), \
201 ptr, &__x); \
202 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
203 break; \
204 }; \
205 case 8: { \
206 unsigned long long __x; \
207 __gu_err = __get_user_fn(sizeof (*(ptr)), \
208 ptr, &__x); \
209 (x) = *(__force __typeof__(*(ptr)) *) &__x; \
210 break; \
211 }; \
212 default: \
213 __get_user_bad(); \
214 break; \
215 } \
216 __gu_err; \
217})
218
219#define get_user(x, ptr) \
220({ \
221 might_sleep(); \
222 access_ok(VERIFY_READ, ptr, sizeof(*ptr)) ? \
223 __get_user(x, ptr) : \
224 -EFAULT; \
225})
226
227static inline int __get_user_fn(size_t size, const void __user *ptr, void *x)
228{
229 size = __copy_from_user(x, ptr, size);
230 return size ? -EFAULT : size;
231}
232
233extern int __get_user_bad(void) __attribute__((noreturn));
234
235#ifndef __copy_from_user_inatomic
236#define __copy_from_user_inatomic __copy_from_user
237#endif
238
239#ifndef __copy_to_user_inatomic
240#define __copy_to_user_inatomic __copy_to_user
241#endif
242
243static inline long copy_from_user(void *to,
244 const void __user * from, unsigned long n)
245{
246 might_sleep();
247 if (access_ok(VERIFY_READ, from, n))
248 return __copy_from_user(to, from, n);
249 else
250 return n;
251}
252
253static inline long copy_to_user(void __user *to,
254 const void *from, unsigned long n)
255{
256 might_sleep();
257 if (access_ok(VERIFY_WRITE, to, n))
258 return __copy_to_user(to, from, n);
259 else
260 return n;
261}
262
263/*
264 * Copy a null terminated string from userspace.
265 */
266#ifndef __strncpy_from_user
267static inline long
268__strncpy_from_user(char *dst, const char __user *src, long count)
269{
270 char *tmp;
271 strncpy(dst, (const char __force *)src, count);
272 for (tmp = dst; *tmp && count > 0; tmp++, count--)
273 ;
274 return (tmp - dst);
275}
276#endif
277
278static inline long
279strncpy_from_user(char *dst, const char __user *src, long count)
280{
281 if (!access_ok(VERIFY_READ, src, 1))
282 return -EFAULT;
283 return __strncpy_from_user(dst, src, count);
284}
285
286/*
287 * Return the size of a string (including the ending 0)
288 *
289 * Return 0 on exception, a value greater than N if too long
290 */
291#ifndef strnlen_user
292static inline long strnlen_user(const char __user *src, long n)
293{
294 if (!access_ok(VERIFY_READ, src, 1))
295 return 0;
296 return strlen((void * __force)src) + 1;
297}
298#endif
299
300static inline long strlen_user(const char __user *src)
301{
302 return strnlen_user(src, 32767);
303}
304
305/*
306 * Zero Userspace
307 */
308#ifndef __clear_user
309static inline __must_check unsigned long
310__clear_user(void __user *to, unsigned long n)
311{
312 memset((void __force *)to, 0, n);
313 return 0;
314}
315#endif
316
317static inline __must_check unsigned long
318clear_user(void __user *to, unsigned long n)
319{
320 might_sleep();
321 if (!access_ok(VERIFY_WRITE, to, n))
322 return n;
323
324 return __clear_user(to, n);
325}
326
327#endif /* __ASM_GENERIC_UACCESS_H */
diff --git a/include/asm-generic/ucontext.h b/include/asm-generic/ucontext.h
new file mode 100644
index 000000000000..ad77343e8a9a
--- /dev/null
+++ b/include/asm-generic/ucontext.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_GENERIC_UCONTEXT_H
2#define __ASM_GENERIC_UCONTEXT_H
3
4struct ucontext {
5 unsigned long uc_flags;
6 struct ucontext *uc_link;
7 stack_t uc_stack;
8 struct sigcontext uc_mcontext;
9 sigset_t uc_sigmask; /* mask last for extensibility */
10};
11
12#endif /* __ASM_GENERIC_UCONTEXT_H */
diff --git a/include/asm-generic/unaligned.h b/include/asm-generic/unaligned.h
new file mode 100644
index 000000000000..03cf5936bad6
--- /dev/null
+++ b/include/asm-generic/unaligned.h
@@ -0,0 +1,30 @@
1#ifndef __ASM_GENERIC_UNALIGNED_H
2#define __ASM_GENERIC_UNALIGNED_H
3
4/*
5 * This is the most generic implementation of unaligned accesses
6 * and should work almost anywhere.
7 *
8 * If an architecture can handle unaligned accesses in hardware,
9 * it may want to use the linux/unaligned/access_ok.h implementation
10 * instead.
11 */
12#include <asm/byteorder.h>
13
14#if defined(__LITTLE_ENDIAN)
15# include <linux/unaligned/le_struct.h>
16# include <linux/unaligned/be_byteshift.h>
17# include <linux/unaligned/generic.h>
18# define get_unaligned __get_unaligned_le
19# define put_unaligned __put_unaligned_le
20#elif defined(__BIG_ENDIAN)
21# include <linux/unaligned/be_struct.h>
22# include <linux/unaligned/le_byteshift.h>
23# include <linux/unaligned/generic.h>
24# define get_unaligned __get_unaligned_be
25# define put_unaligned __put_unaligned_be
26#else
27# error need to define endianess
28#endif
29
30#endif /* __ASM_GENERIC_UNALIGNED_H */
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
new file mode 100644
index 000000000000..1125e5a1ee5d
--- /dev/null
+++ b/include/asm-generic/unistd.h
@@ -0,0 +1,859 @@
1#if !defined(_ASM_GENERIC_UNISTD_H) || defined(__SYSCALL)
2#define _ASM_GENERIC_UNISTD_H
3
4#include <asm/bitsperlong.h>
5
6/*
7 * This file contains the system call numbers, based on the
8 * layout of the x86-64 architecture, which embeds the
9 * pointer to the syscall in the table.
10 *
11 * As a basic principle, no duplication of functionality
12 * should be added, e.g. we don't use lseek when llseek
13 * is present. New architectures should use this file
14 * and implement the less feature-full calls in user space.
15 */
16
17#ifndef __SYSCALL
18#define __SYSCALL(x, y)
19#endif
20
21#if __BITS_PER_LONG == 32
22#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32)
23#else
24#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64)
25#endif
26
27#define __NR_io_setup 0
28__SYSCALL(__NR_io_setup, sys_io_setup)
29#define __NR_io_destroy 1
30__SYSCALL(__NR_io_destroy, sys_io_destroy)
31#define __NR_io_submit 2
32__SYSCALL(__NR_io_submit, sys_io_submit)
33#define __NR_io_cancel 3
34__SYSCALL(__NR_io_cancel, sys_io_cancel)
35#define __NR_io_getevents 4
36__SYSCALL(__NR_io_getevents, sys_io_getevents)
37
38/* fs/xattr.c */
39#define __NR_setxattr 5
40__SYSCALL(__NR_setxattr, sys_setxattr)
41#define __NR_lsetxattr 6
42__SYSCALL(__NR_lsetxattr, sys_lsetxattr)
43#define __NR_fsetxattr 7
44__SYSCALL(__NR_fsetxattr, sys_fsetxattr)
45#define __NR_getxattr 8
46__SYSCALL(__NR_getxattr, sys_getxattr)
47#define __NR_lgetxattr 9
48__SYSCALL(__NR_lgetxattr, sys_lgetxattr)
49#define __NR_fgetxattr 10
50__SYSCALL(__NR_fgetxattr, sys_fgetxattr)
51#define __NR_listxattr 11
52__SYSCALL(__NR_listxattr, sys_listxattr)
53#define __NR_llistxattr 12
54__SYSCALL(__NR_llistxattr, sys_llistxattr)
55#define __NR_flistxattr 13
56__SYSCALL(__NR_flistxattr, sys_flistxattr)
57#define __NR_removexattr 14
58__SYSCALL(__NR_removexattr, sys_removexattr)
59#define __NR_lremovexattr 15
60__SYSCALL(__NR_lremovexattr, sys_lremovexattr)
61#define __NR_fremovexattr 16
62__SYSCALL(__NR_fremovexattr, sys_fremovexattr)
63
64/* fs/dcache.c */
65#define __NR_getcwd 17
66__SYSCALL(__NR_getcwd, sys_getcwd)
67
68/* fs/cookies.c */
69#define __NR_lookup_dcookie 18
70__SYSCALL(__NR_lookup_dcookie, sys_lookup_dcookie)
71
72/* fs/eventfd.c */
73#define __NR_eventfd2 19
74__SYSCALL(__NR_eventfd2, sys_eventfd2)
75
76/* fs/eventpoll.c */
77#define __NR_epoll_create1 20
78__SYSCALL(__NR_epoll_create1, sys_epoll_create1)
79#define __NR_epoll_ctl 21
80__SYSCALL(__NR_epoll_ctl, sys_epoll_ctl)
81#define __NR_epoll_pwait 22
82__SYSCALL(__NR_epoll_pwait, sys_epoll_pwait)
83
84/* fs/fcntl.c */
85#define __NR_dup 23
86__SYSCALL(__NR_dup, sys_dup)
87#define __NR_dup3 24
88__SYSCALL(__NR_dup3, sys_dup3)
89#define __NR3264_fcntl 25
90__SC_3264(__NR3264_fcntl, sys_fcntl64, sys_fcntl)
91
92/* fs/inotify_user.c */
93#define __NR_inotify_init1 26
94__SYSCALL(__NR_inotify_init1, sys_inotify_init1)
95#define __NR_inotify_add_watch 27
96__SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch)
97#define __NR_inotify_rm_watch 28
98__SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch)
99
100/* fs/ioctl.c */
101#define __NR_ioctl 29
102__SYSCALL(__NR_ioctl, sys_ioctl)
103
104/* fs/ioprio.c */
105#define __NR_ioprio_set 30
106__SYSCALL(__NR_ioprio_set, sys_ioprio_set)
107#define __NR_ioprio_get 31
108__SYSCALL(__NR_ioprio_get, sys_ioprio_get)
109
110/* fs/locks.c */
111#define __NR_flock 32
112__SYSCALL(__NR_flock, sys_flock)
113
114/* fs/namei.c */
115#define __NR_mknodat 33
116__SYSCALL(__NR_mknodat, sys_mknodat)
117#define __NR_mkdirat 34
118__SYSCALL(__NR_mkdirat, sys_mkdirat)
119#define __NR_unlinkat 35
120__SYSCALL(__NR_unlinkat, sys_unlinkat)
121#define __NR_symlinkat 36
122__SYSCALL(__NR_symlinkat, sys_symlinkat)
123#define __NR_linkat 37
124__SYSCALL(__NR_linkat, sys_linkat)
125#define __NR_renameat 38
126__SYSCALL(__NR_renameat, sys_renameat)
127
128/* fs/namespace.c */
129#define __NR_umount2 39
130__SYSCALL(__NR_umount2, sys_umount)
131#define __NR_mount 40
132__SYSCALL(__NR_mount, sys_mount)
133#define __NR_pivot_root 41
134__SYSCALL(__NR_pivot_root, sys_pivot_root)
135
136/* fs/nfsctl.c */
137#define __NR_nfsservctl 42
138__SYSCALL(__NR_nfsservctl, sys_nfsservctl)
139
140/* fs/open.c */
141#define __NR3264_statfs 43
142__SC_3264(__NR3264_statfs, sys_statfs64, sys_statfs)
143#define __NR3264_fstatfs 44
144__SC_3264(__NR3264_fstatfs, sys_fstatfs64, sys_fstatfs)
145#define __NR3264_truncate 45
146__SC_3264(__NR3264_truncate, sys_truncate64, sys_truncate)
147#define __NR3264_ftruncate 46
148__SC_3264(__NR3264_ftruncate, sys_ftruncate64, sys_ftruncate)
149
150#define __NR_fallocate 47
151__SYSCALL(__NR_fallocate, sys_fallocate)
152#define __NR_faccessat 48
153__SYSCALL(__NR_faccessat, sys_faccessat)
154#define __NR_chdir 49
155__SYSCALL(__NR_chdir, sys_chdir)
156#define __NR_fchdir 50
157__SYSCALL(__NR_fchdir, sys_fchdir)
158#define __NR_chroot 51
159__SYSCALL(__NR_chroot, sys_chroot)
160#define __NR_fchmod 52
161__SYSCALL(__NR_fchmod, sys_fchmod)
162#define __NR_fchmodat 53
163__SYSCALL(__NR_fchmodat, sys_fchmodat)
164#define __NR_fchownat 54
165__SYSCALL(__NR_fchownat, sys_fchownat)
166#define __NR_fchown 55
167__SYSCALL(__NR_fchown, sys_fchown)
168#define __NR_openat 56
169__SYSCALL(__NR_openat, sys_openat)
170#define __NR_close 57
171__SYSCALL(__NR_close, sys_close)
172#define __NR_vhangup 58
173__SYSCALL(__NR_vhangup, sys_vhangup)
174
175/* fs/pipe.c */
176#define __NR_pipe2 59
177__SYSCALL(__NR_pipe2, sys_pipe2)
178
179/* fs/quota.c */
180#define __NR_quotactl 60
181__SYSCALL(__NR_quotactl, sys_quotactl)
182
183/* fs/readdir.c */
184#define __NR_getdents64 61
185__SYSCALL(__NR_getdents64, sys_getdents64)
186
187/* fs/read_write.c */
188#define __NR3264_lseek 62
189__SC_3264(__NR3264_lseek, sys_llseek, sys_lseek)
190#define __NR_read 63
191__SYSCALL(__NR_read, sys_read)
192#define __NR_write 64
193__SYSCALL(__NR_write, sys_write)
194#define __NR_readv 65
195__SYSCALL(__NR_readv, sys_readv)
196#define __NR_writev 66
197__SYSCALL(__NR_writev, sys_writev)
198#define __NR_pread64 67
199__SYSCALL(__NR_pread64, sys_pread64)
200#define __NR_pwrite64 68
201__SYSCALL(__NR_pwrite64, sys_pwrite64)
202#define __NR_preadv 69
203__SYSCALL(__NR_preadv, sys_preadv)
204#define __NR_pwritev 70
205__SYSCALL(__NR_pwritev, sys_pwritev)
206
207/* fs/sendfile.c */
208#define __NR3264_sendfile 71
209__SC_3264(__NR3264_sendfile, sys_sendfile64, sys_sendfile)
210
211/* fs/select.c */
212#define __NR_pselect6 72
213__SYSCALL(__NR_pselect6, sys_pselect6)
214#define __NR_ppoll 73
215__SYSCALL(__NR_ppoll, sys_ppoll)
216
217/* fs/signalfd.c */
218#define __NR_signalfd4 74
219__SYSCALL(__NR_signalfd4, sys_signalfd4)
220
221/* fs/splice.c */
222#define __NR_vmsplice 75
223__SYSCALL(__NR_vmsplice, sys_vmsplice)
224#define __NR_splice 76
225__SYSCALL(__NR_splice, sys_splice)
226#define __NR_tee 77
227__SYSCALL(__NR_tee, sys_tee)
228
229/* fs/stat.c */
230#define __NR_readlinkat 78
231__SYSCALL(__NR_readlinkat, sys_readlinkat)
232#define __NR3264_fstatat 79
233__SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat)
234#define __NR3264_fstat 80
235__SC_3264(__NR3264_fstat, sys_fstat64, sys_newfstat)
236
237/* fs/sync.c */
238#define __NR_sync 81
239__SYSCALL(__NR_sync, sys_sync)
240#define __NR_fsync 82
241__SYSCALL(__NR_fsync, sys_fsync)
242#define __NR_fdatasync 83
243__SYSCALL(__NR_fdatasync, sys_fdatasync)
244#define __NR_sync_file_range 84
245__SYSCALL(__NR_sync_file_range, sys_sync_file_range) /* .long sys_sync_file_range2, */
246
247/* fs/timerfd.c */
248#define __NR_timerfd_create 85
249__SYSCALL(__NR_timerfd_create, sys_timerfd_create)
250#define __NR_timerfd_settime 86
251__SYSCALL(__NR_timerfd_settime, sys_timerfd_settime)
252#define __NR_timerfd_gettime 87
253__SYSCALL(__NR_timerfd_gettime, sys_timerfd_gettime)
254
255/* fs/utimes.c */
256#define __NR_utimensat 88
257__SYSCALL(__NR_utimensat, sys_utimensat)
258
259/* kernel/acct.c */
260#define __NR_acct 89
261__SYSCALL(__NR_acct, sys_acct)
262
263/* kernel/capability.c */
264#define __NR_capget 90
265__SYSCALL(__NR_capget, sys_capget)
266#define __NR_capset 91
267__SYSCALL(__NR_capset, sys_capset)
268
269/* kernel/exec_domain.c */
270#define __NR_personality 92
271__SYSCALL(__NR_personality, sys_personality)
272
273/* kernel/exit.c */
274#define __NR_exit 93
275__SYSCALL(__NR_exit, sys_exit)
276#define __NR_exit_group 94
277__SYSCALL(__NR_exit_group, sys_exit_group)
278#define __NR_waitid 95
279__SYSCALL(__NR_waitid, sys_waitid)
280
281/* kernel/fork.c */
282#define __NR_set_tid_address 96
283__SYSCALL(__NR_set_tid_address, sys_set_tid_address)
284#define __NR_unshare 97
285__SYSCALL(__NR_unshare, sys_unshare)
286
287/* kernel/futex.c */
288#define __NR_futex 98
289__SYSCALL(__NR_futex, sys_futex)
290#define __NR_set_robust_list 99
291__SYSCALL(__NR_set_robust_list, sys_set_robust_list)
292#define __NR_get_robust_list 100
293__SYSCALL(__NR_get_robust_list, sys_get_robust_list)
294
295/* kernel/hrtimer.c */
296#define __NR_nanosleep 101
297__SYSCALL(__NR_nanosleep, sys_nanosleep)
298
299/* kernel/itimer.c */
300#define __NR_getitimer 102
301__SYSCALL(__NR_getitimer, sys_getitimer)
302#define __NR_setitimer 103
303__SYSCALL(__NR_setitimer, sys_setitimer)
304
305/* kernel/kexec.c */
306#define __NR_kexec_load 104
307__SYSCALL(__NR_kexec_load, sys_kexec_load)
308
309/* kernel/module.c */
310#define __NR_init_module 105
311__SYSCALL(__NR_init_module, sys_init_module)
312#define __NR_delete_module 106
313__SYSCALL(__NR_delete_module, sys_delete_module)
314
315/* kernel/posix-timers.c */
316#define __NR_timer_create 107
317__SYSCALL(__NR_timer_create, sys_timer_create)
318#define __NR_timer_gettime 108
319__SYSCALL(__NR_timer_gettime, sys_timer_gettime)
320#define __NR_timer_getoverrun 109
321__SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun)
322#define __NR_timer_settime 110
323__SYSCALL(__NR_timer_settime, sys_timer_settime)
324#define __NR_timer_delete 111
325__SYSCALL(__NR_timer_delete, sys_timer_delete)
326#define __NR_clock_settime 112
327__SYSCALL(__NR_clock_settime, sys_clock_settime)
328#define __NR_clock_gettime 113
329__SYSCALL(__NR_clock_gettime, sys_clock_gettime)
330#define __NR_clock_getres 114
331__SYSCALL(__NR_clock_getres, sys_clock_getres)
332#define __NR_clock_nanosleep 115
333__SYSCALL(__NR_clock_nanosleep, sys_clock_nanosleep)
334
335/* kernel/printk.c */
336#define __NR_syslog 116
337__SYSCALL(__NR_syslog, sys_syslog)
338
339/* kernel/ptrace.c */
340#define __NR_ptrace 117
341__SYSCALL(__NR_ptrace, sys_ptrace)
342
343/* kernel/sched.c */
344#define __NR_sched_setparam 118
345__SYSCALL(__NR_sched_setparam, sys_sched_setparam)
346#define __NR_sched_setscheduler 119
347__SYSCALL(__NR_sched_setscheduler, sys_sched_setscheduler)
348#define __NR_sched_getscheduler 120
349__SYSCALL(__NR_sched_getscheduler, sys_sched_getscheduler)
350#define __NR_sched_getparam 121
351__SYSCALL(__NR_sched_getparam, sys_sched_getparam)
352#define __NR_sched_setaffinity 122
353__SYSCALL(__NR_sched_setaffinity, sys_sched_setaffinity)
354#define __NR_sched_getaffinity 123
355__SYSCALL(__NR_sched_getaffinity, sys_sched_getaffinity)
356#define __NR_sched_yield 124
357__SYSCALL(__NR_sched_yield, sys_sched_yield)
358#define __NR_sched_get_priority_max 125
359__SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max)
360#define __NR_sched_get_priority_min 126
361__SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min)
362#define __NR_sched_rr_get_interval 127
363__SYSCALL(__NR_sched_rr_get_interval, sys_sched_rr_get_interval)
364
365/* kernel/signal.c */
366#define __NR_restart_syscall 128
367__SYSCALL(__NR_restart_syscall, sys_restart_syscall)
368#define __NR_kill 129
369__SYSCALL(__NR_kill, sys_kill)
370#define __NR_tkill 130
371__SYSCALL(__NR_tkill, sys_tkill)
372#define __NR_tgkill 131
373__SYSCALL(__NR_tgkill, sys_tgkill)
374#define __NR_sigaltstack 132
375__SYSCALL(__NR_sigaltstack, sys_sigaltstack)
376#define __NR_rt_sigsuspend 133
377__SYSCALL(__NR_rt_sigsuspend, sys_rt_sigsuspend) /* __ARCH_WANT_SYS_RT_SIGSUSPEND */
378#define __NR_rt_sigaction 134
379__SYSCALL(__NR_rt_sigaction, sys_rt_sigaction) /* __ARCH_WANT_SYS_RT_SIGACTION */
380#define __NR_rt_sigprocmask 135
381__SYSCALL(__NR_rt_sigprocmask, sys_rt_sigprocmask)
382#define __NR_rt_sigpending 136
383__SYSCALL(__NR_rt_sigpending, sys_rt_sigpending)
384#define __NR_rt_sigtimedwait 137
385__SYSCALL(__NR_rt_sigtimedwait, sys_rt_sigtimedwait)
386#define __NR_rt_sigqueueinfo 138
387__SYSCALL(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo)
388#define __NR_rt_sigreturn 139
389__SYSCALL(__NR_rt_sigreturn, sys_rt_sigreturn) /* sys_rt_sigreturn_wrapper, */
390
391/* kernel/sys.c */
392#define __NR_setpriority 140
393__SYSCALL(__NR_setpriority, sys_setpriority)
394#define __NR_getpriority 141
395__SYSCALL(__NR_getpriority, sys_getpriority)
396#define __NR_reboot 142
397__SYSCALL(__NR_reboot, sys_reboot)
398#define __NR_setregid 143
399__SYSCALL(__NR_setregid, sys_setregid)
400#define __NR_setgid 144
401__SYSCALL(__NR_setgid, sys_setgid)
402#define __NR_setreuid 145
403__SYSCALL(__NR_setreuid, sys_setreuid)
404#define __NR_setuid 146
405__SYSCALL(__NR_setuid, sys_setuid)
406#define __NR_setresuid 147
407__SYSCALL(__NR_setresuid, sys_setresuid)
408#define __NR_getresuid 148
409__SYSCALL(__NR_getresuid, sys_getresuid)
410#define __NR_setresgid 149
411__SYSCALL(__NR_setresgid, sys_setresgid)
412#define __NR_getresgid 150
413__SYSCALL(__NR_getresgid, sys_getresgid)
414#define __NR_setfsuid 151
415__SYSCALL(__NR_setfsuid, sys_setfsuid)
416#define __NR_setfsgid 152
417__SYSCALL(__NR_setfsgid, sys_setfsgid)
418#define __NR_times 153
419__SYSCALL(__NR_times, sys_times)
420#define __NR_setpgid 154
421__SYSCALL(__NR_setpgid, sys_setpgid)
422#define __NR_getpgid 155
423__SYSCALL(__NR_getpgid, sys_getpgid)
424#define __NR_getsid 156
425__SYSCALL(__NR_getsid, sys_getsid)
426#define __NR_setsid 157
427__SYSCALL(__NR_setsid, sys_setsid)
428#define __NR_getgroups 158
429__SYSCALL(__NR_getgroups, sys_getgroups)
430#define __NR_setgroups 159
431__SYSCALL(__NR_setgroups, sys_setgroups)
432#define __NR_uname 160
433__SYSCALL(__NR_uname, sys_newuname)
434#define __NR_sethostname 161
435__SYSCALL(__NR_sethostname, sys_sethostname)
436#define __NR_setdomainname 162
437__SYSCALL(__NR_setdomainname, sys_setdomainname)
438#define __NR_getrlimit 163
439__SYSCALL(__NR_getrlimit, sys_getrlimit)
440#define __NR_setrlimit 164
441__SYSCALL(__NR_setrlimit, sys_setrlimit)
442#define __NR_getrusage 165
443__SYSCALL(__NR_getrusage, sys_getrusage)
444#define __NR_umask 166
445__SYSCALL(__NR_umask, sys_umask)
446#define __NR_prctl 167
447__SYSCALL(__NR_prctl, sys_prctl)
448#define __NR_getcpu 168
449__SYSCALL(__NR_getcpu, sys_getcpu)
450
451/* kernel/time.c */
452#define __NR_gettimeofday 169
453__SYSCALL(__NR_gettimeofday, sys_gettimeofday)
454#define __NR_settimeofday 170
455__SYSCALL(__NR_settimeofday, sys_settimeofday)
456#define __NR_adjtimex 171
457__SYSCALL(__NR_adjtimex, sys_adjtimex)
458
459/* kernel/timer.c */
460#define __NR_getpid 172
461__SYSCALL(__NR_getpid, sys_getpid)
462#define __NR_getppid 173
463__SYSCALL(__NR_getppid, sys_getppid)
464#define __NR_getuid 174
465__SYSCALL(__NR_getuid, sys_getuid)
466#define __NR_geteuid 175
467__SYSCALL(__NR_geteuid, sys_geteuid)
468#define __NR_getgid 176
469__SYSCALL(__NR_getgid, sys_getgid)
470#define __NR_getegid 177
471__SYSCALL(__NR_getegid, sys_getegid)
472#define __NR_gettid 178
473__SYSCALL(__NR_gettid, sys_gettid)
474#define __NR_sysinfo 179
475__SYSCALL(__NR_sysinfo, sys_sysinfo)
476
477/* ipc/mqueue.c */
478#define __NR_mq_open 180
479__SYSCALL(__NR_mq_open, sys_mq_open)
480#define __NR_mq_unlink 181
481__SYSCALL(__NR_mq_unlink, sys_mq_unlink)
482#define __NR_mq_timedsend 182
483__SYSCALL(__NR_mq_timedsend, sys_mq_timedsend)
484#define __NR_mq_timedreceive 183
485__SYSCALL(__NR_mq_timedreceive, sys_mq_timedreceive)
486#define __NR_mq_notify 184
487__SYSCALL(__NR_mq_notify, sys_mq_notify)
488#define __NR_mq_getsetattr 185
489__SYSCALL(__NR_mq_getsetattr, sys_mq_getsetattr)
490
491/* ipc/msg.c */
492#define __NR_msgget 186
493__SYSCALL(__NR_msgget, sys_msgget)
494#define __NR_msgctl 187
495__SYSCALL(__NR_msgctl, sys_msgctl)
496#define __NR_msgrcv 188
497__SYSCALL(__NR_msgrcv, sys_msgrcv)
498#define __NR_msgsnd 189
499__SYSCALL(__NR_msgsnd, sys_msgsnd)
500
501/* ipc/sem.c */
502#define __NR_semget 190
503__SYSCALL(__NR_semget, sys_semget)
504#define __NR_semctl 191
505__SYSCALL(__NR_semctl, sys_semctl)
506#define __NR_semtimedop 192
507__SYSCALL(__NR_semtimedop, sys_semtimedop)
508#define __NR_semop 193
509__SYSCALL(__NR_semop, sys_semop)
510
511/* ipc/shm.c */
512#define __NR_shmget 194
513__SYSCALL(__NR_shmget, sys_shmget)
514#define __NR_shmctl 195
515__SYSCALL(__NR_shmctl, sys_shmctl)
516#define __NR_shmat 196
517__SYSCALL(__NR_shmat, sys_shmat)
518#define __NR_shmdt 197
519__SYSCALL(__NR_shmdt, sys_shmdt)
520
521/* net/socket.c */
522#define __NR_socket 198
523__SYSCALL(__NR_socket, sys_socket)
524#define __NR_socketpair 199
525__SYSCALL(__NR_socketpair, sys_socketpair)
526#define __NR_bind 200
527__SYSCALL(__NR_bind, sys_bind)
528#define __NR_listen 201
529__SYSCALL(__NR_listen, sys_listen)
530#define __NR_accept 202
531__SYSCALL(__NR_accept, sys_accept)
532#define __NR_connect 203
533__SYSCALL(__NR_connect, sys_connect)
534#define __NR_getsockname 204
535__SYSCALL(__NR_getsockname, sys_getsockname)
536#define __NR_getpeername 205
537__SYSCALL(__NR_getpeername, sys_getpeername)
538#define __NR_sendto 206
539__SYSCALL(__NR_sendto, sys_sendto)
540#define __NR_recvfrom 207
541__SYSCALL(__NR_recvfrom, sys_recvfrom)
542#define __NR_setsockopt 208
543__SYSCALL(__NR_setsockopt, sys_setsockopt)
544#define __NR_getsockopt 209
545__SYSCALL(__NR_getsockopt, sys_getsockopt)
546#define __NR_shutdown 210
547__SYSCALL(__NR_shutdown, sys_shutdown)
548#define __NR_sendmsg 211
549__SYSCALL(__NR_sendmsg, sys_sendmsg)
550#define __NR_recvmsg 212
551__SYSCALL(__NR_recvmsg, sys_recvmsg)
552
553/* mm/filemap.c */
554#define __NR_readahead 213
555__SYSCALL(__NR_readahead, sys_readahead)
556
557/* mm/nommu.c, also with MMU */
558#define __NR_brk 214
559__SYSCALL(__NR_brk, sys_brk)
560#define __NR_munmap 215
561__SYSCALL(__NR_munmap, sys_munmap)
562#define __NR_mremap 216
563__SYSCALL(__NR_mremap, sys_mremap)
564
565/* security/keys/keyctl.c */
566#define __NR_add_key 217
567__SYSCALL(__NR_add_key, sys_add_key)
568#define __NR_request_key 218
569__SYSCALL(__NR_request_key, sys_request_key)
570#define __NR_keyctl 219
571__SYSCALL(__NR_keyctl, sys_keyctl)
572
573/* arch/example/kernel/sys_example.c */
574#define __NR_clone 220
575__SYSCALL(__NR_clone, sys_clone) /* .long sys_clone_wrapper */
576#define __NR_execve 221
577__SYSCALL(__NR_execve, sys_execve) /* .long sys_execve_wrapper */
578
579#define __NR3264_mmap 222
580__SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap)
581/* mm/fadvise.c */
582#define __NR3264_fadvise64 223
583__SC_3264(__NR3264_fadvise64, sys_fadvise64_64, sys_fadvise64)
584
585/* mm/, CONFIG_MMU only */
586#ifndef __ARCH_NOMMU
587#define __NR_swapon 224
588__SYSCALL(__NR_swapon, sys_swapon)
589#define __NR_swapoff 225
590__SYSCALL(__NR_swapoff, sys_swapoff)
591#define __NR_mprotect 226
592__SYSCALL(__NR_mprotect, sys_mprotect)
593#define __NR_msync 227
594__SYSCALL(__NR_msync, sys_msync)
595#define __NR_mlock 228
596__SYSCALL(__NR_mlock, sys_mlock)
597#define __NR_munlock 229
598__SYSCALL(__NR_munlock, sys_munlock)
599#define __NR_mlockall 230
600__SYSCALL(__NR_mlockall, sys_mlockall)
601#define __NR_munlockall 231
602__SYSCALL(__NR_munlockall, sys_munlockall)
603#define __NR_mincore 232
604__SYSCALL(__NR_mincore, sys_mincore)
605#define __NR_madvise 233
606__SYSCALL(__NR_madvise, sys_madvise)
607#define __NR_remap_file_pages 234
608__SYSCALL(__NR_remap_file_pages, sys_remap_file_pages)
609#define __NR_mbind 235
610__SYSCALL(__NR_mbind, sys_mbind)
611#define __NR_get_mempolicy 236
612__SYSCALL(__NR_get_mempolicy, sys_get_mempolicy)
613#define __NR_set_mempolicy 237
614__SYSCALL(__NR_set_mempolicy, sys_set_mempolicy)
615#define __NR_migrate_pages 238
616__SYSCALL(__NR_migrate_pages, sys_migrate_pages)
617#define __NR_move_pages 239
618__SYSCALL(__NR_move_pages, sys_move_pages)
619#endif
620
621#define __NR_rt_tgsigqueueinfo 240
622__SYSCALL(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo)
623#define __NR_perf_counter_open 241
624__SYSCALL(__NR_perf_counter_open, sys_perf_counter_open)
625
626#undef __NR_syscalls
627#define __NR_syscalls 242
628
629/*
630 * All syscalls below here should go away really,
631 * these are provided for both review and as a porting
632 * help for the C library version.
633*
634 * Last chance: are any of these important enought to
635 * enable by default?
636 */
637#ifdef __ARCH_WANT_SYSCALL_NO_AT
638#define __NR_open 1024
639__SYSCALL(__NR_open, sys_open)
640#define __NR_link 1025
641__SYSCALL(__NR_link, sys_link)
642#define __NR_unlink 1026
643__SYSCALL(__NR_unlink, sys_unlink)
644#define __NR_mknod 1027
645__SYSCALL(__NR_mknod, sys_mknod)
646#define __NR_chmod 1028
647__SYSCALL(__NR_chmod, sys_chmod)
648#define __NR_chown 1029
649__SYSCALL(__NR_chown, sys_chown)
650#define __NR_mkdir 1030
651__SYSCALL(__NR_mkdir, sys_mkdir)
652#define __NR_rmdir 1031
653__SYSCALL(__NR_rmdir, sys_rmdir)
654#define __NR_lchown 1032
655__SYSCALL(__NR_lchown, sys_lchown)
656#define __NR_access 1033
657__SYSCALL(__NR_access, sys_access)
658#define __NR_rename 1034
659__SYSCALL(__NR_rename, sys_rename)
660#define __NR_readlink 1035
661__SYSCALL(__NR_readlink, sys_readlink)
662#define __NR_symlink 1036
663__SYSCALL(__NR_symlink, sys_symlink)
664#define __NR_utimes 1037
665__SYSCALL(__NR_utimes, sys_utimes)
666#define __NR3264_stat 1038
667__SC_3264(__NR3264_stat, sys_stat64, sys_newstat)
668#define __NR3264_lstat 1039
669__SC_3264(__NR3264_lstat, sys_lstat64, sys_newlstat)
670
671#undef __NR_syscalls
672#define __NR_syscalls (__NR3264_lstat+1)
673#endif /* __ARCH_WANT_SYSCALL_NO_AT */
674
675#ifdef __ARCH_WANT_SYSCALL_NO_FLAGS
676#define __NR_pipe 1040
677__SYSCALL(__NR_pipe, sys_pipe)
678#define __NR_dup2 1041
679__SYSCALL(__NR_dup2, sys_dup2)
680#define __NR_epoll_create 1042
681__SYSCALL(__NR_epoll_create, sys_epoll_create)
682#define __NR_inotify_init 1043
683__SYSCALL(__NR_inotify_init, sys_inotify_init)
684#define __NR_eventfd 1044
685__SYSCALL(__NR_eventfd, sys_eventfd)
686#define __NR_signalfd 1045
687__SYSCALL(__NR_signalfd, sys_signalfd)
688
689#undef __NR_syscalls
690#define __NR_syscalls (__NR_signalfd+1)
691#endif /* __ARCH_WANT_SYSCALL_NO_FLAGS */
692
693#if __BITS_PER_LONG == 32 && defined(__ARCH_WANT_SYSCALL_OFF_T)
694#define __NR_sendfile 1046
695__SYSCALL(__NR_sendfile, sys_sendfile)
696#define __NR_ftruncate 1047
697__SYSCALL(__NR_ftruncate, sys_ftruncate)
698#define __NR_truncate 1048
699__SYSCALL(__NR_truncate, sys_truncate)
700#define __NR_stat 1049
701__SYSCALL(__NR_stat, sys_newstat)
702#define __NR_lstat 1050
703__SYSCALL(__NR_lstat, sys_newlstat)
704#define __NR_fstat 1051
705__SYSCALL(__NR_fstat, sys_newfstat)
706#define __NR_fcntl 1052
707__SYSCALL(__NR_fcntl, sys_fcntl)
708#define __NR_fadvise64 1053
709#define __ARCH_WANT_SYS_FADVISE64
710__SYSCALL(__NR_fadvise64, sys_fadvise64)
711#define __NR_newfstatat 1054
712#define __ARCH_WANT_SYS_NEWFSTATAT
713__SYSCALL(__NR_newfstatat, sys_newfstatat)
714#define __NR_fstatfs 1055
715__SYSCALL(__NR_fstatfs, sys_fstatfs)
716#define __NR_statfs 1056
717__SYSCALL(__NR_statfs, sys_statfs)
718#define __NR_lseek 1057
719__SYSCALL(__NR_lseek, sys_lseek)
720#define __NR_mmap 1058
721__SYSCALL(__NR_mmap, sys_mmap)
722
723#undef __NR_syscalls
724#define __NR_syscalls (__NR_mmap+1)
725#endif /* 32 bit off_t syscalls */
726
727#ifdef __ARCH_WANT_SYSCALL_DEPRECATED
728#define __NR_alarm 1059
729#define __ARCH_WANT_SYS_ALARM
730__SYSCALL(__NR_alarm, sys_alarm)
731#define __NR_getpgrp 1060
732#define __ARCH_WANT_SYS_GETPGRP
733__SYSCALL(__NR_getpgrp, sys_getpgrp)
734#define __NR_pause 1061
735#define __ARCH_WANT_SYS_PAUSE
736__SYSCALL(__NR_pause, sys_pause)
737#define __NR_time 1062
738#define __ARCH_WANT_SYS_TIME
739__SYSCALL(__NR_time, sys_time)
740#define __NR_utime 1063
741#define __ARCH_WANT_SYS_UTIME
742__SYSCALL(__NR_utime, sys_utime)
743
744#define __NR_creat 1064
745__SYSCALL(__NR_creat, sys_creat)
746#define __NR_getdents 1065
747#define __ARCH_WANT_SYS_GETDENTS
748__SYSCALL(__NR_getdents, sys_getdents)
749#define __NR_futimesat 1066
750__SYSCALL(__NR_futimesat, sys_futimesat)
751#define __NR_select 1067
752#define __ARCH_WANT_SYS_SELECT
753__SYSCALL(__NR_select, sys_select)
754#define __NR_poll 1068
755__SYSCALL(__NR_poll, sys_poll)
756#define __NR_epoll_wait 1069
757__SYSCALL(__NR_epoll_wait, sys_epoll_wait)
758#define __NR_ustat 1070
759__SYSCALL(__NR_ustat, sys_ustat)
760#define __NR_vfork 1071
761__SYSCALL(__NR_vfork, sys_vfork)
762#define __NR_wait4 1072
763__SYSCALL(__NR_wait4, sys_wait4)
764#define __NR_recv 1073
765__SYSCALL(__NR_recv, sys_recv)
766#define __NR_send 1074
767__SYSCALL(__NR_send, sys_send)
768#define __NR_bdflush 1075
769__SYSCALL(__NR_bdflush, sys_bdflush)
770#define __NR_umount 1076
771__SYSCALL(__NR_umount, sys_oldumount)
772#define __ARCH_WANT_SYS_OLDUMOUNT
773#define __NR_uselib 1077
774__SYSCALL(__NR_uselib, sys_uselib)
775#define __NR__sysctl 1078
776__SYSCALL(__NR__sysctl, sys_sysctl)
777
778#define __NR_fork 1079
779#ifdef CONFIG_MMU
780__SYSCALL(__NR_fork, sys_fork)
781#else
782__SYSCALL(__NR_fork, sys_ni_syscall)
783#endif /* CONFIG_MMU */
784
785#undef __NR_syscalls
786#define __NR_syscalls (__NR_fork+1)
787
788#endif /* __ARCH_WANT_SYSCALL_DEPRECATED */
789
790/*
791 * 32 bit systems traditionally used different
792 * syscalls for off_t and loff_t arguments, while
793 * 64 bit systems only need the off_t version.
794 * For new 32 bit platforms, there is no need to
795 * implement the old 32 bit off_t syscalls, so
796 * they take different names.
797 * Here we map the numbers so that both versions
798 * use the same syscall table layout.
799 */
800#if __BITS_PER_LONG == 64
801#define __NR_fcntl __NR3264_fcntl
802#define __NR_statfs __NR3264_statfs
803#define __NR_fstatfs __NR3264_fstatfs
804#define __NR_truncate __NR3264_truncate
805#define __NR_ftruncate __NR3264_truncate
806#define __NR_lseek __NR3264_lseek
807#define __NR_sendfile __NR3264_sendfile
808#define __NR_newfstatat __NR3264_fstatat
809#define __NR_fstat __NR3264_fstat
810#define __NR_mmap __NR3264_mmap
811#define __NR_fadvise64 __NR3264_fadvise64
812#ifdef __NR3264_stat
813#define __NR_stat __NR3264_stat
814#define __NR_lstat __NR3264_lstat
815#endif
816#else
817#define __NR_fcntl64 __NR3264_fcntl
818#define __NR_statfs64 __NR3264_statfs
819#define __NR_fstatfs64 __NR3264_fstatfs
820#define __NR_truncate64 __NR3264_truncate
821#define __NR_ftruncate64 __NR3264_truncate
822#define __NR_llseek __NR3264_lseek
823#define __NR_sendfile64 __NR3264_sendfile
824#define __NR_fstatat64 __NR3264_fstatat
825#define __NR_fstat64 __NR3264_fstat
826#define __NR_mmap2 __NR3264_mmap
827#define __NR_fadvise64_64 __NR3264_fadvise64
828#ifdef __NR3264_stat
829#define __NR_stat64 __NR3264_stat
830#define __NR_lstat64 __NR3264_lstat
831#endif
832#endif
833
834#ifdef __KERNEL__
835
836/*
837 * These are required system calls, we should
838 * invert the logic eventually and let them
839 * be selected by default.
840 */
841#if __BITS_PER_LONG == 32
842#define __ARCH_WANT_STAT64
843#define __ARCH_WANT_SYS_LLSEEK
844#endif
845#define __ARCH_WANT_SYS_RT_SIGACTION
846#define __ARCH_WANT_SYS_RT_SIGSUSPEND
847
848/*
849 * "Conditional" syscalls
850 *
851 * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
852 * but it doesn't work on all toolchains, so we just do it by hand
853 */
854#ifndef cond_syscall
855#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
856#endif
857
858#endif /* __KERNEL__ */
859#endif /* _ASM_GENERIC_UNISTD_H */
diff --git a/include/asm-generic/user.h b/include/asm-generic/user.h
new file mode 100644
index 000000000000..8b9c3c960aeb
--- /dev/null
+++ b/include/asm-generic/user.h
@@ -0,0 +1,8 @@
1#ifndef __ASM_GENERIC_USER_H
2#define __ASM_GENERIC_USER_H
3/*
4 * This file may define a 'struct user' structure. However, it it only
5 * used for a.out file, which are not supported on new architectures.
6 */
7
8#endif /* __ASM_GENERIC_USER_H */
diff --git a/include/asm-generic/vga.h b/include/asm-generic/vga.h
new file mode 100644
index 000000000000..36c8ff52016b
--- /dev/null
+++ b/include/asm-generic/vga.h
@@ -0,0 +1,24 @@
1/*
2 * Access to VGA videoram
3 *
4 * (c) 1998 Martin Mares <mj@ucw.cz>
5 */
6#ifndef __ASM_GENERIC_VGA_H
7#define __ASM_GENERIC_VGA_H
8
9/*
10 * On most architectures that support VGA, we can just
11 * recalculate addresses and then access the videoram
12 * directly without any black magic.
13 *
14 * Everyone else needs to ioremap the address and use
15 * proper I/O accesses.
16 */
17#ifndef VGA_MAP_MEM
18#define VGA_MAP_MEM(x, s) (unsigned long)phys_to_virt(x)
19#endif
20
21#define vga_readb(x) (*(x))
22#define vga_writeb(x, y) (*(y) = (x))
23
24#endif /* _ASM_GENERIC_VGA_H */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 89853bcd27a6..92b73b6140ff 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -1,4 +1,57 @@
1#include <linux/section-names.h> 1/*
2 * Helper macros to support writing architecture specific
3 * linker scripts.
4 *
5 * A minimal linker scripts has following content:
6 * [This is a sample, architectures may have special requiriements]
7 *
8 * OUTPUT_FORMAT(...)
9 * OUTPUT_ARCH(...)
10 * ENTRY(...)
11 * SECTIONS
12 * {
13 * . = START;
14 * __init_begin = .;
15 * HEAD_TEXT_SECTION
16 * INIT_TEXT_SECTION(PAGE_SIZE)
17 * INIT_DATA_SECTION(...)
18 * PERCPU(PAGE_SIZE)
19 * __init_end = .;
20 *
21 * _stext = .;
22 * TEXT_SECTION = 0
23 * _etext = .;
24 *
25 * _sdata = .;
26 * RO_DATA_SECTION(PAGE_SIZE)
27 * RW_DATA_SECTION(...)
28 * _edata = .;
29 *
30 * EXCEPTION_TABLE(...)
31 * NOTES
32 *
33 * __bss_start = .;
34 * BSS_SECTION(0, 0)
35 * __bss_stop = .;
36 * _end = .;
37 *
38 * /DISCARD/ : {
39 * EXIT_TEXT
40 * EXIT_DATA
41 * EXIT_CALL
42 * }
43 * STABS_DEBUG
44 * DWARF_DEBUG
45 * }
46 *
47 * [__init_begin, __init_end] is the init section that may be freed after init
48 * [_stext, _etext] is the text section
49 * [_sdata, _edata] is the data section
50 *
51 * Some of the included output section have their own set of constants.
52 * Examples are: [__initramfs_start, __initramfs_end] for initramfs and
53 * [__nosave_begin, __nosave_end] for the nosave data
54 */
2 55
3#ifndef LOAD_OFFSET 56#ifndef LOAD_OFFSET
4#define LOAD_OFFSET 0 57#define LOAD_OFFSET 0
@@ -63,7 +116,7 @@
63#define BRANCH_PROFILE() 116#define BRANCH_PROFILE()
64#endif 117#endif
65 118
66#ifdef CONFIG_EVENT_TRACER 119#ifdef CONFIG_EVENT_TRACING
67#define FTRACE_EVENTS() VMLINUX_SYMBOL(__start_ftrace_events) = .; \ 120#define FTRACE_EVENTS() VMLINUX_SYMBOL(__start_ftrace_events) = .; \
68 *(_ftrace_events) \ 121 *(_ftrace_events) \
69 VMLINUX_SYMBOL(__stop_ftrace_events) = .; 122 VMLINUX_SYMBOL(__stop_ftrace_events) = .;
@@ -116,7 +169,36 @@
116 FTRACE_EVENTS() \ 169 FTRACE_EVENTS() \
117 TRACE_SYSCALLS() 170 TRACE_SYSCALLS()
118 171
119#define RO_DATA(align) \ 172/*
173 * Data section helpers
174 */
175#define NOSAVE_DATA \
176 . = ALIGN(PAGE_SIZE); \
177 VMLINUX_SYMBOL(__nosave_begin) = .; \
178 *(.data.nosave) \
179 . = ALIGN(PAGE_SIZE); \
180 VMLINUX_SYMBOL(__nosave_end) = .;
181
182#define PAGE_ALIGNED_DATA(page_align) \
183 . = ALIGN(page_align); \
184 *(.data.page_aligned)
185
186#define READ_MOSTLY_DATA(align) \
187 . = ALIGN(align); \
188 *(.data.read_mostly)
189
190#define CACHELINE_ALIGNED_DATA(align) \
191 . = ALIGN(align); \
192 *(.data.cacheline_aligned)
193
194#define INIT_TASK(align) \
195 . = ALIGN(align); \
196 *(.data.init_task)
197
198/*
199 * Read only Data
200 */
201#define RO_DATA_SECTION(align) \
120 . = ALIGN((align)); \ 202 . = ALIGN((align)); \
121 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ 203 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
122 VMLINUX_SYMBOL(__start_rodata) = .; \ 204 VMLINUX_SYMBOL(__start_rodata) = .; \
@@ -270,9 +352,10 @@
270 } \ 352 } \
271 . = ALIGN((align)); 353 . = ALIGN((align));
272 354
273/* RODATA provided for backward compatibility. 355/* RODATA & RO_DATA provided for backward compatibility.
274 * All archs are supposed to use RO_DATA() */ 356 * All archs are supposed to use RO_DATA() */
275#define RODATA RO_DATA(4096) 357#define RODATA RO_DATA_SECTION(4096)
358#define RO_DATA(align) RO_DATA_SECTION(align)
276 359
277#define SECURITY_INIT \ 360#define SECURITY_INIT \
278 .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \ 361 .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
@@ -330,16 +413,51 @@
330#endif 413#endif
331 414
332/* Section used for early init (in .S files) */ 415/* Section used for early init (in .S files) */
333#define HEAD_TEXT *(HEAD_TEXT_SECTION) 416#define HEAD_TEXT *(.head.text)
417
418#define HEAD_TEXT_SECTION \
419 .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) { \
420 HEAD_TEXT \
421 }
422
423/*
424 * Exception table
425 */
426#define EXCEPTION_TABLE(align) \
427 . = ALIGN(align); \
428 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \
429 VMLINUX_SYMBOL(__start___ex_table) = .; \
430 *(__ex_table) \
431 VMLINUX_SYMBOL(__stop___ex_table) = .; \
432 }
433
434/*
435 * Init task
436 */
437#define INIT_TASK_DATA(align) \
438 . = ALIGN(align); \
439 .data.init_task : { \
440 INIT_TASK \
441 }
442
443#ifdef CONFIG_CONSTRUCTORS
444#define KERNEL_CTORS() VMLINUX_SYMBOL(__ctors_start) = .; \
445 *(.ctors) \
446 VMLINUX_SYMBOL(__ctors_end) = .;
447#else
448#define KERNEL_CTORS()
449#endif
334 450
335/* init and exit section handling */ 451/* init and exit section handling */
336#define INIT_DATA \ 452#define INIT_DATA \
337 *(.init.data) \ 453 *(.init.data) \
338 DEV_DISCARD(init.data) \ 454 DEV_DISCARD(init.data) \
339 DEV_DISCARD(init.rodata) \
340 CPU_DISCARD(init.data) \ 455 CPU_DISCARD(init.data) \
341 CPU_DISCARD(init.rodata) \
342 MEM_DISCARD(init.data) \ 456 MEM_DISCARD(init.data) \
457 KERNEL_CTORS() \
458 *(.init.rodata) \
459 DEV_DISCARD(init.rodata) \
460 CPU_DISCARD(init.rodata) \
343 MEM_DISCARD(init.rodata) 461 MEM_DISCARD(init.rodata)
344 462
345#define INIT_TEXT \ 463#define INIT_TEXT \
@@ -363,9 +481,35 @@
363 CPU_DISCARD(exit.text) \ 481 CPU_DISCARD(exit.text) \
364 MEM_DISCARD(exit.text) 482 MEM_DISCARD(exit.text)
365 483
366 /* DWARF debug sections. 484#define EXIT_CALL \
367 Symbols in the DWARF debugging sections are relative to 485 *(.exitcall.exit)
368 the beginning of the section so we begin them at 0. */ 486
487/*
488 * bss (Block Started by Symbol) - uninitialized data
489 * zeroed during startup
490 */
491#define SBSS \
492 .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \
493 *(.sbss) \
494 *(.scommon) \
495 }
496
497#define BSS(bss_align) \
498 . = ALIGN(bss_align); \
499 .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \
500 VMLINUX_SYMBOL(__bss_start) = .; \
501 *(.bss.page_aligned) \
502 *(.dynbss) \
503 *(.bss) \
504 *(COMMON) \
505 VMLINUX_SYMBOL(__bss_stop) = .; \
506 }
507
508/*
509 * DWARF debug sections.
510 * Symbols in the DWARF debugging sections are relative to
511 * the beginning of the section so we begin them at 0.
512 */
369#define DWARF_DEBUG \ 513#define DWARF_DEBUG \
370 /* DWARF 1 */ \ 514 /* DWARF 1 */ \
371 .debug 0 : { *(.debug) } \ 515 .debug 0 : { *(.debug) } \
@@ -432,6 +576,12 @@
432 VMLINUX_SYMBOL(__stop_notes) = .; \ 576 VMLINUX_SYMBOL(__stop_notes) = .; \
433 } 577 }
434 578
579#define INIT_SETUP(initsetup_align) \
580 . = ALIGN(initsetup_align); \
581 VMLINUX_SYMBOL(__setup_start) = .; \
582 *(.init.setup) \
583 VMLINUX_SYMBOL(__setup_end) = .;
584
435#define INITCALLS \ 585#define INITCALLS \
436 *(.initcallearly.init) \ 586 *(.initcallearly.init) \
437 VMLINUX_SYMBOL(__early_initcall_end) = .; \ 587 VMLINUX_SYMBOL(__early_initcall_end) = .; \
@@ -453,6 +603,31 @@
453 *(.initcall7.init) \ 603 *(.initcall7.init) \
454 *(.initcall7s.init) 604 *(.initcall7s.init)
455 605
606#define INIT_CALLS \
607 VMLINUX_SYMBOL(__initcall_start) = .; \
608 INITCALLS \
609 VMLINUX_SYMBOL(__initcall_end) = .;
610
611#define CON_INITCALL \
612 VMLINUX_SYMBOL(__con_initcall_start) = .; \
613 *(.con_initcall.init) \
614 VMLINUX_SYMBOL(__con_initcall_end) = .;
615
616#define SECURITY_INITCALL \
617 VMLINUX_SYMBOL(__security_initcall_start) = .; \
618 *(.security_initcall.init) \
619 VMLINUX_SYMBOL(__security_initcall_end) = .;
620
621#ifdef CONFIG_BLK_DEV_INITRD
622#define INIT_RAM_FS \
623 . = ALIGN(PAGE_SIZE); \
624 VMLINUX_SYMBOL(__initramfs_start) = .; \
625 *(.init.ramfs) \
626 VMLINUX_SYMBOL(__initramfs_end) = .;
627#else
628#define INIT_RAM_FS
629#endif
630
456/** 631/**
457 * PERCPU_VADDR - define output section for percpu area 632 * PERCPU_VADDR - define output section for percpu area
458 * @vaddr: explicit base address (optional) 633 * @vaddr: explicit base address (optional)
@@ -509,3 +684,58 @@
509 *(.data.percpu.shared_aligned) \ 684 *(.data.percpu.shared_aligned) \
510 VMLINUX_SYMBOL(__per_cpu_end) = .; \ 685 VMLINUX_SYMBOL(__per_cpu_end) = .; \
511 } 686 }
687
688
689/*
690 * Definition of the high level *_SECTION macros
691 * They will fit only a subset of the architectures
692 */
693
694
695/*
696 * Writeable data.
697 * All sections are combined in a single .data section.
698 * The sections following CONSTRUCTORS are arranged so their
699 * typical alignment matches.
700 * A cacheline is typical/always less than a PAGE_SIZE so
701 * the sections that has this restriction (or similar)
702 * is located before the ones requiring PAGE_SIZE alignment.
703 * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
704 * matches the requirment of PAGE_ALIGNED_DATA.
705 *
706 * use 0 as page_align if page_aligned data is not used */
707#define RW_DATA_SECTION(cacheline, nosave, pagealigned, inittask) \
708 . = ALIGN(PAGE_SIZE); \
709 .data : AT(ADDR(.data) - LOAD_OFFSET) { \
710 INIT_TASK(inittask) \
711 CACHELINE_ALIGNED_DATA(cacheline) \
712 READ_MOSTLY_DATA(cacheline) \
713 DATA_DATA \
714 CONSTRUCTORS \
715 NOSAVE_DATA(nosave) \
716 PAGE_ALIGNED_DATA(pagealigned) \
717 }
718
719#define INIT_TEXT_SECTION(inittext_align) \
720 . = ALIGN(inittext_align); \
721 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { \
722 VMLINUX_SYMBOL(_sinittext) = .; \
723 INIT_TEXT \
724 VMLINUX_SYMBOL(_einittext) = .; \
725 }
726
727#define INIT_DATA_SECTION(initsetup_align) \
728 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { \
729 INIT_DATA \
730 INIT_SETUP(initsetup_align) \
731 INIT_CALLS \
732 CON_INITCALL \
733 SECURITY_INITCALL \
734 INIT_RAM_FS \
735 }
736
737#define BSS_SECTION(sbss_align, bss_align) \
738 SBSS \
739 BSS(bss_align) \
740 . = ALIGN(4);
741
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index b84d8ae35e6f..45b67d9c39c1 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -34,9 +34,6 @@
34#ifndef _DRM_P_H_ 34#ifndef _DRM_P_H_
35#define _DRM_P_H_ 35#define _DRM_P_H_
36 36
37/* If you want the memory alloc debug functionality, change define below */
38/* #define DEBUG_MEMORY */
39
40#ifdef __KERNEL__ 37#ifdef __KERNEL__
41#ifdef __alpha__ 38#ifdef __alpha__
42/* add include of current.h so that "current" is defined 39/* add include of current.h so that "current" is defined
@@ -86,7 +83,17 @@ struct drm_device;
86 83
87#include "drm_os_linux.h" 84#include "drm_os_linux.h"
88#include "drm_hashtab.h" 85#include "drm_hashtab.h"
86#include "drm_mm.h"
87
88#define DRM_UT_CORE 0x01
89#define DRM_UT_DRIVER 0x02
90#define DRM_UT_KMS 0x04
91#define DRM_UT_MODE 0x08
89 92
93extern void drm_ut_debug_printk(unsigned int request_level,
94 const char *prefix,
95 const char *function_name,
96 const char *format, ...);
90/***********************************************************************/ 97/***********************************************************************/
91/** \name DRM template customization defaults */ 98/** \name DRM template customization defaults */
92/*@{*/ 99/*@{*/
@@ -123,31 +130,6 @@ struct drm_device;
123 130
124#define DRM_FLAG_DEBUG 0x01 131#define DRM_FLAG_DEBUG 0x01
125 132
126#define DRM_MEM_DMA 0
127#define DRM_MEM_SAREA 1
128#define DRM_MEM_DRIVER 2
129#define DRM_MEM_MAGIC 3
130#define DRM_MEM_IOCTLS 4
131#define DRM_MEM_MAPS 5
132#define DRM_MEM_VMAS 6
133#define DRM_MEM_BUFS 7
134#define DRM_MEM_SEGS 8
135#define DRM_MEM_PAGES 9
136#define DRM_MEM_FILES 10
137#define DRM_MEM_QUEUES 11
138#define DRM_MEM_CMDS 12
139#define DRM_MEM_MAPPINGS 13
140#define DRM_MEM_BUFLISTS 14
141#define DRM_MEM_AGPLISTS 15
142#define DRM_MEM_TOTALAGP 16
143#define DRM_MEM_BOUNDAGP 17
144#define DRM_MEM_CTXBITMAP 18
145#define DRM_MEM_STUB 19
146#define DRM_MEM_SGLISTS 20
147#define DRM_MEM_CTXLIST 21
148#define DRM_MEM_MM 22
149#define DRM_MEM_HASHTAB 23
150
151#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8) 133#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
152#define DRM_MAP_HASH_OFFSET 0x10000000 134#define DRM_MAP_HASH_OFFSET 0x10000000
153 135
@@ -186,15 +168,57 @@ struct drm_device;
186 * \param arg arguments 168 * \param arg arguments
187 */ 169 */
188#if DRM_DEBUG_CODE 170#if DRM_DEBUG_CODE
189#define DRM_DEBUG(fmt, arg...) \ 171#define DRM_DEBUG(fmt, args...) \
172 do { \
173 drm_ut_debug_printk(DRM_UT_CORE, DRM_NAME, \
174 __func__, fmt, ##args); \
175 } while (0)
176
177#define DRM_DEBUG_DRIVER(prefix, fmt, args...) \
178 do { \
179 drm_ut_debug_printk(DRM_UT_DRIVER, prefix, \
180 __func__, fmt, ##args); \
181 } while (0)
182#define DRM_DEBUG_KMS(prefix, fmt, args...) \
183 do { \
184 drm_ut_debug_printk(DRM_UT_KMS, prefix, \
185 __func__, fmt, ##args); \
186 } while (0)
187#define DRM_DEBUG_MODE(prefix, fmt, args...) \
188 do { \
189 drm_ut_debug_printk(DRM_UT_MODE, prefix, \
190 __func__, fmt, ##args); \
191 } while (0)
192#define DRM_LOG(fmt, args...) \
193 do { \
194 drm_ut_debug_printk(DRM_UT_CORE, NULL, \
195 NULL, fmt, ##args); \
196 } while (0)
197#define DRM_LOG_KMS(fmt, args...) \
190 do { \ 198 do { \
191 if ( drm_debug ) \ 199 drm_ut_debug_printk(DRM_UT_KMS, NULL, \
192 printk(KERN_DEBUG \ 200 NULL, fmt, ##args); \
193 "[" DRM_NAME ":%s] " fmt , \ 201 } while (0)
194 __func__ , ##arg); \ 202#define DRM_LOG_MODE(fmt, args...) \
203 do { \
204 drm_ut_debug_printk(DRM_UT_MODE, NULL, \
205 NULL, fmt, ##args); \
206 } while (0)
207#define DRM_LOG_DRIVER(fmt, args...) \
208 do { \
209 drm_ut_debug_printk(DRM_UT_DRIVER, NULL, \
210 NULL, fmt, ##args); \
195 } while (0) 211 } while (0)
196#else 212#else
213#define DRM_DEBUG_DRIVER(prefix, fmt, args...) do { } while (0)
214#define DRM_DEBUG_KMS(prefix, fmt, args...) do { } while (0)
215#define DRM_DEBUG_MODE(prefix, fmt, args...) do { } while (0)
197#define DRM_DEBUG(fmt, arg...) do { } while (0) 216#define DRM_DEBUG(fmt, arg...) do { } while (0)
217#define DRM_LOG(fmt, arg...) do { } while (0)
218#define DRM_LOG_KMS(fmt, args...) do { } while (0)
219#define DRM_LOG_MODE(fmt, arg...) do { } while (0)
220#define DRM_LOG_DRIVER(fmt, arg...) do { } while (0)
221
198#endif 222#endif
199 223
200#define DRM_PROC_LIMIT (PAGE_SIZE-80) 224#define DRM_PROC_LIMIT (PAGE_SIZE-80)
@@ -237,15 +261,15 @@ struct drm_device;
237 * \param dev DRM device. 261 * \param dev DRM device.
238 * \param filp file pointer of the caller. 262 * \param filp file pointer of the caller.
239 */ 263 */
240#define LOCK_TEST_WITH_RETURN( dev, file_priv ) \ 264#define LOCK_TEST_WITH_RETURN( dev, _file_priv ) \
241do { \ 265do { \
242 if (!_DRM_LOCK_IS_HELD(file_priv->master->lock.hw_lock->lock) || \ 266 if (!_DRM_LOCK_IS_HELD(_file_priv->master->lock.hw_lock->lock) || \
243 file_priv->master->lock.file_priv != file_priv) { \ 267 _file_priv->master->lock.file_priv != _file_priv) { \
244 DRM_ERROR( "%s called without lock held, held %d owner %p %p\n",\ 268 DRM_ERROR( "%s called without lock held, held %d owner %p %p\n",\
245 __func__, _DRM_LOCK_IS_HELD(file_priv->master->lock.hw_lock->lock),\ 269 __func__, _DRM_LOCK_IS_HELD(_file_priv->master->lock.hw_lock->lock),\
246 file_priv->master->lock.file_priv, file_priv); \ 270 _file_priv->master->lock.file_priv, _file_priv); \
247 return -EINVAL; \ 271 return -EINVAL; \
248 } \ 272 } \
249} while (0) 273} while (0)
250 274
251/** 275/**
@@ -502,26 +526,6 @@ struct drm_sigdata {
502}; 526};
503 527
504 528
505/*
506 * Generic memory manager structs
507 */
508
509struct drm_mm_node {
510 struct list_head fl_entry;
511 struct list_head ml_entry;
512 int free;
513 unsigned long start;
514 unsigned long size;
515 struct drm_mm *mm;
516 void *private;
517};
518
519struct drm_mm {
520 struct list_head fl_entry;
521 struct list_head ml_entry;
522};
523
524
525/** 529/**
526 * Kernel side of a mapping 530 * Kernel side of a mapping
527 */ 531 */
@@ -1385,22 +1389,6 @@ extern char *drm_get_connector_status_name(enum drm_connector_status status);
1385extern int drm_sysfs_connector_add(struct drm_connector *connector); 1389extern int drm_sysfs_connector_add(struct drm_connector *connector);
1386extern void drm_sysfs_connector_remove(struct drm_connector *connector); 1390extern void drm_sysfs_connector_remove(struct drm_connector *connector);
1387 1391
1388/*
1389 * Basic memory manager support (drm_mm.c)
1390 */
1391extern struct drm_mm_node *drm_mm_get_block(struct drm_mm_node * parent,
1392 unsigned long size,
1393 unsigned alignment);
1394extern void drm_mm_put_block(struct drm_mm_node * cur);
1395extern struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm, unsigned long size,
1396 unsigned alignment, int best_match);
1397extern int drm_mm_init(struct drm_mm *mm, unsigned long start, unsigned long size);
1398extern void drm_mm_takedown(struct drm_mm *mm);
1399extern int drm_mm_clean(struct drm_mm *mm);
1400extern unsigned long drm_mm_tail_space(struct drm_mm *mm);
1401extern int drm_mm_remove_space_from_tail(struct drm_mm *mm, unsigned long size);
1402extern int drm_mm_add_space_to_tail(struct drm_mm *mm, unsigned long size);
1403
1404/* Graphics Execution Manager library functions (drm_gem.c) */ 1392/* Graphics Execution Manager library functions (drm_gem.c) */
1405int drm_gem_init(struct drm_device *dev); 1393int drm_gem_init(struct drm_device *dev);
1406void drm_gem_destroy(struct drm_device *dev); 1394void drm_gem_destroy(struct drm_device *dev);
@@ -1501,39 +1489,17 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1501{ 1489{
1502} 1490}
1503 1491
1504#ifndef DEBUG_MEMORY
1505/** Wrapper around kmalloc() */
1506static __inline__ void *drm_alloc(size_t size, int area)
1507{
1508 return kmalloc(size, GFP_KERNEL);
1509}
1510
1511/** Wrapper around kfree() */
1512static __inline__ void drm_free(void *pt, size_t size, int area)
1513{
1514 kfree(pt);
1515}
1516
1517/** Wrapper around kcalloc() */
1518static __inline__ void *drm_calloc(size_t nmemb, size_t size, int area)
1519{
1520 return kcalloc(nmemb, size, GFP_KERNEL);
1521}
1522 1492
1523static __inline__ void *drm_calloc_large(size_t nmemb, size_t size) 1493static __inline__ void *drm_calloc_large(size_t nmemb, size_t size)
1524{ 1494{
1525 u8 *addr; 1495 if (size * nmemb <= PAGE_SIZE)
1526
1527 if (size <= PAGE_SIZE)
1528 return kcalloc(nmemb, size, GFP_KERNEL); 1496 return kcalloc(nmemb, size, GFP_KERNEL);
1529 1497
1530 addr = vmalloc(nmemb * size); 1498 if (size != 0 && nmemb > ULONG_MAX / size)
1531 if (!addr)
1532 return NULL; 1499 return NULL;
1533 1500
1534 memset(addr, 0, nmemb * size); 1501 return __vmalloc(size * nmemb,
1535 1502 GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL);
1536 return addr;
1537} 1503}
1538 1504
1539static __inline void drm_free_large(void *ptr) 1505static __inline void drm_free_large(void *ptr)
@@ -1543,12 +1509,6 @@ static __inline void drm_free_large(void *ptr)
1543 1509
1544 vfree(ptr); 1510 vfree(ptr);
1545} 1511}
1546#else
1547extern void *drm_alloc(size_t size, int area);
1548extern void drm_free(void *pt, size_t size, int area);
1549extern void *drm_calloc(size_t nmemb, size_t size, int area);
1550#endif
1551
1552/*@}*/ 1512/*@}*/
1553 1513
1554#endif /* __KERNEL__ */ 1514#endif /* __KERNEL__ */
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index a11cc9d32591..c263e4d71754 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -28,53 +28,49 @@
28#define EDID_LENGTH 128 28#define EDID_LENGTH 128
29#define DDC_ADDR 0x50 29#define DDC_ADDR 0x50
30 30
31#ifdef BIG_ENDIAN
32#error "EDID structure is little endian, need big endian versions"
33#else
34
35struct est_timings { 31struct est_timings {
36 u8 t1; 32 u8 t1;
37 u8 t2; 33 u8 t2;
38 u8 mfg_rsvd; 34 u8 mfg_rsvd;
39} __attribute__((packed)); 35} __attribute__((packed));
40 36
37/* 00=16:10, 01=4:3, 10=5:4, 11=16:9 */
38#define EDID_TIMING_ASPECT_SHIFT 0
39#define EDID_TIMING_ASPECT_MASK (0x3 << EDID_TIMING_ASPECT_SHIFT)
40
41/* need to add 60 */
42#define EDID_TIMING_VFREQ_SHIFT 2
43#define EDID_TIMING_VFREQ_MASK (0x3f << EDID_TIMING_VFREQ_SHIFT)
44
41struct std_timing { 45struct std_timing {
42 u8 hsize; /* need to multiply by 8 then add 248 */ 46 u8 hsize; /* need to multiply by 8 then add 248 */
43 u8 vfreq:6; /* need to add 60 */ 47 u8 vfreq_aspect;
44 u8 aspect_ratio:2; /* 00=16:10, 01=4:3, 10=5:4, 11=16:9 */
45} __attribute__((packed)); 48} __attribute__((packed));
46 49
50#define DRM_EDID_PT_HSYNC_POSITIVE (1 << 6)
51#define DRM_EDID_PT_VSYNC_POSITIVE (1 << 5)
52#define DRM_EDID_PT_SEPARATE_SYNC (3 << 3)
53#define DRM_EDID_PT_STEREO (1 << 2)
54#define DRM_EDID_PT_INTERLACED (1 << 1)
55
47/* If detailed data is pixel timing */ 56/* If detailed data is pixel timing */
48struct detailed_pixel_timing { 57struct detailed_pixel_timing {
49 u8 hactive_lo; 58 u8 hactive_lo;
50 u8 hblank_lo; 59 u8 hblank_lo;
51 u8 hblank_hi:4; 60 u8 hactive_hblank_hi;
52 u8 hactive_hi:4;
53 u8 vactive_lo; 61 u8 vactive_lo;
54 u8 vblank_lo; 62 u8 vblank_lo;
55 u8 vblank_hi:4; 63 u8 vactive_vblank_hi;
56 u8 vactive_hi:4;
57 u8 hsync_offset_lo; 64 u8 hsync_offset_lo;
58 u8 hsync_pulse_width_lo; 65 u8 hsync_pulse_width_lo;
59 u8 vsync_pulse_width_lo:4; 66 u8 vsync_offset_pulse_width_lo;
60 u8 vsync_offset_lo:4; 67 u8 hsync_vsync_offset_pulse_width_hi;
61 u8 vsync_pulse_width_hi:2;
62 u8 vsync_offset_hi:2;
63 u8 hsync_pulse_width_hi:2;
64 u8 hsync_offset_hi:2;
65 u8 width_mm_lo; 68 u8 width_mm_lo;
66 u8 height_mm_lo; 69 u8 height_mm_lo;
67 u8 height_mm_hi:4; 70 u8 width_height_mm_hi;
68 u8 width_mm_hi:4;
69 u8 hborder; 71 u8 hborder;
70 u8 vborder; 72 u8 vborder;
71 u8 unknown0:1; 73 u8 misc;
72 u8 hsync_positive:1;
73 u8 vsync_positive:1;
74 u8 separate_sync:2;
75 u8 stereo:1;
76 u8 unknown6:1;
77 u8 interlaced:1;
78} __attribute__((packed)); 74} __attribute__((packed));
79 75
80/* If it's not pixel timing, it'll be one of the below */ 76/* If it's not pixel timing, it'll be one of the below */
@@ -88,18 +84,16 @@ struct detailed_data_monitor_range {
88 u8 min_hfreq_khz; 84 u8 min_hfreq_khz;
89 u8 max_hfreq_khz; 85 u8 max_hfreq_khz;
90 u8 pixel_clock_mhz; /* need to multiply by 10 */ 86 u8 pixel_clock_mhz; /* need to multiply by 10 */
91 u16 sec_gtf_toggle; /* A000=use above, 20=use below */ /* FIXME: byte order */ 87 __le16 sec_gtf_toggle; /* A000=use above, 20=use below */
92 u8 hfreq_start_khz; /* need to multiply by 2 */ 88 u8 hfreq_start_khz; /* need to multiply by 2 */
93 u8 c; /* need to divide by 2 */ 89 u8 c; /* need to divide by 2 */
94 u16 m; /* FIXME: byte order */ 90 __le16 m;
95 u8 k; 91 u8 k;
96 u8 j; /* need to divide by 2 */ 92 u8 j; /* need to divide by 2 */
97} __attribute__((packed)); 93} __attribute__((packed));
98 94
99struct detailed_data_wpindex { 95struct detailed_data_wpindex {
100 u8 white_y_lo:2; 96 u8 white_xy_lo; /* Upper 2 bits each */
101 u8 white_x_lo:2;
102 u8 pad:4;
103 u8 white_x_hi; 97 u8 white_x_hi;
104 u8 white_y_hi; 98 u8 white_y_hi;
105 u8 gamma; /* need to divide by 100 then add 1 */ 99 u8 gamma; /* need to divide by 100 then add 1 */
@@ -134,13 +128,29 @@ struct detailed_non_pixel {
134#define EDID_DETAIL_MONITOR_SERIAL 0xff 128#define EDID_DETAIL_MONITOR_SERIAL 0xff
135 129
136struct detailed_timing { 130struct detailed_timing {
137 u16 pixel_clock; /* need to multiply by 10 KHz */ /* FIXME: byte order */ 131 __le16 pixel_clock; /* need to multiply by 10 KHz */
138 union { 132 union {
139 struct detailed_pixel_timing pixel_data; 133 struct detailed_pixel_timing pixel_data;
140 struct detailed_non_pixel other_data; 134 struct detailed_non_pixel other_data;
141 } data; 135 } data;
142} __attribute__((packed)); 136} __attribute__((packed));
143 137
138#define DRM_EDID_INPUT_SERRATION_VSYNC (1 << 7)
139#define DRM_EDID_INPUT_SYNC_ON_GREEN (1 << 5)
140#define DRM_EDID_INPUT_COMPOSITE_SYNC (1 << 4)
141#define DRM_EDID_INPUT_SEPARATE_SYNCS (1 << 3)
142#define DRM_EDID_INPUT_BLANK_TO_BLACK (1 << 2)
143#define DRM_EDID_INPUT_VIDEO_LEVEL (3 << 1)
144#define DRM_EDID_INPUT_DIGITAL (1 << 0) /* bits above must be zero if set */
145
146#define DRM_EDID_FEATURE_DEFAULT_GTF (1 << 7)
147#define DRM_EDID_FEATURE_PREFERRED_TIMING (1 << 6)
148#define DRM_EDID_FEATURE_STANDARD_COLOR (1 << 5)
149#define DRM_EDID_FEATURE_DISPLAY_TYPE (3 << 3) /* 00=mono, 01=rgb, 10=non-rgb, 11=unknown */
150#define DRM_EDID_FEATURE_PM_ACTIVE_OFF (1 << 2)
151#define DRM_EDID_FEATURE_PM_SUSPEND (1 << 1)
152#define DRM_EDID_FEATURE_PM_STANDBY (1 << 0)
153
144struct edid { 154struct edid {
145 u8 header[8]; 155 u8 header[8];
146 /* Vendor & product info */ 156 /* Vendor & product info */
@@ -153,25 +163,11 @@ struct edid {
153 u8 version; 163 u8 version;
154 u8 revision; 164 u8 revision;
155 /* Display info: */ 165 /* Display info: */
156 /* input definition */ 166 u8 input;
157 u8 serration_vsync:1;
158 u8 sync_on_green:1;
159 u8 composite_sync:1;
160 u8 separate_syncs:1;
161 u8 blank_to_black:1;
162 u8 video_level:2;
163 u8 digital:1; /* bits below must be zero if set */
164 u8 width_cm; 167 u8 width_cm;
165 u8 height_cm; 168 u8 height_cm;
166 u8 gamma; 169 u8 gamma;
167 /* feature support */ 170 u8 features;
168 u8 default_gtf:1;
169 u8 preferred_timing:1;
170 u8 standard_color:1;
171 u8 display_type:2; /* 00=mono, 01=rgb, 10=non-rgb, 11=unknown */
172 u8 pm_active_off:1;
173 u8 pm_suspend:1;
174 u8 pm_standby:1;
175 /* Color characteristics */ 171 /* Color characteristics */
176 u8 red_green_lo; 172 u8 red_green_lo;
177 u8 black_white_lo; 173 u8 black_white_lo;
@@ -195,8 +191,6 @@ struct edid {
195 u8 checksum; 191 u8 checksum;
196} __attribute__((packed)); 192} __attribute__((packed));
197 193
198#endif /* little endian structs */
199
200#define EDID_PRODUCT_ID(e) ((e)->prod_code[0] | ((e)->prod_code[1] << 8)) 194#define EDID_PRODUCT_ID(e) ((e)->prod_code[0] | ((e)->prod_code[1] << 8))
201 195
202#endif /* __DRM_EDID_H__ */ 196#endif /* __DRM_EDID_H__ */
diff --git a/include/drm/drm_hashtab.h b/include/drm/drm_hashtab.h
index cd2b189e1be6..0af087a4d3b3 100644
--- a/include/drm/drm_hashtab.h
+++ b/include/drm/drm_hashtab.h
@@ -35,6 +35,8 @@
35#ifndef DRM_HASHTAB_H 35#ifndef DRM_HASHTAB_H
36#define DRM_HASHTAB_H 36#define DRM_HASHTAB_H
37 37
38#include <linux/list.h>
39
38#define drm_hash_entry(_ptr, _type, _member) container_of(_ptr, _type, _member) 40#define drm_hash_entry(_ptr, _type, _member) container_of(_ptr, _type, _member)
39 41
40struct drm_hash_item { 42struct drm_hash_item {
diff --git a/include/drm/drm_memory_debug.h b/include/drm/drm_memory_debug.h
deleted file mode 100644
index 6463271deea8..000000000000
--- a/include/drm/drm_memory_debug.h
+++ /dev/null
@@ -1,309 +0,0 @@
1/**
2 * \file drm_memory_debug.h
3 * Memory management wrappers for DRM.
4 *
5 * \author Rickard E. (Rik) Faith <faith@valinux.com>
6 * \author Gareth Hughes <gareth@valinux.com>
7 */
8
9/*
10 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
11 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
12 * All Rights Reserved.
13 *
14 * Permission is hereby granted, free of charge, to any person obtaining a
15 * copy of this software and associated documentation files (the "Software"),
16 * to deal in the Software without restriction, including without limitation
17 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 * and/or sell copies of the Software, and to permit persons to whom the
19 * Software is furnished to do so, subject to the following conditions:
20 *
21 * The above copyright notice and this permission notice (including the next
22 * paragraph) shall be included in all copies or substantial portions of the
23 * Software.
24 *
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
28 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
29 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
30 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31 * OTHER DEALINGS IN THE SOFTWARE.
32 */
33
34#include "drmP.h"
35
36typedef struct drm_mem_stats {
37 const char *name;
38 int succeed_count;
39 int free_count;
40 int fail_count;
41 unsigned long bytes_allocated;
42 unsigned long bytes_freed;
43} drm_mem_stats_t;
44
45static DEFINE_SPINLOCK(drm_mem_lock);
46static unsigned long drm_ram_available = 0; /* In pages */
47static unsigned long drm_ram_used = 0;
48static drm_mem_stats_t drm_mem_stats[] =
49{
50 [DRM_MEM_DMA] = {"dmabufs"},
51 [DRM_MEM_SAREA] = {"sareas"},
52 [DRM_MEM_DRIVER] = {"driver"},
53 [DRM_MEM_MAGIC] = {"magic"},
54 [DRM_MEM_IOCTLS] = {"ioctltab"},
55 [DRM_MEM_MAPS] = {"maplist"},
56 [DRM_MEM_VMAS] = {"vmalist"},
57 [DRM_MEM_BUFS] = {"buflist"},
58 [DRM_MEM_SEGS] = {"seglist"},
59 [DRM_MEM_PAGES] = {"pagelist"},
60 [DRM_MEM_FILES] = {"files"},
61 [DRM_MEM_QUEUES] = {"queues"},
62 [DRM_MEM_CMDS] = {"commands"},
63 [DRM_MEM_MAPPINGS] = {"mappings"},
64 [DRM_MEM_BUFLISTS] = {"buflists"},
65 [DRM_MEM_AGPLISTS] = {"agplist"},
66 [DRM_MEM_SGLISTS] = {"sglist"},
67 [DRM_MEM_TOTALAGP] = {"totalagp"},
68 [DRM_MEM_BOUNDAGP] = {"boundagp"},
69 [DRM_MEM_CTXBITMAP] = {"ctxbitmap"},
70 [DRM_MEM_CTXLIST] = {"ctxlist"},
71 [DRM_MEM_STUB] = {"stub"},
72 {NULL, 0,} /* Last entry must be null */
73};
74
75void drm_mem_init (void) {
76 drm_mem_stats_t *mem;
77 struct sysinfo si;
78
79 for (mem = drm_mem_stats; mem->name; ++mem) {
80 mem->succeed_count = 0;
81 mem->free_count = 0;
82 mem->fail_count = 0;
83 mem->bytes_allocated = 0;
84 mem->bytes_freed = 0;
85 }
86
87 si_meminfo(&si);
88 drm_ram_available = si.totalram;
89 drm_ram_used = 0;
90}
91
92/* drm_mem_info is called whenever a process reads /dev/drm/mem. */
93
94static int drm__mem_info (char *buf, char **start, off_t offset,
95 int request, int *eof, void *data) {
96 drm_mem_stats_t *pt;
97 int len = 0;
98
99 if (offset > DRM_PROC_LIMIT) {
100 *eof = 1;
101 return 0;
102 }
103
104 *eof = 0;
105 *start = &buf[offset];
106
107 DRM_PROC_PRINT(" total counts "
108 " | outstanding \n");
109 DRM_PROC_PRINT("type alloc freed fail bytes freed"
110 " | allocs bytes\n\n");
111 DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB |\n",
112 "system", 0, 0, 0,
113 drm_ram_available << (PAGE_SHIFT - 10));
114 DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB |\n",
115 "locked", 0, 0, 0, drm_ram_used >> 10);
116 DRM_PROC_PRINT("\n");
117 for (pt = drm_mem_stats; pt->name; pt++) {
118 DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu %10lu | %6d %10ld\n",
119 pt->name,
120 pt->succeed_count,
121 pt->free_count,
122 pt->fail_count,
123 pt->bytes_allocated,
124 pt->bytes_freed,
125 pt->succeed_count - pt->free_count,
126 (long)pt->bytes_allocated
127 - (long)pt->bytes_freed);
128 }
129
130 if (len > request + offset)
131 return request;
132 *eof = 1;
133 return len - offset;
134}
135
136int drm_mem_info (char *buf, char **start, off_t offset,
137 int len, int *eof, void *data) {
138 int ret;
139
140 spin_lock(&drm_mem_lock);
141 ret = drm__mem_info (buf, start, offset, len, eof, data);
142 spin_unlock(&drm_mem_lock);
143 return ret;
144}
145
146void *drm_alloc (size_t size, int area) {
147 void *pt;
148
149 if (!size) {
150 DRM_MEM_ERROR(area, "Allocating 0 bytes\n");
151 return NULL;
152 }
153
154 if (!(pt = kmalloc(size, GFP_KERNEL))) {
155 spin_lock(&drm_mem_lock);
156 ++drm_mem_stats[area].fail_count;
157 spin_unlock(&drm_mem_lock);
158 return NULL;
159 }
160 spin_lock(&drm_mem_lock);
161 ++drm_mem_stats[area].succeed_count;
162 drm_mem_stats[area].bytes_allocated += size;
163 spin_unlock(&drm_mem_lock);
164 return pt;
165}
166
167void *drm_calloc (size_t nmemb, size_t size, int area) {
168 void *addr;
169
170 addr = drm_alloc (nmemb * size, area);
171 if (addr != NULL)
172 memset((void *)addr, 0, size * nmemb);
173
174 return addr;
175}
176
177void *drm_realloc (void *oldpt, size_t oldsize, size_t size, int area) {
178 void *pt;
179
180 if (!(pt = drm_alloc (size, area)))
181 return NULL;
182 if (oldpt && oldsize) {
183 memcpy(pt, oldpt, oldsize);
184 drm_free (oldpt, oldsize, area);
185 }
186 return pt;
187}
188
189void drm_free (void *pt, size_t size, int area) {
190 int alloc_count;
191 int free_count;
192
193 if (!pt)
194 DRM_MEM_ERROR(area, "Attempt to free NULL pointer\n");
195 else
196 kfree(pt);
197 spin_lock(&drm_mem_lock);
198 drm_mem_stats[area].bytes_freed += size;
199 free_count = ++drm_mem_stats[area].free_count;
200 alloc_count = drm_mem_stats[area].succeed_count;
201 spin_unlock(&drm_mem_lock);
202 if (free_count > alloc_count) {
203 DRM_MEM_ERROR(area, "Excess frees: %d frees, %d allocs\n",
204 free_count, alloc_count);
205 }
206}
207
208#if __OS_HAS_AGP
209
210DRM_AGP_MEM *drm_alloc_agp (drm_device_t *dev, int pages, u32 type) {
211 DRM_AGP_MEM *handle;
212
213 if (!pages) {
214 DRM_MEM_ERROR(DRM_MEM_TOTALAGP, "Allocating 0 pages\n");
215 return NULL;
216 }
217
218 if ((handle = drm_agp_allocate_memory (pages, type))) {
219 spin_lock(&drm_mem_lock);
220 ++drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count;
221 drm_mem_stats[DRM_MEM_TOTALAGP].bytes_allocated
222 += pages << PAGE_SHIFT;
223 spin_unlock(&drm_mem_lock);
224 return handle;
225 }
226 spin_lock(&drm_mem_lock);
227 ++drm_mem_stats[DRM_MEM_TOTALAGP].fail_count;
228 spin_unlock(&drm_mem_lock);
229 return NULL;
230}
231
232int drm_free_agp (DRM_AGP_MEM * handle, int pages) {
233 int alloc_count;
234 int free_count;
235 int retval = -EINVAL;
236
237 if (!handle) {
238 DRM_MEM_ERROR(DRM_MEM_TOTALAGP,
239 "Attempt to free NULL AGP handle\n");
240 return retval;
241 }
242
243 if (drm_agp_free_memory (handle)) {
244 spin_lock(&drm_mem_lock);
245 free_count = ++drm_mem_stats[DRM_MEM_TOTALAGP].free_count;
246 alloc_count = drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count;
247 drm_mem_stats[DRM_MEM_TOTALAGP].bytes_freed
248 += pages << PAGE_SHIFT;
249 spin_unlock(&drm_mem_lock);
250 if (free_count > alloc_count) {
251 DRM_MEM_ERROR(DRM_MEM_TOTALAGP,
252 "Excess frees: %d frees, %d allocs\n",
253 free_count, alloc_count);
254 }
255 return 0;
256 }
257 return retval;
258}
259
260int drm_bind_agp (DRM_AGP_MEM * handle, unsigned int start) {
261 int retcode = -EINVAL;
262
263 if (!handle) {
264 DRM_MEM_ERROR(DRM_MEM_BOUNDAGP,
265 "Attempt to bind NULL AGP handle\n");
266 return retcode;
267 }
268
269 if (!(retcode = drm_agp_bind_memory (handle, start))) {
270 spin_lock(&drm_mem_lock);
271 ++drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count;
272 drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_allocated
273 += handle->page_count << PAGE_SHIFT;
274 spin_unlock(&drm_mem_lock);
275 return retcode;
276 }
277 spin_lock(&drm_mem_lock);
278 ++drm_mem_stats[DRM_MEM_BOUNDAGP].fail_count;
279 spin_unlock(&drm_mem_lock);
280 return retcode;
281}
282
283int drm_unbind_agp (DRM_AGP_MEM * handle) {
284 int alloc_count;
285 int free_count;
286 int retcode = -EINVAL;
287
288 if (!handle) {
289 DRM_MEM_ERROR(DRM_MEM_BOUNDAGP,
290 "Attempt to unbind NULL AGP handle\n");
291 return retcode;
292 }
293
294 if ((retcode = drm_agp_unbind_memory (handle)))
295 return retcode;
296 spin_lock(&drm_mem_lock);
297 free_count = ++drm_mem_stats[DRM_MEM_BOUNDAGP].free_count;
298 alloc_count = drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count;
299 drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_freed
300 += handle->page_count << PAGE_SHIFT;
301 spin_unlock(&drm_mem_lock);
302 if (free_count > alloc_count) {
303 DRM_MEM_ERROR(DRM_MEM_BOUNDAGP,
304 "Excess frees: %d frees, %d allocs\n",
305 free_count, alloc_count);
306 }
307 return retcode;
308}
309#endif
diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h
new file mode 100644
index 000000000000..f8332073d277
--- /dev/null
+++ b/include/drm/drm_mm.h
@@ -0,0 +1,99 @@
1/**************************************************************************
2 *
3 * Copyright 2006-2008 Tungsten Graphics, Inc., Cedar Park, TX. USA.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 *
27 **************************************************************************/
28/*
29 * Authors:
30 * Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
31 */
32
33#ifndef _DRM_MM_H_
34#define _DRM_MM_H_
35
36/*
37 * Generic range manager structs
38 */
39#include <linux/list.h>
40
41struct drm_mm_node {
42 struct list_head fl_entry;
43 struct list_head ml_entry;
44 int free;
45 unsigned long start;
46 unsigned long size;
47 struct drm_mm *mm;
48 void *private;
49};
50
51struct drm_mm {
52 struct list_head fl_entry;
53 struct list_head ml_entry;
54 struct list_head unused_nodes;
55 int num_unused;
56 spinlock_t unused_lock;
57};
58
59/*
60 * Basic range manager support (drm_mm.c)
61 */
62extern struct drm_mm_node *drm_mm_get_block_generic(struct drm_mm_node *node,
63 unsigned long size,
64 unsigned alignment,
65 int atomic);
66static inline struct drm_mm_node *drm_mm_get_block(struct drm_mm_node *parent,
67 unsigned long size,
68 unsigned alignment)
69{
70 return drm_mm_get_block_generic(parent, size, alignment, 0);
71}
72static inline struct drm_mm_node *drm_mm_get_block_atomic(struct drm_mm_node *parent,
73 unsigned long size,
74 unsigned alignment)
75{
76 return drm_mm_get_block_generic(parent, size, alignment, 1);
77}
78extern void drm_mm_put_block(struct drm_mm_node *cur);
79extern struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm,
80 unsigned long size,
81 unsigned alignment,
82 int best_match);
83extern int drm_mm_init(struct drm_mm *mm, unsigned long start,
84 unsigned long size);
85extern void drm_mm_takedown(struct drm_mm *mm);
86extern int drm_mm_clean(struct drm_mm *mm);
87extern unsigned long drm_mm_tail_space(struct drm_mm *mm);
88extern int drm_mm_remove_space_from_tail(struct drm_mm *mm,
89 unsigned long size);
90extern int drm_mm_add_space_to_tail(struct drm_mm *mm,
91 unsigned long size, int atomic);
92extern int drm_mm_pre_get(struct drm_mm *mm);
93
94static inline struct drm_mm *drm_get_mm(struct drm_mm_node *block)
95{
96 return block->mm;
97}
98
99#endif
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index fc55db780199..45c18672b093 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -254,6 +254,11 @@
254 {0x1002, 0x940A, 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}, \ 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}, \ 256 {0x1002, 0x940F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R600|RADEON_NEW_MEMMAP}, \
257 {0x1002, 0x94A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
258 {0x1002, 0x94A1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
259 {0x1002, 0x94B1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \
260 {0x1002, 0x94B3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \
261 {0x1002, 0x94B5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV740|RADEON_NEW_MEMMAP}, \
257 {0x1002, 0x9440, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ 262 {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}, \ 263 {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}, \ 264 {0x1002, 0x9442, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
@@ -268,6 +273,8 @@
268 {0x1002, 0x9456, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ 273 {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}, \ 274 {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}, \ 275 {0x1002, 0x945B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
276 {0x1002, 0x9460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
277 {0x1002, 0x9462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \
271 {0x1002, 0x946A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 278 {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}, \ 279 {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}, \ 280 {0x1002, 0x947A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
@@ -536,4 +543,6 @@
536 {0x8086, 0xa001, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 543 {0x8086, 0xa001, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
537 {0x8086, 0xa011, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 544 {0x8086, 0xa011, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
538 {0x8086, 0x35e8, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \ 545 {0x8086, 0x35e8, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
546 {0x8086, 0x0042, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
547 {0x8086, 0x0046, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_DISPLAY_VGA << 8, 0xffff00, 0}, \
539 {0, 0, 0} 548 {0, 0, 0}
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index fe3e3a4b4aed..41862e9a4c20 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -496,6 +496,16 @@ typedef struct {
496#define DRM_RADEON_SETPARAM 0x19 496#define DRM_RADEON_SETPARAM 0x19
497#define DRM_RADEON_SURF_ALLOC 0x1a 497#define DRM_RADEON_SURF_ALLOC 0x1a
498#define DRM_RADEON_SURF_FREE 0x1b 498#define DRM_RADEON_SURF_FREE 0x1b
499/* KMS ioctl */
500#define DRM_RADEON_GEM_INFO 0x1c
501#define DRM_RADEON_GEM_CREATE 0x1d
502#define DRM_RADEON_GEM_MMAP 0x1e
503#define DRM_RADEON_GEM_PREAD 0x21
504#define DRM_RADEON_GEM_PWRITE 0x22
505#define DRM_RADEON_GEM_SET_DOMAIN 0x23
506#define DRM_RADEON_GEM_WAIT_IDLE 0x24
507#define DRM_RADEON_CS 0x26
508#define DRM_RADEON_INFO 0x27
499 509
500#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t) 510#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_CP_INIT, drm_radeon_init_t)
501#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START) 511#define DRM_IOCTL_RADEON_CP_START DRM_IO( DRM_COMMAND_BASE + DRM_RADEON_CP_START)
@@ -524,6 +534,17 @@ typedef struct {
524#define DRM_IOCTL_RADEON_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t) 534#define DRM_IOCTL_RADEON_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SETPARAM, drm_radeon_setparam_t)
525#define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t) 535#define DRM_IOCTL_RADEON_SURF_ALLOC DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_ALLOC, drm_radeon_surface_alloc_t)
526#define DRM_IOCTL_RADEON_SURF_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t) 536#define DRM_IOCTL_RADEON_SURF_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_RADEON_SURF_FREE, drm_radeon_surface_free_t)
537/* KMS */
538#define DRM_IOCTL_RADEON_GEM_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_INFO, struct drm_radeon_gem_info)
539#define DRM_IOCTL_RADEON_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_CREATE, struct drm_radeon_gem_create)
540#define DRM_IOCTL_RADEON_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_MMAP, struct drm_radeon_gem_mmap)
541#define DRM_IOCTL_RADEON_GEM_PREAD DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PREAD, struct drm_radeon_gem_pread)
542#define DRM_IOCTL_RADEON_GEM_PWRITE DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_PWRITE, struct drm_radeon_gem_pwrite)
543#define DRM_IOCTL_RADEON_GEM_SET_DOMAIN DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_GEM_SET_DOMAIN, struct drm_radeon_gem_set_domain)
544#define DRM_IOCTL_RADEON_GEM_WAIT_IDLE DRM_IOW(DRM_COMMAND_BASE + DRM_RADEON_GEM_WAIT_IDLE, struct drm_radeon_gem_wait_idle)
545#define DRM_IOCTL_RADEON_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_CS, struct drm_radeon_cs)
546#define DRM_IOCTL_RADEON_INFO DRM_IOWR(DRM_COMMAND_BASE + DRM_RADEON_INFO, struct drm_radeon_info)
547
527 548
528typedef struct drm_radeon_init { 549typedef struct drm_radeon_init {
529 enum { 550 enum {
@@ -682,6 +703,7 @@ typedef struct drm_radeon_indirect {
682#define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */ 703#define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */
683#define RADEON_PARAM_FB_LOCATION 14 /* FB location */ 704#define RADEON_PARAM_FB_LOCATION 14 /* FB location */
684#define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */ 705#define RADEON_PARAM_NUM_GB_PIPES 15 /* num GB pipes */
706#define RADEON_PARAM_DEVICE_ID 16
685 707
686typedef struct drm_radeon_getparam { 708typedef struct drm_radeon_getparam {
687 int param; 709 int param;
@@ -751,4 +773,112 @@ typedef struct drm_radeon_surface_free {
751#define DRM_RADEON_VBLANK_CRTC1 1 773#define DRM_RADEON_VBLANK_CRTC1 1
752#define DRM_RADEON_VBLANK_CRTC2 2 774#define DRM_RADEON_VBLANK_CRTC2 2
753 775
776/*
777 * Kernel modesetting world below.
778 */
779#define RADEON_GEM_DOMAIN_CPU 0x1
780#define RADEON_GEM_DOMAIN_GTT 0x2
781#define RADEON_GEM_DOMAIN_VRAM 0x4
782
783struct drm_radeon_gem_info {
784 uint64_t gart_size;
785 uint64_t vram_size;
786 uint64_t vram_visible;
787};
788
789#define RADEON_GEM_NO_BACKING_STORE 1
790
791struct drm_radeon_gem_create {
792 uint64_t size;
793 uint64_t alignment;
794 uint32_t handle;
795 uint32_t initial_domain;
796 uint32_t flags;
797};
798
799struct drm_radeon_gem_mmap {
800 uint32_t handle;
801 uint32_t pad;
802 uint64_t offset;
803 uint64_t size;
804 uint64_t addr_ptr;
805};
806
807struct drm_radeon_gem_set_domain {
808 uint32_t handle;
809 uint32_t read_domains;
810 uint32_t write_domain;
811};
812
813struct drm_radeon_gem_wait_idle {
814 uint32_t handle;
815 uint32_t pad;
816};
817
818struct drm_radeon_gem_busy {
819 uint32_t handle;
820 uint32_t busy;
821};
822
823struct drm_radeon_gem_pread {
824 /** Handle for the object being read. */
825 uint32_t handle;
826 uint32_t pad;
827 /** Offset into the object to read from */
828 uint64_t offset;
829 /** Length of data to read */
830 uint64_t size;
831 /** Pointer to write the data into. */
832 /* void *, but pointers are not 32/64 compatible */
833 uint64_t data_ptr;
834};
835
836struct drm_radeon_gem_pwrite {
837 /** Handle for the object being written to. */
838 uint32_t handle;
839 uint32_t pad;
840 /** Offset into the object to write to */
841 uint64_t offset;
842 /** Length of data to write */
843 uint64_t size;
844 /** Pointer to read the data from. */
845 /* void *, but pointers are not 32/64 compatible */
846 uint64_t data_ptr;
847};
848
849#define RADEON_CHUNK_ID_RELOCS 0x01
850#define RADEON_CHUNK_ID_IB 0x02
851
852struct drm_radeon_cs_chunk {
853 uint32_t chunk_id;
854 uint32_t length_dw;
855 uint64_t chunk_data;
856};
857
858struct drm_radeon_cs_reloc {
859 uint32_t handle;
860 uint32_t read_domains;
861 uint32_t write_domain;
862 uint32_t flags;
863};
864
865struct drm_radeon_cs {
866 uint32_t num_chunks;
867 uint32_t cs_id;
868 /* this points to uint64_t * which point to cs chunks */
869 uint64_t chunks;
870 /* updates to the limits after this CS ioctl */
871 uint64_t gart_limit;
872 uint64_t vram_limit;
873};
874
875#define RADEON_INFO_DEVICE_ID 0x00
876#define RADEON_INFO_NUM_GB_PIPES 0x01
877
878struct drm_radeon_info {
879 uint32_t request;
880 uint32_t pad;
881 uint64_t value;
882};
883
754#endif 884#endif
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
new file mode 100644
index 000000000000..cd22ab4b495c
--- /dev/null
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -0,0 +1,618 @@
1/**************************************************************************
2 *
3 * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27/*
28 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29 */
30
31#ifndef _TTM_BO_API_H_
32#define _TTM_BO_API_H_
33
34#include "drm_hashtab.h"
35#include <linux/kref.h>
36#include <linux/list.h>
37#include <linux/wait.h>
38#include <linux/mutex.h>
39#include <linux/mm.h>
40#include <linux/rbtree.h>
41#include <linux/bitmap.h>
42
43struct ttm_bo_device;
44
45struct drm_mm_node;
46
47/**
48 * struct ttm_mem_reg
49 *
50 * @mm_node: Memory manager node.
51 * @size: Requested size of memory region.
52 * @num_pages: Actual size of memory region in pages.
53 * @page_alignment: Page alignment.
54 * @placement: Placement flags.
55 *
56 * Structure indicating the placement and space resources used by a
57 * buffer object.
58 */
59
60struct ttm_mem_reg {
61 struct drm_mm_node *mm_node;
62 unsigned long size;
63 unsigned long num_pages;
64 uint32_t page_alignment;
65 uint32_t mem_type;
66 uint32_t placement;
67};
68
69/**
70 * enum ttm_bo_type
71 *
72 * @ttm_bo_type_device: These are 'normal' buffers that can
73 * be mmapped by user space. Each of these bos occupy a slot in the
74 * device address space, that can be used for normal vm operations.
75 *
76 * @ttm_bo_type_user: These are user-space memory areas that are made
77 * available to the GPU by mapping the buffer pages into the GPU aperture
78 * space. These buffers cannot be mmaped from the device address space.
79 *
80 * @ttm_bo_type_kernel: These buffers are like ttm_bo_type_device buffers,
81 * but they cannot be accessed from user-space. For kernel-only use.
82 */
83
84enum ttm_bo_type {
85 ttm_bo_type_device,
86 ttm_bo_type_user,
87 ttm_bo_type_kernel
88};
89
90struct ttm_tt;
91
92/**
93 * struct ttm_buffer_object
94 *
95 * @bdev: Pointer to the buffer object device structure.
96 * @buffer_start: The virtual user-space start address of ttm_bo_type_user
97 * buffers.
98 * @type: The bo type.
99 * @destroy: Destruction function. If NULL, kfree is used.
100 * @num_pages: Actual number of pages.
101 * @addr_space_offset: Address space offset.
102 * @acc_size: Accounted size for this object.
103 * @kref: Reference count of this buffer object. When this refcount reaches
104 * zero, the object is put on the delayed delete list.
105 * @list_kref: List reference count of this buffer object. This member is
106 * used to avoid destruction while the buffer object is still on a list.
107 * Lru lists may keep one refcount, the delayed delete list, and kref != 0
108 * keeps one refcount. When this refcount reaches zero,
109 * the object is destroyed.
110 * @event_queue: Queue for processes waiting on buffer object status change.
111 * @lock: spinlock protecting mostly synchronization members.
112 * @proposed_placement: Proposed placement for the buffer. Changed only by the
113 * creator prior to validation as opposed to bo->mem.proposed_flags which is
114 * changed by the implementation prior to a buffer move if it wants to outsmart
115 * the buffer creator / user. This latter happens, for example, at eviction.
116 * @mem: structure describing current placement.
117 * @persistant_swap_storage: Usually the swap storage is deleted for buffers
118 * pinned in physical memory. If this behaviour is not desired, this member
119 * holds a pointer to a persistant shmem object.
120 * @ttm: TTM structure holding system pages.
121 * @evicted: Whether the object was evicted without user-space knowing.
122 * @cpu_writes: For synchronization. Number of cpu writers.
123 * @lru: List head for the lru list.
124 * @ddestroy: List head for the delayed destroy list.
125 * @swap: List head for swap LRU list.
126 * @val_seq: Sequence of the validation holding the @reserved lock.
127 * Used to avoid starvation when many processes compete to validate the
128 * buffer. This member is protected by the bo_device::lru_lock.
129 * @seq_valid: The value of @val_seq is valid. This value is protected by
130 * the bo_device::lru_lock.
131 * @reserved: Deadlock-free lock used for synchronization state transitions.
132 * @sync_obj_arg: Opaque argument to synchronization object function.
133 * @sync_obj: Pointer to a synchronization object.
134 * @priv_flags: Flags describing buffer object internal state.
135 * @vm_rb: Rb node for the vm rb tree.
136 * @vm_node: Address space manager node.
137 * @offset: The current GPU offset, which can have different meanings
138 * depending on the memory type. For SYSTEM type memory, it should be 0.
139 * @cur_placement: Hint of current placement.
140 *
141 * Base class for TTM buffer object, that deals with data placement and CPU
142 * mappings. GPU mappings are really up to the driver, but for simpler GPUs
143 * the driver can usually use the placement offset @offset directly as the
144 * GPU virtual address. For drivers implementing multiple
145 * GPU memory manager contexts, the driver should manage the address space
146 * in these contexts separately and use these objects to get the correct
147 * placement and caching for these GPU maps. This makes it possible to use
148 * these objects for even quite elaborate memory management schemes.
149 * The destroy member, the API visibility of this object makes it possible
150 * to derive driver specific types.
151 */
152
153struct ttm_buffer_object {
154 /**
155 * Members constant at init.
156 */
157
158 struct ttm_bo_device *bdev;
159 unsigned long buffer_start;
160 enum ttm_bo_type type;
161 void (*destroy) (struct ttm_buffer_object *);
162 unsigned long num_pages;
163 uint64_t addr_space_offset;
164 size_t acc_size;
165
166 /**
167 * Members not needing protection.
168 */
169
170 struct kref kref;
171 struct kref list_kref;
172 wait_queue_head_t event_queue;
173 spinlock_t lock;
174
175 /**
176 * Members protected by the bo::reserved lock.
177 */
178
179 uint32_t proposed_placement;
180 struct ttm_mem_reg mem;
181 struct file *persistant_swap_storage;
182 struct ttm_tt *ttm;
183 bool evicted;
184
185 /**
186 * Members protected by the bo::reserved lock only when written to.
187 */
188
189 atomic_t cpu_writers;
190
191 /**
192 * Members protected by the bdev::lru_lock.
193 */
194
195 struct list_head lru;
196 struct list_head ddestroy;
197 struct list_head swap;
198 uint32_t val_seq;
199 bool seq_valid;
200
201 /**
202 * Members protected by the bdev::lru_lock
203 * only when written to.
204 */
205
206 atomic_t reserved;
207
208
209 /**
210 * Members protected by the bo::lock
211 */
212
213 void *sync_obj_arg;
214 void *sync_obj;
215 unsigned long priv_flags;
216
217 /**
218 * Members protected by the bdev::vm_lock
219 */
220
221 struct rb_node vm_rb;
222 struct drm_mm_node *vm_node;
223
224
225 /**
226 * Special members that are protected by the reserve lock
227 * and the bo::lock when written to. Can be read with
228 * either of these locks held.
229 */
230
231 unsigned long offset;
232 uint32_t cur_placement;
233};
234
235/**
236 * struct ttm_bo_kmap_obj
237 *
238 * @virtual: The current kernel virtual address.
239 * @page: The page when kmap'ing a single page.
240 * @bo_kmap_type: Type of bo_kmap.
241 *
242 * Object describing a kernel mapping. Since a TTM bo may be located
243 * in various memory types with various caching policies, the
244 * mapping can either be an ioremap, a vmap, a kmap or part of a
245 * premapped region.
246 */
247
248struct ttm_bo_kmap_obj {
249 void *virtual;
250 struct page *page;
251 enum {
252 ttm_bo_map_iomap,
253 ttm_bo_map_vmap,
254 ttm_bo_map_kmap,
255 ttm_bo_map_premapped,
256 } bo_kmap_type;
257};
258
259/**
260 * ttm_bo_reference - reference a struct ttm_buffer_object
261 *
262 * @bo: The buffer object.
263 *
264 * Returns a refcounted pointer to a buffer object.
265 */
266
267static inline struct ttm_buffer_object *
268ttm_bo_reference(struct ttm_buffer_object *bo)
269{
270 kref_get(&bo->kref);
271 return bo;
272}
273
274/**
275 * ttm_bo_wait - wait for buffer idle.
276 *
277 * @bo: The buffer object.
278 * @interruptible: Use interruptible wait.
279 * @no_wait: Return immediately if buffer is busy.
280 *
281 * This function must be called with the bo::mutex held, and makes
282 * sure any previous rendering to the buffer is completed.
283 * Note: It might be necessary to block validations before the
284 * wait by reserving the buffer.
285 * Returns -EBUSY if no_wait is true and the buffer is busy.
286 * Returns -ERESTART if interrupted by a signal.
287 */
288extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
289 bool interruptible, bool no_wait);
290/**
291 * ttm_buffer_object_validate
292 *
293 * @bo: The buffer object.
294 * @proposed_placement: Proposed_placement for the buffer object.
295 * @interruptible: Sleep interruptible if sleeping.
296 * @no_wait: Return immediately if the buffer is busy.
297 *
298 * Changes placement and caching policy of the buffer object
299 * according to bo::proposed_flags.
300 * Returns
301 * -EINVAL on invalid proposed_flags.
302 * -ENOMEM on out-of-memory condition.
303 * -EBUSY if no_wait is true and buffer busy.
304 * -ERESTART if interrupted by a signal.
305 */
306extern int ttm_buffer_object_validate(struct ttm_buffer_object *bo,
307 uint32_t proposed_placement,
308 bool interruptible, bool no_wait);
309/**
310 * ttm_bo_unref
311 *
312 * @bo: The buffer object.
313 *
314 * Unreference and clear a pointer to a buffer object.
315 */
316extern void ttm_bo_unref(struct ttm_buffer_object **bo);
317
318/**
319 * ttm_bo_synccpu_write_grab
320 *
321 * @bo: The buffer object:
322 * @no_wait: Return immediately if buffer is busy.
323 *
324 * Synchronizes a buffer object for CPU RW access. This means
325 * blocking command submission that affects the buffer and
326 * waiting for buffer idle. This lock is recursive.
327 * Returns
328 * -EBUSY if the buffer is busy and no_wait is true.
329 * -ERESTART if interrupted by a signal.
330 */
331
332extern int
333ttm_bo_synccpu_write_grab(struct ttm_buffer_object *bo, bool no_wait);
334/**
335 * ttm_bo_synccpu_write_release:
336 *
337 * @bo : The buffer object.
338 *
339 * Releases a synccpu lock.
340 */
341extern void ttm_bo_synccpu_write_release(struct ttm_buffer_object *bo);
342
343/**
344 * ttm_buffer_object_init
345 *
346 * @bdev: Pointer to a ttm_bo_device struct.
347 * @bo: Pointer to a ttm_buffer_object to be initialized.
348 * @size: Requested size of buffer object.
349 * @type: Requested type of buffer object.
350 * @flags: Initial placement flags.
351 * @page_alignment: Data alignment in pages.
352 * @buffer_start: Virtual address of user space data backing a
353 * user buffer object.
354 * @interruptible: If needing to sleep to wait for GPU resources,
355 * sleep interruptible.
356 * @persistant_swap_storage: Usually the swap storage is deleted for buffers
357 * pinned in physical memory. If this behaviour is not desired, this member
358 * holds a pointer to a persistant shmem object. Typically, this would
359 * point to the shmem object backing a GEM object if TTM is used to back a
360 * GEM user interface.
361 * @acc_size: Accounted size for this object.
362 * @destroy: Destroy function. Use NULL for kfree().
363 *
364 * This function initializes a pre-allocated struct ttm_buffer_object.
365 * As this object may be part of a larger structure, this function,
366 * together with the @destroy function,
367 * enables driver-specific objects derived from a ttm_buffer_object.
368 * On successful return, the object kref and list_kref are set to 1.
369 * Returns
370 * -ENOMEM: Out of memory.
371 * -EINVAL: Invalid placement flags.
372 * -ERESTART: Interrupted by signal while sleeping waiting for resources.
373 */
374
375extern int ttm_buffer_object_init(struct ttm_bo_device *bdev,
376 struct ttm_buffer_object *bo,
377 unsigned long size,
378 enum ttm_bo_type type,
379 uint32_t flags,
380 uint32_t page_alignment,
381 unsigned long buffer_start,
382 bool interrubtible,
383 struct file *persistant_swap_storage,
384 size_t acc_size,
385 void (*destroy) (struct ttm_buffer_object *));
386/**
387 * ttm_bo_synccpu_object_init
388 *
389 * @bdev: Pointer to a ttm_bo_device struct.
390 * @bo: Pointer to a ttm_buffer_object to be initialized.
391 * @size: Requested size of buffer object.
392 * @type: Requested type of buffer object.
393 * @flags: Initial placement flags.
394 * @page_alignment: Data alignment in pages.
395 * @buffer_start: Virtual address of user space data backing a
396 * user buffer object.
397 * @interruptible: If needing to sleep while waiting for GPU resources,
398 * sleep interruptible.
399 * @persistant_swap_storage: Usually the swap storage is deleted for buffers
400 * pinned in physical memory. If this behaviour is not desired, this member
401 * holds a pointer to a persistant shmem object. Typically, this would
402 * point to the shmem object backing a GEM object if TTM is used to back a
403 * GEM user interface.
404 * @p_bo: On successful completion *p_bo points to the created object.
405 *
406 * This function allocates a ttm_buffer_object, and then calls
407 * ttm_buffer_object_init on that object.
408 * The destroy function is set to kfree().
409 * Returns
410 * -ENOMEM: Out of memory.
411 * -EINVAL: Invalid placement flags.
412 * -ERESTART: Interrupted by signal while waiting for resources.
413 */
414
415extern int ttm_buffer_object_create(struct ttm_bo_device *bdev,
416 unsigned long size,
417 enum ttm_bo_type type,
418 uint32_t flags,
419 uint32_t page_alignment,
420 unsigned long buffer_start,
421 bool interruptible,
422 struct file *persistant_swap_storage,
423 struct ttm_buffer_object **p_bo);
424
425/**
426 * ttm_bo_check_placement
427 *
428 * @bo: the buffer object.
429 * @set_flags: placement flags to set.
430 * @clr_flags: placement flags to clear.
431 *
432 * Performs minimal validity checking on an intended change of
433 * placement flags.
434 * Returns
435 * -EINVAL: Intended change is invalid or not allowed.
436 */
437
438extern int ttm_bo_check_placement(struct ttm_buffer_object *bo,
439 uint32_t set_flags, uint32_t clr_flags);
440
441/**
442 * ttm_bo_init_mm
443 *
444 * @bdev: Pointer to a ttm_bo_device struct.
445 * @mem_type: The memory type.
446 * @p_offset: offset for managed area in pages.
447 * @p_size: size managed area in pages.
448 *
449 * Initialize a manager for a given memory type.
450 * Note: if part of driver firstopen, it must be protected from a
451 * potentially racing lastclose.
452 * Returns:
453 * -EINVAL: invalid size or memory type.
454 * -ENOMEM: Not enough memory.
455 * May also return driver-specified errors.
456 */
457
458extern int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type,
459 unsigned long p_offset, unsigned long p_size);
460/**
461 * ttm_bo_clean_mm
462 *
463 * @bdev: Pointer to a ttm_bo_device struct.
464 * @mem_type: The memory type.
465 *
466 * Take down a manager for a given memory type after first walking
467 * the LRU list to evict any buffers left alive.
468 *
469 * Normally, this function is part of lastclose() or unload(), and at that
470 * point there shouldn't be any buffers left created by user-space, since
471 * there should've been removed by the file descriptor release() method.
472 * However, before this function is run, make sure to signal all sync objects,
473 * and verify that the delayed delete queue is empty. The driver must also
474 * make sure that there are no NO_EVICT buffers present in this memory type
475 * when the call is made.
476 *
477 * If this function is part of a VT switch, the caller must make sure that
478 * there are no appications currently validating buffers before this
479 * function is called. The caller can do that by first taking the
480 * struct ttm_bo_device::ttm_lock in write mode.
481 *
482 * Returns:
483 * -EINVAL: invalid or uninitialized memory type.
484 * -EBUSY: There are still buffers left in this memory type.
485 */
486
487extern int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type);
488
489/**
490 * ttm_bo_evict_mm
491 *
492 * @bdev: Pointer to a ttm_bo_device struct.
493 * @mem_type: The memory type.
494 *
495 * Evicts all buffers on the lru list of the memory type.
496 * This is normally part of a VT switch or an
497 * out-of-memory-space-due-to-fragmentation handler.
498 * The caller must make sure that there are no other processes
499 * currently validating buffers, and can do that by taking the
500 * struct ttm_bo_device::ttm_lock in write mode.
501 *
502 * Returns:
503 * -EINVAL: Invalid or uninitialized memory type.
504 * -ERESTART: The call was interrupted by a signal while waiting to
505 * evict a buffer.
506 */
507
508extern int ttm_bo_evict_mm(struct ttm_bo_device *bdev, unsigned mem_type);
509
510/**
511 * ttm_kmap_obj_virtual
512 *
513 * @map: A struct ttm_bo_kmap_obj returned from ttm_bo_kmap.
514 * @is_iomem: Pointer to an integer that on return indicates 1 if the
515 * virtual map is io memory, 0 if normal memory.
516 *
517 * Returns the virtual address of a buffer object area mapped by ttm_bo_kmap.
518 * If *is_iomem is 1 on return, the virtual address points to an io memory area,
519 * that should strictly be accessed by the iowriteXX() and similar functions.
520 */
521
522static inline void *ttm_kmap_obj_virtual(struct ttm_bo_kmap_obj *map,
523 bool *is_iomem)
524{
525 *is_iomem = (map->bo_kmap_type == ttm_bo_map_iomap ||
526 map->bo_kmap_type == ttm_bo_map_premapped);
527 return map->virtual;
528}
529
530/**
531 * ttm_bo_kmap
532 *
533 * @bo: The buffer object.
534 * @start_page: The first page to map.
535 * @num_pages: Number of pages to map.
536 * @map: pointer to a struct ttm_bo_kmap_obj representing the map.
537 *
538 * Sets up a kernel virtual mapping, using ioremap, vmap or kmap to the
539 * data in the buffer object. The ttm_kmap_obj_virtual function can then be
540 * used to obtain a virtual address to the data.
541 *
542 * Returns
543 * -ENOMEM: Out of memory.
544 * -EINVAL: Invalid range.
545 */
546
547extern int ttm_bo_kmap(struct ttm_buffer_object *bo, unsigned long start_page,
548 unsigned long num_pages, struct ttm_bo_kmap_obj *map);
549
550/**
551 * ttm_bo_kunmap
552 *
553 * @map: Object describing the map to unmap.
554 *
555 * Unmaps a kernel map set up by ttm_bo_kmap.
556 */
557
558extern void ttm_bo_kunmap(struct ttm_bo_kmap_obj *map);
559
560#if 0
561#endif
562
563/**
564 * ttm_fbdev_mmap - mmap fbdev memory backed by a ttm buffer object.
565 *
566 * @vma: vma as input from the fbdev mmap method.
567 * @bo: The bo backing the address space. The address space will
568 * have the same size as the bo, and start at offset 0.
569 *
570 * This function is intended to be called by the fbdev mmap method
571 * if the fbdev address space is to be backed by a bo.
572 */
573
574extern int ttm_fbdev_mmap(struct vm_area_struct *vma,
575 struct ttm_buffer_object *bo);
576
577/**
578 * ttm_bo_mmap - mmap out of the ttm device address space.
579 *
580 * @filp: filp as input from the mmap method.
581 * @vma: vma as input from the mmap method.
582 * @bdev: Pointer to the ttm_bo_device with the address space manager.
583 *
584 * This function is intended to be called by the device mmap method.
585 * if the device address space is to be backed by the bo manager.
586 */
587
588extern int ttm_bo_mmap(struct file *filp, struct vm_area_struct *vma,
589 struct ttm_bo_device *bdev);
590
591/**
592 * ttm_bo_io
593 *
594 * @bdev: Pointer to the struct ttm_bo_device.
595 * @filp: Pointer to the struct file attempting to read / write.
596 * @wbuf: User-space pointer to address of buffer to write. NULL on read.
597 * @rbuf: User-space pointer to address of buffer to read into.
598 * Null on write.
599 * @count: Number of bytes to read / write.
600 * @f_pos: Pointer to current file position.
601 * @write: 1 for read, 0 for write.
602 *
603 * This function implements read / write into ttm buffer objects, and is
604 * intended to
605 * be called from the fops::read and fops::write method.
606 * Returns:
607 * See man (2) write, man(2) read. In particular,
608 * the function may return -EINTR if
609 * interrupted by a signal.
610 */
611
612extern ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp,
613 const char __user *wbuf, char __user *rbuf,
614 size_t count, loff_t *f_pos, bool write);
615
616extern void ttm_bo_swapout_all(struct ttm_bo_device *bdev);
617
618#endif
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
new file mode 100644
index 000000000000..62ed733c52a2
--- /dev/null
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -0,0 +1,867 @@
1/**************************************************************************
2 *
3 * Copyright (c) 2006-2009 Vmware, Inc., Palo Alto, CA., USA
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27/*
28 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29 */
30#ifndef _TTM_BO_DRIVER_H_
31#define _TTM_BO_DRIVER_H_
32
33#include "ttm/ttm_bo_api.h"
34#include "ttm/ttm_memory.h"
35#include "drm_mm.h"
36#include "linux/workqueue.h"
37#include "linux/fs.h"
38#include "linux/spinlock.h"
39
40struct ttm_backend;
41
42struct ttm_backend_func {
43 /**
44 * struct ttm_backend_func member populate
45 *
46 * @backend: Pointer to a struct ttm_backend.
47 * @num_pages: Number of pages to populate.
48 * @pages: Array of pointers to ttm pages.
49 * @dummy_read_page: Page to be used instead of NULL pages in the
50 * array @pages.
51 *
52 * Populate the backend with ttm pages. Depending on the backend,
53 * it may or may not copy the @pages array.
54 */
55 int (*populate) (struct ttm_backend *backend,
56 unsigned long num_pages, struct page **pages,
57 struct page *dummy_read_page);
58 /**
59 * struct ttm_backend_func member clear
60 *
61 * @backend: Pointer to a struct ttm_backend.
62 *
63 * This is an "unpopulate" function. Release all resources
64 * allocated with populate.
65 */
66 void (*clear) (struct ttm_backend *backend);
67
68 /**
69 * struct ttm_backend_func member bind
70 *
71 * @backend: Pointer to a struct ttm_backend.
72 * @bo_mem: Pointer to a struct ttm_mem_reg describing the
73 * memory type and location for binding.
74 *
75 * Bind the backend pages into the aperture in the location
76 * indicated by @bo_mem. This function should be able to handle
77 * differences between aperture- and system page sizes.
78 */
79 int (*bind) (struct ttm_backend *backend, struct ttm_mem_reg *bo_mem);
80
81 /**
82 * struct ttm_backend_func member unbind
83 *
84 * @backend: Pointer to a struct ttm_backend.
85 *
86 * Unbind previously bound backend pages. This function should be
87 * able to handle differences between aperture- and system page sizes.
88 */
89 int (*unbind) (struct ttm_backend *backend);
90
91 /**
92 * struct ttm_backend_func member destroy
93 *
94 * @backend: Pointer to a struct ttm_backend.
95 *
96 * Destroy the backend.
97 */
98 void (*destroy) (struct ttm_backend *backend);
99};
100
101/**
102 * struct ttm_backend
103 *
104 * @bdev: Pointer to a struct ttm_bo_device.
105 * @flags: For driver use.
106 * @func: Pointer to a struct ttm_backend_func that describes
107 * the backend methods.
108 *
109 */
110
111struct ttm_backend {
112 struct ttm_bo_device *bdev;
113 uint32_t flags;
114 struct ttm_backend_func *func;
115};
116
117#define TTM_PAGE_FLAG_VMALLOC (1 << 0)
118#define TTM_PAGE_FLAG_USER (1 << 1)
119#define TTM_PAGE_FLAG_USER_DIRTY (1 << 2)
120#define TTM_PAGE_FLAG_WRITE (1 << 3)
121#define TTM_PAGE_FLAG_SWAPPED (1 << 4)
122#define TTM_PAGE_FLAG_PERSISTANT_SWAP (1 << 5)
123#define TTM_PAGE_FLAG_ZERO_ALLOC (1 << 6)
124
125enum ttm_caching_state {
126 tt_uncached,
127 tt_wc,
128 tt_cached
129};
130
131/**
132 * struct ttm_tt
133 *
134 * @dummy_read_page: Page to map where the ttm_tt page array contains a NULL
135 * pointer.
136 * @pages: Array of pages backing the data.
137 * @first_himem_page: Himem pages are put last in the page array, which
138 * enables us to run caching attribute changes on only the first part
139 * of the page array containing lomem pages. This is the index of the
140 * first himem page.
141 * @last_lomem_page: Index of the last lomem page in the page array.
142 * @num_pages: Number of pages in the page array.
143 * @bdev: Pointer to the current struct ttm_bo_device.
144 * @be: Pointer to the ttm backend.
145 * @tsk: The task for user ttm.
146 * @start: virtual address for user ttm.
147 * @swap_storage: Pointer to shmem struct file for swap storage.
148 * @caching_state: The current caching state of the pages.
149 * @state: The current binding state of the pages.
150 *
151 * This is a structure holding the pages, caching- and aperture binding
152 * status for a buffer object that isn't backed by fixed (VRAM / AGP)
153 * memory.
154 */
155
156struct ttm_tt {
157 struct page *dummy_read_page;
158 struct page **pages;
159 long first_himem_page;
160 long last_lomem_page;
161 uint32_t page_flags;
162 unsigned long num_pages;
163 struct ttm_bo_device *bdev;
164 struct ttm_backend *be;
165 struct task_struct *tsk;
166 unsigned long start;
167 struct file *swap_storage;
168 enum ttm_caching_state caching_state;
169 enum {
170 tt_bound,
171 tt_unbound,
172 tt_unpopulated,
173 } state;
174};
175
176#define TTM_MEMTYPE_FLAG_FIXED (1 << 0) /* Fixed (on-card) PCI memory */
177#define TTM_MEMTYPE_FLAG_MAPPABLE (1 << 1) /* Memory mappable */
178#define TTM_MEMTYPE_FLAG_NEEDS_IOREMAP (1 << 2) /* Fixed memory needs ioremap
179 before kernel access. */
180#define TTM_MEMTYPE_FLAG_CMA (1 << 3) /* Can't map aperture */
181
182/**
183 * struct ttm_mem_type_manager
184 *
185 * @has_type: The memory type has been initialized.
186 * @use_type: The memory type is enabled.
187 * @flags: TTM_MEMTYPE_XX flags identifying the traits of the memory
188 * managed by this memory type.
189 * @gpu_offset: If used, the GPU offset of the first managed page of
190 * fixed memory or the first managed location in an aperture.
191 * @io_offset: The io_offset of the first managed page of IO memory or
192 * the first managed location in an aperture. For TTM_MEMTYPE_FLAG_CMA
193 * memory, this should be set to NULL.
194 * @io_size: The size of a managed IO region (fixed memory or aperture).
195 * @io_addr: Virtual kernel address if the io region is pre-mapped. For
196 * TTM_MEMTYPE_FLAG_NEEDS_IOREMAP there is no pre-mapped io map and
197 * @io_addr should be set to NULL.
198 * @size: Size of the managed region.
199 * @available_caching: A mask of available caching types, TTM_PL_FLAG_XX,
200 * as defined in ttm_placement_common.h
201 * @default_caching: The default caching policy used for a buffer object
202 * placed in this memory type if the user doesn't provide one.
203 * @manager: The range manager used for this memory type. FIXME: If the aperture
204 * has a page size different from the underlying system, the granularity
205 * of this manager should take care of this. But the range allocating code
206 * in ttm_bo.c needs to be modified for this.
207 * @lru: The lru list for this memory type.
208 *
209 * This structure is used to identify and manage memory types for a device.
210 * It's set up by the ttm_bo_driver::init_mem_type method.
211 */
212
213struct ttm_mem_type_manager {
214
215 /*
216 * No protection. Constant from start.
217 */
218
219 bool has_type;
220 bool use_type;
221 uint32_t flags;
222 unsigned long gpu_offset;
223 unsigned long io_offset;
224 unsigned long io_size;
225 void *io_addr;
226 uint64_t size;
227 uint32_t available_caching;
228 uint32_t default_caching;
229
230 /*
231 * Protected by the bdev->lru_lock.
232 * TODO: Consider one lru_lock per ttm_mem_type_manager.
233 * Plays ill with list removal, though.
234 */
235
236 struct drm_mm manager;
237 struct list_head lru;
238};
239
240/**
241 * struct ttm_bo_driver
242 *
243 * @mem_type_prio: Priority array of memory types to place a buffer object in
244 * if it fits without evicting buffers from any of these memory types.
245 * @mem_busy_prio: Priority array of memory types to place a buffer object in
246 * if it needs to evict buffers to make room.
247 * @num_mem_type_prio: Number of elements in the @mem_type_prio array.
248 * @num_mem_busy_prio: Number of elements in the @num_mem_busy_prio array.
249 * @create_ttm_backend_entry: Callback to create a struct ttm_backend.
250 * @invalidate_caches: Callback to invalidate read caches when a buffer object
251 * has been evicted.
252 * @init_mem_type: Callback to initialize a struct ttm_mem_type_manager
253 * structure.
254 * @evict_flags: Callback to obtain placement flags when a buffer is evicted.
255 * @move: Callback for a driver to hook in accelerated functions to
256 * move a buffer.
257 * If set to NULL, a potentially slow memcpy() move is used.
258 * @sync_obj_signaled: See ttm_fence_api.h
259 * @sync_obj_wait: See ttm_fence_api.h
260 * @sync_obj_flush: See ttm_fence_api.h
261 * @sync_obj_unref: See ttm_fence_api.h
262 * @sync_obj_ref: See ttm_fence_api.h
263 */
264
265struct ttm_bo_driver {
266 const uint32_t *mem_type_prio;
267 const uint32_t *mem_busy_prio;
268 uint32_t num_mem_type_prio;
269 uint32_t num_mem_busy_prio;
270
271 /**
272 * struct ttm_bo_driver member create_ttm_backend_entry
273 *
274 * @bdev: The buffer object device.
275 *
276 * Create a driver specific struct ttm_backend.
277 */
278
279 struct ttm_backend *(*create_ttm_backend_entry)
280 (struct ttm_bo_device *bdev);
281
282 /**
283 * struct ttm_bo_driver member invalidate_caches
284 *
285 * @bdev: the buffer object device.
286 * @flags: new placement of the rebound buffer object.
287 *
288 * A previosly evicted buffer has been rebound in a
289 * potentially new location. Tell the driver that it might
290 * consider invalidating read (texture) caches on the next command
291 * submission as a consequence.
292 */
293
294 int (*invalidate_caches) (struct ttm_bo_device *bdev, uint32_t flags);
295 int (*init_mem_type) (struct ttm_bo_device *bdev, uint32_t type,
296 struct ttm_mem_type_manager *man);
297 /**
298 * struct ttm_bo_driver member evict_flags:
299 *
300 * @bo: the buffer object to be evicted
301 *
302 * Return the bo flags for a buffer which is not mapped to the hardware.
303 * These will be placed in proposed_flags so that when the move is
304 * finished, they'll end up in bo->mem.flags
305 */
306
307 uint32_t(*evict_flags) (struct ttm_buffer_object *bo);
308 /**
309 * struct ttm_bo_driver member move:
310 *
311 * @bo: the buffer to move
312 * @evict: whether this motion is evicting the buffer from
313 * the graphics address space
314 * @interruptible: Use interruptible sleeps if possible when sleeping.
315 * @no_wait: whether this should give up and return -EBUSY
316 * if this move would require sleeping
317 * @new_mem: the new memory region receiving the buffer
318 *
319 * Move a buffer between two memory regions.
320 */
321 int (*move) (struct ttm_buffer_object *bo,
322 bool evict, bool interruptible,
323 bool no_wait, struct ttm_mem_reg *new_mem);
324
325 /**
326 * struct ttm_bo_driver_member verify_access
327 *
328 * @bo: Pointer to a buffer object.
329 * @filp: Pointer to a struct file trying to access the object.
330 *
331 * Called from the map / write / read methods to verify that the
332 * caller is permitted to access the buffer object.
333 * This member may be set to NULL, which will refuse this kind of
334 * access for all buffer objects.
335 * This function should return 0 if access is granted, -EPERM otherwise.
336 */
337 int (*verify_access) (struct ttm_buffer_object *bo,
338 struct file *filp);
339
340 /**
341 * In case a driver writer dislikes the TTM fence objects,
342 * the driver writer can replace those with sync objects of
343 * his / her own. If it turns out that no driver writer is
344 * using these. I suggest we remove these hooks and plug in
345 * fences directly. The bo driver needs the following functionality:
346 * See the corresponding functions in the fence object API
347 * documentation.
348 */
349
350 bool (*sync_obj_signaled) (void *sync_obj, void *sync_arg);
351 int (*sync_obj_wait) (void *sync_obj, void *sync_arg,
352 bool lazy, bool interruptible);
353 int (*sync_obj_flush) (void *sync_obj, void *sync_arg);
354 void (*sync_obj_unref) (void **sync_obj);
355 void *(*sync_obj_ref) (void *sync_obj);
356};
357
358#define TTM_NUM_MEM_TYPES 8
359
360#define TTM_BO_PRIV_FLAG_MOVING 0 /* Buffer object is moving and needs
361 idling before CPU mapping */
362#define TTM_BO_PRIV_FLAG_MAX 1
363/**
364 * struct ttm_bo_device - Buffer object driver device-specific data.
365 *
366 * @mem_glob: Pointer to a struct ttm_mem_global object for accounting.
367 * @driver: Pointer to a struct ttm_bo_driver struct setup by the driver.
368 * @count: Current number of buffer object.
369 * @pages: Current number of pinned pages.
370 * @dummy_read_page: Pointer to a dummy page used for mapping requests
371 * of unpopulated pages.
372 * @shrink: A shrink callback object used for buffre object swap.
373 * @ttm_bo_extra_size: Extra size (sizeof(struct ttm_buffer_object) excluded)
374 * used by a buffer object. This is excluding page arrays and backing pages.
375 * @ttm_bo_size: This is @ttm_bo_extra_size + sizeof(struct ttm_buffer_object).
376 * @man: An array of mem_type_managers.
377 * @addr_space_mm: Range manager for the device address space.
378 * lru_lock: Spinlock that protects the buffer+device lru lists and
379 * ddestroy lists.
380 * @nice_mode: Try nicely to wait for buffer idle when cleaning a manager.
381 * If a GPU lockup has been detected, this is forced to 0.
382 * @dev_mapping: A pointer to the struct address_space representing the
383 * device address space.
384 * @wq: Work queue structure for the delayed delete workqueue.
385 *
386 */
387
388struct ttm_bo_device {
389
390 /*
391 * Constant after bo device init / atomic.
392 */
393
394 struct ttm_mem_global *mem_glob;
395 struct ttm_bo_driver *driver;
396 struct page *dummy_read_page;
397 struct ttm_mem_shrink shrink;
398
399 size_t ttm_bo_extra_size;
400 size_t ttm_bo_size;
401
402 rwlock_t vm_lock;
403 /*
404 * Protected by the vm lock.
405 */
406 struct ttm_mem_type_manager man[TTM_NUM_MEM_TYPES];
407 struct rb_root addr_space_rb;
408 struct drm_mm addr_space_mm;
409
410 /*
411 * Might want to change this to one lock per manager.
412 */
413 spinlock_t lru_lock;
414 /*
415 * Protected by the lru lock.
416 */
417 struct list_head ddestroy;
418 struct list_head swap_lru;
419
420 /*
421 * Protected by load / firstopen / lastclose /unload sync.
422 */
423
424 bool nice_mode;
425 struct address_space *dev_mapping;
426
427 /*
428 * Internal protection.
429 */
430
431 struct delayed_work wq;
432};
433
434/**
435 * ttm_flag_masked
436 *
437 * @old: Pointer to the result and original value.
438 * @new: New value of bits.
439 * @mask: Mask of bits to change.
440 *
441 * Convenience function to change a number of bits identified by a mask.
442 */
443
444static inline uint32_t
445ttm_flag_masked(uint32_t *old, uint32_t new, uint32_t mask)
446{
447 *old ^= (*old ^ new) & mask;
448 return *old;
449}
450
451/**
452 * ttm_tt_create
453 *
454 * @bdev: pointer to a struct ttm_bo_device:
455 * @size: Size of the data needed backing.
456 * @page_flags: Page flags as identified by TTM_PAGE_FLAG_XX flags.
457 * @dummy_read_page: See struct ttm_bo_device.
458 *
459 * Create a struct ttm_tt to back data with system memory pages.
460 * No pages are actually allocated.
461 * Returns:
462 * NULL: Out of memory.
463 */
464extern struct ttm_tt *ttm_tt_create(struct ttm_bo_device *bdev,
465 unsigned long size,
466 uint32_t page_flags,
467 struct page *dummy_read_page);
468
469/**
470 * ttm_tt_set_user:
471 *
472 * @ttm: The struct ttm_tt to populate.
473 * @tsk: A struct task_struct for which @start is a valid user-space address.
474 * @start: A valid user-space address.
475 * @num_pages: Size in pages of the user memory area.
476 *
477 * Populate a struct ttm_tt with a user-space memory area after first pinning
478 * the pages backing it.
479 * Returns:
480 * !0: Error.
481 */
482
483extern int ttm_tt_set_user(struct ttm_tt *ttm,
484 struct task_struct *tsk,
485 unsigned long start, unsigned long num_pages);
486
487/**
488 * ttm_ttm_bind:
489 *
490 * @ttm: The struct ttm_tt containing backing pages.
491 * @bo_mem: The struct ttm_mem_reg identifying the binding location.
492 *
493 * Bind the pages of @ttm to an aperture location identified by @bo_mem
494 */
495extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem);
496
497/**
498 * ttm_ttm_destroy:
499 *
500 * @ttm: The struct ttm_tt.
501 *
502 * Unbind, unpopulate and destroy a struct ttm_tt.
503 */
504extern void ttm_tt_destroy(struct ttm_tt *ttm);
505
506/**
507 * ttm_ttm_unbind:
508 *
509 * @ttm: The struct ttm_tt.
510 *
511 * Unbind a struct ttm_tt.
512 */
513extern void ttm_tt_unbind(struct ttm_tt *ttm);
514
515/**
516 * ttm_ttm_destroy:
517 *
518 * @ttm: The struct ttm_tt.
519 * @index: Index of the desired page.
520 *
521 * Return a pointer to the struct page backing @ttm at page
522 * index @index. If the page is unpopulated, one will be allocated to
523 * populate that index.
524 *
525 * Returns:
526 * NULL on OOM.
527 */
528extern struct page *ttm_tt_get_page(struct ttm_tt *ttm, int index);
529
530/**
531 * ttm_tt_cache_flush:
532 *
533 * @pages: An array of pointers to struct page:s to flush.
534 * @num_pages: Number of pages to flush.
535 *
536 * Flush the data of the indicated pages from the cpu caches.
537 * This is used when changing caching attributes of the pages from
538 * cache-coherent.
539 */
540extern void ttm_tt_cache_flush(struct page *pages[], unsigned long num_pages);
541
542/**
543 * ttm_tt_set_placement_caching:
544 *
545 * @ttm A struct ttm_tt the backing pages of which will change caching policy.
546 * @placement: Flag indicating the desired caching policy.
547 *
548 * This function will change caching policy of any default kernel mappings of
549 * the pages backing @ttm. If changing from cached to uncached or
550 * write-combined,
551 * all CPU caches will first be flushed to make sure the data of the pages
552 * hit RAM. This function may be very costly as it involves global TLB
553 * and cache flushes and potential page splitting / combining.
554 */
555extern int ttm_tt_set_placement_caching(struct ttm_tt *ttm, uint32_t placement);
556extern int ttm_tt_swapout(struct ttm_tt *ttm,
557 struct file *persistant_swap_storage);
558
559/*
560 * ttm_bo.c
561 */
562
563/**
564 * ttm_mem_reg_is_pci
565 *
566 * @bdev: Pointer to a struct ttm_bo_device.
567 * @mem: A valid struct ttm_mem_reg.
568 *
569 * Returns true if the memory described by @mem is PCI memory,
570 * false otherwise.
571 */
572extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev,
573 struct ttm_mem_reg *mem);
574
575/**
576 * ttm_bo_mem_space
577 *
578 * @bo: Pointer to a struct ttm_buffer_object. the data of which
579 * we want to allocate space for.
580 * @proposed_placement: Proposed new placement for the buffer object.
581 * @mem: A struct ttm_mem_reg.
582 * @interruptible: Sleep interruptible when sliping.
583 * @no_wait: Don't sleep waiting for space to become available.
584 *
585 * Allocate memory space for the buffer object pointed to by @bo, using
586 * the placement flags in @mem, potentially evicting other idle buffer objects.
587 * This function may sleep while waiting for space to become available.
588 * Returns:
589 * -EBUSY: No space available (only if no_wait == 1).
590 * -ENOMEM: Could not allocate memory for the buffer object, either due to
591 * fragmentation or concurrent allocators.
592 * -ERESTART: An interruptible sleep was interrupted by a signal.
593 */
594extern int ttm_bo_mem_space(struct ttm_buffer_object *bo,
595 uint32_t proposed_placement,
596 struct ttm_mem_reg *mem,
597 bool interruptible, bool no_wait);
598/**
599 * ttm_bo_wait_for_cpu
600 *
601 * @bo: Pointer to a struct ttm_buffer_object.
602 * @no_wait: Don't sleep while waiting.
603 *
604 * Wait until a buffer object is no longer sync'ed for CPU access.
605 * Returns:
606 * -EBUSY: Buffer object was sync'ed for CPU access. (only if no_wait == 1).
607 * -ERESTART: An interruptible sleep was interrupted by a signal.
608 */
609
610extern int ttm_bo_wait_cpu(struct ttm_buffer_object *bo, bool no_wait);
611
612/**
613 * ttm_bo_pci_offset - Get the PCI offset for the buffer object memory.
614 *
615 * @bo Pointer to a struct ttm_buffer_object.
616 * @bus_base On return the base of the PCI region
617 * @bus_offset On return the byte offset into the PCI region
618 * @bus_size On return the byte size of the buffer object or zero if
619 * the buffer object memory is not accessible through a PCI region.
620 *
621 * Returns:
622 * -EINVAL if the buffer object is currently not mappable.
623 * 0 otherwise.
624 */
625
626extern int ttm_bo_pci_offset(struct ttm_bo_device *bdev,
627 struct ttm_mem_reg *mem,
628 unsigned long *bus_base,
629 unsigned long *bus_offset,
630 unsigned long *bus_size);
631
632extern int ttm_bo_device_release(struct ttm_bo_device *bdev);
633
634/**
635 * ttm_bo_device_init
636 *
637 * @bdev: A pointer to a struct ttm_bo_device to initialize.
638 * @mem_global: A pointer to an initialized struct ttm_mem_global.
639 * @driver: A pointer to a struct ttm_bo_driver set up by the caller.
640 * @file_page_offset: Offset into the device address space that is available
641 * for buffer data. This ensures compatibility with other users of the
642 * address space.
643 *
644 * Initializes a struct ttm_bo_device:
645 * Returns:
646 * !0: Failure.
647 */
648extern int ttm_bo_device_init(struct ttm_bo_device *bdev,
649 struct ttm_mem_global *mem_glob,
650 struct ttm_bo_driver *driver,
651 uint64_t file_page_offset);
652
653/**
654 * ttm_bo_reserve:
655 *
656 * @bo: A pointer to a struct ttm_buffer_object.
657 * @interruptible: Sleep interruptible if waiting.
658 * @no_wait: Don't sleep while trying to reserve, rather return -EBUSY.
659 * @use_sequence: If @bo is already reserved, Only sleep waiting for
660 * it to become unreserved if @sequence < (@bo)->sequence.
661 *
662 * Locks a buffer object for validation. (Or prevents other processes from
663 * locking it for validation) and removes it from lru lists, while taking
664 * a number of measures to prevent deadlocks.
665 *
666 * Deadlocks may occur when two processes try to reserve multiple buffers in
667 * different order, either by will or as a result of a buffer being evicted
668 * to make room for a buffer already reserved. (Buffers are reserved before
669 * they are evicted). The following algorithm prevents such deadlocks from
670 * occuring:
671 * 1) Buffers are reserved with the lru spinlock held. Upon successful
672 * reservation they are removed from the lru list. This stops a reserved buffer
673 * from being evicted. However the lru spinlock is released between the time
674 * a buffer is selected for eviction and the time it is reserved.
675 * Therefore a check is made when a buffer is reserved for eviction, that it
676 * is still the first buffer in the lru list, before it is removed from the
677 * list. @check_lru == 1 forces this check. If it fails, the function returns
678 * -EINVAL, and the caller should then choose a new buffer to evict and repeat
679 * the procedure.
680 * 2) Processes attempting to reserve multiple buffers other than for eviction,
681 * (typically execbuf), should first obtain a unique 32-bit
682 * validation sequence number,
683 * and call this function with @use_sequence == 1 and @sequence == the unique
684 * sequence number. If upon call of this function, the buffer object is already
685 * reserved, the validation sequence is checked against the validation
686 * sequence of the process currently reserving the buffer,
687 * and if the current validation sequence is greater than that of the process
688 * holding the reservation, the function returns -EAGAIN. Otherwise it sleeps
689 * waiting for the buffer to become unreserved, after which it retries
690 * reserving.
691 * The caller should, when receiving an -EAGAIN error
692 * release all its buffer reservations, wait for @bo to become unreserved, and
693 * then rerun the validation with the same validation sequence. This procedure
694 * will always guarantee that the process with the lowest validation sequence
695 * will eventually succeed, preventing both deadlocks and starvation.
696 *
697 * Returns:
698 * -EAGAIN: The reservation may cause a deadlock.
699 * Release all buffer reservations, wait for @bo to become unreserved and
700 * try again. (only if use_sequence == 1).
701 * -ERESTART: A wait for the buffer to become unreserved was interrupted by
702 * a signal. Release all buffer reservations and return to user-space.
703 */
704extern int ttm_bo_reserve(struct ttm_buffer_object *bo,
705 bool interruptible,
706 bool no_wait, bool use_sequence, uint32_t sequence);
707
708/**
709 * ttm_bo_unreserve
710 *
711 * @bo: A pointer to a struct ttm_buffer_object.
712 *
713 * Unreserve a previous reservation of @bo.
714 */
715extern void ttm_bo_unreserve(struct ttm_buffer_object *bo);
716
717/**
718 * ttm_bo_wait_unreserved
719 *
720 * @bo: A pointer to a struct ttm_buffer_object.
721 *
722 * Wait for a struct ttm_buffer_object to become unreserved.
723 * This is typically used in the execbuf code to relax cpu-usage when
724 * a potential deadlock condition backoff.
725 */
726extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
727 bool interruptible);
728
729/**
730 * ttm_bo_block_reservation
731 *
732 * @bo: A pointer to a struct ttm_buffer_object.
733 * @interruptible: Use interruptible sleep when waiting.
734 * @no_wait: Don't sleep, but rather return -EBUSY.
735 *
736 * Block reservation for validation by simply reserving the buffer.
737 * This is intended for single buffer use only without eviction,
738 * and thus needs no deadlock protection.
739 *
740 * Returns:
741 * -EBUSY: If no_wait == 1 and the buffer is already reserved.
742 * -ERESTART: If interruptible == 1 and the process received a signal
743 * while sleeping.
744 */
745extern int ttm_bo_block_reservation(struct ttm_buffer_object *bo,
746 bool interruptible, bool no_wait);
747
748/**
749 * ttm_bo_unblock_reservation
750 *
751 * @bo: A pointer to a struct ttm_buffer_object.
752 *
753 * Unblocks reservation leaving lru lists untouched.
754 */
755extern void ttm_bo_unblock_reservation(struct ttm_buffer_object *bo);
756
757/*
758 * ttm_bo_util.c
759 */
760
761/**
762 * ttm_bo_move_ttm
763 *
764 * @bo: A pointer to a struct ttm_buffer_object.
765 * @evict: 1: This is an eviction. Don't try to pipeline.
766 * @no_wait: Never sleep, but rather return with -EBUSY.
767 * @new_mem: struct ttm_mem_reg indicating where to move.
768 *
769 * Optimized move function for a buffer object with both old and
770 * new placement backed by a TTM. The function will, if successful,
771 * free any old aperture space, and set (@new_mem)->mm_node to NULL,
772 * and update the (@bo)->mem placement flags. If unsuccessful, the old
773 * data remains untouched, and it's up to the caller to free the
774 * memory space indicated by @new_mem.
775 * Returns:
776 * !0: Failure.
777 */
778
779extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
780 bool evict, bool no_wait,
781 struct ttm_mem_reg *new_mem);
782
783/**
784 * ttm_bo_move_memcpy
785 *
786 * @bo: A pointer to a struct ttm_buffer_object.
787 * @evict: 1: This is an eviction. Don't try to pipeline.
788 * @no_wait: Never sleep, but rather return with -EBUSY.
789 * @new_mem: struct ttm_mem_reg indicating where to move.
790 *
791 * Fallback move function for a mappable buffer object in mappable memory.
792 * The function will, if successful,
793 * free any old aperture space, and set (@new_mem)->mm_node to NULL,
794 * and update the (@bo)->mem placement flags. If unsuccessful, the old
795 * data remains untouched, and it's up to the caller to free the
796 * memory space indicated by @new_mem.
797 * Returns:
798 * !0: Failure.
799 */
800
801extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
802 bool evict,
803 bool no_wait, struct ttm_mem_reg *new_mem);
804
805/**
806 * ttm_bo_free_old_node
807 *
808 * @bo: A pointer to a struct ttm_buffer_object.
809 *
810 * Utility function to free an old placement after a successful move.
811 */
812extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
813
814/**
815 * ttm_bo_move_accel_cleanup.
816 *
817 * @bo: A pointer to a struct ttm_buffer_object.
818 * @sync_obj: A sync object that signals when moving is complete.
819 * @sync_obj_arg: An argument to pass to the sync object idle / wait
820 * functions.
821 * @evict: This is an evict move. Don't return until the buffer is idle.
822 * @no_wait: Never sleep, but rather return with -EBUSY.
823 * @new_mem: struct ttm_mem_reg indicating where to move.
824 *
825 * Accelerated move function to be called when an accelerated move
826 * has been scheduled. The function will create a new temporary buffer object
827 * representing the old placement, and put the sync object on both buffer
828 * objects. After that the newly created buffer object is unref'd to be
829 * destroyed when the move is complete. This will help pipeline
830 * buffer moves.
831 */
832
833extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
834 void *sync_obj,
835 void *sync_obj_arg,
836 bool evict, bool no_wait,
837 struct ttm_mem_reg *new_mem);
838/**
839 * ttm_io_prot
840 *
841 * @c_state: Caching state.
842 * @tmp: Page protection flag for a normal, cached mapping.
843 *
844 * Utility function that returns the pgprot_t that should be used for
845 * setting up a PTE with the caching model indicated by @c_state.
846 */
847extern pgprot_t ttm_io_prot(enum ttm_caching_state c_state, pgprot_t tmp);
848
849#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
850#define TTM_HAS_AGP
851#include <linux/agp_backend.h>
852
853/**
854 * ttm_agp_backend_init
855 *
856 * @bdev: Pointer to a struct ttm_bo_device.
857 * @bridge: The agp bridge this device is sitting on.
858 *
859 * Create a TTM backend that uses the indicated AGP bridge as an aperture
860 * for TT memory. This function uses the linux agpgart interface to
861 * bind and unbind memory backing a ttm_tt.
862 */
863extern struct ttm_backend *ttm_agp_backend_init(struct ttm_bo_device *bdev,
864 struct agp_bridge_data *bridge);
865#endif
866
867#endif
diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h
new file mode 100644
index 000000000000..d8b8f042c4f1
--- /dev/null
+++ b/include/drm/ttm/ttm_memory.h
@@ -0,0 +1,153 @@
1/**************************************************************************
2 *
3 * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28#ifndef TTM_MEMORY_H
29#define TTM_MEMORY_H
30
31#include <linux/workqueue.h>
32#include <linux/spinlock.h>
33#include <linux/wait.h>
34#include <linux/errno.h>
35
36/**
37 * struct ttm_mem_shrink - callback to shrink TTM memory usage.
38 *
39 * @do_shrink: The callback function.
40 *
41 * Arguments to the do_shrink functions are intended to be passed using
42 * inheritance. That is, the argument class derives from struct ttm_mem_srink,
43 * and can be accessed using container_of().
44 */
45
46struct ttm_mem_shrink {
47 int (*do_shrink) (struct ttm_mem_shrink *);
48};
49
50/**
51 * struct ttm_mem_global - Global memory accounting structure.
52 *
53 * @shrink: A single callback to shrink TTM memory usage. Extend this
54 * to a linked list to be able to handle multiple callbacks when needed.
55 * @swap_queue: A workqueue to handle shrinking in low memory situations. We
56 * need a separate workqueue since it will spend a lot of time waiting
57 * for the GPU, and this will otherwise block other workqueue tasks(?)
58 * At this point we use only a single-threaded workqueue.
59 * @work: The workqueue callback for the shrink queue.
60 * @queue: Wait queue for processes suspended waiting for memory.
61 * @lock: Lock to protect the @shrink - and the memory accounting members,
62 * that is, essentially the whole structure with some exceptions.
63 * @emer_memory: Lowmem memory limit available for root.
64 * @max_memory: Lowmem memory limit available for non-root.
65 * @swap_limit: Lowmem memory limit where the shrink workqueue kicks in.
66 * @used_memory: Currently used lowmem memory.
67 * @used_total_memory: Currently used total (lowmem + highmem) memory.
68 * @total_memory_swap_limit: Total memory limit where the shrink workqueue
69 * kicks in.
70 * @max_total_memory: Total memory available to non-root processes.
71 * @emer_total_memory: Total memory available to root processes.
72 *
73 * Note that this structure is not per device. It should be global for all
74 * graphics devices.
75 */
76
77struct ttm_mem_global {
78 struct ttm_mem_shrink *shrink;
79 struct workqueue_struct *swap_queue;
80 struct work_struct work;
81 wait_queue_head_t queue;
82 spinlock_t lock;
83 uint64_t emer_memory;
84 uint64_t max_memory;
85 uint64_t swap_limit;
86 uint64_t used_memory;
87 uint64_t used_total_memory;
88 uint64_t total_memory_swap_limit;
89 uint64_t max_total_memory;
90 uint64_t emer_total_memory;
91};
92
93/**
94 * ttm_mem_init_shrink - initialize a struct ttm_mem_shrink object
95 *
96 * @shrink: The object to initialize.
97 * @func: The callback function.
98 */
99
100static inline void ttm_mem_init_shrink(struct ttm_mem_shrink *shrink,
101 int (*func) (struct ttm_mem_shrink *))
102{
103 shrink->do_shrink = func;
104}
105
106/**
107 * ttm_mem_register_shrink - register a struct ttm_mem_shrink object.
108 *
109 * @glob: The struct ttm_mem_global object to register with.
110 * @shrink: An initialized struct ttm_mem_shrink object to register.
111 *
112 * Returns:
113 * -EBUSY: There's already a callback registered. (May change).
114 */
115
116static inline int ttm_mem_register_shrink(struct ttm_mem_global *glob,
117 struct ttm_mem_shrink *shrink)
118{
119 spin_lock(&glob->lock);
120 if (glob->shrink != NULL) {
121 spin_unlock(&glob->lock);
122 return -EBUSY;
123 }
124 glob->shrink = shrink;
125 spin_unlock(&glob->lock);
126 return 0;
127}
128
129/**
130 * ttm_mem_unregister_shrink - unregister a struct ttm_mem_shrink object.
131 *
132 * @glob: The struct ttm_mem_global object to unregister from.
133 * @shrink: A previously registert struct ttm_mem_shrink object.
134 *
135 */
136
137static inline void ttm_mem_unregister_shrink(struct ttm_mem_global *glob,
138 struct ttm_mem_shrink *shrink)
139{
140 spin_lock(&glob->lock);
141 BUG_ON(glob->shrink != shrink);
142 glob->shrink = NULL;
143 spin_unlock(&glob->lock);
144}
145
146extern int ttm_mem_global_init(struct ttm_mem_global *glob);
147extern void ttm_mem_global_release(struct ttm_mem_global *glob);
148extern int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory,
149 bool no_wait, bool interruptible, bool himem);
150extern void ttm_mem_global_free(struct ttm_mem_global *glob,
151 uint64_t amount, bool himem);
152extern size_t ttm_round_pot(size_t size);
153#endif
diff --git a/include/drm/ttm/ttm_module.h b/include/drm/ttm/ttm_module.h
new file mode 100644
index 000000000000..889a4c7958ae
--- /dev/null
+++ b/include/drm/ttm/ttm_module.h
@@ -0,0 +1,58 @@
1/**************************************************************************
2 *
3 * Copyright 2008-2009 VMware, Inc., Palo Alto, CA., USA
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27/*
28 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29 */
30
31#ifndef _TTM_MODULE_H_
32#define _TTM_MODULE_H_
33
34#include <linux/kernel.h>
35
36#define TTM_PFX "[TTM]"
37
38enum ttm_global_types {
39 TTM_GLOBAL_TTM_MEM = 0,
40 TTM_GLOBAL_TTM_BO,
41 TTM_GLOBAL_TTM_OBJECT,
42 TTM_GLOBAL_NUM
43};
44
45struct ttm_global_reference {
46 enum ttm_global_types global_type;
47 size_t size;
48 void *object;
49 int (*init) (struct ttm_global_reference *);
50 void (*release) (struct ttm_global_reference *);
51};
52
53extern void ttm_global_init(void);
54extern void ttm_global_release(void);
55extern int ttm_global_item_ref(struct ttm_global_reference *ref);
56extern void ttm_global_item_unref(struct ttm_global_reference *ref);
57
58#endif /* _TTM_MODULE_H_ */
diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h
new file mode 100644
index 000000000000..c84ff153a564
--- /dev/null
+++ b/include/drm/ttm/ttm_placement.h
@@ -0,0 +1,92 @@
1/**************************************************************************
2 *
3 * Copyright (c) 2006-2009 VMware, Inc., Palo Alto, CA., USA
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27/*
28 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29 */
30
31#ifndef _TTM_PLACEMENT_H_
32#define _TTM_PLACEMENT_H_
33/*
34 * Memory regions for data placement.
35 */
36
37#define TTM_PL_SYSTEM 0
38#define TTM_PL_TT 1
39#define TTM_PL_VRAM 2
40#define TTM_PL_PRIV0 3
41#define TTM_PL_PRIV1 4
42#define TTM_PL_PRIV2 5
43#define TTM_PL_PRIV3 6
44#define TTM_PL_PRIV4 7
45#define TTM_PL_PRIV5 8
46#define TTM_PL_SWAPPED 15
47
48#define TTM_PL_FLAG_SYSTEM (1 << TTM_PL_SYSTEM)
49#define TTM_PL_FLAG_TT (1 << TTM_PL_TT)
50#define TTM_PL_FLAG_VRAM (1 << TTM_PL_VRAM)
51#define TTM_PL_FLAG_PRIV0 (1 << TTM_PL_PRIV0)
52#define TTM_PL_FLAG_PRIV1 (1 << TTM_PL_PRIV1)
53#define TTM_PL_FLAG_PRIV2 (1 << TTM_PL_PRIV2)
54#define TTM_PL_FLAG_PRIV3 (1 << TTM_PL_PRIV3)
55#define TTM_PL_FLAG_PRIV4 (1 << TTM_PL_PRIV4)
56#define TTM_PL_FLAG_PRIV5 (1 << TTM_PL_PRIV5)
57#define TTM_PL_FLAG_SWAPPED (1 << TTM_PL_SWAPPED)
58#define TTM_PL_MASK_MEM 0x0000FFFF
59
60/*
61 * Other flags that affects data placement.
62 * TTM_PL_FLAG_CACHED indicates cache-coherent mappings
63 * if available.
64 * TTM_PL_FLAG_SHARED means that another application may
65 * reference the buffer.
66 * TTM_PL_FLAG_NO_EVICT means that the buffer may never
67 * be evicted to make room for other buffers.
68 */
69
70#define TTM_PL_FLAG_CACHED (1 << 16)
71#define TTM_PL_FLAG_UNCACHED (1 << 17)
72#define TTM_PL_FLAG_WC (1 << 18)
73#define TTM_PL_FLAG_SHARED (1 << 20)
74#define TTM_PL_FLAG_NO_EVICT (1 << 21)
75
76#define TTM_PL_MASK_CACHING (TTM_PL_FLAG_CACHED | \
77 TTM_PL_FLAG_UNCACHED | \
78 TTM_PL_FLAG_WC)
79
80#define TTM_PL_MASK_MEMTYPE (TTM_PL_MASK_MEM | TTM_PL_MASK_CACHING)
81
82/*
83 * Access flags to be used for CPU- and GPU- mappings.
84 * The idea is that the TTM synchronization mechanism will
85 * allow concurrent READ access and exclusive write access.
86 * Currently GPU- and CPU accesses are exclusive.
87 */
88
89#define TTM_ACCESS_READ (1 << 0)
90#define TTM_ACCESS_WRITE (1 << 1)
91
92#endif
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 3f0eaa397ef5..03f22076381f 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -135,6 +135,7 @@ header-y += posix_types.h
135header-y += ppdev.h 135header-y += ppdev.h
136header-y += prctl.h 136header-y += prctl.h
137header-y += qnxtypes.h 137header-y += qnxtypes.h
138header-y += qnx4_fs.h
138header-y += radeonfb.h 139header-y += radeonfb.h
139header-y += raw.h 140header-y += raw.h
140header-y += resource.h 141header-y += resource.h
@@ -307,10 +308,11 @@ unifdef-y += pmu.h
307unifdef-y += poll.h 308unifdef-y += poll.h
308unifdef-y += ppp_defs.h 309unifdef-y += ppp_defs.h
309unifdef-y += ppp-comp.h 310unifdef-y += ppp-comp.h
311unifdef-y += pps.h
310unifdef-y += ptrace.h 312unifdef-y += ptrace.h
311unifdef-y += qnx4_fs.h
312unifdef-y += quota.h 313unifdef-y += quota.h
313unifdef-y += random.h 314unifdef-y += random.h
315unifdef-y += rfkill.h
314unifdef-y += irqnr.h 316unifdef-y += irqnr.h
315unifdef-y += reboot.h 317unifdef-y += reboot.h
316unifdef-y += reiserfs_fs.h 318unifdef-y += reiserfs_fs.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index bf17681cb06f..34321cfffeab 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -116,7 +116,7 @@ extern u32 acpi_irq_not_handled;
116extern int sbf_port; 116extern int sbf_port;
117extern unsigned long acpi_realmode_flags; 117extern unsigned long acpi_realmode_flags;
118 118
119int acpi_register_gsi (u32 gsi, int triggering, int polarity); 119int acpi_register_gsi (struct device *dev, u32 gsi, int triggering, int polarity);
120int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); 120int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
121 121
122#ifdef CONFIG_X86_IO_APIC 122#ifdef CONFIG_X86_IO_APIC
diff --git a/include/linux/adfs_fs.h b/include/linux/adfs_fs.h
index ef788c2085a1..b19801f73890 100644
--- a/include/linux/adfs_fs.h
+++ b/include/linux/adfs_fs.h
@@ -41,8 +41,6 @@ struct adfs_discrecord {
41#define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3) 41#define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3)
42 42
43#ifdef __KERNEL__ 43#ifdef __KERNEL__
44#include <linux/adfs_fs_i.h>
45#include <linux/adfs_fs_sb.h>
46/* 44/*
47 * Calculate the boot block checksum on an ADFS drive. Note that this will 45 * Calculate the boot block checksum on an ADFS drive. Note that this will
48 * appear to be correct if the sector contains all zeros, so also check that 46 * appear to be correct if the sector contains all zeros, so also check that
@@ -60,17 +58,6 @@ static inline int adfs_checkbblk(unsigned char *ptr)
60 58
61 return (result & 0xff) != ptr[511]; 59 return (result & 0xff) != ptr[511];
62} 60}
63
64static inline struct adfs_sb_info *ADFS_SB(struct super_block *sb)
65{
66 return sb->s_fs_info;
67}
68
69static inline struct adfs_inode_info *ADFS_I(struct inode *inode)
70{
71 return container_of(inode, struct adfs_inode_info, vfs_inode);
72}
73
74#endif 61#endif
75 62
76#endif 63#endif
diff --git a/include/linux/adfs_fs_i.h b/include/linux/adfs_fs_i.h
deleted file mode 100644
index cb543034e54f..000000000000
--- a/include/linux/adfs_fs_i.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * linux/include/linux/adfs_fs_i.h
3 *
4 * Copyright (C) 1997 Russell King
5 */
6
7#ifndef _ADFS_FS_I
8#define _ADFS_FS_I
9
10/*
11 * adfs file system inode data in memory
12 */
13struct adfs_inode_info {
14 loff_t mmu_private;
15 unsigned long parent_id; /* object id of parent */
16 __u32 loadaddr; /* RISC OS load address */
17 __u32 execaddr; /* RISC OS exec address */
18 unsigned int filetype; /* RISC OS file type */
19 unsigned int attr; /* RISC OS permissions */
20 unsigned int stamped:1; /* RISC OS file has date/time */
21 struct inode vfs_inode;
22};
23
24#endif
diff --git a/include/linux/adfs_fs_sb.h b/include/linux/adfs_fs_sb.h
deleted file mode 100644
index d9bf05c02ccc..000000000000
--- a/include/linux/adfs_fs_sb.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * linux/include/linux/adfs_fs_sb.h
3 *
4 * Copyright (C) 1997-1999 Russell King
5 */
6
7#ifndef _ADFS_FS_SB
8#define _ADFS_FS_SB
9
10/*
11 * Forward-declare this
12 */
13struct adfs_discmap;
14struct adfs_dir_ops;
15
16/*
17 * ADFS file system superblock data in memory
18 */
19struct adfs_sb_info {
20 struct adfs_discmap *s_map; /* bh list containing map */
21 struct adfs_dir_ops *s_dir; /* directory operations */
22
23 uid_t s_uid; /* owner uid */
24 gid_t s_gid; /* owner gid */
25 umode_t s_owner_mask; /* ADFS owner perm -> unix perm */
26 umode_t s_other_mask; /* ADFS other perm -> unix perm */
27
28 __u32 s_ids_per_zone; /* max. no ids in one zone */
29 __u32 s_idlen; /* length of ID in map */
30 __u32 s_map_size; /* sector size of a map */
31 unsigned long s_size; /* total size (in blocks) of this fs */
32 signed int s_map2blk; /* shift left by this for map->sector */
33 unsigned int s_log2sharesize;/* log2 share size */
34 __le32 s_version; /* disc format version */
35 unsigned int s_namelen; /* maximum number of characters in name */
36};
37
38#endif
diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h
index 2b8df8b420fd..76fa794fdac0 100644
--- a/include/linux/agp_backend.h
+++ b/include/linux/agp_backend.h
@@ -70,7 +70,7 @@ struct agp_memory {
70 struct agp_memory *next; 70 struct agp_memory *next;
71 struct agp_memory *prev; 71 struct agp_memory *prev;
72 struct agp_bridge_data *bridge; 72 struct agp_bridge_data *bridge;
73 unsigned long *memory; 73 struct page **pages;
74 size_t page_count; 74 size_t page_count;
75 int key; 75 int key;
76 int num_scratch_pages; 76 int num_scratch_pages;
diff --git a/include/linux/amba/pl022.h b/include/linux/amba/pl022.h
new file mode 100644
index 000000000000..dcad0ffd1755
--- /dev/null
+++ b/include/linux/amba/pl022.h
@@ -0,0 +1,264 @@
1/*
2 * include/linux/amba/pl022.h
3 *
4 * Copyright (C) 2008-2009 ST-Ericsson AB
5 * Copyright (C) 2006 STMicroelectronics Pvt. Ltd.
6 *
7 * Author: Linus Walleij <linus.walleij@stericsson.com>
8 *
9 * Initial version inspired by:
10 * linux-2.6.17-rc3-mm1/drivers/spi/pxa2xx_spi.c
11 * Initial adoption to PL022 by:
12 * Sachin Verma <sachin.verma@st.com>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 */
24
25#ifndef _SSP_PL022_H
26#define _SSP_PL022_H
27
28#include <linux/device.h>
29
30/**
31 * whether SSP is in loopback mode or not
32 */
33enum ssp_loopback {
34 LOOPBACK_DISABLED,
35 LOOPBACK_ENABLED
36};
37
38/**
39 * enum ssp_interface - interfaces allowed for this SSP Controller
40 * @SSP_INTERFACE_MOTOROLA_SPI: Motorola Interface
41 * @SSP_INTERFACE_TI_SYNC_SERIAL: Texas Instrument Synchronous Serial
42 * interface
43 * @SSP_INTERFACE_NATIONAL_MICROWIRE: National Semiconductor Microwire
44 * interface
45 * @SSP_INTERFACE_UNIDIRECTIONAL: Unidirectional interface (STn8810
46 * &STn8815 only)
47 */
48enum ssp_interface {
49 SSP_INTERFACE_MOTOROLA_SPI,
50 SSP_INTERFACE_TI_SYNC_SERIAL,
51 SSP_INTERFACE_NATIONAL_MICROWIRE,
52 SSP_INTERFACE_UNIDIRECTIONAL
53};
54
55/**
56 * enum ssp_hierarchy - whether SSP is configured as Master or Slave
57 */
58enum ssp_hierarchy {
59 SSP_MASTER,
60 SSP_SLAVE
61};
62
63/**
64 * enum ssp_clock_params - clock parameters, to set SSP clock at a
65 * desired freq
66 */
67struct ssp_clock_params {
68 u8 cpsdvsr; /* value from 2 to 254 (even only!) */
69 u8 scr; /* value from 0 to 255 */
70};
71
72/**
73 * enum ssp_rx_endian - endianess of Rx FIFO Data
74 */
75enum ssp_rx_endian {
76 SSP_RX_MSB,
77 SSP_RX_LSB
78};
79
80/**
81 * enum ssp_tx_endian - endianess of Tx FIFO Data
82 */
83enum ssp_tx_endian {
84 SSP_TX_MSB,
85 SSP_TX_LSB
86};
87
88/**
89 * enum ssp_data_size - number of bits in one data element
90 */
91enum ssp_data_size {
92 SSP_DATA_BITS_4 = 0x03, SSP_DATA_BITS_5, SSP_DATA_BITS_6,
93 SSP_DATA_BITS_7, SSP_DATA_BITS_8, SSP_DATA_BITS_9,
94 SSP_DATA_BITS_10, SSP_DATA_BITS_11, SSP_DATA_BITS_12,
95 SSP_DATA_BITS_13, SSP_DATA_BITS_14, SSP_DATA_BITS_15,
96 SSP_DATA_BITS_16, SSP_DATA_BITS_17, SSP_DATA_BITS_18,
97 SSP_DATA_BITS_19, SSP_DATA_BITS_20, SSP_DATA_BITS_21,
98 SSP_DATA_BITS_22, SSP_DATA_BITS_23, SSP_DATA_BITS_24,
99 SSP_DATA_BITS_25, SSP_DATA_BITS_26, SSP_DATA_BITS_27,
100 SSP_DATA_BITS_28, SSP_DATA_BITS_29, SSP_DATA_BITS_30,
101 SSP_DATA_BITS_31, SSP_DATA_BITS_32
102};
103
104/**
105 * enum ssp_mode - SSP mode of operation (Communication modes)
106 */
107enum ssp_mode {
108 INTERRUPT_TRANSFER,
109 POLLING_TRANSFER,
110 DMA_TRANSFER
111};
112
113/**
114 * enum ssp_rx_level_trig - receive FIFO watermark level which triggers
115 * IT: Interrupt fires when _N_ or more elements in RX FIFO.
116 */
117enum ssp_rx_level_trig {
118 SSP_RX_1_OR_MORE_ELEM,
119 SSP_RX_4_OR_MORE_ELEM,
120 SSP_RX_8_OR_MORE_ELEM,
121 SSP_RX_16_OR_MORE_ELEM,
122 SSP_RX_32_OR_MORE_ELEM
123};
124
125/**
126 * Transmit FIFO watermark level which triggers (IT Interrupt fires
127 * when _N_ or more empty locations in TX FIFO)
128 */
129enum ssp_tx_level_trig {
130 SSP_TX_1_OR_MORE_EMPTY_LOC,
131 SSP_TX_4_OR_MORE_EMPTY_LOC,
132 SSP_TX_8_OR_MORE_EMPTY_LOC,
133 SSP_TX_16_OR_MORE_EMPTY_LOC,
134 SSP_TX_32_OR_MORE_EMPTY_LOC
135};
136
137/**
138 * enum SPI Clock Phase - clock phase (Motorola SPI interface only)
139 * @SSP_CLK_RISING_EDGE: Receive data on rising edge
140 * @SSP_CLK_FALLING_EDGE: Receive data on falling edge
141 */
142enum ssp_spi_clk_phase {
143 SSP_CLK_RISING_EDGE,
144 SSP_CLK_FALLING_EDGE
145};
146
147/**
148 * enum SPI Clock Polarity - clock polarity (Motorola SPI interface only)
149 * @SSP_CLK_POL_IDLE_LOW: Low inactive level
150 * @SSP_CLK_POL_IDLE_HIGH: High inactive level
151 */
152enum ssp_spi_clk_pol {
153 SSP_CLK_POL_IDLE_LOW,
154 SSP_CLK_POL_IDLE_HIGH
155};
156
157/**
158 * Microwire Conrol Lengths Command size in microwire format
159 */
160enum ssp_microwire_ctrl_len {
161 SSP_BITS_4 = 0x03, SSP_BITS_5, SSP_BITS_6,
162 SSP_BITS_7, SSP_BITS_8, SSP_BITS_9,
163 SSP_BITS_10, SSP_BITS_11, SSP_BITS_12,
164 SSP_BITS_13, SSP_BITS_14, SSP_BITS_15,
165 SSP_BITS_16, SSP_BITS_17, SSP_BITS_18,
166 SSP_BITS_19, SSP_BITS_20, SSP_BITS_21,
167 SSP_BITS_22, SSP_BITS_23, SSP_BITS_24,
168 SSP_BITS_25, SSP_BITS_26, SSP_BITS_27,
169 SSP_BITS_28, SSP_BITS_29, SSP_BITS_30,
170 SSP_BITS_31, SSP_BITS_32
171};
172
173/**
174 * enum Microwire Wait State
175 * @SSP_MWIRE_WAIT_ZERO: No wait state inserted after last command bit
176 * @SSP_MWIRE_WAIT_ONE: One wait state inserted after last command bit
177 */
178enum ssp_microwire_wait_state {
179 SSP_MWIRE_WAIT_ZERO,
180 SSP_MWIRE_WAIT_ONE
181};
182
183/**
184 * enum Microwire - whether Full/Half Duplex
185 * @SSP_MICROWIRE_CHANNEL_FULL_DUPLEX: SSPTXD becomes bi-directional,
186 * SSPRXD not used
187 * @SSP_MICROWIRE_CHANNEL_HALF_DUPLEX: SSPTXD is an output, SSPRXD is
188 * an input.
189 */
190enum ssp_duplex {
191 SSP_MICROWIRE_CHANNEL_FULL_DUPLEX,
192 SSP_MICROWIRE_CHANNEL_HALF_DUPLEX
193};
194
195/**
196 * CHIP select/deselect commands
197 */
198enum ssp_chip_select {
199 SSP_CHIP_SELECT,
200 SSP_CHIP_DESELECT
201};
202
203
204/**
205 * struct pl022_ssp_master - device.platform_data for SPI controller devices.
206 * @num_chipselect: chipselects are used to distinguish individual
207 * SPI slaves, and are numbered from zero to num_chipselects - 1.
208 * each slave has a chipselect signal, but it's common that not
209 * every chipselect is connected to a slave.
210 * @enable_dma: if true enables DMA driven transfers.
211 */
212struct pl022_ssp_controller {
213 u16 bus_id;
214 u8 num_chipselect;
215 u8 enable_dma:1;
216};
217
218/**
219 * struct ssp_config_chip - spi_board_info.controller_data for SPI
220 * slave devices, copied to spi_device.controller_data.
221 *
222 * @lbm: used for test purpose to internally connect RX and TX
223 * @iface: Interface type(Motorola, TI, Microwire, Universal)
224 * @hierarchy: sets whether interface is master or slave
225 * @slave_tx_disable: SSPTXD is disconnected (in slave mode only)
226 * @clk_freq: Tune freq parameters of SSP(when in master mode)
227 * @endian_rx: Endianess of Data in Rx FIFO
228 * @endian_tx: Endianess of Data in Tx FIFO
229 * @data_size: Width of data element(4 to 32 bits)
230 * @com_mode: communication mode: polling, Interrupt or DMA
231 * @rx_lev_trig: Rx FIFO watermark level (for IT & DMA mode)
232 * @tx_lev_trig: Tx FIFO watermark level (for IT & DMA mode)
233 * @clk_phase: Motorola SPI interface Clock phase
234 * @clk_pol: Motorola SPI interface Clock polarity
235 * @ctrl_len: Microwire interface: Control length
236 * @wait_state: Microwire interface: Wait state
237 * @duplex: Microwire interface: Full/Half duplex
238 * @cs_control: function pointer to board-specific function to
239 * assert/deassert I/O port to control HW generation of devices chip-select.
240 * @dma_xfer_type: Type of DMA xfer (Mem-to-periph or Periph-to-Periph)
241 * @dma_config: DMA configuration for SSP controller and peripheral
242 */
243struct pl022_config_chip {
244 struct device *dev;
245 enum ssp_loopback lbm;
246 enum ssp_interface iface;
247 enum ssp_hierarchy hierarchy;
248 bool slave_tx_disable;
249 struct ssp_clock_params clk_freq;
250 enum ssp_rx_endian endian_rx;
251 enum ssp_tx_endian endian_tx;
252 enum ssp_data_size data_size;
253 enum ssp_mode com_mode;
254 enum ssp_rx_level_trig rx_lev_trig;
255 enum ssp_tx_level_trig tx_lev_trig;
256 enum ssp_spi_clk_phase clk_phase;
257 enum ssp_spi_clk_pol clk_pol;
258 enum ssp_microwire_ctrl_len ctrl_len;
259 enum ssp_microwire_wait_state wait_state;
260 enum ssp_duplex duplex;
261 void (*cs_control) (u32 control);
262};
263
264#endif /* _SSP_PL022_H */
diff --git a/include/linux/amba/pl061.h b/include/linux/amba/pl061.h
new file mode 100644
index 000000000000..b4fbd9862606
--- /dev/null
+++ b/include/linux/amba/pl061.h
@@ -0,0 +1,15 @@
1/* platform data for the PL061 GPIO driver */
2
3struct pl061_platform_data {
4 /* number of the first GPIO */
5 unsigned gpio_base;
6
7 /* number of the first IRQ.
8 * If the IRQ functionality in not desired this must be set to
9 * (unsigned) -1.
10 */
11 unsigned irq_base;
12
13 u8 directions; /* startup directions, 1: out, 0: in */
14 u8 values; /* startup values */
15};
diff --git a/include/linux/amba/serial.h b/include/linux/amba/serial.h
index 64a982ea5d5f..5a5a7fd62490 100644
--- a/include/linux/amba/serial.h
+++ b/include/linux/amba/serial.h
@@ -114,6 +114,9 @@
114#define UART011_IFLS_TX4_8 (2 << 0) 114#define UART011_IFLS_TX4_8 (2 << 0)
115#define UART011_IFLS_TX6_8 (3 << 0) 115#define UART011_IFLS_TX6_8 (3 << 0)
116#define UART011_IFLS_TX7_8 (4 << 0) 116#define UART011_IFLS_TX7_8 (4 << 0)
117/* special values for ST vendor with deeper fifo */
118#define UART011_IFLS_RX_HALF (5 << 3)
119#define UART011_IFLS_TX_HALF (5 << 0)
117 120
118#define UART011_OEIM (1 << 10) /* overrun error interrupt mask */ 121#define UART011_OEIM (1 << 10) /* overrun error interrupt mask */
119#define UART011_BEIM (1 << 9) /* break error interrupt mask */ 122#define UART011_BEIM (1 << 9) /* break error interrupt mask */
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 915da43edee1..9c75921f0c16 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -800,6 +800,20 @@ static inline int ata_id_is_ssd(const u16 *id)
800 return id[ATA_ID_ROT_SPEED] == 0x01; 800 return id[ATA_ID_ROT_SPEED] == 0x01;
801} 801}
802 802
803static inline int ata_id_pio_need_iordy(const u16 *id, const u8 pio)
804{
805 /* CF spec. r4.1 Table 22 says no IORDY on PIO5 and PIO6. */
806 if (pio > 4 && ata_id_is_cfa(id))
807 return 0;
808 /* For PIO3 and higher it is mandatory. */
809 if (pio > 2)
810 return 1;
811 /* Turn it on when possible. */
812 if (ata_id_has_iordy(id))
813 return 1;
814 return 0;
815}
816
803static inline int ata_drive_40wire(const u16 *dev_id) 817static inline int ata_drive_40wire(const u16 *dev_id)
804{ 818{
805 if (ata_id_is_sata(dev_id)) 819 if (ata_id_is_sata(dev_id))
diff --git a/include/linux/atmel-mci.h b/include/linux/atmel-mci.h
index 2f1f95737acb..57b1846a3c87 100644
--- a/include/linux/atmel-mci.h
+++ b/include/linux/atmel-mci.h
@@ -10,6 +10,7 @@
10 * @bus_width: Number of data lines wired up the slot 10 * @bus_width: Number of data lines wired up the slot
11 * @detect_pin: GPIO pin wired to the card detect switch 11 * @detect_pin: GPIO pin wired to the card detect switch
12 * @wp_pin: GPIO pin wired to the write protect sensor 12 * @wp_pin: GPIO pin wired to the write protect sensor
13 * @detect_is_active_high: The state of the detect pin when it is active
13 * 14 *
14 * If a given slot is not present on the board, @bus_width should be 15 * If a given slot is not present on the board, @bus_width should be
15 * set to 0. The other fields are ignored in this case. 16 * set to 0. The other fields are ignored in this case.
@@ -24,6 +25,7 @@ struct mci_slot_pdata {
24 unsigned int bus_width; 25 unsigned int bus_width;
25 int detect_pin; 26 int detect_pin;
26 int wp_pin; 27 int wp_pin;
28 bool detect_is_active_high;
27}; 29};
28 30
29/** 31/**
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 7b214fd672a2..2a04eb54c0dd 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -218,12 +218,12 @@ struct bio {
218#define bio_sectors(bio) ((bio)->bi_size >> 9) 218#define bio_sectors(bio) ((bio)->bi_size >> 9)
219#define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio) && !bio_discard(bio)) 219#define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio) && !bio_discard(bio))
220 220
221static inline unsigned int bio_cur_sectors(struct bio *bio) 221static inline unsigned int bio_cur_bytes(struct bio *bio)
222{ 222{
223 if (bio->bi_vcnt) 223 if (bio->bi_vcnt)
224 return bio_iovec(bio)->bv_len >> 9; 224 return bio_iovec(bio)->bv_len;
225 else /* dataless requests such as discard */ 225 else /* dataless requests such as discard */
226 return bio->bi_size >> 9; 226 return bio->bi_size;
227} 227}
228 228
229static inline void *bio_data(struct bio *bio) 229static inline void *bio_data(struct bio *bio)
@@ -279,7 +279,7 @@ static inline int bio_has_allocated_vec(struct bio *bio)
279#define __BIO_SEG_BOUNDARY(addr1, addr2, mask) \ 279#define __BIO_SEG_BOUNDARY(addr1, addr2, mask) \
280 (((addr1) | (mask)) == (((addr2) - 1) | (mask))) 280 (((addr1) | (mask)) == (((addr2) - 1) | (mask)))
281#define BIOVEC_SEG_BOUNDARY(q, b1, b2) \ 281#define BIOVEC_SEG_BOUNDARY(q, b1, b2) \
282 __BIO_SEG_BOUNDARY(bvec_to_phys((b1)), bvec_to_phys((b2)) + (b2)->bv_len, (q)->seg_boundary_mask) 282 __BIO_SEG_BOUNDARY(bvec_to_phys((b1)), bvec_to_phys((b2)) + (b2)->bv_len, queue_segment_boundary((q)))
283#define BIO_SEG_BOUNDARY(q, b1, b2) \ 283#define BIO_SEG_BOUNDARY(q, b1, b2) \
284 BIOVEC_SEG_BOUNDARY((q), __BVEC_END((b1)), __BVEC_START((b2))) 284 BIOVEC_SEG_BOUNDARY((q), __BVEC_END((b1)), __BVEC_START((b2)))
285 285
@@ -506,7 +506,7 @@ static inline int bio_has_data(struct bio *bio)
506} 506}
507 507
508/* 508/*
509 * BIO list managment for use by remapping drivers (e.g. DM or MD). 509 * BIO list management for use by remapping drivers (e.g. DM or MD) and loop.
510 * 510 *
511 * A bio_list anchors a singly-linked list of bios chained through the bi_next 511 * A bio_list anchors a singly-linked list of bios chained through the bi_next
512 * member of the bio. The bio_list also caches the last list member to allow 512 * member of the bio. The bio_list also caches the last list member to allow
@@ -590,6 +590,11 @@ static inline void bio_list_merge_head(struct bio_list *bl,
590 bl->head = bl2->head; 590 bl->head = bl2->head;
591} 591}
592 592
593static inline struct bio *bio_list_peek(struct bio_list *bl)
594{
595 return bl->head;
596}
597
593static inline struct bio *bio_list_pop(struct bio_list *bl) 598static inline struct bio *bio_list_pop(struct bio_list *bl)
594{ 599{
595 struct bio *bio = bl->head; 600 struct bio *bio = bl->head;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index b4f71f1a4af7..8963d9149b5f 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -166,19 +166,9 @@ struct request {
166 enum rq_cmd_type_bits cmd_type; 166 enum rq_cmd_type_bits cmd_type;
167 unsigned long atomic_flags; 167 unsigned long atomic_flags;
168 168
169 /* Maintain bio traversal state for part by part I/O submission. 169 /* the following two fields are internal, NEVER access directly */
170 * hard_* are block layer internals, no driver should touch them! 170 sector_t __sector; /* sector cursor */
171 */ 171 unsigned int __data_len; /* total data len */
172
173 sector_t sector; /* next sector to submit */
174 sector_t hard_sector; /* next sector to complete */
175 unsigned long nr_sectors; /* no. of sectors left to submit */
176 unsigned long hard_nr_sectors; /* no. of sectors left to complete */
177 /* no. of sectors left to submit in the current segment */
178 unsigned int current_nr_sectors;
179
180 /* no. of sectors left to complete in the current segment */
181 unsigned int hard_cur_sectors;
182 172
183 struct bio *bio; 173 struct bio *bio;
184 struct bio *biotail; 174 struct bio *biotail;
@@ -211,8 +201,8 @@ struct request {
211 201
212 unsigned short ioprio; 202 unsigned short ioprio;
213 203
214 void *special; 204 void *special; /* opaque pointer available for LLD use */
215 char *buffer; 205 char *buffer; /* kaddr of the current segment if available */
216 206
217 int tag; 207 int tag;
218 int errors; 208 int errors;
@@ -226,10 +216,9 @@ struct request {
226 unsigned char __cmd[BLK_MAX_CDB]; 216 unsigned char __cmd[BLK_MAX_CDB];
227 unsigned char *cmd; 217 unsigned char *cmd;
228 218
229 unsigned int data_len;
230 unsigned int extra_len; /* length of alignment and padding */ 219 unsigned int extra_len; /* length of alignment and padding */
231 unsigned int sense_len; 220 unsigned int sense_len;
232 void *data; 221 unsigned int resid_len; /* residual count */
233 void *sense; 222 void *sense;
234 223
235 unsigned long deadline; 224 unsigned long deadline;
@@ -318,6 +307,26 @@ struct blk_cmd_filter {
318 struct kobject kobj; 307 struct kobject kobj;
319}; 308};
320 309
310struct queue_limits {
311 unsigned long bounce_pfn;
312 unsigned long seg_boundary_mask;
313
314 unsigned int max_hw_sectors;
315 unsigned int max_sectors;
316 unsigned int max_segment_size;
317 unsigned int physical_block_size;
318 unsigned int alignment_offset;
319 unsigned int io_min;
320 unsigned int io_opt;
321
322 unsigned short logical_block_size;
323 unsigned short max_hw_segments;
324 unsigned short max_phys_segments;
325
326 unsigned char misaligned;
327 unsigned char no_cluster;
328};
329
321struct request_queue 330struct request_queue
322{ 331{
323 /* 332 /*
@@ -369,7 +378,6 @@ struct request_queue
369 /* 378 /*
370 * queue needs bounce pages for pages above this limit 379 * queue needs bounce pages for pages above this limit
371 */ 380 */
372 unsigned long bounce_pfn;
373 gfp_t bounce_gfp; 381 gfp_t bounce_gfp;
374 382
375 /* 383 /*
@@ -398,14 +406,6 @@ struct request_queue
398 unsigned int nr_congestion_off; 406 unsigned int nr_congestion_off;
399 unsigned int nr_batching; 407 unsigned int nr_batching;
400 408
401 unsigned int max_sectors;
402 unsigned int max_hw_sectors;
403 unsigned short max_phys_segments;
404 unsigned short max_hw_segments;
405 unsigned short hardsect_size;
406 unsigned int max_segment_size;
407
408 unsigned long seg_boundary_mask;
409 void *dma_drain_buffer; 409 void *dma_drain_buffer;
410 unsigned int dma_drain_size; 410 unsigned int dma_drain_size;
411 unsigned int dma_pad_mask; 411 unsigned int dma_pad_mask;
@@ -415,12 +415,14 @@ struct request_queue
415 struct list_head tag_busy_list; 415 struct list_head tag_busy_list;
416 416
417 unsigned int nr_sorted; 417 unsigned int nr_sorted;
418 unsigned int in_flight; 418 unsigned int in_flight[2];
419 419
420 unsigned int rq_timeout; 420 unsigned int rq_timeout;
421 struct timer_list timeout; 421 struct timer_list timeout;
422 struct list_head timeout_list; 422 struct list_head timeout_list;
423 423
424 struct queue_limits limits;
425
424 /* 426 /*
425 * sg stuff 427 * sg stuff
426 */ 428 */
@@ -522,6 +524,11 @@ static inline void queue_flag_clear_unlocked(unsigned int flag,
522 __clear_bit(flag, &q->queue_flags); 524 __clear_bit(flag, &q->queue_flags);
523} 525}
524 526
527static inline int queue_in_flight(struct request_queue *q)
528{
529 return q->in_flight[0] + q->in_flight[1];
530}
531
525static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) 532static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
526{ 533{
527 WARN_ON_ONCE(!queue_is_locked(q)); 534 WARN_ON_ONCE(!queue_is_locked(q));
@@ -752,10 +759,17 @@ extern void blk_rq_init(struct request_queue *q, struct request *rq);
752extern void blk_put_request(struct request *); 759extern void blk_put_request(struct request *);
753extern void __blk_put_request(struct request_queue *, struct request *); 760extern void __blk_put_request(struct request_queue *, struct request *);
754extern struct request *blk_get_request(struct request_queue *, int, gfp_t); 761extern struct request *blk_get_request(struct request_queue *, int, gfp_t);
762extern struct request *blk_make_request(struct request_queue *, struct bio *,
763 gfp_t);
755extern void blk_insert_request(struct request_queue *, struct request *, int, void *); 764extern void blk_insert_request(struct request_queue *, struct request *, int, void *);
756extern void blk_requeue_request(struct request_queue *, struct request *); 765extern void blk_requeue_request(struct request_queue *, struct request *);
757extern int blk_rq_check_limits(struct request_queue *q, struct request *rq); 766extern int blk_rq_check_limits(struct request_queue *q, struct request *rq);
758extern int blk_lld_busy(struct request_queue *q); 767extern int blk_lld_busy(struct request_queue *q);
768extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
769 struct bio_set *bs, gfp_t gfp_mask,
770 int (*bio_ctr)(struct bio *, struct bio *, void *),
771 void *data);
772extern void blk_rq_unprep_clone(struct request *rq);
759extern int blk_insert_cloned_request(struct request_queue *q, 773extern int blk_insert_cloned_request(struct request_queue *q,
760 struct request *rq); 774 struct request *rq);
761extern void blk_plug_device(struct request_queue *); 775extern void blk_plug_device(struct request_queue *);
@@ -768,12 +782,6 @@ extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t,
768 struct scsi_ioctl_command __user *); 782 struct scsi_ioctl_command __user *);
769 783
770/* 784/*
771 * Temporary export, until SCSI gets fixed up.
772 */
773extern int blk_rq_append_bio(struct request_queue *q, struct request *rq,
774 struct bio *bio);
775
776/*
777 * A queue has just exitted congestion. Note this in the global counter of 785 * A queue has just exitted congestion. Note this in the global counter of
778 * congested queues, and wake up anyone who was waiting for requests to be 786 * congested queues, and wake up anyone who was waiting for requests to be
779 * put back. 787 * put back.
@@ -798,7 +806,6 @@ extern void blk_sync_queue(struct request_queue *q);
798extern void __blk_stop_queue(struct request_queue *q); 806extern void __blk_stop_queue(struct request_queue *q);
799extern void __blk_run_queue(struct request_queue *); 807extern void __blk_run_queue(struct request_queue *);
800extern void blk_run_queue(struct request_queue *); 808extern void blk_run_queue(struct request_queue *);
801extern void blk_start_queueing(struct request_queue *);
802extern int blk_rq_map_user(struct request_queue *, struct request *, 809extern int blk_rq_map_user(struct request_queue *, struct request *,
803 struct rq_map_data *, void __user *, unsigned long, 810 struct rq_map_data *, void __user *, unsigned long,
804 gfp_t); 811 gfp_t);
@@ -831,41 +838,73 @@ static inline void blk_run_address_space(struct address_space *mapping)
831 blk_run_backing_dev(mapping->backing_dev_info, NULL); 838 blk_run_backing_dev(mapping->backing_dev_info, NULL);
832} 839}
833 840
834extern void blkdev_dequeue_request(struct request *req); 841/*
842 * blk_rq_pos() : the current sector
843 * blk_rq_bytes() : bytes left in the entire request
844 * blk_rq_cur_bytes() : bytes left in the current segment
845 * blk_rq_sectors() : sectors left in the entire request
846 * blk_rq_cur_sectors() : sectors left in the current segment
847 */
848static inline sector_t blk_rq_pos(const struct request *rq)
849{
850 return rq->__sector;
851}
852
853static inline unsigned int blk_rq_bytes(const struct request *rq)
854{
855 return rq->__data_len;
856}
857
858static inline int blk_rq_cur_bytes(const struct request *rq)
859{
860 return rq->bio ? bio_cur_bytes(rq->bio) : 0;
861}
862
863static inline unsigned int blk_rq_sectors(const struct request *rq)
864{
865 return blk_rq_bytes(rq) >> 9;
866}
867
868static inline unsigned int blk_rq_cur_sectors(const struct request *rq)
869{
870 return blk_rq_cur_bytes(rq) >> 9;
871}
872
873/*
874 * Request issue related functions.
875 */
876extern struct request *blk_peek_request(struct request_queue *q);
877extern void blk_start_request(struct request *rq);
878extern struct request *blk_fetch_request(struct request_queue *q);
835 879
836/* 880/*
837 * blk_end_request() and friends. 881 * Request completion related functions.
838 * __blk_end_request() and end_request() must be called with 882 *
839 * the request queue spinlock acquired. 883 * blk_update_request() completes given number of bytes and updates
884 * the request without completing it.
885 *
886 * blk_end_request() and friends. __blk_end_request() must be called
887 * with the request queue spinlock acquired.
840 * 888 *
841 * Several drivers define their own end_request and call 889 * Several drivers define their own end_request and call
842 * blk_end_request() for parts of the original function. 890 * blk_end_request() for parts of the original function.
843 * This prevents code duplication in drivers. 891 * This prevents code duplication in drivers.
844 */ 892 */
845extern int blk_end_request(struct request *rq, int error, 893extern bool blk_update_request(struct request *rq, int error,
846 unsigned int nr_bytes); 894 unsigned int nr_bytes);
847extern int __blk_end_request(struct request *rq, int error, 895extern bool blk_end_request(struct request *rq, int error,
848 unsigned int nr_bytes); 896 unsigned int nr_bytes);
849extern int blk_end_bidi_request(struct request *rq, int error, 897extern void blk_end_request_all(struct request *rq, int error);
850 unsigned int nr_bytes, unsigned int bidi_bytes); 898extern bool blk_end_request_cur(struct request *rq, int error);
851extern void end_request(struct request *, int); 899extern bool __blk_end_request(struct request *rq, int error,
852extern int blk_end_request_callback(struct request *rq, int error, 900 unsigned int nr_bytes);
853 unsigned int nr_bytes, 901extern void __blk_end_request_all(struct request *rq, int error);
854 int (drv_callback)(struct request *)); 902extern bool __blk_end_request_cur(struct request *rq, int error);
903
855extern void blk_complete_request(struct request *); 904extern void blk_complete_request(struct request *);
856extern void __blk_complete_request(struct request *); 905extern void __blk_complete_request(struct request *);
857extern void blk_abort_request(struct request *); 906extern void blk_abort_request(struct request *);
858extern void blk_abort_queue(struct request_queue *); 907extern void blk_abort_queue(struct request_queue *);
859extern void blk_update_request(struct request *rq, int error,
860 unsigned int nr_bytes);
861
862/*
863 * blk_end_request() takes bytes instead of sectors as a complete size.
864 * blk_rq_bytes() returns bytes left to complete in the entire request.
865 * blk_rq_cur_bytes() returns bytes left to complete in the current segment.
866 */
867extern unsigned int blk_rq_bytes(struct request *rq);
868extern unsigned int blk_rq_cur_bytes(struct request *rq);
869 908
870/* 909/*
871 * Access functions for manipulating queue properties 910 * Access functions for manipulating queue properties
@@ -877,10 +916,21 @@ extern void blk_cleanup_queue(struct request_queue *);
877extern void blk_queue_make_request(struct request_queue *, make_request_fn *); 916extern void blk_queue_make_request(struct request_queue *, make_request_fn *);
878extern void blk_queue_bounce_limit(struct request_queue *, u64); 917extern void blk_queue_bounce_limit(struct request_queue *, u64);
879extern void blk_queue_max_sectors(struct request_queue *, unsigned int); 918extern void blk_queue_max_sectors(struct request_queue *, unsigned int);
919extern void blk_queue_max_hw_sectors(struct request_queue *, unsigned int);
880extern void blk_queue_max_phys_segments(struct request_queue *, unsigned short); 920extern void blk_queue_max_phys_segments(struct request_queue *, unsigned short);
881extern void blk_queue_max_hw_segments(struct request_queue *, unsigned short); 921extern void blk_queue_max_hw_segments(struct request_queue *, unsigned short);
882extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); 922extern void blk_queue_max_segment_size(struct request_queue *, unsigned int);
883extern void blk_queue_hardsect_size(struct request_queue *, unsigned short); 923extern void blk_queue_logical_block_size(struct request_queue *, unsigned short);
924extern void blk_queue_physical_block_size(struct request_queue *, unsigned short);
925extern void blk_queue_alignment_offset(struct request_queue *q,
926 unsigned int alignment);
927extern void blk_queue_io_min(struct request_queue *q, unsigned int min);
928extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt);
929extern void blk_set_default_limits(struct queue_limits *lim);
930extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
931 sector_t offset);
932extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
933 sector_t offset);
884extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); 934extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b);
885extern void blk_queue_dma_pad(struct request_queue *, unsigned int); 935extern void blk_queue_dma_pad(struct request_queue *, unsigned int);
886extern void blk_queue_update_dma_pad(struct request_queue *, unsigned int); 936extern void blk_queue_update_dma_pad(struct request_queue *, unsigned int);
@@ -967,19 +1017,87 @@ extern void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter);
967 1017
968#define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist) 1018#define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist)
969 1019
970static inline int queue_hardsect_size(struct request_queue *q) 1020static inline unsigned long queue_bounce_pfn(struct request_queue *q)
1021{
1022 return q->limits.bounce_pfn;
1023}
1024
1025static inline unsigned long queue_segment_boundary(struct request_queue *q)
1026{
1027 return q->limits.seg_boundary_mask;
1028}
1029
1030static inline unsigned int queue_max_sectors(struct request_queue *q)
1031{
1032 return q->limits.max_sectors;
1033}
1034
1035static inline unsigned int queue_max_hw_sectors(struct request_queue *q)
1036{
1037 return q->limits.max_hw_sectors;
1038}
1039
1040static inline unsigned short queue_max_hw_segments(struct request_queue *q)
1041{
1042 return q->limits.max_hw_segments;
1043}
1044
1045static inline unsigned short queue_max_phys_segments(struct request_queue *q)
1046{
1047 return q->limits.max_phys_segments;
1048}
1049
1050static inline unsigned int queue_max_segment_size(struct request_queue *q)
1051{
1052 return q->limits.max_segment_size;
1053}
1054
1055static inline unsigned short queue_logical_block_size(struct request_queue *q)
971{ 1056{
972 int retval = 512; 1057 int retval = 512;
973 1058
974 if (q && q->hardsect_size) 1059 if (q && q->limits.logical_block_size)
975 retval = q->hardsect_size; 1060 retval = q->limits.logical_block_size;
976 1061
977 return retval; 1062 return retval;
978} 1063}
979 1064
980static inline int bdev_hardsect_size(struct block_device *bdev) 1065static inline unsigned short bdev_logical_block_size(struct block_device *bdev)
1066{
1067 return queue_logical_block_size(bdev_get_queue(bdev));
1068}
1069
1070static inline unsigned int queue_physical_block_size(struct request_queue *q)
1071{
1072 return q->limits.physical_block_size;
1073}
1074
1075static inline unsigned int queue_io_min(struct request_queue *q)
1076{
1077 return q->limits.io_min;
1078}
1079
1080static inline unsigned int queue_io_opt(struct request_queue *q)
1081{
1082 return q->limits.io_opt;
1083}
1084
1085static inline int queue_alignment_offset(struct request_queue *q)
1086{
1087 if (q && q->limits.misaligned)
1088 return -1;
1089
1090 if (q && q->limits.alignment_offset)
1091 return q->limits.alignment_offset;
1092
1093 return 0;
1094}
1095
1096static inline int queue_sector_alignment_offset(struct request_queue *q,
1097 sector_t sector)
981{ 1098{
982 return queue_hardsect_size(bdev_get_queue(bdev)); 1099 return ((sector << 9) - q->limits.alignment_offset)
1100 & (q->limits.io_min - 1);
983} 1101}
984 1102
985static inline int queue_dma_alignment(struct request_queue *q) 1103static inline int queue_dma_alignment(struct request_queue *q)
@@ -1109,6 +1227,8 @@ struct block_device_operations {
1109 int (*direct_access) (struct block_device *, sector_t, 1227 int (*direct_access) (struct block_device *, sector_t,
1110 void **, unsigned long *); 1228 void **, unsigned long *);
1111 int (*media_changed) (struct gendisk *); 1229 int (*media_changed) (struct gendisk *);
1230 unsigned long long (*set_capacity) (struct gendisk *,
1231 unsigned long long);
1112 int (*revalidate_disk) (struct gendisk *); 1232 int (*revalidate_disk) (struct gendisk *);
1113 int (*getgeo)(struct block_device *, struct hd_geometry *); 1233 int (*getgeo)(struct block_device *, struct hd_geometry *);
1114 struct module *owner; 1234 struct module *owner;
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index d960889e92ef..7e4350ece0f8 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -116,9 +116,9 @@ struct blk_io_trace {
116 * The remap event 116 * The remap event
117 */ 117 */
118struct blk_io_trace_remap { 118struct blk_io_trace_remap {
119 __be32 device;
120 __be32 device_from; 119 __be32 device_from;
121 __be64 sector; 120 __be32 device_to;
121 __be64 sector_from;
122}; 122};
123 123
124enum { 124enum {
@@ -165,8 +165,9 @@ struct blk_trace {
165 165
166extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *); 166extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *);
167extern void blk_trace_shutdown(struct request_queue *); 167extern void blk_trace_shutdown(struct request_queue *);
168extern int do_blk_trace_setup(struct request_queue *q, 168extern int do_blk_trace_setup(struct request_queue *q, char *name,
169 char *name, dev_t dev, struct blk_user_trace_setup *buts); 169 dev_t dev, struct block_device *bdev,
170 struct blk_user_trace_setup *buts);
170extern void __trace_note_message(struct blk_trace *, const char *fmt, ...); 171extern void __trace_note_message(struct blk_trace *, const char *fmt, ...);
171 172
172/** 173/**
@@ -193,22 +194,42 @@ extern void __trace_note_message(struct blk_trace *, const char *fmt, ...);
193extern void blk_add_driver_data(struct request_queue *q, struct request *rq, 194extern void blk_add_driver_data(struct request_queue *q, struct request *rq,
194 void *data, size_t len); 195 void *data, size_t len);
195extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev, 196extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
197 struct block_device *bdev,
196 char __user *arg); 198 char __user *arg);
197extern int blk_trace_startstop(struct request_queue *q, int start); 199extern int blk_trace_startstop(struct request_queue *q, int start);
198extern int blk_trace_remove(struct request_queue *q); 200extern int blk_trace_remove(struct request_queue *q);
201extern int blk_trace_init_sysfs(struct device *dev);
199 202
200extern struct attribute_group blk_trace_attr_group; 203extern struct attribute_group blk_trace_attr_group;
201 204
202#else /* !CONFIG_BLK_DEV_IO_TRACE */ 205#else /* !CONFIG_BLK_DEV_IO_TRACE */
203#define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY) 206# define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY)
204#define blk_trace_shutdown(q) do { } while (0) 207# define blk_trace_shutdown(q) do { } while (0)
205#define do_blk_trace_setup(q, name, dev, buts) (-ENOTTY) 208# define do_blk_trace_setup(q, name, dev, bdev, buts) (-ENOTTY)
206#define blk_add_driver_data(q, rq, data, len) do {} while (0) 209# define blk_add_driver_data(q, rq, data, len) do {} while (0)
207#define blk_trace_setup(q, name, dev, arg) (-ENOTTY) 210# define blk_trace_setup(q, name, dev, bdev, arg) (-ENOTTY)
208#define blk_trace_startstop(q, start) (-ENOTTY) 211# define blk_trace_startstop(q, start) (-ENOTTY)
209#define blk_trace_remove(q) (-ENOTTY) 212# define blk_trace_remove(q) (-ENOTTY)
210#define blk_add_trace_msg(q, fmt, ...) do { } while (0) 213# define blk_add_trace_msg(q, fmt, ...) do { } while (0)
214static inline int blk_trace_init_sysfs(struct device *dev)
215{
216 return 0;
217}
211 218
212#endif /* CONFIG_BLK_DEV_IO_TRACE */ 219#endif /* CONFIG_BLK_DEV_IO_TRACE */
220
221#if defined(CONFIG_EVENT_TRACING) && defined(CONFIG_BLOCK)
222
223static inline int blk_cmd_buf_len(struct request *rq)
224{
225 return blk_pc_request(rq) ? rq->cmd_len * 3 : 1;
226}
227
228extern void blk_dump_cmd(char *buf, struct request *rq);
229extern void blk_fill_rwbs(char *rwbs, u32 rw, int bytes);
230extern void blk_fill_rwbs_rq(char *rwbs, struct request *rq);
231
232#endif /* CONFIG_EVENT_TRACING && CONFIG_BLOCK */
233
213#endif /* __KERNEL__ */ 234#endif /* __KERNEL__ */
214#endif 235#endif
diff --git a/include/linux/bug.h b/include/linux/bug.h
index 54398d2c6d8d..d276b5510c83 100644
--- a/include/linux/bug.h
+++ b/include/linux/bug.h
@@ -1,7 +1,6 @@
1#ifndef _LINUX_BUG_H 1#ifndef _LINUX_BUG_H
2#define _LINUX_BUG_H 2#define _LINUX_BUG_H
3 3
4#include <linux/module.h>
5#include <asm/bug.h> 4#include <asm/bug.h>
6 5
7enum bug_trap_type { 6enum bug_trap_type {
@@ -24,10 +23,6 @@ const struct bug_entry *find_bug(unsigned long bugaddr);
24 23
25enum bug_trap_type report_bug(unsigned long bug_addr, struct pt_regs *regs); 24enum bug_trap_type report_bug(unsigned long bug_addr, struct pt_regs *regs);
26 25
27int module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *,
28 struct module *);
29void module_bug_cleanup(struct module *);
30
31/* These are defined by the architecture */ 26/* These are defined by the architecture */
32int is_valid_bugaddr(unsigned long addr); 27int is_valid_bugaddr(unsigned long addr);
33 28
@@ -38,13 +33,6 @@ static inline enum bug_trap_type report_bug(unsigned long bug_addr,
38{ 33{
39 return BUG_TRAP_TYPE_BUG; 34 return BUG_TRAP_TYPE_BUG;
40} 35}
41static inline int module_bug_finalize(const Elf_Ehdr *hdr,
42 const Elf_Shdr *sechdrs,
43 struct module *mod)
44{
45 return 0;
46}
47static inline void module_bug_cleanup(struct module *mod) {}
48 36
49#endif /* CONFIG_GENERIC_BUG */ 37#endif /* CONFIG_GENERIC_BUG */
50#endif /* _LINUX_BUG_H */ 38#endif /* _LINUX_BUG_H */
diff --git a/include/linux/c2port.h b/include/linux/c2port.h
index 7b5a2388ba67..2a5cd867c365 100644
--- a/include/linux/c2port.h
+++ b/include/linux/c2port.h
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/kmemcheck.h>
13 14
14#define C2PORT_NAME_LEN 32 15#define C2PORT_NAME_LEN 32
15 16
@@ -20,8 +21,10 @@
20/* Main struct */ 21/* Main struct */
21struct c2port_ops; 22struct c2port_ops;
22struct c2port_device { 23struct c2port_device {
24 kmemcheck_bitfield_begin(flags);
23 unsigned int access:1; 25 unsigned int access:1;
24 unsigned int flash_access:1; 26 unsigned int flash_access:1;
27 kmemcheck_bitfield_end(flags);
25 28
26 int id; 29 int id;
27 char name[C2PORT_NAME_LEN]; 30 char name[C2PORT_NAME_LEN];
diff --git a/include/linux/can/Kbuild b/include/linux/can/Kbuild
index eff898aac02b..8cb05aae661c 100644
--- a/include/linux/can/Kbuild
+++ b/include/linux/can/Kbuild
@@ -1,3 +1,4 @@
1header-y += raw.h 1header-y += raw.h
2header-y += bcm.h 2header-y += bcm.h
3header-y += error.h 3header-y += error.h
4header-y += netlink.h
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
new file mode 100644
index 000000000000..4a37a56f6cdd
--- /dev/null
+++ b/include/linux/can/dev.h
@@ -0,0 +1,70 @@
1/*
2 * linux/can/dev.h
3 *
4 * Definitions for the CAN network device driver interface
5 *
6 * Copyright (C) 2006 Andrey Volkov <avolkov@varma-el.com>
7 * Varma Electronics Oy
8 *
9 * Copyright (C) 2008 Wolfgang Grandegger <wg@grandegger.com>
10 *
11 * Send feedback to <socketcan-users@lists.berlios.de>
12 */
13
14#ifndef CAN_DEV_H
15#define CAN_DEV_H
16
17#include <linux/can/netlink.h>
18#include <linux/can/error.h>
19
20/*
21 * CAN mode
22 */
23enum can_mode {
24 CAN_MODE_STOP = 0,
25 CAN_MODE_START,
26 CAN_MODE_SLEEP
27};
28
29/*
30 * CAN common private data
31 */
32#define CAN_ECHO_SKB_MAX 4
33
34struct can_priv {
35 struct can_device_stats can_stats;
36
37 struct can_bittiming bittiming;
38 struct can_bittiming_const *bittiming_const;
39 struct can_clock clock;
40
41 enum can_state state;
42 u32 ctrlmode;
43
44 int restart_ms;
45 struct timer_list restart_timer;
46
47 struct sk_buff *echo_skb[CAN_ECHO_SKB_MAX];
48
49 int (*do_set_bittiming)(struct net_device *dev);
50 int (*do_set_mode)(struct net_device *dev, enum can_mode mode);
51 int (*do_get_state)(const struct net_device *dev,
52 enum can_state *state);
53};
54
55struct net_device *alloc_candev(int sizeof_priv);
56void free_candev(struct net_device *dev);
57
58int open_candev(struct net_device *dev);
59void close_candev(struct net_device *dev);
60
61int register_candev(struct net_device *dev);
62void unregister_candev(struct net_device *dev);
63
64int can_restart_now(struct net_device *dev);
65void can_bus_off(struct net_device *dev);
66
67void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, int idx);
68void can_get_echo_skb(struct net_device *dev, int idx);
69
70#endif /* CAN_DEV_H */
diff --git a/include/linux/can/netlink.h b/include/linux/can/netlink.h
new file mode 100644
index 000000000000..9ecbb7871c0e
--- /dev/null
+++ b/include/linux/can/netlink.h
@@ -0,0 +1,113 @@
1/*
2 * linux/can/netlink.h
3 *
4 * Definitions for the CAN netlink interface
5 *
6 * Copyright (c) 2009 Wolfgang Grandegger <wg@grandegger.com>
7 *
8 * Send feedback to <socketcan-users@lists.berlios.de>
9 *
10 */
11
12#ifndef CAN_NETLINK_H
13#define CAN_NETLINK_H
14
15#include <linux/types.h>
16
17/*
18 * CAN bit-timing parameters
19 *
20 * For futher information, please read chapter "8 BIT TIMING
21 * REQUIREMENTS" of the "Bosch CAN Specification version 2.0"
22 * at http://www.semiconductors.bosch.de/pdf/can2spec.pdf.
23 */
24struct can_bittiming {
25 __u32 bitrate; /* Bit-rate in bits/second */
26 __u32 sample_point; /* Sample point in one-tenth of a percent */
27 __u32 tq; /* Time quanta (TQ) in nanoseconds */
28 __u32 prop_seg; /* Propagation segment in TQs */
29 __u32 phase_seg1; /* Phase buffer segment 1 in TQs */
30 __u32 phase_seg2; /* Phase buffer segment 2 in TQs */
31 __u32 sjw; /* Synchronisation jump width in TQs */
32 __u32 brp; /* Bit-rate prescaler */
33};
34
35/*
36 * CAN harware-dependent bit-timing constant
37 *
38 * Used for calculating and checking bit-timing parameters
39 */
40struct can_bittiming_const {
41 char name[16]; /* Name of the CAN controller hardware */
42 __u32 tseg1_min; /* Time segement 1 = prop_seg + phase_seg1 */
43 __u32 tseg1_max;
44 __u32 tseg2_min; /* Time segement 2 = phase_seg2 */
45 __u32 tseg2_max;
46 __u32 sjw_max; /* Synchronisation jump width */
47 __u32 brp_min; /* Bit-rate prescaler */
48 __u32 brp_max;
49 __u32 brp_inc;
50};
51
52/*
53 * CAN clock parameters
54 */
55struct can_clock {
56 __u32 freq; /* CAN system clock frequency in Hz */
57};
58
59/*
60 * CAN operational and error states
61 */
62enum can_state {
63 CAN_STATE_ERROR_ACTIVE = 0, /* RX/TX error count < 96 */
64 CAN_STATE_ERROR_WARNING, /* RX/TX error count < 128 */
65 CAN_STATE_ERROR_PASSIVE, /* RX/TX error count < 256 */
66 CAN_STATE_BUS_OFF, /* RX/TX error count >= 256 */
67 CAN_STATE_STOPPED, /* Device is stopped */
68 CAN_STATE_SLEEPING, /* Device is sleeping */
69 CAN_STATE_MAX
70};
71
72/*
73 * CAN controller mode
74 */
75struct can_ctrlmode {
76 __u32 mask;
77 __u32 flags;
78};
79
80#define CAN_CTRLMODE_LOOPBACK 0x1 /* Loopback mode */
81#define CAN_CTRLMODE_LISTENONLY 0x2 /* Listen-only mode */
82#define CAN_CTRLMODE_3_SAMPLES 0x4 /* Triple sampling mode */
83
84/*
85 * CAN device statistics
86 */
87struct can_device_stats {
88 __u32 bus_error; /* Bus errors */
89 __u32 error_warning; /* Changes to error warning state */
90 __u32 error_passive; /* Changes to error passive state */
91 __u32 bus_off; /* Changes to bus off state */
92 __u32 arbitration_lost; /* Arbitration lost errors */
93 __u32 restarts; /* CAN controller re-starts */
94};
95
96/*
97 * CAN netlink interface
98 */
99enum {
100 IFLA_CAN_UNSPEC,
101 IFLA_CAN_BITTIMING,
102 IFLA_CAN_BITTIMING_CONST,
103 IFLA_CAN_CLOCK,
104 IFLA_CAN_STATE,
105 IFLA_CAN_CTRLMODE,
106 IFLA_CAN_RESTART_MS,
107 IFLA_CAN_RESTART,
108 __IFLA_CAN_MAX
109};
110
111#define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1)
112
113#endif /* CAN_NETLINK_H */
diff --git a/include/linux/can/platform/sja1000.h b/include/linux/can/platform/sja1000.h
new file mode 100644
index 000000000000..01ee2aeb048d
--- /dev/null
+++ b/include/linux/can/platform/sja1000.h
@@ -0,0 +1,35 @@
1#ifndef _CAN_PLATFORM_SJA1000_H_
2#define _CAN_PLATFORM_SJA1000_H_
3
4/* clock divider register */
5#define CDR_CLKOUT_MASK 0x07
6#define CDR_CLK_OFF 0x08 /* Clock off (CLKOUT pin) */
7#define CDR_RXINPEN 0x20 /* TX1 output is RX irq output */
8#define CDR_CBP 0x40 /* CAN input comparator bypass */
9#define CDR_PELICAN 0x80 /* PeliCAN mode */
10
11/* output control register */
12#define OCR_MODE_BIPHASE 0x00
13#define OCR_MODE_TEST 0x01
14#define OCR_MODE_NORMAL 0x02
15#define OCR_MODE_CLOCK 0x03
16#define OCR_MODE_MASK 0x07
17#define OCR_TX0_INVERT 0x04
18#define OCR_TX0_PULLDOWN 0x08
19#define OCR_TX0_PULLUP 0x10
20#define OCR_TX0_PUSHPULL 0x18
21#define OCR_TX1_INVERT 0x20
22#define OCR_TX1_PULLDOWN 0x40
23#define OCR_TX1_PULLUP 0x80
24#define OCR_TX1_PUSHPULL 0xc0
25#define OCR_TX_MASK 0xfc
26#define OCR_TX_SHIFT 2
27
28struct sja1000_platform_data {
29 u32 clock; /* CAN bus oscillator frequency in Hz */
30
31 u8 ocr; /* output control register */
32 u8 cdr; /* clock divider register */
33};
34
35#endif /* !_CAN_PLATFORM_SJA1000_H_ */
diff --git a/include/linux/cb710.h b/include/linux/cb710.h
new file mode 100644
index 000000000000..63bc9a4d2926
--- /dev/null
+++ b/include/linux/cb710.h
@@ -0,0 +1,231 @@
1/*
2 * cb710/cb710.h
3 *
4 * Copyright by Michał Mirosław, 2008-2009
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef LINUX_CB710_DRIVER_H
11#define LINUX_CB710_DRIVER_H
12
13#include <linux/io.h>
14#include <linux/interrupt.h>
15#include <linux/spinlock.h>
16#include <linux/pci.h>
17#include <linux/platform_device.h>
18#include <linux/mmc/host.h>
19
20struct cb710_slot;
21
22typedef int (*cb710_irq_handler_t)(struct cb710_slot *);
23
24/* per-virtual-slot structure */
25struct cb710_slot {
26 struct platform_device pdev;
27 void __iomem *iobase;
28 cb710_irq_handler_t irq_handler;
29};
30
31/* per-device structure */
32struct cb710_chip {
33 struct pci_dev *pdev;
34 void __iomem *iobase;
35 unsigned platform_id;
36#ifdef CONFIG_CB710_DEBUG_ASSUMPTIONS
37 atomic_t slot_refs_count;
38#endif
39 unsigned slot_mask;
40 unsigned slots;
41 spinlock_t irq_lock;
42 struct cb710_slot slot[0];
43};
44
45/* NOTE: cb710_chip.slots is modified only during device init/exit and
46 * they are all serialized wrt themselves */
47
48/* cb710_chip.slot_mask values */
49#define CB710_SLOT_MMC 1
50#define CB710_SLOT_MS 2
51#define CB710_SLOT_SM 4
52
53/* slot port accessors - so the logic is more clear in the code */
54#define CB710_PORT_ACCESSORS(t) \
55static inline void cb710_write_port_##t(struct cb710_slot *slot, \
56 unsigned port, u##t value) \
57{ \
58 iowrite##t(value, slot->iobase + port); \
59} \
60 \
61static inline u##t cb710_read_port_##t(struct cb710_slot *slot, \
62 unsigned port) \
63{ \
64 return ioread##t(slot->iobase + port); \
65} \
66 \
67static inline void cb710_modify_port_##t(struct cb710_slot *slot, \
68 unsigned port, u##t set, u##t clear) \
69{ \
70 iowrite##t( \
71 (ioread##t(slot->iobase + port) & ~clear)|set, \
72 slot->iobase + port); \
73}
74
75CB710_PORT_ACCESSORS(8)
76CB710_PORT_ACCESSORS(16)
77CB710_PORT_ACCESSORS(32)
78
79void cb710_pci_update_config_reg(struct pci_dev *pdev,
80 int reg, uint32_t and, uint32_t xor);
81void cb710_set_irq_handler(struct cb710_slot *slot,
82 cb710_irq_handler_t handler);
83
84/* some device struct walking */
85
86static inline struct cb710_slot *cb710_pdev_to_slot(
87 struct platform_device *pdev)
88{
89 return container_of(pdev, struct cb710_slot, pdev);
90}
91
92static inline struct cb710_chip *cb710_slot_to_chip(struct cb710_slot *slot)
93{
94 return dev_get_drvdata(slot->pdev.dev.parent);
95}
96
97static inline struct device *cb710_slot_dev(struct cb710_slot *slot)
98{
99 return &slot->pdev.dev;
100}
101
102static inline struct device *cb710_chip_dev(struct cb710_chip *chip)
103{
104 return &chip->pdev->dev;
105}
106
107/* debugging aids */
108
109#ifdef CONFIG_CB710_DEBUG
110void cb710_dump_regs(struct cb710_chip *chip, unsigned dump);
111#else
112#define cb710_dump_regs(c, d) do {} while (0)
113#endif
114
115#define CB710_DUMP_REGS_MMC 0x0F
116#define CB710_DUMP_REGS_MS 0x30
117#define CB710_DUMP_REGS_SM 0xC0
118#define CB710_DUMP_REGS_ALL 0xFF
119#define CB710_DUMP_REGS_MASK 0xFF
120
121#define CB710_DUMP_ACCESS_8 0x100
122#define CB710_DUMP_ACCESS_16 0x200
123#define CB710_DUMP_ACCESS_32 0x400
124#define CB710_DUMP_ACCESS_ALL 0x700
125#define CB710_DUMP_ACCESS_MASK 0x700
126
127#endif /* LINUX_CB710_DRIVER_H */
128/*
129 * cb710/sgbuf2.h
130 *
131 * Copyright by Michał Mirosław, 2008-2009
132 *
133 * This program is free software; you can redistribute it and/or modify
134 * it under the terms of the GNU General Public License version 2 as
135 * published by the Free Software Foundation.
136 */
137#ifndef LINUX_CB710_SG_H
138#define LINUX_CB710_SG_H
139
140#include <linux/highmem.h>
141#include <linux/scatterlist.h>
142
143/**
144 * cb710_sg_miter_stop_writing - stop mapping iteration after writing
145 * @miter: sg mapping iter to be stopped
146 *
147 * Description:
148 * Stops mapping iterator @miter. @miter should have been started
149 * started using sg_miter_start(). A stopped iteration can be
150 * resumed by calling sg_miter_next() on it. This is useful when
151 * resources (kmap) need to be released during iteration.
152 *
153 * This is a convenience wrapper that will be optimized out for arches
154 * that don't need flush_kernel_dcache_page().
155 *
156 * Context:
157 * IRQ disabled if the SG_MITER_ATOMIC is set. Don't care otherwise.
158 */
159static inline void cb710_sg_miter_stop_writing(struct sg_mapping_iter *miter)
160{
161 if (miter->page)
162 flush_kernel_dcache_page(miter->page);
163 sg_miter_stop(miter);
164}
165
166/*
167 * 32-bit PIO mapping sg iterator
168 *
169 * Hides scatterlist access issues - fragment boundaries, alignment, page
170 * mapping - for drivers using 32-bit-word-at-a-time-PIO (ie. PCI devices
171 * without DMA support).
172 *
173 * Best-case reading (transfer from device):
174 * sg_miter_start();
175 * cb710_sg_dwiter_write_from_io();
176 * cb710_sg_miter_stop_writing();
177 *
178 * Best-case writing (transfer to device):
179 * sg_miter_start();
180 * cb710_sg_dwiter_read_to_io();
181 * sg_miter_stop();
182 */
183
184uint32_t cb710_sg_dwiter_read_next_block(struct sg_mapping_iter *miter);
185void cb710_sg_dwiter_write_next_block(struct sg_mapping_iter *miter, uint32_t data);
186
187/**
188 * cb710_sg_dwiter_write_from_io - transfer data to mapped buffer from 32-bit IO port
189 * @miter: sg mapping iter
190 * @port: PIO port - IO or MMIO address
191 * @count: number of 32-bit words to transfer
192 *
193 * Description:
194 * Reads @count 32-bit words from register @port and stores it in
195 * buffer iterated by @miter. Data that would overflow the buffer
196 * is silently ignored. Iterator is advanced by 4*@count bytes
197 * or to the buffer's end whichever is closer.
198 *
199 * Context:
200 * IRQ disabled if the SG_MITER_ATOMIC is set. Don't care otherwise.
201 */
202static inline void cb710_sg_dwiter_write_from_io(struct sg_mapping_iter *miter,
203 void __iomem *port, size_t count)
204{
205 while (count-- > 0)
206 cb710_sg_dwiter_write_next_block(miter, ioread32(port));
207}
208
209/**
210 * cb710_sg_dwiter_read_to_io - transfer data to 32-bit IO port from mapped buffer
211 * @miter: sg mapping iter
212 * @port: PIO port - IO or MMIO address
213 * @count: number of 32-bit words to transfer
214 *
215 * Description:
216 * Writes @count 32-bit words to register @port from buffer iterated
217 * through @miter. If buffer ends before @count words are written
218 * missing data is replaced by zeroes. @miter is advanced by 4*@count
219 * bytes or to the buffer's end whichever is closer.
220 *
221 * Context:
222 * IRQ disabled if the SG_MITER_ATOMIC is set. Don't care otherwise.
223 */
224static inline void cb710_sg_dwiter_read_to_io(struct sg_mapping_iter *miter,
225 void __iomem *port, size_t count)
226{
227 while (count-- > 0)
228 iowrite32(cb710_sg_dwiter_read_next_block(miter), port);
229}
230
231#endif /* LINUX_CB710_SG_H */
diff --git a/include/linux/cdev.h b/include/linux/cdev.h
index fb4591977b03..f389e319a454 100644
--- a/include/linux/cdev.h
+++ b/include/linux/cdev.h
@@ -28,6 +28,8 @@ int cdev_add(struct cdev *, dev_t, unsigned);
28 28
29void cdev_del(struct cdev *); 29void cdev_del(struct cdev *);
30 30
31int cdev_index(struct inode *inode);
32
31void cd_forget(struct inode *); 33void cd_forget(struct inode *);
32 34
33extern struct backing_dev_info directly_mappable_cdev_bdi; 35extern struct backing_dev_info directly_mappable_cdev_bdi;
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 1db9bbf444a3..1d37f42ac294 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -142,4 +142,17 @@ struct clk *clk_get_parent(struct clk *clk);
142 */ 142 */
143struct clk *clk_get_sys(const char *dev_id, const char *con_id); 143struct clk *clk_get_sys(const char *dev_id, const char *con_id);
144 144
145/**
146 * clk_add_alias - add a new clock alias
147 * @alias: name for clock alias
148 * @alias_dev_name: device name
149 * @id: platform specific clock name
150 * @dev: device
151 *
152 * Allows using generic clock names for drivers by adding a new alias.
153 * Assumes clkdev, see clkdev.h for more info.
154 */
155int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
156 struct device *dev);
157
145#endif 158#endif
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 3a1dbba4d3ae..20a100fe2b4f 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -143,3 +143,12 @@ extern void clockevents_notify(unsigned long reason, void *arg);
143#endif 143#endif
144 144
145#endif 145#endif
146
147#ifdef CONFIG_GENERIC_CLOCKEVENTS
148extern ktime_t clockevents_get_next_event(int cpu);
149#else
150static inline ktime_t clockevents_get_next_event(int cpu)
151{
152 return (ktime_t) { .tv64 = KTIME_MAX };
153}
154#endif
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 5a40d14daa9f..c56457c8334e 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -288,7 +288,15 @@ static inline cycle_t clocksource_read(struct clocksource *cs)
288 */ 288 */
289static inline int clocksource_enable(struct clocksource *cs) 289static inline int clocksource_enable(struct clocksource *cs)
290{ 290{
291 return cs->enable ? cs->enable(cs) : 0; 291 int ret = 0;
292
293 if (cs->enable)
294 ret = cs->enable(cs);
295
296 /* save mult_orig on enable */
297 cs->mult_orig = cs->mult;
298
299 return ret;
292} 300}
293 301
294/** 302/**
diff --git a/include/linux/compat.h b/include/linux/compat.h
index f2ded21f9a3c..af931ee43dd8 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -222,6 +222,8 @@ int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from);
222int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from); 222int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from);
223int get_compat_sigevent(struct sigevent *event, 223int get_compat_sigevent(struct sigevent *event,
224 const struct compat_sigevent __user *u_event); 224 const struct compat_sigevent __user *u_event);
225long compat_sys_rt_tgsigqueueinfo(compat_pid_t tgid, compat_pid_t pid, int sig,
226 struct compat_siginfo __user *uinfo);
225 227
226static inline int compat_timeval_compare(struct compat_timeval *lhs, 228static inline int compat_timeval_compare(struct compat_timeval *lhs,
227 struct compat_timeval *rhs) 229 struct compat_timeval *rhs)
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
index 8005effc04f1..b721129e0469 100644
--- a/include/linux/compiler-gcc3.h
+++ b/include/linux/compiler-gcc3.h
@@ -16,6 +16,12 @@
16#define __must_check __attribute__((warn_unused_result)) 16#define __must_check __attribute__((warn_unused_result))
17#endif 17#endif
18 18
19#ifdef CONFIG_GCOV_KERNEL
20# if __GNUC_MINOR__ < 4
21# error "GCOV profiling support for gcc versions below 3.4 not included"
22# endif /* __GNUC_MINOR__ */
23#endif /* CONFIG_GCOV_KERNEL */
24
19/* 25/*
20 * A trick to suppress uninitialized variable warning without generating any 26 * A trick to suppress uninitialized variable warning without generating any
21 * code 27 * code
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 37bcb50a4d7c..04fb5135b4e1 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -261,6 +261,11 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
261# define __section(S) __attribute__ ((__section__(#S))) 261# define __section(S) __attribute__ ((__section__(#S)))
262#endif 262#endif
263 263
264/* Are two types/vars the same type (ignoring qualifiers)? */
265#ifndef __same_type
266# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
267#endif
268
264/* 269/*
265 * Prevent the compiler from merging or refetching accesses. The compiler 270 * Prevent the compiler from merging or refetching accesses. The compiler
266 * is also forbidden from reordering successive instances of ACCESS_ONCE(), 271 * is also forbidden from reordering successive instances of ACCESS_ONCE(),
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 2643d848df90..4d668e05d458 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -69,7 +69,6 @@ static inline void unregister_cpu_notifier(struct notifier_block *nb)
69 69
70int cpu_up(unsigned int cpu); 70int cpu_up(unsigned int cpu);
71void notify_cpu_starting(unsigned int cpu); 71void notify_cpu_starting(unsigned int cpu);
72extern void cpu_hotplug_init(void);
73extern void cpu_maps_update_begin(void); 72extern void cpu_maps_update_begin(void);
74extern void cpu_maps_update_done(void); 73extern void cpu_maps_update_done(void);
75 74
@@ -84,10 +83,6 @@ static inline void unregister_cpu_notifier(struct notifier_block *nb)
84{ 83{
85} 84}
86 85
87static inline void cpu_hotplug_init(void)
88{
89}
90
91static inline void cpu_maps_update_begin(void) 86static inline void cpu_maps_update_begin(void)
92{ 87{
93} 88}
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 05ea1dd7d681..a5740fc4d04b 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -18,7 +18,6 @@
18 18
19extern int number_of_cpusets; /* How many cpusets are defined in system? */ 19extern int number_of_cpusets; /* How many cpusets are defined in system? */
20 20
21extern int cpuset_init_early(void);
22extern int cpuset_init(void); 21extern int cpuset_init(void);
23extern void cpuset_init_smp(void); 22extern void cpuset_init_smp(void);
24extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask); 23extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
@@ -27,7 +26,6 @@ extern void cpuset_cpus_allowed_locked(struct task_struct *p,
27extern nodemask_t cpuset_mems_allowed(struct task_struct *p); 26extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
28#define cpuset_current_mems_allowed (current->mems_allowed) 27#define cpuset_current_mems_allowed (current->mems_allowed)
29void cpuset_init_current_mems_allowed(void); 28void cpuset_init_current_mems_allowed(void);
30void cpuset_update_task_memory_state(void);
31int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask); 29int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask);
32 30
33extern int __cpuset_node_allowed_softwall(int node, gfp_t gfp_mask); 31extern int __cpuset_node_allowed_softwall(int node, gfp_t gfp_mask);
@@ -92,9 +90,13 @@ extern void rebuild_sched_domains(void);
92 90
93extern void cpuset_print_task_mems_allowed(struct task_struct *p); 91extern void cpuset_print_task_mems_allowed(struct task_struct *p);
94 92
93static inline void set_mems_allowed(nodemask_t nodemask)
94{
95 current->mems_allowed = nodemask;
96}
97
95#else /* !CONFIG_CPUSETS */ 98#else /* !CONFIG_CPUSETS */
96 99
97static inline int cpuset_init_early(void) { return 0; }
98static inline int cpuset_init(void) { return 0; } 100static inline int cpuset_init(void) { return 0; }
99static inline void cpuset_init_smp(void) {} 101static inline void cpuset_init_smp(void) {}
100 102
@@ -116,7 +118,6 @@ static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
116 118
117#define cpuset_current_mems_allowed (node_states[N_HIGH_MEMORY]) 119#define cpuset_current_mems_allowed (node_states[N_HIGH_MEMORY])
118static inline void cpuset_init_current_mems_allowed(void) {} 120static inline void cpuset_init_current_mems_allowed(void) {}
119static inline void cpuset_update_task_memory_state(void) {}
120 121
121static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask) 122static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask)
122{ 123{
@@ -188,6 +189,10 @@ static inline void cpuset_print_task_mems_allowed(struct task_struct *p)
188{ 189{
189} 190}
190 191
192static inline void set_mems_allowed(nodemask_t nodemask)
193{
194}
195
191#endif /* !CONFIG_CPUSETS */ 196#endif /* !CONFIG_CPUSETS */
192 197
193#endif /* _LINUX_CPUSET_H */ 198#endif /* _LINUX_CPUSET_H */
diff --git a/include/linux/cramfs_fs.h b/include/linux/cramfs_fs.h
index 3be4e5a27d82..6fc2bed368b8 100644
--- a/include/linux/cramfs_fs.h
+++ b/include/linux/cramfs_fs.h
@@ -2,9 +2,8 @@
2#define __CRAMFS_H 2#define __CRAMFS_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/magic.h>
5 6
6#define CRAMFS_MAGIC 0x28cd3d45 /* some random number */
7#define CRAMFS_MAGIC_WEND 0x453dcd28 /* magic number with the wrong endianess */
8#define CRAMFS_SIGNATURE "Compressed ROMFS" 7#define CRAMFS_SIGNATURE "Compressed ROMFS"
9 8
10/* 9/*
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index 788850ba4e75..1fbdea4f08eb 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -142,19 +142,6 @@ struct CYZ_BOOT_CTRL {
142 142
143 143
144#ifndef DP_WINDOW_SIZE 144#ifndef DP_WINDOW_SIZE
145/* #include "cyclomz.h" */
146/****************** ****************** *******************/
147/*
148 * The data types defined below are used in all ZFIRM interface
149 * data structures. They accomodate differences between HW
150 * architectures and compilers.
151 */
152
153typedef __u64 ucdouble; /* 64 bits, unsigned */
154typedef __u32 uclong; /* 32 bits, unsigned */
155typedef __u16 ucshort; /* 16 bits, unsigned */
156typedef __u8 ucchar; /* 8 bits, unsigned */
157
158/* 145/*
159 * Memory Window Sizes 146 * Memory Window Sizes
160 */ 147 */
@@ -507,16 +494,20 @@ struct ZFW_CTRL {
507 494
508/* Per card data structure */ 495/* Per card data structure */
509struct cyclades_card { 496struct cyclades_card {
510 void __iomem *base_addr; 497 void __iomem *base_addr;
511 void __iomem *ctl_addr; 498 union {
512 int irq; 499 void __iomem *p9050;
513 unsigned int num_chips; /* 0 if card absent, -1 if Z/PCI, else Y */ 500 struct RUNTIME_9060 __iomem *p9060;
514 unsigned int first_line; /* minor number of first channel on card */ 501 } ctl_addr;
515 unsigned int nports; /* Number of ports in the card */ 502 int irq;
516 int bus_index; /* address shift - 0 for ISA, 1 for PCI */ 503 unsigned int num_chips; /* 0 if card absent, -1 if Z/PCI, else Y */
517 int intr_enabled; /* FW Interrupt flag - 0 disabled, 1 enabled */ 504 unsigned int first_line; /* minor number of first channel on card */
518 spinlock_t card_lock; 505 unsigned int nports; /* Number of ports in the card */
519 struct cyclades_port *ports; 506 int bus_index; /* address shift - 0 for ISA, 1 for PCI */
507 int intr_enabled; /* FW Interrupt flag - 0 disabled, 1 enabled */
508 u32 hw_ver;
509 spinlock_t card_lock;
510 struct cyclades_port *ports;
520}; 511};
521 512
522/*************************************** 513/***************************************
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 15156364d196..30b93b2a01a4 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -180,10 +180,12 @@ d_iput: no no no yes
180#define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */ 180#define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */
181#define DCACHE_UNHASHED 0x0010 181#define DCACHE_UNHASHED 0x0010
182 182
183#define DCACHE_INOTIFY_PARENT_WATCHED 0x0020 /* Parent inode is watched */ 183#define DCACHE_INOTIFY_PARENT_WATCHED 0x0020 /* Parent inode is watched by inotify */
184 184
185#define DCACHE_COOKIE 0x0040 /* For use by dcookie subsystem */ 185#define DCACHE_COOKIE 0x0040 /* For use by dcookie subsystem */
186 186
187#define DCACHE_FSNOTIFY_PARENT_WATCHED 0x0080 /* Parent inode is watched by some fsnotify listener */
188
187extern spinlock_t dcache_lock; 189extern spinlock_t dcache_lock;
188extern seqlock_t rename_lock; 190extern seqlock_t rename_lock;
189 191
@@ -351,6 +353,11 @@ static inline int d_unhashed(struct dentry *dentry)
351 return (dentry->d_flags & DCACHE_UNHASHED); 353 return (dentry->d_flags & DCACHE_UNHASHED);
352} 354}
353 355
356static inline int d_unlinked(struct dentry *dentry)
357{
358 return d_unhashed(dentry) && !IS_ROOT(dentry);
359}
360
354static inline struct dentry *dget_parent(struct dentry *dentry) 361static inline struct dentry *dget_parent(struct dentry *dentry)
355{ 362{
356 struct dentry *ret; 363 struct dentry *ret;
@@ -368,7 +375,7 @@ static inline int d_mountpoint(struct dentry *dentry)
368 return dentry->d_mounted; 375 return dentry->d_mounted;
369} 376}
370 377
371extern struct vfsmount *lookup_mnt(struct vfsmount *, struct dentry *); 378extern struct vfsmount *lookup_mnt(struct path *);
372extern struct dentry *lookup_create(struct nameidata *nd, int is_dir); 379extern struct dentry *lookup_create(struct nameidata *nd, int is_dir);
373 380
374extern int sysctl_vfs_cache_pressure; 381extern int sysctl_vfs_cache_pressure;
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index ded2d7c42668..49c2362977fd 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -149,7 +149,7 @@ struct io_restrictions {
149 unsigned max_hw_sectors; 149 unsigned max_hw_sectors;
150 unsigned max_sectors; 150 unsigned max_sectors;
151 unsigned max_segment_size; 151 unsigned max_segment_size;
152 unsigned short hardsect_size; 152 unsigned short logical_block_size;
153 unsigned short max_hw_segments; 153 unsigned short max_hw_segments;
154 unsigned short max_phys_segments; 154 unsigned short max_phys_segments;
155 unsigned char no_cluster; /* inverted so that 0 is default */ 155 unsigned char no_cluster; /* inverted so that 0 is default */
diff --git a/include/linux/device.h b/include/linux/device.h
index 5d5c197bad45..ed4e39f2c423 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -62,8 +62,6 @@ struct bus_type {
62 void (*shutdown)(struct device *dev); 62 void (*shutdown)(struct device *dev);
63 63
64 int (*suspend)(struct device *dev, pm_message_t state); 64 int (*suspend)(struct device *dev, pm_message_t state);
65 int (*suspend_late)(struct device *dev, pm_message_t state);
66 int (*resume_early)(struct device *dev);
67 int (*resume)(struct device *dev); 65 int (*resume)(struct device *dev);
68 66
69 struct dev_pm_ops *pm; 67 struct dev_pm_ops *pm;
@@ -116,6 +114,8 @@ extern int bus_unregister_notifier(struct bus_type *bus,
116#define BUS_NOTIFY_BOUND_DRIVER 0x00000003 /* driver bound to device */ 114#define BUS_NOTIFY_BOUND_DRIVER 0x00000003 /* driver bound to device */
117#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be 115#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be
118 unbound */ 116 unbound */
117#define BUS_NOTIFY_UNBOUND_DRIVER 0x00000005 /* driver is unbound
118 from the device */
119 119
120extern struct kset *bus_get_kset(struct bus_type *bus); 120extern struct kset *bus_get_kset(struct bus_type *bus);
121extern struct klist *bus_get_device_klist(struct bus_type *bus); 121extern struct klist *bus_get_device_klist(struct bus_type *bus);
@@ -194,6 +194,7 @@ struct class {
194 struct kobject *dev_kobj; 194 struct kobject *dev_kobj;
195 195
196 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 196 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
197 char *(*nodename)(struct device *dev);
197 198
198 void (*class_release)(struct class *class); 199 void (*class_release)(struct class *class);
199 void (*dev_release)(struct device *dev); 200 void (*dev_release)(struct device *dev);
@@ -289,11 +290,9 @@ struct device_type {
289 const char *name; 290 const char *name;
290 struct attribute_group **groups; 291 struct attribute_group **groups;
291 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 292 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
293 char *(*nodename)(struct device *dev);
292 void (*release)(struct device *dev); 294 void (*release)(struct device *dev);
293 295
294 int (*suspend)(struct device *dev, pm_message_t state);
295 int (*resume)(struct device *dev);
296
297 struct dev_pm_ops *pm; 296 struct dev_pm_ops *pm;
298}; 297};
299 298
@@ -491,6 +490,7 @@ extern struct device *device_find_child(struct device *dev, void *data,
491extern int device_rename(struct device *dev, char *new_name); 490extern int device_rename(struct device *dev, char *new_name);
492extern int device_move(struct device *dev, struct device *new_parent, 491extern int device_move(struct device *dev, struct device *new_parent,
493 enum dpm_order dpm_order); 492 enum dpm_order dpm_order);
493extern const char *device_get_nodename(struct device *dev, const char **tmp);
494 494
495/* 495/*
496 * Root device objects for grouping under /sys/devices 496 * Root device objects for grouping under /sys/devices
diff --git a/include/linux/dlm.h b/include/linux/dlm.h
index b9cd38603fd8..0b3518c42356 100644
--- a/include/linux/dlm.h
+++ b/include/linux/dlm.h
@@ -81,8 +81,8 @@ struct dlm_lksb {
81 * the cluster, the calling node joins it. 81 * the cluster, the calling node joins it.
82 */ 82 */
83 83
84int dlm_new_lockspace(char *name, int namelen, dlm_lockspace_t **lockspace, 84int dlm_new_lockspace(const char *name, int namelen,
85 uint32_t flags, int lvblen); 85 dlm_lockspace_t **lockspace, uint32_t flags, int lvblen);
86 86
87/* 87/*
88 * dlm_release_lockspace 88 * dlm_release_lockspace
diff --git a/include/linux/dma-debug.h b/include/linux/dma-debug.h
index 28d53cb7b5a2..171ad8aedc83 100644
--- a/include/linux/dma-debug.h
+++ b/include/linux/dma-debug.h
@@ -32,6 +32,8 @@ extern void dma_debug_add_bus(struct bus_type *bus);
32 32
33extern void dma_debug_init(u32 num_entries); 33extern void dma_debug_init(u32 num_entries);
34 34
35extern int dma_debug_resize_entries(u32 num_entries);
36
35extern void debug_dma_map_page(struct device *dev, struct page *page, 37extern void debug_dma_map_page(struct device *dev, struct page *page,
36 size_t offset, size_t size, 38 size_t offset, size_t size,
37 int direction, dma_addr_t dma_addr, 39 int direction, dma_addr_t dma_addr,
@@ -91,6 +93,11 @@ static inline void dma_debug_init(u32 num_entries)
91{ 93{
92} 94}
93 95
96static inline int dma_debug_resize_entries(u32 num_entries)
97{
98 return 0;
99}
100
94static inline void debug_dma_map_page(struct device *dev, struct page *page, 101static inline void debug_dma_map_page(struct device *dev, struct page *page,
95 size_t offset, size_t size, 102 size_t offset, size_t size,
96 int direction, dma_addr_t dma_addr, 103 int direction, dma_addr_t dma_addr,
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 8083b6a36a38..07dfd460d286 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -63,24 +63,26 @@ struct dma_map_ops {
63 63
64#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) 64#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
65 65
66typedef u64 DMA_nnBIT_MASK __deprecated;
67
66/* 68/*
67 * NOTE: do not use the below macros in new code and do not add new definitions 69 * NOTE: do not use the below macros in new code and do not add new definitions
68 * here. 70 * here.
69 * 71 *
70 * Instead, just open-code DMA_BIT_MASK(n) within your driver 72 * Instead, just open-code DMA_BIT_MASK(n) within your driver
71 */ 73 */
72#define DMA_64BIT_MASK DMA_BIT_MASK(64) 74#define DMA_64BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(64)
73#define DMA_48BIT_MASK DMA_BIT_MASK(48) 75#define DMA_48BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(48)
74#define DMA_47BIT_MASK DMA_BIT_MASK(47) 76#define DMA_47BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(47)
75#define DMA_40BIT_MASK DMA_BIT_MASK(40) 77#define DMA_40BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(40)
76#define DMA_39BIT_MASK DMA_BIT_MASK(39) 78#define DMA_39BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(39)
77#define DMA_35BIT_MASK DMA_BIT_MASK(35) 79#define DMA_35BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(35)
78#define DMA_32BIT_MASK DMA_BIT_MASK(32) 80#define DMA_32BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(32)
79#define DMA_31BIT_MASK DMA_BIT_MASK(31) 81#define DMA_31BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(31)
80#define DMA_30BIT_MASK DMA_BIT_MASK(30) 82#define DMA_30BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(30)
81#define DMA_29BIT_MASK DMA_BIT_MASK(29) 83#define DMA_29BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(29)
82#define DMA_28BIT_MASK DMA_BIT_MASK(28) 84#define DMA_28BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(28)
83#define DMA_24BIT_MASK DMA_BIT_MASK(24) 85#define DMA_24BIT_MASK (DMA_nnBIT_MASK)DMA_BIT_MASK(24)
84 86
85#define DMA_MASK_NONE 0x0ULL 87#define DMA_MASK_NONE 0x0ULL
86 88
@@ -107,9 +109,20 @@ static inline int is_buffer_dma_capable(u64 mask, dma_addr_t addr, size_t size)
107#include <asm-generic/dma-mapping-broken.h> 109#include <asm-generic/dma-mapping-broken.h>
108#endif 110#endif
109 111
110/* Backwards compat, remove in 2.7.x */ 112/* for backwards compatibility, removed soon */
111#define dma_sync_single dma_sync_single_for_cpu 113static inline void __deprecated dma_sync_single(struct device *dev,
112#define dma_sync_sg dma_sync_sg_for_cpu 114 dma_addr_t addr, size_t size,
115 enum dma_data_direction dir)
116{
117 dma_sync_single_for_cpu(dev, addr, size, dir);
118}
119
120static inline void __deprecated dma_sync_sg(struct device *dev,
121 struct scatterlist *sg, int nelems,
122 enum dma_data_direction dir)
123{
124 dma_sync_sg_for_cpu(dev, sg, nelems, dir);
125}
113 126
114static inline u64 dma_get_mask(struct device *dev) 127static inline u64 dma_get_mask(struct device *dev)
115{ 128{
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h
index 1a455f1f86d7..5619f8522738 100644
--- a/include/linux/dma_remapping.h
+++ b/include/linux/dma_remapping.h
@@ -13,6 +13,10 @@
13#define DMA_PTE_WRITE (2) 13#define DMA_PTE_WRITE (2)
14#define DMA_PTE_SNP (1 << 11) 14#define DMA_PTE_SNP (1 << 11)
15 15
16#define CONTEXT_TT_MULTI_LEVEL 0
17#define CONTEXT_TT_DEV_IOTLB 1
18#define CONTEXT_TT_PASS_THROUGH 2
19
16struct intel_iommu; 20struct intel_iommu;
17struct dmar_domain; 21struct dmar_domain;
18struct root_entry; 22struct root_entry;
@@ -21,11 +25,16 @@ extern void free_dmar_iommu(struct intel_iommu *iommu);
21 25
22#ifdef CONFIG_DMAR 26#ifdef CONFIG_DMAR
23extern int iommu_calculate_agaw(struct intel_iommu *iommu); 27extern int iommu_calculate_agaw(struct intel_iommu *iommu);
28extern int iommu_calculate_max_sagaw(struct intel_iommu *iommu);
24#else 29#else
25static inline int iommu_calculate_agaw(struct intel_iommu *iommu) 30static inline int iommu_calculate_agaw(struct intel_iommu *iommu)
26{ 31{
27 return 0; 32 return 0;
28} 33}
34static inline int iommu_calculate_max_sagaw(struct intel_iommu *iommu)
35{
36 return 0;
37}
29#endif 38#endif
30 39
31extern int dmar_disabled; 40extern int dmar_disabled;
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index e397dc342cda..1731fb5fd775 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -108,6 +108,7 @@ struct irte {
108}; 108};
109#ifdef CONFIG_INTR_REMAP 109#ifdef CONFIG_INTR_REMAP
110extern int intr_remapping_enabled; 110extern int intr_remapping_enabled;
111extern int intr_remapping_supported(void);
111extern int enable_intr_remapping(int); 112extern int enable_intr_remapping(int);
112extern void disable_intr_remapping(void); 113extern void disable_intr_remapping(void);
113extern int reenable_intr_remapping(int); 114extern int reenable_intr_remapping(int);
@@ -157,6 +158,8 @@ static inline struct intel_iommu *map_ioapic_to_ir(int apic)
157} 158}
158#define irq_remapped(irq) (0) 159#define irq_remapped(irq) (0)
159#define enable_intr_remapping(mode) (-1) 160#define enable_intr_remapping(mode) (-1)
161#define disable_intr_remapping() (0)
162#define reenable_intr_remapping(mode) (0)
160#define intr_remapping_enabled (0) 163#define intr_remapping_enabled (0)
161#endif 164#endif
162 165
@@ -185,6 +188,15 @@ struct dmar_rmrr_unit {
185 188
186#define for_each_rmrr_units(rmrr) \ 189#define for_each_rmrr_units(rmrr) \
187 list_for_each_entry(rmrr, &dmar_rmrr_units, list) 190 list_for_each_entry(rmrr, &dmar_rmrr_units, list)
191
192struct dmar_atsr_unit {
193 struct list_head list; /* list of ATSR units */
194 struct acpi_dmar_header *hdr; /* ACPI header */
195 struct pci_dev **devices; /* target devices */
196 int devices_cnt; /* target device count */
197 u8 include_all:1; /* include all ports */
198};
199
188/* Intel DMAR initialization functions */ 200/* Intel DMAR initialization functions */
189extern int intel_iommu_init(void); 201extern int intel_iommu_init(void);
190#else 202#else
diff --git a/include/linux/dnotify.h b/include/linux/dnotify.h
index 102a902b4396..ecc06286226d 100644
--- a/include/linux/dnotify.h
+++ b/include/linux/dnotify.h
@@ -10,7 +10,7 @@
10 10
11struct dnotify_struct { 11struct dnotify_struct {
12 struct dnotify_struct * dn_next; 12 struct dnotify_struct * dn_next;
13 unsigned long dn_mask; 13 __u32 dn_mask;
14 int dn_fd; 14 int dn_fd;
15 struct file * dn_filp; 15 struct file * dn_filp;
16 fl_owner_t dn_owner; 16 fl_owner_t dn_owner;
@@ -21,23 +21,18 @@ struct dnotify_struct {
21 21
22#ifdef CONFIG_DNOTIFY 22#ifdef CONFIG_DNOTIFY
23 23
24extern void __inode_dir_notify(struct inode *, unsigned long); 24#define DNOTIFY_ALL_EVENTS (FS_DELETE | FS_DELETE_CHILD |\
25 FS_MODIFY | FS_MODIFY_CHILD |\
26 FS_ACCESS | FS_ACCESS_CHILD |\
27 FS_ATTRIB | FS_ATTRIB_CHILD |\
28 FS_CREATE | FS_DN_RENAME |\
29 FS_MOVED_FROM | FS_MOVED_TO)
30
25extern void dnotify_flush(struct file *, fl_owner_t); 31extern void dnotify_flush(struct file *, fl_owner_t);
26extern int fcntl_dirnotify(int, struct file *, unsigned long); 32extern int fcntl_dirnotify(int, struct file *, unsigned long);
27extern void dnotify_parent(struct dentry *, unsigned long);
28
29static inline void inode_dir_notify(struct inode *inode, unsigned long event)
30{
31 if (inode->i_dnotify_mask & (event))
32 __inode_dir_notify(inode, event);
33}
34 33
35#else 34#else
36 35
37static inline void __inode_dir_notify(struct inode *inode, unsigned long event)
38{
39}
40
41static inline void dnotify_flush(struct file *filp, fl_owner_t id) 36static inline void dnotify_flush(struct file *filp, fl_owner_t id)
42{ 37{
43} 38}
@@ -47,14 +42,6 @@ static inline int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)
47 return -EINVAL; 42 return -EINVAL;
48} 43}
49 44
50static inline void dnotify_parent(struct dentry *dentry, unsigned long event)
51{
52}
53
54static inline void inode_dir_notify(struct inode *inode, unsigned long event)
55{
56}
57
58#endif /* CONFIG_DNOTIFY */ 45#endif /* CONFIG_DNOTIFY */
59 46
60#endif /* __KERNEL __ */ 47#endif /* __KERNEL __ */
diff --git a/include/linux/efi.h b/include/linux/efi.h
index bb66feb164bd..ce4581fbc08b 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -101,7 +101,7 @@ typedef struct {
101 u64 attribute; 101 u64 attribute;
102} efi_memory_desc_t; 102} efi_memory_desc_t;
103 103
104typedef int (*efi_freemem_callback_t) (unsigned long start, unsigned long end, void *arg); 104typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg);
105 105
106/* 106/*
107 * Types and defines for Time Services 107 * Types and defines for Time Services
diff --git a/include/linux/eisa.h b/include/linux/eisa.h
index e61c0be2a459..6925249a5ac6 100644
--- a/include/linux/eisa.h
+++ b/include/linux/eisa.h
@@ -78,12 +78,12 @@ static inline void eisa_driver_unregister (struct eisa_driver *edrv) { }
78/* Mimics pci.h... */ 78/* Mimics pci.h... */
79static inline void *eisa_get_drvdata (struct eisa_device *edev) 79static inline void *eisa_get_drvdata (struct eisa_device *edev)
80{ 80{
81 return edev->dev.driver_data; 81 return dev_get_drvdata(&edev->dev);
82} 82}
83 83
84static inline void eisa_set_drvdata (struct eisa_device *edev, void *data) 84static inline void eisa_set_drvdata (struct eisa_device *edev, void *data)
85{ 85{
86 edev->dev.driver_data = data; 86 dev_set_drvdata(&edev->dev, data);
87} 87}
88 88
89/* The EISA root device. There's rumours about machines with multiple 89/* The EISA root device. There's rumours about machines with multiple
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index c59b769f62b0..1cb3372e65d8 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -103,10 +103,8 @@ extern int elv_merge(struct request_queue *, struct request **, struct bio *);
103extern void elv_merge_requests(struct request_queue *, struct request *, 103extern void elv_merge_requests(struct request_queue *, struct request *,
104 struct request *); 104 struct request *);
105extern void elv_merged_request(struct request_queue *, struct request *, int); 105extern void elv_merged_request(struct request_queue *, struct request *, int);
106extern void elv_dequeue_request(struct request_queue *, struct request *);
107extern void elv_requeue_request(struct request_queue *, struct request *); 106extern void elv_requeue_request(struct request_queue *, struct request *);
108extern int elv_queue_empty(struct request_queue *); 107extern int elv_queue_empty(struct request_queue *);
109extern struct request *elv_next_request(struct request_queue *q);
110extern struct request *elv_former_request(struct request_queue *, struct request *); 108extern struct request *elv_former_request(struct request_queue *, struct request *);
111extern struct request *elv_latter_request(struct request_queue *, struct request *); 109extern struct request *elv_latter_request(struct request_queue *, struct request *);
112extern int elv_register_queue(struct request_queue *q); 110extern int elv_register_queue(struct request_queue *q);
@@ -171,7 +169,7 @@ enum {
171 ELV_MQUEUE_MUST, 169 ELV_MQUEUE_MUST,
172}; 170};
173 171
174#define rq_end_sector(rq) ((rq)->sector + (rq)->nr_sectors) 172#define rq_end_sector(rq) (blk_rq_pos(rq) + blk_rq_sectors(rq))
175#define rb_entry_rq(node) rb_entry((node), struct request, rb_node) 173#define rb_entry_rq(node) rb_entry((node), struct request, rb_node)
176 174
177/* 175/*
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index a1f17abba7dc..3d7a6687d247 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -182,6 +182,33 @@ static inline unsigned compare_ether_addr_64bits(const u8 addr1[6+2],
182 return compare_ether_addr(addr1, addr2); 182 return compare_ether_addr(addr1, addr2);
183#endif 183#endif
184} 184}
185
186/**
187 * is_etherdev_addr - Tell if given Ethernet address belongs to the device.
188 * @dev: Pointer to a device structure
189 * @addr: Pointer to a six-byte array containing the Ethernet address
190 *
191 * Compare passed address with all addresses of the device. Return true if the
192 * address if one of the device addresses.
193 *
194 * Note that this function calls compare_ether_addr_64bits() so take care of
195 * the right padding.
196 */
197static inline bool is_etherdev_addr(const struct net_device *dev,
198 const u8 addr[6 + 2])
199{
200 struct netdev_hw_addr *ha;
201 int res = 1;
202
203 rcu_read_lock();
204 for_each_dev_addr(dev, ha) {
205 res = compare_ether_addr_64bits(addr, ha->addr);
206 if (!res)
207 break;
208 }
209 rcu_read_unlock();
210 return !res;
211}
185#endif /* __KERNEL__ */ 212#endif /* __KERNEL__ */
186 213
187/** 214/**
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 131b127b70f8..9b660bd2e2b3 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -26,11 +26,14 @@ struct ethtool_cmd {
26 __u8 phy_address; 26 __u8 phy_address;
27 __u8 transceiver; /* Which transceiver to use */ 27 __u8 transceiver; /* Which transceiver to use */
28 __u8 autoneg; /* Enable or disable autonegotiation */ 28 __u8 autoneg; /* Enable or disable autonegotiation */
29 __u8 mdio_support;
29 __u32 maxtxpkt; /* Tx pkts before generating tx int */ 30 __u32 maxtxpkt; /* Tx pkts before generating tx int */
30 __u32 maxrxpkt; /* Rx pkts before generating rx int */ 31 __u32 maxrxpkt; /* Rx pkts before generating rx int */
31 __u16 speed_hi; 32 __u16 speed_hi;
32 __u16 reserved2; 33 __u8 eth_tp_mdix;
33 __u32 reserved[3]; 34 __u8 reserved2;
35 __u32 lp_advertising; /* Features the link partner advertises */
36 __u32 reserved[2];
34}; 37};
35 38
36static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep, 39static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
@@ -563,6 +566,11 @@ struct ethtool_ops {
563#define SUPPORTED_Pause (1 << 13) 566#define SUPPORTED_Pause (1 << 13)
564#define SUPPORTED_Asym_Pause (1 << 14) 567#define SUPPORTED_Asym_Pause (1 << 14)
565#define SUPPORTED_2500baseX_Full (1 << 15) 568#define SUPPORTED_2500baseX_Full (1 << 15)
569#define SUPPORTED_Backplane (1 << 16)
570#define SUPPORTED_1000baseKX_Full (1 << 17)
571#define SUPPORTED_10000baseKX4_Full (1 << 18)
572#define SUPPORTED_10000baseKR_Full (1 << 19)
573#define SUPPORTED_10000baseR_FEC (1 << 20)
566 574
567/* Indicates what features are advertised by the interface. */ 575/* Indicates what features are advertised by the interface. */
568#define ADVERTISED_10baseT_Half (1 << 0) 576#define ADVERTISED_10baseT_Half (1 << 0)
@@ -581,6 +589,11 @@ struct ethtool_ops {
581#define ADVERTISED_Pause (1 << 13) 589#define ADVERTISED_Pause (1 << 13)
582#define ADVERTISED_Asym_Pause (1 << 14) 590#define ADVERTISED_Asym_Pause (1 << 14)
583#define ADVERTISED_2500baseX_Full (1 << 15) 591#define ADVERTISED_2500baseX_Full (1 << 15)
592#define ADVERTISED_Backplane (1 << 16)
593#define ADVERTISED_1000baseKX_Full (1 << 17)
594#define ADVERTISED_10000baseKX4_Full (1 << 18)
595#define ADVERTISED_10000baseKR_Full (1 << 19)
596#define ADVERTISED_10000baseR_FEC (1 << 20)
584 597
585/* The following are all involved in forcing a particular link 598/* The following are all involved in forcing a particular link
586 * mode for the device for setting things. When getting the 599 * mode for the device for setting things. When getting the
@@ -605,6 +618,7 @@ struct ethtool_ops {
605#define PORT_MII 0x02 618#define PORT_MII 0x02
606#define PORT_FIBRE 0x03 619#define PORT_FIBRE 0x03
607#define PORT_BNC 0x04 620#define PORT_BNC 0x04
621#define PORT_OTHER 0xff
608 622
609/* Which transceiver to use. */ 623/* Which transceiver to use. */
610#define XCVR_INTERNAL 0x00 624#define XCVR_INTERNAL 0x00
@@ -619,6 +633,11 @@ struct ethtool_ops {
619#define AUTONEG_DISABLE 0x00 633#define AUTONEG_DISABLE 0x00
620#define AUTONEG_ENABLE 0x01 634#define AUTONEG_ENABLE 0x01
621 635
636/* Mode MDI or MDI-X */
637#define ETH_TP_MDI_INVALID 0x00
638#define ETH_TP_MDI 0x01
639#define ETH_TP_MDI_X 0x02
640
622/* Wake-On-Lan options. */ 641/* Wake-On-Lan options. */
623#define WAKE_PHY (1 << 0) 642#define WAKE_PHY (1 << 0)
624#define WAKE_UCAST (1 << 1) 643#define WAKE_UCAST (1 << 1)
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 330c4b1bfcaa..dd68358996b7 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -677,6 +677,9 @@ struct fb_ops {
677 /* get capability given var */ 677 /* get capability given var */
678 void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps, 678 void (*fb_get_caps)(struct fb_info *info, struct fb_blit_caps *caps,
679 struct fb_var_screeninfo *var); 679 struct fb_var_screeninfo *var);
680
681 /* teardown any resources to do with this framebuffer */
682 void (*fb_destroy)(struct fb_info *info);
680}; 683};
681 684
682#ifdef CONFIG_FB_TILEBLITTING 685#ifdef CONFIG_FB_TILEBLITTING
@@ -786,6 +789,8 @@ struct fb_tile_ops {
786#define FBINFO_MISC_USEREVENT 0x10000 /* event request 789#define FBINFO_MISC_USEREVENT 0x10000 /* event request
787 from userspace */ 790 from userspace */
788#define FBINFO_MISC_TILEBLITTING 0x20000 /* use tile blitting */ 791#define FBINFO_MISC_TILEBLITTING 0x20000 /* use tile blitting */
792#define FBINFO_MISC_FIRMWARE 0x40000 /* a replaceable firmware
793 inited framebuffer */
789 794
790/* A driver may set this flag to indicate that it does want a set_par to be 795/* A driver may set this flag to indicate that it does want a set_par to be
791 * called every time when fbcon_switch is executed. The advantage is that with 796 * called every time when fbcon_switch is executed. The advantage is that with
@@ -854,7 +859,12 @@ struct fb_info {
854 u32 state; /* Hardware state i.e suspend */ 859 u32 state; /* Hardware state i.e suspend */
855 void *fbcon_par; /* fbcon use-only private area */ 860 void *fbcon_par; /* fbcon use-only private area */
856 /* From here on everything is device dependent */ 861 /* From here on everything is device dependent */
857 void *par; 862 void *par;
863 /* we need the PCI or similiar aperture base/size not
864 smem_start/size as smem_start may just be an object
865 allocated inside the aperture so may not actually overlap */
866 resource_size_t aperture_base;
867 resource_size_t aperture_size;
858}; 868};
859 869
860#ifdef MODULE 870#ifdef MODULE
@@ -893,7 +903,7 @@ struct fb_info {
893#define fb_writeq sbus_writeq 903#define fb_writeq sbus_writeq
894#define fb_memset sbus_memset_io 904#define fb_memset sbus_memset_io
895 905
896#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) 906#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__) || defined(__bfin__)
897 907
898#define fb_readb __raw_readb 908#define fb_readb __raw_readb
899#define fb_readw __raw_readw 909#define fb_readw __raw_readw
diff --git a/include/linux/firewire.h b/include/linux/firewire.h
new file mode 100644
index 000000000000..9823946adbc5
--- /dev/null
+++ b/include/linux/firewire.h
@@ -0,0 +1,445 @@
1#ifndef _LINUX_FIREWIRE_H
2#define _LINUX_FIREWIRE_H
3
4#include <linux/completion.h>
5#include <linux/device.h>
6#include <linux/dma-mapping.h>
7#include <linux/kernel.h>
8#include <linux/kref.h>
9#include <linux/list.h>
10#include <linux/mutex.h>
11#include <linux/spinlock.h>
12#include <linux/sysfs.h>
13#include <linux/timer.h>
14#include <linux/types.h>
15#include <linux/workqueue.h>
16
17#include <asm/atomic.h>
18#include <asm/byteorder.h>
19
20#define fw_notify(s, args...) printk(KERN_NOTICE KBUILD_MODNAME ": " s, ## args)
21#define fw_error(s, args...) printk(KERN_ERR KBUILD_MODNAME ": " s, ## args)
22
23static inline void fw_memcpy_from_be32(void *_dst, void *_src, size_t size)
24{
25 u32 *dst = _dst;
26 __be32 *src = _src;
27 int i;
28
29 for (i = 0; i < size / 4; i++)
30 dst[i] = be32_to_cpu(src[i]);
31}
32
33static inline void fw_memcpy_to_be32(void *_dst, void *_src, size_t size)
34{
35 fw_memcpy_from_be32(_dst, _src, size);
36}
37#define CSR_REGISTER_BASE 0xfffff0000000ULL
38
39/* register offsets are relative to CSR_REGISTER_BASE */
40#define CSR_STATE_CLEAR 0x0
41#define CSR_STATE_SET 0x4
42#define CSR_NODE_IDS 0x8
43#define CSR_RESET_START 0xc
44#define CSR_SPLIT_TIMEOUT_HI 0x18
45#define CSR_SPLIT_TIMEOUT_LO 0x1c
46#define CSR_CYCLE_TIME 0x200
47#define CSR_BUS_TIME 0x204
48#define CSR_BUSY_TIMEOUT 0x210
49#define CSR_BUS_MANAGER_ID 0x21c
50#define CSR_BANDWIDTH_AVAILABLE 0x220
51#define CSR_CHANNELS_AVAILABLE 0x224
52#define CSR_CHANNELS_AVAILABLE_HI 0x224
53#define CSR_CHANNELS_AVAILABLE_LO 0x228
54#define CSR_BROADCAST_CHANNEL 0x234
55#define CSR_CONFIG_ROM 0x400
56#define CSR_CONFIG_ROM_END 0x800
57#define CSR_FCP_COMMAND 0xB00
58#define CSR_FCP_RESPONSE 0xD00
59#define CSR_FCP_END 0xF00
60#define CSR_TOPOLOGY_MAP 0x1000
61#define CSR_TOPOLOGY_MAP_END 0x1400
62#define CSR_SPEED_MAP 0x2000
63#define CSR_SPEED_MAP_END 0x3000
64
65#define CSR_OFFSET 0x40
66#define CSR_LEAF 0x80
67#define CSR_DIRECTORY 0xc0
68
69#define CSR_DESCRIPTOR 0x01
70#define CSR_VENDOR 0x03
71#define CSR_HARDWARE_VERSION 0x04
72#define CSR_NODE_CAPABILITIES 0x0c
73#define CSR_UNIT 0x11
74#define CSR_SPECIFIER_ID 0x12
75#define CSR_VERSION 0x13
76#define CSR_DEPENDENT_INFO 0x14
77#define CSR_MODEL 0x17
78#define CSR_INSTANCE 0x18
79#define CSR_DIRECTORY_ID 0x20
80
81struct fw_csr_iterator {
82 u32 *p;
83 u32 *end;
84};
85
86void fw_csr_iterator_init(struct fw_csr_iterator *ci, u32 *p);
87int fw_csr_iterator_next(struct fw_csr_iterator *ci, int *key, int *value);
88
89extern struct bus_type fw_bus_type;
90
91struct fw_card_driver;
92struct fw_node;
93
94struct fw_card {
95 const struct fw_card_driver *driver;
96 struct device *device;
97 struct kref kref;
98 struct completion done;
99
100 int node_id;
101 int generation;
102 int current_tlabel;
103 u64 tlabel_mask;
104 struct list_head transaction_list;
105 struct timer_list flush_timer;
106 unsigned long reset_jiffies;
107
108 unsigned long long guid;
109 unsigned max_receive;
110 int link_speed;
111 int config_rom_generation;
112
113 spinlock_t lock; /* Take this lock when handling the lists in
114 * this struct. */
115 struct fw_node *local_node;
116 struct fw_node *root_node;
117 struct fw_node *irm_node;
118 u8 color; /* must be u8 to match the definition in struct fw_node */
119 int gap_count;
120 bool beta_repeaters_present;
121
122 int index;
123
124 struct list_head link;
125
126 /* Work struct for BM duties. */
127 struct delayed_work work;
128 int bm_retries;
129 int bm_generation;
130
131 bool broadcast_channel_allocated;
132 u32 broadcast_channel;
133 u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4];
134};
135
136static inline struct fw_card *fw_card_get(struct fw_card *card)
137{
138 kref_get(&card->kref);
139
140 return card;
141}
142
143void fw_card_release(struct kref *kref);
144
145static inline void fw_card_put(struct fw_card *card)
146{
147 kref_put(&card->kref, fw_card_release);
148}
149
150struct fw_attribute_group {
151 struct attribute_group *groups[2];
152 struct attribute_group group;
153 struct attribute *attrs[12];
154};
155
156enum fw_device_state {
157 FW_DEVICE_INITIALIZING,
158 FW_DEVICE_RUNNING,
159 FW_DEVICE_GONE,
160 FW_DEVICE_SHUTDOWN,
161};
162
163/*
164 * Note, fw_device.generation always has to be read before fw_device.node_id.
165 * Use SMP memory barriers to ensure this. Otherwise requests will be sent
166 * to an outdated node_id if the generation was updated in the meantime due
167 * to a bus reset.
168 *
169 * Likewise, fw-core will take care to update .node_id before .generation so
170 * that whenever fw_device.generation is current WRT the actual bus generation,
171 * fw_device.node_id is guaranteed to be current too.
172 *
173 * The same applies to fw_device.card->node_id vs. fw_device.generation.
174 *
175 * fw_device.config_rom and fw_device.config_rom_length may be accessed during
176 * the lifetime of any fw_unit belonging to the fw_device, before device_del()
177 * was called on the last fw_unit. Alternatively, they may be accessed while
178 * holding fw_device_rwsem.
179 */
180struct fw_device {
181 atomic_t state;
182 struct fw_node *node;
183 int node_id;
184 int generation;
185 unsigned max_speed;
186 struct fw_card *card;
187 struct device device;
188
189 struct mutex client_list_mutex;
190 struct list_head client_list;
191
192 u32 *config_rom;
193 size_t config_rom_length;
194 int config_rom_retries;
195 unsigned is_local:1;
196 unsigned max_rec:4;
197 unsigned cmc:1;
198 unsigned irmc:1;
199 unsigned bc_implemented:2;
200
201 struct delayed_work work;
202 struct fw_attribute_group attribute_group;
203};
204
205static inline struct fw_device *fw_device(struct device *dev)
206{
207 return container_of(dev, struct fw_device, device);
208}
209
210static inline int fw_device_is_shutdown(struct fw_device *device)
211{
212 return atomic_read(&device->state) == FW_DEVICE_SHUTDOWN;
213}
214
215static inline struct fw_device *fw_device_get(struct fw_device *device)
216{
217 get_device(&device->device);
218
219 return device;
220}
221
222static inline void fw_device_put(struct fw_device *device)
223{
224 put_device(&device->device);
225}
226
227int fw_device_enable_phys_dma(struct fw_device *device);
228
229/*
230 * fw_unit.directory must not be accessed after device_del(&fw_unit.device).
231 */
232struct fw_unit {
233 struct device device;
234 u32 *directory;
235 struct fw_attribute_group attribute_group;
236};
237
238static inline struct fw_unit *fw_unit(struct device *dev)
239{
240 return container_of(dev, struct fw_unit, device);
241}
242
243static inline struct fw_unit *fw_unit_get(struct fw_unit *unit)
244{
245 get_device(&unit->device);
246
247 return unit;
248}
249
250static inline void fw_unit_put(struct fw_unit *unit)
251{
252 put_device(&unit->device);
253}
254
255static inline struct fw_device *fw_parent_device(struct fw_unit *unit)
256{
257 return fw_device(unit->device.parent);
258}
259
260struct ieee1394_device_id;
261
262struct fw_driver {
263 struct device_driver driver;
264 /* Called when the parent device sits through a bus reset. */
265 void (*update)(struct fw_unit *unit);
266 const struct ieee1394_device_id *id_table;
267};
268
269struct fw_packet;
270struct fw_request;
271
272typedef void (*fw_packet_callback_t)(struct fw_packet *packet,
273 struct fw_card *card, int status);
274typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode,
275 void *data, size_t length,
276 void *callback_data);
277/*
278 * Important note: The callback must guarantee that either fw_send_response()
279 * or kfree() is called on the @request.
280 */
281typedef void (*fw_address_callback_t)(struct fw_card *card,
282 struct fw_request *request,
283 int tcode, int destination, int source,
284 int generation, int speed,
285 unsigned long long offset,
286 void *data, size_t length,
287 void *callback_data);
288
289struct fw_packet {
290 int speed;
291 int generation;
292 u32 header[4];
293 size_t header_length;
294 void *payload;
295 size_t payload_length;
296 dma_addr_t payload_bus;
297 u32 timestamp;
298
299 /*
300 * This callback is called when the packet transmission has
301 * completed; for successful transmission, the status code is
302 * the ack received from the destination, otherwise it's a
303 * negative errno: ENOMEM, ESTALE, ETIMEDOUT, ENODEV, EIO.
304 * The callback can be called from tasklet context and thus
305 * must never block.
306 */
307 fw_packet_callback_t callback;
308 int ack;
309 struct list_head link;
310 void *driver_data;
311};
312
313struct fw_transaction {
314 int node_id; /* The generation is implied; it is always the current. */
315 int tlabel;
316 int timestamp;
317 struct list_head link;
318
319 struct fw_packet packet;
320
321 /*
322 * The data passed to the callback is valid only during the
323 * callback.
324 */
325 fw_transaction_callback_t callback;
326 void *callback_data;
327};
328
329struct fw_address_handler {
330 u64 offset;
331 size_t length;
332 fw_address_callback_t address_callback;
333 void *callback_data;
334 struct list_head link;
335};
336
337struct fw_address_region {
338 u64 start;
339 u64 end;
340};
341
342extern const struct fw_address_region fw_high_memory_region;
343
344int fw_core_add_address_handler(struct fw_address_handler *handler,
345 const struct fw_address_region *region);
346void fw_core_remove_address_handler(struct fw_address_handler *handler);
347void fw_send_response(struct fw_card *card,
348 struct fw_request *request, int rcode);
349void fw_send_request(struct fw_card *card, struct fw_transaction *t,
350 int tcode, int destination_id, int generation, int speed,
351 unsigned long long offset, void *payload, size_t length,
352 fw_transaction_callback_t callback, void *callback_data);
353int fw_cancel_transaction(struct fw_card *card,
354 struct fw_transaction *transaction);
355int fw_run_transaction(struct fw_card *card, int tcode, int destination_id,
356 int generation, int speed, unsigned long long offset,
357 void *payload, size_t length);
358
359static inline int fw_stream_packet_destination_id(int tag, int channel, int sy)
360{
361 return tag << 14 | channel << 8 | sy;
362}
363
364struct fw_descriptor {
365 struct list_head link;
366 size_t length;
367 u32 immediate;
368 u32 key;
369 const u32 *data;
370};
371
372int fw_core_add_descriptor(struct fw_descriptor *desc);
373void fw_core_remove_descriptor(struct fw_descriptor *desc);
374
375/*
376 * The iso packet format allows for an immediate header/payload part
377 * stored in 'header' immediately after the packet info plus an
378 * indirect payload part that is pointer to by the 'payload' field.
379 * Applications can use one or the other or both to implement simple
380 * low-bandwidth streaming (e.g. audio) or more advanced
381 * scatter-gather streaming (e.g. assembling video frame automatically).
382 */
383struct fw_iso_packet {
384 u16 payload_length; /* Length of indirect payload. */
385 u32 interrupt:1; /* Generate interrupt on this packet */
386 u32 skip:1; /* Set to not send packet at all. */
387 u32 tag:2;
388 u32 sy:4;
389 u32 header_length:8; /* Length of immediate header. */
390 u32 header[0];
391};
392
393#define FW_ISO_CONTEXT_TRANSMIT 0
394#define FW_ISO_CONTEXT_RECEIVE 1
395
396#define FW_ISO_CONTEXT_MATCH_TAG0 1
397#define FW_ISO_CONTEXT_MATCH_TAG1 2
398#define FW_ISO_CONTEXT_MATCH_TAG2 4
399#define FW_ISO_CONTEXT_MATCH_TAG3 8
400#define FW_ISO_CONTEXT_MATCH_ALL_TAGS 15
401
402/*
403 * An iso buffer is just a set of pages mapped for DMA in the
404 * specified direction. Since the pages are to be used for DMA, they
405 * are not mapped into the kernel virtual address space. We store the
406 * DMA address in the page private. The helper function
407 * fw_iso_buffer_map() will map the pages into a given vma.
408 */
409struct fw_iso_buffer {
410 enum dma_data_direction direction;
411 struct page **pages;
412 int page_count;
413};
414
415int fw_iso_buffer_init(struct fw_iso_buffer *buffer, struct fw_card *card,
416 int page_count, enum dma_data_direction direction);
417void fw_iso_buffer_destroy(struct fw_iso_buffer *buffer, struct fw_card *card);
418
419struct fw_iso_context;
420typedef void (*fw_iso_callback_t)(struct fw_iso_context *context,
421 u32 cycle, size_t header_length,
422 void *header, void *data);
423struct fw_iso_context {
424 struct fw_card *card;
425 int type;
426 int channel;
427 int speed;
428 size_t header_size;
429 fw_iso_callback_t callback;
430 void *callback_data;
431};
432
433struct fw_iso_context *fw_iso_context_create(struct fw_card *card,
434 int type, int channel, int speed, size_t header_size,
435 fw_iso_callback_t callback, void *callback_data);
436int fw_iso_context_queue(struct fw_iso_context *ctx,
437 struct fw_iso_packet *packet,
438 struct fw_iso_buffer *buffer,
439 unsigned long payload);
440int fw_iso_context_start(struct fw_iso_context *ctx,
441 int cycle, int sync, int tags);
442int fw_iso_context_stop(struct fw_iso_context *ctx);
443void fw_iso_context_destroy(struct fw_iso_context *ctx);
444
445#endif /* _LINUX_FIREWIRE_H */
diff --git a/include/linux/firmware-map.h b/include/linux/firmware-map.h
index cca686b39123..875451f1373a 100644
--- a/include/linux/firmware-map.h
+++ b/include/linux/firmware-map.h
@@ -24,21 +24,17 @@
24 */ 24 */
25#ifdef CONFIG_FIRMWARE_MEMMAP 25#ifdef CONFIG_FIRMWARE_MEMMAP
26 26
27int firmware_map_add(resource_size_t start, resource_size_t end, 27int firmware_map_add(u64 start, u64 end, const char *type);
28 const char *type); 28int firmware_map_add_early(u64 start, u64 end, const char *type);
29int firmware_map_add_early(resource_size_t start, resource_size_t end,
30 const char *type);
31 29
32#else /* CONFIG_FIRMWARE_MEMMAP */ 30#else /* CONFIG_FIRMWARE_MEMMAP */
33 31
34static inline int firmware_map_add(resource_size_t start, resource_size_t end, 32static inline int firmware_map_add(u64 start, u64 end, const char *type)
35 const char *type)
36{ 33{
37 return 0; 34 return 0;
38} 35}
39 36
40static inline int firmware_map_add_early(resource_size_t start, 37static inline int firmware_map_add_early(u64 start, u64 end, const char *type)
41 resource_size_t end, const char *type)
42{ 38{
43 return 0; 39 return 0;
44} 40}
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index c8ecf5b2a207..d31544628436 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -5,7 +5,6 @@
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/compiler.h> 6#include <linux/compiler.h>
7 7
8#define FIRMWARE_NAME_MAX 30
9#define FW_ACTION_NOHOTPLUG 0 8#define FW_ACTION_NOHOTPLUG 0
10#define FW_ACTION_HOTPLUG 1 9#define FW_ACTION_HOTPLUG 1
11 10
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3b534e527e09..1ff5e4e01952 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -729,8 +729,8 @@ struct inode {
729 struct timespec i_atime; 729 struct timespec i_atime;
730 struct timespec i_mtime; 730 struct timespec i_mtime;
731 struct timespec i_ctime; 731 struct timespec i_ctime;
732 unsigned int i_blkbits;
733 blkcnt_t i_blocks; 732 blkcnt_t i_blocks;
733 unsigned int i_blkbits;
734 unsigned short i_bytes; 734 unsigned short i_bytes;
735 umode_t i_mode; 735 umode_t i_mode;
736 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ 736 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
@@ -751,13 +751,12 @@ struct inode {
751 struct block_device *i_bdev; 751 struct block_device *i_bdev;
752 struct cdev *i_cdev; 752 struct cdev *i_cdev;
753 }; 753 };
754 int i_cindex;
755 754
756 __u32 i_generation; 755 __u32 i_generation;
757 756
758#ifdef CONFIG_DNOTIFY 757#ifdef CONFIG_FSNOTIFY
759 unsigned long i_dnotify_mask; /* Directory notify events */ 758 __u32 i_fsnotify_mask; /* all events this inode cares about */
760 struct dnotify_struct *i_dnotify; /* for directory notifications */ 759 struct hlist_head i_fsnotify_mark_entries; /* fsnotify mark entries */
761#endif 760#endif
762 761
763#ifdef CONFIG_INOTIFY 762#ifdef CONFIG_INOTIFY
@@ -880,7 +879,7 @@ struct file_ra_state {
880 there are only # of pages ahead */ 879 there are only # of pages ahead */
881 880
882 unsigned int ra_pages; /* Maximum readahead window */ 881 unsigned int ra_pages; /* Maximum readahead window */
883 int mmap_miss; /* Cache miss stat for mmap accesses */ 882 unsigned int mmap_miss; /* Cache miss stat for mmap accesses */
884 loff_t prev_pos; /* Cache last read() position */ 883 loff_t prev_pos; /* Cache last read() position */
885}; 884};
886 885
@@ -1108,6 +1107,7 @@ extern void locks_copy_lock(struct file_lock *, struct file_lock *);
1108extern void __locks_copy_lock(struct file_lock *, const struct file_lock *); 1107extern void __locks_copy_lock(struct file_lock *, const struct file_lock *);
1109extern void locks_remove_posix(struct file *, fl_owner_t); 1108extern void locks_remove_posix(struct file *, fl_owner_t);
1110extern void locks_remove_flock(struct file *); 1109extern void locks_remove_flock(struct file *);
1110extern void locks_release_private(struct file_lock *);
1111extern void posix_test_lock(struct file *, struct file_lock *); 1111extern void posix_test_lock(struct file *, struct file_lock *);
1112extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); 1112extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *);
1113extern int posix_lock_file_wait(struct file *, struct file_lock *); 1113extern int posix_lock_file_wait(struct file *, struct file_lock *);
@@ -1321,7 +1321,7 @@ struct super_block {
1321 struct rw_semaphore s_umount; 1321 struct rw_semaphore s_umount;
1322 struct mutex s_lock; 1322 struct mutex s_lock;
1323 int s_count; 1323 int s_count;
1324 int s_need_sync_fs; 1324 int s_need_sync;
1325 atomic_t s_active; 1325 atomic_t s_active;
1326#ifdef CONFIG_SECURITY 1326#ifdef CONFIG_SECURITY
1327 void *s_security; 1327 void *s_security;
@@ -1372,11 +1372,6 @@ struct super_block {
1372 * generic_show_options() 1372 * generic_show_options()
1373 */ 1373 */
1374 char *s_options; 1374 char *s_options;
1375
1376 /*
1377 * storage for asynchronous operations
1378 */
1379 struct list_head s_async_list;
1380}; 1375};
1381 1376
1382extern struct timespec current_fs_time(struct super_block *sb); 1377extern struct timespec current_fs_time(struct super_block *sb);
@@ -1800,7 +1795,7 @@ extern struct vfsmount *kern_mount_data(struct file_system_type *, void *data);
1800extern int may_umount_tree(struct vfsmount *); 1795extern int may_umount_tree(struct vfsmount *);
1801extern int may_umount(struct vfsmount *); 1796extern int may_umount(struct vfsmount *);
1802extern long do_mount(char *, char *, char *, unsigned long, void *); 1797extern long do_mount(char *, char *, char *, unsigned long, void *);
1803extern struct vfsmount *collect_mounts(struct vfsmount *, struct dentry *); 1798extern struct vfsmount *collect_mounts(struct path *);
1804extern void drop_collected_mounts(struct vfsmount *); 1799extern void drop_collected_mounts(struct vfsmount *);
1805 1800
1806extern int vfs_statfs(struct dentry *, struct kstatfs *); 1801extern int vfs_statfs(struct dentry *, struct kstatfs *);
@@ -1925,8 +1920,9 @@ extern void __init vfs_caches_init(unsigned long);
1925 1920
1926extern struct kmem_cache *names_cachep; 1921extern struct kmem_cache *names_cachep;
1927 1922
1928#define __getname() kmem_cache_alloc(names_cachep, GFP_KERNEL) 1923#define __getname_gfp(gfp) kmem_cache_alloc(names_cachep, (gfp))
1929#define __putname(name) kmem_cache_free(names_cachep, (void *)(name)) 1924#define __getname() __getname_gfp(GFP_KERNEL)
1925#define __putname(name) kmem_cache_free(names_cachep, (void *)(name))
1930#ifndef CONFIG_AUDITSYSCALL 1926#ifndef CONFIG_AUDITSYSCALL
1931#define putname(name) __putname(name) 1927#define putname(name) __putname(name)
1932#else 1928#else
@@ -1947,8 +1943,6 @@ extern struct super_block *freeze_bdev(struct block_device *);
1947extern void emergency_thaw_all(void); 1943extern void emergency_thaw_all(void);
1948extern int thaw_bdev(struct block_device *bdev, struct super_block *sb); 1944extern int thaw_bdev(struct block_device *bdev, struct super_block *sb);
1949extern int fsync_bdev(struct block_device *); 1945extern int fsync_bdev(struct block_device *);
1950extern int fsync_super(struct super_block *);
1951extern int fsync_no_super(struct block_device *);
1952#else 1946#else
1953static inline void bd_forget(struct inode *inode) {} 1947static inline void bd_forget(struct inode *inode) {}
1954static inline int sync_blockdev(struct block_device *bdev) { return 0; } 1948static inline int sync_blockdev(struct block_device *bdev) { return 0; }
@@ -1964,6 +1958,7 @@ static inline int thaw_bdev(struct block_device *bdev, struct super_block *sb)
1964 return 0; 1958 return 0;
1965} 1959}
1966#endif 1960#endif
1961extern int sync_filesystem(struct super_block *);
1967extern const struct file_operations def_blk_fops; 1962extern const struct file_operations def_blk_fops;
1968extern const struct file_operations def_chr_fops; 1963extern const struct file_operations def_chr_fops;
1969extern const struct file_operations bad_sock_fops; 1964extern const struct file_operations bad_sock_fops;
@@ -2043,9 +2038,6 @@ extern int __invalidate_device(struct block_device *);
2043extern int invalidate_partition(struct gendisk *, int); 2038extern int invalidate_partition(struct gendisk *, int);
2044#endif 2039#endif
2045extern int invalidate_inodes(struct super_block *); 2040extern int invalidate_inodes(struct super_block *);
2046unsigned long __invalidate_mapping_pages(struct address_space *mapping,
2047 pgoff_t start, pgoff_t end,
2048 bool be_atomic);
2049unsigned long invalidate_mapping_pages(struct address_space *mapping, 2041unsigned long invalidate_mapping_pages(struct address_space *mapping,
2050 pgoff_t start, pgoff_t end); 2042 pgoff_t start, pgoff_t end);
2051 2043
@@ -2082,12 +2074,8 @@ extern int filemap_fdatawrite_range(struct address_space *mapping,
2082 2074
2083extern int vfs_fsync(struct file *file, struct dentry *dentry, int datasync); 2075extern int vfs_fsync(struct file *file, struct dentry *dentry, int datasync);
2084extern void sync_supers(void); 2076extern void sync_supers(void);
2085extern void sync_filesystems(int wait);
2086extern void __fsync_super(struct super_block *sb);
2087extern void emergency_sync(void); 2077extern void emergency_sync(void);
2088extern void emergency_remount(void); 2078extern void emergency_remount(void);
2089extern int do_remount_sb(struct super_block *sb, int flags,
2090 void *data, int force);
2091#ifdef CONFIG_BLOCK 2079#ifdef CONFIG_BLOCK
2092extern sector_t bmap(struct inode *, sector_t); 2080extern sector_t bmap(struct inode *, sector_t);
2093#endif 2081#endif
@@ -2205,6 +2193,8 @@ extern int generic_segment_checks(const struct iovec *iov,
2205/* fs/splice.c */ 2193/* fs/splice.c */
2206extern ssize_t generic_file_splice_read(struct file *, loff_t *, 2194extern ssize_t generic_file_splice_read(struct file *, loff_t *,
2207 struct pipe_inode_info *, size_t, unsigned int); 2195 struct pipe_inode_info *, size_t, unsigned int);
2196extern ssize_t default_file_splice_read(struct file *, loff_t *,
2197 struct pipe_inode_info *, size_t, unsigned int);
2208extern ssize_t generic_file_splice_write(struct pipe_inode_info *, 2198extern ssize_t generic_file_splice_write(struct pipe_inode_info *,
2209 struct file *, loff_t *, size_t, unsigned int); 2199 struct file *, loff_t *, size_t, unsigned int);
2210extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, 2200extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe,
@@ -2354,6 +2344,8 @@ extern void simple_release_fs(struct vfsmount **mount, int *count);
2354extern ssize_t simple_read_from_buffer(void __user *to, size_t count, 2344extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
2355 loff_t *ppos, const void *from, size_t available); 2345 loff_t *ppos, const void *from, size_t available);
2356 2346
2347extern int simple_fsync(struct file *, struct dentry *, int);
2348
2357#ifdef CONFIG_MIGRATION 2349#ifdef CONFIG_MIGRATION
2358extern int buffer_migrate_page(struct address_space *, 2350extern int buffer_migrate_page(struct address_space *,
2359 struct page *, struct page *); 2351 struct page *, struct page *);
diff --git a/include/linux/fs_enet_pd.h b/include/linux/fs_enet_pd.h
index 8300cab30f9a..51b793466ff3 100644
--- a/include/linux/fs_enet_pd.h
+++ b/include/linux/fs_enet_pd.h
@@ -17,6 +17,7 @@
17#define FS_ENET_PD_H 17#define FS_ENET_PD_H
18 18
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/of_mdio.h>
20#include <asm/types.h> 21#include <asm/types.h>
21 22
22#define FS_ENET_NAME "fs_enet" 23#define FS_ENET_NAME "fs_enet"
@@ -130,10 +131,7 @@ struct fs_platform_info {
130 131
131 u32 device_flags; 132 u32 device_flags;
132 133
133 int phy_addr; /* the phy address (-1 no phy) */ 134 struct device_node *phy_node;
134 char bus_id[16];
135 int phy_irq; /* the phy irq (if it exists) */
136
137 const struct fs_mii_bus_info *bus_info; 135 const struct fs_mii_bus_info *bus_info;
138 136
139 int rx_ring, tx_ring; /* number of buffers on rx */ 137 int rx_ring, tx_ring; /* number of buffers on rx */
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 244677cc082b..43fc95d822d5 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -79,10 +79,6 @@ struct fsl_spi_platform_data {
79 u16 max_chipselect; 79 u16 max_chipselect;
80 void (*cs_control)(struct spi_device *spi, bool on); 80 void (*cs_control)(struct spi_device *spi, bool on);
81 u32 sysclk; 81 u32 sysclk;
82
83 /* Legacy hooks, used by mpc52xx_psc_spi driver. */
84 void (*activate_cs)(u8 cs, u8 polarity);
85 void (*deactivate_cs)(u8 cs, u8 polarity);
86}; 82};
87 83
88struct mpc8xx_pcmcia_ops { 84struct mpc8xx_pcmcia_ops {
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 00fbd5b245c9..936f9aa8bb97 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -13,6 +13,7 @@
13 13
14#include <linux/dnotify.h> 14#include <linux/dnotify.h>
15#include <linux/inotify.h> 15#include <linux/inotify.h>
16#include <linux/fsnotify_backend.h>
16#include <linux/audit.h> 17#include <linux/audit.h>
17 18
18/* 19/*
@@ -22,19 +23,45 @@
22static inline void fsnotify_d_instantiate(struct dentry *entry, 23static inline void fsnotify_d_instantiate(struct dentry *entry,
23 struct inode *inode) 24 struct inode *inode)
24{ 25{
26 __fsnotify_d_instantiate(entry, inode);
27
25 inotify_d_instantiate(entry, inode); 28 inotify_d_instantiate(entry, inode);
26} 29}
27 30
31/* Notify this dentry's parent about a child's events. */
32static inline void fsnotify_parent(struct dentry *dentry, __u32 mask)
33{
34 __fsnotify_parent(dentry, mask);
35
36 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name);
37}
38
28/* 39/*
29 * fsnotify_d_move - entry has been moved 40 * fsnotify_d_move - entry has been moved
30 * Called with dcache_lock and entry->d_lock held. 41 * Called with dcache_lock and entry->d_lock held.
31 */ 42 */
32static inline void fsnotify_d_move(struct dentry *entry) 43static inline void fsnotify_d_move(struct dentry *entry)
33{ 44{
45 /*
46 * On move we need to update entry->d_flags to indicate if the new parent
47 * cares about events from this entry.
48 */
49 __fsnotify_update_dcache_flags(entry);
50
34 inotify_d_move(entry); 51 inotify_d_move(entry);
35} 52}
36 53
37/* 54/*
55 * fsnotify_link_count - inode's link count changed
56 */
57static inline void fsnotify_link_count(struct inode *inode)
58{
59 inotify_inode_queue_event(inode, IN_ATTRIB, 0, NULL, NULL);
60
61 fsnotify(inode, FS_ATTRIB, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
62}
63
64/*
38 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir 65 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir
39 */ 66 */
40static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, 67static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
@@ -42,42 +69,62 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
42 int isdir, struct inode *target, struct dentry *moved) 69 int isdir, struct inode *target, struct dentry *moved)
43{ 70{
44 struct inode *source = moved->d_inode; 71 struct inode *source = moved->d_inode;
45 u32 cookie = inotify_get_cookie(); 72 u32 in_cookie = inotify_get_cookie();
73 u32 fs_cookie = fsnotify_get_cookie();
74 __u32 old_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_FROM);
75 __u32 new_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_TO);
46 76
47 if (old_dir == new_dir) 77 if (old_dir == new_dir)
48 inode_dir_notify(old_dir, DN_RENAME); 78 old_dir_mask |= FS_DN_RENAME;
49 else {
50 inode_dir_notify(old_dir, DN_DELETE);
51 inode_dir_notify(new_dir, DN_CREATE);
52 }
53 79
54 if (isdir) 80 if (isdir) {
55 isdir = IN_ISDIR; 81 isdir = IN_ISDIR;
56 inotify_inode_queue_event(old_dir, IN_MOVED_FROM|isdir,cookie,old_name, 82 old_dir_mask |= FS_IN_ISDIR;
83 new_dir_mask |= FS_IN_ISDIR;
84 }
85
86 inotify_inode_queue_event(old_dir, IN_MOVED_FROM|isdir, in_cookie, old_name,
57 source); 87 source);
58 inotify_inode_queue_event(new_dir, IN_MOVED_TO|isdir, cookie, new_name, 88 inotify_inode_queue_event(new_dir, IN_MOVED_TO|isdir, in_cookie, new_name,
59 source); 89 source);
60 90
91 fsnotify(old_dir, old_dir_mask, old_dir, FSNOTIFY_EVENT_INODE, old_name, fs_cookie);
92 fsnotify(new_dir, new_dir_mask, new_dir, FSNOTIFY_EVENT_INODE, new_name, fs_cookie);
93
61 if (target) { 94 if (target) {
62 inotify_inode_queue_event(target, IN_DELETE_SELF, 0, NULL, NULL); 95 inotify_inode_queue_event(target, IN_DELETE_SELF, 0, NULL, NULL);
63 inotify_inode_is_dead(target); 96 inotify_inode_is_dead(target);
97
98 /* this is really a link_count change not a removal */
99 fsnotify_link_count(target);
64 } 100 }
65 101
66 if (source) { 102 if (source) {
67 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL); 103 inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL, NULL);
104 fsnotify(source, FS_MOVE_SELF, moved->d_inode, FSNOTIFY_EVENT_INODE, NULL, 0);
68 } 105 }
69 audit_inode_child(new_name, moved, new_dir); 106 audit_inode_child(new_name, moved, new_dir);
70} 107}
71 108
72/* 109/*
110 * fsnotify_inode_delete - and inode is being evicted from cache, clean up is needed
111 */
112static inline void fsnotify_inode_delete(struct inode *inode)
113{
114 __fsnotify_inode_delete(inode);
115}
116
117/*
73 * fsnotify_nameremove - a filename was removed from a directory 118 * fsnotify_nameremove - a filename was removed from a directory
74 */ 119 */
75static inline void fsnotify_nameremove(struct dentry *dentry, int isdir) 120static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
76{ 121{
122 __u32 mask = FS_DELETE;
123
77 if (isdir) 124 if (isdir)
78 isdir = IN_ISDIR; 125 mask |= FS_IN_ISDIR;
79 dnotify_parent(dentry, DN_DELETE); 126
80 inotify_dentry_parent_queue_event(dentry, IN_DELETE|isdir, 0, dentry->d_name.name); 127 fsnotify_parent(dentry, mask);
81} 128}
82 129
83/* 130/*
@@ -87,14 +134,9 @@ static inline void fsnotify_inoderemove(struct inode *inode)
87{ 134{
88 inotify_inode_queue_event(inode, IN_DELETE_SELF, 0, NULL, NULL); 135 inotify_inode_queue_event(inode, IN_DELETE_SELF, 0, NULL, NULL);
89 inotify_inode_is_dead(inode); 136 inotify_inode_is_dead(inode);
90}
91 137
92/* 138 fsnotify(inode, FS_DELETE_SELF, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
93 * fsnotify_link_count - inode's link count changed 139 __fsnotify_inode_delete(inode);
94 */
95static inline void fsnotify_link_count(struct inode *inode)
96{
97 inotify_inode_queue_event(inode, IN_ATTRIB, 0, NULL, NULL);
98} 140}
99 141
100/* 142/*
@@ -102,10 +144,11 @@ static inline void fsnotify_link_count(struct inode *inode)
102 */ 144 */
103static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) 145static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
104{ 146{
105 inode_dir_notify(inode, DN_CREATE);
106 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name, 147 inotify_inode_queue_event(inode, IN_CREATE, 0, dentry->d_name.name,
107 dentry->d_inode); 148 dentry->d_inode);
108 audit_inode_child(dentry->d_name.name, dentry, inode); 149 audit_inode_child(dentry->d_name.name, dentry, inode);
150
151 fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0);
109} 152}
110 153
111/* 154/*
@@ -115,11 +158,12 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
115 */ 158 */
116static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry) 159static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry)
117{ 160{
118 inode_dir_notify(dir, DN_CREATE);
119 inotify_inode_queue_event(dir, IN_CREATE, 0, new_dentry->d_name.name, 161 inotify_inode_queue_event(dir, IN_CREATE, 0, new_dentry->d_name.name,
120 inode); 162 inode);
121 fsnotify_link_count(inode); 163 fsnotify_link_count(inode);
122 audit_inode_child(new_dentry->d_name.name, new_dentry, dir); 164 audit_inode_child(new_dentry->d_name.name, new_dentry, dir);
165
166 fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, new_dentry->d_name.name, 0);
123} 167}
124 168
125/* 169/*
@@ -127,10 +171,13 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct
127 */ 171 */
128static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) 172static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
129{ 173{
130 inode_dir_notify(inode, DN_CREATE); 174 __u32 mask = (FS_CREATE | FS_IN_ISDIR);
131 inotify_inode_queue_event(inode, IN_CREATE | IN_ISDIR, 0, 175 struct inode *d_inode = dentry->d_inode;
132 dentry->d_name.name, dentry->d_inode); 176
177 inotify_inode_queue_event(inode, mask, 0, dentry->d_name.name, d_inode);
133 audit_inode_child(dentry->d_name.name, dentry, inode); 178 audit_inode_child(dentry->d_name.name, dentry, inode);
179
180 fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0);
134} 181}
135 182
136/* 183/*
@@ -139,14 +186,15 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
139static inline void fsnotify_access(struct dentry *dentry) 186static inline void fsnotify_access(struct dentry *dentry)
140{ 187{
141 struct inode *inode = dentry->d_inode; 188 struct inode *inode = dentry->d_inode;
142 u32 mask = IN_ACCESS; 189 __u32 mask = FS_ACCESS;
143 190
144 if (S_ISDIR(inode->i_mode)) 191 if (S_ISDIR(inode->i_mode))
145 mask |= IN_ISDIR; 192 mask |= FS_IN_ISDIR;
146 193
147 dnotify_parent(dentry, DN_ACCESS);
148 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name);
149 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 194 inotify_inode_queue_event(inode, mask, 0, NULL, NULL);
195
196 fsnotify_parent(dentry, mask);
197 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
150} 198}
151 199
152/* 200/*
@@ -155,14 +203,15 @@ static inline void fsnotify_access(struct dentry *dentry)
155static inline void fsnotify_modify(struct dentry *dentry) 203static inline void fsnotify_modify(struct dentry *dentry)
156{ 204{
157 struct inode *inode = dentry->d_inode; 205 struct inode *inode = dentry->d_inode;
158 u32 mask = IN_MODIFY; 206 __u32 mask = FS_MODIFY;
159 207
160 if (S_ISDIR(inode->i_mode)) 208 if (S_ISDIR(inode->i_mode))
161 mask |= IN_ISDIR; 209 mask |= FS_IN_ISDIR;
162 210
163 dnotify_parent(dentry, DN_MODIFY);
164 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name);
165 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 211 inotify_inode_queue_event(inode, mask, 0, NULL, NULL);
212
213 fsnotify_parent(dentry, mask);
214 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
166} 215}
167 216
168/* 217/*
@@ -171,13 +220,15 @@ static inline void fsnotify_modify(struct dentry *dentry)
171static inline void fsnotify_open(struct dentry *dentry) 220static inline void fsnotify_open(struct dentry *dentry)
172{ 221{
173 struct inode *inode = dentry->d_inode; 222 struct inode *inode = dentry->d_inode;
174 u32 mask = IN_OPEN; 223 __u32 mask = FS_OPEN;
175 224
176 if (S_ISDIR(inode->i_mode)) 225 if (S_ISDIR(inode->i_mode))
177 mask |= IN_ISDIR; 226 mask |= FS_IN_ISDIR;
178 227
179 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name);
180 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 228 inotify_inode_queue_event(inode, mask, 0, NULL, NULL);
229
230 fsnotify_parent(dentry, mask);
231 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
181} 232}
182 233
183/* 234/*
@@ -187,15 +238,16 @@ static inline void fsnotify_close(struct file *file)
187{ 238{
188 struct dentry *dentry = file->f_path.dentry; 239 struct dentry *dentry = file->f_path.dentry;
189 struct inode *inode = dentry->d_inode; 240 struct inode *inode = dentry->d_inode;
190 const char *name = dentry->d_name.name;
191 fmode_t mode = file->f_mode; 241 fmode_t mode = file->f_mode;
192 u32 mask = (mode & FMODE_WRITE) ? IN_CLOSE_WRITE : IN_CLOSE_NOWRITE; 242 __u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE;
193 243
194 if (S_ISDIR(inode->i_mode)) 244 if (S_ISDIR(inode->i_mode))
195 mask |= IN_ISDIR; 245 mask |= FS_IN_ISDIR;
196 246
197 inotify_dentry_parent_queue_event(dentry, mask, 0, name);
198 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 247 inotify_inode_queue_event(inode, mask, 0, NULL, NULL);
248
249 fsnotify_parent(dentry, mask);
250 fsnotify(inode, mask, file, FSNOTIFY_EVENT_FILE, NULL, 0);
199} 251}
200 252
201/* 253/*
@@ -204,13 +256,15 @@ static inline void fsnotify_close(struct file *file)
204static inline void fsnotify_xattr(struct dentry *dentry) 256static inline void fsnotify_xattr(struct dentry *dentry)
205{ 257{
206 struct inode *inode = dentry->d_inode; 258 struct inode *inode = dentry->d_inode;
207 u32 mask = IN_ATTRIB; 259 __u32 mask = FS_ATTRIB;
208 260
209 if (S_ISDIR(inode->i_mode)) 261 if (S_ISDIR(inode->i_mode))
210 mask |= IN_ISDIR; 262 mask |= FS_IN_ISDIR;
211 263
212 inotify_dentry_parent_queue_event(dentry, mask, 0, dentry->d_name.name);
213 inotify_inode_queue_event(inode, mask, 0, NULL, NULL); 264 inotify_inode_queue_event(inode, mask, 0, NULL, NULL);
265
266 fsnotify_parent(dentry, mask);
267 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
214} 268}
215 269
216/* 270/*
@@ -220,50 +274,37 @@ static inline void fsnotify_xattr(struct dentry *dentry)
220static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid) 274static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid)
221{ 275{
222 struct inode *inode = dentry->d_inode; 276 struct inode *inode = dentry->d_inode;
223 int dn_mask = 0; 277 __u32 mask = 0;
224 u32 in_mask = 0; 278
279 if (ia_valid & ATTR_UID)
280 mask |= FS_ATTRIB;
281 if (ia_valid & ATTR_GID)
282 mask |= FS_ATTRIB;
283 if (ia_valid & ATTR_SIZE)
284 mask |= FS_MODIFY;
225 285
226 if (ia_valid & ATTR_UID) {
227 in_mask |= IN_ATTRIB;
228 dn_mask |= DN_ATTRIB;
229 }
230 if (ia_valid & ATTR_GID) {
231 in_mask |= IN_ATTRIB;
232 dn_mask |= DN_ATTRIB;
233 }
234 if (ia_valid & ATTR_SIZE) {
235 in_mask |= IN_MODIFY;
236 dn_mask |= DN_MODIFY;
237 }
238 /* both times implies a utime(s) call */ 286 /* both times implies a utime(s) call */
239 if ((ia_valid & (ATTR_ATIME | ATTR_MTIME)) == (ATTR_ATIME | ATTR_MTIME)) 287 if ((ia_valid & (ATTR_ATIME | ATTR_MTIME)) == (ATTR_ATIME | ATTR_MTIME))
240 { 288 mask |= FS_ATTRIB;
241 in_mask |= IN_ATTRIB; 289 else if (ia_valid & ATTR_ATIME)
242 dn_mask |= DN_ATTRIB; 290 mask |= FS_ACCESS;
243 } else if (ia_valid & ATTR_ATIME) { 291 else if (ia_valid & ATTR_MTIME)
244 in_mask |= IN_ACCESS; 292 mask |= FS_MODIFY;
245 dn_mask |= DN_ACCESS; 293
246 } else if (ia_valid & ATTR_MTIME) { 294 if (ia_valid & ATTR_MODE)
247 in_mask |= IN_MODIFY; 295 mask |= FS_ATTRIB;
248 dn_mask |= DN_MODIFY;
249 }
250 if (ia_valid & ATTR_MODE) {
251 in_mask |= IN_ATTRIB;
252 dn_mask |= DN_ATTRIB;
253 }
254 296
255 if (dn_mask) 297 if (mask) {
256 dnotify_parent(dentry, dn_mask);
257 if (in_mask) {
258 if (S_ISDIR(inode->i_mode)) 298 if (S_ISDIR(inode->i_mode))
259 in_mask |= IN_ISDIR; 299 mask |= FS_IN_ISDIR;
260 inotify_inode_queue_event(inode, in_mask, 0, NULL, NULL); 300 inotify_inode_queue_event(inode, mask, 0, NULL, NULL);
261 inotify_dentry_parent_queue_event(dentry, in_mask, 0, 301
262 dentry->d_name.name); 302 fsnotify_parent(dentry, mask);
303 fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
263 } 304 }
264} 305}
265 306
266#ifdef CONFIG_INOTIFY /* inotify helpers */ 307#if defined(CONFIG_INOTIFY) || defined(CONFIG_FSNOTIFY) /* notify helpers */
267 308
268/* 309/*
269 * fsnotify_oldname_init - save off the old filename before we change it 310 * fsnotify_oldname_init - save off the old filename before we change it
@@ -281,7 +322,7 @@ static inline void fsnotify_oldname_free(const char *old_name)
281 kfree(old_name); 322 kfree(old_name);
282} 323}
283 324
284#else /* CONFIG_INOTIFY */ 325#else /* CONFIG_INOTIFY || CONFIG_FSNOTIFY */
285 326
286static inline const char *fsnotify_oldname_init(const char *name) 327static inline const char *fsnotify_oldname_init(const char *name)
287{ 328{
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
new file mode 100644
index 000000000000..44848aa830dc
--- /dev/null
+++ b/include/linux/fsnotify_backend.h
@@ -0,0 +1,387 @@
1/*
2 * Filesystem access notification for Linux
3 *
4 * Copyright (C) 2008 Red Hat, Inc., Eric Paris <eparis@redhat.com>
5 */
6
7#ifndef __LINUX_FSNOTIFY_BACKEND_H
8#define __LINUX_FSNOTIFY_BACKEND_H
9
10#ifdef __KERNEL__
11
12#include <linux/idr.h> /* inotify uses this */
13#include <linux/fs.h> /* struct inode */
14#include <linux/list.h>
15#include <linux/path.h> /* struct path */
16#include <linux/spinlock.h>
17#include <linux/types.h>
18
19#include <asm/atomic.h>
20
21/*
22 * IN_* from inotfy.h lines up EXACTLY with FS_*, this is so we can easily
23 * convert between them. dnotify only needs conversion at watch creation
24 * so no perf loss there. fanotify isn't defined yet, so it can use the
25 * wholes if it needs more events.
26 */
27#define FS_ACCESS 0x00000001 /* File was accessed */
28#define FS_MODIFY 0x00000002 /* File was modified */
29#define FS_ATTRIB 0x00000004 /* Metadata changed */
30#define FS_CLOSE_WRITE 0x00000008 /* Writtable file was closed */
31#define FS_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed */
32#define FS_OPEN 0x00000020 /* File was opened */
33#define FS_MOVED_FROM 0x00000040 /* File was moved from X */
34#define FS_MOVED_TO 0x00000080 /* File was moved to Y */
35#define FS_CREATE 0x00000100 /* Subfile was created */
36#define FS_DELETE 0x00000200 /* Subfile was deleted */
37#define FS_DELETE_SELF 0x00000400 /* Self was deleted */
38#define FS_MOVE_SELF 0x00000800 /* Self was moved */
39
40#define FS_UNMOUNT 0x00002000 /* inode on umount fs */
41#define FS_Q_OVERFLOW 0x00004000 /* Event queued overflowed */
42#define FS_IN_IGNORED 0x00008000 /* last inotify event here */
43
44#define FS_IN_ISDIR 0x40000000 /* event occurred against dir */
45#define FS_IN_ONESHOT 0x80000000 /* only send event once */
46
47#define FS_DN_RENAME 0x10000000 /* file renamed */
48#define FS_DN_MULTISHOT 0x20000000 /* dnotify multishot */
49
50/* This inode cares about things that happen to its children. Always set for
51 * dnotify and inotify. */
52#define FS_EVENT_ON_CHILD 0x08000000
53
54/* This is a list of all events that may get sent to a parernt based on fs event
55 * happening to inodes inside that directory */
56#define FS_EVENTS_POSS_ON_CHILD (FS_ACCESS | FS_MODIFY | FS_ATTRIB |\
57 FS_CLOSE_WRITE | FS_CLOSE_NOWRITE | FS_OPEN |\
58 FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE |\
59 FS_DELETE)
60
61/* listeners that hard code group numbers near the top */
62#define DNOTIFY_GROUP_NUM UINT_MAX
63#define INOTIFY_GROUP_NUM (DNOTIFY_GROUP_NUM-1)
64
65struct fsnotify_group;
66struct fsnotify_event;
67struct fsnotify_mark_entry;
68struct fsnotify_event_private_data;
69
70/*
71 * Each group much define these ops. The fsnotify infrastructure will call
72 * these operations for each relevant group.
73 *
74 * should_send_event - given a group, inode, and mask this function determines
75 * if the group is interested in this event.
76 * handle_event - main call for a group to handle an fs event
77 * free_group_priv - called when a group refcnt hits 0 to clean up the private union
78 * freeing-mark - this means that a mark has been flagged to die when everything
79 * finishes using it. The function is supplied with what must be a
80 * valid group and inode to use to clean up.
81 */
82struct fsnotify_ops {
83 bool (*should_send_event)(struct fsnotify_group *group, struct inode *inode, __u32 mask);
84 int (*handle_event)(struct fsnotify_group *group, struct fsnotify_event *event);
85 void (*free_group_priv)(struct fsnotify_group *group);
86 void (*freeing_mark)(struct fsnotify_mark_entry *entry, struct fsnotify_group *group);
87 void (*free_event_priv)(struct fsnotify_event_private_data *priv);
88};
89
90/*
91 * A group is a "thing" that wants to receive notification about filesystem
92 * events. The mask holds the subset of event types this group cares about.
93 * refcnt on a group is up to the implementor and at any moment if it goes 0
94 * everything will be cleaned up.
95 */
96struct fsnotify_group {
97 /*
98 * global list of all groups receiving events from fsnotify.
99 * anchored by fsnotify_groups and protected by either fsnotify_grp_mutex
100 * or fsnotify_grp_srcu depending on write vs read.
101 */
102 struct list_head group_list;
103
104 /*
105 * Defines all of the event types in which this group is interested.
106 * This mask is a bitwise OR of the FS_* events from above. Each time
107 * this mask changes for a group (if it changes) the correct functions
108 * must be called to update the global structures which indicate global
109 * interest in event types.
110 */
111 __u32 mask;
112
113 /*
114 * How the refcnt is used is up to each group. When the refcnt hits 0
115 * fsnotify will clean up all of the resources associated with this group.
116 * As an example, the dnotify group will always have a refcnt=1 and that
117 * will never change. Inotify, on the other hand, has a group per
118 * inotify_init() and the refcnt will hit 0 only when that fd has been
119 * closed.
120 */
121 atomic_t refcnt; /* things with interest in this group */
122 unsigned int group_num; /* simply prevents accidental group collision */
123
124 const struct fsnotify_ops *ops; /* how this group handles things */
125
126 /* needed to send notification to userspace */
127 struct mutex notification_mutex; /* protect the notification_list */
128 struct list_head notification_list; /* list of event_holder this group needs to send to userspace */
129 wait_queue_head_t notification_waitq; /* read() on the notification file blocks on this waitq */
130 unsigned int q_len; /* events on the queue */
131 unsigned int max_events; /* maximum events allowed on the list */
132
133 /* stores all fastapth entries assoc with this group so they can be cleaned on unregister */
134 spinlock_t mark_lock; /* protect mark_entries list */
135 atomic_t num_marks; /* 1 for each mark entry and 1 for not being
136 * past the point of no return when freeing
137 * a group */
138 struct list_head mark_entries; /* all inode mark entries for this group */
139
140 /* prevents double list_del of group_list. protected by global fsnotify_grp_mutex */
141 bool on_group_list;
142
143 /* groups can define private fields here or use the void *private */
144 union {
145 void *private;
146#ifdef CONFIG_INOTIFY_USER
147 struct inotify_group_private_data {
148 spinlock_t idr_lock;
149 struct idr idr;
150 u32 last_wd;
151 struct fasync_struct *fa; /* async notification */
152 struct user_struct *user;
153 } inotify_data;
154#endif
155 };
156};
157
158/*
159 * A single event can be queued in multiple group->notification_lists.
160 *
161 * each group->notification_list will point to an event_holder which in turns points
162 * to the actual event that needs to be sent to userspace.
163 *
164 * Seemed cheaper to create a refcnt'd event and a small holder for every group
165 * than create a different event for every group
166 *
167 */
168struct fsnotify_event_holder {
169 struct fsnotify_event *event;
170 struct list_head event_list;
171};
172
173/*
174 * Inotify needs to tack data onto an event. This struct lets us later find the
175 * correct private data of the correct group.
176 */
177struct fsnotify_event_private_data {
178 struct fsnotify_group *group;
179 struct list_head event_list;
180};
181
182/*
183 * all of the information about the original object we want to now send to
184 * a group. If you want to carry more info from the accessing task to the
185 * listener this structure is where you need to be adding fields.
186 */
187struct fsnotify_event {
188 /*
189 * If we create an event we are also likely going to need a holder
190 * to link to a group. So embed one holder in the event. Means only
191 * one allocation for the common case where we only have one group
192 */
193 struct fsnotify_event_holder holder;
194 spinlock_t lock; /* protection for the associated event_holder and private_list */
195 /* to_tell may ONLY be dereferenced during handle_event(). */
196 struct inode *to_tell; /* either the inode the event happened to or its parent */
197 /*
198 * depending on the event type we should have either a path or inode
199 * We hold a reference on path, but NOT on inode. Since we have the ref on
200 * the path, it may be dereferenced at any point during this object's
201 * lifetime. That reference is dropped when this object's refcnt hits
202 * 0. If this event contains an inode instead of a path, the inode may
203 * ONLY be used during handle_event().
204 */
205 union {
206 struct path path;
207 struct inode *inode;
208 };
209/* when calling fsnotify tell it if the data is a path or inode */
210#define FSNOTIFY_EVENT_NONE 0
211#define FSNOTIFY_EVENT_PATH 1
212#define FSNOTIFY_EVENT_INODE 2
213#define FSNOTIFY_EVENT_FILE 3
214 int data_type; /* which of the above union we have */
215 atomic_t refcnt; /* how many groups still are using/need to send this event */
216 __u32 mask; /* the type of access, bitwise OR for FS_* event types */
217
218 u32 sync_cookie; /* used to corrolate events, namely inotify mv events */
219 char *file_name;
220 size_t name_len;
221
222 struct list_head private_data_list; /* groups can store private data here */
223};
224
225/*
226 * a mark is simply an entry attached to an in core inode which allows an
227 * fsnotify listener to indicate they are either no longer interested in events
228 * of a type matching mask or only interested in those events.
229 *
230 * these are flushed when an inode is evicted from core and may be flushed
231 * when the inode is modified (as seen by fsnotify_access). Some fsnotify users
232 * (such as dnotify) will flush these when the open fd is closed and not at
233 * inode eviction or modification.
234 */
235struct fsnotify_mark_entry {
236 __u32 mask; /* mask this mark entry is for */
237 /* we hold ref for each i_list and g_list. also one ref for each 'thing'
238 * in kernel that found and may be using this mark. */
239 atomic_t refcnt; /* active things looking at this mark */
240 struct inode *inode; /* inode this entry is associated with */
241 struct fsnotify_group *group; /* group this mark entry is for */
242 struct hlist_node i_list; /* list of mark_entries by inode->i_fsnotify_mark_entries */
243 struct list_head g_list; /* list of mark_entries by group->i_fsnotify_mark_entries */
244 spinlock_t lock; /* protect group, inode, and killme */
245 struct list_head free_i_list; /* tmp list used when freeing this mark */
246 struct list_head free_g_list; /* tmp list used when freeing this mark */
247 void (*free_mark)(struct fsnotify_mark_entry *entry); /* called on final put+free */
248};
249
250#ifdef CONFIG_FSNOTIFY
251
252/* called from the vfs helpers */
253
254/* main fsnotify call to send events */
255extern void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
256 const char *name, u32 cookie);
257extern void __fsnotify_parent(struct dentry *dentry, __u32 mask);
258extern void __fsnotify_inode_delete(struct inode *inode);
259extern u32 fsnotify_get_cookie(void);
260
261static inline int fsnotify_inode_watches_children(struct inode *inode)
262{
263 /* FS_EVENT_ON_CHILD is set if the inode may care */
264 if (!(inode->i_fsnotify_mask & FS_EVENT_ON_CHILD))
265 return 0;
266 /* this inode might care about child events, does it care about the
267 * specific set of events that can happen on a child? */
268 return inode->i_fsnotify_mask & FS_EVENTS_POSS_ON_CHILD;
269}
270
271/*
272 * Update the dentry with a flag indicating the interest of its parent to receive
273 * filesystem events when those events happens to this dentry->d_inode.
274 */
275static inline void __fsnotify_update_dcache_flags(struct dentry *dentry)
276{
277 struct dentry *parent;
278
279 assert_spin_locked(&dcache_lock);
280 assert_spin_locked(&dentry->d_lock);
281
282 parent = dentry->d_parent;
283 if (fsnotify_inode_watches_children(parent->d_inode))
284 dentry->d_flags |= DCACHE_FSNOTIFY_PARENT_WATCHED;
285 else
286 dentry->d_flags &= ~DCACHE_FSNOTIFY_PARENT_WATCHED;
287}
288
289/*
290 * fsnotify_d_instantiate - instantiate a dentry for inode
291 * Called with dcache_lock held.
292 */
293static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode *inode)
294{
295 if (!inode)
296 return;
297
298 assert_spin_locked(&dcache_lock);
299
300 spin_lock(&dentry->d_lock);
301 __fsnotify_update_dcache_flags(dentry);
302 spin_unlock(&dentry->d_lock);
303}
304
305/* called from fsnotify listeners, such as fanotify or dnotify */
306
307/* must call when a group changes its ->mask */
308extern void fsnotify_recalc_global_mask(void);
309/* get a reference to an existing or create a new group */
310extern struct fsnotify_group *fsnotify_obtain_group(unsigned int group_num,
311 __u32 mask,
312 const struct fsnotify_ops *ops);
313/* run all marks associated with this group and update group->mask */
314extern void fsnotify_recalc_group_mask(struct fsnotify_group *group);
315/* drop reference on a group from fsnotify_obtain_group */
316extern void fsnotify_put_group(struct fsnotify_group *group);
317
318/* take a reference to an event */
319extern void fsnotify_get_event(struct fsnotify_event *event);
320extern void fsnotify_put_event(struct fsnotify_event *event);
321/* find private data previously attached to an event and unlink it */
322extern struct fsnotify_event_private_data *fsnotify_remove_priv_from_event(struct fsnotify_group *group,
323 struct fsnotify_event *event);
324
325/* attach the event to the group notification queue */
326extern int fsnotify_add_notify_event(struct fsnotify_group *group, struct fsnotify_event *event,
327 struct fsnotify_event_private_data *priv);
328/* true if the group notification queue is empty */
329extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group);
330/* return, but do not dequeue the first event on the notification queue */
331extern struct fsnotify_event *fsnotify_peek_notify_event(struct fsnotify_group *group);
332/* return AND dequeue the first event on the notification queue */
333extern struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group);
334
335/* functions used to manipulate the marks attached to inodes */
336
337/* run all marks associated with an inode and update inode->i_fsnotify_mask */
338extern void fsnotify_recalc_inode_mask(struct inode *inode);
339extern void fsnotify_init_mark(struct fsnotify_mark_entry *entry, void (*free_mark)(struct fsnotify_mark_entry *entry));
340/* find (and take a reference) to a mark associated with group and inode */
341extern struct fsnotify_mark_entry *fsnotify_find_mark_entry(struct fsnotify_group *group, struct inode *inode);
342/* attach the mark to both the group and the inode */
343extern int fsnotify_add_mark(struct fsnotify_mark_entry *entry, struct fsnotify_group *group, struct inode *inode);
344/* given a mark, flag it to be freed when all references are dropped */
345extern void fsnotify_destroy_mark_by_entry(struct fsnotify_mark_entry *entry);
346/* run all the marks in a group, and flag them to be freed */
347extern void fsnotify_clear_marks_by_group(struct fsnotify_group *group);
348extern void fsnotify_get_mark(struct fsnotify_mark_entry *entry);
349extern void fsnotify_put_mark(struct fsnotify_mark_entry *entry);
350extern void fsnotify_unmount_inodes(struct list_head *list);
351
352/* put here because inotify does some weird stuff when destroying watches */
353extern struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask,
354 void *data, int data_is, const char *name,
355 u32 cookie);
356
357#else
358
359static inline void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
360 const char *name, u32 cookie)
361{}
362
363static inline void __fsnotify_parent(struct dentry *dentry, __u32 mask)
364{}
365
366static inline void __fsnotify_inode_delete(struct inode *inode)
367{}
368
369static inline void __fsnotify_update_dcache_flags(struct dentry *dentry)
370{}
371
372static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode *inode)
373{}
374
375static inline u32 fsnotify_get_cookie(void)
376{
377 return 0;
378}
379
380static inline void fsnotify_unmount_inodes(struct list_head *list)
381{}
382
383#endif /* CONFIG_FSNOTIFY */
384
385#endif /* __KERNEL __ */
386
387#endif /* __LINUX_FSNOTIFY_BACKEND_H */
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 8a0c2f221e6b..dc3b1328aaeb 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -233,8 +233,6 @@ extern int ftrace_arch_read_dyn_info(char *buf, int size);
233 233
234extern int skip_trace(unsigned long ip); 234extern int skip_trace(unsigned long ip);
235 235
236extern void ftrace_release(void *start, unsigned long size);
237
238extern void ftrace_disable_daemon(void); 236extern void ftrace_disable_daemon(void);
239extern void ftrace_enable_daemon(void); 237extern void ftrace_enable_daemon(void);
240#else 238#else
@@ -325,13 +323,8 @@ static inline void __ftrace_enabled_restore(int enabled)
325 323
326#ifdef CONFIG_FTRACE_MCOUNT_RECORD 324#ifdef CONFIG_FTRACE_MCOUNT_RECORD
327extern void ftrace_init(void); 325extern void ftrace_init(void);
328extern void ftrace_init_module(struct module *mod,
329 unsigned long *start, unsigned long *end);
330#else 326#else
331static inline void ftrace_init(void) { } 327static inline void ftrace_init(void) { }
332static inline void
333ftrace_init_module(struct module *mod,
334 unsigned long *start, unsigned long *end) { }
335#endif 328#endif
336 329
337/* 330/*
@@ -368,6 +361,8 @@ struct ftrace_ret_stack {
368 unsigned long ret; 361 unsigned long ret;
369 unsigned long func; 362 unsigned long func;
370 unsigned long long calltime; 363 unsigned long long calltime;
364 unsigned long long subtime;
365 unsigned long fp;
371}; 366};
372 367
373/* 368/*
@@ -378,9 +373,8 @@ struct ftrace_ret_stack {
378extern void return_to_handler(void); 373extern void return_to_handler(void);
379 374
380extern int 375extern int
381ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth); 376ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth,
382extern void 377 unsigned long frame_pointer);
383ftrace_pop_return_trace(struct ftrace_graph_ret *trace, unsigned long *ret);
384 378
385/* 379/*
386 * Sometimes we don't want to trace a function with the function 380 * Sometimes we don't want to trace a function with the function
@@ -496,8 +490,15 @@ static inline int test_tsk_trace_graph(struct task_struct *tsk)
496 490
497extern int ftrace_dump_on_oops; 491extern int ftrace_dump_on_oops;
498 492
493#ifdef CONFIG_PREEMPT
494#define INIT_TRACE_RECURSION .trace_recursion = 0,
495#endif
496
499#endif /* CONFIG_TRACING */ 497#endif /* CONFIG_TRACING */
500 498
499#ifndef INIT_TRACE_RECURSION
500#define INIT_TRACE_RECURSION
501#endif
501 502
502#ifdef CONFIG_HW_BRANCH_TRACER 503#ifdef CONFIG_HW_BRANCH_TRACER
503 504
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
new file mode 100644
index 000000000000..5c093ffc655b
--- /dev/null
+++ b/include/linux/ftrace_event.h
@@ -0,0 +1,172 @@
1#ifndef _LINUX_FTRACE_EVENT_H
2#define _LINUX_FTRACE_EVENT_H
3
4#include <linux/trace_seq.h>
5#include <linux/ring_buffer.h>
6#include <linux/percpu.h>
7
8struct trace_array;
9struct tracer;
10struct dentry;
11
12DECLARE_PER_CPU(struct trace_seq, ftrace_event_seq);
13
14struct trace_print_flags {
15 unsigned long mask;
16 const char *name;
17};
18
19const char *ftrace_print_flags_seq(struct trace_seq *p, const char *delim,
20 unsigned long flags,
21 const struct trace_print_flags *flag_array);
22
23const char *ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val,
24 const struct trace_print_flags *symbol_array);
25
26/*
27 * The trace entry - the most basic unit of tracing. This is what
28 * is printed in the end as a single line in the trace output, such as:
29 *
30 * bash-15816 [01] 235.197585: idle_cpu <- irq_enter
31 */
32struct trace_entry {
33 unsigned short type;
34 unsigned char flags;
35 unsigned char preempt_count;
36 int pid;
37 int tgid;
38};
39
40#define FTRACE_MAX_EVENT \
41 ((1 << (sizeof(((struct trace_entry *)0)->type) * 8)) - 1)
42
43/*
44 * Trace iterator - used by printout routines who present trace
45 * results to users and which routines might sleep, etc:
46 */
47struct trace_iterator {
48 struct trace_array *tr;
49 struct tracer *trace;
50 void *private;
51 int cpu_file;
52 struct mutex mutex;
53 struct ring_buffer_iter *buffer_iter[NR_CPUS];
54 unsigned long iter_flags;
55
56 /* The below is zeroed out in pipe_read */
57 struct trace_seq seq;
58 struct trace_entry *ent;
59 int cpu;
60 u64 ts;
61
62 loff_t pos;
63 long idx;
64
65 cpumask_var_t started;
66};
67
68
69typedef enum print_line_t (*trace_print_func)(struct trace_iterator *iter,
70 int flags);
71struct trace_event {
72 struct hlist_node node;
73 struct list_head list;
74 int type;
75 trace_print_func trace;
76 trace_print_func raw;
77 trace_print_func hex;
78 trace_print_func binary;
79};
80
81extern int register_ftrace_event(struct trace_event *event);
82extern int unregister_ftrace_event(struct trace_event *event);
83
84/* Return values for print_line callback */
85enum print_line_t {
86 TRACE_TYPE_PARTIAL_LINE = 0, /* Retry after flushing the seq */
87 TRACE_TYPE_HANDLED = 1,
88 TRACE_TYPE_UNHANDLED = 2, /* Relay to other output functions */
89 TRACE_TYPE_NO_CONSUME = 3 /* Handled but ask to not consume */
90};
91
92
93struct ring_buffer_event *
94trace_current_buffer_lock_reserve(int type, unsigned long len,
95 unsigned long flags, int pc);
96void trace_current_buffer_unlock_commit(struct ring_buffer_event *event,
97 unsigned long flags, int pc);
98void trace_nowake_buffer_unlock_commit(struct ring_buffer_event *event,
99 unsigned long flags, int pc);
100void trace_current_buffer_discard_commit(struct ring_buffer_event *event);
101
102void tracing_record_cmdline(struct task_struct *tsk);
103
104struct ftrace_event_call {
105 struct list_head list;
106 char *name;
107 char *system;
108 struct dentry *dir;
109 struct trace_event *event;
110 int enabled;
111 int (*regfunc)(void);
112 void (*unregfunc)(void);
113 int id;
114 int (*raw_init)(void);
115 int (*show_format)(struct trace_seq *s);
116 int (*define_fields)(void);
117 struct list_head fields;
118 int filter_active;
119 void *filter;
120 void *mod;
121
122#ifdef CONFIG_EVENT_PROFILE
123 atomic_t profile_count;
124 int (*profile_enable)(struct ftrace_event_call *);
125 void (*profile_disable)(struct ftrace_event_call *);
126#endif
127};
128
129#define MAX_FILTER_PRED 32
130#define MAX_FILTER_STR_VAL 128
131
132extern int init_preds(struct ftrace_event_call *call);
133extern void destroy_preds(struct ftrace_event_call *call);
134extern int filter_match_preds(struct ftrace_event_call *call, void *rec);
135extern int filter_current_check_discard(struct ftrace_event_call *call,
136 void *rec,
137 struct ring_buffer_event *event);
138
139extern int trace_define_field(struct ftrace_event_call *call, char *type,
140 char *name, int offset, int size, int is_signed);
141
142#define is_signed_type(type) (((type)(-1)) < 0)
143
144int trace_set_clr_event(const char *system, const char *event, int set);
145
146/*
147 * The double __builtin_constant_p is because gcc will give us an error
148 * if we try to allocate the static variable to fmt if it is not a
149 * constant. Even with the outer if statement optimizing out.
150 */
151#define event_trace_printk(ip, fmt, args...) \
152do { \
153 __trace_printk_check_format(fmt, ##args); \
154 tracing_record_cmdline(current); \
155 if (__builtin_constant_p(fmt)) { \
156 static const char *trace_printk_fmt \
157 __attribute__((section("__trace_printk_fmt"))) = \
158 __builtin_constant_p(fmt) ? fmt : NULL; \
159 \
160 __trace_bprintk(ip, trace_printk_fmt, ##args); \
161 } else \
162 __trace_printk(ip, fmt, ##args); \
163} while (0)
164
165#define __common_field(type, item, is_signed) \
166 ret = trace_define_field(event_call, #type, "common_" #item, \
167 offsetof(typeof(field.ent), item), \
168 sizeof(field.ent.item), is_signed); \
169 if (ret) \
170 return ret;
171
172#endif /* _LINUX_FTRACE_EVENT_H */
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 162e5defe683..d41ed593f79f 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -121,6 +121,13 @@ struct fuse_file_lock {
121#define FUSE_BIG_WRITES (1 << 5) 121#define FUSE_BIG_WRITES (1 << 5)
122 122
123/** 123/**
124 * CUSE INIT request/reply flags
125 *
126 * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl
127 */
128#define CUSE_UNRESTRICTED_IOCTL (1 << 0)
129
130/**
124 * Release flags 131 * Release flags
125 */ 132 */
126#define FUSE_RELEASE_FLUSH (1 << 0) 133#define FUSE_RELEASE_FLUSH (1 << 0)
@@ -210,6 +217,9 @@ enum fuse_opcode {
210 FUSE_DESTROY = 38, 217 FUSE_DESTROY = 38,
211 FUSE_IOCTL = 39, 218 FUSE_IOCTL = 39,
212 FUSE_POLL = 40, 219 FUSE_POLL = 40,
220
221 /* CUSE specific operations */
222 CUSE_INIT = 4096,
213}; 223};
214 224
215enum fuse_notify_code { 225enum fuse_notify_code {
@@ -401,6 +411,27 @@ struct fuse_init_out {
401 __u32 max_write; 411 __u32 max_write;
402}; 412};
403 413
414#define CUSE_INIT_INFO_MAX 4096
415
416struct cuse_init_in {
417 __u32 major;
418 __u32 minor;
419 __u32 unused;
420 __u32 flags;
421};
422
423struct cuse_init_out {
424 __u32 major;
425 __u32 minor;
426 __u32 unused;
427 __u32 flags;
428 __u32 max_read;
429 __u32 max_write;
430 __u32 dev_major; /* chardev major */
431 __u32 dev_minor; /* chardev minor */
432 __u32 spare[10];
433};
434
404struct fuse_interrupt_in { 435struct fuse_interrupt_in {
405 __u64 unique; 436 __u64 unique;
406}; 437};
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 3bf5bb5a34f9..34956c8fdebf 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -23,6 +23,8 @@ union ktime;
23#define FUTEX_TRYLOCK_PI 8 23#define FUTEX_TRYLOCK_PI 8
24#define FUTEX_WAIT_BITSET 9 24#define FUTEX_WAIT_BITSET 9
25#define FUTEX_WAKE_BITSET 10 25#define FUTEX_WAKE_BITSET 10
26#define FUTEX_WAIT_REQUEUE_PI 11
27#define FUTEX_CMP_REQUEUE_PI 12
26 28
27#define FUTEX_PRIVATE_FLAG 128 29#define FUTEX_PRIVATE_FLAG 128
28#define FUTEX_CLOCK_REALTIME 256 30#define FUTEX_CLOCK_REALTIME 256
@@ -38,6 +40,10 @@ union ktime;
38#define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG) 40#define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG)
39#define FUTEX_WAIT_BITSET_PRIVATE (FUTEX_WAIT_BITS | FUTEX_PRIVATE_FLAG) 41#define FUTEX_WAIT_BITSET_PRIVATE (FUTEX_WAIT_BITS | FUTEX_PRIVATE_FLAG)
40#define FUTEX_WAKE_BITSET_PRIVATE (FUTEX_WAKE_BITS | FUTEX_PRIVATE_FLAG) 42#define FUTEX_WAKE_BITSET_PRIVATE (FUTEX_WAKE_BITS | FUTEX_PRIVATE_FLAG)
43#define FUTEX_WAIT_REQUEUE_PI_PRIVATE (FUTEX_WAIT_REQUEUE_PI | \
44 FUTEX_PRIVATE_FLAG)
45#define FUTEX_CMP_REQUEUE_PI_PRIVATE (FUTEX_CMP_REQUEUE_PI | \
46 FUTEX_PRIVATE_FLAG)
41 47
42/* 48/*
43 * Support for robust futexes: the kernel cleans up held futexes at 49 * Support for robust futexes: the kernel cleans up held futexes at
diff --git a/include/linux/gameport.h b/include/linux/gameport.h
index 0cd825f7363a..1bc08541c2b9 100644
--- a/include/linux/gameport.h
+++ b/include/linux/gameport.h
@@ -11,6 +11,7 @@
11 11
12#ifdef __KERNEL__ 12#ifdef __KERNEL__
13#include <asm/io.h> 13#include <asm/io.h>
14#include <linux/types.h>
14#include <linux/list.h> 15#include <linux/list.h>
15#include <linux/mutex.h> 16#include <linux/mutex.h>
16#include <linux/device.h> 17#include <linux/device.h>
@@ -62,7 +63,7 @@ struct gameport_driver {
62 63
63 struct device_driver driver; 64 struct device_driver driver;
64 65
65 unsigned int ignore; 66 bool ignore;
66}; 67};
67#define to_gameport_driver(d) container_of(d, struct gameport_driver, driver) 68#define to_gameport_driver(d) container_of(d, struct gameport_driver, driver)
68 69
diff --git a/include/linux/gcd.h b/include/linux/gcd.h
new file mode 100644
index 000000000000..69f5e8a01bad
--- /dev/null
+++ b/include/linux/gcd.h
@@ -0,0 +1,8 @@
1#ifndef _GCD_H
2#define _GCD_H
3
4#include <linux/compiler.h>
5
6unsigned long gcd(unsigned long a, unsigned long b) __attribute_const__;
7
8#endif /* _GCD_H */
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index a1a28caed23d..45fc320a53c6 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -90,6 +90,7 @@ struct disk_stats {
90struct hd_struct { 90struct hd_struct {
91 sector_t start_sect; 91 sector_t start_sect;
92 sector_t nr_sects; 92 sector_t nr_sects;
93 sector_t alignment_offset;
93 struct device __dev; 94 struct device __dev;
94 struct kobject *holder_dir; 95 struct kobject *holder_dir;
95 int policy, partno; 96 int policy, partno;
@@ -113,6 +114,7 @@ struct hd_struct {
113#define GENHD_FL_UP 16 114#define GENHD_FL_UP 16
114#define GENHD_FL_SUPPRESS_PARTITION_INFO 32 115#define GENHD_FL_SUPPRESS_PARTITION_INFO 32
115#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */ 116#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */
117#define GENHD_FL_NATIVE_CAPACITY 128
116 118
117#define BLK_SCSI_MAX_CMDS (256) 119#define BLK_SCSI_MAX_CMDS (256)
118#define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) 120#define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8))
@@ -140,7 +142,7 @@ struct gendisk {
140 * disks that can't be partitioned. */ 142 * disks that can't be partitioned. */
141 143
142 char disk_name[DISK_NAME_LEN]; /* name of major driver */ 144 char disk_name[DISK_NAME_LEN]; /* name of major driver */
143 145 char *(*nodename)(struct gendisk *gd);
144 /* Array of pointers to partitions indexed by partno. 146 /* Array of pointers to partitions indexed by partno.
145 * Protected with matching bdev lock but stat and other 147 * Protected with matching bdev lock but stat and other
146 * non-critical accesses use RCU. Always access through 148 * non-critical accesses use RCU. Always access through
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 0bbc15f54536..7c777a0da17a 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -5,6 +5,7 @@
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#include <linux/topology.h>
8#include <linux/mmdebug.h>
8 9
9struct vm_area_struct; 10struct vm_area_struct;
10 11
@@ -20,7 +21,8 @@ struct vm_area_struct;
20#define __GFP_DMA ((__force gfp_t)0x01u) 21#define __GFP_DMA ((__force gfp_t)0x01u)
21#define __GFP_HIGHMEM ((__force gfp_t)0x02u) 22#define __GFP_HIGHMEM ((__force gfp_t)0x02u)
22#define __GFP_DMA32 ((__force gfp_t)0x04u) 23#define __GFP_DMA32 ((__force gfp_t)0x04u)
23 24#define __GFP_MOVABLE ((__force gfp_t)0x08u) /* Page is movable */
25#define GFP_ZONEMASK (__GFP_DMA|__GFP_HIGHMEM|__GFP_DMA32|__GFP_MOVABLE)
24/* 26/*
25 * Action modifiers - doesn't change the zoning 27 * Action modifiers - doesn't change the zoning
26 * 28 *
@@ -50,9 +52,20 @@ struct vm_area_struct;
50#define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */ 52#define __GFP_HARDWALL ((__force gfp_t)0x20000u) /* Enforce hardwall cpuset memory allocs */
51#define __GFP_THISNODE ((__force gfp_t)0x40000u)/* No fallback, no policies */ 53#define __GFP_THISNODE ((__force gfp_t)0x40000u)/* No fallback, no policies */
52#define __GFP_RECLAIMABLE ((__force gfp_t)0x80000u) /* Page is reclaimable */ 54#define __GFP_RECLAIMABLE ((__force gfp_t)0x80000u) /* Page is reclaimable */
53#define __GFP_MOVABLE ((__force gfp_t)0x100000u) /* Page is movable */
54 55
55#define __GFP_BITS_SHIFT 21 /* Room for 21 __GFP_FOO bits */ 56#ifdef CONFIG_KMEMCHECK
57#define __GFP_NOTRACK ((__force gfp_t)0x200000u) /* Don't track with kmemcheck */
58#else
59#define __GFP_NOTRACK ((__force gfp_t)0)
60#endif
61
62/*
63 * This may seem redundant, but it's a way of annotating false positives vs.
64 * allocations that simply cannot be supported (e.g. page tables).
65 */
66#define __GFP_NOTRACK_FALSE_POSITIVE (__GFP_NOTRACK)
67
68#define __GFP_BITS_SHIFT 22 /* Room for 22 __GFP_FOO bits */
56#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1)) 69#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
57 70
58/* This equals 0, but use constants in case they ever change */ 71/* This equals 0, but use constants in case they ever change */
@@ -85,6 +98,9 @@ struct vm_area_struct;
85 __GFP_NOWARN|__GFP_REPEAT|__GFP_NOFAIL|\ 98 __GFP_NOWARN|__GFP_REPEAT|__GFP_NOFAIL|\
86 __GFP_NORETRY|__GFP_NOMEMALLOC) 99 __GFP_NORETRY|__GFP_NOMEMALLOC)
87 100
101/* Control slab gfp mask during early boot */
102#define GFP_BOOT_MASK __GFP_BITS_MASK & ~(__GFP_WAIT|__GFP_IO|__GFP_FS)
103
88/* Control allocation constraints */ 104/* Control allocation constraints */
89#define GFP_CONSTRAINT_MASK (__GFP_HARDWALL|__GFP_THISNODE) 105#define GFP_CONSTRAINT_MASK (__GFP_HARDWALL|__GFP_THISNODE)
90 106
@@ -112,24 +128,105 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
112 ((gfp_flags & __GFP_RECLAIMABLE) != 0); 128 ((gfp_flags & __GFP_RECLAIMABLE) != 0);
113} 129}
114 130
115static inline enum zone_type gfp_zone(gfp_t flags) 131#ifdef CONFIG_HIGHMEM
116{ 132#define OPT_ZONE_HIGHMEM ZONE_HIGHMEM
133#else
134#define OPT_ZONE_HIGHMEM ZONE_NORMAL
135#endif
136
117#ifdef CONFIG_ZONE_DMA 137#ifdef CONFIG_ZONE_DMA
118 if (flags & __GFP_DMA) 138#define OPT_ZONE_DMA ZONE_DMA
119 return ZONE_DMA; 139#else
140#define OPT_ZONE_DMA ZONE_NORMAL
120#endif 141#endif
142
121#ifdef CONFIG_ZONE_DMA32 143#ifdef CONFIG_ZONE_DMA32
122 if (flags & __GFP_DMA32) 144#define OPT_ZONE_DMA32 ZONE_DMA32
123 return ZONE_DMA32; 145#else
146#define OPT_ZONE_DMA32 ZONE_NORMAL
124#endif 147#endif
125 if ((flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) == 148
126 (__GFP_HIGHMEM | __GFP_MOVABLE)) 149/*
127 return ZONE_MOVABLE; 150 * GFP_ZONE_TABLE is a word size bitstring that is used for looking up the
128#ifdef CONFIG_HIGHMEM 151 * zone to use given the lowest 4 bits of gfp_t. Entries are ZONE_SHIFT long
129 if (flags & __GFP_HIGHMEM) 152 * and there are 16 of them to cover all possible combinations of
130 return ZONE_HIGHMEM; 153 * __GFP_DMA, __GFP_DMA32, __GFP_MOVABLE and __GFP_HIGHMEM
154 *
155 * The zone fallback order is MOVABLE=>HIGHMEM=>NORMAL=>DMA32=>DMA.
156 * But GFP_MOVABLE is not only a zone specifier but also an allocation
157 * policy. Therefore __GFP_MOVABLE plus another zone selector is valid.
158 * Only 1bit of the lowest 3 bit (DMA,DMA32,HIGHMEM) can be set to "1".
159 *
160 * bit result
161 * =================
162 * 0x0 => NORMAL
163 * 0x1 => DMA or NORMAL
164 * 0x2 => HIGHMEM or NORMAL
165 * 0x3 => BAD (DMA+HIGHMEM)
166 * 0x4 => DMA32 or DMA or NORMAL
167 * 0x5 => BAD (DMA+DMA32)
168 * 0x6 => BAD (HIGHMEM+DMA32)
169 * 0x7 => BAD (HIGHMEM+DMA32+DMA)
170 * 0x8 => NORMAL (MOVABLE+0)
171 * 0x9 => DMA or NORMAL (MOVABLE+DMA)
172 * 0xa => MOVABLE (Movable is valid only if HIGHMEM is set too)
173 * 0xb => BAD (MOVABLE+HIGHMEM+DMA)
174 * 0xc => DMA32 (MOVABLE+HIGHMEM+DMA32)
175 * 0xd => BAD (MOVABLE+DMA32+DMA)
176 * 0xe => BAD (MOVABLE+DMA32+HIGHMEM)
177 * 0xf => BAD (MOVABLE+DMA32+HIGHMEM+DMA)
178 *
179 * ZONES_SHIFT must be <= 2 on 32 bit platforms.
180 */
181
182#if 16 * ZONES_SHIFT > BITS_PER_LONG
183#error ZONES_SHIFT too large to create GFP_ZONE_TABLE integer
131#endif 184#endif
132 return ZONE_NORMAL; 185
186#define GFP_ZONE_TABLE ( \
187 (ZONE_NORMAL << 0 * ZONES_SHIFT) \
188 | (OPT_ZONE_DMA << __GFP_DMA * ZONES_SHIFT) \
189 | (OPT_ZONE_HIGHMEM << __GFP_HIGHMEM * ZONES_SHIFT) \
190 | (OPT_ZONE_DMA32 << __GFP_DMA32 * ZONES_SHIFT) \
191 | (ZONE_NORMAL << __GFP_MOVABLE * ZONES_SHIFT) \
192 | (OPT_ZONE_DMA << (__GFP_MOVABLE | __GFP_DMA) * ZONES_SHIFT) \
193 | (ZONE_MOVABLE << (__GFP_MOVABLE | __GFP_HIGHMEM) * ZONES_SHIFT)\
194 | (OPT_ZONE_DMA32 << (__GFP_MOVABLE | __GFP_DMA32) * ZONES_SHIFT)\
195)
196
197/*
198 * GFP_ZONE_BAD is a bitmap for all combination of __GFP_DMA, __GFP_DMA32
199 * __GFP_HIGHMEM and __GFP_MOVABLE that are not permitted. One flag per
200 * entry starting with bit 0. Bit is set if the combination is not
201 * allowed.
202 */
203#define GFP_ZONE_BAD ( \
204 1 << (__GFP_DMA | __GFP_HIGHMEM) \
205 | 1 << (__GFP_DMA | __GFP_DMA32) \
206 | 1 << (__GFP_DMA32 | __GFP_HIGHMEM) \
207 | 1 << (__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM) \
208 | 1 << (__GFP_MOVABLE | __GFP_HIGHMEM | __GFP_DMA) \
209 | 1 << (__GFP_MOVABLE | __GFP_DMA32 | __GFP_DMA) \
210 | 1 << (__GFP_MOVABLE | __GFP_DMA32 | __GFP_HIGHMEM) \
211 | 1 << (__GFP_MOVABLE | __GFP_DMA32 | __GFP_DMA | __GFP_HIGHMEM)\
212)
213
214static inline enum zone_type gfp_zone(gfp_t flags)
215{
216 enum zone_type z;
217 int bit = flags & GFP_ZONEMASK;
218
219 z = (GFP_ZONE_TABLE >> (bit * ZONES_SHIFT)) &
220 ((1 << ZONES_SHIFT) - 1);
221
222 if (__builtin_constant_p(bit))
223 BUILD_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
224 else {
225#ifdef CONFIG_DEBUG_VM
226 BUG_ON((GFP_ZONE_BAD >> bit) & 1);
227#endif
228 }
229 return z;
133} 230}
134 231
135/* 232/*
@@ -169,30 +266,19 @@ static inline void arch_alloc_page(struct page *page, int order) { }
169#endif 266#endif
170 267
171struct page * 268struct page *
172__alloc_pages_internal(gfp_t gfp_mask, unsigned int order, 269__alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
173 struct zonelist *zonelist, nodemask_t *nodemask); 270 struct zonelist *zonelist, nodemask_t *nodemask);
174 271
175static inline struct page * 272static inline struct page *
176__alloc_pages(gfp_t gfp_mask, unsigned int order, 273__alloc_pages(gfp_t gfp_mask, unsigned int order,
177 struct zonelist *zonelist) 274 struct zonelist *zonelist)
178{ 275{
179 return __alloc_pages_internal(gfp_mask, order, zonelist, NULL); 276 return __alloc_pages_nodemask(gfp_mask, order, zonelist, NULL);
180} 277}
181 278
182static inline struct page *
183__alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
184 struct zonelist *zonelist, nodemask_t *nodemask)
185{
186 return __alloc_pages_internal(gfp_mask, order, zonelist, nodemask);
187}
188
189
190static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, 279static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
191 unsigned int order) 280 unsigned int order)
192{ 281{
193 if (unlikely(order >= MAX_ORDER))
194 return NULL;
195
196 /* Unknown node is current node */ 282 /* Unknown node is current node */
197 if (nid < 0) 283 if (nid < 0)
198 nid = numa_node_id(); 284 nid = numa_node_id();
@@ -200,15 +286,20 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
200 return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask)); 286 return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask));
201} 287}
202 288
289static inline struct page *alloc_pages_exact_node(int nid, gfp_t gfp_mask,
290 unsigned int order)
291{
292 VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES);
293
294 return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask));
295}
296
203#ifdef CONFIG_NUMA 297#ifdef CONFIG_NUMA
204extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order); 298extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order);
205 299
206static inline struct page * 300static inline struct page *
207alloc_pages(gfp_t gfp_mask, unsigned int order) 301alloc_pages(gfp_t gfp_mask, unsigned int order)
208{ 302{
209 if (unlikely(order >= MAX_ORDER))
210 return NULL;
211
212 return alloc_pages_current(gfp_mask, order); 303 return alloc_pages_current(gfp_mask, order);
213} 304}
214extern struct page *alloc_page_vma(gfp_t gfp_mask, 305extern struct page *alloc_page_vma(gfp_t gfp_mask,
@@ -245,4 +336,23 @@ void drain_zone_pages(struct zone *zone, struct per_cpu_pages *pcp);
245void drain_all_pages(void); 336void drain_all_pages(void);
246void drain_local_pages(void *dummy); 337void drain_local_pages(void *dummy);
247 338
339extern bool oom_killer_disabled;
340
341static inline void oom_killer_disable(void)
342{
343 oom_killer_disabled = true;
344}
345
346static inline void oom_killer_enable(void)
347{
348 oom_killer_disabled = false;
349}
350
351extern gfp_t gfp_allowed_mask;
352
353static inline void set_gfp_allowed_mask(gfp_t mask)
354{
355 gfp_allowed_mask = mask;
356}
357
248#endif /* __LINUX_GFP_H */ 358#endif /* __LINUX_GFP_H */
diff --git a/include/linux/hid.h b/include/linux/hid.h
index a72876e43589..53489fd4d700 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -238,6 +238,42 @@ struct hid_item {
238#define HID_GD_RIGHT 0x00010092 238#define HID_GD_RIGHT 0x00010092
239#define HID_GD_LEFT 0x00010093 239#define HID_GD_LEFT 0x00010093
240 240
241#define HID_DG_DIGITIZER 0x000d0001
242#define HID_DG_PEN 0x000d0002
243#define HID_DG_LIGHTPEN 0x000d0003
244#define HID_DG_TOUCHSCREEN 0x000d0004
245#define HID_DG_TOUCHPAD 0x000d0005
246#define HID_DG_STYLUS 0x000d0020
247#define HID_DG_PUCK 0x000d0021
248#define HID_DG_FINGER 0x000d0022
249#define HID_DG_TIPPRESSURE 0x000d0030
250#define HID_DG_BARRELPRESSURE 0x000d0031
251#define HID_DG_INRANGE 0x000d0032
252#define HID_DG_TOUCH 0x000d0033
253#define HID_DG_UNTOUCH 0x000d0034
254#define HID_DG_TAP 0x000d0035
255#define HID_DG_TABLETFUNCTIONKEY 0x000d0039
256#define HID_DG_PROGRAMCHANGEKEY 0x000d003a
257#define HID_DG_INVERT 0x000d003c
258#define HID_DG_TIPSWITCH 0x000d0042
259#define HID_DG_TIPSWITCH2 0x000d0043
260#define HID_DG_BARRELSWITCH 0x000d0044
261#define HID_DG_ERASER 0x000d0045
262#define HID_DG_TABLETPICK 0x000d0046
263/*
264 * as of May 20, 2009 the usages below are not yet in the official USB spec
265 * but are being pushed by Microsft as described in their paper "Digitizer
266 * Drivers for Windows Touch and Pen-Based Computers"
267 */
268#define HID_DG_CONFIDENCE 0x000d0047
269#define HID_DG_WIDTH 0x000d0048
270#define HID_DG_HEIGHT 0x000d0049
271#define HID_DG_CONTACTID 0x000d0051
272#define HID_DG_INPUTMODE 0x000d0052
273#define HID_DG_DEVICEINDEX 0x000d0053
274#define HID_DG_CONTACTCOUNT 0x000d0054
275#define HID_DG_CONTACTMAX 0x000d0055
276
241/* 277/*
242 * HID report types --- Ouch! HID spec says 1 2 3! 278 * HID report types --- Ouch! HID spec says 1 2 3!
243 */ 279 */
diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 1fcb7126a01f..211ff4497269 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -55,7 +55,9 @@ static inline void *kmap(struct page *page)
55 return page_address(page); 55 return page_address(page);
56} 56}
57 57
58#define kunmap(page) do { (void) (page); } while (0) 58static inline void kunmap(struct page *page)
59{
60}
59 61
60static inline void *kmap_atomic(struct page *page, enum km_type idx) 62static inline void *kmap_atomic(struct page *page, enum km_type idx)
61{ 63{
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 0d2f7c8a33d6..7400900de94a 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -30,8 +30,11 @@ struct hrtimer_cpu_base;
30 * Mode arguments of xxx_hrtimer functions: 30 * Mode arguments of xxx_hrtimer functions:
31 */ 31 */
32enum hrtimer_mode { 32enum hrtimer_mode {
33 HRTIMER_MODE_ABS, /* Time value is absolute */ 33 HRTIMER_MODE_ABS = 0x0, /* Time value is absolute */
34 HRTIMER_MODE_REL, /* Time value is relative to now */ 34 HRTIMER_MODE_REL = 0x1, /* Time value is relative to now */
35 HRTIMER_MODE_PINNED = 0x02, /* Timer is bound to CPU */
36 HRTIMER_MODE_ABS_PINNED = 0x02,
37 HRTIMER_MODE_REL_PINNED = 0x03,
35}; 38};
36 39
37/* 40/*
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 03be7f29ca01..2723513a5651 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -11,6 +11,8 @@
11 11
12struct ctl_table; 12struct ctl_table;
13 13
14int PageHuge(struct page *page);
15
14static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) 16static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
15{ 17{
16 return vma->vm_flags & VM_HUGETLB; 18 return vma->vm_flags & VM_HUGETLB;
@@ -31,7 +33,7 @@ void hugetlb_report_meminfo(struct seq_file *);
31int hugetlb_report_node_meminfo(int, char *); 33int hugetlb_report_node_meminfo(int, char *);
32unsigned long hugetlb_total_pages(void); 34unsigned long hugetlb_total_pages(void);
33int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, 35int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
34 unsigned long address, int write_access); 36 unsigned long address, unsigned int flags);
35int hugetlb_reserve_pages(struct inode *inode, long from, long to, 37int hugetlb_reserve_pages(struct inode *inode, long from, long to,
36 struct vm_area_struct *vma, 38 struct vm_area_struct *vma,
37 int acctflags); 39 int acctflags);
@@ -61,6 +63,11 @@ void hugetlb_change_protection(struct vm_area_struct *vma,
61 63
62#else /* !CONFIG_HUGETLB_PAGE */ 64#else /* !CONFIG_HUGETLB_PAGE */
63 65
66static inline int PageHuge(struct page *page)
67{
68 return 0;
69}
70
64static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) 71static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
65{ 72{
66 return 0; 73 return 0;
@@ -91,7 +98,7 @@ static inline void hugetlb_report_meminfo(struct seq_file *m)
91#define pud_huge(x) 0 98#define pud_huge(x) 0
92#define is_hugepage_only_range(mm, addr, len) 0 99#define is_hugepage_only_range(mm, addr, len) 0
93#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) 100#define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; })
94#define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; }) 101#define hugetlb_fault(mm, vma, addr, flags) ({ BUG(); 0; })
95 102
96#define hugetlb_change_protection(vma, address, end, newprot) 103#define hugetlb_change_protection(vma, address, end, newprot)
97 104
diff --git a/include/linux/i2c-ocores.h b/include/linux/i2c-ocores.h
index 8ed591b0887e..4d5e57ff6614 100644
--- a/include/linux/i2c-ocores.h
+++ b/include/linux/i2c-ocores.h
@@ -14,6 +14,8 @@
14struct ocores_i2c_platform_data { 14struct ocores_i2c_platform_data {
15 u32 regstep; /* distance between registers */ 15 u32 regstep; /* distance between registers */
16 u32 clock_khz; /* input clock in kHz */ 16 u32 clock_khz; /* input clock in kHz */
17 u8 num_devices; /* number of devices in the devices list */
18 struct i2c_board_info const *devices; /* devices connected to the bus */
17}; 19};
18 20
19#endif /* _LINUX_I2C_OCORES_H */ 21#endif /* _LINUX_I2C_OCORES_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index ad2580596033..f4784c0fe975 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -47,6 +47,7 @@ struct i2c_driver;
47union i2c_smbus_data; 47union i2c_smbus_data;
48struct i2c_board_info; 48struct i2c_board_info;
49 49
50#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
50/* 51/*
51 * The master routines are the ones normally used to transmit data to devices 52 * The master routines are the ones normally used to transmit data to devices
52 * on a bus (or read from them). Apart from two basic transfer functions to 53 * on a bus (or read from them). Apart from two basic transfer functions to
@@ -93,6 +94,7 @@ extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client *client,
93extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, 94extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client,
94 u8 command, u8 length, 95 u8 command, u8 length,
95 const u8 *values); 96 const u8 *values);
97#endif /* I2C */
96 98
97/** 99/**
98 * struct i2c_driver - represent an I2C device driver 100 * struct i2c_driver - represent an I2C device driver
@@ -100,9 +102,8 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client,
100 * @class: What kind of i2c device we instantiate (for detect) 102 * @class: What kind of i2c device we instantiate (for detect)
101 * @attach_adapter: Callback for bus addition (for legacy drivers) 103 * @attach_adapter: Callback for bus addition (for legacy drivers)
102 * @detach_adapter: Callback for bus removal (for legacy drivers) 104 * @detach_adapter: Callback for bus removal (for legacy drivers)
103 * @detach_client: Callback for device removal (for legacy drivers) 105 * @probe: Callback for device binding
104 * @probe: Callback for device binding (new-style drivers) 106 * @remove: Callback for device unbinding
105 * @remove: Callback for device unbinding (new-style drivers)
106 * @shutdown: Callback for device shutdown 107 * @shutdown: Callback for device shutdown
107 * @suspend: Callback for device suspend 108 * @suspend: Callback for device suspend
108 * @resume: Callback for device resume 109 * @resume: Callback for device resume
@@ -137,26 +138,14 @@ struct i2c_driver {
137 int id; 138 int id;
138 unsigned int class; 139 unsigned int class;
139 140
140 /* Notifies the driver that a new bus has appeared. This routine 141 /* Notifies the driver that a new bus has appeared or is about to be
141 * can be used by the driver to test if the bus meets its conditions 142 * removed. You should avoid using this if you can, it will probably
142 * & seek for the presence of the chip(s) it supports. If found, it 143 * be removed in a near future.
143 * registers the client(s) that are on the bus to the i2c admin. via
144 * i2c_attach_client. (LEGACY I2C DRIVERS ONLY)
145 */ 144 */
146 int (*attach_adapter)(struct i2c_adapter *); 145 int (*attach_adapter)(struct i2c_adapter *);
147 int (*detach_adapter)(struct i2c_adapter *); 146 int (*detach_adapter)(struct i2c_adapter *);
148 147
149 /* tells the driver that a client is about to be deleted & gives it 148 /* Standard driver model interfaces */
150 * the chance to remove its private data. Also, if the client struct
151 * has been dynamically allocated by the driver in the function above,
152 * it must be freed here. (LEGACY I2C DRIVERS ONLY)
153 */
154 int (*detach_client)(struct i2c_client *) __deprecated;
155
156 /* Standard driver model interfaces, for "new style" i2c drivers.
157 * With the driver model, device enumeration is NEVER done by drivers;
158 * it's done by infrastructure. (NEW STYLE DRIVERS ONLY)
159 */
160 int (*probe)(struct i2c_client *, const struct i2c_device_id *); 149 int (*probe)(struct i2c_client *, const struct i2c_device_id *);
161 int (*remove)(struct i2c_client *); 150 int (*remove)(struct i2c_client *);
162 151
@@ -191,9 +180,8 @@ struct i2c_driver {
191 * @driver: device's driver, hence pointer to access routines 180 * @driver: device's driver, hence pointer to access routines
192 * @dev: Driver model device node for the slave. 181 * @dev: Driver model device node for the slave.
193 * @irq: indicates the IRQ generated by this device (if any) 182 * @irq: indicates the IRQ generated by this device (if any)
194 * @list: list of active/busy clients (DEPRECATED) 183 * @detected: member of an i2c_driver.clients list or i2c-core's
195 * @detected: member of an i2c_driver.clients list 184 * userspace_devices list
196 * @released: used to synchronize client releases & detaches and references
197 * 185 *
198 * An i2c_client identifies a single device (i.e. chip) connected to an 186 * An i2c_client identifies a single device (i.e. chip) connected to an
199 * i2c bus. The behaviour exposed to Linux is defined by the driver 187 * i2c bus. The behaviour exposed to Linux is defined by the driver
@@ -209,9 +197,7 @@ struct i2c_client {
209 struct i2c_driver *driver; /* and our access routines */ 197 struct i2c_driver *driver; /* and our access routines */
210 struct device dev; /* the device structure */ 198 struct device dev; /* the device structure */
211 int irq; /* irq issued by device */ 199 int irq; /* irq issued by device */
212 struct list_head list; /* DEPRECATED */
213 struct list_head detected; 200 struct list_head detected;
214 struct completion released;
215}; 201};
216#define to_i2c_client(d) container_of(d, struct i2c_client, dev) 202#define to_i2c_client(d) container_of(d, struct i2c_client, dev)
217 203
@@ -248,11 +234,10 @@ static inline void i2c_set_clientdata(struct i2c_client *dev, void *data)
248 * that, such as chip type, configuration, associated IRQ, and so on. 234 * that, such as chip type, configuration, associated IRQ, and so on.
249 * 235 *
250 * i2c_board_info is used to build tables of information listing I2C devices 236 * i2c_board_info is used to build tables of information listing I2C devices
251 * that are present. This information is used to grow the driver model tree 237 * that are present. This information is used to grow the driver model tree.
252 * for "new style" I2C drivers. For mainboards this is done statically using 238 * For mainboards this is done statically using i2c_register_board_info();
253 * i2c_register_board_info(); bus numbers identify adapters that aren't 239 * bus numbers identify adapters that aren't yet available. For add-on boards,
254 * yet available. For add-on boards, i2c_new_device() does this dynamically 240 * i2c_new_device() does this dynamically with the adapter already known.
255 * with the adapter already known.
256 */ 241 */
257struct i2c_board_info { 242struct i2c_board_info {
258 char type[I2C_NAME_SIZE]; 243 char type[I2C_NAME_SIZE];
@@ -277,6 +262,7 @@ struct i2c_board_info {
277 .type = dev_type, .addr = (dev_addr) 262 .type = dev_type, .addr = (dev_addr)
278 263
279 264
265#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
280/* Add-on boards should register/unregister their devices; e.g. a board 266/* Add-on boards should register/unregister their devices; e.g. a board
281 * with integrated I2C, a config eeprom, sensors, and a codec that's 267 * with integrated I2C, a config eeprom, sensors, and a codec that's
282 * used in conjunction with the primary hardware. 268 * used in conjunction with the primary hardware.
@@ -300,6 +286,7 @@ extern struct i2c_client *
300i2c_new_dummy(struct i2c_adapter *adap, u16 address); 286i2c_new_dummy(struct i2c_adapter *adap, u16 address);
301 287
302extern void i2c_unregister_device(struct i2c_client *); 288extern void i2c_unregister_device(struct i2c_client *);
289#endif /* I2C */
303 290
304/* Mainboard arch_initcall() code should register all its I2C devices. 291/* Mainboard arch_initcall() code should register all its I2C devices.
305 * This is done at arch_initcall time, before declaring any i2c adapters. 292 * This is done at arch_initcall time, before declaring any i2c adapters.
@@ -316,7 +303,7 @@ i2c_register_board_info(int busnum, struct i2c_board_info const *info,
316{ 303{
317 return 0; 304 return 0;
318} 305}
319#endif 306#endif /* I2C_BOARDINFO */
320 307
321/* 308/*
322 * The following structs are for those who like to implement new bus drivers: 309 * The following structs are for those who like to implement new bus drivers:
@@ -352,21 +339,15 @@ struct i2c_adapter {
352 const struct i2c_algorithm *algo; /* the algorithm to access the bus */ 339 const struct i2c_algorithm *algo; /* the algorithm to access the bus */
353 void *algo_data; 340 void *algo_data;
354 341
355 /* --- administration stuff. */
356 int (*client_register)(struct i2c_client *) __deprecated;
357 int (*client_unregister)(struct i2c_client *) __deprecated;
358
359 /* data fields that are valid for all devices */ 342 /* data fields that are valid for all devices */
360 u8 level; /* nesting level for lockdep */ 343 u8 level; /* nesting level for lockdep */
361 struct mutex bus_lock; 344 struct mutex bus_lock;
362 struct mutex clist_lock;
363 345
364 int timeout; /* in jiffies */ 346 int timeout; /* in jiffies */
365 int retries; 347 int retries;
366 struct device dev; /* the adapter device */ 348 struct device dev; /* the adapter device */
367 349
368 int nr; 350 int nr;
369 struct list_head clients; /* DEPRECATED */
370 char name[48]; 351 char name[48];
371 struct completion dev_released; 352 struct completion dev_released;
372}; 353};
@@ -412,11 +393,16 @@ struct i2c_client_address_data {
412/* The numbers to use to set I2C bus address */ 393/* The numbers to use to set I2C bus address */
413#define ANY_I2C_BUS 0xffff 394#define ANY_I2C_BUS 0xffff
414 395
396/* Construct an I2C_CLIENT_END-terminated array of i2c addresses */
397#define I2C_ADDRS(addr, addrs...) \
398 ((const unsigned short []){ addr, ## addrs, I2C_CLIENT_END })
399
415 400
416/* ----- functions exported by i2c.o */ 401/* ----- functions exported by i2c.o */
417 402
418/* administration... 403/* administration...
419 */ 404 */
405#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
420extern int i2c_add_adapter(struct i2c_adapter *); 406extern int i2c_add_adapter(struct i2c_adapter *);
421extern int i2c_del_adapter(struct i2c_adapter *); 407extern int i2c_del_adapter(struct i2c_adapter *);
422extern int i2c_add_numbered_adapter(struct i2c_adapter *); 408extern int i2c_add_numbered_adapter(struct i2c_adapter *);
@@ -429,11 +415,6 @@ static inline int i2c_add_driver(struct i2c_driver *driver)
429 return i2c_register_driver(THIS_MODULE, driver); 415 return i2c_register_driver(THIS_MODULE, driver);
430} 416}
431 417
432/* These are deprecated, your driver should use the standard .probe()
433 * and .remove() methods instead. */
434extern int __deprecated i2c_attach_client(struct i2c_client *);
435extern int __deprecated i2c_detach_client(struct i2c_client *);
436
437extern struct i2c_client *i2c_use_client(struct i2c_client *client); 418extern struct i2c_client *i2c_use_client(struct i2c_client *client);
438extern void i2c_release_client(struct i2c_client *client); 419extern void i2c_release_client(struct i2c_client *client);
439 420
@@ -442,14 +423,6 @@ extern void i2c_release_client(struct i2c_client *client);
442extern void i2c_clients_command(struct i2c_adapter *adap, 423extern void i2c_clients_command(struct i2c_adapter *adap,
443 unsigned int cmd, void *arg); 424 unsigned int cmd, void *arg);
444 425
445/* Detect function. It iterates over all possible addresses itself.
446 * It will only call found_proc if some client is connected at the
447 * specific address (unless a 'force' matched);
448 */
449extern int i2c_probe(struct i2c_adapter *adapter,
450 const struct i2c_client_address_data *address_data,
451 int (*found_proc) (struct i2c_adapter *, int, int));
452
453extern struct i2c_adapter *i2c_get_adapter(int id); 426extern struct i2c_adapter *i2c_get_adapter(int id);
454extern void i2c_put_adapter(struct i2c_adapter *adap); 427extern void i2c_put_adapter(struct i2c_adapter *adap);
455 428
@@ -471,6 +444,7 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap)
471{ 444{
472 return adap->nr; 445 return adap->nr;
473} 446}
447#endif /* I2C */
474#endif /* __KERNEL__ */ 448#endif /* __KERNEL__ */
475 449
476/** 450/**
diff --git a/include/linux/i2c/lm8323.h b/include/linux/i2c/lm8323.h
new file mode 100644
index 000000000000..478d668bc590
--- /dev/null
+++ b/include/linux/i2c/lm8323.h
@@ -0,0 +1,46 @@
1/*
2 * lm8323.h - Configuration for LM8323 keypad driver.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation (version 2 of the License only).
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17
18#ifndef __LINUX_LM8323_H
19#define __LINUX_LM8323_H
20
21#include <linux/types.h>
22
23/*
24 * Largest keycode that the chip can send, plus one,
25 * so keys can be mapped directly at the index of the
26 * LM8323 keycode instead of subtracting one.
27 */
28#define LM8323_KEYMAP_SIZE (0x7f + 1)
29
30#define LM8323_NUM_PWMS 3
31
32struct lm8323_platform_data {
33 int debounce_time; /* Time to watch for key bouncing, in ms. */
34 int active_time; /* Idle time until sleep, in ms. */
35
36 int size_x;
37 int size_y;
38 bool repeat;
39 const unsigned short *keymap;
40
41 const char *pwm_names[LM8323_NUM_PWMS];
42
43 const char *name; /* Device name. */
44};
45
46#endif /* __LINUX_LM8323_H */
diff --git a/include/linux/i2c/pca953x.h b/include/linux/i2c/pca953x.h
index 3c7361217df8..81736d6a8db7 100644
--- a/include/linux/i2c/pca953x.h
+++ b/include/linux/i2c/pca953x.h
@@ -15,4 +15,5 @@ struct pca953x_platform_data {
15 int (*teardown)(struct i2c_client *client, 15 int (*teardown)(struct i2c_client *client,
16 unsigned gpio, unsigned ngpio, 16 unsigned gpio, unsigned ngpio,
17 void *context); 17 void *context);
18 char **names;
18}; 19};
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 9fed365a598b..95c6e00a72e8 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -26,6 +26,9 @@
26#include <asm/io.h> 26#include <asm/io.h>
27#include <asm/mutex.h> 27#include <asm/mutex.h>
28 28
29/* for request_sense */
30#include <linux/cdrom.h>
31
29#if defined(CONFIG_CRIS) || defined(CONFIG_FRV) || defined(CONFIG_MN10300) 32#if defined(CONFIG_CRIS) || defined(CONFIG_FRV) || defined(CONFIG_MN10300)
30# define SUPPORT_VLB_SYNC 0 33# define SUPPORT_VLB_SYNC 0
31#else 34#else
@@ -154,12 +157,6 @@ enum {
154#define REQ_UNPARK_HEADS 0x23 157#define REQ_UNPARK_HEADS 0x23
155 158
156/* 159/*
157 * Check for an interrupt and acknowledge the interrupt status
158 */
159struct hwif_s;
160typedef int (ide_ack_intr_t)(struct hwif_s *);
161
162/*
163 * hwif_chipset_t is used to keep track of the specific hardware 160 * hwif_chipset_t is used to keep track of the specific hardware
164 * chipset used by each IDE interface, if known. 161 * chipset used by each IDE interface, if known.
165 */ 162 */
@@ -175,20 +172,18 @@ typedef u8 hwif_chipset_t;
175/* 172/*
176 * Structure to hold all information about the location of this port 173 * Structure to hold all information about the location of this port
177 */ 174 */
178typedef struct hw_regs_s { 175struct ide_hw {
179 union { 176 union {
180 struct ide_io_ports io_ports; 177 struct ide_io_ports io_ports;
181 unsigned long io_ports_array[IDE_NR_PORTS]; 178 unsigned long io_ports_array[IDE_NR_PORTS];
182 }; 179 };
183 180
184 int irq; /* our irq number */ 181 int irq; /* our irq number */
185 ide_ack_intr_t *ack_intr; /* acknowledge interrupt */
186 hwif_chipset_t chipset;
187 struct device *dev, *parent; 182 struct device *dev, *parent;
188 unsigned long config; 183 unsigned long config;
189} hw_regs_t; 184};
190 185
191static inline void ide_std_init_ports(hw_regs_t *hw, 186static inline void ide_std_init_ports(struct ide_hw *hw,
192 unsigned long io_addr, 187 unsigned long io_addr,
193 unsigned long ctl_addr) 188 unsigned long ctl_addr)
194{ 189{
@@ -215,21 +210,12 @@ static inline void ide_std_init_ports(hw_regs_t *hw,
215 210
216/* 211/*
217 * Special Driver Flags 212 * Special Driver Flags
218 *
219 * set_geometry : respecify drive geometry
220 * recalibrate : seek to cyl 0
221 * set_multmode : set multmode count
222 * reserved : unused
223 */ 213 */
224typedef union { 214enum {
225 unsigned all : 8; 215 IDE_SFLAG_SET_GEOMETRY = (1 << 0),
226 struct { 216 IDE_SFLAG_RECALIBRATE = (1 << 1),
227 unsigned set_geometry : 1; 217 IDE_SFLAG_SET_MULTMODE = (1 << 2),
228 unsigned recalibrate : 1; 218};
229 unsigned set_multmode : 1;
230 unsigned reserved : 5;
231 } b;
232} special_t;
233 219
234/* 220/*
235 * Status returned from various ide_ functions 221 * Status returned from various ide_ functions
@@ -324,7 +310,6 @@ struct ide_cmd {
324 unsigned int cursg_ofs; 310 unsigned int cursg_ofs;
325 311
326 struct request *rq; /* copy of request */ 312 struct request *rq; /* copy of request */
327 void *special; /* valid_t generally */
328}; 313};
329 314
330/* ATAPI packet command flags */ 315/* ATAPI packet command flags */
@@ -339,11 +324,6 @@ enum {
339 PC_FLAG_WRITING = (1 << 6), 324 PC_FLAG_WRITING = (1 << 6),
340}; 325};
341 326
342/*
343 * With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes.
344 * This is used for several packet commands (not for READ/WRITE commands).
345 */
346#define IDE_PC_BUFFER_SIZE 64
347#define ATAPI_WAIT_PC (60 * HZ) 327#define ATAPI_WAIT_PC (60 * HZ)
348 328
349struct ide_atapi_pc { 329struct ide_atapi_pc {
@@ -355,16 +335,6 @@ struct ide_atapi_pc {
355 335
356 /* bytes to transfer */ 336 /* bytes to transfer */
357 int req_xfer; 337 int req_xfer;
358 /* bytes actually transferred */
359 int xferred;
360
361 /* data buffer */
362 u8 *buf;
363 /* current buffer position */
364 u8 *cur_pos;
365 int buf_size;
366 /* missing/available data on the current buffer */
367 int b_count;
368 338
369 /* the corresponding request */ 339 /* the corresponding request */
370 struct request *rq; 340 struct request *rq;
@@ -375,12 +345,6 @@ struct ide_atapi_pc {
375 * those are more or less driver-specific and some of them are subject 345 * those are more or less driver-specific and some of them are subject
376 * to change/removal later. 346 * to change/removal later.
377 */ 347 */
378 u8 pc_buf[IDE_PC_BUFFER_SIZE];
379
380 /* idetape only */
381 struct idetape_bh *bh;
382 char *b_data;
383
384 unsigned long timeout; 348 unsigned long timeout;
385}; 349};
386 350
@@ -397,6 +361,7 @@ struct ide_drive_s;
397struct ide_disk_ops { 361struct ide_disk_ops {
398 int (*check)(struct ide_drive_s *, const char *); 362 int (*check)(struct ide_drive_s *, const char *);
399 int (*get_capacity)(struct ide_drive_s *); 363 int (*get_capacity)(struct ide_drive_s *);
364 u64 (*set_capacity)(struct ide_drive_s *, u64);
400 void (*setup)(struct ide_drive_s *); 365 void (*setup)(struct ide_drive_s *);
401 void (*flush)(struct ide_drive_s *); 366 void (*flush)(struct ide_drive_s *);
402 int (*init_media)(struct ide_drive_s *, struct gendisk *); 367 int (*init_media)(struct ide_drive_s *, struct gendisk *);
@@ -474,6 +439,8 @@ enum {
474 IDE_DFLAG_NICE1 = (1 << 5), 439 IDE_DFLAG_NICE1 = (1 << 5),
475 /* device is physically present */ 440 /* device is physically present */
476 IDE_DFLAG_PRESENT = (1 << 6), 441 IDE_DFLAG_PRESENT = (1 << 6),
442 /* disable Host Protected Area */
443 IDE_DFLAG_NOHPA = (1 << 7),
477 /* id read from device (synthetic if not set) */ 444 /* id read from device (synthetic if not set) */
478 IDE_DFLAG_ID_READ = (1 << 8), 445 IDE_DFLAG_ID_READ = (1 << 8),
479 IDE_DFLAG_NOPROBE = (1 << 9), 446 IDE_DFLAG_NOPROBE = (1 << 9),
@@ -512,6 +479,7 @@ enum {
512 /* write protect */ 479 /* write protect */
513 IDE_DFLAG_WP = (1 << 29), 480 IDE_DFLAG_WP = (1 << 29),
514 IDE_DFLAG_FORMAT_IN_PROGRESS = (1 << 30), 481 IDE_DFLAG_FORMAT_IN_PROGRESS = (1 << 30),
482 IDE_DFLAG_NIEN_QUIRK = (1 << 31),
515}; 483};
516 484
517struct ide_drive_s { 485struct ide_drive_s {
@@ -536,14 +504,13 @@ struct ide_drive_s {
536 unsigned long sleep; /* sleep until this time */ 504 unsigned long sleep; /* sleep until this time */
537 unsigned long timeout; /* max time to wait for irq */ 505 unsigned long timeout; /* max time to wait for irq */
538 506
539 special_t special; /* special action flags */ 507 u8 special_flags; /* special action flags */
540 508
541 u8 select; /* basic drive/head select reg value */ 509 u8 select; /* basic drive/head select reg value */
542 u8 retry_pio; /* retrying dma capable host in pio */ 510 u8 retry_pio; /* retrying dma capable host in pio */
543 u8 waiting_for_dma; /* dma currently in progress */ 511 u8 waiting_for_dma; /* dma currently in progress */
544 u8 dma; /* atapi dma flag */ 512 u8 dma; /* atapi dma flag */
545 513
546 u8 quirk_list; /* considered quirky, set for a specific host */
547 u8 init_speed; /* transfer rate set at boot */ 514 u8 init_speed; /* transfer rate set at boot */
548 u8 current_speed; /* current transfer rate set */ 515 u8 current_speed; /* current transfer rate set */
549 u8 desired_speed; /* desired transfer rate set */ 516 u8 desired_speed; /* desired transfer rate set */
@@ -565,11 +532,10 @@ struct ide_drive_s {
565 532
566 unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */ 533 unsigned int bios_cyl; /* BIOS/fdisk/LILO number of cyls */
567 unsigned int cyl; /* "real" number of cyls */ 534 unsigned int cyl; /* "real" number of cyls */
568 unsigned int drive_data; /* used by set_pio_mode/dev_select() */ 535 void *drive_data; /* used by set_pio_mode/dev_select() */
569 unsigned int failures; /* current failure count */ 536 unsigned int failures; /* current failure count */
570 unsigned int max_failures; /* maximum allowed failure count */ 537 unsigned int max_failures; /* maximum allowed failure count */
571 u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */ 538 u64 probed_capacity;/* initial/native media capacity */
572
573 u64 capacity64; /* total number of sectors */ 539 u64 capacity64; /* total number of sectors */
574 540
575 int lun; /* logical unit */ 541 int lun; /* logical unit */
@@ -593,16 +559,16 @@ struct ide_drive_s {
593 /* callback for packet commands */ 559 /* callback for packet commands */
594 int (*pc_callback)(struct ide_drive_s *, int); 560 int (*pc_callback)(struct ide_drive_s *, int);
595 561
596 void (*pc_update_buffers)(struct ide_drive_s *, struct ide_atapi_pc *);
597 int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *,
598 unsigned int, int);
599
600 ide_startstop_t (*irq_handler)(struct ide_drive_s *); 562 ide_startstop_t (*irq_handler)(struct ide_drive_s *);
601 563
602 unsigned long atapi_flags; 564 unsigned long atapi_flags;
603 565
604 struct ide_atapi_pc request_sense_pc; 566 struct ide_atapi_pc request_sense_pc;
605 struct request request_sense_rq; 567
568 /* current sense rq and buffer */
569 bool sense_rq_armed;
570 struct request sense_rq;
571 struct request_sense sense_data;
606}; 572};
607 573
608typedef struct ide_drive_s ide_drive_t; 574typedef struct ide_drive_s ide_drive_t;
@@ -663,6 +629,7 @@ struct ide_port_ops {
663 void (*maskproc)(ide_drive_t *, int); 629 void (*maskproc)(ide_drive_t *, int);
664 void (*quirkproc)(ide_drive_t *); 630 void (*quirkproc)(ide_drive_t *);
665 void (*clear_irq)(ide_drive_t *); 631 void (*clear_irq)(ide_drive_t *);
632 int (*test_irq)(struct hwif_s *);
666 633
667 u8 (*mdma_filter)(ide_drive_t *); 634 u8 (*mdma_filter)(ide_drive_t *);
668 u8 (*udma_filter)(ide_drive_t *); 635 u8 (*udma_filter)(ide_drive_t *);
@@ -688,6 +655,10 @@ struct ide_dma_ops {
688 u8 (*dma_sff_read_status)(struct hwif_s *); 655 u8 (*dma_sff_read_status)(struct hwif_s *);
689}; 656};
690 657
658enum {
659 IDE_PFLAG_PROBING = (1 << 0),
660};
661
691struct ide_host; 662struct ide_host;
692 663
693typedef struct hwif_s { 664typedef struct hwif_s {
@@ -704,6 +675,8 @@ typedef struct hwif_s {
704 675
705 ide_drive_t *devices[MAX_DRIVES + 1]; 676 ide_drive_t *devices[MAX_DRIVES + 1];
706 677
678 unsigned long port_flags;
679
707 u8 major; /* our major number */ 680 u8 major; /* our major number */
708 u8 index; /* 0 for ide0; 1 for ide1; ... */ 681 u8 index; /* 0 for ide0; 1 for ide1; ... */
709 u8 channel; /* for dual-port chips: 0=primary, 1=secondary */ 682 u8 channel; /* for dual-port chips: 0=primary, 1=secondary */
@@ -722,8 +695,6 @@ typedef struct hwif_s {
722 695
723 struct device *dev; 696 struct device *dev;
724 697
725 ide_ack_intr_t *ack_intr;
726
727 void (*rw_disk)(ide_drive_t *, struct request *); 698 void (*rw_disk)(ide_drive_t *, struct request *);
728 699
729 const struct ide_tp_ops *tp_ops; 700 const struct ide_tp_ops *tp_ops;
@@ -1144,6 +1115,8 @@ void SELECT_MASK(ide_drive_t *, int);
1144u8 ide_read_error(ide_drive_t *); 1115u8 ide_read_error(ide_drive_t *);
1145void ide_read_bcount_and_ireason(ide_drive_t *, u16 *, u8 *); 1116void ide_read_bcount_and_ireason(ide_drive_t *, u16 *, u8 *);
1146 1117
1118int ide_check_ireason(ide_drive_t *, struct request *, int, int, int);
1119
1147int ide_check_atapi_device(ide_drive_t *, const char *); 1120int ide_check_atapi_device(ide_drive_t *, const char *);
1148 1121
1149void ide_init_pc(struct ide_atapi_pc *); 1122void ide_init_pc(struct ide_atapi_pc *);
@@ -1168,13 +1141,17 @@ enum {
1168 REQ_IDETAPE_WRITE = (1 << 3), 1141 REQ_IDETAPE_WRITE = (1 << 3),
1169}; 1142};
1170 1143
1171int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *); 1144int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *,
1145 void *, unsigned int);
1172 1146
1173int ide_do_test_unit_ready(ide_drive_t *, struct gendisk *); 1147int ide_do_test_unit_ready(ide_drive_t *, struct gendisk *);
1174int ide_do_start_stop(ide_drive_t *, struct gendisk *, int); 1148int ide_do_start_stop(ide_drive_t *, struct gendisk *, int);
1175int ide_set_media_lock(ide_drive_t *, struct gendisk *, int); 1149int ide_set_media_lock(ide_drive_t *, struct gendisk *, int);
1176void ide_create_request_sense_cmd(ide_drive_t *, struct ide_atapi_pc *); 1150void ide_create_request_sense_cmd(ide_drive_t *, struct ide_atapi_pc *);
1177void ide_retry_pc(ide_drive_t *, struct gendisk *); 1151void ide_retry_pc(ide_drive_t *drive);
1152
1153void ide_prep_sense(ide_drive_t *drive, struct request *rq);
1154int ide_queue_sense_rq(ide_drive_t *drive, void *special);
1178 1155
1179int ide_cd_expiry(ide_drive_t *); 1156int ide_cd_expiry(ide_drive_t *);
1180 1157
@@ -1225,7 +1202,7 @@ static inline int ide_pci_is_in_compatibility_mode(struct pci_dev *dev)
1225} 1202}
1226 1203
1227void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, 1204void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *,
1228 hw_regs_t *, hw_regs_t **); 1205 struct ide_hw *, struct ide_hw **);
1229void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); 1206void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *);
1230 1207
1231#ifdef CONFIG_BLK_DEV_IDEDMA_PCI 1208#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
@@ -1464,16 +1441,18 @@ static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
1464void ide_register_region(struct gendisk *); 1441void ide_register_region(struct gendisk *);
1465void ide_unregister_region(struct gendisk *); 1442void ide_unregister_region(struct gendisk *);
1466 1443
1444void ide_check_nien_quirk_list(ide_drive_t *);
1467void ide_undecoded_slave(ide_drive_t *); 1445void ide_undecoded_slave(ide_drive_t *);
1468 1446
1469void ide_port_apply_params(ide_hwif_t *); 1447void ide_port_apply_params(ide_hwif_t *);
1470int ide_sysfs_register_port(ide_hwif_t *); 1448int ide_sysfs_register_port(ide_hwif_t *);
1471 1449
1472struct ide_host *ide_host_alloc(const struct ide_port_info *, hw_regs_t **); 1450struct ide_host *ide_host_alloc(const struct ide_port_info *, struct ide_hw **,
1451 unsigned int);
1473void ide_host_free(struct ide_host *); 1452void ide_host_free(struct ide_host *);
1474int ide_host_register(struct ide_host *, const struct ide_port_info *, 1453int ide_host_register(struct ide_host *, const struct ide_port_info *,
1475 hw_regs_t **); 1454 struct ide_hw **);
1476int ide_host_add(const struct ide_port_info *, hw_regs_t **, 1455int ide_host_add(const struct ide_port_info *, struct ide_hw **, unsigned int,
1477 struct ide_host **); 1456 struct ide_host **);
1478void ide_host_remove(struct ide_host *); 1457void ide_host_remove(struct ide_host *);
1479int ide_legacy_device_add(const struct ide_port_info *, unsigned long); 1458int ide_legacy_device_add(const struct ide_port_info *, unsigned long);
@@ -1533,6 +1512,7 @@ int ide_timing_compute(ide_drive_t *, u8, struct ide_timing *, int, int);
1533int ide_scan_pio_blacklist(char *); 1512int ide_scan_pio_blacklist(char *);
1534const char *ide_xfer_verbose(u8); 1513const char *ide_xfer_verbose(u8);
1535u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); 1514u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8);
1515int ide_pio_need_iordy(ide_drive_t *, const u8);
1536int ide_set_pio_mode(ide_drive_t *, u8); 1516int ide_set_pio_mode(ide_drive_t *, u8);
1537int ide_set_dma_mode(ide_drive_t *, u8); 1517int ide_set_dma_mode(ide_drive_t *, u8);
1538void ide_set_pio(ide_drive_t *, u8); 1518void ide_set_pio(ide_drive_t *, u8);
@@ -1570,6 +1550,16 @@ static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive)
1570 return (peer->dev_flags & IDE_DFLAG_PRESENT) ? peer : NULL; 1550 return (peer->dev_flags & IDE_DFLAG_PRESENT) ? peer : NULL;
1571} 1551}
1572 1552
1553static inline void *ide_get_drivedata(ide_drive_t *drive)
1554{
1555 return drive->drive_data;
1556}
1557
1558static inline void ide_set_drivedata(ide_drive_t *drive, void *data)
1559{
1560 drive->drive_data = data;
1561}
1562
1573#define ide_port_for_each_dev(i, dev, port) \ 1563#define ide_port_for_each_dev(i, dev, port) \
1574 for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++) 1564 for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++)
1575 1565
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 4b501b48ce86..a9173d5434d1 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -493,6 +493,7 @@ struct ieee80211s_hdr {
493/* Mesh flags */ 493/* Mesh flags */
494#define MESH_FLAGS_AE_A4 0x1 494#define MESH_FLAGS_AE_A4 0x1
495#define MESH_FLAGS_AE_A5_A6 0x2 495#define MESH_FLAGS_AE_A5_A6 0x2
496#define MESH_FLAGS_AE 0x3
496#define MESH_FLAGS_PS_DEEP 0x4 497#define MESH_FLAGS_PS_DEEP 0x4
497 498
498/** 499/**
@@ -540,10 +541,10 @@ struct ieee80211_tim_ie {
540 u8 dtim_period; 541 u8 dtim_period;
541 u8 bitmap_ctrl; 542 u8 bitmap_ctrl;
542 /* variable size: 1 - 251 bytes */ 543 /* variable size: 1 - 251 bytes */
543 u8 virtual_map[0]; 544 u8 virtual_map[1];
544} __attribute__ ((packed)); 545} __attribute__ ((packed));
545 546
546#define WLAN_SA_QUERY_TR_ID_LEN 16 547#define WLAN_SA_QUERY_TR_ID_LEN 2
547 548
548struct ieee80211_mgmt { 549struct ieee80211_mgmt {
549 __le16 frame_control; 550 __le16 frame_control;
@@ -1068,8 +1069,12 @@ enum ieee80211_category {
1068 WLAN_CATEGORY_DLS = 2, 1069 WLAN_CATEGORY_DLS = 2,
1069 WLAN_CATEGORY_BACK = 3, 1070 WLAN_CATEGORY_BACK = 3,
1070 WLAN_CATEGORY_PUBLIC = 4, 1071 WLAN_CATEGORY_PUBLIC = 4,
1072 WLAN_CATEGORY_HT = 7,
1071 WLAN_CATEGORY_SA_QUERY = 8, 1073 WLAN_CATEGORY_SA_QUERY = 8,
1074 WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9,
1072 WLAN_CATEGORY_WMM = 17, 1075 WLAN_CATEGORY_WMM = 17,
1076 WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126,
1077 WLAN_CATEGORY_VENDOR_SPECIFIC = 127,
1073}; 1078};
1074 1079
1075/* SPECTRUM_MGMT action code */ 1080/* SPECTRUM_MGMT action code */
@@ -1081,6 +1086,15 @@ enum ieee80211_spectrum_mgmt_actioncode {
1081 WLAN_ACTION_SPCT_CHL_SWITCH = 4, 1086 WLAN_ACTION_SPCT_CHL_SWITCH = 4,
1082}; 1087};
1083 1088
1089/* Security key length */
1090enum ieee80211_key_len {
1091 WLAN_KEY_LEN_WEP40 = 5,
1092 WLAN_KEY_LEN_WEP104 = 13,
1093 WLAN_KEY_LEN_CCMP = 16,
1094 WLAN_KEY_LEN_TKIP = 32,
1095 WLAN_KEY_LEN_AES_CMAC = 16,
1096};
1097
1084/* 1098/*
1085 * IEEE 802.11-2007 7.3.2.9 Country information element 1099 * IEEE 802.11-2007 7.3.2.9 Country information element
1086 * 1100 *
@@ -1261,7 +1275,9 @@ static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
1261 if (ieee80211_has_protected(hdr->frame_control)) 1275 if (ieee80211_has_protected(hdr->frame_control))
1262 return true; 1276 return true;
1263 category = ((u8 *) hdr) + 24; 1277 category = ((u8 *) hdr) + 24;
1264 return *category != WLAN_CATEGORY_PUBLIC; 1278 return *category != WLAN_CATEGORY_PUBLIC &&
1279 *category != WLAN_CATEGORY_HT &&
1280 *category != WLAN_CATEGORY_VENDOR_SPECIFIC;
1265 } 1281 }
1266 1282
1267 return false; 1283 return false;
@@ -1383,4 +1399,43 @@ static inline int ieee80211_freq_to_ofdm_chan(int s_freq, int freq)
1383 return -1; 1399 return -1;
1384} 1400}
1385 1401
1402/**
1403 * ieee80211_tu_to_usec - convert time units (TU) to microseconds
1404 * @tu: the TUs
1405 */
1406static inline unsigned long ieee80211_tu_to_usec(unsigned long tu)
1407{
1408 return 1024 * tu;
1409}
1410
1411/**
1412 * ieee80211_check_tim - check if AID bit is set in TIM
1413 * @tim: the TIM IE
1414 * @tim_len: length of the TIM IE
1415 * @aid: the AID to look for
1416 */
1417static inline bool ieee80211_check_tim(struct ieee80211_tim_ie *tim,
1418 u8 tim_len, u16 aid)
1419{
1420 u8 mask;
1421 u8 index, indexn1, indexn2;
1422
1423 if (unlikely(!tim || tim_len < sizeof(*tim)))
1424 return false;
1425
1426 aid &= 0x3fff;
1427 index = aid / 8;
1428 mask = 1 << (aid & 7);
1429
1430 indexn1 = tim->bitmap_ctrl & 0xfe;
1431 indexn2 = tim_len + indexn1 - 4;
1432
1433 if (index < indexn1 || index > indexn2)
1434 return false;
1435
1436 index -= indexn1;
1437
1438 return !!(tim->virtual_map[index] & mask);
1439}
1440
1386#endif /* LINUX_IEEE80211_H */ 1441#endif /* LINUX_IEEE80211_H */
diff --git a/include/linux/if.h b/include/linux/if.h
index 1108f3e099e3..b9a6229f3be7 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -67,6 +67,9 @@
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#define IFF_WAN_HDLC 0x200 /* WAN HDLC device */
70#define IFF_XMIT_DST_RELEASE 0x400 /* dev_hard_start_xmit() is allowed to
71 * release skb->dst
72 */
70 73
71#define IF_GET_IFACE 0x0001 /* for querying only */ 74#define IF_GET_IFACE 0x0001 /* for querying only */
72#define IF_GET_PROTO 0x0002 75#define IF_GET_PROTO 0x0002
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 5ff89809a581..b554300ef8bf 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -86,6 +86,8 @@
86#define ARPHRD_IEEE80211 801 /* IEEE 802.11 */ 86#define ARPHRD_IEEE80211 801 /* IEEE 802.11 */
87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ 87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */
88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ 88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */
89#define ARPHRD_IEEE802154 804
90#define ARPHRD_IEEE802154_PHY 805
89 91
90#define ARPHRD_PHONET 820 /* PhoNet media type */ 92#define ARPHRD_PHONET 820 /* PhoNet media type */
91#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */ 93#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index cfe4fe1b7132..ae3a1871413d 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -79,6 +79,7 @@
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_FCOE 0x8906 /* Fibre Channel over Ethernet */
82#define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */
82#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ 83#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
83 84
84/* 85/*
@@ -106,6 +107,7 @@
106#define ETH_P_DSA 0x001B /* Distributed Switch Arch. */ 107#define ETH_P_DSA 0x001B /* Distributed Switch Arch. */
107#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */ 108#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */
108#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */ 109#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */
110#define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */
109 111
110/* 112/*
111 * This is an Ethernet frame header. 113 * This is an Ethernet frame header.
diff --git a/include/linux/if_packet.h b/include/linux/if_packet.h
index 18db0668065a..dea7d6b7cf98 100644
--- a/include/linux/if_packet.h
+++ b/include/linux/if_packet.h
@@ -46,6 +46,8 @@ struct sockaddr_ll
46#define PACKET_VERSION 10 46#define PACKET_VERSION 10
47#define PACKET_HDRLEN 11 47#define PACKET_HDRLEN 11
48#define PACKET_RESERVE 12 48#define PACKET_RESERVE 12
49#define PACKET_TX_RING 13
50#define PACKET_LOSS 14
49 51
50struct tpacket_stats 52struct tpacket_stats
51{ 53{
@@ -63,14 +65,22 @@ struct tpacket_auxdata
63 __u16 tp_vlan_tci; 65 __u16 tp_vlan_tci;
64}; 66};
65 67
68/* Rx ring - header status */
69#define TP_STATUS_KERNEL 0x0
70#define TP_STATUS_USER 0x1
71#define TP_STATUS_COPY 0x2
72#define TP_STATUS_LOSING 0x4
73#define TP_STATUS_CSUMNOTREADY 0x8
74
75/* Tx ring - header status */
76#define TP_STATUS_AVAILABLE 0x0
77#define TP_STATUS_SEND_REQUEST 0x1
78#define TP_STATUS_SENDING 0x2
79#define TP_STATUS_WRONG_FORMAT 0x4
80
66struct tpacket_hdr 81struct tpacket_hdr
67{ 82{
68 unsigned long tp_status; 83 unsigned long tp_status;
69#define TP_STATUS_KERNEL 0
70#define TP_STATUS_USER 1
71#define TP_STATUS_COPY 2
72#define TP_STATUS_LOSING 4
73#define TP_STATUS_CSUMNOTREADY 8
74 unsigned int tp_len; 84 unsigned int tp_len;
75 unsigned int tp_snaplen; 85 unsigned int tp_snaplen;
76 unsigned short tp_mac; 86 unsigned short tp_mac;
@@ -135,5 +145,6 @@ struct packet_mreq
135#define PACKET_MR_MULTICAST 0 145#define PACKET_MR_MULTICAST 0
136#define PACKET_MR_PROMISC 1 146#define PACKET_MR_PROMISC 1
137#define PACKET_MR_ALLMULTI 2 147#define PACKET_MR_ALLMULTI 2
148#define PACKET_MR_UNICAST 3
138 149
139#endif 150#endif
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 049d6c9428db..915ba5789f0e 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -55,6 +55,7 @@
55#define IFF_NO_PI 0x1000 55#define IFF_NO_PI 0x1000
56#define IFF_ONE_QUEUE 0x2000 56#define IFF_ONE_QUEUE 0x2000
57#define IFF_VNET_HDR 0x4000 57#define IFF_VNET_HDR 0x4000
58#define IFF_TUN_EXCL 0x8000
58 59
59/* Features for GSO (TUNSETOFFLOAD). */ 60/* Features for GSO (TUNSETOFFLOAD). */
60#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */ 61#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 5a9aae4adb44..5eb9b0f857e0 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -44,7 +44,7 @@ struct ip_tunnel_prl {
44 __u16 flags; 44 __u16 flags;
45 __u16 __reserved; 45 __u16 __reserved;
46 __u32 datalen; 46 __u32 datalen;
47 __u32 __reserved2; 47 __u32 rs_delay;
48 /* data follows */ 48 /* data follows */
49}; 49};
50 50
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index e1ff5b14310e..7ff9af1d0f05 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -118,8 +118,7 @@ extern int vlan_hwaccel_do_receive(struct sk_buff *skb);
118extern int vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp, 118extern int vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp,
119 unsigned int vlan_tci, struct sk_buff *skb); 119 unsigned int vlan_tci, struct sk_buff *skb);
120extern int vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp, 120extern int vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
121 unsigned int vlan_tci, 121 unsigned int vlan_tci);
122 struct napi_gro_fraginfo *info);
123 122
124#else 123#else
125static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev) 124static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev)
@@ -154,8 +153,7 @@ static inline int vlan_gro_receive(struct napi_struct *napi,
154} 153}
155 154
156static inline int vlan_gro_frags(struct napi_struct *napi, 155static inline int vlan_gro_frags(struct napi_struct *napi,
157 struct vlan_group *grp, unsigned int vlan_tci, 156 struct vlan_group *grp, unsigned int vlan_tci)
158 struct napi_gro_fraginfo *info)
159{ 157{
160 return NET_RX_DROP; 158 return NET_RX_DROP;
161} 159}
diff --git a/include/linux/ima.h b/include/linux/ima.h
index 0e2aa45cb0ce..b1b827d091a9 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -13,14 +13,17 @@
13#include <linux/fs.h> 13#include <linux/fs.h>
14struct linux_binprm; 14struct linux_binprm;
15 15
16#define IMA_COUNT_UPDATE 1
17#define IMA_COUNT_LEAVE 0
18
16#ifdef CONFIG_IMA 19#ifdef CONFIG_IMA
17extern int ima_bprm_check(struct linux_binprm *bprm); 20extern int ima_bprm_check(struct linux_binprm *bprm);
18extern int ima_inode_alloc(struct inode *inode); 21extern int ima_inode_alloc(struct inode *inode);
19extern void ima_inode_free(struct inode *inode); 22extern void ima_inode_free(struct inode *inode);
20extern int ima_path_check(struct path *path, int mask); 23extern int ima_path_check(struct path *path, int mask, int update_counts);
21extern void ima_file_free(struct file *file); 24extern void ima_file_free(struct file *file);
22extern int ima_file_mmap(struct file *file, unsigned long prot); 25extern int ima_file_mmap(struct file *file, unsigned long prot);
23extern void ima_shm_check(struct file *file); 26extern void ima_counts_get(struct file *file);
24 27
25#else 28#else
26static inline int ima_bprm_check(struct linux_binprm *bprm) 29static inline int ima_bprm_check(struct linux_binprm *bprm)
@@ -38,7 +41,7 @@ static inline void ima_inode_free(struct inode *inode)
38 return; 41 return;
39} 42}
40 43
41static inline int ima_path_check(struct path *path, int mask) 44static inline int ima_path_check(struct path *path, int mask, int update_counts)
42{ 45{
43 return 0; 46 return 0;
44} 47}
@@ -53,7 +56,7 @@ static inline int ima_file_mmap(struct file *file, unsigned long prot)
53 return 0; 56 return 0;
54} 57}
55 58
56static inline void ima_shm_check(struct file *file) 59static inline void ima_counts_get(struct file *file)
57{ 60{
58 return; 61 return;
59} 62}
diff --git a/include/linux/in.h b/include/linux/in.h
index d60122a3a088..cf196da04ec9 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -107,6 +107,7 @@ struct in_addr {
107#define MCAST_JOIN_SOURCE_GROUP 46 107#define MCAST_JOIN_SOURCE_GROUP 46
108#define MCAST_LEAVE_SOURCE_GROUP 47 108#define MCAST_LEAVE_SOURCE_GROUP 47
109#define MCAST_MSFILTER 48 109#define MCAST_MSFILTER 48
110#define IP_MULTICAST_ALL 49
110 111
111#define MCAST_EXCLUDE 0 112#define MCAST_EXCLUDE 0
112#define MCAST_INCLUDE 1 113#define MCAST_INCLUDE 1
diff --git a/include/linux/init.h b/include/linux/init.h
index 0e06c176f185..13b633ed695e 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -2,8 +2,6 @@
2#define _LINUX_INIT_H 2#define _LINUX_INIT_H
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/section-names.h>
6#include <linux/stringify.h>
7 5
8/* These macros are used to mark some functions or 6/* These macros are used to mark some functions or
9 * initialized data (doesn't apply to uninitialized data) 7 * initialized data (doesn't apply to uninitialized data)
@@ -31,7 +29,7 @@
31 * sign followed by value, e.g.: 29 * sign followed by value, e.g.:
32 * 30 *
33 * static int init_variable __initdata = 0; 31 * static int init_variable __initdata = 0;
34 * static char linux_logo[] __initdata = { 0x32, 0x36, ... }; 32 * static const char linux_logo[] __initconst = { 0x32, 0x36, ... };
35 * 33 *
36 * Don't forget to initialize data not at file scope, i.e. within a function, 34 * Don't forget to initialize data not at file scope, i.e. within a function,
37 * as gcc otherwise puts the data into the bss section and not into the init 35 * as gcc otherwise puts the data into the bss section and not into the init
@@ -101,7 +99,7 @@
101#define __memexitconst __section(.memexit.rodata) 99#define __memexitconst __section(.memexit.rodata)
102 100
103/* For assembly routines */ 101/* For assembly routines */
104#define __HEAD .section __stringify(HEAD_TEXT_SECTION),"ax" 102#define __HEAD .section ".head.text","ax"
105#define __INIT .section ".init.text","ax" 103#define __INIT .section ".init.text","ax"
106#define __FINIT .previous 104#define __FINIT .previous
107 105
@@ -136,6 +134,9 @@ typedef void (*exitcall_t)(void);
136extern initcall_t __con_initcall_start[], __con_initcall_end[]; 134extern initcall_t __con_initcall_start[], __con_initcall_end[];
137extern initcall_t __security_initcall_start[], __security_initcall_end[]; 135extern initcall_t __security_initcall_start[], __security_initcall_end[];
138 136
137/* Used for contructor calls. */
138typedef void (*ctor_fn_t)(void);
139
139/* Defined in init/main.c */ 140/* Defined in init/main.c */
140extern int do_one_initcall(initcall_t fn); 141extern int do_one_initcall(initcall_t fn);
141extern char __initdata boot_command_line[]; 142extern char __initdata boot_command_line[];
@@ -225,7 +226,8 @@ struct obs_kernel_param {
225 * obs_kernel_param "array" too far apart in .init.setup. 226 * obs_kernel_param "array" too far apart in .init.setup.
226 */ 227 */
227#define __setup_param(str, unique_id, fn, early) \ 228#define __setup_param(str, unique_id, fn, early) \
228 static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \ 229 static const char __setup_str_##unique_id[] __initconst \
230 __aligned(1) = str; \
229 static struct obs_kernel_param __setup_##unique_id \ 231 static struct obs_kernel_param __setup_##unique_id \
230 __used __section(.init.setup) \ 232 __used __section(.init.setup) \
231 __attribute__((aligned((sizeof(long))))) \ 233 __attribute__((aligned((sizeof(long))))) \
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index d87247d2641f..5368fbdc7801 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -15,18 +15,6 @@
15extern struct files_struct init_files; 15extern struct files_struct init_files;
16extern struct fs_struct init_fs; 16extern struct fs_struct init_fs;
17 17
18#define INIT_MM(name) \
19{ \
20 .mm_rb = RB_ROOT, \
21 .pgd = swapper_pg_dir, \
22 .mm_users = ATOMIC_INIT(2), \
23 .mm_count = ATOMIC_INIT(1), \
24 .mmap_sem = __RWSEM_INITIALIZER(name.mmap_sem), \
25 .page_table_lock = __SPIN_LOCK_UNLOCKED(name.page_table_lock), \
26 .mmlist = LIST_HEAD_INIT(name.mmlist), \
27 .cpu_vm_mask = CPU_MASK_ALL, \
28}
29
30#define INIT_SIGNALS(sig) { \ 18#define INIT_SIGNALS(sig) { \
31 .count = ATOMIC_INIT(1), \ 19 .count = ATOMIC_INIT(1), \
32 .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\ 20 .wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
@@ -108,6 +96,15 @@ extern struct group_info init_groups;
108 96
109extern struct cred init_cred; 97extern struct cred init_cred;
110 98
99#ifdef CONFIG_PERF_COUNTERS
100# define INIT_PERF_COUNTERS(tsk) \
101 .perf_counter_mutex = \
102 __MUTEX_INITIALIZER(tsk.perf_counter_mutex), \
103 .perf_counter_list = LIST_HEAD_INIT(tsk.perf_counter_list),
104#else
105# define INIT_PERF_COUNTERS(tsk)
106#endif
107
111/* 108/*
112 * INIT_TASK is used to set up the first task table, touch at 109 * INIT_TASK is used to set up the first task table, touch at
113 * your own risk!. Base=0, limit=0x1fffff (=2MB) 110 * your own risk!. Base=0, limit=0x1fffff (=2MB)
@@ -145,8 +142,8 @@ extern struct cred init_cred;
145 .group_leader = &tsk, \ 142 .group_leader = &tsk, \
146 .real_cred = &init_cred, \ 143 .real_cred = &init_cred, \
147 .cred = &init_cred, \ 144 .cred = &init_cred, \
148 .cred_exec_mutex = \ 145 .cred_guard_mutex = \
149 __MUTEX_INITIALIZER(tsk.cred_exec_mutex), \ 146 __MUTEX_INITIALIZER(tsk.cred_guard_mutex), \
150 .comm = "swapper", \ 147 .comm = "swapper", \
151 .thread = INIT_THREAD, \ 148 .thread = INIT_THREAD, \
152 .fs = &init_fs, \ 149 .fs = &init_fs, \
@@ -171,9 +168,11 @@ extern struct cred init_cred;
171 }, \ 168 }, \
172 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \ 169 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \
173 INIT_IDS \ 170 INIT_IDS \
171 INIT_PERF_COUNTERS(tsk) \
174 INIT_TRACE_IRQFLAGS \ 172 INIT_TRACE_IRQFLAGS \
175 INIT_LOCKDEP \ 173 INIT_LOCKDEP \
176 INIT_FTRACE_GRAPH \ 174 INIT_FTRACE_GRAPH \
175 INIT_TRACE_RECURSION \
177} 176}
178 177
179 178
diff --git a/include/linux/input.h b/include/linux/input.h
index 6fed4f6a9c9e..8b3bc3e0d146 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -53,6 +53,7 @@ struct input_absinfo {
53 __s32 maximum; 53 __s32 maximum;
54 __s32 fuzz; 54 __s32 fuzz;
55 __s32 flat; 55 __s32 flat;
56 __s32 resolution;
56}; 57};
57 58
58#define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */ 59#define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */
@@ -1109,6 +1110,7 @@ struct input_dev {
1109 int absmin[ABS_MAX + 1]; 1110 int absmin[ABS_MAX + 1];
1110 int absfuzz[ABS_MAX + 1]; 1111 int absfuzz[ABS_MAX + 1];
1111 int absflat[ABS_MAX + 1]; 1112 int absflat[ABS_MAX + 1];
1113 int absres[ABS_MAX + 1];
1112 1114
1113 int (*open)(struct input_dev *dev); 1115 int (*open)(struct input_dev *dev);
1114 void (*close)(struct input_dev *dev); 1116 void (*close)(struct input_dev *dev);
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index aa8c53171233..482dc91fd53a 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -53,6 +53,7 @@
53#define DMAR_PHMLIMIT_REG 0x78 /* pmrr high limit */ 53#define DMAR_PHMLIMIT_REG 0x78 /* pmrr high limit */
54#define DMAR_IQH_REG 0x80 /* Invalidation queue head register */ 54#define DMAR_IQH_REG 0x80 /* Invalidation queue head register */
55#define DMAR_IQT_REG 0x88 /* Invalidation queue tail register */ 55#define DMAR_IQT_REG 0x88 /* Invalidation queue tail register */
56#define DMAR_IQ_SHIFT 4 /* Invalidation queue head/tail shift */
56#define DMAR_IQA_REG 0x90 /* Invalidation queue addr register */ 57#define DMAR_IQA_REG 0x90 /* Invalidation queue addr register */
57#define DMAR_ICS_REG 0x98 /* Invalidation complete status register */ 58#define DMAR_ICS_REG 0x98 /* Invalidation complete status register */
58#define DMAR_IRTA_REG 0xb8 /* Interrupt remapping table addr register */ 59#define DMAR_IRTA_REG 0xb8 /* Interrupt remapping table addr register */
@@ -120,8 +121,10 @@ static inline void dmar_writeq(void __iomem *addr, u64 val)
120 (ecap_iotlb_offset(e) + ecap_niotlb_iunits(e) * 16) 121 (ecap_iotlb_offset(e) + ecap_niotlb_iunits(e) * 16)
121#define ecap_coherent(e) ((e) & 0x1) 122#define ecap_coherent(e) ((e) & 0x1)
122#define ecap_qis(e) ((e) & 0x2) 123#define ecap_qis(e) ((e) & 0x2)
124#define ecap_pass_through(e) ((e >> 6) & 0x1)
123#define ecap_eim_support(e) ((e >> 4) & 0x1) 125#define ecap_eim_support(e) ((e >> 4) & 0x1)
124#define ecap_ir_support(e) ((e >> 3) & 0x1) 126#define ecap_ir_support(e) ((e >> 3) & 0x1)
127#define ecap_dev_iotlb_support(e) (((e) >> 2) & 0x1)
125#define ecap_max_handle_mask(e) ((e >> 20) & 0xf) 128#define ecap_max_handle_mask(e) ((e >> 20) & 0xf)
126#define ecap_sc_support(e) ((e >> 7) & 0x1) /* Snooping Control */ 129#define ecap_sc_support(e) ((e >> 7) & 0x1) /* Snooping Control */
127 130
@@ -197,6 +200,8 @@ static inline void dmar_writeq(void __iomem *addr, u64 val)
197#define DMA_FSTS_PPF ((u32)2) 200#define DMA_FSTS_PPF ((u32)2)
198#define DMA_FSTS_PFO ((u32)1) 201#define DMA_FSTS_PFO ((u32)1)
199#define DMA_FSTS_IQE (1 << 4) 202#define DMA_FSTS_IQE (1 << 4)
203#define DMA_FSTS_ICE (1 << 5)
204#define DMA_FSTS_ITE (1 << 6)
200#define dma_fsts_fault_record_index(s) (((s) >> 8) & 0xff) 205#define dma_fsts_fault_record_index(s) (((s) >> 8) & 0xff)
201 206
202/* FRCD_REG, 32 bits access */ 207/* FRCD_REG, 32 bits access */
@@ -225,7 +230,8 @@ do { \
225enum { 230enum {
226 QI_FREE, 231 QI_FREE,
227 QI_IN_USE, 232 QI_IN_USE,
228 QI_DONE 233 QI_DONE,
234 QI_ABORT
229}; 235};
230 236
231#define QI_CC_TYPE 0x1 237#define QI_CC_TYPE 0x1
@@ -254,6 +260,12 @@ enum {
254#define QI_CC_DID(did) (((u64)did) << 16) 260#define QI_CC_DID(did) (((u64)did) << 16)
255#define QI_CC_GRAN(gran) (((u64)gran) >> (DMA_CCMD_INVL_GRANU_OFFSET-4)) 261#define QI_CC_GRAN(gran) (((u64)gran) >> (DMA_CCMD_INVL_GRANU_OFFSET-4))
256 262
263#define QI_DEV_IOTLB_SID(sid) ((u64)((sid) & 0xffff) << 32)
264#define QI_DEV_IOTLB_QDEP(qdep) (((qdep) & 0x1f) << 16)
265#define QI_DEV_IOTLB_ADDR(addr) ((u64)(addr) & VTD_PAGE_MASK)
266#define QI_DEV_IOTLB_SIZE 1
267#define QI_DEV_IOTLB_MAX_INVS 32
268
257struct qi_desc { 269struct qi_desc {
258 u64 low, high; 270 u64 low, high;
259}; 271};
@@ -280,10 +292,10 @@ struct ir_table {
280#endif 292#endif
281 293
282struct iommu_flush { 294struct iommu_flush {
283 int (*flush_context)(struct intel_iommu *iommu, u16 did, u16 sid, u8 fm, 295 void (*flush_context)(struct intel_iommu *iommu, u16 did, u16 sid,
284 u64 type, int non_present_entry_flush); 296 u8 fm, u64 type);
285 int (*flush_iotlb)(struct intel_iommu *iommu, u16 did, u64 addr, 297 void (*flush_iotlb)(struct intel_iommu *iommu, u16 did, u64 addr,
286 unsigned int size_order, u64 type, int non_present_entry_flush); 298 unsigned int size_order, u64 type);
287}; 299};
288 300
289enum { 301enum {
@@ -302,6 +314,7 @@ struct intel_iommu {
302 spinlock_t register_lock; /* protect register handling */ 314 spinlock_t register_lock; /* protect register handling */
303 int seq_id; /* sequence id of the iommu */ 315 int seq_id; /* sequence id of the iommu */
304 int agaw; /* agaw of this iommu */ 316 int agaw; /* agaw of this iommu */
317 int msagaw; /* max sagaw of this iommu */
305 unsigned int irq; 318 unsigned int irq;
306 unsigned char name[13]; /* Device Name */ 319 unsigned char name[13]; /* Device Name */
307 320
@@ -329,6 +342,7 @@ static inline void __iommu_flush_cache(
329} 342}
330 343
331extern struct dmar_drhd_unit * dmar_find_matched_drhd_unit(struct pci_dev *dev); 344extern struct dmar_drhd_unit * dmar_find_matched_drhd_unit(struct pci_dev *dev);
345extern int dmar_find_matched_atsr_unit(struct pci_dev *dev);
332 346
333extern int alloc_iommu(struct dmar_drhd_unit *drhd); 347extern int alloc_iommu(struct dmar_drhd_unit *drhd);
334extern void free_iommu(struct intel_iommu *iommu); 348extern void free_iommu(struct intel_iommu *iommu);
@@ -337,11 +351,12 @@ extern void dmar_disable_qi(struct intel_iommu *iommu);
337extern int dmar_reenable_qi(struct intel_iommu *iommu); 351extern int dmar_reenable_qi(struct intel_iommu *iommu);
338extern void qi_global_iec(struct intel_iommu *iommu); 352extern void qi_global_iec(struct intel_iommu *iommu);
339 353
340extern int qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid, 354extern void qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid,
341 u8 fm, u64 type, int non_present_entry_flush); 355 u8 fm, u64 type);
342extern int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr, 356extern void qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr,
343 unsigned int size_order, u64 type, 357 unsigned int size_order, u64 type);
344 int non_present_entry_flush); 358extern void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 qdep,
359 u64 addr, unsigned mask);
345 360
346extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); 361extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
347 362
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 91bb76f44f14..2721f07e9354 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -183,6 +183,7 @@ extern void disable_irq(unsigned int irq);
183extern void enable_irq(unsigned int irq); 183extern void enable_irq(unsigned int irq);
184 184
185/* The following three functions are for the core kernel use only. */ 185/* The following three functions are for the core kernel use only. */
186#ifdef CONFIG_GENERIC_HARDIRQS
186extern void suspend_device_irqs(void); 187extern void suspend_device_irqs(void);
187extern void resume_device_irqs(void); 188extern void resume_device_irqs(void);
188#ifdef CONFIG_PM_SLEEP 189#ifdef CONFIG_PM_SLEEP
@@ -190,6 +191,11 @@ extern int check_wakeup_irqs(void);
190#else 191#else
191static inline int check_wakeup_irqs(void) { return 0; } 192static inline int check_wakeup_irqs(void) { return 0; }
192#endif 193#endif
194#else
195static inline void suspend_device_irqs(void) { };
196static inline void resume_device_irqs(void) { };
197static inline int check_wakeup_irqs(void) { return 0; }
198#endif
193 199
194#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS) 200#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
195 201
@@ -466,6 +472,20 @@ static inline void tasklet_hi_schedule(struct tasklet_struct *t)
466 __tasklet_hi_schedule(t); 472 __tasklet_hi_schedule(t);
467} 473}
468 474
475extern void __tasklet_hi_schedule_first(struct tasklet_struct *t);
476
477/*
478 * This version avoids touching any other tasklets. Needed for kmemcheck
479 * in order not to take any page faults while enqueueing this tasklet;
480 * consider VERY carefully whether you really need this or
481 * tasklet_hi_schedule()...
482 */
483static inline void tasklet_hi_schedule_first(struct tasklet_struct *t)
484{
485 if (!test_and_set_bit(TASKLET_STATE_SCHED, &t->state))
486 __tasklet_hi_schedule_first(t);
487}
488
469 489
470static inline void tasklet_disable_nosync(struct tasklet_struct *t) 490static inline void tasklet_disable_nosync(struct tasklet_struct *t)
471{ 491{
@@ -566,6 +586,6 @@ struct irq_desc;
566extern int early_irq_init(void); 586extern int early_irq_init(void);
567extern int arch_probe_nr_irqs(void); 587extern int arch_probe_nr_irqs(void);
568extern int arch_early_irq_init(void); 588extern int arch_early_irq_init(void);
569extern int arch_init_chip_data(struct irq_desc *desc, int cpu); 589extern int arch_init_chip_data(struct irq_desc *desc, int node);
570 590
571#endif 591#endif
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index 08b987bccf89..dd05434fa45f 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -64,7 +64,7 @@ struct cfq_io_context {
64 * and kmalloc'ed. These could be shared between processes. 64 * and kmalloc'ed. These could be shared between processes.
65 */ 65 */
66struct io_context { 66struct io_context {
67 atomic_t refcount; 67 atomic_long_t refcount;
68 atomic_t nr_tasks; 68 atomic_t nr_tasks;
69 69
70 /* all the fields below are protected by this lock */ 70 /* all the fields below are protected by this lock */
@@ -91,8 +91,8 @@ static inline struct io_context *ioc_task_link(struct io_context *ioc)
91 * if ref count is zero, don't allow sharing (ioc is going away, it's 91 * if ref count is zero, don't allow sharing (ioc is going away, it's
92 * a race). 92 * a race).
93 */ 93 */
94 if (ioc && atomic_inc_not_zero(&ioc->refcount)) { 94 if (ioc && atomic_long_inc_not_zero(&ioc->refcount)) {
95 atomic_inc(&ioc->nr_tasks); 95 atomic_long_inc(&ioc->refcount);
96 return ioc; 96 return ioc;
97 } 97 }
98 98
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 32e4b2f72294..786e7b8cece9 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -49,6 +49,8 @@ struct resource_list {
49#define IORESOURCE_SIZEALIGN 0x00020000 /* size indicates alignment */ 49#define IORESOURCE_SIZEALIGN 0x00020000 /* size indicates alignment */
50#define IORESOURCE_STARTALIGN 0x00040000 /* start field is alignment */ 50#define IORESOURCE_STARTALIGN 0x00040000 /* start field is alignment */
51 51
52#define IORESOURCE_MEM_64 0x00100000
53
52#define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */ 54#define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */
53#define IORESOURCE_DISABLED 0x10000000 55#define IORESOURCE_DISABLED 0x10000000
54#define IORESOURCE_UNSET 0x20000000 56#define IORESOURCE_UNSET 0x20000000
diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
index 3bf40e246a80..e408722a84c7 100644
--- a/include/linux/ipc_namespace.h
+++ b/include/linux/ipc_namespace.h
@@ -94,13 +94,8 @@ static inline int mq_init_ns(struct ipc_namespace *ns) { return 0; }
94#endif 94#endif
95 95
96#if defined(CONFIG_IPC_NS) 96#if defined(CONFIG_IPC_NS)
97extern void free_ipc_ns(struct ipc_namespace *ns);
98extern struct ipc_namespace *copy_ipcs(unsigned long flags, 97extern struct ipc_namespace *copy_ipcs(unsigned long flags,
99 struct ipc_namespace *ns); 98 struct ipc_namespace *ns);
100extern void free_ipcs(struct ipc_namespace *ns, struct ipc_ids *ids,
101 void (*free)(struct ipc_namespace *,
102 struct kern_ipc_perm *));
103
104static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) 99static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
105{ 100{
106 if (ns) 101 if (ns)
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 476d9464ac82..c662efa68289 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -169,6 +169,12 @@ struct ipv6_devconf {
169 __s32 accept_dad; 169 __s32 accept_dad;
170 void *sysctl; 170 void *sysctl;
171}; 171};
172
173struct ipv6_params {
174 __s32 disable_ipv6;
175 __s32 autoconf;
176};
177extern struct ipv6_params ipv6_defaults;
172#endif 178#endif
173 179
174/* index values for the variables in ipv6_devconf */ 180/* index values for the variables in ipv6_devconf */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index b7cbeed972e4..cb2e77a3f7f7 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -117,7 +117,7 @@ struct irq_chip {
117 void (*eoi)(unsigned int irq); 117 void (*eoi)(unsigned int irq);
118 118
119 void (*end)(unsigned int irq); 119 void (*end)(unsigned int irq);
120 void (*set_affinity)(unsigned int irq, 120 int (*set_affinity)(unsigned int irq,
121 const struct cpumask *dest); 121 const struct cpumask *dest);
122 int (*retrigger)(unsigned int irq); 122 int (*retrigger)(unsigned int irq);
123 int (*set_type)(unsigned int irq, unsigned int flow_type); 123 int (*set_type)(unsigned int irq, unsigned int flow_type);
@@ -157,7 +157,7 @@ struct irq_2_iommu;
157 * @irqs_unhandled: stats field for spurious unhandled interrupts 157 * @irqs_unhandled: stats field for spurious unhandled interrupts
158 * @lock: locking for SMP 158 * @lock: locking for SMP
159 * @affinity: IRQ affinity on SMP 159 * @affinity: IRQ affinity on SMP
160 * @cpu: cpu index useful for balancing 160 * @node: node index useful for balancing
161 * @pending_mask: pending rebalanced interrupts 161 * @pending_mask: pending rebalanced interrupts
162 * @threads_active: number of irqaction threads currently running 162 * @threads_active: number of irqaction threads currently running
163 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers 163 * @wait_for_threads: wait queue for sync_irq to wait for threaded handlers
@@ -187,7 +187,7 @@ struct irq_desc {
187 spinlock_t lock; 187 spinlock_t lock;
188#ifdef CONFIG_SMP 188#ifdef CONFIG_SMP
189 cpumask_var_t affinity; 189 cpumask_var_t affinity;
190 unsigned int cpu; 190 unsigned int node;
191#ifdef CONFIG_GENERIC_PENDING_IRQ 191#ifdef CONFIG_GENERIC_PENDING_IRQ
192 cpumask_var_t pending_mask; 192 cpumask_var_t pending_mask;
193#endif 193#endif
@@ -201,26 +201,23 @@ struct irq_desc {
201} ____cacheline_internodealigned_in_smp; 201} ____cacheline_internodealigned_in_smp;
202 202
203extern void arch_init_copy_chip_data(struct irq_desc *old_desc, 203extern void arch_init_copy_chip_data(struct irq_desc *old_desc,
204 struct irq_desc *desc, int cpu); 204 struct irq_desc *desc, int node);
205extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc); 205extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc);
206 206
207#ifndef CONFIG_SPARSE_IRQ 207#ifndef CONFIG_SPARSE_IRQ
208extern struct irq_desc irq_desc[NR_IRQS]; 208extern struct irq_desc irq_desc[NR_IRQS];
209#else /* CONFIG_SPARSE_IRQ */ 209#endif
210extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu);
211#endif /* CONFIG_SPARSE_IRQ */
212
213extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu);
214 210
215static inline struct irq_desc * 211#ifdef CONFIG_NUMA_IRQ_DESC
216irq_remap_to_desc(unsigned int irq, struct irq_desc *desc) 212extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int node);
217{
218#ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC
219 return irq_to_desc(irq);
220#else 213#else
214static inline struct irq_desc *move_irq_desc(struct irq_desc *desc, int node)
215{
221 return desc; 216 return desc;
222#endif
223} 217}
218#endif
219
220extern struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node);
224 221
225/* 222/*
226 * Migration helpers for obsolete names, they will go away: 223 * Migration helpers for obsolete names, they will go away:
@@ -386,7 +383,7 @@ extern void set_irq_noprobe(unsigned int irq);
386extern void set_irq_probe(unsigned int irq); 383extern void set_irq_probe(unsigned int irq);
387 384
388/* Handle dynamic irq creation and destruction */ 385/* Handle dynamic irq creation and destruction */
389extern unsigned int create_irq_nr(unsigned int irq_want); 386extern unsigned int create_irq_nr(unsigned int irq_want, int node);
390extern int create_irq(void); 387extern int create_irq(void);
391extern void destroy_irq(unsigned int irq); 388extern void destroy_irq(unsigned int irq);
392 389
@@ -424,47 +421,44 @@ extern int set_irq_msi(unsigned int irq, struct msi_desc *entry);
424 421
425#ifdef CONFIG_SMP 422#ifdef CONFIG_SMP
426/** 423/**
427 * init_alloc_desc_masks - allocate cpumasks for irq_desc 424 * alloc_desc_masks - allocate cpumasks for irq_desc
428 * @desc: pointer to irq_desc struct 425 * @desc: pointer to irq_desc struct
429 * @cpu: cpu which will be handling the cpumasks 426 * @node: node which will be handling the cpumasks
430 * @boot: true if need bootmem 427 * @boot: true if need bootmem
431 * 428 *
432 * Allocates affinity and pending_mask cpumask if required. 429 * Allocates affinity and pending_mask cpumask if required.
433 * Returns true if successful (or not required). 430 * Returns true if successful (or not required).
434 * Side effect: affinity has all bits set, pending_mask has all bits clear.
435 */ 431 */
436static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu, 432static inline bool alloc_desc_masks(struct irq_desc *desc, int node,
437 bool boot) 433 bool boot)
438{ 434{
439 int node; 435 gfp_t gfp = GFP_ATOMIC;
440
441 if (boot) {
442 alloc_bootmem_cpumask_var(&desc->affinity);
443 cpumask_setall(desc->affinity);
444
445#ifdef CONFIG_GENERIC_PENDING_IRQ
446 alloc_bootmem_cpumask_var(&desc->pending_mask);
447 cpumask_clear(desc->pending_mask);
448#endif
449 return true;
450 }
451 436
452 node = cpu_to_node(cpu); 437 if (boot)
438 gfp = GFP_NOWAIT;
453 439
454 if (!alloc_cpumask_var_node(&desc->affinity, GFP_ATOMIC, node)) 440#ifdef CONFIG_CPUMASK_OFFSTACK
441 if (!alloc_cpumask_var_node(&desc->affinity, gfp, node))
455 return false; 442 return false;
456 cpumask_setall(desc->affinity);
457 443
458#ifdef CONFIG_GENERIC_PENDING_IRQ 444#ifdef CONFIG_GENERIC_PENDING_IRQ
459 if (!alloc_cpumask_var_node(&desc->pending_mask, GFP_ATOMIC, node)) { 445 if (!alloc_cpumask_var_node(&desc->pending_mask, gfp, node)) {
460 free_cpumask_var(desc->affinity); 446 free_cpumask_var(desc->affinity);
461 return false; 447 return false;
462 } 448 }
463 cpumask_clear(desc->pending_mask); 449#endif
464#endif 450#endif
465 return true; 451 return true;
466} 452}
467 453
454static inline void init_desc_masks(struct irq_desc *desc)
455{
456 cpumask_setall(desc->affinity);
457#ifdef CONFIG_GENERIC_PENDING_IRQ
458 cpumask_clear(desc->pending_mask);
459#endif
460}
461
468/** 462/**
469 * init_copy_desc_masks - copy cpumasks for irq_desc 463 * init_copy_desc_masks - copy cpumasks for irq_desc
470 * @old_desc: pointer to old irq_desc struct 464 * @old_desc: pointer to old irq_desc struct
@@ -478,7 +472,7 @@ static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu,
478static inline void init_copy_desc_masks(struct irq_desc *old_desc, 472static inline void init_copy_desc_masks(struct irq_desc *old_desc,
479 struct irq_desc *new_desc) 473 struct irq_desc *new_desc)
480{ 474{
481#ifdef CONFIG_CPUMASKS_OFFSTACK 475#ifdef CONFIG_CPUMASK_OFFSTACK
482 cpumask_copy(new_desc->affinity, old_desc->affinity); 476 cpumask_copy(new_desc->affinity, old_desc->affinity);
483 477
484#ifdef CONFIG_GENERIC_PENDING_IRQ 478#ifdef CONFIG_GENERIC_PENDING_IRQ
@@ -499,12 +493,16 @@ static inline void free_desc_masks(struct irq_desc *old_desc,
499 493
500#else /* !CONFIG_SMP */ 494#else /* !CONFIG_SMP */
501 495
502static inline bool init_alloc_desc_masks(struct irq_desc *desc, int cpu, 496static inline bool alloc_desc_masks(struct irq_desc *desc, int node,
503 bool boot) 497 bool boot)
504{ 498{
505 return true; 499 return true;
506} 500}
507 501
502static inline void init_desc_masks(struct irq_desc *desc)
503{
504}
505
508static inline void init_copy_desc_masks(struct irq_desc *old_desc, 506static inline void init_copy_desc_masks(struct irq_desc *old_desc,
509 struct irq_desc *new_desc) 507 struct irq_desc *new_desc)
510{ 508{
diff --git a/include/linux/isdn/capilli.h b/include/linux/isdn/capilli.h
index 35e9b0fd014b..7acb87a44872 100644
--- a/include/linux/isdn/capilli.h
+++ b/include/linux/isdn/capilli.h
@@ -79,7 +79,7 @@ int attach_capi_ctr(struct capi_ctr *);
79int detach_capi_ctr(struct capi_ctr *); 79int detach_capi_ctr(struct capi_ctr *);
80 80
81void capi_ctr_ready(struct capi_ctr * card); 81void capi_ctr_ready(struct capi_ctr * card);
82void capi_ctr_reseted(struct capi_ctr * card); 82void capi_ctr_down(struct capi_ctr * card);
83void capi_ctr_suspend_output(struct capi_ctr * card); 83void capi_ctr_suspend_output(struct capi_ctr * card);
84void capi_ctr_resume_output(struct capi_ctr * card); 84void capi_ctr_resume_output(struct capi_ctr * card);
85void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *skb); 85void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *skb);
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index cc02393bfce8..d97eb652d6ca 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -1315,6 +1315,12 @@ extern int jbd_blocks_per_page(struct inode *inode);
1315#define BUFFER_TRACE2(bh, bh2, info) do {} while (0) 1315#define BUFFER_TRACE2(bh, bh2, info) do {} while (0)
1316#define JBUFFER_TRACE(jh, info) do {} while (0) 1316#define JBUFFER_TRACE(jh, info) do {} while (0)
1317 1317
1318/*
1319 * jbd2_dev_to_name is a utility function used by the jbd2 and ext4
1320 * tracing infrastructure to map a dev_t to a device name.
1321 */
1322extern const char *jbd2_dev_to_name(dev_t device);
1323
1318#endif /* __KERNEL__ */ 1324#endif /* __KERNEL__ */
1319 1325
1320#endif /* _LINUX_JBD2_H */ 1326#endif /* _LINUX_JBD2_H */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 883cd44ff765..fac104e7186a 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -58,7 +58,7 @@ extern const char linux_proc_banner[];
58#define _RET_IP_ (unsigned long)__builtin_return_address(0) 58#define _RET_IP_ (unsigned long)__builtin_return_address(0)
59#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) 59#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
60 60
61#ifdef CONFIG_LBD 61#ifdef CONFIG_LBDAF
62# include <asm/div64.h> 62# include <asm/div64.h>
63# define sector_div(a, b) do_div(a, b) 63# define sector_div(a, b) do_div(a, b)
64#else 64#else
@@ -97,12 +97,14 @@ extern const char linux_proc_banner[];
97#define KERN_INFO "<6>" /* informational */ 97#define KERN_INFO "<6>" /* informational */
98#define KERN_DEBUG "<7>" /* debug-level messages */ 98#define KERN_DEBUG "<7>" /* debug-level messages */
99 99
100/* Use the default kernel loglevel */
101#define KERN_DEFAULT "<d>"
100/* 102/*
101 * Annotation for a "continued" line of log printout (only done after a 103 * Annotation for a "continued" line of log printout (only done after a
102 * line that had no enclosing \n). Only to be used by core/arch code 104 * line that had no enclosing \n). Only to be used by core/arch code
103 * during early bootup (a continued line is not SMP-safe otherwise). 105 * during early bootup (a continued line is not SMP-safe otherwise).
104 */ 106 */
105#define KERN_CONT "" 107#define KERN_CONT "<c>"
106 108
107extern int console_printk[]; 109extern int console_printk[];
108 110
@@ -406,7 +408,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
406 * 408 *
407 * Use tracing_on/tracing_off when you want to quickly turn on or off 409 * Use tracing_on/tracing_off when you want to quickly turn on or off
408 * tracing. It simply enables or disables the recording of the trace events. 410 * tracing. It simply enables or disables the recording of the trace events.
409 * This also corresponds to the user space debugfs/tracing/tracing_on 411 * This also corresponds to the user space /sys/kernel/debug/tracing/tracing_on
410 * file, which gives a means for the kernel and userspace to interact. 412 * file, which gives a means for the kernel and userspace to interact.
411 * Place a tracing_off() in the kernel where you want tracing to end. 413 * Place a tracing_off() in the kernel where you want tracing to end.
412 * From user space, examine the trace, and then echo 1 > tracing_on 414 * From user space, examine the trace, and then echo 1 > tracing_on
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 0c8b89f28a95..348fa8874b52 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -5,6 +5,7 @@
5#include <linux/threads.h> 5#include <linux/threads.h>
6#include <linux/percpu.h> 6#include <linux/percpu.h>
7#include <linux/cpumask.h> 7#include <linux/cpumask.h>
8#include <linux/interrupt.h>
8#include <asm/irq.h> 9#include <asm/irq.h>
9#include <asm/cputime.h> 10#include <asm/cputime.h>
10 11
@@ -31,6 +32,7 @@ struct kernel_stat {
31#ifndef CONFIG_GENERIC_HARDIRQS 32#ifndef CONFIG_GENERIC_HARDIRQS
32 unsigned int irqs[NR_IRQS]; 33 unsigned int irqs[NR_IRQS];
33#endif 34#endif
35 unsigned int softirqs[NR_SOFTIRQS];
34}; 36};
35 37
36DECLARE_PER_CPU(struct kernel_stat, kstat); 38DECLARE_PER_CPU(struct kernel_stat, kstat);
@@ -67,6 +69,16 @@ extern unsigned int kstat_irqs_cpu(unsigned int irq, int cpu);
67 69
68#endif 70#endif
69 71
72static inline void kstat_incr_softirqs_this_cpu(unsigned int irq)
73{
74 kstat_this_cpu.softirqs[irq]++;
75}
76
77static inline unsigned int kstat_softirqs_cpu(unsigned int irq, int cpu)
78{
79 return kstat_cpu(cpu).softirqs[irq];
80}
81
70/* 82/*
71 * Number of interrupts per specific IRQ source, since bootup 83 * Number of interrupts per specific IRQ source, since bootup
72 */ 84 */
@@ -81,7 +93,12 @@ static inline unsigned int kstat_irqs(unsigned int irq)
81 return sum; 93 return sum;
82} 94}
83 95
96
97/*
98 * Lock/unlock the current runqueue - to extract task statistics:
99 */
84extern unsigned long long task_delta_exec(struct task_struct *); 100extern unsigned long long task_delta_exec(struct task_struct *);
101
85extern void account_user_time(struct task_struct *, cputime_t, cputime_t); 102extern void account_user_time(struct task_struct *, cputime_t, cputime_t);
86extern void account_system_time(struct task_struct *, int, cputime_t, cputime_t); 103extern void account_system_time(struct task_struct *, int, cputime_t, cputime_t);
87extern void account_steal_time(cputime_t); 104extern void account_steal_time(cputime_t);
diff --git a/include/linux/keyboard.h b/include/linux/keyboard.h
index a3c984d780f0..33a63f62d57f 100644
--- a/include/linux/keyboard.h
+++ b/include/linux/keyboard.h
@@ -56,6 +56,7 @@ extern int unregister_keyboard_notifier(struct notifier_block *nb);
56#define KT_ASCII 9 56#define KT_ASCII 9
57#define KT_LOCK 10 57#define KT_LOCK 10
58#define KT_SLOCK 12 58#define KT_SLOCK 12
59#define KT_DEAD2 13
59#define KT_BRL 14 60#define KT_BRL 14
60 61
61#define K(t,v) (((t)<<8)|(v)) 62#define K(t,v) (((t)<<8)|(v))
diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h
new file mode 100644
index 000000000000..47b39b7c7e84
--- /dev/null
+++ b/include/linux/kmemcheck.h
@@ -0,0 +1,153 @@
1#ifndef LINUX_KMEMCHECK_H
2#define LINUX_KMEMCHECK_H
3
4#include <linux/mm_types.h>
5#include <linux/types.h>
6
7#ifdef CONFIG_KMEMCHECK
8extern int kmemcheck_enabled;
9
10/* The slab-related functions. */
11void kmemcheck_alloc_shadow(struct page *page, int order, gfp_t flags, int node);
12void kmemcheck_free_shadow(struct page *page, int order);
13void kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object,
14 size_t size);
15void kmemcheck_slab_free(struct kmem_cache *s, void *object, size_t size);
16
17void kmemcheck_pagealloc_alloc(struct page *p, unsigned int order,
18 gfp_t gfpflags);
19
20void kmemcheck_show_pages(struct page *p, unsigned int n);
21void kmemcheck_hide_pages(struct page *p, unsigned int n);
22
23bool kmemcheck_page_is_tracked(struct page *p);
24
25void kmemcheck_mark_unallocated(void *address, unsigned int n);
26void kmemcheck_mark_uninitialized(void *address, unsigned int n);
27void kmemcheck_mark_initialized(void *address, unsigned int n);
28void kmemcheck_mark_freed(void *address, unsigned int n);
29
30void kmemcheck_mark_unallocated_pages(struct page *p, unsigned int n);
31void kmemcheck_mark_uninitialized_pages(struct page *p, unsigned int n);
32void kmemcheck_mark_initialized_pages(struct page *p, unsigned int n);
33
34int kmemcheck_show_addr(unsigned long address);
35int kmemcheck_hide_addr(unsigned long address);
36
37#else
38#define kmemcheck_enabled 0
39
40static inline void
41kmemcheck_alloc_shadow(struct page *page, int order, gfp_t flags, int node)
42{
43}
44
45static inline void
46kmemcheck_free_shadow(struct page *page, int order)
47{
48}
49
50static inline void
51kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object,
52 size_t size)
53{
54}
55
56static inline void kmemcheck_slab_free(struct kmem_cache *s, void *object,
57 size_t size)
58{
59}
60
61static inline void kmemcheck_pagealloc_alloc(struct page *p,
62 unsigned int order, gfp_t gfpflags)
63{
64}
65
66static inline bool kmemcheck_page_is_tracked(struct page *p)
67{
68 return false;
69}
70
71static inline void kmemcheck_mark_unallocated(void *address, unsigned int n)
72{
73}
74
75static inline void kmemcheck_mark_uninitialized(void *address, unsigned int n)
76{
77}
78
79static inline void kmemcheck_mark_initialized(void *address, unsigned int n)
80{
81}
82
83static inline void kmemcheck_mark_freed(void *address, unsigned int n)
84{
85}
86
87static inline void kmemcheck_mark_unallocated_pages(struct page *p,
88 unsigned int n)
89{
90}
91
92static inline void kmemcheck_mark_uninitialized_pages(struct page *p,
93 unsigned int n)
94{
95}
96
97static inline void kmemcheck_mark_initialized_pages(struct page *p,
98 unsigned int n)
99{
100}
101
102#endif /* CONFIG_KMEMCHECK */
103
104/*
105 * Bitfield annotations
106 *
107 * How to use: If you have a struct using bitfields, for example
108 *
109 * struct a {
110 * int x:8, y:8;
111 * };
112 *
113 * then this should be rewritten as
114 *
115 * struct a {
116 * kmemcheck_bitfield_begin(flags);
117 * int x:8, y:8;
118 * kmemcheck_bitfield_end(flags);
119 * };
120 *
121 * Now the "flags_begin" and "flags_end" members may be used to refer to the
122 * beginning and end, respectively, of the bitfield (and things like
123 * &x.flags_begin is allowed). As soon as the struct is allocated, the bit-
124 * fields should be annotated:
125 *
126 * struct a *a = kmalloc(sizeof(struct a), GFP_KERNEL);
127 * kmemcheck_annotate_bitfield(a, flags);
128 *
129 * Note: We provide the same definitions for both kmemcheck and non-
130 * kmemcheck kernels. This makes it harder to introduce accidental errors. It
131 * is also allowed to pass NULL pointers to kmemcheck_annotate_bitfield().
132 */
133#define kmemcheck_bitfield_begin(name) \
134 int name##_begin[0];
135
136#define kmemcheck_bitfield_end(name) \
137 int name##_end[0];
138
139#define kmemcheck_annotate_bitfield(ptr, name) \
140 do if (ptr) { \
141 int _n = (long) &((ptr)->name##_end) \
142 - (long) &((ptr)->name##_begin); \
143 BUILD_BUG_ON(_n < 0); \
144 \
145 kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \
146 } while (0)
147
148#define kmemcheck_annotate_variable(var) \
149 do { \
150 kmemcheck_mark_initialized(&(var), sizeof(var)); \
151 } while (0) \
152
153#endif /* LINUX_KMEMCHECK_H */
diff --git a/include/linux/kmemleak.h b/include/linux/kmemleak.h
new file mode 100644
index 000000000000..7796aed6cdd5
--- /dev/null
+++ b/include/linux/kmemleak.h
@@ -0,0 +1,96 @@
1/*
2 * include/linux/kmemleak.h
3 *
4 * Copyright (C) 2008 ARM Limited
5 * Written by Catalin Marinas <catalin.marinas@arm.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 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef __KMEMLEAK_H
22#define __KMEMLEAK_H
23
24#ifdef CONFIG_DEBUG_KMEMLEAK
25
26extern void kmemleak_init(void);
27extern void kmemleak_alloc(const void *ptr, size_t size, int min_count,
28 gfp_t gfp);
29extern void kmemleak_free(const void *ptr);
30extern void kmemleak_padding(const void *ptr, unsigned long offset,
31 size_t size);
32extern void kmemleak_not_leak(const void *ptr);
33extern void kmemleak_ignore(const void *ptr);
34extern void kmemleak_scan_area(const void *ptr, unsigned long offset,
35 size_t length, gfp_t gfp);
36extern void kmemleak_no_scan(const void *ptr);
37
38static inline void kmemleak_alloc_recursive(const void *ptr, size_t size,
39 int min_count, unsigned long flags,
40 gfp_t gfp)
41{
42 if (!(flags & SLAB_NOLEAKTRACE))
43 kmemleak_alloc(ptr, size, min_count, gfp);
44}
45
46static inline void kmemleak_free_recursive(const void *ptr, unsigned long flags)
47{
48 if (!(flags & SLAB_NOLEAKTRACE))
49 kmemleak_free(ptr);
50}
51
52static inline void kmemleak_erase(void **ptr)
53{
54 *ptr = NULL;
55}
56
57#else
58
59static inline void kmemleak_init(void)
60{
61}
62static inline void kmemleak_alloc(const void *ptr, size_t size, int min_count,
63 gfp_t gfp)
64{
65}
66static inline void kmemleak_alloc_recursive(const void *ptr, size_t size,
67 int min_count, unsigned long flags,
68 gfp_t gfp)
69{
70}
71static inline void kmemleak_free(const void *ptr)
72{
73}
74static inline void kmemleak_free_recursive(const void *ptr, unsigned long flags)
75{
76}
77static inline void kmemleak_not_leak(const void *ptr)
78{
79}
80static inline void kmemleak_ignore(const void *ptr)
81{
82}
83static inline void kmemleak_scan_area(const void *ptr, unsigned long offset,
84 size_t length, gfp_t gfp)
85{
86}
87static inline void kmemleak_erase(void **ptr)
88{
89}
90static inline void kmemleak_no_scan(const void *ptr)
91{
92}
93
94#endif /* CONFIG_DEBUG_KMEMLEAK */
95
96#endif /* __KMEMLEAK_H */
diff --git a/include/linux/kmemtrace.h b/include/linux/kmemtrace.h
new file mode 100644
index 000000000000..b616d3930c3b
--- /dev/null
+++ b/include/linux/kmemtrace.h
@@ -0,0 +1,25 @@
1/*
2 * Copyright (C) 2008 Eduard - Gabriel Munteanu
3 *
4 * This file is released under GPL version 2.
5 */
6
7#ifndef _LINUX_KMEMTRACE_H
8#define _LINUX_KMEMTRACE_H
9
10#ifdef __KERNEL__
11
12#include <trace/events/kmem.h>
13
14#ifdef CONFIG_KMEMTRACE
15extern void kmemtrace_init(void);
16#else
17static inline void kmemtrace_init(void)
18{
19}
20#endif
21
22#endif /* __KERNEL__ */
23
24#endif /* _LINUX_KMEMTRACE_H */
25
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 8cc137911b34..3db5d8d37485 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -119,7 +119,7 @@ struct kvm_run {
119 __u32 error_code; 119 __u32 error_code;
120 } ex; 120 } ex;
121 /* KVM_EXIT_IO */ 121 /* KVM_EXIT_IO */
122 struct kvm_io { 122 struct {
123#define KVM_EXIT_IO_IN 0 123#define KVM_EXIT_IO_IN 0
124#define KVM_EXIT_IO_OUT 1 124#define KVM_EXIT_IO_OUT 1
125 __u8 direction; 125 __u8 direction;
@@ -224,10 +224,10 @@ struct kvm_interrupt {
224/* for KVM_GET_DIRTY_LOG */ 224/* for KVM_GET_DIRTY_LOG */
225struct kvm_dirty_log { 225struct kvm_dirty_log {
226 __u32 slot; 226 __u32 slot;
227 __u32 padding; 227 __u32 padding1;
228 union { 228 union {
229 void __user *dirty_bitmap; /* one bit per page */ 229 void __user *dirty_bitmap; /* one bit per page */
230 __u64 padding; 230 __u64 padding2;
231 }; 231 };
232}; 232};
233 233
@@ -409,6 +409,10 @@ struct kvm_trace_rec {
409#ifdef __KVM_HAVE_DEVICE_ASSIGNMENT 409#ifdef __KVM_HAVE_DEVICE_ASSIGNMENT
410#define KVM_CAP_DEVICE_DEASSIGNMENT 27 410#define KVM_CAP_DEVICE_DEASSIGNMENT 27
411#endif 411#endif
412#ifdef __KVM_HAVE_MSIX
413#define KVM_CAP_DEVICE_MSIX 28
414#endif
415#define KVM_CAP_ASSIGN_DEV_IRQ 29
412/* Another bug in KVM_SET_USER_MEMORY_REGION fixed: */ 416/* Another bug in KVM_SET_USER_MEMORY_REGION fixed: */
413#define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30 417#define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS 30
414 418
@@ -482,11 +486,18 @@ struct kvm_irq_routing {
482#define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \ 486#define KVM_ASSIGN_PCI_DEVICE _IOR(KVMIO, 0x69, \
483 struct kvm_assigned_pci_dev) 487 struct kvm_assigned_pci_dev)
484#define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing) 488#define KVM_SET_GSI_ROUTING _IOW(KVMIO, 0x6a, struct kvm_irq_routing)
489/* deprecated, replaced by KVM_ASSIGN_DEV_IRQ */
485#define KVM_ASSIGN_IRQ _IOR(KVMIO, 0x70, \ 490#define KVM_ASSIGN_IRQ _IOR(KVMIO, 0x70, \
486 struct kvm_assigned_irq) 491 struct kvm_assigned_irq)
492#define KVM_ASSIGN_DEV_IRQ _IOW(KVMIO, 0x70, struct kvm_assigned_irq)
487#define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71) 493#define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71)
488#define KVM_DEASSIGN_PCI_DEVICE _IOW(KVMIO, 0x72, \ 494#define KVM_DEASSIGN_PCI_DEVICE _IOW(KVMIO, 0x72, \
489 struct kvm_assigned_pci_dev) 495 struct kvm_assigned_pci_dev)
496#define KVM_ASSIGN_SET_MSIX_NR \
497 _IOW(KVMIO, 0x73, struct kvm_assigned_msix_nr)
498#define KVM_ASSIGN_SET_MSIX_ENTRY \
499 _IOW(KVMIO, 0x74, struct kvm_assigned_msix_entry)
500#define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq)
490 501
491/* 502/*
492 * ioctls for vcpu fds 503 * ioctls for vcpu fds
@@ -577,6 +588,8 @@ struct kvm_debug_guest {
577#define KVM_TRC_STLB_INVAL (KVM_TRC_HANDLER + 0x18) 588#define KVM_TRC_STLB_INVAL (KVM_TRC_HANDLER + 0x18)
578#define KVM_TRC_PPC_INSTR (KVM_TRC_HANDLER + 0x19) 589#define KVM_TRC_PPC_INSTR (KVM_TRC_HANDLER + 0x19)
579 590
591#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
592
580struct kvm_assigned_pci_dev { 593struct kvm_assigned_pci_dev {
581 __u32 assigned_dev_id; 594 __u32 assigned_dev_id;
582 __u32 busnr; 595 __u32 busnr;
@@ -587,6 +600,17 @@ struct kvm_assigned_pci_dev {
587 }; 600 };
588}; 601};
589 602
603#define KVM_DEV_IRQ_HOST_INTX (1 << 0)
604#define KVM_DEV_IRQ_HOST_MSI (1 << 1)
605#define KVM_DEV_IRQ_HOST_MSIX (1 << 2)
606
607#define KVM_DEV_IRQ_GUEST_INTX (1 << 8)
608#define KVM_DEV_IRQ_GUEST_MSI (1 << 9)
609#define KVM_DEV_IRQ_GUEST_MSIX (1 << 10)
610
611#define KVM_DEV_IRQ_HOST_MASK 0x00ff
612#define KVM_DEV_IRQ_GUEST_MASK 0xff00
613
590struct kvm_assigned_irq { 614struct kvm_assigned_irq {
591 __u32 assigned_dev_id; 615 __u32 assigned_dev_id;
592 __u32 host_irq; 616 __u32 host_irq;
@@ -602,9 +626,19 @@ struct kvm_assigned_irq {
602 }; 626 };
603}; 627};
604 628
605#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
606 629
607#define KVM_DEV_IRQ_ASSIGN_MSI_ACTION KVM_DEV_IRQ_ASSIGN_ENABLE_MSI 630struct kvm_assigned_msix_nr {
608#define KVM_DEV_IRQ_ASSIGN_ENABLE_MSI (1 << 0) 631 __u32 assigned_dev_id;
632 __u16 entry_nr;
633 __u16 padding;
634};
635
636#define KVM_MAX_MSIX_PER_DEV 512
637struct kvm_assigned_msix_entry {
638 __u32 assigned_dev_id;
639 __u32 gsi;
640 __u16 entry; /* The index of entry in the MSI-X table */
641 __u16 padding[3];
642};
609 643
610#endif 644#endif
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 894a56e365e8..aacc5449f586 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -38,6 +38,7 @@
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#define KVM_REQ_KVMCLOCK_UPDATE 8
41#define KVM_REQ_KICK 9
41 42
42#define KVM_USERSPACE_IRQ_SOURCE_ID 0 43#define KVM_USERSPACE_IRQ_SOURCE_ID 0
43 44
@@ -72,7 +73,6 @@ struct kvm_vcpu {
72 struct mutex mutex; 73 struct mutex mutex;
73 int cpu; 74 int cpu;
74 struct kvm_run *run; 75 struct kvm_run *run;
75 int guest_mode;
76 unsigned long requests; 76 unsigned long requests;
77 unsigned long guest_debug; 77 unsigned long guest_debug;
78 int fpu_active; 78 int fpu_active;
@@ -298,6 +298,7 @@ int kvm_arch_hardware_setup(void);
298void kvm_arch_hardware_unsetup(void); 298void kvm_arch_hardware_unsetup(void);
299void kvm_arch_check_processor_compat(void *rtn); 299void kvm_arch_check_processor_compat(void *rtn);
300int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu); 300int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
301int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu);
301 302
302void kvm_free_physmem(struct kvm *kvm); 303void kvm_free_physmem(struct kvm *kvm);
303 304
@@ -319,6 +320,13 @@ struct kvm_irq_ack_notifier {
319 void (*irq_acked)(struct kvm_irq_ack_notifier *kian); 320 void (*irq_acked)(struct kvm_irq_ack_notifier *kian);
320}; 321};
321 322
323#define KVM_ASSIGNED_MSIX_PENDING 0x1
324struct kvm_guest_msix_entry {
325 u32 vector;
326 u16 entry;
327 u16 flags;
328};
329
322struct kvm_assigned_dev_kernel { 330struct kvm_assigned_dev_kernel {
323 struct kvm_irq_ack_notifier ack_notifier; 331 struct kvm_irq_ack_notifier ack_notifier;
324 struct work_struct interrupt_work; 332 struct work_struct interrupt_work;
@@ -326,18 +334,18 @@ struct kvm_assigned_dev_kernel {
326 int assigned_dev_id; 334 int assigned_dev_id;
327 int host_busnr; 335 int host_busnr;
328 int host_devfn; 336 int host_devfn;
337 unsigned int entries_nr;
329 int host_irq; 338 int host_irq;
330 bool host_irq_disabled; 339 bool host_irq_disabled;
340 struct msix_entry *host_msix_entries;
331 int guest_irq; 341 int guest_irq;
332#define KVM_ASSIGNED_DEV_GUEST_INTX (1 << 0) 342 struct kvm_guest_msix_entry *guest_msix_entries;
333#define KVM_ASSIGNED_DEV_GUEST_MSI (1 << 1)
334#define KVM_ASSIGNED_DEV_HOST_INTX (1 << 8)
335#define KVM_ASSIGNED_DEV_HOST_MSI (1 << 9)
336 unsigned long irq_requested_type; 343 unsigned long irq_requested_type;
337 int irq_source_id; 344 int irq_source_id;
338 int flags; 345 int flags;
339 struct pci_dev *dev; 346 struct pci_dev *dev;
340 struct kvm *kvm; 347 struct kvm *kvm;
348 spinlock_t assigned_dev_lock;
341}; 349};
342 350
343struct kvm_irq_mask_notifier { 351struct kvm_irq_mask_notifier {
@@ -360,6 +368,9 @@ void kvm_unregister_irq_ack_notifier(struct kvm_irq_ack_notifier *kian);
360int kvm_request_irq_source_id(struct kvm *kvm); 368int kvm_request_irq_source_id(struct kvm *kvm);
361void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id); 369void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id);
362 370
371/* For vcpu->arch.iommu_flags */
372#define KVM_IOMMU_CACHE_COHERENCY 0x1
373
363#ifdef CONFIG_IOMMU_API 374#ifdef CONFIG_IOMMU_API
364int kvm_iommu_map_pages(struct kvm *kvm, gfn_t base_gfn, 375int kvm_iommu_map_pages(struct kvm *kvm, gfn_t base_gfn,
365 unsigned long npages); 376 unsigned long npages);
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
index 2b8318c83e53..fb46efbeabec 100644
--- a/include/linux/kvm_types.h
+++ b/include/linux/kvm_types.h
@@ -40,4 +40,31 @@ typedef unsigned long hfn_t;
40 40
41typedef hfn_t pfn_t; 41typedef hfn_t pfn_t;
42 42
43union kvm_ioapic_redirect_entry {
44 u64 bits;
45 struct {
46 u8 vector;
47 u8 delivery_mode:3;
48 u8 dest_mode:1;
49 u8 delivery_status:1;
50 u8 polarity:1;
51 u8 remote_irr:1;
52 u8 trig_mode:1;
53 u8 mask:1;
54 u8 reserve:7;
55 u8 reserved[4];
56 u8 dest_id;
57 } fields;
58};
59
60struct kvm_lapic_irq {
61 u32 vector;
62 u32 delivery_mode;
63 u32 dest_mode;
64 u32 level;
65 u32 trig_mode;
66 u32 shorthand;
67 u32 dest_id;
68};
69
43#endif /* __KVM_TYPES_H__ */ 70#endif /* __KVM_TYPES_H__ */
diff --git a/include/linux/lguest.h b/include/linux/lguest.h
index 175e63f4a8c0..7bc1440fc473 100644
--- a/include/linux/lguest.h
+++ b/include/linux/lguest.h
@@ -30,6 +30,10 @@ struct lguest_data
30 /* Wallclock time set by the Host. */ 30 /* Wallclock time set by the Host. */
31 struct timespec time; 31 struct timespec time;
32 32
33 /* Interrupt pending set by the Host. The Guest should do a hypercall
34 * if it re-enables interrupts and sees this set (to X86_EFLAGS_IF). */
35 int irq_pending;
36
33 /* Async hypercall ring. Instead of directly making hypercalls, we can 37 /* Async hypercall ring. Instead of directly making hypercalls, we can
34 * place them in here for processing the next time the Host wants. 38 * place them in here for processing the next time the Host wants.
35 * This batching can be quite efficient. */ 39 * This batching can be quite efficient. */
diff --git a/include/linux/lguest_launcher.h b/include/linux/lguest_launcher.h
index a53407a4165c..bfefbdf7498a 100644
--- a/include/linux/lguest_launcher.h
+++ b/include/linux/lguest_launcher.h
@@ -57,7 +57,8 @@ enum lguest_req
57 LHREQ_INITIALIZE, /* + base, pfnlimit, start */ 57 LHREQ_INITIALIZE, /* + base, pfnlimit, start */
58 LHREQ_GETDMA, /* No longer used */ 58 LHREQ_GETDMA, /* No longer used */
59 LHREQ_IRQ, /* + irq */ 59 LHREQ_IRQ, /* + irq */
60 LHREQ_BREAK, /* + on/off flag (on blocks until someone does off) */ 60 LHREQ_BREAK, /* No longer used */
61 LHREQ_EVENTFD, /* + address, fd. */
61}; 62};
62 63
63/* The alignment to use between consumer and producer parts of vring. 64/* The alignment to use between consumer and producer parts of vring.
diff --git a/include/linux/linux_logo.h b/include/linux/linux_logo.h
index 08a92969c76e..ca5bd91d12e1 100644
--- a/include/linux/linux_logo.h
+++ b/include/linux/linux_logo.h
@@ -32,6 +32,22 @@ struct linux_logo {
32 const unsigned char *data; 32 const unsigned char *data;
33}; 33};
34 34
35extern const struct linux_logo logo_linux_mono;
36extern const struct linux_logo logo_linux_vga16;
37extern const struct linux_logo logo_linux_clut224;
38extern const struct linux_logo logo_blackfin_vga16;
39extern const struct linux_logo logo_blackfin_clut224;
40extern const struct linux_logo logo_dec_clut224;
41extern const struct linux_logo logo_mac_clut224;
42extern const struct linux_logo logo_parisc_clut224;
43extern const struct linux_logo logo_sgi_clut224;
44extern const struct linux_logo logo_sun_clut224;
45extern const struct linux_logo logo_superh_mono;
46extern const struct linux_logo logo_superh_vga16;
47extern const struct linux_logo logo_superh_clut224;
48extern const struct linux_logo logo_m32r_clut224;
49extern const struct linux_logo logo_spe_clut224;
50
35extern const struct linux_logo *fb_find_logo(int depth); 51extern const struct linux_logo *fb_find_logo(int depth);
36#ifdef CONFIG_FB_LOGO_EXTRA 52#ifdef CONFIG_FB_LOGO_EXTRA
37extern void fb_append_extra_logo(const struct linux_logo *logo, 53extern void fb_append_extra_logo(const struct linux_logo *logo,
diff --git a/include/linux/lis3lv02d.h b/include/linux/lis3lv02d.h
new file mode 100644
index 000000000000..ad651f4e45ac
--- /dev/null
+++ b/include/linux/lis3lv02d.h
@@ -0,0 +1,39 @@
1#ifndef __LIS3LV02D_H_
2#define __LIS3LV02D_H_
3
4struct lis3lv02d_platform_data {
5 /* please note: the 'click' feature is only supported for
6 * LIS[32]02DL variants of the chip and will be ignored for
7 * others */
8#define LIS3_CLICK_SINGLE_X (1 << 0)
9#define LIS3_CLICK_DOUBLE_X (1 << 1)
10#define LIS3_CLICK_SINGLE_Y (1 << 2)
11#define LIS3_CLICK_DOUBLE_Y (1 << 3)
12#define LIS3_CLICK_SINGLE_Z (1 << 4)
13#define LIS3_CLICK_DOUBLE_Z (1 << 5)
14 unsigned char click_flags;
15 unsigned char click_thresh_x;
16 unsigned char click_thresh_y;
17 unsigned char click_thresh_z;
18 unsigned char click_time_limit;
19 unsigned char click_latency;
20 unsigned char click_window;
21
22#define LIS3_IRQ1_DISABLE (0 << 0)
23#define LIS3_IRQ1_FF_WU_1 (1 << 0)
24#define LIS3_IRQ1_FF_WU_2 (2 << 0)
25#define LIS3_IRQ1_FF_WU_12 (3 << 0)
26#define LIS3_IRQ1_DATA_READY (4 << 0)
27#define LIS3_IRQ1_CLICK (7 << 0)
28#define LIS3_IRQ2_DISABLE (0 << 3)
29#define LIS3_IRQ2_FF_WU_1 (1 << 3)
30#define LIS3_IRQ2_FF_WU_2 (2 << 3)
31#define LIS3_IRQ2_FF_WU_12 (3 << 3)
32#define LIS3_IRQ2_DATA_READY (4 << 3)
33#define LIS3_IRQ2_CLICK (7 << 3)
34#define LIS3_IRQ_OPEN_DRAIN (1 << 6)
35#define LIS3_IRQ_ACTIVE_HIGH (1 << 7)
36 unsigned char irq_cfg;
37};
38
39#endif /* __LIS3LV02D_H_ */
diff --git a/include/linux/list_nulls.h b/include/linux/list_nulls.h
index 93150ecf3ea4..5d10ae364b5e 100644
--- a/include/linux/list_nulls.h
+++ b/include/linux/list_nulls.h
@@ -56,6 +56,18 @@ static inline int hlist_nulls_empty(const struct hlist_nulls_head *h)
56 return is_a_nulls(h->first); 56 return is_a_nulls(h->first);
57} 57}
58 58
59static inline void hlist_nulls_add_head(struct hlist_nulls_node *n,
60 struct hlist_nulls_head *h)
61{
62 struct hlist_nulls_node *first = h->first;
63
64 n->next = first;
65 n->pprev = &h->first;
66 h->first = n;
67 if (!is_a_nulls(first))
68 first->pprev = &n->next;
69}
70
59static inline void __hlist_nulls_del(struct hlist_nulls_node *n) 71static inline void __hlist_nulls_del(struct hlist_nulls_node *n)
60{ 72{
61 struct hlist_nulls_node *next = n->next; 73 struct hlist_nulls_node *next = n->next;
@@ -65,6 +77,12 @@ static inline void __hlist_nulls_del(struct hlist_nulls_node *n)
65 next->pprev = pprev; 77 next->pprev = pprev;
66} 78}
67 79
80static inline void hlist_nulls_del(struct hlist_nulls_node *n)
81{
82 __hlist_nulls_del(n);
83 n->pprev = LIST_POISON2;
84}
85
68/** 86/**
69 * hlist_nulls_for_each_entry - iterate over list of given type 87 * hlist_nulls_for_each_entry - iterate over list of given type
70 * @tpos: the type * to use as a loop cursor. 88 * @tpos: the type * to use as a loop cursor.
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 51855dfd8adb..c325b187966b 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -195,7 +195,7 @@ extern struct svc_procedure nlmsvc_procedures4[];
195extern int nlmsvc_grace_period; 195extern int nlmsvc_grace_period;
196extern unsigned long nlmsvc_timeout; 196extern unsigned long nlmsvc_timeout;
197extern int nsm_use_hostnames; 197extern int nsm_use_hostnames;
198extern int nsm_local_state; 198extern u32 nsm_local_state;
199 199
200/* 200/*
201 * Lockd client functions 201 * Lockd client functions
diff --git a/include/linux/loop.h b/include/linux/loop.h
index 40725447f5e0..66c194e2d9b9 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -56,8 +56,7 @@ struct loop_device {
56 gfp_t old_gfp_mask; 56 gfp_t old_gfp_mask;
57 57
58 spinlock_t lo_lock; 58 spinlock_t lo_lock;
59 struct bio *lo_bio; 59 struct bio_list lo_bio_list;
60 struct bio *lo_biotail;
61 int lo_state; 60 int lo_state;
62 struct mutex lo_ctl_mutex; 61 struct mutex lo_ctl_mutex;
63 struct task_struct *lo_thread; 62 struct task_struct *lo_thread;
diff --git a/include/linux/lsm_audit.h b/include/linux/lsm_audit.h
new file mode 100644
index 000000000000..e461b2c3d711
--- /dev/null
+++ b/include/linux/lsm_audit.h
@@ -0,0 +1,111 @@
1/*
2 * Common LSM logging functions
3 * Heavily borrowed from selinux/avc.h
4 *
5 * Author : Etienne BASSET <etienne.basset@ensta.org>
6 *
7 * All credits to : Stephen Smalley, <sds@epoch.ncsc.mil>
8 * All BUGS to : Etienne BASSET <etienne.basset@ensta.org>
9 */
10#ifndef _LSM_COMMON_LOGGING_
11#define _LSM_COMMON_LOGGING_
12
13#include <linux/stddef.h>
14#include <linux/errno.h>
15#include <linux/kernel.h>
16#include <linux/kdev_t.h>
17#include <linux/spinlock.h>
18#include <linux/init.h>
19#include <linux/audit.h>
20#include <linux/in6.h>
21#include <linux/path.h>
22#include <linux/key.h>
23#include <linux/skbuff.h>
24#include <asm/system.h>
25
26
27/* Auxiliary data to use in generating the audit record. */
28struct common_audit_data {
29 char type;
30#define LSM_AUDIT_DATA_FS 1
31#define LSM_AUDIT_DATA_NET 2
32#define LSM_AUDIT_DATA_CAP 3
33#define LSM_AUDIT_DATA_IPC 4
34#define LSM_AUDIT_DATA_TASK 5
35#define LSM_AUDIT_DATA_KEY 6
36 struct task_struct *tsk;
37 union {
38 struct {
39 struct path path;
40 struct inode *inode;
41 } fs;
42 struct {
43 int netif;
44 struct sock *sk;
45 u16 family;
46 __be16 dport;
47 __be16 sport;
48 union {
49 struct {
50 __be32 daddr;
51 __be32 saddr;
52 } v4;
53 struct {
54 struct in6_addr daddr;
55 struct in6_addr saddr;
56 } v6;
57 } fam;
58 } net;
59 int cap;
60 int ipc_id;
61 struct task_struct *tsk;
62#ifdef CONFIG_KEYS
63 struct {
64 key_serial_t key;
65 char *key_desc;
66 } key_struct;
67#endif
68 } u;
69 const char *function;
70 /* this union contains LSM specific data */
71 union {
72 /* SMACK data */
73 struct smack_audit_data {
74 char *subject;
75 char *object;
76 char *request;
77 int result;
78 } smack_audit_data;
79 /* SELinux data */
80 struct {
81 u32 ssid;
82 u32 tsid;
83 u16 tclass;
84 u32 requested;
85 u32 audited;
86 struct av_decision *avd;
87 int result;
88 } selinux_audit_data;
89 } lsm_priv;
90 /* these callback will be implemented by a specific LSM */
91 void (*lsm_pre_audit)(struct audit_buffer *, void *);
92 void (*lsm_post_audit)(struct audit_buffer *, void *);
93};
94
95#define v4info fam.v4
96#define v6info fam.v6
97
98int ipv4_skb_to_auditdata(struct sk_buff *skb,
99 struct common_audit_data *ad, u8 *proto);
100
101int ipv6_skb_to_auditdata(struct sk_buff *skb,
102 struct common_audit_data *ad, u8 *proto);
103
104/* Initialize an LSM audit data structure. */
105#define COMMON_AUDIT_DATA_INIT(_d, _t) \
106 { memset((_d), 0, sizeof(struct common_audit_data)); \
107 (_d)->type = LSM_AUDIT_DATA_##_t; (_d)->function = __func__; }
108
109void common_lsm_audit(struct common_audit_data *a);
110
111#endif
diff --git a/include/linux/mISDNdsp.h b/include/linux/mISDNdsp.h
index 6b71d2dce508..41d1eeb9b3bd 100644
--- a/include/linux/mISDNdsp.h
+++ b/include/linux/mISDNdsp.h
@@ -12,7 +12,8 @@ struct mISDN_dsp_element {
12 void *(*new)(const char *arg); 12 void *(*new)(const char *arg);
13 void (*free)(void *p); 13 void (*free)(void *p);
14 void (*process_tx)(void *p, unsigned char *data, int len); 14 void (*process_tx)(void *p, unsigned char *data, int len);
15 void (*process_rx)(void *p, unsigned char *data, int len); 15 void (*process_rx)(void *p, unsigned char *data, int len,
16 unsigned int txlen);
16 int num_args; 17 int num_args;
17 struct mISDN_dsp_element_arg 18 struct mISDN_dsp_element_arg
18 *args; 19 *args;
@@ -24,6 +25,7 @@ extern void mISDN_dsp_element_unregister(struct mISDN_dsp_element *elem);
24struct dsp_features { 25struct dsp_features {
25 int hfc_id; /* unique id to identify the chip (or -1) */ 26 int hfc_id; /* unique id to identify the chip (or -1) */
26 int hfc_dtmf; /* set if HFCmulti card supports dtmf */ 27 int hfc_dtmf; /* set if HFCmulti card supports dtmf */
28 int hfc_conf; /* set if HFCmulti card supports conferences */
27 int hfc_loops; /* set if card supports tone loops */ 29 int hfc_loops; /* set if card supports tone loops */
28 int hfc_echocanhw; /* set if card supports echocancelation*/ 30 int hfc_echocanhw; /* set if card supports echocancelation*/
29 int pcm_id; /* unique id to identify the pcm bus (or -1) */ 31 int pcm_id; /* unique id to identify the pcm bus (or -1) */
diff --git a/include/linux/mISDNhw.h b/include/linux/mISDNhw.h
index 97ffdc1d3442..7f9831da847f 100644
--- a/include/linux/mISDNhw.h
+++ b/include/linux/mISDNhw.h
@@ -89,11 +89,6 @@ struct dchannel {
89 void (*phfunc) (struct dchannel *); 89 void (*phfunc) (struct dchannel *);
90 u_int state; 90 u_int state;
91 void *l1; 91 void *l1;
92 /* HW access */
93 u_char (*read_reg) (void *, u_char);
94 void (*write_reg) (void *, u_char, u_char);
95 void (*read_fifo) (void *, u_char *, int);
96 void (*write_fifo) (void *, u_char *, int);
97 void *hw; 92 void *hw;
98 int slot; /* multiport card channel slot */ 93 int slot; /* multiport card channel slot */
99 struct timer_list timer; 94 struct timer_list timer;
@@ -151,11 +146,6 @@ struct bchannel {
151 u_long Flags; 146 u_long Flags;
152 struct work_struct workq; 147 struct work_struct workq;
153 u_int state; 148 u_int state;
154 /* HW access */
155 u_char (*read_reg) (void *, u_char);
156 void (*write_reg) (void *, u_char, u_char);
157 void (*read_fifo) (void *, u_char *, int);
158 void (*write_fifo) (void *, u_char *, int);
159 void *hw; 149 void *hw;
160 int slot; /* multiport card channel slot */ 150 int slot; /* multiport card channel slot */
161 struct timer_list timer; 151 struct timer_list timer;
@@ -185,7 +175,7 @@ extern int dchannel_senddata(struct dchannel *, struct sk_buff *);
185extern int bchannel_senddata(struct bchannel *, struct sk_buff *); 175extern int bchannel_senddata(struct bchannel *, struct sk_buff *);
186extern void recv_Dchannel(struct dchannel *); 176extern void recv_Dchannel(struct dchannel *);
187extern void recv_Echannel(struct dchannel *, struct dchannel *); 177extern void recv_Echannel(struct dchannel *, struct dchannel *);
188extern void recv_Bchannel(struct bchannel *); 178extern void recv_Bchannel(struct bchannel *, unsigned int id);
189extern void recv_Dchannel_skb(struct dchannel *, struct sk_buff *); 179extern void recv_Dchannel_skb(struct dchannel *, struct sk_buff *);
190extern void recv_Bchannel_skb(struct bchannel *, struct sk_buff *); 180extern void recv_Bchannel_skb(struct bchannel *, struct sk_buff *);
191extern void confirm_Bsend(struct bchannel *bch); 181extern void confirm_Bsend(struct bchannel *bch);
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h
index 5da3d95b27f1..45100b39a7cf 100644
--- a/include/linux/mISDNif.h
+++ b/include/linux/mISDNif.h
@@ -229,6 +229,7 @@
229#define OPTION_L2_PTP 2 229#define OPTION_L2_PTP 2
230#define OPTION_L2_FIXEDTEI 3 230#define OPTION_L2_FIXEDTEI 3
231#define OPTION_L2_CLEANUP 4 231#define OPTION_L2_CLEANUP 4
232#define OPTION_L1_HOLD 5
232 233
233/* should be in sync with linux/kobject.h:KOBJ_NAME_LEN */ 234/* should be in sync with linux/kobject.h:KOBJ_NAME_LEN */
234#define MISDN_MAX_IDLEN 20 235#define MISDN_MAX_IDLEN 20
@@ -291,19 +292,19 @@ struct mISDN_devrename {
291 292
292/* MPH_INFORMATION_REQ payload */ 293/* MPH_INFORMATION_REQ payload */
293struct ph_info_ch { 294struct ph_info_ch {
294 __u32 protocol; 295 __u32 protocol;
295 __u64 Flags; 296 __u64 Flags;
296}; 297};
297 298
298struct ph_info_dch { 299struct ph_info_dch {
299 struct ph_info_ch ch; 300 struct ph_info_ch ch;
300 __u16 state; 301 __u16 state;
301 __u16 num_bch; 302 __u16 num_bch;
302}; 303};
303 304
304struct ph_info { 305struct ph_info {
305 struct ph_info_dch dch; 306 struct ph_info_dch dch;
306 struct ph_info_ch bch[]; 307 struct ph_info_ch bch[];
307}; 308};
308 309
309/* timer device ioctl */ 310/* timer device ioctl */
@@ -317,6 +318,7 @@ struct ph_info {
317#define IMCTRLREQ _IOR('I', 69, int) 318#define IMCTRLREQ _IOR('I', 69, int)
318#define IMCLEAR_L2 _IOR('I', 70, int) 319#define IMCLEAR_L2 _IOR('I', 70, int)
319#define IMSETDEVNAME _IOR('I', 71, struct mISDN_devrename) 320#define IMSETDEVNAME _IOR('I', 71, struct mISDN_devrename)
321#define IMHOLD_L1 _IOR('I', 72, int)
320 322
321static inline int 323static inline int
322test_channelmap(u_int nr, u_char *map) 324test_channelmap(u_int nr, u_char *map)
@@ -362,7 +364,8 @@ clear_channelmap(u_int nr, u_char *map)
362#define MISDN_CTRL_HFC_RECEIVE_ON 0x4006 364#define MISDN_CTRL_HFC_RECEIVE_ON 0x4006
363#define MISDN_CTRL_HFC_ECHOCAN_ON 0x4007 365#define MISDN_CTRL_HFC_ECHOCAN_ON 0x4007
364#define MISDN_CTRL_HFC_ECHOCAN_OFF 0x4008 366#define MISDN_CTRL_HFC_ECHOCAN_OFF 0x4008
365 367#define MISDN_CTRL_HFC_WD_INIT 0x4009
368#define MISDN_CTRL_HFC_WD_RESET 0x400A
366 369
367/* socket options */ 370/* socket options */
368#define MISDN_TIME_STAMP 0x0001 371#define MISDN_TIME_STAMP 0x0001
diff --git a/include/linux/magic.h b/include/linux/magic.h
index 5b4e28bcb788..1923327b9869 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -6,9 +6,12 @@
6#define AFS_SUPER_MAGIC 0x5346414F 6#define AFS_SUPER_MAGIC 0x5346414F
7#define AUTOFS_SUPER_MAGIC 0x0187 7#define AUTOFS_SUPER_MAGIC 0x0187
8#define CODA_SUPER_MAGIC 0x73757245 8#define CODA_SUPER_MAGIC 0x73757245
9#define CRAMFS_MAGIC 0x28cd3d45 /* some random number */
10#define CRAMFS_MAGIC_WEND 0x453dcd28 /* magic number with the wrong endianess */
9#define DEBUGFS_MAGIC 0x64626720 11#define DEBUGFS_MAGIC 0x64626720
10#define SYSFS_MAGIC 0x62656572 12#define SYSFS_MAGIC 0x62656572
11#define SECURITYFS_MAGIC 0x73636673 13#define SECURITYFS_MAGIC 0x73636673
14#define SELINUX_MAGIC 0xf97cff8c
12#define TMPFS_MAGIC 0x01021994 15#define TMPFS_MAGIC 0x01021994
13#define SQUASHFS_MAGIC 0x73717368 16#define SQUASHFS_MAGIC 0x73717368
14#define EFS_SUPER_MAGIC 0x414A53 17#define EFS_SUPER_MAGIC 0x414A53
diff --git a/include/linux/major.h b/include/linux/major.h
index 058ec15dd060..6a8ca98c9a96 100644
--- a/include/linux/major.h
+++ b/include/linux/major.h
@@ -145,6 +145,7 @@
145#define UNIX98_PTY_MAJOR_COUNT 8 145#define UNIX98_PTY_MAJOR_COUNT 8
146#define UNIX98_PTY_SLAVE_MAJOR (UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT) 146#define UNIX98_PTY_SLAVE_MAJOR (UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT)
147 147
148#define DRBD_MAJOR 147
148#define RTF_MAJOR 150 149#define RTF_MAJOR 150
149#define RAW_MAJOR 162 150#define RAW_MAJOR 162
150 151
diff --git a/include/linux/mdio.h b/include/linux/mdio.h
new file mode 100644
index 000000000000..cfdf1df2875e
--- /dev/null
+++ b/include/linux/mdio.h
@@ -0,0 +1,356 @@
1/*
2 * linux/mdio.h: definitions for MDIO (clause 45) transceivers
3 * Copyright 2006-2009 Solarflare Communications Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published
7 * by the Free Software Foundation, incorporated herein by reference.
8 */
9
10#ifndef __LINUX_MDIO_H__
11#define __LINUX_MDIO_H__
12
13#include <linux/mii.h>
14
15/* MDIO Manageable Devices (MMDs). */
16#define MDIO_MMD_PMAPMD 1 /* Physical Medium Attachment/
17 * Physical Medium Dependent */
18#define MDIO_MMD_WIS 2 /* WAN Interface Sublayer */
19#define MDIO_MMD_PCS 3 /* Physical Coding Sublayer */
20#define MDIO_MMD_PHYXS 4 /* PHY Extender Sublayer */
21#define MDIO_MMD_DTEXS 5 /* DTE Extender Sublayer */
22#define MDIO_MMD_TC 6 /* Transmission Convergence */
23#define MDIO_MMD_AN 7 /* Auto-Negotiation */
24#define MDIO_MMD_C22EXT 29 /* Clause 22 extension */
25#define MDIO_MMD_VEND1 30 /* Vendor specific 1 */
26#define MDIO_MMD_VEND2 31 /* Vendor specific 2 */
27
28/* Generic MDIO registers. */
29#define MDIO_CTRL1 MII_BMCR
30#define MDIO_STAT1 MII_BMSR
31#define MDIO_DEVID1 MII_PHYSID1
32#define MDIO_DEVID2 MII_PHYSID2
33#define MDIO_SPEED 4 /* Speed ability */
34#define MDIO_DEVS1 5 /* Devices in package */
35#define MDIO_DEVS2 6
36#define MDIO_CTRL2 7 /* 10G control 2 */
37#define MDIO_STAT2 8 /* 10G status 2 */
38#define MDIO_PMA_TXDIS 9 /* 10G PMA/PMD transmit disable */
39#define MDIO_PMA_RXDET 10 /* 10G PMA/PMD receive signal detect */
40#define MDIO_PMA_EXTABLE 11 /* 10G PMA/PMD extended ability */
41#define MDIO_PKGID1 14 /* Package identifier */
42#define MDIO_PKGID2 15
43#define MDIO_AN_ADVERTISE 16 /* AN advertising (base page) */
44#define MDIO_AN_LPA 19 /* AN LP abilities (base page) */
45#define MDIO_PHYXS_LNSTAT 24 /* PHY XGXS lane state */
46
47/* Media-dependent registers. */
48#define MDIO_PMA_10GBT_SWAPPOL 130 /* 10GBASE-T pair swap & polarity */
49#define MDIO_PMA_10GBT_TXPWR 131 /* 10GBASE-T TX power control */
50#define MDIO_PMA_10GBT_SNR 133 /* 10GBASE-T SNR margin, lane A.
51 * Lanes B-D are numbered 134-136. */
52#define MDIO_PMA_10GBR_FECABLE 170 /* 10GBASE-R FEC ability */
53#define MDIO_PCS_10GBX_STAT1 24 /* 10GBASE-X PCS status 1 */
54#define MDIO_PCS_10GBRT_STAT1 32 /* 10GBASE-R/-T PCS status 1 */
55#define MDIO_PCS_10GBRT_STAT2 33 /* 10GBASE-R/-T PCS status 2 */
56#define MDIO_AN_10GBT_CTRL 32 /* 10GBASE-T auto-negotiation control */
57#define MDIO_AN_10GBT_STAT 33 /* 10GBASE-T auto-negotiation status */
58
59/* LASI (Link Alarm Status Interrupt) registers, defined by XENPAK MSA. */
60#define MDIO_PMA_LASI_RXCTRL 0x9000 /* RX_ALARM control */
61#define MDIO_PMA_LASI_TXCTRL 0x9001 /* TX_ALARM control */
62#define MDIO_PMA_LASI_CTRL 0x9002 /* LASI control */
63#define MDIO_PMA_LASI_RXSTAT 0x9003 /* RX_ALARM status */
64#define MDIO_PMA_LASI_TXSTAT 0x9004 /* TX_ALARM status */
65#define MDIO_PMA_LASI_STAT 0x9005 /* LASI status */
66
67/* Control register 1. */
68/* Enable extended speed selection */
69#define MDIO_CTRL1_SPEEDSELEXT (BMCR_SPEED1000 | BMCR_SPEED100)
70/* All speed selection bits */
71#define MDIO_CTRL1_SPEEDSEL (MDIO_CTRL1_SPEEDSELEXT | 0x003c)
72#define MDIO_CTRL1_FULLDPLX BMCR_FULLDPLX
73#define MDIO_CTRL1_LPOWER BMCR_PDOWN
74#define MDIO_CTRL1_RESET BMCR_RESET
75#define MDIO_PMA_CTRL1_LOOPBACK 0x0001
76#define MDIO_PMA_CTRL1_SPEED1000 BMCR_SPEED1000
77#define MDIO_PMA_CTRL1_SPEED100 BMCR_SPEED100
78#define MDIO_PCS_CTRL1_LOOPBACK BMCR_LOOPBACK
79#define MDIO_PHYXS_CTRL1_LOOPBACK BMCR_LOOPBACK
80#define MDIO_AN_CTRL1_RESTART BMCR_ANRESTART
81#define MDIO_AN_CTRL1_ENABLE BMCR_ANENABLE
82#define MDIO_AN_CTRL1_XNP 0x2000 /* Enable extended next page */
83
84/* 10 Gb/s */
85#define MDIO_CTRL1_SPEED10G (MDIO_CTRL1_SPEEDSELEXT | 0x00)
86/* 10PASS-TS/2BASE-TL */
87#define MDIO_CTRL1_SPEED10P2B (MDIO_CTRL1_SPEEDSELEXT | 0x04)
88
89/* Status register 1. */
90#define MDIO_STAT1_LPOWERABLE 0x0002 /* Low-power ability */
91#define MDIO_STAT1_LSTATUS BMSR_LSTATUS
92#define MDIO_STAT1_FAULT 0x0080 /* Fault */
93#define MDIO_AN_STAT1_LPABLE 0x0001 /* Link partner AN ability */
94#define MDIO_AN_STAT1_ABLE BMSR_ANEGCAPABLE
95#define MDIO_AN_STAT1_RFAULT BMSR_RFAULT
96#define MDIO_AN_STAT1_COMPLETE BMSR_ANEGCOMPLETE
97#define MDIO_AN_STAT1_PAGE 0x0040 /* Page received */
98#define MDIO_AN_STAT1_XNP 0x0080 /* Extended next page status */
99
100/* Speed register. */
101#define MDIO_SPEED_10G 0x0001 /* 10G capable */
102#define MDIO_PMA_SPEED_2B 0x0002 /* 2BASE-TL capable */
103#define MDIO_PMA_SPEED_10P 0x0004 /* 10PASS-TS capable */
104#define MDIO_PMA_SPEED_1000 0x0010 /* 1000M capable */
105#define MDIO_PMA_SPEED_100 0x0020 /* 100M capable */
106#define MDIO_PMA_SPEED_10 0x0040 /* 10M capable */
107#define MDIO_PCS_SPEED_10P2B 0x0002 /* 10PASS-TS/2BASE-TL capable */
108
109/* Device present registers. */
110#define MDIO_DEVS_PRESENT(devad) (1 << (devad))
111#define MDIO_DEVS_PMAPMD MDIO_DEVS_PRESENT(MDIO_MMD_PMAPMD)
112#define MDIO_DEVS_WIS MDIO_DEVS_PRESENT(MDIO_MMD_WIS)
113#define MDIO_DEVS_PCS MDIO_DEVS_PRESENT(MDIO_MMD_PCS)
114#define MDIO_DEVS_PHYXS MDIO_DEVS_PRESENT(MDIO_MMD_PHYXS)
115#define MDIO_DEVS_DTEXS MDIO_DEVS_PRESENT(MDIO_MMD_DTEXS)
116#define MDIO_DEVS_TC MDIO_DEVS_PRESENT(MDIO_MMD_TC)
117#define MDIO_DEVS_AN MDIO_DEVS_PRESENT(MDIO_MMD_AN)
118#define MDIO_DEVS_C22EXT MDIO_DEVS_PRESENT(MDIO_MMD_C22EXT)
119
120/* Control register 2. */
121#define MDIO_PMA_CTRL2_TYPE 0x000f /* PMA/PMD type selection */
122#define MDIO_PMA_CTRL2_10GBCX4 0x0000 /* 10GBASE-CX4 type */
123#define MDIO_PMA_CTRL2_10GBEW 0x0001 /* 10GBASE-EW type */
124#define MDIO_PMA_CTRL2_10GBLW 0x0002 /* 10GBASE-LW type */
125#define MDIO_PMA_CTRL2_10GBSW 0x0003 /* 10GBASE-SW type */
126#define MDIO_PMA_CTRL2_10GBLX4 0x0004 /* 10GBASE-LX4 type */
127#define MDIO_PMA_CTRL2_10GBER 0x0005 /* 10GBASE-ER type */
128#define MDIO_PMA_CTRL2_10GBLR 0x0006 /* 10GBASE-LR type */
129#define MDIO_PMA_CTRL2_10GBSR 0x0007 /* 10GBASE-SR type */
130#define MDIO_PMA_CTRL2_10GBLRM 0x0008 /* 10GBASE-LRM type */
131#define MDIO_PMA_CTRL2_10GBT 0x0009 /* 10GBASE-T type */
132#define MDIO_PMA_CTRL2_10GBKX4 0x000a /* 10GBASE-KX4 type */
133#define MDIO_PMA_CTRL2_10GBKR 0x000b /* 10GBASE-KR type */
134#define MDIO_PMA_CTRL2_1000BT 0x000c /* 1000BASE-T type */
135#define MDIO_PMA_CTRL2_1000BKX 0x000d /* 1000BASE-KX type */
136#define MDIO_PMA_CTRL2_100BTX 0x000e /* 100BASE-TX type */
137#define MDIO_PMA_CTRL2_10BT 0x000f /* 10BASE-T type */
138#define MDIO_PCS_CTRL2_TYPE 0x0003 /* PCS type selection */
139#define MDIO_PCS_CTRL2_10GBR 0x0000 /* 10GBASE-R type */
140#define MDIO_PCS_CTRL2_10GBX 0x0001 /* 10GBASE-X type */
141#define MDIO_PCS_CTRL2_10GBW 0x0002 /* 10GBASE-W type */
142#define MDIO_PCS_CTRL2_10GBT 0x0003 /* 10GBASE-T type */
143
144/* Status register 2. */
145#define MDIO_STAT2_RXFAULT 0x0400 /* Receive fault */
146#define MDIO_STAT2_TXFAULT 0x0800 /* Transmit fault */
147#define MDIO_STAT2_DEVPRST 0xc000 /* Device present */
148#define MDIO_STAT2_DEVPRST_VAL 0x8000 /* Device present value */
149#define MDIO_PMA_STAT2_LBABLE 0x0001 /* PMA loopback ability */
150#define MDIO_PMA_STAT2_10GBEW 0x0002 /* 10GBASE-EW ability */
151#define MDIO_PMA_STAT2_10GBLW 0x0004 /* 10GBASE-LW ability */
152#define MDIO_PMA_STAT2_10GBSW 0x0008 /* 10GBASE-SW ability */
153#define MDIO_PMA_STAT2_10GBLX4 0x0010 /* 10GBASE-LX4 ability */
154#define MDIO_PMA_STAT2_10GBER 0x0020 /* 10GBASE-ER ability */
155#define MDIO_PMA_STAT2_10GBLR 0x0040 /* 10GBASE-LR ability */
156#define MDIO_PMA_STAT2_10GBSR 0x0080 /* 10GBASE-SR ability */
157#define MDIO_PMD_STAT2_TXDISAB 0x0100 /* PMD TX disable ability */
158#define MDIO_PMA_STAT2_EXTABLE 0x0200 /* Extended abilities */
159#define MDIO_PMA_STAT2_RXFLTABLE 0x1000 /* Receive fault ability */
160#define MDIO_PMA_STAT2_TXFLTABLE 0x2000 /* Transmit fault ability */
161#define MDIO_PCS_STAT2_10GBR 0x0001 /* 10GBASE-R capable */
162#define MDIO_PCS_STAT2_10GBX 0x0002 /* 10GBASE-X capable */
163#define MDIO_PCS_STAT2_10GBW 0x0004 /* 10GBASE-W capable */
164#define MDIO_PCS_STAT2_RXFLTABLE 0x1000 /* Receive fault ability */
165#define MDIO_PCS_STAT2_TXFLTABLE 0x2000 /* Transmit fault ability */
166
167/* Transmit disable register. */
168#define MDIO_PMD_TXDIS_GLOBAL 0x0001 /* Global PMD TX disable */
169#define MDIO_PMD_TXDIS_0 0x0002 /* PMD TX disable 0 */
170#define MDIO_PMD_TXDIS_1 0x0004 /* PMD TX disable 1 */
171#define MDIO_PMD_TXDIS_2 0x0008 /* PMD TX disable 2 */
172#define MDIO_PMD_TXDIS_3 0x0010 /* PMD TX disable 3 */
173
174/* Receive signal detect register. */
175#define MDIO_PMD_RXDET_GLOBAL 0x0001 /* Global PMD RX signal detect */
176#define MDIO_PMD_RXDET_0 0x0002 /* PMD RX signal detect 0 */
177#define MDIO_PMD_RXDET_1 0x0004 /* PMD RX signal detect 1 */
178#define MDIO_PMD_RXDET_2 0x0008 /* PMD RX signal detect 2 */
179#define MDIO_PMD_RXDET_3 0x0010 /* PMD RX signal detect 3 */
180
181/* Extended abilities register. */
182#define MDIO_PMA_EXTABLE_10GCX4 0x0001 /* 10GBASE-CX4 ability */
183#define MDIO_PMA_EXTABLE_10GBLRM 0x0002 /* 10GBASE-LRM ability */
184#define MDIO_PMA_EXTABLE_10GBT 0x0004 /* 10GBASE-T ability */
185#define MDIO_PMA_EXTABLE_10GBKX4 0x0008 /* 10GBASE-KX4 ability */
186#define MDIO_PMA_EXTABLE_10GBKR 0x0010 /* 10GBASE-KR ability */
187#define MDIO_PMA_EXTABLE_1000BT 0x0020 /* 1000BASE-T ability */
188#define MDIO_PMA_EXTABLE_1000BKX 0x0040 /* 1000BASE-KX ability */
189#define MDIO_PMA_EXTABLE_100BTX 0x0080 /* 100BASE-TX ability */
190#define MDIO_PMA_EXTABLE_10BT 0x0100 /* 10BASE-T ability */
191
192/* PHY XGXS lane state register. */
193#define MDIO_PHYXS_LNSTAT_SYNC0 0x0001
194#define MDIO_PHYXS_LNSTAT_SYNC1 0x0002
195#define MDIO_PHYXS_LNSTAT_SYNC2 0x0004
196#define MDIO_PHYXS_LNSTAT_SYNC3 0x0008
197#define MDIO_PHYXS_LNSTAT_ALIGN 0x1000
198
199/* PMA 10GBASE-T pair swap & polarity */
200#define MDIO_PMA_10GBT_SWAPPOL_ABNX 0x0001 /* Pair A/B uncrossed */
201#define MDIO_PMA_10GBT_SWAPPOL_CDNX 0x0002 /* Pair C/D uncrossed */
202#define MDIO_PMA_10GBT_SWAPPOL_AREV 0x0100 /* Pair A polarity reversed */
203#define MDIO_PMA_10GBT_SWAPPOL_BREV 0x0200 /* Pair B polarity reversed */
204#define MDIO_PMA_10GBT_SWAPPOL_CREV 0x0400 /* Pair C polarity reversed */
205#define MDIO_PMA_10GBT_SWAPPOL_DREV 0x0800 /* Pair D polarity reversed */
206
207/* PMA 10GBASE-T TX power register. */
208#define MDIO_PMA_10GBT_TXPWR_SHORT 0x0001 /* Short-reach mode */
209
210/* PMA 10GBASE-T SNR registers. */
211/* Value is SNR margin in dB, clamped to range [-127, 127], plus 0x8000. */
212#define MDIO_PMA_10GBT_SNR_BIAS 0x8000
213#define MDIO_PMA_10GBT_SNR_MAX 127
214
215/* PMA 10GBASE-R FEC ability register. */
216#define MDIO_PMA_10GBR_FECABLE_ABLE 0x0001 /* FEC ability */
217#define MDIO_PMA_10GBR_FECABLE_ERRABLE 0x0002 /* FEC error indic. ability */
218
219/* PCS 10GBASE-R/-T status register 1. */
220#define MDIO_PCS_10GBRT_STAT1_BLKLK 0x0001 /* Block lock attained */
221
222/* PCS 10GBASE-R/-T status register 2. */
223#define MDIO_PCS_10GBRT_STAT2_ERR 0x00ff
224#define MDIO_PCS_10GBRT_STAT2_BER 0x3f00
225
226/* AN 10GBASE-T control register. */
227#define MDIO_AN_10GBT_CTRL_ADV10G 0x1000 /* Advertise 10GBASE-T */
228
229/* AN 10GBASE-T status register. */
230#define MDIO_AN_10GBT_STAT_LPTRR 0x0200 /* LP training reset req. */
231#define MDIO_AN_10GBT_STAT_LPLTABLE 0x0400 /* LP loop timing ability */
232#define MDIO_AN_10GBT_STAT_LP10G 0x0800 /* LP is 10GBT capable */
233#define MDIO_AN_10GBT_STAT_REMOK 0x1000 /* Remote OK */
234#define MDIO_AN_10GBT_STAT_LOCOK 0x2000 /* Local OK */
235#define MDIO_AN_10GBT_STAT_MS 0x4000 /* Master/slave config */
236#define MDIO_AN_10GBT_STAT_MSFLT 0x8000 /* Master/slave config fault */
237
238/* LASI RX_ALARM control/status registers. */
239#define MDIO_PMA_LASI_RX_PHYXSLFLT 0x0001 /* PHY XS RX local fault */
240#define MDIO_PMA_LASI_RX_PCSLFLT 0x0008 /* PCS RX local fault */
241#define MDIO_PMA_LASI_RX_PMALFLT 0x0010 /* PMA/PMD RX local fault */
242#define MDIO_PMA_LASI_RX_OPTICPOWERFLT 0x0020 /* RX optical power fault */
243#define MDIO_PMA_LASI_RX_WISLFLT 0x0200 /* WIS local fault */
244
245/* LASI TX_ALARM control/status registers. */
246#define MDIO_PMA_LASI_TX_PHYXSLFLT 0x0001 /* PHY XS TX local fault */
247#define MDIO_PMA_LASI_TX_PCSLFLT 0x0008 /* PCS TX local fault */
248#define MDIO_PMA_LASI_TX_PMALFLT 0x0010 /* PMA/PMD TX local fault */
249#define MDIO_PMA_LASI_TX_LASERPOWERFLT 0x0080 /* Laser output power fault */
250#define MDIO_PMA_LASI_TX_LASERTEMPFLT 0x0100 /* Laser temperature fault */
251#define MDIO_PMA_LASI_TX_LASERBICURRFLT 0x0200 /* Laser bias current fault */
252
253/* LASI control/status registers. */
254#define MDIO_PMA_LASI_LSALARM 0x0001 /* LS_ALARM enable/status */
255#define MDIO_PMA_LASI_TXALARM 0x0002 /* TX_ALARM enable/status */
256#define MDIO_PMA_LASI_RXALARM 0x0004 /* RX_ALARM enable/status */
257
258/* Mapping between MDIO PRTAD/DEVAD and mii_ioctl_data::phy_id */
259
260#define MDIO_PHY_ID_C45 0x8000
261#define MDIO_PHY_ID_PRTAD 0x03e0
262#define MDIO_PHY_ID_DEVAD 0x001f
263#define MDIO_PHY_ID_C45_MASK \
264 (MDIO_PHY_ID_C45 | MDIO_PHY_ID_PRTAD | MDIO_PHY_ID_DEVAD)
265
266static inline __u16 mdio_phy_id_c45(int prtad, int devad)
267{
268 return MDIO_PHY_ID_C45 | (prtad << 5) | devad;
269}
270
271static inline bool mdio_phy_id_is_c45(int phy_id)
272{
273 return (phy_id & MDIO_PHY_ID_C45) && !(phy_id & ~MDIO_PHY_ID_C45_MASK);
274}
275
276static inline __u16 mdio_phy_id_prtad(int phy_id)
277{
278 return (phy_id & MDIO_PHY_ID_PRTAD) >> 5;
279}
280
281static inline __u16 mdio_phy_id_devad(int phy_id)
282{
283 return phy_id & MDIO_PHY_ID_DEVAD;
284}
285
286#define MDIO_SUPPORTS_C22 1
287#define MDIO_SUPPORTS_C45 2
288
289#ifdef __KERNEL__
290
291/**
292 * struct mdio_if_info - Ethernet controller MDIO interface
293 * @prtad: PRTAD of the PHY (%MDIO_PRTAD_NONE if not present/unknown)
294 * @mmds: Mask of MMDs expected to be present in the PHY. This must be
295 * non-zero unless @prtad = %MDIO_PRTAD_NONE.
296 * @mode_support: MDIO modes supported. If %MDIO_SUPPORTS_C22 is set then
297 * MII register access will be passed through with @devad =
298 * %MDIO_DEVAD_NONE. If %MDIO_EMULATE_C22 is set then access to
299 * commonly used clause 22 registers will be translated into
300 * clause 45 registers.
301 * @dev: Net device structure
302 * @mdio_read: Register read function; returns value or negative error code
303 * @mdio_write: Register write function; returns 0 or negative error code
304 */
305struct mdio_if_info {
306 int prtad;
307 u32 __bitwise mmds;
308 unsigned mode_support;
309
310 struct net_device *dev;
311 int (*mdio_read)(struct net_device *dev, int prtad, int devad,
312 u16 addr);
313 int (*mdio_write)(struct net_device *dev, int prtad, int devad,
314 u16 addr, u16 val);
315};
316
317#define MDIO_PRTAD_NONE (-1)
318#define MDIO_DEVAD_NONE (-1)
319#define MDIO_EMULATE_C22 4
320
321struct ethtool_cmd;
322struct ethtool_pauseparam;
323extern int mdio45_probe(struct mdio_if_info *mdio, int prtad);
324extern int mdio_set_flag(const struct mdio_if_info *mdio,
325 int prtad, int devad, u16 addr, int mask,
326 bool sense);
327extern int mdio45_links_ok(const struct mdio_if_info *mdio, u32 mmds);
328extern int mdio45_nway_restart(const struct mdio_if_info *mdio);
329extern void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio,
330 struct ethtool_cmd *ecmd,
331 u32 npage_adv, u32 npage_lpa);
332extern void
333mdio45_ethtool_spauseparam_an(const struct mdio_if_info *mdio,
334 const struct ethtool_pauseparam *ecmd);
335
336/**
337 * mdio45_ethtool_gset - get settings for ETHTOOL_GSET
338 * @mdio: MDIO interface
339 * @ecmd: Ethtool request structure
340 *
341 * Since the CSRs for auto-negotiation using next pages are not fully
342 * standardised, this function does not attempt to decode them. Use
343 * mdio45_ethtool_gset_npage() to specify advertisement bits from next
344 * pages.
345 */
346static inline void mdio45_ethtool_gset(const struct mdio_if_info *mdio,
347 struct ethtool_cmd *ecmd)
348{
349 mdio45_ethtool_gset_npage(mdio, ecmd, 0, 0);
350}
351
352extern int mdio_mii_ioctl(const struct mdio_if_info *mdio,
353 struct mii_ioctl_data *mii_data, int cmd);
354
355#endif /* __KERNEL__ */
356#endif /* __LINUX_MDIO_H__ */
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 25b9ca93d232..e46a0734ab6e 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -94,6 +94,7 @@ extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem,
94extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem, 94extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
95 int priority); 95 int priority);
96int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg); 96int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg);
97int mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg);
97unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, 98unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg,
98 struct zone *zone, 99 struct zone *zone,
99 enum lru_list lru); 100 enum lru_list lru);
@@ -116,7 +117,7 @@ static inline bool mem_cgroup_disabled(void)
116} 117}
117 118
118extern bool mem_cgroup_oom_called(struct task_struct *task); 119extern bool mem_cgroup_oom_called(struct task_struct *task);
119 120void mem_cgroup_update_mapped_file_stat(struct page *page, int val);
120#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 121#else /* CONFIG_CGROUP_MEM_RES_CTLR */
121struct mem_cgroup; 122struct mem_cgroup;
122 123
@@ -239,6 +240,12 @@ mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg)
239 return 1; 240 return 1;
240} 241}
241 242
243static inline int
244mem_cgroup_inactive_file_is_low(struct mem_cgroup *memcg)
245{
246 return 1;
247}
248
242static inline unsigned long 249static inline unsigned long
243mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, struct zone *zone, 250mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, struct zone *zone,
244 enum lru_list lru) 251 enum lru_list lru)
@@ -264,6 +271,11 @@ mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p)
264{ 271{
265} 272}
266 273
274static inline void mem_cgroup_update_mapped_file_stat(struct page *page,
275 int val)
276{
277}
278
267#endif /* CONFIG_CGROUP_MEM_CONT */ 279#endif /* CONFIG_CGROUP_MEM_CONT */
268 280
269#endif /* _LINUX_MEMCONTROL_H */ 281#endif /* _LINUX_MEMCONTROL_H */
diff --git a/include/linux/mfd/ab3100.h b/include/linux/mfd/ab3100.h
new file mode 100644
index 000000000000..7a3f316e3848
--- /dev/null
+++ b/include/linux/mfd/ab3100.h
@@ -0,0 +1,103 @@
1/*
2 * Copyright (C) 2007-2009 ST-Ericsson AB
3 * License terms: GNU General Public License (GPL) version 2
4 * AB3100 core access functions
5 * Author: Linus Walleij <linus.walleij@stericsson.com>
6 */
7
8#include <linux/device.h>
9
10#ifndef MFD_AB3100_H
11#define MFD_AB3100_H
12
13#define ABUNKNOWN 0
14#define AB3000 1
15#define AB3100 2
16
17/*
18 * AB3100, EVENTA1, A2 and A3 event register flags
19 * these are catenated into a single 32-bit flag in the code
20 * for event notification broadcasts.
21 */
22#define AB3100_EVENTA1_ONSWA (0x01<<16)
23#define AB3100_EVENTA1_ONSWB (0x02<<16)
24#define AB3100_EVENTA1_ONSWC (0x04<<16)
25#define AB3100_EVENTA1_DCIO (0x08<<16)
26#define AB3100_EVENTA1_OVER_TEMP (0x10<<16)
27#define AB3100_EVENTA1_SIM_OFF (0x20<<16)
28#define AB3100_EVENTA1_VBUS (0x40<<16)
29#define AB3100_EVENTA1_VSET_USB (0x80<<16)
30
31#define AB3100_EVENTA2_READY_TX (0x01<<8)
32#define AB3100_EVENTA2_READY_RX (0x02<<8)
33#define AB3100_EVENTA2_OVERRUN_ERROR (0x04<<8)
34#define AB3100_EVENTA2_FRAMING_ERROR (0x08<<8)
35#define AB3100_EVENTA2_CHARG_OVERCURRENT (0x10<<8)
36#define AB3100_EVENTA2_MIDR (0x20<<8)
37#define AB3100_EVENTA2_BATTERY_REM (0x40<<8)
38#define AB3100_EVENTA2_ALARM (0x80<<8)
39
40#define AB3100_EVENTA3_ADC_TRIG5 (0x01)
41#define AB3100_EVENTA3_ADC_TRIG4 (0x02)
42#define AB3100_EVENTA3_ADC_TRIG3 (0x04)
43#define AB3100_EVENTA3_ADC_TRIG2 (0x08)
44#define AB3100_EVENTA3_ADC_TRIGVBAT (0x10)
45#define AB3100_EVENTA3_ADC_TRIGVTX (0x20)
46#define AB3100_EVENTA3_ADC_TRIG1 (0x40)
47#define AB3100_EVENTA3_ADC_TRIG0 (0x80)
48
49/* AB3100, STR register flags */
50#define AB3100_STR_ONSWA (0x01)
51#define AB3100_STR_ONSWB (0x02)
52#define AB3100_STR_ONSWC (0x04)
53#define AB3100_STR_DCIO (0x08)
54#define AB3100_STR_BOOT_MODE (0x10)
55#define AB3100_STR_SIM_OFF (0x20)
56#define AB3100_STR_BATT_REMOVAL (0x40)
57#define AB3100_STR_VBUS (0x80)
58
59/**
60 * struct ab3100
61 * @access_mutex: lock out concurrent accesses to the AB3100 registers
62 * @dev: pointer to the containing device
63 * @i2c_client: I2C client for this chip
64 * @testreg_client: secondary client for test registers
65 * @chip_name: name of this chip variant
66 * @chip_id: 8 bit chip ID for this chip variant
67 * @work: an event handling worker
68 * @event_subscribers: event subscribers are listed here
69 * @startup_events: a copy of the first reading of the event registers
70 * @startup_events_read: whether the first events have been read
71 *
72 * This struct is PRIVATE and devices using it should NOT
73 * access ANY fields. It is used as a token for calling the
74 * AB3100 functions.
75 */
76struct ab3100 {
77 struct mutex access_mutex;
78 struct device *dev;
79 struct i2c_client *i2c_client;
80 struct i2c_client *testreg_client;
81 char chip_name[32];
82 u8 chip_id;
83 struct work_struct work;
84 struct blocking_notifier_head event_subscribers;
85 u32 startup_events;
86 bool startup_events_read;
87};
88
89int ab3100_set_register(struct ab3100 *ab3100, u8 reg, u8 regval);
90int ab3100_get_register(struct ab3100 *ab3100, u8 reg, u8 *regval);
91int ab3100_get_register_page(struct ab3100 *ab3100,
92 u8 first_reg, u8 *regvals, u8 numregs);
93int ab3100_mask_and_set_register(struct ab3100 *ab3100,
94 u8 reg, u8 andmask, u8 ormask);
95u8 ab3100_get_chip_type(struct ab3100 *ab3100);
96int ab3100_event_register(struct ab3100 *ab3100,
97 struct notifier_block *nb);
98int ab3100_event_unregister(struct ab3100 *ab3100,
99 struct notifier_block *nb);
100int ab3100_event_registers_startup_state_get(struct ab3100 *ab3100,
101 u32 *fatevent);
102
103#endif
diff --git a/include/linux/mfd/asic3.h b/include/linux/mfd/asic3.h
index 322cd6deb9f0..de3c4ad19afb 100644
--- a/include/linux/mfd/asic3.h
+++ b/include/linux/mfd/asic3.h
@@ -30,6 +30,13 @@ struct asic3_platform_data {
30#define ASIC3_NUM_GPIOS 64 30#define ASIC3_NUM_GPIOS 64
31#define ASIC3_NR_IRQS ASIC3_NUM_GPIOS + 6 31#define ASIC3_NR_IRQS ASIC3_NUM_GPIOS + 6
32 32
33#define ASIC3_IRQ_LED0 64
34#define ASIC3_IRQ_LED1 65
35#define ASIC3_IRQ_LED2 66
36#define ASIC3_IRQ_SPI 67
37#define ASIC3_IRQ_SMBUS 68
38#define ASIC3_IRQ_OWM 69
39
33#define ASIC3_TO_GPIO(gpio) (NR_BUILTIN_GPIO + (gpio)) 40#define ASIC3_TO_GPIO(gpio) (NR_BUILTIN_GPIO + (gpio))
34 41
35#define ASIC3_GPIO_BANK_A 0 42#define ASIC3_GPIO_BANK_A 0
@@ -227,8 +234,8 @@ struct asic3_platform_data {
227 234
228 235
229/* Basic control of the SD ASIC */ 236/* Basic control of the SD ASIC */
230#define ASIC3_SDHWCTRL_Base 0x0E00 237#define ASIC3_SDHWCTRL_BASE 0x0E00
231#define ASIC3_SDHWCTRL_SDConf 0x00 238#define ASIC3_SDHWCTRL_SDCONF 0x00
232 239
233#define ASIC3_SDHWCTRL_SUSPEND (1 << 0) /* 1=suspend all SD operations */ 240#define ASIC3_SDHWCTRL_SUSPEND (1 << 0) /* 1=suspend all SD operations */
234#define ASIC3_SDHWCTRL_CLKSEL (1 << 1) /* 1=SDICK, 0=HCLK */ 241#define ASIC3_SDHWCTRL_CLKSEL (1 << 1) /* 1=SDICK, 0=HCLK */
@@ -242,10 +249,10 @@ struct asic3_platform_data {
242/* SD card power supply ctrl 1=enable */ 249/* SD card power supply ctrl 1=enable */
243#define ASIC3_SDHWCTRL_SDPWR (1 << 6) 250#define ASIC3_SDHWCTRL_SDPWR (1 << 6)
244 251
245#define ASIC3_EXTCF_Base 0x1100 252#define ASIC3_EXTCF_BASE 0x1100
246 253
247#define ASIC3_EXTCF_Select 0x00 254#define ASIC3_EXTCF_SELECT 0x00
248#define ASIC3_EXTCF_Reset 0x04 255#define ASIC3_EXTCF_RESET 0x04
249 256
250#define ASIC3_EXTCF_SMOD0 (1 << 0) /* slot number of mode 0 */ 257#define ASIC3_EXTCF_SMOD0 (1 << 0) /* slot number of mode 0 */
251#define ASIC3_EXTCF_SMOD1 (1 << 1) /* slot number of mode 1 */ 258#define ASIC3_EXTCF_SMOD1 (1 << 1) /* slot number of mode 1 */
@@ -279,222 +286,9 @@ struct asic3_platform_data {
279 * SDIO_CTRL Control registers for SDIO operations 286 * SDIO_CTRL Control registers for SDIO operations
280 * 287 *
281 *****************************************************************************/ 288 *****************************************************************************/
282#define ASIC3_SD_CONFIG_Base 0x0400 /* Assumes 32 bit addressing */ 289#define ASIC3_SD_CONFIG_BASE 0x0400 /* Assumes 32 bit addressing */
283 290#define ASIC3_SD_CTRL_BASE 0x1000
284#define ASIC3_SD_CONFIG_Command 0x08 /* R/W: Command */ 291#define ASIC3_SDIO_CTRL_BASE 0x1200
285
286/* [0:8] SD Control Register Base Address */
287#define ASIC3_SD_CONFIG_Addr0 0x20
288
289/* [9:31] SD Control Register Base Address */
290#define ASIC3_SD_CONFIG_Addr1 0x24
291
292/* R/O: interrupt assigned to pin */
293#define ASIC3_SD_CONFIG_IntPin 0x78
294
295/*
296 * Set to 0x1f to clock SD controller, 0 otherwise.
297 * At 0x82 - Gated Clock Ctrl
298 */
299#define ASIC3_SD_CONFIG_ClkStop 0x80
300
301/* Control clock of SD controller */
302#define ASIC3_SD_CONFIG_ClockMode 0x84
303#define ASIC3_SD_CONFIG_SDHC_PinStatus 0x88 /* R/0: SD pins status */
304#define ASIC3_SD_CONFIG_SDHC_Power1 0x90 /* Power1 - manual pwr ctrl */
305
306/* auto power up after card inserted */
307#define ASIC3_SD_CONFIG_SDHC_Power2 0x92
308
309/* auto power down when card removed */
310#define ASIC3_SD_CONFIG_SDHC_Power3 0x94
311#define ASIC3_SD_CONFIG_SDHC_CardDetect 0x98
312#define ASIC3_SD_CONFIG_SDHC_Slot 0xA0 /* R/O: support slot number */
313#define ASIC3_SD_CONFIG_SDHC_ExtGateClk1 0x1E0 /* Not used */
314#define ASIC3_SD_CONFIG_SDHC_ExtGateClk2 0x1E2 /* Not used*/
315
316/* GPIO Output Reg. , at 0x1EA - GPIO Output Enable Reg. */
317#define ASIC3_SD_CONFIG_SDHC_GPIO_OutAndEnable 0x1E8
318#define ASIC3_SD_CONFIG_SDHC_GPIO_Status 0x1EC /* GPIO Status Reg. */
319
320/* Bit 1: double buffer/single buffer */
321#define ASIC3_SD_CONFIG_SDHC_ExtGateClk3 0x1F0
322
323/* Memory access enable (set to 1 to access SD Controller) */
324#define SD_CONFIG_COMMAND_MAE (1<<1)
325
326#define SD_CONFIG_CLK_ENABLE_ALL 0x1f
327
328#define SD_CONFIG_POWER1_PC_33V 0x0200 /* Set for 3.3 volts */
329#define SD_CONFIG_POWER1_PC_OFF 0x0000 /* Turn off power */
330
331 /* two bits - number of cycles for card detection */
332#define SD_CONFIG_CARDDETECTMODE_CLK ((x) & 0x3)
333
334
335#define ASIC3_SD_CTRL_Base 0x1000
336
337#define ASIC3_SD_CTRL_Cmd 0x00
338#define ASIC3_SD_CTRL_Arg0 0x08
339#define ASIC3_SD_CTRL_Arg1 0x0C
340#define ASIC3_SD_CTRL_StopInternal 0x10
341#define ASIC3_SD_CTRL_TransferSectorCount 0x14
342#define ASIC3_SD_CTRL_Response0 0x18
343#define ASIC3_SD_CTRL_Response1 0x1C
344#define ASIC3_SD_CTRL_Response2 0x20
345#define ASIC3_SD_CTRL_Response3 0x24
346#define ASIC3_SD_CTRL_Response4 0x28
347#define ASIC3_SD_CTRL_Response5 0x2C
348#define ASIC3_SD_CTRL_Response6 0x30
349#define ASIC3_SD_CTRL_Response7 0x34
350#define ASIC3_SD_CTRL_CardStatus 0x38
351#define ASIC3_SD_CTRL_BufferCtrl 0x3C
352#define ASIC3_SD_CTRL_IntMaskCard 0x40
353#define ASIC3_SD_CTRL_IntMaskBuffer 0x44
354#define ASIC3_SD_CTRL_CardClockCtrl 0x48
355#define ASIC3_SD_CTRL_MemCardXferDataLen 0x4C
356#define ASIC3_SD_CTRL_MemCardOptionSetup 0x50
357#define ASIC3_SD_CTRL_ErrorStatus0 0x58
358#define ASIC3_SD_CTRL_ErrorStatus1 0x5C
359#define ASIC3_SD_CTRL_DataPort 0x60
360#define ASIC3_SD_CTRL_TransactionCtrl 0x68
361#define ASIC3_SD_CTRL_SoftwareReset 0x1C0
362
363#define SD_CTRL_SOFTWARE_RESET_CLEAR (1<<0)
364
365#define SD_CTRL_TRANSACTIONCONTROL_SET (1<<8)
366
367#define SD_CTRL_CARDCLOCKCONTROL_FOR_SD_CARD (1<<15)
368#define SD_CTRL_CARDCLOCKCONTROL_ENABLE_CLOCK (1<<8)
369#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_512 (1<<7)
370#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_256 (1<<6)
371#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_128 (1<<5)
372#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_64 (1<<4)
373#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_32 (1<<3)
374#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_16 (1<<2)
375#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_8 (1<<1)
376#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_4 (1<<0)
377#define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_2 (0<<0)
378
379#define MEM_CARD_OPTION_REQUIRED 0x000e
380#define MEM_CARD_OPTION_DATA_RESPONSE_TIMEOUT(x) (((x) & 0x0f) << 4)
381#define MEM_CARD_OPTION_C2_MODULE_NOT_PRESENT (1<<14)
382#define MEM_CARD_OPTION_DATA_XFR_WIDTH_1 (1<<15)
383#define MEM_CARD_OPTION_DATA_XFR_WIDTH_4 0
384
385#define SD_CTRL_COMMAND_INDEX(x) ((x) & 0x3f)
386#define SD_CTRL_COMMAND_TYPE_CMD (0 << 6)
387#define SD_CTRL_COMMAND_TYPE_ACMD (1 << 6)
388#define SD_CTRL_COMMAND_TYPE_AUTHENTICATION (2 << 6)
389#define SD_CTRL_COMMAND_RESPONSE_TYPE_NORMAL (0 << 8)
390#define SD_CTRL_COMMAND_RESPONSE_TYPE_EXT_R1 (4 << 8)
391#define SD_CTRL_COMMAND_RESPONSE_TYPE_EXT_R1B (5 << 8)
392#define SD_CTRL_COMMAND_RESPONSE_TYPE_EXT_R2 (6 << 8)
393#define SD_CTRL_COMMAND_RESPONSE_TYPE_EXT_R3 (7 << 8)
394#define SD_CTRL_COMMAND_DATA_PRESENT (1 << 11)
395#define SD_CTRL_COMMAND_TRANSFER_READ (1 << 12)
396#define SD_CTRL_COMMAND_TRANSFER_WRITE (0 << 12)
397#define SD_CTRL_COMMAND_MULTI_BLOCK (1 << 13)
398#define SD_CTRL_COMMAND_SECURITY_CMD (1 << 14)
399
400#define SD_CTRL_STOP_INTERNAL_ISSSUE_CMD12 (1 << 0)
401#define SD_CTRL_STOP_INTERNAL_AUTO_ISSUE_CMD12 (1 << 8)
402
403#define SD_CTRL_CARDSTATUS_RESPONSE_END (1 << 0)
404#define SD_CTRL_CARDSTATUS_RW_END (1 << 2)
405#define SD_CTRL_CARDSTATUS_CARD_REMOVED_0 (1 << 3)
406#define SD_CTRL_CARDSTATUS_CARD_INSERTED_0 (1 << 4)
407#define SD_CTRL_CARDSTATUS_SIGNAL_STATE_PRESENT_0 (1 << 5)
408#define SD_CTRL_CARDSTATUS_WRITE_PROTECT (1 << 7)
409#define SD_CTRL_CARDSTATUS_CARD_REMOVED_3 (1 << 8)
410#define SD_CTRL_CARDSTATUS_CARD_INSERTED_3 (1 << 9)
411#define SD_CTRL_CARDSTATUS_SIGNAL_STATE_PRESENT_3 (1 << 10)
412
413#define SD_CTRL_BUFFERSTATUS_CMD_INDEX_ERROR (1 << 0)
414#define SD_CTRL_BUFFERSTATUS_CRC_ERROR (1 << 1)
415#define SD_CTRL_BUFFERSTATUS_STOP_BIT_END_ERROR (1 << 2)
416#define SD_CTRL_BUFFERSTATUS_DATA_TIMEOUT (1 << 3)
417#define SD_CTRL_BUFFERSTATUS_BUFFER_OVERFLOW (1 << 4)
418#define SD_CTRL_BUFFERSTATUS_BUFFER_UNDERFLOW (1 << 5)
419#define SD_CTRL_BUFFERSTATUS_CMD_TIMEOUT (1 << 6)
420#define SD_CTRL_BUFFERSTATUS_UNK7 (1 << 7)
421#define SD_CTRL_BUFFERSTATUS_BUFFER_READ_ENABLE (1 << 8)
422#define SD_CTRL_BUFFERSTATUS_BUFFER_WRITE_ENABLE (1 << 9)
423#define SD_CTRL_BUFFERSTATUS_ILLEGAL_FUNCTION (1 << 13)
424#define SD_CTRL_BUFFERSTATUS_CMD_BUSY (1 << 14)
425#define SD_CTRL_BUFFERSTATUS_ILLEGAL_ACCESS (1 << 15)
426
427#define SD_CTRL_INTMASKCARD_RESPONSE_END (1 << 0)
428#define SD_CTRL_INTMASKCARD_RW_END (1 << 2)
429#define SD_CTRL_INTMASKCARD_CARD_REMOVED_0 (1 << 3)
430#define SD_CTRL_INTMASKCARD_CARD_INSERTED_0 (1 << 4)
431#define SD_CTRL_INTMASKCARD_SIGNAL_STATE_PRESENT_0 (1 << 5)
432#define SD_CTRL_INTMASKCARD_UNK6 (1 << 6)
433#define SD_CTRL_INTMASKCARD_WRITE_PROTECT (1 << 7)
434#define SD_CTRL_INTMASKCARD_CARD_REMOVED_3 (1 << 8)
435#define SD_CTRL_INTMASKCARD_CARD_INSERTED_3 (1 << 9)
436#define SD_CTRL_INTMASKCARD_SIGNAL_STATE_PRESENT_3 (1 << 10)
437
438#define SD_CTRL_INTMASKBUFFER_CMD_INDEX_ERROR (1 << 0)
439#define SD_CTRL_INTMASKBUFFER_CRC_ERROR (1 << 1)
440#define SD_CTRL_INTMASKBUFFER_STOP_BIT_END_ERROR (1 << 2)
441#define SD_CTRL_INTMASKBUFFER_DATA_TIMEOUT (1 << 3)
442#define SD_CTRL_INTMASKBUFFER_BUFFER_OVERFLOW (1 << 4)
443#define SD_CTRL_INTMASKBUFFER_BUFFER_UNDERFLOW (1 << 5)
444#define SD_CTRL_INTMASKBUFFER_CMD_TIMEOUT (1 << 6)
445#define SD_CTRL_INTMASKBUFFER_UNK7 (1 << 7)
446#define SD_CTRL_INTMASKBUFFER_BUFFER_READ_ENABLE (1 << 8)
447#define SD_CTRL_INTMASKBUFFER_BUFFER_WRITE_ENABLE (1 << 9)
448#define SD_CTRL_INTMASKBUFFER_ILLEGAL_FUNCTION (1 << 13)
449#define SD_CTRL_INTMASKBUFFER_CMD_BUSY (1 << 14)
450#define SD_CTRL_INTMASKBUFFER_ILLEGAL_ACCESS (1 << 15)
451
452#define SD_CTRL_DETAIL0_RESPONSE_CMD_ERROR (1 << 0)
453#define SD_CTRL_DETAIL0_END_BIT_ERROR_FOR_RESPONSE_NON_CMD12 (1 << 2)
454#define SD_CTRL_DETAIL0_END_BIT_ERROR_FOR_RESPONSE_CMD12 (1 << 3)
455#define SD_CTRL_DETAIL0_END_BIT_ERROR_FOR_READ_DATA (1 << 4)
456#define SD_CTRL_DETAIL0_END_BIT_ERROR_FOR_WRITE_CRC_STATUS (1 << 5)
457#define SD_CTRL_DETAIL0_CRC_ERROR_FOR_RESPONSE_NON_CMD12 (1 << 8)
458#define SD_CTRL_DETAIL0_CRC_ERROR_FOR_RESPONSE_CMD12 (1 << 9)
459#define SD_CTRL_DETAIL0_CRC_ERROR_FOR_READ_DATA (1 << 10)
460#define SD_CTRL_DETAIL0_CRC_ERROR_FOR_WRITE_CMD (1 << 11)
461
462#define SD_CTRL_DETAIL1_NO_CMD_RESPONSE (1 << 0)
463#define SD_CTRL_DETAIL1_TIMEOUT_READ_DATA (1 << 4)
464#define SD_CTRL_DETAIL1_TIMEOUT_CRS_STATUS (1 << 5)
465#define SD_CTRL_DETAIL1_TIMEOUT_CRC_BUSY (1 << 6)
466
467#define ASIC3_SDIO_CTRL_Base 0x1200
468
469#define ASIC3_SDIO_CTRL_Cmd 0x00
470#define ASIC3_SDIO_CTRL_CardPortSel 0x04
471#define ASIC3_SDIO_CTRL_Arg0 0x08
472#define ASIC3_SDIO_CTRL_Arg1 0x0C
473#define ASIC3_SDIO_CTRL_TransferBlockCount 0x14
474#define ASIC3_SDIO_CTRL_Response0 0x18
475#define ASIC3_SDIO_CTRL_Response1 0x1C
476#define ASIC3_SDIO_CTRL_Response2 0x20
477#define ASIC3_SDIO_CTRL_Response3 0x24
478#define ASIC3_SDIO_CTRL_Response4 0x28
479#define ASIC3_SDIO_CTRL_Response5 0x2C
480#define ASIC3_SDIO_CTRL_Response6 0x30
481#define ASIC3_SDIO_CTRL_Response7 0x34
482#define ASIC3_SDIO_CTRL_CardStatus 0x38
483#define ASIC3_SDIO_CTRL_BufferCtrl 0x3C
484#define ASIC3_SDIO_CTRL_IntMaskCard 0x40
485#define ASIC3_SDIO_CTRL_IntMaskBuffer 0x44
486#define ASIC3_SDIO_CTRL_CardXferDataLen 0x4C
487#define ASIC3_SDIO_CTRL_CardOptionSetup 0x50
488#define ASIC3_SDIO_CTRL_ErrorStatus0 0x54
489#define ASIC3_SDIO_CTRL_ErrorStatus1 0x58
490#define ASIC3_SDIO_CTRL_DataPort 0x60
491#define ASIC3_SDIO_CTRL_TransactionCtrl 0x68
492#define ASIC3_SDIO_CTRL_CardIntCtrl 0x6C
493#define ASIC3_SDIO_CTRL_ClocknWaitCtrl 0x70
494#define ASIC3_SDIO_CTRL_HostInformation 0x74
495#define ASIC3_SDIO_CTRL_ErrorCtrl 0x78
496#define ASIC3_SDIO_CTRL_LEDCtrl 0x7C
497#define ASIC3_SDIO_CTRL_SoftwareReset 0x1C0
498 292
499#define ASIC3_MAP_SIZE_32BIT 0x2000 293#define ASIC3_MAP_SIZE_32BIT 0x2000
500#define ASIC3_MAP_SIZE_16BIT 0x1000 294#define ASIC3_MAP_SIZE_16BIT 0x1000
diff --git a/include/linux/mfd/ezx-pcap.h b/include/linux/mfd/ezx-pcap.h
new file mode 100644
index 000000000000..c12c3c0932bf
--- /dev/null
+++ b/include/linux/mfd/ezx-pcap.h
@@ -0,0 +1,256 @@
1/*
2 * Copyright 2009 Daniel Ribeiro <drwyrm@gmail.com>
3 *
4 * For further information, please see http://wiki.openezx.org/PCAP2
5 */
6
7#ifndef EZX_PCAP_H
8#define EZX_PCAP_H
9
10struct pcap_subdev {
11 int id;
12 const char *name;
13 void *platform_data;
14};
15
16struct pcap_platform_data {
17 unsigned int irq_base;
18 unsigned int config;
19 void (*init) (void *); /* board specific init */
20 int num_subdevs;
21 struct pcap_subdev *subdevs;
22};
23
24struct pcap_chip;
25
26int ezx_pcap_write(struct pcap_chip *, u8, u32);
27int ezx_pcap_read(struct pcap_chip *, u8, u32 *);
28int pcap_to_irq(struct pcap_chip *, int);
29int pcap_adc_async(struct pcap_chip *, u8, u32, u8[], void *, void *);
30int pcap_adc_sync(struct pcap_chip *, u8, u32, u8[], u16[]);
31
32#define PCAP_SECOND_PORT 1
33#define PCAP_CS_AH 2
34
35#define PCAP_REGISTER_WRITE_OP_BIT 0x80000000
36#define PCAP_REGISTER_READ_OP_BIT 0x00000000
37
38#define PCAP_REGISTER_VALUE_MASK 0x01ffffff
39#define PCAP_REGISTER_ADDRESS_MASK 0x7c000000
40#define PCAP_REGISTER_ADDRESS_SHIFT 26
41#define PCAP_REGISTER_NUMBER 32
42#define PCAP_CLEAR_INTERRUPT_REGISTER 0x01ffffff
43#define PCAP_MASK_ALL_INTERRUPT 0x01ffffff
44
45/* registers acessible by both pcap ports */
46#define PCAP_REG_ISR 0x0 /* Interrupt Status */
47#define PCAP_REG_MSR 0x1 /* Interrupt Mask */
48#define PCAP_REG_PSTAT 0x2 /* Processor Status */
49#define PCAP_REG_VREG2 0x6 /* Regulator Bank 2 Control */
50#define PCAP_REG_AUXVREG 0x7 /* Auxiliary Regulator Control */
51#define PCAP_REG_BATT 0x8 /* Battery Control */
52#define PCAP_REG_ADC 0x9 /* AD Control */
53#define PCAP_REG_ADR 0xa /* AD Result */
54#define PCAP_REG_CODEC 0xb /* Audio Codec Control */
55#define PCAP_REG_RX_AMPS 0xc /* RX Audio Amplifiers Control */
56#define PCAP_REG_ST_DAC 0xd /* Stereo DAC Control */
57#define PCAP_REG_BUSCTRL 0x14 /* Connectivity Control */
58#define PCAP_REG_PERIPH 0x15 /* Peripheral Control */
59#define PCAP_REG_LOWPWR 0x18 /* Regulator Low Power Control */
60#define PCAP_REG_TX_AMPS 0x1a /* TX Audio Amplifiers Control */
61#define PCAP_REG_GP 0x1b /* General Purpose */
62#define PCAP_REG_TEST1 0x1c
63#define PCAP_REG_TEST2 0x1d
64#define PCAP_REG_VENDOR_TEST1 0x1e
65#define PCAP_REG_VENDOR_TEST2 0x1f
66
67/* registers acessible by pcap port 1 only (a1200, e2 & e6) */
68#define PCAP_REG_INT_SEL 0x3 /* Interrupt Select */
69#define PCAP_REG_SWCTRL 0x4 /* Switching Regulator Control */
70#define PCAP_REG_VREG1 0x5 /* Regulator Bank 1 Control */
71#define PCAP_REG_RTC_TOD 0xe /* RTC Time of Day */
72#define PCAP_REG_RTC_TODA 0xf /* RTC Time of Day Alarm */
73#define PCAP_REG_RTC_DAY 0x10 /* RTC Day */
74#define PCAP_REG_RTC_DAYA 0x11 /* RTC Day Alarm */
75#define PCAP_REG_MTRTMR 0x12 /* AD Monitor Timer */
76#define PCAP_REG_PWR 0x13 /* Power Control */
77#define PCAP_REG_AUXVREG_MASK 0x16 /* Auxiliary Regulator Mask */
78#define PCAP_REG_VENDOR_REV 0x17
79#define PCAP_REG_PERIPH_MASK 0x19 /* Peripheral Mask */
80
81/* PCAP2 Interrupts */
82#define PCAP_NIRQS 23
83#define PCAP_IRQ_ADCDONE 0 /* ADC done port 1 */
84#define PCAP_IRQ_TS 1 /* Touch Screen */
85#define PCAP_IRQ_1HZ 2 /* 1HZ timer */
86#define PCAP_IRQ_WH 3 /* ADC above high limit */
87#define PCAP_IRQ_WL 4 /* ADC below low limit */
88#define PCAP_IRQ_TODA 5 /* Time of day alarm */
89#define PCAP_IRQ_USB4V 6 /* USB above 4V */
90#define PCAP_IRQ_ONOFF 7 /* On/Off button */
91#define PCAP_IRQ_ONOFF2 8 /* On/Off button 2 */
92#define PCAP_IRQ_USB1V 9 /* USB above 1V */
93#define PCAP_IRQ_MOBPORT 10
94#define PCAP_IRQ_MIC 11 /* Mic attach/HS button */
95#define PCAP_IRQ_HS 12 /* Headset attach */
96#define PCAP_IRQ_ST 13
97#define PCAP_IRQ_PC 14 /* Power Cut */
98#define PCAP_IRQ_WARM 15
99#define PCAP_IRQ_EOL 16 /* Battery End Of Life */
100#define PCAP_IRQ_CLK 17
101#define PCAP_IRQ_SYSRST 18 /* System Reset */
102#define PCAP_IRQ_DUMMY 19
103#define PCAP_IRQ_ADCDONE2 20 /* ADC done port 2 */
104#define PCAP_IRQ_SOFTRESET 21
105#define PCAP_IRQ_MNEXB 22
106
107/* voltage regulators */
108#define V1 0
109#define V2 1
110#define V3 2
111#define V4 3
112#define V5 4
113#define V6 5
114#define V7 6
115#define V8 7
116#define V9 8
117#define V10 9
118#define VAUX1 10
119#define VAUX2 11
120#define VAUX3 12
121#define VAUX4 13
122#define VSIM 14
123#define VSIM2 15
124#define VVIB 16
125#define SW1 17
126#define SW2 18
127#define SW3 19
128#define SW1S 20
129#define SW2S 21
130
131#define PCAP_BATT_DAC_MASK 0x000000ff
132#define PCAP_BATT_DAC_SHIFT 0
133#define PCAP_BATT_B_FDBK (1 << 8)
134#define PCAP_BATT_EXT_ISENSE (1 << 9)
135#define PCAP_BATT_V_COIN_MASK 0x00003c00
136#define PCAP_BATT_V_COIN_SHIFT 10
137#define PCAP_BATT_I_COIN (1 << 14)
138#define PCAP_BATT_COIN_CH_EN (1 << 15)
139#define PCAP_BATT_EOL_SEL_MASK 0x000e0000
140#define PCAP_BATT_EOL_SEL_SHIFT 17
141#define PCAP_BATT_EOL_CMP_EN (1 << 20)
142#define PCAP_BATT_BATT_DET_EN (1 << 21)
143#define PCAP_BATT_THERMBIAS_CTRL (1 << 22)
144
145#define PCAP_ADC_ADEN (1 << 0)
146#define PCAP_ADC_RAND (1 << 1)
147#define PCAP_ADC_AD_SEL1 (1 << 2)
148#define PCAP_ADC_AD_SEL2 (1 << 3)
149#define PCAP_ADC_ADA1_MASK 0x00000070
150#define PCAP_ADC_ADA1_SHIFT 4
151#define PCAP_ADC_ADA2_MASK 0x00000380
152#define PCAP_ADC_ADA2_SHIFT 7
153#define PCAP_ADC_ATO_MASK 0x00003c00
154#define PCAP_ADC_ATO_SHIFT 10
155#define PCAP_ADC_ATOX (1 << 14)
156#define PCAP_ADC_MTR1 (1 << 15)
157#define PCAP_ADC_MTR2 (1 << 16)
158#define PCAP_ADC_TS_M_MASK 0x000e0000
159#define PCAP_ADC_TS_M_SHIFT 17
160#define PCAP_ADC_TS_REF_LOWPWR (1 << 20)
161#define PCAP_ADC_TS_REFENB (1 << 21)
162#define PCAP_ADC_BATT_I_POLARITY (1 << 22)
163#define PCAP_ADC_BATT_I_ADC (1 << 23)
164
165#define PCAP_ADC_BANK_0 0
166#define PCAP_ADC_BANK_1 1
167/* ADC bank 0 */
168#define PCAP_ADC_CH_COIN 0
169#define PCAP_ADC_CH_BATT 1
170#define PCAP_ADC_CH_BPLUS 2
171#define PCAP_ADC_CH_MOBPORTB 3
172#define PCAP_ADC_CH_TEMPERATURE 4
173#define PCAP_ADC_CH_CHARGER_ID 5
174#define PCAP_ADC_CH_AD6 6
175/* ADC bank 1 */
176#define PCAP_ADC_CH_AD7 0
177#define PCAP_ADC_CH_AD8 1
178#define PCAP_ADC_CH_AD9 2
179#define PCAP_ADC_CH_TS_X1 3
180#define PCAP_ADC_CH_TS_X2 4
181#define PCAP_ADC_CH_TS_Y1 5
182#define PCAP_ADC_CH_TS_Y2 6
183
184#define PCAP_ADC_T_NOW 0
185#define PCAP_ADC_T_IN_BURST 1
186#define PCAP_ADC_T_OUT_BURST 2
187
188#define PCAP_ADC_ATO_IN_BURST 6
189#define PCAP_ADC_ATO_OUT_BURST 0
190
191#define PCAP_ADC_TS_M_XY 1
192#define PCAP_ADC_TS_M_PRESSURE 2
193#define PCAP_ADC_TS_M_PLATE_X 3
194#define PCAP_ADC_TS_M_PLATE_Y 4
195#define PCAP_ADC_TS_M_STANDBY 5
196#define PCAP_ADC_TS_M_NONTS 6
197
198#define PCAP_ADR_ADD1_MASK 0x000003ff
199#define PCAP_ADR_ADD1_SHIFT 0
200#define PCAP_ADR_ADD2_MASK 0x000ffc00
201#define PCAP_ADR_ADD2_SHIFT 10
202#define PCAP_ADR_ADINC1 (1 << 20)
203#define PCAP_ADR_ADINC2 (1 << 21)
204#define PCAP_ADR_ASC (1 << 22)
205#define PCAP_ADR_ONESHOT (1 << 23)
206
207#define PCAP_BUSCTRL_FSENB (1 << 0)
208#define PCAP_BUSCTRL_USB_SUSPEND (1 << 1)
209#define PCAP_BUSCTRL_USB_PU (1 << 2)
210#define PCAP_BUSCTRL_USB_PD (1 << 3)
211#define PCAP_BUSCTRL_VUSB_EN (1 << 4)
212#define PCAP_BUSCTRL_USB_PS (1 << 5)
213#define PCAP_BUSCTRL_VUSB_MSTR_EN (1 << 6)
214#define PCAP_BUSCTRL_VBUS_PD_ENB (1 << 7)
215#define PCAP_BUSCTRL_CURRLIM (1 << 8)
216#define PCAP_BUSCTRL_RS232ENB (1 << 9)
217#define PCAP_BUSCTRL_RS232_DIR (1 << 10)
218#define PCAP_BUSCTRL_SE0_CONN (1 << 11)
219#define PCAP_BUSCTRL_USB_PDM (1 << 12)
220#define PCAP_BUSCTRL_BUS_PRI_ADJ (1 << 24)
221
222/* leds */
223#define PCAP_LED0 0
224#define PCAP_LED1 1
225#define PCAP_BL0 2
226#define PCAP_BL1 3
227#define PCAP_VIB 4
228#define PCAP_LED_3MA 0
229#define PCAP_LED_4MA 1
230#define PCAP_LED_5MA 2
231#define PCAP_LED_9MA 3
232#define PCAP_LED_GPIO_VAL_MASK 0x00ffffff
233#define PCAP_LED_GPIO_EN 0x01000000
234#define PCAP_LED_GPIO_INVERT 0x02000000
235#define PCAP_LED_T_MASK 0xf
236#define PCAP_LED_C_MASK 0x3
237#define PCAP_BL_MASK 0x1f
238#define PCAP_BL0_SHIFT 0
239#define PCAP_LED0_EN (1 << 5)
240#define PCAP_LED1_EN (1 << 6)
241#define PCAP_LED0_T_SHIFT 7
242#define PCAP_LED1_T_SHIFT 11
243#define PCAP_LED0_C_SHIFT 15
244#define PCAP_LED1_C_SHIFT 17
245#define PCAP_BL1_SHIFT 20
246#define PCAP_VIB_MASK 0x3
247#define PCAP_VIB_SHIFT 20
248#define PCAP_VIB_EN (1 << 19)
249
250/* RTC */
251#define PCAP_RTC_DAY_MASK 0x3fff
252#define PCAP_RTC_TOD_MASK 0xffff
253#define PCAP_RTC_PC_MASK 0x7
254#define SEC_PER_DAY 86400
255
256#endif
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 516d955ab8a1..6b9c5d06690c 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -19,6 +19,13 @@
19 } while (0) 19 } while (0)
20 20
21/* 21/*
22 * data for the MMC controller
23 */
24struct tmio_mmc_data {
25 const unsigned int hclk;
26};
27
28/*
22 * data for the NAND controller 29 * data for the NAND controller
23 */ 30 */
24struct tmio_nand_data { 31struct tmio_nand_data {
diff --git a/include/linux/mg_disk.h b/include/linux/mg_disk.h
index 1f76b1ebf627..e11f4d9f1c2e 100644
--- a/include/linux/mg_disk.h
+++ b/include/linux/mg_disk.h
@@ -1,8 +1,7 @@
1/* 1/*
2 * include/linux/mg_disk.c 2 * include/linux/mg_disk.c
3 * 3 *
4 * Support for the mGine m[g]flash IO mode. 4 * Private data for mflash platform driver
5 * Based on legacy hd.c
6 * 5 *
7 * (c) 2008 mGine Co.,LTD 6 * (c) 2008 mGine Co.,LTD
8 * (c) 2008 unsik Kim <donari75@gmail.com> 7 * (c) 2008 unsik Kim <donari75@gmail.com>
@@ -15,127 +14,13 @@
15#ifndef __MG_DISK_H__ 14#ifndef __MG_DISK_H__
16#define __MG_DISK_H__ 15#define __MG_DISK_H__
17 16
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 */ 17/* name for platform device */
24#define MG_DEV_NAME "mg_disk" 18#define MG_DEV_NAME "mg_disk"
25 19
26#define MG_DISK_MAJ 0 20/* names of GPIO resource */
27#define MG_DISK_MAX_PART 16 21#define MG_RST_PIN "mg_rst"
28#define MG_SECTOR_SIZE 512 22/* except MG_BOOT_DEV, reset-out pin should be assigned */
29#define MG_MAX_SECTS 256 23#define MG_RSTOUT_PIN "mg_rstout"
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 24
140/* device attribution */ 25/* device attribution */
141/* use mflash as boot device */ 26/* use mflash as boot device */
@@ -145,13 +30,6 @@
145/* same as MG_STORAGE_DEV, but bootloader already done reset sequence */ 30/* same as MG_STORAGE_DEV, but bootloader already done reset sequence */
146#define MG_STORAGE_DEV_SKIP_RST (1 << 2) 31#define MG_STORAGE_DEV_SKIP_RST (1 << 2)
147 32
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 */ 33/* private driver data */
156struct mg_drv_data { 34struct mg_drv_data {
157 /* disk resource */ 35 /* disk resource */
@@ -161,46 +39,7 @@ struct mg_drv_data {
161 u32 dev_attr; 39 u32 dev_attr;
162 40
163 /* internally used */ 41 /* internally used */
164 struct mg_host *host; 42 void *host;
165}; 43};
166 44
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 45#endif
diff --git a/include/linux/mii.h b/include/linux/mii.h
index ad748588faf1..359fba880274 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -240,6 +240,22 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock,
240} 240}
241 241
242/** 242/**
243 * mii_advertise_flowctrl - get flow control advertisement flags
244 * @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both)
245 */
246static inline u16 mii_advertise_flowctrl(int cap)
247{
248 u16 adv = 0;
249
250 if (cap & FLOW_CTRL_RX)
251 adv = ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
252 if (cap & FLOW_CTRL_TX)
253 adv ^= ADVERTISE_PAUSE_ASYM;
254
255 return adv;
256}
257
258/**
243 * mii_resolve_flowctrl_fdx 259 * mii_resolve_flowctrl_fdx
244 * @lcladv: value of MII ADVERTISE register 260 * @lcladv: value of MII ADVERTISE register
245 * @rmtadv: value of MII LPA register 261 * @rmtadv: value of MII LPA register
@@ -250,18 +266,12 @@ static inline u8 mii_resolve_flowctrl_fdx(u16 lcladv, u16 rmtadv)
250{ 266{
251 u8 cap = 0; 267 u8 cap = 0;
252 268
253 if (lcladv & ADVERTISE_PAUSE_CAP) { 269 if (lcladv & rmtadv & ADVERTISE_PAUSE_CAP) {
254 if (lcladv & ADVERTISE_PAUSE_ASYM) { 270 cap = FLOW_CTRL_TX | FLOW_CTRL_RX;
255 if (rmtadv & LPA_PAUSE_CAP) 271 } else if (lcladv & rmtadv & ADVERTISE_PAUSE_ASYM) {
256 cap = FLOW_CTRL_TX | FLOW_CTRL_RX; 272 if (lcladv & ADVERTISE_PAUSE_CAP)
257 else if (rmtadv & LPA_PAUSE_ASYM) 273 cap = FLOW_CTRL_RX;
258 cap = FLOW_CTRL_RX; 274 else if (rmtadv & ADVERTISE_PAUSE_CAP)
259 } else {
260 if (rmtadv & LPA_PAUSE_CAP)
261 cap = FLOW_CTRL_TX | FLOW_CTRL_RX;
262 }
263 } else if (lcladv & ADVERTISE_PAUSE_ASYM) {
264 if ((rmtadv & LPA_PAUSE_CAP) && (rmtadv & LPA_PAUSE_ASYM))
265 cap = FLOW_CTRL_TX; 275 cap = FLOW_CTRL_TX;
266 } 276 }
267 277
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index beb6ec99cfef..052117744629 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -41,6 +41,7 @@ struct miscdevice {
41 struct list_head list; 41 struct list_head list;
42 struct device *parent; 42 struct device *parent;
43 struct device *this_device; 43 struct device *this_device;
44 const char *devnode;
44}; 45};
45 46
46extern int misc_register(struct miscdevice * misc); 47extern int misc_register(struct miscdevice * misc);
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 3aff8a6a389e..ce7cc6c7bcbb 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -210,6 +210,7 @@ struct mlx4_caps {
210 int num_comp_vectors; 210 int num_comp_vectors;
211 int num_mpts; 211 int num_mpts;
212 int num_mtt_segs; 212 int num_mtt_segs;
213 int mtts_per_seg;
213 int fmr_reserved_mtts; 214 int fmr_reserved_mtts;
214 int reserved_mtts; 215 int reserved_mtts;
215 int reserved_mrws; 216 int reserved_mrws;
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index bf8f11982dae..9f29d86e5dc9 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -165,6 +165,7 @@ enum {
165 MLX4_WQE_CTRL_IP_CSUM = 1 << 4, 165 MLX4_WQE_CTRL_IP_CSUM = 1 << 4,
166 MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5, 166 MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5,
167 MLX4_WQE_CTRL_INS_VLAN = 1 << 6, 167 MLX4_WQE_CTRL_INS_VLAN = 1 << 6,
168 MLX4_WQE_CTRL_STRONG_ORDER = 1 << 7,
168}; 169};
169 170
170struct mlx4_wqe_ctrl_seg { 171struct mlx4_wqe_ctrl_seg {
diff --git a/include/linux/mm.h b/include/linux/mm.h
index bff1f0d475c7..d006e93d5c93 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -7,7 +7,6 @@
7 7
8#include <linux/gfp.h> 8#include <linux/gfp.h>
9#include <linux/list.h> 9#include <linux/list.h>
10#include <linux/mmdebug.h>
11#include <linux/mmzone.h> 10#include <linux/mmzone.h>
12#include <linux/rbtree.h> 11#include <linux/rbtree.h>
13#include <linux/prio_tree.h> 12#include <linux/prio_tree.h>
@@ -19,6 +18,7 @@ struct anon_vma;
19struct file_ra_state; 18struct file_ra_state;
20struct user_struct; 19struct user_struct;
21struct writeback_control; 20struct writeback_control;
21struct rlimit;
22 22
23#ifndef CONFIG_DISCONTIGMEM /* Don't use mapnrs, do it properly */ 23#ifndef CONFIG_DISCONTIGMEM /* Don't use mapnrs, do it properly */
24extern unsigned long max_mapnr; 24extern unsigned long max_mapnr;
@@ -580,12 +580,10 @@ static inline void set_page_links(struct page *page, enum zone_type zone,
580 */ 580 */
581static inline unsigned long round_hint_to_min(unsigned long hint) 581static inline unsigned long round_hint_to_min(unsigned long hint)
582{ 582{
583#ifdef CONFIG_SECURITY
584 hint &= PAGE_MASK; 583 hint &= PAGE_MASK;
585 if (((void *)hint != NULL) && 584 if (((void *)hint != NULL) &&
586 (hint < mmap_min_addr)) 585 (hint < mmap_min_addr))
587 return PAGE_ALIGN(mmap_min_addr); 586 return PAGE_ALIGN(mmap_min_addr);
588#endif
589 return hint; 587 return hint;
590} 588}
591 589
@@ -726,7 +724,7 @@ static inline int shmem_lock(struct file *file, int lock,
726 return 0; 724 return 0;
727} 725}
728#endif 726#endif
729struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags); 727struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags);
730 728
731int shmem_zero_setup(struct vm_area_struct *); 729int shmem_zero_setup(struct vm_area_struct *);
732 730
@@ -794,6 +792,8 @@ int copy_page_range(struct mm_struct *dst, struct mm_struct *src,
794 struct vm_area_struct *vma); 792 struct vm_area_struct *vma);
795void unmap_mapping_range(struct address_space *mapping, 793void unmap_mapping_range(struct address_space *mapping,
796 loff_t const holebegin, loff_t const holelen, int even_cows); 794 loff_t const holebegin, loff_t const holelen, int even_cows);
795int follow_pfn(struct vm_area_struct *vma, unsigned long address,
796 unsigned long *pfn);
797int follow_phys(struct vm_area_struct *vma, unsigned long address, 797int follow_phys(struct vm_area_struct *vma, unsigned long address,
798 unsigned int flags, unsigned long *prot, resource_size_t *phys); 798 unsigned int flags, unsigned long *prot, resource_size_t *phys);
799int generic_access_phys(struct vm_area_struct *vma, unsigned long addr, 799int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
@@ -810,11 +810,11 @@ extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end);
810 810
811#ifdef CONFIG_MMU 811#ifdef CONFIG_MMU
812extern int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, 812extern int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma,
813 unsigned long address, int write_access); 813 unsigned long address, unsigned int flags);
814#else 814#else
815static inline int handle_mm_fault(struct mm_struct *mm, 815static inline int handle_mm_fault(struct mm_struct *mm,
816 struct vm_area_struct *vma, unsigned long address, 816 struct vm_area_struct *vma, unsigned long address,
817 int write_access) 817 unsigned int flags)
818{ 818{
819 /* should never happen if there's no MMU */ 819 /* should never happen if there's no MMU */
820 BUG(); 820 BUG();
@@ -825,8 +825,11 @@ static inline int handle_mm_fault(struct mm_struct *mm,
825extern int make_pages_present(unsigned long addr, unsigned long end); 825extern int make_pages_present(unsigned long addr, unsigned long end);
826extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write); 826extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write);
827 827
828int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, 828int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
829 int len, int write, int force, struct page **pages, struct vm_area_struct **vmas); 829 unsigned long start, int len, int write, int force,
830 struct page **pages, struct vm_area_struct **vmas);
831int get_user_pages_fast(unsigned long start, int nr_pages, int write,
832 struct page **pages);
830 833
831extern int try_to_release_page(struct page * page, gfp_t gfp_mask); 834extern int try_to_release_page(struct page * page, gfp_t gfp_mask);
832extern void do_invalidatepage(struct page *page, unsigned long offset); 835extern void do_invalidatepage(struct page *page, unsigned long offset);
@@ -851,17 +854,10 @@ extern int mprotect_fixup(struct vm_area_struct *vma,
851 unsigned long end, unsigned long newflags); 854 unsigned long end, unsigned long newflags);
852 855
853/* 856/*
854 * get_user_pages_fast provides equivalent functionality to get_user_pages, 857 * doesn't attempt to fault and will return short.
855 * operating on current and current->mm (force=0 and doesn't return any vmas).
856 *
857 * get_user_pages_fast may take mmap_sem and page tables, so no assumptions
858 * can be made about locking. get_user_pages_fast is to be implemented in a
859 * way that is advantageous (vs get_user_pages()) when the user memory area is
860 * already faulted in and present in ptes. However if the pages have to be
861 * faulted in, it may turn out to be slightly slower).
862 */ 858 */
863int get_user_pages_fast(unsigned long start, int nr_pages, int write, 859int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
864 struct page **pages); 860 struct page **pages);
865 861
866/* 862/*
867 * A callback you can register to apply pressure to ageable caches. 863 * A callback you can register to apply pressure to ageable caches.
@@ -1031,8 +1027,6 @@ extern void add_active_range(unsigned int nid, unsigned long start_pfn,
1031 unsigned long end_pfn); 1027 unsigned long end_pfn);
1032extern void remove_active_range(unsigned int nid, unsigned long start_pfn, 1028extern void remove_active_range(unsigned int nid, unsigned long start_pfn,
1033 unsigned long end_pfn); 1029 unsigned long end_pfn);
1034extern void push_node_boundaries(unsigned int nid, unsigned long start_pfn,
1035 unsigned long end_pfn);
1036extern void remove_all_active_ranges(void); 1030extern void remove_all_active_ranges(void);
1037extern unsigned long absent_pages_in_range(unsigned long start_pfn, 1031extern unsigned long absent_pages_in_range(unsigned long start_pfn,
1038 unsigned long end_pfn); 1032 unsigned long end_pfn);
@@ -1064,7 +1058,8 @@ extern int __meminit __early_pfn_to_nid(unsigned long pfn);
1064extern void set_dma_reserve(unsigned long new_dma_reserve); 1058extern void set_dma_reserve(unsigned long new_dma_reserve);
1065extern void memmap_init_zone(unsigned long, int, unsigned long, 1059extern void memmap_init_zone(unsigned long, int, unsigned long,
1066 unsigned long, enum memmap_context); 1060 unsigned long, enum memmap_context);
1067extern void setup_per_zone_pages_min(void); 1061extern void setup_per_zone_wmarks(void);
1062extern void calculate_zone_inactive_ratio(struct zone *zone);
1068extern void mem_init(void); 1063extern void mem_init(void);
1069extern void __init mmap_init(void); 1064extern void __init mmap_init(void);
1070extern void show_mem(void); 1065extern void show_mem(void);
@@ -1181,8 +1176,6 @@ void task_dirty_inc(struct task_struct *tsk);
1181#define VM_MAX_READAHEAD 128 /* kbytes */ 1176#define VM_MAX_READAHEAD 128 /* kbytes */
1182#define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */ 1177#define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */
1183 1178
1184int do_page_cache_readahead(struct address_space *mapping, struct file *filp,
1185 pgoff_t offset, unsigned long nr_to_read);
1186int force_page_cache_readahead(struct address_space *mapping, struct file *filp, 1179int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
1187 pgoff_t offset, unsigned long nr_to_read); 1180 pgoff_t offset, unsigned long nr_to_read);
1188 1181
@@ -1200,6 +1193,9 @@ void page_cache_async_readahead(struct address_space *mapping,
1200 unsigned long size); 1193 unsigned long size);
1201 1194
1202unsigned long max_sane_readahead(unsigned long nr); 1195unsigned long max_sane_readahead(unsigned long nr);
1196unsigned long ra_submit(struct file_ra_state *ra,
1197 struct address_space *mapping,
1198 struct file *filp);
1203 1199
1204/* Do stack extension */ 1200/* Do stack extension */
1205extern int expand_stack(struct vm_area_struct *vma, unsigned long address); 1201extern int expand_stack(struct vm_area_struct *vma, unsigned long address);
@@ -1319,8 +1315,8 @@ int vmemmap_populate_basepages(struct page *start_page,
1319int vmemmap_populate(struct page *start_page, unsigned long pages, int node); 1315int vmemmap_populate(struct page *start_page, unsigned long pages, int node);
1320void vmemmap_populate_print_last(void); 1316void vmemmap_populate_print_last(void);
1321 1317
1322extern void *alloc_locked_buffer(size_t size); 1318extern int account_locked_memory(struct mm_struct *mm, struct rlimit *rlim,
1323extern void free_locked_buffer(void *buffer, size_t size); 1319 size_t size);
1324extern void release_locked_buffer(void *buffer, size_t size); 1320extern void refund_locked_memory(struct mm_struct *mm, size_t size);
1325#endif /* __KERNEL__ */ 1321#endif /* __KERNEL__ */
1326#endif /* _LINUX_MM_H */ 1322#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 0e80e26ecf21..7acc8439d9b3 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -98,6 +98,14 @@ struct page {
98#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS 98#ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS
99 unsigned long debug_flags; /* Use atomic bitops on this */ 99 unsigned long debug_flags; /* Use atomic bitops on this */
100#endif 100#endif
101
102#ifdef CONFIG_KMEMCHECK
103 /*
104 * kmemcheck wants to track the status of each byte in a page; this
105 * is a pointer to such a status block. NULL if not tracked.
106 */
107 void *shadow;
108#endif
101}; 109};
102 110
103/* 111/*
@@ -232,6 +240,8 @@ struct mm_struct {
232 240
233 unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ 241 unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */
234 242
243 s8 oom_adj; /* OOM kill score adjustment (bit shift) */
244
235 cpumask_t cpu_vm_mask; 245 cpumask_t cpu_vm_mask;
236 246
237 /* Architecture-specific MM context */ 247 /* Architecture-specific MM context */
diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
index ea1bf5ba092f..39751c8cde9c 100644
--- a/include/linux/mmc/sdio_ids.h
+++ b/include/linux/mmc/sdio_ids.h
@@ -25,5 +25,15 @@
25 25
26#define SDIO_VENDOR_ID_MARVELL 0x02df 26#define SDIO_VENDOR_ID_MARVELL 0x02df
27#define SDIO_DEVICE_ID_MARVELL_LIBERTAS 0x9103 27#define SDIO_DEVICE_ID_MARVELL_LIBERTAS 0x9103
28#define SDIO_DEVICE_ID_MARVELL_8688WLAN 0x9104
29#define SDIO_DEVICE_ID_MARVELL_8688BT 0x9105
30
31#define SDIO_VENDOR_ID_SIANO 0x039a
32#define SDIO_DEVICE_ID_SIANO_NOVA_B0 0x0201
33#define SDIO_DEVICE_ID_SIANO_NICE 0x0202
34#define SDIO_DEVICE_ID_SIANO_VEGA_A0 0x0300
35#define SDIO_DEVICE_ID_SIANO_VENICE 0x0301
36#define SDIO_DEVICE_ID_SIANO_NOVA_A0 0x1100
37#define SDIO_DEVICE_ID_SIANO_STELLAR 0x5347
28 38
29#endif 39#endif
diff --git a/include/linux/mmiotrace.h b/include/linux/mmiotrace.h
index 3d1b7bde1283..97491f78b08c 100644
--- a/include/linux/mmiotrace.h
+++ b/include/linux/mmiotrace.h
@@ -30,6 +30,8 @@ extern unsigned int kmmio_count;
30 30
31extern int register_kmmio_probe(struct kmmio_probe *p); 31extern int register_kmmio_probe(struct kmmio_probe *p);
32extern void unregister_kmmio_probe(struct kmmio_probe *p); 32extern void unregister_kmmio_probe(struct kmmio_probe *p);
33extern int kmmio_init(void);
34extern void kmmio_cleanup(void);
33 35
34#ifdef CONFIG_MMIOTRACE 36#ifdef CONFIG_MMIOTRACE
35/* kmmio is active by some kmmio_probes? */ 37/* kmmio is active by some kmmio_probes? */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index a47c879e1304..889598537370 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -50,9 +50,6 @@ extern int page_group_by_mobility_disabled;
50 50
51static inline int get_pageblock_migratetype(struct page *page) 51static inline int get_pageblock_migratetype(struct page *page)
52{ 52{
53 if (unlikely(page_group_by_mobility_disabled))
54 return MIGRATE_UNMOVABLE;
55
56 return get_pageblock_flags_group(page, PB_migrate, PB_migrate_end); 53 return get_pageblock_flags_group(page, PB_migrate, PB_migrate_end);
57} 54}
58 55
@@ -86,13 +83,8 @@ enum zone_stat_item {
86 NR_ACTIVE_ANON, /* " " " " " */ 83 NR_ACTIVE_ANON, /* " " " " " */
87 NR_INACTIVE_FILE, /* " " " " " */ 84 NR_INACTIVE_FILE, /* " " " " " */
88 NR_ACTIVE_FILE, /* " " " " " */ 85 NR_ACTIVE_FILE, /* " " " " " */
89#ifdef CONFIG_UNEVICTABLE_LRU
90 NR_UNEVICTABLE, /* " " " " " */ 86 NR_UNEVICTABLE, /* " " " " " */
91 NR_MLOCK, /* mlock()ed pages found and moved off LRU */ 87 NR_MLOCK, /* mlock()ed pages found and moved off LRU */
92#else
93 NR_UNEVICTABLE = NR_ACTIVE_FILE, /* avoid compiler errors in dead code */
94 NR_MLOCK = NR_ACTIVE_FILE,
95#endif
96 NR_ANON_PAGES, /* Mapped anonymous pages */ 88 NR_ANON_PAGES, /* Mapped anonymous pages */
97 NR_FILE_MAPPED, /* pagecache pages mapped into pagetables. 89 NR_FILE_MAPPED, /* pagecache pages mapped into pagetables.
98 only modified from process context */ 90 only modified from process context */
@@ -135,11 +127,7 @@ enum lru_list {
135 LRU_ACTIVE_ANON = LRU_BASE + LRU_ACTIVE, 127 LRU_ACTIVE_ANON = LRU_BASE + LRU_ACTIVE,
136 LRU_INACTIVE_FILE = LRU_BASE + LRU_FILE, 128 LRU_INACTIVE_FILE = LRU_BASE + LRU_FILE,
137 LRU_ACTIVE_FILE = LRU_BASE + LRU_FILE + LRU_ACTIVE, 129 LRU_ACTIVE_FILE = LRU_BASE + LRU_FILE + LRU_ACTIVE,
138#ifdef CONFIG_UNEVICTABLE_LRU
139 LRU_UNEVICTABLE, 130 LRU_UNEVICTABLE,
140#else
141 LRU_UNEVICTABLE = LRU_ACTIVE_FILE, /* avoid compiler errors in dead code */
142#endif
143 NR_LRU_LISTS 131 NR_LRU_LISTS
144}; 132};
145 133
@@ -159,13 +147,20 @@ static inline int is_active_lru(enum lru_list l)
159 147
160static inline int is_unevictable_lru(enum lru_list l) 148static inline int is_unevictable_lru(enum lru_list l)
161{ 149{
162#ifdef CONFIG_UNEVICTABLE_LRU
163 return (l == LRU_UNEVICTABLE); 150 return (l == LRU_UNEVICTABLE);
164#else
165 return 0;
166#endif
167} 151}
168 152
153enum zone_watermarks {
154 WMARK_MIN,
155 WMARK_LOW,
156 WMARK_HIGH,
157 NR_WMARK
158};
159
160#define min_wmark_pages(z) (z->watermark[WMARK_MIN])
161#define low_wmark_pages(z) (z->watermark[WMARK_LOW])
162#define high_wmark_pages(z) (z->watermark[WMARK_HIGH])
163
169struct per_cpu_pages { 164struct per_cpu_pages {
170 int count; /* number of pages in the list */ 165 int count; /* number of pages in the list */
171 int high; /* high watermark, emptying needed */ 166 int high; /* high watermark, emptying needed */
@@ -278,7 +273,10 @@ struct zone_reclaim_stat {
278 273
279struct zone { 274struct zone {
280 /* Fields commonly accessed by the page allocator */ 275 /* Fields commonly accessed by the page allocator */
281 unsigned long pages_min, pages_low, pages_high; 276
277 /* zone watermarks, access with *_wmark_pages(zone) macros */
278 unsigned long watermark[NR_WMARK];
279
282 /* 280 /*
283 * We don't know if the memory that we're going to allocate will be freeable 281 * We don't know if the memory that we're going to allocate will be freeable
284 * or/and it will be released eventually, so to avoid totally wasting several 282 * or/and it will be released eventually, so to avoid totally wasting several
@@ -323,9 +321,9 @@ struct zone {
323 321
324 /* Fields commonly accessed by the page reclaim scanner */ 322 /* Fields commonly accessed by the page reclaim scanner */
325 spinlock_t lru_lock; 323 spinlock_t lru_lock;
326 struct { 324 struct zone_lru {
327 struct list_head list; 325 struct list_head list;
328 unsigned long nr_scan; 326 unsigned long nr_saved_scan; /* accumulated for batching */
329 } lru[NR_LRU_LISTS]; 327 } lru[NR_LRU_LISTS];
330 328
331 struct zone_reclaim_stat reclaim_stat; 329 struct zone_reclaim_stat reclaim_stat;
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h
index 3a059298cc19..3beb2592b03f 100644
--- a/include/linux/mnt_namespace.h
+++ b/include/linux/mnt_namespace.h
@@ -24,16 +24,10 @@ struct proc_mounts {
24 24
25struct fs_struct; 25struct fs_struct;
26 26
27extern struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt);
27extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, 28extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *,
28 struct fs_struct *); 29 struct fs_struct *);
29extern void __put_mnt_ns(struct mnt_namespace *ns); 30extern void put_mnt_ns(struct mnt_namespace *ns);
30
31static inline void put_mnt_ns(struct mnt_namespace *ns)
32{
33 if (atomic_dec_and_lock(&ns->count, &vfsmount_lock))
34 /* releases vfsmount_lock */
35 __put_mnt_ns(ns);
36}
37 31
38static inline void exit_mnt_ns(struct task_struct *p) 32static inline void exit_mnt_ns(struct task_struct *p)
39{ 33{
diff --git a/include/linux/module.h b/include/linux/module.h
index 627ac082e2a6..098bdb7bfacf 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -77,6 +77,7 @@ search_extable(const struct exception_table_entry *first,
77void sort_extable(struct exception_table_entry *start, 77void sort_extable(struct exception_table_entry *start,
78 struct exception_table_entry *finish); 78 struct exception_table_entry *finish);
79void sort_main_extable(void); 79void sort_main_extable(void);
80void trim_init_extable(struct module *m);
80 81
81#ifdef MODULE 82#ifdef MODULE
82#define MODULE_GENERIC_TABLE(gtype,name) \ 83#define MODULE_GENERIC_TABLE(gtype,name) \
@@ -337,6 +338,14 @@ struct module
337 const char **trace_bprintk_fmt_start; 338 const char **trace_bprintk_fmt_start;
338 unsigned int num_trace_bprintk_fmt; 339 unsigned int num_trace_bprintk_fmt;
339#endif 340#endif
341#ifdef CONFIG_EVENT_TRACING
342 struct ftrace_event_call *trace_events;
343 unsigned int num_trace_events;
344#endif
345#ifdef CONFIG_FTRACE_MCOUNT_RECORD
346 unsigned long *ftrace_callsites;
347 unsigned int num_ftrace_callsites;
348#endif
340 349
341#ifdef CONFIG_MODULE_UNLOAD 350#ifdef CONFIG_MODULE_UNLOAD
342 /* What modules depend on me? */ 351 /* What modules depend on me? */
@@ -354,6 +363,12 @@ struct module
354 local_t ref; 363 local_t ref;
355#endif 364#endif
356#endif 365#endif
366
367#ifdef CONFIG_CONSTRUCTORS
368 /* Constructor functions. */
369 ctor_fn_t *ctors;
370 unsigned int num_ctors;
371#endif
357}; 372};
358#ifndef MODULE_ARCH_INIT 373#ifndef MODULE_ARCH_INIT
359#define MODULE_ARCH_INIT {} 374#define MODULE_ARCH_INIT {}
@@ -688,4 +703,21 @@ static inline void module_remove_modinfo_attrs(struct module *mod)
688 703
689#define __MODULE_STRING(x) __stringify(x) 704#define __MODULE_STRING(x) __stringify(x)
690 705
706
707#ifdef CONFIG_GENERIC_BUG
708int module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *,
709 struct module *);
710void module_bug_cleanup(struct module *);
711
712#else /* !CONFIG_GENERIC_BUG */
713
714static inline int module_bug_finalize(const Elf_Ehdr *hdr,
715 const Elf_Shdr *sechdrs,
716 struct module *mod)
717{
718 return 0;
719}
720static inline void module_bug_cleanup(struct module *mod) {}
721#endif /* CONFIG_GENERIC_BUG */
722
691#endif /* _LINUX_MODULE_H */ 723#endif /* _LINUX_MODULE_H */
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index a4f0b931846c..6547c3cdbc4c 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -36,9 +36,14 @@ typedef int (*param_set_fn)(const char *val, struct kernel_param *kp);
36/* Returns length written or -errno. Buffer is 4k (ie. be short!) */ 36/* Returns length written or -errno. Buffer is 4k (ie. be short!) */
37typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp); 37typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp);
38 38
39/* Flag bits for kernel_param.flags */
40#define KPARAM_KMALLOCED 1
41#define KPARAM_ISBOOL 2
42
39struct kernel_param { 43struct kernel_param {
40 const char *name; 44 const char *name;
41 unsigned int perm; 45 u16 perm;
46 u16 flags;
42 param_set_fn set; 47 param_set_fn set;
43 param_get_fn get; 48 param_get_fn get;
44 union { 49 union {
@@ -79,7 +84,7 @@ struct kparam_array
79 parameters. perm sets the visibility in sysfs: 000 means it's 84 parameters. perm sets the visibility in sysfs: 000 means it's
80 not there, read bits mean it's readable, write bits mean it's 85 not there, read bits mean it's readable, write bits mean it's
81 writable. */ 86 writable. */
82#define __module_param_call(prefix, name, set, get, arg, perm) \ 87#define __module_param_call(prefix, name, set, get, arg, isbool, perm) \
83 /* Default value instead of permissions? */ \ 88 /* Default value instead of permissions? */ \
84 static int __param_perm_check_##name __attribute__((unused)) = \ 89 static int __param_perm_check_##name __attribute__((unused)) = \
85 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ 90 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \
@@ -88,10 +93,13 @@ struct kparam_array
88 static struct kernel_param __moduleparam_const __param_##name \ 93 static struct kernel_param __moduleparam_const __param_##name \
89 __used \ 94 __used \
90 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ 95 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
91 = { __param_str_##name, perm, set, get, { arg } } 96 = { __param_str_##name, perm, isbool ? KPARAM_ISBOOL : 0, \
97 set, get, { arg } }
92 98
93#define module_param_call(name, set, get, arg, perm) \ 99#define module_param_call(name, set, get, arg, perm) \
94 __module_param_call(MODULE_PARAM_PREFIX, name, set, get, arg, perm) 100 __module_param_call(MODULE_PARAM_PREFIX, \
101 name, set, get, arg, \
102 __same_type(*(arg), bool), perm)
95 103
96/* Helper functions: type is byte, short, ushort, int, uint, long, 104/* Helper functions: type is byte, short, ushort, int, uint, long,
97 ulong, charp, bool or invbool, or XXX if you define param_get_XXX, 105 ulong, charp, bool or invbool, or XXX if you define param_get_XXX,
@@ -120,15 +128,16 @@ struct kparam_array
120#define core_param(name, var, type, perm) \ 128#define core_param(name, var, type, perm) \
121 param_check_##type(name, &(var)); \ 129 param_check_##type(name, &(var)); \
122 __module_param_call("", name, param_set_##type, param_get_##type, \ 130 __module_param_call("", name, param_set_##type, param_get_##type, \
123 &var, perm) 131 &var, __same_type(var, bool), perm)
124#endif /* !MODULE */ 132#endif /* !MODULE */
125 133
126/* Actually copy string: maxlen param is usually sizeof(string). */ 134/* Actually copy string: maxlen param is usually sizeof(string). */
127#define module_param_string(name, string, len, perm) \ 135#define module_param_string(name, string, len, perm) \
128 static const struct kparam_string __param_string_##name \ 136 static const struct kparam_string __param_string_##name \
129 = { len, string }; \ 137 = { len, string }; \
130 module_param_call(name, param_set_copystring, param_get_string, \ 138 __module_param_call(MODULE_PARAM_PREFIX, name, \
131 .str = &__param_string_##name, perm); \ 139 param_set_copystring, param_get_string, \
140 .str = &__param_string_##name, 0, perm); \
132 __MODULE_PARM_TYPE(name, "string") 141 __MODULE_PARM_TYPE(name, "string")
133 142
134/* Called on module insert or kernel boot */ 143/* Called on module insert or kernel boot */
@@ -186,21 +195,30 @@ extern int param_set_charp(const char *val, struct kernel_param *kp);
186extern int param_get_charp(char *buffer, struct kernel_param *kp); 195extern int param_get_charp(char *buffer, struct kernel_param *kp);
187#define param_check_charp(name, p) __param_check(name, p, char *) 196#define param_check_charp(name, p) __param_check(name, p, char *)
188 197
198/* For historical reasons "bool" parameters can be (unsigned) "int". */
189extern int param_set_bool(const char *val, struct kernel_param *kp); 199extern int param_set_bool(const char *val, struct kernel_param *kp);
190extern int param_get_bool(char *buffer, struct kernel_param *kp); 200extern int param_get_bool(char *buffer, struct kernel_param *kp);
191#define param_check_bool(name, p) __param_check(name, p, int) 201#define param_check_bool(name, p) \
202 static inline void __check_##name(void) \
203 { \
204 BUILD_BUG_ON(!__same_type(*(p), bool) && \
205 !__same_type(*(p), unsigned int) && \
206 !__same_type(*(p), int)); \
207 }
192 208
193extern int param_set_invbool(const char *val, struct kernel_param *kp); 209extern int param_set_invbool(const char *val, struct kernel_param *kp);
194extern int param_get_invbool(char *buffer, struct kernel_param *kp); 210extern int param_get_invbool(char *buffer, struct kernel_param *kp);
195#define param_check_invbool(name, p) __param_check(name, p, int) 211#define param_check_invbool(name, p) __param_check(name, p, bool)
196 212
197/* Comma-separated array: *nump is set to number they actually specified. */ 213/* Comma-separated array: *nump is set to number they actually specified. */
198#define module_param_array_named(name, array, type, nump, perm) \ 214#define module_param_array_named(name, array, type, nump, perm) \
199 static const struct kparam_array __param_arr_##name \ 215 static const struct kparam_array __param_arr_##name \
200 = { ARRAY_SIZE(array), nump, param_set_##type, param_get_##type,\ 216 = { ARRAY_SIZE(array), nump, param_set_##type, param_get_##type,\
201 sizeof(array[0]), array }; \ 217 sizeof(array[0]), array }; \
202 module_param_call(name, param_array_set, param_array_get, \ 218 __module_param_call(MODULE_PARAM_PREFIX, name, \
203 .arr = &__param_arr_##name, perm); \ 219 param_array_set, param_array_get, \
220 .arr = &__param_arr_##name, \
221 __same_type(array[0], bool), perm); \
204 __MODULE_PARM_TYPE(name, "array of " #type) 222 __MODULE_PARM_TYPE(name, "array of " #type)
205 223
206#define module_param_array(name, type, nump, perm) \ 224#define module_param_array(name, type, nump, perm) \
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 51f55f903aff..5d5275364867 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -30,7 +30,7 @@ struct mnt_namespace;
30#define MNT_STRICTATIME 0x80 30#define MNT_STRICTATIME 0x80
31 31
32#define MNT_SHRINKABLE 0x100 32#define MNT_SHRINKABLE 0x100
33#define MNT_IMBALANCED_WRITE_COUNT 0x200 /* just for debugging */ 33#define MNT_WRITE_HOLD 0x200
34 34
35#define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */ 35#define MNT_SHARED 0x1000 /* if the vfsmount is a shared mount */
36#define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */ 36#define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */
@@ -65,13 +65,22 @@ struct vfsmount {
65 int mnt_expiry_mark; /* true if marked for expiry */ 65 int mnt_expiry_mark; /* true if marked for expiry */
66 int mnt_pinned; 66 int mnt_pinned;
67 int mnt_ghosts; 67 int mnt_ghosts;
68 /* 68#ifdef CONFIG_SMP
69 * This value is not stable unless all of the mnt_writers[] spinlocks 69 int *mnt_writers;
70 * are held, and all mnt_writer[]s on this mount have 0 as their ->count 70#else
71 */ 71 int mnt_writers;
72 atomic_t __mnt_writers; 72#endif
73}; 73};
74 74
75static inline int *get_mnt_writers_ptr(struct vfsmount *mnt)
76{
77#ifdef CONFIG_SMP
78 return mnt->mnt_writers;
79#else
80 return &mnt->mnt_writers;
81#endif
82}
83
75static inline struct vfsmount *mntget(struct vfsmount *mnt) 84static inline struct vfsmount *mntget(struct vfsmount *mnt)
76{ 85{
77 if (mnt) 86 if (mnt)
@@ -79,7 +88,11 @@ static inline struct vfsmount *mntget(struct vfsmount *mnt)
79 return mnt; 88 return mnt;
80} 89}
81 90
91struct file; /* forward dec */
92
82extern int mnt_want_write(struct vfsmount *mnt); 93extern int mnt_want_write(struct vfsmount *mnt);
94extern int mnt_want_write_file(struct file *file);
95extern int mnt_clone_write(struct vfsmount *mnt);
83extern void mnt_drop_write(struct vfsmount *mnt); 96extern void mnt_drop_write(struct vfsmount *mnt);
84extern void mntput_no_expire(struct vfsmount *mnt); 97extern void mntput_no_expire(struct vfsmount *mnt);
85extern void mnt_pin(struct vfsmount *mnt); 98extern void mnt_pin(struct vfsmount *mnt);
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 7efb9be34662..4030ebada49e 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -563,6 +563,7 @@ extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len,
563 * @options: Option flags, e.g. 16bit buswidth 563 * @options: Option flags, e.g. 16bit buswidth
564 * @ecclayout: ecc layout info structure 564 * @ecclayout: ecc layout info structure
565 * @part_probe_types: NULL-terminated array of probe types 565 * @part_probe_types: NULL-terminated array of probe types
566 * @set_parts: platform specific function to set partitions
566 * @priv: hardware controller specific settings 567 * @priv: hardware controller specific settings
567 */ 568 */
568struct platform_nand_chip { 569struct platform_nand_chip {
@@ -574,26 +575,41 @@ struct platform_nand_chip {
574 int chip_delay; 575 int chip_delay;
575 unsigned int options; 576 unsigned int options;
576 const char **part_probe_types; 577 const char **part_probe_types;
578 void (*set_parts)(uint64_t size,
579 struct platform_nand_chip *chip);
577 void *priv; 580 void *priv;
578}; 581};
579 582
583/* Keep gcc happy */
584struct platform_device;
585
580/** 586/**
581 * struct platform_nand_ctrl - controller level device structure 587 * struct platform_nand_ctrl - controller level device structure
588 * @probe: platform specific function to probe/setup hardware
589 * @remove: platform specific function to remove/teardown hardware
582 * @hwcontrol: platform specific hardware control structure 590 * @hwcontrol: platform specific hardware control structure
583 * @dev_ready: platform specific function to read ready/busy pin 591 * @dev_ready: platform specific function to read ready/busy pin
584 * @select_chip: platform specific chip select function 592 * @select_chip: platform specific chip select function
585 * @cmd_ctrl: platform specific function for controlling 593 * @cmd_ctrl: platform specific function for controlling
586 * ALE/CLE/nCE. Also used to write command and address 594 * ALE/CLE/nCE. Also used to write command and address
595 * @write_buf: platform specific function for write buffer
596 * @read_buf: platform specific function for read buffer
587 * @priv: private data to transport driver specific settings 597 * @priv: private data to transport driver specific settings
588 * 598 *
589 * All fields are optional and depend on the hardware driver requirements 599 * All fields are optional and depend on the hardware driver requirements
590 */ 600 */
591struct platform_nand_ctrl { 601struct platform_nand_ctrl {
602 int (*probe)(struct platform_device *pdev);
603 void (*remove)(struct platform_device *pdev);
592 void (*hwcontrol)(struct mtd_info *mtd, int cmd); 604 void (*hwcontrol)(struct mtd_info *mtd, int cmd);
593 int (*dev_ready)(struct mtd_info *mtd); 605 int (*dev_ready)(struct mtd_info *mtd);
594 void (*select_chip)(struct mtd_info *mtd, int chip); 606 void (*select_chip)(struct mtd_info *mtd, int chip);
595 void (*cmd_ctrl)(struct mtd_info *mtd, int dat, 607 void (*cmd_ctrl)(struct mtd_info *mtd, int dat,
596 unsigned int ctrl); 608 unsigned int ctrl);
609 void (*write_buf)(struct mtd_info *mtd,
610 const uint8_t *buf, int len);
611 void (*read_buf)(struct mtd_info *mtd,
612 uint8_t *buf, int len);
597 void *priv; 613 void *priv;
598}; 614};
599 615
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 9aa2a9149b58..8ed873374381 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -17,6 +17,7 @@
17#include <linux/mtd/onenand_regs.h> 17#include <linux/mtd/onenand_regs.h>
18#include <linux/mtd/bbm.h> 18#include <linux/mtd/bbm.h>
19 19
20#define MAX_DIES 2
20#define MAX_BUFFERRAM 2 21#define MAX_BUFFERRAM 2
21 22
22/* Scan and identify a OneNAND device */ 23/* Scan and identify a OneNAND device */
@@ -51,7 +52,12 @@ struct onenand_bufferram {
51/** 52/**
52 * struct onenand_chip - OneNAND Private Flash Chip Data 53 * struct onenand_chip - OneNAND Private Flash Chip Data
53 * @base: [BOARDSPECIFIC] address to access OneNAND 54 * @base: [BOARDSPECIFIC] address to access OneNAND
55 * @dies: [INTERN][FLEX-ONENAND] number of dies on chip
56 * @boundary: [INTERN][FLEX-ONENAND] Boundary of the dies
57 * @diesize: [INTERN][FLEX-ONENAND] Size of the dies
54 * @chipsize: [INTERN] the size of one chip for multichip arrays 58 * @chipsize: [INTERN] the size of one chip for multichip arrays
59 * FIXME For Flex-OneNAND, chipsize holds maximum possible
60 * device size ie when all blocks are considered MLC
55 * @device_id: [INTERN] device ID 61 * @device_id: [INTERN] device ID
56 * @density_mask: chip density, used for DDP devices 62 * @density_mask: chip density, used for DDP devices
57 * @verstion_id: [INTERN] version ID 63 * @verstion_id: [INTERN] version ID
@@ -68,6 +74,8 @@ struct onenand_bufferram {
68 * @command: [REPLACEABLE] hardware specific function for writing 74 * @command: [REPLACEABLE] hardware specific function for writing
69 * commands to the chip 75 * commands to the chip
70 * @wait: [REPLACEABLE] hardware specific function for wait on ready 76 * @wait: [REPLACEABLE] hardware specific function for wait on ready
77 * @bbt_wait: [REPLACEABLE] hardware specific function for bbt wait on ready
78 * @unlock_all: [REPLACEABLE] hardware specific function for unlock all
71 * @read_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area 79 * @read_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area
72 * @write_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area 80 * @write_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area
73 * @read_word: [REPLACEABLE] hardware specific function for read 81 * @read_word: [REPLACEABLE] hardware specific function for read
@@ -92,9 +100,13 @@ struct onenand_bufferram {
92 */ 100 */
93struct onenand_chip { 101struct onenand_chip {
94 void __iomem *base; 102 void __iomem *base;
103 unsigned dies;
104 unsigned boundary[MAX_DIES];
105 loff_t diesize[MAX_DIES];
95 unsigned int chipsize; 106 unsigned int chipsize;
96 unsigned int device_id; 107 unsigned int device_id;
97 unsigned int version_id; 108 unsigned int version_id;
109 unsigned int technology;
98 unsigned int density_mask; 110 unsigned int density_mask;
99 unsigned int options; 111 unsigned int options;
100 112
@@ -108,6 +120,8 @@ struct onenand_chip {
108 120
109 int (*command)(struct mtd_info *mtd, int cmd, loff_t address, size_t len); 121 int (*command)(struct mtd_info *mtd, int cmd, loff_t address, size_t len);
110 int (*wait)(struct mtd_info *mtd, int state); 122 int (*wait)(struct mtd_info *mtd, int state);
123 int (*bbt_wait)(struct mtd_info *mtd, int state);
124 void (*unlock_all)(struct mtd_info *mtd);
111 int (*read_bufferram)(struct mtd_info *mtd, int area, 125 int (*read_bufferram)(struct mtd_info *mtd, int area,
112 unsigned char *buffer, int offset, size_t count); 126 unsigned char *buffer, int offset, size_t count);
113 int (*write_bufferram)(struct mtd_info *mtd, int area, 127 int (*write_bufferram)(struct mtd_info *mtd, int area,
@@ -145,6 +159,8 @@ struct onenand_chip {
145#define ONENAND_SET_BUFFERRAM0(this) (this->bufferram_index = 0) 159#define ONENAND_SET_BUFFERRAM0(this) (this->bufferram_index = 0)
146#define ONENAND_SET_BUFFERRAM1(this) (this->bufferram_index = 1) 160#define ONENAND_SET_BUFFERRAM1(this) (this->bufferram_index = 1)
147 161
162#define FLEXONENAND(this) \
163 (this->device_id & DEVICE_IS_FLEXONENAND)
148#define ONENAND_GET_SYS_CFG1(this) \ 164#define ONENAND_GET_SYS_CFG1(this) \
149 (this->read_word(this->base + ONENAND_REG_SYS_CFG1)) 165 (this->read_word(this->base + ONENAND_REG_SYS_CFG1))
150#define ONENAND_SET_SYS_CFG1(v, this) \ 166#define ONENAND_SET_SYS_CFG1(v, this) \
@@ -153,6 +169,9 @@ struct onenand_chip {
153#define ONENAND_IS_DDP(this) \ 169#define ONENAND_IS_DDP(this) \
154 (this->device_id & ONENAND_DEVICE_IS_DDP) 170 (this->device_id & ONENAND_DEVICE_IS_DDP)
155 171
172#define ONENAND_IS_MLC(this) \
173 (this->technology & ONENAND_TECHNOLOGY_IS_MLC)
174
156#ifdef CONFIG_MTD_ONENAND_2X_PROGRAM 175#ifdef CONFIG_MTD_ONENAND_2X_PROGRAM
157#define ONENAND_IS_2PLANE(this) \ 176#define ONENAND_IS_2PLANE(this) \
158 (this->options & ONENAND_HAS_2PLANE) 177 (this->options & ONENAND_HAS_2PLANE)
@@ -169,6 +188,7 @@ struct onenand_chip {
169#define ONENAND_HAS_CONT_LOCK (0x0001) 188#define ONENAND_HAS_CONT_LOCK (0x0001)
170#define ONENAND_HAS_UNLOCK_ALL (0x0002) 189#define ONENAND_HAS_UNLOCK_ALL (0x0002)
171#define ONENAND_HAS_2PLANE (0x0004) 190#define ONENAND_HAS_2PLANE (0x0004)
191#define ONENAND_SKIP_UNLOCK_CHECK (0x0100)
172#define ONENAND_PAGEBUF_ALLOC (0x1000) 192#define ONENAND_PAGEBUF_ALLOC (0x1000)
173#define ONENAND_OOBBUF_ALLOC (0x2000) 193#define ONENAND_OOBBUF_ALLOC (0x2000)
174 194
@@ -176,6 +196,7 @@ struct onenand_chip {
176 * OneNAND Flash Manufacturer ID Codes 196 * OneNAND Flash Manufacturer ID Codes
177 */ 197 */
178#define ONENAND_MFR_SAMSUNG 0xec 198#define ONENAND_MFR_SAMSUNG 0xec
199#define ONENAND_MFR_NUMONYX 0x20
179 200
180/** 201/**
181 * struct onenand_manufacturers - NAND Flash Manufacturer ID Structure 202 * struct onenand_manufacturers - NAND Flash Manufacturer ID Structure
@@ -189,5 +210,8 @@ struct onenand_manufacturers {
189 210
190int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t from, 211int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t from,
191 struct mtd_oob_ops *ops); 212 struct mtd_oob_ops *ops);
213unsigned onenand_block(struct onenand_chip *this, loff_t addr);
214loff_t onenand_addr(struct onenand_chip *this, int block);
215int flexonenand_region(struct mtd_info *mtd, loff_t addr);
192 216
193#endif /* __LINUX_MTD_ONENAND_H */ 217#endif /* __LINUX_MTD_ONENAND_H */
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h
index 0c6bbe28f38c..86a6bbef6465 100644
--- a/include/linux/mtd/onenand_regs.h
+++ b/include/linux/mtd/onenand_regs.h
@@ -67,6 +67,9 @@
67/* 67/*
68 * Device ID Register F001h (R) 68 * Device ID Register F001h (R)
69 */ 69 */
70#define DEVICE_IS_FLEXONENAND (1 << 9)
71#define FLEXONENAND_PI_MASK (0x3ff)
72#define FLEXONENAND_PI_UNLOCK_SHIFT (14)
70#define ONENAND_DEVICE_DENSITY_MASK (0xf) 73#define ONENAND_DEVICE_DENSITY_MASK (0xf)
71#define ONENAND_DEVICE_DENSITY_SHIFT (4) 74#define ONENAND_DEVICE_DENSITY_SHIFT (4)
72#define ONENAND_DEVICE_IS_DDP (1 << 3) 75#define ONENAND_DEVICE_IS_DDP (1 << 3)
@@ -84,6 +87,11 @@
84#define ONENAND_VERSION_PROCESS_SHIFT (8) 87#define ONENAND_VERSION_PROCESS_SHIFT (8)
85 88
86/* 89/*
90 * Technology Register F006h (R)
91 */
92#define ONENAND_TECHNOLOGY_IS_MLC (1 << 0)
93
94/*
87 * Start Address 1 F100h (R/W) & Start Address 2 F101h (R/W) 95 * Start Address 1 F100h (R/W) & Start Address 2 F101h (R/W)
88 */ 96 */
89#define ONENAND_DDP_SHIFT (15) 97#define ONENAND_DDP_SHIFT (15)
@@ -93,7 +101,8 @@
93/* 101/*
94 * Start Address 8 F107h (R/W) 102 * Start Address 8 F107h (R/W)
95 */ 103 */
96#define ONENAND_FPA_MASK (0x3f) 104/* Note: It's actually 0x3f in case of SLC */
105#define ONENAND_FPA_MASK (0x7f)
97#define ONENAND_FPA_SHIFT (2) 106#define ONENAND_FPA_SHIFT (2)
98#define ONENAND_FSA_MASK (0x03) 107#define ONENAND_FSA_MASK (0x03)
99 108
@@ -105,7 +114,8 @@
105#define ONENAND_BSA_BOOTRAM (0 << 2) 114#define ONENAND_BSA_BOOTRAM (0 << 2)
106#define ONENAND_BSA_DATARAM0 (2 << 2) 115#define ONENAND_BSA_DATARAM0 (2 << 2)
107#define ONENAND_BSA_DATARAM1 (3 << 2) 116#define ONENAND_BSA_DATARAM1 (3 << 2)
108#define ONENAND_BSC_MASK (0x03) 117/* Note: It's actually 0x03 in case of SLC */
118#define ONENAND_BSC_MASK (0x07)
109 119
110/* 120/*
111 * Command Register F220h (R/W) 121 * Command Register F220h (R/W)
@@ -124,9 +134,13 @@
124#define ONENAND_CMD_RESET (0xF0) 134#define ONENAND_CMD_RESET (0xF0)
125#define ONENAND_CMD_OTP_ACCESS (0x65) 135#define ONENAND_CMD_OTP_ACCESS (0x65)
126#define ONENAND_CMD_READID (0x90) 136#define ONENAND_CMD_READID (0x90)
137#define FLEXONENAND_CMD_PI_UPDATE (0x05)
138#define FLEXONENAND_CMD_PI_ACCESS (0x66)
139#define FLEXONENAND_CMD_RECOVER_LSB (0x05)
127 140
128/* NOTE: Those are not *REAL* commands */ 141/* NOTE: Those are not *REAL* commands */
129#define ONENAND_CMD_BUFFERRAM (0x1978) 142#define ONENAND_CMD_BUFFERRAM (0x1978)
143#define FLEXONENAND_CMD_READ_PI (0x1985)
130 144
131/* 145/*
132 * System Configuration 1 Register F221h (R, R/W) 146 * System Configuration 1 Register F221h (R, R/W)
@@ -192,10 +206,12 @@
192#define ONENAND_ECC_1BIT_ALL (0x5555) 206#define ONENAND_ECC_1BIT_ALL (0x5555)
193#define ONENAND_ECC_2BIT (1 << 1) 207#define ONENAND_ECC_2BIT (1 << 1)
194#define ONENAND_ECC_2BIT_ALL (0xAAAA) 208#define ONENAND_ECC_2BIT_ALL (0xAAAA)
209#define FLEXONENAND_UNCORRECTABLE_ERROR (0x1010)
195 210
196/* 211/*
197 * One-Time Programmable (OTP) 212 * One-Time Programmable (OTP)
198 */ 213 */
214#define FLEXONENAND_OTP_LOCK_OFFSET (2048)
199#define ONENAND_OTP_LOCK_OFFSET (14) 215#define ONENAND_OTP_LOCK_OFFSET (14)
200 216
201#endif /* __ONENAND_REG_H */ 217#endif /* __ONENAND_REG_H */
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index 7535a74083b9..af6dcb992bc3 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -40,7 +40,6 @@ struct mtd_partition {
40 uint64_t offset; /* offset within the master MTD space */ 40 uint64_t offset; /* offset within the master MTD space */
41 uint32_t mask_flags; /* master MTD flags to mask out for this partition */ 41 uint32_t mask_flags; /* master MTD flags to mask out for this partition */
42 struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only)*/ 42 struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only)*/
43 struct mtd_info **mtdp; /* pointer to store the MTD object */
44}; 43};
45 44
46#define MTDPART_OFS_NXTBLK (-2) 45#define MTDPART_OFS_NXTBLK (-2)
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h
index 6316fafe5c2a..6913b71d9ab2 100644
--- a/include/linux/mtd/ubi.h
+++ b/include/linux/mtd/ubi.h
@@ -132,6 +132,39 @@ struct ubi_device_info {
132 dev_t cdev; 132 dev_t cdev;
133}; 133};
134 134
135/*
136 * enum - volume notification types.
137 * @UBI_VOLUME_ADDED: volume has been added
138 * @UBI_VOLUME_REMOVED: start volume volume
139 * @UBI_VOLUME_RESIZED: volume size has been re-sized
140 * @UBI_VOLUME_RENAMED: volume name has been re-named
141 * @UBI_VOLUME_UPDATED: volume name has been updated
142 *
143 * These constants define which type of event has happened when a volume
144 * notification function is invoked.
145 */
146enum {
147 UBI_VOLUME_ADDED,
148 UBI_VOLUME_REMOVED,
149 UBI_VOLUME_RESIZED,
150 UBI_VOLUME_RENAMED,
151 UBI_VOLUME_UPDATED,
152};
153
154/*
155 * struct ubi_notification - UBI notification description structure.
156 * @di: UBI device description object
157 * @vi: UBI volume description object
158 *
159 * UBI notifiers are called with a pointer to an object of this type. The
160 * object describes the notification. Namely, it provides a description of the
161 * UBI device and UBI volume the notification informs about.
162 */
163struct ubi_notification {
164 struct ubi_device_info di;
165 struct ubi_volume_info vi;
166};
167
135/* UBI descriptor given to users when they open UBI volumes */ 168/* UBI descriptor given to users when they open UBI volumes */
136struct ubi_volume_desc; 169struct ubi_volume_desc;
137 170
@@ -141,6 +174,10 @@ void ubi_get_volume_info(struct ubi_volume_desc *desc,
141struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode); 174struct ubi_volume_desc *ubi_open_volume(int ubi_num, int vol_id, int mode);
142struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name, 175struct ubi_volume_desc *ubi_open_volume_nm(int ubi_num, const char *name,
143 int mode); 176 int mode);
177int ubi_register_volume_notifier(struct notifier_block *nb,
178 int ignore_existing);
179int ubi_unregister_volume_notifier(struct notifier_block *nb);
180
144void ubi_close_volume(struct ubi_volume_desc *desc); 181void ubi_close_volume(struct ubi_volume_desc *desc);
145int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, 182int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset,
146 int len, int check); 183 int len, int check);
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 3069ec7e0ab8..878cab4f5fcc 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -150,5 +150,6 @@ extern int __must_check mutex_lock_killable(struct mutex *lock);
150 */ 150 */
151extern int mutex_trylock(struct mutex *lock); 151extern int mutex_trylock(struct mutex *lock);
152extern void mutex_unlock(struct mutex *lock); 152extern void mutex_unlock(struct mutex *lock);
153extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
153 154
154#endif 155#endif
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 518098fe63af..d870ae2faedc 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -18,6 +18,7 @@ enum { MAX_NESTED_LINKS = 8 };
18struct nameidata { 18struct nameidata {
19 struct path path; 19 struct path path;
20 struct qstr last; 20 struct qstr last;
21 struct path root;
21 unsigned int flags; 22 unsigned int flags;
22 int last_type; 23 int last_type;
23 unsigned depth; 24 unsigned depth;
@@ -77,8 +78,8 @@ extern void release_open_intent(struct nameidata *);
77extern struct dentry *lookup_one_len(const char *, struct dentry *, int); 78extern struct dentry *lookup_one_len(const char *, struct dentry *, int);
78extern struct dentry *lookup_one_noperm(const char *, struct dentry *); 79extern struct dentry *lookup_one_noperm(const char *, struct dentry *);
79 80
80extern int follow_down(struct vfsmount **, struct dentry **); 81extern int follow_down(struct path *);
81extern int follow_up(struct vfsmount **, struct dentry **); 82extern int follow_up(struct path *);
82 83
83extern struct dentry *lock_rename(struct dentry *, struct dentry *); 84extern struct dentry *lock_rename(struct dentry *, struct dentry *);
84extern void unlock_rename(struct dentry *, struct dentry *); 85extern void unlock_rename(struct dentry *, struct dentry *);
diff --git a/include/linux/net_dropmon.h b/include/linux/net_dropmon.h
index 0e2e100c44a2..3ceb0cc1bc78 100644
--- a/include/linux/net_dropmon.h
+++ b/include/linux/net_dropmon.h
@@ -3,12 +3,20 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/netlink.h> 5#include <linux/netlink.h>
6#include <linux/types.h>
6 7
7struct net_dm_drop_point { 8struct net_dm_drop_point {
8 __u8 pc[8]; 9 __u8 pc[8];
9 __u32 count; 10 __u32 count;
10}; 11};
11 12
13#define is_drop_point_hw(x) do {\
14 int ____i, ____j;\
15 for (____i = 0; ____i < 8; i ____i++)\
16 ____j |= x[____i];\
17 ____j;\
18} while (0)
19
12#define NET_DM_CFG_VERSION 0 20#define NET_DM_CFG_VERSION 0
13#define NET_DM_CFG_ALERT_COUNT 1 21#define NET_DM_CFG_ALERT_COUNT 1
14#define NET_DM_CFG_ALERT_DELAY 2 22#define NET_DM_CFG_ALERT_DELAY 2
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5a96a1a406e9..d4a4d9867794 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -39,9 +39,11 @@
39 39
40#include <linux/device.h> 40#include <linux/device.h>
41#include <linux/percpu.h> 41#include <linux/percpu.h>
42#include <linux/rculist.h>
42#include <linux/dmaengine.h> 43#include <linux/dmaengine.h>
43#include <linux/workqueue.h> 44#include <linux/workqueue.h>
44 45
46#include <linux/ethtool.h>
45#include <net/net_namespace.h> 47#include <net/net_namespace.h>
46#include <net/dsa.h> 48#include <net/dsa.h>
47#ifdef CONFIG_DCB 49#ifdef CONFIG_DCB
@@ -49,7 +51,6 @@
49#endif 51#endif
50 52
51struct vlan_group; 53struct vlan_group;
52struct ethtool_ops;
53struct netpoll_info; 54struct netpoll_info;
54/* 802.11 specific */ 55/* 802.11 specific */
55struct wireless_dev; 56struct wireless_dev;
@@ -210,6 +211,24 @@ struct dev_addr_list
210#define dmi_users da_users 211#define dmi_users da_users
211#define dmi_gusers da_gusers 212#define dmi_gusers da_gusers
212 213
214struct netdev_hw_addr {
215 struct list_head list;
216 unsigned char addr[MAX_ADDR_LEN];
217 unsigned char type;
218#define NETDEV_HW_ADDR_T_LAN 1
219#define NETDEV_HW_ADDR_T_SAN 2
220#define NETDEV_HW_ADDR_T_SLAVE 3
221#define NETDEV_HW_ADDR_T_UNICAST 4
222 int refcount;
223 bool synced;
224 struct rcu_head rcu_head;
225};
226
227struct netdev_hw_addr_list {
228 struct list_head list;
229 int count;
230};
231
213struct hh_cache 232struct hh_cache
214{ 233{
215 struct hh_cache *hh_next; /* Next entry */ 234 struct hh_cache *hh_next; /* Next entry */
@@ -447,12 +466,25 @@ enum netdev_queue_state_t
447}; 466};
448 467
449struct netdev_queue { 468struct netdev_queue {
469/*
470 * read mostly part
471 */
450 struct net_device *dev; 472 struct net_device *dev;
451 struct Qdisc *qdisc; 473 struct Qdisc *qdisc;
452 unsigned long state; 474 unsigned long state;
453 spinlock_t _xmit_lock;
454 int xmit_lock_owner;
455 struct Qdisc *qdisc_sleeping; 475 struct Qdisc *qdisc_sleeping;
476/*
477 * write mostly part
478 */
479 spinlock_t _xmit_lock ____cacheline_aligned_in_smp;
480 int xmit_lock_owner;
481 /*
482 * please use this field instead of dev->trans_start
483 */
484 unsigned long trans_start;
485 unsigned long tx_bytes;
486 unsigned long tx_packets;
487 unsigned long tx_dropped;
456} ____cacheline_aligned_in_smp; 488} ____cacheline_aligned_in_smp;
457 489
458 490
@@ -670,7 +702,9 @@ struct net_device
670#define NETIF_F_GRO 16384 /* Generic receive offload */ 702#define NETIF_F_GRO 16384 /* Generic receive offload */
671#define NETIF_F_LRO 32768 /* large receive offload */ 703#define NETIF_F_LRO 32768 /* large receive offload */
672 704
705/* the GSO_MASK reserves bits 16 through 23 */
673#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */ 706#define NETIF_F_FCOE_CRC (1 << 24) /* FCoE CRC32 */
707#define NETIF_F_SCTP_CSUM (1 << 25) /* SCTP checksum offload */
674 708
675 /* Segmentation offload features */ 709 /* Segmentation offload features */
676#define NETIF_F_GSO_SHIFT 16 710#define NETIF_F_GSO_SHIFT 16
@@ -747,10 +781,10 @@ struct net_device
747 unsigned char addr_len; /* hardware address length */ 781 unsigned char addr_len; /* hardware address length */
748 unsigned short dev_id; /* for shared network cards */ 782 unsigned short dev_id; /* for shared network cards */
749 783
750 spinlock_t addr_list_lock; 784 struct netdev_hw_addr_list uc; /* Secondary unicast
751 struct dev_addr_list *uc_list; /* Secondary unicast mac addresses */ 785 mac addresses */
752 int uc_count; /* Number of installed ucasts */
753 int uc_promisc; 786 int uc_promisc;
787 spinlock_t addr_list_lock;
754 struct dev_addr_list *mc_list; /* Multicast mac addresses */ 788 struct dev_addr_list *mc_list; /* Multicast mac addresses */
755 int mc_count; /* Number of installed mcasts */ 789 int mc_count; /* Number of installed mcasts */
756 unsigned int promiscuity; 790 unsigned int promiscuity;
@@ -776,8 +810,12 @@ struct net_device
776 */ 810 */
777 unsigned long last_rx; /* Time of last Rx */ 811 unsigned long last_rx; /* Time of last Rx */
778 /* Interface address info used in eth_type_trans() */ 812 /* Interface address info used in eth_type_trans() */
779 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast 813 unsigned char *dev_addr; /* hw address, (before bcast
780 because most packets are unicast) */ 814 because most packets are
815 unicast) */
816
817 struct netdev_hw_addr_list dev_addrs; /* list of device
818 hw addresses */
781 819
782 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 820 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
783 821
@@ -797,6 +835,11 @@ struct net_device
797 * One part is mostly used on xmit path (device) 835 * One part is mostly used on xmit path (device)
798 */ 836 */
799 /* These may be needed for future network-power-down code. */ 837 /* These may be needed for future network-power-down code. */
838
839 /*
840 * trans_start here is expensive for high speed devices on SMP,
841 * please use netdev_queue->trans_start instead.
842 */
800 unsigned long trans_start; /* Time (in jiffies) of last Tx */ 843 unsigned long trans_start; /* Time (in jiffies) of last Tx */
801 844
802 int watchdog_timeo; /* used by dev_watchdog() */ 845 int watchdog_timeo; /* used by dev_watchdog() */
@@ -867,49 +910,10 @@ struct net_device
867 /* max exchange id for FCoE LRO by ddp */ 910 /* max exchange id for FCoE LRO by ddp */
868 unsigned int fcoe_ddp_xid; 911 unsigned int fcoe_ddp_xid;
869#endif 912#endif
870
871#ifdef CONFIG_COMPAT_NET_DEV_OPS
872 struct {
873 int (*init)(struct net_device *dev);
874 void (*uninit)(struct net_device *dev);
875 int (*open)(struct net_device *dev);
876 int (*stop)(struct net_device *dev);
877 int (*hard_start_xmit) (struct sk_buff *skb,
878 struct net_device *dev);
879 u16 (*select_queue)(struct net_device *dev,
880 struct sk_buff *skb);
881 void (*change_rx_flags)(struct net_device *dev,
882 int flags);
883 void (*set_rx_mode)(struct net_device *dev);
884 void (*set_multicast_list)(struct net_device *dev);
885 int (*set_mac_address)(struct net_device *dev,
886 void *addr);
887 int (*validate_addr)(struct net_device *dev);
888 int (*do_ioctl)(struct net_device *dev,
889 struct ifreq *ifr, int cmd);
890 int (*set_config)(struct net_device *dev,
891 struct ifmap *map);
892 int (*change_mtu)(struct net_device *dev, int new_mtu);
893 int (*neigh_setup)(struct net_device *dev,
894 struct neigh_parms *);
895 void (*tx_timeout) (struct net_device *dev);
896 struct net_device_stats* (*get_stats)(struct net_device *dev);
897 void (*vlan_rx_register)(struct net_device *dev,
898 struct vlan_group *grp);
899 void (*vlan_rx_add_vid)(struct net_device *dev,
900 unsigned short vid);
901 void (*vlan_rx_kill_vid)(struct net_device *dev,
902 unsigned short vid);
903#ifdef CONFIG_NET_POLL_CONTROLLER
904 void (*poll_controller)(struct net_device *dev);
905#endif
906 };
907#endif
908}; 913};
909#define to_net_dev(d) container_of(d, struct net_device, dev) 914#define to_net_dev(d) container_of(d, struct net_device, dev)
910 915
911#define NETDEV_ALIGN 32 916#define NETDEV_ALIGN 32
912#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1)
913 917
914static inline 918static inline
915struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev, 919struct netdev_queue *netdev_get_tx_queue(const struct net_device *dev,
@@ -980,9 +984,7 @@ static inline bool netdev_uses_trailer_tags(struct net_device *dev)
980 */ 984 */
981static inline void *netdev_priv(const struct net_device *dev) 985static inline void *netdev_priv(const struct net_device *dev)
982{ 986{
983 return (char *)dev + ((sizeof(struct net_device) 987 return (char *)dev + ALIGN(sizeof(struct net_device), NETDEV_ALIGN);
984 + NETDEV_ALIGN_CONST)
985 & ~NETDEV_ALIGN_CONST);
986} 988}
987 989
988/* Set the sysfs physical device reference for the network logical device 990/* Set the sysfs physical device reference for the network logical device
@@ -1012,6 +1014,12 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
1012void netif_napi_del(struct napi_struct *napi); 1014void netif_napi_del(struct napi_struct *napi);
1013 1015
1014struct napi_gro_cb { 1016struct napi_gro_cb {
1017 /* Virtual address of skb_shinfo(skb)->frags[0].page + offset. */
1018 void *frag0;
1019
1020 /* Length of frag0. */
1021 unsigned int frag0_len;
1022
1015 /* This indicates where we are processing relative to skb->data. */ 1023 /* This indicates where we are processing relative to skb->data. */
1016 int data_offset; 1024 int data_offset;
1017 1025
@@ -1047,14 +1055,6 @@ struct packet_type {
1047 struct list_head list; 1055 struct list_head list;
1048}; 1056};
1049 1057
1050struct napi_gro_fraginfo {
1051 skb_frag_t frags[MAX_SKB_FRAGS];
1052 unsigned int nr_frags;
1053 unsigned int ip_summed;
1054 unsigned int len;
1055 __wsum csum;
1056};
1057
1058#include <linux/interrupt.h> 1058#include <linux/interrupt.h>
1059#include <linux/notifier.h> 1059#include <linux/notifier.h>
1060 1060
@@ -1119,9 +1119,9 @@ extern int dev_restart(struct net_device *dev);
1119#ifdef CONFIG_NETPOLL_TRAP 1119#ifdef CONFIG_NETPOLL_TRAP
1120extern int netpoll_trap(void); 1120extern int netpoll_trap(void);
1121#endif 1121#endif
1122extern void *skb_gro_header(struct sk_buff *skb, unsigned int hlen);
1123extern int skb_gro_receive(struct sk_buff **head, 1122extern int skb_gro_receive(struct sk_buff **head,
1124 struct sk_buff *skb); 1123 struct sk_buff *skb);
1124extern void skb_gro_reset_offset(struct sk_buff *skb);
1125 1125
1126static inline unsigned int skb_gro_offset(const struct sk_buff *skb) 1126static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
1127{ 1127{
@@ -1138,16 +1138,34 @@ static inline void skb_gro_pull(struct sk_buff *skb, unsigned int len)
1138 NAPI_GRO_CB(skb)->data_offset += len; 1138 NAPI_GRO_CB(skb)->data_offset += len;
1139} 1139}
1140 1140
1141static inline void skb_gro_reset_offset(struct sk_buff *skb) 1141static inline void *skb_gro_header_fast(struct sk_buff *skb,
1142 unsigned int offset)
1143{
1144 return NAPI_GRO_CB(skb)->frag0 + offset;
1145}
1146
1147static inline int skb_gro_header_hard(struct sk_buff *skb, unsigned int hlen)
1148{
1149 return NAPI_GRO_CB(skb)->frag0_len < hlen;
1150}
1151
1152static inline void *skb_gro_header_slow(struct sk_buff *skb, unsigned int hlen,
1153 unsigned int offset)
1142{ 1154{
1143 NAPI_GRO_CB(skb)->data_offset = 0; 1155 NAPI_GRO_CB(skb)->frag0 = NULL;
1156 NAPI_GRO_CB(skb)->frag0_len = 0;
1157 return pskb_may_pull(skb, hlen) ? skb->data + offset : NULL;
1144} 1158}
1145 1159
1146static inline void *skb_gro_mac_header(struct sk_buff *skb) 1160static inline void *skb_gro_mac_header(struct sk_buff *skb)
1147{ 1161{
1148 return skb_mac_header(skb) < skb->data ? skb_mac_header(skb) : 1162 return NAPI_GRO_CB(skb)->frag0 ?: skb_mac_header(skb);
1149 page_address(skb_shinfo(skb)->frags[0].page) + 1163}
1150 skb_shinfo(skb)->frags[0].page_offset; 1164
1165static inline void *skb_gro_network_header(struct sk_buff *skb)
1166{
1167 return (NAPI_GRO_CB(skb)->frag0 ?: skb->data) +
1168 skb_network_offset(skb);
1151} 1169}
1152 1170
1153static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev, 1171static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
@@ -1442,12 +1460,18 @@ extern int napi_gro_receive(struct napi_struct *napi,
1442 struct sk_buff *skb); 1460 struct sk_buff *skb);
1443extern void napi_reuse_skb(struct napi_struct *napi, 1461extern void napi_reuse_skb(struct napi_struct *napi,
1444 struct sk_buff *skb); 1462 struct sk_buff *skb);
1445extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi, 1463extern struct sk_buff * napi_get_frags(struct napi_struct *napi);
1446 struct napi_gro_fraginfo *info);
1447extern int napi_frags_finish(struct napi_struct *napi, 1464extern int napi_frags_finish(struct napi_struct *napi,
1448 struct sk_buff *skb, int ret); 1465 struct sk_buff *skb, int ret);
1449extern int napi_gro_frags(struct napi_struct *napi, 1466extern struct sk_buff * napi_frags_skb(struct napi_struct *napi);
1450 struct napi_gro_fraginfo *info); 1467extern int napi_gro_frags(struct napi_struct *napi);
1468
1469static inline void napi_free_frags(struct napi_struct *napi)
1470{
1471 kfree_skb(napi->skb);
1472 napi->skb = NULL;
1473}
1474
1451extern void netif_nit_deliver(struct sk_buff *skb); 1475extern void netif_nit_deliver(struct sk_buff *skb);
1452extern int dev_valid_name(const char *name); 1476extern int dev_valid_name(const char *name);
1453extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 1477extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
@@ -1514,6 +1538,8 @@ static inline int netif_carrier_ok(const struct net_device *dev)
1514 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state); 1538 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
1515} 1539}
1516 1540
1541extern unsigned long dev_trans_start(struct net_device *dev);
1542
1517extern void __netdev_watchdog_up(struct net_device *dev); 1543extern void __netdev_watchdog_up(struct net_device *dev);
1518 1544
1519extern void netif_carrier_on(struct net_device *dev); 1545extern void netif_carrier_on(struct net_device *dev);
@@ -1671,6 +1697,12 @@ static inline void __netif_tx_unlock_bh(struct netdev_queue *txq)
1671 spin_unlock_bh(&txq->_xmit_lock); 1697 spin_unlock_bh(&txq->_xmit_lock);
1672} 1698}
1673 1699
1700static inline void txq_trans_update(struct netdev_queue *txq)
1701{
1702 if (txq->xmit_lock_owner != -1)
1703 txq->trans_start = jiffies;
1704}
1705
1674/** 1706/**
1675 * netif_tx_lock - grab network device transmit lock 1707 * netif_tx_lock - grab network device transmit lock
1676 * @dev: network device 1708 * @dev: network device
@@ -1778,6 +1810,13 @@ static inline void netif_addr_unlock_bh(struct net_device *dev)
1778 spin_unlock_bh(&dev->addr_list_lock); 1810 spin_unlock_bh(&dev->addr_list_lock);
1779} 1811}
1780 1812
1813/*
1814 * dev_addrs walker. Should be used only for read access. Call with
1815 * rcu_read_lock held.
1816 */
1817#define for_each_dev_addr(dev, ha) \
1818 list_for_each_entry_rcu(ha, &dev->dev_addrs.list, list)
1819
1781/* These functions live elsewhere (drivers/net/net_init.c, but related) */ 1820/* These functions live elsewhere (drivers/net/net_init.c, but related) */
1782 1821
1783extern void ether_setup(struct net_device *dev); 1822extern void ether_setup(struct net_device *dev);
@@ -1790,11 +1829,24 @@ extern struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
1790 alloc_netdev_mq(sizeof_priv, name, setup, 1) 1829 alloc_netdev_mq(sizeof_priv, name, setup, 1)
1791extern int register_netdev(struct net_device *dev); 1830extern int register_netdev(struct net_device *dev);
1792extern void unregister_netdev(struct net_device *dev); 1831extern void unregister_netdev(struct net_device *dev);
1832
1833/* Functions used for device addresses handling */
1834extern int dev_addr_add(struct net_device *dev, unsigned char *addr,
1835 unsigned char addr_type);
1836extern int dev_addr_del(struct net_device *dev, unsigned char *addr,
1837 unsigned char addr_type);
1838extern int dev_addr_add_multiple(struct net_device *to_dev,
1839 struct net_device *from_dev,
1840 unsigned char addr_type);
1841extern int dev_addr_del_multiple(struct net_device *to_dev,
1842 struct net_device *from_dev,
1843 unsigned char addr_type);
1844
1793/* Functions used for secondary unicast and multicast support */ 1845/* Functions used for secondary unicast and multicast support */
1794extern void dev_set_rx_mode(struct net_device *dev); 1846extern void dev_set_rx_mode(struct net_device *dev);
1795extern void __dev_set_rx_mode(struct net_device *dev); 1847extern void __dev_set_rx_mode(struct net_device *dev);
1796extern int dev_unicast_delete(struct net_device *dev, void *addr, int alen); 1848extern int dev_unicast_delete(struct net_device *dev, void *addr);
1797extern int dev_unicast_add(struct net_device *dev, void *addr, int alen); 1849extern int dev_unicast_add(struct net_device *dev, void *addr);
1798extern int dev_unicast_sync(struct net_device *to, struct net_device *from); 1850extern int dev_unicast_sync(struct net_device *to, struct net_device *from);
1799extern void dev_unicast_unsync(struct net_device *to, struct net_device *from); 1851extern void dev_unicast_unsync(struct net_device *to, struct net_device *from);
1800extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all); 1852extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all);
@@ -1856,15 +1908,14 @@ static inline int net_gso_ok(int features, int gso_type)
1856 1908
1857static inline int skb_gso_ok(struct sk_buff *skb, int features) 1909static inline int skb_gso_ok(struct sk_buff *skb, int features)
1858{ 1910{
1859 return net_gso_ok(features, skb_shinfo(skb)->gso_type); 1911 return net_gso_ok(features, skb_shinfo(skb)->gso_type) &&
1912 (!skb_has_frags(skb) || (features & NETIF_F_FRAGLIST));
1860} 1913}
1861 1914
1862static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb) 1915static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
1863{ 1916{
1864 return skb_is_gso(skb) && 1917 return skb_is_gso(skb) &&
1865 (!skb_gso_ok(skb, dev->features) || 1918 (!skb_gso_ok(skb, dev->features) ||
1866 (skb_shinfo(skb)->frag_list &&
1867 !(dev->features & NETIF_F_FRAGLIST)) ||
1868 unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); 1919 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
1869} 1920}
1870 1921
@@ -1874,6 +1925,16 @@ static inline void netif_set_gso_max_size(struct net_device *dev,
1874 dev->gso_max_size = size; 1925 dev->gso_max_size = size;
1875} 1926}
1876 1927
1928static inline void skb_bond_set_mac_by_master(struct sk_buff *skb,
1929 struct net_device *master)
1930{
1931 if (skb->pkt_type == PACKET_HOST) {
1932 u16 *dest = (u16 *) eth_hdr(skb)->h_dest;
1933
1934 memcpy(dest, master->dev_addr, ETH_ALEN);
1935 }
1936}
1937
1877/* On bonding slaves other than the currently active slave, suppress 1938/* On bonding slaves other than the currently active slave, suppress
1878 * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and 1939 * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and
1879 * ARP on active-backup slaves with arp_validate enabled. 1940 * ARP on active-backup slaves with arp_validate enabled.
@@ -1887,6 +1948,14 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1887 if (master->priv_flags & IFF_MASTER_ARPMON) 1948 if (master->priv_flags & IFF_MASTER_ARPMON)
1888 dev->last_rx = jiffies; 1949 dev->last_rx = jiffies;
1889 1950
1951 if ((master->priv_flags & IFF_MASTER_ALB) && master->br_port) {
1952 /* Do address unmangle. The local destination address
1953 * will be always the one master has. Provides the right
1954 * functionality in a bridge.
1955 */
1956 skb_bond_set_mac_by_master(skb, master);
1957 }
1958
1890 if (dev->priv_flags & IFF_SLAVE_INACTIVE) { 1959 if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
1891 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && 1960 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
1892 skb->protocol == __cpu_to_be16(ETH_P_ARP)) 1961 skb->protocol == __cpu_to_be16(ETH_P_ARP))
@@ -1908,6 +1977,28 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1908} 1977}
1909 1978
1910extern struct pernet_operations __net_initdata loopback_net_ops; 1979extern struct pernet_operations __net_initdata loopback_net_ops;
1980
1981static inline int dev_ethtool_get_settings(struct net_device *dev,
1982 struct ethtool_cmd *cmd)
1983{
1984 if (!dev->ethtool_ops || !dev->ethtool_ops->get_settings)
1985 return -EOPNOTSUPP;
1986 return dev->ethtool_ops->get_settings(dev, cmd);
1987}
1988
1989static inline u32 dev_ethtool_get_rx_csum(struct net_device *dev)
1990{
1991 if (!dev->ethtool_ops || !dev->ethtool_ops->get_rx_csum)
1992 return 0;
1993 return dev->ethtool_ops->get_rx_csum(dev);
1994}
1995
1996static inline u32 dev_ethtool_get_flags(struct net_device *dev)
1997{
1998 if (!dev->ethtool_ops || !dev->ethtool_ops->get_flags)
1999 return 0;
2000 return dev->ethtool_ops->get_flags(dev);
2001}
1911#endif /* __KERNEL__ */ 2002#endif /* __KERNEL__ */
1912 2003
1913#endif /* _LINUX_DEV_H */ 2004#endif /* _LINUX_NETDEVICE_H */
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index af9d2fb97212..2aea50399c0b 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -33,6 +33,7 @@ header-y += xt_limit.h
33header-y += xt_mac.h 33header-y += xt_mac.h
34header-y += xt_mark.h 34header-y += xt_mark.h
35header-y += xt_multiport.h 35header-y += xt_multiport.h
36header-y += xt_osf.h
36header-y += xt_owner.h 37header-y += xt_owner.h
37header-y += xt_pkttype.h 38header-y += xt_pkttype.h
38header-y += xt_quota.h 39header-y += xt_quota.h
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index 885cbe282260..a8248ee422b7 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -75,75 +75,6 @@ enum ip_conntrack_status {
75 IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT), 75 IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT),
76}; 76};
77 77
78/* Connection tracking event bits */
79enum ip_conntrack_events
80{
81 /* New conntrack */
82 IPCT_NEW_BIT = 0,
83 IPCT_NEW = (1 << IPCT_NEW_BIT),
84
85 /* Expected connection */
86 IPCT_RELATED_BIT = 1,
87 IPCT_RELATED = (1 << IPCT_RELATED_BIT),
88
89 /* Destroyed conntrack */
90 IPCT_DESTROY_BIT = 2,
91 IPCT_DESTROY = (1 << IPCT_DESTROY_BIT),
92
93 /* Timer has been refreshed */
94 IPCT_REFRESH_BIT = 3,
95 IPCT_REFRESH = (1 << IPCT_REFRESH_BIT),
96
97 /* Status has changed */
98 IPCT_STATUS_BIT = 4,
99 IPCT_STATUS = (1 << IPCT_STATUS_BIT),
100
101 /* Update of protocol info */
102 IPCT_PROTOINFO_BIT = 5,
103 IPCT_PROTOINFO = (1 << IPCT_PROTOINFO_BIT),
104
105 /* Volatile protocol info */
106 IPCT_PROTOINFO_VOLATILE_BIT = 6,
107 IPCT_PROTOINFO_VOLATILE = (1 << IPCT_PROTOINFO_VOLATILE_BIT),
108
109 /* New helper for conntrack */
110 IPCT_HELPER_BIT = 7,
111 IPCT_HELPER = (1 << IPCT_HELPER_BIT),
112
113 /* Update of helper info */
114 IPCT_HELPINFO_BIT = 8,
115 IPCT_HELPINFO = (1 << IPCT_HELPINFO_BIT),
116
117 /* Volatile helper info */
118 IPCT_HELPINFO_VOLATILE_BIT = 9,
119 IPCT_HELPINFO_VOLATILE = (1 << IPCT_HELPINFO_VOLATILE_BIT),
120
121 /* NAT info */
122 IPCT_NATINFO_BIT = 10,
123 IPCT_NATINFO = (1 << IPCT_NATINFO_BIT),
124
125 /* Counter highest bit has been set, unused */
126 IPCT_COUNTER_FILLING_BIT = 11,
127 IPCT_COUNTER_FILLING = (1 << IPCT_COUNTER_FILLING_BIT),
128
129 /* Mark is set */
130 IPCT_MARK_BIT = 12,
131 IPCT_MARK = (1 << IPCT_MARK_BIT),
132
133 /* NAT sequence adjustment */
134 IPCT_NATSEQADJ_BIT = 13,
135 IPCT_NATSEQADJ = (1 << IPCT_NATSEQADJ_BIT),
136
137 /* Secmark is set */
138 IPCT_SECMARK_BIT = 14,
139 IPCT_SECMARK = (1 << IPCT_SECMARK_BIT),
140};
141
142enum ip_conntrack_expect_events {
143 IPEXP_NEW_BIT = 0,
144 IPEXP_NEW = (1 << IPEXP_NEW_BIT),
145};
146
147#ifdef __KERNEL__ 78#ifdef __KERNEL__
148struct ip_conntrack_stat 79struct ip_conntrack_stat
149{ 80{
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h
index b2f384d42611..4352feed2377 100644
--- a/include/linux/netfilter/nf_conntrack_tcp.h
+++ b/include/linux/netfilter/nf_conntrack_tcp.h
@@ -15,7 +15,8 @@ enum tcp_conntrack {
15 TCP_CONNTRACK_LAST_ACK, 15 TCP_CONNTRACK_LAST_ACK,
16 TCP_CONNTRACK_TIME_WAIT, 16 TCP_CONNTRACK_TIME_WAIT,
17 TCP_CONNTRACK_CLOSE, 17 TCP_CONNTRACK_CLOSE,
18 TCP_CONNTRACK_LISTEN, 18 TCP_CONNTRACK_LISTEN, /* obsolete */
19#define TCP_CONNTRACK_SYN_SENT2 TCP_CONNTRACK_LISTEN
19 TCP_CONNTRACK_MAX, 20 TCP_CONNTRACK_MAX,
20 TCP_CONNTRACK_IGNORE 21 TCP_CONNTRACK_IGNORE
21}; 22};
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index c600083cbdf5..bff4d5741d98 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -46,7 +46,8 @@ struct nfgenmsg {
46#define NFNL_SUBSYS_CTNETLINK_EXP 2 46#define NFNL_SUBSYS_CTNETLINK_EXP 2
47#define NFNL_SUBSYS_QUEUE 3 47#define NFNL_SUBSYS_QUEUE 3
48#define NFNL_SUBSYS_ULOG 4 48#define NFNL_SUBSYS_ULOG 4
49#define NFNL_SUBSYS_COUNT 5 49#define NFNL_SUBSYS_OSF 5
50#define NFNL_SUBSYS_COUNT 6
50 51
51#ifdef __KERNEL__ 52#ifdef __KERNEL__
52 53
@@ -75,7 +76,7 @@ extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
75 76
76extern int nfnetlink_has_listeners(unsigned int group); 77extern int nfnetlink_has_listeners(unsigned int group);
77extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, 78extern int nfnetlink_send(struct sk_buff *skb, u32 pid, unsigned group,
78 int echo); 79 int echo, gfp_t flags);
79extern void nfnetlink_set_err(u32 pid, u32 group, int error); 80extern void nfnetlink_set_err(u32 pid, u32 group, int error);
80extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags); 81extern int nfnetlink_unicast(struct sk_buff *skb, u_int32_t pid, int flags);
81 82
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index 1a865e48b8eb..ed4ef8d0b11b 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -101,6 +101,7 @@ enum ctattr_protoinfo_dccp {
101 CTA_PROTOINFO_DCCP_UNSPEC, 101 CTA_PROTOINFO_DCCP_UNSPEC,
102 CTA_PROTOINFO_DCCP_STATE, 102 CTA_PROTOINFO_DCCP_STATE,
103 CTA_PROTOINFO_DCCP_ROLE, 103 CTA_PROTOINFO_DCCP_ROLE,
104 CTA_PROTOINFO_DCCP_HANDSHAKE_SEQ,
104 __CTA_PROTOINFO_DCCP_MAX, 105 __CTA_PROTOINFO_DCCP_MAX,
105}; 106};
106#define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1) 107#define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1)
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index c9efe039dc57..1030b7593898 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -184,9 +184,10 @@ struct xt_counters_info
184 * @matchinfo: per-match data 184 * @matchinfo: per-match data
185 * @fragoff: packet is a fragment, this is the data offset 185 * @fragoff: packet is a fragment, this is the data offset
186 * @thoff: position of transport header relative to skb->data 186 * @thoff: position of transport header relative to skb->data
187 * @hotdrop: drop packet if we had inspection problems 187 * @hook: hook number given packet came from
188 * @family: Actual NFPROTO_* through which the function is invoked 188 * @family: Actual NFPROTO_* through which the function is invoked
189 * (helpful when match->family == NFPROTO_UNSPEC) 189 * (helpful when match->family == NFPROTO_UNSPEC)
190 * @hotdrop: drop packet if we had inspection problems
190 */ 191 */
191struct xt_match_param { 192struct xt_match_param {
192 const struct net_device *in, *out; 193 const struct net_device *in, *out;
@@ -194,8 +195,9 @@ struct xt_match_param {
194 const void *matchinfo; 195 const void *matchinfo;
195 int fragoff; 196 int fragoff;
196 unsigned int thoff; 197 unsigned int thoff;
197 bool *hotdrop; 198 unsigned int hooknum;
198 u_int8_t family; 199 u_int8_t family;
200 bool *hotdrop;
199}; 201};
200 202
201/** 203/**
diff --git a/include/linux/netfilter/xt_NFQUEUE.h b/include/linux/netfilter/xt_NFQUEUE.h
index 982a89f78272..2584f4a777de 100644
--- a/include/linux/netfilter/xt_NFQUEUE.h
+++ b/include/linux/netfilter/xt_NFQUEUE.h
@@ -15,4 +15,9 @@ struct xt_NFQ_info {
15 __u16 queuenum; 15 __u16 queuenum;
16}; 16};
17 17
18struct xt_NFQ_info_v1 {
19 __u16 queuenum;
20 __u16 queues_total;
21};
22
18#endif /* _XT_NFQ_TARGET_H */ 23#endif /* _XT_NFQ_TARGET_H */
diff --git a/include/linux/netfilter/xt_osf.h b/include/linux/netfilter/xt_osf.h
new file mode 100644
index 000000000000..fd2272e0959a
--- /dev/null
+++ b/include/linux/netfilter/xt_osf.h
@@ -0,0 +1,133 @@
1/*
2 * Copyright (c) 2003+ Evgeniy Polyakov <johnpol@2ka.mxt.ru>
3 *
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 * 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 _XT_OSF_H
21#define _XT_OSF_H
22
23#define MAXGENRELEN 32
24
25#define XT_OSF_GENRE (1<<0)
26#define XT_OSF_TTL (1<<1)
27#define XT_OSF_LOG (1<<2)
28#define XT_OSF_INVERT (1<<3)
29
30#define XT_OSF_LOGLEVEL_ALL 0 /* log all matched fingerprints */
31#define XT_OSF_LOGLEVEL_FIRST 1 /* log only the first matced fingerprint */
32#define XT_OSF_LOGLEVEL_ALL_KNOWN 2 /* do not log unknown packets */
33
34#define XT_OSF_TTL_TRUE 0 /* True ip and fingerprint TTL comparison */
35#define XT_OSF_TTL_LESS 1 /* Check if ip TTL is less than fingerprint one */
36#define XT_OSF_TTL_NOCHECK 2 /* Do not compare ip and fingerprint TTL at all */
37
38struct xt_osf_info {
39 char genre[MAXGENRELEN];
40 __u32 len;
41 __u32 flags;
42 __u32 loglevel;
43 __u32 ttl;
44};
45
46/*
47 * Wildcard MSS (kind of).
48 * It is used to implement a state machine for the different wildcard values
49 * of the MSS and window sizes.
50 */
51struct xt_osf_wc {
52 __u32 wc;
53 __u32 val;
54};
55
56/*
57 * This struct represents IANA options
58 * http://www.iana.org/assignments/tcp-parameters
59 */
60struct xt_osf_opt {
61 __u16 kind, length;
62 struct xt_osf_wc wc;
63};
64
65struct xt_osf_user_finger {
66 struct xt_osf_wc wss;
67
68 __u8 ttl, df;
69 __u16 ss, mss;
70 __u16 opt_num;
71
72 char genre[MAXGENRELEN];
73 char version[MAXGENRELEN];
74 char subtype[MAXGENRELEN];
75
76 /* MAX_IPOPTLEN is maximum if all options are NOPs or EOLs */
77 struct xt_osf_opt opt[MAX_IPOPTLEN];
78};
79
80struct xt_osf_nlmsg {
81 struct xt_osf_user_finger f;
82 struct iphdr ip;
83 struct tcphdr tcp;
84};
85
86/* Defines for IANA option kinds */
87
88enum iana_options {
89 OSFOPT_EOL = 0, /* End of options */
90 OSFOPT_NOP, /* NOP */
91 OSFOPT_MSS, /* Maximum segment size */
92 OSFOPT_WSO, /* Window scale option */
93 OSFOPT_SACKP, /* SACK permitted */
94 OSFOPT_SACK, /* SACK */
95 OSFOPT_ECHO,
96 OSFOPT_ECHOREPLY,
97 OSFOPT_TS, /* Timestamp option */
98 OSFOPT_POCP, /* Partial Order Connection Permitted */
99 OSFOPT_POSP, /* Partial Order Service Profile */
100
101 /* Others are not used in the current OSF */
102 OSFOPT_EMPTY = 255,
103};
104
105/*
106 * Initial window size option state machine: multiple of mss, mtu or
107 * plain numeric value. Can also be made as plain numeric value which
108 * is not a multiple of specified value.
109 */
110enum xt_osf_window_size_options {
111 OSF_WSS_PLAIN = 0,
112 OSF_WSS_MSS,
113 OSF_WSS_MTU,
114 OSF_WSS_MODULO,
115 OSF_WSS_MAX,
116};
117
118/*
119 * Add/remove fingerprint from the kernel.
120 */
121enum xt_osf_msg_types {
122 OSF_MSG_ADD,
123 OSF_MSG_REMOVE,
124 OSF_MSG_MAX,
125};
126
127enum xt_osf_attr_type {
128 OSF_ATTR_UNSPEC,
129 OSF_ATTR_FINGER,
130 OSF_ATTR_MAX,
131};
132
133#endif /* _XT_OSF_H */
diff --git a/include/linux/netfilter/xt_socket.h b/include/linux/netfilter/xt_socket.h
new file mode 100644
index 000000000000..6f475b8ff34b
--- /dev/null
+++ b/include/linux/netfilter/xt_socket.h
@@ -0,0 +1,12 @@
1#ifndef _XT_SOCKET_H
2#define _XT_SOCKET_H
3
4enum {
5 XT_SOCKET_TRANSPARENT = 1 << 0,
6};
7
8struct xt_socket_mtinfo1 {
9 __u8 flags;
10};
11
12#endif /* _XT_SOCKET_H */
diff --git a/include/linux/nfs.h b/include/linux/nfs.h
index 214d499718f7..f387919bbc59 100644
--- a/include/linux/nfs.h
+++ b/include/linux/nfs.h
@@ -25,8 +25,9 @@
25#define NFSMODE_SOCK 0140000 25#define NFSMODE_SOCK 0140000
26#define NFSMODE_FIFO 0010000 26#define NFSMODE_FIFO 0010000
27 27
28#define NFS_MNT_PROGRAM 100005 28#define NFS_MNT_PROGRAM 100005
29#define NFS_MNT_PORT 627 29#define NFS_MNT_VERSION 1
30#define NFS_MNT3_VERSION 3
30 31
31/* 32/*
32 * NFS stats. The good thing with these values is that NFSv3 errors are 33 * NFS stats. The good thing with these values is that NFSv3 errors are
diff --git a/include/linux/nfs2.h b/include/linux/nfs2.h
index 0ed9517138fc..fde24b30cc9e 100644
--- a/include/linux/nfs2.h
+++ b/include/linux/nfs2.h
@@ -64,11 +64,4 @@ struct nfs2_fh {
64#define NFSPROC_READDIR 16 64#define NFSPROC_READDIR 16
65#define NFSPROC_STATFS 17 65#define NFSPROC_STATFS 17
66 66
67#define NFS_MNT_PROGRAM 100005
68#define NFS_MNT_VERSION 1
69#define MNTPROC_NULL 0
70#define MNTPROC_MNT 1
71#define MNTPROC_UMNT 3
72#define MNTPROC_UMNTALL 4
73
74#endif /* _LINUX_NFS2_H */ 67#endif /* _LINUX_NFS2_H */
diff --git a/include/linux/nfs3.h b/include/linux/nfs3.h
index 539f3b550eab..ac33806ec7f9 100644
--- a/include/linux/nfs3.h
+++ b/include/linux/nfs3.h
@@ -88,12 +88,7 @@ struct nfs3_fh {
88#define NFS3PROC_PATHCONF 20 88#define NFS3PROC_PATHCONF 20
89#define NFS3PROC_COMMIT 21 89#define NFS3PROC_COMMIT 21
90 90
91#define NFS_MNT3_PROGRAM 100005
92#define NFS_MNT3_VERSION 3 91#define NFS_MNT3_VERSION 3
93#define MOUNTPROC3_NULL 0
94#define MOUNTPROC3_MNT 1
95#define MOUNTPROC3_UMNT 3
96#define MOUNTPROC3_UMNTALL 4
97 92
98 93
99#if defined(__KERNEL__) 94#if defined(__KERNEL__)
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index e3f0cbcbd0db..bd2eba530667 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_OPAQUE_LIMIT 1024
24#define NFS4_MAX_SESSIONID_LEN 16 25#define NFS4_MAX_SESSIONID_LEN 16
25 26
26#define NFS4_ACCESS_READ 0x0001 27#define NFS4_ACCESS_READ 0x0001
@@ -130,6 +131,16 @@
130 131
131#define NFS4_MAX_UINT64 (~(u64)0) 132#define NFS4_MAX_UINT64 (~(u64)0)
132 133
134/* An NFS4 sessions server must support at least NFS4_MAX_OPS operations.
135 * If a compound requires more operations, adjust NFS4_MAX_OPS accordingly.
136 */
137#define NFS4_MAX_OPS 8
138
139/* Our NFS4 client back channel server only wants the cb_sequene and the
140 * actual operation per compound
141 */
142#define NFS4_MAX_BACK_CHANNEL_OPS 2
143
133enum nfs4_acl_whotype { 144enum nfs4_acl_whotype {
134 NFS4_ACL_WHO_NAMED = 0, 145 NFS4_ACL_WHO_NAMED = 0,
135 NFS4_ACL_WHO_OWNER, 146 NFS4_ACL_WHO_OWNER,
@@ -462,6 +473,13 @@ enum lock_type4 {
462#define NFSPROC4_NULL 0 473#define NFSPROC4_NULL 0
463#define NFSPROC4_COMPOUND 1 474#define NFSPROC4_COMPOUND 1
464#define NFS4_MINOR_VERSION 0 475#define NFS4_MINOR_VERSION 0
476
477#if defined(CONFIG_NFS_V4_1)
478#define NFS4_MAX_MINOR_VERSION 1
479#else
480#define NFS4_MAX_MINOR_VERSION 0
481#endif /* CONFIG_NFS_V4_1 */
482
465#define NFS4_DEBUG 1 483#define NFS4_DEBUG 1
466 484
467/* Index of predefined Linux client operations */ 485/* Index of predefined Linux client operations */
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 6ad75948cbf7..19fe15d12042 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -4,11 +4,17 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/backing-dev.h> 5#include <linux/backing-dev.h>
6#include <linux/wait.h> 6#include <linux/wait.h>
7#include <linux/nfs_xdr.h>
8#include <linux/sunrpc/xprt.h>
7 9
8#include <asm/atomic.h> 10#include <asm/atomic.h>
9 11
12struct nfs4_session;
10struct nfs_iostats; 13struct nfs_iostats;
11struct nlm_host; 14struct nlm_host;
15struct nfs4_sequence_args;
16struct nfs4_sequence_res;
17struct nfs_server;
12 18
13/* 19/*
14 * The nfs_client identifies our client state to the server. 20 * The nfs_client identifies our client state to the server.
@@ -18,6 +24,7 @@ struct nfs_client {
18 int cl_cons_state; /* current construction state (-ve: init error) */ 24 int cl_cons_state; /* current construction state (-ve: init error) */
19#define NFS_CS_READY 0 /* ready to be used */ 25#define NFS_CS_READY 0 /* ready to be used */
20#define NFS_CS_INITING 1 /* busy initialising */ 26#define NFS_CS_INITING 1 /* busy initialising */
27#define NFS_CS_SESSION_INITING 2 /* busy initialising session */
21 unsigned long cl_res_state; /* NFS resources state */ 28 unsigned long cl_res_state; /* NFS resources state */
22#define NFS_CS_CALLBACK 1 /* - callback started */ 29#define NFS_CS_CALLBACK 1 /* - callback started */
23#define NFS_CS_IDMAP 2 /* - idmap started */ 30#define NFS_CS_IDMAP 2 /* - idmap started */
@@ -32,6 +39,7 @@ struct nfs_client {
32 const struct nfs_rpc_ops *rpc_ops; /* NFS protocol vector */ 39 const struct nfs_rpc_ops *rpc_ops; /* NFS protocol vector */
33 int cl_proto; /* Network transport protocol */ 40 int cl_proto; /* Network transport protocol */
34 41
42 u32 cl_minorversion;/* NFSv4 minorversion */
35 struct rpc_cred *cl_machine_cred; 43 struct rpc_cred *cl_machine_cred;
36 44
37#ifdef CONFIG_NFS_V4 45#ifdef CONFIG_NFS_V4
@@ -63,7 +71,22 @@ struct nfs_client {
63 */ 71 */
64 char cl_ipaddr[48]; 72 char cl_ipaddr[48];
65 unsigned char cl_id_uniquifier; 73 unsigned char cl_id_uniquifier;
66#endif 74 int (* cl_call_sync)(struct nfs_server *server,
75 struct rpc_message *msg,
76 struct nfs4_sequence_args *args,
77 struct nfs4_sequence_res *res,
78 int cache_reply);
79#endif /* CONFIG_NFS_V4 */
80
81#ifdef CONFIG_NFS_V4_1
82 /* clientid returned from EXCHANGE_ID, used by session operations */
83 u64 cl_ex_clid;
84 /* The sequence id to use for the next CREATE_SESSION */
85 u32 cl_seqid;
86 /* The flags used for obtaining the clientid during EXCHANGE_ID */
87 u32 cl_exchange_flags;
88 struct nfs4_session *cl_session; /* sharred session */
89#endif /* CONFIG_NFS_V4_1 */
67 90
68#ifdef CONFIG_NFS_FSCACHE 91#ifdef CONFIG_NFS_FSCACHE
69 struct fscache_cookie *fscache; /* client index cache cookie */ 92 struct fscache_cookie *fscache; /* client index cache cookie */
@@ -145,4 +168,46 @@ struct nfs_server {
145#define NFS_CAP_ACLS (1U << 3) 168#define NFS_CAP_ACLS (1U << 3)
146#define NFS_CAP_ATOMIC_OPEN (1U << 4) 169#define NFS_CAP_ATOMIC_OPEN (1U << 4)
147 170
171
172/* maximum number of slots to use */
173#define NFS4_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE
174
175#if defined(CONFIG_NFS_V4_1)
176
177/* Sessions */
178#define SLOT_TABLE_SZ (NFS4_MAX_SLOT_TABLE/(8*sizeof(long)))
179struct nfs4_slot_table {
180 struct nfs4_slot *slots; /* seqid per slot */
181 unsigned long used_slots[SLOT_TABLE_SZ]; /* used/unused bitmap */
182 spinlock_t slot_tbl_lock;
183 struct rpc_wait_queue slot_tbl_waitq; /* allocators may wait here */
184 int max_slots; /* # slots in table */
185 int highest_used_slotid; /* sent to server on each SEQ.
186 * op for dynamic resizing */
187};
188
189static inline int slot_idx(struct nfs4_slot_table *tbl, struct nfs4_slot *sp)
190{
191 return sp - tbl->slots;
192}
193
194/*
195 * Session related parameters
196 */
197struct nfs4_session {
198 struct nfs4_sessionid sess_id;
199 u32 flags;
200 unsigned long session_state;
201 u32 hash_alg;
202 u32 ssv_len;
203
204 /* The fore and back channel */
205 struct nfs4_channel_attrs fc_attrs;
206 struct nfs4_slot_table fc_slot_table;
207 struct nfs4_channel_attrs bc_attrs;
208 struct nfs4_slot_table bc_slot_table;
209 struct nfs_client *clp;
210};
211
212#endif /* CONFIG_NFS_V4_1 */
148#endif 213#endif
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index b89c34e40bc2..62f63fb0c4c8 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -145,6 +145,44 @@ struct nfs4_change_info {
145}; 145};
146 146
147struct nfs_seqid; 147struct nfs_seqid;
148
149/* nfs41 sessions channel attributes */
150struct nfs4_channel_attrs {
151 u32 headerpadsz;
152 u32 max_rqst_sz;
153 u32 max_resp_sz;
154 u32 max_resp_sz_cached;
155 u32 max_ops;
156 u32 max_reqs;
157};
158
159/* nfs41 sessions slot seqid */
160struct nfs4_slot {
161 u32 seq_nr;
162};
163
164struct nfs4_sequence_args {
165 struct nfs4_session *sa_session;
166 u8 sa_slotid;
167 u8 sa_cache_this;
168};
169
170struct nfs4_sequence_res {
171 struct nfs4_session *sr_session;
172 u8 sr_slotid; /* slot used to send request */
173 unsigned long sr_renewal_time;
174 int sr_status; /* sequence operation status */
175};
176
177struct nfs4_get_lease_time_args {
178 struct nfs4_sequence_args la_seq_args;
179};
180
181struct nfs4_get_lease_time_res {
182 struct nfs_fsinfo *lr_fsinfo;
183 struct nfs4_sequence_res lr_seq_res;
184};
185
148/* 186/*
149 * Arguments to the open call. 187 * Arguments to the open call.
150 */ 188 */
@@ -165,6 +203,7 @@ struct nfs_openargs {
165 const struct nfs_server *server; /* Needed for ID mapping */ 203 const struct nfs_server *server; /* Needed for ID mapping */
166 const u32 * bitmask; 204 const u32 * bitmask;
167 __u32 claim; 205 __u32 claim;
206 struct nfs4_sequence_args seq_args;
168}; 207};
169 208
170struct nfs_openres { 209struct nfs_openres {
@@ -181,6 +220,7 @@ struct nfs_openres {
181 __u32 do_recall; 220 __u32 do_recall;
182 __u64 maxsize; 221 __u64 maxsize;
183 __u32 attrset[NFS4_BITMAP_SIZE]; 222 __u32 attrset[NFS4_BITMAP_SIZE];
223 struct nfs4_sequence_res seq_res;
184}; 224};
185 225
186/* 226/*
@@ -206,6 +246,7 @@ struct nfs_closeargs {
206 struct nfs_seqid * seqid; 246 struct nfs_seqid * seqid;
207 fmode_t fmode; 247 fmode_t fmode;
208 const u32 * bitmask; 248 const u32 * bitmask;
249 struct nfs4_sequence_args seq_args;
209}; 250};
210 251
211struct nfs_closeres { 252struct nfs_closeres {
@@ -213,6 +254,7 @@ struct nfs_closeres {
213 struct nfs_fattr * fattr; 254 struct nfs_fattr * fattr;
214 struct nfs_seqid * seqid; 255 struct nfs_seqid * seqid;
215 const struct nfs_server *server; 256 const struct nfs_server *server;
257 struct nfs4_sequence_res seq_res;
216}; 258};
217/* 259/*
218 * * Arguments to the lock,lockt, and locku call. 260 * * Arguments to the lock,lockt, and locku call.
@@ -233,12 +275,14 @@ struct nfs_lock_args {
233 unsigned char block : 1; 275 unsigned char block : 1;
234 unsigned char reclaim : 1; 276 unsigned char reclaim : 1;
235 unsigned char new_lock_owner : 1; 277 unsigned char new_lock_owner : 1;
278 struct nfs4_sequence_args seq_args;
236}; 279};
237 280
238struct nfs_lock_res { 281struct nfs_lock_res {
239 nfs4_stateid stateid; 282 nfs4_stateid stateid;
240 struct nfs_seqid * lock_seqid; 283 struct nfs_seqid * lock_seqid;
241 struct nfs_seqid * open_seqid; 284 struct nfs_seqid * open_seqid;
285 struct nfs4_sequence_res seq_res;
242}; 286};
243 287
244struct nfs_locku_args { 288struct nfs_locku_args {
@@ -246,32 +290,38 @@ struct nfs_locku_args {
246 struct file_lock * fl; 290 struct file_lock * fl;
247 struct nfs_seqid * seqid; 291 struct nfs_seqid * seqid;
248 nfs4_stateid * stateid; 292 nfs4_stateid * stateid;
293 struct nfs4_sequence_args seq_args;
249}; 294};
250 295
251struct nfs_locku_res { 296struct nfs_locku_res {
252 nfs4_stateid stateid; 297 nfs4_stateid stateid;
253 struct nfs_seqid * seqid; 298 struct nfs_seqid * seqid;
299 struct nfs4_sequence_res seq_res;
254}; 300};
255 301
256struct nfs_lockt_args { 302struct nfs_lockt_args {
257 struct nfs_fh * fh; 303 struct nfs_fh * fh;
258 struct file_lock * fl; 304 struct file_lock * fl;
259 struct nfs_lowner lock_owner; 305 struct nfs_lowner lock_owner;
306 struct nfs4_sequence_args seq_args;
260}; 307};
261 308
262struct nfs_lockt_res { 309struct nfs_lockt_res {
263 struct file_lock * denied; /* LOCK, LOCKT failed */ 310 struct file_lock * denied; /* LOCK, LOCKT failed */
311 struct nfs4_sequence_res seq_res;
264}; 312};
265 313
266struct nfs4_delegreturnargs { 314struct nfs4_delegreturnargs {
267 const struct nfs_fh *fhandle; 315 const struct nfs_fh *fhandle;
268 const nfs4_stateid *stateid; 316 const nfs4_stateid *stateid;
269 const u32 * bitmask; 317 const u32 * bitmask;
318 struct nfs4_sequence_args seq_args;
270}; 319};
271 320
272struct nfs4_delegreturnres { 321struct nfs4_delegreturnres {
273 struct nfs_fattr * fattr; 322 struct nfs_fattr * fattr;
274 const struct nfs_server *server; 323 const struct nfs_server *server;
324 struct nfs4_sequence_res seq_res;
275}; 325};
276 326
277/* 327/*
@@ -284,12 +334,14 @@ struct nfs_readargs {
284 __u32 count; 334 __u32 count;
285 unsigned int pgbase; 335 unsigned int pgbase;
286 struct page ** pages; 336 struct page ** pages;
337 struct nfs4_sequence_args seq_args;
287}; 338};
288 339
289struct nfs_readres { 340struct nfs_readres {
290 struct nfs_fattr * fattr; 341 struct nfs_fattr * fattr;
291 __u32 count; 342 __u32 count;
292 int eof; 343 int eof;
344 struct nfs4_sequence_res seq_res;
293}; 345};
294 346
295/* 347/*
@@ -304,6 +356,7 @@ struct nfs_writeargs {
304 unsigned int pgbase; 356 unsigned int pgbase;
305 struct page ** pages; 357 struct page ** pages;
306 const u32 * bitmask; 358 const u32 * bitmask;
359 struct nfs4_sequence_args seq_args;
307}; 360};
308 361
309struct nfs_writeverf { 362struct nfs_writeverf {
@@ -316,6 +369,7 @@ struct nfs_writeres {
316 struct nfs_writeverf * verf; 369 struct nfs_writeverf * verf;
317 __u32 count; 370 __u32 count;
318 const struct nfs_server *server; 371 const struct nfs_server *server;
372 struct nfs4_sequence_res seq_res;
319}; 373};
320 374
321/* 375/*
@@ -325,12 +379,14 @@ struct nfs_removeargs {
325 const struct nfs_fh *fh; 379 const struct nfs_fh *fh;
326 struct qstr name; 380 struct qstr name;
327 const u32 * bitmask; 381 const u32 * bitmask;
382 struct nfs4_sequence_args seq_args;
328}; 383};
329 384
330struct nfs_removeres { 385struct nfs_removeres {
331 const struct nfs_server *server; 386 const struct nfs_server *server;
332 struct nfs4_change_info cinfo; 387 struct nfs4_change_info cinfo;
333 struct nfs_fattr dir_attr; 388 struct nfs_fattr dir_attr;
389 struct nfs4_sequence_res seq_res;
334}; 390};
335 391
336/* 392/*
@@ -383,6 +439,7 @@ struct nfs_setattrargs {
383 struct iattr * iap; 439 struct iattr * iap;
384 const struct nfs_server * server; /* Needed for name mapping */ 440 const struct nfs_server * server; /* Needed for name mapping */
385 const u32 * bitmask; 441 const u32 * bitmask;
442 struct nfs4_sequence_args seq_args;
386}; 443};
387 444
388struct nfs_setaclargs { 445struct nfs_setaclargs {
@@ -390,6 +447,11 @@ struct nfs_setaclargs {
390 size_t acl_len; 447 size_t acl_len;
391 unsigned int acl_pgbase; 448 unsigned int acl_pgbase;
392 struct page ** acl_pages; 449 struct page ** acl_pages;
450 struct nfs4_sequence_args seq_args;
451};
452
453struct nfs_setaclres {
454 struct nfs4_sequence_res seq_res;
393}; 455};
394 456
395struct nfs_getaclargs { 457struct nfs_getaclargs {
@@ -397,11 +459,18 @@ struct nfs_getaclargs {
397 size_t acl_len; 459 size_t acl_len;
398 unsigned int acl_pgbase; 460 unsigned int acl_pgbase;
399 struct page ** acl_pages; 461 struct page ** acl_pages;
462 struct nfs4_sequence_args seq_args;
463};
464
465struct nfs_getaclres {
466 size_t acl_len;
467 struct nfs4_sequence_res seq_res;
400}; 468};
401 469
402struct nfs_setattrres { 470struct nfs_setattrres {
403 struct nfs_fattr * fattr; 471 struct nfs_fattr * fattr;
404 const struct nfs_server * server; 472 const struct nfs_server * server;
473 struct nfs4_sequence_res seq_res;
405}; 474};
406 475
407struct nfs_linkargs { 476struct nfs_linkargs {
@@ -583,6 +652,7 @@ struct nfs4_accessargs {
583 const struct nfs_fh * fh; 652 const struct nfs_fh * fh;
584 const u32 * bitmask; 653 const u32 * bitmask;
585 u32 access; 654 u32 access;
655 struct nfs4_sequence_args seq_args;
586}; 656};
587 657
588struct nfs4_accessres { 658struct nfs4_accessres {
@@ -590,6 +660,7 @@ struct nfs4_accessres {
590 struct nfs_fattr * fattr; 660 struct nfs_fattr * fattr;
591 u32 supported; 661 u32 supported;
592 u32 access; 662 u32 access;
663 struct nfs4_sequence_res seq_res;
593}; 664};
594 665
595struct nfs4_create_arg { 666struct nfs4_create_arg {
@@ -609,6 +680,7 @@ struct nfs4_create_arg {
609 const struct iattr * attrs; 680 const struct iattr * attrs;
610 const struct nfs_fh * dir_fh; 681 const struct nfs_fh * dir_fh;
611 const u32 * bitmask; 682 const u32 * bitmask;
683 struct nfs4_sequence_args seq_args;
612}; 684};
613 685
614struct nfs4_create_res { 686struct nfs4_create_res {
@@ -617,21 +689,30 @@ struct nfs4_create_res {
617 struct nfs_fattr * fattr; 689 struct nfs_fattr * fattr;
618 struct nfs4_change_info dir_cinfo; 690 struct nfs4_change_info dir_cinfo;
619 struct nfs_fattr * dir_fattr; 691 struct nfs_fattr * dir_fattr;
692 struct nfs4_sequence_res seq_res;
620}; 693};
621 694
622struct nfs4_fsinfo_arg { 695struct nfs4_fsinfo_arg {
623 const struct nfs_fh * fh; 696 const struct nfs_fh * fh;
624 const u32 * bitmask; 697 const u32 * bitmask;
698 struct nfs4_sequence_args seq_args;
699};
700
701struct nfs4_fsinfo_res {
702 struct nfs_fsinfo *fsinfo;
703 struct nfs4_sequence_res seq_res;
625}; 704};
626 705
627struct nfs4_getattr_arg { 706struct nfs4_getattr_arg {
628 const struct nfs_fh * fh; 707 const struct nfs_fh * fh;
629 const u32 * bitmask; 708 const u32 * bitmask;
709 struct nfs4_sequence_args seq_args;
630}; 710};
631 711
632struct nfs4_getattr_res { 712struct nfs4_getattr_res {
633 const struct nfs_server * server; 713 const struct nfs_server * server;
634 struct nfs_fattr * fattr; 714 struct nfs_fattr * fattr;
715 struct nfs4_sequence_res seq_res;
635}; 716};
636 717
637struct nfs4_link_arg { 718struct nfs4_link_arg {
@@ -639,6 +720,7 @@ struct nfs4_link_arg {
639 const struct nfs_fh * dir_fh; 720 const struct nfs_fh * dir_fh;
640 const struct qstr * name; 721 const struct qstr * name;
641 const u32 * bitmask; 722 const u32 * bitmask;
723 struct nfs4_sequence_args seq_args;
642}; 724};
643 725
644struct nfs4_link_res { 726struct nfs4_link_res {
@@ -646,6 +728,7 @@ struct nfs4_link_res {
646 struct nfs_fattr * fattr; 728 struct nfs_fattr * fattr;
647 struct nfs4_change_info cinfo; 729 struct nfs4_change_info cinfo;
648 struct nfs_fattr * dir_attr; 730 struct nfs_fattr * dir_attr;
731 struct nfs4_sequence_res seq_res;
649}; 732};
650 733
651 734
@@ -653,21 +736,30 @@ struct nfs4_lookup_arg {
653 const struct nfs_fh * dir_fh; 736 const struct nfs_fh * dir_fh;
654 const struct qstr * name; 737 const struct qstr * name;
655 const u32 * bitmask; 738 const u32 * bitmask;
739 struct nfs4_sequence_args seq_args;
656}; 740};
657 741
658struct nfs4_lookup_res { 742struct nfs4_lookup_res {
659 const struct nfs_server * server; 743 const struct nfs_server * server;
660 struct nfs_fattr * fattr; 744 struct nfs_fattr * fattr;
661 struct nfs_fh * fh; 745 struct nfs_fh * fh;
746 struct nfs4_sequence_res seq_res;
662}; 747};
663 748
664struct nfs4_lookup_root_arg { 749struct nfs4_lookup_root_arg {
665 const u32 * bitmask; 750 const u32 * bitmask;
751 struct nfs4_sequence_args seq_args;
666}; 752};
667 753
668struct nfs4_pathconf_arg { 754struct nfs4_pathconf_arg {
669 const struct nfs_fh * fh; 755 const struct nfs_fh * fh;
670 const u32 * bitmask; 756 const u32 * bitmask;
757 struct nfs4_sequence_args seq_args;
758};
759
760struct nfs4_pathconf_res {
761 struct nfs_pathconf *pathconf;
762 struct nfs4_sequence_res seq_res;
671}; 763};
672 764
673struct nfs4_readdir_arg { 765struct nfs4_readdir_arg {
@@ -678,11 +770,13 @@ struct nfs4_readdir_arg {
678 struct page ** pages; /* zero-copy data */ 770 struct page ** pages; /* zero-copy data */
679 unsigned int pgbase; /* zero-copy data */ 771 unsigned int pgbase; /* zero-copy data */
680 const u32 * bitmask; 772 const u32 * bitmask;
773 struct nfs4_sequence_args seq_args;
681}; 774};
682 775
683struct nfs4_readdir_res { 776struct nfs4_readdir_res {
684 nfs4_verifier verifier; 777 nfs4_verifier verifier;
685 unsigned int pgbase; 778 unsigned int pgbase;
779 struct nfs4_sequence_res seq_res;
686}; 780};
687 781
688struct nfs4_readlink { 782struct nfs4_readlink {
@@ -690,6 +784,11 @@ struct nfs4_readlink {
690 unsigned int pgbase; 784 unsigned int pgbase;
691 unsigned int pglen; /* zero-copy data */ 785 unsigned int pglen; /* zero-copy data */
692 struct page ** pages; /* zero-copy data */ 786 struct page ** pages; /* zero-copy data */
787 struct nfs4_sequence_args seq_args;
788};
789
790struct nfs4_readlink_res {
791 struct nfs4_sequence_res seq_res;
693}; 792};
694 793
695struct nfs4_rename_arg { 794struct nfs4_rename_arg {
@@ -698,6 +797,7 @@ struct nfs4_rename_arg {
698 const struct qstr * old_name; 797 const struct qstr * old_name;
699 const struct qstr * new_name; 798 const struct qstr * new_name;
700 const u32 * bitmask; 799 const u32 * bitmask;
800 struct nfs4_sequence_args seq_args;
701}; 801};
702 802
703struct nfs4_rename_res { 803struct nfs4_rename_res {
@@ -706,6 +806,7 @@ struct nfs4_rename_res {
706 struct nfs_fattr * old_fattr; 806 struct nfs_fattr * old_fattr;
707 struct nfs4_change_info new_cinfo; 807 struct nfs4_change_info new_cinfo;
708 struct nfs_fattr * new_fattr; 808 struct nfs_fattr * new_fattr;
809 struct nfs4_sequence_res seq_res;
709}; 810};
710 811
711#define NFS4_SETCLIENTID_NAMELEN (127) 812#define NFS4_SETCLIENTID_NAMELEN (127)
@@ -724,6 +825,17 @@ struct nfs4_setclientid {
724struct nfs4_statfs_arg { 825struct nfs4_statfs_arg {
725 const struct nfs_fh * fh; 826 const struct nfs_fh * fh;
726 const u32 * bitmask; 827 const u32 * bitmask;
828 struct nfs4_sequence_args seq_args;
829};
830
831struct nfs4_statfs_res {
832 struct nfs_fsstat *fsstat;
833 struct nfs4_sequence_res seq_res;
834};
835
836struct nfs4_server_caps_arg {
837 struct nfs_fh *fhandle;
838 struct nfs4_sequence_args seq_args;
727}; 839};
728 840
729struct nfs4_server_caps_res { 841struct nfs4_server_caps_res {
@@ -731,6 +843,7 @@ struct nfs4_server_caps_res {
731 u32 acl_bitmask; 843 u32 acl_bitmask;
732 u32 has_links; 844 u32 has_links;
733 u32 has_symlinks; 845 u32 has_symlinks;
846 struct nfs4_sequence_res seq_res;
734}; 847};
735 848
736struct nfs4_string { 849struct nfs4_string {
@@ -765,10 +878,68 @@ struct nfs4_fs_locations_arg {
765 const struct qstr *name; 878 const struct qstr *name;
766 struct page *page; 879 struct page *page;
767 const u32 *bitmask; 880 const u32 *bitmask;
881 struct nfs4_sequence_args seq_args;
882};
883
884struct nfs4_fs_locations_res {
885 struct nfs4_fs_locations *fs_locations;
886 struct nfs4_sequence_res seq_res;
768}; 887};
769 888
770#endif /* CONFIG_NFS_V4 */ 889#endif /* CONFIG_NFS_V4 */
771 890
891struct nfstime4 {
892 u64 seconds;
893 u32 nseconds;
894};
895
896#ifdef CONFIG_NFS_V4_1
897struct nfs_impl_id4 {
898 u32 domain_len;
899 char *domain;
900 u32 name_len;
901 char *name;
902 struct nfstime4 date;
903};
904
905#define NFS4_EXCHANGE_ID_LEN (48)
906struct nfs41_exchange_id_args {
907 struct nfs_client *client;
908 nfs4_verifier *verifier;
909 unsigned int id_len;
910 char id[NFS4_EXCHANGE_ID_LEN];
911 u32 flags;
912};
913
914struct server_owner {
915 uint64_t minor_id;
916 uint32_t major_id_sz;
917 char major_id[NFS4_OPAQUE_LIMIT];
918};
919
920struct server_scope {
921 uint32_t server_scope_sz;
922 char server_scope[NFS4_OPAQUE_LIMIT];
923};
924
925struct nfs41_exchange_id_res {
926 struct nfs_client *client;
927 u32 flags;
928};
929
930struct nfs41_create_session_args {
931 struct nfs_client *client;
932 uint32_t flags;
933 uint32_t cb_program;
934 struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
935 struct nfs4_channel_attrs bc_attrs; /* Back Channel */
936};
937
938struct nfs41_create_session_res {
939 struct nfs_client *client;
940};
941#endif /* CONFIG_NFS_V4_1 */
942
772struct nfs_page; 943struct nfs_page;
773 944
774#define NFS_PAGEVEC_SIZE (8U) 945#define NFS_PAGEVEC_SIZE (8U)
diff --git a/include/linux/nfsd/cache.h b/include/linux/nfsd/cache.h
index 5bccaab81056..3a3f58934f5e 100644
--- a/include/linux/nfsd/cache.h
+++ b/include/linux/nfsd/cache.h
@@ -14,8 +14,7 @@
14#include <linux/uio.h> 14#include <linux/uio.h>
15 15
16/* 16/*
17 * Representation of a reply cache entry. The first two members *must* 17 * Representation of a reply cache entry.
18 * be hash_next and hash_prev.
19 */ 18 */
20struct svc_cacherep { 19struct svc_cacherep {
21 struct hlist_node c_hash; 20 struct hlist_node c_hash;
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index bcd0201589f8..a6d9ef2bb34a 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -125,11 +125,9 @@ void nfsd_export_flush(void);
125void exp_readlock(void); 125void exp_readlock(void);
126void exp_readunlock(void); 126void exp_readunlock(void);
127struct svc_export * rqst_exp_get_by_name(struct svc_rqst *, 127struct svc_export * rqst_exp_get_by_name(struct svc_rqst *,
128 struct vfsmount *, 128 struct path *);
129 struct dentry *);
130struct svc_export * rqst_exp_parent(struct svc_rqst *, 129struct svc_export * rqst_exp_parent(struct svc_rqst *,
131 struct vfsmount *mnt, 130 struct path *);
132 struct dentry *dentry);
133int exp_rootfh(struct auth_domain *, 131int exp_rootfh(struct auth_domain *,
134 char *path, struct knfsd_fh *, int maxsize); 132 char *path, struct knfsd_fh *, int maxsize);
135__be32 exp_pseudoroot(struct svc_rqst *, struct svc_fh *); 133__be32 exp_pseudoroot(struct svc_rqst *, struct svc_fh *);
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index afa19016c4a8..8f641c908450 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -151,9 +151,15 @@ typedef struct svc_fh {
151 __u64 fh_pre_size; /* size before operation */ 151 __u64 fh_pre_size; /* size before operation */
152 struct timespec fh_pre_mtime; /* mtime before oper */ 152 struct timespec fh_pre_mtime; /* mtime before oper */
153 struct timespec fh_pre_ctime; /* ctime before oper */ 153 struct timespec fh_pre_ctime; /* ctime before oper */
154 /*
155 * pre-op nfsv4 change attr: note must check IS_I_VERSION(inode)
156 * to find out if it is valid.
157 */
158 u64 fh_pre_change;
154 159
155 /* Post-op attributes saved in fh_unlock */ 160 /* Post-op attributes saved in fh_unlock */
156 struct kstat fh_post_attr; /* full attrs after operation */ 161 struct kstat fh_post_attr; /* full attrs after operation */
162 u64 fh_post_change; /* nfsv4 change; see above */
157#endif /* CONFIG_NFSD_V3 */ 163#endif /* CONFIG_NFSD_V3 */
158 164
159} svc_fh; 165} svc_fh;
@@ -298,6 +304,7 @@ fill_pre_wcc(struct svc_fh *fhp)
298 fhp->fh_pre_mtime = inode->i_mtime; 304 fhp->fh_pre_mtime = inode->i_mtime;
299 fhp->fh_pre_ctime = inode->i_ctime; 305 fhp->fh_pre_ctime = inode->i_ctime;
300 fhp->fh_pre_size = inode->i_size; 306 fhp->fh_pre_size = inode->i_size;
307 fhp->fh_pre_change = inode->i_version;
301 fhp->fh_pre_saved = 1; 308 fhp->fh_pre_saved = 1;
302 } 309 }
303} 310}
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index 4d61c873feed..57ab2ed08459 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -41,7 +41,6 @@
41#include <linux/kref.h> 41#include <linux/kref.h>
42#include <linux/sunrpc/clnt.h> 42#include <linux/sunrpc/clnt.h>
43 43
44#define NFS4_OPAQUE_LIMIT 1024
45typedef struct { 44typedef struct {
46 u32 cl_boot; 45 u32 cl_boot;
47 u32 cl_id; 46 u32 cl_id;
@@ -61,15 +60,6 @@ typedef struct {
61#define si_stateownerid si_opaque.so_stateownerid 60#define si_stateownerid si_opaque.so_stateownerid
62#define si_fileid si_opaque.so_fileid 61#define si_fileid si_opaque.so_fileid
63 62
64
65struct nfs4_cb_recall {
66 u32 cbr_ident;
67 int cbr_trunc;
68 stateid_t cbr_stateid;
69 struct knfsd_fh cbr_fh;
70 struct nfs4_delegation *cbr_dp;
71};
72
73struct nfs4_delegation { 63struct nfs4_delegation {
74 struct list_head dl_perfile; 64 struct list_head dl_perfile;
75 struct list_head dl_perclnt; 65 struct list_head dl_perclnt;
@@ -81,22 +71,25 @@ struct nfs4_delegation {
81 struct file *dl_vfs_file; 71 struct file *dl_vfs_file;
82 u32 dl_type; 72 u32 dl_type;
83 time_t dl_time; 73 time_t dl_time;
84 struct nfs4_cb_recall dl_recall; 74/* For recall: */
75 u32 dl_ident;
76 stateid_t dl_stateid;
77 struct knfsd_fh dl_fh;
78 int dl_retries;
85}; 79};
86 80
87#define dl_stateid dl_recall.cbr_stateid
88#define dl_fh dl_recall.cbr_fh
89
90/* client delegation callback info */ 81/* client delegation callback info */
91struct nfs4_callback { 82struct nfs4_cb_conn {
92 /* SETCLIENTID info */ 83 /* SETCLIENTID info */
93 u32 cb_addr; 84 u32 cb_addr;
94 unsigned short cb_port; 85 unsigned short cb_port;
95 u32 cb_prog; 86 u32 cb_prog;
96 u32 cb_ident; 87 u32 cb_minorversion;
88 u32 cb_ident; /* minorversion 0 only */
97 /* RPC client info */ 89 /* RPC client info */
98 atomic_t cb_set; /* successful CB_NULL call */ 90 atomic_t cb_set; /* successful CB_NULL call */
99 struct rpc_clnt * cb_client; 91 struct rpc_clnt * cb_client;
92 struct rpc_cred * cb_cred;
100}; 93};
101 94
102/* Maximum number of slots per session. 128 is useful for long haul TCP */ 95/* Maximum number of slots per session. 128 is useful for long haul TCP */
@@ -122,6 +115,17 @@ struct nfsd4_slot {
122 struct nfsd4_cache_entry sl_cache_entry; 115 struct nfsd4_cache_entry sl_cache_entry;
123}; 116};
124 117
118struct nfsd4_channel_attrs {
119 u32 headerpadsz;
120 u32 maxreq_sz;
121 u32 maxresp_sz;
122 u32 maxresp_cached;
123 u32 maxops;
124 u32 maxreqs;
125 u32 nr_rdma_attrs;
126 u32 rdma_attrs;
127};
128
125struct nfsd4_session { 129struct nfsd4_session {
126 struct kref se_ref; 130 struct kref se_ref;
127 struct list_head se_hash; /* hash by sessionid */ 131 struct list_head se_hash; /* hash by sessionid */
@@ -129,11 +133,8 @@ struct nfsd4_session {
129 u32 se_flags; 133 u32 se_flags;
130 struct nfs4_client *se_client; /* for expire_client */ 134 struct nfs4_client *se_client; /* for expire_client */
131 struct nfs4_sessionid se_sessionid; 135 struct nfs4_sessionid se_sessionid;
132 u32 se_fmaxreq_sz; 136 struct nfsd4_channel_attrs se_fchannel;
133 u32 se_fmaxresp_sz; 137 struct nfsd4_channel_attrs se_bchannel;
134 u32 se_fmaxresp_cached;
135 u32 se_fmaxops;
136 u32 se_fnumslots;
137 struct nfsd4_slot se_slots[]; /* forward channel slots */ 138 struct nfsd4_slot se_slots[]; /* forward channel slots */
138}; 139};
139 140
@@ -185,7 +186,7 @@ struct nfs4_client {
185 struct svc_cred cl_cred; /* setclientid principal */ 186 struct svc_cred cl_cred; /* setclientid principal */
186 clientid_t cl_clientid; /* generated by server */ 187 clientid_t cl_clientid; /* generated by server */
187 nfs4_verifier cl_confirm; /* generated by server */ 188 nfs4_verifier cl_confirm; /* generated by server */
188 struct nfs4_callback cl_callback; /* callback info */ 189 struct nfs4_cb_conn cl_cb_conn; /* callback info */
189 atomic_t cl_count; /* ref count */ 190 atomic_t cl_count; /* ref count */
190 u32 cl_firststate; /* recovery dir creation */ 191 u32 cl_firststate; /* recovery dir creation */
191 192
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
index f80d6013fdc3..2bacf7535069 100644
--- a/include/linux/nfsd/xdr4.h
+++ b/include/linux/nfsd/xdr4.h
@@ -64,10 +64,13 @@ static inline bool nfsd4_has_session(struct nfsd4_compound_state *cs)
64 64
65struct nfsd4_change_info { 65struct nfsd4_change_info {
66 u32 atomic; 66 u32 atomic;
67 bool change_supported;
67 u32 before_ctime_sec; 68 u32 before_ctime_sec;
68 u32 before_ctime_nsec; 69 u32 before_ctime_nsec;
70 u64 before_change;
69 u32 after_ctime_sec; 71 u32 after_ctime_sec;
70 u32 after_ctime_nsec; 72 u32 after_ctime_nsec;
73 u64 after_change;
71}; 74};
72 75
73struct nfsd4_access { 76struct nfsd4_access {
@@ -363,17 +366,6 @@ struct nfsd4_exchange_id {
363 int spa_how; 366 int spa_how;
364}; 367};
365 368
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 { 369struct nfsd4_create_session {
378 clientid_t clientid; 370 clientid_t clientid;
379 struct nfs4_sessionid sessionid; 371 struct nfs4_sessionid sessionid;
@@ -503,10 +495,16 @@ set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
503{ 495{
504 BUG_ON(!fhp->fh_pre_saved || !fhp->fh_post_saved); 496 BUG_ON(!fhp->fh_pre_saved || !fhp->fh_post_saved);
505 cinfo->atomic = 1; 497 cinfo->atomic = 1;
506 cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec; 498 cinfo->change_supported = IS_I_VERSION(fhp->fh_dentry->d_inode);
507 cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec; 499 if (cinfo->change_supported) {
508 cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec; 500 cinfo->before_change = fhp->fh_pre_change;
509 cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec; 501 cinfo->after_change = fhp->fh_post_change;
502 } else {
503 cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec;
504 cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec;
505 cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec;
506 cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec;
507 }
510} 508}
511 509
512int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *); 510int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *);
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index cbe8ce3bf486..dbea93b694e5 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -7,7 +7,7 @@
7 * Copyright 2008 Michael Wu <flamingice@sourmilk.net> 7 * Copyright 2008 Michael Wu <flamingice@sourmilk.net>
8 * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com> 8 * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com>
9 * Copyright 2008 Michael Buesch <mb@bu3sch.de> 9 * Copyright 2008 Michael Buesch <mb@bu3sch.de>
10 * Copyright 2008 Luis R. Rodriguez <lrodriguez@atheros.com> 10 * Copyright 2008, 2009 Luis R. Rodriguez <lrodriguez@atheros.com>
11 * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com> 11 * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
12 * Copyright 2008 Colin McCabe <colin@cozybit.com> 12 * Copyright 2008 Colin McCabe <colin@cozybit.com>
13 * 13 *
@@ -25,6 +25,8 @@
25 * 25 *
26 */ 26 */
27 27
28#include <linux/types.h>
29
28/** 30/**
29 * DOC: Station handling 31 * DOC: Station handling
30 * 32 *
@@ -46,8 +48,10 @@
46 * to get a list of all present wiphys. 48 * to get a list of all present wiphys.
47 * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or 49 * @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, 50 * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME,
49 * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, and/or 51 * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ,
50 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE. 52 * %NL80211_ATTR_WIPHY_CHANNEL_TYPE, %NL80211_ATTR_WIPHY_RETRY_SHORT,
53 * %NL80211_ATTR_WIPHY_RETRY_LONG, %NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
54 * and/or %NL80211_ATTR_WIPHY_RTS_THRESHOLD.
51 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request 55 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
52 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and 56 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and
53 * %NL80211_ATTR_WIPHY_NAME. 57 * %NL80211_ATTR_WIPHY_NAME.
@@ -75,8 +79,8 @@
75 * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT, 79 * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT,
76 * %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD. 80 * %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD.
77 * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA, 81 * @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 82 * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC, %NL80211_ATTR_KEY_CIPHER,
79 * attributes. 83 * and %NL80211_ATTR_KEY_SEQ attributes.
80 * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX 84 * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX
81 * or %NL80211_ATTR_MAC. 85 * or %NL80211_ATTR_MAC.
82 * 86 *
@@ -166,6 +170,22 @@
166 * set (%NL80211_ATTR_REG_TYPE), if the type of regulatory domain is 170 * 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 171 * %NL80211_REG_TYPE_COUNTRY the alpha2 to which we have moved on
168 * to (%NL80211_ATTR_REG_ALPHA2). 172 * to (%NL80211_ATTR_REG_ALPHA2).
173 * @NL80211_CMD_REG_BEACON_HINT: indicates to userspace that an AP beacon
174 * has been found while world roaming thus enabling active scan or
175 * any mode of operation that initiates TX (beacons) on a channel
176 * where we would not have been able to do either before. As an example
177 * if you are world roaming (regulatory domain set to world or if your
178 * driver is using a custom world roaming regulatory domain) and while
179 * doing a passive scan on the 5 GHz band you find an AP there (if not
180 * on a DFS channel) you will now be able to actively scan for that AP
181 * or use AP mode on your card on that same channel. Note that this will
182 * never be used for channels 1-11 on the 2 GHz band as they are always
183 * enabled world wide. This beacon hint is only sent if your device had
184 * either disabled active scanning or beaconing on a channel. We send to
185 * userspace the wiphy on which we removed a restriction from
186 * (%NL80211_ATTR_WIPHY) and the channel on which this occurred
187 * before (%NL80211_ATTR_FREQ_BEFORE) and after (%NL80211_ATTR_FREQ_AFTER)
188 * the beacon hint was processed.
169 * 189 *
170 * @NL80211_CMD_AUTHENTICATE: authentication request and notification. 190 * @NL80211_CMD_AUTHENTICATE: authentication request and notification.
171 * This command is used both as a command (request to authenticate) and 191 * This command is used both as a command (request to authenticate) and
@@ -185,8 +205,12 @@
185 * frame, i.e., it was for the local STA and was received in correct 205 * 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 206 * state. This is similar to MLME-AUTHENTICATE.confirm primitive in the
187 * MLME SAP interface (kernel providing MLME, userspace SME). The 207 * MLME SAP interface (kernel providing MLME, userspace SME). The
188 * included NL80211_ATTR_FRAME attribute contains the management frame 208 * included %NL80211_ATTR_FRAME attribute contains the management frame
189 * (including both the header and frame body, but not FCS). 209 * (including both the header and frame body, but not FCS). This event is
210 * also used to indicate if the authentication attempt timed out. In that
211 * case the %NL80211_ATTR_FRAME attribute is replaced with a
212 * %NL80211_ATTR_TIMED_OUT flag (and %NL80211_ATTR_MAC to indicate which
213 * pending authentication timed out).
190 * @NL80211_CMD_ASSOCIATE: association request and notification; like 214 * @NL80211_CMD_ASSOCIATE: association request and notification; like
191 * NL80211_CMD_AUTHENTICATE but for Association and Reassociation 215 * NL80211_CMD_AUTHENTICATE but for Association and Reassociation
192 * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request, 216 * (similar to MLME-ASSOCIATE.request, MLME-REASSOCIATE.request,
@@ -199,6 +223,25 @@
199 * NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to 223 * NL80211_CMD_AUTHENTICATE but for Disassociation frames (similar to
200 * MLME-DISASSOCIATE.request and MLME-DISASSOCIATE.indication primitives). 224 * MLME-DISASSOCIATE.request and MLME-DISASSOCIATE.indication primitives).
201 * 225 *
226 * @NL80211_CMD_MICHAEL_MIC_FAILURE: notification of a locally detected Michael
227 * MIC (part of TKIP) failure; sent on the "mlme" multicast group; the
228 * event includes %NL80211_ATTR_MAC to describe the source MAC address of
229 * the frame with invalid MIC, %NL80211_ATTR_KEY_TYPE to show the key
230 * type, %NL80211_ATTR_KEY_IDX to indicate the key identifier, and
231 * %NL80211_ATTR_KEY_SEQ to indicate the TSC value of the frame; this
232 * event matches with MLME-MICHAELMICFAILURE.indication() primitive
233 *
234 * @NL80211_CMD_JOIN_IBSS: Join a new IBSS -- given at least an SSID and a
235 * FREQ attribute (for the initial frequency if no peer can be found)
236 * and optionally a MAC (as BSSID) and FREQ_FIXED attribute if those
237 * should be fixed rather than automatically determined. Can only be
238 * executed on a network interface that is UP, and fixed BSSID/FREQ
239 * may be rejected. Another optional parameter is the beacon interval,
240 * given in the %NL80211_ATTR_BEACON_INTERVAL attribute, which if not
241 * given defaults to 100 TU (102.4ms).
242 * @NL80211_CMD_LEAVE_IBSS: Leave the IBSS -- no special arguments, the IBSS is
243 * determined by the network interface.
244 *
202 * @NL80211_CMD_MAX: highest used command number 245 * @NL80211_CMD_MAX: highest used command number
203 * @__NL80211_CMD_AFTER_LAST: internal use 246 * @__NL80211_CMD_AFTER_LAST: internal use
204 */ 247 */
@@ -260,6 +303,13 @@ enum nl80211_commands {
260 NL80211_CMD_DEAUTHENTICATE, 303 NL80211_CMD_DEAUTHENTICATE,
261 NL80211_CMD_DISASSOCIATE, 304 NL80211_CMD_DISASSOCIATE,
262 305
306 NL80211_CMD_MICHAEL_MIC_FAILURE,
307
308 NL80211_CMD_REG_BEACON_HINT,
309
310 NL80211_CMD_JOIN_IBSS,
311 NL80211_CMD_LEAVE_IBSS,
312
263 /* add new commands above here */ 313 /* add new commands above here */
264 314
265 /* used to define NL80211_CMD_MAX below */ 315 /* used to define NL80211_CMD_MAX below */
@@ -278,6 +328,7 @@ enum nl80211_commands {
278#define NL80211_CMD_ASSOCIATE NL80211_CMD_ASSOCIATE 328#define NL80211_CMD_ASSOCIATE NL80211_CMD_ASSOCIATE
279#define NL80211_CMD_DEAUTHENTICATE NL80211_CMD_DEAUTHENTICATE 329#define NL80211_CMD_DEAUTHENTICATE NL80211_CMD_DEAUTHENTICATE
280#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE 330#define NL80211_CMD_DISASSOCIATE NL80211_CMD_DISASSOCIATE
331#define NL80211_CMD_REG_BEACON_HINT NL80211_CMD_REG_BEACON_HINT
281 332
282/** 333/**
283 * enum nl80211_attrs - nl80211 netlink attributes 334 * enum nl80211_attrs - nl80211 netlink attributes
@@ -296,6 +347,18 @@ enum nl80211_commands {
296 * NL80211_CHAN_HT20 = HT20 only 347 * NL80211_CHAN_HT20 = HT20 only
297 * NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel 348 * NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel
298 * NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel 349 * NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel
350 * @NL80211_ATTR_WIPHY_RETRY_SHORT: TX retry limit for frames whose length is
351 * less than or equal to the RTS threshold; allowed range: 1..255;
352 * dot11ShortRetryLimit; u8
353 * @NL80211_ATTR_WIPHY_RETRY_LONG: TX retry limit for frames whose length is
354 * greater than the RTS threshold; allowed range: 1..255;
355 * dot11ShortLongLimit; u8
356 * @NL80211_ATTR_WIPHY_FRAG_THRESHOLD: fragmentation threshold, i.e., maximum
357 * length in octets for frames; allowed range: 256..8000, disable
358 * fragmentation with (u32)-1; dot11FragmentationThreshold; u32
359 * @NL80211_ATTR_WIPHY_RTS_THRESHOLD: RTS threshold (TX frames with length
360 * larger than or equal to this use RTS/CTS handshake); allowed range:
361 * 0..65536, disable with (u32)-1; dot11RTSThreshold; u32
299 * 362 *
300 * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on 363 * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on
301 * @NL80211_ATTR_IFNAME: network interface name 364 * @NL80211_ATTR_IFNAME: network interface name
@@ -319,7 +382,7 @@ enum nl80211_commands {
319 * 382 *
320 * @NL80211_ATTR_STA_AID: Association ID for the station (u16) 383 * @NL80211_ATTR_STA_AID: Association ID for the station (u16)
321 * @NL80211_ATTR_STA_FLAGS: flags, nested element with NLA_FLAG attributes of 384 * @NL80211_ATTR_STA_FLAGS: flags, nested element with NLA_FLAG attributes of
322 * &enum nl80211_sta_flags. 385 * &enum nl80211_sta_flags (deprecated, use %NL80211_ATTR_STA_FLAGS2)
323 * @NL80211_ATTR_STA_LISTEN_INTERVAL: listen interval as defined by 386 * @NL80211_ATTR_STA_LISTEN_INTERVAL: listen interval as defined by
324 * IEEE 802.11 7.3.1.6 (u16). 387 * IEEE 802.11 7.3.1.6 (u16).
325 * @NL80211_ATTR_STA_SUPPORTED_RATES: supported rates, array of supported 388 * @NL80211_ATTR_STA_SUPPORTED_RATES: supported rates, array of supported
@@ -380,6 +443,8 @@ enum nl80211_commands {
380 * 443 *
381 * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with 444 * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with
382 * a single scan request, a wiphy attribute. 445 * a single scan request, a wiphy attribute.
446 * @NL80211_ATTR_MAX_SCAN_IE_LEN: maximum length of information elements
447 * that can be added to a scan request
383 * 448 *
384 * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz) 449 * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz)
385 * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive 450 * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive
@@ -408,6 +473,44 @@ enum nl80211_commands {
408 * @NL80211_ATTR_REASON_CODE: ReasonCode for %NL80211_CMD_DEAUTHENTICATE and 473 * @NL80211_ATTR_REASON_CODE: ReasonCode for %NL80211_CMD_DEAUTHENTICATE and
409 * %NL80211_CMD_DISASSOCIATE, u16 474 * %NL80211_CMD_DISASSOCIATE, u16
410 * 475 *
476 * @NL80211_ATTR_KEY_TYPE: Key Type, see &enum nl80211_key_type, represented as
477 * a u32
478 *
479 * @NL80211_ATTR_FREQ_BEFORE: A channel which has suffered a regulatory change
480 * due to considerations from a beacon hint. This attribute reflects
481 * the state of the channel _before_ the beacon hint processing. This
482 * attributes consists of a nested attribute containing
483 * NL80211_FREQUENCY_ATTR_*
484 * @NL80211_ATTR_FREQ_AFTER: A channel which has suffered a regulatory change
485 * due to considerations from a beacon hint. This attribute reflects
486 * the state of the channel _after_ the beacon hint processing. This
487 * attributes consists of a nested attribute containing
488 * NL80211_FREQUENCY_ATTR_*
489 *
490 * @NL80211_ATTR_CIPHER_SUITES: a set of u32 values indicating the supported
491 * cipher suites
492 *
493 * @NL80211_ATTR_FREQ_FIXED: a flag indicating the IBSS should not try to look
494 * for other networks on different channels
495 *
496 * @NL80211_ATTR_TIMED_OUT: a flag indicating than an operation timed out; this
497 * is used, e.g., with %NL80211_CMD_AUTHENTICATE event
498 *
499 * @NL80211_ATTR_USE_MFP: Whether management frame protection (IEEE 802.11w) is
500 * used for the association (&enum nl80211_mfp, represented as a u32);
501 * this attribute can be used
502 * with %NL80211_CMD_ASSOCIATE request
503 *
504 * @NL80211_ATTR_STA_FLAGS2: Attribute containing a
505 * &struct nl80211_sta_flag_update.
506 *
507 * @NL80211_ATTR_CONTROL_PORT: A flag indicating whether user space controls
508 * IEEE 802.1X port, i.e., sets/clears %NL80211_STA_FLAG_AUTHORIZED, in
509 * station mode. If the flag is included in %NL80211_CMD_ASSOCIATE
510 * request, the driver will assume that the port is unauthorized until
511 * authorized by user space. Otherwise, port is marked authorized by
512 * default in station mode.
513 *
411 * @NL80211_ATTR_MAX: highest attribute number currently defined 514 * @NL80211_ATTR_MAX: highest attribute number currently defined
412 * @__NL80211_ATTR_AFTER_LAST: internal use 515 * @__NL80211_ATTR_AFTER_LAST: internal use
413 */ 516 */
@@ -492,6 +595,30 @@ enum nl80211_attrs {
492 NL80211_ATTR_AUTH_TYPE, 595 NL80211_ATTR_AUTH_TYPE,
493 NL80211_ATTR_REASON_CODE, 596 NL80211_ATTR_REASON_CODE,
494 597
598 NL80211_ATTR_KEY_TYPE,
599
600 NL80211_ATTR_MAX_SCAN_IE_LEN,
601 NL80211_ATTR_CIPHER_SUITES,
602
603 NL80211_ATTR_FREQ_BEFORE,
604 NL80211_ATTR_FREQ_AFTER,
605
606 NL80211_ATTR_FREQ_FIXED,
607
608
609 NL80211_ATTR_WIPHY_RETRY_SHORT,
610 NL80211_ATTR_WIPHY_RETRY_LONG,
611 NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
612 NL80211_ATTR_WIPHY_RTS_THRESHOLD,
613
614 NL80211_ATTR_TIMED_OUT,
615
616 NL80211_ATTR_USE_MFP,
617
618 NL80211_ATTR_STA_FLAGS2,
619
620 NL80211_ATTR_CONTROL_PORT,
621
495 /* add attributes here, update the policy in nl80211.c */ 622 /* add attributes here, update the policy in nl80211.c */
496 623
497 __NL80211_ATTR_AFTER_LAST, 624 __NL80211_ATTR_AFTER_LAST,
@@ -581,6 +708,18 @@ enum nl80211_sta_flags {
581}; 708};
582 709
583/** 710/**
711 * struct nl80211_sta_flag_update - station flags mask/set
712 * @mask: mask of station flags to set
713 * @set: which values to set them to
714 *
715 * Both mask and set contain bits as per &enum nl80211_sta_flags.
716 */
717struct nl80211_sta_flag_update {
718 __u32 mask;
719 __u32 set;
720} __attribute__((packed));
721
722/**
584 * enum nl80211_rate_info - bitrate information 723 * enum nl80211_rate_info - bitrate information
585 * 724 *
586 * These attribute types are used with %NL80211_STA_INFO_TXRATE 725 * These attribute types are used with %NL80211_STA_INFO_TXRATE
@@ -1062,4 +1201,27 @@ enum nl80211_auth_type {
1062 NL80211_AUTHTYPE_FT, 1201 NL80211_AUTHTYPE_FT,
1063 NL80211_AUTHTYPE_NETWORK_EAP, 1202 NL80211_AUTHTYPE_NETWORK_EAP,
1064}; 1203};
1204
1205/**
1206 * enum nl80211_key_type - Key Type
1207 * @NL80211_KEYTYPE_GROUP: Group (broadcast/multicast) key
1208 * @NL80211_KEYTYPE_PAIRWISE: Pairwise (unicast/individual) key
1209 * @NL80211_KEYTYPE_PEERKEY: PeerKey (DLS)
1210 */
1211enum nl80211_key_type {
1212 NL80211_KEYTYPE_GROUP,
1213 NL80211_KEYTYPE_PAIRWISE,
1214 NL80211_KEYTYPE_PEERKEY,
1215};
1216
1217/**
1218 * enum nl80211_mfp - Management frame protection state
1219 * @NL80211_MFP_NO: Management frame protection not used
1220 * @NL80211_MFP_REQUIRED: Management frame protection required
1221 */
1222enum nl80211_mfp {
1223 NL80211_MFP_NO,
1224 NL80211_MFP_REQUIRED,
1225};
1226
1065#endif /* __LINUX_NL80211_H */ 1227#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/nl802154.h b/include/linux/nl802154.h
new file mode 100644
index 000000000000..2cda00ccfcca
--- /dev/null
+++ b/include/linux/nl802154.h
@@ -0,0 +1,119 @@
1/*
2 * nl802154.h
3 *
4 * Copyright (C) 2007, 2008, 2009 Siemens AG
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#ifndef NL802154_H
22#define NL802154_H
23
24#define IEEE802154_NL_NAME "802.15.4 MAC"
25#define IEEE802154_MCAST_COORD_NAME "coordinator"
26#define IEEE802154_MCAST_BEACON_NAME "beacon"
27
28enum {
29 __IEEE802154_ATTR_INVALID,
30
31 IEEE802154_ATTR_DEV_NAME,
32 IEEE802154_ATTR_DEV_INDEX,
33
34 IEEE802154_ATTR_STATUS,
35
36 IEEE802154_ATTR_SHORT_ADDR,
37 IEEE802154_ATTR_HW_ADDR,
38 IEEE802154_ATTR_PAN_ID,
39
40 IEEE802154_ATTR_CHANNEL,
41
42 IEEE802154_ATTR_COORD_SHORT_ADDR,
43 IEEE802154_ATTR_COORD_HW_ADDR,
44 IEEE802154_ATTR_COORD_PAN_ID,
45
46 IEEE802154_ATTR_SRC_SHORT_ADDR,
47 IEEE802154_ATTR_SRC_HW_ADDR,
48 IEEE802154_ATTR_SRC_PAN_ID,
49
50 IEEE802154_ATTR_DEST_SHORT_ADDR,
51 IEEE802154_ATTR_DEST_HW_ADDR,
52 IEEE802154_ATTR_DEST_PAN_ID,
53
54 IEEE802154_ATTR_CAPABILITY,
55 IEEE802154_ATTR_REASON,
56 IEEE802154_ATTR_SCAN_TYPE,
57 IEEE802154_ATTR_CHANNELS,
58 IEEE802154_ATTR_DURATION,
59 IEEE802154_ATTR_ED_LIST,
60 IEEE802154_ATTR_BCN_ORD,
61 IEEE802154_ATTR_SF_ORD,
62 IEEE802154_ATTR_PAN_COORD,
63 IEEE802154_ATTR_BAT_EXT,
64 IEEE802154_ATTR_COORD_REALIGN,
65 IEEE802154_ATTR_SEC,
66
67 __IEEE802154_ATTR_MAX,
68};
69
70#define IEEE802154_ATTR_MAX (__IEEE802154_ATTR_MAX - 1)
71
72extern struct nla_policy ieee802154_policy[];
73
74/* commands */
75/* REQ should be responded with CONF
76 * and INDIC with RESP
77 */
78enum {
79 __IEEE802154_COMMAND_INVALID,
80
81 IEEE802154_ASSOCIATE_REQ,
82 IEEE802154_ASSOCIATE_CONF,
83 IEEE802154_DISASSOCIATE_REQ,
84 IEEE802154_DISASSOCIATE_CONF,
85 IEEE802154_GET_REQ,
86 IEEE802154_GET_CONF,
87 IEEE802154_RESET_REQ,
88 IEEE802154_RESET_CONF,
89 IEEE802154_SCAN_REQ,
90 IEEE802154_SCAN_CONF,
91 IEEE802154_SET_REQ,
92 IEEE802154_SET_CONF,
93 IEEE802154_START_REQ,
94 IEEE802154_START_CONF,
95 IEEE802154_SYNC_REQ,
96 IEEE802154_POLL_REQ,
97 IEEE802154_POLL_CONF,
98
99 IEEE802154_ASSOCIATE_INDIC,
100 IEEE802154_ASSOCIATE_RESP,
101 IEEE802154_DISASSOCIATE_INDIC,
102 IEEE802154_BEACON_NOTIFY_INDIC,
103 IEEE802154_ORPHAN_INDIC,
104 IEEE802154_ORPHAN_RESP,
105 IEEE802154_COMM_STATUS_INDIC,
106 IEEE802154_SYNC_LOSS_INDIC,
107
108 IEEE802154_GTS_REQ, /* Not supported yet */
109 IEEE802154_GTS_INDIC, /* Not supported yet */
110 IEEE802154_GTS_CONF, /* Not supported yet */
111 IEEE802154_RX_ENABLE_REQ, /* Not supported yet */
112 IEEE802154_RX_ENABLE_CONF, /* Not supported yet */
113
114 __IEEE802154_CMD_MAX,
115};
116
117#define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1)
118
119#endif
diff --git a/include/linux/nls.h b/include/linux/nls.h
index 52b1a76c1b43..d47beef08dfd 100644
--- a/include/linux/nls.h
+++ b/include/linux/nls.h
@@ -3,8 +3,23 @@
3 3
4#include <linux/init.h> 4#include <linux/init.h>
5 5
6/* unicode character */ 6/* Unicode has changed over the years. Unicode code points no longer
7typedef __u16 wchar_t; 7 * fit into 16 bits; as of Unicode 5 valid code points range from 0
8 * to 0x10ffff (17 planes, where each plane holds 65536 code points).
9 *
10 * The original decision to represent Unicode characters as 16-bit
11 * wchar_t values is now outdated. But plane 0 still includes the
12 * most commonly used characters, so we will retain it. The newer
13 * 32-bit unicode_t type can be used when it is necessary to
14 * represent the full Unicode character set.
15 */
16
17/* Plane-0 Unicode character */
18typedef u16 wchar_t;
19#define MAX_WCHAR_T 0xffff
20
21/* Arbitrary Unicode character */
22typedef u32 unicode_t;
8 23
9struct nls_table { 24struct nls_table {
10 const char *charset; 25 const char *charset;
@@ -21,6 +36,13 @@ struct nls_table {
21/* this value hold the maximum octet of charset */ 36/* this value hold the maximum octet of charset */
22#define NLS_MAX_CHARSET_SIZE 6 /* for UTF-8 */ 37#define NLS_MAX_CHARSET_SIZE 6 /* for UTF-8 */
23 38
39/* Byte order for UTF-16 strings */
40enum utf16_endian {
41 UTF16_HOST_ENDIAN,
42 UTF16_LITTLE_ENDIAN,
43 UTF16_BIG_ENDIAN
44};
45
24/* nls.c */ 46/* nls.c */
25extern int register_nls(struct nls_table *); 47extern int register_nls(struct nls_table *);
26extern int unregister_nls(struct nls_table *); 48extern int unregister_nls(struct nls_table *);
@@ -28,10 +50,11 @@ extern struct nls_table *load_nls(char *);
28extern void unload_nls(struct nls_table *); 50extern void unload_nls(struct nls_table *);
29extern struct nls_table *load_nls_default(void); 51extern struct nls_table *load_nls_default(void);
30 52
31extern int utf8_mbtowc(wchar_t *, const __u8 *, int); 53extern int utf8_to_utf32(const u8 *s, int len, unicode_t *pu);
32extern int utf8_mbstowcs(wchar_t *, const __u8 *, int); 54extern int utf32_to_utf8(unicode_t u, u8 *s, int maxlen);
33extern int utf8_wctomb(__u8 *, wchar_t, int); 55extern int utf8s_to_utf16s(const u8 *s, int len, wchar_t *pwcs);
34extern int utf8_wcstombs(__u8 *, const wchar_t *, int); 56extern int utf16s_to_utf8s(const wchar_t *pwcs, int len,
57 enum utf16_endian endian, u8 *s, int maxlen);
35 58
36static inline unsigned char nls_tolower(struct nls_table *t, unsigned char c) 59static inline unsigned char nls_tolower(struct nls_table *t, unsigned char c)
37{ 60{
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 848025cd7087..829b94b156f2 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -408,6 +408,19 @@ static inline int num_node_state(enum node_states state)
408#define next_online_node(nid) next_node((nid), node_states[N_ONLINE]) 408#define next_online_node(nid) next_node((nid), node_states[N_ONLINE])
409 409
410extern int nr_node_ids; 410extern int nr_node_ids;
411extern int nr_online_nodes;
412
413static inline void node_set_online(int nid)
414{
415 node_set_state(nid, N_ONLINE);
416 nr_online_nodes = num_node_state(N_ONLINE);
417}
418
419static inline void node_set_offline(int nid)
420{
421 node_clear_state(nid, N_ONLINE);
422 nr_online_nodes = num_node_state(N_ONLINE);
423}
411#else 424#else
412 425
413static inline int node_state(int node, enum node_states state) 426static inline int node_state(int node, enum node_states state)
@@ -434,7 +447,10 @@ static inline int num_node_state(enum node_states state)
434#define first_online_node 0 447#define first_online_node 0
435#define next_online_node(nid) (MAX_NUMNODES) 448#define next_online_node(nid) (MAX_NUMNODES)
436#define nr_node_ids 1 449#define nr_node_ids 1
450#define nr_online_nodes 1
437 451
452#define node_set_online(node) node_set_state((node), N_ONLINE)
453#define node_set_offline(node) node_clear_state((node), N_ONLINE)
438#endif 454#endif
439 455
440#define node_online_map node_states[N_ONLINE] 456#define node_online_map node_states[N_ONLINE]
@@ -454,9 +470,6 @@ static inline int num_node_state(enum node_states state)
454#define node_online(node) node_state((node), N_ONLINE) 470#define node_online(node) node_state((node), N_ONLINE)
455#define node_possible(node) node_state((node), N_POSSIBLE) 471#define node_possible(node) node_state((node), N_POSSIBLE)
456 472
457#define node_set_online(node) node_set_state((node), N_ONLINE)
458#define node_set_offline(node) node_clear_state((node), N_ONLINE)
459
460#define for_each_node(node) for_each_node_state(node, N_POSSIBLE) 473#define for_each_node(node) for_each_node_state(node, N_POSSIBLE)
461#define for_each_online_node(node) for_each_node_state(node, N_ONLINE) 474#define for_each_online_node(node) for_each_node_state(node, N_ONLINE)
462 475
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index b86fa2ffca0c..81bc252dc8ac 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -198,6 +198,7 @@ static inline int notifier_to_errno(int ret)
198#define NETDEV_CHANGENAME 0x000A 198#define NETDEV_CHANGENAME 0x000A
199#define NETDEV_FEAT_CHANGE 0x000B 199#define NETDEV_FEAT_CHANGE 0x000B
200#define NETDEV_BONDING_FAILOVER 0x000C 200#define NETDEV_BONDING_FAILOVER 0x000C
201#define NETDEV_PRE_UP 0x000D
201 202
202#define SYS_DOWN 0x0001 /* Notify of system down */ 203#define SYS_DOWN 0x0001 /* Notify of system down */
203#define SYS_RESTART SYS_DOWN 204#define SYS_RESTART SYS_DOWN
diff --git a/include/linux/of.h b/include/linux/of.h
index 6a7efa242f5e..7be2d1043c16 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -77,6 +77,9 @@ extern int of_n_size_cells(struct device_node *np);
77extern const struct of_device_id *of_match_node( 77extern const struct of_device_id *of_match_node(
78 const struct of_device_id *matches, const struct device_node *node); 78 const struct of_device_id *matches, const struct device_node *node);
79extern int of_modalias_node(struct device_node *node, char *modalias, int len); 79extern int of_modalias_node(struct device_node *node, char *modalias, int len);
80extern struct device_node *of_parse_phandle(struct device_node *np,
81 const char *phandle_name,
82 int index);
80extern int of_parse_phandles_with_args(struct device_node *np, 83extern int of_parse_phandles_with_args(struct device_node *np,
81 const char *list_name, const char *cells_name, int index, 84 const char *list_name, const char *cells_name, int index,
82 struct device_node **out_node, const void **out_args); 85 struct device_node **out_node, const void **out_args);
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
new file mode 100644
index 000000000000..c9663c690303
--- /dev/null
+++ b/include/linux/of_mdio.h
@@ -0,0 +1,22 @@
1/*
2 * OF helpers for the MDIO (Ethernet PHY) API
3 *
4 * Copyright (c) 2009 Secret Lab Technologies, Ltd.
5 *
6 * This file is released under the GPLv2
7 */
8
9#ifndef __LINUX_OF_MDIO_H
10#define __LINUX_OF_MDIO_H
11
12#include <linux/phy.h>
13#include <linux/of.h>
14
15extern int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np);
16extern struct phy_device *of_phy_find_device(struct device_node *phy_np);
17extern struct phy_device *of_phy_connect(struct net_device *dev,
18 struct device_node *phy_np,
19 void (*hndlr)(struct net_device *),
20 u32 flags, phy_interface_t iface);
21
22#endif /* __LINUX_OF_MDIO_H */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 62214c7d2d93..e2e5ce543595 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -95,9 +95,7 @@ enum pageflags {
95 PG_reclaim, /* To be reclaimed asap */ 95 PG_reclaim, /* To be reclaimed asap */
96 PG_buddy, /* Page is free, on buddy lists */ 96 PG_buddy, /* Page is free, on buddy lists */
97 PG_swapbacked, /* Page is backed by RAM/swap */ 97 PG_swapbacked, /* Page is backed by RAM/swap */
98#ifdef CONFIG_UNEVICTABLE_LRU
99 PG_unevictable, /* Page is "unevictable" */ 98 PG_unevictable, /* Page is "unevictable" */
100#endif
101#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT 99#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
102 PG_mlocked, /* Page is vma mlocked */ 100 PG_mlocked, /* Page is vma mlocked */
103#endif 101#endif
@@ -120,7 +118,6 @@ enum pageflags {
120 PG_savepinned = PG_dirty, 118 PG_savepinned = PG_dirty,
121 119
122 /* SLOB */ 120 /* SLOB */
123 PG_slob_page = PG_active,
124 PG_slob_free = PG_private, 121 PG_slob_free = PG_private,
125 122
126 /* SLUB */ 123 /* SLUB */
@@ -203,7 +200,6 @@ PAGEFLAG(SavePinned, savepinned); /* Xen */
203PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) 200PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved)
204PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked) 201PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked)
205 202
206__PAGEFLAG(SlobPage, slob_page)
207__PAGEFLAG(SlobFree, slob_free) 203__PAGEFLAG(SlobFree, slob_free)
208 204
209__PAGEFLAG(SlubFrozen, slub_frozen) 205__PAGEFLAG(SlubFrozen, slub_frozen)
@@ -248,14 +244,8 @@ PAGEFLAG_FALSE(SwapCache)
248 SETPAGEFLAG_NOOP(SwapCache) CLEARPAGEFLAG_NOOP(SwapCache) 244 SETPAGEFLAG_NOOP(SwapCache) CLEARPAGEFLAG_NOOP(SwapCache)
249#endif 245#endif
250 246
251#ifdef CONFIG_UNEVICTABLE_LRU
252PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable) 247PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable)
253 TESTCLEARFLAG(Unevictable, unevictable) 248 TESTCLEARFLAG(Unevictable, unevictable)
254#else
255PAGEFLAG_FALSE(Unevictable) TESTCLEARFLAG_FALSE(Unevictable)
256 SETPAGEFLAG_NOOP(Unevictable) CLEARPAGEFLAG_NOOP(Unevictable)
257 __CLEARPAGEFLAG_NOOP(Unevictable)
258#endif
259 249
260#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT 250#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
261#define MLOCK_PAGES 1 251#define MLOCK_PAGES 1
@@ -382,12 +372,6 @@ static inline void __ClearPageTail(struct page *page)
382 372
383#endif /* !PAGEFLAGS_EXTENDED */ 373#endif /* !PAGEFLAGS_EXTENDED */
384 374
385#ifdef CONFIG_UNEVICTABLE_LRU
386#define __PG_UNEVICTABLE (1 << PG_unevictable)
387#else
388#define __PG_UNEVICTABLE 0
389#endif
390
391#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT 375#ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT
392#define __PG_MLOCKED (1 << PG_mlocked) 376#define __PG_MLOCKED (1 << PG_mlocked)
393#else 377#else
@@ -403,7 +387,7 @@ static inline void __ClearPageTail(struct page *page)
403 1 << PG_private | 1 << PG_private_2 | \ 387 1 << PG_private | 1 << PG_private_2 | \
404 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \ 388 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \
405 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \ 389 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \
406 __PG_UNEVICTABLE | __PG_MLOCKED) 390 1 << PG_unevictable | __PG_MLOCKED)
407 391
408/* 392/*
409 * Flags checked when a page is prepped for return by the page allocator. 393 * Flags checked when a page is prepped for return by the page allocator.
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 7339c7bf7331..13f126c89ae8 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -18,7 +18,19 @@ struct page_cgroup {
18}; 18};
19 19
20void __meminit pgdat_page_cgroup_init(struct pglist_data *pgdat); 20void __meminit pgdat_page_cgroup_init(struct pglist_data *pgdat);
21void __init page_cgroup_init(void); 21
22#ifdef CONFIG_SPARSEMEM
23static inline void __init page_cgroup_init_flatmem(void)
24{
25}
26extern void __init page_cgroup_init(void);
27#else
28void __init page_cgroup_init_flatmem(void);
29static inline void __init page_cgroup_init(void)
30{
31}
32#endif
33
22struct page_cgroup *lookup_page_cgroup(struct page *page); 34struct page_cgroup *lookup_page_cgroup(struct page *page);
23 35
24enum { 36enum {
@@ -87,6 +99,10 @@ static inline void page_cgroup_init(void)
87{ 99{
88} 100}
89 101
102static inline void __init page_cgroup_init_flatmem(void)
103{
104}
105
90#endif 106#endif
91 107
92#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP 108#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 34da5230faab..aec3252afcf5 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -22,9 +22,7 @@ enum mapping_flags {
22 AS_EIO = __GFP_BITS_SHIFT + 0, /* IO error on async write */ 22 AS_EIO = __GFP_BITS_SHIFT + 0, /* IO error on async write */
23 AS_ENOSPC = __GFP_BITS_SHIFT + 1, /* ENOSPC on async write */ 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() */ 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 */ 25 AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */
27#endif
28}; 26};
29 27
30static inline void mapping_set_error(struct address_space *mapping, int error) 28static inline void mapping_set_error(struct address_space *mapping, int error)
@@ -37,8 +35,6 @@ static inline void mapping_set_error(struct address_space *mapping, int error)
37 } 35 }
38} 36}
39 37
40#ifdef CONFIG_UNEVICTABLE_LRU
41
42static inline void mapping_set_unevictable(struct address_space *mapping) 38static inline void mapping_set_unevictable(struct address_space *mapping)
43{ 39{
44 set_bit(AS_UNEVICTABLE, &mapping->flags); 40 set_bit(AS_UNEVICTABLE, &mapping->flags);
@@ -55,14 +51,6 @@ static inline int mapping_unevictable(struct address_space *mapping)
55 return test_bit(AS_UNEVICTABLE, &mapping->flags); 51 return test_bit(AS_UNEVICTABLE, &mapping->flags);
56 return !!mapping; 52 return !!mapping;
57} 53}
58#else
59static inline void mapping_set_unevictable(struct address_space *mapping) { }
60static inline void mapping_clear_unevictable(struct address_space *mapping) { }
61static inline int mapping_unevictable(struct address_space *mapping)
62{
63 return 0;
64}
65#endif
66 54
67static inline gfp_t mapping_gfp_mask(struct address_space * mapping) 55static inline gfp_t mapping_gfp_mask(struct address_space * mapping)
68{ 56{
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 092e82e0048c..93a7c08f869d 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -15,7 +15,7 @@ static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
15{ 15{
16 struct pci_bus *pbus = pdev->bus; 16 struct pci_bus *pbus = pdev->bus;
17 /* Find a PCI root bus */ 17 /* Find a PCI root bus */
18 while (pbus->parent) 18 while (!pci_is_root_bus(pbus))
19 pbus = pbus->parent; 19 pbus = pbus->parent;
20 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus), 20 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus),
21 pbus->number); 21 pbus->number);
@@ -23,7 +23,7 @@ static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
23 23
24static 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)
25{ 25{
26 if (pbus->parent) 26 if (!pci_is_root_bus(pbus))
27 return DEVICE_ACPI_HANDLE(&(pbus->self->dev)); 27 return DEVICE_ACPI_HANDLE(&(pbus->self->dev));
28 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus), 28 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pbus),
29 pbus->number); 29 pbus->number);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 72698d89e767..d304ddf412d0 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -124,6 +124,14 @@ typedef int __bitwise pci_power_t;
124#define PCI_UNKNOWN ((pci_power_t __force) 5) 124#define PCI_UNKNOWN ((pci_power_t __force) 5)
125#define PCI_POWER_ERROR ((pci_power_t __force) -1) 125#define PCI_POWER_ERROR ((pci_power_t __force) -1)
126 126
127/* Remember to update this when the list above changes! */
128extern const char *pci_power_names[];
129
130static inline const char *pci_power_name(pci_power_t state)
131{
132 return pci_power_names[1 + (int) state];
133}
134
127#define PCI_PM_D2_DELAY 200 135#define PCI_PM_D2_DELAY 200
128#define PCI_PM_D3_WAIT 10 136#define PCI_PM_D3_WAIT 10
129#define PCI_PM_BUS_WAIT 50 137#define PCI_PM_BUS_WAIT 50
@@ -188,6 +196,7 @@ struct pci_cap_saved_state {
188struct pcie_link_state; 196struct pcie_link_state;
189struct pci_vpd; 197struct pci_vpd;
190struct pci_sriov; 198struct pci_sriov;
199struct pci_ats;
191 200
192/* 201/*
193 * The pci_dev structure is used to describe PCI devices. 202 * The pci_dev structure is used to describe PCI devices.
@@ -285,6 +294,7 @@ struct pci_dev {
285 struct pci_sriov *sriov; /* SR-IOV capability related */ 294 struct pci_sriov *sriov; /* SR-IOV capability related */
286 struct pci_dev *physfn; /* the PF this VF is associated with */ 295 struct pci_dev *physfn; /* the PF this VF is associated with */
287 }; 296 };
297 struct pci_ats *ats; /* Address Translation Service */
288#endif 298#endif
289}; 299};
290 300
@@ -599,8 +609,6 @@ extern void pci_sort_breadthfirst(void);
599struct pci_dev __deprecated *pci_find_device(unsigned int vendor, 609struct pci_dev __deprecated *pci_find_device(unsigned int vendor,
600 unsigned int device, 610 unsigned int device,
601 struct pci_dev *from); 611 struct pci_dev *from);
602struct pci_dev __deprecated *pci_find_slot(unsigned int bus,
603 unsigned int devfn);
604#endif /* CONFIG_PCI_LEGACY */ 612#endif /* CONFIG_PCI_LEGACY */
605 613
606enum pci_lost_interrupt_reason { 614enum pci_lost_interrupt_reason {
@@ -639,6 +647,7 @@ int pci_bus_write_config_word(struct pci_bus *bus, unsigned int devfn,
639 int where, u16 val); 647 int where, u16 val);
640int pci_bus_write_config_dword(struct pci_bus *bus, unsigned int devfn, 648int pci_bus_write_config_dword(struct pci_bus *bus, unsigned int devfn,
641 int where, u32 val); 649 int where, u32 val);
650struct pci_ops *pci_bus_set_ops(struct pci_bus *bus, struct pci_ops *ops);
642 651
643static inline int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val) 652static inline int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val)
644{ 653{
@@ -703,8 +712,8 @@ int pcix_get_mmrbc(struct pci_dev *dev);
703int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc); 712int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc);
704int pcie_get_readrq(struct pci_dev *dev); 713int pcie_get_readrq(struct pci_dev *dev);
705int pcie_set_readrq(struct pci_dev *dev, int rq); 714int pcie_set_readrq(struct pci_dev *dev, int rq);
715int __pci_reset_function(struct pci_dev *dev);
706int pci_reset_function(struct pci_dev *dev); 716int pci_reset_function(struct pci_dev *dev);
707int pci_execute_reset_function(struct pci_dev *dev);
708void pci_update_resource(struct pci_dev *dev, int resno); 717void pci_update_resource(struct pci_dev *dev, int resno);
709int __must_check pci_assign_resource(struct pci_dev *dev, int i); 718int __must_check pci_assign_resource(struct pci_dev *dev, int i);
710int pci_select_bars(struct pci_dev *dev, unsigned long flags); 719int pci_select_bars(struct pci_dev *dev, unsigned long flags);
@@ -724,7 +733,7 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
724pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); 733pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
725bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); 734bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
726void pci_pme_active(struct pci_dev *dev, bool enable); 735void pci_pme_active(struct pci_dev *dev, bool enable);
727int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); 736int pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable);
728int pci_wake_from_d3(struct pci_dev *dev, bool enable); 737int pci_wake_from_d3(struct pci_dev *dev, bool enable);
729pci_power_t pci_target_state(struct pci_dev *dev); 738pci_power_t pci_target_state(struct pci_dev *dev);
730int pci_prepare_to_sleep(struct pci_dev *dev); 739int pci_prepare_to_sleep(struct pci_dev *dev);
@@ -790,7 +799,7 @@ const struct pci_device_id *pci_match_id(const struct pci_device_id *ids,
790int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, 799int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
791 int pass); 800 int pass);
792 801
793void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), 802void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
794 void *userdata); 803 void *userdata);
795int pci_cfg_space_size_ext(struct pci_dev *dev); 804int pci_cfg_space_size_ext(struct pci_dev *dev);
796int pci_cfg_space_size(struct pci_dev *dev); 805int pci_cfg_space_size(struct pci_dev *dev);
@@ -880,6 +889,17 @@ static inline int pcie_aspm_enabled(void)
880extern int pcie_aspm_enabled(void); 889extern int pcie_aspm_enabled(void);
881#endif 890#endif
882 891
892#ifndef CONFIG_PCIE_ECRC
893static inline void pcie_set_ecrc_checking(struct pci_dev *dev)
894{
895 return;
896}
897static inline void pcie_ecrc_get_policy(char *str) {};
898#else
899extern void pcie_set_ecrc_checking(struct pci_dev *dev);
900extern void pcie_ecrc_get_policy(char *str);
901#endif
902
883#define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1) 903#define pci_enable_msi(pdev) pci_enable_msi_block(pdev, 1)
884 904
885#ifdef CONFIG_HT_IRQ 905#ifdef CONFIG_HT_IRQ
@@ -936,12 +956,6 @@ static inline struct pci_dev *pci_find_device(unsigned int vendor,
936 return NULL; 956 return NULL;
937} 957}
938 958
939static inline struct pci_dev *pci_find_slot(unsigned int bus,
940 unsigned int devfn)
941{
942 return NULL;
943}
944
945static inline struct pci_dev *pci_get_device(unsigned int vendor, 959static inline struct pci_dev *pci_get_device(unsigned int vendor,
946 unsigned int device, 960 unsigned int device,
947 struct pci_dev *from) 961 struct pci_dev *from)
@@ -1097,6 +1111,10 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus,
1097 1111
1098#include <asm/pci.h> 1112#include <asm/pci.h>
1099 1113
1114#ifndef PCIBIOS_MAX_MEM_32
1115#define PCIBIOS_MAX_MEM_32 (-1)
1116#endif
1117
1100/* these helpers provide future and backwards compatibility 1118/* these helpers provide future and backwards compatibility
1101 * for accessing popular PCI BAR info */ 1119 * for accessing popular PCI BAR info */
1102#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) 1120#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start)
@@ -1253,5 +1271,10 @@ static inline irqreturn_t pci_sriov_migration(struct pci_dev *dev)
1253} 1271}
1254#endif 1272#endif
1255 1273
1274#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE)
1275extern void pci_hp_create_module_link(struct pci_slot *pci_slot);
1276extern void pci_hp_remove_module_link(struct pci_slot *pci_slot);
1277#endif
1278
1256#endif /* __KERNEL__ */ 1279#endif /* __KERNEL__ */
1257#endif /* LINUX_PCI_H */ 1280#endif /* LINUX_PCI_H */
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 20998746518e..4391741b99dc 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -66,17 +66,10 @@ enum pcie_link_speed {
66 PCIE_LNK_SPEED_UNKNOWN = 0xFF, 66 PCIE_LNK_SPEED_UNKNOWN = 0xFF,
67}; 67};
68 68
69struct hotplug_slot;
70struct hotplug_slot_attribute {
71 struct attribute attr;
72 ssize_t (*show)(struct hotplug_slot *, char *);
73 ssize_t (*store)(struct hotplug_slot *, const char *, size_t);
74};
75#define to_hotplug_attr(n) container_of(n, struct hotplug_slot_attribute, attr);
76
77/** 69/**
78 * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use 70 * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use
79 * @owner: The module owner of this structure 71 * @owner: The module owner of this structure
72 * @mod_name: The module name (KBUILD_MODNAME) of this structure
80 * @enable_slot: Called when the user wants to enable a specific pci slot 73 * @enable_slot: Called when the user wants to enable a specific pci slot
81 * @disable_slot: Called when the user wants to disable a specific pci slot 74 * @disable_slot: Called when the user wants to disable a specific pci slot
82 * @set_attention_status: Called to set the specific slot's attention LED to 75 * @set_attention_status: Called to set the specific slot's attention LED to
@@ -109,6 +102,7 @@ struct hotplug_slot_attribute {
109 */ 102 */
110struct hotplug_slot_ops { 103struct hotplug_slot_ops {
111 struct module *owner; 104 struct module *owner;
105 const char *mod_name;
112 int (*enable_slot) (struct hotplug_slot *slot); 106 int (*enable_slot) (struct hotplug_slot *slot);
113 int (*disable_slot) (struct hotplug_slot *slot); 107 int (*disable_slot) (struct hotplug_slot *slot);
114 int (*set_attention_status) (struct hotplug_slot *slot, u8 value); 108 int (*set_attention_status) (struct hotplug_slot *slot, u8 value);
@@ -167,12 +161,21 @@ static inline const char *hotplug_slot_name(const struct hotplug_slot *slot)
167 return pci_slot_name(slot->pci_slot); 161 return pci_slot_name(slot->pci_slot);
168} 162}
169 163
170extern int pci_hp_register(struct hotplug_slot *, struct pci_bus *, int nr, 164extern int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *pbus,
171 const char *name); 165 int nr, const char *name,
166 struct module *owner, const char *mod_name);
172extern int pci_hp_deregister(struct hotplug_slot *slot); 167extern int pci_hp_deregister(struct hotplug_slot *slot);
173extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, 168extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot,
174 struct hotplug_slot_info *info); 169 struct hotplug_slot_info *info);
175 170
171static inline int pci_hp_register(struct hotplug_slot *slot,
172 struct pci_bus *pbus,
173 int devnr, const char *name)
174{
175 return __pci_hp_register(slot, pbus, devnr, name,
176 THIS_MODULE, KBUILD_MODNAME);
177}
178
176/* PCI Setting Record (Type 0) */ 179/* PCI Setting Record (Type 0) */
177struct hpp_type0 { 180struct hpp_type0 {
178 u32 revision; 181 u32 revision;
@@ -226,7 +229,6 @@ struct hotplug_params {
226extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus, 229extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus,
227 struct hotplug_params *hpp); 230 struct hotplug_params *hpp);
228int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags); 231int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags);
229int acpi_root_bridge(acpi_handle handle);
230int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle); 232int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle);
231int acpi_pci_detect_ejectable(struct pci_bus *pbus); 233int acpi_pci_detect_ejectable(struct pci_bus *pbus);
232#endif 234#endif
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 0f71812d67d3..a3b000365795 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -104,6 +104,7 @@
104#define PCI_CLASS_SERIAL_USB_UHCI 0x0c0300 104#define PCI_CLASS_SERIAL_USB_UHCI 0x0c0300
105#define PCI_CLASS_SERIAL_USB_OHCI 0x0c0310 105#define PCI_CLASS_SERIAL_USB_OHCI 0x0c0310
106#define PCI_CLASS_SERIAL_USB_EHCI 0x0c0320 106#define PCI_CLASS_SERIAL_USB_EHCI 0x0c0320
107#define PCI_CLASS_SERIAL_USB_XHCI 0x0c0330
107#define PCI_CLASS_SERIAL_FIBER 0x0c04 108#define PCI_CLASS_SERIAL_FIBER 0x0c04
108#define PCI_CLASS_SERIAL_SMBUS 0x0c05 109#define PCI_CLASS_SERIAL_SMBUS 0x0c05
109 110
@@ -1005,6 +1006,7 @@
1005#define PCI_DEVICE_ID_PLX_PCI200SYN 0x3196 1006#define PCI_DEVICE_ID_PLX_PCI200SYN 0x3196
1006#define PCI_DEVICE_ID_PLX_9030 0x9030 1007#define PCI_DEVICE_ID_PLX_9030 0x9030
1007#define PCI_DEVICE_ID_PLX_9050 0x9050 1008#define PCI_DEVICE_ID_PLX_9050 0x9050
1009#define PCI_DEVICE_ID_PLX_9056 0x9056
1008#define PCI_DEVICE_ID_PLX_9080 0x9080 1010#define PCI_DEVICE_ID_PLX_9080 0x9080
1009#define PCI_DEVICE_ID_PLX_GTEK_SERIAL2 0xa001 1011#define PCI_DEVICE_ID_PLX_GTEK_SERIAL2 0xa001
1010 1012
@@ -1066,8 +1068,6 @@
1066#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS 0x0034 1068#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS 0x0034
1067#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE 0x0035 1069#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE 0x0035
1068#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA 0x0036 1070#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA 0x0036
1069#define PCI_DEVICE_ID_NVIDIA_NVENET_10 0x0037
1070#define PCI_DEVICE_ID_NVIDIA_NVENET_11 0x0038
1071#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2 0x003e 1071#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2 0x003e
1072#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800_ULTRA 0x0040 1072#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800_ULTRA 0x0040
1073#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800 0x0041 1073#define PCI_DEVICE_ID_NVIDIA_GEFORCE_6800 0x0041
@@ -1078,21 +1078,16 @@
1078#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE 0x0053 1078#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE 0x0053
1079#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA 0x0054 1079#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA 0x0054
1080#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2 0x0055 1080#define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2 0x0055
1081#define PCI_DEVICE_ID_NVIDIA_NVENET_8 0x0056
1082#define PCI_DEVICE_ID_NVIDIA_NVENET_9 0x0057
1083#define PCI_DEVICE_ID_NVIDIA_CK804_AUDIO 0x0059 1081#define PCI_DEVICE_ID_NVIDIA_CK804_AUDIO 0x0059
1084#define PCI_DEVICE_ID_NVIDIA_CK804_PCIE 0x005d 1082#define PCI_DEVICE_ID_NVIDIA_CK804_PCIE 0x005d
1085#define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS 0x0064 1083#define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS 0x0064
1086#define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE 0x0065 1084#define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE 0x0065
1087#define PCI_DEVICE_ID_NVIDIA_NVENET_2 0x0066
1088#define PCI_DEVICE_ID_NVIDIA_MCP2_MODEM 0x0069 1085#define PCI_DEVICE_ID_NVIDIA_MCP2_MODEM 0x0069
1089#define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a 1086#define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a
1090#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS 0x0084 1087#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS 0x0084
1091#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE 0x0085 1088#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE 0x0085
1092#define PCI_DEVICE_ID_NVIDIA_NVENET_4 0x0086
1093#define PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM 0x0089 1089#define PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM 0x0089
1094#define PCI_DEVICE_ID_NVIDIA_CK8_AUDIO 0x008a 1090#define PCI_DEVICE_ID_NVIDIA_CK8_AUDIO 0x008a
1095#define PCI_DEVICE_ID_NVIDIA_NVENET_5 0x008c
1096#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA 0x008e 1091#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA 0x008e
1097#define PCI_DEVICE_ID_NVIDIA_GEFORCE_7800_GT 0x0090 1092#define PCI_DEVICE_ID_NVIDIA_GEFORCE_7800_GT 0x0090
1098#define PCI_DEVICE_ID_NVIDIA_GEFORCE_7800_GTX 0x0091 1093#define PCI_DEVICE_ID_NVIDIA_GEFORCE_7800_GTX 0x0091
@@ -1108,15 +1103,12 @@
1108#define PCI_DEVICE_ID_NVIDIA_NFORCE3 0x00d1 1103#define PCI_DEVICE_ID_NVIDIA_NFORCE3 0x00d1
1109#define PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS 0x00d4 1104#define PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS 0x00d4
1110#define PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE 0x00d5 1105#define PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE 0x00d5
1111#define PCI_DEVICE_ID_NVIDIA_NVENET_3 0x00d6
1112#define PCI_DEVICE_ID_NVIDIA_MCP3_MODEM 0x00d9 1106#define PCI_DEVICE_ID_NVIDIA_MCP3_MODEM 0x00d9
1113#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da 1107#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da
1114#define PCI_DEVICE_ID_NVIDIA_NVENET_7 0x00df
1115#define PCI_DEVICE_ID_NVIDIA_NFORCE3S 0x00e1 1108#define PCI_DEVICE_ID_NVIDIA_NFORCE3S 0x00e1
1116#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA 0x00e3 1109#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA 0x00e3
1117#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS 0x00e4 1110#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS 0x00e4
1118#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE 0x00e5 1111#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE 0x00e5
1119#define PCI_DEVICE_ID_NVIDIA_NVENET_6 0x00e6
1120#define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea 1112#define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea
1121#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2 0x00ee 1113#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2 0x00ee
1122#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_ALT1 0x00f0 1114#define PCIE_DEVICE_ID_NVIDIA_GEFORCE_6800_ALT1 0x00f0
@@ -1176,7 +1168,6 @@
1176#define PCI_DEVICE_ID_NVIDIA_NFORCE_SMBUS 0x01b4 1168#define PCI_DEVICE_ID_NVIDIA_NFORCE_SMBUS 0x01b4
1177#define PCI_DEVICE_ID_NVIDIA_NFORCE_IDE 0x01bc 1169#define PCI_DEVICE_ID_NVIDIA_NFORCE_IDE 0x01bc
1178#define PCI_DEVICE_ID_NVIDIA_MCP1_MODEM 0x01c1 1170#define PCI_DEVICE_ID_NVIDIA_MCP1_MODEM 0x01c1
1179#define PCI_DEVICE_ID_NVIDIA_NVENET_1 0x01c3
1180#define PCI_DEVICE_ID_NVIDIA_NFORCE2 0x01e0 1171#define PCI_DEVICE_ID_NVIDIA_NFORCE2 0x01e0
1181#define PCI_DEVICE_ID_NVIDIA_GEFORCE3 0x0200 1172#define PCI_DEVICE_ID_NVIDIA_GEFORCE3 0x0200
1182#define PCI_DEVICE_ID_NVIDIA_GEFORCE3_1 0x0201 1173#define PCI_DEVICE_ID_NVIDIA_GEFORCE3_1 0x0201
@@ -1199,8 +1190,6 @@
1199#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E 1190#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE 0x036E
1200#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA 0x037E 1191#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA 0x037E
1201#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2 0x037F 1192#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_SATA2 0x037F
1202#define PCI_DEVICE_ID_NVIDIA_NVENET_12 0x0268
1203#define PCI_DEVICE_ID_NVIDIA_NVENET_13 0x0269
1204#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800 0x0280 1193#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800 0x0280
1205#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800_8X 0x0281 1194#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800_8X 0x0281
1206#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800SE 0x0282 1195#define PCI_DEVICE_ID_NVIDIA_GEFORCE4_TI_4800SE 0x0282
@@ -1247,46 +1236,21 @@
1247#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_2 0x0348 1236#define PCI_DEVICE_ID_NVIDIA_GEFORCE_FX_GO5700_2 0x0348
1248#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO1000 0x034C 1237#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_GO1000 0x034C
1249#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1100 0x034E 1238#define PCI_DEVICE_ID_NVIDIA_QUADRO_FX_1100 0x034E
1250#define PCI_DEVICE_ID_NVIDIA_NVENET_14 0x0372
1251#define PCI_DEVICE_ID_NVIDIA_NVENET_15 0x0373 1239#define PCI_DEVICE_ID_NVIDIA_NVENET_15 0x0373
1252#define PCI_DEVICE_ID_NVIDIA_NVENET_16 0x03E5
1253#define PCI_DEVICE_ID_NVIDIA_NVENET_17 0x03E6
1254#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA 0x03E7 1240#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA 0x03E7
1255#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SMBUS 0x03EB 1241#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SMBUS 0x03EB
1256#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE 0x03EC 1242#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE 0x03EC
1257#define PCI_DEVICE_ID_NVIDIA_NVENET_18 0x03EE
1258#define PCI_DEVICE_ID_NVIDIA_NVENET_19 0x03EF
1259#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2 0x03F6 1243#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA2 0x03F6
1260#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3 0x03F7 1244#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_SATA3 0x03F7
1261#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_SMBUS 0x0446 1245#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_SMBUS 0x0446
1262#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE 0x0448 1246#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE 0x0448
1263#define PCI_DEVICE_ID_NVIDIA_NVENET_20 0x0450
1264#define PCI_DEVICE_ID_NVIDIA_NVENET_21 0x0451
1265#define PCI_DEVICE_ID_NVIDIA_NVENET_22 0x0452
1266#define PCI_DEVICE_ID_NVIDIA_NVENET_23 0x0453
1267#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_SMBUS 0x0542 1247#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_SMBUS 0x0542
1268#define PCI_DEVICE_ID_NVIDIA_NVENET_24 0x054C
1269#define PCI_DEVICE_ID_NVIDIA_NVENET_25 0x054D
1270#define PCI_DEVICE_ID_NVIDIA_NVENET_26 0x054E
1271#define PCI_DEVICE_ID_NVIDIA_NVENET_27 0x054F
1272#define PCI_DEVICE_ID_NVIDIA_NVENET_28 0x07DC
1273#define PCI_DEVICE_ID_NVIDIA_NVENET_29 0x07DD
1274#define PCI_DEVICE_ID_NVIDIA_NVENET_30 0x07DE
1275#define PCI_DEVICE_ID_NVIDIA_NVENET_31 0x07DF
1276#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560 1248#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560
1277#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE 0x056C 1249#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE 0x056C
1278#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP78S_SMBUS 0x0752 1250#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP78S_SMBUS 0x0752
1279#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759 1251#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759
1280#define PCI_DEVICE_ID_NVIDIA_NVENET_32 0x0760
1281#define PCI_DEVICE_ID_NVIDIA_NVENET_33 0x0761
1282#define PCI_DEVICE_ID_NVIDIA_NVENET_34 0x0762
1283#define PCI_DEVICE_ID_NVIDIA_NVENET_35 0x0763
1284#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_SMBUS 0x07D8 1252#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_NFORCE_MCP79_SMBUS 0x0AA2
1286#define PCI_DEVICE_ID_NVIDIA_NVENET_36 0x0AB0
1287#define PCI_DEVICE_ID_NVIDIA_NVENET_37 0x0AB1
1288#define PCI_DEVICE_ID_NVIDIA_NVENET_38 0x0AB2
1289#define PCI_DEVICE_ID_NVIDIA_NVENET_39 0x0AB3
1290 1254
1291#define PCI_VENDOR_ID_IMS 0x10e0 1255#define PCI_VENDOR_ID_IMS 0x10e0
1292#define PCI_DEVICE_ID_IMS_TT128 0x9128 1256#define PCI_DEVICE_ID_IMS_TT128 0x9128
@@ -1314,6 +1278,13 @@
1314 1278
1315#define PCI_VENDOR_ID_CREATIVE 0x1102 /* duplicate: ECTIVA */ 1279#define PCI_VENDOR_ID_CREATIVE 0x1102 /* duplicate: ECTIVA */
1316#define PCI_DEVICE_ID_CREATIVE_EMU10K1 0x0002 1280#define PCI_DEVICE_ID_CREATIVE_EMU10K1 0x0002
1281#define PCI_DEVICE_ID_CREATIVE_20K1 0x0005
1282#define PCI_DEVICE_ID_CREATIVE_20K2 0x000b
1283#define PCI_SUBDEVICE_ID_CREATIVE_SB0760 0x0024
1284#define PCI_SUBDEVICE_ID_CREATIVE_SB08801 0x0041
1285#define PCI_SUBDEVICE_ID_CREATIVE_SB08802 0x0042
1286#define PCI_SUBDEVICE_ID_CREATIVE_SB08803 0x0043
1287#define PCI_SUBDEVICE_ID_CREATIVE_HENDRIX 0x6000
1317 1288
1318#define PCI_VENDOR_ID_ECTIVA 0x1102 /* duplicate: CREATIVE */ 1289#define PCI_VENDOR_ID_ECTIVA 0x1102 /* duplicate: CREATIVE */
1319#define PCI_DEVICE_ID_ECTIVA_EV1938 0x8938 1290#define PCI_DEVICE_ID_ECTIVA_EV1938 0x8938
@@ -1847,6 +1818,10 @@
1847#define PCI_SUBDEVICE_ID_HYPERCOPE_METRO 0x0107 1818#define PCI_SUBDEVICE_ID_HYPERCOPE_METRO 0x0107
1848#define PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2 0x0108 1819#define PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2 0x0108
1849 1820
1821#define PCI_VENDOR_ID_DIGIGRAM 0x1369
1822#define PCI_SUBDEVICE_ID_DIGIGRAM_LX6464ES_SERIAL_SUBSYSTEM 0xc001
1823#define PCI_SUBDEVICE_ID_DIGIGRAM_LX6464ES_CAE_SERIAL_SUBSYSTEM 0xc002
1824
1850#define PCI_VENDOR_ID_KAWASAKI 0x136b 1825#define PCI_VENDOR_ID_KAWASAKI 0x136b
1851#define PCI_DEVICE_ID_MCHIP_KL5A72002 0xff01 1826#define PCI_DEVICE_ID_MCHIP_KL5A72002 0xff01
1852 1827
@@ -1914,6 +1889,8 @@
1914#define PCI_SUBDEVICE_ID_CCD_SWYX4S 0xB540 1889#define PCI_SUBDEVICE_ID_CCD_SWYX4S 0xB540
1915#define PCI_SUBDEVICE_ID_CCD_JH4S20 0xB550 1890#define PCI_SUBDEVICE_ID_CCD_JH4S20 0xB550
1916#define PCI_SUBDEVICE_ID_CCD_IOB8ST_1 0xB552 1891#define PCI_SUBDEVICE_ID_CCD_IOB8ST_1 0xB552
1892#define PCI_SUBDEVICE_ID_CCD_JHSE1 0xB553
1893#define PCI_SUBDEVICE_ID_CCD_JH8S 0xB55B
1917#define PCI_SUBDEVICE_ID_CCD_BN4S 0xB560 1894#define PCI_SUBDEVICE_ID_CCD_BN4S 0xB560
1918#define PCI_SUBDEVICE_ID_CCD_BN8S 0xB562 1895#define PCI_SUBDEVICE_ID_CCD_BN8S 0xB562
1919#define PCI_SUBDEVICE_ID_CCD_BNE1 0xB563 1896#define PCI_SUBDEVICE_ID_CCD_BNE1 0xB563
@@ -1996,10 +1973,12 @@
1996#define PCI_DEVICE_ID_OXSEMI_PCIe952_1_U 0xC118 1973#define PCI_DEVICE_ID_OXSEMI_PCIe952_1_U 0xC118
1997#define PCI_DEVICE_ID_OXSEMI_PCIe952_1_GU 0xC11C 1974#define PCI_DEVICE_ID_OXSEMI_PCIe952_1_GU 0xC11C
1998#define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501 1975#define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501
1976#define PCI_DEVICE_ID_OXSEMI_C950 0x950B
1999#define PCI_DEVICE_ID_OXSEMI_16PCI95N 0x9511 1977#define PCI_DEVICE_ID_OXSEMI_16PCI95N 0x9511
2000#define PCI_DEVICE_ID_OXSEMI_16PCI954PP 0x9513 1978#define PCI_DEVICE_ID_OXSEMI_16PCI954PP 0x9513
2001#define PCI_DEVICE_ID_OXSEMI_16PCI952 0x9521 1979#define PCI_DEVICE_ID_OXSEMI_16PCI952 0x9521
2002#define PCI_DEVICE_ID_OXSEMI_16PCI952PP 0x9523 1980#define PCI_DEVICE_ID_OXSEMI_16PCI952PP 0x9523
1981#define PCI_SUBDEVICE_ID_OXSEMI_C950 0x0001
2003 1982
2004#define PCI_VENDOR_ID_CHELSIO 0x1425 1983#define PCI_VENDOR_ID_CHELSIO 0x1425
2005 1984
@@ -2113,6 +2092,7 @@
2113#define PCI_VENDOR_ID_MAINPINE 0x1522 2092#define PCI_VENDOR_ID_MAINPINE 0x1522
2114#define PCI_DEVICE_ID_MAINPINE_PBRIDGE 0x0100 2093#define PCI_DEVICE_ID_MAINPINE_PBRIDGE 0x0100
2115#define PCI_VENDOR_ID_ENE 0x1524 2094#define PCI_VENDOR_ID_ENE 0x1524
2095#define PCI_DEVICE_ID_ENE_CB710_FLASH 0x0510
2116#define PCI_DEVICE_ID_ENE_CB712_SD 0x0550 2096#define PCI_DEVICE_ID_ENE_CB712_SD 0x0550
2117#define PCI_DEVICE_ID_ENE_CB712_SD_2 0x0551 2097#define PCI_DEVICE_ID_ENE_CB712_SD_2 0x0551
2118#define PCI_DEVICE_ID_ENE_CB714_SD 0x0750 2098#define PCI_DEVICE_ID_ENE_CB714_SD 0x0750
@@ -2274,6 +2254,8 @@
2274#define PCI_DEVICE_ID_MPC8547E 0x0018 2254#define PCI_DEVICE_ID_MPC8547E 0x0018
2275#define PCI_DEVICE_ID_MPC8545E 0x0019 2255#define PCI_DEVICE_ID_MPC8545E 0x0019
2276#define PCI_DEVICE_ID_MPC8545 0x001a 2256#define PCI_DEVICE_ID_MPC8545 0x001a
2257#define PCI_DEVICE_ID_MPC8569E 0x0061
2258#define PCI_DEVICE_ID_MPC8569 0x0060
2277#define PCI_DEVICE_ID_MPC8568E 0x0020 2259#define PCI_DEVICE_ID_MPC8568E 0x0020
2278#define PCI_DEVICE_ID_MPC8568 0x0021 2260#define PCI_DEVICE_ID_MPC8568 0x0021
2279#define PCI_DEVICE_ID_MPC8567E 0x0022 2261#define PCI_DEVICE_ID_MPC8567E 0x0022
@@ -2286,6 +2268,8 @@
2286#define PCI_DEVICE_ID_MPC8572 0x0041 2268#define PCI_DEVICE_ID_MPC8572 0x0041
2287#define PCI_DEVICE_ID_MPC8536E 0x0050 2269#define PCI_DEVICE_ID_MPC8536E 0x0050
2288#define PCI_DEVICE_ID_MPC8536 0x0051 2270#define PCI_DEVICE_ID_MPC8536 0x0051
2271#define PCI_DEVICE_ID_P2020E 0x0070
2272#define PCI_DEVICE_ID_P2020 0x0071
2289#define PCI_DEVICE_ID_MPC8641 0x7010 2273#define PCI_DEVICE_ID_MPC8641 0x7010
2290#define PCI_DEVICE_ID_MPC8641D 0x7011 2274#define PCI_DEVICE_ID_MPC8641D 0x7011
2291#define PCI_DEVICE_ID_MPC8610 0x7018 2275#define PCI_DEVICE_ID_MPC8610 0x7018
@@ -2313,6 +2297,8 @@
2313 2297
2314#define PCI_VENDOR_ID_QMI 0x1a32 2298#define PCI_VENDOR_ID_QMI 0x1a32
2315 2299
2300#define PCI_VENDOR_ID_AZWAVE 0x1a3b
2301
2316#define PCI_VENDOR_ID_TEKRAM 0x1de1 2302#define PCI_VENDOR_ID_TEKRAM 0x1de1
2317#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 2303#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29
2318 2304
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index 616bf8b3c8b5..fcaee42c7ac2 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -295,8 +295,9 @@
295#define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */ 295#define PCI_MSI_ADDRESS_LO 4 /* Lower 32 bits */
296#define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */ 296#define PCI_MSI_ADDRESS_HI 8 /* Upper 32 bits (if PCI_MSI_FLAGS_64BIT set) */
297#define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */ 297#define PCI_MSI_DATA_32 8 /* 16 bits of data for 32-bit devices */
298#define PCI_MSI_MASK_32 12 /* Mask bits register for 32-bit devices */
298#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */ 299#define PCI_MSI_DATA_64 12 /* 16 bits of data for 64-bit devices */
299#define PCI_MSI_MASK_BIT 16 /* Mask bits register */ 300#define PCI_MSI_MASK_64 16 /* Mask bits register for 64-bit devices */
300 301
301/* MSI-X registers (these are at offset PCI_MSIX_FLAGS) */ 302/* MSI-X registers (these are at offset PCI_MSIX_FLAGS) */
302#define PCI_MSIX_FLAGS 2 303#define PCI_MSIX_FLAGS 2
@@ -304,7 +305,6 @@
304#define PCI_MSIX_FLAGS_ENABLE (1 << 15) 305#define PCI_MSIX_FLAGS_ENABLE (1 << 15)
305#define PCI_MSIX_FLAGS_MASKALL (1 << 14) 306#define PCI_MSIX_FLAGS_MASKALL (1 << 14)
306#define PCI_MSIX_FLAGS_BIRMASK (7 << 0) 307#define PCI_MSIX_FLAGS_BIRMASK (7 << 0)
307#define PCI_MSIX_FLAGS_BITMASK (1 << 0)
308 308
309/* CompactPCI Hotswap Register */ 309/* CompactPCI Hotswap Register */
310 310
@@ -502,6 +502,7 @@
502#define PCI_EXT_CAP_ID_DSN 3 502#define PCI_EXT_CAP_ID_DSN 3
503#define PCI_EXT_CAP_ID_PWR 4 503#define PCI_EXT_CAP_ID_PWR 4
504#define PCI_EXT_CAP_ID_ARI 14 504#define PCI_EXT_CAP_ID_ARI 14
505#define PCI_EXT_CAP_ID_ATS 15
505#define PCI_EXT_CAP_ID_SRIOV 16 506#define PCI_EXT_CAP_ID_SRIOV 16
506 507
507/* Advanced Error Reporting */ 508/* Advanced Error Reporting */
@@ -620,6 +621,15 @@
620#define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */ 621#define PCI_ARI_CTRL_ACS 0x0002 /* ACS Function Groups Enable */
621#define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */ 622#define PCI_ARI_CTRL_FG(x) (((x) >> 4) & 7) /* Function Group */
622 623
624/* Address Translation Service */
625#define PCI_ATS_CAP 0x04 /* ATS Capability Register */
626#define PCI_ATS_CAP_QDEP(x) ((x) & 0x1f) /* Invalidate Queue Depth */
627#define PCI_ATS_MAX_QDEP 32 /* Max Invalidate Queue Depth */
628#define PCI_ATS_CTRL 0x06 /* ATS Control Register */
629#define PCI_ATS_CTRL_ENABLE 0x8000 /* ATS Enable */
630#define PCI_ATS_CTRL_STU(x) ((x) & 0x1f) /* Smallest Translation Unit */
631#define PCI_ATS_MIN_STU 12 /* shift of minimum STU block */
632
623/* Single Root I/O Virtualization */ 633/* Single Root I/O Virtualization */
624#define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */ 634#define PCI_SRIOV_CAP 0x04 /* SR-IOV Capabilities */
625#define PCI_SRIOV_CAP_VFM 0x01 /* VF Migration Capable */ 635#define PCI_SRIOV_CAP_VFM 0x01 /* VF Migration Capable */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 1581ff235c7e..26fd9d12f050 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -86,7 +86,12 @@ struct percpu_data {
86 void *ptrs[1]; 86 void *ptrs[1];
87}; 87};
88 88
89/* pointer disguising messes up the kmemleak objects tracking */
90#ifndef CONFIG_DEBUG_KMEMLEAK
89#define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata) 91#define __percpu_disguise(pdata) (struct percpu_data *)~(unsigned long)(pdata)
92#else
93#define __percpu_disguise(pdata) (struct percpu_data *)(pdata)
94#endif
90 95
91#define per_cpu_ptr(ptr, cpu) \ 96#define per_cpu_ptr(ptr, cpu) \
92({ \ 97({ \
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
new file mode 100644
index 000000000000..89698d8aba5c
--- /dev/null
+++ b/include/linux/perf_counter.h
@@ -0,0 +1,728 @@
1/*
2 * Performance counters:
3 *
4 * Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de>
5 * Copyright (C) 2008-2009, Red Hat, Inc., Ingo Molnar
6 * Copyright (C) 2008-2009, Red Hat, Inc., Peter Zijlstra
7 *
8 * Data type definitions, declarations, prototypes.
9 *
10 * Started by: Thomas Gleixner and Ingo Molnar
11 *
12 * For licencing details see kernel-base/COPYING
13 */
14#ifndef _LINUX_PERF_COUNTER_H
15#define _LINUX_PERF_COUNTER_H
16
17#include <linux/types.h>
18#include <linux/ioctl.h>
19#include <asm/byteorder.h>
20
21/*
22 * User-space ABI bits:
23 */
24
25/*
26 * attr.type
27 */
28enum perf_type_id {
29 PERF_TYPE_HARDWARE = 0,
30 PERF_TYPE_SOFTWARE = 1,
31 PERF_TYPE_TRACEPOINT = 2,
32 PERF_TYPE_HW_CACHE = 3,
33 PERF_TYPE_RAW = 4,
34
35 PERF_TYPE_MAX, /* non-ABI */
36};
37
38/*
39 * Generalized performance counter event types, used by the
40 * attr.event_id parameter of the sys_perf_counter_open()
41 * syscall:
42 */
43enum perf_hw_id {
44 /*
45 * Common hardware events, generalized by the kernel:
46 */
47 PERF_COUNT_HW_CPU_CYCLES = 0,
48 PERF_COUNT_HW_INSTRUCTIONS = 1,
49 PERF_COUNT_HW_CACHE_REFERENCES = 2,
50 PERF_COUNT_HW_CACHE_MISSES = 3,
51 PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4,
52 PERF_COUNT_HW_BRANCH_MISSES = 5,
53 PERF_COUNT_HW_BUS_CYCLES = 6,
54
55 PERF_COUNT_HW_MAX, /* non-ABI */
56};
57
58/*
59 * Generalized hardware cache counters:
60 *
61 * { L1-D, L1-I, LLC, ITLB, DTLB, BPU } x
62 * { read, write, prefetch } x
63 * { accesses, misses }
64 */
65enum perf_hw_cache_id {
66 PERF_COUNT_HW_CACHE_L1D = 0,
67 PERF_COUNT_HW_CACHE_L1I = 1,
68 PERF_COUNT_HW_CACHE_LL = 2,
69 PERF_COUNT_HW_CACHE_DTLB = 3,
70 PERF_COUNT_HW_CACHE_ITLB = 4,
71 PERF_COUNT_HW_CACHE_BPU = 5,
72
73 PERF_COUNT_HW_CACHE_MAX, /* non-ABI */
74};
75
76enum perf_hw_cache_op_id {
77 PERF_COUNT_HW_CACHE_OP_READ = 0,
78 PERF_COUNT_HW_CACHE_OP_WRITE = 1,
79 PERF_COUNT_HW_CACHE_OP_PREFETCH = 2,
80
81 PERF_COUNT_HW_CACHE_OP_MAX, /* non-ABI */
82};
83
84enum perf_hw_cache_op_result_id {
85 PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0,
86 PERF_COUNT_HW_CACHE_RESULT_MISS = 1,
87
88 PERF_COUNT_HW_CACHE_RESULT_MAX, /* non-ABI */
89};
90
91/*
92 * Special "software" counters provided by the kernel, even if the hardware
93 * does not support performance counters. These counters measure various
94 * physical and sw events of the kernel (and allow the profiling of them as
95 * well):
96 */
97enum perf_sw_ids {
98 PERF_COUNT_SW_CPU_CLOCK = 0,
99 PERF_COUNT_SW_TASK_CLOCK = 1,
100 PERF_COUNT_SW_PAGE_FAULTS = 2,
101 PERF_COUNT_SW_CONTEXT_SWITCHES = 3,
102 PERF_COUNT_SW_CPU_MIGRATIONS = 4,
103 PERF_COUNT_SW_PAGE_FAULTS_MIN = 5,
104 PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6,
105
106 PERF_COUNT_SW_MAX, /* non-ABI */
107};
108
109/*
110 * Bits that can be set in attr.sample_type to request information
111 * in the overflow packets.
112 */
113enum perf_counter_sample_format {
114 PERF_SAMPLE_IP = 1U << 0,
115 PERF_SAMPLE_TID = 1U << 1,
116 PERF_SAMPLE_TIME = 1U << 2,
117 PERF_SAMPLE_ADDR = 1U << 3,
118 PERF_SAMPLE_GROUP = 1U << 4,
119 PERF_SAMPLE_CALLCHAIN = 1U << 5,
120 PERF_SAMPLE_ID = 1U << 6,
121 PERF_SAMPLE_CPU = 1U << 7,
122 PERF_SAMPLE_PERIOD = 1U << 8,
123
124 PERF_SAMPLE_MAX = 1U << 9, /* non-ABI */
125};
126
127/*
128 * Bits that can be set in attr.read_format to request that
129 * reads on the counter should return the indicated quantities,
130 * in increasing order of bit value, after the counter value.
131 */
132enum perf_counter_read_format {
133 PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0,
134 PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1,
135 PERF_FORMAT_ID = 1U << 2,
136
137 PERF_FORMAT_MAX = 1U << 3, /* non-ABI */
138};
139
140#define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */
141
142/*
143 * Hardware event to monitor via a performance monitoring counter:
144 */
145struct perf_counter_attr {
146
147 /*
148 * Major type: hardware/software/tracepoint/etc.
149 */
150 __u32 type;
151
152 /*
153 * Size of the attr structure, for fwd/bwd compat.
154 */
155 __u32 size;
156
157 /*
158 * Type specific configuration information.
159 */
160 __u64 config;
161
162 union {
163 __u64 sample_period;
164 __u64 sample_freq;
165 };
166
167 __u64 sample_type;
168 __u64 read_format;
169
170 __u64 disabled : 1, /* off by default */
171 inherit : 1, /* children inherit it */
172 pinned : 1, /* must always be on PMU */
173 exclusive : 1, /* only group on PMU */
174 exclude_user : 1, /* don't count user */
175 exclude_kernel : 1, /* ditto kernel */
176 exclude_hv : 1, /* ditto hypervisor */
177 exclude_idle : 1, /* don't count when idle */
178 mmap : 1, /* include mmap data */
179 comm : 1, /* include comm data */
180 freq : 1, /* use freq, not period */
181
182 __reserved_1 : 53;
183
184 __u32 wakeup_events; /* wakeup every n events */
185 __u32 __reserved_2;
186
187 __u64 __reserved_3;
188};
189
190/*
191 * Ioctls that can be done on a perf counter fd:
192 */
193#define PERF_COUNTER_IOC_ENABLE _IO ('$', 0)
194#define PERF_COUNTER_IOC_DISABLE _IO ('$', 1)
195#define PERF_COUNTER_IOC_REFRESH _IO ('$', 2)
196#define PERF_COUNTER_IOC_RESET _IO ('$', 3)
197#define PERF_COUNTER_IOC_PERIOD _IOW('$', 4, u64)
198
199enum perf_counter_ioc_flags {
200 PERF_IOC_FLAG_GROUP = 1U << 0,
201};
202
203/*
204 * Structure of the page that can be mapped via mmap
205 */
206struct perf_counter_mmap_page {
207 __u32 version; /* version number of this structure */
208 __u32 compat_version; /* lowest version this is compat with */
209
210 /*
211 * Bits needed to read the hw counters in user-space.
212 *
213 * u32 seq;
214 * s64 count;
215 *
216 * do {
217 * seq = pc->lock;
218 *
219 * barrier()
220 * if (pc->index) {
221 * count = pmc_read(pc->index - 1);
222 * count += pc->offset;
223 * } else
224 * goto regular_read;
225 *
226 * barrier();
227 * } while (pc->lock != seq);
228 *
229 * NOTE: for obvious reason this only works on self-monitoring
230 * processes.
231 */
232 __u32 lock; /* seqlock for synchronization */
233 __u32 index; /* hardware counter identifier */
234 __s64 offset; /* add to hardware counter value */
235
236 /*
237 * Control data for the mmap() data buffer.
238 *
239 * User-space reading the @data_head value should issue an rmb(), on
240 * SMP capable platforms, after reading this value -- see
241 * perf_counter_wakeup().
242 *
243 * When the mapping is PROT_WRITE the @data_tail value should be
244 * written by userspace to reflect the last read data. In this case
245 * the kernel will not over-write unread data.
246 */
247 __u64 data_head; /* head in the data section */
248 __u64 data_tail; /* user-space written tail */
249};
250
251#define PERF_EVENT_MISC_CPUMODE_MASK (3 << 0)
252#define PERF_EVENT_MISC_CPUMODE_UNKNOWN (0 << 0)
253#define PERF_EVENT_MISC_KERNEL (1 << 0)
254#define PERF_EVENT_MISC_USER (2 << 0)
255#define PERF_EVENT_MISC_HYPERVISOR (3 << 0)
256#define PERF_EVENT_MISC_OVERFLOW (1 << 2)
257
258struct perf_event_header {
259 __u32 type;
260 __u16 misc;
261 __u16 size;
262};
263
264enum perf_event_type {
265
266 /*
267 * The MMAP events record the PROT_EXEC mappings so that we can
268 * correlate userspace IPs to code. They have the following structure:
269 *
270 * struct {
271 * struct perf_event_header header;
272 *
273 * u32 pid, tid;
274 * u64 addr;
275 * u64 len;
276 * u64 pgoff;
277 * char filename[];
278 * };
279 */
280 PERF_EVENT_MMAP = 1,
281
282 /*
283 * struct {
284 * struct perf_event_header header;
285 * u64 id;
286 * u64 lost;
287 * };
288 */
289 PERF_EVENT_LOST = 2,
290
291 /*
292 * struct {
293 * struct perf_event_header header;
294 *
295 * u32 pid, tid;
296 * char comm[];
297 * };
298 */
299 PERF_EVENT_COMM = 3,
300
301 /*
302 * struct {
303 * struct perf_event_header header;
304 * u64 time;
305 * u64 id;
306 * u64 sample_period;
307 * };
308 */
309 PERF_EVENT_PERIOD = 4,
310
311 /*
312 * struct {
313 * struct perf_event_header header;
314 * u64 time;
315 * u64 id;
316 * };
317 */
318 PERF_EVENT_THROTTLE = 5,
319 PERF_EVENT_UNTHROTTLE = 6,
320
321 /*
322 * struct {
323 * struct perf_event_header header;
324 * u32 pid, ppid;
325 * };
326 */
327 PERF_EVENT_FORK = 7,
328
329 /*
330 * When header.misc & PERF_EVENT_MISC_OVERFLOW the event_type field
331 * will be PERF_SAMPLE_*
332 *
333 * struct {
334 * struct perf_event_header header;
335 *
336 * { u64 ip; } && PERF_SAMPLE_IP
337 * { u32 pid, tid; } && PERF_SAMPLE_TID
338 * { u64 time; } && PERF_SAMPLE_TIME
339 * { u64 addr; } && PERF_SAMPLE_ADDR
340 * { u64 config; } && PERF_SAMPLE_CONFIG
341 * { u32 cpu, res; } && PERF_SAMPLE_CPU
342 *
343 * { u64 nr;
344 * { u64 id, val; } cnt[nr]; } && PERF_SAMPLE_GROUP
345 *
346 * { u64 nr,
347 * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN
348 * };
349 */
350};
351
352enum perf_callchain_context {
353 PERF_CONTEXT_HV = (__u64)-32,
354 PERF_CONTEXT_KERNEL = (__u64)-128,
355 PERF_CONTEXT_USER = (__u64)-512,
356
357 PERF_CONTEXT_GUEST = (__u64)-2048,
358 PERF_CONTEXT_GUEST_KERNEL = (__u64)-2176,
359 PERF_CONTEXT_GUEST_USER = (__u64)-2560,
360
361 PERF_CONTEXT_MAX = (__u64)-4095,
362};
363
364#ifdef __KERNEL__
365/*
366 * Kernel-internal data types and definitions:
367 */
368
369#ifdef CONFIG_PERF_COUNTERS
370# include <asm/perf_counter.h>
371#endif
372
373#include <linux/list.h>
374#include <linux/mutex.h>
375#include <linux/rculist.h>
376#include <linux/rcupdate.h>
377#include <linux/spinlock.h>
378#include <linux/hrtimer.h>
379#include <linux/fs.h>
380#include <linux/pid_namespace.h>
381#include <asm/atomic.h>
382
383#define PERF_MAX_STACK_DEPTH 255
384
385struct perf_callchain_entry {
386 __u64 nr;
387 __u64 ip[PERF_MAX_STACK_DEPTH];
388};
389
390struct task_struct;
391
392/**
393 * struct hw_perf_counter - performance counter hardware details:
394 */
395struct hw_perf_counter {
396#ifdef CONFIG_PERF_COUNTERS
397 union {
398 struct { /* hardware */
399 u64 config;
400 unsigned long config_base;
401 unsigned long counter_base;
402 int idx;
403 };
404 union { /* software */
405 atomic64_t count;
406 struct hrtimer hrtimer;
407 };
408 };
409 atomic64_t prev_count;
410 u64 sample_period;
411 u64 last_period;
412 atomic64_t period_left;
413 u64 interrupts;
414
415 u64 freq_count;
416 u64 freq_interrupts;
417 u64 freq_stamp;
418#endif
419};
420
421struct perf_counter;
422
423/**
424 * struct pmu - generic performance monitoring unit
425 */
426struct pmu {
427 int (*enable) (struct perf_counter *counter);
428 void (*disable) (struct perf_counter *counter);
429 void (*read) (struct perf_counter *counter);
430 void (*unthrottle) (struct perf_counter *counter);
431};
432
433/**
434 * enum perf_counter_active_state - the states of a counter
435 */
436enum perf_counter_active_state {
437 PERF_COUNTER_STATE_ERROR = -2,
438 PERF_COUNTER_STATE_OFF = -1,
439 PERF_COUNTER_STATE_INACTIVE = 0,
440 PERF_COUNTER_STATE_ACTIVE = 1,
441};
442
443struct file;
444
445struct perf_mmap_data {
446 struct rcu_head rcu_head;
447 int nr_pages; /* nr of data pages */
448 int writable; /* are we writable */
449 int nr_locked; /* nr pages mlocked */
450
451 atomic_t poll; /* POLL_ for wakeups */
452 atomic_t events; /* event limit */
453
454 atomic_long_t head; /* write position */
455 atomic_long_t done_head; /* completed head */
456
457 atomic_t lock; /* concurrent writes */
458 atomic_t wakeup; /* needs a wakeup */
459 atomic_t lost; /* nr records lost */
460
461 struct perf_counter_mmap_page *user_page;
462 void *data_pages[0];
463};
464
465struct perf_pending_entry {
466 struct perf_pending_entry *next;
467 void (*func)(struct perf_pending_entry *);
468};
469
470/**
471 * struct perf_counter - performance counter kernel representation:
472 */
473struct perf_counter {
474#ifdef CONFIG_PERF_COUNTERS
475 struct list_head list_entry;
476 struct list_head event_entry;
477 struct list_head sibling_list;
478 int nr_siblings;
479 struct perf_counter *group_leader;
480 const struct pmu *pmu;
481
482 enum perf_counter_active_state state;
483 atomic64_t count;
484
485 /*
486 * These are the total time in nanoseconds that the counter
487 * has been enabled (i.e. eligible to run, and the task has
488 * been scheduled in, if this is a per-task counter)
489 * and running (scheduled onto the CPU), respectively.
490 *
491 * They are computed from tstamp_enabled, tstamp_running and
492 * tstamp_stopped when the counter is in INACTIVE or ACTIVE state.
493 */
494 u64 total_time_enabled;
495 u64 total_time_running;
496
497 /*
498 * These are timestamps used for computing total_time_enabled
499 * and total_time_running when the counter is in INACTIVE or
500 * ACTIVE state, measured in nanoseconds from an arbitrary point
501 * in time.
502 * tstamp_enabled: the notional time when the counter was enabled
503 * tstamp_running: the notional time when the counter was scheduled on
504 * tstamp_stopped: in INACTIVE state, the notional time when the
505 * counter was scheduled off.
506 */
507 u64 tstamp_enabled;
508 u64 tstamp_running;
509 u64 tstamp_stopped;
510
511 struct perf_counter_attr attr;
512 struct hw_perf_counter hw;
513
514 struct perf_counter_context *ctx;
515 struct file *filp;
516
517 /*
518 * These accumulate total time (in nanoseconds) that children
519 * counters have been enabled and running, respectively.
520 */
521 atomic64_t child_total_time_enabled;
522 atomic64_t child_total_time_running;
523
524 /*
525 * Protect attach/detach and child_list:
526 */
527 struct mutex child_mutex;
528 struct list_head child_list;
529 struct perf_counter *parent;
530
531 int oncpu;
532 int cpu;
533
534 struct list_head owner_entry;
535 struct task_struct *owner;
536
537 /* mmap bits */
538 struct mutex mmap_mutex;
539 atomic_t mmap_count;
540 struct perf_mmap_data *data;
541
542 /* poll related */
543 wait_queue_head_t waitq;
544 struct fasync_struct *fasync;
545
546 /* delayed work for NMIs and such */
547 int pending_wakeup;
548 int pending_kill;
549 int pending_disable;
550 struct perf_pending_entry pending;
551
552 atomic_t event_limit;
553
554 void (*destroy)(struct perf_counter *);
555 struct rcu_head rcu_head;
556
557 struct pid_namespace *ns;
558 u64 id;
559#endif
560};
561
562/**
563 * struct perf_counter_context - counter context structure
564 *
565 * Used as a container for task counters and CPU counters as well:
566 */
567struct perf_counter_context {
568 /*
569 * Protect the states of the counters in the list,
570 * nr_active, and the list:
571 */
572 spinlock_t lock;
573 /*
574 * Protect the list of counters. Locking either mutex or lock
575 * is sufficient to ensure the list doesn't change; to change
576 * the list you need to lock both the mutex and the spinlock.
577 */
578 struct mutex mutex;
579
580 struct list_head counter_list;
581 struct list_head event_list;
582 int nr_counters;
583 int nr_active;
584 int is_active;
585 atomic_t refcount;
586 struct task_struct *task;
587
588 /*
589 * Context clock, runs when context enabled.
590 */
591 u64 time;
592 u64 timestamp;
593
594 /*
595 * These fields let us detect when two contexts have both
596 * been cloned (inherited) from a common ancestor.
597 */
598 struct perf_counter_context *parent_ctx;
599 u64 parent_gen;
600 u64 generation;
601 int pin_count;
602 struct rcu_head rcu_head;
603};
604
605/**
606 * struct perf_counter_cpu_context - per cpu counter context structure
607 */
608struct perf_cpu_context {
609 struct perf_counter_context ctx;
610 struct perf_counter_context *task_ctx;
611 int active_oncpu;
612 int max_pertask;
613 int exclusive;
614
615 /*
616 * Recursion avoidance:
617 *
618 * task, softirq, irq, nmi context
619 */
620 int recursion[4];
621};
622
623#ifdef CONFIG_PERF_COUNTERS
624
625/*
626 * Set by architecture code:
627 */
628extern int perf_max_counters;
629
630extern const struct pmu *hw_perf_counter_init(struct perf_counter *counter);
631
632extern void perf_counter_task_sched_in(struct task_struct *task, int cpu);
633extern void perf_counter_task_sched_out(struct task_struct *task,
634 struct task_struct *next, int cpu);
635extern void perf_counter_task_tick(struct task_struct *task, int cpu);
636extern int perf_counter_init_task(struct task_struct *child);
637extern void perf_counter_exit_task(struct task_struct *child);
638extern void perf_counter_free_task(struct task_struct *task);
639extern void set_perf_counter_pending(void);
640extern void perf_counter_do_pending(void);
641extern void perf_counter_print_debug(void);
642extern void __perf_disable(void);
643extern bool __perf_enable(void);
644extern void perf_disable(void);
645extern void perf_enable(void);
646extern int perf_counter_task_disable(void);
647extern int perf_counter_task_enable(void);
648extern int hw_perf_group_sched_in(struct perf_counter *group_leader,
649 struct perf_cpu_context *cpuctx,
650 struct perf_counter_context *ctx, int cpu);
651extern void perf_counter_update_userpage(struct perf_counter *counter);
652
653struct perf_sample_data {
654 struct pt_regs *regs;
655 u64 addr;
656 u64 period;
657};
658
659extern int perf_counter_overflow(struct perf_counter *counter, int nmi,
660 struct perf_sample_data *data);
661
662/*
663 * Return 1 for a software counter, 0 for a hardware counter
664 */
665static inline int is_software_counter(struct perf_counter *counter)
666{
667 return (counter->attr.type != PERF_TYPE_RAW) &&
668 (counter->attr.type != PERF_TYPE_HARDWARE) &&
669 (counter->attr.type != PERF_TYPE_HW_CACHE);
670}
671
672extern void perf_swcounter_event(u32, u64, int, struct pt_regs *, u64);
673
674extern void __perf_counter_mmap(struct vm_area_struct *vma);
675
676static inline void perf_counter_mmap(struct vm_area_struct *vma)
677{
678 if (vma->vm_flags & VM_EXEC)
679 __perf_counter_mmap(vma);
680}
681
682extern void perf_counter_comm(struct task_struct *tsk);
683extern void perf_counter_fork(struct task_struct *tsk);
684
685extern struct perf_callchain_entry *perf_callchain(struct pt_regs *regs);
686
687extern int sysctl_perf_counter_paranoid;
688extern int sysctl_perf_counter_mlock;
689extern int sysctl_perf_counter_sample_rate;
690
691extern void perf_counter_init(void);
692
693#ifndef perf_misc_flags
694#define perf_misc_flags(regs) (user_mode(regs) ? PERF_EVENT_MISC_USER : \
695 PERF_EVENT_MISC_KERNEL)
696#define perf_instruction_pointer(regs) instruction_pointer(regs)
697#endif
698
699#else
700static inline void
701perf_counter_task_sched_in(struct task_struct *task, int cpu) { }
702static inline void
703perf_counter_task_sched_out(struct task_struct *task,
704 struct task_struct *next, int cpu) { }
705static inline void
706perf_counter_task_tick(struct task_struct *task, int cpu) { }
707static inline int perf_counter_init_task(struct task_struct *child) { return 0; }
708static inline void perf_counter_exit_task(struct task_struct *child) { }
709static inline void perf_counter_free_task(struct task_struct *task) { }
710static inline void perf_counter_do_pending(void) { }
711static inline void perf_counter_print_debug(void) { }
712static inline void perf_disable(void) { }
713static inline void perf_enable(void) { }
714static inline int perf_counter_task_disable(void) { return -EINVAL; }
715static inline int perf_counter_task_enable(void) { return -EINVAL; }
716
717static inline void
718perf_swcounter_event(u32 event, u64 nr, int nmi,
719 struct pt_regs *regs, u64 addr) { }
720
721static inline void perf_counter_mmap(struct vm_area_struct *vma) { }
722static inline void perf_counter_comm(struct task_struct *tsk) { }
723static inline void perf_counter_fork(struct task_struct *tsk) { }
724static inline void perf_counter_init(void) { }
725#endif
726
727#endif /* __KERNEL__ */
728#endif /* _LINUX_PERF_COUNTER_H */
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 97e40cb6b588..b1368b8f6572 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -79,7 +79,7 @@ typedef enum {
79 * Need to be a little smaller than phydev->dev.bus_id to leave room 79 * Need to be a little smaller than phydev->dev.bus_id to leave room
80 * for the ":%02x" 80 * for the ":%02x"
81 */ 81 */
82#define MII_BUS_ID_SIZE (BUS_ID_SIZE - 3) 82#define MII_BUS_ID_SIZE (20 - 3)
83 83
84/* 84/*
85 * The Bus class for PHYs. Devices which provide access to 85 * The Bus class for PHYs. Devices which provide access to
@@ -407,7 +407,7 @@ struct phy_driver {
407/* A Structure for boards to register fixups with the PHY Lib */ 407/* A Structure for boards to register fixups with the PHY Lib */
408struct phy_fixup { 408struct phy_fixup {
409 struct list_head list; 409 struct list_head list;
410 char bus_id[BUS_ID_SIZE]; 410 char bus_id[20];
411 u32 phy_uid; 411 u32 phy_uid;
412 u32 phy_uid_mask; 412 u32 phy_uid_mask;
413 int (*run)(struct phy_device *phydev); 413 int (*run)(struct phy_device *phydev);
@@ -444,10 +444,16 @@ static inline int phy_write(struct phy_device *phydev, u16 regnum, u16 val)
444 444
445int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id); 445int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id);
446struct phy_device* get_phy_device(struct mii_bus *bus, int addr); 446struct phy_device* get_phy_device(struct mii_bus *bus, int addr);
447int phy_device_register(struct phy_device *phy);
447int phy_clear_interrupt(struct phy_device *phydev); 448int phy_clear_interrupt(struct phy_device *phydev);
448int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); 449int phy_config_interrupt(struct phy_device *phydev, u32 interrupts);
450int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
451 u32 flags, phy_interface_t interface);
449struct phy_device * phy_attach(struct net_device *dev, 452struct phy_device * phy_attach(struct net_device *dev,
450 const char *bus_id, u32 flags, phy_interface_t interface); 453 const char *bus_id, u32 flags, phy_interface_t interface);
454int phy_connect_direct(struct net_device *dev, struct phy_device *phydev,
455 void (*handler)(struct net_device *), u32 flags,
456 phy_interface_t interface);
451struct phy_device * phy_connect(struct net_device *dev, const char *bus_id, 457struct phy_device * phy_connect(struct net_device *dev, const char *bus_id,
452 void (*handler)(struct net_device *), u32 flags, 458 void (*handler)(struct net_device *), u32 flags,
453 phy_interface_t interface); 459 phy_interface_t interface);
diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
index c8f038554e80..b43a9e039059 100644
--- a/include/linux/pipe_fs_i.h
+++ b/include/linux/pipe_fs_i.h
@@ -152,5 +152,6 @@ void generic_pipe_buf_unmap(struct pipe_inode_info *, struct pipe_buffer *, void
152void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *); 152void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
153int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *); 153int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *);
154int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *); 154int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
155void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *);
155 156
156#endif 157#endif
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index b67bb5d7b221..8dc5123b6305 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -36,8 +36,8 @@ extern struct device platform_bus;
36 36
37extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int); 37extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int);
38extern int platform_get_irq(struct platform_device *, unsigned int); 38extern int platform_get_irq(struct platform_device *, unsigned int);
39extern struct resource *platform_get_resource_byname(struct platform_device *, unsigned int, char *); 39extern struct resource *platform_get_resource_byname(struct platform_device *, unsigned int, const char *);
40extern int platform_get_irq_byname(struct platform_device *, char *); 40extern int platform_get_irq_byname(struct platform_device *, const char *);
41extern int platform_add_devices(struct platform_device **, int); 41extern int platform_add_devices(struct platform_device **, int);
42 42
43extern struct platform_device *platform_device_register_simple(const char *, int id, 43extern struct platform_device *platform_device_register_simple(const char *, int id,
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 1d4e2d289821..b3f74764a586 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -382,14 +382,13 @@ struct dev_pm_info {
382#ifdef CONFIG_PM_SLEEP 382#ifdef CONFIG_PM_SLEEP
383extern void device_pm_lock(void); 383extern void device_pm_lock(void);
384extern int sysdev_resume(void); 384extern int sysdev_resume(void);
385extern void device_power_up(pm_message_t state); 385extern void dpm_resume_noirq(pm_message_t state);
386extern void device_resume(pm_message_t state); 386extern void dpm_resume_end(pm_message_t state);
387 387
388extern void device_pm_unlock(void); 388extern void device_pm_unlock(void);
389extern int sysdev_suspend(pm_message_t state); 389extern int sysdev_suspend(pm_message_t state);
390extern int device_power_down(pm_message_t state); 390extern int dpm_suspend_noirq(pm_message_t state);
391extern int device_suspend(pm_message_t state); 391extern int dpm_suspend_start(pm_message_t state);
392extern int device_prepare_suspend(pm_message_t state);
393 392
394extern void __suspend_report_result(const char *function, void *fn, int ret); 393extern void __suspend_report_result(const char *function, void *fn, int ret);
395 394
@@ -403,7 +402,7 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
403#define device_pm_lock() do {} while (0) 402#define device_pm_lock() do {} while (0)
404#define device_pm_unlock() do {} while (0) 403#define device_pm_unlock() do {} while (0)
405 404
406static inline int device_suspend(pm_message_t state) 405static inline int dpm_suspend_start(pm_message_t state)
407{ 406{
408 return 0; 407 return 0;
409} 408}
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index ca3c88773028..b063c7328ba5 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -446,6 +446,7 @@ int pnp_start_dev(struct pnp_dev *dev);
446int pnp_stop_dev(struct pnp_dev *dev); 446int pnp_stop_dev(struct pnp_dev *dev);
447int pnp_activate_dev(struct pnp_dev *dev); 447int pnp_activate_dev(struct pnp_dev *dev);
448int pnp_disable_dev(struct pnp_dev *dev); 448int pnp_disable_dev(struct pnp_dev *dev);
449int pnp_range_reserved(resource_size_t start, resource_size_t end);
449 450
450/* protocol helpers */ 451/* protocol helpers */
451int pnp_is_active(struct pnp_dev *dev); 452int pnp_is_active(struct pnp_dev *dev);
@@ -476,6 +477,7 @@ static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; }
476static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; } 477static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; }
477static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; } 478static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; }
478static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; } 479static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; }
480static inline int pnp_range_reserved(resource_size_t start, resource_size_t end) { return 0;}
479 481
480/* protocol helpers */ 482/* protocol helpers */
481static inline int pnp_is_active(struct pnp_dev *dev) { return 0; } 483static inline int pnp_is_active(struct pnp_dev *dev) { return 0; }
diff --git a/include/linux/poll.h b/include/linux/poll.h
index 8c24ef8d9976..fa287f25138d 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -32,6 +32,7 @@ typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_
32 32
33typedef struct poll_table_struct { 33typedef struct poll_table_struct {
34 poll_queue_proc qproc; 34 poll_queue_proc qproc;
35 unsigned long key;
35} poll_table; 36} poll_table;
36 37
37static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p) 38static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_address, poll_table *p)
@@ -43,10 +44,12 @@ static inline void poll_wait(struct file * filp, wait_queue_head_t * wait_addres
43static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc) 44static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc)
44{ 45{
45 pt->qproc = qproc; 46 pt->qproc = qproc;
47 pt->key = ~0UL; /* all events enabled */
46} 48}
47 49
48struct poll_table_entry { 50struct poll_table_entry {
49 struct file *filp; 51 struct file *filp;
52 unsigned long key;
50 wait_queue_t wait; 53 wait_queue_t wait;
51 wait_queue_head_t *wait_address; 54 wait_queue_head_t *wait_address;
52}; 55};
diff --git a/include/linux/pps.h b/include/linux/pps.h
new file mode 100644
index 000000000000..cfe5c7214ec6
--- /dev/null
+++ b/include/linux/pps.h
@@ -0,0 +1,122 @@
1/*
2 * PPS API header
3 *
4 * Copyright (C) 2005-2009 Rodolfo Giometti <giometti@linux.it>
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
22#ifndef _PPS_H_
23#define _PPS_H_
24
25#define PPS_VERSION "5.3.6"
26#define PPS_MAX_SOURCES 16 /* should be enough... */
27
28/* Implementation note: the logical states ``assert'' and ``clear''
29 * are implemented in terms of the chip register, i.e. ``assert''
30 * means the bit is set. */
31
32/*
33 * 3.2 New data structures
34 */
35
36#define PPS_API_VERS_1 1
37#define PPS_API_VERS PPS_API_VERS_1 /* we use API version 1 */
38#define PPS_MAX_NAME_LEN 32
39
40/* 32-bit vs. 64-bit compatibility.
41 *
42 * 0n i386, the alignment of a uint64_t is only 4 bytes, while on most other
43 * architectures it's 8 bytes. On i386, there will be no padding between the
44 * two consecutive 'struct pps_ktime' members of struct pps_kinfo and struct
45 * pps_kparams. But on most platforms there will be padding to ensure correct
46 * alignment.
47 *
48 * The simple fix is probably to add an explicit padding.
49 * [David Woodhouse]
50 */
51struct pps_ktime {
52 __s64 sec;
53 __s32 nsec;
54 __u32 flags;
55};
56#define PPS_TIME_INVALID (1<<0) /* used to specify timeout==NULL */
57
58struct pps_kinfo {
59 __u32 assert_sequence; /* seq. num. of assert event */
60 __u32 clear_sequence; /* seq. num. of clear event */
61 struct pps_ktime assert_tu; /* time of assert event */
62 struct pps_ktime clear_tu; /* time of clear event */
63 int current_mode; /* current mode bits */
64};
65
66struct pps_kparams {
67 int api_version; /* API version # */
68 int mode; /* mode bits */
69 struct pps_ktime assert_off_tu; /* offset compensation for assert */
70 struct pps_ktime clear_off_tu; /* offset compensation for clear */
71};
72
73/*
74 * 3.3 Mode bit definitions
75 */
76
77/* Device/implementation parameters */
78#define PPS_CAPTUREASSERT 0x01 /* capture assert events */
79#define PPS_CAPTURECLEAR 0x02 /* capture clear events */
80#define PPS_CAPTUREBOTH 0x03 /* capture assert and clear events */
81
82#define PPS_OFFSETASSERT 0x10 /* apply compensation for assert ev. */
83#define PPS_OFFSETCLEAR 0x20 /* apply compensation for clear ev. */
84
85#define PPS_CANWAIT 0x100 /* can we wait for an event? */
86#define PPS_CANPOLL 0x200 /* bit reserved for future use */
87
88/* Kernel actions */
89#define PPS_ECHOASSERT 0x40 /* feed back assert event to output */
90#define PPS_ECHOCLEAR 0x80 /* feed back clear event to output */
91
92/* Timestamp formats */
93#define PPS_TSFMT_TSPEC 0x1000 /* select timespec format */
94#define PPS_TSFMT_NTPFP 0x2000 /* select NTP format */
95
96/*
97 * 3.4.4 New functions: disciplining the kernel timebase
98 */
99
100/* Kernel consumers */
101#define PPS_KC_HARDPPS 0 /* hardpps() (or equivalent) */
102#define PPS_KC_HARDPPS_PLL 1 /* hardpps() constrained to
103 use a phase-locked loop */
104#define PPS_KC_HARDPPS_FLL 2 /* hardpps() constrained to
105 use a frequency-locked loop */
106/*
107 * Here begins the implementation-specific part!
108 */
109
110struct pps_fdata {
111 struct pps_kinfo info;
112 struct pps_ktime timeout;
113};
114
115#include <linux/ioctl.h>
116
117#define PPS_GETPARAMS _IOR('p', 0xa1, struct pps_kparams *)
118#define PPS_SETPARAMS _IOW('p', 0xa2, struct pps_kparams *)
119#define PPS_GETCAP _IOR('p', 0xa3, int *)
120#define PPS_FETCH _IOWR('p', 0xa4, struct pps_fdata *)
121
122#endif /* _PPS_H_ */
diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h
new file mode 100644
index 000000000000..e0a193f830ef
--- /dev/null
+++ b/include/linux/pps_kernel.h
@@ -0,0 +1,89 @@
1/*
2 * PPS API kernel header
3 *
4 * Copyright (C) 2009 Rodolfo Giometti <giometti@linux.it>
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#include <linux/pps.h>
22
23#include <linux/cdev.h>
24#include <linux/device.h>
25#include <linux/time.h>
26
27/*
28 * Global defines
29 */
30
31/* The specific PPS source info */
32struct pps_source_info {
33 char name[PPS_MAX_NAME_LEN]; /* simbolic name */
34 char path[PPS_MAX_NAME_LEN]; /* path of connected device */
35 int mode; /* PPS's allowed mode */
36
37 void (*echo)(int source, int event, void *data); /* PPS echo function */
38
39 struct module *owner;
40 struct device *dev;
41};
42
43/* The main struct */
44struct pps_device {
45 struct pps_source_info info; /* PSS source info */
46
47 struct pps_kparams params; /* PPS's current params */
48
49 __u32 assert_sequence; /* PPS' assert event seq # */
50 __u32 clear_sequence; /* PPS' clear event seq # */
51 struct pps_ktime assert_tu;
52 struct pps_ktime clear_tu;
53 int current_mode; /* PPS mode at event time */
54
55 int go; /* PPS event is arrived? */
56 wait_queue_head_t queue; /* PPS event queue */
57
58 unsigned int id; /* PPS source unique ID */
59 struct cdev cdev;
60 struct device *dev;
61 int devno;
62 struct fasync_struct *async_queue; /* fasync method */
63 spinlock_t lock;
64
65 atomic_t usage; /* usage count */
66};
67
68/*
69 * Global variables
70 */
71
72extern spinlock_t pps_idr_lock;
73extern struct idr pps_idr;
74extern struct timespec pps_irq_ts[];
75
76extern struct device_attribute pps_attrs[];
77
78/*
79 * Exported functions
80 */
81
82struct pps_device *pps_get_source(int source);
83extern void pps_put_source(struct pps_device *pps);
84extern int pps_register_source(struct pps_source_info *info,
85 int default_params);
86extern void pps_unregister_source(int source);
87extern int pps_register_cdev(struct pps_device *pps);
88extern void pps_unregister_cdev(struct pps_device *pps);
89extern void pps_event(int source, struct pps_ktime *ts, int event, void *data);
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index 48d887e3c6e7..b00df4c79c63 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -85,4 +85,7 @@
85#define PR_SET_TIMERSLACK 29 85#define PR_SET_TIMERSLACK 29
86#define PR_GET_TIMERSLACK 30 86#define PR_GET_TIMERSLACK 30
87 87
88#define PR_TASK_PERF_COUNTERS_DISABLE 31
89#define PR_TASK_PERF_COUNTERS_ENABLE 32
90
88#endif /* _LINUX_PRCTL_H */ 91#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index fbfa3d44d33d..e6e77d31c418 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -93,20 +93,9 @@ struct vmcore {
93 93
94#ifdef CONFIG_PROC_FS 94#ifdef CONFIG_PROC_FS
95 95
96extern spinlock_t proc_subdir_lock;
97
98extern void proc_root_init(void); 96extern void proc_root_init(void);
99 97
100void proc_flush_task(struct task_struct *task); 98void proc_flush_task(struct task_struct *task);
101struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *);
102int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir);
103unsigned long task_vsize(struct mm_struct *);
104int task_statm(struct mm_struct *, int *, int *, int *, int *);
105void task_mem(struct seq_file *, struct mm_struct *);
106void clear_refs_smap(struct mm_struct *mm);
107
108struct proc_dir_entry *de_get(struct proc_dir_entry *de);
109void de_put(struct proc_dir_entry *de);
110 99
111extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode, 100extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
112 struct proc_dir_entry *parent); 101 struct proc_dir_entry *parent);
@@ -116,20 +105,7 @@ struct proc_dir_entry *proc_create_data(const char *name, mode_t mode,
116 void *data); 105 void *data);
117extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent); 106extern void remove_proc_entry(const char *name, struct proc_dir_entry *parent);
118 107
119extern struct vfsmount *proc_mnt;
120struct pid_namespace; 108struct pid_namespace;
121extern int proc_fill_super(struct super_block *);
122extern struct inode *proc_get_inode(struct super_block *, unsigned int, struct proc_dir_entry *);
123
124/*
125 * These are generic /proc routines that use the internal
126 * "struct proc_dir_entry" tree to traverse the filesystem.
127 *
128 * The /proc root directory has extended versions to take care
129 * of the /proc/<pid> subdirectories.
130 */
131extern int proc_readdir(struct file *, void *, filldir_t);
132extern struct dentry *proc_lookup(struct inode *, struct dentry *, struct nameidata *);
133 109
134extern int pid_ns_prepare_proc(struct pid_namespace *ns); 110extern int pid_ns_prepare_proc(struct pid_namespace *ns);
135extern void pid_ns_release_proc(struct pid_namespace *ns); 111extern void pid_ns_release_proc(struct pid_namespace *ns);
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 67c15653fc23..7456d7d87a19 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -81,7 +81,6 @@
81 81
82 82
83extern long arch_ptrace(struct task_struct *child, long request, long addr, long data); 83extern long arch_ptrace(struct task_struct *child, long request, long addr, long data);
84extern struct task_struct *ptrace_get_task_struct(pid_t pid);
85extern int ptrace_traceme(void); 84extern int ptrace_traceme(void);
86extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); 85extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len);
87extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); 86extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len);
@@ -95,7 +94,6 @@ extern void __ptrace_link(struct task_struct *child,
95 struct task_struct *new_parent); 94 struct task_struct *new_parent);
96extern void __ptrace_unlink(struct task_struct *child); 95extern void __ptrace_unlink(struct task_struct *child);
97extern void exit_ptrace(struct task_struct *tracer); 96extern void exit_ptrace(struct task_struct *tracer);
98extern void ptrace_fork(struct task_struct *task, unsigned long clone_flags);
99#define PTRACE_MODE_READ 1 97#define PTRACE_MODE_READ 1
100#define PTRACE_MODE_ATTACH 2 98#define PTRACE_MODE_ATTACH 2
101/* Returns 0 on success, -errno on denial. */ 99/* Returns 0 on success, -errno on denial. */
@@ -327,15 +325,6 @@ static inline void user_enable_block_step(struct task_struct *task)
327#define arch_ptrace_untrace(task) do { } while (0) 325#define arch_ptrace_untrace(task) do { } while (0)
328#endif 326#endif
329 327
330#ifndef arch_ptrace_fork
331/*
332 * Do machine-specific work to initialize a new task.
333 *
334 * This is called from copy_process().
335 */
336#define arch_ptrace_fork(child, clone_flags) do { } while (0)
337#endif
338
339extern int task_current_syscall(struct task_struct *target, long *callno, 328extern int task_current_syscall(struct task_struct *target, long *callno,
340 unsigned long args[6], unsigned int maxargs, 329 unsigned long args[6], unsigned int maxargs,
341 unsigned long *sp, unsigned long *pc); 330 unsigned long *sp, unsigned long *pc);
diff --git a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h
index 787d19ea9f46..8b9aee1a9ce3 100644
--- a/include/linux/qnx4_fs.h
+++ b/include/linux/qnx4_fs.h
@@ -85,65 +85,4 @@ struct qnx4_super_block {
85 struct qnx4_inode_entry AltBoot; 85 struct qnx4_inode_entry AltBoot;
86}; 86};
87 87
88#ifdef __KERNEL__
89
90#define QNX4_DEBUG 0
91
92#if QNX4_DEBUG
93#define QNX4DEBUG(X) printk X
94#else
95#define QNX4DEBUG(X) (void) 0
96#endif
97
98struct qnx4_sb_info {
99 struct buffer_head *sb_buf; /* superblock buffer */
100 struct qnx4_super_block *sb; /* our superblock */
101 unsigned int Version; /* may be useful */
102 struct qnx4_inode_entry *BitMap; /* useful */
103};
104
105struct qnx4_inode_info {
106 struct qnx4_inode_entry raw;
107 loff_t mmu_private;
108 struct inode vfs_inode;
109};
110
111extern struct inode *qnx4_iget(struct super_block *, unsigned long);
112extern struct dentry *qnx4_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd);
113extern unsigned long qnx4_count_free_blocks(struct super_block *sb);
114extern unsigned long qnx4_block_map(struct inode *inode, long iblock);
115
116extern struct buffer_head *qnx4_bread(struct inode *, int, int);
117
118extern const struct inode_operations qnx4_file_inode_operations;
119extern const struct inode_operations qnx4_dir_inode_operations;
120extern const struct file_operations qnx4_file_operations;
121extern const struct file_operations qnx4_dir_operations;
122extern int qnx4_is_free(struct super_block *sb, long block);
123extern int qnx4_set_bitmap(struct super_block *sb, long block, int busy);
124extern int qnx4_create(struct inode *inode, struct dentry *dentry, int mode, struct nameidata *nd);
125extern void qnx4_truncate(struct inode *inode);
126extern void qnx4_free_inode(struct inode *inode);
127extern int qnx4_unlink(struct inode *dir, struct dentry *dentry);
128extern int qnx4_rmdir(struct inode *dir, struct dentry *dentry);
129extern int qnx4_sync_file(struct file *file, struct dentry *dentry, int);
130extern int qnx4_sync_inode(struct inode *inode);
131
132static inline struct qnx4_sb_info *qnx4_sb(struct super_block *sb)
133{
134 return sb->s_fs_info;
135}
136
137static inline struct qnx4_inode_info *qnx4_i(struct inode *inode)
138{
139 return container_of(inode, struct qnx4_inode_info, vfs_inode);
140}
141
142static inline struct qnx4_inode_entry *qnx4_raw_inode(struct inode *inode)
143{
144 return &qnx4_i(inode)->raw;
145}
146
147#endif /* __KERNEL__ */
148
149#endif 88#endif
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 36353d95c8db..7bc457593684 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -20,7 +20,12 @@ static inline struct quota_info *sb_dqopt(struct super_block *sb)
20/* 20/*
21 * declaration of quota_function calls in kernel. 21 * declaration of quota_function calls in kernel.
22 */ 22 */
23void sync_dquots(struct super_block *sb, int type); 23void sync_quota_sb(struct super_block *sb, int type);
24static inline void writeout_quota_sb(struct super_block *sb, int type)
25{
26 if (sb->s_qcop->quota_sync)
27 sb->s_qcop->quota_sync(sb, type);
28}
24 29
25int dquot_initialize(struct inode *inode, int type); 30int dquot_initialize(struct inode *inode, int type);
26int dquot_drop(struct inode *inode); 31int dquot_drop(struct inode *inode);
@@ -253,12 +258,7 @@ static inline void vfs_dq_free_inode(struct inode *inode)
253 inode->i_sb->dq_op->free_inode(inode, 1); 258 inode->i_sb->dq_op->free_inode(inode, 1);
254} 259}
255 260
256/* The following two functions cannot be called inside a transaction */ 261/* Cannot be called inside a transaction */
257static inline void vfs_dq_sync(struct super_block *sb)
258{
259 sync_dquots(sb, -1);
260}
261
262static inline int vfs_dq_off(struct super_block *sb, int remount) 262static inline int vfs_dq_off(struct super_block *sb, int remount)
263{ 263{
264 int ret = -ENOSYS; 264 int ret = -ENOSYS;
@@ -334,7 +334,11 @@ static inline void vfs_dq_free_inode(struct inode *inode)
334{ 334{
335} 335}
336 336
337static inline void vfs_dq_sync(struct super_block *sb) 337static inline void sync_quota_sb(struct super_block *sb, int type)
338{
339}
340
341static inline void writeout_quota_sb(struct super_block *sb, int type)
338{ 342{
339} 343}
340 344
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index 355f6e80db0d..c5da74918096 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -167,6 +167,8 @@ radix_tree_gang_lookup_slot(struct radix_tree_root *root, void ***results,
167 unsigned long first_index, unsigned int max_items); 167 unsigned long first_index, unsigned int max_items);
168unsigned long radix_tree_next_hole(struct radix_tree_root *root, 168unsigned long radix_tree_next_hole(struct radix_tree_root *root,
169 unsigned long index, unsigned long max_scan); 169 unsigned long index, unsigned long max_scan);
170unsigned long radix_tree_prev_hole(struct radix_tree_root *root,
171 unsigned long index, unsigned long max_scan);
170int radix_tree_preload(gfp_t gfp_mask); 172int radix_tree_preload(gfp_t gfp_mask);
171void radix_tree_init(void); 173void radix_tree_init(void);
172void *radix_tree_tag_set(struct radix_tree_root *root, 174void *radix_tree_tag_set(struct radix_tree_root *root,
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index 6ba830fa8538..ffa2efbbe382 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -232,7 +232,7 @@ struct mdp_superblock_1 {
232 __le64 reshape_position; /* next address in array-space for reshape */ 232 __le64 reshape_position; /* next address in array-space for reshape */
233 __le32 delta_disks; /* change in number of raid_disks */ 233 __le32 delta_disks; /* change in number of raid_disks */
234 __le32 new_layout; /* new layout */ 234 __le32 new_layout; /* new layout */
235 __le32 new_chunk; /* new chunk size (bytes) */ 235 __le32 new_chunk; /* new chunk size (512byte sectors) */
236 __u8 pad1[128-124]; /* set to 0 when written */ 236 __u8 pad1[128-124]; /* set to 0 when written */
237 237
238 /* constant this-device information - 64 bytes */ 238 /* constant this-device information - 64 bytes */
diff --git a/include/linux/rational.h b/include/linux/rational.h
new file mode 100644
index 000000000000..4f532fcd9eea
--- /dev/null
+++ b/include/linux/rational.h
@@ -0,0 +1,19 @@
1/*
2 * rational fractions
3 *
4 * Copyright (C) 2009 emlix GmbH, Oskar Schirmer <os@emlix.com>
5 *
6 * helper functions when coping with rational numbers,
7 * e.g. when calculating optimum numerator/denominator pairs for
8 * pll configuration taking into account restricted register size
9 */
10
11#ifndef _LINUX_RATIONAL_H
12#define _LINUX_RATIONAL_H
13
14void rational_best_approximation(
15 unsigned long given_numerator, unsigned long given_denominator,
16 unsigned long max_numerator, unsigned long max_denominator,
17 unsigned long *best_numerator, unsigned long *best_denominator);
18
19#endif /* _LINUX_RATIONAL_H */
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index e649bd3f2c97..5710f43bbc9e 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -198,6 +198,32 @@ static inline void list_splice_init_rcu(struct list_head *list,
198 at->prev = last; 198 at->prev = last;
199} 199}
200 200
201/**
202 * list_entry_rcu - get the struct for this entry
203 * @ptr: the &struct list_head pointer.
204 * @type: the type of the struct this is embedded in.
205 * @member: the name of the list_struct within the struct.
206 *
207 * This primitive may safely run concurrently with the _rcu list-mutation
208 * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock().
209 */
210#define list_entry_rcu(ptr, type, member) \
211 container_of(rcu_dereference(ptr), type, member)
212
213/**
214 * list_first_entry_rcu - get the first element from a list
215 * @ptr: the list head to take the element from.
216 * @type: the type of the struct this is embedded in.
217 * @member: the name of the list_struct within the struct.
218 *
219 * Note, that list is expected to be not empty.
220 *
221 * This primitive may safely run concurrently with the _rcu list-mutation
222 * primitives such as list_add_rcu() as long as it's guarded by rcu_read_lock().
223 */
224#define list_first_entry_rcu(ptr, type, member) \
225 list_entry_rcu((ptr)->next, type, member)
226
201#define __list_for_each_rcu(pos, head) \ 227#define __list_for_each_rcu(pos, head) \
202 for (pos = rcu_dereference((head)->next); \ 228 for (pos = rcu_dereference((head)->next); \
203 pos != (head); \ 229 pos != (head); \
@@ -214,9 +240,9 @@ static inline void list_splice_init_rcu(struct list_head *list,
214 * as long as the traversal is guarded by rcu_read_lock(). 240 * as long as the traversal is guarded by rcu_read_lock().
215 */ 241 */
216#define list_for_each_entry_rcu(pos, head, member) \ 242#define list_for_each_entry_rcu(pos, head, member) \
217 for (pos = list_entry(rcu_dereference((head)->next), typeof(*pos), member); \ 243 for (pos = list_entry_rcu((head)->next, typeof(*pos), member); \
218 prefetch(pos->member.next), &pos->member != (head); \ 244 prefetch(pos->member.next), &pos->member != (head); \
219 pos = list_entry(rcu_dereference(pos->member.next), typeof(*pos), member)) 245 pos = list_entry_rcu(pos->member.next, typeof(*pos), member))
220 246
221 247
222/** 248/**
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 58b2aa5312b9..5a5153806c42 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -161,8 +161,15 @@ struct rcu_data {
161 unsigned long offline_fqs; /* Kicked due to being offline. */ 161 unsigned long offline_fqs; /* Kicked due to being offline. */
162 unsigned long resched_ipi; /* Sent a resched IPI. */ 162 unsigned long resched_ipi; /* Sent a resched IPI. */
163 163
164 /* 5) For future __rcu_pending statistics. */ 164 /* 5) __rcu_pending() statistics. */
165 long n_rcu_pending; /* rcu_pending() calls since boot. */ 165 long n_rcu_pending; /* rcu_pending() calls since boot. */
166 long n_rp_qs_pending;
167 long n_rp_cb_ready;
168 long n_rp_cpu_needs_gp;
169 long n_rp_gp_completed;
170 long n_rp_gp_started;
171 long n_rp_need_fqs;
172 long n_rp_need_nothing;
166 173
167 int cpu; 174 int cpu;
168}; 175};
diff --git a/include/linux/regulator/lp3971.h b/include/linux/regulator/lp3971.h
new file mode 100644
index 000000000000..61401649fe7d
--- /dev/null
+++ b/include/linux/regulator/lp3971.h
@@ -0,0 +1,51 @@
1/*
2 * National Semiconductors LP3971 PMIC chip client interface
3 *
4 * Copyright (C) 2009 Samsung Electronics
5 * Author: Marek Szyprowski <m.szyprowski@samsung.com>
6 *
7 * Based on wm8400.h
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#ifndef __LINUX_REGULATOR_LP3971_H
25#define __LINUX_REGULATOR_LP3971_H
26
27#include <linux/regulator/machine.h>
28
29#define LP3971_LDO1 0
30#define LP3971_LDO2 1
31#define LP3971_LDO3 2
32#define LP3971_LDO4 3
33#define LP3971_LDO5 4
34
35#define LP3971_DCDC1 5
36#define LP3971_DCDC2 6
37#define LP3971_DCDC3 7
38
39#define LP3971_NUM_REGULATORS 8
40
41struct lp3971_regulator_subdev {
42 int id;
43 struct regulator_init_data *initdata;
44};
45
46struct lp3971_platform_data {
47 int num_regulators;
48 struct lp3971_regulator_subdev *regulators;
49};
50
51#endif
diff --git a/include/linux/regulator/max1586.h b/include/linux/regulator/max1586.h
new file mode 100644
index 000000000000..44563192bf16
--- /dev/null
+++ b/include/linux/regulator/max1586.h
@@ -0,0 +1,63 @@
1/*
2 * max1586.h -- Voltage regulation for the Maxim 1586
3 *
4 * Copyright (C) 2008 Robert Jarzmik
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef REGULATOR_MAX1586
22#define REGULATOR_MAX1586
23
24#include <linux/regulator/machine.h>
25
26#define MAX1586_V3 0
27#define MAX1586_V6 1
28
29/* precalculated values for v3_gain */
30#define MAX1586_GAIN_NO_R24 1000000 /* 700000 .. 1475000 mV */
31#define MAX1586_GAIN_R24_3k32 1051098 /* 735768 .. 1550369 mV */
32#define MAX1586_GAIN_R24_5k11 1078648 /* 755053 .. 1591005 mV */
33#define MAX1586_GAIN_R24_7k5 1115432 /* 780802 .. 1645262 mV */
34
35/**
36 * max1586_subdev_data - regulator data
37 * @id: regulator Id (either MAX1586_V3 or MAX1586_V6)
38 * @name: regulator cute name (example for V3: "vcc_core")
39 * @platform_data: regulator init data (contraints, supplies, ...)
40 */
41struct max1586_subdev_data {
42 int id;
43 char *name;
44 struct regulator_init_data *platform_data;
45};
46
47/**
48 * max1586_platform_data - platform data for max1586
49 * @num_subdevs: number of regultors used (may be 1 or 2)
50 * @subdevs: regulator used
51 * At most, there will be a regulator for V3 and one for V6 voltages.
52 * @v3_gain: gain on the V3 voltage output multiplied by 1e6.
53 * This can be calculated as ((1 + R24/R25 + R24/185.5kOhm) * 1e6)
54 * for an external resistor configuration as described in the
55 * data sheet (R25=100kOhm).
56 */
57struct max1586_platform_data {
58 int num_subdevs;
59 struct max1586_subdev_data *subdevs;
60 int v3_gain;
61};
62
63#endif
diff --git a/include/linux/regulator/userspace-consumer.h b/include/linux/regulator/userspace-consumer.h
new file mode 100644
index 000000000000..b4554ce9d4bb
--- /dev/null
+++ b/include/linux/regulator/userspace-consumer.h
@@ -0,0 +1,25 @@
1#ifndef __REGULATOR_PLATFORM_CONSUMER_H_
2#define __REGULATOR_PLATFORM_CONSUMER_H_
3
4struct regulator_consumer_supply;
5
6/**
7 * struct regulator_userspace_consumer_data - line consumer
8 * initialisation data.
9 *
10 * @name: Name for the consumer line
11 * @num_supplies: Number of supplies feeding the line
12 * @supplies: Supplies configuration.
13 * @init_on: Set if the regulators supplying the line should be
14 * enabled during initialisation
15 */
16struct regulator_userspace_consumer_data {
17 const char *name;
18
19 int num_supplies;
20 struct regulator_bulk_data *supplies;
21
22 bool init_on;
23};
24
25#endif /* __REGULATOR_PLATFORM_CONSUMER_H_ */
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 2245c78d5876..dd31e7bae35c 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -660,23 +660,54 @@ static inline void set_le_key_k_type(int version, struct reiserfs_key *key,
660 cpu_to_le32(type2uniqueness(type))) 660 cpu_to_le32(type2uniqueness(type)))
661 : (void)(set_offset_v2_k_type(&(key->u.k_offset_v2), type)); 661 : (void)(set_offset_v2_k_type(&(key->u.k_offset_v2), type));
662} 662}
663
663static inline void set_le_ih_k_type(struct item_head *ih, int type) 664static inline void set_le_ih_k_type(struct item_head *ih, int type)
664{ 665{
665 set_le_key_k_type(ih_version(ih), &(ih->ih_key), type); 666 set_le_key_k_type(ih_version(ih), &(ih->ih_key), type);
666} 667}
667 668
668#define is_direntry_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRENTRY) 669static inline int is_direntry_le_key(int version, struct reiserfs_key *key)
669#define is_direct_le_key(version,key) (le_key_k_type (version, key) == TYPE_DIRECT) 670{
670#define is_indirect_le_key(version,key) (le_key_k_type (version, key) == TYPE_INDIRECT) 671 return le_key_k_type(version, key) == TYPE_DIRENTRY;
671#define is_statdata_le_key(version,key) (le_key_k_type (version, key) == TYPE_STAT_DATA) 672}
673
674static inline int is_direct_le_key(int version, struct reiserfs_key *key)
675{
676 return le_key_k_type(version, key) == TYPE_DIRECT;
677}
678
679static inline int is_indirect_le_key(int version, struct reiserfs_key *key)
680{
681 return le_key_k_type(version, key) == TYPE_INDIRECT;
682}
683
684static inline int is_statdata_le_key(int version, struct reiserfs_key *key)
685{
686 return le_key_k_type(version, key) == TYPE_STAT_DATA;
687}
672 688
673// 689//
674// item header has version. 690// item header has version.
675// 691//
676#define is_direntry_le_ih(ih) is_direntry_le_key (ih_version (ih), &((ih)->ih_key)) 692static inline int is_direntry_le_ih(struct item_head *ih)
677#define is_direct_le_ih(ih) is_direct_le_key (ih_version (ih), &((ih)->ih_key)) 693{
678#define is_indirect_le_ih(ih) is_indirect_le_key (ih_version(ih), &((ih)->ih_key)) 694 return is_direntry_le_key(ih_version(ih), &ih->ih_key);
679#define is_statdata_le_ih(ih) is_statdata_le_key (ih_version (ih), &((ih)->ih_key)) 695}
696
697static inline int is_direct_le_ih(struct item_head *ih)
698{
699 return is_direct_le_key(ih_version(ih), &ih->ih_key);
700}
701
702static inline int is_indirect_le_ih(struct item_head *ih)
703{
704 return is_indirect_le_key(ih_version(ih), &ih->ih_key);
705}
706
707static inline int is_statdata_le_ih(struct item_head *ih)
708{
709 return is_statdata_le_key(ih_version(ih), &ih->ih_key);
710}
680 711
681// 712//
682// key is pointer to cpu key, result is cpu 713// key is pointer to cpu key, result is cpu
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index 6473650c28f1..dab68bbed675 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -453,6 +453,7 @@ enum reiserfs_mount_options {
453 REISERFS_ATTRS, 453 REISERFS_ATTRS,
454 REISERFS_XATTRS_USER, 454 REISERFS_XATTRS_USER,
455 REISERFS_POSIXACL, 455 REISERFS_POSIXACL,
456 REISERFS_EXPOSE_PRIVROOT,
456 REISERFS_BARRIER_NONE, 457 REISERFS_BARRIER_NONE,
457 REISERFS_BARRIER_FLUSH, 458 REISERFS_BARRIER_FLUSH,
458 459
@@ -490,6 +491,7 @@ enum reiserfs_mount_options {
490#define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK)) 491#define reiserfs_data_writeback(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_DATA_WRITEBACK))
491#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))
492#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))
494#define reiserfs_expose_privroot(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_EXPOSE_PRIVROOT))
493#define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s)) 495#define reiserfs_xattrs_optional(s) (reiserfs_xattrs_user(s) || reiserfs_posixacl(s))
494#define reiserfs_barrier_none(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_BARRIER_NONE)) 496#define reiserfs_barrier_none(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_BARRIER_NONE))
495#define reiserfs_barrier_flush(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_BARRIER_FLUSH)) 497#define reiserfs_barrier_flush(s) (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_BARRIER_FLUSH))
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 4c5bcf6ca7e8..511f42fc6816 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -49,6 +49,8 @@ struct res_counter {
49 struct res_counter *parent; 49 struct res_counter *parent;
50}; 50};
51 51
52#define RESOURCE_MAX (unsigned long long)LLONG_MAX
53
52/** 54/**
53 * Helpers to interact with userspace 55 * Helpers to interact with userspace
54 * res_counter_read_u64() - returns the value of the specified member. 56 * res_counter_read_u64() - returns the value of the specified member.
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 164332cbb77c..e73e2429a1b1 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -4,6 +4,7 @@
4/* 4/*
5 * Copyright (C) 2006 - 2007 Ivo van Doorn 5 * Copyright (C) 2006 - 2007 Ivo van Doorn
6 * Copyright (C) 2007 Dmitry Torokhov 6 * Copyright (C) 2007 Dmitry Torokhov
7 * Copyright 2009 Johannes Berg <johannes@sipsolutions.net>
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * 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 * it under the terms of the GNU General Public License as published by
@@ -22,131 +23,354 @@
22 */ 23 */
23 24
24#include <linux/types.h> 25#include <linux/types.h>
25#include <linux/kernel.h> 26
26#include <linux/list.h> 27/* define userspace visible states */
27#include <linux/mutex.h> 28#define RFKILL_STATE_SOFT_BLOCKED 0
28#include <linux/device.h> 29#define RFKILL_STATE_UNBLOCKED 1
29#include <linux/leds.h> 30#define RFKILL_STATE_HARD_BLOCKED 2
30 31
31/** 32/**
32 * enum rfkill_type - type of rfkill switch. 33 * enum rfkill_type - type of rfkill switch.
33 * RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device. 34 *
34 * RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. 35 * @RFKILL_TYPE_ALL: toggles all switches (userspace only)
35 * RFKILL_TYPE_UWB: switch is on a ultra wideband device. 36 * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device.
36 * RFKILL_TYPE_WIMAX: switch is on a WiMAX device. 37 * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device.
37 * RFKILL_TYPE_WWAN: switch is on a wireless WAN device. 38 * @RFKILL_TYPE_UWB: switch is on a ultra wideband device.
39 * @RFKILL_TYPE_WIMAX: switch is on a WiMAX device.
40 * @RFKILL_TYPE_WWAN: switch is on a wireless WAN device.
41 * @NUM_RFKILL_TYPES: number of defined rfkill types
38 */ 42 */
39enum rfkill_type { 43enum rfkill_type {
40 RFKILL_TYPE_WLAN , 44 RFKILL_TYPE_ALL = 0,
45 RFKILL_TYPE_WLAN,
41 RFKILL_TYPE_BLUETOOTH, 46 RFKILL_TYPE_BLUETOOTH,
42 RFKILL_TYPE_UWB, 47 RFKILL_TYPE_UWB,
43 RFKILL_TYPE_WIMAX, 48 RFKILL_TYPE_WIMAX,
44 RFKILL_TYPE_WWAN, 49 RFKILL_TYPE_WWAN,
45 RFKILL_TYPE_MAX, 50 NUM_RFKILL_TYPES,
46}; 51};
47 52
48enum rfkill_state { 53/**
49 RFKILL_STATE_SOFT_BLOCKED = 0, /* Radio output blocked */ 54 * enum rfkill_operation - operation types
50 RFKILL_STATE_UNBLOCKED = 1, /* Radio output allowed */ 55 * @RFKILL_OP_ADD: a device was added
51 RFKILL_STATE_HARD_BLOCKED = 2, /* Output blocked, non-overrideable */ 56 * @RFKILL_OP_DEL: a device was removed
52 RFKILL_STATE_MAX, /* marker for last valid state */ 57 * @RFKILL_OP_CHANGE: a device's state changed -- userspace changes one device
58 * @RFKILL_OP_CHANGE_ALL: userspace changes all devices (of a type, or all)
59 */
60enum rfkill_operation {
61 RFKILL_OP_ADD = 0,
62 RFKILL_OP_DEL,
63 RFKILL_OP_CHANGE,
64 RFKILL_OP_CHANGE_ALL,
53}; 65};
54 66
55/* 67/**
56 * These are DEPRECATED, drivers using them should be verified to 68 * struct rfkill_event - events for userspace on /dev/rfkill
57 * comply with the rfkill usage guidelines in Documentation/rfkill.txt 69 * @idx: index of dev rfkill
58 * and then converted to use the new names for rfkill_state 70 * @type: type of the rfkill struct
59 */ 71 * @op: operation code
60#define RFKILL_STATE_OFF RFKILL_STATE_SOFT_BLOCKED 72 * @hard: hard state (0/1)
61#define RFKILL_STATE_ON RFKILL_STATE_UNBLOCKED 73 * @soft: soft state (0/1)
62 74 *
63/** 75 * Structure used for userspace communication on /dev/rfkill,
64 * struct rfkill - rfkill control structure. 76 * used for events from the kernel and control to the kernel.
65 * @name: Name of the switch. 77 */
66 * @type: Radio type which the button controls, the value stored 78struct rfkill_event {
67 * here should be a value from enum rfkill_type. 79 __u32 idx;
68 * @state: State of the switch, "UNBLOCKED" means radio can operate. 80 __u8 type;
69 * @user_claim_unsupported: Whether the hardware supports exclusive 81 __u8 op;
70 * RF-kill control by userspace. Set this before registering. 82 __u8 soft, hard;
71 * @user_claim: Set when the switch is controlled exlusively by userspace. 83} __packed;
72 * @mutex: Guards switch state transitions. It serializes callbacks
73 * and also protects the state.
74 * @data: Pointer to the RF button drivers private data which will be
75 * passed along when toggling radio state.
76 * @toggle_radio(): Mandatory handler to control state of the radio.
77 * only RFKILL_STATE_SOFT_BLOCKED and RFKILL_STATE_UNBLOCKED are
78 * valid parameters.
79 * @get_state(): handler to read current radio state from hardware,
80 * may be called from atomic context, should return 0 on success.
81 * Either this handler OR judicious use of rfkill_force_state() is
82 * MANDATORY for any driver capable of RFKILL_STATE_HARD_BLOCKED.
83 * @led_trigger: A LED trigger for this button's LED.
84 * @dev: Device structure integrating the switch into device tree.
85 * @node: Used to place switch into list of all switches known to the
86 * the system.
87 *
88 * This structure represents a RF switch located on a network device.
89 */
90struct rfkill {
91 const char *name;
92 enum rfkill_type type;
93
94 bool user_claim_unsupported;
95 bool user_claim;
96
97 /* the mutex serializes callbacks and also protects
98 * the state */
99 struct mutex mutex;
100 enum rfkill_state state;
101 void *data;
102 int (*toggle_radio)(void *data, enum rfkill_state state);
103 int (*get_state)(void *data, enum rfkill_state *state);
104 84
105#ifdef CONFIG_RFKILL_LEDS 85/* ioctl for turning off rfkill-input (if present) */
106 struct led_trigger led_trigger; 86#define RFKILL_IOC_MAGIC 'R'
107#endif 87#define RFKILL_IOC_NOINPUT 1
88#define RFKILL_IOCTL_NOINPUT _IO(RFKILL_IOC_MAGIC, RFKILL_IOC_NOINPUT)
108 89
109 struct device dev; 90/* and that's all userspace gets */
110 struct list_head node; 91#ifdef __KERNEL__
111 enum rfkill_state state_for_resume; 92/* don't allow anyone to use these in the kernel */
93enum rfkill_user_states {
94 RFKILL_USER_STATE_SOFT_BLOCKED = RFKILL_STATE_SOFT_BLOCKED,
95 RFKILL_USER_STATE_UNBLOCKED = RFKILL_STATE_UNBLOCKED,
96 RFKILL_USER_STATE_HARD_BLOCKED = RFKILL_STATE_HARD_BLOCKED,
112}; 97};
113#define to_rfkill(d) container_of(d, struct rfkill, dev) 98#undef RFKILL_STATE_SOFT_BLOCKED
99#undef RFKILL_STATE_UNBLOCKED
100#undef RFKILL_STATE_HARD_BLOCKED
114 101
115struct rfkill * __must_check rfkill_allocate(struct device *parent, 102#include <linux/types.h>
116 enum rfkill_type type); 103#include <linux/kernel.h>
117void rfkill_free(struct rfkill *rfkill); 104#include <linux/list.h>
105#include <linux/mutex.h>
106#include <linux/device.h>
107#include <linux/leds.h>
108#include <linux/err.h>
109
110/* this is opaque */
111struct rfkill;
112
113/**
114 * struct rfkill_ops - rfkill driver methods
115 *
116 * @poll: poll the rfkill block state(s) -- only assign this method
117 * when you need polling. When called, simply call one of the
118 * rfkill_set{,_hw,_sw}_state family of functions. If the hw
119 * is getting unblocked you need to take into account the return
120 * value of those functions to make sure the software block is
121 * properly used.
122 * @query: query the rfkill block state(s) and call exactly one of the
123 * rfkill_set{,_hw,_sw}_state family of functions. Assign this
124 * method if input events can cause hardware state changes to make
125 * the rfkill core query your driver before setting a requested
126 * block.
127 * @set_block: turn the transmitter on (blocked == false) or off
128 * (blocked == true) -- ignore and return 0 when hard blocked.
129 * This callback must be assigned.
130 */
131struct rfkill_ops {
132 void (*poll)(struct rfkill *rfkill, void *data);
133 void (*query)(struct rfkill *rfkill, void *data);
134 int (*set_block)(void *data, bool blocked);
135};
136
137#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
138/**
139 * rfkill_alloc - allocate rfkill structure
140 * @name: name of the struct -- the string is not copied internally
141 * @parent: device that has rf switch on it
142 * @type: type of the switch (RFKILL_TYPE_*)
143 * @ops: rfkill methods
144 * @ops_data: data passed to each method
145 *
146 * This function should be called by the transmitter driver to allocate an
147 * rfkill structure. Returns %NULL on failure.
148 */
149struct rfkill * __must_check rfkill_alloc(const char *name,
150 struct device *parent,
151 const enum rfkill_type type,
152 const struct rfkill_ops *ops,
153 void *ops_data);
154
155/**
156 * rfkill_register - Register a rfkill structure.
157 * @rfkill: rfkill structure to be registered
158 *
159 * This function should be called by the transmitter driver to register
160 * the rfkill structure. Before calling this function the driver needs
161 * to be ready to service method calls from rfkill.
162 *
163 * If rfkill_init_sw_state() is not called before registration,
164 * set_block() will be called to initialize the software blocked state
165 * to a default value.
166 *
167 * If the hardware blocked state is not set before registration,
168 * it is assumed to be unblocked.
169 */
118int __must_check rfkill_register(struct rfkill *rfkill); 170int __must_check rfkill_register(struct rfkill *rfkill);
171
172/**
173 * rfkill_pause_polling(struct rfkill *rfkill)
174 *
175 * Pause polling -- say transmitter is off for other reasons.
176 * NOTE: not necessary for suspend/resume -- in that case the
177 * core stops polling anyway
178 */
179void rfkill_pause_polling(struct rfkill *rfkill);
180
181/**
182 * rfkill_resume_polling(struct rfkill *rfkill)
183 *
184 * Pause polling -- say transmitter is off for other reasons.
185 * NOTE: not necessary for suspend/resume -- in that case the
186 * core stops polling anyway
187 */
188void rfkill_resume_polling(struct rfkill *rfkill);
189
190
191/**
192 * rfkill_unregister - Unregister a rfkill structure.
193 * @rfkill: rfkill structure to be unregistered
194 *
195 * This function should be called by the network driver during device
196 * teardown to destroy rfkill structure. Until it returns, the driver
197 * needs to be able to service method calls.
198 */
119void rfkill_unregister(struct rfkill *rfkill); 199void rfkill_unregister(struct rfkill *rfkill);
120 200
121int rfkill_force_state(struct rfkill *rfkill, enum rfkill_state state); 201/**
122int rfkill_set_default(enum rfkill_type type, enum rfkill_state state); 202 * rfkill_destroy - free rfkill structure
203 * @rfkill: rfkill structure to be destroyed
204 *
205 * Destroys the rfkill structure.
206 */
207void rfkill_destroy(struct rfkill *rfkill);
123 208
124/** 209/**
125 * rfkill_state_complement - return complementar state 210 * rfkill_set_hw_state - Set the internal rfkill hardware block state
126 * @state: state to return the complement of 211 * @rfkill: pointer to the rfkill class to modify.
212 * @state: the current hardware block state to set
213 *
214 * rfkill drivers that get events when the hard-blocked state changes
215 * use this function to notify the rfkill core (and through that also
216 * userspace) of the current state. They should also use this after
217 * resume if the state could have changed.
127 * 218 *
128 * Returns RFKILL_STATE_SOFT_BLOCKED if @state is RFKILL_STATE_UNBLOCKED, 219 * You need not (but may) call this function if poll_state is assigned.
129 * returns RFKILL_STATE_UNBLOCKED otherwise. 220 *
221 * This function can be called in any context, even from within rfkill
222 * callbacks.
223 *
224 * The function returns the combined block state (true if transmitter
225 * should be blocked) so that drivers need not keep track of the soft
226 * block state -- which they might not be able to.
130 */ 227 */
131static inline enum rfkill_state rfkill_state_complement(enum rfkill_state state) 228bool __must_check rfkill_set_hw_state(struct rfkill *rfkill, bool blocked);
229
230/**
231 * rfkill_set_sw_state - Set the internal rfkill software block state
232 * @rfkill: pointer to the rfkill class to modify.
233 * @state: the current software block state to set
234 *
235 * rfkill drivers that get events when the soft-blocked state changes
236 * (yes, some platforms directly act on input but allow changing again)
237 * use this function to notify the rfkill core (and through that also
238 * userspace) of the current state.
239 *
240 * Drivers should also call this function after resume if the state has
241 * been changed by the user. This only makes sense for "persistent"
242 * devices (see rfkill_init_sw_state()).
243 *
244 * This function can be called in any context, even from within rfkill
245 * callbacks.
246 *
247 * The function returns the combined block state (true if transmitter
248 * should be blocked).
249 */
250bool rfkill_set_sw_state(struct rfkill *rfkill, bool blocked);
251
252/**
253 * rfkill_init_sw_state - Initialize persistent software block state
254 * @rfkill: pointer to the rfkill class to modify.
255 * @state: the current software block state to set
256 *
257 * rfkill drivers that preserve their software block state over power off
258 * use this function to notify the rfkill core (and through that also
259 * userspace) of their initial state. It should only be used before
260 * registration.
261 *
262 * In addition, it marks the device as "persistent", an attribute which
263 * can be read by userspace. Persistent devices are expected to preserve
264 * their own state when suspended.
265 */
266void rfkill_init_sw_state(struct rfkill *rfkill, bool blocked);
267
268/**
269 * rfkill_set_states - Set the internal rfkill block states
270 * @rfkill: pointer to the rfkill class to modify.
271 * @sw: the current software block state to set
272 * @hw: the current hardware block state to set
273 *
274 * This function can be called in any context, even from within rfkill
275 * callbacks.
276 */
277void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw);
278
279/**
280 * rfkill_blocked - query rfkill block
281 *
282 * @rfkill: rfkill struct to query
283 */
284bool rfkill_blocked(struct rfkill *rfkill);
285#else /* !RFKILL */
286static inline struct rfkill * __must_check
287rfkill_alloc(const char *name,
288 struct device *parent,
289 const enum rfkill_type type,
290 const struct rfkill_ops *ops,
291 void *ops_data)
292{
293 return ERR_PTR(-ENODEV);
294}
295
296static inline int __must_check rfkill_register(struct rfkill *rfkill)
297{
298 if (rfkill == ERR_PTR(-ENODEV))
299 return 0;
300 return -EINVAL;
301}
302
303static inline void rfkill_pause_polling(struct rfkill *rfkill)
304{
305}
306
307static inline void rfkill_resume_polling(struct rfkill *rfkill)
308{
309}
310
311static inline void rfkill_unregister(struct rfkill *rfkill)
312{
313}
314
315static inline void rfkill_destroy(struct rfkill *rfkill)
132{ 316{
133 return (state == RFKILL_STATE_UNBLOCKED) ?
134 RFKILL_STATE_SOFT_BLOCKED : RFKILL_STATE_UNBLOCKED;
135} 317}
136 318
319static inline bool rfkill_set_hw_state(struct rfkill *rfkill, bool blocked)
320{
321 return blocked;
322}
323
324static inline bool rfkill_set_sw_state(struct rfkill *rfkill, bool blocked)
325{
326 return blocked;
327}
328
329static inline void rfkill_init_sw_state(struct rfkill *rfkill, bool blocked)
330{
331}
332
333static inline void rfkill_set_states(struct rfkill *rfkill, bool sw, bool hw)
334{
335}
336
337static inline bool rfkill_blocked(struct rfkill *rfkill)
338{
339 return false;
340}
341#endif /* RFKILL || RFKILL_MODULE */
342
343
344#ifdef CONFIG_RFKILL_LEDS
137/** 345/**
138 * rfkill_get_led_name - Get the LED trigger name for the button's LED. 346 * rfkill_get_led_trigger_name - Get the LED trigger name for the button's LED.
139 * This function might return a NULL pointer if registering of the 347 * This function might return a NULL pointer if registering of the
140 * LED trigger failed. 348 * LED trigger failed. Use this as "default_trigger" for the LED.
141 * Use this as "default_trigger" for the LED.
142 */ 349 */
143static inline char *rfkill_get_led_name(struct rfkill *rfkill) 350const char *rfkill_get_led_trigger_name(struct rfkill *rfkill);
144{ 351
145#ifdef CONFIG_RFKILL_LEDS 352/**
146 return (char *)(rfkill->led_trigger.name); 353 * rfkill_set_led_trigger_name -- set the LED trigger name
354 * @rfkill: rfkill struct
355 * @name: LED trigger name
356 *
357 * This function sets the LED trigger name of the radio LED
358 * trigger that rfkill creates. It is optional, but if called
359 * must be called before rfkill_register() to be effective.
360 */
361void rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name);
147#else 362#else
363static inline const char *rfkill_get_led_trigger_name(struct rfkill *rfkill)
364{
148 return NULL; 365 return NULL;
149#endif
150} 366}
151 367
368static inline void
369rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name)
370{
371}
372#endif
373
374#endif /* __KERNEL__ */
375
152#endif /* RFKILL_H */ 376#endif /* RFKILL_H */
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index e1b7b2173885..29f8599e6bea 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_RING_BUFFER_H 1#ifndef _LINUX_RING_BUFFER_H
2#define _LINUX_RING_BUFFER_H 2#define _LINUX_RING_BUFFER_H
3 3
4#include <linux/kmemcheck.h>
4#include <linux/mm.h> 5#include <linux/mm.h>
5#include <linux/seq_file.h> 6#include <linux/seq_file.h>
6 7
@@ -11,7 +12,10 @@ struct ring_buffer_iter;
11 * Don't refer to this struct directly, use functions below. 12 * Don't refer to this struct directly, use functions below.
12 */ 13 */
13struct ring_buffer_event { 14struct ring_buffer_event {
14 u32 type:2, len:3, time_delta:27; 15 kmemcheck_bitfield_begin(bitfield);
16 u32 type_len:5, time_delta:27;
17 kmemcheck_bitfield_end(bitfield);
18
15 u32 array[]; 19 u32 array[];
16}; 20};
17 21
@@ -24,7 +28,8 @@ struct ring_buffer_event {
24 * size is variable depending on how much 28 * size is variable depending on how much
25 * padding is needed 29 * padding is needed
26 * If time_delta is non zero: 30 * If time_delta is non zero:
27 * everything else same as RINGBUF_TYPE_DATA 31 * array[0] holds the actual length
32 * size = 4 + length (bytes)
28 * 33 *
29 * @RINGBUF_TYPE_TIME_EXTEND: Extend the time delta 34 * @RINGBUF_TYPE_TIME_EXTEND: Extend the time delta
30 * array[0] = time delta (28 .. 59) 35 * array[0] = time delta (28 .. 59)
@@ -35,22 +40,23 @@ struct ring_buffer_event {
35 * array[1..2] = tv_sec 40 * array[1..2] = tv_sec
36 * size = 16 bytes 41 * size = 16 bytes
37 * 42 *
38 * @RINGBUF_TYPE_DATA: Data record 43 * <= @RINGBUF_TYPE_DATA_TYPE_LEN_MAX:
39 * If len is zero: 44 * Data record
45 * If type_len is zero:
40 * array[0] holds the actual length 46 * array[0] holds the actual length
41 * array[1..(length+3)/4] holds data 47 * array[1..(length+3)/4] holds data
42 * size = 4 + 4 + length (bytes) 48 * size = 4 + length (bytes)
43 * else 49 * else
44 * length = len << 2 50 * length = type_len << 2
45 * array[0..(length+3)/4-1] holds data 51 * array[0..(length+3)/4-1] holds data
46 * size = 4 + length (bytes) 52 * size = 4 + length (bytes)
47 */ 53 */
48enum ring_buffer_type { 54enum ring_buffer_type {
55 RINGBUF_TYPE_DATA_TYPE_LEN_MAX = 28,
49 RINGBUF_TYPE_PADDING, 56 RINGBUF_TYPE_PADDING,
50 RINGBUF_TYPE_TIME_EXTEND, 57 RINGBUF_TYPE_TIME_EXTEND,
51 /* FIXME: RINGBUF_TYPE_TIME_STAMP not implemented */ 58 /* FIXME: RINGBUF_TYPE_TIME_STAMP not implemented */
52 RINGBUF_TYPE_TIME_STAMP, 59 RINGBUF_TYPE_TIME_STAMP,
53 RINGBUF_TYPE_DATA,
54}; 60};
55 61
56unsigned ring_buffer_event_length(struct ring_buffer_event *event); 62unsigned ring_buffer_event_length(struct ring_buffer_event *event);
@@ -68,13 +74,54 @@ ring_buffer_event_time_delta(struct ring_buffer_event *event)
68 return event->time_delta; 74 return event->time_delta;
69} 75}
70 76
77/*
78 * ring_buffer_event_discard can discard any event in the ring buffer.
79 * it is up to the caller to protect against a reader from
80 * consuming it or a writer from wrapping and replacing it.
81 *
82 * No external protection is needed if this is called before
83 * the event is commited. But in that case it would be better to
84 * use ring_buffer_discard_commit.
85 *
86 * Note, if an event that has not been committed is discarded
87 * with ring_buffer_event_discard, it must still be committed.
88 */
71void ring_buffer_event_discard(struct ring_buffer_event *event); 89void ring_buffer_event_discard(struct ring_buffer_event *event);
72 90
73/* 91/*
92 * ring_buffer_discard_commit will remove an event that has not
93 * ben committed yet. If this is used, then ring_buffer_unlock_commit
94 * must not be called on the discarded event. This function
95 * will try to remove the event from the ring buffer completely
96 * if another event has not been written after it.
97 *
98 * Example use:
99 *
100 * if (some_condition)
101 * ring_buffer_discard_commit(buffer, event);
102 * else
103 * ring_buffer_unlock_commit(buffer, event);
104 */
105void ring_buffer_discard_commit(struct ring_buffer *buffer,
106 struct ring_buffer_event *event);
107
108/*
74 * size is in bytes for each per CPU buffer. 109 * size is in bytes for each per CPU buffer.
75 */ 110 */
76struct ring_buffer * 111struct ring_buffer *
77ring_buffer_alloc(unsigned long size, unsigned flags); 112__ring_buffer_alloc(unsigned long size, unsigned flags, struct lock_class_key *key);
113
114/*
115 * Because the ring buffer is generic, if other users of the ring buffer get
116 * traced by ftrace, it can produce lockdep warnings. We need to keep each
117 * ring buffer's lock class separate.
118 */
119#define ring_buffer_alloc(size, flags) \
120({ \
121 static struct lock_class_key __key; \
122 __ring_buffer_alloc((size), (flags), &__key); \
123})
124
78void ring_buffer_free(struct ring_buffer *buffer); 125void ring_buffer_free(struct ring_buffer *buffer);
79 126
80int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size); 127int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size);
@@ -122,6 +169,8 @@ unsigned long ring_buffer_entries(struct ring_buffer *buffer);
122unsigned long ring_buffer_overruns(struct ring_buffer *buffer); 169unsigned long ring_buffer_overruns(struct ring_buffer *buffer);
123unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu); 170unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu);
124unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu); 171unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu);
172unsigned long ring_buffer_commit_overrun_cpu(struct ring_buffer *buffer, int cpu);
173unsigned long ring_buffer_nmi_dropped_cpu(struct ring_buffer *buffer, int cpu);
125 174
126u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu); 175u64 ring_buffer_time_stamp(struct ring_buffer *buffer, int cpu);
127void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer, 176void ring_buffer_normalize_time_stamp(struct ring_buffer *buffer,
@@ -137,6 +186,11 @@ void ring_buffer_free_read_page(struct ring_buffer *buffer, void *data);
137int ring_buffer_read_page(struct ring_buffer *buffer, void **data_page, 186int ring_buffer_read_page(struct ring_buffer *buffer, void **data_page,
138 size_t len, int cpu, int full); 187 size_t len, int cpu, int full);
139 188
189struct trace_seq;
190
191int ring_buffer_print_entry_header(struct trace_seq *s);
192int ring_buffer_print_page_header(struct trace_seq *s);
193
140enum ring_buffer_flags { 194enum ring_buffer_flags {
141 RB_FL_OVERWRITE = 1 << 0, 195 RB_FL_OVERWRITE = 1 << 0,
142}; 196};
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index b35bc0e19cd9..bf116d0dbf23 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -83,7 +83,8 @@ static inline void page_dup_rmap(struct page *page, struct vm_area_struct *vma,
83/* 83/*
84 * Called from mm/vmscan.c to handle paging out 84 * Called from mm/vmscan.c to handle paging out
85 */ 85 */
86int page_referenced(struct page *, int is_locked, struct mem_cgroup *cnt); 86int page_referenced(struct page *, int is_locked,
87 struct mem_cgroup *cnt, unsigned long *vm_flags);
87int try_to_unmap(struct page *, int ignore_refs); 88int try_to_unmap(struct page *, int ignore_refs);
88 89
89/* 90/*
@@ -105,18 +106,11 @@ unsigned long page_address_in_vma(struct page *, struct vm_area_struct *);
105 */ 106 */
106int page_mkclean(struct page *); 107int page_mkclean(struct page *);
107 108
108#ifdef CONFIG_UNEVICTABLE_LRU
109/* 109/*
110 * called in munlock()/munmap() path to check for other vmas holding 110 * called in munlock()/munmap() path to check for other vmas holding
111 * the page mlocked. 111 * the page mlocked.
112 */ 112 */
113int try_to_munlock(struct page *); 113int try_to_munlock(struct page *);
114#else
115static inline int try_to_munlock(struct page *page)
116{
117 return 0; /* a.k.a. SWAP_SUCCESS */
118}
119#endif
120 114
121#else /* !CONFIG_MMU */ 115#else /* !CONFIG_MMU */
122 116
@@ -124,7 +118,14 @@ static inline int try_to_munlock(struct page *page)
124#define anon_vma_prepare(vma) (0) 118#define anon_vma_prepare(vma) (0)
125#define anon_vma_link(vma) do {} while (0) 119#define anon_vma_link(vma) do {} while (0)
126 120
127#define page_referenced(page,l,cnt) TestClearPageReferenced(page) 121static inline int page_referenced(struct page *page, int is_locked,
122 struct mem_cgroup *cnt,
123 unsigned long *vm_flags)
124{
125 *vm_flags = 0;
126 return TestClearPageReferenced(page);
127}
128
128#define try_to_unmap(page, refs) SWAP_FAIL 129#define try_to_unmap(page, refs) SWAP_FAIL
129 130
130static inline int page_mkclean(struct page *page) 131static inline int page_mkclean(struct page *page)
diff --git a/include/linux/rotary_encoder.h b/include/linux/rotary_encoder.h
index 12d63a30c347..215278b8df2a 100644
--- a/include/linux/rotary_encoder.h
+++ b/include/linux/rotary_encoder.h
@@ -8,6 +8,8 @@ struct rotary_encoder_platform_data {
8 unsigned int gpio_b; 8 unsigned int gpio_b;
9 unsigned int inverted_a; 9 unsigned int inverted_a;
10 unsigned int inverted_b; 10 unsigned int inverted_b;
11 bool relative_axis;
12 bool rollover;
11}; 13};
12 14
13#endif /* __ROTARY_ENCODER_H__ */ 15#endif /* __ROTARY_ENCODER_H__ */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index b4c38bc8049c..4d0754269884 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -77,6 +77,7 @@ struct sched_param {
77#include <linux/proportions.h> 77#include <linux/proportions.h>
78#include <linux/seccomp.h> 78#include <linux/seccomp.h>
79#include <linux/rcupdate.h> 79#include <linux/rcupdate.h>
80#include <linux/rculist.h>
80#include <linux/rtmutex.h> 81#include <linux/rtmutex.h>
81 82
82#include <linux/time.h> 83#include <linux/time.h>
@@ -91,13 +92,13 @@ struct sched_param {
91 92
92#include <asm/processor.h> 93#include <asm/processor.h>
93 94
94struct mem_cgroup;
95struct exec_domain; 95struct exec_domain;
96struct futex_pi_state; 96struct futex_pi_state;
97struct robust_list_head; 97struct robust_list_head;
98struct bio; 98struct bio;
99struct bts_tracer;
100struct fs_struct; 99struct fs_struct;
100struct bts_context;
101struct perf_counter_context;
101 102
102/* 103/*
103 * List of flags we want to share for kernel threads, 104 * List of flags we want to share for kernel threads,
@@ -116,6 +117,7 @@ struct fs_struct;
116 * 11 bit fractions. 117 * 11 bit fractions.
117 */ 118 */
118extern unsigned long avenrun[]; /* Load averages */ 119extern unsigned long avenrun[]; /* Load averages */
120extern void get_avenrun(unsigned long *loads, unsigned long offset, int shift);
119 121
120#define FSHIFT 11 /* nr of bits of precision */ 122#define FSHIFT 11 /* nr of bits of precision */
121#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */ 123#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */
@@ -135,8 +137,9 @@ DECLARE_PER_CPU(unsigned long, process_counts);
135extern int nr_processes(void); 137extern int nr_processes(void);
136extern unsigned long nr_running(void); 138extern unsigned long nr_running(void);
137extern unsigned long nr_uninterruptible(void); 139extern unsigned long nr_uninterruptible(void);
138extern unsigned long nr_active(void);
139extern unsigned long nr_iowait(void); 140extern unsigned long nr_iowait(void);
141extern void calc_global_load(void);
142extern u64 cpu_nr_migrations(int cpu);
140 143
141extern unsigned long get_parent_ip(unsigned long addr); 144extern unsigned long get_parent_ip(unsigned long addr);
142 145
@@ -257,6 +260,7 @@ extern void task_rq_unlock_wait(struct task_struct *p);
257extern cpumask_var_t nohz_cpu_mask; 260extern cpumask_var_t nohz_cpu_mask;
258#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ) 261#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
259extern int select_nohz_load_balancer(int cpu); 262extern int select_nohz_load_balancer(int cpu);
263extern int get_nohz_load_balancer(void);
260#else 264#else
261static inline int select_nohz_load_balancer(int cpu) 265static inline int select_nohz_load_balancer(int cpu)
262{ 266{
@@ -669,9 +673,13 @@ struct user_struct {
669 struct task_group *tg; 673 struct task_group *tg;
670#ifdef CONFIG_SYSFS 674#ifdef CONFIG_SYSFS
671 struct kobject kobj; 675 struct kobject kobj;
672 struct work_struct work; 676 struct delayed_work work;
673#endif 677#endif
674#endif 678#endif
679
680#ifdef CONFIG_PERF_COUNTERS
681 atomic_long_t locked_vm;
682#endif
675}; 683};
676 684
677extern int uids_sysfs_init(void); 685extern int uids_sysfs_init(void);
@@ -838,7 +846,17 @@ struct sched_group {
838 */ 846 */
839 u32 reciprocal_cpu_power; 847 u32 reciprocal_cpu_power;
840 848
841 unsigned long cpumask[]; 849 /*
850 * The CPUs this group covers.
851 *
852 * NOTE: this field is variable length. (Allocated dynamically
853 * by attaching extra space to the end of the structure,
854 * depending on how many CPUs the kernel has booted up with)
855 *
856 * It is also be embedded into static data structures at build
857 * time. (See 'struct static_sched_group' in kernel/sched.c)
858 */
859 unsigned long cpumask[0];
842}; 860};
843 861
844static inline struct cpumask *sched_group_cpus(struct sched_group *sg) 862static inline struct cpumask *sched_group_cpus(struct sched_group *sg)
@@ -924,8 +942,17 @@ struct sched_domain {
924 char *name; 942 char *name;
925#endif 943#endif
926 944
927 /* span of all CPUs in this domain */ 945 /*
928 unsigned long span[]; 946 * Span of all CPUs in this domain.
947 *
948 * NOTE: this field is variable length. (Allocated dynamically
949 * by attaching extra space to the end of the structure,
950 * depending on how many CPUs the kernel has booted up with)
951 *
952 * It is also be embedded into static data structures at build
953 * time. (See 'struct static_sched_domain' in kernel/sched.c)
954 */
955 unsigned long span[0];
929}; 956};
930 957
931static inline struct cpumask *sched_domain_span(struct sched_domain *sd) 958static inline struct cpumask *sched_domain_span(struct sched_domain *sd)
@@ -1052,9 +1079,10 @@ struct sched_entity {
1052 u64 last_wakeup; 1079 u64 last_wakeup;
1053 u64 avg_overlap; 1080 u64 avg_overlap;
1054 1081
1082 u64 nr_migrations;
1083
1055 u64 start_runtime; 1084 u64 start_runtime;
1056 u64 avg_wakeup; 1085 u64 avg_wakeup;
1057 u64 nr_migrations;
1058 1086
1059#ifdef CONFIG_SCHEDSTATS 1087#ifdef CONFIG_SCHEDSTATS
1060 u64 wait_start; 1088 u64 wait_start;
@@ -1149,7 +1177,6 @@ struct task_struct {
1149 * a short time 1177 * a short time
1150 */ 1178 */
1151 unsigned char fpu_counter; 1179 unsigned char fpu_counter;
1152 s8 oomkilladj; /* OOM kill score adjustment (bit shift). */
1153#ifdef CONFIG_BLK_DEV_IO_TRACE 1180#ifdef CONFIG_BLK_DEV_IO_TRACE
1154 unsigned int btrace_seq; 1181 unsigned int btrace_seq;
1155#endif 1182#endif
@@ -1209,18 +1236,11 @@ struct task_struct {
1209 struct list_head ptraced; 1236 struct list_head ptraced;
1210 struct list_head ptrace_entry; 1237 struct list_head ptrace_entry;
1211 1238
1212#ifdef CONFIG_X86_PTRACE_BTS
1213 /* 1239 /*
1214 * This is the tracer handle for the ptrace BTS extension. 1240 * This is the tracer handle for the ptrace BTS extension.
1215 * This field actually belongs to the ptracer task. 1241 * This field actually belongs to the ptracer task.
1216 */ 1242 */
1217 struct bts_tracer *bts; 1243 struct bts_context *bts;
1218 /*
1219 * The buffer to hold the BTS data.
1220 */
1221 void *bts_buffer;
1222 size_t bts_size;
1223#endif /* CONFIG_X86_PTRACE_BTS */
1224 1244
1225 /* PID/PID hash table linkage. */ 1245 /* PID/PID hash table linkage. */
1226 struct pid_link pids[PIDTYPE_MAX]; 1246 struct pid_link pids[PIDTYPE_MAX];
@@ -1247,7 +1267,9 @@ struct task_struct {
1247 * credentials (COW) */ 1267 * credentials (COW) */
1248 const struct cred *cred; /* effective (overridable) subjective task 1268 const struct cred *cred; /* effective (overridable) subjective task
1249 * credentials (COW) */ 1269 * credentials (COW) */
1250 struct mutex cred_exec_mutex; /* execve vs ptrace cred calculation mutex */ 1270 struct mutex cred_guard_mutex; /* guard against foreign influences on
1271 * credential calculations
1272 * (notably. ptrace) */
1251 1273
1252 char comm[TASK_COMM_LEN]; /* executable name excluding path 1274 char comm[TASK_COMM_LEN]; /* executable name excluding path
1253 - access with [gs]et_task_comm (which lock 1275 - access with [gs]et_task_comm (which lock
@@ -1294,7 +1316,8 @@ struct task_struct {
1294/* Thread group tracking */ 1316/* Thread group tracking */
1295 u32 parent_exec_id; 1317 u32 parent_exec_id;
1296 u32 self_exec_id; 1318 u32 self_exec_id;
1297/* Protection of (de-)allocation: mm, files, fs, tty, keyrings */ 1319/* Protection of (de-)allocation: mm, files, fs, tty, keyrings, mems_allowed,
1320 * mempolicy */
1298 spinlock_t alloc_lock; 1321 spinlock_t alloc_lock;
1299 1322
1300#ifdef CONFIG_GENERIC_HARDIRQS 1323#ifdef CONFIG_GENERIC_HARDIRQS
@@ -1362,8 +1385,7 @@ struct task_struct {
1362 cputime_t acct_timexpd; /* stime + utime since last update */ 1385 cputime_t acct_timexpd; /* stime + utime since last update */
1363#endif 1386#endif
1364#ifdef CONFIG_CPUSETS 1387#ifdef CONFIG_CPUSETS
1365 nodemask_t mems_allowed; 1388 nodemask_t mems_allowed; /* Protected by alloc_lock */
1366 int cpuset_mems_generation;
1367 int cpuset_mem_spread_rotor; 1389 int cpuset_mem_spread_rotor;
1368#endif 1390#endif
1369#ifdef CONFIG_CGROUPS 1391#ifdef CONFIG_CGROUPS
@@ -1380,8 +1402,13 @@ struct task_struct {
1380 struct list_head pi_state_list; 1402 struct list_head pi_state_list;
1381 struct futex_pi_state *pi_state_cache; 1403 struct futex_pi_state *pi_state_cache;
1382#endif 1404#endif
1405#ifdef CONFIG_PERF_COUNTERS
1406 struct perf_counter_context *perf_counter_ctxp;
1407 struct mutex perf_counter_mutex;
1408 struct list_head perf_counter_list;
1409#endif
1383#ifdef CONFIG_NUMA 1410#ifdef CONFIG_NUMA
1384 struct mempolicy *mempolicy; 1411 struct mempolicy *mempolicy; /* Protected by alloc_lock */
1385 short il_next; 1412 short il_next;
1386#endif 1413#endif
1387 atomic_t fs_excl; /* holding fs exclusive resources */ 1414 atomic_t fs_excl; /* holding fs exclusive resources */
@@ -1428,7 +1455,9 @@ struct task_struct {
1428#ifdef CONFIG_TRACING 1455#ifdef CONFIG_TRACING
1429 /* state flags for use by tracers */ 1456 /* state flags for use by tracers */
1430 unsigned long trace; 1457 unsigned long trace;
1431#endif 1458 /* bitmask of trace recursion */
1459 unsigned long trace_recursion;
1460#endif /* CONFIG_TRACING */
1432}; 1461};
1433 1462
1434/* Future-safe accessor for struct task_struct's cpus_allowed. */ 1463/* Future-safe accessor for struct task_struct's cpus_allowed. */
@@ -1766,11 +1795,23 @@ extern unsigned int sysctl_sched_child_runs_first;
1766extern unsigned int sysctl_sched_features; 1795extern unsigned int sysctl_sched_features;
1767extern unsigned int sysctl_sched_migration_cost; 1796extern unsigned int sysctl_sched_migration_cost;
1768extern unsigned int sysctl_sched_nr_migrate; 1797extern unsigned int sysctl_sched_nr_migrate;
1798extern unsigned int sysctl_timer_migration;
1769 1799
1770int sched_nr_latency_handler(struct ctl_table *table, int write, 1800int sched_nr_latency_handler(struct ctl_table *table, int write,
1771 struct file *file, void __user *buffer, size_t *length, 1801 struct file *file, void __user *buffer, size_t *length,
1772 loff_t *ppos); 1802 loff_t *ppos);
1773#endif 1803#endif
1804#ifdef CONFIG_SCHED_DEBUG
1805static inline unsigned int get_sysctl_timer_migration(void)
1806{
1807 return sysctl_timer_migration;
1808}
1809#else
1810static inline unsigned int get_sysctl_timer_migration(void)
1811{
1812 return 1;
1813}
1814#endif
1774extern unsigned int sysctl_sched_rt_period; 1815extern unsigned int sysctl_sched_rt_period;
1775extern int sysctl_sched_rt_runtime; 1816extern int sysctl_sched_rt_runtime;
1776 1817
@@ -1837,9 +1878,6 @@ extern struct pid_namespace init_pid_ns;
1837/* 1878/*
1838 * find a task by one of its numerical ids 1879 * find a task by one of its numerical ids
1839 * 1880 *
1840 * find_task_by_pid_type_ns():
1841 * it is the most generic call - it finds a task by all id,
1842 * type and namespace specified
1843 * find_task_by_pid_ns(): 1881 * find_task_by_pid_ns():
1844 * finds a task by its pid in the specified namespace 1882 * finds a task by its pid in the specified namespace
1845 * find_task_by_vpid(): 1883 * find_task_by_vpid():
@@ -1848,9 +1886,6 @@ extern struct pid_namespace init_pid_ns;
1848 * see also find_vpid() etc in include/linux/pid.h 1886 * see also find_vpid() etc in include/linux/pid.h
1849 */ 1887 */
1850 1888
1851extern struct task_struct *find_task_by_pid_type_ns(int type, int pid,
1852 struct pid_namespace *ns);
1853
1854extern struct task_struct *find_task_by_vpid(pid_t nr); 1889extern struct task_struct *find_task_by_vpid(pid_t nr);
1855extern struct task_struct *find_task_by_pid_ns(pid_t nr, 1890extern struct task_struct *find_task_by_pid_ns(pid_t nr,
1856 struct pid_namespace *ns); 1891 struct pid_namespace *ns);
@@ -1885,6 +1920,7 @@ extern void sched_dead(struct task_struct *p);
1885 1920
1886extern void proc_caches_init(void); 1921extern void proc_caches_init(void);
1887extern void flush_signals(struct task_struct *); 1922extern void flush_signals(struct task_struct *);
1923extern void __flush_signals(struct task_struct *);
1888extern void ignore_signals(struct task_struct *); 1924extern void ignore_signals(struct task_struct *);
1889extern void flush_signal_handlers(struct task_struct *, int force_default); 1925extern void flush_signal_handlers(struct task_struct *, int force_default);
1890extern int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info); 1926extern int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info);
@@ -2001,8 +2037,10 @@ extern void set_task_comm(struct task_struct *tsk, char *from);
2001extern char *get_task_comm(char *to, struct task_struct *tsk); 2037extern char *get_task_comm(char *to, struct task_struct *tsk);
2002 2038
2003#ifdef CONFIG_SMP 2039#ifdef CONFIG_SMP
2040extern void wait_task_context_switch(struct task_struct *p);
2004extern unsigned long wait_task_inactive(struct task_struct *, long match_state); 2041extern unsigned long wait_task_inactive(struct task_struct *, long match_state);
2005#else 2042#else
2043static inline void wait_task_context_switch(struct task_struct *p) {}
2006static inline unsigned long wait_task_inactive(struct task_struct *p, 2044static inline unsigned long wait_task_inactive(struct task_struct *p,
2007 long match_state) 2045 long match_state)
2008{ 2046{
@@ -2010,7 +2048,8 @@ static inline unsigned long wait_task_inactive(struct task_struct *p,
2010} 2048}
2011#endif 2049#endif
2012 2050
2013#define next_task(p) list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks) 2051#define next_task(p) \
2052 list_entry_rcu((p)->tasks.next, struct task_struct, tasks)
2014 2053
2015#define for_each_process(p) \ 2054#define for_each_process(p) \
2016 for (p = &init_task ; (p = next_task(p)) != &init_task ; ) 2055 for (p = &init_task ; (p = next_task(p)) != &init_task ; )
@@ -2049,8 +2088,8 @@ int same_thread_group(struct task_struct *p1, struct task_struct *p2)
2049 2088
2050static inline struct task_struct *next_thread(const struct task_struct *p) 2089static inline struct task_struct *next_thread(const struct task_struct *p)
2051{ 2090{
2052 return list_entry(rcu_dereference(p->thread_group.next), 2091 return list_entry_rcu(p->thread_group.next,
2053 struct task_struct, thread_group); 2092 struct task_struct, thread_group);
2054} 2093}
2055 2094
2056static inline int thread_group_empty(struct task_struct *p) 2095static inline int thread_group_empty(struct task_struct *p)
@@ -2178,6 +2217,12 @@ static inline int test_tsk_need_resched(struct task_struct *tsk)
2178 return unlikely(test_tsk_thread_flag(tsk,TIF_NEED_RESCHED)); 2217 return unlikely(test_tsk_thread_flag(tsk,TIF_NEED_RESCHED));
2179} 2218}
2180 2219
2220static inline int restart_syscall(void)
2221{
2222 set_tsk_thread_flag(current, TIF_SIGPENDING);
2223 return -ERESTARTNOINTR;
2224}
2225
2181static inline int signal_pending(struct task_struct *p) 2226static inline int signal_pending(struct task_struct *p)
2182{ 2227{
2183 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING)); 2228 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));
@@ -2388,6 +2433,13 @@ static inline void inc_syscw(struct task_struct *tsk)
2388#define TASK_SIZE_OF(tsk) TASK_SIZE 2433#define TASK_SIZE_OF(tsk) TASK_SIZE
2389#endif 2434#endif
2390 2435
2436/*
2437 * Call the function if the target task is executing on a CPU right now:
2438 */
2439extern void task_oncpu_function_call(struct task_struct *p,
2440 void (*func) (void *info), void *info);
2441
2442
2391#ifdef CONFIG_MM_OWNER 2443#ifdef CONFIG_MM_OWNER
2392extern void mm_update_next_owner(struct mm_struct *mm); 2444extern void mm_update_next_owner(struct mm_struct *mm);
2393extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p); 2445extern void mm_init_owner(struct mm_struct *mm, struct task_struct *p);
diff --git a/include/linux/sctp.h b/include/linux/sctp.h
index c2731bfe04d8..b464b9d3d242 100644
--- a/include/linux/sctp.h
+++ b/include/linux/sctp.h
@@ -487,17 +487,17 @@ typedef enum {
487 * 487 *
488 * Value Cause Code 488 * Value Cause Code
489 * --------- ---------------- 489 * --------- ----------------
490 * 0x0100 Request to Delete Last Remaining IP Address. 490 * 0x00A0 Request to Delete Last Remaining IP Address.
491 * 0x0101 Operation Refused Due to Resource Shortage. 491 * 0x00A1 Operation Refused Due to Resource Shortage.
492 * 0x0102 Request to Delete Source IP Address. 492 * 0x00A2 Request to Delete Source IP Address.
493 * 0x0103 Association Aborted due to illegal ASCONF-ACK 493 * 0x00A3 Association Aborted due to illegal ASCONF-ACK
494 * 0x0104 Request refused - no authorization. 494 * 0x00A4 Request refused - no authorization.
495 */ 495 */
496 SCTP_ERROR_DEL_LAST_IP = cpu_to_be16(0x0100), 496 SCTP_ERROR_DEL_LAST_IP = cpu_to_be16(0x00A0),
497 SCTP_ERROR_RSRC_LOW = cpu_to_be16(0x0101), 497 SCTP_ERROR_RSRC_LOW = cpu_to_be16(0x00A1),
498 SCTP_ERROR_DEL_SRC_IP = cpu_to_be16(0x0102), 498 SCTP_ERROR_DEL_SRC_IP = cpu_to_be16(0x00A2),
499 SCTP_ERROR_ASCONF_ACK = cpu_to_be16(0x0103), 499 SCTP_ERROR_ASCONF_ACK = cpu_to_be16(0x00A3),
500 SCTP_ERROR_REQ_REFUSED = cpu_to_be16(0x0104), 500 SCTP_ERROR_REQ_REFUSED = cpu_to_be16(0x00A4),
501 501
502 /* AUTH Section 4. New Error Cause 502 /* AUTH Section 4. New Error Cause
503 * 503 *
diff --git a/include/linux/section-names.h b/include/linux/section-names.h
deleted file mode 100644
index c956f4eb2adf..000000000000
--- a/include/linux/section-names.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __LINUX_SECTION_NAMES_H
2#define __LINUX_SECTION_NAMES_H
3
4#define HEAD_TEXT_SECTION .head.text
5
6#endif /* !__LINUX_SECTION_NAMES_H */
diff --git a/include/linux/security.h b/include/linux/security.h
index d5fd6163606f..5eff459b3833 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -2197,6 +2197,8 @@ static inline int security_file_mmap(struct file *file, unsigned long reqprot,
2197 unsigned long addr, 2197 unsigned long addr,
2198 unsigned long addr_only) 2198 unsigned long addr_only)
2199{ 2199{
2200 if ((addr < mmap_min_addr) && !capable(CAP_SYS_RAWIO))
2201 return -EACCES;
2200 return 0; 2202 return 0;
2201} 2203}
2202 2204
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 004f3b3342c5..0c6a86b79596 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -43,6 +43,7 @@ int seq_release(struct inode *, struct file *);
43int seq_escape(struct seq_file *, const char *, const char *); 43int seq_escape(struct seq_file *, const char *, const char *);
44int seq_putc(struct seq_file *m, char c); 44int seq_putc(struct seq_file *m, char c);
45int seq_puts(struct seq_file *m, const char *s); 45int seq_puts(struct seq_file *m, const char *s);
46int seq_write(struct seq_file *seq, const void *data, size_t len);
46 47
47int seq_printf(struct seq_file *, const char *, ...) 48int seq_printf(struct seq_file *, const char *, ...)
48 __attribute__ ((format (printf,2,3))); 49 __attribute__ ((format (printf,2,3)));
diff --git a/include/linux/serial.h b/include/linux/serial.h
index 9136cc5608c3..e5bb75a63802 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -96,54 +96,76 @@ struct serial_uart_config {
96 96
97/* 97/*
98 * Definitions for async_struct (and serial_struct) flags field 98 * Definitions for async_struct (and serial_struct) flags field
99 *
100 * Define ASYNCB_* for convenient use with {test,set,clear}_bit.
99 */ 101 */
100#define ASYNC_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes 102#define ASYNCB_HUP_NOTIFY 0 /* Notify getty on hangups and closes
101 on the callout port */ 103 * on the callout port */
102#define ASYNC_FOURPORT 0x0002 /* Set OU1, OUT2 per AST Fourport settings */ 104#define ASYNCB_FOURPORT 1 /* Set OU1, OUT2 per AST Fourport settings */
103#define ASYNC_SAK 0x0004 /* Secure Attention Key (Orange book) */ 105#define ASYNCB_SAK 2 /* Secure Attention Key (Orange book) */
104#define ASYNC_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */ 106#define ASYNCB_SPLIT_TERMIOS 3 /* Separate termios for dialin/callout */
105 107#define ASYNCB_SPD_HI 4 /* Use 56000 instead of 38400 bps */
106#define ASYNC_SPD_MASK 0x1030 108#define ASYNCB_SPD_VHI 5 /* Use 115200 instead of 38400 bps */
107#define ASYNC_SPD_HI 0x0010 /* Use 56000 instead of 38400 bps */ 109#define ASYNCB_SKIP_TEST 6 /* Skip UART test during autoconfiguration */
108 110#define ASYNCB_AUTO_IRQ 7 /* Do automatic IRQ during
109#define ASYNC_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */ 111 * autoconfiguration */
110#define ASYNC_SPD_CUST 0x0030 /* Use user-specified divisor */ 112#define ASYNCB_SESSION_LOCKOUT 8 /* Lock out cua opens based on session */
111 113#define ASYNCB_PGRP_LOCKOUT 9 /* Lock out cua opens based on pgrp */
112#define ASYNC_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */ 114#define ASYNCB_CALLOUT_NOHUP 10 /* Don't do hangups for cua device */
113#define ASYNC_AUTO_IRQ 0x0080 /* Do automatic IRQ during autoconfiguration */ 115#define ASYNCB_HARDPPS_CD 11 /* Call hardpps when CD goes high */
114#define ASYNC_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */ 116#define ASYNCB_SPD_SHI 12 /* Use 230400 instead of 38400 bps */
115#define ASYNC_PGRP_LOCKOUT 0x0200 /* Lock out cua opens based on pgrp */ 117#define ASYNCB_LOW_LATENCY 13 /* Request low latency behaviour */
116#define ASYNC_CALLOUT_NOHUP 0x0400 /* Don't do hangups for cua device */ 118#define ASYNCB_BUGGY_UART 14 /* This is a buggy UART, skip some safety
117 119 * checks. Note: can be dangerous! */
118#define ASYNC_HARDPPS_CD 0x0800 /* Call hardpps when CD goes high */ 120#define ASYNCB_AUTOPROBE 15 /* Port was autoprobed by PCI or PNP code */
119 121#define ASYNCB_LAST_USER 15
120#define ASYNC_SPD_SHI 0x1000 /* Use 230400 instead of 38400 bps */ 122
121#define ASYNC_SPD_WARP 0x1010 /* Use 460800 instead of 38400 bps */ 123/* Internal flags used only by kernel */
122 124#define ASYNCB_INITIALIZED 31 /* Serial port was initialized */
123#define ASYNC_LOW_LATENCY 0x2000 /* Request low latency behaviour */ 125#define ASYNCB_NORMAL_ACTIVE 29 /* Normal device is active */
124 126#define ASYNCB_BOOT_AUTOCONF 28 /* Autoconfigure port on bootup */
125#define ASYNC_BUGGY_UART 0x4000 /* This is a buggy UART, skip some safety 127#define ASYNCB_CLOSING 27 /* Serial port is closing */
126 * checks. Note: can be dangerous! */ 128#define ASYNCB_CTS_FLOW 26 /* Do CTS flow control */
127 129#define ASYNCB_CHECK_CD 25 /* i.e., CLOCAL */
128#define ASYNC_AUTOPROBE 0x8000 /* Port was autoprobed by PCI or PNP code */ 130#define ASYNCB_SHARE_IRQ 24 /* for multifunction cards, no longer used */
129 131#define ASYNCB_CONS_FLOW 23 /* flow control for console */
130#define ASYNC_FLAGS 0x7FFF /* Possible legal async flags */ 132#define ASYNCB_BOOT_ONLYMCA 22 /* Probe only if MCA bus */
131#define ASYNC_USR_MASK 0x3430 /* Legal flags that non-privileged 133#define ASYNCB_FIRST_KERNEL 22
132 * users can set or reset */ 134
133 135#define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY)
134/* Internal flags used only by kernel/chr_drv/serial.c */ 136#define ASYNC_FOURPORT (1U << ASYNCB_FOURPORT)
135#define ASYNC_INITIALIZED 0x80000000 /* Serial port was initialized */ 137#define ASYNC_SAK (1U << ASYNCB_SAK)
136#define ASYNC_NORMAL_ACTIVE 0x20000000 /* Normal device is active */ 138#define ASYNC_SPLIT_TERMIOS (1U << ASYNCB_SPLIT_TERMIOS)
137#define ASYNC_BOOT_AUTOCONF 0x10000000 /* Autoconfigure port on bootup */ 139#define ASYNC_SPD_HI (1U << ASYNCB_SPD_HI)
138#define ASYNC_CLOSING 0x08000000 /* Serial port is closing */ 140#define ASYNC_SPD_VHI (1U << ASYNCB_SPD_VHI)
139#define ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */ 141#define ASYNC_SKIP_TEST (1U << ASYNCB_SKIP_TEST)
140#define ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */ 142#define ASYNC_AUTO_IRQ (1U << ASYNCB_AUTO_IRQ)
141#define ASYNC_SHARE_IRQ 0x01000000 /* for multifunction cards 143#define ASYNC_SESSION_LOCKOUT (1U << ASYNCB_SESSION_LOCKOUT)
142 --- no longer used */ 144#define ASYNC_PGRP_LOCKOUT (1U << ASYNCB_PGRP_LOCKOUT)
143#define ASYNC_CONS_FLOW 0x00800000 /* flow control for console */ 145#define ASYNC_CALLOUT_NOHUP (1U << ASYNCB_CALLOUT_NOHUP)
144 146#define ASYNC_HARDPPS_CD (1U << ASYNCB_HARDPPS_CD)
145#define ASYNC_BOOT_ONLYMCA 0x00400000 /* Probe only if MCA bus */ 147#define ASYNC_SPD_SHI (1U << ASYNCB_SPD_SHI)
146#define ASYNC_INTERNAL_FLAGS 0xFFC00000 /* Internal flags */ 148#define ASYNC_LOW_LATENCY (1U << ASYNCB_LOW_LATENCY)
149#define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART)
150#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE)
151
152#define ASYNC_FLAGS ((1U << ASYNCB_LAST_USER) - 1)
153#define ASYNC_USR_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI| \
154 ASYNC_CALLOUT_NOHUP|ASYNC_SPD_SHI|ASYNC_LOW_LATENCY)
155#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI)
156#define ASYNC_SPD_WARP (ASYNC_SPD_HI|ASYNC_SPD_SHI)
157#define ASYNC_SPD_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI|ASYNC_SPD_SHI)
158
159#define ASYNC_INITIALIZED (1U << ASYNCB_INITIALIZED)
160#define ASYNC_NORMAL_ACTIVE (1U << ASYNCB_NORMAL_ACTIVE)
161#define ASYNC_BOOT_AUTOCONF (1U << ASYNCB_BOOT_AUTOCONF)
162#define ASYNC_CLOSING (1U << ASYNCB_CLOSING)
163#define ASYNC_CTS_FLOW (1U << ASYNCB_CTS_FLOW)
164#define ASYNC_CHECK_CD (1U << ASYNCB_CHECK_CD)
165#define ASYNC_SHARE_IRQ (1U << ASYNCB_SHARE_IRQ)
166#define ASYNC_CONS_FLOW (1U << ASYNCB_CONS_FLOW)
167#define ASYNC_BOOT_ONLYMCA (1U << ASYNCB_BOOT_ONLYMCA)
168#define ASYNC_INTERNAL_FLAGS (~((1U << ASYNCB_FIRST_KERNEL) - 1))
147 169
148/* 170/*
149 * Multiport serial configuration structure --- external structure 171 * Multiport serial configuration structure --- external structure
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 57a97e52e58d..23d2fb051f97 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -41,7 +41,8 @@
41#define PORT_XSCALE 15 41#define PORT_XSCALE 15
42#define PORT_RM9000 16 /* PMC-Sierra RM9xxx internal UART */ 42#define PORT_RM9000 16 /* PMC-Sierra RM9xxx internal UART */
43#define PORT_OCTEON 17 /* Cavium OCTEON internal UART */ 43#define PORT_OCTEON 17 /* Cavium OCTEON internal UART */
44#define PORT_MAX_8250 17 /* max port ID */ 44#define PORT_AR7 18 /* Texas Instruments AR7 internal UART */
45#define PORT_MAX_8250 18 /* max port ID */
45 46
46/* 47/*
47 * ARM specific type numbers. These are not currently guaranteed 48 * ARM specific type numbers. These are not currently guaranteed
@@ -167,6 +168,12 @@
167/* MAX3100 */ 168/* MAX3100 */
168#define PORT_MAX3100 86 169#define PORT_MAX3100 86
169 170
171/* Timberdale UART */
172#define PORT_TIMBUART 87
173
174/* Qualcomm MSM SoCs */
175#define PORT_MSM 88
176
170#ifdef __KERNEL__ 177#ifdef __KERNEL__
171 178
172#include <linux/compiler.h> 179#include <linux/compiler.h>
diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h
index 96c0d93fc2ca..850db2e80510 100644
--- a/include/linux/serial_reg.h
+++ b/include/linux/serial_reg.h
@@ -323,6 +323,7 @@
323#define UART_OMAP_MVER 0x14 /* Module version register */ 323#define UART_OMAP_MVER 0x14 /* Module version register */
324#define UART_OMAP_SYSC 0x15 /* System configuration register */ 324#define UART_OMAP_SYSC 0x15 /* System configuration register */
325#define UART_OMAP_SYSS 0x16 /* System status register */ 325#define UART_OMAP_SYSS 0x16 /* System status register */
326#define UART_OMAP_WER 0x17 /* Wake-up enable register */
326 327
327#endif /* _LINUX_SERIAL_REG_H */ 328#endif /* _LINUX_SERIAL_REG_H */
328 329
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index 893cc53486bc..1c297ddc9d5a 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -25,8 +25,7 @@ struct plat_sci_port {
25 unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */ 25 unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */
26 unsigned int type; /* SCI / SCIF / IRDA */ 26 unsigned int type; /* SCI / SCIF / IRDA */
27 upf_t flags; /* UPF_* flags */ 27 upf_t flags; /* UPF_* flags */
28 char *clk; /* clock string */
28}; 29};
29 30
30int early_sci_setup(struct uart_port *port);
31
32#endif /* __LINUX_SERIAL_SCI_H */ 31#endif /* __LINUX_SERIAL_SCI_H */
diff --git a/include/linux/serio.h b/include/linux/serio.h
index e0417e4d3f15..126d24c9eaa8 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -15,6 +15,7 @@
15 15
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17 17
18#include <linux/types.h>
18#include <linux/interrupt.h> 19#include <linux/interrupt.h>
19#include <linux/list.h> 20#include <linux/list.h>
20#include <linux/spinlock.h> 21#include <linux/spinlock.h>
@@ -28,7 +29,10 @@ struct serio {
28 char name[32]; 29 char name[32];
29 char phys[32]; 30 char phys[32];
30 31
31 unsigned int manual_bind; 32 bool manual_bind;
33 bool registered; /* port has been fully registered with driver core */
34 bool suspended; /* port is suspended */
35
32 36
33 struct serio_device_id id; 37 struct serio_device_id id;
34 38
@@ -47,7 +51,6 @@ struct serio {
47 struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */ 51 struct mutex drv_mutex; /* protects serio->drv so attributes can pin driver */
48 52
49 struct device dev; 53 struct device dev;
50 unsigned int registered; /* port has been fully registered with driver core */
51 54
52 struct list_head node; 55 struct list_head node;
53}; 56};
@@ -58,7 +61,7 @@ struct serio_driver {
58 char *description; 61 char *description;
59 62
60 struct serio_device_id *id_table; 63 struct serio_device_id *id_table;
61 unsigned int manual_bind; 64 bool manual_bind;
62 65
63 void (*write_wakeup)(struct serio *); 66 void (*write_wakeup)(struct serio *);
64 irqreturn_t (*interrupt)(struct serio *, unsigned char, unsigned int); 67 irqreturn_t (*interrupt)(struct serio *, unsigned char, unsigned int);
diff --git a/include/linux/sh_cmt.h b/include/linux/sh_cmt.h
deleted file mode 100644
index 68cacde5954f..000000000000
--- a/include/linux/sh_cmt.h
+++ /dev/null
@@ -1,13 +0,0 @@
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_timer.h b/include/linux/sh_timer.h
new file mode 100644
index 000000000000..864bd56bd3b0
--- /dev/null
+++ b/include/linux/sh_timer.h
@@ -0,0 +1,13 @@
1#ifndef __SH_TIMER_H__
2#define __SH_TIMER_H__
3
4struct sh_timer_config {
5 char *name;
6 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_TIMER_H__ */
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 84f997f8aa53..c7552836bd95 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -235,6 +235,8 @@ static inline int valid_signal(unsigned long sig)
235extern int next_signal(struct sigpending *pending, sigset_t *mask); 235extern int next_signal(struct sigpending *pending, sigset_t *mask);
236extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p); 236extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p);
237extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *); 237extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *);
238extern long do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig,
239 siginfo_t *info);
238extern long do_sigpending(void __user *, unsigned long); 240extern long do_sigpending(void __user *, unsigned long);
239extern int sigprocmask(int, sigset_t *, sigset_t *); 241extern int sigprocmask(int, sigset_t *, sigset_t *);
240extern int show_unhandled_signals; 242extern int show_unhandled_signals;
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 5fd389162f01..b47b3f039d14 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -15,6 +15,7 @@
15#define _LINUX_SKBUFF_H 15#define _LINUX_SKBUFF_H
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/kmemcheck.h>
18#include <linux/compiler.h> 19#include <linux/compiler.h>
19#include <linux/time.h> 20#include <linux/time.h>
20#include <linux/cache.h> 21#include <linux/cache.h>
@@ -189,20 +190,23 @@ struct skb_shared_info {
189 atomic_t dataref; 190 atomic_t dataref;
190 unsigned short nr_frags; 191 unsigned short nr_frags;
191 unsigned short gso_size; 192 unsigned short gso_size;
193#ifdef CONFIG_HAS_DMA
194 dma_addr_t dma_head;
195#endif
192 /* Warning: this field is not always filled in (UFO)! */ 196 /* Warning: this field is not always filled in (UFO)! */
193 unsigned short gso_segs; 197 unsigned short gso_segs;
194 unsigned short gso_type; 198 unsigned short gso_type;
195 __be32 ip6_frag_id; 199 __be32 ip6_frag_id;
196 union skb_shared_tx tx_flags; 200 union skb_shared_tx tx_flags;
197#ifdef CONFIG_HAS_DMA
198 unsigned int num_dma_maps;
199#endif
200 struct sk_buff *frag_list; 201 struct sk_buff *frag_list;
201 struct skb_shared_hwtstamps hwtstamps; 202 struct skb_shared_hwtstamps hwtstamps;
202 skb_frag_t frags[MAX_SKB_FRAGS]; 203 skb_frag_t frags[MAX_SKB_FRAGS];
203#ifdef CONFIG_HAS_DMA 204#ifdef CONFIG_HAS_DMA
204 dma_addr_t dma_maps[MAX_SKB_FRAGS + 1]; 205 dma_addr_t dma_maps[MAX_SKB_FRAGS];
205#endif 206#endif
207 /* Intermediate layers must ensure that destructor_arg
208 * remains valid until skb destructor */
209 void * destructor_arg;
206}; 210};
207 211
208/* We divide dataref into two halves. The higher 16 bits hold references 212/* We divide dataref into two halves. The higher 16 bits hold references
@@ -261,7 +265,7 @@ typedef unsigned char *sk_buff_data_t;
261 * @transport_header: Transport layer header 265 * @transport_header: Transport layer header
262 * @network_header: Network layer header 266 * @network_header: Network layer header
263 * @mac_header: Link layer header 267 * @mac_header: Link layer header
264 * @dst: destination entry 268 * @_skb_dst: destination entry
265 * @sp: the security path, used for xfrm 269 * @sp: the security path, used for xfrm
266 * @cb: Control buffer. Free for use by every layer. Put private vars here 270 * @cb: Control buffer. Free for use by every layer. Put private vars here
267 * @len: Length of actual data 271 * @len: Length of actual data
@@ -301,9 +305,6 @@ typedef unsigned char *sk_buff_data_t;
301 * @tc_verd: traffic control verdict 305 * @tc_verd: traffic control verdict
302 * @ndisc_nodetype: router type (from link layer) 306 * @ndisc_nodetype: router type (from link layer)
303 * @do_not_encrypt: set to prevent encryption of this frame 307 * @do_not_encrypt: set to prevent encryption of this frame
304 * @requeue: set to indicate that the wireless core should attempt
305 * a software retry on this frame if we failed to
306 * receive an ACK for it
307 * @dma_cookie: a cookie to one of several possible DMA operations 308 * @dma_cookie: a cookie to one of several possible DMA operations
308 * done by skb DMA functions 309 * done by skb DMA functions
309 * @secmark: security marking 310 * @secmark: security marking
@@ -319,10 +320,7 @@ struct sk_buff {
319 ktime_t tstamp; 320 ktime_t tstamp;
320 struct net_device *dev; 321 struct net_device *dev;
321 322
322 union { 323 unsigned long _skb_dst;
323 struct dst_entry *dst;
324 struct rtable *rtable;
325 };
326#ifdef CONFIG_XFRM 324#ifdef CONFIG_XFRM
327 struct sec_path *sp; 325 struct sec_path *sp;
328#endif 326#endif
@@ -346,6 +344,7 @@ struct sk_buff {
346 }; 344 };
347 }; 345 };
348 __u32 priority; 346 __u32 priority;
347 kmemcheck_bitfield_begin(flags1);
349 __u8 local_df:1, 348 __u8 local_df:1,
350 cloned:1, 349 cloned:1,
351 ip_summed:2, 350 ip_summed:2,
@@ -356,6 +355,7 @@ struct sk_buff {
356 ipvs_property:1, 355 ipvs_property:1,
357 peeked:1, 356 peeked:1,
358 nf_trace:1; 357 nf_trace:1;
358 kmemcheck_bitfield_end(flags1);
359 __be16 protocol; 359 __be16 protocol;
360 360
361 void (*destructor)(struct sk_buff *skb); 361 void (*destructor)(struct sk_buff *skb);
@@ -375,13 +375,16 @@ struct sk_buff {
375 __u16 tc_verd; /* traffic control verdict */ 375 __u16 tc_verd; /* traffic control verdict */
376#endif 376#endif
377#endif 377#endif
378
379 kmemcheck_bitfield_begin(flags2);
378#ifdef CONFIG_IPV6_NDISC_NODETYPE 380#ifdef CONFIG_IPV6_NDISC_NODETYPE
379 __u8 ndisc_nodetype:2; 381 __u8 ndisc_nodetype:2;
380#endif 382#endif
381#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE) 383#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
382 __u8 do_not_encrypt:1; 384 __u8 do_not_encrypt:1;
383 __u8 requeue:1;
384#endif 385#endif
386 kmemcheck_bitfield_end(flags2);
387
385 /* 0/13/14 bit hole */ 388 /* 0/13/14 bit hole */
386 389
387#ifdef CONFIG_NET_DMA 390#ifdef CONFIG_NET_DMA
@@ -423,6 +426,21 @@ extern void skb_dma_unmap(struct device *dev, struct sk_buff *skb,
423 enum dma_data_direction dir); 426 enum dma_data_direction dir);
424#endif 427#endif
425 428
429static inline struct dst_entry *skb_dst(const struct sk_buff *skb)
430{
431 return (struct dst_entry *)skb->_skb_dst;
432}
433
434static inline void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst)
435{
436 skb->_skb_dst = (unsigned long)dst;
437}
438
439static inline struct rtable *skb_rtable(const struct sk_buff *skb)
440{
441 return (struct rtable *)skb_dst(skb);
442}
443
426extern void kfree_skb(struct sk_buff *skb); 444extern void kfree_skb(struct sk_buff *skb);
427extern void consume_skb(struct sk_buff *skb); 445extern void consume_skb(struct sk_buff *skb);
428extern void __kfree_skb(struct sk_buff *skb); 446extern void __kfree_skb(struct sk_buff *skb);
@@ -1062,7 +1080,7 @@ extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page,
1062 int off, int size); 1080 int off, int size);
1063 1081
1064#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) 1082#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags)
1065#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) 1083#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_has_frags(skb))
1066#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) 1084#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb))
1067 1085
1068#ifdef NET_SKBUFF_DATA_USES_OFFSET 1086#ifdef NET_SKBUFF_DATA_USES_OFFSET
@@ -1701,6 +1719,25 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
1701 skb = skb->prev) 1719 skb = skb->prev)
1702 1720
1703 1721
1722static inline bool skb_has_frags(const struct sk_buff *skb)
1723{
1724 return skb_shinfo(skb)->frag_list != NULL;
1725}
1726
1727static inline void skb_frag_list_init(struct sk_buff *skb)
1728{
1729 skb_shinfo(skb)->frag_list = NULL;
1730}
1731
1732static inline void skb_frag_add_head(struct sk_buff *skb, struct sk_buff *frag)
1733{
1734 frag->next = skb_shinfo(skb)->frag_list;
1735 skb_shinfo(skb)->frag_list = frag;
1736}
1737
1738#define skb_walk_frags(skb, iter) \
1739 for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next)
1740
1704extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, 1741extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags,
1705 int *peeked, int *err); 1742 int *peeked, int *err);
1706extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, 1743extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags,
@@ -1715,8 +1752,14 @@ extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
1715 struct iovec *iov); 1752 struct iovec *iov);
1716extern int skb_copy_datagram_from_iovec(struct sk_buff *skb, 1753extern int skb_copy_datagram_from_iovec(struct sk_buff *skb,
1717 int offset, 1754 int offset,
1718 struct iovec *from, 1755 const struct iovec *from,
1756 int from_offset,
1719 int len); 1757 int len);
1758extern int skb_copy_datagram_const_iovec(const struct sk_buff *from,
1759 int offset,
1760 const struct iovec *to,
1761 int to_offset,
1762 int size);
1720extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 1763extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
1721extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, 1764extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
1722 unsigned int flags); 1765 unsigned int flags);
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 24c5602bee99..2da8372519f5 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -62,6 +62,15 @@
62# define SLAB_DEBUG_OBJECTS 0x00000000UL 62# define SLAB_DEBUG_OBJECTS 0x00000000UL
63#endif 63#endif
64 64
65#define SLAB_NOLEAKTRACE 0x00800000UL /* Avoid kmemleak tracing */
66
67/* Don't track use of uninitialized memory */
68#ifdef CONFIG_KMEMCHECK
69# define SLAB_NOTRACK 0x01000000UL
70#else
71# define SLAB_NOTRACK 0x00000000UL
72#endif
73
65/* The following flags affect the page allocator grouping pages by mobility */ 74/* The following flags affect the page allocator grouping pages by mobility */
66#define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ 75#define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */
67#define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */ 76#define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */
@@ -317,4 +326,6 @@ static inline void *kzalloc_node(size_t size, gfp_t flags, int node)
317 return kmalloc_node(size, flags | __GFP_ZERO, node); 326 return kmalloc_node(size, flags | __GFP_ZERO, node);
318} 327}
319 328
329void __init kmem_cache_init_late(void);
330
320#endif /* _LINUX_SLAB_H */ 331#endif /* _LINUX_SLAB_H */
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 5ac9b0bcaf9a..850d057500de 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -14,7 +14,88 @@
14#include <asm/page.h> /* kmalloc_sizes.h needs PAGE_SIZE */ 14#include <asm/page.h> /* kmalloc_sizes.h needs PAGE_SIZE */
15#include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */ 15#include <asm/cache.h> /* kmalloc_sizes.h needs L1_CACHE_BYTES */
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17#include <trace/kmemtrace.h> 17#include <linux/kmemtrace.h>
18
19/*
20 * struct kmem_cache
21 *
22 * manages a cache.
23 */
24
25struct kmem_cache {
26/* 1) per-cpu data, touched during every alloc/free */
27 struct array_cache *array[NR_CPUS];
28/* 2) Cache tunables. Protected by cache_chain_mutex */
29 unsigned int batchcount;
30 unsigned int limit;
31 unsigned int shared;
32
33 unsigned int buffer_size;
34 u32 reciprocal_buffer_size;
35/* 3) touched by every alloc & free from the backend */
36
37 unsigned int flags; /* constant flags */
38 unsigned int num; /* # of objs per slab */
39
40/* 4) cache_grow/shrink */
41 /* order of pgs per slab (2^n) */
42 unsigned int gfporder;
43
44 /* force GFP flags, e.g. GFP_DMA */
45 gfp_t gfpflags;
46
47 size_t colour; /* cache colouring range */
48 unsigned int colour_off; /* colour offset */
49 struct kmem_cache *slabp_cache;
50 unsigned int slab_size;
51 unsigned int dflags; /* dynamic flags */
52
53 /* constructor func */
54 void (*ctor)(void *obj);
55
56/* 5) cache creation/removal */
57 const char *name;
58 struct list_head next;
59
60/* 6) statistics */
61#ifdef CONFIG_DEBUG_SLAB
62 unsigned long num_active;
63 unsigned long num_allocations;
64 unsigned long high_mark;
65 unsigned long grown;
66 unsigned long reaped;
67 unsigned long errors;
68 unsigned long max_freeable;
69 unsigned long node_allocs;
70 unsigned long node_frees;
71 unsigned long node_overflow;
72 atomic_t allochit;
73 atomic_t allocmiss;
74 atomic_t freehit;
75 atomic_t freemiss;
76
77 /*
78 * If debugging is enabled, then the allocator can add additional
79 * fields and/or padding to every object. buffer_size contains the total
80 * object size including these internal fields, the following two
81 * variables contain the offset to the user object and its size.
82 */
83 int obj_offset;
84 int obj_size;
85#endif /* CONFIG_DEBUG_SLAB */
86
87 /*
88 * We put nodelists[] at the end of kmem_cache, because we want to size
89 * this array to nr_node_ids slots instead of MAX_NUMNODES
90 * (see kmem_cache_init())
91 * We still use [MAX_NUMNODES] and not [1] or [0] because cache_cache
92 * is statically defined, so we reserve the max number of nodes.
93 */
94 struct kmem_list3 *nodelists[MAX_NUMNODES];
95 /*
96 * Do not add fields after nodelists[]
97 */
98};
18 99
19/* Size description struct for general caches. */ 100/* Size description struct for general caches. */
20struct cache_sizes { 101struct cache_sizes {
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
index 0ec00b39d006..bb5368df4be8 100644
--- a/include/linux/slob_def.h
+++ b/include/linux/slob_def.h
@@ -34,4 +34,9 @@ static __always_inline void *__kmalloc(size_t size, gfp_t flags)
34 return kmalloc(size, flags); 34 return kmalloc(size, flags);
35} 35}
36 36
37static inline void kmem_cache_init_late(void)
38{
39 /* Nothing to do */
40}
41
37#endif /* __LINUX_SLOB_DEF_H */ 42#endif /* __LINUX_SLOB_DEF_H */
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index 5046f90c1171..4dcbc2c71491 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -10,7 +10,7 @@
10#include <linux/gfp.h> 10#include <linux/gfp.h>
11#include <linux/workqueue.h> 11#include <linux/workqueue.h>
12#include <linux/kobject.h> 12#include <linux/kobject.h>
13#include <trace/kmemtrace.h> 13#include <linux/kmemtrace.h>
14 14
15enum stat_item { 15enum stat_item {
16 ALLOC_FASTPATH, /* Allocation from cpu slab */ 16 ALLOC_FASTPATH, /* Allocation from cpu slab */
@@ -302,4 +302,6 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
302} 302}
303#endif 303#endif
304 304
305void __init kmem_cache_init_late(void);
306
305#endif /* _LINUX_SLUB_DEF_H */ 307#endif /* _LINUX_SLUB_DEF_H */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index a69db820eed6..9e3d8af09207 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -177,7 +177,6 @@ static inline void init_call_single_data(void)
177 177
178#define get_cpu() ({ preempt_disable(); smp_processor_id(); }) 178#define get_cpu() ({ preempt_disable(); smp_processor_id(); })
179#define put_cpu() preempt_enable() 179#define put_cpu() preempt_enable()
180#define put_cpu_no_resched() preempt_enable_no_resched()
181 180
182/* 181/*
183 * Callback to arch code if there's nosmp or maxcpus=0 on the 182 * Callback to arch code if there's nosmp or maxcpus=0 on the
diff --git a/include/linux/smsc911x.h b/include/linux/smsc911x.h
index b32725075d71..5241e4fb4eca 100644
--- a/include/linux/smsc911x.h
+++ b/include/linux/smsc911x.h
@@ -47,4 +47,14 @@ struct smsc911x_platform_config {
47#define SMSC911X_FORCE_EXTERNAL_PHY (BIT(3)) 47#define SMSC911X_FORCE_EXTERNAL_PHY (BIT(3))
48#define SMSC911X_SAVE_MAC_ADDRESS (BIT(4)) 48#define SMSC911X_SAVE_MAC_ADDRESS (BIT(4))
49 49
50/*
51 * SMSC911X_SWAP_FIFO:
52 * Enables software byte swap for fifo data. Should only be used as a
53 * "last resort" in the case of big endian mode on boards with incorrectly
54 * routed data bus to older devices such as LAN9118. Newer devices such as
55 * LAN9221 can handle this in hardware, there are registers to control
56 * this swapping but the driver doesn't currently use them.
57 */
58#define SMSC911X_SWAP_FIFO (BIT(5))
59
50#endif /* __LINUX_SMSC911X_H__ */ 60#endif /* __LINUX_SMSC911X_H__ */
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index aee3f1e1d1ce..0f953fe40413 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -18,7 +18,7 @@
18enum 18enum
19{ 19{
20 IPSTATS_MIB_NUM = 0, 20 IPSTATS_MIB_NUM = 0,
21 IPSTATS_MIB_INRECEIVES, /* InReceives */ 21 IPSTATS_MIB_INPKTS, /* InReceives */
22 IPSTATS_MIB_INHDRERRORS, /* InHdrErrors */ 22 IPSTATS_MIB_INHDRERRORS, /* InHdrErrors */
23 IPSTATS_MIB_INTOOBIGERRORS, /* InTooBigErrors */ 23 IPSTATS_MIB_INTOOBIGERRORS, /* InTooBigErrors */
24 IPSTATS_MIB_INNOROUTES, /* InNoRoutes */ 24 IPSTATS_MIB_INNOROUTES, /* InNoRoutes */
@@ -28,7 +28,7 @@ enum
28 IPSTATS_MIB_INDISCARDS, /* InDiscards */ 28 IPSTATS_MIB_INDISCARDS, /* InDiscards */
29 IPSTATS_MIB_INDELIVERS, /* InDelivers */ 29 IPSTATS_MIB_INDELIVERS, /* InDelivers */
30 IPSTATS_MIB_OUTFORWDATAGRAMS, /* OutForwDatagrams */ 30 IPSTATS_MIB_OUTFORWDATAGRAMS, /* OutForwDatagrams */
31 IPSTATS_MIB_OUTREQUESTS, /* OutRequests */ 31 IPSTATS_MIB_OUTPKTS, /* OutRequests */
32 IPSTATS_MIB_OUTDISCARDS, /* OutDiscards */ 32 IPSTATS_MIB_OUTDISCARDS, /* OutDiscards */
33 IPSTATS_MIB_OUTNOROUTES, /* OutNoRoutes */ 33 IPSTATS_MIB_OUTNOROUTES, /* OutNoRoutes */
34 IPSTATS_MIB_REASMTIMEOUT, /* ReasmTimeout */ 34 IPSTATS_MIB_REASMTIMEOUT, /* ReasmTimeout */
@@ -42,6 +42,12 @@ enum
42 IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */ 42 IPSTATS_MIB_OUTMCASTPKTS, /* OutMcastPkts */
43 IPSTATS_MIB_INBCASTPKTS, /* InBcastPkts */ 43 IPSTATS_MIB_INBCASTPKTS, /* InBcastPkts */
44 IPSTATS_MIB_OUTBCASTPKTS, /* OutBcastPkts */ 44 IPSTATS_MIB_OUTBCASTPKTS, /* OutBcastPkts */
45 IPSTATS_MIB_INOCTETS, /* InOctets */
46 IPSTATS_MIB_OUTOCTETS, /* OutOctets */
47 IPSTATS_MIB_INMCASTOCTETS, /* InMcastOctets */
48 IPSTATS_MIB_OUTMCASTOCTETS, /* OutMcastOctets */
49 IPSTATS_MIB_INBCASTOCTETS, /* InBcastOctets */
50 IPSTATS_MIB_OUTBCASTOCTETS, /* OutBcastOctets */
45 __IPSTATS_MIB_MAX 51 __IPSTATS_MIB_MAX
46}; 52};
47 53
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 421afb4d29b0..3b461dffe244 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -194,7 +194,8 @@ struct ucred {
194#define AF_RXRPC 33 /* RxRPC sockets */ 194#define AF_RXRPC 33 /* RxRPC sockets */
195#define AF_ISDN 34 /* mISDN sockets */ 195#define AF_ISDN 34 /* mISDN sockets */
196#define AF_PHONET 35 /* Phonet sockets */ 196#define AF_PHONET 35 /* Phonet sockets */
197#define AF_MAX 36 /* For now.. */ 197#define AF_IEEE802154 36 /* IEEE802154 sockets */
198#define AF_MAX 37 /* For now.. */
198 199
199/* Protocol families, same as address families. */ 200/* Protocol families, same as address families. */
200#define PF_UNSPEC AF_UNSPEC 201#define PF_UNSPEC AF_UNSPEC
@@ -233,6 +234,7 @@ struct ucred {
233#define PF_RXRPC AF_RXRPC 234#define PF_RXRPC AF_RXRPC
234#define PF_ISDN AF_ISDN 235#define PF_ISDN AF_ISDN
235#define PF_PHONET AF_PHONET 236#define PF_PHONET AF_PHONET
237#define PF_IEEE802154 AF_IEEE802154
236#define PF_MAX AF_MAX 238#define PF_MAX AF_MAX
237 239
238/* Maximum queue length specifiable by listen. */ 240/* Maximum queue length specifiable by listen. */
@@ -303,14 +305,15 @@ struct ucred {
303#define SOL_BLUETOOTH 274 305#define SOL_BLUETOOTH 274
304#define SOL_PNPIPE 275 306#define SOL_PNPIPE 275
305#define SOL_RDS 276 307#define SOL_RDS 276
308#define SOL_IUCV 277
306 309
307/* IPX options */ 310/* IPX options */
308#define IPX_TYPE 1 311#define IPX_TYPE 1
309 312
310#ifdef __KERNEL__ 313#ifdef __KERNEL__
311extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len); 314extern int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len);
312extern int memcpy_fromiovecend(unsigned char *kdata, struct iovec *iov, 315extern int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov,
313 int offset, int len); 316 int offset, int len);
314extern int csum_partial_copy_fromiovecend(unsigned char *kdata, 317extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
315 struct iovec *iov, 318 struct iovec *iov,
316 int offset, 319 int offset,
@@ -318,6 +321,8 @@ extern int csum_partial_copy_fromiovecend(unsigned char *kdata,
318 321
319extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode); 322extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode);
320extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); 323extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len);
324extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata,
325 int offset, int len);
321extern int move_addr_to_user(struct sockaddr *kaddr, int klen, void __user *uaddr, int __user *ulen); 326extern int move_addr_to_user(struct sockaddr *kaddr, int klen, void __user *uaddr, int __user *ulen);
322extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr *kaddr); 327extern int move_addr_to_kernel(void __user *uaddr, int ulen, struct sockaddr *kaddr);
323extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data); 328extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
index 2ea20320c093..51948eb6927a 100644
--- a/include/linux/spi/ads7846.h
+++ b/include/linux/spi/ads7846.h
@@ -17,6 +17,7 @@ struct ads7846_platform_data {
17 u16 vref_mv; /* external vref value, milliVolts */ 17 u16 vref_mv; /* external vref value, milliVolts */
18 bool keep_vref_on; /* set to keep vref on for differential 18 bool keep_vref_on; /* set to keep vref on for differential
19 * measurements as well */ 19 * measurements as well */
20 bool swap_xy; /* swap x and y axes */
20 21
21 /* Settling time of the analog signals; a function of Vcc and the 22 /* Settling time of the analog signals; a function of Vcc and the
22 * capacitance on the X/Y drivers. If set to non-zero, two samples 23 * capacitance on the X/Y drivers. If set to non-zero, two samples
diff --git a/include/linux/spi/libertas_spi.h b/include/linux/spi/libertas_spi.h
index 79506f5f9e67..1b5d5384fcd3 100644
--- a/include/linux/spi/libertas_spi.h
+++ b/include/linux/spi/libertas_spi.h
@@ -22,9 +22,6 @@ struct libertas_spi_platform_data {
22 * speed, you may want to use 0 here. */ 22 * speed, you may want to use 0 here. */
23 u16 use_dummy_writes; 23 u16 use_dummy_writes;
24 24
25 /* GPIO number to use as chip select */
26 u16 gpio_cs;
27
28 /* Board specific setup/teardown */ 25 /* Board specific setup/teardown */
29 int (*setup)(struct spi_device *spi); 26 int (*setup)(struct spi_device *spi);
30 int (*teardown)(struct spi_device *spi); 27 int (*teardown)(struct spi_device *spi);
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index a0faa18f7b1b..9c4cd27f4685 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -245,6 +245,9 @@ struct spi_master {
245 */ 245 */
246 u16 dma_alignment; 246 u16 dma_alignment;
247 247
248 /* spi_device.mode flags understood by this controller driver */
249 u16 mode_bits;
250
248 /* Setup mode and clock, etc (spi driver may call many times). 251 /* Setup mode and clock, etc (spi driver may call many times).
249 * 252 *
250 * IMPORTANT: this may be called when transfers to another 253 * IMPORTANT: this may be called when transfers to another
@@ -523,30 +526,7 @@ static inline void spi_message_free(struct spi_message *m)
523 kfree(m); 526 kfree(m);
524} 527}
525 528
526/** 529extern int spi_setup(struct spi_device *spi);
527 * spi_setup - setup SPI mode and clock rate
528 * @spi: the device whose settings are being modified
529 * Context: can sleep, and no requests are queued to the device
530 *
531 * SPI protocol drivers may need to update the transfer mode if the
532 * device doesn't work with its default. They may likewise need
533 * to update clock rates or word sizes from initial values. This function
534 * changes those settings, and must be called from a context that can sleep.
535 * Except for SPI_CS_HIGH, which takes effect immediately, the changes take
536 * effect the next time the device is selected and data is transferred to
537 * or from it. When this function returns, the spi device is deselected.
538 *
539 * Note that this call will fail if the protocol driver specifies an option
540 * that the underlying controller or its driver does not support. For
541 * example, not all hardware supports wire transfers using nine bit words,
542 * LSB-first wire encoding, or active-high chipselects.
543 */
544static inline int
545spi_setup(struct spi_device *spi)
546{
547 return spi->master->setup(spi);
548}
549
550 530
551/** 531/**
552 * spi_async - asynchronous SPI transfer 532 * spi_async - asynchronous SPI transfer
diff --git a/include/linux/spi/wl12xx.h b/include/linux/spi/wl12xx.h
new file mode 100644
index 000000000000..11430cab2aad
--- /dev/null
+++ b/include/linux/spi/wl12xx.h
@@ -0,0 +1,31 @@
1/*
2 * This file is part of wl12xx
3 *
4 * Copyright (C) 2009 Nokia Corporation
5 *
6 * Contact: Kalle Valo <kalle.valo@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
24#ifndef _LINUX_SPI_WL12XX_H
25#define _LINUX_SPI_WL12XX_H
26
27struct wl12xx_platform_data {
28 void (*set_power)(bool enable);
29};
30
31#endif
diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h
index 938234c4a996..d4841ed8215b 100644
--- a/include/linux/spinlock_up.h
+++ b/include/linux/spinlock_up.h
@@ -60,6 +60,7 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock)
60#define __raw_spin_is_locked(lock) ((void)(lock), 0) 60#define __raw_spin_is_locked(lock) ((void)(lock), 0)
61/* for sched.c and kernel_lock.c: */ 61/* for sched.c and kernel_lock.c: */
62# define __raw_spin_lock(lock) do { (void)(lock); } while (0) 62# define __raw_spin_lock(lock) do { (void)(lock); } while (0)
63# define __raw_spin_lock_flags(lock, flags) do { (void)(lock); } while (0)
63# define __raw_spin_unlock(lock) do { (void)(lock); } while (0) 64# define __raw_spin_unlock(lock) do { (void)(lock); } while (0)
64# define __raw_spin_trylock(lock) ({ (void)(lock); 1; }) 65# define __raw_spin_trylock(lock) ({ (void)(lock); 1; })
65#endif /* DEBUG_SPINLOCK */ 66#endif /* DEBUG_SPINLOCK */
diff --git a/include/linux/splice.h b/include/linux/splice.h
index 5f3faa9d15ae..18e7c7c0cae6 100644
--- a/include/linux/splice.h
+++ b/include/linux/splice.h
@@ -11,8 +11,7 @@
11#include <linux/pipe_fs_i.h> 11#include <linux/pipe_fs_i.h>
12 12
13/* 13/*
14 * splice is tied to pipes as a transport (at least for now), so we'll just 14 * Flags passed in from splice/tee/vmsplice
15 * add the splice flags here.
16 */ 15 */
17#define SPLICE_F_MOVE (0x01) /* move pages instead of copying */ 16#define SPLICE_F_MOVE (0x01) /* move pages instead of copying */
18#define SPLICE_F_NONBLOCK (0x02) /* don't block on the pipe splicing (but */ 17#define SPLICE_F_NONBLOCK (0x02) /* don't block on the pipe splicing (but */
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
index 1a8cecc4f38c..51efbef38fb0 100644
--- a/include/linux/stacktrace.h
+++ b/include/linux/stacktrace.h
@@ -4,6 +4,8 @@
4struct task_struct; 4struct task_struct;
5 5
6#ifdef CONFIG_STACKTRACE 6#ifdef CONFIG_STACKTRACE
7struct task_struct;
8
7struct stack_trace { 9struct stack_trace {
8 unsigned int nr_entries, max_entries; 10 unsigned int nr_entries, max_entries;
9 unsigned long *entries; 11 unsigned long *entries;
@@ -11,6 +13,7 @@ struct stack_trace {
11}; 13};
12 14
13extern void save_stack_trace(struct stack_trace *trace); 15extern void save_stack_trace(struct stack_trace *trace);
16extern void save_stack_trace_bp(struct stack_trace *trace, unsigned long bp);
14extern void save_stack_trace_tsk(struct task_struct *tsk, 17extern void save_stack_trace_tsk(struct task_struct *tsk,
15 struct stack_trace *trace); 18 struct stack_trace *trace);
16 19
diff --git a/include/linux/sunrpc/bc_xprt.h b/include/linux/sunrpc/bc_xprt.h
new file mode 100644
index 000000000000..6508f0dc0eff
--- /dev/null
+++ b/include/linux/sunrpc/bc_xprt.h
@@ -0,0 +1,49 @@
1/******************************************************************************
2
3(c) 2008 NetApp. All Rights Reserved.
4
5NetApp provides this source code under the GPL v2 License.
6The GPL v2 license is available at
7http://opensource.org/licenses/gpl-license.php.
8
9THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
10"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
11LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
12A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
13CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
14EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
15PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
16PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
17LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
18NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
19SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20
21******************************************************************************/
22
23/*
24 * Functions to create and manage the backchannel
25 */
26
27#ifndef _LINUX_SUNRPC_BC_XPRT_H
28#define _LINUX_SUNRPC_BC_XPRT_H
29
30#include <linux/sunrpc/svcsock.h>
31#include <linux/sunrpc/xprt.h>
32#include <linux/sunrpc/sched.h>
33
34#ifdef CONFIG_NFS_V4_1
35struct rpc_rqst *xprt_alloc_bc_request(struct rpc_xprt *xprt);
36void xprt_free_bc_request(struct rpc_rqst *req);
37int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs);
38void xprt_destroy_backchannel(struct rpc_xprt *, int max_reqs);
39void bc_release_request(struct rpc_task *);
40int bc_send(struct rpc_rqst *req);
41#else /* CONFIG_NFS_V4_1 */
42static inline int xprt_setup_backchannel(struct rpc_xprt *xprt,
43 unsigned int min_reqs)
44{
45 return 0;
46}
47#endif /* CONFIG_NFS_V4_1 */
48#endif /* _LINUX_SUNRPC_BC_XPRT_H */
49
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index c39a21040dcb..37881f1a0bd7 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -143,6 +143,7 @@ int rpc_call_sync(struct rpc_clnt *clnt,
143 const struct rpc_message *msg, int flags); 143 const struct rpc_message *msg, int flags);
144struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, 144struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred,
145 int flags); 145 int flags);
146void rpc_restart_call_prepare(struct rpc_task *);
146void rpc_restart_call(struct rpc_task *); 147void rpc_restart_call(struct rpc_task *);
147void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); 148void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
148size_t rpc_max_payload(struct rpc_clnt *); 149size_t rpc_max_payload(struct rpc_clnt *);
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 64981a2f1cae..401097781fc0 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -210,6 +210,8 @@ struct rpc_wait_queue {
210 */ 210 */
211struct rpc_task *rpc_new_task(const struct rpc_task_setup *); 211struct rpc_task *rpc_new_task(const struct rpc_task_setup *);
212struct rpc_task *rpc_run_task(const struct rpc_task_setup *); 212struct rpc_task *rpc_run_task(const struct rpc_task_setup *);
213struct rpc_task *rpc_run_bc_task(struct rpc_rqst *req,
214 const struct rpc_call_ops *ops);
213void rpc_put_task(struct rpc_task *); 215void rpc_put_task(struct rpc_task *);
214void rpc_exit_task(struct rpc_task *); 216void rpc_exit_task(struct rpc_task *);
215void rpc_release_calldata(const struct rpc_call_ops *, void *); 217void rpc_release_calldata(const struct rpc_call_ops *, void *);
@@ -237,6 +239,7 @@ void rpc_show_tasks(void);
237int rpc_init_mempool(void); 239int rpc_init_mempool(void);
238void rpc_destroy_mempool(void); 240void rpc_destroy_mempool(void);
239extern struct workqueue_struct *rpciod_workqueue; 241extern struct workqueue_struct *rpciod_workqueue;
242void rpc_prepare_task(struct rpc_task *task);
240 243
241static inline void rpc_exit(struct rpc_task *task, int status) 244static inline void rpc_exit(struct rpc_task *task, int status)
242{ 245{
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 2a30775959e9..ea8009695c69 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -96,6 +96,15 @@ struct svc_serv {
96 svc_thread_fn sv_function; /* main function for threads */ 96 svc_thread_fn sv_function; /* main function for threads */
97 unsigned int sv_drc_max_pages; /* Total pages for DRC */ 97 unsigned int sv_drc_max_pages; /* Total pages for DRC */
98 unsigned int sv_drc_pages_used;/* DRC pages used */ 98 unsigned int sv_drc_pages_used;/* DRC pages used */
99#if defined(CONFIG_NFS_V4_1)
100 struct list_head sv_cb_list; /* queue for callback requests
101 * that arrive over the same
102 * connection */
103 spinlock_t sv_cb_lock; /* protects the svc_cb_list */
104 wait_queue_head_t sv_cb_waitq; /* sleep here if there are no
105 * entries in the svc_cb_list */
106 struct svc_xprt *bc_xprt;
107#endif /* CONFIG_NFS_V4_1 */
99}; 108};
100 109
101/* 110/*
@@ -411,6 +420,8 @@ int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);
411int svc_pool_stats_open(struct svc_serv *serv, struct file *file); 420int svc_pool_stats_open(struct svc_serv *serv, struct file *file);
412void svc_destroy(struct svc_serv *); 421void svc_destroy(struct svc_serv *);
413int svc_process(struct svc_rqst *); 422int svc_process(struct svc_rqst *);
423int bc_svc_process(struct svc_serv *, struct rpc_rqst *,
424 struct svc_rqst *);
414int svc_register(const struct svc_serv *, const int, 425int svc_register(const struct svc_serv *, const int,
415 const unsigned short, const unsigned short); 426 const unsigned short, const unsigned short);
416 427
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 0d9cb6ef28b0..2223ae0b5ed5 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -83,7 +83,7 @@ int svc_port_is_privileged(struct sockaddr *sin);
83int svc_print_xprts(char *buf, int maxlen); 83int svc_print_xprts(char *buf, int maxlen);
84struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name, 84struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name,
85 const sa_family_t af, const unsigned short port); 85 const sa_family_t af, const unsigned short port);
86int svc_xprt_names(struct svc_serv *serv, char *buf, int buflen); 86int svc_xprt_names(struct svc_serv *serv, char *buf, const int buflen);
87 87
88static inline void svc_xprt_get(struct svc_xprt *xprt) 88static inline void svc_xprt_get(struct svc_xprt *xprt)
89{ 89{
@@ -118,7 +118,7 @@ static inline unsigned short svc_addr_port(const struct sockaddr *sa)
118 return 0; 118 return 0;
119} 119}
120 120
121static inline size_t svc_addr_len(struct sockaddr *sa) 121static inline size_t svc_addr_len(const struct sockaddr *sa)
122{ 122{
123 switch (sa->sa_family) { 123 switch (sa->sa_family) {
124 case AF_INET: 124 case AF_INET:
@@ -126,7 +126,8 @@ static inline size_t svc_addr_len(struct sockaddr *sa)
126 case AF_INET6: 126 case AF_INET6:
127 return sizeof(struct sockaddr_in6); 127 return sizeof(struct sockaddr_in6);
128 } 128 }
129 return -EAFNOSUPPORT; 129
130 return 0;
130} 131}
131 132
132static inline unsigned short svc_xprt_local_port(const struct svc_xprt *xprt) 133static inline unsigned short svc_xprt_local_port(const struct svc_xprt *xprt)
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 483e10380aae..04dba23c59f2 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -38,10 +38,15 @@ int svc_recv(struct svc_rqst *, long);
38int svc_send(struct svc_rqst *); 38int svc_send(struct svc_rqst *);
39void svc_drop(struct svc_rqst *); 39void svc_drop(struct svc_rqst *);
40void svc_sock_update_bufs(struct svc_serv *serv); 40void svc_sock_update_bufs(struct svc_serv *serv);
41int svc_sock_names(char *buf, struct svc_serv *serv, char *toclose); 41int svc_sock_names(struct svc_serv *serv, char *buf,
42int svc_addsock(struct svc_serv *serv, int fd, char *name_return); 42 const size_t buflen,
43 const char *toclose);
44int svc_addsock(struct svc_serv *serv, const int fd,
45 char *name_return, const size_t len);
43void svc_init_xprt_sock(void); 46void svc_init_xprt_sock(void);
44void svc_cleanup_xprt_sock(void); 47void svc_cleanup_xprt_sock(void);
48struct svc_xprt *svc_sock_create(struct svc_serv *serv, int prot);
49void svc_sock_destroy(struct svc_xprt *);
45 50
46/* 51/*
47 * svc_makesock socket characteristics 52 * svc_makesock socket characteristics
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 08afe43118f4..1175d58efc2e 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -67,7 +67,8 @@ struct rpc_rqst {
67 struct rpc_task * rq_task; /* RPC task data */ 67 struct rpc_task * rq_task; /* RPC task data */
68 __be32 rq_xid; /* request XID */ 68 __be32 rq_xid; /* request XID */
69 int rq_cong; /* has incremented xprt->cong */ 69 int rq_cong; /* has incremented xprt->cong */
70 int rq_received; /* receive completed */ 70 int rq_reply_bytes_recvd; /* number of reply */
71 /* bytes received */
71 u32 rq_seqno; /* gss seq no. used on req. */ 72 u32 rq_seqno; /* gss seq no. used on req. */
72 int rq_enc_pages_num; 73 int rq_enc_pages_num;
73 struct page **rq_enc_pages; /* scratch pages for use by 74 struct page **rq_enc_pages; /* scratch pages for use by
@@ -97,6 +98,12 @@ struct rpc_rqst {
97 98
98 unsigned long rq_xtime; /* when transmitted */ 99 unsigned long rq_xtime; /* when transmitted */
99 int rq_ntrans; 100 int rq_ntrans;
101
102#if defined(CONFIG_NFS_V4_1)
103 struct list_head rq_bc_list; /* Callback service list */
104 unsigned long rq_bc_pa_state; /* Backchannel prealloc state */
105 struct list_head rq_bc_pa_list; /* Backchannel prealloc list */
106#endif /* CONFIG_NFS_V4_1 */
100}; 107};
101#define rq_svec rq_snd_buf.head 108#define rq_svec rq_snd_buf.head
102#define rq_slen rq_snd_buf.len 109#define rq_slen rq_snd_buf.len
@@ -174,6 +181,15 @@ struct rpc_xprt {
174 spinlock_t reserve_lock; /* lock slot table */ 181 spinlock_t reserve_lock; /* lock slot table */
175 u32 xid; /* Next XID value to use */ 182 u32 xid; /* Next XID value to use */
176 struct rpc_task * snd_task; /* Task blocked in send */ 183 struct rpc_task * snd_task; /* Task blocked in send */
184#if defined(CONFIG_NFS_V4_1)
185 struct svc_serv *bc_serv; /* The RPC service which will */
186 /* process the callback */
187 unsigned int bc_alloc_count; /* Total number of preallocs */
188 spinlock_t bc_pa_lock; /* Protects the preallocated
189 * items */
190 struct list_head bc_pa_list; /* List of preallocated
191 * backchannel rpc_rqst's */
192#endif /* CONFIG_NFS_V4_1 */
177 struct list_head recv; 193 struct list_head recv;
178 194
179 struct { 195 struct {
@@ -192,6 +208,26 @@ struct rpc_xprt {
192 const char *address_strings[RPC_DISPLAY_MAX]; 208 const char *address_strings[RPC_DISPLAY_MAX];
193}; 209};
194 210
211#if defined(CONFIG_NFS_V4_1)
212/*
213 * Backchannel flags
214 */
215#define RPC_BC_PA_IN_USE 0x0001 /* Preallocated backchannel */
216 /* buffer in use */
217#endif /* CONFIG_NFS_V4_1 */
218
219#if defined(CONFIG_NFS_V4_1)
220static inline int bc_prealloc(struct rpc_rqst *req)
221{
222 return test_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state);
223}
224#else
225static inline int bc_prealloc(struct rpc_rqst *req)
226{
227 return 0;
228}
229#endif /* CONFIG_NFS_V4_1 */
230
195struct xprt_create { 231struct xprt_create {
196 int ident; /* XPRT_TRANSPORT identifier */ 232 int ident; /* XPRT_TRANSPORT identifier */
197 struct sockaddr * srcaddr; /* optional local address */ 233 struct sockaddr * srcaddr; /* optional local address */
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 795032edfc46..cd15df6c63cd 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -245,11 +245,6 @@ extern unsigned long get_safe_page(gfp_t gfp_mask);
245 245
246extern void hibernation_set_ops(struct platform_hibernation_ops *ops); 246extern void hibernation_set_ops(struct platform_hibernation_ops *ops);
247extern int hibernate(void); 247extern int hibernate(void);
248extern int hibernate_nvs_register(unsigned long start, unsigned long size);
249extern int hibernate_nvs_alloc(void);
250extern void hibernate_nvs_free(void);
251extern void hibernate_nvs_save(void);
252extern void hibernate_nvs_restore(void);
253extern bool system_entering_hibernation(void); 248extern bool system_entering_hibernation(void);
254#else /* CONFIG_HIBERNATION */ 249#else /* CONFIG_HIBERNATION */
255static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } 250static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
@@ -258,6 +253,16 @@ static inline void swsusp_unset_page_free(struct page *p) {}
258 253
259static inline void hibernation_set_ops(struct platform_hibernation_ops *ops) {} 254static inline void hibernation_set_ops(struct platform_hibernation_ops *ops) {}
260static inline int hibernate(void) { return -ENOSYS; } 255static inline int hibernate(void) { return -ENOSYS; }
256static inline bool system_entering_hibernation(void) { return false; }
257#endif /* CONFIG_HIBERNATION */
258
259#ifdef CONFIG_HIBERNATION_NVS
260extern int hibernate_nvs_register(unsigned long start, unsigned long size);
261extern int hibernate_nvs_alloc(void);
262extern void hibernate_nvs_free(void);
263extern void hibernate_nvs_save(void);
264extern void hibernate_nvs_restore(void);
265#else /* CONFIG_HIBERNATION_NVS */
261static inline int hibernate_nvs_register(unsigned long a, unsigned long b) 266static inline int hibernate_nvs_register(unsigned long a, unsigned long b)
262{ 267{
263 return 0; 268 return 0;
@@ -266,8 +271,7 @@ static inline int hibernate_nvs_alloc(void) { return 0; }
266static inline void hibernate_nvs_free(void) {} 271static inline void hibernate_nvs_free(void) {}
267static inline void hibernate_nvs_save(void) {} 272static inline void hibernate_nvs_save(void) {}
268static inline void hibernate_nvs_restore(void) {} 273static inline void hibernate_nvs_restore(void) {}
269static inline bool system_entering_hibernation(void) { return false; } 274#endif /* CONFIG_HIBERNATION_NVS */
270#endif /* CONFIG_HIBERNATION */
271 275
272#ifdef CONFIG_PM_SLEEP 276#ifdef CONFIG_PM_SLEEP
273void save_processor_state(void); 277void save_processor_state(void);
diff --git a/include/linux/swap.h b/include/linux/swap.h
index d476aad3ff57..7c15334f3ff2 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -129,9 +129,10 @@ enum {
129 129
130#define SWAP_CLUSTER_MAX 32 130#define SWAP_CLUSTER_MAX 32
131 131
132#define SWAP_MAP_MAX 0x7fff 132#define SWAP_MAP_MAX 0x7ffe
133#define SWAP_MAP_BAD 0x8000 133#define SWAP_MAP_BAD 0x7fff
134 134#define SWAP_HAS_CACHE 0x8000 /* There is a swap cache of entry. */
135#define SWAP_COUNT_MASK (~SWAP_HAS_CACHE)
135/* 136/*
136 * The in-memory structure used to track swap areas. 137 * The in-memory structure used to track swap areas.
137 */ 138 */
@@ -235,7 +236,6 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
235} 236}
236#endif 237#endif
237 238
238#ifdef CONFIG_UNEVICTABLE_LRU
239extern int page_evictable(struct page *page, struct vm_area_struct *vma); 239extern int page_evictable(struct page *page, struct vm_area_struct *vma);
240extern void scan_mapping_unevictable_pages(struct address_space *); 240extern void scan_mapping_unevictable_pages(struct address_space *);
241 241
@@ -244,24 +244,6 @@ extern int scan_unevictable_handler(struct ctl_table *, int, struct file *,
244 void __user *, size_t *, loff_t *); 244 void __user *, size_t *, loff_t *);
245extern int scan_unevictable_register_node(struct node *node); 245extern int scan_unevictable_register_node(struct node *node);
246extern void scan_unevictable_unregister_node(struct node *node); 246extern void scan_unevictable_unregister_node(struct node *node);
247#else
248static inline int page_evictable(struct page *page,
249 struct vm_area_struct *vma)
250{
251 return 1;
252}
253
254static inline void scan_mapping_unevictable_pages(struct address_space *mapping)
255{
256}
257
258static inline int scan_unevictable_register_node(struct node *node)
259{
260 return 0;
261}
262
263static inline void scan_unevictable_unregister_node(struct node *node) { }
264#endif
265 247
266extern int kswapd_run(int nid); 248extern int kswapd_run(int nid);
267 249
@@ -274,7 +256,7 @@ extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *);
274 256
275#ifdef CONFIG_SWAP 257#ifdef CONFIG_SWAP
276/* linux/mm/page_io.c */ 258/* linux/mm/page_io.c */
277extern int swap_readpage(struct file *, struct page *); 259extern int swap_readpage(struct page *);
278extern int swap_writepage(struct page *page, struct writeback_control *wbc); 260extern int swap_writepage(struct page *page, struct writeback_control *wbc);
279extern void end_swap_bio_read(struct bio *bio, int err); 261extern void end_swap_bio_read(struct bio *bio, int err);
280 262
@@ -300,9 +282,11 @@ extern long total_swap_pages;
300extern void si_swapinfo(struct sysinfo *); 282extern void si_swapinfo(struct sysinfo *);
301extern swp_entry_t get_swap_page(void); 283extern swp_entry_t get_swap_page(void);
302extern swp_entry_t get_swap_page_of_type(int); 284extern swp_entry_t get_swap_page_of_type(int);
303extern int swap_duplicate(swp_entry_t); 285extern void swap_duplicate(swp_entry_t);
286extern int swapcache_prepare(swp_entry_t);
304extern int valid_swaphandles(swp_entry_t, unsigned long *); 287extern int valid_swaphandles(swp_entry_t, unsigned long *);
305extern void swap_free(swp_entry_t); 288extern void swap_free(swp_entry_t);
289extern void swapcache_free(swp_entry_t, struct page *page);
306extern int free_swap_and_cache(swp_entry_t); 290extern int free_swap_and_cache(swp_entry_t);
307extern int swap_type_of(dev_t, sector_t, struct block_device **); 291extern int swap_type_of(dev_t, sector_t, struct block_device **);
308extern unsigned int count_swap_pages(int, int); 292extern unsigned int count_swap_pages(int, int);
@@ -314,8 +298,8 @@ extern int try_to_free_swap(struct page *);
314struct backing_dev_info; 298struct backing_dev_info;
315 299
316/* linux/mm/thrash.c */ 300/* linux/mm/thrash.c */
317extern struct mm_struct * swap_token_mm; 301extern struct mm_struct *swap_token_mm;
318extern void grab_swap_token(void); 302extern void grab_swap_token(struct mm_struct *);
319extern void __put_swap_token(struct mm_struct *); 303extern void __put_swap_token(struct mm_struct *);
320 304
321static inline int has_swap_token(struct mm_struct *mm) 305static inline int has_swap_token(struct mm_struct *mm)
@@ -335,10 +319,11 @@ static inline void disable_swap_token(void)
335} 319}
336 320
337#ifdef CONFIG_CGROUP_MEM_RES_CTLR 321#ifdef CONFIG_CGROUP_MEM_RES_CTLR
338extern void mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent); 322extern void
323mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout);
339#else 324#else
340static inline void 325static inline void
341mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent) 326mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
342{ 327{
343} 328}
344#endif 329#endif
@@ -370,12 +355,20 @@ static inline void show_swap_cache_info(void)
370} 355}
371 356
372#define free_swap_and_cache(swp) is_migration_entry(swp) 357#define free_swap_and_cache(swp) is_migration_entry(swp)
373#define swap_duplicate(swp) is_migration_entry(swp) 358#define swapcache_prepare(swp) is_migration_entry(swp)
359
360static inline void swap_duplicate(swp_entry_t swp)
361{
362}
374 363
375static inline void swap_free(swp_entry_t swp) 364static inline void swap_free(swp_entry_t swp)
376{ 365{
377} 366}
378 367
368static inline void swapcache_free(swp_entry_t swp, struct page *page)
369{
370}
371
379static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask, 372static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask,
380 struct vm_area_struct *vma, unsigned long addr) 373 struct vm_area_struct *vma, unsigned long addr)
381{ 374{
@@ -426,16 +419,10 @@ static inline swp_entry_t get_swap_page(void)
426} 419}
427 420
428/* linux/mm/thrash.c */ 421/* linux/mm/thrash.c */
429#define put_swap_token(x) do { } while(0) 422#define put_swap_token(mm) do { } while (0)
430#define grab_swap_token() do { } while(0) 423#define grab_swap_token(mm) do { } while (0)
431#define has_swap_token(x) 0 424#define has_swap_token(mm) 0
432#define disable_swap_token() do { } while(0) 425#define disable_swap_token() do { } while (0)
433
434static inline int mem_cgroup_cache_charge_swapin(struct page *page,
435 struct mm_struct *mm, gfp_t mask, bool locked)
436{
437 return 0;
438}
439 426
440static inline void 427static inline void
441mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent) 428mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent)
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index ac9ff54f7cb3..cb1a6631b8f4 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -29,7 +29,8 @@ extern void *swiotlb_alloc(unsigned order, unsigned long nslabs);
29 29
30extern dma_addr_t swiotlb_phys_to_bus(struct device *hwdev, 30extern 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(struct device *hwdev,
33 dma_addr_t address);
33 34
34extern int swiotlb_arch_range_needs_mapping(phys_addr_t paddr, size_t size); 35extern int swiotlb_arch_range_needs_mapping(phys_addr_t paddr, size_t size);
35 36
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 30520844b8da..fa4242cdade8 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -55,6 +55,7 @@ struct compat_timeval;
55struct robust_list_head; 55struct robust_list_head;
56struct getcpu_cache; 56struct getcpu_cache;
57struct old_linux_dirent; 57struct old_linux_dirent;
58struct perf_counter_attr;
58 59
59#include <linux/types.h> 60#include <linux/types.h>
60#include <linux/aio_abi.h> 61#include <linux/aio_abi.h>
@@ -433,6 +434,7 @@ asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg);
433asmlinkage long sys_fcntl64(unsigned int fd, 434asmlinkage long sys_fcntl64(unsigned int fd,
434 unsigned int cmd, unsigned long arg); 435 unsigned int cmd, unsigned long arg);
435#endif 436#endif
437asmlinkage long sys_pipe(int __user *fildes);
436asmlinkage long sys_pipe2(int __user *fildes, int flags); 438asmlinkage long sys_pipe2(int __user *fildes, int flags);
437asmlinkage long sys_dup(unsigned int fildes); 439asmlinkage long sys_dup(unsigned int fildes);
438asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd); 440asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd);
@@ -750,9 +752,11 @@ asmlinkage long sys_pselect6(int, fd_set __user *, fd_set __user *,
750asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int, 752asmlinkage long sys_ppoll(struct pollfd __user *, unsigned int,
751 struct timespec __user *, const sigset_t __user *, 753 struct timespec __user *, const sigset_t __user *,
752 size_t); 754 size_t);
753asmlinkage long sys_pipe2(int __user *, int);
754asmlinkage long sys_pipe(int __user *);
755 755
756int kernel_execve(const char *filename, char *const argv[], char *const envp[]); 756int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
757 757
758
759asmlinkage long sys_perf_counter_open(
760 struct perf_counter_attr __user *attr_uptr,
761 pid_t pid, int cpu, int group_fd, unsigned long flags);
758#endif 762#endif
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 9d5078bd23a3..8afac76cd748 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -377,7 +377,7 @@ struct tcp_sock {
377 unsigned int keepalive_time; /* time before keep alive takes place */ 377 unsigned int keepalive_time; /* time before keep alive takes place */
378 unsigned int keepalive_intvl; /* time interval between keep alive probes */ 378 unsigned int keepalive_intvl; /* time interval between keep alive probes */
379 379
380 unsigned long last_synq_overflow; 380 int linger2;
381 381
382/* Receiver side RTT estimation */ 382/* Receiver side RTT estimation */
383 struct { 383 struct {
@@ -406,8 +406,6 @@ struct tcp_sock {
406/* TCP MD5 Signagure Option information */ 406/* TCP MD5 Signagure Option information */
407 struct tcp_md5sig_info *md5sig_info; 407 struct tcp_md5sig_info *md5sig_info;
408#endif 408#endif
409
410 int linger2;
411}; 409};
412 410
413static inline struct tcp_sock *tcp_sk(const struct sock *sk) 411static inline struct tcp_sock *tcp_sk(const struct sock *sk)
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index e6b820f8b56b..a8cc4e13434c 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -21,13 +21,14 @@ struct restart_block {
21 struct { 21 struct {
22 unsigned long arg0, arg1, arg2, arg3; 22 unsigned long arg0, arg1, arg2, arg3;
23 }; 23 };
24 /* For futex_wait */ 24 /* For futex_wait and futex_wait_requeue_pi */
25 struct { 25 struct {
26 u32 *uaddr; 26 u32 *uaddr;
27 u32 val; 27 u32 val;
28 u32 flags; 28 u32 flags;
29 u32 bitset; 29 u32 bitset;
30 u64 time; 30 u64 time;
31 u32 *uaddr2;
31 } futex; 32 } futex;
32 /* For nanosleep */ 33 /* For nanosleep */
33 struct { 34 struct {
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 469b82d88b3b..0482229c07db 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -97,10 +97,12 @@ extern void tick_clock_notify(void);
97extern int tick_check_oneshot_change(int allow_nohz); 97extern int tick_check_oneshot_change(int allow_nohz);
98extern struct tick_sched *tick_get_tick_sched(int cpu); 98extern struct tick_sched *tick_get_tick_sched(int cpu);
99extern void tick_check_idle(int cpu); 99extern void tick_check_idle(int cpu);
100extern int tick_oneshot_mode_active(void);
100# else 101# else
101static inline void tick_clock_notify(void) { } 102static inline void tick_clock_notify(void) { }
102static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } 103static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
103static inline void tick_check_idle(int cpu) { } 104static inline void tick_check_idle(int cpu) { }
105static inline int tick_oneshot_mode_active(void) { return 0; }
104# endif 106# endif
105 107
106#else /* CONFIG_GENERIC_CLOCKEVENTS */ 108#else /* CONFIG_GENERIC_CLOCKEVENTS */
@@ -109,6 +111,7 @@ static inline void tick_cancel_sched_timer(int cpu) { }
109static inline void tick_clock_notify(void) { } 111static inline void tick_clock_notify(void) { }
110static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } 112static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
111static inline void tick_check_idle(int cpu) { } 113static inline void tick_check_idle(int cpu) { }
114static inline int tick_oneshot_mode_active(void) { return 0; }
112#endif /* !CONFIG_GENERIC_CLOCKEVENTS */ 115#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
113 116
114# ifdef CONFIG_NO_HZ 117# ifdef CONFIG_NO_HZ
diff --git a/include/linux/time.h b/include/linux/time.h
index 242f62499bb7..ea16c1a01d51 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -113,6 +113,21 @@ struct timespec current_kernel_time(void);
113#define CURRENT_TIME (current_kernel_time()) 113#define CURRENT_TIME (current_kernel_time())
114#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 }) 114#define CURRENT_TIME_SEC ((struct timespec) { get_seconds(), 0 })
115 115
116/* Some architectures do not supply their own clocksource.
117 * This is mainly the case in architectures that get their
118 * inter-tick times by reading the counter on their interval
119 * timer. Since these timers wrap every tick, they're not really
120 * useful as clocksources. Wrapping them to act like one is possible
121 * but not very efficient. So we provide a callout these arches
122 * can implement for use with the jiffies clocksource to provide
123 * finer then tick granular time.
124 */
125#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
126extern u32 arch_gettimeoffset(void);
127#else
128static inline u32 arch_gettimeoffset(void) { return 0; }
129#endif
130
116extern void do_gettimeofday(struct timeval *tv); 131extern void do_gettimeofday(struct timeval *tv);
117extern int do_settimeofday(struct timespec *tv); 132extern int do_settimeofday(struct timespec *tv);
118extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz); 133extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz);
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 6cdb6f3331f1..ccf882eed8f8 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -163,7 +163,10 @@ extern 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); 164extern int mod_timer(struct timer_list *timer, unsigned long expires);
165extern int mod_timer_pending(struct timer_list *timer, unsigned long expires); 165extern int mod_timer_pending(struct timer_list *timer, unsigned long expires);
166extern int mod_timer_pinned(struct timer_list *timer, unsigned long expires);
166 167
168#define TIMER_NOT_PINNED 0
169#define TIMER_PINNED 1
167/* 170/*
168 * The jiffies value which is added to now, when there is no timer 171 * The jiffies value which is added to now, when there is no timer
169 * in the timer wheel: 172 * in the timer wheel:
diff --git a/include/linux/timex.h b/include/linux/timex.h
index aa3475fcff64..e6967d10d9e5 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -170,17 +170,37 @@ struct timex {
170#include <asm/timex.h> 170#include <asm/timex.h>
171 171
172/* 172/*
173 * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen 173 * SHIFT_PLL is used as a dampening factor to define how much we
174 * for a slightly underdamped convergence characteristic. SHIFT_KH 174 * adjust the frequency correction for a given offset in PLL mode.
175 * establishes the damping of the FLL and is chosen by wisdom and black 175 * It also used in dampening the offset correction, to define how
176 * art. 176 * much of the current value in time_offset we correct for each
177 * second. Changing this value changes the stiffness of the ntp
178 * adjustment code. A lower value makes it more flexible, reducing
179 * NTP convergence time. A higher value makes it stiffer, increasing
180 * convergence time, but making the clock more stable.
177 * 181 *
178 * MAXTC establishes the maximum time constant of the PLL. With the 182 * In David Mills' nanokernel reference implementation SHIFT_PLL is 4.
179 * SHIFT_KG and SHIFT_KF values given and a time constant range from 183 * However this seems to increase convergence time much too long.
180 * zero to MAXTC, the PLL will converge in 15 minutes to 16 hours, 184 *
181 * respectively. 185 * https://lists.ntp.org/pipermail/hackers/2008-January/003487.html
186 *
187 * In the above mailing list discussion, it seems the value of 4
188 * was appropriate for other Unix systems with HZ=100, and that
189 * SHIFT_PLL should be decreased as HZ increases. However, Linux's
190 * clock steering implementation is HZ independent.
191 *
192 * Through experimentation, a SHIFT_PLL value of 2 was found to allow
193 * for fast convergence (very similar to the NTPv3 code used prior to
194 * v2.6.19), with good clock stability.
195 *
196 *
197 * SHIFT_FLL is used as a dampening factor to define how much we
198 * adjust the frequency correction for a given offset in FLL mode.
199 * In David Mills' nanokernel reference implementation SHIFT_FLL is 2.
200 *
201 * MAXTC establishes the maximum time constant of the PLL.
182 */ 202 */
183#define SHIFT_PLL 4 /* PLL frequency factor (shift) */ 203#define SHIFT_PLL 2 /* PLL frequency factor (shift) */
184#define SHIFT_FLL 2 /* FLL frequency factor (shift) */ 204#define SHIFT_FLL 2 /* FLL frequency factor (shift) */
185#define MAXTC 10 /* maximum time constant (shift) */ 205#define MAXTC 10 /* maximum time constant (shift) */
186 206
@@ -192,10 +212,10 @@ struct timex {
192#define SHIFT_USEC 16 /* frequency offset scale (shift) */ 212#define SHIFT_USEC 16 /* frequency offset scale (shift) */
193#define PPM_SCALE ((s64)NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC)) 213#define PPM_SCALE ((s64)NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC))
194#define PPM_SCALE_INV_SHIFT 19 214#define PPM_SCALE_INV_SHIFT 19
195#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \ 215#define PPM_SCALE_INV ((1LL << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \
196 PPM_SCALE + 1) 216 PPM_SCALE + 1)
197 217
198#define MAXPHASE 500000000l /* max phase error (ns) */ 218#define MAXPHASE 500000000L /* max phase error (ns) */
199#define MAXFREQ 500000 /* max frequency error (ns/s) */ 219#define MAXFREQ 500000 /* max frequency error (ns/s) */
200#define MAXFREQ_SCALED ((s64)MAXFREQ << NTP_SCALE_SHIFT) 220#define MAXFREQ_SCALED ((s64)MAXFREQ << NTP_SCALE_SHIFT)
201#define MINSEC 256 /* min interval between updates (s) */ 221#define MINSEC 256 /* min interval between updates (s) */
@@ -260,6 +280,9 @@ extern int do_adjtimex(struct timex *);
260 280
261int read_current_timer(unsigned long *timer_val); 281int read_current_timer(unsigned long *timer_val);
262 282
283/* The clock frequency of the i8253/i8254 PIT */
284#define PIT_TICK_RATE 1193182ul
285
263#endif /* KERNEL */ 286#endif /* KERNEL */
264 287
265#endif /* LINUX_TIMEX_H */ 288#endif /* LINUX_TIMEX_H */
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h
new file mode 100644
index 000000000000..c134dd1fe6b6
--- /dev/null
+++ b/include/linux/trace_seq.h
@@ -0,0 +1,94 @@
1#ifndef _LINUX_TRACE_SEQ_H
2#define _LINUX_TRACE_SEQ_H
3
4#include <linux/fs.h>
5
6#include <asm/page.h>
7
8/*
9 * Trace sequences are used to allow a function to call several other functions
10 * to create a string of data to use (up to a max of PAGE_SIZE.
11 */
12
13struct trace_seq {
14 unsigned char buffer[PAGE_SIZE];
15 unsigned int len;
16 unsigned int readpos;
17};
18
19static inline void
20trace_seq_init(struct trace_seq *s)
21{
22 s->len = 0;
23 s->readpos = 0;
24}
25
26/*
27 * Currently only defined when tracing is enabled.
28 */
29#ifdef CONFIG_TRACING
30extern int trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
31 __attribute__ ((format (printf, 2, 3)));
32extern int trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args)
33 __attribute__ ((format (printf, 2, 0)));
34extern int
35trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary);
36extern void trace_print_seq(struct seq_file *m, struct trace_seq *s);
37extern ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
38 size_t cnt);
39extern int trace_seq_puts(struct trace_seq *s, const char *str);
40extern int trace_seq_putc(struct trace_seq *s, unsigned char c);
41extern int trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len);
42extern int trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
43 size_t len);
44extern void *trace_seq_reserve(struct trace_seq *s, size_t len);
45extern int trace_seq_path(struct trace_seq *s, struct path *path);
46
47#else /* CONFIG_TRACING */
48static inline int trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
49{
50 return 0;
51}
52static inline int
53trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary)
54{
55 return 0;
56}
57
58static inline void trace_print_seq(struct seq_file *m, struct trace_seq *s)
59{
60}
61static inline ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf,
62 size_t cnt)
63{
64 return 0;
65}
66static inline int trace_seq_puts(struct trace_seq *s, const char *str)
67{
68 return 0;
69}
70static inline int trace_seq_putc(struct trace_seq *s, unsigned char c)
71{
72 return 0;
73}
74static inline int
75trace_seq_putmem(struct trace_seq *s, const void *mem, size_t len)
76{
77 return 0;
78}
79static inline int trace_seq_putmem_hex(struct trace_seq *s, const void *mem,
80 size_t len)
81{
82 return 0;
83}
84static inline void *trace_seq_reserve(struct trace_seq *s, size_t len)
85{
86 return NULL;
87}
88static inline int trace_seq_path(struct trace_seq *s, struct path *path)
89{
90 return 0;
91}
92#endif /* CONFIG_TRACING */
93
94#endif /* _LINUX_TRACE_SEQ_H */
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index eb96603d92db..17ba82efa483 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -143,7 +143,7 @@ static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
143 * 143 *
144 * Return %LSM_UNSAFE_* bits applied to an exec because of tracing. 144 * Return %LSM_UNSAFE_* bits applied to an exec because of tracing.
145 * 145 *
146 * Called with task_lock() held on @task. 146 * @task->cred_guard_mutex is held by the caller through the do_execve().
147 */ 147 */
148static inline int tracehook_unsafe_exec(struct task_struct *task) 148static inline int tracehook_unsafe_exec(struct task_struct *task)
149{ 149{
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index d35a7ee7611f..b9dc4ca0246f 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -31,6 +31,8 @@ struct tracepoint {
31 * Keep in sync with vmlinux.lds.h. 31 * Keep in sync with vmlinux.lds.h.
32 */ 32 */
33 33
34#ifndef DECLARE_TRACE
35
34#define TP_PROTO(args...) args 36#define TP_PROTO(args...) args
35#define TP_ARGS(args...) args 37#define TP_ARGS(args...) args
36 38
@@ -114,6 +116,7 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin,
114 struct tracepoint *end) 116 struct tracepoint *end)
115{ } 117{ }
116#endif /* CONFIG_TRACEPOINTS */ 118#endif /* CONFIG_TRACEPOINTS */
119#endif /* DECLARE_TRACE */
117 120
118/* 121/*
119 * Connect a probe to a tracepoint. 122 * Connect a probe to a tracepoint.
@@ -154,10 +157,8 @@ static inline void tracepoint_synchronize_unregister(void)
154} 157}
155 158
156#define PARAMS(args...) args 159#define PARAMS(args...) args
157#define TRACE_FORMAT(name, proto, args, fmt) \
158 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
159
160 160
161#ifndef TRACE_EVENT
161/* 162/*
162 * For use with the TRACE_EVENT macro: 163 * For use with the TRACE_EVENT macro:
163 * 164 *
@@ -197,7 +198,7 @@ static inline void tracepoint_synchronize_unregister(void)
197 * * This is how the trace record is structured and will 198 * * This is how the trace record is structured and will
198 * * be saved into the ring buffer. These are the fields 199 * * be saved into the ring buffer. These are the fields
199 * * that will be exposed to user-space in 200 * * that will be exposed to user-space in
200 * * /debug/tracing/events/<*>/format. 201 * * /sys/kernel/debug/tracing/events/<*>/format.
201 * * 202 * *
202 * * The declared 'local variable' is called '__entry' 203 * * The declared 'local variable' is called '__entry'
203 * * 204 * *
@@ -257,10 +258,11 @@ static inline void tracepoint_synchronize_unregister(void)
257 * tracepoint callback (this is used by programmatic plugins and 258 * tracepoint callback (this is used by programmatic plugins and
258 * can also by used by generic instrumentation like SystemTap), and 259 * can also by used by generic instrumentation like SystemTap), and
259 * it is also used to expose a structured trace record in 260 * it is also used to expose a structured trace record in
260 * /debug/tracing/events/. 261 * /sys/kernel/debug/tracing/events/.
261 */ 262 */
262 263
263#define TRACE_EVENT(name, proto, args, struct, assign, print) \ 264#define TRACE_EVENT(name, proto, args, struct, assign, print) \
264 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args)) 265 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
266#endif
265 267
266#endif 268#endif
diff --git a/include/linux/tty.h b/include/linux/tty.h
index fc39db95499f..1488d8c81aac 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -185,7 +185,7 @@ struct tty_port;
185struct tty_port_operations { 185struct tty_port_operations {
186 /* Return 1 if the carrier is raised */ 186 /* Return 1 if the carrier is raised */
187 int (*carrier_raised)(struct tty_port *port); 187 int (*carrier_raised)(struct tty_port *port);
188 void (*raise_dtr_rts)(struct tty_port *port); 188 void (*dtr_rts)(struct tty_port *port, int raise);
189}; 189};
190 190
191struct tty_port { 191struct tty_port {
@@ -201,6 +201,9 @@ struct tty_port {
201 unsigned char *xmit_buf; /* Optional buffer */ 201 unsigned char *xmit_buf; /* Optional buffer */
202 int close_delay; /* Close port delay */ 202 int close_delay; /* Close port delay */
203 int closing_wait; /* Delay for output */ 203 int closing_wait; /* Delay for output */
204 int drain_delay; /* Set to zero if no pure time
205 based drain is needed else
206 set to size of fifo */
204}; 207};
205 208
206/* 209/*
@@ -223,8 +226,11 @@ struct tty_struct {
223 struct tty_driver *driver; 226 struct tty_driver *driver;
224 const struct tty_operations *ops; 227 const struct tty_operations *ops;
225 int index; 228 int index;
226 /* The ldisc objects are protected by tty_ldisc_lock at the moment */ 229
227 struct tty_ldisc ldisc; 230 /* Protects ldisc changes: Lock tty not pty */
231 struct mutex ldisc_mutex;
232 struct tty_ldisc *ldisc;
233
228 struct mutex termios_mutex; 234 struct mutex termios_mutex;
229 spinlock_t ctrl_lock; 235 spinlock_t ctrl_lock;
230 /* Termios values are protected by the termios mutex */ 236 /* Termios values are protected by the termios mutex */
@@ -311,6 +317,7 @@ struct tty_struct {
311#define TTY_CLOSING 7 /* ->close() in progress */ 317#define TTY_CLOSING 7 /* ->close() in progress */
312#define TTY_LDISC 9 /* Line discipline attached */ 318#define TTY_LDISC 9 /* Line discipline attached */
313#define TTY_LDISC_CHANGING 10 /* Line discipline changing */ 319#define TTY_LDISC_CHANGING 10 /* Line discipline changing */
320#define TTY_LDISC_OPEN 11 /* Line discipline is open */
314#define TTY_HW_COOK_OUT 14 /* Hardware can do output cooking */ 321#define TTY_HW_COOK_OUT 14 /* Hardware can do output cooking */
315#define TTY_HW_COOK_IN 15 /* Hardware can do input cooking */ 322#define TTY_HW_COOK_IN 15 /* Hardware can do input cooking */
316#define TTY_PTY_LOCK 16 /* pty private */ 323#define TTY_PTY_LOCK 16 /* pty private */
@@ -403,6 +410,7 @@ extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b);
403extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *); 410extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *);
404extern void tty_ldisc_deref(struct tty_ldisc *); 411extern void tty_ldisc_deref(struct tty_ldisc *);
405extern struct tty_ldisc *tty_ldisc_ref_wait(struct tty_struct *); 412extern struct tty_ldisc *tty_ldisc_ref_wait(struct tty_struct *);
413extern void tty_ldisc_hangup(struct tty_struct *tty);
406extern const struct file_operations tty_ldiscs_proc_fops; 414extern const struct file_operations tty_ldiscs_proc_fops;
407 415
408extern void tty_wakeup(struct tty_struct *tty); 416extern void tty_wakeup(struct tty_struct *tty);
@@ -425,6 +433,9 @@ extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx,
425extern void tty_release_dev(struct file *filp); 433extern void tty_release_dev(struct file *filp);
426extern int tty_init_termios(struct tty_struct *tty); 434extern int tty_init_termios(struct tty_struct *tty);
427 435
436extern struct tty_struct *tty_pair_get_tty(struct tty_struct *tty);
437extern struct tty_struct *tty_pair_get_pty(struct tty_struct *tty);
438
428extern struct mutex tty_mutex; 439extern struct mutex tty_mutex;
429 440
430extern void tty_write_unlock(struct tty_struct *tty); 441extern void tty_write_unlock(struct tty_struct *tty);
@@ -438,6 +449,7 @@ extern struct tty_struct *tty_port_tty_get(struct tty_port *port);
438extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty); 449extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty);
439extern int tty_port_carrier_raised(struct tty_port *port); 450extern int tty_port_carrier_raised(struct tty_port *port);
440extern void tty_port_raise_dtr_rts(struct tty_port *port); 451extern void tty_port_raise_dtr_rts(struct tty_port *port);
452extern void tty_port_lower_dtr_rts(struct tty_port *port);
441extern void tty_port_hangup(struct tty_port *port); 453extern void tty_port_hangup(struct tty_port *port);
442extern int tty_port_block_til_ready(struct tty_port *port, 454extern int tty_port_block_til_ready(struct tty_port *port,
443 struct tty_struct *tty, struct file *filp); 455 struct tty_struct *tty, struct file *filp);
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index bcba84ea2d86..3566129384a4 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -127,7 +127,8 @@
127 * the line discipline are close to full, and it should somehow 127 * the line discipline are close to full, and it should somehow
128 * signal that no more characters should be sent to the tty. 128 * signal that no more characters should be sent to the tty.
129 * 129 *
130 * Optional: Always invoke via tty_throttle(); 130 * Optional: Always invoke via tty_throttle(), called under the
131 * termios lock.
131 * 132 *
132 * void (*unthrottle)(struct tty_struct * tty); 133 * void (*unthrottle)(struct tty_struct * tty);
133 * 134 *
@@ -135,7 +136,8 @@
135 * that characters can now be sent to the tty without fear of 136 * that characters can now be sent to the tty without fear of
136 * overrunning the input buffers of the line disciplines. 137 * overrunning the input buffers of the line disciplines.
137 * 138 *
138 * Optional: Always invoke via tty_unthrottle(); 139 * Optional: Always invoke via tty_unthrottle(), called under the
140 * termios lock.
139 * 141 *
140 * void (*stop)(struct tty_struct *tty); 142 * void (*stop)(struct tty_struct *tty);
141 * 143 *
diff --git a/include/linux/types.h b/include/linux/types.h
index 5abe354020f9..c42724f8c802 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -131,7 +131,7 @@ typedef __s64 int64_t;
131 * 131 *
132 * blkcnt_t is the type of the inode's block count. 132 * blkcnt_t is the type of the inode's block count.
133 */ 133 */
134#ifdef CONFIG_LBD 134#ifdef CONFIG_LBDAF
135typedef u64 sector_t; 135typedef u64 sector_t;
136typedef u64 blkcnt_t; 136typedef u64 blkcnt_t;
137#else 137#else
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h
index 970473bf8d5a..ed889f4168f3 100644
--- a/include/linux/ucb1400.h
+++ b/include/linux/ucb1400.h
@@ -134,28 +134,13 @@ static inline void ucb1400_adc_enable(struct snd_ac97 *ac97)
134 ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA); 134 ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA);
135} 135}
136 136
137static unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel,
138 int adcsync)
139{
140 unsigned int val;
141
142 if (adcsync)
143 adc_channel |= UCB_ADC_SYNC_ENA;
144
145 ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel);
146 ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel |
147 UCB_ADC_START);
148
149 while (!((val = ucb1400_reg_read(ac97, UCB_ADC_DATA))
150 & UCB_ADC_DAT_VALID))
151 schedule_timeout_uninterruptible(1);
152
153 return val & UCB_ADC_DAT_MASK;
154}
155
156static inline void ucb1400_adc_disable(struct snd_ac97 *ac97) 137static inline void ucb1400_adc_disable(struct snd_ac97 *ac97)
157{ 138{
158 ucb1400_reg_write(ac97, UCB_ADC_CR, 0); 139 ucb1400_reg_write(ac97, UCB_ADC_CR, 0);
159} 140}
160 141
142
143unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel,
144 int adcsync);
145
161#endif 146#endif
diff --git a/include/linux/ultrasound.h b/include/linux/ultrasound.h
index 6b7703e75cec..71339dc531c5 100644
--- a/include/linux/ultrasound.h
+++ b/include/linux/ultrasound.h
@@ -34,7 +34,7 @@
34 * _GUS_VOICEOFF - Stops voice (no parameters) 34 * _GUS_VOICEOFF - Stops voice (no parameters)
35 * _GUS_VOICEFADE - Stops the voice smoothly. 35 * _GUS_VOICEFADE - Stops the voice smoothly.
36 * _GUS_VOICEMODE - Alters the voice mode, don't start or stop voice (P1=voice mode) 36 * _GUS_VOICEMODE - Alters the voice mode, don't start or stop voice (P1=voice mode)
37 * _GUS_VOICEBALA - Sets voice balence (P1, 0=left, 7=middle and 15=right, default 7) 37 * _GUS_VOICEBALA - Sets voice balance (P1, 0=left, 7=middle and 15=right, default 7)
38 * _GUS_VOICEFREQ - Sets voice (sample) playback frequency (P1=Hz) 38 * _GUS_VOICEFREQ - Sets voice (sample) playback frequency (P1=Hz)
39 * _GUS_VOICEVOL - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off) 39 * _GUS_VOICEVOL - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off)
40 * _GUS_VOICEVOL2 - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off) 40 * _GUS_VOICEVOL2 - Sets voice volume (P1=volume, 0xfff=max, 0xeff=half, 0x000=off)
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 3aa2cd1f8d08..84929e914034 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -36,6 +36,7 @@ struct wusb_dev;
36 * - configs have one (often) or more interfaces; 36 * - configs have one (often) or more interfaces;
37 * - interfaces have one (usually) or more settings; 37 * - interfaces have one (usually) or more settings;
38 * - each interface setting has zero or (usually) more endpoints. 38 * - each interface setting has zero or (usually) more endpoints.
39 * - a SuperSpeed endpoint has a companion descriptor
39 * 40 *
40 * And there might be other descriptors mixed in with those. 41 * And there might be other descriptors mixed in with those.
41 * 42 *
@@ -44,6 +45,19 @@ struct wusb_dev;
44 45
45struct ep_device; 46struct ep_device;
46 47
48/* For SS devices */
49/**
50 * struct usb_host_ss_ep_comp - Valid for SuperSpeed devices only
51 * @desc: endpoint companion descriptor, wMaxPacketSize in native byteorder
52 * @extra: descriptors following this endpoint companion descriptor
53 * @extralen: how many bytes of "extra" are valid
54 */
55struct usb_host_ss_ep_comp {
56 struct usb_ss_ep_comp_descriptor desc;
57 unsigned char *extra; /* Extra descriptors */
58 int extralen;
59};
60
47/** 61/**
48 * struct usb_host_endpoint - host-side endpoint descriptor and queue 62 * struct usb_host_endpoint - host-side endpoint descriptor and queue
49 * @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder 63 * @desc: descriptor for this endpoint, wMaxPacketSize in native byteorder
@@ -51,6 +65,7 @@ struct ep_device;
51 * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) 65 * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH)
52 * with one or more transfer descriptors (TDs) per urb 66 * with one or more transfer descriptors (TDs) per urb
53 * @ep_dev: ep_device for sysfs info 67 * @ep_dev: ep_device for sysfs info
68 * @ss_ep_comp: companion descriptor information for this endpoint
54 * @extra: descriptors following this endpoint in the configuration 69 * @extra: descriptors following this endpoint in the configuration
55 * @extralen: how many bytes of "extra" are valid 70 * @extralen: how many bytes of "extra" are valid
56 * @enabled: URBs may be submitted to this endpoint 71 * @enabled: URBs may be submitted to this endpoint
@@ -63,6 +78,7 @@ struct usb_host_endpoint {
63 struct list_head urb_list; 78 struct list_head urb_list;
64 void *hcpriv; 79 void *hcpriv;
65 struct ep_device *ep_dev; /* For sysfs info */ 80 struct ep_device *ep_dev; /* For sysfs info */
81 struct usb_host_ss_ep_comp *ss_ep_comp; /* For SS devices */
66 82
67 unsigned char *extra; /* Extra descriptors */ 83 unsigned char *extra; /* Extra descriptors */
68 int extralen; 84 int extralen;
@@ -336,7 +352,6 @@ struct usb_bus {
336#ifdef CONFIG_USB_DEVICEFS 352#ifdef CONFIG_USB_DEVICEFS
337 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ 353 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
338#endif 354#endif
339 struct device *dev; /* device for this bus */
340 355
341#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE) 356#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
342 struct mon_bus *mon_bus; /* non-null when associated */ 357 struct mon_bus *mon_bus; /* non-null when associated */
@@ -363,6 +378,7 @@ struct usb_tt;
363 * struct usb_device - kernel's representation of a USB device 378 * struct usb_device - kernel's representation of a USB device
364 * @devnum: device number; address on a USB bus 379 * @devnum: device number; address on a USB bus
365 * @devpath: device ID string for use in messages (e.g., /port/...) 380 * @devpath: device ID string for use in messages (e.g., /port/...)
381 * @route: tree topology hex string for use with xHCI
366 * @state: device state: configured, not attached, etc. 382 * @state: device state: configured, not attached, etc.
367 * @speed: device speed: high/full/low (or error) 383 * @speed: device speed: high/full/low (or error)
368 * @tt: Transaction Translator info; used with low/full speed dev, highspeed hub 384 * @tt: Transaction Translator info; used with low/full speed dev, highspeed hub
@@ -420,6 +436,7 @@ struct usb_tt;
420 * @skip_sys_resume: skip the next system resume 436 * @skip_sys_resume: skip the next system resume
421 * @wusb_dev: if this is a Wireless USB device, link to the WUSB 437 * @wusb_dev: if this is a Wireless USB device, link to the WUSB
422 * specific data for the device. 438 * specific data for the device.
439 * @slot_id: Slot ID assigned by xHCI
423 * 440 *
424 * Notes: 441 * Notes:
425 * Usbcore drivers should not set usbdev->state directly. Instead use 442 * Usbcore drivers should not set usbdev->state directly. Instead use
@@ -428,6 +445,7 @@ struct usb_tt;
428struct usb_device { 445struct usb_device {
429 int devnum; 446 int devnum;
430 char devpath [16]; 447 char devpath [16];
448 u32 route;
431 enum usb_device_state state; 449 enum usb_device_state state;
432 enum usb_device_speed speed; 450 enum usb_device_speed speed;
433 451
@@ -503,6 +521,7 @@ struct usb_device {
503 unsigned skip_sys_resume:1; 521 unsigned skip_sys_resume:1;
504#endif 522#endif
505 struct wusb_dev *wusb_dev; 523 struct wusb_dev *wusb_dev;
524 int slot_id;
506}; 525};
507#define to_usb_device(d) container_of(d, struct usb_device, dev) 526#define to_usb_device(d) container_of(d, struct usb_device, dev)
508 527
@@ -869,6 +888,8 @@ struct usb_driver {
869 * struct usb_device_driver - identifies USB device driver to usbcore 888 * struct usb_device_driver - identifies USB device driver to usbcore
870 * @name: The driver name should be unique among USB drivers, 889 * @name: The driver name should be unique among USB drivers,
871 * and should normally be the same as the module name. 890 * and should normally be the same as the module name.
891 * @nodename: Callback to provide a naming hint for a possible
892 * device node to create.
872 * @probe: Called to see if the driver is willing to manage a particular 893 * @probe: Called to see if the driver is willing to manage a particular
873 * device. If it is, probe returns zero and uses dev_set_drvdata() 894 * device. If it is, probe returns zero and uses dev_set_drvdata()
874 * to associate driver-specific data with the device. If unwilling 895 * to associate driver-specific data with the device. If unwilling
@@ -912,6 +933,7 @@ extern struct bus_type usb_bus_type;
912 */ 933 */
913struct usb_class_driver { 934struct usb_class_driver {
914 char *name; 935 char *name;
936 char *(*nodename)(struct device *dev);
915 const struct file_operations *fops; 937 const struct file_operations *fops;
916 int minor_base; 938 int minor_base;
917}; 939};
@@ -1041,7 +1063,9 @@ typedef void (*usb_complete_t)(struct urb *);
1041 * @setup_dma: For control transfers with URB_NO_SETUP_DMA_MAP set, the 1063 * @setup_dma: For control transfers with URB_NO_SETUP_DMA_MAP set, the
1042 * device driver has provided this DMA address for the setup packet. 1064 * device driver has provided this DMA address for the setup packet.
1043 * The host controller driver should use this in preference to 1065 * The host controller driver should use this in preference to
1044 * setup_packet. 1066 * setup_packet, but the HCD may chose to ignore the address if it must
1067 * copy the setup packet into internal structures. Therefore, setup_packet
1068 * must always point to a valid buffer.
1045 * @start_frame: Returns the initial frame for isochronous transfers. 1069 * @start_frame: Returns the initial frame for isochronous transfers.
1046 * @number_of_packets: Lists the number of ISO transfer buffers. 1070 * @number_of_packets: Lists the number of ISO transfer buffers.
1047 * @interval: Specifies the polling interval for interrupt or isochronous 1071 * @interval: Specifies the polling interval for interrupt or isochronous
@@ -1177,6 +1201,8 @@ struct urb {
1177 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ 1201 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/
1178 void *transfer_buffer; /* (in) associated data buffer */ 1202 void *transfer_buffer; /* (in) associated data buffer */
1179 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */ 1203 dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */
1204 struct usb_sg_request *sg; /* (in) scatter gather buffer list */
1205 int num_sgs; /* (in) number of entries in the sg list */
1180 u32 transfer_buffer_length; /* (in) data buffer length */ 1206 u32 transfer_buffer_length; /* (in) data buffer length */
1181 u32 actual_length; /* (return) actual transfer length */ 1207 u32 actual_length; /* (return) actual transfer length */
1182 unsigned char *setup_packet; /* (in) setup packet (control only) */ 1208 unsigned char *setup_packet; /* (in) setup packet (control only) */
@@ -1422,8 +1448,8 @@ struct usb_sg_request {
1422 int status; 1448 int status;
1423 size_t bytes; 1449 size_t bytes;
1424 1450
1425 /* 1451 /* private:
1426 * members below are private: to usbcore, 1452 * members below are private to usbcore,
1427 * and are not provided for driver access! 1453 * and are not provided for driver access!
1428 */ 1454 */
1429 spinlock_t lock; 1455 spinlock_t lock;
@@ -1558,6 +1584,9 @@ extern void usb_unregister_notify(struct notifier_block *nb);
1558#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \ 1584#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \
1559 format "\n" , ## arg) 1585 format "\n" , ## arg)
1560 1586
1587/* debugfs stuff */
1588extern struct dentry *usb_debug_root;
1589
1561#endif /* __KERNEL__ */ 1590#endif /* __KERNEL__ */
1562 1591
1563#endif 1592#endif
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
index 8cb025fef634..b5744bc218ab 100644
--- a/include/linux/usb/audio.h
+++ b/include/linux/usb/audio.h
@@ -24,10 +24,75 @@
24#define USB_SUBCLASS_AUDIOCONTROL 0x01 24#define USB_SUBCLASS_AUDIOCONTROL 0x01
25#define USB_SUBCLASS_AUDIOSTREAMING 0x02 25#define USB_SUBCLASS_AUDIOSTREAMING 0x02
26#define USB_SUBCLASS_MIDISTREAMING 0x03 26#define USB_SUBCLASS_MIDISTREAMING 0x03
27#define USB_SUBCLASS_VENDOR_SPEC 0xff
27 28
29/* A.5 Audio Class-Specific AC interface Descriptor Subtypes*/
30#define HEADER 0x01
31#define INPUT_TERMINAL 0x02
32#define OUTPUT_TERMINAL 0x03
33#define MIXER_UNIT 0x04
34#define SELECTOR_UNIT 0x05
35#define FEATURE_UNIT 0x06
36#define PROCESSING_UNIT 0x07
37#define EXTENSION_UNIT 0x08
38
39#define AS_GENERAL 0x01
40#define FORMAT_TYPE 0x02
41#define FORMAT_SPECIFIC 0x03
42
43#define EP_GENERAL 0x01
44
45#define MS_GENERAL 0x01
46#define MIDI_IN_JACK 0x02
47#define MIDI_OUT_JACK 0x03
48
49/* endpoint attributes */
50#define EP_ATTR_MASK 0x0c
51#define EP_ATTR_ASYNC 0x04
52#define EP_ATTR_ADAPTIVE 0x08
53#define EP_ATTR_SYNC 0x0c
54
55/* cs endpoint attributes */
56#define EP_CS_ATTR_SAMPLE_RATE 0x01
57#define EP_CS_ATTR_PITCH_CONTROL 0x02
58#define EP_CS_ATTR_FILL_MAX 0x80
59
60/* Audio Class specific Request Codes */
61#define USB_AUDIO_SET_INTF 0x21
62#define USB_AUDIO_SET_ENDPOINT 0x22
63#define USB_AUDIO_GET_INTF 0xa1
64#define USB_AUDIO_GET_ENDPOINT 0xa2
65
66#define SET_ 0x00
67#define GET_ 0x80
68
69#define _CUR 0x1
70#define _MIN 0x2
71#define _MAX 0x3
72#define _RES 0x4
73#define _MEM 0x5
74
75#define SET_CUR (SET_ | _CUR)
76#define GET_CUR (GET_ | _CUR)
77#define SET_MIN (SET_ | _MIN)
78#define GET_MIN (GET_ | _MIN)
79#define SET_MAX (SET_ | _MAX)
80#define GET_MAX (GET_ | _MAX)
81#define SET_RES (SET_ | _RES)
82#define GET_RES (GET_ | _RES)
83#define SET_MEM (SET_ | _MEM)
84#define GET_MEM (GET_ | _MEM)
85
86#define GET_STAT 0xff
87
88#define USB_AC_TERMINAL_UNDEFINED 0x100
89#define USB_AC_TERMINAL_STREAMING 0x101
90#define USB_AC_TERMINAL_VENDOR_SPEC 0x1FF
91
92/* Terminal Control Selectors */
28/* 4.3.2 Class-Specific AC Interface Descriptor */ 93/* 4.3.2 Class-Specific AC Interface Descriptor */
29struct usb_ac_header_descriptor { 94struct usb_ac_header_descriptor {
30 __u8 bLength; /* 8+n */ 95 __u8 bLength; /* 8 + n */
31 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 96 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
32 __u8 bDescriptorSubtype; /* USB_MS_HEADER */ 97 __u8 bDescriptorSubtype; /* USB_MS_HEADER */
33 __le16 bcdADC; /* 0x0100 */ 98 __le16 bcdADC; /* 0x0100 */
@@ -36,7 +101,7 @@ struct usb_ac_header_descriptor {
36 __u8 baInterfaceNr[]; /* [n] */ 101 __u8 baInterfaceNr[]; /* [n] */
37} __attribute__ ((packed)); 102} __attribute__ ((packed));
38 103
39#define USB_DT_AC_HEADER_SIZE(n) (8+(n)) 104#define USB_DT_AC_HEADER_SIZE(n) (8 + (n))
40 105
41/* As above, but more useful for defining your own descriptors: */ 106/* As above, but more useful for defining your own descriptors: */
42#define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) \ 107#define DECLARE_USB_AC_HEADER_DESCRIPTOR(n) \
@@ -50,4 +115,200 @@ struct usb_ac_header_descriptor_##n { \
50 __u8 baInterfaceNr[n]; \ 115 __u8 baInterfaceNr[n]; \
51} __attribute__ ((packed)) 116} __attribute__ ((packed))
52 117
118/* 4.3.2.1 Input Terminal Descriptor */
119struct usb_input_terminal_descriptor {
120 __u8 bLength; /* in bytes: 12 */
121 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
122 __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */
123 __u8 bTerminalID; /* Constant uniquely terminal ID */
124 __le16 wTerminalType; /* USB Audio Terminal Types */
125 __u8 bAssocTerminal; /* ID of the Output Terminal associated */
126 __u8 bNrChannels; /* Number of logical output channels */
127 __le16 wChannelConfig;
128 __u8 iChannelNames;
129 __u8 iTerminal;
130} __attribute__ ((packed));
131
132#define USB_DT_AC_INPUT_TERMINAL_SIZE 12
133
134#define USB_AC_INPUT_TERMINAL_UNDEFINED 0x200
135#define USB_AC_INPUT_TERMINAL_MICROPHONE 0x201
136#define USB_AC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202
137#define USB_AC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203
138#define USB_AC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204
139#define USB_AC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205
140#define USB_AC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206
141
142/* 4.3.2.2 Output Terminal Descriptor */
143struct usb_output_terminal_descriptor {
144 __u8 bLength; /* in bytes: 9 */
145 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
146 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */
147 __u8 bTerminalID; /* Constant uniquely terminal ID */
148 __le16 wTerminalType; /* USB Audio Terminal Types */
149 __u8 bAssocTerminal; /* ID of the Input Terminal associated */
150 __u8 bSourceID; /* ID of the connected Unit or Terminal*/
151 __u8 iTerminal;
152} __attribute__ ((packed));
153
154#define USB_DT_AC_OUTPUT_TERMINAL_SIZE 9
155
156#define USB_AC_OUTPUT_TERMINAL_UNDEFINED 0x300
157#define USB_AC_OUTPUT_TERMINAL_SPEAKER 0x301
158#define USB_AC_OUTPUT_TERMINAL_HEADPHONES 0x302
159#define USB_AC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303
160#define USB_AC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304
161#define USB_AC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305
162#define USB_AC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306
163#define USB_AC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307
164
165/* Set bControlSize = 2 as default setting */
166#define USB_DT_AC_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2)
167
168/* As above, but more useful for defining your own descriptors: */
169#define DECLARE_USB_AC_FEATURE_UNIT_DESCRIPTOR(ch) \
170struct usb_ac_feature_unit_descriptor_##ch { \
171 __u8 bLength; \
172 __u8 bDescriptorType; \
173 __u8 bDescriptorSubtype; \
174 __u8 bUnitID; \
175 __u8 bSourceID; \
176 __u8 bControlSize; \
177 __le16 bmaControls[ch + 1]; \
178 __u8 iFeature; \
179} __attribute__ ((packed))
180
181/* 4.5.2 Class-Specific AS Interface Descriptor */
182struct usb_as_header_descriptor {
183 __u8 bLength; /* in bytes: 7 */
184 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
185 __u8 bDescriptorSubtype; /* AS_GENERAL */
186 __u8 bTerminalLink; /* Terminal ID of connected Terminal */
187 __u8 bDelay; /* Delay introduced by the data path */
188 __le16 wFormatTag; /* The Audio Data Format */
189} __attribute__ ((packed));
190
191#define USB_DT_AS_HEADER_SIZE 7
192
193#define USB_AS_AUDIO_FORMAT_TYPE_I_UNDEFINED 0x0
194#define USB_AS_AUDIO_FORMAT_TYPE_I_PCM 0x1
195#define USB_AS_AUDIO_FORMAT_TYPE_I_PCM8 0x2
196#define USB_AS_AUDIO_FORMAT_TYPE_I_IEEE_FLOAT 0x3
197#define USB_AS_AUDIO_FORMAT_TYPE_I_ALAW 0x4
198#define USB_AS_AUDIO_FORMAT_TYPE_I_MULAW 0x5
199
200struct usb_as_format_type_i_continuous_descriptor {
201 __u8 bLength; /* in bytes: 8 + (ns * 3) */
202 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
203 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
204 __u8 bFormatType; /* FORMAT_TYPE_1 */
205 __u8 bNrChannels; /* physical channels in the stream */
206 __u8 bSubframeSize; /* */
207 __u8 bBitResolution;
208 __u8 bSamFreqType;
209 __u8 tLowerSamFreq[3];
210 __u8 tUpperSamFreq[3];
211} __attribute__ ((packed));
212
213#define USB_AS_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14
214
215struct usb_as_formate_type_i_discrete_descriptor {
216 __u8 bLength; /* in bytes: 8 + (ns * 3) */
217 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
218 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
219 __u8 bFormatType; /* FORMAT_TYPE_1 */
220 __u8 bNrChannels; /* physical channels in the stream */
221 __u8 bSubframeSize; /* */
222 __u8 bBitResolution;
223 __u8 bSamFreqType;
224 __u8 tSamFreq[][3];
225} __attribute__ ((packed));
226
227#define DECLARE_USB_AS_FORMAT_TYPE_I_DISCRETE_DESC(n) \
228struct usb_as_formate_type_i_discrete_descriptor_##n { \
229 __u8 bLength; \
230 __u8 bDescriptorType; \
231 __u8 bDescriptorSubtype; \
232 __u8 bFormatType; \
233 __u8 bNrChannels; \
234 __u8 bSubframeSize; \
235 __u8 bBitResolution; \
236 __u8 bSamFreqType; \
237 __u8 tSamFreq[n][3]; \
238} __attribute__ ((packed))
239
240#define USB_AS_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3))
241
242#define USB_AS_FORMAT_TYPE_UNDEFINED 0x0
243#define USB_AS_FORMAT_TYPE_I 0x1
244#define USB_AS_FORMAT_TYPE_II 0x2
245#define USB_AS_FORMAT_TYPE_III 0x3
246
247#define USB_AS_ENDPOINT_ASYNC (1 << 2)
248#define USB_AS_ENDPOINT_ADAPTIVE (2 << 2)
249#define USB_AS_ENDPOINT_SYNC (3 << 2)
250
251struct usb_as_iso_endpoint_descriptor {
252 __u8 bLength; /* in bytes: 7 */
253 __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */
254 __u8 bDescriptorSubtype; /* EP_GENERAL */
255 __u8 bmAttributes;
256 __u8 bLockDelayUnits;
257 __le16 wLockDelay;
258};
259#define USB_AS_ISO_ENDPOINT_DESC_SIZE 7
260
261#define FU_CONTROL_UNDEFINED 0x00
262#define MUTE_CONTROL 0x01
263#define VOLUME_CONTROL 0x02
264#define BASS_CONTROL 0x03
265#define MID_CONTROL 0x04
266#define TREBLE_CONTROL 0x05
267#define GRAPHIC_EQUALIZER_CONTROL 0x06
268#define AUTOMATIC_GAIN_CONTROL 0x07
269#define DELAY_CONTROL 0x08
270#define BASS_BOOST_CONTROL 0x09
271#define LOUDNESS_CONTROL 0x0a
272
273#define FU_MUTE (1 << (MUTE_CONTROL - 1))
274#define FU_VOLUME (1 << (VOLUME_CONTROL - 1))
275#define FU_BASS (1 << (BASS_CONTROL - 1))
276#define FU_MID (1 << (MID_CONTROL - 1))
277#define FU_TREBLE (1 << (TREBLE_CONTROL - 1))
278#define FU_GRAPHIC_EQ (1 << (GRAPHIC_EQUALIZER_CONTROL - 1))
279#define FU_AUTO_GAIN (1 << (AUTOMATIC_GAIN_CONTROL - 1))
280#define FU_DELAY (1 << (DELAY_CONTROL - 1))
281#define FU_BASS_BOOST (1 << (BASS_BOOST_CONTROL - 1))
282#define FU_LOUDNESS (1 << (LOUDNESS_CONTROL - 1))
283
284struct usb_audio_control {
285 struct list_head list;
286 const char *name;
287 u8 type;
288 int data[5];
289 int (*set)(struct usb_audio_control *con, u8 cmd, int value);
290 int (*get)(struct usb_audio_control *con, u8 cmd);
291};
292
293static inline int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value)
294{
295 con->data[cmd] = value;
296
297 return 0;
298}
299
300static inline int generic_get_cmd(struct usb_audio_control *con, u8 cmd)
301{
302 return con->data[cmd];
303}
304
305struct usb_audio_control_selector {
306 struct list_head list;
307 struct list_head control;
308 u8 id;
309 const char *name;
310 u8 type;
311 struct usb_descriptor_header *desc;
312};
313
53#endif /* __LINUX_USB_AUDIO_H */ 314#endif /* __LINUX_USB_AUDIO_H */
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index b145119a90da..93223638f702 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -191,6 +191,8 @@ struct usb_ctrlrequest {
191#define USB_DT_WIRE_ADAPTER 0x21 191#define USB_DT_WIRE_ADAPTER 0x21
192#define USB_DT_RPIPE 0x22 192#define USB_DT_RPIPE 0x22
193#define USB_DT_CS_RADIO_CONTROL 0x23 193#define USB_DT_CS_RADIO_CONTROL 0x23
194/* From the USB 3.0 spec */
195#define USB_DT_SS_ENDPOINT_COMP 0x30
194 196
195/* Conventional codes for class-specific descriptors. The convention is 197/* Conventional codes for class-specific descriptors. The convention is
196 * defined in the USB "Common Class" Spec (3.11). Individual class specs 198 * defined in the USB "Common Class" Spec (3.11). Individual class specs
@@ -535,6 +537,20 @@ static inline int usb_endpoint_is_isoc_out(
535 537
536/*-------------------------------------------------------------------------*/ 538/*-------------------------------------------------------------------------*/
537 539
540/* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */
541struct usb_ss_ep_comp_descriptor {
542 __u8 bLength;
543 __u8 bDescriptorType;
544
545 __u8 bMaxBurst;
546 __u8 bmAttributes;
547 __u16 wBytesPerInterval;
548} __attribute__ ((packed));
549
550#define USB_DT_SS_EP_COMP_SIZE 6
551
552/*-------------------------------------------------------------------------*/
553
538/* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */ 554/* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */
539struct usb_qualifier_descriptor { 555struct usb_qualifier_descriptor {
540 __u8 bLength; 556 __u8 bLength;
@@ -752,6 +768,7 @@ enum usb_device_speed {
752 USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ 768 USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */
753 USB_SPEED_HIGH, /* usb 2.0 */ 769 USB_SPEED_HIGH, /* usb 2.0 */
754 USB_SPEED_VARIABLE, /* wireless (usb 2.5) */ 770 USB_SPEED_VARIABLE, /* wireless (usb 2.5) */
771 USB_SPEED_SUPER, /* usb 3.0 */
755}; 772};
756 773
757enum usb_device_state { 774enum usb_device_state {
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index acd7b0f06c8a..4f6bb3d2160e 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -124,6 +124,7 @@ struct usb_function {
124 void (*suspend)(struct usb_function *); 124 void (*suspend)(struct usb_function *);
125 void (*resume)(struct usb_function *); 125 void (*resume)(struct usb_function *);
126 126
127 /* private: */
127 /* internals */ 128 /* internals */
128 struct list_head list; 129 struct list_head list;
129}; 130};
@@ -219,6 +220,7 @@ struct usb_configuration {
219 220
220 struct usb_composite_dev *cdev; 221 struct usb_composite_dev *cdev;
221 222
223 /* private: */
222 /* internals */ 224 /* internals */
223 struct list_head list; 225 struct list_head list;
224 struct list_head functions; 226 struct list_head functions;
@@ -321,6 +323,7 @@ struct usb_composite_dev {
321 323
322 struct usb_configuration *config; 324 struct usb_configuration *config;
323 325
326 /* private: */
324 /* internals */ 327 /* internals */
325 struct usb_device_descriptor desc; 328 struct usb_device_descriptor desc;
326 struct list_head configs; 329 struct list_head configs;
diff --git a/include/linux/usb/langwell_otg.h b/include/linux/usb/langwell_otg.h
new file mode 100644
index 000000000000..e115ae6df1da
--- /dev/null
+++ b/include/linux/usb/langwell_otg.h
@@ -0,0 +1,177 @@
1/*
2 * Intel Langwell USB OTG transceiver driver
3 * Copyright (C) 2008, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19
20#ifndef __LANGWELL_OTG_H__
21#define __LANGWELL_OTG_H__
22
23/* notify transceiver driver about OTG events */
24extern void langwell_update_transceiver(void);
25/* HCD register bus driver */
26extern int langwell_register_host(struct pci_driver *host_driver);
27/* HCD unregister bus driver */
28extern void langwell_unregister_host(struct pci_driver *host_driver);
29/* DCD register bus driver */
30extern int langwell_register_peripheral(struct pci_driver *client_driver);
31/* DCD unregister bus driver */
32extern void langwell_unregister_peripheral(struct pci_driver *client_driver);
33/* No silent failure, output warning message */
34extern void langwell_otg_nsf_msg(unsigned long message);
35
36#define CI_USBCMD 0x30
37# define USBCMD_RST BIT(1)
38# define USBCMD_RS BIT(0)
39#define CI_USBSTS 0x34
40# define USBSTS_SLI BIT(8)
41# define USBSTS_URI BIT(6)
42# define USBSTS_PCI BIT(2)
43#define CI_PORTSC1 0x74
44# define PORTSC_PP BIT(12)
45# define PORTSC_LS (BIT(11) | BIT(10))
46# define PORTSC_SUSP BIT(7)
47# define PORTSC_CCS BIT(0)
48#define CI_HOSTPC1 0xb4
49# define HOSTPC1_PHCD BIT(22)
50#define CI_OTGSC 0xf4
51# define OTGSC_DPIE BIT(30)
52# define OTGSC_1MSE BIT(29)
53# define OTGSC_BSEIE BIT(28)
54# define OTGSC_BSVIE BIT(27)
55# define OTGSC_ASVIE BIT(26)
56# define OTGSC_AVVIE BIT(25)
57# define OTGSC_IDIE BIT(24)
58# define OTGSC_DPIS BIT(22)
59# define OTGSC_1MSS BIT(21)
60# define OTGSC_BSEIS BIT(20)
61# define OTGSC_BSVIS BIT(19)
62# define OTGSC_ASVIS BIT(18)
63# define OTGSC_AVVIS BIT(17)
64# define OTGSC_IDIS BIT(16)
65# define OTGSC_DPS BIT(14)
66# define OTGSC_1MST BIT(13)
67# define OTGSC_BSE BIT(12)
68# define OTGSC_BSV BIT(11)
69# define OTGSC_ASV BIT(10)
70# define OTGSC_AVV BIT(9)
71# define OTGSC_ID BIT(8)
72# define OTGSC_HABA BIT(7)
73# define OTGSC_HADP BIT(6)
74# define OTGSC_IDPU BIT(5)
75# define OTGSC_DP BIT(4)
76# define OTGSC_OT BIT(3)
77# define OTGSC_HAAR BIT(2)
78# define OTGSC_VC BIT(1)
79# define OTGSC_VD BIT(0)
80# define OTGSC_INTEN_MASK (0x7f << 24)
81# define OTGSC_INTSTS_MASK (0x7f << 16)
82#define CI_USBMODE 0xf8
83# define USBMODE_CM (BIT(1) | BIT(0))
84# define USBMODE_IDLE 0
85# define USBMODE_DEVICE 0x2
86# define USBMODE_HOST 0x3
87
88#define INTR_DUMMY_MASK (USBSTS_SLI | USBSTS_URI | USBSTS_PCI)
89
90struct otg_hsm {
91 /* Input */
92 int a_bus_resume;
93 int a_bus_suspend;
94 int a_conn;
95 int a_sess_vld;
96 int a_srp_det;
97 int a_vbus_vld;
98 int b_bus_resume;
99 int b_bus_suspend;
100 int b_conn;
101 int b_se0_srp;
102 int b_sess_end;
103 int b_sess_vld;
104 int id;
105
106 /* Internal variables */
107 int a_set_b_hnp_en;
108 int b_srp_done;
109 int b_hnp_enable;
110
111 /* Timeout indicator for timers */
112 int a_wait_vrise_tmout;
113 int a_wait_bcon_tmout;
114 int a_aidl_bdis_tmout;
115 int b_ase0_brst_tmout;
116 int b_bus_suspend_tmout;
117 int b_srp_res_tmout;
118
119 /* Informative variables */
120 int a_bus_drop;
121 int a_bus_req;
122 int a_clr_err;
123 int a_suspend_req;
124 int b_bus_req;
125
126 /* Output */
127 int drv_vbus;
128 int loc_conn;
129 int loc_sof;
130
131 /* Others */
132 int b_bus_suspend_vld;
133};
134
135#define TA_WAIT_VRISE 100
136#define TA_WAIT_BCON 30000
137#define TA_AIDL_BDIS 15000
138#define TB_ASE0_BRST 5000
139#define TB_SE0_SRP 2
140#define TB_SRP_RES 100
141#define TB_BUS_SUSPEND 500
142
143struct langwell_otg_timer {
144 unsigned long expires; /* Number of count increase to timeout */
145 unsigned long count; /* Tick counter */
146 void (*function)(unsigned long); /* Timeout function */
147 unsigned long data; /* Data passed to function */
148 struct list_head list;
149};
150
151struct langwell_otg {
152 struct otg_transceiver otg;
153 struct otg_hsm hsm;
154 void __iomem *regs;
155 unsigned region;
156 struct pci_driver *host_ops;
157 struct pci_driver *client_ops;
158 struct pci_dev *pdev;
159 struct work_struct work;
160 struct workqueue_struct *qwork;
161 spinlock_t lock;
162 spinlock_t wq_lock;
163};
164
165static inline struct langwell_otg *otg_to_langwell(struct otg_transceiver *otg)
166{
167 return container_of(otg, struct langwell_otg, otg);
168}
169
170#ifdef DEBUG
171#define otg_dbg(fmt, args...) \
172 printk(KERN_DEBUG fmt , ## args)
173#else
174#define otg_dbg(fmt, args...) \
175 do { } while (0)
176#endif /* DEBUG */
177#endif /* __LANGWELL_OTG_H__ */
diff --git a/include/linux/usb/langwell_udc.h b/include/linux/usb/langwell_udc.h
new file mode 100644
index 000000000000..c949178a6530
--- /dev/null
+++ b/include/linux/usb/langwell_udc.h
@@ -0,0 +1,310 @@
1/*
2 * Intel Langwell USB Device Controller driver
3 * Copyright (C) 2008-2009, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19
20#ifndef __LANGWELL_UDC_H
21#define __LANGWELL_UDC_H
22
23
24/* MACRO defines */
25#define CAP_REG_OFFSET 0x0
26#define OP_REG_OFFSET 0x28
27
28#define DMA_ADDR_INVALID (~(dma_addr_t)0)
29
30#define DQH_ALIGNMENT 2048
31#define DTD_ALIGNMENT 64
32#define DMA_BOUNDARY 4096
33
34#define EP0_MAX_PKT_SIZE 64
35#define EP_DIR_IN 1
36#define EP_DIR_OUT 0
37
38#define FLUSH_TIMEOUT 1000
39#define RESET_TIMEOUT 1000
40#define SETUPSTAT_TIMEOUT 100
41#define PRIME_TIMEOUT 100
42
43
44/* device memory space registers */
45
46/* Capability Registers, BAR0 + CAP_REG_OFFSET */
47struct langwell_cap_regs {
48 /* offset: 0x0 */
49 u8 caplength; /* offset of Operational Register */
50 u8 _reserved3;
51 u16 hciversion; /* H: BCD encoding of host version */
52 u32 hcsparams; /* H: host port steering logic capability */
53 u32 hccparams; /* H: host multiple mode control capability */
54#define HCC_LEN BIT(17) /* Link power management (LPM) capability */
55 u8 _reserved4[0x20-0xc];
56 /* offset: 0x20 */
57 u16 dciversion; /* BCD encoding of device version */
58 u8 _reserved5[0x24-0x22];
59 u32 dccparams; /* overall device controller capability */
60#define HOSTCAP BIT(8) /* host capable */
61#define DEVCAP BIT(7) /* device capable */
62#define DEN(d) \
63 (((d)>>0)&0x1f) /* bits 4:0, device endpoint number */
64} __attribute__ ((packed));
65
66
67/* Operational Registers, BAR0 + OP_REG_OFFSET */
68struct langwell_op_regs {
69 /* offset: 0x28 */
70 u32 extsts;
71#define EXTS_TI1 BIT(4) /* general purpose timer interrupt 1 */
72#define EXTS_TI1TI0 BIT(3) /* general purpose timer interrupt 0 */
73#define EXTS_TI1UPI BIT(2) /* USB host periodic interrupt */
74#define EXTS_TI1UAI BIT(1) /* USB host asynchronous interrupt */
75#define EXTS_TI1NAKI BIT(0) /* NAK interrupt */
76 u32 extintr;
77#define EXTI_TIE1 BIT(4) /* general purpose timer interrupt enable 1 */
78#define EXTI_TIE0 BIT(3) /* general purpose timer interrupt enable 0 */
79#define EXTI_UPIE BIT(2) /* USB host periodic interrupt enable */
80#define EXTI_UAIE BIT(1) /* USB host asynchronous interrupt enable */
81#define EXTI_NAKE BIT(0) /* NAK interrupt enable */
82 /* offset: 0x30 */
83 u32 usbcmd;
84#define CMD_HIRD(u) \
85 (((u)>>24)&0xf) /* bits 27:24, host init resume duration */
86#define CMD_ITC(u) \
87 (((u)>>16)&0xff) /* bits 23:16, interrupt threshold control */
88#define CMD_PPE BIT(15) /* per-port change events enable */
89#define CMD_ATDTW BIT(14) /* add dTD tripwire */
90#define CMD_SUTW BIT(13) /* setup tripwire */
91#define CMD_ASPE BIT(11) /* asynchronous schedule park mode enable */
92#define CMD_FS2 BIT(10) /* frame list size */
93#define CMD_ASP1 BIT(9) /* asynchronous schedule park mode count */
94#define CMD_ASP0 BIT(8)
95#define CMD_LR BIT(7) /* light host/device controller reset */
96#define CMD_IAA BIT(6) /* interrupt on async advance doorbell */
97#define CMD_ASE BIT(5) /* asynchronous schedule enable */
98#define CMD_PSE BIT(4) /* periodic schedule enable */
99#define CMD_FS1 BIT(3)
100#define CMD_FS0 BIT(2)
101#define CMD_RST BIT(1) /* controller reset */
102#define CMD_RUNSTOP BIT(0) /* run/stop */
103 u32 usbsts;
104#define STS_PPCI(u) \
105 (((u)>>16)&0xffff) /* bits 31:16, port-n change detect */
106#define STS_AS BIT(15) /* asynchronous schedule status */
107#define STS_PS BIT(14) /* periodic schedule status */
108#define STS_RCL BIT(13) /* reclamation */
109#define STS_HCH BIT(12) /* HC halted */
110#define STS_ULPII BIT(10) /* ULPI interrupt */
111#define STS_SLI BIT(8) /* DC suspend */
112#define STS_SRI BIT(7) /* SOF received */
113#define STS_URI BIT(6) /* USB reset received */
114#define STS_AAI BIT(5) /* interrupt on async advance */
115#define STS_SEI BIT(4) /* system error */
116#define STS_FRI BIT(3) /* frame list rollover */
117#define STS_PCI BIT(2) /* port change detect */
118#define STS_UEI BIT(1) /* USB error interrupt */
119#define STS_UI BIT(0) /* USB interrupt */
120 u32 usbintr;
121/* bits 31:16, per-port interrupt enable */
122#define INTR_PPCE(u) (((u)>>16)&0xffff)
123#define INTR_ULPIE BIT(10) /* ULPI enable */
124#define INTR_SLE BIT(8) /* DC sleep/suspend enable */
125#define INTR_SRE BIT(7) /* SOF received enable */
126#define INTR_URE BIT(6) /* USB reset enable */
127#define INTR_AAE BIT(5) /* interrupt on async advance enable */
128#define INTR_SEE BIT(4) /* system error enable */
129#define INTR_FRE BIT(3) /* frame list rollover enable */
130#define INTR_PCE BIT(2) /* port change detect enable */
131#define INTR_UEE BIT(1) /* USB error interrupt enable */
132#define INTR_UE BIT(0) /* USB interrupt enable */
133 u32 frindex; /* frame index */
134#define FRINDEX_MASK (0x3fff << 0)
135 u32 ctrldssegment; /* not used */
136 u32 deviceaddr;
137#define USBADR_SHIFT 25
138#define USBADR(d) \
139 (((d)>>25)&0x7f) /* bits 31:25, device address */
140#define USBADR_MASK (0x7f << 25)
141#define USBADRA BIT(24) /* device address advance */
142 u32 endpointlistaddr;/* endpoint list top memory address */
143/* bits 31:11, endpoint list pointer */
144#define EPBASE(d) (((d)>>11)&0x1fffff)
145#define ENDPOINTLISTADDR_MASK (0x1fffff << 11)
146 u32 ttctrl; /* H: TT operatin, not used */
147 /* offset: 0x50 */
148 u32 burstsize; /* burst size of data movement */
149#define TXPBURST(b) \
150 (((b)>>8)&0xff) /* bits 15:8, TX burst length */
151#define RXPBURST(b) \
152 (((b)>>0)&0xff) /* bits 7:0, RX burst length */
153 u32 txfilltuning; /* TX tuning */
154 u32 txttfilltuning; /* H: TX TT tuning */
155 u32 ic_usb; /* control the IC_USB FS/LS transceiver */
156 /* offset: 0x60 */
157 u32 ulpi_viewport; /* indirect access to ULPI PHY */
158#define ULPIWU BIT(31) /* ULPI wakeup */
159#define ULPIRUN BIT(30) /* ULPI read/write run */
160#define ULPIRW BIT(29) /* ULPI read/write control */
161#define ULPISS BIT(27) /* ULPI sync state */
162#define ULPIPORT(u) \
163 (((u)>>24)&7) /* bits 26:24, ULPI port number */
164#define ULPIADDR(u) \
165 (((u)>>16)&0xff) /* bits 23:16, ULPI data address */
166#define ULPIDATRD(u) \
167 (((u)>>8)&0xff) /* bits 15:8, ULPI data read */
168#define ULPIDATWR(u) \
169 (((u)>>0)&0xff) /* bits 7:0, ULPI date write */
170 u8 _reserved6[0x70-0x64];
171 /* offset: 0x70 */
172 u32 configflag; /* H: not used */
173 u32 portsc1; /* port status */
174#define DA(p) \
175 (((p)>>25)&0x7f) /* bits 31:25, device address */
176#define PORTS_SSTS (BIT(24) | BIT(23)) /* suspend status */
177#define PORTS_WKOC BIT(22) /* wake on over-current enable */
178#define PORTS_WKDS BIT(21) /* wake on disconnect enable */
179#define PORTS_WKCN BIT(20) /* wake on connect enable */
180#define PORTS_PTC(p) (((p)>>16)&0xf) /* bits 19:16, port test control */
181#define PORTS_PIC (BIT(15) | BIT(14)) /* port indicator control */
182#define PORTS_PO BIT(13) /* port owner */
183#define PORTS_PP BIT(12) /* port power */
184#define PORTS_LS (BIT(11) | BIT(10)) /* line status */
185#define PORTS_SLP BIT(9) /* suspend using L1 */
186#define PORTS_PR BIT(8) /* port reset */
187#define PORTS_SUSP BIT(7) /* suspend */
188#define PORTS_FPR BIT(6) /* force port resume */
189#define PORTS_OCC BIT(5) /* over-current change */
190#define PORTS_OCA BIT(4) /* over-current active */
191#define PORTS_PEC BIT(3) /* port enable/disable change */
192#define PORTS_PE BIT(2) /* port enable/disable */
193#define PORTS_CSC BIT(1) /* connect status change */
194#define PORTS_CCS BIT(0) /* current connect status */
195 u8 _reserved7[0xb4-0x78];
196 /* offset: 0xb4 */
197 u32 devlc; /* control LPM and each USB port behavior */
198/* bits 31:29, parallel transceiver select */
199#define LPM_PTS(d) (((d)>>29)&7)
200#define LPM_STS BIT(28) /* serial transceiver select */
201#define LPM_PTW BIT(27) /* parallel transceiver width */
202#define LPM_PSPD(d) (((d)>>25)&3) /* bits 26:25, port speed */
203#define LPM_PSPD_MASK (BIT(26) | BIT(25))
204#define LPM_SPEED_FULL 0
205#define LPM_SPEED_LOW 1
206#define LPM_SPEED_HIGH 2
207#define LPM_SRT BIT(24) /* shorten reset time */
208#define LPM_PFSC BIT(23) /* port force full speed connect */
209#define LPM_PHCD BIT(22) /* PHY low power suspend clock disable */
210#define LPM_STL BIT(16) /* STALL reply to LPM token */
211#define LPM_BA(d) \
212 (((d)>>1)&0x7ff) /* bits 11:1, BmAttributes */
213#define LPM_NYT_ACK BIT(0) /* NYET/ACK reply to LPM token */
214 u8 _reserved8[0xf4-0xb8];
215 /* offset: 0xf4 */
216 u32 otgsc; /* On-The-Go status and control */
217#define OTGSC_DPIE BIT(30) /* data pulse interrupt enable */
218#define OTGSC_MSE BIT(29) /* 1 ms timer interrupt enable */
219#define OTGSC_BSEIE BIT(28) /* B session end interrupt enable */
220#define OTGSC_BSVIE BIT(27) /* B session valid interrupt enable */
221#define OTGSC_ASVIE BIT(26) /* A session valid interrupt enable */
222#define OTGSC_AVVIE BIT(25) /* A VBUS valid interrupt enable */
223#define OTGSC_IDIE BIT(24) /* USB ID interrupt enable */
224#define OTGSC_DPIS BIT(22) /* data pulse interrupt status */
225#define OTGSC_MSS BIT(21) /* 1 ms timer interrupt status */
226#define OTGSC_BSEIS BIT(20) /* B session end interrupt status */
227#define OTGSC_BSVIS BIT(19) /* B session valid interrupt status */
228#define OTGSC_ASVIS BIT(18) /* A session valid interrupt status */
229#define OTGSC_AVVIS BIT(17) /* A VBUS valid interrupt status */
230#define OTGSC_IDIS BIT(16) /* USB ID interrupt status */
231#define OTGSC_DPS BIT(14) /* data bus pulsing status */
232#define OTGSC_MST BIT(13) /* 1 ms timer toggle */
233#define OTGSC_BSE BIT(12) /* B session end */
234#define OTGSC_BSV BIT(11) /* B session valid */
235#define OTGSC_ASV BIT(10) /* A session valid */
236#define OTGSC_AVV BIT(9) /* A VBUS valid */
237#define OTGSC_USBID BIT(8) /* USB ID */
238#define OTGSC_HABA BIT(7) /* hw assist B-disconnect to A-connect */
239#define OTGSC_HADP BIT(6) /* hw assist data pulse */
240#define OTGSC_IDPU BIT(5) /* ID pullup */
241#define OTGSC_DP BIT(4) /* data pulsing */
242#define OTGSC_OT BIT(3) /* OTG termination */
243#define OTGSC_HAAR BIT(2) /* hw assist auto reset */
244#define OTGSC_VC BIT(1) /* VBUS charge */
245#define OTGSC_VD BIT(0) /* VBUS discharge */
246 u32 usbmode;
247#define MODE_VBPS BIT(5) /* R/W VBUS power select */
248#define MODE_SDIS BIT(4) /* R/W stream disable mode */
249#define MODE_SLOM BIT(3) /* R/W setup lockout mode */
250#define MODE_ENSE BIT(2) /* endian select */
251#define MODE_CM(u) (((u)>>0)&3) /* bits 1:0, controller mode */
252#define MODE_IDLE 0
253#define MODE_DEVICE 2
254#define MODE_HOST 3
255 u8 _reserved9[0x100-0xfc];
256 /* offset: 0x100 */
257 u32 endptnak;
258#define EPTN(e) \
259 (((e)>>16)&0xffff) /* bits 31:16, TX endpoint NAK */
260#define EPRN(e) \
261 (((e)>>0)&0xffff) /* bits 15:0, RX endpoint NAK */
262 u32 endptnaken;
263#define EPTNE(e) \
264 (((e)>>16)&0xffff) /* bits 31:16, TX endpoint NAK enable */
265#define EPRNE(e) \
266 (((e)>>0)&0xffff) /* bits 15:0, RX endpoint NAK enable */
267 u32 endptsetupstat;
268#define SETUPSTAT_MASK (0xffff << 0) /* bits 15:0 */
269#define EP0SETUPSTAT_MASK 1
270 u32 endptprime;
271/* bits 31:16, prime endpoint transmit buffer */
272#define PETB(e) (((e)>>16)&0xffff)
273/* bits 15:0, prime endpoint receive buffer */
274#define PERB(e) (((e)>>0)&0xffff)
275 /* offset: 0x110 */
276 u32 endptflush;
277/* bits 31:16, flush endpoint transmit buffer */
278#define FETB(e) (((e)>>16)&0xffff)
279/* bits 15:0, flush endpoint receive buffer */
280#define FERB(e) (((e)>>0)&0xffff)
281 u32 endptstat;
282/* bits 31:16, endpoint transmit buffer ready */
283#define ETBR(e) (((e)>>16)&0xffff)
284/* bits 15:0, endpoint receive buffer ready */
285#define ERBR(e) (((e)>>0)&0xffff)
286 u32 endptcomplete;
287/* bits 31:16, endpoint transmit complete event */
288#define ETCE(e) (((e)>>16)&0xffff)
289/* bits 15:0, endpoint receive complete event */
290#define ERCE(e) (((e)>>0)&0xffff)
291 /* offset: 0x11c */
292 u32 endptctrl[16];
293#define EPCTRL_TXE BIT(23) /* TX endpoint enable */
294#define EPCTRL_TXR BIT(22) /* TX data toggle reset */
295#define EPCTRL_TXI BIT(21) /* TX data toggle inhibit */
296#define EPCTRL_TXT(e) (((e)>>18)&3) /* bits 19:18, TX endpoint type */
297#define EPCTRL_TXT_SHIFT 18
298#define EPCTRL_TXD BIT(17) /* TX endpoint data source */
299#define EPCTRL_TXS BIT(16) /* TX endpoint STALL */
300#define EPCTRL_RXE BIT(7) /* RX endpoint enable */
301#define EPCTRL_RXR BIT(6) /* RX data toggle reset */
302#define EPCTRL_RXI BIT(5) /* RX data toggle inhibit */
303#define EPCTRL_RXT(e) (((e)>>2)&3) /* bits 3:2, RX endpoint type */
304#define EPCTRL_RXT_SHIFT 2 /* bits 19:18, TX endpoint type */
305#define EPCTRL_RXD BIT(1) /* RX endpoint data sink */
306#define EPCTRL_RXS BIT(0) /* RX endpoint STALL */
307} __attribute__ ((packed));
308
309#endif /* __LANGWELL_UDC_H */
310
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 1aaa826396a1..2443c0e7a80c 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -80,10 +80,10 @@ 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 83
84/* sometimes transceivers are accessed only through e.g. ULPI */
84extern void usb_nop_xceiv_register(void); 85extern void usb_nop_xceiv_register(void);
85extern void usb_nop_xceiv_unregister(void); 86extern void usb_nop_xceiv_unregister(void);
86#endif
87 87
88 88
89/* for usb host and peripheral controller drivers */ 89/* for usb host and peripheral controller drivers */
diff --git a/include/linux/usb/r8a66597.h b/include/linux/usb/r8a66597.h
new file mode 100644
index 000000000000..e9f0384fa20c
--- /dev/null
+++ b/include/linux/usb/r8a66597.h
@@ -0,0 +1,44 @@
1/*
2 * R8A66597 driver platform data
3 *
4 * Copyright (C) 2009 Renesas Solutions Corp.
5 *
6 * Author : Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 *
21 */
22
23#ifndef __LINUX_USB_R8A66597_H
24#define __LINUX_USB_R8A66597_H
25
26#define R8A66597_PLATDATA_XTAL_12MHZ 0x01
27#define R8A66597_PLATDATA_XTAL_24MHZ 0x02
28#define R8A66597_PLATDATA_XTAL_48MHZ 0x03
29
30struct r8a66597_platdata {
31 /* This ops can controll port power instead of DVSTCTR register. */
32 void (*port_power)(int port, int power);
33
34 /* (external controller only) set R8A66597_PLATDATA_XTAL_nnMHZ */
35 unsigned xtal:2;
36
37 /* set one = 3.3V, set zero = 1.5V */
38 unsigned vif:1;
39
40 /* set one = big endian, set zero = little endian */
41 unsigned endian:1;
42};
43#endif
44
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 625e9e4639c6..44801d26a37a 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/kref.h> 16#include <linux/kref.h>
17#include <linux/mutex.h> 17#include <linux/mutex.h>
18#include <linux/sysrq.h>
18 19
19#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ 20#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
20#define SERIAL_TTY_MINORS 254 /* loads of devices :) */ 21#define SERIAL_TTY_MINORS 254 /* loads of devices :) */
@@ -26,6 +27,13 @@
26/* parity check flag */ 27/* parity check flag */
27#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) 28#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
28 29
30enum port_dev_state {
31 PORT_UNREGISTERED,
32 PORT_REGISTERING,
33 PORT_REGISTERED,
34 PORT_UNREGISTERING,
35};
36
29/** 37/**
30 * usb_serial_port: structure for the specific ports of a device. 38 * usb_serial_port: structure for the specific ports of a device.
31 * @serial: pointer back to the struct usb_serial owner of this port. 39 * @serial: pointer back to the struct usb_serial owner of this port.
@@ -91,12 +99,17 @@ struct usb_serial_port {
91 int write_urb_busy; 99 int write_urb_busy;
92 __u8 bulk_out_endpointAddress; 100 __u8 bulk_out_endpointAddress;
93 101
102 int tx_bytes_flight;
103 int urbs_in_flight;
104
94 wait_queue_head_t write_wait; 105 wait_queue_head_t write_wait;
95 struct work_struct work; 106 struct work_struct work;
96 char throttled; 107 char throttled;
97 char throttle_req; 108 char throttle_req;
98 char console; 109 char console;
110 unsigned long sysrq; /* sysrq timeout */
99 struct device dev; 111 struct device dev;
112 enum port_dev_state dev_state;
100}; 113};
101#define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) 114#define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev)
102 115
@@ -181,8 +194,10 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
181 * This will be called when the struct usb_serial structure is fully set 194 * This will be called when the struct usb_serial structure is fully set
182 * set up. Do any local initialization of the device, or any private 195 * set up. Do any local initialization of the device, or any private
183 * memory structure allocation at this point in time. 196 * memory structure allocation at this point in time.
184 * @shutdown: pointer to the driver's shutdown function. This will be 197 * @disconnect: pointer to the driver's disconnect function. This will be
185 * called when the device is removed from the system. 198 * called when the device is unplugged or unbound from the driver.
199 * @release: pointer to the driver's release function. This will be called
200 * when the usb_serial data structure is about to be destroyed.
186 * @usb_driver: pointer to the struct usb_driver that controls this 201 * @usb_driver: pointer to the struct usb_driver that controls this
187 * device. This is necessary to allow dynamic ids to be added to 202 * device. This is necessary to allow dynamic ids to be added to
188 * the driver from sysfs. 203 * the driver from sysfs.
@@ -207,12 +222,14 @@ struct usb_serial_driver {
207 struct device_driver driver; 222 struct device_driver driver;
208 struct usb_driver *usb_driver; 223 struct usb_driver *usb_driver;
209 struct usb_dynids dynids; 224 struct usb_dynids dynids;
225 int max_in_flight_urbs;
210 226
211 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id); 227 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id);
212 int (*attach)(struct usb_serial *serial); 228 int (*attach)(struct usb_serial *serial);
213 int (*calc_num_ports) (struct usb_serial *serial); 229 int (*calc_num_ports) (struct usb_serial *serial);
214 230
215 void (*shutdown)(struct usb_serial *serial); 231 void (*disconnect)(struct usb_serial *serial);
232 void (*release)(struct usb_serial *serial);
216 233
217 int (*port_probe)(struct usb_serial_port *port); 234 int (*port_probe)(struct usb_serial_port *port);
218 int (*port_remove)(struct usb_serial_port *port); 235 int (*port_remove)(struct usb_serial_port *port);
@@ -224,8 +241,7 @@ struct usb_serial_driver {
224 /* Called by console with tty = NULL and by tty */ 241 /* Called by console with tty = NULL and by tty */
225 int (*open)(struct tty_struct *tty, 242 int (*open)(struct tty_struct *tty,
226 struct usb_serial_port *port, struct file *filp); 243 struct usb_serial_port *port, struct file *filp);
227 void (*close)(struct tty_struct *tty, 244 void (*close)(struct usb_serial_port *port);
228 struct usb_serial_port *port, struct file *filp);
229 int (*write)(struct tty_struct *tty, struct usb_serial_port *port, 245 int (*write)(struct tty_struct *tty, struct usb_serial_port *port,
230 const unsigned char *buf, int count); 246 const unsigned char *buf, int count);
231 /* Called only by the tty layer */ 247 /* Called only by the tty layer */
@@ -241,6 +257,10 @@ struct usb_serial_driver {
241 int (*tiocmget)(struct tty_struct *tty, struct file *file); 257 int (*tiocmget)(struct tty_struct *tty, struct file *file);
242 int (*tiocmset)(struct tty_struct *tty, struct file *file, 258 int (*tiocmset)(struct tty_struct *tty, struct file *file,
243 unsigned int set, unsigned int clear); 259 unsigned int set, unsigned int clear);
260 /* Called by the tty layer for port level work. There may or may not
261 be an attached tty at this point */
262 void (*dtr_rts)(struct usb_serial_port *port, int on);
263 int (*carrier_raised)(struct usb_serial_port *port);
244 /* USB events */ 264 /* USB events */
245 void (*read_int_callback)(struct urb *urb); 265 void (*read_int_callback)(struct urb *urb);
246 void (*write_int_callback)(struct urb *urb); 266 void (*write_int_callback)(struct urb *urb);
@@ -283,8 +303,7 @@ extern int usb_serial_generic_open(struct tty_struct *tty,
283 struct usb_serial_port *port, struct file *filp); 303 struct usb_serial_port *port, struct file *filp);
284extern int usb_serial_generic_write(struct tty_struct *tty, 304extern int usb_serial_generic_write(struct tty_struct *tty,
285 struct usb_serial_port *port, const unsigned char *buf, int count); 305 struct usb_serial_port *port, const unsigned char *buf, int count);
286extern void usb_serial_generic_close(struct tty_struct *tty, 306extern void usb_serial_generic_close(struct usb_serial_port *port);
287 struct usb_serial_port *port, struct file *filp);
288extern int usb_serial_generic_resume(struct usb_serial *serial); 307extern int usb_serial_generic_resume(struct usb_serial *serial);
289extern int usb_serial_generic_write_room(struct tty_struct *tty); 308extern int usb_serial_generic_write_room(struct tty_struct *tty);
290extern int usb_serial_generic_chars_in_buffer(struct tty_struct *tty); 309extern int usb_serial_generic_chars_in_buffer(struct tty_struct *tty);
@@ -292,9 +311,16 @@ extern void usb_serial_generic_read_bulk_callback(struct urb *urb);
292extern void usb_serial_generic_write_bulk_callback(struct urb *urb); 311extern void usb_serial_generic_write_bulk_callback(struct urb *urb);
293extern void usb_serial_generic_throttle(struct tty_struct *tty); 312extern void usb_serial_generic_throttle(struct tty_struct *tty);
294extern void usb_serial_generic_unthrottle(struct tty_struct *tty); 313extern void usb_serial_generic_unthrottle(struct tty_struct *tty);
295extern void usb_serial_generic_shutdown(struct usb_serial *serial); 314extern void usb_serial_generic_disconnect(struct usb_serial *serial);
315extern void usb_serial_generic_release(struct usb_serial *serial);
296extern int usb_serial_generic_register(int debug); 316extern int usb_serial_generic_register(int debug);
297extern void usb_serial_generic_deregister(void); 317extern void usb_serial_generic_deregister(void);
318extern void usb_serial_generic_resubmit_read_urb(struct usb_serial_port *port,
319 gfp_t mem_flags);
320extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port,
321 unsigned int ch);
322extern int usb_serial_handle_break(struct usb_serial_port *port);
323
298 324
299extern int usb_serial_bus_register(struct usb_serial_driver *device); 325extern int usb_serial_bus_register(struct usb_serial_driver *device);
300extern void usb_serial_bus_deregister(struct usb_serial_driver *device); 326extern void usb_serial_bus_deregister(struct usb_serial_driver *device);
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 36fabb95c7d3..5d44059f6d63 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -183,6 +183,7 @@ extern void usbnet_tx_timeout (struct net_device *net);
183extern int usbnet_change_mtu (struct net_device *net, int new_mtu); 183extern int usbnet_change_mtu (struct net_device *net, int new_mtu);
184 184
185extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *); 185extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *);
186extern int usbnet_get_ethernet_addr(struct usbnet *, int);
186extern void usbnet_defer_kevent (struct usbnet *, int); 187extern void usbnet_defer_kevent (struct usbnet *, int);
187extern void usbnet_skb_return (struct usbnet *, struct sk_buff *); 188extern void usbnet_skb_return (struct usbnet *, struct sk_buff *);
188extern void usbnet_unlink_rx_urbs(struct usbnet *); 189extern void usbnet_unlink_rx_urbs(struct usbnet *);
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index 11232676bfff..3656b300de3a 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -22,12 +22,12 @@ struct old_utsname {
22}; 22};
23 23
24struct new_utsname { 24struct new_utsname {
25 char sysname[65]; 25 char sysname[__NEW_UTS_LEN + 1];
26 char nodename[65]; 26 char nodename[__NEW_UTS_LEN + 1];
27 char release[65]; 27 char release[__NEW_UTS_LEN + 1];
28 char version[65]; 28 char version[__NEW_UTS_LEN + 1];
29 char machine[65]; 29 char machine[__NEW_UTS_LEN + 1];
30 char domainname[65]; 30 char domainname[__NEW_UTS_LEN + 1];
31}; 31};
32 32
33#ifdef __KERNEL__ 33#ifdef __KERNEL__
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index ebb2ea6b4995..8a025d510904 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -347,7 +347,9 @@ struct v4l2_pix_format {
347#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* 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 */ 348#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
349#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 */
350#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 */
351#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */
352#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */
351 353
352/* 354/*
353 * F O R M A T E N U M E R A T I O N 355 * F O R M A T E N U M E R A T I O N
@@ -893,9 +895,10 @@ enum v4l2_colorfx {
893 V4L2_COLORFX_BW = 1, 895 V4L2_COLORFX_BW = 1,
894 V4L2_COLORFX_SEPIA = 2, 896 V4L2_COLORFX_SEPIA = 2,
895}; 897};
898#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
896 899
897/* last CID + 1 */ 900/* last CID + 1 */
898#define V4L2_CID_LASTP1 (V4L2_CID_BASE+32) 901#define V4L2_CID_LASTP1 (V4L2_CID_BASE+33)
899 902
900/* MPEG-class control IDs defined by V4L2 */ 903/* MPEG-class control IDs defined by V4L2 */
901#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 904#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 06005fa9e982..4fca4f5440ba 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -10,14 +10,17 @@
10 10
11/** 11/**
12 * virtqueue - a queue to register buffers for sending or receiving. 12 * virtqueue - a queue to register buffers for sending or receiving.
13 * @list: the chain of virtqueues for this device
13 * @callback: the function to call when buffers are consumed (can be NULL). 14 * @callback: the function to call when buffers are consumed (can be NULL).
15 * @name: the name of this virtqueue (mainly for debugging)
14 * @vdev: the virtio device this queue was created for. 16 * @vdev: the virtio device this queue was created for.
15 * @vq_ops: the operations for this virtqueue (see below). 17 * @vq_ops: the operations for this virtqueue (see below).
16 * @priv: a pointer for the virtqueue implementation to use. 18 * @priv: a pointer for the virtqueue implementation to use.
17 */ 19 */
18struct virtqueue 20struct virtqueue {
19{ 21 struct list_head list;
20 void (*callback)(struct virtqueue *vq); 22 void (*callback)(struct virtqueue *vq);
23 const char *name;
21 struct virtio_device *vdev; 24 struct virtio_device *vdev;
22 struct virtqueue_ops *vq_ops; 25 struct virtqueue_ops *vq_ops;
23 void *priv; 26 void *priv;
@@ -76,15 +79,16 @@ struct virtqueue_ops {
76 * @dev: underlying device. 79 * @dev: underlying device.
77 * @id: the device type identification (used to match it with a driver). 80 * @id: the device type identification (used to match it with a driver).
78 * @config: the configuration ops for this device. 81 * @config: the configuration ops for this device.
82 * @vqs: the list of virtqueues for this device.
79 * @features: the features supported by both driver and device. 83 * @features: the features supported by both driver and device.
80 * @priv: private pointer for the driver's use. 84 * @priv: private pointer for the driver's use.
81 */ 85 */
82struct virtio_device 86struct virtio_device {
83{
84 int index; 87 int index;
85 struct device dev; 88 struct device dev;
86 struct virtio_device_id id; 89 struct virtio_device_id id;
87 struct virtio_config_ops *config; 90 struct virtio_config_ops *config;
91 struct list_head vqs;
88 /* Note that this is a Linux set_bit-style bitmap. */ 92 /* Note that this is a Linux set_bit-style bitmap. */
89 unsigned long features[1]; 93 unsigned long features[1];
90 void *priv; 94 void *priv;
@@ -99,8 +103,7 @@ void unregister_virtio_device(struct virtio_device *dev);
99 * @id_table: the ids serviced by this driver. 103 * @id_table: the ids serviced by this driver.
100 * @feature_table: an array of feature numbers supported by this device. 104 * @feature_table: an array of feature numbers supported by this device.
101 * @feature_table_size: number of entries in the feature table array. 105 * @feature_table_size: number of entries in the feature table array.
102 * @probe: the function to call when a device is found. Returns a token for 106 * @probe: the function to call when a device is found. Returns 0 or -errno.
103 * remove, or PTR_ERR().
104 * @remove: the function when a device is removed. 107 * @remove: the function when a device is removed.
105 * @config_changed: optional function to call when the device configuration 108 * @config_changed: optional function to call when the device configuration
106 * changes; may be called in interrupt context. 109 * changes; may be called in interrupt context.
diff --git a/include/linux/virtio_blk.h b/include/linux/virtio_blk.h
index 94c56d29869d..be7d255fc7cf 100644
--- a/include/linux/virtio_blk.h
+++ b/include/linux/virtio_blk.h
@@ -15,6 +15,10 @@
15#define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */ 15#define VIRTIO_BLK_F_GEOMETRY 4 /* Legacy geometry available */
16#define VIRTIO_BLK_F_RO 5 /* Disk is read-only */ 16#define VIRTIO_BLK_F_RO 5 /* Disk is read-only */
17#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/ 17#define VIRTIO_BLK_F_BLK_SIZE 6 /* Block size of disk is available*/
18#define VIRTIO_BLK_F_SCSI 7 /* Supports scsi command passthru */
19#define VIRTIO_BLK_F_IDENTIFY 8 /* ATA IDENTIFY supported */
20
21#define VIRTIO_BLK_ID_BYTES (sizeof(__u16[256])) /* IDENTIFY DATA */
18 22
19struct virtio_blk_config 23struct virtio_blk_config
20{ 24{
@@ -32,6 +36,7 @@ struct virtio_blk_config
32 } geometry; 36 } geometry;
33 /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ 37 /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */
34 __u32 blk_size; 38 __u32 blk_size;
39 __u8 identify[VIRTIO_BLK_ID_BYTES];
35} __attribute__((packed)); 40} __attribute__((packed));
36 41
37/* These two define direction. */ 42/* These two define direction. */
@@ -55,6 +60,13 @@ struct virtio_blk_outhdr
55 __u64 sector; 60 __u64 sector;
56}; 61};
57 62
63struct virtio_scsi_inhdr {
64 __u32 errors;
65 __u32 data_len;
66 __u32 sense_len;
67 __u32 residual;
68};
69
58/* And this is the final byte of the write scatter-gather list. */ 70/* And this is the final byte of the write scatter-gather list. */
59#define VIRTIO_BLK_S_OK 0 71#define VIRTIO_BLK_S_OK 0
60#define VIRTIO_BLK_S_IOERR 1 72#define VIRTIO_BLK_S_IOERR 1
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index bf8ec283b232..99f514575f6a 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -29,6 +29,7 @@
29#define VIRTIO_F_NOTIFY_ON_EMPTY 24 29#define VIRTIO_F_NOTIFY_ON_EMPTY 24
30 30
31#ifdef __KERNEL__ 31#ifdef __KERNEL__
32#include <linux/err.h>
32#include <linux/virtio.h> 33#include <linux/virtio.h>
33 34
34/** 35/**
@@ -49,15 +50,26 @@
49 * @set_status: write the status byte 50 * @set_status: write the status byte
50 * vdev: the virtio_device 51 * vdev: the virtio_device
51 * status: the new status byte 52 * status: the new status byte
53 * @request_vqs: request the specified number of virtqueues
54 * vdev: the virtio_device
55 * max_vqs: the max number of virtqueues we want
56 * If supplied, must call before any virtqueues are instantiated.
57 * To modify the max number of virtqueues after request_vqs has been
58 * called, call free_vqs and then request_vqs with a new value.
59 * @free_vqs: cleanup resources allocated by request_vqs
60 * vdev: the virtio_device
61 * If supplied, must call after all virtqueues have been deleted.
52 * @reset: reset the device 62 * @reset: reset the device
53 * vdev: the virtio device 63 * vdev: the virtio device
54 * After this, status and feature negotiation must be done again 64 * After this, status and feature negotiation must be done again
55 * @find_vq: find a virtqueue and instantiate it. 65 * @find_vqs: find virtqueues and instantiate them.
56 * vdev: the virtio_device 66 * vdev: the virtio_device
57 * index: the 0-based virtqueue number in case there's more than one. 67 * nvqs: the number of virtqueues to find
58 * callback: the virqtueue callback 68 * vqs: on success, includes new virtqueues
59 * Returns the new virtqueue or ERR_PTR() (eg. -ENOENT). 69 * callbacks: array of callbacks, for each virtqueue
60 * @del_vq: free a virtqueue found by find_vq(). 70 * names: array of virtqueue names (mainly for debugging)
71 * Returns 0 on success or error status
72 * @del_vqs: free virtqueues found by find_vqs().
61 * @get_features: get the array of feature bits for this device. 73 * @get_features: get the array of feature bits for this device.
62 * vdev: the virtio_device 74 * vdev: the virtio_device
63 * Returns the first 32 feature bits (all we currently need). 75 * Returns the first 32 feature bits (all we currently need).
@@ -66,6 +78,7 @@
66 * This gives the final feature bits for the device: it can change 78 * This gives the final feature bits for the device: it can change
67 * the dev->feature bits if it wants. 79 * the dev->feature bits if it wants.
68 */ 80 */
81typedef void vq_callback_t(struct virtqueue *);
69struct virtio_config_ops 82struct virtio_config_ops
70{ 83{
71 void (*get)(struct virtio_device *vdev, unsigned offset, 84 void (*get)(struct virtio_device *vdev, unsigned offset,
@@ -75,10 +88,11 @@ struct virtio_config_ops
75 u8 (*get_status)(struct virtio_device *vdev); 88 u8 (*get_status)(struct virtio_device *vdev);
76 void (*set_status)(struct virtio_device *vdev, u8 status); 89 void (*set_status)(struct virtio_device *vdev, u8 status);
77 void (*reset)(struct virtio_device *vdev); 90 void (*reset)(struct virtio_device *vdev);
78 struct virtqueue *(*find_vq)(struct virtio_device *vdev, 91 int (*find_vqs)(struct virtio_device *, unsigned nvqs,
79 unsigned index, 92 struct virtqueue *vqs[],
80 void (*callback)(struct virtqueue *)); 93 vq_callback_t *callbacks[],
81 void (*del_vq)(struct virtqueue *vq); 94 const char *names[]);
95 void (*del_vqs)(struct virtio_device *);
82 u32 (*get_features)(struct virtio_device *vdev); 96 u32 (*get_features)(struct virtio_device *vdev);
83 void (*finalize_features)(struct virtio_device *vdev); 97 void (*finalize_features)(struct virtio_device *vdev);
84}; 98};
@@ -99,7 +113,9 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev,
99 if (__builtin_constant_p(fbit)) 113 if (__builtin_constant_p(fbit))
100 BUILD_BUG_ON(fbit >= 32); 114 BUILD_BUG_ON(fbit >= 32);
101 115
102 virtio_check_driver_offered_feature(vdev, fbit); 116 if (fbit < VIRTIO_TRANSPORT_F_START)
117 virtio_check_driver_offered_feature(vdev, fbit);
118
103 return test_bit(fbit, vdev->features); 119 return test_bit(fbit, vdev->features);
104} 120}
105 121
@@ -126,5 +142,18 @@ static inline int virtio_config_buf(struct virtio_device *vdev,
126 vdev->config->get(vdev, offset, buf, len); 142 vdev->config->get(vdev, offset, buf, len);
127 return 0; 143 return 0;
128} 144}
145
146static inline
147struct virtqueue *virtio_find_single_vq(struct virtio_device *vdev,
148 vq_callback_t *c, const char *n)
149{
150 vq_callback_t *callbacks[] = { c };
151 const char *names[] = { n };
152 struct virtqueue *vq;
153 int err = vdev->config->find_vqs(vdev, 1, &vq, callbacks, names);
154 if (err < 0)
155 return ERR_PTR(err);
156 return vq;
157}
129#endif /* __KERNEL__ */ 158#endif /* __KERNEL__ */
130#endif /* _LINUX_VIRTIO_CONFIG_H */ 159#endif /* _LINUX_VIRTIO_CONFIG_H */
diff --git a/include/linux/virtio_pci.h b/include/linux/virtio_pci.h
index cd0fd5d181a6..9a3d7c48c622 100644
--- a/include/linux/virtio_pci.h
+++ b/include/linux/virtio_pci.h
@@ -47,9 +47,17 @@
47/* The bit of the ISR which indicates a device configuration change. */ 47/* The bit of the ISR which indicates a device configuration change. */
48#define VIRTIO_PCI_ISR_CONFIG 0x2 48#define VIRTIO_PCI_ISR_CONFIG 0x2
49 49
50/* MSI-X registers: only enabled if MSI-X is enabled. */
51/* A 16-bit vector for configuration changes. */
52#define VIRTIO_MSI_CONFIG_VECTOR 20
53/* A 16-bit vector for selected queue notifications. */
54#define VIRTIO_MSI_QUEUE_VECTOR 22
55/* Vector value used to disable MSI for queue */
56#define VIRTIO_MSI_NO_VECTOR 0xffff
57
50/* The remaining space is defined by each driver as the per-driver 58/* The remaining space is defined by each driver as the per-driver
51 * configuration space */ 59 * configuration space */
52#define VIRTIO_PCI_CONFIG 20 60#define VIRTIO_PCI_CONFIG(dev) ((dev)->msix_enabled ? 24 : 20)
53 61
54/* Virtio ABI version, this must match exactly */ 62/* Virtio ABI version, this must match exactly */
55#define VIRTIO_PCI_ABI_VERSION 0 63#define VIRTIO_PCI_ABI_VERSION 0
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index 71e03722fb59..693e0ec5afa6 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -14,6 +14,8 @@
14#define VRING_DESC_F_NEXT 1 14#define VRING_DESC_F_NEXT 1
15/* This marks a buffer as write-only (otherwise read-only). */ 15/* This marks a buffer as write-only (otherwise read-only). */
16#define VRING_DESC_F_WRITE 2 16#define VRING_DESC_F_WRITE 2
17/* This means the buffer contains a list of buffer descriptors. */
18#define VRING_DESC_F_INDIRECT 4
17 19
18/* The Host uses this in used->flags to advise the Guest: don't kick me when 20/* The Host uses this in used->flags to advise the Guest: don't kick me when
19 * you add a buffer. It's unreliable, so it's simply an optimization. Guest 21 * you add a buffer. It's unreliable, so it's simply an optimization. Guest
@@ -24,6 +26,9 @@
24 * optimization. */ 26 * optimization. */
25#define VRING_AVAIL_F_NO_INTERRUPT 1 27#define VRING_AVAIL_F_NO_INTERRUPT 1
26 28
29/* We support indirect buffer descriptors */
30#define VIRTIO_RING_F_INDIRECT_DESC 28
31
27/* Virtio ring descriptors: 16 bytes. These can chain together via "next". */ 32/* Virtio ring descriptors: 16 bytes. These can chain together via "next". */
28struct vring_desc 33struct vring_desc
29{ 34{
@@ -119,7 +124,8 @@ struct virtqueue *vring_new_virtqueue(unsigned int num,
119 struct virtio_device *vdev, 124 struct virtio_device *vdev,
120 void *pages, 125 void *pages,
121 void (*notify)(struct virtqueue *vq), 126 void (*notify)(struct virtqueue *vq),
122 void (*callback)(struct virtqueue *vq)); 127 void (*callback)(struct virtqueue *vq),
128 const char *name);
123void vring_del_virtqueue(struct virtqueue *vq); 129void vring_del_virtqueue(struct virtqueue *vq);
124/* Filter out transport-specific feature bits. */ 130/* Filter out transport-specific feature bits. */
125void vring_transport_features(struct virtio_device *vdev); 131void vring_transport_features(struct virtio_device *vdev);
diff --git a/include/linux/vlynq.h b/include/linux/vlynq.h
new file mode 100644
index 000000000000..8f6a95882b09
--- /dev/null
+++ b/include/linux/vlynq.h
@@ -0,0 +1,161 @@
1/*
2 * Copyright (C) 2006, 2007 Eugene Konev <ejka@openwrt.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef __VLYNQ_H__
20#define __VLYNQ_H__
21
22#include <linux/device.h>
23#include <linux/module.h>
24#include <linux/types.h>
25
26#define VLYNQ_NUM_IRQS 32
27
28struct vlynq_mapping {
29 u32 size;
30 u32 offset;
31};
32
33enum vlynq_divisor {
34 vlynq_div_auto = 0,
35 vlynq_ldiv1,
36 vlynq_ldiv2,
37 vlynq_ldiv3,
38 vlynq_ldiv4,
39 vlynq_ldiv5,
40 vlynq_ldiv6,
41 vlynq_ldiv7,
42 vlynq_ldiv8,
43 vlynq_rdiv1,
44 vlynq_rdiv2,
45 vlynq_rdiv3,
46 vlynq_rdiv4,
47 vlynq_rdiv5,
48 vlynq_rdiv6,
49 vlynq_rdiv7,
50 vlynq_rdiv8,
51 vlynq_div_external
52};
53
54struct vlynq_device_id {
55 u32 id;
56 enum vlynq_divisor divisor;
57 unsigned long driver_data;
58};
59
60struct vlynq_regs;
61struct vlynq_device {
62 u32 id, dev_id;
63 int local_irq;
64 int remote_irq;
65 enum vlynq_divisor divisor;
66 u32 regs_start, regs_end;
67 u32 mem_start, mem_end;
68 u32 irq_start, irq_end;
69 int irq;
70 int enabled;
71 struct vlynq_regs *local;
72 struct vlynq_regs *remote;
73 struct device dev;
74};
75
76struct vlynq_driver {
77 char *name;
78 struct vlynq_device_id *id_table;
79 int (*probe)(struct vlynq_device *dev, struct vlynq_device_id *id);
80 void (*remove)(struct vlynq_device *dev);
81 struct device_driver driver;
82};
83
84struct plat_vlynq_ops {
85 int (*on)(struct vlynq_device *dev);
86 void (*off)(struct vlynq_device *dev);
87};
88
89static inline struct vlynq_driver *to_vlynq_driver(struct device_driver *drv)
90{
91 return container_of(drv, struct vlynq_driver, driver);
92}
93
94static inline struct vlynq_device *to_vlynq_device(struct device *device)
95{
96 return container_of(device, struct vlynq_device, dev);
97}
98
99extern struct bus_type vlynq_bus_type;
100
101extern int __vlynq_register_driver(struct vlynq_driver *driver,
102 struct module *owner);
103
104static inline int vlynq_register_driver(struct vlynq_driver *driver)
105{
106 return __vlynq_register_driver(driver, THIS_MODULE);
107}
108
109static inline void *vlynq_get_drvdata(struct vlynq_device *dev)
110{
111 return dev_get_drvdata(&dev->dev);
112}
113
114static inline void vlynq_set_drvdata(struct vlynq_device *dev, void *data)
115{
116 dev_set_drvdata(&dev->dev, data);
117}
118
119static inline u32 vlynq_mem_start(struct vlynq_device *dev)
120{
121 return dev->mem_start;
122}
123
124static inline u32 vlynq_mem_end(struct vlynq_device *dev)
125{
126 return dev->mem_end;
127}
128
129static inline u32 vlynq_mem_len(struct vlynq_device *dev)
130{
131 return dev->mem_end - dev->mem_start + 1;
132}
133
134static inline int vlynq_virq_to_irq(struct vlynq_device *dev, int virq)
135{
136 int irq = dev->irq_start + virq;
137 if ((irq < dev->irq_start) || (irq > dev->irq_end))
138 return -EINVAL;
139
140 return irq;
141}
142
143static inline int vlynq_irq_to_virq(struct vlynq_device *dev, int irq)
144{
145 if ((irq < dev->irq_start) || (irq > dev->irq_end))
146 return -EINVAL;
147
148 return irq - dev->irq_start;
149}
150
151extern void vlynq_unregister_driver(struct vlynq_driver *driver);
152extern int vlynq_enable_device(struct vlynq_device *dev);
153extern void vlynq_disable_device(struct vlynq_device *dev);
154extern int vlynq_set_local_mapping(struct vlynq_device *dev, u32 tx_offset,
155 struct vlynq_mapping *mapping);
156extern int vlynq_set_remote_mapping(struct vlynq_device *dev, u32 tx_offset,
157 struct vlynq_mapping *mapping);
158extern int vlynq_set_local_irq(struct vlynq_device *dev, int virq);
159extern int vlynq_set_remote_irq(struct vlynq_device *dev, int virq);
160
161#endif /* __VLYNQ_H__ */
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 524cd1b28ecb..81a97cf8f0a0 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -36,12 +36,14 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
36 FOR_ALL_ZONES(PGSTEAL), 36 FOR_ALL_ZONES(PGSTEAL),
37 FOR_ALL_ZONES(PGSCAN_KSWAPD), 37 FOR_ALL_ZONES(PGSCAN_KSWAPD),
38 FOR_ALL_ZONES(PGSCAN_DIRECT), 38 FOR_ALL_ZONES(PGSCAN_DIRECT),
39#ifdef CONFIG_NUMA
40 PGSCAN_ZONE_RECLAIM_FAILED,
41#endif
39 PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL, 42 PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL,
40 PAGEOUTRUN, ALLOCSTALL, PGROTATED, 43 PAGEOUTRUN, ALLOCSTALL, PGROTATED,
41#ifdef CONFIG_HUGETLB_PAGE 44#ifdef CONFIG_HUGETLB_PAGE
42 HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL, 45 HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL,
43#endif 46#endif
44#ifdef CONFIG_UNEVICTABLE_LRU
45 UNEVICTABLE_PGCULLED, /* culled to noreclaim list */ 47 UNEVICTABLE_PGCULLED, /* culled to noreclaim list */
46 UNEVICTABLE_PGSCANNED, /* scanned for reclaimability */ 48 UNEVICTABLE_PGSCANNED, /* scanned for reclaimability */
47 UNEVICTABLE_PGRESCUED, /* rescued from noreclaim list */ 49 UNEVICTABLE_PGRESCUED, /* rescued from noreclaim list */
@@ -50,7 +52,6 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
50 UNEVICTABLE_PGCLEARED, /* on COW, page truncate */ 52 UNEVICTABLE_PGCLEARED, /* on COW, page truncate */
51 UNEVICTABLE_PGSTRANDED, /* unable to isolate on unlock */ 53 UNEVICTABLE_PGSTRANDED, /* unable to isolate on unlock */
52 UNEVICTABLE_MLOCKFREED, 54 UNEVICTABLE_MLOCKFREED,
53#endif
54 NR_VM_EVENT_ITEMS 55 NR_VM_EVENT_ITEMS
55}; 56};
56 57
diff --git a/include/linux/w1-gpio.h b/include/linux/w1-gpio.h
index 9797fec7748a..3adeff82212f 100644
--- a/include/linux/w1-gpio.h
+++ b/include/linux/w1-gpio.h
@@ -18,6 +18,7 @@
18struct w1_gpio_platform_data { 18struct w1_gpio_platform_data {
19 unsigned int pin; 19 unsigned int pin;
20 unsigned int is_open_drain:1; 20 unsigned int is_open_drain:1;
21 void (*enable_external_pullup)(int enable);
21}; 22};
22 23
23#endif /* _LINUX_W1_GPIO_H */ 24#endif /* _LINUX_W1_GPIO_H */
diff --git a/include/linux/wait.h b/include/linux/wait.h
index bc024632f365..6788e1a4d4ca 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -132,8 +132,6 @@ static inline void __remove_wait_queue(wait_queue_head_t *head,
132 list_del(&old->task_list); 132 list_del(&old->task_list);
133} 133}
134 134
135void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
136 int nr_exclusive, int sync, void *key);
137void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); 135void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
138void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); 136void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key);
139void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, 137void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr,
diff --git a/include/linux/wimax.h b/include/linux/wimax.h
index c89de7f4e5b9..4fdcc5635518 100644
--- a/include/linux/wimax.h
+++ b/include/linux/wimax.h
@@ -59,7 +59,7 @@ enum {
59 * M - Major: change if removing or modifying an existing call. 59 * M - Major: change if removing or modifying an existing call.
60 * m - minor: change when adding a new call 60 * m - minor: change when adding a new call
61 */ 61 */
62 WIMAX_GNL_VERSION = 00, 62 WIMAX_GNL_VERSION = 01,
63 /* Generic NetLink attributes */ 63 /* Generic NetLink attributes */
64 WIMAX_GNL_ATTR_INVALID = 0x00, 64 WIMAX_GNL_ATTR_INVALID = 0x00,
65 WIMAX_GNL_ATTR_MAX = 10, 65 WIMAX_GNL_ATTR_MAX = 10,
@@ -78,6 +78,7 @@ enum {
78 WIMAX_GNL_OP_RFKILL, /* Run wimax_rfkill() */ 78 WIMAX_GNL_OP_RFKILL, /* Run wimax_rfkill() */
79 WIMAX_GNL_OP_RESET, /* Run wimax_rfkill() */ 79 WIMAX_GNL_OP_RESET, /* Run wimax_rfkill() */
80 WIMAX_GNL_RE_STATE_CHANGE, /* Report: status change */ 80 WIMAX_GNL_RE_STATE_CHANGE, /* Report: status change */
81 WIMAX_GNL_OP_STATE_GET, /* Request for current state */
81}; 82};
82 83
83 84
@@ -113,6 +114,10 @@ enum {
113 WIMAX_GNL_RESET_IFIDX = 1, 114 WIMAX_GNL_RESET_IFIDX = 1,
114}; 115};
115 116
117/* Atributes for wimax_state_get() */
118enum {
119 WIMAX_GNL_STGET_IFIDX = 1,
120};
116 121
117/* 122/*
118 * Attributes for the Report State Change 123 * Attributes for the Report State Change
diff --git a/include/linux/wimax/i2400m.h b/include/linux/wimax/i2400m.h
index d5148a7889a6..433693ef2bb0 100644
--- a/include/linux/wimax/i2400m.h
+++ b/include/linux/wimax/i2400m.h
@@ -266,7 +266,7 @@ enum i2400m_ro_type {
266 266
267/* Misc constants */ 267/* Misc constants */
268enum { 268enum {
269 I2400M_PL_PAD = 16, /* Payload data size alignment */ 269 I2400M_PL_ALIGN = 16, /* Payload data size alignment */
270 I2400M_PL_SIZE_MAX = 0x3EFF, 270 I2400M_PL_SIZE_MAX = 0x3EFF,
271 I2400M_MAX_PLS_IN_MSG = 60, 271 I2400M_MAX_PLS_IN_MSG = 60,
272 /* protocol barkers: sync sequences; for notifications they 272 /* protocol barkers: sync sequences; for notifications they
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 93445477f86a..3224820c8514 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -79,7 +79,6 @@ struct writeback_control {
79void writeback_inodes(struct writeback_control *wbc); 79void writeback_inodes(struct writeback_control *wbc);
80int inode_wait(void *); 80int inode_wait(void *);
81void sync_inodes_sb(struct super_block *, int wait); 81void sync_inodes_sb(struct super_block *, int wait);
82void sync_inodes(int wait);
83 82
84/* writeback.h requires fs.h; it, too, is not included from here. */ 83/* writeback.h requires fs.h; it, too, is not included from here. */
85static inline void wait_on_inode(struct inode *inode) 84static inline void wait_on_inode(struct inode *inode)
diff --git a/include/media/adv7343.h b/include/media/adv7343.h
new file mode 100644
index 000000000000..d6f8a4e1a1fc
--- /dev/null
+++ b/include/media/adv7343.h
@@ -0,0 +1,23 @@
1/*
2 * ADV7343 header file
3 *
4 * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.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 as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed .as is. WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef ADV7343_H
17#define ADV7343_H
18
19#define ADV7343_COMPOSITE_ID (0)
20#define ADV7343_COMPONENT_ID (1)
21#define ADV7343_SVIDEO_ID (2)
22
23#endif /* End of #ifndef ADV7343_H */
diff --git a/include/media/ir-common.h b/include/media/ir-common.h
index 7b5b91f60425..9dcb632f6083 100644
--- a/include/media/ir-common.h
+++ b/include/media/ir-common.h
@@ -162,6 +162,8 @@ extern IR_KEYTAB_TYPE ir_codes_ati_tv_wonder_hd_600[IR_KEYTAB_SIZE];
162extern 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]; 163extern IR_KEYTAB_TYPE ir_codes_kaiomy[IR_KEYTAB_SIZE];
164extern IR_KEYTAB_TYPE ir_codes_dm1105_nec[IR_KEYTAB_SIZE]; 164extern IR_KEYTAB_TYPE ir_codes_dm1105_nec[IR_KEYTAB_SIZE];
165extern IR_KEYTAB_TYPE ir_codes_evga_indtube[IR_KEYTAB_SIZE];
166
165#endif 167#endif
166 168
167/* 169/*
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h
index 07963d705400..3ad4ed5402fb 100644
--- a/include/media/ir-kbd-i2c.h
+++ b/include/media/ir-kbd-i2c.h
@@ -7,7 +7,7 @@ struct IR_i2c;
7 7
8struct IR_i2c { 8struct IR_i2c {
9 IR_KEYTAB_TYPE *ir_codes; 9 IR_KEYTAB_TYPE *ir_codes;
10 struct i2c_client c; 10 struct i2c_client *c;
11 struct input_dev *input; 11 struct input_dev *input;
12 struct ir_input_state ir; 12 struct ir_input_state ir;
13 13
@@ -15,7 +15,15 @@ struct IR_i2c {
15 unsigned char old; 15 unsigned char old;
16 16
17 struct delayed_work work; 17 struct delayed_work work;
18 char name[32];
18 char phys[32]; 19 char phys[32];
19 int (*get_key)(struct IR_i2c*, u32*, u32*); 20 int (*get_key)(struct IR_i2c*, u32*, u32*);
20}; 21};
22
23/* Can be passed when instantiating an ir_video i2c device */
24struct IR_i2c_init_data {
25 IR_KEYTAB_TYPE *ir_codes;
26 const char *name;
27 int (*get_key)(struct IR_i2c*, u32*, u32*);
28};
21#endif 29#endif
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 37013688af44..23ecead35e7a 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -60,7 +60,7 @@ struct soc_camera_file {
60 60
61struct soc_camera_host { 61struct soc_camera_host {
62 struct list_head list; 62 struct list_head list;
63 struct device dev; 63 struct device *dev;
64 unsigned char nr; /* Host number */ 64 unsigned char nr; /* Host number */
65 void *priv; 65 void *priv;
66 const char *drv_name; 66 const char *drv_name;
@@ -92,11 +92,16 @@ struct soc_camera_host_ops {
92#define SOCAM_SENSOR_INVERT_VSYNC (1 << 3) 92#define SOCAM_SENSOR_INVERT_VSYNC (1 << 3)
93#define SOCAM_SENSOR_INVERT_DATA (1 << 4) 93#define SOCAM_SENSOR_INVERT_DATA (1 << 4)
94 94
95struct i2c_board_info;
96
95struct soc_camera_link { 97struct soc_camera_link {
96 /* Camera bus id, used to match a camera and a bus */ 98 /* Camera bus id, used to match a camera and a bus */
97 int bus_id; 99 int bus_id;
98 /* Per camera SOCAM_SENSOR_* bus flags */ 100 /* Per camera SOCAM_SENSOR_* bus flags */
99 unsigned long flags; 101 unsigned long flags;
102 int i2c_adapter_id;
103 struct i2c_board_info *board_info;
104 const char *module_name;
100 /* Optional callbacks to power on or off and reset the sensor */ 105 /* Optional callbacks to power on or off and reset the sensor */
101 int (*power)(struct device *, int); 106 int (*power)(struct device *, int);
102 int (*reset)(struct device *); 107 int (*reset)(struct device *);
@@ -107,6 +112,7 @@ struct soc_camera_link {
107 */ 112 */
108 int (*set_bus_param)(struct soc_camera_link *, unsigned long flags); 113 int (*set_bus_param)(struct soc_camera_link *, unsigned long flags);
109 unsigned long (*query_bus_param)(struct soc_camera_link *); 114 unsigned long (*query_bus_param)(struct soc_camera_link *);
115 void (*free_bus)(struct soc_camera_link *);
110}; 116};
111 117
112static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev) 118static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev)
@@ -116,7 +122,7 @@ static inline struct soc_camera_device *to_soc_camera_dev(struct device *dev)
116 122
117static inline struct soc_camera_host *to_soc_camera_host(struct device *dev) 123static inline struct soc_camera_host *to_soc_camera_host(struct device *dev)
118{ 124{
119 return container_of(dev, struct soc_camera_host, dev); 125 return dev_get_drvdata(dev);
120} 126}
121 127
122extern int soc_camera_host_register(struct soc_camera_host *ici); 128extern int soc_camera_host_register(struct soc_camera_host *ici);
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 7d4e2db78076..cbf97f45fbec 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -124,6 +124,8 @@
124#define TUNER_XC5000 76 /* Xceive Silicon Tuner */ 124#define TUNER_XC5000 76 /* Xceive Silicon Tuner */
125#define TUNER_TCL_MF02GIP_5N 77 /* TCL MF02GIP_5N */ 125#define TUNER_TCL_MF02GIP_5N 77 /* TCL MF02GIP_5N */
126#define TUNER_PHILIPS_FMD1216MEX_MK3 78 126#define TUNER_PHILIPS_FMD1216MEX_MK3 78
127#define TUNER_PHILIPS_FM1216MK5 79
128#define TUNER_PHILIPS_FQ1216LME_MK3 80 /* Active loopthrough, no FM */
127 129
128/* tv card specific */ 130/* tv card specific */
129#define TDA9887_PRESENT (1<<0) 131#define TDA9887_PRESENT (1<<0)
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 1be461a29077..4d7e2272c42f 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -137,6 +137,12 @@ enum {
137 /* module saa7191: just ident 7191 */ 137 /* module saa7191: just ident 7191 */
138 V4L2_IDENT_SAA7191 = 7191, 138 V4L2_IDENT_SAA7191 = 7191,
139 139
140 /* module ths7303: just ident 7303 */
141 V4L2_IDENT_THS7303 = 7303,
142
143 /* module adv7343: just ident 7343 */
144 V4L2_IDENT_ADV7343 = 7343,
145
140 /* module wm8739: just ident 8739 */ 146 /* module wm8739: just ident 8739 */
141 V4L2_IDENT_WM8739 = 8739, 147 V4L2_IDENT_WM8739 = 8739,
142 148
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index c48c24e4d0fa..33a18426ab9b 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -153,6 +153,22 @@ struct v4l2_subdev *v4l2_i2c_new_probed_subdev(struct v4l2_device *v4l2_dev,
153struct v4l2_subdev *v4l2_i2c_new_probed_subdev_addr(struct v4l2_device *v4l2_dev, 153struct v4l2_subdev *v4l2_i2c_new_probed_subdev_addr(struct v4l2_device *v4l2_dev,
154 struct i2c_adapter *adapter, 154 struct i2c_adapter *adapter,
155 const char *module_name, const char *client_type, u8 addr); 155 const char *module_name, const char *client_type, u8 addr);
156
157/* Load an i2c module and return an initialized v4l2_subdev struct.
158 Only call request_module if module_name != NULL.
159 The client_type argument is the name of the chip that's on the adapter. */
160struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev,
161 struct i2c_adapter *adapter,
162 const char *module_name, const char *client_type,
163 int irq, void *platform_data,
164 u8 addr, const unsigned short *probe_addrs);
165
166struct i2c_board_info;
167
168struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev,
169 struct i2c_adapter *adapter, const char *module_name,
170 struct i2c_board_info *info, const unsigned short *probe_addrs);
171
156/* Initialize an v4l2_subdev with data from an i2c_client struct */ 172/* Initialize an v4l2_subdev with data from an i2c_client struct */
157void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client, 173void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client,
158 const struct v4l2_subdev_ops *ops); 174 const struct v4l2_subdev_ops *ops);
@@ -193,4 +209,14 @@ struct v4l2_routing {
193 u32 output; 209 u32 output;
194}; 210};
195 211
212/* ------------------------------------------------------------------------- */
213
214/* Miscellaneous helper functions */
215
216void v4l_bound_align_image(unsigned int *w, unsigned int wmin,
217 unsigned int wmax, unsigned int walign,
218 unsigned int *h, unsigned int hmin,
219 unsigned int hmax, unsigned int halign,
220 unsigned int salign);
221
196#endif /* V4L2_COMMON_H_ */ 222#endif /* V4L2_COMMON_H_ */
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index 0dd3e8e8653e..5d5d550e63ad 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -30,7 +30,7 @@
30 basic V4L2 device-level support. 30 basic V4L2 device-level support.
31 */ 31 */
32 32
33#define V4L2_DEVICE_NAME_SIZE (BUS_ID_SIZE + 16) 33#define V4L2_DEVICE_NAME_SIZE (20 + 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.
@@ -53,10 +53,31 @@ struct v4l2_device {
53 dev may be NULL in rare cases (ISA devices). In that case you 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. */ 54 must fill in the v4l2_dev->name field before calling this function. */
55int __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);
56
57/* Optional function to initialize the name field of struct v4l2_device using
58 the driver name and a driver-global atomic_t instance.
59 This function will increment the instance counter and returns the instance
60 value used in the name.
61
62 Example:
63
64 static atomic_t drv_instance = ATOMIC_INIT(0);
65
66 ...
67
68 instance = v4l2_device_set_name(&v4l2_dev, "foo", &drv_instance);
69
70 The first time this is called the name field will be set to foo0 and
71 this function returns 0. If the name ends with a digit (e.g. cx18),
72 then the name will be set to cx18-0 since cx180 looks really odd. */
73int v4l2_device_set_name(struct v4l2_device *v4l2_dev, const char *basename,
74 atomic_t *instance);
75
56/* Set v4l2_dev->dev to NULL. Call when the USB parent disconnects. 76/* 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 77 Since the parent disappears this ensures that v4l2_dev doesn't have an
58 invalid parent pointer. */ 78 invalid parent pointer. */
59void v4l2_device_disconnect(struct v4l2_device *v4l2_dev); 79void v4l2_device_disconnect(struct v4l2_device *v4l2_dev);
80
60/* Unregister all sub-devices and any other resources related to v4l2_dev. */ 81/* Unregister all sub-devices and any other resources related to v4l2_dev. */
61void v4l2_device_unregister(struct v4l2_device *v4l2_dev); 82void v4l2_device_unregister(struct v4l2_device *v4l2_dev);
62 83
diff --git a/include/media/v4l2-i2c-drv.h b/include/media/v4l2-i2c-drv.h
index 10a2882c3cbf..74bf741d1a9b 100644
--- a/include/media/v4l2-i2c-drv.h
+++ b/include/media/v4l2-i2c-drv.h
@@ -22,7 +22,7 @@
22 */ 22 */
23 23
24/* NOTE: the full version of this header is in the v4l-dvb repository 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. 25 * and allows v4l i2c drivers to be compiled on pre-2.6.26 kernels.
26 * The version of this header as it appears in the kernel is a stripped 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 27 * version (without all the backwards compatibility stuff) and so it
28 * looks a bit odd. 28 * looks a bit odd.
@@ -30,6 +30,9 @@
30 * If you look at the full version then you will understand the reason 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 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. 32 * the tricky backwards compatibility code in each and every i2c driver.
33 *
34 * If the i2c driver will never be compiled for pre-2.6.26 kernels, then
35 * DO NOT USE this header! Just write it as a regular i2c driver.
33 */ 36 */
34 37
35#ifndef __V4L2_I2C_DRV_H__ 38#ifndef __V4L2_I2C_DRV_H__
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 17856081c809..5dcb36785529 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -79,7 +79,11 @@ struct v4l2_decode_vbi_line {
79 not yet implemented) since ops provide proper type-checking. 79 not yet implemented) since ops provide proper type-checking.
80 */ 80 */
81 81
82/* init: initialize the sensor registors to some sort of reasonable default 82/* s_config: if set, then it is always called by the v4l2_i2c_new_subdev*
83 functions after the v4l2_subdev was registered. It is used to pass
84 platform data to the subdev which can be used during initialization.
85
86 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 87 values. Do not use for new drivers and should be removed in existing
84 drivers. 88 drivers.
85 89
@@ -96,6 +100,7 @@ struct v4l2_decode_vbi_line {
96struct v4l2_subdev_core_ops { 100struct v4l2_subdev_core_ops {
97 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); 101 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip);
98 int (*log_status)(struct v4l2_subdev *sd); 102 int (*log_status)(struct v4l2_subdev *sd);
103 int (*s_config)(struct v4l2_subdev *sd, int irq, void *platform_data);
99 int (*init)(struct v4l2_subdev *sd, u32 val); 104 int (*init)(struct v4l2_subdev *sd, u32 val);
100 int (*load_fw)(struct v4l2_subdev *sd); 105 int (*load_fw)(struct v4l2_subdev *sd);
101 int (*reset)(struct v4l2_subdev *sd, u32 val); 106 int (*reset)(struct v4l2_subdev *sd, u32 val);
@@ -230,12 +235,16 @@ struct v4l2_subdev_ops {
230 235
231#define V4L2_SUBDEV_NAME_SIZE 32 236#define V4L2_SUBDEV_NAME_SIZE 32
232 237
238/* Set this flag if this subdev is a i2c device. */
239#define V4L2_SUBDEV_FL_IS_I2C (1U << 0)
240
233/* Each instance of a subdev driver should create this struct, either 241/* Each instance of a subdev driver should create this struct, either
234 stand-alone or embedded in a larger struct. 242 stand-alone or embedded in a larger struct.
235 */ 243 */
236struct v4l2_subdev { 244struct v4l2_subdev {
237 struct list_head list; 245 struct list_head list;
238 struct module *owner; 246 struct module *owner;
247 u32 flags;
239 struct v4l2_device *v4l2_dev; 248 struct v4l2_device *v4l2_dev;
240 const struct v4l2_subdev_ops *ops; 249 const struct v4l2_subdev_ops *ops;
241 /* name must be unique */ 250 /* name must be unique */
@@ -264,6 +273,7 @@ static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
264 BUG_ON(!ops || !ops->core); 273 BUG_ON(!ops || !ops->core);
265 sd->ops = ops; 274 sd->ops = ops;
266 sd->v4l2_dev = NULL; 275 sd->v4l2_dev = NULL;
276 sd->flags = 0;
267 sd->name[0] = '\0'; 277 sd->name[0] = '\0';
268 sd->grp_id = 0; 278 sd->grp_id = 0;
269 sd->priv = NULL; 279 sd->priv = NULL;
diff --git a/include/mtd/Kbuild b/include/mtd/Kbuild
index 8eb018f96002..192f8fb7d546 100644
--- a/include/mtd/Kbuild
+++ b/include/mtd/Kbuild
@@ -1,5 +1,4 @@
1header-y += inftl-user.h 1header-y += inftl-user.h
2header-y += jffs2-user.h
3header-y += mtd-abi.h 2header-y += mtd-abi.h
4header-y += mtd-user.h 3header-y += mtd-user.h
5header-y += nftl-user.h 4header-y += nftl-user.h
diff --git a/include/mtd/jffs2-user.h b/include/mtd/jffs2-user.h
deleted file mode 100644
index fa94b0eb67c1..000000000000
--- a/include/mtd/jffs2-user.h
+++ /dev/null
@@ -1,34 +0,0 @@
1/*
2 * JFFS2 definitions for use in user space only
3 */
4
5#ifndef __JFFS2_USER_H__
6#define __JFFS2_USER_H__
7
8/* This file is blessed for inclusion by userspace */
9#include <linux/jffs2.h>
10#include <linux/types.h>
11#include <endian.h>
12#include <byteswap.h>
13
14#undef cpu_to_je16
15#undef cpu_to_je32
16#undef cpu_to_jemode
17#undef je16_to_cpu
18#undef je32_to_cpu
19#undef jemode_to_cpu
20
21extern int target_endian;
22
23#define t16(x) ({ __u16 __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_16(__b); })
24#define t32(x) ({ __u32 __b = (x); (target_endian==__BYTE_ORDER)?__b:bswap_32(__b); })
25
26#define cpu_to_je16(x) ((jint16_t){t16(x)})
27#define cpu_to_je32(x) ((jint32_t){t32(x)})
28#define cpu_to_jemode(x) ((jmode_t){t32(x)})
29
30#define je16_to_cpu(x) (t16((x).v16))
31#define je32_to_cpu(x) (t32((x).v32))
32#define jemode_to_cpu(x) (t32((x).m))
33
34#endif /* __JFFS2_USER_H__ */
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index b6595b3c68b6..be51ae2bd0ff 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -12,12 +12,24 @@ struct erase_info_user {
12 __u32 length; 12 __u32 length;
13}; 13};
14 14
15struct erase_info_user64 {
16 __u64 start;
17 __u64 length;
18};
19
15struct mtd_oob_buf { 20struct mtd_oob_buf {
16 __u32 start; 21 __u32 start;
17 __u32 length; 22 __u32 length;
18 unsigned char __user *ptr; 23 unsigned char __user *ptr;
19}; 24};
20 25
26struct mtd_oob_buf64 {
27 __u64 start;
28 __u32 pad;
29 __u32 length;
30 __u64 usr_ptr;
31};
32
21#define MTD_ABSENT 0 33#define MTD_ABSENT 0
22#define MTD_RAM 1 34#define MTD_RAM 1
23#define MTD_ROM 2 35#define MTD_ROM 2
@@ -95,6 +107,9 @@ struct otp_info {
95#define ECCGETLAYOUT _IOR('M', 17, struct nand_ecclayout) 107#define ECCGETLAYOUT _IOR('M', 17, struct nand_ecclayout)
96#define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats) 108#define ECCGETSTATS _IOR('M', 18, struct mtd_ecc_stats)
97#define MTDFILEMODE _IO('M', 19) 109#define MTDFILEMODE _IO('M', 19)
110#define MEMERASE64 _IOW('M', 20, struct erase_info_user64)
111#define MEMWRITEOOB64 _IOWR('M', 21, struct mtd_oob_buf64)
112#define MEMREADOOB64 _IOWR('M', 22, struct mtd_oob_buf64)
98 113
99/* 114/*
100 * Obsolete legacy interface. Keep it in order not to break userspace 115 * Obsolete legacy interface. Keep it in order not to break userspace
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 3ad5390a4dd5..968166a45f86 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -81,12 +81,6 @@ enum {
81 BT_CLOSED 81 BT_CLOSED
82}; 82};
83 83
84/* Endianness conversions */
85#define htobs(a) __cpu_to_le16(a)
86#define htobl(a) __cpu_to_le32(a)
87#define btohs(a) __le16_to_cpu(a)
88#define btohl(a) __le32_to_cpu(a)
89
90/* BD Address */ 84/* BD Address */
91typedef struct { 85typedef struct {
92 __u8 b[6]; 86 __u8 b[6];
@@ -171,15 +165,6 @@ static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, unsigned long l
171 return skb; 165 return skb;
172} 166}
173 167
174static inline int skb_frags_no(struct sk_buff *skb)
175{
176 register struct sk_buff *frag = skb_shinfo(skb)->frag_list;
177 register int n = 1;
178
179 for (; frag; frag=frag->next, n++);
180 return n;
181}
182
183int bt_err(__u16 code); 168int bt_err(__u16 code);
184 169
185extern int hci_sock_init(void); 170extern int hci_sock_init(void);
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 73aead222b32..c4ca4228b083 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -137,6 +137,8 @@ struct hci_dev {
137 struct device *parent; 137 struct device *parent;
138 struct device dev; 138 struct device dev;
139 139
140 struct rfkill *rfkill;
141
140 struct module *owner; 142 struct module *owner;
141 143
142 int (*open)(struct hci_dev *hdev); 144 int (*open)(struct hci_dev *hdev);
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index f566aa1f0a4c..e919fca1072a 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -26,8 +26,13 @@
26#define __L2CAP_H 26#define __L2CAP_H
27 27
28/* L2CAP defaults */ 28/* L2CAP defaults */
29#define L2CAP_DEFAULT_MTU 672 29#define L2CAP_DEFAULT_MTU 672
30#define L2CAP_DEFAULT_FLUSH_TO 0xFFFF 30#define L2CAP_DEFAULT_FLUSH_TO 0xffff
31#define L2CAP_DEFAULT_RX_WINDOW 1
32#define L2CAP_DEFAULT_MAX_RECEIVE 1
33#define L2CAP_DEFAULT_RETRANS_TO 300 /* 300 milliseconds */
34#define L2CAP_DEFAULT_MONITOR_TO 1000 /* 1 second */
35#define L2CAP_DEFAULT_MAX_RX_APDU 0xfff7
31 36
32#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */ 37#define L2CAP_CONN_TIMEOUT (40000) /* 40 seconds */
33#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */ 38#define L2CAP_INFO_TIMEOUT (4000) /* 4 seconds */
@@ -64,17 +69,29 @@ struct l2cap_conninfo {
64#define L2CAP_LM_SECURE 0x0020 69#define L2CAP_LM_SECURE 0x0020
65 70
66/* L2CAP command codes */ 71/* L2CAP command codes */
67#define L2CAP_COMMAND_REJ 0x01 72#define L2CAP_COMMAND_REJ 0x01
68#define L2CAP_CONN_REQ 0x02 73#define L2CAP_CONN_REQ 0x02
69#define L2CAP_CONN_RSP 0x03 74#define L2CAP_CONN_RSP 0x03
70#define L2CAP_CONF_REQ 0x04 75#define L2CAP_CONF_REQ 0x04
71#define L2CAP_CONF_RSP 0x05 76#define L2CAP_CONF_RSP 0x05
72#define L2CAP_DISCONN_REQ 0x06 77#define L2CAP_DISCONN_REQ 0x06
73#define L2CAP_DISCONN_RSP 0x07 78#define L2CAP_DISCONN_RSP 0x07
74#define L2CAP_ECHO_REQ 0x08 79#define L2CAP_ECHO_REQ 0x08
75#define L2CAP_ECHO_RSP 0x09 80#define L2CAP_ECHO_RSP 0x09
76#define L2CAP_INFO_REQ 0x0a 81#define L2CAP_INFO_REQ 0x0a
77#define L2CAP_INFO_RSP 0x0b 82#define L2CAP_INFO_RSP 0x0b
83
84/* L2CAP feature mask */
85#define L2CAP_FEAT_FLOWCTL 0x00000001
86#define L2CAP_FEAT_RETRANS 0x00000002
87#define L2CAP_FEAT_ERTM 0x00000008
88#define L2CAP_FEAT_STREAMING 0x00000010
89#define L2CAP_FEAT_FCS 0x00000020
90#define L2CAP_FEAT_FIXED_CHAN 0x00000080
91
92/* L2CAP checksum option */
93#define L2CAP_FCS_NONE 0x00
94#define L2CAP_FCS_CRC16 0x01
78 95
79/* L2CAP structures */ 96/* L2CAP structures */
80struct l2cap_hdr { 97struct l2cap_hdr {
@@ -106,17 +123,23 @@ struct l2cap_conn_rsp {
106 __le16 status; 123 __le16 status;
107} __attribute__ ((packed)); 124} __attribute__ ((packed));
108 125
126/* channel indentifier */
127#define L2CAP_CID_SIGNALING 0x0001
128#define L2CAP_CID_CONN_LESS 0x0002
129#define L2CAP_CID_DYN_START 0x0040
130#define L2CAP_CID_DYN_END 0xffff
131
109/* connect result */ 132/* connect result */
110#define L2CAP_CR_SUCCESS 0x0000 133#define L2CAP_CR_SUCCESS 0x0000
111#define L2CAP_CR_PEND 0x0001 134#define L2CAP_CR_PEND 0x0001
112#define L2CAP_CR_BAD_PSM 0x0002 135#define L2CAP_CR_BAD_PSM 0x0002
113#define L2CAP_CR_SEC_BLOCK 0x0003 136#define L2CAP_CR_SEC_BLOCK 0x0003
114#define L2CAP_CR_NO_MEM 0x0004 137#define L2CAP_CR_NO_MEM 0x0004
115 138
116/* connect status */ 139/* connect status */
117#define L2CAP_CS_NO_INFO 0x0000 140#define L2CAP_CS_NO_INFO 0x0000
118#define L2CAP_CS_AUTHEN_PEND 0x0001 141#define L2CAP_CS_AUTHEN_PEND 0x0001
119#define L2CAP_CS_AUTHOR_PEND 0x0002 142#define L2CAP_CS_AUTHOR_PEND 0x0002
120 143
121struct l2cap_conf_req { 144struct l2cap_conf_req {
122 __le16 dcid; 145 __le16 dcid;
@@ -143,10 +166,14 @@ struct l2cap_conf_opt {
143} __attribute__ ((packed)); 166} __attribute__ ((packed));
144#define L2CAP_CONF_OPT_SIZE 2 167#define L2CAP_CONF_OPT_SIZE 2
145 168
169#define L2CAP_CONF_HINT 0x80
170#define L2CAP_CONF_MASK 0x7f
171
146#define L2CAP_CONF_MTU 0x01 172#define L2CAP_CONF_MTU 0x01
147#define L2CAP_CONF_FLUSH_TO 0x02 173#define L2CAP_CONF_FLUSH_TO 0x02
148#define L2CAP_CONF_QOS 0x03 174#define L2CAP_CONF_QOS 0x03
149#define L2CAP_CONF_RFC 0x04 175#define L2CAP_CONF_RFC 0x04
176#define L2CAP_CONF_FCS 0x05
150 177
151#define L2CAP_CONF_MAX_SIZE 22 178#define L2CAP_CONF_MAX_SIZE 22
152 179
@@ -162,6 +189,8 @@ struct l2cap_conf_rfc {
162#define L2CAP_MODE_BASIC 0x00 189#define L2CAP_MODE_BASIC 0x00
163#define L2CAP_MODE_RETRANS 0x01 190#define L2CAP_MODE_RETRANS 0x01
164#define L2CAP_MODE_FLOWCTL 0x02 191#define L2CAP_MODE_FLOWCTL 0x02
192#define L2CAP_MODE_ERTM 0x03
193#define L2CAP_MODE_STREAM 0x04
165 194
166struct l2cap_disconn_req { 195struct l2cap_disconn_req {
167 __le16 dcid; 196 __le16 dcid;
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 5389afdc1297..1a21895b732b 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1,71 +1,220 @@
1#ifndef __NET_CFG80211_H 1#ifndef __NET_CFG80211_H
2#define __NET_CFG80211_H 2#define __NET_CFG80211_H
3/*
4 * 802.11 device and configuration interface
5 *
6 * Copyright 2006-2009 Johannes Berg <johannes@sipsolutions.net>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
3 12
13#include <linux/netdevice.h>
14#include <linux/debugfs.h>
15#include <linux/list.h>
4#include <linux/netlink.h> 16#include <linux/netlink.h>
5#include <linux/skbuff.h> 17#include <linux/skbuff.h>
6#include <linux/nl80211.h> 18#include <linux/nl80211.h>
7#include <linux/if_ether.h> 19#include <linux/if_ether.h>
8#include <linux/ieee80211.h> 20#include <linux/ieee80211.h>
9#include <linux/wireless.h> 21#include <net/regulatory.h>
10#include <net/iw_handler.h> 22
11#include <net/genetlink.h>
12/* remove once we remove the wext stuff */ 23/* remove once we remove the wext stuff */
13#include <net/iw_handler.h> 24#include <net/iw_handler.h>
25#include <linux/wireless.h>
26
14 27
15/* 28/*
16 * 802.11 configuration in-kernel interface 29 * wireless hardware capability structures
30 */
31
32/**
33 * enum ieee80211_band - supported frequency bands
34 *
35 * The bands are assigned this way because the supported
36 * bitrates differ in these bands.
17 * 37 *
18 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> 38 * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
39 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
19 */ 40 */
41enum ieee80211_band {
42 IEEE80211_BAND_2GHZ,
43 IEEE80211_BAND_5GHZ,
44
45 /* keep last */
46 IEEE80211_NUM_BANDS
47};
20 48
21/** 49/**
22 * struct vif_params - describes virtual interface parameters 50 * enum ieee80211_channel_flags - channel flags
23 * @mesh_id: mesh ID to use 51 *
24 * @mesh_id_len: length of the mesh ID 52 * Channel flags set by the regulatory control code.
53 *
54 * @IEEE80211_CHAN_DISABLED: This channel is disabled.
55 * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted
56 * on this channel.
57 * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
58 * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
59 * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
60 * is not permitted.
61 * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
62 * is not permitted.
25 */ 63 */
26struct vif_params { 64enum ieee80211_channel_flags {
27 u8 *mesh_id; 65 IEEE80211_CHAN_DISABLED = 1<<0,
28 int mesh_id_len; 66 IEEE80211_CHAN_PASSIVE_SCAN = 1<<1,
67 IEEE80211_CHAN_NO_IBSS = 1<<2,
68 IEEE80211_CHAN_RADAR = 1<<3,
69 IEEE80211_CHAN_NO_HT40PLUS = 1<<4,
70 IEEE80211_CHAN_NO_HT40MINUS = 1<<5,
29}; 71};
30 72
31/* Radiotap header iteration 73#define IEEE80211_CHAN_NO_HT40 \
32 * implemented in net/wireless/radiotap.c 74 (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
33 * docs in Documentation/networking/radiotap-headers.txt 75
76/**
77 * struct ieee80211_channel - channel definition
78 *
79 * This structure describes a single channel for use
80 * with cfg80211.
81 *
82 * @center_freq: center frequency in MHz
83 * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz
84 * @hw_value: hardware-specific value for the channel
85 * @flags: channel flags from &enum ieee80211_channel_flags.
86 * @orig_flags: channel flags at registration time, used by regulatory
87 * code to support devices with additional restrictions
88 * @band: band this channel belongs to.
89 * @max_antenna_gain: maximum antenna gain in dBi
90 * @max_power: maximum transmission power (in dBm)
91 * @beacon_found: helper to regulatory code to indicate when a beacon
92 * has been found on this channel. Use regulatory_hint_found_beacon()
93 * to enable this, this is is useful only on 5 GHz band.
94 * @orig_mag: internal use
95 * @orig_mpwr: internal use
34 */ 96 */
97struct ieee80211_channel {
98 enum ieee80211_band band;
99 u16 center_freq;
100 u8 max_bandwidth;
101 u16 hw_value;
102 u32 flags;
103 int max_antenna_gain;
104 int max_power;
105 bool beacon_found;
106 u32 orig_flags;
107 int orig_mag, orig_mpwr;
108};
109
35/** 110/**
36 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args 111 * enum ieee80211_rate_flags - rate flags
37 * @rtheader: pointer to the radiotap header we are walking through 112 *
38 * @max_length: length of radiotap header in cpu byte ordering 113 * Hardware/specification flags for rates. These are structured
39 * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg 114 * in a way that allows using the same bitrate structure for
40 * @this_arg: pointer to current radiotap arg 115 * different bands/PHY modes.
41 * @arg_index: internal next argument index 116 *
42 * @arg: internal next argument pointer 117 * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
43 * @next_bitmap: internal pointer to next present u32 118 * preamble on this bitrate; only relevant in 2.4GHz band and
44 * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present 119 * with CCK rates.
120 * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
121 * when used with 802.11a (on the 5 GHz band); filled by the
122 * core code when registering the wiphy.
123 * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
124 * when used with 802.11b (on the 2.4 GHz band); filled by the
125 * core code when registering the wiphy.
126 * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
127 * when used with 802.11g (on the 2.4 GHz band); filled by the
128 * core code when registering the wiphy.
129 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
45 */ 130 */
131enum ieee80211_rate_flags {
132 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
133 IEEE80211_RATE_MANDATORY_A = 1<<1,
134 IEEE80211_RATE_MANDATORY_B = 1<<2,
135 IEEE80211_RATE_MANDATORY_G = 1<<3,
136 IEEE80211_RATE_ERP_G = 1<<4,
137};
46 138
47struct ieee80211_radiotap_iterator { 139/**
48 struct ieee80211_radiotap_header *rtheader; 140 * struct ieee80211_rate - bitrate definition
49 int max_length; 141 *
50 int this_arg_index; 142 * This structure describes a bitrate that an 802.11 PHY can
51 u8 *this_arg; 143 * operate with. The two values @hw_value and @hw_value_short
144 * are only for driver use when pointers to this structure are
145 * passed around.
146 *
147 * @flags: rate-specific flags
148 * @bitrate: bitrate in units of 100 Kbps
149 * @hw_value: driver/hardware value for this rate
150 * @hw_value_short: driver/hardware value for this rate when
151 * short preamble is used
152 */
153struct ieee80211_rate {
154 u32 flags;
155 u16 bitrate;
156 u16 hw_value, hw_value_short;
157};
52 158
53 int arg_index; 159/**
54 u8 *arg; 160 * struct ieee80211_sta_ht_cap - STA's HT capabilities
55 __le32 *next_bitmap; 161 *
56 u32 bitmap_shifter; 162 * This structure describes most essential parameters needed
163 * to describe 802.11n HT capabilities for an STA.
164 *
165 * @ht_supported: is HT supported by the STA
166 * @cap: HT capabilities map as described in 802.11n spec
167 * @ampdu_factor: Maximum A-MPDU length factor
168 * @ampdu_density: Minimum A-MPDU spacing
169 * @mcs: Supported MCS rates
170 */
171struct ieee80211_sta_ht_cap {
172 u16 cap; /* use IEEE80211_HT_CAP_ */
173 bool ht_supported;
174 u8 ampdu_factor;
175 u8 ampdu_density;
176 struct ieee80211_mcs_info mcs;
57}; 177};
58 178
59extern int ieee80211_radiotap_iterator_init( 179/**
60 struct ieee80211_radiotap_iterator *iterator, 180 * struct ieee80211_supported_band - frequency band definition
61 struct ieee80211_radiotap_header *radiotap_header, 181 *
62 int max_length); 182 * This structure describes a frequency band a wiphy
183 * is able to operate in.
184 *
185 * @channels: Array of channels the hardware can operate in
186 * in this band.
187 * @band: the band this structure represents
188 * @n_channels: Number of channels in @channels
189 * @bitrates: Array of bitrates the hardware can operate with
190 * in this band. Must be sorted to give a valid "supported
191 * rates" IE, i.e. CCK rates first, then OFDM.
192 * @n_bitrates: Number of bitrates in @bitrates
193 */
194struct ieee80211_supported_band {
195 struct ieee80211_channel *channels;
196 struct ieee80211_rate *bitrates;
197 enum ieee80211_band band;
198 int n_channels;
199 int n_bitrates;
200 struct ieee80211_sta_ht_cap ht_cap;
201};
63 202
64extern int ieee80211_radiotap_iterator_next( 203/*
65 struct ieee80211_radiotap_iterator *iterator); 204 * Wireless hardware/device configuration structures and methods
205 */
66 206
207/**
208 * struct vif_params - describes virtual interface parameters
209 * @mesh_id: mesh ID to use
210 * @mesh_id_len: length of the mesh ID
211 */
212struct vif_params {
213 u8 *mesh_id;
214 int mesh_id_len;
215};
67 216
68 /** 217/**
69 * struct key_params - key information 218 * struct key_params - key information
70 * 219 *
71 * Information about a key 220 * Information about a key
@@ -106,27 +255,6 @@ struct beacon_parameters {
106}; 255};
107 256
108/** 257/**
109 * enum station_flags - station flags
110 *
111 * Station capability flags. Note that these must be the bits
112 * according to the nl80211 flags.
113 *
114 * @STATION_FLAG_CHANGED: station flags were changed
115 * @STATION_FLAG_AUTHORIZED: station is authorized to send frames (802.1X)
116 * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames
117 * with short preambles
118 * @STATION_FLAG_WME: station is WME/QoS capable
119 * @STATION_FLAG_MFP: station uses management frame protection
120 */
121enum station_flags {
122 STATION_FLAG_CHANGED = 1<<0,
123 STATION_FLAG_AUTHORIZED = 1<<NL80211_STA_FLAG_AUTHORIZED,
124 STATION_FLAG_SHORT_PREAMBLE = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE,
125 STATION_FLAG_WME = 1<<NL80211_STA_FLAG_WME,
126 STATION_FLAG_MFP = 1<<NL80211_STA_FLAG_MFP,
127};
128
129/**
130 * enum plink_action - actions to perform in mesh peers 258 * enum plink_action - actions to perform in mesh peers
131 * 259 *
132 * @PLINK_ACTION_INVALID: action 0 is reserved 260 * @PLINK_ACTION_INVALID: action 0 is reserved
@@ -148,14 +276,17 @@ enum plink_actions {
148 * @supported_rates: supported rates in IEEE 802.11 format 276 * @supported_rates: supported rates in IEEE 802.11 format
149 * (or NULL for no change) 277 * (or NULL for no change)
150 * @supported_rates_len: number of supported rates 278 * @supported_rates_len: number of supported rates
151 * @station_flags: station flags (see &enum station_flags) 279 * @sta_flags_mask: station flags that changed
280 * (bitmask of BIT(NL80211_STA_FLAG_...))
281 * @sta_flags_set: station flags values
282 * (bitmask of BIT(NL80211_STA_FLAG_...))
152 * @listen_interval: listen interval or -1 for no change 283 * @listen_interval: listen interval or -1 for no change
153 * @aid: AID or zero for no change 284 * @aid: AID or zero for no change
154 */ 285 */
155struct station_parameters { 286struct station_parameters {
156 u8 *supported_rates; 287 u8 *supported_rates;
157 struct net_device *vlan; 288 struct net_device *vlan;
158 u32 station_flags; 289 u32 sta_flags_mask, sta_flags_set;
159 int listen_interval; 290 int listen_interval;
160 u16 aid; 291 u16 aid;
161 u8 supported_rates_len; 292 u8 supported_rates_len;
@@ -348,92 +479,6 @@ struct bss_parameters {
348 u8 basic_rates_len; 479 u8 basic_rates_len;
349}; 480};
350 481
351/**
352 * enum environment_cap - Environment parsed from country IE
353 * @ENVIRON_ANY: indicates country IE applies to both indoor and
354 * outdoor operation.
355 * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
356 * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
357 */
358enum environment_cap {
359 ENVIRON_ANY,
360 ENVIRON_INDOOR,
361 ENVIRON_OUTDOOR,
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
387 */
388struct regulatory_request {
389 int wiphy_idx;
390 enum nl80211_reg_initiator initiator;
391 char alpha2[2];
392 bool intersect;
393 u32 country_ie_checksum;
394 enum environment_cap country_ie_env;
395 struct list_head list;
396};
397
398struct ieee80211_freq_range {
399 u32 start_freq_khz;
400 u32 end_freq_khz;
401 u32 max_bandwidth_khz;
402};
403
404struct ieee80211_power_rule {
405 u32 max_antenna_gain;
406 u32 max_eirp;
407};
408
409struct ieee80211_reg_rule {
410 struct ieee80211_freq_range freq_range;
411 struct ieee80211_power_rule power_rule;
412 u32 flags;
413};
414
415struct ieee80211_regdomain {
416 u32 n_reg_rules;
417 char alpha2[2];
418 struct ieee80211_reg_rule reg_rules[];
419};
420
421#define MHZ_TO_KHZ(freq) ((freq) * 1000)
422#define KHZ_TO_MHZ(freq) ((freq) / 1000)
423#define DBI_TO_MBI(gain) ((gain) * 100)
424#define MBI_TO_DBI(gain) ((gain) / 100)
425#define DBM_TO_MBM(gain) ((gain) * 100)
426#define MBM_TO_DBM(gain) ((gain) / 100)
427
428#define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \
429 .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
430 .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
431 .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
432 .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \
433 .power_rule.max_eirp = DBM_TO_MBM(eirp), \
434 .flags = reg_flags, \
435 }
436
437struct mesh_config { 482struct mesh_config {
438 /* Timeouts in ms */ 483 /* Timeouts in ms */
439 /* Mesh plink management parameters */ 484 /* Mesh plink management parameters */
@@ -504,7 +549,7 @@ struct cfg80211_scan_request {
504 int n_ssids; 549 int n_ssids;
505 struct ieee80211_channel **channels; 550 struct ieee80211_channel **channels;
506 u32 n_channels; 551 u32 n_channels;
507 u8 *ie; 552 const u8 *ie;
508 size_t ie_len; 553 size_t ie_len;
509 554
510 /* internal */ 555 /* internal */
@@ -612,6 +657,11 @@ struct cfg80211_auth_request {
612 * @ssid_len: Length of ssid in octets 657 * @ssid_len: Length of ssid in octets
613 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 658 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
614 * @ie_len: Length of ie buffer in octets 659 * @ie_len: Length of ie buffer in octets
660 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
661 * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
662 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
663 * required to assume that the port is unauthorized until authorized by
664 * user space. Otherwise, port is marked authorized by default.
615 */ 665 */
616struct cfg80211_assoc_request { 666struct cfg80211_assoc_request {
617 struct ieee80211_channel *chan; 667 struct ieee80211_channel *chan;
@@ -620,6 +670,8 @@ struct cfg80211_assoc_request {
620 size_t ssid_len; 670 size_t ssid_len;
621 const u8 *ie; 671 const u8 *ie;
622 size_t ie_len; 672 size_t ie_len;
673 bool use_mfp;
674 bool control_port;
623}; 675};
624 676
625/** 677/**
@@ -659,6 +711,60 @@ struct cfg80211_disassoc_request {
659}; 711};
660 712
661/** 713/**
714 * struct cfg80211_ibss_params - IBSS parameters
715 *
716 * This structure defines the IBSS parameters for the join_ibss()
717 * method.
718 *
719 * @ssid: The SSID, will always be non-null.
720 * @ssid_len: The length of the SSID, will always be non-zero.
721 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
722 * search for IBSSs with a different BSSID.
723 * @channel: The channel to use if no IBSS can be found to join.
724 * @channel_fixed: The channel should be fixed -- do not search for
725 * IBSSs to join on other channels.
726 * @ie: information element(s) to include in the beacon
727 * @ie_len: length of that
728 * @beacon_interval: beacon interval to use
729 */
730struct cfg80211_ibss_params {
731 u8 *ssid;
732 u8 *bssid;
733 struct ieee80211_channel *channel;
734 u8 *ie;
735 u8 ssid_len, ie_len;
736 u16 beacon_interval;
737 bool channel_fixed;
738};
739
740/**
741 * enum wiphy_params_flags - set_wiphy_params bitfield values
742 * WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
743 * WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
744 * WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
745 * WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
746 */
747enum wiphy_params_flags {
748 WIPHY_PARAM_RETRY_SHORT = 1 << 0,
749 WIPHY_PARAM_RETRY_LONG = 1 << 1,
750 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
751 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
752};
753
754/**
755 * enum tx_power_setting - TX power adjustment
756 *
757 * @TX_POWER_AUTOMATIC: the dbm parameter is ignored
758 * @TX_POWER_LIMITED: limit TX power by the dbm parameter
759 * @TX_POWER_FIXED: fix TX power to the dbm parameter
760 */
761enum tx_power_setting {
762 TX_POWER_AUTOMATIC,
763 TX_POWER_LIMITED,
764 TX_POWER_FIXED,
765};
766
767/**
662 * struct cfg80211_ops - backend description for wireless configuration 768 * struct cfg80211_ops - backend description for wireless configuration
663 * 769 *
664 * This struct is registered by fullmac card drivers and/or wireless stacks 770 * This struct is registered by fullmac card drivers and/or wireless stacks
@@ -688,10 +794,11 @@ struct cfg80211_disassoc_request {
688 * @get_key: get information about the key with the given parameters. 794 * @get_key: get information about the key with the given parameters.
689 * @mac_addr will be %NULL when requesting information for a group 795 * @mac_addr will be %NULL when requesting information for a group
690 * key. All pointers given to the @callback function need not be valid 796 * key. All pointers given to the @callback function need not be valid
691 * after it returns. 797 * after it returns. This function should return an error if it is
798 * not possible to retrieve the key, -ENOENT if it doesn't exist.
692 * 799 *
693 * @del_key: remove a key given the @mac_addr (%NULL for a group key) 800 * @del_key: remove a key given the @mac_addr (%NULL for a group key)
694 * and @key_index 801 * and @key_index, return -ENOENT if the key doesn't exist.
695 * 802 *
696 * @set_default_key: set the default key on an interface 803 * @set_default_key: set the default key on an interface
697 * 804 *
@@ -733,6 +840,23 @@ struct cfg80211_disassoc_request {
733 * @assoc: Request to (re)associate with the specified peer 840 * @assoc: Request to (re)associate with the specified peer
734 * @deauth: Request to deauthenticate from the specified peer 841 * @deauth: Request to deauthenticate from the specified peer
735 * @disassoc: Request to disassociate from the specified peer 842 * @disassoc: Request to disassociate from the specified peer
843 *
844 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
845 * cfg80211_ibss_joined(), also call that function when changing BSSID due
846 * to a merge.
847 * @leave_ibss: Leave the IBSS.
848 *
849 * @set_wiphy_params: Notify that wiphy parameters have changed;
850 * @changed bitfield (see &enum wiphy_params_flags) describes which values
851 * have changed. The actual parameter values are available in
852 * struct wiphy. If returning an error, no value should be changed.
853 *
854 * @set_tx_power: set the transmit power according to the parameters
855 * @get_tx_power: store the current TX power into the dbm variable;
856 * return 0 if successful
857 *
858 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
859 * functions to adjust rfkill hw state
736 */ 860 */
737struct cfg80211_ops { 861struct cfg80211_ops {
738 int (*suspend)(struct wiphy *wiphy); 862 int (*suspend)(struct wiphy *wiphy);
@@ -747,13 +871,13 @@ struct cfg80211_ops {
747 struct vif_params *params); 871 struct vif_params *params);
748 872
749 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 873 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
750 u8 key_index, u8 *mac_addr, 874 u8 key_index, const u8 *mac_addr,
751 struct key_params *params); 875 struct key_params *params);
752 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 876 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
753 u8 key_index, u8 *mac_addr, void *cookie, 877 u8 key_index, const u8 *mac_addr, void *cookie,
754 void (*callback)(void *cookie, struct key_params*)); 878 void (*callback)(void *cookie, struct key_params*));
755 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 879 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
756 u8 key_index, u8 *mac_addr); 880 u8 key_index, const u8 *mac_addr);
757 int (*set_default_key)(struct wiphy *wiphy, 881 int (*set_default_key)(struct wiphy *wiphy,
758 struct net_device *netdev, 882 struct net_device *netdev,
759 u8 key_index); 883 u8 key_index);
@@ -818,9 +942,473 @@ struct cfg80211_ops {
818 struct cfg80211_deauth_request *req); 942 struct cfg80211_deauth_request *req);
819 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, 943 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
820 struct cfg80211_disassoc_request *req); 944 struct cfg80211_disassoc_request *req);
945
946 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
947 struct cfg80211_ibss_params *params);
948 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
949
950 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
951
952 int (*set_tx_power)(struct wiphy *wiphy,
953 enum tx_power_setting type, int dbm);
954 int (*get_tx_power)(struct wiphy *wiphy, int *dbm);
955
956 void (*rfkill_poll)(struct wiphy *wiphy);
821}; 957};
822 958
823/* temporary wext handlers */ 959/*
960 * wireless hardware and networking interfaces structures
961 * and registration/helper functions
962 */
963
964/**
965 * struct wiphy - wireless hardware description
966 * @idx: the wiphy index assigned to this item
967 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
968 * @custom_regulatory: tells us the driver for this device
969 * has its own custom regulatory domain and cannot identify the
970 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled
971 * we will disregard the first regulatory hint (when the
972 * initiator is %REGDOM_SET_BY_CORE).
973 * @strict_regulatory: tells us the driver for this device will ignore
974 * regulatory domain settings until it gets its own regulatory domain
975 * via its regulatory_hint(). After its gets its own regulatory domain
976 * it will only allow further regulatory domain settings to further
977 * enhance compliance. For example if channel 13 and 14 are disabled
978 * by this regulatory domain no user regulatory domain can enable these
979 * channels at a later time. This can be used for devices which do not
980 * have calibration information gauranteed for frequencies or settings
981 * outside of its regulatory domain.
982 * @reg_notifier: the driver's regulatory notification callback
983 * @regd: the driver's regulatory domain, if one was requested via
984 * the regulatory_hint() API. This can be used by the driver
985 * on the reg_notifier() if it chooses to ignore future
986 * regulatory domain changes caused by other drivers.
987 * @signal_type: signal type reported in &struct cfg80211_bss.
988 * @cipher_suites: supported cipher suites
989 * @n_cipher_suites: number of supported cipher suites
990 * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
991 * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
992 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
993 * -1 = fragmentation disabled, only odd values >= 256 used
994 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
995 */
996struct wiphy {
997 /* assign these fields before you register the wiphy */
998
999 /* permanent MAC address */
1000 u8 perm_addr[ETH_ALEN];
1001
1002 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
1003 u16 interface_modes;
1004
1005 bool custom_regulatory;
1006 bool strict_regulatory;
1007
1008 enum cfg80211_signal_type signal_type;
1009
1010 int bss_priv_size;
1011 u8 max_scan_ssids;
1012 u16 max_scan_ie_len;
1013
1014 int n_cipher_suites;
1015 const u32 *cipher_suites;
1016
1017 u8 retry_short;
1018 u8 retry_long;
1019 u32 frag_threshold;
1020 u32 rts_threshold;
1021
1022 /* If multiple wiphys are registered and you're handed e.g.
1023 * a regular netdev with assigned ieee80211_ptr, you won't
1024 * know whether it points to a wiphy your driver has registered
1025 * or not. Assign this to something global to your driver to
1026 * help determine whether you own this wiphy or not. */
1027 const void *privid;
1028
1029 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
1030
1031 /* Lets us get back the wiphy on the callback */
1032 int (*reg_notifier)(struct wiphy *wiphy,
1033 struct regulatory_request *request);
1034
1035 /* fields below are read-only, assigned by cfg80211 */
1036
1037 const struct ieee80211_regdomain *regd;
1038
1039 /* the item in /sys/class/ieee80211/ points to this,
1040 * you need use set_wiphy_dev() (see below) */
1041 struct device dev;
1042
1043 /* dir in debugfs: ieee80211/<wiphyname> */
1044 struct dentry *debugfsdir;
1045
1046 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
1047};
1048
1049/**
1050 * wiphy_priv - return priv from wiphy
1051 *
1052 * @wiphy: the wiphy whose priv pointer to return
1053 */
1054static inline void *wiphy_priv(struct wiphy *wiphy)
1055{
1056 BUG_ON(!wiphy);
1057 return &wiphy->priv;
1058}
1059
1060/**
1061 * set_wiphy_dev - set device pointer for wiphy
1062 *
1063 * @wiphy: The wiphy whose device to bind
1064 * @dev: The device to parent it to
1065 */
1066static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
1067{
1068 wiphy->dev.parent = dev;
1069}
1070
1071/**
1072 * wiphy_dev - get wiphy dev pointer
1073 *
1074 * @wiphy: The wiphy whose device struct to look up
1075 */
1076static inline struct device *wiphy_dev(struct wiphy *wiphy)
1077{
1078 return wiphy->dev.parent;
1079}
1080
1081/**
1082 * wiphy_name - get wiphy name
1083 *
1084 * @wiphy: The wiphy whose name to return
1085 */
1086static inline const char *wiphy_name(struct wiphy *wiphy)
1087{
1088 return dev_name(&wiphy->dev);
1089}
1090
1091/**
1092 * wiphy_new - create a new wiphy for use with cfg80211
1093 *
1094 * @ops: The configuration operations for this device
1095 * @sizeof_priv: The size of the private area to allocate
1096 *
1097 * Create a new wiphy and associate the given operations with it.
1098 * @sizeof_priv bytes are allocated for private use.
1099 *
1100 * The returned pointer must be assigned to each netdev's
1101 * ieee80211_ptr for proper operation.
1102 */
1103struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv);
1104
1105/**
1106 * wiphy_register - register a wiphy with cfg80211
1107 *
1108 * @wiphy: The wiphy to register.
1109 *
1110 * Returns a non-negative wiphy index or a negative error code.
1111 */
1112extern int wiphy_register(struct wiphy *wiphy);
1113
1114/**
1115 * wiphy_unregister - deregister a wiphy from cfg80211
1116 *
1117 * @wiphy: The wiphy to unregister.
1118 *
1119 * After this call, no more requests can be made with this priv
1120 * pointer, but the call may sleep to wait for an outstanding
1121 * request that is being handled.
1122 */
1123extern void wiphy_unregister(struct wiphy *wiphy);
1124
1125/**
1126 * wiphy_free - free wiphy
1127 *
1128 * @wiphy: The wiphy to free
1129 */
1130extern void wiphy_free(struct wiphy *wiphy);
1131
1132/**
1133 * struct wireless_dev - wireless per-netdev state
1134 *
1135 * This structure must be allocated by the driver/stack
1136 * that uses the ieee80211_ptr field in struct net_device
1137 * (this is intentional so it can be allocated along with
1138 * the netdev.)
1139 *
1140 * @wiphy: pointer to hardware description
1141 * @iftype: interface type
1142 * @list: (private) Used to collect the interfaces
1143 * @netdev: (private) Used to reference back to the netdev
1144 * @current_bss: (private) Used by the internal configuration code
1145 * @bssid: (private) Used by the internal configuration code
1146 * @ssid: (private) Used by the internal configuration code
1147 * @ssid_len: (private) Used by the internal configuration code
1148 * @wext: (private) Used by the internal wireless extensions compat code
1149 * @wext_bssid: (private) Used by the internal wireless extensions compat code
1150 */
1151struct wireless_dev {
1152 struct wiphy *wiphy;
1153 enum nl80211_iftype iftype;
1154
1155 /* private to the generic wireless code */
1156 struct list_head list;
1157 struct net_device *netdev;
1158
1159 /* currently used for IBSS - might be rearranged in the future */
1160 struct cfg80211_bss *current_bss;
1161 u8 bssid[ETH_ALEN];
1162 u8 ssid[IEEE80211_MAX_SSID_LEN];
1163 u8 ssid_len;
1164
1165#ifdef CONFIG_WIRELESS_EXT
1166 /* wext data */
1167 struct {
1168 struct cfg80211_ibss_params ibss;
1169 u8 bssid[ETH_ALEN];
1170 s8 default_key, default_mgmt_key;
1171 } wext;
1172#endif
1173};
1174
1175/**
1176 * wdev_priv - return wiphy priv from wireless_dev
1177 *
1178 * @wdev: The wireless device whose wiphy's priv pointer to return
1179 */
1180static inline void *wdev_priv(struct wireless_dev *wdev)
1181{
1182 BUG_ON(!wdev);
1183 return wiphy_priv(wdev->wiphy);
1184}
1185
1186/*
1187 * Utility functions
1188 */
1189
1190/**
1191 * ieee80211_channel_to_frequency - convert channel number to frequency
1192 */
1193extern int ieee80211_channel_to_frequency(int chan);
1194
1195/**
1196 * ieee80211_frequency_to_channel - convert frequency to channel number
1197 */
1198extern int ieee80211_frequency_to_channel(int freq);
1199
1200/*
1201 * Name indirection necessary because the ieee80211 code also has
1202 * a function named "ieee80211_get_channel", so if you include
1203 * cfg80211's header file you get cfg80211's version, if you try
1204 * to include both header files you'll (rightfully!) get a symbol
1205 * clash.
1206 */
1207extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
1208 int freq);
1209/**
1210 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
1211 */
1212static inline struct ieee80211_channel *
1213ieee80211_get_channel(struct wiphy *wiphy, int freq)
1214{
1215 return __ieee80211_get_channel(wiphy, freq);
1216}
1217
1218/**
1219 * ieee80211_get_response_rate - get basic rate for a given rate
1220 *
1221 * @sband: the band to look for rates in
1222 * @basic_rates: bitmap of basic rates
1223 * @bitrate: the bitrate for which to find the basic rate
1224 *
1225 * This function returns the basic rate corresponding to a given
1226 * bitrate, that is the next lower bitrate contained in the basic
1227 * rate map, which is, for this function, given as a bitmap of
1228 * indices of rates in the band's bitrate table.
1229 */
1230struct ieee80211_rate *
1231ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
1232 u32 basic_rates, int bitrate);
1233
1234/*
1235 * Radiotap parsing functions -- for controlled injection support
1236 *
1237 * Implemented in net/wireless/radiotap.c
1238 * Documentation in Documentation/networking/radiotap-headers.txt
1239 */
1240
1241/**
1242 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
1243 * @rtheader: pointer to the radiotap header we are walking through
1244 * @max_length: length of radiotap header in cpu byte ordering
1245 * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg
1246 * @this_arg: pointer to current radiotap arg
1247 * @arg_index: internal next argument index
1248 * @arg: internal next argument pointer
1249 * @next_bitmap: internal pointer to next present u32
1250 * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
1251 */
1252
1253struct ieee80211_radiotap_iterator {
1254 struct ieee80211_radiotap_header *rtheader;
1255 int max_length;
1256 int this_arg_index;
1257 u8 *this_arg;
1258
1259 int arg_index;
1260 u8 *arg;
1261 __le32 *next_bitmap;
1262 u32 bitmap_shifter;
1263};
1264
1265extern int ieee80211_radiotap_iterator_init(
1266 struct ieee80211_radiotap_iterator *iterator,
1267 struct ieee80211_radiotap_header *radiotap_header,
1268 int max_length);
1269
1270extern int ieee80211_radiotap_iterator_next(
1271 struct ieee80211_radiotap_iterator *iterator);
1272
1273extern const unsigned char rfc1042_header[6];
1274extern const unsigned char bridge_tunnel_header[6];
1275
1276/**
1277 * ieee80211_get_hdrlen_from_skb - get header length from data
1278 *
1279 * Given an skb with a raw 802.11 header at the data pointer this function
1280 * returns the 802.11 header length in bytes (not including encryption
1281 * headers). If the data in the sk_buff is too short to contain a valid 802.11
1282 * header the function returns 0.
1283 *
1284 * @skb: the frame
1285 */
1286unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
1287
1288/**
1289 * ieee80211_hdrlen - get header length in bytes from frame control
1290 * @fc: frame control field in little-endian format
1291 */
1292unsigned int ieee80211_hdrlen(__le16 fc);
1293
1294/**
1295 * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
1296 * @skb: the 802.11 data frame
1297 * @addr: the device MAC address
1298 * @iftype: the virtual interface type
1299 */
1300int ieee80211_data_to_8023(struct sk_buff *skb, u8 *addr,
1301 enum nl80211_iftype iftype);
1302
1303/**
1304 * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11
1305 * @skb: the 802.3 frame
1306 * @addr: the device MAC address
1307 * @iftype: the virtual interface type
1308 * @bssid: the network bssid (used only for iftype STATION and ADHOC)
1309 * @qos: build 802.11 QoS data frame
1310 */
1311int ieee80211_data_from_8023(struct sk_buff *skb, u8 *addr,
1312 enum nl80211_iftype iftype, u8 *bssid, bool qos);
1313
1314/**
1315 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
1316 * @skb: the data frame
1317 */
1318unsigned int cfg80211_classify8021d(struct sk_buff *skb);
1319
1320/*
1321 * Regulatory helper functions for wiphys
1322 */
1323
1324/**
1325 * regulatory_hint - driver hint to the wireless core a regulatory domain
1326 * @wiphy: the wireless device giving the hint (used only for reporting
1327 * conflicts)
1328 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
1329 * should be in. If @rd is set this should be NULL. Note that if you
1330 * set this to NULL you should still set rd->alpha2 to some accepted
1331 * alpha2.
1332 *
1333 * Wireless drivers can use this function to hint to the wireless core
1334 * what it believes should be the current regulatory domain by
1335 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
1336 * domain should be in or by providing a completely build regulatory domain.
1337 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
1338 * for a regulatory domain structure for the respective country.
1339 *
1340 * The wiphy must have been registered to cfg80211 prior to this call.
1341 * For cfg80211 drivers this means you must first use wiphy_register(),
1342 * for mac80211 drivers you must first use ieee80211_register_hw().
1343 *
1344 * Drivers should check the return value, its possible you can get
1345 * an -ENOMEM.
1346 */
1347extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
1348
1349/**
1350 * regulatory_hint_11d - hints a country IE as a regulatory domain
1351 * @wiphy: the wireless device giving the hint (used only for reporting
1352 * conflicts)
1353 * @country_ie: pointer to the country IE
1354 * @country_ie_len: length of the country IE
1355 *
1356 * We will intersect the rd with the what CRDA tells us should apply
1357 * for the alpha2 this country IE belongs to, this prevents APs from
1358 * sending us incorrect or outdated information against a country.
1359 */
1360extern void regulatory_hint_11d(struct wiphy *wiphy,
1361 u8 *country_ie,
1362 u8 country_ie_len);
1363/**
1364 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
1365 * @wiphy: the wireless device we want to process the regulatory domain on
1366 * @regd: the custom regulatory domain to use for this wiphy
1367 *
1368 * Drivers can sometimes have custom regulatory domains which do not apply
1369 * to a specific country. Drivers can use this to apply such custom regulatory
1370 * domains. This routine must be called prior to wiphy registration. The
1371 * custom regulatory domain will be trusted completely and as such previous
1372 * default channel settings will be disregarded. If no rule is found for a
1373 * channel on the regulatory domain the channel will be disabled.
1374 */
1375extern void wiphy_apply_custom_regulatory(
1376 struct wiphy *wiphy,
1377 const struct ieee80211_regdomain *regd);
1378
1379/**
1380 * freq_reg_info - get regulatory information for the given frequency
1381 * @wiphy: the wiphy for which we want to process this rule for
1382 * @center_freq: Frequency in KHz for which we want regulatory information for
1383 * @desired_bw_khz: the desired max bandwidth you want to use per
1384 * channel. Note that this is still 20 MHz if you want to use HT40
1385 * as HT40 makes use of two channels for its 40 MHz width bandwidth.
1386 * If set to 0 we'll assume you want the standard 20 MHz.
1387 * @reg_rule: the regulatory rule which we have for this frequency
1388 *
1389 * Use this function to get the regulatory rule for a specific frequency on
1390 * a given wireless device. If the device has a specific regulatory domain
1391 * it wants to follow we respect that unless a country IE has been received
1392 * and processed already.
1393 *
1394 * Returns 0 if it was able to find a valid regulatory rule which does
1395 * apply to the given center_freq otherwise it returns non-zero. It will
1396 * also return -ERANGE if we determine the given center_freq does not even have
1397 * a regulatory rule for a frequency range in the center_freq's band. See
1398 * freq_in_rule_band() for our current definition of a band -- this is purely
1399 * subjective and right now its 802.11 specific.
1400 */
1401extern int freq_reg_info(struct wiphy *wiphy,
1402 u32 center_freq,
1403 u32 desired_bw_khz,
1404 const struct ieee80211_reg_rule **reg_rule);
1405
1406/*
1407 * Temporary wext handlers & helper functions
1408 *
1409 * In the future cfg80211 will simply assign the entire wext handler
1410 * structure to netdevs it manages, but we're not there yet.
1411 */
824int cfg80211_wext_giwname(struct net_device *dev, 1412int cfg80211_wext_giwname(struct net_device *dev,
825 struct iw_request_info *info, 1413 struct iw_request_info *info,
826 char *name, char *extra); 1414 char *name, char *extra);
@@ -834,9 +1422,72 @@ int cfg80211_wext_siwscan(struct net_device *dev,
834int cfg80211_wext_giwscan(struct net_device *dev, 1422int cfg80211_wext_giwscan(struct net_device *dev,
835 struct iw_request_info *info, 1423 struct iw_request_info *info,
836 struct iw_point *data, char *extra); 1424 struct iw_point *data, char *extra);
1425int cfg80211_wext_siwmlme(struct net_device *dev,
1426 struct iw_request_info *info,
1427 struct iw_point *data, char *extra);
837int cfg80211_wext_giwrange(struct net_device *dev, 1428int cfg80211_wext_giwrange(struct net_device *dev,
838 struct iw_request_info *info, 1429 struct iw_request_info *info,
839 struct iw_point *data, char *extra); 1430 struct iw_point *data, char *extra);
1431int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
1432 struct iw_request_info *info,
1433 struct iw_freq *freq, char *extra);
1434int cfg80211_ibss_wext_giwfreq(struct net_device *dev,
1435 struct iw_request_info *info,
1436 struct iw_freq *freq, char *extra);
1437int cfg80211_ibss_wext_siwessid(struct net_device *dev,
1438 struct iw_request_info *info,
1439 struct iw_point *data, char *ssid);
1440int cfg80211_ibss_wext_giwessid(struct net_device *dev,
1441 struct iw_request_info *info,
1442 struct iw_point *data, char *ssid);
1443int cfg80211_ibss_wext_siwap(struct net_device *dev,
1444 struct iw_request_info *info,
1445 struct sockaddr *ap_addr, char *extra);
1446int cfg80211_ibss_wext_giwap(struct net_device *dev,
1447 struct iw_request_info *info,
1448 struct sockaddr *ap_addr, char *extra);
1449
1450struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
1451 struct iw_freq *freq);
1452
1453int cfg80211_wext_siwrts(struct net_device *dev,
1454 struct iw_request_info *info,
1455 struct iw_param *rts, char *extra);
1456int cfg80211_wext_giwrts(struct net_device *dev,
1457 struct iw_request_info *info,
1458 struct iw_param *rts, char *extra);
1459int cfg80211_wext_siwfrag(struct net_device *dev,
1460 struct iw_request_info *info,
1461 struct iw_param *frag, char *extra);
1462int cfg80211_wext_giwfrag(struct net_device *dev,
1463 struct iw_request_info *info,
1464 struct iw_param *frag, char *extra);
1465int cfg80211_wext_siwretry(struct net_device *dev,
1466 struct iw_request_info *info,
1467 struct iw_param *retry, char *extra);
1468int cfg80211_wext_giwretry(struct net_device *dev,
1469 struct iw_request_info *info,
1470 struct iw_param *retry, char *extra);
1471int cfg80211_wext_siwencodeext(struct net_device *dev,
1472 struct iw_request_info *info,
1473 struct iw_point *erq, char *extra);
1474int cfg80211_wext_siwencode(struct net_device *dev,
1475 struct iw_request_info *info,
1476 struct iw_point *erq, char *keybuf);
1477int cfg80211_wext_giwencode(struct net_device *dev,
1478 struct iw_request_info *info,
1479 struct iw_point *erq, char *keybuf);
1480int cfg80211_wext_siwtxpower(struct net_device *dev,
1481 struct iw_request_info *info,
1482 union iwreq_data *data, char *keybuf);
1483int cfg80211_wext_giwtxpower(struct net_device *dev,
1484 struct iw_request_info *info,
1485 union iwreq_data *data, char *keybuf);
1486
1487/*
1488 * callbacks for asynchronous cfg80211 methods, notification
1489 * functions and BSS handling helpers
1490 */
840 1491
841/** 1492/**
842 * cfg80211_scan_done - notify that scan finished 1493 * cfg80211_scan_done - notify that scan finished
@@ -864,6 +1515,14 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
864 struct ieee80211_mgmt *mgmt, size_t len, 1515 struct ieee80211_mgmt *mgmt, size_t len,
865 s32 signal, gfp_t gfp); 1516 s32 signal, gfp_t gfp);
866 1517
1518struct cfg80211_bss*
1519cfg80211_inform_bss(struct wiphy *wiphy,
1520 struct ieee80211_channel *channel,
1521 const u8 *bssid,
1522 u64 timestamp, u16 capability, u16 beacon_interval,
1523 const u8 *ie, size_t ielen,
1524 s32 signal, gfp_t gfp);
1525
867struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, 1526struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
868 struct ieee80211_channel *channel, 1527 struct ieee80211_channel *channel,
869 const u8 *bssid, 1528 const u8 *bssid,
@@ -883,6 +1542,7 @@ struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
883 const u8 *meshid, size_t meshidlen, 1542 const u8 *meshid, size_t meshidlen,
884 const u8 *meshcfg); 1543 const u8 *meshcfg);
885void cfg80211_put_bss(struct cfg80211_bss *bss); 1544void cfg80211_put_bss(struct cfg80211_bss *bss);
1545
886/** 1546/**
887 * cfg80211_unlink_bss - unlink BSS from internal data structures 1547 * cfg80211_unlink_bss - unlink BSS from internal data structures
888 * @wiphy: the wiphy 1548 * @wiphy: the wiphy
@@ -902,44 +1562,62 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
902 * @len: length of the frame data 1562 * @len: length of the frame data
903 * 1563 *
904 * This function is called whenever an authentication has been processed in 1564 * This function is called whenever an authentication has been processed in
905 * station mode. 1565 * station mode. The driver is required to call either this function or
1566 * cfg80211_send_auth_timeout() to indicate the result of cfg80211_ops::auth()
1567 * call.
906 */ 1568 */
907void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len); 1569void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
908 1570
909/** 1571/**
1572 * cfg80211_send_auth_timeout - notification of timed out authentication
1573 * @dev: network device
1574 * @addr: The MAC address of the device with which the authentication timed out
1575 */
1576void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr);
1577
1578/**
910 * cfg80211_send_rx_assoc - notification of processed association 1579 * cfg80211_send_rx_assoc - notification of processed association
911 * @dev: network device 1580 * @dev: network device
912 * @buf: (re)association response frame (header + body) 1581 * @buf: (re)association response frame (header + body)
913 * @len: length of the frame data 1582 * @len: length of the frame data
914 * 1583 *
915 * This function is called whenever a (re)association response has been 1584 * This function is called whenever a (re)association response has been
916 * processed in station mode. 1585 * processed in station mode. The driver is required to call either this
1586 * function or cfg80211_send_assoc_timeout() to indicate the result of
1587 * cfg80211_ops::assoc() call.
917 */ 1588 */
918void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len); 1589void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
919 1590
920/** 1591/**
921 * cfg80211_send_rx_deauth - notification of processed deauthentication 1592 * cfg80211_send_assoc_timeout - notification of timed out association
1593 * @dev: network device
1594 * @addr: The MAC address of the device with which the association timed out
1595 */
1596void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr);
1597
1598/**
1599 * cfg80211_send_deauth - notification of processed deauthentication
922 * @dev: network device 1600 * @dev: network device
923 * @buf: deauthentication frame (header + body) 1601 * @buf: deauthentication frame (header + body)
924 * @len: length of the frame data 1602 * @len: length of the frame data
925 * 1603 *
926 * This function is called whenever deauthentication has been processed in 1604 * This function is called whenever deauthentication has been processed in
927 * station mode. 1605 * station mode. This includes both received deauthentication frames and
1606 * locally generated ones.
928 */ 1607 */
929void cfg80211_send_rx_deauth(struct net_device *dev, const u8 *buf, 1608void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
930 size_t len);
931 1609
932/** 1610/**
933 * cfg80211_send_rx_disassoc - notification of processed disassociation 1611 * cfg80211_send_disassoc - notification of processed disassociation
934 * @dev: network device 1612 * @dev: network device
935 * @buf: disassociation response frame (header + body) 1613 * @buf: disassociation response frame (header + body)
936 * @len: length of the frame data 1614 * @len: length of the frame data
937 * 1615 *
938 * This function is called whenever disassociation has been processed in 1616 * This function is called whenever disassociation has been processed in
939 * station mode. 1617 * station mode. This includes both received disassociation frames and locally
1618 * generated ones.
940 */ 1619 */
941void cfg80211_send_rx_disassoc(struct net_device *dev, const u8 *buf, 1620void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
942 size_t len);
943 1621
944/** 1622/**
945 * cfg80211_hold_bss - exclude bss from expiration 1623 * cfg80211_hold_bss - exclude bss from expiration
@@ -958,4 +1636,55 @@ void cfg80211_hold_bss(struct cfg80211_bss *bss);
958 */ 1636 */
959void cfg80211_unhold_bss(struct cfg80211_bss *bss); 1637void cfg80211_unhold_bss(struct cfg80211_bss *bss);
960 1638
1639/**
1640 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
1641 * @dev: network device
1642 * @addr: The source MAC address of the frame
1643 * @key_type: The key type that the received frame used
1644 * @key_id: Key identifier (0..3)
1645 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
1646 *
1647 * This function is called whenever the local MAC detects a MIC failure in a
1648 * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
1649 * primitive.
1650 */
1651void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
1652 enum nl80211_key_type key_type, int key_id,
1653 const u8 *tsc);
1654
1655/**
1656 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
1657 *
1658 * @dev: network device
1659 * @bssid: the BSSID of the IBSS joined
1660 * @gfp: allocation flags
1661 *
1662 * This function notifies cfg80211 that the device joined an IBSS or
1663 * switched to a different BSSID. Before this function can be called,
1664 * either a beacon has to have been received from the IBSS, or one of
1665 * the cfg80211_inform_bss{,_frame} functions must have been called
1666 * with the locally generated beacon -- this guarantees that there is
1667 * always a scan result for this IBSS. cfg80211 will handle the rest.
1668 */
1669void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp);
1670
1671/**
1672 * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
1673 * @wiphy: the wiphy
1674 * @blocked: block status
1675 */
1676void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
1677
1678/**
1679 * wiphy_rfkill_start_polling - start polling rfkill
1680 * @wiphy: the wiphy
1681 */
1682void wiphy_rfkill_start_polling(struct wiphy *wiphy);
1683
1684/**
1685 * wiphy_rfkill_stop_polling - stop polling rfkill
1686 * @wiphy: the wiphy
1687 */
1688void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
1689
961#endif /* __NET_CFG80211_H */ 1690#endif /* __NET_CFG80211_H */
diff --git a/include/net/dst.h b/include/net/dst.h
index 6be3b082a070..7fc409c19b37 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -195,6 +195,12 @@ struct dst_entry * dst_clone(struct dst_entry * dst)
195} 195}
196 196
197extern void dst_release(struct dst_entry *dst); 197extern void dst_release(struct dst_entry *dst);
198static inline void skb_dst_drop(struct sk_buff *skb)
199{
200 if (skb->_skb_dst)
201 dst_release(skb_dst(skb));
202 skb->_skb_dst = 0UL;
203}
198 204
199/* Children define the path of the packet through the 205/* Children define the path of the packet through the
200 * Linux networking. Thus, destinations are stackable. 206 * Linux networking. Thus, destinations are stackable.
@@ -246,7 +252,7 @@ static inline void dst_negative_advice(struct dst_entry **dst_p)
246 252
247static inline void dst_link_failure(struct sk_buff *skb) 253static inline void dst_link_failure(struct sk_buff *skb)
248{ 254{
249 struct dst_entry * dst = skb->dst; 255 struct dst_entry *dst = skb_dst(skb);
250 if (dst && dst->ops && dst->ops->link_failure) 256 if (dst && dst->ops && dst->ops->link_failure)
251 dst->ops->link_failure(skb); 257 dst->ops->link_failure(skb);
252} 258}
@@ -265,13 +271,13 @@ static inline void dst_set_expires(struct dst_entry *dst, int timeout)
265/* Output packet to network from transport. */ 271/* Output packet to network from transport. */
266static inline int dst_output(struct sk_buff *skb) 272static inline int dst_output(struct sk_buff *skb)
267{ 273{
268 return skb->dst->output(skb); 274 return skb_dst(skb)->output(skb);
269} 275}
270 276
271/* Input packet from network to transport. */ 277/* Input packet from network to transport. */
272static inline int dst_input(struct sk_buff *skb) 278static inline int dst_input(struct sk_buff *skb)
273{ 279{
274 return skb->dst->input(skb); 280 return skb_dst(skb)->input(skb);
275} 281}
276 282
277static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie) 283static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie)
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index c2bb5cae6515..ca4b2e840078 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -48,14 +48,12 @@ struct fib_rules_ops
48 struct flowi *, int); 48 struct flowi *, int);
49 int (*configure)(struct fib_rule *, 49 int (*configure)(struct fib_rule *,
50 struct sk_buff *, 50 struct sk_buff *,
51 struct nlmsghdr *,
52 struct fib_rule_hdr *, 51 struct fib_rule_hdr *,
53 struct nlattr **); 52 struct nlattr **);
54 int (*compare)(struct fib_rule *, 53 int (*compare)(struct fib_rule *,
55 struct fib_rule_hdr *, 54 struct fib_rule_hdr *,
56 struct nlattr **); 55 struct nlattr **);
57 int (*fill)(struct fib_rule *, struct sk_buff *, 56 int (*fill)(struct fib_rule *, struct sk_buff *,
58 struct nlmsghdr *,
59 struct fib_rule_hdr *); 57 struct fib_rule_hdr *);
60 u32 (*default_pref)(struct fib_rules_ops *ops); 58 u32 (*default_pref)(struct fib_rules_ops *ops);
61 size_t (*nlmsg_payload)(struct fib_rule *); 59 size_t (*nlmsg_payload)(struct fib_rule *);
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 747c255d1df0..1b0e3ee4ddd8 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -88,6 +88,8 @@ struct genl_ops
88}; 88};
89 89
90extern int genl_register_family(struct genl_family *family); 90extern int genl_register_family(struct genl_family *family);
91extern int genl_register_family_with_ops(struct genl_family *family,
92 struct genl_ops *ops, size_t n_ops);
91extern int genl_unregister_family(struct genl_family *family); 93extern int genl_unregister_family(struct genl_family *family);
92extern int genl_register_ops(struct genl_family *, struct genl_ops *ops); 94extern int genl_register_ops(struct genl_family *, struct genl_ops *ops);
93extern int genl_unregister_ops(struct genl_family *, struct genl_ops *ops); 95extern int genl_unregister_ops(struct genl_family *, struct genl_ops *ops);
diff --git a/include/net/ieee802154/af_ieee802154.h b/include/net/ieee802154/af_ieee802154.h
new file mode 100644
index 000000000000..0d78605fb1a6
--- /dev/null
+++ b/include/net/ieee802154/af_ieee802154.h
@@ -0,0 +1,60 @@
1/*
2 * IEEE 802.15.4 inteface for userspace
3 *
4 * Copyright 2007, 2008 Siemens AG
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Written by:
20 * Sergey Lapin <slapin@ossfans.org>
21 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
22 */
23
24#ifndef _AF_IEEE802154_H
25#define _AF_IEEE802154_H
26
27#include <linux/socket.h> /* for sa_family_t */
28
29enum {
30 IEEE802154_ADDR_NONE = 0x0,
31 /* RESERVED = 0x01, */
32 IEEE802154_ADDR_SHORT = 0x2, /* 16-bit address + PANid */
33 IEEE802154_ADDR_LONG = 0x3, /* 64-bit address + PANid */
34};
35
36/* address length, octets */
37#define IEEE802154_ADDR_LEN 8
38
39struct ieee802154_addr {
40 int addr_type;
41 u16 pan_id;
42 union {
43 u8 hwaddr[IEEE802154_ADDR_LEN];
44 u16 short_addr;
45 };
46};
47
48#define IEEE802154_PANID_BROADCAST 0xffff
49#define IEEE802154_ADDR_BROADCAST 0xffff
50#define IEEE802154_ADDR_UNDEF 0xfffe
51
52struct sockaddr_ieee802154 {
53 sa_family_t family; /* AF_IEEE802154 */
54 struct ieee802154_addr addr;
55};
56
57/* master device */
58#define IEEE802154_SIOC_ADD_SLAVE (SIOCDEVPRIVATE + 0)
59
60#endif
diff --git a/include/net/ieee802154/mac_def.h b/include/net/ieee802154/mac_def.h
new file mode 100644
index 000000000000..8cb684635650
--- /dev/null
+++ b/include/net/ieee802154/mac_def.h
@@ -0,0 +1,160 @@
1/*
2 * IEEE802.15.4-2003 specification
3 *
4 * Copyright (C) 2007, 2008 Siemens AG
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Written by:
20 * Pavel Smolenskiy <pavel.smolenskiy@gmail.com>
21 * Maxim Gorbachyov <maxim.gorbachev@siemens.com>
22 * Maxim Osipov <maxim.osipov@siemens.com>
23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
24 */
25
26#ifndef IEEE802154_MAC_DEF_H
27#define IEEE802154_MAC_DEF_H
28
29#define IEEE802154_FC_TYPE_BEACON 0x0 /* Frame is beacon */
30#define IEEE802154_FC_TYPE_DATA 0x1 /* Frame is data */
31#define IEEE802154_FC_TYPE_ACK 0x2 /* Frame is acknowledgment */
32#define IEEE802154_FC_TYPE_MAC_CMD 0x3 /* Frame is MAC command */
33
34#define IEEE802154_FC_TYPE_SHIFT 0
35#define IEEE802154_FC_TYPE_MASK ((1 << 3) - 1)
36#define IEEE802154_FC_TYPE(x) ((x & IEEE802154_FC_TYPE_MASK) >> IEEE802154_FC_TYPE_SHIFT)
37#define IEEE802154_FC_SET_TYPE(v, x) do { \
38 v = (((v) & ~IEEE802154_FC_TYPE_MASK) | \
39 (((x) << IEEE802154_FC_TYPE_SHIFT) & IEEE802154_FC_TYPE_MASK)); \
40 } while (0)
41
42#define IEEE802154_FC_SECEN (1 << 3)
43#define IEEE802154_FC_FRPEND (1 << 4)
44#define IEEE802154_FC_ACK_REQ (1 << 5)
45#define IEEE802154_FC_INTRA_PAN (1 << 6)
46
47#define IEEE802154_FC_SAMODE_SHIFT 14
48#define IEEE802154_FC_SAMODE_MASK (3 << IEEE802154_FC_SAMODE_SHIFT)
49#define IEEE802154_FC_DAMODE_SHIFT 10
50#define IEEE802154_FC_DAMODE_MASK (3 << IEEE802154_FC_DAMODE_SHIFT)
51
52#define IEEE802154_FC_SAMODE(x) \
53 (((x) & IEEE802154_FC_SAMODE_MASK) >> IEEE802154_FC_SAMODE_SHIFT)
54
55#define IEEE802154_FC_DAMODE(x) \
56 (((x) & IEEE802154_FC_DAMODE_MASK) >> IEEE802154_FC_DAMODE_SHIFT)
57
58
59/* MAC's Command Frames Identifiers */
60#define IEEE802154_CMD_ASSOCIATION_REQ 0x01
61#define IEEE802154_CMD_ASSOCIATION_RESP 0x02
62#define IEEE802154_CMD_DISASSOCIATION_NOTIFY 0x03
63#define IEEE802154_CMD_DATA_REQ 0x04
64#define IEEE802154_CMD_PANID_CONFLICT_NOTIFY 0x05
65#define IEEE802154_CMD_ORPHAN_NOTIFY 0x06
66#define IEEE802154_CMD_BEACON_REQ 0x07
67#define IEEE802154_CMD_COORD_REALIGN_NOTIFY 0x08
68#define IEEE802154_CMD_GTS_REQ 0x09
69
70/*
71 * The return values of MAC operations
72 */
73enum {
74 /*
75 * The requested operation was completed successfully.
76 * For a transmission request, this value indicates
77 * a successful transmission.
78 */
79 IEEE802154_SUCCESS = 0x0,
80
81 /* The beacon was lost following a synchronization request. */
82 IEEE802154_BEACON_LOSS = 0xe0,
83 /*
84 * A transmission could not take place due to activity on the
85 * channel, i.e., the CSMA-CA mechanism has failed.
86 */
87 IEEE802154_CHNL_ACCESS_FAIL = 0xe1,
88 /* The GTS request has been denied by the PAN coordinator. */
89 IEEE802154_DENINED = 0xe2,
90 /* The attempt to disable the transceiver has failed. */
91 IEEE802154_DISABLE_TRX_FAIL = 0xe3,
92 /*
93 * The received frame induces a failed security check according to
94 * the security suite.
95 */
96 IEEE802154_FAILED_SECURITY_CHECK = 0xe4,
97 /*
98 * The frame resulting from secure processing has a length that is
99 * greater than aMACMaxFrameSize.
100 */
101 IEEE802154_FRAME_TOO_LONG = 0xe5,
102 /*
103 * The requested GTS transmission failed because the specified GTS
104 * either did not have a transmit GTS direction or was not defined.
105 */
106 IEEE802154_INVALID_GTS = 0xe6,
107 /*
108 * A request to purge an MSDU from the transaction queue was made using
109 * an MSDU handle that was not found in the transaction table.
110 */
111 IEEE802154_INVALID_HANDLE = 0xe7,
112 /* A parameter in the primitive is out of the valid range.*/
113 IEEE802154_INVALID_PARAMETER = 0xe8,
114 /* No acknowledgment was received after aMaxFrameRetries. */
115 IEEE802154_NO_ACK = 0xe9,
116 /* A scan operation failed to find any network beacons.*/
117 IEEE802154_NO_BEACON = 0xea,
118 /* No response data were available following a request. */
119 IEEE802154_NO_DATA = 0xeb,
120 /* The operation failed because a short address was not allocated. */
121 IEEE802154_NO_SHORT_ADDRESS = 0xec,
122 /*
123 * A receiver enable request was unsuccessful because it could not be
124 * completed within the CAP.
125 */
126 IEEE802154_OUT_OF_CAP = 0xed,
127 /*
128 * A PAN identifier conflict has been detected and communicated to the
129 * PAN coordinator.
130 */
131 IEEE802154_PANID_CONFLICT = 0xee,
132 /* A coordinator realignment command has been received. */
133 IEEE802154_REALIGMENT = 0xef,
134 /* The transaction has expired and its information discarded. */
135 IEEE802154_TRANSACTION_EXPIRED = 0xf0,
136 /* There is no capacity to store the transaction. */
137 IEEE802154_TRANSACTION_OVERFLOW = 0xf1,
138 /*
139 * The transceiver was in the transmitter enabled state when the
140 * receiver was requested to be enabled.
141 */
142 IEEE802154_TX_ACTIVE = 0xf2,
143 /* The appropriate key is not available in the ACL. */
144 IEEE802154_UNAVAILABLE_KEY = 0xf3,
145 /*
146 * A SET/GET request was issued with the identifier of a PIB attribute
147 * that is not supported.
148 */
149 IEEE802154_UNSUPPORTED_ATTR = 0xf4,
150 /*
151 * A request to perform a scan operation failed because the MLME was
152 * in the process of performing a previously initiated scan operation.
153 */
154 IEEE802154_SCAN_IN_PROGRESS = 0xfc,
155};
156
157
158#endif
159
160
diff --git a/include/net/ieee802154/netdevice.h b/include/net/ieee802154/netdevice.h
new file mode 100644
index 000000000000..e2506af3e7c8
--- /dev/null
+++ b/include/net/ieee802154/netdevice.h
@@ -0,0 +1,115 @@
1/*
2 * An interface between IEEE802.15.4 device and rest of the kernel.
3 *
4 * Copyright (C) 2007, 2008, 2009 Siemens AG
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Written by:
20 * Pavel Smolenskiy <pavel.smolenskiy@gmail.com>
21 * Maxim Gorbachyov <maxim.gorbachev@siemens.com>
22 * Maxim Osipov <maxim.osipov@siemens.com>
23 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
24 */
25
26#ifndef IEEE802154_NETDEVICE_H
27#define IEEE802154_NETDEVICE_H
28
29/*
30 * A control block of skb passed between the ARPHRD_IEEE802154 device
31 * and other stack parts.
32 */
33struct ieee802154_mac_cb {
34 u8 lqi;
35 struct ieee802154_addr sa;
36 struct ieee802154_addr da;
37 u8 flags;
38 u8 seq;
39};
40
41static inline struct ieee802154_mac_cb *mac_cb(struct sk_buff *skb)
42{
43 return (struct ieee802154_mac_cb *)skb->cb;
44}
45
46#define MAC_CB_FLAG_TYPEMASK ((1 << 3) - 1)
47
48#define MAC_CB_FLAG_ACKREQ (1 << 3)
49#define MAC_CB_FLAG_SECEN (1 << 4)
50#define MAC_CB_FLAG_INTRAPAN (1 << 5)
51
52static inline int mac_cb_is_ackreq(struct sk_buff *skb)
53{
54 return mac_cb(skb)->flags & MAC_CB_FLAG_ACKREQ;
55}
56
57static inline int mac_cb_is_secen(struct sk_buff *skb)
58{
59 return mac_cb(skb)->flags & MAC_CB_FLAG_SECEN;
60}
61
62static inline int mac_cb_is_intrapan(struct sk_buff *skb)
63{
64 return mac_cb(skb)->flags & MAC_CB_FLAG_INTRAPAN;
65}
66
67static inline int mac_cb_type(struct sk_buff *skb)
68{
69 return mac_cb(skb)->flags & MAC_CB_FLAG_TYPEMASK;
70}
71
72#define IEEE802154_MAC_SCAN_ED 0
73#define IEEE802154_MAC_SCAN_ACTIVE 1
74#define IEEE802154_MAC_SCAN_PASSIVE 2
75#define IEEE802154_MAC_SCAN_ORPHAN 3
76
77/*
78 * This should be located at net_device->ml_priv
79 */
80struct ieee802154_mlme_ops {
81 int (*assoc_req)(struct net_device *dev,
82 struct ieee802154_addr *addr,
83 u8 channel, u8 cap);
84 int (*assoc_resp)(struct net_device *dev,
85 struct ieee802154_addr *addr,
86 u16 short_addr, u8 status);
87 int (*disassoc_req)(struct net_device *dev,
88 struct ieee802154_addr *addr,
89 u8 reason);
90 int (*start_req)(struct net_device *dev,
91 struct ieee802154_addr *addr,
92 u8 channel, u8 bcn_ord, u8 sf_ord,
93 u8 pan_coord, u8 blx, u8 coord_realign);
94 int (*scan_req)(struct net_device *dev,
95 u8 type, u32 channels, u8 duration);
96
97 /*
98 * FIXME: these should become the part of PIB/MIB interface.
99 * However we still don't have IB interface of any kind
100 */
101 u16 (*get_pan_id)(struct net_device *dev);
102 u16 (*get_short_addr)(struct net_device *dev);
103 u8 (*get_dsn)(struct net_device *dev);
104 u8 (*get_bsn)(struct net_device *dev);
105};
106
107static inline struct ieee802154_mlme_ops *ieee802154_mlme_ops(
108 struct net_device *dev)
109{
110 return dev->ml_priv;
111}
112
113#endif
114
115
diff --git a/include/net/ieee802154/nl802154.h b/include/net/ieee802154/nl802154.h
new file mode 100644
index 000000000000..78efcdf52b59
--- /dev/null
+++ b/include/net/ieee802154/nl802154.h
@@ -0,0 +1,41 @@
1/*
2 * nl802154.h
3 *
4 * Copyright (C) 2007, 2008, 2009 Siemens AG
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#ifndef IEEE802154_NL_H
22#define IEEE802154_NL_H
23
24struct net_device;
25struct ieee802154_addr;
26
27int ieee802154_nl_assoc_indic(struct net_device *dev,
28 struct ieee802154_addr *addr, u8 cap);
29int ieee802154_nl_assoc_confirm(struct net_device *dev,
30 u16 short_addr, u8 status);
31int ieee802154_nl_disassoc_indic(struct net_device *dev,
32 struct ieee802154_addr *addr, u8 reason);
33int ieee802154_nl_disassoc_confirm(struct net_device *dev,
34 u8 status);
35int ieee802154_nl_scan_confirm(struct net_device *dev,
36 u8 status, u8 scan_type, u32 unscanned,
37 u8 *edl/*, struct list_head *pan_desc_list */);
38int ieee802154_nl_beacon_indic(struct net_device *dev, u16 panid,
39 u16 coord_addr);
40
41#endif
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index f74665d7bea8..22c73a77cd99 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -100,7 +100,7 @@ static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo,
100 100
101 if (unlikely(sk = skb_steal_sock(skb))) 101 if (unlikely(sk = skb_steal_sock(skb)))
102 return sk; 102 return sk;
103 else return __inet6_lookup(dev_net(skb->dst->dev), hashinfo, 103 else return __inet6_lookup(dev_net(skb_dst(skb)->dev), hashinfo,
104 &ipv6_hdr(skb)->saddr, sport, 104 &ipv6_hdr(skb)->saddr, sport,
105 &ipv6_hdr(skb)->daddr, ntohs(dport), 105 &ipv6_hdr(skb)->daddr, ntohs(dport),
106 inet6_iif(skb)); 106 inet6_iif(skb));
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index a44e2248b2ef..d522dcf3031a 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -385,7 +385,7 @@ static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo,
385 if (unlikely(sk = skb_steal_sock(skb))) 385 if (unlikely(sk = skb_steal_sock(skb)))
386 return sk; 386 return sk;
387 else 387 else
388 return __inet_lookup(dev_net(skb->dst->dev), hashinfo, 388 return __inet_lookup(dev_net(skb_dst(skb)->dev), hashinfo,
389 iph->saddr, sport, 389 iph->saddr, sport,
390 iph->daddr, dport, inet_iif(skb)); 390 iph->daddr, dport, inet_iif(skb));
391} 391}
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index de0ecc71cf03..47004f35cc7e 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -17,6 +17,7 @@
17#define _INET_SOCK_H 17#define _INET_SOCK_H
18 18
19 19
20#include <linux/kmemcheck.h>
20#include <linux/string.h> 21#include <linux/string.h>
21#include <linux/types.h> 22#include <linux/types.h>
22#include <linux/jhash.h> 23#include <linux/jhash.h>
@@ -66,14 +67,16 @@ struct inet_request_sock {
66 __be32 loc_addr; 67 __be32 loc_addr;
67 __be32 rmt_addr; 68 __be32 rmt_addr;
68 __be16 rmt_port; 69 __be16 rmt_port;
69 u16 snd_wscale : 4, 70 kmemcheck_bitfield_begin(flags);
70 rcv_wscale : 4, 71 u16 snd_wscale : 4,
72 rcv_wscale : 4,
71 tstamp_ok : 1, 73 tstamp_ok : 1,
72 sack_ok : 1, 74 sack_ok : 1,
73 wscale_ok : 1, 75 wscale_ok : 1,
74 ecn_ok : 1, 76 ecn_ok : 1,
75 acked : 1, 77 acked : 1,
76 no_srccheck: 1; 78 no_srccheck: 1;
79 kmemcheck_bitfield_end(flags);
77 struct ip_options *opt; 80 struct ip_options *opt;
78}; 81};
79 82
@@ -130,7 +133,8 @@ struct inet_sock {
130 freebind:1, 133 freebind:1,
131 hdrincl:1, 134 hdrincl:1,
132 mc_loop:1, 135 mc_loop:1,
133 transparent:1; 136 transparent:1,
137 mc_all:1;
134 int mc_index; 138 int mc_index;
135 __be32 mc_addr; 139 __be32 mc_addr;
136 struct ip_mc_socklist *mc_list; 140 struct ip_mc_socklist *mc_list;
@@ -198,9 +202,12 @@ static inline int inet_sk_ehashfn(const struct sock *sk)
198static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops) 202static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops)
199{ 203{
200 struct request_sock *req = reqsk_alloc(ops); 204 struct request_sock *req = reqsk_alloc(ops);
205 struct inet_request_sock *ireq = inet_rsk(req);
201 206
202 if (req != NULL) 207 if (req != NULL) {
203 inet_rsk(req)->opt = NULL; 208 kmemcheck_annotate_bitfield(ireq, flags);
209 ireq->opt = NULL;
210 }
204 211
205 return req; 212 return req;
206} 213}
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 4b8ece22b8e9..b63b80fac567 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -16,6 +16,7 @@
16#define _INET_TIMEWAIT_SOCK_ 16#define _INET_TIMEWAIT_SOCK_
17 17
18 18
19#include <linux/kmemcheck.h>
19#include <linux/list.h> 20#include <linux/list.h>
20#include <linux/module.h> 21#include <linux/module.h>
21#include <linux/timer.h> 22#include <linux/timer.h>
@@ -127,10 +128,12 @@ struct inet_timewait_sock {
127 __be32 tw_rcv_saddr; 128 __be32 tw_rcv_saddr;
128 __be16 tw_dport; 129 __be16 tw_dport;
129 __u16 tw_num; 130 __u16 tw_num;
131 kmemcheck_bitfield_begin(flags);
130 /* And these are ours. */ 132 /* And these are ours. */
131 __u8 tw_ipv6only:1, 133 __u8 tw_ipv6only:1,
132 tw_transparent:1; 134 tw_transparent:1;
133 /* 15 bits hole, try to pack */ 135 /* 14 bits hole, try to pack */
136 kmemcheck_bitfield_end(flags);
134 __u16 tw_ipv6_offset; 137 __u16 tw_ipv6_offset;
135 unsigned long tw_ttd; 138 unsigned long tw_ttd;
136 struct inet_bind_bucket *tw_tb; 139 struct inet_bind_bucket *tw_tb;
diff --git a/include/net/ip.h b/include/net/ip.h
index 4ac7577f98d0..72c36926c26d 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -168,7 +168,10 @@ struct ipv4_config
168extern struct ipv4_config ipv4_config; 168extern struct ipv4_config ipv4_config;
169#define IP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.ip_statistics, field) 169#define IP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.ip_statistics, field)
170#define IP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.ip_statistics, field) 170#define IP_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.ip_statistics, field)
171#define IP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.ip_statistics, field, val)
171#define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS_BH((net)->mib.ip_statistics, field, val) 172#define IP_ADD_STATS_BH(net, field, val) SNMP_ADD_STATS_BH((net)->mib.ip_statistics, field, val)
173#define IP_UPD_PO_STATS(net, field, val) SNMP_UPD_PO_STATS((net)->mib.ip_statistics, field, val)
174#define IP_UPD_PO_STATS_BH(net, field, val) SNMP_UPD_PO_STATS_BH((net)->mib.ip_statistics, field, val)
172#define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field) 175#define NET_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.net_statistics, field)
173#define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field) 176#define NET_INC_STATS_BH(net, field) SNMP_INC_STATS_BH((net)->mib.net_statistics, field)
174#define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field) 177#define NET_INC_STATS_USER(net, field) SNMP_INC_STATS_USER((net)->mib.net_statistics, field)
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 5f53db7e4e57..0e1b8aebaff8 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -142,7 +142,7 @@ static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
142 142
143static inline int ipv6_unicast_destination(struct sk_buff *skb) 143static inline int ipv6_unicast_destination(struct sk_buff *skb)
144{ 144{
145 struct rt6_info *rt = (struct rt6_info *) skb->dst; 145 struct rt6_info *rt = (struct rt6_info *) skb_dst(skb);
146 146
147 return rt->rt6i_flags & RTF_LOCAL; 147 return rt->rt6i_flags & RTF_LOCAL;
148} 148}
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 8b12667f7a2b..ef91fe924ba4 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -124,14 +124,12 @@ struct fib_result_nl {
124#ifdef CONFIG_IP_ROUTE_MULTIPATH 124#ifdef CONFIG_IP_ROUTE_MULTIPATH
125 125
126#define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel]) 126#define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel])
127#define FIB_RES_RESET(res) ((res).nh_sel = 0)
128 127
129#define FIB_TABLE_HASHSZ 2 128#define FIB_TABLE_HASHSZ 2
130 129
131#else /* CONFIG_IP_ROUTE_MULTIPATH */ 130#else /* CONFIG_IP_ROUTE_MULTIPATH */
132 131
133#define FIB_RES_NH(res) ((res).fi->fib_nh[0]) 132#define FIB_RES_NH(res) ((res).fi->fib_nh[0])
134#define FIB_RES_RESET(res)
135 133
136#define FIB_TABLE_HASHSZ 256 134#define FIB_TABLE_HASHSZ 256
137 135
@@ -145,7 +143,6 @@ struct fib_result_nl {
145struct fib_table { 143struct fib_table {
146 struct hlist_node tb_hlist; 144 struct hlist_node tb_hlist;
147 u32 tb_id; 145 u32 tb_id;
148 unsigned tb_stamp;
149 int tb_default; 146 int tb_default;
150 int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res); 147 int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res);
151 int (*tb_insert)(struct fib_table *, struct fib_config *); 148 int (*tb_insert)(struct fib_table *, struct fib_config *);
diff --git a/include/net/ipip.h b/include/net/ipip.h
index fdf9bd743705..5d3036fa1511 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -28,11 +28,18 @@ struct ip_tunnel
28 unsigned int prl_count; /* # of entries in PRL */ 28 unsigned int prl_count; /* # of entries in PRL */
29}; 29};
30 30
31/* ISATAP: default interval between RS in secondy */
32#define IPTUNNEL_RS_DEFAULT_DELAY (900)
33
31struct ip_tunnel_prl_entry 34struct ip_tunnel_prl_entry
32{ 35{
33 struct ip_tunnel_prl_entry *next; 36 struct ip_tunnel_prl_entry *next;
34 __be32 addr; 37 __be32 addr;
35 u16 flags; 38 u16 flags;
39 unsigned long rs_delay;
40 struct timer_list rs_timer;
41 struct ip_tunnel *tunnel;
42 spinlock_t lock;
36}; 43};
37 44
38#define IPTUNNEL_XMIT() do { \ 45#define IPTUNNEL_XMIT() do { \
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index c1f16fc49ade..f27fd83d67d8 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -126,15 +126,28 @@ extern struct ctl_path net_ipv6_ctl_path[];
126 SNMP_ADD_STATS##modifier((net)->mib.statname##_statistics, (field), (val));\ 126 SNMP_ADD_STATS##modifier((net)->mib.statname##_statistics, (field), (val));\
127}) 127})
128 128
129#define _DEVUPD(net, statname, modifier, idev, field, val) \
130({ \
131 struct inet6_dev *_idev = (idev); \
132 if (likely(_idev != NULL)) \
133 SNMP_UPD_PO_STATS##modifier((_idev)->stats.statname, field, (val)); \
134 SNMP_UPD_PO_STATS##modifier((net)->mib.statname##_statistics, field, (val));\
135})
136
129/* MIBs */ 137/* MIBs */
130 138
131#define IP6_INC_STATS(net, idev,field) \ 139#define IP6_INC_STATS(net, idev,field) \
132 _DEVINC(net, ipv6, , idev, field) 140 _DEVINC(net, ipv6, , idev, field)
133#define IP6_INC_STATS_BH(net, idev,field) \ 141#define IP6_INC_STATS_BH(net, idev,field) \
134 _DEVINC(net, ipv6, _BH, idev, field) 142 _DEVINC(net, ipv6, _BH, idev, field)
143#define IP6_ADD_STATS(net, idev,field,val) \
144 _DEVADD(net, ipv6, , idev, field, val)
135#define IP6_ADD_STATS_BH(net, idev,field,val) \ 145#define IP6_ADD_STATS_BH(net, idev,field,val) \
136 _DEVADD(net, ipv6, _BH, idev, field, val) 146 _DEVADD(net, ipv6, _BH, idev, field, val)
137 147#define IP6_UPD_PO_STATS(net, idev,field,val) \
148 _DEVUPD(net, ipv6, , idev, field, val)
149#define IP6_UPD_PO_STATS_BH(net, idev,field,val) \
150 _DEVUPD(net, ipv6, _BH, idev, field, val)
138#define ICMP6_INC_STATS(net, idev, field) \ 151#define ICMP6_INC_STATS(net, idev, field) \
139 _DEVINC(net, icmpv6, , idev, field) 152 _DEVINC(net, icmpv6, , idev, field)
140#define ICMP6_INC_STATS_BH(net, idev, field) \ 153#define ICMP6_INC_STATS_BH(net, idev, field) \
diff --git a/include/net/iucv/af_iucv.h b/include/net/iucv/af_iucv.h
index 85f80eadfa35..f82a1e877372 100644
--- a/include/net/iucv/af_iucv.h
+++ b/include/net/iucv/af_iucv.h
@@ -73,8 +73,17 @@ struct iucv_sock {
73 struct sk_buff_head backlog_skb_q; 73 struct sk_buff_head backlog_skb_q;
74 struct sock_msg_q message_q; 74 struct sock_msg_q message_q;
75 unsigned int send_tag; 75 unsigned int send_tag;
76 u8 flags;
77 u16 msglimit;
76}; 78};
77 79
80/* iucv socket options (SOL_IUCV) */
81#define SO_IPRMDATA_MSG 0x0080 /* send/recv IPRM_DATA msgs */
82#define SO_MSGLIMIT 0x1000 /* get/set IUCV MSGLIMIT */
83
84/* iucv related control messages (scm) */
85#define SCM_IUCV_TRGCLS 0x0001 /* target class control message */
86
78struct iucv_sock_list { 87struct iucv_sock_list {
79 struct hlist_head head; 88 struct hlist_head head;
80 rwlock_t lock; 89 rwlock_t lock;
@@ -85,8 +94,6 @@ unsigned int iucv_sock_poll(struct file *file, struct socket *sock,
85 poll_table *wait); 94 poll_table *wait);
86void iucv_sock_link(struct iucv_sock_list *l, struct sock *s); 95void iucv_sock_link(struct iucv_sock_list *l, struct sock *s);
87void iucv_sock_unlink(struct iucv_sock_list *l, struct sock *s); 96void iucv_sock_unlink(struct iucv_sock_list *l, struct sock *s);
88int iucv_sock_wait_state(struct sock *sk, int state, int state2,
89 unsigned long timeo);
90int iucv_sock_wait_cnt(struct sock *sk, unsigned long timeo); 97int iucv_sock_wait_cnt(struct sock *sk, unsigned long timeo);
91void iucv_accept_enqueue(struct sock *parent, struct sock *sk); 98void iucv_accept_enqueue(struct sock *parent, struct sock *sk);
92void iucv_accept_unlink(struct sock *sk); 99void iucv_accept_unlink(struct sock *sk);
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 3b83a80e3fe0..c06104476973 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -19,7 +19,6 @@
19#include <linux/wireless.h> 19#include <linux/wireless.h>
20#include <linux/device.h> 20#include <linux/device.h>
21#include <linux/ieee80211.h> 21#include <linux/ieee80211.h>
22#include <net/wireless.h>
23#include <net/cfg80211.h> 22#include <net/cfg80211.h>
24 23
25/** 24/**
@@ -74,22 +73,6 @@
74 */ 73 */
75 74
76/** 75/**
77 * struct ieee80211_ht_bss_info - describing BSS's HT characteristics
78 *
79 * This structure describes most essential parameters needed
80 * to describe 802.11n HT characteristics in a BSS.
81 *
82 * @primary_channel: channel number of primery channel
83 * @bss_cap: 802.11n's general BSS capabilities (e.g. channel width)
84 * @bss_op_mode: 802.11n's BSS operation modes (e.g. HT protection)
85 */
86struct ieee80211_ht_bss_info {
87 u8 primary_channel;
88 u8 bss_cap; /* use IEEE80211_HT_IE_CHA_ */
89 u8 bss_op_mode; /* use IEEE80211_HT_IE_ */
90};
91
92/**
93 * enum ieee80211_max_queues - maximum number of queues 76 * enum ieee80211_max_queues - maximum number of queues
94 * 77 *
95 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. 78 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
@@ -150,6 +133,13 @@ struct ieee80211_low_level_stats {
150 * @BSS_CHANGED_ERP_SLOT: slot timing changed 133 * @BSS_CHANGED_ERP_SLOT: slot timing changed
151 * @BSS_CHANGED_HT: 802.11n parameters changed 134 * @BSS_CHANGED_HT: 802.11n parameters changed
152 * @BSS_CHANGED_BASIC_RATES: Basic rateset changed 135 * @BSS_CHANGED_BASIC_RATES: Basic rateset changed
136 * @BSS_CHANGED_BEACON_INT: Beacon interval changed
137 * @BSS_CHANGED_BSSID: BSSID changed, for whatever
138 * reason (IBSS and managed mode)
139 * @BSS_CHANGED_BEACON: Beacon data changed, retrieve
140 * new beacon (beaconing modes)
141 * @BSS_CHANGED_BEACON_ENABLED: Beaconing should be
142 * enabled/disabled (beaconing modes)
153 */ 143 */
154enum ieee80211_bss_change { 144enum ieee80211_bss_change {
155 BSS_CHANGED_ASSOC = 1<<0, 145 BSS_CHANGED_ASSOC = 1<<0,
@@ -158,14 +148,10 @@ enum ieee80211_bss_change {
158 BSS_CHANGED_ERP_SLOT = 1<<3, 148 BSS_CHANGED_ERP_SLOT = 1<<3,
159 BSS_CHANGED_HT = 1<<4, 149 BSS_CHANGED_HT = 1<<4,
160 BSS_CHANGED_BASIC_RATES = 1<<5, 150 BSS_CHANGED_BASIC_RATES = 1<<5,
161}; 151 BSS_CHANGED_BEACON_INT = 1<<6,
162 152 BSS_CHANGED_BSSID = 1<<7,
163/** 153 BSS_CHANGED_BEACON = 1<<8,
164 * struct ieee80211_bss_ht_conf - BSS's changing HT configuration 154 BSS_CHANGED_BEACON_ENABLED = 1<<9,
165 * @operation_mode: HT operation mode (like in &struct ieee80211_ht_info)
166 */
167struct ieee80211_bss_ht_conf {
168 u16 operation_mode;
169}; 155};
170 156
171/** 157/**
@@ -187,12 +173,16 @@ struct ieee80211_bss_ht_conf {
187 * @timestamp: beacon timestamp 173 * @timestamp: beacon timestamp
188 * @beacon_int: beacon interval 174 * @beacon_int: beacon interval
189 * @assoc_capability: capabilities taken from assoc resp 175 * @assoc_capability: capabilities taken from assoc resp
190 * @ht: BSS's HT configuration
191 * @basic_rates: bitmap of basic rates, each bit stands for an 176 * @basic_rates: bitmap of basic rates, each bit stands for an
192 * index into the rate table configured by the driver in 177 * index into the rate table configured by the driver in
193 * the current band. 178 * the current band.
179 * @bssid: The BSSID for this BSS
180 * @enable_beacon: whether beaconing should be enabled or not
181 * @ht_operation_mode: HT operation mode (like in &struct ieee80211_ht_info).
182 * This field is only valid when the channel type is one of the HT types.
194 */ 183 */
195struct ieee80211_bss_conf { 184struct ieee80211_bss_conf {
185 const u8 *bssid;
196 /* association related data */ 186 /* association related data */
197 bool assoc; 187 bool assoc;
198 u16 aid; 188 u16 aid;
@@ -200,12 +190,13 @@ struct ieee80211_bss_conf {
200 bool use_cts_prot; 190 bool use_cts_prot;
201 bool use_short_preamble; 191 bool use_short_preamble;
202 bool use_short_slot; 192 bool use_short_slot;
193 bool enable_beacon;
203 u8 dtim_period; 194 u8 dtim_period;
204 u16 beacon_int; 195 u16 beacon_int;
205 u16 assoc_capability; 196 u16 assoc_capability;
206 u64 timestamp; 197 u64 timestamp;
207 u32 basic_rates; 198 u32 basic_rates;
208 struct ieee80211_bss_ht_conf ht; 199 u16 ht_operation_mode;
209}; 200};
210 201
211/** 202/**
@@ -248,6 +239,8 @@ struct ieee80211_bss_conf {
248 * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211, 239 * @IEEE80211_TX_INTFL_NEED_TXPROCESSING: completely internal to mac80211,
249 * used to indicate that a pending frame requires TX processing before 240 * used to indicate that a pending frame requires TX processing before
250 * it can be sent out. 241 * it can be sent out.
242 * @IEEE80211_TX_INTFL_RETRIED: completely internal to mac80211,
243 * used to indicate that a frame was already retried due to PS
251 */ 244 */
252enum mac80211_tx_control_flags { 245enum mac80211_tx_control_flags {
253 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), 246 IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
@@ -265,6 +258,7 @@ enum mac80211_tx_control_flags {
265 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12), 258 IEEE80211_TX_CTL_RATE_CTRL_PROBE = BIT(12),
266 IEEE80211_TX_INTFL_RCALGO = BIT(13), 259 IEEE80211_TX_INTFL_RCALGO = BIT(13),
267 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14), 260 IEEE80211_TX_INTFL_NEED_TXPROCESSING = BIT(14),
261 IEEE80211_TX_INTFL_RETRIED = BIT(15),
268}; 262};
269 263
270/** 264/**
@@ -518,52 +512,76 @@ struct ieee80211_rx_status {
518 * Flags to define PHY configuration options 512 * Flags to define PHY configuration options
519 * 513 *
520 * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) 514 * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported)
521 * @IEEE80211_CONF_PS: Enable 802.11 power save mode 515 * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only)
516 * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set
517 * the driver should be prepared to handle configuration requests but
518 * may turn the device off as much as possible. Typically, this flag will
519 * be set when an interface is set UP but not associated or scanning, but
520 * it can also be unset in that case when monitor interfaces are active.
522 */ 521 */
523enum ieee80211_conf_flags { 522enum ieee80211_conf_flags {
524 IEEE80211_CONF_RADIOTAP = (1<<0), 523 IEEE80211_CONF_RADIOTAP = (1<<0),
525 IEEE80211_CONF_PS = (1<<1), 524 IEEE80211_CONF_PS = (1<<1),
525 IEEE80211_CONF_IDLE = (1<<2),
526}; 526};
527 527
528 528
529/** 529/**
530 * enum ieee80211_conf_changed - denotes which configuration changed 530 * enum ieee80211_conf_changed - denotes which configuration changed
531 * 531 *
532 * @IEEE80211_CONF_CHANGE_RADIO_ENABLED: the value of radio_enabled changed 532 * @_IEEE80211_CONF_CHANGE_RADIO_ENABLED: DEPRECATED
533 * @IEEE80211_CONF_CHANGE_BEACON_INTERVAL: the beacon interval changed
534 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed 533 * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
535 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed 534 * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
536 * @IEEE80211_CONF_CHANGE_PS: the PS flag changed 535 * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed
537 * @IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT: the dynamic PS timeout changed
538 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed 536 * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
539 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed 537 * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed
540 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed 538 * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
539 * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed
541 */ 540 */
542enum ieee80211_conf_changed { 541enum ieee80211_conf_changed {
543 IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0), 542 _IEEE80211_CONF_CHANGE_RADIO_ENABLED = BIT(0),
544 IEEE80211_CONF_CHANGE_BEACON_INTERVAL = BIT(1),
545 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2), 543 IEEE80211_CONF_CHANGE_LISTEN_INTERVAL = BIT(2),
546 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3), 544 IEEE80211_CONF_CHANGE_RADIOTAP = BIT(3),
547 IEEE80211_CONF_CHANGE_PS = BIT(4), 545 IEEE80211_CONF_CHANGE_PS = BIT(4),
548 IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT = BIT(5), 546 IEEE80211_CONF_CHANGE_POWER = BIT(5),
549 IEEE80211_CONF_CHANGE_POWER = BIT(6), 547 IEEE80211_CONF_CHANGE_CHANNEL = BIT(6),
550 IEEE80211_CONF_CHANGE_CHANNEL = BIT(7), 548 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(7),
551 IEEE80211_CONF_CHANGE_RETRY_LIMITS = BIT(8), 549 IEEE80211_CONF_CHANGE_IDLE = BIT(8),
552}; 550};
553 551
552static inline __deprecated enum ieee80211_conf_changed
553__IEEE80211_CONF_CHANGE_RADIO_ENABLED(void)
554{
555 return _IEEE80211_CONF_CHANGE_RADIO_ENABLED;
556}
557#define IEEE80211_CONF_CHANGE_RADIO_ENABLED \
558 __IEEE80211_CONF_CHANGE_RADIO_ENABLED()
559
554/** 560/**
555 * struct ieee80211_conf - configuration of the device 561 * struct ieee80211_conf - configuration of the device
556 * 562 *
557 * This struct indicates how the driver shall configure the hardware. 563 * This struct indicates how the driver shall configure the hardware.
558 * 564 *
565 * @flags: configuration flags defined above
566 *
559 * @radio_enabled: when zero, driver is required to switch off the radio. 567 * @radio_enabled: when zero, driver is required to switch off the radio.
560 * @beacon_int: beacon interval (TODO make interface config) 568 * @beacon_int: DEPRECATED, DO NOT USE
569 *
561 * @listen_interval: listen interval in units of beacon interval 570 * @listen_interval: listen interval in units of beacon interval
562 * @flags: configuration flags defined above 571 * @max_sleep_period: the maximum number of beacon intervals to sleep for
572 * before checking the beacon for a TIM bit (managed mode only); this
573 * value will be only achievable between DTIM frames, the hardware
574 * needs to check for the multicast traffic bit in DTIM beacons.
575 * This variable is valid only when the CONF_PS flag is set.
576 * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the
577 * powersave documentation below. This variable is valid only when
578 * the CONF_PS flag is set.
579 *
563 * @power_level: requested transmit power (in dBm) 580 * @power_level: requested transmit power (in dBm)
564 * @dynamic_ps_timeout: dynamic powersave timeout (in ms) 581 *
565 * @channel: the channel to tune to 582 * @channel: the channel to tune to
566 * @channel_type: the channel (HT) type 583 * @channel_type: the channel (HT) type
584 *
567 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame 585 * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
568 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11, 586 * (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
569 * but actually means the number of transmissions not the number of retries 587 * but actually means the number of transmissions not the number of retries
@@ -572,12 +590,13 @@ enum ieee80211_conf_changed {
572 * number of transmissions not the number of retries 590 * number of transmissions not the number of retries
573 */ 591 */
574struct ieee80211_conf { 592struct ieee80211_conf {
575 int beacon_int; 593 int __deprecated beacon_int;
576 u32 flags; 594 u32 flags;
577 int power_level, dynamic_ps_timeout; 595 int power_level, dynamic_ps_timeout;
596 int max_sleep_period;
578 597
579 u16 listen_interval; 598 u16 listen_interval;
580 bool radio_enabled; 599 bool __deprecated radio_enabled;
581 600
582 u8 long_frame_max_tx_count, short_frame_max_tx_count; 601 u8 long_frame_max_tx_count, short_frame_max_tx_count;
583 602
@@ -640,37 +659,6 @@ struct ieee80211_if_init_conf {
640}; 659};
641 660
642/** 661/**
643 * enum ieee80211_if_conf_change - interface config change flags
644 *
645 * @IEEE80211_IFCC_BSSID: The BSSID changed.
646 * @IEEE80211_IFCC_BEACON: The beacon for this interface changed
647 * (currently AP and MESH only), use ieee80211_beacon_get().
648 * @IEEE80211_IFCC_BEACON_ENABLED: The enable_beacon value changed.
649 */
650enum ieee80211_if_conf_change {
651 IEEE80211_IFCC_BSSID = BIT(0),
652 IEEE80211_IFCC_BEACON = BIT(1),
653 IEEE80211_IFCC_BEACON_ENABLED = BIT(2),
654};
655
656/**
657 * struct ieee80211_if_conf - configuration of an interface
658 *
659 * @changed: parameters that have changed, see &enum ieee80211_if_conf_change.
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.
663 *
664 * This structure is passed to the config_interface() callback of
665 * &struct ieee80211_hw.
666 */
667struct ieee80211_if_conf {
668 u32 changed;
669 const u8 *bssid;
670 bool enable_beacon;
671};
672
673/**
674 * enum ieee80211_key_alg - key algorithm 662 * enum ieee80211_key_alg - key algorithm
675 * @ALG_WEP: WEP40 or WEP104 663 * @ALG_WEP: WEP40 or WEP104
676 * @ALG_TKIP: TKIP 664 * @ALG_TKIP: TKIP
@@ -685,16 +673,6 @@ enum ieee80211_key_alg {
685}; 673};
686 674
687/** 675/**
688 * enum ieee80211_key_len - key length
689 * @LEN_WEP40: WEP 5-byte long key
690 * @LEN_WEP104: WEP 13-byte long key
691 */
692enum ieee80211_key_len {
693 LEN_WEP40 = 5,
694 LEN_WEP104 = 13,
695};
696
697/**
698 * enum ieee80211_key_flags - key flags 676 * enum ieee80211_key_flags - key flags
699 * 677 *
700 * These flags are used for communication about keys between the driver 678 * These flags are used for communication about keys between the driver
@@ -1109,11 +1087,9 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1109 * need software support for parsing the TIM bitmap. This is also supported 1087 * need software support for parsing the TIM bitmap. This is also supported
1110 * by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and 1088 * by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and
1111 * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still 1089 * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still
1112 * required to pass up beacons. Additionally, in this case, mac80211 will 1090 * required to pass up beacons. The hardware is still required to handle
1113 * wake up the hardware when multicast traffic is announced in the beacon. 1091 * waking up for multicast traffic; if it cannot the driver must handle that
1114 * 1092 * as best as it can, mac80211 is too slow.
1115 * FIXME: I don't think we can be fast enough in software when we want to
1116 * receive multicast traffic?
1117 * 1093 *
1118 * Dynamic powersave mode is an extension to normal powersave mode in which 1094 * 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 1095 * the hardware stays awake for a user-specified period of time after sending
@@ -1134,11 +1110,53 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
1134 * way the host will only receive beacons where some relevant information 1110 * way the host will only receive beacons where some relevant information
1135 * (for example ERP protection or WMM settings) have changed. 1111 * (for example ERP protection or WMM settings) have changed.
1136 * 1112 *
1137 * Beacon filter support is informed with %IEEE80211_HW_BEACON_FILTER flag. 1113 * Beacon filter support is advertised with the %IEEE80211_HW_BEACON_FILTER
1138 * The driver needs to enable beacon filter support whenever power save is 1114 * hardware capability. The driver needs to enable beacon filter support
1139 * enabled, that is %IEEE80211_CONF_PS is set. When power save is enabled, 1115 * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When
1140 * the stack will not check for beacon miss at all and the driver needs to 1116 * power save is enabled, the stack will not check for beacon loss and the
1141 * notify about complete loss of beacons with ieee80211_beacon_loss(). 1117 * driver needs to notify about loss of beacons with ieee80211_beacon_loss().
1118 *
1119 * The time (or number of beacons missed) until the firmware notifies the
1120 * driver of a beacon loss event (which in turn causes the driver to call
1121 * ieee80211_beacon_loss()) should be configurable and will be controlled
1122 * by mac80211 and the roaming algorithm in the future.
1123 *
1124 * Since there may be constantly changing information elements that nothing
1125 * in the software stack cares about, we will, in the future, have mac80211
1126 * tell the driver which information elements are interesting in the sense
1127 * that we want to see changes in them. This will include
1128 * - a list of information element IDs
1129 * - a list of OUIs for the vendor information element
1130 *
1131 * Ideally, the hardware would filter out any beacons without changes in the
1132 * requested elements, but if it cannot support that it may, at the expense
1133 * of some efficiency, filter out only a subset. For example, if the device
1134 * doesn't support checking for OUIs it should pass up all changes in all
1135 * vendor information elements.
1136 *
1137 * Note that change, for the sake of simplification, also includes information
1138 * elements appearing or disappearing from the beacon.
1139 *
1140 * Some hardware supports an "ignore list" instead, just make sure nothing
1141 * that was requested is on the ignore list, and include commonly changing
1142 * information element IDs in the ignore list, for example 11 (BSS load) and
1143 * the various vendor-assigned IEs with unknown contents (128, 129, 133-136,
1144 * 149, 150, 155, 156, 173, 176, 178, 179, 219); for forward compatibility
1145 * it could also include some currently unused IDs.
1146 *
1147 *
1148 * In addition to these capabilities, hardware should support notifying the
1149 * host of changes in the beacon RSSI. This is relevant to implement roaming
1150 * when no traffic is flowing (when traffic is flowing we see the RSSI of
1151 * the received data packets). This can consist in notifying the host when
1152 * the RSSI changes significantly or when it drops below or rises above
1153 * configurable thresholds. In the future these thresholds will also be
1154 * configured by mac80211 (which gets them from userspace) to implement
1155 * them as the roaming algorithm requires.
1156 *
1157 * If the hardware cannot implement this, the driver should ask it to
1158 * periodically pass beacon frames to the host so that software can do the
1159 * signal strength threshold checking.
1142 */ 1160 */
1143 1161
1144/** 1162/**
@@ -1298,10 +1316,6 @@ enum ieee80211_ampdu_mlme_action {
1298 * This function should never fail but returns a negative error code 1316 * This function should never fail but returns a negative error code
1299 * if it does. 1317 * if it does.
1300 * 1318 *
1301 * @config_interface: Handler for configuration requests related to interfaces
1302 * (e.g. BSSID changes.)
1303 * Returns a negative error code which will be seen in userspace.
1304 *
1305 * @bss_info_changed: Handler for configuration requests related to BSS 1319 * @bss_info_changed: Handler for configuration requests related to BSS
1306 * parameters that may vary during BSS's lifespan, and may affect low 1320 * parameters that may vary during BSS's lifespan, and may affect low
1307 * level driver (e.g. assoc/disassoc status, erp parameters). 1321 * level driver (e.g. assoc/disassoc status, erp parameters).
@@ -1330,11 +1344,14 @@ enum ieee80211_ampdu_mlme_action {
1330 * the scan state machine in stack. The scan must honour the channel 1344 * the scan state machine in stack. The scan must honour the channel
1331 * configuration done by the regulatory agent in the wiphy's 1345 * configuration done by the regulatory agent in the wiphy's
1332 * registered bands. The hardware (or the driver) needs to make sure 1346 * registered bands. The hardware (or the driver) needs to make sure
1333 * that power save is disabled. When the scan finishes, 1347 * that power save is disabled.
1334 * ieee80211_scan_completed() must be called; note that it also must 1348 * The @req ie/ie_len members are rewritten by mac80211 to contain the
1335 * be called when the scan cannot finish because the hardware is 1349 * entire IEs after the SSID, so that drivers need not look at these
1336 * turned off! Anything else is a bug! Returns a negative error code 1350 * at all but just send them after the SSID -- mac80211 includes the
1337 * which will be seen in userspace. 1351 * (extended) supported rates and HT information (where applicable).
1352 * When the scan finishes, ieee80211_scan_completed() must be called;
1353 * note that it also must be called when the scan cannot finish due to
1354 * any error unless this callback returned a negative error code.
1338 * 1355 *
1339 * @sw_scan_start: Notifier function that is called just before a software scan 1356 * @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. 1357 * is started. Can be NULL, if the driver doesn't need this notification.
@@ -1390,6 +1407,10 @@ enum ieee80211_ampdu_mlme_action {
1390 * is the first frame we expect to perform the action on. Notice 1407 * is the first frame we expect to perform the action on. Notice
1391 * that TX/RX_STOP can pass NULL for this parameter. 1408 * that TX/RX_STOP can pass NULL for this parameter.
1392 * Returns a negative error code on failure. 1409 * Returns a negative error code on failure.
1410 *
1411 * @rfkill_poll: Poll rfkill hardware state. If you need this, you also
1412 * need to set wiphy->rfkill_poll to %true before registration,
1413 * and need to call wiphy_rfkill_set_hw_state() in the callback.
1393 */ 1414 */
1394struct ieee80211_ops { 1415struct ieee80211_ops {
1395 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 1416 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
@@ -1400,9 +1421,6 @@ struct ieee80211_ops {
1400 void (*remove_interface)(struct ieee80211_hw *hw, 1421 void (*remove_interface)(struct ieee80211_hw *hw,
1401 struct ieee80211_if_init_conf *conf); 1422 struct ieee80211_if_init_conf *conf);
1402 int (*config)(struct ieee80211_hw *hw, u32 changed); 1423 int (*config)(struct ieee80211_hw *hw, u32 changed);
1403 int (*config_interface)(struct ieee80211_hw *hw,
1404 struct ieee80211_vif *vif,
1405 struct ieee80211_if_conf *conf);
1406 void (*bss_info_changed)(struct ieee80211_hw *hw, 1424 void (*bss_info_changed)(struct ieee80211_hw *hw,
1407 struct ieee80211_vif *vif, 1425 struct ieee80211_vif *vif,
1408 struct ieee80211_bss_conf *info, 1426 struct ieee80211_bss_conf *info,
@@ -1441,6 +1459,8 @@ struct ieee80211_ops {
1441 int (*ampdu_action)(struct ieee80211_hw *hw, 1459 int (*ampdu_action)(struct ieee80211_hw *hw,
1442 enum ieee80211_ampdu_mlme_action action, 1460 enum ieee80211_ampdu_mlme_action action,
1443 struct ieee80211_sta *sta, u16 tid, u16 *ssn); 1461 struct ieee80211_sta *sta, u16 tid, u16 *ssn);
1462
1463 void (*rfkill_poll)(struct ieee80211_hw *hw);
1444}; 1464};
1445 1465
1446/** 1466/**
@@ -1572,6 +1592,20 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw);
1572 */ 1592 */
1573void ieee80211_free_hw(struct ieee80211_hw *hw); 1593void ieee80211_free_hw(struct ieee80211_hw *hw);
1574 1594
1595/**
1596 * ieee80211_restart_hw - restart hardware completely
1597 *
1598 * Call this function when the hardware was restarted for some reason
1599 * (hardware error, ...) and the driver is unable to restore its state
1600 * by itself. mac80211 assumes that at this point the driver/hardware
1601 * is completely uninitialised and stopped, it starts the process by
1602 * calling the ->start() operation. The driver will need to reset all
1603 * internal state that it has prior to calling this function.
1604 *
1605 * @hw: the hardware to restart
1606 */
1607void ieee80211_restart_hw(struct ieee80211_hw *hw);
1608
1575/* trick to avoid symbol clashes with the ieee80211 subsystem */ 1609/* trick to avoid symbol clashes with the ieee80211 subsystem */
1576void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb, 1610void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1577 struct ieee80211_rx_status *status); 1611 struct ieee80211_rx_status *status);
@@ -1775,24 +1809,6 @@ struct sk_buff *
1775ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif); 1809ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
1776 1810
1777/** 1811/**
1778 * ieee80211_get_hdrlen_from_skb - get header length from data
1779 *
1780 * Given an skb with a raw 802.11 header at the data pointer this function
1781 * returns the 802.11 header length in bytes (not including encryption
1782 * headers). If the data in the sk_buff is too short to contain a valid 802.11
1783 * header the function returns 0.
1784 *
1785 * @skb: the frame
1786 */
1787unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
1788
1789/**
1790 * ieee80211_hdrlen - get header length in bytes from frame control
1791 * @fc: frame control field in little-endian format
1792 */
1793unsigned int ieee80211_hdrlen(__le16 fc);
1794
1795/**
1796 * ieee80211_get_tkip_key - get a TKIP rc4 for skb 1812 * ieee80211_get_tkip_key - get a TKIP rc4 for skb
1797 * 1813 *
1798 * This function computes a TKIP rc4 key for an skb. It computes 1814 * This function computes a TKIP rc4 key for an skb. It computes
diff --git a/include/net/netfilter/ipv4/nf_conntrack_icmp.h b/include/net/netfilter/ipv4/nf_conntrack_icmp.h
deleted file mode 100644
index 3dd22cff23ec..000000000000
--- a/include/net/netfilter/ipv4/nf_conntrack_icmp.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef _NF_CONNTRACK_ICMP_H
2#define _NF_CONNTRACK_ICMP_H
3/* ICMP tracking. */
4#include <asm/atomic.h>
5
6struct ip_ct_icmp
7{
8 /* Optimization: when number in == number out, forget immediately. */
9 atomic_t count;
10};
11#endif /* _NF_CONNTRACK_ICMP_H */
diff --git a/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h b/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h
index 86591afda29c..67edd50a398a 100644
--- a/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h
+++ b/include/net/netfilter/ipv6/nf_conntrack_icmpv6.h
@@ -9,7 +9,6 @@
9 9
10#ifndef _NF_CONNTRACK_ICMPV6_H 10#ifndef _NF_CONNTRACK_ICMPV6_H
11#define _NF_CONNTRACK_ICMPV6_H 11#define _NF_CONNTRACK_ICMPV6_H
12#include <asm/atomic.h>
13 12
14#ifndef ICMPV6_NI_QUERY 13#ifndef ICMPV6_NI_QUERY
15#define ICMPV6_NI_QUERY 139 14#define ICMPV6_NI_QUERY 139
@@ -18,10 +17,4 @@
18#define ICMPV6_NI_REPLY 140 17#define ICMPV6_NI_REPLY 140
19#endif 18#endif
20 19
21struct nf_ct_icmpv6
22{
23 /* Optimization: when number in == number out, forget immediately. */
24 atomic_t count;
25};
26
27#endif /* _NF_CONNTRACK_ICMPV6_H */ 20#endif /* _NF_CONNTRACK_ICMPV6_H */
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 6c3f964de9e1..a632689b61b4 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -23,7 +23,6 @@
23#include <linux/netfilter/nf_conntrack_dccp.h> 23#include <linux/netfilter/nf_conntrack_dccp.h>
24#include <linux/netfilter/nf_conntrack_sctp.h> 24#include <linux/netfilter/nf_conntrack_sctp.h>
25#include <linux/netfilter/nf_conntrack_proto_gre.h> 25#include <linux/netfilter/nf_conntrack_proto_gre.h>
26#include <net/netfilter/ipv4/nf_conntrack_icmp.h>
27#include <net/netfilter/ipv6/nf_conntrack_icmpv6.h> 26#include <net/netfilter/ipv6/nf_conntrack_icmpv6.h>
28 27
29#include <net/netfilter/nf_conntrack_tuple.h> 28#include <net/netfilter/nf_conntrack_tuple.h>
@@ -34,8 +33,6 @@ union nf_conntrack_proto {
34 struct nf_ct_dccp dccp; 33 struct nf_ct_dccp dccp;
35 struct ip_ct_sctp sctp; 34 struct ip_ct_sctp sctp;
36 struct ip_ct_tcp tcp; 35 struct ip_ct_tcp tcp;
37 struct ip_ct_icmp icmp;
38 struct nf_ct_icmpv6 icmpv6;
39 struct nf_ct_gre gre; 36 struct nf_ct_gre gre;
40}; 37};
41 38
@@ -96,6 +93,8 @@ struct nf_conn {
96 plus 1 for any connection(s) we are `master' for */ 93 plus 1 for any connection(s) we are `master' for */
97 struct nf_conntrack ct_general; 94 struct nf_conntrack ct_general;
98 95
96 spinlock_t lock;
97
99 /* XXX should I move this to the tail ? - Y.K */ 98 /* XXX should I move this to the tail ? - Y.K */
100 /* These are my tuples; original and reply */ 99 /* These are my tuples; original and reply */
101 struct nf_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX]; 100 struct nf_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX];
@@ -144,6 +143,8 @@ static inline u_int8_t nf_ct_protonum(const struct nf_conn *ct)
144 return ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum; 143 return ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum;
145} 144}
146 145
146#define nf_ct_tuple(ct, dir) (&(ct)->tuplehash[dir].tuple)
147
147/* get master conntrack via master expectation */ 148/* get master conntrack via master expectation */
148#define master_ct(conntr) (conntr->master) 149#define master_ct(conntr) (conntr->master)
149 150
@@ -200,8 +201,10 @@ extern struct nf_conntrack_tuple_hash *
200__nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple); 201__nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple);
201 202
202extern void nf_conntrack_hash_insert(struct nf_conn *ct); 203extern void nf_conntrack_hash_insert(struct nf_conn *ct);
204extern void nf_ct_delete_from_lists(struct nf_conn *ct);
205extern void nf_ct_insert_dying_list(struct nf_conn *ct);
203 206
204extern void nf_conntrack_flush(struct net *net, u32 pid, int report); 207extern void nf_conntrack_flush_report(struct net *net, u32 pid, int report);
205 208
206extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, 209extern bool nf_ct_get_tuplepr(const struct sk_buff *skb,
207 unsigned int nhoff, u_int16_t l3num, 210 unsigned int nhoff, u_int16_t l3num,
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 0ff0dc69ca4a..4f20d58e2ab7 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -6,17 +6,54 @@
6#define _NF_CONNTRACK_ECACHE_H 6#define _NF_CONNTRACK_ECACHE_H
7#include <net/netfilter/nf_conntrack.h> 7#include <net/netfilter/nf_conntrack.h>
8 8
9#include <linux/notifier.h>
10#include <linux/interrupt.h>
11#include <net/net_namespace.h> 9#include <net/net_namespace.h>
12#include <net/netfilter/nf_conntrack_expect.h> 10#include <net/netfilter/nf_conntrack_expect.h>
11#include <linux/netfilter/nf_conntrack_common.h>
12#include <linux/netfilter/nf_conntrack_tuple_common.h>
13#include <net/netfilter/nf_conntrack_extend.h>
14
15/* Connection tracking event types */
16enum ip_conntrack_events
17{
18 IPCT_NEW = 0, /* new conntrack */
19 IPCT_RELATED = 1, /* related conntrack */
20 IPCT_DESTROY = 2, /* destroyed conntrack */
21 IPCT_STATUS = 3, /* status has changed */
22 IPCT_PROTOINFO = 4, /* protocol information has changed */
23 IPCT_HELPER = 5, /* new helper has been set */
24 IPCT_MARK = 6, /* new mark has been set */
25 IPCT_NATSEQADJ = 7, /* NAT is doing sequence adjustment */
26 IPCT_SECMARK = 8, /* new security mark has been set */
27};
28
29enum ip_conntrack_expect_events {
30 IPEXP_NEW = 0, /* new expectation */
31};
13 32
14#ifdef CONFIG_NF_CONNTRACK_EVENTS
15struct nf_conntrack_ecache { 33struct nf_conntrack_ecache {
16 struct nf_conn *ct; 34 unsigned long cache; /* bitops want long */
17 unsigned int events; 35 unsigned long missed; /* missed events */
36 u32 pid; /* netlink pid of destroyer */
37};
38
39static inline struct nf_conntrack_ecache *
40nf_ct_ecache_find(const struct nf_conn *ct)
41{
42 return nf_ct_ext_find(ct, NF_CT_EXT_ECACHE);
43}
44
45static inline struct nf_conntrack_ecache *
46nf_ct_ecache_ext_add(struct nf_conn *ct, gfp_t gfp)
47{
48 struct net *net = nf_ct_net(ct);
49
50 if (!net->ct.sysctl_events)
51 return NULL;
52
53 return nf_ct_ext_add(ct, NF_CT_EXT_ECACHE, gfp);
18}; 54};
19 55
56#ifdef CONFIG_NF_CONNTRACK_EVENTS
20/* This structure is passed to event handler */ 57/* This structure is passed to event handler */
21struct nf_ct_event { 58struct nf_ct_event {
22 struct nf_conn *ct; 59 struct nf_conn *ct;
@@ -24,47 +61,96 @@ struct nf_ct_event {
24 int report; 61 int report;
25}; 62};
26 63
27extern struct atomic_notifier_head nf_conntrack_chain; 64struct nf_ct_event_notifier {
28extern int nf_conntrack_register_notifier(struct notifier_block *nb); 65 int (*fcn)(unsigned int events, struct nf_ct_event *item);
29extern int nf_conntrack_unregister_notifier(struct notifier_block *nb); 66};
67
68extern struct nf_ct_event_notifier *nf_conntrack_event_cb;
69extern int nf_conntrack_register_notifier(struct nf_ct_event_notifier *nb);
70extern void nf_conntrack_unregister_notifier(struct nf_ct_event_notifier *nb);
30 71
31extern void nf_ct_deliver_cached_events(const struct nf_conn *ct); 72extern void nf_ct_deliver_cached_events(struct nf_conn *ct);
32extern void __nf_ct_event_cache_init(struct nf_conn *ct);
33extern void nf_ct_event_cache_flush(struct net *net);
34 73
35static inline void 74static inline void
36nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct) 75nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
37{ 76{
77 struct nf_conntrack_ecache *e;
78
79 if (nf_conntrack_event_cb == NULL)
80 return;
81
82 e = nf_ct_ecache_find(ct);
83 if (e == NULL)
84 return;
85
86 set_bit(event, &e->cache);
87}
88
89static inline int
90nf_conntrack_eventmask_report(unsigned int eventmask,
91 struct nf_conn *ct,
92 u32 pid,
93 int report)
94{
95 int ret = 0;
38 struct net *net = nf_ct_net(ct); 96 struct net *net = nf_ct_net(ct);
39 struct nf_conntrack_ecache *ecache; 97 struct nf_ct_event_notifier *notify;
40 98 struct nf_conntrack_ecache *e;
41 local_bh_disable(); 99
42 ecache = per_cpu_ptr(net->ct.ecache, raw_smp_processor_id()); 100 rcu_read_lock();
43 if (ct != ecache->ct) 101 notify = rcu_dereference(nf_conntrack_event_cb);
44 __nf_ct_event_cache_init(ct); 102 if (notify == NULL)
45 ecache->events |= event; 103 goto out_unlock;
46 local_bh_enable(); 104
105 if (!net->ct.sysctl_events)
106 goto out_unlock;
107
108 e = nf_ct_ecache_find(ct);
109 if (e == NULL)
110 goto out_unlock;
111
112 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) {
113 struct nf_ct_event item = {
114 .ct = ct,
115 .pid = e->pid ? e->pid : pid,
116 .report = report
117 };
118 /* This is a resent of a destroy event? If so, skip missed */
119 unsigned long missed = e->pid ? 0 : e->missed;
120
121 ret = notify->fcn(eventmask | missed, &item);
122 if (unlikely(ret < 0 || missed)) {
123 spin_lock_bh(&ct->lock);
124 if (ret < 0) {
125 /* This is a destroy event that has been
126 * triggered by a process, we store the PID
127 * to include it in the retransmission. */
128 if (eventmask & (1 << IPCT_DESTROY) &&
129 e->pid == 0 && pid != 0)
130 e->pid = pid;
131 else
132 e->missed |= eventmask;
133 } else
134 e->missed &= ~missed;
135 spin_unlock_bh(&ct->lock);
136 }
137 }
138out_unlock:
139 rcu_read_unlock();
140 return ret;
47} 141}
48 142
49static inline void 143static inline int
50nf_conntrack_event_report(enum ip_conntrack_events event, 144nf_conntrack_event_report(enum ip_conntrack_events event, struct nf_conn *ct,
51 struct nf_conn *ct, 145 u32 pid, int report)
52 u32 pid,
53 int report)
54{ 146{
55 struct nf_ct_event item = { 147 return nf_conntrack_eventmask_report(1 << event, ct, pid, report);
56 .ct = ct,
57 .pid = pid,
58 .report = report
59 };
60 if (nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
61 atomic_notifier_call_chain(&nf_conntrack_chain, event, &item);
62} 148}
63 149
64static inline void 150static inline int
65nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct) 151nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct)
66{ 152{
67 nf_conntrack_event_report(event, ct, 0, 0); 153 return nf_conntrack_eventmask_report(1 << event, ct, 0, 0);
68} 154}
69 155
70struct nf_exp_event { 156struct nf_exp_event {
@@ -73,9 +159,13 @@ struct nf_exp_event {
73 int report; 159 int report;
74}; 160};
75 161
76extern struct atomic_notifier_head nf_ct_expect_chain; 162struct nf_exp_event_notifier {
77extern int nf_ct_expect_register_notifier(struct notifier_block *nb); 163 int (*fcn)(unsigned int events, struct nf_exp_event *item);
78extern int nf_ct_expect_unregister_notifier(struct notifier_block *nb); 164};
165
166extern struct nf_exp_event_notifier *nf_expect_event_cb;
167extern int nf_ct_expect_register_notifier(struct nf_exp_event_notifier *nb);
168extern void nf_ct_expect_unregister_notifier(struct nf_exp_event_notifier *nb);
79 169
80static inline void 170static inline void
81nf_ct_expect_event_report(enum ip_conntrack_expect_events event, 171nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
@@ -83,12 +173,27 @@ nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
83 u32 pid, 173 u32 pid,
84 int report) 174 int report)
85{ 175{
86 struct nf_exp_event item = { 176 struct net *net = nf_ct_exp_net(exp);
87 .exp = exp, 177 struct nf_exp_event_notifier *notify;
88 .pid = pid, 178
89 .report = report 179 rcu_read_lock();
90 }; 180 notify = rcu_dereference(nf_expect_event_cb);
91 atomic_notifier_call_chain(&nf_ct_expect_chain, event, &item); 181 if (notify == NULL)
182 goto out_unlock;
183
184 if (!net->ct.sysctl_events)
185 goto out_unlock;
186
187 {
188 struct nf_exp_event item = {
189 .exp = exp,
190 .pid = pid,
191 .report = report
192 };
193 notify->fcn(1 << event, &item);
194 }
195out_unlock:
196 rcu_read_unlock();
92} 197}
93 198
94static inline void 199static inline void
@@ -105,12 +210,16 @@ extern void nf_conntrack_ecache_fini(struct net *net);
105 210
106static inline void nf_conntrack_event_cache(enum ip_conntrack_events event, 211static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
107 struct nf_conn *ct) {} 212 struct nf_conn *ct) {}
108static inline void nf_conntrack_event(enum ip_conntrack_events event, 213static inline int nf_conntrack_eventmask_report(unsigned int eventmask,
109 struct nf_conn *ct) {} 214 struct nf_conn *ct,
110static inline void nf_conntrack_event_report(enum ip_conntrack_events event, 215 u32 pid,
111 struct nf_conn *ct, 216 int report) { return 0; }
112 u32 pid, 217static inline int nf_conntrack_event(enum ip_conntrack_events event,
113 int report) {} 218 struct nf_conn *ct) { return 0; }
219static inline int nf_conntrack_event_report(enum ip_conntrack_events event,
220 struct nf_conn *ct,
221 u32 pid,
222 int report) { return 0; }
114static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {} 223static inline void nf_ct_deliver_cached_events(const struct nf_conn *ct) {}
115static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event, 224static inline void nf_ct_expect_event(enum ip_conntrack_expect_events event,
116 struct nf_conntrack_expect *exp) {} 225 struct nf_conntrack_expect *exp) {}
@@ -118,7 +227,6 @@ static inline void nf_ct_expect_event_report(enum ip_conntrack_expect_events e,
118 struct nf_conntrack_expect *exp, 227 struct nf_conntrack_expect *exp,
119 u32 pid, 228 u32 pid,
120 int report) {} 229 int report) {}
121static inline void nf_ct_event_cache_flush(struct net *net) {}
122 230
123static inline int nf_conntrack_ecache_init(struct net *net) 231static inline int nf_conntrack_ecache_init(struct net *net)
124{ 232{
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index da8ee52613a5..7f8fc5d123c5 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -8,12 +8,14 @@ enum nf_ct_ext_id
8 NF_CT_EXT_HELPER, 8 NF_CT_EXT_HELPER,
9 NF_CT_EXT_NAT, 9 NF_CT_EXT_NAT,
10 NF_CT_EXT_ACCT, 10 NF_CT_EXT_ACCT,
11 NF_CT_EXT_ECACHE,
11 NF_CT_EXT_NUM, 12 NF_CT_EXT_NUM,
12}; 13};
13 14
14#define NF_CT_EXT_HELPER_TYPE struct nf_conn_help 15#define NF_CT_EXT_HELPER_TYPE struct nf_conn_help
15#define NF_CT_EXT_NAT_TYPE struct nf_conn_nat 16#define NF_CT_EXT_NAT_TYPE struct nf_conn_nat
16#define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter 17#define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter
18#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache
17 19
18/* Extensions: optional stuff which isn't permanently in struct. */ 20/* Extensions: optional stuff which isn't permanently in struct. */
19struct nf_ct_ext { 21struct nf_ct_ext {
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index ee2a4b369a04..1b7068000927 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -50,6 +50,8 @@ extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp);
50 50
51extern int __nf_ct_try_assign_helper(struct nf_conn *ct, gfp_t flags); 51extern int __nf_ct_try_assign_helper(struct nf_conn *ct, gfp_t flags);
52 52
53extern void nf_ct_helper_destroy(struct nf_conn *ct);
54
53static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct) 55static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
54{ 56{
55 return nf_ct_ext_find(ct, NF_CT_EXT_HELPER); 57 return nf_ct_ext_find(ct, NF_CT_EXT_HELPER);
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index ba32ed7bdabe..3767fb41e541 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -59,11 +59,11 @@ struct nf_conntrack_l4proto
59 const struct nf_conntrack_tuple *); 59 const struct nf_conntrack_tuple *);
60 60
61 /* Print out the private part of the conntrack. */ 61 /* Print out the private part of the conntrack. */
62 int (*print_conntrack)(struct seq_file *s, const struct nf_conn *); 62 int (*print_conntrack)(struct seq_file *s, struct nf_conn *);
63 63
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 struct nf_conn *ct);
67 /* Calculate protoinfo nlattr size */ 67 /* Calculate protoinfo nlattr size */
68 int (*nlattr_size)(void); 68 int (*nlattr_size)(void);
69 69
diff --git a/include/net/netlink.h b/include/net/netlink.h
index eddb50289d6d..007bdb07dabb 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -940,6 +940,15 @@ static inline u64 nla_get_u64(const struct nlattr *nla)
940} 940}
941 941
942/** 942/**
943 * nla_get_be64 - return payload of __be64 attribute
944 * @nla: __be64 netlink attribute
945 */
946static inline __be64 nla_get_be64(const struct nlattr *nla)
947{
948 return *(__be64 *) nla_data(nla);
949}
950
951/**
943 * nla_get_flag - return payload of flag attribute 952 * nla_get_flag - return payload of flag attribute
944 * @nla: flag netlink attribute 953 * @nla: flag netlink attribute
945 */ 954 */
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index 9dc58402bc09..ba1ba0c5efd1 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -14,16 +14,17 @@ struct netns_ct {
14 struct hlist_nulls_head *hash; 14 struct hlist_nulls_head *hash;
15 struct hlist_head *expect_hash; 15 struct hlist_head *expect_hash;
16 struct hlist_nulls_head unconfirmed; 16 struct hlist_nulls_head unconfirmed;
17 struct hlist_nulls_head dying;
17 struct ip_conntrack_stat *stat; 18 struct ip_conntrack_stat *stat;
18#ifdef CONFIG_NF_CONNTRACK_EVENTS 19 int sysctl_events;
19 struct nf_conntrack_ecache *ecache; 20 unsigned int sysctl_events_retry_timeout;
20#endif
21 int sysctl_acct; 21 int sysctl_acct;
22 int sysctl_checksum; 22 int sysctl_checksum;
23 unsigned int sysctl_log_invalid; /* Log invalid packets */ 23 unsigned int sysctl_log_invalid; /* Log invalid packets */
24#ifdef CONFIG_SYSCTL 24#ifdef CONFIG_SYSCTL
25 struct ctl_table_header *sysctl_header; 25 struct ctl_table_header *sysctl_header;
26 struct ctl_table_header *acct_sysctl_header; 26 struct ctl_table_header *acct_sysctl_header;
27 struct ctl_table_header *event_sysctl_header;
27#endif 28#endif
28 int hash_vmalloc; 29 int hash_vmalloc;
29 int expect_vmalloc; 30 int expect_vmalloc;
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index e37fe3129c17..82a3191375f5 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -41,16 +41,17 @@ static inline void *qdisc_priv(struct Qdisc *q)
41typedef u64 psched_time_t; 41typedef u64 psched_time_t;
42typedef long psched_tdiff_t; 42typedef long psched_tdiff_t;
43 43
44/* Avoid doing 64 bit divide by 1000 */ 44/* Avoid doing 64 bit divide */
45#define PSCHED_US2NS(x) ((s64)(x) << 10) 45#define PSCHED_SHIFT 6
46#define PSCHED_NS2US(x) ((x) >> 10) 46#define PSCHED_TICKS2NS(x) ((s64)(x) << PSCHED_SHIFT)
47#define PSCHED_NS2TICKS(x) ((x) >> PSCHED_SHIFT)
47 48
48#define PSCHED_TICKS_PER_SEC PSCHED_NS2US(NSEC_PER_SEC) 49#define PSCHED_TICKS_PER_SEC PSCHED_NS2TICKS(NSEC_PER_SEC)
49#define PSCHED_PASTPERFECT 0 50#define PSCHED_PASTPERFECT 0
50 51
51static inline psched_time_t psched_get_time(void) 52static inline psched_time_t psched_get_time(void)
52{ 53{
53 return PSCHED_NS2US(ktime_to_ns(ktime_get())); 54 return PSCHED_NS2TICKS(ktime_to_ns(ktime_get()));
54} 55}
55 56
56static inline psched_tdiff_t 57static inline psched_tdiff_t
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
new file mode 100644
index 000000000000..47995b81c5d7
--- /dev/null
+++ b/include/net/regulatory.h
@@ -0,0 +1,101 @@
1#ifndef __NET_REGULATORY_H
2#define __NET_REGULATORY_H
3/*
4 * regulatory support structures
5 *
6 * Copyright 2008-2009 Luis R. Rodriguez <lrodriguez@atheros.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13
14/**
15 * enum environment_cap - Environment parsed from country IE
16 * @ENVIRON_ANY: indicates country IE applies to both indoor and
17 * outdoor operation.
18 * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
19 * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
20 */
21enum environment_cap {
22 ENVIRON_ANY,
23 ENVIRON_INDOOR,
24 ENVIRON_OUTDOOR,
25};
26
27/**
28 * struct regulatory_request - used to keep track of regulatory requests
29 *
30 * @wiphy_idx: this is set if this request's initiator is
31 * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
32 * can be used by the wireless core to deal with conflicts
33 * and potentially inform users of which devices specifically
34 * cased the conflicts.
35 * @initiator: indicates who sent this request, could be any of
36 * of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*)
37 * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
38 * regulatory domain. We have a few special codes:
39 * 00 - World regulatory domain
40 * 99 - built by driver but a specific alpha2 cannot be determined
41 * 98 - result of an intersection between two regulatory domains
42 * @intersect: indicates whether the wireless core should intersect
43 * the requested regulatory domain with the presently set regulatory
44 * domain.
45 * @country_ie_checksum: checksum of the last processed and accepted
46 * country IE
47 * @country_ie_env: lets us know if the AP is telling us we are outdoor,
48 * indoor, or if it doesn't matter
49 * @list: used to insert into the reg_requests_list linked list
50 */
51struct regulatory_request {
52 int wiphy_idx;
53 enum nl80211_reg_initiator initiator;
54 char alpha2[2];
55 bool intersect;
56 u32 country_ie_checksum;
57 enum environment_cap country_ie_env;
58 struct list_head list;
59};
60
61struct ieee80211_freq_range {
62 u32 start_freq_khz;
63 u32 end_freq_khz;
64 u32 max_bandwidth_khz;
65};
66
67struct ieee80211_power_rule {
68 u32 max_antenna_gain;
69 u32 max_eirp;
70};
71
72struct ieee80211_reg_rule {
73 struct ieee80211_freq_range freq_range;
74 struct ieee80211_power_rule power_rule;
75 u32 flags;
76};
77
78struct ieee80211_regdomain {
79 u32 n_reg_rules;
80 char alpha2[2];
81 struct ieee80211_reg_rule reg_rules[];
82};
83
84#define MHZ_TO_KHZ(freq) ((freq) * 1000)
85#define KHZ_TO_MHZ(freq) ((freq) / 1000)
86#define DBI_TO_MBI(gain) ((gain) * 100)
87#define MBI_TO_DBI(gain) ((gain) / 100)
88#define DBM_TO_MBM(gain) ((gain) * 100)
89#define MBM_TO_DBM(gain) ((gain) / 100)
90
91#define REG_RULE(start, end, bw, gain, eirp, reg_flags) \
92{ \
93 .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
94 .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
95 .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
96 .power_rule.max_antenna_gain = DBI_TO_MBI(gain),\
97 .power_rule.max_eirp = DBM_TO_MBM(eirp), \
98 .flags = reg_flags, \
99}
100
101#endif
diff --git a/include/net/route.h b/include/net/route.h
index 4e8cae0e5841..40f6346ef496 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -210,7 +210,7 @@ static inline struct inet_peer *rt_get_peer(struct rtable *rt)
210 210
211static inline int inet_iif(const struct sk_buff *skb) 211static inline int inet_iif(const struct sk_buff *skb)
212{ 212{
213 return skb->rtable->rt_iif; 213 return skb_rtable(skb)->rt_iif;
214} 214}
215 215
216#endif /* _ROUTE_H */ 216#endif /* _ROUTE_H */
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 23f08fe1d50a..edfcacf3250e 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -1939,10 +1939,8 @@ void sctp_association_free(struct sctp_association *);
1939void sctp_association_put(struct sctp_association *); 1939void sctp_association_put(struct sctp_association *);
1940void sctp_association_hold(struct sctp_association *); 1940void sctp_association_hold(struct sctp_association *);
1941 1941
1942struct sctp_transport *sctp_assoc_choose_init_transport( 1942struct sctp_transport *sctp_assoc_choose_alter_transport(
1943 struct sctp_association *); 1943 struct sctp_association *, struct sctp_transport *);
1944struct sctp_transport *sctp_assoc_choose_shutdown_transport(
1945 struct sctp_association *);
1946void sctp_assoc_update_retran_path(struct sctp_association *); 1944void sctp_assoc_update_retran_path(struct sctp_association *);
1947struct sctp_transport *sctp_assoc_lookup_paddr(const struct sctp_association *, 1945struct sctp_transport *sctp_assoc_lookup_paddr(const struct sctp_association *,
1948 const union sctp_addr *); 1946 const union sctp_addr *);
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index b259fc5798fb..1580c04f68bc 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -147,6 +147,8 @@ enum sctp_optname {
147#define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS 147#define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS
148 SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */ 148 SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */
149#define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX 149#define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX
150 SCTP_SOCKOPT_CONNECTX3, /* CONNECTX requests. (new implementation) */
151#define SCTP_SOCKOPT_CONNECTX3 SCTP_SOCKOPT_CONNECTX3
150}; 152};
151 153
152/* 154/*
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 57c93628695f..8c842e06bec8 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -153,6 +153,11 @@ struct linux_xfrm_mib {
153 per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]--; \ 153 per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]--; \
154 put_cpu(); \ 154 put_cpu(); \
155 } while (0) 155 } while (0)
156#define SNMP_ADD_STATS(mib, field, addend) \
157 do { \
158 per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field] += addend; \
159 put_cpu(); \
160 } while (0)
156#define SNMP_ADD_STATS_BH(mib, field, addend) \ 161#define SNMP_ADD_STATS_BH(mib, field, addend) \
157 (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend) 162 (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend)
158#define SNMP_ADD_STATS_USER(mib, field, addend) \ 163#define SNMP_ADD_STATS_USER(mib, field, addend) \
@@ -160,5 +165,17 @@ struct linux_xfrm_mib {
160 per_cpu_ptr(mib[1], get_cpu())->mibs[field] += addend; \ 165 per_cpu_ptr(mib[1], get_cpu())->mibs[field] += addend; \
161 put_cpu(); \ 166 put_cpu(); \
162 } while (0) 167 } while (0)
163 168#define SNMP_UPD_PO_STATS(mib, basefield, addend) \
169 do { \
170 __typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], get_cpu());\
171 ptr->mibs[basefield##PKTS]++; \
172 ptr->mibs[basefield##OCTETS] += addend;\
173 put_cpu(); \
174 } while (0)
175#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
176 do { \
177 __typeof__(mib[0]) ptr = per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id());\
178 ptr->mibs[basefield##PKTS]++; \
179 ptr->mibs[basefield##OCTETS] += addend;\
180 } while (0)
164#endif 181#endif
diff --git a/include/net/sock.h b/include/net/sock.h
index 4bb1ff9fd15b..07133c5e9868 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -218,9 +218,11 @@ struct sock {
218#define sk_hash __sk_common.skc_hash 218#define sk_hash __sk_common.skc_hash
219#define sk_prot __sk_common.skc_prot 219#define sk_prot __sk_common.skc_prot
220#define sk_net __sk_common.skc_net 220#define sk_net __sk_common.skc_net
221 kmemcheck_bitfield_begin(flags);
221 unsigned char sk_shutdown : 2, 222 unsigned char sk_shutdown : 2,
222 sk_no_check : 2, 223 sk_no_check : 2,
223 sk_userlocks : 4; 224 sk_userlocks : 4;
225 kmemcheck_bitfield_end(flags);
224 unsigned char sk_protocol; 226 unsigned char sk_protocol;
225 unsigned short sk_type; 227 unsigned short sk_type;
226 int sk_rcvbuf; 228 int sk_rcvbuf;
@@ -1206,6 +1208,39 @@ static inline int skb_copy_to_page(struct sock *sk, char __user *from,
1206 return 0; 1208 return 0;
1207} 1209}
1208 1210
1211/**
1212 * sk_wmem_alloc_get - returns write allocations
1213 * @sk: socket
1214 *
1215 * Returns sk_wmem_alloc minus initial offset of one
1216 */
1217static inline int sk_wmem_alloc_get(const struct sock *sk)
1218{
1219 return atomic_read(&sk->sk_wmem_alloc) - 1;
1220}
1221
1222/**
1223 * sk_rmem_alloc_get - returns read allocations
1224 * @sk: socket
1225 *
1226 * Returns sk_rmem_alloc
1227 */
1228static inline int sk_rmem_alloc_get(const struct sock *sk)
1229{
1230 return atomic_read(&sk->sk_rmem_alloc);
1231}
1232
1233/**
1234 * sk_has_allocations - check if allocations are outstanding
1235 * @sk: socket
1236 *
1237 * Returns true if socket has write or read allocations
1238 */
1239static inline int sk_has_allocations(const struct sock *sk)
1240{
1241 return sk_wmem_alloc_get(sk) || sk_rmem_alloc_get(sk);
1242}
1243
1209/* 1244/*
1210 * Queue a received datagram if it will fit. Stream and sequenced 1245 * Queue a received datagram if it will fit. Stream and sequenced
1211 * protocols can't normally use this as they need to fit buffers in 1246 * protocols can't normally use this as they need to fit buffers in
@@ -1217,9 +1252,13 @@ static inline int skb_copy_to_page(struct sock *sk, char __user *from,
1217 1252
1218static inline void skb_set_owner_w(struct sk_buff *skb, struct sock *sk) 1253static inline void skb_set_owner_w(struct sk_buff *skb, struct sock *sk)
1219{ 1254{
1220 sock_hold(sk);
1221 skb->sk = sk; 1255 skb->sk = sk;
1222 skb->destructor = sock_wfree; 1256 skb->destructor = sock_wfree;
1257 /*
1258 * We used to take a refcount on sk, but following operation
1259 * is enough to guarantee sk_free() wont free this sock until
1260 * all in-flight packets are completed
1261 */
1223 atomic_add(skb->truesize, &sk->sk_wmem_alloc); 1262 atomic_add(skb->truesize, &sk->sk_wmem_alloc);
1224} 1263}
1225 1264
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 646dbe3962ea..19f4150f4d4d 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -266,6 +266,19 @@ static inline int tcp_too_many_orphans(struct sock *sk, int num)
266 atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]); 266 atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]);
267} 267}
268 268
269/* syncookies: remember time of last synqueue overflow */
270static inline void tcp_synq_overflow(struct sock *sk)
271{
272 tcp_sk(sk)->rx_opt.ts_recent_stamp = jiffies;
273}
274
275/* syncookies: no recent synqueue overflow on this listening socket? */
276static inline int tcp_synq_no_recent_overflow(const struct sock *sk)
277{
278 unsigned long last_overflow = tcp_sk(sk)->rx_opt.ts_recent_stamp;
279 return time_after(jiffies, last_overflow + TCP_TIMEOUT_INIT);
280}
281
269extern struct proto tcp_prot; 282extern struct proto tcp_prot;
270 283
271#define TCP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.tcp_statistics, field) 284#define TCP_INC_STATS(net, field) SNMP_INC_STATS((net)->mib.tcp_statistics, field)
@@ -889,30 +902,32 @@ static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
889{ 902{
890 struct tcp_sock *tp = tcp_sk(sk); 903 struct tcp_sock *tp = tcp_sk(sk);
891 904
892 if (!sysctl_tcp_low_latency && tp->ucopy.task) { 905 if (sysctl_tcp_low_latency || !tp->ucopy.task)
893 __skb_queue_tail(&tp->ucopy.prequeue, skb); 906 return 0;
894 tp->ucopy.memory += skb->truesize; 907
895 if (tp->ucopy.memory > sk->sk_rcvbuf) { 908 __skb_queue_tail(&tp->ucopy.prequeue, skb);
896 struct sk_buff *skb1; 909 tp->ucopy.memory += skb->truesize;
897 910 if (tp->ucopy.memory > sk->sk_rcvbuf) {
898 BUG_ON(sock_owned_by_user(sk)); 911 struct sk_buff *skb1;
899 912
900 while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) { 913 BUG_ON(sock_owned_by_user(sk));
901 sk_backlog_rcv(sk, skb1); 914
902 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPPREQUEUEDROPPED); 915 while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) {
903 } 916 sk_backlog_rcv(sk, skb1);
904 917 NET_INC_STATS_BH(sock_net(sk),
905 tp->ucopy.memory = 0; 918 LINUX_MIB_TCPPREQUEUEDROPPED);
906 } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) {
907 wake_up_interruptible(sk->sk_sleep);
908 if (!inet_csk_ack_scheduled(sk))
909 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
910 (3 * tcp_rto_min(sk)) / 4,
911 TCP_RTO_MAX);
912 } 919 }
913 return 1; 920
921 tp->ucopy.memory = 0;
922 } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) {
923 wake_up_interruptible_poll(sk->sk_sleep,
924 POLLIN | POLLRDNORM | POLLRDBAND);
925 if (!inet_csk_ack_scheduled(sk))
926 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
927 (3 * tcp_rto_min(sk)) / 4,
928 TCP_RTO_MAX);
914 } 929 }
915 return 0; 930 return 1;
916} 931}
917 932
918 933
diff --git a/include/net/wimax.h b/include/net/wimax.h
index 6b3824edb39e..2af7bf839f23 100644
--- a/include/net/wimax.h
+++ b/include/net/wimax.h
@@ -253,7 +253,6 @@
253struct net_device; 253struct net_device;
254struct genl_info; 254struct genl_info;
255struct wimax_dev; 255struct wimax_dev;
256struct input_dev;
257 256
258/** 257/**
259 * struct wimax_dev - Generic WiMAX device 258 * struct wimax_dev - Generic WiMAX device
@@ -293,8 +292,8 @@ struct input_dev;
293 * See wimax_reset()'s documentation. 292 * See wimax_reset()'s documentation.
294 * 293 *
295 * @name: [fill] A way to identify this device. We need to register a 294 * @name: [fill] A way to identify this device. We need to register a
296 * name with many subsystems (input for RFKILL, workqueue 295 * name with many subsystems (rfkill, workqueue creation, etc).
297 * creation, etc). We can't use the network device name as that 296 * We can't use the network device name as that
298 * might change and in some instances we don't know it yet (until 297 * might change and in some instances we don't know it yet (until
299 * we don't call register_netdev()). So we generate an unique one 298 * we don't call register_netdev()). So we generate an unique one
300 * using the driver name and device bus id, place it here and use 299 * using the driver name and device bus id, place it here and use
@@ -316,9 +315,6 @@ struct input_dev;
316 * 315 *
317 * @rfkill: [private] integration into the RF-Kill infrastructure. 316 * @rfkill: [private] integration into the RF-Kill infrastructure.
318 * 317 *
319 * @rfkill_input: [private] virtual input device to process the
320 * hardware RF Kill switches.
321 *
322 * @rf_sw: [private] State of the software radio switch (OFF/ON) 318 * @rf_sw: [private] State of the software radio switch (OFF/ON)
323 * 319 *
324 * @rf_hw: [private] State of the hardware radio switch (OFF/ON) 320 * @rf_hw: [private] State of the hardware radio switch (OFF/ON)
diff --git a/include/net/wireless.h b/include/net/wireless.h
deleted file mode 100644
index 64a76208580c..000000000000
--- a/include/net/wireless.h
+++ /dev/null
@@ -1,472 +0,0 @@
1#ifndef __NET_WIRELESS_H
2#define __NET_WIRELESS_H
3
4/*
5 * 802.11 device management
6 *
7 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
8 */
9
10#include <linux/netdevice.h>
11#include <linux/debugfs.h>
12#include <linux/list.h>
13#include <linux/ieee80211.h>
14#include <net/cfg80211.h>
15
16/**
17 * enum ieee80211_band - supported frequency bands
18 *
19 * The bands are assigned this way because the supported
20 * bitrates differ in these bands.
21 *
22 * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
23 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
24 */
25enum ieee80211_band {
26 IEEE80211_BAND_2GHZ,
27 IEEE80211_BAND_5GHZ,
28
29 /* keep last */
30 IEEE80211_NUM_BANDS
31};
32
33/**
34 * enum ieee80211_channel_flags - channel flags
35 *
36 * Channel flags set by the regulatory control code.
37 *
38 * @IEEE80211_CHAN_DISABLED: This channel is disabled.
39 * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted
40 * on this channel.
41 * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
42 * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
43 * @IEEE80211_CHAN_NO_FAT_ABOVE: extension channel above this channel
44 * is not permitted.
45 * @IEEE80211_CHAN_NO_FAT_BELOW: extension channel below this channel
46 * is not permitted.
47 */
48enum ieee80211_channel_flags {
49 IEEE80211_CHAN_DISABLED = 1<<0,
50 IEEE80211_CHAN_PASSIVE_SCAN = 1<<1,
51 IEEE80211_CHAN_NO_IBSS = 1<<2,
52 IEEE80211_CHAN_RADAR = 1<<3,
53 IEEE80211_CHAN_NO_FAT_ABOVE = 1<<4,
54 IEEE80211_CHAN_NO_FAT_BELOW = 1<<5,
55};
56
57/**
58 * struct ieee80211_channel - channel definition
59 *
60 * This structure describes a single channel for use
61 * with cfg80211.
62 *
63 * @center_freq: center frequency in MHz
64 * @max_bandwidth: maximum allowed bandwidth for this channel, in MHz
65 * @hw_value: hardware-specific value for the channel
66 * @flags: channel flags from &enum ieee80211_channel_flags.
67 * @orig_flags: channel flags at registration time, used by regulatory
68 * code to support devices with additional restrictions
69 * @band: band this channel belongs to.
70 * @max_antenna_gain: maximum antenna gain in dBi
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.
75 * @orig_mag: internal use
76 * @orig_mpwr: internal use
77 */
78struct ieee80211_channel {
79 enum ieee80211_band band;
80 u16 center_freq;
81 u8 max_bandwidth;
82 u16 hw_value;
83 u32 flags;
84 int max_antenna_gain;
85 int max_power;
86 bool beacon_found;
87 u32 orig_flags;
88 int orig_mag, orig_mpwr;
89};
90
91/**
92 * enum ieee80211_rate_flags - rate flags
93 *
94 * Hardware/specification flags for rates. These are structured
95 * in a way that allows using the same bitrate structure for
96 * different bands/PHY modes.
97 *
98 * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
99 * preamble on this bitrate; only relevant in 2.4GHz band and
100 * with CCK rates.
101 * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
102 * when used with 802.11a (on the 5 GHz band); filled by the
103 * core code when registering the wiphy.
104 * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
105 * when used with 802.11b (on the 2.4 GHz band); filled by the
106 * core code when registering the wiphy.
107 * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
108 * when used with 802.11g (on the 2.4 GHz band); filled by the
109 * core code when registering the wiphy.
110 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
111 */
112enum ieee80211_rate_flags {
113 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
114 IEEE80211_RATE_MANDATORY_A = 1<<1,
115 IEEE80211_RATE_MANDATORY_B = 1<<2,
116 IEEE80211_RATE_MANDATORY_G = 1<<3,
117 IEEE80211_RATE_ERP_G = 1<<4,
118};
119
120/**
121 * struct ieee80211_rate - bitrate definition
122 *
123 * This structure describes a bitrate that an 802.11 PHY can
124 * operate with. The two values @hw_value and @hw_value_short
125 * are only for driver use when pointers to this structure are
126 * passed around.
127 *
128 * @flags: rate-specific flags
129 * @bitrate: bitrate in units of 100 Kbps
130 * @hw_value: driver/hardware value for this rate
131 * @hw_value_short: driver/hardware value for this rate when
132 * short preamble is used
133 */
134struct ieee80211_rate {
135 u32 flags;
136 u16 bitrate;
137 u16 hw_value, hw_value_short;
138};
139
140/**
141 * struct ieee80211_sta_ht_cap - STA's HT capabilities
142 *
143 * This structure describes most essential parameters needed
144 * to describe 802.11n HT capabilities for an STA.
145 *
146 * @ht_supported: is HT supported by the STA
147 * @cap: HT capabilities map as described in 802.11n spec
148 * @ampdu_factor: Maximum A-MPDU length factor
149 * @ampdu_density: Minimum A-MPDU spacing
150 * @mcs: Supported MCS rates
151 */
152struct ieee80211_sta_ht_cap {
153 u16 cap; /* use IEEE80211_HT_CAP_ */
154 bool ht_supported;
155 u8 ampdu_factor;
156 u8 ampdu_density;
157 struct ieee80211_mcs_info mcs;
158};
159
160/**
161 * struct ieee80211_supported_band - frequency band definition
162 *
163 * This structure describes a frequency band a wiphy
164 * is able to operate in.
165 *
166 * @channels: Array of channels the hardware can operate in
167 * in this band.
168 * @band: the band this structure represents
169 * @n_channels: Number of channels in @channels
170 * @bitrates: Array of bitrates the hardware can operate with
171 * in this band. Must be sorted to give a valid "supported
172 * rates" IE, i.e. CCK rates first, then OFDM.
173 * @n_bitrates: Number of bitrates in @bitrates
174 */
175struct ieee80211_supported_band {
176 struct ieee80211_channel *channels;
177 struct ieee80211_rate *bitrates;
178 enum ieee80211_band band;
179 int n_channels;
180 int n_bitrates;
181 struct ieee80211_sta_ht_cap ht_cap;
182};
183
184/**
185 * struct wiphy - wireless hardware description
186 * @idx: the wiphy index assigned to this item
187 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
188 * @custom_regulatory: tells us the driver for this device
189 * has its own custom regulatory domain and cannot identify the
190 * ISO / IEC 3166 alpha2 it belongs to. When this is enabled
191 * we will disregard the first regulatory hint (when the
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.
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.
208 */
209struct wiphy {
210 /* assign these fields before you register the wiphy */
211
212 /* permanent MAC address */
213 u8 perm_addr[ETH_ALEN];
214
215 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
216 u16 interface_modes;
217
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;
225
226 /* If multiple wiphys are registered and you're handed e.g.
227 * a regular netdev with assigned ieee80211_ptr, you won't
228 * know whether it points to a wiphy your driver has registered
229 * or not. Assign this to something global to your driver to
230 * help determine whether you own this wiphy or not. */
231 void *privid;
232
233 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
234
235 /* Lets us get back the wiphy on the callback */
236 int (*reg_notifier)(struct wiphy *wiphy,
237 struct regulatory_request *request);
238
239 /* fields below are read-only, assigned by cfg80211 */
240
241 const struct ieee80211_regdomain *regd;
242
243 /* the item in /sys/class/ieee80211/ points to this,
244 * you need use set_wiphy_dev() (see below) */
245 struct device dev;
246
247 /* dir in debugfs: ieee80211/<wiphyname> */
248 struct dentry *debugfsdir;
249
250 char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
251};
252
253/** struct wireless_dev - wireless per-netdev state
254 *
255 * This structure must be allocated by the driver/stack
256 * that uses the ieee80211_ptr field in struct net_device
257 * (this is intentional so it can be allocated along with
258 * the netdev.)
259 *
260 * @wiphy: pointer to hardware description
261 * @iftype: interface type
262 */
263struct wireless_dev {
264 struct wiphy *wiphy;
265 enum nl80211_iftype iftype;
266
267 /* private to the generic wireless code */
268 struct list_head list;
269 struct net_device *netdev;
270};
271
272/**
273 * wiphy_priv - return priv from wiphy
274 */
275static inline void *wiphy_priv(struct wiphy *wiphy)
276{
277 BUG_ON(!wiphy);
278 return &wiphy->priv;
279}
280
281/**
282 * set_wiphy_dev - set device pointer for wiphy
283 */
284static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
285{
286 wiphy->dev.parent = dev;
287}
288
289/**
290 * wiphy_dev - get wiphy dev pointer
291 */
292static inline struct device *wiphy_dev(struct wiphy *wiphy)
293{
294 return wiphy->dev.parent;
295}
296
297/**
298 * wiphy_name - get wiphy name
299 */
300static inline const char *wiphy_name(struct wiphy *wiphy)
301{
302 return dev_name(&wiphy->dev);
303}
304
305/**
306 * wdev_priv - return wiphy priv from wireless_dev
307 */
308static inline void *wdev_priv(struct wireless_dev *wdev)
309{
310 BUG_ON(!wdev);
311 return wiphy_priv(wdev->wiphy);
312}
313
314/**
315 * wiphy_new - create a new wiphy for use with cfg80211
316 *
317 * create a new wiphy and associate the given operations with it.
318 * @sizeof_priv bytes are allocated for private use.
319 *
320 * the returned pointer must be assigned to each netdev's
321 * ieee80211_ptr for proper operation.
322 */
323struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv);
324
325/**
326 * wiphy_register - register a wiphy with cfg80211
327 *
328 * register the given wiphy
329 *
330 * Returns a non-negative wiphy index or a negative error code.
331 */
332extern int wiphy_register(struct wiphy *wiphy);
333
334/**
335 * wiphy_unregister - deregister a wiphy from cfg80211
336 *
337 * unregister a device with the given priv pointer.
338 * After this call, no more requests can be made with this priv
339 * pointer, but the call may sleep to wait for an outstanding
340 * request that is being handled.
341 */
342extern void wiphy_unregister(struct wiphy *wiphy);
343
344/**
345 * wiphy_free - free wiphy
346 */
347extern void wiphy_free(struct wiphy *wiphy);
348
349/**
350 * ieee80211_channel_to_frequency - convert channel number to frequency
351 */
352extern int ieee80211_channel_to_frequency(int chan);
353
354/**
355 * ieee80211_frequency_to_channel - convert frequency to channel number
356 */
357extern int ieee80211_frequency_to_channel(int freq);
358
359/*
360 * Name indirection necessary because the ieee80211 code also has
361 * a function named "ieee80211_get_channel", so if you include
362 * cfg80211's header file you get cfg80211's version, if you try
363 * to include both header files you'll (rightfully!) get a symbol
364 * clash.
365 */
366extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
367 int freq);
368/**
369 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
370 */
371static inline struct ieee80211_channel *
372ieee80211_get_channel(struct wiphy *wiphy, int freq)
373{
374 return __ieee80211_get_channel(wiphy, freq);
375}
376
377/**
378 * ieee80211_get_response_rate - get basic rate for a given rate
379 *
380 * @sband: the band to look for rates in
381 * @basic_rates: bitmap of basic rates
382 * @bitrate: the bitrate for which to find the basic rate
383 *
384 * This function returns the basic rate corresponding to a given
385 * bitrate, that is the next lower bitrate contained in the basic
386 * rate map, which is, for this function, given as a bitmap of
387 * indices of rates in the band's bitrate table.
388 */
389struct ieee80211_rate *
390ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
391 u32 basic_rates, int bitrate);
392
393/**
394 * regulatory_hint - driver hint to the wireless core a regulatory domain
395 * @wiphy: the wireless device giving the hint (used only for reporting
396 * conflicts)
397 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
398 * should be in. If @rd is set this should be NULL. Note that if you
399 * set this to NULL you should still set rd->alpha2 to some accepted
400 * alpha2.
401 *
402 * Wireless drivers can use this function to hint to the wireless core
403 * what it believes should be the current regulatory domain by
404 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
405 * domain should be in or by providing a completely build regulatory domain.
406 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
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.
415 */
416extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
417
418/**
419 * regulatory_hint_11d - hints a country IE as a regulatory domain
420 * @wiphy: the wireless device giving the hint (used only for reporting
421 * conflicts)
422 * @country_ie: pointer to the country IE
423 * @country_ie_len: length of the country IE
424 *
425 * We will intersect the rd with the what CRDA tells us should apply
426 * for the alpha2 this country IE belongs to, this prevents APs from
427 * sending us incorrect or outdated information against a country.
428 */
429extern void regulatory_hint_11d(struct wiphy *wiphy,
430 u8 *country_ie,
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
472#endif /* __NET_WIRELESS_H */
diff --git a/include/net/x25.h b/include/net/x25.h
index fc3f03d976f8..2cda04011568 100644
--- a/include/net/x25.h
+++ b/include/net/x25.h
@@ -187,7 +187,7 @@ extern int x25_addr_ntoa(unsigned char *, struct x25_address *,
187extern int x25_addr_aton(unsigned char *, struct x25_address *, 187extern int x25_addr_aton(unsigned char *, struct x25_address *,
188 struct x25_address *); 188 struct x25_address *);
189extern struct sock *x25_find_socket(unsigned int, struct x25_neigh *); 189extern struct sock *x25_find_socket(unsigned int, struct x25_neigh *);
190extern void x25_destroy_socket(struct sock *); 190extern void x25_destroy_socket_from_timer(struct sock *);
191extern int x25_rx_call_request(struct sk_buff *, struct x25_neigh *, unsigned int); 191extern int x25_rx_call_request(struct sk_buff *, struct x25_neigh *, unsigned int);
192extern void x25_kill_by_neigh(struct x25_neigh *); 192extern void x25_kill_by_neigh(struct x25_neigh *);
193 193
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 2e9f5c0018ae..736bca450886 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -994,7 +994,7 @@ static inline int __xfrm_policy_check2(struct sock *sk, int dir,
994 return __xfrm_policy_check(sk, ndir, skb, family); 994 return __xfrm_policy_check(sk, ndir, skb, family);
995 995
996 return (!net->xfrm.policy_count[dir] && !skb->sp) || 996 return (!net->xfrm.policy_count[dir] && !skb->sp) ||
997 (skb->dst->flags & DST_NOPOLICY) || 997 (skb_dst(skb)->flags & DST_NOPOLICY) ||
998 __xfrm_policy_check(sk, ndir, skb, family); 998 __xfrm_policy_check(sk, ndir, skb, family);
999} 999}
1000 1000
@@ -1048,7 +1048,7 @@ static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family)
1048 struct net *net = dev_net(skb->dev); 1048 struct net *net = dev_net(skb->dev);
1049 1049
1050 return !net->xfrm.policy_count[XFRM_POLICY_OUT] || 1050 return !net->xfrm.policy_count[XFRM_POLICY_OUT] ||
1051 (skb->dst->flags & DST_NOXFRM) || 1051 (skb_dst(skb)->flags & DST_NOXFRM) ||
1052 __xfrm_route_forward(skb, family); 1052 __xfrm_route_forward(skb, family);
1053} 1053}
1054 1054
diff --git a/include/scsi/Kbuild b/include/scsi/Kbuild
new file mode 100644
index 000000000000..33b2750e9283
--- /dev/null
+++ b/include/scsi/Kbuild
@@ -0,0 +1,4 @@
1header-y += scsi.h
2header-y += scsi_netlink.h
3header-y += scsi_netlink_fc.h
4header-y += scsi_bsg_fc.h
diff --git a/include/scsi/fc/fc_fip.h b/include/scsi/fc/fc_fip.h
index 0627a9ae6347..3d138c1fcf8a 100644
--- a/include/scsi/fc/fc_fip.h
+++ b/include/scsi/fc/fc_fip.h
@@ -22,13 +22,6 @@
22 * http://www.t11.org/ftp/t11/pub/fc/bb-5/08-543v1.pdf 22 * http://www.t11.org/ftp/t11/pub/fc/bb-5/08-543v1.pdf
23 */ 23 */
24 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 */ 25#define FIP_DEF_PRI 128 /* default selection priority */
33#define FIP_DEF_FC_MAP 0x0efc00 /* default FCoE MAP (MAC OUI) value */ 26#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) */ 27#define FIP_DEF_FKA 8000 /* default FCF keep-alive/advert period (mS) */
diff --git a/include/scsi/fc_encode.h b/include/scsi/fc_encode.h
index 6300f556bce5..a0ff61c3e935 100644
--- a/include/scsi/fc_encode.h
+++ b/include/scsi/fc_encode.h
@@ -107,7 +107,6 @@ static inline int fc_ct_fill(struct fc_lport *lport, struct fc_frame *fp,
107 break; 107 break;
108 108
109 default: 109 default:
110 FC_DBG("Invalid op code %x \n", op);
111 return -EINVAL; 110 return -EINVAL;
112 } 111 }
113 *r_ctl = FC_RCTL_DD_UNSOL_CTL; 112 *r_ctl = FC_RCTL_DD_UNSOL_CTL;
@@ -298,7 +297,6 @@ static inline int fc_els_fill(struct fc_lport *lport, struct fc_rport *rport,
298 break; 297 break;
299 298
300 default: 299 default:
301 FC_DBG("Invalid op code %x \n", op);
302 return -EINVAL; 300 return -EINVAL;
303 } 301 }
304 302
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index d0ed5226f8c4..4426f00da5ff 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -22,6 +22,11 @@
22#define ISCSI_IF_H 22#define ISCSI_IF_H
23 23
24#include <scsi/iscsi_proto.h> 24#include <scsi/iscsi_proto.h>
25#include <linux/in.h>
26#include <linux/in6.h>
27
28#define ISCSI_NL_GRP_ISCSID 1
29#define ISCSI_NL_GRP_UIP 2
25 30
26#define UEVENT_BASE 10 31#define UEVENT_BASE 10
27#define KEVENT_BASE 100 32#define KEVENT_BASE 100
@@ -50,7 +55,10 @@ enum iscsi_uevent_e {
50 ISCSI_UEVENT_TGT_DSCVR = UEVENT_BASE + 15, 55 ISCSI_UEVENT_TGT_DSCVR = UEVENT_BASE + 15,
51 ISCSI_UEVENT_SET_HOST_PARAM = UEVENT_BASE + 16, 56 ISCSI_UEVENT_SET_HOST_PARAM = UEVENT_BASE + 16,
52 ISCSI_UEVENT_UNBIND_SESSION = UEVENT_BASE + 17, 57 ISCSI_UEVENT_UNBIND_SESSION = UEVENT_BASE + 17,
53 ISCSI_UEVENT_CREATE_BOUND_SESSION = UEVENT_BASE + 18, 58 ISCSI_UEVENT_CREATE_BOUND_SESSION = UEVENT_BASE + 18,
59 ISCSI_UEVENT_TRANSPORT_EP_CONNECT_THROUGH_HOST = UEVENT_BASE + 19,
60
61 ISCSI_UEVENT_PATH_UPDATE = UEVENT_BASE + 20,
54 62
55 /* up events */ 63 /* up events */
56 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1, 64 ISCSI_KEVENT_RECV_PDU = KEVENT_BASE + 1,
@@ -59,6 +67,9 @@ enum iscsi_uevent_e {
59 ISCSI_KEVENT_DESTROY_SESSION = KEVENT_BASE + 4, 67 ISCSI_KEVENT_DESTROY_SESSION = KEVENT_BASE + 4,
60 ISCSI_KEVENT_UNBIND_SESSION = KEVENT_BASE + 5, 68 ISCSI_KEVENT_UNBIND_SESSION = KEVENT_BASE + 5,
61 ISCSI_KEVENT_CREATE_SESSION = KEVENT_BASE + 6, 69 ISCSI_KEVENT_CREATE_SESSION = KEVENT_BASE + 6,
70
71 ISCSI_KEVENT_PATH_REQ = KEVENT_BASE + 7,
72 ISCSI_KEVENT_IF_DOWN = KEVENT_BASE + 8,
62}; 73};
63 74
64enum iscsi_tgt_dscvr { 75enum iscsi_tgt_dscvr {
@@ -131,6 +142,10 @@ struct iscsi_uevent {
131 struct msg_transport_connect { 142 struct msg_transport_connect {
132 uint32_t non_blocking; 143 uint32_t non_blocking;
133 } ep_connect; 144 } ep_connect;
145 struct msg_transport_connect_through_host {
146 uint32_t host_no;
147 uint32_t non_blocking;
148 } ep_connect_through_host;
134 struct msg_transport_poll { 149 struct msg_transport_poll {
135 uint64_t ep_handle; 150 uint64_t ep_handle;
136 uint32_t timeout_ms; 151 uint32_t timeout_ms;
@@ -154,6 +169,9 @@ struct iscsi_uevent {
154 uint32_t param; /* enum iscsi_host_param */ 169 uint32_t param; /* enum iscsi_host_param */
155 uint32_t len; 170 uint32_t len;
156 } set_host_param; 171 } set_host_param;
172 struct msg_set_path {
173 uint32_t host_no;
174 } set_path;
157 } u; 175 } u;
158 union { 176 union {
159 /* messages k -> u */ 177 /* messages k -> u */
@@ -187,10 +205,39 @@ struct iscsi_uevent {
187 struct msg_transport_connect_ret { 205 struct msg_transport_connect_ret {
188 uint64_t handle; 206 uint64_t handle;
189 } ep_connect_ret; 207 } ep_connect_ret;
208 struct msg_req_path {
209 uint32_t host_no;
210 } req_path;
211 struct msg_notify_if_down {
212 uint32_t host_no;
213 } notify_if_down;
190 } r; 214 } r;
191} __attribute__ ((aligned (sizeof(uint64_t)))); 215} __attribute__ ((aligned (sizeof(uint64_t))));
192 216
193/* 217/*
218 * To keep the struct iscsi_uevent size the same for userspace code
219 * compatibility, the main structure for ISCSI_UEVENT_PATH_UPDATE and
220 * ISCSI_KEVENT_PATH_REQ is defined separately and comes after the
221 * struct iscsi_uevent in the NETLINK_ISCSI message.
222 */
223struct iscsi_path {
224 uint64_t handle;
225 uint8_t mac_addr[6];
226 uint8_t mac_addr_old[6];
227 uint32_t ip_addr_len; /* 4 or 16 */
228 union {
229 struct in_addr v4_addr;
230 struct in6_addr v6_addr;
231 } src;
232 union {
233 struct in_addr v4_addr;
234 struct in6_addr v6_addr;
235 } dst;
236 uint16_t vlan_id;
237 uint16_t pmtu;
238} __attribute__ ((aligned (sizeof(uint64_t))));
239
240/*
194 * Common error codes 241 * Common error codes
195 */ 242 */
196enum iscsi_err { 243enum iscsi_err {
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 45f9cc642c46..b92584a8843a 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -34,17 +34,72 @@
34 34
35#include <scsi/fc_frame.h> 35#include <scsi/fc_frame.h>
36 36
37#define LIBFC_DEBUG 37#define FC_LIBFC_LOGGING 0x01 /* General logging, not categorized */
38 38#define FC_LPORT_LOGGING 0x02 /* lport layer logging */
39#ifdef LIBFC_DEBUG 39#define FC_DISC_LOGGING 0x04 /* discovery layer logging */
40/* Log messages */ 40#define FC_RPORT_LOGGING 0x08 /* rport layer logging */
41#define FC_DBG(fmt, args...) \ 41#define FC_FCP_LOGGING 0x10 /* I/O path logging */
42 do { \ 42#define FC_EM_LOGGING 0x20 /* Exchange Manager logging */
43 printk(KERN_INFO "%s " fmt, __func__, ##args); \ 43#define FC_EXCH_LOGGING 0x40 /* Exchange/Sequence logging */
44 } while (0) 44#define FC_SCSI_LOGGING 0x80 /* SCSI logging (mostly error handling) */
45#else 45
46#define FC_DBG(fmt, args...) 46extern unsigned int fc_debug_logging;
47#endif 47
48#define FC_CHECK_LOGGING(LEVEL, CMD) \
49do { \
50 if (unlikely(fc_debug_logging & LEVEL)) \
51 do { \
52 CMD; \
53 } while (0); \
54} while (0);
55
56#define FC_LIBFC_DBG(fmt, args...) \
57 FC_CHECK_LOGGING(FC_LIBFC_LOGGING, \
58 printk(KERN_INFO "libfc: " fmt, ##args);)
59
60#define FC_LPORT_DBG(lport, fmt, args...) \
61 FC_CHECK_LOGGING(FC_LPORT_LOGGING, \
62 printk(KERN_INFO "lport: %6x: " fmt, \
63 fc_host_port_id(lport->host), ##args);)
64
65#define FC_DISC_DBG(disc, fmt, args...) \
66 FC_CHECK_LOGGING(FC_DISC_LOGGING, \
67 printk(KERN_INFO "disc: %6x: " fmt, \
68 fc_host_port_id(disc->lport->host), \
69 ##args);)
70
71#define FC_RPORT_DBG(rport, fmt, args...) \
72do { \
73 struct fc_rport_libfc_priv *rdata = rport->dd_data; \
74 struct fc_lport *lport = rdata->local_port; \
75 FC_CHECK_LOGGING(FC_RPORT_LOGGING, \
76 printk(KERN_INFO "rport: %6x: %6x: " fmt, \
77 fc_host_port_id(lport->host), \
78 rport->port_id, ##args);) \
79} while (0);
80
81#define FC_FCP_DBG(pkt, fmt, args...) \
82 FC_CHECK_LOGGING(FC_FCP_LOGGING, \
83 printk(KERN_INFO "fcp: %6x: %6x: " fmt, \
84 fc_host_port_id(pkt->lp->host), \
85 pkt->rport->port_id, ##args);)
86
87#define FC_EM_DBG(em, fmt, args...) \
88 FC_CHECK_LOGGING(FC_EM_LOGGING, \
89 printk(KERN_INFO "em: %6x: " fmt, \
90 fc_host_port_id(em->lp->host), \
91 ##args);)
92
93#define FC_EXCH_DBG(exch, fmt, args...) \
94 FC_CHECK_LOGGING(FC_EXCH_LOGGING, \
95 printk(KERN_INFO "exch: %6x: %4x: " fmt, \
96 fc_host_port_id(exch->lp->host), \
97 exch->xid, ##args);)
98
99#define FC_SCSI_DBG(lport, fmt, args...) \
100 FC_CHECK_LOGGING(FC_SCSI_LOGGING, \
101 printk(KERN_INFO "scsi: %6x: " fmt, \
102 fc_host_port_id(lport->host), ##args);)
48 103
49/* 104/*
50 * libfc error codes 105 * libfc error codes
@@ -679,6 +734,7 @@ struct fc_lport {
679 unsigned int e_d_tov; 734 unsigned int e_d_tov;
680 unsigned int r_a_tov; 735 unsigned int r_a_tov;
681 u8 max_retry_count; 736 u8 max_retry_count;
737 u8 max_rport_retry_count;
682 u16 link_speed; 738 u16 link_speed;
683 u16 link_supported_speeds; 739 u16 link_supported_speeds;
684 u16 lro_xid; /* max xid for fcoe lro */ 740 u16 lro_xid; /* max xid for fcoe lro */
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index 666cc131732e..b2410605b740 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -73,6 +73,7 @@ enum fip_state {
73 * @link: current link status for libfc. 73 * @link: current link status for libfc.
74 * @last_link: last link state reported to libfc. 74 * @last_link: last link state reported to libfc.
75 * @map_dest: use the FC_MAP mode for destination MAC addresses. 75 * @map_dest: use the FC_MAP mode for destination MAC addresses.
76 * @spma: supports SPMA server-provided MACs mode
76 * @dest_addr: MAC address of the selected FC forwarder. 77 * @dest_addr: MAC address of the selected FC forwarder.
77 * @ctl_src_addr: the native MAC address of our local port. 78 * @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 * @data_src_addr: the assigned MAC address for the local port after FLOGI.
@@ -104,6 +105,7 @@ struct fcoe_ctlr {
104 u8 link; 105 u8 link;
105 u8 last_link; 106 u8 last_link;
106 u8 map_dest; 107 u8 map_dest;
108 u8 spma;
107 u8 dest_addr[ETH_ALEN]; 109 u8 dest_addr[ETH_ALEN];
108 u8 ctl_src_addr[ETH_ALEN]; 110 u8 ctl_src_addr[ETH_ALEN];
109 u8 data_src_addr[ETH_ALEN]; 111 u8 data_src_addr[ETH_ALEN];
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 0289f5745fb9..61afeb59a836 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -82,9 +82,12 @@ enum {
82 82
83 83
84enum { 84enum {
85 ISCSI_TASK_FREE,
85 ISCSI_TASK_COMPLETED, 86 ISCSI_TASK_COMPLETED,
86 ISCSI_TASK_PENDING, 87 ISCSI_TASK_PENDING,
87 ISCSI_TASK_RUNNING, 88 ISCSI_TASK_RUNNING,
89 ISCSI_TASK_ABRT_TMF, /* aborted due to TMF */
90 ISCSI_TASK_ABRT_SESS_RECOV, /* aborted due to session recovery */
88}; 91};
89 92
90struct iscsi_r2t_info { 93struct iscsi_r2t_info {
@@ -122,6 +125,10 @@ struct iscsi_task {
122 struct scsi_cmnd *sc; /* associated SCSI cmd*/ 125 struct scsi_cmnd *sc; /* associated SCSI cmd*/
123 struct iscsi_conn *conn; /* used connection */ 126 struct iscsi_conn *conn; /* used connection */
124 127
128 /* data processing tracking */
129 unsigned long last_xfer;
130 unsigned long last_timeout;
131 bool have_checked_conn;
125 /* state set/tested under session->lock */ 132 /* state set/tested under session->lock */
126 int state; 133 int state;
127 atomic_t refcount; 134 atomic_t refcount;
@@ -181,9 +188,7 @@ struct iscsi_conn {
181 188
182 /* xmit */ 189 /* xmit */
183 struct list_head mgmtqueue; /* mgmt (control) xmit queue */ 190 struct list_head mgmtqueue; /* mgmt (control) xmit queue */
184 struct list_head mgmt_run_list; /* list of control tasks */ 191 struct list_head cmdqueue; /* data-path cmd queue */
185 struct list_head xmitqueue; /* data-path cmd queue */
186 struct list_head run_list; /* list of cmds in progress */
187 struct list_head requeue; /* tasks needing another run */ 192 struct list_head requeue; /* tasks needing another run */
188 struct work_struct xmitwork; /* per-conn. xmit workqueue */ 193 struct work_struct xmitwork; /* per-conn. xmit workqueue */
189 unsigned long suspend_tx; /* suspend Tx */ 194 unsigned long suspend_tx; /* suspend Tx */
@@ -406,6 +411,7 @@ extern int __iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *,
406 char *, int); 411 char *, int);
407extern int iscsi_verify_itt(struct iscsi_conn *, itt_t); 412extern int iscsi_verify_itt(struct iscsi_conn *, itt_t);
408extern struct iscsi_task *iscsi_itt_to_ctask(struct iscsi_conn *, itt_t); 413extern struct iscsi_task *iscsi_itt_to_ctask(struct iscsi_conn *, itt_t);
414extern struct iscsi_task *iscsi_itt_to_task(struct iscsi_conn *, itt_t);
409extern void iscsi_requeue_task(struct iscsi_task *task); 415extern void iscsi_requeue_task(struct iscsi_task *task);
410extern void iscsi_put_task(struct iscsi_task *task); 416extern void iscsi_put_task(struct iscsi_task *task);
411extern void __iscsi_get_task(struct iscsi_task *task); 417extern void __iscsi_get_task(struct iscsi_task *task);
diff --git a/include/scsi/osd_attributes.h b/include/scsi/osd_attributes.h
index f888a6fda073..56e920ade326 100644
--- a/include/scsi/osd_attributes.h
+++ b/include/scsi/osd_attributes.h
@@ -29,6 +29,7 @@ enum {
29 OSD_APAGE_PARTITION_INFORMATION = OSD_APAGE_PARTITION_FIRST + 1, 29 OSD_APAGE_PARTITION_INFORMATION = OSD_APAGE_PARTITION_FIRST + 1,
30 OSD_APAGE_PARTITION_QUOTAS = OSD_APAGE_PARTITION_FIRST + 2, 30 OSD_APAGE_PARTITION_QUOTAS = OSD_APAGE_PARTITION_FIRST + 2,
31 OSD_APAGE_PARTITION_TIMESTAMP = OSD_APAGE_PARTITION_FIRST + 3, 31 OSD_APAGE_PARTITION_TIMESTAMP = OSD_APAGE_PARTITION_FIRST + 3,
32 OSD_APAGE_PARTITION_ATTR_ACCESS = OSD_APAGE_PARTITION_FIRST + 4,
32 OSD_APAGE_PARTITION_SECURITY = OSD_APAGE_PARTITION_FIRST + 5, 33 OSD_APAGE_PARTITION_SECURITY = OSD_APAGE_PARTITION_FIRST + 5,
33 OSD_APAGE_PARTITION_LAST = 0x5FFFFFFF, 34 OSD_APAGE_PARTITION_LAST = 0x5FFFFFFF,
34 35
@@ -51,7 +52,9 @@ enum {
51 OSD_APAGE_RESERVED_TYPE_LAST = 0xEFFFFFFF, 52 OSD_APAGE_RESERVED_TYPE_LAST = 0xEFFFFFFF,
52 53
53 OSD_APAGE_COMMON_FIRST = 0xF0000000, 54 OSD_APAGE_COMMON_FIRST = 0xF0000000,
54 OSD_APAGE_COMMON_LAST = 0xFFFFFFFE, 55 OSD_APAGE_COMMON_LAST = 0xFFFFFFFD,
56
57 OSD_APAGE_CURRENT_COMMAND = 0xFFFFFFFE,
55 58
56 OSD_APAGE_REQUEST_ALL = 0xFFFFFFFF, 59 OSD_APAGE_REQUEST_ALL = 0xFFFFFFFF,
57}; 60};
@@ -106,10 +109,30 @@ enum {
106 OSD_ATTR_RI_PRODUCT_REVISION_LEVEL = 0x7, /* 4 */ 109 OSD_ATTR_RI_PRODUCT_REVISION_LEVEL = 0x7, /* 4 */
107 OSD_ATTR_RI_PRODUCT_SERIAL_NUMBER = 0x8, /* variable */ 110 OSD_ATTR_RI_PRODUCT_SERIAL_NUMBER = 0x8, /* variable */
108 OSD_ATTR_RI_OSD_NAME = 0x9, /* variable */ 111 OSD_ATTR_RI_OSD_NAME = 0x9, /* variable */
112 OSD_ATTR_RI_MAX_CDB_CONTINUATION_LEN = 0xA, /* 4 */
109 OSD_ATTR_RI_TOTAL_CAPACITY = 0x80, /* 8 */ 113 OSD_ATTR_RI_TOTAL_CAPACITY = 0x80, /* 8 */
110 OSD_ATTR_RI_USED_CAPACITY = 0x81, /* 8 */ 114 OSD_ATTR_RI_USED_CAPACITY = 0x81, /* 8 */
111 OSD_ATTR_RI_NUMBER_OF_PARTITIONS = 0xC0, /* 8 */ 115 OSD_ATTR_RI_NUMBER_OF_PARTITIONS = 0xC0, /* 8 */
112 OSD_ATTR_RI_CLOCK = 0x100, /* 6 */ 116 OSD_ATTR_RI_CLOCK = 0x100, /* 6 */
117 OARI_DEFAULT_ISOLATION_METHOD = 0X110, /* 1 */
118 OARI_SUPPORTED_ISOLATION_METHODS = 0X111, /* 32 */
119
120 OARI_DATA_ATOMICITY_GUARANTEE = 0X120, /* 8 */
121 OARI_DATA_ATOMICITY_ALIGNMENT = 0X121, /* 8 */
122 OARI_ATTRIBUTES_ATOMICITY_GUARANTEE = 0X122, /* 8 */
123 OARI_DATA_ATTRIBUTES_ATOMICITY_MULTIPLIER = 0X123, /* 1 */
124
125 OARI_MAXIMUM_SNAPSHOTS_COUNT = 0X1C1, /* 0 or 4 */
126 OARI_MAXIMUM_CLONES_COUNT = 0X1C2, /* 0 or 4 */
127 OARI_MAXIMUM_BRANCH_DEPTH = 0X1CC, /* 0 or 4 */
128 OARI_SUPPORTED_OBJECT_DUPLICATION_METHOD_FIRST = 0X200, /* 0 or 4 */
129 OARI_SUPPORTED_OBJECT_DUPLICATION_METHOD_LAST = 0X2ff, /* 0 or 4 */
130 OARI_SUPPORTED_TIME_OF_DUPLICATION_METHOD_FIRST = 0X300, /* 0 or 4 */
131 OARI_SUPPORTED_TIME_OF_DUPLICATION_METHOD_LAST = 0X30F, /* 0 or 4 */
132 OARI_SUPPORT_FOR_DUPLICATED_OBJECT_FREEZING = 0X310, /* 0 or 4 */
133 OARI_SUPPORT_FOR_SNAPSHOT_REFRESHING = 0X311, /* 0 or 1 */
134 OARI_SUPPORTED_CDB_CONTINUATION_DESC_TYPE_FIRST = 0X7000001,/* 0 or 4 */
135 OARI_SUPPORTED_CDB_CONTINUATION_DESC_TYPE_LAST = 0X700FFFF,/* 0 or 4 */
113}; 136};
114/* Root_Information_attributes_page does not have a get_page structure */ 137/* Root_Information_attributes_page does not have a get_page structure */
115 138
@@ -120,7 +143,15 @@ enum {
120 OSD_ATTR_PI_PARTITION_ID = 0x1, /* 8 */ 143 OSD_ATTR_PI_PARTITION_ID = 0x1, /* 8 */
121 OSD_ATTR_PI_USERNAME = 0x9, /* variable */ 144 OSD_ATTR_PI_USERNAME = 0x9, /* variable */
122 OSD_ATTR_PI_USED_CAPACITY = 0x81, /* 8 */ 145 OSD_ATTR_PI_USED_CAPACITY = 0x81, /* 8 */
146 OSD_ATTR_PI_USED_CAPACITY_INCREMENT = 0x84, /* 0 or 8 */
123 OSD_ATTR_PI_NUMBER_OF_OBJECTS = 0xC1, /* 8 */ 147 OSD_ATTR_PI_NUMBER_OF_OBJECTS = 0xC1, /* 8 */
148
149 OSD_ATTR_PI_ACTUAL_DATA_SPACE = 0xD1, /* 0 or 8 */
150 OSD_ATTR_PI_RESERVED_DATA_SPACE = 0xD2, /* 0 or 8 */
151 OSD_ATTR_PI_DEFAULT_SNAPSHOT_DUPLICATION_METHOD = 0x200,/* 0 or 4 */
152 OSD_ATTR_PI_DEFAULT_CLONE_DUPLICATION_METHOD = 0x201,/* 0 or 4 */
153 OSD_ATTR_PI_DEFAULT_SP_TIME_OF_DUPLICATION = 0x300,/* 0 or 4 */
154 OSD_ATTR_PI_DEFAULT_CLONE_TIME_OF_DUPLICATION = 0x301,/* 0 or 4 */
124}; 155};
125/* Partition Information attributes page does not have a get_page structure */ 156/* Partition Information attributes page does not have a get_page structure */
126 157
@@ -131,6 +162,7 @@ enum {
131 OSD_ATTR_CI_PARTITION_ID = 0x1, /* 8 */ 162 OSD_ATTR_CI_PARTITION_ID = 0x1, /* 8 */
132 OSD_ATTR_CI_COLLECTION_OBJECT_ID = 0x2, /* 8 */ 163 OSD_ATTR_CI_COLLECTION_OBJECT_ID = 0x2, /* 8 */
133 OSD_ATTR_CI_USERNAME = 0x9, /* variable */ 164 OSD_ATTR_CI_USERNAME = 0x9, /* variable */
165 OSD_ATTR_CI_COLLECTION_TYPE = 0xA, /* 1 */
134 OSD_ATTR_CI_USED_CAPACITY = 0x81, /* 8 */ 166 OSD_ATTR_CI_USED_CAPACITY = 0x81, /* 8 */
135}; 167};
136/* Collection Information attributes page does not have a get_page structure */ 168/* Collection Information attributes page does not have a get_page structure */
@@ -144,6 +176,8 @@ enum {
144 OSD_ATTR_OI_USERNAME = 0x9, /* variable */ 176 OSD_ATTR_OI_USERNAME = 0x9, /* variable */
145 OSD_ATTR_OI_USED_CAPACITY = 0x81, /* 8 */ 177 OSD_ATTR_OI_USED_CAPACITY = 0x81, /* 8 */
146 OSD_ATTR_OI_LOGICAL_LENGTH = 0x82, /* 8 */ 178 OSD_ATTR_OI_LOGICAL_LENGTH = 0x82, /* 8 */
179 SD_ATTR_OI_ACTUAL_DATA_SPACE = 0XD1, /* 0 OR 8 */
180 SD_ATTR_OI_RESERVED_DATA_SPACE = 0XD2, /* 0 OR 8 */
147}; 181};
148/* Object Information attributes page does not have a get_page structure */ 182/* Object Information attributes page does not have a get_page structure */
149 183
@@ -248,7 +282,18 @@ struct object_timestamps_attributes_page {
248 struct osd_timestamp data_modified_time; 282 struct osd_timestamp data_modified_time;
249} __packed; 283} __packed;
250 284
251/* 7.1.2.19 Collections attributes page */ 285/* OSD2r05: 7.1.3.19 Attributes Access attributes page
286 * (OSD_APAGE_PARTITION_ATTR_ACCESS)
287 *
288 * each attribute is of the form below. Total array length is deduced
289 * from the attribute's length
290 * (See allowed_attributes_access of the struct osd_cap_object_descriptor)
291 */
292struct attributes_access_attr {
293 struct osd_attributes_list_attrid attr_list[0];
294} __packed;
295
296/* OSD2r05: 7.1.2.21 Collections attributes page */
252/* TBD */ 297/* TBD */
253 298
254/* 7.1.2.20 Root Policy/Security attributes page (OSD_APAGE_ROOT_SECURITY) */ 299/* 7.1.2.20 Root Policy/Security attributes page (OSD_APAGE_ROOT_SECURITY) */
@@ -324,4 +369,29 @@ struct object_security_attributes_page {
324 __be32 policy_access_tag; 369 __be32 policy_access_tag;
325} __packed; 370} __packed;
326 371
372/* OSD2r05: 7.1.3.31 Current Command attributes page
373 * (OSD_APAGE_CURRENT_COMMAND)
374 */
375enum {
376 OSD_ATTR_CC_RESPONSE_INTEGRITY_CHECK_VALUE = 0x1, /* 32 */
377 OSD_ATTR_CC_OBJECT_TYPE = 0x2, /* 1 */
378 OSD_ATTR_CC_PARTITION_ID = 0x3, /* 8 */
379 OSD_ATTR_CC_OBJECT_ID = 0x4, /* 8 */
380 OSD_ATTR_CC_STARTING_BYTE_ADDRESS_OF_APPEND = 0x5, /* 8 */
381 OSD_ATTR_CC_CHANGE_IN_USED_CAPACITY = 0x6, /* 8 */
382};
383
384/*TBD: osdv1_current_command_attributes_page */
385
386struct osdv2_current_command_attributes_page {
387 struct osd_attr_page_header hdr; /* id=0xFFFFFFFE, size=0x44 */
388 u8 response_integrity_check_value[OSD_CRYPTO_KEYID_SIZE];
389 u8 object_type;
390 u8 reserved[3];
391 __be64 partition_id;
392 __be64 object_id;
393 __be64 starting_byte_address_of_append;
394 __be64 change_in_used_capacity;
395};
396
327#endif /*ndef __OSD_ATTRIBUTES_H__*/ 397#endif /*ndef __OSD_ATTRIBUTES_H__*/
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h
index b24d9616eb46..02bd9f716357 100644
--- a/include/scsi/osd_initiator.h
+++ b/include/scsi/osd_initiator.h
@@ -18,6 +18,7 @@
18#include "osd_types.h" 18#include "osd_types.h"
19 19
20#include <linux/blkdev.h> 20#include <linux/blkdev.h>
21#include <scsi/scsi_device.h>
21 22
22/* Note: "NI" in comments below means "Not Implemented yet" */ 23/* Note: "NI" in comments below means "Not Implemented yet" */
23 24
@@ -47,6 +48,7 @@ enum osd_std_version {
47 */ 48 */
48struct osd_dev { 49struct osd_dev {
49 struct scsi_device *scsi_device; 50 struct scsi_device *scsi_device;
51 struct file *file;
50 unsigned def_timeout; 52 unsigned def_timeout;
51 53
52#ifdef OSD_VER1_SUPPORT 54#ifdef OSD_VER1_SUPPORT
@@ -69,6 +71,10 @@ void osd_dev_fini(struct osd_dev *od);
69 71
70/* some hi level device operations */ 72/* some hi level device operations */
71int osd_auto_detect_ver(struct osd_dev *od, void *caps); /* GFP_KERNEL */ 73int osd_auto_detect_ver(struct osd_dev *od, void *caps); /* GFP_KERNEL */
74static inline struct request_queue *osd_request_queue(struct osd_dev *od)
75{
76 return od->scsi_device->request_queue;
77}
72 78
73/* we might want to use function vector in the future */ 79/* 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) 80static inline void osd_dev_set_ver(struct osd_dev *od, enum osd_std_version v)
@@ -363,7 +369,9 @@ void 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 *); 369void osd_req_remove_object(struct osd_request *or, struct osd_obj_id *);
364 370
365void osd_req_write(struct osd_request *or, 371void osd_req_write(struct osd_request *or,
366 const struct osd_obj_id *, struct bio *data_out, u64 offset); 372 const struct osd_obj_id *obj, u64 offset, struct bio *bio, u64 len);
373int osd_req_write_kern(struct osd_request *or,
374 const struct osd_obj_id *obj, u64 offset, void *buff, u64 len);
367void osd_req_append(struct osd_request *or, 375void osd_req_append(struct osd_request *or,
368 const struct osd_obj_id *, struct bio *data_out);/* NI */ 376 const struct osd_obj_id *, struct bio *data_out);/* NI */
369void osd_req_create_write(struct osd_request *or, 377void osd_req_create_write(struct osd_request *or,
@@ -378,7 +386,9 @@ void osd_req_flush_object(struct osd_request *or,
378 /*V2*/ u64 offset, /*V2*/ u64 len); 386 /*V2*/ u64 offset, /*V2*/ u64 len);
379 387
380void osd_req_read(struct osd_request *or, 388void osd_req_read(struct osd_request *or,
381 const struct osd_obj_id *, struct bio *data_in, u64 offset); 389 const struct osd_obj_id *obj, u64 offset, struct bio *bio, u64 len);
390int osd_req_read_kern(struct osd_request *or,
391 const struct osd_obj_id *obj, u64 offset, void *buff, u64 len);
382 392
383/* 393/*
384 * Root/Partition/Collection/Object Attributes commands 394 * Root/Partition/Collection/Object Attributes commands
diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h
index 62b2ab8c69d4..2cc8e8b1cc19 100644
--- a/include/scsi/osd_protocol.h
+++ b/include/scsi/osd_protocol.h
@@ -303,7 +303,15 @@ enum osd_service_actions {
303 OSD_ACT_V2(REMOVE_MEMBER_OBJECTS, 0x21) 303 OSD_ACT_V2(REMOVE_MEMBER_OBJECTS, 0x21)
304 OSD_ACT_V2(GET_MEMBER_ATTRIBUTES, 0x22) 304 OSD_ACT_V2(GET_MEMBER_ATTRIBUTES, 0x22)
305 OSD_ACT_V2(SET_MEMBER_ATTRIBUTES, 0x23) 305 OSD_ACT_V2(SET_MEMBER_ATTRIBUTES, 0x23)
306
307 OSD_ACT_V2(CREATE_CLONE, 0x28)
308 OSD_ACT_V2(CREATE_SNAPSHOT, 0x29)
309 OSD_ACT_V2(DETACH_CLONE, 0x2A)
310 OSD_ACT_V2(REFRESH_SNAPSHOT_CLONE, 0x2B)
311 OSD_ACT_V2(RESTORE_PARTITION_FROM_SNAPSHOT, 0x2C)
312
306 OSD_ACT_V2(READ_MAP, 0x31) 313 OSD_ACT_V2(READ_MAP, 0x31)
314 OSD_ACT_V2(READ_MAPS_COMPARE, 0x32)
307 315
308 OSD_ACT_V1_V2(PERFORM_SCSI_COMMAND, 0x8F7E, 0x8F7C) 316 OSD_ACT_V1_V2(PERFORM_SCSI_COMMAND, 0x8F7E, 0x8F7C)
309 OSD_ACT_V1_V2(SCSI_TASK_MANAGEMENT, 0x8F7F, 0x8F7D) 317 OSD_ACT_V1_V2(SCSI_TASK_MANAGEMENT, 0x8F7F, 0x8F7D)
diff --git a/include/scsi/scsi_bsg_fc.h b/include/scsi/scsi_bsg_fc.h
new file mode 100644
index 000000000000..a4b233318179
--- /dev/null
+++ b/include/scsi/scsi_bsg_fc.h
@@ -0,0 +1,322 @@
1/*
2 * FC Transport BSG Interface
3 *
4 * Copyright (C) 2008 James Smart, Emulex 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22#ifndef SCSI_BSG_FC_H
23#define SCSI_BSG_FC_H
24
25/*
26 * This file intended to be included by both kernel and user space
27 */
28
29#include <scsi/scsi.h>
30
31/*
32 * FC Transport SGIO v4 BSG Message Support
33 */
34
35/* Default BSG request timeout (in seconds) */
36#define FC_DEFAULT_BSG_TIMEOUT (10 * HZ)
37
38
39/*
40 * Request Message Codes supported by the FC Transport
41 */
42
43/* define the class masks for the message codes */
44#define FC_BSG_CLS_MASK 0xF0000000 /* find object class */
45#define FC_BSG_HST_MASK 0x80000000 /* fc host class */
46#define FC_BSG_RPT_MASK 0x40000000 /* fc rport class */
47
48 /* fc_host Message Codes */
49#define FC_BSG_HST_ADD_RPORT (FC_BSG_HST_MASK | 0x00000001)
50#define FC_BSG_HST_DEL_RPORT (FC_BSG_HST_MASK | 0x00000002)
51#define FC_BSG_HST_ELS_NOLOGIN (FC_BSG_HST_MASK | 0x00000003)
52#define FC_BSG_HST_CT (FC_BSG_HST_MASK | 0x00000004)
53#define FC_BSG_HST_VENDOR (FC_BSG_HST_MASK | 0x000000FF)
54
55 /* fc_rport Message Codes */
56#define FC_BSG_RPT_ELS (FC_BSG_RPT_MASK | 0x00000001)
57#define FC_BSG_RPT_CT (FC_BSG_RPT_MASK | 0x00000002)
58
59
60
61/*
62 * FC Address Identifiers in Message Structures :
63 *
64 * Whenever a command payload contains a FC Address Identifier
65 * (aka port_id), the value is effectively in big-endian
66 * order, thus the array elements are decoded as follows:
67 * element [0] is bits 23:16 of the FC Address Identifier
68 * element [1] is bits 15:8 of the FC Address Identifier
69 * element [2] is bits 7:0 of the FC Address Identifier
70 */
71
72
73/*
74 * FC Host Messages
75 */
76
77/* FC_BSG_HST_ADDR_PORT : */
78
79/* Request:
80 * This message requests the FC host to login to the remote port
81 * at the specified N_Port_Id. The remote port is to be enumerated
82 * with the transport upon completion of the login.
83 */
84struct fc_bsg_host_add_rport {
85 uint8_t reserved;
86
87 /* FC Address Identier of the remote port to login to */
88 uint8_t port_id[3];
89};
90
91/* Response:
92 * There is no additional response data - fc_bsg_reply->result is sufficient
93 */
94
95
96/* FC_BSG_HST_DEL_RPORT : */
97
98/* Request:
99 * This message requests the FC host to remove an enumerated
100 * remote port and to terminate the login to it.
101 *
102 * Note: The driver is free to reject this request if it desires to
103 * remain logged in with the remote port.
104 */
105struct fc_bsg_host_del_rport {
106 uint8_t reserved;
107
108 /* FC Address Identier of the remote port to logout of */
109 uint8_t port_id[3];
110};
111
112/* Response:
113 * There is no additional response data - fc_bsg_reply->result is sufficient
114 */
115
116
117/* FC_BSG_HST_ELS_NOLOGIN : */
118
119/* Request:
120 * This message requests the FC_Host to send an ELS to a specific
121 * N_Port_ID. The host does not need to log into the remote port,
122 * nor does it need to enumerate the rport for further traffic
123 * (although, the FC host is free to do so if it desires).
124 */
125struct fc_bsg_host_els {
126 /*
127 * ELS Command Code being sent (must be the same as byte 0
128 * of the payload)
129 */
130 uint8_t command_code;
131
132 /* FC Address Identier of the remote port to send the ELS to */
133 uint8_t port_id[3];
134};
135
136/* Response:
137 */
138/* fc_bsg_ctels_reply->status values */
139#define FC_CTELS_STATUS_OK 0x00000000
140#define FC_CTELS_STATUS_REJECT 0x00000001
141#define FC_CTELS_STATUS_P_RJT 0x00000002
142#define FC_CTELS_STATUS_F_RJT 0x00000003
143#define FC_CTELS_STATUS_P_BSY 0x00000004
144#define FC_CTELS_STATUS_F_BSY 0x00000006
145struct fc_bsg_ctels_reply {
146 /*
147 * Note: An ELS LS_RJT may be reported in 2 ways:
148 * a) A status of FC_CTELS_STATUS_OK is returned. The caller
149 * is to look into the ELS receive payload to determine
150 * LS_ACC or LS_RJT (by contents of word 0). The reject
151 * data will be in word 1.
152 * b) A status of FC_CTELS_STATUS_REJECT is returned, The
153 * rjt_data field will contain valid data.
154 *
155 * Note: ELS LS_ACC is determined by an FC_CTELS_STATUS_OK, and
156 * the receive payload word 0 indicates LS_ACC
157 * (e.g. value is 0x02xxxxxx).
158 *
159 * Note: Similarly, a CT Reject may be reported in 2 ways:
160 * a) A status of FC_CTELS_STATUS_OK is returned. The caller
161 * is to look into the CT receive payload to determine
162 * Accept or Reject (by contents of word 2). The reject
163 * data will be in word 3.
164 * b) A status of FC_CTELS_STATUS_REJECT is returned, The
165 * rjt_data field will contain valid data.
166 *
167 * Note: x_RJT/BSY status will indicae that the rjt_data field
168 * is valid and contains the reason/explanation values.
169 */
170 uint32_t status; /* See FC_CTELS_STATUS_xxx */
171
172 /* valid if status is not FC_CTELS_STATUS_OK */
173 struct {
174 uint8_t action; /* fragment_id for CT REJECT */
175 uint8_t reason_code;
176 uint8_t reason_explanation;
177 uint8_t vendor_unique;
178 } rjt_data;
179};
180
181
182/* FC_BSG_HST_CT : */
183
184/* Request:
185 * This message requests that a CT Request be performed with the
186 * indicated N_Port_ID. The driver is responsible for logging in with
187 * the fabric and/or N_Port_ID, etc as per FC rules. This request does
188 * not mandate that the driver must enumerate the destination in the
189 * transport. The driver is allowed to decide whether to enumerate it,
190 * and whether to tear it down after the request.
191 */
192struct fc_bsg_host_ct {
193 uint8_t reserved;
194
195 /* FC Address Identier of the remote port to send the ELS to */
196 uint8_t port_id[3];
197
198 /*
199 * We need words 0-2 of the generic preamble for the LLD's
200 */
201 uint32_t preamble_word0; /* revision & IN_ID */
202 uint32_t preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */
203 uint32_t preamble_word2; /* Cmd Code, Max Size */
204
205};
206/* Response:
207 *
208 * The reply structure is an fc_bsg_ctels_reply structure
209 */
210
211
212/* FC_BSG_HST_VENDOR : */
213
214/* Request:
215 * Note: When specifying vendor_id, be sure to read the Vendor Type and ID
216 * formatting requirements specified in scsi_netlink.h
217 */
218struct fc_bsg_host_vendor {
219 /*
220 * Identifies the vendor that the message is formatted for. This
221 * should be the recipient of the message.
222 */
223 uint64_t vendor_id;
224
225 /* start of vendor command area */
226 uint32_t vendor_cmd[0];
227};
228
229/* Response:
230 */
231struct fc_bsg_host_vendor_reply {
232 /* start of vendor response area */
233 uint32_t vendor_rsp[0];
234};
235
236
237
238/*
239 * FC Remote Port Messages
240 */
241
242/* FC_BSG_RPT_ELS : */
243
244/* Request:
245 * This message requests that an ELS be performed with the rport.
246 */
247struct fc_bsg_rport_els {
248 /*
249 * ELS Command Code being sent (must be the same as
250 * byte 0 of the payload)
251 */
252 uint8_t els_code;
253};
254
255/* Response:
256 *
257 * The reply structure is an fc_bsg_ctels_reply structure
258 */
259
260
261/* FC_BSG_RPT_CT : */
262
263/* Request:
264 * This message requests that a CT Request be performed with the rport.
265 */
266struct fc_bsg_rport_ct {
267 /*
268 * We need words 0-2 of the generic preamble for the LLD's
269 */
270 uint32_t preamble_word0; /* revision & IN_ID */
271 uint32_t preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */
272 uint32_t preamble_word2; /* Cmd Code, Max Size */
273};
274/* Response:
275 *
276 * The reply structure is an fc_bsg_ctels_reply structure
277 */
278
279
280
281
282/* request (CDB) structure of the sg_io_v4 */
283struct fc_bsg_request {
284 uint32_t msgcode;
285 union {
286 struct fc_bsg_host_add_rport h_addrport;
287 struct fc_bsg_host_del_rport h_delrport;
288 struct fc_bsg_host_els h_els;
289 struct fc_bsg_host_ct h_ct;
290 struct fc_bsg_host_vendor h_vendor;
291
292 struct fc_bsg_rport_els r_els;
293 struct fc_bsg_rport_ct r_ct;
294 } rqst_data;
295};
296
297
298/* response (request sense data) structure of the sg_io_v4 */
299struct fc_bsg_reply {
300 /*
301 * The completion result. Result exists in two forms:
302 * if negative, it is an -Exxx system errno value. There will
303 * be no further reply information supplied.
304 * else, it's the 4-byte scsi error result, with driver, host,
305 * msg and status fields. The per-msgcode reply structure
306 * will contain valid data.
307 */
308 uint32_t result;
309
310 /* If there was reply_payload, how much was recevied ? */
311 uint32_t reply_payload_rcv_len;
312
313 union {
314 struct fc_bsg_host_vendor_reply vendor_reply;
315
316 struct fc_bsg_ctels_reply ctels_reply;
317 } reply_data;
318};
319
320
321#endif /* SCSI_BSG_FC_H */
322
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 43b50d36925c..3878d1dc7f59 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -270,7 +270,7 @@ static inline unsigned char scsi_get_prot_type(struct scsi_cmnd *scmd)
270 270
271static inline sector_t scsi_get_lba(struct scsi_cmnd *scmd) 271static inline sector_t scsi_get_lba(struct scsi_cmnd *scmd)
272{ 272{
273 return scmd->request->sector; 273 return blk_rq_pos(scmd->request);
274} 274}
275 275
276static inline unsigned scsi_prot_sg_count(struct scsi_cmnd *cmd) 276static inline unsigned scsi_prot_sg_count(struct scsi_cmnd *cmd)
diff --git a/include/scsi/scsi_driver.h b/include/scsi/scsi_driver.h
index 1f5ca7f62116..9fd6702f02e2 100644
--- a/include/scsi/scsi_driver.h
+++ b/include/scsi/scsi_driver.h
@@ -32,5 +32,6 @@ int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req);
32int scsi_setup_fs_cmnd(struct scsi_device *sdev, struct request *req); 32int scsi_setup_fs_cmnd(struct scsi_device *sdev, struct request *req);
33int scsi_prep_state_check(struct scsi_device *sdev, struct request *req); 33int scsi_prep_state_check(struct scsi_device *sdev, struct request *req);
34int scsi_prep_return(struct request_queue *q, struct request *req, int ret); 34int scsi_prep_return(struct request_queue *q, struct request *req, int ret);
35int scsi_prep_fn(struct request_queue *, struct request *);
35 36
36#endif /* _SCSI_SCSI_DRIVER_H */ 37#endif /* _SCSI_SCSI_DRIVER_H */
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index d123ca84e732..b62a097b3ecb 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -478,6 +478,15 @@ struct scsi_host_template {
478 * module_init/module_exit. 478 * module_init/module_exit.
479 */ 479 */
480 struct list_head legacy_hosts; 480 struct list_head legacy_hosts;
481
482 /*
483 * Vendor Identifier associated with the host
484 *
485 * Note: When specifying vendor_id, be sure to read the
486 * Vendor Type and ID formatting requirements specified in
487 * scsi_netlink.h
488 */
489 u64 vendor_id;
481}; 490};
482 491
483/* 492/*
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 68a8d873bbd9..fc50bd64aa4e 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -33,7 +33,6 @@
33 33
34struct scsi_transport_template; 34struct scsi_transport_template;
35 35
36
37/* 36/*
38 * FC Port definitions - Following FC HBAAPI guidelines 37 * FC Port definitions - Following FC HBAAPI guidelines
39 * 38 *
@@ -352,6 +351,7 @@ struct fc_rport { /* aka fc_starget_attrs */
352 struct delayed_work fail_io_work; 351 struct delayed_work fail_io_work;
353 struct work_struct stgt_delete_work; 352 struct work_struct stgt_delete_work;
354 struct work_struct rport_delete_work; 353 struct work_struct rport_delete_work;
354 struct request_queue *rqst_q; /* bsg support */
355} __attribute__((aligned(sizeof(unsigned long)))); 355} __attribute__((aligned(sizeof(unsigned long))));
356 356
357/* bit field values for struct fc_rport "flags" field: */ 357/* bit field values for struct fc_rport "flags" field: */
@@ -514,6 +514,9 @@ struct fc_host_attrs {
514 struct workqueue_struct *work_q; 514 struct workqueue_struct *work_q;
515 char devloss_work_q_name[20]; 515 char devloss_work_q_name[20];
516 struct workqueue_struct *devloss_work_q; 516 struct workqueue_struct *devloss_work_q;
517
518 /* bsg support */
519 struct request_queue *rqst_q;
517}; 520};
518 521
519#define shost_to_fc_host(x) \ 522#define shost_to_fc_host(x) \
@@ -579,6 +582,47 @@ struct fc_host_attrs {
579 (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q) 582 (((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q)
580 583
581 584
585struct fc_bsg_buffer {
586 unsigned int payload_len;
587 int sg_cnt;
588 struct scatterlist *sg_list;
589};
590
591/* Values for fc_bsg_job->state_flags (bitflags) */
592#define FC_RQST_STATE_INPROGRESS 0
593#define FC_RQST_STATE_DONE 1
594
595struct fc_bsg_job {
596 struct Scsi_Host *shost;
597 struct fc_rport *rport;
598 struct device *dev;
599 struct request *req;
600 spinlock_t job_lock;
601 unsigned int state_flags;
602 unsigned int ref_cnt;
603 void (*job_done)(struct fc_bsg_job *);
604
605 struct fc_bsg_request *request;
606 struct fc_bsg_reply *reply;
607 unsigned int request_len;
608 unsigned int reply_len;
609 /*
610 * On entry : reply_len indicates the buffer size allocated for
611 * the reply.
612 *
613 * Upon completion : the message handler must set reply_len
614 * to indicates the size of the reply to be returned to the
615 * caller.
616 */
617
618 /* DMA payloads for the request/response */
619 struct fc_bsg_buffer request_payload;
620 struct fc_bsg_buffer reply_payload;
621
622 void *dd_data; /* Used for driver-specific storage */
623};
624
625
582/* The functions by which the transport class and the driver communicate */ 626/* The functions by which the transport class and the driver communicate */
583struct fc_function_template { 627struct fc_function_template {
584 void (*get_rport_dev_loss_tmo)(struct fc_rport *); 628 void (*get_rport_dev_loss_tmo)(struct fc_rport *);
@@ -614,9 +658,14 @@ struct fc_function_template {
614 int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64, int); 658 int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64, int);
615 int (* it_nexus_response)(struct Scsi_Host *, u64, int); 659 int (* it_nexus_response)(struct Scsi_Host *, u64, int);
616 660
661 /* bsg support */
662 int (*bsg_request)(struct fc_bsg_job *);
663 int (*bsg_timeout)(struct fc_bsg_job *);
664
617 /* allocation lengths for host-specific data */ 665 /* allocation lengths for host-specific data */
618 u32 dd_fcrport_size; 666 u32 dd_fcrport_size;
619 u32 dd_fcvport_size; 667 u32 dd_fcvport_size;
668 u32 dd_bsg_size;
620 669
621 /* 670 /*
622 * The driver sets these to tell the transport class it 671 * The driver sets these to tell the transport class it
@@ -737,7 +786,6 @@ fc_vport_set_state(struct fc_vport *vport, enum fc_vport_state new_state)
737 vport->vport_state = new_state; 786 vport->vport_state = new_state;
738} 787}
739 788
740
741struct scsi_transport_template *fc_attach_transport( 789struct scsi_transport_template *fc_attach_transport(
742 struct fc_function_template *); 790 struct fc_function_template *);
743void fc_release_transport(struct scsi_transport_template *); 791void fc_release_transport(struct scsi_transport_template *);
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 457588e1119b..349c7f30720d 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -126,12 +126,14 @@ struct iscsi_transport {
126 int *index, int *age); 126 int *index, int *age);
127 127
128 void (*session_recovery_timedout) (struct iscsi_cls_session *session); 128 void (*session_recovery_timedout) (struct iscsi_cls_session *session);
129 struct iscsi_endpoint *(*ep_connect) (struct sockaddr *dst_addr, 129 struct iscsi_endpoint *(*ep_connect) (struct Scsi_Host *shost,
130 struct sockaddr *dst_addr,
130 int non_blocking); 131 int non_blocking);
131 int (*ep_poll) (struct iscsi_endpoint *ep, int timeout_ms); 132 int (*ep_poll) (struct iscsi_endpoint *ep, int timeout_ms);
132 void (*ep_disconnect) (struct iscsi_endpoint *ep); 133 void (*ep_disconnect) (struct iscsi_endpoint *ep);
133 int (*tgt_dscvr) (struct Scsi_Host *shost, enum iscsi_tgt_dscvr type, 134 int (*tgt_dscvr) (struct Scsi_Host *shost, enum iscsi_tgt_dscvr type,
134 uint32_t enable, struct sockaddr *dst_addr); 135 uint32_t enable, struct sockaddr *dst_addr);
136 int (*set_path) (struct Scsi_Host *shost, struct iscsi_path *params);
135}; 137};
136 138
137/* 139/*
@@ -148,6 +150,10 @@ extern void iscsi_conn_error_event(struct iscsi_cls_conn *conn,
148extern int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, 150extern int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
149 char *data, uint32_t data_size); 151 char *data, uint32_t data_size);
150 152
153extern int iscsi_offload_mesg(struct Scsi_Host *shost,
154 struct iscsi_transport *transport, uint32_t type,
155 char *data, uint16_t data_size);
156
151struct iscsi_cls_conn { 157struct iscsi_cls_conn {
152 struct list_head conn_list; /* item in connlist */ 158 struct list_head conn_list; /* item in connlist */
153 void *dd_data; /* LLD private data */ 159 void *dd_data; /* LLD private data */
diff --git a/include/scsi/scsi_transport_spi.h b/include/scsi/scsi_transport_spi.h
index 286e9628ed8b..7497a383b1a4 100644
--- a/include/scsi/scsi_transport_spi.h
+++ b/include/scsi/scsi_transport_spi.h
@@ -36,8 +36,10 @@ struct spi_transport_attrs {
36 unsigned int width:1; /* 0 - narrow, 1 - wide */ 36 unsigned int width:1; /* 0 - narrow, 1 - wide */
37 unsigned int max_width:1; 37 unsigned int max_width:1;
38 unsigned int iu:1; /* Information Units enabled */ 38 unsigned int iu:1; /* Information Units enabled */
39 unsigned int max_iu:1;
39 unsigned int dt:1; /* DT clocking enabled */ 40 unsigned int dt:1; /* DT clocking enabled */
40 unsigned int qas:1; /* Quick Arbitration and Selection enabled */ 41 unsigned int qas:1; /* Quick Arbitration and Selection enabled */
42 unsigned int max_qas:1;
41 unsigned int wr_flow:1; /* Write Flow control enabled */ 43 unsigned int wr_flow:1; /* Write Flow control enabled */
42 unsigned int rd_strm:1; /* Read streaming enabled */ 44 unsigned int rd_strm:1; /* Read streaming enabled */
43 unsigned int rti:1; /* Retain Training Information */ 45 unsigned int rti:1; /* Retain Training Information */
@@ -77,8 +79,10 @@ struct spi_host_attrs {
77#define spi_width(x) (((struct spi_transport_attrs *)&(x)->starget_data)->width) 79#define spi_width(x) (((struct spi_transport_attrs *)&(x)->starget_data)->width)
78#define spi_max_width(x) (((struct spi_transport_attrs *)&(x)->starget_data)->max_width) 80#define spi_max_width(x) (((struct spi_transport_attrs *)&(x)->starget_data)->max_width)
79#define spi_iu(x) (((struct spi_transport_attrs *)&(x)->starget_data)->iu) 81#define spi_iu(x) (((struct spi_transport_attrs *)&(x)->starget_data)->iu)
82#define spi_max_iu(x) (((struct spi_transport_attrs *)&(x)->starget_data)->max_iu)
80#define spi_dt(x) (((struct spi_transport_attrs *)&(x)->starget_data)->dt) 83#define spi_dt(x) (((struct spi_transport_attrs *)&(x)->starget_data)->dt)
81#define spi_qas(x) (((struct spi_transport_attrs *)&(x)->starget_data)->qas) 84#define spi_qas(x) (((struct spi_transport_attrs *)&(x)->starget_data)->qas)
85#define spi_max_qas(x) (((struct spi_transport_attrs *)&(x)->starget_data)->max_qas)
82#define spi_wr_flow(x) (((struct spi_transport_attrs *)&(x)->starget_data)->wr_flow) 86#define spi_wr_flow(x) (((struct spi_transport_attrs *)&(x)->starget_data)->wr_flow)
83#define spi_rd_strm(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rd_strm) 87#define spi_rd_strm(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rd_strm)
84#define spi_rti(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rti) 88#define spi_rti(x) (((struct spi_transport_attrs *)&(x)->starget_data)->rti)
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 6add80fc2512..82aed3f47534 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -255,6 +255,7 @@ typedef int __bitwise snd_pcm_subformat_t;
255#define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */ 255#define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */
256#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */ 256#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */
257#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */ 257#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */
258#define SNDRV_PCM_INFO_FIFO_IN_FRAMES 0x80000000 /* internal kernel flag - FIFO size is in frames */
258 259
259typedef int __bitwise snd_pcm_state_t; 260typedef int __bitwise snd_pcm_state_t;
260#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */ 261#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */
diff --git a/include/sound/core.h b/include/sound/core.h
index 3dea79829acc..309cb9659a05 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -300,19 +300,10 @@ int snd_card_create(int idx, const char *id,
300 struct module *module, int extra_size, 300 struct module *module, int extra_size,
301 struct snd_card **card_ret); 301 struct snd_card **card_ret);
302 302
303static inline __deprecated
304struct snd_card *snd_card_new(int idx, const char *id,
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
313int snd_card_disconnect(struct snd_card *card); 303int snd_card_disconnect(struct snd_card *card);
314int snd_card_free(struct snd_card *card); 304int snd_card_free(struct snd_card *card);
315int snd_card_free_when_closed(struct snd_card *card); 305int snd_card_free_when_closed(struct snd_card *card);
306void snd_card_set_id(struct snd_card *card, const char *id);
316int snd_card_register(struct snd_card *card); 307int snd_card_register(struct snd_card *card);
317int snd_card_info_init(void); 308int snd_card_info_init(void);
318int snd_card_info_done(void); 309int snd_card_info_done(void);
diff --git a/include/sound/driver.h b/include/sound/driver.h
deleted file mode 100644
index f0359437d01a..000000000000
--- a/include/sound/driver.h
+++ /dev/null
@@ -1 +0,0 @@
1#warning "This file is deprecated"
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index c17296891617..23893523dc8c 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -98,6 +98,7 @@ struct snd_pcm_ops {
98#define SNDRV_PCM_IOCTL1_INFO 1 98#define SNDRV_PCM_IOCTL1_INFO 1
99#define SNDRV_PCM_IOCTL1_CHANNEL_INFO 2 99#define SNDRV_PCM_IOCTL1_CHANNEL_INFO 2
100#define SNDRV_PCM_IOCTL1_GSTATE 3 100#define SNDRV_PCM_IOCTL1_GSTATE 3
101#define SNDRV_PCM_IOCTL1_FIFO_SIZE 4
101 102
102#define SNDRV_PCM_TRIGGER_STOP 0 103#define SNDRV_PCM_TRIGGER_STOP 0
103#define SNDRV_PCM_TRIGGER_START 1 104#define SNDRV_PCM_TRIGGER_START 1
@@ -270,6 +271,7 @@ struct snd_pcm_runtime {
270 snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */ 271 snd_pcm_uframes_t hw_ptr_base; /* Position at buffer restart */
271 snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time */ 272 snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time */
272 unsigned long hw_ptr_jiffies; /* Time when hw_ptr is updated */ 273 unsigned long hw_ptr_jiffies; /* Time when hw_ptr is updated */
274 snd_pcm_sframes_t delay; /* extra delay; typically FIFO size */
273 275
274 /* -- HW params -- */ 276 /* -- HW params -- */
275 snd_pcm_access_t access; /* access mode */ 277 snd_pcm_access_t access; /* access mode */
@@ -486,80 +488,6 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream);
486void snd_pcm_vma_notify_data(void *client, void *data); 488void snd_pcm_vma_notify_data(void *client, void *data);
487int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area); 489int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area);
488 490
489#if BITS_PER_LONG >= 64
490
491static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem)
492{
493 *rem = *n % div;
494 *n /= div;
495}
496
497#elif defined(i386)
498
499static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem)
500{
501 u_int32_t low, high;
502 low = *n & 0xffffffff;
503 high = *n >> 32;
504 if (high) {
505 u_int32_t high1 = high % div;
506 high /= div;
507 asm("divl %2":"=a" (low), "=d" (*rem):"rm" (div), "a" (low), "d" (high1));
508 *n = (u_int64_t)high << 32 | low;
509 } else {
510 *n = low / div;
511 *rem = low % div;
512 }
513}
514#else
515
516static inline void divl(u_int32_t high, u_int32_t low,
517 u_int32_t div,
518 u_int32_t *q, u_int32_t *r)
519{
520 u_int64_t n = (u_int64_t)high << 32 | low;
521 u_int64_t d = (u_int64_t)div << 31;
522 u_int32_t q1 = 0;
523 int c = 32;
524 while (n > 0xffffffffU) {
525 q1 <<= 1;
526 if (n >= d) {
527 n -= d;
528 q1 |= 1;
529 }
530 d >>= 1;
531 c--;
532 }
533 q1 <<= c;
534 if (n) {
535 low = n;
536 *q = q1 | (low / div);
537 *r = low % div;
538 } else {
539 *r = 0;
540 *q = q1;
541 }
542 return;
543}
544
545static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem)
546{
547 u_int32_t low, high;
548 low = *n & 0xffffffff;
549 high = *n >> 32;
550 if (high) {
551 u_int32_t high1 = high % div;
552 u_int32_t low1 = low;
553 high /= div;
554 divl(high1, low1, div, &low, rem);
555 *n = (u_int64_t)high << 32 | low;
556 } else {
557 *n = low / div;
558 *rem = low % div;
559 }
560}
561#endif
562
563/* 491/*
564 * PCM library 492 * PCM library
565 */ 493 */
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 13676472ddfc..352d7eee9b6d 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -45,24 +45,6 @@ struct snd_pcm_substream;
45#define SND_SOC_DAIFMT_GATED (1 << 4) /* clock is gated */ 45#define SND_SOC_DAIFMT_GATED (1 << 4) /* clock is gated */
46 46
47/* 47/*
48 * DAI Left/Right Clocks.
49 *
50 * Specifies whether the DAI can support different samples for similtanious
51 * playback and capture. This usually requires a seperate physical frame
52 * clock for playback and capture.
53 */
54#define SND_SOC_DAIFMT_SYNC (0 << 5) /* Tx FRM = Rx FRM */
55#define SND_SOC_DAIFMT_ASYNC (1 << 5) /* Tx FRM ~ Rx FRM */
56
57/*
58 * TDM
59 *
60 * Time Division Multiplexing. Allows PCM data to be multplexed with other
61 * data on the DAI.
62 */
63#define SND_SOC_DAIFMT_TDM (1 << 6)
64
65/*
66 * DAI hardware signal inversions. 48 * DAI hardware signal inversions.
67 * 49 *
68 * Specifies whether the DAI can also support inverted clocks for the specified 50 * Specifies whether the DAI can also support inverted clocks for the specified
@@ -96,6 +78,10 @@ struct snd_pcm_substream;
96#define SND_SOC_CLOCK_IN 0 78#define SND_SOC_CLOCK_IN 0
97#define SND_SOC_CLOCK_OUT 1 79#define SND_SOC_CLOCK_OUT 1
98 80
81#define SND_SOC_STD_AC97_FMTS (SNDRV_PCM_FMTBIT_S16_LE |\
82 SNDRV_PCM_FMTBIT_S32_LE |\
83 SNDRV_PCM_FMTBIT_S32_BE)
84
99struct snd_soc_dai_ops; 85struct snd_soc_dai_ops;
100struct snd_soc_dai; 86struct snd_soc_dai;
101struct snd_ac97_bus_ops; 87struct snd_ac97_bus_ops;
@@ -208,6 +194,7 @@ struct snd_soc_dai {
208 /* DAI capabilities */ 194 /* DAI capabilities */
209 struct snd_soc_pcm_stream capture; 195 struct snd_soc_pcm_stream capture;
210 struct snd_soc_pcm_stream playback; 196 struct snd_soc_pcm_stream playback;
197 unsigned int symmetric_rates:1;
211 198
212 /* DAI runtime info */ 199 /* DAI runtime info */
213 struct snd_pcm_runtime *runtime; 200 struct snd_pcm_runtime *runtime;
@@ -219,11 +206,8 @@ struct snd_soc_dai {
219 /* DAI private data */ 206 /* DAI private data */
220 void *private_data; 207 void *private_data;
221 208
222 /* parent codec/platform */ 209 /* parent platform */
223 union { 210 struct snd_soc_platform *platform;
224 struct snd_soc_codec *codec;
225 struct snd_soc_platform *platform;
226 };
227 211
228 struct list_head list; 212 struct list_head list;
229}; 213};
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index a7def6a9a030..ec8a45f9a069 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -140,16 +140,30 @@
140#define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \ 140#define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \
141{ .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \ 141{ .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \
142 .shift = wshift, .invert = winvert} 142 .shift = wshift, .invert = winvert}
143#define SND_SOC_DAPM_DAC_E(wname, stname, wreg, wshift, winvert, \
144 wevent, wflags) \
145{ .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \
146 .shift = wshift, .invert = winvert, \
147 .event = wevent, .event_flags = wflags}
143#define SND_SOC_DAPM_ADC(wname, stname, wreg, wshift, winvert) \ 148#define SND_SOC_DAPM_ADC(wname, stname, wreg, wshift, winvert) \
144{ .id = snd_soc_dapm_adc, .name = wname, .sname = stname, .reg = wreg, \ 149{ .id = snd_soc_dapm_adc, .name = wname, .sname = stname, .reg = wreg, \
145 .shift = wshift, .invert = winvert} 150 .shift = wshift, .invert = winvert}
151#define SND_SOC_DAPM_ADC_E(wname, stname, wreg, wshift, winvert, \
152 wevent, wflags) \
153{ .id = snd_soc_dapm_adc, .name = wname, .sname = stname, .reg = wreg, \
154 .shift = wshift, .invert = winvert, \
155 .event = wevent, .event_flags = wflags}
146 156
147/* generic register modifier widget */ 157/* generic widgets */
148#define SND_SOC_DAPM_REG(wid, wname, wreg, wshift, wmask, won_val, woff_val) \ 158#define SND_SOC_DAPM_REG(wid, wname, wreg, wshift, wmask, won_val, woff_val) \
149{ .id = wid, .name = wname, .kcontrols = NULL, .num_kcontrols = 0, \ 159{ .id = wid, .name = wname, .kcontrols = NULL, .num_kcontrols = 0, \
150 .reg = -((wreg) + 1), .shift = wshift, .mask = wmask, \ 160 .reg = -((wreg) + 1), .shift = wshift, .mask = wmask, \
151 .on_val = won_val, .off_val = woff_val, .event = dapm_reg_event, \ 161 .on_val = won_val, .off_val = woff_val, .event = dapm_reg_event, \
152 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD} 162 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD}
163#define SND_SOC_DAPM_SUPPLY(wname, wreg, wshift, winvert, wevent, wflags) \
164{ .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \
165 .shift = wshift, .invert = winvert, .event = wevent, \
166 .event_flags = wflags}
153 167
154/* dapm kcontrol types */ 168/* dapm kcontrol types */
155#define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \ 169#define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \
@@ -265,8 +279,6 @@ int snd_soc_dapm_add_routes(struct snd_soc_codec *codec,
265/* dapm events */ 279/* dapm events */
266int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, char *stream, 280int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, char *stream,
267 int event); 281 int event);
268int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev,
269 enum snd_soc_bias_level level);
270 282
271/* dapm sys fs - used by the core */ 283/* dapm sys fs - used by the core */
272int snd_soc_dapm_sys_add(struct device *dev); 284int snd_soc_dapm_sys_add(struct device *dev);
@@ -298,6 +310,7 @@ enum snd_soc_dapm_type {
298 snd_soc_dapm_vmid, /* codec bias/vmid - to minimise pops */ 310 snd_soc_dapm_vmid, /* codec bias/vmid - to minimise pops */
299 snd_soc_dapm_pre, /* machine specific pre widget - exec first */ 311 snd_soc_dapm_pre, /* machine specific pre widget - exec first */
300 snd_soc_dapm_post, /* machine specific post widget - exec last */ 312 snd_soc_dapm_post, /* machine specific post widget - exec last */
313 snd_soc_dapm_supply, /* power/clock supply */
301}; 314};
302 315
303/* 316/*
@@ -357,6 +370,8 @@ struct snd_soc_dapm_widget {
357 unsigned char suspend:1; /* was active before suspend */ 370 unsigned char suspend:1; /* was active before suspend */
358 unsigned char pmdown:1; /* waiting for timeout */ 371 unsigned char pmdown:1; /* waiting for timeout */
359 372
373 int (*power_check)(struct snd_soc_dapm_widget *w);
374
360 /* external events */ 375 /* external events */
361 unsigned short event_flags; /* flags to specify event types */ 376 unsigned short event_flags; /* flags to specify event types */
362 int (*event)(struct snd_soc_dapm_widget*, struct snd_kcontrol *, int); 377 int (*event)(struct snd_soc_dapm_widget*, struct snd_kcontrol *, int);
@@ -368,6 +383,9 @@ struct snd_soc_dapm_widget {
368 /* widget input and outputs */ 383 /* widget input and outputs */
369 struct list_head sources; 384 struct list_head sources;
370 struct list_head sinks; 385 struct list_head sinks;
386
387 /* used during DAPM updates */
388 struct list_head power_list;
371}; 389};
372 390
373#endif 391#endif
diff --git a/include/sound/soc.h b/include/sound/soc.h
index a40bc6f316fc..cf6111d72b17 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -118,6 +118,14 @@
118 .info = snd_soc_info_volsw, \ 118 .info = snd_soc_info_volsw, \
119 .get = xhandler_get, .put = xhandler_put, \ 119 .get = xhandler_get, .put = xhandler_put, \
120 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) } 120 .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
121#define SOC_DOUBLE_EXT(xname, xreg, shift_left, shift_right, xmax, xinvert,\
122 xhandler_get, xhandler_put) \
123{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
124 .info = snd_soc_info_volsw, \
125 .get = xhandler_get, .put = xhandler_put, \
126 .private_value = (unsigned long)&(struct soc_mixer_control) \
127 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \
128 .max = xmax, .invert = xinvert} }
121#define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\ 129#define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\
122 xhandler_get, xhandler_put, tlv_array) \ 130 xhandler_get, xhandler_put, tlv_array) \
123{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 131{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
@@ -206,10 +214,6 @@ void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
206 struct snd_soc_jack_gpio *gpios); 214 struct snd_soc_jack_gpio *gpios);
207#endif 215#endif
208 216
209/* codec IO */
210#define snd_soc_read(codec, reg) codec->read(codec, reg)
211#define snd_soc_write(codec, reg, value) codec->write(codec, reg, value)
212
213/* codec register bit access */ 217/* codec register bit access */
214int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg, 218int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg,
215 unsigned short mask, unsigned short value); 219 unsigned short mask, unsigned short value);
@@ -331,6 +335,7 @@ struct snd_soc_codec {
331 struct module *owner; 335 struct module *owner;
332 struct mutex mutex; 336 struct mutex mutex;
333 struct device *dev; 337 struct device *dev;
338 struct snd_soc_device *socdev;
334 339
335 struct list_head list; 340 struct list_head list;
336 341
@@ -364,6 +369,8 @@ struct snd_soc_codec {
364 enum snd_soc_bias_level bias_level; 369 enum snd_soc_bias_level bias_level;
365 enum snd_soc_bias_level suspend_bias_level; 370 enum snd_soc_bias_level suspend_bias_level;
366 struct delayed_work delayed_work; 371 struct delayed_work delayed_work;
372 struct list_head up_list;
373 struct list_head down_list;
367 374
368 /* codec DAI's */ 375 /* codec DAI's */
369 struct snd_soc_dai *dai; 376 struct snd_soc_dai *dai;
@@ -417,6 +424,12 @@ struct snd_soc_dai_link {
417 /* codec/machine specific init - e.g. add machine controls */ 424 /* codec/machine specific init - e.g. add machine controls */
418 int (*init)(struct snd_soc_codec *codec); 425 int (*init)(struct snd_soc_codec *codec);
419 426
427 /* Symmetry requirements */
428 unsigned int symmetric_rates:1;
429
430 /* Symmetry data - only valid if symmetry is being enforced */
431 unsigned int rate;
432
420 /* DAI pcm */ 433 /* DAI pcm */
421 struct snd_pcm *pcm; 434 struct snd_pcm *pcm;
422}; 435};
@@ -490,6 +503,19 @@ struct soc_enum {
490 void *dapm; 503 void *dapm;
491}; 504};
492 505
506/* codec IO */
507static inline unsigned int snd_soc_read(struct snd_soc_codec *codec,
508 unsigned int reg)
509{
510 return codec->read(codec, reg);
511}
512
513static inline unsigned int snd_soc_write(struct snd_soc_codec *codec,
514 unsigned int reg, unsigned int val)
515{
516 return codec->write(codec, reg, val);
517}
518
493#include <sound/soc-dai.h> 519#include <sound/soc-dai.h>
494 520
495#endif 521#endif
diff --git a/include/sound/wm9081.h b/include/sound/wm9081.h
new file mode 100644
index 000000000000..e173ddbf6bd4
--- /dev/null
+++ b/include/sound/wm9081.h
@@ -0,0 +1,25 @@
1/*
2 * linux/sound/wm9081.h -- Platform data for WM9081
3 *
4 * Copyright 2009 Wolfson Microelectronics. PLC.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __LINUX_SND_WM_9081_H
12#define __LINUX_SND_WM_9081_H
13
14struct wm9081_retune_mobile_setting {
15 const char *name;
16 unsigned int rate;
17 u16 config[20];
18};
19
20struct wm9081_retune_mobile_config {
21 struct wm9081_retune_mobile_setting *configs;
22 int num_configs;
23};
24
25#endif
diff --git a/include/trace/block.h b/include/trace/block.h
deleted file mode 100644
index 25b7068b819e..000000000000
--- a/include/trace/block.h
+++ /dev/null
@@ -1,76 +0,0 @@
1#ifndef _TRACE_BLOCK_H
2#define _TRACE_BLOCK_H
3
4#include <linux/blkdev.h>
5#include <linux/tracepoint.h>
6
7DECLARE_TRACE(block_rq_abort,
8 TP_PROTO(struct request_queue *q, struct request *rq),
9 TP_ARGS(q, rq));
10
11DECLARE_TRACE(block_rq_insert,
12 TP_PROTO(struct request_queue *q, struct request *rq),
13 TP_ARGS(q, rq));
14
15DECLARE_TRACE(block_rq_issue,
16 TP_PROTO(struct request_queue *q, struct request *rq),
17 TP_ARGS(q, rq));
18
19DECLARE_TRACE(block_rq_requeue,
20 TP_PROTO(struct request_queue *q, struct request *rq),
21 TP_ARGS(q, rq));
22
23DECLARE_TRACE(block_rq_complete,
24 TP_PROTO(struct request_queue *q, struct request *rq),
25 TP_ARGS(q, rq));
26
27DECLARE_TRACE(block_bio_bounce,
28 TP_PROTO(struct request_queue *q, struct bio *bio),
29 TP_ARGS(q, bio));
30
31DECLARE_TRACE(block_bio_complete,
32 TP_PROTO(struct request_queue *q, struct bio *bio),
33 TP_ARGS(q, bio));
34
35DECLARE_TRACE(block_bio_backmerge,
36 TP_PROTO(struct request_queue *q, struct bio *bio),
37 TP_ARGS(q, bio));
38
39DECLARE_TRACE(block_bio_frontmerge,
40 TP_PROTO(struct request_queue *q, struct bio *bio),
41 TP_ARGS(q, bio));
42
43DECLARE_TRACE(block_bio_queue,
44 TP_PROTO(struct request_queue *q, struct bio *bio),
45 TP_ARGS(q, bio));
46
47DECLARE_TRACE(block_getrq,
48 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
49 TP_ARGS(q, bio, rw));
50
51DECLARE_TRACE(block_sleeprq,
52 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
53 TP_ARGS(q, bio, rw));
54
55DECLARE_TRACE(block_plug,
56 TP_PROTO(struct request_queue *q),
57 TP_ARGS(q));
58
59DECLARE_TRACE(block_unplug_timer,
60 TP_PROTO(struct request_queue *q),
61 TP_ARGS(q));
62
63DECLARE_TRACE(block_unplug_io,
64 TP_PROTO(struct request_queue *q),
65 TP_ARGS(q));
66
67DECLARE_TRACE(block_split,
68 TP_PROTO(struct request_queue *q, struct bio *bio, unsigned int pdu),
69 TP_ARGS(q, bio, pdu));
70
71DECLARE_TRACE(block_remap,
72 TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev,
73 sector_t from, sector_t to),
74 TP_ARGS(q, bio, dev, from, to));
75
76#endif
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
new file mode 100644
index 000000000000..f7a7ae1e8f90
--- /dev/null
+++ b/include/trace/define_trace.h
@@ -0,0 +1,75 @@
1/*
2 * Trace files that want to automate creationg of all tracepoints defined
3 * in their file should include this file. The following are macros that the
4 * trace file may define:
5 *
6 * TRACE_SYSTEM defines the system the tracepoint is for
7 *
8 * TRACE_INCLUDE_FILE if the file name is something other than TRACE_SYSTEM.h
9 * This macro may be defined to tell define_trace.h what file to include.
10 * Note, leave off the ".h".
11 *
12 * TRACE_INCLUDE_PATH if the path is something other than core kernel include/trace
13 * then this macro can define the path to use. Note, the path is relative to
14 * define_trace.h, not the file including it. Full path names for out of tree
15 * modules must be used.
16 */
17
18#ifdef CREATE_TRACE_POINTS
19
20/* Prevent recursion */
21#undef CREATE_TRACE_POINTS
22
23#include <linux/stringify.h>
24
25#undef TRACE_EVENT
26#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
27 DEFINE_TRACE(name)
28
29#undef DECLARE_TRACE
30#define DECLARE_TRACE(name, proto, args) \
31 DEFINE_TRACE(name)
32
33#undef TRACE_INCLUDE
34#undef __TRACE_INCLUDE
35
36#ifndef TRACE_INCLUDE_FILE
37# define TRACE_INCLUDE_FILE TRACE_SYSTEM
38# define UNDEF_TRACE_INCLUDE_FILE
39#endif
40
41#ifndef TRACE_INCLUDE_PATH
42# define __TRACE_INCLUDE(system) <trace/events/system.h>
43# define UNDEF_TRACE_INCLUDE_PATH
44#else
45# define __TRACE_INCLUDE(system) __stringify(TRACE_INCLUDE_PATH/system.h)
46#endif
47
48# define TRACE_INCLUDE(system) __TRACE_INCLUDE(system)
49
50/* Let the trace headers be reread */
51#define TRACE_HEADER_MULTI_READ
52
53#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
54
55#ifdef CONFIG_EVENT_TRACING
56#include <trace/ftrace.h>
57#endif
58
59#undef TRACE_HEADER_MULTI_READ
60
61/* Only undef what we defined in this file */
62#ifdef UNDEF_TRACE_INCLUDE_FILE
63# undef TRACE_INCLUDE_FILE
64# undef UNDEF_TRACE_INCLUDE_FILE
65#endif
66
67#ifdef UNDEF_TRACE_INCLUDE_PATH
68# undef TRACE_INCLUDE_PATH
69# undef UNDEF_TRACE_INCLUDE_PATH
70#endif
71
72/* We may be processing more files */
73#define CREATE_TRACE_POINTS
74
75#endif /* CREATE_TRACE_POINTS */
diff --git a/include/trace/events/block.h b/include/trace/events/block.h
new file mode 100644
index 000000000000..d6b05f42dd44
--- /dev/null
+++ b/include/trace/events/block.h
@@ -0,0 +1,493 @@
1#if !defined(_TRACE_BLOCK_H) || defined(TRACE_HEADER_MULTI_READ)
2#define _TRACE_BLOCK_H
3
4#include <linux/blktrace_api.h>
5#include <linux/blkdev.h>
6#include <linux/tracepoint.h>
7
8#undef TRACE_SYSTEM
9#define TRACE_SYSTEM block
10
11TRACE_EVENT(block_rq_abort,
12
13 TP_PROTO(struct request_queue *q, struct request *rq),
14
15 TP_ARGS(q, rq),
16
17 TP_STRUCT__entry(
18 __field( dev_t, dev )
19 __field( sector_t, sector )
20 __field( unsigned int, nr_sector )
21 __field( int, errors )
22 __array( char, rwbs, 6 )
23 __dynamic_array( char, cmd, blk_cmd_buf_len(rq) )
24 ),
25
26 TP_fast_assign(
27 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
28 __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq);
29 __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq);
30 __entry->errors = rq->errors;
31
32 blk_fill_rwbs_rq(__entry->rwbs, rq);
33 blk_dump_cmd(__get_str(cmd), rq);
34 ),
35
36 TP_printk("%d,%d %s (%s) %llu + %u [%d]",
37 MAJOR(__entry->dev), MINOR(__entry->dev),
38 __entry->rwbs, __get_str(cmd),
39 (unsigned long long)__entry->sector,
40 __entry->nr_sector, __entry->errors)
41);
42
43TRACE_EVENT(block_rq_insert,
44
45 TP_PROTO(struct request_queue *q, struct request *rq),
46
47 TP_ARGS(q, rq),
48
49 TP_STRUCT__entry(
50 __field( dev_t, dev )
51 __field( sector_t, sector )
52 __field( unsigned int, nr_sector )
53 __field( unsigned int, bytes )
54 __array( char, rwbs, 6 )
55 __array( char, comm, TASK_COMM_LEN )
56 __dynamic_array( char, cmd, blk_cmd_buf_len(rq) )
57 ),
58
59 TP_fast_assign(
60 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
61 __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq);
62 __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq);
63 __entry->bytes = blk_pc_request(rq) ? blk_rq_bytes(rq) : 0;
64
65 blk_fill_rwbs_rq(__entry->rwbs, rq);
66 blk_dump_cmd(__get_str(cmd), rq);
67 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
68 ),
69
70 TP_printk("%d,%d %s %u (%s) %llu + %u [%s]",
71 MAJOR(__entry->dev), MINOR(__entry->dev),
72 __entry->rwbs, __entry->bytes, __get_str(cmd),
73 (unsigned long long)__entry->sector,
74 __entry->nr_sector, __entry->comm)
75);
76
77TRACE_EVENT(block_rq_issue,
78
79 TP_PROTO(struct request_queue *q, struct request *rq),
80
81 TP_ARGS(q, rq),
82
83 TP_STRUCT__entry(
84 __field( dev_t, dev )
85 __field( sector_t, sector )
86 __field( unsigned int, nr_sector )
87 __field( unsigned int, bytes )
88 __array( char, rwbs, 6 )
89 __array( char, comm, TASK_COMM_LEN )
90 __dynamic_array( char, cmd, blk_cmd_buf_len(rq) )
91 ),
92
93 TP_fast_assign(
94 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
95 __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq);
96 __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq);
97 __entry->bytes = blk_pc_request(rq) ? blk_rq_bytes(rq) : 0;
98
99 blk_fill_rwbs_rq(__entry->rwbs, rq);
100 blk_dump_cmd(__get_str(cmd), rq);
101 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
102 ),
103
104 TP_printk("%d,%d %s %u (%s) %llu + %u [%s]",
105 MAJOR(__entry->dev), MINOR(__entry->dev),
106 __entry->rwbs, __entry->bytes, __get_str(cmd),
107 (unsigned long long)__entry->sector,
108 __entry->nr_sector, __entry->comm)
109);
110
111TRACE_EVENT(block_rq_requeue,
112
113 TP_PROTO(struct request_queue *q, struct request *rq),
114
115 TP_ARGS(q, rq),
116
117 TP_STRUCT__entry(
118 __field( dev_t, dev )
119 __field( sector_t, sector )
120 __field( unsigned int, nr_sector )
121 __field( int, errors )
122 __array( char, rwbs, 6 )
123 __dynamic_array( char, cmd, blk_cmd_buf_len(rq) )
124 ),
125
126 TP_fast_assign(
127 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
128 __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq);
129 __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq);
130 __entry->errors = rq->errors;
131
132 blk_fill_rwbs_rq(__entry->rwbs, rq);
133 blk_dump_cmd(__get_str(cmd), rq);
134 ),
135
136 TP_printk("%d,%d %s (%s) %llu + %u [%d]",
137 MAJOR(__entry->dev), MINOR(__entry->dev),
138 __entry->rwbs, __get_str(cmd),
139 (unsigned long long)__entry->sector,
140 __entry->nr_sector, __entry->errors)
141);
142
143TRACE_EVENT(block_rq_complete,
144
145 TP_PROTO(struct request_queue *q, struct request *rq),
146
147 TP_ARGS(q, rq),
148
149 TP_STRUCT__entry(
150 __field( dev_t, dev )
151 __field( sector_t, sector )
152 __field( unsigned int, nr_sector )
153 __field( int, errors )
154 __array( char, rwbs, 6 )
155 __dynamic_array( char, cmd, blk_cmd_buf_len(rq) )
156 ),
157
158 TP_fast_assign(
159 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0;
160 __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq);
161 __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq);
162 __entry->errors = rq->errors;
163
164 blk_fill_rwbs_rq(__entry->rwbs, rq);
165 blk_dump_cmd(__get_str(cmd), rq);
166 ),
167
168 TP_printk("%d,%d %s (%s) %llu + %u [%d]",
169 MAJOR(__entry->dev), MINOR(__entry->dev),
170 __entry->rwbs, __get_str(cmd),
171 (unsigned long long)__entry->sector,
172 __entry->nr_sector, __entry->errors)
173);
174TRACE_EVENT(block_bio_bounce,
175
176 TP_PROTO(struct request_queue *q, struct bio *bio),
177
178 TP_ARGS(q, bio),
179
180 TP_STRUCT__entry(
181 __field( dev_t, dev )
182 __field( sector_t, sector )
183 __field( unsigned int, nr_sector )
184 __array( char, rwbs, 6 )
185 __array( char, comm, TASK_COMM_LEN )
186 ),
187
188 TP_fast_assign(
189 __entry->dev = bio->bi_bdev->bd_dev;
190 __entry->sector = bio->bi_sector;
191 __entry->nr_sector = bio->bi_size >> 9;
192 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
193 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
194 ),
195
196 TP_printk("%d,%d %s %llu + %u [%s]",
197 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
198 (unsigned long long)__entry->sector,
199 __entry->nr_sector, __entry->comm)
200);
201
202TRACE_EVENT(block_bio_complete,
203
204 TP_PROTO(struct request_queue *q, struct bio *bio),
205
206 TP_ARGS(q, bio),
207
208 TP_STRUCT__entry(
209 __field( dev_t, dev )
210 __field( sector_t, sector )
211 __field( unsigned, nr_sector )
212 __field( int, error )
213 __array( char, rwbs, 6 )
214 ),
215
216 TP_fast_assign(
217 __entry->dev = bio->bi_bdev->bd_dev;
218 __entry->sector = bio->bi_sector;
219 __entry->nr_sector = bio->bi_size >> 9;
220 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
221 ),
222
223 TP_printk("%d,%d %s %llu + %u [%d]",
224 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
225 (unsigned long long)__entry->sector,
226 __entry->nr_sector, __entry->error)
227);
228
229TRACE_EVENT(block_bio_backmerge,
230
231 TP_PROTO(struct request_queue *q, struct bio *bio),
232
233 TP_ARGS(q, bio),
234
235 TP_STRUCT__entry(
236 __field( dev_t, dev )
237 __field( sector_t, sector )
238 __field( unsigned int, nr_sector )
239 __array( char, rwbs, 6 )
240 __array( char, comm, TASK_COMM_LEN )
241 ),
242
243 TP_fast_assign(
244 __entry->dev = bio->bi_bdev->bd_dev;
245 __entry->sector = bio->bi_sector;
246 __entry->nr_sector = bio->bi_size >> 9;
247 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
248 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
249 ),
250
251 TP_printk("%d,%d %s %llu + %u [%s]",
252 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
253 (unsigned long long)__entry->sector,
254 __entry->nr_sector, __entry->comm)
255);
256
257TRACE_EVENT(block_bio_frontmerge,
258
259 TP_PROTO(struct request_queue *q, struct bio *bio),
260
261 TP_ARGS(q, bio),
262
263 TP_STRUCT__entry(
264 __field( dev_t, dev )
265 __field( sector_t, sector )
266 __field( unsigned, nr_sector )
267 __array( char, rwbs, 6 )
268 __array( char, comm, TASK_COMM_LEN )
269 ),
270
271 TP_fast_assign(
272 __entry->dev = bio->bi_bdev->bd_dev;
273 __entry->sector = bio->bi_sector;
274 __entry->nr_sector = bio->bi_size >> 9;
275 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
276 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
277 ),
278
279 TP_printk("%d,%d %s %llu + %u [%s]",
280 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
281 (unsigned long long)__entry->sector,
282 __entry->nr_sector, __entry->comm)
283);
284
285TRACE_EVENT(block_bio_queue,
286
287 TP_PROTO(struct request_queue *q, struct bio *bio),
288
289 TP_ARGS(q, bio),
290
291 TP_STRUCT__entry(
292 __field( dev_t, dev )
293 __field( sector_t, sector )
294 __field( unsigned int, nr_sector )
295 __array( char, rwbs, 6 )
296 __array( char, comm, TASK_COMM_LEN )
297 ),
298
299 TP_fast_assign(
300 __entry->dev = bio->bi_bdev->bd_dev;
301 __entry->sector = bio->bi_sector;
302 __entry->nr_sector = bio->bi_size >> 9;
303 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
304 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
305 ),
306
307 TP_printk("%d,%d %s %llu + %u [%s]",
308 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
309 (unsigned long long)__entry->sector,
310 __entry->nr_sector, __entry->comm)
311);
312
313TRACE_EVENT(block_getrq,
314
315 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
316
317 TP_ARGS(q, bio, rw),
318
319 TP_STRUCT__entry(
320 __field( dev_t, dev )
321 __field( sector_t, sector )
322 __field( unsigned int, nr_sector )
323 __array( char, rwbs, 6 )
324 __array( char, comm, TASK_COMM_LEN )
325 ),
326
327 TP_fast_assign(
328 __entry->dev = bio ? bio->bi_bdev->bd_dev : 0;
329 __entry->sector = bio ? bio->bi_sector : 0;
330 __entry->nr_sector = bio ? bio->bi_size >> 9 : 0;
331 blk_fill_rwbs(__entry->rwbs,
332 bio ? bio->bi_rw : 0, __entry->nr_sector);
333 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
334 ),
335
336 TP_printk("%d,%d %s %llu + %u [%s]",
337 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
338 (unsigned long long)__entry->sector,
339 __entry->nr_sector, __entry->comm)
340);
341
342TRACE_EVENT(block_sleeprq,
343
344 TP_PROTO(struct request_queue *q, struct bio *bio, int rw),
345
346 TP_ARGS(q, bio, rw),
347
348 TP_STRUCT__entry(
349 __field( dev_t, dev )
350 __field( sector_t, sector )
351 __field( unsigned int, nr_sector )
352 __array( char, rwbs, 6 )
353 __array( char, comm, TASK_COMM_LEN )
354 ),
355
356 TP_fast_assign(
357 __entry->dev = bio ? bio->bi_bdev->bd_dev : 0;
358 __entry->sector = bio ? bio->bi_sector : 0;
359 __entry->nr_sector = bio ? bio->bi_size >> 9 : 0;
360 blk_fill_rwbs(__entry->rwbs,
361 bio ? bio->bi_rw : 0, __entry->nr_sector);
362 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
363 ),
364
365 TP_printk("%d,%d %s %llu + %u [%s]",
366 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
367 (unsigned long long)__entry->sector,
368 __entry->nr_sector, __entry->comm)
369);
370
371TRACE_EVENT(block_plug,
372
373 TP_PROTO(struct request_queue *q),
374
375 TP_ARGS(q),
376
377 TP_STRUCT__entry(
378 __array( char, comm, TASK_COMM_LEN )
379 ),
380
381 TP_fast_assign(
382 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
383 ),
384
385 TP_printk("[%s]", __entry->comm)
386);
387
388TRACE_EVENT(block_unplug_timer,
389
390 TP_PROTO(struct request_queue *q),
391
392 TP_ARGS(q),
393
394 TP_STRUCT__entry(
395 __field( int, nr_rq )
396 __array( char, comm, TASK_COMM_LEN )
397 ),
398
399 TP_fast_assign(
400 __entry->nr_rq = q->rq.count[READ] + q->rq.count[WRITE];
401 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
402 ),
403
404 TP_printk("[%s] %d", __entry->comm, __entry->nr_rq)
405);
406
407TRACE_EVENT(block_unplug_io,
408
409 TP_PROTO(struct request_queue *q),
410
411 TP_ARGS(q),
412
413 TP_STRUCT__entry(
414 __field( int, nr_rq )
415 __array( char, comm, TASK_COMM_LEN )
416 ),
417
418 TP_fast_assign(
419 __entry->nr_rq = q->rq.count[READ] + q->rq.count[WRITE];
420 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
421 ),
422
423 TP_printk("[%s] %d", __entry->comm, __entry->nr_rq)
424);
425
426TRACE_EVENT(block_split,
427
428 TP_PROTO(struct request_queue *q, struct bio *bio,
429 unsigned int new_sector),
430
431 TP_ARGS(q, bio, new_sector),
432
433 TP_STRUCT__entry(
434 __field( dev_t, dev )
435 __field( sector_t, sector )
436 __field( sector_t, new_sector )
437 __array( char, rwbs, 6 )
438 __array( char, comm, TASK_COMM_LEN )
439 ),
440
441 TP_fast_assign(
442 __entry->dev = bio->bi_bdev->bd_dev;
443 __entry->sector = bio->bi_sector;
444 __entry->new_sector = new_sector;
445 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
446 memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
447 ),
448
449 TP_printk("%d,%d %s %llu / %llu [%s]",
450 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
451 (unsigned long long)__entry->sector,
452 (unsigned long long)__entry->new_sector,
453 __entry->comm)
454);
455
456TRACE_EVENT(block_remap,
457
458 TP_PROTO(struct request_queue *q, struct bio *bio, dev_t dev,
459 sector_t from),
460
461 TP_ARGS(q, bio, dev, from),
462
463 TP_STRUCT__entry(
464 __field( dev_t, dev )
465 __field( sector_t, sector )
466 __field( unsigned int, nr_sector )
467 __field( dev_t, old_dev )
468 __field( sector_t, old_sector )
469 __array( char, rwbs, 6 )
470 ),
471
472 TP_fast_assign(
473 __entry->dev = bio->bi_bdev->bd_dev;
474 __entry->sector = bio->bi_sector;
475 __entry->nr_sector = bio->bi_size >> 9;
476 __entry->old_dev = dev;
477 __entry->old_sector = from;
478 blk_fill_rwbs(__entry->rwbs, bio->bi_rw, bio->bi_size);
479 ),
480
481 TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu",
482 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->rwbs,
483 (unsigned long long)__entry->sector,
484 __entry->nr_sector,
485 MAJOR(__entry->old_dev), MINOR(__entry->old_dev),
486 (unsigned long long)__entry->old_sector)
487);
488
489#endif /* _TRACE_BLOCK_H */
490
491/* This part must be outside protection */
492#include <trace/define_trace.h>
493
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
new file mode 100644
index 000000000000..acf4cc9cd36d
--- /dev/null
+++ b/include/trace/events/ext4.h
@@ -0,0 +1,719 @@
1#if !defined(_TRACE_EXT4_H) || defined(TRACE_HEADER_MULTI_READ)
2#define _TRACE_EXT4_H
3
4#undef TRACE_SYSTEM
5#define TRACE_SYSTEM ext4
6
7#include <linux/writeback.h>
8#include "../../../fs/ext4/ext4.h"
9#include "../../../fs/ext4/mballoc.h"
10#include <linux/tracepoint.h>
11
12TRACE_EVENT(ext4_free_inode,
13 TP_PROTO(struct inode *inode),
14
15 TP_ARGS(inode),
16
17 TP_STRUCT__entry(
18 __field( dev_t, dev )
19 __field( ino_t, ino )
20 __field( umode_t, mode )
21 __field( uid_t, uid )
22 __field( gid_t, gid )
23 __field( blkcnt_t, blocks )
24 ),
25
26 TP_fast_assign(
27 __entry->dev = inode->i_sb->s_dev;
28 __entry->ino = inode->i_ino;
29 __entry->mode = inode->i_mode;
30 __entry->uid = inode->i_uid;
31 __entry->gid = inode->i_gid;
32 __entry->blocks = inode->i_blocks;
33 ),
34
35 TP_printk("dev %s ino %lu mode %d uid %u gid %u blocks %llu",
36 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->mode,
37 __entry->uid, __entry->gid, __entry->blocks)
38);
39
40TRACE_EVENT(ext4_request_inode,
41 TP_PROTO(struct inode *dir, int mode),
42
43 TP_ARGS(dir, mode),
44
45 TP_STRUCT__entry(
46 __field( dev_t, dev )
47 __field( ino_t, dir )
48 __field( umode_t, mode )
49 ),
50
51 TP_fast_assign(
52 __entry->dev = dir->i_sb->s_dev;
53 __entry->dir = dir->i_ino;
54 __entry->mode = mode;
55 ),
56
57 TP_printk("dev %s dir %lu mode %d",
58 jbd2_dev_to_name(__entry->dev), __entry->dir, __entry->mode)
59);
60
61TRACE_EVENT(ext4_allocate_inode,
62 TP_PROTO(struct inode *inode, struct inode *dir, int mode),
63
64 TP_ARGS(inode, dir, mode),
65
66 TP_STRUCT__entry(
67 __field( dev_t, dev )
68 __field( ino_t, ino )
69 __field( ino_t, dir )
70 __field( umode_t, mode )
71 ),
72
73 TP_fast_assign(
74 __entry->dev = inode->i_sb->s_dev;
75 __entry->ino = inode->i_ino;
76 __entry->dir = dir->i_ino;
77 __entry->mode = mode;
78 ),
79
80 TP_printk("dev %s ino %lu dir %lu mode %d",
81 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->dir, __entry->mode)
82);
83
84TRACE_EVENT(ext4_write_begin,
85
86 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
87 unsigned int flags),
88
89 TP_ARGS(inode, pos, len, flags),
90
91 TP_STRUCT__entry(
92 __field( dev_t, dev )
93 __field( ino_t, ino )
94 __field( loff_t, pos )
95 __field( unsigned int, len )
96 __field( unsigned int, flags )
97 ),
98
99 TP_fast_assign(
100 __entry->dev = inode->i_sb->s_dev;
101 __entry->ino = inode->i_ino;
102 __entry->pos = pos;
103 __entry->len = len;
104 __entry->flags = flags;
105 ),
106
107 TP_printk("dev %s ino %lu pos %llu len %u flags %u",
108 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pos, __entry->len,
109 __entry->flags)
110);
111
112TRACE_EVENT(ext4_ordered_write_end,
113 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
114 unsigned int copied),
115
116 TP_ARGS(inode, pos, len, copied),
117
118 TP_STRUCT__entry(
119 __field( dev_t, dev )
120 __field( ino_t, ino )
121 __field( loff_t, pos )
122 __field( unsigned int, len )
123 __field( unsigned int, copied )
124 ),
125
126 TP_fast_assign(
127 __entry->dev = inode->i_sb->s_dev;
128 __entry->ino = inode->i_ino;
129 __entry->pos = pos;
130 __entry->len = len;
131 __entry->copied = copied;
132 ),
133
134 TP_printk("dev %s ino %lu pos %llu len %u copied %u",
135 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pos, __entry->len,
136 __entry->copied)
137);
138
139TRACE_EVENT(ext4_writeback_write_end,
140 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
141 unsigned int copied),
142
143 TP_ARGS(inode, pos, len, copied),
144
145 TP_STRUCT__entry(
146 __field( dev_t, dev )
147 __field( ino_t, ino )
148 __field( loff_t, pos )
149 __field( unsigned int, len )
150 __field( unsigned int, copied )
151 ),
152
153 TP_fast_assign(
154 __entry->dev = inode->i_sb->s_dev;
155 __entry->ino = inode->i_ino;
156 __entry->pos = pos;
157 __entry->len = len;
158 __entry->copied = copied;
159 ),
160
161 TP_printk("dev %s ino %lu pos %llu len %u copied %u",
162 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pos, __entry->len,
163 __entry->copied)
164);
165
166TRACE_EVENT(ext4_journalled_write_end,
167 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
168 unsigned int copied),
169 TP_ARGS(inode, pos, len, copied),
170
171 TP_STRUCT__entry(
172 __field( dev_t, dev )
173 __field( ino_t, ino )
174 __field( loff_t, pos )
175 __field( unsigned int, len )
176 __field( unsigned int, copied )
177 ),
178
179 TP_fast_assign(
180 __entry->dev = inode->i_sb->s_dev;
181 __entry->ino = inode->i_ino;
182 __entry->pos = pos;
183 __entry->len = len;
184 __entry->copied = copied;
185 ),
186
187 TP_printk("dev %s ino %lu pos %llu len %u copied %u",
188 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pos, __entry->len,
189 __entry->copied)
190);
191
192TRACE_EVENT(ext4_da_writepage,
193 TP_PROTO(struct inode *inode, struct page *page),
194
195 TP_ARGS(inode, page),
196
197 TP_STRUCT__entry(
198 __field( dev_t, dev )
199 __field( ino_t, ino )
200 __field( pgoff_t, index )
201
202 ),
203
204 TP_fast_assign(
205 __entry->dev = inode->i_sb->s_dev;
206 __entry->ino = inode->i_ino;
207 __entry->index = page->index;
208 ),
209
210 TP_printk("dev %s ino %lu page_index %lu",
211 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->index)
212);
213
214TRACE_EVENT(ext4_da_writepages,
215 TP_PROTO(struct inode *inode, struct writeback_control *wbc),
216
217 TP_ARGS(inode, wbc),
218
219 TP_STRUCT__entry(
220 __field( dev_t, dev )
221 __field( ino_t, ino )
222 __field( long, nr_to_write )
223 __field( long, pages_skipped )
224 __field( loff_t, range_start )
225 __field( loff_t, range_end )
226 __field( char, nonblocking )
227 __field( char, for_kupdate )
228 __field( char, for_reclaim )
229 __field( char, for_writepages )
230 __field( char, range_cyclic )
231 ),
232
233 TP_fast_assign(
234 __entry->dev = inode->i_sb->s_dev;
235 __entry->ino = inode->i_ino;
236 __entry->nr_to_write = wbc->nr_to_write;
237 __entry->pages_skipped = wbc->pages_skipped;
238 __entry->range_start = wbc->range_start;
239 __entry->range_end = wbc->range_end;
240 __entry->nonblocking = wbc->nonblocking;
241 __entry->for_kupdate = wbc->for_kupdate;
242 __entry->for_reclaim = wbc->for_reclaim;
243 __entry->for_writepages = wbc->for_writepages;
244 __entry->range_cyclic = wbc->range_cyclic;
245 ),
246
247 TP_printk("dev %s ino %lu nr_t_write %ld pages_skipped %ld range_start %llu range_end %llu nonblocking %d for_kupdate %d for_reclaim %d for_writepages %d range_cyclic %d",
248 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->nr_to_write,
249 __entry->pages_skipped, __entry->range_start,
250 __entry->range_end, __entry->nonblocking,
251 __entry->for_kupdate, __entry->for_reclaim,
252 __entry->for_writepages, __entry->range_cyclic)
253);
254
255TRACE_EVENT(ext4_da_writepages_result,
256 TP_PROTO(struct inode *inode, struct writeback_control *wbc,
257 int ret, int pages_written),
258
259 TP_ARGS(inode, wbc, ret, pages_written),
260
261 TP_STRUCT__entry(
262 __field( dev_t, dev )
263 __field( ino_t, ino )
264 __field( int, ret )
265 __field( int, pages_written )
266 __field( long, pages_skipped )
267 __field( char, encountered_congestion )
268 __field( char, more_io )
269 __field( char, no_nrwrite_index_update )
270 ),
271
272 TP_fast_assign(
273 __entry->dev = inode->i_sb->s_dev;
274 __entry->ino = inode->i_ino;
275 __entry->ret = ret;
276 __entry->pages_written = pages_written;
277 __entry->pages_skipped = wbc->pages_skipped;
278 __entry->encountered_congestion = wbc->encountered_congestion;
279 __entry->more_io = wbc->more_io;
280 __entry->no_nrwrite_index_update = wbc->no_nrwrite_index_update;
281 ),
282
283 TP_printk("dev %s ino %lu ret %d pages_written %d pages_skipped %ld congestion %d more_io %d no_nrwrite_index_update %d",
284 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->ret,
285 __entry->pages_written, __entry->pages_skipped,
286 __entry->encountered_congestion, __entry->more_io,
287 __entry->no_nrwrite_index_update)
288);
289
290TRACE_EVENT(ext4_da_write_begin,
291 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
292 unsigned int flags),
293
294 TP_ARGS(inode, pos, len, flags),
295
296 TP_STRUCT__entry(
297 __field( dev_t, dev )
298 __field( ino_t, ino )
299 __field( loff_t, pos )
300 __field( unsigned int, len )
301 __field( unsigned int, flags )
302 ),
303
304 TP_fast_assign(
305 __entry->dev = inode->i_sb->s_dev;
306 __entry->ino = inode->i_ino;
307 __entry->pos = pos;
308 __entry->len = len;
309 __entry->flags = flags;
310 ),
311
312 TP_printk("dev %s ino %lu pos %llu len %u flags %u",
313 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pos, __entry->len,
314 __entry->flags)
315);
316
317TRACE_EVENT(ext4_da_write_end,
318 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
319 unsigned int copied),
320
321 TP_ARGS(inode, pos, len, copied),
322
323 TP_STRUCT__entry(
324 __field( dev_t, dev )
325 __field( ino_t, ino )
326 __field( loff_t, pos )
327 __field( unsigned int, len )
328 __field( unsigned int, copied )
329 ),
330
331 TP_fast_assign(
332 __entry->dev = inode->i_sb->s_dev;
333 __entry->ino = inode->i_ino;
334 __entry->pos = pos;
335 __entry->len = len;
336 __entry->copied = copied;
337 ),
338
339 TP_printk("dev %s ino %lu pos %llu len %u copied %u",
340 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pos, __entry->len,
341 __entry->copied)
342);
343
344TRACE_EVENT(ext4_normal_writepage,
345 TP_PROTO(struct inode *inode, struct page *page),
346
347 TP_ARGS(inode, page),
348
349 TP_STRUCT__entry(
350 __field( dev_t, dev )
351 __field( ino_t, ino )
352 __field( pgoff_t, index )
353 ),
354
355 TP_fast_assign(
356 __entry->dev = inode->i_sb->s_dev;
357 __entry->ino = inode->i_ino;
358 __entry->index = page->index;
359 ),
360
361 TP_printk("dev %s ino %lu page_index %lu",
362 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->index)
363);
364
365TRACE_EVENT(ext4_journalled_writepage,
366 TP_PROTO(struct inode *inode, struct page *page),
367
368 TP_ARGS(inode, page),
369
370 TP_STRUCT__entry(
371 __field( dev_t, dev )
372 __field( ino_t, ino )
373 __field( pgoff_t, index )
374
375 ),
376
377 TP_fast_assign(
378 __entry->dev = inode->i_sb->s_dev;
379 __entry->ino = inode->i_ino;
380 __entry->index = page->index;
381 ),
382
383 TP_printk("dev %s ino %lu page_index %lu",
384 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->index)
385);
386
387TRACE_EVENT(ext4_discard_blocks,
388 TP_PROTO(struct super_block *sb, unsigned long long blk,
389 unsigned long long count),
390
391 TP_ARGS(sb, blk, count),
392
393 TP_STRUCT__entry(
394 __field( dev_t, dev )
395 __field( __u64, blk )
396 __field( __u64, count )
397
398 ),
399
400 TP_fast_assign(
401 __entry->dev = sb->s_dev;
402 __entry->blk = blk;
403 __entry->count = count;
404 ),
405
406 TP_printk("dev %s blk %llu count %llu",
407 jbd2_dev_to_name(__entry->dev), __entry->blk, __entry->count)
408);
409
410TRACE_EVENT(ext4_mb_new_inode_pa,
411 TP_PROTO(struct ext4_allocation_context *ac,
412 struct ext4_prealloc_space *pa),
413
414 TP_ARGS(ac, pa),
415
416 TP_STRUCT__entry(
417 __field( dev_t, dev )
418 __field( ino_t, ino )
419 __field( __u64, pa_pstart )
420 __field( __u32, pa_len )
421 __field( __u64, pa_lstart )
422
423 ),
424
425 TP_fast_assign(
426 __entry->dev = ac->ac_sb->s_dev;
427 __entry->ino = ac->ac_inode->i_ino;
428 __entry->pa_pstart = pa->pa_pstart;
429 __entry->pa_len = pa->pa_len;
430 __entry->pa_lstart = pa->pa_lstart;
431 ),
432
433 TP_printk("dev %s ino %lu pstart %llu len %u lstart %llu",
434 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pa_pstart,
435 __entry->pa_len, __entry->pa_lstart)
436);
437
438TRACE_EVENT(ext4_mb_new_group_pa,
439 TP_PROTO(struct ext4_allocation_context *ac,
440 struct ext4_prealloc_space *pa),
441
442 TP_ARGS(ac, pa),
443
444 TP_STRUCT__entry(
445 __field( dev_t, dev )
446 __field( ino_t, ino )
447 __field( __u64, pa_pstart )
448 __field( __u32, pa_len )
449 __field( __u64, pa_lstart )
450
451 ),
452
453 TP_fast_assign(
454 __entry->dev = ac->ac_sb->s_dev;
455 __entry->ino = ac->ac_inode->i_ino;
456 __entry->pa_pstart = pa->pa_pstart;
457 __entry->pa_len = pa->pa_len;
458 __entry->pa_lstart = pa->pa_lstart;
459 ),
460
461 TP_printk("dev %s ino %lu pstart %llu len %u lstart %llu",
462 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->pa_pstart,
463 __entry->pa_len, __entry->pa_lstart)
464);
465
466TRACE_EVENT(ext4_mb_release_inode_pa,
467 TP_PROTO(struct ext4_allocation_context *ac,
468 struct ext4_prealloc_space *pa,
469 unsigned long long block, unsigned int count),
470
471 TP_ARGS(ac, pa, block, count),
472
473 TP_STRUCT__entry(
474 __field( dev_t, dev )
475 __field( ino_t, ino )
476 __field( __u64, block )
477 __field( __u32, count )
478
479 ),
480
481 TP_fast_assign(
482 __entry->dev = ac->ac_sb->s_dev;
483 __entry->ino = ac->ac_inode->i_ino;
484 __entry->block = block;
485 __entry->count = count;
486 ),
487
488 TP_printk("dev %s ino %lu block %llu count %u",
489 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->block,
490 __entry->count)
491);
492
493TRACE_EVENT(ext4_mb_release_group_pa,
494 TP_PROTO(struct ext4_allocation_context *ac,
495 struct ext4_prealloc_space *pa),
496
497 TP_ARGS(ac, pa),
498
499 TP_STRUCT__entry(
500 __field( dev_t, dev )
501 __field( ino_t, ino )
502 __field( __u64, pa_pstart )
503 __field( __u32, pa_len )
504
505 ),
506
507 TP_fast_assign(
508 __entry->dev = ac->ac_sb->s_dev;
509 __entry->ino = ac->ac_inode->i_ino;
510 __entry->pa_pstart = pa->pa_pstart;
511 __entry->pa_len = pa->pa_len;
512 ),
513
514 TP_printk("dev %s pstart %llu len %u",
515 jbd2_dev_to_name(__entry->dev), __entry->pa_pstart, __entry->pa_len)
516);
517
518TRACE_EVENT(ext4_discard_preallocations,
519 TP_PROTO(struct inode *inode),
520
521 TP_ARGS(inode),
522
523 TP_STRUCT__entry(
524 __field( dev_t, dev )
525 __field( ino_t, ino )
526
527 ),
528
529 TP_fast_assign(
530 __entry->dev = inode->i_sb->s_dev;
531 __entry->ino = inode->i_ino;
532 ),
533
534 TP_printk("dev %s ino %lu",
535 jbd2_dev_to_name(__entry->dev), __entry->ino)
536);
537
538TRACE_EVENT(ext4_mb_discard_preallocations,
539 TP_PROTO(struct super_block *sb, int needed),
540
541 TP_ARGS(sb, needed),
542
543 TP_STRUCT__entry(
544 __field( dev_t, dev )
545 __field( int, needed )
546
547 ),
548
549 TP_fast_assign(
550 __entry->dev = sb->s_dev;
551 __entry->needed = needed;
552 ),
553
554 TP_printk("dev %s needed %d",
555 jbd2_dev_to_name(__entry->dev), __entry->needed)
556);
557
558TRACE_EVENT(ext4_request_blocks,
559 TP_PROTO(struct ext4_allocation_request *ar),
560
561 TP_ARGS(ar),
562
563 TP_STRUCT__entry(
564 __field( dev_t, dev )
565 __field( ino_t, ino )
566 __field( unsigned int, flags )
567 __field( unsigned int, len )
568 __field( __u64, logical )
569 __field( __u64, goal )
570 __field( __u64, lleft )
571 __field( __u64, lright )
572 __field( __u64, pleft )
573 __field( __u64, pright )
574 ),
575
576 TP_fast_assign(
577 __entry->dev = ar->inode->i_sb->s_dev;
578 __entry->ino = ar->inode->i_ino;
579 __entry->flags = ar->flags;
580 __entry->len = ar->len;
581 __entry->logical = ar->logical;
582 __entry->goal = ar->goal;
583 __entry->lleft = ar->lleft;
584 __entry->lright = ar->lright;
585 __entry->pleft = ar->pleft;
586 __entry->pright = ar->pright;
587 ),
588
589 TP_printk("dev %s ino %lu flags %u len %u lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ",
590 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->flags,
591 __entry->len,
592 (unsigned long long) __entry->logical,
593 (unsigned long long) __entry->goal,
594 (unsigned long long) __entry->lleft,
595 (unsigned long long) __entry->lright,
596 (unsigned long long) __entry->pleft,
597 (unsigned long long) __entry->pright)
598);
599
600TRACE_EVENT(ext4_allocate_blocks,
601 TP_PROTO(struct ext4_allocation_request *ar, unsigned long long block),
602
603 TP_ARGS(ar, block),
604
605 TP_STRUCT__entry(
606 __field( dev_t, dev )
607 __field( ino_t, ino )
608 __field( __u64, block )
609 __field( unsigned int, flags )
610 __field( unsigned int, len )
611 __field( __u64, logical )
612 __field( __u64, goal )
613 __field( __u64, lleft )
614 __field( __u64, lright )
615 __field( __u64, pleft )
616 __field( __u64, pright )
617 ),
618
619 TP_fast_assign(
620 __entry->dev = ar->inode->i_sb->s_dev;
621 __entry->ino = ar->inode->i_ino;
622 __entry->block = block;
623 __entry->flags = ar->flags;
624 __entry->len = ar->len;
625 __entry->logical = ar->logical;
626 __entry->goal = ar->goal;
627 __entry->lleft = ar->lleft;
628 __entry->lright = ar->lright;
629 __entry->pleft = ar->pleft;
630 __entry->pright = ar->pright;
631 ),
632
633 TP_printk("dev %s ino %lu flags %u len %u block %llu lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ",
634 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->flags,
635 __entry->len, __entry->block,
636 (unsigned long long) __entry->logical,
637 (unsigned long long) __entry->goal,
638 (unsigned long long) __entry->lleft,
639 (unsigned long long) __entry->lright,
640 (unsigned long long) __entry->pleft,
641 (unsigned long long) __entry->pright)
642);
643
644TRACE_EVENT(ext4_free_blocks,
645 TP_PROTO(struct inode *inode, __u64 block, unsigned long count,
646 int metadata),
647
648 TP_ARGS(inode, block, count, metadata),
649
650 TP_STRUCT__entry(
651 __field( dev_t, dev )
652 __field( ino_t, ino )
653 __field( __u64, block )
654 __field( unsigned long, count )
655 __field( int, metadata )
656
657 ),
658
659 TP_fast_assign(
660 __entry->dev = inode->i_sb->s_dev;
661 __entry->ino = inode->i_ino;
662 __entry->block = block;
663 __entry->count = count;
664 __entry->metadata = metadata;
665 ),
666
667 TP_printk("dev %s ino %lu block %llu count %lu metadata %d",
668 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->block,
669 __entry->count, __entry->metadata)
670);
671
672TRACE_EVENT(ext4_sync_file,
673 TP_PROTO(struct file *file, struct dentry *dentry, int datasync),
674
675 TP_ARGS(file, dentry, datasync),
676
677 TP_STRUCT__entry(
678 __field( dev_t, dev )
679 __field( ino_t, ino )
680 __field( ino_t, parent )
681 __field( int, datasync )
682 ),
683
684 TP_fast_assign(
685 __entry->dev = dentry->d_inode->i_sb->s_dev;
686 __entry->ino = dentry->d_inode->i_ino;
687 __entry->datasync = datasync;
688 __entry->parent = dentry->d_parent->d_inode->i_ino;
689 ),
690
691 TP_printk("dev %s ino %ld parent %ld datasync %d ",
692 jbd2_dev_to_name(__entry->dev), __entry->ino, __entry->parent,
693 __entry->datasync)
694);
695
696TRACE_EVENT(ext4_sync_fs,
697 TP_PROTO(struct super_block *sb, int wait),
698
699 TP_ARGS(sb, wait),
700
701 TP_STRUCT__entry(
702 __field( dev_t, dev )
703 __field( int, wait )
704
705 ),
706
707 TP_fast_assign(
708 __entry->dev = sb->s_dev;
709 __entry->wait = wait;
710 ),
711
712 TP_printk("dev %s wait %d", jbd2_dev_to_name(__entry->dev),
713 __entry->wait)
714);
715
716#endif /* _TRACE_EXT4_H */
717
718/* This part must be outside protection */
719#include <trace/define_trace.h>
diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h
new file mode 100644
index 000000000000..b0c7ede55eb1
--- /dev/null
+++ b/include/trace/events/irq.h
@@ -0,0 +1,145 @@
1#if !defined(_TRACE_IRQ_H) || defined(TRACE_HEADER_MULTI_READ)
2#define _TRACE_IRQ_H
3
4#include <linux/tracepoint.h>
5#include <linux/interrupt.h>
6
7#undef TRACE_SYSTEM
8#define TRACE_SYSTEM irq
9
10#define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq }
11#define show_softirq_name(val) \
12 __print_symbolic(val, \
13 softirq_name(HI), \
14 softirq_name(TIMER), \
15 softirq_name(NET_TX), \
16 softirq_name(NET_RX), \
17 softirq_name(BLOCK), \
18 softirq_name(TASKLET), \
19 softirq_name(SCHED), \
20 softirq_name(HRTIMER), \
21 softirq_name(RCU))
22
23/**
24 * irq_handler_entry - called immediately before the irq action handler
25 * @irq: irq number
26 * @action: pointer to struct irqaction
27 *
28 * The struct irqaction pointed to by @action contains various
29 * information about the handler, including the device name,
30 * @action->name, and the device id, @action->dev_id. When used in
31 * conjunction with the irq_handler_exit tracepoint, we can figure
32 * out irq handler latencies.
33 */
34TRACE_EVENT(irq_handler_entry,
35
36 TP_PROTO(int irq, struct irqaction *action),
37
38 TP_ARGS(irq, action),
39
40 TP_STRUCT__entry(
41 __field( int, irq )
42 __string( name, action->name )
43 ),
44
45 TP_fast_assign(
46 __entry->irq = irq;
47 __assign_str(name, action->name);
48 ),
49
50 TP_printk("irq=%d handler=%s", __entry->irq, __get_str(name))
51);
52
53/**
54 * irq_handler_exit - called immediately after the irq action handler returns
55 * @irq: irq number
56 * @action: pointer to struct irqaction
57 * @ret: return value
58 *
59 * If the @ret value is set to IRQ_HANDLED, then we know that the corresponding
60 * @action->handler scuccessully handled this irq. Otherwise, the irq might be
61 * a shared irq line, or the irq was not handled successfully. Can be used in
62 * conjunction with the irq_handler_entry to understand irq handler latencies.
63 */
64TRACE_EVENT(irq_handler_exit,
65
66 TP_PROTO(int irq, struct irqaction *action, int ret),
67
68 TP_ARGS(irq, action, ret),
69
70 TP_STRUCT__entry(
71 __field( int, irq )
72 __field( int, ret )
73 ),
74
75 TP_fast_assign(
76 __entry->irq = irq;
77 __entry->ret = ret;
78 ),
79
80 TP_printk("irq=%d return=%s",
81 __entry->irq, __entry->ret ? "handled" : "unhandled")
82);
83
84/**
85 * softirq_entry - called immediately before the softirq handler
86 * @h: pointer to struct softirq_action
87 * @vec: pointer to first struct softirq_action in softirq_vec array
88 *
89 * The @h parameter, contains a pointer to the struct softirq_action
90 * which has a pointer to the action handler that is called. By subtracting
91 * the @vec pointer from the @h pointer, we can determine the softirq
92 * number. Also, when used in combination with the softirq_exit tracepoint
93 * we can determine the softirq latency.
94 */
95TRACE_EVENT(softirq_entry,
96
97 TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
98
99 TP_ARGS(h, vec),
100
101 TP_STRUCT__entry(
102 __field( int, vec )
103 ),
104
105 TP_fast_assign(
106 __entry->vec = (int)(h - vec);
107 ),
108
109 TP_printk("softirq=%d action=%s", __entry->vec,
110 show_softirq_name(__entry->vec))
111);
112
113/**
114 * softirq_exit - called immediately after the softirq handler returns
115 * @h: pointer to struct softirq_action
116 * @vec: pointer to first struct softirq_action in softirq_vec array
117 *
118 * The @h parameter contains a pointer to the struct softirq_action
119 * that has handled the softirq. By subtracting the @vec pointer from
120 * the @h pointer, we can determine the softirq number. Also, when used in
121 * combination with the softirq_entry tracepoint we can determine the softirq
122 * latency.
123 */
124TRACE_EVENT(softirq_exit,
125
126 TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
127
128 TP_ARGS(h, vec),
129
130 TP_STRUCT__entry(
131 __field( int, vec )
132 ),
133
134 TP_fast_assign(
135 __entry->vec = (int)(h - vec);
136 ),
137
138 TP_printk("softirq=%d action=%s", __entry->vec,
139 show_softirq_name(__entry->vec))
140);
141
142#endif /* _TRACE_IRQ_H */
143
144/* This part must be outside protection */
145#include <trace/define_trace.h>
diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h
new file mode 100644
index 000000000000..845b0b4b48fd
--- /dev/null
+++ b/include/trace/events/jbd2.h
@@ -0,0 +1,168 @@
1#if !defined(_TRACE_JBD2_H) || defined(TRACE_HEADER_MULTI_READ)
2#define _TRACE_JBD2_H
3
4#include <linux/jbd2.h>
5#include <linux/tracepoint.h>
6
7#undef TRACE_SYSTEM
8#define TRACE_SYSTEM jbd2
9
10TRACE_EVENT(jbd2_checkpoint,
11
12 TP_PROTO(journal_t *journal, int result),
13
14 TP_ARGS(journal, result),
15
16 TP_STRUCT__entry(
17 __field( dev_t, dev )
18 __field( int, result )
19 ),
20
21 TP_fast_assign(
22 __entry->dev = journal->j_fs_dev->bd_dev;
23 __entry->result = result;
24 ),
25
26 TP_printk("dev %s result %d",
27 jbd2_dev_to_name(__entry->dev), __entry->result)
28);
29
30TRACE_EVENT(jbd2_start_commit,
31
32 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
33
34 TP_ARGS(journal, commit_transaction),
35
36 TP_STRUCT__entry(
37 __field( dev_t, dev )
38 __field( char, sync_commit )
39 __field( int, transaction )
40 ),
41
42 TP_fast_assign(
43 __entry->dev = journal->j_fs_dev->bd_dev;
44 __entry->sync_commit = commit_transaction->t_synchronous_commit;
45 __entry->transaction = commit_transaction->t_tid;
46 ),
47
48 TP_printk("dev %s transaction %d sync %d",
49 jbd2_dev_to_name(__entry->dev), __entry->transaction,
50 __entry->sync_commit)
51);
52
53TRACE_EVENT(jbd2_commit_locking,
54
55 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
56
57 TP_ARGS(journal, commit_transaction),
58
59 TP_STRUCT__entry(
60 __field( dev_t, dev )
61 __field( char, sync_commit )
62 __field( int, transaction )
63 ),
64
65 TP_fast_assign(
66 __entry->dev = journal->j_fs_dev->bd_dev;
67 __entry->sync_commit = commit_transaction->t_synchronous_commit;
68 __entry->transaction = commit_transaction->t_tid;
69 ),
70
71 TP_printk("dev %s transaction %d sync %d",
72 jbd2_dev_to_name(__entry->dev), __entry->transaction,
73 __entry->sync_commit)
74);
75
76TRACE_EVENT(jbd2_commit_flushing,
77
78 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
79
80 TP_ARGS(journal, commit_transaction),
81
82 TP_STRUCT__entry(
83 __field( dev_t, dev )
84 __field( char, sync_commit )
85 __field( int, transaction )
86 ),
87
88 TP_fast_assign(
89 __entry->dev = journal->j_fs_dev->bd_dev;
90 __entry->sync_commit = commit_transaction->t_synchronous_commit;
91 __entry->transaction = commit_transaction->t_tid;
92 ),
93
94 TP_printk("dev %s transaction %d sync %d",
95 jbd2_dev_to_name(__entry->dev), __entry->transaction,
96 __entry->sync_commit)
97);
98
99TRACE_EVENT(jbd2_commit_logging,
100
101 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
102
103 TP_ARGS(journal, commit_transaction),
104
105 TP_STRUCT__entry(
106 __field( dev_t, dev )
107 __field( char, sync_commit )
108 __field( int, transaction )
109 ),
110
111 TP_fast_assign(
112 __entry->dev = journal->j_fs_dev->bd_dev;
113 __entry->sync_commit = commit_transaction->t_synchronous_commit;
114 __entry->transaction = commit_transaction->t_tid;
115 ),
116
117 TP_printk("dev %s transaction %d sync %d",
118 jbd2_dev_to_name(__entry->dev), __entry->transaction,
119 __entry->sync_commit)
120);
121
122TRACE_EVENT(jbd2_end_commit,
123 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
124
125 TP_ARGS(journal, commit_transaction),
126
127 TP_STRUCT__entry(
128 __field( dev_t, dev )
129 __field( char, sync_commit )
130 __field( int, transaction )
131 __field( int, head )
132 ),
133
134 TP_fast_assign(
135 __entry->dev = journal->j_fs_dev->bd_dev;
136 __entry->sync_commit = commit_transaction->t_synchronous_commit;
137 __entry->transaction = commit_transaction->t_tid;
138 __entry->head = journal->j_tail_sequence;
139 ),
140
141 TP_printk("dev %s transaction %d sync %d head %d",
142 jbd2_dev_to_name(__entry->dev), __entry->transaction,
143 __entry->sync_commit, __entry->head)
144);
145
146TRACE_EVENT(jbd2_submit_inode_data,
147 TP_PROTO(struct inode *inode),
148
149 TP_ARGS(inode),
150
151 TP_STRUCT__entry(
152 __field( dev_t, dev )
153 __field( ino_t, ino )
154 ),
155
156 TP_fast_assign(
157 __entry->dev = inode->i_sb->s_dev;
158 __entry->ino = inode->i_ino;
159 ),
160
161 TP_printk("dev %s ino %lu",
162 jbd2_dev_to_name(__entry->dev), __entry->ino)
163);
164
165#endif /* _TRACE_JBD2_H */
166
167/* This part must be outside protection */
168#include <trace/define_trace.h>
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
new file mode 100644
index 000000000000..9baba50d6512
--- /dev/null
+++ b/include/trace/events/kmem.h
@@ -0,0 +1,231 @@
1#if !defined(_TRACE_KMEM_H) || defined(TRACE_HEADER_MULTI_READ)
2#define _TRACE_KMEM_H
3
4#include <linux/types.h>
5#include <linux/tracepoint.h>
6
7#undef TRACE_SYSTEM
8#define TRACE_SYSTEM kmem
9
10/*
11 * The order of these masks is important. Matching masks will be seen
12 * first and the left over flags will end up showing by themselves.
13 *
14 * For example, if we have GFP_KERNEL before GFP_USER we wil get:
15 *
16 * GFP_KERNEL|GFP_HARDWALL
17 *
18 * Thus most bits set go first.
19 */
20#define show_gfp_flags(flags) \
21 (flags) ? __print_flags(flags, "|", \
22 {(unsigned long)GFP_HIGHUSER_MOVABLE, "GFP_HIGHUSER_MOVABLE"}, \
23 {(unsigned long)GFP_HIGHUSER, "GFP_HIGHUSER"}, \
24 {(unsigned long)GFP_USER, "GFP_USER"}, \
25 {(unsigned long)GFP_TEMPORARY, "GFP_TEMPORARY"}, \
26 {(unsigned long)GFP_KERNEL, "GFP_KERNEL"}, \
27 {(unsigned long)GFP_NOFS, "GFP_NOFS"}, \
28 {(unsigned long)GFP_ATOMIC, "GFP_ATOMIC"}, \
29 {(unsigned long)GFP_NOIO, "GFP_NOIO"}, \
30 {(unsigned long)__GFP_HIGH, "GFP_HIGH"}, \
31 {(unsigned long)__GFP_WAIT, "GFP_WAIT"}, \
32 {(unsigned long)__GFP_IO, "GFP_IO"}, \
33 {(unsigned long)__GFP_COLD, "GFP_COLD"}, \
34 {(unsigned long)__GFP_NOWARN, "GFP_NOWARN"}, \
35 {(unsigned long)__GFP_REPEAT, "GFP_REPEAT"}, \
36 {(unsigned long)__GFP_NOFAIL, "GFP_NOFAIL"}, \
37 {(unsigned long)__GFP_NORETRY, "GFP_NORETRY"}, \
38 {(unsigned long)__GFP_COMP, "GFP_COMP"}, \
39 {(unsigned long)__GFP_ZERO, "GFP_ZERO"}, \
40 {(unsigned long)__GFP_NOMEMALLOC, "GFP_NOMEMALLOC"}, \
41 {(unsigned long)__GFP_HARDWALL, "GFP_HARDWALL"}, \
42 {(unsigned long)__GFP_THISNODE, "GFP_THISNODE"}, \
43 {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \
44 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"} \
45 ) : "GFP_NOWAIT"
46
47TRACE_EVENT(kmalloc,
48
49 TP_PROTO(unsigned long call_site,
50 const void *ptr,
51 size_t bytes_req,
52 size_t bytes_alloc,
53 gfp_t gfp_flags),
54
55 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags),
56
57 TP_STRUCT__entry(
58 __field( unsigned long, call_site )
59 __field( const void *, ptr )
60 __field( size_t, bytes_req )
61 __field( size_t, bytes_alloc )
62 __field( gfp_t, gfp_flags )
63 ),
64
65 TP_fast_assign(
66 __entry->call_site = call_site;
67 __entry->ptr = ptr;
68 __entry->bytes_req = bytes_req;
69 __entry->bytes_alloc = bytes_alloc;
70 __entry->gfp_flags = gfp_flags;
71 ),
72
73 TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s",
74 __entry->call_site,
75 __entry->ptr,
76 __entry->bytes_req,
77 __entry->bytes_alloc,
78 show_gfp_flags(__entry->gfp_flags))
79);
80
81TRACE_EVENT(kmem_cache_alloc,
82
83 TP_PROTO(unsigned long call_site,
84 const void *ptr,
85 size_t bytes_req,
86 size_t bytes_alloc,
87 gfp_t gfp_flags),
88
89 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags),
90
91 TP_STRUCT__entry(
92 __field( unsigned long, call_site )
93 __field( const void *, ptr )
94 __field( size_t, bytes_req )
95 __field( size_t, bytes_alloc )
96 __field( gfp_t, gfp_flags )
97 ),
98
99 TP_fast_assign(
100 __entry->call_site = call_site;
101 __entry->ptr = ptr;
102 __entry->bytes_req = bytes_req;
103 __entry->bytes_alloc = bytes_alloc;
104 __entry->gfp_flags = gfp_flags;
105 ),
106
107 TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s",
108 __entry->call_site,
109 __entry->ptr,
110 __entry->bytes_req,
111 __entry->bytes_alloc,
112 show_gfp_flags(__entry->gfp_flags))
113);
114
115TRACE_EVENT(kmalloc_node,
116
117 TP_PROTO(unsigned long call_site,
118 const void *ptr,
119 size_t bytes_req,
120 size_t bytes_alloc,
121 gfp_t gfp_flags,
122 int node),
123
124 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node),
125
126 TP_STRUCT__entry(
127 __field( unsigned long, call_site )
128 __field( const void *, ptr )
129 __field( size_t, bytes_req )
130 __field( size_t, bytes_alloc )
131 __field( gfp_t, gfp_flags )
132 __field( int, node )
133 ),
134
135 TP_fast_assign(
136 __entry->call_site = call_site;
137 __entry->ptr = ptr;
138 __entry->bytes_req = bytes_req;
139 __entry->bytes_alloc = bytes_alloc;
140 __entry->gfp_flags = gfp_flags;
141 __entry->node = node;
142 ),
143
144 TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d",
145 __entry->call_site,
146 __entry->ptr,
147 __entry->bytes_req,
148 __entry->bytes_alloc,
149 show_gfp_flags(__entry->gfp_flags),
150 __entry->node)
151);
152
153TRACE_EVENT(kmem_cache_alloc_node,
154
155 TP_PROTO(unsigned long call_site,
156 const void *ptr,
157 size_t bytes_req,
158 size_t bytes_alloc,
159 gfp_t gfp_flags,
160 int node),
161
162 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node),
163
164 TP_STRUCT__entry(
165 __field( unsigned long, call_site )
166 __field( const void *, ptr )
167 __field( size_t, bytes_req )
168 __field( size_t, bytes_alloc )
169 __field( gfp_t, gfp_flags )
170 __field( int, node )
171 ),
172
173 TP_fast_assign(
174 __entry->call_site = call_site;
175 __entry->ptr = ptr;
176 __entry->bytes_req = bytes_req;
177 __entry->bytes_alloc = bytes_alloc;
178 __entry->gfp_flags = gfp_flags;
179 __entry->node = node;
180 ),
181
182 TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%s node=%d",
183 __entry->call_site,
184 __entry->ptr,
185 __entry->bytes_req,
186 __entry->bytes_alloc,
187 show_gfp_flags(__entry->gfp_flags),
188 __entry->node)
189);
190
191TRACE_EVENT(kfree,
192
193 TP_PROTO(unsigned long call_site, const void *ptr),
194
195 TP_ARGS(call_site, ptr),
196
197 TP_STRUCT__entry(
198 __field( unsigned long, call_site )
199 __field( const void *, ptr )
200 ),
201
202 TP_fast_assign(
203 __entry->call_site = call_site;
204 __entry->ptr = ptr;
205 ),
206
207 TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr)
208);
209
210TRACE_EVENT(kmem_cache_free,
211
212 TP_PROTO(unsigned long call_site, const void *ptr),
213
214 TP_ARGS(call_site, ptr),
215
216 TP_STRUCT__entry(
217 __field( unsigned long, call_site )
218 __field( const void *, ptr )
219 ),
220
221 TP_fast_assign(
222 __entry->call_site = call_site;
223 __entry->ptr = ptr;
224 ),
225
226 TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr)
227);
228#endif /* _TRACE_KMEM_H */
229
230/* This part must be outside protection */
231#include <trace/define_trace.h>
diff --git a/include/trace/events/lockdep.h b/include/trace/events/lockdep.h
new file mode 100644
index 000000000000..0e956c9dfd7e
--- /dev/null
+++ b/include/trace/events/lockdep.h
@@ -0,0 +1,96 @@
1#if !defined(_TRACE_LOCKDEP_H) || defined(TRACE_HEADER_MULTI_READ)
2#define _TRACE_LOCKDEP_H
3
4#include <linux/lockdep.h>
5#include <linux/tracepoint.h>
6
7#undef TRACE_SYSTEM
8#define TRACE_SYSTEM lockdep
9
10#ifdef CONFIG_LOCKDEP
11
12TRACE_EVENT(lock_acquire,
13
14 TP_PROTO(struct lockdep_map *lock, unsigned int subclass,
15 int trylock, int read, int check,
16 struct lockdep_map *next_lock, unsigned long ip),
17
18 TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip),
19
20 TP_STRUCT__entry(
21 __field(unsigned int, flags)
22 __string(name, lock->name)
23 ),
24
25 TP_fast_assign(
26 __entry->flags = (trylock ? 1 : 0) | (read ? 2 : 0);
27 __assign_str(name, lock->name);
28 ),
29
30 TP_printk("%s%s%s", (__entry->flags & 1) ? "try " : "",
31 (__entry->flags & 2) ? "read " : "",
32 __get_str(name))
33);
34
35TRACE_EVENT(lock_release,
36
37 TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip),
38
39 TP_ARGS(lock, nested, ip),
40
41 TP_STRUCT__entry(
42 __string(name, lock->name)
43 ),
44
45 TP_fast_assign(
46 __assign_str(name, lock->name);
47 ),
48
49 TP_printk("%s", __get_str(name))
50);
51
52#ifdef CONFIG_LOCK_STAT
53
54TRACE_EVENT(lock_contended,
55
56 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
57
58 TP_ARGS(lock, ip),
59
60 TP_STRUCT__entry(
61 __string(name, lock->name)
62 ),
63
64 TP_fast_assign(
65 __assign_str(name, lock->name);
66 ),
67
68 TP_printk("%s", __get_str(name))
69);
70
71TRACE_EVENT(lock_acquired,
72 TP_PROTO(struct lockdep_map *lock, unsigned long ip, s64 waittime),
73
74 TP_ARGS(lock, ip, waittime),
75
76 TP_STRUCT__entry(
77 __string(name, lock->name)
78 __field(unsigned long, wait_usec)
79 __field(unsigned long, wait_nsec_rem)
80 ),
81 TP_fast_assign(
82 __assign_str(name, lock->name);
83 __entry->wait_nsec_rem = do_div(waittime, NSEC_PER_USEC);
84 __entry->wait_usec = (unsigned long) waittime;
85 ),
86 TP_printk("%s (%lu.%03lu us)", __get_str(name), __entry->wait_usec,
87 __entry->wait_nsec_rem)
88);
89
90#endif
91#endif
92
93#endif /* _TRACE_LOCKDEP_H */
94
95/* This part must be outside protection */
96#include <trace/define_trace.h>
diff --git a/include/trace/events/napi.h b/include/trace/events/napi.h
new file mode 100644
index 000000000000..a8989c4547e7
--- /dev/null
+++ b/include/trace/events/napi.h
@@ -0,0 +1,11 @@
1#ifndef _TRACE_NAPI_H_
2#define _TRACE_NAPI_H_
3
4#include <linux/netdevice.h>
5#include <linux/tracepoint.h>
6
7DECLARE_TRACE(napi_poll,
8 TP_PROTO(struct napi_struct *napi),
9 TP_ARGS(napi));
10
11#endif
diff --git a/include/trace/sched_event_types.h b/include/trace/events/sched.h
index 63547dc1125f..24ab5bcff7b2 100644
--- a/include/trace/sched_event_types.h
+++ b/include/trace/events/sched.h
@@ -1,9 +1,8 @@
1#if !defined(_TRACE_SCHED_H) || defined(TRACE_HEADER_MULTI_READ)
2#define _TRACE_SCHED_H
1 3
2/* use <trace/sched.h> instead */ 4#include <linux/sched.h>
3#ifndef TRACE_EVENT 5#include <linux/tracepoint.h>
4# error Do not include this file directly.
5# error Unless you know what you are doing.
6#endif
7 6
8#undef TRACE_SYSTEM 7#undef TRACE_SYSTEM
9#define TRACE_SYSTEM sched 8#define TRACE_SYSTEM sched
@@ -157,6 +156,7 @@ TRACE_EVENT(sched_switch,
157 __array( char, prev_comm, TASK_COMM_LEN ) 156 __array( char, prev_comm, TASK_COMM_LEN )
158 __field( pid_t, prev_pid ) 157 __field( pid_t, prev_pid )
159 __field( int, prev_prio ) 158 __field( int, prev_prio )
159 __field( long, prev_state )
160 __array( char, next_comm, TASK_COMM_LEN ) 160 __array( char, next_comm, TASK_COMM_LEN )
161 __field( pid_t, next_pid ) 161 __field( pid_t, next_pid )
162 __field( int, next_prio ) 162 __field( int, next_prio )
@@ -166,13 +166,19 @@ TRACE_EVENT(sched_switch,
166 memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN); 166 memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
167 __entry->prev_pid = prev->pid; 167 __entry->prev_pid = prev->pid;
168 __entry->prev_prio = prev->prio; 168 __entry->prev_prio = prev->prio;
169 __entry->prev_state = prev->state;
169 memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN); 170 memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
170 __entry->next_pid = next->pid; 171 __entry->next_pid = next->pid;
171 __entry->next_prio = next->prio; 172 __entry->next_prio = next->prio;
172 ), 173 ),
173 174
174 TP_printk("task %s:%d [%d] ==> %s:%d [%d]", 175 TP_printk("task %s:%d [%d] (%s) ==> %s:%d [%d]",
175 __entry->prev_comm, __entry->prev_pid, __entry->prev_prio, 176 __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
177 __entry->prev_state ?
178 __print_flags(__entry->prev_state, "|",
179 { 1, "S"} , { 2, "D" }, { 4, "T" }, { 8, "t" },
180 { 16, "Z" }, { 32, "X" }, { 64, "x" },
181 { 128, "W" }) : "R",
176 __entry->next_comm, __entry->next_pid, __entry->next_prio) 182 __entry->next_comm, __entry->next_pid, __entry->next_prio)
177); 183);
178 184
@@ -181,9 +187,9 @@ TRACE_EVENT(sched_switch,
181 */ 187 */
182TRACE_EVENT(sched_migrate_task, 188TRACE_EVENT(sched_migrate_task,
183 189
184 TP_PROTO(struct task_struct *p, int orig_cpu, int dest_cpu), 190 TP_PROTO(struct task_struct *p, int dest_cpu),
185 191
186 TP_ARGS(p, orig_cpu, dest_cpu), 192 TP_ARGS(p, dest_cpu),
187 193
188 TP_STRUCT__entry( 194 TP_STRUCT__entry(
189 __array( char, comm, TASK_COMM_LEN ) 195 __array( char, comm, TASK_COMM_LEN )
@@ -197,7 +203,7 @@ TRACE_EVENT(sched_migrate_task,
197 memcpy(__entry->comm, p->comm, TASK_COMM_LEN); 203 memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
198 __entry->pid = p->pid; 204 __entry->pid = p->pid;
199 __entry->prio = p->prio; 205 __entry->prio = p->prio;
200 __entry->orig_cpu = orig_cpu; 206 __entry->orig_cpu = task_cpu(p);
201 __entry->dest_cpu = dest_cpu; 207 __entry->dest_cpu = dest_cpu;
202 ), 208 ),
203 209
@@ -334,4 +340,7 @@ TRACE_EVENT(sched_signal_send,
334 __entry->sig, __entry->comm, __entry->pid) 340 __entry->sig, __entry->comm, __entry->pid)
335); 341);
336 342
337#undef TRACE_SYSTEM 343#endif /* _TRACE_SCHED_H */
344
345/* This part must be outside protection */
346#include <trace/define_trace.h>
diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h
new file mode 100644
index 000000000000..1e8fabb57c06
--- /dev/null
+++ b/include/trace/events/skb.h
@@ -0,0 +1,40 @@
1#if !defined(_TRACE_SKB_H) || defined(TRACE_HEADER_MULTI_READ)
2#define _TRACE_SKB_H
3
4#include <linux/skbuff.h>
5#include <linux/tracepoint.h>
6
7#undef TRACE_SYSTEM
8#define TRACE_SYSTEM skb
9
10/*
11 * Tracepoint for free an sk_buff:
12 */
13TRACE_EVENT(kfree_skb,
14
15 TP_PROTO(struct sk_buff *skb, void *location),
16
17 TP_ARGS(skb, location),
18
19 TP_STRUCT__entry(
20 __field( void *, skbaddr )
21 __field( unsigned short, protocol )
22 __field( void *, location )
23 ),
24
25 TP_fast_assign(
26 __entry->skbaddr = skb;
27 if (skb) {
28 __entry->protocol = ntohs(skb->protocol);
29 }
30 __entry->location = location;
31 ),
32
33 TP_printk("skbaddr=%p protocol=%u location=%p",
34 __entry->skbaddr, __entry->protocol, __entry->location)
35);
36
37#endif /* _TRACE_SKB_H */
38
39/* This part must be outside protection */
40#include <trace/define_trace.h>
diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h
new file mode 100644
index 000000000000..035f1bff288e
--- /dev/null
+++ b/include/trace/events/workqueue.h
@@ -0,0 +1,100 @@
1#if !defined(_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ)
2#define _TRACE_WORKQUEUE_H
3
4#include <linux/workqueue.h>
5#include <linux/sched.h>
6#include <linux/tracepoint.h>
7
8#undef TRACE_SYSTEM
9#define TRACE_SYSTEM workqueue
10
11TRACE_EVENT(workqueue_insertion,
12
13 TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
14
15 TP_ARGS(wq_thread, work),
16
17 TP_STRUCT__entry(
18 __array(char, thread_comm, TASK_COMM_LEN)
19 __field(pid_t, thread_pid)
20 __field(work_func_t, func)
21 ),
22
23 TP_fast_assign(
24 memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN);
25 __entry->thread_pid = wq_thread->pid;
26 __entry->func = work->func;
27 ),
28
29 TP_printk("thread=%s:%d func=%pF", __entry->thread_comm,
30 __entry->thread_pid, __entry->func)
31);
32
33TRACE_EVENT(workqueue_execution,
34
35 TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
36
37 TP_ARGS(wq_thread, work),
38
39 TP_STRUCT__entry(
40 __array(char, thread_comm, TASK_COMM_LEN)
41 __field(pid_t, thread_pid)
42 __field(work_func_t, func)
43 ),
44
45 TP_fast_assign(
46 memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN);
47 __entry->thread_pid = wq_thread->pid;
48 __entry->func = work->func;
49 ),
50
51 TP_printk("thread=%s:%d func=%pF", __entry->thread_comm,
52 __entry->thread_pid, __entry->func)
53);
54
55/* Trace the creation of one workqueue thread on a cpu */
56TRACE_EVENT(workqueue_creation,
57
58 TP_PROTO(struct task_struct *wq_thread, int cpu),
59
60 TP_ARGS(wq_thread, cpu),
61
62 TP_STRUCT__entry(
63 __array(char, thread_comm, TASK_COMM_LEN)
64 __field(pid_t, thread_pid)
65 __field(int, cpu)
66 ),
67
68 TP_fast_assign(
69 memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN);
70 __entry->thread_pid = wq_thread->pid;
71 __entry->cpu = cpu;
72 ),
73
74 TP_printk("thread=%s:%d cpu=%d", __entry->thread_comm,
75 __entry->thread_pid, __entry->cpu)
76);
77
78TRACE_EVENT(workqueue_destruction,
79
80 TP_PROTO(struct task_struct *wq_thread),
81
82 TP_ARGS(wq_thread),
83
84 TP_STRUCT__entry(
85 __array(char, thread_comm, TASK_COMM_LEN)
86 __field(pid_t, thread_pid)
87 ),
88
89 TP_fast_assign(
90 memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN);
91 __entry->thread_pid = wq_thread->pid;
92 ),
93
94 TP_printk("thread=%s:%d", __entry->thread_comm, __entry->thread_pid)
95);
96
97#endif /* _TRACE_WORKQUEUE_H */
98
99/* This part must be outside protection */
100#include <trace/define_trace.h>
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
new file mode 100644
index 000000000000..1867553c61e5
--- /dev/null
+++ b/include/trace/ftrace.h
@@ -0,0 +1,591 @@
1/*
2 * Stage 1 of the trace events.
3 *
4 * Override the macros in <trace/trace_events.h> to include the following:
5 *
6 * struct ftrace_raw_<call> {
7 * struct trace_entry ent;
8 * <type> <item>;
9 * <type2> <item2>[<len>];
10 * [...]
11 * };
12 *
13 * The <type> <item> is created by the __field(type, item) macro or
14 * the __array(type2, item2, len) macro.
15 * We simply do "type item;", and that will create the fields
16 * in the structure.
17 */
18
19#include <linux/ftrace_event.h>
20
21#undef __field
22#define __field(type, item) type item;
23
24#undef __array
25#define __array(type, item, len) type item[len];
26
27#undef __dynamic_array
28#define __dynamic_array(type, item, len) unsigned short __data_loc_##item;
29
30#undef __string
31#define __string(item, src) __dynamic_array(char, item, -1)
32
33#undef TP_STRUCT__entry
34#define TP_STRUCT__entry(args...) args
35
36#undef TRACE_EVENT
37#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
38 struct ftrace_raw_##name { \
39 struct trace_entry ent; \
40 tstruct \
41 char __data[0]; \
42 }; \
43 static struct ftrace_event_call event_##name
44
45#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
46
47
48/*
49 * Stage 2 of the trace events.
50 *
51 * Include the following:
52 *
53 * struct ftrace_data_offsets_<call> {
54 * int <item1>;
55 * int <item2>;
56 * [...]
57 * };
58 *
59 * The __dynamic_array() macro will create each int <item>, this is
60 * to keep the offset of each array from the beginning of the event.
61 */
62
63#undef __field
64#define __field(type, item);
65
66#undef __array
67#define __array(type, item, len)
68
69#undef __dynamic_array
70#define __dynamic_array(type, item, len) int item;
71
72#undef __string
73#define __string(item, src) __dynamic_array(char, item, -1)
74
75#undef TRACE_EVENT
76#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
77 struct ftrace_data_offsets_##call { \
78 tstruct; \
79 };
80
81#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
82
83/*
84 * Setup the showing format of trace point.
85 *
86 * int
87 * ftrace_format_##call(struct trace_seq *s)
88 * {
89 * struct ftrace_raw_##call field;
90 * int ret;
91 *
92 * ret = trace_seq_printf(s, #type " " #item ";"
93 * " offset:%u; size:%u;\n",
94 * offsetof(struct ftrace_raw_##call, item),
95 * sizeof(field.type));
96 *
97 * }
98 */
99
100#undef TP_STRUCT__entry
101#define TP_STRUCT__entry(args...) args
102
103#undef __field
104#define __field(type, item) \
105 ret = trace_seq_printf(s, "\tfield:" #type " " #item ";\t" \
106 "offset:%u;\tsize:%u;\n", \
107 (unsigned int)offsetof(typeof(field), item), \
108 (unsigned int)sizeof(field.item)); \
109 if (!ret) \
110 return 0;
111
112#undef __array
113#define __array(type, item, len) \
114 ret = trace_seq_printf(s, "\tfield:" #type " " #item "[" #len "];\t" \
115 "offset:%u;\tsize:%u;\n", \
116 (unsigned int)offsetof(typeof(field), item), \
117 (unsigned int)sizeof(field.item)); \
118 if (!ret) \
119 return 0;
120
121#undef __dynamic_array
122#define __dynamic_array(type, item, len) \
123 ret = trace_seq_printf(s, "\tfield:__data_loc " #item ";\t" \
124 "offset:%u;\tsize:%u;\n", \
125 (unsigned int)offsetof(typeof(field), \
126 __data_loc_##item), \
127 (unsigned int)sizeof(field.__data_loc_##item)); \
128 if (!ret) \
129 return 0;
130
131#undef __string
132#define __string(item, src) __dynamic_array(char, item, -1)
133
134#undef __entry
135#define __entry REC
136
137#undef __print_symbolic
138#undef __get_dynamic_array
139#undef __get_str
140
141#undef TP_printk
142#define TP_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args)
143
144#undef TP_fast_assign
145#define TP_fast_assign(args...) args
146
147#undef TRACE_EVENT
148#define TRACE_EVENT(call, proto, args, tstruct, func, print) \
149static int \
150ftrace_format_##call(struct trace_seq *s) \
151{ \
152 struct ftrace_raw_##call field __attribute__((unused)); \
153 int ret = 0; \
154 \
155 tstruct; \
156 \
157 trace_seq_printf(s, "\nprint fmt: " print); \
158 \
159 return ret; \
160}
161
162#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
163
164/*
165 * Stage 3 of the trace events.
166 *
167 * Override the macros in <trace/trace_events.h> to include the following:
168 *
169 * enum print_line_t
170 * ftrace_raw_output_<call>(struct trace_iterator *iter, int flags)
171 * {
172 * struct trace_seq *s = &iter->seq;
173 * struct ftrace_raw_<call> *field; <-- defined in stage 1
174 * struct trace_entry *entry;
175 * struct trace_seq *p;
176 * int ret;
177 *
178 * entry = iter->ent;
179 *
180 * if (entry->type != event_<call>.id) {
181 * WARN_ON_ONCE(1);
182 * return TRACE_TYPE_UNHANDLED;
183 * }
184 *
185 * field = (typeof(field))entry;
186 *
187 * p = get_cpu_var(ftrace_event_seq);
188 * trace_seq_init(p);
189 * ret = trace_seq_printf(s, <TP_printk> "\n");
190 * put_cpu();
191 * if (!ret)
192 * return TRACE_TYPE_PARTIAL_LINE;
193 *
194 * return TRACE_TYPE_HANDLED;
195 * }
196 *
197 * This is the method used to print the raw event to the trace
198 * output format. Note, this is not needed if the data is read
199 * in binary.
200 */
201
202#undef __entry
203#define __entry field
204
205#undef TP_printk
206#define TP_printk(fmt, args...) fmt "\n", args
207
208#undef __get_dynamic_array
209#define __get_dynamic_array(field) \
210 ((void *)__entry + __entry->__data_loc_##field)
211
212#undef __get_str
213#define __get_str(field) (char *)__get_dynamic_array(field)
214
215#undef __print_flags
216#define __print_flags(flag, delim, flag_array...) \
217 ({ \
218 static const struct trace_print_flags flags[] = \
219 { flag_array, { -1, NULL }}; \
220 ftrace_print_flags_seq(p, delim, flag, flags); \
221 })
222
223#undef __print_symbolic
224#define __print_symbolic(value, symbol_array...) \
225 ({ \
226 static const struct trace_print_flags symbols[] = \
227 { symbol_array, { -1, NULL }}; \
228 ftrace_print_symbols_seq(p, value, symbols); \
229 })
230
231#undef TRACE_EVENT
232#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
233enum print_line_t \
234ftrace_raw_output_##call(struct trace_iterator *iter, int flags) \
235{ \
236 struct trace_seq *s = &iter->seq; \
237 struct ftrace_raw_##call *field; \
238 struct trace_entry *entry; \
239 struct trace_seq *p; \
240 int ret; \
241 \
242 entry = iter->ent; \
243 \
244 if (entry->type != event_##call.id) { \
245 WARN_ON_ONCE(1); \
246 return TRACE_TYPE_UNHANDLED; \
247 } \
248 \
249 field = (typeof(field))entry; \
250 \
251 p = &get_cpu_var(ftrace_event_seq); \
252 trace_seq_init(p); \
253 ret = trace_seq_printf(s, #call ": " print); \
254 put_cpu(); \
255 if (!ret) \
256 return TRACE_TYPE_PARTIAL_LINE; \
257 \
258 return TRACE_TYPE_HANDLED; \
259}
260
261#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
262
263#undef __field
264#define __field(type, item) \
265 ret = trace_define_field(event_call, #type, #item, \
266 offsetof(typeof(field), item), \
267 sizeof(field.item), is_signed_type(type)); \
268 if (ret) \
269 return ret;
270
271#undef __array
272#define __array(type, item, len) \
273 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
274 ret = trace_define_field(event_call, #type "[" #len "]", #item, \
275 offsetof(typeof(field), item), \
276 sizeof(field.item), 0); \
277 if (ret) \
278 return ret;
279
280#undef __dynamic_array
281#define __dynamic_array(type, item, len) \
282 ret = trace_define_field(event_call, "__data_loc" "[" #type "]", #item,\
283 offsetof(typeof(field), __data_loc_##item), \
284 sizeof(field.__data_loc_##item), 0);
285
286#undef __string
287#define __string(item, src) __dynamic_array(char, item, -1)
288
289#undef TRACE_EVENT
290#define TRACE_EVENT(call, proto, args, tstruct, func, print) \
291int \
292ftrace_define_fields_##call(void) \
293{ \
294 struct ftrace_raw_##call field; \
295 struct ftrace_event_call *event_call = &event_##call; \
296 int ret; \
297 \
298 __common_field(int, type, 1); \
299 __common_field(unsigned char, flags, 0); \
300 __common_field(unsigned char, preempt_count, 0); \
301 __common_field(int, pid, 1); \
302 __common_field(int, tgid, 1); \
303 \
304 tstruct; \
305 \
306 return ret; \
307}
308
309#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
310
311/*
312 * remember the offset of each array from the beginning of the event.
313 */
314
315#undef __entry
316#define __entry entry
317
318#undef __field
319#define __field(type, item)
320
321#undef __array
322#define __array(type, item, len)
323
324#undef __dynamic_array
325#define __dynamic_array(type, item, len) \
326 __data_offsets->item = __data_size + \
327 offsetof(typeof(*entry), __data); \
328 __data_size += (len) * sizeof(type);
329
330#undef __string
331#define __string(item, src) __dynamic_array(char, item, strlen(src) + 1) \
332
333#undef TRACE_EVENT
334#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
335static inline int ftrace_get_offsets_##call( \
336 struct ftrace_data_offsets_##call *__data_offsets, proto) \
337{ \
338 int __data_size = 0; \
339 struct ftrace_raw_##call __maybe_unused *entry; \
340 \
341 tstruct; \
342 \
343 return __data_size; \
344}
345
346#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
347
348/*
349 * Stage 4 of the trace events.
350 *
351 * Override the macros in <trace/trace_events.h> to include the following:
352 *
353 * static void ftrace_event_<call>(proto)
354 * {
355 * event_trace_printk(_RET_IP_, "<call>: " <fmt>);
356 * }
357 *
358 * static int ftrace_reg_event_<call>(void)
359 * {
360 * int ret;
361 *
362 * ret = register_trace_<call>(ftrace_event_<call>);
363 * if (!ret)
364 * pr_info("event trace: Could not activate trace point "
365 * "probe to <call>");
366 * return ret;
367 * }
368 *
369 * static void ftrace_unreg_event_<call>(void)
370 * {
371 * unregister_trace_<call>(ftrace_event_<call>);
372 * }
373 *
374 *
375 * For those macros defined with TRACE_EVENT:
376 *
377 * static struct ftrace_event_call event_<call>;
378 *
379 * static void ftrace_raw_event_<call>(proto)
380 * {
381 * struct ring_buffer_event *event;
382 * struct ftrace_raw_<call> *entry; <-- defined in stage 1
383 * unsigned long irq_flags;
384 * int pc;
385 *
386 * local_save_flags(irq_flags);
387 * pc = preempt_count();
388 *
389 * event = trace_current_buffer_lock_reserve(event_<call>.id,
390 * sizeof(struct ftrace_raw_<call>),
391 * irq_flags, pc);
392 * if (!event)
393 * return;
394 * entry = ring_buffer_event_data(event);
395 *
396 * <assign>; <-- Here we assign the entries by the __field and
397 * __array macros.
398 *
399 * trace_current_buffer_unlock_commit(event, irq_flags, pc);
400 * }
401 *
402 * static int ftrace_raw_reg_event_<call>(void)
403 * {
404 * int ret;
405 *
406 * ret = register_trace_<call>(ftrace_raw_event_<call>);
407 * if (!ret)
408 * pr_info("event trace: Could not activate trace point "
409 * "probe to <call>");
410 * return ret;
411 * }
412 *
413 * static void ftrace_unreg_event_<call>(void)
414 * {
415 * unregister_trace_<call>(ftrace_raw_event_<call>);
416 * }
417 *
418 * static struct trace_event ftrace_event_type_<call> = {
419 * .trace = ftrace_raw_output_<call>, <-- stage 2
420 * };
421 *
422 * static int ftrace_raw_init_event_<call>(void)
423 * {
424 * int id;
425 *
426 * id = register_ftrace_event(&ftrace_event_type_<call>);
427 * if (!id)
428 * return -ENODEV;
429 * event_<call>.id = id;
430 * return 0;
431 * }
432 *
433 * static struct ftrace_event_call __used
434 * __attribute__((__aligned__(4)))
435 * __attribute__((section("_ftrace_events"))) event_<call> = {
436 * .name = "<call>",
437 * .system = "<system>",
438 * .raw_init = ftrace_raw_init_event_<call>,
439 * .regfunc = ftrace_reg_event_<call>,
440 * .unregfunc = ftrace_unreg_event_<call>,
441 * .show_format = ftrace_format_<call>,
442 * }
443 *
444 */
445
446#undef TP_FMT
447#define TP_FMT(fmt, args...) fmt "\n", ##args
448
449#ifdef CONFIG_EVENT_PROFILE
450#define _TRACE_PROFILE(call, proto, args) \
451static void ftrace_profile_##call(proto) \
452{ \
453 extern void perf_tpcounter_event(int); \
454 perf_tpcounter_event(event_##call.id); \
455} \
456 \
457static int ftrace_profile_enable_##call(struct ftrace_event_call *event_call) \
458{ \
459 int ret = 0; \
460 \
461 if (!atomic_inc_return(&event_call->profile_count)) \
462 ret = register_trace_##call(ftrace_profile_##call); \
463 \
464 return ret; \
465} \
466 \
467static void ftrace_profile_disable_##call(struct ftrace_event_call *event_call)\
468{ \
469 if (atomic_add_negative(-1, &event_call->profile_count)) \
470 unregister_trace_##call(ftrace_profile_##call); \
471}
472
473#define _TRACE_PROFILE_INIT(call) \
474 .profile_count = ATOMIC_INIT(-1), \
475 .profile_enable = ftrace_profile_enable_##call, \
476 .profile_disable = ftrace_profile_disable_##call,
477
478#else
479#define _TRACE_PROFILE(call, proto, args)
480#define _TRACE_PROFILE_INIT(call)
481#endif
482
483#undef __entry
484#define __entry entry
485
486#undef __field
487#define __field(type, item)
488
489#undef __array
490#define __array(type, item, len)
491
492#undef __dynamic_array
493#define __dynamic_array(type, item, len) \
494 __entry->__data_loc_##item = __data_offsets.item;
495
496#undef __string
497#define __string(item, src) __dynamic_array(char, item, -1) \
498
499#undef __assign_str
500#define __assign_str(dst, src) \
501 strcpy(__get_str(dst), src);
502
503#undef TRACE_EVENT
504#define TRACE_EVENT(call, proto, args, tstruct, assign, print) \
505_TRACE_PROFILE(call, PARAMS(proto), PARAMS(args)) \
506 \
507static struct ftrace_event_call event_##call; \
508 \
509static void ftrace_raw_event_##call(proto) \
510{ \
511 struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\
512 struct ftrace_event_call *event_call = &event_##call; \
513 struct ring_buffer_event *event; \
514 struct ftrace_raw_##call *entry; \
515 unsigned long irq_flags; \
516 int __data_size; \
517 int pc; \
518 \
519 local_save_flags(irq_flags); \
520 pc = preempt_count(); \
521 \
522 __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
523 \
524 event = trace_current_buffer_lock_reserve(event_##call.id, \
525 sizeof(*entry) + __data_size, \
526 irq_flags, pc); \
527 if (!event) \
528 return; \
529 entry = ring_buffer_event_data(event); \
530 \
531 \
532 tstruct \
533 \
534 { assign; } \
535 \
536 if (!filter_current_check_discard(event_call, entry, event)) \
537 trace_nowake_buffer_unlock_commit(event, irq_flags, pc); \
538} \
539 \
540static int ftrace_raw_reg_event_##call(void) \
541{ \
542 int ret; \
543 \
544 ret = register_trace_##call(ftrace_raw_event_##call); \
545 if (ret) \
546 pr_info("event trace: Could not activate trace point " \
547 "probe to " #call "\n"); \
548 return ret; \
549} \
550 \
551static void ftrace_raw_unreg_event_##call(void) \
552{ \
553 unregister_trace_##call(ftrace_raw_event_##call); \
554} \
555 \
556static struct trace_event ftrace_event_type_##call = { \
557 .trace = ftrace_raw_output_##call, \
558}; \
559 \
560static int ftrace_raw_init_event_##call(void) \
561{ \
562 int id; \
563 \
564 id = register_ftrace_event(&ftrace_event_type_##call); \
565 if (!id) \
566 return -ENODEV; \
567 event_##call.id = id; \
568 INIT_LIST_HEAD(&event_##call.fields); \
569 init_preds(&event_##call); \
570 return 0; \
571} \
572 \
573static struct ftrace_event_call __used \
574__attribute__((__aligned__(4))) \
575__attribute__((section("_ftrace_events"))) event_##call = { \
576 .name = #call, \
577 .system = __stringify(TRACE_SYSTEM), \
578 .event = &ftrace_event_type_##call, \
579 .raw_init = ftrace_raw_init_event_##call, \
580 .regfunc = ftrace_raw_reg_event_##call, \
581 .unregfunc = ftrace_raw_unreg_event_##call, \
582 .show_format = ftrace_format_##call, \
583 .define_fields = ftrace_define_fields_##call, \
584 _TRACE_PROFILE_INIT(call) \
585}
586
587#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
588
589#undef _TRACE_PROFILE
590#undef _TRACE_PROFILE_INIT
591
diff --git a/include/trace/irq.h b/include/trace/irq.h
deleted file mode 100644
index ff5d4495dc37..000000000000
--- a/include/trace/irq.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _TRACE_IRQ_H
2#define _TRACE_IRQ_H
3
4#include <linux/interrupt.h>
5#include <linux/tracepoint.h>
6
7#include <trace/irq_event_types.h>
8
9#endif
diff --git a/include/trace/irq_event_types.h b/include/trace/irq_event_types.h
deleted file mode 100644
index 85964ebd47ec..000000000000
--- a/include/trace/irq_event_types.h
+++ /dev/null
@@ -1,55 +0,0 @@
1
2/* use <trace/irq.h> instead */
3#ifndef TRACE_FORMAT
4# error Do not include this file directly.
5# error Unless you know what you are doing.
6#endif
7
8#undef TRACE_SYSTEM
9#define TRACE_SYSTEM irq
10
11/*
12 * Tracepoint for entry of interrupt handler:
13 */
14TRACE_FORMAT(irq_handler_entry,
15 TP_PROTO(int irq, struct irqaction *action),
16 TP_ARGS(irq, action),
17 TP_FMT("irq=%d handler=%s", irq, action->name)
18 );
19
20/*
21 * Tracepoint for return of an interrupt handler:
22 */
23TRACE_EVENT(irq_handler_exit,
24
25 TP_PROTO(int irq, struct irqaction *action, int ret),
26
27 TP_ARGS(irq, action, ret),
28
29 TP_STRUCT__entry(
30 __field( int, irq )
31 __field( int, ret )
32 ),
33
34 TP_fast_assign(
35 __entry->irq = irq;
36 __entry->ret = ret;
37 ),
38
39 TP_printk("irq=%d return=%s",
40 __entry->irq, __entry->ret ? "handled" : "unhandled")
41);
42
43TRACE_FORMAT(softirq_entry,
44 TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
45 TP_ARGS(h, vec),
46 TP_FMT("softirq=%d action=%s", (int)(h - vec), softirq_to_name[h-vec])
47 );
48
49TRACE_FORMAT(softirq_exit,
50 TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
51 TP_ARGS(h, vec),
52 TP_FMT("softirq=%d action=%s", (int)(h - vec), softirq_to_name[h-vec])
53 );
54
55#undef TRACE_SYSTEM
diff --git a/include/trace/kmemtrace.h b/include/trace/kmemtrace.h
deleted file mode 100644
index 28ee69f9cd46..000000000000
--- a/include/trace/kmemtrace.h
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * Copyright (C) 2008 Eduard - Gabriel Munteanu
3 *
4 * This file is released under GPL version 2.
5 */
6
7#ifndef _LINUX_KMEMTRACE_H
8#define _LINUX_KMEMTRACE_H
9
10#ifdef __KERNEL__
11
12#include <linux/tracepoint.h>
13#include <linux/types.h>
14
15#ifdef CONFIG_KMEMTRACE
16extern void kmemtrace_init(void);
17#else
18static inline void kmemtrace_init(void)
19{
20}
21#endif
22
23DECLARE_TRACE(kmalloc,
24 TP_PROTO(unsigned long call_site,
25 const void *ptr,
26 size_t bytes_req,
27 size_t bytes_alloc,
28 gfp_t gfp_flags),
29 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags));
30DECLARE_TRACE(kmem_cache_alloc,
31 TP_PROTO(unsigned long call_site,
32 const void *ptr,
33 size_t bytes_req,
34 size_t bytes_alloc,
35 gfp_t gfp_flags),
36 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags));
37DECLARE_TRACE(kmalloc_node,
38 TP_PROTO(unsigned long call_site,
39 const void *ptr,
40 size_t bytes_req,
41 size_t bytes_alloc,
42 gfp_t gfp_flags,
43 int node),
44 TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node));
45DECLARE_TRACE(kmem_cache_alloc_node,
46 TP_PROTO(unsigned long call_site,
47 const void *ptr,
48 size_t bytes_req,
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));
59
60#endif /* __KERNEL__ */
61
62#endif /* _LINUX_KMEMTRACE_H */
63
diff --git a/include/trace/lockdep.h b/include/trace/lockdep.h
deleted file mode 100644
index 5ca67df87f2a..000000000000
--- a/include/trace/lockdep.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _TRACE_LOCKDEP_H
2#define _TRACE_LOCKDEP_H
3
4#include <linux/lockdep.h>
5#include <linux/tracepoint.h>
6
7#include <trace/lockdep_event_types.h>
8
9#endif
diff --git a/include/trace/lockdep_event_types.h b/include/trace/lockdep_event_types.h
deleted file mode 100644
index adccfcd2ec8f..000000000000
--- a/include/trace/lockdep_event_types.h
+++ /dev/null
@@ -1,44 +0,0 @@
1
2#ifndef TRACE_FORMAT
3# error Do not include this file directly.
4# error Unless you know what you are doing.
5#endif
6
7#undef TRACE_SYSTEM
8#define TRACE_SYSTEM lock
9
10#ifdef CONFIG_LOCKDEP
11
12TRACE_FORMAT(lock_acquire,
13 TP_PROTO(struct lockdep_map *lock, unsigned int subclass,
14 int trylock, int read, int check,
15 struct lockdep_map *next_lock, unsigned long ip),
16 TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip),
17 TP_FMT("%s%s%s", trylock ? "try " : "",
18 read ? "read " : "", lock->name)
19 );
20
21TRACE_FORMAT(lock_release,
22 TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip),
23 TP_ARGS(lock, nested, ip),
24 TP_FMT("%s", lock->name)
25 );
26
27#ifdef CONFIG_LOCK_STAT
28
29TRACE_FORMAT(lock_contended,
30 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
31 TP_ARGS(lock, ip),
32 TP_FMT("%s", lock->name)
33 );
34
35TRACE_FORMAT(lock_acquired,
36 TP_PROTO(struct lockdep_map *lock, unsigned long ip),
37 TP_ARGS(lock, ip),
38 TP_FMT("%s", lock->name)
39 );
40
41#endif
42#endif
43
44#undef TRACE_SYSTEM
diff --git a/include/trace/sched.h b/include/trace/sched.h
deleted file mode 100644
index 4e372a1a29bf..000000000000
--- a/include/trace/sched.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef _TRACE_SCHED_H
2#define _TRACE_SCHED_H
3
4#include <linux/sched.h>
5#include <linux/tracepoint.h>
6
7#include <trace/sched_event_types.h>
8
9#endif
diff --git a/include/trace/skb.h b/include/trace/skb.h
deleted file mode 100644
index b66206d9be72..000000000000
--- a/include/trace/skb.h
+++ /dev/null
@@ -1,11 +0,0 @@
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/trace/trace_event_types.h b/include/trace/trace_event_types.h
deleted file mode 100644
index df56f5694be6..000000000000
--- a/include/trace/trace_event_types.h
+++ /dev/null
@@ -1,5 +0,0 @@
1/* trace/<type>_event_types.h here */
2
3#include <trace/sched_event_types.h>
4#include <trace/irq_event_types.h>
5#include <trace/lockdep_event_types.h>
diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h
deleted file mode 100644
index fd13750ca4ba..000000000000
--- a/include/trace/trace_events.h
+++ /dev/null
@@ -1,5 +0,0 @@
1/* trace/<type>.h here */
2
3#include <trace/sched.h>
4#include <trace/irq.h>
5#include <trace/lockdep.h>
diff --git a/include/trace/workqueue.h b/include/trace/workqueue.h
deleted file mode 100644
index 7626523deeba..000000000000
--- a/include/trace/workqueue.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef __TRACE_WORKQUEUE_H
2#define __TRACE_WORKQUEUE_H
3
4#include <linux/tracepoint.h>
5#include <linux/workqueue.h>
6#include <linux/sched.h>
7
8DECLARE_TRACE(workqueue_insertion,
9 TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
10 TP_ARGS(wq_thread, work));
11
12DECLARE_TRACE(workqueue_execution,
13 TP_PROTO(struct task_struct *wq_thread, struct work_struct *work),
14 TP_ARGS(wq_thread, work));
15
16/* Trace the creation of one workqueue thread on a cpu */
17DECLARE_TRACE(workqueue_creation,
18 TP_PROTO(struct task_struct *wq_thread, int cpu),
19 TP_ARGS(wq_thread, cpu));
20
21DECLARE_TRACE(workqueue_destruction,
22 TP_PROTO(struct task_struct *wq_thread),
23 TP_ARGS(wq_thread));
24
25#endif /* __TRACE_WORKQUEUE_H */
diff --git a/include/video/pxa168fb.h b/include/video/pxa168fb.h
new file mode 100644
index 000000000000..b5cc72fe0461
--- /dev/null
+++ b/include/video/pxa168fb.h
@@ -0,0 +1,127 @@
1/*
2 * linux/arch/arm/mach-mmp/include/mach/pxa168fb.h
3 *
4 * Copyright (C) 2009 Marvell International Ltd.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_MACH_PXA168FB_H
12#define __ASM_MACH_PXA168FB_H
13
14#include <linux/fb.h>
15#include <linux/interrupt.h>
16
17/* Dumb interface */
18#define PIN_MODE_DUMB_24 0
19#define PIN_MODE_DUMB_18_SPI 1
20#define PIN_MODE_DUMB_18_GPIO 2
21#define PIN_MODE_DUMB_16_SPI 3
22#define PIN_MODE_DUMB_16_GPIO 4
23#define PIN_MODE_DUMB_12_SPI_GPIO 5
24#define PIN_MODE_SMART_18_SPI 6
25#define PIN_MODE_SMART_16_SPI 7
26#define PIN_MODE_SMART_8_SPI_GPIO 8
27
28/* Dumb interface pin allocation */
29#define DUMB_MODE_RGB565 0
30#define DUMB_MODE_RGB565_UPPER 1
31#define DUMB_MODE_RGB666 2
32#define DUMB_MODE_RGB666_UPPER 3
33#define DUMB_MODE_RGB444 4
34#define DUMB_MODE_RGB444_UPPER 5
35#define DUMB_MODE_RGB888 6
36
37/* default fb buffer size WVGA-32bits */
38#define DEFAULT_FB_SIZE (800 * 480 * 4)
39
40/*
41 * Buffer pixel format
42 * bit0 is for rb swap.
43 * bit12 is for Y UorV swap
44 */
45#define PIX_FMT_RGB565 0
46#define PIX_FMT_BGR565 1
47#define PIX_FMT_RGB1555 2
48#define PIX_FMT_BGR1555 3
49#define PIX_FMT_RGB888PACK 4
50#define PIX_FMT_BGR888PACK 5
51#define PIX_FMT_RGB888UNPACK 6
52#define PIX_FMT_BGR888UNPACK 7
53#define PIX_FMT_RGBA888 8
54#define PIX_FMT_BGRA888 9
55#define PIX_FMT_YUV422PACK 10
56#define PIX_FMT_YVU422PACK 11
57#define PIX_FMT_YUV422PLANAR 12
58#define PIX_FMT_YVU422PLANAR 13
59#define PIX_FMT_YUV420PLANAR 14
60#define PIX_FMT_YVU420PLANAR 15
61#define PIX_FMT_PSEUDOCOLOR 20
62#define PIX_FMT_UYVY422PACK (0x1000|PIX_FMT_YUV422PACK)
63
64/*
65 * PXA LCD controller private state.
66 */
67struct pxa168fb_info {
68 struct device *dev;
69 struct clk *clk;
70 struct fb_info *info;
71
72 void __iomem *reg_base;
73 dma_addr_t fb_start_dma;
74 u32 pseudo_palette[16];
75
76 int pix_fmt;
77 unsigned is_blanked:1;
78 unsigned panel_rbswap:1;
79 unsigned active:1;
80};
81
82/*
83 * PXA fb machine information
84 */
85struct pxa168fb_mach_info {
86 char id[16];
87
88 int num_modes;
89 struct fb_videomode *modes;
90
91 /*
92 * Pix_fmt
93 */
94 unsigned pix_fmt;
95
96 /*
97 * I/O pin allocation.
98 */
99 unsigned io_pin_allocation_mode:4;
100
101 /*
102 * Dumb panel -- assignment of R/G/B component info to the 24
103 * available external data lanes.
104 */
105 unsigned dumb_mode:4;
106 unsigned panel_rgb_reverse_lanes:1;
107
108 /*
109 * Dumb panel -- GPIO output data.
110 */
111 unsigned gpio_output_mask:8;
112 unsigned gpio_output_data:8;
113
114 /*
115 * Dumb panel -- configurable output signal polarity.
116 */
117 unsigned invert_composite_blank:1;
118 unsigned invert_pix_val_ena:1;
119 unsigned invert_pixclock:1;
120 unsigned invert_vsync:1;
121 unsigned invert_hsync:1;
122 unsigned panel_rbswap:1;
123 unsigned active:1;
124 unsigned enable_lcd:1;
125};
126
127#endif /* __ASM_MACH_PXA168FB_H */
diff --git a/include/video/s1d13xxxfb.h b/include/video/s1d13xxxfb.h
index c3b2a2aa7140..f0736cff2ca3 100644
--- a/include/video/s1d13xxxfb.h
+++ b/include/video/s1d13xxxfb.h
@@ -136,6 +136,15 @@
136#define S1DREG_DELAYOFF 0xFFFE 136#define S1DREG_DELAYOFF 0xFFFE
137#define S1DREG_DELAYON 0xFFFF 137#define S1DREG_DELAYON 0xFFFF
138 138
139#define BBLT_FIFO_EMPTY 0x00
140#define BBLT_FIFO_NOT_EMPTY 0x40
141#define BBLT_FIFO_NOT_FULL 0x30
142#define BBLT_FIFO_HALF_FULL 0x20
143#define BBLT_FIFO_FULL 0x10
144
145#define BBLT_SOLID_FILL 0x0c
146
147
139/* Note: all above defines should go in separate header files 148/* Note: all above defines should go in separate header files
140 when implementing other S1D13xxx chip support. */ 149 when implementing other S1D13xxx chip support. */
141 150
diff --git a/include/xen/Kbuild b/include/xen/Kbuild
new file mode 100644
index 000000000000..4e65c16a445b
--- /dev/null
+++ b/include/xen/Kbuild
@@ -0,0 +1 @@
header-y += evtchn.h
diff --git a/include/xen/events.h b/include/xen/events.h
index 0d5f1adc0363..e68d59a90ca8 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -53,4 +53,7 @@ bool xen_test_irq_pending(int irq);
53 irq will be disabled so it won't deliver an interrupt. */ 53 irq will be disabled so it won't deliver an interrupt. */
54void xen_poll_irq(int irq); 54void xen_poll_irq(int irq);
55 55
56/* Determine the IRQ which is bound to an event channel */
57unsigned irq_from_evtchn(unsigned int evtchn);
58
56#endif /* _XEN_EVENTS_H */ 59#endif /* _XEN_EVENTS_H */
diff --git a/include/xen/evtchn.h b/include/xen/evtchn.h
new file mode 100644
index 000000000000..14e833ee4e0b
--- /dev/null
+++ b/include/xen/evtchn.h
@@ -0,0 +1,88 @@
1/******************************************************************************
2 * evtchn.h
3 *
4 * Interface to /dev/xen/evtchn.
5 *
6 * Copyright (c) 2003-2005, K A Fraser
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 version 2
10 * as published by the Free Software Foundation; or, when distributed
11 * separately from the Linux kernel or incorporated into other
12 * software packages, subject to the following license:
13 *
14 * Permission is hereby granted, free of charge, to any person obtaining a copy
15 * of this source file (the "Software"), to deal in the Software without
16 * restriction, including without limitation the rights to use, copy, modify,
17 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
18 * and to permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be included in
22 * all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
30 * IN THE SOFTWARE.
31 */
32
33#ifndef __LINUX_PUBLIC_EVTCHN_H__
34#define __LINUX_PUBLIC_EVTCHN_H__
35
36/*
37 * Bind a fresh port to VIRQ @virq.
38 * Return allocated port.
39 */
40#define IOCTL_EVTCHN_BIND_VIRQ \
41 _IOC(_IOC_NONE, 'E', 0, sizeof(struct ioctl_evtchn_bind_virq))
42struct ioctl_evtchn_bind_virq {
43 unsigned int virq;
44};
45
46/*
47 * Bind a fresh port to remote <@remote_domain, @remote_port>.
48 * Return allocated port.
49 */
50#define IOCTL_EVTCHN_BIND_INTERDOMAIN \
51 _IOC(_IOC_NONE, 'E', 1, sizeof(struct ioctl_evtchn_bind_interdomain))
52struct ioctl_evtchn_bind_interdomain {
53 unsigned int remote_domain, remote_port;
54};
55
56/*
57 * Allocate a fresh port for binding to @remote_domain.
58 * Return allocated port.
59 */
60#define IOCTL_EVTCHN_BIND_UNBOUND_PORT \
61 _IOC(_IOC_NONE, 'E', 2, sizeof(struct ioctl_evtchn_bind_unbound_port))
62struct ioctl_evtchn_bind_unbound_port {
63 unsigned int remote_domain;
64};
65
66/*
67 * Unbind previously allocated @port.
68 */
69#define IOCTL_EVTCHN_UNBIND \
70 _IOC(_IOC_NONE, 'E', 3, sizeof(struct ioctl_evtchn_unbind))
71struct ioctl_evtchn_unbind {
72 unsigned int port;
73};
74
75/*
76 * Unbind previously allocated @port.
77 */
78#define IOCTL_EVTCHN_NOTIFY \
79 _IOC(_IOC_NONE, 'E', 4, sizeof(struct ioctl_evtchn_notify))
80struct ioctl_evtchn_notify {
81 unsigned int port;
82};
83
84/* Clear and reinitialise the event buffer. Clear error condition. */
85#define IOCTL_EVTCHN_RESET \
86 _IOC(_IOC_NONE, 'E', 5, 0)
87
88#endif /* __LINUX_PUBLIC_EVTCHN_H__ */
diff --git a/include/xen/interface/version.h b/include/xen/interface/version.h
index 453235e923f0..e8b6519d47e9 100644
--- a/include/xen/interface/version.h
+++ b/include/xen/interface/version.h
@@ -57,4 +57,7 @@ struct xen_feature_info {
57/* Declares the features reported by XENVER_get_features. */ 57/* Declares the features reported by XENVER_get_features. */
58#include "features.h" 58#include "features.h"
59 59
60/* arg == NULL; returns host memory page size. */
61#define XENVER_pagesize 7
62
60#endif /* __XEN_PUBLIC_VERSION_H__ */ 63#endif /* __XEN_PUBLIC_VERSION_H__ */
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index f87f9614844d..b9763badbd77 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -91,8 +91,7 @@ struct xenbus_driver {
91 void (*otherend_changed)(struct xenbus_device *dev, 91 void (*otherend_changed)(struct xenbus_device *dev,
92 enum xenbus_state backend_state); 92 enum xenbus_state backend_state);
93 int (*remove)(struct xenbus_device *dev); 93 int (*remove)(struct xenbus_device *dev);
94 int (*suspend)(struct xenbus_device *dev); 94 int (*suspend)(struct xenbus_device *dev, pm_message_t state);
95 int (*suspend_cancel)(struct xenbus_device *dev);
96 int (*resume)(struct xenbus_device *dev); 95 int (*resume)(struct xenbus_device *dev);
97 int (*uevent)(struct xenbus_device *, char **, int, char *, int); 96 int (*uevent)(struct xenbus_device *, char **, int, char *, int);
98 struct device_driver driver; 97 struct device_driver driver;