aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2012-10-29 17:15:32 -0400
committerMarcelo Tosatti <mtosatti@redhat.com>2012-10-29 17:15:32 -0400
commit19bf7f8ac3f8131100027281c495dbbe00cd5ae0 (patch)
tree270b97e3ca47c0f62a1babca2ae37f79a76a309c /include
parent787c57c0fb393fe8a3974d300ddcfe30373386fe (diff)
parent35fd3dc58da675d659513384221349ef90749a01 (diff)
Merge remote-tracking branch 'master' into queue
Merge reason: development work has dependency on kvm patches merged upstream. Conflicts: arch/powerpc/include/asm/Kbuild arch/powerpc/include/asm/kvm_para.h Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/Kbuild4
-rw-r--r--include/acpi/acbuffer.h235
-rw-r--r--include/acpi/acnames.h3
-rw-r--r--include/acpi/acpi_bus.h60
-rw-r--r--include/acpi/acpixf.h7
-rw-r--r--include/acpi/actbl.h60
-rw-r--r--include/acpi/actbl1.h16
-rw-r--r--include/acpi/actbl2.h123
-rw-r--r--include/acpi/actbl3.h13
-rw-r--r--include/acpi/actypes.h7
-rw-r--r--include/asm-generic/Kbuild35
-rw-r--r--include/asm-generic/bitops/count_zeros.h57
-rw-r--r--include/asm-generic/bitops/le.h10
-rw-r--r--include/asm-generic/bitsperlong.h13
-rw-r--r--include/asm-generic/clkdev.h28
-rw-r--r--include/asm-generic/int-l64.h26
-rw-r--r--include/asm-generic/int-ll64.h31
-rw-r--r--include/asm-generic/ioctl.h95
-rw-r--r--include/asm-generic/kvm_para.h5
-rw-r--r--include/asm-generic/module.h40
-rw-r--r--include/asm-generic/param.h17
-rw-r--r--include/asm-generic/pgtable.h72
-rw-r--r--include/asm-generic/resource.h66
-rw-r--r--include/asm-generic/siginfo.h297
-rw-r--r--include/asm-generic/signal.h117
-rw-r--r--include/asm-generic/statfs.h81
-rw-r--r--include/asm-generic/termios.h49
-rw-r--r--include/asm-generic/unistd.h911
-rw-r--r--include/asm-generic/vmlinux.lds.h9
-rw-r--r--include/asm-generic/xor.h4
-rw-r--r--include/crypto/public_key.h108
-rw-r--r--include/drm/Kbuild15
-rw-r--r--include/drm/drm_crtc.h1
-rw-r--r--include/drm/drm_dp_helper.h101
-rw-r--r--include/drm/drm_pciids.h3
-rw-r--r--include/drm/exynos_drm.h175
-rw-r--r--include/drm/i915_drm.h920
-rw-r--r--include/keys/asymmetric-parser.h37
-rw-r--r--include/keys/asymmetric-subtype.h55
-rw-r--r--include/keys/asymmetric-type.h25
-rw-r--r--include/keys/user-type.h6
-rw-r--r--include/linux/Kbuild408
-rw-r--r--include/linux/a.out.h196
-rw-r--r--include/linux/acct.h108
-rw-r--r--include/linux/adb.h39
-rw-r--r--include/linux/adfs_fs.h42
-rw-r--r--include/linux/agpgart.h86
-rw-r--r--include/linux/alarmtimer.h31
-rw-r--r--include/linux/apm_bios.h125
-rw-r--r--include/linux/asn1.h67
-rw-r--r--include/linux/asn1_ber_bytecode.h87
-rw-r--r--include/linux/asn1_decoder.h24
-rw-r--r--include/linux/atalk.h43
-rw-r--r--include/linux/atm.h238
-rw-r--r--include/linux/atm_tcp.h54
-rw-r--r--include/linux/atmdev.h213
-rw-r--r--include/linux/atomic.h25
-rw-r--r--include/linux/audit.h639
-rw-r--r--include/linux/auto_fs.h68
-rw-r--r--include/linux/auxvec.h33
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h2
-rw-r--r--include/linux/binfmts.h28
-rw-r--r--include/linux/bio.h70
-rw-r--r--include/linux/blk_types.h36
-rw-r--r--include/linux/blkdev.h82
-rw-r--r--include/linux/blktrace_api.h142
-rw-r--r--include/linux/bsg.h63
-rw-r--r--include/linux/byteorder/Kbuild2
-rw-r--r--include/linux/byteorder/big_endian.h103
-rw-r--r--include/linux/byteorder/little_endian.h103
-rw-r--r--include/linux/caif/Kbuild2
-rw-r--r--include/linux/can/Kbuild5
-rw-r--r--include/linux/capability.h346
-rw-r--r--include/linux/cciss_ioctl.h86
-rw-r--r--include/linux/cdrom.h902
-rw-r--r--include/linux/ceph/mon_client.h1
-rw-r--r--include/linux/ceph/osd_client.h2
-rw-r--r--include/linux/ceph/osdmap.h6
-rw-r--r--include/linux/clocksource.h16
-rw-r--r--include/linux/cm4000_cs.h60
-rw-r--r--include/linux/cn_proc.h103
-rw-r--r--include/linux/coda.h680
-rw-r--r--include/linux/coda_psdev.h26
-rw-r--r--include/linux/compaction.h19
-rw-r--r--include/linux/compat.h13
-rw-r--r--include/linux/compiler-gcc4.h2
-rw-r--r--include/linux/connector.h56
-rw-r--r--include/linux/console.h10
-rw-r--r--include/linux/coredump.h6
-rw-r--r--include/linux/cpu_cooling.h58
-rw-r--r--include/linux/cramfs_fs.h86
-rw-r--r--include/linux/cuda.h25
-rw-r--r--include/linux/cyclades.h426
-rw-r--r--include/linux/dccp.h236
-rw-r--r--include/linux/dlm.h62
-rw-r--r--include/linux/dlm_plock.h37
-rw-r--r--include/linux/dmaengine.h7
-rw-r--r--include/linux/dvb/Kbuild8
-rw-r--r--include/linux/dvb/dmx.h130
-rw-r--r--include/linux/dvb/video.h249
-rw-r--r--include/linux/dw_dmac.h7
-rw-r--r--include/linux/dynamic_debug.h2
-rw-r--r--include/linux/edd.h158
-rw-r--r--include/linux/edma.h29
-rw-r--r--include/linux/elf-fdpic.h23
-rw-r--r--include/linux/elf.h408
-rw-r--r--include/linux/elfcore.h102
-rw-r--r--include/linux/errno.h5
-rw-r--r--include/linux/errqueue.h25
-rw-r--r--include/linux/ethtool.h1076
-rw-r--r--include/linux/eventpoll.h52
-rw-r--r--include/linux/extcon.h2
-rw-r--r--include/linux/falloc.h6
-rw-r--r--include/linux/fanotify.h114
-rw-r--r--include/linux/fb.h403
-rw-r--r--include/linux/fcntl.h50
-rw-r--r--include/linux/fd.h380
-rw-r--r--include/linux/filter.h133
-rw-r--r--include/linux/flat.h50
-rw-r--r--include/linux/fs.h484
-rw-r--r--include/linux/fsl_hypervisor.h180
-rw-r--r--include/linux/fsnotify.h8
-rw-r--r--include/linux/futex.h150
-rw-r--r--include/linux/gameport.h26
-rw-r--r--include/linux/genalloc.h27
-rw-r--r--include/linux/genetlink.h82
-rw-r--r--include/linux/gfp.h9
-rw-r--r--include/linux/hdlc.h13
-rw-r--r--include/linux/hdlcdrv.h104
-rw-r--r--include/linux/hid.h46
-rw-r--r--include/linux/hiddev.h190
-rw-r--r--include/linux/hidraw.h40
-rw-r--r--include/linux/hpet.h23
-rw-r--r--include/linux/hsi/Kbuild1
-rw-r--r--include/linux/huge_mm.h3
-rw-r--r--include/linux/i2c-algo-pca.h1
-rw-r--r--include/linux/i2c-dev.h49
-rw-r--r--include/linux/i2c-mux-gpio.h5
-rw-r--r--include/linux/i2c-mux.h1
-rw-r--r--include/linux/i2c-omap.h1
-rw-r--r--include/linux/i2c.h127
-rw-r--r--include/linux/i2c/i2c-rcar.h10
-rw-r--r--include/linux/i2c/pca954x.h1
-rw-r--r--include/linux/i2c/twl.h3
-rw-r--r--include/linux/icmp.h80
-rw-r--r--include/linux/icmpv6.h165
-rw-r--r--include/linux/idr.h10
-rw-r--r--include/linux/if_arp.h136
-rw-r--r--include/linux/if_bridge.h89
-rw-r--r--include/linux/if_eql.h36
-rw-r--r--include/linux/if_ether.h115
-rw-r--r--include/linux/if_fddi.h80
-rw-r--r--include/linux/if_frad.h98
-rw-r--r--include/linux/if_link.h421
-rw-r--r--include/linux/if_ltalk.h7
-rw-r--r--include/linux/if_phonet.h7
-rw-r--r--include/linux/if_pppol2tp.h89
-rw-r--r--include/linux/if_pppox.h143
-rw-r--r--include/linux/if_team.h97
-rw-r--r--include/linux/if_tun.h78
-rw-r--r--include/linux/if_tunnel.h94
-rw-r--r--include/linux/if_vlan.h59
-rw-r--r--include/linux/igmp.h113
-rw-r--r--include/linux/iio/iio.h16
-rw-r--r--include/linux/in.h235
-rw-r--r--include/linux/in6.h258
-rw-r--r--include/linux/inet_diag.h134
-rw-r--r--include/linux/init.h27
-rw-r--r--include/linux/inotify.h69
-rw-r--r--include/linux/input.h1161
-rw-r--r--include/linux/interval_tree.h27
-rw-r--r--include/linux/interval_tree_generic.h191
-rw-r--r--include/linux/ioport.h3
-rw-r--r--include/linux/ip.h119
-rw-r--r--include/linux/ipc.h80
-rw-r--r--include/linux/ipmi.h422
-rw-r--r--include/linux/ipv6.h166
-rw-r--r--include/linux/ipv6_route.h45
-rw-r--r--include/linux/irqnr.h8
-rw-r--r--include/linux/isdn.h130
-rw-r--r--include/linux/isdn/Kbuild1
-rw-r--r--include/linux/isdn_divertif.h18
-rw-r--r--include/linux/isdn_ppp.h55
-rw-r--r--include/linux/isdnif.h43
-rw-r--r--include/linux/jiffies.h20
-rw-r--r--include/linux/joystick.h114
-rw-r--r--include/linux/kd.h181
-rw-r--r--include/linux/kdev_t.h14
-rw-r--r--include/linux/kernel-page-flags.h34
-rw-r--r--include/linux/kernel.h12
-rw-r--r--include/linux/kernelcapi.h38
-rw-r--r--include/linux/kexec.h52
-rw-r--r--include/linux/key-type.h35
-rw-r--r--include/linux/keyboard.h441
-rw-r--r--include/linux/kvm_para.h26
-rw-r--r--include/linux/l2tp.h172
-rw-r--r--include/linux/leds-lp5523.h1
-rw-r--r--include/linux/leds.h4
-rw-r--r--include/linux/lglock.h19
-rw-r--r--include/linux/libfdt.h4
-rw-r--r--include/linux/llc.h74
-rw-r--r--include/linux/loop.h91
-rw-r--r--include/linux/lp.h97
-rw-r--r--include/linux/mdio.h287
-rw-r--r--include/linux/memblock.h4
-rw-r--r--include/linux/memcontrol.h18
-rw-r--r--include/linux/memory_hotplug.h3
-rw-r--r--include/linux/mempolicy.h67
-rw-r--r--include/linux/mfd/88pm860x.h132
-rw-r--r--include/linux/mfd/ab3100.h129
-rw-r--r--include/linux/mfd/abx500.h117
-rw-r--r--include/linux/mfd/abx500/ab8500.h2
-rw-r--r--include/linux/mfd/anatop.h40
-rw-r--r--include/linux/mfd/da9055/core.h94
-rw-r--r--include/linux/mfd/da9055/pdata.h32
-rw-r--r--include/linux/mfd/da9055/reg.h699
-rw-r--r--include/linux/mfd/lp8788-isink.h52
-rw-r--r--include/linux/mfd/lp8788.h364
-rw-r--r--include/linux/mfd/lpc_ich.h1
-rw-r--r--include/linux/mfd/max77693.h13
-rw-r--r--include/linux/mfd/max8907.h252
-rw-r--r--include/linux/mfd/max8925.h26
-rw-r--r--include/linux/mfd/palmas.h232
-rw-r--r--include/linux/mfd/rc5t583.h22
-rw-r--r--include/linux/mfd/smsc.h109
-rw-r--r--include/linux/mfd/syscon.h23
-rw-r--r--include/linux/mfd/syscon/imx6q-iomuxc-gpr.h319
-rw-r--r--include/linux/mfd/tc3589x.h1
-rw-r--r--include/linux/mfd/tps65217.h18
-rw-r--r--include/linux/mfd/tps6586x.h1
-rw-r--r--include/linux/mfd/tps65910.h13
-rw-r--r--include/linux/mfd/twl6040.h11
-rw-r--r--include/linux/mfd/wm8994/pdata.h4
-rw-r--r--include/linux/mii.h154
-rw-r--r--include/linux/mm.h140
-rw-r--r--include/linux/mm_types.h16
-rw-r--r--include/linux/mman.h13
-rw-r--r--include/linux/mmc/Kbuild1
-rw-r--r--include/linux/mmc/card.h18
-rw-r--r--include/linux/mmc/core.h4
-rw-r--r--include/linux/mmc/dw_mmc.h15
-rw-r--r--include/linux/mmc/host.h5
-rw-r--r--include/linux/mmc/mmc.h19
-rw-r--r--include/linux/mmc/sdhci.h3
-rw-r--r--include/linux/mmu_notifier.h60
-rw-r--r--include/linux/mmzone.h10
-rw-r--r--include/linux/module.h8
-rw-r--r--include/linux/moduleloader.h36
-rw-r--r--include/linux/mpi.h1
-rw-r--r--include/linux/mroute.h146
-rw-r--r--include/linux/mroute6.h138
-rw-r--r--include/linux/msdos_fs.h165
-rw-r--r--include/linux/msg.h74
-rw-r--r--include/linux/mtd/bbm.h7
-rw-r--r--include/linux/mtd/lpc32xx_mlc.h20
-rw-r--r--include/linux/mtd/lpc32xx_slc.h20
-rw-r--r--include/linux/mtd/mtd.h9
-rw-r--r--include/linux/mtd/nand.h72
-rw-r--r--include/linux/mtd/sh_flctl.h23
-rw-r--r--include/linux/n_r3964.h56
-rw-r--r--include/linux/nbd.h58
-rw-r--r--include/linux/net.h39
-rw-r--r--include/linux/netdevice.h51
-rw-r--r--include/linux/netfilter.h72
-rw-r--r--include/linux/netfilter/Kbuild78
-rw-r--r--include/linux/netfilter/ipset/Kbuild4
-rw-r--r--include/linux/netfilter/ipset/ip_set.h225
-rw-r--r--include/linux/netfilter/ipset/ip_set_bitmap.h11
-rw-r--r--include/linux/netfilter/ipset/ip_set_hash.h19
-rw-r--r--include/linux/netfilter/ipset/ip_set_list.h19
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h115
-rw-r--r--include/linux/netfilter/nf_conntrack_ftp.h16
-rw-r--r--include/linux/netfilter/nf_conntrack_tcp.h49
-rw-r--r--include/linux/netfilter/nfnetlink.h55
-rw-r--r--include/linux/netfilter/nfnetlink_acct.h25
-rw-r--r--include/linux/netfilter/x_tables.h186
-rw-r--r--include/linux/netfilter/xt_hashlimit.h71
-rw-r--r--include/linux/netfilter/xt_physdev.h21
-rw-r--r--include/linux/netfilter_arp/Kbuild2
-rw-r--r--include/linux/netfilter_arp/arp_tables.h200
-rw-r--r--include/linux/netfilter_bridge.h27
-rw-r--r--include/linux/netfilter_bridge/Kbuild18
-rw-r--r--include/linux/netfilter_bridge/ebt_802_3.h61
-rw-r--r--include/linux/netfilter_bridge/ebtables.h255
-rw-r--r--include/linux/netfilter_ipv4.h80
-rw-r--r--include/linux/netfilter_ipv4/Kbuild10
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h218
-rw-r--r--include/linux/netfilter_ipv6.h75
-rw-r--r--include/linux/netfilter_ipv6/Kbuild12
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h256
-rw-r--r--include/linux/netlink.h170
-rw-r--r--include/linux/nfs.h124
-rw-r--r--include/linux/nfs3.h92
-rw-r--r--include/linux/nfs4.h166
-rw-r--r--include/linux/nfs_fs.h65
-rw-r--r--include/linux/nfs_fs_sb.h3
-rw-r--r--include/linux/nfs_idmap.h28
-rw-r--r--include/linux/nfs_xdr.h5
-rw-r--r--include/linux/nfsacl.h23
-rw-r--r--include/linux/nfsd/Kbuild5
-rw-r--r--include/linux/nfsd/debug.h31
-rw-r--r--include/linux/nfsd/export.h52
-rw-r--r--include/linux/nfsd/nfsfh.h111
-rw-r--r--include/linux/nfsd/stats.h8
-rw-r--r--include/linux/nubus.h234
-rw-r--r--include/linux/nvram.h14
-rw-r--r--include/linux/of.h13
-rw-r--r--include/linux/of_address.h4
-rw-r--r--include/linux/of_irq.h4
-rw-r--r--include/linux/of_mdio.h20
-rw-r--r--include/linux/oid_registry.h92
-rw-r--r--include/linux/omapfb.h198
-rw-r--r--include/linux/oom.h21
-rw-r--r--include/linux/page-isolation.h7
-rw-r--r--include/linux/pageblock-flags.h19
-rw-r--r--include/linux/parport.h89
-rw-r--r--include/linux/patchkey.h24
-rw-r--r--include/linux/pci.h25
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/percpu-rwsem.h83
-rw-r--r--include/linux/percpu.h2
-rw-r--r--include/linux/perf_event.h612
-rw-r--r--include/linux/personality.h71
-rw-r--r--include/linux/phonet.h162
-rw-r--r--include/linux/pid_namespace.h8
-rw-r--r--include/linux/pktcdvd.h99
-rw-r--r--include/linux/platform_data/asoc-mx27vis.h11
-rw-r--r--include/linux/platform_data/asoc-ti-mcbsp.h2
-rw-r--r--include/linux/platform_data/davinci_asp.h105
-rw-r--r--include/linux/platform_data/exynos_thermal.h (renamed from include/linux/platform_data/exynos4_tmu.h)47
-rw-r--r--include/linux/platform_data/i2c-nomadik.h2
-rw-r--r--include/linux/platform_data/leds-lm3556.h50
-rw-r--r--include/linux/platform_data/leds-lm355x.h66
-rw-r--r--include/linux/platform_data/leds-lm3642.h38
-rw-r--r--include/linux/platform_data/leds-pca9633.h35
-rw-r--r--include/linux/platform_data/lm3630_bl.h57
-rw-r--r--include/linux/platform_data/lm3639_bl.h69
-rw-r--r--include/linux/platform_data/lp855x.h2
-rw-r--r--include/linux/platform_data/lp8727.h51
-rw-r--r--include/linux/platform_data/mipi-csis.h30
-rw-r--r--include/linux/platform_data/mmp_dma.h19
-rw-r--r--include/linux/platform_data/omap-twl4030.h32
-rw-r--r--include/linux/platform_data/pxa_sdhci.h1
-rw-r--r--include/linux/pmu.h130
-rw-r--r--include/linux/pnfs_osd_xdr.h1
-rw-r--r--include/linux/poll.h6
-rw-r--r--include/linux/power/charger-manager.h47
-rw-r--r--include/linux/power_supply.h5
-rw-r--r--include/linux/ppp-comp.h84
-rw-r--r--include/linux/ppp_defs.h141
-rw-r--r--include/linux/prio_tree.h120
-rw-r--r--include/linux/pstore.h8
-rw-r--r--include/linux/ptrace.h92
-rw-r--r--include/linux/pwm.h108
-rw-r--r--include/linux/quota.h139
-rw-r--r--include/linux/random.h43
-rw-r--r--include/linux/ratelimit.h27
-rw-r--r--include/linux/rbtree.h119
-rw-r--r--include/linux/rbtree_augmented.h224
-rw-r--r--include/linux/reboot.h38
-rw-r--r--include/linux/resource.h78
-rw-r--r--include/linux/rfkill.h92
-rw-r--r--include/linux/rio.h22
-rw-r--r--include/linux/rio_drv.h5
-rw-r--r--include/linux/rmap.h36
-rw-r--r--include/linux/rtc-ds2404.h20
-rw-r--r--include/linux/rtc.h98
-rw-r--r--include/linux/rtnetlink.h611
-rw-r--r--include/linux/scatterlist.h1
-rw-r--r--include/linux/scc.h169
-rw-r--r--include/linux/sched.h49
-rw-r--r--include/linux/screen_info.h72
-rw-r--r--include/linux/sdla.h93
-rw-r--r--include/linux/seccomp.h45
-rw-r--r--include/linux/securebits.h51
-rw-r--r--include/linux/security.h12
-rw-r--r--include/linux/sem.h79
-rw-r--r--include/linux/serial.h119
-rw-r--r--include/linux/serial_core.h199
-rw-r--r--include/linux/serio.h76
-rw-r--r--include/linux/shm.h81
-rw-r--r--include/linux/signal.h7
-rw-r--r--include/linux/signalfd.h44
-rw-r--r--include/linux/skbuff.h24
-rw-r--r--include/linux/slab.h6
-rw-r--r--include/linux/slab_def.h27
-rw-r--r--include/linux/slob_def.h6
-rw-r--r--include/linux/sock_diag.h24
-rw-r--r--include/linux/socket.h20
-rw-r--r--include/linux/sonet.h58
-rw-r--r--include/linux/sonypi.h110
-rw-r--r--include/linux/sound.h29
-rw-r--r--include/linux/soundcard.h1261
-rw-r--r--include/linux/spi/Kbuild1
-rw-r--r--include/linux/spi/tsc2005.h2
-rw-r--r--include/linux/stat.h46
-rw-r--r--include/linux/stddef.h5
-rw-r--r--include/linux/string.h7
-rw-r--r--include/linux/sunrpc/Kbuild1
-rw-r--r--include/linux/sunrpc/clnt.h2
-rw-r--r--include/linux/sunrpc/debug.h39
-rw-r--r--include/linux/sunrpc/svc_xprt.h5
-rw-r--r--include/linux/sunrpc/svcsock.h3
-rw-r--r--include/linux/sunrpc/xprt.h3
-rw-r--r--include/linux/swab.h280
-rw-r--r--include/linux/swap.h2
-rw-r--r--include/linux/synclink.h288
-rw-r--r--include/linux/syscalls.h8
-rw-r--r--include/linux/sysctl.h911
-rw-r--r--include/linux/tc_act/Kbuild7
-rw-r--r--include/linux/tc_ematch/Kbuild4
-rw-r--r--include/linux/tcp.h211
-rw-r--r--include/linux/thermal.h28
-rw-r--r--include/linux/time.h72
-rw-r--r--include/linux/timekeeper_internal.h108
-rw-r--r--include/linux/timerqueue.h2
-rw-r--r--include/linux/timex.h113
-rw-r--r--include/linux/toshiba.h17
-rw-r--r--include/linux/tty.h37
-rw-r--r--include/linux/types.h50
-rw-r--r--include/linux/udp.h22
-rw-r--r--include/linux/uinput.h109
-rw-r--r--include/linux/uio.h24
-rw-r--r--include/linux/uprobes.h11
-rw-r--r--include/linux/usb.h11
-rw-r--r--include/linux/usb/Kbuild10
-rw-r--r--include/linux/usb/audio.h524
-rw-r--r--include/linux/usb/ch9.h960
-rw-r--r--include/linux/usb/functionfs.h167
-rw-r--r--include/linux/usb/usbnet.h2
-rw-r--r--include/linux/usbdevice_fs.h151
-rw-r--r--include/linux/utsname.h33
-rw-r--r--include/linux/uuid.h37
-rw-r--r--include/linux/vfio.h357
-rw-r--r--include/linux/videodev2.h2603
-rw-r--r--include/linux/virtio.h2
-rw-r--r--include/linux/virtio_config.h76
-rw-r--r--include/linux/virtio_console.h45
-rw-r--r--include/linux/virtio_ring.h166
-rw-r--r--include/linux/virtio_scsi.h2
-rw-r--r--include/linux/vm_event_item.h1
-rw-r--r--include/linux/vmstat.h12
-rw-r--r--include/linux/vt.h88
-rw-r--r--include/linux/wait.h20
-rw-r--r--include/linux/wanrouter.h405
-rw-r--r--include/linux/watchdog.h49
-rw-r--r--include/linux/wimax/Kbuild1
-rw-r--r--include/linux/wireless.h1120
-rw-r--r--include/linux/xattr.h54
-rw-r--r--include/media/ad9389b.h49
-rw-r--r--include/media/adv7604.h153
-rw-r--r--include/media/davinci/vpbe.h14
-rw-r--r--include/media/davinci/vpbe_types.h8
-rw-r--r--include/media/davinci/vpbe_venc.h2
-rw-r--r--include/media/davinci/vpif_types.h26
-rw-r--r--include/media/ir-rx51.h10
-rw-r--r--include/media/mt9v032.h3
-rw-r--r--include/media/omap3isp.h14
-rw-r--r--include/media/s5k4ecgx.h37
-rw-r--r--include/media/s5p_fimc.h20
-rw-r--r--include/media/s5p_hdmi.h2
-rw-r--r--include/media/saa7146.h4
-rw-r--r--include/media/soc_camera.h16
-rw-r--r--include/media/v4l2-chip-ident.h6
-rw-r--r--include/media/v4l2-common.h17
-rw-r--r--include/media/v4l2-ctrls.h66
-rw-r--r--include/media/v4l2-dev.h12
-rw-r--r--include/media/v4l2-event.h4
-rw-r--r--include/media/v4l2-ioctl.h26
-rw-r--r--include/media/v4l2-mem2mem.h4
-rw-r--r--include/media/v4l2-subdev.h56
-rw-r--r--include/media/videobuf-dvb.h4
-rw-r--r--include/media/videobuf2-core.h2
-rw-r--r--include/mtd/Kbuild5
-rw-r--r--include/net/cfg80211.h1
-rw-r--r--include/net/flow.h1
-rw-r--r--include/net/ip_fib.h1
-rw-r--r--include/net/net_namespace.h2
-rw-r--r--include/net/route.h3
-rw-r--r--include/net/sctp/structs.h2
-rw-r--r--include/rdma/rdma_netlink.h1
-rw-r--r--include/scsi/fc/fc_fcp.h6
-rw-r--r--include/scsi/libfcoe.h2
-rw-r--r--include/scsi/scsi_cmnd.h12
-rw-r--r--include/sound/ac97_codec.h3
-rw-r--r--include/sound/ad1816a.h9
-rw-r--r--include/sound/asound.h39
-rw-r--r--include/sound/compress_driver.h1
-rw-r--r--include/sound/compress_params.h1
-rw-r--r--include/sound/da9055.h33
-rw-r--r--include/sound/emu10k1.h4
-rw-r--r--include/sound/initval.h14
-rw-r--r--include/sound/memalloc.h27
-rw-r--r--include/sound/pcm.h87
-rw-r--r--include/sound/soc-dai.h3
-rw-r--r--include/sound/soc-dapm.h10
-rw-r--r--include/sound/soc.h20
-rw-r--r--include/sound/tea575x-tuner.h4
-rw-r--r--include/sound/tegra_wm8903.h26
-rw-r--r--include/sound/tlv.h8
-rw-r--r--include/sound/version.h3
-rw-r--r--include/sound/wm0010.h27
-rw-r--r--include/sound/wm8960.h2
-rw-r--r--include/sound/wm8993.h4
-rw-r--r--include/target/target_core_backend.h3
-rw-r--r--include/target/target_core_fabric.h5
-rw-r--r--include/trace/events/btrfs.h14
-rw-r--r--include/trace/events/ext4.h242
-rw-r--r--include/trace/events/gfpflags.h1
-rw-r--r--include/uapi/asm-generic/Kbuild35
-rw-r--r--include/uapi/asm-generic/auxvec.h (renamed from include/asm-generic/auxvec.h)0
-rw-r--r--include/uapi/asm-generic/bitsperlong.h15
-rw-r--r--include/uapi/asm-generic/errno-base.h (renamed from include/asm-generic/errno-base.h)0
-rw-r--r--include/uapi/asm-generic/errno.h (renamed from include/asm-generic/errno.h)0
-rw-r--r--include/uapi/asm-generic/fcntl.h (renamed from include/asm-generic/fcntl.h)0
-rw-r--r--include/uapi/asm-generic/int-l64.h34
-rw-r--r--include/uapi/asm-generic/int-ll64.h39
-rw-r--r--include/uapi/asm-generic/ioctl.h98
-rw-r--r--include/uapi/asm-generic/ioctls.h (renamed from include/asm-generic/ioctls.h)0
-rw-r--r--include/uapi/asm-generic/ipcbuf.h (renamed from include/asm-generic/ipcbuf.h)0
-rw-r--r--include/uapi/asm-generic/kvm_para.h4
-rw-r--r--include/uapi/asm-generic/mman-common.h (renamed from include/asm-generic/mman-common.h)0
-rw-r--r--include/uapi/asm-generic/mman.h (renamed from include/asm-generic/mman.h)0
-rw-r--r--include/uapi/asm-generic/msgbuf.h (renamed from include/asm-generic/msgbuf.h)0
-rw-r--r--include/uapi/asm-generic/param.h19
-rw-r--r--include/uapi/asm-generic/poll.h (renamed from include/asm-generic/poll.h)0
-rw-r--r--include/uapi/asm-generic/posix_types.h (renamed from include/asm-generic/posix_types.h)0
-rw-r--r--include/uapi/asm-generic/resource.h68
-rw-r--r--include/uapi/asm-generic/sembuf.h (renamed from include/asm-generic/sembuf.h)0
-rw-r--r--include/uapi/asm-generic/setup.h (renamed from include/asm-generic/setup.h)0
-rw-r--r--include/uapi/asm-generic/shmbuf.h (renamed from include/asm-generic/shmbuf.h)0
-rw-r--r--include/uapi/asm-generic/shmparam.h (renamed from include/asm-generic/shmparam.h)0
-rw-r--r--include/uapi/asm-generic/siginfo.h298
-rw-r--r--include/uapi/asm-generic/signal-defs.h (renamed from include/asm-generic/signal-defs.h)0
-rw-r--r--include/uapi/asm-generic/signal.h123
-rw-r--r--include/uapi/asm-generic/socket.h (renamed from include/asm-generic/socket.h)0
-rw-r--r--include/uapi/asm-generic/sockios.h (renamed from include/asm-generic/sockios.h)0
-rw-r--r--include/uapi/asm-generic/stat.h (renamed from include/asm-generic/stat.h)0
-rw-r--r--include/uapi/asm-generic/statfs.h83
-rw-r--r--include/uapi/asm-generic/swab.h (renamed from include/asm-generic/swab.h)0
-rw-r--r--include/uapi/asm-generic/termbits.h (renamed from include/asm-generic/termbits.h)0
-rw-r--r--include/uapi/asm-generic/termios.h50
-rw-r--r--include/uapi/asm-generic/types.h (renamed from include/asm-generic/types.h)0
-rw-r--r--include/uapi/asm-generic/ucontext.h (renamed from include/asm-generic/ucontext.h)0
-rw-r--r--include/uapi/asm-generic/unistd.h902
-rw-r--r--include/uapi/drm/Kbuild15
-rw-r--r--include/uapi/drm/drm.h (renamed from include/drm/drm.h)0
-rw-r--r--include/uapi/drm/drm_fourcc.h (renamed from include/drm/drm_fourcc.h)0
-rw-r--r--include/uapi/drm/drm_mode.h (renamed from include/drm/drm_mode.h)0
-rw-r--r--include/uapi/drm/drm_sarea.h (renamed from include/drm/drm_sarea.h)0
-rw-r--r--include/uapi/drm/exynos_drm.h203
-rw-r--r--include/uapi/drm/i810_drm.h (renamed from include/drm/i810_drm.h)0
-rw-r--r--include/uapi/drm/i915_drm.h947
-rw-r--r--include/uapi/drm/mga_drm.h (renamed from include/drm/mga_drm.h)0
-rw-r--r--include/uapi/drm/nouveau_drm.h (renamed from include/drm/nouveau_drm.h)0
-rw-r--r--include/uapi/drm/r128_drm.h (renamed from include/drm/r128_drm.h)0
-rw-r--r--include/uapi/drm/radeon_drm.h (renamed from include/drm/radeon_drm.h)0
-rw-r--r--include/uapi/drm/savage_drm.h (renamed from include/drm/savage_drm.h)0
-rw-r--r--include/uapi/drm/sis_drm.h (renamed from include/drm/sis_drm.h)0
-rw-r--r--include/uapi/drm/via_drm.h (renamed from include/drm/via_drm.h)0
-rw-r--r--include/uapi/drm/vmwgfx_drm.h (renamed from include/drm/vmwgfx_drm.h)0
-rw-r--r--include/uapi/linux/Kbuild393
-rw-r--r--include/uapi/linux/a.out.h274
-rw-r--r--include/uapi/linux/acct.h122
-rw-r--r--include/uapi/linux/adb.h44
-rw-r--r--include/uapi/linux/adfs_fs.h44
-rw-r--r--include/uapi/linux/affs_hardblocks.h (renamed from include/linux/affs_hardblocks.h)0
-rw-r--r--include/uapi/linux/agpgart.h113
-rw-r--r--include/uapi/linux/aio_abi.h (renamed from include/linux/aio_abi.h)0
-rw-r--r--include/uapi/linux/apm_bios.h135
-rw-r--r--include/uapi/linux/arcfb.h (renamed from include/linux/arcfb.h)0
-rw-r--r--include/uapi/linux/atalk.h44
-rw-r--r--include/uapi/linux/atm.h241
-rw-r--r--include/uapi/linux/atm_eni.h (renamed from include/linux/atm_eni.h)0
-rw-r--r--include/uapi/linux/atm_he.h (renamed from include/linux/atm_he.h)0
-rw-r--r--include/uapi/linux/atm_idt77105.h (renamed from include/linux/atm_idt77105.h)0
-rw-r--r--include/uapi/linux/atm_nicstar.h (renamed from include/linux/atm_nicstar.h)0
-rw-r--r--include/uapi/linux/atm_tcp.h61
-rw-r--r--include/uapi/linux/atm_zatm.h (renamed from include/linux/atm_zatm.h)0
-rw-r--r--include/uapi/linux/atmapi.h (renamed from include/linux/atmapi.h)0
-rw-r--r--include/uapi/linux/atmarp.h (renamed from include/linux/atmarp.h)0
-rw-r--r--include/uapi/linux/atmbr2684.h (renamed from include/linux/atmbr2684.h)0
-rw-r--r--include/uapi/linux/atmclip.h (renamed from include/linux/atmclip.h)0
-rw-r--r--include/uapi/linux/atmdev.h215
-rw-r--r--include/uapi/linux/atmioc.h (renamed from include/linux/atmioc.h)0
-rw-r--r--include/uapi/linux/atmlec.h (renamed from include/linux/atmlec.h)0
-rw-r--r--include/uapi/linux/atmmpc.h (renamed from include/linux/atmmpc.h)0
-rw-r--r--include/uapi/linux/atmppp.h (renamed from include/linux/atmppp.h)0
-rw-r--r--include/uapi/linux/atmsap.h (renamed from include/linux/atmsap.h)0
-rw-r--r--include/uapi/linux/atmsvc.h (renamed from include/linux/atmsvc.h)0
-rw-r--r--include/uapi/linux/audit.h404
-rw-r--r--include/uapi/linux/auto_fs.h83
-rw-r--r--include/uapi/linux/auto_fs4.h (renamed from include/linux/auto_fs4.h)0
-rw-r--r--include/uapi/linux/auxvec.h35
-rw-r--r--include/uapi/linux/ax25.h (renamed from include/linux/ax25.h)0
-rw-r--r--include/uapi/linux/b1lli.h (renamed from include/linux/b1lli.h)0
-rw-r--r--include/uapi/linux/baycom.h (renamed from include/linux/baycom.h)0
-rw-r--r--include/uapi/linux/bfs_fs.h (renamed from include/linux/bfs_fs.h)0
-rw-r--r--include/uapi/linux/binfmts.h20
-rw-r--r--include/uapi/linux/blkpg.h (renamed from include/linux/blkpg.h)0
-rw-r--r--include/uapi/linux/blktrace_api.h142
-rw-r--r--include/uapi/linux/bpqether.h (renamed from include/linux/bpqether.h)0
-rw-r--r--include/uapi/linux/bsg.h65
-rw-r--r--include/uapi/linux/byteorder/Kbuild2
-rw-r--r--include/uapi/linux/byteorder/big_endian.h105
-rw-r--r--include/uapi/linux/byteorder/little_endian.h105
-rw-r--r--include/uapi/linux/caif/Kbuild2
-rw-r--r--include/uapi/linux/caif/caif_socket.h (renamed from include/linux/caif/caif_socket.h)0
-rw-r--r--include/uapi/linux/caif/if_caif.h (renamed from include/linux/caif/if_caif.h)0
-rw-r--r--include/uapi/linux/can.h (renamed from include/linux/can.h)0
-rw-r--r--include/uapi/linux/can/Kbuild5
-rw-r--r--include/uapi/linux/can/bcm.h (renamed from include/linux/can/bcm.h)0
-rw-r--r--include/uapi/linux/can/error.h (renamed from include/linux/can/error.h)0
-rw-r--r--include/uapi/linux/can/gw.h (renamed from include/linux/can/gw.h)0
-rw-r--r--include/uapi/linux/can/netlink.h (renamed from include/linux/can/netlink.h)0
-rw-r--r--include/uapi/linux/can/raw.h (renamed from include/linux/can/raw.h)0
-rw-r--r--include/uapi/linux/capability.h358
-rw-r--r--include/uapi/linux/capi.h (renamed from include/linux/capi.h)0
-rw-r--r--include/uapi/linux/cciss_defs.h (renamed from include/linux/cciss_defs.h)0
-rw-r--r--include/uapi/linux/cciss_ioctl.h88
-rw-r--r--include/uapi/linux/cdrom.h912
-rw-r--r--include/uapi/linux/cgroupstats.h (renamed from include/linux/cgroupstats.h)0
-rw-r--r--include/uapi/linux/chio.h (renamed from include/linux/chio.h)0
-rw-r--r--include/uapi/linux/cm4000_cs.h62
-rw-r--r--include/uapi/linux/cn_proc.h121
-rw-r--r--include/uapi/linux/coda.h741
-rw-r--r--include/uapi/linux/coda_psdev.h27
-rw-r--r--include/uapi/linux/coff.h (renamed from include/linux/coff.h)0
-rw-r--r--include/uapi/linux/connector.h77
-rw-r--r--include/uapi/linux/const.h (renamed from include/linux/const.h)0
-rw-r--r--include/uapi/linux/cramfs_fs.h88
-rw-r--r--include/uapi/linux/cuda.h33
-rw-r--r--include/uapi/linux/cyclades.h493
-rw-r--r--include/uapi/linux/cycx_cfm.h (renamed from include/linux/cycx_cfm.h)0
-rw-r--r--include/uapi/linux/dcbnl.h (renamed from include/linux/dcbnl.h)0
-rw-r--r--include/uapi/linux/dccp.h237
-rw-r--r--include/uapi/linux/dlm.h75
-rw-r--r--include/uapi/linux/dlm_device.h (renamed from include/linux/dlm_device.h)0
-rw-r--r--include/uapi/linux/dlm_netlink.h (renamed from include/linux/dlm_netlink.h)0
-rw-r--r--include/uapi/linux/dlm_plock.h45
-rw-r--r--include/uapi/linux/dlmconstants.h (renamed from include/linux/dlmconstants.h)0
-rw-r--r--include/uapi/linux/dm-ioctl.h (renamed from include/linux/dm-ioctl.h)0
-rw-r--r--include/uapi/linux/dm-log-userspace.h (renamed from include/linux/dm-log-userspace.h)0
-rw-r--r--include/uapi/linux/dn.h (renamed from include/linux/dn.h)0
-rw-r--r--include/uapi/linux/dqblk_xfs.h (renamed from include/linux/dqblk_xfs.h)0
-rw-r--r--include/uapi/linux/dvb/Kbuild8
-rw-r--r--include/uapi/linux/dvb/audio.h (renamed from include/linux/dvb/audio.h)0
-rw-r--r--include/uapi/linux/dvb/ca.h (renamed from include/linux/dvb/ca.h)0
-rw-r--r--include/uapi/linux/dvb/dmx.h155
-rw-r--r--include/uapi/linux/dvb/frontend.h (renamed from include/linux/dvb/frontend.h)61
-rw-r--r--include/uapi/linux/dvb/net.h (renamed from include/linux/dvb/net.h)0
-rw-r--r--include/uapi/linux/dvb/osd.h (renamed from include/linux/dvb/osd.h)0
-rw-r--r--include/uapi/linux/dvb/version.h (renamed from include/linux/dvb/version.h)2
-rw-r--r--include/uapi/linux/dvb/video.h274
-rw-r--r--include/uapi/linux/edd.h191
-rw-r--r--include/uapi/linux/efs_fs_sb.h (renamed from include/linux/efs_fs_sb.h)0
-rw-r--r--include/uapi/linux/elf-em.h (renamed from include/linux/elf-em.h)0
-rw-r--r--include/uapi/linux/elf-fdpic.h34
-rw-r--r--include/uapi/linux/elf.h414
-rw-r--r--include/uapi/linux/elfcore.h100
-rw-r--r--include/uapi/linux/errno.h1
-rw-r--r--include/uapi/linux/errqueue.h26
-rw-r--r--include/uapi/linux/ethtool.h1085
-rw-r--r--include/uapi/linux/eventpoll.h66
-rw-r--r--include/uapi/linux/fadvise.h (renamed from include/linux/fadvise.h)0
-rw-r--r--include/uapi/linux/falloc.h9
-rw-r--r--include/uapi/linux/fanotify.h116
-rw-r--r--include/uapi/linux/fb.h402
-rw-r--r--include/uapi/linux/fcntl.h52
-rw-r--r--include/uapi/linux/fd.h382
-rw-r--r--include/uapi/linux/fdreg.h (renamed from include/linux/fdreg.h)0
-rw-r--r--include/uapi/linux/fib_rules.h (renamed from include/linux/fib_rules.h)0
-rw-r--r--include/uapi/linux/fiemap.h (renamed from include/linux/fiemap.h)0
-rw-r--r--include/uapi/linux/filter.h135
-rw-r--r--include/uapi/linux/firewire-cdev.h (renamed from include/linux/firewire-cdev.h)0
-rw-r--r--include/uapi/linux/firewire-constants.h (renamed from include/linux/firewire-constants.h)0
-rw-r--r--include/uapi/linux/flat.h58
-rw-r--r--include/uapi/linux/fs.h202
-rw-r--r--include/uapi/linux/fsl_hypervisor.h220
-rw-r--r--include/uapi/linux/fuse.h (renamed from include/linux/fuse.h)0
-rw-r--r--include/uapi/linux/futex.h152
-rw-r--r--include/uapi/linux/gameport.h28
-rw-r--r--include/uapi/linux/gen_stats.h (renamed from include/linux/gen_stats.h)0
-rw-r--r--include/uapi/linux/genetlink.h84
-rw-r--r--include/uapi/linux/gfs2_ondisk.h (renamed from include/linux/gfs2_ondisk.h)0
-rw-r--r--include/uapi/linux/gigaset_dev.h (renamed from include/linux/gigaset_dev.h)0
-rw-r--r--include/uapi/linux/hdlc.h23
-rw-r--r--include/uapi/linux/hdlcdrv.h110
-rw-r--r--include/uapi/linux/hdreg.h (renamed from include/linux/hdreg.h)0
-rw-r--r--include/uapi/linux/hid.h66
-rw-r--r--include/uapi/linux/hiddev.h212
-rw-r--r--include/uapi/linux/hidraw.h50
-rw-r--r--include/uapi/linux/hpet.h25
-rw-r--r--include/uapi/linux/hsi/Kbuild1
-rw-r--r--include/uapi/linux/hsi/hsi_char.h (renamed from include/linux/hsi/hsi_char.h)0
-rw-r--r--include/uapi/linux/hysdn_if.h (renamed from include/linux/hysdn_if.h)0
-rw-r--r--include/uapi/linux/i2c-dev.h72
-rw-r--r--include/uapi/linux/i2c.h151
-rw-r--r--include/uapi/linux/i2o-dev.h (renamed from include/linux/i2o-dev.h)0
-rw-r--r--include/uapi/linux/i8k.h (renamed from include/linux/i8k.h)0
-rw-r--r--include/uapi/linux/icmp.h97
-rw-r--r--include/uapi/linux/icmpv6.h164
-rw-r--r--include/uapi/linux/if.h (renamed from include/linux/if.h)0
-rw-r--r--include/uapi/linux/if_addr.h (renamed from include/linux/if_addr.h)0
-rw-r--r--include/uapi/linux/if_addrlabel.h (renamed from include/linux/if_addrlabel.h)0
-rw-r--r--include/uapi/linux/if_alg.h (renamed from include/linux/if_alg.h)0
-rw-r--r--include/uapi/linux/if_arcnet.h (renamed from include/linux/if_arcnet.h)0
-rw-r--r--include/uapi/linux/if_arp.h159
-rw-r--r--include/uapi/linux/if_bonding.h (renamed from include/linux/if_bonding.h)0
-rw-r--r--include/uapi/linux/if_bridge.h101
-rw-r--r--include/uapi/linux/if_cablemodem.h (renamed from include/linux/if_cablemodem.h)0
-rw-r--r--include/uapi/linux/if_eql.h54
-rw-r--r--include/uapi/linux/if_ether.h135
-rw-r--r--include/uapi/linux/if_fc.h (renamed from include/linux/if_fc.h)0
-rw-r--r--include/uapi/linux/if_fddi.h104
-rw-r--r--include/uapi/linux/if_frad.h122
-rw-r--r--include/uapi/linux/if_hippi.h (renamed from include/linux/if_hippi.h)0
-rw-r--r--include/uapi/linux/if_infiniband.h (renamed from include/linux/if_infiniband.h)0
-rw-r--r--include/uapi/linux/if_link.h429
-rw-r--r--include/uapi/linux/if_ltalk.h9
-rw-r--r--include/uapi/linux/if_packet.h (renamed from include/linux/if_packet.h)0
-rw-r--r--include/uapi/linux/if_phonet.h16
-rw-r--r--include/uapi/linux/if_plip.h (renamed from include/linux/if_plip.h)0
-rw-r--r--include/uapi/linux/if_ppp.h (renamed from include/linux/if_ppp.h)0
-rw-r--r--include/uapi/linux/if_pppol2tp.h104
-rw-r--r--include/uapi/linux/if_pppox.h156
-rw-r--r--include/uapi/linux/if_slip.h (renamed from include/linux/if_slip.h)0
-rw-r--r--include/uapi/linux/if_team.h107
-rw-r--r--include/uapi/linux/if_tun.h94
-rw-r--r--include/uapi/linux/if_tunnel.h96
-rw-r--r--include/uapi/linux/if_vlan.h63
-rw-r--r--include/uapi/linux/if_x25.h (renamed from include/linux/if_x25.h)0
-rw-r--r--include/uapi/linux/igmp.h128
-rw-r--r--include/uapi/linux/in.h253
-rw-r--r--include/uapi/linux/in6.h279
-rw-r--r--include/uapi/linux/in_route.h (renamed from include/linux/in_route.h)0
-rw-r--r--include/uapi/linux/inet_diag.h136
-rw-r--r--include/uapi/linux/inotify.h74
-rw-r--r--include/uapi/linux/input.h1153
-rw-r--r--include/uapi/linux/ioctl.h (renamed from include/linux/ioctl.h)0
-rw-r--r--include/uapi/linux/ip.h136
-rw-r--r--include/uapi/linux/ip6_tunnel.h (renamed from include/linux/ip6_tunnel.h)0
-rw-r--r--include/uapi/linux/ip_vs.h (renamed from include/linux/ip_vs.h)0
-rw-r--r--include/uapi/linux/ipc.h81
-rw-r--r--include/uapi/linux/ipmi.h456
-rw-r--r--include/uapi/linux/ipmi_msgdefs.h (renamed from include/linux/ipmi_msgdefs.h)0
-rw-r--r--include/uapi/linux/ipsec.h (renamed from include/linux/ipsec.h)0
-rw-r--r--include/uapi/linux/ipv6.h164
-rw-r--r--include/uapi/linux/ipv6_route.h58
-rw-r--r--include/uapi/linux/ipx.h (renamed from include/linux/ipx.h)0
-rw-r--r--include/uapi/linux/irda.h (renamed from include/linux/irda.h)0
-rw-r--r--include/uapi/linux/irqnr.h4
-rw-r--r--include/uapi/linux/isdn.h143
-rw-r--r--include/uapi/linux/isdn/Kbuild1
-rw-r--r--include/uapi/linux/isdn/capicmd.h (renamed from include/linux/isdn/capicmd.h)0
-rw-r--r--include/uapi/linux/isdn_divertif.h30
-rw-r--r--include/uapi/linux/isdn_ppp.h67
-rw-r--r--include/uapi/linux/isdnif.h56
-rw-r--r--include/uapi/linux/iso_fs.h (renamed from include/linux/iso_fs.h)0
-rw-r--r--include/uapi/linux/ivtv.h (renamed from include/linux/ivtv.h)0
-rw-r--r--include/uapi/linux/ivtvfb.h (renamed from include/linux/ivtvfb.h)0
-rw-r--r--include/uapi/linux/ixjuser.h (renamed from include/linux/ixjuser.h)0
-rw-r--r--include/uapi/linux/jffs2.h (renamed from include/linux/jffs2.h)0
-rw-r--r--include/uapi/linux/joystick.h136
-rw-r--r--include/uapi/linux/kd.h183
-rw-r--r--include/uapi/linux/kdev_t.h13
-rw-r--r--include/uapi/linux/kernel-page-flags.h36
-rw-r--r--include/uapi/linux/kernel.h13
-rw-r--r--include/uapi/linux/kernelcapi.h47
-rw-r--r--include/uapi/linux/kexec.h54
-rw-r--r--include/uapi/linux/keyboard.h443
-rw-r--r--include/uapi/linux/keyctl.h (renamed from include/linux/keyctl.h)0
-rw-r--r--include/uapi/linux/kvm.h (renamed from include/linux/kvm.h)0
-rw-r--r--include/uapi/linux/kvm_para.h28
-rw-r--r--include/uapi/linux/l2tp.h180
-rw-r--r--include/uapi/linux/limits.h (renamed from include/linux/limits.h)0
-rw-r--r--include/uapi/linux/llc.h84
-rw-r--r--include/uapi/linux/loop.h94
-rw-r--r--include/uapi/linux/lp.h100
-rw-r--r--include/uapi/linux/magic.h (renamed from include/linux/magic.h)0
-rw-r--r--include/uapi/linux/major.h (renamed from include/linux/major.h)0
-rw-r--r--include/uapi/linux/map_to_7segment.h (renamed from include/linux/map_to_7segment.h)0
-rw-r--r--include/uapi/linux/matroxfb.h (renamed from include/linux/matroxfb.h)0
-rw-r--r--include/uapi/linux/mdio.h297
-rw-r--r--include/uapi/linux/media.h (renamed from include/linux/media.h)0
-rw-r--r--include/uapi/linux/mei.h (renamed from include/linux/mei.h)0
-rw-r--r--include/uapi/linux/mempolicy.h64
-rw-r--r--include/uapi/linux/meye.h (renamed from include/linux/meye.h)0
-rw-r--r--include/uapi/linux/mii.h161
-rw-r--r--include/uapi/linux/minix_fs.h (renamed from include/linux/minix_fs.h)0
-rw-r--r--include/uapi/linux/mman.h13
-rw-r--r--include/uapi/linux/mmc/Kbuild1
-rw-r--r--include/uapi/linux/mmc/ioctl.h (renamed from include/linux/mmc/ioctl.h)0
-rw-r--r--include/uapi/linux/mmtimer.h (renamed from include/linux/mmtimer.h)0
-rw-r--r--include/uapi/linux/mqueue.h (renamed from include/linux/mqueue.h)0
-rw-r--r--include/uapi/linux/mroute.h143
-rw-r--r--include/uapi/linux/mroute6.h137
-rw-r--r--include/uapi/linux/msdos_fs.h167
-rw-r--r--include/uapi/linux/msg.h75
-rw-r--r--include/uapi/linux/mtio.h (renamed from include/linux/mtio.h)0
-rw-r--r--include/uapi/linux/n_r3964.h98
-rw-r--r--include/uapi/linux/nbd.h77
-rw-r--r--include/uapi/linux/ncp.h (renamed from include/linux/ncp.h)0
-rw-r--r--include/uapi/linux/ncp_fs.h (renamed from include/linux/ncp_fs.h)0
-rw-r--r--include/uapi/linux/ncp_mount.h (renamed from include/linux/ncp_mount.h)0
-rw-r--r--include/uapi/linux/ncp_no.h (renamed from include/linux/ncp_no.h)0
-rw-r--r--include/uapi/linux/neighbour.h (renamed from include/linux/neighbour.h)0
-rw-r--r--include/uapi/linux/net.h57
-rw-r--r--include/uapi/linux/net_dropmon.h (renamed from include/linux/net_dropmon.h)0
-rw-r--r--include/uapi/linux/net_tstamp.h (renamed from include/linux/net_tstamp.h)0
-rw-r--r--include/uapi/linux/netdevice.h53
-rw-r--r--include/uapi/linux/netfilter.h72
-rw-r--r--include/uapi/linux/netfilter/Kbuild76
-rw-r--r--include/uapi/linux/netfilter/ipset/Kbuild4
-rw-r--r--include/uapi/linux/netfilter/ipset/ip_set.h231
-rw-r--r--include/uapi/linux/netfilter/ipset/ip_set_bitmap.h13
-rw-r--r--include/uapi/linux/netfilter/ipset/ip_set_hash.h21
-rw-r--r--include/uapi/linux/netfilter/ipset/ip_set_list.h21
-rw-r--r--include/uapi/linux/netfilter/nf_conntrack_common.h117
-rw-r--r--include/uapi/linux/netfilter/nf_conntrack_ftp.h18
-rw-r--r--include/uapi/linux/netfilter/nf_conntrack_sctp.h (renamed from include/linux/netfilter/nf_conntrack_sctp.h)0
-rw-r--r--include/uapi/linux/netfilter/nf_conntrack_tcp.h51
-rw-r--r--include/uapi/linux/netfilter/nf_conntrack_tuple_common.h (renamed from include/linux/netfilter/nf_conntrack_tuple_common.h)0
-rw-r--r--include/uapi/linux/netfilter/nf_nat.h (renamed from include/linux/netfilter/nf_nat.h)0
-rw-r--r--include/uapi/linux/netfilter/nfnetlink.h56
-rw-r--r--include/uapi/linux/netfilter/nfnetlink_acct.h27
-rw-r--r--include/uapi/linux/netfilter/nfnetlink_compat.h (renamed from include/linux/netfilter/nfnetlink_compat.h)0
-rw-r--r--include/uapi/linux/netfilter/nfnetlink_conntrack.h (renamed from include/linux/netfilter/nfnetlink_conntrack.h)0
-rw-r--r--include/uapi/linux/netfilter/nfnetlink_cthelper.h (renamed from include/linux/netfilter/nfnetlink_cthelper.h)0
-rw-r--r--include/uapi/linux/netfilter/nfnetlink_cttimeout.h (renamed from include/linux/netfilter/nfnetlink_cttimeout.h)0
-rw-r--r--include/uapi/linux/netfilter/nfnetlink_log.h (renamed from include/linux/netfilter/nfnetlink_log.h)0
-rw-r--r--include/uapi/linux/netfilter/nfnetlink_queue.h (renamed from include/linux/netfilter/nfnetlink_queue.h)0
-rw-r--r--include/uapi/linux/netfilter/x_tables.h187
-rw-r--r--include/uapi/linux/netfilter/xt_AUDIT.h (renamed from include/linux/netfilter/xt_AUDIT.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_CHECKSUM.h (renamed from include/linux/netfilter/xt_CHECKSUM.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_CLASSIFY.h (renamed from include/linux/netfilter/xt_CLASSIFY.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_CONNMARK.h (renamed from include/linux/netfilter/xt_CONNMARK.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_CONNSECMARK.h (renamed from include/linux/netfilter/xt_CONNSECMARK.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_CT.h (renamed from include/linux/netfilter/xt_CT.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_DSCP.h (renamed from include/linux/netfilter/xt_DSCP.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_IDLETIMER.h (renamed from include/linux/netfilter/xt_IDLETIMER.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_LED.h (renamed from include/linux/netfilter/xt_LED.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_LOG.h (renamed from include/linux/netfilter/xt_LOG.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_MARK.h (renamed from include/linux/netfilter/xt_MARK.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_NFLOG.h (renamed from include/linux/netfilter/xt_NFLOG.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_NFQUEUE.h (renamed from include/linux/netfilter/xt_NFQUEUE.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_RATEEST.h (renamed from include/linux/netfilter/xt_RATEEST.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_SECMARK.h (renamed from include/linux/netfilter/xt_SECMARK.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_TCPMSS.h (renamed from include/linux/netfilter/xt_TCPMSS.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_TCPOPTSTRIP.h (renamed from include/linux/netfilter/xt_TCPOPTSTRIP.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_TEE.h (renamed from include/linux/netfilter/xt_TEE.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_TPROXY.h (renamed from include/linux/netfilter/xt_TPROXY.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_addrtype.h (renamed from include/linux/netfilter/xt_addrtype.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_cluster.h (renamed from include/linux/netfilter/xt_cluster.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_comment.h (renamed from include/linux/netfilter/xt_comment.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_connbytes.h (renamed from include/linux/netfilter/xt_connbytes.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_connlimit.h (renamed from include/linux/netfilter/xt_connlimit.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_connmark.h (renamed from include/linux/netfilter/xt_connmark.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_conntrack.h (renamed from include/linux/netfilter/xt_conntrack.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_cpu.h (renamed from include/linux/netfilter/xt_cpu.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_dccp.h (renamed from include/linux/netfilter/xt_dccp.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_devgroup.h (renamed from include/linux/netfilter/xt_devgroup.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_dscp.h (renamed from include/linux/netfilter/xt_dscp.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_ecn.h (renamed from include/linux/netfilter/xt_ecn.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_esp.h (renamed from include/linux/netfilter/xt_esp.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_hashlimit.h73
-rw-r--r--include/uapi/linux/netfilter/xt_helper.h (renamed from include/linux/netfilter/xt_helper.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_iprange.h (renamed from include/linux/netfilter/xt_iprange.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_ipvs.h (renamed from include/linux/netfilter/xt_ipvs.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_length.h (renamed from include/linux/netfilter/xt_length.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_limit.h (renamed from include/linux/netfilter/xt_limit.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_mac.h (renamed from include/linux/netfilter/xt_mac.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_mark.h (renamed from include/linux/netfilter/xt_mark.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_multiport.h (renamed from include/linux/netfilter/xt_multiport.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_nfacct.h (renamed from include/linux/netfilter/xt_nfacct.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_osf.h (renamed from include/linux/netfilter/xt_osf.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_owner.h (renamed from include/linux/netfilter/xt_owner.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_physdev.h23
-rw-r--r--include/uapi/linux/netfilter/xt_pkttype.h (renamed from include/linux/netfilter/xt_pkttype.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_policy.h (renamed from include/linux/netfilter/xt_policy.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_quota.h (renamed from include/linux/netfilter/xt_quota.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_rateest.h (renamed from include/linux/netfilter/xt_rateest.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_realm.h (renamed from include/linux/netfilter/xt_realm.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_recent.h (renamed from include/linux/netfilter/xt_recent.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_sctp.h (renamed from include/linux/netfilter/xt_sctp.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_set.h (renamed from include/linux/netfilter/xt_set.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_socket.h (renamed from include/linux/netfilter/xt_socket.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_state.h (renamed from include/linux/netfilter/xt_state.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_statistic.h (renamed from include/linux/netfilter/xt_statistic.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_string.h (renamed from include/linux/netfilter/xt_string.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_tcpmss.h (renamed from include/linux/netfilter/xt_tcpmss.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_tcpudp.h (renamed from include/linux/netfilter/xt_tcpudp.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_time.h (renamed from include/linux/netfilter/xt_time.h)0
-rw-r--r--include/uapi/linux/netfilter/xt_u32.h (renamed from include/linux/netfilter/xt_u32.h)0
-rw-r--r--include/uapi/linux/netfilter_arp.h (renamed from include/linux/netfilter_arp.h)0
-rw-r--r--include/uapi/linux/netfilter_arp/Kbuild2
-rw-r--r--include/uapi/linux/netfilter_arp/arp_tables.h206
-rw-r--r--include/uapi/linux/netfilter_arp/arpt_mangle.h (renamed from include/linux/netfilter_arp/arpt_mangle.h)0
-rw-r--r--include/uapi/linux/netfilter_bridge.h27
-rw-r--r--include/uapi/linux/netfilter_bridge/Kbuild18
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_802_3.h62
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_among.h (renamed from include/linux/netfilter_bridge/ebt_among.h)0
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_arp.h (renamed from include/linux/netfilter_bridge/ebt_arp.h)0
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_arpreply.h (renamed from include/linux/netfilter_bridge/ebt_arpreply.h)0
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_ip.h (renamed from include/linux/netfilter_bridge/ebt_ip.h)0
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_ip6.h (renamed from include/linux/netfilter_bridge/ebt_ip6.h)0
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_limit.h (renamed from include/linux/netfilter_bridge/ebt_limit.h)0
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_log.h (renamed from include/linux/netfilter_bridge/ebt_log.h)0
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_mark_m.h (renamed from include/linux/netfilter_bridge/ebt_mark_m.h)0
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_mark_t.h (renamed from include/linux/netfilter_bridge/ebt_mark_t.h)0
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_nat.h (renamed from include/linux/netfilter_bridge/ebt_nat.h)0
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_nflog.h (renamed from include/linux/netfilter_bridge/ebt_nflog.h)0
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_pkttype.h (renamed from include/linux/netfilter_bridge/ebt_pkttype.h)0
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_redirect.h (renamed from include/linux/netfilter_bridge/ebt_redirect.h)0
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_stp.h (renamed from include/linux/netfilter_bridge/ebt_stp.h)0
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_ulog.h (renamed from include/linux/netfilter_bridge/ebt_ulog.h)0
-rw-r--r--include/uapi/linux/netfilter_bridge/ebt_vlan.h (renamed from include/linux/netfilter_bridge/ebt_vlan.h)0
-rw-r--r--include/uapi/linux/netfilter_bridge/ebtables.h268
-rw-r--r--include/uapi/linux/netfilter_decnet.h (renamed from include/linux/netfilter_decnet.h)0
-rw-r--r--include/uapi/linux/netfilter_ipv4.h81
-rw-r--r--include/uapi/linux/netfilter_ipv4/Kbuild10
-rw-r--r--include/uapi/linux/netfilter_ipv4/ip_tables.h229
-rw-r--r--include/uapi/linux/netfilter_ipv4/ipt_CLUSTERIP.h (renamed from include/linux/netfilter_ipv4/ipt_CLUSTERIP.h)0
-rw-r--r--include/uapi/linux/netfilter_ipv4/ipt_ECN.h (renamed from include/linux/netfilter_ipv4/ipt_ECN.h)0
-rw-r--r--include/uapi/linux/netfilter_ipv4/ipt_LOG.h (renamed from include/linux/netfilter_ipv4/ipt_LOG.h)0
-rw-r--r--include/uapi/linux/netfilter_ipv4/ipt_REJECT.h (renamed from include/linux/netfilter_ipv4/ipt_REJECT.h)0
-rw-r--r--include/uapi/linux/netfilter_ipv4/ipt_TTL.h (renamed from include/linux/netfilter_ipv4/ipt_TTL.h)0
-rw-r--r--include/uapi/linux/netfilter_ipv4/ipt_ULOG.h (renamed from include/linux/netfilter_ipv4/ipt_ULOG.h)0
-rw-r--r--include/uapi/linux/netfilter_ipv4/ipt_ah.h (renamed from include/linux/netfilter_ipv4/ipt_ah.h)0
-rw-r--r--include/uapi/linux/netfilter_ipv4/ipt_ecn.h (renamed from include/linux/netfilter_ipv4/ipt_ecn.h)0
-rw-r--r--include/uapi/linux/netfilter_ipv4/ipt_ttl.h (renamed from include/linux/netfilter_ipv4/ipt_ttl.h)0
-rw-r--r--include/uapi/linux/netfilter_ipv6.h79
-rw-r--r--include/uapi/linux/netfilter_ipv6/Kbuild12
-rw-r--r--include/uapi/linux/netfilter_ipv6/ip6_tables.h267
-rw-r--r--include/uapi/linux/netfilter_ipv6/ip6t_HL.h (renamed from include/linux/netfilter_ipv6/ip6t_HL.h)0
-rw-r--r--include/uapi/linux/netfilter_ipv6/ip6t_LOG.h (renamed from include/linux/netfilter_ipv6/ip6t_LOG.h)0
-rw-r--r--include/uapi/linux/netfilter_ipv6/ip6t_NPT.h (renamed from include/linux/netfilter_ipv6/ip6t_NPT.h)0
-rw-r--r--include/uapi/linux/netfilter_ipv6/ip6t_REJECT.h (renamed from include/linux/netfilter_ipv6/ip6t_REJECT.h)0
-rw-r--r--include/uapi/linux/netfilter_ipv6/ip6t_ah.h (renamed from include/linux/netfilter_ipv6/ip6t_ah.h)0
-rw-r--r--include/uapi/linux/netfilter_ipv6/ip6t_frag.h (renamed from include/linux/netfilter_ipv6/ip6t_frag.h)0
-rw-r--r--include/uapi/linux/netfilter_ipv6/ip6t_hl.h (renamed from include/linux/netfilter_ipv6/ip6t_hl.h)0
-rw-r--r--include/uapi/linux/netfilter_ipv6/ip6t_ipv6header.h (renamed from include/linux/netfilter_ipv6/ip6t_ipv6header.h)0
-rw-r--r--include/uapi/linux/netfilter_ipv6/ip6t_mh.h (renamed from include/linux/netfilter_ipv6/ip6t_mh.h)0
-rw-r--r--include/uapi/linux/netfilter_ipv6/ip6t_opts.h (renamed from include/linux/netfilter_ipv6/ip6t_opts.h)0
-rw-r--r--include/uapi/linux/netfilter_ipv6/ip6t_rt.h (renamed from include/linux/netfilter_ipv6/ip6t_rt.h)0
-rw-r--r--include/uapi/linux/netlink.h153
-rw-r--r--include/uapi/linux/netrom.h (renamed from include/linux/netrom.h)0
-rw-r--r--include/uapi/linux/nfc.h (renamed from include/linux/nfc.h)0
-rw-r--r--include/uapi/linux/nfs.h131
-rw-r--r--include/uapi/linux/nfs2.h (renamed from include/linux/nfs2.h)0
-rw-r--r--include/uapi/linux/nfs3.h97
-rw-r--r--include/uapi/linux/nfs4.h178
-rw-r--r--include/uapi/linux/nfs4_mount.h (renamed from include/linux/nfs4_mount.h)0
-rw-r--r--include/uapi/linux/nfs_fs.h61
-rw-r--r--include/uapi/linux/nfs_idmap.h65
-rw-r--r--include/uapi/linux/nfs_mount.h (renamed from include/linux/nfs_mount.h)0
-rw-r--r--include/uapi/linux/nfsacl.h29
-rw-r--r--include/uapi/linux/nfsd/Kbuild5
-rw-r--r--include/uapi/linux/nfsd/cld.h (renamed from include/linux/nfsd/cld.h)0
-rw-r--r--include/uapi/linux/nfsd/debug.h40
-rw-r--r--include/uapi/linux/nfsd/export.h58
-rw-r--r--include/uapi/linux/nfsd/nfsfh.h122
-rw-r--r--include/uapi/linux/nfsd/stats.h17
-rw-r--r--include/uapi/linux/nl80211.h (renamed from include/linux/nl80211.h)0
-rw-r--r--include/uapi/linux/nubus.h244
-rw-r--r--include/uapi/linux/nvram.h16
-rw-r--r--include/uapi/linux/omap3isp.h (renamed from include/linux/omap3isp.h)6
-rw-r--r--include/uapi/linux/omapfb.h222
-rw-r--r--include/uapi/linux/oom.h11
-rw-r--r--include/uapi/linux/packet_diag.h (renamed from include/linux/packet_diag.h)0
-rw-r--r--include/uapi/linux/param.h (renamed from include/linux/param.h)0
-rw-r--r--include/uapi/linux/parport.h95
-rw-r--r--include/uapi/linux/patchkey.h37
-rw-r--r--include/uapi/linux/pci.h41
-rw-r--r--include/uapi/linux/pci_regs.h (renamed from include/linux/pci_regs.h)0
-rw-r--r--include/uapi/linux/perf_event.h615
-rw-r--r--include/uapi/linux/personality.h69
-rw-r--r--include/uapi/linux/pfkeyv2.h (renamed from include/linux/pfkeyv2.h)0
-rw-r--r--include/uapi/linux/pg.h (renamed from include/linux/pg.h)0
-rw-r--r--include/uapi/linux/phantom.h (renamed from include/linux/phantom.h)0
-rw-r--r--include/uapi/linux/phonet.h185
-rw-r--r--include/uapi/linux/pkt_cls.h (renamed from include/linux/pkt_cls.h)0
-rw-r--r--include/uapi/linux/pkt_sched.h (renamed from include/linux/pkt_sched.h)0
-rw-r--r--include/uapi/linux/pktcdvd.h111
-rw-r--r--include/uapi/linux/pmu.h139
-rw-r--r--include/uapi/linux/poll.h1
-rw-r--r--include/uapi/linux/posix_types.h (renamed from include/linux/posix_types.h)0
-rw-r--r--include/uapi/linux/ppdev.h (renamed from include/linux/ppdev.h)0
-rw-r--r--include/uapi/linux/ppp-comp.h93
-rw-r--r--include/uapi/linux/ppp-ioctl.h (renamed from include/linux/ppp-ioctl.h)0
-rw-r--r--include/uapi/linux/ppp_defs.h150
-rw-r--r--include/uapi/linux/pps.h (renamed from include/linux/pps.h)0
-rw-r--r--include/uapi/linux/prctl.h (renamed from include/linux/prctl.h)0
-rw-r--r--include/uapi/linux/ptp_clock.h (renamed from include/linux/ptp_clock.h)0
-rw-r--r--include/uapi/linux/ptrace.h81
-rw-r--r--include/uapi/linux/qnx4_fs.h (renamed from include/linux/qnx4_fs.h)0
-rw-r--r--include/uapi/linux/qnxtypes.h (renamed from include/linux/qnxtypes.h)0
-rw-r--r--include/uapi/linux/quota.h171
-rw-r--r--include/uapi/linux/radeonfb.h (renamed from include/linux/radeonfb.h)0
-rw-r--r--include/uapi/linux/random.h50
-rw-r--r--include/uapi/linux/raw.h (renamed from include/linux/raw.h)0
-rw-r--r--include/uapi/linux/rds.h (renamed from include/linux/rds.h)0
-rw-r--r--include/uapi/linux/reboot.h39
-rw-r--r--include/uapi/linux/reiserfs_fs.h (renamed from include/linux/reiserfs_fs.h)0
-rw-r--r--include/uapi/linux/reiserfs_xattr.h (renamed from include/linux/reiserfs_xattr.h)0
-rw-r--r--include/uapi/linux/resource.h80
-rw-r--r--include/uapi/linux/rfkill.h107
-rw-r--r--include/uapi/linux/romfs_fs.h (renamed from include/linux/romfs_fs.h)0
-rw-r--r--include/uapi/linux/rose.h (renamed from include/linux/rose.h)0
-rw-r--r--include/uapi/linux/route.h (renamed from include/linux/route.h)0
-rw-r--r--include/uapi/linux/rtc.h107
-rw-r--r--include/uapi/linux/rtnetlink.h612
-rw-r--r--include/uapi/linux/scc.h172
-rw-r--r--include/uapi/linux/sched.h46
-rw-r--r--include/uapi/linux/screen_info.h74
-rw-r--r--include/uapi/linux/sdla.h116
-rw-r--r--include/uapi/linux/seccomp.h47
-rw-r--r--include/uapi/linux/securebits.h51
-rw-r--r--include/uapi/linux/selinux_netlink.h (renamed from include/linux/selinux_netlink.h)0
-rw-r--r--include/uapi/linux/sem.h80
-rw-r--r--include/uapi/linux/serial.h126
-rw-r--r--include/uapi/linux/serial_core.h219
-rw-r--r--include/uapi/linux/serial_reg.h (renamed from include/linux/serial_reg.h)0
-rw-r--r--include/uapi/linux/serio.h80
-rw-r--r--include/uapi/linux/shm.h79
-rw-r--r--include/uapi/linux/signal.h8
-rw-r--r--include/uapi/linux/signalfd.h52
-rw-r--r--include/uapi/linux/snmp.h (renamed from include/linux/snmp.h)0
-rw-r--r--include/uapi/linux/sock_diag.h26
-rw-r--r--include/uapi/linux/socket.h21
-rw-r--r--include/uapi/linux/sockios.h (renamed from include/linux/sockios.h)0
-rw-r--r--include/uapi/linux/som.h (renamed from include/linux/som.h)0
-rw-r--r--include/uapi/linux/sonet.h60
-rw-r--r--include/uapi/linux/sonypi.h146
-rw-r--r--include/uapi/linux/sound.h31
-rw-r--r--include/uapi/linux/soundcard.h1282
-rw-r--r--include/uapi/linux/spi/Kbuild1
-rw-r--r--include/uapi/linux/spi/spidev.h (renamed from include/linux/spi/spidev.h)0
-rw-r--r--include/uapi/linux/stat.h45
-rw-r--r--include/uapi/linux/stddef.h1
-rw-r--r--include/uapi/linux/string.h9
-rw-r--r--include/uapi/linux/sunrpc/Kbuild1
-rw-r--r--include/uapi/linux/sunrpc/debug.h48
-rw-r--r--include/uapi/linux/suspend_ioctls.h (renamed from include/linux/suspend_ioctls.h)0
-rw-r--r--include/uapi/linux/swab.h282
-rw-r--r--include/uapi/linux/synclink.h300
-rw-r--r--include/uapi/linux/sysctl.h932
-rw-r--r--include/uapi/linux/sysinfo.h (renamed from include/linux/sysinfo.h)0
-rw-r--r--include/uapi/linux/taskstats.h (renamed from include/linux/taskstats.h)0
-rw-r--r--include/uapi/linux/tc_act/Kbuild7
-rw-r--r--include/uapi/linux/tc_act/tc_csum.h (renamed from include/linux/tc_act/tc_csum.h)0
-rw-r--r--include/uapi/linux/tc_act/tc_gact.h (renamed from include/linux/tc_act/tc_gact.h)0
-rw-r--r--include/uapi/linux/tc_act/tc_ipt.h (renamed from include/linux/tc_act/tc_ipt.h)0
-rw-r--r--include/uapi/linux/tc_act/tc_mirred.h (renamed from include/linux/tc_act/tc_mirred.h)0
-rw-r--r--include/uapi/linux/tc_act/tc_nat.h (renamed from include/linux/tc_act/tc_nat.h)0
-rw-r--r--include/uapi/linux/tc_act/tc_pedit.h (renamed from include/linux/tc_act/tc_pedit.h)0
-rw-r--r--include/uapi/linux/tc_act/tc_skbedit.h (renamed from include/linux/tc_act/tc_skbedit.h)0
-rw-r--r--include/uapi/linux/tc_ematch/Kbuild4
-rw-r--r--include/uapi/linux/tc_ematch/tc_em_cmp.h (renamed from include/linux/tc_ematch/tc_em_cmp.h)0
-rw-r--r--include/uapi/linux/tc_ematch/tc_em_meta.h (renamed from include/linux/tc_ematch/tc_em_meta.h)0
-rw-r--r--include/uapi/linux/tc_ematch/tc_em_nbyte.h (renamed from include/linux/tc_ematch/tc_em_nbyte.h)0
-rw-r--r--include/uapi/linux/tc_ematch/tc_em_text.h (renamed from include/linux/tc_ematch/tc_em_text.h)0
-rw-r--r--include/uapi/linux/tcp.h226
-rw-r--r--include/uapi/linux/tcp_metrics.h (renamed from include/linux/tcp_metrics.h)0
-rw-r--r--include/uapi/linux/telephony.h (renamed from include/linux/telephony.h)0
-rw-r--r--include/uapi/linux/termios.h (renamed from include/linux/termios.h)0
-rw-r--r--include/uapi/linux/time.h71
-rw-r--r--include/uapi/linux/times.h (renamed from include/linux/times.h)0
-rw-r--r--include/uapi/linux/timex.h166
-rw-r--r--include/uapi/linux/tiocl.h (renamed from include/linux/tiocl.h)0
-rw-r--r--include/uapi/linux/tipc.h (renamed from include/linux/tipc.h)0
-rw-r--r--include/uapi/linux/tipc_config.h (renamed from include/linux/tipc_config.h)0
-rw-r--r--include/uapi/linux/toshiba.h37
-rw-r--r--include/uapi/linux/tty.h38
-rw-r--r--include/uapi/linux/tty_flags.h (renamed from include/linux/tty_flags.h)0
-rw-r--r--include/uapi/linux/types.h56
-rw-r--r--include/uapi/linux/udf_fs_i.h (renamed from include/linux/udf_fs_i.h)0
-rw-r--r--include/uapi/linux/udp.h39
-rw-r--r--include/uapi/linux/uhid.h (renamed from include/linux/uhid.h)0
-rw-r--r--include/uapi/linux/uinput.h137
-rw-r--r--include/uapi/linux/uio.h30
-rw-r--r--include/uapi/linux/ultrasound.h (renamed from include/linux/ultrasound.h)0
-rw-r--r--include/uapi/linux/un.h (renamed from include/linux/un.h)0
-rw-r--r--include/uapi/linux/unistd.h (renamed from include/linux/unistd.h)0
-rw-r--r--include/uapi/linux/unix_diag.h (renamed from include/linux/unix_diag.h)0
-rw-r--r--include/uapi/linux/usb/Kbuild10
-rw-r--r--include/uapi/linux/usb/audio.h545
-rw-r--r--include/uapi/linux/usb/cdc.h (renamed from include/linux/usb/cdc.h)0
-rw-r--r--include/uapi/linux/usb/ch11.h (renamed from include/linux/usb/ch11.h)0
-rw-r--r--include/uapi/linux/usb/ch9.h993
-rw-r--r--include/uapi/linux/usb/functionfs.h169
-rw-r--r--include/uapi/linux/usb/g_printer.h (renamed from include/linux/usb/g_printer.h)0
-rw-r--r--include/uapi/linux/usb/gadgetfs.h (renamed from include/linux/usb/gadgetfs.h)0
-rw-r--r--include/uapi/linux/usb/midi.h (renamed from include/linux/usb/midi.h)0
-rw-r--r--include/uapi/linux/usb/tmc.h (renamed from include/linux/usb/tmc.h)0
-rw-r--r--include/uapi/linux/usb/video.h (renamed from include/linux/usb/video.h)0
-rw-r--r--include/uapi/linux/usbdevice_fs.h180
-rw-r--r--include/uapi/linux/utime.h (renamed from include/linux/utime.h)0
-rw-r--r--include/uapi/linux/utsname.h34
-rw-r--r--include/uapi/linux/uuid.h58
-rw-r--r--include/uapi/linux/uvcvideo.h (renamed from include/linux/uvcvideo.h)0
-rw-r--r--include/uapi/linux/v4l2-common.h (renamed from include/linux/v4l2-common.h)8
-rw-r--r--include/uapi/linux/v4l2-controls.h803
-rw-r--r--include/uapi/linux/v4l2-dv-timings.h (renamed from include/linux/v4l2-dv-timings.h)0
-rw-r--r--include/uapi/linux/v4l2-mediabus.h (renamed from include/linux/v4l2-mediabus.h)5
-rw-r--r--include/uapi/linux/v4l2-subdev.h (renamed from include/linux/v4l2-subdev.h)10
-rw-r--r--include/uapi/linux/veth.h (renamed from include/linux/veth.h)0
-rw-r--r--include/uapi/linux/vfio.h368
-rw-r--r--include/uapi/linux/vhost.h (renamed from include/linux/vhost.h)0
-rw-r--r--include/uapi/linux/videodev2.h1998
-rw-r--r--include/uapi/linux/virtio_9p.h (renamed from include/linux/virtio_9p.h)0
-rw-r--r--include/uapi/linux/virtio_balloon.h (renamed from include/linux/virtio_balloon.h)0
-rw-r--r--include/uapi/linux/virtio_blk.h (renamed from include/linux/virtio_blk.h)0
-rw-r--r--include/uapi/linux/virtio_config.h54
-rw-r--r--include/uapi/linux/virtio_console.h74
-rw-r--r--include/uapi/linux/virtio_ids.h (renamed from include/linux/virtio_ids.h)0
-rw-r--r--include/uapi/linux/virtio_net.h (renamed from include/linux/virtio_net.h)0
-rw-r--r--include/uapi/linux/virtio_pci.h (renamed from include/linux/virtio_pci.h)0
-rw-r--r--include/uapi/linux/virtio_ring.h163
-rw-r--r--include/uapi/linux/virtio_rng.h (renamed from include/linux/virtio_rng.h)0
-rw-r--r--include/uapi/linux/vt.h90
-rw-r--r--include/uapi/linux/wait.h21
-rw-r--r--include/uapi/linux/wanrouter.h452
-rw-r--r--include/uapi/linux/watchdog.h57
-rw-r--r--include/uapi/linux/wimax.h (renamed from include/linux/wimax.h)0
-rw-r--r--include/uapi/linux/wimax/Kbuild1
-rw-r--r--include/uapi/linux/wimax/i2400m.h (renamed from include/linux/wimax/i2400m.h)0
-rw-r--r--include/uapi/linux/wireless.h1128
-rw-r--r--include/uapi/linux/x25.h (renamed from include/linux/x25.h)0
-rw-r--r--include/uapi/linux/xattr.h64
-rw-r--r--include/uapi/linux/xfrm.h (renamed from include/linux/xfrm.h)0
-rw-r--r--include/uapi/mtd/Kbuild5
-rw-r--r--include/uapi/mtd/inftl-user.h (renamed from include/mtd/inftl-user.h)0
-rw-r--r--include/uapi/mtd/mtd-abi.h (renamed from include/mtd/mtd-abi.h)0
-rw-r--r--include/uapi/mtd/mtd-user.h (renamed from include/mtd/mtd-user.h)0
-rw-r--r--include/uapi/mtd/nftl-user.h (renamed from include/mtd/nftl-user.h)0
-rw-r--r--include/uapi/mtd/ubi-user.h (renamed from include/mtd/ubi-user.h)0
-rw-r--r--include/uapi/xen/Kbuild2
-rw-r--r--include/uapi/xen/evtchn.h (renamed from include/xen/evtchn.h)0
-rw-r--r--include/uapi/xen/privcmd.h (renamed from include/xen/privcmd.h)0
-rw-r--r--include/video/omapdss.h112
-rw-r--r--include/video/samsung_fimd.h533
-rw-r--r--include/xen/Kbuild2
-rw-r--r--include/xen/events.h2
-rw-r--r--include/xen/grant_table.h2
-rw-r--r--include/xen/interface/features.h3
-rw-r--r--include/xen/interface/grant_table.h2
-rw-r--r--include/xen/interface/hvm/hvm_op.h19
-rw-r--r--include/xen/interface/io/protocols.h3
-rw-r--r--include/xen/interface/memory.h34
-rw-r--r--include/xen/interface/physdev.h2
-rw-r--r--include/xen/interface/version.h2
-rw-r--r--include/xen/xen.h4
1153 files changed, 49142 insertions, 39720 deletions
diff --git a/include/Kbuild b/include/Kbuild
index 8d226bfa2696..83256b64166a 100644
--- a/include/Kbuild
+++ b/include/Kbuild
@@ -1,12 +1,8 @@
1# Top-level Makefile calls into asm-$(ARCH) 1# Top-level Makefile calls into asm-$(ARCH)
2# List only non-arch directories below 2# List only non-arch directories below
3 3
4header-y += asm-generic/
5header-y += linux/ 4header-y += linux/
6header-y += sound/ 5header-y += sound/
7header-y += mtd/
8header-y += rdma/ 6header-y += rdma/
9header-y += video/ 7header-y += video/
10header-y += drm/
11header-y += xen/
12header-y += scsi/ 8header-y += scsi/
diff --git a/include/acpi/acbuffer.h b/include/acpi/acbuffer.h
new file mode 100644
index 000000000000..a1e45cdd729a
--- /dev/null
+++ b/include/acpi/acbuffer.h
@@ -0,0 +1,235 @@
1/******************************************************************************
2 *
3 * Name: acbuffer.h - Support for buffers returned by ACPI predefined names
4 *
5 *****************************************************************************/
6
7/*
8 * Copyright (C) 2000 - 2012, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44#ifndef __ACBUFFER_H__
45#define __ACBUFFER_H__
46
47/*
48 * Contains buffer structures for these predefined names:
49 * _FDE, _GRT, _GTM, _PLD, _SRT
50 */
51
52/*
53 * Note: C bitfields are not used for this reason:
54 *
55 * "Bitfields are great and easy to read, but unfortunately the C language
56 * does not specify the layout of bitfields in memory, which means they are
57 * essentially useless for dealing with packed data in on-disk formats or
58 * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
59 * this decision was a design error in C. Ritchie could have picked an order
60 * and stuck with it." Norman Ramsey.
61 * See http://stackoverflow.com/a/1053662/41661
62 */
63
64/* _FDE return value */
65
66struct acpi_fde_info {
67 u32 floppy0;
68 u32 floppy1;
69 u32 floppy2;
70 u32 floppy3;
71 u32 tape;
72};
73
74/*
75 * _GRT return value
76 * _SRT input value
77 */
78struct acpi_grt_info {
79 u16 year;
80 u8 month;
81 u8 day;
82 u8 hour;
83 u8 minute;
84 u8 second;
85 u8 valid;
86 u16 milliseconds;
87 u16 timezone;
88 u8 daylight;
89 u8 reserved[3];
90};
91
92/* _GTM return value */
93
94struct acpi_gtm_info {
95 u32 pio_speed0;
96 u32 dma_speed0;
97 u32 pio_speed1;
98 u32 dma_speed1;
99 u32 flags;
100};
101
102/*
103 * Formatted _PLD return value. The minimum size is a package containing
104 * one buffer.
105 * Revision 1: Buffer is 16 bytes (128 bits)
106 * Revision 2: Buffer is 20 bytes (160 bits)
107 *
108 * Note: This structure is returned from the acpi_decode_pld_buffer
109 * interface.
110 */
111struct acpi_pld_info {
112 u8 revision;
113 u8 ignore_color;
114 u32 color;
115 u16 width;
116 u16 height;
117 u8 user_visible;
118 u8 dock;
119 u8 lid;
120 u8 panel;
121 u8 vertical_position;
122 u8 horizontal_position;
123 u8 shape;
124 u8 group_orientation;
125 u8 group_token;
126 u8 group_position;
127 u8 bay;
128 u8 ejectable;
129 u8 ospm_eject_required;
130 u8 cabinet_number;
131 u8 card_cage_number;
132 u8 reference;
133 u8 rotation;
134 u8 order;
135 u8 reserved;
136 u16 vertical_offset;
137 u16 horizontal_offset;
138};
139
140/*
141 * Macros to:
142 * 1) Convert a _PLD buffer to internal struct acpi_pld_info format - ACPI_PLD_GET*
143 * (Used by acpi_decode_pld_buffer)
144 * 2) Construct a _PLD buffer - ACPI_PLD_SET*
145 * (Intended for BIOS use only)
146 */
147#define ACPI_PLD_REV1_BUFFER_SIZE 16 /* For Revision 1 of the buffer (From ACPI spec) */
148#define ACPI_PLD_BUFFER_SIZE 20 /* For Revision 2 of the buffer (From ACPI spec) */
149
150/* First 32-bit dword, bits 0:32 */
151
152#define ACPI_PLD_GET_REVISION(dword) ACPI_GET_BITS (dword, 0, ACPI_7BIT_MASK)
153#define ACPI_PLD_SET_REVISION(dword,value) ACPI_SET_BITS (dword, 0, ACPI_7BIT_MASK, value) /* Offset 0, Len 7 */
154
155#define ACPI_PLD_GET_IGNORE_COLOR(dword) ACPI_GET_BITS (dword, 7, ACPI_1BIT_MASK)
156#define ACPI_PLD_SET_IGNORE_COLOR(dword,value) ACPI_SET_BITS (dword, 7, ACPI_1BIT_MASK, value) /* Offset 7, Len 1 */
157
158#define ACPI_PLD_GET_COLOR(dword) ACPI_GET_BITS (dword, 8, ACPI_24BIT_MASK)
159#define ACPI_PLD_SET_COLOR(dword,value) ACPI_SET_BITS (dword, 8, ACPI_24BIT_MASK, value) /* Offset 8, Len 24 */
160
161/* Second 32-bit dword, bits 33:63 */
162
163#define ACPI_PLD_GET_WIDTH(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK)
164#define ACPI_PLD_SET_WIDTH(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 32+0=32, Len 16 */
165
166#define ACPI_PLD_GET_HEIGHT(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK)
167#define ACPI_PLD_SET_HEIGHT(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 32+16=48, Len 16 */
168
169/* Third 32-bit dword, bits 64:95 */
170
171#define ACPI_PLD_GET_USER_VISIBLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK)
172#define ACPI_PLD_SET_USER_VISIBLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 64+0=64, Len 1 */
173
174#define ACPI_PLD_GET_DOCK(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK)
175#define ACPI_PLD_SET_DOCK(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 64+1=65, Len 1 */
176
177#define ACPI_PLD_GET_LID(dword) ACPI_GET_BITS (dword, 2, ACPI_1BIT_MASK)
178#define ACPI_PLD_SET_LID(dword,value) ACPI_SET_BITS (dword, 2, ACPI_1BIT_MASK, value) /* Offset 64+2=66, Len 1 */
179
180#define ACPI_PLD_GET_PANEL(dword) ACPI_GET_BITS (dword, 3, ACPI_3BIT_MASK)
181#define ACPI_PLD_SET_PANEL(dword,value) ACPI_SET_BITS (dword, 3, ACPI_3BIT_MASK, value) /* Offset 64+3=67, Len 3 */
182
183#define ACPI_PLD_GET_VERTICAL(dword) ACPI_GET_BITS (dword, 6, ACPI_2BIT_MASK)
184#define ACPI_PLD_SET_VERTICAL(dword,value) ACPI_SET_BITS (dword, 6, ACPI_2BIT_MASK, value) /* Offset 64+6=70, Len 2 */
185
186#define ACPI_PLD_GET_HORIZONTAL(dword) ACPI_GET_BITS (dword, 8, ACPI_2BIT_MASK)
187#define ACPI_PLD_SET_HORIZONTAL(dword,value) ACPI_SET_BITS (dword, 8, ACPI_2BIT_MASK, value) /* Offset 64+8=72, Len 2 */
188
189#define ACPI_PLD_GET_SHAPE(dword) ACPI_GET_BITS (dword, 10, ACPI_4BIT_MASK)
190#define ACPI_PLD_SET_SHAPE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_4BIT_MASK, value) /* Offset 64+10=74, Len 4 */
191
192#define ACPI_PLD_GET_ORIENTATION(dword) ACPI_GET_BITS (dword, 14, ACPI_1BIT_MASK)
193#define ACPI_PLD_SET_ORIENTATION(dword,value) ACPI_SET_BITS (dword, 14, ACPI_1BIT_MASK, value) /* Offset 64+14=78, Len 1 */
194
195#define ACPI_PLD_GET_TOKEN(dword) ACPI_GET_BITS (dword, 15, ACPI_8BIT_MASK)
196#define ACPI_PLD_SET_TOKEN(dword,value) ACPI_SET_BITS (dword, 15, ACPI_8BIT_MASK, value) /* Offset 64+15=79, Len 8 */
197
198#define ACPI_PLD_GET_POSITION(dword) ACPI_GET_BITS (dword, 23, ACPI_8BIT_MASK)
199#define ACPI_PLD_SET_POSITION(dword,value) ACPI_SET_BITS (dword, 23, ACPI_8BIT_MASK, value) /* Offset 64+23=87, Len 8 */
200
201#define ACPI_PLD_GET_BAY(dword) ACPI_GET_BITS (dword, 31, ACPI_1BIT_MASK)
202#define ACPI_PLD_SET_BAY(dword,value) ACPI_SET_BITS (dword, 31, ACPI_1BIT_MASK, value) /* Offset 64+31=95, Len 1 */
203
204/* Fourth 32-bit dword, bits 96:127 */
205
206#define ACPI_PLD_GET_EJECTABLE(dword) ACPI_GET_BITS (dword, 0, ACPI_1BIT_MASK)
207#define ACPI_PLD_SET_EJECTABLE(dword,value) ACPI_SET_BITS (dword, 0, ACPI_1BIT_MASK, value) /* Offset 96+0=96, Len 1 */
208
209#define ACPI_PLD_GET_OSPM_EJECT(dword) ACPI_GET_BITS (dword, 1, ACPI_1BIT_MASK)
210#define ACPI_PLD_SET_OSPM_EJECT(dword,value) ACPI_SET_BITS (dword, 1, ACPI_1BIT_MASK, value) /* Offset 96+1=97, Len 1 */
211
212#define ACPI_PLD_GET_CABINET(dword) ACPI_GET_BITS (dword, 2, ACPI_8BIT_MASK)
213#define ACPI_PLD_SET_CABINET(dword,value) ACPI_SET_BITS (dword, 2, ACPI_8BIT_MASK, value) /* Offset 96+2=98, Len 8 */
214
215#define ACPI_PLD_GET_CARD_CAGE(dword) ACPI_GET_BITS (dword, 10, ACPI_8BIT_MASK)
216#define ACPI_PLD_SET_CARD_CAGE(dword,value) ACPI_SET_BITS (dword, 10, ACPI_8BIT_MASK, value) /* Offset 96+10=106, Len 8 */
217
218#define ACPI_PLD_GET_REFERENCE(dword) ACPI_GET_BITS (dword, 18, ACPI_1BIT_MASK)
219#define ACPI_PLD_SET_REFERENCE(dword,value) ACPI_SET_BITS (dword, 18, ACPI_1BIT_MASK, value) /* Offset 96+18=114, Len 1 */
220
221#define ACPI_PLD_GET_ROTATION(dword) ACPI_GET_BITS (dword, 19, ACPI_4BIT_MASK)
222#define ACPI_PLD_SET_ROTATION(dword,value) ACPI_SET_BITS (dword, 19, ACPI_4BIT_MASK, value) /* Offset 96+19=115, Len 4 */
223
224#define ACPI_PLD_GET_ORDER(dword) ACPI_GET_BITS (dword, 23, ACPI_5BIT_MASK)
225#define ACPI_PLD_SET_ORDER(dword,value) ACPI_SET_BITS (dword, 23, ACPI_5BIT_MASK, value) /* Offset 96+23=119, Len 5 */
226
227/* Fifth 32-bit dword, bits 128:159 (Revision 2 of _PLD only) */
228
229#define ACPI_PLD_GET_VERT_OFFSET(dword) ACPI_GET_BITS (dword, 0, ACPI_16BIT_MASK)
230#define ACPI_PLD_SET_VERT_OFFSET(dword,value) ACPI_SET_BITS (dword, 0, ACPI_16BIT_MASK, value) /* Offset 128+0=128, Len 16 */
231
232#define ACPI_PLD_GET_HORIZ_OFFSET(dword) ACPI_GET_BITS (dword, 16, ACPI_16BIT_MASK)
233#define ACPI_PLD_SET_HORIZ_OFFSET(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 128+16=144, Len 16 */
234
235#endif /* ACBUFFER_H */
diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h
index d988ac54f41e..745dd24e3cb5 100644
--- a/include/acpi/acnames.h
+++ b/include/acpi/acnames.h
@@ -63,11 +63,10 @@
63#define METHOD_NAME__PRW "_PRW" 63#define METHOD_NAME__PRW "_PRW"
64#define METHOD_NAME__SRS "_SRS" 64#define METHOD_NAME__SRS "_SRS"
65#define METHOD_NAME__CBA "_CBA" 65#define METHOD_NAME__CBA "_CBA"
66#define METHOD_NAME__PLD "_PLD"
66 67
67/* Method names - these methods must appear at the namespace root */ 68/* Method names - these methods must appear at the namespace root */
68 69
69#define METHOD_PATHNAME__BFS "\\_BFS"
70#define METHOD_PATHNAME__GTS "\\_GTS"
71#define METHOD_PATHNAME__PTS "\\_PTS" 70#define METHOD_PATHNAME__PTS "\\_PTS"
72#define METHOD_PATHNAME__SST "\\_SI._SST" 71#define METHOD_PATHNAME__SST "\\_SI._SST"
73#define METHOD_PATHNAME__WAK "\\_WAK" 72#define METHOD_PATHNAME__WAK "\\_WAK"
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index bde976ee068d..0daa0fbd8654 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -54,37 +54,8 @@ acpi_status
54acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event, 54acpi_evaluate_hotplug_ost(acpi_handle handle, u32 source_event,
55 u32 status_code, struct acpi_buffer *status_buf); 55 u32 status_code, struct acpi_buffer *status_buf);
56 56
57struct acpi_pld {
58 unsigned int revision:7; /* 0 */
59 unsigned int ignore_colour:1; /* 7 */
60 unsigned int colour:24; /* 8 */
61 unsigned int width:16; /* 32 */
62 unsigned int height:16; /* 48 */
63 unsigned int user_visible:1; /* 64 */
64 unsigned int dock:1; /* 65 */
65 unsigned int lid:1; /* 66 */
66 unsigned int panel:3; /* 67 */
67 unsigned int vertical_pos:2; /* 70 */
68 unsigned int horizontal_pos:2; /* 72 */
69 unsigned int shape:4; /* 74 */
70 unsigned int group_orientation:1; /* 78 */
71 unsigned int group_token:8; /* 79 */
72 unsigned int group_position:8; /* 87 */
73 unsigned int bay:1; /* 95 */
74 unsigned int ejectable:1; /* 96 */
75 unsigned int ospm_eject_required:1; /* 97 */
76 unsigned int cabinet_number:8; /* 98 */
77 unsigned int card_cage_number:8; /* 106 */
78 unsigned int reference:1; /* 114 */
79 unsigned int rotation:4; /* 115 */
80 unsigned int order:5; /* 119 */
81 unsigned int reserved:4; /* 124 */
82 unsigned int vertical_offset:16; /* 128 */
83 unsigned int horizontal_offset:16; /* 144 */
84} __attribute__((__packed__));
85
86acpi_status 57acpi_status
87acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld *pld); 58acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld_info **pld);
88#ifdef CONFIG_ACPI 59#ifdef CONFIG_ACPI
89 60
90#include <linux/proc_fs.h> 61#include <linux/proc_fs.h>
@@ -208,6 +179,7 @@ struct acpi_device_pnp {
208 struct list_head ids; /* _HID and _CIDs */ 179 struct list_head ids; /* _HID and _CIDs */
209 acpi_device_name device_name; /* Driver-determined */ 180 acpi_device_name device_name; /* Driver-determined */
210 acpi_device_class device_class; /* " */ 181 acpi_device_class device_class; /* " */
182 union acpi_object *str_obj; /* unicode string for _STR method */
211}; 183};
212 184
213#define acpi_device_bid(d) ((d)->pnp.bus_id) 185#define acpi_device_bid(d) ((d)->pnp.bus_id)
@@ -282,8 +254,16 @@ struct acpi_device_wakeup {
282 int prepare_count; 254 int prepare_count;
283}; 255};
284 256
285/* Device */ 257struct acpi_device_physical_node {
258 u8 node_id;
259 struct list_head node;
260 struct device *dev;
261};
262
263/* set maximum of physical nodes to 32 for expansibility */
264#define ACPI_MAX_PHYSICAL_NODE 32
286 265
266/* Device */
287struct acpi_device { 267struct acpi_device {
288 int device_type; 268 int device_type;
289 acpi_handle handle; /* no handle for fixed hardware */ 269 acpi_handle handle; /* no handle for fixed hardware */
@@ -304,6 +284,10 @@ struct acpi_device {
304 struct device dev; 284 struct device dev;
305 struct acpi_bus_ops bus_ops; /* workaround for different code path for hotplug */ 285 struct acpi_bus_ops bus_ops; /* workaround for different code path for hotplug */
306 enum acpi_bus_removal_type removal_type; /* indicate for different removal type */ 286 enum acpi_bus_removal_type removal_type; /* indicate for different removal type */
287 u8 physical_node_count;
288 struct list_head physical_node_list;
289 struct mutex physical_node_lock;
290 DECLARE_BITMAP(physical_node_id_bitmap, ACPI_MAX_PHYSICAL_NODE);
307}; 291};
308 292
309static inline void *acpi_driver_data(struct acpi_device *d) 293static inline void *acpi_driver_data(struct acpi_device *d)
@@ -381,6 +365,19 @@ int acpi_match_device_ids(struct acpi_device *device,
381int acpi_create_dir(struct acpi_device *); 365int acpi_create_dir(struct acpi_device *);
382void acpi_remove_dir(struct acpi_device *); 366void acpi_remove_dir(struct acpi_device *);
383 367
368
369/**
370 * module_acpi_driver(acpi_driver) - Helper macro for registering an ACPI driver
371 * @__acpi_driver: acpi_driver struct
372 *
373 * Helper macro for ACPI drivers which do not do anything special in module
374 * init/exit. This eliminates a lot of boilerplate. Each module may only
375 * use this macro once, and calling it replaces module_init() and module_exit()
376 */
377#define module_acpi_driver(__acpi_driver) \
378 module_driver(__acpi_driver, acpi_bus_register_driver, \
379 acpi_bus_unregister_driver)
380
384/* 381/*
385 * Bind physical devices with ACPI devices 382 * Bind physical devices with ACPI devices
386 */ 383 */
@@ -394,7 +391,6 @@ struct acpi_bus_type {
394}; 391};
395int register_acpi_bus_type(struct acpi_bus_type *); 392int register_acpi_bus_type(struct acpi_bus_type *);
396int unregister_acpi_bus_type(struct acpi_bus_type *); 393int unregister_acpi_bus_type(struct acpi_bus_type *);
397struct device *acpi_get_physical_device(acpi_handle);
398 394
399struct acpi_pci_root { 395struct acpi_pci_root {
400 struct list_head node; 396 struct list_head node;
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h
index 51405d32ac64..8b891dbead66 100644
--- a/include/acpi/acpixf.h
+++ b/include/acpi/acpixf.h
@@ -47,11 +47,12 @@
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 0x20120711 50#define ACPI_CA_VERSION 0x20120913
51 51
52#include <acpi/acconfig.h> 52#include <acpi/acconfig.h>
53#include <acpi/actypes.h> 53#include <acpi/actypes.h>
54#include <acpi/actbl.h> 54#include <acpi/actbl.h>
55#include <acpi/acbuffer.h>
55 56
56extern u8 acpi_gbl_permanent_mmap; 57extern u8 acpi_gbl_permanent_mmap;
57 58
@@ -144,6 +145,10 @@ acpi_check_address_range(acpi_adr_space_type space_id,
144 acpi_physical_address address, 145 acpi_physical_address address,
145 acpi_size length, u8 warn); 146 acpi_size length, u8 warn);
146 147
148acpi_status
149acpi_decode_pld_buffer(u8 *in_buffer,
150 acpi_size length, struct acpi_pld_info **return_buffer);
151
147/* 152/*
148 * ACPI Memory management 153 * ACPI Memory management
149 */ 154 */
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h
index 59a73e1b2845..4f94b1d812d5 100644
--- a/include/acpi/actbl.h
+++ b/include/acpi/actbl.h
@@ -79,9 +79,15 @@
79#pragma pack(1) 79#pragma pack(1)
80 80
81/* 81/*
82 * Note about bitfields: The u8 type is used for bitfields in ACPI tables. 82 * Note: C bitfields are not used for this reason:
83 * This is the only type that is even remotely portable. Anything else is not 83 *
84 * portable, so do not use any other bitfield types. 84 * "Bitfields are great and easy to read, but unfortunately the C language
85 * does not specify the layout of bitfields in memory, which means they are
86 * essentially useless for dealing with packed data in on-disk formats or
87 * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
88 * this decision was a design error in C. Ritchie could have picked an order
89 * and stuck with it." Norman Ramsey.
90 * See http://stackoverflow.com/a/1053662/41661
85 */ 91 */
86 92
87/******************************************************************************* 93/*******************************************************************************
@@ -94,7 +100,7 @@
94struct acpi_table_header { 100struct acpi_table_header {
95 char signature[ACPI_NAME_SIZE]; /* ASCII table signature */ 101 char signature[ACPI_NAME_SIZE]; /* ASCII table signature */
96 u32 length; /* Length of table in bytes, including this header */ 102 u32 length; /* Length of table in bytes, including this header */
97 u8 revision; /* ACPI Specification minor version # */ 103 u8 revision; /* ACPI Specification minor version number */
98 u8 checksum; /* To make sum of entire table == 0 */ 104 u8 checksum; /* To make sum of entire table == 0 */
99 char oem_id[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */ 105 char oem_id[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */
100 char oem_table_id[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */ 106 char oem_table_id[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */
@@ -108,7 +114,7 @@ struct acpi_table_header {
108 * GAS - Generic Address Structure (ACPI 2.0+) 114 * GAS - Generic Address Structure (ACPI 2.0+)
109 * 115 *
110 * Note: Since this structure is used in the ACPI tables, it is byte aligned. 116 * Note: Since this structure is used in the ACPI tables, it is byte aligned.
111 * If misaliged access is not supported by the hardware, accesses to the 117 * If misaligned access is not supported by the hardware, accesses to the
112 * 64-bit Address field must be performed with care. 118 * 64-bit Address field must be performed with care.
113 * 119 *
114 ******************************************************************************/ 120 ******************************************************************************/
@@ -210,18 +216,18 @@ struct acpi_table_fadt {
210 u8 preferred_profile; /* Conveys preferred power management profile to OSPM. */ 216 u8 preferred_profile; /* Conveys preferred power management profile to OSPM. */
211 u16 sci_interrupt; /* System vector of SCI interrupt */ 217 u16 sci_interrupt; /* System vector of SCI interrupt */
212 u32 smi_command; /* 32-bit Port address of SMI command port */ 218 u32 smi_command; /* 32-bit Port address of SMI command port */
213 u8 acpi_enable; /* Value to write to smi_cmd to enable ACPI */ 219 u8 acpi_enable; /* Value to write to SMI_CMD to enable ACPI */
214 u8 acpi_disable; /* Value to write to smi_cmd to disable ACPI */ 220 u8 acpi_disable; /* Value to write to SMI_CMD to disable ACPI */
215 u8 s4_bios_request; /* Value to write to SMI CMD to enter S4BIOS state */ 221 u8 s4_bios_request; /* Value to write to SMI_CMD to enter S4BIOS state */
216 u8 pstate_control; /* Processor performance state control */ 222 u8 pstate_control; /* Processor performance state control */
217 u32 pm1a_event_block; /* 32-bit Port address of Power Mgt 1a Event Reg Blk */ 223 u32 pm1a_event_block; /* 32-bit port address of Power Mgt 1a Event Reg Blk */
218 u32 pm1b_event_block; /* 32-bit Port address of Power Mgt 1b Event Reg Blk */ 224 u32 pm1b_event_block; /* 32-bit port address of Power Mgt 1b Event Reg Blk */
219 u32 pm1a_control_block; /* 32-bit Port address of Power Mgt 1a Control Reg Blk */ 225 u32 pm1a_control_block; /* 32-bit port address of Power Mgt 1a Control Reg Blk */
220 u32 pm1b_control_block; /* 32-bit Port address of Power Mgt 1b Control Reg Blk */ 226 u32 pm1b_control_block; /* 32-bit port address of Power Mgt 1b Control Reg Blk */
221 u32 pm2_control_block; /* 32-bit Port address of Power Mgt 2 Control Reg Blk */ 227 u32 pm2_control_block; /* 32-bit port address of Power Mgt 2 Control Reg Blk */
222 u32 pm_timer_block; /* 32-bit Port address of Power Mgt Timer Ctrl Reg Blk */ 228 u32 pm_timer_block; /* 32-bit port address of Power Mgt Timer Ctrl Reg Blk */
223 u32 gpe0_block; /* 32-bit Port address of General Purpose Event 0 Reg Blk */ 229 u32 gpe0_block; /* 32-bit port address of General Purpose Event 0 Reg Blk */
224 u32 gpe1_block; /* 32-bit Port address of General Purpose Event 1 Reg Blk */ 230 u32 gpe1_block; /* 32-bit port address of General Purpose Event 1 Reg Blk */
225 u8 pm1_event_length; /* Byte Length of ports at pm1x_event_block */ 231 u8 pm1_event_length; /* Byte Length of ports at pm1x_event_block */
226 u8 pm1_control_length; /* Byte Length of ports at pm1x_control_block */ 232 u8 pm1_control_length; /* Byte Length of ports at pm1x_control_block */
227 u8 pm2_control_length; /* Byte Length of ports at pm2_control_block */ 233 u8 pm2_control_length; /* Byte Length of ports at pm2_control_block */
@@ -229,12 +235,12 @@ struct acpi_table_fadt {
229 u8 gpe0_block_length; /* Byte Length of ports at gpe0_block */ 235 u8 gpe0_block_length; /* Byte Length of ports at gpe0_block */
230 u8 gpe1_block_length; /* Byte Length of ports at gpe1_block */ 236 u8 gpe1_block_length; /* Byte Length of ports at gpe1_block */
231 u8 gpe1_base; /* Offset in GPE number space where GPE1 events start */ 237 u8 gpe1_base; /* Offset in GPE number space where GPE1 events start */
232 u8 cst_control; /* Support for the _CST object and C States change notification */ 238 u8 cst_control; /* Support for the _CST object and C-States change notification */
233 u16 c2_latency; /* Worst case HW latency to enter/exit C2 state */ 239 u16 c2_latency; /* Worst case HW latency to enter/exit C2 state */
234 u16 c3_latency; /* Worst case HW latency to enter/exit C3 state */ 240 u16 c3_latency; /* Worst case HW latency to enter/exit C3 state */
235 u16 flush_size; /* Processor's memory cache line width, in bytes */ 241 u16 flush_size; /* Processor memory cache line width, in bytes */
236 u16 flush_stride; /* Number of flush strides that need to be read */ 242 u16 flush_stride; /* Number of flush strides that need to be read */
237 u8 duty_offset; /* Processor duty cycle index in processor's P_CNT reg */ 243 u8 duty_offset; /* Processor duty cycle index in processor P_CNT reg */
238 u8 duty_width; /* Processor duty cycle value bit width in P_CNT register */ 244 u8 duty_width; /* Processor duty cycle value bit width in P_CNT register */
239 u8 day_alarm; /* Index to day-of-month alarm in RTC CMOS RAM */ 245 u8 day_alarm; /* Index to day-of-month alarm in RTC CMOS RAM */
240 u8 month_alarm; /* Index to month-of-year alarm in RTC CMOS RAM */ 246 u8 month_alarm; /* Index to month-of-year alarm in RTC CMOS RAM */
@@ -255,11 +261,11 @@ struct acpi_table_fadt {
255 struct acpi_generic_address xpm_timer_block; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */ 261 struct acpi_generic_address xpm_timer_block; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */
256 struct acpi_generic_address xgpe0_block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */ 262 struct acpi_generic_address xgpe0_block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */
257 struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */ 263 struct acpi_generic_address xgpe1_block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */
258 struct acpi_generic_address sleep_control; /* 64-bit Sleep Control register */ 264 struct acpi_generic_address sleep_control; /* 64-bit Sleep Control register (ACPI 5.0) */
259 struct acpi_generic_address sleep_status; /* 64-bit Sleep Status register */ 265 struct acpi_generic_address sleep_status; /* 64-bit Sleep Status register (ACPI 5.0) */
260}; 266};
261 267
262/* Masks for FADT Boot Architecture Flags (boot_flags) */ 268/* Masks for FADT Boot Architecture Flags (boot_flags) [Vx]=Introduced in this FADT revision */
263 269
264#define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */ 270#define ACPI_FADT_LEGACY_DEVICES (1) /* 00: [V2] System has LPC or ISA bus devices */
265#define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */ 271#define ACPI_FADT_8042 (1<<1) /* 01: [V3] System has an 8042 controller on port 60/64 */
@@ -272,13 +278,13 @@ struct acpi_table_fadt {
272 278
273/* Masks for FADT flags */ 279/* Masks for FADT flags */
274 280
275#define ACPI_FADT_WBINVD (1) /* 00: [V1] The wbinvd instruction works properly */ 281#define ACPI_FADT_WBINVD (1) /* 00: [V1] The WBINVD instruction works properly */
276#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] wbinvd flushes but does not invalidate caches */ 282#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: [V1] WBINVD flushes but does not invalidate caches */
277#define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: [V1] All processors support C1 state */ 283#define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: [V1] All processors support C1 state */
278#define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: [V1] C2 state works on MP system */ 284#define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: [V1] C2 state works on MP system */
279#define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: [V1] Power button is handled as a control method device */ 285#define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: [V1] Power button is handled as a control method device */
280#define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: [V1] Sleep button is handled as a control method device */ 286#define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: [V1] Sleep button is handled as a control method device */
281#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: [V1] RTC wakeup status not in fixed register space */ 287#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: [V1] RTC wakeup status is not in fixed register space */
282#define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: [V1] RTC alarm can wake system from S4 */ 288#define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: [V1] RTC alarm can wake system from S4 */
283#define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: [V1] ACPI timer width is 32-bit (0=24-bit) */ 289#define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: [V1] ACPI timer width is 32-bit (0=24-bit) */
284#define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: [V1] Docking supported */ 290#define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: [V1] Docking supported */
@@ -297,7 +303,7 @@ struct acpi_table_fadt {
297 303
298/* Values for preferred_profile (Preferred Power Management Profiles) */ 304/* Values for preferred_profile (Preferred Power Management Profiles) */
299 305
300enum acpi_prefered_pm_profiles { 306enum acpi_preferred_pm_profiles {
301 PM_UNSPECIFIED = 0, 307 PM_UNSPECIFIED = 0,
302 PM_DESKTOP = 1, 308 PM_DESKTOP = 1,
303 PM_MOBILE = 2, 309 PM_MOBILE = 2,
@@ -335,7 +341,7 @@ union acpi_name_union {
335struct acpi_table_desc { 341struct acpi_table_desc {
336 acpi_physical_address address; 342 acpi_physical_address address;
337 struct acpi_table_header *pointer; 343 struct acpi_table_header *pointer;
338 u32 length; /* Length fixed at 32 bits */ 344 u32 length; /* Length fixed at 32 bits (fixed in table header) */
339 union acpi_name_union signature; 345 union acpi_name_union signature;
340 acpi_owner_id owner_id; 346 acpi_owner_id owner_id;
341 u8 flags; 347 u8 flags;
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 300d14e7c5d5..280fc45b59dd 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -79,9 +79,15 @@
79#pragma pack(1) 79#pragma pack(1)
80 80
81/* 81/*
82 * Note about bitfields: The u8 type is used for bitfields in ACPI tables. 82 * Note: C bitfields are not used for this reason:
83 * This is the only type that is even remotely portable. Anything else is not 83 *
84 * portable, so do not use any other bitfield types. 84 * "Bitfields are great and easy to read, but unfortunately the C language
85 * does not specify the layout of bitfields in memory, which means they are
86 * essentially useless for dealing with packed data in on-disk formats or
87 * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
88 * this decision was a design error in C. Ritchie could have picked an order
89 * and stuck with it." Norman Ramsey.
90 * See http://stackoverflow.com/a/1053662/41661
85 */ 91 */
86 92
87/******************************************************************************* 93/*******************************************************************************
@@ -489,7 +495,9 @@ enum acpi_hest_notify_types {
489 ACPI_HEST_NOTIFY_LOCAL = 2, 495 ACPI_HEST_NOTIFY_LOCAL = 2,
490 ACPI_HEST_NOTIFY_SCI = 3, 496 ACPI_HEST_NOTIFY_SCI = 3,
491 ACPI_HEST_NOTIFY_NMI = 4, 497 ACPI_HEST_NOTIFY_NMI = 4,
492 ACPI_HEST_NOTIFY_RESERVED = 5 /* 5 and greater are reserved */ 498 ACPI_HEST_NOTIFY_CMCI = 5, /* ACPI 5.0 */
499 ACPI_HEST_NOTIFY_MCE = 6, /* ACPI 5.0 */
500 ACPI_HEST_NOTIFY_RESERVED = 7 /* 7 and greater are reserved */
493}; 501};
494 502
495/* Values for config_write_enable bitfield above */ 503/* Values for config_write_enable bitfield above */
diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index d9ceb3d31629..1b2b356486d1 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -63,6 +63,8 @@
63 */ 63 */
64#define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */ 64#define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */
65#define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */ 65#define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */
66#define ACPI_SIG_CSRT "CSRT" /* Core System Resource Table */
67#define ACPI_SIG_DBG2 "DBG2" /* Debug Port table type 2 */
66#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */ 68#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */
67#define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */ 69#define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */
68#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ 70#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */
@@ -96,9 +98,15 @@
96#pragma pack(1) 98#pragma pack(1)
97 99
98/* 100/*
99 * Note about bitfields: The u8 type is used for bitfields in ACPI tables. 101 * Note: C bitfields are not used for this reason:
100 * This is the only type that is even remotely portable. Anything else is not 102 *
101 * portable, so do not use any other bitfield types. 103 * "Bitfields are great and easy to read, but unfortunately the C language
104 * does not specify the layout of bitfields in memory, which means they are
105 * essentially useless for dealing with packed data in on-disk formats or
106 * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
107 * this decision was a design error in C. Ritchie could have picked an order
108 * and stuck with it." Norman Ramsey.
109 * See http://stackoverflow.com/a/1053662/41661
102 */ 110 */
103 111
104/******************************************************************************* 112/*******************************************************************************
@@ -232,6 +240,115 @@ struct acpi_table_boot {
232 240
233/******************************************************************************* 241/*******************************************************************************
234 * 242 *
243 * CSRT - Core System Resource Table
244 * Version 0
245 *
246 * Conforms to the "Core System Resource Table (CSRT)", November 14, 2011
247 *
248 ******************************************************************************/
249
250struct acpi_table_csrt {
251 struct acpi_table_header header; /* Common ACPI table header */
252};
253
254/* Resource Group subtable */
255
256struct acpi_csrt_group {
257 u32 length;
258 u32 vendor_id;
259 u32 subvendor_id;
260 u16 device_id;
261 u16 subdevice_id;
262 u16 revision;
263 u16 reserved;
264 u32 info_length;
265
266 /* Shared data (length = info_length) immediately follows */
267};
268
269/* Resource Descriptor subtable */
270
271struct acpi_csrt_descriptor {
272 u32 length;
273 u16 type;
274 u16 subtype;
275 u32 uid;
276
277 /* Resource-specific information immediately follows */
278};
279
280/* Resource Types */
281
282#define ACPI_CSRT_TYPE_INTERRUPT 0x0001
283#define ACPI_CSRT_TYPE_TIMER 0x0002
284#define ACPI_CSRT_TYPE_DMA 0x0003
285
286/* Resource Subtypes */
287
288#define ACPI_CSRT_XRUPT_LINE 0x0000
289#define ACPI_CSRT_XRUPT_CONTROLLER 0x0001
290#define ACPI_CSRT_TIMER 0x0000
291#define ACPI_CSRT_DMA_CHANNEL 0x0000
292#define ACPI_CSRT_DMA_CONTROLLER 0x0001
293
294/*******************************************************************************
295 *
296 * DBG2 - Debug Port Table 2
297 * Version 0 (Both main table and subtables)
298 *
299 * Conforms to "Microsoft Debug Port Table 2 (DBG2)", May 22 2012.
300 *
301 ******************************************************************************/
302
303struct acpi_table_dbg2 {
304 struct acpi_table_header header; /* Common ACPI table header */
305 u32 info_offset;
306 u32 info_count;
307};
308
309/* Debug Device Information Subtable */
310
311struct acpi_dbg2_device {
312 u8 revision;
313 u16 length;
314 u8 register_count; /* Number of base_address registers */
315 u16 namepath_length;
316 u16 namepath_offset;
317 u16 oem_data_length;
318 u16 oem_data_offset;
319 u16 port_type;
320 u16 port_subtype;
321 u16 reserved;
322 u16 base_address_offset;
323 u16 address_size_offset;
324 /*
325 * Data that follows:
326 * base_address (required) - Each in 12-byte Generic Address Structure format.
327 * address_size (required) - Array of u32 sizes corresponding to each base_address register.
328 * Namepath (required) - Null terminated string. Single dot if not supported.
329 * oem_data (optional) - Length is oem_data_length.
330 */
331};
332
333/* Types for port_type field above */
334
335#define ACPI_DBG2_SERIAL_PORT 0x8000
336#define ACPI_DBG2_1394_PORT 0x8001
337#define ACPI_DBG2_USB_PORT 0x8002
338#define ACPI_DBG2_NET_PORT 0x8003
339
340/* Subtypes for port_subtype field above */
341
342#define ACPI_DBG2_16550_COMPATIBLE 0x0000
343#define ACPI_DBG2_16550_SUBSET 0x0001
344
345#define ACPI_DBG2_1394_STANDARD 0x0000
346
347#define ACPI_DBG2_USB_XHCI 0x0000
348#define ACPI_DBG2_USB_EHCI 0x0001
349
350/*******************************************************************************
351 *
235 * DBGP - Debug Port table 352 * DBGP - Debug Port table
236 * Version 1 353 * Version 1
237 * 354 *
diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h
index f65a0ed869eb..8c61b5fe42a4 100644
--- a/include/acpi/actbl3.h
+++ b/include/acpi/actbl3.h
@@ -75,7 +75,6 @@
75/* Reserved table signatures */ 75/* Reserved table signatures */
76 76
77#define ACPI_SIG_CSRT "CSRT" /* Core System Resources Table */ 77#define ACPI_SIG_CSRT "CSRT" /* Core System Resources Table */
78#define ACPI_SIG_DBG2 "DBG2" /* Debug Port table 2 */
79#define ACPI_SIG_MATR "MATR" /* Memory Address Translation Table */ 78#define ACPI_SIG_MATR "MATR" /* Memory Address Translation Table */
80#define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */ 79#define ACPI_SIG_MSDM "MSDM" /* Microsoft Data Management Table */
81#define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */ 80#define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */
@@ -87,9 +86,15 @@
87#pragma pack(1) 86#pragma pack(1)
88 87
89/* 88/*
90 * Note about bitfields: The u8 type is used for bitfields in ACPI tables. 89 * Note: C bitfields are not used for this reason:
91 * This is the only type that is even remotely portable. Anything else is not 90 *
92 * portable, so do not use any other bitfield types. 91 * "Bitfields are great and easy to read, but unfortunately the C language
92 * does not specify the layout of bitfields in memory, which means they are
93 * essentially useless for dealing with packed data in on-disk formats or
94 * binary wire protocols." (Or ACPI tables and buffers.) "If you ask me,
95 * this decision was a design error in C. Ritchie could have picked an order
96 * and stuck with it." Norman Ramsey.
97 * See http://stackoverflow.com/a/1053662/41661
93 */ 98 */
94 99
95/******************************************************************************* 100/*******************************************************************************
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 3d00bd5bd7e3..a85bae968262 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -519,13 +519,6 @@ typedef u64 acpi_integer;
519#define ACPI_SLEEP_TYPE_INVALID 0xFF 519#define ACPI_SLEEP_TYPE_INVALID 0xFF
520 520
521/* 521/*
522 * Sleep/Wake flags
523 */
524#define ACPI_NO_OPTIONAL_METHODS 0x00 /* Do not execute any optional methods */
525#define ACPI_EXECUTE_GTS 0x01 /* For enter sleep interface */
526#define ACPI_EXECUTE_BFS 0x02 /* For leave sleep prep interface */
527
528/*
529 * Standard notify values 522 * Standard notify values
530 */ 523 */
531#define ACPI_NOTIFY_BUS_CHECK (u8) 0x00 524#define ACPI_NOTIFY_BUS_CHECK (u8) 0x00
diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
deleted file mode 100644
index 2c85a0f647b7..000000000000
--- a/include/asm-generic/Kbuild
+++ /dev/null
@@ -1,35 +0,0 @@
1header-y += auxvec.h
2header-y += bitsperlong.h
3header-y += errno-base.h
4header-y += errno.h
5header-y += fcntl.h
6header-y += int-l64.h
7header-y += int-ll64.h
8header-y += ioctl.h
9header-y += ioctls.h
10header-y += ipcbuf.h
11header-y += kvm_para.h
12header-y += mman-common.h
13header-y += mman.h
14header-y += msgbuf.h
15header-y += param.h
16header-y += poll.h
17header-y += posix_types.h
18header-y += resource.h
19header-y += sembuf.h
20header-y += setup.h
21header-y += shmbuf.h
22header-y += shmparam.h
23header-y += siginfo.h
24header-y += signal-defs.h
25header-y += signal.h
26header-y += socket.h
27header-y += sockios.h
28header-y += stat.h
29header-y += statfs.h
30header-y += swab.h
31header-y += termbits.h
32header-y += termios.h
33header-y += types.h
34header-y += ucontext.h
35header-y += unistd.h
diff --git a/include/asm-generic/bitops/count_zeros.h b/include/asm-generic/bitops/count_zeros.h
new file mode 100644
index 000000000000..97520d21fe62
--- /dev/null
+++ b/include/asm-generic/bitops/count_zeros.h
@@ -0,0 +1,57 @@
1/* Count leading and trailing zeros functions
2 *
3 * Copyright (C) 2012 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
12#ifndef _ASM_GENERIC_BITOPS_COUNT_ZEROS_H_
13#define _ASM_GENERIC_BITOPS_COUNT_ZEROS_H_
14
15#include <asm/bitops.h>
16
17/**
18 * count_leading_zeros - Count the number of zeros from the MSB back
19 * @x: The value
20 *
21 * Count the number of leading zeros from the MSB going towards the LSB in @x.
22 *
23 * If the MSB of @x is set, the result is 0.
24 * If only the LSB of @x is set, then the result is BITS_PER_LONG-1.
25 * If @x is 0 then the result is COUNT_LEADING_ZEROS_0.
26 */
27static inline int count_leading_zeros(unsigned long x)
28{
29 if (sizeof(x) == 4)
30 return BITS_PER_LONG - fls(x);
31 else
32 return BITS_PER_LONG - fls64(x);
33}
34
35#define COUNT_LEADING_ZEROS_0 BITS_PER_LONG
36
37/**
38 * count_trailing_zeros - Count the number of zeros from the LSB forwards
39 * @x: The value
40 *
41 * Count the number of trailing zeros from the LSB going towards the MSB in @x.
42 *
43 * If the LSB of @x is set, the result is 0.
44 * If only the MSB of @x is set, then the result is BITS_PER_LONG-1.
45 * If @x is 0 then the result is COUNT_TRAILING_ZEROS_0.
46 */
47static inline int count_trailing_zeros(unsigned long x)
48{
49#define COUNT_TRAILING_ZEROS_0 (-1)
50
51 if (sizeof(x) == 4)
52 return ffs(x);
53 else
54 return (x != 0) ? __ffs(x) : COUNT_TRAILING_ZEROS_0;
55}
56
57#endif /* _ASM_GENERIC_BITOPS_COUNT_ZEROS_H_ */
diff --git a/include/asm-generic/bitops/le.h b/include/asm-generic/bitops/le.h
index f95c663a6a41..61731543c00e 100644
--- a/include/asm-generic/bitops/le.h
+++ b/include/asm-generic/bitops/le.h
@@ -54,6 +54,16 @@ static inline int test_bit_le(int nr, const void *addr)
54 return test_bit(nr ^ BITOP_LE_SWIZZLE, addr); 54 return test_bit(nr ^ BITOP_LE_SWIZZLE, addr);
55} 55}
56 56
57static inline void set_bit_le(int nr, void *addr)
58{
59 set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
60}
61
62static inline void clear_bit_le(int nr, void *addr)
63{
64 clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
65}
66
57static inline void __set_bit_le(int nr, void *addr) 67static inline void __set_bit_le(int nr, void *addr)
58{ 68{
59 __set_bit(nr ^ BITOP_LE_SWIZZLE, addr); 69 __set_bit(nr ^ BITOP_LE_SWIZZLE, addr);
diff --git a/include/asm-generic/bitsperlong.h b/include/asm-generic/bitsperlong.h
index a7b0914348fd..d1d70aa19021 100644
--- a/include/asm-generic/bitsperlong.h
+++ b/include/asm-generic/bitsperlong.h
@@ -1,18 +1,8 @@
1#ifndef __ASM_GENERIC_BITS_PER_LONG 1#ifndef __ASM_GENERIC_BITS_PER_LONG
2#define __ASM_GENERIC_BITS_PER_LONG 2#define __ASM_GENERIC_BITS_PER_LONG
3 3
4/* 4#include <uapi/asm-generic/bitsperlong.h>
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 5
15#ifdef __KERNEL__
16 6
17#ifdef CONFIG_64BIT 7#ifdef CONFIG_64BIT
18#define BITS_PER_LONG 64 8#define BITS_PER_LONG 64
@@ -32,5 +22,4 @@
32#define BITS_PER_LONG_LONG 64 22#define BITS_PER_LONG_LONG 64
33#endif 23#endif
34 24
35#endif /* __KERNEL__ */
36#endif /* __ASM_GENERIC_BITS_PER_LONG */ 25#endif /* __ASM_GENERIC_BITS_PER_LONG */
diff --git a/include/asm-generic/clkdev.h b/include/asm-generic/clkdev.h
new file mode 100644
index 000000000000..90a32a61dd21
--- /dev/null
+++ b/include/asm-generic/clkdev.h
@@ -0,0 +1,28 @@
1/*
2 * include/asm-generic/clkdev.h
3 *
4 * Based on the ARM clkdev.h:
5 * Copyright (C) 2008 Russell King.
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 * Helper for the clk API to assist looking up a struct clk.
12 */
13#ifndef __ASM_CLKDEV_H
14#define __ASM_CLKDEV_H
15
16#include <linux/slab.h>
17
18struct clk;
19
20static inline int __clk_get(struct clk *clk) { return 1; }
21static inline void __clk_put(struct clk *clk) { }
22
23static inline struct clk_lookup_alloc *__clkdev_alloc(size_t size)
24{
25 return kzalloc(size, GFP_KERNEL);
26}
27
28#endif
diff --git a/include/asm-generic/int-l64.h b/include/asm-generic/int-l64.h
index 1ca3efc976cc..27d4ec0dfce0 100644
--- a/include/asm-generic/int-l64.h
+++ b/include/asm-generic/int-l64.h
@@ -4,33 +4,11 @@
4 * Integer declarations for architectures which use "long" 4 * Integer declarations for architectures which use "long"
5 * for 64-bit types. 5 * for 64-bit types.
6 */ 6 */
7
8#ifndef _ASM_GENERIC_INT_L64_H 7#ifndef _ASM_GENERIC_INT_L64_H
9#define _ASM_GENERIC_INT_L64_H 8#define _ASM_GENERIC_INT_L64_H
10 9
11#include <asm/bitsperlong.h> 10#include <uapi/asm-generic/int-l64.h>
12
13#ifndef __ASSEMBLY__
14/*
15 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
16 * header files exported to user space
17 */
18
19typedef __signed__ char __s8;
20typedef unsigned char __u8;
21 11
22typedef __signed__ short __s16;
23typedef unsigned short __u16;
24
25typedef __signed__ int __s32;
26typedef unsigned int __u32;
27
28typedef __signed__ long __s64;
29typedef unsigned long __u64;
30
31#endif /* __ASSEMBLY__ */
32
33#ifdef __KERNEL__
34 12
35#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
36 14
@@ -68,6 +46,4 @@ typedef unsigned long u64;
68 46
69#endif /* __ASSEMBLY__ */ 47#endif /* __ASSEMBLY__ */
70 48
71#endif /* __KERNEL__ */
72
73#endif /* _ASM_GENERIC_INT_L64_H */ 49#endif /* _ASM_GENERIC_INT_L64_H */
diff --git a/include/asm-generic/int-ll64.h b/include/asm-generic/int-ll64.h
index f394147c0739..4cd84855cb46 100644
--- a/include/asm-generic/int-ll64.h
+++ b/include/asm-generic/int-ll64.h
@@ -4,38 +4,11 @@
4 * Integer declarations for architectures which use "long long" 4 * Integer declarations for architectures which use "long long"
5 * for 64-bit types. 5 * for 64-bit types.
6 */ 6 */
7
8#ifndef _ASM_GENERIC_INT_LL64_H 7#ifndef _ASM_GENERIC_INT_LL64_H
9#define _ASM_GENERIC_INT_LL64_H 8#define _ASM_GENERIC_INT_LL64_H
10 9
11#include <asm/bitsperlong.h> 10#include <uapi/asm-generic/int-ll64.h>
12
13#ifndef __ASSEMBLY__
14/*
15 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
16 * header files exported to user space
17 */
18
19typedef __signed__ char __s8;
20typedef unsigned char __u8;
21 11
22typedef __signed__ short __s16;
23typedef unsigned short __u16;
24
25typedef __signed__ int __s32;
26typedef unsigned int __u32;
27
28#ifdef __GNUC__
29__extension__ typedef __signed__ long long __s64;
30__extension__ typedef unsigned long long __u64;
31#else
32typedef __signed__ long long __s64;
33typedef unsigned long long __u64;
34#endif
35
36#endif /* __ASSEMBLY__ */
37
38#ifdef __KERNEL__
39 12
40#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
41 14
@@ -73,6 +46,4 @@ typedef unsigned long long u64;
73 46
74#endif /* __ASSEMBLY__ */ 47#endif /* __ASSEMBLY__ */
75 48
76#endif /* __KERNEL__ */
77
78#endif /* _ASM_GENERIC_INT_LL64_H */ 49#endif /* _ASM_GENERIC_INT_LL64_H */
diff --git a/include/asm-generic/ioctl.h b/include/asm-generic/ioctl.h
index 15828b2d663c..d17295b290fa 100644
--- a/include/asm-generic/ioctl.h
+++ b/include/asm-generic/ioctl.h
@@ -1,105 +1,12 @@
1#ifndef _ASM_GENERIC_IOCTL_H 1#ifndef _ASM_GENERIC_IOCTL_H
2#define _ASM_GENERIC_IOCTL_H 2#define _ASM_GENERIC_IOCTL_H
3 3
4/* ioctl command encoding: 32 bits total, command in lower 16 bits, 4#include <uapi/asm-generic/ioctl.h>
5 * size of the parameter structure in the lower 14 bits of the
6 * upper 16 bits.
7 * Encoding the size of the parameter structure in the ioctl request
8 * is useful for catching programs compiled with old versions
9 * and to avoid overwriting user space outside the user buffer area.
10 * The highest 2 bits are reserved for indicating the ``access mode''.
11 * NOTE: This limits the max parameter size to 16kB -1 !
12 */
13 5
14/*
15 * The following is for compatibility across the various Linux
16 * platforms. The generic ioctl numbering scheme doesn't really enforce
17 * a type field. De facto, however, the top 8 bits of the lower 16
18 * bits are indeed used as a type field, so we might just as well make
19 * this explicit here. Please be sure to use the decoding macros
20 * below from now on.
21 */
22#define _IOC_NRBITS 8
23#define _IOC_TYPEBITS 8
24
25/*
26 * Let any architecture override either of the following before
27 * including this file.
28 */
29
30#ifndef _IOC_SIZEBITS
31# define _IOC_SIZEBITS 14
32#endif
33
34#ifndef _IOC_DIRBITS
35# define _IOC_DIRBITS 2
36#endif
37
38#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
39#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
40#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
41#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
42
43#define _IOC_NRSHIFT 0
44#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
45#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
46#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
47
48/*
49 * Direction bits, which any architecture can choose to override
50 * before including this file.
51 */
52
53#ifndef _IOC_NONE
54# define _IOC_NONE 0U
55#endif
56
57#ifndef _IOC_WRITE
58# define _IOC_WRITE 1U
59#endif
60
61#ifndef _IOC_READ
62# define _IOC_READ 2U
63#endif
64
65#define _IOC(dir,type,nr,size) \
66 (((dir) << _IOC_DIRSHIFT) | \
67 ((type) << _IOC_TYPESHIFT) | \
68 ((nr) << _IOC_NRSHIFT) | \
69 ((size) << _IOC_SIZESHIFT))
70
71#ifdef __KERNEL__
72/* provoke compile error for invalid uses of size argument */ 6/* provoke compile error for invalid uses of size argument */
73extern unsigned int __invalid_size_argument_for_IOC; 7extern unsigned int __invalid_size_argument_for_IOC;
74#define _IOC_TYPECHECK(t) \ 8#define _IOC_TYPECHECK(t) \
75 ((sizeof(t) == sizeof(t[1]) && \ 9 ((sizeof(t) == sizeof(t[1]) && \
76 sizeof(t) < (1 << _IOC_SIZEBITS)) ? \ 10 sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
77 sizeof(t) : __invalid_size_argument_for_IOC) 11 sizeof(t) : __invalid_size_argument_for_IOC)
78#else
79#define _IOC_TYPECHECK(t) (sizeof(t))
80#endif
81
82/* used to create numbers */
83#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
84#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
85#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
86#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
87#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
88#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
89#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
90
91/* used to decode ioctl numbers.. */
92#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
93#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
94#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
95#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
96
97/* ...and for the drivers/sound files... */
98
99#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
100#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
101#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
102#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
103#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
104
105#endif /* _ASM_GENERIC_IOCTL_H */ 12#endif /* _ASM_GENERIC_IOCTL_H */
diff --git a/include/asm-generic/kvm_para.h b/include/asm-generic/kvm_para.h
index 5cba37f9eae1..9d96605f160a 100644
--- a/include/asm-generic/kvm_para.h
+++ b/include/asm-generic/kvm_para.h
@@ -1,7 +1,8 @@
1#ifndef _ASM_GENERIC_KVM_PARA_H 1#ifndef _ASM_GENERIC_KVM_PARA_H
2#define _ASM_GENERIC_KVM_PARA_H 2#define _ASM_GENERIC_KVM_PARA_H
3 3
4#ifdef __KERNEL__ 4#include <uapi/asm-generic/kvm_para.h>
5
5 6
6/* 7/*
7 * This function is used by architectures that support kvm to avoid issuing 8 * This function is used by architectures that support kvm to avoid issuing
@@ -17,6 +18,4 @@ static inline unsigned int kvm_arch_para_features(void)
17 return 0; 18 return 0;
18} 19}
19 20
20#endif /* _KERNEL__ */
21
22#endif 21#endif
diff --git a/include/asm-generic/module.h b/include/asm-generic/module.h
index ed5b44de4c91..14dc41d185a7 100644
--- a/include/asm-generic/module.h
+++ b/include/asm-generic/module.h
@@ -5,18 +5,44 @@
5 * Many architectures just need a simple module 5 * Many architectures just need a simple module
6 * loader without arch specific data. 6 * loader without arch specific data.
7 */ 7 */
8#ifndef CONFIG_HAVE_MOD_ARCH_SPECIFIC
8struct mod_arch_specific 9struct mod_arch_specific
9{ 10{
10}; 11};
12#endif
11 13
12#ifdef CONFIG_64BIT 14#ifdef CONFIG_64BIT
13#define Elf_Shdr Elf64_Shdr 15#define Elf_Shdr Elf64_Shdr
14#define Elf_Sym Elf64_Sym 16#define Elf_Phdr Elf64_Phdr
15#define Elf_Ehdr Elf64_Ehdr 17#define Elf_Sym Elf64_Sym
16#else 18#define Elf_Dyn Elf64_Dyn
17#define Elf_Shdr Elf32_Shdr 19#define Elf_Ehdr Elf64_Ehdr
18#define Elf_Sym Elf32_Sym 20#define Elf_Addr Elf64_Addr
19#define Elf_Ehdr Elf32_Ehdr 21#ifdef CONFIG_MODULES_USE_ELF_REL
22#define Elf_Rel Elf64_Rel
23#endif
24#ifdef CONFIG_MODULES_USE_ELF_RELA
25#define Elf_Rela Elf64_Rela
26#endif
27#define ELF_R_TYPE(X) ELF64_R_TYPE(X)
28#define ELF_R_SYM(X) ELF64_R_SYM(X)
29
30#else /* CONFIG_64BIT */
31
32#define Elf_Shdr Elf32_Shdr
33#define Elf_Phdr Elf32_Phdr
34#define Elf_Sym Elf32_Sym
35#define Elf_Dyn Elf32_Dyn
36#define Elf_Ehdr Elf32_Ehdr
37#define Elf_Addr Elf32_Addr
38#ifdef CONFIG_MODULES_USE_ELF_REL
39#define Elf_Rel Elf32_Rel
40#endif
41#ifdef CONFIG_MODULES_USE_ELF_RELA
42#define Elf_Rela Elf32_Rela
43#endif
44#define ELF_R_TYPE(X) ELF32_R_TYPE(X)
45#define ELF_R_SYM(X) ELF32_R_SYM(X)
20#endif 46#endif
21 47
22#endif /* __ASM_GENERIC_MODULE_H */ 48#endif /* __ASM_GENERIC_MODULE_H */
diff --git a/include/asm-generic/param.h b/include/asm-generic/param.h
index 835632a3b468..04e715bccceb 100644
--- a/include/asm-generic/param.h
+++ b/include/asm-generic/param.h
@@ -1,25 +1,10 @@
1#ifndef __ASM_GENERIC_PARAM_H 1#ifndef __ASM_GENERIC_PARAM_H
2#define __ASM_GENERIC_PARAM_H 2#define __ASM_GENERIC_PARAM_H
3 3
4#ifndef HZ 4#include <uapi/asm-generic/param.h>
5#define HZ 100
6#endif
7 5
8#ifndef EXEC_PAGESIZE
9#define EXEC_PAGESIZE 4096
10#endif
11
12#ifndef NOGROUP
13#define NOGROUP (-1)
14#endif
15
16#define MAXHOSTNAMELEN 64 /* max length of hostname */
17
18#ifdef __KERNEL__
19# undef HZ 6# undef HZ
20# define HZ CONFIG_HZ /* Internal kernel timer frequency */ 7# define HZ CONFIG_HZ /* Internal kernel timer frequency */
21# define USER_HZ 100 /* some user interfaces are */ 8# define USER_HZ 100 /* some user interfaces are */
22# define CLOCKS_PER_SEC (USER_HZ) /* in "ticks" like times() */ 9# define CLOCKS_PER_SEC (USER_HZ) /* in "ticks" like times() */
23#endif
24
25#endif /* __ASM_GENERIC_PARAM_H */ 10#endif /* __ASM_GENERIC_PARAM_H */
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index ff4947b7a976..b36ce40bd1c6 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -87,7 +87,7 @@ static inline pmd_t pmdp_get_and_clear(struct mm_struct *mm,
87 pmd_t *pmdp) 87 pmd_t *pmdp)
88{ 88{
89 pmd_t pmd = *pmdp; 89 pmd_t pmd = *pmdp;
90 pmd_clear(mm, address, pmdp); 90 pmd_clear(pmdp);
91 return pmd; 91 return pmd;
92} 92}
93#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 93#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
@@ -162,6 +162,19 @@ extern void pmdp_splitting_flush(struct vm_area_struct *vma,
162 unsigned long address, pmd_t *pmdp); 162 unsigned long address, pmd_t *pmdp);
163#endif 163#endif
164 164
165#ifndef __HAVE_ARCH_PGTABLE_DEPOSIT
166extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable);
167#endif
168
169#ifndef __HAVE_ARCH_PGTABLE_WITHDRAW
170extern pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm);
171#endif
172
173#ifndef __HAVE_ARCH_PMDP_INVALIDATE
174extern void pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
175 pmd_t *pmdp);
176#endif
177
165#ifndef __HAVE_ARCH_PTE_SAME 178#ifndef __HAVE_ARCH_PTE_SAME
166static inline int pte_same(pte_t pte_a, pte_t pte_b) 179static inline int pte_same(pte_t pte_a, pte_t pte_b)
167{ 180{
@@ -381,48 +394,59 @@ static inline void ptep_modify_prot_commit(struct mm_struct *mm,
381 394
382#ifndef __HAVE_PFNMAP_TRACKING 395#ifndef __HAVE_PFNMAP_TRACKING
383/* 396/*
384 * Interface that can be used by architecture code to keep track of 397 * Interfaces that can be used by architecture code to keep track of
385 * memory type of pfn mappings (remap_pfn_range, vm_insert_pfn) 398 * memory type of pfn mappings specified by the remap_pfn_range,
386 * 399 * vm_insert_pfn.
387 * track_pfn_vma_new is called when a _new_ pfn mapping is being established 400 */
388 * for physical range indicated by pfn and size. 401
402/*
403 * track_pfn_remap is called when a _new_ pfn mapping is being established
404 * by remap_pfn_range() for physical range indicated by pfn and size.
389 */ 405 */
390static inline int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t *prot, 406static inline int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot,
391 unsigned long pfn, unsigned long size) 407 unsigned long pfn, unsigned long addr,
408 unsigned long size)
392{ 409{
393 return 0; 410 return 0;
394} 411}
395 412
396/* 413/*
397 * Interface that can be used by architecture code to keep track of 414 * track_pfn_insert is called when a _new_ single pfn is established
398 * memory type of pfn mappings (remap_pfn_range, vm_insert_pfn) 415 * by vm_insert_pfn().
399 * 416 */
400 * track_pfn_vma_copy is called when vma that is covering the pfnmap gets 417static inline int track_pfn_insert(struct vm_area_struct *vma, pgprot_t *prot,
418 unsigned long pfn)
419{
420 return 0;
421}
422
423/*
424 * track_pfn_copy is called when vma that is covering the pfnmap gets
401 * copied through copy_page_range(). 425 * copied through copy_page_range().
402 */ 426 */
403static inline int track_pfn_vma_copy(struct vm_area_struct *vma) 427static inline int track_pfn_copy(struct vm_area_struct *vma)
404{ 428{
405 return 0; 429 return 0;
406} 430}
407 431
408/* 432/*
409 * Interface that can be used by architecture code to keep track of
410 * memory type of pfn mappings (remap_pfn_range, vm_insert_pfn)
411 *
412 * untrack_pfn_vma is called while unmapping a pfnmap for a region. 433 * untrack_pfn_vma is called while unmapping a pfnmap for a region.
413 * untrack can be called for a specific region indicated by pfn and size or 434 * untrack can be called for a specific region indicated by pfn and size or
414 * can be for the entire vma (in which case size can be zero). 435 * can be for the entire vma (in which case pfn, size are zero).
415 */ 436 */
416static inline void untrack_pfn_vma(struct vm_area_struct *vma, 437static inline void untrack_pfn(struct vm_area_struct *vma,
417 unsigned long pfn, unsigned long size) 438 unsigned long pfn, unsigned long size)
418{ 439{
419} 440}
420#else 441#else
421extern int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t *prot, 442extern int track_pfn_remap(struct vm_area_struct *vma, pgprot_t *prot,
422 unsigned long pfn, unsigned long size); 443 unsigned long pfn, unsigned long addr,
423extern int track_pfn_vma_copy(struct vm_area_struct *vma); 444 unsigned long size);
424extern void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn, 445extern int track_pfn_insert(struct vm_area_struct *vma, pgprot_t *prot,
425 unsigned long size); 446 unsigned long pfn);
447extern int track_pfn_copy(struct vm_area_struct *vma);
448extern void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn,
449 unsigned long size);
426#endif 450#endif
427 451
428#ifdef CONFIG_MMU 452#ifdef CONFIG_MMU
diff --git a/include/asm-generic/resource.h b/include/asm-generic/resource.h
index 61fa862fe08d..b4ea8f50fc65 100644
--- a/include/asm-generic/resource.h
+++ b/include/asm-generic/resource.h
@@ -1,70 +1,8 @@
1#ifndef _ASM_GENERIC_RESOURCE_H 1#ifndef _ASM_GENERIC_RESOURCE_H
2#define _ASM_GENERIC_RESOURCE_H 2#define _ASM_GENERIC_RESOURCE_H
3 3
4/* 4#include <uapi/asm-generic/resource.h>
5 * Resource limit IDs
6 *
7 * ( Compatibility detail: there are architectures that have
8 * a different rlimit ID order in the 5-9 range and want
9 * to keep that order for binary compatibility. The reasons
10 * are historic and all new rlimits are identical across all
11 * arches. If an arch has such special order for some rlimits
12 * then it defines them prior including asm-generic/resource.h. )
13 */
14
15#define RLIMIT_CPU 0 /* CPU time in sec */
16#define RLIMIT_FSIZE 1 /* Maximum filesize */
17#define RLIMIT_DATA 2 /* max data size */
18#define RLIMIT_STACK 3 /* max stack size */
19#define RLIMIT_CORE 4 /* max core file size */
20
21#ifndef RLIMIT_RSS
22# define RLIMIT_RSS 5 /* max resident set size */
23#endif
24
25#ifndef RLIMIT_NPROC
26# define RLIMIT_NPROC 6 /* max number of processes */
27#endif
28
29#ifndef RLIMIT_NOFILE
30# define RLIMIT_NOFILE 7 /* max number of open files */
31#endif
32 5
33#ifndef RLIMIT_MEMLOCK
34# define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */
35#endif
36
37#ifndef RLIMIT_AS
38# define RLIMIT_AS 9 /* address space limit */
39#endif
40
41#define RLIMIT_LOCKS 10 /* maximum file locks held */
42#define RLIMIT_SIGPENDING 11 /* max number of pending signals */
43#define RLIMIT_MSGQUEUE 12 /* maximum bytes in POSIX mqueues */
44#define RLIMIT_NICE 13 /* max nice prio allowed to raise to
45 0-39 for nice level 19 .. -20 */
46#define RLIMIT_RTPRIO 14 /* maximum realtime priority */
47#define RLIMIT_RTTIME 15 /* timeout for RT tasks in us */
48#define RLIM_NLIMITS 16
49
50/*
51 * SuS says limits have to be unsigned.
52 * Which makes a ton more sense anyway.
53 *
54 * Some architectures override this (for compatibility reasons):
55 */
56#ifndef RLIM_INFINITY
57# define RLIM_INFINITY (~0UL)
58#endif
59
60/*
61 * RLIMIT_STACK default maximum - some architectures override it:
62 */
63#ifndef _STK_LIM_MAX
64# define _STK_LIM_MAX RLIM_INFINITY
65#endif
66
67#ifdef __KERNEL__
68 6
69/* 7/*
70 * boot-time rlimit defaults for the init task: 8 * boot-time rlimit defaults for the init task:
@@ -89,6 +27,4 @@
89 [RLIMIT_RTTIME] = { RLIM_INFINITY, RLIM_INFINITY }, \ 27 [RLIMIT_RTTIME] = { RLIM_INFINITY, RLIM_INFINITY }, \
90} 28}
91 29
92#endif /* __KERNEL__ */
93
94#endif 30#endif
diff --git a/include/asm-generic/siginfo.h b/include/asm-generic/siginfo.h
index 8ed67779fc09..b685d3bd32e2 100644
--- a/include/asm-generic/siginfo.h
+++ b/include/asm-generic/siginfo.h
@@ -1,145 +1,8 @@
1#ifndef _ASM_GENERIC_SIGINFO_H 1#ifndef _ASM_GENERIC_SIGINFO_H
2#define _ASM_GENERIC_SIGINFO_H 2#define _ASM_GENERIC_SIGINFO_H
3 3
4#include <linux/compiler.h> 4#include <uapi/asm-generic/siginfo.h>
5#include <linux/types.h>
6 5
7typedef union sigval {
8 int sival_int;
9 void __user *sival_ptr;
10} sigval_t;
11
12/*
13 * This is the size (including padding) of the part of the
14 * struct siginfo that is before the union.
15 */
16#ifndef __ARCH_SI_PREAMBLE_SIZE
17#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
18#endif
19
20#define SI_MAX_SIZE 128
21#ifndef SI_PAD_SIZE
22#define SI_PAD_SIZE ((SI_MAX_SIZE - __ARCH_SI_PREAMBLE_SIZE) / sizeof(int))
23#endif
24
25#ifndef __ARCH_SI_UID_T
26#define __ARCH_SI_UID_T __kernel_uid32_t
27#endif
28
29/*
30 * The default "si_band" type is "long", as specified by POSIX.
31 * However, some architectures want to override this to "int"
32 * for historical compatibility reasons, so we allow that.
33 */
34#ifndef __ARCH_SI_BAND_T
35#define __ARCH_SI_BAND_T long
36#endif
37
38#ifndef __ARCH_SI_CLOCK_T
39#define __ARCH_SI_CLOCK_T __kernel_clock_t
40#endif
41
42#ifndef __ARCH_SI_ATTRIBUTES
43#define __ARCH_SI_ATTRIBUTES
44#endif
45
46#ifndef HAVE_ARCH_SIGINFO_T
47
48typedef struct siginfo {
49 int si_signo;
50 int si_errno;
51 int si_code;
52
53 union {
54 int _pad[SI_PAD_SIZE];
55
56 /* kill() */
57 struct {
58 __kernel_pid_t _pid; /* sender's pid */
59 __ARCH_SI_UID_T _uid; /* sender's uid */
60 } _kill;
61
62 /* POSIX.1b timers */
63 struct {
64 __kernel_timer_t _tid; /* timer id */
65 int _overrun; /* overrun count */
66 char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
67 sigval_t _sigval; /* same as below */
68 int _sys_private; /* not to be passed to user */
69 } _timer;
70
71 /* POSIX.1b signals */
72 struct {
73 __kernel_pid_t _pid; /* sender's pid */
74 __ARCH_SI_UID_T _uid; /* sender's uid */
75 sigval_t _sigval;
76 } _rt;
77
78 /* SIGCHLD */
79 struct {
80 __kernel_pid_t _pid; /* which child */
81 __ARCH_SI_UID_T _uid; /* sender's uid */
82 int _status; /* exit code */
83 __ARCH_SI_CLOCK_T _utime;
84 __ARCH_SI_CLOCK_T _stime;
85 } _sigchld;
86
87 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
88 struct {
89 void __user *_addr; /* faulting insn/memory ref. */
90#ifdef __ARCH_SI_TRAPNO
91 int _trapno; /* TRAP # which caused the signal */
92#endif
93 short _addr_lsb; /* LSB of the reported address */
94 } _sigfault;
95
96 /* SIGPOLL */
97 struct {
98 __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
99 int _fd;
100 } _sigpoll;
101
102 /* SIGSYS */
103 struct {
104 void __user *_call_addr; /* calling user insn */
105 int _syscall; /* triggering system call number */
106 unsigned int _arch; /* AUDIT_ARCH_* of syscall */
107 } _sigsys;
108 } _sifields;
109} __ARCH_SI_ATTRIBUTES siginfo_t;
110
111/* If the arch shares siginfo, then it has SIGSYS. */
112#define __ARCH_SIGSYS
113#endif
114
115/*
116 * How these fields are to be accessed.
117 */
118#define si_pid _sifields._kill._pid
119#define si_uid _sifields._kill._uid
120#define si_tid _sifields._timer._tid
121#define si_overrun _sifields._timer._overrun
122#define si_sys_private _sifields._timer._sys_private
123#define si_status _sifields._sigchld._status
124#define si_utime _sifields._sigchld._utime
125#define si_stime _sifields._sigchld._stime
126#define si_value _sifields._rt._sigval
127#define si_int _sifields._rt._sigval.sival_int
128#define si_ptr _sifields._rt._sigval.sival_ptr
129#define si_addr _sifields._sigfault._addr
130#ifdef __ARCH_SI_TRAPNO
131#define si_trapno _sifields._sigfault._trapno
132#endif
133#define si_addr_lsb _sifields._sigfault._addr_lsb
134#define si_band _sifields._sigpoll._band
135#define si_fd _sifields._sigpoll._fd
136#ifdef __ARCH_SIGSYS
137#define si_call_addr _sifields._sigsys._call_addr
138#define si_syscall _sifields._sigsys._syscall
139#define si_arch _sifields._sigsys._arch
140#endif
141
142#ifdef __KERNEL__
143#define __SI_MASK 0xffff0000u 6#define __SI_MASK 0xffff0000u
144#define __SI_KILL (0 << 16) 7#define __SI_KILL (0 << 16)
145#define __SI_TIMER (1 << 16) 8#define __SI_TIMER (1 << 16)
@@ -150,162 +13,6 @@ typedef struct siginfo {
150#define __SI_MESGQ (6 << 16) 13#define __SI_MESGQ (6 << 16)
151#define __SI_SYS (7 << 16) 14#define __SI_SYS (7 << 16)
152#define __SI_CODE(T,N) ((T) | ((N) & 0xffff)) 15#define __SI_CODE(T,N) ((T) | ((N) & 0xffff))
153#else
154#define __SI_KILL 0
155#define __SI_TIMER 0
156#define __SI_POLL 0
157#define __SI_FAULT 0
158#define __SI_CHLD 0
159#define __SI_RT 0
160#define __SI_MESGQ 0
161#define __SI_SYS 0
162#define __SI_CODE(T,N) (N)
163#endif
164
165/*
166 * si_code values
167 * Digital reserves positive values for kernel-generated signals.
168 */
169#define SI_USER 0 /* sent by kill, sigsend, raise */
170#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */
171#define SI_QUEUE -1 /* sent by sigqueue */
172#define SI_TIMER __SI_CODE(__SI_TIMER,-2) /* sent by timer expiration */
173#define SI_MESGQ __SI_CODE(__SI_MESGQ,-3) /* sent by real time mesq state change */
174#define SI_ASYNCIO -4 /* sent by AIO completion */
175#define SI_SIGIO -5 /* sent by queued SIGIO */
176#define SI_TKILL -6 /* sent by tkill system call */
177#define SI_DETHREAD -7 /* sent by execve() killing subsidiary threads */
178
179#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
180#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
181
182/*
183 * SIGILL si_codes
184 */
185#define ILL_ILLOPC (__SI_FAULT|1) /* illegal opcode */
186#define ILL_ILLOPN (__SI_FAULT|2) /* illegal operand */
187#define ILL_ILLADR (__SI_FAULT|3) /* illegal addressing mode */
188#define ILL_ILLTRP (__SI_FAULT|4) /* illegal trap */
189#define ILL_PRVOPC (__SI_FAULT|5) /* privileged opcode */
190#define ILL_PRVREG (__SI_FAULT|6) /* privileged register */
191#define ILL_COPROC (__SI_FAULT|7) /* coprocessor error */
192#define ILL_BADSTK (__SI_FAULT|8) /* internal stack error */
193#define NSIGILL 8
194
195/*
196 * SIGFPE si_codes
197 */
198#define FPE_INTDIV (__SI_FAULT|1) /* integer divide by zero */
199#define FPE_INTOVF (__SI_FAULT|2) /* integer overflow */
200#define FPE_FLTDIV (__SI_FAULT|3) /* floating point divide by zero */
201#define FPE_FLTOVF (__SI_FAULT|4) /* floating point overflow */
202#define FPE_FLTUND (__SI_FAULT|5) /* floating point underflow */
203#define FPE_FLTRES (__SI_FAULT|6) /* floating point inexact result */
204#define FPE_FLTINV (__SI_FAULT|7) /* floating point invalid operation */
205#define FPE_FLTSUB (__SI_FAULT|8) /* subscript out of range */
206#define NSIGFPE 8
207
208/*
209 * SIGSEGV si_codes
210 */
211#define SEGV_MAPERR (__SI_FAULT|1) /* address not mapped to object */
212#define SEGV_ACCERR (__SI_FAULT|2) /* invalid permissions for mapped object */
213#define NSIGSEGV 2
214
215/*
216 * SIGBUS si_codes
217 */
218#define BUS_ADRALN (__SI_FAULT|1) /* invalid address alignment */
219#define BUS_ADRERR (__SI_FAULT|2) /* non-existent physical address */
220#define BUS_OBJERR (__SI_FAULT|3) /* object specific hardware error */
221/* hardware memory error consumed on a machine check: action required */
222#define BUS_MCEERR_AR (__SI_FAULT|4)
223/* hardware memory error detected in process but not consumed: action optional*/
224#define BUS_MCEERR_AO (__SI_FAULT|5)
225#define NSIGBUS 5
226
227/*
228 * SIGTRAP si_codes
229 */
230#define TRAP_BRKPT (__SI_FAULT|1) /* process breakpoint */
231#define TRAP_TRACE (__SI_FAULT|2) /* process trace trap */
232#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */
233#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint/watchpoint */
234#define NSIGTRAP 4
235
236/*
237 * SIGCHLD si_codes
238 */
239#define CLD_EXITED (__SI_CHLD|1) /* child has exited */
240#define CLD_KILLED (__SI_CHLD|2) /* child was killed */
241#define CLD_DUMPED (__SI_CHLD|3) /* child terminated abnormally */
242#define CLD_TRAPPED (__SI_CHLD|4) /* traced child has trapped */
243#define CLD_STOPPED (__SI_CHLD|5) /* child has stopped */
244#define CLD_CONTINUED (__SI_CHLD|6) /* stopped child has continued */
245#define NSIGCHLD 6
246
247/*
248 * SIGPOLL si_codes
249 */
250#define POLL_IN (__SI_POLL|1) /* data input available */
251#define POLL_OUT (__SI_POLL|2) /* output buffers available */
252#define POLL_MSG (__SI_POLL|3) /* input message available */
253#define POLL_ERR (__SI_POLL|4) /* i/o error */
254#define POLL_PRI (__SI_POLL|5) /* high priority input available */
255#define POLL_HUP (__SI_POLL|6) /* device disconnected */
256#define NSIGPOLL 6
257
258/*
259 * SIGSYS si_codes
260 */
261#define SYS_SECCOMP (__SI_SYS|1) /* seccomp triggered */
262#define NSIGSYS 1
263
264/*
265 * sigevent definitions
266 *
267 * It seems likely that SIGEV_THREAD will have to be handled from
268 * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the
269 * thread manager then catches and does the appropriate nonsense.
270 * However, everything is written out here so as to not get lost.
271 */
272#define SIGEV_SIGNAL 0 /* notify via signal */
273#define SIGEV_NONE 1 /* other notification: meaningless */
274#define SIGEV_THREAD 2 /* deliver via thread creation */
275#define SIGEV_THREAD_ID 4 /* deliver to thread */
276
277/*
278 * This works because the alignment is ok on all current architectures
279 * but we leave open this being overridden in the future
280 */
281#ifndef __ARCH_SIGEV_PREAMBLE_SIZE
282#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_t))
283#endif
284
285#define SIGEV_MAX_SIZE 64
286#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) \
287 / sizeof(int))
288
289typedef struct sigevent {
290 sigval_t sigev_value;
291 int sigev_signo;
292 int sigev_notify;
293 union {
294 int _pad[SIGEV_PAD_SIZE];
295 int _tid;
296
297 struct {
298 void (*_function)(sigval_t);
299 void *_attribute; /* really pthread_attr_t */
300 } _sigev_thread;
301 } _sigev_un;
302} sigevent_t;
303
304#define sigev_notify_function _sigev_un._sigev_thread._function
305#define sigev_notify_attributes _sigev_un._sigev_thread._attribute
306#define sigev_notify_thread_id _sigev_un._tid
307
308#ifdef __KERNEL__
309 16
310struct siginfo; 17struct siginfo;
311void do_schedule_next_timer(struct siginfo *info); 18void do_schedule_next_timer(struct siginfo *info);
@@ -327,6 +34,4 @@ static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
327 34
328extern int copy_siginfo_to_user(struct siginfo __user *to, struct siginfo *from); 35extern int copy_siginfo_to_user(struct siginfo __user *to, struct siginfo *from);
329 36
330#endif /* __KERNEL__ */
331
332#endif 37#endif
diff --git a/include/asm-generic/signal.h b/include/asm-generic/signal.h
index 555c0aee8a47..98caa306122a 100644
--- a/include/asm-generic/signal.h
+++ b/include/asm-generic/signal.h
@@ -1,131 +1,16 @@
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/types.h> 4#include <uapi/asm-generic/signal.h>
5
6#define _NSIG 64
7#define _NSIG_BPW __BITS_PER_LONG
8#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
9
10#define SIGHUP 1
11#define SIGINT 2
12#define SIGQUIT 3
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
52#endif
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 5
92#ifndef __ASSEMBLY__ 6#ifndef __ASSEMBLY__
93typedef struct {
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;
99
100#include <asm-generic/signal-defs.h>
101
102struct sigaction {
103 __sighandler_t sa_handler;
104 unsigned long sa_flags;
105#ifdef SA_RESTORER 7#ifdef SA_RESTORER
106 __sigrestore_t sa_restorer;
107#endif 8#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 9
123#include <asm/sigcontext.h> 10#include <asm/sigcontext.h>
124#undef __HAVE_ARCH_SIG_BITOPS 11#undef __HAVE_ARCH_SIG_BITOPS
125 12
126#define ptrace_signal_deliver(regs, cookie) do { } while (0) 13#define ptrace_signal_deliver(regs, cookie) do { } while (0)
127 14
128#endif /* __KERNEL__ */
129#endif /* __ASSEMBLY__ */ 15#endif /* __ASSEMBLY__ */
130
131#endif /* _ASM_GENERIC_SIGNAL_H */ 16#endif /* _ASM_GENERIC_SIGNAL_H */
diff --git a/include/asm-generic/statfs.h b/include/asm-generic/statfs.h
index c749af9c0983..4b934e9ec970 100644
--- a/include/asm-generic/statfs.h
+++ b/include/asm-generic/statfs.h
@@ -1,86 +1,7 @@
1#ifndef _GENERIC_STATFS_H 1#ifndef _GENERIC_STATFS_H
2#define _GENERIC_STATFS_H 2#define _GENERIC_STATFS_H
3 3
4#include <linux/types.h> 4#include <uapi/asm-generic/statfs.h>
5 5
6#ifdef __KERNEL__
7typedef __kernel_fsid_t fsid_t; 6typedef __kernel_fsid_t fsid_t;
8#endif 7#endif
9
10/*
11 * Most 64-bit platforms use 'long', while most 32-bit platforms use '__u32'.
12 * Yes, they differ in signedness as well as size.
13 * Special cases can override it for themselves -- except for S390x, which
14 * is just a little too special for us. And MIPS, which I'm not touching
15 * with a 10' pole.
16 */
17#ifndef __statfs_word
18#if __BITS_PER_LONG == 64
19#define __statfs_word long
20#else
21#define __statfs_word __u32
22#endif
23#endif
24
25struct statfs {
26 __statfs_word f_type;
27 __statfs_word f_bsize;
28 __statfs_word f_blocks;
29 __statfs_word f_bfree;
30 __statfs_word f_bavail;
31 __statfs_word f_files;
32 __statfs_word f_ffree;
33 __kernel_fsid_t f_fsid;
34 __statfs_word f_namelen;
35 __statfs_word f_frsize;
36 __statfs_word f_flags;
37 __statfs_word f_spare[4];
38};
39
40/*
41 * ARM needs to avoid the 32-bit padding at the end, for consistency
42 * between EABI and OABI
43 */
44#ifndef ARCH_PACK_STATFS64
45#define ARCH_PACK_STATFS64
46#endif
47
48struct statfs64 {
49 __statfs_word f_type;
50 __statfs_word f_bsize;
51 __u64 f_blocks;
52 __u64 f_bfree;
53 __u64 f_bavail;
54 __u64 f_files;
55 __u64 f_ffree;
56 __kernel_fsid_t f_fsid;
57 __statfs_word f_namelen;
58 __statfs_word f_frsize;
59 __statfs_word f_flags;
60 __statfs_word f_spare[4];
61} ARCH_PACK_STATFS64;
62
63/*
64 * IA64 and x86_64 need to avoid the 32-bit padding at the end,
65 * to be compatible with the i386 ABI
66 */
67#ifndef ARCH_PACK_COMPAT_STATFS64
68#define ARCH_PACK_COMPAT_STATFS64
69#endif
70
71struct compat_statfs64 {
72 __u32 f_type;
73 __u32 f_bsize;
74 __u64 f_blocks;
75 __u64 f_bfree;
76 __u64 f_bavail;
77 __u64 f_files;
78 __u64 f_ffree;
79 __kernel_fsid_t f_fsid;
80 __u32 f_namelen;
81 __u32 f_frsize;
82 __u32 f_flags;
83 __u32 f_spare[4];
84} ARCH_PACK_COMPAT_STATFS64;
85
86#endif
diff --git a/include/asm-generic/termios.h b/include/asm-generic/termios.h
index d0922adc56d4..4fa6fe0fc2a2 100644
--- a/include/asm-generic/termios.h
+++ b/include/asm-generic/termios.h
@@ -1,54 +1,9 @@
1#ifndef _ASM_GENERIC_TERMIOS_H 1#ifndef _ASM_GENERIC_TERMIOS_H
2#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 3
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__
50 4
51#include <asm/uaccess.h> 5#include <asm/uaccess.h>
6#include <uapi/asm-generic/termios.h>
52 7
53/* intr=^C quit=^\ erase=del kill=^U 8/* intr=^C quit=^\ erase=del kill=^U
54 eof=^D vtime=\0 vmin=\1 sxtc=\0 9 eof=^D vtime=\0 vmin=\1 sxtc=\0
@@ -149,6 +104,4 @@ static inline int kernel_termios_to_user_termios(struct termios __user *u,
149} 104}
150#endif /* TCGETS2 */ 105#endif /* TCGETS2 */
151 106
152#endif /* __KERNEL__ */
153
154#endif /* _ASM_GENERIC_TERMIOS_H */ 107#endif /* _ASM_GENERIC_TERMIOS_H */
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index 3748ec92dcbc..a36991ab334e 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -1,910 +1,4 @@
1#if !defined(_ASM_GENERIC_UNISTD_H) || defined(__SYSCALL) 1#include <uapi/asm-generic/unistd.h>
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 || defined(__SYSCALL_COMPAT)
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#ifdef __SYSCALL_COMPAT
28#define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _comp)
29#define __SC_COMP_3264(_nr, _32, _64, _comp) __SYSCALL(_nr, _comp)
30#else
31#define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _sys)
32#define __SC_COMP_3264(_nr, _32, _64, _comp) __SC_3264(_nr, _32, _64)
33#endif
34
35#define __NR_io_setup 0
36__SC_COMP(__NR_io_setup, sys_io_setup, compat_sys_io_setup)
37#define __NR_io_destroy 1
38__SYSCALL(__NR_io_destroy, sys_io_destroy)
39#define __NR_io_submit 2
40__SC_COMP(__NR_io_submit, sys_io_submit, compat_sys_io_submit)
41#define __NR_io_cancel 3
42__SYSCALL(__NR_io_cancel, sys_io_cancel)
43#define __NR_io_getevents 4
44__SC_COMP(__NR_io_getevents, sys_io_getevents, compat_sys_io_getevents)
45
46/* fs/xattr.c */
47#define __NR_setxattr 5
48__SYSCALL(__NR_setxattr, sys_setxattr)
49#define __NR_lsetxattr 6
50__SYSCALL(__NR_lsetxattr, sys_lsetxattr)
51#define __NR_fsetxattr 7
52__SYSCALL(__NR_fsetxattr, sys_fsetxattr)
53#define __NR_getxattr 8
54__SYSCALL(__NR_getxattr, sys_getxattr)
55#define __NR_lgetxattr 9
56__SYSCALL(__NR_lgetxattr, sys_lgetxattr)
57#define __NR_fgetxattr 10
58__SYSCALL(__NR_fgetxattr, sys_fgetxattr)
59#define __NR_listxattr 11
60__SYSCALL(__NR_listxattr, sys_listxattr)
61#define __NR_llistxattr 12
62__SYSCALL(__NR_llistxattr, sys_llistxattr)
63#define __NR_flistxattr 13
64__SYSCALL(__NR_flistxattr, sys_flistxattr)
65#define __NR_removexattr 14
66__SYSCALL(__NR_removexattr, sys_removexattr)
67#define __NR_lremovexattr 15
68__SYSCALL(__NR_lremovexattr, sys_lremovexattr)
69#define __NR_fremovexattr 16
70__SYSCALL(__NR_fremovexattr, sys_fremovexattr)
71
72/* fs/dcache.c */
73#define __NR_getcwd 17
74__SYSCALL(__NR_getcwd, sys_getcwd)
75
76/* fs/cookies.c */
77#define __NR_lookup_dcookie 18
78__SC_COMP(__NR_lookup_dcookie, sys_lookup_dcookie, compat_sys_lookup_dcookie)
79
80/* fs/eventfd.c */
81#define __NR_eventfd2 19
82__SYSCALL(__NR_eventfd2, sys_eventfd2)
83
84/* fs/eventpoll.c */
85#define __NR_epoll_create1 20
86__SYSCALL(__NR_epoll_create1, sys_epoll_create1)
87#define __NR_epoll_ctl 21
88__SYSCALL(__NR_epoll_ctl, sys_epoll_ctl)
89#define __NR_epoll_pwait 22
90__SC_COMP(__NR_epoll_pwait, sys_epoll_pwait, compat_sys_epoll_pwait)
91
92/* fs/fcntl.c */
93#define __NR_dup 23
94__SYSCALL(__NR_dup, sys_dup)
95#define __NR_dup3 24
96__SYSCALL(__NR_dup3, sys_dup3)
97#define __NR3264_fcntl 25
98__SC_COMP_3264(__NR3264_fcntl, sys_fcntl64, sys_fcntl, compat_sys_fcntl64)
99
100/* fs/inotify_user.c */
101#define __NR_inotify_init1 26
102__SYSCALL(__NR_inotify_init1, sys_inotify_init1)
103#define __NR_inotify_add_watch 27
104__SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch)
105#define __NR_inotify_rm_watch 28
106__SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch)
107
108/* fs/ioctl.c */
109#define __NR_ioctl 29
110__SC_COMP(__NR_ioctl, sys_ioctl, compat_sys_ioctl)
111
112/* fs/ioprio.c */
113#define __NR_ioprio_set 30
114__SYSCALL(__NR_ioprio_set, sys_ioprio_set)
115#define __NR_ioprio_get 31
116__SYSCALL(__NR_ioprio_get, sys_ioprio_get)
117
118/* fs/locks.c */
119#define __NR_flock 32
120__SYSCALL(__NR_flock, sys_flock)
121
122/* fs/namei.c */
123#define __NR_mknodat 33
124__SYSCALL(__NR_mknodat, sys_mknodat)
125#define __NR_mkdirat 34
126__SYSCALL(__NR_mkdirat, sys_mkdirat)
127#define __NR_unlinkat 35
128__SYSCALL(__NR_unlinkat, sys_unlinkat)
129#define __NR_symlinkat 36
130__SYSCALL(__NR_symlinkat, sys_symlinkat)
131#define __NR_linkat 37
132__SYSCALL(__NR_linkat, sys_linkat)
133#define __NR_renameat 38
134__SYSCALL(__NR_renameat, sys_renameat)
135
136/* fs/namespace.c */
137#define __NR_umount2 39
138__SYSCALL(__NR_umount2, sys_umount)
139#define __NR_mount 40
140__SC_COMP(__NR_mount, sys_mount, compat_sys_mount)
141#define __NR_pivot_root 41
142__SYSCALL(__NR_pivot_root, sys_pivot_root)
143
144/* fs/nfsctl.c */
145#define __NR_nfsservctl 42
146__SYSCALL(__NR_nfsservctl, sys_ni_syscall)
147
148/* fs/open.c */
149#define __NR3264_statfs 43
150__SC_COMP_3264(__NR3264_statfs, sys_statfs64, sys_statfs, \
151 compat_sys_statfs64)
152#define __NR3264_fstatfs 44
153__SC_COMP_3264(__NR3264_fstatfs, sys_fstatfs64, sys_fstatfs, \
154 compat_sys_fstatfs64)
155#define __NR3264_truncate 45
156__SC_COMP_3264(__NR3264_truncate, sys_truncate64, sys_truncate, \
157 compat_sys_truncate64)
158#define __NR3264_ftruncate 46
159__SC_COMP_3264(__NR3264_ftruncate, sys_ftruncate64, sys_ftruncate, \
160 compat_sys_ftruncate64)
161
162#define __NR_fallocate 47
163__SC_COMP(__NR_fallocate, sys_fallocate, compat_sys_fallocate)
164#define __NR_faccessat 48
165__SYSCALL(__NR_faccessat, sys_faccessat)
166#define __NR_chdir 49
167__SYSCALL(__NR_chdir, sys_chdir)
168#define __NR_fchdir 50
169__SYSCALL(__NR_fchdir, sys_fchdir)
170#define __NR_chroot 51
171__SYSCALL(__NR_chroot, sys_chroot)
172#define __NR_fchmod 52
173__SYSCALL(__NR_fchmod, sys_fchmod)
174#define __NR_fchmodat 53
175__SYSCALL(__NR_fchmodat, sys_fchmodat)
176#define __NR_fchownat 54
177__SYSCALL(__NR_fchownat, sys_fchownat)
178#define __NR_fchown 55
179__SYSCALL(__NR_fchown, sys_fchown)
180#define __NR_openat 56
181__SC_COMP(__NR_openat, sys_openat, compat_sys_openat)
182#define __NR_close 57
183__SYSCALL(__NR_close, sys_close)
184#define __NR_vhangup 58
185__SYSCALL(__NR_vhangup, sys_vhangup)
186
187/* fs/pipe.c */
188#define __NR_pipe2 59
189__SYSCALL(__NR_pipe2, sys_pipe2)
190
191/* fs/quota.c */
192#define __NR_quotactl 60
193__SYSCALL(__NR_quotactl, sys_quotactl)
194
195/* fs/readdir.c */
196#define __NR_getdents64 61
197__SC_COMP(__NR_getdents64, sys_getdents64, compat_sys_getdents64)
198
199/* fs/read_write.c */
200#define __NR3264_lseek 62
201__SC_3264(__NR3264_lseek, sys_llseek, sys_lseek)
202#define __NR_read 63
203__SYSCALL(__NR_read, sys_read)
204#define __NR_write 64
205__SYSCALL(__NR_write, sys_write)
206#define __NR_readv 65
207__SC_COMP(__NR_readv, sys_readv, compat_sys_readv)
208#define __NR_writev 66
209__SC_COMP(__NR_writev, sys_writev, compat_sys_writev)
210#define __NR_pread64 67
211__SC_COMP(__NR_pread64, sys_pread64, compat_sys_pread64)
212#define __NR_pwrite64 68
213__SC_COMP(__NR_pwrite64, sys_pwrite64, compat_sys_pwrite64)
214#define __NR_preadv 69
215__SC_COMP(__NR_preadv, sys_preadv, compat_sys_preadv)
216#define __NR_pwritev 70
217__SC_COMP(__NR_pwritev, sys_pwritev, compat_sys_pwritev)
218
219/* fs/sendfile.c */
220#define __NR3264_sendfile 71
221__SYSCALL(__NR3264_sendfile, sys_sendfile64)
222
223/* fs/select.c */
224#define __NR_pselect6 72
225__SC_COMP(__NR_pselect6, sys_pselect6, compat_sys_pselect6)
226#define __NR_ppoll 73
227__SC_COMP(__NR_ppoll, sys_ppoll, compat_sys_ppoll)
228
229/* fs/signalfd.c */
230#define __NR_signalfd4 74
231__SC_COMP(__NR_signalfd4, sys_signalfd4, compat_sys_signalfd4)
232
233/* fs/splice.c */
234#define __NR_vmsplice 75
235__SC_COMP(__NR_vmsplice, sys_vmsplice, compat_sys_vmsplice)
236#define __NR_splice 76
237__SYSCALL(__NR_splice, sys_splice)
238#define __NR_tee 77
239__SYSCALL(__NR_tee, sys_tee)
240
241/* fs/stat.c */
242#define __NR_readlinkat 78
243__SYSCALL(__NR_readlinkat, sys_readlinkat)
244#define __NR3264_fstatat 79
245__SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat)
246#define __NR3264_fstat 80
247__SC_3264(__NR3264_fstat, sys_fstat64, sys_newfstat)
248
249/* fs/sync.c */
250#define __NR_sync 81
251__SYSCALL(__NR_sync, sys_sync)
252#define __NR_fsync 82
253__SYSCALL(__NR_fsync, sys_fsync)
254#define __NR_fdatasync 83
255__SYSCALL(__NR_fdatasync, sys_fdatasync)
256#ifdef __ARCH_WANT_SYNC_FILE_RANGE2
257#define __NR_sync_file_range2 84
258__SC_COMP(__NR_sync_file_range2, sys_sync_file_range2, \
259 compat_sys_sync_file_range2)
260#else
261#define __NR_sync_file_range 84
262__SC_COMP(__NR_sync_file_range, sys_sync_file_range, \
263 compat_sys_sync_file_range)
264#endif
265
266/* fs/timerfd.c */
267#define __NR_timerfd_create 85
268__SYSCALL(__NR_timerfd_create, sys_timerfd_create)
269#define __NR_timerfd_settime 86
270__SC_COMP(__NR_timerfd_settime, sys_timerfd_settime, \
271 compat_sys_timerfd_settime)
272#define __NR_timerfd_gettime 87
273__SC_COMP(__NR_timerfd_gettime, sys_timerfd_gettime, \
274 compat_sys_timerfd_gettime)
275
276/* fs/utimes.c */
277#define __NR_utimensat 88
278__SC_COMP(__NR_utimensat, sys_utimensat, compat_sys_utimensat)
279
280/* kernel/acct.c */
281#define __NR_acct 89
282__SYSCALL(__NR_acct, sys_acct)
283
284/* kernel/capability.c */
285#define __NR_capget 90
286__SYSCALL(__NR_capget, sys_capget)
287#define __NR_capset 91
288__SYSCALL(__NR_capset, sys_capset)
289
290/* kernel/exec_domain.c */
291#define __NR_personality 92
292__SYSCALL(__NR_personality, sys_personality)
293
294/* kernel/exit.c */
295#define __NR_exit 93
296__SYSCALL(__NR_exit, sys_exit)
297#define __NR_exit_group 94
298__SYSCALL(__NR_exit_group, sys_exit_group)
299#define __NR_waitid 95
300__SC_COMP(__NR_waitid, sys_waitid, compat_sys_waitid)
301
302/* kernel/fork.c */
303#define __NR_set_tid_address 96
304__SYSCALL(__NR_set_tid_address, sys_set_tid_address)
305#define __NR_unshare 97
306__SYSCALL(__NR_unshare, sys_unshare)
307
308/* kernel/futex.c */
309#define __NR_futex 98
310__SC_COMP(__NR_futex, sys_futex, compat_sys_futex)
311#define __NR_set_robust_list 99
312__SC_COMP(__NR_set_robust_list, sys_set_robust_list, \
313 compat_sys_set_robust_list)
314#define __NR_get_robust_list 100
315__SC_COMP(__NR_get_robust_list, sys_get_robust_list, \
316 compat_sys_get_robust_list)
317
318/* kernel/hrtimer.c */
319#define __NR_nanosleep 101
320__SC_COMP(__NR_nanosleep, sys_nanosleep, compat_sys_nanosleep)
321
322/* kernel/itimer.c */
323#define __NR_getitimer 102
324__SC_COMP(__NR_getitimer, sys_getitimer, compat_sys_getitimer)
325#define __NR_setitimer 103
326__SC_COMP(__NR_setitimer, sys_setitimer, compat_sys_setitimer)
327
328/* kernel/kexec.c */
329#define __NR_kexec_load 104
330__SC_COMP(__NR_kexec_load, sys_kexec_load, compat_sys_kexec_load)
331
332/* kernel/module.c */
333#define __NR_init_module 105
334__SYSCALL(__NR_init_module, sys_init_module)
335#define __NR_delete_module 106
336__SYSCALL(__NR_delete_module, sys_delete_module)
337
338/* kernel/posix-timers.c */
339#define __NR_timer_create 107
340__SC_COMP(__NR_timer_create, sys_timer_create, compat_sys_timer_create)
341#define __NR_timer_gettime 108
342__SC_COMP(__NR_timer_gettime, sys_timer_gettime, compat_sys_timer_gettime)
343#define __NR_timer_getoverrun 109
344__SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun)
345#define __NR_timer_settime 110
346__SC_COMP(__NR_timer_settime, sys_timer_settime, compat_sys_timer_settime)
347#define __NR_timer_delete 111
348__SYSCALL(__NR_timer_delete, sys_timer_delete)
349#define __NR_clock_settime 112
350__SC_COMP(__NR_clock_settime, sys_clock_settime, compat_sys_clock_settime)
351#define __NR_clock_gettime 113
352__SC_COMP(__NR_clock_gettime, sys_clock_gettime, compat_sys_clock_gettime)
353#define __NR_clock_getres 114
354__SC_COMP(__NR_clock_getres, sys_clock_getres, compat_sys_clock_getres)
355#define __NR_clock_nanosleep 115
356__SC_COMP(__NR_clock_nanosleep, sys_clock_nanosleep, \
357 compat_sys_clock_nanosleep)
358
359/* kernel/printk.c */
360#define __NR_syslog 116
361__SYSCALL(__NR_syslog, sys_syslog)
362
363/* kernel/ptrace.c */
364#define __NR_ptrace 117
365__SYSCALL(__NR_ptrace, sys_ptrace)
366
367/* kernel/sched.c */
368#define __NR_sched_setparam 118
369__SYSCALL(__NR_sched_setparam, sys_sched_setparam)
370#define __NR_sched_setscheduler 119
371__SYSCALL(__NR_sched_setscheduler, sys_sched_setscheduler)
372#define __NR_sched_getscheduler 120
373__SYSCALL(__NR_sched_getscheduler, sys_sched_getscheduler)
374#define __NR_sched_getparam 121
375__SYSCALL(__NR_sched_getparam, sys_sched_getparam)
376#define __NR_sched_setaffinity 122
377__SC_COMP(__NR_sched_setaffinity, sys_sched_setaffinity, \
378 compat_sys_sched_setaffinity)
379#define __NR_sched_getaffinity 123
380__SC_COMP(__NR_sched_getaffinity, sys_sched_getaffinity, \
381 compat_sys_sched_getaffinity)
382#define __NR_sched_yield 124
383__SYSCALL(__NR_sched_yield, sys_sched_yield)
384#define __NR_sched_get_priority_max 125
385__SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max)
386#define __NR_sched_get_priority_min 126
387__SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min)
388#define __NR_sched_rr_get_interval 127
389__SC_COMP(__NR_sched_rr_get_interval, sys_sched_rr_get_interval, \
390 compat_sys_sched_rr_get_interval)
391
392/* kernel/signal.c */
393#define __NR_restart_syscall 128
394__SYSCALL(__NR_restart_syscall, sys_restart_syscall)
395#define __NR_kill 129
396__SYSCALL(__NR_kill, sys_kill)
397#define __NR_tkill 130
398__SYSCALL(__NR_tkill, sys_tkill)
399#define __NR_tgkill 131
400__SYSCALL(__NR_tgkill, sys_tgkill)
401#define __NR_sigaltstack 132
402__SC_COMP(__NR_sigaltstack, sys_sigaltstack, compat_sys_sigaltstack)
403#define __NR_rt_sigsuspend 133
404__SC_COMP(__NR_rt_sigsuspend, sys_rt_sigsuspend, compat_sys_rt_sigsuspend)
405#define __NR_rt_sigaction 134
406__SC_COMP(__NR_rt_sigaction, sys_rt_sigaction, compat_sys_rt_sigaction)
407#define __NR_rt_sigprocmask 135
408__SYSCALL(__NR_rt_sigprocmask, sys_rt_sigprocmask)
409#define __NR_rt_sigpending 136
410__SYSCALL(__NR_rt_sigpending, sys_rt_sigpending)
411#define __NR_rt_sigtimedwait 137
412__SC_COMP(__NR_rt_sigtimedwait, sys_rt_sigtimedwait, \
413 compat_sys_rt_sigtimedwait)
414#define __NR_rt_sigqueueinfo 138
415__SC_COMP(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo, \
416 compat_sys_rt_sigqueueinfo)
417#define __NR_rt_sigreturn 139
418__SC_COMP(__NR_rt_sigreturn, sys_rt_sigreturn, compat_sys_rt_sigreturn)
419
420/* kernel/sys.c */
421#define __NR_setpriority 140
422__SYSCALL(__NR_setpriority, sys_setpriority)
423#define __NR_getpriority 141
424__SYSCALL(__NR_getpriority, sys_getpriority)
425#define __NR_reboot 142
426__SYSCALL(__NR_reboot, sys_reboot)
427#define __NR_setregid 143
428__SYSCALL(__NR_setregid, sys_setregid)
429#define __NR_setgid 144
430__SYSCALL(__NR_setgid, sys_setgid)
431#define __NR_setreuid 145
432__SYSCALL(__NR_setreuid, sys_setreuid)
433#define __NR_setuid 146
434__SYSCALL(__NR_setuid, sys_setuid)
435#define __NR_setresuid 147
436__SYSCALL(__NR_setresuid, sys_setresuid)
437#define __NR_getresuid 148
438__SYSCALL(__NR_getresuid, sys_getresuid)
439#define __NR_setresgid 149
440__SYSCALL(__NR_setresgid, sys_setresgid)
441#define __NR_getresgid 150
442__SYSCALL(__NR_getresgid, sys_getresgid)
443#define __NR_setfsuid 151
444__SYSCALL(__NR_setfsuid, sys_setfsuid)
445#define __NR_setfsgid 152
446__SYSCALL(__NR_setfsgid, sys_setfsgid)
447#define __NR_times 153
448__SC_COMP(__NR_times, sys_times, compat_sys_times)
449#define __NR_setpgid 154
450__SYSCALL(__NR_setpgid, sys_setpgid)
451#define __NR_getpgid 155
452__SYSCALL(__NR_getpgid, sys_getpgid)
453#define __NR_getsid 156
454__SYSCALL(__NR_getsid, sys_getsid)
455#define __NR_setsid 157
456__SYSCALL(__NR_setsid, sys_setsid)
457#define __NR_getgroups 158
458__SYSCALL(__NR_getgroups, sys_getgroups)
459#define __NR_setgroups 159
460__SYSCALL(__NR_setgroups, sys_setgroups)
461#define __NR_uname 160
462__SYSCALL(__NR_uname, sys_newuname)
463#define __NR_sethostname 161
464__SYSCALL(__NR_sethostname, sys_sethostname)
465#define __NR_setdomainname 162
466__SYSCALL(__NR_setdomainname, sys_setdomainname)
467#define __NR_getrlimit 163
468__SC_COMP(__NR_getrlimit, sys_getrlimit, compat_sys_getrlimit)
469#define __NR_setrlimit 164
470__SC_COMP(__NR_setrlimit, sys_setrlimit, compat_sys_setrlimit)
471#define __NR_getrusage 165
472__SC_COMP(__NR_getrusage, sys_getrusage, compat_sys_getrusage)
473#define __NR_umask 166
474__SYSCALL(__NR_umask, sys_umask)
475#define __NR_prctl 167
476__SYSCALL(__NR_prctl, sys_prctl)
477#define __NR_getcpu 168
478__SYSCALL(__NR_getcpu, sys_getcpu)
479
480/* kernel/time.c */
481#define __NR_gettimeofday 169
482__SC_COMP(__NR_gettimeofday, sys_gettimeofday, compat_sys_gettimeofday)
483#define __NR_settimeofday 170
484__SC_COMP(__NR_settimeofday, sys_settimeofday, compat_sys_settimeofday)
485#define __NR_adjtimex 171
486__SC_COMP(__NR_adjtimex, sys_adjtimex, compat_sys_adjtimex)
487
488/* kernel/timer.c */
489#define __NR_getpid 172
490__SYSCALL(__NR_getpid, sys_getpid)
491#define __NR_getppid 173
492__SYSCALL(__NR_getppid, sys_getppid)
493#define __NR_getuid 174
494__SYSCALL(__NR_getuid, sys_getuid)
495#define __NR_geteuid 175
496__SYSCALL(__NR_geteuid, sys_geteuid)
497#define __NR_getgid 176
498__SYSCALL(__NR_getgid, sys_getgid)
499#define __NR_getegid 177
500__SYSCALL(__NR_getegid, sys_getegid)
501#define __NR_gettid 178
502__SYSCALL(__NR_gettid, sys_gettid)
503#define __NR_sysinfo 179
504__SC_COMP(__NR_sysinfo, sys_sysinfo, compat_sys_sysinfo)
505
506/* ipc/mqueue.c */
507#define __NR_mq_open 180
508__SC_COMP(__NR_mq_open, sys_mq_open, compat_sys_mq_open)
509#define __NR_mq_unlink 181
510__SYSCALL(__NR_mq_unlink, sys_mq_unlink)
511#define __NR_mq_timedsend 182
512__SC_COMP(__NR_mq_timedsend, sys_mq_timedsend, compat_sys_mq_timedsend)
513#define __NR_mq_timedreceive 183
514__SC_COMP(__NR_mq_timedreceive, sys_mq_timedreceive, \
515 compat_sys_mq_timedreceive)
516#define __NR_mq_notify 184
517__SC_COMP(__NR_mq_notify, sys_mq_notify, compat_sys_mq_notify)
518#define __NR_mq_getsetattr 185
519__SC_COMP(__NR_mq_getsetattr, sys_mq_getsetattr, compat_sys_mq_getsetattr)
520
521/* ipc/msg.c */
522#define __NR_msgget 186
523__SYSCALL(__NR_msgget, sys_msgget)
524#define __NR_msgctl 187
525__SC_COMP(__NR_msgctl, sys_msgctl, compat_sys_msgctl)
526#define __NR_msgrcv 188
527__SC_COMP(__NR_msgrcv, sys_msgrcv, compat_sys_msgrcv)
528#define __NR_msgsnd 189
529__SC_COMP(__NR_msgsnd, sys_msgsnd, compat_sys_msgsnd)
530
531/* ipc/sem.c */
532#define __NR_semget 190
533__SYSCALL(__NR_semget, sys_semget)
534#define __NR_semctl 191
535__SC_COMP(__NR_semctl, sys_semctl, compat_sys_semctl)
536#define __NR_semtimedop 192
537__SC_COMP(__NR_semtimedop, sys_semtimedop, compat_sys_semtimedop)
538#define __NR_semop 193
539__SYSCALL(__NR_semop, sys_semop)
540
541/* ipc/shm.c */
542#define __NR_shmget 194
543__SYSCALL(__NR_shmget, sys_shmget)
544#define __NR_shmctl 195
545__SC_COMP(__NR_shmctl, sys_shmctl, compat_sys_shmctl)
546#define __NR_shmat 196
547__SC_COMP(__NR_shmat, sys_shmat, compat_sys_shmat)
548#define __NR_shmdt 197
549__SYSCALL(__NR_shmdt, sys_shmdt)
550
551/* net/socket.c */
552#define __NR_socket 198
553__SYSCALL(__NR_socket, sys_socket)
554#define __NR_socketpair 199
555__SYSCALL(__NR_socketpair, sys_socketpair)
556#define __NR_bind 200
557__SYSCALL(__NR_bind, sys_bind)
558#define __NR_listen 201
559__SYSCALL(__NR_listen, sys_listen)
560#define __NR_accept 202
561__SYSCALL(__NR_accept, sys_accept)
562#define __NR_connect 203
563__SYSCALL(__NR_connect, sys_connect)
564#define __NR_getsockname 204
565__SYSCALL(__NR_getsockname, sys_getsockname)
566#define __NR_getpeername 205
567__SYSCALL(__NR_getpeername, sys_getpeername)
568#define __NR_sendto 206
569__SYSCALL(__NR_sendto, sys_sendto)
570#define __NR_recvfrom 207
571__SC_COMP(__NR_recvfrom, sys_recvfrom, compat_sys_recvfrom)
572#define __NR_setsockopt 208
573__SC_COMP(__NR_setsockopt, sys_setsockopt, compat_sys_setsockopt)
574#define __NR_getsockopt 209
575__SC_COMP(__NR_getsockopt, sys_getsockopt, compat_sys_getsockopt)
576#define __NR_shutdown 210
577__SYSCALL(__NR_shutdown, sys_shutdown)
578#define __NR_sendmsg 211
579__SC_COMP(__NR_sendmsg, sys_sendmsg, compat_sys_sendmsg)
580#define __NR_recvmsg 212
581__SC_COMP(__NR_recvmsg, sys_recvmsg, compat_sys_recvmsg)
582
583/* mm/filemap.c */
584#define __NR_readahead 213
585__SC_COMP(__NR_readahead, sys_readahead, compat_sys_readahead)
586
587/* mm/nommu.c, also with MMU */
588#define __NR_brk 214
589__SYSCALL(__NR_brk, sys_brk)
590#define __NR_munmap 215
591__SYSCALL(__NR_munmap, sys_munmap)
592#define __NR_mremap 216
593__SYSCALL(__NR_mremap, sys_mremap)
594
595/* security/keys/keyctl.c */
596#define __NR_add_key 217
597__SYSCALL(__NR_add_key, sys_add_key)
598#define __NR_request_key 218
599__SYSCALL(__NR_request_key, sys_request_key)
600#define __NR_keyctl 219
601__SC_COMP(__NR_keyctl, sys_keyctl, compat_sys_keyctl)
602
603/* arch/example/kernel/sys_example.c */
604#define __NR_clone 220
605__SYSCALL(__NR_clone, sys_clone)
606#define __NR_execve 221
607__SC_COMP(__NR_execve, sys_execve, compat_sys_execve)
608
609#define __NR3264_mmap 222
610__SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap)
611/* mm/fadvise.c */
612#define __NR3264_fadvise64 223
613__SC_COMP(__NR3264_fadvise64, sys_fadvise64_64, compat_sys_fadvise64_64)
614
615/* mm/, CONFIG_MMU only */
616#ifndef __ARCH_NOMMU
617#define __NR_swapon 224
618__SYSCALL(__NR_swapon, sys_swapon)
619#define __NR_swapoff 225
620__SYSCALL(__NR_swapoff, sys_swapoff)
621#define __NR_mprotect 226
622__SYSCALL(__NR_mprotect, sys_mprotect)
623#define __NR_msync 227
624__SYSCALL(__NR_msync, sys_msync)
625#define __NR_mlock 228
626__SYSCALL(__NR_mlock, sys_mlock)
627#define __NR_munlock 229
628__SYSCALL(__NR_munlock, sys_munlock)
629#define __NR_mlockall 230
630__SYSCALL(__NR_mlockall, sys_mlockall)
631#define __NR_munlockall 231
632__SYSCALL(__NR_munlockall, sys_munlockall)
633#define __NR_mincore 232
634__SYSCALL(__NR_mincore, sys_mincore)
635#define __NR_madvise 233
636__SYSCALL(__NR_madvise, sys_madvise)
637#define __NR_remap_file_pages 234
638__SYSCALL(__NR_remap_file_pages, sys_remap_file_pages)
639#define __NR_mbind 235
640__SC_COMP(__NR_mbind, sys_mbind, compat_sys_mbind)
641#define __NR_get_mempolicy 236
642__SC_COMP(__NR_get_mempolicy, sys_get_mempolicy, compat_sys_get_mempolicy)
643#define __NR_set_mempolicy 237
644__SC_COMP(__NR_set_mempolicy, sys_set_mempolicy, compat_sys_set_mempolicy)
645#define __NR_migrate_pages 238
646__SC_COMP(__NR_migrate_pages, sys_migrate_pages, compat_sys_migrate_pages)
647#define __NR_move_pages 239
648__SC_COMP(__NR_move_pages, sys_move_pages, compat_sys_move_pages)
649#endif
650
651#define __NR_rt_tgsigqueueinfo 240
652__SC_COMP(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo, \
653 compat_sys_rt_tgsigqueueinfo)
654#define __NR_perf_event_open 241
655__SYSCALL(__NR_perf_event_open, sys_perf_event_open)
656#define __NR_accept4 242
657__SYSCALL(__NR_accept4, sys_accept4)
658#define __NR_recvmmsg 243
659__SC_COMP(__NR_recvmmsg, sys_recvmmsg, compat_sys_recvmmsg)
660
661/*
662 * Architectures may provide up to 16 syscalls of their own
663 * starting with this value.
664 */
665#define __NR_arch_specific_syscall 244
666
667#define __NR_wait4 260
668__SC_COMP(__NR_wait4, sys_wait4, compat_sys_wait4)
669#define __NR_prlimit64 261
670__SYSCALL(__NR_prlimit64, sys_prlimit64)
671#define __NR_fanotify_init 262
672__SYSCALL(__NR_fanotify_init, sys_fanotify_init)
673#define __NR_fanotify_mark 263
674__SYSCALL(__NR_fanotify_mark, sys_fanotify_mark)
675#define __NR_name_to_handle_at 264
676__SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at)
677#define __NR_open_by_handle_at 265
678__SC_COMP(__NR_open_by_handle_at, sys_open_by_handle_at, \
679 compat_sys_open_by_handle_at)
680#define __NR_clock_adjtime 266
681__SC_COMP(__NR_clock_adjtime, sys_clock_adjtime, compat_sys_clock_adjtime)
682#define __NR_syncfs 267
683__SYSCALL(__NR_syncfs, sys_syncfs)
684#define __NR_setns 268
685__SYSCALL(__NR_setns, sys_setns)
686#define __NR_sendmmsg 269
687__SC_COMP(__NR_sendmmsg, sys_sendmmsg, compat_sys_sendmmsg)
688#define __NR_process_vm_readv 270
689__SC_COMP(__NR_process_vm_readv, sys_process_vm_readv, \
690 compat_sys_process_vm_readv)
691#define __NR_process_vm_writev 271
692__SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \
693 compat_sys_process_vm_writev)
694#define __NR_kcmp 272
695__SYSCALL(__NR_kcmp, sys_kcmp)
696
697#undef __NR_syscalls
698#define __NR_syscalls 273
699
700/*
701 * All syscalls below here should go away really,
702 * these are provided for both review and as a porting
703 * help for the C library version.
704*
705 * Last chance: are any of these important enough to
706 * enable by default?
707 */
708#ifdef __ARCH_WANT_SYSCALL_NO_AT
709#define __NR_open 1024
710__SYSCALL(__NR_open, sys_open)
711#define __NR_link 1025
712__SYSCALL(__NR_link, sys_link)
713#define __NR_unlink 1026
714__SYSCALL(__NR_unlink, sys_unlink)
715#define __NR_mknod 1027
716__SYSCALL(__NR_mknod, sys_mknod)
717#define __NR_chmod 1028
718__SYSCALL(__NR_chmod, sys_chmod)
719#define __NR_chown 1029
720__SYSCALL(__NR_chown, sys_chown)
721#define __NR_mkdir 1030
722__SYSCALL(__NR_mkdir, sys_mkdir)
723#define __NR_rmdir 1031
724__SYSCALL(__NR_rmdir, sys_rmdir)
725#define __NR_lchown 1032
726__SYSCALL(__NR_lchown, sys_lchown)
727#define __NR_access 1033
728__SYSCALL(__NR_access, sys_access)
729#define __NR_rename 1034
730__SYSCALL(__NR_rename, sys_rename)
731#define __NR_readlink 1035
732__SYSCALL(__NR_readlink, sys_readlink)
733#define __NR_symlink 1036
734__SYSCALL(__NR_symlink, sys_symlink)
735#define __NR_utimes 1037
736__SYSCALL(__NR_utimes, sys_utimes)
737#define __NR3264_stat 1038
738__SC_3264(__NR3264_stat, sys_stat64, sys_newstat)
739#define __NR3264_lstat 1039
740__SC_3264(__NR3264_lstat, sys_lstat64, sys_newlstat)
741
742#undef __NR_syscalls
743#define __NR_syscalls (__NR3264_lstat+1)
744#endif /* __ARCH_WANT_SYSCALL_NO_AT */
745
746#ifdef __ARCH_WANT_SYSCALL_NO_FLAGS
747#define __NR_pipe 1040
748__SYSCALL(__NR_pipe, sys_pipe)
749#define __NR_dup2 1041
750__SYSCALL(__NR_dup2, sys_dup2)
751#define __NR_epoll_create 1042
752__SYSCALL(__NR_epoll_create, sys_epoll_create)
753#define __NR_inotify_init 1043
754__SYSCALL(__NR_inotify_init, sys_inotify_init)
755#define __NR_eventfd 1044
756__SYSCALL(__NR_eventfd, sys_eventfd)
757#define __NR_signalfd 1045
758__SYSCALL(__NR_signalfd, sys_signalfd)
759
760#undef __NR_syscalls
761#define __NR_syscalls (__NR_signalfd+1)
762#endif /* __ARCH_WANT_SYSCALL_NO_FLAGS */
763
764#if (__BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)) && \
765 defined(__ARCH_WANT_SYSCALL_OFF_T)
766#define __NR_sendfile 1046
767__SYSCALL(__NR_sendfile, sys_sendfile)
768#define __NR_ftruncate 1047
769__SYSCALL(__NR_ftruncate, sys_ftruncate)
770#define __NR_truncate 1048
771__SYSCALL(__NR_truncate, sys_truncate)
772#define __NR_stat 1049
773__SYSCALL(__NR_stat, sys_newstat)
774#define __NR_lstat 1050
775__SYSCALL(__NR_lstat, sys_newlstat)
776#define __NR_fstat 1051
777__SYSCALL(__NR_fstat, sys_newfstat)
778#define __NR_fcntl 1052
779__SYSCALL(__NR_fcntl, sys_fcntl)
780#define __NR_fadvise64 1053
781#define __ARCH_WANT_SYS_FADVISE64
782__SYSCALL(__NR_fadvise64, sys_fadvise64)
783#define __NR_newfstatat 1054
784#define __ARCH_WANT_SYS_NEWFSTATAT
785__SYSCALL(__NR_newfstatat, sys_newfstatat)
786#define __NR_fstatfs 1055
787__SYSCALL(__NR_fstatfs, sys_fstatfs)
788#define __NR_statfs 1056
789__SYSCALL(__NR_statfs, sys_statfs)
790#define __NR_lseek 1057
791__SYSCALL(__NR_lseek, sys_lseek)
792#define __NR_mmap 1058
793__SYSCALL(__NR_mmap, sys_mmap)
794
795#undef __NR_syscalls
796#define __NR_syscalls (__NR_mmap+1)
797#endif /* 32 bit off_t syscalls */
798
799#ifdef __ARCH_WANT_SYSCALL_DEPRECATED
800#define __NR_alarm 1059
801#define __ARCH_WANT_SYS_ALARM
802__SYSCALL(__NR_alarm, sys_alarm)
803#define __NR_getpgrp 1060
804#define __ARCH_WANT_SYS_GETPGRP
805__SYSCALL(__NR_getpgrp, sys_getpgrp)
806#define __NR_pause 1061
807#define __ARCH_WANT_SYS_PAUSE
808__SYSCALL(__NR_pause, sys_pause)
809#define __NR_time 1062
810#define __ARCH_WANT_SYS_TIME
811#define __ARCH_WANT_COMPAT_SYS_TIME
812__SYSCALL(__NR_time, sys_time)
813#define __NR_utime 1063
814#define __ARCH_WANT_SYS_UTIME
815__SYSCALL(__NR_utime, sys_utime)
816
817#define __NR_creat 1064
818__SYSCALL(__NR_creat, sys_creat)
819#define __NR_getdents 1065
820#define __ARCH_WANT_SYS_GETDENTS
821__SYSCALL(__NR_getdents, sys_getdents)
822#define __NR_futimesat 1066
823__SYSCALL(__NR_futimesat, sys_futimesat)
824#define __NR_select 1067
825#define __ARCH_WANT_SYS_SELECT
826__SYSCALL(__NR_select, sys_select)
827#define __NR_poll 1068
828__SYSCALL(__NR_poll, sys_poll)
829#define __NR_epoll_wait 1069
830__SYSCALL(__NR_epoll_wait, sys_epoll_wait)
831#define __NR_ustat 1070
832__SYSCALL(__NR_ustat, sys_ustat)
833#define __NR_vfork 1071
834__SYSCALL(__NR_vfork, sys_vfork)
835#define __NR_oldwait4 1072
836__SYSCALL(__NR_oldwait4, sys_wait4)
837#define __NR_recv 1073
838__SYSCALL(__NR_recv, sys_recv)
839#define __NR_send 1074
840__SYSCALL(__NR_send, sys_send)
841#define __NR_bdflush 1075
842__SYSCALL(__NR_bdflush, sys_bdflush)
843#define __NR_umount 1076
844__SYSCALL(__NR_umount, sys_oldumount)
845#define __ARCH_WANT_SYS_OLDUMOUNT
846#define __NR_uselib 1077
847__SYSCALL(__NR_uselib, sys_uselib)
848#define __NR__sysctl 1078
849__SYSCALL(__NR__sysctl, sys_sysctl)
850
851#define __NR_fork 1079
852#ifdef CONFIG_MMU
853__SYSCALL(__NR_fork, sys_fork)
854#else
855__SYSCALL(__NR_fork, sys_ni_syscall)
856#endif /* CONFIG_MMU */
857
858#undef __NR_syscalls
859#define __NR_syscalls (__NR_fork+1)
860
861#endif /* __ARCH_WANT_SYSCALL_DEPRECATED */
862
863/*
864 * 32 bit systems traditionally used different
865 * syscalls for off_t and loff_t arguments, while
866 * 64 bit systems only need the off_t version.
867 * For new 32 bit platforms, there is no need to
868 * implement the old 32 bit off_t syscalls, so
869 * they take different names.
870 * Here we map the numbers so that both versions
871 * use the same syscall table layout.
872 */
873#if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT)
874#define __NR_fcntl __NR3264_fcntl
875#define __NR_statfs __NR3264_statfs
876#define __NR_fstatfs __NR3264_fstatfs
877#define __NR_truncate __NR3264_truncate
878#define __NR_ftruncate __NR3264_ftruncate
879#define __NR_lseek __NR3264_lseek
880#define __NR_sendfile __NR3264_sendfile
881#define __NR_newfstatat __NR3264_fstatat
882#define __NR_fstat __NR3264_fstat
883#define __NR_mmap __NR3264_mmap
884#define __NR_fadvise64 __NR3264_fadvise64
885#ifdef __NR3264_stat
886#define __NR_stat __NR3264_stat
887#define __NR_lstat __NR3264_lstat
888#endif
889#else
890#define __NR_fcntl64 __NR3264_fcntl
891#define __NR_statfs64 __NR3264_statfs
892#define __NR_fstatfs64 __NR3264_fstatfs
893#define __NR_truncate64 __NR3264_truncate
894#define __NR_ftruncate64 __NR3264_ftruncate
895#define __NR_llseek __NR3264_lseek
896#define __NR_sendfile64 __NR3264_sendfile
897#define __NR_fstatat64 __NR3264_fstatat
898#define __NR_fstat64 __NR3264_fstat
899#define __NR_mmap2 __NR3264_mmap
900#define __NR_fadvise64_64 __NR3264_fadvise64
901#ifdef __NR3264_stat
902#define __NR_stat64 __NR3264_stat
903#define __NR_lstat64 __NR3264_lstat
904#endif
905#endif
906
907#ifdef __KERNEL__
908 2
909/* 3/*
910 * These are required system calls, we should 4 * These are required system calls, we should
@@ -928,6 +22,3 @@ __SYSCALL(__NR_fork, sys_ni_syscall)
928#ifndef cond_syscall 22#ifndef cond_syscall
929#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") 23#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
930#endif 24#endif
931
932#endif /* __KERNEL__ */
933#endif /* _ASM_GENERIC_UNISTD_H */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 4e2e1cc505ab..d1ea7ce0b4cb 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -530,9 +530,18 @@
530 *(.scommon) \ 530 *(.scommon) \
531 } 531 }
532 532
533/*
534 * Allow archectures to redefine BSS_FIRST_SECTIONS to add extra
535 * sections to the front of bss.
536 */
537#ifndef BSS_FIRST_SECTIONS
538#define BSS_FIRST_SECTIONS
539#endif
540
533#define BSS(bss_align) \ 541#define BSS(bss_align) \
534 . = ALIGN(bss_align); \ 542 . = ALIGN(bss_align); \
535 .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \ 543 .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \
544 BSS_FIRST_SECTIONS \
536 *(.bss..page_aligned) \ 545 *(.bss..page_aligned) \
537 *(.dynbss) \ 546 *(.dynbss) \
538 *(.bss) \ 547 *(.bss) \
diff --git a/include/asm-generic/xor.h b/include/asm-generic/xor.h
index 6028fb862254..b4d843225afd 100644
--- a/include/asm-generic/xor.h
+++ b/include/asm-generic/xor.h
@@ -693,7 +693,7 @@ static struct xor_block_template xor_block_32regs = {
693 .do_5 = xor_32regs_5, 693 .do_5 = xor_32regs_5,
694}; 694};
695 695
696static struct xor_block_template xor_block_8regs_p = { 696static struct xor_block_template xor_block_8regs_p __maybe_unused = {
697 .name = "8regs_prefetch", 697 .name = "8regs_prefetch",
698 .do_2 = xor_8regs_p_2, 698 .do_2 = xor_8regs_p_2,
699 .do_3 = xor_8regs_p_3, 699 .do_3 = xor_8regs_p_3,
@@ -701,7 +701,7 @@ static struct xor_block_template xor_block_8regs_p = {
701 .do_5 = xor_8regs_p_5, 701 .do_5 = xor_8regs_p_5,
702}; 702};
703 703
704static struct xor_block_template xor_block_32regs_p = { 704static struct xor_block_template xor_block_32regs_p __maybe_unused = {
705 .name = "32regs_prefetch", 705 .name = "32regs_prefetch",
706 .do_2 = xor_32regs_p_2, 706 .do_2 = xor_32regs_p_2,
707 .do_3 = xor_32regs_p_3, 707 .do_3 = xor_32regs_p_3,
diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h
new file mode 100644
index 000000000000..f5b0224c9967
--- /dev/null
+++ b/include/crypto/public_key.h
@@ -0,0 +1,108 @@
1/* Asymmetric public-key algorithm definitions
2 *
3 * See Documentation/crypto/asymmetric-keys.txt
4 *
5 * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
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.
12 */
13
14#ifndef _LINUX_PUBLIC_KEY_H
15#define _LINUX_PUBLIC_KEY_H
16
17#include <linux/mpi.h>
18
19enum pkey_algo {
20 PKEY_ALGO_DSA,
21 PKEY_ALGO_RSA,
22 PKEY_ALGO__LAST
23};
24
25extern const char *const pkey_algo[PKEY_ALGO__LAST];
26
27enum pkey_hash_algo {
28 PKEY_HASH_MD4,
29 PKEY_HASH_MD5,
30 PKEY_HASH_SHA1,
31 PKEY_HASH_RIPE_MD_160,
32 PKEY_HASH_SHA256,
33 PKEY_HASH_SHA384,
34 PKEY_HASH_SHA512,
35 PKEY_HASH_SHA224,
36 PKEY_HASH__LAST
37};
38
39extern const char *const pkey_hash_algo[PKEY_HASH__LAST];
40
41enum pkey_id_type {
42 PKEY_ID_PGP, /* OpenPGP generated key ID */
43 PKEY_ID_X509, /* X.509 arbitrary subjectKeyIdentifier */
44 PKEY_ID_TYPE__LAST
45};
46
47extern const char *const pkey_id_type[PKEY_ID_TYPE__LAST];
48
49/*
50 * Cryptographic data for the public-key subtype of the asymmetric key type.
51 *
52 * Note that this may include private part of the key as well as the public
53 * part.
54 */
55struct public_key {
56 const struct public_key_algorithm *algo;
57 u8 capabilities;
58#define PKEY_CAN_ENCRYPT 0x01
59#define PKEY_CAN_DECRYPT 0x02
60#define PKEY_CAN_SIGN 0x04
61#define PKEY_CAN_VERIFY 0x08
62 enum pkey_id_type id_type : 8;
63 union {
64 MPI mpi[5];
65 struct {
66 MPI p; /* DSA prime */
67 MPI q; /* DSA group order */
68 MPI g; /* DSA group generator */
69 MPI y; /* DSA public-key value = g^x mod p */
70 MPI x; /* DSA secret exponent (if present) */
71 } dsa;
72 struct {
73 MPI n; /* RSA public modulus */
74 MPI e; /* RSA public encryption exponent */
75 MPI d; /* RSA secret encryption exponent (if present) */
76 MPI p; /* RSA secret prime (if present) */
77 MPI q; /* RSA secret prime (if present) */
78 } rsa;
79 };
80};
81
82extern void public_key_destroy(void *payload);
83
84/*
85 * Public key cryptography signature data
86 */
87struct public_key_signature {
88 u8 *digest;
89 u8 digest_size; /* Number of bytes in digest */
90 u8 nr_mpi; /* Occupancy of mpi[] */
91 enum pkey_hash_algo pkey_hash_algo : 8;
92 union {
93 MPI mpi[2];
94 struct {
95 MPI s; /* m^d mod n */
96 } rsa;
97 struct {
98 MPI r;
99 MPI s;
100 } dsa;
101 };
102};
103
104struct key;
105extern int verify_signature(const struct key *key,
106 const struct public_key_signature *sig);
107
108#endif /* _LINUX_PUBLIC_KEY_H */
diff --git a/include/drm/Kbuild b/include/drm/Kbuild
deleted file mode 100644
index 1e38a19d68f6..000000000000
--- a/include/drm/Kbuild
+++ /dev/null
@@ -1,15 +0,0 @@
1header-y += drm.h
2header-y += drm_fourcc.h
3header-y += drm_mode.h
4header-y += drm_sarea.h
5header-y += exynos_drm.h
6header-y += i810_drm.h
7header-y += i915_drm.h
8header-y += mga_drm.h
9header-y += nouveau_drm.h
10header-y += r128_drm.h
11header-y += radeon_drm.h
12header-y += savage_drm.h
13header-y += sis_drm.h
14header-y += via_drm.h
15header-y += vmwgfx_drm.h
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 1816bb31273a..3fa18b7e9497 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -878,6 +878,7 @@ extern char *drm_get_tv_subconnector_name(int val);
878extern char *drm_get_tv_select_name(int val); 878extern char *drm_get_tv_select_name(int val);
879extern void drm_fb_release(struct drm_file *file_priv); 879extern void drm_fb_release(struct drm_file *file_priv);
880extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group); 880extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
881extern bool drm_probe_ddc(struct i2c_adapter *adapter);
881extern struct edid *drm_get_edid(struct drm_connector *connector, 882extern struct edid *drm_get_edid(struct drm_connector *connector,
882 struct i2c_adapter *adapter); 883 struct i2c_adapter *adapter);
883extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); 884extern int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 1744b18c06b3..fe061489f91f 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -26,7 +26,19 @@
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/i2c.h> 27#include <linux/i2c.h>
28 28
29/* From the VESA DisplayPort spec */ 29/*
30 * Unless otherwise noted, all values are from the DP 1.1a spec. Note that
31 * DP and DPCD versions are independent. Differences from 1.0 are not noted,
32 * 1.0 devices basically don't exist in the wild.
33 *
34 * Abbreviations, in chronological order:
35 *
36 * eDP: Embedded DisplayPort version 1
37 * DPI: DisplayPort Interoperability Guideline v1.1a
38 * 1.2: DisplayPort 1.2
39 *
40 * 1.2 formally includes both eDP and DPI definitions.
41 */
30 42
31#define AUX_NATIVE_WRITE 0x8 43#define AUX_NATIVE_WRITE 0x8
32#define AUX_NATIVE_READ 0x9 44#define AUX_NATIVE_READ 0x9
@@ -53,7 +65,7 @@
53 65
54#define DP_MAX_LANE_COUNT 0x002 66#define DP_MAX_LANE_COUNT 0x002
55# define DP_MAX_LANE_COUNT_MASK 0x1f 67# define DP_MAX_LANE_COUNT_MASK 0x1f
56# define DP_TPS3_SUPPORTED (1 << 6) 68# define DP_TPS3_SUPPORTED (1 << 6) /* 1.2 */
57# define DP_ENHANCED_FRAME_CAP (1 << 7) 69# define DP_ENHANCED_FRAME_CAP (1 << 7)
58 70
59#define DP_MAX_DOWNSPREAD 0x003 71#define DP_MAX_DOWNSPREAD 0x003
@@ -69,19 +81,33 @@
69/* 10b = TMDS or HDMI */ 81/* 10b = TMDS or HDMI */
70/* 11b = Other */ 82/* 11b = Other */
71# define DP_FORMAT_CONVERSION (1 << 3) 83# define DP_FORMAT_CONVERSION (1 << 3)
84# define DP_DETAILED_CAP_INFO_AVAILABLE (1 << 4) /* DPI */
72 85
73#define DP_MAIN_LINK_CHANNEL_CODING 0x006 86#define DP_MAIN_LINK_CHANNEL_CODING 0x006
74 87
75#define DP_DOWN_STREAM_PORT_COUNT 0x007 88#define DP_DOWN_STREAM_PORT_COUNT 0x007
76#define DP_PORT_COUNT_MASK 0x0f 89# define DP_PORT_COUNT_MASK 0x0f
77#define DP_OUI_SUPPORT (1 << 7) 90# define DP_MSA_TIMING_PAR_IGNORED (1 << 6) /* eDP */
78 91# define DP_OUI_SUPPORT (1 << 7)
79#define DP_EDP_CONFIGURATION_CAP 0x00d 92
80#define DP_TRAINING_AUX_RD_INTERVAL 0x00e 93#define DP_I2C_SPEED_CAP 0x00c /* DPI */
81 94# define DP_I2C_SPEED_1K 0x01
82#define DP_PSR_SUPPORT 0x070 95# define DP_I2C_SPEED_5K 0x02
96# define DP_I2C_SPEED_10K 0x04
97# define DP_I2C_SPEED_100K 0x08
98# define DP_I2C_SPEED_400K 0x10
99# define DP_I2C_SPEED_1M 0x20
100
101#define DP_EDP_CONFIGURATION_CAP 0x00d /* XXX 1.2? */
102#define DP_TRAINING_AUX_RD_INTERVAL 0x00e /* XXX 1.2? */
103
104/* Multiple stream transport */
105#define DP_MSTM_CAP 0x021 /* 1.2 */
106# define DP_MST_CAP (1 << 0)
107
108#define DP_PSR_SUPPORT 0x070 /* XXX 1.2? */
83# define DP_PSR_IS_SUPPORTED 1 109# define DP_PSR_IS_SUPPORTED 1
84#define DP_PSR_CAPS 0x071 110#define DP_PSR_CAPS 0x071 /* XXX 1.2? */
85# define DP_PSR_NO_TRAIN_ON_EXIT 1 111# define DP_PSR_NO_TRAIN_ON_EXIT 1
86# define DP_PSR_SETUP_TIME_330 (0 << 1) 112# define DP_PSR_SETUP_TIME_330 (0 << 1)
87# define DP_PSR_SETUP_TIME_275 (1 << 1) 113# define DP_PSR_SETUP_TIME_275 (1 << 1)
@@ -93,11 +119,36 @@
93# define DP_PSR_SETUP_TIME_MASK (7 << 1) 119# define DP_PSR_SETUP_TIME_MASK (7 << 1)
94# define DP_PSR_SETUP_TIME_SHIFT 1 120# define DP_PSR_SETUP_TIME_SHIFT 1
95 121
122/*
123 * 0x80-0x8f describe downstream port capabilities, but there are two layouts
124 * based on whether DP_DETAILED_CAP_INFO_AVAILABLE was set. If it was not,
125 * each port's descriptor is one byte wide. If it was set, each port's is
126 * four bytes wide, starting with the one byte from the base info. As of
127 * DP interop v1.1a only VGA defines additional detail.
128 */
129
130/* offset 0 */
131#define DP_DOWNSTREAM_PORT_0 0x80
132# define DP_DS_PORT_TYPE_MASK (7 << 0)
133# define DP_DS_PORT_TYPE_DP 0
134# define DP_DS_PORT_TYPE_VGA 1
135# define DP_DS_PORT_TYPE_DVI 2
136# define DP_DS_PORT_TYPE_HDMI 3
137# define DP_DS_PORT_TYPE_NON_EDID 4
138# define DP_DS_PORT_HPD (1 << 3)
139/* offset 1 for VGA is maximum megapixels per second / 8 */
140/* offset 2 */
141# define DP_DS_VGA_MAX_BPC_MASK (3 << 0)
142# define DP_DS_VGA_8BPC 0
143# define DP_DS_VGA_10BPC 1
144# define DP_DS_VGA_12BPC 2
145# define DP_DS_VGA_16BPC 3
146
96/* link configuration */ 147/* link configuration */
97#define DP_LINK_BW_SET 0x100 148#define DP_LINK_BW_SET 0x100
98# define DP_LINK_BW_1_62 0x06 149# define DP_LINK_BW_1_62 0x06
99# define DP_LINK_BW_2_7 0x0a 150# define DP_LINK_BW_2_7 0x0a
100# define DP_LINK_BW_5_4 0x14 151# define DP_LINK_BW_5_4 0x14 /* 1.2 */
101 152
102#define DP_LANE_COUNT_SET 0x101 153#define DP_LANE_COUNT_SET 0x101
103# define DP_LANE_COUNT_MASK 0x0f 154# define DP_LANE_COUNT_MASK 0x0f
@@ -107,7 +158,7 @@
107# define DP_TRAINING_PATTERN_DISABLE 0 158# define DP_TRAINING_PATTERN_DISABLE 0
108# define DP_TRAINING_PATTERN_1 1 159# define DP_TRAINING_PATTERN_1 1
109# define DP_TRAINING_PATTERN_2 2 160# define DP_TRAINING_PATTERN_2 2
110# define DP_TRAINING_PATTERN_3 3 161# define DP_TRAINING_PATTERN_3 3 /* 1.2 */
111# define DP_TRAINING_PATTERN_MASK 0x3 162# define DP_TRAINING_PATTERN_MASK 0x3
112 163
113# define DP_LINK_QUAL_PATTERN_DISABLE (0 << 2) 164# define DP_LINK_QUAL_PATTERN_DISABLE (0 << 2)
@@ -148,24 +199,38 @@
148 199
149#define DP_DOWNSPREAD_CTRL 0x107 200#define DP_DOWNSPREAD_CTRL 0x107
150# define DP_SPREAD_AMP_0_5 (1 << 4) 201# define DP_SPREAD_AMP_0_5 (1 << 4)
202# define DP_MSA_TIMING_PAR_IGNORE_EN (1 << 7) /* eDP */
151 203
152#define DP_MAIN_LINK_CHANNEL_CODING_SET 0x108 204#define DP_MAIN_LINK_CHANNEL_CODING_SET 0x108
153# define DP_SET_ANSI_8B10B (1 << 0) 205# define DP_SET_ANSI_8B10B (1 << 0)
154 206
155#define DP_PSR_EN_CFG 0x170 207#define DP_I2C_SPEED_CONTROL_STATUS 0x109 /* DPI */
208/* bitmask as for DP_I2C_SPEED_CAP */
209
210#define DP_EDP_CONFIGURATION_SET 0x10a /* XXX 1.2? */
211
212#define DP_MSTM_CTRL 0x111 /* 1.2 */
213# define DP_MST_EN (1 << 0)
214# define DP_UP_REQ_EN (1 << 1)
215# define DP_UPSTREAM_IS_SRC (1 << 2)
216
217#define DP_PSR_EN_CFG 0x170 /* XXX 1.2? */
156# define DP_PSR_ENABLE (1 << 0) 218# define DP_PSR_ENABLE (1 << 0)
157# define DP_PSR_MAIN_LINK_ACTIVE (1 << 1) 219# define DP_PSR_MAIN_LINK_ACTIVE (1 << 1)
158# define DP_PSR_CRC_VERIFICATION (1 << 2) 220# define DP_PSR_CRC_VERIFICATION (1 << 2)
159# define DP_PSR_FRAME_CAPTURE (1 << 3) 221# define DP_PSR_FRAME_CAPTURE (1 << 3)
160 222
223#define DP_SINK_COUNT 0x200
224/* prior to 1.2 bit 7 was reserved mbz */
225# define DP_GET_SINK_COUNT(x) ((((x) & 0x80) >> 1) | ((x) & 0x3f))
226# define DP_SINK_CP_READY (1 << 6)
227
161#define DP_DEVICE_SERVICE_IRQ_VECTOR 0x201 228#define DP_DEVICE_SERVICE_IRQ_VECTOR 0x201
162# define DP_REMOTE_CONTROL_COMMAND_PENDING (1 << 0) 229# define DP_REMOTE_CONTROL_COMMAND_PENDING (1 << 0)
163# define DP_AUTOMATED_TEST_REQUEST (1 << 1) 230# define DP_AUTOMATED_TEST_REQUEST (1 << 1)
164# define DP_CP_IRQ (1 << 2) 231# define DP_CP_IRQ (1 << 2)
165# define DP_SINK_SPECIFIC_IRQ (1 << 6) 232# define DP_SINK_SPECIFIC_IRQ (1 << 6)
166 233
167#define DP_EDP_CONFIGURATION_SET 0x10a
168
169#define DP_LANE0_1_STATUS 0x202 234#define DP_LANE0_1_STATUS 0x202
170#define DP_LANE2_3_STATUS 0x203 235#define DP_LANE2_3_STATUS 0x203
171# define DP_LANE_CR_DONE (1 << 0) 236# define DP_LANE_CR_DONE (1 << 0)
@@ -225,14 +290,14 @@
225# define DP_SET_POWER_D0 0x1 290# define DP_SET_POWER_D0 0x1
226# define DP_SET_POWER_D3 0x2 291# define DP_SET_POWER_D3 0x2
227 292
228#define DP_PSR_ERROR_STATUS 0x2006 293#define DP_PSR_ERROR_STATUS 0x2006 /* XXX 1.2? */
229# define DP_PSR_LINK_CRC_ERROR (1 << 0) 294# define DP_PSR_LINK_CRC_ERROR (1 << 0)
230# define DP_PSR_RFB_STORAGE_ERROR (1 << 1) 295# define DP_PSR_RFB_STORAGE_ERROR (1 << 1)
231 296
232#define DP_PSR_ESI 0x2007 297#define DP_PSR_ESI 0x2007 /* XXX 1.2? */
233# define DP_PSR_CAPS_CHANGE (1 << 0) 298# define DP_PSR_CAPS_CHANGE (1 << 0)
234 299
235#define DP_PSR_STATUS 0x2008 300#define DP_PSR_STATUS 0x2008 /* XXX 1.2? */
236# define DP_PSR_SINK_INACTIVE 0 301# define DP_PSR_SINK_INACTIVE 0
237# define DP_PSR_SINK_ACTIVE_SRC_SYNCED 1 302# define DP_PSR_SINK_ACTIVE_SRC_SYNCED 1
238# define DP_PSR_SINK_ACTIVE_RFB 2 303# define DP_PSR_SINK_ACTIVE_RFB 2
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
index c78bb997e2c6..af1cbaf535ed 100644
--- a/include/drm/drm_pciids.h
+++ b/include/drm/drm_pciids.h
@@ -205,6 +205,8 @@
205 {0x1002, 0x6788, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ 205 {0x1002, 0x6788, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
206 {0x1002, 0x678A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ 206 {0x1002, 0x678A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
207 {0x1002, 0x6790, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ 207 {0x1002, 0x6790, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
208 {0x1002, 0x6791, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
209 {0x1002, 0x6792, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
208 {0x1002, 0x6798, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ 210 {0x1002, 0x6798, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
209 {0x1002, 0x6799, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ 211 {0x1002, 0x6799, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
210 {0x1002, 0x679A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \ 212 {0x1002, 0x679A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
@@ -217,6 +219,7 @@
217 {0x1002, 0x6808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ 219 {0x1002, 0x6808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
218 {0x1002, 0x6809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ 220 {0x1002, 0x6809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
219 {0x1002, 0x6810, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ 221 {0x1002, 0x6810, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
222 {0x1002, 0x6811, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
220 {0x1002, 0x6816, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ 223 {0x1002, 0x6816, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
221 {0x1002, 0x6817, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ 224 {0x1002, 0x6817, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
222 {0x1002, 0x6818, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \ 225 {0x1002, 0x6818, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
diff --git a/include/drm/exynos_drm.h b/include/drm/exynos_drm.h
index 1f2acdfbfd6d..3c13a3a4b158 100644
--- a/include/drm/exynos_drm.h
+++ b/include/drm/exynos_drm.h
@@ -25,182 +25,10 @@
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE. 26 * OTHER DEALINGS IN THE SOFTWARE.
27 */ 27 */
28
29#ifndef _EXYNOS_DRM_H_ 28#ifndef _EXYNOS_DRM_H_
30#define _EXYNOS_DRM_H_ 29#define _EXYNOS_DRM_H_
31 30
32#include <drm/drm.h> 31#include <uapi/drm/exynos_drm.h>
33
34/**
35 * User-desired buffer creation information structure.
36 *
37 * @size: user-desired memory allocation size.
38 * - this size value would be page-aligned internally.
39 * @flags: user request for setting memory type or cache attributes.
40 * @handle: returned a handle to created gem object.
41 * - this handle will be set by gem module of kernel side.
42 */
43struct drm_exynos_gem_create {
44 uint64_t size;
45 unsigned int flags;
46 unsigned int handle;
47};
48
49/**
50 * A structure for getting buffer offset.
51 *
52 * @handle: a pointer to gem object created.
53 * @pad: just padding to be 64-bit aligned.
54 * @offset: relatived offset value of the memory region allocated.
55 * - this value should be set by user.
56 */
57struct drm_exynos_gem_map_off {
58 unsigned int handle;
59 unsigned int pad;
60 uint64_t offset;
61};
62
63/**
64 * A structure for mapping buffer.
65 *
66 * @handle: a handle to gem object created.
67 * @pad: just padding to be 64-bit aligned.
68 * @size: memory size to be mapped.
69 * @mapped: having user virtual address mmaped.
70 * - this variable would be filled by exynos gem module
71 * of kernel side with user virtual address which is allocated
72 * by do_mmap().
73 */
74struct drm_exynos_gem_mmap {
75 unsigned int handle;
76 unsigned int pad;
77 uint64_t size;
78 uint64_t mapped;
79};
80
81/**
82 * A structure to gem information.
83 *
84 * @handle: a handle to gem object created.
85 * @flags: flag value including memory type and cache attribute and
86 * this value would be set by driver.
87 * @size: size to memory region allocated by gem and this size would
88 * be set by driver.
89 */
90struct drm_exynos_gem_info {
91 unsigned int handle;
92 unsigned int flags;
93 uint64_t size;
94};
95
96/**
97 * A structure for user connection request of virtual display.
98 *
99 * @connection: indicate whether doing connetion or not by user.
100 * @extensions: if this value is 1 then the vidi driver would need additional
101 * 128bytes edid data.
102 * @edid: the edid data pointer from user side.
103 */
104struct drm_exynos_vidi_connection {
105 unsigned int connection;
106 unsigned int extensions;
107 uint64_t edid;
108};
109
110/* memory type definitions. */
111enum e_drm_exynos_gem_mem_type {
112 /* Physically Continuous memory and used as default. */
113 EXYNOS_BO_CONTIG = 0 << 0,
114 /* Physically Non-Continuous memory. */
115 EXYNOS_BO_NONCONTIG = 1 << 0,
116 /* non-cachable mapping and used as default. */
117 EXYNOS_BO_NONCACHABLE = 0 << 1,
118 /* cachable mapping. */
119 EXYNOS_BO_CACHABLE = 1 << 1,
120 /* write-combine mapping. */
121 EXYNOS_BO_WC = 1 << 2,
122 EXYNOS_BO_MASK = EXYNOS_BO_NONCONTIG | EXYNOS_BO_CACHABLE |
123 EXYNOS_BO_WC
124};
125
126struct drm_exynos_g2d_get_ver {
127 __u32 major;
128 __u32 minor;
129};
130
131struct drm_exynos_g2d_cmd {
132 __u32 offset;
133 __u32 data;
134};
135
136enum drm_exynos_g2d_event_type {
137 G2D_EVENT_NOT,
138 G2D_EVENT_NONSTOP,
139 G2D_EVENT_STOP, /* not yet */
140};
141
142struct drm_exynos_g2d_set_cmdlist {
143 __u64 cmd;
144 __u64 cmd_gem;
145 __u32 cmd_nr;
146 __u32 cmd_gem_nr;
147
148 /* for g2d event */
149 __u64 event_type;
150 __u64 user_data;
151};
152
153struct drm_exynos_g2d_exec {
154 __u64 async;
155};
156
157#define DRM_EXYNOS_GEM_CREATE 0x00
158#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01
159#define DRM_EXYNOS_GEM_MMAP 0x02
160/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
161#define DRM_EXYNOS_GEM_GET 0x04
162#define DRM_EXYNOS_VIDI_CONNECTION 0x07
163
164/* G2D */
165#define DRM_EXYNOS_G2D_GET_VER 0x20
166#define DRM_EXYNOS_G2D_SET_CMDLIST 0x21
167#define DRM_EXYNOS_G2D_EXEC 0x22
168
169#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
170 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
171
172#define DRM_IOCTL_EXYNOS_GEM_MAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + \
173 DRM_EXYNOS_GEM_MAP_OFFSET, struct drm_exynos_gem_map_off)
174
175#define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \
176 DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap)
177
178#define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \
179 DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info)
180
181#define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \
182 DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection)
183
184#define DRM_IOCTL_EXYNOS_G2D_GET_VER DRM_IOWR(DRM_COMMAND_BASE + \
185 DRM_EXYNOS_G2D_GET_VER, struct drm_exynos_g2d_get_ver)
186#define DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST DRM_IOWR(DRM_COMMAND_BASE + \
187 DRM_EXYNOS_G2D_SET_CMDLIST, struct drm_exynos_g2d_set_cmdlist)
188#define DRM_IOCTL_EXYNOS_G2D_EXEC DRM_IOWR(DRM_COMMAND_BASE + \
189 DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec)
190
191/* EXYNOS specific events */
192#define DRM_EXYNOS_G2D_EVENT 0x80000000
193
194struct drm_exynos_g2d_event {
195 struct drm_event base;
196 __u64 user_data;
197 __u32 tv_sec;
198 __u32 tv_usec;
199 __u32 cmdlist_no;
200 __u32 reserved;
201};
202
203#ifdef __KERNEL__
204 32
205/** 33/**
206 * A structure for lcd panel information. 34 * A structure for lcd panel information.
@@ -257,5 +85,4 @@ struct exynos_drm_hdmi_pdata {
257 int (*get_hpd)(void); 85 int (*get_hpd)(void);
258}; 86};
259 87
260#endif /* __KERNEL__ */
261#endif /* _EXYNOS_DRM_H_ */ 88#endif /* _EXYNOS_DRM_H_ */
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index a940d4e18917..63d609d8a3f6 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -23,933 +23,15 @@
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 * 24 *
25 */ 25 */
26
27#ifndef _I915_DRM_H_ 26#ifndef _I915_DRM_H_
28#define _I915_DRM_H_ 27#define _I915_DRM_H_
29 28
30#include <drm/drm.h> 29#include <uapi/drm/i915_drm.h>
31
32/* Please note that modifications to all structs defined here are
33 * subject to backwards-compatibility constraints.
34 */
35 30
36#ifdef __KERNEL__
37/* For use by IPS driver */ 31/* For use by IPS driver */
38extern unsigned long i915_read_mch_val(void); 32extern unsigned long i915_read_mch_val(void);
39extern bool i915_gpu_raise(void); 33extern bool i915_gpu_raise(void);
40extern bool i915_gpu_lower(void); 34extern bool i915_gpu_lower(void);
41extern bool i915_gpu_busy(void); 35extern bool i915_gpu_busy(void);
42extern bool i915_gpu_turbo_disable(void); 36extern bool i915_gpu_turbo_disable(void);
43#endif
44
45/* Each region is a minimum of 16k, and there are at most 255 of them.
46 */
47#define I915_NR_TEX_REGIONS 255 /* table size 2k - maximum due to use
48 * of chars for next/prev indices */
49#define I915_LOG_MIN_TEX_REGION_SIZE 14
50
51typedef struct _drm_i915_init {
52 enum {
53 I915_INIT_DMA = 0x01,
54 I915_CLEANUP_DMA = 0x02,
55 I915_RESUME_DMA = 0x03
56 } func;
57 unsigned int mmio_offset;
58 int sarea_priv_offset;
59 unsigned int ring_start;
60 unsigned int ring_end;
61 unsigned int ring_size;
62 unsigned int front_offset;
63 unsigned int back_offset;
64 unsigned int depth_offset;
65 unsigned int w;
66 unsigned int h;
67 unsigned int pitch;
68 unsigned int pitch_bits;
69 unsigned int back_pitch;
70 unsigned int depth_pitch;
71 unsigned int cpp;
72 unsigned int chipset;
73} drm_i915_init_t;
74
75typedef struct _drm_i915_sarea {
76 struct drm_tex_region texList[I915_NR_TEX_REGIONS + 1];
77 int last_upload; /* last time texture was uploaded */
78 int last_enqueue; /* last time a buffer was enqueued */
79 int last_dispatch; /* age of the most recently dispatched buffer */
80 int ctxOwner; /* last context to upload state */
81 int texAge;
82 int pf_enabled; /* is pageflipping allowed? */
83 int pf_active;
84 int pf_current_page; /* which buffer is being displayed? */
85 int perf_boxes; /* performance boxes to be displayed */
86 int width, height; /* screen size in pixels */
87
88 drm_handle_t front_handle;
89 int front_offset;
90 int front_size;
91
92 drm_handle_t back_handle;
93 int back_offset;
94 int back_size;
95
96 drm_handle_t depth_handle;
97 int depth_offset;
98 int depth_size;
99
100 drm_handle_t tex_handle;
101 int tex_offset;
102 int tex_size;
103 int log_tex_granularity;
104 int pitch;
105 int rotation; /* 0, 90, 180 or 270 */
106 int rotated_offset;
107 int rotated_size;
108 int rotated_pitch;
109 int virtualX, virtualY;
110
111 unsigned int front_tiled;
112 unsigned int back_tiled;
113 unsigned int depth_tiled;
114 unsigned int rotated_tiled;
115 unsigned int rotated2_tiled;
116
117 int pipeA_x;
118 int pipeA_y;
119 int pipeA_w;
120 int pipeA_h;
121 int pipeB_x;
122 int pipeB_y;
123 int pipeB_w;
124 int pipeB_h;
125
126 /* fill out some space for old userspace triple buffer */
127 drm_handle_t unused_handle;
128 __u32 unused1, unused2, unused3;
129
130 /* buffer object handles for static buffers. May change
131 * over the lifetime of the client.
132 */
133 __u32 front_bo_handle;
134 __u32 back_bo_handle;
135 __u32 unused_bo_handle;
136 __u32 depth_bo_handle;
137
138} drm_i915_sarea_t;
139
140/* due to userspace building against these headers we need some compat here */
141#define planeA_x pipeA_x
142#define planeA_y pipeA_y
143#define planeA_w pipeA_w
144#define planeA_h pipeA_h
145#define planeB_x pipeB_x
146#define planeB_y pipeB_y
147#define planeB_w pipeB_w
148#define planeB_h pipeB_h
149
150/* Flags for perf_boxes
151 */
152#define I915_BOX_RING_EMPTY 0x1
153#define I915_BOX_FLIP 0x2
154#define I915_BOX_WAIT 0x4
155#define I915_BOX_TEXTURE_LOAD 0x8
156#define I915_BOX_LOST_CONTEXT 0x10
157
158/* I915 specific ioctls
159 * The device specific ioctl range is 0x40 to 0x79.
160 */
161#define DRM_I915_INIT 0x00
162#define DRM_I915_FLUSH 0x01
163#define DRM_I915_FLIP 0x02
164#define DRM_I915_BATCHBUFFER 0x03
165#define DRM_I915_IRQ_EMIT 0x04
166#define DRM_I915_IRQ_WAIT 0x05
167#define DRM_I915_GETPARAM 0x06
168#define DRM_I915_SETPARAM 0x07
169#define DRM_I915_ALLOC 0x08
170#define DRM_I915_FREE 0x09
171#define DRM_I915_INIT_HEAP 0x0a
172#define DRM_I915_CMDBUFFER 0x0b
173#define DRM_I915_DESTROY_HEAP 0x0c
174#define DRM_I915_SET_VBLANK_PIPE 0x0d
175#define DRM_I915_GET_VBLANK_PIPE 0x0e
176#define DRM_I915_VBLANK_SWAP 0x0f
177#define DRM_I915_HWS_ADDR 0x11
178#define DRM_I915_GEM_INIT 0x13
179#define DRM_I915_GEM_EXECBUFFER 0x14
180#define DRM_I915_GEM_PIN 0x15
181#define DRM_I915_GEM_UNPIN 0x16
182#define DRM_I915_GEM_BUSY 0x17
183#define DRM_I915_GEM_THROTTLE 0x18
184#define DRM_I915_GEM_ENTERVT 0x19
185#define DRM_I915_GEM_LEAVEVT 0x1a
186#define DRM_I915_GEM_CREATE 0x1b
187#define DRM_I915_GEM_PREAD 0x1c
188#define DRM_I915_GEM_PWRITE 0x1d
189#define DRM_I915_GEM_MMAP 0x1e
190#define DRM_I915_GEM_SET_DOMAIN 0x1f
191#define DRM_I915_GEM_SW_FINISH 0x20
192#define DRM_I915_GEM_SET_TILING 0x21
193#define DRM_I915_GEM_GET_TILING 0x22
194#define DRM_I915_GEM_GET_APERTURE 0x23
195#define DRM_I915_GEM_MMAP_GTT 0x24
196#define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25
197#define DRM_I915_GEM_MADVISE 0x26
198#define DRM_I915_OVERLAY_PUT_IMAGE 0x27
199#define DRM_I915_OVERLAY_ATTRS 0x28
200#define DRM_I915_GEM_EXECBUFFER2 0x29
201#define DRM_I915_GET_SPRITE_COLORKEY 0x2a
202#define DRM_I915_SET_SPRITE_COLORKEY 0x2b
203#define DRM_I915_GEM_WAIT 0x2c
204#define DRM_I915_GEM_CONTEXT_CREATE 0x2d
205#define DRM_I915_GEM_CONTEXT_DESTROY 0x2e
206#define DRM_I915_GEM_SET_CACHING 0x2f
207#define DRM_I915_GEM_GET_CACHING 0x30
208#define DRM_I915_REG_READ 0x31
209
210#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
211#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
212#define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP)
213#define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t)
214#define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t)
215#define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t)
216#define DRM_IOCTL_I915_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GETPARAM, drm_i915_getparam_t)
217#define DRM_IOCTL_I915_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SETPARAM, drm_i915_setparam_t)
218#define DRM_IOCTL_I915_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_ALLOC, drm_i915_mem_alloc_t)
219#define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t)
220#define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t)
221#define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t)
222#define DRM_IOCTL_I915_DESTROY_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t)
223#define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
224#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
225#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t)
226#define DRM_IOCTL_I915_HWS_ADDR DRM_IOW(DRM_COMMAND_BASE + DRM_I915_HWS_ADDR, struct drm_i915_gem_init)
227#define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init)
228#define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer)
229#define DRM_IOCTL_I915_GEM_EXECBUFFER2 DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2)
230#define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin)
231#define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin)
232#define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy)
233#define DRM_IOCTL_I915_GEM_SET_CACHING DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_SET_CACHING, struct drm_i915_gem_caching)
234#define DRM_IOCTL_I915_GEM_GET_CACHING DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_GET_CACHING, struct drm_i915_gem_caching)
235#define DRM_IOCTL_I915_GEM_THROTTLE DRM_IO ( DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE)
236#define DRM_IOCTL_I915_GEM_ENTERVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT)
237#define DRM_IOCTL_I915_GEM_LEAVEVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT)
238#define DRM_IOCTL_I915_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create)
239#define DRM_IOCTL_I915_GEM_PREAD DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread)
240#define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite)
241#define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap)
242#define DRM_IOCTL_I915_GEM_MMAP_GTT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt)
243#define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain)
244#define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish)
245#define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling)
246#define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling)
247#define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture)
248#define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_i915_get_pipe_from_crtc_id)
249#define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise)
250#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image)
251#define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs)
252#define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
253#define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
254#define DRM_IOCTL_I915_GEM_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait)
255#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create)
256#define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy)
257#define DRM_IOCTL_I915_REG_READ DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read)
258
259/* Allow drivers to submit batchbuffers directly to hardware, relying
260 * on the security mechanisms provided by hardware.
261 */
262typedef struct drm_i915_batchbuffer {
263 int start; /* agp offset */
264 int used; /* nr bytes in use */
265 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
266 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
267 int num_cliprects; /* mulitpass with multiple cliprects? */
268 struct drm_clip_rect __user *cliprects; /* pointer to userspace cliprects */
269} drm_i915_batchbuffer_t;
270
271/* As above, but pass a pointer to userspace buffer which can be
272 * validated by the kernel prior to sending to hardware.
273 */
274typedef struct _drm_i915_cmdbuffer {
275 char __user *buf; /* pointer to userspace command buffer */
276 int sz; /* nr bytes in buf */
277 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
278 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
279 int num_cliprects; /* mulitpass with multiple cliprects? */
280 struct drm_clip_rect __user *cliprects; /* pointer to userspace cliprects */
281} drm_i915_cmdbuffer_t;
282
283/* Userspace can request & wait on irq's:
284 */
285typedef struct drm_i915_irq_emit {
286 int __user *irq_seq;
287} drm_i915_irq_emit_t;
288
289typedef struct drm_i915_irq_wait {
290 int irq_seq;
291} drm_i915_irq_wait_t;
292
293/* Ioctl to query kernel params:
294 */
295#define I915_PARAM_IRQ_ACTIVE 1
296#define I915_PARAM_ALLOW_BATCHBUFFER 2
297#define I915_PARAM_LAST_DISPATCH 3
298#define I915_PARAM_CHIPSET_ID 4
299#define I915_PARAM_HAS_GEM 5
300#define I915_PARAM_NUM_FENCES_AVAIL 6
301#define I915_PARAM_HAS_OVERLAY 7
302#define I915_PARAM_HAS_PAGEFLIPPING 8
303#define I915_PARAM_HAS_EXECBUF2 9
304#define I915_PARAM_HAS_BSD 10
305#define I915_PARAM_HAS_BLT 11
306#define I915_PARAM_HAS_RELAXED_FENCING 12
307#define I915_PARAM_HAS_COHERENT_RINGS 13
308#define I915_PARAM_HAS_EXEC_CONSTANTS 14
309#define I915_PARAM_HAS_RELAXED_DELTA 15
310#define I915_PARAM_HAS_GEN7_SOL_RESET 16
311#define I915_PARAM_HAS_LLC 17
312#define I915_PARAM_HAS_ALIASING_PPGTT 18
313#define I915_PARAM_HAS_WAIT_TIMEOUT 19
314#define I915_PARAM_HAS_SEMAPHORES 20
315#define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21
316#define I915_PARAM_RSVD_FOR_FUTURE_USE 22
317
318typedef struct drm_i915_getparam {
319 int param;
320 int __user *value;
321} drm_i915_getparam_t;
322
323/* Ioctl to set kernel params:
324 */
325#define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1
326#define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2
327#define I915_SETPARAM_ALLOW_BATCHBUFFER 3
328#define I915_SETPARAM_NUM_USED_FENCES 4
329
330typedef struct drm_i915_setparam {
331 int param;
332 int value;
333} drm_i915_setparam_t;
334
335/* A memory manager for regions of shared memory:
336 */
337#define I915_MEM_REGION_AGP 1
338
339typedef struct drm_i915_mem_alloc {
340 int region;
341 int alignment;
342 int size;
343 int __user *region_offset; /* offset from start of fb or agp */
344} drm_i915_mem_alloc_t;
345
346typedef struct drm_i915_mem_free {
347 int region;
348 int region_offset;
349} drm_i915_mem_free_t;
350
351typedef struct drm_i915_mem_init_heap {
352 int region;
353 int size;
354 int start;
355} drm_i915_mem_init_heap_t;
356
357/* Allow memory manager to be torn down and re-initialized (eg on
358 * rotate):
359 */
360typedef struct drm_i915_mem_destroy_heap {
361 int region;
362} drm_i915_mem_destroy_heap_t;
363
364/* Allow X server to configure which pipes to monitor for vblank signals
365 */
366#define DRM_I915_VBLANK_PIPE_A 1
367#define DRM_I915_VBLANK_PIPE_B 2
368
369typedef struct drm_i915_vblank_pipe {
370 int pipe;
371} drm_i915_vblank_pipe_t;
372
373/* Schedule buffer swap at given vertical blank:
374 */
375typedef struct drm_i915_vblank_swap {
376 drm_drawable_t drawable;
377 enum drm_vblank_seq_type seqtype;
378 unsigned int sequence;
379} drm_i915_vblank_swap_t;
380
381typedef struct drm_i915_hws_addr {
382 __u64 addr;
383} drm_i915_hws_addr_t;
384
385struct drm_i915_gem_init {
386 /**
387 * Beginning offset in the GTT to be managed by the DRM memory
388 * manager.
389 */
390 __u64 gtt_start;
391 /**
392 * Ending offset in the GTT to be managed by the DRM memory
393 * manager.
394 */
395 __u64 gtt_end;
396};
397
398struct drm_i915_gem_create {
399 /**
400 * Requested size for the object.
401 *
402 * The (page-aligned) allocated size for the object will be returned.
403 */
404 __u64 size;
405 /**
406 * Returned handle for the object.
407 *
408 * Object handles are nonzero.
409 */
410 __u32 handle;
411 __u32 pad;
412};
413
414struct drm_i915_gem_pread {
415 /** Handle for the object being read. */
416 __u32 handle;
417 __u32 pad;
418 /** Offset into the object to read from */
419 __u64 offset;
420 /** Length of data to read */
421 __u64 size;
422 /**
423 * Pointer to write the data into.
424 *
425 * This is a fixed-size type for 32/64 compatibility.
426 */
427 __u64 data_ptr;
428};
429
430struct drm_i915_gem_pwrite {
431 /** Handle for the object being written to. */
432 __u32 handle;
433 __u32 pad;
434 /** Offset into the object to write to */
435 __u64 offset;
436 /** Length of data to write */
437 __u64 size;
438 /**
439 * Pointer to read the data from.
440 *
441 * This is a fixed-size type for 32/64 compatibility.
442 */
443 __u64 data_ptr;
444};
445
446struct drm_i915_gem_mmap {
447 /** Handle for the object being mapped. */
448 __u32 handle;
449 __u32 pad;
450 /** Offset in the object to map. */
451 __u64 offset;
452 /**
453 * Length of data to map.
454 *
455 * The value will be page-aligned.
456 */
457 __u64 size;
458 /**
459 * Returned pointer the data was mapped at.
460 *
461 * This is a fixed-size type for 32/64 compatibility.
462 */
463 __u64 addr_ptr;
464};
465
466struct drm_i915_gem_mmap_gtt {
467 /** Handle for the object being mapped. */
468 __u32 handle;
469 __u32 pad;
470 /**
471 * Fake offset to use for subsequent mmap call
472 *
473 * This is a fixed-size type for 32/64 compatibility.
474 */
475 __u64 offset;
476};
477
478struct drm_i915_gem_set_domain {
479 /** Handle for the object */
480 __u32 handle;
481
482 /** New read domains */
483 __u32 read_domains;
484
485 /** New write domain */
486 __u32 write_domain;
487};
488
489struct drm_i915_gem_sw_finish {
490 /** Handle for the object */
491 __u32 handle;
492};
493
494struct drm_i915_gem_relocation_entry {
495 /**
496 * Handle of the buffer being pointed to by this relocation entry.
497 *
498 * It's appealing to make this be an index into the mm_validate_entry
499 * list to refer to the buffer, but this allows the driver to create
500 * a relocation list for state buffers and not re-write it per
501 * exec using the buffer.
502 */
503 __u32 target_handle;
504
505 /**
506 * Value to be added to the offset of the target buffer to make up
507 * the relocation entry.
508 */
509 __u32 delta;
510
511 /** Offset in the buffer the relocation entry will be written into */
512 __u64 offset;
513
514 /**
515 * Offset value of the target buffer that the relocation entry was last
516 * written as.
517 *
518 * If the buffer has the same offset as last time, we can skip syncing
519 * and writing the relocation. This value is written back out by
520 * the execbuffer ioctl when the relocation is written.
521 */
522 __u64 presumed_offset;
523
524 /**
525 * Target memory domains read by this operation.
526 */
527 __u32 read_domains;
528
529 /**
530 * Target memory domains written by this operation.
531 *
532 * Note that only one domain may be written by the whole
533 * execbuffer operation, so that where there are conflicts,
534 * the application will get -EINVAL back.
535 */
536 __u32 write_domain;
537};
538
539/** @{
540 * Intel memory domains
541 *
542 * Most of these just align with the various caches in
543 * the system and are used to flush and invalidate as
544 * objects end up cached in different domains.
545 */
546/** CPU cache */
547#define I915_GEM_DOMAIN_CPU 0x00000001
548/** Render cache, used by 2D and 3D drawing */
549#define I915_GEM_DOMAIN_RENDER 0x00000002
550/** Sampler cache, used by texture engine */
551#define I915_GEM_DOMAIN_SAMPLER 0x00000004
552/** Command queue, used to load batch buffers */
553#define I915_GEM_DOMAIN_COMMAND 0x00000008
554/** Instruction cache, used by shader programs */
555#define I915_GEM_DOMAIN_INSTRUCTION 0x00000010
556/** Vertex address cache */
557#define I915_GEM_DOMAIN_VERTEX 0x00000020
558/** GTT domain - aperture and scanout */
559#define I915_GEM_DOMAIN_GTT 0x00000040
560/** @} */
561
562struct drm_i915_gem_exec_object {
563 /**
564 * User's handle for a buffer to be bound into the GTT for this
565 * operation.
566 */
567 __u32 handle;
568
569 /** Number of relocations to be performed on this buffer */
570 __u32 relocation_count;
571 /**
572 * Pointer to array of struct drm_i915_gem_relocation_entry containing
573 * the relocations to be performed in this buffer.
574 */
575 __u64 relocs_ptr;
576
577 /** Required alignment in graphics aperture */
578 __u64 alignment;
579
580 /**
581 * Returned value of the updated offset of the object, for future
582 * presumed_offset writes.
583 */
584 __u64 offset;
585};
586
587struct drm_i915_gem_execbuffer {
588 /**
589 * List of buffers to be validated with their relocations to be
590 * performend on them.
591 *
592 * This is a pointer to an array of struct drm_i915_gem_validate_entry.
593 *
594 * These buffers must be listed in an order such that all relocations
595 * a buffer is performing refer to buffers that have already appeared
596 * in the validate list.
597 */
598 __u64 buffers_ptr;
599 __u32 buffer_count;
600
601 /** Offset in the batchbuffer to start execution from. */
602 __u32 batch_start_offset;
603 /** Bytes used in batchbuffer from batch_start_offset */
604 __u32 batch_len;
605 __u32 DR1;
606 __u32 DR4;
607 __u32 num_cliprects;
608 /** This is a struct drm_clip_rect *cliprects */
609 __u64 cliprects_ptr;
610};
611
612struct drm_i915_gem_exec_object2 {
613 /**
614 * User's handle for a buffer to be bound into the GTT for this
615 * operation.
616 */
617 __u32 handle;
618
619 /** Number of relocations to be performed on this buffer */
620 __u32 relocation_count;
621 /**
622 * Pointer to array of struct drm_i915_gem_relocation_entry containing
623 * the relocations to be performed in this buffer.
624 */
625 __u64 relocs_ptr;
626
627 /** Required alignment in graphics aperture */
628 __u64 alignment;
629
630 /**
631 * Returned value of the updated offset of the object, for future
632 * presumed_offset writes.
633 */
634 __u64 offset;
635
636#define EXEC_OBJECT_NEEDS_FENCE (1<<0)
637 __u64 flags;
638 __u64 rsvd1;
639 __u64 rsvd2;
640};
641
642struct drm_i915_gem_execbuffer2 {
643 /**
644 * List of gem_exec_object2 structs
645 */
646 __u64 buffers_ptr;
647 __u32 buffer_count;
648
649 /** Offset in the batchbuffer to start execution from. */
650 __u32 batch_start_offset;
651 /** Bytes used in batchbuffer from batch_start_offset */
652 __u32 batch_len;
653 __u32 DR1;
654 __u32 DR4;
655 __u32 num_cliprects;
656 /** This is a struct drm_clip_rect *cliprects */
657 __u64 cliprects_ptr;
658#define I915_EXEC_RING_MASK (7<<0)
659#define I915_EXEC_DEFAULT (0<<0)
660#define I915_EXEC_RENDER (1<<0)
661#define I915_EXEC_BSD (2<<0)
662#define I915_EXEC_BLT (3<<0)
663
664/* Used for switching the constants addressing mode on gen4+ RENDER ring.
665 * Gen6+ only supports relative addressing to dynamic state (default) and
666 * absolute addressing.
667 *
668 * These flags are ignored for the BSD and BLT rings.
669 */
670#define I915_EXEC_CONSTANTS_MASK (3<<6)
671#define I915_EXEC_CONSTANTS_REL_GENERAL (0<<6) /* default */
672#define I915_EXEC_CONSTANTS_ABSOLUTE (1<<6)
673#define I915_EXEC_CONSTANTS_REL_SURFACE (2<<6) /* gen4/5 only */
674 __u64 flags;
675 __u64 rsvd1; /* now used for context info */
676 __u64 rsvd2;
677};
678
679/** Resets the SO write offset registers for transform feedback on gen7. */
680#define I915_EXEC_GEN7_SOL_RESET (1<<8)
681
682#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff)
683#define i915_execbuffer2_set_context_id(eb2, context) \
684 (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK
685#define i915_execbuffer2_get_context_id(eb2) \
686 ((eb2).rsvd1 & I915_EXEC_CONTEXT_ID_MASK)
687
688struct drm_i915_gem_pin {
689 /** Handle of the buffer to be pinned. */
690 __u32 handle;
691 __u32 pad;
692
693 /** alignment required within the aperture */
694 __u64 alignment;
695
696 /** Returned GTT offset of the buffer. */
697 __u64 offset;
698};
699
700struct drm_i915_gem_unpin {
701 /** Handle of the buffer to be unpinned. */
702 __u32 handle;
703 __u32 pad;
704};
705
706struct drm_i915_gem_busy {
707 /** Handle of the buffer to check for busy */
708 __u32 handle;
709
710 /** Return busy status (1 if busy, 0 if idle).
711 * The high word is used to indicate on which rings the object
712 * currently resides:
713 * 16:31 - busy (r or r/w) rings (16 render, 17 bsd, 18 blt, etc)
714 */
715 __u32 busy;
716};
717
718#define I915_CACHING_NONE 0
719#define I915_CACHING_CACHED 1
720
721struct drm_i915_gem_caching {
722 /**
723 * Handle of the buffer to set/get the caching level of. */
724 __u32 handle;
725
726 /**
727 * Cacheing level to apply or return value
728 *
729 * bits0-15 are for generic caching control (i.e. the above defined
730 * values). bits16-31 are reserved for platform-specific variations
731 * (e.g. l3$ caching on gen7). */
732 __u32 caching;
733};
734
735#define I915_TILING_NONE 0
736#define I915_TILING_X 1
737#define I915_TILING_Y 2
738
739#define I915_BIT_6_SWIZZLE_NONE 0
740#define I915_BIT_6_SWIZZLE_9 1
741#define I915_BIT_6_SWIZZLE_9_10 2
742#define I915_BIT_6_SWIZZLE_9_11 3
743#define I915_BIT_6_SWIZZLE_9_10_11 4
744/* Not seen by userland */
745#define I915_BIT_6_SWIZZLE_UNKNOWN 5
746/* Seen by userland. */
747#define I915_BIT_6_SWIZZLE_9_17 6
748#define I915_BIT_6_SWIZZLE_9_10_17 7
749
750struct drm_i915_gem_set_tiling {
751 /** Handle of the buffer to have its tiling state updated */
752 __u32 handle;
753
754 /**
755 * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
756 * I915_TILING_Y).
757 *
758 * This value is to be set on request, and will be updated by the
759 * kernel on successful return with the actual chosen tiling layout.
760 *
761 * The tiling mode may be demoted to I915_TILING_NONE when the system
762 * has bit 6 swizzling that can't be managed correctly by GEM.
763 *
764 * Buffer contents become undefined when changing tiling_mode.
765 */
766 __u32 tiling_mode;
767
768 /**
769 * Stride in bytes for the object when in I915_TILING_X or
770 * I915_TILING_Y.
771 */
772 __u32 stride;
773
774 /**
775 * Returned address bit 6 swizzling required for CPU access through
776 * mmap mapping.
777 */
778 __u32 swizzle_mode;
779};
780
781struct drm_i915_gem_get_tiling {
782 /** Handle of the buffer to get tiling state for. */
783 __u32 handle;
784
785 /**
786 * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
787 * I915_TILING_Y).
788 */
789 __u32 tiling_mode;
790
791 /**
792 * Returned address bit 6 swizzling required for CPU access through
793 * mmap mapping.
794 */
795 __u32 swizzle_mode;
796};
797
798struct drm_i915_gem_get_aperture {
799 /** Total size of the aperture used by i915_gem_execbuffer, in bytes */
800 __u64 aper_size;
801
802 /**
803 * Available space in the aperture used by i915_gem_execbuffer, in
804 * bytes
805 */
806 __u64 aper_available_size;
807};
808
809struct drm_i915_get_pipe_from_crtc_id {
810 /** ID of CRTC being requested **/
811 __u32 crtc_id;
812
813 /** pipe of requested CRTC **/
814 __u32 pipe;
815};
816
817#define I915_MADV_WILLNEED 0
818#define I915_MADV_DONTNEED 1
819#define __I915_MADV_PURGED 2 /* internal state */
820
821struct drm_i915_gem_madvise {
822 /** Handle of the buffer to change the backing store advice */
823 __u32 handle;
824
825 /* Advice: either the buffer will be needed again in the near future,
826 * or wont be and could be discarded under memory pressure.
827 */
828 __u32 madv;
829
830 /** Whether the backing store still exists. */
831 __u32 retained;
832};
833
834/* flags */
835#define I915_OVERLAY_TYPE_MASK 0xff
836#define I915_OVERLAY_YUV_PLANAR 0x01
837#define I915_OVERLAY_YUV_PACKED 0x02
838#define I915_OVERLAY_RGB 0x03
839
840#define I915_OVERLAY_DEPTH_MASK 0xff00
841#define I915_OVERLAY_RGB24 0x1000
842#define I915_OVERLAY_RGB16 0x2000
843#define I915_OVERLAY_RGB15 0x3000
844#define I915_OVERLAY_YUV422 0x0100
845#define I915_OVERLAY_YUV411 0x0200
846#define I915_OVERLAY_YUV420 0x0300
847#define I915_OVERLAY_YUV410 0x0400
848
849#define I915_OVERLAY_SWAP_MASK 0xff0000
850#define I915_OVERLAY_NO_SWAP 0x000000
851#define I915_OVERLAY_UV_SWAP 0x010000
852#define I915_OVERLAY_Y_SWAP 0x020000
853#define I915_OVERLAY_Y_AND_UV_SWAP 0x030000
854
855#define I915_OVERLAY_FLAGS_MASK 0xff000000
856#define I915_OVERLAY_ENABLE 0x01000000
857
858struct drm_intel_overlay_put_image {
859 /* various flags and src format description */
860 __u32 flags;
861 /* source picture description */
862 __u32 bo_handle;
863 /* stride values and offsets are in bytes, buffer relative */
864 __u16 stride_Y; /* stride for packed formats */
865 __u16 stride_UV;
866 __u32 offset_Y; /* offset for packet formats */
867 __u32 offset_U;
868 __u32 offset_V;
869 /* in pixels */
870 __u16 src_width;
871 __u16 src_height;
872 /* to compensate the scaling factors for partially covered surfaces */
873 __u16 src_scan_width;
874 __u16 src_scan_height;
875 /* output crtc description */
876 __u32 crtc_id;
877 __u16 dst_x;
878 __u16 dst_y;
879 __u16 dst_width;
880 __u16 dst_height;
881};
882
883/* flags */
884#define I915_OVERLAY_UPDATE_ATTRS (1<<0)
885#define I915_OVERLAY_UPDATE_GAMMA (1<<1)
886struct drm_intel_overlay_attrs {
887 __u32 flags;
888 __u32 color_key;
889 __s32 brightness;
890 __u32 contrast;
891 __u32 saturation;
892 __u32 gamma0;
893 __u32 gamma1;
894 __u32 gamma2;
895 __u32 gamma3;
896 __u32 gamma4;
897 __u32 gamma5;
898};
899
900/*
901 * Intel sprite handling
902 *
903 * Color keying works with a min/mask/max tuple. Both source and destination
904 * color keying is allowed.
905 *
906 * Source keying:
907 * Sprite pixels within the min & max values, masked against the color channels
908 * specified in the mask field, will be transparent. All other pixels will
909 * be displayed on top of the primary plane. For RGB surfaces, only the min
910 * and mask fields will be used; ranged compares are not allowed.
911 *
912 * Destination keying:
913 * Primary plane pixels that match the min value, masked against the color
914 * channels specified in the mask field, will be replaced by corresponding
915 * pixels from the sprite plane.
916 *
917 * Note that source & destination keying are exclusive; only one can be
918 * active on a given plane.
919 */
920
921#define I915_SET_COLORKEY_NONE (1<<0) /* disable color key matching */
922#define I915_SET_COLORKEY_DESTINATION (1<<1)
923#define I915_SET_COLORKEY_SOURCE (1<<2)
924struct drm_intel_sprite_colorkey {
925 __u32 plane_id;
926 __u32 min_value;
927 __u32 channel_mask;
928 __u32 max_value;
929 __u32 flags;
930};
931
932struct drm_i915_gem_wait {
933 /** Handle of BO we shall wait on */
934 __u32 bo_handle;
935 __u32 flags;
936 /** Number of nanoseconds to wait, Returns time remaining. */
937 __s64 timeout_ns;
938};
939
940struct drm_i915_gem_context_create {
941 /* output: id of new context*/
942 __u32 ctx_id;
943 __u32 pad;
944};
945
946struct drm_i915_gem_context_destroy {
947 __u32 ctx_id;
948 __u32 pad;
949};
950
951struct drm_i915_reg_read {
952 __u64 offset;
953 __u64 val; /* Return value */
954};
955#endif /* _I915_DRM_H_ */ 37#endif /* _I915_DRM_H_ */
diff --git a/include/keys/asymmetric-parser.h b/include/keys/asymmetric-parser.h
new file mode 100644
index 000000000000..09b3b4807f5c
--- /dev/null
+++ b/include/keys/asymmetric-parser.h
@@ -0,0 +1,37 @@
1/* Asymmetric public-key cryptography data parser
2 *
3 * See Documentation/crypto/asymmetric-keys.txt
4 *
5 * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
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.
12 */
13
14#ifndef _KEYS_ASYMMETRIC_PARSER_H
15#define _KEYS_ASYMMETRIC_PARSER_H
16
17/*
18 * Key data parser. Called during key instantiation.
19 */
20struct asymmetric_key_parser {
21 struct list_head link;
22 struct module *owner;
23 const char *name;
24
25 /* Attempt to parse a key from the data blob passed to add_key() or
26 * keyctl_instantiate(). Should also generate a proposed description
27 * that the caller can optionally use for the key.
28 *
29 * Return EBADMSG if not recognised.
30 */
31 int (*parse)(struct key_preparsed_payload *prep);
32};
33
34extern int register_asymmetric_key_parser(struct asymmetric_key_parser *);
35extern void unregister_asymmetric_key_parser(struct asymmetric_key_parser *);
36
37#endif /* _KEYS_ASYMMETRIC_PARSER_H */
diff --git a/include/keys/asymmetric-subtype.h b/include/keys/asymmetric-subtype.h
new file mode 100644
index 000000000000..4b840e822209
--- /dev/null
+++ b/include/keys/asymmetric-subtype.h
@@ -0,0 +1,55 @@
1/* Asymmetric public-key cryptography key subtype
2 *
3 * See Documentation/security/asymmetric-keys.txt
4 *
5 * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
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.
12 */
13
14#ifndef _KEYS_ASYMMETRIC_SUBTYPE_H
15#define _KEYS_ASYMMETRIC_SUBTYPE_H
16
17#include <linux/seq_file.h>
18#include <keys/asymmetric-type.h>
19
20struct public_key_signature;
21
22/*
23 * Keys of this type declare a subtype that indicates the handlers and
24 * capabilities.
25 */
26struct asymmetric_key_subtype {
27 struct module *owner;
28 const char *name;
29 unsigned short name_len; /* length of name */
30
31 /* Describe a key of this subtype for /proc/keys */
32 void (*describe)(const struct key *key, struct seq_file *m);
33
34 /* Destroy a key of this subtype */
35 void (*destroy)(void *payload);
36
37 /* Verify the signature on a key of this subtype (optional) */
38 int (*verify_signature)(const struct key *key,
39 const struct public_key_signature *sig);
40};
41
42/**
43 * asymmetric_key_subtype - Get the subtype from an asymmetric key
44 * @key: The key of interest.
45 *
46 * Retrieves and returns the subtype pointer of the asymmetric key from the
47 * type-specific data attached to the key.
48 */
49static inline
50struct asymmetric_key_subtype *asymmetric_key_subtype(const struct key *key)
51{
52 return key->type_data.p[0];
53}
54
55#endif /* _KEYS_ASYMMETRIC_SUBTYPE_H */
diff --git a/include/keys/asymmetric-type.h b/include/keys/asymmetric-type.h
new file mode 100644
index 000000000000..7dd473496180
--- /dev/null
+++ b/include/keys/asymmetric-type.h
@@ -0,0 +1,25 @@
1/* Asymmetric Public-key cryptography key type interface
2 *
3 * See Documentation/security/asymmetric-keys.txt
4 *
5 * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.
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.
12 */
13
14#ifndef _KEYS_ASYMMETRIC_TYPE_H
15#define _KEYS_ASYMMETRIC_TYPE_H
16
17#include <linux/key-type.h>
18
19extern struct key_type key_type_asymmetric;
20
21/*
22 * The payload is at the discretion of the subtype.
23 */
24
25#endif /* _KEYS_ASYMMETRIC_TYPE_H */
diff --git a/include/keys/user-type.h b/include/keys/user-type.h
index bc9ec1d7698c..5e452c84f1e6 100644
--- a/include/keys/user-type.h
+++ b/include/keys/user-type.h
@@ -35,8 +35,10 @@ struct user_key_payload {
35extern struct key_type key_type_user; 35extern struct key_type key_type_user;
36extern struct key_type key_type_logon; 36extern struct key_type key_type_logon;
37 37
38extern int user_instantiate(struct key *key, const void *data, size_t datalen); 38struct key_preparsed_payload;
39extern int user_update(struct key *key, const void *data, size_t datalen); 39
40extern int user_instantiate(struct key *key, struct key_preparsed_payload *prep);
41extern int user_update(struct key *key, struct key_preparsed_payload *prep);
40extern int user_match(const struct key *key, const void *criterion); 42extern int user_match(const struct key *key, const void *criterion);
41extern void user_revoke(struct key *key); 43extern void user_revoke(struct key *key);
42extern void user_destroy(struct key *key); 44extern void user_destroy(struct key *key);
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index e149e8be9065..7fe2dae251e5 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -1,413 +1,5 @@
1header-y += byteorder/
2header-y += can/
3header-y += caif/
4header-y += dvb/ 1header-y += dvb/
5header-y += hdlc/ 2header-y += hdlc/
6header-y += hsi/ 3header-y += hsi/
7header-y += isdn/
8header-y += mmc/
9header-y += nfsd/
10header-y += raid/ 4header-y += raid/
11header-y += spi/
12header-y += sunrpc/
13header-y += tc_act/
14header-y += tc_ematch/
15header-y += netfilter/
16header-y += netfilter_arp/
17header-y += netfilter_bridge/
18header-y += netfilter_ipv4/
19header-y += netfilter_ipv6/
20header-y += usb/ 5header-y += usb/
21header-y += wimax/
22
23ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \
24 $(srctree)/include/asm-$(SRCARCH)/a.out.h \
25 $(INSTALL_HDR_PATH)/include/asm-*/a.out.h),)
26header-y += a.out.h
27endif
28ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \
29 $(srctree)/include/asm-$(SRCARCH)/kvm.h \
30 $(INSTALL_HDR_PATH)/include/asm-*/kvm.h),)
31header-y += kvm.h
32endif
33ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h \
34 $(srctree)/include/asm-$(SRCARCH)/kvm_para.h \
35 $(INSTALL_HDR_PATH)/include/asm-*/kvm_para.h),)
36header-y += kvm_para.h
37endif
38
39header-y += acct.h
40header-y += adb.h
41header-y += adfs_fs.h
42header-y += affs_hardblocks.h
43header-y += agpgart.h
44header-y += aio_abi.h
45header-y += apm_bios.h
46header-y += arcfb.h
47header-y += atalk.h
48header-y += atm.h
49header-y += atm_eni.h
50header-y += atm_he.h
51header-y += atm_idt77105.h
52header-y += atm_nicstar.h
53header-y += atm_tcp.h
54header-y += atm_zatm.h
55header-y += atmapi.h
56header-y += atmarp.h
57header-y += atmbr2684.h
58header-y += atmclip.h
59header-y += atmdev.h
60header-y += atmioc.h
61header-y += atmlec.h
62header-y += atmmpc.h
63header-y += atmppp.h
64header-y += atmsap.h
65header-y += atmsvc.h
66header-y += audit.h
67header-y += auto_fs.h
68header-y += auto_fs4.h
69header-y += auxvec.h
70header-y += ax25.h
71header-y += b1lli.h
72header-y += baycom.h
73header-y += bfs_fs.h
74header-y += binfmts.h
75header-y += blk_types.h
76header-y += blkpg.h
77header-y += blktrace_api.h
78header-y += bpqether.h
79header-y += bsg.h
80header-y += can.h
81header-y += capability.h
82header-y += capi.h
83header-y += cciss_defs.h
84header-y += cciss_ioctl.h
85header-y += cdrom.h
86header-y += cgroupstats.h
87header-y += chio.h
88header-y += cm4000_cs.h
89header-y += cn_proc.h
90header-y += coda.h
91header-y += coda_psdev.h
92header-y += coff.h
93header-y += connector.h
94header-y += const.h
95header-y += cramfs_fs.h
96header-y += cuda.h
97header-y += cyclades.h
98header-y += cycx_cfm.h
99header-y += dcbnl.h
100header-y += dccp.h
101header-y += dlm.h
102header-y += dlm_device.h
103header-y += dlm_netlink.h
104header-y += dlm_plock.h
105header-y += dlmconstants.h
106header-y += dm-ioctl.h
107header-y += dm-log-userspace.h
108header-y += dn.h
109header-y += dqblk_xfs.h
110header-y += edd.h
111header-y += efs_fs_sb.h
112header-y += elf-em.h
113header-y += elf-fdpic.h
114header-y += elf.h
115header-y += elfcore.h
116header-y += errno.h
117header-y += errqueue.h
118header-y += ethtool.h
119header-y += eventpoll.h
120header-y += fadvise.h
121header-y += falloc.h
122header-y += fanotify.h
123header-y += fb.h
124header-y += fcntl.h
125header-y += fd.h
126header-y += fdreg.h
127header-y += fib_rules.h
128header-y += fiemap.h
129header-y += filter.h
130header-y += firewire-cdev.h
131header-y += firewire-constants.h
132header-y += flat.h
133header-y += fs.h
134header-y += fsl_hypervisor.h
135header-y += fuse.h
136header-y += futex.h
137header-y += gameport.h
138header-y += gen_stats.h
139header-y += genetlink.h
140header-y += gfs2_ondisk.h
141header-y += gigaset_dev.h
142header-y += hdlc.h
143header-y += hdlcdrv.h
144header-y += hdreg.h
145header-y += hid.h
146header-y += hiddev.h
147header-y += hidraw.h
148header-y += hpet.h
149header-y += hysdn_if.h
150header-y += i2c-dev.h
151header-y += i2c.h
152header-y += i2o-dev.h
153header-y += i8k.h
154header-y += icmp.h
155header-y += icmpv6.h
156header-y += if.h
157header-y += if_addr.h
158header-y += if_addrlabel.h
159header-y += if_alg.h
160header-y += if_arcnet.h
161header-y += if_arp.h
162header-y += if_bonding.h
163header-y += if_bridge.h
164header-y += if_cablemodem.h
165header-y += if_eql.h
166header-y += if_ether.h
167header-y += if_fc.h
168header-y += if_fddi.h
169header-y += if_frad.h
170header-y += if_hippi.h
171header-y += if_infiniband.h
172header-y += if_link.h
173header-y += if_ltalk.h
174header-y += if_packet.h
175header-y += if_phonet.h
176header-y += if_plip.h
177header-y += if_ppp.h
178header-y += if_pppol2tp.h
179header-y += if_pppox.h
180header-y += if_slip.h
181header-y += if_team.h
182header-y += if_tun.h
183header-y += if_tunnel.h
184header-y += if_vlan.h
185header-y += if_x25.h
186header-y += igmp.h
187header-y += in.h
188header-y += in6.h
189header-y += in_route.h
190header-y += sock_diag.h
191header-y += inet_diag.h
192header-y += unix_diag.h
193header-y += packet_diag.h
194header-y += inotify.h
195header-y += input.h
196header-y += ioctl.h
197header-y += ip.h
198header-y += ip6_tunnel.h
199header-y += ip_vs.h
200header-y += ipc.h
201header-y += ipmi.h
202header-y += ipmi_msgdefs.h
203header-y += ipsec.h
204header-y += ipv6.h
205header-y += ipv6_route.h
206header-y += ipx.h
207header-y += irda.h
208header-y += irqnr.h
209header-y += isdn.h
210header-y += isdn_divertif.h
211header-y += isdn_ppp.h
212header-y += isdnif.h
213header-y += iso_fs.h
214header-y += ivtv.h
215header-y += ivtvfb.h
216header-y += ixjuser.h
217header-y += jffs2.h
218header-y += joystick.h
219header-y += kd.h
220header-y += kdev_t.h
221header-y += kernel.h
222header-y += kernelcapi.h
223header-y += kernel-page-flags.h
224header-y += kexec.h
225header-y += keyboard.h
226header-y += keyctl.h
227header-y += l2tp.h
228header-y += limits.h
229header-y += llc.h
230header-y += loop.h
231header-y += lp.h
232header-y += magic.h
233header-y += major.h
234header-y += map_to_7segment.h
235header-y += matroxfb.h
236header-y += mdio.h
237header-y += media.h
238header-y += mei.h
239header-y += mempolicy.h
240header-y += meye.h
241header-y += mii.h
242header-y += minix_fs.h
243header-y += mman.h
244header-y += mmtimer.h
245header-y += mqueue.h
246header-y += mroute.h
247header-y += mroute6.h
248header-y += msdos_fs.h
249header-y += msg.h
250header-y += mtio.h
251header-y += n_r3964.h
252header-y += nbd.h
253header-y += ncp.h
254header-y += ncp_fs.h
255header-y += ncp_mount.h
256header-y += ncp_no.h
257header-y += neighbour.h
258header-y += net.h
259header-y += net_dropmon.h
260header-y += net_tstamp.h
261header-y += netdevice.h
262header-y += netfilter.h
263header-y += netfilter_arp.h
264header-y += netfilter_bridge.h
265header-y += netfilter_decnet.h
266header-y += netfilter_ipv4.h
267header-y += netfilter_ipv6.h
268header-y += netlink.h
269header-y += netrom.h
270header-y += nfc.h
271header-y += nfs.h
272header-y += nfs2.h
273header-y += nfs3.h
274header-y += nfs4.h
275header-y += nfs4_mount.h
276header-y += nfs_fs.h
277header-y += nfs_idmap.h
278header-y += nfs_mount.h
279header-y += nfsacl.h
280header-y += nl80211.h
281header-y += nubus.h
282header-y += nvram.h
283header-y += omap3isp.h
284header-y += omapfb.h
285header-y += oom.h
286header-y += param.h
287header-y += parport.h
288header-y += patchkey.h
289header-y += pci.h
290header-y += pci_regs.h
291header-y += perf_event.h
292header-y += personality.h
293header-y += pfkeyv2.h
294header-y += pg.h
295header-y += phantom.h
296header-y += phonet.h
297header-y += pkt_cls.h
298header-y += pkt_sched.h
299header-y += pktcdvd.h
300header-y += pmu.h
301header-y += poll.h
302header-y += posix_types.h
303header-y += ppdev.h
304header-y += ppp-comp.h
305header-y += ppp-ioctl.h
306header-y += ppp_defs.h
307header-y += pps.h
308header-y += prctl.h
309header-y += ptp_clock.h
310header-y += ptrace.h
311header-y += qnx4_fs.h
312header-y += qnxtypes.h
313header-y += quota.h
314header-y += radeonfb.h
315header-y += random.h
316header-y += raw.h
317header-y += rds.h
318header-y += reboot.h
319header-y += reiserfs_fs.h
320header-y += reiserfs_xattr.h
321header-y += resource.h
322header-y += rfkill.h
323header-y += romfs_fs.h
324header-y += rose.h
325header-y += route.h
326header-y += rtc.h
327header-y += rtnetlink.h
328header-y += scc.h
329header-y += sched.h
330header-y += screen_info.h
331header-y += sdla.h
332header-y += seccomp.h
333header-y += securebits.h
334header-y += selinux_netlink.h
335header-y += sem.h
336header-y += serial.h
337header-y += serial_core.h
338header-y += serial_reg.h
339header-y += serio.h
340header-y += shm.h
341header-y += signal.h
342header-y += signalfd.h
343header-y += snmp.h
344header-y += socket.h
345header-y += sockios.h
346header-y += som.h
347header-y += sonet.h
348header-y += sonypi.h
349header-y += sound.h
350header-y += soundcard.h
351header-y += stat.h
352header-y += stddef.h
353header-y += string.h
354header-y += suspend_ioctls.h
355header-y += swab.h
356header-y += synclink.h
357header-y += sysctl.h
358header-y += sysinfo.h
359header-y += taskstats.h
360header-y += tcp.h
361header-y += tcp_metrics.h
362header-y += telephony.h
363header-y += termios.h
364header-y += time.h
365header-y += times.h
366header-y += timex.h
367header-y += tiocl.h
368header-y += tipc.h
369header-y += tipc_config.h
370header-y += toshiba.h
371header-y += tty.h
372header-y += tty_flags.h
373header-y += types.h
374header-y += udf_fs_i.h
375header-y += udp.h
376header-y += uhid.h
377header-y += uinput.h
378header-y += uio.h
379header-y += ultrasound.h
380header-y += un.h
381header-y += unistd.h
382header-y += usbdevice_fs.h
383header-y += utime.h
384header-y += utsname.h
385header-y += uuid.h
386header-y += uvcvideo.h
387header-y += v4l2-common.h
388header-y += v4l2-dv-timings.h
389header-y += v4l2-mediabus.h
390header-y += v4l2-subdev.h
391header-y += veth.h
392header-y += vfio.h
393header-y += vhost.h
394header-y += videodev2.h
395header-y += virtio_9p.h
396header-y += virtio_balloon.h
397header-y += virtio_blk.h
398header-y += virtio_config.h
399header-y += virtio_console.h
400header-y += virtio_ids.h
401header-y += virtio_net.h
402header-y += virtio_pci.h
403header-y += virtio_ring.h
404header-y += virtio_rng.h
405header-y += vt.h
406header-y += wait.h
407header-y += wanrouter.h
408header-y += watchdog.h
409header-y += wimax.h
410header-y += wireless.h
411header-y += x25.h
412header-y += xattr.h
413header-y += xfrm.h
diff --git a/include/linux/a.out.h b/include/linux/a.out.h
index e86dfca44589..220f14338895 100644
--- a/include/linux/a.out.h
+++ b/include/linux/a.out.h
@@ -1,278 +1,84 @@
1#ifndef __A_OUT_GNU_H__ 1#ifndef __A_OUT_GNU_H__
2#define __A_OUT_GNU_H__ 2#define __A_OUT_GNU_H__
3 3
4#define __GNU_EXEC_MACROS__ 4#include <uapi/linux/a.out.h>
5
6#ifndef __STRUCT_EXEC_OVERRIDE__
7
8#include <asm/a.out.h>
9
10#endif /* __STRUCT_EXEC_OVERRIDE__ */
11 5
12#ifndef __ASSEMBLY__ 6#ifndef __ASSEMBLY__
13
14/* these go in the N_MACHTYPE field */
15enum machine_type {
16#if defined (M_OLDSUN2) 7#if defined (M_OLDSUN2)
17 M__OLDSUN2 = M_OLDSUN2,
18#else 8#else
19 M_OLDSUN2 = 0,
20#endif 9#endif
21#if defined (M_68010) 10#if defined (M_68010)
22 M__68010 = M_68010,
23#else 11#else
24 M_68010 = 1,
25#endif 12#endif
26#if defined (M_68020) 13#if defined (M_68020)
27 M__68020 = M_68020,
28#else 14#else
29 M_68020 = 2,
30#endif 15#endif
31#if defined (M_SPARC) 16#if defined (M_SPARC)
32 M__SPARC = M_SPARC,
33#else 17#else
34 M_SPARC = 3,
35#endif 18#endif
36 /* skip a bunch so we don't run into any of sun's numbers */
37 M_386 = 100,
38 M_MIPS1 = 151, /* MIPS R3000/R3000 binary */
39 M_MIPS2 = 152 /* MIPS R6000/R4000 binary */
40};
41
42#if !defined (N_MAGIC) 19#if !defined (N_MAGIC)
43#define N_MAGIC(exec) ((exec).a_info & 0xffff)
44#endif 20#endif
45#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
46#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
47#define N_SET_INFO(exec, magic, type, flags) \
48 ((exec).a_info = ((magic) & 0xffff) \
49 | (((int)(type) & 0xff) << 16) \
50 | (((flags) & 0xff) << 24))
51#define N_SET_MAGIC(exec, magic) \
52 ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
53
54#define N_SET_MACHTYPE(exec, machtype) \
55 ((exec).a_info = \
56 ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
57
58#define N_SET_FLAGS(exec, flags) \
59 ((exec).a_info = \
60 ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
61
62/* Code indicating object file or impure executable. */
63#define OMAGIC 0407
64/* Code indicating pure executable. */
65#define NMAGIC 0410
66/* Code indicating demand-paged executable. */
67#define ZMAGIC 0413
68/* This indicates a demand-paged executable with the header in the text.
69 The first page is unmapped to help trap NULL pointer references */
70#define QMAGIC 0314
71
72/* Code indicating core file. */
73#define CMAGIC 0421
74
75#if !defined (N_BADMAG) 21#if !defined (N_BADMAG)
76#define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
77 && N_MAGIC(x) != NMAGIC \
78 && N_MAGIC(x) != ZMAGIC \
79 && N_MAGIC(x) != QMAGIC)
80#endif 22#endif
81
82#define _N_HDROFF(x) (1024 - sizeof (struct exec))
83
84#if !defined (N_TXTOFF) 23#if !defined (N_TXTOFF)
85#define N_TXTOFF(x) \
86 (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \
87 (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
88#endif 24#endif
89
90#if !defined (N_DATOFF) 25#if !defined (N_DATOFF)
91#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
92#endif 26#endif
93
94#if !defined (N_TRELOFF) 27#if !defined (N_TRELOFF)
95#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
96#endif 28#endif
97
98#if !defined (N_DRELOFF) 29#if !defined (N_DRELOFF)
99#define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x))
100#endif 30#endif
101
102#if !defined (N_SYMOFF) 31#if !defined (N_SYMOFF)
103#define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x))
104#endif 32#endif
105
106#if !defined (N_STROFF) 33#if !defined (N_STROFF)
107#define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x))
108#endif 34#endif
109
110/* Address of text segment in memory after it is loaded. */
111#if !defined (N_TXTADDR) 35#if !defined (N_TXTADDR)
112#define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0)
113#endif 36#endif
114
115/* Address of data segment in memory after it is loaded.
116 Note that it is up to you to define SEGMENT_SIZE
117 on machines not listed here. */
118#if defined(vax) || defined(hp300) || defined(pyr) 37#if defined(vax) || defined(hp300) || defined(pyr)
119#define SEGMENT_SIZE page_size
120#endif 38#endif
121#ifdef sony 39#ifdef sony
122#define SEGMENT_SIZE 0x2000
123#endif /* Sony. */ 40#endif /* Sony. */
124#ifdef is68k 41#ifdef is68k
125#define SEGMENT_SIZE 0x20000
126#endif 42#endif
127#if defined(m68k) && defined(PORTAR) 43#if defined(m68k) && defined(PORTAR)
128#define PAGE_SIZE 0x400
129#define SEGMENT_SIZE PAGE_SIZE
130#endif 44#endif
131
132#ifdef linux 45#ifdef linux
133#ifdef __KERNEL__
134#include <asm/page.h> 46#include <asm/page.h>
135#else
136#include <unistd.h>
137#endif
138#if defined(__i386__) || defined(__mc68000__) 47#if defined(__i386__) || defined(__mc68000__)
139#define SEGMENT_SIZE 1024
140#else 48#else
141#ifndef SEGMENT_SIZE 49#ifndef SEGMENT_SIZE
142#ifdef __KERNEL__
143#define SEGMENT_SIZE PAGE_SIZE 50#define SEGMENT_SIZE PAGE_SIZE
144#else
145#define SEGMENT_SIZE getpagesize()
146#endif
147#endif 51#endif
148#endif 52#endif
149#endif 53#endif
150
151#define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE)
152
153#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
154
155#ifndef N_DATADDR 54#ifndef N_DATADDR
156#define N_DATADDR(x) \
157 (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
158 : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
159#endif 55#endif
160
161/* Address of bss segment in memory after it is loaded. */
162#if !defined (N_BSSADDR) 56#if !defined (N_BSSADDR)
163#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
164#endif 57#endif
165
166#if !defined (N_NLIST_DECLARED) 58#if !defined (N_NLIST_DECLARED)
167struct nlist {
168 union {
169 char *n_name;
170 struct nlist *n_next;
171 long n_strx;
172 } n_un;
173 unsigned char n_type;
174 char n_other;
175 short n_desc;
176 unsigned long n_value;
177};
178#endif /* no N_NLIST_DECLARED. */ 59#endif /* no N_NLIST_DECLARED. */
179
180#if !defined (N_UNDF) 60#if !defined (N_UNDF)
181#define N_UNDF 0
182#endif 61#endif
183#if !defined (N_ABS) 62#if !defined (N_ABS)
184#define N_ABS 2
185#endif 63#endif
186#if !defined (N_TEXT) 64#if !defined (N_TEXT)
187#define N_TEXT 4
188#endif 65#endif
189#if !defined (N_DATA) 66#if !defined (N_DATA)
190#define N_DATA 6
191#endif 67#endif
192#if !defined (N_BSS) 68#if !defined (N_BSS)
193#define N_BSS 8
194#endif 69#endif
195#if !defined (N_FN) 70#if !defined (N_FN)
196#define N_FN 15
197#endif 71#endif
198
199#if !defined (N_EXT) 72#if !defined (N_EXT)
200#define N_EXT 1
201#endif 73#endif
202#if !defined (N_TYPE) 74#if !defined (N_TYPE)
203#define N_TYPE 036
204#endif 75#endif
205#if !defined (N_STAB) 76#if !defined (N_STAB)
206#define N_STAB 0340
207#endif 77#endif
208
209/* The following type indicates the definition of a symbol as being
210 an indirect reference to another symbol. The other symbol
211 appears as an undefined reference, immediately following this symbol.
212
213 Indirection is asymmetrical. The other symbol's value will be used
214 to satisfy requests for the indirect symbol, but not vice versa.
215 If the other symbol does not have a definition, libraries will
216 be searched to find a definition. */
217#define N_INDR 0xa
218
219/* The following symbols refer to set elements.
220 All the N_SET[ATDB] symbols with the same name form one set.
221 Space is allocated for the set in the text section, and each set
222 element's value is stored into one word of the space.
223 The first word of the space is the length of the set (number of elements).
224
225 The address of the set is made into an N_SETV symbol
226 whose name is the same as the name of the set.
227 This symbol acts like a N_DATA global symbol
228 in that it can satisfy undefined external references. */
229
230/* These appear as input to LD, in a .o file. */
231#define N_SETA 0x14 /* Absolute set element symbol */
232#define N_SETT 0x16 /* Text set element symbol */
233#define N_SETD 0x18 /* Data set element symbol */
234#define N_SETB 0x1A /* Bss set element symbol */
235
236/* This is output from LD. */
237#define N_SETV 0x1C /* Pointer to set vector in data area. */
238
239#if !defined (N_RELOCATION_INFO_DECLARED) 78#if !defined (N_RELOCATION_INFO_DECLARED)
240/* This structure describes a single relocation to be performed.
241 The text-relocation section of the file is a vector of these structures,
242 all of which apply to the text section.
243 Likewise, the data-relocation section applies to the data section. */
244
245struct relocation_info
246{
247 /* Address (within segment) to be relocated. */
248 int r_address;
249 /* The meaning of r_symbolnum depends on r_extern. */
250 unsigned int r_symbolnum:24;
251 /* Nonzero means value is a pc-relative offset
252 and it should be relocated for changes in its own address
253 as well as for changes in the symbol or section specified. */
254 unsigned int r_pcrel:1;
255 /* Length (as exponent of 2) of the field to be relocated.
256 Thus, a value of 2 indicates 1<<2 bytes. */
257 unsigned int r_length:2;
258 /* 1 => relocate with value of symbol.
259 r_symbolnum is the index of the symbol
260 in file's the symbol table.
261 0 => relocate with the address of a segment.
262 r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
263 (the N_EXT bit may be set also, but signifies nothing). */
264 unsigned int r_extern:1;
265 /* Four bits that aren't used, but when writing an object file
266 it is desirable to clear them. */
267#ifdef NS32K 79#ifdef NS32K
268 unsigned r_bsr:1;
269 unsigned r_disp:1;
270 unsigned r_pad:2;
271#else 80#else
272 unsigned int r_pad:4;
273#endif 81#endif
274};
275#endif /* no N_RELOCATION_INFO_DECLARED. */ 82#endif /* no N_RELOCATION_INFO_DECLARED. */
276
277#endif /*__ASSEMBLY__ */ 83#endif /*__ASSEMBLY__ */
278#endif /* __A_OUT_GNU_H__ */ 84#endif /* __A_OUT_GNU_H__ */
diff --git a/include/linux/acct.h b/include/linux/acct.h
index d537aa0ec414..4a5b7cb56079 100644
--- a/include/linux/acct.h
+++ b/include/linux/acct.h
@@ -11,109 +11,11 @@
11 * Copyright (C) 1995 - 1997 Marco van Wieringen - ELM Consultancy B.V. 11 * Copyright (C) 1995 - 1997 Marco van Wieringen - ELM Consultancy B.V.
12 * 12 *
13 */ 13 */
14
15#ifndef _LINUX_ACCT_H 14#ifndef _LINUX_ACCT_H
16#define _LINUX_ACCT_H 15#define _LINUX_ACCT_H
17 16
18#include <linux/types.h> 17#include <uapi/linux/acct.h>
19
20#include <asm/param.h>
21#include <asm/byteorder.h>
22
23/*
24 * comp_t is a 16-bit "floating" point number with a 3-bit base 8
25 * exponent and a 13-bit fraction.
26 * comp2_t is 24-bit with 5-bit base 2 exponent and 20 bit fraction
27 * (leading 1 not stored).
28 * See linux/kernel/acct.c for the specific encoding systems used.
29 */
30
31typedef __u16 comp_t;
32typedef __u32 comp2_t;
33
34/*
35 * accounting file record
36 *
37 * This structure contains all of the information written out to the
38 * process accounting file whenever a process exits.
39 */
40 18
41#define ACCT_COMM 16
42
43struct acct
44{
45 char ac_flag; /* Flags */
46 char ac_version; /* Always set to ACCT_VERSION */
47 /* for binary compatibility back until 2.0 */
48 __u16 ac_uid16; /* LSB of Real User ID */
49 __u16 ac_gid16; /* LSB of Real Group ID */
50 __u16 ac_tty; /* Control Terminal */
51 __u32 ac_btime; /* Process Creation Time */
52 comp_t ac_utime; /* User Time */
53 comp_t ac_stime; /* System Time */
54 comp_t ac_etime; /* Elapsed Time */
55 comp_t ac_mem; /* Average Memory Usage */
56 comp_t ac_io; /* Chars Transferred */
57 comp_t ac_rw; /* Blocks Read or Written */
58 comp_t ac_minflt; /* Minor Pagefaults */
59 comp_t ac_majflt; /* Major Pagefaults */
60 comp_t ac_swaps; /* Number of Swaps */
61/* m68k had no padding here. */
62#if !defined(CONFIG_M68K) || !defined(__KERNEL__)
63 __u16 ac_ahz; /* AHZ */
64#endif
65 __u32 ac_exitcode; /* Exitcode */
66 char ac_comm[ACCT_COMM + 1]; /* Command Name */
67 __u8 ac_etime_hi; /* Elapsed Time MSB */
68 __u16 ac_etime_lo; /* Elapsed Time LSB */
69 __u32 ac_uid; /* Real User ID */
70 __u32 ac_gid; /* Real Group ID */
71};
72
73struct acct_v3
74{
75 char ac_flag; /* Flags */
76 char ac_version; /* Always set to ACCT_VERSION */
77 __u16 ac_tty; /* Control Terminal */
78 __u32 ac_exitcode; /* Exitcode */
79 __u32 ac_uid; /* Real User ID */
80 __u32 ac_gid; /* Real Group ID */
81 __u32 ac_pid; /* Process ID */
82 __u32 ac_ppid; /* Parent Process ID */
83 __u32 ac_btime; /* Process Creation Time */
84#ifdef __KERNEL__
85 __u32 ac_etime; /* Elapsed Time */
86#else
87 float ac_etime; /* Elapsed Time */
88#endif
89 comp_t ac_utime; /* User Time */
90 comp_t ac_stime; /* System Time */
91 comp_t ac_mem; /* Average Memory Usage */
92 comp_t ac_io; /* Chars Transferred */
93 comp_t ac_rw; /* Blocks Read or Written */
94 comp_t ac_minflt; /* Minor Pagefaults */
95 comp_t ac_majflt; /* Major Pagefaults */
96 comp_t ac_swaps; /* Number of Swaps */
97 char ac_comm[ACCT_COMM]; /* Command Name */
98};
99
100/*
101 * accounting flags
102 */
103 /* bit set when the process ... */
104#define AFORK 0x01 /* ... executed fork, but did not exec */
105#define ASU 0x02 /* ... used super-user privileges */
106#define ACOMPAT 0x04 /* ... used compatibility mode (VAX only not used) */
107#define ACORE 0x08 /* ... dumped core */
108#define AXSIG 0x10 /* ... was killed by a signal */
109
110#ifdef __BIG_ENDIAN
111#define ACCT_BYTEORDER 0x80 /* accounting file is big endian */
112#else
113#define ACCT_BYTEORDER 0x00 /* accounting file is little endian */
114#endif
115
116#ifdef __KERNEL__
117 19
118 20
119#ifdef CONFIG_BSD_PROCESS_ACCT 21#ifdef CONFIG_BSD_PROCESS_ACCT
@@ -163,12 +65,6 @@ typedef struct acct_v3 acct_t;
163typedef struct acct acct_t; 65typedef struct acct acct_t;
164#endif 66#endif
165 67
166#else
167#define ACCT_VERSION 2
168#define AHZ (HZ)
169#endif /* __KERNEL */
170
171#ifdef __KERNEL__
172#include <linux/jiffies.h> 68#include <linux/jiffies.h>
173/* 69/*
174 * Yet another set of HZ to *HZ helper functions. 70 * Yet another set of HZ to *HZ helper functions.
@@ -210,6 +106,4 @@ static inline u64 nsec_to_AHZ(u64 x)
210 return x; 106 return x;
211} 107}
212 108
213#endif /* __KERNEL */
214
215#endif /* _LINUX_ACCT_H */ 109#endif /* _LINUX_ACCT_H */
diff --git a/include/linux/adb.h b/include/linux/adb.h
index 63bca502fa55..cde41300c7ad 100644
--- a/include/linux/adb.h
+++ b/include/linux/adb.h
@@ -4,43 +4,8 @@
4#ifndef __ADB_H 4#ifndef __ADB_H
5#define __ADB_H 5#define __ADB_H
6 6
7/* ADB commands */ 7#include <uapi/linux/adb.h>
8#define ADB_BUSRESET 0
9#define ADB_FLUSH(id) (0x01 | ((id) << 4))
10#define ADB_WRITEREG(id, reg) (0x08 | (reg) | ((id) << 4))
11#define ADB_READREG(id, reg) (0x0C | (reg) | ((id) << 4))
12 8
13/* ADB default device IDs (upper 4 bits of ADB command byte) */
14#define ADB_DONGLE 1 /* "software execution control" devices */
15#define ADB_KEYBOARD 2
16#define ADB_MOUSE 3
17#define ADB_TABLET 4
18#define ADB_MODEM 5
19#define ADB_MISC 7 /* maybe a monitor */
20
21#define ADB_RET_OK 0
22#define ADB_RET_TIMEOUT 3
23
24/* The kind of ADB request. The controller may emulate some
25 or all of those CUDA/PMU packet kinds */
26#define ADB_PACKET 0
27#define CUDA_PACKET 1
28#define ERROR_PACKET 2
29#define TIMER_PACKET 3
30#define POWER_PACKET 4
31#define MACIIC_PACKET 5
32#define PMU_PACKET 6
33#define ADB_QUERY 7
34
35/* ADB queries */
36
37/* ADB_QUERY_GETDEVINFO
38 * Query ADB slot for device presence
39 * data[2] = id, rep[0] = orig addr, rep[1] = handler_id
40 */
41#define ADB_QUERY_GETDEVINFO 1
42
43#ifdef __KERNEL__
44 9
45struct adb_request { 10struct adb_request {
46 unsigned char data[32]; 11 unsigned char data[32];
@@ -98,6 +63,4 @@ int adb_reset_bus(void);
98int adb_try_handler_change(int address, int new_id); 63int adb_try_handler_change(int address, int new_id);
99int adb_get_infos(int address, int *original_address, int *handler_id); 64int adb_get_infos(int address, int *original_address, int *handler_id);
100 65
101#endif /* __KERNEL__ */
102
103#endif /* __ADB_H */ 66#endif /* __ADB_H */
diff --git a/include/linux/adfs_fs.h b/include/linux/adfs_fs.h
index b19801f73890..0d991071a9d4 100644
--- a/include/linux/adfs_fs.h
+++ b/include/linux/adfs_fs.h
@@ -1,47 +1,9 @@
1#ifndef _ADFS_FS_H 1#ifndef _ADFS_FS_H
2#define _ADFS_FS_H 2#define _ADFS_FS_H
3 3
4#include <linux/types.h> 4#include <uapi/linux/adfs_fs.h>
5#include <linux/magic.h>
6 5
7/* 6/*
8 * Disc Record at disc address 0xc00
9 */
10struct adfs_discrecord {
11 __u8 log2secsize;
12 __u8 secspertrack;
13 __u8 heads;
14 __u8 density;
15 __u8 idlen;
16 __u8 log2bpmb;
17 __u8 skew;
18 __u8 bootoption;
19 __u8 lowsector;
20 __u8 nzones;
21 __le16 zone_spare;
22 __le32 root;
23 __le32 disc_size;
24 __le16 disc_id;
25 __u8 disc_name[10];
26 __le32 disc_type;
27 __le32 disc_size_high;
28 __u8 log2sharesize:4;
29 __u8 unused40:4;
30 __u8 big_flag:1;
31 __u8 unused41:1;
32 __u8 nzones_high;
33 __le32 format_version;
34 __le32 root_size;
35 __u8 unused52[60 - 52];
36};
37
38#define ADFS_DISCRECORD (0xc00)
39#define ADFS_DR_OFFSET (0x1c0)
40#define ADFS_DR_SIZE 60
41#define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3)
42
43#ifdef __KERNEL__
44/*
45 * Calculate the boot block checksum on an ADFS drive. Note that this will 7 * Calculate the boot block checksum on an ADFS drive. Note that this will
46 * appear to be correct if the sector contains all zeros, so also check that 8 * appear to be correct if the sector contains all zeros, so also check that
47 * the disk size is non-zero!!! 9 * the disk size is non-zero!!!
@@ -59,5 +21,3 @@ static inline int adfs_checkbblk(unsigned char *ptr)
59 return (result & 0xff) != ptr[511]; 21 return (result & 0xff) != ptr[511];
60} 22}
61#endif 23#endif
62
63#endif
diff --git a/include/linux/agpgart.h b/include/linux/agpgart.h
index f6778eceb8f4..c6b61ca97053 100644
--- a/include/linux/agpgart.h
+++ b/include/linux/agpgart.h
@@ -23,94 +23,12 @@
23 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 * 24 *
25 */ 25 */
26
27#ifndef _AGP_H 26#ifndef _AGP_H
28#define _AGP_H 1 27#define _AGP_H 1
29 28
30#define AGPIOC_BASE 'A'
31#define AGPIOC_INFO _IOR (AGPIOC_BASE, 0, struct agp_info*)
32#define AGPIOC_ACQUIRE _IO (AGPIOC_BASE, 1)
33#define AGPIOC_RELEASE _IO (AGPIOC_BASE, 2)
34#define AGPIOC_SETUP _IOW (AGPIOC_BASE, 3, struct agp_setup*)
35#define AGPIOC_RESERVE _IOW (AGPIOC_BASE, 4, struct agp_region*)
36#define AGPIOC_PROTECT _IOW (AGPIOC_BASE, 5, struct agp_region*)
37#define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 6, struct agp_allocate*)
38#define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int)
39#define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, struct agp_bind*)
40#define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, struct agp_unbind*)
41#define AGPIOC_CHIPSET_FLUSH _IO (AGPIOC_BASE, 10)
42
43#define AGP_DEVICE "/dev/agpgart"
44
45#ifndef TRUE
46#define TRUE 1
47#endif
48
49#ifndef FALSE
50#define FALSE 0
51#endif
52
53#ifndef __KERNEL__
54#include <linux/types.h>
55
56struct agp_version {
57 __u16 major;
58 __u16 minor;
59};
60
61typedef struct _agp_info {
62 struct agp_version version; /* version of the driver */
63 __u32 bridge_id; /* bridge vendor/device */
64 __u32 agp_mode; /* mode info of bridge */
65 unsigned long aper_base;/* base of aperture */
66 size_t aper_size; /* size of aperture */
67 size_t pg_total; /* max pages (swap + system) */
68 size_t pg_system; /* max pages (system) */
69 size_t pg_used; /* current pages used */
70} agp_info;
71
72typedef struct _agp_setup {
73 __u32 agp_mode; /* mode info of bridge */
74} agp_setup;
75
76/*
77 * The "prot" down below needs still a "sleep" flag somehow ...
78 */
79typedef struct _agp_segment {
80 __kernel_off_t pg_start; /* starting page to populate */
81 __kernel_size_t pg_count; /* number of pages */
82 int prot; /* prot flags for mmap */
83} agp_segment;
84
85typedef struct _agp_region {
86 __kernel_pid_t pid; /* pid of process */
87 __kernel_size_t seg_count; /* number of segments */
88 struct _agp_segment *seg_list;
89} agp_region;
90
91typedef struct _agp_allocate {
92 int key; /* tag of allocation */
93 __kernel_size_t pg_count;/* number of pages */
94 __u32 type; /* 0 == normal, other devspec */
95 __u32 physical; /* device specific (some devices
96 * need a phys address of the
97 * actual page behind the gatt
98 * table) */
99} agp_allocate;
100
101typedef struct _agp_bind {
102 int key; /* tag of allocation */
103 __kernel_off_t pg_start;/* starting page to populate */
104} agp_bind;
105
106typedef struct _agp_unbind {
107 int key; /* tag of allocation */
108 __u32 priority; /* priority for paging out */
109} agp_unbind;
110
111#else /* __KERNEL__ */
112#include <linux/mutex.h> 29#include <linux/mutex.h>
113#include <linux/agp_backend.h> 30#include <linux/agp_backend.h>
31#include <uapi/linux/agpgart.h>
114 32
115#define AGPGART_MINOR 175 33#define AGPGART_MINOR 175
116 34
@@ -209,6 +127,4 @@ struct agp_front_data {
209 bool backend_acquired; 127 bool backend_acquired;
210}; 128};
211 129
212#endif /* __KERNEL__ */
213
214#endif /* _AGP_H */ 130#endif /* _AGP_H */
diff --git a/include/linux/alarmtimer.h b/include/linux/alarmtimer.h
index 96c5c249b086..9069694e70eb 100644
--- a/include/linux/alarmtimer.h
+++ b/include/linux/alarmtimer.h
@@ -21,7 +21,6 @@ enum alarmtimer_restart {
21 21
22#define ALARMTIMER_STATE_INACTIVE 0x00 22#define ALARMTIMER_STATE_INACTIVE 0x00
23#define ALARMTIMER_STATE_ENQUEUED 0x01 23#define ALARMTIMER_STATE_ENQUEUED 0x01
24#define ALARMTIMER_STATE_CALLBACK 0x02
25 24
26/** 25/**
27 * struct alarm - Alarm timer structure 26 * struct alarm - Alarm timer structure
@@ -35,6 +34,7 @@ enum alarmtimer_restart {
35 */ 34 */
36struct alarm { 35struct alarm {
37 struct timerqueue_node node; 36 struct timerqueue_node node;
37 struct hrtimer timer;
38 enum alarmtimer_restart (*function)(struct alarm *, ktime_t now); 38 enum alarmtimer_restart (*function)(struct alarm *, ktime_t now);
39 enum alarmtimer_type type; 39 enum alarmtimer_type type;
40 int state; 40 int state;
@@ -43,39 +43,12 @@ struct alarm {
43 43
44void alarm_init(struct alarm *alarm, enum alarmtimer_type type, 44void alarm_init(struct alarm *alarm, enum alarmtimer_type type,
45 enum alarmtimer_restart (*function)(struct alarm *, ktime_t)); 45 enum alarmtimer_restart (*function)(struct alarm *, ktime_t));
46void alarm_start(struct alarm *alarm, ktime_t start); 46int alarm_start(struct alarm *alarm, ktime_t start);
47int alarm_try_to_cancel(struct alarm *alarm); 47int alarm_try_to_cancel(struct alarm *alarm);
48int alarm_cancel(struct alarm *alarm); 48int alarm_cancel(struct alarm *alarm);
49 49
50u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval); 50u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval);
51 51
52/*
53 * A alarmtimer is active, when it is enqueued into timerqueue or the
54 * callback function is running.
55 */
56static inline int alarmtimer_active(const struct alarm *timer)
57{
58 return timer->state != ALARMTIMER_STATE_INACTIVE;
59}
60
61/*
62 * Helper function to check, whether the timer is on one of the queues
63 */
64static inline int alarmtimer_is_queued(struct alarm *timer)
65{
66 return timer->state & ALARMTIMER_STATE_ENQUEUED;
67}
68
69/*
70 * Helper function to check, whether the timer is running the callback
71 * function
72 */
73static inline int alarmtimer_callback_running(struct alarm *timer)
74{
75 return timer->state & ALARMTIMER_STATE_CALLBACK;
76}
77
78
79/* Provide way to access the rtc device being used by alarmtimers */ 52/* Provide way to access the rtc device being used by alarmtimers */
80struct rtc_device *alarmtimer_get_rtcdev(void); 53struct rtc_device *alarmtimer_get_rtcdev(void);
81 54
diff --git a/include/linux/apm_bios.h b/include/linux/apm_bios.h
index 01a6244c9bc9..9c3a87184f48 100644
--- a/include/linux/apm_bios.h
+++ b/include/linux/apm_bios.h
@@ -1,6 +1,3 @@
1#ifndef _LINUX_APM_H
2#define _LINUX_APM_H
3
4/* 1/*
5 * Include file for the interface to an APM BIOS 2 * Include file for the interface to an APM BIOS
6 * Copyright 1994-2001 Stephen Rothwell (sfr@canb.auug.org.au) 3 * Copyright 1994-2001 Stephen Rothwell (sfr@canb.auug.org.au)
@@ -15,25 +12,11 @@
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details. 13 * General Public License for more details.
17 */ 14 */
15#ifndef _LINUX_APM_H
16#define _LINUX_APM_H
18 17
19#include <linux/types.h> 18#include <uapi/linux/apm_bios.h>
20
21typedef unsigned short apm_event_t;
22typedef unsigned short apm_eventinfo_t;
23
24struct apm_bios_info {
25 __u16 version;
26 __u16 cseg;
27 __u32 offset;
28 __u16 cseg_16;
29 __u16 dseg;
30 __u16 flags;
31 __u16 cseg_len;
32 __u16 cseg_16_len;
33 __u16 dseg_len;
34};
35 19
36#ifdef __KERNEL__
37 20
38#define APM_CS (GDT_ENTRY_APMBIOS_BASE * 8) 21#define APM_CS (GDT_ENTRY_APMBIOS_BASE * 8)
39#define APM_CS_16 (APM_CS + 8) 22#define APM_CS_16 (APM_CS + 8)
@@ -110,111 +93,9 @@ struct apm_info {
110 */ 93 */
111extern struct apm_info apm_info; 94extern struct apm_info apm_info;
112 95
113#endif /* __KERNEL__ */
114
115/*
116 * Power states
117 */
118#define APM_STATE_READY 0x0000
119#define APM_STATE_STANDBY 0x0001
120#define APM_STATE_SUSPEND 0x0002
121#define APM_STATE_OFF 0x0003
122#define APM_STATE_BUSY 0x0004
123#define APM_STATE_REJECT 0x0005
124#define APM_STATE_OEM_SYS 0x0020
125#define APM_STATE_OEM_DEV 0x0040
126
127#define APM_STATE_DISABLE 0x0000
128#define APM_STATE_ENABLE 0x0001
129
130#define APM_STATE_DISENGAGE 0x0000
131#define APM_STATE_ENGAGE 0x0001
132
133/*
134 * Events (results of Get PM Event)
135 */
136#define APM_SYS_STANDBY 0x0001
137#define APM_SYS_SUSPEND 0x0002
138#define APM_NORMAL_RESUME 0x0003
139#define APM_CRITICAL_RESUME 0x0004
140#define APM_LOW_BATTERY 0x0005
141#define APM_POWER_STATUS_CHANGE 0x0006
142#define APM_UPDATE_TIME 0x0007
143#define APM_CRITICAL_SUSPEND 0x0008
144#define APM_USER_STANDBY 0x0009
145#define APM_USER_SUSPEND 0x000a
146#define APM_STANDBY_RESUME 0x000b
147#define APM_CAPABILITY_CHANGE 0x000c
148
149/*
150 * Error codes
151 */
152#define APM_SUCCESS 0x00
153#define APM_DISABLED 0x01
154#define APM_CONNECTED 0x02
155#define APM_NOT_CONNECTED 0x03
156#define APM_16_CONNECTED 0x05
157#define APM_16_UNSUPPORTED 0x06
158#define APM_32_CONNECTED 0x07
159#define APM_32_UNSUPPORTED 0x08
160#define APM_BAD_DEVICE 0x09
161#define APM_BAD_PARAM 0x0a
162#define APM_NOT_ENGAGED 0x0b
163#define APM_BAD_FUNCTION 0x0c
164#define APM_RESUME_DISABLED 0x0d
165#define APM_NO_ERROR 0x53
166#define APM_BAD_STATE 0x60
167#define APM_NO_EVENTS 0x80
168#define APM_NOT_PRESENT 0x86
169
170/*
171 * APM Device IDs
172 */
173#define APM_DEVICE_BIOS 0x0000
174#define APM_DEVICE_ALL 0x0001
175#define APM_DEVICE_DISPLAY 0x0100
176#define APM_DEVICE_STORAGE 0x0200
177#define APM_DEVICE_PARALLEL 0x0300
178#define APM_DEVICE_SERIAL 0x0400
179#define APM_DEVICE_NETWORK 0x0500
180#define APM_DEVICE_PCMCIA 0x0600
181#define APM_DEVICE_BATTERY 0x8000
182#define APM_DEVICE_OEM 0xe000
183#define APM_DEVICE_OLD_ALL 0xffff
184#define APM_DEVICE_CLASS 0x00ff
185#define APM_DEVICE_MASK 0xff00
186
187#ifdef __KERNEL__
188/* 96/*
189 * This is the "All Devices" ID communicated to the BIOS 97 * This is the "All Devices" ID communicated to the BIOS
190 */ 98 */
191#define APM_DEVICE_BALL ((apm_info.connection_version > 0x0100) ? \ 99#define APM_DEVICE_BALL ((apm_info.connection_version > 0x0100) ? \
192 APM_DEVICE_ALL : APM_DEVICE_OLD_ALL) 100 APM_DEVICE_ALL : APM_DEVICE_OLD_ALL)
193#endif
194
195/*
196 * Battery status
197 */
198#define APM_MAX_BATTERIES 2
199
200/*
201 * APM defined capability bit flags
202 */
203#define APM_CAP_GLOBAL_STANDBY 0x0001
204#define APM_CAP_GLOBAL_SUSPEND 0x0002
205#define APM_CAP_RESUME_STANDBY_TIMER 0x0004 /* Timer resume from standby */
206#define APM_CAP_RESUME_SUSPEND_TIMER 0x0008 /* Timer resume from suspend */
207#define APM_CAP_RESUME_STANDBY_RING 0x0010 /* Resume on Ring fr standby */
208#define APM_CAP_RESUME_SUSPEND_RING 0x0020 /* Resume on Ring fr suspend */
209#define APM_CAP_RESUME_STANDBY_PCMCIA 0x0040 /* Resume on PCMCIA Ring */
210#define APM_CAP_RESUME_SUSPEND_PCMCIA 0x0080 /* Resume on PCMCIA Ring */
211
212/*
213 * ioctl operations
214 */
215#include <linux/ioctl.h>
216
217#define APM_IOC_STANDBY _IO('A', 1)
218#define APM_IOC_SUSPEND _IO('A', 2)
219
220#endif /* LINUX_APM_H */ 101#endif /* LINUX_APM_H */
diff --git a/include/linux/asn1.h b/include/linux/asn1.h
new file mode 100644
index 000000000000..5c3f4e4b9a23
--- /dev/null
+++ b/include/linux/asn1.h
@@ -0,0 +1,67 @@
1/* ASN.1 BER/DER/CER encoding definitions
2 *
3 * Copyright (C) 2012 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
12#ifndef _LINUX_ASN1_H
13#define _LINUX_ASN1_H
14
15/* Class */
16enum asn1_class {
17 ASN1_UNIV = 0, /* Universal */
18 ASN1_APPL = 1, /* Application */
19 ASN1_CONT = 2, /* Context */
20 ASN1_PRIV = 3 /* Private */
21};
22#define ASN1_CLASS_BITS 0xc0
23
24
25enum asn1_method {
26 ASN1_PRIM = 0, /* Primitive */
27 ASN1_CONS = 1 /* Constructed */
28};
29#define ASN1_CONS_BIT 0x20
30
31/* Tag */
32enum asn1_tag {
33 ASN1_EOC = 0, /* End Of Contents or N/A */
34 ASN1_BOOL = 1, /* Boolean */
35 ASN1_INT = 2, /* Integer */
36 ASN1_BTS = 3, /* Bit String */
37 ASN1_OTS = 4, /* Octet String */
38 ASN1_NULL = 5, /* Null */
39 ASN1_OID = 6, /* Object Identifier */
40 ASN1_ODE = 7, /* Object Description */
41 ASN1_EXT = 8, /* External */
42 ASN1_REAL = 9, /* Real float */
43 ASN1_ENUM = 10, /* Enumerated */
44 ASN1_EPDV = 11, /* Embedded PDV */
45 ASN1_UTF8STR = 12, /* UTF8 String */
46 ASN1_RELOID = 13, /* Relative OID */
47 /* 14 - Reserved */
48 /* 15 - Reserved */
49 ASN1_SEQ = 16, /* Sequence and Sequence of */
50 ASN1_SET = 17, /* Set and Set of */
51 ASN1_NUMSTR = 18, /* Numerical String */
52 ASN1_PRNSTR = 19, /* Printable String */
53 ASN1_TEXSTR = 20, /* T61 String / Teletext String */
54 ASN1_VIDSTR = 21, /* Videotex String */
55 ASN1_IA5STR = 22, /* IA5 String */
56 ASN1_UNITIM = 23, /* Universal Time */
57 ASN1_GENTIM = 24, /* General Time */
58 ASN1_GRASTR = 25, /* Graphic String */
59 ASN1_VISSTR = 26, /* Visible String */
60 ASN1_GENSTR = 27, /* General String */
61 ASN1_UNISTR = 28, /* Universal String */
62 ASN1_CHRSTR = 29, /* Character String */
63 ASN1_BMPSTR = 30, /* BMP String */
64 ASN1_LONG_TAG = 31 /* Long form tag */
65};
66
67#endif /* _LINUX_ASN1_H */
diff --git a/include/linux/asn1_ber_bytecode.h b/include/linux/asn1_ber_bytecode.h
new file mode 100644
index 000000000000..945d44ae529c
--- /dev/null
+++ b/include/linux/asn1_ber_bytecode.h
@@ -0,0 +1,87 @@
1/* ASN.1 BER/DER/CER parsing state machine internal definitions
2 *
3 * Copyright (C) 2012 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
12#ifndef _LINUX_ASN1_BER_BYTECODE_H
13#define _LINUX_ASN1_BER_BYTECODE_H
14
15#ifdef __KERNEL__
16#include <linux/types.h>
17#endif
18#include <linux/asn1.h>
19
20typedef int (*asn1_action_t)(void *context,
21 size_t hdrlen, /* In case of ANY type */
22 unsigned char tag, /* In case of ANY type */
23 const void *value, size_t vlen);
24
25struct asn1_decoder {
26 const unsigned char *machine;
27 size_t machlen;
28 const asn1_action_t *actions;
29};
30
31enum asn1_opcode {
32 /* The tag-matching ops come first and the odd-numbered slots
33 * are for OR_SKIP ops.
34 */
35#define ASN1_OP_MATCH__SKIP 0x01
36#define ASN1_OP_MATCH__ACT 0x02
37#define ASN1_OP_MATCH__JUMP 0x04
38#define ASN1_OP_MATCH__ANY 0x08
39#define ASN1_OP_MATCH__COND 0x10
40
41 ASN1_OP_MATCH = 0x00,
42 ASN1_OP_MATCH_OR_SKIP = 0x01,
43 ASN1_OP_MATCH_ACT = 0x02,
44 ASN1_OP_MATCH_ACT_OR_SKIP = 0x03,
45 ASN1_OP_MATCH_JUMP = 0x04,
46 ASN1_OP_MATCH_JUMP_OR_SKIP = 0x05,
47 ASN1_OP_MATCH_ANY = 0x08,
48 ASN1_OP_MATCH_ANY_ACT = 0x0a,
49 /* Everything before here matches unconditionally */
50
51 ASN1_OP_COND_MATCH_OR_SKIP = 0x11,
52 ASN1_OP_COND_MATCH_ACT_OR_SKIP = 0x13,
53 ASN1_OP_COND_MATCH_JUMP_OR_SKIP = 0x15,
54 ASN1_OP_COND_MATCH_ANY = 0x18,
55 ASN1_OP_COND_MATCH_ANY_ACT = 0x1a,
56
57 /* Everything before here will want a tag from the data */
58#define ASN1_OP__MATCHES_TAG ASN1_OP_COND_MATCH_ANY_ACT
59
60 /* These are here to help fill up space */
61 ASN1_OP_COND_FAIL = 0x1b,
62 ASN1_OP_COMPLETE = 0x1c,
63 ASN1_OP_ACT = 0x1d,
64 ASN1_OP_RETURN = 0x1e,
65
66 /* The following eight have bit 0 -> SET, 1 -> OF, 2 -> ACT */
67 ASN1_OP_END_SEQ = 0x20,
68 ASN1_OP_END_SET = 0x21,
69 ASN1_OP_END_SEQ_OF = 0x22,
70 ASN1_OP_END_SET_OF = 0x23,
71 ASN1_OP_END_SEQ_ACT = 0x24,
72 ASN1_OP_END_SET_ACT = 0x25,
73 ASN1_OP_END_SEQ_OF_ACT = 0x26,
74 ASN1_OP_END_SET_OF_ACT = 0x27,
75#define ASN1_OP_END__SET 0x01
76#define ASN1_OP_END__OF 0x02
77#define ASN1_OP_END__ACT 0x04
78
79 ASN1_OP__NR
80};
81
82#define _tag(CLASS, CP, TAG) ((ASN1_##CLASS << 6) | (ASN1_##CP << 5) | ASN1_##TAG)
83#define _tagn(CLASS, CP, TAG) ((ASN1_##CLASS << 6) | (ASN1_##CP << 5) | TAG)
84#define _jump_target(N) (N)
85#define _action(N) (N)
86
87#endif /* _LINUX_ASN1_BER_BYTECODE_H */
diff --git a/include/linux/asn1_decoder.h b/include/linux/asn1_decoder.h
new file mode 100644
index 000000000000..fa2ff5bc0483
--- /dev/null
+++ b/include/linux/asn1_decoder.h
@@ -0,0 +1,24 @@
1/* ASN.1 decoder
2 *
3 * Copyright (C) 2012 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
12#ifndef _LINUX_ASN1_DECODER_H
13#define _LINUX_ASN1_DECODER_H
14
15#include <linux/asn1.h>
16
17struct asn1_decoder;
18
19extern int asn1_ber_decoder(const struct asn1_decoder *decoder,
20 void *context,
21 const unsigned char *data,
22 size_t datalen);
23
24#endif /* _LINUX_ASN1_DECODER_H */
diff --git a/include/linux/atalk.h b/include/linux/atalk.h
index f57c36881c48..73fd8b7e9534 100644
--- a/include/linux/atalk.h
+++ b/include/linux/atalk.h
@@ -1,49 +1,9 @@
1#ifndef __LINUX_ATALK_H__ 1#ifndef __LINUX_ATALK_H__
2#define __LINUX_ATALK_H__ 2#define __LINUX_ATALK_H__
3 3
4#include <linux/types.h>
5#include <asm/byteorder.h>
6#include <linux/socket.h>
7
8/*
9 * AppleTalk networking structures
10 *
11 * The following are directly referenced from the University Of Michigan
12 * netatalk for compatibility reasons.
13 */
14#define ATPORT_FIRST 1
15#define ATPORT_RESERVED 128
16#define ATPORT_LAST 254 /* 254 is only legal on localtalk */
17#define ATADDR_ANYNET (__u16)0
18#define ATADDR_ANYNODE (__u8)0
19#define ATADDR_ANYPORT (__u8)0
20#define ATADDR_BCAST (__u8)255
21#define DDP_MAXSZ 587
22#define DDP_MAXHOPS 15 /* 4 bits of hop counter */
23
24#define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0)
25
26struct atalk_addr {
27 __be16 s_net;
28 __u8 s_node;
29};
30
31struct sockaddr_at {
32 __kernel_sa_family_t sat_family;
33 __u8 sat_port;
34 struct atalk_addr sat_addr;
35 char sat_zero[8];
36};
37
38struct atalk_netrange {
39 __u8 nr_phase;
40 __be16 nr_firstnet;
41 __be16 nr_lastnet;
42};
43
44#ifdef __KERNEL__
45 4
46#include <net/sock.h> 5#include <net/sock.h>
6#include <uapi/linux/atalk.h>
47 7
48struct atalk_route { 8struct atalk_route {
49 struct net_device *dev; 9 struct net_device *dev;
@@ -205,5 +165,4 @@ extern void atalk_proc_exit(void);
205#define atalk_proc_exit() do { } while(0) 165#define atalk_proc_exit() do { } while(0)
206#endif /* CONFIG_PROC_FS */ 166#endif /* CONFIG_PROC_FS */
207 167
208#endif /* __KERNEL__ */
209#endif /* __LINUX_ATALK_H__ */ 168#endif /* __LINUX_ATALK_H__ */
diff --git a/include/linux/atm.h b/include/linux/atm.h
index d3b292174aeb..30006c435951 100644
--- a/include/linux/atm.h
+++ b/include/linux/atm.h
@@ -1,242 +1,9 @@
1/* atm.h - general ATM declarations */ 1/* atm.h - general ATM declarations */
2
3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
4
5
6/*
7 * WARNING: User-space programs should not #include <linux/atm.h> directly.
8 * Instead, #include <atm.h>
9 */
10
11#ifndef _LINUX_ATM_H 2#ifndef _LINUX_ATM_H
12#define _LINUX_ATM_H 3#define _LINUX_ATM_H
13 4
14/* 5#include <uapi/linux/atm.h>
15 * BEGIN_xx and END_xx markers are used for automatic generation of
16 * documentation. Do not change them.
17 */
18
19#include <linux/compiler.h>
20#include <linux/atmapi.h>
21#include <linux/atmsap.h>
22#include <linux/atmioc.h>
23#include <linux/types.h>
24
25
26/* general ATM constants */
27#define ATM_CELL_SIZE 53 /* ATM cell size incl. header */
28#define ATM_CELL_PAYLOAD 48 /* ATM payload size */
29#define ATM_AAL0_SDU 52 /* AAL0 SDU size */
30#define ATM_MAX_AAL34_PDU 65535 /* maximum AAL3/4 PDU payload */
31#define ATM_AAL5_TRAILER 8 /* AAL5 trailer size */
32#define ATM_MAX_AAL5_PDU 65535 /* maximum AAL5 PDU payload */
33#define ATM_MAX_CDV 9999 /* maximum (default) CDV */
34#define ATM_NOT_RSV_VCI 32 /* first non-reserved VCI value */
35
36#define ATM_MAX_VPI 255 /* maximum VPI at the UNI */
37#define ATM_MAX_VPI_NNI 4096 /* maximum VPI at the NNI */
38#define ATM_MAX_VCI 65535 /* maximum VCI */
39
40
41/* "protcol" values for the socket system call */
42#define ATM_NO_AAL 0 /* AAL not specified */
43#define ATM_AAL0 13 /* "raw" ATM cells */
44#define ATM_AAL1 1 /* AAL1 (CBR) */
45#define ATM_AAL2 2 /* AAL2 (VBR) */
46#define ATM_AAL34 3 /* AAL3/4 (data) */
47#define ATM_AAL5 5 /* AAL5 (data) */
48
49/*
50 * socket option name coding functions
51 *
52 * Note that __SO_ENCODE and __SO_LEVEL are somewhat a hack since the
53 * << 22 only reserves 9 bits for the level. On some architectures
54 * SOL_SOCKET is 0xFFFF, so that's a bit of a problem
55 */
56
57#define __SO_ENCODE(l,n,t) ((((l) & 0x1FF) << 22) | ((n) << 16) | \
58 sizeof(t))
59#define __SO_LEVEL_MATCH(c,m) (((c) >> 22) == ((m) & 0x1FF))
60#define __SO_NUMBER(c) (((c) >> 16) & 0x3f)
61#define __SO_SIZE(c) ((c) & 0x3fff)
62
63/*
64 * ATM layer
65 */
66
67#define SO_SETCLP __SO_ENCODE(SOL_ATM,0,int)
68 /* set CLP bit value - TODO */
69#define SO_CIRANGE __SO_ENCODE(SOL_ATM,1,struct atm_cirange)
70 /* connection identifier range; socket must be
71 bound or connected */
72#define SO_ATMQOS __SO_ENCODE(SOL_ATM,2,struct atm_qos)
73 /* Quality of Service setting */
74#define SO_ATMSAP __SO_ENCODE(SOL_ATM,3,struct atm_sap)
75 /* Service Access Point */
76#define SO_ATMPVC __SO_ENCODE(SOL_ATM,4,struct sockaddr_atmpvc)
77 /* "PVC" address (also for SVCs); get only */
78#define SO_MULTIPOINT __SO_ENCODE(SOL_ATM, 5, int)
79 /* make this vc a p2mp */
80
81
82/*
83 * Note @@@: since the socket layers don't really distinguish the control and
84 * the data plane but generally seems to be data plane-centric, any layer is
85 * about equally wrong for the SAP. If you have a better idea about this,
86 * please speak up ...
87 */
88
89
90/* ATM cell header (for AAL0) */
91
92/* BEGIN_CH */
93#define ATM_HDR_GFC_MASK 0xf0000000
94#define ATM_HDR_GFC_SHIFT 28
95#define ATM_HDR_VPI_MASK 0x0ff00000
96#define ATM_HDR_VPI_SHIFT 20
97#define ATM_HDR_VCI_MASK 0x000ffff0
98#define ATM_HDR_VCI_SHIFT 4
99#define ATM_HDR_PTI_MASK 0x0000000e
100#define ATM_HDR_PTI_SHIFT 1
101#define ATM_HDR_CLP 0x00000001
102/* END_CH */
103
104
105/* PTI codings */
106
107/* BEGIN_PTI */
108#define ATM_PTI_US0 0 /* user data cell, congestion not exp, SDU-type 0 */
109#define ATM_PTI_US1 1 /* user data cell, congestion not exp, SDU-type 1 */
110#define ATM_PTI_UCES0 2 /* user data cell, cong. experienced, SDU-type 0 */
111#define ATM_PTI_UCES1 3 /* user data cell, cong. experienced, SDU-type 1 */
112#define ATM_PTI_SEGF5 4 /* segment OAM F5 flow related cell */
113#define ATM_PTI_E2EF5 5 /* end-to-end OAM F5 flow related cell */
114#define ATM_PTI_RSV_RM 6 /* reserved for traffic control/resource mgmt */
115#define ATM_PTI_RSV 7 /* reserved */
116/* END_PTI */
117
118
119/*
120 * The following items should stay in linux/atm.h, which should be linked to
121 * netatm/atm.h
122 */
123
124/* Traffic description */
125
126#define ATM_NONE 0 /* no traffic */
127#define ATM_UBR 1
128#define ATM_CBR 2
129#define ATM_VBR 3
130#define ATM_ABR 4
131#define ATM_ANYCLASS 5 /* compatible with everything */
132
133#define ATM_MAX_PCR -1 /* maximum available PCR */
134
135struct atm_trafprm {
136 unsigned char traffic_class; /* traffic class (ATM_UBR, ...) */
137 int max_pcr; /* maximum PCR in cells per second */
138 int pcr; /* desired PCR in cells per second */
139 int min_pcr; /* minimum PCR in cells per second */
140 int max_cdv; /* maximum CDV in microseconds */
141 int max_sdu; /* maximum SDU in bytes */
142 /* extra params for ABR */
143 unsigned int icr; /* Initial Cell Rate (24-bit) */
144 unsigned int tbe; /* Transient Buffer Exposure (24-bit) */
145 unsigned int frtt : 24; /* Fixed Round Trip Time (24-bit) */
146 unsigned int rif : 4; /* Rate Increment Factor (4-bit) */
147 unsigned int rdf : 4; /* Rate Decrease Factor (4-bit) */
148 unsigned int nrm_pres :1; /* nrm present bit */
149 unsigned int trm_pres :1; /* rm present bit */
150 unsigned int adtf_pres :1; /* adtf present bit */
151 unsigned int cdf_pres :1; /* cdf present bit*/
152 unsigned int nrm :3; /* Max # of Cells for each forward RM cell (3-bit) */
153 unsigned int trm :3; /* Time between forward RM cells (3-bit) */
154 unsigned int adtf :10; /* ACR Decrease Time Factor (10-bit) */
155 unsigned int cdf :3; /* Cutoff Decrease Factor (3-bit) */
156 unsigned int spare :9; /* spare bits */
157};
158
159struct atm_qos {
160 struct atm_trafprm txtp; /* parameters in TX direction */
161 struct atm_trafprm rxtp __ATM_API_ALIGN;
162 /* parameters in RX direction */
163 unsigned char aal __ATM_API_ALIGN;
164};
165
166/* PVC addressing */
167
168#define ATM_ITF_ANY -1 /* "magic" PVC address values */
169#define ATM_VPI_ANY -1
170#define ATM_VCI_ANY -1
171#define ATM_VPI_UNSPEC -2
172#define ATM_VCI_UNSPEC -2
173
174
175struct sockaddr_atmpvc {
176 unsigned short sap_family; /* address family, AF_ATMPVC */
177 struct { /* PVC address */
178 short itf; /* ATM interface */
179 short vpi; /* VPI (only 8 bits at UNI) */
180 int vci; /* VCI (only 16 bits at UNI) */
181 } sap_addr __ATM_API_ALIGN; /* PVC address */
182};
183
184/* SVC addressing */
185
186#define ATM_ESA_LEN 20 /* ATM End System Address length */
187#define ATM_E164_LEN 12 /* maximum E.164 number length */
188
189#define ATM_AFI_DCC 0x39 /* DCC ATM Format */
190#define ATM_AFI_ICD 0x47 /* ICD ATM Format */
191#define ATM_AFI_E164 0x45 /* E.164 ATM Format */
192#define ATM_AFI_LOCAL 0x49 /* Local ATM Format */
193
194#define ATM_AFI_DCC_GROUP 0xBD /* DCC ATM Group Format */
195#define ATM_AFI_ICD_GROUP 0xC5 /* ICD ATM Group Format */
196#define ATM_AFI_E164_GROUP 0xC3 /* E.164 ATM Group Format */
197#define ATM_AFI_LOCAL_GROUP 0xC7 /* Local ATM Group Format */
198 6
199#define ATM_LIJ_NONE 0 /* no leaf-initiated join */
200#define ATM_LIJ 1 /* request joining */
201#define ATM_LIJ_RPJ 2 /* set to root-prompted join */
202#define ATM_LIJ_NJ 3 /* set to network join */
203
204
205struct sockaddr_atmsvc {
206 unsigned short sas_family; /* address family, AF_ATMSVC */
207 struct { /* SVC address */
208 unsigned char prv[ATM_ESA_LEN];/* private ATM address */
209 char pub[ATM_E164_LEN+1]; /* public address (E.164) */
210 /* unused addresses must be bzero'ed */
211 char lij_type; /* role in LIJ call; one of ATM_LIJ* */
212 __u32 lij_id; /* LIJ call identifier */
213 } sas_addr __ATM_API_ALIGN; /* SVC address */
214};
215
216
217static __inline__ int atmsvc_addr_in_use(struct sockaddr_atmsvc addr)
218{
219 return *addr.sas_addr.prv || *addr.sas_addr.pub;
220}
221
222
223static __inline__ int atmpvc_addr_in_use(struct sockaddr_atmpvc addr)
224{
225 return addr.sap_addr.itf || addr.sap_addr.vpi || addr.sap_addr.vci;
226}
227
228
229/*
230 * Some stuff for linux/sockios.h
231 */
232
233struct atmif_sioc {
234 int number;
235 int length;
236 void __user *arg;
237};
238
239#ifdef __KERNEL__
240#ifdef CONFIG_COMPAT 7#ifdef CONFIG_COMPAT
241#include <linux/compat.h> 8#include <linux/compat.h>
242struct compat_atmif_sioc { 9struct compat_atmif_sioc {
@@ -246,6 +13,3 @@ struct compat_atmif_sioc {
246}; 13};
247#endif 14#endif
248#endif 15#endif
249
250typedef unsigned short atm_backend_t;
251#endif
diff --git a/include/linux/atm_tcp.h b/include/linux/atm_tcp.h
index 375638f8554b..db6b65fc0aec 100644
--- a/include/linux/atm_tcp.h
+++ b/include/linux/atm_tcp.h
@@ -3,61 +3,11 @@
3 3
4/* Written 1997-2000 by Werner Almesberger, EPFL LRC/ICA */ 4/* Written 1997-2000 by Werner Almesberger, EPFL LRC/ICA */
5 5
6
7#ifndef LINUX_ATM_TCP_H 6#ifndef LINUX_ATM_TCP_H
8#define LINUX_ATM_TCP_H 7#define LINUX_ATM_TCP_H
9 8
10#include <linux/atmapi.h> 9#include <uapi/linux/atm_tcp.h>
11#include <linux/atm.h>
12#include <linux/atmioc.h>
13#include <linux/types.h>
14
15
16/*
17 * All values in struct atmtcp_hdr are in network byte order
18 */
19
20struct atmtcp_hdr {
21 __u16 vpi;
22 __u16 vci;
23 __u32 length; /* ... of data part */
24};
25
26/*
27 * All values in struct atmtcp_command are in host byte order
28 */
29
30#define ATMTCP_HDR_MAGIC (~0) /* this length indicates a command */
31#define ATMTCP_CTRL_OPEN 1 /* request/reply */
32#define ATMTCP_CTRL_CLOSE 2 /* request/reply */
33 10
34struct atmtcp_control {
35 struct atmtcp_hdr hdr; /* must be first */
36 int type; /* message type; both directions */
37 atm_kptr_t vcc; /* both directions */
38 struct sockaddr_atmpvc addr; /* suggested value from kernel */
39 struct atm_qos qos; /* both directions */
40 int result; /* to kernel only */
41} __ATM_API_ALIGN;
42
43/*
44 * Field usage:
45 * Messge type dir. hdr.v?i type addr qos vcc result
46 * ----------- ---- ------- ---- ---- --- --- ------
47 * OPEN K->D Y Y Y Y Y 0
48 * OPEN D->K - Y Y Y Y Y
49 * CLOSE K->D - - Y - Y 0
50 * CLOSE D->K - - - - Y Y
51 */
52
53#define SIOCSIFATMTCP _IO('a',ATMIOC_ITF) /* set ATMTCP mode */
54#define ATMTCP_CREATE _IO('a',ATMIOC_ITF+14) /* create persistent ATMTCP
55 interface */
56#define ATMTCP_REMOVE _IO('a',ATMIOC_ITF+15) /* destroy persistent ATMTCP
57 interface */
58
59
60#ifdef __KERNEL__
61 11
62struct atm_tcp_ops { 12struct atm_tcp_ops {
63 int (*attach)(struct atm_vcc *vcc,int itf); 13 int (*attach)(struct atm_vcc *vcc,int itf);
@@ -69,5 +19,3 @@ struct atm_tcp_ops {
69extern struct atm_tcp_ops atm_tcp_ops; 19extern struct atm_tcp_ops atm_tcp_ops;
70 20
71#endif 21#endif
72
73#endif
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 06fd4bbc58f6..22ef21c33d0c 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -1,218 +1,8 @@
1/* atmdev.h - ATM device driver declarations and various related items */ 1/* atmdev.h - ATM device driver declarations and various related items */
2
3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
4
5
6#ifndef LINUX_ATMDEV_H 2#ifndef LINUX_ATMDEV_H
7#define LINUX_ATMDEV_H 3#define LINUX_ATMDEV_H
8 4
9 5
10#include <linux/atmapi.h>
11#include <linux/atm.h>
12#include <linux/atmioc.h>
13
14
15#define ESI_LEN 6
16
17#define ATM_OC3_PCR (155520000/270*260/8/53)
18 /* OC3 link rate: 155520000 bps
19 SONET overhead: /270*260 (9 section, 1 path)
20 bits per cell: /8/53
21 max cell rate: 353207.547 cells/sec */
22#define ATM_25_PCR ((25600000/8-8000)/54)
23 /* 25 Mbps ATM cell rate (59111) */
24#define ATM_OC12_PCR (622080000/1080*1040/8/53)
25 /* OC12 link rate: 622080000 bps
26 SONET overhead: /1080*1040
27 bits per cell: /8/53
28 max cell rate: 1412830.188 cells/sec */
29#define ATM_DS3_PCR (8000*12)
30 /* DS3: 12 cells in a 125 usec time slot */
31
32
33#define __AAL_STAT_ITEMS \
34 __HANDLE_ITEM(tx); /* TX okay */ \
35 __HANDLE_ITEM(tx_err); /* TX errors */ \
36 __HANDLE_ITEM(rx); /* RX okay */ \
37 __HANDLE_ITEM(rx_err); /* RX errors */ \
38 __HANDLE_ITEM(rx_drop); /* RX out of memory */
39
40struct atm_aal_stats {
41#define __HANDLE_ITEM(i) int i
42 __AAL_STAT_ITEMS
43#undef __HANDLE_ITEM
44};
45
46
47struct atm_dev_stats {
48 struct atm_aal_stats aal0;
49 struct atm_aal_stats aal34;
50 struct atm_aal_stats aal5;
51} __ATM_API_ALIGN;
52
53
54#define ATM_GETLINKRATE _IOW('a',ATMIOC_ITF+1,struct atmif_sioc)
55 /* get link rate */
56#define ATM_GETNAMES _IOW('a',ATMIOC_ITF+3,struct atm_iobuf)
57 /* get interface names (numbers) */
58#define ATM_GETTYPE _IOW('a',ATMIOC_ITF+4,struct atmif_sioc)
59 /* get interface type name */
60#define ATM_GETESI _IOW('a',ATMIOC_ITF+5,struct atmif_sioc)
61 /* get interface ESI */
62#define ATM_GETADDR _IOW('a',ATMIOC_ITF+6,struct atmif_sioc)
63 /* get itf's local ATM addr. list */
64#define ATM_RSTADDR _IOW('a',ATMIOC_ITF+7,struct atmif_sioc)
65 /* reset itf's ATM address list */
66#define ATM_ADDADDR _IOW('a',ATMIOC_ITF+8,struct atmif_sioc)
67 /* add a local ATM address */
68#define ATM_DELADDR _IOW('a',ATMIOC_ITF+9,struct atmif_sioc)
69 /* remove a local ATM address */
70#define ATM_GETCIRANGE _IOW('a',ATMIOC_ITF+10,struct atmif_sioc)
71 /* get connection identifier range */
72#define ATM_SETCIRANGE _IOW('a',ATMIOC_ITF+11,struct atmif_sioc)
73 /* set connection identifier range */
74#define ATM_SETESI _IOW('a',ATMIOC_ITF+12,struct atmif_sioc)
75 /* set interface ESI */
76#define ATM_SETESIF _IOW('a',ATMIOC_ITF+13,struct atmif_sioc)
77 /* force interface ESI */
78#define ATM_ADDLECSADDR _IOW('a', ATMIOC_ITF+14, struct atmif_sioc)
79 /* register a LECS address */
80#define ATM_DELLECSADDR _IOW('a', ATMIOC_ITF+15, struct atmif_sioc)
81 /* unregister a LECS address */
82#define ATM_GETLECSADDR _IOW('a', ATMIOC_ITF+16, struct atmif_sioc)
83 /* retrieve LECS address(es) */
84
85#define ATM_GETSTAT _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc)
86 /* get AAL layer statistics */
87#define ATM_GETSTATZ _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc)
88 /* get AAL layer statistics and zero */
89#define ATM_GETLOOP _IOW('a',ATMIOC_SARCOM+2,struct atmif_sioc)
90 /* get loopback mode */
91#define ATM_SETLOOP _IOW('a',ATMIOC_SARCOM+3,struct atmif_sioc)
92 /* set loopback mode */
93#define ATM_QUERYLOOP _IOW('a',ATMIOC_SARCOM+4,struct atmif_sioc)
94 /* query supported loopback modes */
95#define ATM_SETSC _IOW('a',ATMIOC_SPECIAL+1,int)
96 /* enable or disable single-copy */
97#define ATM_SETBACKEND _IOW('a',ATMIOC_SPECIAL+2,atm_backend_t)
98 /* set backend handler */
99#define ATM_NEWBACKENDIF _IOW('a',ATMIOC_SPECIAL+3,atm_backend_t)
100 /* use backend to make new if */
101#define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf)
102 /* add party to p2mp call */
103#ifdef CONFIG_COMPAT
104/* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */
105#define COMPAT_ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct compat_atm_iobuf)
106#endif
107#define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int)
108 /* drop party from p2mp call */
109
110/*
111 * These are backend handkers that can be set via the ATM_SETBACKEND call
112 * above. In the future we may support dynamic loading of these - for now,
113 * they're just being used to share the ATMIOC_BACKEND ioctls
114 */
115#define ATM_BACKEND_RAW 0
116#define ATM_BACKEND_PPP 1 /* PPPoATM - RFC2364 */
117#define ATM_BACKEND_BR2684 2 /* Bridged RFC1483/2684 */
118
119/* for ATM_GETTYPE */
120#define ATM_ITFTYP_LEN 8 /* maximum length of interface type name */
121
122/*
123 * Loopback modes for ATM_{PHY,SAR}_{GET,SET}LOOP
124 */
125
126/* Point of loopback CPU-->SAR-->PHY-->line--> ... */
127#define __ATM_LM_NONE 0 /* no loop back ^ ^ ^ ^ */
128#define __ATM_LM_AAL 1 /* loop back PDUs --' | | | */
129#define __ATM_LM_ATM 2 /* loop back ATM cells ---' | | */
130/* RESERVED 4 loop back on PHY side ---' */
131#define __ATM_LM_PHY 8 /* loop back bits (digital) ----' | */
132#define __ATM_LM_ANALOG 16 /* loop back the analog signal --------' */
133
134/* Direction of loopback */
135#define __ATM_LM_MKLOC(n) ((n)) /* Local (i.e. loop TX to RX) */
136#define __ATM_LM_MKRMT(n) ((n) << 8) /* Remote (i.e. loop RX to TX) */
137
138#define __ATM_LM_XTLOC(n) ((n) & 0xff)
139#define __ATM_LM_XTRMT(n) (((n) >> 8) & 0xff)
140
141#define ATM_LM_NONE 0 /* no loopback */
142
143#define ATM_LM_LOC_AAL __ATM_LM_MKLOC(__ATM_LM_AAL)
144#define ATM_LM_LOC_ATM __ATM_LM_MKLOC(__ATM_LM_ATM)
145#define ATM_LM_LOC_PHY __ATM_LM_MKLOC(__ATM_LM_PHY)
146#define ATM_LM_LOC_ANALOG __ATM_LM_MKLOC(__ATM_LM_ANALOG)
147
148#define ATM_LM_RMT_AAL __ATM_LM_MKRMT(__ATM_LM_AAL)
149#define ATM_LM_RMT_ATM __ATM_LM_MKRMT(__ATM_LM_ATM)
150#define ATM_LM_RMT_PHY __ATM_LM_MKRMT(__ATM_LM_PHY)
151#define ATM_LM_RMT_ANALOG __ATM_LM_MKRMT(__ATM_LM_ANALOG)
152
153/*
154 * Note: ATM_LM_LOC_* and ATM_LM_RMT_* can be combined, provided that
155 * __ATM_LM_XTLOC(x) <= __ATM_LM_XTRMT(x)
156 */
157
158
159struct atm_iobuf {
160 int length;
161 void __user *buffer;
162};
163
164/* for ATM_GETCIRANGE / ATM_SETCIRANGE */
165
166#define ATM_CI_MAX -1 /* use maximum range of VPI/VCI */
167
168struct atm_cirange {
169 signed char vpi_bits; /* 1..8, ATM_CI_MAX (-1) for maximum */
170 signed char vci_bits; /* 1..16, ATM_CI_MAX (-1) for maximum */
171};
172
173/* for ATM_SETSC; actually taken from the ATM_VF number space */
174
175#define ATM_SC_RX 1024 /* enable RX single-copy */
176#define ATM_SC_TX 2048 /* enable TX single-copy */
177
178#define ATM_BACKLOG_DEFAULT 32 /* if we get more, we're likely to time out
179 anyway */
180
181/* MF: change_qos (Modify) flags */
182
183#define ATM_MF_IMMED 1 /* Block until change is effective */
184#define ATM_MF_INC_RSV 2 /* Change reservation on increase */
185#define ATM_MF_INC_SHP 4 /* Change shaping on increase */
186#define ATM_MF_DEC_RSV 8 /* Change reservation on decrease */
187#define ATM_MF_DEC_SHP 16 /* Change shaping on decrease */
188#define ATM_MF_BWD 32 /* Set the backward direction parameters */
189
190#define ATM_MF_SET (ATM_MF_INC_RSV | ATM_MF_INC_SHP | ATM_MF_DEC_RSV | \
191 ATM_MF_DEC_SHP | ATM_MF_BWD)
192
193/*
194 * ATM_VS_* are used to express VC state in a human-friendly way.
195 */
196
197#define ATM_VS_IDLE 0 /* VC is not used */
198#define ATM_VS_CONNECTED 1 /* VC is connected */
199#define ATM_VS_CLOSING 2 /* VC is closing */
200#define ATM_VS_LISTEN 3 /* VC is listening for incoming setups */
201#define ATM_VS_INUSE 4 /* VC is in use (registered with atmsigd) */
202#define ATM_VS_BOUND 5 /* VC is bound */
203
204#define ATM_VS2TXT_MAP \
205 "IDLE", "CONNECTED", "CLOSING", "LISTEN", "INUSE", "BOUND"
206
207#define ATM_VF2TXT_MAP \
208 "ADDR", "READY", "PARTIAL", "REGIS", \
209 "RELEASED", "HASQOS", "LISTEN", "META", \
210 "256", "512", "1024", "2048", \
211 "SESSION", "HASSAP", "BOUND", "CLOSE"
212
213
214#ifdef __KERNEL__
215
216#include <linux/wait.h> /* wait_queue_head_t */ 6#include <linux/wait.h> /* wait_queue_head_t */
217#include <linux/time.h> /* struct timeval */ 7#include <linux/time.h> /* struct timeval */
218#include <linux/net.h> 8#include <linux/net.h>
@@ -221,6 +11,7 @@ struct atm_cirange {
221#include <linux/uio.h> 11#include <linux/uio.h>
222#include <net/sock.h> 12#include <net/sock.h>
223#include <linux/atomic.h> 13#include <linux/atomic.h>
14#include <uapi/linux/atmdev.h>
224 15
225#ifdef CONFIG_PROC_FS 16#ifdef CONFIG_PROC_FS
226#include <linux/proc_fs.h> 17#include <linux/proc_fs.h>
@@ -521,6 +312,4 @@ void deregister_atm_ioctl(struct atm_ioctl *);
521int register_atmdevice_notifier(struct notifier_block *nb); 312int register_atmdevice_notifier(struct notifier_block *nb);
522void unregister_atmdevice_notifier(struct notifier_block *nb); 313void unregister_atmdevice_notifier(struct notifier_block *nb);
523 314
524#endif /* __KERNEL__ */
525
526#endif 315#endif
diff --git a/include/linux/atomic.h b/include/linux/atomic.h
index 70cfcb2d63c4..5b08a8540ecf 100644
--- a/include/linux/atomic.h
+++ b/include/linux/atomic.h
@@ -86,6 +86,31 @@ static inline int atomic_dec_unless_positive(atomic_t *p)
86} 86}
87#endif 87#endif
88 88
89/*
90 * atomic_dec_if_positive - decrement by 1 if old value positive
91 * @v: pointer of type atomic_t
92 *
93 * The function returns the old value of *v minus 1, even if
94 * the atomic variable, v, was not decremented.
95 */
96#ifndef atomic_dec_if_positive
97static inline int atomic_dec_if_positive(atomic_t *v)
98{
99 int c, old, dec;
100 c = atomic_read(v);
101 for (;;) {
102 dec = c - 1;
103 if (unlikely(dec < 0))
104 break;
105 old = atomic_cmpxchg((v), c, dec);
106 if (likely(old == c))
107 break;
108 c = old;
109 }
110 return dec;
111}
112#endif
113
89#ifndef CONFIG_ARCH_HAS_ATOMIC_OR 114#ifndef CONFIG_ARCH_HAS_ATOMIC_OR
90static inline void atomic_or(int i, atomic_t *v) 115static inline void atomic_or(int i, atomic_t *v)
91{ 116{
diff --git a/include/linux/audit.h b/include/linux/audit.h
index e7c836d961ea..bce729afbcf9 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -20,388 +20,11 @@
20 * Written by Rickard E. (Rik) Faith <faith@redhat.com> 20 * Written by Rickard E. (Rik) Faith <faith@redhat.com>
21 * 21 *
22 */ 22 */
23
24#ifndef _LINUX_AUDIT_H_ 23#ifndef _LINUX_AUDIT_H_
25#define _LINUX_AUDIT_H_ 24#define _LINUX_AUDIT_H_
26 25
27#include <linux/types.h>
28#include <linux/elf-em.h>
29#include <linux/ptrace.h>
30
31/* The netlink messages for the audit system is divided into blocks:
32 * 1000 - 1099 are for commanding the audit system
33 * 1100 - 1199 user space trusted application messages
34 * 1200 - 1299 messages internal to the audit daemon
35 * 1300 - 1399 audit event messages
36 * 1400 - 1499 SE Linux use
37 * 1500 - 1599 kernel LSPP events
38 * 1600 - 1699 kernel crypto events
39 * 1700 - 1799 kernel anomaly records
40 * 1800 - 1899 kernel integrity events
41 * 1900 - 1999 future kernel use
42 * 2000 is for otherwise unclassified kernel audit messages (legacy)
43 * 2001 - 2099 unused (kernel)
44 * 2100 - 2199 user space anomaly records
45 * 2200 - 2299 user space actions taken in response to anomalies
46 * 2300 - 2399 user space generated LSPP events
47 * 2400 - 2499 user space crypto events
48 * 2500 - 2999 future user space (maybe integrity labels and related events)
49 *
50 * Messages from 1000-1199 are bi-directional. 1200-1299 & 2100 - 2999 are
51 * exclusively user space. 1300-2099 is kernel --> user space
52 * communication.
53 */
54#define AUDIT_GET 1000 /* Get status */
55#define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */
56#define AUDIT_LIST 1002 /* List syscall rules -- deprecated */
57#define AUDIT_ADD 1003 /* Add syscall rule -- deprecated */
58#define AUDIT_DEL 1004 /* Delete syscall rule -- deprecated */
59#define AUDIT_USER 1005 /* Message from userspace -- deprecated */
60#define AUDIT_LOGIN 1006 /* Define the login id and information */
61#define AUDIT_WATCH_INS 1007 /* Insert file/dir watch entry */
62#define AUDIT_WATCH_REM 1008 /* Remove file/dir watch entry */
63#define AUDIT_WATCH_LIST 1009 /* List all file/dir watches */
64#define AUDIT_SIGNAL_INFO 1010 /* Get info about sender of signal to auditd */
65#define AUDIT_ADD_RULE 1011 /* Add syscall filtering rule */
66#define AUDIT_DEL_RULE 1012 /* Delete syscall filtering rule */
67#define AUDIT_LIST_RULES 1013 /* List syscall filtering rules */
68#define AUDIT_TRIM 1014 /* Trim junk from watched tree */
69#define AUDIT_MAKE_EQUIV 1015 /* Append to watched tree */
70#define AUDIT_TTY_GET 1016 /* Get TTY auditing status */
71#define AUDIT_TTY_SET 1017 /* Set TTY auditing status */
72
73#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */
74#define AUDIT_USER_AVC 1107 /* We filter this differently */
75#define AUDIT_USER_TTY 1124 /* Non-ICANON TTY input meaning */
76#define AUDIT_LAST_USER_MSG 1199
77#define AUDIT_FIRST_USER_MSG2 2100 /* More user space messages */
78#define AUDIT_LAST_USER_MSG2 2999
79
80#define AUDIT_DAEMON_START 1200 /* Daemon startup record */
81#define AUDIT_DAEMON_END 1201 /* Daemon normal stop record */
82#define AUDIT_DAEMON_ABORT 1202 /* Daemon error stop record */
83#define AUDIT_DAEMON_CONFIG 1203 /* Daemon config change */
84
85#define AUDIT_SYSCALL 1300 /* Syscall event */
86/* #define AUDIT_FS_WATCH 1301 * Deprecated */
87#define AUDIT_PATH 1302 /* Filename path information */
88#define AUDIT_IPC 1303 /* IPC record */
89#define AUDIT_SOCKETCALL 1304 /* sys_socketcall arguments */
90#define AUDIT_CONFIG_CHANGE 1305 /* Audit system configuration change */
91#define AUDIT_SOCKADDR 1306 /* sockaddr copied as syscall arg */
92#define AUDIT_CWD 1307 /* Current working directory */
93#define AUDIT_EXECVE 1309 /* execve arguments */
94#define AUDIT_IPC_SET_PERM 1311 /* IPC new permissions record type */
95#define AUDIT_MQ_OPEN 1312 /* POSIX MQ open record type */
96#define AUDIT_MQ_SENDRECV 1313 /* POSIX MQ send/receive record type */
97#define AUDIT_MQ_NOTIFY 1314 /* POSIX MQ notify record type */
98#define AUDIT_MQ_GETSETATTR 1315 /* POSIX MQ get/set attribute record type */
99#define AUDIT_KERNEL_OTHER 1316 /* For use by 3rd party modules */
100#define AUDIT_FD_PAIR 1317 /* audit record for pipe/socketpair */
101#define AUDIT_OBJ_PID 1318 /* ptrace target */
102#define AUDIT_TTY 1319 /* Input on an administrative TTY */
103#define AUDIT_EOE 1320 /* End of multi-record event */
104#define AUDIT_BPRM_FCAPS 1321 /* Information about fcaps increasing perms */
105#define AUDIT_CAPSET 1322 /* Record showing argument to sys_capset */
106#define AUDIT_MMAP 1323 /* Record showing descriptor and flags in mmap */
107#define AUDIT_NETFILTER_PKT 1324 /* Packets traversing netfilter chains */
108#define AUDIT_NETFILTER_CFG 1325 /* Netfilter chain modifications */
109
110#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
111#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
112#define AUDIT_AVC_PATH 1402 /* dentry, vfsmount pair from avc */
113#define AUDIT_MAC_POLICY_LOAD 1403 /* Policy file load */
114#define AUDIT_MAC_STATUS 1404 /* Changed enforcing,permissive,off */
115#define AUDIT_MAC_CONFIG_CHANGE 1405 /* Changes to booleans */
116#define AUDIT_MAC_UNLBL_ALLOW 1406 /* NetLabel: allow unlabeled traffic */
117#define AUDIT_MAC_CIPSOV4_ADD 1407 /* NetLabel: add CIPSOv4 DOI entry */
118#define AUDIT_MAC_CIPSOV4_DEL 1408 /* NetLabel: del CIPSOv4 DOI entry */
119#define AUDIT_MAC_MAP_ADD 1409 /* NetLabel: add LSM domain mapping */
120#define AUDIT_MAC_MAP_DEL 1410 /* NetLabel: del LSM domain mapping */
121#define AUDIT_MAC_IPSEC_ADDSA 1411 /* Not used */
122#define AUDIT_MAC_IPSEC_DELSA 1412 /* Not used */
123#define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Not used */
124#define AUDIT_MAC_IPSEC_DELSPD 1414 /* Not used */
125#define AUDIT_MAC_IPSEC_EVENT 1415 /* Audit an IPSec event */
126#define AUDIT_MAC_UNLBL_STCADD 1416 /* NetLabel: add a static label */
127#define AUDIT_MAC_UNLBL_STCDEL 1417 /* NetLabel: del a static label */
128
129#define AUDIT_FIRST_KERN_ANOM_MSG 1700
130#define AUDIT_LAST_KERN_ANOM_MSG 1799
131#define AUDIT_ANOM_PROMISCUOUS 1700 /* Device changed promiscuous mode */
132#define AUDIT_ANOM_ABEND 1701 /* Process ended abnormally */
133#define AUDIT_ANOM_LINK 1702 /* Suspicious use of file links */
134#define AUDIT_INTEGRITY_DATA 1800 /* Data integrity verification */
135#define AUDIT_INTEGRITY_METADATA 1801 /* Metadata integrity verification */
136#define AUDIT_INTEGRITY_STATUS 1802 /* Integrity enable status */
137#define AUDIT_INTEGRITY_HASH 1803 /* Integrity HASH type */
138#define AUDIT_INTEGRITY_PCR 1804 /* PCR invalidation msgs */
139#define AUDIT_INTEGRITY_RULE 1805 /* policy rule */
140
141#define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */
142
143/* Rule flags */
144#define AUDIT_FILTER_USER 0x00 /* Apply rule to user-generated messages */
145#define AUDIT_FILTER_TASK 0x01 /* Apply rule at task creation (not syscall) */
146#define AUDIT_FILTER_ENTRY 0x02 /* Apply rule at syscall entry */
147#define AUDIT_FILTER_WATCH 0x03 /* Apply rule to file system watches */
148#define AUDIT_FILTER_EXIT 0x04 /* Apply rule at syscall exit */
149#define AUDIT_FILTER_TYPE 0x05 /* Apply rule at audit_log_start */
150
151#define AUDIT_NR_FILTERS 6
152
153#define AUDIT_FILTER_PREPEND 0x10 /* Prepend to front of list */
154
155/* Rule actions */
156#define AUDIT_NEVER 0 /* Do not build context if rule matches */
157#define AUDIT_POSSIBLE 1 /* Build context if rule matches */
158#define AUDIT_ALWAYS 2 /* Generate audit record if rule matches */
159
160/* Rule structure sizes -- if these change, different AUDIT_ADD and
161 * AUDIT_LIST commands must be implemented. */
162#define AUDIT_MAX_FIELDS 64
163#define AUDIT_MAX_KEY_LEN 256
164#define AUDIT_BITMASK_SIZE 64
165#define AUDIT_WORD(nr) ((__u32)((nr)/32))
166#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32))
167
168#define AUDIT_SYSCALL_CLASSES 16
169#define AUDIT_CLASS_DIR_WRITE 0
170#define AUDIT_CLASS_DIR_WRITE_32 1
171#define AUDIT_CLASS_CHATTR 2
172#define AUDIT_CLASS_CHATTR_32 3
173#define AUDIT_CLASS_READ 4
174#define AUDIT_CLASS_READ_32 5
175#define AUDIT_CLASS_WRITE 6
176#define AUDIT_CLASS_WRITE_32 7
177#define AUDIT_CLASS_SIGNAL 8
178#define AUDIT_CLASS_SIGNAL_32 9
179
180/* This bitmask is used to validate user input. It represents all bits that
181 * are currently used in an audit field constant understood by the kernel.
182 * If you are adding a new #define AUDIT_<whatever>, please ensure that
183 * AUDIT_UNUSED_BITS is updated if need be. */
184#define AUDIT_UNUSED_BITS 0x07FFFC00
185
186/* AUDIT_FIELD_COMPARE rule list */
187#define AUDIT_COMPARE_UID_TO_OBJ_UID 1
188#define AUDIT_COMPARE_GID_TO_OBJ_GID 2
189#define AUDIT_COMPARE_EUID_TO_OBJ_UID 3
190#define AUDIT_COMPARE_EGID_TO_OBJ_GID 4
191#define AUDIT_COMPARE_AUID_TO_OBJ_UID 5
192#define AUDIT_COMPARE_SUID_TO_OBJ_UID 6
193#define AUDIT_COMPARE_SGID_TO_OBJ_GID 7
194#define AUDIT_COMPARE_FSUID_TO_OBJ_UID 8
195#define AUDIT_COMPARE_FSGID_TO_OBJ_GID 9
196
197#define AUDIT_COMPARE_UID_TO_AUID 10
198#define AUDIT_COMPARE_UID_TO_EUID 11
199#define AUDIT_COMPARE_UID_TO_FSUID 12
200#define AUDIT_COMPARE_UID_TO_SUID 13
201
202#define AUDIT_COMPARE_AUID_TO_FSUID 14
203#define AUDIT_COMPARE_AUID_TO_SUID 15
204#define AUDIT_COMPARE_AUID_TO_EUID 16
205
206#define AUDIT_COMPARE_EUID_TO_SUID 17
207#define AUDIT_COMPARE_EUID_TO_FSUID 18
208
209#define AUDIT_COMPARE_SUID_TO_FSUID 19
210
211#define AUDIT_COMPARE_GID_TO_EGID 20
212#define AUDIT_COMPARE_GID_TO_FSGID 21
213#define AUDIT_COMPARE_GID_TO_SGID 22
214
215#define AUDIT_COMPARE_EGID_TO_FSGID 23
216#define AUDIT_COMPARE_EGID_TO_SGID 24
217#define AUDIT_COMPARE_SGID_TO_FSGID 25
218
219#define AUDIT_MAX_FIELD_COMPARE AUDIT_COMPARE_SGID_TO_FSGID
220
221/* Rule fields */
222 /* These are useful when checking the
223 * task structure at task creation time
224 * (AUDIT_PER_TASK). */
225#define AUDIT_PID 0
226#define AUDIT_UID 1
227#define AUDIT_EUID 2
228#define AUDIT_SUID 3
229#define AUDIT_FSUID 4
230#define AUDIT_GID 5
231#define AUDIT_EGID 6
232#define AUDIT_SGID 7
233#define AUDIT_FSGID 8
234#define AUDIT_LOGINUID 9
235#define AUDIT_PERS 10
236#define AUDIT_ARCH 11
237#define AUDIT_MSGTYPE 12
238#define AUDIT_SUBJ_USER 13 /* security label user */
239#define AUDIT_SUBJ_ROLE 14 /* security label role */
240#define AUDIT_SUBJ_TYPE 15 /* security label type */
241#define AUDIT_SUBJ_SEN 16 /* security label sensitivity label */
242#define AUDIT_SUBJ_CLR 17 /* security label clearance label */
243#define AUDIT_PPID 18
244#define AUDIT_OBJ_USER 19
245#define AUDIT_OBJ_ROLE 20
246#define AUDIT_OBJ_TYPE 21
247#define AUDIT_OBJ_LEV_LOW 22
248#define AUDIT_OBJ_LEV_HIGH 23
249
250 /* These are ONLY useful when checking
251 * at syscall exit time (AUDIT_AT_EXIT). */
252#define AUDIT_DEVMAJOR 100
253#define AUDIT_DEVMINOR 101
254#define AUDIT_INODE 102
255#define AUDIT_EXIT 103
256#define AUDIT_SUCCESS 104 /* exit >= 0; value ignored */
257#define AUDIT_WATCH 105
258#define AUDIT_PERM 106
259#define AUDIT_DIR 107
260#define AUDIT_FILETYPE 108
261#define AUDIT_OBJ_UID 109
262#define AUDIT_OBJ_GID 110
263#define AUDIT_FIELD_COMPARE 111
264
265#define AUDIT_ARG0 200
266#define AUDIT_ARG1 (AUDIT_ARG0+1)
267#define AUDIT_ARG2 (AUDIT_ARG0+2)
268#define AUDIT_ARG3 (AUDIT_ARG0+3)
269
270#define AUDIT_FILTERKEY 210
271
272#define AUDIT_NEGATE 0x80000000
273
274/* These are the supported operators.
275 * 4 2 1 8
276 * = > < ?
277 * ----------
278 * 0 0 0 0 00 nonsense
279 * 0 0 0 1 08 & bit mask
280 * 0 0 1 0 10 <
281 * 0 1 0 0 20 >
282 * 0 1 1 0 30 !=
283 * 1 0 0 0 40 =
284 * 1 0 0 1 48 &= bit test
285 * 1 0 1 0 50 <=
286 * 1 1 0 0 60 >=
287 * 1 1 1 1 78 all operators
288 */
289#define AUDIT_BIT_MASK 0x08000000
290#define AUDIT_LESS_THAN 0x10000000
291#define AUDIT_GREATER_THAN 0x20000000
292#define AUDIT_NOT_EQUAL 0x30000000
293#define AUDIT_EQUAL 0x40000000
294#define AUDIT_BIT_TEST (AUDIT_BIT_MASK|AUDIT_EQUAL)
295#define AUDIT_LESS_THAN_OR_EQUAL (AUDIT_LESS_THAN|AUDIT_EQUAL)
296#define AUDIT_GREATER_THAN_OR_EQUAL (AUDIT_GREATER_THAN|AUDIT_EQUAL)
297#define AUDIT_OPERATORS (AUDIT_EQUAL|AUDIT_NOT_EQUAL|AUDIT_BIT_MASK)
298
299enum {
300 Audit_equal,
301 Audit_not_equal,
302 Audit_bitmask,
303 Audit_bittest,
304 Audit_lt,
305 Audit_gt,
306 Audit_le,
307 Audit_ge,
308 Audit_bad
309};
310
311/* Status symbols */
312 /* Mask values */
313#define AUDIT_STATUS_ENABLED 0x0001
314#define AUDIT_STATUS_FAILURE 0x0002
315#define AUDIT_STATUS_PID 0x0004
316#define AUDIT_STATUS_RATE_LIMIT 0x0008
317#define AUDIT_STATUS_BACKLOG_LIMIT 0x0010
318 /* Failure-to-log actions */
319#define AUDIT_FAIL_SILENT 0
320#define AUDIT_FAIL_PRINTK 1
321#define AUDIT_FAIL_PANIC 2
322
323/* distinguish syscall tables */
324#define __AUDIT_ARCH_64BIT 0x80000000
325#define __AUDIT_ARCH_LE 0x40000000
326#define AUDIT_ARCH_ALPHA (EM_ALPHA|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
327#define AUDIT_ARCH_ARM (EM_ARM|__AUDIT_ARCH_LE)
328#define AUDIT_ARCH_ARMEB (EM_ARM)
329#define AUDIT_ARCH_CRIS (EM_CRIS|__AUDIT_ARCH_LE)
330#define AUDIT_ARCH_FRV (EM_FRV)
331#define AUDIT_ARCH_H8300 (EM_H8_300)
332#define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE)
333#define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
334#define AUDIT_ARCH_M32R (EM_M32R)
335#define AUDIT_ARCH_M68K (EM_68K)
336#define AUDIT_ARCH_MIPS (EM_MIPS)
337#define AUDIT_ARCH_MIPSEL (EM_MIPS|__AUDIT_ARCH_LE)
338#define AUDIT_ARCH_MIPS64 (EM_MIPS|__AUDIT_ARCH_64BIT)
339#define AUDIT_ARCH_MIPSEL64 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
340#define AUDIT_ARCH_PARISC (EM_PARISC)
341#define AUDIT_ARCH_PARISC64 (EM_PARISC|__AUDIT_ARCH_64BIT)
342#define AUDIT_ARCH_PPC (EM_PPC)
343#define AUDIT_ARCH_PPC64 (EM_PPC64|__AUDIT_ARCH_64BIT)
344#define AUDIT_ARCH_S390 (EM_S390)
345#define AUDIT_ARCH_S390X (EM_S390|__AUDIT_ARCH_64BIT)
346#define AUDIT_ARCH_SH (EM_SH)
347#define AUDIT_ARCH_SHEL (EM_SH|__AUDIT_ARCH_LE)
348#define AUDIT_ARCH_SH64 (EM_SH|__AUDIT_ARCH_64BIT)
349#define AUDIT_ARCH_SHEL64 (EM_SH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
350#define AUDIT_ARCH_SPARC (EM_SPARC)
351#define AUDIT_ARCH_SPARC64 (EM_SPARCV9|__AUDIT_ARCH_64BIT)
352#define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
353
354#define AUDIT_PERM_EXEC 1
355#define AUDIT_PERM_WRITE 2
356#define AUDIT_PERM_READ 4
357#define AUDIT_PERM_ATTR 8
358
359struct audit_status {
360 __u32 mask; /* Bit mask for valid entries */
361 __u32 enabled; /* 1 = enabled, 0 = disabled */
362 __u32 failure; /* Failure-to-log action */
363 __u32 pid; /* pid of auditd process */
364 __u32 rate_limit; /* messages rate limit (per second) */
365 __u32 backlog_limit; /* waiting messages limit */
366 __u32 lost; /* messages lost */
367 __u32 backlog; /* messages waiting in queue */
368};
369
370struct audit_tty_status {
371 __u32 enabled; /* 1 = enabled, 0 = disabled */
372};
373
374/* audit_rule_data supports filter rules with both integer and string
375 * fields. It corresponds with AUDIT_ADD_RULE, AUDIT_DEL_RULE and
376 * AUDIT_LIST_RULES requests.
377 */
378struct audit_rule_data {
379 __u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */
380 __u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */
381 __u32 field_count;
382 __u32 mask[AUDIT_BITMASK_SIZE]; /* syscall(s) affected */
383 __u32 fields[AUDIT_MAX_FIELDS];
384 __u32 values[AUDIT_MAX_FIELDS];
385 __u32 fieldflags[AUDIT_MAX_FIELDS];
386 __u32 buflen; /* total length of string fields */
387 char buf[0]; /* string fields buffer */
388};
389
390/* audit_rule is supported to maintain backward compatibility with
391 * userspace. It supports integer fields only and corresponds to
392 * AUDIT_ADD, AUDIT_DEL and AUDIT_LIST requests.
393 */
394struct audit_rule { /* for AUDIT_LIST, AUDIT_ADD, and AUDIT_DEL */
395 __u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */
396 __u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */
397 __u32 field_count;
398 __u32 mask[AUDIT_BITMASK_SIZE];
399 __u32 fields[AUDIT_MAX_FIELDS];
400 __u32 values[AUDIT_MAX_FIELDS];
401};
402
403#ifdef __KERNEL__
404#include <linux/sched.h> 26#include <linux/sched.h>
27#include <uapi/linux/audit.h>
405 28
406struct audit_sig_info { 29struct audit_sig_info {
407 uid_t uid; 30 uid_t uid;
@@ -452,6 +75,16 @@ struct audit_field {
452extern int __init audit_register_class(int class, unsigned *list); 75extern int __init audit_register_class(int class, unsigned *list);
453extern int audit_classify_syscall(int abi, unsigned syscall); 76extern int audit_classify_syscall(int abi, unsigned syscall);
454extern int audit_classify_arch(int arch); 77extern int audit_classify_arch(int arch);
78
79/* audit_names->type values */
80#define AUDIT_TYPE_UNKNOWN 0 /* we don't know yet */
81#define AUDIT_TYPE_NORMAL 1 /* a "normal" audit record */
82#define AUDIT_TYPE_PARENT 2 /* a parent audit record */
83#define AUDIT_TYPE_CHILD_DELETE 3 /* a child being deleted */
84#define AUDIT_TYPE_CHILD_CREATE 4 /* a child being created */
85
86struct filename;
87
455#ifdef CONFIG_AUDITSYSCALL 88#ifdef CONFIG_AUDITSYSCALL
456/* These are defined in auditsc.c */ 89/* These are defined in auditsc.c */
457 /* Public API */ 90 /* Public API */
@@ -461,11 +94,14 @@ extern void __audit_syscall_entry(int arch,
461 int major, unsigned long a0, unsigned long a1, 94 int major, unsigned long a0, unsigned long a1,
462 unsigned long a2, unsigned long a3); 95 unsigned long a2, unsigned long a3);
463extern void __audit_syscall_exit(int ret_success, long ret_value); 96extern void __audit_syscall_exit(int ret_success, long ret_value);
464extern void __audit_getname(const char *name); 97extern struct filename *__audit_reusename(const __user char *uptr);
465extern void audit_putname(const char *name); 98extern void __audit_getname(struct filename *name);
466extern void __audit_inode(const char *name, const struct dentry *dentry); 99extern void audit_putname(struct filename *name);
467extern void __audit_inode_child(const struct dentry *dentry, 100extern void __audit_inode(struct filename *name, const struct dentry *dentry,
468 const struct inode *parent); 101 unsigned int parent);
102extern void __audit_inode_child(const struct inode *parent,
103 const struct dentry *dentry,
104 const unsigned char type);
469extern void __audit_seccomp(unsigned long syscall, long signr, int code); 105extern void __audit_seccomp(unsigned long syscall, long signr, int code);
470extern void __audit_ptrace(struct task_struct *t); 106extern void __audit_ptrace(struct task_struct *t);
471 107
@@ -495,19 +131,27 @@ static inline void audit_syscall_exit(void *pt_regs)
495 __audit_syscall_exit(success, return_code); 131 __audit_syscall_exit(success, return_code);
496 } 132 }
497} 133}
498static inline void audit_getname(const char *name) 134static inline struct filename *audit_reusename(const __user char *name)
135{
136 if (unlikely(!audit_dummy_context()))
137 return __audit_reusename(name);
138 return NULL;
139}
140static inline void audit_getname(struct filename *name)
499{ 141{
500 if (unlikely(!audit_dummy_context())) 142 if (unlikely(!audit_dummy_context()))
501 __audit_getname(name); 143 __audit_getname(name);
502} 144}
503static inline void audit_inode(const char *name, const struct dentry *dentry) { 145static inline void audit_inode(struct filename *name, const struct dentry *dentry,
146 unsigned int parent) {
504 if (unlikely(!audit_dummy_context())) 147 if (unlikely(!audit_dummy_context()))
505 __audit_inode(name, dentry); 148 __audit_inode(name, dentry, parent);
506} 149}
507static inline void audit_inode_child(const struct dentry *dentry, 150static inline void audit_inode_child(const struct inode *parent,
508 const struct inode *parent) { 151 const struct dentry *dentry,
152 const unsigned char type) {
509 if (unlikely(!audit_dummy_context())) 153 if (unlikely(!audit_dummy_context()))
510 __audit_inode_child(dentry, parent); 154 __audit_inode_child(parent, dentry, type);
511} 155}
512void audit_core_dumps(long signr); 156void audit_core_dumps(long signr);
513 157
@@ -527,9 +171,18 @@ static inline void audit_ptrace(struct task_struct *t)
527extern unsigned int audit_serial(void); 171extern unsigned int audit_serial(void);
528extern int auditsc_get_stamp(struct audit_context *ctx, 172extern int auditsc_get_stamp(struct audit_context *ctx,
529 struct timespec *t, unsigned int *serial); 173 struct timespec *t, unsigned int *serial);
530extern int audit_set_loginuid(kuid_t loginuid); 174extern int audit_set_loginuid(kuid_t loginuid);
531#define audit_get_loginuid(t) ((t)->loginuid) 175
532#define audit_get_sessionid(t) ((t)->sessionid) 176static inline kuid_t audit_get_loginuid(struct task_struct *tsk)
177{
178 return tsk->loginuid;
179}
180
181static inline int audit_get_sessionid(struct task_struct *tsk)
182{
183 return tsk->sessionid;
184}
185
533extern void audit_log_task_context(struct audit_buffer *ab); 186extern void audit_log_task_context(struct audit_buffer *ab);
534extern void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk); 187extern void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk);
535extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp); 188extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp);
@@ -626,38 +279,111 @@ static inline void audit_mmap_fd(int fd, int flags)
626extern int audit_n_rules; 279extern int audit_n_rules;
627extern int audit_signals; 280extern int audit_signals;
628#else /* CONFIG_AUDITSYSCALL */ 281#else /* CONFIG_AUDITSYSCALL */
629#define audit_alloc(t) ({ 0; }) 282static inline int audit_alloc(struct task_struct *task)
630#define audit_free(t) do { ; } while (0) 283{
631#define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0) 284 return 0;
632#define audit_syscall_exit(r) do { ; } while (0) 285}
633#define audit_dummy_context() 1 286static inline void audit_free(struct task_struct *task)
634#define audit_getname(n) do { ; } while (0) 287{ }
635#define audit_putname(n) do { ; } while (0) 288static inline void audit_syscall_entry(int arch, int major, unsigned long a0,
636#define __audit_inode(n,d) do { ; } while (0) 289 unsigned long a1, unsigned long a2,
637#define __audit_inode_child(i,p) do { ; } while (0) 290 unsigned long a3)
638#define audit_inode(n,d) do { (void)(d); } while (0) 291{ }
639#define audit_inode_child(i,p) do { ; } while (0) 292static inline void audit_syscall_exit(void *pt_regs)
640#define audit_core_dumps(i) do { ; } while (0) 293{ }
641#define audit_seccomp(i,s,c) do { ; } while (0) 294static inline int audit_dummy_context(void)
642#define auditsc_get_stamp(c,t,s) (0) 295{
643#define audit_get_loginuid(t) (INVALID_UID) 296 return 1;
644#define audit_get_sessionid(t) (-1) 297}
645#define audit_log_task_context(b) do { ; } while (0) 298static inline struct filename *audit_reusename(const __user char *name)
646#define audit_log_task_info(b, t) do { ; } while (0) 299{
647#define audit_ipc_obj(i) ((void)0) 300 return NULL;
648#define audit_ipc_set_perm(q,u,g,m) ((void)0) 301}
649#define audit_bprm(p) ({ 0; }) 302static inline void audit_getname(struct filename *name)
650#define audit_socketcall(n,a) ((void)0) 303{ }
651#define audit_fd_pair(n,a) ((void)0) 304static inline void audit_putname(struct filename *name)
652#define audit_sockaddr(len, addr) ({ 0; }) 305{ }
653#define audit_mq_open(o,m,a) ((void)0) 306static inline void __audit_inode(struct filename *name,
654#define audit_mq_sendrecv(d,l,p,t) ((void)0) 307 const struct dentry *dentry,
655#define audit_mq_notify(d,n) ((void)0) 308 unsigned int parent)
656#define audit_mq_getsetattr(d,s) ((void)0) 309{ }
657#define audit_log_bprm_fcaps(b, ncr, ocr) ({ 0; }) 310static inline void __audit_inode_child(const struct inode *parent,
658#define audit_log_capset(pid, ncr, ocr) ((void)0) 311 const struct dentry *dentry,
659#define audit_mmap_fd(fd, flags) ((void)0) 312 const unsigned char type)
660#define audit_ptrace(t) ((void)0) 313{ }
314static inline void audit_inode(struct filename *name,
315 const struct dentry *dentry,
316 unsigned int parent)
317{ }
318static inline void audit_inode_child(const struct inode *parent,
319 const struct dentry *dentry,
320 const unsigned char type)
321{ }
322static inline void audit_core_dumps(long signr)
323{ }
324static inline void __audit_seccomp(unsigned long syscall, long signr, int code)
325{ }
326static inline void audit_seccomp(unsigned long syscall, long signr, int code)
327{ }
328static inline int auditsc_get_stamp(struct audit_context *ctx,
329 struct timespec *t, unsigned int *serial)
330{
331 return 0;
332}
333static inline kuid_t audit_get_loginuid(struct task_struct *tsk)
334{
335 return INVALID_UID;
336}
337static inline int audit_get_sessionid(struct task_struct *tsk)
338{
339 return -1;
340}
341static inline void audit_log_task_context(struct audit_buffer *ab)
342{ }
343static inline void audit_log_task_info(struct audit_buffer *ab,
344 struct task_struct *tsk)
345{ }
346static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
347{ }
348static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid,
349 gid_t gid, umode_t mode)
350{ }
351static inline int audit_bprm(struct linux_binprm *bprm)
352{
353 return 0;
354}
355static inline void audit_socketcall(int nargs, unsigned long *args)
356{ }
357static inline void audit_fd_pair(int fd1, int fd2)
358{ }
359static inline int audit_sockaddr(int len, void *addr)
360{
361 return 0;
362}
363static inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr)
364{ }
365static inline void audit_mq_sendrecv(mqd_t mqdes, size_t msg_len,
366 unsigned int msg_prio,
367 const struct timespec *abs_timeout)
368{ }
369static inline void audit_mq_notify(mqd_t mqdes,
370 const struct sigevent *notification)
371{ }
372static inline void audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
373{ }
374static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
375 const struct cred *new,
376 const struct cred *old)
377{
378 return 0;
379}
380static inline void audit_log_capset(pid_t pid, const struct cred *new,
381 const struct cred *old)
382{ }
383static inline void audit_mmap_fd(int fd, int flags)
384{ }
385static inline void audit_ptrace(struct task_struct *t)
386{ }
661#define audit_n_rules 0 387#define audit_n_rules 0
662#define audit_signals 0 388#define audit_signals 0
663#endif /* CONFIG_AUDITSYSCALL */ 389#endif /* CONFIG_AUDITSYSCALL */
@@ -681,7 +407,6 @@ extern void audit_log_n_hex(struct audit_buffer *ab,
681extern void audit_log_n_string(struct audit_buffer *ab, 407extern void audit_log_n_string(struct audit_buffer *ab,
682 const char *buf, 408 const char *buf,
683 size_t n); 409 size_t n);
684#define audit_log_string(a,b) audit_log_n_string(a, b, strlen(b));
685extern void audit_log_n_untrustedstring(struct audit_buffer *ab, 410extern void audit_log_n_untrustedstring(struct audit_buffer *ab,
686 const char *string, 411 const char *string,
687 size_t n); 412 size_t n);
@@ -698,7 +423,8 @@ extern void audit_log_lost(const char *message);
698#ifdef CONFIG_SECURITY 423#ifdef CONFIG_SECURITY
699extern void audit_log_secctx(struct audit_buffer *ab, u32 secid); 424extern void audit_log_secctx(struct audit_buffer *ab, u32 secid);
700#else 425#else
701#define audit_log_secctx(b,s) do { ; } while (0) 426static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid)
427{ }
702#endif 428#endif
703 429
704extern int audit_update_lsm_rules(void); 430extern int audit_update_lsm_rules(void);
@@ -710,22 +436,49 @@ extern int audit_receive_filter(int type, int pid, int seq,
710 void *data, size_t datasz, kuid_t loginuid, 436 void *data, size_t datasz, kuid_t loginuid,
711 u32 sessionid, u32 sid); 437 u32 sessionid, u32 sid);
712extern int audit_enabled; 438extern int audit_enabled;
713#else 439#else /* CONFIG_AUDIT */
714#define audit_log(c,g,t,f,...) do { ; } while (0) 440static inline __printf(4, 5)
715#define audit_log_start(c,g,t) ({ NULL; }) 441void audit_log(struct audit_context *ctx, gfp_t gfp_mask, int type,
716#define audit_log_vformat(b,f,a) do { ; } while (0) 442 const char *fmt, ...)
717#define audit_log_format(b,f,...) do { ; } while (0) 443{ }
718#define audit_log_end(b) do { ; } while (0) 444static inline struct audit_buffer *audit_log_start(struct audit_context *ctx,
719#define audit_log_n_hex(a,b,l) do { ; } while (0) 445 gfp_t gfp_mask, int type)
720#define audit_log_n_string(a,c,l) do { ; } while (0) 446{
721#define audit_log_string(a,c) do { ; } while (0) 447 return NULL;
722#define audit_log_n_untrustedstring(a,n,s) do { ; } while (0) 448}
723#define audit_log_untrustedstring(a,s) do { ; } while (0) 449static inline __printf(2, 3)
724#define audit_log_d_path(b, p, d) do { ; } while (0) 450void audit_log_format(struct audit_buffer *ab, const char *fmt, ...)
725#define audit_log_key(b, k) do { ; } while (0) 451{ }
726#define audit_log_link_denied(o, l) do { ; } while (0) 452static inline void audit_log_end(struct audit_buffer *ab)
727#define audit_log_secctx(b,s) do { ; } while (0) 453{ }
454static inline void audit_log_n_hex(struct audit_buffer *ab,
455 const unsigned char *buf, size_t len)
456{ }
457static inline void audit_log_n_string(struct audit_buffer *ab,
458 const char *buf, size_t n)
459{ }
460static inline void audit_log_n_untrustedstring(struct audit_buffer *ab,
461 const char *string, size_t n)
462{ }
463static inline void audit_log_untrustedstring(struct audit_buffer *ab,
464 const char *string)
465{ }
466static inline void audit_log_d_path(struct audit_buffer *ab,
467 const char *prefix,
468 const struct path *path)
469{ }
470static inline void audit_log_key(struct audit_buffer *ab, char *key)
471{ }
472static inline void audit_log_link_denied(const char *string,
473 const struct path *link)
474{ }
475static inline void audit_log_secctx(struct audit_buffer *ab, u32 secid)
476{ }
728#define audit_enabled 0 477#define audit_enabled 0
729#endif 478#endif /* CONFIG_AUDIT */
730#endif 479static inline void audit_log_string(struct audit_buffer *ab, const char *buf)
480{
481 audit_log_n_string(ab, buf, strlen(buf));
482}
483
731#endif 484#endif
diff --git a/include/linux/auto_fs.h b/include/linux/auto_fs.h
index da64e15004b6..fcd704d354c4 100644
--- a/include/linux/auto_fs.h
+++ b/include/linux/auto_fs.h
@@ -10,77 +10,11 @@
10 * 10 *
11 * ----------------------------------------------------------------------- */ 11 * ----------------------------------------------------------------------- */
12 12
13
14#ifndef _LINUX_AUTO_FS_H 13#ifndef _LINUX_AUTO_FS_H
15#define _LINUX_AUTO_FS_H 14#define _LINUX_AUTO_FS_H
16 15
17#include <linux/types.h>
18#ifdef __KERNEL__
19#include <linux/fs.h> 16#include <linux/fs.h>
20#include <linux/limits.h> 17#include <linux/limits.h>
21#include <linux/ioctl.h> 18#include <linux/ioctl.h>
22#else 19#include <uapi/linux/auto_fs.h>
23#include <sys/ioctl.h>
24#endif /* __KERNEL__ */
25
26/* This file describes autofs v3 */
27#define AUTOFS_PROTO_VERSION 3
28
29/* Range of protocol versions defined */
30#define AUTOFS_MAX_PROTO_VERSION AUTOFS_PROTO_VERSION
31#define AUTOFS_MIN_PROTO_VERSION AUTOFS_PROTO_VERSION
32
33/*
34 * Architectures where both 32- and 64-bit binaries can be executed
35 * on 64-bit kernels need this. This keeps the structure format
36 * uniform, and makes sure the wait_queue_token isn't too big to be
37 * passed back down to the kernel.
38 *
39 * This assumes that on these architectures:
40 * mode 32 bit 64 bit
41 * -------------------------
42 * int 32 bit 32 bit
43 * long 32 bit 64 bit
44 *
45 * If so, 32-bit user-space code should be backwards compatible.
46 */
47
48#if defined(__sparc__) || defined(__mips__) || defined(__x86_64__) \
49 || defined(__powerpc__) || defined(__s390__)
50typedef unsigned int autofs_wqt_t;
51#else
52typedef unsigned long autofs_wqt_t;
53#endif
54
55/* Packet types */
56#define autofs_ptype_missing 0 /* Missing entry (mount request) */
57#define autofs_ptype_expire 1 /* Expire entry (umount request) */
58
59struct autofs_packet_hdr {
60 int proto_version; /* Protocol version */
61 int type; /* Type of packet */
62};
63
64struct autofs_packet_missing {
65 struct autofs_packet_hdr hdr;
66 autofs_wqt_t wait_queue_token;
67 int len;
68 char name[NAME_MAX+1];
69};
70
71/* v3 expire (via ioctl) */
72struct autofs_packet_expire {
73 struct autofs_packet_hdr hdr;
74 int len;
75 char name[NAME_MAX+1];
76};
77
78#define AUTOFS_IOC_READY _IO(0x93,0x60)
79#define AUTOFS_IOC_FAIL _IO(0x93,0x61)
80#define AUTOFS_IOC_CATATONIC _IO(0x93,0x62)
81#define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int)
82#define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,compat_ulong_t)
83#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long)
84#define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire)
85
86#endif /* _LINUX_AUTO_FS_H */ 20#endif /* _LINUX_AUTO_FS_H */
diff --git a/include/linux/auxvec.h b/include/linux/auxvec.h
index f3b5d4e3a2ac..669fef5c745a 100644
--- a/include/linux/auxvec.h
+++ b/include/linux/auxvec.h
@@ -1,39 +1,8 @@
1#ifndef _LINUX_AUXVEC_H 1#ifndef _LINUX_AUXVEC_H
2#define _LINUX_AUXVEC_H 2#define _LINUX_AUXVEC_H
3 3
4#include <asm/auxvec.h> 4#include <uapi/linux/auxvec.h>
5 5
6/* Symbolic values for the entries in the auxiliary table
7 put on the initial stack */
8#define AT_NULL 0 /* end of vector */
9#define AT_IGNORE 1 /* entry should be ignored */
10#define AT_EXECFD 2 /* file descriptor of program */
11#define AT_PHDR 3 /* program headers for program */
12#define AT_PHENT 4 /* size of program header entry */
13#define AT_PHNUM 5 /* number of program headers */
14#define AT_PAGESZ 6 /* system page size */
15#define AT_BASE 7 /* base address of interpreter */
16#define AT_FLAGS 8 /* flags */
17#define AT_ENTRY 9 /* entry point of program */
18#define AT_NOTELF 10 /* program is not ELF */
19#define AT_UID 11 /* real uid */
20#define AT_EUID 12 /* effective uid */
21#define AT_GID 13 /* real gid */
22#define AT_EGID 14 /* effective gid */
23#define AT_PLATFORM 15 /* string identifying CPU for optimizations */
24#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */
25#define AT_CLKTCK 17 /* frequency at which times() increments */
26/* AT_* values 18 through 22 are reserved */
27#define AT_SECURE 23 /* secure mode boolean */
28#define AT_BASE_PLATFORM 24 /* string identifying real platform, may
29 * differ from AT_PLATFORM. */
30#define AT_RANDOM 25 /* address of 16 random bytes */
31
32#define AT_EXECFN 31 /* filename of program */
33
34#ifdef __KERNEL__
35#define AT_VECTOR_SIZE_BASE 19 /* NEW_AUX_ENT entries in auxiliary table */ 6#define AT_VECTOR_SIZE_BASE 19 /* NEW_AUX_ENT entries in auxiliary table */
36 /* number of "#define AT_.*" above, minus {AT_NULL, AT_IGNORE, AT_NOTELF} */ 7 /* number of "#define AT_.*" above, minus {AT_NULL, AT_IGNORE, AT_NOTELF} */
37#endif
38
39#endif /* _LINUX_AUXVEC_H */ 8#endif /* _LINUX_AUXVEC_H */
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 6ba45d2b99db..1cf1749440ac 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -522,6 +522,8 @@ struct bcma_sflash {
522 u32 blocksize; 522 u32 blocksize;
523 u16 numblocks; 523 u16 numblocks;
524 u32 size; 524 u32 size;
525
526 struct mtd_info *mtd;
525}; 527};
526#endif 528#endif
527 529
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 366422bc1633..cfcc6bfcaec0 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -1,24 +1,10 @@
1#ifndef _LINUX_BINFMTS_H 1#ifndef _LINUX_BINFMTS_H
2#define _LINUX_BINFMTS_H 2#define _LINUX_BINFMTS_H
3 3
4#include <linux/capability.h>
5
6struct pt_regs;
7
8/*
9 * These are the maximum length and maximum number of strings passed to the
10 * execve() system call. MAX_ARG_STRLEN is essentially random but serves to
11 * prevent the kernel from being unduly impacted by misaddressed pointers.
12 * MAX_ARG_STRINGS is chosen to fit in a signed 32-bit integer.
13 */
14#define MAX_ARG_STRLEN (PAGE_SIZE * 32)
15#define MAX_ARG_STRINGS 0x7FFFFFFF
16
17/* sizeof(linux_binprm->buf) */
18#define BINPRM_BUF_SIZE 128
19
20#ifdef __KERNEL__
21#include <linux/sched.h> 4#include <linux/sched.h>
5#include <linux/unistd.h>
6#include <asm/exec.h>
7#include <uapi/linux/binfmts.h>
22 8
23#define CORENAME_MAX_SIZE 128 9#define CORENAME_MAX_SIZE 128
24 10
@@ -72,7 +58,7 @@ struct linux_binprm {
72 58
73/* Function parameter for binfmt->coredump */ 59/* Function parameter for binfmt->coredump */
74struct coredump_params { 60struct coredump_params {
75 long signr; 61 siginfo_t *siginfo;
76 struct pt_regs *regs; 62 struct pt_regs *regs;
77 struct file *file; 63 struct file *file;
78 unsigned long limit; 64 unsigned long limit;
@@ -132,9 +118,11 @@ extern int copy_strings_kernel(int argc, const char *const *argv,
132 struct linux_binprm *bprm); 118 struct linux_binprm *bprm);
133extern int prepare_bprm_creds(struct linux_binprm *bprm); 119extern int prepare_bprm_creds(struct linux_binprm *bprm);
134extern void install_exec_creds(struct linux_binprm *bprm); 120extern void install_exec_creds(struct linux_binprm *bprm);
135extern void do_coredump(long signr, int exit_code, struct pt_regs *regs);
136extern void set_binfmt(struct linux_binfmt *new); 121extern void set_binfmt(struct linux_binfmt *new);
137extern void free_bprm(struct linux_binprm *); 122extern void free_bprm(struct linux_binprm *);
138 123
139#endif /* __KERNEL__ */ 124#ifdef __ARCH_WANT_KERNEL_EXECVE
125extern void ret_from_kernel_execve(struct pt_regs *normal) __noreturn;
126#endif
127
140#endif /* _LINUX_BINFMTS_H */ 128#endif /* _LINUX_BINFMTS_H */
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 26435890dc87..820e7aaad4fd 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -212,20 +212,41 @@ extern void bio_pair_release(struct bio_pair *dbio);
212extern struct bio_set *bioset_create(unsigned int, unsigned int); 212extern struct bio_set *bioset_create(unsigned int, unsigned int);
213extern void bioset_free(struct bio_set *); 213extern void bioset_free(struct bio_set *);
214 214
215extern struct bio *bio_alloc(gfp_t, unsigned int);
216extern struct bio *bio_kmalloc(gfp_t, unsigned int);
217extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); 215extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *);
218extern void bio_put(struct bio *); 216extern void bio_put(struct bio *);
219extern void bio_free(struct bio *, struct bio_set *); 217
218extern void __bio_clone(struct bio *, struct bio *);
219extern struct bio *bio_clone_bioset(struct bio *, gfp_t, struct bio_set *bs);
220
221extern struct bio_set *fs_bio_set;
222
223static inline struct bio *bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs)
224{
225 return bio_alloc_bioset(gfp_mask, nr_iovecs, fs_bio_set);
226}
227
228static inline struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask)
229{
230 return bio_clone_bioset(bio, gfp_mask, fs_bio_set);
231}
232
233static inline struct bio *bio_kmalloc(gfp_t gfp_mask, unsigned int nr_iovecs)
234{
235 return bio_alloc_bioset(gfp_mask, nr_iovecs, NULL);
236}
237
238static inline struct bio *bio_clone_kmalloc(struct bio *bio, gfp_t gfp_mask)
239{
240 return bio_clone_bioset(bio, gfp_mask, NULL);
241
242}
220 243
221extern void bio_endio(struct bio *, int); 244extern void bio_endio(struct bio *, int);
222struct request_queue; 245struct request_queue;
223extern int bio_phys_segments(struct request_queue *, struct bio *); 246extern int bio_phys_segments(struct request_queue *, struct bio *);
224 247
225extern void __bio_clone(struct bio *, struct bio *);
226extern struct bio *bio_clone(struct bio *, gfp_t);
227
228extern void bio_init(struct bio *); 248extern void bio_init(struct bio *);
249extern void bio_reset(struct bio *);
229 250
230extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); 251extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int);
231extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, 252extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *,
@@ -304,8 +325,6 @@ struct biovec_slab {
304 struct kmem_cache *slab; 325 struct kmem_cache *slab;
305}; 326};
306 327
307extern struct bio_set *fs_bio_set;
308
309/* 328/*
310 * a small number of entries is fine, not going to be performance critical. 329 * a small number of entries is fine, not going to be performance critical.
311 * basically we just need to survive 330 * basically we just need to survive
@@ -367,9 +386,31 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
367/* 386/*
368 * Check whether this bio carries any data or not. A NULL bio is allowed. 387 * Check whether this bio carries any data or not. A NULL bio is allowed.
369 */ 388 */
370static inline int bio_has_data(struct bio *bio) 389static inline bool bio_has_data(struct bio *bio)
371{ 390{
372 return bio && bio->bi_io_vec != NULL; 391 if (bio && bio->bi_vcnt)
392 return true;
393
394 return false;
395}
396
397static inline bool bio_is_rw(struct bio *bio)
398{
399 if (!bio_has_data(bio))
400 return false;
401
402 if (bio->bi_rw & REQ_WRITE_SAME)
403 return false;
404
405 return true;
406}
407
408static inline bool bio_mergeable(struct bio *bio)
409{
410 if (bio->bi_rw & REQ_NOMERGE_FLAGS)
411 return false;
412
413 return true;
373} 414}
374 415
375/* 416/*
@@ -505,9 +546,8 @@ static inline struct bio *bio_list_get(struct bio_list *bl)
505 546
506#define bio_integrity(bio) (bio->bi_integrity != NULL) 547#define bio_integrity(bio) (bio->bi_integrity != NULL)
507 548
508extern struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *, gfp_t, unsigned int, struct bio_set *);
509extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); 549extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int);
510extern void bio_integrity_free(struct bio *, struct bio_set *); 550extern void bio_integrity_free(struct bio *);
511extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int); 551extern int bio_integrity_add_page(struct bio *, struct page *, unsigned int, unsigned int);
512extern int bio_integrity_enabled(struct bio *bio); 552extern int bio_integrity_enabled(struct bio *bio);
513extern int bio_integrity_set_tag(struct bio *, void *, unsigned int); 553extern int bio_integrity_set_tag(struct bio *, void *, unsigned int);
@@ -517,7 +557,7 @@ extern void bio_integrity_endio(struct bio *, int);
517extern void bio_integrity_advance(struct bio *, unsigned int); 557extern void bio_integrity_advance(struct bio *, unsigned int);
518extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int); 558extern void bio_integrity_trim(struct bio *, unsigned int, unsigned int);
519extern void bio_integrity_split(struct bio *, struct bio_pair *, int); 559extern void bio_integrity_split(struct bio *, struct bio_pair *, int);
520extern int bio_integrity_clone(struct bio *, struct bio *, gfp_t, struct bio_set *); 560extern int bio_integrity_clone(struct bio *, struct bio *, gfp_t);
521extern int bioset_integrity_create(struct bio_set *, int); 561extern int bioset_integrity_create(struct bio_set *, int);
522extern void bioset_integrity_free(struct bio_set *); 562extern void bioset_integrity_free(struct bio_set *);
523extern void bio_integrity_init(void); 563extern void bio_integrity_init(void);
@@ -549,13 +589,13 @@ static inline int bio_integrity_prep(struct bio *bio)
549 return 0; 589 return 0;
550} 590}
551 591
552static inline void bio_integrity_free(struct bio *bio, struct bio_set *bs) 592static inline void bio_integrity_free(struct bio *bio)
553{ 593{
554 return; 594 return;
555} 595}
556 596
557static inline int bio_integrity_clone(struct bio *bio, struct bio *bio_src, 597static inline int bio_integrity_clone(struct bio *bio, struct bio *bio_src,
558 gfp_t gfp_mask, struct bio_set *bs) 598 gfp_t gfp_mask)
559{ 599{
560 return 0; 600 return 0;
561} 601}
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 7b7ac9ccec7a..cdf11191e645 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -59,12 +59,6 @@ struct bio {
59 unsigned int bi_seg_front_size; 59 unsigned int bi_seg_front_size;
60 unsigned int bi_seg_back_size; 60 unsigned int bi_seg_back_size;
61 61
62 unsigned int bi_max_vecs; /* max bvl_vecs we can hold */
63
64 atomic_t bi_cnt; /* pin count */
65
66 struct bio_vec *bi_io_vec; /* the actual vec list */
67
68 bio_end_io_t *bi_end_io; 62 bio_end_io_t *bi_end_io;
69 63
70 void *bi_private; 64 void *bi_private;
@@ -80,7 +74,17 @@ struct bio {
80 struct bio_integrity_payload *bi_integrity; /* data integrity */ 74 struct bio_integrity_payload *bi_integrity; /* data integrity */
81#endif 75#endif
82 76
83 bio_destructor_t *bi_destructor; /* destructor */ 77 /*
78 * Everything starting with bi_max_vecs will be preserved by bio_reset()
79 */
80
81 unsigned int bi_max_vecs; /* max bvl_vecs we can hold */
82
83 atomic_t bi_cnt; /* pin count */
84
85 struct bio_vec *bi_io_vec; /* the actual vec list */
86
87 struct bio_set *bi_pool;
84 88
85 /* 89 /*
86 * We can inline a number of vecs at the end of the bio, to avoid 90 * We can inline a number of vecs at the end of the bio, to avoid
@@ -90,6 +94,8 @@ struct bio {
90 struct bio_vec bi_inline_vecs[0]; 94 struct bio_vec bi_inline_vecs[0];
91}; 95};
92 96
97#define BIO_RESET_BYTES offsetof(struct bio, bi_max_vecs)
98
93/* 99/*
94 * bio flags 100 * bio flags
95 */ 101 */
@@ -105,6 +111,13 @@ struct bio {
105#define BIO_FS_INTEGRITY 9 /* fs owns integrity data, not block layer */ 111#define BIO_FS_INTEGRITY 9 /* fs owns integrity data, not block layer */
106#define BIO_QUIET 10 /* Make BIO Quiet */ 112#define BIO_QUIET 10 /* Make BIO Quiet */
107#define BIO_MAPPED_INTEGRITY 11/* integrity metadata has been remapped */ 113#define BIO_MAPPED_INTEGRITY 11/* integrity metadata has been remapped */
114
115/*
116 * Flags starting here get preserved by bio_reset() - this includes
117 * BIO_POOL_IDX()
118 */
119#define BIO_RESET_BITS 12
120
108#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) 121#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
109 122
110/* 123/*
@@ -134,6 +147,7 @@ enum rq_flag_bits {
134 __REQ_PRIO, /* boost priority in cfq */ 147 __REQ_PRIO, /* boost priority in cfq */
135 __REQ_DISCARD, /* request to discard sectors */ 148 __REQ_DISCARD, /* request to discard sectors */
136 __REQ_SECURE, /* secure discard (used with __REQ_DISCARD) */ 149 __REQ_SECURE, /* secure discard (used with __REQ_DISCARD) */
150 __REQ_WRITE_SAME, /* write same block many times */
137 151
138 __REQ_NOIDLE, /* don't anticipate more IO after this one */ 152 __REQ_NOIDLE, /* don't anticipate more IO after this one */
139 __REQ_FUA, /* forced unit access */ 153 __REQ_FUA, /* forced unit access */
@@ -172,15 +186,21 @@ enum rq_flag_bits {
172#define REQ_META (1 << __REQ_META) 186#define REQ_META (1 << __REQ_META)
173#define REQ_PRIO (1 << __REQ_PRIO) 187#define REQ_PRIO (1 << __REQ_PRIO)
174#define REQ_DISCARD (1 << __REQ_DISCARD) 188#define REQ_DISCARD (1 << __REQ_DISCARD)
189#define REQ_WRITE_SAME (1 << __REQ_WRITE_SAME)
175#define REQ_NOIDLE (1 << __REQ_NOIDLE) 190#define REQ_NOIDLE (1 << __REQ_NOIDLE)
176 191
177#define REQ_FAILFAST_MASK \ 192#define REQ_FAILFAST_MASK \
178 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER) 193 (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)
179#define REQ_COMMON_MASK \ 194#define REQ_COMMON_MASK \
180 (REQ_WRITE | REQ_FAILFAST_MASK | REQ_SYNC | REQ_META | REQ_PRIO | \ 195 (REQ_WRITE | REQ_FAILFAST_MASK | REQ_SYNC | REQ_META | REQ_PRIO | \
181 REQ_DISCARD | REQ_NOIDLE | REQ_FLUSH | REQ_FUA | REQ_SECURE) 196 REQ_DISCARD | REQ_WRITE_SAME | REQ_NOIDLE | REQ_FLUSH | REQ_FUA | \
197 REQ_SECURE)
182#define REQ_CLONE_MASK REQ_COMMON_MASK 198#define REQ_CLONE_MASK REQ_COMMON_MASK
183 199
200/* This mask is used for both bio and request merge checking */
201#define REQ_NOMERGE_FLAGS \
202 (REQ_NOMERGE | REQ_STARTED | REQ_SOFTBARRIER | REQ_FLUSH | REQ_FUA)
203
184#define REQ_RAHEAD (1 << __REQ_RAHEAD) 204#define REQ_RAHEAD (1 << __REQ_RAHEAD)
185#define REQ_THROTTLED (1 << __REQ_THROTTLED) 205#define REQ_THROTTLED (1 << __REQ_THROTTLED)
186 206
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 4a2ab7c85393..1756001210d2 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -270,6 +270,7 @@ struct queue_limits {
270 unsigned int io_min; 270 unsigned int io_min;
271 unsigned int io_opt; 271 unsigned int io_opt;
272 unsigned int max_discard_sectors; 272 unsigned int max_discard_sectors;
273 unsigned int max_write_same_sectors;
273 unsigned int discard_granularity; 274 unsigned int discard_granularity;
274 unsigned int discard_alignment; 275 unsigned int discard_alignment;
275 276
@@ -540,8 +541,7 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q)
540 541
541#define blk_account_rq(rq) \ 542#define blk_account_rq(rq) \
542 (((rq)->cmd_flags & REQ_STARTED) && \ 543 (((rq)->cmd_flags & REQ_STARTED) && \
543 ((rq)->cmd_type == REQ_TYPE_FS || \ 544 ((rq)->cmd_type == REQ_TYPE_FS))
544 ((rq)->cmd_flags & REQ_DISCARD)))
545 545
546#define blk_pm_request(rq) \ 546#define blk_pm_request(rq) \
547 ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND || \ 547 ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND || \
@@ -595,17 +595,39 @@ static inline void blk_clear_rl_full(struct request_list *rl, bool sync)
595 rl->flags &= ~flag; 595 rl->flags &= ~flag;
596} 596}
597 597
598static inline bool rq_mergeable(struct request *rq)
599{
600 if (rq->cmd_type != REQ_TYPE_FS)
601 return false;
598 602
599/* 603 if (rq->cmd_flags & REQ_NOMERGE_FLAGS)
600 * mergeable request must not have _NOMERGE or _BARRIER bit set, nor may 604 return false;
601 * it already be started by driver. 605
602 */ 606 return true;
603#define RQ_NOMERGE_FLAGS \ 607}
604 (REQ_NOMERGE | REQ_STARTED | REQ_SOFTBARRIER | REQ_FLUSH | REQ_FUA | REQ_DISCARD) 608
605#define rq_mergeable(rq) \ 609static inline bool blk_check_merge_flags(unsigned int flags1,
606 (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \ 610 unsigned int flags2)
607 (((rq)->cmd_flags & REQ_DISCARD) || \ 611{
608 (rq)->cmd_type == REQ_TYPE_FS)) 612 if ((flags1 & REQ_DISCARD) != (flags2 & REQ_DISCARD))
613 return false;
614
615 if ((flags1 & REQ_SECURE) != (flags2 & REQ_SECURE))
616 return false;
617
618 if ((flags1 & REQ_WRITE_SAME) != (flags2 & REQ_WRITE_SAME))
619 return false;
620
621 return true;
622}
623
624static inline bool blk_write_same_mergeable(struct bio *a, struct bio *b)
625{
626 if (bio_data(a) == bio_data(b))
627 return true;
628
629 return false;
630}
609 631
610/* 632/*
611 * q->prep_rq_fn return values 633 * q->prep_rq_fn return values
@@ -802,6 +824,28 @@ static inline unsigned int blk_rq_cur_sectors(const struct request *rq)
802 return blk_rq_cur_bytes(rq) >> 9; 824 return blk_rq_cur_bytes(rq) >> 9;
803} 825}
804 826
827static inline unsigned int blk_queue_get_max_sectors(struct request_queue *q,
828 unsigned int cmd_flags)
829{
830 if (unlikely(cmd_flags & REQ_DISCARD))
831 return q->limits.max_discard_sectors;
832
833 if (unlikely(cmd_flags & REQ_WRITE_SAME))
834 return q->limits.max_write_same_sectors;
835
836 return q->limits.max_sectors;
837}
838
839static inline unsigned int blk_rq_get_max_sectors(struct request *rq)
840{
841 struct request_queue *q = rq->q;
842
843 if (unlikely(rq->cmd_type == REQ_TYPE_BLOCK_PC))
844 return q->limits.max_hw_sectors;
845
846 return blk_queue_get_max_sectors(q, rq->cmd_flags);
847}
848
805/* 849/*
806 * Request issue related functions. 850 * Request issue related functions.
807 */ 851 */
@@ -857,6 +901,8 @@ extern void blk_queue_max_segments(struct request_queue *, unsigned short);
857extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); 901extern void blk_queue_max_segment_size(struct request_queue *, unsigned int);
858extern void blk_queue_max_discard_sectors(struct request_queue *q, 902extern void blk_queue_max_discard_sectors(struct request_queue *q,
859 unsigned int max_discard_sectors); 903 unsigned int max_discard_sectors);
904extern void blk_queue_max_write_same_sectors(struct request_queue *q,
905 unsigned int max_write_same_sectors);
860extern void blk_queue_logical_block_size(struct request_queue *, unsigned short); 906extern void blk_queue_logical_block_size(struct request_queue *, unsigned short);
861extern void blk_queue_physical_block_size(struct request_queue *, unsigned int); 907extern void blk_queue_physical_block_size(struct request_queue *, unsigned int);
862extern void blk_queue_alignment_offset(struct request_queue *q, 908extern void blk_queue_alignment_offset(struct request_queue *q,
@@ -987,6 +1033,8 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
987extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *); 1033extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *);
988extern int blkdev_issue_discard(struct block_device *bdev, sector_t sector, 1034extern int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
989 sector_t nr_sects, gfp_t gfp_mask, unsigned long flags); 1035 sector_t nr_sects, gfp_t gfp_mask, unsigned long flags);
1036extern int blkdev_issue_write_same(struct block_device *bdev, sector_t sector,
1037 sector_t nr_sects, gfp_t gfp_mask, struct page *page);
990extern int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, 1038extern int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
991 sector_t nr_sects, gfp_t gfp_mask); 1039 sector_t nr_sects, gfp_t gfp_mask);
992static inline int sb_issue_discard(struct super_block *sb, sector_t block, 1040static inline int sb_issue_discard(struct super_block *sb, sector_t block,
@@ -1164,6 +1212,16 @@ static inline unsigned int bdev_discard_zeroes_data(struct block_device *bdev)
1164 return queue_discard_zeroes_data(bdev_get_queue(bdev)); 1212 return queue_discard_zeroes_data(bdev_get_queue(bdev));
1165} 1213}
1166 1214
1215static inline unsigned int bdev_write_same(struct block_device *bdev)
1216{
1217 struct request_queue *q = bdev_get_queue(bdev);
1218
1219 if (q)
1220 return q->limits.max_write_same_sectors;
1221
1222 return 0;
1223}
1224
1167static inline int queue_dma_alignment(struct request_queue *q) 1225static inline int queue_dma_alignment(struct request_queue *q)
1168{ 1226{
1169 return q ? q->dma_alignment : 511; 1227 return q ? q->dma_alignment : 511;
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 4d1a0748eaf8..7c2e030e72f1 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -1,150 +1,11 @@
1#ifndef BLKTRACE_H 1#ifndef BLKTRACE_H
2#define BLKTRACE_H 2#define BLKTRACE_H
3 3
4#include <linux/types.h>
5#ifdef __KERNEL__
6#include <linux/blkdev.h> 4#include <linux/blkdev.h>
7#include <linux/relay.h> 5#include <linux/relay.h>
8#include <linux/compat.h> 6#include <linux/compat.h>
9#endif 7#include <uapi/linux/blktrace_api.h>
10
11/*
12 * Trace categories
13 */
14enum blktrace_cat {
15 BLK_TC_READ = 1 << 0, /* reads */
16 BLK_TC_WRITE = 1 << 1, /* writes */
17 BLK_TC_FLUSH = 1 << 2, /* flush */
18 BLK_TC_SYNC = 1 << 3, /* sync IO */
19 BLK_TC_SYNCIO = BLK_TC_SYNC,
20 BLK_TC_QUEUE = 1 << 4, /* queueing/merging */
21 BLK_TC_REQUEUE = 1 << 5, /* requeueing */
22 BLK_TC_ISSUE = 1 << 6, /* issue */
23 BLK_TC_COMPLETE = 1 << 7, /* completions */
24 BLK_TC_FS = 1 << 8, /* fs requests */
25 BLK_TC_PC = 1 << 9, /* pc requests */
26 BLK_TC_NOTIFY = 1 << 10, /* special message */
27 BLK_TC_AHEAD = 1 << 11, /* readahead */
28 BLK_TC_META = 1 << 12, /* metadata */
29 BLK_TC_DISCARD = 1 << 13, /* discard requests */
30 BLK_TC_DRV_DATA = 1 << 14, /* binary per-driver data */
31 BLK_TC_FUA = 1 << 15, /* fua requests */
32
33 BLK_TC_END = 1 << 15, /* we've run out of bits! */
34};
35
36#define BLK_TC_SHIFT (16)
37#define BLK_TC_ACT(act) ((act) << BLK_TC_SHIFT)
38
39/*
40 * Basic trace actions
41 */
42enum blktrace_act {
43 __BLK_TA_QUEUE = 1, /* queued */
44 __BLK_TA_BACKMERGE, /* back merged to existing rq */
45 __BLK_TA_FRONTMERGE, /* front merge to existing rq */
46 __BLK_TA_GETRQ, /* allocated new request */
47 __BLK_TA_SLEEPRQ, /* sleeping on rq allocation */
48 __BLK_TA_REQUEUE, /* request requeued */
49 __BLK_TA_ISSUE, /* sent to driver */
50 __BLK_TA_COMPLETE, /* completed by driver */
51 __BLK_TA_PLUG, /* queue was plugged */
52 __BLK_TA_UNPLUG_IO, /* queue was unplugged by io */
53 __BLK_TA_UNPLUG_TIMER, /* queue was unplugged by timer */
54 __BLK_TA_INSERT, /* insert request */
55 __BLK_TA_SPLIT, /* bio was split */
56 __BLK_TA_BOUNCE, /* bio was bounced */
57 __BLK_TA_REMAP, /* bio was remapped */
58 __BLK_TA_ABORT, /* request aborted */
59 __BLK_TA_DRV_DATA, /* driver-specific binary data */
60};
61
62/*
63 * Notify events.
64 */
65enum blktrace_notify {
66 __BLK_TN_PROCESS = 0, /* establish pid/name mapping */
67 __BLK_TN_TIMESTAMP, /* include system clock */
68 __BLK_TN_MESSAGE, /* Character string message */
69};
70
71
72/*
73 * Trace actions in full. Additionally, read or write is masked
74 */
75#define BLK_TA_QUEUE (__BLK_TA_QUEUE | BLK_TC_ACT(BLK_TC_QUEUE))
76#define BLK_TA_BACKMERGE (__BLK_TA_BACKMERGE | BLK_TC_ACT(BLK_TC_QUEUE))
77#define BLK_TA_FRONTMERGE (__BLK_TA_FRONTMERGE | BLK_TC_ACT(BLK_TC_QUEUE))
78#define BLK_TA_GETRQ (__BLK_TA_GETRQ | BLK_TC_ACT(BLK_TC_QUEUE))
79#define BLK_TA_SLEEPRQ (__BLK_TA_SLEEPRQ | BLK_TC_ACT(BLK_TC_QUEUE))
80#define BLK_TA_REQUEUE (__BLK_TA_REQUEUE | BLK_TC_ACT(BLK_TC_REQUEUE))
81#define BLK_TA_ISSUE (__BLK_TA_ISSUE | BLK_TC_ACT(BLK_TC_ISSUE))
82#define BLK_TA_COMPLETE (__BLK_TA_COMPLETE| BLK_TC_ACT(BLK_TC_COMPLETE))
83#define BLK_TA_PLUG (__BLK_TA_PLUG | BLK_TC_ACT(BLK_TC_QUEUE))
84#define BLK_TA_UNPLUG_IO (__BLK_TA_UNPLUG_IO | BLK_TC_ACT(BLK_TC_QUEUE))
85#define BLK_TA_UNPLUG_TIMER (__BLK_TA_UNPLUG_TIMER | BLK_TC_ACT(BLK_TC_QUEUE))
86#define BLK_TA_INSERT (__BLK_TA_INSERT | BLK_TC_ACT(BLK_TC_QUEUE))
87#define BLK_TA_SPLIT (__BLK_TA_SPLIT)
88#define BLK_TA_BOUNCE (__BLK_TA_BOUNCE)
89#define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE))
90#define BLK_TA_ABORT (__BLK_TA_ABORT | BLK_TC_ACT(BLK_TC_QUEUE))
91#define BLK_TA_DRV_DATA (__BLK_TA_DRV_DATA | BLK_TC_ACT(BLK_TC_DRV_DATA))
92
93#define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY))
94#define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY))
95#define BLK_TN_MESSAGE (__BLK_TN_MESSAGE | BLK_TC_ACT(BLK_TC_NOTIFY))
96
97#define BLK_IO_TRACE_MAGIC 0x65617400
98#define BLK_IO_TRACE_VERSION 0x07
99
100/*
101 * The trace itself
102 */
103struct blk_io_trace {
104 __u32 magic; /* MAGIC << 8 | version */
105 __u32 sequence; /* event number */
106 __u64 time; /* in microseconds */
107 __u64 sector; /* disk offset */
108 __u32 bytes; /* transfer length */
109 __u32 action; /* what happened */
110 __u32 pid; /* who did it */
111 __u32 device; /* device number */
112 __u32 cpu; /* on what cpu did it happen */
113 __u16 error; /* completion error */
114 __u16 pdu_len; /* length of data after this trace */
115};
116
117/*
118 * The remap event
119 */
120struct blk_io_trace_remap {
121 __be32 device_from;
122 __be32 device_to;
123 __be64 sector_from;
124};
125
126enum {
127 Blktrace_setup = 1,
128 Blktrace_running,
129 Blktrace_stopped,
130};
131
132#define BLKTRACE_BDEV_SIZE 32
133
134/*
135 * User setup structure passed with BLKTRACESTART
136 */
137struct blk_user_trace_setup {
138 char name[BLKTRACE_BDEV_SIZE]; /* output */
139 __u16 act_mask; /* input */
140 __u32 buf_size; /* input */
141 __u32 buf_nr; /* input */
142 __u64 start_lba;
143 __u64 end_lba;
144 __u32 pid;
145};
146 8
147#ifdef __KERNEL__
148#if defined(CONFIG_BLK_DEV_IO_TRACE) 9#if defined(CONFIG_BLK_DEV_IO_TRACE)
149 10
150#include <linux/sysfs.h> 11#include <linux/sysfs.h>
@@ -250,5 +111,4 @@ extern void blk_fill_rwbs(char *rwbs, u32 rw, int bytes);
250 111
251#endif /* CONFIG_EVENT_TRACING && CONFIG_BLOCK */ 112#endif /* CONFIG_EVENT_TRACING && CONFIG_BLOCK */
252 113
253#endif /* __KERNEL__ */
254#endif 114#endif
diff --git a/include/linux/bsg.h b/include/linux/bsg.h
index ecb4730d0868..7173f6e9d2dd 100644
--- a/include/linux/bsg.h
+++ b/include/linux/bsg.h
@@ -1,67 +1,8 @@
1#ifndef BSG_H 1#ifndef BSG_H
2#define BSG_H 2#define BSG_H
3 3
4#include <linux/types.h> 4#include <uapi/linux/bsg.h>
5 5
6#define BSG_PROTOCOL_SCSI 0
7
8#define BSG_SUB_PROTOCOL_SCSI_CMD 0
9#define BSG_SUB_PROTOCOL_SCSI_TMF 1
10#define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2
11
12/*
13 * For flags member below
14 * sg.h sg_io_hdr also has bits defined for it's flags member. However
15 * none of these bits are implemented/used by bsg. The bits below are
16 * allocated to not conflict with sg.h ones anyway.
17 */
18#define BSG_FLAG_Q_AT_TAIL 0x10 /* default, == 0 at this bit, is Q_AT_HEAD */
19
20struct sg_io_v4 {
21 __s32 guard; /* [i] 'Q' to differentiate from v3 */
22 __u32 protocol; /* [i] 0 -> SCSI , .... */
23 __u32 subprotocol; /* [i] 0 -> SCSI command, 1 -> SCSI task
24 management function, .... */
25
26 __u32 request_len; /* [i] in bytes */
27 __u64 request; /* [i], [*i] {SCSI: cdb} */
28 __u64 request_tag; /* [i] {SCSI: task tag (only if flagged)} */
29 __u32 request_attr; /* [i] {SCSI: task attribute} */
30 __u32 request_priority; /* [i] {SCSI: task priority} */
31 __u32 request_extra; /* [i] {spare, for padding} */
32 __u32 max_response_len; /* [i] in bytes */
33 __u64 response; /* [i], [*o] {SCSI: (auto)sense data} */
34
35 /* "dout_": data out (to device); "din_": data in (from device) */
36 __u32 dout_iovec_count; /* [i] 0 -> "flat" dout transfer else
37 dout_xfer points to array of iovec */
38 __u32 dout_xfer_len; /* [i] bytes to be transferred to device */
39 __u32 din_iovec_count; /* [i] 0 -> "flat" din transfer */
40 __u32 din_xfer_len; /* [i] bytes to be transferred from device */
41 __u64 dout_xferp; /* [i], [*i] */
42 __u64 din_xferp; /* [i], [*o] */
43
44 __u32 timeout; /* [i] units: millisecond */
45 __u32 flags; /* [i] bit mask */
46 __u64 usr_ptr; /* [i->o] unused internally */
47 __u32 spare_in; /* [i] */
48
49 __u32 driver_status; /* [o] 0 -> ok */
50 __u32 transport_status; /* [o] 0 -> ok */
51 __u32 device_status; /* [o] {SCSI: command completion status} */
52 __u32 retry_delay; /* [o] {SCSI: status auxiliary information} */
53 __u32 info; /* [o] additional information */
54 __u32 duration; /* [o] time to complete, in milliseconds */
55 __u32 response_len; /* [o] bytes of response actually written */
56 __s32 din_resid; /* [o] din_xfer_len - actual_din_xfer_len */
57 __s32 dout_resid; /* [o] dout_xfer_len - actual_dout_xfer_len */
58 __u64 generated_tag; /* [o] {SCSI: transport generated task tag} */
59 __u32 spare_out; /* [o] */
60
61 __u32 padding;
62};
63
64#ifdef __KERNEL__
65 6
66#if defined(CONFIG_BLK_DEV_BSG) 7#if defined(CONFIG_BLK_DEV_BSG)
67struct bsg_class_device { 8struct bsg_class_device {
@@ -89,6 +30,4 @@ static inline void bsg_unregister_queue(struct request_queue *q)
89} 30}
90#endif 31#endif
91 32
92#endif /* __KERNEL__ */
93
94#endif 33#endif
diff --git a/include/linux/byteorder/Kbuild b/include/linux/byteorder/Kbuild
deleted file mode 100644
index 5896e344ba6c..000000000000
--- a/include/linux/byteorder/Kbuild
+++ /dev/null
@@ -1,2 +0,0 @@
1header-y += big_endian.h
2header-y += little_endian.h
diff --git a/include/linux/byteorder/big_endian.h b/include/linux/byteorder/big_endian.h
index 3c80fd7e8b56..392041475c72 100644
--- a/include/linux/byteorder/big_endian.h
+++ b/include/linux/byteorder/big_endian.h
@@ -1,108 +1,7 @@
1#ifndef _LINUX_BYTEORDER_BIG_ENDIAN_H 1#ifndef _LINUX_BYTEORDER_BIG_ENDIAN_H
2#define _LINUX_BYTEORDER_BIG_ENDIAN_H 2#define _LINUX_BYTEORDER_BIG_ENDIAN_H
3 3
4#ifndef __BIG_ENDIAN 4#include <uapi/linux/byteorder/big_endian.h>
5#define __BIG_ENDIAN 4321
6#endif
7#ifndef __BIG_ENDIAN_BITFIELD
8#define __BIG_ENDIAN_BITFIELD
9#endif
10 5
11#include <linux/types.h>
12#include <linux/swab.h>
13
14#define __constant_htonl(x) ((__force __be32)(__u32)(x))
15#define __constant_ntohl(x) ((__force __u32)(__be32)(x))
16#define __constant_htons(x) ((__force __be16)(__u16)(x))
17#define __constant_ntohs(x) ((__force __u16)(__be16)(x))
18#define __constant_cpu_to_le64(x) ((__force __le64)___constant_swab64((x)))
19#define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x))
20#define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x)))
21#define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le32)(x))
22#define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x)))
23#define __constant_le16_to_cpu(x) ___constant_swab16((__force __u16)(__le16)(x))
24#define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x))
25#define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x))
26#define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x))
27#define __constant_be32_to_cpu(x) ((__force __u32)(__be32)(x))
28#define __constant_cpu_to_be16(x) ((__force __be16)(__u16)(x))
29#define __constant_be16_to_cpu(x) ((__force __u16)(__be16)(x))
30#define __cpu_to_le64(x) ((__force __le64)__swab64((x)))
31#define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x))
32#define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
33#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
34#define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
35#define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
36#define __cpu_to_be64(x) ((__force __be64)(__u64)(x))
37#define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
38#define __cpu_to_be32(x) ((__force __be32)(__u32)(x))
39#define __be32_to_cpu(x) ((__force __u32)(__be32)(x))
40#define __cpu_to_be16(x) ((__force __be16)(__u16)(x))
41#define __be16_to_cpu(x) ((__force __u16)(__be16)(x))
42
43static inline __le64 __cpu_to_le64p(const __u64 *p)
44{
45 return (__force __le64)__swab64p(p);
46}
47static inline __u64 __le64_to_cpup(const __le64 *p)
48{
49 return __swab64p((__u64 *)p);
50}
51static inline __le32 __cpu_to_le32p(const __u32 *p)
52{
53 return (__force __le32)__swab32p(p);
54}
55static inline __u32 __le32_to_cpup(const __le32 *p)
56{
57 return __swab32p((__u32 *)p);
58}
59static inline __le16 __cpu_to_le16p(const __u16 *p)
60{
61 return (__force __le16)__swab16p(p);
62}
63static inline __u16 __le16_to_cpup(const __le16 *p)
64{
65 return __swab16p((__u16 *)p);
66}
67static inline __be64 __cpu_to_be64p(const __u64 *p)
68{
69 return (__force __be64)*p;
70}
71static inline __u64 __be64_to_cpup(const __be64 *p)
72{
73 return (__force __u64)*p;
74}
75static inline __be32 __cpu_to_be32p(const __u32 *p)
76{
77 return (__force __be32)*p;
78}
79static inline __u32 __be32_to_cpup(const __be32 *p)
80{
81 return (__force __u32)*p;
82}
83static inline __be16 __cpu_to_be16p(const __u16 *p)
84{
85 return (__force __be16)*p;
86}
87static inline __u16 __be16_to_cpup(const __be16 *p)
88{
89 return (__force __u16)*p;
90}
91#define __cpu_to_le64s(x) __swab64s((x))
92#define __le64_to_cpus(x) __swab64s((x))
93#define __cpu_to_le32s(x) __swab32s((x))
94#define __le32_to_cpus(x) __swab32s((x))
95#define __cpu_to_le16s(x) __swab16s((x))
96#define __le16_to_cpus(x) __swab16s((x))
97#define __cpu_to_be64s(x) do { (void)(x); } while (0)
98#define __be64_to_cpus(x) do { (void)(x); } while (0)
99#define __cpu_to_be32s(x) do { (void)(x); } while (0)
100#define __be32_to_cpus(x) do { (void)(x); } while (0)
101#define __cpu_to_be16s(x) do { (void)(x); } while (0)
102#define __be16_to_cpus(x) do { (void)(x); } while (0)
103
104#ifdef __KERNEL__
105#include <linux/byteorder/generic.h> 6#include <linux/byteorder/generic.h>
106#endif
107
108#endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */ 7#endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */
diff --git a/include/linux/byteorder/little_endian.h b/include/linux/byteorder/little_endian.h
index 83195fb82962..08057377aa23 100644
--- a/include/linux/byteorder/little_endian.h
+++ b/include/linux/byteorder/little_endian.h
@@ -1,108 +1,7 @@
1#ifndef _LINUX_BYTEORDER_LITTLE_ENDIAN_H 1#ifndef _LINUX_BYTEORDER_LITTLE_ENDIAN_H
2#define _LINUX_BYTEORDER_LITTLE_ENDIAN_H 2#define _LINUX_BYTEORDER_LITTLE_ENDIAN_H
3 3
4#ifndef __LITTLE_ENDIAN 4#include <uapi/linux/byteorder/little_endian.h>
5#define __LITTLE_ENDIAN 1234
6#endif
7#ifndef __LITTLE_ENDIAN_BITFIELD
8#define __LITTLE_ENDIAN_BITFIELD
9#endif
10 5
11#include <linux/types.h>
12#include <linux/swab.h>
13
14#define __constant_htonl(x) ((__force __be32)___constant_swab32((x)))
15#define __constant_ntohl(x) ___constant_swab32((__force __be32)(x))
16#define __constant_htons(x) ((__force __be16)___constant_swab16((x)))
17#define __constant_ntohs(x) ___constant_swab16((__force __be16)(x))
18#define __constant_cpu_to_le64(x) ((__force __le64)(__u64)(x))
19#define __constant_le64_to_cpu(x) ((__force __u64)(__le64)(x))
20#define __constant_cpu_to_le32(x) ((__force __le32)(__u32)(x))
21#define __constant_le32_to_cpu(x) ((__force __u32)(__le32)(x))
22#define __constant_cpu_to_le16(x) ((__force __le16)(__u16)(x))
23#define __constant_le16_to_cpu(x) ((__force __u16)(__le16)(x))
24#define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x)))
25#define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x))
26#define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x)))
27#define __constant_be32_to_cpu(x) ___constant_swab32((__force __u32)(__be32)(x))
28#define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x)))
29#define __constant_be16_to_cpu(x) ___constant_swab16((__force __u16)(__be16)(x))
30#define __cpu_to_le64(x) ((__force __le64)(__u64)(x))
31#define __le64_to_cpu(x) ((__force __u64)(__le64)(x))
32#define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
33#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
34#define __cpu_to_le16(x) ((__force __le16)(__u16)(x))
35#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
36#define __cpu_to_be64(x) ((__force __be64)__swab64((x)))
37#define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x))
38#define __cpu_to_be32(x) ((__force __be32)__swab32((x)))
39#define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
40#define __cpu_to_be16(x) ((__force __be16)__swab16((x)))
41#define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x))
42
43static inline __le64 __cpu_to_le64p(const __u64 *p)
44{
45 return (__force __le64)*p;
46}
47static inline __u64 __le64_to_cpup(const __le64 *p)
48{
49 return (__force __u64)*p;
50}
51static inline __le32 __cpu_to_le32p(const __u32 *p)
52{
53 return (__force __le32)*p;
54}
55static inline __u32 __le32_to_cpup(const __le32 *p)
56{
57 return (__force __u32)*p;
58}
59static inline __le16 __cpu_to_le16p(const __u16 *p)
60{
61 return (__force __le16)*p;
62}
63static inline __u16 __le16_to_cpup(const __le16 *p)
64{
65 return (__force __u16)*p;
66}
67static inline __be64 __cpu_to_be64p(const __u64 *p)
68{
69 return (__force __be64)__swab64p(p);
70}
71static inline __u64 __be64_to_cpup(const __be64 *p)
72{
73 return __swab64p((__u64 *)p);
74}
75static inline __be32 __cpu_to_be32p(const __u32 *p)
76{
77 return (__force __be32)__swab32p(p);
78}
79static inline __u32 __be32_to_cpup(const __be32 *p)
80{
81 return __swab32p((__u32 *)p);
82}
83static inline __be16 __cpu_to_be16p(const __u16 *p)
84{
85 return (__force __be16)__swab16p(p);
86}
87static inline __u16 __be16_to_cpup(const __be16 *p)
88{
89 return __swab16p((__u16 *)p);
90}
91#define __cpu_to_le64s(x) do { (void)(x); } while (0)
92#define __le64_to_cpus(x) do { (void)(x); } while (0)
93#define __cpu_to_le32s(x) do { (void)(x); } while (0)
94#define __le32_to_cpus(x) do { (void)(x); } while (0)
95#define __cpu_to_le16s(x) do { (void)(x); } while (0)
96#define __le16_to_cpus(x) do { (void)(x); } while (0)
97#define __cpu_to_be64s(x) __swab64s((x))
98#define __be64_to_cpus(x) __swab64s((x))
99#define __cpu_to_be32s(x) __swab32s((x))
100#define __be32_to_cpus(x) __swab32s((x))
101#define __cpu_to_be16s(x) __swab16s((x))
102#define __be16_to_cpus(x) __swab16s((x))
103
104#ifdef __KERNEL__
105#include <linux/byteorder/generic.h> 6#include <linux/byteorder/generic.h>
106#endif
107
108#endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */ 7#endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */
diff --git a/include/linux/caif/Kbuild b/include/linux/caif/Kbuild
deleted file mode 100644
index a9cf250689dc..000000000000
--- a/include/linux/caif/Kbuild
+++ /dev/null
@@ -1,2 +0,0 @@
1header-y += caif_socket.h
2header-y += if_caif.h
diff --git a/include/linux/can/Kbuild b/include/linux/can/Kbuild
deleted file mode 100644
index c62b7f1728f9..000000000000
--- a/include/linux/can/Kbuild
+++ /dev/null
@@ -1,5 +0,0 @@
1header-y += raw.h
2header-y += bcm.h
3header-y += gw.h
4header-y += error.h
5header-y += netlink.h
diff --git a/include/linux/capability.h b/include/linux/capability.h
index d10b7ed595b1..98503b792369 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -9,82 +9,11 @@
9 * 9 *
10 * ftp://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/ 10 * ftp://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/
11 */ 11 */
12
13#ifndef _LINUX_CAPABILITY_H 12#ifndef _LINUX_CAPABILITY_H
14#define _LINUX_CAPABILITY_H 13#define _LINUX_CAPABILITY_H
15 14
16#include <linux/types.h> 15#include <uapi/linux/capability.h>
17
18struct task_struct;
19
20/* User-level do most of the mapping between kernel and user
21 capabilities based on the version tag given by the kernel. The
22 kernel might be somewhat backwards compatible, but don't bet on
23 it. */
24
25/* Note, cap_t, is defined by POSIX (draft) to be an "opaque" pointer to
26 a set of three capability sets. The transposition of 3*the
27 following structure to such a composite is better handled in a user
28 library since the draft standard requires the use of malloc/free
29 etc.. */
30
31#define _LINUX_CAPABILITY_VERSION_1 0x19980330
32#define _LINUX_CAPABILITY_U32S_1 1
33
34#define _LINUX_CAPABILITY_VERSION_2 0x20071026 /* deprecated - use v3 */
35#define _LINUX_CAPABILITY_U32S_2 2
36
37#define _LINUX_CAPABILITY_VERSION_3 0x20080522
38#define _LINUX_CAPABILITY_U32S_3 2
39
40typedef struct __user_cap_header_struct {
41 __u32 version;
42 int pid;
43} __user *cap_user_header_t;
44
45typedef struct __user_cap_data_struct {
46 __u32 effective;
47 __u32 permitted;
48 __u32 inheritable;
49} __user *cap_user_data_t;
50
51
52#define VFS_CAP_REVISION_MASK 0xFF000000
53#define VFS_CAP_REVISION_SHIFT 24
54#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK
55#define VFS_CAP_FLAGS_EFFECTIVE 0x000001
56
57#define VFS_CAP_REVISION_1 0x01000000
58#define VFS_CAP_U32_1 1
59#define XATTR_CAPS_SZ_1 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_1))
60
61#define VFS_CAP_REVISION_2 0x02000000
62#define VFS_CAP_U32_2 2
63#define XATTR_CAPS_SZ_2 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_2))
64 16
65#define XATTR_CAPS_SZ XATTR_CAPS_SZ_2
66#define VFS_CAP_U32 VFS_CAP_U32_2
67#define VFS_CAP_REVISION VFS_CAP_REVISION_2
68
69struct vfs_cap_data {
70 __le32 magic_etc; /* Little endian */
71 struct {
72 __le32 permitted; /* Little endian */
73 __le32 inheritable; /* Little endian */
74 } data[VFS_CAP_U32];
75};
76
77#ifndef __KERNEL__
78
79/*
80 * Backwardly compatible definition for source code - trapped in a
81 * 32-bit world. If you find you need this, please consider using
82 * libcap to untrap yourself...
83 */
84#define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_1
85#define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_1
86
87#else
88 17
89#define _KERNEL_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_3 18#define _KERNEL_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_3
90#define _KERNEL_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_3 19#define _KERNEL_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_3
@@ -105,277 +34,6 @@ struct cpu_vfs_cap_data {
105#define _USER_CAP_HEADER_SIZE (sizeof(struct __user_cap_header_struct)) 34#define _USER_CAP_HEADER_SIZE (sizeof(struct __user_cap_header_struct))
106#define _KERNEL_CAP_T_SIZE (sizeof(kernel_cap_t)) 35#define _KERNEL_CAP_T_SIZE (sizeof(kernel_cap_t))
107 36
108#endif
109
110
111/**
112 ** POSIX-draft defined capabilities.
113 **/
114
115/* In a system with the [_POSIX_CHOWN_RESTRICTED] option defined, this
116 overrides the restriction of changing file ownership and group
117 ownership. */
118
119#define CAP_CHOWN 0
120
121/* Override all DAC access, including ACL execute access if
122 [_POSIX_ACL] is defined. Excluding DAC access covered by
123 CAP_LINUX_IMMUTABLE. */
124
125#define CAP_DAC_OVERRIDE 1
126
127/* Overrides all DAC restrictions regarding read and search on files
128 and directories, including ACL restrictions if [_POSIX_ACL] is
129 defined. Excluding DAC access covered by CAP_LINUX_IMMUTABLE. */
130
131#define CAP_DAC_READ_SEARCH 2
132
133/* Overrides all restrictions about allowed operations on files, where
134 file owner ID must be equal to the user ID, except where CAP_FSETID
135 is applicable. It doesn't override MAC and DAC restrictions. */
136
137#define CAP_FOWNER 3
138
139/* Overrides the following restrictions that the effective user ID
140 shall match the file owner ID when setting the S_ISUID and S_ISGID
141 bits on that file; that the effective group ID (or one of the
142 supplementary group IDs) shall match the file owner ID when setting
143 the S_ISGID bit on that file; that the S_ISUID and S_ISGID bits are
144 cleared on successful return from chown(2) (not implemented). */
145
146#define CAP_FSETID 4
147
148/* Overrides the restriction that the real or effective user ID of a
149 process sending a signal must match the real or effective user ID
150 of the process receiving the signal. */
151
152#define CAP_KILL 5
153
154/* Allows setgid(2) manipulation */
155/* Allows setgroups(2) */
156/* Allows forged gids on socket credentials passing. */
157
158#define CAP_SETGID 6
159
160/* Allows set*uid(2) manipulation (including fsuid). */
161/* Allows forged pids on socket credentials passing. */
162
163#define CAP_SETUID 7
164
165
166/**
167 ** Linux-specific capabilities
168 **/
169
170/* Without VFS support for capabilities:
171 * Transfer any capability in your permitted set to any pid,
172 * remove any capability in your permitted set from any pid
173 * With VFS support for capabilities (neither of above, but)
174 * Add any capability from current's capability bounding set
175 * to the current process' inheritable set
176 * Allow taking bits out of capability bounding set
177 * Allow modification of the securebits for a process
178 */
179
180#define CAP_SETPCAP 8
181
182/* Allow modification of S_IMMUTABLE and S_APPEND file attributes */
183
184#define CAP_LINUX_IMMUTABLE 9
185
186/* Allows binding to TCP/UDP sockets below 1024 */
187/* Allows binding to ATM VCIs below 32 */
188
189#define CAP_NET_BIND_SERVICE 10
190
191/* Allow broadcasting, listen to multicast */
192
193#define CAP_NET_BROADCAST 11
194
195/* Allow interface configuration */
196/* Allow administration of IP firewall, masquerading and accounting */
197/* Allow setting debug option on sockets */
198/* Allow modification of routing tables */
199/* Allow setting arbitrary process / process group ownership on
200 sockets */
201/* Allow binding to any address for transparent proxying (also via NET_RAW) */
202/* Allow setting TOS (type of service) */
203/* Allow setting promiscuous mode */
204/* Allow clearing driver statistics */
205/* Allow multicasting */
206/* Allow read/write of device-specific registers */
207/* Allow activation of ATM control sockets */
208
209#define CAP_NET_ADMIN 12
210
211/* Allow use of RAW sockets */
212/* Allow use of PACKET sockets */
213/* Allow binding to any address for transparent proxying (also via NET_ADMIN) */
214
215#define CAP_NET_RAW 13
216
217/* Allow locking of shared memory segments */
218/* Allow mlock and mlockall (which doesn't really have anything to do
219 with IPC) */
220
221#define CAP_IPC_LOCK 14
222
223/* Override IPC ownership checks */
224
225#define CAP_IPC_OWNER 15
226
227/* Insert and remove kernel modules - modify kernel without limit */
228#define CAP_SYS_MODULE 16
229
230/* Allow ioperm/iopl access */
231/* Allow sending USB messages to any device via /proc/bus/usb */
232
233#define CAP_SYS_RAWIO 17
234
235/* Allow use of chroot() */
236
237#define CAP_SYS_CHROOT 18
238
239/* Allow ptrace() of any process */
240
241#define CAP_SYS_PTRACE 19
242
243/* Allow configuration of process accounting */
244
245#define CAP_SYS_PACCT 20
246
247/* Allow configuration of the secure attention key */
248/* Allow administration of the random device */
249/* Allow examination and configuration of disk quotas */
250/* Allow setting the domainname */
251/* Allow setting the hostname */
252/* Allow calling bdflush() */
253/* Allow mount() and umount(), setting up new smb connection */
254/* Allow some autofs root ioctls */
255/* Allow nfsservctl */
256/* Allow VM86_REQUEST_IRQ */
257/* Allow to read/write pci config on alpha */
258/* Allow irix_prctl on mips (setstacksize) */
259/* Allow flushing all cache on m68k (sys_cacheflush) */
260/* Allow removing semaphores */
261/* Used instead of CAP_CHOWN to "chown" IPC message queues, semaphores
262 and shared memory */
263/* Allow locking/unlocking of shared memory segment */
264/* Allow turning swap on/off */
265/* Allow forged pids on socket credentials passing */
266/* Allow setting readahead and flushing buffers on block devices */
267/* Allow setting geometry in floppy driver */
268/* Allow turning DMA on/off in xd driver */
269/* Allow administration of md devices (mostly the above, but some
270 extra ioctls) */
271/* Allow tuning the ide driver */
272/* Allow access to the nvram device */
273/* Allow administration of apm_bios, serial and bttv (TV) device */
274/* Allow manufacturer commands in isdn CAPI support driver */
275/* Allow reading non-standardized portions of pci configuration space */
276/* Allow DDI debug ioctl on sbpcd driver */
277/* Allow setting up serial ports */
278/* Allow sending raw qic-117 commands */
279/* Allow enabling/disabling tagged queuing on SCSI controllers and sending
280 arbitrary SCSI commands */
281/* Allow setting encryption key on loopback filesystem */
282/* Allow setting zone reclaim policy */
283
284#define CAP_SYS_ADMIN 21
285
286/* Allow use of reboot() */
287
288#define CAP_SYS_BOOT 22
289
290/* Allow raising priority and setting priority on other (different
291 UID) processes */
292/* Allow use of FIFO and round-robin (realtime) scheduling on own
293 processes and setting the scheduling algorithm used by another
294 process. */
295/* Allow setting cpu affinity on other processes */
296
297#define CAP_SYS_NICE 23
298
299/* Override resource limits. Set resource limits. */
300/* Override quota limits. */
301/* Override reserved space on ext2 filesystem */
302/* Modify data journaling mode on ext3 filesystem (uses journaling
303 resources) */
304/* NOTE: ext2 honors fsuid when checking for resource overrides, so
305 you can override using fsuid too */
306/* Override size restrictions on IPC message queues */
307/* Allow more than 64hz interrupts from the real-time clock */
308/* Override max number of consoles on console allocation */
309/* Override max number of keymaps */
310
311#define CAP_SYS_RESOURCE 24
312
313/* Allow manipulation of system clock */
314/* Allow irix_stime on mips */
315/* Allow setting the real-time clock */
316
317#define CAP_SYS_TIME 25
318
319/* Allow configuration of tty devices */
320/* Allow vhangup() of tty */
321
322#define CAP_SYS_TTY_CONFIG 26
323
324/* Allow the privileged aspects of mknod() */
325
326#define CAP_MKNOD 27
327
328/* Allow taking of leases on files */
329
330#define CAP_LEASE 28
331
332#define CAP_AUDIT_WRITE 29
333
334#define CAP_AUDIT_CONTROL 30
335
336#define CAP_SETFCAP 31
337
338/* Override MAC access.
339 The base kernel enforces no MAC policy.
340 An LSM may enforce a MAC policy, and if it does and it chooses
341 to implement capability based overrides of that policy, this is
342 the capability it should use to do so. */
343
344#define CAP_MAC_OVERRIDE 32
345
346/* Allow MAC configuration or state changes.
347 The base kernel requires no MAC configuration.
348 An LSM may enforce a MAC policy, and if it does and it chooses
349 to implement capability based checks on modifications to that
350 policy or the data required to maintain it, this is the
351 capability it should use to do so. */
352
353#define CAP_MAC_ADMIN 33
354
355/* Allow configuring the kernel's syslog (printk behaviour) */
356
357#define CAP_SYSLOG 34
358
359/* Allow triggering something that will wake the system */
360
361#define CAP_WAKE_ALARM 35
362
363/* Allow preventing system suspends */
364
365#define CAP_BLOCK_SUSPEND 36
366
367#define CAP_LAST_CAP CAP_BLOCK_SUSPEND
368
369#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
370
371/*
372 * Bit location of each capability (used by user-space library and kernel)
373 */
374
375#define CAP_TO_INDEX(x) ((x) >> 5) /* 1 << 5 == bits in __u32 */
376#define CAP_TO_MASK(x) (1 << ((x) & 31)) /* mask for indexed __u32 */
377
378#ifdef __KERNEL__
379 37
380struct inode; 38struct inode;
381struct dentry; 39struct dentry;
@@ -557,6 +215,4 @@ extern bool inode_capable(const struct inode *inode, int cap);
557/* audit system wants to get cap info from files as well */ 215/* audit system wants to get cap info from files as well */
558extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps); 216extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps);
559 217
560#endif /* __KERNEL__ */
561
562#endif /* !_LINUX_CAPABILITY_H */ 218#endif /* !_LINUX_CAPABILITY_H */
diff --git a/include/linux/cciss_ioctl.h b/include/linux/cciss_ioctl.h
index 986493f5b92b..84b6e2d0f44d 100644
--- a/include/linux/cciss_ioctl.h
+++ b/include/linux/cciss_ioctl.h
@@ -1,91 +1,8 @@
1#ifndef CCISS_IOCTLH 1#ifndef CCISS_IOCTLH
2#define CCISS_IOCTLH 2#define CCISS_IOCTLH
3 3
4#include <linux/types.h> 4#include <uapi/linux/cciss_ioctl.h>
5#include <linux/ioctl.h>
6#include <linux/cciss_defs.h>
7 5
8#define CCISS_IOC_MAGIC 'B'
9
10
11typedef struct _cciss_pci_info_struct
12{
13 unsigned char bus;
14 unsigned char dev_fn;
15 unsigned short domain;
16 __u32 board_id;
17} cciss_pci_info_struct;
18
19typedef struct _cciss_coalint_struct
20{
21 __u32 delay;
22 __u32 count;
23} cciss_coalint_struct;
24
25typedef char NodeName_type[16];
26
27typedef __u32 Heartbeat_type;
28
29#define CISS_PARSCSIU2 0x0001
30#define CISS_PARCSCIU3 0x0002
31#define CISS_FIBRE1G 0x0100
32#define CISS_FIBRE2G 0x0200
33typedef __u32 BusTypes_type;
34
35typedef char FirmwareVer_type[4];
36typedef __u32 DriverVer_type;
37
38#define MAX_KMALLOC_SIZE 128000
39
40typedef struct _IOCTL_Command_struct {
41 LUNAddr_struct LUN_info;
42 RequestBlock_struct Request;
43 ErrorInfo_struct error_info;
44 WORD buf_size; /* size in bytes of the buf */
45 BYTE __user *buf;
46} IOCTL_Command_struct;
47
48typedef struct _BIG_IOCTL_Command_struct {
49 LUNAddr_struct LUN_info;
50 RequestBlock_struct Request;
51 ErrorInfo_struct error_info;
52 DWORD malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */
53 DWORD buf_size; /* size in bytes of the buf */
54 /* < malloc_size * MAXSGENTRIES */
55 BYTE __user *buf;
56} BIG_IOCTL_Command_struct;
57
58typedef struct _LogvolInfo_struct{
59 __u32 LunID;
60 int num_opens; /* number of opens on the logical volume */
61 int num_parts; /* number of partitions configured on logvol */
62} LogvolInfo_struct;
63
64#define CCISS_GETPCIINFO _IOR(CCISS_IOC_MAGIC, 1, cciss_pci_info_struct)
65
66#define CCISS_GETINTINFO _IOR(CCISS_IOC_MAGIC, 2, cciss_coalint_struct)
67#define CCISS_SETINTINFO _IOW(CCISS_IOC_MAGIC, 3, cciss_coalint_struct)
68
69#define CCISS_GETNODENAME _IOR(CCISS_IOC_MAGIC, 4, NodeName_type)
70#define CCISS_SETNODENAME _IOW(CCISS_IOC_MAGIC, 5, NodeName_type)
71
72#define CCISS_GETHEARTBEAT _IOR(CCISS_IOC_MAGIC, 6, Heartbeat_type)
73#define CCISS_GETBUSTYPES _IOR(CCISS_IOC_MAGIC, 7, BusTypes_type)
74#define CCISS_GETFIRMVER _IOR(CCISS_IOC_MAGIC, 8, FirmwareVer_type)
75#define CCISS_GETDRIVVER _IOR(CCISS_IOC_MAGIC, 9, DriverVer_type)
76#define CCISS_REVALIDVOLS _IO(CCISS_IOC_MAGIC, 10)
77#define CCISS_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 11, IOCTL_Command_struct)
78#define CCISS_DEREGDISK _IO(CCISS_IOC_MAGIC, 12)
79
80/* no longer used... use REGNEWD instead */
81#define CCISS_REGNEWDISK _IOW(CCISS_IOC_MAGIC, 13, int)
82
83#define CCISS_REGNEWD _IO(CCISS_IOC_MAGIC, 14)
84#define CCISS_RESCANDISK _IO(CCISS_IOC_MAGIC, 16)
85#define CCISS_GETLUNINFO _IOR(CCISS_IOC_MAGIC, 17, LogvolInfo_struct)
86#define CCISS_BIG_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL_Command_struct)
87
88#ifdef __KERNEL__
89#ifdef CONFIG_COMPAT 6#ifdef CONFIG_COMPAT
90 7
91/* 32 bit compatible ioctl structs */ 8/* 32 bit compatible ioctl structs */
@@ -111,5 +28,4 @@ typedef struct _BIG_IOCTL32_Command_struct {
111#define CCISS_BIG_PASSTHRU32 _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL32_Command_struct) 28#define CCISS_BIG_PASSTHRU32 _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL32_Command_struct)
112 29
113#endif /* CONFIG_COMPAT */ 30#endif /* CONFIG_COMPAT */
114#endif /* __KERNEL__ */
115#endif 31#endif
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index dfd7f187c351..8609d577bb66 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -7,910 +7,12 @@
7 * 1997, 1998 Erik Andersen, andersee@debian.org 7 * 1997, 1998 Erik Andersen, andersee@debian.org
8 * 1998-2002 Jens Axboe, axboe@suse.de 8 * 1998-2002 Jens Axboe, axboe@suse.de
9 */ 9 */
10
11#ifndef _LINUX_CDROM_H 10#ifndef _LINUX_CDROM_H
12#define _LINUX_CDROM_H 11#define _LINUX_CDROM_H
13 12
14#include <linux/types.h>
15#include <asm/byteorder.h>
16
17/*******************************************************
18 * As of Linux 2.1.x, all Linux CD-ROM application programs will use this
19 * (and only this) include file. It is my hope to provide Linux with
20 * a uniform interface between software accessing CD-ROMs and the various
21 * device drivers that actually talk to the drives. There may still be
22 * 23 different kinds of strange CD-ROM drives, but at least there will
23 * now be one, and only one, Linux CD-ROM interface.
24 *
25 * Additionally, as of Linux 2.1.x, all Linux application programs
26 * should use the O_NONBLOCK option when opening a CD-ROM device
27 * for subsequent ioctl commands. This allows for neat system errors
28 * like "No medium found" or "Wrong medium type" upon attempting to
29 * mount or play an empty slot, mount an audio disc, or play a data disc.
30 * Generally, changing an application program to support O_NONBLOCK
31 * is as easy as the following:
32 * - drive = open("/dev/cdrom", O_RDONLY);
33 * + drive = open("/dev/cdrom", O_RDONLY | O_NONBLOCK);
34 * It is worth the small change.
35 *
36 * Patches for many common CD programs (provided by David A. van Leeuwen)
37 * can be found at: ftp://ftp.gwdg.de/pub/linux/cdrom/drivers/cm206/
38 *
39 *******************************************************/
40
41/* When a driver supports a certain function, but the cdrom drive we are
42 * using doesn't, we will return the error EDRIVE_CANT_DO_THIS. We will
43 * borrow the "Operation not supported" error from the network folks to
44 * accomplish this. Maybe someday we will get a more targeted error code,
45 * but this will do for now... */
46#define EDRIVE_CANT_DO_THIS EOPNOTSUPP
47
48/*******************************************************
49 * The CD-ROM IOCTL commands -- these should be supported by
50 * all the various cdrom drivers. For the CD-ROM ioctls, we
51 * will commandeer byte 0x53, or 'S'.
52 *******************************************************/
53#define CDROMPAUSE 0x5301 /* Pause Audio Operation */
54#define CDROMRESUME 0x5302 /* Resume paused Audio Operation */
55#define CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */
56#define CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index
57 (struct cdrom_ti) */
58#define CDROMREADTOCHDR 0x5305 /* Read TOC header
59 (struct cdrom_tochdr) */
60#define CDROMREADTOCENTRY 0x5306 /* Read TOC entry
61 (struct cdrom_tocentry) */
62#define CDROMSTOP 0x5307 /* Stop the cdrom drive */
63#define CDROMSTART 0x5308 /* Start the cdrom drive */
64#define CDROMEJECT 0x5309 /* Ejects the cdrom media */
65#define CDROMVOLCTRL 0x530a /* Control output volume
66 (struct cdrom_volctrl) */
67#define CDROMSUBCHNL 0x530b /* Read subchannel data
68 (struct cdrom_subchnl) */
69#define CDROMREADMODE2 0x530c /* Read CDROM mode 2 data (2336 Bytes)
70 (struct cdrom_read) */
71#define CDROMREADMODE1 0x530d /* Read CDROM mode 1 data (2048 Bytes)
72 (struct cdrom_read) */
73#define CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */
74#define CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */
75#define CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session
76 address of multi session disks
77 (struct cdrom_multisession) */
78#define CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code"
79 if available (struct cdrom_mcn) */
80#define CDROM_GET_UPC CDROM_GET_MCN /* This one is deprecated,
81 but here anyway for compatibility */
82#define CDROMRESET 0x5312 /* hard-reset the drive */
83#define CDROMVOLREAD 0x5313 /* Get the drive's volume setting
84 (struct cdrom_volctrl) */
85#define CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes)
86 (struct cdrom_read) */
87/*
88 * These ioctls are used only used in aztcd.c and optcd.c
89 */
90#define CDROMREADCOOKED 0x5315 /* read data in cooked mode */
91#define CDROMSEEK 0x5316 /* seek msf address */
92
93/*
94 * This ioctl is only used by the scsi-cd driver.
95 It is for playing audio in logical block addressing mode.
96 */
97#define CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */
98
99/*
100 * These ioctls are only used in optcd.c
101 */
102#define CDROMREADALL 0x5318 /* read all 2646 bytes */
103
104/*
105 * These ioctls are (now) only in ide-cd.c for controlling
106 * drive spindown time. They should be implemented in the
107 * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10,
108 * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE...
109 * -Erik
110 */
111#define CDROMGETSPINDOWN 0x531d
112#define CDROMSETSPINDOWN 0x531e
113
114/*
115 * These ioctls are implemented through the uniform CD-ROM driver
116 * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM
117 * drivers are eventually ported to the uniform CD-ROM driver interface.
118 */
119#define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */
120#define CDROM_SET_OPTIONS 0x5320 /* Set behavior options */
121#define CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */
122#define CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */
123#define CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */
124#define CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */
125#define CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */
126#define CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */
127#define CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */
128#define CDROM_LOCKDOOR 0x5329 /* lock or unlock door */
129#define CDROM_DEBUG 0x5330 /* Turn debug messages on/off */
130#define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */
131
132/* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386.
133 * Future CDROM ioctls should be kept below 0x537F
134 */
135
136/* This ioctl is only used by sbpcd at the moment */
137#define CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */
138 /* conflict with SCSI_IOCTL_GET_IDLUN */
139
140/* DVD-ROM Specific ioctls */
141#define DVD_READ_STRUCT 0x5390 /* Read structure */
142#define DVD_WRITE_STRUCT 0x5391 /* Write structure */
143#define DVD_AUTH 0x5392 /* Authentication */
144
145#define CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */
146#define CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */
147#define CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */
148
149/*******************************************************
150 * CDROM IOCTL structures
151 *******************************************************/
152
153/* Address in MSF format */
154struct cdrom_msf0
155{
156 __u8 minute;
157 __u8 second;
158 __u8 frame;
159};
160
161/* Address in either MSF or logical format */
162union cdrom_addr
163{
164 struct cdrom_msf0 msf;
165 int lba;
166};
167
168/* This struct is used by the CDROMPLAYMSF ioctl */
169struct cdrom_msf
170{
171 __u8 cdmsf_min0; /* start minute */
172 __u8 cdmsf_sec0; /* start second */
173 __u8 cdmsf_frame0; /* start frame */
174 __u8 cdmsf_min1; /* end minute */
175 __u8 cdmsf_sec1; /* end second */
176 __u8 cdmsf_frame1; /* end frame */
177};
178
179/* This struct is used by the CDROMPLAYTRKIND ioctl */
180struct cdrom_ti
181{
182 __u8 cdti_trk0; /* start track */
183 __u8 cdti_ind0; /* start index */
184 __u8 cdti_trk1; /* end track */
185 __u8 cdti_ind1; /* end index */
186};
187
188/* This struct is used by the CDROMREADTOCHDR ioctl */
189struct cdrom_tochdr
190{
191 __u8 cdth_trk0; /* start track */
192 __u8 cdth_trk1; /* end track */
193};
194
195/* This struct is used by the CDROMVOLCTRL and CDROMVOLREAD ioctls */
196struct cdrom_volctrl
197{
198 __u8 channel0;
199 __u8 channel1;
200 __u8 channel2;
201 __u8 channel3;
202};
203
204/* This struct is used by the CDROMSUBCHNL ioctl */
205struct cdrom_subchnl
206{
207 __u8 cdsc_format;
208 __u8 cdsc_audiostatus;
209 __u8 cdsc_adr: 4;
210 __u8 cdsc_ctrl: 4;
211 __u8 cdsc_trk;
212 __u8 cdsc_ind;
213 union cdrom_addr cdsc_absaddr;
214 union cdrom_addr cdsc_reladdr;
215};
216
217
218/* This struct is used by the CDROMREADTOCENTRY ioctl */
219struct cdrom_tocentry
220{
221 __u8 cdte_track;
222 __u8 cdte_adr :4;
223 __u8 cdte_ctrl :4;
224 __u8 cdte_format;
225 union cdrom_addr cdte_addr;
226 __u8 cdte_datamode;
227};
228
229/* This struct is used by the CDROMREADMODE1, and CDROMREADMODE2 ioctls */
230struct cdrom_read
231{
232 int cdread_lba;
233 char *cdread_bufaddr;
234 int cdread_buflen;
235};
236
237/* This struct is used by the CDROMREADAUDIO ioctl */
238struct cdrom_read_audio
239{
240 union cdrom_addr addr; /* frame address */
241 __u8 addr_format; /* CDROM_LBA or CDROM_MSF */
242 int nframes; /* number of 2352-byte-frames to read at once */
243 __u8 __user *buf; /* frame buffer (size: nframes*2352 bytes) */
244};
245
246/* This struct is used with the CDROMMULTISESSION ioctl */
247struct cdrom_multisession
248{
249 union cdrom_addr addr; /* frame address: start-of-last-session
250 (not the new "frame 16"!). Only valid
251 if the "xa_flag" is true. */
252 __u8 xa_flag; /* 1: "is XA disk" */
253 __u8 addr_format; /* CDROM_LBA or CDROM_MSF */
254};
255
256/* This struct is used with the CDROM_GET_MCN ioctl.
257 * Very few audio discs actually have Universal Product Code information,
258 * which should just be the Medium Catalog Number on the box. Also note
259 * that the way the codeis written on CD is _not_ uniform across all discs!
260 */
261struct cdrom_mcn
262{
263 __u8 medium_catalog_number[14]; /* 13 ASCII digits, null-terminated */
264};
265
266/* This is used by the CDROMPLAYBLK ioctl */
267struct cdrom_blk
268{
269 unsigned from;
270 unsigned short len;
271};
272
273#define CDROM_PACKET_SIZE 12
274
275#define CGC_DATA_UNKNOWN 0
276#define CGC_DATA_WRITE 1
277#define CGC_DATA_READ 2
278#define CGC_DATA_NONE 3
279
280/* for CDROM_PACKET_COMMAND ioctl */
281struct cdrom_generic_command
282{
283 unsigned char cmd[CDROM_PACKET_SIZE];
284 unsigned char __user *buffer;
285 unsigned int buflen;
286 int stat;
287 struct request_sense __user *sense;
288 unsigned char data_direction;
289 int quiet;
290 int timeout;
291 void __user *reserved[1]; /* unused, actually */
292};
293
294/*
295 * A CD-ROM physical sector size is 2048, 2052, 2056, 2324, 2332, 2336,
296 * 2340, or 2352 bytes long.
297
298* Sector types of the standard CD-ROM data formats:
299 *
300 * format sector type user data size (bytes)
301 * -----------------------------------------------------------------------------
302 * 1 (Red Book) CD-DA 2352 (CD_FRAMESIZE_RAW)
303 * 2 (Yellow Book) Mode1 Form1 2048 (CD_FRAMESIZE)
304 * 3 (Yellow Book) Mode1 Form2 2336 (CD_FRAMESIZE_RAW0)
305 * 4 (Green Book) Mode2 Form1 2048 (CD_FRAMESIZE)
306 * 5 (Green Book) Mode2 Form2 2328 (2324+4 spare bytes)
307 *
308 *
309 * The layout of the standard CD-ROM data formats:
310 * -----------------------------------------------------------------------------
311 * - audio (red): | audio_sample_bytes |
312 * | 2352 |
313 *
314 * - data (yellow, mode1): | sync - head - data - EDC - zero - ECC |
315 * | 12 - 4 - 2048 - 4 - 8 - 276 |
316 *
317 * - data (yellow, mode2): | sync - head - data |
318 * | 12 - 4 - 2336 |
319 *
320 * - XA data (green, mode2 form1): | sync - head - sub - data - EDC - ECC |
321 * | 12 - 4 - 8 - 2048 - 4 - 276 |
322 *
323 * - XA data (green, mode2 form2): | sync - head - sub - data - Spare |
324 * | 12 - 4 - 8 - 2324 - 4 |
325 *
326 */
327
328/* Some generally useful CD-ROM information -- mostly based on the above */
329#define CD_MINS 74 /* max. minutes per CD, not really a limit */
330#define CD_SECS 60 /* seconds per minute */
331#define CD_FRAMES 75 /* frames per second */
332#define CD_SYNC_SIZE 12 /* 12 sync bytes per raw data frame */
333#define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */
334#define CD_CHUNK_SIZE 24 /* lowest-level "data bytes piece" */
335#define CD_NUM_OF_CHUNKS 98 /* chunks per frame */
336#define CD_FRAMESIZE_SUB 96 /* subchannel data "frame" size */
337#define CD_HEAD_SIZE 4 /* header (address) bytes per raw data frame */
338#define CD_SUBHEAD_SIZE 8 /* subheader bytes per raw XA data frame */
339#define CD_EDC_SIZE 4 /* bytes EDC per most raw data frame types */
340#define CD_ZERO_SIZE 8 /* bytes zero per yellow book mode 1 frame */
341#define CD_ECC_SIZE 276 /* bytes ECC per most raw data frame types */
342#define CD_FRAMESIZE 2048 /* bytes per frame, "cooked" mode */
343#define CD_FRAMESIZE_RAW 2352 /* bytes per frame, "raw" mode */
344#define CD_FRAMESIZE_RAWER 2646 /* The maximum possible returned bytes */
345/* most drives don't deliver everything: */
346#define CD_FRAMESIZE_RAW1 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE) /*2340*/
347#define CD_FRAMESIZE_RAW0 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE-CD_HEAD_SIZE) /*2336*/
348
349#define CD_XA_HEAD (CD_HEAD_SIZE+CD_SUBHEAD_SIZE) /* "before data" part of raw XA frame */
350#define CD_XA_TAIL (CD_EDC_SIZE+CD_ECC_SIZE) /* "after data" part of raw XA frame */
351#define CD_XA_SYNC_HEAD (CD_SYNC_SIZE+CD_XA_HEAD) /* sync bytes + header of XA frame */
352
353/* CD-ROM address types (cdrom_tocentry.cdte_format) */
354#define CDROM_LBA 0x01 /* "logical block": first frame is #0 */
355#define CDROM_MSF 0x02 /* "minute-second-frame": binary, not bcd here! */
356
357/* bit to tell whether track is data or audio (cdrom_tocentry.cdte_ctrl) */
358#define CDROM_DATA_TRACK 0x04
359
360/* The leadout track is always 0xAA, regardless of # of tracks on disc */
361#define CDROM_LEADOUT 0xAA
362
363/* audio states (from SCSI-2, but seen with other drives, too) */
364#define CDROM_AUDIO_INVALID 0x00 /* audio status not supported */
365#define CDROM_AUDIO_PLAY 0x11 /* audio play operation in progress */
366#define CDROM_AUDIO_PAUSED 0x12 /* audio play operation paused */
367#define CDROM_AUDIO_COMPLETED 0x13 /* audio play successfully completed */
368#define CDROM_AUDIO_ERROR 0x14 /* audio play stopped due to error */
369#define CDROM_AUDIO_NO_STATUS 0x15 /* no current audio status to return */
370
371/* capability flags used with the uniform CD-ROM driver */
372#define CDC_CLOSE_TRAY 0x1 /* caddy systems _can't_ close */
373#define CDC_OPEN_TRAY 0x2 /* but _can_ eject. */
374#define CDC_LOCK 0x4 /* disable manual eject */
375#define CDC_SELECT_SPEED 0x8 /* programmable speed */
376#define CDC_SELECT_DISC 0x10 /* select disc from juke-box */
377#define CDC_MULTI_SESSION 0x20 /* read sessions>1 */
378#define CDC_MCN 0x40 /* Medium Catalog Number */
379#define CDC_MEDIA_CHANGED 0x80 /* media changed */
380#define CDC_PLAY_AUDIO 0x100 /* audio functions */
381#define CDC_RESET 0x200 /* hard reset device */
382#define CDC_DRIVE_STATUS 0x800 /* driver implements drive status */
383#define CDC_GENERIC_PACKET 0x1000 /* driver implements generic packets */
384#define CDC_CD_R 0x2000 /* drive is a CD-R */
385#define CDC_CD_RW 0x4000 /* drive is a CD-RW */
386#define CDC_DVD 0x8000 /* drive is a DVD */
387#define CDC_DVD_R 0x10000 /* drive can write DVD-R */
388#define CDC_DVD_RAM 0x20000 /* drive can write DVD-RAM */
389#define CDC_MO_DRIVE 0x40000 /* drive is an MO device */
390#define CDC_MRW 0x80000 /* drive can read MRW */
391#define CDC_MRW_W 0x100000 /* drive can write MRW */
392#define CDC_RAM 0x200000 /* ok to open for WRITE */
393
394/* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */
395#define CDS_NO_INFO 0 /* if not implemented */
396#define CDS_NO_DISC 1
397#define CDS_TRAY_OPEN 2
398#define CDS_DRIVE_NOT_READY 3
399#define CDS_DISC_OK 4
400
401/* return values for the CDROM_DISC_STATUS ioctl */
402/* can also return CDS_NO_[INFO|DISC], from above */
403#define CDS_AUDIO 100
404#define CDS_DATA_1 101
405#define CDS_DATA_2 102
406#define CDS_XA_2_1 103
407#define CDS_XA_2_2 104
408#define CDS_MIXED 105
409
410/* User-configurable behavior options for the uniform CD-ROM driver */
411#define CDO_AUTO_CLOSE 0x1 /* close tray on first open() */
412#define CDO_AUTO_EJECT 0x2 /* open tray on last release() */
413#define CDO_USE_FFLAGS 0x4 /* use O_NONBLOCK information on open */
414#define CDO_LOCK 0x8 /* lock tray on open files */
415#define CDO_CHECK_TYPE 0x10 /* check type on open for data */
416
417/* Special codes used when specifying changer slots. */
418#define CDSL_NONE (INT_MAX-1)
419#define CDSL_CURRENT INT_MAX
420
421/* For partition based multisession access. IDE can handle 64 partitions
422 * per drive - SCSI CD-ROM's use minors to differentiate between the
423 * various drives, so we can't do multisessions the same way there.
424 * Use the -o session=x option to mount on them.
425 */
426#define CD_PART_MAX 64
427#define CD_PART_MASK (CD_PART_MAX - 1)
428
429/*********************************************************************
430 * Generic Packet commands, MMC commands, and such
431 *********************************************************************/
432
433 /* The generic packet command opcodes for CD/DVD Logical Units,
434 * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */
435#define GPCMD_BLANK 0xa1
436#define GPCMD_CLOSE_TRACK 0x5b
437#define GPCMD_FLUSH_CACHE 0x35
438#define GPCMD_FORMAT_UNIT 0x04
439#define GPCMD_GET_CONFIGURATION 0x46
440#define GPCMD_GET_EVENT_STATUS_NOTIFICATION 0x4a
441#define GPCMD_GET_PERFORMANCE 0xac
442#define GPCMD_INQUIRY 0x12
443#define GPCMD_LOAD_UNLOAD 0xa6
444#define GPCMD_MECHANISM_STATUS 0xbd
445#define GPCMD_MODE_SELECT_10 0x55
446#define GPCMD_MODE_SENSE_10 0x5a
447#define GPCMD_PAUSE_RESUME 0x4b
448#define GPCMD_PLAY_AUDIO_10 0x45
449#define GPCMD_PLAY_AUDIO_MSF 0x47
450#define GPCMD_PLAY_AUDIO_TI 0x48
451#define GPCMD_PLAY_CD 0xbc
452#define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e
453#define GPCMD_READ_10 0x28
454#define GPCMD_READ_12 0xa8
455#define GPCMD_READ_BUFFER 0x3c
456#define GPCMD_READ_BUFFER_CAPACITY 0x5c
457#define GPCMD_READ_CDVD_CAPACITY 0x25
458#define GPCMD_READ_CD 0xbe
459#define GPCMD_READ_CD_MSF 0xb9
460#define GPCMD_READ_DISC_INFO 0x51
461#define GPCMD_READ_DVD_STRUCTURE 0xad
462#define GPCMD_READ_FORMAT_CAPACITIES 0x23
463#define GPCMD_READ_HEADER 0x44
464#define GPCMD_READ_TRACK_RZONE_INFO 0x52
465#define GPCMD_READ_SUBCHANNEL 0x42
466#define GPCMD_READ_TOC_PMA_ATIP 0x43
467#define GPCMD_REPAIR_RZONE_TRACK 0x58
468#define GPCMD_REPORT_KEY 0xa4
469#define GPCMD_REQUEST_SENSE 0x03
470#define GPCMD_RESERVE_RZONE_TRACK 0x53
471#define GPCMD_SEND_CUE_SHEET 0x5d
472#define GPCMD_SCAN 0xba
473#define GPCMD_SEEK 0x2b
474#define GPCMD_SEND_DVD_STRUCTURE 0xbf
475#define GPCMD_SEND_EVENT 0xa2
476#define GPCMD_SEND_KEY 0xa3
477#define GPCMD_SEND_OPC 0x54
478#define GPCMD_SET_READ_AHEAD 0xa7
479#define GPCMD_SET_STREAMING 0xb6
480#define GPCMD_START_STOP_UNIT 0x1b
481#define GPCMD_STOP_PLAY_SCAN 0x4e
482#define GPCMD_TEST_UNIT_READY 0x00
483#define GPCMD_VERIFY_10 0x2f
484#define GPCMD_WRITE_10 0x2a
485#define GPCMD_WRITE_12 0xaa
486#define GPCMD_WRITE_AND_VERIFY_10 0x2e
487#define GPCMD_WRITE_BUFFER 0x3b
488/* This is listed as optional in ATAPI 2.6, but is (curiously)
489 * missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji
490 * Table 377 as an MMC command for SCSi devices though... Most ATAPI
491 * drives support it. */
492#define GPCMD_SET_SPEED 0xbb
493/* This seems to be a SCSI specific CD-ROM opcode
494 * to play data at track/index */
495#define GPCMD_PLAYAUDIO_TI 0x48
496/*
497 * From MS Media Status Notification Support Specification. For
498 * older drives only.
499 */
500#define GPCMD_GET_MEDIA_STATUS 0xda
501
502/* Mode page codes for mode sense/set */
503#define GPMODE_VENDOR_PAGE 0x00
504#define GPMODE_R_W_ERROR_PAGE 0x01
505#define GPMODE_WRITE_PARMS_PAGE 0x05
506#define GPMODE_WCACHING_PAGE 0x08
507#define GPMODE_AUDIO_CTL_PAGE 0x0e
508#define GPMODE_POWER_PAGE 0x1a
509#define GPMODE_FAULT_FAIL_PAGE 0x1c
510#define GPMODE_TO_PROTECT_PAGE 0x1d
511#define GPMODE_CAPABILITIES_PAGE 0x2a
512#define GPMODE_ALL_PAGES 0x3f
513/* Not in Mt. Fuji, but in ATAPI 2.6 -- deprecated now in favor
514 * of MODE_SENSE_POWER_PAGE */
515#define GPMODE_CDROM_PAGE 0x0d
516
517
518
519/* DVD struct types */
520#define DVD_STRUCT_PHYSICAL 0x00
521#define DVD_STRUCT_COPYRIGHT 0x01
522#define DVD_STRUCT_DISCKEY 0x02
523#define DVD_STRUCT_BCA 0x03
524#define DVD_STRUCT_MANUFACT 0x04
525
526struct dvd_layer {
527 __u8 book_version : 4;
528 __u8 book_type : 4;
529 __u8 min_rate : 4;
530 __u8 disc_size : 4;
531 __u8 layer_type : 4;
532 __u8 track_path : 1;
533 __u8 nlayers : 2;
534 __u8 track_density : 4;
535 __u8 linear_density : 4;
536 __u8 bca : 1;
537 __u32 start_sector;
538 __u32 end_sector;
539 __u32 end_sector_l0;
540};
541
542#define DVD_LAYERS 4
543
544struct dvd_physical {
545 __u8 type;
546 __u8 layer_num;
547 struct dvd_layer layer[DVD_LAYERS];
548};
549
550struct dvd_copyright {
551 __u8 type;
552
553 __u8 layer_num;
554 __u8 cpst;
555 __u8 rmi;
556};
557
558struct dvd_disckey {
559 __u8 type;
560
561 unsigned agid : 2;
562 __u8 value[2048];
563};
564
565struct dvd_bca {
566 __u8 type;
567
568 int len;
569 __u8 value[188];
570};
571
572struct dvd_manufact {
573 __u8 type;
574
575 __u8 layer_num;
576 int len;
577 __u8 value[2048];
578};
579
580typedef union {
581 __u8 type;
582
583 struct dvd_physical physical;
584 struct dvd_copyright copyright;
585 struct dvd_disckey disckey;
586 struct dvd_bca bca;
587 struct dvd_manufact manufact;
588} dvd_struct;
589
590/*
591 * DVD authentication ioctl
592 */
593
594/* Authentication states */
595#define DVD_LU_SEND_AGID 0
596#define DVD_HOST_SEND_CHALLENGE 1
597#define DVD_LU_SEND_KEY1 2
598#define DVD_LU_SEND_CHALLENGE 3
599#define DVD_HOST_SEND_KEY2 4
600
601/* Termination states */
602#define DVD_AUTH_ESTABLISHED 5
603#define DVD_AUTH_FAILURE 6
604
605/* Other functions */
606#define DVD_LU_SEND_TITLE_KEY 7
607#define DVD_LU_SEND_ASF 8
608#define DVD_INVALIDATE_AGID 9
609#define DVD_LU_SEND_RPC_STATE 10
610#define DVD_HOST_SEND_RPC_STATE 11
611
612/* State data */
613typedef __u8 dvd_key[5]; /* 40-bit value, MSB is first elem. */
614typedef __u8 dvd_challenge[10]; /* 80-bit value, MSB is first elem. */
615
616struct dvd_lu_send_agid {
617 __u8 type;
618 unsigned agid : 2;
619};
620
621struct dvd_host_send_challenge {
622 __u8 type;
623 unsigned agid : 2;
624
625 dvd_challenge chal;
626};
627
628struct dvd_send_key {
629 __u8 type;
630 unsigned agid : 2;
631
632 dvd_key key;
633};
634
635struct dvd_lu_send_challenge {
636 __u8 type;
637 unsigned agid : 2;
638
639 dvd_challenge chal;
640};
641
642#define DVD_CPM_NO_COPYRIGHT 0
643#define DVD_CPM_COPYRIGHTED 1
644
645#define DVD_CP_SEC_NONE 0
646#define DVD_CP_SEC_EXIST 1
647
648#define DVD_CGMS_UNRESTRICTED 0
649#define DVD_CGMS_SINGLE 2
650#define DVD_CGMS_RESTRICTED 3
651
652struct dvd_lu_send_title_key {
653 __u8 type;
654 unsigned agid : 2;
655
656 dvd_key title_key;
657 int lba;
658 unsigned cpm : 1;
659 unsigned cp_sec : 1;
660 unsigned cgms : 2;
661};
662
663struct dvd_lu_send_asf {
664 __u8 type;
665 unsigned agid : 2;
666
667 unsigned asf : 1;
668};
669
670struct dvd_host_send_rpcstate {
671 __u8 type;
672 __u8 pdrc;
673};
674
675struct dvd_lu_send_rpcstate {
676 __u8 type : 2;
677 __u8 vra : 3;
678 __u8 ucca : 3;
679 __u8 region_mask;
680 __u8 rpc_scheme;
681};
682
683typedef union {
684 __u8 type;
685
686 struct dvd_lu_send_agid lsa;
687 struct dvd_host_send_challenge hsc;
688 struct dvd_send_key lsk;
689 struct dvd_lu_send_challenge lsc;
690 struct dvd_send_key hsk;
691 struct dvd_lu_send_title_key lstk;
692 struct dvd_lu_send_asf lsasf;
693 struct dvd_host_send_rpcstate hrpcs;
694 struct dvd_lu_send_rpcstate lrpcs;
695} dvd_authinfo;
696
697struct request_sense {
698#if defined(__BIG_ENDIAN_BITFIELD)
699 __u8 valid : 1;
700 __u8 error_code : 7;
701#elif defined(__LITTLE_ENDIAN_BITFIELD)
702 __u8 error_code : 7;
703 __u8 valid : 1;
704#endif
705 __u8 segment_number;
706#if defined(__BIG_ENDIAN_BITFIELD)
707 __u8 reserved1 : 2;
708 __u8 ili : 1;
709 __u8 reserved2 : 1;
710 __u8 sense_key : 4;
711#elif defined(__LITTLE_ENDIAN_BITFIELD)
712 __u8 sense_key : 4;
713 __u8 reserved2 : 1;
714 __u8 ili : 1;
715 __u8 reserved1 : 2;
716#endif
717 __u8 information[4];
718 __u8 add_sense_len;
719 __u8 command_info[4];
720 __u8 asc;
721 __u8 ascq;
722 __u8 fruc;
723 __u8 sks[3];
724 __u8 asb[46];
725};
726
727/*
728 * feature profile
729 */
730#define CDF_RWRT 0x0020 /* "Random Writable" */
731#define CDF_HWDM 0x0024 /* "Hardware Defect Management" */
732#define CDF_MRW 0x0028
733
734/*
735 * media status bits
736 */
737#define CDM_MRW_NOTMRW 0
738#define CDM_MRW_BGFORMAT_INACTIVE 1
739#define CDM_MRW_BGFORMAT_ACTIVE 2
740#define CDM_MRW_BGFORMAT_COMPLETE 3
741
742/*
743 * mrw address spaces
744 */
745#define MRW_LBA_DMA 0
746#define MRW_LBA_GAA 1
747
748/*
749 * mrw mode pages (first is deprecated) -- probed at init time and
750 * cdi->mrw_mode_page is set
751 */
752#define MRW_MODE_PC_PRE1 0x2c
753#define MRW_MODE_PC 0x03
754
755struct mrw_feature_desc {
756 __be16 feature_code;
757#if defined(__BIG_ENDIAN_BITFIELD)
758 __u8 reserved1 : 2;
759 __u8 feature_version : 4;
760 __u8 persistent : 1;
761 __u8 curr : 1;
762#elif defined(__LITTLE_ENDIAN_BITFIELD)
763 __u8 curr : 1;
764 __u8 persistent : 1;
765 __u8 feature_version : 4;
766 __u8 reserved1 : 2;
767#endif
768 __u8 add_len;
769#if defined(__BIG_ENDIAN_BITFIELD)
770 __u8 reserved2 : 7;
771 __u8 write : 1;
772#elif defined(__LITTLE_ENDIAN_BITFIELD)
773 __u8 write : 1;
774 __u8 reserved2 : 7;
775#endif
776 __u8 reserved3;
777 __u8 reserved4;
778 __u8 reserved5;
779};
780
781/* cf. mmc4r02g.pdf 5.3.10 Random Writable Feature (0020h) pg 197 of 635 */
782struct rwrt_feature_desc {
783 __be16 feature_code;
784#if defined(__BIG_ENDIAN_BITFIELD)
785 __u8 reserved1 : 2;
786 __u8 feature_version : 4;
787 __u8 persistent : 1;
788 __u8 curr : 1;
789#elif defined(__LITTLE_ENDIAN_BITFIELD)
790 __u8 curr : 1;
791 __u8 persistent : 1;
792 __u8 feature_version : 4;
793 __u8 reserved1 : 2;
794#endif
795 __u8 add_len;
796 __u32 last_lba;
797 __u32 block_size;
798 __u16 blocking;
799#if defined(__BIG_ENDIAN_BITFIELD)
800 __u8 reserved2 : 7;
801 __u8 page_present : 1;
802#elif defined(__LITTLE_ENDIAN_BITFIELD)
803 __u8 page_present : 1;
804 __u8 reserved2 : 7;
805#endif
806 __u8 reserved3;
807};
808
809typedef struct {
810 __be16 disc_information_length;
811#if defined(__BIG_ENDIAN_BITFIELD)
812 __u8 reserved1 : 3;
813 __u8 erasable : 1;
814 __u8 border_status : 2;
815 __u8 disc_status : 2;
816#elif defined(__LITTLE_ENDIAN_BITFIELD)
817 __u8 disc_status : 2;
818 __u8 border_status : 2;
819 __u8 erasable : 1;
820 __u8 reserved1 : 3;
821#else
822#error "Please fix <asm/byteorder.h>"
823#endif
824 __u8 n_first_track;
825 __u8 n_sessions_lsb;
826 __u8 first_track_lsb;
827 __u8 last_track_lsb;
828#if defined(__BIG_ENDIAN_BITFIELD)
829 __u8 did_v : 1;
830 __u8 dbc_v : 1;
831 __u8 uru : 1;
832 __u8 reserved2 : 2;
833 __u8 dbit : 1;
834 __u8 mrw_status : 2;
835#elif defined(__LITTLE_ENDIAN_BITFIELD)
836 __u8 mrw_status : 2;
837 __u8 dbit : 1;
838 __u8 reserved2 : 2;
839 __u8 uru : 1;
840 __u8 dbc_v : 1;
841 __u8 did_v : 1;
842#endif
843 __u8 disc_type;
844 __u8 n_sessions_msb;
845 __u8 first_track_msb;
846 __u8 last_track_msb;
847 __u32 disc_id;
848 __u32 lead_in;
849 __u32 lead_out;
850 __u8 disc_bar_code[8];
851 __u8 reserved3;
852 __u8 n_opc;
853} disc_information;
854
855typedef struct {
856 __be16 track_information_length;
857 __u8 track_lsb;
858 __u8 session_lsb;
859 __u8 reserved1;
860#if defined(__BIG_ENDIAN_BITFIELD)
861 __u8 reserved2 : 2;
862 __u8 damage : 1;
863 __u8 copy : 1;
864 __u8 track_mode : 4;
865 __u8 rt : 1;
866 __u8 blank : 1;
867 __u8 packet : 1;
868 __u8 fp : 1;
869 __u8 data_mode : 4;
870 __u8 reserved3 : 6;
871 __u8 lra_v : 1;
872 __u8 nwa_v : 1;
873#elif defined(__LITTLE_ENDIAN_BITFIELD)
874 __u8 track_mode : 4;
875 __u8 copy : 1;
876 __u8 damage : 1;
877 __u8 reserved2 : 2;
878 __u8 data_mode : 4;
879 __u8 fp : 1;
880 __u8 packet : 1;
881 __u8 blank : 1;
882 __u8 rt : 1;
883 __u8 nwa_v : 1;
884 __u8 lra_v : 1;
885 __u8 reserved3 : 6;
886#endif
887 __be32 track_start;
888 __be32 next_writable;
889 __be32 free_blocks;
890 __be32 fixed_packet_size;
891 __be32 track_size;
892 __be32 last_rec_address;
893} track_information;
894
895struct feature_header {
896 __u32 data_len;
897 __u8 reserved1;
898 __u8 reserved2;
899 __u16 curr_profile;
900};
901
902struct mode_page_header {
903 __be16 mode_data_length;
904 __u8 medium_type;
905 __u8 reserved1;
906 __u8 reserved2;
907 __u8 reserved3;
908 __be16 desc_length;
909};
910
911#ifdef __KERNEL__
912#include <linux/fs.h> /* not really needed, later.. */ 13#include <linux/fs.h> /* not really needed, later.. */
913#include <linux/list.h> 14#include <linux/list.h>
15#include <uapi/linux/cdrom.h>
914 16
915struct packet_command 17struct packet_command
916{ 18{
@@ -1209,6 +311,4 @@ static inline int msf_to_lba(u8 m, u8 s, u8 f)
1209{ 311{
1210 return (((m * CD_SECS) + s) * CD_FRAMES + f) - CD_MSF_OFFSET; 312 return (((m * CD_SECS) + s) * CD_FRAMES + f) - CD_MSF_OFFSET;
1211} 313}
1212#endif /* End of kernel only stuff */
1213
1214#endif /* _LINUX_CDROM_H */ 314#endif /* _LINUX_CDROM_H */
diff --git a/include/linux/ceph/mon_client.h b/include/linux/ceph/mon_client.h
index 1fb93e9080b0..a486f390dfbe 100644
--- a/include/linux/ceph/mon_client.h
+++ b/include/linux/ceph/mon_client.h
@@ -71,7 +71,6 @@ struct ceph_mon_client {
71 int cur_mon; /* last monitor i contacted */ 71 int cur_mon; /* last monitor i contacted */
72 unsigned long sub_sent, sub_renew_after; 72 unsigned long sub_sent, sub_renew_after;
73 struct ceph_connection con; 73 struct ceph_connection con;
74 bool have_fsid;
75 74
76 /* pending generic requests */ 75 /* pending generic requests */
77 struct rb_root generic_request_tree; 76 struct rb_root generic_request_tree;
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
index cedfb1a8434a..d9b880e977e6 100644
--- a/include/linux/ceph/osd_client.h
+++ b/include/linux/ceph/osd_client.h
@@ -207,7 +207,7 @@ extern void ceph_osdc_handle_reply(struct ceph_osd_client *osdc,
207extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc, 207extern void ceph_osdc_handle_map(struct ceph_osd_client *osdc,
208 struct ceph_msg *msg); 208 struct ceph_msg *msg);
209 209
210extern void ceph_calc_raw_layout(struct ceph_osd_client *osdc, 210extern int ceph_calc_raw_layout(struct ceph_osd_client *osdc,
211 struct ceph_file_layout *layout, 211 struct ceph_file_layout *layout,
212 u64 snapid, 212 u64 snapid,
213 u64 off, u64 *plen, u64 *bno, 213 u64 off, u64 *plen, u64 *bno,
diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index 25b930bffea6..e37acbe989a9 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -109,9 +109,9 @@ extern struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
109extern void ceph_osdmap_destroy(struct ceph_osdmap *map); 109extern void ceph_osdmap_destroy(struct ceph_osdmap *map);
110 110
111/* calculate mapping of a file extent to an object */ 111/* calculate mapping of a file extent to an object */
112extern void ceph_calc_file_object_mapping(struct ceph_file_layout *layout, 112extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
113 u64 off, u64 *plen, 113 u64 off, u64 *plen,
114 u64 *bno, u64 *oxoff, u64 *oxlen); 114 u64 *bno, u64 *oxoff, u64 *oxlen);
115 115
116/* calculate mapping of object to a placement group */ 116/* calculate mapping of object to a placement group */
117extern int ceph_calc_object_layout(struct ceph_object_layout *ol, 117extern int ceph_calc_object_layout(struct ceph_object_layout *ol,
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index fbe89e17124e..4dceaf8ae152 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -319,22 +319,6 @@ static inline void __clocksource_updatefreq_khz(struct clocksource *cs, u32 khz)
319 __clocksource_updatefreq_scale(cs, 1000, khz); 319 __clocksource_updatefreq_scale(cs, 1000, khz);
320} 320}
321 321
322#ifdef CONFIG_GENERIC_TIME_VSYSCALL
323extern void
324update_vsyscall(struct timespec *ts, struct timespec *wtm,
325 struct clocksource *c, u32 mult);
326extern void update_vsyscall_tz(void);
327#else
328static inline void
329update_vsyscall(struct timespec *ts, struct timespec *wtm,
330 struct clocksource *c, u32 mult)
331{
332}
333
334static inline void update_vsyscall_tz(void)
335{
336}
337#endif
338 322
339extern void timekeeping_notify(struct clocksource *clock); 323extern void timekeeping_notify(struct clocksource *clock);
340 324
diff --git a/include/linux/cm4000_cs.h b/include/linux/cm4000_cs.h
index 3c4aac406175..88bee3a33090 100644
--- a/include/linux/cm4000_cs.h
+++ b/include/linux/cm4000_cs.h
@@ -1,68 +1,10 @@
1#ifndef _CM4000_H_ 1#ifndef _CM4000_H_
2#define _CM4000_H_ 2#define _CM4000_H_
3 3
4#include <linux/types.h> 4#include <uapi/linux/cm4000_cs.h>
5 5
6#define MAX_ATR 33
7
8#define CM4000_MAX_DEV 4
9
10/* those two structures are passed via ioctl() from/to userspace. They are
11 * used by existing userspace programs, so I kepth the awkward "bIFSD" naming
12 * not to break compilation of userspace apps. -HW */
13
14typedef struct atreq {
15 __s32 atr_len;
16 unsigned char atr[64];
17 __s32 power_act;
18 unsigned char bIFSD;
19 unsigned char bIFSC;
20} atreq_t;
21
22
23/* what is particularly stupid in the original driver is the arch-dependent
24 * member sizes. This leads to CONFIG_COMPAT breakage, since 32bit userspace
25 * will lay out the structure members differently than the 64bit kernel.
26 *
27 * I've changed "ptsreq.protocol" from "unsigned long" to "__u32".
28 * On 32bit this will make no difference. With 64bit kernels, it will make
29 * 32bit apps work, too.
30 */
31
32typedef struct ptsreq {
33 __u32 protocol; /*T=0: 2^0, T=1: 2^1*/
34 unsigned char flags;
35 unsigned char pts1;
36 unsigned char pts2;
37 unsigned char pts3;
38} ptsreq_t;
39
40#define CM_IOC_MAGIC 'c'
41#define CM_IOC_MAXNR 255
42
43#define CM_IOCGSTATUS _IOR (CM_IOC_MAGIC, 0, unsigned char *)
44#define CM_IOCGATR _IOWR(CM_IOC_MAGIC, 1, atreq_t *)
45#define CM_IOCSPTS _IOW (CM_IOC_MAGIC, 2, ptsreq_t *)
46#define CM_IOCSRDR _IO (CM_IOC_MAGIC, 3)
47#define CM_IOCARDOFF _IO (CM_IOC_MAGIC, 4)
48
49#define CM_IOSDBGLVL _IOW(CM_IOC_MAGIC, 250, int*)
50
51/* card and device states */
52#define CM_CARD_INSERTED 0x01
53#define CM_CARD_POWERED 0x02
54#define CM_ATR_PRESENT 0x04
55#define CM_ATR_VALID 0x08
56#define CM_STATE_VALID 0x0f
57/* extra info only from CM4000 */
58#define CM_NO_READER 0x10
59#define CM_BAD_CARD 0x20
60
61
62#ifdef __KERNEL__
63 6
64#define DEVICE_NAME "cmm" 7#define DEVICE_NAME "cmm"
65#define MODULE_NAME "cm4000_cs" 8#define MODULE_NAME "cm4000_cs"
66 9
67#endif /* __KERNEL__ */
68#endif /* _CM4000_H_ */ 10#endif /* _CM4000_H_ */
diff --git a/include/linux/cn_proc.h b/include/linux/cn_proc.h
index d03612b196e1..2c1bc1ea04ee 100644
--- a/include/linux/cn_proc.h
+++ b/include/linux/cn_proc.h
@@ -14,111 +14,11 @@
14 * WITHOUT ANY WARRANTY; without even the implied warranty of 14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 */ 16 */
17
18#ifndef CN_PROC_H 17#ifndef CN_PROC_H
19#define CN_PROC_H 18#define CN_PROC_H
20 19
21#include <linux/types.h> 20#include <uapi/linux/cn_proc.h>
22
23/*
24 * Userspace sends this enum to register with the kernel that it is listening
25 * for events on the connector.
26 */
27enum proc_cn_mcast_op {
28 PROC_CN_MCAST_LISTEN = 1,
29 PROC_CN_MCAST_IGNORE = 2
30};
31
32/*
33 * From the user's point of view, the process
34 * ID is the thread group ID and thread ID is the internal
35 * kernel "pid". So, fields are assigned as follow:
36 *
37 * In user space - In kernel space
38 *
39 * parent process ID = parent->tgid
40 * parent thread ID = parent->pid
41 * child process ID = child->tgid
42 * child thread ID = child->pid
43 */
44
45struct proc_event {
46 enum what {
47 /* Use successive bits so the enums can be used to record
48 * sets of events as well
49 */
50 PROC_EVENT_NONE = 0x00000000,
51 PROC_EVENT_FORK = 0x00000001,
52 PROC_EVENT_EXEC = 0x00000002,
53 PROC_EVENT_UID = 0x00000004,
54 PROC_EVENT_GID = 0x00000040,
55 PROC_EVENT_SID = 0x00000080,
56 PROC_EVENT_PTRACE = 0x00000100,
57 PROC_EVENT_COMM = 0x00000200,
58 /* "next" should be 0x00000400 */
59 /* "last" is the last process event: exit */
60 PROC_EVENT_EXIT = 0x80000000
61 } what;
62 __u32 cpu;
63 __u64 __attribute__((aligned(8))) timestamp_ns;
64 /* Number of nano seconds since system boot */
65 union { /* must be last field of proc_event struct */
66 struct {
67 __u32 err;
68 } ack;
69
70 struct fork_proc_event {
71 __kernel_pid_t parent_pid;
72 __kernel_pid_t parent_tgid;
73 __kernel_pid_t child_pid;
74 __kernel_pid_t child_tgid;
75 } fork;
76
77 struct exec_proc_event {
78 __kernel_pid_t process_pid;
79 __kernel_pid_t process_tgid;
80 } exec;
81
82 struct id_proc_event {
83 __kernel_pid_t process_pid;
84 __kernel_pid_t process_tgid;
85 union {
86 __u32 ruid; /* task uid */
87 __u32 rgid; /* task gid */
88 } r;
89 union {
90 __u32 euid;
91 __u32 egid;
92 } e;
93 } id;
94
95 struct sid_proc_event {
96 __kernel_pid_t process_pid;
97 __kernel_pid_t process_tgid;
98 } sid;
99
100 struct ptrace_proc_event {
101 __kernel_pid_t process_pid;
102 __kernel_pid_t process_tgid;
103 __kernel_pid_t tracer_pid;
104 __kernel_pid_t tracer_tgid;
105 } ptrace;
106
107 struct comm_proc_event {
108 __kernel_pid_t process_pid;
109 __kernel_pid_t process_tgid;
110 char comm[16];
111 } comm;
112
113 struct exit_proc_event {
114 __kernel_pid_t process_pid;
115 __kernel_pid_t process_tgid;
116 __u32 exit_code, exit_signal;
117 } exit;
118 } event_data;
119};
120 21
121#ifdef __KERNEL__
122#ifdef CONFIG_PROC_EVENTS 22#ifdef CONFIG_PROC_EVENTS
123void proc_fork_connector(struct task_struct *task); 23void proc_fork_connector(struct task_struct *task);
124void proc_exec_connector(struct task_struct *task); 24void proc_exec_connector(struct task_struct *task);
@@ -151,5 +51,4 @@ static inline void proc_ptrace_connector(struct task_struct *task,
151static inline void proc_exit_connector(struct task_struct *task) 51static inline void proc_exit_connector(struct task_struct *task)
152{} 52{}
153#endif /* CONFIG_PROC_EVENTS */ 53#endif /* CONFIG_PROC_EVENTS */
154#endif /* __KERNEL__ */
155#endif /* CN_PROC_H */ 54#endif /* CN_PROC_H */
diff --git a/include/linux/coda.h b/include/linux/coda.h
index 96c87693800b..cff544f81105 100644
--- a/include/linux/coda.h
+++ b/include/linux/coda.h
@@ -55,690 +55,12 @@ Mellon the rights to redistribute these changes without encumbrance.
55 * Linux modifications by 55 * Linux modifications by
56 * Peter Braam, Aug 1996 56 * Peter Braam, Aug 1996
57 */ 57 */
58
59#ifndef _CODA_HEADER_ 58#ifndef _CODA_HEADER_
60#define _CODA_HEADER_ 59#define _CODA_HEADER_
61 60
62
63/* Catch new _KERNEL defn for NetBSD and DJGPP/__CYGWIN32__ */
64#if defined(__NetBSD__) || \
65 ((defined(DJGPP) || defined(__CYGWIN32__)) && !defined(KERNEL))
66#include <sys/types.h>
67#endif
68
69#ifndef CODA_MAXSYMLINKS
70#define CODA_MAXSYMLINKS 10
71#endif
72
73#if defined(DJGPP) || defined(__CYGWIN32__)
74#ifdef KERNEL
75typedef unsigned long u_long;
76typedef unsigned int u_int;
77typedef unsigned short u_short;
78typedef u_long ino_t;
79typedef u_long dev_t;
80typedef void * caddr_t;
81#ifdef DOS
82typedef unsigned __int64 u_quad_t;
83#else
84typedef unsigned long long u_quad_t;
85#endif
86
87#define inline
88
89struct timespec {
90 long ts_sec;
91 long ts_nsec;
92};
93#else /* DJGPP but not KERNEL */
94#include <sys/time.h>
95typedef unsigned long long u_quad_t;
96#endif /* !KERNEL */
97#endif /* !DJGPP */
98
99
100#if defined(__linux__) 61#if defined(__linux__)
101#include <linux/time.h>
102#define cdev_t u_quad_t
103#ifndef __KERNEL__
104#if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2)
105#define _UQUAD_T_ 1
106typedef unsigned long long u_quad_t; 62typedef unsigned long long u_quad_t;
107#endif
108#else /*__KERNEL__ */
109typedef unsigned long long u_quad_t;
110#endif /* __KERNEL__ */
111#else 63#else
112#define cdev_t dev_t
113#endif
114
115#ifdef __CYGWIN32__
116struct timespec {
117 time_t tv_sec; /* seconds */
118 long tv_nsec; /* nanoseconds */
119};
120#endif
121
122#ifndef __BIT_TYPES_DEFINED__
123#define __BIT_TYPES_DEFINED__
124typedef signed char int8_t;
125typedef unsigned char u_int8_t;
126typedef short int16_t;
127typedef unsigned short u_int16_t;
128typedef int int32_t;
129typedef unsigned int u_int32_t;
130#endif
131
132
133/*
134 * Cfs constants
135 */
136#define CODA_MAXNAMLEN 255
137#define CODA_MAXPATHLEN 1024
138#define CODA_MAXSYMLINK 10
139
140/* these are Coda's version of O_RDONLY etc combinations
141 * to deal with VFS open modes
142 */
143#define C_O_READ 0x001
144#define C_O_WRITE 0x002
145#define C_O_TRUNC 0x010
146#define C_O_EXCL 0x100
147#define C_O_CREAT 0x200
148
149/* these are to find mode bits in Venus */
150#define C_M_READ 00400
151#define C_M_WRITE 00200
152
153/* for access Venus will use */
154#define C_A_C_OK 8 /* Test for writing upon create. */
155#define C_A_R_OK 4 /* Test for read permission. */
156#define C_A_W_OK 2 /* Test for write permission. */
157#define C_A_X_OK 1 /* Test for execute permission. */
158#define C_A_F_OK 0 /* Test for existence. */
159
160
161
162#ifndef _VENUS_DIRENT_T_
163#define _VENUS_DIRENT_T_ 1
164struct venus_dirent {
165 u_int32_t d_fileno; /* file number of entry */
166 u_int16_t d_reclen; /* length of this record */
167 u_int8_t d_type; /* file type, see below */
168 u_int8_t d_namlen; /* length of string in d_name */
169 char d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */
170};
171#undef DIRSIZ
172#define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \
173 (((dp)->d_namlen+1 + 3) &~ 3))
174
175/*
176 * File types
177 */
178#define CDT_UNKNOWN 0
179#define CDT_FIFO 1
180#define CDT_CHR 2
181#define CDT_DIR 4
182#define CDT_BLK 6
183#define CDT_REG 8
184#define CDT_LNK 10
185#define CDT_SOCK 12
186#define CDT_WHT 14
187
188/*
189 * Convert between stat structure types and directory types.
190 */
191#define IFTOCDT(mode) (((mode) & 0170000) >> 12)
192#define CDTTOIF(dirtype) ((dirtype) << 12)
193
194#endif 64#endif
195 65#include <uapi/linux/coda.h>
196#ifndef _VUID_T_
197#define _VUID_T_
198typedef u_int32_t vuid_t;
199typedef u_int32_t vgid_t;
200#endif /*_VUID_T_ */
201
202struct CodaFid {
203 u_int32_t opaque[4];
204};
205
206#define coda_f2i(fid)\
207 (fid ? (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]) : 0)
208
209#ifndef _VENUS_VATTR_T_
210#define _VENUS_VATTR_T_
211/*
212 * Vnode types. VNON means no type.
213 */
214enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD };
215
216struct coda_vattr {
217 long va_type; /* vnode type (for create) */
218 u_short va_mode; /* files access mode and type */
219 short va_nlink; /* number of references to file */
220 vuid_t va_uid; /* owner user id */
221 vgid_t va_gid; /* owner group id */
222 long va_fileid; /* file id */
223 u_quad_t va_size; /* file size in bytes */
224 long va_blocksize; /* blocksize preferred for i/o */
225 struct timespec va_atime; /* time of last access */
226 struct timespec va_mtime; /* time of last modification */
227 struct timespec va_ctime; /* time file changed */
228 u_long va_gen; /* generation number of file */
229 u_long va_flags; /* flags defined for file */
230 cdev_t va_rdev; /* device special file represents */
231 u_quad_t va_bytes; /* bytes of disk space held by file */
232 u_quad_t va_filerev; /* file modification number */
233};
234
235#endif 66#endif
236
237/* structure used by CODA_STATFS for getting cache information from venus */
238struct coda_statfs {
239 int32_t f_blocks;
240 int32_t f_bfree;
241 int32_t f_bavail;
242 int32_t f_files;
243 int32_t f_ffree;
244};
245
246/*
247 * Kernel <--> Venus communications.
248 */
249
250#define CODA_ROOT 2
251#define CODA_OPEN_BY_FD 3
252#define CODA_OPEN 4
253#define CODA_CLOSE 5
254#define CODA_IOCTL 6
255#define CODA_GETATTR 7
256#define CODA_SETATTR 8
257#define CODA_ACCESS 9
258#define CODA_LOOKUP 10
259#define CODA_CREATE 11
260#define CODA_REMOVE 12
261#define CODA_LINK 13
262#define CODA_RENAME 14
263#define CODA_MKDIR 15
264#define CODA_RMDIR 16
265#define CODA_SYMLINK 18
266#define CODA_READLINK 19
267#define CODA_FSYNC 20
268#define CODA_VGET 22
269#define CODA_SIGNAL 23
270#define CODA_REPLACE 24 /* DOWNCALL */
271#define CODA_FLUSH 25 /* DOWNCALL */
272#define CODA_PURGEUSER 26 /* DOWNCALL */
273#define CODA_ZAPFILE 27 /* DOWNCALL */
274#define CODA_ZAPDIR 28 /* DOWNCALL */
275#define CODA_PURGEFID 30 /* DOWNCALL */
276#define CODA_OPEN_BY_PATH 31
277#define CODA_RESOLVE 32
278#define CODA_REINTEGRATE 33
279#define CODA_STATFS 34
280#define CODA_STORE 35
281#define CODA_RELEASE 36
282#define CODA_NCALLS 37
283
284#define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID)
285
286#define VC_MAXDATASIZE 8192
287#define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\
288 VC_MAXDATASIZE
289
290#define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t)
291
292#define CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */
293
294/*
295 * Venus <-> Coda RPC arguments
296 */
297struct coda_in_hdr {
298 u_int32_t opcode;
299 u_int32_t unique; /* Keep multiple outstanding msgs distinct */
300 pid_t pid;
301 pid_t pgid;
302 vuid_t uid;
303};
304
305/* Really important that opcode and unique are 1st two fields! */
306struct coda_out_hdr {
307 u_int32_t opcode;
308 u_int32_t unique;
309 u_int32_t result;
310};
311
312/* coda_root: NO_IN */
313struct coda_root_out {
314 struct coda_out_hdr oh;
315 struct CodaFid VFid;
316};
317
318struct coda_root_in {
319 struct coda_in_hdr in;
320};
321
322/* coda_open: */
323struct coda_open_in {
324 struct coda_in_hdr ih;
325 struct CodaFid VFid;
326 int flags;
327};
328
329struct coda_open_out {
330 struct coda_out_hdr oh;
331 cdev_t dev;
332 ino_t inode;
333};
334
335
336/* coda_store: */
337struct coda_store_in {
338 struct coda_in_hdr ih;
339 struct CodaFid VFid;
340 int flags;
341};
342
343struct coda_store_out {
344 struct coda_out_hdr out;
345};
346
347/* coda_release: */
348struct coda_release_in {
349 struct coda_in_hdr ih;
350 struct CodaFid VFid;
351 int flags;
352};
353
354struct coda_release_out {
355 struct coda_out_hdr out;
356};
357
358/* coda_close: */
359struct coda_close_in {
360 struct coda_in_hdr ih;
361 struct CodaFid VFid;
362 int flags;
363};
364
365struct coda_close_out {
366 struct coda_out_hdr out;
367};
368
369/* coda_ioctl: */
370struct coda_ioctl_in {
371 struct coda_in_hdr ih;
372 struct CodaFid VFid;
373 int cmd;
374 int len;
375 int rwflag;
376 char *data; /* Place holder for data. */
377};
378
379struct coda_ioctl_out {
380 struct coda_out_hdr oh;
381 int len;
382 caddr_t data; /* Place holder for data. */
383};
384
385
386/* coda_getattr: */
387struct coda_getattr_in {
388 struct coda_in_hdr ih;
389 struct CodaFid VFid;
390};
391
392struct coda_getattr_out {
393 struct coda_out_hdr oh;
394 struct coda_vattr attr;
395};
396
397
398/* coda_setattr: NO_OUT */
399struct coda_setattr_in {
400 struct coda_in_hdr ih;
401 struct CodaFid VFid;
402 struct coda_vattr attr;
403};
404
405struct coda_setattr_out {
406 struct coda_out_hdr out;
407};
408
409/* coda_access: NO_OUT */
410struct coda_access_in {
411 struct coda_in_hdr ih;
412 struct CodaFid VFid;
413 int flags;
414};
415
416struct coda_access_out {
417 struct coda_out_hdr out;
418};
419
420
421/* lookup flags */
422#define CLU_CASE_SENSITIVE 0x01
423#define CLU_CASE_INSENSITIVE 0x02
424
425/* coda_lookup: */
426struct coda_lookup_in {
427 struct coda_in_hdr ih;
428 struct CodaFid VFid;
429 int name; /* Place holder for data. */
430 int flags;
431};
432
433struct coda_lookup_out {
434 struct coda_out_hdr oh;
435 struct CodaFid VFid;
436 int vtype;
437};
438
439
440/* coda_create: */
441struct coda_create_in {
442 struct coda_in_hdr ih;
443 struct CodaFid VFid;
444 struct coda_vattr attr;
445 int excl;
446 int mode;
447 int name; /* Place holder for data. */
448};
449
450struct coda_create_out {
451 struct coda_out_hdr oh;
452 struct CodaFid VFid;
453 struct coda_vattr attr;
454};
455
456
457/* coda_remove: NO_OUT */
458struct coda_remove_in {
459 struct coda_in_hdr ih;
460 struct CodaFid VFid;
461 int name; /* Place holder for data. */
462};
463
464struct coda_remove_out {
465 struct coda_out_hdr out;
466};
467
468/* coda_link: NO_OUT */
469struct coda_link_in {
470 struct coda_in_hdr ih;
471 struct CodaFid sourceFid; /* cnode to link *to* */
472 struct CodaFid destFid; /* Directory in which to place link */
473 int tname; /* Place holder for data. */
474};
475
476struct coda_link_out {
477 struct coda_out_hdr out;
478};
479
480
481/* coda_rename: NO_OUT */
482struct coda_rename_in {
483 struct coda_in_hdr ih;
484 struct CodaFid sourceFid;
485 int srcname;
486 struct CodaFid destFid;
487 int destname;
488};
489
490struct coda_rename_out {
491 struct coda_out_hdr out;
492};
493
494/* coda_mkdir: */
495struct coda_mkdir_in {
496 struct coda_in_hdr ih;
497 struct CodaFid VFid;
498 struct coda_vattr attr;
499 int name; /* Place holder for data. */
500};
501
502struct coda_mkdir_out {
503 struct coda_out_hdr oh;
504 struct CodaFid VFid;
505 struct coda_vattr attr;
506};
507
508
509/* coda_rmdir: NO_OUT */
510struct coda_rmdir_in {
511 struct coda_in_hdr ih;
512 struct CodaFid VFid;
513 int name; /* Place holder for data. */
514};
515
516struct coda_rmdir_out {
517 struct coda_out_hdr out;
518};
519
520/* coda_symlink: NO_OUT */
521struct coda_symlink_in {
522 struct coda_in_hdr ih;
523 struct CodaFid VFid; /* Directory to put symlink in */
524 int srcname;
525 struct coda_vattr attr;
526 int tname;
527};
528
529struct coda_symlink_out {
530 struct coda_out_hdr out;
531};
532
533/* coda_readlink: */
534struct coda_readlink_in {
535 struct coda_in_hdr ih;
536 struct CodaFid VFid;
537};
538
539struct coda_readlink_out {
540 struct coda_out_hdr oh;
541 int count;
542 caddr_t data; /* Place holder for data. */
543};
544
545
546/* coda_fsync: NO_OUT */
547struct coda_fsync_in {
548 struct coda_in_hdr ih;
549 struct CodaFid VFid;
550};
551
552struct coda_fsync_out {
553 struct coda_out_hdr out;
554};
555
556/* coda_vget: */
557struct coda_vget_in {
558 struct coda_in_hdr ih;
559 struct CodaFid VFid;
560};
561
562struct coda_vget_out {
563 struct coda_out_hdr oh;
564 struct CodaFid VFid;
565 int vtype;
566};
567
568
569/* CODA_SIGNAL is out-of-band, doesn't need data. */
570/* CODA_INVALIDATE is a venus->kernel call */
571/* CODA_FLUSH is a venus->kernel call */
572
573/* coda_purgeuser: */
574/* CODA_PURGEUSER is a venus->kernel call */
575struct coda_purgeuser_out {
576 struct coda_out_hdr oh;
577 vuid_t uid;
578};
579
580/* coda_zapfile: */
581/* CODA_ZAPFILE is a venus->kernel call */
582struct coda_zapfile_out {
583 struct coda_out_hdr oh;
584 struct CodaFid CodaFid;
585};
586
587/* coda_zapdir: */
588/* CODA_ZAPDIR is a venus->kernel call */
589struct coda_zapdir_out {
590 struct coda_out_hdr oh;
591 struct CodaFid CodaFid;
592};
593
594/* coda_purgefid: */
595/* CODA_PURGEFID is a venus->kernel call */
596struct coda_purgefid_out {
597 struct coda_out_hdr oh;
598 struct CodaFid CodaFid;
599};
600
601/* coda_replace: */
602/* CODA_REPLACE is a venus->kernel call */
603struct coda_replace_out { /* coda_replace is a venus->kernel call */
604 struct coda_out_hdr oh;
605 struct CodaFid NewFid;
606 struct CodaFid OldFid;
607};
608
609/* coda_open_by_fd: */
610struct coda_open_by_fd_in {
611 struct coda_in_hdr ih;
612 struct CodaFid VFid;
613 int flags;
614};
615
616struct coda_open_by_fd_out {
617 struct coda_out_hdr oh;
618 int fd;
619
620#ifdef __KERNEL__
621 struct file *fh; /* not passed from userspace but used in-kernel only */
622#endif
623};
624
625/* coda_open_by_path: */
626struct coda_open_by_path_in {
627 struct coda_in_hdr ih;
628 struct CodaFid VFid;
629 int flags;
630};
631
632struct coda_open_by_path_out {
633 struct coda_out_hdr oh;
634 int path;
635};
636
637/* coda_statfs: NO_IN */
638struct coda_statfs_in {
639 struct coda_in_hdr in;
640};
641
642struct coda_statfs_out {
643 struct coda_out_hdr oh;
644 struct coda_statfs stat;
645};
646
647/*
648 * Occasionally, we don't cache the fid returned by CODA_LOOKUP.
649 * For instance, if the fid is inconsistent.
650 * This case is handled by setting the top bit of the type result parameter.
651 */
652#define CODA_NOCACHE 0x80000000
653
654union inputArgs {
655 struct coda_in_hdr ih; /* NB: every struct below begins with an ih */
656 struct coda_open_in coda_open;
657 struct coda_store_in coda_store;
658 struct coda_release_in coda_release;
659 struct coda_close_in coda_close;
660 struct coda_ioctl_in coda_ioctl;
661 struct coda_getattr_in coda_getattr;
662 struct coda_setattr_in coda_setattr;
663 struct coda_access_in coda_access;
664 struct coda_lookup_in coda_lookup;
665 struct coda_create_in coda_create;
666 struct coda_remove_in coda_remove;
667 struct coda_link_in coda_link;
668 struct coda_rename_in coda_rename;
669 struct coda_mkdir_in coda_mkdir;
670 struct coda_rmdir_in coda_rmdir;
671 struct coda_symlink_in coda_symlink;
672 struct coda_readlink_in coda_readlink;
673 struct coda_fsync_in coda_fsync;
674 struct coda_vget_in coda_vget;
675 struct coda_open_by_fd_in coda_open_by_fd;
676 struct coda_open_by_path_in coda_open_by_path;
677 struct coda_statfs_in coda_statfs;
678};
679
680union outputArgs {
681 struct coda_out_hdr oh; /* NB: every struct below begins with an oh */
682 struct coda_root_out coda_root;
683 struct coda_open_out coda_open;
684 struct coda_ioctl_out coda_ioctl;
685 struct coda_getattr_out coda_getattr;
686 struct coda_lookup_out coda_lookup;
687 struct coda_create_out coda_create;
688 struct coda_mkdir_out coda_mkdir;
689 struct coda_readlink_out coda_readlink;
690 struct coda_vget_out coda_vget;
691 struct coda_purgeuser_out coda_purgeuser;
692 struct coda_zapfile_out coda_zapfile;
693 struct coda_zapdir_out coda_zapdir;
694 struct coda_purgefid_out coda_purgefid;
695 struct coda_replace_out coda_replace;
696 struct coda_open_by_fd_out coda_open_by_fd;
697 struct coda_open_by_path_out coda_open_by_path;
698 struct coda_statfs_out coda_statfs;
699};
700
701union coda_downcalls {
702 /* CODA_INVALIDATE is a venus->kernel call */
703 /* CODA_FLUSH is a venus->kernel call */
704 struct coda_purgeuser_out purgeuser;
705 struct coda_zapfile_out zapfile;
706 struct coda_zapdir_out zapdir;
707 struct coda_purgefid_out purgefid;
708 struct coda_replace_out replace;
709};
710
711
712/*
713 * Used for identifying usage of "Control" and pioctls
714 */
715
716#define PIOCPARM_MASK 0x0000ffff
717struct ViceIoctl {
718 void __user *in; /* Data to be transferred in */
719 void __user *out; /* Data to be transferred out */
720 u_short in_size; /* Size of input buffer <= 2K */
721 u_short out_size; /* Maximum size of output buffer, <= 2K */
722};
723
724struct PioctlData {
725 const char __user *path;
726 int follow;
727 struct ViceIoctl vi;
728};
729
730#define CODA_CONTROL ".CONTROL"
731#define CODA_CONTROLLEN 8
732#define CTL_INO -1
733
734/* Data passed to mount */
735
736#define CODA_MOUNT_VERSION 1
737
738struct coda_mount_data {
739 int version;
740 int fd; /* Opened device */
741};
742
743#endif
744
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h
index 72f2d2f0af91..8031d6eef102 100644
--- a/include/linux/coda_psdev.h
+++ b/include/linux/coda_psdev.h
@@ -1,14 +1,9 @@
1#ifndef __CODA_PSDEV_H 1#ifndef __CODA_PSDEV_H
2#define __CODA_PSDEV_H 2#define __CODA_PSDEV_H
3 3
4#include <linux/magic.h>
5
6#define CODA_PSDEV_MAJOR 67
7#define MAX_CODADEVS 5 /* how many do we allow */
8
9#ifdef __KERNEL__
10#include <linux/backing-dev.h> 4#include <linux/backing-dev.h>
11#include <linux/mutex.h> 5#include <linux/mutex.h>
6#include <uapi/linux/coda_psdev.h>
12 7
13struct kstatfs; 8struct kstatfs;
14 9
@@ -74,23 +69,4 @@ int venus_statfs(struct dentry *dentry, struct kstatfs *sfs);
74 */ 69 */
75 70
76extern struct venus_comm coda_comms[]; 71extern struct venus_comm coda_comms[];
77#endif /* __KERNEL__ */
78
79/* messages between coda filesystem in kernel and Venus */
80struct upc_req {
81 struct list_head uc_chain;
82 caddr_t uc_data;
83 u_short uc_flags;
84 u_short uc_inSize; /* Size is at most 5000 bytes */
85 u_short uc_outSize;
86 u_short uc_opcode; /* copied from data to save lookup */
87 int uc_unique;
88 wait_queue_head_t uc_sleep; /* process' wait queue */
89};
90
91#define CODA_REQ_ASYNC 0x1
92#define CODA_REQ_READ 0x2
93#define CODA_REQ_WRITE 0x4
94#define CODA_REQ_ABORT 0x8
95
96#endif 72#endif
diff --git a/include/linux/compaction.h b/include/linux/compaction.h
index ef658147e4e8..6ecb6dc2f303 100644
--- a/include/linux/compaction.h
+++ b/include/linux/compaction.h
@@ -22,8 +22,9 @@ extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
22extern int fragmentation_index(struct zone *zone, unsigned int order); 22extern int fragmentation_index(struct zone *zone, unsigned int order);
23extern unsigned long try_to_compact_pages(struct zonelist *zonelist, 23extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
24 int order, gfp_t gfp_mask, nodemask_t *mask, 24 int order, gfp_t gfp_mask, nodemask_t *mask,
25 bool sync, bool *contended); 25 bool sync, bool *contended, struct page **page);
26extern int compact_pgdat(pg_data_t *pgdat, int order); 26extern int compact_pgdat(pg_data_t *pgdat, int order);
27extern void reset_isolation_suitable(pg_data_t *pgdat);
27extern unsigned long compaction_suitable(struct zone *zone, int order); 28extern unsigned long compaction_suitable(struct zone *zone, int order);
28 29
29/* Do not skip compaction more than 64 times */ 30/* Do not skip compaction more than 64 times */
@@ -61,10 +62,20 @@ static inline bool compaction_deferred(struct zone *zone, int order)
61 return zone->compact_considered < defer_limit; 62 return zone->compact_considered < defer_limit;
62} 63}
63 64
65/* Returns true if restarting compaction after many failures */
66static inline bool compaction_restarting(struct zone *zone, int order)
67{
68 if (order < zone->compact_order_failed)
69 return false;
70
71 return zone->compact_defer_shift == COMPACT_MAX_DEFER_SHIFT &&
72 zone->compact_considered >= 1UL << zone->compact_defer_shift;
73}
74
64#else 75#else
65static inline unsigned long try_to_compact_pages(struct zonelist *zonelist, 76static inline unsigned long try_to_compact_pages(struct zonelist *zonelist,
66 int order, gfp_t gfp_mask, nodemask_t *nodemask, 77 int order, gfp_t gfp_mask, nodemask_t *nodemask,
67 bool sync, bool *contended) 78 bool sync, bool *contended, struct page **page)
68{ 79{
69 return COMPACT_CONTINUE; 80 return COMPACT_CONTINUE;
70} 81}
@@ -74,6 +85,10 @@ static inline int compact_pgdat(pg_data_t *pgdat, int order)
74 return COMPACT_CONTINUE; 85 return COMPACT_CONTINUE;
75} 86}
76 87
88static inline void reset_isolation_suitable(pg_data_t *pgdat)
89{
90}
91
77static inline unsigned long compaction_suitable(struct zone *zone, int order) 92static inline unsigned long compaction_suitable(struct zone *zone, int order)
78{ 93{
79 return COMPACT_SKIPPED; 94 return COMPACT_SKIPPED;
diff --git a/include/linux/compat.h b/include/linux/compat.h
index fd4e29956d1c..d0ced1011f2f 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -160,11 +160,6 @@ struct compat_ustat {
160 char f_fpack[6]; 160 char f_fpack[6];
161}; 161};
162 162
163typedef union compat_sigval {
164 compat_int_t sival_int;
165 compat_uptr_t sival_ptr;
166} compat_sigval_t;
167
168#define COMPAT_SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3) 163#define COMPAT_SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE/sizeof(int)) - 3)
169 164
170typedef struct compat_sigevent { 165typedef struct compat_sigevent {
@@ -289,8 +284,12 @@ asmlinkage ssize_t compat_sys_pwritev(unsigned long fd,
289 const struct compat_iovec __user *vec, 284 const struct compat_iovec __user *vec,
290 unsigned long vlen, u32 pos_low, u32 pos_high); 285 unsigned long vlen, u32 pos_low, u32 pos_high);
291 286
292int compat_do_execve(char *filename, compat_uptr_t __user *argv, 287int compat_do_execve(const char *filename, const compat_uptr_t __user *argv,
293 compat_uptr_t __user *envp, struct pt_regs *regs); 288 const compat_uptr_t __user *envp, struct pt_regs *regs);
289#ifdef __ARCH_WANT_SYS_EXECVE
290asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv,
291 const compat_uptr_t __user *envp);
292#endif
294 293
295asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, 294asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
296 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 295 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 934bc34d5f99..412bc6c2b023 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -59,7 +59,7 @@
59#if __GNUC_MINOR__ > 0 59#if __GNUC_MINOR__ > 0
60#define __compiletime_object_size(obj) __builtin_object_size(obj, 0) 60#define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
61#endif 61#endif
62#if __GNUC_MINOR__ >= 4 && !defined(__CHECKER__) 62#if __GNUC_MINOR__ >= 3 && !defined(__CHECKER__)
63#define __compiletime_warning(message) __attribute__((warning(message))) 63#define __compiletime_warning(message) __attribute__((warning(message)))
64#define __compiletime_error(message) __attribute__((error(message))) 64#define __compiletime_error(message) __attribute__((error(message)))
65#endif 65#endif
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 76384074262d..b2b5a41b6a24 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -18,63 +18,9 @@
18 * along with this program; if not, write to the Free Software 18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21
22#ifndef __CONNECTOR_H 21#ifndef __CONNECTOR_H
23#define __CONNECTOR_H 22#define __CONNECTOR_H
24 23
25#include <linux/types.h>
26
27/*
28 * Process Events connector unique ids -- used for message routing
29 */
30#define CN_IDX_PROC 0x1
31#define CN_VAL_PROC 0x1
32#define CN_IDX_CIFS 0x2
33#define CN_VAL_CIFS 0x1
34#define CN_W1_IDX 0x3 /* w1 communication */
35#define CN_W1_VAL 0x1
36#define CN_IDX_V86D 0x4
37#define CN_VAL_V86D_UVESAFB 0x1
38#define CN_IDX_BB 0x5 /* BlackBoard, from the TSP GPL sampling framework */
39#define CN_DST_IDX 0x6
40#define CN_DST_VAL 0x1
41#define CN_IDX_DM 0x7 /* Device Mapper */
42#define CN_VAL_DM_USERSPACE_LOG 0x1
43#define CN_IDX_DRBD 0x8
44#define CN_VAL_DRBD 0x1
45#define CN_KVP_IDX 0x9 /* HyperV KVP */
46#define CN_KVP_VAL 0x1 /* queries from the kernel */
47
48#define CN_NETLINK_USERS 10 /* Highest index + 1 */
49
50/*
51 * Maximum connector's message size.
52 */
53#define CONNECTOR_MAX_MSG_SIZE 16384
54
55/*
56 * idx and val are unique identifiers which
57 * are used for message routing and
58 * must be registered in connector.h for in-kernel usage.
59 */
60
61struct cb_id {
62 __u32 idx;
63 __u32 val;
64};
65
66struct cn_msg {
67 struct cb_id id;
68
69 __u32 seq;
70 __u32 ack;
71
72 __u16 len; /* Length of the following data */
73 __u16 flags;
74 __u8 data[0];
75};
76
77#ifdef __KERNEL__
78 24
79#include <linux/atomic.h> 25#include <linux/atomic.h>
80 26
@@ -82,6 +28,7 @@ struct cn_msg {
82#include <linux/workqueue.h> 28#include <linux/workqueue.h>
83 29
84#include <net/sock.h> 30#include <net/sock.h>
31#include <uapi/linux/connector.h>
85 32
86#define CN_CBQ_NAMELEN 32 33#define CN_CBQ_NAMELEN 32
87 34
@@ -137,5 +84,4 @@ void cn_queue_free_dev(struct cn_queue_dev *dev);
137 84
138int cn_cb_equal(struct cb_id *, struct cb_id *); 85int cn_cb_equal(struct cb_id *, struct cb_id *);
139 86
140#endif /* __KERNEL__ */
141#endif /* __CONNECTOR_H */ 87#endif /* __CONNECTOR_H */
diff --git a/include/linux/console.h b/include/linux/console.h
index 7201ce4280ca..dedb082fe50f 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -83,8 +83,14 @@ void give_up_console(const struct consw *sw);
83int con_debug_enter(struct vc_data *vc); 83int con_debug_enter(struct vc_data *vc);
84int con_debug_leave(void); 84int con_debug_leave(void);
85#else 85#else
86#define con_debug_enter(vc) (0) 86static inline int con_debug_enter(struct vc_data *vc)
87#define con_debug_leave() (0) 87{
88 return 0;
89}
90static inline int con_debug_leave(void)
91{
92 return 0;
93}
88#endif 94#endif
89 95
90/* scroll */ 96/* scroll */
diff --git a/include/linux/coredump.h b/include/linux/coredump.h
index ba4b85a6d9b8..1d7399314a89 100644
--- a/include/linux/coredump.h
+++ b/include/linux/coredump.h
@@ -4,6 +4,7 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/mm.h> 5#include <linux/mm.h>
6#include <linux/fs.h> 6#include <linux/fs.h>
7#include <asm/siginfo.h>
7 8
8/* 9/*
9 * These are the only things you should do on a core-file: use only these 10 * These are the only things you should do on a core-file: use only these
@@ -11,5 +12,10 @@
11 */ 12 */
12extern int dump_write(struct file *file, const void *addr, int nr); 13extern int dump_write(struct file *file, const void *addr, int nr);
13extern int dump_seek(struct file *file, loff_t off); 14extern int dump_seek(struct file *file, loff_t off);
15#ifdef CONFIG_COREDUMP
16extern void do_coredump(siginfo_t *siginfo, struct pt_regs *regs);
17#else
18static inline void do_coredump(siginfo_t *siginfo, struct pt_regs *regs) {}
19#endif
14 20
15#endif /* _LINUX_COREDUMP_H */ 21#endif /* _LINUX_COREDUMP_H */
diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h
new file mode 100644
index 000000000000..851530128e65
--- /dev/null
+++ b/include/linux/cpu_cooling.h
@@ -0,0 +1,58 @@
1/*
2 * linux/include/linux/cpu_cooling.h
3 *
4 * Copyright (C) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com)
5 * Copyright (C) 2012 Amit Daniel <amit.kachhap@linaro.org>
6 *
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, 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 along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20 *
21 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 */
23
24#ifndef __CPU_COOLING_H__
25#define __CPU_COOLING_H__
26
27#include <linux/thermal.h>
28
29#define CPUFREQ_COOLING_START 0
30#define CPUFREQ_COOLING_STOP 1
31
32#ifdef CONFIG_CPU_THERMAL
33/**
34 * cpufreq_cooling_register - function to create cpufreq cooling device.
35 * @clip_cpus: cpumask of cpus where the frequency constraints will happen
36 */
37struct thermal_cooling_device *cpufreq_cooling_register(
38 struct cpumask *clip_cpus);
39
40/**
41 * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
42 * @cdev: thermal cooling device pointer.
43 */
44void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
45#else /* !CONFIG_CPU_THERMAL */
46static inline struct thermal_cooling_device *cpufreq_cooling_register(
47 struct cpumask *clip_cpus)
48{
49 return NULL;
50}
51static inline void cpufreq_cooling_unregister(
52 struct thermal_cooling_device *cdev)
53{
54 return;
55}
56#endif /* CONFIG_CPU_THERMAL */
57
58#endif /* __CPU_COOLING_H__ */
diff --git a/include/linux/cramfs_fs.h b/include/linux/cramfs_fs.h
index 0e7bf272ec2f..133789609f23 100644
--- a/include/linux/cramfs_fs.h
+++ b/include/linux/cramfs_fs.h
@@ -1,94 +1,10 @@
1#ifndef __CRAMFS_H 1#ifndef __CRAMFS_H
2#define __CRAMFS_H 2#define __CRAMFS_H
3 3
4#include <linux/types.h> 4#include <uapi/linux/cramfs_fs.h>
5#include <linux/magic.h>
6 5
7#define CRAMFS_SIGNATURE "Compressed ROMFS"
8
9/*
10 * Width of various bitfields in struct cramfs_inode.
11 * Primarily used to generate warnings in mkcramfs.
12 */
13#define CRAMFS_MODE_WIDTH 16
14#define CRAMFS_UID_WIDTH 16
15#define CRAMFS_SIZE_WIDTH 24
16#define CRAMFS_GID_WIDTH 8
17#define CRAMFS_NAMELEN_WIDTH 6
18#define CRAMFS_OFFSET_WIDTH 26
19
20/*
21 * Since inode.namelen is a unsigned 6-bit number, the maximum cramfs
22 * path length is 63 << 2 = 252.
23 */
24#define CRAMFS_MAXPATHLEN (((1 << CRAMFS_NAMELEN_WIDTH) - 1) << 2)
25
26/*
27 * Reasonably terse representation of the inode data.
28 */
29struct cramfs_inode {
30 __u32 mode:CRAMFS_MODE_WIDTH, uid:CRAMFS_UID_WIDTH;
31 /* SIZE for device files is i_rdev */
32 __u32 size:CRAMFS_SIZE_WIDTH, gid:CRAMFS_GID_WIDTH;
33 /* NAMELEN is the length of the file name, divided by 4 and
34 rounded up. (cramfs doesn't support hard links.) */
35 /* OFFSET: For symlinks and non-empty regular files, this
36 contains the offset (divided by 4) of the file data in
37 compressed form (starting with an array of block pointers;
38 see README). For non-empty directories it is the offset
39 (divided by 4) of the inode of the first file in that
40 directory. For anything else, offset is zero. */
41 __u32 namelen:CRAMFS_NAMELEN_WIDTH, offset:CRAMFS_OFFSET_WIDTH;
42};
43
44struct cramfs_info {
45 __u32 crc;
46 __u32 edition;
47 __u32 blocks;
48 __u32 files;
49};
50
51/*
52 * Superblock information at the beginning of the FS.
53 */
54struct cramfs_super {
55 __u32 magic; /* 0x28cd3d45 - random number */
56 __u32 size; /* length in bytes */
57 __u32 flags; /* feature flags */
58 __u32 future; /* reserved for future use */
59 __u8 signature[16]; /* "Compressed ROMFS" */
60 struct cramfs_info fsid; /* unique filesystem info */
61 __u8 name[16]; /* user-defined name */
62 struct cramfs_inode root; /* root inode data */
63};
64
65/*
66 * Feature flags
67 *
68 * 0x00000000 - 0x000000ff: features that work for all past kernels
69 * 0x00000100 - 0xffffffff: features that don't work for past kernels
70 */
71#define CRAMFS_FLAG_FSID_VERSION_2 0x00000001 /* fsid version #2 */
72#define CRAMFS_FLAG_SORTED_DIRS 0x00000002 /* sorted dirs */
73#define CRAMFS_FLAG_HOLES 0x00000100 /* support for holes */
74#define CRAMFS_FLAG_WRONG_SIGNATURE 0x00000200 /* reserved */
75#define CRAMFS_FLAG_SHIFTED_ROOT_OFFSET 0x00000400 /* shifted root fs */
76
77/*
78 * Valid values in super.flags. Currently we refuse to mount
79 * if (flags & ~CRAMFS_SUPPORTED_FLAGS). Maybe that should be
80 * changed to test super.future instead.
81 */
82#define CRAMFS_SUPPORTED_FLAGS ( 0x000000ff \
83 | CRAMFS_FLAG_HOLES \
84 | CRAMFS_FLAG_WRONG_SIGNATURE \
85 | CRAMFS_FLAG_SHIFTED_ROOT_OFFSET )
86
87#ifdef __KERNEL__
88/* Uncompression interfaces to the underlying zlib */ 6/* Uncompression interfaces to the underlying zlib */
89int cramfs_uncompress_block(void *dst, int dstlen, void *src, int srclen); 7int cramfs_uncompress_block(void *dst, int dstlen, void *src, int srclen);
90int cramfs_uncompress_init(void); 8int cramfs_uncompress_init(void);
91void cramfs_uncompress_exit(void); 9void cramfs_uncompress_exit(void);
92#endif /* __KERNEL__ */
93
94#endif 10#endif
diff --git a/include/linux/cuda.h b/include/linux/cuda.h
index 9f9865ff781e..b72332823807 100644
--- a/include/linux/cuda.h
+++ b/include/linux/cuda.h
@@ -4,38 +4,15 @@
4 * 4 *
5 * Copyright (C) 1996 Paul Mackerras. 5 * Copyright (C) 1996 Paul Mackerras.
6 */ 6 */
7
8#ifndef _LINUX_CUDA_H 7#ifndef _LINUX_CUDA_H
9#define _LINUX_CUDA_H 8#define _LINUX_CUDA_H
10 9
11/* CUDA commands (2nd byte) */ 10#include <uapi/linux/cuda.h>
12#define CUDA_WARM_START 0
13#define CUDA_AUTOPOLL 1
14#define CUDA_GET_6805_ADDR 2
15#define CUDA_GET_TIME 3
16#define CUDA_GET_PRAM 7
17#define CUDA_SET_6805_ADDR 8
18#define CUDA_SET_TIME 9
19#define CUDA_POWERDOWN 0xa
20#define CUDA_POWERUP_TIME 0xb
21#define CUDA_SET_PRAM 0xc
22#define CUDA_MS_RESET 0xd
23#define CUDA_SEND_DFAC 0xe
24#define CUDA_RESET_SYSTEM 0x11
25#define CUDA_SET_IPL 0x12
26#define CUDA_SET_AUTO_RATE 0x14
27#define CUDA_GET_AUTO_RATE 0x16
28#define CUDA_SET_DEVICE_LIST 0x19
29#define CUDA_GET_DEVICE_LIST 0x1a
30#define CUDA_GET_SET_IIC 0x22
31 11
32#ifdef __KERNEL__
33 12
34extern int find_via_cuda(void); 13extern int find_via_cuda(void);
35extern int cuda_request(struct adb_request *req, 14extern int cuda_request(struct adb_request *req,
36 void (*done)(struct adb_request *), int nbytes, ...); 15 void (*done)(struct adb_request *), int nbytes, ...);
37extern void cuda_poll(void); 16extern void cuda_poll(void);
38 17
39#endif /* __KERNEL */
40
41#endif /* _LINUX_CUDA_H */ 18#endif /* _LINUX_CUDA_H */
diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h
index a5049eaf782d..19ae518f5471 100644
--- a/include/linux/cyclades.h
+++ b/include/linux/cyclades.h
@@ -63,434 +63,11 @@
63 * 63 *
64 * 64 *
65 */ 65 */
66
67#ifndef _LINUX_CYCLADES_H 66#ifndef _LINUX_CYCLADES_H
68#define _LINUX_CYCLADES_H 67#define _LINUX_CYCLADES_H
69 68
70#include <linux/types.h> 69#include <uapi/linux/cyclades.h>
71
72struct cyclades_monitor {
73 unsigned long int_count;
74 unsigned long char_count;
75 unsigned long char_max;
76 unsigned long char_last;
77};
78
79/*
80 * These stats all reflect activity since the device was last initialized.
81 * (i.e., since the port was opened with no other processes already having it
82 * open)
83 */
84struct cyclades_idle_stats {
85 __kernel_time_t in_use; /* Time device has been in use (secs) */
86 __kernel_time_t recv_idle; /* Time since last char received (secs) */
87 __kernel_time_t xmit_idle; /* Time since last char transmitted (secs) */
88 unsigned long recv_bytes; /* Bytes received */
89 unsigned long xmit_bytes; /* Bytes transmitted */
90 unsigned long overruns; /* Input overruns */
91 unsigned long frame_errs; /* Input framing errors */
92 unsigned long parity_errs; /* Input parity errors */
93};
94
95#define CYCLADES_MAGIC 0x4359
96
97#define CYGETMON 0x435901
98#define CYGETTHRESH 0x435902
99#define CYSETTHRESH 0x435903
100#define CYGETDEFTHRESH 0x435904
101#define CYSETDEFTHRESH 0x435905
102#define CYGETTIMEOUT 0x435906
103#define CYSETTIMEOUT 0x435907
104#define CYGETDEFTIMEOUT 0x435908
105#define CYSETDEFTIMEOUT 0x435909
106#define CYSETRFLOW 0x43590a
107#define CYGETRFLOW 0x43590b
108#define CYSETRTSDTR_INV 0x43590c
109#define CYGETRTSDTR_INV 0x43590d
110#define CYZSETPOLLCYCLE 0x43590e
111#define CYZGETPOLLCYCLE 0x43590f
112#define CYGETCD1400VER 0x435910
113#define CYSETWAIT 0x435912
114#define CYGETWAIT 0x435913
115
116/*************** CYCLOM-Z ADDITIONS ***************/
117
118#define CZIOC ('M' << 8)
119#define CZ_NBOARDS (CZIOC|0xfa)
120#define CZ_BOOT_START (CZIOC|0xfb)
121#define CZ_BOOT_DATA (CZIOC|0xfc)
122#define CZ_BOOT_END (CZIOC|0xfd)
123#define CZ_TEST (CZIOC|0xfe)
124
125#define CZ_DEF_POLL (HZ/25)
126
127#define MAX_BOARD 4 /* Max number of boards */
128#define MAX_DEV 256 /* Max number of ports total */
129#define CYZ_MAX_SPEED 921600
130
131#define CYZ_FIFO_SIZE 16
132
133#define CYZ_BOOT_NWORDS 0x100
134struct CYZ_BOOT_CTRL {
135 unsigned short nboard;
136 int status[MAX_BOARD];
137 int nchannel[MAX_BOARD];
138 int fw_rev[MAX_BOARD];
139 unsigned long offset;
140 unsigned long data[CYZ_BOOT_NWORDS];
141};
142
143
144#ifndef DP_WINDOW_SIZE
145/*
146 * Memory Window Sizes
147 */
148
149#define DP_WINDOW_SIZE (0x00080000) /* window size 512 Kb */
150#define ZE_DP_WINDOW_SIZE (0x00100000) /* window size 1 Mb (Ze and
151 8Zo V.2 */
152#define CTRL_WINDOW_SIZE (0x00000080) /* runtime regs 128 bytes */
153
154/*
155 * CUSTOM_REG - Cyclom-Z/PCI Custom Registers Set. The driver
156 * normally will access only interested on the fpga_id, fpga_version,
157 * start_cpu and stop_cpu.
158 */
159
160struct CUSTOM_REG {
161 __u32 fpga_id; /* FPGA Identification Register */
162 __u32 fpga_version; /* FPGA Version Number Register */
163 __u32 cpu_start; /* CPU start Register (write) */
164 __u32 cpu_stop; /* CPU stop Register (write) */
165 __u32 misc_reg; /* Miscellaneous Register */
166 __u32 idt_mode; /* IDT mode Register */
167 __u32 uart_irq_status; /* UART IRQ status Register */
168 __u32 clear_timer0_irq; /* Clear timer interrupt Register */
169 __u32 clear_timer1_irq; /* Clear timer interrupt Register */
170 __u32 clear_timer2_irq; /* Clear timer interrupt Register */
171 __u32 test_register; /* Test Register */
172 __u32 test_count; /* Test Count Register */
173 __u32 timer_select; /* Timer select register */
174 __u32 pr_uart_irq_status; /* Prioritized UART IRQ stat Reg */
175 __u32 ram_wait_state; /* RAM wait-state Register */
176 __u32 uart_wait_state; /* UART wait-state Register */
177 __u32 timer_wait_state; /* timer wait-state Register */
178 __u32 ack_wait_state; /* ACK wait State Register */
179};
180
181/*
182 * RUNTIME_9060 - PLX PCI9060ES local configuration and shared runtime
183 * registers. This structure can be used to access the 9060 registers
184 * (memory mapped).
185 */
186
187struct RUNTIME_9060 {
188 __u32 loc_addr_range; /* 00h - Local Address Range */
189 __u32 loc_addr_base; /* 04h - Local Address Base */
190 __u32 loc_arbitr; /* 08h - Local Arbitration */
191 __u32 endian_descr; /* 0Ch - Big/Little Endian Descriptor */
192 __u32 loc_rom_range; /* 10h - Local ROM Range */
193 __u32 loc_rom_base; /* 14h - Local ROM Base */
194 __u32 loc_bus_descr; /* 18h - Local Bus descriptor */
195 __u32 loc_range_mst; /* 1Ch - Local Range for Master to PCI */
196 __u32 loc_base_mst; /* 20h - Local Base for Master PCI */
197 __u32 loc_range_io; /* 24h - Local Range for Master IO */
198 __u32 pci_base_mst; /* 28h - PCI Base for Master PCI */
199 __u32 pci_conf_io; /* 2Ch - PCI configuration for Master IO */
200 __u32 filler1; /* 30h */
201 __u32 filler2; /* 34h */
202 __u32 filler3; /* 38h */
203 __u32 filler4; /* 3Ch */
204 __u32 mail_box_0; /* 40h - Mail Box 0 */
205 __u32 mail_box_1; /* 44h - Mail Box 1 */
206 __u32 mail_box_2; /* 48h - Mail Box 2 */
207 __u32 mail_box_3; /* 4Ch - Mail Box 3 */
208 __u32 filler5; /* 50h */
209 __u32 filler6; /* 54h */
210 __u32 filler7; /* 58h */
211 __u32 filler8; /* 5Ch */
212 __u32 pci_doorbell; /* 60h - PCI to Local Doorbell */
213 __u32 loc_doorbell; /* 64h - Local to PCI Doorbell */
214 __u32 intr_ctrl_stat; /* 68h - Interrupt Control/Status */
215 __u32 init_ctrl; /* 6Ch - EEPROM control, Init Control, etc */
216};
217
218/* Values for the Local Base Address re-map register */
219
220#define WIN_RAM 0x00000001L /* set the sliding window to RAM */
221#define WIN_CREG 0x14000001L /* set the window to custom Registers */
222
223/* Values timer select registers */
224
225#define TIMER_BY_1M 0x00 /* clock divided by 1M */
226#define TIMER_BY_256K 0x01 /* clock divided by 256k */
227#define TIMER_BY_128K 0x02 /* clock divided by 128k */
228#define TIMER_BY_32K 0x03 /* clock divided by 32k */
229
230/****************** ****************** *******************/
231#endif
232
233#ifndef ZFIRM_ID
234/* #include "zfwint.h" */
235/****************** ****************** *******************/
236/*
237 * This file contains the definitions for interfacing with the
238 * Cyclom-Z ZFIRM Firmware.
239 */
240
241/* General Constant definitions */
242
243#define MAX_CHAN 64 /* max number of channels per board */
244
245/* firmware id structure (set after boot) */
246
247#define ID_ADDRESS 0x00000180L /* signature/pointer address */
248#define ZFIRM_ID 0x5557465AL /* ZFIRM/U signature */
249#define ZFIRM_HLT 0x59505B5CL /* ZFIRM needs external power supply */
250#define ZFIRM_RST 0x56040674L /* RST signal (due to FW reset) */
251
252#define ZF_TINACT_DEF 1000 /* default inactivity timeout
253 (1000 ms) */
254#define ZF_TINACT ZF_TINACT_DEF
255
256struct FIRM_ID {
257 __u32 signature; /* ZFIRM/U signature */
258 __u32 zfwctrl_addr; /* pointer to ZFW_CTRL structure */
259};
260
261/* Op. System id */
262
263#define C_OS_LINUX 0x00000030 /* generic Linux system */
264
265/* channel op_mode */
266
267#define C_CH_DISABLE 0x00000000 /* channel is disabled */
268#define C_CH_TXENABLE 0x00000001 /* channel Tx enabled */
269#define C_CH_RXENABLE 0x00000002 /* channel Rx enabled */
270#define C_CH_ENABLE 0x00000003 /* channel Tx/Rx enabled */
271#define C_CH_LOOPBACK 0x00000004 /* Loopback mode */
272
273/* comm_parity - parity */
274
275#define C_PR_NONE 0x00000000 /* None */
276#define C_PR_ODD 0x00000001 /* Odd */
277#define C_PR_EVEN 0x00000002 /* Even */
278#define C_PR_MARK 0x00000004 /* Mark */
279#define C_PR_SPACE 0x00000008 /* Space */
280#define C_PR_PARITY 0x000000ff
281
282#define C_PR_DISCARD 0x00000100 /* discard char with frame/par error */
283#define C_PR_IGNORE 0x00000200 /* ignore frame/par error */
284
285/* comm_data_l - data length and stop bits */
286
287#define C_DL_CS5 0x00000001
288#define C_DL_CS6 0x00000002
289#define C_DL_CS7 0x00000004
290#define C_DL_CS8 0x00000008
291#define C_DL_CS 0x0000000f
292#define C_DL_1STOP 0x00000010
293#define C_DL_15STOP 0x00000020
294#define C_DL_2STOP 0x00000040
295#define C_DL_STOP 0x000000f0
296
297/* interrupt enabling/status */
298
299#define C_IN_DISABLE 0x00000000 /* zero, disable interrupts */
300#define C_IN_TXBEMPTY 0x00000001 /* tx buffer empty */
301#define C_IN_TXLOWWM 0x00000002 /* tx buffer below LWM */
302#define C_IN_RXHIWM 0x00000010 /* rx buffer above HWM */
303#define C_IN_RXNNDT 0x00000020 /* rx no new data timeout */
304#define C_IN_MDCD 0x00000100 /* modem DCD change */
305#define C_IN_MDSR 0x00000200 /* modem DSR change */
306#define C_IN_MRI 0x00000400 /* modem RI change */
307#define C_IN_MCTS 0x00000800 /* modem CTS change */
308#define C_IN_RXBRK 0x00001000 /* Break received */
309#define C_IN_PR_ERROR 0x00002000 /* parity error */
310#define C_IN_FR_ERROR 0x00004000 /* frame error */
311#define C_IN_OVR_ERROR 0x00008000 /* overrun error */
312#define C_IN_RXOFL 0x00010000 /* RX buffer overflow */
313#define C_IN_IOCTLW 0x00020000 /* I/O control w/ wait */
314#define C_IN_MRTS 0x00040000 /* modem RTS drop */
315#define C_IN_ICHAR 0x00080000
316
317/* flow control */
318
319#define C_FL_OXX 0x00000001 /* output Xon/Xoff flow control */
320#define C_FL_IXX 0x00000002 /* output Xon/Xoff flow control */
321#define C_FL_OIXANY 0x00000004 /* output Xon/Xoff (any xon) */
322#define C_FL_SWFLOW 0x0000000f
323
324/* flow status */
325
326#define C_FS_TXIDLE 0x00000000 /* no Tx data in the buffer or UART */
327#define C_FS_SENDING 0x00000001 /* UART is sending data */
328#define C_FS_SWFLOW 0x00000002 /* Tx is stopped by received Xoff */
329
330/* rs_control/rs_status RS-232 signals */
331
332#define C_RS_PARAM 0x80000000 /* Indicates presence of parameter in
333 IOCTLM command */
334#define C_RS_RTS 0x00000001 /* RTS */
335#define C_RS_DTR 0x00000004 /* DTR */
336#define C_RS_DCD 0x00000100 /* CD */
337#define C_RS_DSR 0x00000200 /* DSR */
338#define C_RS_RI 0x00000400 /* RI */
339#define C_RS_CTS 0x00000800 /* CTS */
340
341/* commands Host <-> Board */
342
343#define C_CM_RESET 0x01 /* reset/flush buffers */
344#define C_CM_IOCTL 0x02 /* re-read CH_CTRL */
345#define C_CM_IOCTLW 0x03 /* re-read CH_CTRL, intr when done */
346#define C_CM_IOCTLM 0x04 /* RS-232 outputs change */
347#define C_CM_SENDXOFF 0x10 /* send Xoff */
348#define C_CM_SENDXON 0x11 /* send Xon */
349#define C_CM_CLFLOW 0x12 /* Clear flow control (resume) */
350#define C_CM_SENDBRK 0x41 /* send break */
351#define C_CM_INTBACK 0x42 /* Interrupt back */
352#define C_CM_SET_BREAK 0x43 /* Tx break on */
353#define C_CM_CLR_BREAK 0x44 /* Tx break off */
354#define C_CM_CMD_DONE 0x45 /* Previous command done */
355#define C_CM_INTBACK2 0x46 /* Alternate Interrupt back */
356#define C_CM_TINACT 0x51 /* set inactivity detection */
357#define C_CM_IRQ_ENBL 0x52 /* enable generation of interrupts */
358#define C_CM_IRQ_DSBL 0x53 /* disable generation of interrupts */
359#define C_CM_ACK_ENBL 0x54 /* enable acknowledged interrupt mode */
360#define C_CM_ACK_DSBL 0x55 /* disable acknowledged intr mode */
361#define C_CM_FLUSH_RX 0x56 /* flushes Rx buffer */
362#define C_CM_FLUSH_TX 0x57 /* flushes Tx buffer */
363#define C_CM_Q_ENABLE 0x58 /* enables queue access from the
364 driver */
365#define C_CM_Q_DISABLE 0x59 /* disables queue access from the
366 driver */
367
368#define C_CM_TXBEMPTY 0x60 /* Tx buffer is empty */
369#define C_CM_TXLOWWM 0x61 /* Tx buffer low water mark */
370#define C_CM_RXHIWM 0x62 /* Rx buffer high water mark */
371#define C_CM_RXNNDT 0x63 /* rx no new data timeout */
372#define C_CM_TXFEMPTY 0x64
373#define C_CM_ICHAR 0x65
374#define C_CM_MDCD 0x70 /* modem DCD change */
375#define C_CM_MDSR 0x71 /* modem DSR change */
376#define C_CM_MRI 0x72 /* modem RI change */
377#define C_CM_MCTS 0x73 /* modem CTS change */
378#define C_CM_MRTS 0x74 /* modem RTS drop */
379#define C_CM_RXBRK 0x84 /* Break received */
380#define C_CM_PR_ERROR 0x85 /* Parity error */
381#define C_CM_FR_ERROR 0x86 /* Frame error */
382#define C_CM_OVR_ERROR 0x87 /* Overrun error */
383#define C_CM_RXOFL 0x88 /* RX buffer overflow */
384#define C_CM_CMDERROR 0x90 /* command error */
385#define C_CM_FATAL 0x91 /* fatal error */
386#define C_CM_HW_RESET 0x92 /* reset board */
387
388/*
389 * CH_CTRL - This per port structure contains all parameters
390 * that control an specific port. It can be seen as the
391 * configuration registers of a "super-serial-controller".
392 */
393
394struct CH_CTRL {
395 __u32 op_mode; /* operation mode */
396 __u32 intr_enable; /* interrupt masking */
397 __u32 sw_flow; /* SW flow control */
398 __u32 flow_status; /* output flow status */
399 __u32 comm_baud; /* baud rate - numerically specified */
400 __u32 comm_parity; /* parity */
401 __u32 comm_data_l; /* data length/stop */
402 __u32 comm_flags; /* other flags */
403 __u32 hw_flow; /* HW flow control */
404 __u32 rs_control; /* RS-232 outputs */
405 __u32 rs_status; /* RS-232 inputs */
406 __u32 flow_xon; /* xon char */
407 __u32 flow_xoff; /* xoff char */
408 __u32 hw_overflow; /* hw overflow counter */
409 __u32 sw_overflow; /* sw overflow counter */
410 __u32 comm_error; /* frame/parity error counter */
411 __u32 ichar;
412 __u32 filler[7];
413};
414
415
416/*
417 * BUF_CTRL - This per channel structure contains
418 * all Tx and Rx buffer control for a given channel.
419 */
420
421struct BUF_CTRL {
422 __u32 flag_dma; /* buffers are in Host memory */
423 __u32 tx_bufaddr; /* address of the tx buffer */
424 __u32 tx_bufsize; /* tx buffer size */
425 __u32 tx_threshold; /* tx low water mark */
426 __u32 tx_get; /* tail index tx buf */
427 __u32 tx_put; /* head index tx buf */
428 __u32 rx_bufaddr; /* address of the rx buffer */
429 __u32 rx_bufsize; /* rx buffer size */
430 __u32 rx_threshold; /* rx high water mark */
431 __u32 rx_get; /* tail index rx buf */
432 __u32 rx_put; /* head index rx buf */
433 __u32 filler[5]; /* filler to align structures */
434};
435
436/*
437 * BOARD_CTRL - This per board structure contains all global
438 * control fields related to the board.
439 */
440
441struct BOARD_CTRL {
442
443 /* static info provided by the on-board CPU */
444 __u32 n_channel; /* number of channels */
445 __u32 fw_version; /* firmware version */
446
447 /* static info provided by the driver */
448 __u32 op_system; /* op_system id */
449 __u32 dr_version; /* driver version */
450
451 /* board control area */
452 __u32 inactivity; /* inactivity control */
453
454 /* host to FW commands */
455 __u32 hcmd_channel; /* channel number */
456 __u32 hcmd_param; /* pointer to parameters */
457
458 /* FW to Host commands */
459 __u32 fwcmd_channel; /* channel number */
460 __u32 fwcmd_param; /* pointer to parameters */
461 __u32 zf_int_queue_addr; /* offset for INT_QUEUE structure */
462
463 /* filler so the structures are aligned */
464 __u32 filler[6];
465};
466
467/* Host Interrupt Queue */
468
469#define QUEUE_SIZE (10*MAX_CHAN)
470
471struct INT_QUEUE {
472 unsigned char intr_code[QUEUE_SIZE];
473 unsigned long channel[QUEUE_SIZE];
474 unsigned long param[QUEUE_SIZE];
475 unsigned long put;
476 unsigned long get;
477};
478
479/*
480 * ZFW_CTRL - This is the data structure that includes all other
481 * data structures used by the Firmware.
482 */
483
484struct ZFW_CTRL {
485 struct BOARD_CTRL board_ctrl;
486 struct CH_CTRL ch_ctrl[MAX_CHAN];
487 struct BUF_CTRL buf_ctrl[MAX_CHAN];
488};
489
490/****************** ****************** *******************/
491#endif
492 70
493#ifdef __KERNEL__
494 71
495/* Per card data structure */ 72/* Per card data structure */
496struct cyclades_card { 73struct cyclades_card {
@@ -780,5 +357,4 @@ struct cyclades_port {
780 357
781/***************************************************************************/ 358/***************************************************************************/
782 359
783#endif /* __KERNEL__ */
784#endif /* _LINUX_CYCLADES_H */ 360#endif /* _LINUX_CYCLADES_H */
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index d16294e2a118..439ff698000a 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -1,239 +1,6 @@
1#ifndef _LINUX_DCCP_H 1#ifndef _LINUX_DCCP_H
2#define _LINUX_DCCP_H 2#define _LINUX_DCCP_H
3 3
4#include <linux/types.h>
5#include <asm/byteorder.h>
6
7/**
8 * struct dccp_hdr - generic part of DCCP packet header
9 *
10 * @dccph_sport - Relevant port on the endpoint that sent this packet
11 * @dccph_dport - Relevant port on the other endpoint
12 * @dccph_doff - Data Offset from the start of the DCCP header, in 32-bit words
13 * @dccph_ccval - Used by the HC-Sender CCID
14 * @dccph_cscov - Parts of the packet that are covered by the Checksum field
15 * @dccph_checksum - Internet checksum, depends on dccph_cscov
16 * @dccph_x - 0 = 24 bit sequence number, 1 = 48
17 * @dccph_type - packet type, see DCCP_PKT_ prefixed macros
18 * @dccph_seq - sequence number high or low order 24 bits, depends on dccph_x
19 */
20struct dccp_hdr {
21 __be16 dccph_sport,
22 dccph_dport;
23 __u8 dccph_doff;
24#if defined(__LITTLE_ENDIAN_BITFIELD)
25 __u8 dccph_cscov:4,
26 dccph_ccval:4;
27#elif defined(__BIG_ENDIAN_BITFIELD)
28 __u8 dccph_ccval:4,
29 dccph_cscov:4;
30#else
31#error "Adjust your <asm/byteorder.h> defines"
32#endif
33 __sum16 dccph_checksum;
34#if defined(__LITTLE_ENDIAN_BITFIELD)
35 __u8 dccph_x:1,
36 dccph_type:4,
37 dccph_reserved:3;
38#elif defined(__BIG_ENDIAN_BITFIELD)
39 __u8 dccph_reserved:3,
40 dccph_type:4,
41 dccph_x:1;
42#else
43#error "Adjust your <asm/byteorder.h> defines"
44#endif
45 __u8 dccph_seq2;
46 __be16 dccph_seq;
47};
48
49/**
50 * struct dccp_hdr_ext - the low bits of a 48 bit seq packet
51 *
52 * @dccph_seq_low - low 24 bits of a 48 bit seq packet
53 */
54struct dccp_hdr_ext {
55 __be32 dccph_seq_low;
56};
57
58/**
59 * struct dccp_hdr_request - Connection initiation request header
60 *
61 * @dccph_req_service - Service to which the client app wants to connect
62 */
63struct dccp_hdr_request {
64 __be32 dccph_req_service;
65};
66/**
67 * struct dccp_hdr_ack_bits - acknowledgment bits common to most packets
68 *
69 * @dccph_resp_ack_nr_high - 48 bit ack number high order bits, contains GSR
70 * @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR
71 */
72struct dccp_hdr_ack_bits {
73 __be16 dccph_reserved1;
74 __be16 dccph_ack_nr_high;
75 __be32 dccph_ack_nr_low;
76};
77/**
78 * struct dccp_hdr_response - Connection initiation response header
79 *
80 * @dccph_resp_ack - 48 bit Acknowledgment Number Subheader (5.3)
81 * @dccph_resp_service - Echoes the Service Code on a received DCCP-Request
82 */
83struct dccp_hdr_response {
84 struct dccp_hdr_ack_bits dccph_resp_ack;
85 __be32 dccph_resp_service;
86};
87
88/**
89 * struct dccp_hdr_reset - Unconditionally shut down a connection
90 *
91 * @dccph_reset_ack - 48 bit Acknowledgment Number Subheader (5.6)
92 * @dccph_reset_code - one of %dccp_reset_codes
93 * @dccph_reset_data - the Data 1 ... Data 3 fields from 5.6
94 */
95struct dccp_hdr_reset {
96 struct dccp_hdr_ack_bits dccph_reset_ack;
97 __u8 dccph_reset_code,
98 dccph_reset_data[3];
99};
100
101enum dccp_pkt_type {
102 DCCP_PKT_REQUEST = 0,
103 DCCP_PKT_RESPONSE,
104 DCCP_PKT_DATA,
105 DCCP_PKT_ACK,
106 DCCP_PKT_DATAACK,
107 DCCP_PKT_CLOSEREQ,
108 DCCP_PKT_CLOSE,
109 DCCP_PKT_RESET,
110 DCCP_PKT_SYNC,
111 DCCP_PKT_SYNCACK,
112 DCCP_PKT_INVALID,
113};
114
115#define DCCP_NR_PKT_TYPES DCCP_PKT_INVALID
116
117static inline unsigned int dccp_packet_hdr_len(const __u8 type)
118{
119 if (type == DCCP_PKT_DATA)
120 return 0;
121 if (type == DCCP_PKT_DATAACK ||
122 type == DCCP_PKT_ACK ||
123 type == DCCP_PKT_SYNC ||
124 type == DCCP_PKT_SYNCACK ||
125 type == DCCP_PKT_CLOSE ||
126 type == DCCP_PKT_CLOSEREQ)
127 return sizeof(struct dccp_hdr_ack_bits);
128 if (type == DCCP_PKT_REQUEST)
129 return sizeof(struct dccp_hdr_request);
130 if (type == DCCP_PKT_RESPONSE)
131 return sizeof(struct dccp_hdr_response);
132 return sizeof(struct dccp_hdr_reset);
133}
134enum dccp_reset_codes {
135 DCCP_RESET_CODE_UNSPECIFIED = 0,
136 DCCP_RESET_CODE_CLOSED,
137 DCCP_RESET_CODE_ABORTED,
138 DCCP_RESET_CODE_NO_CONNECTION,
139 DCCP_RESET_CODE_PACKET_ERROR,
140 DCCP_RESET_CODE_OPTION_ERROR,
141 DCCP_RESET_CODE_MANDATORY_ERROR,
142 DCCP_RESET_CODE_CONNECTION_REFUSED,
143 DCCP_RESET_CODE_BAD_SERVICE_CODE,
144 DCCP_RESET_CODE_TOO_BUSY,
145 DCCP_RESET_CODE_BAD_INIT_COOKIE,
146 DCCP_RESET_CODE_AGGRESSION_PENALTY,
147
148 DCCP_MAX_RESET_CODES /* Leave at the end! */
149};
150
151/* DCCP options */
152enum {
153 DCCPO_PADDING = 0,
154 DCCPO_MANDATORY = 1,
155 DCCPO_MIN_RESERVED = 3,
156 DCCPO_MAX_RESERVED = 31,
157 DCCPO_CHANGE_L = 32,
158 DCCPO_CONFIRM_L = 33,
159 DCCPO_CHANGE_R = 34,
160 DCCPO_CONFIRM_R = 35,
161 DCCPO_NDP_COUNT = 37,
162 DCCPO_ACK_VECTOR_0 = 38,
163 DCCPO_ACK_VECTOR_1 = 39,
164 DCCPO_TIMESTAMP = 41,
165 DCCPO_TIMESTAMP_ECHO = 42,
166 DCCPO_ELAPSED_TIME = 43,
167 DCCPO_MAX = 45,
168 DCCPO_MIN_RX_CCID_SPECIFIC = 128, /* from sender to receiver */
169 DCCPO_MAX_RX_CCID_SPECIFIC = 191,
170 DCCPO_MIN_TX_CCID_SPECIFIC = 192, /* from receiver to sender */
171 DCCPO_MAX_TX_CCID_SPECIFIC = 255,
172};
173/* maximum size of a single TLV-encoded DCCP option (sans type/len bytes) */
174#define DCCP_SINGLE_OPT_MAXLEN 253
175
176/* DCCP CCIDS */
177enum {
178 DCCPC_CCID2 = 2,
179 DCCPC_CCID3 = 3,
180};
181
182/* DCCP features (RFC 4340 section 6.4) */
183enum dccp_feature_numbers {
184 DCCPF_RESERVED = 0,
185 DCCPF_CCID = 1,
186 DCCPF_SHORT_SEQNOS = 2,
187 DCCPF_SEQUENCE_WINDOW = 3,
188 DCCPF_ECN_INCAPABLE = 4,
189 DCCPF_ACK_RATIO = 5,
190 DCCPF_SEND_ACK_VECTOR = 6,
191 DCCPF_SEND_NDP_COUNT = 7,
192 DCCPF_MIN_CSUM_COVER = 8,
193 DCCPF_DATA_CHECKSUM = 9,
194 /* 10-127 reserved */
195 DCCPF_MIN_CCID_SPECIFIC = 128,
196 DCCPF_SEND_LEV_RATE = 192, /* RFC 4342, sec. 8.4 */
197 DCCPF_MAX_CCID_SPECIFIC = 255,
198};
199
200/* DCCP socket control message types for cmsg */
201enum dccp_cmsg_type {
202 DCCP_SCM_PRIORITY = 1,
203 DCCP_SCM_QPOLICY_MAX = 0xFFFF,
204 /* ^-- Up to here reserved exclusively for qpolicy parameters */
205 DCCP_SCM_MAX
206};
207
208/* DCCP priorities for outgoing/queued packets */
209enum dccp_packet_dequeueing_policy {
210 DCCPQ_POLICY_SIMPLE,
211 DCCPQ_POLICY_PRIO,
212 DCCPQ_POLICY_MAX
213};
214
215/* DCCP socket options */
216#define DCCP_SOCKOPT_PACKET_SIZE 1 /* XXX deprecated, without effect */
217#define DCCP_SOCKOPT_SERVICE 2
218#define DCCP_SOCKOPT_CHANGE_L 3
219#define DCCP_SOCKOPT_CHANGE_R 4
220#define DCCP_SOCKOPT_GET_CUR_MPS 5
221#define DCCP_SOCKOPT_SERVER_TIMEWAIT 6
222#define DCCP_SOCKOPT_SEND_CSCOV 10
223#define DCCP_SOCKOPT_RECV_CSCOV 11
224#define DCCP_SOCKOPT_AVAILABLE_CCIDS 12
225#define DCCP_SOCKOPT_CCID 13
226#define DCCP_SOCKOPT_TX_CCID 14
227#define DCCP_SOCKOPT_RX_CCID 15
228#define DCCP_SOCKOPT_QPOLICY_ID 16
229#define DCCP_SOCKOPT_QPOLICY_TXQLEN 17
230#define DCCP_SOCKOPT_CCID_RX_INFO 128
231#define DCCP_SOCKOPT_CCID_TX_INFO 192
232
233/* maximum number of services provided on the same listening port */
234#define DCCP_SERVICE_LIST_MAX_LEN 32
235
236#ifdef __KERNEL__
237 4
238#include <linux/in.h> 5#include <linux/in.h>
239#include <linux/interrupt.h> 6#include <linux/interrupt.h>
@@ -246,6 +13,7 @@ enum dccp_packet_dequeueing_policy {
246#include <net/inet_sock.h> 13#include <net/inet_sock.h>
247#include <net/inet_timewait_sock.h> 14#include <net/inet_timewait_sock.h>
248#include <net/tcp_states.h> 15#include <net/tcp_states.h>
16#include <uapi/linux/dccp.h>
249 17
250enum dccp_state { 18enum dccp_state {
251 DCCP_OPEN = TCP_ESTABLISHED, 19 DCCP_OPEN = TCP_ESTABLISHED,
@@ -551,6 +319,4 @@ static inline const char *dccp_role(const struct sock *sk)
551 319
552extern void dccp_syn_ack_timeout(struct sock *sk, struct request_sock *req); 320extern void dccp_syn_ack_timeout(struct sock *sk, struct request_sock *req);
553 321
554#endif /* __KERNEL__ */
555
556#endif /* _LINUX_DCCP_H */ 322#endif /* _LINUX_DCCP_H */
diff --git a/include/linux/dlm.h b/include/linux/dlm.h
index 520152411cd1..1d47dcce11e1 100644
--- a/include/linux/dlm.h
+++ b/include/linux/dlm.h
@@ -10,68 +10,11 @@
10** 10**
11******************************************************************************* 11*******************************************************************************
12******************************************************************************/ 12******************************************************************************/
13
14#ifndef __DLM_DOT_H__ 13#ifndef __DLM_DOT_H__
15#define __DLM_DOT_H__ 14#define __DLM_DOT_H__
16 15
17/* 16#include <uapi/linux/dlm.h>
18 * Interface to Distributed Lock Manager (DLM)
19 * routines and structures to use DLM lockspaces
20 */
21
22/* Lock levels and flags are here */
23#include <linux/dlmconstants.h>
24#include <linux/types.h>
25
26typedef void dlm_lockspace_t;
27
28/*
29 * Lock status block
30 *
31 * Use this structure to specify the contents of the lock value block. For a
32 * conversion request, this structure is used to specify the lock ID of the
33 * lock. DLM writes the status of the lock request and the lock ID assigned
34 * to the request in the lock status block.
35 *
36 * sb_lkid: the returned lock ID. It is set on new (non-conversion) requests.
37 * It is available when dlm_lock returns.
38 *
39 * sb_lvbptr: saves or returns the contents of the lock's LVB according to rules
40 * shown for the DLM_LKF_VALBLK flag.
41 *
42 * sb_flags: DLM_SBF_DEMOTED is returned if in the process of promoting a lock,
43 * it was first demoted to NL to avoid conversion deadlock.
44 * DLM_SBF_VALNOTVALID is returned if the resource's LVB is marked invalid.
45 *
46 * sb_status: the returned status of the lock request set prior to AST
47 * execution. Possible return values:
48 *
49 * 0 if lock request was successful
50 * -EAGAIN if request would block and is flagged DLM_LKF_NOQUEUE
51 * -DLM_EUNLOCK if unlock request was successful
52 * -DLM_ECANCEL if a cancel completed successfully
53 * -EDEADLK if a deadlock was detected
54 * -ETIMEDOUT if the lock request was canceled due to a timeout
55 */
56
57#define DLM_SBF_DEMOTED 0x01
58#define DLM_SBF_VALNOTVALID 0x02
59#define DLM_SBF_ALTMODE 0x04
60 17
61struct dlm_lksb {
62 int sb_status;
63 __u32 sb_lkid;
64 char sb_flags;
65 char * sb_lvbptr;
66};
67
68/* dlm_new_lockspace() flags */
69
70#define DLM_LSFL_TIMEWARN 0x00000002
71#define DLM_LSFL_FS 0x00000004
72#define DLM_LSFL_NEWEXCL 0x00000008
73
74#ifdef __KERNEL__
75 18
76struct dlm_slot { 19struct dlm_slot {
77 int nodeid; /* 1 to MAX_INT */ 20 int nodeid; /* 1 to MAX_INT */
@@ -226,7 +169,4 @@ int dlm_unlock(dlm_lockspace_t *lockspace,
226 struct dlm_lksb *lksb, 169 struct dlm_lksb *lksb,
227 void *astarg); 170 void *astarg);
228 171
229#endif /* __KERNEL__ */
230
231#endif /* __DLM_DOT_H__ */ 172#endif /* __DLM_DOT_H__ */
232
diff --git a/include/linux/dlm_plock.h b/include/linux/dlm_plock.h
index 3b1cc1be419f..95ad387a7769 100644
--- a/include/linux/dlm_plock.h
+++ b/include/linux/dlm_plock.h
@@ -5,50 +5,15 @@
5 * modify, copy, or redistribute it subject to the terms and conditions 5 * modify, copy, or redistribute it subject to the terms and conditions
6 * of the GNU General Public License v.2. 6 * of the GNU General Public License v.2.
7 */ 7 */
8
9#ifndef __DLM_PLOCK_DOT_H__ 8#ifndef __DLM_PLOCK_DOT_H__
10#define __DLM_PLOCK_DOT_H__ 9#define __DLM_PLOCK_DOT_H__
11 10
12#include <linux/types.h> 11#include <uapi/linux/dlm_plock.h>
13
14#define DLM_PLOCK_MISC_NAME "dlm_plock"
15
16#define DLM_PLOCK_VERSION_MAJOR 1
17#define DLM_PLOCK_VERSION_MINOR 2
18#define DLM_PLOCK_VERSION_PATCH 0
19
20enum {
21 DLM_PLOCK_OP_LOCK = 1,
22 DLM_PLOCK_OP_UNLOCK,
23 DLM_PLOCK_OP_GET,
24};
25 12
26#define DLM_PLOCK_FL_CLOSE 1
27
28struct dlm_plock_info {
29 __u32 version[3];
30 __u8 optype;
31 __u8 ex;
32 __u8 wait;
33 __u8 flags;
34 __u32 pid;
35 __s32 nodeid;
36 __s32 rv;
37 __u32 fsid;
38 __u64 number;
39 __u64 start;
40 __u64 end;
41 __u64 owner;
42};
43
44#ifdef __KERNEL__
45int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file, 13int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
46 int cmd, struct file_lock *fl); 14 int cmd, struct file_lock *fl);
47int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file, 15int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
48 struct file_lock *fl); 16 struct file_lock *fl);
49int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file, 17int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file,
50 struct file_lock *fl); 18 struct file_lock *fl);
51#endif /* __KERNEL__ */
52
53#endif 19#endif
54
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 9c02a4508b25..d3201e438d16 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -591,7 +591,7 @@ struct dma_device {
591 struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)( 591 struct dma_async_tx_descriptor *(*device_prep_dma_cyclic)(
592 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, 592 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
593 size_t period_len, enum dma_transfer_direction direction, 593 size_t period_len, enum dma_transfer_direction direction,
594 void *context); 594 unsigned long flags, void *context);
595 struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)( 595 struct dma_async_tx_descriptor *(*device_prep_interleaved_dma)(
596 struct dma_chan *chan, struct dma_interleaved_template *xt, 596 struct dma_chan *chan, struct dma_interleaved_template *xt,
597 unsigned long flags); 597 unsigned long flags);
@@ -653,10 +653,11 @@ static inline struct dma_async_tx_descriptor *dmaengine_prep_rio_sg(
653 653
654static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic( 654static inline struct dma_async_tx_descriptor *dmaengine_prep_dma_cyclic(
655 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len, 655 struct dma_chan *chan, dma_addr_t buf_addr, size_t buf_len,
656 size_t period_len, enum dma_transfer_direction dir) 656 size_t period_len, enum dma_transfer_direction dir,
657 unsigned long flags)
657{ 658{
658 return chan->device->device_prep_dma_cyclic(chan, buf_addr, buf_len, 659 return chan->device->device_prep_dma_cyclic(chan, buf_addr, buf_len,
659 period_len, dir, NULL); 660 period_len, dir, flags, NULL);
660} 661}
661 662
662static inline int dmaengine_terminate_all(struct dma_chan *chan) 663static inline int dmaengine_terminate_all(struct dma_chan *chan)
diff --git a/include/linux/dvb/Kbuild b/include/linux/dvb/Kbuild
index f4dba8637f98..e69de29bb2d1 100644
--- a/include/linux/dvb/Kbuild
+++ b/include/linux/dvb/Kbuild
@@ -1,8 +0,0 @@
1header-y += audio.h
2header-y += ca.h
3header-y += dmx.h
4header-y += frontend.h
5header-y += net.h
6header-y += osd.h
7header-y += version.h
8header-y += video.h
diff --git a/include/linux/dvb/dmx.h b/include/linux/dvb/dmx.h
index f078f3ac82d4..0be6d8f2b52b 100644
--- a/include/linux/dvb/dmx.h
+++ b/include/linux/dvb/dmx.h
@@ -20,138 +20,10 @@
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 * 21 *
22 */ 22 */
23
24#ifndef _DVBDMX_H_ 23#ifndef _DVBDMX_H_
25#define _DVBDMX_H_ 24#define _DVBDMX_H_
26 25
27#include <linux/types.h>
28#ifdef __KERNEL__
29#include <linux/time.h> 26#include <linux/time.h>
30#else 27#include <uapi/linux/dvb/dmx.h>
31#include <time.h>
32#endif
33
34
35#define DMX_FILTER_SIZE 16
36
37typedef enum
38{
39 DMX_OUT_DECODER, /* Streaming directly to decoder. */
40 DMX_OUT_TAP, /* Output going to a memory buffer */
41 /* (to be retrieved via the read command).*/
42 DMX_OUT_TS_TAP, /* Output multiplexed into a new TS */
43 /* (to be retrieved by reading from the */
44 /* logical DVR device). */
45 DMX_OUT_TSDEMUX_TAP /* Like TS_TAP but retrieved from the DMX device */
46} dmx_output_t;
47
48
49typedef enum
50{
51 DMX_IN_FRONTEND, /* Input from a front-end device. */
52 DMX_IN_DVR /* Input from the logical DVR device. */
53} dmx_input_t;
54
55
56typedef enum
57{
58 DMX_PES_AUDIO0,
59 DMX_PES_VIDEO0,
60 DMX_PES_TELETEXT0,
61 DMX_PES_SUBTITLE0,
62 DMX_PES_PCR0,
63
64 DMX_PES_AUDIO1,
65 DMX_PES_VIDEO1,
66 DMX_PES_TELETEXT1,
67 DMX_PES_SUBTITLE1,
68 DMX_PES_PCR1,
69
70 DMX_PES_AUDIO2,
71 DMX_PES_VIDEO2,
72 DMX_PES_TELETEXT2,
73 DMX_PES_SUBTITLE2,
74 DMX_PES_PCR2,
75
76 DMX_PES_AUDIO3,
77 DMX_PES_VIDEO3,
78 DMX_PES_TELETEXT3,
79 DMX_PES_SUBTITLE3,
80 DMX_PES_PCR3,
81
82 DMX_PES_OTHER
83} dmx_pes_type_t;
84
85#define DMX_PES_AUDIO DMX_PES_AUDIO0
86#define DMX_PES_VIDEO DMX_PES_VIDEO0
87#define DMX_PES_TELETEXT DMX_PES_TELETEXT0
88#define DMX_PES_SUBTITLE DMX_PES_SUBTITLE0
89#define DMX_PES_PCR DMX_PES_PCR0
90
91
92typedef struct dmx_filter
93{
94 __u8 filter[DMX_FILTER_SIZE];
95 __u8 mask[DMX_FILTER_SIZE];
96 __u8 mode[DMX_FILTER_SIZE];
97} dmx_filter_t;
98
99
100struct dmx_sct_filter_params
101{
102 __u16 pid;
103 dmx_filter_t filter;
104 __u32 timeout;
105 __u32 flags;
106#define DMX_CHECK_CRC 1
107#define DMX_ONESHOT 2
108#define DMX_IMMEDIATE_START 4
109#define DMX_KERNEL_CLIENT 0x8000
110};
111
112
113struct dmx_pes_filter_params
114{
115 __u16 pid;
116 dmx_input_t input;
117 dmx_output_t output;
118 dmx_pes_type_t pes_type;
119 __u32 flags;
120};
121
122typedef struct dmx_caps {
123 __u32 caps;
124 int num_decoders;
125} dmx_caps_t;
126
127typedef enum {
128 DMX_SOURCE_FRONT0 = 0,
129 DMX_SOURCE_FRONT1,
130 DMX_SOURCE_FRONT2,
131 DMX_SOURCE_FRONT3,
132 DMX_SOURCE_DVR0 = 16,
133 DMX_SOURCE_DVR1,
134 DMX_SOURCE_DVR2,
135 DMX_SOURCE_DVR3
136} dmx_source_t;
137
138struct dmx_stc {
139 unsigned int num; /* input : which STC? 0..N */
140 unsigned int base; /* output: divisor for stc to get 90 kHz clock */
141 __u64 stc; /* output: stc in 'base'*90 kHz units */
142};
143
144
145#define DMX_START _IO('o', 41)
146#define DMX_STOP _IO('o', 42)
147#define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params)
148#define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params)
149#define DMX_SET_BUFFER_SIZE _IO('o', 45)
150#define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5])
151#define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t)
152#define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t)
153#define DMX_GET_STC _IOWR('o', 50, struct dmx_stc)
154#define DMX_ADD_PID _IOW('o', 51, __u16)
155#define DMX_REMOVE_PID _IOW('o', 52, __u16)
156 28
157#endif /*_DVBDMX_H_*/ 29#endif /*_DVBDMX_H_*/
diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h
index 1d750c0fd86e..85c20d925696 100644
--- a/include/linux/dvb/video.h
+++ b/include/linux/dvb/video.h
@@ -20,257 +20,10 @@
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 * 21 *
22 */ 22 */
23
24#ifndef _DVBVIDEO_H_ 23#ifndef _DVBVIDEO_H_
25#define _DVBVIDEO_H_ 24#define _DVBVIDEO_H_
26 25
27#include <linux/types.h>
28#ifdef __KERNEL__
29#include <linux/compiler.h> 26#include <linux/compiler.h>
30#else 27#include <uapi/linux/dvb/video.h>
31#include <stdint.h>
32#include <time.h>
33#endif
34
35typedef enum {
36 VIDEO_FORMAT_4_3, /* Select 4:3 format */
37 VIDEO_FORMAT_16_9, /* Select 16:9 format. */
38 VIDEO_FORMAT_221_1 /* 2.21:1 */
39} video_format_t;
40
41
42typedef enum {
43 VIDEO_SYSTEM_PAL,
44 VIDEO_SYSTEM_NTSC,
45 VIDEO_SYSTEM_PALN,
46 VIDEO_SYSTEM_PALNc,
47 VIDEO_SYSTEM_PALM,
48 VIDEO_SYSTEM_NTSC60,
49 VIDEO_SYSTEM_PAL60,
50 VIDEO_SYSTEM_PALM60
51} video_system_t;
52
53
54typedef enum {
55 VIDEO_PAN_SCAN, /* use pan and scan format */
56 VIDEO_LETTER_BOX, /* use letterbox format */
57 VIDEO_CENTER_CUT_OUT /* use center cut out format */
58} video_displayformat_t;
59
60typedef struct {
61 int w;
62 int h;
63 video_format_t aspect_ratio;
64} video_size_t;
65
66typedef enum {
67 VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */
68 VIDEO_SOURCE_MEMORY /* If this source is selected, the stream
69 comes from the user through the write
70 system call */
71} video_stream_source_t;
72
73
74typedef enum {
75 VIDEO_STOPPED, /* Video is stopped */
76 VIDEO_PLAYING, /* Video is currently playing */
77 VIDEO_FREEZED /* Video is freezed */
78} video_play_state_t;
79
80
81/* Decoder commands */
82#define VIDEO_CMD_PLAY (0)
83#define VIDEO_CMD_STOP (1)
84#define VIDEO_CMD_FREEZE (2)
85#define VIDEO_CMD_CONTINUE (3)
86
87/* Flags for VIDEO_CMD_FREEZE */
88#define VIDEO_CMD_FREEZE_TO_BLACK (1 << 0)
89
90/* Flags for VIDEO_CMD_STOP */
91#define VIDEO_CMD_STOP_TO_BLACK (1 << 0)
92#define VIDEO_CMD_STOP_IMMEDIATELY (1 << 1)
93
94/* Play input formats: */
95/* The decoder has no special format requirements */
96#define VIDEO_PLAY_FMT_NONE (0)
97/* The decoder requires full GOPs */
98#define VIDEO_PLAY_FMT_GOP (1)
99
100/* The structure must be zeroed before use by the application
101 This ensures it can be extended safely in the future. */
102struct video_command {
103 __u32 cmd;
104 __u32 flags;
105 union {
106 struct {
107 __u64 pts;
108 } stop;
109
110 struct {
111 /* 0 or 1000 specifies normal speed,
112 1 specifies forward single stepping,
113 -1 specifies backward single stepping,
114 >1: playback at speed/1000 of the normal speed,
115 <-1: reverse playback at (-speed/1000) of the normal speed. */
116 __s32 speed;
117 __u32 format;
118 } play;
119
120 struct {
121 __u32 data[16];
122 } raw;
123 };
124};
125
126/* FIELD_UNKNOWN can be used if the hardware does not know whether
127 the Vsync is for an odd, even or progressive (i.e. non-interlaced)
128 field. */
129#define VIDEO_VSYNC_FIELD_UNKNOWN (0)
130#define VIDEO_VSYNC_FIELD_ODD (1)
131#define VIDEO_VSYNC_FIELD_EVEN (2)
132#define VIDEO_VSYNC_FIELD_PROGRESSIVE (3)
133
134struct video_event {
135 __s32 type;
136#define VIDEO_EVENT_SIZE_CHANGED 1
137#define VIDEO_EVENT_FRAME_RATE_CHANGED 2
138#define VIDEO_EVENT_DECODER_STOPPED 3
139#define VIDEO_EVENT_VSYNC 4
140 __kernel_time_t timestamp;
141 union {
142 video_size_t size;
143 unsigned int frame_rate; /* in frames per 1000sec */
144 unsigned char vsync_field; /* unknown/odd/even/progressive */
145 } u;
146};
147
148
149struct video_status {
150 int video_blank; /* blank video on freeze? */
151 video_play_state_t play_state; /* current state of playback */
152 video_stream_source_t stream_source; /* current source (demux/memory) */
153 video_format_t video_format; /* current aspect ratio of stream*/
154 video_displayformat_t display_format;/* selected cropping mode */
155};
156
157
158struct video_still_picture {
159 char __user *iFrame; /* pointer to a single iframe in memory */
160 __s32 size;
161};
162
163
164typedef
165struct video_highlight {
166 int active; /* 1=show highlight, 0=hide highlight */
167 __u8 contrast1; /* 7- 4 Pattern pixel contrast */
168 /* 3- 0 Background pixel contrast */
169 __u8 contrast2; /* 7- 4 Emphasis pixel-2 contrast */
170 /* 3- 0 Emphasis pixel-1 contrast */
171 __u8 color1; /* 7- 4 Pattern pixel color */
172 /* 3- 0 Background pixel color */
173 __u8 color2; /* 7- 4 Emphasis pixel-2 color */
174 /* 3- 0 Emphasis pixel-1 color */
175 __u32 ypos; /* 23-22 auto action mode */
176 /* 21-12 start y */
177 /* 9- 0 end y */
178 __u32 xpos; /* 23-22 button color number */
179 /* 21-12 start x */
180 /* 9- 0 end x */
181} video_highlight_t;
182
183
184typedef struct video_spu {
185 int active;
186 int stream_id;
187} video_spu_t;
188
189
190typedef struct video_spu_palette { /* SPU Palette information */
191 int length;
192 __u8 __user *palette;
193} video_spu_palette_t;
194
195
196typedef struct video_navi_pack {
197 int length; /* 0 ... 1024 */
198 __u8 data[1024];
199} video_navi_pack_t;
200
201
202typedef __u16 video_attributes_t;
203/* bits: descr. */
204/* 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */
205/* 13-12 TV system (0=525/60, 1=625/50) */
206/* 11-10 Aspect ratio (0=4:3, 3=16:9) */
207/* 9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca */
208/* 7 line 21-1 data present in GOP (1=yes, 0=no) */
209/* 6 line 21-2 data present in GOP (1=yes, 0=no) */
210/* 5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */
211/* 2 source letterboxed (1=yes, 0=no) */
212/* 0 film/camera mode (0=camera, 1=film (625/50 only)) */
213
214
215/* bit definitions for capabilities: */
216/* can the hardware decode MPEG1 and/or MPEG2? */
217#define VIDEO_CAP_MPEG1 1
218#define VIDEO_CAP_MPEG2 2
219/* can you send a system and/or program stream to video device?
220 (you still have to open the video and the audio device but only
221 send the stream to the video device) */
222#define VIDEO_CAP_SYS 4
223#define VIDEO_CAP_PROG 8
224/* can the driver also handle SPU, NAVI and CSS encoded data?
225 (CSS API is not present yet) */
226#define VIDEO_CAP_SPU 16
227#define VIDEO_CAP_NAVI 32
228#define VIDEO_CAP_CSS 64
229
230
231#define VIDEO_STOP _IO('o', 21)
232#define VIDEO_PLAY _IO('o', 22)
233#define VIDEO_FREEZE _IO('o', 23)
234#define VIDEO_CONTINUE _IO('o', 24)
235#define VIDEO_SELECT_SOURCE _IO('o', 25)
236#define VIDEO_SET_BLANK _IO('o', 26)
237#define VIDEO_GET_STATUS _IOR('o', 27, struct video_status)
238#define VIDEO_GET_EVENT _IOR('o', 28, struct video_event)
239#define VIDEO_SET_DISPLAY_FORMAT _IO('o', 29)
240#define VIDEO_STILLPICTURE _IOW('o', 30, struct video_still_picture)
241#define VIDEO_FAST_FORWARD _IO('o', 31)
242#define VIDEO_SLOWMOTION _IO('o', 32)
243#define VIDEO_GET_CAPABILITIES _IOR('o', 33, unsigned int)
244#define VIDEO_CLEAR_BUFFER _IO('o', 34)
245#define VIDEO_SET_ID _IO('o', 35)
246#define VIDEO_SET_STREAMTYPE _IO('o', 36)
247#define VIDEO_SET_FORMAT _IO('o', 37)
248#define VIDEO_SET_SYSTEM _IO('o', 38)
249#define VIDEO_SET_HIGHLIGHT _IOW('o', 39, video_highlight_t)
250#define VIDEO_SET_SPU _IOW('o', 50, video_spu_t)
251#define VIDEO_SET_SPU_PALETTE _IOW('o', 51, video_spu_palette_t)
252#define VIDEO_GET_NAVI _IOR('o', 52, video_navi_pack_t)
253#define VIDEO_SET_ATTRIBUTES _IO('o', 53)
254#define VIDEO_GET_SIZE _IOR('o', 55, video_size_t)
255#define VIDEO_GET_FRAME_RATE _IOR('o', 56, unsigned int)
256
257/**
258 * VIDEO_GET_PTS
259 *
260 * Read the 33 bit presentation time stamp as defined
261 * in ITU T-REC-H.222.0 / ISO/IEC 13818-1.
262 *
263 * The PTS should belong to the currently played
264 * frame if possible, but may also be a value close to it
265 * like the PTS of the last decoded frame or the last PTS
266 * extracted by the PES parser.
267 */
268#define VIDEO_GET_PTS _IOR('o', 57, __u64)
269
270/* Read the number of displayed frames since the decoder was started */
271#define VIDEO_GET_FRAME_COUNT _IOR('o', 58, __u64)
272
273#define VIDEO_COMMAND _IOWR('o', 59, struct video_command)
274#define VIDEO_TRY_COMMAND _IOWR('o', 60, struct video_command)
275 28
276#endif /*_DVBVIDEO_H_*/ 29#endif /*_DVBVIDEO_H_*/
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
index 2412e02d7c0f..e1c8c9e919ac 100644
--- a/include/linux/dw_dmac.h
+++ b/include/linux/dw_dmac.h
@@ -19,6 +19,10 @@
19 * @nr_channels: Number of channels supported by hardware (max 8) 19 * @nr_channels: Number of channels supported by hardware (max 8)
20 * @is_private: The device channels should be marked as private and not for 20 * @is_private: The device channels should be marked as private and not for
21 * by the general purpose DMA channel allocator. 21 * by the general purpose DMA channel allocator.
22 * @block_size: Maximum block size supported by the controller
23 * @nr_masters: Number of AHB masters supported by the controller
24 * @data_width: Maximum data width supported by hardware per AHB master
25 * (0 - 8bits, 1 - 16bits, ..., 5 - 256bits)
22 */ 26 */
23struct dw_dma_platform_data { 27struct dw_dma_platform_data {
24 unsigned int nr_channels; 28 unsigned int nr_channels;
@@ -29,6 +33,9 @@ struct dw_dma_platform_data {
29#define CHAN_PRIORITY_ASCENDING 0 /* chan0 highest */ 33#define CHAN_PRIORITY_ASCENDING 0 /* chan0 highest */
30#define CHAN_PRIORITY_DESCENDING 1 /* chan7 highest */ 34#define CHAN_PRIORITY_DESCENDING 1 /* chan7 highest */
31 unsigned char chan_priority; 35 unsigned char chan_priority;
36 unsigned short block_size;
37 unsigned char nr_masters;
38 unsigned char data_width[4];
32}; 39};
33 40
34/* bursts size */ 41/* bursts size */
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index c18257b0fa72..6dd4787a798a 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -61,7 +61,7 @@ int __dynamic_netdev_dbg(struct _ddebug *descriptor,
61 const char *fmt, ...); 61 const char *fmt, ...);
62 62
63#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \ 63#define DEFINE_DYNAMIC_DEBUG_METADATA(name, fmt) \
64 static struct _ddebug __used __aligned(8) \ 64 static struct _ddebug __aligned(8) \
65 __attribute__((section("__verbose"))) name = { \ 65 __attribute__((section("__verbose"))) name = { \
66 .modname = KBUILD_MODNAME, \ 66 .modname = KBUILD_MODNAME, \
67 .function = __func__, \ 67 .function = __func__, \
diff --git a/include/linux/edd.h b/include/linux/edd.h
index 4cbd0fe9df08..83d4371ec996 100644
--- a/include/linux/edd.h
+++ b/include/linux/edd.h
@@ -30,165 +30,9 @@
30#ifndef _LINUX_EDD_H 30#ifndef _LINUX_EDD_H
31#define _LINUX_EDD_H 31#define _LINUX_EDD_H
32 32
33#include <linux/types.h> 33#include <uapi/linux/edd.h>
34
35#define EDDNR 0x1e9 /* addr of number of edd_info structs at EDDBUF
36 in boot_params - treat this as 1 byte */
37#define EDDBUF 0xd00 /* addr of edd_info structs in boot_params */
38#define EDDMAXNR 6 /* number of edd_info structs starting at EDDBUF */
39#define EDDEXTSIZE 8 /* change these if you muck with the structures */
40#define EDDPARMSIZE 74
41#define CHECKEXTENSIONSPRESENT 0x41
42#define GETDEVICEPARAMETERS 0x48
43#define LEGACYGETDEVICEPARAMETERS 0x08
44#define EDDMAGIC1 0x55AA
45#define EDDMAGIC2 0xAA55
46
47
48#define READ_SECTORS 0x02 /* int13 AH=0x02 is READ_SECTORS command */
49#define EDD_MBR_SIG_OFFSET 0x1B8 /* offset of signature in the MBR */
50#define EDD_MBR_SIG_BUF 0x290 /* addr in boot params */
51#define EDD_MBR_SIG_MAX 16 /* max number of signatures to store */
52#define EDD_MBR_SIG_NR_BUF 0x1ea /* addr of number of MBR signtaures at EDD_MBR_SIG_BUF
53 in boot_params - treat this as 1 byte */
54 34
55#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
56
57#define EDD_EXT_FIXED_DISK_ACCESS (1 << 0)
58#define EDD_EXT_DEVICE_LOCKING_AND_EJECTING (1 << 1)
59#define EDD_EXT_ENHANCED_DISK_DRIVE_SUPPORT (1 << 2)
60#define EDD_EXT_64BIT_EXTENSIONS (1 << 3)
61
62#define EDD_INFO_DMA_BOUNDARY_ERROR_TRANSPARENT (1 << 0)
63#define EDD_INFO_GEOMETRY_VALID (1 << 1)
64#define EDD_INFO_REMOVABLE (1 << 2)
65#define EDD_INFO_WRITE_VERIFY (1 << 3)
66#define EDD_INFO_MEDIA_CHANGE_NOTIFICATION (1 << 4)
67#define EDD_INFO_LOCKABLE (1 << 5)
68#define EDD_INFO_NO_MEDIA_PRESENT (1 << 6)
69#define EDD_INFO_USE_INT13_FN50 (1 << 7)
70
71struct edd_device_params {
72 __u16 length;
73 __u16 info_flags;
74 __u32 num_default_cylinders;
75 __u32 num_default_heads;
76 __u32 sectors_per_track;
77 __u64 number_of_sectors;
78 __u16 bytes_per_sector;
79 __u32 dpte_ptr; /* 0xFFFFFFFF for our purposes */
80 __u16 key; /* = 0xBEDD */
81 __u8 device_path_info_length; /* = 44 */
82 __u8 reserved2;
83 __u16 reserved3;
84 __u8 host_bus_type[4];
85 __u8 interface_type[8];
86 union {
87 struct {
88 __u16 base_address;
89 __u16 reserved1;
90 __u32 reserved2;
91 } __attribute__ ((packed)) isa;
92 struct {
93 __u8 bus;
94 __u8 slot;
95 __u8 function;
96 __u8 channel;
97 __u32 reserved;
98 } __attribute__ ((packed)) pci;
99 /* pcix is same as pci */
100 struct {
101 __u64 reserved;
102 } __attribute__ ((packed)) ibnd;
103 struct {
104 __u64 reserved;
105 } __attribute__ ((packed)) xprs;
106 struct {
107 __u64 reserved;
108 } __attribute__ ((packed)) htpt;
109 struct {
110 __u64 reserved;
111 } __attribute__ ((packed)) unknown;
112 } interface_path;
113 union {
114 struct {
115 __u8 device;
116 __u8 reserved1;
117 __u16 reserved2;
118 __u32 reserved3;
119 __u64 reserved4;
120 } __attribute__ ((packed)) ata;
121 struct {
122 __u8 device;
123 __u8 lun;
124 __u8 reserved1;
125 __u8 reserved2;
126 __u32 reserved3;
127 __u64 reserved4;
128 } __attribute__ ((packed)) atapi;
129 struct {
130 __u16 id;
131 __u64 lun;
132 __u16 reserved1;
133 __u32 reserved2;
134 } __attribute__ ((packed)) scsi;
135 struct {
136 __u64 serial_number;
137 __u64 reserved;
138 } __attribute__ ((packed)) usb;
139 struct {
140 __u64 eui;
141 __u64 reserved;
142 } __attribute__ ((packed)) i1394;
143 struct {
144 __u64 wwid;
145 __u64 lun;
146 } __attribute__ ((packed)) fibre;
147 struct {
148 __u64 identity_tag;
149 __u64 reserved;
150 } __attribute__ ((packed)) i2o;
151 struct {
152 __u32 array_number;
153 __u32 reserved1;
154 __u64 reserved2;
155 } __attribute__ ((packed)) raid;
156 struct {
157 __u8 device;
158 __u8 reserved1;
159 __u16 reserved2;
160 __u32 reserved3;
161 __u64 reserved4;
162 } __attribute__ ((packed)) sata;
163 struct {
164 __u64 reserved1;
165 __u64 reserved2;
166 } __attribute__ ((packed)) unknown;
167 } device_path;
168 __u8 reserved4;
169 __u8 checksum;
170} __attribute__ ((packed));
171
172struct edd_info {
173 __u8 device;
174 __u8 version;
175 __u16 interface_support;
176 __u16 legacy_max_cylinder;
177 __u8 legacy_max_head;
178 __u8 legacy_sectors_per_track;
179 struct edd_device_params params;
180} __attribute__ ((packed));
181
182struct edd {
183 unsigned int mbr_signature[EDD_MBR_SIG_MAX];
184 struct edd_info edd_info[EDDMAXNR];
185 unsigned char mbr_signature_nr;
186 unsigned char edd_info_nr;
187};
188
189#ifdef __KERNEL__
190extern struct edd edd; 36extern struct edd edd;
191#endif /* __KERNEL__ */
192#endif /*!__ASSEMBLY__ */ 37#endif /*!__ASSEMBLY__ */
193
194#endif /* _LINUX_EDD_H */ 38#endif /* _LINUX_EDD_H */
diff --git a/include/linux/edma.h b/include/linux/edma.h
new file mode 100644
index 000000000000..a1307e7827e8
--- /dev/null
+++ b/include/linux/edma.h
@@ -0,0 +1,29 @@
1/*
2 * TI EDMA DMA engine driver
3 *
4 * Copyright 2012 Texas Instruments
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#ifndef __LINUX_EDMA_H
16#define __LINUX_EDMA_H
17
18struct dma_chan;
19
20#if defined(CONFIG_TI_EDMA) || defined(CONFIG_TI_EDMA_MODULE)
21bool edma_filter_fn(struct dma_chan *, void *);
22#else
23static inline bool edma_filter_fn(struct dma_chan *chan, void *param)
24{
25 return false;
26}
27#endif
28
29#endif
diff --git a/include/linux/elf-fdpic.h b/include/linux/elf-fdpic.h
index 7cd2e80cebc8..386440317b0c 100644
--- a/include/linux/elf-fdpic.h
+++ b/include/linux/elf-fdpic.h
@@ -1,4 +1,4 @@
1/* elf-fdpic.h: FDPIC ELF load map 1/* FDPIC ELF load map
2 * 2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -12,24 +12,7 @@
12#ifndef _LINUX_ELF_FDPIC_H 12#ifndef _LINUX_ELF_FDPIC_H
13#define _LINUX_ELF_FDPIC_H 13#define _LINUX_ELF_FDPIC_H
14 14
15#include <linux/elf.h> 15#include <uapi/linux/elf-fdpic.h>
16
17#define PT_GNU_STACK (PT_LOOS + 0x474e551)
18
19/* segment mappings for ELF FDPIC libraries/executables/interpreters */
20struct elf32_fdpic_loadseg {
21 Elf32_Addr addr; /* core address to which mapped */
22 Elf32_Addr p_vaddr; /* VMA recorded in file */
23 Elf32_Word p_memsz; /* allocation size recorded in file */
24};
25
26struct elf32_fdpic_loadmap {
27 Elf32_Half version; /* version of these structures, just in case... */
28 Elf32_Half nsegs; /* number of segments */
29 struct elf32_fdpic_loadseg segs[];
30};
31
32#define ELF32_FDPIC_LOADMAP_VERSION 0x0000
33 16
34/* 17/*
35 * binfmt binary parameters structure 18 * binfmt binary parameters structure
@@ -58,13 +41,11 @@ struct elf_fdpic_params {
58#define ELF_FDPIC_FLAG_PRESENT 0x80000000 /* T if this object is present */ 41#define ELF_FDPIC_FLAG_PRESENT 0x80000000 /* T if this object is present */
59}; 42};
60 43
61#ifdef __KERNEL__
62#ifdef CONFIG_MMU 44#ifdef CONFIG_MMU
63extern void elf_fdpic_arch_lay_out_mm(struct elf_fdpic_params *exec_params, 45extern void elf_fdpic_arch_lay_out_mm(struct elf_fdpic_params *exec_params,
64 struct elf_fdpic_params *interp_params, 46 struct elf_fdpic_params *interp_params,
65 unsigned long *start_stack, 47 unsigned long *start_stack,
66 unsigned long *start_brk); 48 unsigned long *start_brk);
67#endif 49#endif
68#endif /* __KERNEL__ */
69 50
70#endif /* _LINUX_ELF_FDPIC_H */ 51#endif /* _LINUX_ELF_FDPIC_H */
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 0a05051a8924..8c9048e33463 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -1,414 +1,9 @@
1#ifndef _LINUX_ELF_H 1#ifndef _LINUX_ELF_H
2#define _LINUX_ELF_H 2#define _LINUX_ELF_H
3 3
4#include <linux/types.h>
5#include <linux/elf-em.h>
6#ifdef __KERNEL__
7#include <asm/elf.h> 4#include <asm/elf.h>
8#endif 5#include <uapi/linux/elf.h>
9
10/* 32-bit ELF base types. */
11typedef __u32 Elf32_Addr;
12typedef __u16 Elf32_Half;
13typedef __u32 Elf32_Off;
14typedef __s32 Elf32_Sword;
15typedef __u32 Elf32_Word;
16
17/* 64-bit ELF base types. */
18typedef __u64 Elf64_Addr;
19typedef __u16 Elf64_Half;
20typedef __s16 Elf64_SHalf;
21typedef __u64 Elf64_Off;
22typedef __s32 Elf64_Sword;
23typedef __u32 Elf64_Word;
24typedef __u64 Elf64_Xword;
25typedef __s64 Elf64_Sxword;
26
27/* These constants are for the segment types stored in the image headers */
28#define PT_NULL 0
29#define PT_LOAD 1
30#define PT_DYNAMIC 2
31#define PT_INTERP 3
32#define PT_NOTE 4
33#define PT_SHLIB 5
34#define PT_PHDR 6
35#define PT_TLS 7 /* Thread local storage segment */
36#define PT_LOOS 0x60000000 /* OS-specific */
37#define PT_HIOS 0x6fffffff /* OS-specific */
38#define PT_LOPROC 0x70000000
39#define PT_HIPROC 0x7fffffff
40#define PT_GNU_EH_FRAME 0x6474e550
41
42#define PT_GNU_STACK (PT_LOOS + 0x474e551)
43
44/*
45 * Extended Numbering
46 *
47 * If the real number of program header table entries is larger than
48 * or equal to PN_XNUM(0xffff), it is set to sh_info field of the
49 * section header at index 0, and PN_XNUM is set to e_phnum
50 * field. Otherwise, the section header at index 0 is zero
51 * initialized, if it exists.
52 *
53 * Specifications are available in:
54 *
55 * - Sun microsystems: Linker and Libraries.
56 * Part No: 817-1984-17, September 2008.
57 * URL: http://docs.sun.com/app/docs/doc/817-1984
58 *
59 * - System V ABI AMD64 Architecture Processor Supplement
60 * Draft Version 0.99.,
61 * May 11, 2009.
62 * URL: http://www.x86-64.org/
63 */
64#define PN_XNUM 0xffff
65
66/* These constants define the different elf file types */
67#define ET_NONE 0
68#define ET_REL 1
69#define ET_EXEC 2
70#define ET_DYN 3
71#define ET_CORE 4
72#define ET_LOPROC 0xff00
73#define ET_HIPROC 0xffff
74
75/* This is the info that is needed to parse the dynamic section of the file */
76#define DT_NULL 0
77#define DT_NEEDED 1
78#define DT_PLTRELSZ 2
79#define DT_PLTGOT 3
80#define DT_HASH 4
81#define DT_STRTAB 5
82#define DT_SYMTAB 6
83#define DT_RELA 7
84#define DT_RELASZ 8
85#define DT_RELAENT 9
86#define DT_STRSZ 10
87#define DT_SYMENT 11
88#define DT_INIT 12
89#define DT_FINI 13
90#define DT_SONAME 14
91#define DT_RPATH 15
92#define DT_SYMBOLIC 16
93#define DT_REL 17
94#define DT_RELSZ 18
95#define DT_RELENT 19
96#define DT_PLTREL 20
97#define DT_DEBUG 21
98#define DT_TEXTREL 22
99#define DT_JMPREL 23
100#define DT_ENCODING 32
101#define OLD_DT_LOOS 0x60000000
102#define DT_LOOS 0x6000000d
103#define DT_HIOS 0x6ffff000
104#define DT_VALRNGLO 0x6ffffd00
105#define DT_VALRNGHI 0x6ffffdff
106#define DT_ADDRRNGLO 0x6ffffe00
107#define DT_ADDRRNGHI 0x6ffffeff
108#define DT_VERSYM 0x6ffffff0
109#define DT_RELACOUNT 0x6ffffff9
110#define DT_RELCOUNT 0x6ffffffa
111#define DT_FLAGS_1 0x6ffffffb
112#define DT_VERDEF 0x6ffffffc
113#define DT_VERDEFNUM 0x6ffffffd
114#define DT_VERNEED 0x6ffffffe
115#define DT_VERNEEDNUM 0x6fffffff
116#define OLD_DT_HIOS 0x6fffffff
117#define DT_LOPROC 0x70000000
118#define DT_HIPROC 0x7fffffff
119
120/* This info is needed when parsing the symbol table */
121#define STB_LOCAL 0
122#define STB_GLOBAL 1
123#define STB_WEAK 2
124
125#define STT_NOTYPE 0
126#define STT_OBJECT 1
127#define STT_FUNC 2
128#define STT_SECTION 3
129#define STT_FILE 4
130#define STT_COMMON 5
131#define STT_TLS 6
132
133#define ELF_ST_BIND(x) ((x) >> 4)
134#define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf)
135#define ELF32_ST_BIND(x) ELF_ST_BIND(x)
136#define ELF32_ST_TYPE(x) ELF_ST_TYPE(x)
137#define ELF64_ST_BIND(x) ELF_ST_BIND(x)
138#define ELF64_ST_TYPE(x) ELF_ST_TYPE(x)
139
140typedef struct dynamic{
141 Elf32_Sword d_tag;
142 union{
143 Elf32_Sword d_val;
144 Elf32_Addr d_ptr;
145 } d_un;
146} Elf32_Dyn;
147
148typedef struct {
149 Elf64_Sxword d_tag; /* entry tag value */
150 union {
151 Elf64_Xword d_val;
152 Elf64_Addr d_ptr;
153 } d_un;
154} Elf64_Dyn;
155
156/* The following are used with relocations */
157#define ELF32_R_SYM(x) ((x) >> 8)
158#define ELF32_R_TYPE(x) ((x) & 0xff)
159
160#define ELF64_R_SYM(i) ((i) >> 32)
161#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
162
163typedef struct elf32_rel {
164 Elf32_Addr r_offset;
165 Elf32_Word r_info;
166} Elf32_Rel;
167
168typedef struct elf64_rel {
169 Elf64_Addr r_offset; /* Location at which to apply the action */
170 Elf64_Xword r_info; /* index and type of relocation */
171} Elf64_Rel;
172
173typedef struct elf32_rela{
174 Elf32_Addr r_offset;
175 Elf32_Word r_info;
176 Elf32_Sword r_addend;
177} Elf32_Rela;
178
179typedef struct elf64_rela {
180 Elf64_Addr r_offset; /* Location at which to apply the action */
181 Elf64_Xword r_info; /* index and type of relocation */
182 Elf64_Sxword r_addend; /* Constant addend used to compute value */
183} Elf64_Rela;
184
185typedef struct elf32_sym{
186 Elf32_Word st_name;
187 Elf32_Addr st_value;
188 Elf32_Word st_size;
189 unsigned char st_info;
190 unsigned char st_other;
191 Elf32_Half st_shndx;
192} Elf32_Sym;
193
194typedef struct elf64_sym {
195 Elf64_Word st_name; /* Symbol name, index in string tbl */
196 unsigned char st_info; /* Type and binding attributes */
197 unsigned char st_other; /* No defined meaning, 0 */
198 Elf64_Half st_shndx; /* Associated section index */
199 Elf64_Addr st_value; /* Value of the symbol */
200 Elf64_Xword st_size; /* Associated symbol size */
201} Elf64_Sym;
202
203
204#define EI_NIDENT 16
205
206typedef struct elf32_hdr{
207 unsigned char e_ident[EI_NIDENT];
208 Elf32_Half e_type;
209 Elf32_Half e_machine;
210 Elf32_Word e_version;
211 Elf32_Addr e_entry; /* Entry point */
212 Elf32_Off e_phoff;
213 Elf32_Off e_shoff;
214 Elf32_Word e_flags;
215 Elf32_Half e_ehsize;
216 Elf32_Half e_phentsize;
217 Elf32_Half e_phnum;
218 Elf32_Half e_shentsize;
219 Elf32_Half e_shnum;
220 Elf32_Half e_shstrndx;
221} Elf32_Ehdr;
222
223typedef struct elf64_hdr {
224 unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */
225 Elf64_Half e_type;
226 Elf64_Half e_machine;
227 Elf64_Word e_version;
228 Elf64_Addr e_entry; /* Entry point virtual address */
229 Elf64_Off e_phoff; /* Program header table file offset */
230 Elf64_Off e_shoff; /* Section header table file offset */
231 Elf64_Word e_flags;
232 Elf64_Half e_ehsize;
233 Elf64_Half e_phentsize;
234 Elf64_Half e_phnum;
235 Elf64_Half e_shentsize;
236 Elf64_Half e_shnum;
237 Elf64_Half e_shstrndx;
238} Elf64_Ehdr;
239
240/* These constants define the permissions on sections in the program
241 header, p_flags. */
242#define PF_R 0x4
243#define PF_W 0x2
244#define PF_X 0x1
245
246typedef struct elf32_phdr{
247 Elf32_Word p_type;
248 Elf32_Off p_offset;
249 Elf32_Addr p_vaddr;
250 Elf32_Addr p_paddr;
251 Elf32_Word p_filesz;
252 Elf32_Word p_memsz;
253 Elf32_Word p_flags;
254 Elf32_Word p_align;
255} Elf32_Phdr;
256
257typedef struct elf64_phdr {
258 Elf64_Word p_type;
259 Elf64_Word p_flags;
260 Elf64_Off p_offset; /* Segment file offset */
261 Elf64_Addr p_vaddr; /* Segment virtual address */
262 Elf64_Addr p_paddr; /* Segment physical address */
263 Elf64_Xword p_filesz; /* Segment size in file */
264 Elf64_Xword p_memsz; /* Segment size in memory */
265 Elf64_Xword p_align; /* Segment alignment, file & memory */
266} Elf64_Phdr;
267
268/* sh_type */
269#define SHT_NULL 0
270#define SHT_PROGBITS 1
271#define SHT_SYMTAB 2
272#define SHT_STRTAB 3
273#define SHT_RELA 4
274#define SHT_HASH 5
275#define SHT_DYNAMIC 6
276#define SHT_NOTE 7
277#define SHT_NOBITS 8
278#define SHT_REL 9
279#define SHT_SHLIB 10
280#define SHT_DYNSYM 11
281#define SHT_NUM 12
282#define SHT_LOPROC 0x70000000
283#define SHT_HIPROC 0x7fffffff
284#define SHT_LOUSER 0x80000000
285#define SHT_HIUSER 0xffffffff
286
287/* sh_flags */
288#define SHF_WRITE 0x1
289#define SHF_ALLOC 0x2
290#define SHF_EXECINSTR 0x4
291#define SHF_MASKPROC 0xf0000000
292
293/* special section indexes */
294#define SHN_UNDEF 0
295#define SHN_LORESERVE 0xff00
296#define SHN_LOPROC 0xff00
297#define SHN_HIPROC 0xff1f
298#define SHN_ABS 0xfff1
299#define SHN_COMMON 0xfff2
300#define SHN_HIRESERVE 0xffff
301
302typedef struct elf32_shdr {
303 Elf32_Word sh_name;
304 Elf32_Word sh_type;
305 Elf32_Word sh_flags;
306 Elf32_Addr sh_addr;
307 Elf32_Off sh_offset;
308 Elf32_Word sh_size;
309 Elf32_Word sh_link;
310 Elf32_Word sh_info;
311 Elf32_Word sh_addralign;
312 Elf32_Word sh_entsize;
313} Elf32_Shdr;
314
315typedef struct elf64_shdr {
316 Elf64_Word sh_name; /* Section name, index in string tbl */
317 Elf64_Word sh_type; /* Type of section */
318 Elf64_Xword sh_flags; /* Miscellaneous section attributes */
319 Elf64_Addr sh_addr; /* Section virtual addr at execution */
320 Elf64_Off sh_offset; /* Section file offset */
321 Elf64_Xword sh_size; /* Size of section in bytes */
322 Elf64_Word sh_link; /* Index of another section */
323 Elf64_Word sh_info; /* Additional section information */
324 Elf64_Xword sh_addralign; /* Section alignment */
325 Elf64_Xword sh_entsize; /* Entry size if section holds table */
326} Elf64_Shdr;
327
328#define EI_MAG0 0 /* e_ident[] indexes */
329#define EI_MAG1 1
330#define EI_MAG2 2
331#define EI_MAG3 3
332#define EI_CLASS 4
333#define EI_DATA 5
334#define EI_VERSION 6
335#define EI_OSABI 7
336#define EI_PAD 8
337
338#define ELFMAG0 0x7f /* EI_MAG */
339#define ELFMAG1 'E'
340#define ELFMAG2 'L'
341#define ELFMAG3 'F'
342#define ELFMAG "\177ELF"
343#define SELFMAG 4
344
345#define ELFCLASSNONE 0 /* EI_CLASS */
346#define ELFCLASS32 1
347#define ELFCLASS64 2
348#define ELFCLASSNUM 3
349
350#define ELFDATANONE 0 /* e_ident[EI_DATA] */
351#define ELFDATA2LSB 1
352#define ELFDATA2MSB 2
353
354#define EV_NONE 0 /* e_version, EI_VERSION */
355#define EV_CURRENT 1
356#define EV_NUM 2
357
358#define ELFOSABI_NONE 0
359#define ELFOSABI_LINUX 3
360
361#ifndef ELF_OSABI
362#define ELF_OSABI ELFOSABI_NONE
363#endif
364
365/*
366 * Notes used in ET_CORE. Architectures export some of the arch register sets
367 * using the corresponding note types via the PTRACE_GETREGSET and
368 * PTRACE_SETREGSET requests.
369 */
370#define NT_PRSTATUS 1
371#define NT_PRFPREG 2
372#define NT_PRPSINFO 3
373#define NT_TASKSTRUCT 4
374#define NT_AUXV 6
375#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
376#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
377#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */
378#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
379#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
380#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
381#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */
382#define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */
383#define NT_S390_TIMER 0x301 /* s390 timer register */
384#define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */
385#define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */
386#define NT_S390_CTRS 0x304 /* s390 control registers */
387#define NT_S390_PREFIX 0x305 /* s390 prefix register */
388#define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */
389#define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */
390#define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */
391#define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */
392#define NT_ARM_TLS 0x401 /* ARM TLS register */
393#define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */
394#define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */
395
396
397/* Note header in a PT_NOTE section */
398typedef struct elf32_note {
399 Elf32_Word n_namesz; /* Name size */
400 Elf32_Word n_descsz; /* Content size */
401 Elf32_Word n_type; /* Content type */
402} Elf32_Nhdr;
403
404/* Note header in a PT_NOTE section */
405typedef struct elf64_note {
406 Elf64_Word n_namesz; /* Name size */
407 Elf64_Word n_descsz; /* Content size */
408 Elf64_Word n_type; /* Content type */
409} Elf64_Nhdr;
410 6
411#ifdef __KERNEL__
412#ifndef elf_read_implies_exec 7#ifndef elf_read_implies_exec
413 /* Executables for which elf_read_implies_exec() returns TRUE will 8 /* Executables for which elf_read_implies_exec() returns TRUE will
414 have the READ_IMPLIES_EXEC personality flag set automatically. 9 have the READ_IMPLIES_EXEC personality flag set automatically.
@@ -449,5 +44,4 @@ static inline int elf_coredump_extra_notes_write(struct file *file,
449extern int elf_coredump_extra_notes_size(void); 44extern int elf_coredump_extra_notes_size(void);
450extern int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset); 45extern int elf_coredump_extra_notes_write(struct file *file, loff_t *foffset);
451#endif 46#endif
452#endif /* __KERNEL__ */
453#endif /* _LINUX_ELF_H */ 47#endif /* _LINUX_ELF_H */
diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h
index 0698c79fbcb2..cdd3d13efce7 100644
--- a/include/linux/elfcore.h
+++ b/include/linux/elfcore.h
@@ -1,109 +1,11 @@
1#ifndef _LINUX_ELFCORE_H 1#ifndef _LINUX_ELFCORE_H
2#define _LINUX_ELFCORE_H 2#define _LINUX_ELFCORE_H
3 3
4#include <linux/types.h>
5#include <linux/signal.h>
6#include <linux/time.h>
7#ifdef __KERNEL__
8#include <linux/user.h> 4#include <linux/user.h>
9#include <linux/bug.h> 5#include <linux/bug.h>
10#endif
11#include <linux/ptrace.h>
12#include <linux/elf.h>
13#include <linux/fs.h>
14
15struct elf_siginfo
16{
17 int si_signo; /* signal number */
18 int si_code; /* extra code */
19 int si_errno; /* errno */
20};
21
22#ifdef __KERNEL__
23#include <asm/elf.h> 6#include <asm/elf.h>
24#endif 7#include <uapi/linux/elfcore.h>
25 8
26#ifndef __KERNEL__
27typedef elf_greg_t greg_t;
28typedef elf_gregset_t gregset_t;
29typedef elf_fpregset_t fpregset_t;
30typedef elf_fpxregset_t fpxregset_t;
31#define NGREG ELF_NGREG
32#endif
33
34/*
35 * Definitions to generate Intel SVR4-like core files.
36 * These mostly have the same names as the SVR4 types with "elf_"
37 * tacked on the front to prevent clashes with linux definitions,
38 * and the typedef forms have been avoided. This is mostly like
39 * the SVR4 structure, but more Linuxy, with things that Linux does
40 * not support and which gdb doesn't really use excluded.
41 * Fields present but not used are marked with "XXX".
42 */
43struct elf_prstatus
44{
45#if 0
46 long pr_flags; /* XXX Process flags */
47 short pr_why; /* XXX Reason for process halt */
48 short pr_what; /* XXX More detailed reason */
49#endif
50 struct elf_siginfo pr_info; /* Info associated with signal */
51 short pr_cursig; /* Current signal */
52 unsigned long pr_sigpend; /* Set of pending signals */
53 unsigned long pr_sighold; /* Set of held signals */
54#if 0
55 struct sigaltstack pr_altstack; /* Alternate stack info */
56 struct sigaction pr_action; /* Signal action for current sig */
57#endif
58 pid_t pr_pid;
59 pid_t pr_ppid;
60 pid_t pr_pgrp;
61 pid_t pr_sid;
62 struct timeval pr_utime; /* User time */
63 struct timeval pr_stime; /* System time */
64 struct timeval pr_cutime; /* Cumulative user time */
65 struct timeval pr_cstime; /* Cumulative system time */
66#if 0
67 long pr_instr; /* Current instruction */
68#endif
69 elf_gregset_t pr_reg; /* GP registers */
70#ifdef CONFIG_BINFMT_ELF_FDPIC
71 /* When using FDPIC, the loadmap addresses need to be communicated
72 * to GDB in order for GDB to do the necessary relocations. The
73 * fields (below) used to communicate this information are placed
74 * immediately after ``pr_reg'', so that the loadmap addresses may
75 * be viewed as part of the register set if so desired.
76 */
77 unsigned long pr_exec_fdpic_loadmap;
78 unsigned long pr_interp_fdpic_loadmap;
79#endif
80 int pr_fpvalid; /* True if math co-processor being used. */
81};
82
83#define ELF_PRARGSZ (80) /* Number of chars for args */
84
85struct elf_prpsinfo
86{
87 char pr_state; /* numeric process state */
88 char pr_sname; /* char for pr_state */
89 char pr_zomb; /* zombie */
90 char pr_nice; /* nice val */
91 unsigned long pr_flag; /* flags */
92 __kernel_uid_t pr_uid;
93 __kernel_gid_t pr_gid;
94 pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
95 /* Lots missing */
96 char pr_fname[16]; /* filename of executable */
97 char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
98};
99
100#ifndef __KERNEL__
101typedef struct elf_prstatus prstatus_t;
102typedef struct elf_prpsinfo prpsinfo_t;
103#define PRARGSZ ELF_PRARGSZ
104#endif
105
106#ifdef __KERNEL__
107static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *regs) 9static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *regs)
108{ 10{
109#ifdef ELF_CORE_COPY_REGS 11#ifdef ELF_CORE_COPY_REGS
@@ -167,6 +69,4 @@ extern int
167elf_core_write_extra_data(struct file *file, size_t *size, unsigned long limit); 69elf_core_write_extra_data(struct file *file, size_t *size, unsigned long limit);
168extern size_t elf_core_extra_data_size(void); 70extern size_t elf_core_extra_data_size(void);
169 71
170#endif /* __KERNEL__ */
171
172#endif /* _LINUX_ELFCORE_H */ 72#endif /* _LINUX_ELFCORE_H */
diff --git a/include/linux/errno.h b/include/linux/errno.h
index e0de516374da..f6bf082d4d4f 100644
--- a/include/linux/errno.h
+++ b/include/linux/errno.h
@@ -1,9 +1,8 @@
1#ifndef _LINUX_ERRNO_H 1#ifndef _LINUX_ERRNO_H
2#define _LINUX_ERRNO_H 2#define _LINUX_ERRNO_H
3 3
4#include <asm/errno.h> 4#include <uapi/linux/errno.h>
5 5
6#ifdef __KERNEL__
7 6
8/* 7/*
9 * These should never be seen by user programs. To return one of ERESTART* 8 * These should never be seen by user programs. To return one of ERESTART*
@@ -32,5 +31,3 @@
32#define EIOCBRETRY 530 /* iocb queued, will trigger a retry */ 31#define EIOCBRETRY 530 /* iocb queued, will trigger a retry */
33 32
34#endif 33#endif
35
36#endif
diff --git a/include/linux/errqueue.h b/include/linux/errqueue.h
index fd0628be45ce..9ca23fcfb5d7 100644
--- a/include/linux/errqueue.h
+++ b/include/linux/errqueue.h
@@ -1,33 +1,12 @@
1#ifndef _LINUX_ERRQUEUE_H 1#ifndef _LINUX_ERRQUEUE_H
2#define _LINUX_ERRQUEUE_H 1 2#define _LINUX_ERRQUEUE_H 1
3 3
4#include <linux/types.h>
5
6struct sock_extended_err {
7 __u32 ee_errno;
8 __u8 ee_origin;
9 __u8 ee_type;
10 __u8 ee_code;
11 __u8 ee_pad;
12 __u32 ee_info;
13 __u32 ee_data;
14};
15
16#define SO_EE_ORIGIN_NONE 0
17#define SO_EE_ORIGIN_LOCAL 1
18#define SO_EE_ORIGIN_ICMP 2
19#define SO_EE_ORIGIN_ICMP6 3
20#define SO_EE_ORIGIN_TXSTATUS 4
21#define SO_EE_ORIGIN_TIMESTAMPING SO_EE_ORIGIN_TXSTATUS
22
23#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1))
24
25#ifdef __KERNEL__
26 4
27#include <net/ip.h> 5#include <net/ip.h>
28#if IS_ENABLED(CONFIG_IPV6) 6#if IS_ENABLED(CONFIG_IPV6)
29#include <linux/ipv6.h> 7#include <linux/ipv6.h>
30#endif 8#endif
9#include <uapi/linux/errqueue.h>
31 10
32#define SKB_EXT_ERR(skb) ((struct sock_exterr_skb *) ((skb)->cb)) 11#define SKB_EXT_ERR(skb) ((struct sock_exterr_skb *) ((skb)->cb))
33 12
@@ -44,5 +23,3 @@ struct sock_exterr_skb {
44}; 23};
45 24
46#endif 25#endif
47
48#endif
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index fcb4f8e60c1c..c8e3e7e39c6b 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -9,596 +9,12 @@
9 * scott.feldman@intel.com) 9 * scott.feldman@intel.com)
10 * Portions Copyright (C) Sun Microsystems 2008 10 * Portions Copyright (C) Sun Microsystems 2008
11 */ 11 */
12
13#ifndef _LINUX_ETHTOOL_H 12#ifndef _LINUX_ETHTOOL_H
14#define _LINUX_ETHTOOL_H 13#define _LINUX_ETHTOOL_H
15 14
16#ifdef __KERNEL__
17#include <linux/compat.h> 15#include <linux/compat.h>
18#endif 16#include <uapi/linux/ethtool.h>
19#include <linux/types.h>
20#include <linux/if_ether.h>
21
22/* This should work for both 32 and 64 bit userland. */
23struct ethtool_cmd {
24 __u32 cmd;
25 __u32 supported; /* Features this interface supports */
26 __u32 advertising; /* Features this interface advertises */
27 __u16 speed; /* The forced speed (lower bits) in
28 * Mbps. Please use
29 * ethtool_cmd_speed()/_set() to
30 * access it */
31 __u8 duplex; /* Duplex, half or full */
32 __u8 port; /* Which connector port */
33 __u8 phy_address; /* MDIO PHY address (PRTAD for clause 45).
34 * May be read-only or read-write
35 * depending on the driver.
36 */
37 __u8 transceiver; /* Which transceiver to use */
38 __u8 autoneg; /* Enable or disable autonegotiation */
39 __u8 mdio_support; /* MDIO protocols supported. Read-only.
40 * Not set by all drivers.
41 */
42 __u32 maxtxpkt; /* Tx pkts before generating tx int */
43 __u32 maxrxpkt; /* Rx pkts before generating rx int */
44 __u16 speed_hi; /* The forced speed (upper
45 * bits) in Mbps. Please use
46 * ethtool_cmd_speed()/_set() to
47 * access it */
48 __u8 eth_tp_mdix; /* twisted pair MDI-X status */
49 __u8 eth_tp_mdix_ctrl; /* twisted pair MDI-X control, when set,
50 * link should be renegotiated if necessary
51 */
52 __u32 lp_advertising; /* Features the link partner advertises */
53 __u32 reserved[2];
54};
55
56static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
57 __u32 speed)
58{
59
60 ep->speed = (__u16)speed;
61 ep->speed_hi = (__u16)(speed >> 16);
62}
63
64static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
65{
66 return (ep->speed_hi << 16) | ep->speed;
67}
68
69/* Device supports clause 22 register access to PHY or peripherals
70 * using the interface defined in <linux/mii.h>. This should not be
71 * set if there are known to be no such peripherals present or if
72 * the driver only emulates clause 22 registers for compatibility.
73 */
74#define ETH_MDIO_SUPPORTS_C22 1
75
76/* Device supports clause 45 register access to PHY or peripherals
77 * using the interface defined in <linux/mii.h> and <linux/mdio.h>.
78 * This should not be set if there are known to be no such peripherals
79 * present.
80 */
81#define ETH_MDIO_SUPPORTS_C45 2
82
83#define ETHTOOL_FWVERS_LEN 32
84#define ETHTOOL_BUSINFO_LEN 32
85/* these strings are set to whatever the driver author decides... */
86struct ethtool_drvinfo {
87 __u32 cmd;
88 char driver[32]; /* driver short name, "tulip", "eepro100" */
89 char version[32]; /* driver version string */
90 char fw_version[ETHTOOL_FWVERS_LEN]; /* firmware version string */
91 char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */
92 /* For PCI devices, use pci_name(pci_dev). */
93 char reserved1[32];
94 char reserved2[12];
95 /*
96 * Some struct members below are filled in
97 * using ops->get_sset_count(). Obtaining
98 * this info from ethtool_drvinfo is now
99 * deprecated; Use ETHTOOL_GSSET_INFO
100 * instead.
101 */
102 __u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */
103 __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */
104 __u32 testinfo_len;
105 __u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */
106 __u32 regdump_len; /* Size of data from ETHTOOL_GREGS (bytes) */
107};
108
109#define SOPASS_MAX 6
110/* wake-on-lan settings */
111struct ethtool_wolinfo {
112 __u32 cmd;
113 __u32 supported;
114 __u32 wolopts;
115 __u8 sopass[SOPASS_MAX]; /* SecureOn(tm) password */
116};
117
118/* for passing single values */
119struct ethtool_value {
120 __u32 cmd;
121 __u32 data;
122};
123
124/* for passing big chunks of data */
125struct ethtool_regs {
126 __u32 cmd;
127 __u32 version; /* driver-specific, indicates different chips/revs */
128 __u32 len; /* bytes */
129 __u8 data[0];
130};
131
132/* for passing EEPROM chunks */
133struct ethtool_eeprom {
134 __u32 cmd;
135 __u32 magic;
136 __u32 offset; /* in bytes */
137 __u32 len; /* in bytes */
138 __u8 data[0];
139};
140
141/**
142 * struct ethtool_eee - Energy Efficient Ethernet information
143 * @cmd: ETHTOOL_{G,S}EEE
144 * @supported: Mask of %SUPPORTED_* flags for the speed/duplex combinations
145 * for which there is EEE support.
146 * @advertised: Mask of %ADVERTISED_* flags for the speed/duplex combinations
147 * advertised as eee capable.
148 * @lp_advertised: Mask of %ADVERTISED_* flags for the speed/duplex
149 * combinations advertised by the link partner as eee capable.
150 * @eee_active: Result of the eee auto negotiation.
151 * @eee_enabled: EEE configured mode (enabled/disabled).
152 * @tx_lpi_enabled: Whether the interface should assert its tx lpi, given
153 * that eee was negotiated.
154 * @tx_lpi_timer: Time in microseconds the interface delays prior to asserting
155 * its tx lpi (after reaching 'idle' state). Effective only when eee
156 * was negotiated and tx_lpi_enabled was set.
157 */
158struct ethtool_eee {
159 __u32 cmd;
160 __u32 supported;
161 __u32 advertised;
162 __u32 lp_advertised;
163 __u32 eee_active;
164 __u32 eee_enabled;
165 __u32 tx_lpi_enabled;
166 __u32 tx_lpi_timer;
167 __u32 reserved[2];
168};
169
170/**
171 * struct ethtool_modinfo - plugin module eeprom information
172 * @cmd: %ETHTOOL_GMODULEINFO
173 * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx
174 * @eeprom_len: Length of the eeprom
175 *
176 * This structure is used to return the information to
177 * properly size memory for a subsequent call to %ETHTOOL_GMODULEEEPROM.
178 * The type code indicates the eeprom data format
179 */
180struct ethtool_modinfo {
181 __u32 cmd;
182 __u32 type;
183 __u32 eeprom_len;
184 __u32 reserved[8];
185};
186
187/**
188 * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates
189 * @cmd: ETHTOOL_{G,S}COALESCE
190 * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after
191 * a packet arrives.
192 * @rx_max_coalesced_frames: Maximum number of packets to receive
193 * before an RX interrupt.
194 * @rx_coalesce_usecs_irq: Same as @rx_coalesce_usecs, except that
195 * this value applies while an IRQ is being serviced by the host.
196 * @rx_max_coalesced_frames_irq: Same as @rx_max_coalesced_frames,
197 * except that this value applies while an IRQ is being serviced
198 * by the host.
199 * @tx_coalesce_usecs: How many usecs to delay a TX interrupt after
200 * a packet is sent.
201 * @tx_max_coalesced_frames: Maximum number of packets to be sent
202 * before a TX interrupt.
203 * @tx_coalesce_usecs_irq: Same as @tx_coalesce_usecs, except that
204 * this value applies while an IRQ is being serviced by the host.
205 * @tx_max_coalesced_frames_irq: Same as @tx_max_coalesced_frames,
206 * except that this value applies while an IRQ is being serviced
207 * by the host.
208 * @stats_block_coalesce_usecs: How many usecs to delay in-memory
209 * statistics block updates. Some drivers do not have an
210 * in-memory statistic block, and in such cases this value is
211 * ignored. This value must not be zero.
212 * @use_adaptive_rx_coalesce: Enable adaptive RX coalescing.
213 * @use_adaptive_tx_coalesce: Enable adaptive TX coalescing.
214 * @pkt_rate_low: Threshold for low packet rate (packets per second).
215 * @rx_coalesce_usecs_low: How many usecs to delay an RX interrupt after
216 * a packet arrives, when the packet rate is below @pkt_rate_low.
217 * @rx_max_coalesced_frames_low: Maximum number of packets to be received
218 * before an RX interrupt, when the packet rate is below @pkt_rate_low.
219 * @tx_coalesce_usecs_low: How many usecs to delay a TX interrupt after
220 * a packet is sent, when the packet rate is below @pkt_rate_low.
221 * @tx_max_coalesced_frames_low: Maximum nuumber of packets to be sent before
222 * a TX interrupt, when the packet rate is below @pkt_rate_low.
223 * @pkt_rate_high: Threshold for high packet rate (packets per second).
224 * @rx_coalesce_usecs_high: How many usecs to delay an RX interrupt after
225 * a packet arrives, when the packet rate is above @pkt_rate_high.
226 * @rx_max_coalesced_frames_high: Maximum number of packets to be received
227 * before an RX interrupt, when the packet rate is above @pkt_rate_high.
228 * @tx_coalesce_usecs_high: How many usecs to delay a TX interrupt after
229 * a packet is sent, when the packet rate is above @pkt_rate_high.
230 * @tx_max_coalesced_frames_high: Maximum number of packets to be sent before
231 * a TX interrupt, when the packet rate is above @pkt_rate_high.
232 * @rate_sample_interval: How often to do adaptive coalescing packet rate
233 * sampling, measured in seconds. Must not be zero.
234 *
235 * Each pair of (usecs, max_frames) fields specifies this exit
236 * condition for interrupt coalescing:
237 * (usecs > 0 && time_since_first_completion >= usecs) ||
238 * (max_frames > 0 && completed_frames >= max_frames)
239 * It is illegal to set both usecs and max_frames to zero as this
240 * would cause interrupts to never be generated. To disable
241 * coalescing, set usecs = 0 and max_frames = 1.
242 *
243 * Some implementations ignore the value of max_frames and use the
244 * condition:
245 * time_since_first_completion >= usecs
246 * This is deprecated. Drivers for hardware that does not support
247 * counting completions should validate that max_frames == !rx_usecs.
248 *
249 * Adaptive RX/TX coalescing is an algorithm implemented by some
250 * drivers to improve latency under low packet rates and improve
251 * throughput under high packet rates. Some drivers only implement
252 * one of RX or TX adaptive coalescing. Anything not implemented by
253 * the driver causes these values to be silently ignored.
254 *
255 * When the packet rate is below @pkt_rate_high but above
256 * @pkt_rate_low (both measured in packets per second) the
257 * normal {rx,tx}_* coalescing parameters are used.
258 */
259struct ethtool_coalesce {
260 __u32 cmd;
261 __u32 rx_coalesce_usecs;
262 __u32 rx_max_coalesced_frames;
263 __u32 rx_coalesce_usecs_irq;
264 __u32 rx_max_coalesced_frames_irq;
265 __u32 tx_coalesce_usecs;
266 __u32 tx_max_coalesced_frames;
267 __u32 tx_coalesce_usecs_irq;
268 __u32 tx_max_coalesced_frames_irq;
269 __u32 stats_block_coalesce_usecs;
270 __u32 use_adaptive_rx_coalesce;
271 __u32 use_adaptive_tx_coalesce;
272 __u32 pkt_rate_low;
273 __u32 rx_coalesce_usecs_low;
274 __u32 rx_max_coalesced_frames_low;
275 __u32 tx_coalesce_usecs_low;
276 __u32 tx_max_coalesced_frames_low;
277 __u32 pkt_rate_high;
278 __u32 rx_coalesce_usecs_high;
279 __u32 rx_max_coalesced_frames_high;
280 __u32 tx_coalesce_usecs_high;
281 __u32 tx_max_coalesced_frames_high;
282 __u32 rate_sample_interval;
283};
284
285/* for configuring RX/TX ring parameters */
286struct ethtool_ringparam {
287 __u32 cmd; /* ETHTOOL_{G,S}RINGPARAM */
288
289 /* Read only attributes. These indicate the maximum number
290 * of pending RX/TX ring entries the driver will allow the
291 * user to set.
292 */
293 __u32 rx_max_pending;
294 __u32 rx_mini_max_pending;
295 __u32 rx_jumbo_max_pending;
296 __u32 tx_max_pending;
297
298 /* Values changeable by the user. The valid values are
299 * in the range 1 to the "*_max_pending" counterpart above.
300 */
301 __u32 rx_pending;
302 __u32 rx_mini_pending;
303 __u32 rx_jumbo_pending;
304 __u32 tx_pending;
305};
306
307/**
308 * struct ethtool_channels - configuring number of network channel
309 * @cmd: ETHTOOL_{G,S}CHANNELS
310 * @max_rx: Read only. Maximum number of receive channel the driver support.
311 * @max_tx: Read only. Maximum number of transmit channel the driver support.
312 * @max_other: Read only. Maximum number of other channel the driver support.
313 * @max_combined: Read only. Maximum number of combined channel the driver
314 * support. Set of queues RX, TX or other.
315 * @rx_count: Valid values are in the range 1 to the max_rx.
316 * @tx_count: Valid values are in the range 1 to the max_tx.
317 * @other_count: Valid values are in the range 1 to the max_other.
318 * @combined_count: Valid values are in the range 1 to the max_combined.
319 *
320 * This can be used to configure RX, TX and other channels.
321 */
322
323struct ethtool_channels {
324 __u32 cmd;
325 __u32 max_rx;
326 __u32 max_tx;
327 __u32 max_other;
328 __u32 max_combined;
329 __u32 rx_count;
330 __u32 tx_count;
331 __u32 other_count;
332 __u32 combined_count;
333};
334
335/* for configuring link flow control parameters */
336struct ethtool_pauseparam {
337 __u32 cmd; /* ETHTOOL_{G,S}PAUSEPARAM */
338
339 /* If the link is being auto-negotiated (via ethtool_cmd.autoneg
340 * being true) the user may set 'autoneg' here non-zero to have the
341 * pause parameters be auto-negotiated too. In such a case, the
342 * {rx,tx}_pause values below determine what capabilities are
343 * advertised.
344 *
345 * If 'autoneg' is zero or the link is not being auto-negotiated,
346 * then {rx,tx}_pause force the driver to use/not-use pause
347 * flow control.
348 */
349 __u32 autoneg;
350 __u32 rx_pause;
351 __u32 tx_pause;
352};
353
354#define ETH_GSTRING_LEN 32
355enum ethtool_stringset {
356 ETH_SS_TEST = 0,
357 ETH_SS_STATS,
358 ETH_SS_PRIV_FLAGS,
359 ETH_SS_NTUPLE_FILTERS, /* Do not use, GRXNTUPLE is now deprecated */
360 ETH_SS_FEATURES,
361};
362
363/* for passing string sets for data tagging */
364struct ethtool_gstrings {
365 __u32 cmd; /* ETHTOOL_GSTRINGS */
366 __u32 string_set; /* string set id e.c. ETH_SS_TEST, etc*/
367 __u32 len; /* number of strings in the string set */
368 __u8 data[0];
369};
370
371struct ethtool_sset_info {
372 __u32 cmd; /* ETHTOOL_GSSET_INFO */
373 __u32 reserved;
374 __u64 sset_mask; /* input: each bit selects an sset to query */
375 /* output: each bit a returned sset */
376 __u32 data[0]; /* ETH_SS_xxx count, in order, based on bits
377 in sset_mask. One bit implies one
378 __u32, two bits implies two
379 __u32's, etc. */
380};
381
382/**
383 * enum ethtool_test_flags - flags definition of ethtool_test
384 * @ETH_TEST_FL_OFFLINE: if set perform online and offline tests, otherwise
385 * only online tests.
386 * @ETH_TEST_FL_FAILED: Driver set this flag if test fails.
387 * @ETH_TEST_FL_EXTERNAL_LB: Application request to perform external loopback
388 * test.
389 * @ETH_TEST_FL_EXTERNAL_LB_DONE: Driver performed the external loopback test
390 */
391
392enum ethtool_test_flags {
393 ETH_TEST_FL_OFFLINE = (1 << 0),
394 ETH_TEST_FL_FAILED = (1 << 1),
395 ETH_TEST_FL_EXTERNAL_LB = (1 << 2),
396 ETH_TEST_FL_EXTERNAL_LB_DONE = (1 << 3),
397};
398
399/* for requesting NIC test and getting results*/
400struct ethtool_test {
401 __u32 cmd; /* ETHTOOL_TEST */
402 __u32 flags; /* ETH_TEST_FL_xxx */
403 __u32 reserved;
404 __u32 len; /* result length, in number of u64 elements */
405 __u64 data[0];
406};
407
408/* for dumping NIC-specific statistics */
409struct ethtool_stats {
410 __u32 cmd; /* ETHTOOL_GSTATS */
411 __u32 n_stats; /* number of u64's being returned */
412 __u64 data[0];
413};
414
415struct ethtool_perm_addr {
416 __u32 cmd; /* ETHTOOL_GPERMADDR */
417 __u32 size;
418 __u8 data[0];
419};
420
421/* boolean flags controlling per-interface behavior characteristics.
422 * When reading, the flag indicates whether or not a certain behavior
423 * is enabled/present. When writing, the flag indicates whether
424 * or not the driver should turn on (set) or off (clear) a behavior.
425 *
426 * Some behaviors may read-only (unconditionally absent or present).
427 * If such is the case, return EINVAL in the set-flags operation if the
428 * flag differs from the read-only value.
429 */
430enum ethtool_flags {
431 ETH_FLAG_TXVLAN = (1 << 7), /* TX VLAN offload enabled */
432 ETH_FLAG_RXVLAN = (1 << 8), /* RX VLAN offload enabled */
433 ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
434 ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */
435 ETH_FLAG_RXHASH = (1 << 28),
436};
437 17
438/* The following structures are for supporting RX network flow
439 * classification and RX n-tuple configuration. Note, all multibyte
440 * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to
441 * be in network byte order.
442 */
443
444/**
445 * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc.
446 * @ip4src: Source host
447 * @ip4dst: Destination host
448 * @psrc: Source port
449 * @pdst: Destination port
450 * @tos: Type-of-service
451 *
452 * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow.
453 */
454struct ethtool_tcpip4_spec {
455 __be32 ip4src;
456 __be32 ip4dst;
457 __be16 psrc;
458 __be16 pdst;
459 __u8 tos;
460};
461
462/**
463 * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4
464 * @ip4src: Source host
465 * @ip4dst: Destination host
466 * @spi: Security parameters index
467 * @tos: Type-of-service
468 *
469 * This can be used to specify an IPsec transport or tunnel over IPv4.
470 */
471struct ethtool_ah_espip4_spec {
472 __be32 ip4src;
473 __be32 ip4dst;
474 __be32 spi;
475 __u8 tos;
476};
477
478#define ETH_RX_NFC_IP4 1
479
480/**
481 * struct ethtool_usrip4_spec - general flow specification for IPv4
482 * @ip4src: Source host
483 * @ip4dst: Destination host
484 * @l4_4_bytes: First 4 bytes of transport (layer 4) header
485 * @tos: Type-of-service
486 * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0
487 * @proto: Transport protocol number; mask must be 0
488 */
489struct ethtool_usrip4_spec {
490 __be32 ip4src;
491 __be32 ip4dst;
492 __be32 l4_4_bytes;
493 __u8 tos;
494 __u8 ip_ver;
495 __u8 proto;
496};
497
498union ethtool_flow_union {
499 struct ethtool_tcpip4_spec tcp_ip4_spec;
500 struct ethtool_tcpip4_spec udp_ip4_spec;
501 struct ethtool_tcpip4_spec sctp_ip4_spec;
502 struct ethtool_ah_espip4_spec ah_ip4_spec;
503 struct ethtool_ah_espip4_spec esp_ip4_spec;
504 struct ethtool_usrip4_spec usr_ip4_spec;
505 struct ethhdr ether_spec;
506 __u8 hdata[60];
507};
508
509struct ethtool_flow_ext {
510 __be16 vlan_etype;
511 __be16 vlan_tci;
512 __be32 data[2];
513};
514
515/**
516 * struct ethtool_rx_flow_spec - classification rule for RX flows
517 * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
518 * @h_u: Flow fields to match (dependent on @flow_type)
519 * @h_ext: Additional fields to match
520 * @m_u: Masks for flow field bits to be matched
521 * @m_ext: Masks for additional field bits to be matched
522 * Note, all additional fields must be ignored unless @flow_type
523 * includes the %FLOW_EXT flag.
524 * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
525 * if packets should be discarded
526 * @location: Location of rule in the table. Locations must be
527 * numbered such that a flow matching multiple rules will be
528 * classified according to the first (lowest numbered) rule.
529 */
530struct ethtool_rx_flow_spec {
531 __u32 flow_type;
532 union ethtool_flow_union h_u;
533 struct ethtool_flow_ext h_ext;
534 union ethtool_flow_union m_u;
535 struct ethtool_flow_ext m_ext;
536 __u64 ring_cookie;
537 __u32 location;
538};
539
540/**
541 * struct ethtool_rxnfc - command to get or set RX flow classification rules
542 * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH,
543 * %ETHTOOL_GRXRINGS, %ETHTOOL_GRXCLSRLCNT, %ETHTOOL_GRXCLSRULE,
544 * %ETHTOOL_GRXCLSRLALL, %ETHTOOL_SRXCLSRLDEL or %ETHTOOL_SRXCLSRLINS
545 * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW
546 * @data: Command-dependent value
547 * @fs: Flow classification rule
548 * @rule_cnt: Number of rules to be affected
549 * @rule_locs: Array of used rule locations
550 *
551 * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating
552 * the fields included in the flow hash, e.g. %RXH_IP_SRC. The following
553 * structure fields must not be used.
554 *
555 * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues
556 * on return.
557 *
558 * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined
559 * rules on return. If @data is non-zero on return then it is the
560 * size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the
561 * driver supports any special location values. If that flag is not
562 * set in @data then special location values should not be used.
563 *
564 * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an
565 * existing rule on entry and @fs contains the rule on return.
566 *
567 * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the
568 * user buffer for @rule_locs on entry. On return, @data is the size
569 * of the rule table, @rule_cnt is the number of defined rules, and
570 * @rule_locs contains the locations of the defined rules. Drivers
571 * must use the second parameter to get_rxnfc() instead of @rule_locs.
572 *
573 * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
574 * @fs.@location either specifies the location to use or is a special
575 * location value with %RX_CLS_LOC_SPECIAL flag set. On return,
576 * @fs.@location is the actual rule location.
577 *
578 * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
579 * existing rule on entry.
580 *
581 * A driver supporting the special location values for
582 * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused
583 * location, and may remove a rule at a later location (lower
584 * priority) that matches exactly the same set of flows. The special
585 * values are: %RX_CLS_LOC_ANY, selecting any location;
586 * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum
587 * priority); and %RX_CLS_LOC_LAST, selecting the last suitable
588 * location (minimum priority). Additional special values may be
589 * defined in future and drivers must return -%EINVAL for any
590 * unrecognised value.
591 */
592struct ethtool_rxnfc {
593 __u32 cmd;
594 __u32 flow_type;
595 __u64 data;
596 struct ethtool_rx_flow_spec fs;
597 __u32 rule_cnt;
598 __u32 rule_locs[0];
599};
600
601#ifdef __KERNEL__
602#ifdef CONFIG_COMPAT 18#ifdef CONFIG_COMPAT
603 19
604struct compat_ethtool_rx_flow_spec { 20struct compat_ethtool_rx_flow_spec {
@@ -621,223 +37,6 @@ struct compat_ethtool_rxnfc {
621}; 37};
622 38
623#endif /* CONFIG_COMPAT */ 39#endif /* CONFIG_COMPAT */
624#endif /* __KERNEL__ */
625
626/**
627 * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
628 * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
629 * @size: On entry, the array size of the user buffer, which may be zero.
630 * On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware
631 * indirection table.
632 * @ring_index: RX ring/queue index for each hash value
633 *
634 * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size
635 * should be returned. For %ETHTOOL_SRXFHINDIR, a @size of zero means
636 * the table should be reset to default values. This last feature
637 * is not supported by the original implementations.
638 */
639struct ethtool_rxfh_indir {
640 __u32 cmd;
641 __u32 size;
642 __u32 ring_index[0];
643};
644
645/**
646 * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter
647 * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
648 * @h_u: Flow field values to match (dependent on @flow_type)
649 * @m_u: Masks for flow field value bits to be ignored
650 * @vlan_tag: VLAN tag to match
651 * @vlan_tag_mask: Mask for VLAN tag bits to be ignored
652 * @data: Driver-dependent data to match
653 * @data_mask: Mask for driver-dependent data bits to be ignored
654 * @action: RX ring/queue index to deliver to (non-negative) or other action
655 * (negative, e.g. %ETHTOOL_RXNTUPLE_ACTION_DROP)
656 *
657 * For flow types %TCP_V4_FLOW, %UDP_V4_FLOW and %SCTP_V4_FLOW, where
658 * a field value and mask are both zero this is treated as if all mask
659 * bits are set i.e. the field is ignored.
660 */
661struct ethtool_rx_ntuple_flow_spec {
662 __u32 flow_type;
663 union {
664 struct ethtool_tcpip4_spec tcp_ip4_spec;
665 struct ethtool_tcpip4_spec udp_ip4_spec;
666 struct ethtool_tcpip4_spec sctp_ip4_spec;
667 struct ethtool_ah_espip4_spec ah_ip4_spec;
668 struct ethtool_ah_espip4_spec esp_ip4_spec;
669 struct ethtool_usrip4_spec usr_ip4_spec;
670 struct ethhdr ether_spec;
671 __u8 hdata[72];
672 } h_u, m_u;
673
674 __u16 vlan_tag;
675 __u16 vlan_tag_mask;
676 __u64 data;
677 __u64 data_mask;
678
679 __s32 action;
680#define ETHTOOL_RXNTUPLE_ACTION_DROP (-1) /* drop packet */
681#define ETHTOOL_RXNTUPLE_ACTION_CLEAR (-2) /* clear filter */
682};
683
684/**
685 * struct ethtool_rx_ntuple - command to set or clear RX flow filter
686 * @cmd: Command number - %ETHTOOL_SRXNTUPLE
687 * @fs: Flow filter specification
688 */
689struct ethtool_rx_ntuple {
690 __u32 cmd;
691 struct ethtool_rx_ntuple_flow_spec fs;
692};
693
694#define ETHTOOL_FLASH_MAX_FILENAME 128
695enum ethtool_flash_op_type {
696 ETHTOOL_FLASH_ALL_REGIONS = 0,
697};
698
699/* for passing firmware flashing related parameters */
700struct ethtool_flash {
701 __u32 cmd;
702 __u32 region;
703 char data[ETHTOOL_FLASH_MAX_FILENAME];
704};
705
706/**
707 * struct ethtool_dump - used for retrieving, setting device dump
708 * @cmd: Command number - %ETHTOOL_GET_DUMP_FLAG, %ETHTOOL_GET_DUMP_DATA, or
709 * %ETHTOOL_SET_DUMP
710 * @version: FW version of the dump, filled in by driver
711 * @flag: driver dependent flag for dump setting, filled in by driver during
712 * get and filled in by ethtool for set operation.
713 * flag must be initialized by macro ETH_FW_DUMP_DISABLE value when
714 * firmware dump is disabled.
715 * @len: length of dump data, used as the length of the user buffer on entry to
716 * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver
717 * for %ETHTOOL_GET_DUMP_FLAG command
718 * @data: data collected for get dump data operation
719 */
720
721#define ETH_FW_DUMP_DISABLE 0
722
723struct ethtool_dump {
724 __u32 cmd;
725 __u32 version;
726 __u32 flag;
727 __u32 len;
728 __u8 data[0];
729};
730
731/* for returning and changing feature sets */
732
733/**
734 * struct ethtool_get_features_block - block with state of 32 features
735 * @available: mask of changeable features
736 * @requested: mask of features requested to be enabled if possible
737 * @active: mask of currently enabled features
738 * @never_changed: mask of features not changeable for any device
739 */
740struct ethtool_get_features_block {
741 __u32 available;
742 __u32 requested;
743 __u32 active;
744 __u32 never_changed;
745};
746
747/**
748 * struct ethtool_gfeatures - command to get state of device's features
749 * @cmd: command number = %ETHTOOL_GFEATURES
750 * @size: in: number of elements in the features[] array;
751 * out: number of elements in features[] needed to hold all features
752 * @features: state of features
753 */
754struct ethtool_gfeatures {
755 __u32 cmd;
756 __u32 size;
757 struct ethtool_get_features_block features[0];
758};
759
760/**
761 * struct ethtool_set_features_block - block with request for 32 features
762 * @valid: mask of features to be changed
763 * @requested: values of features to be changed
764 */
765struct ethtool_set_features_block {
766 __u32 valid;
767 __u32 requested;
768};
769
770/**
771 * struct ethtool_sfeatures - command to request change in device's features
772 * @cmd: command number = %ETHTOOL_SFEATURES
773 * @size: array size of the features[] array
774 * @features: feature change masks
775 */
776struct ethtool_sfeatures {
777 __u32 cmd;
778 __u32 size;
779 struct ethtool_set_features_block features[0];
780};
781
782/**
783 * struct ethtool_ts_info - holds a device's timestamping and PHC association
784 * @cmd: command number = %ETHTOOL_GET_TS_INFO
785 * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags
786 * @phc_index: device index of the associated PHC, or -1 if there is none
787 * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values
788 * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values
789 *
790 * The bits in the 'tx_types' and 'rx_filters' fields correspond to
791 * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values,
792 * respectively. For example, if the device supports HWTSTAMP_TX_ON,
793 * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set.
794 */
795struct ethtool_ts_info {
796 __u32 cmd;
797 __u32 so_timestamping;
798 __s32 phc_index;
799 __u32 tx_types;
800 __u32 tx_reserved[3];
801 __u32 rx_filters;
802 __u32 rx_reserved[3];
803};
804
805/*
806 * %ETHTOOL_SFEATURES changes features present in features[].valid to the
807 * values of corresponding bits in features[].requested. Bits in .requested
808 * not set in .valid or not changeable are ignored.
809 *
810 * Returns %EINVAL when .valid contains undefined or never-changeable bits
811 * or size is not equal to required number of features words (32-bit blocks).
812 * Returns >= 0 if request was completed; bits set in the value mean:
813 * %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not
814 * changeable (not present in %ETHTOOL_GFEATURES' features[].available)
815 * those bits were ignored.
816 * %ETHTOOL_F_WISH - some or all changes requested were recorded but the
817 * resulting state of bits masked by .valid is not equal to .requested.
818 * Probably there are other device-specific constraints on some features
819 * in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered
820 * here as though ignored bits were cleared.
821 * %ETHTOOL_F_COMPAT - some or all changes requested were made by calling
822 * compatibility functions. Requested offload state cannot be properly
823 * managed by kernel.
824 *
825 * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of
826 * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands
827 * for ETH_SS_FEATURES string set. First entry in the table corresponds to least
828 * significant bit in features[0] fields. Empty strings mark undefined features.
829 */
830enum ethtool_sfeatures_retval_bits {
831 ETHTOOL_F_UNSUPPORTED__BIT,
832 ETHTOOL_F_WISH__BIT,
833 ETHTOOL_F_COMPAT__BIT,
834};
835
836#define ETHTOOL_F_UNSUPPORTED (1 << ETHTOOL_F_UNSUPPORTED__BIT)
837#define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT)
838#define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT)
839
840#ifdef __KERNEL__
841 40
842#include <linux/rculist.h> 41#include <linux/rculist.h>
843 42
@@ -1049,277 +248,4 @@ struct ethtool_ops {
1049 248
1050 249
1051}; 250};
1052#endif /* __KERNEL__ */
1053
1054/* CMDs currently supported */
1055#define ETHTOOL_GSET 0x00000001 /* Get settings. */
1056#define ETHTOOL_SSET 0x00000002 /* Set settings. */
1057#define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */
1058#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */
1059#define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */
1060#define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */
1061#define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */
1062#define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */
1063#define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */
1064/* Get link status for host, i.e. whether the interface *and* the
1065 * physical port (if there is one) are up (ethtool_value). */
1066#define ETHTOOL_GLINK 0x0000000a
1067#define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */
1068#define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */
1069#define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */
1070#define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */
1071#define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */
1072#define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */
1073#define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */
1074#define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */
1075#define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */
1076#define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */
1077#define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */
1078#define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */
1079#define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable
1080 * (ethtool_value) */
1081#define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable
1082 * (ethtool_value). */
1083#define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */
1084#define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */
1085#define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */
1086#define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */
1087#define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */
1088#define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */
1089#define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */
1090#define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */
1091#define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */
1092#define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */
1093#define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */
1094#define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */
1095#define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */
1096#define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */
1097#define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */
1098
1099#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */
1100#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */
1101#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */
1102#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */
1103#define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */
1104#define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */
1105#define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */
1106#define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */
1107#define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */
1108#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */
1109#define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */
1110#define ETHTOOL_RESET 0x00000034 /* Reset hardware */
1111#define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */
1112#define ETHTOOL_GRXNTUPLE 0x00000036 /* deprecated */
1113#define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */
1114#define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */
1115#define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */
1116
1117#define ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */
1118#define ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */
1119#define ETHTOOL_GCHANNELS 0x0000003c /* Get no of channels */
1120#define ETHTOOL_SCHANNELS 0x0000003d /* Set no of channels */
1121#define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */
1122#define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */
1123#define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */
1124#define ETHTOOL_GET_TS_INFO 0x00000041 /* Get time stamping and PHC info */
1125#define ETHTOOL_GMODULEINFO 0x00000042 /* Get plug-in module information */
1126#define ETHTOOL_GMODULEEEPROM 0x00000043 /* Get plug-in module eeprom */
1127#define ETHTOOL_GEEE 0x00000044 /* Get EEE settings */
1128#define ETHTOOL_SEEE 0x00000045 /* Set EEE settings */
1129
1130/* compatibility with older code */
1131#define SPARC_ETH_GSET ETHTOOL_GSET
1132#define SPARC_ETH_SSET ETHTOOL_SSET
1133
1134/* Indicates what features are supported by the interface. */
1135#define SUPPORTED_10baseT_Half (1 << 0)
1136#define SUPPORTED_10baseT_Full (1 << 1)
1137#define SUPPORTED_100baseT_Half (1 << 2)
1138#define SUPPORTED_100baseT_Full (1 << 3)
1139#define SUPPORTED_1000baseT_Half (1 << 4)
1140#define SUPPORTED_1000baseT_Full (1 << 5)
1141#define SUPPORTED_Autoneg (1 << 6)
1142#define SUPPORTED_TP (1 << 7)
1143#define SUPPORTED_AUI (1 << 8)
1144#define SUPPORTED_MII (1 << 9)
1145#define SUPPORTED_FIBRE (1 << 10)
1146#define SUPPORTED_BNC (1 << 11)
1147#define SUPPORTED_10000baseT_Full (1 << 12)
1148#define SUPPORTED_Pause (1 << 13)
1149#define SUPPORTED_Asym_Pause (1 << 14)
1150#define SUPPORTED_2500baseX_Full (1 << 15)
1151#define SUPPORTED_Backplane (1 << 16)
1152#define SUPPORTED_1000baseKX_Full (1 << 17)
1153#define SUPPORTED_10000baseKX4_Full (1 << 18)
1154#define SUPPORTED_10000baseKR_Full (1 << 19)
1155#define SUPPORTED_10000baseR_FEC (1 << 20)
1156#define SUPPORTED_20000baseMLD2_Full (1 << 21)
1157#define SUPPORTED_20000baseKR2_Full (1 << 22)
1158#define SUPPORTED_40000baseKR4_Full (1 << 23)
1159#define SUPPORTED_40000baseCR4_Full (1 << 24)
1160#define SUPPORTED_40000baseSR4_Full (1 << 25)
1161#define SUPPORTED_40000baseLR4_Full (1 << 26)
1162
1163/* Indicates what features are advertised by the interface. */
1164#define ADVERTISED_10baseT_Half (1 << 0)
1165#define ADVERTISED_10baseT_Full (1 << 1)
1166#define ADVERTISED_100baseT_Half (1 << 2)
1167#define ADVERTISED_100baseT_Full (1 << 3)
1168#define ADVERTISED_1000baseT_Half (1 << 4)
1169#define ADVERTISED_1000baseT_Full (1 << 5)
1170#define ADVERTISED_Autoneg (1 << 6)
1171#define ADVERTISED_TP (1 << 7)
1172#define ADVERTISED_AUI (1 << 8)
1173#define ADVERTISED_MII (1 << 9)
1174#define ADVERTISED_FIBRE (1 << 10)
1175#define ADVERTISED_BNC (1 << 11)
1176#define ADVERTISED_10000baseT_Full (1 << 12)
1177#define ADVERTISED_Pause (1 << 13)
1178#define ADVERTISED_Asym_Pause (1 << 14)
1179#define ADVERTISED_2500baseX_Full (1 << 15)
1180#define ADVERTISED_Backplane (1 << 16)
1181#define ADVERTISED_1000baseKX_Full (1 << 17)
1182#define ADVERTISED_10000baseKX4_Full (1 << 18)
1183#define ADVERTISED_10000baseKR_Full (1 << 19)
1184#define ADVERTISED_10000baseR_FEC (1 << 20)
1185#define ADVERTISED_20000baseMLD2_Full (1 << 21)
1186#define ADVERTISED_20000baseKR2_Full (1 << 22)
1187#define ADVERTISED_40000baseKR4_Full (1 << 23)
1188#define ADVERTISED_40000baseCR4_Full (1 << 24)
1189#define ADVERTISED_40000baseSR4_Full (1 << 25)
1190#define ADVERTISED_40000baseLR4_Full (1 << 26)
1191
1192/* The following are all involved in forcing a particular link
1193 * mode for the device for setting things. When getting the
1194 * devices settings, these indicate the current mode and whether
1195 * it was forced up into this mode or autonegotiated.
1196 */
1197
1198/* The forced speed, 10Mb, 100Mb, gigabit, 2.5Gb, 10GbE. */
1199#define SPEED_10 10
1200#define SPEED_100 100
1201#define SPEED_1000 1000
1202#define SPEED_2500 2500
1203#define SPEED_10000 10000
1204#define SPEED_UNKNOWN -1
1205
1206/* Duplex, half or full. */
1207#define DUPLEX_HALF 0x00
1208#define DUPLEX_FULL 0x01
1209#define DUPLEX_UNKNOWN 0xff
1210
1211/* Which connector port. */
1212#define PORT_TP 0x00
1213#define PORT_AUI 0x01
1214#define PORT_MII 0x02
1215#define PORT_FIBRE 0x03
1216#define PORT_BNC 0x04
1217#define PORT_DA 0x05
1218#define PORT_NONE 0xef
1219#define PORT_OTHER 0xff
1220
1221/* Which transceiver to use. */
1222#define XCVR_INTERNAL 0x00
1223#define XCVR_EXTERNAL 0x01
1224#define XCVR_DUMMY1 0x02
1225#define XCVR_DUMMY2 0x03
1226#define XCVR_DUMMY3 0x04
1227
1228/* Enable or disable autonegotiation. If this is set to enable,
1229 * the forced link modes above are completely ignored.
1230 */
1231#define AUTONEG_DISABLE 0x00
1232#define AUTONEG_ENABLE 0x01
1233
1234/* MDI or MDI-X status/control - if MDI/MDI_X/AUTO is set then
1235 * the driver is required to renegotiate link
1236 */
1237#define ETH_TP_MDI_INVALID 0x00 /* status: unknown; control: unsupported */
1238#define ETH_TP_MDI 0x01 /* status: MDI; control: force MDI */
1239#define ETH_TP_MDI_X 0x02 /* status: MDI-X; control: force MDI-X */
1240#define ETH_TP_MDI_AUTO 0x03 /* control: auto-select */
1241
1242/* Wake-On-Lan options. */
1243#define WAKE_PHY (1 << 0)
1244#define WAKE_UCAST (1 << 1)
1245#define WAKE_MCAST (1 << 2)
1246#define WAKE_BCAST (1 << 3)
1247#define WAKE_ARP (1 << 4)
1248#define WAKE_MAGIC (1 << 5)
1249#define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */
1250
1251/* L2-L4 network traffic flow types */
1252#define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */
1253#define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */
1254#define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */
1255#define AH_ESP_V4_FLOW 0x04 /* hash only */
1256#define TCP_V6_FLOW 0x05 /* hash only */
1257#define UDP_V6_FLOW 0x06 /* hash only */
1258#define SCTP_V6_FLOW 0x07 /* hash only */
1259#define AH_ESP_V6_FLOW 0x08 /* hash only */
1260#define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */
1261#define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */
1262#define AH_V6_FLOW 0x0b /* hash only */
1263#define ESP_V6_FLOW 0x0c /* hash only */
1264#define IP_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */
1265#define IPV4_FLOW 0x10 /* hash only */
1266#define IPV6_FLOW 0x11 /* hash only */
1267#define ETHER_FLOW 0x12 /* spec only (ether_spec) */
1268/* Flag to enable additional fields in struct ethtool_rx_flow_spec */
1269#define FLOW_EXT 0x80000000
1270
1271/* L3-L4 network traffic flow hash options */
1272#define RXH_L2DA (1 << 1)
1273#define RXH_VLAN (1 << 2)
1274#define RXH_L3_PROTO (1 << 3)
1275#define RXH_IP_SRC (1 << 4)
1276#define RXH_IP_DST (1 << 5)
1277#define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */
1278#define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */
1279#define RXH_DISCARD (1 << 31)
1280
1281#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
1282
1283/* Special RX classification rule insert location values */
1284#define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */
1285#define RX_CLS_LOC_ANY 0xffffffff
1286#define RX_CLS_LOC_FIRST 0xfffffffe
1287#define RX_CLS_LOC_LAST 0xfffffffd
1288
1289/* EEPROM Standards for plug in modules */
1290#define ETH_MODULE_SFF_8079 0x1
1291#define ETH_MODULE_SFF_8079_LEN 256
1292#define ETH_MODULE_SFF_8472 0x2
1293#define ETH_MODULE_SFF_8472_LEN 512
1294
1295/* Reset flags */
1296/* The reset() operation must clear the flags for the components which
1297 * were actually reset. On successful return, the flags indicate the
1298 * components which were not reset, either because they do not exist
1299 * in the hardware or because they cannot be reset independently. The
1300 * driver must never reset any components that were not requested.
1301 */
1302enum ethtool_reset_flags {
1303 /* These flags represent components dedicated to the interface
1304 * the command is addressed to. Shift any flag left by
1305 * ETH_RESET_SHARED_SHIFT to reset a shared component of the
1306 * same type.
1307 */
1308 ETH_RESET_MGMT = 1 << 0, /* Management processor */
1309 ETH_RESET_IRQ = 1 << 1, /* Interrupt requester */
1310 ETH_RESET_DMA = 1 << 2, /* DMA engine */
1311 ETH_RESET_FILTER = 1 << 3, /* Filtering/flow direction */
1312 ETH_RESET_OFFLOAD = 1 << 4, /* Protocol offload */
1313 ETH_RESET_MAC = 1 << 5, /* Media access controller */
1314 ETH_RESET_PHY = 1 << 6, /* Transceiver/PHY */
1315 ETH_RESET_RAM = 1 << 7, /* RAM shared between
1316 * multiple components */
1317
1318 ETH_RESET_DEDICATED = 0x0000ffff, /* All components dedicated to
1319 * this interface */
1320 ETH_RESET_ALL = 0xffffffff, /* All components used by this
1321 * interface, even if shared */
1322};
1323#define ETH_RESET_SHARED_SHIFT 16
1324
1325#endif /* _LINUX_ETHTOOL_H */ 251#endif /* _LINUX_ETHTOOL_H */
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index f4bb378ccf6a..6daf6d4971f6 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -10,58 +10,11 @@
10 * Davide Libenzi <davidel@xmailserver.org> 10 * Davide Libenzi <davidel@xmailserver.org>
11 * 11 *
12 */ 12 */
13
14#ifndef _LINUX_EVENTPOLL_H 13#ifndef _LINUX_EVENTPOLL_H
15#define _LINUX_EVENTPOLL_H 14#define _LINUX_EVENTPOLL_H
16 15
17/* For O_CLOEXEC */ 16#include <uapi/linux/eventpoll.h>
18#include <linux/fcntl.h>
19#include <linux/types.h>
20
21/* Flags for epoll_create1. */
22#define EPOLL_CLOEXEC O_CLOEXEC
23
24/* Valid opcodes to issue to sys_epoll_ctl() */
25#define EPOLL_CTL_ADD 1
26#define EPOLL_CTL_DEL 2
27#define EPOLL_CTL_MOD 3
28
29/*
30 * Request the handling of system wakeup events so as to prevent system suspends
31 * from happening while those events are being processed.
32 *
33 * Assuming neither EPOLLET nor EPOLLONESHOT is set, system suspends will not be
34 * re-allowed until epoll_wait is called again after consuming the wakeup
35 * event(s).
36 *
37 * Requires CAP_BLOCK_SUSPEND
38 */
39#define EPOLLWAKEUP (1 << 29)
40
41/* Set the One Shot behaviour for the target file descriptor */
42#define EPOLLONESHOT (1 << 30)
43 17
44/* Set the Edge Triggered behaviour for the target file descriptor */
45#define EPOLLET (1 << 31)
46
47/*
48 * On x86-64 make the 64bit structure have the same alignment as the
49 * 32bit structure. This makes 32bit emulation easier.
50 *
51 * UML/x86_64 needs the same packing as x86_64
52 */
53#ifdef __x86_64__
54#define EPOLL_PACKED __attribute__((packed))
55#else
56#define EPOLL_PACKED
57#endif
58
59struct epoll_event {
60 __u32 events;
61 __u64 data;
62} EPOLL_PACKED;
63
64#ifdef __KERNEL__
65 18
66/* Forward declarations to avoid compiler errors */ 19/* Forward declarations to avoid compiler errors */
67struct file; 20struct file;
@@ -115,7 +68,4 @@ static inline void eventpoll_release(struct file *file) {}
115 68
116#endif 69#endif
117 70
118#endif /* #ifdef __KERNEL__ */
119
120#endif /* #ifndef _LINUX_EVENTPOLL_H */ 71#endif /* #ifndef _LINUX_EVENTPOLL_H */
121
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 7443a560c9d0..2c26c14cd710 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -68,7 +68,7 @@ enum extcon_cable_name {
68 EXTCON_VIDEO_OUT, 68 EXTCON_VIDEO_OUT,
69 EXTCON_MECHANICAL, 69 EXTCON_MECHANICAL,
70}; 70};
71extern const char *extcon_cable_name[]; 71extern const char extcon_cable_name[][CABLE_NAME_MAX + 1];
72 72
73struct extcon_cable; 73struct extcon_cable;
74 74
diff --git a/include/linux/falloc.h b/include/linux/falloc.h
index 73e0b628e058..31591686ac2d 100644
--- a/include/linux/falloc.h
+++ b/include/linux/falloc.h
@@ -1,10 +1,8 @@
1#ifndef _FALLOC_H_ 1#ifndef _FALLOC_H_
2#define _FALLOC_H_ 2#define _FALLOC_H_
3 3
4#define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */ 4#include <uapi/linux/falloc.h>
5#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */
6 5
7#ifdef __KERNEL__
8 6
9/* 7/*
10 * Space reservation ioctls and argument structure 8 * Space reservation ioctls and argument structure
@@ -23,6 +21,4 @@ struct space_resv {
23#define FS_IOC_RESVSP _IOW('X', 40, struct space_resv) 21#define FS_IOC_RESVSP _IOW('X', 40, struct space_resv)
24#define FS_IOC_RESVSP64 _IOW('X', 42, struct space_resv) 22#define FS_IOC_RESVSP64 _IOW('X', 42, struct space_resv)
25 23
26#endif /* __KERNEL__ */
27
28#endif /* _FALLOC_H_ */ 24#endif /* _FALLOC_H_ */
diff --git a/include/linux/fanotify.h b/include/linux/fanotify.h
index 6c6133f76e16..cef93ddcc5a0 100644
--- a/include/linux/fanotify.h
+++ b/include/linux/fanotify.h
@@ -1,120 +1,8 @@
1#ifndef _LINUX_FANOTIFY_H 1#ifndef _LINUX_FANOTIFY_H
2#define _LINUX_FANOTIFY_H 2#define _LINUX_FANOTIFY_H
3 3
4#include <linux/types.h> 4#include <uapi/linux/fanotify.h>
5 5
6/* the following events that user-space can register for */
7#define FAN_ACCESS 0x00000001 /* File was accessed */
8#define FAN_MODIFY 0x00000002 /* File was modified */
9#define FAN_CLOSE_WRITE 0x00000008 /* Writtable file closed */
10#define FAN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed */
11#define FAN_OPEN 0x00000020 /* File was opened */
12
13#define FAN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */
14
15#define FAN_OPEN_PERM 0x00010000 /* File open in perm check */
16#define FAN_ACCESS_PERM 0x00020000 /* File accessed in perm check */
17
18#define FAN_ONDIR 0x40000000 /* event occurred against dir */
19
20#define FAN_EVENT_ON_CHILD 0x08000000 /* interested in child events */
21
22/* helper events */
23#define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE) /* close */
24
25/* flags used for fanotify_init() */
26#define FAN_CLOEXEC 0x00000001
27#define FAN_NONBLOCK 0x00000002
28
29/* These are NOT bitwise flags. Both bits are used togther. */
30#define FAN_CLASS_NOTIF 0x00000000
31#define FAN_CLASS_CONTENT 0x00000004
32#define FAN_CLASS_PRE_CONTENT 0x00000008
33#define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | \
34 FAN_CLASS_PRE_CONTENT)
35
36#define FAN_UNLIMITED_QUEUE 0x00000010
37#define FAN_UNLIMITED_MARKS 0x00000020
38
39#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | \
40 FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE |\
41 FAN_UNLIMITED_MARKS)
42
43/* flags used for fanotify_modify_mark() */
44#define FAN_MARK_ADD 0x00000001
45#define FAN_MARK_REMOVE 0x00000002
46#define FAN_MARK_DONT_FOLLOW 0x00000004
47#define FAN_MARK_ONLYDIR 0x00000008
48#define FAN_MARK_MOUNT 0x00000010
49#define FAN_MARK_IGNORED_MASK 0x00000020
50#define FAN_MARK_IGNORED_SURV_MODIFY 0x00000040
51#define FAN_MARK_FLUSH 0x00000080
52#ifdef __KERNEL__
53/* not valid from userspace, only kernel internal */ 6/* not valid from userspace, only kernel internal */
54#define FAN_MARK_ONDIR 0x00000100 7#define FAN_MARK_ONDIR 0x00000100
55#endif
56
57#define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD |\
58 FAN_MARK_REMOVE |\
59 FAN_MARK_DONT_FOLLOW |\
60 FAN_MARK_ONLYDIR |\
61 FAN_MARK_MOUNT |\
62 FAN_MARK_IGNORED_MASK |\
63 FAN_MARK_IGNORED_SURV_MODIFY |\
64 FAN_MARK_FLUSH)
65
66/*
67 * All of the events - we build the list by hand so that we can add flags in
68 * the future and not break backward compatibility. Apps will get only the
69 * events that they originally wanted. Be sure to add new events here!
70 */
71#define FAN_ALL_EVENTS (FAN_ACCESS |\
72 FAN_MODIFY |\
73 FAN_CLOSE |\
74 FAN_OPEN)
75
76/*
77 * All events which require a permission response from userspace
78 */
79#define FAN_ALL_PERM_EVENTS (FAN_OPEN_PERM |\
80 FAN_ACCESS_PERM)
81
82#define FAN_ALL_OUTGOING_EVENTS (FAN_ALL_EVENTS |\
83 FAN_ALL_PERM_EVENTS |\
84 FAN_Q_OVERFLOW)
85
86#define FANOTIFY_METADATA_VERSION 3
87
88struct fanotify_event_metadata {
89 __u32 event_len;
90 __u8 vers;
91 __u8 reserved;
92 __u16 metadata_len;
93 __aligned_u64 mask;
94 __s32 fd;
95 __s32 pid;
96};
97
98struct fanotify_response {
99 __s32 fd;
100 __u32 response;
101};
102
103/* Legit userspace responses to a _PERM event */
104#define FAN_ALLOW 0x01
105#define FAN_DENY 0x02
106/* No fd set in event */
107#define FAN_NOFD -1
108
109/* Helper functions to deal with fanotify_event_metadata buffers */
110#define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata))
111
112#define FAN_EVENT_NEXT(meta, len) ((len) -= (meta)->event_len, \
113 (struct fanotify_event_metadata*)(((char *)(meta)) + \
114 (meta)->event_len))
115
116#define FAN_EVENT_OK(meta, len) ((long)(len) >= (long)FAN_EVENT_METADATA_LEN && \
117 (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && \
118 (long)(meta)->event_len <= (long)(len))
119
120#endif /* _LINUX_FANOTIFY_H */ 8#endif /* _LINUX_FANOTIFY_H */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index ac3f1c605843..c7a95714b1fe 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -1,409 +1,10 @@
1#ifndef _LINUX_FB_H 1#ifndef _LINUX_FB_H
2#define _LINUX_FB_H 2#define _LINUX_FB_H
3 3
4#include <linux/types.h>
5#include <linux/i2c.h>
6#ifdef __KERNEL__
7#include <linux/kgdb.h> 4#include <linux/kgdb.h>
8#endif /* __KERNEL__ */ 5#include <uapi/linux/fb.h>
9 6
10/* Definitions of frame buffers */
11
12#define FB_MAX 32 /* sufficient for now */
13
14/* ioctls
15 0x46 is 'F' */
16#define FBIOGET_VSCREENINFO 0x4600
17#define FBIOPUT_VSCREENINFO 0x4601
18#define FBIOGET_FSCREENINFO 0x4602
19#define FBIOGETCMAP 0x4604
20#define FBIOPUTCMAP 0x4605
21#define FBIOPAN_DISPLAY 0x4606
22#ifdef __KERNEL__
23#define FBIO_CURSOR _IOWR('F', 0x08, struct fb_cursor_user) 7#define FBIO_CURSOR _IOWR('F', 0x08, struct fb_cursor_user)
24#else
25#define FBIO_CURSOR _IOWR('F', 0x08, struct fb_cursor)
26#endif
27/* 0x4607-0x460B are defined below */
28/* #define FBIOGET_MONITORSPEC 0x460C */
29/* #define FBIOPUT_MONITORSPEC 0x460D */
30/* #define FBIOSWITCH_MONIBIT 0x460E */
31#define FBIOGET_CON2FBMAP 0x460F
32#define FBIOPUT_CON2FBMAP 0x4610
33#define FBIOBLANK 0x4611 /* arg: 0 or vesa level + 1 */
34#define FBIOGET_VBLANK _IOR('F', 0x12, struct fb_vblank)
35#define FBIO_ALLOC 0x4613
36#define FBIO_FREE 0x4614
37#define FBIOGET_GLYPH 0x4615
38#define FBIOGET_HWCINFO 0x4616
39#define FBIOPUT_MODEINFO 0x4617
40#define FBIOGET_DISPINFO 0x4618
41#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
42
43#define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
44#define FB_TYPE_PLANES 1 /* Non interleaved planes */
45#define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */
46#define FB_TYPE_TEXT 3 /* Text/attributes */
47#define FB_TYPE_VGA_PLANES 4 /* EGA/VGA planes */
48#define FB_TYPE_FOURCC 5 /* Type identified by a V4L2 FOURCC */
49
50#define FB_AUX_TEXT_MDA 0 /* Monochrome text */
51#define FB_AUX_TEXT_CGA 1 /* CGA/EGA/VGA Color text */
52#define FB_AUX_TEXT_S3_MMIO 2 /* S3 MMIO fasttext */
53#define FB_AUX_TEXT_MGA_STEP16 3 /* MGA Millenium I: text, attr, 14 reserved bytes */
54#define FB_AUX_TEXT_MGA_STEP8 4 /* other MGAs: text, attr, 6 reserved bytes */
55#define FB_AUX_TEXT_SVGA_GROUP 8 /* 8-15: SVGA tileblit compatible modes */
56#define FB_AUX_TEXT_SVGA_MASK 7 /* lower three bits says step */
57#define FB_AUX_TEXT_SVGA_STEP2 8 /* SVGA text mode: text, attr */
58#define FB_AUX_TEXT_SVGA_STEP4 9 /* SVGA text mode: text, attr, 2 reserved bytes */
59#define FB_AUX_TEXT_SVGA_STEP8 10 /* SVGA text mode: text, attr, 6 reserved bytes */
60#define FB_AUX_TEXT_SVGA_STEP16 11 /* SVGA text mode: text, attr, 14 reserved bytes */
61#define FB_AUX_TEXT_SVGA_LAST 15 /* reserved up to 15 */
62
63#define FB_AUX_VGA_PLANES_VGA4 0 /* 16 color planes (EGA/VGA) */
64#define FB_AUX_VGA_PLANES_CFB4 1 /* CFB4 in planes (VGA) */
65#define FB_AUX_VGA_PLANES_CFB8 2 /* CFB8 in planes (VGA) */
66
67#define FB_VISUAL_MONO01 0 /* Monochr. 1=Black 0=White */
68#define FB_VISUAL_MONO10 1 /* Monochr. 1=White 0=Black */
69#define FB_VISUAL_TRUECOLOR 2 /* True color */
70#define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */
71#define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */
72#define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */
73#define FB_VISUAL_FOURCC 6 /* Visual identified by a V4L2 FOURCC */
74
75#define FB_ACCEL_NONE 0 /* no hardware accelerator */
76#define FB_ACCEL_ATARIBLITT 1 /* Atari Blitter */
77#define FB_ACCEL_AMIGABLITT 2 /* Amiga Blitter */
78#define FB_ACCEL_S3_TRIO64 3 /* Cybervision64 (S3 Trio64) */
79#define FB_ACCEL_NCR_77C32BLT 4 /* RetinaZ3 (NCR 77C32BLT) */
80#define FB_ACCEL_S3_VIRGE 5 /* Cybervision64/3D (S3 ViRGE) */
81#define FB_ACCEL_ATI_MACH64GX 6 /* ATI Mach 64GX family */
82#define FB_ACCEL_DEC_TGA 7 /* DEC 21030 TGA */
83#define FB_ACCEL_ATI_MACH64CT 8 /* ATI Mach 64CT family */
84#define FB_ACCEL_ATI_MACH64VT 9 /* ATI Mach 64CT family VT class */
85#define FB_ACCEL_ATI_MACH64GT 10 /* ATI Mach 64CT family GT class */
86#define FB_ACCEL_SUN_CREATOR 11 /* Sun Creator/Creator3D */
87#define FB_ACCEL_SUN_CGSIX 12 /* Sun cg6 */
88#define FB_ACCEL_SUN_LEO 13 /* Sun leo/zx */
89#define FB_ACCEL_IMS_TWINTURBO 14 /* IMS Twin Turbo */
90#define FB_ACCEL_3DLABS_PERMEDIA2 15 /* 3Dlabs Permedia 2 */
91#define FB_ACCEL_MATROX_MGA2064W 16 /* Matrox MGA2064W (Millenium) */
92#define FB_ACCEL_MATROX_MGA1064SG 17 /* Matrox MGA1064SG (Mystique) */
93#define FB_ACCEL_MATROX_MGA2164W 18 /* Matrox MGA2164W (Millenium II) */
94#define FB_ACCEL_MATROX_MGA2164W_AGP 19 /* Matrox MGA2164W (Millenium II) */
95#define FB_ACCEL_MATROX_MGAG100 20 /* Matrox G100 (Productiva G100) */
96#define FB_ACCEL_MATROX_MGAG200 21 /* Matrox G200 (Myst, Mill, ...) */
97#define FB_ACCEL_SUN_CG14 22 /* Sun cgfourteen */
98#define FB_ACCEL_SUN_BWTWO 23 /* Sun bwtwo */
99#define FB_ACCEL_SUN_CGTHREE 24 /* Sun cgthree */
100#define FB_ACCEL_SUN_TCX 25 /* Sun tcx */
101#define FB_ACCEL_MATROX_MGAG400 26 /* Matrox G400 */
102#define FB_ACCEL_NV3 27 /* nVidia RIVA 128 */
103#define FB_ACCEL_NV4 28 /* nVidia RIVA TNT */
104#define FB_ACCEL_NV5 29 /* nVidia RIVA TNT2 */
105#define FB_ACCEL_CT_6555x 30 /* C&T 6555x */
106#define FB_ACCEL_3DFX_BANSHEE 31 /* 3Dfx Banshee */
107#define FB_ACCEL_ATI_RAGE128 32 /* ATI Rage128 family */
108#define FB_ACCEL_IGS_CYBER2000 33 /* CyberPro 2000 */
109#define FB_ACCEL_IGS_CYBER2010 34 /* CyberPro 2010 */
110#define FB_ACCEL_IGS_CYBER5000 35 /* CyberPro 5000 */
111#define FB_ACCEL_SIS_GLAMOUR 36 /* SiS 300/630/540 */
112#define FB_ACCEL_3DLABS_PERMEDIA3 37 /* 3Dlabs Permedia 3 */
113#define FB_ACCEL_ATI_RADEON 38 /* ATI Radeon family */
114#define FB_ACCEL_I810 39 /* Intel 810/815 */
115#define FB_ACCEL_SIS_GLAMOUR_2 40 /* SiS 315, 650, 740 */
116#define FB_ACCEL_SIS_XABRE 41 /* SiS 330 ("Xabre") */
117#define FB_ACCEL_I830 42 /* Intel 830M/845G/85x/865G */
118#define FB_ACCEL_NV_10 43 /* nVidia Arch 10 */
119#define FB_ACCEL_NV_20 44 /* nVidia Arch 20 */
120#define FB_ACCEL_NV_30 45 /* nVidia Arch 30 */
121#define FB_ACCEL_NV_40 46 /* nVidia Arch 40 */
122#define FB_ACCEL_XGI_VOLARI_V 47 /* XGI Volari V3XT, V5, V8 */
123#define FB_ACCEL_XGI_VOLARI_Z 48 /* XGI Volari Z7 */
124#define FB_ACCEL_OMAP1610 49 /* TI OMAP16xx */
125#define FB_ACCEL_TRIDENT_TGUI 50 /* Trident TGUI */
126#define FB_ACCEL_TRIDENT_3DIMAGE 51 /* Trident 3DImage */
127#define FB_ACCEL_TRIDENT_BLADE3D 52 /* Trident Blade3D */
128#define FB_ACCEL_TRIDENT_BLADEXP 53 /* Trident BladeXP */
129#define FB_ACCEL_CIRRUS_ALPINE 53 /* Cirrus Logic 543x/544x/5480 */
130#define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */
131#define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */
132#define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */
133#define FB_ACCEL_NEOMAGIC_NM2097 93 /* NeoMagic NM2097 */
134#define FB_ACCEL_NEOMAGIC_NM2160 94 /* NeoMagic NM2160 */
135#define FB_ACCEL_NEOMAGIC_NM2200 95 /* NeoMagic NM2200 */
136#define FB_ACCEL_NEOMAGIC_NM2230 96 /* NeoMagic NM2230 */
137#define FB_ACCEL_NEOMAGIC_NM2360 97 /* NeoMagic NM2360 */
138#define FB_ACCEL_NEOMAGIC_NM2380 98 /* NeoMagic NM2380 */
139#define FB_ACCEL_PXA3XX 99 /* PXA3xx */
140
141#define FB_ACCEL_SAVAGE4 0x80 /* S3 Savage4 */
142#define FB_ACCEL_SAVAGE3D 0x81 /* S3 Savage3D */
143#define FB_ACCEL_SAVAGE3D_MV 0x82 /* S3 Savage3D-MV */
144#define FB_ACCEL_SAVAGE2000 0x83 /* S3 Savage2000 */
145#define FB_ACCEL_SAVAGE_MX_MV 0x84 /* S3 Savage/MX-MV */
146#define FB_ACCEL_SAVAGE_MX 0x85 /* S3 Savage/MX */
147#define FB_ACCEL_SAVAGE_IX_MV 0x86 /* S3 Savage/IX-MV */
148#define FB_ACCEL_SAVAGE_IX 0x87 /* S3 Savage/IX */
149#define FB_ACCEL_PROSAVAGE_PM 0x88 /* S3 ProSavage PM133 */
150#define FB_ACCEL_PROSAVAGE_KM 0x89 /* S3 ProSavage KM133 */
151#define FB_ACCEL_S3TWISTER_P 0x8a /* S3 Twister */
152#define FB_ACCEL_S3TWISTER_K 0x8b /* S3 TwisterK */
153#define FB_ACCEL_SUPERSAVAGE 0x8c /* S3 Supersavage */
154#define FB_ACCEL_PROSAVAGE_DDR 0x8d /* S3 ProSavage DDR */
155#define FB_ACCEL_PROSAVAGE_DDRK 0x8e /* S3 ProSavage DDR-K */
156
157#define FB_ACCEL_PUV3_UNIGFX 0xa0 /* PKUnity-v3 Unigfx */
158
159#define FB_CAP_FOURCC 1 /* Device supports FOURCC-based formats */
160
161struct fb_fix_screeninfo {
162 char id[16]; /* identification string eg "TT Builtin" */
163 unsigned long smem_start; /* Start of frame buffer mem */
164 /* (physical address) */
165 __u32 smem_len; /* Length of frame buffer mem */
166 __u32 type; /* see FB_TYPE_* */
167 __u32 type_aux; /* Interleave for interleaved Planes */
168 __u32 visual; /* see FB_VISUAL_* */
169 __u16 xpanstep; /* zero if no hardware panning */
170 __u16 ypanstep; /* zero if no hardware panning */
171 __u16 ywrapstep; /* zero if no hardware ywrap */
172 __u32 line_length; /* length of a line in bytes */
173 unsigned long mmio_start; /* Start of Memory Mapped I/O */
174 /* (physical address) */
175 __u32 mmio_len; /* Length of Memory Mapped I/O */
176 __u32 accel; /* Indicate to driver which */
177 /* specific chip/card we have */
178 __u16 capabilities; /* see FB_CAP_* */
179 __u16 reserved[2]; /* Reserved for future compatibility */
180};
181
182/* Interpretation of offset for color fields: All offsets are from the right,
183 * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you
184 * can use the offset as right argument to <<). A pixel afterwards is a bit
185 * stream and is written to video memory as that unmodified.
186 *
187 * For pseudocolor: offset and length should be the same for all color
188 * components. Offset specifies the position of the least significant bit
189 * of the pallette index in a pixel value. Length indicates the number
190 * of available palette entries (i.e. # of entries = 1 << length).
191 */
192struct fb_bitfield {
193 __u32 offset; /* beginning of bitfield */
194 __u32 length; /* length of bitfield */
195 __u32 msb_right; /* != 0 : Most significant bit is */
196 /* right */
197};
198
199#define FB_NONSTD_HAM 1 /* Hold-And-Modify (HAM) */
200#define FB_NONSTD_REV_PIX_IN_B 2 /* order of pixels in each byte is reversed */
201
202#define FB_ACTIVATE_NOW 0 /* set values immediately (or vbl)*/
203#define FB_ACTIVATE_NXTOPEN 1 /* activate on next open */
204#define FB_ACTIVATE_TEST 2 /* don't set, round up impossible */
205#define FB_ACTIVATE_MASK 15
206 /* values */
207#define FB_ACTIVATE_VBL 16 /* activate values on next vbl */
208#define FB_CHANGE_CMAP_VBL 32 /* change colormap on vbl */
209#define FB_ACTIVATE_ALL 64 /* change all VCs on this fb */
210#define FB_ACTIVATE_FORCE 128 /* force apply even when no change*/
211#define FB_ACTIVATE_INV_MODE 256 /* invalidate videomode */
212
213#define FB_ACCELF_TEXT 1 /* (OBSOLETE) see fb_info.flags and vc_mode */
214
215#define FB_SYNC_HOR_HIGH_ACT 1 /* horizontal sync high active */
216#define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */
217#define FB_SYNC_EXT 4 /* external sync */
218#define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */
219#define FB_SYNC_BROADCAST 16 /* broadcast video timings */
220 /* vtotal = 144d/288n/576i => PAL */
221 /* vtotal = 121d/242n/484i => NTSC */
222#define FB_SYNC_ON_GREEN 32 /* sync on green */
223
224#define FB_VMODE_NONINTERLACED 0 /* non interlaced */
225#define FB_VMODE_INTERLACED 1 /* interlaced */
226#define FB_VMODE_DOUBLE 2 /* double scan */
227#define FB_VMODE_ODD_FLD_FIRST 4 /* interlaced: top line first */
228#define FB_VMODE_MASK 255
229
230#define FB_VMODE_YWRAP 256 /* ywrap instead of panning */
231#define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */
232#define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */
233
234/*
235 * Display rotation support
236 */
237#define FB_ROTATE_UR 0
238#define FB_ROTATE_CW 1
239#define FB_ROTATE_UD 2
240#define FB_ROTATE_CCW 3
241
242#define PICOS2KHZ(a) (1000000000UL/(a))
243#define KHZ2PICOS(a) (1000000000UL/(a))
244
245struct fb_var_screeninfo {
246 __u32 xres; /* visible resolution */
247 __u32 yres;
248 __u32 xres_virtual; /* virtual resolution */
249 __u32 yres_virtual;
250 __u32 xoffset; /* offset from virtual to visible */
251 __u32 yoffset; /* resolution */
252
253 __u32 bits_per_pixel; /* guess what */
254 __u32 grayscale; /* 0 = color, 1 = grayscale, */
255 /* >1 = FOURCC */
256 struct fb_bitfield red; /* bitfield in fb mem if true color, */
257 struct fb_bitfield green; /* else only length is significant */
258 struct fb_bitfield blue;
259 struct fb_bitfield transp; /* transparency */
260
261 __u32 nonstd; /* != 0 Non standard pixel format */
262
263 __u32 activate; /* see FB_ACTIVATE_* */
264
265 __u32 height; /* height of picture in mm */
266 __u32 width; /* width of picture in mm */
267
268 __u32 accel_flags; /* (OBSOLETE) see fb_info.flags */
269
270 /* Timing: All values in pixclocks, except pixclock (of course) */
271 __u32 pixclock; /* pixel clock in ps (pico seconds) */
272 __u32 left_margin; /* time from sync to picture */
273 __u32 right_margin; /* time from picture to sync */
274 __u32 upper_margin; /* time from sync to picture */
275 __u32 lower_margin;
276 __u32 hsync_len; /* length of horizontal sync */
277 __u32 vsync_len; /* length of vertical sync */
278 __u32 sync; /* see FB_SYNC_* */
279 __u32 vmode; /* see FB_VMODE_* */
280 __u32 rotate; /* angle we rotate counter clockwise */
281 __u32 colorspace; /* colorspace for FOURCC-based modes */
282 __u32 reserved[4]; /* Reserved for future compatibility */
283};
284
285struct fb_cmap {
286 __u32 start; /* First entry */
287 __u32 len; /* Number of entries */
288 __u16 *red; /* Red values */
289 __u16 *green;
290 __u16 *blue;
291 __u16 *transp; /* transparency, can be NULL */
292};
293
294struct fb_con2fbmap {
295 __u32 console;
296 __u32 framebuffer;
297};
298
299/* VESA Blanking Levels */
300#define VESA_NO_BLANKING 0
301#define VESA_VSYNC_SUSPEND 1
302#define VESA_HSYNC_SUSPEND 2
303#define VESA_POWERDOWN 3
304
305
306enum {
307 /* screen: unblanked, hsync: on, vsync: on */
308 FB_BLANK_UNBLANK = VESA_NO_BLANKING,
309
310 /* screen: blanked, hsync: on, vsync: on */
311 FB_BLANK_NORMAL = VESA_NO_BLANKING + 1,
312
313 /* screen: blanked, hsync: on, vsync: off */
314 FB_BLANK_VSYNC_SUSPEND = VESA_VSYNC_SUSPEND + 1,
315
316 /* screen: blanked, hsync: off, vsync: on */
317 FB_BLANK_HSYNC_SUSPEND = VESA_HSYNC_SUSPEND + 1,
318
319 /* screen: blanked, hsync: off, vsync: off */
320 FB_BLANK_POWERDOWN = VESA_POWERDOWN + 1
321};
322
323#define FB_VBLANK_VBLANKING 0x001 /* currently in a vertical blank */
324#define FB_VBLANK_HBLANKING 0x002 /* currently in a horizontal blank */
325#define FB_VBLANK_HAVE_VBLANK 0x004 /* vertical blanks can be detected */
326#define FB_VBLANK_HAVE_HBLANK 0x008 /* horizontal blanks can be detected */
327#define FB_VBLANK_HAVE_COUNT 0x010 /* global retrace counter is available */
328#define FB_VBLANK_HAVE_VCOUNT 0x020 /* the vcount field is valid */
329#define FB_VBLANK_HAVE_HCOUNT 0x040 /* the hcount field is valid */
330#define FB_VBLANK_VSYNCING 0x080 /* currently in a vsync */
331#define FB_VBLANK_HAVE_VSYNC 0x100 /* verical syncs can be detected */
332
333struct fb_vblank {
334 __u32 flags; /* FB_VBLANK flags */
335 __u32 count; /* counter of retraces since boot */
336 __u32 vcount; /* current scanline position */
337 __u32 hcount; /* current scandot position */
338 __u32 reserved[4]; /* reserved for future compatibility */
339};
340
341/* Internal HW accel */
342#define ROP_COPY 0
343#define ROP_XOR 1
344
345struct fb_copyarea {
346 __u32 dx;
347 __u32 dy;
348 __u32 width;
349 __u32 height;
350 __u32 sx;
351 __u32 sy;
352};
353
354struct fb_fillrect {
355 __u32 dx; /* screen-relative */
356 __u32 dy;
357 __u32 width;
358 __u32 height;
359 __u32 color;
360 __u32 rop;
361};
362
363struct fb_image {
364 __u32 dx; /* Where to place image */
365 __u32 dy;
366 __u32 width; /* Size of image */
367 __u32 height;
368 __u32 fg_color; /* Only used when a mono bitmap */
369 __u32 bg_color;
370 __u8 depth; /* Depth of the image */
371 const char *data; /* Pointer to image data */
372 struct fb_cmap cmap; /* color map info */
373};
374
375/*
376 * hardware cursor control
377 */
378
379#define FB_CUR_SETIMAGE 0x01
380#define FB_CUR_SETPOS 0x02
381#define FB_CUR_SETHOT 0x04
382#define FB_CUR_SETCMAP 0x08
383#define FB_CUR_SETSHAPE 0x10
384#define FB_CUR_SETSIZE 0x20
385#define FB_CUR_SETALL 0xFF
386
387struct fbcurpos {
388 __u16 x, y;
389};
390
391struct fb_cursor {
392 __u16 set; /* what to set */
393 __u16 enable; /* cursor on/off */
394 __u16 rop; /* bitop operation */
395 const char *mask; /* cursor mask bits */
396 struct fbcurpos hot; /* cursor hot spot */
397 struct fb_image image; /* Cursor image */
398};
399
400#ifdef CONFIG_FB_BACKLIGHT
401/* Settings for the generic backlight code */
402#define FB_BACKLIGHT_LEVELS 128
403#define FB_BACKLIGHT_MAX 0xFF
404#endif
405
406#ifdef __KERNEL__
407 8
408#include <linux/fs.h> 9#include <linux/fs.h>
409#include <linux/init.h> 10#include <linux/init.h>
@@ -1181,6 +782,4 @@ extern int fb_find_mode(struct fb_var_screeninfo *var,
1181 const struct fb_videomode *default_mode, 782 const struct fb_videomode *default_mode,
1182 unsigned int default_bpp); 783 unsigned int default_bpp);
1183 784
1184#endif /* __KERNEL__ */
1185
1186#endif /* _LINUX_FB_H */ 785#endif /* _LINUX_FB_H */
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h
index f550f894ba15..76ce329e656d 100644
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -1,54 +1,8 @@
1#ifndef _LINUX_FCNTL_H 1#ifndef _LINUX_FCNTL_H
2#define _LINUX_FCNTL_H 2#define _LINUX_FCNTL_H
3 3
4#include <asm/fcntl.h> 4#include <uapi/linux/fcntl.h>
5 5
6#define F_SETLEASE (F_LINUX_SPECIFIC_BASE + 0)
7#define F_GETLEASE (F_LINUX_SPECIFIC_BASE + 1)
8
9/*
10 * Cancel a blocking posix lock; internal use only until we expose an
11 * asynchronous lock api to userspace:
12 */
13#define F_CANCELLK (F_LINUX_SPECIFIC_BASE + 5)
14
15/* Create a file descriptor with FD_CLOEXEC set. */
16#define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6)
17
18/*
19 * Request nofications on a directory.
20 * See below for events that may be notified.
21 */
22#define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2)
23
24/*
25 * Set and get of pipe page size array
26 */
27#define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)
28#define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
29
30/*
31 * Types of directory notifications that may be requested.
32 */
33#define DN_ACCESS 0x00000001 /* File accessed */
34#define DN_MODIFY 0x00000002 /* File modified */
35#define DN_CREATE 0x00000004 /* File created */
36#define DN_DELETE 0x00000008 /* File removed */
37#define DN_RENAME 0x00000010 /* File renamed */
38#define DN_ATTRIB 0x00000020 /* File changed attibutes */
39#define DN_MULTISHOT 0x80000000 /* Don't remove notifier */
40
41#define AT_FDCWD -100 /* Special value used to indicate
42 openat should use the current
43 working directory. */
44#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
45#define AT_REMOVEDIR 0x200 /* Remove directory instead of
46 unlinking file. */
47#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
48#define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */
49#define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */
50
51#ifdef __KERNEL__
52 6
53#ifndef force_o_largefile 7#ifndef force_o_largefile
54#define force_o_largefile() (BITS_PER_LONG != 32) 8#define force_o_largefile() (BITS_PER_LONG != 32)
@@ -74,6 +28,4 @@
74#define IS_SETLK(cmd) (IS_SETLK32(cmd) || IS_SETLK64(cmd)) 28#define IS_SETLK(cmd) (IS_SETLK32(cmd) || IS_SETLK64(cmd))
75#define IS_SETLKW(cmd) (IS_SETLKW32(cmd) || IS_SETLKW64(cmd)) 29#define IS_SETLKW(cmd) (IS_SETLKW32(cmd) || IS_SETLKW64(cmd))
76 30
77#endif /* __KERNEL__ */
78
79#endif 31#endif
diff --git a/include/linux/fd.h b/include/linux/fd.h
index 72202b1b9a6a..69275bccc3e4 100644
--- a/include/linux/fd.h
+++ b/include/linux/fd.h
@@ -1,384 +1,8 @@
1#ifndef _LINUX_FD_H 1#ifndef _LINUX_FD_H
2#define _LINUX_FD_H 2#define _LINUX_FD_H
3 3
4#include <linux/ioctl.h> 4#include <uapi/linux/fd.h>
5#include <linux/compiler.h>
6 5
7/* New file layout: Now the ioctl definitions immediately follow the
8 * definitions of the structures that they use */
9
10/*
11 * Geometry
12 */
13struct floppy_struct {
14 unsigned int size, /* nr of sectors total */
15 sect, /* sectors per track */
16 head, /* nr of heads */
17 track, /* nr of tracks */
18 stretch; /* bit 0 !=0 means double track steps */
19 /* bit 1 != 0 means swap sides */
20 /* bits 2..9 give the first sector */
21 /* number (the LSB is flipped) */
22#define FD_STRETCH 1
23#define FD_SWAPSIDES 2
24#define FD_ZEROBASED 4
25#define FD_SECTBASEMASK 0x3FC
26#define FD_MKSECTBASE(s) (((s) ^ 1) << 2)
27#define FD_SECTBASE(floppy) ((((floppy)->stretch & FD_SECTBASEMASK) >> 2) ^ 1)
28
29 unsigned char gap, /* gap1 size */
30
31 rate, /* data rate. |= 0x40 for perpendicular */
32#define FD_2M 0x4
33#define FD_SIZECODEMASK 0x38
34#define FD_SIZECODE(floppy) (((((floppy)->rate&FD_SIZECODEMASK)>> 3)+ 2) %8)
35#define FD_SECTSIZE(floppy) ( (floppy)->rate & FD_2M ? \
36 512 : 128 << FD_SIZECODE(floppy) )
37#define FD_PERP 0x40
38
39 spec1, /* stepping rate, head unload time */
40 fmt_gap; /* gap2 size */
41 const char * name; /* used only for predefined formats */
42};
43
44
45/* commands needing write access have 0x40 set */
46/* commands needing super user access have 0x80 set */
47
48#define FDCLRPRM _IO(2, 0x41)
49/* clear user-defined parameters */
50
51#define FDSETPRM _IOW(2, 0x42, struct floppy_struct)
52#define FDSETMEDIAPRM FDSETPRM
53/* set user-defined parameters for current media */
54
55#define FDDEFPRM _IOW(2, 0x43, struct floppy_struct)
56#define FDGETPRM _IOR(2, 0x04, struct floppy_struct)
57#define FDDEFMEDIAPRM FDDEFPRM
58#define FDGETMEDIAPRM FDGETPRM
59/* set/get disk parameters */
60
61
62#define FDMSGON _IO(2,0x45)
63#define FDMSGOFF _IO(2,0x46)
64/* issue/don't issue kernel messages on media type change */
65
66
67/*
68 * Formatting (obsolete)
69 */
70#define FD_FILL_BYTE 0xF6 /* format fill byte. */
71
72struct format_descr {
73 unsigned int device,head,track;
74};
75
76#define FDFMTBEG _IO(2,0x47)
77/* begin formatting a disk */
78#define FDFMTTRK _IOW(2,0x48, struct format_descr)
79/* format the specified track */
80#define FDFMTEND _IO(2,0x49)
81/* end formatting a disk */
82
83
84/*
85 * Error thresholds
86 */
87struct floppy_max_errors {
88 unsigned int
89 abort, /* number of errors to be reached before aborting */
90 read_track, /* maximal number of errors permitted to read an
91 * entire track at once */
92 reset, /* maximal number of errors before a reset is tried */
93 recal, /* maximal number of errors before a recalibrate is
94 * tried */
95
96 /*
97 * Threshold for reporting FDC errors to the console.
98 * Setting this to zero may flood your screen when using
99 * ultra cheap floppies ;-)
100 */
101 reporting;
102
103};
104
105#define FDSETEMSGTRESH _IO(2,0x4a)
106/* set fdc error reporting threshold */
107
108#define FDFLUSH _IO(2,0x4b)
109/* flush buffers for media; either for verifying media, or for
110 * handling a media change without closing the file descriptor */
111
112#define FDSETMAXERRS _IOW(2, 0x4c, struct floppy_max_errors)
113#define FDGETMAXERRS _IOR(2, 0x0e, struct floppy_max_errors)
114/* set/get abortion and read_track threshold. See also floppy_drive_params
115 * structure */
116
117
118typedef char floppy_drive_name[16];
119#define FDGETDRVTYP _IOR(2, 0x0f, floppy_drive_name)
120/* get drive type: 5 1/4 or 3 1/2 */
121
122
123/*
124 * Drive parameters (user modifiable)
125 */
126struct floppy_drive_params {
127 signed char cmos; /* CMOS type */
128
129 /* Spec2 is (HLD<<1 | ND), where HLD is head load time (1=2ms, 2=4 ms
130 * etc) and ND is set means no DMA. Hardcoded to 6 (HLD=6ms, use DMA).
131 */
132 unsigned long max_dtr; /* Step rate, usec */
133 unsigned long hlt; /* Head load/settle time, msec */
134 unsigned long hut; /* Head unload time (remnant of
135 * 8" drives) */
136 unsigned long srt; /* Step rate, usec */
137
138 unsigned long spinup; /* time needed for spinup (expressed
139 * in jiffies) */
140 unsigned long spindown; /* timeout needed for spindown */
141 unsigned char spindown_offset; /* decides in which position the disk
142 * will stop */
143 unsigned char select_delay; /* delay to wait after select */
144 unsigned char rps; /* rotations per second */
145 unsigned char tracks; /* maximum number of tracks */
146 unsigned long timeout; /* timeout for interrupt requests */
147
148 unsigned char interleave_sect; /* if there are more sectors, use
149 * interleave */
150
151 struct floppy_max_errors max_errors;
152
153 char flags; /* various flags, including ftd_msg */
154/*
155 * Announce successful media type detection and media information loss after
156 * disk changes.
157 * Also used to enable/disable printing of overrun warnings.
158 */
159
160#define FTD_MSG 0x10
161#define FD_BROKEN_DCL 0x20
162#define FD_DEBUG 0x02
163#define FD_SILENT_DCL_CLEAR 0x4
164#define FD_INVERTED_DCL 0x80 /* must be 0x80, because of hardware
165 considerations */
166
167 char read_track; /* use readtrack during probing? */
168
169/*
170 * Auto-detection. Each drive type has eight formats which are
171 * used in succession to try to read the disk. If the FDC cannot lock onto
172 * the disk, the next format is tried. This uses the variable 'probing'.
173 */
174 short autodetect[8]; /* autodetected formats */
175
176 int checkfreq; /* how often should the drive be checked for disk
177 * changes */
178 int native_format; /* native format of this drive */
179};
180
181enum {
182 FD_NEED_TWADDLE_BIT, /* more magic */
183 FD_VERIFY_BIT, /* inquire for write protection */
184 FD_DISK_NEWCHANGE_BIT, /* change detected, and no action undertaken yet
185 * to clear media change status */
186 FD_UNUSED_BIT,
187 FD_DISK_CHANGED_BIT, /* disk has been changed since last i/o */
188 FD_DISK_WRITABLE_BIT /* disk is writable */
189};
190
191#define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params)
192#define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params)
193/* set/get drive parameters */
194
195
196/*
197 * Current drive state (not directly modifiable by user, readonly)
198 */
199struct floppy_drive_struct {
200 unsigned long flags;
201/* values for these flags */
202#define FD_NEED_TWADDLE (1 << FD_NEED_TWADDLE_BIT)
203#define FD_VERIFY (1 << FD_VERIFY_BIT)
204#define FD_DISK_NEWCHANGE (1 << FD_DISK_NEWCHANGE_BIT)
205#define FD_DISK_CHANGED (1 << FD_DISK_CHANGED_BIT)
206#define FD_DISK_WRITABLE (1 << FD_DISK_WRITABLE_BIT)
207
208 unsigned long spinup_date;
209 unsigned long select_date;
210 unsigned long first_read_date;
211 short probed_format;
212 short track; /* current track */
213 short maxblock; /* id of highest block read */
214 short maxtrack; /* id of highest half track read */
215 int generation; /* how many diskchanges? */
216
217/*
218 * (User-provided) media information is _not_ discarded after a media change
219 * if the corresponding keep_data flag is non-zero. Positive values are
220 * decremented after each probe.
221 */
222 int keep_data;
223
224 /* Prevent "aliased" accesses. */
225 int fd_ref;
226 int fd_device;
227 unsigned long last_checked; /* when was the drive last checked for a disk
228 * change? */
229
230 char *dmabuf;
231 int bufblocks;
232};
233
234#define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct)
235#define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct)
236/* get drive state: GET returns the cached state, POLL polls for new state */
237
238
239/*
240 * reset FDC
241 */
242enum reset_mode {
243 FD_RESET_IF_NEEDED, /* reset only if the reset flags is set */
244 FD_RESET_IF_RAWCMD, /* obsolete */
245 FD_RESET_ALWAYS /* reset always */
246};
247#define FDRESET _IO(2, 0x54)
248
249
250/*
251 * FDC state
252 */
253struct floppy_fdc_state {
254 int spec1; /* spec1 value last used */
255 int spec2; /* spec2 value last used */
256 int dtr;
257 unsigned char version; /* FDC version code */
258 unsigned char dor;
259 unsigned long address; /* io address */
260 unsigned int rawcmd:2;
261 unsigned int reset:1;
262 unsigned int need_configure:1;
263 unsigned int perp_mode:2;
264 unsigned int has_fifo:1;
265 unsigned int driver_version; /* version code for floppy driver */
266#define FD_DRIVER_VERSION 0x100
267/* user programs using the floppy API should use floppy_fdc_state to
268 * get the version number of the floppy driver that they are running
269 * on. If this version number is bigger than the one compiled into the
270 * user program (the FD_DRIVER_VERSION define), it should be prepared
271 * to bigger structures
272 */
273
274 unsigned char track[4];
275 /* Position of the heads of the 4 units attached to this FDC,
276 * as stored on the FDC. In the future, the position as stored
277 * on the FDC might not agree with the actual physical
278 * position of these drive heads. By allowing such
279 * disagreement, it will be possible to reset the FDC without
280 * incurring the expensive cost of repositioning all heads.
281 * Right now, these positions are hard wired to 0. */
282
283};
284
285#define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state)
286
287
288/*
289 * Asynchronous Write error tracking
290 */
291struct floppy_write_errors {
292 /* Write error logging.
293 *
294 * These fields can be cleared with the FDWERRORCLR ioctl.
295 * Only writes that were attempted but failed due to a physical media
296 * error are logged. write(2) calls that fail and return an error code
297 * to the user process are not counted.
298 */
299
300 unsigned int write_errors; /* number of physical write errors
301 * encountered */
302
303 /* position of first and last write errors */
304 unsigned long first_error_sector;
305 int first_error_generation;
306 unsigned long last_error_sector;
307 int last_error_generation;
308
309 unsigned int badness; /* highest retry count for a read or write
310 * operation */
311};
312
313#define FDWERRORCLR _IO(2, 0x56)
314/* clear write error and badness information */
315#define FDWERRORGET _IOR(2, 0x17, struct floppy_write_errors)
316/* get write error and badness information */
317
318
319/*
320 * Raw commands
321 */
322/* new interface flag: now we can do them in batches */
323#define FDHAVEBATCHEDRAWCMD
324
325struct floppy_raw_cmd {
326 unsigned int flags;
327#define FD_RAW_READ 1
328#define FD_RAW_WRITE 2
329#define FD_RAW_NO_MOTOR 4
330#define FD_RAW_DISK_CHANGE 4 /* out: disk change flag was set */
331#define FD_RAW_INTR 8 /* wait for an interrupt */
332#define FD_RAW_SPIN 0x10 /* spin up the disk for this command */
333#define FD_RAW_NO_MOTOR_AFTER 0x20 /* switch the motor off after command
334 * completion */
335#define FD_RAW_NEED_DISK 0x40 /* this command needs a disk to be present */
336#define FD_RAW_NEED_SEEK 0x80 /* this command uses an implied seek (soft) */
337
338/* more "in" flags */
339#define FD_RAW_MORE 0x100 /* more records follow */
340#define FD_RAW_STOP_IF_FAILURE 0x200 /* stop if we encounter a failure */
341#define FD_RAW_STOP_IF_SUCCESS 0x400 /* stop if command successful */
342#define FD_RAW_SOFTFAILURE 0x800 /* consider the return value for failure
343 * detection too */
344
345/* more "out" flags */
346#define FD_RAW_FAILURE 0x10000 /* command sent to fdc, fdc returned error */
347#define FD_RAW_HARDFAILURE 0x20000 /* fdc had to be reset, or timed out */
348
349 void __user *data;
350 char *kernel_data; /* location of data buffer in the kernel */
351 struct floppy_raw_cmd *next; /* used for chaining of raw cmd's
352 * within the kernel */
353 long length; /* in: length of dma transfer. out: remaining bytes */
354 long phys_length; /* physical length, if different from dma length */
355 int buffer_length; /* length of allocated buffer */
356
357 unsigned char rate;
358 unsigned char cmd_count;
359 unsigned char cmd[16];
360 unsigned char reply_count;
361 unsigned char reply[16];
362 int track;
363 int resultcode;
364
365 int reserved1;
366 int reserved2;
367};
368
369#define FDRAWCMD _IO(2, 0x58)
370/* send a raw command to the fdc. Structure size not included, because of
371 * batches */
372
373#define FDTWADDLE _IO(2, 0x59)
374/* flicker motor-on bit before reading a sector. Experimental */
375
376
377#define FDEJECT _IO(2, 0x5a)
378/* eject the disk */
379
380
381#ifdef __KERNEL__
382#ifdef CONFIG_COMPAT 6#ifdef CONFIG_COMPAT
383#include <linux/compat.h> 7#include <linux/compat.h>
384 8
@@ -398,5 +22,3 @@ struct compat_floppy_struct {
398#define FDGETPRM32 _IOR(2, 0x04, struct compat_floppy_struct) 22#define FDGETPRM32 _IOR(2, 0x04, struct compat_floppy_struct)
399#endif 23#endif
400#endif 24#endif
401
402#endif
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 2ded090e10f4..24d251f3bab0 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -1,141 +1,12 @@
1/* 1/*
2 * Linux Socket Filter Data Structures 2 * Linux Socket Filter Data Structures
3 */ 3 */
4
5#ifndef __LINUX_FILTER_H__ 4#ifndef __LINUX_FILTER_H__
6#define __LINUX_FILTER_H__ 5#define __LINUX_FILTER_H__
7 6
8#include <linux/compiler.h>
9#include <linux/types.h>
10
11#ifdef __KERNEL__
12#include <linux/atomic.h> 7#include <linux/atomic.h>
13#include <linux/compat.h> 8#include <linux/compat.h>
14#endif 9#include <uapi/linux/filter.h>
15
16/*
17 * Current version of the filter code architecture.
18 */
19#define BPF_MAJOR_VERSION 1
20#define BPF_MINOR_VERSION 1
21
22/*
23 * Try and keep these values and structures similar to BSD, especially
24 * the BPF code definitions which need to match so you can share filters
25 */
26
27struct sock_filter { /* Filter block */
28 __u16 code; /* Actual filter code */
29 __u8 jt; /* Jump true */
30 __u8 jf; /* Jump false */
31 __u32 k; /* Generic multiuse field */
32};
33
34struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
35 unsigned short len; /* Number of filter blocks */
36 struct sock_filter __user *filter;
37};
38
39/*
40 * Instruction classes
41 */
42
43#define BPF_CLASS(code) ((code) & 0x07)
44#define BPF_LD 0x00
45#define BPF_LDX 0x01
46#define BPF_ST 0x02
47#define BPF_STX 0x03
48#define BPF_ALU 0x04
49#define BPF_JMP 0x05
50#define BPF_RET 0x06
51#define BPF_MISC 0x07
52
53/* ld/ldx fields */
54#define BPF_SIZE(code) ((code) & 0x18)
55#define BPF_W 0x00
56#define BPF_H 0x08
57#define BPF_B 0x10
58#define BPF_MODE(code) ((code) & 0xe0)
59#define BPF_IMM 0x00
60#define BPF_ABS 0x20
61#define BPF_IND 0x40
62#define BPF_MEM 0x60
63#define BPF_LEN 0x80
64#define BPF_MSH 0xa0
65
66/* alu/jmp fields */
67#define BPF_OP(code) ((code) & 0xf0)
68#define BPF_ADD 0x00
69#define BPF_SUB 0x10
70#define BPF_MUL 0x20
71#define BPF_DIV 0x30
72#define BPF_OR 0x40
73#define BPF_AND 0x50
74#define BPF_LSH 0x60
75#define BPF_RSH 0x70
76#define BPF_NEG 0x80
77#define BPF_MOD 0x90
78#define BPF_XOR 0xa0
79
80#define BPF_JA 0x00
81#define BPF_JEQ 0x10
82#define BPF_JGT 0x20
83#define BPF_JGE 0x30
84#define BPF_JSET 0x40
85#define BPF_SRC(code) ((code) & 0x08)
86#define BPF_K 0x00
87#define BPF_X 0x08
88
89/* ret - BPF_K and BPF_X also apply */
90#define BPF_RVAL(code) ((code) & 0x18)
91#define BPF_A 0x10
92
93/* misc */
94#define BPF_MISCOP(code) ((code) & 0xf8)
95#define BPF_TAX 0x00
96#define BPF_TXA 0x80
97
98#ifndef BPF_MAXINSNS
99#define BPF_MAXINSNS 4096
100#endif
101
102/*
103 * Macros for filter block array initializers.
104 */
105#ifndef BPF_STMT
106#define BPF_STMT(code, k) { (unsigned short)(code), 0, 0, k }
107#endif
108#ifndef BPF_JUMP
109#define BPF_JUMP(code, k, jt, jf) { (unsigned short)(code), jt, jf, k }
110#endif
111
112/*
113 * Number of scratch memory words for: BPF_ST and BPF_STX
114 */
115#define BPF_MEMWORDS 16
116
117/* RATIONALE. Negative offsets are invalid in BPF.
118 We use them to reference ancillary data.
119 Unlike introduction new instructions, it does not break
120 existing compilers/optimizers.
121 */
122#define SKF_AD_OFF (-0x1000)
123#define SKF_AD_PROTOCOL 0
124#define SKF_AD_PKTTYPE 4
125#define SKF_AD_IFINDEX 8
126#define SKF_AD_NLATTR 12
127#define SKF_AD_NLATTR_NEST 16
128#define SKF_AD_MARK 20
129#define SKF_AD_QUEUE 24
130#define SKF_AD_HATYPE 28
131#define SKF_AD_RXHASH 32
132#define SKF_AD_CPU 36
133#define SKF_AD_ALU_XOR_X 40
134#define SKF_AD_MAX 44
135#define SKF_NET_OFF (-0x100000)
136#define SKF_LL_OFF (-0x200000)
137
138#ifdef __KERNEL__
139 10
140#ifdef CONFIG_COMPAT 11#ifdef CONFIG_COMPAT
141/* 12/*
@@ -254,6 +125,4 @@ enum {
254 BPF_S_ANC_SECCOMP_LD_W, 125 BPF_S_ANC_SECCOMP_LD_W,
255}; 126};
256 127
257#endif /* __KERNEL__ */
258
259#endif /* __LINUX_FILTER_H__ */ 128#endif /* __LINUX_FILTER_H__ */
diff --git a/include/linux/flat.h b/include/linux/flat.h
index ec56852e2659..2c1eb15c4ba4 100644
--- a/include/linux/flat.h
+++ b/include/linux/flat.h
@@ -6,58 +6,12 @@
6 * This file provides the definitions and structures needed to 6 * This file provides the definitions and structures needed to
7 * support uClinux flat-format executables. 7 * support uClinux flat-format executables.
8 */ 8 */
9
10#ifndef _LINUX_FLAT_H 9#ifndef _LINUX_FLAT_H
11#define _LINUX_FLAT_H 10#define _LINUX_FLAT_H
12 11
13#ifdef __KERNEL__
14#include <asm/flat.h> 12#include <asm/flat.h>
15#endif 13#include <uapi/linux/flat.h>
16
17#define FLAT_VERSION 0x00000004L
18
19#ifdef CONFIG_BINFMT_SHARED_FLAT
20#define MAX_SHARED_LIBS (4)
21#else
22#define MAX_SHARED_LIBS (1)
23#endif
24
25/*
26 * To make everything easier to port and manage cross platform
27 * development, all fields are in network byte order.
28 */
29 14
30struct flat_hdr {
31 char magic[4];
32 unsigned long rev; /* version (as above) */
33 unsigned long entry; /* Offset of first executable instruction
34 with text segment from beginning of file */
35 unsigned long data_start; /* Offset of data segment from beginning of
36 file */
37 unsigned long data_end; /* Offset of end of data segment
38 from beginning of file */
39 unsigned long bss_end; /* Offset of end of bss segment from beginning
40 of file */
41
42 /* (It is assumed that data_end through bss_end forms the bss segment.) */
43
44 unsigned long stack_size; /* Size of stack, in bytes */
45 unsigned long reloc_start; /* Offset of relocation records from
46 beginning of file */
47 unsigned long reloc_count; /* Number of relocation records */
48 unsigned long flags;
49 unsigned long build_date; /* When the program/library was built */
50 unsigned long filler[5]; /* Reservered, set to zero */
51};
52
53#define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */
54#define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */
55#define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */
56#define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */
57#define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */
58
59
60#ifdef __KERNEL__ /* so systems without linux headers can compile the apps */
61/* 15/*
62 * While it would be nice to keep this header clean, users of older 16 * While it would be nice to keep this header clean, users of older
63 * tools still need this support in the kernel. So this section is 17 * tools still need this support in the kernel. So this section is
@@ -95,6 +49,4 @@ typedef union {
95 } reloc; 49 } reloc;
96} flat_v2_reloc_t; 50} flat_v2_reloc_t;
97 51
98#endif /* __KERNEL__ */
99
100#endif /* _LINUX_FLAT_H */ 52#endif /* _LINUX_FLAT_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index ca6d8c806f47..b33cfc97b9ca 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1,62 +1,68 @@
1#ifndef _LINUX_FS_H 1#ifndef _LINUX_FS_H
2#define _LINUX_FS_H 2#define _LINUX_FS_H
3 3
4/*
5 * This file has definitions for some important file table
6 * structures etc.
7 */
8 4
9#include <linux/limits.h> 5#include <linux/linkage.h>
10#include <linux/ioctl.h> 6#include <linux/wait.h>
7#include <linux/kdev_t.h>
8#include <linux/dcache.h>
9#include <linux/path.h>
10#include <linux/stat.h>
11#include <linux/cache.h>
12#include <linux/list.h>
13#include <linux/radix-tree.h>
14#include <linux/rbtree.h>
15#include <linux/init.h>
16#include <linux/pid.h>
17#include <linux/bug.h>
18#include <linux/mutex.h>
19#include <linux/capability.h>
20#include <linux/semaphore.h>
21#include <linux/fiemap.h>
22#include <linux/rculist_bl.h>
23#include <linux/atomic.h>
24#include <linux/shrinker.h>
25#include <linux/migrate_mode.h>
26#include <linux/uidgid.h>
27#include <linux/lockdep.h>
28#include <linux/percpu-rwsem.h>
11#include <linux/blk_types.h> 29#include <linux/blk_types.h>
12#include <linux/types.h>
13 30
14/* 31#include <asm/byteorder.h>
15 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change 32#include <uapi/linux/fs.h>
16 * the file limit at runtime and only root can increase the per-process
17 * nr_file rlimit, so it's safe to set up a ridiculously high absolute
18 * upper limit on files-per-process.
19 *
20 * Some programs (notably those using select()) may have to be
21 * recompiled to take full advantage of the new limits..
22 */
23
24/* Fixed constants first: */
25#undef NR_OPEN
26#define INR_OPEN_CUR 1024 /* Initial setting for nfile rlimits */
27#define INR_OPEN_MAX 4096 /* Hard limit for nfile rlimits */
28
29#define BLOCK_SIZE_BITS 10
30#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
31
32#define SEEK_SET 0 /* seek relative to beginning of file */
33#define SEEK_CUR 1 /* seek relative to current file position */
34#define SEEK_END 2 /* seek relative to end of file */
35#define SEEK_DATA 3 /* seek to the next data */
36#define SEEK_HOLE 4 /* seek to the next hole */
37#define SEEK_MAX SEEK_HOLE
38
39struct fstrim_range {
40 __u64 start;
41 __u64 len;
42 __u64 minlen;
43};
44 33
45/* And dynamically-tunable limits and defaults: */ 34struct export_operations;
46struct files_stat_struct { 35struct hd_geometry;
47 unsigned long nr_files; /* read only */ 36struct iovec;
48 unsigned long nr_free_files; /* read only */ 37struct nameidata;
49 unsigned long max_files; /* tunable */ 38struct kiocb;
50}; 39struct kobject;
40struct pipe_inode_info;
41struct poll_table_struct;
42struct kstatfs;
43struct vm_area_struct;
44struct vfsmount;
45struct cred;
46struct swap_info_struct;
51 47
52struct inodes_stat_t { 48extern void __init inode_init(void);
53 int nr_inodes; 49extern void __init inode_init_early(void);
54 int nr_unused; 50extern void __init files_init(unsigned long);
55 int dummy[5]; /* padding for sysctl ABI compatibility */
56};
57 51
52extern struct files_stat_struct files_stat;
53extern unsigned long get_max_files(void);
54extern int sysctl_nr_open;
55extern struct inodes_stat_t inodes_stat;
56extern int leases_enable, lease_break_time;
57extern int sysctl_protected_symlinks;
58extern int sysctl_protected_hardlinks;
58 59
59#define NR_FILE 8192 /* this can well be larger on a larger system */ 60struct buffer_head;
61typedef int (get_block_t)(struct inode *inode, sector_t iblock,
62 struct buffer_head *bh_result, int create);
63typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
64 ssize_t bytes, void *private, int ret,
65 bool is_async);
60 66
61#define MAY_EXEC 0x00000001 67#define MAY_EXEC 0x00000001
62#define MAY_WRITE 0x00000002 68#define MAY_WRITE 0x00000002
@@ -118,6 +124,14 @@ struct inodes_stat_t {
118#define FMODE_NONOTIFY ((__force fmode_t)0x1000000) 124#define FMODE_NONOTIFY ((__force fmode_t)0x1000000)
119 125
120/* 126/*
127 * Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector
128 * that indicates that they should check the contents of the iovec are
129 * valid, but not check the memory that the iovec elements
130 * points too.
131 */
132#define CHECK_IOVEC_ONLY -1
133
134/*
121 * The below are the various read and write types that we support. Some of 135 * The below are the various read and write types that we support. Some of
122 * them include behavioral modifiers that send information down to the 136 * them include behavioral modifiers that send information down to the
123 * block layer and IO scheduler. Terminology: 137 * block layer and IO scheduler. Terminology:
@@ -175,282 +189,6 @@ struct inodes_stat_t {
175#define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FUA) 189#define WRITE_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FUA)
176#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA) 190#define WRITE_FLUSH_FUA (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_FLUSH | REQ_FUA)
177 191
178
179/*
180 * Flag for rw_copy_check_uvector and compat_rw_copy_check_uvector
181 * that indicates that they should check the contents of the iovec are
182 * valid, but not check the memory that the iovec elements
183 * points too.
184 */
185#define CHECK_IOVEC_ONLY -1
186
187#define SEL_IN 1
188#define SEL_OUT 2
189#define SEL_EX 4
190
191/* public flags for file_system_type */
192#define FS_REQUIRES_DEV 1
193#define FS_BINARY_MOUNTDATA 2
194#define FS_HAS_SUBTYPE 4
195#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */
196#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move()
197 * during rename() internally.
198 */
199
200/*
201 * These are the fs-independent mount-flags: up to 32 flags are supported
202 */
203#define MS_RDONLY 1 /* Mount read-only */
204#define MS_NOSUID 2 /* Ignore suid and sgid bits */
205#define MS_NODEV 4 /* Disallow access to device special files */
206#define MS_NOEXEC 8 /* Disallow program execution */
207#define MS_SYNCHRONOUS 16 /* Writes are synced at once */
208#define MS_REMOUNT 32 /* Alter flags of a mounted FS */
209#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */
210#define MS_DIRSYNC 128 /* Directory modifications are synchronous */
211#define MS_NOATIME 1024 /* Do not update access times. */
212#define MS_NODIRATIME 2048 /* Do not update directory access times */
213#define MS_BIND 4096
214#define MS_MOVE 8192
215#define MS_REC 16384
216#define MS_VERBOSE 32768 /* War is peace. Verbosity is silence.
217 MS_VERBOSE is deprecated. */
218#define MS_SILENT 32768
219#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
220#define MS_UNBINDABLE (1<<17) /* change to unbindable */
221#define MS_PRIVATE (1<<18) /* change to private */
222#define MS_SLAVE (1<<19) /* change to slave */
223#define MS_SHARED (1<<20) /* change to shared */
224#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
225#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
226#define MS_I_VERSION (1<<23) /* Update inode I_version field */
227#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
228#define MS_NOSEC (1<<28)
229#define MS_BORN (1<<29)
230#define MS_ACTIVE (1<<30)
231#define MS_NOUSER (1<<31)
232
233/*
234 * Superblock flags that can be altered by MS_REMOUNT
235 */
236#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION)
237
238/*
239 * Old magic mount flag and mask
240 */
241#define MS_MGC_VAL 0xC0ED0000
242#define MS_MGC_MSK 0xffff0000
243
244/* Inode flags - they have nothing to superblock flags now */
245
246#define S_SYNC 1 /* Writes are synced at once */
247#define S_NOATIME 2 /* Do not update access times */
248#define S_APPEND 4 /* Append-only file */
249#define S_IMMUTABLE 8 /* Immutable file */
250#define S_DEAD 16 /* removed, but still open directory */
251#define S_NOQUOTA 32 /* Inode is not counted to quota */
252#define S_DIRSYNC 64 /* Directory modifications are synchronous */
253#define S_NOCMTIME 128 /* Do not update file c/mtime */
254#define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */
255#define S_PRIVATE 512 /* Inode is fs-internal */
256#define S_IMA 1024 /* Inode has an associated IMA struct */
257#define S_AUTOMOUNT 2048 /* Automount/referral quasi-directory */
258#define S_NOSEC 4096 /* no suid or xattr security attributes */
259
260/*
261 * Note that nosuid etc flags are inode-specific: setting some file-system
262 * flags just means all the inodes inherit those flags by default. It might be
263 * possible to override it selectively if you really wanted to with some
264 * ioctl() that is not currently implemented.
265 *
266 * Exception: MS_RDONLY is always applied to the entire file system.
267 *
268 * Unfortunately, it is possible to change a filesystems flags with it mounted
269 * with files in use. This means that all of the inodes will not have their
270 * i_flags updated. Hence, i_flags no longer inherit the superblock mount
271 * flags, so these have to be checked separately. -- rmk@arm.uk.linux.org
272 */
273#define __IS_FLG(inode,flg) ((inode)->i_sb->s_flags & (flg))
274
275#define IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY)
276#define IS_SYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS) || \
277 ((inode)->i_flags & S_SYNC))
278#define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \
279 ((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
280#define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK)
281#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
282#define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION)
283
284#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
285#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
286#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
287#define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL)
288
289#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD)
290#define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME)
291#define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE)
292#define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE)
293#define IS_IMA(inode) ((inode)->i_flags & S_IMA)
294#define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT)
295#define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC)
296
297/* the read-only stuff doesn't really belong here, but any other place is
298 probably as bad and I don't want to create yet another include file. */
299
300#define BLKROSET _IO(0x12,93) /* set device read-only (0 = read-write) */
301#define BLKROGET _IO(0x12,94) /* get read-only status (0 = read_write) */
302#define BLKRRPART _IO(0x12,95) /* re-read partition table */
303#define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */
304#define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */
305#define BLKRASET _IO(0x12,98) /* set read ahead for block device */
306#define BLKRAGET _IO(0x12,99) /* get current read ahead setting */
307#define BLKFRASET _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
308#define BLKFRAGET _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
309#define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
310#define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
311#define BLKSSZGET _IO(0x12,104)/* get block device sector size */
312#if 0
313#define BLKPG _IO(0x12,105)/* See blkpg.h */
314
315/* Some people are morons. Do not use sizeof! */
316
317#define BLKELVGET _IOR(0x12,106,size_t)/* elevator get */
318#define BLKELVSET _IOW(0x12,107,size_t)/* elevator set */
319/* This was here just to show that the number is taken -
320 probably all these _IO(0x12,*) ioctls should be moved to blkpg.h. */
321#endif
322/* A jump here: 108-111 have been used for various private purposes. */
323#define BLKBSZGET _IOR(0x12,112,size_t)
324#define BLKBSZSET _IOW(0x12,113,size_t)
325#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */
326#define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup)
327#define BLKTRACESTART _IO(0x12,116)
328#define BLKTRACESTOP _IO(0x12,117)
329#define BLKTRACETEARDOWN _IO(0x12,118)
330#define BLKDISCARD _IO(0x12,119)
331#define BLKIOMIN _IO(0x12,120)
332#define BLKIOOPT _IO(0x12,121)
333#define BLKALIGNOFF _IO(0x12,122)
334#define BLKPBSZGET _IO(0x12,123)
335#define BLKDISCARDZEROES _IO(0x12,124)
336#define BLKSECDISCARD _IO(0x12,125)
337#define BLKROTATIONAL _IO(0x12,126)
338
339#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
340#define FIBMAP _IO(0x00,1) /* bmap access */
341#define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */
342#define FIFREEZE _IOWR('X', 119, int) /* Freeze */
343#define FITHAW _IOWR('X', 120, int) /* Thaw */
344#define FITRIM _IOWR('X', 121, struct fstrim_range) /* Trim */
345
346#define FS_IOC_GETFLAGS _IOR('f', 1, long)
347#define FS_IOC_SETFLAGS _IOW('f', 2, long)
348#define FS_IOC_GETVERSION _IOR('v', 1, long)
349#define FS_IOC_SETVERSION _IOW('v', 2, long)
350#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
351#define FS_IOC32_GETFLAGS _IOR('f', 1, int)
352#define FS_IOC32_SETFLAGS _IOW('f', 2, int)
353#define FS_IOC32_GETVERSION _IOR('v', 1, int)
354#define FS_IOC32_SETVERSION _IOW('v', 2, int)
355
356/*
357 * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)
358 */
359#define FS_SECRM_FL 0x00000001 /* Secure deletion */
360#define FS_UNRM_FL 0x00000002 /* Undelete */
361#define FS_COMPR_FL 0x00000004 /* Compress file */
362#define FS_SYNC_FL 0x00000008 /* Synchronous updates */
363#define FS_IMMUTABLE_FL 0x00000010 /* Immutable file */
364#define FS_APPEND_FL 0x00000020 /* writes to file may only append */
365#define FS_NODUMP_FL 0x00000040 /* do not dump file */
366#define FS_NOATIME_FL 0x00000080 /* do not update atime */
367/* Reserved for compression usage... */
368#define FS_DIRTY_FL 0x00000100
369#define FS_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
370#define FS_NOCOMP_FL 0x00000400 /* Don't compress */
371#define FS_ECOMPR_FL 0x00000800 /* Compression error */
372/* End compression flags --- maybe not all used */
373#define FS_BTREE_FL 0x00001000 /* btree format dir */
374#define FS_INDEX_FL 0x00001000 /* hash-indexed directory */
375#define FS_IMAGIC_FL 0x00002000 /* AFS directory */
376#define FS_JOURNAL_DATA_FL 0x00004000 /* Reserved for ext3 */
377#define FS_NOTAIL_FL 0x00008000 /* file tail should not be merged */
378#define FS_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
379#define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
380#define FS_EXTENT_FL 0x00080000 /* Extents */
381#define FS_DIRECTIO_FL 0x00100000 /* Use direct i/o */
382#define FS_NOCOW_FL 0x00800000 /* Do not cow file */
383#define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
384
385#define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
386#define FS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
387
388
389#define SYNC_FILE_RANGE_WAIT_BEFORE 1
390#define SYNC_FILE_RANGE_WRITE 2
391#define SYNC_FILE_RANGE_WAIT_AFTER 4
392
393#ifdef __KERNEL__
394
395#include <linux/linkage.h>
396#include <linux/wait.h>
397#include <linux/kdev_t.h>
398#include <linux/dcache.h>
399#include <linux/path.h>
400#include <linux/stat.h>
401#include <linux/cache.h>
402#include <linux/list.h>
403#include <linux/radix-tree.h>
404#include <linux/prio_tree.h>
405#include <linux/init.h>
406#include <linux/pid.h>
407#include <linux/bug.h>
408#include <linux/mutex.h>
409#include <linux/capability.h>
410#include <linux/semaphore.h>
411#include <linux/fiemap.h>
412#include <linux/rculist_bl.h>
413#include <linux/atomic.h>
414#include <linux/shrinker.h>
415#include <linux/migrate_mode.h>
416#include <linux/uidgid.h>
417#include <linux/lockdep.h>
418
419#include <asm/byteorder.h>
420
421struct export_operations;
422struct hd_geometry;
423struct iovec;
424struct nameidata;
425struct kiocb;
426struct kobject;
427struct pipe_inode_info;
428struct poll_table_struct;
429struct kstatfs;
430struct vm_area_struct;
431struct vfsmount;
432struct cred;
433struct swap_info_struct;
434
435extern void __init inode_init(void);
436extern void __init inode_init_early(void);
437extern void __init files_init(unsigned long);
438
439extern struct files_stat_struct files_stat;
440extern unsigned long get_max_files(void);
441extern int sysctl_nr_open;
442extern struct inodes_stat_t inodes_stat;
443extern int leases_enable, lease_break_time;
444extern int sysctl_protected_symlinks;
445extern int sysctl_protected_hardlinks;
446
447struct buffer_head;
448typedef int (get_block_t)(struct inode *inode, sector_t iblock,
449 struct buffer_head *bh_result, int create);
450typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
451 ssize_t bytes, void *private, int ret,
452 bool is_async);
453
454/* 192/*
455 * Attribute flags. These should be or-ed together to figure out what 193 * Attribute flags. These should be or-ed together to figure out what
456 * has been changed! 194 * has been changed!
@@ -669,7 +407,7 @@ struct address_space {
669 struct radix_tree_root page_tree; /* radix tree of all pages */ 407 struct radix_tree_root page_tree; /* radix tree of all pages */
670 spinlock_t tree_lock; /* and lock protecting it */ 408 spinlock_t tree_lock; /* and lock protecting it */
671 unsigned int i_mmap_writable;/* count VM_SHARED mappings */ 409 unsigned int i_mmap_writable;/* count VM_SHARED mappings */
672 struct prio_tree_root i_mmap; /* tree of private and shared mappings */ 410 struct rb_root i_mmap; /* tree of private and shared mappings */
673 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ 411 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
674 struct mutex i_mmap_mutex; /* protect tree, count, list */ 412 struct mutex i_mmap_mutex; /* protect tree, count, list */
675 /* Protected by tree_lock together with the radix tree */ 413 /* Protected by tree_lock together with the radix tree */
@@ -724,6 +462,8 @@ struct block_device {
724 int bd_fsfreeze_count; 462 int bd_fsfreeze_count;
725 /* Mutex for freeze */ 463 /* Mutex for freeze */
726 struct mutex bd_fsfreeze_mutex; 464 struct mutex bd_fsfreeze_mutex;
465 /* A semaphore that prevents I/O while block size is being changed */
466 struct percpu_rw_semaphore bd_block_size_semaphore;
727}; 467};
728 468
729/* 469/*
@@ -741,7 +481,7 @@ int mapping_tagged(struct address_space *mapping, int tag);
741 */ 481 */
742static inline int mapping_mapped(struct address_space *mapping) 482static inline int mapping_mapped(struct address_space *mapping)
743{ 483{
744 return !prio_tree_empty(&mapping->i_mmap) || 484 return !RB_EMPTY_ROOT(&mapping->i_mmap) ||
745 !list_empty(&mapping->i_mmap_nonlinear); 485 !list_empty(&mapping->i_mmap_nonlinear);
746} 486}
747 487
@@ -1132,7 +872,7 @@ static inline int file_check_writeable(struct file *filp)
1132#if BITS_PER_LONG==32 872#if BITS_PER_LONG==32
1133#define MAX_LFS_FILESIZE (((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1) 873#define MAX_LFS_FILESIZE (((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
1134#elif BITS_PER_LONG==64 874#elif BITS_PER_LONG==64
1135#define MAX_LFS_FILESIZE ((loff_t)0x7fffffffffffffff) 875#define MAX_LFS_FILESIZE ((loff_t)0x7fffffffffffffffLL)
1136#endif 876#endif
1137 877
1138#define FL_POSIX 1 878#define FL_POSIX 1
@@ -1507,7 +1247,6 @@ struct super_block {
1507 unsigned long s_magic; 1247 unsigned long s_magic;
1508 struct dentry *s_root; 1248 struct dentry *s_root;
1509 struct rw_semaphore s_umount; 1249 struct rw_semaphore s_umount;
1510 struct mutex s_lock;
1511 int s_count; 1250 int s_count;
1512 atomic_t s_active; 1251 atomic_t s_active;
1513#ifdef CONFIG_SECURITY 1252#ifdef CONFIG_SECURITY
@@ -1885,6 +1624,60 @@ struct super_operations {
1885}; 1624};
1886 1625
1887/* 1626/*
1627 * Inode flags - they have no relation to superblock flags now
1628 */
1629#define S_SYNC 1 /* Writes are synced at once */
1630#define S_NOATIME 2 /* Do not update access times */
1631#define S_APPEND 4 /* Append-only file */
1632#define S_IMMUTABLE 8 /* Immutable file */
1633#define S_DEAD 16 /* removed, but still open directory */
1634#define S_NOQUOTA 32 /* Inode is not counted to quota */
1635#define S_DIRSYNC 64 /* Directory modifications are synchronous */
1636#define S_NOCMTIME 128 /* Do not update file c/mtime */
1637#define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */
1638#define S_PRIVATE 512 /* Inode is fs-internal */
1639#define S_IMA 1024 /* Inode has an associated IMA struct */
1640#define S_AUTOMOUNT 2048 /* Automount/referral quasi-directory */
1641#define S_NOSEC 4096 /* no suid or xattr security attributes */
1642
1643/*
1644 * Note that nosuid etc flags are inode-specific: setting some file-system
1645 * flags just means all the inodes inherit those flags by default. It might be
1646 * possible to override it selectively if you really wanted to with some
1647 * ioctl() that is not currently implemented.
1648 *
1649 * Exception: MS_RDONLY is always applied to the entire file system.
1650 *
1651 * Unfortunately, it is possible to change a filesystems flags with it mounted
1652 * with files in use. This means that all of the inodes will not have their
1653 * i_flags updated. Hence, i_flags no longer inherit the superblock mount
1654 * flags, so these have to be checked separately. -- rmk@arm.uk.linux.org
1655 */
1656#define __IS_FLG(inode, flg) ((inode)->i_sb->s_flags & (flg))
1657
1658#define IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY)
1659#define IS_SYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS) || \
1660 ((inode)->i_flags & S_SYNC))
1661#define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \
1662 ((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
1663#define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK)
1664#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
1665#define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION)
1666
1667#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
1668#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
1669#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
1670#define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL)
1671
1672#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD)
1673#define IS_NOCMTIME(inode) ((inode)->i_flags & S_NOCMTIME)
1674#define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE)
1675#define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE)
1676#define IS_IMA(inode) ((inode)->i_flags & S_IMA)
1677#define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT)
1678#define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC)
1679
1680/*
1888 * Inode state bits. Protected by inode->i_lock 1681 * Inode state bits. Protected by inode->i_lock
1889 * 1682 *
1890 * Three bits determine the dirty state of the inode, I_DIRTY_SYNC, 1683 * Three bits determine the dirty state of the inode, I_DIRTY_SYNC,
@@ -2016,6 +1809,11 @@ int sync_inode_metadata(struct inode *inode, int wait);
2016struct file_system_type { 1809struct file_system_type {
2017 const char *name; 1810 const char *name;
2018 int fs_flags; 1811 int fs_flags;
1812#define FS_REQUIRES_DEV 1
1813#define FS_BINARY_MOUNTDATA 2
1814#define FS_HAS_SUBTYPE 4
1815#define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */
1816#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */
2019 struct dentry *(*mount) (struct file_system_type *, int, 1817 struct dentry *(*mount) (struct file_system_type *, int,
2020 const char *, void *); 1818 const char *, void *);
2021 void (*kill_sb) (struct super_block *); 1819 void (*kill_sb) (struct super_block *);
@@ -2076,7 +1874,7 @@ extern struct vfsmount *kern_mount_data(struct file_system_type *, void *data);
2076extern void kern_unmount(struct vfsmount *mnt); 1874extern void kern_unmount(struct vfsmount *mnt);
2077extern int may_umount_tree(struct vfsmount *); 1875extern int may_umount_tree(struct vfsmount *);
2078extern int may_umount(struct vfsmount *); 1876extern int may_umount(struct vfsmount *);
2079extern long do_mount(char *, char *, char *, unsigned long, void *); 1877extern long do_mount(const char *, const char *, const char *, unsigned long, void *);
2080extern struct vfsmount *collect_mounts(struct path *); 1878extern struct vfsmount *collect_mounts(struct path *);
2081extern void drop_collected_mounts(struct vfsmount *); 1879extern void drop_collected_mounts(struct vfsmount *);
2082extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, 1880extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
@@ -2193,6 +1991,13 @@ static inline int break_lease(struct inode *inode, unsigned int mode)
2193#endif /* CONFIG_FILE_LOCKING */ 1991#endif /* CONFIG_FILE_LOCKING */
2194 1992
2195/* fs/open.c */ 1993/* fs/open.c */
1994struct audit_names;
1995struct filename {
1996 const char *name; /* pointer to actual string */
1997 const __user char *uptr; /* original userland pointer */
1998 struct audit_names *aname;
1999 bool separate; /* should "name" be freed? */
2000};
2196 2001
2197extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs, 2002extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
2198 struct file *filp); 2003 struct file *filp);
@@ -2200,12 +2005,15 @@ extern int do_fallocate(struct file *file, int mode, loff_t offset,
2200 loff_t len); 2005 loff_t len);
2201extern long do_sys_open(int dfd, const char __user *filename, int flags, 2006extern long do_sys_open(int dfd, const char __user *filename, int flags,
2202 umode_t mode); 2007 umode_t mode);
2008extern struct file *file_open_name(struct filename *, int, umode_t);
2203extern struct file *filp_open(const char *, int, umode_t); 2009extern struct file *filp_open(const char *, int, umode_t);
2204extern struct file *file_open_root(struct dentry *, struct vfsmount *, 2010extern struct file *file_open_root(struct dentry *, struct vfsmount *,
2205 const char *, int); 2011 const char *, int);
2206extern struct file * dentry_open(const struct path *, int, const struct cred *); 2012extern struct file * dentry_open(const struct path *, int, const struct cred *);
2207extern int filp_close(struct file *, fl_owner_t id); 2013extern int filp_close(struct file *, fl_owner_t id);
2208extern char * getname(const char __user *); 2014
2015extern struct filename *getname(const char __user *);
2016
2209enum { 2017enum {
2210 FILE_CREATED = 1, 2018 FILE_CREATED = 1,
2211 FILE_OPENED = 2 2019 FILE_OPENED = 2
@@ -2225,13 +2033,14 @@ extern void __init vfs_caches_init(unsigned long);
2225 2033
2226extern struct kmem_cache *names_cachep; 2034extern struct kmem_cache *names_cachep;
2227 2035
2228#define __getname_gfp(gfp) kmem_cache_alloc(names_cachep, (gfp)) 2036extern void final_putname(struct filename *name);
2229#define __getname() __getname_gfp(GFP_KERNEL) 2037
2038#define __getname() kmem_cache_alloc(names_cachep, GFP_KERNEL)
2230#define __putname(name) kmem_cache_free(names_cachep, (void *)(name)) 2039#define __putname(name) kmem_cache_free(names_cachep, (void *)(name))
2231#ifndef CONFIG_AUDITSYSCALL 2040#ifndef CONFIG_AUDITSYSCALL
2232#define putname(name) __putname(name) 2041#define putname(name) final_putname(name)
2233#else 2042#else
2234extern void putname(const char *name); 2043extern void putname(struct filename *name);
2235#endif 2044#endif
2236 2045
2237#ifdef CONFIG_BLOCK 2046#ifdef CONFIG_BLOCK
@@ -2552,6 +2361,8 @@ extern int sb_min_blocksize(struct super_block *, int);
2552 2361
2553extern int generic_file_mmap(struct file *, struct vm_area_struct *); 2362extern int generic_file_mmap(struct file *, struct vm_area_struct *);
2554extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); 2363extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
2364extern int generic_file_remap_pages(struct vm_area_struct *, unsigned long addr,
2365 unsigned long size, pgoff_t pgoff);
2555extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); 2366extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
2556int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); 2367int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk);
2557extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t); 2368extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t);
@@ -2568,6 +2379,8 @@ extern int generic_segment_checks(const struct iovec *iov,
2568 unsigned long *nr_segs, size_t *count, int access_flags); 2379 unsigned long *nr_segs, size_t *count, int access_flags);
2569 2380
2570/* fs/block_dev.c */ 2381/* fs/block_dev.c */
2382extern ssize_t blkdev_aio_read(struct kiocb *iocb, const struct iovec *iov,
2383 unsigned long nr_segs, loff_t pos);
2571extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, 2384extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
2572 unsigned long nr_segs, loff_t pos); 2385 unsigned long nr_segs, loff_t pos);
2573extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, 2386extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end,
@@ -2859,5 +2672,4 @@ static inline void inode_has_no_xattr(struct inode *inode)
2859 inode->i_flags |= S_NOSEC; 2672 inode->i_flags |= S_NOSEC;
2860} 2673}
2861 2674
2862#endif /* __KERNEL__ */
2863#endif /* _LINUX_FS_H */ 2675#endif /* _LINUX_FS_H */
diff --git a/include/linux/fsl_hypervisor.h b/include/linux/fsl_hypervisor.h
index 1cebaeeeef57..2a707d7fb32c 100644
--- a/include/linux/fsl_hypervisor.h
+++ b/include/linux/fsl_hypervisor.h
@@ -36,187 +36,11 @@
36 * also be included by applications that need to communicate with the driver 36 * also be included by applications that need to communicate with the driver
37 * via the ioctl interface. 37 * via the ioctl interface.
38 */ 38 */
39
40#ifndef FSL_HYPERVISOR_H 39#ifndef FSL_HYPERVISOR_H
41#define FSL_HYPERVISOR_H 40#define FSL_HYPERVISOR_H
42 41
43#include <linux/types.h> 42#include <uapi/linux/fsl_hypervisor.h>
44
45/**
46 * struct fsl_hv_ioctl_restart - restart a partition
47 * @ret: return error code from the hypervisor
48 * @partition: the ID of the partition to restart, or -1 for the
49 * calling partition
50 *
51 * Used by FSL_HV_IOCTL_PARTITION_RESTART
52 */
53struct fsl_hv_ioctl_restart {
54 __u32 ret;
55 __u32 partition;
56};
57 43
58/**
59 * struct fsl_hv_ioctl_status - get a partition's status
60 * @ret: return error code from the hypervisor
61 * @partition: the ID of the partition to query, or -1 for the
62 * calling partition
63 * @status: The returned status of the partition
64 *
65 * Used by FSL_HV_IOCTL_PARTITION_GET_STATUS
66 *
67 * Values of 'status':
68 * 0 = Stopped
69 * 1 = Running
70 * 2 = Starting
71 * 3 = Stopping
72 */
73struct fsl_hv_ioctl_status {
74 __u32 ret;
75 __u32 partition;
76 __u32 status;
77};
78
79/**
80 * struct fsl_hv_ioctl_start - start a partition
81 * @ret: return error code from the hypervisor
82 * @partition: the ID of the partition to control
83 * @entry_point: The offset within the guest IMA to start execution
84 * @load: If non-zero, reload the partition's images before starting
85 *
86 * Used by FSL_HV_IOCTL_PARTITION_START
87 */
88struct fsl_hv_ioctl_start {
89 __u32 ret;
90 __u32 partition;
91 __u32 entry_point;
92 __u32 load;
93};
94
95/**
96 * struct fsl_hv_ioctl_stop - stop a partition
97 * @ret: return error code from the hypervisor
98 * @partition: the ID of the partition to stop, or -1 for the calling
99 * partition
100 *
101 * Used by FSL_HV_IOCTL_PARTITION_STOP
102 */
103struct fsl_hv_ioctl_stop {
104 __u32 ret;
105 __u32 partition;
106};
107
108/**
109 * struct fsl_hv_ioctl_memcpy - copy memory between partitions
110 * @ret: return error code from the hypervisor
111 * @source: the partition ID of the source partition, or -1 for this
112 * partition
113 * @target: the partition ID of the target partition, or -1 for this
114 * partition
115 * @reserved: reserved, must be set to 0
116 * @local_addr: user-space virtual address of a buffer in the local
117 * partition
118 * @remote_addr: guest physical address of a buffer in the
119 * remote partition
120 * @count: the number of bytes to copy. Both the local and remote
121 * buffers must be at least 'count' bytes long
122 *
123 * Used by FSL_HV_IOCTL_MEMCPY
124 *
125 * The 'local' partition is the partition that calls this ioctl. The
126 * 'remote' partition is a different partition. The data is copied from
127 * the 'source' paritition' to the 'target' partition.
128 *
129 * The buffer in the remote partition must be guest physically
130 * contiguous.
131 *
132 * This ioctl does not support copying memory between two remote
133 * partitions or within the same partition, so either 'source' or
134 * 'target' (but not both) must be -1. In other words, either
135 *
136 * source == local and target == remote
137 * or
138 * source == remote and target == local
139 */
140struct fsl_hv_ioctl_memcpy {
141 __u32 ret;
142 __u32 source;
143 __u32 target;
144 __u32 reserved; /* padding to ensure local_vaddr is aligned */
145 __u64 local_vaddr;
146 __u64 remote_paddr;
147 __u64 count;
148};
149
150/**
151 * struct fsl_hv_ioctl_doorbell - ring a doorbell
152 * @ret: return error code from the hypervisor
153 * @doorbell: the handle of the doorbell to ring doorbell
154 *
155 * Used by FSL_HV_IOCTL_DOORBELL
156 */
157struct fsl_hv_ioctl_doorbell {
158 __u32 ret;
159 __u32 doorbell;
160};
161
162/**
163 * struct fsl_hv_ioctl_prop - get/set a device tree property
164 * @ret: return error code from the hypervisor
165 * @handle: handle of partition whose tree to access
166 * @path: virtual address of path name of node to access
167 * @propname: virtual address of name of property to access
168 * @propval: virtual address of property data buffer
169 * @proplen: Size of property data buffer
170 * @reserved: reserved, must be set to 0
171 *
172 * Used by FSL_HV_IOCTL_DOORBELL
173 */
174struct fsl_hv_ioctl_prop {
175 __u32 ret;
176 __u32 handle;
177 __u64 path;
178 __u64 propname;
179 __u64 propval;
180 __u32 proplen;
181 __u32 reserved; /* padding to ensure structure is aligned */
182};
183
184/* The ioctl type, documented in ioctl-number.txt */
185#define FSL_HV_IOCTL_TYPE 0xAF
186
187/* Restart another partition */
188#define FSL_HV_IOCTL_PARTITION_RESTART \
189 _IOWR(FSL_HV_IOCTL_TYPE, 1, struct fsl_hv_ioctl_restart)
190
191/* Get a partition's status */
192#define FSL_HV_IOCTL_PARTITION_GET_STATUS \
193 _IOWR(FSL_HV_IOCTL_TYPE, 2, struct fsl_hv_ioctl_status)
194
195/* Boot another partition */
196#define FSL_HV_IOCTL_PARTITION_START \
197 _IOWR(FSL_HV_IOCTL_TYPE, 3, struct fsl_hv_ioctl_start)
198
199/* Stop this or another partition */
200#define FSL_HV_IOCTL_PARTITION_STOP \
201 _IOWR(FSL_HV_IOCTL_TYPE, 4, struct fsl_hv_ioctl_stop)
202
203/* Copy data from one partition to another */
204#define FSL_HV_IOCTL_MEMCPY \
205 _IOWR(FSL_HV_IOCTL_TYPE, 5, struct fsl_hv_ioctl_memcpy)
206
207/* Ring a doorbell */
208#define FSL_HV_IOCTL_DOORBELL \
209 _IOWR(FSL_HV_IOCTL_TYPE, 6, struct fsl_hv_ioctl_doorbell)
210
211/* Get a property from another guest's device tree */
212#define FSL_HV_IOCTL_GETPROP \
213 _IOWR(FSL_HV_IOCTL_TYPE, 7, struct fsl_hv_ioctl_prop)
214
215/* Set a property in another guest's device tree */
216#define FSL_HV_IOCTL_SETPROP \
217 _IOWR(FSL_HV_IOCTL_TYPE, 8, struct fsl_hv_ioctl_prop)
218
219#ifdef __KERNEL__
220 44
221/** 45/**
222 * fsl_hv_event_register() - register a callback for failover events 46 * fsl_hv_event_register() - register a callback for failover events
@@ -237,5 +61,3 @@ int fsl_hv_failover_register(struct notifier_block *nb);
237int fsl_hv_failover_unregister(struct notifier_block *nb); 61int fsl_hv_failover_unregister(struct notifier_block *nb);
238 62
239#endif 63#endif
240
241#endif
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index a6dfe6944564..0fbfb4646d1b 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -109,7 +109,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
109 109
110 if (source) 110 if (source)
111 fsnotify(source, FS_MOVE_SELF, moved->d_inode, FSNOTIFY_EVENT_INODE, NULL, 0); 111 fsnotify(source, FS_MOVE_SELF, moved->d_inode, FSNOTIFY_EVENT_INODE, NULL, 0);
112 audit_inode_child(moved, new_dir); 112 audit_inode_child(new_dir, moved, AUDIT_TYPE_CHILD_CREATE);
113} 113}
114 114
115/* 115/*
@@ -155,7 +155,7 @@ static inline void fsnotify_inoderemove(struct inode *inode)
155 */ 155 */
156static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) 156static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
157{ 157{
158 audit_inode_child(dentry, inode); 158 audit_inode_child(inode, dentry, AUDIT_TYPE_CHILD_CREATE);
159 159
160 fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); 160 fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0);
161} 161}
@@ -168,7 +168,7 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
168static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry) 168static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry)
169{ 169{
170 fsnotify_link_count(inode); 170 fsnotify_link_count(inode);
171 audit_inode_child(new_dentry, dir); 171 audit_inode_child(dir, new_dentry, AUDIT_TYPE_CHILD_CREATE);
172 172
173 fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, new_dentry->d_name.name, 0); 173 fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, new_dentry->d_name.name, 0);
174} 174}
@@ -181,7 +181,7 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
181 __u32 mask = (FS_CREATE | FS_ISDIR); 181 __u32 mask = (FS_CREATE | FS_ISDIR);
182 struct inode *d_inode = dentry->d_inode; 182 struct inode *d_inode = dentry->d_inode;
183 183
184 audit_inode_child(dentry, inode); 184 audit_inode_child(inode, dentry, AUDIT_TYPE_CHILD_CREATE);
185 185
186 fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); 186 fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0);
187} 187}
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 1e5a26d79232..b0d95cac826e 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -1,129 +1,8 @@
1#ifndef _LINUX_FUTEX_H 1#ifndef _LINUX_FUTEX_H
2#define _LINUX_FUTEX_H 2#define _LINUX_FUTEX_H
3 3
4#include <linux/compiler.h> 4#include <uapi/linux/futex.h>
5#include <linux/types.h>
6 5
7/* Second argument to futex syscall */
8
9
10#define FUTEX_WAIT 0
11#define FUTEX_WAKE 1
12#define FUTEX_FD 2
13#define FUTEX_REQUEUE 3
14#define FUTEX_CMP_REQUEUE 4
15#define FUTEX_WAKE_OP 5
16#define FUTEX_LOCK_PI 6
17#define FUTEX_UNLOCK_PI 7
18#define FUTEX_TRYLOCK_PI 8
19#define FUTEX_WAIT_BITSET 9
20#define FUTEX_WAKE_BITSET 10
21#define FUTEX_WAIT_REQUEUE_PI 11
22#define FUTEX_CMP_REQUEUE_PI 12
23
24#define FUTEX_PRIVATE_FLAG 128
25#define FUTEX_CLOCK_REALTIME 256
26#define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
27
28#define FUTEX_WAIT_PRIVATE (FUTEX_WAIT | FUTEX_PRIVATE_FLAG)
29#define FUTEX_WAKE_PRIVATE (FUTEX_WAKE | FUTEX_PRIVATE_FLAG)
30#define FUTEX_REQUEUE_PRIVATE (FUTEX_REQUEUE | FUTEX_PRIVATE_FLAG)
31#define FUTEX_CMP_REQUEUE_PRIVATE (FUTEX_CMP_REQUEUE | FUTEX_PRIVATE_FLAG)
32#define FUTEX_WAKE_OP_PRIVATE (FUTEX_WAKE_OP | FUTEX_PRIVATE_FLAG)
33#define FUTEX_LOCK_PI_PRIVATE (FUTEX_LOCK_PI | FUTEX_PRIVATE_FLAG)
34#define FUTEX_UNLOCK_PI_PRIVATE (FUTEX_UNLOCK_PI | FUTEX_PRIVATE_FLAG)
35#define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG)
36#define FUTEX_WAIT_BITSET_PRIVATE (FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG)
37#define FUTEX_WAKE_BITSET_PRIVATE (FUTEX_WAKE_BITSET | FUTEX_PRIVATE_FLAG)
38#define FUTEX_WAIT_REQUEUE_PI_PRIVATE (FUTEX_WAIT_REQUEUE_PI | \
39 FUTEX_PRIVATE_FLAG)
40#define FUTEX_CMP_REQUEUE_PI_PRIVATE (FUTEX_CMP_REQUEUE_PI | \
41 FUTEX_PRIVATE_FLAG)
42
43/*
44 * Support for robust futexes: the kernel cleans up held futexes at
45 * thread exit time.
46 */
47
48/*
49 * Per-lock list entry - embedded in user-space locks, somewhere close
50 * to the futex field. (Note: user-space uses a double-linked list to
51 * achieve O(1) list add and remove, but the kernel only needs to know
52 * about the forward link)
53 *
54 * NOTE: this structure is part of the syscall ABI, and must not be
55 * changed.
56 */
57struct robust_list {
58 struct robust_list __user *next;
59};
60
61/*
62 * Per-thread list head:
63 *
64 * NOTE: this structure is part of the syscall ABI, and must only be
65 * changed if the change is first communicated with the glibc folks.
66 * (When an incompatible change is done, we'll increase the structure
67 * size, which glibc will detect)
68 */
69struct robust_list_head {
70 /*
71 * The head of the list. Points back to itself if empty:
72 */
73 struct robust_list list;
74
75 /*
76 * This relative offset is set by user-space, it gives the kernel
77 * the relative position of the futex field to examine. This way
78 * we keep userspace flexible, to freely shape its data-structure,
79 * without hardcoding any particular offset into the kernel:
80 */
81 long futex_offset;
82
83 /*
84 * The death of the thread may race with userspace setting
85 * up a lock's links. So to handle this race, userspace first
86 * sets this field to the address of the to-be-taken lock,
87 * then does the lock acquire, and then adds itself to the
88 * list, and then clears this field. Hence the kernel will
89 * always have full knowledge of all locks that the thread
90 * _might_ have taken. We check the owner TID in any case,
91 * so only truly owned locks will be handled.
92 */
93 struct robust_list __user *list_op_pending;
94};
95
96/*
97 * Are there any waiters for this robust futex:
98 */
99#define FUTEX_WAITERS 0x80000000
100
101/*
102 * The kernel signals via this bit that a thread holding a futex
103 * has exited without unlocking the futex. The kernel also does
104 * a FUTEX_WAKE on such futexes, after setting the bit, to wake
105 * up any possible waiters:
106 */
107#define FUTEX_OWNER_DIED 0x40000000
108
109/*
110 * The rest of the robust-futex field is for the TID:
111 */
112#define FUTEX_TID_MASK 0x3fffffff
113
114/*
115 * This limit protects against a deliberately circular list.
116 * (Not worth introducing an rlimit for it)
117 */
118#define ROBUST_LIST_LIMIT 2048
119
120/*
121 * bitset with all bits set for the FUTEX_xxx_BITSET OPs to request a
122 * match of any bit.
123 */
124#define FUTEX_BITSET_MATCH_ANY 0xffffffff
125
126#ifdef __KERNEL__
127struct inode; 6struct inode;
128struct mm_struct; 7struct mm_struct;
129struct task_struct; 8struct task_struct;
@@ -185,31 +64,4 @@ static inline void exit_pi_state_list(struct task_struct *curr)
185{ 64{
186} 65}
187#endif 66#endif
188#endif /* __KERNEL__ */
189
190#define FUTEX_OP_SET 0 /* *(int *)UADDR2 = OPARG; */
191#define FUTEX_OP_ADD 1 /* *(int *)UADDR2 += OPARG; */
192#define FUTEX_OP_OR 2 /* *(int *)UADDR2 |= OPARG; */
193#define FUTEX_OP_ANDN 3 /* *(int *)UADDR2 &= ~OPARG; */
194#define FUTEX_OP_XOR 4 /* *(int *)UADDR2 ^= OPARG; */
195
196#define FUTEX_OP_OPARG_SHIFT 8 /* Use (1 << OPARG) instead of OPARG. */
197
198#define FUTEX_OP_CMP_EQ 0 /* if (oldval == CMPARG) wake */
199#define FUTEX_OP_CMP_NE 1 /* if (oldval != CMPARG) wake */
200#define FUTEX_OP_CMP_LT 2 /* if (oldval < CMPARG) wake */
201#define FUTEX_OP_CMP_LE 3 /* if (oldval <= CMPARG) wake */
202#define FUTEX_OP_CMP_GT 4 /* if (oldval > CMPARG) wake */
203#define FUTEX_OP_CMP_GE 5 /* if (oldval >= CMPARG) wake */
204
205/* FUTEX_WAKE_OP will perform atomically
206 int oldval = *(int *)UADDR2;
207 *(int *)UADDR2 = oldval OP OPARG;
208 if (oldval CMP CMPARG)
209 wake UADDR2; */
210
211#define FUTEX_OP(op, oparg, cmp, cmparg) \
212 (((op & 0xf) << 28) | ((cmp & 0xf) << 24) \
213 | ((oparg & 0xfff) << 12) | (cmparg & 0xfff))
214
215#endif 67#endif
diff --git a/include/linux/gameport.h b/include/linux/gameport.h
index b986be513406..bb7de09e8d57 100644
--- a/include/linux/gameport.h
+++ b/include/linux/gameport.h
@@ -1,6 +1,3 @@
1#ifndef _GAMEPORT_H
2#define _GAMEPORT_H
3
4/* 1/*
5 * Copyright (c) 1999-2002 Vojtech Pavlik 2 * Copyright (c) 1999-2002 Vojtech Pavlik
6 * 3 *
@@ -8,8 +5,9 @@
8 * under the terms of the GNU General Public License version 2 as published by 5 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation. 6 * the Free Software Foundation.
10 */ 7 */
8#ifndef _GAMEPORT_H
9#define _GAMEPORT_H
11 10
12#ifdef __KERNEL__
13#include <asm/io.h> 11#include <asm/io.h>
14#include <linux/types.h> 12#include <linux/types.h>
15#include <linux/list.h> 13#include <linux/list.h>
@@ -17,6 +15,7 @@
17#include <linux/device.h> 15#include <linux/device.h>
18#include <linux/timer.h> 16#include <linux/timer.h>
19#include <linux/slab.h> 17#include <linux/slab.h>
18#include <uapi/linux/gameport.h>
20 19
21struct gameport { 20struct gameport {
22 21
@@ -166,24 +165,6 @@ void gameport_unregister_driver(struct gameport_driver *drv);
166 module_driver(__gameport_driver, gameport_register_driver, \ 165 module_driver(__gameport_driver, gameport_register_driver, \
167 gameport_unregister_driver) 166 gameport_unregister_driver)
168 167
169#endif /* __KERNEL__ */
170
171#define GAMEPORT_MODE_DISABLED 0
172#define GAMEPORT_MODE_RAW 1
173#define GAMEPORT_MODE_COOKED 2
174
175#define GAMEPORT_ID_VENDOR_ANALOG 0x0001
176#define GAMEPORT_ID_VENDOR_MADCATZ 0x0002
177#define GAMEPORT_ID_VENDOR_LOGITECH 0x0003
178#define GAMEPORT_ID_VENDOR_CREATIVE 0x0004
179#define GAMEPORT_ID_VENDOR_GENIUS 0x0005
180#define GAMEPORT_ID_VENDOR_INTERACT 0x0006
181#define GAMEPORT_ID_VENDOR_MICROSOFT 0x0007
182#define GAMEPORT_ID_VENDOR_THRUSTMASTER 0x0008
183#define GAMEPORT_ID_VENDOR_GRAVIS 0x0009
184#define GAMEPORT_ID_VENDOR_GUILLEMOT 0x000a
185
186#ifdef __KERNEL__
187 168
188static inline void gameport_trigger(struct gameport *gameport) 169static inline void gameport_trigger(struct gameport *gameport)
189{ 170{
@@ -235,5 +216,4 @@ static inline void gameport_set_poll_interval(struct gameport *gameport, unsigne
235void gameport_start_polling(struct gameport *gameport); 216void gameport_start_polling(struct gameport *gameport);
236void gameport_stop_polling(struct gameport *gameport); 217void gameport_stop_polling(struct gameport *gameport);
237 218
238#endif /* __KERNEL__ */
239#endif 219#endif
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
index 5e98eeb2af3b..dd7c569aacad 100644
--- a/include/linux/genalloc.h
+++ b/include/linux/genalloc.h
@@ -29,6 +29,20 @@
29 29
30#ifndef __GENALLOC_H__ 30#ifndef __GENALLOC_H__
31#define __GENALLOC_H__ 31#define __GENALLOC_H__
32/**
33 * Allocation callback function type definition
34 * @map: Pointer to bitmap
35 * @size: The bitmap size in bits
36 * @start: The bitnumber to start searching at
37 * @nr: The number of zeroed bits we're looking for
38 * @data: optional additional data used by @genpool_algo_t
39 */
40typedef unsigned long (*genpool_algo_t)(unsigned long *map,
41 unsigned long size,
42 unsigned long start,
43 unsigned int nr,
44 void *data);
45
32/* 46/*
33 * General purpose special memory pool descriptor. 47 * General purpose special memory pool descriptor.
34 */ 48 */
@@ -36,6 +50,9 @@ struct gen_pool {
36 spinlock_t lock; 50 spinlock_t lock;
37 struct list_head chunks; /* list of chunks in this pool */ 51 struct list_head chunks; /* list of chunks in this pool */
38 int min_alloc_order; /* minimum allocation order */ 52 int min_alloc_order; /* minimum allocation order */
53
54 genpool_algo_t algo; /* allocation function */
55 void *data;
39}; 56};
40 57
41/* 58/*
@@ -78,4 +95,14 @@ extern void gen_pool_for_each_chunk(struct gen_pool *,
78 void (*)(struct gen_pool *, struct gen_pool_chunk *, void *), void *); 95 void (*)(struct gen_pool *, struct gen_pool_chunk *, void *), void *);
79extern size_t gen_pool_avail(struct gen_pool *); 96extern size_t gen_pool_avail(struct gen_pool *);
80extern size_t gen_pool_size(struct gen_pool *); 97extern size_t gen_pool_size(struct gen_pool *);
98
99extern void gen_pool_set_algo(struct gen_pool *pool, genpool_algo_t algo,
100 void *data);
101
102extern unsigned long gen_pool_first_fit(unsigned long *map, unsigned long size,
103 unsigned long start, unsigned int nr, void *data);
104
105extern unsigned long gen_pool_best_fit(unsigned long *map, unsigned long size,
106 unsigned long start, unsigned int nr, void *data);
107
81#endif /* __GENALLOC_H__ */ 108#endif /* __GENALLOC_H__ */
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
index 5ab61c1eb6bf..55b685719d52 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -1,86 +1,8 @@
1#ifndef __LINUX_GENERIC_NETLINK_H 1#ifndef __LINUX_GENERIC_NETLINK_H
2#define __LINUX_GENERIC_NETLINK_H 2#define __LINUX_GENERIC_NETLINK_H
3 3
4#include <linux/types.h> 4#include <uapi/linux/genetlink.h>
5#include <linux/netlink.h>
6 5
7#define GENL_NAMSIZ 16 /* length of family name */
8
9#define GENL_MIN_ID NLMSG_MIN_TYPE
10#define GENL_MAX_ID 1023
11
12struct genlmsghdr {
13 __u8 cmd;
14 __u8 version;
15 __u16 reserved;
16};
17
18#define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr))
19
20#define GENL_ADMIN_PERM 0x01
21#define GENL_CMD_CAP_DO 0x02
22#define GENL_CMD_CAP_DUMP 0x04
23#define GENL_CMD_CAP_HASPOL 0x08
24
25/*
26 * List of reserved static generic netlink identifiers:
27 */
28#define GENL_ID_GENERATE 0
29#define GENL_ID_CTRL NLMSG_MIN_TYPE
30
31/**************************************************************************
32 * Controller
33 **************************************************************************/
34
35enum {
36 CTRL_CMD_UNSPEC,
37 CTRL_CMD_NEWFAMILY,
38 CTRL_CMD_DELFAMILY,
39 CTRL_CMD_GETFAMILY,
40 CTRL_CMD_NEWOPS,
41 CTRL_CMD_DELOPS,
42 CTRL_CMD_GETOPS,
43 CTRL_CMD_NEWMCAST_GRP,
44 CTRL_CMD_DELMCAST_GRP,
45 CTRL_CMD_GETMCAST_GRP, /* unused */
46 __CTRL_CMD_MAX,
47};
48
49#define CTRL_CMD_MAX (__CTRL_CMD_MAX - 1)
50
51enum {
52 CTRL_ATTR_UNSPEC,
53 CTRL_ATTR_FAMILY_ID,
54 CTRL_ATTR_FAMILY_NAME,
55 CTRL_ATTR_VERSION,
56 CTRL_ATTR_HDRSIZE,
57 CTRL_ATTR_MAXATTR,
58 CTRL_ATTR_OPS,
59 CTRL_ATTR_MCAST_GROUPS,
60 __CTRL_ATTR_MAX,
61};
62
63#define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1)
64
65enum {
66 CTRL_ATTR_OP_UNSPEC,
67 CTRL_ATTR_OP_ID,
68 CTRL_ATTR_OP_FLAGS,
69 __CTRL_ATTR_OP_MAX,
70};
71
72#define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1)
73
74enum {
75 CTRL_ATTR_MCAST_GRP_UNSPEC,
76 CTRL_ATTR_MCAST_GRP_NAME,
77 CTRL_ATTR_MCAST_GRP_ID,
78 __CTRL_ATTR_MCAST_GRP_MAX,
79};
80
81#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
82
83#ifdef __KERNEL__
84 6
85/* All generic netlink requests are serialized by a global lock. */ 7/* All generic netlink requests are serialized by a global lock. */
86extern void genl_lock(void); 8extern void genl_lock(void);
@@ -113,6 +35,4 @@ extern int lockdep_genl_is_held(void);
113#define MODULE_ALIAS_GENL_FAMILY(family)\ 35#define MODULE_ALIAS_GENL_FAMILY(family)\
114 MODULE_ALIAS_NET_PF_PROTO_NAME(PF_NETLINK, NETLINK_GENERIC, "-family-" family) 36 MODULE_ALIAS_NET_PF_PROTO_NAME(PF_NETLINK, NETLINK_GENERIC, "-family-" family)
115 37
116#endif /* __KERNEL__ */
117
118#endif /* __LINUX_GENERIC_NETLINK_H */ 38#endif /* __LINUX_GENERIC_NETLINK_H */
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 4883f393f50a..02c1c9710be0 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -30,12 +30,7 @@ struct vm_area_struct;
30#define ___GFP_HARDWALL 0x20000u 30#define ___GFP_HARDWALL 0x20000u
31#define ___GFP_THISNODE 0x40000u 31#define ___GFP_THISNODE 0x40000u
32#define ___GFP_RECLAIMABLE 0x80000u 32#define ___GFP_RECLAIMABLE 0x80000u
33#ifdef CONFIG_KMEMCHECK
34#define ___GFP_NOTRACK 0x200000u 33#define ___GFP_NOTRACK 0x200000u
35#else
36#define ___GFP_NOTRACK 0
37#endif
38#define ___GFP_NO_KSWAPD 0x400000u
39#define ___GFP_OTHER_NODE 0x800000u 34#define ___GFP_OTHER_NODE 0x800000u
40#define ___GFP_WRITE 0x1000000u 35#define ___GFP_WRITE 0x1000000u
41 36
@@ -90,7 +85,6 @@ struct vm_area_struct;
90#define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */ 85#define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE) /* Page is reclaimable */
91#define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */ 86#define __GFP_NOTRACK ((__force gfp_t)___GFP_NOTRACK) /* Don't track with kmemcheck */
92 87
93#define __GFP_NO_KSWAPD ((__force gfp_t)___GFP_NO_KSWAPD)
94#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */ 88#define __GFP_OTHER_NODE ((__force gfp_t)___GFP_OTHER_NODE) /* On behalf of other node */
95#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */ 89#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE) /* Allocator intends to dirty page */
96 90
@@ -120,8 +114,7 @@ struct vm_area_struct;
120 __GFP_MOVABLE) 114 __GFP_MOVABLE)
121#define GFP_IOFS (__GFP_IO | __GFP_FS) 115#define GFP_IOFS (__GFP_IO | __GFP_FS)
122#define GFP_TRANSHUGE (GFP_HIGHUSER_MOVABLE | __GFP_COMP | \ 116#define GFP_TRANSHUGE (GFP_HIGHUSER_MOVABLE | __GFP_COMP | \
123 __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | \ 117 __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN)
124 __GFP_NO_KSWAPD)
125 118
126#ifdef CONFIG_NUMA 119#ifdef CONFIG_NUMA
127#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) 120#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index ee275c8b3df1..1acb1445e05f 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -7,24 +7,14 @@
7 * under the terms of version 2 of the GNU General Public License 7 * under the terms of version 2 of the GNU General Public License
8 * as published by the Free Software Foundation. 8 * as published by the Free Software Foundation.
9 */ 9 */
10
11#ifndef __HDLC_H 10#ifndef __HDLC_H
12#define __HDLC_H 11#define __HDLC_H
13 12
14 13
15#define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */
16#if 0
17#define HDLC_MAX_MRU (HDLC_MAX_MTU + 10 + 14 + 4) /* for ETH+VLAN over FR */
18#else
19#define HDLC_MAX_MRU 1600 /* as required for FR network */
20#endif
21
22
23#ifdef __KERNEL__
24
25#include <linux/skbuff.h> 14#include <linux/skbuff.h>
26#include <linux/netdevice.h> 15#include <linux/netdevice.h>
27#include <linux/hdlc/ioctl.h> 16#include <linux/hdlc/ioctl.h>
17#include <uapi/linux/hdlc.h>
28 18
29/* This structure is a private property of HDLC protocols. 19/* This structure is a private property of HDLC protocols.
30 Hardware drivers have no interest here */ 20 Hardware drivers have no interest here */
@@ -127,5 +117,4 @@ static __inline__ __be16 hdlc_type_trans(struct sk_buff *skb,
127 return htons(ETH_P_HDLC); 117 return htons(ETH_P_HDLC);
128} 118}
129 119
130#endif /* __KERNEL */
131#endif /* __HDLC_H */ 120#endif /* __HDLC_H */
diff --git a/include/linux/hdlcdrv.h b/include/linux/hdlcdrv.h
index c010b4a785b8..be3be25bb898 100644
--- a/include/linux/hdlcdrv.h
+++ b/include/linux/hdlcdrv.h
@@ -3,110 +3,14 @@
3 * The Linux soundcard driver for 1200 baud and 9600 baud packet radio 3 * The Linux soundcard driver for 1200 baud and 9600 baud packet radio
4 * (C) 1996-1998 by Thomas Sailer, HB9JNX/AE4WA 4 * (C) 1996-1998 by Thomas Sailer, HB9JNX/AE4WA
5 */ 5 */
6
7#ifndef _HDLCDRV_H 6#ifndef _HDLCDRV_H
8#define _HDLCDRV_H 7#define _HDLCDRV_H
9 8
10/* -------------------------------------------------------------------- */
11/*
12 * structs for the IOCTL commands
13 */
14
15struct hdlcdrv_params {
16 int iobase;
17 int irq;
18 int dma;
19 int dma2;
20 int seriobase;
21 int pariobase;
22 int midiiobase;
23};
24
25struct hdlcdrv_channel_params {
26 int tx_delay; /* the transmitter keyup delay in 10ms units */
27 int tx_tail; /* the transmitter keyoff delay in 10ms units */
28 int slottime; /* the slottime in 10ms; usually 10 = 100ms */
29 int ppersist; /* the p-persistence 0..255 */
30 int fulldup; /* some driver do not support full duplex, setting */
31 /* this just makes them send even if DCD is on */
32};
33
34struct hdlcdrv_old_channel_state {
35 int ptt;
36 int dcd;
37 int ptt_keyed;
38};
39
40struct hdlcdrv_channel_state {
41 int ptt;
42 int dcd;
43 int ptt_keyed;
44 unsigned long tx_packets;
45 unsigned long tx_errors;
46 unsigned long rx_packets;
47 unsigned long rx_errors;
48};
49
50struct hdlcdrv_ioctl {
51 int cmd;
52 union {
53 struct hdlcdrv_params mp;
54 struct hdlcdrv_channel_params cp;
55 struct hdlcdrv_channel_state cs;
56 struct hdlcdrv_old_channel_state ocs;
57 unsigned int calibrate;
58 unsigned char bits;
59 char modename[128];
60 char drivername[32];
61 } data;
62};
63
64/* -------------------------------------------------------------------- */
65
66/*
67 * ioctl values
68 */
69#define HDLCDRVCTL_GETMODEMPAR 0
70#define HDLCDRVCTL_SETMODEMPAR 1
71#define HDLCDRVCTL_MODEMPARMASK 2 /* not handled by hdlcdrv */
72#define HDLCDRVCTL_GETCHANNELPAR 10
73#define HDLCDRVCTL_SETCHANNELPAR 11
74#define HDLCDRVCTL_OLDGETSTAT 20
75#define HDLCDRVCTL_CALIBRATE 21
76#define HDLCDRVCTL_GETSTAT 22
77
78/*
79 * these are mainly for debugging purposes
80 */
81#define HDLCDRVCTL_GETSAMPLES 30
82#define HDLCDRVCTL_GETBITS 31
83
84/*
85 * not handled by hdlcdrv, but by its depending drivers
86 */
87#define HDLCDRVCTL_GETMODE 40
88#define HDLCDRVCTL_SETMODE 41
89#define HDLCDRVCTL_MODELIST 42
90#define HDLCDRVCTL_DRIVERNAME 43
91
92/*
93 * mask of needed modem parameters, returned by HDLCDRVCTL_MODEMPARMASK
94 */
95#define HDLCDRV_PARMASK_IOBASE (1<<0)
96#define HDLCDRV_PARMASK_IRQ (1<<1)
97#define HDLCDRV_PARMASK_DMA (1<<2)
98#define HDLCDRV_PARMASK_DMA2 (1<<3)
99#define HDLCDRV_PARMASK_SERIOBASE (1<<4)
100#define HDLCDRV_PARMASK_PARIOBASE (1<<5)
101#define HDLCDRV_PARMASK_MIDIIOBASE (1<<6)
102
103/* -------------------------------------------------------------------- */
104
105#ifdef __KERNEL__
106 9
107#include <linux/netdevice.h> 10#include <linux/netdevice.h>
108#include <linux/if.h> 11#include <linux/if.h>
109#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13#include <uapi/linux/hdlcdrv.h>
110 14
111#define HDLCDRV_MAGIC 0x5ac6e778 15#define HDLCDRV_MAGIC 0x5ac6e778
112#define HDLCDRV_HDLCBUFFER 32 /* should be a power of 2 for speed reasons */ 16#define HDLCDRV_HDLCBUFFER 32 /* should be a power of 2 for speed reasons */
@@ -368,10 +272,4 @@ void hdlcdrv_unregister(struct net_device *dev);
368 272
369 273
370 274
371#endif /* __KERNEL__ */
372
373/* -------------------------------------------------------------------- */
374
375#endif /* _HDLCDRV_H */ 275#endif /* _HDLCDRV_H */
376
377/* -------------------------------------------------------------------- */
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 7e1f37db7582..c076041a069e 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -1,12 +1,8 @@
1#ifndef __HID_H
2#define __HID_H
3
4/* 1/*
5 * Copyright (c) 1999 Andreas Gal 2 * Copyright (c) 1999 Andreas Gal
6 * Copyright (c) 2000-2001 Vojtech Pavlik 3 * Copyright (c) 2000-2001 Vojtech Pavlik
7 * Copyright (c) 2006-2007 Jiri Kosina 4 * Copyright (c) 2006-2007 Jiri Kosina
8 */ 5 */
9
10/* 6/*
11 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -26,43 +22,9 @@
26 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: 22 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
27 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic 23 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
28 */ 24 */
25#ifndef __HID_H
26#define __HID_H
29 27
30/*
31 * USB HID (Human Interface Device) interface class code
32 */
33
34#define USB_INTERFACE_CLASS_HID 3
35
36/*
37 * USB HID interface subclass and protocol codes
38 */
39
40#define USB_INTERFACE_SUBCLASS_BOOT 1
41#define USB_INTERFACE_PROTOCOL_KEYBOARD 1
42#define USB_INTERFACE_PROTOCOL_MOUSE 2
43
44/*
45 * HID class requests
46 */
47
48#define HID_REQ_GET_REPORT 0x01
49#define HID_REQ_GET_IDLE 0x02
50#define HID_REQ_GET_PROTOCOL 0x03
51#define HID_REQ_SET_REPORT 0x09
52#define HID_REQ_SET_IDLE 0x0A
53#define HID_REQ_SET_PROTOCOL 0x0B
54
55/*
56 * HID class descriptor types
57 */
58
59#define HID_DT_HID (USB_TYPE_CLASS | 0x01)
60#define HID_DT_REPORT (USB_TYPE_CLASS | 0x02)
61#define HID_DT_PHYSICAL (USB_TYPE_CLASS | 0x03)
62
63#define HID_MAX_DESCRIPTOR_SIZE 4096
64
65#ifdef __KERNEL__
66 28
67#include <linux/types.h> 29#include <linux/types.h>
68#include <linux/slab.h> 30#include <linux/slab.h>
@@ -73,6 +35,7 @@
73#include <linux/input.h> 35#include <linux/input.h>
74#include <linux/semaphore.h> 36#include <linux/semaphore.h>
75#include <linux/power_supply.h> 37#include <linux/power_supply.h>
38#include <uapi/linux/hid.h>
76 39
77/* 40/*
78 * We parse each description item into this structure. Short items data 41 * We parse each description item into this structure. Short items data
@@ -943,7 +906,4 @@ do { \
943#define hid_dbg(hid, fmt, arg...) \ 906#define hid_dbg(hid, fmt, arg...) \
944 dev_dbg(&(hid)->dev, fmt, ##arg) 907 dev_dbg(&(hid)->dev, fmt, ##arg)
945 908
946#endif /* __KERNEL__ */
947
948#endif 909#endif
949
diff --git a/include/linux/hiddev.h b/include/linux/hiddev.h
index a3f481a3063b..a5dd8148660b 100644
--- a/include/linux/hiddev.h
+++ b/include/linux/hiddev.h
@@ -1,12 +1,8 @@
1#ifndef _HIDDEV_H
2#define _HIDDEV_H
3
4/* 1/*
5 * Copyright (c) 1999-2000 Vojtech Pavlik 2 * Copyright (c) 1999-2000 Vojtech Pavlik
6 * 3 *
7 * Sponsored by SuSE 4 * Sponsored by SuSE
8 */ 5 */
9
10/* 6/*
11 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -26,190 +22,11 @@
26 * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail: 22 * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
27 * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic 23 * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
28 */ 24 */
25#ifndef _HIDDEV_H
26#define _HIDDEV_H
29 27
30#include <linux/types.h> 28#include <uapi/linux/hiddev.h>
31
32/*
33 * The event structure itself
34 */
35
36struct hiddev_event {
37 unsigned hid;
38 signed int value;
39};
40
41struct hiddev_devinfo {
42 __u32 bustype;
43 __u32 busnum;
44 __u32 devnum;
45 __u32 ifnum;
46 __s16 vendor;
47 __s16 product;
48 __s16 version;
49 __u32 num_applications;
50};
51
52struct hiddev_collection_info {
53 __u32 index;
54 __u32 type;
55 __u32 usage;
56 __u32 level;
57};
58
59#define HID_STRING_SIZE 256
60struct hiddev_string_descriptor {
61 __s32 index;
62 char value[HID_STRING_SIZE];
63};
64
65struct hiddev_report_info {
66 __u32 report_type;
67 __u32 report_id;
68 __u32 num_fields;
69};
70
71/* To do a GUSAGE/SUSAGE, fill in at least usage_code, report_type and
72 * report_id. Set report_id to REPORT_ID_UNKNOWN if the rest of the fields
73 * are unknown. Otherwise use a usage_ref struct filled in from a previous
74 * successful GUSAGE call to save time. To actually send a value to the
75 * device, perform a SUSAGE first, followed by a SREPORT. An INITREPORT or a
76 * GREPORT isn't necessary for a GUSAGE to return valid data.
77 */
78#define HID_REPORT_ID_UNKNOWN 0xffffffff
79#define HID_REPORT_ID_FIRST 0x00000100
80#define HID_REPORT_ID_NEXT 0x00000200
81#define HID_REPORT_ID_MASK 0x000000ff
82#define HID_REPORT_ID_MAX 0x000000ff
83
84#define HID_REPORT_TYPE_INPUT 1
85#define HID_REPORT_TYPE_OUTPUT 2
86#define HID_REPORT_TYPE_FEATURE 3
87#define HID_REPORT_TYPE_MIN 1
88#define HID_REPORT_TYPE_MAX 3
89
90struct hiddev_field_info {
91 __u32 report_type;
92 __u32 report_id;
93 __u32 field_index;
94 __u32 maxusage;
95 __u32 flags;
96 __u32 physical; /* physical usage for this field */
97 __u32 logical; /* logical usage for this field */
98 __u32 application; /* application usage for this field */
99 __s32 logical_minimum;
100 __s32 logical_maximum;
101 __s32 physical_minimum;
102 __s32 physical_maximum;
103 __u32 unit_exponent;
104 __u32 unit;
105};
106
107/* Fill in report_type, report_id and field_index to get the information on a
108 * field.
109 */
110#define HID_FIELD_CONSTANT 0x001
111#define HID_FIELD_VARIABLE 0x002
112#define HID_FIELD_RELATIVE 0x004
113#define HID_FIELD_WRAP 0x008
114#define HID_FIELD_NONLINEAR 0x010
115#define HID_FIELD_NO_PREFERRED 0x020
116#define HID_FIELD_NULL_STATE 0x040
117#define HID_FIELD_VOLATILE 0x080
118#define HID_FIELD_BUFFERED_BYTE 0x100
119
120struct hiddev_usage_ref {
121 __u32 report_type;
122 __u32 report_id;
123 __u32 field_index;
124 __u32 usage_index;
125 __u32 usage_code;
126 __s32 value;
127};
128
129/* hiddev_usage_ref_multi is used for sending multiple bytes to a control.
130 * It really manifests itself as setting the value of consecutive usages */
131#define HID_MAX_MULTI_USAGES 1024
132struct hiddev_usage_ref_multi {
133 struct hiddev_usage_ref uref;
134 __u32 num_values;
135 __s32 values[HID_MAX_MULTI_USAGES];
136};
137
138/* FIELD_INDEX_NONE is returned in read() data from the kernel when flags
139 * is set to (HIDDEV_FLAG_UREF | HIDDEV_FLAG_REPORT) and a new report has
140 * been sent by the device
141 */
142#define HID_FIELD_INDEX_NONE 0xffffffff
143
144/*
145 * Protocol version.
146 */
147
148#define HID_VERSION 0x010004
149
150/*
151 * IOCTLs (0x00 - 0x7f)
152 */
153
154#define HIDIOCGVERSION _IOR('H', 0x01, int)
155#define HIDIOCAPPLICATION _IO('H', 0x02)
156#define HIDIOCGDEVINFO _IOR('H', 0x03, struct hiddev_devinfo)
157#define HIDIOCGSTRING _IOR('H', 0x04, struct hiddev_string_descriptor)
158#define HIDIOCINITREPORT _IO('H', 0x05)
159#define HIDIOCGNAME(len) _IOC(_IOC_READ, 'H', 0x06, len)
160#define HIDIOCGREPORT _IOW('H', 0x07, struct hiddev_report_info)
161#define HIDIOCSREPORT _IOW('H', 0x08, struct hiddev_report_info)
162#define HIDIOCGREPORTINFO _IOWR('H', 0x09, struct hiddev_report_info)
163#define HIDIOCGFIELDINFO _IOWR('H', 0x0A, struct hiddev_field_info)
164#define HIDIOCGUSAGE _IOWR('H', 0x0B, struct hiddev_usage_ref)
165#define HIDIOCSUSAGE _IOW('H', 0x0C, struct hiddev_usage_ref)
166#define HIDIOCGUCODE _IOWR('H', 0x0D, struct hiddev_usage_ref)
167#define HIDIOCGFLAG _IOR('H', 0x0E, int)
168#define HIDIOCSFLAG _IOW('H', 0x0F, int)
169#define HIDIOCGCOLLECTIONINDEX _IOW('H', 0x10, struct hiddev_usage_ref)
170#define HIDIOCGCOLLECTIONINFO _IOWR('H', 0x11, struct hiddev_collection_info)
171#define HIDIOCGPHYS(len) _IOC(_IOC_READ, 'H', 0x12, len)
172
173/* For writing/reading to multiple/consecutive usages */
174#define HIDIOCGUSAGES _IOWR('H', 0x13, struct hiddev_usage_ref_multi)
175#define HIDIOCSUSAGES _IOW('H', 0x14, struct hiddev_usage_ref_multi)
176
177/*
178 * Flags to be used in HIDIOCSFLAG
179 */
180#define HIDDEV_FLAG_UREF 0x1
181#define HIDDEV_FLAG_REPORT 0x2
182#define HIDDEV_FLAGS 0x3
183
184/* To traverse the input report descriptor info for a HID device, perform the
185 * following:
186 *
187 * rinfo.report_type = HID_REPORT_TYPE_INPUT;
188 * rinfo.report_id = HID_REPORT_ID_FIRST;
189 * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo);
190 *
191 * while (ret >= 0) {
192 * for (i = 0; i < rinfo.num_fields; i++) {
193 * finfo.report_type = rinfo.report_type;
194 * finfo.report_id = rinfo.report_id;
195 * finfo.field_index = i;
196 * ioctl(fd, HIDIOCGFIELDINFO, &finfo);
197 * for (j = 0; j < finfo.maxusage; j++) {
198 * uref.report_type = rinfo.report_type;
199 * uref.report_id = rinfo.report_id;
200 * uref.field_index = i;
201 * uref.usage_index = j;
202 * ioctl(fd, HIDIOCGUCODE, &uref);
203 * ioctl(fd, HIDIOCGUSAGE, &uref);
204 * }
205 * }
206 * rinfo.report_id |= HID_REPORT_ID_NEXT;
207 * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo);
208 * }
209 */
210
211 29
212#ifdef __KERNEL__
213 30
214/* 31/*
215 * In-kernel definitions. 32 * In-kernel definitions.
@@ -237,4 +54,3 @@ static inline void hiddev_report_event(struct hid_device *hid, struct hid_report
237#endif 54#endif
238 55
239#endif 56#endif
240#endif
diff --git a/include/linux/hidraw.h b/include/linux/hidraw.h
index 45e9fcb8d877..2451662c728a 100644
--- a/include/linux/hidraw.h
+++ b/include/linux/hidraw.h
@@ -1,10 +1,6 @@
1#ifndef _HIDRAW_H
2#define _HIDRAW_H
3
4/* 1/*
5 * Copyright (c) 2007 Jiri Kosina 2 * Copyright (c) 2007 Jiri Kosina
6 */ 3 */
7
8/* 4/*
9 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
10 * under the terms and conditions of the GNU General Public License, 6 * under the terms and conditions of the GNU General Public License,
@@ -14,39 +10,11 @@
14 * this program; if not, write to the Free Software Foundation, Inc., 10 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 11 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 */ 12 */
13#ifndef _HIDRAW_H
14#define _HIDRAW_H
17 15
18#include <linux/hid.h> 16#include <uapi/linux/hidraw.h>
19#include <linux/types.h>
20
21struct hidraw_report_descriptor {
22 __u32 size;
23 __u8 value[HID_MAX_DESCRIPTOR_SIZE];
24};
25
26struct hidraw_devinfo {
27 __u32 bustype;
28 __s16 vendor;
29 __s16 product;
30};
31
32/* ioctl interface */
33#define HIDIOCGRDESCSIZE _IOR('H', 0x01, int)
34#define HIDIOCGRDESC _IOR('H', 0x02, struct hidraw_report_descriptor)
35#define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo)
36#define HIDIOCGRAWNAME(len) _IOC(_IOC_READ, 'H', 0x04, len)
37#define HIDIOCGRAWPHYS(len) _IOC(_IOC_READ, 'H', 0x05, len)
38/* The first byte of SFEATURE and GFEATURE is the report number */
39#define HIDIOCSFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len)
40#define HIDIOCGFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x07, len)
41
42#define HIDRAW_FIRST_MINOR 0
43#define HIDRAW_MAX_DEVICES 64
44/* number of reports to buffer */
45#define HIDRAW_BUFFER_SIZE 64
46
47 17
48/* kernel-only API declarations */
49#ifdef __KERNEL__
50 18
51struct hidraw { 19struct hidraw {
52 unsigned int minor; 20 unsigned int minor;
@@ -88,5 +56,3 @@ static inline void hidraw_disconnect(struct hid_device *hid) { }
88#endif 56#endif
89 57
90#endif 58#endif
91
92#endif
diff --git a/include/linux/hpet.h b/include/linux/hpet.h
index 219ca4f6bea6..9427ab4e01c3 100644
--- a/include/linux/hpet.h
+++ b/include/linux/hpet.h
@@ -1,9 +1,8 @@
1#ifndef __HPET__ 1#ifndef __HPET__
2#define __HPET__ 1 2#define __HPET__ 1
3 3
4#include <linux/compiler.h> 4#include <uapi/linux/hpet.h>
5 5
6#ifdef __KERNEL__
7 6
8/* 7/*
9 * Offsets into HPET Registers 8 * Offsets into HPET Registers
@@ -108,24 +107,4 @@ static inline void hpet_reserve_timer(struct hpet_data *hd, int timer)
108 107
109int hpet_alloc(struct hpet_data *); 108int hpet_alloc(struct hpet_data *);
110 109
111#endif /* __KERNEL__ */
112
113struct hpet_info {
114 unsigned long hi_ireqfreq; /* Hz */
115 unsigned long hi_flags; /* information */
116 unsigned short hi_hpet;
117 unsigned short hi_timer;
118};
119
120#define HPET_INFO_PERIODIC 0x0010 /* periodic-capable comparator */
121
122#define HPET_IE_ON _IO('h', 0x01) /* interrupt on */
123#define HPET_IE_OFF _IO('h', 0x02) /* interrupt off */
124#define HPET_INFO _IOR('h', 0x03, struct hpet_info)
125#define HPET_EPI _IO('h', 0x04) /* enable periodic */
126#define HPET_DPI _IO('h', 0x05) /* disable periodic */
127#define HPET_IRQFREQ _IOW('h', 0x6, unsigned long) /* IRQFREQ usec */
128
129#define MAX_HPET_TBS 8 /* maximum hpet timer blocks */
130
131#endif /* !__HPET__ */ 110#endif /* !__HPET__ */
diff --git a/include/linux/hsi/Kbuild b/include/linux/hsi/Kbuild
index 271a770b4784..e69de29bb2d1 100644
--- a/include/linux/hsi/Kbuild
+++ b/include/linux/hsi/Kbuild
@@ -1 +0,0 @@
1header-y += hsi_char.h
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index 4c59b1131187..b31cb7da0346 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -11,8 +11,7 @@ extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
11extern int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, 11extern int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
12 unsigned long address, pmd_t *pmd, 12 unsigned long address, pmd_t *pmd,
13 pmd_t orig_pmd); 13 pmd_t orig_pmd);
14extern pgtable_t get_pmd_huge_pte(struct mm_struct *mm); 14extern struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
15extern struct page *follow_trans_huge_pmd(struct mm_struct *mm,
16 unsigned long addr, 15 unsigned long addr,
17 pmd_t *pmd, 16 pmd_t *pmd,
18 unsigned int flags); 17 unsigned int flags);
diff --git a/include/linux/i2c-algo-pca.h b/include/linux/i2c-algo-pca.h
index 1364d62e2fbe..a3c3ecd59f08 100644
--- a/include/linux/i2c-algo-pca.h
+++ b/include/linux/i2c-algo-pca.h
@@ -62,6 +62,7 @@ struct i2c_algo_pca_data {
62 * 330000, 288000, 217000, 146000, 88000, 59000, 44000, 36000 62 * 330000, 288000, 217000, 146000, 88000, 59000, 44000, 36000
63 * For PCA9665, use the frequency you want here. */ 63 * For PCA9665, use the frequency you want here. */
64 unsigned int i2c_clock; 64 unsigned int i2c_clock;
65 unsigned int chip;
65}; 66};
66 67
67int i2c_pca_add_bus(struct i2c_adapter *); 68int i2c_pca_add_bus(struct i2c_adapter *);
diff --git a/include/linux/i2c-dev.h b/include/linux/i2c-dev.h
index 8a7406b2114d..79727144c5cd 100644
--- a/include/linux/i2c-dev.h
+++ b/include/linux/i2c-dev.h
@@ -19,57 +19,10 @@
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 MA 02110-1301 USA. 20 MA 02110-1301 USA.
21*/ 21*/
22
23#ifndef _LINUX_I2C_DEV_H 22#ifndef _LINUX_I2C_DEV_H
24#define _LINUX_I2C_DEV_H 23#define _LINUX_I2C_DEV_H
25 24
26#include <linux/types.h> 25#include <uapi/linux/i2c-dev.h>
27#include <linux/compiler.h>
28
29/* /dev/i2c-X ioctl commands. The ioctl's parameter is always an
30 * unsigned long, except for:
31 * - I2C_FUNCS, takes pointer to an unsigned long
32 * - I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data
33 * - I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data
34 */
35#define I2C_RETRIES 0x0701 /* number of times a device address should
36 be polled when not acknowledging */
37#define I2C_TIMEOUT 0x0702 /* set timeout in units of 10 ms */
38
39/* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses
40 * are NOT supported! (due to code brokenness)
41 */
42#define I2C_SLAVE 0x0703 /* Use this slave address */
43#define I2C_SLAVE_FORCE 0x0706 /* Use this slave address, even if it
44 is already in use by a driver! */
45#define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */
46
47#define I2C_FUNCS 0x0705 /* Get the adapter functionality mask */
48
49#define I2C_RDWR 0x0707 /* Combined R/W transfer (one STOP only) */
50
51#define I2C_PEC 0x0708 /* != 0 to use PEC with SMBus */
52#define I2C_SMBUS 0x0720 /* SMBus transfer */
53 26
54
55/* This is the structure as used in the I2C_SMBUS ioctl call */
56struct i2c_smbus_ioctl_data {
57 __u8 read_write;
58 __u8 command;
59 __u32 size;
60 union i2c_smbus_data __user *data;
61};
62
63/* This is the structure as used in the I2C_RDWR ioctl call */
64struct i2c_rdwr_ioctl_data {
65 struct i2c_msg __user *msgs; /* pointers to i2c_msgs */
66 __u32 nmsgs; /* number of i2c_msgs */
67};
68
69#define I2C_RDRW_IOCTL_MAX_MSGS 42
70
71#ifdef __KERNEL__
72#define I2C_MAJOR 89 /* Device major number */ 27#define I2C_MAJOR 89 /* Device major number */
73#endif
74
75#endif /* _LINUX_I2C_DEV_H */ 28#endif /* _LINUX_I2C_DEV_H */
diff --git a/include/linux/i2c-mux-gpio.h b/include/linux/i2c-mux-gpio.h
index a36343a37ebc..4406108201fe 100644
--- a/include/linux/i2c-mux-gpio.h
+++ b/include/linux/i2c-mux-gpio.h
@@ -21,6 +21,9 @@
21 * @values: Array of bitmasks of GPIO settings (low/high) for each 21 * @values: Array of bitmasks of GPIO settings (low/high) for each
22 * position 22 * position
23 * @n_values: Number of multiplexer positions (busses to instantiate) 23 * @n_values: Number of multiplexer positions (busses to instantiate)
24 * @classes: Optional I2C auto-detection classes
25 * @gpio_chip: Optional GPIO chip name; if set, GPIO pin numbers are given
26 * relative to the base GPIO number of that chip
24 * @gpios: Array of GPIO numbers used to control MUX 27 * @gpios: Array of GPIO numbers used to control MUX
25 * @n_gpios: Number of GPIOs used to control MUX 28 * @n_gpios: Number of GPIOs used to control MUX
26 * @idle: Bitmask to write to MUX when idle or GPIO_I2CMUX_NO_IDLE if not used 29 * @idle: Bitmask to write to MUX when idle or GPIO_I2CMUX_NO_IDLE if not used
@@ -30,6 +33,8 @@ struct i2c_mux_gpio_platform_data {
30 int base_nr; 33 int base_nr;
31 const unsigned *values; 34 const unsigned *values;
32 int n_values; 35 int n_values;
36 const unsigned *classes;
37 char *gpio_chip;
33 const unsigned *gpios; 38 const unsigned *gpios;
34 int n_gpios; 39 int n_gpios;
35 unsigned idle; 40 unsigned idle;
diff --git a/include/linux/i2c-mux.h b/include/linux/i2c-mux.h
index c79083830014..40cb05a97b46 100644
--- a/include/linux/i2c-mux.h
+++ b/include/linux/i2c-mux.h
@@ -36,6 +36,7 @@
36struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent, 36struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
37 struct device *mux_dev, 37 struct device *mux_dev,
38 void *mux_priv, u32 force_nr, u32 chan_id, 38 void *mux_priv, u32 force_nr, u32 chan_id,
39 unsigned int class,
39 int (*select) (struct i2c_adapter *, 40 int (*select) (struct i2c_adapter *,
40 void *mux_dev, u32 chan_id), 41 void *mux_dev, u32 chan_id),
41 int (*deselect) (struct i2c_adapter *, 42 int (*deselect) (struct i2c_adapter *,
diff --git a/include/linux/i2c-omap.h b/include/linux/i2c-omap.h
index 92a0dc75bc74..df804ba73e0b 100644
--- a/include/linux/i2c-omap.h
+++ b/include/linux/i2c-omap.h
@@ -34,7 +34,6 @@ struct omap_i2c_bus_platform_data {
34 u32 clkrate; 34 u32 clkrate;
35 u32 rev; 35 u32 rev;
36 u32 flags; 36 u32 flags;
37 void (*set_mpu_wkup_lat)(struct device *dev, long set);
38}; 37};
39 38
40#endif 39#endif
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 5970266930a2..800de224336b 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -23,18 +23,16 @@
23 23
24/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and 24/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
25 Frodo Looijaard <frodol@dds.nl> */ 25 Frodo Looijaard <frodol@dds.nl> */
26
27#ifndef _LINUX_I2C_H 26#ifndef _LINUX_I2C_H
28#define _LINUX_I2C_H 27#define _LINUX_I2C_H
29 28
30#include <linux/types.h>
31#ifdef __KERNEL__
32#include <linux/mod_devicetable.h> 29#include <linux/mod_devicetable.h>
33#include <linux/device.h> /* for struct device */ 30#include <linux/device.h> /* for struct device */
34#include <linux/sched.h> /* for completion */ 31#include <linux/sched.h> /* for completion */
35#include <linux/mutex.h> 32#include <linux/mutex.h>
36#include <linux/of.h> /* for struct device_node */ 33#include <linux/of.h> /* for struct device_node */
37#include <linux/swab.h> /* for swab16 */ 34#include <linux/swab.h> /* for swab16 */
35#include <uapi/linux/i2c.h>
38 36
39extern struct bus_type i2c_bus_type; 37extern struct bus_type i2c_bus_type;
40extern struct device_type i2c_adapter_type; 38extern struct device_type i2c_adapter_type;
@@ -144,7 +142,7 @@ extern s32 i2c_smbus_write_i2c_block_data(const struct i2c_client *client,
144 * The driver.owner field should be set to the module owner of this driver. 142 * The driver.owner field should be set to the module owner of this driver.
145 * The driver.name field should be set to the name of this driver. 143 * The driver.name field should be set to the name of this driver.
146 * 144 *
147 * For automatic device detection, both @detect and @address_data must 145 * For automatic device detection, both @detect and @address_list must
148 * be defined. @class should also be set, otherwise only devices forced 146 * be defined. @class should also be set, otherwise only devices forced
149 * with module parameters will be created. The detect function must 147 * with module parameters will be created. The detect function must
150 * fill at least the name field of the i2c_board_info structure it is 148 * fill at least the name field of the i2c_board_info structure it is
@@ -503,125 +501,4 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap)
503 i2c_del_driver) 501 i2c_del_driver)
504 502
505#endif /* I2C */ 503#endif /* I2C */
506#endif /* __KERNEL__ */
507
508/**
509 * struct i2c_msg - an I2C transaction segment beginning with START
510 * @addr: Slave address, either seven or ten bits. When this is a ten
511 * bit address, I2C_M_TEN must be set in @flags and the adapter
512 * must support I2C_FUNC_10BIT_ADDR.
513 * @flags: I2C_M_RD is handled by all adapters. No other flags may be
514 * provided unless the adapter exported the relevant I2C_FUNC_*
515 * flags through i2c_check_functionality().
516 * @len: Number of data bytes in @buf being read from or written to the
517 * I2C slave address. For read transactions where I2C_M_RECV_LEN
518 * is set, the caller guarantees that this buffer can hold up to
519 * 32 bytes in addition to the initial length byte sent by the
520 * slave (plus, if used, the SMBus PEC); and this value will be
521 * incremented by the number of block data bytes received.
522 * @buf: The buffer into which data is read, or from which it's written.
523 *
524 * An i2c_msg is the low level representation of one segment of an I2C
525 * transaction. It is visible to drivers in the @i2c_transfer() procedure,
526 * to userspace from i2c-dev, and to I2C adapter drivers through the
527 * @i2c_adapter.@master_xfer() method.
528 *
529 * Except when I2C "protocol mangling" is used, all I2C adapters implement
530 * the standard rules for I2C transactions. Each transaction begins with a
531 * START. That is followed by the slave address, and a bit encoding read
532 * versus write. Then follow all the data bytes, possibly including a byte
533 * with SMBus PEC. The transfer terminates with a NAK, or when all those
534 * bytes have been transferred and ACKed. If this is the last message in a
535 * group, it is followed by a STOP. Otherwise it is followed by the next
536 * @i2c_msg transaction segment, beginning with a (repeated) START.
537 *
538 * Alternatively, when the adapter supports I2C_FUNC_PROTOCOL_MANGLING then
539 * passing certain @flags may have changed those standard protocol behaviors.
540 * Those flags are only for use with broken/nonconforming slaves, and with
541 * adapters which are known to support the specific mangling options they
542 * need (one or more of IGNORE_NAK, NO_RD_ACK, NOSTART, and REV_DIR_ADDR).
543 */
544struct i2c_msg {
545 __u16 addr; /* slave address */
546 __u16 flags;
547#define I2C_M_TEN 0x0010 /* this is a ten bit chip address */
548#define I2C_M_RD 0x0001 /* read data, from slave to master */
549#define I2C_M_STOP 0x8000 /* if I2C_FUNC_PROTOCOL_MANGLING */
550#define I2C_M_NOSTART 0x4000 /* if I2C_FUNC_NOSTART */
551#define I2C_M_REV_DIR_ADDR 0x2000 /* if I2C_FUNC_PROTOCOL_MANGLING */
552#define I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */
553#define I2C_M_NO_RD_ACK 0x0800 /* if I2C_FUNC_PROTOCOL_MANGLING */
554#define I2C_M_RECV_LEN 0x0400 /* length will be first received byte */
555 __u16 len; /* msg length */
556 __u8 *buf; /* pointer to msg data */
557};
558
559/* To determine what functionality is present */
560
561#define I2C_FUNC_I2C 0x00000001
562#define I2C_FUNC_10BIT_ADDR 0x00000002
563#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_IGNORE_NAK etc. */
564#define I2C_FUNC_SMBUS_PEC 0x00000008
565#define I2C_FUNC_NOSTART 0x00000010 /* I2C_M_NOSTART */
566#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */
567#define I2C_FUNC_SMBUS_QUICK 0x00010000
568#define I2C_FUNC_SMBUS_READ_BYTE 0x00020000
569#define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000
570#define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000
571#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000
572#define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000
573#define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000
574#define I2C_FUNC_SMBUS_PROC_CALL 0x00800000
575#define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000
576#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000
577#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */
578#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */
579
580#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \
581 I2C_FUNC_SMBUS_WRITE_BYTE)
582#define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \
583 I2C_FUNC_SMBUS_WRITE_BYTE_DATA)
584#define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \
585 I2C_FUNC_SMBUS_WRITE_WORD_DATA)
586#define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \
587 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA)
588#define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \
589 I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)
590
591#define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \
592 I2C_FUNC_SMBUS_BYTE | \
593 I2C_FUNC_SMBUS_BYTE_DATA | \
594 I2C_FUNC_SMBUS_WORD_DATA | \
595 I2C_FUNC_SMBUS_PROC_CALL | \
596 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \
597 I2C_FUNC_SMBUS_I2C_BLOCK | \
598 I2C_FUNC_SMBUS_PEC)
599
600/*
601 * Data for SMBus Messages
602 */
603#define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */
604union i2c_smbus_data {
605 __u8 byte;
606 __u16 word;
607 __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */
608 /* and one more for user-space compatibility */
609};
610
611/* i2c_smbus_xfer read or write markers */
612#define I2C_SMBUS_READ 1
613#define I2C_SMBUS_WRITE 0
614
615/* SMBus transaction types (size parameter in the above functions)
616 Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */
617#define I2C_SMBUS_QUICK 0
618#define I2C_SMBUS_BYTE 1
619#define I2C_SMBUS_BYTE_DATA 2
620#define I2C_SMBUS_WORD_DATA 3
621#define I2C_SMBUS_PROC_CALL 4
622#define I2C_SMBUS_BLOCK_DATA 5
623#define I2C_SMBUS_I2C_BLOCK_BROKEN 6
624#define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */
625#define I2C_SMBUS_I2C_BLOCK_DATA 8
626
627#endif /* _LINUX_I2C_H */ 504#endif /* _LINUX_I2C_H */
diff --git a/include/linux/i2c/i2c-rcar.h b/include/linux/i2c/i2c-rcar.h
new file mode 100644
index 000000000000..496f5c2b23c9
--- /dev/null
+++ b/include/linux/i2c/i2c-rcar.h
@@ -0,0 +1,10 @@
1#ifndef __I2C_R_CAR_H__
2#define __I2C_R_CAR_H__
3
4#include <linux/platform_device.h>
5
6struct i2c_rcar_platform_data {
7 u32 bus_speed;
8};
9
10#endif /* __I2C_R_CAR_H__ */
diff --git a/include/linux/i2c/pca954x.h b/include/linux/i2c/pca954x.h
index 28f1f8d5ab1f..1712677d5904 100644
--- a/include/linux/i2c/pca954x.h
+++ b/include/linux/i2c/pca954x.h
@@ -36,6 +36,7 @@
36struct pca954x_platform_mode { 36struct pca954x_platform_mode {
37 int adap_id; 37 int adap_id;
38 unsigned int deselect_on_exit:1; 38 unsigned int deselect_on_exit:1;
39 unsigned int class;
39}; 40};
40 41
41/* Per mux/switch data, used with i2c_register_board_info */ 42/* Per mux/switch data, used with i2c_register_board_info */
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index a12a38107c1a..9a5e28462324 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -188,6 +188,7 @@ int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
188 188
189int twl_get_type(void); 189int twl_get_type(void);
190int twl_get_version(void); 190int twl_get_version(void);
191int twl_get_hfclk_rate(void);
191 192
192int twl6030_interrupt_unmask(u8 bit_mask, u8 offset); 193int twl6030_interrupt_unmask(u8 bit_mask, u8 offset);
193int twl6030_interrupt_mask(u8 bit_mask, u8 offset); 194int twl6030_interrupt_mask(u8 bit_mask, u8 offset);
@@ -663,7 +664,7 @@ struct twl4030_codec_data {
663 unsigned int check_defaults:1; 664 unsigned int check_defaults:1;
664 unsigned int reset_registers:1; 665 unsigned int reset_registers:1;
665 unsigned int hs_extmute:1; 666 unsigned int hs_extmute:1;
666 void (*set_hs_extmute)(int mute); 667 int hs_extmute_gpio;
667}; 668};
668 669
669struct twl4030_vibra_data { 670struct twl4030_vibra_data {
diff --git a/include/linux/icmp.h b/include/linux/icmp.h
index 474f2a51cf0a..efc18490627a 100644
--- a/include/linux/icmp.h
+++ b/include/linux/icmp.h
@@ -17,89 +17,11 @@
17#ifndef _LINUX_ICMP_H 17#ifndef _LINUX_ICMP_H
18#define _LINUX_ICMP_H 18#define _LINUX_ICMP_H
19 19
20#include <linux/types.h>
21
22#define ICMP_ECHOREPLY 0 /* Echo Reply */
23#define ICMP_DEST_UNREACH 3 /* Destination Unreachable */
24#define ICMP_SOURCE_QUENCH 4 /* Source Quench */
25#define ICMP_REDIRECT 5 /* Redirect (change route) */
26#define ICMP_ECHO 8 /* Echo Request */
27#define ICMP_TIME_EXCEEDED 11 /* Time Exceeded */
28#define ICMP_PARAMETERPROB 12 /* Parameter Problem */
29#define ICMP_TIMESTAMP 13 /* Timestamp Request */
30#define ICMP_TIMESTAMPREPLY 14 /* Timestamp Reply */
31#define ICMP_INFO_REQUEST 15 /* Information Request */
32#define ICMP_INFO_REPLY 16 /* Information Reply */
33#define ICMP_ADDRESS 17 /* Address Mask Request */
34#define ICMP_ADDRESSREPLY 18 /* Address Mask Reply */
35#define NR_ICMP_TYPES 18
36
37
38/* Codes for UNREACH. */
39#define ICMP_NET_UNREACH 0 /* Network Unreachable */
40#define ICMP_HOST_UNREACH 1 /* Host Unreachable */
41#define ICMP_PROT_UNREACH 2 /* Protocol Unreachable */
42#define ICMP_PORT_UNREACH 3 /* Port Unreachable */
43#define ICMP_FRAG_NEEDED 4 /* Fragmentation Needed/DF set */
44#define ICMP_SR_FAILED 5 /* Source Route failed */
45#define ICMP_NET_UNKNOWN 6
46#define ICMP_HOST_UNKNOWN 7
47#define ICMP_HOST_ISOLATED 8
48#define ICMP_NET_ANO 9
49#define ICMP_HOST_ANO 10
50#define ICMP_NET_UNR_TOS 11
51#define ICMP_HOST_UNR_TOS 12
52#define ICMP_PKT_FILTERED 13 /* Packet filtered */
53#define ICMP_PREC_VIOLATION 14 /* Precedence violation */
54#define ICMP_PREC_CUTOFF 15 /* Precedence cut off */
55#define NR_ICMP_UNREACH 15 /* instead of hardcoding immediate value */
56
57/* Codes for REDIRECT. */
58#define ICMP_REDIR_NET 0 /* Redirect Net */
59#define ICMP_REDIR_HOST 1 /* Redirect Host */
60#define ICMP_REDIR_NETTOS 2 /* Redirect Net for TOS */
61#define ICMP_REDIR_HOSTTOS 3 /* Redirect Host for TOS */
62
63/* Codes for TIME_EXCEEDED. */
64#define ICMP_EXC_TTL 0 /* TTL count exceeded */
65#define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */
66
67
68struct icmphdr {
69 __u8 type;
70 __u8 code;
71 __sum16 checksum;
72 union {
73 struct {
74 __be16 id;
75 __be16 sequence;
76 } echo;
77 __be32 gateway;
78 struct {
79 __be16 __unused;
80 __be16 mtu;
81 } frag;
82 } un;
83};
84
85#ifdef __KERNEL__
86#include <linux/skbuff.h> 20#include <linux/skbuff.h>
21#include <uapi/linux/icmp.h>
87 22
88static inline struct icmphdr *icmp_hdr(const struct sk_buff *skb) 23static inline struct icmphdr *icmp_hdr(const struct sk_buff *skb)
89{ 24{
90 return (struct icmphdr *)skb_transport_header(skb); 25 return (struct icmphdr *)skb_transport_header(skb);
91} 26}
92#endif
93
94/*
95 * constants for (set|get)sockopt
96 */
97
98#define ICMP_FILTER 1
99
100struct icmp_filter {
101 __u32 data;
102};
103
104
105#endif /* _LINUX_ICMP_H */ 27#endif /* _LINUX_ICMP_H */
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index ba45e6bc0764..b4f6c29caced 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -1,174 +1,13 @@
1#ifndef _LINUX_ICMPV6_H 1#ifndef _LINUX_ICMPV6_H
2#define _LINUX_ICMPV6_H 2#define _LINUX_ICMPV6_H
3 3
4#include <linux/types.h>
5#include <asm/byteorder.h>
6
7struct icmp6hdr {
8
9 __u8 icmp6_type;
10 __u8 icmp6_code;
11 __sum16 icmp6_cksum;
12
13
14 union {
15 __be32 un_data32[1];
16 __be16 un_data16[2];
17 __u8 un_data8[4];
18
19 struct icmpv6_echo {
20 __be16 identifier;
21 __be16 sequence;
22 } u_echo;
23
24 struct icmpv6_nd_advt {
25#if defined(__LITTLE_ENDIAN_BITFIELD)
26 __u32 reserved:5,
27 override:1,
28 solicited:1,
29 router:1,
30 reserved2:24;
31#elif defined(__BIG_ENDIAN_BITFIELD)
32 __u32 router:1,
33 solicited:1,
34 override:1,
35 reserved:29;
36#else
37#error "Please fix <asm/byteorder.h>"
38#endif
39 } u_nd_advt;
40
41 struct icmpv6_nd_ra {
42 __u8 hop_limit;
43#if defined(__LITTLE_ENDIAN_BITFIELD)
44 __u8 reserved:3,
45 router_pref:2,
46 home_agent:1,
47 other:1,
48 managed:1;
49
50#elif defined(__BIG_ENDIAN_BITFIELD)
51 __u8 managed:1,
52 other:1,
53 home_agent:1,
54 router_pref:2,
55 reserved:3;
56#else
57#error "Please fix <asm/byteorder.h>"
58#endif
59 __be16 rt_lifetime;
60 } u_nd_ra;
61
62 } icmp6_dataun;
63
64#define icmp6_identifier icmp6_dataun.u_echo.identifier
65#define icmp6_sequence icmp6_dataun.u_echo.sequence
66#define icmp6_pointer icmp6_dataun.un_data32[0]
67#define icmp6_mtu icmp6_dataun.un_data32[0]
68#define icmp6_unused icmp6_dataun.un_data32[0]
69#define icmp6_maxdelay icmp6_dataun.un_data16[0]
70#define icmp6_router icmp6_dataun.u_nd_advt.router
71#define icmp6_solicited icmp6_dataun.u_nd_advt.solicited
72#define icmp6_override icmp6_dataun.u_nd_advt.override
73#define icmp6_ndiscreserved icmp6_dataun.u_nd_advt.reserved
74#define icmp6_hop_limit icmp6_dataun.u_nd_ra.hop_limit
75#define icmp6_addrconf_managed icmp6_dataun.u_nd_ra.managed
76#define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other
77#define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime
78#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref
79};
80
81#ifdef __KERNEL__
82#include <linux/skbuff.h> 4#include <linux/skbuff.h>
5#include <uapi/linux/icmpv6.h>
83 6
84static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb) 7static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb)
85{ 8{
86 return (struct icmp6hdr *)skb_transport_header(skb); 9 return (struct icmp6hdr *)skb_transport_header(skb);
87} 10}
88#endif
89
90#define ICMPV6_ROUTER_PREF_LOW 0x3
91#define ICMPV6_ROUTER_PREF_MEDIUM 0x0
92#define ICMPV6_ROUTER_PREF_HIGH 0x1
93#define ICMPV6_ROUTER_PREF_INVALID 0x2
94
95#define ICMPV6_DEST_UNREACH 1
96#define ICMPV6_PKT_TOOBIG 2
97#define ICMPV6_TIME_EXCEED 3
98#define ICMPV6_PARAMPROB 4
99
100#define ICMPV6_INFOMSG_MASK 0x80
101
102#define ICMPV6_ECHO_REQUEST 128
103#define ICMPV6_ECHO_REPLY 129
104#define ICMPV6_MGM_QUERY 130
105#define ICMPV6_MGM_REPORT 131
106#define ICMPV6_MGM_REDUCTION 132
107
108#define ICMPV6_NI_QUERY 139
109#define ICMPV6_NI_REPLY 140
110
111#define ICMPV6_MLD2_REPORT 143
112
113#define ICMPV6_DHAAD_REQUEST 144
114#define ICMPV6_DHAAD_REPLY 145
115#define ICMPV6_MOBILE_PREFIX_SOL 146
116#define ICMPV6_MOBILE_PREFIX_ADV 147
117
118/*
119 * Codes for Destination Unreachable
120 */
121#define ICMPV6_NOROUTE 0
122#define ICMPV6_ADM_PROHIBITED 1
123#define ICMPV6_NOT_NEIGHBOUR 2
124#define ICMPV6_ADDR_UNREACH 3
125#define ICMPV6_PORT_UNREACH 4
126
127/*
128 * Codes for Time Exceeded
129 */
130#define ICMPV6_EXC_HOPLIMIT 0
131#define ICMPV6_EXC_FRAGTIME 1
132
133/*
134 * Codes for Parameter Problem
135 */
136#define ICMPV6_HDR_FIELD 0
137#define ICMPV6_UNK_NEXTHDR 1
138#define ICMPV6_UNK_OPTION 2
139
140/*
141 * constants for (set|get)sockopt
142 */
143
144#define ICMPV6_FILTER 1
145
146/*
147 * ICMPV6 filter
148 */
149
150#define ICMPV6_FILTER_BLOCK 1
151#define ICMPV6_FILTER_PASS 2
152#define ICMPV6_FILTER_BLOCKOTHERS 3
153#define ICMPV6_FILTER_PASSONLY 4
154
155struct icmp6_filter {
156 __u32 data[8];
157};
158
159/*
160 * Definitions for MLDv2
161 */
162#define MLD2_MODE_IS_INCLUDE 1
163#define MLD2_MODE_IS_EXCLUDE 2
164#define MLD2_CHANGE_TO_INCLUDE 3
165#define MLD2_CHANGE_TO_EXCLUDE 4
166#define MLD2_ALLOW_NEW_SOURCES 5
167#define MLD2_BLOCK_OLD_SOURCES 6
168
169#define MLD2_ALL_MCR_INIT { { { 0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,0x16 } } }
170
171#ifdef __KERNEL__
172 11
173#include <linux/netdevice.h> 12#include <linux/netdevice.h>
174 13
@@ -192,5 +31,3 @@ extern void icmpv6_flow_init(struct sock *sk,
192 const struct in6_addr *daddr, 31 const struct in6_addr *daddr,
193 int oif); 32 int oif);
194#endif 33#endif
195
196#endif
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 255491cf522e..87259a44c251 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -38,15 +38,15 @@
38#define IDR_SIZE (1 << IDR_BITS) 38#define IDR_SIZE (1 << IDR_BITS)
39#define IDR_MASK ((1 << IDR_BITS)-1) 39#define IDR_MASK ((1 << IDR_BITS)-1)
40 40
41#define MAX_ID_SHIFT (sizeof(int)*8 - 1) 41#define MAX_IDR_SHIFT (sizeof(int)*8 - 1)
42#define MAX_ID_BIT (1U << MAX_ID_SHIFT) 42#define MAX_IDR_BIT (1U << MAX_IDR_SHIFT)
43#define MAX_ID_MASK (MAX_ID_BIT - 1) 43#define MAX_IDR_MASK (MAX_IDR_BIT - 1)
44 44
45/* Leave the possibility of an incomplete final layer */ 45/* Leave the possibility of an incomplete final layer */
46#define MAX_LEVEL (MAX_ID_SHIFT + IDR_BITS - 1) / IDR_BITS 46#define MAX_IDR_LEVEL ((MAX_IDR_SHIFT + IDR_BITS - 1) / IDR_BITS)
47 47
48/* Number of id_layer structs to leave in free list */ 48/* Number of id_layer structs to leave in free list */
49#define IDR_FREE_MAX MAX_LEVEL + MAX_LEVEL 49#define MAX_IDR_FREE (MAX_IDR_LEVEL * 2)
50 50
51struct idr_layer { 51struct idr_layer {
52 unsigned long bitmap; /* A zero bit means "space here" */ 52 unsigned long bitmap; /* A zero bit means "space here" */
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 9adcc29f084a..89b4614a4722 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -23,140 +23,8 @@
23#ifndef _LINUX_IF_ARP_H 23#ifndef _LINUX_IF_ARP_H
24#define _LINUX_IF_ARP_H 24#define _LINUX_IF_ARP_H
25 25
26#include <linux/netdevice.h>
27
28/* ARP protocol HARDWARE identifiers. */
29#define ARPHRD_NETROM 0 /* from KA9Q: NET/ROM pseudo */
30#define ARPHRD_ETHER 1 /* Ethernet 10Mbps */
31#define ARPHRD_EETHER 2 /* Experimental Ethernet */
32#define ARPHRD_AX25 3 /* AX.25 Level 2 */
33#define ARPHRD_PRONET 4 /* PROnet token ring */
34#define ARPHRD_CHAOS 5 /* Chaosnet */
35#define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB */
36#define ARPHRD_ARCNET 7 /* ARCnet */
37#define ARPHRD_APPLETLK 8 /* APPLEtalk */
38#define ARPHRD_DLCI 15 /* Frame Relay DLCI */
39#define ARPHRD_ATM 19 /* ATM */
40#define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id) */
41#define ARPHRD_IEEE1394 24 /* IEEE 1394 IPv4 - RFC 2734 */
42#define ARPHRD_EUI64 27 /* EUI-64 */
43#define ARPHRD_INFINIBAND 32 /* InfiniBand */
44
45/* Dummy types for non ARP hardware */
46#define ARPHRD_SLIP 256
47#define ARPHRD_CSLIP 257
48#define ARPHRD_SLIP6 258
49#define ARPHRD_CSLIP6 259
50#define ARPHRD_RSRVD 260 /* Notional KISS type */
51#define ARPHRD_ADAPT 264
52#define ARPHRD_ROSE 270
53#define ARPHRD_X25 271 /* CCITT X.25 */
54#define ARPHRD_HWX25 272 /* Boards with X.25 in firmware */
55#define ARPHRD_CAN 280 /* Controller Area Network */
56#define ARPHRD_PPP 512
57#define ARPHRD_CISCO 513 /* Cisco HDLC */
58#define ARPHRD_HDLC ARPHRD_CISCO
59#define ARPHRD_LAPB 516 /* LAPB */
60#define ARPHRD_DDCMP 517 /* Digital's DDCMP protocol */
61#define ARPHRD_RAWHDLC 518 /* Raw HDLC */
62
63#define ARPHRD_TUNNEL 768 /* IPIP tunnel */
64#define ARPHRD_TUNNEL6 769 /* IP6IP6 tunnel */
65#define ARPHRD_FRAD 770 /* Frame Relay Access Device */
66#define ARPHRD_SKIP 771 /* SKIP vif */
67#define ARPHRD_LOOPBACK 772 /* Loopback device */
68#define ARPHRD_LOCALTLK 773 /* Localtalk device */
69#define ARPHRD_FDDI 774 /* Fiber Distributed Data Interface */
70#define ARPHRD_BIF 775 /* AP1000 BIF */
71#define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4 */
72#define ARPHRD_IPDDP 777 /* IP over DDP tunneller */
73#define ARPHRD_IPGRE 778 /* GRE over IP */
74#define ARPHRD_PIMREG 779 /* PIMSM register interface */
75#define ARPHRD_HIPPI 780 /* High Performance Parallel Interface */
76#define ARPHRD_ASH 781 /* Nexus 64Mbps Ash */
77#define ARPHRD_ECONET 782 /* Acorn Econet */
78#define ARPHRD_IRDA 783 /* Linux-IrDA */
79/* ARP works differently on different FC media .. so */
80#define ARPHRD_FCPP 784 /* Point to point fibrechannel */
81#define ARPHRD_FCAL 785 /* Fibrechannel arbitrated loop */
82#define ARPHRD_FCPL 786 /* Fibrechannel public loop */
83#define ARPHRD_FCFABRIC 787 /* Fibrechannel fabric */
84 /* 787->799 reserved for fibrechannel media types */
85#define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR */
86#define ARPHRD_IEEE80211 801 /* IEEE 802.11 */
87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */
88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */
89#define ARPHRD_IEEE802154 804
90#define ARPHRD_IEEE802154_MONITOR 805 /* IEEE 802.15.4 network monitor */
91
92#define ARPHRD_PHONET 820 /* PhoNet media type */
93#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
94#define ARPHRD_CAIF 822 /* CAIF media type */
95#define ARPHRD_IP6GRE 823 /* GRE over IPv6 */
96
97#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */
98#define ARPHRD_NONE 0xFFFE /* zero header length */
99
100/* ARP protocol opcodes. */
101#define ARPOP_REQUEST 1 /* ARP request */
102#define ARPOP_REPLY 2 /* ARP reply */
103#define ARPOP_RREQUEST 3 /* RARP request */
104#define ARPOP_RREPLY 4 /* RARP reply */
105#define ARPOP_InREQUEST 8 /* InARP request */
106#define ARPOP_InREPLY 9 /* InARP reply */
107#define ARPOP_NAK 10 /* (ATM)ARP NAK */
108
109
110/* ARP ioctl request. */
111struct arpreq {
112 struct sockaddr arp_pa; /* protocol address */
113 struct sockaddr arp_ha; /* hardware address */
114 int arp_flags; /* flags */
115 struct sockaddr arp_netmask; /* netmask (only for proxy arps) */
116 char arp_dev[16];
117};
118
119struct arpreq_old {
120 struct sockaddr arp_pa; /* protocol address */
121 struct sockaddr arp_ha; /* hardware address */
122 int arp_flags; /* flags */
123 struct sockaddr arp_netmask; /* netmask (only for proxy arps) */
124};
125
126/* ARP Flag values. */
127#define ATF_COM 0x02 /* completed entry (ha valid) */
128#define ATF_PERM 0x04 /* permanent entry */
129#define ATF_PUBL 0x08 /* publish entry */
130#define ATF_USETRAILERS 0x10 /* has requested trailers */
131#define ATF_NETMASK 0x20 /* want to use a netmask (only
132 for proxy entries) */
133#define ATF_DONTPUB 0x40 /* don't answer this addresses */
134
135/*
136 * This structure defines an ethernet arp header.
137 */
138
139struct arphdr {
140 __be16 ar_hrd; /* format of hardware address */
141 __be16 ar_pro; /* format of protocol address */
142 unsigned char ar_hln; /* length of hardware address */
143 unsigned char ar_pln; /* length of protocol address */
144 __be16 ar_op; /* ARP opcode (command) */
145
146#if 0
147 /*
148 * Ethernet looks like this : This bit is variable sized however...
149 */
150 unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */
151 unsigned char ar_sip[4]; /* sender IP address */
152 unsigned char ar_tha[ETH_ALEN]; /* target hardware address */
153 unsigned char ar_tip[4]; /* target IP address */
154#endif
155
156};
157
158#ifdef __KERNEL__
159#include <linux/skbuff.h> 26#include <linux/skbuff.h>
27#include <uapi/linux/if_arp.h>
160 28
161static inline struct arphdr *arp_hdr(const struct sk_buff *skb) 29static inline struct arphdr *arp_hdr(const struct sk_buff *skb)
162{ 30{
@@ -168,6 +36,4 @@ static inline int arp_hdr_len(struct net_device *dev)
168 /* ARP header, plus 2 device addresses, plus 2 IP addresses. */ 36 /* ARP header, plus 2 device addresses, plus 2 IP addresses. */
169 return sizeof(struct arphdr) + (dev->addr_len + sizeof(u32)) * 2; 37 return sizeof(struct arphdr) + (dev->addr_len + sizeof(u32)) * 2;
170} 38}
171#endif
172
173#endif /* _LINUX_IF_ARP_H */ 39#endif /* _LINUX_IF_ARP_H */
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index dd3f20139640..1085ffeef956 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -9,97 +9,12 @@
9 * as published by the Free Software Foundation; either version 9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 */ 11 */
12
13#ifndef _LINUX_IF_BRIDGE_H 12#ifndef _LINUX_IF_BRIDGE_H
14#define _LINUX_IF_BRIDGE_H 13#define _LINUX_IF_BRIDGE_H
15 14
16#include <linux/types.h>
17
18#define SYSFS_BRIDGE_ATTR "bridge"
19#define SYSFS_BRIDGE_FDB "brforward"
20#define SYSFS_BRIDGE_PORT_SUBDIR "brif"
21#define SYSFS_BRIDGE_PORT_ATTR "brport"
22#define SYSFS_BRIDGE_PORT_LINK "bridge"
23
24#define BRCTL_VERSION 1
25
26#define BRCTL_GET_VERSION 0
27#define BRCTL_GET_BRIDGES 1
28#define BRCTL_ADD_BRIDGE 2
29#define BRCTL_DEL_BRIDGE 3
30#define BRCTL_ADD_IF 4
31#define BRCTL_DEL_IF 5
32#define BRCTL_GET_BRIDGE_INFO 6
33#define BRCTL_GET_PORT_LIST 7
34#define BRCTL_SET_BRIDGE_FORWARD_DELAY 8
35#define BRCTL_SET_BRIDGE_HELLO_TIME 9
36#define BRCTL_SET_BRIDGE_MAX_AGE 10
37#define BRCTL_SET_AGEING_TIME 11
38#define BRCTL_SET_GC_INTERVAL 12
39#define BRCTL_GET_PORT_INFO 13
40#define BRCTL_SET_BRIDGE_STP_STATE 14
41#define BRCTL_SET_BRIDGE_PRIORITY 15
42#define BRCTL_SET_PORT_PRIORITY 16
43#define BRCTL_SET_PATH_COST 17
44#define BRCTL_GET_FDB_ENTRIES 18
45
46#define BR_STATE_DISABLED 0
47#define BR_STATE_LISTENING 1
48#define BR_STATE_LEARNING 2
49#define BR_STATE_FORWARDING 3
50#define BR_STATE_BLOCKING 4
51
52struct __bridge_info {
53 __u64 designated_root;
54 __u64 bridge_id;
55 __u32 root_path_cost;
56 __u32 max_age;
57 __u32 hello_time;
58 __u32 forward_delay;
59 __u32 bridge_max_age;
60 __u32 bridge_hello_time;
61 __u32 bridge_forward_delay;
62 __u8 topology_change;
63 __u8 topology_change_detected;
64 __u8 root_port;
65 __u8 stp_enabled;
66 __u32 ageing_time;
67 __u32 gc_interval;
68 __u32 hello_timer_value;
69 __u32 tcn_timer_value;
70 __u32 topology_change_timer_value;
71 __u32 gc_timer_value;
72};
73
74struct __port_info {
75 __u64 designated_root;
76 __u64 designated_bridge;
77 __u16 port_id;
78 __u16 designated_port;
79 __u32 path_cost;
80 __u32 designated_cost;
81 __u8 state;
82 __u8 top_change_ack;
83 __u8 config_pending;
84 __u8 unused0;
85 __u32 message_age_timer_value;
86 __u32 forward_delay_timer_value;
87 __u32 hold_timer_value;
88};
89
90struct __fdb_entry {
91 __u8 mac_addr[6];
92 __u8 port_no;
93 __u8 is_local;
94 __u32 ageing_timer_value;
95 __u8 port_hi;
96 __u8 pad0;
97 __u16 unused;
98};
99
100#ifdef __KERNEL__
101 15
102#include <linux/netdevice.h> 16#include <linux/netdevice.h>
17#include <uapi/linux/if_bridge.h>
103 18
104extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); 19extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
105 20
@@ -107,5 +22,3 @@ typedef int br_should_route_hook_t(struct sk_buff *skb);
107extern br_should_route_hook_t __rcu *br_should_route_hook; 22extern br_should_route_hook_t __rcu *br_should_route_hook;
108 23
109#endif 24#endif
110
111#endif
diff --git a/include/linux/if_eql.h b/include/linux/if_eql.h
index 18a5d02a8644..d984694c384d 100644
--- a/include/linux/if_eql.h
+++ b/include/linux/if_eql.h
@@ -15,28 +15,13 @@
15 * McLean VA 22101 15 * McLean VA 22101
16 * Phone: 1-703-847-0040 ext 103 16 * Phone: 1-703-847-0040 ext 103
17 */ 17 */
18
19#ifndef _LINUX_IF_EQL_H 18#ifndef _LINUX_IF_EQL_H
20#define _LINUX_IF_EQL_H 19#define _LINUX_IF_EQL_H
21 20
22#define EQL_DEFAULT_SLAVE_PRIORITY 28800
23#define EQL_DEFAULT_MAX_SLAVES 4
24#define EQL_DEFAULT_MTU 576
25#define EQL_DEFAULT_RESCHED_IVAL HZ
26
27#define EQL_ENSLAVE (SIOCDEVPRIVATE)
28#define EQL_EMANCIPATE (SIOCDEVPRIVATE + 1)
29
30#define EQL_GETSLAVECFG (SIOCDEVPRIVATE + 2)
31#define EQL_SETSLAVECFG (SIOCDEVPRIVATE + 3)
32
33#define EQL_GETMASTRCFG (SIOCDEVPRIVATE + 4)
34#define EQL_SETMASTRCFG (SIOCDEVPRIVATE + 5)
35
36#ifdef __KERNEL__
37 21
38#include <linux/timer.h> 22#include <linux/timer.h>
39#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <uapi/linux/if_eql.h>
40 25
41typedef struct slave { 26typedef struct slave {
42 struct list_head list; 27 struct list_head list;
@@ -61,23 +46,4 @@ typedef struct equalizer {
61 struct timer_list timer; 46 struct timer_list timer;
62} equalizer_t; 47} equalizer_t;
63 48
64#endif /* __KERNEL__ */
65
66typedef struct master_config {
67 char master_name[16];
68 int max_slaves;
69 int min_slaves;
70} master_config_t;
71
72typedef struct slave_config {
73 char slave_name[16];
74 long priority;
75} slave_config_t;
76
77typedef struct slaving_request {
78 char slave_name[16];
79 long priority;
80} slaving_request_t;
81
82
83#endif /* _LINUX_EQL_H */ 49#endif /* _LINUX_EQL_H */
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 167ce5b363d2..12b4d55a02af 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -17,122 +17,11 @@
17 * as published by the Free Software Foundation; either version 17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version. 18 * 2 of the License, or (at your option) any later version.
19 */ 19 */
20
21#ifndef _LINUX_IF_ETHER_H 20#ifndef _LINUX_IF_ETHER_H
22#define _LINUX_IF_ETHER_H 21#define _LINUX_IF_ETHER_H
23 22
24#include <linux/types.h>
25
26/*
27 * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
28 * and FCS/CRC (frame check sequence).
29 */
30
31#define ETH_ALEN 6 /* Octets in one ethernet addr */
32#define ETH_HLEN 14 /* Total octets in header. */
33#define ETH_ZLEN 60 /* Min. octets in frame sans FCS */
34#define ETH_DATA_LEN 1500 /* Max. octets in payload */
35#define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */
36#define ETH_FCS_LEN 4 /* Octets in the FCS */
37
38/*
39 * These are the defined Ethernet Protocol ID's.
40 */
41
42#define ETH_P_LOOP 0x0060 /* Ethernet Loopback packet */
43#define ETH_P_PUP 0x0200 /* Xerox PUP packet */
44#define ETH_P_PUPAT 0x0201 /* Xerox PUP Addr Trans packet */
45#define ETH_P_IP 0x0800 /* Internet Protocol packet */
46#define ETH_P_X25 0x0805 /* CCITT X.25 */
47#define ETH_P_ARP 0x0806 /* Address Resolution packet */
48#define ETH_P_BPQ 0x08FF /* G8BPQ AX.25 Ethernet Packet [ NOT AN OFFICIALLY REGISTERED ID ] */
49#define ETH_P_IEEEPUP 0x0a00 /* Xerox IEEE802.3 PUP packet */
50#define ETH_P_IEEEPUPAT 0x0a01 /* Xerox IEEE802.3 PUP Addr Trans packet */
51#define ETH_P_DEC 0x6000 /* DEC Assigned proto */
52#define ETH_P_DNA_DL 0x6001 /* DEC DNA Dump/Load */
53#define ETH_P_DNA_RC 0x6002 /* DEC DNA Remote Console */
54#define ETH_P_DNA_RT 0x6003 /* DEC DNA Routing */
55#define ETH_P_LAT 0x6004 /* DEC LAT */
56#define ETH_P_DIAG 0x6005 /* DEC Diagnostics */
57#define ETH_P_CUST 0x6006 /* DEC Customer use */
58#define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */
59#define ETH_P_TEB 0x6558 /* Trans Ether Bridging */
60#define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */
61#define ETH_P_ATALK 0x809B /* Appletalk DDP */
62#define ETH_P_AARP 0x80F3 /* Appletalk AARP */
63#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */
64#define ETH_P_IPX 0x8137 /* IPX over DIX */
65#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */
66#define ETH_P_PAUSE 0x8808 /* IEEE Pause frames. See 802.3 31B */
67#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */
68#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol
69 * defined in draft-wilson-wrec-wccp-v2-00.txt */
70#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */
71#define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */
72#define ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */
73#define ETH_P_MPLS_MC 0x8848 /* MPLS Multicast traffic */
74#define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */
75#define ETH_P_LINK_CTL 0x886c /* HPNA, wlan link local tunnel */
76#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport
77 * over Ethernet
78 */
79#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
80#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */
81#define ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */
82#define ETH_P_802_EX1 0x88B5 /* 802.1 Local Experimental 1. */
83#define ETH_P_TIPC 0x88CA /* TIPC */
84#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */
85#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */
86#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */
87#define ETH_P_TDLS 0x890D /* TDLS */
88#define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */
89#define ETH_P_QINQ1 0x9100 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
90#define ETH_P_QINQ2 0x9200 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
91#define ETH_P_QINQ3 0x9300 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
92#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
93#define ETH_P_AF_IUCV 0xFBFB /* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */
94
95/*
96 * Non DIX types. Won't clash for 1500 types.
97 */
98
99#define ETH_P_802_3 0x0001 /* Dummy type for 802.3 frames */
100#define ETH_P_AX25 0x0002 /* Dummy protocol id for AX.25 */
101#define ETH_P_ALL 0x0003 /* Every packet (be careful!!!) */
102#define ETH_P_802_2 0x0004 /* 802.2 frames */
103#define ETH_P_SNAP 0x0005 /* Internal only */
104#define ETH_P_DDCMP 0x0006 /* DEC DDCMP: Internal only */
105#define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/
106#define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */
107#define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */
108#define ETH_P_CAN 0x000C /* CAN: Controller Area Network */
109#define ETH_P_CANFD 0x000D /* CANFD: CAN flexible data rate*/
110#define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/
111#define ETH_P_TR_802_2 0x0011 /* 802.2 frames */
112#define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */
113#define ETH_P_CONTROL 0x0016 /* Card specific control frames */
114#define ETH_P_IRDA 0x0017 /* Linux-IrDA */
115#define ETH_P_ECONET 0x0018 /* Acorn Econet */
116#define ETH_P_HDLC 0x0019 /* HDLC frames */
117#define ETH_P_ARCNET 0x001A /* 1A for ArcNet :-) */
118#define ETH_P_DSA 0x001B /* Distributed Switch Arch. */
119#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */
120#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */
121#define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */
122#define ETH_P_CAIF 0x00F7 /* ST-Ericsson CAIF protocol */
123
124/*
125 * This is an Ethernet frame header.
126 */
127
128struct ethhdr {
129 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
130 unsigned char h_source[ETH_ALEN]; /* source ether addr */
131 __be16 h_proto; /* packet type ID field */
132} __attribute__((packed));
133
134#ifdef __KERNEL__
135#include <linux/skbuff.h> 23#include <linux/skbuff.h>
24#include <uapi/linux/if_ether.h>
136 25
137static inline struct ethhdr *eth_hdr(const struct sk_buff *skb) 26static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
138{ 27{
@@ -144,6 +33,4 @@ int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
144int mac_pton(const char *s, u8 *mac); 33int mac_pton(const char *s, u8 *mac);
145extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len); 34extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
146 35
147#endif
148
149#endif /* _LINUX_IF_ETHER_H */ 36#endif /* _LINUX_IF_ETHER_H */
diff --git a/include/linux/if_fddi.h b/include/linux/if_fddi.h
index e6dc11e7f9a5..f5550b3eeeab 100644
--- a/include/linux/if_fddi.h
+++ b/include/linux/if_fddi.h
@@ -24,84 +24,8 @@
24#ifndef _LINUX_IF_FDDI_H 24#ifndef _LINUX_IF_FDDI_H
25#define _LINUX_IF_FDDI_H 25#define _LINUX_IF_FDDI_H
26 26
27#include <linux/types.h>
28
29/*
30 * Define max and min legal sizes. The frame sizes do not include
31 * 4 byte FCS/CRC (frame check sequence).
32 */
33#define FDDI_K_ALEN 6 /* Octets in one FDDI address */
34#define FDDI_K_8022_HLEN 16 /* Total octets in 802.2 header */
35#define FDDI_K_SNAP_HLEN 21 /* Total octets in 802.2 SNAP header */
36#define FDDI_K_8022_ZLEN 16 /* Min octets in 802.2 frame sans FCS */
37#define FDDI_K_SNAP_ZLEN 21 /* Min octets in 802.2 SNAP frame sans FCS */
38#define FDDI_K_8022_DLEN 4475 /* Max octets in 802.2 payload */
39#define FDDI_K_SNAP_DLEN 4470 /* Max octets in 802.2 SNAP payload */
40#define FDDI_K_LLC_ZLEN 13 /* Min octets in LLC frame sans FCS */
41#define FDDI_K_LLC_LEN 4491 /* Max octets in LLC frame sans FCS */
42
43/* Define FDDI Frame Control (FC) Byte values */
44#define FDDI_FC_K_VOID 0x00
45#define FDDI_FC_K_NON_RESTRICTED_TOKEN 0x80
46#define FDDI_FC_K_RESTRICTED_TOKEN 0xC0
47#define FDDI_FC_K_SMT_MIN 0x41
48#define FDDI_FC_K_SMT_MAX 0x4F
49#define FDDI_FC_K_MAC_MIN 0xC1
50#define FDDI_FC_K_MAC_MAX 0xCF
51#define FDDI_FC_K_ASYNC_LLC_MIN 0x50
52#define FDDI_FC_K_ASYNC_LLC_DEF 0x54
53#define FDDI_FC_K_ASYNC_LLC_MAX 0x5F
54#define FDDI_FC_K_SYNC_LLC_MIN 0xD0
55#define FDDI_FC_K_SYNC_LLC_MAX 0xD7
56#define FDDI_FC_K_IMPLEMENTOR_MIN 0x60
57#define FDDI_FC_K_IMPLEMENTOR_MAX 0x6F
58#define FDDI_FC_K_RESERVED_MIN 0x70
59#define FDDI_FC_K_RESERVED_MAX 0x7F
60
61/* Define LLC and SNAP constants */
62#define FDDI_EXTENDED_SAP 0xAA
63#define FDDI_UI_CMD 0x03
64
65/* Define 802.2 Type 1 header */
66struct fddi_8022_1_hdr {
67 __u8 dsap; /* destination service access point */
68 __u8 ssap; /* source service access point */
69 __u8 ctrl; /* control byte #1 */
70} __attribute__((packed));
71
72/* Define 802.2 Type 2 header */
73struct fddi_8022_2_hdr {
74 __u8 dsap; /* destination service access point */
75 __u8 ssap; /* source service access point */
76 __u8 ctrl_1; /* control byte #1 */
77 __u8 ctrl_2; /* control byte #2 */
78} __attribute__((packed));
79
80/* Define 802.2 SNAP header */
81#define FDDI_K_OUI_LEN 3
82struct fddi_snap_hdr {
83 __u8 dsap; /* always 0xAA */
84 __u8 ssap; /* always 0xAA */
85 __u8 ctrl; /* always 0x03 */
86 __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */
87 __be16 ethertype; /* packet type ID field */
88} __attribute__((packed));
89
90/* Define FDDI LLC frame header */
91struct fddihdr {
92 __u8 fc; /* frame control */
93 __u8 daddr[FDDI_K_ALEN]; /* destination address */
94 __u8 saddr[FDDI_K_ALEN]; /* source address */
95 union
96 {
97 struct fddi_8022_1_hdr llc_8022_1;
98 struct fddi_8022_2_hdr llc_8022_2;
99 struct fddi_snap_hdr llc_snap;
100 } hdr;
101} __attribute__((packed));
102
103#ifdef __KERNEL__
104#include <linux/netdevice.h> 27#include <linux/netdevice.h>
28#include <uapi/linux/if_fddi.h>
105 29
106/* Define FDDI statistics structure */ 30/* Define FDDI statistics structure */
107struct fddi_statistics { 31struct fddi_statistics {
@@ -194,6 +118,4 @@ struct fddi_statistics {
194 __u32 port_ler_flag[2]; 118 __u32 port_ler_flag[2];
195 __u32 port_hardware_present[2]; 119 __u32 port_hardware_present[2];
196}; 120};
197#endif /* __KERNEL__ */
198
199#endif /* _LINUX_IF_FDDI_H */ 121#endif /* _LINUX_IF_FDDI_H */
diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h
index 191ee0869bc1..4316aa173dde 100644
--- a/include/linux/if_frad.h
+++ b/include/linux/if_frad.h
@@ -20,105 +20,11 @@
20 * as published by the Free Software Foundation; either version 20 * as published by the Free Software Foundation; either version
21 * 2 of the License, or (at your option) any later version. 21 * 2 of the License, or (at your option) any later version.
22 */ 22 */
23
24#ifndef _FRAD_H_ 23#ifndef _FRAD_H_
25#define _FRAD_H_ 24#define _FRAD_H_
26 25
27#include <linux/if.h> 26#include <uapi/linux/if_frad.h>
28
29/* Structures and constants associated with the DLCI device driver */
30
31struct dlci_add
32{
33 char devname[IFNAMSIZ];
34 short dlci;
35};
36
37#define DLCI_GET_CONF (SIOCDEVPRIVATE + 2)
38#define DLCI_SET_CONF (SIOCDEVPRIVATE + 3)
39
40/*
41 * These are related to the Sangoma SDLA and should remain in order.
42 * Code within the SDLA module is based on the specifics of this
43 * structure. Change at your own peril.
44 */
45struct dlci_conf {
46 short flags;
47 short CIR_fwd;
48 short Bc_fwd;
49 short Be_fwd;
50 short CIR_bwd;
51 short Bc_bwd;
52 short Be_bwd;
53
54/* these are part of the status read */
55 short Tc_fwd;
56 short Tc_bwd;
57 short Tf_max;
58 short Tb_max;
59
60/* add any new fields here above is a mirror of sdla_dlci_conf */
61};
62
63#define DLCI_GET_SLAVE (SIOCDEVPRIVATE + 4)
64
65/* configuration flags for DLCI */
66#define DLCI_IGNORE_CIR_OUT 0x0001
67#define DLCI_ACCOUNT_CIR_IN 0x0002
68#define DLCI_BUFFER_IF 0x0008
69
70#define DLCI_VALID_FLAGS 0x000B
71 27
72/* defines for the actual Frame Relay hardware */
73#define FRAD_GET_CONF (SIOCDEVPRIVATE)
74#define FRAD_SET_CONF (SIOCDEVPRIVATE + 1)
75
76#define FRAD_LAST_IOCTL FRAD_SET_CONF
77
78/*
79 * Based on the setup for the Sangoma SDLA. If changes are
80 * necessary to this structure, a routine will need to be
81 * added to that module to copy fields.
82 */
83struct frad_conf
84{
85 short station;
86 short flags;
87 short kbaud;
88 short clocking;
89 short mtu;
90 short T391;
91 short T392;
92 short N391;
93 short N392;
94 short N393;
95 short CIR_fwd;
96 short Bc_fwd;
97 short Be_fwd;
98 short CIR_bwd;
99 short Bc_bwd;
100 short Be_bwd;
101
102/* Add new fields here, above is a mirror of the sdla_conf */
103
104};
105
106#define FRAD_STATION_CPE 0x0000
107#define FRAD_STATION_NODE 0x0001
108
109#define FRAD_TX_IGNORE_CIR 0x0001
110#define FRAD_RX_ACCOUNT_CIR 0x0002
111#define FRAD_DROP_ABORTED 0x0004
112#define FRAD_BUFFERIF 0x0008
113#define FRAD_STATS 0x0010
114#define FRAD_MCI 0x0100
115#define FRAD_AUTODLCI 0x8000
116#define FRAD_VALID_FLAGS 0x811F
117
118#define FRAD_CLOCK_INT 0x0001
119#define FRAD_CLOCK_EXT 0x0000
120
121#ifdef __KERNEL__
122 28
123#if defined(CONFIG_DLCI) || defined(CONFIG_DLCI_MODULE) 29#if defined(CONFIG_DLCI) || defined(CONFIG_DLCI_MODULE)
124 30
@@ -188,6 +94,4 @@ struct frad_local
188 94
189extern void dlci_ioctl_set(int (*hook)(unsigned int, void __user *)); 95extern void dlci_ioctl_set(int (*hook)(unsigned int, void __user *));
190 96
191#endif /* __KERNEL__ */
192
193#endif 97#endif
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index e4dad4ddf085..c3f817c3eb45 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -1,335 +1,8 @@
1#ifndef _LINUX_IF_LINK_H 1#ifndef _LINUX_IF_LINK_H
2#define _LINUX_IF_LINK_H 2#define _LINUX_IF_LINK_H
3 3
4#include <linux/types.h> 4#include <uapi/linux/if_link.h>
5#include <linux/netlink.h>
6 5
7/* This struct should be in sync with struct rtnl_link_stats64 */
8struct rtnl_link_stats {
9 __u32 rx_packets; /* total packets received */
10 __u32 tx_packets; /* total packets transmitted */
11 __u32 rx_bytes; /* total bytes received */
12 __u32 tx_bytes; /* total bytes transmitted */
13 __u32 rx_errors; /* bad packets received */
14 __u32 tx_errors; /* packet transmit problems */
15 __u32 rx_dropped; /* no space in linux buffers */
16 __u32 tx_dropped; /* no space available in linux */
17 __u32 multicast; /* multicast packets received */
18 __u32 collisions;
19
20 /* detailed rx_errors: */
21 __u32 rx_length_errors;
22 __u32 rx_over_errors; /* receiver ring buff overflow */
23 __u32 rx_crc_errors; /* recved pkt with crc error */
24 __u32 rx_frame_errors; /* recv'd frame alignment error */
25 __u32 rx_fifo_errors; /* recv'r fifo overrun */
26 __u32 rx_missed_errors; /* receiver missed packet */
27
28 /* detailed tx_errors */
29 __u32 tx_aborted_errors;
30 __u32 tx_carrier_errors;
31 __u32 tx_fifo_errors;
32 __u32 tx_heartbeat_errors;
33 __u32 tx_window_errors;
34
35 /* for cslip etc */
36 __u32 rx_compressed;
37 __u32 tx_compressed;
38};
39
40/* The main device statistics structure */
41struct rtnl_link_stats64 {
42 __u64 rx_packets; /* total packets received */
43 __u64 tx_packets; /* total packets transmitted */
44 __u64 rx_bytes; /* total bytes received */
45 __u64 tx_bytes; /* total bytes transmitted */
46 __u64 rx_errors; /* bad packets received */
47 __u64 tx_errors; /* packet transmit problems */
48 __u64 rx_dropped; /* no space in linux buffers */
49 __u64 tx_dropped; /* no space available in linux */
50 __u64 multicast; /* multicast packets received */
51 __u64 collisions;
52
53 /* detailed rx_errors: */
54 __u64 rx_length_errors;
55 __u64 rx_over_errors; /* receiver ring buff overflow */
56 __u64 rx_crc_errors; /* recved pkt with crc error */
57 __u64 rx_frame_errors; /* recv'd frame alignment error */
58 __u64 rx_fifo_errors; /* recv'r fifo overrun */
59 __u64 rx_missed_errors; /* receiver missed packet */
60
61 /* detailed tx_errors */
62 __u64 tx_aborted_errors;
63 __u64 tx_carrier_errors;
64 __u64 tx_fifo_errors;
65 __u64 tx_heartbeat_errors;
66 __u64 tx_window_errors;
67
68 /* for cslip etc */
69 __u64 rx_compressed;
70 __u64 tx_compressed;
71};
72
73/* The struct should be in sync with struct ifmap */
74struct rtnl_link_ifmap {
75 __u64 mem_start;
76 __u64 mem_end;
77 __u64 base_addr;
78 __u16 irq;
79 __u8 dma;
80 __u8 port;
81};
82
83/*
84 * IFLA_AF_SPEC
85 * Contains nested attributes for address family specific attributes.
86 * Each address family may create a attribute with the address family
87 * number as type and create its own attribute structure in it.
88 *
89 * Example:
90 * [IFLA_AF_SPEC] = {
91 * [AF_INET] = {
92 * [IFLA_INET_CONF] = ...,
93 * },
94 * [AF_INET6] = {
95 * [IFLA_INET6_FLAGS] = ...,
96 * [IFLA_INET6_CONF] = ...,
97 * }
98 * }
99 */
100
101enum {
102 IFLA_UNSPEC,
103 IFLA_ADDRESS,
104 IFLA_BROADCAST,
105 IFLA_IFNAME,
106 IFLA_MTU,
107 IFLA_LINK,
108 IFLA_QDISC,
109 IFLA_STATS,
110 IFLA_COST,
111#define IFLA_COST IFLA_COST
112 IFLA_PRIORITY,
113#define IFLA_PRIORITY IFLA_PRIORITY
114 IFLA_MASTER,
115#define IFLA_MASTER IFLA_MASTER
116 IFLA_WIRELESS, /* Wireless Extension event - see wireless.h */
117#define IFLA_WIRELESS IFLA_WIRELESS
118 IFLA_PROTINFO, /* Protocol specific information for a link */
119#define IFLA_PROTINFO IFLA_PROTINFO
120 IFLA_TXQLEN,
121#define IFLA_TXQLEN IFLA_TXQLEN
122 IFLA_MAP,
123#define IFLA_MAP IFLA_MAP
124 IFLA_WEIGHT,
125#define IFLA_WEIGHT IFLA_WEIGHT
126 IFLA_OPERSTATE,
127 IFLA_LINKMODE,
128 IFLA_LINKINFO,
129#define IFLA_LINKINFO IFLA_LINKINFO
130 IFLA_NET_NS_PID,
131 IFLA_IFALIAS,
132 IFLA_NUM_VF, /* Number of VFs if device is SR-IOV PF */
133 IFLA_VFINFO_LIST,
134 IFLA_STATS64,
135 IFLA_VF_PORTS,
136 IFLA_PORT_SELF,
137 IFLA_AF_SPEC,
138 IFLA_GROUP, /* Group the device belongs to */
139 IFLA_NET_NS_FD,
140 IFLA_EXT_MASK, /* Extended info mask, VFs, etc */
141 IFLA_PROMISCUITY, /* Promiscuity count: > 0 means acts PROMISC */
142#define IFLA_PROMISCUITY IFLA_PROMISCUITY
143 IFLA_NUM_TX_QUEUES,
144 IFLA_NUM_RX_QUEUES,
145 __IFLA_MAX
146};
147
148
149#define IFLA_MAX (__IFLA_MAX - 1)
150
151/* backwards compatibility for userspace */
152#ifndef __KERNEL__
153#define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg))))
154#define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg))
155#endif
156
157enum {
158 IFLA_INET_UNSPEC,
159 IFLA_INET_CONF,
160 __IFLA_INET_MAX,
161};
162
163#define IFLA_INET_MAX (__IFLA_INET_MAX - 1)
164
165/* ifi_flags.
166
167 IFF_* flags.
168
169 The only change is:
170 IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are
171 more not changeable by user. They describe link media
172 characteristics and set by device driver.
173
174 Comments:
175 - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid
176 - If neither of these three flags are set;
177 the interface is NBMA.
178
179 - IFF_MULTICAST does not mean anything special:
180 multicasts can be used on all not-NBMA links.
181 IFF_MULTICAST means that this media uses special encapsulation
182 for multicast frames. Apparently, all IFF_POINTOPOINT and
183 IFF_BROADCAST devices are able to use multicasts too.
184 */
185
186/* IFLA_LINK.
187 For usual devices it is equal ifi_index.
188 If it is a "virtual interface" (f.e. tunnel), ifi_link
189 can point to real physical interface (f.e. for bandwidth calculations),
190 or maybe 0, what means, that real media is unknown (usual
191 for IPIP tunnels, when route to endpoint is allowed to change)
192 */
193
194/* Subtype attributes for IFLA_PROTINFO */
195enum {
196 IFLA_INET6_UNSPEC,
197 IFLA_INET6_FLAGS, /* link flags */
198 IFLA_INET6_CONF, /* sysctl parameters */
199 IFLA_INET6_STATS, /* statistics */
200 IFLA_INET6_MCAST, /* MC things. What of them? */
201 IFLA_INET6_CACHEINFO, /* time values and max reasm size */
202 IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */
203 __IFLA_INET6_MAX
204};
205
206#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1)
207
208struct ifla_cacheinfo {
209 __u32 max_reasm_len;
210 __u32 tstamp; /* ipv6InterfaceTable updated timestamp */
211 __u32 reachable_time;
212 __u32 retrans_time;
213};
214
215enum {
216 IFLA_INFO_UNSPEC,
217 IFLA_INFO_KIND,
218 IFLA_INFO_DATA,
219 IFLA_INFO_XSTATS,
220 __IFLA_INFO_MAX,
221};
222
223#define IFLA_INFO_MAX (__IFLA_INFO_MAX - 1)
224
225/* VLAN section */
226
227enum {
228 IFLA_VLAN_UNSPEC,
229 IFLA_VLAN_ID,
230 IFLA_VLAN_FLAGS,
231 IFLA_VLAN_EGRESS_QOS,
232 IFLA_VLAN_INGRESS_QOS,
233 __IFLA_VLAN_MAX,
234};
235
236#define IFLA_VLAN_MAX (__IFLA_VLAN_MAX - 1)
237
238struct ifla_vlan_flags {
239 __u32 flags;
240 __u32 mask;
241};
242
243enum {
244 IFLA_VLAN_QOS_UNSPEC,
245 IFLA_VLAN_QOS_MAPPING,
246 __IFLA_VLAN_QOS_MAX
247};
248
249#define IFLA_VLAN_QOS_MAX (__IFLA_VLAN_QOS_MAX - 1)
250
251struct ifla_vlan_qos_mapping {
252 __u32 from;
253 __u32 to;
254};
255
256/* MACVLAN section */
257enum {
258 IFLA_MACVLAN_UNSPEC,
259 IFLA_MACVLAN_MODE,
260 IFLA_MACVLAN_FLAGS,
261 __IFLA_MACVLAN_MAX,
262};
263
264#define IFLA_MACVLAN_MAX (__IFLA_MACVLAN_MAX - 1)
265
266enum macvlan_mode {
267 MACVLAN_MODE_PRIVATE = 1, /* don't talk to other macvlans */
268 MACVLAN_MODE_VEPA = 2, /* talk to other ports through ext bridge */
269 MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */
270 MACVLAN_MODE_PASSTHRU = 8,/* take over the underlying device */
271};
272
273#define MACVLAN_FLAG_NOPROMISC 1
274
275/* VXLAN section */
276enum {
277 IFLA_VXLAN_UNSPEC,
278 IFLA_VXLAN_ID,
279 IFLA_VXLAN_GROUP,
280 IFLA_VXLAN_LINK,
281 IFLA_VXLAN_LOCAL,
282 IFLA_VXLAN_TTL,
283 IFLA_VXLAN_TOS,
284 IFLA_VXLAN_LEARNING,
285 IFLA_VXLAN_AGEING,
286 IFLA_VXLAN_LIMIT,
287 __IFLA_VXLAN_MAX
288};
289#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
290
291/* SR-IOV virtual function management section */
292
293enum {
294 IFLA_VF_INFO_UNSPEC,
295 IFLA_VF_INFO,
296 __IFLA_VF_INFO_MAX,
297};
298
299#define IFLA_VF_INFO_MAX (__IFLA_VF_INFO_MAX - 1)
300
301enum {
302 IFLA_VF_UNSPEC,
303 IFLA_VF_MAC, /* Hardware queue specific attributes */
304 IFLA_VF_VLAN,
305 IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */
306 IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */
307 __IFLA_VF_MAX,
308};
309
310#define IFLA_VF_MAX (__IFLA_VF_MAX - 1)
311
312struct ifla_vf_mac {
313 __u32 vf;
314 __u8 mac[32]; /* MAX_ADDR_LEN */
315};
316
317struct ifla_vf_vlan {
318 __u32 vf;
319 __u32 vlan; /* 0 - 4095, 0 disables VLAN filter */
320 __u32 qos;
321};
322
323struct ifla_vf_tx_rate {
324 __u32 vf;
325 __u32 rate; /* Max TX bandwidth in Mbps, 0 disables throttling */
326};
327
328struct ifla_vf_spoofchk {
329 __u32 vf;
330 __u32 setting;
331};
332#ifdef __KERNEL__
333 6
334/* We don't want this structure exposed to user space */ 7/* We don't want this structure exposed to user space */
335struct ifla_vf_info { 8struct ifla_vf_info {
@@ -340,96 +13,4 @@ struct ifla_vf_info {
340 __u32 tx_rate; 13 __u32 tx_rate;
341 __u32 spoofchk; 14 __u32 spoofchk;
342}; 15};
343#endif
344
345/* VF ports management section
346 *
347 * Nested layout of set/get msg is:
348 *
349 * [IFLA_NUM_VF]
350 * [IFLA_VF_PORTS]
351 * [IFLA_VF_PORT]
352 * [IFLA_PORT_*], ...
353 * [IFLA_VF_PORT]
354 * [IFLA_PORT_*], ...
355 * ...
356 * [IFLA_PORT_SELF]
357 * [IFLA_PORT_*], ...
358 */
359
360enum {
361 IFLA_VF_PORT_UNSPEC,
362 IFLA_VF_PORT, /* nest */
363 __IFLA_VF_PORT_MAX,
364};
365
366#define IFLA_VF_PORT_MAX (__IFLA_VF_PORT_MAX - 1)
367
368enum {
369 IFLA_PORT_UNSPEC,
370 IFLA_PORT_VF, /* __u32 */
371 IFLA_PORT_PROFILE, /* string */
372 IFLA_PORT_VSI_TYPE, /* 802.1Qbg (pre-)standard VDP */
373 IFLA_PORT_INSTANCE_UUID, /* binary UUID */
374 IFLA_PORT_HOST_UUID, /* binary UUID */
375 IFLA_PORT_REQUEST, /* __u8 */
376 IFLA_PORT_RESPONSE, /* __u16, output only */
377 __IFLA_PORT_MAX,
378};
379
380#define IFLA_PORT_MAX (__IFLA_PORT_MAX - 1)
381
382#define PORT_PROFILE_MAX 40
383#define PORT_UUID_MAX 16
384#define PORT_SELF_VF -1
385
386enum {
387 PORT_REQUEST_PREASSOCIATE = 0,
388 PORT_REQUEST_PREASSOCIATE_RR,
389 PORT_REQUEST_ASSOCIATE,
390 PORT_REQUEST_DISASSOCIATE,
391};
392
393enum {
394 PORT_VDP_RESPONSE_SUCCESS = 0,
395 PORT_VDP_RESPONSE_INVALID_FORMAT,
396 PORT_VDP_RESPONSE_INSUFFICIENT_RESOURCES,
397 PORT_VDP_RESPONSE_UNUSED_VTID,
398 PORT_VDP_RESPONSE_VTID_VIOLATION,
399 PORT_VDP_RESPONSE_VTID_VERSION_VIOALTION,
400 PORT_VDP_RESPONSE_OUT_OF_SYNC,
401 /* 0x08-0xFF reserved for future VDP use */
402 PORT_PROFILE_RESPONSE_SUCCESS = 0x100,
403 PORT_PROFILE_RESPONSE_INPROGRESS,
404 PORT_PROFILE_RESPONSE_INVALID,
405 PORT_PROFILE_RESPONSE_BADSTATE,
406 PORT_PROFILE_RESPONSE_INSUFFICIENT_RESOURCES,
407 PORT_PROFILE_RESPONSE_ERROR,
408};
409
410struct ifla_port_vsi {
411 __u8 vsi_mgr_id;
412 __u8 vsi_type_id[3];
413 __u8 vsi_type_version;
414 __u8 pad[3];
415};
416
417
418/* IPoIB section */
419
420enum {
421 IFLA_IPOIB_UNSPEC,
422 IFLA_IPOIB_PKEY,
423 IFLA_IPOIB_MODE,
424 IFLA_IPOIB_UMCAST,
425 __IFLA_IPOIB_MAX
426};
427
428enum {
429 IPOIB_MODE_DATAGRAM = 0, /* using unreliable datagram QPs */
430 IPOIB_MODE_CONNECTED = 1, /* using connected QPs */
431};
432
433#define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1)
434
435#endif /* _LINUX_IF_LINK_H */ 16#endif /* _LINUX_IF_LINK_H */
diff --git a/include/linux/if_ltalk.h b/include/linux/if_ltalk.h
index 76525760ba48..81e434c50790 100644
--- a/include/linux/if_ltalk.h
+++ b/include/linux/if_ltalk.h
@@ -1,12 +1,7 @@
1#ifndef __LINUX_LTALK_H 1#ifndef __LINUX_LTALK_H
2#define __LINUX_LTALK_H 2#define __LINUX_LTALK_H
3 3
4#define LTALK_HLEN 1 4#include <uapi/linux/if_ltalk.h>
5#define LTALK_MTU 600
6#define LTALK_ALEN 1
7 5
8#ifdef __KERNEL__
9extern struct net_device *alloc_ltalkdev(int sizeof_priv); 6extern struct net_device *alloc_ltalkdev(int sizeof_priv);
10#endif 7#endif
11
12#endif
diff --git a/include/linux/if_phonet.h b/include/linux/if_phonet.h
index d70034bcec05..bbcdb0a767d8 100644
--- a/include/linux/if_phonet.h
+++ b/include/linux/if_phonet.h
@@ -8,12 +8,7 @@
8#ifndef LINUX_IF_PHONET_H 8#ifndef LINUX_IF_PHONET_H
9#define LINUX_IF_PHONET_H 9#define LINUX_IF_PHONET_H
10 10
11#define PHONET_MIN_MTU 6 /* pn_length = 0 */ 11#include <uapi/linux/if_phonet.h>
12#define PHONET_MAX_MTU 65541 /* pn_length = 0xffff */
13#define PHONET_DEV_MTU PHONET_MAX_MTU
14 12
15#ifdef __KERNEL__
16extern struct header_ops phonet_header_ops; 13extern struct header_ops phonet_header_ops;
17#endif 14#endif
18
19#endif
diff --git a/include/linux/if_pppol2tp.h b/include/linux/if_pppol2tp.h
index b4775418d525..0fb71e532b2c 100644
--- a/include/linux/if_pppol2tp.h
+++ b/include/linux/if_pppol2tp.h
@@ -11,98 +11,11 @@
11 * 2 of the License, or (at your option) any later version. 11 * 2 of the License, or (at your option) any later version.
12 * 12 *
13 */ 13 */
14
15#ifndef __LINUX_IF_PPPOL2TP_H 14#ifndef __LINUX_IF_PPPOL2TP_H
16#define __LINUX_IF_PPPOL2TP_H 15#define __LINUX_IF_PPPOL2TP_H
17 16
18#include <linux/types.h>
19
20#ifdef __KERNEL__
21#include <linux/in.h> 17#include <linux/in.h>
22#include <linux/in6.h> 18#include <linux/in6.h>
23#endif 19#include <uapi/linux/if_pppol2tp.h>
24
25/* Structure used to connect() the socket to a particular tunnel UDP
26 * socket over IPv4.
27 */
28struct pppol2tp_addr {
29 __kernel_pid_t pid; /* pid that owns the fd.
30 * 0 => current */
31 int fd; /* FD of UDP socket to use */
32
33 struct sockaddr_in addr; /* IP address and port to send to */
34
35 __u16 s_tunnel, s_session; /* For matching incoming packets */
36 __u16 d_tunnel, d_session; /* For sending outgoing packets */
37};
38
39/* Structure used to connect() the socket to a particular tunnel UDP
40 * socket over IPv6.
41 */
42struct pppol2tpin6_addr {
43 __kernel_pid_t pid; /* pid that owns the fd.
44 * 0 => current */
45 int fd; /* FD of UDP socket to use */
46
47 __u16 s_tunnel, s_session; /* For matching incoming packets */
48 __u16 d_tunnel, d_session; /* For sending outgoing packets */
49
50 struct sockaddr_in6 addr; /* IP address and port to send to */
51};
52
53/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
54 * bits. So we need a different sockaddr structure.
55 */
56struct pppol2tpv3_addr {
57 __kernel_pid_t pid; /* pid that owns the fd.
58 * 0 => current */
59 int fd; /* FD of UDP or IP socket to use */
60
61 struct sockaddr_in addr; /* IP address and port to send to */
62
63 __u32 s_tunnel, s_session; /* For matching incoming packets */
64 __u32 d_tunnel, d_session; /* For sending outgoing packets */
65};
66
67struct pppol2tpv3in6_addr {
68 __kernel_pid_t pid; /* pid that owns the fd.
69 * 0 => current */
70 int fd; /* FD of UDP or IP socket to use */
71
72 __u32 s_tunnel, s_session; /* For matching incoming packets */
73 __u32 d_tunnel, d_session; /* For sending outgoing packets */
74
75 struct sockaddr_in6 addr; /* IP address and port to send to */
76};
77
78/* Socket options:
79 * DEBUG - bitmask of debug message categories
80 * SENDSEQ - 0 => don't send packets with sequence numbers
81 * 1 => send packets with sequence numbers
82 * RECVSEQ - 0 => receive packet sequence numbers are optional
83 * 1 => drop receive packets without sequence numbers
84 * LNSMODE - 0 => act as LAC.
85 * 1 => act as LNS.
86 * REORDERTO - reorder timeout (in millisecs). If 0, don't try to reorder.
87 */
88enum {
89 PPPOL2TP_SO_DEBUG = 1,
90 PPPOL2TP_SO_RECVSEQ = 2,
91 PPPOL2TP_SO_SENDSEQ = 3,
92 PPPOL2TP_SO_LNSMODE = 4,
93 PPPOL2TP_SO_REORDERTO = 5,
94};
95
96/* Debug message categories for the DEBUG socket option */
97enum {
98 PPPOL2TP_MSG_DEBUG = (1 << 0), /* verbose debug (if
99 * compiled in) */
100 PPPOL2TP_MSG_CONTROL = (1 << 1), /* userspace - kernel
101 * interface */
102 PPPOL2TP_MSG_SEQ = (1 << 2), /* sequence numbers */
103 PPPOL2TP_MSG_DATA = (1 << 3), /* data packets */
104};
105
106
107 20
108#endif 21#endif
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index 09c474c480cd..aff7ad8a4ea3 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -12,153 +12,14 @@
12 * 2 of the License, or (at your option) any later version. 12 * 2 of the License, or (at your option) any later version.
13 * 13 *
14 */ 14 */
15
16#ifndef __LINUX_IF_PPPOX_H 15#ifndef __LINUX_IF_PPPOX_H
17#define __LINUX_IF_PPPOX_H 16#define __LINUX_IF_PPPOX_H
18 17
19
20#include <linux/types.h>
21#include <asm/byteorder.h>
22
23#include <linux/socket.h>
24#include <linux/if_ether.h>
25#ifdef __KERNEL__
26#include <linux/if.h> 18#include <linux/if.h>
27#include <linux/netdevice.h> 19#include <linux/netdevice.h>
28#include <linux/ppp_channel.h> 20#include <linux/ppp_channel.h>
29#endif /* __KERNEL__ */
30#include <linux/if_pppol2tp.h>
31
32/* For user-space programs to pick up these definitions
33 * which they wouldn't get otherwise without defining __KERNEL__
34 */
35#ifndef AF_PPPOX
36#define AF_PPPOX 24
37#define PF_PPPOX AF_PPPOX
38#endif /* !(AF_PPPOX) */
39
40/************************************************************************
41 * PPPoE addressing definition
42 */
43typedef __be16 sid_t;
44struct pppoe_addr {
45 sid_t sid; /* Session identifier */
46 unsigned char remote[ETH_ALEN]; /* Remote address */
47 char dev[IFNAMSIZ]; /* Local device to use */
48};
49
50/************************************************************************
51 * PPTP addressing definition
52 */
53struct pptp_addr {
54 __be16 call_id;
55 struct in_addr sin_addr;
56};
57
58/************************************************************************
59 * Protocols supported by AF_PPPOX
60 */
61#define PX_PROTO_OE 0 /* Currently just PPPoE */
62#define PX_PROTO_OL2TP 1 /* Now L2TP also */
63#define PX_PROTO_PPTP 2
64#define PX_MAX_PROTO 3
65
66struct sockaddr_pppox {
67 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
68 unsigned int sa_protocol; /* protocol identifier */
69 union {
70 struct pppoe_addr pppoe;
71 struct pptp_addr pptp;
72 } sa_addr;
73} __packed;
74
75/* The use of the above union isn't viable because the size of this
76 * struct must stay fixed over time -- applications use sizeof(struct
77 * sockaddr_pppox) to fill it. We use a protocol specific sockaddr
78 * type instead.
79 */
80struct sockaddr_pppol2tp {
81 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
82 unsigned int sa_protocol; /* protocol identifier */
83 struct pppol2tp_addr pppol2tp;
84} __packed;
85
86struct sockaddr_pppol2tpin6 {
87 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
88 unsigned int sa_protocol; /* protocol identifier */
89 struct pppol2tpin6_addr pppol2tp;
90} __packed;
91
92/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
93 * bits. So we need a different sockaddr structure.
94 */
95struct sockaddr_pppol2tpv3 {
96 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
97 unsigned int sa_protocol; /* protocol identifier */
98 struct pppol2tpv3_addr pppol2tp;
99} __packed;
100
101struct sockaddr_pppol2tpv3in6 {
102 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
103 unsigned int sa_protocol; /* protocol identifier */
104 struct pppol2tpv3in6_addr pppol2tp;
105} __packed;
106
107/*********************************************************************
108 *
109 * ioctl interface for defining forwarding of connections
110 *
111 ********************************************************************/
112
113#define PPPOEIOCSFWD _IOW(0xB1 ,0, size_t)
114#define PPPOEIOCDFWD _IO(0xB1 ,1)
115/*#define PPPOEIOCGFWD _IOWR(0xB1,2, size_t)*/
116
117/* Codes to identify message types */
118#define PADI_CODE 0x09
119#define PADO_CODE 0x07
120#define PADR_CODE 0x19
121#define PADS_CODE 0x65
122#define PADT_CODE 0xa7
123struct pppoe_tag {
124 __be16 tag_type;
125 __be16 tag_len;
126 char tag_data[0];
127} __attribute__ ((packed));
128
129/* Tag identifiers */
130#define PTT_EOL __cpu_to_be16(0x0000)
131#define PTT_SRV_NAME __cpu_to_be16(0x0101)
132#define PTT_AC_NAME __cpu_to_be16(0x0102)
133#define PTT_HOST_UNIQ __cpu_to_be16(0x0103)
134#define PTT_AC_COOKIE __cpu_to_be16(0x0104)
135#define PTT_VENDOR __cpu_to_be16(0x0105)
136#define PTT_RELAY_SID __cpu_to_be16(0x0110)
137#define PTT_SRV_ERR __cpu_to_be16(0x0201)
138#define PTT_SYS_ERR __cpu_to_be16(0x0202)
139#define PTT_GEN_ERR __cpu_to_be16(0x0203)
140
141struct pppoe_hdr {
142#if defined(__LITTLE_ENDIAN_BITFIELD)
143 __u8 ver : 4;
144 __u8 type : 4;
145#elif defined(__BIG_ENDIAN_BITFIELD)
146 __u8 type : 4;
147 __u8 ver : 4;
148#else
149#error "Please fix <asm/byteorder.h>"
150#endif
151 __u8 code;
152 __be16 sid;
153 __be16 length;
154 struct pppoe_tag tag[0];
155} __packed;
156
157/* Length of entire PPPoE + PPP header */
158#define PPPOE_SES_HLEN 8
159
160#ifdef __KERNEL__
161#include <linux/skbuff.h> 21#include <linux/skbuff.h>
22#include <uapi/linux/if_pppox.h>
162 23
163static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb) 24static inline struct pppoe_hdr *pppoe_hdr(const struct sk_buff *skb)
164{ 25{
@@ -232,6 +93,4 @@ enum {
232 PPPOX_DEAD = 16 /* dead, useless, please clean me up!*/ 93 PPPOX_DEAD = 16 /* dead, useless, please clean me up!*/
233}; 94};
234 95
235#endif /* __KERNEL__ */
236
237#endif /* !(__LINUX_IF_PPPOX_H) */ 96#endif /* !(__LINUX_IF_PPPOX_H) */
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 6d88a7f57680..0245def2aa93 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -7,14 +7,13 @@
7 * the Free Software Foundation; either version 2 of the License, or 7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version. 8 * (at your option) any later version.
9 */ 9 */
10
11#ifndef _LINUX_IF_TEAM_H_ 10#ifndef _LINUX_IF_TEAM_H_
12#define _LINUX_IF_TEAM_H_ 11#define _LINUX_IF_TEAM_H_
13 12
14#ifdef __KERNEL__
15 13
16#include <linux/netpoll.h> 14#include <linux/netpoll.h>
17#include <net/sch_generic.h> 15#include <net/sch_generic.h>
16#include <uapi/linux/if_team.h>
18 17
19struct team_pcpu_stats { 18struct team_pcpu_stats {
20 u64 rx_packets; 19 u64 rx_packets;
@@ -251,98 +250,4 @@ extern void team_mode_unregister(const struct team_mode *mode);
251#define TEAM_DEFAULT_NUM_TX_QUEUES 16 250#define TEAM_DEFAULT_NUM_TX_QUEUES 16
252#define TEAM_DEFAULT_NUM_RX_QUEUES 16 251#define TEAM_DEFAULT_NUM_RX_QUEUES 16
253 252
254#endif /* __KERNEL__ */
255
256#define TEAM_STRING_MAX_LEN 32
257
258/**********************************
259 * NETLINK_GENERIC netlink family.
260 **********************************/
261
262enum {
263 TEAM_CMD_NOOP,
264 TEAM_CMD_OPTIONS_SET,
265 TEAM_CMD_OPTIONS_GET,
266 TEAM_CMD_PORT_LIST_GET,
267
268 __TEAM_CMD_MAX,
269 TEAM_CMD_MAX = (__TEAM_CMD_MAX - 1),
270};
271
272enum {
273 TEAM_ATTR_UNSPEC,
274 TEAM_ATTR_TEAM_IFINDEX, /* u32 */
275 TEAM_ATTR_LIST_OPTION, /* nest */
276 TEAM_ATTR_LIST_PORT, /* nest */
277
278 __TEAM_ATTR_MAX,
279 TEAM_ATTR_MAX = __TEAM_ATTR_MAX - 1,
280};
281
282/* Nested layout of get/set msg:
283 *
284 * [TEAM_ATTR_LIST_OPTION]
285 * [TEAM_ATTR_ITEM_OPTION]
286 * [TEAM_ATTR_OPTION_*], ...
287 * [TEAM_ATTR_ITEM_OPTION]
288 * [TEAM_ATTR_OPTION_*], ...
289 * ...
290 * [TEAM_ATTR_LIST_PORT]
291 * [TEAM_ATTR_ITEM_PORT]
292 * [TEAM_ATTR_PORT_*], ...
293 * [TEAM_ATTR_ITEM_PORT]
294 * [TEAM_ATTR_PORT_*], ...
295 * ...
296 */
297
298enum {
299 TEAM_ATTR_ITEM_OPTION_UNSPEC,
300 TEAM_ATTR_ITEM_OPTION, /* nest */
301
302 __TEAM_ATTR_ITEM_OPTION_MAX,
303 TEAM_ATTR_ITEM_OPTION_MAX = __TEAM_ATTR_ITEM_OPTION_MAX - 1,
304};
305
306enum {
307 TEAM_ATTR_OPTION_UNSPEC,
308 TEAM_ATTR_OPTION_NAME, /* string */
309 TEAM_ATTR_OPTION_CHANGED, /* flag */
310 TEAM_ATTR_OPTION_TYPE, /* u8 */
311 TEAM_ATTR_OPTION_DATA, /* dynamic */
312 TEAM_ATTR_OPTION_REMOVED, /* flag */
313 TEAM_ATTR_OPTION_PORT_IFINDEX, /* u32 */ /* for per-port options */
314 TEAM_ATTR_OPTION_ARRAY_INDEX, /* u32 */ /* for array options */
315
316 __TEAM_ATTR_OPTION_MAX,
317 TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1,
318};
319
320enum {
321 TEAM_ATTR_ITEM_PORT_UNSPEC,
322 TEAM_ATTR_ITEM_PORT, /* nest */
323
324 __TEAM_ATTR_ITEM_PORT_MAX,
325 TEAM_ATTR_ITEM_PORT_MAX = __TEAM_ATTR_ITEM_PORT_MAX - 1,
326};
327
328enum {
329 TEAM_ATTR_PORT_UNSPEC,
330 TEAM_ATTR_PORT_IFINDEX, /* u32 */
331 TEAM_ATTR_PORT_CHANGED, /* flag */
332 TEAM_ATTR_PORT_LINKUP, /* flag */
333 TEAM_ATTR_PORT_SPEED, /* u32 */
334 TEAM_ATTR_PORT_DUPLEX, /* u8 */
335 TEAM_ATTR_PORT_REMOVED, /* flag */
336
337 __TEAM_ATTR_PORT_MAX,
338 TEAM_ATTR_PORT_MAX = __TEAM_ATTR_PORT_MAX - 1,
339};
340
341/*
342 * NETLINK_GENERIC related info
343 */
344#define TEAM_GENL_NAME "team"
345#define TEAM_GENL_VERSION 0x1
346#define TEAM_GENL_CHANGE_EVENT_MC_GRP_NAME "change_event"
347
348#endif /* _LINUX_IF_TEAM_H_ */ 253#endif /* _LINUX_IF_TEAM_H_ */
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 06b1829731fd..ed6da2e6df90 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -12,86 +12,11 @@
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 */ 14 */
15
16#ifndef __IF_TUN_H 15#ifndef __IF_TUN_H
17#define __IF_TUN_H 16#define __IF_TUN_H
18 17
19#include <linux/types.h> 18#include <uapi/linux/if_tun.h>
20#include <linux/if_ether.h>
21#include <linux/filter.h>
22
23/* Read queue size */
24#define TUN_READQ_SIZE 500
25
26/* TUN device flags */
27#define TUN_TUN_DEV 0x0001
28#define TUN_TAP_DEV 0x0002
29#define TUN_TYPE_MASK 0x000f
30
31#define TUN_FASYNC 0x0010
32#define TUN_NOCHECKSUM 0x0020
33#define TUN_NO_PI 0x0040
34#define TUN_ONE_QUEUE 0x0080
35#define TUN_PERSIST 0x0100
36#define TUN_VNET_HDR 0x0200
37
38/* Ioctl defines */
39#define TUNSETNOCSUM _IOW('T', 200, int)
40#define TUNSETDEBUG _IOW('T', 201, int)
41#define TUNSETIFF _IOW('T', 202, int)
42#define TUNSETPERSIST _IOW('T', 203, int)
43#define TUNSETOWNER _IOW('T', 204, int)
44#define TUNSETLINK _IOW('T', 205, int)
45#define TUNSETGROUP _IOW('T', 206, int)
46#define TUNGETFEATURES _IOR('T', 207, unsigned int)
47#define TUNSETOFFLOAD _IOW('T', 208, unsigned int)
48#define TUNSETTXFILTER _IOW('T', 209, unsigned int)
49#define TUNGETIFF _IOR('T', 210, unsigned int)
50#define TUNGETSNDBUF _IOR('T', 211, int)
51#define TUNSETSNDBUF _IOW('T', 212, int)
52#define TUNATTACHFILTER _IOW('T', 213, struct sock_fprog)
53#define TUNDETACHFILTER _IOW('T', 214, struct sock_fprog)
54#define TUNGETVNETHDRSZ _IOR('T', 215, int)
55#define TUNSETVNETHDRSZ _IOW('T', 216, int)
56
57/* TUNSETIFF ifr flags */
58#define IFF_TUN 0x0001
59#define IFF_TAP 0x0002
60#define IFF_NO_PI 0x1000
61#define IFF_ONE_QUEUE 0x2000
62#define IFF_VNET_HDR 0x4000
63#define IFF_TUN_EXCL 0x8000
64
65/* Features for GSO (TUNSETOFFLOAD). */
66#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */
67#define TUN_F_TSO4 0x02 /* I can handle TSO for IPv4 packets */
68#define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */
69#define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */
70#define TUN_F_UFO 0x10 /* I can handle UFO packets */
71
72/* Protocol info prepended to the packets (when IFF_NO_PI is not set) */
73#define TUN_PKT_STRIP 0x0001
74struct tun_pi {
75 __u16 flags;
76 __be16 proto;
77};
78
79/*
80 * Filter spec (used for SETXXFILTER ioctls)
81 * This stuff is applicable only to the TAP (Ethernet) devices.
82 * If the count is zero the filter is disabled and the driver accepts
83 * all packets (promisc mode).
84 * If the filter is enabled in order to accept broadcast packets
85 * broadcast addr must be explicitly included in the addr list.
86 */
87#define TUN_FLT_ALLMULTI 0x0001 /* Accept all multicast packets */
88struct tun_filter {
89 __u16 flags; /* TUN_FLT_ flags see above */
90 __u16 count; /* Number of addresses */
91 __u8 addr[0][ETH_ALEN];
92};
93 19
94#ifdef __KERNEL__
95#if defined(CONFIG_TUN) || defined(CONFIG_TUN_MODULE) 20#if defined(CONFIG_TUN) || defined(CONFIG_TUN_MODULE)
96struct socket *tun_get_socket(struct file *); 21struct socket *tun_get_socket(struct file *);
97#else 22#else
@@ -104,5 +29,4 @@ static inline struct socket *tun_get_socket(struct file *f)
104 return ERR_PTR(-EINVAL); 29 return ERR_PTR(-EINVAL);
105} 30}
106#endif /* CONFIG_TUN */ 31#endif /* CONFIG_TUN */
107#endif /* __KERNEL__ */
108#endif /* __IF_TUN_H */ 32#endif /* __IF_TUN_H */
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 8c5035ac3142..1cc595a67cc9 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -1,100 +1,8 @@
1#ifndef _IF_TUNNEL_H_ 1#ifndef _IF_TUNNEL_H_
2#define _IF_TUNNEL_H_ 2#define _IF_TUNNEL_H_
3 3
4#include <linux/types.h>
5#include <asm/byteorder.h>
6
7#ifdef __KERNEL__
8#include <linux/ip.h> 4#include <linux/ip.h>
9#include <linux/in6.h> 5#include <linux/in6.h>
10#endif 6#include <uapi/linux/if_tunnel.h>
11
12#define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0)
13#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1)
14#define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2)
15#define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3)
16#define SIOCGETPRL (SIOCDEVPRIVATE + 4)
17#define SIOCADDPRL (SIOCDEVPRIVATE + 5)
18#define SIOCDELPRL (SIOCDEVPRIVATE + 6)
19#define SIOCCHGPRL (SIOCDEVPRIVATE + 7)
20#define SIOCGET6RD (SIOCDEVPRIVATE + 8)
21#define SIOCADD6RD (SIOCDEVPRIVATE + 9)
22#define SIOCDEL6RD (SIOCDEVPRIVATE + 10)
23#define SIOCCHG6RD (SIOCDEVPRIVATE + 11)
24
25#define GRE_CSUM __cpu_to_be16(0x8000)
26#define GRE_ROUTING __cpu_to_be16(0x4000)
27#define GRE_KEY __cpu_to_be16(0x2000)
28#define GRE_SEQ __cpu_to_be16(0x1000)
29#define GRE_STRICT __cpu_to_be16(0x0800)
30#define GRE_REC __cpu_to_be16(0x0700)
31#define GRE_FLAGS __cpu_to_be16(0x00F8)
32#define GRE_VERSION __cpu_to_be16(0x0007)
33
34struct ip_tunnel_parm {
35 char name[IFNAMSIZ];
36 int link;
37 __be16 i_flags;
38 __be16 o_flags;
39 __be32 i_key;
40 __be32 o_key;
41 struct iphdr iph;
42};
43
44/* SIT-mode i_flags */
45#define SIT_ISATAP 0x0001
46
47struct ip_tunnel_prl {
48 __be32 addr;
49 __u16 flags;
50 __u16 __reserved;
51 __u32 datalen;
52 __u32 __reserved2;
53 /* data follows */
54};
55
56/* PRL flags */
57#define PRL_DEFAULT 0x0001
58
59struct ip_tunnel_6rd {
60 struct in6_addr prefix;
61 __be32 relay_prefix;
62 __u16 prefixlen;
63 __u16 relay_prefixlen;
64};
65
66enum {
67 IFLA_GRE_UNSPEC,
68 IFLA_GRE_LINK,
69 IFLA_GRE_IFLAGS,
70 IFLA_GRE_OFLAGS,
71 IFLA_GRE_IKEY,
72 IFLA_GRE_OKEY,
73 IFLA_GRE_LOCAL,
74 IFLA_GRE_REMOTE,
75 IFLA_GRE_TTL,
76 IFLA_GRE_TOS,
77 IFLA_GRE_PMTUDISC,
78 IFLA_GRE_ENCAP_LIMIT,
79 IFLA_GRE_FLOWINFO,
80 IFLA_GRE_FLAGS,
81 __IFLA_GRE_MAX,
82};
83
84#define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1)
85
86/* VTI-mode i_flags */
87#define VTI_ISVTI 0x0001
88
89enum {
90 IFLA_VTI_UNSPEC,
91 IFLA_VTI_LINK,
92 IFLA_VTI_IKEY,
93 IFLA_VTI_OKEY,
94 IFLA_VTI_LOCAL,
95 IFLA_VTI_REMOTE,
96 __IFLA_VTI_MAX,
97};
98 7
99#define IFLA_VTI_MAX (__IFLA_VTI_MAX - 1)
100#endif /* _IF_TUNNEL_H_ */ 8#endif /* _IF_TUNNEL_H_ */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index e6ff12dd717b..d06cc5c8f58c 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -9,15 +9,14 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 * 10 *
11 */ 11 */
12
13#ifndef _LINUX_IF_VLAN_H_ 12#ifndef _LINUX_IF_VLAN_H_
14#define _LINUX_IF_VLAN_H_ 13#define _LINUX_IF_VLAN_H_
15 14
16#ifdef __KERNEL__
17#include <linux/netdevice.h> 15#include <linux/netdevice.h>
18#include <linux/etherdevice.h> 16#include <linux/etherdevice.h>
19#include <linux/rtnetlink.h> 17#include <linux/rtnetlink.h>
20#include <linux/bug.h> 18#include <linux/bug.h>
19#include <uapi/linux/if_vlan.h>
21 20
22#define VLAN_HLEN 4 /* The additional bytes required by VLAN 21#define VLAN_HLEN 4 /* The additional bytes required by VLAN
23 * (in addition to the Ethernet header) 22 * (in addition to the Ethernet header)
@@ -80,6 +79,8 @@ static inline int is_vlan_dev(struct net_device *dev)
80} 79}
81 80
82#define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT) 81#define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT)
82#define vlan_tx_nonzero_tag_present(__skb) \
83 (vlan_tx_tag_present(__skb) && ((__skb)->vlan_tci & VLAN_VID_MASK))
83#define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT) 84#define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT)
84 85
85#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 86#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
@@ -89,7 +90,7 @@ extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev,
89extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); 90extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
90extern u16 vlan_dev_vlan_id(const struct net_device *dev); 91extern u16 vlan_dev_vlan_id(const struct net_device *dev);
91 92
92extern bool vlan_do_receive(struct sk_buff **skb, bool last_handler); 93extern bool vlan_do_receive(struct sk_buff **skb);
93extern struct sk_buff *vlan_untag(struct sk_buff *skb); 94extern struct sk_buff *vlan_untag(struct sk_buff *skb);
94 95
95extern int vlan_vid_add(struct net_device *dev, unsigned short vid); 96extern int vlan_vid_add(struct net_device *dev, unsigned short vid);
@@ -120,10 +121,8 @@ static inline u16 vlan_dev_vlan_id(const struct net_device *dev)
120 return 0; 121 return 0;
121} 122}
122 123
123static inline bool vlan_do_receive(struct sk_buff **skb, bool last_handler) 124static inline bool vlan_do_receive(struct sk_buff **skb)
124{ 125{
125 if (((*skb)->vlan_tci & VLAN_VID_MASK) && last_handler)
126 (*skb)->pkt_type = PACKET_OTHERHOST;
127 return false; 126 return false;
128} 127}
129 128
@@ -361,52 +360,4 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb,
361 */ 360 */
362 skb->protocol = htons(ETH_P_802_2); 361 skb->protocol = htons(ETH_P_802_2);
363} 362}
364#endif /* __KERNEL__ */
365
366/* VLAN IOCTLs are found in sockios.h */
367
368/* Passed in vlan_ioctl_args structure to determine behaviour. */
369enum vlan_ioctl_cmds {
370 ADD_VLAN_CMD,
371 DEL_VLAN_CMD,
372 SET_VLAN_INGRESS_PRIORITY_CMD,
373 SET_VLAN_EGRESS_PRIORITY_CMD,
374 GET_VLAN_INGRESS_PRIORITY_CMD,
375 GET_VLAN_EGRESS_PRIORITY_CMD,
376 SET_VLAN_NAME_TYPE_CMD,
377 SET_VLAN_FLAG_CMD,
378 GET_VLAN_REALDEV_NAME_CMD, /* If this works, you know it's a VLAN device, btw */
379 GET_VLAN_VID_CMD /* Get the VID of this VLAN (specified by name) */
380};
381
382enum vlan_flags {
383 VLAN_FLAG_REORDER_HDR = 0x1,
384 VLAN_FLAG_GVRP = 0x2,
385 VLAN_FLAG_LOOSE_BINDING = 0x4,
386};
387
388enum vlan_name_types {
389 VLAN_NAME_TYPE_PLUS_VID, /* Name will look like: vlan0005 */
390 VLAN_NAME_TYPE_RAW_PLUS_VID, /* name will look like: eth1.0005 */
391 VLAN_NAME_TYPE_PLUS_VID_NO_PAD, /* Name will look like: vlan5 */
392 VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD, /* Name will look like: eth0.5 */
393 VLAN_NAME_TYPE_HIGHEST
394};
395
396struct vlan_ioctl_args {
397 int cmd; /* Should be one of the vlan_ioctl_cmds enum above. */
398 char device1[24];
399
400 union {
401 char device2[24];
402 int VID;
403 unsigned int skb_priority;
404 unsigned int name_type;
405 unsigned int bind_type;
406 unsigned int flag; /* Matches vlan_dev_priv flags */
407 } u;
408
409 short vlan_qos;
410};
411
412#endif /* !(_LINUX_IF_VLAN_H_) */ 363#endif /* !(_LINUX_IF_VLAN_H_) */
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index 82de336b8155..7f2bf1518480 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -12,123 +12,13 @@
12 * as published by the Free Software Foundation; either version 12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version. 13 * 2 of the License, or (at your option) any later version.
14 */ 14 */
15
16#ifndef _LINUX_IGMP_H 15#ifndef _LINUX_IGMP_H
17#define _LINUX_IGMP_H 16#define _LINUX_IGMP_H
18 17
19#include <linux/types.h>
20#include <asm/byteorder.h>
21
22/*
23 * IGMP protocol structures
24 */
25
26/*
27 * Header in on cable format
28 */
29
30struct igmphdr {
31 __u8 type;
32 __u8 code; /* For newer IGMP */
33 __sum16 csum;
34 __be32 group;
35};
36
37/* V3 group record types [grec_type] */
38#define IGMPV3_MODE_IS_INCLUDE 1
39#define IGMPV3_MODE_IS_EXCLUDE 2
40#define IGMPV3_CHANGE_TO_INCLUDE 3
41#define IGMPV3_CHANGE_TO_EXCLUDE 4
42#define IGMPV3_ALLOW_NEW_SOURCES 5
43#define IGMPV3_BLOCK_OLD_SOURCES 6
44
45struct igmpv3_grec {
46 __u8 grec_type;
47 __u8 grec_auxwords;
48 __be16 grec_nsrcs;
49 __be32 grec_mca;
50 __be32 grec_src[0];
51};
52
53struct igmpv3_report {
54 __u8 type;
55 __u8 resv1;
56 __be16 csum;
57 __be16 resv2;
58 __be16 ngrec;
59 struct igmpv3_grec grec[0];
60};
61
62struct igmpv3_query {
63 __u8 type;
64 __u8 code;
65 __be16 csum;
66 __be32 group;
67#if defined(__LITTLE_ENDIAN_BITFIELD)
68 __u8 qrv:3,
69 suppress:1,
70 resv:4;
71#elif defined(__BIG_ENDIAN_BITFIELD)
72 __u8 resv:4,
73 suppress:1,
74 qrv:3;
75#else
76#error "Please fix <asm/byteorder.h>"
77#endif
78 __u8 qqic;
79 __be16 nsrcs;
80 __be32 srcs[0];
81};
82
83#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */
84#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */
85#define IGMP_DVMRP 0x13 /* DVMRP routing */
86#define IGMP_PIM 0x14 /* PIM routing */
87#define IGMP_TRACE 0x15
88#define IGMPV2_HOST_MEMBERSHIP_REPORT 0x16 /* V2 version of 0x12 */
89#define IGMP_HOST_LEAVE_MESSAGE 0x17
90#define IGMPV3_HOST_MEMBERSHIP_REPORT 0x22 /* V3 version of 0x12 */
91
92#define IGMP_MTRACE_RESP 0x1e
93#define IGMP_MTRACE 0x1f
94
95
96/*
97 * Use the BSD names for these for compatibility
98 */
99
100#define IGMP_DELAYING_MEMBER 0x01
101#define IGMP_IDLE_MEMBER 0x02
102#define IGMP_LAZY_MEMBER 0x03
103#define IGMP_SLEEPING_MEMBER 0x04
104#define IGMP_AWAKENING_MEMBER 0x05
105
106#define IGMP_MINLEN 8
107
108#define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */
109 /* query (in seconds) */
110
111#define IGMP_TIMER_SCALE 10 /* denotes that the igmphdr->timer field */
112 /* specifies time in 10th of seconds */
113
114#define IGMP_AGE_THRESHOLD 400 /* If this host don't hear any IGMP V1 */
115 /* message in this period of time, */
116 /* revert to IGMP v2 router. */
117
118#define IGMP_ALL_HOSTS htonl(0xE0000001L)
119#define IGMP_ALL_ROUTER htonl(0xE0000002L)
120#define IGMPV3_ALL_MCR htonl(0xE0000016L)
121#define IGMP_LOCAL_GROUP htonl(0xE0000000L)
122#define IGMP_LOCAL_GROUP_MASK htonl(0xFFFFFF00L)
123
124/*
125 * struct for keeping the multicast list in
126 */
127
128#ifdef __KERNEL__
129#include <linux/skbuff.h> 18#include <linux/skbuff.h>
130#include <linux/timer.h> 19#include <linux/timer.h>
131#include <linux/in.h> 20#include <linux/in.h>
21#include <uapi/linux/igmp.h>
132 22
133static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb) 23static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb)
134{ 24{
@@ -241,4 +131,3 @@ extern void ip_mc_inc_group(struct in_device *in_dev, __be32 addr);
241extern void ip_mc_rejoin_groups(struct in_device *in_dev); 131extern void ip_mc_rejoin_groups(struct in_device *in_dev);
242 132
243#endif 133#endif
244#endif
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index c0ae76ac4e0b..7806c24e5bc8 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -618,4 +618,20 @@ static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
618}; 618};
619#endif 619#endif
620 620
621/**
622 * IIO_DEGREE_TO_RAD() - Convert degree to rad
623 * @deg: A value in degree
624 *
625 * Returns the given value converted from degree to rad
626 */
627#define IIO_DEGREE_TO_RAD(deg) (((deg) * 314159ULL + 9000000ULL) / 18000000ULL)
628
629/**
630 * IIO_G_TO_M_S_2() - Convert g to meter / second**2
631 * @g: A value in g
632 *
633 * Returns the given value converted from g to meter / second**2
634 */
635#define IIO_G_TO_M_S_2(g) ((g) * 980665ULL / 100000ULL)
636
621#endif /* _INDUSTRIAL_IO_H_ */ 637#endif /* _INDUSTRIAL_IO_H_ */
diff --git a/include/linux/in.h b/include/linux/in.h
index e0337f11d92e..31b493734763 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -18,240 +18,9 @@
18#ifndef _LINUX_IN_H 18#ifndef _LINUX_IN_H
19#define _LINUX_IN_H 19#define _LINUX_IN_H
20 20
21#include <linux/types.h>
22#include <linux/socket.h>
23
24/* Standard well-defined IP protocols. */
25enum {
26 IPPROTO_IP = 0, /* Dummy protocol for TCP */
27 IPPROTO_ICMP = 1, /* Internet Control Message Protocol */
28 IPPROTO_IGMP = 2, /* Internet Group Management Protocol */
29 IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94) */
30 IPPROTO_TCP = 6, /* Transmission Control Protocol */
31 IPPROTO_EGP = 8, /* Exterior Gateway Protocol */
32 IPPROTO_PUP = 12, /* PUP protocol */
33 IPPROTO_UDP = 17, /* User Datagram Protocol */
34 IPPROTO_IDP = 22, /* XNS IDP protocol */
35 IPPROTO_DCCP = 33, /* Datagram Congestion Control Protocol */
36 IPPROTO_RSVP = 46, /* RSVP protocol */
37 IPPROTO_GRE = 47, /* Cisco GRE tunnels (rfc 1701,1702) */
38
39 IPPROTO_IPV6 = 41, /* IPv6-in-IPv4 tunnelling */
40
41 IPPROTO_ESP = 50, /* Encapsulation Security Payload protocol */
42 IPPROTO_AH = 51, /* Authentication Header protocol */
43 IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET */
44 IPPROTO_PIM = 103, /* Protocol Independent Multicast */
45
46 IPPROTO_COMP = 108, /* Compression Header protocol */
47 IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */
48 IPPROTO_UDPLITE = 136, /* UDP-Lite (RFC 3828) */
49
50 IPPROTO_RAW = 255, /* Raw IP packets */
51 IPPROTO_MAX
52};
53
54
55/* Internet address. */
56struct in_addr {
57 __be32 s_addr;
58};
59
60#define IP_TOS 1
61#define IP_TTL 2
62#define IP_HDRINCL 3
63#define IP_OPTIONS 4
64#define IP_ROUTER_ALERT 5
65#define IP_RECVOPTS 6
66#define IP_RETOPTS 7
67#define IP_PKTINFO 8
68#define IP_PKTOPTIONS 9
69#define IP_MTU_DISCOVER 10
70#define IP_RECVERR 11
71#define IP_RECVTTL 12
72#define IP_RECVTOS 13
73#define IP_MTU 14
74#define IP_FREEBIND 15
75#define IP_IPSEC_POLICY 16
76#define IP_XFRM_POLICY 17
77#define IP_PASSSEC 18
78#define IP_TRANSPARENT 19
79
80/* BSD compatibility */
81#define IP_RECVRETOPTS IP_RETOPTS
82
83/* TProxy original addresses */
84#define IP_ORIGDSTADDR 20
85#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
86
87#define IP_MINTTL 21
88#define IP_NODEFRAG 22
89
90/* IP_MTU_DISCOVER values */
91#define IP_PMTUDISC_DONT 0 /* Never send DF frames */
92#define IP_PMTUDISC_WANT 1 /* Use per route hints */
93#define IP_PMTUDISC_DO 2 /* Always DF */
94#define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu */
95
96#define IP_MULTICAST_IF 32
97#define IP_MULTICAST_TTL 33
98#define IP_MULTICAST_LOOP 34
99#define IP_ADD_MEMBERSHIP 35
100#define IP_DROP_MEMBERSHIP 36
101#define IP_UNBLOCK_SOURCE 37
102#define IP_BLOCK_SOURCE 38
103#define IP_ADD_SOURCE_MEMBERSHIP 39
104#define IP_DROP_SOURCE_MEMBERSHIP 40
105#define IP_MSFILTER 41
106#define MCAST_JOIN_GROUP 42
107#define MCAST_BLOCK_SOURCE 43
108#define MCAST_UNBLOCK_SOURCE 44
109#define MCAST_LEAVE_GROUP 45
110#define MCAST_JOIN_SOURCE_GROUP 46
111#define MCAST_LEAVE_SOURCE_GROUP 47
112#define MCAST_MSFILTER 48
113#define IP_MULTICAST_ALL 49
114#define IP_UNICAST_IF 50
115
116#define MCAST_EXCLUDE 0
117#define MCAST_INCLUDE 1
118
119/* These need to appear somewhere around here */
120#define IP_DEFAULT_MULTICAST_TTL 1
121#define IP_DEFAULT_MULTICAST_LOOP 1
122
123/* Request struct for multicast socket ops */
124
125struct ip_mreq {
126 struct in_addr imr_multiaddr; /* IP multicast address of group */
127 struct in_addr imr_interface; /* local IP address of interface */
128};
129
130struct ip_mreqn {
131 struct in_addr imr_multiaddr; /* IP multicast address of group */
132 struct in_addr imr_address; /* local IP address of interface */
133 int imr_ifindex; /* Interface index */
134};
135
136struct ip_mreq_source {
137 __be32 imr_multiaddr;
138 __be32 imr_interface;
139 __be32 imr_sourceaddr;
140};
141
142struct ip_msfilter {
143 __be32 imsf_multiaddr;
144 __be32 imsf_interface;
145 __u32 imsf_fmode;
146 __u32 imsf_numsrc;
147 __be32 imsf_slist[1];
148};
149
150#define IP_MSFILTER_SIZE(numsrc) \
151 (sizeof(struct ip_msfilter) - sizeof(__u32) \
152 + (numsrc) * sizeof(__u32))
153
154struct group_req {
155 __u32 gr_interface; /* interface index */
156 struct __kernel_sockaddr_storage gr_group; /* group address */
157};
158
159struct group_source_req {
160 __u32 gsr_interface; /* interface index */
161 struct __kernel_sockaddr_storage gsr_group; /* group address */
162 struct __kernel_sockaddr_storage gsr_source; /* source address */
163};
164
165struct group_filter {
166 __u32 gf_interface; /* interface index */
167 struct __kernel_sockaddr_storage gf_group; /* multicast address */
168 __u32 gf_fmode; /* filter mode */
169 __u32 gf_numsrc; /* number of sources */
170 struct __kernel_sockaddr_storage gf_slist[1]; /* interface index */
171};
172
173#define GROUP_FILTER_SIZE(numsrc) \
174 (sizeof(struct group_filter) - sizeof(struct __kernel_sockaddr_storage) \
175 + (numsrc) * sizeof(struct __kernel_sockaddr_storage))
176
177struct in_pktinfo {
178 int ipi_ifindex;
179 struct in_addr ipi_spec_dst;
180 struct in_addr ipi_addr;
181};
182
183/* Structure describing an Internet (IP) socket address. */
184#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */
185struct sockaddr_in {
186 __kernel_sa_family_t sin_family; /* Address family */
187 __be16 sin_port; /* Port number */
188 struct in_addr sin_addr; /* Internet address */
189
190 /* Pad to size of `struct sockaddr'. */
191 unsigned char __pad[__SOCK_SIZE__ - sizeof(short int) -
192 sizeof(unsigned short int) - sizeof(struct in_addr)];
193};
194#define sin_zero __pad /* for BSD UNIX comp. -FvK */
195
196
197/*
198 * Definitions of the bits in an Internet address integer.
199 * On subnets, host and network parts are found according
200 * to the subnet mask, not these masks.
201 */
202#define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0)
203#define IN_CLASSA_NET 0xff000000
204#define IN_CLASSA_NSHIFT 24
205#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET)
206#define IN_CLASSA_MAX 128
207
208#define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000)
209#define IN_CLASSB_NET 0xffff0000
210#define IN_CLASSB_NSHIFT 16
211#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET)
212#define IN_CLASSB_MAX 65536
213
214#define IN_CLASSC(a) ((((long int) (a)) & 0xe0000000) == 0xc0000000)
215#define IN_CLASSC_NET 0xffffff00
216#define IN_CLASSC_NSHIFT 8
217#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET)
218
219#define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000)
220#define IN_MULTICAST(a) IN_CLASSD(a)
221#define IN_MULTICAST_NET 0xF0000000
222
223#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000)
224#define IN_BADCLASS(a) IN_EXPERIMENTAL((a))
225
226/* Address to accept any incoming messages. */
227#define INADDR_ANY ((unsigned long int) 0x00000000)
228
229/* Address to send to all hosts. */
230#define INADDR_BROADCAST ((unsigned long int) 0xffffffff)
231
232/* Address indicating an error return. */
233#define INADDR_NONE ((unsigned long int) 0xffffffff)
234
235/* Network number for local host loopback. */
236#define IN_LOOPBACKNET 127
237
238/* Address to loopback in software to local host. */
239#define INADDR_LOOPBACK 0x7f000001 /* 127.0.0.1 */
240#define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000)
241
242/* Defines for Multicast INADDR */
243#define INADDR_UNSPEC_GROUP 0xe0000000U /* 224.0.0.0 */
244#define INADDR_ALLHOSTS_GROUP 0xe0000001U /* 224.0.0.1 */
245#define INADDR_ALLRTRS_GROUP 0xe0000002U /* 224.0.0.2 */
246#define INADDR_MAX_LOCAL_GROUP 0xe00000ffU /* 224.0.0.255 */
247
248
249/* <asm/byteorder.h> contains the htonl type stuff.. */
250#include <asm/byteorder.h>
251
252#ifdef __KERNEL__
253 21
254#include <linux/errno.h> 22#include <linux/errno.h>
23#include <uapi/linux/in.h>
255 24
256static inline int proto_ports_offset(int proto) 25static inline int proto_ports_offset(int proto)
257{ 26{
@@ -332,6 +101,4 @@ static inline bool ipv4_is_test_198(__be32 addr)
332{ 101{
333 return (addr & htonl(0xfffe0000)) == htonl(0xc6120000); 102 return (addr & htonl(0xfffe0000)) == htonl(0xc6120000);
334} 103}
335#endif
336
337#endif /* _LINUX_IN_H */ 104#endif /* _LINUX_IN_H */
diff --git a/include/linux/in6.h b/include/linux/in6.h
index cba469ba11a4..9e2ae26fb598 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -17,32 +17,11 @@
17 * as published by the Free Software Foundation; either version 17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version. 18 * 2 of the License, or (at your option) any later version.
19 */ 19 */
20
21#ifndef _LINUX_IN6_H 20#ifndef _LINUX_IN6_H
22#define _LINUX_IN6_H 21#define _LINUX_IN6_H
23 22
24#include <linux/types.h> 23#include <uapi/linux/in6.h>
25
26/*
27 * IPv6 address structure
28 */
29
30struct in6_addr {
31 union {
32 __u8 u6_addr8[16];
33 __be16 u6_addr16[8];
34 __be32 u6_addr32[4];
35 } in6_u;
36#define s6_addr in6_u.u6_addr8
37#define s6_addr16 in6_u.u6_addr16
38#define s6_addr32 in6_u.u6_addr32
39};
40 24
41/* IPv6 Wildcard Address (::) and Loopback Address (::1) defined in RFC2553
42 * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined
43 * in network byte order, not in host byte order as are the IPv4 equivalents
44 */
45#ifdef __KERNEL__
46extern const struct in6_addr in6addr_any; 25extern const struct in6_addr in6addr_any;
47#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } 26#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
48extern const struct in6_addr in6addr_loopback; 27extern const struct in6_addr in6addr_loopback;
@@ -54,238 +33,3 @@ extern const struct in6_addr in6addr_linklocal_allrouters;
54#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \ 33#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
55 { { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2 } } } 34 { { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2 } } }
56#endif 35#endif
57
58struct sockaddr_in6 {
59 unsigned short int sin6_family; /* AF_INET6 */
60 __be16 sin6_port; /* Transport layer port # */
61 __be32 sin6_flowinfo; /* IPv6 flow information */
62 struct in6_addr sin6_addr; /* IPv6 address */
63 __u32 sin6_scope_id; /* scope id (new in RFC2553) */
64};
65
66struct ipv6_mreq {
67 /* IPv6 multicast address of group */
68 struct in6_addr ipv6mr_multiaddr;
69
70 /* local IPv6 address of interface */
71 int ipv6mr_ifindex;
72};
73
74#define ipv6mr_acaddr ipv6mr_multiaddr
75
76struct in6_flowlabel_req {
77 struct in6_addr flr_dst;
78 __be32 flr_label;
79 __u8 flr_action;
80 __u8 flr_share;
81 __u16 flr_flags;
82 __u16 flr_expires;
83 __u16 flr_linger;
84 __u32 __flr_pad;
85 /* Options in format of IPV6_PKTOPTIONS */
86};
87
88#define IPV6_FL_A_GET 0
89#define IPV6_FL_A_PUT 1
90#define IPV6_FL_A_RENEW 2
91
92#define IPV6_FL_F_CREATE 1
93#define IPV6_FL_F_EXCL 2
94
95#define IPV6_FL_S_NONE 0
96#define IPV6_FL_S_EXCL 1
97#define IPV6_FL_S_PROCESS 2
98#define IPV6_FL_S_USER 3
99#define IPV6_FL_S_ANY 255
100
101
102/*
103 * Bitmask constant declarations to help applications select out the
104 * flow label and priority fields.
105 *
106 * Note that this are in host byte order while the flowinfo field of
107 * sockaddr_in6 is in network byte order.
108 */
109
110#define IPV6_FLOWINFO_FLOWLABEL 0x000fffff
111#define IPV6_FLOWINFO_PRIORITY 0x0ff00000
112
113/* These definitions are obsolete */
114#define IPV6_PRIORITY_UNCHARACTERIZED 0x0000
115#define IPV6_PRIORITY_FILLER 0x0100
116#define IPV6_PRIORITY_UNATTENDED 0x0200
117#define IPV6_PRIORITY_RESERVED1 0x0300
118#define IPV6_PRIORITY_BULK 0x0400
119#define IPV6_PRIORITY_RESERVED2 0x0500
120#define IPV6_PRIORITY_INTERACTIVE 0x0600
121#define IPV6_PRIORITY_CONTROL 0x0700
122#define IPV6_PRIORITY_8 0x0800
123#define IPV6_PRIORITY_9 0x0900
124#define IPV6_PRIORITY_10 0x0a00
125#define IPV6_PRIORITY_11 0x0b00
126#define IPV6_PRIORITY_12 0x0c00
127#define IPV6_PRIORITY_13 0x0d00
128#define IPV6_PRIORITY_14 0x0e00
129#define IPV6_PRIORITY_15 0x0f00
130
131/*
132 * IPV6 extension headers
133 */
134#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */
135#define IPPROTO_ROUTING 43 /* IPv6 routing header */
136#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */
137#define IPPROTO_ICMPV6 58 /* ICMPv6 */
138#define IPPROTO_NONE 59 /* IPv6 no next header */
139#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */
140#define IPPROTO_MH 135 /* IPv6 mobility header */
141
142/*
143 * IPv6 TLV options.
144 */
145#define IPV6_TLV_PAD1 0
146#define IPV6_TLV_PADN 1
147#define IPV6_TLV_ROUTERALERT 5
148#define IPV6_TLV_JUMBO 194
149#define IPV6_TLV_HAO 201 /* home address option */
150
151/*
152 * IPV6 socket options
153 */
154
155#define IPV6_ADDRFORM 1
156#define IPV6_2292PKTINFO 2
157#define IPV6_2292HOPOPTS 3
158#define IPV6_2292DSTOPTS 4
159#define IPV6_2292RTHDR 5
160#define IPV6_2292PKTOPTIONS 6
161#define IPV6_CHECKSUM 7
162#define IPV6_2292HOPLIMIT 8
163#define IPV6_NEXTHOP 9
164#define IPV6_AUTHHDR 10 /* obsolete */
165#define IPV6_FLOWINFO 11
166
167#define IPV6_UNICAST_HOPS 16
168#define IPV6_MULTICAST_IF 17
169#define IPV6_MULTICAST_HOPS 18
170#define IPV6_MULTICAST_LOOP 19
171#define IPV6_ADD_MEMBERSHIP 20
172#define IPV6_DROP_MEMBERSHIP 21
173#define IPV6_ROUTER_ALERT 22
174#define IPV6_MTU_DISCOVER 23
175#define IPV6_MTU 24
176#define IPV6_RECVERR 25
177#define IPV6_V6ONLY 26
178#define IPV6_JOIN_ANYCAST 27
179#define IPV6_LEAVE_ANYCAST 28
180
181/* IPV6_MTU_DISCOVER values */
182#define IPV6_PMTUDISC_DONT 0
183#define IPV6_PMTUDISC_WANT 1
184#define IPV6_PMTUDISC_DO 2
185#define IPV6_PMTUDISC_PROBE 3
186
187/* Flowlabel */
188#define IPV6_FLOWLABEL_MGR 32
189#define IPV6_FLOWINFO_SEND 33
190
191#define IPV6_IPSEC_POLICY 34
192#define IPV6_XFRM_POLICY 35
193
194/*
195 * Multicast:
196 * Following socket options are shared between IPv4 and IPv6.
197 *
198 * MCAST_JOIN_GROUP 42
199 * MCAST_BLOCK_SOURCE 43
200 * MCAST_UNBLOCK_SOURCE 44
201 * MCAST_LEAVE_GROUP 45
202 * MCAST_JOIN_SOURCE_GROUP 46
203 * MCAST_LEAVE_SOURCE_GROUP 47
204 * MCAST_MSFILTER 48
205 */
206
207/*
208 * Advanced API (RFC3542) (1)
209 *
210 * Note: IPV6_RECVRTHDRDSTOPTS does not exist. see net/ipv6/datagram.c.
211 */
212
213#define IPV6_RECVPKTINFO 49
214#define IPV6_PKTINFO 50
215#define IPV6_RECVHOPLIMIT 51
216#define IPV6_HOPLIMIT 52
217#define IPV6_RECVHOPOPTS 53
218#define IPV6_HOPOPTS 54
219#define IPV6_RTHDRDSTOPTS 55
220#define IPV6_RECVRTHDR 56
221#define IPV6_RTHDR 57
222#define IPV6_RECVDSTOPTS 58
223#define IPV6_DSTOPTS 59
224#define IPV6_RECVPATHMTU 60
225#define IPV6_PATHMTU 61
226#define IPV6_DONTFRAG 62
227#if 0 /* not yet */
228#define IPV6_USE_MIN_MTU 63
229#endif
230
231/*
232 * Netfilter (1)
233 *
234 * Following socket options are used in ip6_tables;
235 * see include/linux/netfilter_ipv6/ip6_tables.h.
236 *
237 * IP6T_SO_SET_REPLACE / IP6T_SO_GET_INFO 64
238 * IP6T_SO_SET_ADD_COUNTERS / IP6T_SO_GET_ENTRIES 65
239 */
240
241/*
242 * Advanced API (RFC3542) (2)
243 */
244#define IPV6_RECVTCLASS 66
245#define IPV6_TCLASS 67
246
247/*
248 * Netfilter (2)
249 *
250 * Following socket options are used in ip6_tables;
251 * see include/linux/netfilter_ipv6/ip6_tables.h.
252 *
253 * IP6T_SO_GET_REVISION_MATCH 68
254 * IP6T_SO_GET_REVISION_TARGET 69
255 */
256
257/* RFC5014: Source address selection */
258#define IPV6_ADDR_PREFERENCES 72
259
260#define IPV6_PREFER_SRC_TMP 0x0001
261#define IPV6_PREFER_SRC_PUBLIC 0x0002
262#define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100
263#define IPV6_PREFER_SRC_COA 0x0004
264#define IPV6_PREFER_SRC_HOME 0x0400
265#define IPV6_PREFER_SRC_CGA 0x0008
266#define IPV6_PREFER_SRC_NONCGA 0x0800
267
268/* RFC5082: Generalized Ttl Security Mechanism */
269#define IPV6_MINHOPCOUNT 73
270
271#define IPV6_ORIGDSTADDR 74
272#define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR
273#define IPV6_TRANSPARENT 75
274#define IPV6_UNICAST_IF 76
275
276/*
277 * Multicast Routing:
278 * see include/linux/mroute6.h.
279 *
280 * MRT6_INIT 200
281 * MRT6_DONE 201
282 * MRT6_ADD_MIF 202
283 * MRT6_DEL_MIF 203
284 * MRT6_ADD_MFC 204
285 * MRT6_DEL_MFC 205
286 * MRT6_VERSION 206
287 * MRT6_ASSERT 207
288 * MRT6_PIM 208
289 * (reserved) 209
290 */
291#endif
diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h
index e788c186ed3a..46da02410a09 100644
--- a/include/linux/inet_diag.h
+++ b/include/linux/inet_diag.h
@@ -1,138 +1,8 @@
1#ifndef _INET_DIAG_H_ 1#ifndef _INET_DIAG_H_
2#define _INET_DIAG_H_ 1 2#define _INET_DIAG_H_ 1
3 3
4#include <linux/types.h> 4#include <uapi/linux/inet_diag.h>
5 5
6/* Just some random number */
7#define TCPDIAG_GETSOCK 18
8#define DCCPDIAG_GETSOCK 19
9
10#define INET_DIAG_GETSOCK_MAX 24
11
12/* Socket identity */
13struct inet_diag_sockid {
14 __be16 idiag_sport;
15 __be16 idiag_dport;
16 __be32 idiag_src[4];
17 __be32 idiag_dst[4];
18 __u32 idiag_if;
19 __u32 idiag_cookie[2];
20#define INET_DIAG_NOCOOKIE (~0U)
21};
22
23/* Request structure */
24
25struct inet_diag_req {
26 __u8 idiag_family; /* Family of addresses. */
27 __u8 idiag_src_len;
28 __u8 idiag_dst_len;
29 __u8 idiag_ext; /* Query extended information */
30
31 struct inet_diag_sockid id;
32
33 __u32 idiag_states; /* States to dump */
34 __u32 idiag_dbs; /* Tables to dump (NI) */
35};
36
37struct inet_diag_req_v2 {
38 __u8 sdiag_family;
39 __u8 sdiag_protocol;
40 __u8 idiag_ext;
41 __u8 pad;
42 __u32 idiag_states;
43 struct inet_diag_sockid id;
44};
45
46enum {
47 INET_DIAG_REQ_NONE,
48 INET_DIAG_REQ_BYTECODE,
49};
50
51#define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE
52
53/* Bytecode is sequence of 4 byte commands followed by variable arguments.
54 * All the commands identified by "code" are conditional jumps forward:
55 * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be
56 * length of the command and its arguments.
57 */
58
59struct inet_diag_bc_op {
60 unsigned char code;
61 unsigned char yes;
62 unsigned short no;
63};
64
65enum {
66 INET_DIAG_BC_NOP,
67 INET_DIAG_BC_JMP,
68 INET_DIAG_BC_S_GE,
69 INET_DIAG_BC_S_LE,
70 INET_DIAG_BC_D_GE,
71 INET_DIAG_BC_D_LE,
72 INET_DIAG_BC_AUTO,
73 INET_DIAG_BC_S_COND,
74 INET_DIAG_BC_D_COND,
75};
76
77struct inet_diag_hostcond {
78 __u8 family;
79 __u8 prefix_len;
80 int port;
81 __be32 addr[0];
82};
83
84/* Base info structure. It contains socket identity (addrs/ports/cookie)
85 * and, alas, the information shown by netstat. */
86struct inet_diag_msg {
87 __u8 idiag_family;
88 __u8 idiag_state;
89 __u8 idiag_timer;
90 __u8 idiag_retrans;
91
92 struct inet_diag_sockid id;
93
94 __u32 idiag_expires;
95 __u32 idiag_rqueue;
96 __u32 idiag_wqueue;
97 __u32 idiag_uid;
98 __u32 idiag_inode;
99};
100
101/* Extensions */
102
103enum {
104 INET_DIAG_NONE,
105 INET_DIAG_MEMINFO,
106 INET_DIAG_INFO,
107 INET_DIAG_VEGASINFO,
108 INET_DIAG_CONG,
109 INET_DIAG_TOS,
110 INET_DIAG_TCLASS,
111 INET_DIAG_SKMEMINFO,
112};
113
114#define INET_DIAG_MAX INET_DIAG_SKMEMINFO
115
116
117/* INET_DIAG_MEM */
118
119struct inet_diag_meminfo {
120 __u32 idiag_rmem;
121 __u32 idiag_wmem;
122 __u32 idiag_fmem;
123 __u32 idiag_tmem;
124};
125
126/* INET_DIAG_VEGASINFO */
127
128struct tcpvegas_info {
129 __u32 tcpv_enabled;
130 __u32 tcpv_rttcnt;
131 __u32 tcpv_rtt;
132 __u32 tcpv_minrtt;
133};
134
135#ifdef __KERNEL__
136struct sock; 6struct sock;
137struct inet_hashinfo; 7struct inet_hashinfo;
138struct nlattr; 8struct nlattr;
@@ -173,6 +43,4 @@ int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk);
173 43
174extern int inet_diag_register(const struct inet_diag_handler *handler); 44extern int inet_diag_register(const struct inet_diag_handler *handler);
175extern void inet_diag_unregister(const struct inet_diag_handler *handler); 45extern void inet_diag_unregister(const struct inet_diag_handler *handler);
176#endif /* __KERNEL__ */
177
178#endif /* _INET_DIAG_H_ */ 46#endif /* _INET_DIAG_H_ */
diff --git a/include/linux/init.h b/include/linux/init.h
index 5e664f671615..e59041e21df3 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -43,11 +43,22 @@
43 discard it in modules) */ 43 discard it in modules) */
44#define __init __section(.init.text) __cold notrace 44#define __init __section(.init.text) __cold notrace
45#define __initdata __section(.init.data) 45#define __initdata __section(.init.data)
46#define __initconst __section(.init.rodata) 46#define __initconst __constsection(.init.rodata)
47#define __exitdata __section(.exit.data) 47#define __exitdata __section(.exit.data)
48#define __exit_call __used __section(.exitcall.exit) 48#define __exit_call __used __section(.exitcall.exit)
49 49
50/* 50/*
51 * Some architecture have tool chains which do not handle rodata attributes
52 * correctly. For those disable special sections for const, so that other
53 * architectures can annotate correctly.
54 */
55#ifdef CONFIG_BROKEN_RODATA
56#define __constsection(x)
57#else
58#define __constsection(x) __section(x)
59#endif
60
61/*
51 * modpost check for section mismatches during the kernel build. 62 * modpost check for section mismatches during the kernel build.
52 * A section mismatch happens when there are references from a 63 * A section mismatch happens when there are references from a
53 * code or data section to an init section (both code or data). 64 * code or data section to an init section (both code or data).
@@ -66,7 +77,7 @@
66 */ 77 */
67#define __ref __section(.ref.text) noinline 78#define __ref __section(.ref.text) noinline
68#define __refdata __section(.ref.data) 79#define __refdata __section(.ref.data)
69#define __refconst __section(.ref.rodata) 80#define __refconst __constsection(.ref.rodata)
70 81
71/* compatibility defines */ 82/* compatibility defines */
72#define __init_refok __ref 83#define __init_refok __ref
@@ -85,26 +96,26 @@
85/* Used for HOTPLUG */ 96/* Used for HOTPLUG */
86#define __devinit __section(.devinit.text) __cold notrace 97#define __devinit __section(.devinit.text) __cold notrace
87#define __devinitdata __section(.devinit.data) 98#define __devinitdata __section(.devinit.data)
88#define __devinitconst __section(.devinit.rodata) 99#define __devinitconst __constsection(.devinit.rodata)
89#define __devexit __section(.devexit.text) __exitused __cold notrace 100#define __devexit __section(.devexit.text) __exitused __cold notrace
90#define __devexitdata __section(.devexit.data) 101#define __devexitdata __section(.devexit.data)
91#define __devexitconst __section(.devexit.rodata) 102#define __devexitconst __constsection(.devexit.rodata)
92 103
93/* Used for HOTPLUG_CPU */ 104/* Used for HOTPLUG_CPU */
94#define __cpuinit __section(.cpuinit.text) __cold notrace 105#define __cpuinit __section(.cpuinit.text) __cold notrace
95#define __cpuinitdata __section(.cpuinit.data) 106#define __cpuinitdata __section(.cpuinit.data)
96#define __cpuinitconst __section(.cpuinit.rodata) 107#define __cpuinitconst __constsection(.cpuinit.rodata)
97#define __cpuexit __section(.cpuexit.text) __exitused __cold notrace 108#define __cpuexit __section(.cpuexit.text) __exitused __cold notrace
98#define __cpuexitdata __section(.cpuexit.data) 109#define __cpuexitdata __section(.cpuexit.data)
99#define __cpuexitconst __section(.cpuexit.rodata) 110#define __cpuexitconst __constsection(.cpuexit.rodata)
100 111
101/* Used for MEMORY_HOTPLUG */ 112/* Used for MEMORY_HOTPLUG */
102#define __meminit __section(.meminit.text) __cold notrace 113#define __meminit __section(.meminit.text) __cold notrace
103#define __meminitdata __section(.meminit.data) 114#define __meminitdata __section(.meminit.data)
104#define __meminitconst __section(.meminit.rodata) 115#define __meminitconst __constsection(.meminit.rodata)
105#define __memexit __section(.memexit.text) __exitused __cold notrace 116#define __memexit __section(.memexit.text) __exitused __cold notrace
106#define __memexitdata __section(.memexit.data) 117#define __memexitdata __section(.memexit.data)
107#define __memexitconst __section(.memexit.rodata) 118#define __memexitconst __constsection(.memexit.rodata)
108 119
109/* For assembly routines */ 120/* For assembly routines */
110#define __HEAD .section ".head.text","ax" 121#define __HEAD .section ".head.text","ax"
diff --git a/include/linux/inotify.h b/include/linux/inotify.h
index d33041e2a42a..23aede0b5843 100644
--- a/include/linux/inotify.h
+++ b/include/linux/inotify.h
@@ -3,75 +3,12 @@
3 * 3 *
4 * Copyright (C) 2005 John McCutchan 4 * Copyright (C) 2005 John McCutchan
5 */ 5 */
6
7#ifndef _LINUX_INOTIFY_H 6#ifndef _LINUX_INOTIFY_H
8#define _LINUX_INOTIFY_H 7#define _LINUX_INOTIFY_H
9 8
10/* For O_CLOEXEC and O_NONBLOCK */
11#include <linux/fcntl.h>
12#include <linux/types.h>
13
14/*
15 * struct inotify_event - structure read from the inotify device for each event
16 *
17 * When you are watching a directory, you will receive the filename for events
18 * such as IN_CREATE, IN_DELETE, IN_OPEN, IN_CLOSE, ..., relative to the wd.
19 */
20struct inotify_event {
21 __s32 wd; /* watch descriptor */
22 __u32 mask; /* watch mask */
23 __u32 cookie; /* cookie to synchronize two events */
24 __u32 len; /* length (including nulls) of name */
25 char name[0]; /* stub for possible name */
26};
27
28/* the following are legal, implemented events that user-space can watch for */
29#define IN_ACCESS 0x00000001 /* File was accessed */
30#define IN_MODIFY 0x00000002 /* File was modified */
31#define IN_ATTRIB 0x00000004 /* Metadata changed */
32#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed */
33#define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed */
34#define IN_OPEN 0x00000020 /* File was opened */
35#define IN_MOVED_FROM 0x00000040 /* File was moved from X */
36#define IN_MOVED_TO 0x00000080 /* File was moved to Y */
37#define IN_CREATE 0x00000100 /* Subfile was created */
38#define IN_DELETE 0x00000200 /* Subfile was deleted */
39#define IN_DELETE_SELF 0x00000400 /* Self was deleted */
40#define IN_MOVE_SELF 0x00000800 /* Self was moved */
41
42/* the following are legal events. they are sent as needed to any watch */
43#define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted */
44#define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */
45#define IN_IGNORED 0x00008000 /* File was ignored */
46
47/* helper events */
48#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* close */
49#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */
50
51/* special flags */
52#define IN_ONLYDIR 0x01000000 /* only watch the path if it is a directory */
53#define IN_DONT_FOLLOW 0x02000000 /* don't follow a sym link */
54#define IN_EXCL_UNLINK 0x04000000 /* exclude events on unlinked objects */
55#define IN_MASK_ADD 0x20000000 /* add to the mask of an already existing watch */
56#define IN_ISDIR 0x40000000 /* event occurred against dir */
57#define IN_ONESHOT 0x80000000 /* only send event once */
58
59/*
60 * All of the events - we build the list by hand so that we can add flags in
61 * the future and not break backward compatibility. Apps will get only the
62 * events that they originally wanted. Be sure to add new events here!
63 */
64#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
65 IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \
66 IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \
67 IN_MOVE_SELF)
68
69/* Flags for sys_inotify_init1. */
70#define IN_CLOEXEC O_CLOEXEC
71#define IN_NONBLOCK O_NONBLOCK
72
73#ifdef __KERNEL__
74#include <linux/sysctl.h> 9#include <linux/sysctl.h>
10#include <uapi/linux/inotify.h>
11
75extern struct ctl_table inotify_table[]; /* for sysctl */ 12extern struct ctl_table inotify_table[]; /* for sysctl */
76 13
77#define ALL_INOTIFY_BITS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \ 14#define ALL_INOTIFY_BITS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
@@ -82,6 +19,4 @@ extern struct ctl_table inotify_table[]; /* for sysctl */
82 IN_DONT_FOLLOW | IN_EXCL_UNLINK | IN_MASK_ADD | \ 19 IN_DONT_FOLLOW | IN_EXCL_UNLINK | IN_MASK_ADD | \
83 IN_ISDIR | IN_ONESHOT) 20 IN_ISDIR | IN_ONESHOT)
84 21
85#endif
86
87#endif /* _LINUX_INOTIFY_H */ 22#endif /* _LINUX_INOTIFY_H */
diff --git a/include/linux/input.h b/include/linux/input.h
index ba4874302939..cab994ba6d91 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -1,6 +1,3 @@
1#ifndef _INPUT_H
2#define _INPUT_H
3
4/* 1/*
5 * Copyright (c) 1999-2002 Vojtech Pavlik 2 * Copyright (c) 1999-2002 Vojtech Pavlik
6 * 3 *
@@ -8,1156 +5,15 @@
8 * under the terms of the GNU General Public License version 2 as published by 5 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation. 6 * the Free Software Foundation.
10 */ 7 */
8#ifndef _INPUT_H
9#define _INPUT_H
11 10
12#ifdef __KERNEL__
13#include <linux/time.h> 11#include <linux/time.h>
14#include <linux/list.h> 12#include <linux/list.h>
15#else 13#include <uapi/linux/input.h>
16#include <sys/time.h>
17#include <sys/ioctl.h>
18#include <sys/types.h>
19#include <linux/types.h>
20#endif
21
22/*
23 * The event structure itself
24 */
25
26struct input_event {
27 struct timeval time;
28 __u16 type;
29 __u16 code;
30 __s32 value;
31};
32
33/*
34 * Protocol version.
35 */
36
37#define EV_VERSION 0x010001
38
39/*
40 * IOCTLs (0x00 - 0x7f)
41 */
42
43struct input_id {
44 __u16 bustype;
45 __u16 vendor;
46 __u16 product;
47 __u16 version;
48};
49
50/**
51 * struct input_absinfo - used by EVIOCGABS/EVIOCSABS ioctls
52 * @value: latest reported value for the axis.
53 * @minimum: specifies minimum value for the axis.
54 * @maximum: specifies maximum value for the axis.
55 * @fuzz: specifies fuzz value that is used to filter noise from
56 * the event stream.
57 * @flat: values that are within this value will be discarded by
58 * joydev interface and reported as 0 instead.
59 * @resolution: specifies resolution for the values reported for
60 * the axis.
61 *
62 * Note that input core does not clamp reported values to the
63 * [minimum, maximum] limits, such task is left to userspace.
64 *
65 * Resolution for main axes (ABS_X, ABS_Y, ABS_Z) is reported in
66 * units per millimeter (units/mm), resolution for rotational axes
67 * (ABS_RX, ABS_RY, ABS_RZ) is reported in units per radian.
68 */
69struct input_absinfo {
70 __s32 value;
71 __s32 minimum;
72 __s32 maximum;
73 __s32 fuzz;
74 __s32 flat;
75 __s32 resolution;
76};
77
78/**
79 * struct input_keymap_entry - used by EVIOCGKEYCODE/EVIOCSKEYCODE ioctls
80 * @scancode: scancode represented in machine-endian form.
81 * @len: length of the scancode that resides in @scancode buffer.
82 * @index: index in the keymap, may be used instead of scancode
83 * @flags: allows to specify how kernel should handle the request. For
84 * example, setting INPUT_KEYMAP_BY_INDEX flag indicates that kernel
85 * should perform lookup in keymap by @index instead of @scancode
86 * @keycode: key code assigned to this scancode
87 *
88 * The structure is used to retrieve and modify keymap data. Users have
89 * option of performing lookup either by @scancode itself or by @index
90 * in keymap entry. EVIOCGKEYCODE will also return scancode or index
91 * (depending on which element was used to perform lookup).
92 */
93struct input_keymap_entry {
94#define INPUT_KEYMAP_BY_INDEX (1 << 0)
95 __u8 flags;
96 __u8 len;
97 __u16 index;
98 __u32 keycode;
99 __u8 scancode[32];
100};
101
102#define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */
103#define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */
104#define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */
105#define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */
106
107#define EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2]) /* get keycode */
108#define EVIOCGKEYCODE_V2 _IOR('E', 0x04, struct input_keymap_entry)
109#define EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2]) /* set keycode */
110#define EVIOCSKEYCODE_V2 _IOW('E', 0x04, struct input_keymap_entry)
111
112#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */
113#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */
114#define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */
115#define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len) /* get device properties */
116
117/**
118 * EVIOCGMTSLOTS(len) - get MT slot values
119 * @len: size of the data buffer in bytes
120 *
121 * The ioctl buffer argument should be binary equivalent to
122 *
123 * struct input_mt_request_layout {
124 * __u32 code;
125 * __s32 values[num_slots];
126 * };
127 *
128 * where num_slots is the (arbitrary) number of MT slots to extract.
129 *
130 * The ioctl size argument (len) is the size of the buffer, which
131 * should satisfy len = (num_slots + 1) * sizeof(__s32). If len is
132 * too small to fit all available slots, the first num_slots are
133 * returned.
134 *
135 * Before the call, code is set to the wanted ABS_MT event type. On
136 * return, values[] is filled with the slot values for the specified
137 * ABS_MT code.
138 *
139 * If the request code is not an ABS_MT value, -EINVAL is returned.
140 */
141#define EVIOCGMTSLOTS(len) _IOC(_IOC_READ, 'E', 0x0a, len)
142
143#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */
144#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */
145#define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */
146#define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len) /* get all switch states */
147
148#define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + (ev), len) /* get event bits */
149#define EVIOCGABS(abs) _IOR('E', 0x40 + (abs), struct input_absinfo) /* get abs value/limits */
150#define EVIOCSABS(abs) _IOW('E', 0xc0 + (abs), struct input_absinfo) /* set abs value/limits */
151
152#define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect)) /* send a force effect to a force feedback device */
153#define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */
154#define EVIOCGEFFECTS _IOR('E', 0x84, int) /* Report number of effects playable at the same time */
155
156#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */
157
158#define EVIOCSCLOCKID _IOW('E', 0xa0, int) /* Set clockid to be used for timestamps */
159
160/*
161 * Device properties and quirks
162 */
163
164#define INPUT_PROP_POINTER 0x00 /* needs a pointer */
165#define INPUT_PROP_DIRECT 0x01 /* direct input devices */
166#define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */
167#define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */
168
169#define INPUT_PROP_MAX 0x1f
170#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
171
172/*
173 * Event types
174 */
175
176#define EV_SYN 0x00
177#define EV_KEY 0x01
178#define EV_REL 0x02
179#define EV_ABS 0x03
180#define EV_MSC 0x04
181#define EV_SW 0x05
182#define EV_LED 0x11
183#define EV_SND 0x12
184#define EV_REP 0x14
185#define EV_FF 0x15
186#define EV_PWR 0x16
187#define EV_FF_STATUS 0x17
188#define EV_MAX 0x1f
189#define EV_CNT (EV_MAX+1)
190
191/*
192 * Synchronization events.
193 */
194
195#define SYN_REPORT 0
196#define SYN_CONFIG 1
197#define SYN_MT_REPORT 2
198#define SYN_DROPPED 3
199
200/*
201 * Keys and buttons
202 *
203 * Most of the keys/buttons are modeled after USB HUT 1.12
204 * (see http://www.usb.org/developers/hidpage).
205 * Abbreviations in the comments:
206 * AC - Application Control
207 * AL - Application Launch Button
208 * SC - System Control
209 */
210
211#define KEY_RESERVED 0
212#define KEY_ESC 1
213#define KEY_1 2
214#define KEY_2 3
215#define KEY_3 4
216#define KEY_4 5
217#define KEY_5 6
218#define KEY_6 7
219#define KEY_7 8
220#define KEY_8 9
221#define KEY_9 10
222#define KEY_0 11
223#define KEY_MINUS 12
224#define KEY_EQUAL 13
225#define KEY_BACKSPACE 14
226#define KEY_TAB 15
227#define KEY_Q 16
228#define KEY_W 17
229#define KEY_E 18
230#define KEY_R 19
231#define KEY_T 20
232#define KEY_Y 21
233#define KEY_U 22
234#define KEY_I 23
235#define KEY_O 24
236#define KEY_P 25
237#define KEY_LEFTBRACE 26
238#define KEY_RIGHTBRACE 27
239#define KEY_ENTER 28
240#define KEY_LEFTCTRL 29
241#define KEY_A 30
242#define KEY_S 31
243#define KEY_D 32
244#define KEY_F 33
245#define KEY_G 34
246#define KEY_H 35
247#define KEY_J 36
248#define KEY_K 37
249#define KEY_L 38
250#define KEY_SEMICOLON 39
251#define KEY_APOSTROPHE 40
252#define KEY_GRAVE 41
253#define KEY_LEFTSHIFT 42
254#define KEY_BACKSLASH 43
255#define KEY_Z 44
256#define KEY_X 45
257#define KEY_C 46
258#define KEY_V 47
259#define KEY_B 48
260#define KEY_N 49
261#define KEY_M 50
262#define KEY_COMMA 51
263#define KEY_DOT 52
264#define KEY_SLASH 53
265#define KEY_RIGHTSHIFT 54
266#define KEY_KPASTERISK 55
267#define KEY_LEFTALT 56
268#define KEY_SPACE 57
269#define KEY_CAPSLOCK 58
270#define KEY_F1 59
271#define KEY_F2 60
272#define KEY_F3 61
273#define KEY_F4 62
274#define KEY_F5 63
275#define KEY_F6 64
276#define KEY_F7 65
277#define KEY_F8 66
278#define KEY_F9 67
279#define KEY_F10 68
280#define KEY_NUMLOCK 69
281#define KEY_SCROLLLOCK 70
282#define KEY_KP7 71
283#define KEY_KP8 72
284#define KEY_KP9 73
285#define KEY_KPMINUS 74
286#define KEY_KP4 75
287#define KEY_KP5 76
288#define KEY_KP6 77
289#define KEY_KPPLUS 78
290#define KEY_KP1 79
291#define KEY_KP2 80
292#define KEY_KP3 81
293#define KEY_KP0 82
294#define KEY_KPDOT 83
295
296#define KEY_ZENKAKUHANKAKU 85
297#define KEY_102ND 86
298#define KEY_F11 87
299#define KEY_F12 88
300#define KEY_RO 89
301#define KEY_KATAKANA 90
302#define KEY_HIRAGANA 91
303#define KEY_HENKAN 92
304#define KEY_KATAKANAHIRAGANA 93
305#define KEY_MUHENKAN 94
306#define KEY_KPJPCOMMA 95
307#define KEY_KPENTER 96
308#define KEY_RIGHTCTRL 97
309#define KEY_KPSLASH 98
310#define KEY_SYSRQ 99
311#define KEY_RIGHTALT 100
312#define KEY_LINEFEED 101
313#define KEY_HOME 102
314#define KEY_UP 103
315#define KEY_PAGEUP 104
316#define KEY_LEFT 105
317#define KEY_RIGHT 106
318#define KEY_END 107
319#define KEY_DOWN 108
320#define KEY_PAGEDOWN 109
321#define KEY_INSERT 110
322#define KEY_DELETE 111
323#define KEY_MACRO 112
324#define KEY_MUTE 113
325#define KEY_VOLUMEDOWN 114
326#define KEY_VOLUMEUP 115
327#define KEY_POWER 116 /* SC System Power Down */
328#define KEY_KPEQUAL 117
329#define KEY_KPPLUSMINUS 118
330#define KEY_PAUSE 119
331#define KEY_SCALE 120 /* AL Compiz Scale (Expose) */
332
333#define KEY_KPCOMMA 121
334#define KEY_HANGEUL 122
335#define KEY_HANGUEL KEY_HANGEUL
336#define KEY_HANJA 123
337#define KEY_YEN 124
338#define KEY_LEFTMETA 125
339#define KEY_RIGHTMETA 126
340#define KEY_COMPOSE 127
341
342#define KEY_STOP 128 /* AC Stop */
343#define KEY_AGAIN 129
344#define KEY_PROPS 130 /* AC Properties */
345#define KEY_UNDO 131 /* AC Undo */
346#define KEY_FRONT 132
347#define KEY_COPY 133 /* AC Copy */
348#define KEY_OPEN 134 /* AC Open */
349#define KEY_PASTE 135 /* AC Paste */
350#define KEY_FIND 136 /* AC Search */
351#define KEY_CUT 137 /* AC Cut */
352#define KEY_HELP 138 /* AL Integrated Help Center */
353#define KEY_MENU 139 /* Menu (show menu) */
354#define KEY_CALC 140 /* AL Calculator */
355#define KEY_SETUP 141
356#define KEY_SLEEP 142 /* SC System Sleep */
357#define KEY_WAKEUP 143 /* System Wake Up */
358#define KEY_FILE 144 /* AL Local Machine Browser */
359#define KEY_SENDFILE 145
360#define KEY_DELETEFILE 146
361#define KEY_XFER 147
362#define KEY_PROG1 148
363#define KEY_PROG2 149
364#define KEY_WWW 150 /* AL Internet Browser */
365#define KEY_MSDOS 151
366#define KEY_COFFEE 152 /* AL Terminal Lock/Screensaver */
367#define KEY_SCREENLOCK KEY_COFFEE
368#define KEY_DIRECTION 153
369#define KEY_CYCLEWINDOWS 154
370#define KEY_MAIL 155
371#define KEY_BOOKMARKS 156 /* AC Bookmarks */
372#define KEY_COMPUTER 157
373#define KEY_BACK 158 /* AC Back */
374#define KEY_FORWARD 159 /* AC Forward */
375#define KEY_CLOSECD 160
376#define KEY_EJECTCD 161
377#define KEY_EJECTCLOSECD 162
378#define KEY_NEXTSONG 163
379#define KEY_PLAYPAUSE 164
380#define KEY_PREVIOUSSONG 165
381#define KEY_STOPCD 166
382#define KEY_RECORD 167
383#define KEY_REWIND 168
384#define KEY_PHONE 169 /* Media Select Telephone */
385#define KEY_ISO 170
386#define KEY_CONFIG 171 /* AL Consumer Control Configuration */
387#define KEY_HOMEPAGE 172 /* AC Home */
388#define KEY_REFRESH 173 /* AC Refresh */
389#define KEY_EXIT 174 /* AC Exit */
390#define KEY_MOVE 175
391#define KEY_EDIT 176
392#define KEY_SCROLLUP 177
393#define KEY_SCROLLDOWN 178
394#define KEY_KPLEFTPAREN 179
395#define KEY_KPRIGHTPAREN 180
396#define KEY_NEW 181 /* AC New */
397#define KEY_REDO 182 /* AC Redo/Repeat */
398
399#define KEY_F13 183
400#define KEY_F14 184
401#define KEY_F15 185
402#define KEY_F16 186
403#define KEY_F17 187
404#define KEY_F18 188
405#define KEY_F19 189
406#define KEY_F20 190
407#define KEY_F21 191
408#define KEY_F22 192
409#define KEY_F23 193
410#define KEY_F24 194
411
412#define KEY_PLAYCD 200
413#define KEY_PAUSECD 201
414#define KEY_PROG3 202
415#define KEY_PROG4 203
416#define KEY_DASHBOARD 204 /* AL Dashboard */
417#define KEY_SUSPEND 205
418#define KEY_CLOSE 206 /* AC Close */
419#define KEY_PLAY 207
420#define KEY_FASTFORWARD 208
421#define KEY_BASSBOOST 209
422#define KEY_PRINT 210 /* AC Print */
423#define KEY_HP 211
424#define KEY_CAMERA 212
425#define KEY_SOUND 213
426#define KEY_QUESTION 214
427#define KEY_EMAIL 215
428#define KEY_CHAT 216
429#define KEY_SEARCH 217
430#define KEY_CONNECT 218
431#define KEY_FINANCE 219 /* AL Checkbook/Finance */
432#define KEY_SPORT 220
433#define KEY_SHOP 221
434#define KEY_ALTERASE 222
435#define KEY_CANCEL 223 /* AC Cancel */
436#define KEY_BRIGHTNESSDOWN 224
437#define KEY_BRIGHTNESSUP 225
438#define KEY_MEDIA 226
439
440#define KEY_SWITCHVIDEOMODE 227 /* Cycle between available video
441 outputs (Monitor/LCD/TV-out/etc) */
442#define KEY_KBDILLUMTOGGLE 228
443#define KEY_KBDILLUMDOWN 229
444#define KEY_KBDILLUMUP 230
445
446#define KEY_SEND 231 /* AC Send */
447#define KEY_REPLY 232 /* AC Reply */
448#define KEY_FORWARDMAIL 233 /* AC Forward Msg */
449#define KEY_SAVE 234 /* AC Save */
450#define KEY_DOCUMENTS 235
451
452#define KEY_BATTERY 236
453
454#define KEY_BLUETOOTH 237
455#define KEY_WLAN 238
456#define KEY_UWB 239
457
458#define KEY_UNKNOWN 240
459
460#define KEY_VIDEO_NEXT 241 /* drive next video source */
461#define KEY_VIDEO_PREV 242 /* drive previous video source */
462#define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */
463#define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */
464#define KEY_DISPLAY_OFF 245 /* display device to off state */
465
466#define KEY_WIMAX 246
467#define KEY_RFKILL 247 /* Key that controls all radios */
468
469#define KEY_MICMUTE 248 /* Mute / unmute the microphone */
470
471/* Code 255 is reserved for special needs of AT keyboard driver */
472
473#define BTN_MISC 0x100
474#define BTN_0 0x100
475#define BTN_1 0x101
476#define BTN_2 0x102
477#define BTN_3 0x103
478#define BTN_4 0x104
479#define BTN_5 0x105
480#define BTN_6 0x106
481#define BTN_7 0x107
482#define BTN_8 0x108
483#define BTN_9 0x109
484
485#define BTN_MOUSE 0x110
486#define BTN_LEFT 0x110
487#define BTN_RIGHT 0x111
488#define BTN_MIDDLE 0x112
489#define BTN_SIDE 0x113
490#define BTN_EXTRA 0x114
491#define BTN_FORWARD 0x115
492#define BTN_BACK 0x116
493#define BTN_TASK 0x117
494
495#define BTN_JOYSTICK 0x120
496#define BTN_TRIGGER 0x120
497#define BTN_THUMB 0x121
498#define BTN_THUMB2 0x122
499#define BTN_TOP 0x123
500#define BTN_TOP2 0x124
501#define BTN_PINKIE 0x125
502#define BTN_BASE 0x126
503#define BTN_BASE2 0x127
504#define BTN_BASE3 0x128
505#define BTN_BASE4 0x129
506#define BTN_BASE5 0x12a
507#define BTN_BASE6 0x12b
508#define BTN_DEAD 0x12f
509
510#define BTN_GAMEPAD 0x130
511#define BTN_A 0x130
512#define BTN_B 0x131
513#define BTN_C 0x132
514#define BTN_X 0x133
515#define BTN_Y 0x134
516#define BTN_Z 0x135
517#define BTN_TL 0x136
518#define BTN_TR 0x137
519#define BTN_TL2 0x138
520#define BTN_TR2 0x139
521#define BTN_SELECT 0x13a
522#define BTN_START 0x13b
523#define BTN_MODE 0x13c
524#define BTN_THUMBL 0x13d
525#define BTN_THUMBR 0x13e
526
527#define BTN_DIGI 0x140
528#define BTN_TOOL_PEN 0x140
529#define BTN_TOOL_RUBBER 0x141
530#define BTN_TOOL_BRUSH 0x142
531#define BTN_TOOL_PENCIL 0x143
532#define BTN_TOOL_AIRBRUSH 0x144
533#define BTN_TOOL_FINGER 0x145
534#define BTN_TOOL_MOUSE 0x146
535#define BTN_TOOL_LENS 0x147
536#define BTN_TOOL_QUINTTAP 0x148 /* Five fingers on trackpad */
537#define BTN_TOUCH 0x14a
538#define BTN_STYLUS 0x14b
539#define BTN_STYLUS2 0x14c
540#define BTN_TOOL_DOUBLETAP 0x14d
541#define BTN_TOOL_TRIPLETAP 0x14e
542#define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */
543
544#define BTN_WHEEL 0x150
545#define BTN_GEAR_DOWN 0x150
546#define BTN_GEAR_UP 0x151
547
548#define KEY_OK 0x160
549#define KEY_SELECT 0x161
550#define KEY_GOTO 0x162
551#define KEY_CLEAR 0x163
552#define KEY_POWER2 0x164
553#define KEY_OPTION 0x165
554#define KEY_INFO 0x166 /* AL OEM Features/Tips/Tutorial */
555#define KEY_TIME 0x167
556#define KEY_VENDOR 0x168
557#define KEY_ARCHIVE 0x169
558#define KEY_PROGRAM 0x16a /* Media Select Program Guide */
559#define KEY_CHANNEL 0x16b
560#define KEY_FAVORITES 0x16c
561#define KEY_EPG 0x16d
562#define KEY_PVR 0x16e /* Media Select Home */
563#define KEY_MHP 0x16f
564#define KEY_LANGUAGE 0x170
565#define KEY_TITLE 0x171
566#define KEY_SUBTITLE 0x172
567#define KEY_ANGLE 0x173
568#define KEY_ZOOM 0x174
569#define KEY_MODE 0x175
570#define KEY_KEYBOARD 0x176
571#define KEY_SCREEN 0x177
572#define KEY_PC 0x178 /* Media Select Computer */
573#define KEY_TV 0x179 /* Media Select TV */
574#define KEY_TV2 0x17a /* Media Select Cable */
575#define KEY_VCR 0x17b /* Media Select VCR */
576#define KEY_VCR2 0x17c /* VCR Plus */
577#define KEY_SAT 0x17d /* Media Select Satellite */
578#define KEY_SAT2 0x17e
579#define KEY_CD 0x17f /* Media Select CD */
580#define KEY_TAPE 0x180 /* Media Select Tape */
581#define KEY_RADIO 0x181
582#define KEY_TUNER 0x182 /* Media Select Tuner */
583#define KEY_PLAYER 0x183
584#define KEY_TEXT 0x184
585#define KEY_DVD 0x185 /* Media Select DVD */
586#define KEY_AUX 0x186
587#define KEY_MP3 0x187
588#define KEY_AUDIO 0x188 /* AL Audio Browser */
589#define KEY_VIDEO 0x189 /* AL Movie Browser */
590#define KEY_DIRECTORY 0x18a
591#define KEY_LIST 0x18b
592#define KEY_MEMO 0x18c /* Media Select Messages */
593#define KEY_CALENDAR 0x18d
594#define KEY_RED 0x18e
595#define KEY_GREEN 0x18f
596#define KEY_YELLOW 0x190
597#define KEY_BLUE 0x191
598#define KEY_CHANNELUP 0x192 /* Channel Increment */
599#define KEY_CHANNELDOWN 0x193 /* Channel Decrement */
600#define KEY_FIRST 0x194
601#define KEY_LAST 0x195 /* Recall Last */
602#define KEY_AB 0x196
603#define KEY_NEXT 0x197
604#define KEY_RESTART 0x198
605#define KEY_SLOW 0x199
606#define KEY_SHUFFLE 0x19a
607#define KEY_BREAK 0x19b
608#define KEY_PREVIOUS 0x19c
609#define KEY_DIGITS 0x19d
610#define KEY_TEEN 0x19e
611#define KEY_TWEN 0x19f
612#define KEY_VIDEOPHONE 0x1a0 /* Media Select Video Phone */
613#define KEY_GAMES 0x1a1 /* Media Select Games */
614#define KEY_ZOOMIN 0x1a2 /* AC Zoom In */
615#define KEY_ZOOMOUT 0x1a3 /* AC Zoom Out */
616#define KEY_ZOOMRESET 0x1a4 /* AC Zoom */
617#define KEY_WORDPROCESSOR 0x1a5 /* AL Word Processor */
618#define KEY_EDITOR 0x1a6 /* AL Text Editor */
619#define KEY_SPREADSHEET 0x1a7 /* AL Spreadsheet */
620#define KEY_GRAPHICSEDITOR 0x1a8 /* AL Graphics Editor */
621#define KEY_PRESENTATION 0x1a9 /* AL Presentation App */
622#define KEY_DATABASE 0x1aa /* AL Database App */
623#define KEY_NEWS 0x1ab /* AL Newsreader */
624#define KEY_VOICEMAIL 0x1ac /* AL Voicemail */
625#define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */
626#define KEY_MESSENGER 0x1ae /* AL Instant Messaging */
627#define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */
628#define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */
629#define KEY_LOGOFF 0x1b1 /* AL Logoff */
630
631#define KEY_DOLLAR 0x1b2
632#define KEY_EURO 0x1b3
633
634#define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */
635#define KEY_FRAMEFORWARD 0x1b5
636#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */
637#define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */
638#define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */
639#define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */
640#define KEY_IMAGES 0x1ba /* AL Image Browser */
641
642#define KEY_DEL_EOL 0x1c0
643#define KEY_DEL_EOS 0x1c1
644#define KEY_INS_LINE 0x1c2
645#define KEY_DEL_LINE 0x1c3
646
647#define KEY_FN 0x1d0
648#define KEY_FN_ESC 0x1d1
649#define KEY_FN_F1 0x1d2
650#define KEY_FN_F2 0x1d3
651#define KEY_FN_F3 0x1d4
652#define KEY_FN_F4 0x1d5
653#define KEY_FN_F5 0x1d6
654#define KEY_FN_F6 0x1d7
655#define KEY_FN_F7 0x1d8
656#define KEY_FN_F8 0x1d9
657#define KEY_FN_F9 0x1da
658#define KEY_FN_F10 0x1db
659#define KEY_FN_F11 0x1dc
660#define KEY_FN_F12 0x1dd
661#define KEY_FN_1 0x1de
662#define KEY_FN_2 0x1df
663#define KEY_FN_D 0x1e0
664#define KEY_FN_E 0x1e1
665#define KEY_FN_F 0x1e2
666#define KEY_FN_S 0x1e3
667#define KEY_FN_B 0x1e4
668
669#define KEY_BRL_DOT1 0x1f1
670#define KEY_BRL_DOT2 0x1f2
671#define KEY_BRL_DOT3 0x1f3
672#define KEY_BRL_DOT4 0x1f4
673#define KEY_BRL_DOT5 0x1f5
674#define KEY_BRL_DOT6 0x1f6
675#define KEY_BRL_DOT7 0x1f7
676#define KEY_BRL_DOT8 0x1f8
677#define KEY_BRL_DOT9 0x1f9
678#define KEY_BRL_DOT10 0x1fa
679
680#define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */
681#define KEY_NUMERIC_1 0x201 /* and other keypads */
682#define KEY_NUMERIC_2 0x202
683#define KEY_NUMERIC_3 0x203
684#define KEY_NUMERIC_4 0x204
685#define KEY_NUMERIC_5 0x205
686#define KEY_NUMERIC_6 0x206
687#define KEY_NUMERIC_7 0x207
688#define KEY_NUMERIC_8 0x208
689#define KEY_NUMERIC_9 0x209
690#define KEY_NUMERIC_STAR 0x20a
691#define KEY_NUMERIC_POUND 0x20b
692
693#define KEY_CAMERA_FOCUS 0x210
694#define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */
695
696#define KEY_TOUCHPAD_TOGGLE 0x212 /* Request switch touchpad on or off */
697#define KEY_TOUCHPAD_ON 0x213
698#define KEY_TOUCHPAD_OFF 0x214
699
700#define KEY_CAMERA_ZOOMIN 0x215
701#define KEY_CAMERA_ZOOMOUT 0x216
702#define KEY_CAMERA_UP 0x217
703#define KEY_CAMERA_DOWN 0x218
704#define KEY_CAMERA_LEFT 0x219
705#define KEY_CAMERA_RIGHT 0x21a
706
707#define BTN_TRIGGER_HAPPY 0x2c0
708#define BTN_TRIGGER_HAPPY1 0x2c0
709#define BTN_TRIGGER_HAPPY2 0x2c1
710#define BTN_TRIGGER_HAPPY3 0x2c2
711#define BTN_TRIGGER_HAPPY4 0x2c3
712#define BTN_TRIGGER_HAPPY5 0x2c4
713#define BTN_TRIGGER_HAPPY6 0x2c5
714#define BTN_TRIGGER_HAPPY7 0x2c6
715#define BTN_TRIGGER_HAPPY8 0x2c7
716#define BTN_TRIGGER_HAPPY9 0x2c8
717#define BTN_TRIGGER_HAPPY10 0x2c9
718#define BTN_TRIGGER_HAPPY11 0x2ca
719#define BTN_TRIGGER_HAPPY12 0x2cb
720#define BTN_TRIGGER_HAPPY13 0x2cc
721#define BTN_TRIGGER_HAPPY14 0x2cd
722#define BTN_TRIGGER_HAPPY15 0x2ce
723#define BTN_TRIGGER_HAPPY16 0x2cf
724#define BTN_TRIGGER_HAPPY17 0x2d0
725#define BTN_TRIGGER_HAPPY18 0x2d1
726#define BTN_TRIGGER_HAPPY19 0x2d2
727#define BTN_TRIGGER_HAPPY20 0x2d3
728#define BTN_TRIGGER_HAPPY21 0x2d4
729#define BTN_TRIGGER_HAPPY22 0x2d5
730#define BTN_TRIGGER_HAPPY23 0x2d6
731#define BTN_TRIGGER_HAPPY24 0x2d7
732#define BTN_TRIGGER_HAPPY25 0x2d8
733#define BTN_TRIGGER_HAPPY26 0x2d9
734#define BTN_TRIGGER_HAPPY27 0x2da
735#define BTN_TRIGGER_HAPPY28 0x2db
736#define BTN_TRIGGER_HAPPY29 0x2dc
737#define BTN_TRIGGER_HAPPY30 0x2dd
738#define BTN_TRIGGER_HAPPY31 0x2de
739#define BTN_TRIGGER_HAPPY32 0x2df
740#define BTN_TRIGGER_HAPPY33 0x2e0
741#define BTN_TRIGGER_HAPPY34 0x2e1
742#define BTN_TRIGGER_HAPPY35 0x2e2
743#define BTN_TRIGGER_HAPPY36 0x2e3
744#define BTN_TRIGGER_HAPPY37 0x2e4
745#define BTN_TRIGGER_HAPPY38 0x2e5
746#define BTN_TRIGGER_HAPPY39 0x2e6
747#define BTN_TRIGGER_HAPPY40 0x2e7
748
749/* We avoid low common keys in module aliases so they don't get huge. */
750#define KEY_MIN_INTERESTING KEY_MUTE
751#define KEY_MAX 0x2ff
752#define KEY_CNT (KEY_MAX+1)
753
754/*
755 * Relative axes
756 */
757
758#define REL_X 0x00
759#define REL_Y 0x01
760#define REL_Z 0x02
761#define REL_RX 0x03
762#define REL_RY 0x04
763#define REL_RZ 0x05
764#define REL_HWHEEL 0x06
765#define REL_DIAL 0x07
766#define REL_WHEEL 0x08
767#define REL_MISC 0x09
768#define REL_MAX 0x0f
769#define REL_CNT (REL_MAX+1)
770
771/*
772 * Absolute axes
773 */
774
775#define ABS_X 0x00
776#define ABS_Y 0x01
777#define ABS_Z 0x02
778#define ABS_RX 0x03
779#define ABS_RY 0x04
780#define ABS_RZ 0x05
781#define ABS_THROTTLE 0x06
782#define ABS_RUDDER 0x07
783#define ABS_WHEEL 0x08
784#define ABS_GAS 0x09
785#define ABS_BRAKE 0x0a
786#define ABS_HAT0X 0x10
787#define ABS_HAT0Y 0x11
788#define ABS_HAT1X 0x12
789#define ABS_HAT1Y 0x13
790#define ABS_HAT2X 0x14
791#define ABS_HAT2Y 0x15
792#define ABS_HAT3X 0x16
793#define ABS_HAT3Y 0x17
794#define ABS_PRESSURE 0x18
795#define ABS_DISTANCE 0x19
796#define ABS_TILT_X 0x1a
797#define ABS_TILT_Y 0x1b
798#define ABS_TOOL_WIDTH 0x1c
799
800#define ABS_VOLUME 0x20
801
802#define ABS_MISC 0x28
803
804#define ABS_MT_SLOT 0x2f /* MT slot being modified */
805#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */
806#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */
807#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */
808#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */
809#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */
810#define ABS_MT_POSITION_X 0x35 /* Center X touch position */
811#define ABS_MT_POSITION_Y 0x36 /* Center Y touch position */
812#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */
813#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */
814#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */
815#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */
816#define ABS_MT_DISTANCE 0x3b /* Contact hover distance */
817#define ABS_MT_TOOL_X 0x3c /* Center X tool position */
818#define ABS_MT_TOOL_Y 0x3d /* Center Y tool position */
819
820#ifdef __KERNEL__
821/* Implementation details, userspace should not care about these */ 14/* Implementation details, userspace should not care about these */
822#define ABS_MT_FIRST ABS_MT_TOUCH_MAJOR 15#define ABS_MT_FIRST ABS_MT_TOUCH_MAJOR
823#define ABS_MT_LAST ABS_MT_TOOL_Y 16#define ABS_MT_LAST ABS_MT_TOOL_Y
824#endif
825
826#define ABS_MAX 0x3f
827#define ABS_CNT (ABS_MAX+1)
828
829/*
830 * Switch events
831 */
832
833#define SW_LID 0x00 /* set = lid shut */
834#define SW_TABLET_MODE 0x01 /* set = tablet mode */
835#define SW_HEADPHONE_INSERT 0x02 /* set = inserted */
836#define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any"
837 set = radio enabled */
838#define SW_RADIO SW_RFKILL_ALL /* deprecated */
839#define SW_MICROPHONE_INSERT 0x04 /* set = inserted */
840#define SW_DOCK 0x05 /* set = plugged into dock */
841#define SW_LINEOUT_INSERT 0x06 /* set = inserted */
842#define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */
843#define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */
844#define SW_CAMERA_LENS_COVER 0x09 /* set = lens covered */
845#define SW_KEYPAD_SLIDE 0x0a /* set = keypad slide out */
846#define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */
847#define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */
848#define SW_LINEIN_INSERT 0x0d /* set = inserted */
849#define SW_MAX 0x0f
850#define SW_CNT (SW_MAX+1)
851
852/*
853 * Misc events
854 */
855
856#define MSC_SERIAL 0x00
857#define MSC_PULSELED 0x01
858#define MSC_GESTURE 0x02
859#define MSC_RAW 0x03
860#define MSC_SCAN 0x04
861#define MSC_MAX 0x07
862#define MSC_CNT (MSC_MAX+1)
863
864/*
865 * LEDs
866 */
867
868#define LED_NUML 0x00
869#define LED_CAPSL 0x01
870#define LED_SCROLLL 0x02
871#define LED_COMPOSE 0x03
872#define LED_KANA 0x04
873#define LED_SLEEP 0x05
874#define LED_SUSPEND 0x06
875#define LED_MUTE 0x07
876#define LED_MISC 0x08
877#define LED_MAIL 0x09
878#define LED_CHARGING 0x0a
879#define LED_MAX 0x0f
880#define LED_CNT (LED_MAX+1)
881
882/*
883 * Autorepeat values
884 */
885
886#define REP_DELAY 0x00
887#define REP_PERIOD 0x01
888#define REP_MAX 0x01
889#define REP_CNT (REP_MAX+1)
890
891/*
892 * Sounds
893 */
894
895#define SND_CLICK 0x00
896#define SND_BELL 0x01
897#define SND_TONE 0x02
898#define SND_MAX 0x07
899#define SND_CNT (SND_MAX+1)
900
901/*
902 * IDs.
903 */
904
905#define ID_BUS 0
906#define ID_VENDOR 1
907#define ID_PRODUCT 2
908#define ID_VERSION 3
909
910#define BUS_PCI 0x01
911#define BUS_ISAPNP 0x02
912#define BUS_USB 0x03
913#define BUS_HIL 0x04
914#define BUS_BLUETOOTH 0x05
915#define BUS_VIRTUAL 0x06
916
917#define BUS_ISA 0x10
918#define BUS_I8042 0x11
919#define BUS_XTKBD 0x12
920#define BUS_RS232 0x13
921#define BUS_GAMEPORT 0x14
922#define BUS_PARPORT 0x15
923#define BUS_AMIGA 0x16
924#define BUS_ADB 0x17
925#define BUS_I2C 0x18
926#define BUS_HOST 0x19
927#define BUS_GSC 0x1A
928#define BUS_ATARI 0x1B
929#define BUS_SPI 0x1C
930
931/*
932 * MT_TOOL types
933 */
934#define MT_TOOL_FINGER 0
935#define MT_TOOL_PEN 1
936#define MT_TOOL_MAX 1
937
938/*
939 * Values describing the status of a force-feedback effect
940 */
941#define FF_STATUS_STOPPED 0x00
942#define FF_STATUS_PLAYING 0x01
943#define FF_STATUS_MAX 0x01
944
945/*
946 * Structures used in ioctls to upload effects to a device
947 * They are pieces of a bigger structure (called ff_effect)
948 */
949
950/*
951 * All duration values are expressed in ms. Values above 32767 ms (0x7fff)
952 * should not be used and have unspecified results.
953 */
954
955/**
956 * struct ff_replay - defines scheduling of the force-feedback effect
957 * @length: duration of the effect
958 * @delay: delay before effect should start playing
959 */
960struct ff_replay {
961 __u16 length;
962 __u16 delay;
963};
964
965/**
966 * struct ff_trigger - defines what triggers the force-feedback effect
967 * @button: number of the button triggering the effect
968 * @interval: controls how soon the effect can be re-triggered
969 */
970struct ff_trigger {
971 __u16 button;
972 __u16 interval;
973};
974
975/**
976 * struct ff_envelope - generic force-feedback effect envelope
977 * @attack_length: duration of the attack (ms)
978 * @attack_level: level at the beginning of the attack
979 * @fade_length: duration of fade (ms)
980 * @fade_level: level at the end of fade
981 *
982 * The @attack_level and @fade_level are absolute values; when applying
983 * envelope force-feedback core will convert to positive/negative
984 * value based on polarity of the default level of the effect.
985 * Valid range for the attack and fade levels is 0x0000 - 0x7fff
986 */
987struct ff_envelope {
988 __u16 attack_length;
989 __u16 attack_level;
990 __u16 fade_length;
991 __u16 fade_level;
992};
993
994/**
995 * struct ff_constant_effect - defines parameters of a constant force-feedback effect
996 * @level: strength of the effect; may be negative
997 * @envelope: envelope data
998 */
999struct ff_constant_effect {
1000 __s16 level;
1001 struct ff_envelope envelope;
1002};
1003
1004/**
1005 * struct ff_ramp_effect - defines parameters of a ramp force-feedback effect
1006 * @start_level: beginning strength of the effect; may be negative
1007 * @end_level: final strength of the effect; may be negative
1008 * @envelope: envelope data
1009 */
1010struct ff_ramp_effect {
1011 __s16 start_level;
1012 __s16 end_level;
1013 struct ff_envelope envelope;
1014};
1015
1016/**
1017 * struct ff_condition_effect - defines a spring or friction force-feedback effect
1018 * @right_saturation: maximum level when joystick moved all way to the right
1019 * @left_saturation: same for the left side
1020 * @right_coeff: controls how fast the force grows when the joystick moves
1021 * to the right
1022 * @left_coeff: same for the left side
1023 * @deadband: size of the dead zone, where no force is produced
1024 * @center: position of the dead zone
1025 */
1026struct ff_condition_effect {
1027 __u16 right_saturation;
1028 __u16 left_saturation;
1029
1030 __s16 right_coeff;
1031 __s16 left_coeff;
1032
1033 __u16 deadband;
1034 __s16 center;
1035};
1036
1037/**
1038 * struct ff_periodic_effect - defines parameters of a periodic force-feedback effect
1039 * @waveform: kind of the effect (wave)
1040 * @period: period of the wave (ms)
1041 * @magnitude: peak value
1042 * @offset: mean value of the wave (roughly)
1043 * @phase: 'horizontal' shift
1044 * @envelope: envelope data
1045 * @custom_len: number of samples (FF_CUSTOM only)
1046 * @custom_data: buffer of samples (FF_CUSTOM only)
1047 *
1048 * Known waveforms - FF_SQUARE, FF_TRIANGLE, FF_SINE, FF_SAW_UP,
1049 * FF_SAW_DOWN, FF_CUSTOM. The exact syntax FF_CUSTOM is undefined
1050 * for the time being as no driver supports it yet.
1051 *
1052 * Note: the data pointed by custom_data is copied by the driver.
1053 * You can therefore dispose of the memory after the upload/update.
1054 */
1055struct ff_periodic_effect {
1056 __u16 waveform;
1057 __u16 period;
1058 __s16 magnitude;
1059 __s16 offset;
1060 __u16 phase;
1061
1062 struct ff_envelope envelope;
1063
1064 __u32 custom_len;
1065 __s16 __user *custom_data;
1066};
1067
1068/**
1069 * struct ff_rumble_effect - defines parameters of a periodic force-feedback effect
1070 * @strong_magnitude: magnitude of the heavy motor
1071 * @weak_magnitude: magnitude of the light one
1072 *
1073 * Some rumble pads have two motors of different weight. Strong_magnitude
1074 * represents the magnitude of the vibration generated by the heavy one.
1075 */
1076struct ff_rumble_effect {
1077 __u16 strong_magnitude;
1078 __u16 weak_magnitude;
1079};
1080
1081/**
1082 * struct ff_effect - defines force feedback effect
1083 * @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING,
1084 * FF_FRICTION, FF_DAMPER, FF_RUMBLE, FF_INERTIA, or FF_CUSTOM)
1085 * @id: an unique id assigned to an effect
1086 * @direction: direction of the effect
1087 * @trigger: trigger conditions (struct ff_trigger)
1088 * @replay: scheduling of the effect (struct ff_replay)
1089 * @u: effect-specific structure (one of ff_constant_effect, ff_ramp_effect,
1090 * ff_periodic_effect, ff_condition_effect, ff_rumble_effect) further
1091 * defining effect parameters
1092 *
1093 * This structure is sent through ioctl from the application to the driver.
1094 * To create a new effect application should set its @id to -1; the kernel
1095 * will return assigned @id which can later be used to update or delete
1096 * this effect.
1097 *
1098 * Direction of the effect is encoded as follows:
1099 * 0 deg -> 0x0000 (down)
1100 * 90 deg -> 0x4000 (left)
1101 * 180 deg -> 0x8000 (up)
1102 * 270 deg -> 0xC000 (right)
1103 */
1104struct ff_effect {
1105 __u16 type;
1106 __s16 id;
1107 __u16 direction;
1108 struct ff_trigger trigger;
1109 struct ff_replay replay;
1110
1111 union {
1112 struct ff_constant_effect constant;
1113 struct ff_ramp_effect ramp;
1114 struct ff_periodic_effect periodic;
1115 struct ff_condition_effect condition[2]; /* One for each axis */
1116 struct ff_rumble_effect rumble;
1117 } u;
1118};
1119
1120/*
1121 * Force feedback effect types
1122 */
1123
1124#define FF_RUMBLE 0x50
1125#define FF_PERIODIC 0x51
1126#define FF_CONSTANT 0x52
1127#define FF_SPRING 0x53
1128#define FF_FRICTION 0x54
1129#define FF_DAMPER 0x55
1130#define FF_INERTIA 0x56
1131#define FF_RAMP 0x57
1132
1133#define FF_EFFECT_MIN FF_RUMBLE
1134#define FF_EFFECT_MAX FF_RAMP
1135
1136/*
1137 * Force feedback periodic effect types
1138 */
1139
1140#define FF_SQUARE 0x58
1141#define FF_TRIANGLE 0x59
1142#define FF_SINE 0x5a
1143#define FF_SAW_UP 0x5b
1144#define FF_SAW_DOWN 0x5c
1145#define FF_CUSTOM 0x5d
1146
1147#define FF_WAVEFORM_MIN FF_SQUARE
1148#define FF_WAVEFORM_MAX FF_CUSTOM
1149
1150/*
1151 * Set ff device properties
1152 */
1153
1154#define FF_GAIN 0x60
1155#define FF_AUTOCENTER 0x61
1156
1157#define FF_MAX 0x7f
1158#define FF_CNT (FF_MAX+1)
1159
1160#ifdef __KERNEL__
1161 17
1162/* 18/*
1163 * In-kernel definitions. 19 * In-kernel definitions.
@@ -1396,8 +252,8 @@ struct input_handle;
1396 * @start: starts handler for given handle. This function is called by 252 * @start: starts handler for given handle. This function is called by
1397 * input core right after connect() method and also when a process 253 * input core right after connect() method and also when a process
1398 * that "grabbed" a device releases it 254 * that "grabbed" a device releases it
1399 * @fops: file operations this driver implements 255 * @legacy_minors: set to %true by drivers using legacy minor ranges
1400 * @minor: beginning of range of 32 minors for devices this driver 256 * @minor: beginning of range of 32 legacy minors for devices this driver
1401 * can provide 257 * can provide
1402 * @name: name of the handler, to be shown in /proc/bus/input/handlers 258 * @name: name of the handler, to be shown in /proc/bus/input/handlers
1403 * @id_table: pointer to a table of input_device_ids this driver can 259 * @id_table: pointer to a table of input_device_ids this driver can
@@ -1431,7 +287,7 @@ struct input_handler {
1431 void (*disconnect)(struct input_handle *handle); 287 void (*disconnect)(struct input_handle *handle);
1432 void (*start)(struct input_handle *handle); 288 void (*start)(struct input_handle *handle);
1433 289
1434 const struct file_operations *fops; 290 bool legacy_minors;
1435 int minor; 291 int minor;
1436 const char *name; 292 const char *name;
1437 293
@@ -1499,6 +355,10 @@ void input_reset_device(struct input_dev *);
1499int __must_check input_register_handler(struct input_handler *); 355int __must_check input_register_handler(struct input_handler *);
1500void input_unregister_handler(struct input_handler *); 356void input_unregister_handler(struct input_handler *);
1501 357
358int __must_check input_get_new_minor(int legacy_base, unsigned int legacy_num,
359 bool allow_dynamic);
360void input_free_minor(unsigned int minor);
361
1502int input_handler_for_each_handle(struct input_handler *, void *data, 362int input_handler_for_each_handle(struct input_handler *, void *data,
1503 int (*fn)(struct input_handle *, void *)); 363 int (*fn)(struct input_handle *, void *));
1504 364
@@ -1664,4 +524,3 @@ int input_ff_create_memless(struct input_dev *dev, void *data,
1664 int (*play_effect)(struct input_dev *, void *, struct ff_effect *)); 524 int (*play_effect)(struct input_dev *, void *, struct ff_effect *));
1665 525
1666#endif 526#endif
1667#endif
diff --git a/include/linux/interval_tree.h b/include/linux/interval_tree.h
new file mode 100644
index 000000000000..724556aa3c95
--- /dev/null
+++ b/include/linux/interval_tree.h
@@ -0,0 +1,27 @@
1#ifndef _LINUX_INTERVAL_TREE_H
2#define _LINUX_INTERVAL_TREE_H
3
4#include <linux/rbtree.h>
5
6struct interval_tree_node {
7 struct rb_node rb;
8 unsigned long start; /* Start of interval */
9 unsigned long last; /* Last location _in_ interval */
10 unsigned long __subtree_last;
11};
12
13extern void
14interval_tree_insert(struct interval_tree_node *node, struct rb_root *root);
15
16extern void
17interval_tree_remove(struct interval_tree_node *node, struct rb_root *root);
18
19extern struct interval_tree_node *
20interval_tree_iter_first(struct rb_root *root,
21 unsigned long start, unsigned long last);
22
23extern struct interval_tree_node *
24interval_tree_iter_next(struct interval_tree_node *node,
25 unsigned long start, unsigned long last);
26
27#endif /* _LINUX_INTERVAL_TREE_H */
diff --git a/include/linux/interval_tree_generic.h b/include/linux/interval_tree_generic.h
new file mode 100644
index 000000000000..58370e1862ad
--- /dev/null
+++ b/include/linux/interval_tree_generic.h
@@ -0,0 +1,191 @@
1/*
2 Interval Trees
3 (C) 2012 Michel Lespinasse <walken@google.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; 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 include/linux/interval_tree_generic.h
20*/
21
22#include <linux/rbtree_augmented.h>
23
24/*
25 * Template for implementing interval trees
26 *
27 * ITSTRUCT: struct type of the interval tree nodes
28 * ITRB: name of struct rb_node field within ITSTRUCT
29 * ITTYPE: type of the interval endpoints
30 * ITSUBTREE: name of ITTYPE field within ITSTRUCT holding last-in-subtree
31 * ITSTART(n): start endpoint of ITSTRUCT node n
32 * ITLAST(n): last endpoint of ITSTRUCT node n
33 * ITSTATIC: 'static' or empty
34 * ITPREFIX: prefix to use for the inline tree definitions
35 *
36 * Note - before using this, please consider if non-generic version
37 * (interval_tree.h) would work for you...
38 */
39
40#define INTERVAL_TREE_DEFINE(ITSTRUCT, ITRB, ITTYPE, ITSUBTREE, \
41 ITSTART, ITLAST, ITSTATIC, ITPREFIX) \
42 \
43/* Callbacks for augmented rbtree insert and remove */ \
44 \
45static inline ITTYPE ITPREFIX ## _compute_subtree_last(ITSTRUCT *node) \
46{ \
47 ITTYPE max = ITLAST(node), subtree_last; \
48 if (node->ITRB.rb_left) { \
49 subtree_last = rb_entry(node->ITRB.rb_left, \
50 ITSTRUCT, ITRB)->ITSUBTREE; \
51 if (max < subtree_last) \
52 max = subtree_last; \
53 } \
54 if (node->ITRB.rb_right) { \
55 subtree_last = rb_entry(node->ITRB.rb_right, \
56 ITSTRUCT, ITRB)->ITSUBTREE; \
57 if (max < subtree_last) \
58 max = subtree_last; \
59 } \
60 return max; \
61} \
62 \
63RB_DECLARE_CALLBACKS(static, ITPREFIX ## _augment, ITSTRUCT, ITRB, \
64 ITTYPE, ITSUBTREE, ITPREFIX ## _compute_subtree_last) \
65 \
66/* Insert / remove interval nodes from the tree */ \
67 \
68ITSTATIC void ITPREFIX ## _insert(ITSTRUCT *node, struct rb_root *root) \
69{ \
70 struct rb_node **link = &root->rb_node, *rb_parent = NULL; \
71 ITTYPE start = ITSTART(node), last = ITLAST(node); \
72 ITSTRUCT *parent; \
73 \
74 while (*link) { \
75 rb_parent = *link; \
76 parent = rb_entry(rb_parent, ITSTRUCT, ITRB); \
77 if (parent->ITSUBTREE < last) \
78 parent->ITSUBTREE = last; \
79 if (start < ITSTART(parent)) \
80 link = &parent->ITRB.rb_left; \
81 else \
82 link = &parent->ITRB.rb_right; \
83 } \
84 \
85 node->ITSUBTREE = last; \
86 rb_link_node(&node->ITRB, rb_parent, link); \
87 rb_insert_augmented(&node->ITRB, root, &ITPREFIX ## _augment); \
88} \
89 \
90ITSTATIC void ITPREFIX ## _remove(ITSTRUCT *node, struct rb_root *root) \
91{ \
92 rb_erase_augmented(&node->ITRB, root, &ITPREFIX ## _augment); \
93} \
94 \
95/* \
96 * Iterate over intervals intersecting [start;last] \
97 * \
98 * Note that a node's interval intersects [start;last] iff: \
99 * Cond1: ITSTART(node) <= last \
100 * and \
101 * Cond2: start <= ITLAST(node) \
102 */ \
103 \
104static ITSTRUCT * \
105ITPREFIX ## _subtree_search(ITSTRUCT *node, ITTYPE start, ITTYPE last) \
106{ \
107 while (true) { \
108 /* \
109 * Loop invariant: start <= node->ITSUBTREE \
110 * (Cond2 is satisfied by one of the subtree nodes) \
111 */ \
112 if (node->ITRB.rb_left) { \
113 ITSTRUCT *left = rb_entry(node->ITRB.rb_left, \
114 ITSTRUCT, ITRB); \
115 if (start <= left->ITSUBTREE) { \
116 /* \
117 * Some nodes in left subtree satisfy Cond2. \
118 * Iterate to find the leftmost such node N. \
119 * If it also satisfies Cond1, that's the \
120 * match we are looking for. Otherwise, there \
121 * is no matching interval as nodes to the \
122 * right of N can't satisfy Cond1 either. \
123 */ \
124 node = left; \
125 continue; \
126 } \
127 } \
128 if (ITSTART(node) <= last) { /* Cond1 */ \
129 if (start <= ITLAST(node)) /* Cond2 */ \
130 return node; /* node is leftmost match */ \
131 if (node->ITRB.rb_right) { \
132 node = rb_entry(node->ITRB.rb_right, \
133 ITSTRUCT, ITRB); \
134 if (start <= node->ITSUBTREE) \
135 continue; \
136 } \
137 } \
138 return NULL; /* No match */ \
139 } \
140} \
141 \
142ITSTATIC ITSTRUCT * \
143ITPREFIX ## _iter_first(struct rb_root *root, ITTYPE start, ITTYPE last) \
144{ \
145 ITSTRUCT *node; \
146 \
147 if (!root->rb_node) \
148 return NULL; \
149 node = rb_entry(root->rb_node, ITSTRUCT, ITRB); \
150 if (node->ITSUBTREE < start) \
151 return NULL; \
152 return ITPREFIX ## _subtree_search(node, start, last); \
153} \
154 \
155ITSTATIC ITSTRUCT * \
156ITPREFIX ## _iter_next(ITSTRUCT *node, ITTYPE start, ITTYPE last) \
157{ \
158 struct rb_node *rb = node->ITRB.rb_right, *prev; \
159 \
160 while (true) { \
161 /* \
162 * Loop invariants: \
163 * Cond1: ITSTART(node) <= last \
164 * rb == node->ITRB.rb_right \
165 * \
166 * First, search right subtree if suitable \
167 */ \
168 if (rb) { \
169 ITSTRUCT *right = rb_entry(rb, ITSTRUCT, ITRB); \
170 if (start <= right->ITSUBTREE) \
171 return ITPREFIX ## _subtree_search(right, \
172 start, last); \
173 } \
174 \
175 /* Move up the tree until we come from a node's left child */ \
176 do { \
177 rb = rb_parent(&node->ITRB); \
178 if (!rb) \
179 return NULL; \
180 prev = &node->ITRB; \
181 node = rb_entry(rb, ITSTRUCT, ITRB); \
182 rb = node->ITRB.rb_right; \
183 } while (prev == rb); \
184 \
185 /* Check if the node intersects [start;last] */ \
186 if (last < ITSTART(node)) /* !Cond1 */ \
187 return NULL; \
188 else if (start <= ITLAST(node)) /* Cond2 */ \
189 return node; \
190 } \
191}
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 589e0e75efae..85ac9b9b72a2 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -29,8 +29,9 @@ struct resource {
29#define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */ 29#define IORESOURCE_BITS 0x000000ff /* Bus-specific bits */
30 30
31#define IORESOURCE_TYPE_BITS 0x00001f00 /* Resource type */ 31#define IORESOURCE_TYPE_BITS 0x00001f00 /* Resource type */
32#define IORESOURCE_IO 0x00000100 32#define IORESOURCE_IO 0x00000100 /* PCI/ISA I/O ports */
33#define IORESOURCE_MEM 0x00000200 33#define IORESOURCE_MEM 0x00000200
34#define IORESOURCE_REG 0x00000300 /* Register offsets */
34#define IORESOURCE_IRQ 0x00000400 35#define IORESOURCE_IRQ 0x00000400
35#define IORESOURCE_DMA 0x00000800 36#define IORESOURCE_DMA 0x00000800
36#define IORESOURCE_BUS 0x00001000 37#define IORESOURCE_BUS 0x00001000
diff --git a/include/linux/ip.h b/include/linux/ip.h
index bd0a2a8631c6..58b82a22a52b 100644
--- a/include/linux/ip.h
+++ b/include/linux/ip.h
@@ -16,96 +16,9 @@
16 */ 16 */
17#ifndef _LINUX_IP_H 17#ifndef _LINUX_IP_H
18#define _LINUX_IP_H 18#define _LINUX_IP_H
19#include <linux/types.h>
20#include <asm/byteorder.h>
21 19
22#define IPTOS_TOS_MASK 0x1E
23#define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK)
24#define IPTOS_LOWDELAY 0x10
25#define IPTOS_THROUGHPUT 0x08
26#define IPTOS_RELIABILITY 0x04
27#define IPTOS_MINCOST 0x02
28
29#define IPTOS_PREC_MASK 0xE0
30#define IPTOS_PREC(tos) ((tos)&IPTOS_PREC_MASK)
31#define IPTOS_PREC_NETCONTROL 0xe0
32#define IPTOS_PREC_INTERNETCONTROL 0xc0
33#define IPTOS_PREC_CRITIC_ECP 0xa0
34#define IPTOS_PREC_FLASHOVERRIDE 0x80
35#define IPTOS_PREC_FLASH 0x60
36#define IPTOS_PREC_IMMEDIATE 0x40
37#define IPTOS_PREC_PRIORITY 0x20
38#define IPTOS_PREC_ROUTINE 0x00
39
40
41/* IP options */
42#define IPOPT_COPY 0x80
43#define IPOPT_CLASS_MASK 0x60
44#define IPOPT_NUMBER_MASK 0x1f
45
46#define IPOPT_COPIED(o) ((o)&IPOPT_COPY)
47#define IPOPT_CLASS(o) ((o)&IPOPT_CLASS_MASK)
48#define IPOPT_NUMBER(o) ((o)&IPOPT_NUMBER_MASK)
49
50#define IPOPT_CONTROL 0x00
51#define IPOPT_RESERVED1 0x20
52#define IPOPT_MEASUREMENT 0x40
53#define IPOPT_RESERVED2 0x60
54
55#define IPOPT_END (0 |IPOPT_CONTROL)
56#define IPOPT_NOOP (1 |IPOPT_CONTROL)
57#define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY)
58#define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY)
59#define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT)
60#define IPOPT_CIPSO (6 |IPOPT_CONTROL|IPOPT_COPY)
61#define IPOPT_RR (7 |IPOPT_CONTROL)
62#define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY)
63#define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY)
64#define IPOPT_RA (20|IPOPT_CONTROL|IPOPT_COPY)
65
66#define IPVERSION 4
67#define MAXTTL 255
68#define IPDEFTTL 64
69
70#define IPOPT_OPTVAL 0
71#define IPOPT_OLEN 1
72#define IPOPT_OFFSET 2
73#define IPOPT_MINOFF 4
74#define MAX_IPOPTLEN 40
75#define IPOPT_NOP IPOPT_NOOP
76#define IPOPT_EOL IPOPT_END
77#define IPOPT_TS IPOPT_TIMESTAMP
78
79#define IPOPT_TS_TSONLY 0 /* timestamps only */
80#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
81#define IPOPT_TS_PRESPEC 3 /* specified modules only */
82
83#define IPV4_BEET_PHMAXLEN 8
84
85struct iphdr {
86#if defined(__LITTLE_ENDIAN_BITFIELD)
87 __u8 ihl:4,
88 version:4;
89#elif defined (__BIG_ENDIAN_BITFIELD)
90 __u8 version:4,
91 ihl:4;
92#else
93#error "Please fix <asm/byteorder.h>"
94#endif
95 __u8 tos;
96 __be16 tot_len;
97 __be16 id;
98 __be16 frag_off;
99 __u8 ttl;
100 __u8 protocol;
101 __sum16 check;
102 __be32 saddr;
103 __be32 daddr;
104 /*The options start here. */
105};
106
107#ifdef __KERNEL__
108#include <linux/skbuff.h> 20#include <linux/skbuff.h>
21#include <uapi/linux/ip.h>
109 22
110static inline struct iphdr *ip_hdr(const struct sk_buff *skb) 23static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
111{ 24{
@@ -116,34 +29,4 @@ static inline struct iphdr *ipip_hdr(const struct sk_buff *skb)
116{ 29{
117 return (struct iphdr *)skb_transport_header(skb); 30 return (struct iphdr *)skb_transport_header(skb);
118} 31}
119#endif
120
121struct ip_auth_hdr {
122 __u8 nexthdr;
123 __u8 hdrlen; /* This one is measured in 32 bit units! */
124 __be16 reserved;
125 __be32 spi;
126 __be32 seq_no; /* Sequence number */
127 __u8 auth_data[0]; /* Variable len but >=4. Mind the 64 bit alignment! */
128};
129
130struct ip_esp_hdr {
131 __be32 spi;
132 __be32 seq_no; /* Sequence number */
133 __u8 enc_data[0]; /* Variable len but >=8. Mind the 64 bit alignment! */
134};
135
136struct ip_comp_hdr {
137 __u8 nexthdr;
138 __u8 flags;
139 __be16 cpi;
140};
141
142struct ip_beet_phdr {
143 __u8 nexthdr;
144 __u8 hdrlen;
145 __u8 padlen;
146 __u8 reserved;
147};
148
149#endif /* _LINUX_IP_H */ 32#endif /* _LINUX_IP_H */
diff --git a/include/linux/ipc.h b/include/linux/ipc.h
index ca833fdc3138..8d861b2651f7 100644
--- a/include/linux/ipc.h
+++ b/include/linux/ipc.h
@@ -1,85 +1,9 @@
1#ifndef _LINUX_IPC_H 1#ifndef _LINUX_IPC_H
2#define _LINUX_IPC_H 2#define _LINUX_IPC_H
3 3
4#include <linux/types.h>
5
6#define IPC_PRIVATE ((__kernel_key_t) 0)
7
8/* Obsolete, used only for backwards compatibility and libc5 compiles */
9struct ipc_perm
10{
11 __kernel_key_t key;
12 __kernel_uid_t uid;
13 __kernel_gid_t gid;
14 __kernel_uid_t cuid;
15 __kernel_gid_t cgid;
16 __kernel_mode_t mode;
17 unsigned short seq;
18};
19
20/* Include the definition of ipc64_perm */
21#include <asm/ipcbuf.h>
22
23/* resource get request flags */
24#define IPC_CREAT 00001000 /* create if key is nonexistent */
25#define IPC_EXCL 00002000 /* fail if key exists */
26#define IPC_NOWAIT 00004000 /* return error on wait */
27
28/* these fields are used by the DIPC package so the kernel as standard
29 should avoid using them if possible */
30
31#define IPC_DIPC 00010000 /* make it distributed */
32#define IPC_OWN 00020000 /* this machine is the DIPC owner */
33
34/*
35 * Control commands used with semctl, msgctl and shmctl
36 * see also specific commands in sem.h, msg.h and shm.h
37 */
38#define IPC_RMID 0 /* remove resource */
39#define IPC_SET 1 /* set ipc_perm options */
40#define IPC_STAT 2 /* get ipc_perm options */
41#define IPC_INFO 3 /* see ipcs */
42
43/*
44 * Version flags for semctl, msgctl, and shmctl commands
45 * These are passed as bitflags or-ed with the actual command
46 */
47#define IPC_OLD 0 /* Old version (no 32-bit UID support on many
48 architectures) */
49#define IPC_64 0x0100 /* New version (support 32-bit UIDs, bigger
50 message sizes, etc. */
51
52/*
53 * These are used to wrap system calls.
54 *
55 * See architecture code for ugly details..
56 */
57struct ipc_kludge {
58 struct msgbuf __user *msgp;
59 long msgtyp;
60};
61
62#define SEMOP 1
63#define SEMGET 2
64#define SEMCTL 3
65#define SEMTIMEDOP 4
66#define MSGSND 11
67#define MSGRCV 12
68#define MSGGET 13
69#define MSGCTL 14
70#define SHMAT 21
71#define SHMDT 22
72#define SHMGET 23
73#define SHMCTL 24
74
75/* Used by the DIPC package, try and avoid reusing it */
76#define DIPC 25
77
78#define IPCCALL(version,op) ((version)<<16 | (op))
79
80#ifdef __KERNEL__
81#include <linux/spinlock.h> 4#include <linux/spinlock.h>
82#include <linux/uidgid.h> 5#include <linux/uidgid.h>
6#include <uapi/linux/ipc.h>
83 7
84#define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */ 8#define IPCMNI 32768 /* <= MAX_INT limit for ipc arrays (including sysctl changes) */
85 9
@@ -99,6 +23,4 @@ struct kern_ipc_perm
99 void *security; 23 void *security;
100}; 24};
101 25
102#endif /* __KERNEL__ */
103
104#endif /* _LINUX_IPC_H */ 26#endif /* _LINUX_IPC_H */
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index 48dcba9b2065..1487e7906bbd 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -30,191 +30,11 @@
30 * with this program; if not, write to the Free Software Foundation, Inc., 30 * with this program; if not, write to the Free Software Foundation, Inc.,
31 * 675 Mass Ave, Cambridge, MA 02139, USA. 31 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 */ 32 */
33
34#ifndef __LINUX_IPMI_H 33#ifndef __LINUX_IPMI_H
35#define __LINUX_IPMI_H 34#define __LINUX_IPMI_H
36 35
37#include <linux/ipmi_msgdefs.h> 36#include <uapi/linux/ipmi.h>
38#include <linux/compiler.h>
39
40/*
41 * This file describes an interface to an IPMI driver. You have to
42 * have a fairly good understanding of IPMI to use this, so go read
43 * the specs first before actually trying to do anything.
44 *
45 * With that said, this driver provides a multi-user interface to the
46 * IPMI driver, and it allows multiple IPMI physical interfaces below
47 * the driver. The physical interfaces bind as a lower layer on the
48 * driver. They appear as interfaces to the application using this
49 * interface.
50 *
51 * Multi-user means that multiple applications may use the driver,
52 * send commands, receive responses, etc. The driver keeps track of
53 * commands the user sends and tracks the responses. The responses
54 * will go back to the application that send the command. If the
55 * response doesn't come back in time, the driver will return a
56 * timeout error response to the application. Asynchronous events
57 * from the BMC event queue will go to all users bound to the driver.
58 * The incoming event queue in the BMC will automatically be flushed
59 * if it becomes full and it is queried once a second to see if
60 * anything is in it. Incoming commands to the driver will get
61 * delivered as commands.
62 *
63 * This driver provides two main interfaces: one for in-kernel
64 * applications and another for userland applications. The
65 * capabilities are basically the same for both interface, although
66 * the interfaces are somewhat different. The stuff in the
67 * #ifdef __KERNEL__ below is the in-kernel interface. The userland
68 * interface is defined later in the file. */
69
70
71
72/*
73 * This is an overlay for all the address types, so it's easy to
74 * determine the actual address type. This is kind of like addresses
75 * work for sockets.
76 */
77#define IPMI_MAX_ADDR_SIZE 32
78struct ipmi_addr {
79 /* Try to take these from the "Channel Medium Type" table
80 in section 6.5 of the IPMI 1.5 manual. */
81 int addr_type;
82 short channel;
83 char data[IPMI_MAX_ADDR_SIZE];
84};
85
86/*
87 * When the address is not used, the type will be set to this value.
88 * The channel is the BMC's channel number for the channel (usually
89 * 0), or IPMC_BMC_CHANNEL if communicating directly with the BMC.
90 */
91#define IPMI_SYSTEM_INTERFACE_ADDR_TYPE 0x0c
92struct ipmi_system_interface_addr {
93 int addr_type;
94 short channel;
95 unsigned char lun;
96};
97
98/* An IPMB Address. */
99#define IPMI_IPMB_ADDR_TYPE 0x01
100/* Used for broadcast get device id as described in section 17.9 of the
101 IPMI 1.5 manual. */
102#define IPMI_IPMB_BROADCAST_ADDR_TYPE 0x41
103struct ipmi_ipmb_addr {
104 int addr_type;
105 short channel;
106 unsigned char slave_addr;
107 unsigned char lun;
108};
109
110/*
111 * A LAN Address. This is an address to/from a LAN interface bridged
112 * by the BMC, not an address actually out on the LAN.
113 *
114 * A conscious decision was made here to deviate slightly from the IPMI
115 * spec. We do not use rqSWID and rsSWID like it shows in the
116 * message. Instead, we use remote_SWID and local_SWID. This means
117 * that any message (a request or response) from another device will
118 * always have exactly the same address. If you didn't do this,
119 * requests and responses from the same device would have different
120 * addresses, and that's not too cool.
121 *
122 * In this address, the remote_SWID is always the SWID the remote
123 * message came from, or the SWID we are sending the message to.
124 * local_SWID is always our SWID. Note that having our SWID in the
125 * message is a little weird, but this is required.
126 */
127#define IPMI_LAN_ADDR_TYPE 0x04
128struct ipmi_lan_addr {
129 int addr_type;
130 short channel;
131 unsigned char privilege;
132 unsigned char session_handle;
133 unsigned char remote_SWID;
134 unsigned char local_SWID;
135 unsigned char lun;
136};
137
138
139/*
140 * Channel for talking directly with the BMC. When using this
141 * channel, This is for the system interface address type only. FIXME
142 * - is this right, or should we use -1?
143 */
144#define IPMI_BMC_CHANNEL 0xf
145#define IPMI_NUM_CHANNELS 0x10
146
147/*
148 * Used to signify an "all channel" bitmask. This is more than the
149 * actual number of channels because this is used in userland and
150 * will cover us if the number of channels is extended.
151 */
152#define IPMI_CHAN_ALL (~0)
153
154
155/*
156 * A raw IPMI message without any addressing. This covers both
157 * commands and responses. The completion code is always the first
158 * byte of data in the response (as the spec shows the messages laid
159 * out).
160 */
161struct ipmi_msg {
162 unsigned char netfn;
163 unsigned char cmd;
164 unsigned short data_len;
165 unsigned char __user *data;
166};
167
168struct kernel_ipmi_msg {
169 unsigned char netfn;
170 unsigned char cmd;
171 unsigned short data_len;
172 unsigned char *data;
173};
174
175/*
176 * Various defines that are useful for IPMI applications.
177 */
178#define IPMI_INVALID_CMD_COMPLETION_CODE 0xC1
179#define IPMI_TIMEOUT_COMPLETION_CODE 0xC3
180#define IPMI_UNKNOWN_ERR_COMPLETION_CODE 0xff
181
182 37
183/*
184 * Receive types for messages coming from the receive interface. This
185 * is used for the receive in-kernel interface and in the receive
186 * IOCTL.
187 *
188 * The "IPMI_RESPONSE_RESPNOSE_TYPE" is a little strange sounding, but
189 * it allows you to get the message results when you send a response
190 * message.
191 */
192#define IPMI_RESPONSE_RECV_TYPE 1 /* A response to a command */
193#define IPMI_ASYNC_EVENT_RECV_TYPE 2 /* Something from the event queue */
194#define IPMI_CMD_RECV_TYPE 3 /* A command from somewhere else */
195#define IPMI_RESPONSE_RESPONSE_TYPE 4 /* The response for
196 a sent response, giving any
197 error status for sending the
198 response. When you send a
199 response message, this will
200 be returned. */
201#define IPMI_OEM_RECV_TYPE 5 /* The response for OEM Channels */
202
203/* Note that async events and received commands do not have a completion
204 code as the first byte of the incoming data, unlike a response. */
205
206
207/*
208 * Modes for ipmi_set_maint_mode() and the userland IOCTL. The AUTO
209 * setting is the default and means it will be set on certain
210 * commands. Hard setting it on and off will override automatic
211 * operation.
212 */
213#define IPMI_MAINTENANCE_MODE_AUTO 0
214#define IPMI_MAINTENANCE_MODE_OFF 1
215#define IPMI_MAINTENANCE_MODE_ON 2
216
217#ifdef __KERNEL__
218 38
219/* 39/*
220 * The in-kernel interface. 40 * The in-kernel interface.
@@ -493,244 +313,4 @@ struct ipmi_smi_info {
493/* This is to get the private info of ipmi_smi_t */ 313/* This is to get the private info of ipmi_smi_t */
494extern int ipmi_get_smi_info(int if_num, struct ipmi_smi_info *data); 314extern int ipmi_get_smi_info(int if_num, struct ipmi_smi_info *data);
495 315
496#endif /* __KERNEL__ */
497
498
499/*
500 * The userland interface
501 */
502
503/*
504 * The userland interface for the IPMI driver is a standard character
505 * device, with each instance of an interface registered as a minor
506 * number under the major character device.
507 *
508 * The read and write calls do not work, to get messages in and out
509 * requires ioctl calls because of the complexity of the data. select
510 * and poll do work, so you can wait for input using the file
511 * descriptor, you just can use read to get it.
512 *
513 * In general, you send a command down to the interface and receive
514 * responses back. You can use the msgid value to correlate commands
515 * and responses, the driver will take care of figuring out which
516 * incoming messages are for which command and find the proper msgid
517 * value to report. You will only receive reponses for commands you
518 * send. Asynchronous events, however, go to all open users, so you
519 * must be ready to handle these (or ignore them if you don't care).
520 *
521 * The address type depends upon the channel type. When talking
522 * directly to the BMC (IPMC_BMC_CHANNEL), the address is ignored
523 * (IPMI_UNUSED_ADDR_TYPE). When talking to an IPMB channel, you must
524 * supply a valid IPMB address with the addr_type set properly.
525 *
526 * When talking to normal channels, the driver takes care of the
527 * details of formatting and sending messages on that channel. You do
528 * not, for instance, have to format a send command, you just send
529 * whatever command you want to the channel, the driver will create
530 * the send command, automatically issue receive command and get even
531 * commands, and pass those up to the proper user.
532 */
533
534
535/* The magic IOCTL value for this interface. */
536#define IPMI_IOC_MAGIC 'i'
537
538
539/* Messages sent to the interface are this format. */
540struct ipmi_req {
541 unsigned char __user *addr; /* Address to send the message to. */
542 unsigned int addr_len;
543
544 long msgid; /* The sequence number for the message. This
545 exact value will be reported back in the
546 response to this request if it is a command.
547 If it is a response, this will be used as
548 the sequence value for the response. */
549
550 struct ipmi_msg msg;
551};
552/*
553 * Send a message to the interfaces. error values are:
554 * - EFAULT - an address supplied was invalid.
555 * - EINVAL - The address supplied was not valid, or the command
556 * was not allowed.
557 * - EMSGSIZE - The message to was too large.
558 * - ENOMEM - Buffers could not be allocated for the command.
559 */
560#define IPMICTL_SEND_COMMAND _IOR(IPMI_IOC_MAGIC, 13, \
561 struct ipmi_req)
562
563/* Messages sent to the interface with timing parameters are this
564 format. */
565struct ipmi_req_settime {
566 struct ipmi_req req;
567
568 /* See ipmi_request_settime() above for details on these
569 values. */
570 int retries;
571 unsigned int retry_time_ms;
572};
573/*
574 * Send a message to the interfaces with timing parameters. error values
575 * are:
576 * - EFAULT - an address supplied was invalid.
577 * - EINVAL - The address supplied was not valid, or the command
578 * was not allowed.
579 * - EMSGSIZE - The message to was too large.
580 * - ENOMEM - Buffers could not be allocated for the command.
581 */
582#define IPMICTL_SEND_COMMAND_SETTIME _IOR(IPMI_IOC_MAGIC, 21, \
583 struct ipmi_req_settime)
584
585/* Messages received from the interface are this format. */
586struct ipmi_recv {
587 int recv_type; /* Is this a command, response or an
588 asyncronous event. */
589
590 unsigned char __user *addr; /* Address the message was from is put
591 here. The caller must supply the
592 memory. */
593 unsigned int addr_len; /* The size of the address buffer.
594 The caller supplies the full buffer
595 length, this value is updated to
596 the actual message length when the
597 message is received. */
598
599 long msgid; /* The sequence number specified in the request
600 if this is a response. If this is a command,
601 this will be the sequence number from the
602 command. */
603
604 struct ipmi_msg msg; /* The data field must point to a buffer.
605 The data_size field must be set to the
606 size of the message buffer. The
607 caller supplies the full buffer
608 length, this value is updated to the
609 actual message length when the message
610 is received. */
611};
612
613/*
614 * Receive a message. error values:
615 * - EAGAIN - no messages in the queue.
616 * - EFAULT - an address supplied was invalid.
617 * - EINVAL - The address supplied was not valid.
618 * - EMSGSIZE - The message to was too large to fit into the message buffer,
619 * the message will be left in the buffer. */
620#define IPMICTL_RECEIVE_MSG _IOWR(IPMI_IOC_MAGIC, 12, \
621 struct ipmi_recv)
622
623/*
624 * Like RECEIVE_MSG, but if the message won't fit in the buffer, it
625 * will truncate the contents instead of leaving the data in the
626 * buffer.
627 */
628#define IPMICTL_RECEIVE_MSG_TRUNC _IOWR(IPMI_IOC_MAGIC, 11, \
629 struct ipmi_recv)
630
631/* Register to get commands from other entities on this interface. */
632struct ipmi_cmdspec {
633 unsigned char netfn;
634 unsigned char cmd;
635};
636
637/*
638 * Register to receive a specific command. error values:
639 * - EFAULT - an address supplied was invalid.
640 * - EBUSY - The netfn/cmd supplied was already in use.
641 * - ENOMEM - could not allocate memory for the entry.
642 */
643#define IPMICTL_REGISTER_FOR_CMD _IOR(IPMI_IOC_MAGIC, 14, \
644 struct ipmi_cmdspec)
645/*
646 * Unregister a regsitered command. error values:
647 * - EFAULT - an address supplied was invalid.
648 * - ENOENT - The netfn/cmd was not found registered for this user.
649 */
650#define IPMICTL_UNREGISTER_FOR_CMD _IOR(IPMI_IOC_MAGIC, 15, \
651 struct ipmi_cmdspec)
652
653/*
654 * Register to get commands from other entities on specific channels.
655 * This way, you can only listen on specific channels, or have messages
656 * from some channels go to one place and other channels to someplace
657 * else. The chans field is a bitmask, (1 << channel) for each channel.
658 * It may be IPMI_CHAN_ALL for all channels.
659 */
660struct ipmi_cmdspec_chans {
661 unsigned int netfn;
662 unsigned int cmd;
663 unsigned int chans;
664};
665
666/*
667 * Register to receive a specific command on specific channels. error values:
668 * - EFAULT - an address supplied was invalid.
669 * - EBUSY - One of the netfn/cmd/chans supplied was already in use.
670 * - ENOMEM - could not allocate memory for the entry.
671 */
672#define IPMICTL_REGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 28, \
673 struct ipmi_cmdspec_chans)
674/*
675 * Unregister some netfn/cmd/chans. error values:
676 * - EFAULT - an address supplied was invalid.
677 * - ENOENT - None of the netfn/cmd/chans were found registered for this user.
678 */
679#define IPMICTL_UNREGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 29, \
680 struct ipmi_cmdspec_chans)
681
682/*
683 * Set whether this interface receives events. Note that the first
684 * user registered for events will get all pending events for the
685 * interface. error values:
686 * - EFAULT - an address supplied was invalid.
687 */
688#define IPMICTL_SET_GETS_EVENTS_CMD _IOR(IPMI_IOC_MAGIC, 16, int)
689
690/*
691 * Set and get the slave address and LUN that we will use for our
692 * source messages. Note that this affects the interface, not just
693 * this user, so it will affect all users of this interface. This is
694 * so some initialization code can come in and do the OEM-specific
695 * things it takes to determine your address (if not the BMC) and set
696 * it for everyone else. You should probably leave the LUN alone.
697 */
698struct ipmi_channel_lun_address_set {
699 unsigned short channel;
700 unsigned char value;
701};
702#define IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD \
703 _IOR(IPMI_IOC_MAGIC, 24, struct ipmi_channel_lun_address_set)
704#define IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD \
705 _IOR(IPMI_IOC_MAGIC, 25, struct ipmi_channel_lun_address_set)
706#define IPMICTL_SET_MY_CHANNEL_LUN_CMD \
707 _IOR(IPMI_IOC_MAGIC, 26, struct ipmi_channel_lun_address_set)
708#define IPMICTL_GET_MY_CHANNEL_LUN_CMD \
709 _IOR(IPMI_IOC_MAGIC, 27, struct ipmi_channel_lun_address_set)
710/* Legacy interfaces, these only set IPMB 0. */
711#define IPMICTL_SET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 17, unsigned int)
712#define IPMICTL_GET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 18, unsigned int)
713#define IPMICTL_SET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 19, unsigned int)
714#define IPMICTL_GET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 20, unsigned int)
715
716/*
717 * Get/set the default timing values for an interface. You shouldn't
718 * generally mess with these.
719 */
720struct ipmi_timing_parms {
721 int retries;
722 unsigned int retry_time_ms;
723};
724#define IPMICTL_SET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 22, \
725 struct ipmi_timing_parms)
726#define IPMICTL_GET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 23, \
727 struct ipmi_timing_parms)
728
729/*
730 * Set the maintenance mode. See ipmi_set_maintenance_mode() above
731 * for a description of what this does.
732 */
733#define IPMICTL_GET_MAINTENANCE_MODE_CMD _IOR(IPMI_IOC_MAGIC, 30, int)
734#define IPMICTL_SET_MAINTENANCE_MODE_CMD _IOW(IPMI_IOC_MAGIC, 31, int)
735
736#endif /* __LINUX_IPMI_H */ 316#endif /* __LINUX_IPMI_H */
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 0b94e91ed685..bcba48a97868 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -1,134 +1,9 @@
1#ifndef _IPV6_H 1#ifndef _IPV6_H
2#define _IPV6_H 2#define _IPV6_H
3 3
4#include <linux/types.h> 4#include <uapi/linux/ipv6.h>
5#include <linux/in6.h>
6#include <asm/byteorder.h>
7 5
8/* The latest drafts declared increase in minimal mtu up to 1280. */
9
10#define IPV6_MIN_MTU 1280
11
12/*
13 * Advanced API
14 * source interface/address selection, source routing, etc...
15 * *under construction*
16 */
17
18
19struct in6_pktinfo {
20 struct in6_addr ipi6_addr;
21 int ipi6_ifindex;
22};
23
24struct ip6_mtuinfo {
25 struct sockaddr_in6 ip6m_addr;
26 __u32 ip6m_mtu;
27};
28
29struct in6_ifreq {
30 struct in6_addr ifr6_addr;
31 __u32 ifr6_prefixlen;
32 int ifr6_ifindex;
33};
34
35#define IPV6_SRCRT_STRICT 0x01 /* Deprecated; will be removed */
36#define IPV6_SRCRT_TYPE_0 0 /* Deprecated; will be removed */
37#define IPV6_SRCRT_TYPE_2 2 /* IPv6 type 2 Routing Header */
38
39/*
40 * routing header
41 */
42struct ipv6_rt_hdr {
43 __u8 nexthdr;
44 __u8 hdrlen;
45 __u8 type;
46 __u8 segments_left;
47
48 /*
49 * type specific data
50 * variable length field
51 */
52};
53
54
55struct ipv6_opt_hdr {
56 __u8 nexthdr;
57 __u8 hdrlen;
58 /*
59 * TLV encoded option data follows.
60 */
61} __attribute__((packed)); /* required for some archs */
62
63#define ipv6_destopt_hdr ipv6_opt_hdr
64#define ipv6_hopopt_hdr ipv6_opt_hdr
65
66#ifdef __KERNEL__
67#define ipv6_optlen(p) (((p)->hdrlen+1) << 3) 6#define ipv6_optlen(p) (((p)->hdrlen+1) << 3)
68#endif
69
70/*
71 * routing header type 0 (used in cmsghdr struct)
72 */
73
74struct rt0_hdr {
75 struct ipv6_rt_hdr rt_hdr;
76 __u32 reserved;
77 struct in6_addr addr[0];
78
79#define rt0_type rt_hdr.type
80};
81
82/*
83 * routing header type 2
84 */
85
86struct rt2_hdr {
87 struct ipv6_rt_hdr rt_hdr;
88 __u32 reserved;
89 struct in6_addr addr;
90
91#define rt2_type rt_hdr.type
92};
93
94/*
95 * home address option in destination options header
96 */
97
98struct ipv6_destopt_hao {
99 __u8 type;
100 __u8 length;
101 struct in6_addr addr;
102} __attribute__((packed));
103
104/*
105 * IPv6 fixed header
106 *
107 * BEWARE, it is incorrect. The first 4 bits of flow_lbl
108 * are glued to priority now, forming "class".
109 */
110
111struct ipv6hdr {
112#if defined(__LITTLE_ENDIAN_BITFIELD)
113 __u8 priority:4,
114 version:4;
115#elif defined(__BIG_ENDIAN_BITFIELD)
116 __u8 version:4,
117 priority:4;
118#else
119#error "Please fix <asm/byteorder.h>"
120#endif
121 __u8 flow_lbl[3];
122
123 __be16 payload_len;
124 __u8 nexthdr;
125 __u8 hop_limit;
126
127 struct in6_addr saddr;
128 struct in6_addr daddr;
129};
130
131#ifdef __KERNEL__
132/* 7/*
133 * This structure contains configuration options per IPv6 link. 8 * This structure contains configuration options per IPv6 link.
134 */ 9 */
@@ -180,43 +55,6 @@ struct ipv6_params {
180 __s32 autoconf; 55 __s32 autoconf;
181}; 56};
182extern struct ipv6_params ipv6_defaults; 57extern struct ipv6_params ipv6_defaults;
183#endif
184
185/* index values for the variables in ipv6_devconf */
186enum {
187 DEVCONF_FORWARDING = 0,
188 DEVCONF_HOPLIMIT,
189 DEVCONF_MTU6,
190 DEVCONF_ACCEPT_RA,
191 DEVCONF_ACCEPT_REDIRECTS,
192 DEVCONF_AUTOCONF,
193 DEVCONF_DAD_TRANSMITS,
194 DEVCONF_RTR_SOLICITS,
195 DEVCONF_RTR_SOLICIT_INTERVAL,
196 DEVCONF_RTR_SOLICIT_DELAY,
197 DEVCONF_USE_TEMPADDR,
198 DEVCONF_TEMP_VALID_LFT,
199 DEVCONF_TEMP_PREFERED_LFT,
200 DEVCONF_REGEN_MAX_RETRY,
201 DEVCONF_MAX_DESYNC_FACTOR,
202 DEVCONF_MAX_ADDRESSES,
203 DEVCONF_FORCE_MLD_VERSION,
204 DEVCONF_ACCEPT_RA_DEFRTR,
205 DEVCONF_ACCEPT_RA_PINFO,
206 DEVCONF_ACCEPT_RA_RTR_PREF,
207 DEVCONF_RTR_PROBE_INTERVAL,
208 DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
209 DEVCONF_PROXY_NDP,
210 DEVCONF_OPTIMISTIC_DAD,
211 DEVCONF_ACCEPT_SOURCE_ROUTE,
212 DEVCONF_MC_FORWARDING,
213 DEVCONF_DISABLE_IPV6,
214 DEVCONF_ACCEPT_DAD,
215 DEVCONF_FORCE_TLLAO,
216 DEVCONF_MAX
217};
218
219#ifdef __KERNEL__
220#include <linux/icmpv6.h> 58#include <linux/icmpv6.h>
221#include <linux/tcp.h> 59#include <linux/tcp.h>
222#include <linux/udp.h> 60#include <linux/udp.h>
@@ -541,6 +379,4 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
541 (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_rcv_saddr, (__daddr))) && \ 379 (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_rcv_saddr, (__daddr))) && \
542 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 380 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
543 381
544#endif /* __KERNEL__ */
545
546#endif /* _IPV6_H */ 382#endif /* _IPV6_H */
diff --git a/include/linux/ipv6_route.h b/include/linux/ipv6_route.h
index 1e7d8af2defe..25b5f1f5e780 100644
--- a/include/linux/ipv6_route.h
+++ b/include/linux/ipv6_route.h
@@ -9,54 +9,11 @@
9 * as published by the Free Software Foundation; either version 9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 */ 11 */
12
13#ifndef _LINUX_IPV6_ROUTE_H 12#ifndef _LINUX_IPV6_ROUTE_H
14#define _LINUX_IPV6_ROUTE_H 13#define _LINUX_IPV6_ROUTE_H
15 14
16#include <linux/types.h> 15#include <uapi/linux/ipv6_route.h>
17
18#define RTF_DEFAULT 0x00010000 /* default - learned via ND */
19#define RTF_ALLONLINK 0x00020000 /* (deprecated and will be removed)
20 fallback, no routers on link */
21#define RTF_ADDRCONF 0x00040000 /* addrconf route - RA */
22#define RTF_PREFIX_RT 0x00080000 /* A prefix only route - RA */
23#define RTF_ANYCAST 0x00100000 /* Anycast */
24
25#define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */
26#define RTF_EXPIRES 0x00400000
27
28#define RTF_ROUTEINFO 0x00800000 /* route information - RA */
29
30#define RTF_CACHE 0x01000000 /* cache entry */
31#define RTF_FLOW 0x02000000 /* flow significant route */
32#define RTF_POLICY 0x04000000 /* policy route */
33
34#define RTF_PREF(pref) ((pref) << 27)
35#define RTF_PREF_MASK 0x18000000
36 16
37#define RTF_LOCAL 0x80000000
38
39#ifdef __KERNEL__
40#define IPV6_EXTRACT_PREF(flag) (((flag) & RTF_PREF_MASK) >> 27) 17#define IPV6_EXTRACT_PREF(flag) (((flag) & RTF_PREF_MASK) >> 27)
41#define IPV6_DECODE_PREF(pref) ((pref) ^ 2) /* 1:low,2:med,3:high */ 18#define IPV6_DECODE_PREF(pref) ((pref) ^ 2) /* 1:low,2:med,3:high */
42#endif 19#endif
43
44struct in6_rtmsg {
45 struct in6_addr rtmsg_dst;
46 struct in6_addr rtmsg_src;
47 struct in6_addr rtmsg_gateway;
48 __u32 rtmsg_type;
49 __u16 rtmsg_dst_len;
50 __u16 rtmsg_src_len;
51 __u32 rtmsg_metric;
52 unsigned long rtmsg_info;
53 __u32 rtmsg_flags;
54 int rtmsg_ifindex;
55};
56
57#define RTMSG_NEWDEVICE 0x11
58#define RTMSG_DELDEVICE 0x12
59#define RTMSG_NEWROUTE 0x21
60#define RTMSG_DELROUTE 0x22
61
62#endif
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h
index 3bc4dcab6e82..0a2dc46cdaf6 100644
--- a/include/linux/irqnr.h
+++ b/include/linux/irqnr.h
@@ -1,10 +1,8 @@
1#ifndef _LINUX_IRQNR_H 1#ifndef _LINUX_IRQNR_H
2#define _LINUX_IRQNR_H 2#define _LINUX_IRQNR_H
3 3
4/* 4#include <uapi/linux/irqnr.h>
5 * Generic irq_desc iterators: 5
6 */
7#ifdef __KERNEL__
8 6
9#ifndef CONFIG_GENERIC_HARDIRQS 7#ifndef CONFIG_GENERIC_HARDIRQS
10#include <asm/irq.h> 8#include <asm/irq.h>
@@ -57,6 +55,4 @@ unsigned int irq_get_next_irq(unsigned int offset);
57#define for_each_irq_nr(irq) \ 55#define for_each_irq_nr(irq) \
58 for (irq = 0; irq < nr_irqs; irq++) 56 for (irq = 0; irq < nr_irqs; irq++)
59 57
60#endif /* __KERNEL__ */
61
62#endif 58#endif
diff --git a/include/linux/isdn.h b/include/linux/isdn.h
index 215c41602af8..1e9a0f2a8626 100644
--- a/include/linux/isdn.h
+++ b/include/linux/isdn.h
@@ -10,136 +10,9 @@
10 * of the GNU General Public License, incorporated herein by reference. 10 * of the GNU General Public License, incorporated herein by reference.
11 * 11 *
12 */ 12 */
13
14#ifndef __ISDN_H__ 13#ifndef __ISDN_H__
15#define __ISDN_H__ 14#define __ISDN_H__
16 15
17#include <linux/ioctl.h>
18#include <linux/tty.h>
19
20#define ISDN_MAX_DRIVERS 32
21#define ISDN_MAX_CHANNELS 64
22
23/* New ioctl-codes */
24#define IIOCNETAIF _IO('I',1)
25#define IIOCNETDIF _IO('I',2)
26#define IIOCNETSCF _IO('I',3)
27#define IIOCNETGCF _IO('I',4)
28#define IIOCNETANM _IO('I',5)
29#define IIOCNETDNM _IO('I',6)
30#define IIOCNETGNM _IO('I',7)
31#define IIOCGETSET _IO('I',8) /* no longer supported */
32#define IIOCSETSET _IO('I',9) /* no longer supported */
33#define IIOCSETVER _IO('I',10)
34#define IIOCNETHUP _IO('I',11)
35#define IIOCSETGST _IO('I',12)
36#define IIOCSETBRJ _IO('I',13)
37#define IIOCSIGPRF _IO('I',14)
38#define IIOCGETPRF _IO('I',15)
39#define IIOCSETPRF _IO('I',16)
40#define IIOCGETMAP _IO('I',17)
41#define IIOCSETMAP _IO('I',18)
42#define IIOCNETASL _IO('I',19)
43#define IIOCNETDIL _IO('I',20)
44#define IIOCGETCPS _IO('I',21)
45#define IIOCGETDVR _IO('I',22)
46#define IIOCNETLCR _IO('I',23) /* dwabc ioctl for LCR from isdnlog */
47#define IIOCNETDWRSET _IO('I',24) /* dwabc ioctl to reset abc-values to default on a net-interface */
48
49#define IIOCNETALN _IO('I',32)
50#define IIOCNETDLN _IO('I',33)
51
52#define IIOCNETGPN _IO('I',34)
53
54#define IIOCDBGVAR _IO('I',127)
55
56#define IIOCDRVCTL _IO('I',128)
57
58/* cisco hdlck device private ioctls */
59#define SIOCGKEEPPERIOD (SIOCDEVPRIVATE + 0)
60#define SIOCSKEEPPERIOD (SIOCDEVPRIVATE + 1)
61#define SIOCGDEBSERINT (SIOCDEVPRIVATE + 2)
62#define SIOCSDEBSERINT (SIOCDEVPRIVATE + 3)
63
64/* Packet encapsulations for net-interfaces */
65#define ISDN_NET_ENCAP_ETHER 0
66#define ISDN_NET_ENCAP_RAWIP 1
67#define ISDN_NET_ENCAP_IPTYP 2
68#define ISDN_NET_ENCAP_CISCOHDLC 3 /* Without SLARP and keepalive */
69#define ISDN_NET_ENCAP_SYNCPPP 4
70#define ISDN_NET_ENCAP_UIHDLC 5
71#define ISDN_NET_ENCAP_CISCOHDLCK 6 /* With SLARP and keepalive */
72#define ISDN_NET_ENCAP_X25IFACE 7 /* Documentation/networking/x25-iface.txt */
73#define ISDN_NET_ENCAP_MAX_ENCAP ISDN_NET_ENCAP_X25IFACE
74
75/* Facility which currently uses an ISDN-channel */
76#define ISDN_USAGE_NONE 0
77#define ISDN_USAGE_RAW 1
78#define ISDN_USAGE_MODEM 2
79#define ISDN_USAGE_NET 3
80#define ISDN_USAGE_VOICE 4
81#define ISDN_USAGE_FAX 5
82#define ISDN_USAGE_MASK 7 /* Mask to get plain usage */
83#define ISDN_USAGE_DISABLED 32 /* This bit is set, if channel is disabled */
84#define ISDN_USAGE_EXCLUSIVE 64 /* This bit is set, if channel is exclusive */
85#define ISDN_USAGE_OUTGOING 128 /* This bit is set, if channel is outgoing */
86
87#define ISDN_MODEM_NUMREG 24 /* Number of Modem-Registers */
88#define ISDN_LMSNLEN 255 /* Length of tty's Listen-MSN string */
89#define ISDN_CMSGLEN 50 /* Length of CONNECT-Message to add for Modem */
90
91#define ISDN_MSNLEN 32
92#define NET_DV 0x06 /* Data version for isdn_net_ioctl_cfg */
93#define TTY_DV 0x06 /* Data version for iprofd etc. */
94
95#define INF_DV 0x01 /* Data version for /dev/isdninfo */
96
97typedef struct {
98 char drvid[25];
99 unsigned long arg;
100} isdn_ioctl_struct;
101
102typedef struct {
103 char name[10];
104 char phone[ISDN_MSNLEN];
105 int outgoing;
106} isdn_net_ioctl_phone;
107
108typedef struct {
109 char name[10]; /* Name of interface */
110 char master[10]; /* Name of Master for Bundling */
111 char slave[10]; /* Name of Slave for Bundling */
112 char eaz[256]; /* EAZ/MSN */
113 char drvid[25]; /* DriverId for Bindings */
114 int onhtime; /* Hangup-Timeout */
115 int charge; /* Charge-Units */
116 int l2_proto; /* Layer-2 protocol */
117 int l3_proto; /* Layer-3 protocol */
118 int p_encap; /* Encapsulation */
119 int exclusive; /* Channel, if bound exclusive */
120 int dialmax; /* Dial Retry-Counter */
121 int slavedelay; /* Delay until slave starts up */
122 int cbdelay; /* Delay before Callback */
123 int chargehup; /* Flag: Charge-Hangup */
124 int ihup; /* Flag: Hangup-Timeout on incoming line */
125 int secure; /* Flag: Secure */
126 int callback; /* Flag: Callback */
127 int cbhup; /* Flag: Reject Call before Callback */
128 int pppbind; /* ippp device for bindings */
129 int chargeint; /* Use fixed charge interval length */
130 int triggercps; /* BogoCPS needed for triggering slave */
131 int dialtimeout; /* Dial-Timeout */
132 int dialwait; /* Time to wait after failed dial */
133 int dialmode; /* Flag: off / on / auto */
134} isdn_net_ioctl_cfg;
135
136#define ISDN_NET_DIALMODE_MASK 0xC0 /* bits for status */
137#define ISDN_NET_DM_OFF 0x00 /* this interface is stopped */
138#define ISDN_NET_DM_MANUAL 0x40 /* this interface is on (manual) */
139#define ISDN_NET_DM_AUTO 0x80 /* this interface is autodial */
140#define ISDN_NET_DIALMODE(x) ((&(x))->flags & ISDN_NET_DIALMODE_MASK)
141
142#ifdef __KERNEL__
143 16
144#include <linux/errno.h> 17#include <linux/errno.h>
145#include <linux/fs.h> 18#include <linux/fs.h>
@@ -163,6 +36,7 @@ typedef struct {
163#include <linux/skbuff.h> 36#include <linux/skbuff.h>
164#include <linux/tcp.h> 37#include <linux/tcp.h>
165#include <linux/mutex.h> 38#include <linux/mutex.h>
39#include <uapi/linux/isdn.h>
166 40
167#define ISDN_TTY_MAJOR 43 41#define ISDN_TTY_MAJOR 43
168#define ISDN_TTYAUX_MAJOR 44 42#define ISDN_TTYAUX_MAJOR 44
@@ -595,6 +469,4 @@ typedef struct isdn_devt {
595extern isdn_dev *dev; 469extern isdn_dev *dev;
596 470
597 471
598#endif /* __KERNEL__ */
599
600#endif /* __ISDN_H__ */ 472#endif /* __ISDN_H__ */
diff --git a/include/linux/isdn/Kbuild b/include/linux/isdn/Kbuild
deleted file mode 100644
index 991cdb29ab2e..000000000000
--- a/include/linux/isdn/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
1header-y += capicmd.h
diff --git a/include/linux/isdn_divertif.h b/include/linux/isdn_divertif.h
index a5a50f523807..19ab361f9f07 100644
--- a/include/linux/isdn_divertif.h
+++ b/include/linux/isdn_divertif.h
@@ -9,26 +9,12 @@
9 * of the GNU General Public License, incorporated herein by reference. 9 * of the GNU General Public License, incorporated herein by reference.
10 * 10 *
11 */ 11 */
12
13#ifndef _LINUX_ISDN_DIVERTIF_H 12#ifndef _LINUX_ISDN_DIVERTIF_H
14#define _LINUX_ISDN_DIVERTIF_H 13#define _LINUX_ISDN_DIVERTIF_H
15 14
16/***********************************************************/
17/* magic value is also used to control version information */
18/***********************************************************/
19#define DIVERT_IF_MAGIC 0x25873401
20#define DIVERT_CMD_REG 0x00 /* register command */
21#define DIVERT_CMD_REL 0x01 /* release command */
22#define DIVERT_NO_ERR 0x00 /* return value no error */
23#define DIVERT_CMD_ERR 0x01 /* invalid cmd */
24#define DIVERT_VER_ERR 0x02 /* magic/version invalid */
25#define DIVERT_REG_ERR 0x03 /* module already registered */
26#define DIVERT_REL_ERR 0x04 /* module not registered */
27#define DIVERT_REG_NAME isdn_register_divert
28
29#ifdef __KERNEL__
30#include <linux/isdnif.h> 15#include <linux/isdnif.h>
31#include <linux/types.h> 16#include <linux/types.h>
17#include <uapi/linux/isdn_divertif.h>
32 18
33/***************************************************************/ 19/***************************************************************/
34/* structure exchanging data between isdn hl and divert module */ 20/* structure exchanging data between isdn hl and divert module */
@@ -46,6 +32,4 @@ typedef struct
46/* function register */ 32/* function register */
47/*********************/ 33/*********************/
48extern int DIVERT_REG_NAME(isdn_divert_if *); 34extern int DIVERT_REG_NAME(isdn_divert_if *);
49#endif
50
51#endif /* _LINUX_ISDN_DIVERTIF_H */ 35#endif /* _LINUX_ISDN_DIVERTIF_H */
diff --git a/include/linux/isdn_ppp.h b/include/linux/isdn_ppp.h
index 8687a7dc0632..d5f62bc5f4be 100644
--- a/include/linux/isdn_ppp.h
+++ b/include/linux/isdn_ppp.h
@@ -9,68 +9,16 @@
9 * of the GNU General Public License, incorporated herein by reference. 9 * of the GNU General Public License, incorporated herein by reference.
10 * 10 *
11 */ 11 */
12
13#ifndef _LINUX_ISDN_PPP_H 12#ifndef _LINUX_ISDN_PPP_H
14#define _LINUX_ISDN_PPP_H 13#define _LINUX_ISDN_PPP_H
15 14
16#define CALLTYPE_INCOMING 0x1
17#define CALLTYPE_OUTGOING 0x2
18#define CALLTYPE_CALLBACK 0x4
19
20#define IPPP_VERSION "2.2.0"
21
22struct pppcallinfo
23{
24 int calltype;
25 unsigned char local_num[64];
26 unsigned char remote_num[64];
27 int charge_units;
28};
29
30#define PPPIOCGCALLINFO _IOWR('t',128,struct pppcallinfo)
31#define PPPIOCBUNDLE _IOW('t',129,int)
32#define PPPIOCGMPFLAGS _IOR('t',130,int)
33#define PPPIOCSMPFLAGS _IOW('t',131,int)
34#define PPPIOCSMPMTU _IOW('t',132,int)
35#define PPPIOCSMPMRU _IOW('t',133,int)
36#define PPPIOCGCOMPRESSORS _IOR('t',134,unsigned long [8])
37#define PPPIOCSCOMPRESSOR _IOW('t',135,int)
38#define PPPIOCGIFNAME _IOR('t',136, char [IFNAMSIZ] )
39
40
41#define SC_MP_PROT 0x00000200
42#define SC_REJ_MP_PROT 0x00000400
43#define SC_OUT_SHORT_SEQ 0x00000800
44#define SC_IN_SHORT_SEQ 0x00004000
45
46#define SC_DECOMP_ON 0x01
47#define SC_COMP_ON 0x02
48#define SC_DECOMP_DISCARD 0x04
49#define SC_COMP_DISCARD 0x08
50#define SC_LINK_DECOMP_ON 0x10
51#define SC_LINK_COMP_ON 0x20
52#define SC_LINK_DECOMP_DISCARD 0x40
53#define SC_LINK_COMP_DISCARD 0x80
54
55#define ISDN_PPP_COMP_MAX_OPTIONS 16
56
57#define IPPP_COMP_FLAG_XMIT 0x1
58#define IPPP_COMP_FLAG_LINK 0x2
59
60struct isdn_ppp_comp_data {
61 int num;
62 unsigned char options[ISDN_PPP_COMP_MAX_OPTIONS];
63 int optlen;
64 int flags;
65};
66
67#ifdef __KERNEL__
68 15
69 16
70 17
71#ifdef CONFIG_IPPP_FILTER 18#ifdef CONFIG_IPPP_FILTER
72#include <linux/filter.h> 19#include <linux/filter.h>
73#endif 20#endif
21#include <uapi/linux/isdn_ppp.h>
74 22
75#define DECOMP_ERR_NOMEM (-10) 23#define DECOMP_ERR_NOMEM (-10)
76 24
@@ -244,5 +192,4 @@ struct ippp_struct {
244 unsigned long compflags; 192 unsigned long compflags;
245}; 193};
246 194
247#endif /* __KERNEL__ */
248#endif /* _LINUX_ISDN_PPP_H */ 195#endif /* _LINUX_ISDN_PPP_H */
diff --git a/include/linux/isdnif.h b/include/linux/isdnif.h
index b8c23f88dd54..0fc6ff276221 100644
--- a/include/linux/isdnif.h
+++ b/include/linux/isdnif.h
@@ -10,51 +10,12 @@
10 * of the GNU General Public License, incorporated herein by reference. 10 * of the GNU General Public License, incorporated herein by reference.
11 * 11 *
12 */ 12 */
13
14#ifndef __ISDNIF_H__ 13#ifndef __ISDNIF_H__
15#define __ISDNIF_H__ 14#define __ISDNIF_H__
16 15
17 16
18/*
19 * Values for general protocol-selection
20 */
21#define ISDN_PTYPE_UNKNOWN 0 /* Protocol undefined */
22#define ISDN_PTYPE_1TR6 1 /* german 1TR6-protocol */
23#define ISDN_PTYPE_EURO 2 /* EDSS1-protocol */
24#define ISDN_PTYPE_LEASED 3 /* for leased lines */
25#define ISDN_PTYPE_NI1 4 /* US NI-1 protocol */
26#define ISDN_PTYPE_MAX 7 /* Max. 8 Protocols */
27
28/*
29 * Values for Layer-2-protocol-selection
30 */
31#define ISDN_PROTO_L2_X75I 0 /* X75/LAPB with I-Frames */
32#define ISDN_PROTO_L2_X75UI 1 /* X75/LAPB with UI-Frames */
33#define ISDN_PROTO_L2_X75BUI 2 /* X75/LAPB with UI-Frames */
34#define ISDN_PROTO_L2_HDLC 3 /* HDLC */
35#define ISDN_PROTO_L2_TRANS 4 /* Transparent (Voice) */
36#define ISDN_PROTO_L2_X25DTE 5 /* X25/LAPB DTE mode */
37#define ISDN_PROTO_L2_X25DCE 6 /* X25/LAPB DCE mode */
38#define ISDN_PROTO_L2_V11096 7 /* V.110 bitrate adaption 9600 Baud */
39#define ISDN_PROTO_L2_V11019 8 /* V.110 bitrate adaption 19200 Baud */
40#define ISDN_PROTO_L2_V11038 9 /* V.110 bitrate adaption 38400 Baud */
41#define ISDN_PROTO_L2_MODEM 10 /* Analog Modem on Board */
42#define ISDN_PROTO_L2_FAX 11 /* Fax Group 2/3 */
43#define ISDN_PROTO_L2_HDLC_56K 12 /* HDLC 56k */
44#define ISDN_PROTO_L2_MAX 15 /* Max. 16 Protocols */
45
46/*
47 * Values for Layer-3-protocol-selection
48 */
49#define ISDN_PROTO_L3_TRANS 0 /* Transparent */
50#define ISDN_PROTO_L3_TRANSDSP 1 /* Transparent with DSP */
51#define ISDN_PROTO_L3_FCLASS2 2 /* Fax Group 2/3 CLASS 2 */
52#define ISDN_PROTO_L3_FCLASS1 3 /* Fax Group 2/3 CLASS 1 */
53#define ISDN_PROTO_L3_MAX 7 /* Max. 8 Protocols */
54
55#ifdef __KERNEL__
56
57#include <linux/skbuff.h> 17#include <linux/skbuff.h>
18#include <uapi/linux/isdnif.h>
58 19
59/***************************************************************************/ 20/***************************************************************************/
60/* Extensions made by Werner Cornelius (werner@ikt.de) */ 21/* Extensions made by Werner Cornelius (werner@ikt.de) */
@@ -541,6 +502,4 @@ typedef struct {
541extern int register_isdn(isdn_if*); 502extern int register_isdn(isdn_if*);
542#include <asm/uaccess.h> 503#include <asm/uaccess.h>
543 504
544#endif /* __KERNEL__ */
545
546#endif /* __ISDNIF_H__ */ 505#endif /* __ISDNIF_H__ */
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 05e3c2c7a8cf..6b87413da9d6 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -51,31 +51,17 @@
51#define SH_DIV(NOM,DEN,LSH) ( (((NOM) / (DEN)) << (LSH)) \ 51#define SH_DIV(NOM,DEN,LSH) ( (((NOM) / (DEN)) << (LSH)) \
52 + ((((NOM) % (DEN)) << (LSH)) + (DEN) / 2) / (DEN)) 52 + ((((NOM) % (DEN)) << (LSH)) + (DEN) / 2) / (DEN))
53 53
54#ifdef CLOCK_TICK_RATE
55/* LATCH is used in the interval timer and ftape setup. */ 54/* LATCH is used in the interval timer and ftape setup. */
56# define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */ 55#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */
57 56
58/* 57extern int register_refined_jiffies(long clock_tick_rate);
59 * HZ is the requested value. However the CLOCK_TICK_RATE may not allow
60 * for exactly HZ. So SHIFTED_HZ is high res HZ ("<< 8" is for accuracy)
61 */
62# define SHIFTED_HZ (SH_DIV(CLOCK_TICK_RATE, LATCH, 8))
63#else
64# define SHIFTED_HZ (HZ << 8)
65#endif
66 58
67/* TICK_NSEC is the time between ticks in nsec assuming SHIFTED_HZ */ 59/* TICK_NSEC is the time between ticks in nsec assuming SHIFTED_HZ */
68#define TICK_NSEC (SH_DIV(1000000UL * 1000, SHIFTED_HZ, 8)) 60#define TICK_NSEC ((NSEC_PER_SEC+HZ/2)/HZ)
69 61
70/* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */ 62/* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */
71#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ) 63#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ)
72 64
73/*
74 * TICK_USEC_TO_NSEC is the time between ticks in nsec assuming SHIFTED_HZ and
75 * a value TUSEC for TICK_USEC (can be set bij adjtimex)
76 */
77#define TICK_USEC_TO_NSEC(TUSEC) (SH_DIV(TUSEC * USER_HZ * 1000, SHIFTED_HZ, 8))
78
79/* some arch's have a small-data section that can be accessed register-relative 65/* some arch's have a small-data section that can be accessed register-relative
80 * but that can only take up to, say, 4-byte variables. jiffies being part of 66 * but that can only take up to, say, 4-byte variables. jiffies being part of
81 * an 8-byte variable may not be correctly accessed unless we force the issue 67 * an 8-byte variable may not be correctly accessed unless we force the issue
diff --git a/include/linux/joystick.h b/include/linux/joystick.h
index 47199b13e0eb..cbf2aa9e93b9 100644
--- a/include/linux/joystick.h
+++ b/include/linux/joystick.h
@@ -1,12 +1,8 @@
1#ifndef _LINUX_JOYSTICK_H
2#define _LINUX_JOYSTICK_H
3
4/* 1/*
5 * Copyright (C) 1996-2000 Vojtech Pavlik 2 * Copyright (C) 1996-2000 Vojtech Pavlik
6 * 3 *
7 * Sponsored by SuSE 4 * Sponsored by SuSE
8 */ 5 */
9
10/* 6/*
11 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -26,113 +22,11 @@
26 * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail: 22 * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
27 * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic 23 * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
28 */ 24 */
25#ifndef _LINUX_JOYSTICK_H
26#define _LINUX_JOYSTICK_H
29 27
30#include <linux/types.h> 28#include <uapi/linux/joystick.h>
31#include <linux/input.h>
32
33/*
34 * Version
35 */
36
37#define JS_VERSION 0x020100
38
39/*
40 * Types and constants for reading from /dev/js
41 */
42
43#define JS_EVENT_BUTTON 0x01 /* button pressed/released */
44#define JS_EVENT_AXIS 0x02 /* joystick moved */
45#define JS_EVENT_INIT 0x80 /* initial state of device */
46
47struct js_event {
48 __u32 time; /* event timestamp in milliseconds */
49 __s16 value; /* value */
50 __u8 type; /* event type */
51 __u8 number; /* axis/button number */
52};
53
54/*
55 * IOCTL commands for joystick driver
56 */
57
58#define JSIOCGVERSION _IOR('j', 0x01, __u32) /* get driver version */
59
60#define JSIOCGAXES _IOR('j', 0x11, __u8) /* get number of axes */
61#define JSIOCGBUTTONS _IOR('j', 0x12, __u8) /* get number of buttons */
62#define JSIOCGNAME(len) _IOC(_IOC_READ, 'j', 0x13, len) /* get identifier string */
63
64#define JSIOCSCORR _IOW('j', 0x21, struct js_corr) /* set correction values */
65#define JSIOCGCORR _IOR('j', 0x22, struct js_corr) /* get correction values */
66
67#define JSIOCSAXMAP _IOW('j', 0x31, __u8[ABS_CNT]) /* set axis mapping */
68#define JSIOCGAXMAP _IOR('j', 0x32, __u8[ABS_CNT]) /* get axis mapping */
69#define JSIOCSBTNMAP _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1]) /* set button mapping */
70#define JSIOCGBTNMAP _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1]) /* get button mapping */
71
72/*
73 * Types and constants for get/set correction
74 */
75
76#define JS_CORR_NONE 0x00 /* returns raw values */
77#define JS_CORR_BROKEN 0x01 /* broken line */
78
79struct js_corr {
80 __s32 coef[8];
81 __s16 prec;
82 __u16 type;
83};
84
85/*
86 * v0.x compatibility definitions
87 */
88
89#define JS_RETURN sizeof(struct JS_DATA_TYPE)
90#define JS_TRUE 1
91#define JS_FALSE 0
92#define JS_X_0 0x01
93#define JS_Y_0 0x02
94#define JS_X_1 0x04
95#define JS_Y_1 0x08
96#define JS_MAX 2
97
98#define JS_DEF_TIMEOUT 0x1300
99#define JS_DEF_CORR 0
100#define JS_DEF_TIMELIMIT 10L
101
102#define JS_SET_CAL 1
103#define JS_GET_CAL 2
104#define JS_SET_TIMEOUT 3
105#define JS_GET_TIMEOUT 4
106#define JS_SET_TIMELIMIT 5
107#define JS_GET_TIMELIMIT 6
108#define JS_GET_ALL 7
109#define JS_SET_ALL 8
110
111struct JS_DATA_TYPE {
112 __s32 buttons;
113 __s32 x;
114 __s32 y;
115};
116
117struct JS_DATA_SAVE_TYPE_32 {
118 __s32 JS_TIMEOUT;
119 __s32 BUSY;
120 __s32 JS_EXPIRETIME;
121 __s32 JS_TIMELIMIT;
122 struct JS_DATA_TYPE JS_SAVE;
123 struct JS_DATA_TYPE JS_CORR;
124};
125
126struct JS_DATA_SAVE_TYPE_64 {
127 __s32 JS_TIMEOUT;
128 __s32 BUSY;
129 __s64 JS_EXPIRETIME;
130 __s64 JS_TIMELIMIT;
131 struct JS_DATA_TYPE JS_SAVE;
132 struct JS_DATA_TYPE JS_CORR;
133};
134 29
135#ifdef __KERNEL__
136#if BITS_PER_LONG == 64 30#if BITS_PER_LONG == 64
137#define JS_DATA_SAVE_TYPE JS_DATA_SAVE_TYPE_64 31#define JS_DATA_SAVE_TYPE JS_DATA_SAVE_TYPE_64
138#elif BITS_PER_LONG == 32 32#elif BITS_PER_LONG == 32
@@ -140,6 +34,4 @@ struct JS_DATA_SAVE_TYPE_64 {
140#else 34#else
141#error Unexpected BITS_PER_LONG 35#error Unexpected BITS_PER_LONG
142#endif 36#endif
143#endif
144
145#endif /* _LINUX_JOYSTICK_H */ 37#endif /* _LINUX_JOYSTICK_H */
diff --git a/include/linux/kd.h b/include/linux/kd.h
index c36d8476db55..25bd17fad239 100644
--- a/include/linux/kd.h
+++ b/include/linux/kd.h
@@ -1,186 +1,7 @@
1#ifndef _LINUX_KD_H 1#ifndef _LINUX_KD_H
2#define _LINUX_KD_H 2#define _LINUX_KD_H
3#include <linux/types.h>
4#include <linux/compiler.h>
5 3
6/* 0x4B is 'K', to avoid collision with termios and vt */ 4#include <uapi/linux/kd.h>
7 5
8#define GIO_FONT 0x4B60 /* gets font in expanded form */
9#define PIO_FONT 0x4B61 /* use font in expanded form */
10
11#define GIO_FONTX 0x4B6B /* get font using struct consolefontdesc */
12#define PIO_FONTX 0x4B6C /* set font using struct consolefontdesc */
13struct consolefontdesc {
14 unsigned short charcount; /* characters in font (256 or 512) */
15 unsigned short charheight; /* scan lines per character (1-32) */
16 char __user *chardata; /* font data in expanded form */
17};
18
19#define PIO_FONTRESET 0x4B6D /* reset to default font */
20
21#define GIO_CMAP 0x4B70 /* gets colour palette on VGA+ */
22#define PIO_CMAP 0x4B71 /* sets colour palette on VGA+ */
23
24#define KIOCSOUND 0x4B2F /* start sound generation (0 for off) */
25#define KDMKTONE 0x4B30 /* generate tone */
26
27#define KDGETLED 0x4B31 /* return current led state */
28#define KDSETLED 0x4B32 /* set led state [lights, not flags] */
29#define LED_SCR 0x01 /* scroll lock led */
30#define LED_NUM 0x02 /* num lock led */
31#define LED_CAP 0x04 /* caps lock led */
32
33#define KDGKBTYPE 0x4B33 /* get keyboard type */
34#define KB_84 0x01
35#define KB_101 0x02 /* this is what we always answer */
36#define KB_OTHER 0x03
37
38#define KDADDIO 0x4B34 /* add i/o port as valid */
39#define KDDELIO 0x4B35 /* del i/o port as valid */
40#define KDENABIO 0x4B36 /* enable i/o to video board */
41#define KDDISABIO 0x4B37 /* disable i/o to video board */
42
43#define KDSETMODE 0x4B3A /* set text/graphics mode */
44#define KD_TEXT 0x00
45#define KD_GRAPHICS 0x01
46#define KD_TEXT0 0x02 /* obsolete */
47#define KD_TEXT1 0x03 /* obsolete */
48#define KDGETMODE 0x4B3B /* get current mode */
49
50#define KDMAPDISP 0x4B3C /* map display into address space */
51#define KDUNMAPDISP 0x4B3D /* unmap display from address space */
52
53typedef char scrnmap_t;
54#define E_TABSZ 256
55#define GIO_SCRNMAP 0x4B40 /* get screen mapping from kernel */
56#define PIO_SCRNMAP 0x4B41 /* put screen mapping table in kernel */
57#define GIO_UNISCRNMAP 0x4B69 /* get full Unicode screen mapping */
58#define PIO_UNISCRNMAP 0x4B6A /* set full Unicode screen mapping */
59
60#define GIO_UNIMAP 0x4B66 /* get unicode-to-font mapping from kernel */
61struct unipair {
62 unsigned short unicode;
63 unsigned short fontpos;
64};
65struct unimapdesc {
66 unsigned short entry_ct;
67 struct unipair __user *entries;
68};
69#define PIO_UNIMAP 0x4B67 /* put unicode-to-font mapping in kernel */
70#define PIO_UNIMAPCLR 0x4B68 /* clear table, possibly advise hash algorithm */
71struct unimapinit {
72 unsigned short advised_hashsize; /* 0 if no opinion */
73 unsigned short advised_hashstep; /* 0 if no opinion */
74 unsigned short advised_hashlevel; /* 0 if no opinion */
75};
76
77#define UNI_DIRECT_BASE 0xF000 /* start of Direct Font Region */
78#define UNI_DIRECT_MASK 0x01FF /* Direct Font Region bitmask */
79
80#define K_RAW 0x00
81#define K_XLATE 0x01
82#define K_MEDIUMRAW 0x02
83#define K_UNICODE 0x03
84#define K_OFF 0x04
85#define KDGKBMODE 0x4B44 /* gets current keyboard mode */
86#define KDSKBMODE 0x4B45 /* sets current keyboard mode */
87
88#define K_METABIT 0x03
89#define K_ESCPREFIX 0x04
90#define KDGKBMETA 0x4B62 /* gets meta key handling mode */
91#define KDSKBMETA 0x4B63 /* sets meta key handling mode */
92
93#define K_SCROLLLOCK 0x01
94#define K_NUMLOCK 0x02
95#define K_CAPSLOCK 0x04
96#define KDGKBLED 0x4B64 /* get led flags (not lights) */
97#define KDSKBLED 0x4B65 /* set led flags (not lights) */
98
99struct kbentry {
100 unsigned char kb_table;
101 unsigned char kb_index;
102 unsigned short kb_value;
103};
104#define K_NORMTAB 0x00
105#define K_SHIFTTAB 0x01
106#define K_ALTTAB 0x02
107#define K_ALTSHIFTTAB 0x03
108
109#define KDGKBENT 0x4B46 /* gets one entry in translation table */
110#define KDSKBENT 0x4B47 /* sets one entry in translation table */
111
112struct kbsentry {
113 unsigned char kb_func;
114 unsigned char kb_string[512];
115};
116#define KDGKBSENT 0x4B48 /* gets one function key string entry */
117#define KDSKBSENT 0x4B49 /* sets one function key string entry */
118
119struct kbdiacr {
120 unsigned char diacr, base, result;
121};
122struct kbdiacrs {
123 unsigned int kb_cnt; /* number of entries in following array */
124 struct kbdiacr kbdiacr[256]; /* MAX_DIACR from keyboard.h */
125};
126#define KDGKBDIACR 0x4B4A /* read kernel accent table */
127#define KDSKBDIACR 0x4B4B /* write kernel accent table */
128
129struct kbdiacruc {
130 unsigned int diacr, base, result;
131};
132struct kbdiacrsuc {
133 unsigned int kb_cnt; /* number of entries in following array */
134 struct kbdiacruc kbdiacruc[256]; /* MAX_DIACR from keyboard.h */
135};
136#define KDGKBDIACRUC 0x4BFA /* read kernel accent table - UCS */
137#define KDSKBDIACRUC 0x4BFB /* write kernel accent table - UCS */
138
139struct kbkeycode {
140 unsigned int scancode, keycode;
141};
142#define KDGETKEYCODE 0x4B4C /* read kernel keycode table entry */
143#define KDSETKEYCODE 0x4B4D /* write kernel keycode table entry */
144
145#define KDSIGACCEPT 0x4B4E /* accept kbd generated signals */
146
147struct kbd_repeat {
148 int delay; /* in msec; <= 0: don't change */
149 int period; /* in msec; <= 0: don't change */
150 /* earlier this field was misnamed "rate" */
151};
152
153#define KDKBDREP 0x4B52 /* set keyboard delay/repeat rate;
154 * actually used values are returned */
155
156#define KDFONTOP 0x4B72 /* font operations */
157
158struct console_font_op {
159 unsigned int op; /* operation code KD_FONT_OP_* */
160 unsigned int flags; /* KD_FONT_FLAG_* */
161 unsigned int width, height; /* font size */
162 unsigned int charcount;
163 unsigned char __user *data; /* font data with height fixed to 32 */
164};
165
166struct console_font {
167 unsigned int width, height; /* font size */
168 unsigned int charcount;
169 unsigned char *data; /* font data with height fixed to 32 */
170};
171
172#define KD_FONT_OP_SET 0 /* Set font */
173#define KD_FONT_OP_GET 1 /* Get font */
174#define KD_FONT_OP_SET_DEFAULT 2 /* Set font to default, data points to name / NULL */
175#define KD_FONT_OP_COPY 3 /* Copy from another console */
176
177#define KD_FONT_FLAG_DONT_RECALC 1 /* Don't recalculate hw charcell size [compat] */
178#ifdef __KERNEL__
179#define KD_FONT_FLAG_OLD 0x80000000 /* Invoked via old interface [compat] */ 6#define KD_FONT_FLAG_OLD 0x80000000 /* Invoked via old interface [compat] */
180#endif
181
182/* note: 0x4B00-0x4B4E all have had a value at some time;
183 don't reuse for the time being */
184/* note: 0x4B60-0x4B6D, 0x4B70-0x4B72 used above */
185
186#endif /* _LINUX_KD_H */ 7#endif /* _LINUX_KD_H */
diff --git a/include/linux/kdev_t.h b/include/linux/kdev_t.h
index 2dacab8beccb..c838abe3ee0a 100644
--- a/include/linux/kdev_t.h
+++ b/include/linux/kdev_t.h
@@ -1,6 +1,8 @@
1#ifndef _LINUX_KDEV_T_H 1#ifndef _LINUX_KDEV_T_H
2#define _LINUX_KDEV_T_H 2#define _LINUX_KDEV_T_H
3#ifdef __KERNEL__ 3
4#include <uapi/linux/kdev_t.h>
5
4#define MINORBITS 20 6#define MINORBITS 20
5#define MINORMASK ((1U << MINORBITS) - 1) 7#define MINORMASK ((1U << MINORBITS) - 1)
6 8
@@ -87,14 +89,4 @@ static inline unsigned sysv_minor(u32 dev)
87 return dev & 0x3ffff; 89 return dev & 0x3ffff;
88} 90}
89 91
90#else /* __KERNEL__ */
91
92/*
93Some programs want their definitions of MAJOR and MINOR and MKDEV
94from the kernel sources. These must be the externally visible ones.
95*/
96#define MAJOR(dev) ((dev)>>8)
97#define MINOR(dev) ((dev) & 0xff)
98#define MKDEV(ma,mi) ((ma)<<8 | (mi))
99#endif /* __KERNEL__ */
100#endif 92#endif
diff --git a/include/linux/kernel-page-flags.h b/include/linux/kernel-page-flags.h
index a1bdf6966357..546eb6a76934 100644
--- a/include/linux/kernel-page-flags.h
+++ b/include/linux/kernel-page-flags.h
@@ -1,38 +1,8 @@
1#ifndef LINUX_KERNEL_PAGE_FLAGS_H 1#ifndef LINUX_KERNEL_PAGE_FLAGS_H
2#define LINUX_KERNEL_PAGE_FLAGS_H 2#define LINUX_KERNEL_PAGE_FLAGS_H
3 3
4/* 4#include <uapi/linux/kernel-page-flags.h>
5 * Stable page flag bits exported to user space
6 */
7
8#define KPF_LOCKED 0
9#define KPF_ERROR 1
10#define KPF_REFERENCED 2
11#define KPF_UPTODATE 3
12#define KPF_DIRTY 4
13#define KPF_LRU 5
14#define KPF_ACTIVE 6
15#define KPF_SLAB 7
16#define KPF_WRITEBACK 8
17#define KPF_RECLAIM 9
18#define KPF_BUDDY 10
19
20/* 11-20: new additions in 2.6.31 */
21#define KPF_MMAP 11
22#define KPF_ANON 12
23#define KPF_SWAPCACHE 13
24#define KPF_SWAPBACKED 14
25#define KPF_COMPOUND_HEAD 15
26#define KPF_COMPOUND_TAIL 16
27#define KPF_HUGE 17
28#define KPF_UNEVICTABLE 18
29#define KPF_HWPOISON 19
30#define KPF_NOPAGE 20
31 5
32#define KPF_KSM 21
33#define KPF_THP 22
34
35#ifdef __KERNEL__
36 6
37/* kernel hacking assistances 7/* kernel hacking assistances
38 * WARNING: subject to change, never rely on them! 8 * WARNING: subject to change, never rely on them!
@@ -46,6 +16,4 @@
46#define KPF_ARCH 38 16#define KPF_ARCH 38
47#define KPF_UNCACHED 39 17#define KPF_UNCACHED 39
48 18
49#endif /* __KERNEL__ */
50
51#endif /* LINUX_KERNEL_PAGE_FLAGS_H */ 19#endif /* LINUX_KERNEL_PAGE_FLAGS_H */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 2451f1f7a1d9..a123b13b70fd 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -1,15 +1,6 @@
1#ifndef _LINUX_KERNEL_H 1#ifndef _LINUX_KERNEL_H
2#define _LINUX_KERNEL_H 2#define _LINUX_KERNEL_H
3 3
4#include <linux/sysinfo.h>
5
6/*
7 * 'kernel.h' contains some often-used function prototypes etc
8 */
9#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
10#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
11
12#ifdef __KERNEL__
13 4
14#include <stdarg.h> 5#include <stdarg.h>
15#include <linux/linkage.h> 6#include <linux/linkage.h>
@@ -22,6 +13,7 @@
22#include <linux/printk.h> 13#include <linux/printk.h>
23#include <linux/dynamic_debug.h> 14#include <linux/dynamic_debug.h>
24#include <asm/byteorder.h> 15#include <asm/byteorder.h>
16#include <uapi/linux/kernel.h>
25 17
26#define USHRT_MAX ((u16)(~0U)) 18#define USHRT_MAX ((u16)(~0U))
27#define SHRT_MAX ((s16)(USHRT_MAX>>1)) 19#define SHRT_MAX ((s16)(USHRT_MAX>>1))
@@ -716,6 +708,4 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
716 708
717extern int do_sysinfo(struct sysinfo *info); 709extern int do_sysinfo(struct sysinfo *info);
718 710
719#endif /* __KERNEL__ */
720
721#endif 711#endif
diff --git a/include/linux/kernelcapi.h b/include/linux/kernelcapi.h
index 9c2683929fd3..9be37da93680 100644
--- a/include/linux/kernelcapi.h
+++ b/include/linux/kernelcapi.h
@@ -6,49 +6,15 @@
6 * (c) Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de) 6 * (c) Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
7 * 7 *
8 */ 8 */
9
10#ifndef __KERNELCAPI_H__ 9#ifndef __KERNELCAPI_H__
11#define __KERNELCAPI_H__ 10#define __KERNELCAPI_H__
12 11
13#define CAPI_MAXAPPL 240 /* maximum number of applications */
14#define CAPI_MAXCONTR 32 /* maximum number of controller */
15#define CAPI_MAXDATAWINDOW 8
16
17
18typedef struct kcapi_flagdef {
19 int contr;
20 int flag;
21} kcapi_flagdef;
22
23typedef struct kcapi_carddef {
24 char driver[32];
25 unsigned int port;
26 unsigned irq;
27 unsigned int membase;
28 int cardnr;
29} kcapi_carddef;
30
31/* new ioctls >= 10 */
32#define KCAPI_CMD_TRACE 10
33#define KCAPI_CMD_ADDCARD 11 /* OBSOLETE */
34
35/*
36 * flag > 2 => trace also data
37 * flag & 1 => show trace
38 */
39#define KCAPI_TRACE_OFF 0
40#define KCAPI_TRACE_SHORT_NO_DATA 1
41#define KCAPI_TRACE_FULL_NO_DATA 2
42#define KCAPI_TRACE_SHORT 3
43#define KCAPI_TRACE_FULL 4
44
45
46#ifdef __KERNEL__
47 12
48#include <linux/list.h> 13#include <linux/list.h>
49#include <linux/skbuff.h> 14#include <linux/skbuff.h>
50#include <linux/workqueue.h> 15#include <linux/workqueue.h>
51#include <linux/notifier.h> 16#include <linux/notifier.h>
17#include <uapi/linux/kernelcapi.h>
52 18
53struct capi20_appl { 19struct capi20_appl {
54 u16 applid; 20 u16 applid;
@@ -150,6 +116,4 @@ typedef enum {
150 CapiCallGivenToOtherApplication = 0x3304, 116 CapiCallGivenToOtherApplication = 0x3304,
151} CAPI_REASON; 117} CAPI_REASON;
152 118
153#endif /* __KERNEL__ */
154
155#endif /* __KERNELCAPI_H__ */ 119#endif /* __KERNELCAPI_H__ */
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 37c5f7261142..d0b8458a703a 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -1,57 +1,8 @@
1#ifndef LINUX_KEXEC_H 1#ifndef LINUX_KEXEC_H
2#define LINUX_KEXEC_H 2#define LINUX_KEXEC_H
3 3
4/* kexec system call - It loads the new kernel to boot into. 4#include <uapi/linux/kexec.h>
5 * kexec does not sync, or unmount filesystems so if you need
6 * that to happen you need to do that yourself.
7 */
8
9#include <linux/types.h>
10
11/* kexec flags for different usage scenarios */
12#define KEXEC_ON_CRASH 0x00000001
13#define KEXEC_PRESERVE_CONTEXT 0x00000002
14#define KEXEC_ARCH_MASK 0xffff0000
15
16/* These values match the ELF architecture values.
17 * Unless there is a good reason that should continue to be the case.
18 */
19#define KEXEC_ARCH_DEFAULT ( 0 << 16)
20#define KEXEC_ARCH_386 ( 3 << 16)
21#define KEXEC_ARCH_X86_64 (62 << 16)
22#define KEXEC_ARCH_PPC (20 << 16)
23#define KEXEC_ARCH_PPC64 (21 << 16)
24#define KEXEC_ARCH_IA_64 (50 << 16)
25#define KEXEC_ARCH_ARM (40 << 16)
26#define KEXEC_ARCH_S390 (22 << 16)
27#define KEXEC_ARCH_SH (42 << 16)
28#define KEXEC_ARCH_MIPS_LE (10 << 16)
29#define KEXEC_ARCH_MIPS ( 8 << 16)
30
31/* The artificial cap on the number of segments passed to kexec_load. */
32#define KEXEC_SEGMENT_MAX 16
33
34#ifndef __KERNEL__
35/*
36 * This structure is used to hold the arguments that are used when
37 * loading kernel binaries.
38 */
39struct kexec_segment {
40 const void *buf;
41 size_t bufsz;
42 const void *mem;
43 size_t memsz;
44};
45
46/* Load a new kernel image as described by the kexec_segment array
47 * consisting of passed number of segments at the entry-point address.
48 * The flags allow different useage types.
49 */
50extern int kexec_load(void *, size_t, struct kexec_segment *,
51 unsigned long int);
52#endif /* __KERNEL__ */
53 5
54#ifdef __KERNEL__
55#ifdef CONFIG_KEXEC 6#ifdef CONFIG_KEXEC
56#include <linux/list.h> 7#include <linux/list.h>
57#include <linux/linkage.h> 8#include <linux/linkage.h>
@@ -258,5 +209,4 @@ struct task_struct;
258static inline void crash_kexec(struct pt_regs *regs) { } 209static inline void crash_kexec(struct pt_regs *regs) { }
259static inline int kexec_should_crash(struct task_struct *p) { return 0; } 210static inline int kexec_should_crash(struct task_struct *p) { return 0; }
260#endif /* CONFIG_KEXEC */ 211#endif /* CONFIG_KEXEC */
261#endif /* __KERNEL__ */
262#endif /* LINUX_KEXEC_H */ 212#endif /* LINUX_KEXEC_H */
diff --git a/include/linux/key-type.h b/include/linux/key-type.h
index f0c651cda7b0..518a53afb9ea 100644
--- a/include/linux/key-type.h
+++ b/include/linux/key-type.h
@@ -26,6 +26,27 @@ struct key_construction {
26 struct key *authkey;/* authorisation for key being constructed */ 26 struct key *authkey;/* authorisation for key being constructed */
27}; 27};
28 28
29/*
30 * Pre-parsed payload, used by key add, update and instantiate.
31 *
32 * This struct will be cleared and data and datalen will be set with the data
33 * and length parameters from the caller and quotalen will be set from
34 * def_datalen from the key type. Then if the preparse() op is provided by the
35 * key type, that will be called. Then the struct will be passed to the
36 * instantiate() or the update() op.
37 *
38 * If the preparse() op is given, the free_preparse() op will be called to
39 * clear the contents.
40 */
41struct key_preparsed_payload {
42 char *description; /* Proposed key description (or NULL) */
43 void *type_data[2]; /* Private key-type data */
44 void *payload; /* Proposed payload */
45 const void *data; /* Raw data */
46 size_t datalen; /* Raw datalen */
47 size_t quotalen; /* Quota length for proposed payload */
48};
49
29typedef int (*request_key_actor_t)(struct key_construction *key, 50typedef int (*request_key_actor_t)(struct key_construction *key,
30 const char *op, void *aux); 51 const char *op, void *aux);
31 52
@@ -45,18 +66,28 @@ struct key_type {
45 /* vet a description */ 66 /* vet a description */
46 int (*vet_description)(const char *description); 67 int (*vet_description)(const char *description);
47 68
69 /* Preparse the data blob from userspace that is to be the payload,
70 * generating a proposed description and payload that will be handed to
71 * the instantiate() and update() ops.
72 */
73 int (*preparse)(struct key_preparsed_payload *prep);
74
75 /* Free a preparse data structure.
76 */
77 void (*free_preparse)(struct key_preparsed_payload *prep);
78
48 /* instantiate a key of this type 79 /* instantiate a key of this type
49 * - this method should call key_payload_reserve() to determine if the 80 * - this method should call key_payload_reserve() to determine if the
50 * user's quota will hold the payload 81 * user's quota will hold the payload
51 */ 82 */
52 int (*instantiate)(struct key *key, const void *data, size_t datalen); 83 int (*instantiate)(struct key *key, struct key_preparsed_payload *prep);
53 84
54 /* update a key of this type (optional) 85 /* update a key of this type (optional)
55 * - this method should call key_payload_reserve() to recalculate the 86 * - this method should call key_payload_reserve() to recalculate the
56 * quota consumption 87 * quota consumption
57 * - the key must be locked against read when modifying 88 * - the key must be locked against read when modifying
58 */ 89 */
59 int (*update)(struct key *key, const void *data, size_t datalen); 90 int (*update)(struct key *key, struct key_preparsed_payload *prep);
60 91
61 /* match a key against a description */ 92 /* match a key against a description */
62 int (*match)(const struct key *key, const void *desc); 93 int (*match)(const struct key *key, const void *desc);
diff --git a/include/linux/keyboard.h b/include/linux/keyboard.h
index 86e5214ae735..131ed5146521 100644
--- a/include/linux/keyboard.h
+++ b/include/linux/keyboard.h
@@ -1,28 +1,8 @@
1#ifndef __LINUX_KEYBOARD_H 1#ifndef __LINUX_KEYBOARD_H
2#define __LINUX_KEYBOARD_H 2#define __LINUX_KEYBOARD_H
3 3
4#include <linux/wait.h> 4#include <uapi/linux/keyboard.h>
5 5
6#define KG_SHIFT 0
7#define KG_CTRL 2
8#define KG_ALT 3
9#define KG_ALTGR 1
10#define KG_SHIFTL 4
11#define KG_KANASHIFT 4
12#define KG_SHIFTR 5
13#define KG_CTRLL 6
14#define KG_CTRLR 7
15#define KG_CAPSSHIFT 8
16
17#define NR_SHIFT 9
18
19#define NR_KEYS 256
20#define MAX_NR_KEYMAPS 256
21/* This means 128Kb if all keymaps are allocated. Only the superuser
22 may increase the number of keymaps beyond MAX_NR_OF_USER_KEYMAPS. */
23#define MAX_NR_OF_USER_KEYMAPS 256 /* should be at least 7 */
24
25#ifdef __KERNEL__
26struct notifier_block; 6struct notifier_block;
27extern unsigned short *key_maps[MAX_NR_KEYMAPS]; 7extern unsigned short *key_maps[MAX_NR_KEYMAPS];
28extern unsigned short plain_map[NR_KEYS]; 8extern unsigned short plain_map[NR_KEYS];
@@ -38,422 +18,3 @@ struct keyboard_notifier_param {
38extern int register_keyboard_notifier(struct notifier_block *nb); 18extern int register_keyboard_notifier(struct notifier_block *nb);
39extern int unregister_keyboard_notifier(struct notifier_block *nb); 19extern int unregister_keyboard_notifier(struct notifier_block *nb);
40#endif 20#endif
41
42#define MAX_NR_FUNC 256 /* max nr of strings assigned to keys */
43
44#define KT_LATIN 0 /* we depend on this being zero */
45#define KT_LETTER 11 /* symbol that can be acted upon by CapsLock */
46#define KT_FN 1
47#define KT_SPEC 2
48#define KT_PAD 3
49#define KT_DEAD 4
50#define KT_CONS 5
51#define KT_CUR 6
52#define KT_SHIFT 7
53#define KT_META 8
54#define KT_ASCII 9
55#define KT_LOCK 10
56#define KT_SLOCK 12
57#define KT_DEAD2 13
58#define KT_BRL 14
59
60#define K(t,v) (((t)<<8)|(v))
61#define KTYP(x) ((x) >> 8)
62#define KVAL(x) ((x) & 0xff)
63
64#define K_F1 K(KT_FN,0)
65#define K_F2 K(KT_FN,1)
66#define K_F3 K(KT_FN,2)
67#define K_F4 K(KT_FN,3)
68#define K_F5 K(KT_FN,4)
69#define K_F6 K(KT_FN,5)
70#define K_F7 K(KT_FN,6)
71#define K_F8 K(KT_FN,7)
72#define K_F9 K(KT_FN,8)
73#define K_F10 K(KT_FN,9)
74#define K_F11 K(KT_FN,10)
75#define K_F12 K(KT_FN,11)
76#define K_F13 K(KT_FN,12)
77#define K_F14 K(KT_FN,13)
78#define K_F15 K(KT_FN,14)
79#define K_F16 K(KT_FN,15)
80#define K_F17 K(KT_FN,16)
81#define K_F18 K(KT_FN,17)
82#define K_F19 K(KT_FN,18)
83#define K_F20 K(KT_FN,19)
84#define K_FIND K(KT_FN,20)
85#define K_INSERT K(KT_FN,21)
86#define K_REMOVE K(KT_FN,22)
87#define K_SELECT K(KT_FN,23)
88#define K_PGUP K(KT_FN,24) /* PGUP is a synonym for PRIOR */
89#define K_PGDN K(KT_FN,25) /* PGDN is a synonym for NEXT */
90#define K_MACRO K(KT_FN,26)
91#define K_HELP K(KT_FN,27)
92#define K_DO K(KT_FN,28)
93#define K_PAUSE K(KT_FN,29)
94#define K_F21 K(KT_FN,30)
95#define K_F22 K(KT_FN,31)
96#define K_F23 K(KT_FN,32)
97#define K_F24 K(KT_FN,33)
98#define K_F25 K(KT_FN,34)
99#define K_F26 K(KT_FN,35)
100#define K_F27 K(KT_FN,36)
101#define K_F28 K(KT_FN,37)
102#define K_F29 K(KT_FN,38)
103#define K_F30 K(KT_FN,39)
104#define K_F31 K(KT_FN,40)
105#define K_F32 K(KT_FN,41)
106#define K_F33 K(KT_FN,42)
107#define K_F34 K(KT_FN,43)
108#define K_F35 K(KT_FN,44)
109#define K_F36 K(KT_FN,45)
110#define K_F37 K(KT_FN,46)
111#define K_F38 K(KT_FN,47)
112#define K_F39 K(KT_FN,48)
113#define K_F40 K(KT_FN,49)
114#define K_F41 K(KT_FN,50)
115#define K_F42 K(KT_FN,51)
116#define K_F43 K(KT_FN,52)
117#define K_F44 K(KT_FN,53)
118#define K_F45 K(KT_FN,54)
119#define K_F46 K(KT_FN,55)
120#define K_F47 K(KT_FN,56)
121#define K_F48 K(KT_FN,57)
122#define K_F49 K(KT_FN,58)
123#define K_F50 K(KT_FN,59)
124#define K_F51 K(KT_FN,60)
125#define K_F52 K(KT_FN,61)
126#define K_F53 K(KT_FN,62)
127#define K_F54 K(KT_FN,63)
128#define K_F55 K(KT_FN,64)
129#define K_F56 K(KT_FN,65)
130#define K_F57 K(KT_FN,66)
131#define K_F58 K(KT_FN,67)
132#define K_F59 K(KT_FN,68)
133#define K_F60 K(KT_FN,69)
134#define K_F61 K(KT_FN,70)
135#define K_F62 K(KT_FN,71)
136#define K_F63 K(KT_FN,72)
137#define K_F64 K(KT_FN,73)
138#define K_F65 K(KT_FN,74)
139#define K_F66 K(KT_FN,75)
140#define K_F67 K(KT_FN,76)
141#define K_F68 K(KT_FN,77)
142#define K_F69 K(KT_FN,78)
143#define K_F70 K(KT_FN,79)
144#define K_F71 K(KT_FN,80)
145#define K_F72 K(KT_FN,81)
146#define K_F73 K(KT_FN,82)
147#define K_F74 K(KT_FN,83)
148#define K_F75 K(KT_FN,84)
149#define K_F76 K(KT_FN,85)
150#define K_F77 K(KT_FN,86)
151#define K_F78 K(KT_FN,87)
152#define K_F79 K(KT_FN,88)
153#define K_F80 K(KT_FN,89)
154#define K_F81 K(KT_FN,90)
155#define K_F82 K(KT_FN,91)
156#define K_F83 K(KT_FN,92)
157#define K_F84 K(KT_FN,93)
158#define K_F85 K(KT_FN,94)
159#define K_F86 K(KT_FN,95)
160#define K_F87 K(KT_FN,96)
161#define K_F88 K(KT_FN,97)
162#define K_F89 K(KT_FN,98)
163#define K_F90 K(KT_FN,99)
164#define K_F91 K(KT_FN,100)
165#define K_F92 K(KT_FN,101)
166#define K_F93 K(KT_FN,102)
167#define K_F94 K(KT_FN,103)
168#define K_F95 K(KT_FN,104)
169#define K_F96 K(KT_FN,105)
170#define K_F97 K(KT_FN,106)
171#define K_F98 K(KT_FN,107)
172#define K_F99 K(KT_FN,108)
173#define K_F100 K(KT_FN,109)
174#define K_F101 K(KT_FN,110)
175#define K_F102 K(KT_FN,111)
176#define K_F103 K(KT_FN,112)
177#define K_F104 K(KT_FN,113)
178#define K_F105 K(KT_FN,114)
179#define K_F106 K(KT_FN,115)
180#define K_F107 K(KT_FN,116)
181#define K_F108 K(KT_FN,117)
182#define K_F109 K(KT_FN,118)
183#define K_F110 K(KT_FN,119)
184#define K_F111 K(KT_FN,120)
185#define K_F112 K(KT_FN,121)
186#define K_F113 K(KT_FN,122)
187#define K_F114 K(KT_FN,123)
188#define K_F115 K(KT_FN,124)
189#define K_F116 K(KT_FN,125)
190#define K_F117 K(KT_FN,126)
191#define K_F118 K(KT_FN,127)
192#define K_F119 K(KT_FN,128)
193#define K_F120 K(KT_FN,129)
194#define K_F121 K(KT_FN,130)
195#define K_F122 K(KT_FN,131)
196#define K_F123 K(KT_FN,132)
197#define K_F124 K(KT_FN,133)
198#define K_F125 K(KT_FN,134)
199#define K_F126 K(KT_FN,135)
200#define K_F127 K(KT_FN,136)
201#define K_F128 K(KT_FN,137)
202#define K_F129 K(KT_FN,138)
203#define K_F130 K(KT_FN,139)
204#define K_F131 K(KT_FN,140)
205#define K_F132 K(KT_FN,141)
206#define K_F133 K(KT_FN,142)
207#define K_F134 K(KT_FN,143)
208#define K_F135 K(KT_FN,144)
209#define K_F136 K(KT_FN,145)
210#define K_F137 K(KT_FN,146)
211#define K_F138 K(KT_FN,147)
212#define K_F139 K(KT_FN,148)
213#define K_F140 K(KT_FN,149)
214#define K_F141 K(KT_FN,150)
215#define K_F142 K(KT_FN,151)
216#define K_F143 K(KT_FN,152)
217#define K_F144 K(KT_FN,153)
218#define K_F145 K(KT_FN,154)
219#define K_F146 K(KT_FN,155)
220#define K_F147 K(KT_FN,156)
221#define K_F148 K(KT_FN,157)
222#define K_F149 K(KT_FN,158)
223#define K_F150 K(KT_FN,159)
224#define K_F151 K(KT_FN,160)
225#define K_F152 K(KT_FN,161)
226#define K_F153 K(KT_FN,162)
227#define K_F154 K(KT_FN,163)
228#define K_F155 K(KT_FN,164)
229#define K_F156 K(KT_FN,165)
230#define K_F157 K(KT_FN,166)
231#define K_F158 K(KT_FN,167)
232#define K_F159 K(KT_FN,168)
233#define K_F160 K(KT_FN,169)
234#define K_F161 K(KT_FN,170)
235#define K_F162 K(KT_FN,171)
236#define K_F163 K(KT_FN,172)
237#define K_F164 K(KT_FN,173)
238#define K_F165 K(KT_FN,174)
239#define K_F166 K(KT_FN,175)
240#define K_F167 K(KT_FN,176)
241#define K_F168 K(KT_FN,177)
242#define K_F169 K(KT_FN,178)
243#define K_F170 K(KT_FN,179)
244#define K_F171 K(KT_FN,180)
245#define K_F172 K(KT_FN,181)
246#define K_F173 K(KT_FN,182)
247#define K_F174 K(KT_FN,183)
248#define K_F175 K(KT_FN,184)
249#define K_F176 K(KT_FN,185)
250#define K_F177 K(KT_FN,186)
251#define K_F178 K(KT_FN,187)
252#define K_F179 K(KT_FN,188)
253#define K_F180 K(KT_FN,189)
254#define K_F181 K(KT_FN,190)
255#define K_F182 K(KT_FN,191)
256#define K_F183 K(KT_FN,192)
257#define K_F184 K(KT_FN,193)
258#define K_F185 K(KT_FN,194)
259#define K_F186 K(KT_FN,195)
260#define K_F187 K(KT_FN,196)
261#define K_F188 K(KT_FN,197)
262#define K_F189 K(KT_FN,198)
263#define K_F190 K(KT_FN,199)
264#define K_F191 K(KT_FN,200)
265#define K_F192 K(KT_FN,201)
266#define K_F193 K(KT_FN,202)
267#define K_F194 K(KT_FN,203)
268#define K_F195 K(KT_FN,204)
269#define K_F196 K(KT_FN,205)
270#define K_F197 K(KT_FN,206)
271#define K_F198 K(KT_FN,207)
272#define K_F199 K(KT_FN,208)
273#define K_F200 K(KT_FN,209)
274#define K_F201 K(KT_FN,210)
275#define K_F202 K(KT_FN,211)
276#define K_F203 K(KT_FN,212)
277#define K_F204 K(KT_FN,213)
278#define K_F205 K(KT_FN,214)
279#define K_F206 K(KT_FN,215)
280#define K_F207 K(KT_FN,216)
281#define K_F208 K(KT_FN,217)
282#define K_F209 K(KT_FN,218)
283#define K_F210 K(KT_FN,219)
284#define K_F211 K(KT_FN,220)
285#define K_F212 K(KT_FN,221)
286#define K_F213 K(KT_FN,222)
287#define K_F214 K(KT_FN,223)
288#define K_F215 K(KT_FN,224)
289#define K_F216 K(KT_FN,225)
290#define K_F217 K(KT_FN,226)
291#define K_F218 K(KT_FN,227)
292#define K_F219 K(KT_FN,228)
293#define K_F220 K(KT_FN,229)
294#define K_F221 K(KT_FN,230)
295#define K_F222 K(KT_FN,231)
296#define K_F223 K(KT_FN,232)
297#define K_F224 K(KT_FN,233)
298#define K_F225 K(KT_FN,234)
299#define K_F226 K(KT_FN,235)
300#define K_F227 K(KT_FN,236)
301#define K_F228 K(KT_FN,237)
302#define K_F229 K(KT_FN,238)
303#define K_F230 K(KT_FN,239)
304#define K_F231 K(KT_FN,240)
305#define K_F232 K(KT_FN,241)
306#define K_F233 K(KT_FN,242)
307#define K_F234 K(KT_FN,243)
308#define K_F235 K(KT_FN,244)
309#define K_F236 K(KT_FN,245)
310#define K_F237 K(KT_FN,246)
311#define K_F238 K(KT_FN,247)
312#define K_F239 K(KT_FN,248)
313#define K_F240 K(KT_FN,249)
314#define K_F241 K(KT_FN,250)
315#define K_F242 K(KT_FN,251)
316#define K_F243 K(KT_FN,252)
317#define K_F244 K(KT_FN,253)
318#define K_F245 K(KT_FN,254)
319#define K_UNDO K(KT_FN,255)
320
321
322#define K_HOLE K(KT_SPEC,0)
323#define K_ENTER K(KT_SPEC,1)
324#define K_SH_REGS K(KT_SPEC,2)
325#define K_SH_MEM K(KT_SPEC,3)
326#define K_SH_STAT K(KT_SPEC,4)
327#define K_BREAK K(KT_SPEC,5)
328#define K_CONS K(KT_SPEC,6)
329#define K_CAPS K(KT_SPEC,7)
330#define K_NUM K(KT_SPEC,8)
331#define K_HOLD K(KT_SPEC,9)
332#define K_SCROLLFORW K(KT_SPEC,10)
333#define K_SCROLLBACK K(KT_SPEC,11)
334#define K_BOOT K(KT_SPEC,12)
335#define K_CAPSON K(KT_SPEC,13)
336#define K_COMPOSE K(KT_SPEC,14)
337#define K_SAK K(KT_SPEC,15)
338#define K_DECRCONSOLE K(KT_SPEC,16)
339#define K_INCRCONSOLE K(KT_SPEC,17)
340#define K_SPAWNCONSOLE K(KT_SPEC,18)
341#define K_BARENUMLOCK K(KT_SPEC,19)
342
343#define K_ALLOCATED K(KT_SPEC,126) /* dynamically allocated keymap */
344#define K_NOSUCHMAP K(KT_SPEC,127) /* returned by KDGKBENT */
345
346#define K_P0 K(KT_PAD,0)
347#define K_P1 K(KT_PAD,1)
348#define K_P2 K(KT_PAD,2)
349#define K_P3 K(KT_PAD,3)
350#define K_P4 K(KT_PAD,4)
351#define K_P5 K(KT_PAD,5)
352#define K_P6 K(KT_PAD,6)
353#define K_P7 K(KT_PAD,7)
354#define K_P8 K(KT_PAD,8)
355#define K_P9 K(KT_PAD,9)
356#define K_PPLUS K(KT_PAD,10) /* key-pad plus */
357#define K_PMINUS K(KT_PAD,11) /* key-pad minus */
358#define K_PSTAR K(KT_PAD,12) /* key-pad asterisk (star) */
359#define K_PSLASH K(KT_PAD,13) /* key-pad slash */
360#define K_PENTER K(KT_PAD,14) /* key-pad enter */
361#define K_PCOMMA K(KT_PAD,15) /* key-pad comma: kludge... */
362#define K_PDOT K(KT_PAD,16) /* key-pad dot (period): kludge... */
363#define K_PPLUSMINUS K(KT_PAD,17) /* key-pad plus/minus */
364#define K_PPARENL K(KT_PAD,18) /* key-pad left parenthesis */
365#define K_PPARENR K(KT_PAD,19) /* key-pad right parenthesis */
366
367#define NR_PAD 20
368
369#define K_DGRAVE K(KT_DEAD,0)
370#define K_DACUTE K(KT_DEAD,1)
371#define K_DCIRCM K(KT_DEAD,2)
372#define K_DTILDE K(KT_DEAD,3)
373#define K_DDIERE K(KT_DEAD,4)
374#define K_DCEDIL K(KT_DEAD,5)
375
376#define NR_DEAD 6
377
378#define K_DOWN K(KT_CUR,0)
379#define K_LEFT K(KT_CUR,1)
380#define K_RIGHT K(KT_CUR,2)
381#define K_UP K(KT_CUR,3)
382
383#define K_SHIFT K(KT_SHIFT,KG_SHIFT)
384#define K_CTRL K(KT_SHIFT,KG_CTRL)
385#define K_ALT K(KT_SHIFT,KG_ALT)
386#define K_ALTGR K(KT_SHIFT,KG_ALTGR)
387#define K_SHIFTL K(KT_SHIFT,KG_SHIFTL)
388#define K_SHIFTR K(KT_SHIFT,KG_SHIFTR)
389#define K_CTRLL K(KT_SHIFT,KG_CTRLL)
390#define K_CTRLR K(KT_SHIFT,KG_CTRLR)
391#define K_CAPSSHIFT K(KT_SHIFT,KG_CAPSSHIFT)
392
393#define K_ASC0 K(KT_ASCII,0)
394#define K_ASC1 K(KT_ASCII,1)
395#define K_ASC2 K(KT_ASCII,2)
396#define K_ASC3 K(KT_ASCII,3)
397#define K_ASC4 K(KT_ASCII,4)
398#define K_ASC5 K(KT_ASCII,5)
399#define K_ASC6 K(KT_ASCII,6)
400#define K_ASC7 K(KT_ASCII,7)
401#define K_ASC8 K(KT_ASCII,8)
402#define K_ASC9 K(KT_ASCII,9)
403#define K_HEX0 K(KT_ASCII,10)
404#define K_HEX1 K(KT_ASCII,11)
405#define K_HEX2 K(KT_ASCII,12)
406#define K_HEX3 K(KT_ASCII,13)
407#define K_HEX4 K(KT_ASCII,14)
408#define K_HEX5 K(KT_ASCII,15)
409#define K_HEX6 K(KT_ASCII,16)
410#define K_HEX7 K(KT_ASCII,17)
411#define K_HEX8 K(KT_ASCII,18)
412#define K_HEX9 K(KT_ASCII,19)
413#define K_HEXa K(KT_ASCII,20)
414#define K_HEXb K(KT_ASCII,21)
415#define K_HEXc K(KT_ASCII,22)
416#define K_HEXd K(KT_ASCII,23)
417#define K_HEXe K(KT_ASCII,24)
418#define K_HEXf K(KT_ASCII,25)
419
420#define NR_ASCII 26
421
422#define K_SHIFTLOCK K(KT_LOCK,KG_SHIFT)
423#define K_CTRLLOCK K(KT_LOCK,KG_CTRL)
424#define K_ALTLOCK K(KT_LOCK,KG_ALT)
425#define K_ALTGRLOCK K(KT_LOCK,KG_ALTGR)
426#define K_SHIFTLLOCK K(KT_LOCK,KG_SHIFTL)
427#define K_SHIFTRLOCK K(KT_LOCK,KG_SHIFTR)
428#define K_CTRLLLOCK K(KT_LOCK,KG_CTRLL)
429#define K_CTRLRLOCK K(KT_LOCK,KG_CTRLR)
430#define K_CAPSSHIFTLOCK K(KT_LOCK,KG_CAPSSHIFT)
431
432#define K_SHIFT_SLOCK K(KT_SLOCK,KG_SHIFT)
433#define K_CTRL_SLOCK K(KT_SLOCK,KG_CTRL)
434#define K_ALT_SLOCK K(KT_SLOCK,KG_ALT)
435#define K_ALTGR_SLOCK K(KT_SLOCK,KG_ALTGR)
436#define K_SHIFTL_SLOCK K(KT_SLOCK,KG_SHIFTL)
437#define K_SHIFTR_SLOCK K(KT_SLOCK,KG_SHIFTR)
438#define K_CTRLL_SLOCK K(KT_SLOCK,KG_CTRLL)
439#define K_CTRLR_SLOCK K(KT_SLOCK,KG_CTRLR)
440#define K_CAPSSHIFT_SLOCK K(KT_SLOCK,KG_CAPSSHIFT)
441
442#define NR_LOCK 9
443
444#define K_BRL_BLANK K(KT_BRL, 0)
445#define K_BRL_DOT1 K(KT_BRL, 1)
446#define K_BRL_DOT2 K(KT_BRL, 2)
447#define K_BRL_DOT3 K(KT_BRL, 3)
448#define K_BRL_DOT4 K(KT_BRL, 4)
449#define K_BRL_DOT5 K(KT_BRL, 5)
450#define K_BRL_DOT6 K(KT_BRL, 6)
451#define K_BRL_DOT7 K(KT_BRL, 7)
452#define K_BRL_DOT8 K(KT_BRL, 8)
453#define K_BRL_DOT9 K(KT_BRL, 9)
454#define K_BRL_DOT10 K(KT_BRL, 10)
455
456#define NR_BRL 11
457
458#define MAX_DIACR 256
459#endif
diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h
index ff476ddaf310..00a97bb905db 100644
--- a/include/linux/kvm_para.h
+++ b/include/linux/kvm_para.h
@@ -1,31 +1,8 @@
1#ifndef __LINUX_KVM_PARA_H 1#ifndef __LINUX_KVM_PARA_H
2#define __LINUX_KVM_PARA_H 2#define __LINUX_KVM_PARA_H
3 3
4/* 4#include <uapi/linux/kvm_para.h>
5 * This header file provides a method for making a hypercall to the host
6 * Architectures should define:
7 * - kvm_hypercall0, kvm_hypercall1...
8 * - kvm_arch_para_features
9 * - kvm_para_available
10 */
11 5
12/* Return values for hypercalls */
13#define KVM_ENOSYS 1000
14#define KVM_EFAULT EFAULT
15#define KVM_E2BIG E2BIG
16#define KVM_EPERM EPERM
17
18#define KVM_HC_VAPIC_POLL_IRQ 1
19#define KVM_HC_MMU_OP 2
20#define KVM_HC_FEATURES 3
21#define KVM_HC_PPC_MAP_MAGIC_PAGE 4
22
23/*
24 * hypercalls use architecture specific
25 */
26#include <asm/kvm_para.h>
27
28#ifdef __KERNEL__
29 6
30static inline int kvm_para_has_feature(unsigned int feature) 7static inline int kvm_para_has_feature(unsigned int feature)
31{ 8{
@@ -33,5 +10,4 @@ static inline int kvm_para_has_feature(unsigned int feature)
33 return 1; 10 return 1;
34 return 0; 11 return 0;
35} 12}
36#endif /* __KERNEL__ */
37#endif /* __LINUX_KVM_PARA_H */ 13#endif /* __LINUX_KVM_PARA_H */
diff --git a/include/linux/l2tp.h b/include/linux/l2tp.h
index 7eab668f60f3..bffdb962f1a6 100644
--- a/include/linux/l2tp.h
+++ b/include/linux/l2tp.h
@@ -3,181 +3,11 @@
3 * 3 *
4 * Author: James Chapman <jchapman@katalix.com> 4 * Author: James Chapman <jchapman@katalix.com>
5 */ 5 */
6
7#ifndef _LINUX_L2TP_H_ 6#ifndef _LINUX_L2TP_H_
8#define _LINUX_L2TP_H_ 7#define _LINUX_L2TP_H_
9 8
10#include <linux/types.h>
11#include <linux/socket.h>
12#ifdef __KERNEL__
13#include <linux/in.h> 9#include <linux/in.h>
14#include <linux/in6.h> 10#include <linux/in6.h>
15#else 11#include <uapi/linux/l2tp.h>
16#include <netinet/in.h>
17#endif
18
19#define IPPROTO_L2TP 115
20
21/**
22 * struct sockaddr_l2tpip - the sockaddr structure for L2TP-over-IP sockets
23 * @l2tp_family: address family number AF_L2TPIP.
24 * @l2tp_addr: protocol specific address information
25 * @l2tp_conn_id: connection id of tunnel
26 */
27#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */
28struct sockaddr_l2tpip {
29 /* The first fields must match struct sockaddr_in */
30 __kernel_sa_family_t l2tp_family; /* AF_INET */
31 __be16 l2tp_unused; /* INET port number (unused) */
32 struct in_addr l2tp_addr; /* Internet address */
33
34 __u32 l2tp_conn_id; /* Connection ID of tunnel */
35
36 /* Pad to size of `struct sockaddr'. */
37 unsigned char __pad[sizeof(struct sockaddr) -
38 sizeof(__kernel_sa_family_t) -
39 sizeof(__be16) - sizeof(struct in_addr) -
40 sizeof(__u32)];
41};
42
43/**
44 * struct sockaddr_l2tpip6 - the sockaddr structure for L2TP-over-IPv6 sockets
45 * @l2tp_family: address family number AF_L2TPIP.
46 * @l2tp_addr: protocol specific address information
47 * @l2tp_conn_id: connection id of tunnel
48 */
49struct sockaddr_l2tpip6 {
50 /* The first fields must match struct sockaddr_in6 */
51 __kernel_sa_family_t l2tp_family; /* AF_INET6 */
52 __be16 l2tp_unused; /* INET port number (unused) */
53 __be32 l2tp_flowinfo; /* IPv6 flow information */
54 struct in6_addr l2tp_addr; /* IPv6 address */
55 __u32 l2tp_scope_id; /* scope id (new in RFC2553) */
56 __u32 l2tp_conn_id; /* Connection ID of tunnel */
57};
58
59/*****************************************************************************
60 * NETLINK_GENERIC netlink family.
61 *****************************************************************************/
62
63/*
64 * Commands.
65 * Valid TLVs of each command are:-
66 * TUNNEL_CREATE - CONN_ID, pw_type, netns, ifname, ipinfo, udpinfo, udpcsum, vlanid
67 * TUNNEL_DELETE - CONN_ID
68 * TUNNEL_MODIFY - CONN_ID, udpcsum
69 * TUNNEL_GETSTATS - CONN_ID, (stats)
70 * TUNNEL_GET - CONN_ID, (...)
71 * SESSION_CREATE - SESSION_ID, PW_TYPE, offset, data_seq, cookie, peer_cookie, offset, l2spec
72 * SESSION_DELETE - SESSION_ID
73 * SESSION_MODIFY - SESSION_ID, data_seq
74 * SESSION_GET - SESSION_ID, (...)
75 * SESSION_GETSTATS - SESSION_ID, (stats)
76 *
77 */
78enum {
79 L2TP_CMD_NOOP,
80 L2TP_CMD_TUNNEL_CREATE,
81 L2TP_CMD_TUNNEL_DELETE,
82 L2TP_CMD_TUNNEL_MODIFY,
83 L2TP_CMD_TUNNEL_GET,
84 L2TP_CMD_SESSION_CREATE,
85 L2TP_CMD_SESSION_DELETE,
86 L2TP_CMD_SESSION_MODIFY,
87 L2TP_CMD_SESSION_GET,
88 __L2TP_CMD_MAX,
89};
90
91#define L2TP_CMD_MAX (__L2TP_CMD_MAX - 1)
92
93/*
94 * ATTR types defined for L2TP
95 */
96enum {
97 L2TP_ATTR_NONE, /* no data */
98 L2TP_ATTR_PW_TYPE, /* u16, enum l2tp_pwtype */
99 L2TP_ATTR_ENCAP_TYPE, /* u16, enum l2tp_encap_type */
100 L2TP_ATTR_OFFSET, /* u16 */
101 L2TP_ATTR_DATA_SEQ, /* u16 */
102 L2TP_ATTR_L2SPEC_TYPE, /* u8, enum l2tp_l2spec_type */
103 L2TP_ATTR_L2SPEC_LEN, /* u8, enum l2tp_l2spec_type */
104 L2TP_ATTR_PROTO_VERSION, /* u8 */
105 L2TP_ATTR_IFNAME, /* string */
106 L2TP_ATTR_CONN_ID, /* u32 */
107 L2TP_ATTR_PEER_CONN_ID, /* u32 */
108 L2TP_ATTR_SESSION_ID, /* u32 */
109 L2TP_ATTR_PEER_SESSION_ID, /* u32 */
110 L2TP_ATTR_UDP_CSUM, /* u8 */
111 L2TP_ATTR_VLAN_ID, /* u16 */
112 L2TP_ATTR_COOKIE, /* 0, 4 or 8 bytes */
113 L2TP_ATTR_PEER_COOKIE, /* 0, 4 or 8 bytes */
114 L2TP_ATTR_DEBUG, /* u32 */
115 L2TP_ATTR_RECV_SEQ, /* u8 */
116 L2TP_ATTR_SEND_SEQ, /* u8 */
117 L2TP_ATTR_LNS_MODE, /* u8 */
118 L2TP_ATTR_USING_IPSEC, /* u8 */
119 L2TP_ATTR_RECV_TIMEOUT, /* msec */
120 L2TP_ATTR_FD, /* int */
121 L2TP_ATTR_IP_SADDR, /* u32 */
122 L2TP_ATTR_IP_DADDR, /* u32 */
123 L2TP_ATTR_UDP_SPORT, /* u16 */
124 L2TP_ATTR_UDP_DPORT, /* u16 */
125 L2TP_ATTR_MTU, /* u16 */
126 L2TP_ATTR_MRU, /* u16 */
127 L2TP_ATTR_STATS, /* nested */
128 L2TP_ATTR_IP6_SADDR, /* struct in6_addr */
129 L2TP_ATTR_IP6_DADDR, /* struct in6_addr */
130 __L2TP_ATTR_MAX,
131};
132
133#define L2TP_ATTR_MAX (__L2TP_ATTR_MAX - 1)
134
135/* Nested in L2TP_ATTR_STATS */
136enum {
137 L2TP_ATTR_STATS_NONE, /* no data */
138 L2TP_ATTR_TX_PACKETS, /* u64 */
139 L2TP_ATTR_TX_BYTES, /* u64 */
140 L2TP_ATTR_TX_ERRORS, /* u64 */
141 L2TP_ATTR_RX_PACKETS, /* u64 */
142 L2TP_ATTR_RX_BYTES, /* u64 */
143 L2TP_ATTR_RX_SEQ_DISCARDS, /* u64 */
144 L2TP_ATTR_RX_OOS_PACKETS, /* u64 */
145 L2TP_ATTR_RX_ERRORS, /* u64 */
146 __L2TP_ATTR_STATS_MAX,
147};
148
149#define L2TP_ATTR_STATS_MAX (__L2TP_ATTR_STATS_MAX - 1)
150
151enum l2tp_pwtype {
152 L2TP_PWTYPE_NONE = 0x0000,
153 L2TP_PWTYPE_ETH_VLAN = 0x0004,
154 L2TP_PWTYPE_ETH = 0x0005,
155 L2TP_PWTYPE_PPP = 0x0007,
156 L2TP_PWTYPE_PPP_AC = 0x0008,
157 L2TP_PWTYPE_IP = 0x000b,
158 __L2TP_PWTYPE_MAX
159};
160
161enum l2tp_l2spec_type {
162 L2TP_L2SPECTYPE_NONE,
163 L2TP_L2SPECTYPE_DEFAULT,
164};
165
166enum l2tp_encap_type {
167 L2TP_ENCAPTYPE_UDP,
168 L2TP_ENCAPTYPE_IP,
169};
170
171enum l2tp_seqmode {
172 L2TP_SEQ_NONE = 0,
173 L2TP_SEQ_IP = 1,
174 L2TP_SEQ_ALL = 2,
175};
176
177/*
178 * NETLINK_GENERIC related info
179 */
180#define L2TP_GENL_NAME "l2tp"
181#define L2TP_GENL_VERSION 0x1
182 12
183#endif 13#endif
diff --git a/include/linux/leds-lp5523.h b/include/linux/leds-lp5523.h
index 2694289babd0..727877fb406d 100644
--- a/include/linux/leds-lp5523.h
+++ b/include/linux/leds-lp5523.h
@@ -26,6 +26,7 @@
26/* See Documentation/leds/leds-lp5523.txt */ 26/* See Documentation/leds/leds-lp5523.txt */
27 27
28struct lp5523_led_config { 28struct lp5523_led_config {
29 const char *name;
29 u8 chan_nr; 30 u8 chan_nr;
30 u8 led_current; /* mA x10, 0 if led is not connected */ 31 u8 led_current; /* mA x10, 0 if led is not connected */
31 u8 max_current; 32 u8 max_current;
diff --git a/include/linux/leds.h b/include/linux/leds.h
index c6f8dad2ceb0..6e53bb31c220 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -16,6 +16,7 @@
16#include <linux/spinlock.h> 16#include <linux/spinlock.h>
17#include <linux/rwsem.h> 17#include <linux/rwsem.h>
18#include <linux/timer.h> 18#include <linux/timer.h>
19#include <linux/workqueue.h>
19 20
20struct device; 21struct device;
21/* 22/*
@@ -69,6 +70,9 @@ struct led_classdev {
69 struct timer_list blink_timer; 70 struct timer_list blink_timer;
70 int blink_brightness; 71 int blink_brightness;
71 72
73 struct work_struct set_brightness_work;
74 int delayed_set_value;
75
72#ifdef CONFIG_LEDS_TRIGGERS 76#ifdef CONFIG_LEDS_TRIGGERS
73 /* Protects the trigger data below */ 77 /* Protects the trigger data below */
74 struct rw_semaphore trigger_lock; 78 struct rw_semaphore trigger_lock;
diff --git a/include/linux/lglock.h b/include/linux/lglock.h
index f01e5f6d1f07..0d24e932db0b 100644
--- a/include/linux/lglock.h
+++ b/include/linux/lglock.h
@@ -32,20 +32,13 @@
32#define br_write_lock(name) lg_global_lock(name) 32#define br_write_lock(name) lg_global_lock(name)
33#define br_write_unlock(name) lg_global_unlock(name) 33#define br_write_unlock(name) lg_global_unlock(name)
34 34
35#define DEFINE_BRLOCK(name) DEFINE_LGLOCK(name) 35#define DEFINE_BRLOCK(name) DEFINE_LGLOCK(name)
36#define DEFINE_STATIC_BRLOCK(name) DEFINE_STATIC_LGLOCK(name)
36 37
37#ifdef CONFIG_DEBUG_LOCK_ALLOC 38#ifdef CONFIG_DEBUG_LOCK_ALLOC
38#define LOCKDEP_INIT_MAP lockdep_init_map 39#define LOCKDEP_INIT_MAP lockdep_init_map
39
40#define DEFINE_LGLOCK_LOCKDEP(name) \
41 struct lock_class_key name##_lock_key; \
42 struct lockdep_map name##_lock_dep_map; \
43 EXPORT_SYMBOL(name##_lock_dep_map)
44
45#else 40#else
46#define LOCKDEP_INIT_MAP(a, b, c, d) 41#define LOCKDEP_INIT_MAP(a, b, c, d)
47
48#define DEFINE_LGLOCK_LOCKDEP(name)
49#endif 42#endif
50 43
51struct lglock { 44struct lglock {
@@ -57,11 +50,15 @@ struct lglock {
57}; 50};
58 51
59#define DEFINE_LGLOCK(name) \ 52#define DEFINE_LGLOCK(name) \
60 DEFINE_LGLOCK_LOCKDEP(name); \ 53 static DEFINE_PER_CPU(arch_spinlock_t, name ## _lock) \
61 DEFINE_PER_CPU(arch_spinlock_t, name ## _lock) \
62 = __ARCH_SPIN_LOCK_UNLOCKED; \ 54 = __ARCH_SPIN_LOCK_UNLOCKED; \
63 struct lglock name = { .lock = &name ## _lock } 55 struct lglock name = { .lock = &name ## _lock }
64 56
57#define DEFINE_STATIC_LGLOCK(name) \
58 static DEFINE_PER_CPU(arch_spinlock_t, name ## _lock) \
59 = __ARCH_SPIN_LOCK_UNLOCKED; \
60 static struct lglock name = { .lock = &name ## _lock }
61
65void lg_lock_init(struct lglock *lg, char *name); 62void lg_lock_init(struct lglock *lg, char *name);
66void lg_local_lock(struct lglock *lg); 63void lg_local_lock(struct lglock *lg);
67void lg_local_unlock(struct lglock *lg); 64void lg_local_unlock(struct lglock *lg);
diff --git a/include/linux/libfdt.h b/include/linux/libfdt.h
index a0c3bf6c9edb..4c0306c69b4e 100644
--- a/include/linux/libfdt.h
+++ b/include/linux/libfdt.h
@@ -2,7 +2,7 @@
2#define _INCLUDE_LIBFDT_H_ 2#define _INCLUDE_LIBFDT_H_
3 3
4#include <linux/libfdt_env.h> 4#include <linux/libfdt_env.h>
5#include <> 5#include "../../scripts/dtc/libfdt/fdt.h"
6#include <> 6#include "../../scripts/dtc/libfdt/libfdt.h"
7 7
8#endif /* _INCLUDE_LIBFDT_H_ */ 8#endif /* _INCLUDE_LIBFDT_H_ */
diff --git a/include/linux/llc.h b/include/linux/llc.h
index a2418ae13ee9..b965314d017f 100644
--- a/include/linux/llc.h
+++ b/include/linux/llc.h
@@ -1,5 +1,3 @@
1#ifndef __LINUX_LLC_H
2#define __LINUX_LLC_H
3/* 1/*
4 * IEEE 802.2 User Interface SAPs for Linux, data structures and indicators. 2 * IEEE 802.2 User Interface SAPs for Linux, data structures and indicators.
5 * 3 *
@@ -12,80 +10,14 @@
12 * 10 *
13 * See the GNU General Public License for more details. 11 * See the GNU General Public License for more details.
14 */ 12 */
13#ifndef __LINUX_LLC_H
14#define __LINUX_LLC_H
15 15
16#include <linux/socket.h> 16#include <uapi/linux/llc.h>
17
18#define __LLC_SOCK_SIZE__ 16 /* sizeof(sockaddr_llc), word align. */
19struct sockaddr_llc {
20 __kernel_sa_family_t sllc_family; /* AF_LLC */
21 __kernel_sa_family_t sllc_arphrd; /* ARPHRD_ETHER */
22 unsigned char sllc_test;
23 unsigned char sllc_xid;
24 unsigned char sllc_ua; /* UA data, only for SOCK_STREAM. */
25 unsigned char sllc_sap;
26 unsigned char sllc_mac[IFHWADDRLEN];
27 unsigned char __pad[__LLC_SOCK_SIZE__ -
28 sizeof(__kernel_sa_family_t) * 2 -
29 sizeof(unsigned char) * 4 - IFHWADDRLEN];
30};
31
32/* sockopt definitions. */
33enum llc_sockopts {
34 LLC_OPT_UNKNOWN = 0,
35 LLC_OPT_RETRY, /* max retrans attempts. */
36 LLC_OPT_SIZE, /* max PDU size (octets). */
37 LLC_OPT_ACK_TMR_EXP, /* ack expire time (secs). */
38 LLC_OPT_P_TMR_EXP, /* pf cycle expire time (secs). */
39 LLC_OPT_REJ_TMR_EXP, /* rej sent expire time (secs). */
40 LLC_OPT_BUSY_TMR_EXP, /* busy state expire time (secs). */
41 LLC_OPT_TX_WIN, /* tx window size. */
42 LLC_OPT_RX_WIN, /* rx window size. */
43 LLC_OPT_PKTINFO, /* ancillary packet information. */
44 LLC_OPT_MAX
45};
46
47#define LLC_OPT_MAX_RETRY 100
48#define LLC_OPT_MAX_SIZE 4196
49#define LLC_OPT_MAX_WIN 127
50#define LLC_OPT_MAX_ACK_TMR_EXP 60
51#define LLC_OPT_MAX_P_TMR_EXP 60
52#define LLC_OPT_MAX_REJ_TMR_EXP 60
53#define LLC_OPT_MAX_BUSY_TMR_EXP 60
54
55/* LLC SAP types. */
56#define LLC_SAP_NULL 0x00 /* NULL SAP. */
57#define LLC_SAP_LLC 0x02 /* LLC Sublayer Management. */
58#define LLC_SAP_SNA 0x04 /* SNA Path Control. */
59#define LLC_SAP_PNM 0x0E /* Proway Network Management. */
60#define LLC_SAP_IP 0x06 /* TCP/IP. */
61#define LLC_SAP_BSPAN 0x42 /* Bridge Spanning Tree Proto */
62#define LLC_SAP_MMS 0x4E /* Manufacturing Message Srv. */
63#define LLC_SAP_8208 0x7E /* ISO 8208 */
64#define LLC_SAP_3COM 0x80 /* 3COM. */
65#define LLC_SAP_PRO 0x8E /* Proway Active Station List */
66#define LLC_SAP_SNAP 0xAA /* SNAP. */
67#define LLC_SAP_BANYAN 0xBC /* Banyan. */
68#define LLC_SAP_IPX 0xE0 /* IPX/SPX. */
69#define LLC_SAP_NETBEUI 0xF0 /* NetBEUI. */
70#define LLC_SAP_LANMGR 0xF4 /* LanManager. */
71#define LLC_SAP_IMPL 0xF8 /* IMPL */
72#define LLC_SAP_DISC 0xFC /* Discovery */
73#define LLC_SAP_OSI 0xFE /* OSI Network Layers. */
74#define LLC_SAP_LAR 0xDC /* LAN Address Resolution */
75#define LLC_SAP_RM 0xD4 /* Resource Management */
76#define LLC_SAP_GLOBAL 0xFF /* Global SAP. */
77
78struct llc_pktinfo {
79 int lpi_ifindex;
80 unsigned char lpi_sap;
81 unsigned char lpi_mac[IFHWADDRLEN];
82};
83 17
84#ifdef __KERNEL__
85#define LLC_SAP_DYN_START 0xC0 18#define LLC_SAP_DYN_START 0xC0
86#define LLC_SAP_DYN_STOP 0xDE 19#define LLC_SAP_DYN_STOP 0xDE
87#define LLC_SAP_DYN_TRIES 4 20#define LLC_SAP_DYN_TRIES 4
88 21
89#define llc_ui_skb_cb(__skb) ((struct sockaddr_llc *)&((__skb)->cb[0])) 22#define llc_ui_skb_cb(__skb) ((struct sockaddr_llc *)&((__skb)->cb[0]))
90#endif /* __KERNEL__ */
91#endif /* __LINUX_LLC_H */ 23#endif /* __LINUX_LLC_H */
diff --git a/include/linux/loop.h b/include/linux/loop.h
index 9635116dd830..6492181bcb1d 100644
--- a/include/linux/loop.h
+++ b/include/linux/loop.h
@@ -1,6 +1,3 @@
1#ifndef _LINUX_LOOP_H
2#define _LINUX_LOOP_H
3
4/* 1/*
5 * include/linux/loop.h 2 * include/linux/loop.h
6 * 3 *
@@ -9,15 +6,14 @@
9 * Copyright 1993 by Theodore Ts'o. Redistribution of this file is 6 * Copyright 1993 by Theodore Ts'o. Redistribution of this file is
10 * permitted under the GNU General Public License. 7 * permitted under the GNU General Public License.
11 */ 8 */
9#ifndef _LINUX_LOOP_H
10#define _LINUX_LOOP_H
12 11
13#define LO_NAME_SIZE 64
14#define LO_KEY_SIZE 32
15
16#ifdef __KERNEL__
17#include <linux/bio.h> 12#include <linux/bio.h>
18#include <linux/blkdev.h> 13#include <linux/blkdev.h>
19#include <linux/spinlock.h> 14#include <linux/spinlock.h>
20#include <linux/mutex.h> 15#include <linux/mutex.h>
16#include <uapi/linux/loop.h>
21 17
22/* Possible states of device */ 18/* Possible states of device */
23enum { 19enum {
@@ -66,69 +62,6 @@ struct loop_device {
66 struct gendisk *lo_disk; 62 struct gendisk *lo_disk;
67}; 63};
68 64
69#endif /* __KERNEL__ */
70
71/*
72 * Loop flags
73 */
74enum {
75 LO_FLAGS_READ_ONLY = 1,
76 LO_FLAGS_AUTOCLEAR = 4,
77 LO_FLAGS_PARTSCAN = 8,
78};
79
80#include <asm/posix_types.h> /* for __kernel_old_dev_t */
81#include <linux/types.h> /* for __u64 */
82
83/* Backwards compatibility version */
84struct loop_info {
85 int lo_number; /* ioctl r/o */
86 __kernel_old_dev_t lo_device; /* ioctl r/o */
87 unsigned long lo_inode; /* ioctl r/o */
88 __kernel_old_dev_t lo_rdevice; /* ioctl r/o */
89 int lo_offset;
90 int lo_encrypt_type;
91 int lo_encrypt_key_size; /* ioctl w/o */
92 int lo_flags; /* ioctl r/o */
93 char lo_name[LO_NAME_SIZE];
94 unsigned char lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
95 unsigned long lo_init[2];
96 char reserved[4];
97};
98
99struct loop_info64 {
100 __u64 lo_device; /* ioctl r/o */
101 __u64 lo_inode; /* ioctl r/o */
102 __u64 lo_rdevice; /* ioctl r/o */
103 __u64 lo_offset;
104 __u64 lo_sizelimit;/* bytes, 0 == max available */
105 __u32 lo_number; /* ioctl r/o */
106 __u32 lo_encrypt_type;
107 __u32 lo_encrypt_key_size; /* ioctl w/o */
108 __u32 lo_flags; /* ioctl r/o */
109 __u8 lo_file_name[LO_NAME_SIZE];
110 __u8 lo_crypt_name[LO_NAME_SIZE];
111 __u8 lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
112 __u64 lo_init[2];
113};
114
115/*
116 * Loop filter types
117 */
118
119#define LO_CRYPT_NONE 0
120#define LO_CRYPT_XOR 1
121#define LO_CRYPT_DES 2
122#define LO_CRYPT_FISH2 3 /* Twofish encryption */
123#define LO_CRYPT_BLOW 4
124#define LO_CRYPT_CAST128 5
125#define LO_CRYPT_IDEA 6
126#define LO_CRYPT_DUMMY 9
127#define LO_CRYPT_SKIPJACK 10
128#define LO_CRYPT_CRYPTOAPI 18
129#define MAX_LO_CRYPT 20
130
131#ifdef __KERNEL__
132/* Support for loadable transfer modules */ 65/* Support for loadable transfer modules */
133struct loop_func_table { 66struct loop_func_table {
134 int number; /* filter type */ 67 int number; /* filter type */
@@ -147,21 +80,3 @@ int loop_register_transfer(struct loop_func_table *funcs);
147int loop_unregister_transfer(int number); 80int loop_unregister_transfer(int number);
148 81
149#endif 82#endif
150/*
151 * IOCTL commands --- we will commandeer 0x4C ('L')
152 */
153
154#define LOOP_SET_FD 0x4C00
155#define LOOP_CLR_FD 0x4C01
156#define LOOP_SET_STATUS 0x4C02
157#define LOOP_GET_STATUS 0x4C03
158#define LOOP_SET_STATUS64 0x4C04
159#define LOOP_GET_STATUS64 0x4C05
160#define LOOP_CHANGE_FD 0x4C06
161#define LOOP_SET_CAPACITY 0x4C07
162
163/* /dev/loop-control interface */
164#define LOOP_CTL_ADD 0x4C80
165#define LOOP_CTL_REMOVE 0x4C81
166#define LOOP_CTL_GET_FREE 0x4C82
167#endif
diff --git a/include/linux/lp.h b/include/linux/lp.h
index 0df024bfd6f0..0dd276af9e4e 100644
--- a/include/linux/lp.h
+++ b/include/linux/lp.h
@@ -1,105 +1,16 @@
1#ifndef _LINUX_LP_H
2#define _LINUX_LP_H
3
4/* 1/*
5 * usr/include/linux/lp.h c.1991-1992 James Wiegand 2 * usr/include/linux/lp.h c.1991-1992 James Wiegand
6 * many modifications copyright (C) 1992 Michael K. Johnson 3 * many modifications copyright (C) 1992 Michael K. Johnson
7 * Interrupt support added 1993 Nigel Gamble 4 * Interrupt support added 1993 Nigel Gamble
8 * Removed 8255 status defines from inside __KERNEL__ Marcelo Tosatti 5 * Removed 8255 status defines from inside __KERNEL__ Marcelo Tosatti
9 */ 6 */
7#ifndef _LINUX_LP_H
8#define _LINUX_LP_H
10 9
11/*
12 * Per POSIX guidelines, this module reserves the LP and lp prefixes
13 * These are the lp_table[minor].flags flags...
14 */
15#define LP_EXIST 0x0001
16#define LP_SELEC 0x0002
17#define LP_BUSY 0x0004
18#define LP_BUSY_BIT_POS 2
19#define LP_OFFL 0x0008
20#define LP_NOPA 0x0010
21#define LP_ERR 0x0020
22#define LP_ABORT 0x0040
23#define LP_CAREFUL 0x0080 /* obsoleted -arca */
24#define LP_ABORTOPEN 0x0100
25
26#define LP_TRUST_IRQ_ 0x0200 /* obsolete */
27#define LP_NO_REVERSE 0x0400 /* No reverse mode available. */
28#define LP_DATA_AVAIL 0x0800 /* Data is available. */
29
30/*
31 * bit defines for 8255 status port
32 * base + 1
33 * accessed with LP_S(minor), which gets the byte...
34 */
35#define LP_PBUSY 0x80 /* inverted input, active high */
36#define LP_PACK 0x40 /* unchanged input, active low */
37#define LP_POUTPA 0x20 /* unchanged input, active high */
38#define LP_PSELECD 0x10 /* unchanged input, active high */
39#define LP_PERRORP 0x08 /* unchanged input, active low */
40
41/* timeout for each character. This is relative to bus cycles -- it
42 * is the count in a busy loop. THIS IS THE VALUE TO CHANGE if you
43 * have extremely slow printing, or if the machine seems to slow down
44 * a lot when you print. If you have slow printing, increase this
45 * number and recompile, and if your system gets bogged down, decrease
46 * this number. This can be changed with the tunelp(8) command as well.
47 */
48
49#define LP_INIT_CHAR 1000
50
51/* The parallel port specs apparently say that there needs to be
52 * a .5usec wait before and after the strobe.
53 */
54
55#define LP_INIT_WAIT 1
56
57/* This is the amount of time that the driver waits for the printer to
58 * catch up when the printer's buffer appears to be filled. If you
59 * want to tune this and have a fast printer (i.e. HPIIIP), decrease
60 * this number, and if you have a slow printer, increase this number.
61 * This is in hundredths of a second, the default 2 being .05 second.
62 * Or use the tunelp(8) command, which is especially nice if you want
63 * change back and forth between character and graphics printing, which
64 * are wildly different...
65 */
66
67#define LP_INIT_TIME 2
68
69/* IOCTL numbers */
70#define LPCHAR 0x0601 /* corresponds to LP_INIT_CHAR */
71#define LPTIME 0x0602 /* corresponds to LP_INIT_TIME */
72#define LPABORT 0x0604 /* call with TRUE arg to abort on error,
73 FALSE to retry. Default is retry. */
74#define LPSETIRQ 0x0605 /* call with new IRQ number,
75 or 0 for polling (no IRQ) */
76#define LPGETIRQ 0x0606 /* get the current IRQ number */
77#define LPWAIT 0x0608 /* corresponds to LP_INIT_WAIT */
78/* NOTE: LPCAREFUL is obsoleted and it' s always the default right now -arca */
79#define LPCAREFUL 0x0609 /* call with TRUE arg to require out-of-paper, off-
80 line, and error indicators good on all writes,
81 FALSE to ignore them. Default is ignore. */
82#define LPABORTOPEN 0x060a /* call with TRUE arg to abort open() on error,
83 FALSE to ignore error. Default is ignore. */
84#define LPGETSTATUS 0x060b /* return LP_S(minor) */
85#define LPRESET 0x060c /* reset printer */
86#ifdef LP_STATS
87#define LPGETSTATS 0x060d /* get statistics (struct lp_stats) */
88#endif
89#define LPGETFLAGS 0x060e /* get status flags */
90#define LPSETTIMEOUT 0x060f /* set parport timeout */
91
92/* timeout for printk'ing a timeout, in jiffies (100ths of a second).
93 This is also used for re-checking error conditions if LP_ABORT is
94 not set. This is the default behavior. */
95
96#define LP_TIMEOUT_INTERRUPT (60 * HZ)
97#define LP_TIMEOUT_POLLED (10 * HZ)
98
99#ifdef __KERNEL__
100 10
101#include <linux/wait.h> 11#include <linux/wait.h>
102#include <linux/mutex.h> 12#include <linux/mutex.h>
13#include <uapi/linux/lp.h>
103 14
104/* Magic numbers for defining port-device mappings */ 15/* Magic numbers for defining port-device mappings */
105#define LP_PARPORT_UNSPEC -4 16#define LP_PARPORT_UNSPEC -4
@@ -187,5 +98,3 @@ struct lp_struct {
187#define LP_DELAY 50 98#define LP_DELAY 50
188 99
189#endif 100#endif
190
191#endif
diff --git a/include/linux/mdio.h b/include/linux/mdio.h
index 6c406845f7e2..3d15c838116c 100644
--- a/include/linux/mdio.h
+++ b/include/linux/mdio.h
@@ -6,295 +6,11 @@
6 * under the terms of the GNU General Public License version 2 as published 6 * under the terms of the GNU General Public License version 2 as published
7 * by the Free Software Foundation, incorporated herein by reference. 7 * by the Free Software Foundation, incorporated herein by reference.
8 */ 8 */
9
10#ifndef __LINUX_MDIO_H__ 9#ifndef __LINUX_MDIO_H__
11#define __LINUX_MDIO_H__ 10#define __LINUX_MDIO_H__
12 11
13#include <linux/types.h> 12#include <uapi/linux/mdio.h>
14#include <linux/mii.h>
15
16/* MDIO Manageable Devices (MMDs). */
17#define MDIO_MMD_PMAPMD 1 /* Physical Medium Attachment/
18 * Physical Medium Dependent */
19#define MDIO_MMD_WIS 2 /* WAN Interface Sublayer */
20#define MDIO_MMD_PCS 3 /* Physical Coding Sublayer */
21#define MDIO_MMD_PHYXS 4 /* PHY Extender Sublayer */
22#define MDIO_MMD_DTEXS 5 /* DTE Extender Sublayer */
23#define MDIO_MMD_TC 6 /* Transmission Convergence */
24#define MDIO_MMD_AN 7 /* Auto-Negotiation */
25#define MDIO_MMD_C22EXT 29 /* Clause 22 extension */
26#define MDIO_MMD_VEND1 30 /* Vendor specific 1 */
27#define MDIO_MMD_VEND2 31 /* Vendor specific 2 */
28
29/* Generic MDIO registers. */
30#define MDIO_CTRL1 MII_BMCR
31#define MDIO_STAT1 MII_BMSR
32#define MDIO_DEVID1 MII_PHYSID1
33#define MDIO_DEVID2 MII_PHYSID2
34#define MDIO_SPEED 4 /* Speed ability */
35#define MDIO_DEVS1 5 /* Devices in package */
36#define MDIO_DEVS2 6
37#define MDIO_CTRL2 7 /* 10G control 2 */
38#define MDIO_STAT2 8 /* 10G status 2 */
39#define MDIO_PMA_TXDIS 9 /* 10G PMA/PMD transmit disable */
40#define MDIO_PMA_RXDET 10 /* 10G PMA/PMD receive signal detect */
41#define MDIO_PMA_EXTABLE 11 /* 10G PMA/PMD extended ability */
42#define MDIO_PKGID1 14 /* Package identifier */
43#define MDIO_PKGID2 15
44#define MDIO_AN_ADVERTISE 16 /* AN advertising (base page) */
45#define MDIO_AN_LPA 19 /* AN LP abilities (base page) */
46#define MDIO_PCS_EEE_ABLE 20 /* EEE Capability register */
47#define MDIO_PCS_EEE_WK_ERR 22 /* EEE wake error counter */
48#define MDIO_PHYXS_LNSTAT 24 /* PHY XGXS lane state */
49#define MDIO_AN_EEE_ADV 60 /* EEE advertisement */
50#define MDIO_AN_EEE_LPABLE 61 /* EEE link partner ability */
51
52/* Media-dependent registers. */
53#define MDIO_PMA_10GBT_SWAPPOL 130 /* 10GBASE-T pair swap & polarity */
54#define MDIO_PMA_10GBT_TXPWR 131 /* 10GBASE-T TX power control */
55#define MDIO_PMA_10GBT_SNR 133 /* 10GBASE-T SNR margin, lane A.
56 * Lanes B-D are numbered 134-136. */
57#define MDIO_PMA_10GBR_FECABLE 170 /* 10GBASE-R FEC ability */
58#define MDIO_PCS_10GBX_STAT1 24 /* 10GBASE-X PCS status 1 */
59#define MDIO_PCS_10GBRT_STAT1 32 /* 10GBASE-R/-T PCS status 1 */
60#define MDIO_PCS_10GBRT_STAT2 33 /* 10GBASE-R/-T PCS status 2 */
61#define MDIO_AN_10GBT_CTRL 32 /* 10GBASE-T auto-negotiation control */
62#define MDIO_AN_10GBT_STAT 33 /* 10GBASE-T auto-negotiation status */
63
64/* LASI (Link Alarm Status Interrupt) registers, defined by XENPAK MSA. */
65#define MDIO_PMA_LASI_RXCTRL 0x9000 /* RX_ALARM control */
66#define MDIO_PMA_LASI_TXCTRL 0x9001 /* TX_ALARM control */
67#define MDIO_PMA_LASI_CTRL 0x9002 /* LASI control */
68#define MDIO_PMA_LASI_RXSTAT 0x9003 /* RX_ALARM status */
69#define MDIO_PMA_LASI_TXSTAT 0x9004 /* TX_ALARM status */
70#define MDIO_PMA_LASI_STAT 0x9005 /* LASI status */
71
72/* Control register 1. */
73/* Enable extended speed selection */
74#define MDIO_CTRL1_SPEEDSELEXT (BMCR_SPEED1000 | BMCR_SPEED100)
75/* All speed selection bits */
76#define MDIO_CTRL1_SPEEDSEL (MDIO_CTRL1_SPEEDSELEXT | 0x003c)
77#define MDIO_CTRL1_FULLDPLX BMCR_FULLDPLX
78#define MDIO_CTRL1_LPOWER BMCR_PDOWN
79#define MDIO_CTRL1_RESET BMCR_RESET
80#define MDIO_PMA_CTRL1_LOOPBACK 0x0001
81#define MDIO_PMA_CTRL1_SPEED1000 BMCR_SPEED1000
82#define MDIO_PMA_CTRL1_SPEED100 BMCR_SPEED100
83#define MDIO_PCS_CTRL1_LOOPBACK BMCR_LOOPBACK
84#define MDIO_PHYXS_CTRL1_LOOPBACK BMCR_LOOPBACK
85#define MDIO_AN_CTRL1_RESTART BMCR_ANRESTART
86#define MDIO_AN_CTRL1_ENABLE BMCR_ANENABLE
87#define MDIO_AN_CTRL1_XNP 0x2000 /* Enable extended next page */
88#define MDIO_PCS_CTRL1_CLKSTOP_EN 0x400 /* Stop the clock during LPI */
89
90/* 10 Gb/s */
91#define MDIO_CTRL1_SPEED10G (MDIO_CTRL1_SPEEDSELEXT | 0x00)
92/* 10PASS-TS/2BASE-TL */
93#define MDIO_CTRL1_SPEED10P2B (MDIO_CTRL1_SPEEDSELEXT | 0x04)
94
95/* Status register 1. */
96#define MDIO_STAT1_LPOWERABLE 0x0002 /* Low-power ability */
97#define MDIO_STAT1_LSTATUS BMSR_LSTATUS
98#define MDIO_STAT1_FAULT 0x0080 /* Fault */
99#define MDIO_AN_STAT1_LPABLE 0x0001 /* Link partner AN ability */
100#define MDIO_AN_STAT1_ABLE BMSR_ANEGCAPABLE
101#define MDIO_AN_STAT1_RFAULT BMSR_RFAULT
102#define MDIO_AN_STAT1_COMPLETE BMSR_ANEGCOMPLETE
103#define MDIO_AN_STAT1_PAGE 0x0040 /* Page received */
104#define MDIO_AN_STAT1_XNP 0x0080 /* Extended next page status */
105
106/* Speed register. */
107#define MDIO_SPEED_10G 0x0001 /* 10G capable */
108#define MDIO_PMA_SPEED_2B 0x0002 /* 2BASE-TL capable */
109#define MDIO_PMA_SPEED_10P 0x0004 /* 10PASS-TS capable */
110#define MDIO_PMA_SPEED_1000 0x0010 /* 1000M capable */
111#define MDIO_PMA_SPEED_100 0x0020 /* 100M capable */
112#define MDIO_PMA_SPEED_10 0x0040 /* 10M capable */
113#define MDIO_PCS_SPEED_10P2B 0x0002 /* 10PASS-TS/2BASE-TL capable */
114
115/* Device present registers. */
116#define MDIO_DEVS_PRESENT(devad) (1 << (devad))
117#define MDIO_DEVS_PMAPMD MDIO_DEVS_PRESENT(MDIO_MMD_PMAPMD)
118#define MDIO_DEVS_WIS MDIO_DEVS_PRESENT(MDIO_MMD_WIS)
119#define MDIO_DEVS_PCS MDIO_DEVS_PRESENT(MDIO_MMD_PCS)
120#define MDIO_DEVS_PHYXS MDIO_DEVS_PRESENT(MDIO_MMD_PHYXS)
121#define MDIO_DEVS_DTEXS MDIO_DEVS_PRESENT(MDIO_MMD_DTEXS)
122#define MDIO_DEVS_TC MDIO_DEVS_PRESENT(MDIO_MMD_TC)
123#define MDIO_DEVS_AN MDIO_DEVS_PRESENT(MDIO_MMD_AN)
124#define MDIO_DEVS_C22EXT MDIO_DEVS_PRESENT(MDIO_MMD_C22EXT)
125
126/* Control register 2. */
127#define MDIO_PMA_CTRL2_TYPE 0x000f /* PMA/PMD type selection */
128#define MDIO_PMA_CTRL2_10GBCX4 0x0000 /* 10GBASE-CX4 type */
129#define MDIO_PMA_CTRL2_10GBEW 0x0001 /* 10GBASE-EW type */
130#define MDIO_PMA_CTRL2_10GBLW 0x0002 /* 10GBASE-LW type */
131#define MDIO_PMA_CTRL2_10GBSW 0x0003 /* 10GBASE-SW type */
132#define MDIO_PMA_CTRL2_10GBLX4 0x0004 /* 10GBASE-LX4 type */
133#define MDIO_PMA_CTRL2_10GBER 0x0005 /* 10GBASE-ER type */
134#define MDIO_PMA_CTRL2_10GBLR 0x0006 /* 10GBASE-LR type */
135#define MDIO_PMA_CTRL2_10GBSR 0x0007 /* 10GBASE-SR type */
136#define MDIO_PMA_CTRL2_10GBLRM 0x0008 /* 10GBASE-LRM type */
137#define MDIO_PMA_CTRL2_10GBT 0x0009 /* 10GBASE-T type */
138#define MDIO_PMA_CTRL2_10GBKX4 0x000a /* 10GBASE-KX4 type */
139#define MDIO_PMA_CTRL2_10GBKR 0x000b /* 10GBASE-KR type */
140#define MDIO_PMA_CTRL2_1000BT 0x000c /* 1000BASE-T type */
141#define MDIO_PMA_CTRL2_1000BKX 0x000d /* 1000BASE-KX type */
142#define MDIO_PMA_CTRL2_100BTX 0x000e /* 100BASE-TX type */
143#define MDIO_PMA_CTRL2_10BT 0x000f /* 10BASE-T type */
144#define MDIO_PCS_CTRL2_TYPE 0x0003 /* PCS type selection */
145#define MDIO_PCS_CTRL2_10GBR 0x0000 /* 10GBASE-R type */
146#define MDIO_PCS_CTRL2_10GBX 0x0001 /* 10GBASE-X type */
147#define MDIO_PCS_CTRL2_10GBW 0x0002 /* 10GBASE-W type */
148#define MDIO_PCS_CTRL2_10GBT 0x0003 /* 10GBASE-T type */
149
150/* Status register 2. */
151#define MDIO_STAT2_RXFAULT 0x0400 /* Receive fault */
152#define MDIO_STAT2_TXFAULT 0x0800 /* Transmit fault */
153#define MDIO_STAT2_DEVPRST 0xc000 /* Device present */
154#define MDIO_STAT2_DEVPRST_VAL 0x8000 /* Device present value */
155#define MDIO_PMA_STAT2_LBABLE 0x0001 /* PMA loopback ability */
156#define MDIO_PMA_STAT2_10GBEW 0x0002 /* 10GBASE-EW ability */
157#define MDIO_PMA_STAT2_10GBLW 0x0004 /* 10GBASE-LW ability */
158#define MDIO_PMA_STAT2_10GBSW 0x0008 /* 10GBASE-SW ability */
159#define MDIO_PMA_STAT2_10GBLX4 0x0010 /* 10GBASE-LX4 ability */
160#define MDIO_PMA_STAT2_10GBER 0x0020 /* 10GBASE-ER ability */
161#define MDIO_PMA_STAT2_10GBLR 0x0040 /* 10GBASE-LR ability */
162#define MDIO_PMA_STAT2_10GBSR 0x0080 /* 10GBASE-SR ability */
163#define MDIO_PMD_STAT2_TXDISAB 0x0100 /* PMD TX disable ability */
164#define MDIO_PMA_STAT2_EXTABLE 0x0200 /* Extended abilities */
165#define MDIO_PMA_STAT2_RXFLTABLE 0x1000 /* Receive fault ability */
166#define MDIO_PMA_STAT2_TXFLTABLE 0x2000 /* Transmit fault ability */
167#define MDIO_PCS_STAT2_10GBR 0x0001 /* 10GBASE-R capable */
168#define MDIO_PCS_STAT2_10GBX 0x0002 /* 10GBASE-X capable */
169#define MDIO_PCS_STAT2_10GBW 0x0004 /* 10GBASE-W capable */
170#define MDIO_PCS_STAT2_RXFLTABLE 0x1000 /* Receive fault ability */
171#define MDIO_PCS_STAT2_TXFLTABLE 0x2000 /* Transmit fault ability */
172
173/* Transmit disable register. */
174#define MDIO_PMD_TXDIS_GLOBAL 0x0001 /* Global PMD TX disable */
175#define MDIO_PMD_TXDIS_0 0x0002 /* PMD TX disable 0 */
176#define MDIO_PMD_TXDIS_1 0x0004 /* PMD TX disable 1 */
177#define MDIO_PMD_TXDIS_2 0x0008 /* PMD TX disable 2 */
178#define MDIO_PMD_TXDIS_3 0x0010 /* PMD TX disable 3 */
179
180/* Receive signal detect register. */
181#define MDIO_PMD_RXDET_GLOBAL 0x0001 /* Global PMD RX signal detect */
182#define MDIO_PMD_RXDET_0 0x0002 /* PMD RX signal detect 0 */
183#define MDIO_PMD_RXDET_1 0x0004 /* PMD RX signal detect 1 */
184#define MDIO_PMD_RXDET_2 0x0008 /* PMD RX signal detect 2 */
185#define MDIO_PMD_RXDET_3 0x0010 /* PMD RX signal detect 3 */
186
187/* Extended abilities register. */
188#define MDIO_PMA_EXTABLE_10GCX4 0x0001 /* 10GBASE-CX4 ability */
189#define MDIO_PMA_EXTABLE_10GBLRM 0x0002 /* 10GBASE-LRM ability */
190#define MDIO_PMA_EXTABLE_10GBT 0x0004 /* 10GBASE-T ability */
191#define MDIO_PMA_EXTABLE_10GBKX4 0x0008 /* 10GBASE-KX4 ability */
192#define MDIO_PMA_EXTABLE_10GBKR 0x0010 /* 10GBASE-KR ability */
193#define MDIO_PMA_EXTABLE_1000BT 0x0020 /* 1000BASE-T ability */
194#define MDIO_PMA_EXTABLE_1000BKX 0x0040 /* 1000BASE-KX ability */
195#define MDIO_PMA_EXTABLE_100BTX 0x0080 /* 100BASE-TX ability */
196#define MDIO_PMA_EXTABLE_10BT 0x0100 /* 10BASE-T ability */
197
198/* PHY XGXS lane state register. */
199#define MDIO_PHYXS_LNSTAT_SYNC0 0x0001
200#define MDIO_PHYXS_LNSTAT_SYNC1 0x0002
201#define MDIO_PHYXS_LNSTAT_SYNC2 0x0004
202#define MDIO_PHYXS_LNSTAT_SYNC3 0x0008
203#define MDIO_PHYXS_LNSTAT_ALIGN 0x1000
204
205/* PMA 10GBASE-T pair swap & polarity */
206#define MDIO_PMA_10GBT_SWAPPOL_ABNX 0x0001 /* Pair A/B uncrossed */
207#define MDIO_PMA_10GBT_SWAPPOL_CDNX 0x0002 /* Pair C/D uncrossed */
208#define MDIO_PMA_10GBT_SWAPPOL_AREV 0x0100 /* Pair A polarity reversed */
209#define MDIO_PMA_10GBT_SWAPPOL_BREV 0x0200 /* Pair B polarity reversed */
210#define MDIO_PMA_10GBT_SWAPPOL_CREV 0x0400 /* Pair C polarity reversed */
211#define MDIO_PMA_10GBT_SWAPPOL_DREV 0x0800 /* Pair D polarity reversed */
212
213/* PMA 10GBASE-T TX power register. */
214#define MDIO_PMA_10GBT_TXPWR_SHORT 0x0001 /* Short-reach mode */
215
216/* PMA 10GBASE-T SNR registers. */
217/* Value is SNR margin in dB, clamped to range [-127, 127], plus 0x8000. */
218#define MDIO_PMA_10GBT_SNR_BIAS 0x8000
219#define MDIO_PMA_10GBT_SNR_MAX 127
220
221/* PMA 10GBASE-R FEC ability register. */
222#define MDIO_PMA_10GBR_FECABLE_ABLE 0x0001 /* FEC ability */
223#define MDIO_PMA_10GBR_FECABLE_ERRABLE 0x0002 /* FEC error indic. ability */
224
225/* PCS 10GBASE-R/-T status register 1. */
226#define MDIO_PCS_10GBRT_STAT1_BLKLK 0x0001 /* Block lock attained */
227
228/* PCS 10GBASE-R/-T status register 2. */
229#define MDIO_PCS_10GBRT_STAT2_ERR 0x00ff
230#define MDIO_PCS_10GBRT_STAT2_BER 0x3f00
231
232/* AN 10GBASE-T control register. */
233#define MDIO_AN_10GBT_CTRL_ADV10G 0x1000 /* Advertise 10GBASE-T */
234
235/* AN 10GBASE-T status register. */
236#define MDIO_AN_10GBT_STAT_LPTRR 0x0200 /* LP training reset req. */
237#define MDIO_AN_10GBT_STAT_LPLTABLE 0x0400 /* LP loop timing ability */
238#define MDIO_AN_10GBT_STAT_LP10G 0x0800 /* LP is 10GBT capable */
239#define MDIO_AN_10GBT_STAT_REMOK 0x1000 /* Remote OK */
240#define MDIO_AN_10GBT_STAT_LOCOK 0x2000 /* Local OK */
241#define MDIO_AN_10GBT_STAT_MS 0x4000 /* Master/slave config */
242#define MDIO_AN_10GBT_STAT_MSFLT 0x8000 /* Master/slave config fault */
243
244/* EEE Supported/Advertisement/LP Advertisement registers.
245 *
246 * EEE capability Register (3.20), Advertisement (7.60) and
247 * Link partner ability (7.61) registers have and can use the same identical
248 * bit masks.
249 */
250#define MDIO_AN_EEE_ADV_100TX 0x0002 /* Advertise 100TX EEE cap */
251#define MDIO_AN_EEE_ADV_1000T 0x0004 /* Advertise 1000T EEE cap */
252/* Note: the two defines above can be potentially used by the user-land
253 * and cannot remove them now.
254 * So, we define the new generic MDIO_EEE_100TX and MDIO_EEE_1000T macros
255 * using the previous ones (that can be considered obsolete).
256 */
257#define MDIO_EEE_100TX MDIO_AN_EEE_ADV_100TX /* 100TX EEE cap */
258#define MDIO_EEE_1000T MDIO_AN_EEE_ADV_1000T /* 1000T EEE cap */
259#define MDIO_EEE_10GT 0x0008 /* 10GT EEE cap */
260#define MDIO_EEE_1000KX 0x0010 /* 1000KX EEE cap */
261#define MDIO_EEE_10GKX4 0x0020 /* 10G KX4 EEE cap */
262#define MDIO_EEE_10GKR 0x0040 /* 10G KR EEE cap */
263
264/* LASI RX_ALARM control/status registers. */
265#define MDIO_PMA_LASI_RX_PHYXSLFLT 0x0001 /* PHY XS RX local fault */
266#define MDIO_PMA_LASI_RX_PCSLFLT 0x0008 /* PCS RX local fault */
267#define MDIO_PMA_LASI_RX_PMALFLT 0x0010 /* PMA/PMD RX local fault */
268#define MDIO_PMA_LASI_RX_OPTICPOWERFLT 0x0020 /* RX optical power fault */
269#define MDIO_PMA_LASI_RX_WISLFLT 0x0200 /* WIS local fault */
270
271/* LASI TX_ALARM control/status registers. */
272#define MDIO_PMA_LASI_TX_PHYXSLFLT 0x0001 /* PHY XS TX local fault */
273#define MDIO_PMA_LASI_TX_PCSLFLT 0x0008 /* PCS TX local fault */
274#define MDIO_PMA_LASI_TX_PMALFLT 0x0010 /* PMA/PMD TX local fault */
275#define MDIO_PMA_LASI_TX_LASERPOWERFLT 0x0080 /* Laser output power fault */
276#define MDIO_PMA_LASI_TX_LASERTEMPFLT 0x0100 /* Laser temperature fault */
277#define MDIO_PMA_LASI_TX_LASERBICURRFLT 0x0200 /* Laser bias current fault */
278
279/* LASI control/status registers. */
280#define MDIO_PMA_LASI_LSALARM 0x0001 /* LS_ALARM enable/status */
281#define MDIO_PMA_LASI_TXALARM 0x0002 /* TX_ALARM enable/status */
282#define MDIO_PMA_LASI_RXALARM 0x0004 /* RX_ALARM enable/status */
283
284/* Mapping between MDIO PRTAD/DEVAD and mii_ioctl_data::phy_id */
285
286#define MDIO_PHY_ID_C45 0x8000
287#define MDIO_PHY_ID_PRTAD 0x03e0
288#define MDIO_PHY_ID_DEVAD 0x001f
289#define MDIO_PHY_ID_C45_MASK \
290 (MDIO_PHY_ID_C45 | MDIO_PHY_ID_PRTAD | MDIO_PHY_ID_DEVAD)
291
292static inline __u16 mdio_phy_id_c45(int prtad, int devad)
293{
294 return MDIO_PHY_ID_C45 | (prtad << 5) | devad;
295}
296 13
297#ifdef __KERNEL__
298 14
299static inline bool mdio_phy_id_is_c45(int phy_id) 15static inline bool mdio_phy_id_is_c45(int phy_id)
300{ 16{
@@ -460,5 +176,4 @@ static inline u16 ethtool_adv_to_mmd_eee_adv_t(u32 adv)
460 return reg; 176 return reg;
461} 177}
462 178
463#endif /* __KERNEL__ */
464#endif /* __LINUX_MDIO_H__ */ 179#endif /* __LINUX_MDIO_H__ */
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 19dc455b4f3d..d452ee191066 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -57,6 +57,7 @@ int memblock_add(phys_addr_t base, phys_addr_t size);
57int memblock_remove(phys_addr_t base, phys_addr_t size); 57int memblock_remove(phys_addr_t base, phys_addr_t size);
58int memblock_free(phys_addr_t base, phys_addr_t size); 58int memblock_free(phys_addr_t base, phys_addr_t size);
59int memblock_reserve(phys_addr_t base, phys_addr_t size); 59int memblock_reserve(phys_addr_t base, phys_addr_t size);
60void memblock_trim_memory(phys_addr_t align);
60 61
61#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP 62#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
62void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn, 63void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
@@ -70,8 +71,7 @@ void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
70 * @p_end: ptr to ulong for end pfn of the range, can be %NULL 71 * @p_end: ptr to ulong for end pfn of the range, can be %NULL
71 * @p_nid: ptr to int for nid of the range, can be %NULL 72 * @p_nid: ptr to int for nid of the range, can be %NULL
72 * 73 *
73 * Walks over configured memory ranges. Available after early_node_map is 74 * Walks over configured memory ranges.
74 * populated.
75 */ 75 */
76#define for_each_mem_pfn_range(i, nid, p_start, p_end, p_nid) \ 76#define for_each_mem_pfn_range(i, nid, p_start, p_end, p_nid) \
77 for (i = -1, __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid); \ 77 for (i = -1, __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid); \
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 8d9489fdab2e..11ddc7ffeba8 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -84,14 +84,14 @@ extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg);
84extern struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont); 84extern struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont);
85 85
86static inline 86static inline
87int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup) 87bool mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *memcg)
88{ 88{
89 struct mem_cgroup *memcg; 89 struct mem_cgroup *task_memcg;
90 int match; 90 bool match;
91 91
92 rcu_read_lock(); 92 rcu_read_lock();
93 memcg = mem_cgroup_from_task(rcu_dereference((mm)->owner)); 93 task_memcg = mem_cgroup_from_task(rcu_dereference(mm->owner));
94 match = __mem_cgroup_same_or_subtree(cgroup, memcg); 94 match = __mem_cgroup_same_or_subtree(memcg, task_memcg);
95 rcu_read_unlock(); 95 rcu_read_unlock();
96 return match; 96 return match;
97} 97}
@@ -258,10 +258,10 @@ static inline struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm
258 return NULL; 258 return NULL;
259} 259}
260 260
261static inline int mm_match_cgroup(struct mm_struct *mm, 261static inline bool mm_match_cgroup(struct mm_struct *mm,
262 struct mem_cgroup *memcg) 262 struct mem_cgroup *memcg)
263{ 263{
264 return 1; 264 return true;
265} 265}
266 266
267static inline int task_in_mem_cgroup(struct task_struct *task, 267static inline int task_in_mem_cgroup(struct task_struct *task,
@@ -396,7 +396,7 @@ enum {
396}; 396};
397 397
398struct sock; 398struct sock;
399#ifdef CONFIG_MEMCG_KMEM 399#if defined(CONFIG_INET) && defined(CONFIG_MEMCG_KMEM)
400void sock_update_memcg(struct sock *sk); 400void sock_update_memcg(struct sock *sk);
401void sock_release_memcg(struct sock *sk); 401void sock_release_memcg(struct sock *sk);
402#else 402#else
@@ -406,6 +406,6 @@ static inline void sock_update_memcg(struct sock *sk)
406static inline void sock_release_memcg(struct sock *sk) 406static inline void sock_release_memcg(struct sock *sk)
407{ 407{
408} 408}
409#endif /* CONFIG_MEMCG_KMEM */ 409#endif /* CONFIG_INET && CONFIG_MEMCG_KMEM */
410#endif /* _LINUX_MEMCONTROL_H */ 410#endif /* _LINUX_MEMCONTROL_H */
411 411
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 910550f3b70e..95573ec4ee6c 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -10,6 +10,7 @@ struct page;
10struct zone; 10struct zone;
11struct pglist_data; 11struct pglist_data;
12struct mem_section; 12struct mem_section;
13struct memory_block;
13 14
14#ifdef CONFIG_MEMORY_HOTPLUG 15#ifdef CONFIG_MEMORY_HOTPLUG
15 16
@@ -233,6 +234,8 @@ static inline int is_mem_section_removable(unsigned long pfn,
233extern int mem_online_node(int nid); 234extern int mem_online_node(int nid);
234extern int add_memory(int nid, u64 start, u64 size); 235extern int add_memory(int nid, u64 start, u64 size);
235extern int arch_add_memory(int nid, u64 start, u64 size); 236extern int arch_add_memory(int nid, u64 start, u64 size);
237extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
238extern int offline_memory_block(struct memory_block *mem);
236extern int remove_memory(u64 start, u64 size); 239extern int remove_memory(u64 start, u64 size);
237extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn, 240extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
238 int nr_pages); 241 int nr_pages);
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 95b738c7abff..e5ccb9ddd90e 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -1,66 +1,10 @@
1#ifndef _LINUX_MEMPOLICY_H
2#define _LINUX_MEMPOLICY_H 1
3
4#include <linux/errno.h>
5
6/* 1/*
7 * NUMA memory policies for Linux. 2 * NUMA memory policies for Linux.
8 * Copyright 2003,2004 Andi Kleen SuSE Labs 3 * Copyright 2003,2004 Andi Kleen SuSE Labs
9 */ 4 */
5#ifndef _LINUX_MEMPOLICY_H
6#define _LINUX_MEMPOLICY_H 1
10 7
11/*
12 * Both the MPOL_* mempolicy mode and the MPOL_F_* optional mode flags are
13 * passed by the user to either set_mempolicy() or mbind() in an 'int' actual.
14 * The MPOL_MODE_FLAGS macro determines the legal set of optional mode flags.
15 */
16
17/* Policies */
18enum {
19 MPOL_DEFAULT,
20 MPOL_PREFERRED,
21 MPOL_BIND,
22 MPOL_INTERLEAVE,
23 MPOL_MAX, /* always last member of enum */
24};
25
26enum mpol_rebind_step {
27 MPOL_REBIND_ONCE, /* do rebind work at once(not by two step) */
28 MPOL_REBIND_STEP1, /* first step(set all the newly nodes) */
29 MPOL_REBIND_STEP2, /* second step(clean all the disallowed nodes)*/
30 MPOL_REBIND_NSTEP,
31};
32
33/* Flags for set_mempolicy */
34#define MPOL_F_STATIC_NODES (1 << 15)
35#define MPOL_F_RELATIVE_NODES (1 << 14)
36
37/*
38 * MPOL_MODE_FLAGS is the union of all possible optional mode flags passed to
39 * either set_mempolicy() or mbind().
40 */
41#define MPOL_MODE_FLAGS (MPOL_F_STATIC_NODES | MPOL_F_RELATIVE_NODES)
42
43/* Flags for get_mempolicy */
44#define MPOL_F_NODE (1<<0) /* return next IL mode instead of node mask */
45#define MPOL_F_ADDR (1<<1) /* look up vma using address */
46#define MPOL_F_MEMS_ALLOWED (1<<2) /* return allowed memories */
47
48/* Flags for mbind */
49#define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */
50#define MPOL_MF_MOVE (1<<1) /* Move pages owned by this process to conform to mapping */
51#define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to mapping */
52#define MPOL_MF_INTERNAL (1<<3) /* Internal flags start here */
53
54/*
55 * Internal flags that share the struct mempolicy flags word with
56 * "mode flags". These flags are allocated from bit 0 up, as they
57 * are never OR'ed into the mode in mempolicy API arguments.
58 */
59#define MPOL_F_SHARED (1 << 0) /* identify shared policies */
60#define MPOL_F_LOCAL (1 << 1) /* preferred local allocation */
61#define MPOL_F_REBINDING (1 << 2) /* identify policies in rebinding */
62
63#ifdef __KERNEL__
64 8
65#include <linux/mmzone.h> 9#include <linux/mmzone.h>
66#include <linux/slab.h> 10#include <linux/slab.h>
@@ -68,6 +12,7 @@ enum mpol_rebind_step {
68#include <linux/spinlock.h> 12#include <linux/spinlock.h>
69#include <linux/nodemask.h> 13#include <linux/nodemask.h>
70#include <linux/pagemap.h> 14#include <linux/pagemap.h>
15#include <uapi/linux/mempolicy.h>
71 16
72struct mm_struct; 17struct mm_struct;
73 18
@@ -188,7 +133,7 @@ struct sp_node {
188 133
189struct shared_policy { 134struct shared_policy {
190 struct rb_root root; 135 struct rb_root root;
191 spinlock_t lock; 136 struct mutex mutex;
192}; 137};
193 138
194void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol); 139void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol);
@@ -239,7 +184,7 @@ extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol,
239/* Check if a vma is migratable */ 184/* Check if a vma is migratable */
240static inline int vma_migratable(struct vm_area_struct *vma) 185static inline int vma_migratable(struct vm_area_struct *vma)
241{ 186{
242 if (vma->vm_flags & (VM_IO|VM_HUGETLB|VM_PFNMAP|VM_RESERVED)) 187 if (vma->vm_flags & (VM_IO | VM_HUGETLB | VM_PFNMAP))
243 return 0; 188 return 0;
244 /* 189 /*
245 * Migration allocates pages in the highest zone. If we cannot 190 * Migration allocates pages in the highest zone. If we cannot
@@ -379,6 +324,4 @@ static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol,
379} 324}
380 325
381#endif /* CONFIG_NUMA */ 326#endif /* CONFIG_NUMA */
382#endif /* __KERNEL__ */
383
384#endif 327#endif
diff --git a/include/linux/mfd/88pm860x.h b/include/linux/mfd/88pm860x.h
index 7b24943779fa..cd97530205c2 100644
--- a/include/linux/mfd/88pm860x.h
+++ b/include/linux/mfd/88pm860x.h
@@ -34,27 +34,26 @@ enum {
34 PM8606_ID_MAX, 34 PM8606_ID_MAX,
35}; 35};
36 36
37enum {
38 PM8606_BACKLIGHT1 = 0,
39 PM8606_BACKLIGHT2,
40 PM8606_BACKLIGHT3,
41};
42
43enum {
44 PM8606_LED1_RED = 0,
45 PM8606_LED1_GREEN,
46 PM8606_LED1_BLUE,
47 PM8606_LED2_RED,
48 PM8606_LED2_GREEN,
49 PM8606_LED2_BLUE,
50 PM8607_LED_VIBRATOR,
51};
52
53 37
54/* 8606 Registers */ 38/* 8606 Registers */
55#define PM8606_DCM_BOOST (0x00) 39#define PM8606_DCM_BOOST (0x00)
56#define PM8606_PWM (0x01) 40#define PM8606_PWM (0x01)
57 41
42#define PM8607_MISC2 (0x42)
43
44/* Power Up Log Register */
45#define PM8607_POWER_UP_LOG (0x3F)
46
47/* Charger Control Registers */
48#define PM8607_CCNT (0x47)
49#define PM8607_CHG_CTRL1 (0x48)
50#define PM8607_CHG_CTRL2 (0x49)
51#define PM8607_CHG_CTRL3 (0x4A)
52#define PM8607_CHG_CTRL4 (0x4B)
53#define PM8607_CHG_CTRL5 (0x4C)
54#define PM8607_CHG_CTRL6 (0x4D)
55#define PM8607_CHG_CTRL7 (0x4E)
56
58/* Backlight Registers */ 57/* Backlight Registers */
59#define PM8606_WLED1A (0x02) 58#define PM8606_WLED1A (0x02)
60#define PM8606_WLED1B (0x03) 59#define PM8606_WLED1B (0x03)
@@ -205,6 +204,71 @@ enum {
205#define PM8607_PD_PREBIAS (0x56) /* prebias time */ 204#define PM8607_PD_PREBIAS (0x56) /* prebias time */
206#define PM8607_GPADC_MISC1 (0x57) 205#define PM8607_GPADC_MISC1 (0x57)
207 206
207/* bit definitions of MEAS_EN1*/
208#define PM8607_MEAS_EN1_VBAT (1 << 0)
209#define PM8607_MEAS_EN1_VCHG (1 << 1)
210#define PM8607_MEAS_EN1_VSYS (1 << 2)
211#define PM8607_MEAS_EN1_TINT (1 << 3)
212#define PM8607_MEAS_EN1_RFTMP (1 << 4)
213#define PM8607_MEAS_EN1_TBAT (1 << 5)
214#define PM8607_MEAS_EN1_GPADC2 (1 << 6)
215#define PM8607_MEAS_EN1_GPADC3 (1 << 7)
216
217/* Battery Monitor Registers */
218#define PM8607_GP_BIAS2 (0x5A)
219#define PM8607_VBAT_LOWTH (0x5B)
220#define PM8607_VCHG_LOWTH (0x5C)
221#define PM8607_VSYS_LOWTH (0x5D)
222#define PM8607_TINT_LOWTH (0x5E)
223#define PM8607_GPADC0_LOWTH (0x5F)
224#define PM8607_GPADC1_LOWTH (0x60)
225#define PM8607_GPADC2_LOWTH (0x61)
226#define PM8607_GPADC3_LOWTH (0x62)
227#define PM8607_VBAT_HIGHTH (0x63)
228#define PM8607_VCHG_HIGHTH (0x64)
229#define PM8607_VSYS_HIGHTH (0x65)
230#define PM8607_TINT_HIGHTH (0x66)
231#define PM8607_GPADC0_HIGHTH (0x67)
232#define PM8607_GPADC1_HIGHTH (0x68)
233#define PM8607_GPADC2_HIGHTH (0x69)
234#define PM8607_GPADC3_HIGHTH (0x6A)
235#define PM8607_IBAT_MEAS1 (0x6B)
236#define PM8607_IBAT_MEAS2 (0x6C)
237#define PM8607_VBAT_MEAS1 (0x6D)
238#define PM8607_VBAT_MEAS2 (0x6E)
239#define PM8607_VCHG_MEAS1 (0x6F)
240#define PM8607_VCHG_MEAS2 (0x70)
241#define PM8607_VSYS_MEAS1 (0x71)
242#define PM8607_VSYS_MEAS2 (0x72)
243#define PM8607_TINT_MEAS1 (0x73)
244#define PM8607_TINT_MEAS2 (0x74)
245#define PM8607_GPADC0_MEAS1 (0x75)
246#define PM8607_GPADC0_MEAS2 (0x76)
247#define PM8607_GPADC1_MEAS1 (0x77)
248#define PM8607_GPADC1_MEAS2 (0x78)
249#define PM8607_GPADC2_MEAS1 (0x79)
250#define PM8607_GPADC2_MEAS2 (0x7A)
251#define PM8607_GPADC3_MEAS1 (0x7B)
252#define PM8607_GPADC3_MEAS2 (0x7C)
253#define PM8607_CCNT_MEAS1 (0x95)
254#define PM8607_CCNT_MEAS2 (0x96)
255#define PM8607_VBAT_AVG (0x97)
256#define PM8607_VCHG_AVG (0x98)
257#define PM8607_VSYS_AVG (0x99)
258#define PM8607_VBAT_MIN (0x9A)
259#define PM8607_VCHG_MIN (0x9B)
260#define PM8607_VSYS_MIN (0x9C)
261#define PM8607_VBAT_MAX (0x9D)
262#define PM8607_VCHG_MAX (0x9E)
263#define PM8607_VSYS_MAX (0x9F)
264
265#define PM8607_GPADC_MISC2 (0x59)
266#define PM8607_GPADC0_GP_BIAS_A0 (1 << 0)
267#define PM8607_GPADC1_GP_BIAS_A1 (1 << 1)
268#define PM8607_GPADC2_GP_BIAS_A2 (1 << 2)
269#define PM8607_GPADC3_GP_BIAS_A3 (1 << 3)
270#define PM8607_GPADC2_GP_BIAS_OUT2 (1 << 6)
271
208/* RTC Control Registers */ 272/* RTC Control Registers */
209#define PM8607_RTC1 (0xA0) 273#define PM8607_RTC1 (0xA0)
210#define PM8607_RTC_COUNTER1 (0xA1) 274#define PM8607_RTC_COUNTER1 (0xA1)
@@ -322,7 +386,7 @@ struct pm860x_chip {
322 struct regmap *regmap_companion; 386 struct regmap *regmap_companion;
323 387
324 int buck3_double; /* DVC ramp slope double */ 388 int buck3_double; /* DVC ramp slope double */
325 unsigned short companion_addr; 389 int companion_addr;
326 unsigned short osc_vote; 390 unsigned short osc_vote;
327 int id; 391 int id;
328 int irq_mode; 392 int irq_mode;
@@ -340,16 +404,12 @@ enum {
340}; 404};
341 405
342struct pm860x_backlight_pdata { 406struct pm860x_backlight_pdata {
343 int id;
344 int pwm; 407 int pwm;
345 int iset; 408 int iset;
346 unsigned long flags;
347}; 409};
348 410
349struct pm860x_led_pdata { 411struct pm860x_led_pdata {
350 int id;
351 int iset; 412 int iset;
352 unsigned long flags;
353}; 413};
354 414
355struct pm860x_rtc_pdata { 415struct pm860x_rtc_pdata {
@@ -370,7 +430,8 @@ struct pm860x_touch_pdata {
370}; 430};
371 431
372struct pm860x_power_pdata { 432struct pm860x_power_pdata {
373 unsigned fast_charge; /* charge current */ 433 int max_capacity;
434 int resistor;
374}; 435};
375 436
376struct pm860x_platform_data { 437struct pm860x_platform_data {
@@ -379,15 +440,30 @@ struct pm860x_platform_data {
379 struct pm860x_rtc_pdata *rtc; 440 struct pm860x_rtc_pdata *rtc;
380 struct pm860x_touch_pdata *touch; 441 struct pm860x_touch_pdata *touch;
381 struct pm860x_power_pdata *power; 442 struct pm860x_power_pdata *power;
382 struct regulator_init_data *regulator; 443 struct regulator_init_data *buck1;
383 444 struct regulator_init_data *buck2;
384 unsigned short companion_addr; /* I2C address of companion chip */ 445 struct regulator_init_data *buck3;
446 struct regulator_init_data *ldo1;
447 struct regulator_init_data *ldo2;
448 struct regulator_init_data *ldo3;
449 struct regulator_init_data *ldo4;
450 struct regulator_init_data *ldo5;
451 struct regulator_init_data *ldo6;
452 struct regulator_init_data *ldo7;
453 struct regulator_init_data *ldo8;
454 struct regulator_init_data *ldo9;
455 struct regulator_init_data *ldo10;
456 struct regulator_init_data *ldo12;
457 struct regulator_init_data *ldo_vibrator;
458 struct regulator_init_data *ldo14;
459 struct charger_desc *chg_desc;
460
461 int companion_addr; /* I2C address of companion chip */
385 int i2c_port; /* Controlled by GI2C or PI2C */ 462 int i2c_port; /* Controlled by GI2C or PI2C */
386 int irq_mode; /* Clear interrupt by read/write(0/1) */ 463 int irq_mode; /* Clear interrupt by read/write(0/1) */
387 int irq_base; /* IRQ base number of 88pm860x */ 464 int irq_base; /* IRQ base number of 88pm860x */
388 int num_leds; 465 int num_leds;
389 int num_backlights; 466 int num_backlights;
390 int num_regulators;
391}; 467};
392 468
393extern int pm8606_osc_enable(struct pm860x_chip *, unsigned short); 469extern int pm8606_osc_enable(struct pm860x_chip *, unsigned short);
@@ -408,8 +484,4 @@ extern int pm860x_page_bulk_write(struct i2c_client *, int, int,
408extern int pm860x_page_set_bits(struct i2c_client *, int, unsigned char, 484extern int pm860x_page_set_bits(struct i2c_client *, int, unsigned char,
409 unsigned char); 485 unsigned char);
410 486
411extern int pm860x_device_init(struct pm860x_chip *chip,
412 struct pm860x_platform_data *pdata) __devinit ;
413extern void pm860x_device_exit(struct pm860x_chip *chip) __devexit ;
414
415#endif /* __LINUX_MFD_88PM860X_H */ 487#endif /* __LINUX_MFD_88PM860X_H */
diff --git a/include/linux/mfd/ab3100.h b/include/linux/mfd/ab3100.h
new file mode 100644
index 000000000000..afd3080bde24
--- /dev/null
+++ b/include/linux/mfd/ab3100.h
@@ -0,0 +1,129 @@
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
9#include <linux/regulator/machine.h>
10
11struct device;
12
13#ifndef MFD_AB3100_H
14#define MFD_AB3100_H
15
16
17#define AB3100_P1A 0xc0
18#define AB3100_P1B 0xc1
19#define AB3100_P1C 0xc2
20#define AB3100_P1D 0xc3
21#define AB3100_P1E 0xc4
22#define AB3100_P1F 0xc5
23#define AB3100_P1G 0xc6
24#define AB3100_R2A 0xc7
25#define AB3100_R2B 0xc8
26
27/*
28 * AB3100, EVENTA1, A2 and A3 event register flags
29 * these are catenated into a single 32-bit flag in the code
30 * for event notification broadcasts.
31 */
32#define AB3100_EVENTA1_ONSWA (0x01<<16)
33#define AB3100_EVENTA1_ONSWB (0x02<<16)
34#define AB3100_EVENTA1_ONSWC (0x04<<16)
35#define AB3100_EVENTA1_DCIO (0x08<<16)
36#define AB3100_EVENTA1_OVER_TEMP (0x10<<16)
37#define AB3100_EVENTA1_SIM_OFF (0x20<<16)
38#define AB3100_EVENTA1_VBUS (0x40<<16)
39#define AB3100_EVENTA1_VSET_USB (0x80<<16)
40
41#define AB3100_EVENTA2_READY_TX (0x01<<8)
42#define AB3100_EVENTA2_READY_RX (0x02<<8)
43#define AB3100_EVENTA2_OVERRUN_ERROR (0x04<<8)
44#define AB3100_EVENTA2_FRAMING_ERROR (0x08<<8)
45#define AB3100_EVENTA2_CHARG_OVERCURRENT (0x10<<8)
46#define AB3100_EVENTA2_MIDR (0x20<<8)
47#define AB3100_EVENTA2_BATTERY_REM (0x40<<8)
48#define AB3100_EVENTA2_ALARM (0x80<<8)
49
50#define AB3100_EVENTA3_ADC_TRIG5 (0x01)
51#define AB3100_EVENTA3_ADC_TRIG4 (0x02)
52#define AB3100_EVENTA3_ADC_TRIG3 (0x04)
53#define AB3100_EVENTA3_ADC_TRIG2 (0x08)
54#define AB3100_EVENTA3_ADC_TRIGVBAT (0x10)
55#define AB3100_EVENTA3_ADC_TRIGVTX (0x20)
56#define AB3100_EVENTA3_ADC_TRIG1 (0x40)
57#define AB3100_EVENTA3_ADC_TRIG0 (0x80)
58
59/* AB3100, STR register flags */
60#define AB3100_STR_ONSWA (0x01)
61#define AB3100_STR_ONSWB (0x02)
62#define AB3100_STR_ONSWC (0x04)
63#define AB3100_STR_DCIO (0x08)
64#define AB3100_STR_BOOT_MODE (0x10)
65#define AB3100_STR_SIM_OFF (0x20)
66#define AB3100_STR_BATT_REMOVAL (0x40)
67#define AB3100_STR_VBUS (0x80)
68
69/*
70 * AB3100 contains 8 regulators, one external regulator controller
71 * and a buck converter, further the LDO E and buck converter can
72 * have separate settings if they are in sleep mode, this is
73 * modeled as a separate regulator.
74 */
75#define AB3100_NUM_REGULATORS 10
76
77/**
78 * struct ab3100
79 * @access_mutex: lock out concurrent accesses to the AB3100 registers
80 * @dev: pointer to the containing device
81 * @i2c_client: I2C client for this chip
82 * @testreg_client: secondary client for test registers
83 * @chip_name: name of this chip variant
84 * @chip_id: 8 bit chip ID for this chip variant
85 * @event_subscribers: event subscribers are listed here
86 * @startup_events: a copy of the first reading of the event registers
87 * @startup_events_read: whether the first events have been read
88 *
89 * This struct is PRIVATE and devices using it should NOT
90 * access ANY fields. It is used as a token for calling the
91 * AB3100 functions.
92 */
93struct ab3100 {
94 struct mutex access_mutex;
95 struct device *dev;
96 struct i2c_client *i2c_client;
97 struct i2c_client *testreg_client;
98 char chip_name[32];
99 u8 chip_id;
100 struct blocking_notifier_head event_subscribers;
101 u8 startup_events[3];
102 bool startup_events_read;
103};
104
105/**
106 * struct ab3100_platform_data
107 * Data supplied to initialize board connections to the AB3100
108 * @reg_constraints: regulator constraints for target board
109 * the order of these constraints are: LDO A, C, D, E,
110 * F, G, H, K, EXT and BUCK.
111 * @reg_initvals: initial values for the regulator registers
112 * plus two sleep settings for LDO E and the BUCK converter.
113 * exactly AB3100_NUM_REGULATORS+2 values must be sent in.
114 * Order: LDO A, C, E, E sleep, F, G, H, K, EXT, BUCK,
115 * BUCK sleep, LDO D. (LDO D need to be initialized last.)
116 * @external_voltage: voltage level of the external regulator.
117 */
118struct ab3100_platform_data {
119 struct regulator_init_data reg_constraints[AB3100_NUM_REGULATORS];
120 u8 reg_initvals[AB3100_NUM_REGULATORS+2];
121 int external_voltage;
122};
123
124int ab3100_event_register(struct ab3100 *ab3100,
125 struct notifier_block *nb);
126int ab3100_event_unregister(struct ab3100 *ab3100,
127 struct notifier_block *nb);
128
129#endif /* MFD_AB3100_H */
diff --git a/include/linux/mfd/abx500.h b/include/linux/mfd/abx500.h
index 1318ca622633..5d5298d56026 100644
--- a/include/linux/mfd/abx500.h
+++ b/include/linux/mfd/abx500.h
@@ -1,12 +1,9 @@
1/* 1/*
2 * Copyright (C) 2007-2009 ST-Ericsson AB 2 * Copyright (C) 2007-2009 ST-Ericsson AB
3 * License terms: GNU General Public License (GPL) version 2 3 * License terms: GNU General Public License (GPL) version 2
4 * AB3100 core access functions
5 * Author: Linus Walleij <linus.walleij@stericsson.com>
6 * 4 *
7 * ABX500 core access functions. 5 * ABX500 core access functions.
8 * The abx500 interface is used for the Analog Baseband chip 6 * The abx500 interface is used for the Analog Baseband chips.
9 * ab3100 and ab8500.
10 * 7 *
11 * Author: Mattias Wallin <mattias.wallin@stericsson.com> 8 * Author: Mattias Wallin <mattias.wallin@stericsson.com>
12 * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com> 9 * Author: Mattias Nilsson <mattias.i.nilsson@stericsson.com>
@@ -21,118 +18,6 @@ struct device;
21#ifndef MFD_ABX500_H 18#ifndef MFD_ABX500_H
22#define MFD_ABX500_H 19#define MFD_ABX500_H
23 20
24#define AB3100_P1A 0xc0
25#define AB3100_P1B 0xc1
26#define AB3100_P1C 0xc2
27#define AB3100_P1D 0xc3
28#define AB3100_P1E 0xc4
29#define AB3100_P1F 0xc5
30#define AB3100_P1G 0xc6
31#define AB3100_R2A 0xc7
32#define AB3100_R2B 0xc8
33
34/*
35 * AB3100, EVENTA1, A2 and A3 event register flags
36 * these are catenated into a single 32-bit flag in the code
37 * for event notification broadcasts.
38 */
39#define AB3100_EVENTA1_ONSWA (0x01<<16)
40#define AB3100_EVENTA1_ONSWB (0x02<<16)
41#define AB3100_EVENTA1_ONSWC (0x04<<16)
42#define AB3100_EVENTA1_DCIO (0x08<<16)
43#define AB3100_EVENTA1_OVER_TEMP (0x10<<16)
44#define AB3100_EVENTA1_SIM_OFF (0x20<<16)
45#define AB3100_EVENTA1_VBUS (0x40<<16)
46#define AB3100_EVENTA1_VSET_USB (0x80<<16)
47
48#define AB3100_EVENTA2_READY_TX (0x01<<8)
49#define AB3100_EVENTA2_READY_RX (0x02<<8)
50#define AB3100_EVENTA2_OVERRUN_ERROR (0x04<<8)
51#define AB3100_EVENTA2_FRAMING_ERROR (0x08<<8)
52#define AB3100_EVENTA2_CHARG_OVERCURRENT (0x10<<8)
53#define AB3100_EVENTA2_MIDR (0x20<<8)
54#define AB3100_EVENTA2_BATTERY_REM (0x40<<8)
55#define AB3100_EVENTA2_ALARM (0x80<<8)
56
57#define AB3100_EVENTA3_ADC_TRIG5 (0x01)
58#define AB3100_EVENTA3_ADC_TRIG4 (0x02)
59#define AB3100_EVENTA3_ADC_TRIG3 (0x04)
60#define AB3100_EVENTA3_ADC_TRIG2 (0x08)
61#define AB3100_EVENTA3_ADC_TRIGVBAT (0x10)
62#define AB3100_EVENTA3_ADC_TRIGVTX (0x20)
63#define AB3100_EVENTA3_ADC_TRIG1 (0x40)
64#define AB3100_EVENTA3_ADC_TRIG0 (0x80)
65
66/* AB3100, STR register flags */
67#define AB3100_STR_ONSWA (0x01)
68#define AB3100_STR_ONSWB (0x02)
69#define AB3100_STR_ONSWC (0x04)
70#define AB3100_STR_DCIO (0x08)
71#define AB3100_STR_BOOT_MODE (0x10)
72#define AB3100_STR_SIM_OFF (0x20)
73#define AB3100_STR_BATT_REMOVAL (0x40)
74#define AB3100_STR_VBUS (0x80)
75
76/*
77 * AB3100 contains 8 regulators, one external regulator controller
78 * and a buck converter, further the LDO E and buck converter can
79 * have separate settings if they are in sleep mode, this is
80 * modeled as a separate regulator.
81 */
82#define AB3100_NUM_REGULATORS 10
83
84/**
85 * struct ab3100
86 * @access_mutex: lock out concurrent accesses to the AB3100 registers
87 * @dev: pointer to the containing device
88 * @i2c_client: I2C client for this chip
89 * @testreg_client: secondary client for test registers
90 * @chip_name: name of this chip variant
91 * @chip_id: 8 bit chip ID for this chip variant
92 * @event_subscribers: event subscribers are listed here
93 * @startup_events: a copy of the first reading of the event registers
94 * @startup_events_read: whether the first events have been read
95 *
96 * This struct is PRIVATE and devices using it should NOT
97 * access ANY fields. It is used as a token for calling the
98 * AB3100 functions.
99 */
100struct ab3100 {
101 struct mutex access_mutex;
102 struct device *dev;
103 struct i2c_client *i2c_client;
104 struct i2c_client *testreg_client;
105 char chip_name[32];
106 u8 chip_id;
107 struct blocking_notifier_head event_subscribers;
108 u8 startup_events[3];
109 bool startup_events_read;
110};
111
112/**
113 * struct ab3100_platform_data
114 * Data supplied to initialize board connections to the AB3100
115 * @reg_constraints: regulator constraints for target board
116 * the order of these constraints are: LDO A, C, D, E,
117 * F, G, H, K, EXT and BUCK.
118 * @reg_initvals: initial values for the regulator registers
119 * plus two sleep settings for LDO E and the BUCK converter.
120 * exactly AB3100_NUM_REGULATORS+2 values must be sent in.
121 * Order: LDO A, C, E, E sleep, F, G, H, K, EXT, BUCK,
122 * BUCK sleep, LDO D. (LDO D need to be initialized last.)
123 * @external_voltage: voltage level of the external regulator.
124 */
125struct ab3100_platform_data {
126 struct regulator_init_data reg_constraints[AB3100_NUM_REGULATORS];
127 u8 reg_initvals[AB3100_NUM_REGULATORS+2];
128 int external_voltage;
129};
130
131int ab3100_event_register(struct ab3100 *ab3100,
132 struct notifier_block *nb);
133int ab3100_event_unregister(struct ab3100 *ab3100,
134 struct notifier_block *nb);
135
136/** 21/**
137 * struct abx500_init_setting 22 * struct abx500_init_setting
138 * Initial value of the registers for driver to use during setup. 23 * Initial value of the registers for driver to use during setup.
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 3764cb6759e3..1491044efa10 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -341,6 +341,4 @@ static inline int is_ab8500_2p0(struct ab8500 *ab)
341 return (is_ab8500(ab) && (ab->chip_id == AB8500_CUT2P0)); 341 return (is_ab8500(ab) && (ab->chip_id == AB8500_CUT2P0));
342} 342}
343 343
344int ab8500_irq_get_virq(struct ab8500 *ab8500, int irq);
345
346#endif /* MFD_AB8500_H */ 344#endif /* MFD_AB8500_H */
diff --git a/include/linux/mfd/anatop.h b/include/linux/mfd/anatop.h
deleted file mode 100644
index 7f92acf03d9e..000000000000
--- a/include/linux/mfd/anatop.h
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * anatop.h - Anatop MFD driver
3 *
4 * Copyright (C) 2012 Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
5 * Copyright (C) 2012 Linaro
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef __LINUX_MFD_ANATOP_H
23#define __LINUX_MFD_ANATOP_H
24
25#include <linux/spinlock.h>
26
27/**
28 * anatop - MFD data
29 * @ioreg: ioremap register
30 * @reglock: spinlock for register read/write
31 */
32struct anatop {
33 void *ioreg;
34 spinlock_t reglock;
35};
36
37extern u32 anatop_read_reg(struct anatop *, u32);
38extern void anatop_write_reg(struct anatop *, u32, u32, u32);
39
40#endif /* __LINUX_MFD_ANATOP_H */
diff --git a/include/linux/mfd/da9055/core.h b/include/linux/mfd/da9055/core.h
new file mode 100644
index 000000000000..c96ad682c59e
--- /dev/null
+++ b/include/linux/mfd/da9055/core.h
@@ -0,0 +1,94 @@
1/*
2 * da9055 declarations for DA9055 PMICs.
3 *
4 * Copyright(c) 2012 Dialog Semiconductor Ltd.
5 *
6 * Author: David Dajun Chen <dchen@diasemi.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 */
23
24#ifndef __DA9055_CORE_H
25#define __DA9055_CORE_H
26
27#include <linux/interrupt.h>
28#include <linux/regmap.h>
29
30/*
31 * PMIC IRQ
32 */
33#define DA9055_IRQ_ALARM 0x01
34#define DA9055_IRQ_TICK 0x02
35#define DA9055_IRQ_NONKEY 0x00
36#define DA9055_IRQ_REGULATOR 0x0B
37#define DA9055_IRQ_HWMON 0x03
38
39struct da9055_pdata;
40
41struct da9055 {
42 struct regmap *regmap;
43 struct regmap_irq_chip_data *irq_data;
44 struct device *dev;
45 struct i2c_client *i2c_client;
46
47 int irq_base;
48 int chip_irq;
49};
50
51/* Device I/O */
52static inline int da9055_reg_read(struct da9055 *da9055, unsigned char reg)
53{
54 int val, ret;
55
56 ret = regmap_read(da9055->regmap, reg, &val);
57 if (ret < 0)
58 return ret;
59
60 return val;
61}
62
63static inline int da9055_reg_write(struct da9055 *da9055, unsigned char reg,
64 unsigned char val)
65{
66 return regmap_write(da9055->regmap, reg, val);
67}
68
69static inline int da9055_group_read(struct da9055 *da9055, unsigned char reg,
70 unsigned reg_cnt, unsigned char *val)
71{
72 return regmap_bulk_read(da9055->regmap, reg, val, reg_cnt);
73}
74
75static inline int da9055_group_write(struct da9055 *da9055, unsigned char reg,
76 unsigned reg_cnt, unsigned char *val)
77{
78 return regmap_raw_write(da9055->regmap, reg, val, reg_cnt);
79}
80
81static inline int da9055_reg_update(struct da9055 *da9055, unsigned char reg,
82 unsigned char bit_mask,
83 unsigned char reg_val)
84{
85 return regmap_update_bits(da9055->regmap, reg, bit_mask, reg_val);
86}
87
88/* Generic Device API */
89int da9055_device_init(struct da9055 *da9055);
90void da9055_device_exit(struct da9055 *da9055);
91
92extern struct regmap_config da9055_regmap_config;
93
94#endif /* __DA9055_CORE_H */
diff --git a/include/linux/mfd/da9055/pdata.h b/include/linux/mfd/da9055/pdata.h
new file mode 100644
index 000000000000..147293b4471d
--- /dev/null
+++ b/include/linux/mfd/da9055/pdata.h
@@ -0,0 +1,32 @@
1/* Copyright (C) 2012 Dialog Semiconductor Ltd.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 */
9#ifndef __DA9055_PDATA_H
10#define __DA9055_PDATA_H
11
12#define DA9055_MAX_REGULATORS 8
13
14struct da9055;
15
16enum gpio_select {
17 NO_GPIO = 0,
18 GPIO_1,
19 GPIO_2
20};
21
22struct da9055_pdata {
23 int (*init) (struct da9055 *da9055);
24 int irq_base;
25 int gpio_base;
26
27 struct regulator_init_data *regulators[DA9055_MAX_REGULATORS];
28 bool reset_enable; /* Enable RTC in RESET Mode */
29 enum gpio_select *gpio_rsel; /* Select regulator set thru GPIO 1/2 */
30 enum gpio_select *gpio_ren; /* Enable regulator thru GPIO 1/2 */
31};
32#endif /* __DA9055_PDATA_H */
diff --git a/include/linux/mfd/da9055/reg.h b/include/linux/mfd/da9055/reg.h
new file mode 100644
index 000000000000..df237ee54803
--- /dev/null
+++ b/include/linux/mfd/da9055/reg.h
@@ -0,0 +1,699 @@
1/*
2 * DA9055 declarations for DA9055 PMICs.
3 *
4 * Copyright(c) 2012 Dialog Semiconductor Ltd.
5 *
6 * Author: David Dajun Chen <dchen@diasemi.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 */
23
24#ifndef __DA9055_REG_H
25#define __DA9055_REG_H
26
27/*
28 * PMIC registers
29 */
30 /* PAGE0 */
31#define DA9055_REG_PAGE_CON 0x00
32
33/* System Control and Event Registers */
34#define DA9055_REG_STATUS_A 0x01
35#define DA9055_REG_STATUS_B 0x02
36#define DA9055_REG_FAULT_LOG 0x03
37#define DA9055_REG_EVENT_A 0x04
38#define DA9055_REG_EVENT_B 0x05
39#define DA9055_REG_EVENT_C 0x06
40#define DA9055_REG_IRQ_MASK_A 0x07
41#define DA9055_REG_IRQ_MASK_B 0x08
42#define DA9055_REG_IRQ_MASK_C 0x09
43#define DA9055_REG_CONTROL_A 0x0A
44#define DA9055_REG_CONTROL_B 0x0B
45#define DA9055_REG_CONTROL_C 0x0C
46#define DA9055_REG_CONTROL_D 0x0D
47#define DA9055_REG_CONTROL_E 0x0E
48#define DA9055_REG_PD_DIS 0x0F
49
50/* GPIO Control Registers */
51#define DA9055_REG_GPIO0_1 0x10
52#define DA9055_REG_GPIO2 0x11
53#define DA9055_REG_GPIO_MODE0_2 0x12
54
55/* Regulator Control Registers */
56#define DA9055_REG_BCORE_CONT 0x13
57#define DA9055_REG_BMEM_CONT 0x14
58#define DA9055_REG_LDO1_CONT 0x15
59#define DA9055_REG_LDO2_CONT 0x16
60#define DA9055_REG_LDO3_CONT 0x17
61#define DA9055_REG_LDO4_CONT 0x18
62#define DA9055_REG_LDO5_CONT 0x19
63#define DA9055_REG_LDO6_CONT 0x1A
64
65/* GP-ADC Control Registers */
66#define DA9055_REG_ADC_MAN 0x1B
67#define DA9055_REG_ADC_CONT 0x1C
68#define DA9055_REG_VSYS_MON 0x1D
69#define DA9055_REG_ADC_RES_L 0x1E
70#define DA9055_REG_ADC_RES_H 0x1F
71#define DA9055_REG_VSYS_RES 0x20
72#define DA9055_REG_ADCIN1_RES 0x21
73#define DA9055_REG_ADCIN2_RES 0x22
74#define DA9055_REG_ADCIN3_RES 0x23
75
76/* Sequencer Control Registers */
77#define DA9055_REG_EN_32K 0x35
78
79/* Regulator Setting Registers */
80#define DA9055_REG_BUCK_LIM 0x37
81#define DA9055_REG_BCORE_MODE 0x38
82#define DA9055_REG_VBCORE_A 0x39
83#define DA9055_REG_VBMEM_A 0x3A
84#define DA9055_REG_VLDO1_A 0x3B
85#define DA9055_REG_VLDO2_A 0x3C
86#define DA9055_REG_VLDO3_A 0x3D
87#define DA9055_REG_VLDO4_A 0x3E
88#define DA9055_REG_VLDO5_A 0x3F
89#define DA9055_REG_VLDO6_A 0x40
90#define DA9055_REG_VBCORE_B 0x41
91#define DA9055_REG_VBMEM_B 0x42
92#define DA9055_REG_VLDO1_B 0x43
93#define DA9055_REG_VLDO2_B 0x44
94#define DA9055_REG_VLDO3_B 0x45
95#define DA9055_REG_VLDO4_B 0x46
96#define DA9055_REG_VLDO5_B 0x47
97#define DA9055_REG_VLDO6_B 0x48
98
99/* GP-ADC Threshold Registers */
100#define DA9055_REG_AUTO1_HIGH 0x49
101#define DA9055_REG_AUTO1_LOW 0x4A
102#define DA9055_REG_AUTO2_HIGH 0x4B
103#define DA9055_REG_AUTO2_LOW 0x4C
104#define DA9055_REG_AUTO3_HIGH 0x4D
105#define DA9055_REG_AUTO3_LOW 0x4E
106
107/* OTP */
108#define DA9055_REG_OPT_COUNT 0x50
109#define DA9055_REG_OPT_ADDR 0x51
110#define DA9055_REG_OPT_DATA 0x52
111
112/* RTC Calendar and Alarm Registers */
113#define DA9055_REG_COUNT_S 0x53
114#define DA9055_REG_COUNT_MI 0x54
115#define DA9055_REG_COUNT_H 0x55
116#define DA9055_REG_COUNT_D 0x56
117#define DA9055_REG_COUNT_MO 0x57
118#define DA9055_REG_COUNT_Y 0x58
119#define DA9055_REG_ALARM_MI 0x59
120#define DA9055_REG_ALARM_H 0x5A
121#define DA9055_REG_ALARM_D 0x5B
122#define DA9055_REG_ALARM_MO 0x5C
123#define DA9055_REG_ALARM_Y 0x5D
124#define DA9055_REG_SECOND_A 0x5E
125#define DA9055_REG_SECOND_B 0x5F
126#define DA9055_REG_SECOND_C 0x60
127#define DA9055_REG_SECOND_D 0x61
128
129/* Customer Trim and Configuration */
130#define DA9055_REG_T_OFFSET 0x63
131#define DA9055_REG_INTERFACE 0x64
132#define DA9055_REG_CONFIG_A 0x65
133#define DA9055_REG_CONFIG_B 0x66
134#define DA9055_REG_CONFIG_C 0x67
135#define DA9055_REG_CONFIG_D 0x68
136#define DA9055_REG_CONFIG_E 0x69
137#define DA9055_REG_TRIM_CLDR 0x6F
138
139/* General Purpose Registers */
140#define DA9055_REG_GP_ID_0 0x70
141#define DA9055_REG_GP_ID_1 0x71
142#define DA9055_REG_GP_ID_2 0x72
143#define DA9055_REG_GP_ID_3 0x73
144#define DA9055_REG_GP_ID_4 0x74
145#define DA9055_REG_GP_ID_5 0x75
146#define DA9055_REG_GP_ID_6 0x76
147#define DA9055_REG_GP_ID_7 0x77
148#define DA9055_REG_GP_ID_8 0x78
149#define DA9055_REG_GP_ID_9 0x79
150#define DA9055_REG_GP_ID_10 0x7A
151#define DA9055_REG_GP_ID_11 0x7B
152#define DA9055_REG_GP_ID_12 0x7C
153#define DA9055_REG_GP_ID_13 0x7D
154#define DA9055_REG_GP_ID_14 0x7E
155#define DA9055_REG_GP_ID_15 0x7F
156#define DA9055_REG_GP_ID_16 0x80
157#define DA9055_REG_GP_ID_17 0x81
158#define DA9055_REG_GP_ID_18 0x82
159#define DA9055_REG_GP_ID_19 0x83
160
161#define DA9055_MAX_REGISTER_CNT DA9055_REG_GP_ID_19
162
163/*
164 * PMIC registers bits
165 */
166
167/* DA9055_REG_PAGE_CON (addr=0x00) */
168#define DA9055_PAGE_WRITE_MODE (0<<6)
169#define DA9055_REPEAT_WRITE_MODE (1<<6)
170
171/* DA9055_REG_STATUS_A (addr=0x01) */
172#define DA9055_NOKEY_STS 0x01
173#define DA9055_WAKE_STS 0x02
174#define DA9055_DVC_BUSY_STS 0x04
175#define DA9055_COMP1V2_STS 0x08
176#define DA9055_NJIG_STS 0x10
177#define DA9055_LDO5_LIM_STS 0x20
178#define DA9055_LDO6_LIM_STS 0x40
179
180/* DA9055_REG_STATUS_B (addr=0x02) */
181#define DA9055_GPI0_STS 0x01
182#define DA9055_GPI1_STS 0x02
183#define DA9055_GPI2_STS 0x04
184
185/* DA9055_REG_FAULT_LOG (addr=0x03) */
186#define DA9055_TWD_ERROR_FLG 0x01
187#define DA9055_POR_FLG 0x02
188#define DA9055_VDD_FAULT_FLG 0x04
189#define DA9055_VDD_START_FLG 0x08
190#define DA9055_TEMP_CRIT_FLG 0x10
191#define DA9055_KEY_RESET_FLG 0x20
192#define DA9055_WAIT_SHUT_FLG 0x80
193
194/* DA9055_REG_EVENT_A (addr=0x04) */
195#define DA9055_NOKEY_EINT 0x01
196#define DA9055_ALARM_EINT 0x02
197#define DA9055_TICK_EINT 0x04
198#define DA9055_ADC_RDY_EINT 0x08
199#define DA9055_SEQ_RDY_EINT 0x10
200#define DA9055_EVENTS_B_EINT 0x20
201#define DA9055_EVENTS_C_EINT 0x40
202
203/* DA9055_REG_EVENT_B (addr=0x05) */
204#define DA9055_E_WAKE_EINT 0x01
205#define DA9055_E_TEMP_EINT 0x02
206#define DA9055_E_COMP1V2_EINT 0x04
207#define DA9055_E_LDO_LIM_EINT 0x08
208#define DA9055_E_NJIG_EINT 0x20
209#define DA9055_E_VDD_MON_EINT 0x40
210#define DA9055_E_VDD_WARN_EINT 0x80
211
212/* DA9055_REG_EVENT_C (addr=0x06) */
213#define DA9055_E_GPI0_EINT 0x01
214#define DA9055_E_GPI1_EINT 0x02
215#define DA9055_E_GPI2_EINT 0x04
216
217/* DA9055_REG_IRQ_MASK_A (addr=0x07) */
218#define DA9055_M_NONKEY_EINT 0x01
219#define DA9055_M_ALARM_EINT 0x02
220#define DA9055_M_TICK_EINT 0x04
221#define DA9055_M_ADC_RDY_EINT 0x08
222#define DA9055_M_SEQ_RDY_EINT 0x10
223
224/* DA9055_REG_IRQ_MASK_B (addr=0x08) */
225#define DA9055_M_WAKE_EINT 0x01
226#define DA9055_M_TEMP_EINT 0x02
227#define DA9055_M_COMP_1V2_EINT 0x04
228#define DA9055_M_LDO_LIM_EINT 0x08
229#define DA9055_M_NJIG_EINT 0x20
230#define DA9055_M_VDD_MON_EINT 0x40
231#define DA9055_M_VDD_WARN_EINT 0x80
232
233/* DA9055_REG_IRQ_MASK_C (addr=0x09) */
234#define DA9055_M_GPI0_EINT 0x01
235#define DA9055_M_GPI1_EINT 0x02
236#define DA9055_M_GPI2_EINT 0x04
237
238/* DA9055_REG_CONTROL_A (addr=0xA) */
239#define DA9055_DEBOUNCING_SHIFT 0x00
240#define DA9055_DEBOUNCING_MASK 0x07
241#define DA9055_NRES_MODE_SHIFT 0x03
242#define DA9055_NRES_MODE_MASK 0x08
243#define DA9055_SLEW_RATE_SHIFT 0x04
244#define DA9055_SLEW_RATE_MASK 0x30
245#define DA9055_NOKEY_LOCK_SHIFT 0x06
246#define DA9055_NOKEY_LOCK_MASK 0x40
247
248/* DA9055_REG_CONTROL_B (addr=0xB) */
249#define DA9055_RTC_MODE_PD 0x01
250#define DA9055_RTC_MODE_SD_SHIFT 0x01
251#define DA9055_RTC_MODE_SD 0x02
252#define DA9055_RTC_EN 0x04
253#define DA9055_ECO_MODE_SHIFT 0x03
254#define DA9055_ECO_MODE_MASK 0x08
255#define DA9055_TWDSCALE_SHIFT 4
256#define DA9055_TWDSCALE_MASK 0x70
257#define DA9055_V_LOCK_SHIFT 0x07
258#define DA9055_V_LOCK_MASK 0x80
259
260/* DA9055_REG_CONTROL_C (addr=0xC) */
261#define DA9055_SYSTEM_EN_SHIFT 0x00
262#define DA9055_SYSTEM_EN_MASK 0x01
263#define DA9055_POWERN_EN_SHIFT 0x01
264#define DA9055_POWERN_EN_MASK 0x02
265#define DA9055_POWER1_EN_SHIFT 0x02
266#define DA9055_POWER1_EN_MASK 0x04
267
268/* DA9055_REG_CONTROL_D (addr=0xD) */
269#define DA9055_STANDBY_SHIFT 0x02
270#define DA9055_STANDBY_MASK 0x08
271#define DA9055_AUTO_BOOT_SHIFT 0x03
272#define DA9055_AUTO_BOOT_MASK 0x04
273
274/* DA9055_REG_CONTROL_E (addr=0xE) */
275#define DA9055_WATCHDOG_SHIFT 0x00
276#define DA9055_WATCHDOG_MASK 0x01
277#define DA9055_SHUTDOWN_SHIFT 0x01
278#define DA9055_SHUTDOWN_MASK 0x02
279#define DA9055_WAKE_UP_SHIFT 0x02
280#define DA9055_WAKE_UP_MASK 0x04
281
282/* DA9055_REG_GPIO (addr=0x10/0x11) */
283#define DA9055_GPIO0_PIN_SHIFT 0x00
284#define DA9055_GPIO0_PIN_MASK 0x03
285#define DA9055_GPIO0_TYPE_SHIFT 0x02
286#define DA9055_GPIO0_TYPE_MASK 0x04
287#define DA9055_GPIO0_WEN_SHIFT 0x03
288#define DA9055_GPIO0_WEN_MASK 0x08
289#define DA9055_GPIO1_PIN_SHIFT 0x04
290#define DA9055_GPIO1_PIN_MASK 0x30
291#define DA9055_GPIO1_TYPE_SHIFT 0x06
292#define DA9055_GPIO1_TYPE_MASK 0x40
293#define DA9055_GPIO1_WEN_SHIFT 0x07
294#define DA9055_GPIO1_WEN_MASK 0x80
295#define DA9055_GPIO2_PIN_SHIFT 0x00
296#define DA9055_GPIO2_PIN_MASK 0x30
297#define DA9055_GPIO2_TYPE_SHIFT 0x02
298#define DA9055_GPIO2_TYPE_MASK 0x04
299#define DA9055_GPIO2_WEN_SHIFT 0x03
300#define DA9055_GPIO2_WEN_MASK 0x08
301
302/* DA9055_REG_GPIO_MODE (addr=0x12) */
303#define DA9055_GPIO0_MODE_SHIFT 0x00
304#define DA9055_GPIO0_MODE_MASK 0x01
305#define DA9055_GPIO1_MODE_SHIFT 0x01
306#define DA9055_GPIO1_MODE_MASK 0x02
307#define DA9055_GPIO2_MODE_SHIFT 0x02
308#define DA9055_GPIO2_MODE_MASK 0x04
309
310/* DA9055_REG_BCORE_CONT (addr=0x13) */
311#define DA9055_BCORE_EN_SHIFT 0x00
312#define DA9055_BCORE_EN_MASK 0x01
313#define DA9055_BCORE_GPI_SHIFT 0x01
314#define DA9055_BCORE_GPI_MASK 0x02
315#define DA9055_BCORE_PD_DIS_SHIFT 0x03
316#define DA9055_BCORE_PD_DIS_MASK 0x04
317#define DA9055_VBCORE_SEL_SHIFT 0x04
318#define DA9055_SEL_REG_A 0x0
319#define DA9055_SEL_REG_B 0x10
320#define DA9055_VBCORE_SEL_MASK 0x10
321#define DA9055_V_GPI_MASK 0x60
322#define DA9055_V_GPI_SHIFT 0x05
323#define DA9055_E_GPI_MASK 0x06
324#define DA9055_E_GPI_SHIFT 0x01
325#define DA9055_VBCORE_GPI_SHIFT 0x05
326#define DA9055_VBCORE_GPI_MASK 0x60
327#define DA9055_BCORE_CONF_SHIFT 0x07
328#define DA9055_BCORE_CONF_MASK 0x80
329
330/* DA9055_REG_BMEM_CONT (addr=0x14) */
331#define DA9055_BMEM_EN_SHIFT 0x00
332#define DA9055_BMEM_EN_MASK 0x01
333#define DA9055_BMEM_GPI_SHIFT 0x01
334#define DA9055_BMEM_GPI_MASK 0x06
335#define DA9055_BMEM_PD_DIS_SHIFT 0x03
336#define DA9055_BMEM_PD_DIS_MASK 0x08
337#define DA9055_VBMEM_SEL_SHIT 0x04
338#define DA9055_VBMEM_SEL_VBMEM_A (0<<4)
339#define DA9055_VBMEM_SEL_VBMEM_B (1<<4)
340#define DA9055_VBMEM_SEL_MASK 0x10
341#define DA9055_VBMEM_GPI_SHIFT 0x05
342#define DA9055_VBMEM_GPI_MASK 0x60
343#define DA9055_BMEM_CONF_SHIFT 0x07
344#define DA9055_BMEM_CONF_MASK 0x80
345
346/* DA9055_REG_LDO_CONT (addr=0x15-0x1A) */
347#define DA9055_LDO_EN_SHIFT 0x00
348#define DA9055_LDO_EN_MASK 0x01
349#define DA9055_LDO_GPI_SHIFT 0x01
350#define DA9055_LDO_GPI_MASK 0x06
351#define DA9055_LDO_PD_DIS_SHIFT 0x03
352#define DA9055_LDO_PD_DIS_MASK 0x08
353#define DA9055_VLDO_SEL_SHIFT 0x04
354#define DA9055_VLDO_SEL_MASK 0x10
355#define DA9055_VLDO_SEL_VLDO_A 0x00
356#define DA9055_VLDO_SEL_VLDO_B 0x01
357#define DA9055_VLDO_GPI_SHIFT 0x05
358#define DA9055_VLDO_GPI_MASK 0x60
359#define DA9055_LDO_CONF_SHIFT 0x07
360#define DA9055_LDO_CONF_MASK 0x80
361#define DA9055_REGUALTOR_SET_A 0x00
362#define DA9055_REGUALTOR_SET_B 0x10
363
364/* DA9055_REG_ADC_MAN (addr=0x1B) */
365#define DA9055_ADC_MUX_SHIFT 0
366#define DA9055_ADC_MUX_MASK 0xF
367#define DA9055_ADC_MUX_VSYS 0x0
368#define DA9055_ADC_MUX_ADCIN1 0x01
369#define DA9055_ADC_MUX_ADCIN2 0x02
370#define DA9055_ADC_MUX_ADCIN3 0x03
371#define DA9055_ADC_MUX_T_SENSE 0x04
372#define DA9055_ADC_MAN_SHIFT 0x04
373#define DA9055_ADC_MAN_CONV 0x10
374#define DA9055_ADC_LSB_MASK 0X03
375#define DA9055_ADC_MODE_MASK 0x20
376#define DA9055_ADC_MODE_SHIFT 5
377#define DA9055_ADC_MODE_1MS (1<<5)
378#define DA9055_COMP1V2_EN_SHIFT 7
379
380/* DA9055_REG_ADC_CONT (addr=0x1C) */
381#define DA9055_ADC_AUTO_VSYS_EN_SHIFT 0
382#define DA9055_ADC_AUTO_AD1_EN_SHIFT 1
383#define DA9055_ADC_AUTO_AD2_EN_SHIFT 2
384#define DA9055_ADC_AUTO_AD3_EN_SHIFT 3
385#define DA9055_ADC_ISRC_EN_SHIFT 4
386#define DA9055_ADC_ADCIN1_DEB_SHIFT 5
387#define DA9055_ADC_ADCIN2_DEB_SHIFT 6
388#define DA9055_ADC_ADCIN3_DEB_SHIFT 7
389#define DA9055_AD1_ISRC_MASK 0x10
390#define DA9055_AD1_ISRC_SHIFT 4
391
392/* DA9055_REG_VSYS_MON (addr=0x1D) */
393#define DA9055_VSYS_VAL_SHIFT 0
394#define DA9055_VSYS_VAL_MASK 0xFF
395#define DA9055_VSYS_VAL_BASE 0x00
396#define DA9055_VSYS_VAL_MAX DA9055_VSYS_VAL_MASK
397#define DA9055_VSYS_VOLT_BASE 2500
398#define DA9055_VSYS_VOLT_INC 10
399#define DA9055_VSYS_STEPS 255
400#define DA9055_VSYS_VOLT_MIN 2500
401
402/* DA9044_REG_XXX_RES (addr=0x20-0x23) */
403#define DA9055_ADC_VAL_SHIFT 0
404#define DA9055_ADC_VAL_MASK 0xFF
405#define DA9055_ADC_VAL_BASE 0x00
406#define DA9055_ADC_VAL_MAX DA9055_ADC_VAL_MASK
407#define DA9055_ADC_VOLT_BASE 0
408#define DA9055_ADC_VSYS_VOLT_BASE 2500
409#define DA9055_ADC_VOLT_INC 10
410#define DA9055_ADC_VSYS_VOLT_INC 12
411#define DA9055_ADC_STEPS 255
412
413/* DA9055_REG_EN_32K (addr=0x35)*/
414#define DA9055_STARTUP_TIME_MASK 0x07
415#define DA9055_STARTUP_TIME_0S 0x0
416#define DA9055_STARTUP_TIME_0_52S 0x1
417#define DA9055_STARTUP_TIME_1S 0x2
418#define DA9055_CRYSTAL_EN 0x08
419#define DA9055_DELAY_MODE_EN 0x10
420#define DA9055_OUT_CLCK_GATED 0x20
421#define DA9055_RTC_CLOCK_GATED 0x40
422#define DA9055_EN_32KOUT_BUF 0x80
423
424/* DA9055_REG_RESET (addr=0x36) */
425/* Timer up to 31.744 ms */
426#define DA9055_RESET_TIMER_VAL_SHIFT 0
427#define DA9055_RESET_LOW_VAL_MASK 0x3F
428#define DA9055_RESET_LOW_VAL_BASE 0
429#define DA9055_RESET_LOW_VAL_MAX DA9055_RESET_LOW_VAL_MASK
430#define DA9055_RESET_US_LOW_BASE 1024 /* min val in units of us */
431#define DA9055_RESET_US_LOW_INC 1024 /* inc val in units of us */
432#define DA9055_RESET_US_LOW_STEP 30
433
434/* Timer up to 1048.576ms */
435#define DA9055_RESET_HIGH_VAL_MASK 0x3F
436#define DA9055_RESET_HIGH_VAL_BASE 0
437#define DA9055_RESET_HIGH_VAL_MAX DA9055_RESET_HIGH_VAL_MASK
438#define DA9055_RESET_US_HIGH_BASE 32768 /* min val in units of us */
439#define DA9055_RESET_US_HIGH_INC 32768 /* inv val in units of us */
440#define DA9055_RESET_US_HIGH_STEP 31
441
442/* DA9055_REG_BUCK_ILIM (addr=0x37)*/
443#define DA9055_BMEM_ILIM_SHIFT 0
444#define DA9055_ILIM_MASK 0x3
445#define DA9055_ILIM_500MA 0x0
446#define DA9055_ILIM_600MA 0x1
447#define DA9055_ILIM_700MA 0x2
448#define DA9055_ILIM_800MA 0x3
449#define DA9055_BCORE_ILIM_SHIFT 2
450
451/* DA9055_REG_BCORE_MODE (addr=0x38) */
452#define DA9055_BMEM_MODE_SHIFT 0
453#define DA9055_MODE_MASK 0x3
454#define DA9055_MODE_AB 0x0
455#define DA9055_MODE_SLEEP 0x1
456#define DA9055_MODE_SYNCHRO 0x2
457#define DA9055_MODE_AUTO 0x3
458#define DA9055_BCORE_MODE_SHIFT 2
459
460/* DA9055_REG_VBCORE_A/B (addr=0x39/0x41)*/
461#define DA9055_VBCORE_VAL_SHIFT 0
462#define DA9055_VBCORE_VAL_MASK 0x3F
463#define DA9055_VBCORE_VAL_BASE 0x09
464#define DA9055_VBCORE_VAL_MAX DA9055_VBCORE_VAL_MASK
465#define DA9055_VBCORE_VOLT_BASE 750
466#define DA9055_VBCORE_VOLT_INC 25
467#define DA9055_VBCORE_STEPS 53
468#define DA9055_VBCORE_VOLT_MIN DA9055_VBCORE_VOLT_BASE
469#define DA9055_BCORE_SL_SYNCHRO (0<<7)
470#define DA9055_BCORE_SL_SLEEP (1<<7)
471
472/* DA9055_REG_VBMEM_A/B (addr=0x3A/0x42)*/
473#define DA9055_VBMEM_VAL_SHIFT 0
474#define DA9055_VBMEM_VAL_MASK 0x3F
475#define DA9055_VBMEM_VAL_BASE 0x00
476#define DA9055_VBMEM_VAL_MAX DA9055_VBMEM_VAL_MASK
477#define DA9055_VBMEM_VOLT_BASE 925
478#define DA9055_VBMEM_VOLT_INC 25
479#define DA9055_VBMEM_STEPS 63
480#define DA9055_VBMEM_VOLT_MIN DA9055_VBMEM_VOLT_BASE
481#define DA9055_BCMEM_SL_SYNCHRO (0<<7)
482#define DA9055_BCMEM_SL_SLEEP (1<<7)
483
484
485/* DA9055_REG_VLDO (addr=0x3B-0x40/0x43-0x48)*/
486#define DA9055_VLDO_VAL_SHIFT 0
487#define DA9055_VLDO_VAL_MASK 0x3F
488#define DA9055_VLDO6_VAL_MASK 0x7F
489#define DA9055_VLDO_VAL_BASE 0x02
490#define DA9055_VLDO2_VAL_BASE 0x03
491#define DA9055_VLDO6_VAL_BASE 0x00
492#define DA9055_VLDO_VAL_MAX DA9055_VLDO_VAL_MASK
493#define DA9055_VLDO6_VAL_MAX DA9055_VLDO6_VAL_MASK
494#define DA9055_VLDO_VOLT_BASE 900
495#define DA9055_VLDO_VOLT_INC 50
496#define DA9055_VLDO6_VOLT_INC 20
497#define DA9055_VLDO_STEPS 48
498#define DA9055_VLDO5_STEPS 37
499#define DA9055_VLDO6_STEPS 120
500#define DA9055_VLDO_VOLT_MIN DA9055_VLDO_VOLT_BASE
501#define DA9055_LDO_MODE_SHIFT 7
502#define DA9055_LDO_SL_NORMAL 0
503#define DA9055_LDO_SL_SLEEP 1
504
505/* DA9055_REG_OTP_CONT (addr=0x50) */
506#define DA9055_OTP_TIM_NORMAL (0<<0)
507#define DA9055_OTP_TIM_MARGINAL (1<<0)
508#define DA9055_OTP_GP_RD_SHIFT 1
509#define DA9055_OTP_APPS_RD_SHIFT 2
510#define DA9055_PC_DONE_SHIFT 3
511#define DA9055_OTP_GP_LOCK_SHIFT 4
512#define DA9055_OTP_APPS_LOCK_SHIFT 5
513#define DA9055_OTP_CONF_LOCK_SHIFT 6
514#define DA9055_OTP_WRITE_DIS_SHIFT 7
515
516/* DA9055_REG_COUNT_S (addr=0x53) */
517#define DA9055_RTC_SEC 0x3F
518#define DA9055_RTC_MONITOR_EN 0x40
519#define DA9055_RTC_READ 0x80
520
521/* DA9055_REG_COUNT_MI (addr=0x54) */
522#define DA9055_RTC_MIN 0x3F
523
524/* DA9055_REG_COUNT_H (addr=0x55) */
525#define DA9055_RTC_HOUR 0x1F
526
527/* DA9055_REG_COUNT_D (addr=0x56) */
528#define DA9055_RTC_DAY 0x1F
529
530/* DA9055_REG_COUNT_MO (addr=0x57) */
531#define DA9055_RTC_MONTH 0x0F
532
533/* DA9055_REG_COUNT_Y (addr=0x58) */
534#define DA9055_RTC_YEAR 0x3F
535#define DA9055_RTC_YEAR_BASE 2000
536
537/* DA9055_REG_ALARM_MI (addr=0x59) */
538#define DA9055_RTC_ALM_MIN 0x3F
539#define DA9055_ALARM_STATUS_SHIFT 6
540#define DA9055_ALARM_STATUS_MASK 0x3
541#define DA9055_ALARM_STATUS_NO_ALARM 0x0
542#define DA9055_ALARM_STATUS_TICK 0x1
543#define DA9055_ALARM_STATUS_TIMER_ALARM 0x2
544#define DA9055_ALARM_STATUS_BOTH 0x3
545
546/* DA9055_REG_ALARM_H (addr=0x5A) */
547#define DA9055_RTC_ALM_HOUR 0x1F
548
549/* DA9055_REG_ALARM_D (addr=0x5B) */
550#define DA9055_RTC_ALM_DAY 0x1F
551
552/* DA9055_REG_ALARM_MO (addr=0x5C) */
553#define DA9055_RTC_ALM_MONTH 0x0F
554#define DA9055_RTC_TICK_WAKE_MASK 0x20
555#define DA9055_RTC_TICK_WAKE_SHIFT 5
556#define DA9055_RTC_TICK_TYPE 0x10
557#define DA9055_RTC_TICK_TYPE_SHIFT 0x4
558#define DA9055_RTC_TICK_SEC 0x0
559#define DA9055_RTC_TICK_MIN 0x1
560#define DA9055_ALARAM_TICK_WAKE 0x20
561
562/* DA9055_REG_ALARM_Y (addr=0x5D) */
563#define DA9055_RTC_TICK_EN 0x80
564#define DA9055_RTC_ALM_EN 0x40
565#define DA9055_RTC_TICK_ALM_MASK 0xC0
566#define DA9055_RTC_ALM_YEAR 0x3F
567
568/* DA9055_REG_TRIM_CLDR (addr=0x62) */
569#define DA9055_TRIM_32K_SHIFT 0
570#define DA9055_TRIM_32K_MASK 0x7F
571#define DA9055_TRIM_DECREMENT (1<<7)
572#define DA9055_TRIM_INCREMENT (0<<7)
573#define DA9055_TRIM_VAL_BASE 0x0
574#define DA9055_TRIM_PPM_BASE 0x0 /* min val in units of 0.1PPM */
575#define DA9055_TRIM_PPM_INC 19 /* min inc in units of 0.1PPM */
576#define DA9055_TRIM_STEPS 127
577
578/* DA9055_REG_CONFIG_A (addr=0x65) */
579#define DA9055_PM_I_V_VDDCORE (0<<0)
580#define DA9055_PM_I_V_VDD_IO (1<<0)
581#define DA9055_VDD_FAULT_TYPE_ACT_LOW (0<<1)
582#define DA9055_VDD_FAULT_TYPE_ACT_HIGH (1<<1)
583#define DA9055_PM_O_TYPE_PUSH_PULL (0<<2)
584#define DA9055_PM_O_TYPE_OPEN_DRAIN (1<<2)
585#define DA9055_IRQ_TYPE_ACT_LOW (0<<3)
586#define DA9055_IRQ_TYPE_ACT_HIGH (1<<3)
587#define DA9055_NIRQ_MODE_IMM (0<<4)
588#define DA9055_NIRQ_MODE_ACTIVE (1<<4)
589#define DA9055_GPI_V_VDDCORE (0<<5)
590#define DA9055_GPI_V_VDD_IO (1<<5)
591#define DA9055_PM_IF_V_VDDCORE (0<<6)
592#define DA9055_PM_IF_V_VDD_IO (1<<6)
593
594/* DA9055_REG_CONFIG_B (addr=0x66) */
595#define DA9055_VDD_FAULT_VAL_SHIFT 0
596#define DA9055_VDD_FAULT_VAL_MASK 0xF
597#define DA9055_VDD_FAULT_VAL_BASE 0x0
598#define DA9055_VDD_FAULT_VAL_MAX DA9055_VDD_FAULT_VAL_MASK
599#define DA9055_VDD_FAULT_VOLT_BASE 2500
600#define DA9055_VDD_FAULT_VOLT_INC 50
601#define DA9055_VDD_FAULT_STEPS 15
602
603#define DA9055_VDD_HYST_VAL_SHIFT 4
604#define DA9055_VDD_HYST_VAL_MASK 0x7
605#define DA9055_VDD_HYST_VAL_BASE 0x0
606#define DA9055_VDD_HYST_VAL_MAX DA9055_VDD_HYST_VAL_MASK
607#define DA9055_VDD_HYST_VOLT_BASE 100
608#define DA9055_VDD_HYST_VOLT_INC 50
609#define DA9055_VDD_HYST_STEPS 7
610#define DA9055_VDD_HYST_VOLT_MIN DA9055_VDD_HYST_VOLT_BASE
611
612#define DA9055_VDD_FAULT_EN_SHIFT 7
613
614/* DA9055_REG_CONFIG_C (addr=0x67) */
615#define DA9055_BCORE_CLK_INV_SHIFT 0
616#define DA9055_BMEM_CLK_INV_SHIFT 1
617#define DA9055_NFAULT_CONF_SHIFT 2
618#define DA9055_LDO_SD_SHIFT 4
619#define DA9055_LDO5_BYP_SHIFT 6
620#define DA9055_LDO6_BYP_SHIFT 7
621
622/* DA9055_REG_CONFIG_D (addr=0x68) */
623#define DA9055_NONKEY_PIN_SHIFT 0
624#define DA9055_NONKEY_PIN_MASK 0x3
625#define DA9055_NONKEY_PIN_PORT_MODE 0x0
626#define DA9055_NONKEY_PIN_KEY_MODE 0x1
627#define DA9055_NONKEY_PIN_MULTI_FUNC 0x2
628#define DA9055_NONKEY_PIN_DEDICT 0x3
629#define DA9055_NONKEY_SD_SHIFT 2
630#define DA9055_KEY_DELAY_SHIFT 3
631#define DA9055_KEY_DELAY_MASK 0x3
632#define DA9055_KEY_DELAY_4S 0x0
633#define DA9055_KEY_DELAY_6S 0x1
634#define DA9055_KEY_DELAY_8S 0x2
635#define DA9055_KEY_DELAY_10S 0x3
636
637/* DA9055_REG_CONFIG_E (addr=0x69) */
638#define DA9055_GPIO_PUPD_PULL_UP 0x0
639#define DA9055_GPIO_PUPD_OPEN_DRAIN 0x1
640#define DA9055_GPIO0_PUPD_SHIFT 0
641#define DA9055_GPIO1_PUPD_SHIFT 1
642#define DA9055_GPIO2_PUPD_SHIFT 2
643#define DA9055_UVOV_DELAY_SHIFT 4
644#define DA9055_UVOV_DELAY_MASK 0x3
645#define DA9055_RESET_DURATION_SHIFT 6
646#define DA9055_RESET_DURATION_MASK 0x3
647#define DA9055_RESET_DURATION_0MS 0x0
648#define DA9055_RESET_DURATION_100MS 0x1
649#define DA9055_RESET_DURATION_500MS 0x2
650#define DA9055_RESET_DURATION_1000MS 0x3
651
652/* DA9055_REG_MON_REG_1 (addr=0x6A) */
653#define DA9055_MON_THRES_SHIFT 0
654#define DA9055_MON_THRES_MASK 0x3
655#define DA9055_MON_RES_SHIFT 2
656#define DA9055_MON_DEB_SHIFT 3
657#define DA9055_MON_MODE_SHIFT 4
658#define DA9055_MON_MODE_MASK 0x3
659#define DA9055_START_MAX_SHIFT 6
660#define DA9055_START_MAX_MASK 0x3
661
662/* DA9055_REG_MON_REG_2 (addr=0x6B) */
663#define DA9055_LDO1_MON_EN_SHIFT 0
664#define DA9055_LDO2_MON_EN_SHIFT 1
665#define DA9055_LDO3_MON_EN_SHIFT 2
666#define DA9055_LDO4_MON_EN_SHIFT 3
667#define DA9055_LDO5_MON_EN_SHIFT 4
668#define DA9055_LDO6_MON_EN_SHIFT 5
669#define DA9055_BCORE_MON_EN_SHIFT 6
670#define DA9055_BMEM_MON_EN_SHIFT 7
671
672/* DA9055_REG_CONFIG_F (addr=0x6C) */
673#define DA9055_LDO1_DEF_SHIFT 0
674#define DA9055_LDO2_DEF_SHIFT 1
675#define DA9055_LDO3_DEF_SHIFT 2
676#define DA9055_LDO4_DEF_SHIFT 3
677#define DA9055_LDO5_DEF_SHIFT 4
678#define DA9055_LDO6_DEF_SHIFT 5
679#define DA9055_BCORE_DEF_SHIFT 6
680#define DA9055_BMEM_DEF_SHIFT 7
681
682/* DA9055_REG_MON_REG_4 (addr=0x6D) */
683#define DA9055_MON_A8_IDX_SHIFT 0
684#define DA9055_MON_A89_IDX_MASK 0x3
685#define DA9055_MON_A89_IDX_NONE 0x0
686#define DA9055_MON_A89_IDX_BUCKCORE 0x1
687#define DA9055_MON_A89_IDX_LDO3 0x2
688#define DA9055_MON_A9_IDX_SHIFT 5
689
690/* DA9055_REG_MON_REG_5 (addr=0x6E) */
691#define DA9055_MON_A10_IDX_SHIFT 0
692#define DA9055_MON_A10_IDX_MASK 0x3
693#define DA9055_MON_A10_IDX_NONE 0x0
694#define DA9055_MON_A10_IDX_LDO1 0x1
695#define DA9055_MON_A10_IDX_LDO2 0x2
696#define DA9055_MON_A10_IDX_LDO5 0x3
697#define DA9055_MON_A10_IDX_LDO6 0x4
698
699#endif /* __DA9055_REG_H */
diff --git a/include/linux/mfd/lp8788-isink.h b/include/linux/mfd/lp8788-isink.h
new file mode 100644
index 000000000000..f38262d21ff1
--- /dev/null
+++ b/include/linux/mfd/lp8788-isink.h
@@ -0,0 +1,52 @@
1/*
2 * TI LP8788 MFD - common definitions for current sinks
3 *
4 * Copyright 2012 Texas Instruments
5 *
6 * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13
14#ifndef __ISINK_LP8788_H__
15#define __ISINK_LP8788_H__
16
17/* register address */
18#define LP8788_ISINK_CTRL 0x99
19#define LP8788_ISINK12_IOUT 0x9A
20#define LP8788_ISINK3_IOUT 0x9B
21#define LP8788_ISINK1_PWM 0x9C
22#define LP8788_ISINK2_PWM 0x9D
23#define LP8788_ISINK3_PWM 0x9E
24
25/* mask bits */
26#define LP8788_ISINK1_IOUT_M 0x0F /* Addr 9Ah */
27#define LP8788_ISINK2_IOUT_M 0xF0
28#define LP8788_ISINK3_IOUT_M 0x0F /* Addr 9Bh */
29
30/* 6 bits used for PWM code : Addr 9C ~ 9Eh */
31#define LP8788_ISINK_MAX_PWM 63
32#define LP8788_ISINK_SCALE_OFFSET 3
33
34static const u8 lp8788_iout_addr[] = {
35 LP8788_ISINK12_IOUT,
36 LP8788_ISINK12_IOUT,
37 LP8788_ISINK3_IOUT,
38};
39
40static const u8 lp8788_iout_mask[] = {
41 LP8788_ISINK1_IOUT_M,
42 LP8788_ISINK2_IOUT_M,
43 LP8788_ISINK3_IOUT_M,
44};
45
46static const u8 lp8788_pwm_addr[] = {
47 LP8788_ISINK1_PWM,
48 LP8788_ISINK2_PWM,
49 LP8788_ISINK3_PWM,
50};
51
52#endif
diff --git a/include/linux/mfd/lp8788.h b/include/linux/mfd/lp8788.h
new file mode 100644
index 000000000000..cec364bdccfa
--- /dev/null
+++ b/include/linux/mfd/lp8788.h
@@ -0,0 +1,364 @@
1/*
2 * TI LP8788 MFD Device
3 *
4 * Copyright 2012 Texas Instruments
5 *
6 * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13
14#ifndef __MFD_LP8788_H__
15#define __MFD_LP8788_H__
16
17#include <linux/gpio.h>
18#include <linux/irqdomain.h>
19#include <linux/regmap.h>
20
21#define LP8788_DEV_BUCK "lp8788-buck"
22#define LP8788_DEV_DLDO "lp8788-dldo"
23#define LP8788_DEV_ALDO "lp8788-aldo"
24#define LP8788_DEV_CHARGER "lp8788-charger"
25#define LP8788_DEV_RTC "lp8788-rtc"
26#define LP8788_DEV_BACKLIGHT "lp8788-backlight"
27#define LP8788_DEV_VIBRATOR "lp8788-vibrator"
28#define LP8788_DEV_KEYLED "lp8788-keyled"
29#define LP8788_DEV_ADC "lp8788-adc"
30
31#define LP8788_NUM_BUCKS 4
32#define LP8788_NUM_DLDOS 12
33#define LP8788_NUM_ALDOS 10
34#define LP8788_NUM_BUCK2_DVS 2
35
36#define LP8788_CHG_IRQ "CHG_IRQ"
37#define LP8788_PRSW_IRQ "PRSW_IRQ"
38#define LP8788_BATT_IRQ "BATT_IRQ"
39#define LP8788_ALM_IRQ "ALARM_IRQ"
40
41enum lp8788_int_id {
42 /* interrup register 1 : Addr 00h */
43 LP8788_INT_TSDL,
44 LP8788_INT_TSDH,
45 LP8788_INT_UVLO,
46 LP8788_INT_FLAGMON,
47 LP8788_INT_PWRON_TIME,
48 LP8788_INT_PWRON,
49 LP8788_INT_COMP1,
50 LP8788_INT_COMP2,
51
52 /* interrupt register 2 : Addr 01h */
53 LP8788_INT_CHG_INPUT_STATE,
54 LP8788_INT_CHG_STATE,
55 LP8788_INT_EOC,
56 LP8788_INT_CHG_RESTART,
57 LP8788_INT_RESTART_TIMEOUT,
58 LP8788_INT_FULLCHG_TIMEOUT,
59 LP8788_INT_PRECHG_TIMEOUT,
60
61 /* interrupt register 3 : Addr 02h */
62 LP8788_INT_RTC_ALARM1 = 17,
63 LP8788_INT_RTC_ALARM2,
64 LP8788_INT_ENTER_SYS_SUPPORT,
65 LP8788_INT_EXIT_SYS_SUPPORT,
66 LP8788_INT_BATT_LOW,
67 LP8788_INT_NO_BATT,
68
69 LP8788_INT_MAX = 24,
70};
71
72enum lp8788_dvs_sel {
73 DVS_SEL_V0,
74 DVS_SEL_V1,
75 DVS_SEL_V2,
76 DVS_SEL_V3,
77};
78
79enum lp8788_ext_ldo_en_id {
80 EN_ALDO1,
81 EN_ALDO234,
82 EN_ALDO5,
83 EN_ALDO7,
84 EN_DLDO7,
85 EN_DLDO911,
86 EN_LDOS_MAX,
87};
88
89enum lp8788_charger_event {
90 NO_CHARGER,
91 CHARGER_DETECTED,
92};
93
94enum lp8788_bl_ctrl_mode {
95 LP8788_BL_REGISTER_ONLY,
96 LP8788_BL_COMB_PWM_BASED, /* PWM + I2C, changed by PWM input */
97 LP8788_BL_COMB_REGISTER_BASED, /* PWM + I2C, changed by I2C */
98};
99
100enum lp8788_bl_dim_mode {
101 LP8788_DIM_EXPONENTIAL,
102 LP8788_DIM_LINEAR,
103};
104
105enum lp8788_bl_full_scale_current {
106 LP8788_FULLSCALE_5000uA,
107 LP8788_FULLSCALE_8500uA,
108 LP8788_FULLSCALE_1200uA,
109 LP8788_FULLSCALE_1550uA,
110 LP8788_FULLSCALE_1900uA,
111 LP8788_FULLSCALE_2250uA,
112 LP8788_FULLSCALE_2600uA,
113 LP8788_FULLSCALE_2950uA,
114};
115
116enum lp8788_bl_ramp_step {
117 LP8788_RAMP_8us,
118 LP8788_RAMP_1024us,
119 LP8788_RAMP_2048us,
120 LP8788_RAMP_4096us,
121 LP8788_RAMP_8192us,
122 LP8788_RAMP_16384us,
123 LP8788_RAMP_32768us,
124 LP8788_RAMP_65538us,
125};
126
127enum lp8788_bl_pwm_polarity {
128 LP8788_PWM_ACTIVE_HIGH,
129 LP8788_PWM_ACTIVE_LOW,
130};
131
132enum lp8788_isink_scale {
133 LP8788_ISINK_SCALE_100mA,
134 LP8788_ISINK_SCALE_120mA,
135};
136
137enum lp8788_isink_number {
138 LP8788_ISINK_1,
139 LP8788_ISINK_2,
140 LP8788_ISINK_3,
141};
142
143enum lp8788_alarm_sel {
144 LP8788_ALARM_1,
145 LP8788_ALARM_2,
146 LP8788_ALARM_MAX,
147};
148
149enum lp8788_adc_id {
150 LPADC_VBATT_5P5,
151 LPADC_VIN_CHG,
152 LPADC_IBATT,
153 LPADC_IC_TEMP,
154 LPADC_VBATT_6P0,
155 LPADC_VBATT_5P0,
156 LPADC_ADC1,
157 LPADC_ADC2,
158 LPADC_VDD,
159 LPADC_VCOIN,
160 LPADC_VDD_LDO,
161 LPADC_ADC3,
162 LPADC_ADC4,
163 LPADC_MAX,
164};
165
166struct lp8788;
167
168/*
169 * lp8788_buck1_dvs
170 * @gpio : gpio pin number for dvs control
171 * @vsel : dvs selector for buck v1 register
172 */
173struct lp8788_buck1_dvs {
174 int gpio;
175 enum lp8788_dvs_sel vsel;
176};
177
178/*
179 * lp8788_buck2_dvs
180 * @gpio : two gpio pin numbers are used for dvs
181 * @vsel : dvs selector for buck v2 register
182 */
183struct lp8788_buck2_dvs {
184 int gpio[LP8788_NUM_BUCK2_DVS];
185 enum lp8788_dvs_sel vsel;
186};
187
188/*
189 * struct lp8788_ldo_enable_pin
190 *
191 * Basically, all LDOs are enabled through the I2C commands.
192 * But ALDO 1 ~ 5, 7, DLDO 7, 9, 11 can be enabled by external gpio pins.
193 *
194 * @gpio : gpio number which is used for enabling ldos
195 * @init_state : initial gpio state (ex. GPIOF_OUT_INIT_LOW)
196 */
197struct lp8788_ldo_enable_pin {
198 int gpio;
199 int init_state;
200};
201
202/*
203 * struct lp8788_chg_param
204 * @addr : charging control register address (range : 0x11 ~ 0x1C)
205 * @val : charging parameter value
206 */
207struct lp8788_chg_param {
208 u8 addr;
209 u8 val;
210};
211
212/*
213 * struct lp8788_charger_platform_data
214 * @vbatt_adc : adc selection id for battery voltage
215 * @batt_temp_adc : adc selection id for battery temperature
216 * @max_vbatt_mv : used for calculating battery capacity
217 * @chg_params : initial charging parameters
218 * @num_chg_params : numbers of charging parameters
219 * @charger_event : the charger event can be reported to the platform side
220 */
221struct lp8788_charger_platform_data {
222 enum lp8788_adc_id vbatt_adc;
223 enum lp8788_adc_id batt_temp_adc;
224 unsigned int max_vbatt_mv;
225 struct lp8788_chg_param *chg_params;
226 int num_chg_params;
227 void (*charger_event) (struct lp8788 *lp,
228 enum lp8788_charger_event event);
229};
230
231/*
232 * struct lp8788_bl_pwm_data
233 * @pwm_set_intensity : set duty of pwm
234 * @pwm_get_intensity : get current duty of pwm
235 */
236struct lp8788_bl_pwm_data {
237 void (*pwm_set_intensity) (int brightness, int max_brightness);
238 int (*pwm_get_intensity) (int max_brightness);
239};
240
241/*
242 * struct lp8788_backlight_platform_data
243 * @name : backlight driver name. (default: "lcd-backlight")
244 * @initial_brightness : initial value of backlight brightness
245 * @bl_mode : brightness control by pwm or lp8788 register
246 * @dim_mode : dimming mode selection
247 * @full_scale : full scale current setting
248 * @rise_time : brightness ramp up step time
249 * @fall_time : brightness ramp down step time
250 * @pwm_pol : pwm polarity setting when bl_mode is pwm based
251 * @pwm_data : platform specific pwm generation functions
252 * only valid when bl_mode is pwm based
253 */
254struct lp8788_backlight_platform_data {
255 char *name;
256 int initial_brightness;
257 enum lp8788_bl_ctrl_mode bl_mode;
258 enum lp8788_bl_dim_mode dim_mode;
259 enum lp8788_bl_full_scale_current full_scale;
260 enum lp8788_bl_ramp_step rise_time;
261 enum lp8788_bl_ramp_step fall_time;
262 enum lp8788_bl_pwm_polarity pwm_pol;
263 struct lp8788_bl_pwm_data pwm_data;
264};
265
266/*
267 * struct lp8788_led_platform_data
268 * @name : led driver name. (default: "keyboard-backlight")
269 * @scale : current scale
270 * @num : current sink number
271 * @iout_code : current output value (Addr 9Ah ~ 9Bh)
272 */
273struct lp8788_led_platform_data {
274 char *name;
275 enum lp8788_isink_scale scale;
276 enum lp8788_isink_number num;
277 int iout_code;
278};
279
280/*
281 * struct lp8788_vib_platform_data
282 * @name : vibrator driver name
283 * @scale : current scale
284 * @num : current sink number
285 * @iout_code : current output value (Addr 9Ah ~ 9Bh)
286 * @pwm_code : PWM code value (Addr 9Ch ~ 9Eh)
287 */
288struct lp8788_vib_platform_data {
289 char *name;
290 enum lp8788_isink_scale scale;
291 enum lp8788_isink_number num;
292 int iout_code;
293 int pwm_code;
294};
295
296/*
297 * struct lp8788_platform_data
298 * @init_func : used for initializing registers
299 * before mfd driver is registered
300 * @buck_data : regulator initial data for buck
301 * @dldo_data : regulator initial data for digital ldo
302 * @aldo_data : regulator initial data for analog ldo
303 * @buck1_dvs : gpio configurations for buck1 dvs
304 * @buck2_dvs : gpio configurations for buck2 dvs
305 * @ldo_pin : gpio configurations for enabling LDOs
306 * @chg_pdata : platform data for charger driver
307 * @alarm_sel : rtc alarm selection (1 or 2)
308 * @bl_pdata : configurable data for backlight driver
309 * @led_pdata : configurable data for led driver
310 * @vib_pdata : configurable data for vibrator driver
311 * @adc_pdata : iio map data for adc driver
312 */
313struct lp8788_platform_data {
314 /* general system information */
315 int (*init_func) (struct lp8788 *lp);
316
317 /* regulators */
318 struct regulator_init_data *buck_data[LP8788_NUM_BUCKS];
319 struct regulator_init_data *dldo_data[LP8788_NUM_DLDOS];
320 struct regulator_init_data *aldo_data[LP8788_NUM_ALDOS];
321 struct lp8788_buck1_dvs *buck1_dvs;
322 struct lp8788_buck2_dvs *buck2_dvs;
323 struct lp8788_ldo_enable_pin *ldo_pin[EN_LDOS_MAX];
324
325 /* charger */
326 struct lp8788_charger_platform_data *chg_pdata;
327
328 /* rtc alarm */
329 enum lp8788_alarm_sel alarm_sel;
330
331 /* backlight */
332 struct lp8788_backlight_platform_data *bl_pdata;
333
334 /* current sinks */
335 struct lp8788_led_platform_data *led_pdata;
336 struct lp8788_vib_platform_data *vib_pdata;
337
338 /* adc iio map data */
339 struct iio_map *adc_pdata;
340};
341
342/*
343 * struct lp8788
344 * @dev : parent device pointer
345 * @regmap : used for i2c communcation on accessing registers
346 * @irqdm : interrupt domain for handling nested interrupt
347 * @irq : pin number of IRQ_N
348 * @pdata : lp8788 platform specific data
349 */
350struct lp8788 {
351 struct device *dev;
352 struct regmap *regmap;
353 struct irq_domain *irqdm;
354 int irq;
355 struct lp8788_platform_data *pdata;
356};
357
358int lp8788_irq_init(struct lp8788 *lp, int chip_irq);
359void lp8788_irq_exit(struct lp8788 *lp);
360int lp8788_read_byte(struct lp8788 *lp, u8 reg, u8 *data);
361int lp8788_read_multi_bytes(struct lp8788 *lp, u8 reg, u8 *data, size_t count);
362int lp8788_write_byte(struct lp8788 *lp, u8 reg, u8 data);
363int lp8788_update_bits(struct lp8788 *lp, u8 reg, u8 mask, u8 data);
364#endif
diff --git a/include/linux/mfd/lpc_ich.h b/include/linux/mfd/lpc_ich.h
index fec5256c3f5d..3e1df644c407 100644
--- a/include/linux/mfd/lpc_ich.h
+++ b/include/linux/mfd/lpc_ich.h
@@ -43,6 +43,7 @@ struct lpc_ich_info {
43 char name[32]; 43 char name[32];
44 unsigned int iTCO_version; 44 unsigned int iTCO_version;
45 unsigned int gpio_version; 45 unsigned int gpio_version;
46 u8 use_gpio;
46}; 47};
47 48
48#endif 49#endif
diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h
index 1d28ae90384e..fe03b2d35d4f 100644
--- a/include/linux/mfd/max77693.h
+++ b/include/linux/mfd/max77693.h
@@ -30,7 +30,20 @@
30#ifndef __LINUX_MFD_MAX77693_H 30#ifndef __LINUX_MFD_MAX77693_H
31#define __LINUX_MFD_MAX77693_H 31#define __LINUX_MFD_MAX77693_H
32 32
33struct max77693_reg_data {
34 u8 addr;
35 u8 data;
36};
37
38struct max77693_muic_platform_data {
39 struct max77693_reg_data *init_data;
40 int num_init_data;
41};
42
33struct max77693_platform_data { 43struct max77693_platform_data {
34 int wakeup; 44 int wakeup;
45
46 /* muic data */
47 struct max77693_muic_platform_data *muic_data;
35}; 48};
36#endif /* __LINUX_MFD_MAX77693_H */ 49#endif /* __LINUX_MFD_MAX77693_H */
diff --git a/include/linux/mfd/max8907.h b/include/linux/mfd/max8907.h
new file mode 100644
index 000000000000..b06f7a6a1e80
--- /dev/null
+++ b/include/linux/mfd/max8907.h
@@ -0,0 +1,252 @@
1/*
2 * Functions to access MAX8907 power management chip.
3 *
4 * Copyright (C) 2010 Gyungoh Yoo <jack.yoo@maxim-ic.com>
5 * Copyright (C) 2012, NVIDIA CORPORATION. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __LINUX_MFD_MAX8907_H
13#define __LINUX_MFD_MAX8907_H
14
15#include <linux/mutex.h>
16#include <linux/pm.h>
17
18#define MAX8907_GEN_I2C_ADDR (0x78 >> 1)
19#define MAX8907_ADC_I2C_ADDR (0x8e >> 1)
20#define MAX8907_RTC_I2C_ADDR (0xd0 >> 1)
21
22/* MAX8907 register map */
23#define MAX8907_REG_SYSENSEL 0x00
24#define MAX8907_REG_ON_OFF_IRQ1 0x01
25#define MAX8907_REG_ON_OFF_IRQ1_MASK 0x02
26#define MAX8907_REG_ON_OFF_STAT 0x03
27#define MAX8907_REG_SDCTL1 0x04
28#define MAX8907_REG_SDSEQCNT1 0x05
29#define MAX8907_REG_SDV1 0x06
30#define MAX8907_REG_SDCTL2 0x07
31#define MAX8907_REG_SDSEQCNT2 0x08
32#define MAX8907_REG_SDV2 0x09
33#define MAX8907_REG_SDCTL3 0x0A
34#define MAX8907_REG_SDSEQCNT3 0x0B
35#define MAX8907_REG_SDV3 0x0C
36#define MAX8907_REG_ON_OFF_IRQ2 0x0D
37#define MAX8907_REG_ON_OFF_IRQ2_MASK 0x0E
38#define MAX8907_REG_RESET_CNFG 0x0F
39#define MAX8907_REG_LDOCTL16 0x10
40#define MAX8907_REG_LDOSEQCNT16 0x11
41#define MAX8907_REG_LDO16VOUT 0x12
42#define MAX8907_REG_SDBYSEQCNT 0x13
43#define MAX8907_REG_LDOCTL17 0x14
44#define MAX8907_REG_LDOSEQCNT17 0x15
45#define MAX8907_REG_LDO17VOUT 0x16
46#define MAX8907_REG_LDOCTL1 0x18
47#define MAX8907_REG_LDOSEQCNT1 0x19
48#define MAX8907_REG_LDO1VOUT 0x1A
49#define MAX8907_REG_LDOCTL2 0x1C
50#define MAX8907_REG_LDOSEQCNT2 0x1D
51#define MAX8907_REG_LDO2VOUT 0x1E
52#define MAX8907_REG_LDOCTL3 0x20
53#define MAX8907_REG_LDOSEQCNT3 0x21
54#define MAX8907_REG_LDO3VOUT 0x22
55#define MAX8907_REG_LDOCTL4 0x24
56#define MAX8907_REG_LDOSEQCNT4 0x25
57#define MAX8907_REG_LDO4VOUT 0x26
58#define MAX8907_REG_LDOCTL5 0x28
59#define MAX8907_REG_LDOSEQCNT5 0x29
60#define MAX8907_REG_LDO5VOUT 0x2A
61#define MAX8907_REG_LDOCTL6 0x2C
62#define MAX8907_REG_LDOSEQCNT6 0x2D
63#define MAX8907_REG_LDO6VOUT 0x2E
64#define MAX8907_REG_LDOCTL7 0x30
65#define MAX8907_REG_LDOSEQCNT7 0x31
66#define MAX8907_REG_LDO7VOUT 0x32
67#define MAX8907_REG_LDOCTL8 0x34
68#define MAX8907_REG_LDOSEQCNT8 0x35
69#define MAX8907_REG_LDO8VOUT 0x36
70#define MAX8907_REG_LDOCTL9 0x38
71#define MAX8907_REG_LDOSEQCNT9 0x39
72#define MAX8907_REG_LDO9VOUT 0x3A
73#define MAX8907_REG_LDOCTL10 0x3C
74#define MAX8907_REG_LDOSEQCNT10 0x3D
75#define MAX8907_REG_LDO10VOUT 0x3E
76#define MAX8907_REG_LDOCTL11 0x40
77#define MAX8907_REG_LDOSEQCNT11 0x41
78#define MAX8907_REG_LDO11VOUT 0x42
79#define MAX8907_REG_LDOCTL12 0x44
80#define MAX8907_REG_LDOSEQCNT12 0x45
81#define MAX8907_REG_LDO12VOUT 0x46
82#define MAX8907_REG_LDOCTL13 0x48
83#define MAX8907_REG_LDOSEQCNT13 0x49
84#define MAX8907_REG_LDO13VOUT 0x4A
85#define MAX8907_REG_LDOCTL14 0x4C
86#define MAX8907_REG_LDOSEQCNT14 0x4D
87#define MAX8907_REG_LDO14VOUT 0x4E
88#define MAX8907_REG_LDOCTL15 0x50
89#define MAX8907_REG_LDOSEQCNT15 0x51
90#define MAX8907_REG_LDO15VOUT 0x52
91#define MAX8907_REG_OUT5VEN 0x54
92#define MAX8907_REG_OUT5VSEQ 0x55
93#define MAX8907_REG_OUT33VEN 0x58
94#define MAX8907_REG_OUT33VSEQ 0x59
95#define MAX8907_REG_LDOCTL19 0x5C
96#define MAX8907_REG_LDOSEQCNT19 0x5D
97#define MAX8907_REG_LDO19VOUT 0x5E
98#define MAX8907_REG_LBCNFG 0x60
99#define MAX8907_REG_SEQ1CNFG 0x64
100#define MAX8907_REG_SEQ2CNFG 0x65
101#define MAX8907_REG_SEQ3CNFG 0x66
102#define MAX8907_REG_SEQ4CNFG 0x67
103#define MAX8907_REG_SEQ5CNFG 0x68
104#define MAX8907_REG_SEQ6CNFG 0x69
105#define MAX8907_REG_SEQ7CNFG 0x6A
106#define MAX8907_REG_LDOCTL18 0x72
107#define MAX8907_REG_LDOSEQCNT18 0x73
108#define MAX8907_REG_LDO18VOUT 0x74
109#define MAX8907_REG_BBAT_CNFG 0x78
110#define MAX8907_REG_CHG_CNTL1 0x7C
111#define MAX8907_REG_CHG_CNTL2 0x7D
112#define MAX8907_REG_CHG_IRQ1 0x7E
113#define MAX8907_REG_CHG_IRQ2 0x7F
114#define MAX8907_REG_CHG_IRQ1_MASK 0x80
115#define MAX8907_REG_CHG_IRQ2_MASK 0x81
116#define MAX8907_REG_CHG_STAT 0x82
117#define MAX8907_REG_WLED_MODE_CNTL 0x84
118#define MAX8907_REG_ILED_CNTL 0x84
119#define MAX8907_REG_II1RR 0x8E
120#define MAX8907_REG_II2RR 0x8F
121#define MAX8907_REG_LDOCTL20 0x9C
122#define MAX8907_REG_LDOSEQCNT20 0x9D
123#define MAX8907_REG_LDO20VOUT 0x9E
124
125/* RTC register map */
126#define MAX8907_REG_RTC_SEC 0x00
127#define MAX8907_REG_RTC_MIN 0x01
128#define MAX8907_REG_RTC_HOURS 0x02
129#define MAX8907_REG_RTC_WEEKDAY 0x03
130#define MAX8907_REG_RTC_DATE 0x04
131#define MAX8907_REG_RTC_MONTH 0x05
132#define MAX8907_REG_RTC_YEAR1 0x06
133#define MAX8907_REG_RTC_YEAR2 0x07
134#define MAX8907_REG_ALARM0_SEC 0x08
135#define MAX8907_REG_ALARM0_MIN 0x09
136#define MAX8907_REG_ALARM0_HOURS 0x0A
137#define MAX8907_REG_ALARM0_WEEKDAY 0x0B
138#define MAX8907_REG_ALARM0_DATE 0x0C
139#define MAX8907_REG_ALARM0_MONTH 0x0D
140#define MAX8907_REG_ALARM0_YEAR1 0x0E
141#define MAX8907_REG_ALARM0_YEAR2 0x0F
142#define MAX8907_REG_ALARM1_SEC 0x10
143#define MAX8907_REG_ALARM1_MIN 0x11
144#define MAX8907_REG_ALARM1_HOURS 0x12
145#define MAX8907_REG_ALARM1_WEEKDAY 0x13
146#define MAX8907_REG_ALARM1_DATE 0x14
147#define MAX8907_REG_ALARM1_MONTH 0x15
148#define MAX8907_REG_ALARM1_YEAR1 0x16
149#define MAX8907_REG_ALARM1_YEAR2 0x17
150#define MAX8907_REG_ALARM0_CNTL 0x18
151#define MAX8907_REG_ALARM1_CNTL 0x19
152#define MAX8907_REG_RTC_STATUS 0x1A
153#define MAX8907_REG_RTC_CNTL 0x1B
154#define MAX8907_REG_RTC_IRQ 0x1C
155#define MAX8907_REG_RTC_IRQ_MASK 0x1D
156#define MAX8907_REG_MPL_CNTL 0x1E
157
158/* ADC and Touch Screen Controller register map */
159#define MAX8907_CTL 0
160#define MAX8907_SEQCNT 1
161#define MAX8907_VOUT 2
162
163/* mask bit fields */
164#define MAX8907_MASK_LDO_SEQ 0x1C
165#define MAX8907_MASK_LDO_EN 0x01
166#define MAX8907_MASK_VBBATTCV 0x03
167#define MAX8907_MASK_OUT5V_VINEN 0x10
168#define MAX8907_MASK_OUT5V_ENSRC 0x0E
169#define MAX8907_MASK_OUT5V_EN 0x01
170#define MAX8907_MASK_POWER_OFF 0x40
171
172/* Regulator IDs */
173#define MAX8907_MBATT 0
174#define MAX8907_SD1 1
175#define MAX8907_SD2 2
176#define MAX8907_SD3 3
177#define MAX8907_LDO1 4
178#define MAX8907_LDO2 5
179#define MAX8907_LDO3 6
180#define MAX8907_LDO4 7
181#define MAX8907_LDO5 8
182#define MAX8907_LDO6 9
183#define MAX8907_LDO7 10
184#define MAX8907_LDO8 11
185#define MAX8907_LDO9 12
186#define MAX8907_LDO10 13
187#define MAX8907_LDO11 14
188#define MAX8907_LDO12 15
189#define MAX8907_LDO13 16
190#define MAX8907_LDO14 17
191#define MAX8907_LDO15 18
192#define MAX8907_LDO16 19
193#define MAX8907_LDO17 20
194#define MAX8907_LDO18 21
195#define MAX8907_LDO19 22
196#define MAX8907_LDO20 23
197#define MAX8907_OUT5V 24
198#define MAX8907_OUT33V 25
199#define MAX8907_BBAT 26
200#define MAX8907_SDBY 27
201#define MAX8907_VRTC 28
202#define MAX8907_NUM_REGULATORS (MAX8907_VRTC + 1)
203
204/* IRQ definitions */
205enum {
206 MAX8907_IRQ_VCHG_DC_OVP = 0,
207 MAX8907_IRQ_VCHG_DC_F,
208 MAX8907_IRQ_VCHG_DC_R,
209 MAX8907_IRQ_VCHG_THM_OK_R,
210 MAX8907_IRQ_VCHG_THM_OK_F,
211 MAX8907_IRQ_VCHG_MBATTLOW_F,
212 MAX8907_IRQ_VCHG_MBATTLOW_R,
213 MAX8907_IRQ_VCHG_RST,
214 MAX8907_IRQ_VCHG_DONE,
215 MAX8907_IRQ_VCHG_TOPOFF,
216 MAX8907_IRQ_VCHG_TMR_FAULT,
217
218 MAX8907_IRQ_GPM_RSTIN = 0,
219 MAX8907_IRQ_GPM_MPL,
220 MAX8907_IRQ_GPM_SW_3SEC,
221 MAX8907_IRQ_GPM_EXTON_F,
222 MAX8907_IRQ_GPM_EXTON_R,
223 MAX8907_IRQ_GPM_SW_1SEC,
224 MAX8907_IRQ_GPM_SW_F,
225 MAX8907_IRQ_GPM_SW_R,
226 MAX8907_IRQ_GPM_SYSCKEN_F,
227 MAX8907_IRQ_GPM_SYSCKEN_R,
228
229 MAX8907_IRQ_RTC_ALARM1 = 0,
230 MAX8907_IRQ_RTC_ALARM0,
231};
232
233struct max8907_platform_data {
234 struct regulator_init_data *init_data[MAX8907_NUM_REGULATORS];
235 bool pm_off;
236};
237
238struct regmap_irq_chips_data;
239
240struct max8907 {
241 struct device *dev;
242 struct mutex irq_lock;
243 struct i2c_client *i2c_gen;
244 struct i2c_client *i2c_rtc;
245 struct regmap *regmap_gen;
246 struct regmap *regmap_rtc;
247 struct regmap_irq_chip_data *irqc_chg;
248 struct regmap_irq_chip_data *irqc_on_off;
249 struct regmap_irq_chip_data *irqc_rtc;
250};
251
252#endif
diff --git a/include/linux/mfd/max8925.h b/include/linux/mfd/max8925.h
index 15b2392a56fb..74d8e2969630 100644
--- a/include/linux/mfd/max8925.h
+++ b/include/linux/mfd/max8925.h
@@ -158,8 +158,6 @@ enum {
158#define TSC_IRQ_MASK (0x03) 158#define TSC_IRQ_MASK (0x03)
159#define RTC_IRQ_MASK (0x0c) 159#define RTC_IRQ_MASK (0x0c)
160 160
161#define MAX8925_MAX_REGULATOR (23)
162
163#define MAX8925_NAME_SIZE (32) 161#define MAX8925_NAME_SIZE (32)
164 162
165/* IRQ definitions */ 163/* IRQ definitions */
@@ -236,7 +234,29 @@ struct max8925_platform_data {
236 struct max8925_backlight_pdata *backlight; 234 struct max8925_backlight_pdata *backlight;
237 struct max8925_touch_pdata *touch; 235 struct max8925_touch_pdata *touch;
238 struct max8925_power_pdata *power; 236 struct max8925_power_pdata *power;
239 struct regulator_init_data *regulator[MAX8925_MAX_REGULATOR]; 237 struct regulator_init_data *sd1;
238 struct regulator_init_data *sd2;
239 struct regulator_init_data *sd3;
240 struct regulator_init_data *ldo1;
241 struct regulator_init_data *ldo2;
242 struct regulator_init_data *ldo3;
243 struct regulator_init_data *ldo4;
244 struct regulator_init_data *ldo5;
245 struct regulator_init_data *ldo6;
246 struct regulator_init_data *ldo7;
247 struct regulator_init_data *ldo8;
248 struct regulator_init_data *ldo9;
249 struct regulator_init_data *ldo10;
250 struct regulator_init_data *ldo11;
251 struct regulator_init_data *ldo12;
252 struct regulator_init_data *ldo13;
253 struct regulator_init_data *ldo14;
254 struct regulator_init_data *ldo15;
255 struct regulator_init_data *ldo16;
256 struct regulator_init_data *ldo17;
257 struct regulator_init_data *ldo18;
258 struct regulator_init_data *ldo19;
259 struct regulator_init_data *ldo20;
240 260
241 int irq_base; 261 int irq_base;
242 int tsc_irq; 262 int tsc_irq;
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h
index 9cbc642d40ad..29f6616e12f0 100644
--- a/include/linux/mfd/palmas.h
+++ b/include/linux/mfd/palmas.h
@@ -23,6 +23,9 @@
23#define PALMAS_NUM_CLIENTS 3 23#define PALMAS_NUM_CLIENTS 3
24 24
25struct palmas_pmic; 25struct palmas_pmic;
26struct palmas_gpadc;
27struct palmas_resource;
28struct palmas_usb;
26 29
27struct palmas { 30struct palmas {
28 struct device *dev; 31 struct device *dev;
@@ -41,6 +44,9 @@ struct palmas {
41 44
42 /* Child Devices */ 45 /* Child Devices */
43 struct palmas_pmic *pmic; 46 struct palmas_pmic *pmic;
47 struct palmas_gpadc *gpadc;
48 struct palmas_resource *resource;
49 struct palmas_usb *usb;
44 50
45 /* GPIO MUXing */ 51 /* GPIO MUXing */
46 u8 gpio_muxed; 52 u8 gpio_muxed;
@@ -48,6 +54,23 @@ struct palmas {
48 u8 pwm_muxed; 54 u8 pwm_muxed;
49}; 55};
50 56
57struct palmas_gpadc_platform_data {
58 /* Channel 3 current source is only enabled during conversion */
59 int ch3_current;
60
61 /* Channel 0 current source can be used for battery detection.
62 * If used for battery detection this will cause a permanent current
63 * consumption depending on current level set here.
64 */
65 int ch0_current;
66
67 /* default BAT_REMOVAL_DAT setting on device probe */
68 int bat_removal;
69
70 /* Sets the START_POLARITY bit in the RT_CTRL register */
71 int start_polarity;
72};
73
51struct palmas_reg_init { 74struct palmas_reg_init {
52 /* warm_rest controls the voltage levels after a warm reset 75 /* warm_rest controls the voltage levels after a warm reset
53 * 76 *
@@ -107,21 +130,94 @@ struct palmas_reg_init {
107 130
108}; 131};
109 132
133enum palmas_regulators {
134 /* SMPS regulators */
135 PALMAS_REG_SMPS12,
136 PALMAS_REG_SMPS123,
137 PALMAS_REG_SMPS3,
138 PALMAS_REG_SMPS45,
139 PALMAS_REG_SMPS457,
140 PALMAS_REG_SMPS6,
141 PALMAS_REG_SMPS7,
142 PALMAS_REG_SMPS8,
143 PALMAS_REG_SMPS9,
144 PALMAS_REG_SMPS10,
145 /* LDO regulators */
146 PALMAS_REG_LDO1,
147 PALMAS_REG_LDO2,
148 PALMAS_REG_LDO3,
149 PALMAS_REG_LDO4,
150 PALMAS_REG_LDO5,
151 PALMAS_REG_LDO6,
152 PALMAS_REG_LDO7,
153 PALMAS_REG_LDO8,
154 PALMAS_REG_LDO9,
155 PALMAS_REG_LDOLN,
156 PALMAS_REG_LDOUSB,
157 /* Total number of regulators */
158 PALMAS_NUM_REGS,
159};
160
110struct palmas_pmic_platform_data { 161struct palmas_pmic_platform_data {
111 /* An array of pointers to regulator init data indexed by regulator 162 /* An array of pointers to regulator init data indexed by regulator
112 * ID 163 * ID
113 */ 164 */
114 struct regulator_init_data **reg_data; 165 struct regulator_init_data *reg_data[PALMAS_NUM_REGS];
115 166
116 /* An array of pointers to structures containing sleep mode and DVS 167 /* An array of pointers to structures containing sleep mode and DVS
117 * configuration for regulators indexed by ID 168 * configuration for regulators indexed by ID
118 */ 169 */
119 struct palmas_reg_init **reg_init; 170 struct palmas_reg_init *reg_init[PALMAS_NUM_REGS];
120 171
121 /* use LDO6 for vibrator control */ 172 /* use LDO6 for vibrator control */
122 int ldo6_vibrator; 173 int ldo6_vibrator;
174};
123 175
176struct palmas_usb_platform_data {
177 /* Set this if platform wishes its own vbus control */
178 int no_control_vbus;
124 179
180 /* Do we enable the wakeup comparator on probe */
181 int wakeup;
182};
183
184struct palmas_resource_platform_data {
185 int regen1_mode_sleep;
186 int regen2_mode_sleep;
187 int sysen1_mode_sleep;
188 int sysen2_mode_sleep;
189
190 /* bitfield to be loaded to NSLEEP_RES_ASSIGN */
191 u8 nsleep_res;
192 /* bitfield to be loaded to NSLEEP_SMPS_ASSIGN */
193 u8 nsleep_smps;
194 /* bitfield to be loaded to NSLEEP_LDO_ASSIGN1 */
195 u8 nsleep_ldo1;
196 /* bitfield to be loaded to NSLEEP_LDO_ASSIGN2 */
197 u8 nsleep_ldo2;
198
199 /* bitfield to be loaded to ENABLE1_RES_ASSIGN */
200 u8 enable1_res;
201 /* bitfield to be loaded to ENABLE1_SMPS_ASSIGN */
202 u8 enable1_smps;
203 /* bitfield to be loaded to ENABLE1_LDO_ASSIGN1 */
204 u8 enable1_ldo1;
205 /* bitfield to be loaded to ENABLE1_LDO_ASSIGN2 */
206 u8 enable1_ldo2;
207
208 /* bitfield to be loaded to ENABLE2_RES_ASSIGN */
209 u8 enable2_res;
210 /* bitfield to be loaded to ENABLE2_SMPS_ASSIGN */
211 u8 enable2_smps;
212 /* bitfield to be loaded to ENABLE2_LDO_ASSIGN1 */
213 u8 enable2_ldo1;
214 /* bitfield to be loaded to ENABLE2_LDO_ASSIGN2 */
215 u8 enable2_ldo2;
216};
217
218struct palmas_clk_platform_data {
219 int clk32kg_mode_sleep;
220 int clk32kgaudio_mode_sleep;
125}; 221};
126 222
127struct palmas_platform_data { 223struct palmas_platform_data {
@@ -138,8 +234,49 @@ struct palmas_platform_data {
138 u8 pad1, pad2; 234 u8 pad1, pad2;
139 235
140 struct palmas_pmic_platform_data *pmic_pdata; 236 struct palmas_pmic_platform_data *pmic_pdata;
237 struct palmas_gpadc_platform_data *gpadc_pdata;
238 struct palmas_usb_platform_data *usb_pdata;
239 struct palmas_resource_platform_data *resource_pdata;
240 struct palmas_clk_platform_data *clk_pdata;
241};
242
243struct palmas_gpadc_calibration {
244 s32 gain;
245 s32 gain_error;
246 s32 offset_error;
141}; 247};
142 248
249struct palmas_gpadc {
250 struct device *dev;
251 struct palmas *palmas;
252
253 int ch3_current;
254 int ch0_current;
255
256 int gpadc_force;
257
258 int bat_removal;
259
260 struct mutex reading_lock;
261 struct completion irq_complete;
262
263 int eoc_sw_irq;
264
265 struct palmas_gpadc_calibration *palmas_cal_tbl;
266
267 int conv0_channel;
268 int conv1_channel;
269 int rt_channel;
270};
271
272struct palmas_gpadc_result {
273 s32 raw_code;
274 s32 corrected_code;
275 s32 result;
276};
277
278#define PALMAS_MAX_CHANNELS 16
279
143/* Define the palmas IRQ numbers */ 280/* Define the palmas IRQ numbers */
144enum palmas_irqs { 281enum palmas_irqs {
145 /* INT1 registers */ 282 /* INT1 registers */
@@ -182,34 +319,6 @@ enum palmas_irqs {
182 PALMAS_NUM_IRQ, 319 PALMAS_NUM_IRQ,
183}; 320};
184 321
185enum palmas_regulators {
186 /* SMPS regulators */
187 PALMAS_REG_SMPS12,
188 PALMAS_REG_SMPS123,
189 PALMAS_REG_SMPS3,
190 PALMAS_REG_SMPS45,
191 PALMAS_REG_SMPS457,
192 PALMAS_REG_SMPS6,
193 PALMAS_REG_SMPS7,
194 PALMAS_REG_SMPS8,
195 PALMAS_REG_SMPS9,
196 PALMAS_REG_SMPS10,
197 /* LDO regulators */
198 PALMAS_REG_LDO1,
199 PALMAS_REG_LDO2,
200 PALMAS_REG_LDO3,
201 PALMAS_REG_LDO4,
202 PALMAS_REG_LDO5,
203 PALMAS_REG_LDO6,
204 PALMAS_REG_LDO7,
205 PALMAS_REG_LDO8,
206 PALMAS_REG_LDO9,
207 PALMAS_REG_LDOLN,
208 PALMAS_REG_LDOUSB,
209 /* Total number of regulators */
210 PALMAS_NUM_REGS,
211};
212
213struct palmas_pmic { 322struct palmas_pmic {
214 struct palmas *palmas; 323 struct palmas *palmas;
215 struct device *dev; 324 struct device *dev;
@@ -223,6 +332,69 @@ struct palmas_pmic {
223 int range[PALMAS_REG_SMPS10]; 332 int range[PALMAS_REG_SMPS10];
224}; 333};
225 334
335struct palmas_resource {
336 struct palmas *palmas;
337 struct device *dev;
338};
339
340struct palmas_usb {
341 struct palmas *palmas;
342 struct device *dev;
343
344 /* for vbus reporting with irqs disabled */
345 spinlock_t lock;
346
347 struct regulator *vbus_reg;
348
349 /* used to set vbus, in atomic path */
350 struct work_struct set_vbus_work;
351
352 int irq1;
353 int irq2;
354 int irq3;
355 int irq4;
356
357 int vbus_enable;
358
359 u8 linkstat;
360};
361
362#define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator)
363
364enum usb_irq_events {
365 /* Wakeup events from INT3 */
366 PALMAS_USB_ID_WAKEPUP,
367 PALMAS_USB_VBUS_WAKEUP,
368
369 /* ID_OTG_EVENTS */
370 PALMAS_USB_ID_GND,
371 N_PALMAS_USB_ID_GND,
372 PALMAS_USB_ID_C,
373 N_PALMAS_USB_ID_C,
374 PALMAS_USB_ID_B,
375 N_PALMAS_USB_ID_B,
376 PALMAS_USB_ID_A,
377 N_PALMAS_USB_ID_A,
378 PALMAS_USB_ID_FLOAT,
379 N_PALMAS_USB_ID_FLOAT,
380
381 /* VBUS_OTG_EVENTS */
382 PALMAS_USB_VB_SESS_END,
383 N_PALMAS_USB_VB_SESS_END,
384 PALMAS_USB_VB_SESS_VLD,
385 N_PALMAS_USB_VB_SESS_VLD,
386 PALMAS_USB_VA_SESS_VLD,
387 N_PALMAS_USB_VA_SESS_VLD,
388 PALMAS_USB_VA_VBUS_VLD,
389 N_PALMAS_USB_VA_VBUS_VLD,
390 PALMAS_USB_VADP_SNS,
391 N_PALMAS_USB_VADP_SNS,
392 PALMAS_USB_VADP_PRB,
393 N_PALMAS_USB_VADP_PRB,
394 PALMAS_USB_VOTG_SESS_VLD,
395 N_PALMAS_USB_VOTG_SESS_VLD,
396};
397
226/* defines so we can store the mux settings */ 398/* defines so we can store the mux settings */
227#define PALMAS_GPIO_0_MUXED (1 << 0) 399#define PALMAS_GPIO_0_MUXED (1 << 0)
228#define PALMAS_GPIO_1_MUXED (1 << 1) 400#define PALMAS_GPIO_1_MUXED (1 << 1)
diff --git a/include/linux/mfd/rc5t583.h b/include/linux/mfd/rc5t583.h
index 3661c59aa1e9..36c242e52ef1 100644
--- a/include/linux/mfd/rc5t583.h
+++ b/include/linux/mfd/rc5t583.h
@@ -146,6 +146,28 @@
146#define RC5T583_GPIO_MON_IOIN 0xAB 146#define RC5T583_GPIO_MON_IOIN 0xAB
147#define RC5T583_GPIO_GPOFUNC 0xAC 147#define RC5T583_GPIO_GPOFUNC 0xAC
148 148
149/* RTC registers */
150#define RC5T583_RTC_SEC 0xE0
151#define RC5T583_RTC_MIN 0xE1
152#define RC5T583_RTC_HOUR 0xE2
153#define RC5T583_RTC_WDAY 0xE3
154#define RC5T583_RTC_DAY 0xE4
155#define RC5T583_RTC_MONTH 0xE5
156#define RC5T583_RTC_YEAR 0xE6
157#define RC5T583_RTC_ADJ 0xE7
158#define RC5T583_RTC_AW_MIN 0xE8
159#define RC5T583_RTC_AW_HOUR 0xE9
160#define RC5T583_RTC_AW_WEEK 0xEA
161#define RC5T583_RTC_AD_MIN 0xEB
162#define RC5T583_RTC_AD_HOUR 0xEC
163#define RC5T583_RTC_CTL1 0xED
164#define RC5T583_RTC_CTL2 0xEE
165#define RC5T583_RTC_AY_MIN 0xF0
166#define RC5T583_RTC_AY_HOUR 0xF1
167#define RC5T583_RTC_AY_DAY 0xF2
168#define RC5T583_RTC_AY_MONTH 0xF3
169#define RC5T583_RTC_AY_YEAR 0xF4
170
149/* RICOH_RC5T583 IRQ definitions */ 171/* RICOH_RC5T583 IRQ definitions */
150enum { 172enum {
151 RC5T583_IRQ_ONKEY, 173 RC5T583_IRQ_ONKEY,
diff --git a/include/linux/mfd/smsc.h b/include/linux/mfd/smsc.h
new file mode 100644
index 000000000000..9747b29f356f
--- /dev/null
+++ b/include/linux/mfd/smsc.h
@@ -0,0 +1,109 @@
1/*
2 * SMSC ECE1099
3 *
4 * Copyright 2012 Texas Instruments Inc.
5 *
6 * Author: Sourav Poddar <sourav.poddar@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __LINUX_MFD_SMSC_H
16#define __LINUX_MFD_SMSC_H
17
18#include <linux/regmap.h>
19
20#define SMSC_ID_ECE1099 1
21#define SMSC_NUM_CLIENTS 2
22
23#define SMSC_BASE_ADDR 0x38
24#define OMAP_GPIO_SMSC_IRQ 151
25
26#define SMSC_MAXGPIO 32
27#define SMSC_BANK(offs) ((offs) >> 3)
28#define SMSC_BIT(offs) (1u << ((offs) & 0x7))
29
30struct smsc {
31 struct device *dev;
32 struct i2c_client *i2c_clients[SMSC_NUM_CLIENTS];
33 struct regmap *regmap;
34 int clk;
35 /* Stored chip id */
36 int id;
37};
38
39struct smsc_gpio;
40struct smsc_keypad;
41
42static inline int smsc_read(struct device *child, unsigned int reg,
43 unsigned int *dest)
44{
45 struct smsc *smsc = dev_get_drvdata(child->parent);
46
47 return regmap_read(smsc->regmap, reg, dest);
48}
49
50static inline int smsc_write(struct device *child, unsigned int reg,
51 unsigned int value)
52{
53 struct smsc *smsc = dev_get_drvdata(child->parent);
54
55 return regmap_write(smsc->regmap, reg, value);
56}
57
58/* Registers for SMSC */
59#define SMSC_RESET 0xF5
60#define SMSC_GRP_INT 0xF9
61#define SMSC_CLK_CTRL 0xFA
62#define SMSC_WKUP_CTRL 0xFB
63#define SMSC_DEV_ID 0xFC
64#define SMSC_DEV_REV 0xFD
65#define SMSC_VEN_ID_L 0xFE
66#define SMSC_VEN_ID_H 0xFF
67
68/* CLK VALUE */
69#define SMSC_CLK_VALUE 0x13
70
71/* Registers for function GPIO INPUT */
72#define SMSC_GPIO_DATA_IN_START 0x00
73
74/* Registers for function GPIO OUPUT */
75#define SMSC_GPIO_DATA_OUT_START 0x05
76
77/* Definitions for SMSC GPIO CONFIGURATION REGISTER*/
78#define SMSC_GPIO_INPUT_LOW 0x01
79#define SMSC_GPIO_INPUT_RISING 0x09
80#define SMSC_GPIO_INPUT_FALLING 0x11
81#define SMSC_GPIO_INPUT_BOTH_EDGE 0x19
82#define SMSC_GPIO_OUTPUT_PP 0x21
83#define SMSC_GPIO_OUTPUT_OP 0x31
84
85#define GRP_INT_STAT 0xf9
86#define SMSC_GPI_INT 0x0f
87#define SMSC_CFG_START 0x0A
88
89/* Registers for SMSC GPIO INTERRUPT STATUS REGISTER*/
90#define SMSC_GPIO_INT_STAT_START 0x32
91
92/* Registers for SMSC GPIO INTERRUPT MASK REGISTER*/
93#define SMSC_GPIO_INT_MASK_START 0x37
94
95/* Registers for SMSC function KEYPAD*/
96#define SMSC_KP_OUT 0x40
97#define SMSC_KP_IN 0x41
98#define SMSC_KP_INT_STAT 0x42
99#define SMSC_KP_INT_MASK 0x43
100
101/* Definitions for keypad */
102#define SMSC_KP_KSO 0x70
103#define SMSC_KP_KSI 0x51
104#define SMSC_KSO_ALL_LOW 0x20
105#define SMSC_KP_SET_LOW_PWR 0x0B
106#define SMSC_KP_SET_HIGH 0xFF
107#define SMSC_KSO_EVAL 0x00
108
109#endif /* __LINUX_MFD_SMSC_H */
diff --git a/include/linux/mfd/syscon.h b/include/linux/mfd/syscon.h
new file mode 100644
index 000000000000..6aeb6b8da64d
--- /dev/null
+++ b/include/linux/mfd/syscon.h
@@ -0,0 +1,23 @@
1/*
2 * System Control Driver
3 *
4 * Copyright (C) 2012 Freescale Semiconductor, Inc.
5 * Copyright (C) 2012 Linaro Ltd.
6 *
7 * Author: Dong Aisheng <dong.aisheng@linaro.org>
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
15#ifndef __LINUX_MFD_SYSCON_H__
16#define __LINUX_MFD_SYSCON_H__
17
18extern struct regmap *syscon_node_to_regmap(struct device_node *np);
19extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s);
20extern struct regmap *syscon_regmap_lookup_by_phandle(
21 struct device_node *np,
22 const char *property);
23#endif /* __LINUX_MFD_SYSCON_H__ */
diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
new file mode 100644
index 000000000000..dab34a1deb2c
--- /dev/null
+++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
@@ -0,0 +1,319 @@
1/*
2 * Copyright (C) 2012 Freescale Semiconductor, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __LINUX_IMX6Q_IOMUXC_GPR_H
10#define __LINUX_IMX6Q_IOMUXC_GPR_H
11
12#include <linux/bitops.h>
13
14#define IOMUXC_GPR0 0x00
15#define IOMUXC_GPR1 0x04
16#define IOMUXC_GPR2 0x08
17#define IOMUXC_GPR3 0x0c
18#define IOMUXC_GPR4 0x10
19#define IOMUXC_GPR5 0x14
20#define IOMUXC_GPR6 0x18
21#define IOMUXC_GPR7 0x1c
22#define IOMUXC_GPR8 0x20
23#define IOMUXC_GPR9 0x24
24#define IOMUXC_GPR10 0x28
25#define IOMUXC_GPR11 0x2c
26#define IOMUXC_GPR12 0x30
27#define IOMUXC_GPR13 0x34
28
29#define IMX6Q_GPR0_CLOCK_8_MUX_SEL_MASK (0x3 << 30)
30#define IMX6Q_GPR0_CLOCK_8_MUX_SEL_AUDMUX_RXCLK_P7_MUXED (0x0 << 30)
31#define IMX6Q_GPR0_CLOCK_8_MUX_SEL_AUDMUX_RXCLK_P7 (0x1 << 30)
32#define IMX6Q_GPR0_CLOCK_8_MUX_SEL_SSI3_SSI_SRCK (0x2 << 30)
33#define IMX6Q_GPR0_CLOCK_8_MUX_SEL_SSI3_RX_BIT_CLK (0x3 << 30)
34#define IMX6Q_GPR0_CLOCK_0_MUX_SEL_MASK (0x3 << 28)
35#define IMX6Q_GPR0_CLOCK_0_MUX_SEL_ESAI1_IPP_IND_SCKR_MUXED (0x0 << 28)
36#define IMX6Q_GPR0_CLOCK_0_MUX_SEL_ESAI1_IPP_IND_SCKR (0x1 << 28)
37#define IMX6Q_GPR0_CLOCK_0_MUX_SEL_ESAI1_IPP_DO_SCKR (0x2 << 28)
38#define IMX6Q_GPR0_CLOCK_B_MUX_SEL_MASK (0x3 << 26)
39#define IMX6Q_GPR0_CLOCK_B_MUX_SEL_AUDMUX_TXCLK_P7_MUXED (0x0 << 26)
40#define IMX6Q_GPR0_CLOCK_B_MUX_SEL_AUDMUX_TXCLK_P7 (0x1 << 26)
41#define IMX6Q_GPR0_CLOCK_B_MUX_SEL_SSI3_SSI_STCK (0x2 << 26)
42#define IMX6Q_GPR0_CLOCK_B_MUX_SEL_SSI3_TX_BIT_CLK (0x3 << 26)
43#define IMX6Q_GPR0_CLOCK_3_MUX_SEL_MASK (0x3 << 24)
44#define IMX6Q_GPR0_CLOCK_3_MUX_SEL_AUDMUX_RXCLK_P7_MUXED (0x3 << 24)
45#define IMX6Q_GPR0_CLOCK_3_MUX_SEL_AUDMUX_RXCLK_P7 (0x3 << 24)
46#define IMX6Q_GPR0_CLOCK_3_MUX_SEL_SSI3_SSI_SRCK (0x3 << 24)
47#define IMX6Q_GPR0_CLOCK_3_MUX_SEL_SSI3_RX_BIT_CLK (0x3 << 24)
48#define IMX6Q_GPR0_CLOCK_A_MUX_SEL_MASK (0x3 << 22)
49#define IMX6Q_GPR0_CLOCK_A_MUX_SEL_AUDMUX_TXCLK_P2_MUXED (0x0 << 22)
50#define IMX6Q_GPR0_CLOCK_A_MUX_SEL_AUDMUX_TXCLK_P2 (0x1 << 22)
51#define IMX6Q_GPR0_CLOCK_A_MUX_SEL_SSI2_SSI_STCK (0x2 << 22)
52#define IMX6Q_GPR0_CLOCK_A_MUX_SEL_SSI2_TX_BIT_CLK (0x3 << 22)
53#define IMX6Q_GPR0_CLOCK_2_MUX_SEL_MASK (0x3 << 20)
54#define IMX6Q_GPR0_CLOCK_2_MUX_SEL_AUDMUX_RXCLK_P2_MUXED (0x0 << 20)
55#define IMX6Q_GPR0_CLOCK_2_MUX_SEL_AUDMUX_RXCLK_P2 (0x1 << 20)
56#define IMX6Q_GPR0_CLOCK_2_MUX_SEL_SSI2_SSI_SRCK (0x2 << 20)
57#define IMX6Q_GPR0_CLOCK_2_MUX_SEL_SSI2_RX_BIT_CLK (0x3 << 20)
58#define IMX6Q_GPR0_CLOCK_9_MUX_SEL_MASK (0x3 << 18)
59#define IMX6Q_GPR0_CLOCK_9_MUX_SEL_AUDMUX_TXCLK_P1_MUXED (0x0 << 18)
60#define IMX6Q_GPR0_CLOCK_9_MUX_SEL_AUDMUX_TXCLK_P1 (0x1 << 18)
61#define IMX6Q_GPR0_CLOCK_9_MUX_SEL_SSI1_SSI_STCK (0x2 << 18)
62#define IMX6Q_GPR0_CLOCK_9_MUX_SEL_SSI1_SSI_TX_BIT_CLK (0x3 << 18)
63#define IMX6Q_GPR0_CLOCK_1_MUX_SEL_MASK (0x3 << 16)
64#define IMX6Q_GPR0_CLOCK_1_MUX_SEL_AUDMUX_RXCLK_P1_MUXED (0x0 << 16)
65#define IMX6Q_GPR0_CLOCK_1_MUX_SEL_AUDMUX_RXCLK_P1 (0x1 << 16)
66#define IMX6Q_GPR0_CLOCK_1_MUX_SEL_SSI1_SSI_SRCK (0x2 << 16)
67#define IMX6Q_GPR0_CLOCK_1_MUX_SEL_SSI1_SSI_RX_BIT_CLK (0x3 << 16)
68#define IMX6Q_GPR0_TX_CLK2_MUX_SEL_MASK (0x3 << 14)
69#define IMX6Q_GPR0_TX_CLK2_MUX_SEL_ASRCK_CLK1 (0x0 << 14)
70#define IMX6Q_GPR0_TX_CLK2_MUX_SEL_ASRCK_CLK2 (0x1 << 14)
71#define IMX6Q_GPR0_TX_CLK2_MUX_SEL_ASRCK_CLK3 (0x2 << 14)
72#define IMX6Q_GPR0_DMAREQ_MUX_SEL7_MASK BIT(7)
73#define IMX6Q_GPR0_DMAREQ_MUX_SEL7_SPDIF 0x0
74#define IMX6Q_GPR0_DMAREQ_MUX_SEL7_IOMUX BIT(7)
75#define IMX6Q_GPR0_DMAREQ_MUX_SEL6_MASK BIT(6)
76#define IMX6Q_GPR0_DMAREQ_MUX_SEL6_ESAI 0x0
77#define IMX6Q_GPR0_DMAREQ_MUX_SEL6_I2C3 BIT(6)
78#define IMX6Q_GPR0_DMAREQ_MUX_SEL5_MASK BIT(5)
79#define IMX6Q_GPR0_DMAREQ_MUX_SEL5_ECSPI4 0x0
80#define IMX6Q_GPR0_DMAREQ_MUX_SEL5_EPIT2 BIT(5)
81#define IMX6Q_GPR0_DMAREQ_MUX_SEL4_MASK BIT(4)
82#define IMX6Q_GPR0_DMAREQ_MUX_SEL4_ECSPI4 0x0
83#define IMX6Q_GPR0_DMAREQ_MUX_SEL4_I2C1 BIT(4)
84#define IMX6Q_GPR0_DMAREQ_MUX_SEL3_MASK BIT(3)
85#define IMX6Q_GPR0_DMAREQ_MUX_SEL3_ECSPI2 0x0
86#define IMX6Q_GPR0_DMAREQ_MUX_SEL3_I2C1 BIT(3)
87#define IMX6Q_GPR0_DMAREQ_MUX_SEL2_MASK BIT(2)
88#define IMX6Q_GPR0_DMAREQ_MUX_SEL2_ECSPI1 0x0
89#define IMX6Q_GPR0_DMAREQ_MUX_SEL2_I2C2 BIT(2)
90#define IMX6Q_GPR0_DMAREQ_MUX_SEL1_MASK BIT(1)
91#define IMX6Q_GPR0_DMAREQ_MUX_SEL1_ECSPI1 0x0
92#define IMX6Q_GPR0_DMAREQ_MUX_SEL1_I2C3 BIT(1)
93#define IMX6Q_GPR0_DMAREQ_MUX_SEL0_MASK BIT(0)
94#define IMX6Q_GPR0_DMAREQ_MUX_SEL0_IPU1 0x0
95#define IMX6Q_GPR0_DMAREQ_MUX_SEL0_IOMUX BIT(0)
96
97#define IMX6Q_GPR1_PCIE_REQ_MASK (0x3 << 30)
98#define IMX6Q_GPR1_PCIE_EXIT_L1 BIT(28)
99#define IMX6Q_GPR1_PCIE_RDY_L23 BIT(27)
100#define IMX6Q_GPR1_PCIE_ENTER_L1 BIT(26)
101#define IMX6Q_GPR1_MIPI_COLOR_SW BIT(25)
102#define IMX6Q_GPR1_DPI_OFF BIT(24)
103#define IMX6Q_GPR1_EXC_MON_MASK BIT(22)
104#define IMX6Q_GPR1_EXC_MON_OKAY 0x0
105#define IMX6Q_GPR1_EXC_MON_SLVE BIT(22)
106#define IMX6Q_GPR1_MIPI_IPU2_SEL_MASK BIT(21)
107#define IMX6Q_GPR1_MIPI_IPU2_SEL_GASKET 0x0
108#define IMX6Q_GPR1_MIPI_IPU2_SEL_IOMUX BIT(21)
109#define IMX6Q_GPR1_MIPI_IPU1_MUX_MASK BIT(20)
110#define IMX6Q_GPR1_MIPI_IPU1_MUX_GASKET 0x0
111#define IMX6Q_GPR1_MIPI_IPU1_MUX_IOMUX BIT(20)
112#define IMX6Q_GPR1_MIPI_IPU2_MUX_MASK BIT(19)
113#define IMX6Q_GPR1_MIPI_IPU2_MUX_GASKET 0x0
114#define IMX6Q_GPR1_MIPI_IPU2_MUX_IOMUX BIT(19)
115#define IMX6Q_GPR1_PCIE_TEST_PD BIT(18)
116#define IMX6Q_GPR1_IPU_VPU_MUX_MASK BIT(17)
117#define IMX6Q_GPR1_IPU_VPU_MUX_IPU1 0x0
118#define IMX6Q_GPR1_IPU_VPU_MUX_IPU2 BIT(17)
119#define IMX6Q_GPR1_PCIE_REF_CLK_EN BIT(16)
120#define IMX6Q_GPR1_USB_EXP_MODE BIT(15)
121#define IMX6Q_GPR1_PCIE_INT BIT(14)
122#define IMX6Q_GPR1_USB_OTG_ID_SEL_MASK BIT(13)
123#define IMX6Q_GPR1_USB_OTG_ID_SEL_ENET_RX_ER 0x0
124#define IMX6Q_GPR1_USB_OTG_ID_SEL_GPIO_1 BIT(13)
125#define IMX6Q_GPR1_GINT BIT(12)
126#define IMX6Q_GPR1_ADDRS3_MASK (0x3 << 10)
127#define IMX6Q_GPR1_ADDRS3_32MB (0x0 << 10)
128#define IMX6Q_GPR1_ADDRS3_64MB (0x1 << 10)
129#define IMX6Q_GPR1_ADDRS3_128MB (0x2 << 10)
130#define IMX6Q_GPR1_ACT_CS3 BIT(9)
131#define IMX6Q_GPR1_ADDRS2_MASK (0x3 << 7)
132#define IMX6Q_GPR1_ACT_CS2 BIT(6)
133#define IMX6Q_GPR1_ADDRS1_MASK (0x3 << 4)
134#define IMX6Q_GPR1_ACT_CS1 BIT(3)
135#define IMX6Q_GPR1_ADDRS0_MASK (0x3 << 1)
136#define IMX6Q_GPR1_ACT_CS0 BIT(0)
137
138#define IMX6Q_GPR2_COUNTER_RESET_VAL_MASK (0x3 << 20)
139#define IMX6Q_GPR2_COUNTER_RESET_VAL_5 (0x0 << 20)
140#define IMX6Q_GPR2_COUNTER_RESET_VAL_3 (0x1 << 20)
141#define IMX6Q_GPR2_COUNTER_RESET_VAL_4 (0x2 << 20)
142#define IMX6Q_GPR2_COUNTER_RESET_VAL_6 (0x3 << 20)
143#define IMX6Q_GPR2_LVDS_CLK_SHIFT_MASK (0x7 << 16)
144#define IMX6Q_GPR2_LVDS_CLK_SHIFT_0 (0x0 << 16)
145#define IMX6Q_GPR2_LVDS_CLK_SHIFT_1 (0x1 << 16)
146#define IMX6Q_GPR2_LVDS_CLK_SHIFT_2 (0x2 << 16)
147#define IMX6Q_GPR2_LVDS_CLK_SHIFT_3 (0x3 << 16)
148#define IMX6Q_GPR2_LVDS_CLK_SHIFT_4 (0x4 << 16)
149#define IMX6Q_GPR2_LVDS_CLK_SHIFT_5 (0x5 << 16)
150#define IMX6Q_GPR2_LVDS_CLK_SHIFT_6 (0x6 << 16)
151#define IMX6Q_GPR2_LVDS_CLK_SHIFT_7 (0x7 << 16)
152#define IMX6Q_GPR2_BGREF_RRMODE_MASK BIT(15)
153#define IMX6Q_GPR2_BGREF_RRMODE_EXT_RESISTOR 0x0
154#define IMX6Q_GPR2_BGREF_RRMODE_INT_RESISTOR BIT(15)
155#define IMX6Q_GPR2_DI1_VS_POLARITY_MASK BIT(10)
156#define IMX6Q_GPR2_DI1_VS_POLARITY_ACTIVE_H 0x0
157#define IMX6Q_GPR2_DI1_VS_POLARITY_ACTIVE_L BIT(10)
158#define IMX6Q_GPR2_DI0_VS_POLARITY_MASK BIT(9)
159#define IMX6Q_GPR2_DI0_VS_POLARITY_ACTIVE_H 0x0
160#define IMX6Q_GPR2_DI0_VS_POLARITY_ACTIVE_L BIT(9)
161#define IMX6Q_GPR2_BIT_MAPPING_CH1_MASK BIT(8)
162#define IMX6Q_GPR2_BIT_MAPPING_CH1_SPWG 0x0
163#define IMX6Q_GPR2_BIT_MAPPING_CH1_JEIDA BIT(8)
164#define IMX6Q_GPR2_DATA_WIDTH_CH1_MASK BIT(7)
165#define IMX6Q_GPR2_DATA_WIDTH_CH1_18BIT 0x0
166#define IMX6Q_GPR2_DATA_WIDTH_CH1_24BIT BIT(7)
167#define IMX6Q_GPR2_BIT_MAPPING_CH0_MASK BIT(6)
168#define IMX6Q_GPR2_BIT_MAPPING_CH0_SPWG 0x0
169#define IMX6Q_GPR2_BIT_MAPPING_CH0_JEIDA BIT(6)
170#define IMX6Q_GPR2_DATA_WIDTH_CH0_MASK BIT(5)
171#define IMX6Q_GPR2_DATA_WIDTH_CH0_18BIT 0x0
172#define IMX6Q_GPR2_DATA_WIDTH_CH0_24BIT BIT(5)
173#define IMX6Q_GPR2_SPLIT_MODE_EN BIT(4)
174#define IMX6Q_GPR2_CH1_MODE_MASK (0x3 << 2)
175#define IMX6Q_GPR2_CH1_MODE_DISABLE (0x0 << 2)
176#define IMX6Q_GPR2_CH1_MODE_EN_ROUTE_DI0 (0x1 << 2)
177#define IMX6Q_GPR2_CH1_MODE_EN_ROUTE_DI1 (0x3 << 2)
178#define IMX6Q_GPR2_CH0_MODE_MASK (0x3 << 0)
179#define IMX6Q_GPR2_CH0_MODE_DISABLE (0x0 << 0)
180#define IMX6Q_GPR2_CH0_MODE_EN_ROUTE_DI0 (0x1 << 0)
181#define IMX6Q_GPR2_CH0_MODE_EN_ROUTE_DI1 (0x3 << 0)
182
183#define IMX6Q_GPR3_GPU_DBG_MASK (0x3 << 29)
184#define IMX6Q_GPR3_GPU_DBG_GPU3D (0x0 << 29)
185#define IMX6Q_GPR3_GPU_DBG_GPU2D (0x1 << 29)
186#define IMX6Q_GPR3_GPU_DBG_OPENVG (0x2 << 29)
187#define IMX6Q_GPR3_BCH_WR_CACHE_CTL BIT(28)
188#define IMX6Q_GPR3_BCH_RD_CACHE_CTL BIT(27)
189#define IMX6Q_GPR3_USDHCX_WR_CACHE_CTL BIT(26)
190#define IMX6Q_GPR3_USDHCX_RD_CACHE_CTL BIT(25)
191#define IMX6Q_GPR3_OCRAM_CTL_MASK (0xf << 21)
192#define IMX6Q_GPR3_OCRAM_STATUS_MASK (0xf << 17)
193#define IMX6Q_GPR3_CORE3_DBG_ACK_EN BIT(16)
194#define IMX6Q_GPR3_CORE2_DBG_ACK_EN BIT(15)
195#define IMX6Q_GPR3_CORE1_DBG_ACK_EN BIT(14)
196#define IMX6Q_GPR3_CORE0_DBG_ACK_EN BIT(13)
197#define IMX6Q_GPR3_TZASC2_BOOT_LOCK BIT(12)
198#define IMX6Q_GPR3_TZASC1_BOOT_LOCK BIT(11)
199#define IMX6Q_GPR3_IPU_DIAG_MASK BIT(10)
200#define IMX6Q_GPR3_LVDS1_MUX_CTL_MASK (0x3 << 8)
201#define IMX6Q_GPR3_LVDS1_MUX_CTL_IPU1_DI0 (0x0 << 8)
202#define IMX6Q_GPR3_LVDS1_MUX_CTL_IPU1_DI1 (0x1 << 8)
203#define IMX6Q_GPR3_LVDS1_MUX_CTL_IPU2_DI0 (0x2 << 8)
204#define IMX6Q_GPR3_LVDS1_MUX_CTL_IPU2_DI1 (0x3 << 8)
205#define IMX6Q_GPR3_LVDS0_MUX_CTL_MASK (0x3 << 6)
206#define IMX6Q_GPR3_LVDS0_MUX_CTL_IPU1_DI0 (0x0 << 6)
207#define IMX6Q_GPR3_LVDS0_MUX_CTL_IPU1_DI1 (0x1 << 6)
208#define IMX6Q_GPR3_LVDS0_MUX_CTL_IPU2_DI0 (0x2 << 6)
209#define IMX6Q_GPR3_LVDS0_MUX_CTL_IPU2_DI1 (0x3 << 6)
210#define IMX6Q_GPR3_MIPI_MUX_CTL_MASK (0x3 << 4)
211#define IMX6Q_GPR3_MIPI_MUX_CTL_IPU1_DI0 (0x0 << 4)
212#define IMX6Q_GPR3_MIPI_MUX_CTL_IPU1_DI1 (0x1 << 4)
213#define IMX6Q_GPR3_MIPI_MUX_CTL_IPU2_DI0 (0x2 << 4)
214#define IMX6Q_GPR3_MIPI_MUX_CTL_IPU2_DI1 (0x3 << 4)
215#define IMX6Q_GPR3_HDMI_MUX_CTL_MASK (0x3 << 2)
216#define IMX6Q_GPR3_HDMI_MUX_CTL_IPU1_DI0 (0x0 << 2)
217#define IMX6Q_GPR3_HDMI_MUX_CTL_IPU1_DI1 (0x1 << 2)
218#define IMX6Q_GPR3_HDMI_MUX_CTL_IPU2_DI0 (0x2 << 2)
219#define IMX6Q_GPR3_HDMI_MUX_CTL_IPU2_DI1 (0x3 << 2)
220
221#define IMX6Q_GPR4_VDOA_WR_CACHE_SEL BIT(31)
222#define IMX6Q_GPR4_VDOA_RD_CACHE_SEL BIT(30)
223#define IMX6Q_GPR4_VDOA_WR_CACHE_VAL BIT(29)
224#define IMX6Q_GPR4_VDOA_RD_CACHE_VAL BIT(28)
225#define IMX6Q_GPR4_PCIE_WR_CACHE_SEL BIT(27)
226#define IMX6Q_GPR4_PCIE_RD_CACHE_SEL BIT(26)
227#define IMX6Q_GPR4_PCIE_WR_CACHE_VAL BIT(25)
228#define IMX6Q_GPR4_PCIE_RD_CACHE_VAL BIT(24)
229#define IMX6Q_GPR4_SDMA_STOP_ACK BIT(19)
230#define IMX6Q_GPR4_CAN2_STOP_ACK BIT(18)
231#define IMX6Q_GPR4_CAN1_STOP_ACK BIT(17)
232#define IMX6Q_GPR4_ENET_STOP_ACK BIT(16)
233#define IMX6Q_GPR4_SOC_VERSION_MASK (0xff << 8)
234#define IMX6Q_GPR4_SOC_VERSION_OFF 0x8
235#define IMX6Q_GPR4_VPU_WR_CACHE_SEL BIT(7)
236#define IMX6Q_GPR4_VPU_RD_CACHE_SEL BIT(6)
237#define IMX6Q_GPR4_VPU_P_WR_CACHE_VAL BIT(3)
238#define IMX6Q_GPR4_VPU_P_RD_CACHE_VAL_MASK BIT(2)
239#define IMX6Q_GPR4_IPU_WR_CACHE_CTL BIT(1)
240#define IMX6Q_GPR4_IPU_RD_CACHE_CTL BIT(0)
241
242#define IMX6Q_GPR5_L2_CLK_STOP BIT(8)
243
244#define IMX6Q_GPR9_TZASC2_BYP BIT(1)
245#define IMX6Q_GPR9_TZASC1_BYP BIT(0)
246
247#define IMX6Q_GPR10_LOCK_DBG_EN BIT(29)
248#define IMX6Q_GPR10_LOCK_DBG_CLK_EN BIT(28)
249#define IMX6Q_GPR10_LOCK_SEC_ERR_RESP BIT(27)
250#define IMX6Q_GPR10_LOCK_OCRAM_TZ_ADDR (0x3f << 21)
251#define IMX6Q_GPR10_LOCK_OCRAM_TZ_EN BIT(20)
252#define IMX6Q_GPR10_LOCK_DCIC2_MUX_MASK (0x3 << 18)
253#define IMX6Q_GPR10_LOCK_DCIC1_MUX_MASK (0x3 << 16)
254#define IMX6Q_GPR10_DBG_EN BIT(13)
255#define IMX6Q_GPR10_DBG_CLK_EN BIT(12)
256#define IMX6Q_GPR10_SEC_ERR_RESP_MASK BIT(11)
257#define IMX6Q_GPR10_SEC_ERR_RESP_OKEY 0x0
258#define IMX6Q_GPR10_SEC_ERR_RESP_SLVE BIT(11)
259#define IMX6Q_GPR10_OCRAM_TZ_ADDR_MASK (0x3f << 5)
260#define IMX6Q_GPR10_OCRAM_TZ_EN_MASK BIT(4)
261#define IMX6Q_GPR10_DCIC2_MUX_CTL_MASK (0x3 << 2)
262#define IMX6Q_GPR10_DCIC2_MUX_CTL_IPU1_DI0 (0x0 << 2)
263#define IMX6Q_GPR10_DCIC2_MUX_CTL_IPU1_DI1 (0x1 << 2)
264#define IMX6Q_GPR10_DCIC2_MUX_CTL_IPU2_DI0 (0x2 << 2)
265#define IMX6Q_GPR10_DCIC2_MUX_CTL_IPU2_DI1 (0x3 << 2)
266#define IMX6Q_GPR10_DCIC1_MUX_CTL_MASK (0x3 << 0)
267#define IMX6Q_GPR10_DCIC1_MUX_CTL_IPU1_DI0 (0x0 << 0)
268#define IMX6Q_GPR10_DCIC1_MUX_CTL_IPU1_DI1 (0x1 << 0)
269#define IMX6Q_GPR10_DCIC1_MUX_CTL_IPU2_DI0 (0x2 << 0)
270#define IMX6Q_GPR10_DCIC1_MUX_CTL_IPU2_DI1 (0x3 << 0)
271
272#define IMX6Q_GPR12_ARMP_IPG_CLK_EN BIT(27)
273#define IMX6Q_GPR12_ARMP_AHB_CLK_EN BIT(26)
274#define IMX6Q_GPR12_ARMP_ATB_CLK_EN BIT(25)
275#define IMX6Q_GPR12_ARMP_APB_CLK_EN BIT(24)
276#define IMX6Q_GPR12_PCIE_CTL_2 BIT(10)
277
278#define IMX6Q_GPR13_SDMA_STOP_REQ BIT(30)
279#define IMX6Q_GPR13_CAN2_STOP_REQ BIT(29)
280#define IMX6Q_GPR13_CAN1_STOP_REQ BIT(28)
281#define IMX6Q_GPR13_ENET_STOP_REQ BIT(27)
282#define IMX6Q_GPR13_SATA_PHY_8_MASK (0x7 << 24)
283#define IMX6Q_GPR13_SATA_PHY_8_0_5_DB (0x0 << 24)
284#define IMX6Q_GPR13_SATA_PHY_8_1_0_DB (0x1 << 24)
285#define IMX6Q_GPR13_SATA_PHY_8_1_5_DB (0x2 << 24)
286#define IMX6Q_GPR13_SATA_PHY_8_2_0_DB (0x3 << 24)
287#define IMX6Q_GPR13_SATA_PHY_8_2_5_DB (0x4 << 24)
288#define IMX6Q_GPR13_SATA_PHY_8_3_0_DB (0x5 << 24)
289#define IMX6Q_GPR13_SATA_PHY_8_3_5_DB (0x6 << 24)
290#define IMX6Q_GPR13_SATA_PHY_8_4_0_DB (0x7 << 24)
291#define IMX6Q_GPR13_SATA_PHY_7_MASK (0x1f << 19)
292#define IMX6Q_GPR13_SATA_PHY_7_SATA1I (0x10 << 19)
293#define IMX6Q_GPR13_SATA_PHY_7_SATA1M (0x10 << 19)
294#define IMX6Q_GPR13_SATA_PHY_7_SATA1X (0x1a << 19)
295#define IMX6Q_GPR13_SATA_PHY_7_SATA2I (0x12 << 19)
296#define IMX6Q_GPR13_SATA_PHY_7_SATA2M (0x12 << 19)
297#define IMX6Q_GPR13_SATA_PHY_7_SATA2X (0x1a << 19)
298#define IMX6Q_GPR13_SATA_PHY_6_MASK (0x7 << 16)
299#define IMX6Q_GPR13_SATA_SPEED_MASK BIT(15)
300#define IMX6Q_GPR13_SATA_SPEED_1P5G 0x0
301#define IMX6Q_GPR13_SATA_SPEED_3P0G BIT(15)
302#define IMX6Q_GPR13_SATA_PHY_5 BIT(14)
303#define IMX6Q_GPR13_SATA_PHY_4_MASK (0x7 << 11)
304#define IMX6Q_GPR13_SATA_PHY_4_16_16 (0x0 << 11)
305#define IMX6Q_GPR13_SATA_PHY_4_14_16 (0x1 << 11)
306#define IMX6Q_GPR13_SATA_PHY_4_12_16 (0x2 << 11)
307#define IMX6Q_GPR13_SATA_PHY_4_10_16 (0x3 << 11)
308#define IMX6Q_GPR13_SATA_PHY_4_9_16 (0x4 << 11)
309#define IMX6Q_GPR13_SATA_PHY_4_8_16 (0x5 << 11)
310#define IMX6Q_GPR13_SATA_PHY_3_MASK (0xf << 7)
311#define IMX6Q_GPR13_SATA_PHY_3_OFF 0x7
312#define IMX6Q_GPR13_SATA_PHY_2_MASK (0x1f << 2)
313#define IMX6Q_GPR13_SATA_PHY_2_OFF 0x2
314#define IMX6Q_GPR13_SATA_PHY_1_MASK (0x3 << 0)
315#define IMX6Q_GPR13_SATA_PHY_1_FAST (0x0 << 0)
316#define IMX6Q_GPR13_SATA_PHY_1_MED (0x1 << 0)
317#define IMX6Q_GPR13_SATA_PHY_1_SLOW (0x2 << 0)
318
319#endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */
diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h
index 3acb3a8e3af5..6b8e1ff4672b 100644
--- a/include/linux/mfd/tc3589x.h
+++ b/include/linux/mfd/tc3589x.h
@@ -117,6 +117,7 @@ struct tc3589x {
117 struct mutex lock; 117 struct mutex lock;
118 struct device *dev; 118 struct device *dev;
119 struct i2c_client *i2c; 119 struct i2c_client *i2c;
120 struct irq_domain *domain;
120 121
121 int irq_base; 122 int irq_base;
122 int num_gpio; 123 int num_gpio;
diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h
index 7cd83d826ed8..290762f93930 100644
--- a/include/linux/mfd/tps65217.h
+++ b/include/linux/mfd/tps65217.h
@@ -213,6 +213,23 @@ enum tps65217_regulator_id {
213/* Number of total regulators available */ 213/* Number of total regulators available */
214#define TPS65217_NUM_REGULATOR (TPS65217_NUM_DCDC + TPS65217_NUM_LDO) 214#define TPS65217_NUM_REGULATOR (TPS65217_NUM_DCDC + TPS65217_NUM_LDO)
215 215
216enum tps65217_bl_isel {
217 TPS65217_BL_ISET1 = 1,
218 TPS65217_BL_ISET2,
219};
220
221enum tps65217_bl_fdim {
222 TPS65217_BL_FDIM_100HZ,
223 TPS65217_BL_FDIM_200HZ,
224 TPS65217_BL_FDIM_500HZ,
225 TPS65217_BL_FDIM_1000HZ,
226};
227
228struct tps65217_bl_pdata {
229 enum tps65217_bl_isel isel;
230 enum tps65217_bl_fdim fdim;
231};
232
216/** 233/**
217 * struct tps65217_board - packages regulator init data 234 * struct tps65217_board - packages regulator init data
218 * @tps65217_regulator_data: regulator initialization values 235 * @tps65217_regulator_data: regulator initialization values
@@ -222,6 +239,7 @@ enum tps65217_regulator_id {
222struct tps65217_board { 239struct tps65217_board {
223 struct regulator_init_data *tps65217_init_data[TPS65217_NUM_REGULATOR]; 240 struct regulator_init_data *tps65217_init_data[TPS65217_NUM_REGULATOR];
224 struct device_node *of_node[TPS65217_NUM_REGULATOR]; 241 struct device_node *of_node[TPS65217_NUM_REGULATOR];
242 struct tps65217_bl_pdata *bl_pdata;
225}; 243};
226 244
227/** 245/**
diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h
index 94514710a03f..2dd123194958 100644
--- a/include/linux/mfd/tps6586x.h
+++ b/include/linux/mfd/tps6586x.h
@@ -78,6 +78,7 @@ struct tps6586x_platform_data {
78 78
79 int gpio_base; 79 int gpio_base;
80 int irq_base; 80 int irq_base;
81 bool pm_off;
81}; 82};
82 83
83/* 84/*
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h
index 9bf8767818b4..02e894f3ff45 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -132,6 +132,16 @@
132 * 132 *
133 */ 133 */
134 134
135/* RTC_CTRL_REG bitfields */
136#define TPS65910_RTC_CTRL_STOP_RTC 0x01 /*0=stop, 1=run */
137#define TPS65910_RTC_CTRL_GET_TIME 0x40
138
139/* RTC_STATUS_REG bitfields */
140#define TPS65910_RTC_STATUS_ALARM 0x40
141
142/* RTC_INTERRUPTS_REG bitfields */
143#define TPS65910_RTC_INTERRUPTS_EVERY 0x03
144#define TPS65910_RTC_INTERRUPTS_IT_ALARM 0x08
135 145
136/*Register BCK1 (0x80) register.RegisterDescription */ 146/*Register BCK1 (0x80) register.RegisterDescription */
137#define BCK1_BCKUP_MASK 0xFF 147#define BCK1_BCKUP_MASK 0xFF
@@ -366,6 +376,8 @@
366 376
367 377
368/*Register DEVCTRL (0x80) register.RegisterDescription */ 378/*Register DEVCTRL (0x80) register.RegisterDescription */
379#define DEVCTRL_PWR_OFF_MASK 0x80
380#define DEVCTRL_PWR_OFF_SHIFT 7
369#define DEVCTRL_RTC_PWDN_MASK 0x40 381#define DEVCTRL_RTC_PWDN_MASK 0x40
370#define DEVCTRL_RTC_PWDN_SHIFT 6 382#define DEVCTRL_RTC_PWDN_SHIFT 6
371#define DEVCTRL_CK32K_CTRL_MASK 0x20 383#define DEVCTRL_CK32K_CTRL_MASK 0x20
@@ -809,6 +821,7 @@ struct tps65910_board {
809 int vmbch2_threshold; 821 int vmbch2_threshold;
810 bool en_ck32k_xtal; 822 bool en_ck32k_xtal;
811 bool en_dev_slp; 823 bool en_dev_slp;
824 bool pm_off;
812 struct tps65910_sleep_keepon_data *slp_keepon; 825 struct tps65910_sleep_keepon_data *slp_keepon;
813 bool en_gpio_sleep[TPS6591X_MAX_NUM_GPIO]; 826 bool en_gpio_sleep[TPS6591X_MAX_NUM_GPIO];
814 unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS]; 827 unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS];
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
index ba43d4806b83..a8eff4ad9be5 100644
--- a/include/linux/mfd/twl6040.h
+++ b/include/linux/mfd/twl6040.h
@@ -143,7 +143,7 @@
143 143
144#define TWL6040_GPO1 0x01 144#define TWL6040_GPO1 0x01
145#define TWL6040_GPO2 0x02 145#define TWL6040_GPO2 0x02
146#define TWL6040_GPO3 0x03 146#define TWL6040_GPO3 0x04
147 147
148/* ACCCTL (0x2D) fields */ 148/* ACCCTL (0x2D) fields */
149 149
@@ -158,7 +158,7 @@
158#define TWL6040_VIBROCDET 0x20 158#define TWL6040_VIBROCDET 0x20
159#define TWL6040_TSHUTDET 0x40 159#define TWL6040_TSHUTDET 0x40
160 160
161#define TWL6040_CELLS 2 161#define TWL6040_CELLS 3
162 162
163#define TWL6040_REV_ES1_0 0x00 163#define TWL6040_REV_ES1_0 0x00
164#define TWL6040_REV_ES1_1 0x01 /* Rev ES1.1 and ES1.2 */ 164#define TWL6040_REV_ES1_1 0x01 /* Rev ES1.1 and ES1.2 */
@@ -176,6 +176,8 @@
176#define TWL6040_SYSCLK_SEL_LPPLL 0 176#define TWL6040_SYSCLK_SEL_LPPLL 0
177#define TWL6040_SYSCLK_SEL_HPPLL 1 177#define TWL6040_SYSCLK_SEL_HPPLL 1
178 178
179#define TWL6040_GPO_MAX 3
180
179struct twl6040_codec_data { 181struct twl6040_codec_data {
180 u16 hs_left_step; 182 u16 hs_left_step;
181 u16 hs_right_step; 183 u16 hs_right_step;
@@ -192,11 +194,16 @@ struct twl6040_vibra_data {
192 int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */ 194 int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */
193}; 195};
194 196
197struct twl6040_gpo_data {
198 int gpio_base;
199};
200
195struct twl6040_platform_data { 201struct twl6040_platform_data {
196 int audpwron_gpio; /* audio power-on gpio */ 202 int audpwron_gpio; /* audio power-on gpio */
197 203
198 struct twl6040_codec_data *codec; 204 struct twl6040_codec_data *codec;
199 struct twl6040_vibra_data *vibra; 205 struct twl6040_vibra_data *vibra;
206 struct twl6040_gpo_data *gpo;
200}; 207};
201 208
202struct regmap; 209struct regmap;
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index f0361c031927..fc87be4fdc25 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -164,6 +164,10 @@ struct wm8994_pdata {
164 int num_micd_rates; 164 int num_micd_rates;
165 struct wm8958_micd_rate *micd_rates; 165 struct wm8958_micd_rate *micd_rates;
166 166
167 /* Power up delays to add after microphone bias power up (ms) */
168 int micb1_delay;
169 int micb2_delay;
170
167 /* LINEOUT can be differential or single ended */ 171 /* LINEOUT can be differential or single ended */
168 unsigned int lineout1_diff:1; 172 unsigned int lineout1_diff:1;
169 unsigned int lineout2_diff:1; 173 unsigned int lineout2_diff:1;
diff --git a/include/linux/mii.h b/include/linux/mii.h
index 8ef3a7a11592..47492c9631b3 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -4,163 +4,12 @@
4 * 4 *
5 * Copyright (C) 1996, 1999, 2001 David S. Miller (davem@redhat.com) 5 * Copyright (C) 1996, 1999, 2001 David S. Miller (davem@redhat.com)
6 */ 6 */
7
8#ifndef __LINUX_MII_H__ 7#ifndef __LINUX_MII_H__
9#define __LINUX_MII_H__ 8#define __LINUX_MII_H__
10 9
11#include <linux/types.h>
12#include <linux/ethtool.h>
13
14/* Generic MII registers. */
15#define MII_BMCR 0x00 /* Basic mode control register */
16#define MII_BMSR 0x01 /* Basic mode status register */
17#define MII_PHYSID1 0x02 /* PHYS ID 1 */
18#define MII_PHYSID2 0x03 /* PHYS ID 2 */
19#define MII_ADVERTISE 0x04 /* Advertisement control reg */
20#define MII_LPA 0x05 /* Link partner ability reg */
21#define MII_EXPANSION 0x06 /* Expansion register */
22#define MII_CTRL1000 0x09 /* 1000BASE-T control */
23#define MII_STAT1000 0x0a /* 1000BASE-T status */
24#define MII_MMD_CTRL 0x0d /* MMD Access Control Register */
25#define MII_MMD_DATA 0x0e /* MMD Access Data Register */
26#define MII_ESTATUS 0x0f /* Extended Status */
27#define MII_DCOUNTER 0x12 /* Disconnect counter */
28#define MII_FCSCOUNTER 0x13 /* False carrier counter */
29#define MII_NWAYTEST 0x14 /* N-way auto-neg test reg */
30#define MII_RERRCOUNTER 0x15 /* Receive error counter */
31#define MII_SREVISION 0x16 /* Silicon revision */
32#define MII_RESV1 0x17 /* Reserved... */
33#define MII_LBRERROR 0x18 /* Lpback, rx, bypass error */
34#define MII_PHYADDR 0x19 /* PHY address */
35#define MII_RESV2 0x1a /* Reserved... */
36#define MII_TPISTATUS 0x1b /* TPI status for 10mbps */
37#define MII_NCONFIG 0x1c /* Network interface config */
38
39/* Basic mode control register. */
40#define BMCR_RESV 0x003f /* Unused... */
41#define BMCR_SPEED1000 0x0040 /* MSB of Speed (1000) */
42#define BMCR_CTST 0x0080 /* Collision test */
43#define BMCR_FULLDPLX 0x0100 /* Full duplex */
44#define BMCR_ANRESTART 0x0200 /* Auto negotiation restart */
45#define BMCR_ISOLATE 0x0400 /* Isolate data paths from MII */
46#define BMCR_PDOWN 0x0800 /* Enable low power state */
47#define BMCR_ANENABLE 0x1000 /* Enable auto negotiation */
48#define BMCR_SPEED100 0x2000 /* Select 100Mbps */
49#define BMCR_LOOPBACK 0x4000 /* TXD loopback bits */
50#define BMCR_RESET 0x8000 /* Reset to default state */
51
52/* Basic mode status register. */
53#define BMSR_ERCAP 0x0001 /* Ext-reg capability */
54#define BMSR_JCD 0x0002 /* Jabber detected */
55#define BMSR_LSTATUS 0x0004 /* Link status */
56#define BMSR_ANEGCAPABLE 0x0008 /* Able to do auto-negotiation */
57#define BMSR_RFAULT 0x0010 /* Remote fault detected */
58#define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */
59#define BMSR_RESV 0x00c0 /* Unused... */
60#define BMSR_ESTATEN 0x0100 /* Extended Status in R15 */
61#define BMSR_100HALF2 0x0200 /* Can do 100BASE-T2 HDX */
62#define BMSR_100FULL2 0x0400 /* Can do 100BASE-T2 FDX */
63#define BMSR_10HALF 0x0800 /* Can do 10mbps, half-duplex */
64#define BMSR_10FULL 0x1000 /* Can do 10mbps, full-duplex */
65#define BMSR_100HALF 0x2000 /* Can do 100mbps, half-duplex */
66#define BMSR_100FULL 0x4000 /* Can do 100mbps, full-duplex */
67#define BMSR_100BASE4 0x8000 /* Can do 100mbps, 4k packets */
68
69/* Advertisement control register. */
70#define ADVERTISE_SLCT 0x001f /* Selector bits */
71#define ADVERTISE_CSMA 0x0001 /* Only selector supported */
72#define ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */
73#define ADVERTISE_1000XFULL 0x0020 /* Try for 1000BASE-X full-duplex */
74#define ADVERTISE_10FULL 0x0040 /* Try for 10mbps full-duplex */
75#define ADVERTISE_1000XHALF 0x0040 /* Try for 1000BASE-X half-duplex */
76#define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */
77#define ADVERTISE_1000XPAUSE 0x0080 /* Try for 1000BASE-X pause */
78#define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */
79#define ADVERTISE_1000XPSE_ASYM 0x0100 /* Try for 1000BASE-X asym pause */
80#define ADVERTISE_100BASE4 0x0200 /* Try for 100mbps 4k packets */
81#define ADVERTISE_PAUSE_CAP 0x0400 /* Try for pause */
82#define ADVERTISE_PAUSE_ASYM 0x0800 /* Try for asymetric pause */
83#define ADVERTISE_RESV 0x1000 /* Unused... */
84#define ADVERTISE_RFAULT 0x2000 /* Say we can detect faults */
85#define ADVERTISE_LPACK 0x4000 /* Ack link partners response */
86#define ADVERTISE_NPAGE 0x8000 /* Next page bit */
87
88#define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \
89 ADVERTISE_CSMA)
90#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \
91 ADVERTISE_100HALF | ADVERTISE_100FULL)
92
93/* Link partner ability register. */
94#define LPA_SLCT 0x001f /* Same as advertise selector */
95#define LPA_10HALF 0x0020 /* Can do 10mbps half-duplex */
96#define LPA_1000XFULL 0x0020 /* Can do 1000BASE-X full-duplex */
97#define LPA_10FULL 0x0040 /* Can do 10mbps full-duplex */
98#define LPA_1000XHALF 0x0040 /* Can do 1000BASE-X half-duplex */
99#define LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */
100#define LPA_1000XPAUSE 0x0080 /* Can do 1000BASE-X pause */
101#define LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */
102#define LPA_1000XPAUSE_ASYM 0x0100 /* Can do 1000BASE-X pause asym*/
103#define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */
104#define LPA_PAUSE_CAP 0x0400 /* Can pause */
105#define LPA_PAUSE_ASYM 0x0800 /* Can pause asymetrically */
106#define LPA_RESV 0x1000 /* Unused... */
107#define LPA_RFAULT 0x2000 /* Link partner faulted */
108#define LPA_LPACK 0x4000 /* Link partner acked us */
109#define LPA_NPAGE 0x8000 /* Next page bit */
110
111#define LPA_DUPLEX (LPA_10FULL | LPA_100FULL)
112#define LPA_100 (LPA_100FULL | LPA_100HALF | LPA_100BASE4)
113
114/* Expansion register for auto-negotiation. */
115#define EXPANSION_NWAY 0x0001 /* Can do N-way auto-nego */
116#define EXPANSION_LCWP 0x0002 /* Got new RX page code word */
117#define EXPANSION_ENABLENPAGE 0x0004 /* This enables npage words */
118#define EXPANSION_NPCAPABLE 0x0008 /* Link partner supports npage */
119#define EXPANSION_MFAULTS 0x0010 /* Multiple faults detected */
120#define EXPANSION_RESV 0xffe0 /* Unused... */
121
122#define ESTATUS_1000_TFULL 0x2000 /* Can do 1000BT Full */
123#define ESTATUS_1000_THALF 0x1000 /* Can do 1000BT Half */
124
125/* N-way test register. */
126#define NWAYTEST_RESV1 0x00ff /* Unused... */
127#define NWAYTEST_LOOPBACK 0x0100 /* Enable loopback for N-way */
128#define NWAYTEST_RESV2 0xfe00 /* Unused... */
129
130/* 1000BASE-T Control register */
131#define ADVERTISE_1000FULL 0x0200 /* Advertise 1000BASE-T full duplex */
132#define ADVERTISE_1000HALF 0x0100 /* Advertise 1000BASE-T half duplex */
133#define CTL1000_AS_MASTER 0x0800
134#define CTL1000_ENABLE_MASTER 0x1000
135
136/* 1000BASE-T Status register */
137#define LPA_1000LOCALRXOK 0x2000 /* Link partner local receiver status */
138#define LPA_1000REMRXOK 0x1000 /* Link partner remote receiver status */
139#define LPA_1000FULL 0x0800 /* Link partner 1000BASE-T full duplex */
140#define LPA_1000HALF 0x0400 /* Link partner 1000BASE-T half duplex */
141
142/* Flow control flags */
143#define FLOW_CTRL_TX 0x01
144#define FLOW_CTRL_RX 0x02
145
146/* MMD Access Control register fields */
147#define MII_MMD_CTRL_DEVAD_MASK 0x1f /* Mask MMD DEVAD*/
148#define MII_MMD_CTRL_ADDR 0x0000 /* Address */
149#define MII_MMD_CTRL_NOINCR 0x4000 /* no post increment */
150#define MII_MMD_CTRL_INCR_RDWT 0x8000 /* post increment on reads & writes */
151#define MII_MMD_CTRL_INCR_ON_WT 0xC000 /* post increment on writes only */
152
153/* This structure is used in all SIOCxMIIxxx ioctl calls */
154struct mii_ioctl_data {
155 __u16 phy_id;
156 __u16 reg_num;
157 __u16 val_in;
158 __u16 val_out;
159};
160
161#ifdef __KERNEL__
162 10
163#include <linux/if.h> 11#include <linux/if.h>
12#include <uapi/linux/mii.h>
164 13
165struct ethtool_cmd; 14struct ethtool_cmd;
166 15
@@ -487,5 +336,4 @@ static inline u8 mii_resolve_flowctrl_fdx(u16 lcladv, u16 rmtadv)
487 return cap; 336 return cap;
488} 337}
489 338
490#endif /* __KERNEL__ */
491#endif /* __LINUX_MII_H__ */ 339#endif /* __LINUX_MII_H__ */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 311be906b57d..fa0680402738 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -10,7 +10,6 @@
10#include <linux/list.h> 10#include <linux/list.h>
11#include <linux/mmzone.h> 11#include <linux/mmzone.h>
12#include <linux/rbtree.h> 12#include <linux/rbtree.h>
13#include <linux/prio_tree.h>
14#include <linux/atomic.h> 13#include <linux/atomic.h>
15#include <linux/debug_locks.h> 14#include <linux/debug_locks.h>
16#include <linux/mm_types.h> 15#include <linux/mm_types.h>
@@ -21,6 +20,7 @@
21 20
22struct mempolicy; 21struct mempolicy;
23struct anon_vma; 22struct anon_vma;
23struct anon_vma_chain;
24struct file_ra_state; 24struct file_ra_state;
25struct user_struct; 25struct user_struct;
26struct writeback_control; 26struct writeback_control;
@@ -70,6 +70,8 @@ extern unsigned int kobjsize(const void *objp);
70/* 70/*
71 * vm_flags in vm_area_struct, see mm_types.h. 71 * vm_flags in vm_area_struct, see mm_types.h.
72 */ 72 */
73#define VM_NONE 0x00000000
74
73#define VM_READ 0x00000001 /* currently active flags */ 75#define VM_READ 0x00000001 /* currently active flags */
74#define VM_WRITE 0x00000002 76#define VM_WRITE 0x00000002
75#define VM_EXEC 0x00000004 77#define VM_EXEC 0x00000004
@@ -82,16 +84,9 @@ extern unsigned int kobjsize(const void *objp);
82#define VM_MAYSHARE 0x00000080 84#define VM_MAYSHARE 0x00000080
83 85
84#define VM_GROWSDOWN 0x00000100 /* general info on the segment */ 86#define VM_GROWSDOWN 0x00000100 /* general info on the segment */
85#if defined(CONFIG_STACK_GROWSUP) || defined(CONFIG_IA64)
86#define VM_GROWSUP 0x00000200
87#else
88#define VM_GROWSUP 0x00000000
89#define VM_NOHUGEPAGE 0x00000200 /* MADV_NOHUGEPAGE marked this vma */
90#endif
91#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */ 87#define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */
92#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */ 88#define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */
93 89
94#define VM_EXECUTABLE 0x00001000
95#define VM_LOCKED 0x00002000 90#define VM_LOCKED 0x00002000
96#define VM_IO 0x00004000 /* Memory mapped I/O or similar */ 91#define VM_IO 0x00004000 /* Memory mapped I/O or similar */
97 92
@@ -101,25 +96,34 @@ extern unsigned int kobjsize(const void *objp);
101 96
102#define VM_DONTCOPY 0x00020000 /* Do not copy this vma on fork */ 97#define VM_DONTCOPY 0x00020000 /* Do not copy this vma on fork */
103#define VM_DONTEXPAND 0x00040000 /* Cannot expand with mremap() */ 98#define VM_DONTEXPAND 0x00040000 /* Cannot expand with mremap() */
104#define VM_RESERVED 0x00080000 /* Count as reserved_vm like IO */
105#define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */ 99#define VM_ACCOUNT 0x00100000 /* Is a VM accounted object */
106#define VM_NORESERVE 0x00200000 /* should the VM suppress accounting */ 100#define VM_NORESERVE 0x00200000 /* should the VM suppress accounting */
107#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */ 101#define VM_HUGETLB 0x00400000 /* Huge TLB Page VM */
108#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */ 102#define VM_NONLINEAR 0x00800000 /* Is non-linear (remap_file_pages) */
109#ifndef CONFIG_TRANSPARENT_HUGEPAGE 103#define VM_ARCH_1 0x01000000 /* Architecture-specific flag */
110#define VM_MAPPED_COPY 0x01000000 /* T if mapped copy of data (nommu mmap) */ 104#define VM_DONTDUMP 0x04000000 /* Do not include in the core dump */
111#else
112#define VM_HUGEPAGE 0x01000000 /* MADV_HUGEPAGE marked this vma */
113#endif
114#define VM_INSERTPAGE 0x02000000 /* The vma has had "vm_insert_page()" done on it */
115#define VM_NODUMP 0x04000000 /* Do not include in the core dump */
116 105
117#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */
118#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */ 106#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */
119#define VM_SAO 0x20000000 /* Strong Access Ordering (powerpc) */ 107#define VM_HUGEPAGE 0x20000000 /* MADV_HUGEPAGE marked this vma */
120#define VM_PFN_AT_MMAP 0x40000000 /* PFNMAP vma that is fully mapped at mmap time */ 108#define VM_NOHUGEPAGE 0x40000000 /* MADV_NOHUGEPAGE marked this vma */
121#define VM_MERGEABLE 0x80000000 /* KSM may merge identical pages */ 109#define VM_MERGEABLE 0x80000000 /* KSM may merge identical pages */
122 110
111#if defined(CONFIG_X86)
112# define VM_PAT VM_ARCH_1 /* PAT reserves whole VMA at once (x86) */
113#elif defined(CONFIG_PPC)
114# define VM_SAO VM_ARCH_1 /* Strong Access Ordering (powerpc) */
115#elif defined(CONFIG_PARISC)
116# define VM_GROWSUP VM_ARCH_1
117#elif defined(CONFIG_IA64)
118# define VM_GROWSUP VM_ARCH_1
119#elif !defined(CONFIG_MMU)
120# define VM_MAPPED_COPY VM_ARCH_1 /* T if mapped copy of data (nommu mmap) */
121#endif
122
123#ifndef VM_GROWSUP
124# define VM_GROWSUP VM_NONE
125#endif
126
123/* Bits set in the VMA until the stack is in its final location */ 127/* Bits set in the VMA until the stack is in its final location */
124#define VM_STACK_INCOMPLETE_SETUP (VM_RAND_READ | VM_SEQ_READ) 128#define VM_STACK_INCOMPLETE_SETUP (VM_RAND_READ | VM_SEQ_READ)
125 129
@@ -143,7 +147,7 @@ extern unsigned int kobjsize(const void *objp);
143 * Special vmas that are non-mergable, non-mlock()able. 147 * Special vmas that are non-mergable, non-mlock()able.
144 * Note: mm/huge_memory.c VM_NO_THP depends on this definition. 148 * Note: mm/huge_memory.c VM_NO_THP depends on this definition.
145 */ 149 */
146#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_RESERVED | VM_PFNMAP) 150#define VM_SPECIAL (VM_IO | VM_DONTEXPAND | VM_PFNMAP)
147 151
148/* 152/*
149 * mapping from the currently active vm_flags protection bits (the 153 * mapping from the currently active vm_flags protection bits (the
@@ -157,24 +161,7 @@ extern pgprot_t protection_map[16];
157#define FAULT_FLAG_ALLOW_RETRY 0x08 /* Retry fault if blocking */ 161#define FAULT_FLAG_ALLOW_RETRY 0x08 /* Retry fault if blocking */
158#define FAULT_FLAG_RETRY_NOWAIT 0x10 /* Don't drop mmap_sem and wait when retrying */ 162#define FAULT_FLAG_RETRY_NOWAIT 0x10 /* Don't drop mmap_sem and wait when retrying */
159#define FAULT_FLAG_KILLABLE 0x20 /* The fault task is in SIGKILL killable region */ 163#define FAULT_FLAG_KILLABLE 0x20 /* The fault task is in SIGKILL killable region */
160 164#define FAULT_FLAG_TRIED 0x40 /* second try */
161/*
162 * This interface is used by x86 PAT code to identify a pfn mapping that is
163 * linear over entire vma. This is to optimize PAT code that deals with
164 * marking the physical region with a particular prot. This is not for generic
165 * mm use. Note also that this check will not work if the pfn mapping is
166 * linear for a vma starting at physical address 0. In which case PAT code
167 * falls back to slow path of reserving physical range page by page.
168 */
169static inline int is_linear_pfn_mapping(struct vm_area_struct *vma)
170{
171 return !!(vma->vm_flags & VM_PFN_AT_MMAP);
172}
173
174static inline int is_pfn_mapping(struct vm_area_struct *vma)
175{
176 return !!(vma->vm_flags & VM_PFNMAP);
177}
178 165
179/* 166/*
180 * vm_fault is filled by the the pagefault handler and passed to the vma's 167 * vm_fault is filled by the the pagefault handler and passed to the vma's
@@ -182,8 +169,7 @@ static inline int is_pfn_mapping(struct vm_area_struct *vma)
182 * of VM_FAULT_xxx flags that give details about how the fault was handled. 169 * of VM_FAULT_xxx flags that give details about how the fault was handled.
183 * 170 *
184 * pgoff should be used in favour of virtual_address, if possible. If pgoff 171 * pgoff should be used in favour of virtual_address, if possible. If pgoff
185 * is used, one may set VM_CAN_NONLINEAR in the vma->vm_flags to get nonlinear 172 * is used, one may implement ->remap_pages to get nonlinear mapping support.
186 * mapping support.
187 */ 173 */
188struct vm_fault { 174struct vm_fault {
189 unsigned int flags; /* FAULT_FLAG_xxx flags */ 175 unsigned int flags; /* FAULT_FLAG_xxx flags */
@@ -241,6 +227,9 @@ struct vm_operations_struct {
241 int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from, 227 int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from,
242 const nodemask_t *to, unsigned long flags); 228 const nodemask_t *to, unsigned long flags);
243#endif 229#endif
230 /* called by sys_remap_file_pages() to populate non-linear mapping */
231 int (*remap_pages)(struct vm_area_struct *vma, unsigned long addr,
232 unsigned long size, pgoff_t pgoff);
244}; 233};
245 234
246struct mmu_gather; 235struct mmu_gather;
@@ -249,6 +238,18 @@ struct inode;
249#define page_private(page) ((page)->private) 238#define page_private(page) ((page)->private)
250#define set_page_private(page, v) ((page)->private = (v)) 239#define set_page_private(page, v) ((page)->private = (v))
251 240
241/* It's valid only if the page is free path or free_list */
242static inline void set_freepage_migratetype(struct page *page, int migratetype)
243{
244 page->index = migratetype;
245}
246
247/* It's valid only if the page is free path or free_list */
248static inline int get_freepage_migratetype(struct page *page)
249{
250 return page->index;
251}
252
252/* 253/*
253 * FIXME: take this include out, include page-flags.h in 254 * FIXME: take this include out, include page-flags.h in
254 * files which need it (119 of them) 255 * files which need it (119 of them)
@@ -454,6 +455,7 @@ void put_pages_list(struct list_head *pages);
454 455
455void split_page(struct page *page, unsigned int order); 456void split_page(struct page *page, unsigned int order);
456int split_free_page(struct page *page); 457int split_free_page(struct page *page);
458int capture_free_page(struct page *page, int alloc_order, int migratetype);
457 459
458/* 460/*
459 * Compound pages have a destructor function. Provide a 461 * Compound pages have a destructor function. Provide a
@@ -1071,7 +1073,8 @@ vm_is_stack(struct task_struct *task, struct vm_area_struct *vma, int in_group);
1071 1073
1072extern unsigned long move_page_tables(struct vm_area_struct *vma, 1074extern unsigned long move_page_tables(struct vm_area_struct *vma,
1073 unsigned long old_addr, struct vm_area_struct *new_vma, 1075 unsigned long old_addr, struct vm_area_struct *new_vma,
1074 unsigned long new_addr, unsigned long len); 1076 unsigned long new_addr, unsigned long len,
1077 bool need_rmap_locks);
1075extern unsigned long do_mremap(unsigned long addr, 1078extern unsigned long do_mremap(unsigned long addr,
1076 unsigned long old_len, unsigned long new_len, 1079 unsigned long old_len, unsigned long new_len,
1077 unsigned long flags, unsigned long new_addr); 1080 unsigned long flags, unsigned long new_addr);
@@ -1366,24 +1369,45 @@ extern void zone_pcp_reset(struct zone *zone);
1366extern atomic_long_t mmap_pages_allocated; 1369extern atomic_long_t mmap_pages_allocated;
1367extern int nommu_shrink_inode_mappings(struct inode *, size_t, size_t); 1370extern int nommu_shrink_inode_mappings(struct inode *, size_t, size_t);
1368 1371
1369/* prio_tree.c */ 1372/* interval_tree.c */
1370void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old); 1373void vma_interval_tree_insert(struct vm_area_struct *node,
1371void vma_prio_tree_insert(struct vm_area_struct *, struct prio_tree_root *); 1374 struct rb_root *root);
1372void vma_prio_tree_remove(struct vm_area_struct *, struct prio_tree_root *); 1375void vma_interval_tree_insert_after(struct vm_area_struct *node,
1373struct vm_area_struct *vma_prio_tree_next(struct vm_area_struct *vma, 1376 struct vm_area_struct *prev,
1374 struct prio_tree_iter *iter); 1377 struct rb_root *root);
1375 1378void vma_interval_tree_remove(struct vm_area_struct *node,
1376#define vma_prio_tree_foreach(vma, iter, root, begin, end) \ 1379 struct rb_root *root);
1377 for (prio_tree_iter_init(iter, root, begin, end), vma = NULL; \ 1380struct vm_area_struct *vma_interval_tree_iter_first(struct rb_root *root,
1378 (vma = vma_prio_tree_next(vma, iter)); ) 1381 unsigned long start, unsigned long last);
1382struct vm_area_struct *vma_interval_tree_iter_next(struct vm_area_struct *node,
1383 unsigned long start, unsigned long last);
1384
1385#define vma_interval_tree_foreach(vma, root, start, last) \
1386 for (vma = vma_interval_tree_iter_first(root, start, last); \
1387 vma; vma = vma_interval_tree_iter_next(vma, start, last))
1379 1388
1380static inline void vma_nonlinear_insert(struct vm_area_struct *vma, 1389static inline void vma_nonlinear_insert(struct vm_area_struct *vma,
1381 struct list_head *list) 1390 struct list_head *list)
1382{ 1391{
1383 vma->shared.vm_set.parent = NULL; 1392 list_add_tail(&vma->shared.nonlinear, list);
1384 list_add_tail(&vma->shared.vm_set.list, list);
1385} 1393}
1386 1394
1395void anon_vma_interval_tree_insert(struct anon_vma_chain *node,
1396 struct rb_root *root);
1397void anon_vma_interval_tree_remove(struct anon_vma_chain *node,
1398 struct rb_root *root);
1399struct anon_vma_chain *anon_vma_interval_tree_iter_first(
1400 struct rb_root *root, unsigned long start, unsigned long last);
1401struct anon_vma_chain *anon_vma_interval_tree_iter_next(
1402 struct anon_vma_chain *node, unsigned long start, unsigned long last);
1403#ifdef CONFIG_DEBUG_VM_RB
1404void anon_vma_interval_tree_verify(struct anon_vma_chain *node);
1405#endif
1406
1407#define anon_vma_interval_tree_foreach(avc, root, start, last) \
1408 for (avc = anon_vma_interval_tree_iter_first(root, start, last); \
1409 avc; avc = anon_vma_interval_tree_iter_next(avc, start, last))
1410
1387/* mmap.c */ 1411/* mmap.c */
1388extern int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin); 1412extern int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin);
1389extern int vma_adjust(struct vm_area_struct *vma, unsigned long start, 1413extern int vma_adjust(struct vm_area_struct *vma, unsigned long start,
@@ -1400,15 +1424,13 @@ extern void __vma_link_rb(struct mm_struct *, struct vm_area_struct *,
1400 struct rb_node **, struct rb_node *); 1424 struct rb_node **, struct rb_node *);
1401extern void unlink_file_vma(struct vm_area_struct *); 1425extern void unlink_file_vma(struct vm_area_struct *);
1402extern struct vm_area_struct *copy_vma(struct vm_area_struct **, 1426extern struct vm_area_struct *copy_vma(struct vm_area_struct **,
1403 unsigned long addr, unsigned long len, pgoff_t pgoff); 1427 unsigned long addr, unsigned long len, pgoff_t pgoff,
1428 bool *need_rmap_locks);
1404extern void exit_mmap(struct mm_struct *); 1429extern void exit_mmap(struct mm_struct *);
1405 1430
1406extern int mm_take_all_locks(struct mm_struct *mm); 1431extern int mm_take_all_locks(struct mm_struct *mm);
1407extern void mm_drop_all_locks(struct mm_struct *mm); 1432extern void mm_drop_all_locks(struct mm_struct *mm);
1408 1433
1409/* From fs/proc/base.c. callers must _not_ hold the mm's exe_file_lock */
1410extern void added_exe_file_vma(struct mm_struct *mm);
1411extern void removed_exe_file_vma(struct mm_struct *mm);
1412extern void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file); 1434extern void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file);
1413extern struct file *get_mm_exe_file(struct mm_struct *mm); 1435extern struct file *get_mm_exe_file(struct mm_struct *mm);
1414 1436
@@ -1662,5 +1684,9 @@ static inline unsigned int debug_guardpage_minorder(void) { return 0; }
1662static inline bool page_is_guard(struct page *page) { return false; } 1684static inline bool page_is_guard(struct page *page) { return false; }
1663#endif /* CONFIG_DEBUG_PAGEALLOC */ 1685#endif /* CONFIG_DEBUG_PAGEALLOC */
1664 1686
1687extern void reset_zone_present_pages(void);
1688extern void fixup_zone_present_pages(int nid, unsigned long start_pfn,
1689 unsigned long end_pfn);
1690
1665#endif /* __KERNEL__ */ 1691#endif /* __KERNEL__ */
1666#endif /* _LINUX_MM_H */ 1692#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index bf7867200b95..31f8a3af7d94 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -6,7 +6,6 @@
6#include <linux/threads.h> 6#include <linux/threads.h>
7#include <linux/list.h> 7#include <linux/list.h>
8#include <linux/spinlock.h> 8#include <linux/spinlock.h>
9#include <linux/prio_tree.h>
10#include <linux/rbtree.h> 9#include <linux/rbtree.h>
11#include <linux/rwsem.h> 10#include <linux/rwsem.h>
12#include <linux/completion.h> 11#include <linux/completion.h>
@@ -240,18 +239,15 @@ struct vm_area_struct {
240 239
241 /* 240 /*
242 * For areas with an address space and backing store, 241 * For areas with an address space and backing store,
243 * linkage into the address_space->i_mmap prio tree, or 242 * linkage into the address_space->i_mmap interval tree, or
244 * linkage to the list of like vmas hanging off its node, or
245 * linkage of vma in the address_space->i_mmap_nonlinear list. 243 * linkage of vma in the address_space->i_mmap_nonlinear list.
246 */ 244 */
247 union { 245 union {
248 struct { 246 struct {
249 struct list_head list; 247 struct rb_node rb;
250 void *parent; /* aligns with prio_tree_node parent */ 248 unsigned long rb_subtree_last;
251 struct vm_area_struct *head; 249 } linear;
252 } vm_set; 250 struct list_head nonlinear;
253
254 struct raw_prio_tree_node prio_tree_node;
255 } shared; 251 } shared;
256 252
257 /* 253 /*
@@ -349,7 +345,6 @@ struct mm_struct {
349 unsigned long shared_vm; /* Shared pages (files) */ 345 unsigned long shared_vm; /* Shared pages (files) */
350 unsigned long exec_vm; /* VM_EXEC & ~VM_WRITE */ 346 unsigned long exec_vm; /* VM_EXEC & ~VM_WRITE */
351 unsigned long stack_vm; /* VM_GROWSUP/DOWN */ 347 unsigned long stack_vm; /* VM_GROWSUP/DOWN */
352 unsigned long reserved_vm; /* VM_RESERVED|VM_IO pages */
353 unsigned long def_flags; 348 unsigned long def_flags;
354 unsigned long nr_ptes; /* Page table pages */ 349 unsigned long nr_ptes; /* Page table pages */
355 unsigned long start_code, end_code, start_data, end_data; 350 unsigned long start_code, end_code, start_data, end_data;
@@ -394,7 +389,6 @@ struct mm_struct {
394 389
395 /* store ref to file /proc/<pid>/exe symlink points to */ 390 /* store ref to file /proc/<pid>/exe symlink points to */
396 struct file *exe_file; 391 struct file *exe_file;
397 unsigned long num_exe_file_vmas;
398#ifdef CONFIG_MMU_NOTIFIER 392#ifdef CONFIG_MMU_NOTIFIER
399 struct mmu_notifier_mm *mmu_notifier_mm; 393 struct mmu_notifier_mm *mmu_notifier_mm;
400#endif 394#endif
diff --git a/include/linux/mman.h b/include/linux/mman.h
index 8b74e9b1d0ad..d09dde1e57fb 100644
--- a/include/linux/mman.h
+++ b/include/linux/mman.h
@@ -1,20 +1,11 @@
1#ifndef _LINUX_MMAN_H 1#ifndef _LINUX_MMAN_H
2#define _LINUX_MMAN_H 2#define _LINUX_MMAN_H
3 3
4#include <asm/mman.h>
5
6#define MREMAP_MAYMOVE 1
7#define MREMAP_FIXED 2
8
9#define OVERCOMMIT_GUESS 0
10#define OVERCOMMIT_ALWAYS 1
11#define OVERCOMMIT_NEVER 2
12
13#ifdef __KERNEL__
14#include <linux/mm.h> 4#include <linux/mm.h>
15#include <linux/percpu_counter.h> 5#include <linux/percpu_counter.h>
16 6
17#include <linux/atomic.h> 7#include <linux/atomic.h>
8#include <uapi/linux/mman.h>
18 9
19extern int sysctl_overcommit_memory; 10extern int sysctl_overcommit_memory;
20extern int sysctl_overcommit_ratio; 11extern int sysctl_overcommit_ratio;
@@ -86,8 +77,6 @@ calc_vm_flag_bits(unsigned long flags)
86{ 77{
87 return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) | 78 return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) |
88 _calc_vm_trans(flags, MAP_DENYWRITE, VM_DENYWRITE ) | 79 _calc_vm_trans(flags, MAP_DENYWRITE, VM_DENYWRITE ) |
89 _calc_vm_trans(flags, MAP_EXECUTABLE, VM_EXECUTABLE) |
90 _calc_vm_trans(flags, MAP_LOCKED, VM_LOCKED ); 80 _calc_vm_trans(flags, MAP_LOCKED, VM_LOCKED );
91} 81}
92#endif /* __KERNEL__ */
93#endif /* _LINUX_MMAN_H */ 82#endif /* _LINUX_MMAN_H */
diff --git a/include/linux/mmc/Kbuild b/include/linux/mmc/Kbuild
deleted file mode 100644
index 1fb26448faa9..000000000000
--- a/include/linux/mmc/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
1header-y += ioctl.h
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 4b27f9f503e4..943550dfe9ea 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -57,6 +57,7 @@ struct mmc_ext_csd {
57 unsigned int sa_timeout; /* Units: 100ns */ 57 unsigned int sa_timeout; /* Units: 100ns */
58 unsigned int generic_cmd6_time; /* Units: 10ms */ 58 unsigned int generic_cmd6_time; /* Units: 10ms */
59 unsigned int power_off_longtime; /* Units: ms */ 59 unsigned int power_off_longtime; /* Units: ms */
60 u8 power_off_notification; /* state */
60 unsigned int hs_max_dtr; 61 unsigned int hs_max_dtr;
61#define MMC_HIGH_26_MAX_DTR 26000000 62#define MMC_HIGH_26_MAX_DTR 26000000
62#define MMC_HIGH_52_MAX_DTR 52000000 63#define MMC_HIGH_52_MAX_DTR 52000000
@@ -76,10 +77,13 @@ struct mmc_ext_csd {
76 bool hpi_en; /* HPI enablebit */ 77 bool hpi_en; /* HPI enablebit */
77 bool hpi; /* HPI support bit */ 78 bool hpi; /* HPI support bit */
78 unsigned int hpi_cmd; /* cmd used as HPI */ 79 unsigned int hpi_cmd; /* cmd used as HPI */
80 bool bkops; /* background support bit */
81 bool bkops_en; /* background enable bit */
79 unsigned int data_sector_size; /* 512 bytes or 4KB */ 82 unsigned int data_sector_size; /* 512 bytes or 4KB */
80 unsigned int data_tag_unit_size; /* DATA TAG UNIT size */ 83 unsigned int data_tag_unit_size; /* DATA TAG UNIT size */
81 unsigned int boot_ro_lock; /* ro lock support */ 84 unsigned int boot_ro_lock; /* ro lock support */
82 bool boot_ro_lockable; 85 bool boot_ro_lockable;
86 u8 raw_exception_status; /* 53 */
83 u8 raw_partition_support; /* 160 */ 87 u8 raw_partition_support; /* 160 */
84 u8 raw_erased_mem_count; /* 181 */ 88 u8 raw_erased_mem_count; /* 181 */
85 u8 raw_ext_csd_structure; /* 194 */ 89 u8 raw_ext_csd_structure; /* 194 */
@@ -93,6 +97,7 @@ struct mmc_ext_csd {
93 u8 raw_sec_erase_mult; /* 230 */ 97 u8 raw_sec_erase_mult; /* 230 */
94 u8 raw_sec_feature_support;/* 231 */ 98 u8 raw_sec_feature_support;/* 231 */
95 u8 raw_trim_mult; /* 232 */ 99 u8 raw_trim_mult; /* 232 */
100 u8 raw_bkops_status; /* 246 */
96 u8 raw_sectors[4]; /* 212 - 4 bytes */ 101 u8 raw_sectors[4]; /* 212 - 4 bytes */
97 102
98 unsigned int feature_support; 103 unsigned int feature_support;
@@ -225,7 +230,7 @@ struct mmc_card {
225#define MMC_CARD_SDXC (1<<6) /* card is SDXC */ 230#define MMC_CARD_SDXC (1<<6) /* card is SDXC */
226#define MMC_CARD_REMOVED (1<<7) /* card has been removed */ 231#define MMC_CARD_REMOVED (1<<7) /* card has been removed */
227#define MMC_STATE_HIGHSPEED_200 (1<<8) /* card is in HS200 mode */ 232#define MMC_STATE_HIGHSPEED_200 (1<<8) /* card is in HS200 mode */
228#define MMC_STATE_SLEEP (1<<9) /* card is in sleep state */ 233#define MMC_STATE_DOING_BKOPS (1<<10) /* card is doing BKOPS */
229 unsigned int quirks; /* card quirks */ 234 unsigned int quirks; /* card quirks */
230#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ 235#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
231#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */ 236#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */
@@ -241,11 +246,6 @@ struct mmc_card {
241#define MMC_QUIRK_LONG_READ_TIME (1<<9) /* Data read time > CSD says */ 246#define MMC_QUIRK_LONG_READ_TIME (1<<9) /* Data read time > CSD says */
242#define MMC_QUIRK_SEC_ERASE_TRIM_BROKEN (1<<10) /* Skip secure for erase/trim */ 247#define MMC_QUIRK_SEC_ERASE_TRIM_BROKEN (1<<10) /* Skip secure for erase/trim */
243 /* byte mode */ 248 /* byte mode */
244 unsigned int poweroff_notify_state; /* eMMC4.5 notify feature */
245#define MMC_NO_POWER_NOTIFICATION 0
246#define MMC_POWERED_ON 1
247#define MMC_POWEROFF_SHORT 2
248#define MMC_POWEROFF_LONG 3
249 249
250 unsigned int erase_size; /* erase size in sectors */ 250 unsigned int erase_size; /* erase size in sectors */
251 unsigned int erase_shift; /* if erase unit is power 2 */ 251 unsigned int erase_shift; /* if erase unit is power 2 */
@@ -392,7 +392,7 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
392#define mmc_sd_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED) 392#define mmc_sd_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
393#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC) 393#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC)
394#define mmc_card_removed(c) ((c) && ((c)->state & MMC_CARD_REMOVED)) 394#define mmc_card_removed(c) ((c) && ((c)->state & MMC_CARD_REMOVED))
395#define mmc_card_is_sleep(c) ((c)->state & MMC_STATE_SLEEP) 395#define mmc_card_doing_bkops(c) ((c)->state & MMC_STATE_DOING_BKOPS)
396 396
397#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) 397#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
398#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) 398#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
@@ -404,9 +404,9 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
404#define mmc_sd_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED) 404#define mmc_sd_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED)
405#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC) 405#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC)
406#define mmc_card_set_removed(c) ((c)->state |= MMC_CARD_REMOVED) 406#define mmc_card_set_removed(c) ((c)->state |= MMC_CARD_REMOVED)
407#define mmc_card_set_sleep(c) ((c)->state |= MMC_STATE_SLEEP) 407#define mmc_card_set_doing_bkops(c) ((c)->state |= MMC_STATE_DOING_BKOPS)
408#define mmc_card_clr_doing_bkops(c) ((c)->state &= ~MMC_STATE_DOING_BKOPS)
408 409
409#define mmc_card_clr_sleep(c) ((c)->state &= ~MMC_STATE_SLEEP)
410/* 410/*
411 * Quirk add/remove for MMC products. 411 * Quirk add/remove for MMC products.
412 */ 412 */
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 1b431c728b9a..9b9cdafc7737 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -134,6 +134,8 @@ struct mmc_host;
134struct mmc_card; 134struct mmc_card;
135struct mmc_async_req; 135struct mmc_async_req;
136 136
137extern int mmc_stop_bkops(struct mmc_card *);
138extern int mmc_read_bkops_status(struct mmc_card *);
137extern struct mmc_async_req *mmc_start_req(struct mmc_host *, 139extern struct mmc_async_req *mmc_start_req(struct mmc_host *,
138 struct mmc_async_req *, int *); 140 struct mmc_async_req *, int *);
139extern int mmc_interrupt_hpi(struct mmc_card *); 141extern int mmc_interrupt_hpi(struct mmc_card *);
@@ -142,6 +144,8 @@ extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
142extern int mmc_app_cmd(struct mmc_host *, struct mmc_card *); 144extern int mmc_app_cmd(struct mmc_host *, struct mmc_card *);
143extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *, 145extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
144 struct mmc_command *, int); 146 struct mmc_command *, int);
147extern void mmc_start_bkops(struct mmc_card *card, bool from_exception);
148extern int __mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int, bool);
145extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int); 149extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int);
146 150
147#define MMC_ERASE_ARG 0x00000000 151#define MMC_ERASE_ARG 0x00000000
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 7a7ebd367cfd..7c6a1139d8fa 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -78,6 +78,10 @@ struct mmc_data;
78 * @data_offset: Set the offset of DATA register according to VERID. 78 * @data_offset: Set the offset of DATA register according to VERID.
79 * @dev: Device associated with the MMC controller. 79 * @dev: Device associated with the MMC controller.
80 * @pdata: Platform data associated with the MMC controller. 80 * @pdata: Platform data associated with the MMC controller.
81 * @drv_data: Driver specific data for identified variant of the controller
82 * @priv: Implementation defined private data.
83 * @biu_clk: Pointer to bus interface unit clock instance.
84 * @ciu_clk: Pointer to card interface unit clock instance.
81 * @slot: Slots sharing this MMC controller. 85 * @slot: Slots sharing this MMC controller.
82 * @fifo_depth: depth of FIFO. 86 * @fifo_depth: depth of FIFO.
83 * @data_shift: log2 of FIFO item size. 87 * @data_shift: log2 of FIFO item size.
@@ -156,8 +160,12 @@ struct dw_mci {
156 u32 fifoth_val; 160 u32 fifoth_val;
157 u16 verid; 161 u16 verid;
158 u16 data_offset; 162 u16 data_offset;
159 struct device dev; 163 struct device *dev;
160 struct dw_mci_board *pdata; 164 struct dw_mci_board *pdata;
165 struct dw_mci_drv_data *drv_data;
166 void *priv;
167 struct clk *biu_clk;
168 struct clk *ciu_clk;
161 struct dw_mci_slot *slot[MAX_MCI_SLOTS]; 169 struct dw_mci_slot *slot[MAX_MCI_SLOTS];
162 170
163 /* FIFO push and pull */ 171 /* FIFO push and pull */
@@ -201,7 +209,8 @@ struct dw_mci_dma_ops {
201#define DW_MCI_QUIRK_HIGHSPEED BIT(2) 209#define DW_MCI_QUIRK_HIGHSPEED BIT(2)
202/* Unreliable card detection */ 210/* Unreliable card detection */
203#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3) 211#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3)
204 212/* Write Protect detection not available */
213#define DW_MCI_QUIRK_NO_WRITE_PROTECT BIT(4)
205 214
206struct dma_pdata; 215struct dma_pdata;
207 216
@@ -218,7 +227,7 @@ struct dw_mci_board {
218 u32 num_slots; 227 u32 num_slots;
219 228
220 u32 quirks; /* Workaround / Quirk flags */ 229 u32 quirks; /* Workaround / Quirk flags */
221 unsigned int bus_hz; /* Bus speed */ 230 unsigned int bus_hz; /* Clock speed at the cclk_in pad */
222 231
223 unsigned int caps; /* Capabilities */ 232 unsigned int caps; /* Capabilities */
224 unsigned int caps2; /* More capabilities */ 233 unsigned int caps2; /* More capabilities */
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index f578a71d82a6..7abb0e1f7bda 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -259,10 +259,6 @@ struct mmc_host {
259#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */ 259#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */
260 260
261 mmc_pm_flag_t pm_caps; /* supported pm features */ 261 mmc_pm_flag_t pm_caps; /* supported pm features */
262 unsigned int power_notify_type;
263#define MMC_HOST_PW_NOTIFY_NONE 0
264#define MMC_HOST_PW_NOTIFY_SHORT 1
265#define MMC_HOST_PW_NOTIFY_LONG 2
266 262
267#ifdef CONFIG_MMC_CLKGATE 263#ifdef CONFIG_MMC_CLKGATE
268 int clk_requests; /* internal reference counter */ 264 int clk_requests; /* internal reference counter */
@@ -300,6 +296,7 @@ struct mmc_host {
300#endif 296#endif
301 297
302 int rescan_disable; /* disable card detection */ 298 int rescan_disable; /* disable card detection */
299 int rescan_entered; /* used with nonremovable devices */
303 300
304 struct mmc_card *card; /* device attached to this host */ 301 struct mmc_card *card; /* device attached to this host */
305 302
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index d425cab144d9..01e4b394029b 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -139,6 +139,7 @@ static inline bool mmc_op_multi(u32 opcode)
139#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */ 139#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */
140#define R1_READY_FOR_DATA (1 << 8) /* sx, a */ 140#define R1_READY_FOR_DATA (1 << 8) /* sx, a */
141#define R1_SWITCH_ERROR (1 << 7) /* sx, c */ 141#define R1_SWITCH_ERROR (1 << 7) /* sx, c */
142#define R1_EXCEPTION_EVENT (1 << 6) /* sx, a */
142#define R1_APP_CMD (1 << 5) /* sr, c */ 143#define R1_APP_CMD (1 << 5) /* sr, c */
143 144
144#define R1_STATE_IDLE 0 145#define R1_STATE_IDLE 0
@@ -274,12 +275,15 @@ struct _mmc_csd {
274#define EXT_CSD_FLUSH_CACHE 32 /* W */ 275#define EXT_CSD_FLUSH_CACHE 32 /* W */
275#define EXT_CSD_CACHE_CTRL 33 /* R/W */ 276#define EXT_CSD_CACHE_CTRL 33 /* R/W */
276#define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */ 277#define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */
278#define EXT_CSD_EXP_EVENTS_STATUS 54 /* RO */
277#define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */ 279#define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */
278#define EXT_CSD_GP_SIZE_MULT 143 /* R/W */ 280#define EXT_CSD_GP_SIZE_MULT 143 /* R/W */
279#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ 281#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */
280#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */ 282#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */
281#define EXT_CSD_HPI_MGMT 161 /* R/W */ 283#define EXT_CSD_HPI_MGMT 161 /* R/W */
282#define EXT_CSD_RST_N_FUNCTION 162 /* R/W */ 284#define EXT_CSD_RST_N_FUNCTION 162 /* R/W */
285#define EXT_CSD_BKOPS_EN 163 /* R/W */
286#define EXT_CSD_BKOPS_START 164 /* W */
283#define EXT_CSD_SANITIZE_START 165 /* W */ 287#define EXT_CSD_SANITIZE_START 165 /* W */
284#define EXT_CSD_WR_REL_PARAM 166 /* RO */ 288#define EXT_CSD_WR_REL_PARAM 166 /* RO */
285#define EXT_CSD_BOOT_WP 173 /* R/W */ 289#define EXT_CSD_BOOT_WP 173 /* R/W */
@@ -313,11 +317,13 @@ struct _mmc_csd {
313#define EXT_CSD_PWR_CL_200_360 237 /* RO */ 317#define EXT_CSD_PWR_CL_200_360 237 /* RO */
314#define EXT_CSD_PWR_CL_DDR_52_195 238 /* RO */ 318#define EXT_CSD_PWR_CL_DDR_52_195 238 /* RO */
315#define EXT_CSD_PWR_CL_DDR_52_360 239 /* RO */ 319#define EXT_CSD_PWR_CL_DDR_52_360 239 /* RO */
320#define EXT_CSD_BKOPS_STATUS 246 /* RO */
316#define EXT_CSD_POWER_OFF_LONG_TIME 247 /* RO */ 321#define EXT_CSD_POWER_OFF_LONG_TIME 247 /* RO */
317#define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */ 322#define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */
318#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */ 323#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */
319#define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */ 324#define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */
320#define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */ 325#define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */
326#define EXT_CSD_BKOPS_SUPPORT 502 /* RO */
321#define EXT_CSD_HPI_FEATURES 503 /* RO */ 327#define EXT_CSD_HPI_FEATURES 503 /* RO */
322 328
323/* 329/*
@@ -378,6 +384,19 @@ struct _mmc_csd {
378#define EXT_CSD_PWR_CL_8BIT_SHIFT 4 384#define EXT_CSD_PWR_CL_8BIT_SHIFT 4
379#define EXT_CSD_PWR_CL_4BIT_SHIFT 0 385#define EXT_CSD_PWR_CL_4BIT_SHIFT 0
380/* 386/*
387 * EXCEPTION_EVENT_STATUS field
388 */
389#define EXT_CSD_URGENT_BKOPS BIT(0)
390#define EXT_CSD_DYNCAP_NEEDED BIT(1)
391#define EXT_CSD_SYSPOOL_EXHAUSTED BIT(2)
392#define EXT_CSD_PACKED_FAILURE BIT(3)
393
394/*
395 * BKOPS status level
396 */
397#define EXT_CSD_BKOPS_LEVEL_2 0x2
398
399/*
381 * MMC_SWITCH access modes 400 * MMC_SWITCH access modes
382 */ 401 */
383 402
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index ac83b105bedd..fa8529a859b8 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -97,7 +97,8 @@ struct sdhci_host {
97 97
98 const struct sdhci_ops *ops; /* Low level hw interface */ 98 const struct sdhci_ops *ops; /* Low level hw interface */
99 99
100 struct regulator *vmmc; /* Power regulator */ 100 struct regulator *vmmc; /* Power regulator (vmmc) */
101 struct regulator *vqmmc; /* Signaling regulator (vccq) */
101 102
102 /* Internal data */ 103 /* Internal data */
103 struct mmc_host *mmc; /* MMC structure */ 104 struct mmc_host *mmc; /* MMC structure */
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index 1d1b1e13f79f..bc823c4c028b 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -4,6 +4,7 @@
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/spinlock.h> 5#include <linux/spinlock.h>
6#include <linux/mm_types.h> 6#include <linux/mm_types.h>
7#include <linux/srcu.h>
7 8
8struct mmu_notifier; 9struct mmu_notifier;
9struct mmu_notifier_ops; 10struct mmu_notifier_ops;
@@ -245,50 +246,6 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
245 __mmu_notifier_mm_destroy(mm); 246 __mmu_notifier_mm_destroy(mm);
246} 247}
247 248
248/*
249 * These two macros will sometime replace ptep_clear_flush.
250 * ptep_clear_flush is implemented as macro itself, so this also is
251 * implemented as a macro until ptep_clear_flush will converted to an
252 * inline function, to diminish the risk of compilation failure. The
253 * invalidate_page method over time can be moved outside the PT lock
254 * and these two macros can be later removed.
255 */
256#define ptep_clear_flush_notify(__vma, __address, __ptep) \
257({ \
258 pte_t __pte; \
259 struct vm_area_struct *___vma = __vma; \
260 unsigned long ___address = __address; \
261 __pte = ptep_clear_flush(___vma, ___address, __ptep); \
262 mmu_notifier_invalidate_page(___vma->vm_mm, ___address); \
263 __pte; \
264})
265
266#define pmdp_clear_flush_notify(__vma, __address, __pmdp) \
267({ \
268 pmd_t __pmd; \
269 struct vm_area_struct *___vma = __vma; \
270 unsigned long ___address = __address; \
271 VM_BUG_ON(__address & ~HPAGE_PMD_MASK); \
272 mmu_notifier_invalidate_range_start(___vma->vm_mm, ___address, \
273 (__address)+HPAGE_PMD_SIZE);\
274 __pmd = pmdp_clear_flush(___vma, ___address, __pmdp); \
275 mmu_notifier_invalidate_range_end(___vma->vm_mm, ___address, \
276 (__address)+HPAGE_PMD_SIZE); \
277 __pmd; \
278})
279
280#define pmdp_splitting_flush_notify(__vma, __address, __pmdp) \
281({ \
282 struct vm_area_struct *___vma = __vma; \
283 unsigned long ___address = __address; \
284 VM_BUG_ON(__address & ~HPAGE_PMD_MASK); \
285 mmu_notifier_invalidate_range_start(___vma->vm_mm, ___address, \
286 (__address)+HPAGE_PMD_SIZE);\
287 pmdp_splitting_flush(___vma, ___address, __pmdp); \
288 mmu_notifier_invalidate_range_end(___vma->vm_mm, ___address, \
289 (__address)+HPAGE_PMD_SIZE); \
290})
291
292#define ptep_clear_flush_young_notify(__vma, __address, __ptep) \ 249#define ptep_clear_flush_young_notify(__vma, __address, __ptep) \
293({ \ 250({ \
294 int __young; \ 251 int __young; \
@@ -311,14 +268,24 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
311 __young; \ 268 __young; \
312}) 269})
313 270
271/*
272 * set_pte_at_notify() sets the pte _after_ running the notifier.
273 * This is safe to start by updating the secondary MMUs, because the primary MMU
274 * pte invalidate must have already happened with a ptep_clear_flush() before
275 * set_pte_at_notify() has been invoked. Updating the secondary MMUs first is
276 * required when we change both the protection of the mapping from read-only to
277 * read-write and the pfn (like during copy on write page faults). Otherwise the
278 * old page would remain mapped readonly in the secondary MMUs after the new
279 * page is already writable by some CPU through the primary MMU.
280 */
314#define set_pte_at_notify(__mm, __address, __ptep, __pte) \ 281#define set_pte_at_notify(__mm, __address, __ptep, __pte) \
315({ \ 282({ \
316 struct mm_struct *___mm = __mm; \ 283 struct mm_struct *___mm = __mm; \
317 unsigned long ___address = __address; \ 284 unsigned long ___address = __address; \
318 pte_t ___pte = __pte; \ 285 pte_t ___pte = __pte; \
319 \ 286 \
320 set_pte_at(___mm, ___address, __ptep, ___pte); \
321 mmu_notifier_change_pte(___mm, ___address, ___pte); \ 287 mmu_notifier_change_pte(___mm, ___address, ___pte); \
288 set_pte_at(___mm, ___address, __ptep, ___pte); \
322}) 289})
323 290
324#else /* CONFIG_MMU_NOTIFIER */ 291#else /* CONFIG_MMU_NOTIFIER */
@@ -369,9 +336,6 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
369 336
370#define ptep_clear_flush_young_notify ptep_clear_flush_young 337#define ptep_clear_flush_young_notify ptep_clear_flush_young
371#define pmdp_clear_flush_young_notify pmdp_clear_flush_young 338#define pmdp_clear_flush_young_notify pmdp_clear_flush_young
372#define ptep_clear_flush_notify ptep_clear_flush
373#define pmdp_clear_flush_notify pmdp_clear_flush
374#define pmdp_splitting_flush_notify pmdp_splitting_flush
375#define set_pte_at_notify set_pte_at 339#define set_pte_at_notify set_pte_at
376 340
377#endif /* CONFIG_MMU_NOTIFIER */ 341#endif /* CONFIG_MMU_NOTIFIER */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 2daa54f55db7..50aaca81f63d 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -142,6 +142,7 @@ enum zone_stat_item {
142 NUMA_OTHER, /* allocation from other node */ 142 NUMA_OTHER, /* allocation from other node */
143#endif 143#endif
144 NR_ANON_TRANSPARENT_HUGEPAGES, 144 NR_ANON_TRANSPARENT_HUGEPAGES,
145 NR_FREE_CMA_PAGES,
145 NR_VM_ZONE_STAT_ITEMS }; 146 NR_VM_ZONE_STAT_ITEMS };
146 147
147/* 148/*
@@ -217,6 +218,8 @@ struct lruvec {
217#define ISOLATE_UNMAPPED ((__force isolate_mode_t)0x2) 218#define ISOLATE_UNMAPPED ((__force isolate_mode_t)0x2)
218/* Isolate for asynchronous migration */ 219/* Isolate for asynchronous migration */
219#define ISOLATE_ASYNC_MIGRATE ((__force isolate_mode_t)0x4) 220#define ISOLATE_ASYNC_MIGRATE ((__force isolate_mode_t)0x4)
221/* Isolate unevictable pages */
222#define ISOLATE_UNEVICTABLE ((__force isolate_mode_t)0x8)
220 223
221/* LRU Isolation modes. */ 224/* LRU Isolation modes. */
222typedef unsigned __bitwise__ isolate_mode_t; 225typedef unsigned __bitwise__ isolate_mode_t;
@@ -369,8 +372,12 @@ struct zone {
369 spinlock_t lock; 372 spinlock_t lock;
370 int all_unreclaimable; /* All pages pinned */ 373 int all_unreclaimable; /* All pages pinned */
371#if defined CONFIG_COMPACTION || defined CONFIG_CMA 374#if defined CONFIG_COMPACTION || defined CONFIG_CMA
372 /* pfn where the last incremental compaction isolated free pages */ 375 /* Set to true when the PG_migrate_skip bits should be cleared */
376 bool compact_blockskip_flush;
377
378 /* pfns where compaction scanners should start */
373 unsigned long compact_cached_free_pfn; 379 unsigned long compact_cached_free_pfn;
380 unsigned long compact_cached_migrate_pfn;
374#endif 381#endif
375#ifdef CONFIG_MEMORY_HOTPLUG 382#ifdef CONFIG_MEMORY_HOTPLUG
376 /* see spanned/present_pages for more description */ 383 /* see spanned/present_pages for more description */
@@ -704,6 +711,7 @@ typedef struct pglist_data {
704 unsigned long node_spanned_pages; /* total size of physical page 711 unsigned long node_spanned_pages; /* total size of physical page
705 range, including holes */ 712 range, including holes */
706 int node_id; 713 int node_id;
714 nodemask_t reclaim_nodes; /* Nodes allowed to reclaim from */
707 wait_queue_head_t kswapd_wait; 715 wait_queue_head_t kswapd_wait;
708 wait_queue_head_t pfmemalloc_wait; 716 wait_queue_head_t pfmemalloc_wait;
709 struct task_struct *kswapd; /* Protected by lock_memory_hotplug() */ 717 struct task_struct *kswapd; /* Protected by lock_memory_hotplug() */
diff --git a/include/linux/module.h b/include/linux/module.h
index fbcafe2ee13e..7760c6d344a3 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -21,6 +21,9 @@
21#include <linux/percpu.h> 21#include <linux/percpu.h>
22#include <asm/module.h> 22#include <asm/module.h>
23 23
24/* In stripped ARM and x86-64 modules, ~ is surprisingly rare. */
25#define MODULE_SIG_STRING "~Module signature appended~\n"
26
24/* Not Yet Implemented */ 27/* Not Yet Implemented */
25#define MODULE_SUPPORTED_DEVICE(name) 28#define MODULE_SUPPORTED_DEVICE(name)
26 29
@@ -260,6 +263,11 @@ struct module
260 const unsigned long *unused_gpl_crcs; 263 const unsigned long *unused_gpl_crcs;
261#endif 264#endif
262 265
266#ifdef CONFIG_MODULE_SIG
267 /* Signature was verified. */
268 bool sig_ok;
269#endif
270
263 /* symbols that will be GPL-only in the near future. */ 271 /* symbols that will be GPL-only in the near future. */
264 const struct kernel_symbol *gpl_future_syms; 272 const struct kernel_symbol *gpl_future_syms;
265 const unsigned long *gpl_future_crcs; 273 const unsigned long *gpl_future_crcs;
diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h
index b2be02ebf453..560ca53a75fa 100644
--- a/include/linux/moduleloader.h
+++ b/include/linux/moduleloader.h
@@ -28,21 +28,49 @@ void *module_alloc(unsigned long size);
28/* Free memory returned from module_alloc. */ 28/* Free memory returned from module_alloc. */
29void module_free(struct module *mod, void *module_region); 29void module_free(struct module *mod, void *module_region);
30 30
31/* Apply the given relocation to the (simplified) ELF. Return -error 31/*
32 or 0. */ 32 * Apply the given relocation to the (simplified) ELF. Return -error
33 * or 0.
34 */
35#ifdef CONFIG_MODULES_USE_ELF_REL
33int apply_relocate(Elf_Shdr *sechdrs, 36int apply_relocate(Elf_Shdr *sechdrs,
34 const char *strtab, 37 const char *strtab,
35 unsigned int symindex, 38 unsigned int symindex,
36 unsigned int relsec, 39 unsigned int relsec,
37 struct module *mod); 40 struct module *mod);
41#else
42static inline int apply_relocate(Elf_Shdr *sechdrs,
43 const char *strtab,
44 unsigned int symindex,
45 unsigned int relsec,
46 struct module *me)
47{
48 printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
49 return -ENOEXEC;
50}
51#endif
38 52
39/* Apply the given add relocation to the (simplified) ELF. Return 53/*
40 -error or 0 */ 54 * Apply the given add relocation to the (simplified) ELF. Return
55 * -error or 0
56 */
57#ifdef CONFIG_MODULES_USE_ELF_RELA
41int apply_relocate_add(Elf_Shdr *sechdrs, 58int apply_relocate_add(Elf_Shdr *sechdrs,
42 const char *strtab, 59 const char *strtab,
43 unsigned int symindex, 60 unsigned int symindex,
44 unsigned int relsec, 61 unsigned int relsec,
45 struct module *mod); 62 struct module *mod);
63#else
64static inline int apply_relocate_add(Elf_Shdr *sechdrs,
65 const char *strtab,
66 unsigned int symindex,
67 unsigned int relsec,
68 struct module *me)
69{
70 printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
71 return -ENOEXEC;
72}
73#endif
46 74
47/* Any final processing of module before access. Return -error or 0. */ 75/* Any final processing of module before access. Return -error or 0. */
48int module_finalize(const Elf_Ehdr *hdr, 76int module_finalize(const Elf_Ehdr *hdr,
diff --git a/include/linux/mpi.h b/include/linux/mpi.h
index d02cca6cc8ce..5af1b81def49 100644
--- a/include/linux/mpi.h
+++ b/include/linux/mpi.h
@@ -76,6 +76,7 @@ void mpi_swap(MPI a, MPI b);
76 76
77/*-- mpicoder.c --*/ 77/*-- mpicoder.c --*/
78MPI do_encode_md(const void *sha_buffer, unsigned nbits); 78MPI do_encode_md(const void *sha_buffer, unsigned nbits);
79MPI mpi_read_raw_data(const void *xbuffer, size_t nbytes);
79MPI mpi_read_from_buffer(const void *buffer, unsigned *ret_nread); 80MPI mpi_read_from_buffer(const void *buffer, unsigned *ret_nread);
80int mpi_fromstr(MPI val, const char *str); 81int mpi_fromstr(MPI val, const char *str);
81u32 mpi_get_keyid(MPI a, u32 *keyid); 82u32 mpi_get_keyid(MPI a, u32 *keyid);
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index 46caaf44339d..ea00d9162ee5 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -1,138 +1,10 @@
1#ifndef __LINUX_MROUTE_H 1#ifndef __LINUX_MROUTE_H
2#define __LINUX_MROUTE_H 2#define __LINUX_MROUTE_H
3 3
4#include <linux/sockios.h>
5#include <linux/types.h>
6#ifdef __KERNEL__
7#include <linux/in.h> 4#include <linux/in.h>
8#endif
9
10/*
11 * Based on the MROUTING 3.5 defines primarily to keep
12 * source compatibility with BSD.
13 *
14 * See the mrouted code for the original history.
15 *
16 * Protocol Independent Multicast (PIM) data structures included
17 * Carlos Picoto (cap@di.fc.ul.pt)
18 *
19 */
20
21#define MRT_BASE 200
22#define MRT_INIT (MRT_BASE) /* Activate the kernel mroute code */
23#define MRT_DONE (MRT_BASE+1) /* Shutdown the kernel mroute */
24#define MRT_ADD_VIF (MRT_BASE+2) /* Add a virtual interface */
25#define MRT_DEL_VIF (MRT_BASE+3) /* Delete a virtual interface */
26#define MRT_ADD_MFC (MRT_BASE+4) /* Add a multicast forwarding entry */
27#define MRT_DEL_MFC (MRT_BASE+5) /* Delete a multicast forwarding entry */
28#define MRT_VERSION (MRT_BASE+6) /* Get the kernel multicast version */
29#define MRT_ASSERT (MRT_BASE+7) /* Activate PIM assert mode */
30#define MRT_PIM (MRT_BASE+8) /* enable PIM code */
31#define MRT_TABLE (MRT_BASE+9) /* Specify mroute table ID */
32
33#define SIOCGETVIFCNT SIOCPROTOPRIVATE /* IP protocol privates */
34#define SIOCGETSGCNT (SIOCPROTOPRIVATE+1)
35#define SIOCGETRPF (SIOCPROTOPRIVATE+2)
36
37#define MAXVIFS 32
38typedef unsigned long vifbitmap_t; /* User mode code depends on this lot */
39typedef unsigned short vifi_t;
40#define ALL_VIFS ((vifi_t)(-1))
41
42/*
43 * Same idea as select
44 */
45
46#define VIFM_SET(n,m) ((m)|=(1<<(n)))
47#define VIFM_CLR(n,m) ((m)&=~(1<<(n)))
48#define VIFM_ISSET(n,m) ((m)&(1<<(n)))
49#define VIFM_CLRALL(m) ((m)=0)
50#define VIFM_COPY(mfrom,mto) ((mto)=(mfrom))
51#define VIFM_SAME(m1,m2) ((m1)==(m2))
52
53/*
54 * Passed by mrouted for an MRT_ADD_VIF - again we use the
55 * mrouted 3.6 structures for compatibility
56 */
57
58struct vifctl {
59 vifi_t vifc_vifi; /* Index of VIF */
60 unsigned char vifc_flags; /* VIFF_ flags */
61 unsigned char vifc_threshold; /* ttl limit */
62 unsigned int vifc_rate_limit; /* Rate limiter values (NI) */
63 union {
64 struct in_addr vifc_lcl_addr; /* Local interface address */
65 int vifc_lcl_ifindex; /* Local interface index */
66 };
67 struct in_addr vifc_rmt_addr; /* IPIP tunnel addr */
68};
69
70#define VIFF_TUNNEL 0x1 /* IPIP tunnel */
71#define VIFF_SRCRT 0x2 /* NI */
72#define VIFF_REGISTER 0x4 /* register vif */
73#define VIFF_USE_IFINDEX 0x8 /* use vifc_lcl_ifindex instead of
74 vifc_lcl_addr to find an interface */
75
76/*
77 * Cache manipulation structures for mrouted and PIMd
78 */
79
80struct mfcctl {
81 struct in_addr mfcc_origin; /* Origin of mcast */
82 struct in_addr mfcc_mcastgrp; /* Group in question */
83 vifi_t mfcc_parent; /* Where it arrived */
84 unsigned char mfcc_ttls[MAXVIFS]; /* Where it is going */
85 unsigned int mfcc_pkt_cnt; /* pkt count for src-grp */
86 unsigned int mfcc_byte_cnt;
87 unsigned int mfcc_wrong_if;
88 int mfcc_expire;
89};
90
91/*
92 * Group count retrieval for mrouted
93 */
94
95struct sioc_sg_req {
96 struct in_addr src;
97 struct in_addr grp;
98 unsigned long pktcnt;
99 unsigned long bytecnt;
100 unsigned long wrong_if;
101};
102
103/*
104 * To get vif packet counts
105 */
106
107struct sioc_vif_req {
108 vifi_t vifi; /* Which iface */
109 unsigned long icount; /* In packets */
110 unsigned long ocount; /* Out packets */
111 unsigned long ibytes; /* In bytes */
112 unsigned long obytes; /* Out bytes */
113};
114
115/*
116 * This is the format the mroute daemon expects to see IGMP control
117 * data. Magically happens to be like an IP packet as per the original
118 */
119
120struct igmpmsg {
121 __u32 unused1,unused2;
122 unsigned char im_msgtype; /* What is this */
123 unsigned char im_mbz; /* Must be zero */
124 unsigned char im_vif; /* Interface (this ought to be a vifi_t!) */
125 unsigned char unused3;
126 struct in_addr im_src,im_dst;
127};
128
129/*
130 * That's all usermode folks
131 */
132
133#ifdef __KERNEL__
134#include <linux/pim.h> 5#include <linux/pim.h>
135#include <net/sock.h> 6#include <net/sock.h>
7#include <uapi/linux/mroute.h>
136 8
137#ifdef CONFIG_IP_MROUTE 9#ifdef CONFIG_IP_MROUTE
138static inline int ip_mroute_opt(int opt) 10static inline int ip_mroute_opt(int opt)
@@ -228,24 +100,8 @@ struct mfc_cache {
228#define MFC_HASH(a,b) ((((__force u32)(__be32)a)^(((__force u32)(__be32)b)>>2))&(MFC_LINES-1)) 100#define MFC_HASH(a,b) ((((__force u32)(__be32)a)^(((__force u32)(__be32)b)>>2))&(MFC_LINES-1))
229#endif 101#endif
230 102
231#endif
232
233
234#define MFC_ASSERT_THRESH (3*HZ) /* Maximal freq. of asserts */
235
236/*
237 * Pseudo messages used by mrouted
238 */
239
240#define IGMPMSG_NOCACHE 1 /* Kern cache fill request to mrouted */
241#define IGMPMSG_WRONGVIF 2 /* For PIM assert processing (unused) */
242#define IGMPMSG_WHOLEPKT 3 /* For PIM Register processing */
243
244#ifdef __KERNEL__
245struct rtmsg; 103struct rtmsg;
246extern int ipmr_get_route(struct net *net, struct sk_buff *skb, 104extern int ipmr_get_route(struct net *net, struct sk_buff *skb,
247 __be32 saddr, __be32 daddr, 105 __be32 saddr, __be32 daddr,
248 struct rtmsg *rtm, int nowait); 106 struct rtmsg *rtm, int nowait);
249#endif 107#endif
250
251#endif
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index 6d8c7251eb8d..a223561ba12e 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -1,123 +1,11 @@
1#ifndef __LINUX_MROUTE6_H 1#ifndef __LINUX_MROUTE6_H
2#define __LINUX_MROUTE6_H 2#define __LINUX_MROUTE6_H
3 3
4#include <linux/types.h>
5#include <linux/sockios.h>
6
7/*
8 * Based on the MROUTING 3.5 defines primarily to keep
9 * source compatibility with BSD.
10 *
11 * See the pim6sd code for the original history.
12 *
13 * Protocol Independent Multicast (PIM) data structures included
14 * Carlos Picoto (cap@di.fc.ul.pt)
15 *
16 */
17
18#define MRT6_BASE 200
19#define MRT6_INIT (MRT6_BASE) /* Activate the kernel mroute code */
20#define MRT6_DONE (MRT6_BASE+1) /* Shutdown the kernel mroute */
21#define MRT6_ADD_MIF (MRT6_BASE+2) /* Add a virtual interface */
22#define MRT6_DEL_MIF (MRT6_BASE+3) /* Delete a virtual interface */
23#define MRT6_ADD_MFC (MRT6_BASE+4) /* Add a multicast forwarding entry */
24#define MRT6_DEL_MFC (MRT6_BASE+5) /* Delete a multicast forwarding entry */
25#define MRT6_VERSION (MRT6_BASE+6) /* Get the kernel multicast version */
26#define MRT6_ASSERT (MRT6_BASE+7) /* Activate PIM assert mode */
27#define MRT6_PIM (MRT6_BASE+8) /* enable PIM code */
28#define MRT6_TABLE (MRT6_BASE+9) /* Specify mroute table ID */
29
30#define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE /* IP protocol privates */
31#define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1)
32#define SIOCGETRPF (SIOCPROTOPRIVATE+2)
33
34#define MAXMIFS 32
35typedef unsigned long mifbitmap_t; /* User mode code depends on this lot */
36typedef unsigned short mifi_t;
37#define ALL_MIFS ((mifi_t)(-1))
38
39#ifndef IF_SETSIZE
40#define IF_SETSIZE 256
41#endif
42
43typedef __u32 if_mask;
44#define NIFBITS (sizeof(if_mask) * 8) /* bits per mask */
45
46#if !defined(__KERNEL__)
47#if !defined(DIV_ROUND_UP)
48#define DIV_ROUND_UP(x,y) (((x) + ((y) - 1)) / (y))
49#endif
50#endif
51
52typedef struct if_set {
53 if_mask ifs_bits[DIV_ROUND_UP(IF_SETSIZE, NIFBITS)];
54} if_set;
55
56#define IF_SET(n, p) ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS)))
57#define IF_CLR(n, p) ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS)))
58#define IF_ISSET(n, p) ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS)))
59#define IF_COPY(f, t) bcopy(f, t, sizeof(*(f)))
60#define IF_ZERO(p) bzero(p, sizeof(*(p)))
61
62/*
63 * Passed by mrouted for an MRT_ADD_MIF - again we use the
64 * mrouted 3.6 structures for compatibility
65 */
66
67struct mif6ctl {
68 mifi_t mif6c_mifi; /* Index of MIF */
69 unsigned char mif6c_flags; /* MIFF_ flags */
70 unsigned char vifc_threshold; /* ttl limit */
71 __u16 mif6c_pifi; /* the index of the physical IF */
72 unsigned int vifc_rate_limit; /* Rate limiter values (NI) */
73};
74
75#define MIFF_REGISTER 0x1 /* register vif */
76
77/*
78 * Cache manipulation structures for mrouted and PIMd
79 */
80
81struct mf6cctl {
82 struct sockaddr_in6 mf6cc_origin; /* Origin of mcast */
83 struct sockaddr_in6 mf6cc_mcastgrp; /* Group in question */
84 mifi_t mf6cc_parent; /* Where it arrived */
85 struct if_set mf6cc_ifset; /* Where it is going */
86};
87
88/*
89 * Group count retrieval for pim6sd
90 */
91
92struct sioc_sg_req6 {
93 struct sockaddr_in6 src;
94 struct sockaddr_in6 grp;
95 unsigned long pktcnt;
96 unsigned long bytecnt;
97 unsigned long wrong_if;
98};
99
100/*
101 * To get vif packet counts
102 */
103
104struct sioc_mif_req6 {
105 mifi_t mifi; /* Which iface */
106 unsigned long icount; /* In packets */
107 unsigned long ocount; /* Out packets */
108 unsigned long ibytes; /* In bytes */
109 unsigned long obytes; /* Out bytes */
110};
111
112/*
113 * That's all usermode folks
114 */
115
116#ifdef __KERNEL__
117 4
118#include <linux/pim.h> 5#include <linux/pim.h>
119#include <linux/skbuff.h> /* for struct sk_buff_head */ 6#include <linux/skbuff.h> /* for struct sk_buff_head */
120#include <net/net_namespace.h> 7#include <net/net_namespace.h>
8#include <uapi/linux/mroute6.h>
121 9
122#ifdef CONFIG_IPV6_MROUTE 10#ifdef CONFIG_IPV6_MROUTE
123static inline int ip6_mroute_opt(int opt) 11static inline int ip6_mroute_opt(int opt)
@@ -225,9 +113,6 @@ struct mfc6_cache {
225 113
226#define MFC_ASSERT_THRESH (3*HZ) /* Maximal freq. of asserts */ 114#define MFC_ASSERT_THRESH (3*HZ) /* Maximal freq. of asserts */
227 115
228#endif
229
230#ifdef __KERNEL__
231struct rtmsg; 116struct rtmsg;
232extern int ip6mr_get_route(struct net *net, struct sk_buff *skb, 117extern int ip6mr_get_route(struct net *net, struct sk_buff *skb,
233 struct rtmsg *rtm, int nowait); 118 struct rtmsg *rtm, int nowait);
@@ -246,24 +131,3 @@ static inline int ip6mr_sk_done(struct sock *sk)
246} 131}
247#endif 132#endif
248#endif 133#endif
249
250/*
251 * Structure used to communicate from kernel to multicast router.
252 * We'll overlay the structure onto an MLD header (not an IPv6 heder like igmpmsg{}
253 * used for IPv4 implementation). This is because this structure will be passed via an
254 * IPv6 raw socket, on which an application will only receiver the payload i.e the data after
255 * the IPv6 header and all the extension headers. (See section 3 of RFC 3542)
256 */
257
258struct mrt6msg {
259#define MRT6MSG_NOCACHE 1
260#define MRT6MSG_WRONGMIF 2
261#define MRT6MSG_WHOLEPKT 3 /* used for use level encap */
262 __u8 im6_mbz; /* must be zero */
263 __u8 im6_msgtype; /* what type of message */
264 __u16 im6_mif; /* mif rec'd on */
265 __u32 im6_pad; /* padding for 64 bit arch */
266 struct in6_addr im6_src, im6_dst;
267};
268
269#endif
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index 11cc2ac67e75..e1b163f912fb 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -1,174 +1,11 @@
1#ifndef _LINUX_MSDOS_FS_H 1#ifndef _LINUX_MSDOS_FS_H
2#define _LINUX_MSDOS_FS_H 2#define _LINUX_MSDOS_FS_H
3 3
4#include <linux/types.h> 4#include <uapi/linux/msdos_fs.h>
5#include <linux/magic.h>
6#include <asm/byteorder.h>
7 5
8/*
9 * The MS-DOS filesystem constants/structures
10 */
11
12#define SECTOR_SIZE 512 /* sector size (bytes) */
13#define SECTOR_BITS 9 /* log2(SECTOR_SIZE) */
14#define MSDOS_DPB (MSDOS_DPS) /* dir entries per block */
15#define MSDOS_DPB_BITS 4 /* log2(MSDOS_DPB) */
16#define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry))
17#define MSDOS_DPS_BITS 4 /* log2(MSDOS_DPS) */
18#define MSDOS_LONGNAME 256 /* maximum name length */
19#define CF_LE_W(v) le16_to_cpu(v)
20#define CF_LE_L(v) le32_to_cpu(v)
21#define CT_LE_W(v) cpu_to_le16(v)
22#define CT_LE_L(v) cpu_to_le32(v)
23
24#define MSDOS_ROOT_INO 1 /* The root inode number */
25#define MSDOS_FSINFO_INO 2 /* Used for managing the FSINFO block */
26
27#define MSDOS_DIR_BITS 5 /* log2(sizeof(struct msdos_dir_entry)) */
28
29/* directory limit */
30#define FAT_MAX_DIR_ENTRIES (65536)
31#define FAT_MAX_DIR_SIZE (FAT_MAX_DIR_ENTRIES << MSDOS_DIR_BITS)
32
33#define ATTR_NONE 0 /* no attribute bits */
34#define ATTR_RO 1 /* read-only */
35#define ATTR_HIDDEN 2 /* hidden */
36#define ATTR_SYS 4 /* system */
37#define ATTR_VOLUME 8 /* volume label */
38#define ATTR_DIR 16 /* directory */
39#define ATTR_ARCH 32 /* archived */
40
41/* attribute bits that are copied "as is" */
42#define ATTR_UNUSED (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN)
43/* bits that are used by the Windows 95/Windows NT extended FAT */
44#define ATTR_EXT (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME)
45
46#define CASE_LOWER_BASE 8 /* base is lower case */
47#define CASE_LOWER_EXT 16 /* extension is lower case */
48
49#define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */
50#define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG)
51
52#define FAT_LFN_LEN 255 /* maximum long name length */
53#define MSDOS_NAME 11 /* maximum name length */
54#define MSDOS_SLOTS 21 /* max # of slots for short and long names */
55#define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */
56#define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */
57
58#define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : \
59 MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x))
60
61/* start of data cluster's entry (number of reserved clusters) */
62#define FAT_START_ENT 2
63
64/* maximum number of clusters */
65#define MAX_FAT12 0xFF4
66#define MAX_FAT16 0xFFF4
67#define MAX_FAT32 0x0FFFFFF6
68#define MAX_FAT(s) (MSDOS_SB(s)->fat_bits == 32 ? MAX_FAT32 : \
69 MSDOS_SB(s)->fat_bits == 16 ? MAX_FAT16 : MAX_FAT12)
70
71/* bad cluster mark */
72#define BAD_FAT12 0xFF7
73#define BAD_FAT16 0xFFF7
74#define BAD_FAT32 0x0FFFFFF7
75
76/* standard EOF */
77#define EOF_FAT12 0xFFF
78#define EOF_FAT16 0xFFFF
79#define EOF_FAT32 0x0FFFFFFF
80
81#define FAT_ENT_FREE (0)
82#define FAT_ENT_BAD (BAD_FAT32)
83#define FAT_ENT_EOF (EOF_FAT32)
84
85#define FAT_FSINFO_SIG1 0x41615252
86#define FAT_FSINFO_SIG2 0x61417272
87#define IS_FSINFO(x) (le32_to_cpu((x)->signature1) == FAT_FSINFO_SIG1 \
88 && le32_to_cpu((x)->signature2) == FAT_FSINFO_SIG2)
89
90struct __fat_dirent {
91 long d_ino;
92 __kernel_off_t d_off;
93 unsigned short d_reclen;
94 char d_name[256]; /* We must not include limits.h! */
95};
96
97/*
98 * ioctl commands
99 */
100#define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct __fat_dirent[2])
101#define VFAT_IOCTL_READDIR_SHORT _IOR('r', 2, struct __fat_dirent[2])
102/* <linux/videotext.h> has used 0x72 ('r') in collision, so skip a few */
103#define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32)
104#define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32)
105
106struct fat_boot_sector {
107 __u8 ignored[3]; /* Boot strap short or near jump */
108 __u8 system_id[8]; /* Name - can be used to special case
109 partition manager volumes */
110 __u8 sector_size[2]; /* bytes per logical sector */
111 __u8 sec_per_clus; /* sectors/cluster */
112 __le16 reserved; /* reserved sectors */
113 __u8 fats; /* number of FATs */
114 __u8 dir_entries[2]; /* root directory entries */
115 __u8 sectors[2]; /* number of sectors */
116 __u8 media; /* media code */
117 __le16 fat_length; /* sectors/FAT */
118 __le16 secs_track; /* sectors per track */
119 __le16 heads; /* number of heads */
120 __le32 hidden; /* hidden sectors (unused) */
121 __le32 total_sect; /* number of sectors (if sectors == 0) */
122
123 /* The following fields are only used by FAT32 */
124 __le32 fat32_length; /* sectors/FAT */
125 __le16 flags; /* bit 8: fat mirroring, low 4: active fat */
126 __u8 version[2]; /* major, minor filesystem version */
127 __le32 root_cluster; /* first cluster in root directory */
128 __le16 info_sector; /* filesystem info sector */
129 __le16 backup_boot; /* backup boot sector */
130 __le16 reserved2[6]; /* Unused */
131};
132
133struct fat_boot_fsinfo {
134 __le32 signature1; /* 0x41615252L */
135 __le32 reserved1[120]; /* Nothing as far as I can tell */
136 __le32 signature2; /* 0x61417272L */
137 __le32 free_clusters; /* Free cluster count. -1 if unknown */
138 __le32 next_cluster; /* Most recently allocated cluster */
139 __le32 reserved2[4];
140};
141
142struct msdos_dir_entry {
143 __u8 name[MSDOS_NAME];/* name and extension */
144 __u8 attr; /* attribute bits */
145 __u8 lcase; /* Case for base and extension */
146 __u8 ctime_cs; /* Creation time, centiseconds (0-199) */
147 __le16 ctime; /* Creation time */
148 __le16 cdate; /* Creation date */
149 __le16 adate; /* Last access date */
150 __le16 starthi; /* High 16 bits of cluster in FAT32 */
151 __le16 time,date,start;/* time, date and first cluster */
152 __le32 size; /* file size (in bytes) */
153};
154
155/* Up to 13 characters of the name */
156struct msdos_dir_slot {
157 __u8 id; /* sequence number for slot */
158 __u8 name0_4[10]; /* first 5 characters in name */
159 __u8 attr; /* attribute byte */
160 __u8 reserved; /* always 0 */
161 __u8 alias_checksum; /* checksum for 8.3 alias */
162 __u8 name5_10[12]; /* 6 more characters in name */
163 __le16 start; /* starting cluster number, 0 in long slots */
164 __u8 name11_12[4]; /* last 2 characters in name */
165};
166
167#ifdef __KERNEL__
168/* media of boot sector */ 6/* media of boot sector */
169static inline int fat_valid_media(u8 media) 7static inline int fat_valid_media(u8 media)
170{ 8{
171 return 0xf8 <= media || media == 0xf0; 9 return 0xf8 <= media || media == 0xf0;
172} 10}
173#endif /* !__KERNEL__ */
174#endif /* !_LINUX_MSDOS_FS_H */ 11#endif /* !_LINUX_MSDOS_FS_H */
diff --git a/include/linux/msg.h b/include/linux/msg.h
index 56abf1558fdd..7a4b9e97d29a 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -1,78 +1,8 @@
1#ifndef _LINUX_MSG_H 1#ifndef _LINUX_MSG_H
2#define _LINUX_MSG_H 2#define _LINUX_MSG_H
3 3
4#include <linux/ipc.h>
5
6/* ipcs ctl commands */
7#define MSG_STAT 11
8#define MSG_INFO 12
9
10/* msgrcv options */
11#define MSG_NOERROR 010000 /* no error if message is too big */
12#define MSG_EXCEPT 020000 /* recv any msg except of specified type.*/
13
14/* Obsolete, used only for backwards compatibility and libc5 compiles */
15struct msqid_ds {
16 struct ipc_perm msg_perm;
17 struct msg *msg_first; /* first message on queue,unused */
18 struct msg *msg_last; /* last message in queue,unused */
19 __kernel_time_t msg_stime; /* last msgsnd time */
20 __kernel_time_t msg_rtime; /* last msgrcv time */
21 __kernel_time_t msg_ctime; /* last change time */
22 unsigned long msg_lcbytes; /* Reuse junk fields for 32 bit */
23 unsigned long msg_lqbytes; /* ditto */
24 unsigned short msg_cbytes; /* current number of bytes on queue */
25 unsigned short msg_qnum; /* number of messages in queue */
26 unsigned short msg_qbytes; /* max number of bytes on queue */
27 __kernel_ipc_pid_t msg_lspid; /* pid of last msgsnd */
28 __kernel_ipc_pid_t msg_lrpid; /* last receive pid */
29};
30
31/* Include the definition of msqid64_ds */
32#include <asm/msgbuf.h>
33
34/* message buffer for msgsnd and msgrcv calls */
35struct msgbuf {
36 long mtype; /* type of message */
37 char mtext[1]; /* message text */
38};
39
40/* buffer for msgctl calls IPC_INFO, MSG_INFO */
41struct msginfo {
42 int msgpool;
43 int msgmap;
44 int msgmax;
45 int msgmnb;
46 int msgmni;
47 int msgssz;
48 int msgtql;
49 unsigned short msgseg;
50};
51
52/*
53 * Scaling factor to compute msgmni:
54 * the memory dedicated to msg queues (msgmni * msgmnb) should occupy
55 * at most 1/MSG_MEM_SCALE of the lowmem (see the formula in ipc/msg.c):
56 * up to 8MB : msgmni = 16 (MSGMNI)
57 * 4 GB : msgmni = 8K
58 * more than 16 GB : msgmni = 32K (IPCMNI)
59 */
60#define MSG_MEM_SCALE 32
61
62#define MSGMNI 16 /* <= IPCMNI */ /* max # of msg queue identifiers */
63#define MSGMAX 8192 /* <= INT_MAX */ /* max size of message (bytes) */
64#define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */
65
66/* unused */
67#define MSGPOOL (MSGMNI * MSGMNB / 1024) /* size in kbytes of message pool */
68#define MSGTQL MSGMNB /* number of system message headers */
69#define MSGMAP MSGMNB /* number of entries in message map */
70#define MSGSSZ 16 /* message segment size */
71#define __MSGSEG ((MSGPOOL * 1024) / MSGSSZ) /* max no. of segments */
72#define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff)
73
74#ifdef __KERNEL__
75#include <linux/list.h> 4#include <linux/list.h>
5#include <uapi/linux/msg.h>
76 6
77/* one msg_msg structure for each message */ 7/* one msg_msg structure for each message */
78struct msg_msg { 8struct msg_msg {
@@ -107,6 +37,4 @@ extern long do_msgsnd(int msqid, long mtype, void __user *mtext,
107extern long do_msgrcv(int msqid, long *pmtype, void __user *mtext, 37extern long do_msgrcv(int msqid, long *pmtype, void __user *mtext,
108 size_t msgsz, long msgtyp, int msgflg); 38 size_t msgsz, long msgtyp, int msgflg);
109 39
110#endif /* __KERNEL__ */
111
112#endif /* _LINUX_MSG_H */ 40#endif /* _LINUX_MSG_H */
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 650ef352f045..211ff67e8b0d 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -78,8 +78,6 @@ struct nand_bbt_descr {
78#define NAND_BBT_LASTBLOCK 0x00000010 78#define NAND_BBT_LASTBLOCK 0x00000010
79/* The bbt is at the given page, else we must scan for the bbt */ 79/* The bbt is at the given page, else we must scan for the bbt */
80#define NAND_BBT_ABSPAGE 0x00000020 80#define NAND_BBT_ABSPAGE 0x00000020
81/* The bbt is at the given page, else we must scan for the bbt */
82#define NAND_BBT_SEARCH 0x00000040
83/* bbt is stored per chip on multichip devices */ 81/* bbt is stored per chip on multichip devices */
84#define NAND_BBT_PERCHIP 0x00000080 82#define NAND_BBT_PERCHIP 0x00000080
85/* bbt has a version counter at offset veroffs */ 83/* bbt has a version counter at offset veroffs */
@@ -110,7 +108,10 @@ struct nand_bbt_descr {
110 * OOB area. This option is passed to the default bad block table function. 108 * OOB area. This option is passed to the default bad block table function.
111 */ 109 */
112#define NAND_BBT_USE_FLASH 0x00020000 110#define NAND_BBT_USE_FLASH 0x00020000
113/* Do not store flash based bad block table in OOB area; store it in-band */ 111/*
112 * Do not store flash based bad block table marker in the OOB area; store it
113 * in-band.
114 */
114#define NAND_BBT_NO_OOB 0x00040000 115#define NAND_BBT_NO_OOB 0x00040000
115/* 116/*
116 * Do not write new bad block markers to OOB; useful, e.g., when ECC covers 117 * Do not write new bad block markers to OOB; useful, e.g., when ECC covers
diff --git a/include/linux/mtd/lpc32xx_mlc.h b/include/linux/mtd/lpc32xx_mlc.h
new file mode 100644
index 000000000000..d91b1e35631e
--- /dev/null
+++ b/include/linux/mtd/lpc32xx_mlc.h
@@ -0,0 +1,20 @@
1/*
2 * Platform data for LPC32xx SoC MLC NAND controller
3 *
4 * Copyright © 2012 Roland Stigge
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_MTD_LPC32XX_MLC_H
12#define __LINUX_MTD_LPC32XX_MLC_H
13
14#include <linux/dmaengine.h>
15
16struct lpc32xx_mlc_platform_data {
17 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
18};
19
20#endif /* __LINUX_MTD_LPC32XX_MLC_H */
diff --git a/include/linux/mtd/lpc32xx_slc.h b/include/linux/mtd/lpc32xx_slc.h
new file mode 100644
index 000000000000..1169548a1535
--- /dev/null
+++ b/include/linux/mtd/lpc32xx_slc.h
@@ -0,0 +1,20 @@
1/*
2 * Platform data for LPC32xx SoC SLC NAND controller
3 *
4 * Copyright © 2012 Roland Stigge
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_MTD_LPC32XX_SLC_H
12#define __LINUX_MTD_LPC32XX_SLC_H
13
14#include <linux/dmaengine.h>
15
16struct lpc32xx_slc_platform_data {
17 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
18};
19
20#endif /* __LINUX_MTD_LPC32XX_SLC_H */
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 63dadc0dfb62..81d61e704599 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -265,14 +265,7 @@ int mtd_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen,
265int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, 265int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen,
266 const u_char *buf); 266 const u_char *buf);
267 267
268static inline int mtd_read_oob(struct mtd_info *mtd, loff_t from, 268int mtd_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops);
269 struct mtd_oob_ops *ops)
270{
271 ops->retlen = ops->oobretlen = 0;
272 if (!mtd->_read_oob)
273 return -EOPNOTSUPP;
274 return mtd->_read_oob(mtd, from, ops);
275}
276 269
277static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to, 270static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to,
278 struct mtd_oob_ops *ops) 271 struct mtd_oob_ops *ops)
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 57977c640529..24e915957e4f 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -56,7 +56,7 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
56 * is supported now. If you add a chip with bigger oobsize/page 56 * is supported now. If you add a chip with bigger oobsize/page
57 * adjust this accordingly. 57 * adjust this accordingly.
58 */ 58 */
59#define NAND_MAX_OOBSIZE 576 59#define NAND_MAX_OOBSIZE 640
60#define NAND_MAX_PAGESIZE 8192 60#define NAND_MAX_PAGESIZE 8192
61 61
62/* 62/*
@@ -92,6 +92,8 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
92#define NAND_CMD_READID 0x90 92#define NAND_CMD_READID 0x90
93#define NAND_CMD_ERASE2 0xd0 93#define NAND_CMD_ERASE2 0xd0
94#define NAND_CMD_PARAM 0xec 94#define NAND_CMD_PARAM 0xec
95#define NAND_CMD_GET_FEATURES 0xee
96#define NAND_CMD_SET_FEATURES 0xef
95#define NAND_CMD_RESET 0xff 97#define NAND_CMD_RESET 0xff
96 98
97#define NAND_CMD_LOCK 0x2a 99#define NAND_CMD_LOCK 0x2a
@@ -185,12 +187,6 @@ typedef enum {
185 * This happens with the Renesas AG-AND chips, possibly others. 187 * This happens with the Renesas AG-AND chips, possibly others.
186 */ 188 */
187#define BBT_AUTO_REFRESH 0x00000080 189#define BBT_AUTO_REFRESH 0x00000080
188/*
189 * Chip does not require ready check on read. True
190 * for all large page devices, as they do not support
191 * autoincrement.
192 */
193#define NAND_NO_READRDY 0x00000100
194/* Chip does not allow subpage writes */ 190/* Chip does not allow subpage writes */
195#define NAND_NO_SUBPAGE_WRITE 0x00000200 191#define NAND_NO_SUBPAGE_WRITE 0x00000200
196 192
@@ -200,6 +196,9 @@ typedef enum {
200/* Device behaves just like nand, but is readonly */ 196/* Device behaves just like nand, but is readonly */
201#define NAND_ROM 0x00000800 197#define NAND_ROM 0x00000800
202 198
199/* Device supports subpage reads */
200#define NAND_SUBPAGE_READ 0x00001000
201
203/* Options valid for Samsung large page devices */ 202/* Options valid for Samsung large page devices */
204#define NAND_SAMSUNG_LP_OPTIONS \ 203#define NAND_SAMSUNG_LP_OPTIONS \
205 (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) 204 (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK)
@@ -208,12 +207,7 @@ typedef enum {
208#define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING)) 207#define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING))
209#define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG)) 208#define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG))
210#define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK)) 209#define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK))
211/* Large page NAND with SOFT_ECC should support subpage reads */ 210#define NAND_HAS_SUBPAGE_READ(chip) ((chip->options & NAND_SUBPAGE_READ))
212#define NAND_SUBPAGE_READ(chip) ((chip->ecc.mode == NAND_ECC_SOFT) \
213 && (chip->page_shift > 9))
214
215/* Mask to zero out the chip options, which come from the id table */
216#define NAND_CHIPOPTIONS_MSK 0x0000ffff
217 211
218/* Non chip related options */ 212/* Non chip related options */
219/* This option skips the bbt scan during initialization. */ 213/* This option skips the bbt scan during initialization. */
@@ -237,6 +231,21 @@ typedef enum {
237/* Keep gcc happy */ 231/* Keep gcc happy */
238struct nand_chip; 232struct nand_chip;
239 233
234/* ONFI timing mode, used in both asynchronous and synchronous mode */
235#define ONFI_TIMING_MODE_0 (1 << 0)
236#define ONFI_TIMING_MODE_1 (1 << 1)
237#define ONFI_TIMING_MODE_2 (1 << 2)
238#define ONFI_TIMING_MODE_3 (1 << 3)
239#define ONFI_TIMING_MODE_4 (1 << 4)
240#define ONFI_TIMING_MODE_5 (1 << 5)
241#define ONFI_TIMING_MODE_UNKNOWN (1 << 6)
242
243/* ONFI feature address */
244#define ONFI_FEATURE_ADDR_TIMING_MODE 0x1
245
246/* ONFI subfeature parameters length */
247#define ONFI_SUBFEATURE_PARAM_LEN 4
248
240struct nand_onfi_params { 249struct nand_onfi_params {
241 /* rev info and features block */ 250 /* rev info and features block */
242 /* 'O' 'N' 'F' 'I' */ 251 /* 'O' 'N' 'F' 'I' */
@@ -334,8 +343,10 @@ struct nand_hw_control {
334 * @read_page_raw: function to read a raw page without ECC 343 * @read_page_raw: function to read a raw page without ECC
335 * @write_page_raw: function to write a raw page without ECC 344 * @write_page_raw: function to write a raw page without ECC
336 * @read_page: function to read a page according to the ECC generator 345 * @read_page: function to read a page according to the ECC generator
337 * requirements. 346 * requirements; returns maximum number of bitflips corrected in
338 * @read_subpage: function to read parts of the page covered by ECC. 347 * any single ECC step, 0 if bitflips uncorrectable, -EIO hw error
348 * @read_subpage: function to read parts of the page covered by ECC;
349 * returns same as read_page()
339 * @write_page: function to write a page according to the ECC generator 350 * @write_page: function to write a page according to the ECC generator
340 * requirements. 351 * requirements.
341 * @write_oob_raw: function to write chip OOB data without ECC 352 * @write_oob_raw: function to write chip OOB data without ECC
@@ -361,13 +372,13 @@ struct nand_ecc_ctrl {
361 uint8_t *calc_ecc); 372 uint8_t *calc_ecc);
362 int (*read_page_raw)(struct mtd_info *mtd, struct nand_chip *chip, 373 int (*read_page_raw)(struct mtd_info *mtd, struct nand_chip *chip,
363 uint8_t *buf, int oob_required, int page); 374 uint8_t *buf, int oob_required, int page);
364 void (*write_page_raw)(struct mtd_info *mtd, struct nand_chip *chip, 375 int (*write_page_raw)(struct mtd_info *mtd, struct nand_chip *chip,
365 const uint8_t *buf, int oob_required); 376 const uint8_t *buf, int oob_required);
366 int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, 377 int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip,
367 uint8_t *buf, int oob_required, int page); 378 uint8_t *buf, int oob_required, int page);
368 int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip, 379 int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip,
369 uint32_t offs, uint32_t len, uint8_t *buf); 380 uint32_t offs, uint32_t len, uint8_t *buf);
370 void (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, 381 int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
371 const uint8_t *buf, int oob_required); 382 const uint8_t *buf, int oob_required);
372 int (*write_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip, 383 int (*write_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip,
373 int page); 384 int page);
@@ -403,8 +414,6 @@ struct nand_buffers {
403 * @read_word: [REPLACEABLE] read one word from the chip 414 * @read_word: [REPLACEABLE] read one word from the chip
404 * @write_buf: [REPLACEABLE] write data from the buffer to the chip 415 * @write_buf: [REPLACEABLE] write data from the buffer to the chip
405 * @read_buf: [REPLACEABLE] read data from the chip into the buffer 416 * @read_buf: [REPLACEABLE] read data from the chip into the buffer
406 * @verify_buf: [REPLACEABLE] verify buffer contents against the chip
407 * data.
408 * @select_chip: [REPLACEABLE] select chip nr 417 * @select_chip: [REPLACEABLE] select chip nr
409 * @block_bad: [REPLACEABLE] check, if the block is bad 418 * @block_bad: [REPLACEABLE] check, if the block is bad
410 * @block_markbad: [REPLACEABLE] mark the block bad 419 * @block_markbad: [REPLACEABLE] mark the block bad
@@ -462,6 +471,8 @@ struct nand_buffers {
462 * non 0 if ONFI supported. 471 * non 0 if ONFI supported.
463 * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is 472 * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is
464 * supported, 0 otherwise. 473 * supported, 0 otherwise.
474 * @onfi_set_features [REPLACEABLE] set the features for ONFI nand
475 * @onfi_get_features [REPLACEABLE] get the features for ONFI nand
465 * @ecclayout: [REPLACEABLE] the default ECC placement scheme 476 * @ecclayout: [REPLACEABLE] the default ECC placement scheme
466 * @bbt: [INTERN] bad block table pointer 477 * @bbt: [INTERN] bad block table pointer
467 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash 478 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash
@@ -487,7 +498,6 @@ struct nand_chip {
487 u16 (*read_word)(struct mtd_info *mtd); 498 u16 (*read_word)(struct mtd_info *mtd);
488 void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); 499 void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
489 void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len); 500 void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len);
490 int (*verify_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
491 void (*select_chip)(struct mtd_info *mtd, int chip); 501 void (*select_chip)(struct mtd_info *mtd, int chip);
492 int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip); 502 int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip);
493 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); 503 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
@@ -505,6 +515,10 @@ struct nand_chip {
505 int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, 515 int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
506 const uint8_t *buf, int oob_required, int page, 516 const uint8_t *buf, int oob_required, int page,
507 int cached, int raw); 517 int cached, int raw);
518 int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip,
519 int feature_addr, uint8_t *subfeature_para);
520 int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip,
521 int feature_addr, uint8_t *subfeature_para);
508 522
509 int chip_delay; 523 int chip_delay;
510 unsigned int options; 524 unsigned int options;
@@ -559,6 +573,7 @@ struct nand_chip {
559#define NAND_MFR_MICRON 0x2c 573#define NAND_MFR_MICRON 0x2c
560#define NAND_MFR_AMD 0x01 574#define NAND_MFR_AMD 0x01
561#define NAND_MFR_MACRONIX 0xc2 575#define NAND_MFR_MACRONIX 0xc2
576#define NAND_MFR_EON 0x92
562 577
563/** 578/**
564 * struct nand_flash_dev - NAND Flash Device ID Structure 579 * struct nand_flash_dev - NAND Flash Device ID Structure
@@ -641,6 +656,7 @@ struct platform_device;
641 * ALE/CLE/nCE. Also used to write command and address 656 * ALE/CLE/nCE. Also used to write command and address
642 * @write_buf: platform specific function for write buffer 657 * @write_buf: platform specific function for write buffer
643 * @read_buf: platform specific function for read buffer 658 * @read_buf: platform specific function for read buffer
659 * @read_byte: platform specific function to read one byte from chip
644 * @priv: private data to transport driver specific settings 660 * @priv: private data to transport driver specific settings
645 * 661 *
646 * All fields are optional and depend on the hardware driver requirements 662 * All fields are optional and depend on the hardware driver requirements
@@ -677,4 +693,20 @@ struct platform_nand_chip *get_platform_nandchip(struct mtd_info *mtd)
677 return chip->priv; 693 return chip->priv;
678} 694}
679 695
696/* return the supported asynchronous timing mode. */
697static inline int onfi_get_async_timing_mode(struct nand_chip *chip)
698{
699 if (!chip->onfi_version)
700 return ONFI_TIMING_MODE_UNKNOWN;
701 return le16_to_cpu(chip->onfi_params.async_timing_mode);
702}
703
704/* return the supported synchronous timing mode. */
705static inline int onfi_get_sync_timing_mode(struct nand_chip *chip)
706{
707 if (!chip->onfi_version)
708 return ONFI_TIMING_MODE_UNKNOWN;
709 return le16_to_cpu(chip->onfi_params.src_sync_timing_mode);
710}
711
680#endif /* __LINUX_MTD_NAND_H */ 712#endif /* __LINUX_MTD_NAND_H */
diff --git a/include/linux/mtd/sh_flctl.h b/include/linux/mtd/sh_flctl.h
index a38e1fa8af01..01e4b15b280e 100644
--- a/include/linux/mtd/sh_flctl.h
+++ b/include/linux/mtd/sh_flctl.h
@@ -49,7 +49,6 @@
49#define FLERRADR(f) (f->reg + 0x98) 49#define FLERRADR(f) (f->reg + 0x98)
50 50
51/* FLCMNCR control bits */ 51/* FLCMNCR control bits */
52#define ECCPOS2 (0x1 << 25)
53#define _4ECCCNTEN (0x1 << 24) 52#define _4ECCCNTEN (0x1 << 24)
54#define _4ECCEN (0x1 << 23) 53#define _4ECCEN (0x1 << 23)
55#define _4ECCCORRECT (0x1 << 22) 54#define _4ECCCORRECT (0x1 << 22)
@@ -59,9 +58,6 @@
59#define QTSEL_E (0x1 << 17) 58#define QTSEL_E (0x1 << 17)
60#define ENDIAN (0x1 << 16) /* 1 = little endian */ 59#define ENDIAN (0x1 << 16) /* 1 = little endian */
61#define FCKSEL_E (0x1 << 15) 60#define FCKSEL_E (0x1 << 15)
62#define ECCPOS_00 (0x00 << 12)
63#define ECCPOS_01 (0x01 << 12)
64#define ECCPOS_02 (0x02 << 12)
65#define ACM_SACCES_MODE (0x01 << 10) 61#define ACM_SACCES_MODE (0x01 << 10)
66#define NANWF_E (0x1 << 9) 62#define NANWF_E (0x1 << 9)
67#define SE_D (0x1 << 8) /* Spare area disable */ 63#define SE_D (0x1 << 8) /* Spare area disable */
@@ -107,6 +103,14 @@
107#define DOCMD2_E (0x1 << 17) /* 2nd cmd stage execute */ 103#define DOCMD2_E (0x1 << 17) /* 2nd cmd stage execute */
108#define DOCMD1_E (0x1 << 16) /* 1st cmd stage execute */ 104#define DOCMD1_E (0x1 << 16) /* 1st cmd stage execute */
109 105
106/* FLINTDMACR control bits */
107#define ESTERINTE (0x1 << 24) /* ECC error interrupt enable */
108#define AC1CLR (0x1 << 19) /* ECC FIFO clear */
109#define AC0CLR (0x1 << 18) /* Data FIFO clear */
110#define ECERB (0x1 << 9) /* ECC error */
111#define STERB (0x1 << 8) /* Status error */
112#define STERINTE (0x1 << 4) /* Status error enable */
113
110/* FLTRCR control bits */ 114/* FLTRCR control bits */
111#define TRSTRT (0x1 << 0) /* translation start */ 115#define TRSTRT (0x1 << 0) /* translation start */
112#define TREND (0x1 << 1) /* translation end */ 116#define TREND (0x1 << 1) /* translation end */
@@ -125,9 +129,15 @@
125#define _4ECCEND (0x1 << 1) /* 4 symbols end */ 129#define _4ECCEND (0x1 << 1) /* 4 symbols end */
126#define _4ECCEXST (0x1 << 0) /* 4 symbols exist */ 130#define _4ECCEXST (0x1 << 0) /* 4 symbols exist */
127 131
128#define INIT_FL4ECCRESULT_VAL 0x03FF03FF
129#define LOOP_TIMEOUT_MAX 0x00010000 132#define LOOP_TIMEOUT_MAX 0x00010000
130 133
134enum flctl_ecc_res_t {
135 FL_SUCCESS,
136 FL_REPAIRABLE,
137 FL_ERROR,
138 FL_TIMEOUT
139};
140
131struct sh_flctl { 141struct sh_flctl {
132 struct mtd_info mtd; 142 struct mtd_info mtd;
133 struct nand_chip chip; 143 struct nand_chip chip;
@@ -145,8 +155,7 @@ struct sh_flctl {
145 uint32_t erase_ADRCNT; /* bits of FLCMDCR in ERASE1 cmd */ 155 uint32_t erase_ADRCNT; /* bits of FLCMDCR in ERASE1 cmd */
146 uint32_t rw_ADRCNT; /* bits of FLCMDCR in READ WRITE cmd */ 156 uint32_t rw_ADRCNT; /* bits of FLCMDCR in READ WRITE cmd */
147 uint32_t flcmncr_base; /* base value of FLCMNCR */ 157 uint32_t flcmncr_base; /* base value of FLCMNCR */
148 158 uint32_t flintdmacr_base; /* irq enable bits */
149 int hwecc_cant_correct[4];
150 159
151 unsigned page_size:1; /* NAND page size (0 = 512, 1 = 2048) */ 160 unsigned page_size:1; /* NAND page size (0 = 512, 1 = 2048) */
152 unsigned hwecc:1; /* Hardware ECC (0 = disabled, 1 = enabled) */ 161 unsigned hwecc:1; /* Hardware ECC (0 = disabled, 1 = enabled) */
diff --git a/include/linux/n_r3964.h b/include/linux/n_r3964.h
index 54b8e0d8d916..5d0b2a1dee69 100644
--- a/include/linux/n_r3964.h
+++ b/include/linux/n_r3964.h
@@ -43,15 +43,12 @@
43 * 43 *
44 * 44 *
45 */ 45 */
46
47#ifndef __LINUX_N_R3964_H__ 46#ifndef __LINUX_N_R3964_H__
48#define __LINUX_N_R3964_H__ 47#define __LINUX_N_R3964_H__
49 48
50/* line disciplines for r3964 protocol */
51
52#ifdef __KERNEL__
53 49
54#include <linux/param.h> 50#include <linux/param.h>
51#include <uapi/linux/n_r3964.h>
55 52
56/* 53/*
57 * Common ascii handshake characters: 54 * Common ascii handshake characters:
@@ -73,32 +70,6 @@
73#define R3964_TO_RX_PANIC ((4000)*HZ/1000) 70#define R3964_TO_RX_PANIC ((4000)*HZ/1000)
74#define R3964_MAX_RETRIES 5 71#define R3964_MAX_RETRIES 5
75 72
76#endif
77
78/*
79 * Ioctl-commands
80 */
81
82#define R3964_ENABLE_SIGNALS 0x5301
83#define R3964_SETPRIORITY 0x5302
84#define R3964_USE_BCC 0x5303
85#define R3964_READ_TELEGRAM 0x5304
86
87/* Options for R3964_SETPRIORITY */
88#define R3964_MASTER 0
89#define R3964_SLAVE 1
90
91/* Options for R3964_ENABLE_SIGNALS */
92#define R3964_SIG_ACK 0x0001
93#define R3964_SIG_DATA 0x0002
94#define R3964_SIG_ALL 0x000f
95#define R3964_SIG_NONE 0x0000
96#define R3964_USE_SIGIO 0x1000
97
98/*
99 * r3964 operation states:
100 */
101#ifdef __KERNEL__
102 73
103enum { R3964_IDLE, 74enum { R3964_IDLE,
104 R3964_TX_REQUEST, R3964_TRANSMITTING, 75 R3964_TX_REQUEST, R3964_TRANSMITTING,
@@ -127,29 +98,6 @@ struct r3964_client_info {
127}; 98};
128 99
129 100
130#endif
131
132/* types for msg_id: */
133enum {R3964_MSG_ACK=1, R3964_MSG_DATA };
134
135#define R3964_MAX_MSG_COUNT 32
136
137/* error codes for client messages */
138#define R3964_OK 0 /* no error. */
139#define R3964_TX_FAIL -1 /* transmission error, block NOT sent */
140#define R3964_OVERFLOW -2 /* msg queue overflow */
141
142/* the client gets this struct when calling read(fd,...): */
143struct r3964_client_message {
144 int msg_id;
145 int arg;
146 int error_code;
147};
148
149#define R3964_MTU 256
150
151
152#ifdef __KERNEL__
153 101
154struct r3964_block_header; 102struct r3964_block_header;
155 103
@@ -226,6 +174,4 @@ struct r3964_info {
226 int nRetry; 174 int nRetry;
227}; 175};
228 176
229#endif
230
231#endif 177#endif
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index d146ca10c0f5..4871170a04a0 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -11,40 +11,13 @@
11 * 2004/02/19 Paul Clements 11 * 2004/02/19 Paul Clements
12 * Removed PARANOIA, plus various cleanup and comments 12 * Removed PARANOIA, plus various cleanup and comments
13 */ 13 */
14
15#ifndef LINUX_NBD_H 14#ifndef LINUX_NBD_H
16#define LINUX_NBD_H 15#define LINUX_NBD_H
17 16
18#include <linux/types.h>
19
20#define NBD_SET_SOCK _IO( 0xab, 0 )
21#define NBD_SET_BLKSIZE _IO( 0xab, 1 )
22#define NBD_SET_SIZE _IO( 0xab, 2 )
23#define NBD_DO_IT _IO( 0xab, 3 )
24#define NBD_CLEAR_SOCK _IO( 0xab, 4 )
25#define NBD_CLEAR_QUE _IO( 0xab, 5 )
26#define NBD_PRINT_DEBUG _IO( 0xab, 6 )
27#define NBD_SET_SIZE_BLOCKS _IO( 0xab, 7 )
28#define NBD_DISCONNECT _IO( 0xab, 8 )
29#define NBD_SET_TIMEOUT _IO( 0xab, 9 )
30
31enum {
32 NBD_CMD_READ = 0,
33 NBD_CMD_WRITE = 1,
34 NBD_CMD_DISC = 2
35};
36
37#define nbd_cmd(req) ((req)->cmd[0])
38
39/* userspace doesn't need the nbd_device structure */
40#ifdef __KERNEL__
41 17
42#include <linux/wait.h> 18#include <linux/wait.h>
43#include <linux/mutex.h> 19#include <linux/mutex.h>
44 20#include <uapi/linux/nbd.h>
45/* values for flags field */
46#define NBD_READ_ONLY 0x0001
47#define NBD_WRITE_NOCHK 0x0002
48 21
49struct request; 22struct request;
50 23
@@ -71,32 +44,3 @@ struct nbd_device {
71}; 44};
72 45
73#endif 46#endif
74
75/* These are sent over the network in the request/reply magic fields */
76
77#define NBD_REQUEST_MAGIC 0x25609513
78#define NBD_REPLY_MAGIC 0x67446698
79/* Do *not* use magics: 0x12560953 0x96744668. */
80
81/*
82 * This is the packet used for communication between client and
83 * server. All data are in network byte order.
84 */
85struct nbd_request {
86 __be32 magic;
87 __be32 type; /* == READ || == WRITE */
88 char handle[8];
89 __be64 from;
90 __be32 len;
91} __attribute__((packed));
92
93/*
94 * This is the reply packet that nbd-server sends back to the client after
95 * it has completed an I/O request (or an error occurs).
96 */
97struct nbd_reply {
98 __be32 magic;
99 __be32 error; /* 0 = ok, else error */
100 char handle[8]; /* handle you got from request */
101};
102#endif
diff --git a/include/linux/net.h b/include/linux/net.h
index 6ab31cabef7c..aa1673160a45 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -18,49 +18,13 @@
18#ifndef _LINUX_NET_H 18#ifndef _LINUX_NET_H
19#define _LINUX_NET_H 19#define _LINUX_NET_H
20 20
21#include <linux/socket.h>
22#include <asm/socket.h>
23
24#define NPROTO AF_MAX
25
26#define SYS_SOCKET 1 /* sys_socket(2) */
27#define SYS_BIND 2 /* sys_bind(2) */
28#define SYS_CONNECT 3 /* sys_connect(2) */
29#define SYS_LISTEN 4 /* sys_listen(2) */
30#define SYS_ACCEPT 5 /* sys_accept(2) */
31#define SYS_GETSOCKNAME 6 /* sys_getsockname(2) */
32#define SYS_GETPEERNAME 7 /* sys_getpeername(2) */
33#define SYS_SOCKETPAIR 8 /* sys_socketpair(2) */
34#define SYS_SEND 9 /* sys_send(2) */
35#define SYS_RECV 10 /* sys_recv(2) */
36#define SYS_SENDTO 11 /* sys_sendto(2) */
37#define SYS_RECVFROM 12 /* sys_recvfrom(2) */
38#define SYS_SHUTDOWN 13 /* sys_shutdown(2) */
39#define SYS_SETSOCKOPT 14 /* sys_setsockopt(2) */
40#define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */
41#define SYS_SENDMSG 16 /* sys_sendmsg(2) */
42#define SYS_RECVMSG 17 /* sys_recvmsg(2) */
43#define SYS_ACCEPT4 18 /* sys_accept4(2) */
44#define SYS_RECVMMSG 19 /* sys_recvmmsg(2) */
45#define SYS_SENDMMSG 20 /* sys_sendmmsg(2) */
46
47typedef enum {
48 SS_FREE = 0, /* not allocated */
49 SS_UNCONNECTED, /* unconnected to any socket */
50 SS_CONNECTING, /* in process of connecting */
51 SS_CONNECTED, /* connected to socket */
52 SS_DISCONNECTING /* in process of disconnecting */
53} socket_state;
54
55#define __SO_ACCEPTCON (1 << 16) /* performed a listen */
56
57#ifdef __KERNEL__
58#include <linux/stringify.h> 21#include <linux/stringify.h>
59#include <linux/random.h> 22#include <linux/random.h>
60#include <linux/wait.h> 23#include <linux/wait.h>
61#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */ 24#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */
62#include <linux/kmemcheck.h> 25#include <linux/kmemcheck.h>
63#include <linux/rcupdate.h> 26#include <linux/rcupdate.h>
27#include <uapi/linux/net.h>
64 28
65struct poll_table_struct; 29struct poll_table_struct;
66struct pipe_inode_info; 30struct pipe_inode_info;
@@ -319,5 +283,4 @@ extern int kernel_sock_shutdown(struct socket *sock,
319#define MODULE_ALIAS_NET_PF_PROTO_NAME(pf, proto, name) \ 283#define MODULE_ALIAS_NET_PF_PROTO_NAME(pf, proto, name) \
320 MODULE_ALIAS("net-pf-" __stringify(pf) "-proto-" __stringify(proto) \ 284 MODULE_ALIAS("net-pf-" __stringify(pf) "-proto-" __stringify(proto) \
321 name) 285 name)
322#endif /* __KERNEL__ */
323#endif /* _LINUX_NET_H */ 286#endif /* _LINUX_NET_H */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 01646aa53b0e..f8eda0276f03 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -25,12 +25,6 @@
25#ifndef _LINUX_NETDEVICE_H 25#ifndef _LINUX_NETDEVICE_H
26#define _LINUX_NETDEVICE_H 26#define _LINUX_NETDEVICE_H
27 27
28#include <linux/if.h>
29#include <linux/if_ether.h>
30#include <linux/if_packet.h>
31#include <linux/if_link.h>
32
33#ifdef __KERNEL__
34#include <linux/pm_qos.h> 28#include <linux/pm_qos.h>
35#include <linux/timer.h> 29#include <linux/timer.h>
36#include <linux/bug.h> 30#include <linux/bug.h>
@@ -55,6 +49,7 @@
55 49
56#include <linux/netdev_features.h> 50#include <linux/netdev_features.h>
57#include <linux/neighbour.h> 51#include <linux/neighbour.h>
52#include <uapi/linux/netdevice.h>
58 53
59struct netpoll_info; 54struct netpoll_info;
60struct device; 55struct device;
@@ -133,14 +128,6 @@ static inline bool dev_xmit_complete(int rc)
133 return false; 128 return false;
134} 129}
135 130
136#endif
137
138#define MAX_ADDR_LEN 32 /* Largest hardware address length */
139
140/* Initial net device group. All devices belong to group 0 by default. */
141#define INIT_NETDEV_GROUP 0
142
143#ifdef __KERNEL__
144/* 131/*
145 * Compute the worst case header length according to the protocols 132 * Compute the worst case header length according to the protocols
146 * used. 133 * used.
@@ -196,21 +183,6 @@ struct net_device_stats {
196 unsigned long tx_compressed; 183 unsigned long tx_compressed;
197}; 184};
198 185
199#endif /* __KERNEL__ */
200
201
202/* Media selection options. */
203enum {
204 IF_PORT_UNKNOWN = 0,
205 IF_PORT_10BASE2,
206 IF_PORT_10BASET,
207 IF_PORT_AUI,
208 IF_PORT_100BASET,
209 IF_PORT_100BASETX,
210 IF_PORT_100BASEFX
211};
212
213#ifdef __KERNEL__
214 186
215#include <linux/cache.h> 187#include <linux/cache.h>
216#include <linux/skbuff.h> 188#include <linux/skbuff.h>
@@ -1497,19 +1469,25 @@ struct napi_gro_cb {
1497 /* This indicates where we are processing relative to skb->data. */ 1469 /* This indicates where we are processing relative to skb->data. */
1498 int data_offset; 1470 int data_offset;
1499 1471
1500 /* This is non-zero if the packet may be of the same flow. */
1501 int same_flow;
1502
1503 /* This is non-zero if the packet cannot be merged with the new skb. */ 1472 /* This is non-zero if the packet cannot be merged with the new skb. */
1504 int flush; 1473 int flush;
1505 1474
1506 /* Number of segments aggregated. */ 1475 /* Number of segments aggregated. */
1507 int count; 1476 u16 count;
1477
1478 /* This is non-zero if the packet may be of the same flow. */
1479 u8 same_flow;
1508 1480
1509 /* Free the skb? */ 1481 /* Free the skb? */
1510 int free; 1482 u8 free;
1511#define NAPI_GRO_FREE 1 1483#define NAPI_GRO_FREE 1
1512#define NAPI_GRO_FREE_STOLEN_HEAD 2 1484#define NAPI_GRO_FREE_STOLEN_HEAD 2
1485
1486 /* jiffies when first packet was created/queued */
1487 unsigned long age;
1488
1489 /* Used in ipv6_gro_receive() */
1490 int proto;
1513}; 1491};
1514 1492
1515#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb) 1493#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
@@ -1663,7 +1641,6 @@ extern int netpoll_trap(void);
1663#endif 1641#endif
1664extern int skb_gro_receive(struct sk_buff **head, 1642extern int skb_gro_receive(struct sk_buff **head,
1665 struct sk_buff *skb); 1643 struct sk_buff *skb);
1666extern void skb_gro_reset_offset(struct sk_buff *skb);
1667 1644
1668static inline unsigned int skb_gro_offset(const struct sk_buff *skb) 1645static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
1669{ 1646{
@@ -2157,7 +2134,7 @@ extern gro_result_t dev_gro_receive(struct napi_struct *napi,
2157extern gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb); 2134extern gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb);
2158extern gro_result_t napi_gro_receive(struct napi_struct *napi, 2135extern gro_result_t napi_gro_receive(struct napi_struct *napi,
2159 struct sk_buff *skb); 2136 struct sk_buff *skb);
2160extern void napi_gro_flush(struct napi_struct *napi); 2137extern void napi_gro_flush(struct napi_struct *napi, bool flush_old);
2161extern struct sk_buff * napi_get_frags(struct napi_struct *napi); 2138extern struct sk_buff * napi_get_frags(struct napi_struct *napi);
2162extern gro_result_t napi_frags_finish(struct napi_struct *napi, 2139extern gro_result_t napi_frags_finish(struct napi_struct *napi,
2163 struct sk_buff *skb, 2140 struct sk_buff *skb,
@@ -2839,6 +2816,4 @@ do { \
2839}) 2816})
2840#endif 2817#endif
2841 2818
2842#endif /* __KERNEL__ */
2843
2844#endif /* _LINUX_NETDEVICE_H */ 2819#endif /* _LINUX_NETDEVICE_H */
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 1dcf2a38e51f..ee142846f56a 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -1,7 +1,6 @@
1#ifndef __LINUX_NETFILTER_H 1#ifndef __LINUX_NETFILTER_H
2#define __LINUX_NETFILTER_H 2#define __LINUX_NETFILTER_H
3 3
4#ifdef __KERNEL__
5#include <linux/init.h> 4#include <linux/init.h>
6#include <linux/skbuff.h> 5#include <linux/skbuff.h>
7#include <linux/net.h> 6#include <linux/net.h>
@@ -10,75 +9,7 @@
10#include <linux/in6.h> 9#include <linux/in6.h>
11#include <linux/wait.h> 10#include <linux/wait.h>
12#include <linux/list.h> 11#include <linux/list.h>
13#endif 12#include <uapi/linux/netfilter.h>
14#include <linux/types.h>
15#include <linux/compiler.h>
16#include <linux/sysctl.h>
17
18/* Responses from hook functions. */
19#define NF_DROP 0
20#define NF_ACCEPT 1
21#define NF_STOLEN 2
22#define NF_QUEUE 3
23#define NF_REPEAT 4
24#define NF_STOP 5
25#define NF_MAX_VERDICT NF_STOP
26
27/* we overload the higher bits for encoding auxiliary data such as the queue
28 * number or errno values. Not nice, but better than additional function
29 * arguments. */
30#define NF_VERDICT_MASK 0x000000ff
31
32/* extra verdict flags have mask 0x0000ff00 */
33#define NF_VERDICT_FLAG_QUEUE_BYPASS 0x00008000
34
35/* queue number (NF_QUEUE) or errno (NF_DROP) */
36#define NF_VERDICT_QMASK 0xffff0000
37#define NF_VERDICT_QBITS 16
38
39#define NF_QUEUE_NR(x) ((((x) << 16) & NF_VERDICT_QMASK) | NF_QUEUE)
40
41#define NF_DROP_ERR(x) (((-x) << 16) | NF_DROP)
42
43/* only for userspace compatibility */
44#ifndef __KERNEL__
45/* Generic cache responses from hook functions.
46 <= 0x2000 is used for protocol-flags. */
47#define NFC_UNKNOWN 0x4000
48#define NFC_ALTERED 0x8000
49
50/* NF_VERDICT_BITS should be 8 now, but userspace might break if this changes */
51#define NF_VERDICT_BITS 16
52#endif
53
54enum nf_inet_hooks {
55 NF_INET_PRE_ROUTING,
56 NF_INET_LOCAL_IN,
57 NF_INET_FORWARD,
58 NF_INET_LOCAL_OUT,
59 NF_INET_POST_ROUTING,
60 NF_INET_NUMHOOKS
61};
62
63enum {
64 NFPROTO_UNSPEC = 0,
65 NFPROTO_IPV4 = 2,
66 NFPROTO_ARP = 3,
67 NFPROTO_BRIDGE = 7,
68 NFPROTO_IPV6 = 10,
69 NFPROTO_DECNET = 12,
70 NFPROTO_NUMPROTO,
71};
72
73union nf_inet_addr {
74 __u32 all[4];
75 __be32 ip;
76 __be32 ip6[4];
77 struct in_addr in;
78 struct in6_addr in6;
79};
80
81#ifdef __KERNEL__
82#ifdef CONFIG_NETFILTER 13#ifdef CONFIG_NETFILTER
83static inline int NF_DROP_GETERR(int verdict) 14static inline int NF_DROP_GETERR(int verdict)
84{ 15{
@@ -411,5 +342,4 @@ extern struct nfq_ct_nat_hook __rcu *nfq_ct_nat_hook;
411static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} 342static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
412#endif 343#endif
413 344
414#endif /*__KERNEL__*/
415#endif /*__LINUX_NETFILTER_H*/ 345#endif /*__LINUX_NETFILTER_H*/
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
deleted file mode 100644
index 874ae8f2706b..000000000000
--- a/include/linux/netfilter/Kbuild
+++ /dev/null
@@ -1,78 +0,0 @@
1header-y += ipset/
2
3header-y += nf_conntrack_common.h
4header-y += nf_conntrack_ftp.h
5header-y += nf_conntrack_sctp.h
6header-y += nf_conntrack_tcp.h
7header-y += nf_conntrack_tuple_common.h
8header-y += nf_nat.h
9header-y += nfnetlink.h
10header-y += nfnetlink_acct.h
11header-y += nfnetlink_compat.h
12header-y += nfnetlink_conntrack.h
13header-y += nfnetlink_cthelper.h
14header-y += nfnetlink_cttimeout.h
15header-y += nfnetlink_log.h
16header-y += nfnetlink_queue.h
17header-y += x_tables.h
18header-y += xt_AUDIT.h
19header-y += xt_CHECKSUM.h
20header-y += xt_CLASSIFY.h
21header-y += xt_CONNMARK.h
22header-y += xt_CONNSECMARK.h
23header-y += xt_CT.h
24header-y += xt_DSCP.h
25header-y += xt_IDLETIMER.h
26header-y += xt_LED.h
27header-y += xt_LOG.h
28header-y += xt_MARK.h
29header-y += xt_nfacct.h
30header-y += xt_NFLOG.h
31header-y += xt_NFQUEUE.h
32header-y += xt_RATEEST.h
33header-y += xt_SECMARK.h
34header-y += xt_TCPMSS.h
35header-y += xt_TCPOPTSTRIP.h
36header-y += xt_TEE.h
37header-y += xt_TPROXY.h
38header-y += xt_addrtype.h
39header-y += xt_cluster.h
40header-y += xt_comment.h
41header-y += xt_connbytes.h
42header-y += xt_connlimit.h
43header-y += xt_connmark.h
44header-y += xt_conntrack.h
45header-y += xt_cpu.h
46header-y += xt_dccp.h
47header-y += xt_devgroup.h
48header-y += xt_dscp.h
49header-y += xt_ecn.h
50header-y += xt_esp.h
51header-y += xt_hashlimit.h
52header-y += xt_helper.h
53header-y += xt_iprange.h
54header-y += xt_ipvs.h
55header-y += xt_length.h
56header-y += xt_limit.h
57header-y += xt_mac.h
58header-y += xt_mark.h
59header-y += xt_multiport.h
60header-y += xt_osf.h
61header-y += xt_owner.h
62header-y += xt_physdev.h
63header-y += xt_pkttype.h
64header-y += xt_policy.h
65header-y += xt_quota.h
66header-y += xt_rateest.h
67header-y += xt_realm.h
68header-y += xt_recent.h
69header-y += xt_set.h
70header-y += xt_sctp.h
71header-y += xt_socket.h
72header-y += xt_state.h
73header-y += xt_statistic.h
74header-y += xt_string.h
75header-y += xt_tcpmss.h
76header-y += xt_tcpudp.h
77header-y += xt_time.h
78header-y += xt_u32.h
diff --git a/include/linux/netfilter/ipset/Kbuild b/include/linux/netfilter/ipset/Kbuild
deleted file mode 100644
index 601fe71d34d5..000000000000
--- a/include/linux/netfilter/ipset/Kbuild
+++ /dev/null
@@ -1,4 +0,0 @@
1header-y += ip_set.h
2header-y += ip_set_bitmap.h
3header-y += ip_set_hash.h
4header-y += ip_set_list.h
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h
index 528697b3c152..7958e84a65af 100644
--- a/include/linux/netfilter/ipset/ip_set.h
+++ b/include/linux/netfilter/ipset/ip_set.h
@@ -1,6 +1,3 @@
1#ifndef _IP_SET_H
2#define _IP_SET_H
3
4/* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu> 1/* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu>
5 * Patrick Schaaf <bof@bof.de> 2 * Patrick Schaaf <bof@bof.de>
6 * Martin Josefsson <gandalf@wlug.westbo.se> 3 * Martin Josefsson <gandalf@wlug.westbo.se>
@@ -10,199 +7,9 @@
10 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
12 */ 9 */
10#ifndef _IP_SET_H
11#define _IP_SET_H
13 12
14#include <linux/types.h>
15
16/* The protocol version */
17#define IPSET_PROTOCOL 6
18
19/* The max length of strings including NUL: set and type identifiers */
20#define IPSET_MAXNAMELEN 32
21
22/* Message types and commands */
23enum ipset_cmd {
24 IPSET_CMD_NONE,
25 IPSET_CMD_PROTOCOL, /* 1: Return protocol version */
26 IPSET_CMD_CREATE, /* 2: Create a new (empty) set */
27 IPSET_CMD_DESTROY, /* 3: Destroy a (empty) set */
28 IPSET_CMD_FLUSH, /* 4: Remove all elements from a set */
29 IPSET_CMD_RENAME, /* 5: Rename a set */
30 IPSET_CMD_SWAP, /* 6: Swap two sets */
31 IPSET_CMD_LIST, /* 7: List sets */
32 IPSET_CMD_SAVE, /* 8: Save sets */
33 IPSET_CMD_ADD, /* 9: Add an element to a set */
34 IPSET_CMD_DEL, /* 10: Delete an element from a set */
35 IPSET_CMD_TEST, /* 11: Test an element in a set */
36 IPSET_CMD_HEADER, /* 12: Get set header data only */
37 IPSET_CMD_TYPE, /* 13: Get set type */
38 IPSET_MSG_MAX, /* Netlink message commands */
39
40 /* Commands in userspace: */
41 IPSET_CMD_RESTORE = IPSET_MSG_MAX, /* 14: Enter restore mode */
42 IPSET_CMD_HELP, /* 15: Get help */
43 IPSET_CMD_VERSION, /* 16: Get program version */
44 IPSET_CMD_QUIT, /* 17: Quit from interactive mode */
45
46 IPSET_CMD_MAX,
47
48 IPSET_CMD_COMMIT = IPSET_CMD_MAX, /* 18: Commit buffered commands */
49};
50
51/* Attributes at command level */
52enum {
53 IPSET_ATTR_UNSPEC,
54 IPSET_ATTR_PROTOCOL, /* 1: Protocol version */
55 IPSET_ATTR_SETNAME, /* 2: Name of the set */
56 IPSET_ATTR_TYPENAME, /* 3: Typename */
57 IPSET_ATTR_SETNAME2 = IPSET_ATTR_TYPENAME, /* Setname at rename/swap */
58 IPSET_ATTR_REVISION, /* 4: Settype revision */
59 IPSET_ATTR_FAMILY, /* 5: Settype family */
60 IPSET_ATTR_FLAGS, /* 6: Flags at command level */
61 IPSET_ATTR_DATA, /* 7: Nested attributes */
62 IPSET_ATTR_ADT, /* 8: Multiple data containers */
63 IPSET_ATTR_LINENO, /* 9: Restore lineno */
64 IPSET_ATTR_PROTOCOL_MIN, /* 10: Minimal supported version number */
65 IPSET_ATTR_REVISION_MIN = IPSET_ATTR_PROTOCOL_MIN, /* type rev min */
66 __IPSET_ATTR_CMD_MAX,
67};
68#define IPSET_ATTR_CMD_MAX (__IPSET_ATTR_CMD_MAX - 1)
69
70/* CADT specific attributes */
71enum {
72 IPSET_ATTR_IP = IPSET_ATTR_UNSPEC + 1,
73 IPSET_ATTR_IP_FROM = IPSET_ATTR_IP,
74 IPSET_ATTR_IP_TO, /* 2 */
75 IPSET_ATTR_CIDR, /* 3 */
76 IPSET_ATTR_PORT, /* 4 */
77 IPSET_ATTR_PORT_FROM = IPSET_ATTR_PORT,
78 IPSET_ATTR_PORT_TO, /* 5 */
79 IPSET_ATTR_TIMEOUT, /* 6 */
80 IPSET_ATTR_PROTO, /* 7 */
81 IPSET_ATTR_CADT_FLAGS, /* 8 */
82 IPSET_ATTR_CADT_LINENO = IPSET_ATTR_LINENO, /* 9 */
83 /* Reserve empty slots */
84 IPSET_ATTR_CADT_MAX = 16,
85 /* Create-only specific attributes */
86 IPSET_ATTR_GC,
87 IPSET_ATTR_HASHSIZE,
88 IPSET_ATTR_MAXELEM,
89 IPSET_ATTR_NETMASK,
90 IPSET_ATTR_PROBES,
91 IPSET_ATTR_RESIZE,
92 IPSET_ATTR_SIZE,
93 /* Kernel-only */
94 IPSET_ATTR_ELEMENTS,
95 IPSET_ATTR_REFERENCES,
96 IPSET_ATTR_MEMSIZE,
97
98 __IPSET_ATTR_CREATE_MAX,
99};
100#define IPSET_ATTR_CREATE_MAX (__IPSET_ATTR_CREATE_MAX - 1)
101
102/* ADT specific attributes */
103enum {
104 IPSET_ATTR_ETHER = IPSET_ATTR_CADT_MAX + 1,
105 IPSET_ATTR_NAME,
106 IPSET_ATTR_NAMEREF,
107 IPSET_ATTR_IP2,
108 IPSET_ATTR_CIDR2,
109 IPSET_ATTR_IP2_TO,
110 IPSET_ATTR_IFACE,
111 __IPSET_ATTR_ADT_MAX,
112};
113#define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1)
114
115/* IP specific attributes */
116enum {
117 IPSET_ATTR_IPADDR_IPV4 = IPSET_ATTR_UNSPEC + 1,
118 IPSET_ATTR_IPADDR_IPV6,
119 __IPSET_ATTR_IPADDR_MAX,
120};
121#define IPSET_ATTR_IPADDR_MAX (__IPSET_ATTR_IPADDR_MAX - 1)
122
123/* Error codes */
124enum ipset_errno {
125 IPSET_ERR_PRIVATE = 4096,
126 IPSET_ERR_PROTOCOL,
127 IPSET_ERR_FIND_TYPE,
128 IPSET_ERR_MAX_SETS,
129 IPSET_ERR_BUSY,
130 IPSET_ERR_EXIST_SETNAME2,
131 IPSET_ERR_TYPE_MISMATCH,
132 IPSET_ERR_EXIST,
133 IPSET_ERR_INVALID_CIDR,
134 IPSET_ERR_INVALID_NETMASK,
135 IPSET_ERR_INVALID_FAMILY,
136 IPSET_ERR_TIMEOUT,
137 IPSET_ERR_REFERENCED,
138 IPSET_ERR_IPADDR_IPV4,
139 IPSET_ERR_IPADDR_IPV6,
140
141 /* Type specific error codes */
142 IPSET_ERR_TYPE_SPECIFIC = 4352,
143};
144
145/* Flags at command level */
146enum ipset_cmd_flags {
147 IPSET_FLAG_BIT_EXIST = 0,
148 IPSET_FLAG_EXIST = (1 << IPSET_FLAG_BIT_EXIST),
149 IPSET_FLAG_BIT_LIST_SETNAME = 1,
150 IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME),
151 IPSET_FLAG_BIT_LIST_HEADER = 2,
152 IPSET_FLAG_LIST_HEADER = (1 << IPSET_FLAG_BIT_LIST_HEADER),
153 IPSET_FLAG_CMD_MAX = 15, /* Lower half */
154};
155
156/* Flags at CADT attribute level */
157enum ipset_cadt_flags {
158 IPSET_FLAG_BIT_BEFORE = 0,
159 IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE),
160 IPSET_FLAG_BIT_PHYSDEV = 1,
161 IPSET_FLAG_PHYSDEV = (1 << IPSET_FLAG_BIT_PHYSDEV),
162 IPSET_FLAG_BIT_NOMATCH = 2,
163 IPSET_FLAG_NOMATCH = (1 << IPSET_FLAG_BIT_NOMATCH),
164 IPSET_FLAG_CADT_MAX = 15, /* Upper half */
165};
166
167/* Commands with settype-specific attributes */
168enum ipset_adt {
169 IPSET_ADD,
170 IPSET_DEL,
171 IPSET_TEST,
172 IPSET_ADT_MAX,
173 IPSET_CREATE = IPSET_ADT_MAX,
174 IPSET_CADT_MAX,
175};
176
177/* Sets are identified by an index in kernel space. Tweak with ip_set_id_t
178 * and IPSET_INVALID_ID if you want to increase the max number of sets.
179 */
180typedef __u16 ip_set_id_t;
181
182#define IPSET_INVALID_ID 65535
183
184enum ip_set_dim {
185 IPSET_DIM_ZERO = 0,
186 IPSET_DIM_ONE,
187 IPSET_DIM_TWO,
188 IPSET_DIM_THREE,
189 /* Max dimension in elements.
190 * If changed, new revision of iptables match/target is required.
191 */
192 IPSET_DIM_MAX = 6,
193 IPSET_BIT_RETURN_NOMATCH = 7,
194};
195
196/* Option flags for kernel operations */
197enum ip_set_kopt {
198 IPSET_INV_MATCH = (1 << IPSET_DIM_ZERO),
199 IPSET_DIM_ONE_SRC = (1 << IPSET_DIM_ONE),
200 IPSET_DIM_TWO_SRC = (1 << IPSET_DIM_TWO),
201 IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE),
202 IPSET_RETURN_NOMATCH = (1 << IPSET_BIT_RETURN_NOMATCH),
203};
204
205#ifdef __KERNEL__
206#include <linux/ip.h> 13#include <linux/ip.h>
207#include <linux/ipv6.h> 14#include <linux/ipv6.h>
208#include <linux/netlink.h> 15#include <linux/netlink.h>
@@ -211,6 +18,7 @@ enum ip_set_kopt {
211#include <linux/stringify.h> 18#include <linux/stringify.h>
212#include <linux/vmalloc.h> 19#include <linux/vmalloc.h>
213#include <net/netlink.h> 20#include <net/netlink.h>
21#include <uapi/linux/netfilter/ipset/ip_set.h>
214 22
215#define _IP_SET_MODULE_DESC(a, b, c) \ 23#define _IP_SET_MODULE_DESC(a, b, c) \
216 MODULE_DESCRIPTION(a " type of IP sets, revisions " b "-" c) 24 MODULE_DESCRIPTION(a " type of IP sets, revisions " b "-" c)
@@ -476,31 +284,4 @@ bitmap_bytes(u32 a, u32 b)
476 return 4 * ((((b - a + 8) / 8) + 3) / 4); 284 return 4 * ((((b - a + 8) / 8) + 3) / 4);
477} 285}
478 286
479#endif /* __KERNEL__ */
480
481/* Interface to iptables/ip6tables */
482
483#define SO_IP_SET 83
484
485union ip_set_name_index {
486 char name[IPSET_MAXNAMELEN];
487 ip_set_id_t index;
488};
489
490#define IP_SET_OP_GET_BYNAME 0x00000006 /* Get set index by name */
491struct ip_set_req_get_set {
492 unsigned int op;
493 unsigned int version;
494 union ip_set_name_index set;
495};
496
497#define IP_SET_OP_GET_BYINDEX 0x00000007 /* Get set name by index */
498/* Uses ip_set_req_get_set */
499
500#define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */
501struct ip_set_req_version {
502 unsigned int op;
503 unsigned int version;
504};
505
506#endif /*_IP_SET_H */ 287#endif /*_IP_SET_H */
diff --git a/include/linux/netfilter/ipset/ip_set_bitmap.h b/include/linux/netfilter/ipset/ip_set_bitmap.h
index 61a9e8746c83..1a30646d5be8 100644
--- a/include/linux/netfilter/ipset/ip_set_bitmap.h
+++ b/include/linux/netfilter/ipset/ip_set_bitmap.h
@@ -1,15 +1,8 @@
1#ifndef __IP_SET_BITMAP_H 1#ifndef __IP_SET_BITMAP_H
2#define __IP_SET_BITMAP_H 2#define __IP_SET_BITMAP_H
3 3
4/* Bitmap type specific error codes */ 4#include <uapi/linux/netfilter/ipset/ip_set_bitmap.h>
5enum {
6 /* The element is out of the range of the set */
7 IPSET_ERR_BITMAP_RANGE = IPSET_ERR_TYPE_SPECIFIC,
8 /* The range exceeds the size limit of the set type */
9 IPSET_ERR_BITMAP_RANGE_SIZE,
10};
11 5
12#ifdef __KERNEL__
13#define IPSET_BITMAP_MAX_RANGE 0x0000FFFF 6#define IPSET_BITMAP_MAX_RANGE 0x0000FFFF
14 7
15/* Common functions */ 8/* Common functions */
@@ -26,6 +19,4 @@ range_to_mask(u32 from, u32 to, u8 *bits)
26 return mask; 19 return mask;
27} 20}
28 21
29#endif /* __KERNEL__ */
30
31#endif /* __IP_SET_BITMAP_H */ 22#endif /* __IP_SET_BITMAP_H */
diff --git a/include/linux/netfilter/ipset/ip_set_hash.h b/include/linux/netfilter/ipset/ip_set_hash.h
index e2a9fae767f6..f98ddfb094cb 100644
--- a/include/linux/netfilter/ipset/ip_set_hash.h
+++ b/include/linux/netfilter/ipset/ip_set_hash.h
@@ -1,23 +1,8 @@
1#ifndef __IP_SET_HASH_H 1#ifndef __IP_SET_HASH_H
2#define __IP_SET_HASH_H 2#define __IP_SET_HASH_H
3 3
4/* Hash type specific error codes */ 4#include <uapi/linux/netfilter/ipset/ip_set_hash.h>
5enum {
6 /* Hash is full */
7 IPSET_ERR_HASH_FULL = IPSET_ERR_TYPE_SPECIFIC,
8 /* Null-valued element */
9 IPSET_ERR_HASH_ELEM,
10 /* Invalid protocol */
11 IPSET_ERR_INVALID_PROTO,
12 /* Protocol missing but must be specified */
13 IPSET_ERR_MISSING_PROTO,
14 /* Range not supported */
15 IPSET_ERR_HASH_RANGE_UNSUPPORTED,
16 /* Invalid range */
17 IPSET_ERR_HASH_RANGE,
18};
19 5
20#ifdef __KERNEL__
21 6
22#define IPSET_DEFAULT_HASHSIZE 1024 7#define IPSET_DEFAULT_HASHSIZE 1024
23#define IPSET_MIMINAL_HASHSIZE 64 8#define IPSET_MIMINAL_HASHSIZE 64
@@ -25,6 +10,4 @@ enum {
25#define IPSET_DEFAULT_PROBES 4 10#define IPSET_DEFAULT_PROBES 4
26#define IPSET_DEFAULT_RESIZE 100 11#define IPSET_DEFAULT_RESIZE 100
27 12
28#endif /* __KERNEL__ */
29
30#endif /* __IP_SET_HASH_H */ 13#endif /* __IP_SET_HASH_H */
diff --git a/include/linux/netfilter/ipset/ip_set_list.h b/include/linux/netfilter/ipset/ip_set_list.h
index 40a63f302613..68c2aea897f5 100644
--- a/include/linux/netfilter/ipset/ip_set_list.h
+++ b/include/linux/netfilter/ipset/ip_set_list.h
@@ -1,27 +1,10 @@
1#ifndef __IP_SET_LIST_H 1#ifndef __IP_SET_LIST_H
2#define __IP_SET_LIST_H 2#define __IP_SET_LIST_H
3 3
4/* List type specific error codes */ 4#include <uapi/linux/netfilter/ipset/ip_set_list.h>
5enum {
6 /* Set name to be added/deleted/tested does not exist. */
7 IPSET_ERR_NAME = IPSET_ERR_TYPE_SPECIFIC,
8 /* list:set type is not permitted to add */
9 IPSET_ERR_LOOP,
10 /* Missing reference set */
11 IPSET_ERR_BEFORE,
12 /* Reference set does not exist */
13 IPSET_ERR_NAMEREF,
14 /* Set is full */
15 IPSET_ERR_LIST_FULL,
16 /* Reference set is not added to the set */
17 IPSET_ERR_REF_EXIST,
18};
19 5
20#ifdef __KERNEL__
21 6
22#define IP_SET_LIST_DEFAULT_SIZE 8 7#define IP_SET_LIST_DEFAULT_SIZE 8
23#define IP_SET_LIST_MIN_SIZE 4 8#define IP_SET_LIST_MIN_SIZE 4
24 9
25#endif /* __KERNEL__ */
26
27#endif /* __IP_SET_LIST_H */ 10#endif /* __IP_SET_LIST_H */
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index d146872a0b91..127d0b90604f 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -1,119 +1,8 @@
1#ifndef _NF_CONNTRACK_COMMON_H 1#ifndef _NF_CONNTRACK_COMMON_H
2#define _NF_CONNTRACK_COMMON_H 2#define _NF_CONNTRACK_COMMON_H
3/* Connection state tracking for netfilter. This is separated from,
4 but required by, the NAT layer; it can also be used by an iptables
5 extension. */
6enum ip_conntrack_info {
7 /* Part of an established connection (either direction). */
8 IP_CT_ESTABLISHED,
9 3
10 /* Like NEW, but related to an existing connection, or ICMP error 4#include <uapi/linux/netfilter/nf_conntrack_common.h>
11 (in either direction). */
12 IP_CT_RELATED,
13 5
14 /* Started a new connection to track (only
15 IP_CT_DIR_ORIGINAL); may be a retransmission. */
16 IP_CT_NEW,
17
18 /* >= this indicates reply direction */
19 IP_CT_IS_REPLY,
20
21 IP_CT_ESTABLISHED_REPLY = IP_CT_ESTABLISHED + IP_CT_IS_REPLY,
22 IP_CT_RELATED_REPLY = IP_CT_RELATED + IP_CT_IS_REPLY,
23 IP_CT_NEW_REPLY = IP_CT_NEW + IP_CT_IS_REPLY,
24 /* Number of distinct IP_CT types (no NEW in reply dirn). */
25 IP_CT_NUMBER = IP_CT_IS_REPLY * 2 - 1
26};
27
28/* Bitset representing status of connection. */
29enum ip_conntrack_status {
30 /* It's an expected connection: bit 0 set. This bit never changed */
31 IPS_EXPECTED_BIT = 0,
32 IPS_EXPECTED = (1 << IPS_EXPECTED_BIT),
33
34 /* We've seen packets both ways: bit 1 set. Can be set, not unset. */
35 IPS_SEEN_REPLY_BIT = 1,
36 IPS_SEEN_REPLY = (1 << IPS_SEEN_REPLY_BIT),
37
38 /* Conntrack should never be early-expired. */
39 IPS_ASSURED_BIT = 2,
40 IPS_ASSURED = (1 << IPS_ASSURED_BIT),
41
42 /* Connection is confirmed: originating packet has left box */
43 IPS_CONFIRMED_BIT = 3,
44 IPS_CONFIRMED = (1 << IPS_CONFIRMED_BIT),
45
46 /* Connection needs src nat in orig dir. This bit never changed. */
47 IPS_SRC_NAT_BIT = 4,
48 IPS_SRC_NAT = (1 << IPS_SRC_NAT_BIT),
49
50 /* Connection needs dst nat in orig dir. This bit never changed. */
51 IPS_DST_NAT_BIT = 5,
52 IPS_DST_NAT = (1 << IPS_DST_NAT_BIT),
53
54 /* Both together. */
55 IPS_NAT_MASK = (IPS_DST_NAT | IPS_SRC_NAT),
56
57 /* Connection needs TCP sequence adjusted. */
58 IPS_SEQ_ADJUST_BIT = 6,
59 IPS_SEQ_ADJUST = (1 << IPS_SEQ_ADJUST_BIT),
60
61 /* NAT initialization bits. */
62 IPS_SRC_NAT_DONE_BIT = 7,
63 IPS_SRC_NAT_DONE = (1 << IPS_SRC_NAT_DONE_BIT),
64
65 IPS_DST_NAT_DONE_BIT = 8,
66 IPS_DST_NAT_DONE = (1 << IPS_DST_NAT_DONE_BIT),
67
68 /* Both together */
69 IPS_NAT_DONE_MASK = (IPS_DST_NAT_DONE | IPS_SRC_NAT_DONE),
70
71 /* Connection is dying (removed from lists), can not be unset. */
72 IPS_DYING_BIT = 9,
73 IPS_DYING = (1 << IPS_DYING_BIT),
74
75 /* Connection has fixed timeout. */
76 IPS_FIXED_TIMEOUT_BIT = 10,
77 IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT),
78
79 /* Conntrack is a template */
80 IPS_TEMPLATE_BIT = 11,
81 IPS_TEMPLATE = (1 << IPS_TEMPLATE_BIT),
82
83 /* Conntrack is a fake untracked entry */
84 IPS_UNTRACKED_BIT = 12,
85 IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT),
86
87 /* Conntrack got a helper explicitly attached via CT target. */
88 IPS_HELPER_BIT = 13,
89 IPS_HELPER = (1 << IPS_HELPER_BIT),
90};
91
92/* Connection tracking event types */
93enum ip_conntrack_events {
94 IPCT_NEW, /* new conntrack */
95 IPCT_RELATED, /* related conntrack */
96 IPCT_DESTROY, /* destroyed conntrack */
97 IPCT_REPLY, /* connection has seen two-way traffic */
98 IPCT_ASSURED, /* connection status has changed to assured */
99 IPCT_PROTOINFO, /* protocol information has changed */
100 IPCT_HELPER, /* new helper has been set */
101 IPCT_MARK, /* new mark has been set */
102 IPCT_NATSEQADJ, /* NAT is doing sequence adjustment */
103 IPCT_SECMARK, /* new security mark has been set */
104};
105
106enum ip_conntrack_expect_events {
107 IPEXP_NEW, /* new expectation */
108 IPEXP_DESTROY, /* destroyed expectation */
109};
110
111/* expectation flags */
112#define NF_CT_EXPECT_PERMANENT 0x1
113#define NF_CT_EXPECT_INACTIVE 0x2
114#define NF_CT_EXPECT_USERSPACE 0x4
115
116#ifdef __KERNEL__
117struct ip_conntrack_stat { 6struct ip_conntrack_stat {
118 unsigned int searched; 7 unsigned int searched;
119 unsigned int found; 8 unsigned int found;
@@ -136,6 +25,4 @@ struct ip_conntrack_stat {
136/* call to create an explicit dependency on nf_conntrack. */ 25/* call to create an explicit dependency on nf_conntrack. */
137extern void need_conntrack(void); 26extern void need_conntrack(void);
138 27
139#endif /* __KERNEL__ */
140
141#endif /* _NF_CONNTRACK_COMMON_H */ 28#endif /* _NF_CONNTRACK_COMMON_H */
diff --git a/include/linux/netfilter/nf_conntrack_ftp.h b/include/linux/netfilter/nf_conntrack_ftp.h
index 8faf3f792d13..5f818b01e035 100644
--- a/include/linux/netfilter/nf_conntrack_ftp.h
+++ b/include/linux/netfilter/nf_conntrack_ftp.h
@@ -1,20 +1,8 @@
1#ifndef _NF_CONNTRACK_FTP_H 1#ifndef _NF_CONNTRACK_FTP_H
2#define _NF_CONNTRACK_FTP_H 2#define _NF_CONNTRACK_FTP_H
3/* FTP tracking. */
4 3
5/* This enum is exposed to userspace */ 4#include <uapi/linux/netfilter/nf_conntrack_ftp.h>
6enum nf_ct_ftp_type {
7 /* PORT command from client */
8 NF_CT_FTP_PORT,
9 /* PASV response from server */
10 NF_CT_FTP_PASV,
11 /* EPRT command from client */
12 NF_CT_FTP_EPRT,
13 /* EPSV response from server */
14 NF_CT_FTP_EPSV,
15};
16 5
17#ifdef __KERNEL__
18 6
19#define FTP_PORT 21 7#define FTP_PORT 21
20 8
@@ -42,6 +30,4 @@ extern unsigned int (*nf_nat_ftp_hook)(struct sk_buff *skb,
42 unsigned int matchoff, 30 unsigned int matchoff,
43 unsigned int matchlen, 31 unsigned int matchlen,
44 struct nf_conntrack_expect *exp); 32 struct nf_conntrack_expect *exp);
45#endif /* __KERNEL__ */
46
47#endif /* _NF_CONNTRACK_FTP_H */ 33#endif /* _NF_CONNTRACK_FTP_H */
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h
index e59868ae12d4..22db9614b584 100644
--- a/include/linux/netfilter/nf_conntrack_tcp.h
+++ b/include/linux/netfilter/nf_conntrack_tcp.h
@@ -1,53 +1,8 @@
1#ifndef _NF_CONNTRACK_TCP_H 1#ifndef _NF_CONNTRACK_TCP_H
2#define _NF_CONNTRACK_TCP_H 2#define _NF_CONNTRACK_TCP_H
3/* TCP tracking. */
4 3
5#include <linux/types.h> 4#include <uapi/linux/netfilter/nf_conntrack_tcp.h>
6 5
7/* This is exposed to userspace (ctnetlink) */
8enum tcp_conntrack {
9 TCP_CONNTRACK_NONE,
10 TCP_CONNTRACK_SYN_SENT,
11 TCP_CONNTRACK_SYN_RECV,
12 TCP_CONNTRACK_ESTABLISHED,
13 TCP_CONNTRACK_FIN_WAIT,
14 TCP_CONNTRACK_CLOSE_WAIT,
15 TCP_CONNTRACK_LAST_ACK,
16 TCP_CONNTRACK_TIME_WAIT,
17 TCP_CONNTRACK_CLOSE,
18 TCP_CONNTRACK_LISTEN, /* obsolete */
19#define TCP_CONNTRACK_SYN_SENT2 TCP_CONNTRACK_LISTEN
20 TCP_CONNTRACK_MAX,
21 TCP_CONNTRACK_IGNORE,
22 TCP_CONNTRACK_RETRANS,
23 TCP_CONNTRACK_UNACK,
24 TCP_CONNTRACK_TIMEOUT_MAX
25};
26
27/* Window scaling is advertised by the sender */
28#define IP_CT_TCP_FLAG_WINDOW_SCALE 0x01
29
30/* SACK is permitted by the sender */
31#define IP_CT_TCP_FLAG_SACK_PERM 0x02
32
33/* This sender sent FIN first */
34#define IP_CT_TCP_FLAG_CLOSE_INIT 0x04
35
36/* Be liberal in window checking */
37#define IP_CT_TCP_FLAG_BE_LIBERAL 0x08
38
39/* Has unacknowledged data */
40#define IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED 0x10
41
42/* The field td_maxack has been set */
43#define IP_CT_TCP_FLAG_MAXACK_SET 0x20
44
45struct nf_ct_tcp_flags {
46 __u8 flags;
47 __u8 mask;
48};
49
50#ifdef __KERNEL__
51 6
52struct ip_ct_tcp_state { 7struct ip_ct_tcp_state {
53 u_int32_t td_end; /* max of seq + len */ 8 u_int32_t td_end; /* max of seq + len */
@@ -74,6 +29,4 @@ struct ip_ct_tcp {
74 u_int8_t last_flags; /* Last flags set */ 29 u_int8_t last_flags; /* Last flags set */
75}; 30};
76 31
77#endif /* __KERNEL__ */
78
79#endif /* _NF_CONNTRACK_TCP_H */ 32#endif /* _NF_CONNTRACK_TCP_H */
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 18341cdb2443..4966ddec039b 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -1,63 +1,11 @@
1#ifndef _NFNETLINK_H 1#ifndef _NFNETLINK_H
2#define _NFNETLINK_H 2#define _NFNETLINK_H
3#include <linux/types.h>
4#include <linux/netfilter/nfnetlink_compat.h>
5 3
6enum nfnetlink_groups {
7 NFNLGRP_NONE,
8#define NFNLGRP_NONE NFNLGRP_NONE
9 NFNLGRP_CONNTRACK_NEW,
10#define NFNLGRP_CONNTRACK_NEW NFNLGRP_CONNTRACK_NEW
11 NFNLGRP_CONNTRACK_UPDATE,
12#define NFNLGRP_CONNTRACK_UPDATE NFNLGRP_CONNTRACK_UPDATE
13 NFNLGRP_CONNTRACK_DESTROY,
14#define NFNLGRP_CONNTRACK_DESTROY NFNLGRP_CONNTRACK_DESTROY
15 NFNLGRP_CONNTRACK_EXP_NEW,
16#define NFNLGRP_CONNTRACK_EXP_NEW NFNLGRP_CONNTRACK_EXP_NEW
17 NFNLGRP_CONNTRACK_EXP_UPDATE,
18#define NFNLGRP_CONNTRACK_EXP_UPDATE NFNLGRP_CONNTRACK_EXP_UPDATE
19 NFNLGRP_CONNTRACK_EXP_DESTROY,
20#define NFNLGRP_CONNTRACK_EXP_DESTROY NFNLGRP_CONNTRACK_EXP_DESTROY
21 __NFNLGRP_MAX,
22};
23#define NFNLGRP_MAX (__NFNLGRP_MAX - 1)
24
25/* General form of address family dependent message.
26 */
27struct nfgenmsg {
28 __u8 nfgen_family; /* AF_xxx */
29 __u8 version; /* nfnetlink version */
30 __be16 res_id; /* resource id */
31};
32
33#define NFNETLINK_V0 0
34
35/* netfilter netlink message types are split in two pieces:
36 * 8 bit subsystem, 8bit operation.
37 */
38
39#define NFNL_SUBSYS_ID(x) ((x & 0xff00) >> 8)
40#define NFNL_MSG_TYPE(x) (x & 0x00ff)
41
42/* No enum here, otherwise __stringify() trick of MODULE_ALIAS_NFNL_SUBSYS()
43 * won't work anymore */
44#define NFNL_SUBSYS_NONE 0
45#define NFNL_SUBSYS_CTNETLINK 1
46#define NFNL_SUBSYS_CTNETLINK_EXP 2
47#define NFNL_SUBSYS_QUEUE 3
48#define NFNL_SUBSYS_ULOG 4
49#define NFNL_SUBSYS_OSF 5
50#define NFNL_SUBSYS_IPSET 6
51#define NFNL_SUBSYS_ACCT 7
52#define NFNL_SUBSYS_CTNETLINK_TIMEOUT 8
53#define NFNL_SUBSYS_CTHELPER 9
54#define NFNL_SUBSYS_COUNT 10
55
56#ifdef __KERNEL__
57 4
58#include <linux/netlink.h> 5#include <linux/netlink.h>
59#include <linux/capability.h> 6#include <linux/capability.h>
60#include <net/netlink.h> 7#include <net/netlink.h>
8#include <uapi/linux/netfilter/nfnetlink.h>
61 9
62struct nfnl_callback { 10struct nfnl_callback {
63 int (*call)(struct sock *nl, struct sk_buff *skb, 11 int (*call)(struct sock *nl, struct sk_buff *skb,
@@ -92,5 +40,4 @@ extern void nfnl_unlock(void);
92#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \ 40#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \
93 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys)) 41 MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys))
94 42
95#endif /* __KERNEL__ */
96#endif /* _NFNETLINK_H */ 43#endif /* _NFNETLINK_H */
diff --git a/include/linux/netfilter/nfnetlink_acct.h b/include/linux/netfilter/nfnetlink_acct.h
index 7c4279b4ae7a..bb4bbc9b7a18 100644
--- a/include/linux/netfilter/nfnetlink_acct.h
+++ b/include/linux/netfilter/nfnetlink_acct.h
@@ -1,29 +1,8 @@
1#ifndef _NFNL_ACCT_H_ 1#ifndef _NFNL_ACCT_H_
2#define _NFNL_ACCT_H_ 2#define _NFNL_ACCT_H_
3 3
4#ifndef NFACCT_NAME_MAX 4#include <uapi/linux/netfilter/nfnetlink_acct.h>
5#define NFACCT_NAME_MAX 32
6#endif
7 5
8enum nfnl_acct_msg_types {
9 NFNL_MSG_ACCT_NEW,
10 NFNL_MSG_ACCT_GET,
11 NFNL_MSG_ACCT_GET_CTRZERO,
12 NFNL_MSG_ACCT_DEL,
13 NFNL_MSG_ACCT_MAX
14};
15
16enum nfnl_acct_type {
17 NFACCT_UNSPEC,
18 NFACCT_NAME,
19 NFACCT_PKTS,
20 NFACCT_BYTES,
21 NFACCT_USE,
22 __NFACCT_MAX
23};
24#define NFACCT_MAX (__NFACCT_MAX - 1)
25
26#ifdef __KERNEL__
27 6
28struct nf_acct; 7struct nf_acct;
29 8
@@ -31,6 +10,4 @@ extern struct nf_acct *nfnl_acct_find_get(const char *filter_name);
31extern void nfnl_acct_put(struct nf_acct *acct); 10extern void nfnl_acct_put(struct nf_acct *acct);
32extern void nfnl_acct_update(const struct sk_buff *skb, struct nf_acct *nfacct); 11extern void nfnl_acct_update(const struct sk_buff *skb, struct nf_acct *nfacct);
33 12
34#endif /* __KERNEL__ */
35
36#endif /* _NFNL_ACCT_H */ 13#endif /* _NFNL_ACCT_H */
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 8d674a786744..dd49566315c6 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -1,191 +1,9 @@
1#ifndef _X_TABLES_H 1#ifndef _X_TABLES_H
2#define _X_TABLES_H 2#define _X_TABLES_H
3#include <linux/kernel.h>
4#include <linux/types.h>
5 3
6#define XT_FUNCTION_MAXNAMELEN 30
7#define XT_EXTENSION_MAXNAMELEN 29
8#define XT_TABLE_MAXNAMELEN 32
9
10struct xt_entry_match {
11 union {
12 struct {
13 __u16 match_size;
14
15 /* Used by userspace */
16 char name[XT_EXTENSION_MAXNAMELEN];
17 __u8 revision;
18 } user;
19 struct {
20 __u16 match_size;
21
22 /* Used inside the kernel */
23 struct xt_match *match;
24 } kernel;
25
26 /* Total length */
27 __u16 match_size;
28 } u;
29
30 unsigned char data[0];
31};
32
33struct xt_entry_target {
34 union {
35 struct {
36 __u16 target_size;
37
38 /* Used by userspace */
39 char name[XT_EXTENSION_MAXNAMELEN];
40 __u8 revision;
41 } user;
42 struct {
43 __u16 target_size;
44
45 /* Used inside the kernel */
46 struct xt_target *target;
47 } kernel;
48
49 /* Total length */
50 __u16 target_size;
51 } u;
52
53 unsigned char data[0];
54};
55
56#define XT_TARGET_INIT(__name, __size) \
57{ \
58 .target.u.user = { \
59 .target_size = XT_ALIGN(__size), \
60 .name = __name, \
61 }, \
62}
63
64struct xt_standard_target {
65 struct xt_entry_target target;
66 int verdict;
67};
68
69struct xt_error_target {
70 struct xt_entry_target target;
71 char errorname[XT_FUNCTION_MAXNAMELEN];
72};
73
74/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision
75 * kernel supports, if >= revision. */
76struct xt_get_revision {
77 char name[XT_EXTENSION_MAXNAMELEN];
78 __u8 revision;
79};
80
81/* CONTINUE verdict for targets */
82#define XT_CONTINUE 0xFFFFFFFF
83
84/* For standard target */
85#define XT_RETURN (-NF_REPEAT - 1)
86
87/* this is a dummy structure to find out the alignment requirement for a struct
88 * containing all the fundamental data types that are used in ipt_entry,
89 * ip6t_entry and arpt_entry. This sucks, and it is a hack. It will be my
90 * personal pleasure to remove it -HW
91 */
92struct _xt_align {
93 __u8 u8;
94 __u16 u16;
95 __u32 u32;
96 __u64 u64;
97};
98
99#define XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _xt_align))
100
101/* Standard return verdict, or do jump. */
102#define XT_STANDARD_TARGET ""
103/* Error verdict. */
104#define XT_ERROR_TARGET "ERROR"
105
106#define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0)
107#define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0)
108
109struct xt_counters {
110 __u64 pcnt, bcnt; /* Packet and byte counters */
111};
112
113/* The argument to IPT_SO_ADD_COUNTERS. */
114struct xt_counters_info {
115 /* Which table. */
116 char name[XT_TABLE_MAXNAMELEN];
117
118 unsigned int num_counters;
119
120 /* The counters (actually `number' of these). */
121 struct xt_counters counters[0];
122};
123
124#define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */
125
126#ifndef __KERNEL__
127/* fn returns 0 to continue iteration */
128#define XT_MATCH_ITERATE(type, e, fn, args...) \
129({ \
130 unsigned int __i; \
131 int __ret = 0; \
132 struct xt_entry_match *__m; \
133 \
134 for (__i = sizeof(type); \
135 __i < (e)->target_offset; \
136 __i += __m->u.match_size) { \
137 __m = (void *)e + __i; \
138 \
139 __ret = fn(__m , ## args); \
140 if (__ret != 0) \
141 break; \
142 } \
143 __ret; \
144})
145
146/* fn returns 0 to continue iteration */
147#define XT_ENTRY_ITERATE_CONTINUE(type, entries, size, n, fn, args...) \
148({ \
149 unsigned int __i, __n; \
150 int __ret = 0; \
151 type *__entry; \
152 \
153 for (__i = 0, __n = 0; __i < (size); \
154 __i += __entry->next_offset, __n++) { \
155 __entry = (void *)(entries) + __i; \
156 if (__n < n) \
157 continue; \
158 \
159 __ret = fn(__entry , ## args); \
160 if (__ret != 0) \
161 break; \
162 } \
163 __ret; \
164})
165
166/* fn returns 0 to continue iteration */
167#define XT_ENTRY_ITERATE(type, entries, size, fn, args...) \
168 XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args)
169
170#endif /* !__KERNEL__ */
171
172/* pos is normally a struct ipt_entry/ip6t_entry/etc. */
173#define xt_entry_foreach(pos, ehead, esize) \
174 for ((pos) = (typeof(pos))(ehead); \
175 (pos) < (typeof(pos))((char *)(ehead) + (esize)); \
176 (pos) = (typeof(pos))((char *)(pos) + (pos)->next_offset))
177
178/* can only be xt_entry_match, so no use of typeof here */
179#define xt_ematch_foreach(pos, entry) \
180 for ((pos) = (struct xt_entry_match *)entry->elems; \
181 (pos) < (struct xt_entry_match *)((char *)(entry) + \
182 (entry)->target_offset); \
183 (pos) = (struct xt_entry_match *)((char *)(pos) + \
184 (pos)->u.match_size))
185
186#ifdef __KERNEL__
187 4
188#include <linux/netdevice.h> 5#include <linux/netdevice.h>
6#include <uapi/linux/netfilter/x_tables.h>
189 7
190/** 8/**
191 * struct xt_action_param - parameters for matches/targets 9 * struct xt_action_param - parameters for matches/targets
@@ -617,6 +435,4 @@ extern int xt_compat_target_to_user(const struct xt_entry_target *t,
617 void __user **dstptr, unsigned int *size); 435 void __user **dstptr, unsigned int *size);
618 436
619#endif /* CONFIG_COMPAT */ 437#endif /* CONFIG_COMPAT */
620#endif /* __KERNEL__ */
621
622#endif /* _X_TABLES_H */ 438#endif /* _X_TABLES_H */
diff --git a/include/linux/netfilter/xt_hashlimit.h b/include/linux/netfilter/xt_hashlimit.h
index c42e52f39f8f..074790c0cf74 100644
--- a/include/linux/netfilter/xt_hashlimit.h
+++ b/include/linux/netfilter/xt_hashlimit.h
@@ -1,78 +1,9 @@
1#ifndef _XT_HASHLIMIT_H 1#ifndef _XT_HASHLIMIT_H
2#define _XT_HASHLIMIT_H 2#define _XT_HASHLIMIT_H
3 3
4#include <linux/types.h> 4#include <uapi/linux/netfilter/xt_hashlimit.h>
5 5
6/* timings are in milliseconds. */
7#define XT_HASHLIMIT_SCALE 10000
8/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
9 * seconds, or one packet every 59 hours.
10 */
11
12/* packet length accounting is done in 16-byte steps */
13#define XT_HASHLIMIT_BYTE_SHIFT 4
14
15/* details of this structure hidden by the implementation */
16struct xt_hashlimit_htable;
17
18enum {
19 XT_HASHLIMIT_HASH_DIP = 1 << 0,
20 XT_HASHLIMIT_HASH_DPT = 1 << 1,
21 XT_HASHLIMIT_HASH_SIP = 1 << 2,
22 XT_HASHLIMIT_HASH_SPT = 1 << 3,
23 XT_HASHLIMIT_INVERT = 1 << 4,
24 XT_HASHLIMIT_BYTES = 1 << 5,
25};
26#ifdef __KERNEL__
27#define XT_HASHLIMIT_ALL (XT_HASHLIMIT_HASH_DIP | XT_HASHLIMIT_HASH_DPT | \ 6#define XT_HASHLIMIT_ALL (XT_HASHLIMIT_HASH_DIP | XT_HASHLIMIT_HASH_DPT | \
28 XT_HASHLIMIT_HASH_SIP | XT_HASHLIMIT_HASH_SPT | \ 7 XT_HASHLIMIT_HASH_SIP | XT_HASHLIMIT_HASH_SPT | \
29 XT_HASHLIMIT_INVERT | XT_HASHLIMIT_BYTES) 8 XT_HASHLIMIT_INVERT | XT_HASHLIMIT_BYTES)
30#endif
31
32struct hashlimit_cfg {
33 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */
34 __u32 avg; /* Average secs between packets * scale */
35 __u32 burst; /* Period multiplier for upper limit. */
36
37 /* user specified */
38 __u32 size; /* how many buckets */
39 __u32 max; /* max number of entries */
40 __u32 gc_interval; /* gc interval */
41 __u32 expire; /* when do entries expire? */
42};
43
44struct xt_hashlimit_info {
45 char name [IFNAMSIZ]; /* name */
46 struct hashlimit_cfg cfg;
47
48 /* Used internally by the kernel */
49 struct xt_hashlimit_htable *hinfo;
50 union {
51 void *ptr;
52 struct xt_hashlimit_info *master;
53 } u;
54};
55
56struct hashlimit_cfg1 {
57 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */
58 __u32 avg; /* Average secs between packets * scale */
59 __u32 burst; /* Period multiplier for upper limit. */
60
61 /* user specified */
62 __u32 size; /* how many buckets */
63 __u32 max; /* max number of entries */
64 __u32 gc_interval; /* gc interval */
65 __u32 expire; /* when do entries expire? */
66
67 __u8 srcmask, dstmask;
68};
69
70struct xt_hashlimit_mtinfo1 {
71 char name[IFNAMSIZ];
72 struct hashlimit_cfg1 cfg;
73
74 /* Used internally by the kernel */
75 struct xt_hashlimit_htable *hinfo __attribute__((aligned(8)));
76};
77
78#endif /*_XT_HASHLIMIT_H*/ 9#endif /*_XT_HASHLIMIT_H*/
diff --git a/include/linux/netfilter/xt_physdev.h b/include/linux/netfilter/xt_physdev.h
index 8555e399886d..5b5e41716d69 100644
--- a/include/linux/netfilter/xt_physdev.h
+++ b/include/linux/netfilter/xt_physdev.h
@@ -1,26 +1,7 @@
1#ifndef _XT_PHYSDEV_H 1#ifndef _XT_PHYSDEV_H
2#define _XT_PHYSDEV_H 2#define _XT_PHYSDEV_H
3 3
4#include <linux/types.h>
5
6#ifdef __KERNEL__
7#include <linux/if.h> 4#include <linux/if.h>
8#endif 5#include <uapi/linux/netfilter/xt_physdev.h>
9
10#define XT_PHYSDEV_OP_IN 0x01
11#define XT_PHYSDEV_OP_OUT 0x02
12#define XT_PHYSDEV_OP_BRIDGED 0x04
13#define XT_PHYSDEV_OP_ISIN 0x08
14#define XT_PHYSDEV_OP_ISOUT 0x10
15#define XT_PHYSDEV_OP_MASK (0x20 - 1)
16
17struct xt_physdev_info {
18 char physindev[IFNAMSIZ];
19 char in_mask[IFNAMSIZ];
20 char physoutdev[IFNAMSIZ];
21 char out_mask[IFNAMSIZ];
22 __u8 invert;
23 __u8 bitmask;
24};
25 6
26#endif /*_XT_PHYSDEV_H*/ 7#endif /*_XT_PHYSDEV_H*/
diff --git a/include/linux/netfilter_arp/Kbuild b/include/linux/netfilter_arp/Kbuild
deleted file mode 100644
index b27439c71037..000000000000
--- a/include/linux/netfilter_arp/Kbuild
+++ /dev/null
@@ -1,2 +0,0 @@
1header-y += arp_tables.h
2header-y += arpt_mangle.h
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index e08565d45178..cfb7191e6efa 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -5,211 +5,14 @@
5 * network byte order. 5 * network byte order.
6 * flags are stored in host byte order (of course). 6 * flags are stored in host byte order (of course).
7 */ 7 */
8
9#ifndef _ARPTABLES_H 8#ifndef _ARPTABLES_H
10#define _ARPTABLES_H 9#define _ARPTABLES_H
11 10
12#ifdef __KERNEL__
13#include <linux/if.h> 11#include <linux/if.h>
14#include <linux/in.h> 12#include <linux/in.h>
15#include <linux/if_arp.h> 13#include <linux/if_arp.h>
16#include <linux/skbuff.h> 14#include <linux/skbuff.h>
17#endif 15#include <uapi/linux/netfilter_arp/arp_tables.h>
18#include <linux/types.h>
19#include <linux/compiler.h>
20#include <linux/netfilter_arp.h>
21
22#include <linux/netfilter/x_tables.h>
23
24#ifndef __KERNEL__
25#define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
26#define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
27#define arpt_entry_target xt_entry_target
28#define arpt_standard_target xt_standard_target
29#define arpt_error_target xt_error_target
30#define ARPT_CONTINUE XT_CONTINUE
31#define ARPT_RETURN XT_RETURN
32#define arpt_counters_info xt_counters_info
33#define arpt_counters xt_counters
34#define ARPT_STANDARD_TARGET XT_STANDARD_TARGET
35#define ARPT_ERROR_TARGET XT_ERROR_TARGET
36#define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \
37 XT_ENTRY_ITERATE(struct arpt_entry, entries, size, fn, ## args)
38#endif
39
40#define ARPT_DEV_ADDR_LEN_MAX 16
41
42struct arpt_devaddr_info {
43 char addr[ARPT_DEV_ADDR_LEN_MAX];
44 char mask[ARPT_DEV_ADDR_LEN_MAX];
45};
46
47/* Yes, Virginia, you have to zero the padding. */
48struct arpt_arp {
49 /* Source and target IP addr */
50 struct in_addr src, tgt;
51 /* Mask for src and target IP addr */
52 struct in_addr smsk, tmsk;
53
54 /* Device hw address length, src+target device addresses */
55 __u8 arhln, arhln_mask;
56 struct arpt_devaddr_info src_devaddr;
57 struct arpt_devaddr_info tgt_devaddr;
58
59 /* ARP operation code. */
60 __be16 arpop, arpop_mask;
61
62 /* ARP hardware address and protocol address format. */
63 __be16 arhrd, arhrd_mask;
64 __be16 arpro, arpro_mask;
65
66 /* The protocol address length is only accepted if it is 4
67 * so there is no use in offering a way to do filtering on it.
68 */
69
70 char iniface[IFNAMSIZ], outiface[IFNAMSIZ];
71 unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
72
73 /* Flags word */
74 __u8 flags;
75 /* Inverse flags */
76 __u16 invflags;
77};
78
79/* Values for "flag" field in struct arpt_ip (general arp structure).
80 * No flags defined yet.
81 */
82#define ARPT_F_MASK 0x00 /* All possible flag bits mask. */
83
84/* Values for "inv" field in struct arpt_arp. */
85#define ARPT_INV_VIA_IN 0x0001 /* Invert the sense of IN IFACE. */
86#define ARPT_INV_VIA_OUT 0x0002 /* Invert the sense of OUT IFACE */
87#define ARPT_INV_SRCIP 0x0004 /* Invert the sense of SRC IP. */
88#define ARPT_INV_TGTIP 0x0008 /* Invert the sense of TGT IP. */
89#define ARPT_INV_SRCDEVADDR 0x0010 /* Invert the sense of SRC DEV ADDR. */
90#define ARPT_INV_TGTDEVADDR 0x0020 /* Invert the sense of TGT DEV ADDR. */
91#define ARPT_INV_ARPOP 0x0040 /* Invert the sense of ARP OP. */
92#define ARPT_INV_ARPHRD 0x0080 /* Invert the sense of ARP HRD. */
93#define ARPT_INV_ARPPRO 0x0100 /* Invert the sense of ARP PRO. */
94#define ARPT_INV_ARPHLN 0x0200 /* Invert the sense of ARP HLN. */
95#define ARPT_INV_MASK 0x03FF /* All possible flag bits mask. */
96
97/* This structure defines each of the firewall rules. Consists of 3
98 parts which are 1) general ARP header stuff 2) match specific
99 stuff 3) the target to perform if the rule matches */
100struct arpt_entry
101{
102 struct arpt_arp arp;
103
104 /* Size of arpt_entry + matches */
105 __u16 target_offset;
106 /* Size of arpt_entry + matches + target */
107 __u16 next_offset;
108
109 /* Back pointer */
110 unsigned int comefrom;
111
112 /* Packet and byte counters. */
113 struct xt_counters counters;
114
115 /* The matches (if any), then the target. */
116 unsigned char elems[0];
117};
118
119/*
120 * New IP firewall options for [gs]etsockopt at the RAW IP level.
121 * Unlike BSD Linux inherits IP options so you don't have to use a raw
122 * socket for this. Instead we check rights in the calls.
123 *
124 * ATTENTION: check linux/in.h before adding new number here.
125 */
126#define ARPT_BASE_CTL 96
127
128#define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL)
129#define ARPT_SO_SET_ADD_COUNTERS (ARPT_BASE_CTL + 1)
130#define ARPT_SO_SET_MAX ARPT_SO_SET_ADD_COUNTERS
131
132#define ARPT_SO_GET_INFO (ARPT_BASE_CTL)
133#define ARPT_SO_GET_ENTRIES (ARPT_BASE_CTL + 1)
134/* #define ARPT_SO_GET_REVISION_MATCH (APRT_BASE_CTL + 2) */
135#define ARPT_SO_GET_REVISION_TARGET (ARPT_BASE_CTL + 3)
136#define ARPT_SO_GET_MAX (ARPT_SO_GET_REVISION_TARGET)
137
138/* The argument to ARPT_SO_GET_INFO */
139struct arpt_getinfo {
140 /* Which table: caller fills this in. */
141 char name[XT_TABLE_MAXNAMELEN];
142
143 /* Kernel fills these in. */
144 /* Which hook entry points are valid: bitmask */
145 unsigned int valid_hooks;
146
147 /* Hook entry points: one per netfilter hook. */
148 unsigned int hook_entry[NF_ARP_NUMHOOKS];
149
150 /* Underflow points. */
151 unsigned int underflow[NF_ARP_NUMHOOKS];
152
153 /* Number of entries */
154 unsigned int num_entries;
155
156 /* Size of entries. */
157 unsigned int size;
158};
159
160/* The argument to ARPT_SO_SET_REPLACE. */
161struct arpt_replace {
162 /* Which table. */
163 char name[XT_TABLE_MAXNAMELEN];
164
165 /* Which hook entry points are valid: bitmask. You can't
166 change this. */
167 unsigned int valid_hooks;
168
169 /* Number of entries */
170 unsigned int num_entries;
171
172 /* Total size of new entries */
173 unsigned int size;
174
175 /* Hook entry points. */
176 unsigned int hook_entry[NF_ARP_NUMHOOKS];
177
178 /* Underflow points. */
179 unsigned int underflow[NF_ARP_NUMHOOKS];
180
181 /* Information about old entries: */
182 /* Number of counters (must be equal to current number of entries). */
183 unsigned int num_counters;
184 /* The old entries' counters. */
185 struct xt_counters __user *counters;
186
187 /* The entries (hang off end: not really an array). */
188 struct arpt_entry entries[0];
189};
190
191/* The argument to ARPT_SO_GET_ENTRIES. */
192struct arpt_get_entries {
193 /* Which table: user fills this in. */
194 char name[XT_TABLE_MAXNAMELEN];
195
196 /* User fills this in: total entry size. */
197 unsigned int size;
198
199 /* The entries. */
200 struct arpt_entry entrytable[0];
201};
202
203/* Helper functions */
204static __inline__ struct xt_entry_target *arpt_get_target(struct arpt_entry *e)
205{
206 return (void *)e + e->target_offset;
207}
208
209/*
210 * Main firewall chains definitions and global var's definitions.
211 */
212#ifdef __KERNEL__
213 16
214/* Standard entry. */ 17/* Standard entry. */
215struct arpt_standard { 18struct arpt_standard {
@@ -274,5 +77,4 @@ compat_arpt_get_target(struct compat_arpt_entry *e)
274} 77}
275 78
276#endif /* CONFIG_COMPAT */ 79#endif /* CONFIG_COMPAT */
277#endif /*__KERNEL__*/
278#endif /* _ARPTABLES_H */ 80#endif /* _ARPTABLES_H */
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 31d2844e6572..dfb4d9e52bcb 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -1,30 +1,8 @@
1#ifndef __LINUX_BRIDGE_NETFILTER_H 1#ifndef __LINUX_BRIDGE_NETFILTER_H
2#define __LINUX_BRIDGE_NETFILTER_H 2#define __LINUX_BRIDGE_NETFILTER_H
3 3
4/* bridge-specific defines for netfilter. 4#include <uapi/linux/netfilter_bridge.h>
5 */ 5
6
7#include <linux/netfilter.h>
8#include <linux/if_ether.h>
9#include <linux/if_vlan.h>
10#include <linux/if_pppox.h>
11
12/* Bridge Hooks */
13/* After promisc drops, checksum checks. */
14#define NF_BR_PRE_ROUTING 0
15/* If the packet is destined for this box. */
16#define NF_BR_LOCAL_IN 1
17/* If the packet is destined for another interface. */
18#define NF_BR_FORWARD 2
19/* Packets coming from a local process. */
20#define NF_BR_LOCAL_OUT 3
21/* Packets about to hit the wire. */
22#define NF_BR_POST_ROUTING 4
23/* Not really a hook, but used for the ebtables broute table */
24#define NF_BR_BROUTING 5
25#define NF_BR_NUMHOOKS 6
26
27#ifdef __KERNEL__
28 6
29enum nf_br_hook_priorities { 7enum nf_br_hook_priorities {
30 NF_BR_PRI_FIRST = INT_MIN, 8 NF_BR_PRI_FIRST = INT_MIN,
@@ -118,5 +96,4 @@ static inline void br_drop_fake_rtable(struct sk_buff *skb)
118#define br_drop_fake_rtable(skb) do { } while (0) 96#define br_drop_fake_rtable(skb) do { } while (0)
119#endif /* CONFIG_BRIDGE_NETFILTER */ 97#endif /* CONFIG_BRIDGE_NETFILTER */
120 98
121#endif /* __KERNEL__ */
122#endif 99#endif
diff --git a/include/linux/netfilter_bridge/Kbuild b/include/linux/netfilter_bridge/Kbuild
deleted file mode 100644
index e48f1a3f5a4a..000000000000
--- a/include/linux/netfilter_bridge/Kbuild
+++ /dev/null
@@ -1,18 +0,0 @@
1header-y += ebt_802_3.h
2header-y += ebt_among.h
3header-y += ebt_arp.h
4header-y += ebt_arpreply.h
5header-y += ebt_ip.h
6header-y += ebt_ip6.h
7header-y += ebt_limit.h
8header-y += ebt_log.h
9header-y += ebt_mark_m.h
10header-y += ebt_mark_t.h
11header-y += ebt_nat.h
12header-y += ebt_nflog.h
13header-y += ebt_pkttype.h
14header-y += ebt_redirect.h
15header-y += ebt_stp.h
16header-y += ebt_ulog.h
17header-y += ebt_vlan.h
18header-y += ebtables.h
diff --git a/include/linux/netfilter_bridge/ebt_802_3.h b/include/linux/netfilter_bridge/ebt_802_3.h
index be5be1577a56..e17e8bfb4e8b 100644
--- a/include/linux/netfilter_bridge/ebt_802_3.h
+++ b/include/linux/netfilter_bridge/ebt_802_3.h
@@ -1,70 +1,11 @@
1#ifndef __LINUX_BRIDGE_EBT_802_3_H 1#ifndef __LINUX_BRIDGE_EBT_802_3_H
2#define __LINUX_BRIDGE_EBT_802_3_H 2#define __LINUX_BRIDGE_EBT_802_3_H
3 3
4#include <linux/types.h>
5
6#define EBT_802_3_SAP 0x01
7#define EBT_802_3_TYPE 0x02
8
9#define EBT_802_3_MATCH "802_3"
10
11/*
12 * If frame has DSAP/SSAP value 0xaa you must check the SNAP type
13 * to discover what kind of packet we're carrying.
14 */
15#define CHECK_TYPE 0xaa
16
17/*
18 * Control field may be one or two bytes. If the first byte has
19 * the value 0x03 then the entire length is one byte, otherwise it is two.
20 * One byte controls are used in Unnumbered Information frames.
21 * Two byte controls are used in Numbered Information frames.
22 */
23#define IS_UI 0x03
24
25#define EBT_802_3_MASK (EBT_802_3_SAP | EBT_802_3_TYPE | EBT_802_3)
26
27/* ui has one byte ctrl, ni has two */
28struct hdr_ui {
29 __u8 dsap;
30 __u8 ssap;
31 __u8 ctrl;
32 __u8 orig[3];
33 __be16 type;
34};
35
36struct hdr_ni {
37 __u8 dsap;
38 __u8 ssap;
39 __be16 ctrl;
40 __u8 orig[3];
41 __be16 type;
42};
43
44struct ebt_802_3_hdr {
45 __u8 daddr[6];
46 __u8 saddr[6];
47 __be16 len;
48 union {
49 struct hdr_ui ui;
50 struct hdr_ni ni;
51 } llc;
52};
53
54#ifdef __KERNEL__
55#include <linux/skbuff.h> 4#include <linux/skbuff.h>
5#include <uapi/linux/netfilter_bridge/ebt_802_3.h>
56 6
57static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb) 7static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb)
58{ 8{
59 return (struct ebt_802_3_hdr *)skb_mac_header(skb); 9 return (struct ebt_802_3_hdr *)skb_mac_header(skb);
60} 10}
61#endif 11#endif
62
63struct ebt_802_3_info {
64 __u8 sap;
65 __be16 type;
66 __u8 bitmask;
67 __u8 invflags;
68};
69
70#endif
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index 4dd5bd6994a8..34e7a2b7f867 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -9,191 +9,11 @@
9 * This code is stongly inspired on the iptables code which is 9 * This code is stongly inspired on the iptables code which is
10 * Copyright (C) 1999 Paul `Rusty' Russell & Michael J. Neuling 10 * Copyright (C) 1999 Paul `Rusty' Russell & Michael J. Neuling
11 */ 11 */
12
13#ifndef __LINUX_BRIDGE_EFF_H 12#ifndef __LINUX_BRIDGE_EFF_H
14#define __LINUX_BRIDGE_EFF_H 13#define __LINUX_BRIDGE_EFF_H
15#include <linux/if.h>
16#include <linux/netfilter_bridge.h>
17#include <linux/if_ether.h>
18
19#define EBT_TABLE_MAXNAMELEN 32
20#define EBT_CHAIN_MAXNAMELEN EBT_TABLE_MAXNAMELEN
21#define EBT_FUNCTION_MAXNAMELEN EBT_TABLE_MAXNAMELEN
22
23/* verdicts >0 are "branches" */
24#define EBT_ACCEPT -1
25#define EBT_DROP -2
26#define EBT_CONTINUE -3
27#define EBT_RETURN -4
28#define NUM_STANDARD_TARGETS 4
29/* ebtables target modules store the verdict inside an int. We can
30 * reclaim a part of this int for backwards compatible extensions.
31 * The 4 lsb are more than enough to store the verdict. */
32#define EBT_VERDICT_BITS 0x0000000F
33
34struct xt_match;
35struct xt_target;
36
37struct ebt_counter {
38 uint64_t pcnt;
39 uint64_t bcnt;
40};
41 14
42struct ebt_replace { 15#include <uapi/linux/netfilter_bridge/ebtables.h>
43 char name[EBT_TABLE_MAXNAMELEN];
44 unsigned int valid_hooks;
45 /* nr of rules in the table */
46 unsigned int nentries;
47 /* total size of the entries */
48 unsigned int entries_size;
49 /* start of the chains */
50 struct ebt_entries __user *hook_entry[NF_BR_NUMHOOKS];
51 /* nr of counters userspace expects back */
52 unsigned int num_counters;
53 /* where the kernel will put the old counters */
54 struct ebt_counter __user *counters;
55 char __user *entries;
56};
57 16
58struct ebt_replace_kernel {
59 char name[EBT_TABLE_MAXNAMELEN];
60 unsigned int valid_hooks;
61 /* nr of rules in the table */
62 unsigned int nentries;
63 /* total size of the entries */
64 unsigned int entries_size;
65 /* start of the chains */
66 struct ebt_entries *hook_entry[NF_BR_NUMHOOKS];
67 /* nr of counters userspace expects back */
68 unsigned int num_counters;
69 /* where the kernel will put the old counters */
70 struct ebt_counter *counters;
71 char *entries;
72};
73
74struct ebt_entries {
75 /* this field is always set to zero
76 * See EBT_ENTRY_OR_ENTRIES.
77 * Must be same size as ebt_entry.bitmask */
78 unsigned int distinguisher;
79 /* the chain name */
80 char name[EBT_CHAIN_MAXNAMELEN];
81 /* counter offset for this chain */
82 unsigned int counter_offset;
83 /* one standard (accept, drop, return) per hook */
84 int policy;
85 /* nr. of entries */
86 unsigned int nentries;
87 /* entry list */
88 char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace))));
89};
90
91/* used for the bitmask of struct ebt_entry */
92
93/* This is a hack to make a difference between an ebt_entry struct and an
94 * ebt_entries struct when traversing the entries from start to end.
95 * Using this simplifies the code a lot, while still being able to use
96 * ebt_entries.
97 * Contrary, iptables doesn't use something like ebt_entries and therefore uses
98 * different techniques for naming the policy and such. So, iptables doesn't
99 * need a hack like this.
100 */
101#define EBT_ENTRY_OR_ENTRIES 0x01
102/* these are the normal masks */
103#define EBT_NOPROTO 0x02
104#define EBT_802_3 0x04
105#define EBT_SOURCEMAC 0x08
106#define EBT_DESTMAC 0x10
107#define EBT_F_MASK (EBT_NOPROTO | EBT_802_3 | EBT_SOURCEMAC | EBT_DESTMAC \
108 | EBT_ENTRY_OR_ENTRIES)
109
110#define EBT_IPROTO 0x01
111#define EBT_IIN 0x02
112#define EBT_IOUT 0x04
113#define EBT_ISOURCE 0x8
114#define EBT_IDEST 0x10
115#define EBT_ILOGICALIN 0x20
116#define EBT_ILOGICALOUT 0x40
117#define EBT_INV_MASK (EBT_IPROTO | EBT_IIN | EBT_IOUT | EBT_ILOGICALIN \
118 | EBT_ILOGICALOUT | EBT_ISOURCE | EBT_IDEST)
119
120struct ebt_entry_match {
121 union {
122 char name[EBT_FUNCTION_MAXNAMELEN];
123 struct xt_match *match;
124 } u;
125 /* size of data */
126 unsigned int match_size;
127 unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace))));
128};
129
130struct ebt_entry_watcher {
131 union {
132 char name[EBT_FUNCTION_MAXNAMELEN];
133 struct xt_target *watcher;
134 } u;
135 /* size of data */
136 unsigned int watcher_size;
137 unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace))));
138};
139
140struct ebt_entry_target {
141 union {
142 char name[EBT_FUNCTION_MAXNAMELEN];
143 struct xt_target *target;
144 } u;
145 /* size of data */
146 unsigned int target_size;
147 unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace))));
148};
149
150#define EBT_STANDARD_TARGET "standard"
151struct ebt_standard_target {
152 struct ebt_entry_target target;
153 int verdict;
154};
155
156/* one entry */
157struct ebt_entry {
158 /* this needs to be the first field */
159 unsigned int bitmask;
160 unsigned int invflags;
161 __be16 ethproto;
162 /* the physical in-dev */
163 char in[IFNAMSIZ];
164 /* the logical in-dev */
165 char logical_in[IFNAMSIZ];
166 /* the physical out-dev */
167 char out[IFNAMSIZ];
168 /* the logical out-dev */
169 char logical_out[IFNAMSIZ];
170 unsigned char sourcemac[ETH_ALEN];
171 unsigned char sourcemsk[ETH_ALEN];
172 unsigned char destmac[ETH_ALEN];
173 unsigned char destmsk[ETH_ALEN];
174 /* sizeof ebt_entry + matches */
175 unsigned int watchers_offset;
176 /* sizeof ebt_entry + matches + watchers */
177 unsigned int target_offset;
178 /* sizeof ebt_entry + matches + watchers + target */
179 unsigned int next_offset;
180 unsigned char elems[0] __attribute__ ((aligned (__alignof__(struct ebt_replace))));
181};
182
183/* {g,s}etsockopt numbers */
184#define EBT_BASE_CTL 128
185
186#define EBT_SO_SET_ENTRIES (EBT_BASE_CTL)
187#define EBT_SO_SET_COUNTERS (EBT_SO_SET_ENTRIES+1)
188#define EBT_SO_SET_MAX (EBT_SO_SET_COUNTERS+1)
189
190#define EBT_SO_GET_INFO (EBT_BASE_CTL)
191#define EBT_SO_GET_ENTRIES (EBT_SO_GET_INFO+1)
192#define EBT_SO_GET_INIT_INFO (EBT_SO_GET_ENTRIES+1)
193#define EBT_SO_GET_INIT_ENTRIES (EBT_SO_GET_INIT_INFO+1)
194#define EBT_SO_GET_MAX (EBT_SO_GET_INIT_ENTRIES+1)
195
196#ifdef __KERNEL__
197 17
198/* return values for match() functions */ 18/* return values for match() functions */
199#define EBT_MATCH 0 19#define EBT_MATCH 0
@@ -304,77 +124,4 @@ extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb,
304/* True if the target is not a standard target */ 124/* True if the target is not a standard target */
305#define INVALID_TARGET (info->target < -NUM_STANDARD_TARGETS || info->target >= 0) 125#define INVALID_TARGET (info->target < -NUM_STANDARD_TARGETS || info->target >= 0)
306 126
307#endif /* __KERNEL__ */
308
309/* blatently stolen from ip_tables.h
310 * fn returns 0 to continue iteration */
311#define EBT_MATCH_ITERATE(e, fn, args...) \
312({ \
313 unsigned int __i; \
314 int __ret = 0; \
315 struct ebt_entry_match *__match; \
316 \
317 for (__i = sizeof(struct ebt_entry); \
318 __i < (e)->watchers_offset; \
319 __i += __match->match_size + \
320 sizeof(struct ebt_entry_match)) { \
321 __match = (void *)(e) + __i; \
322 \
323 __ret = fn(__match , ## args); \
324 if (__ret != 0) \
325 break; \
326 } \
327 if (__ret == 0) { \
328 if (__i != (e)->watchers_offset) \
329 __ret = -EINVAL; \
330 } \
331 __ret; \
332})
333
334#define EBT_WATCHER_ITERATE(e, fn, args...) \
335({ \
336 unsigned int __i; \
337 int __ret = 0; \
338 struct ebt_entry_watcher *__watcher; \
339 \
340 for (__i = e->watchers_offset; \
341 __i < (e)->target_offset; \
342 __i += __watcher->watcher_size + \
343 sizeof(struct ebt_entry_watcher)) { \
344 __watcher = (void *)(e) + __i; \
345 \
346 __ret = fn(__watcher , ## args); \
347 if (__ret != 0) \
348 break; \
349 } \
350 if (__ret == 0) { \
351 if (__i != (e)->target_offset) \
352 __ret = -EINVAL; \
353 } \
354 __ret; \
355})
356
357#define EBT_ENTRY_ITERATE(entries, size, fn, args...) \
358({ \
359 unsigned int __i; \
360 int __ret = 0; \
361 struct ebt_entry *__entry; \
362 \
363 for (__i = 0; __i < (size);) { \
364 __entry = (void *)(entries) + __i; \
365 __ret = fn(__entry , ## args); \
366 if (__ret != 0) \
367 break; \
368 if (__entry->bitmask != 0) \
369 __i += __entry->next_offset; \
370 else \
371 __i += sizeof(struct ebt_entries); \
372 } \
373 if (__ret == 0) { \
374 if (__i != (size)) \
375 __ret = -EINVAL; \
376 } \
377 __ret; \
378})
379
380#endif 127#endif
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index b962dfc695ae..dfaf116b3e81 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -1,86 +1,12 @@
1#ifndef __LINUX_IP_NETFILTER_H
2#define __LINUX_IP_NETFILTER_H
3
4/* IPv4-specific defines for netfilter. 1/* IPv4-specific defines for netfilter.
5 * (C)1998 Rusty Russell -- This code is GPL. 2 * (C)1998 Rusty Russell -- This code is GPL.
6 */ 3 */
4#ifndef __LINUX_IP_NETFILTER_H
5#define __LINUX_IP_NETFILTER_H
7 6
8#include <linux/netfilter.h> 7#include <uapi/linux/netfilter_ipv4.h>
9
10/* only for userspace compatibility */
11#ifndef __KERNEL__
12
13#include <limits.h> /* for INT_MIN, INT_MAX */
14
15/* IP Cache bits. */
16/* Src IP address. */
17#define NFC_IP_SRC 0x0001
18/* Dest IP address. */
19#define NFC_IP_DST 0x0002
20/* Input device. */
21#define NFC_IP_IF_IN 0x0004
22/* Output device. */
23#define NFC_IP_IF_OUT 0x0008
24/* TOS. */
25#define NFC_IP_TOS 0x0010
26/* Protocol. */
27#define NFC_IP_PROTO 0x0020
28/* IP options. */
29#define NFC_IP_OPTIONS 0x0040
30/* Frag & flags. */
31#define NFC_IP_FRAG 0x0080
32
33/* Per-protocol information: only matters if proto match. */
34/* TCP flags. */
35#define NFC_IP_TCPFLAGS 0x0100
36/* Source port. */
37#define NFC_IP_SRC_PT 0x0200
38/* Dest port. */
39#define NFC_IP_DST_PT 0x0400
40/* Something else about the proto */
41#define NFC_IP_PROTO_UNKNOWN 0x2000
42
43/* IP Hooks */
44/* After promisc drops, checksum checks. */
45#define NF_IP_PRE_ROUTING 0
46/* If the packet is destined for this box. */
47#define NF_IP_LOCAL_IN 1
48/* If the packet is destined for another interface. */
49#define NF_IP_FORWARD 2
50/* Packets coming from a local process. */
51#define NF_IP_LOCAL_OUT 3
52/* Packets about to hit the wire. */
53#define NF_IP_POST_ROUTING 4
54#define NF_IP_NUMHOOKS 5
55#endif /* ! __KERNEL__ */
56
57enum nf_ip_hook_priorities {
58 NF_IP_PRI_FIRST = INT_MIN,
59 NF_IP_PRI_CONNTRACK_DEFRAG = -400,
60 NF_IP_PRI_RAW = -300,
61 NF_IP_PRI_SELINUX_FIRST = -225,
62 NF_IP_PRI_CONNTRACK = -200,
63 NF_IP_PRI_MANGLE = -150,
64 NF_IP_PRI_NAT_DST = -100,
65 NF_IP_PRI_FILTER = 0,
66 NF_IP_PRI_SECURITY = 50,
67 NF_IP_PRI_NAT_SRC = 100,
68 NF_IP_PRI_SELINUX_LAST = 225,
69 NF_IP_PRI_CONNTRACK_HELPER = 300,
70 NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX,
71 NF_IP_PRI_LAST = INT_MAX,
72};
73
74/* Arguments for setsockopt SOL_IP: */
75/* 2.0 firewalling went from 64 through 71 (and +256, +512, etc). */
76/* 2.2 firewalling (+ masq) went from 64 through 76 */
77/* 2.4 firewalling went 64 through 67. */
78#define SO_ORIGINAL_DST 80
79 8
80#ifdef __KERNEL__
81extern int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type); 9extern int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type);
82extern __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook, 10extern __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
83 unsigned int dataoff, u_int8_t protocol); 11 unsigned int dataoff, u_int8_t protocol);
84#endif /*__KERNEL__*/
85
86#endif /*__LINUX_IP_NETFILTER_H*/ 12#endif /*__LINUX_IP_NETFILTER_H*/
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
deleted file mode 100644
index 8ba0c5b72ea9..000000000000
--- a/include/linux/netfilter_ipv4/Kbuild
+++ /dev/null
@@ -1,10 +0,0 @@
1header-y += ip_tables.h
2header-y += ipt_CLUSTERIP.h
3header-y += ipt_ECN.h
4header-y += ipt_LOG.h
5header-y += ipt_REJECT.h
6header-y += ipt_TTL.h
7header-y += ipt_ULOG.h
8header-y += ipt_ah.h
9header-y += ipt_ecn.h
10header-y += ipt_ttl.h
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index db79231914ce..901e84db847d 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -11,230 +11,17 @@
11 * flags are stored in host byte order (of course). 11 * flags are stored in host byte order (of course).
12 * Port numbers are stored in HOST byte order. 12 * Port numbers are stored in HOST byte order.
13 */ 13 */
14
15#ifndef _IPTABLES_H 14#ifndef _IPTABLES_H
16#define _IPTABLES_H 15#define _IPTABLES_H
17 16
18#ifdef __KERNEL__
19#include <linux/if.h> 17#include <linux/if.h>
20#include <linux/in.h> 18#include <linux/in.h>
21#include <linux/ip.h> 19#include <linux/ip.h>
22#include <linux/skbuff.h> 20#include <linux/skbuff.h>
23#endif
24#include <linux/types.h>
25#include <linux/compiler.h>
26#include <linux/netfilter_ipv4.h>
27
28#include <linux/netfilter/x_tables.h>
29
30#ifndef __KERNEL__
31#define IPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
32#define IPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
33#define ipt_match xt_match
34#define ipt_target xt_target
35#define ipt_table xt_table
36#define ipt_get_revision xt_get_revision
37#define ipt_entry_match xt_entry_match
38#define ipt_entry_target xt_entry_target
39#define ipt_standard_target xt_standard_target
40#define ipt_error_target xt_error_target
41#define ipt_counters xt_counters
42#define IPT_CONTINUE XT_CONTINUE
43#define IPT_RETURN XT_RETURN
44
45/* This group is older than old (iptables < v1.4.0-rc1~89) */
46#include <linux/netfilter/xt_tcpudp.h>
47#define ipt_udp xt_udp
48#define ipt_tcp xt_tcp
49#define IPT_TCP_INV_SRCPT XT_TCP_INV_SRCPT
50#define IPT_TCP_INV_DSTPT XT_TCP_INV_DSTPT
51#define IPT_TCP_INV_FLAGS XT_TCP_INV_FLAGS
52#define IPT_TCP_INV_OPTION XT_TCP_INV_OPTION
53#define IPT_TCP_INV_MASK XT_TCP_INV_MASK
54#define IPT_UDP_INV_SRCPT XT_UDP_INV_SRCPT
55#define IPT_UDP_INV_DSTPT XT_UDP_INV_DSTPT
56#define IPT_UDP_INV_MASK XT_UDP_INV_MASK
57
58/* The argument to IPT_SO_ADD_COUNTERS. */
59#define ipt_counters_info xt_counters_info
60/* Standard return verdict, or do jump. */
61#define IPT_STANDARD_TARGET XT_STANDARD_TARGET
62/* Error verdict. */
63#define IPT_ERROR_TARGET XT_ERROR_TARGET
64
65/* fn returns 0 to continue iteration */
66#define IPT_MATCH_ITERATE(e, fn, args...) \
67 XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args)
68
69/* fn returns 0 to continue iteration */
70#define IPT_ENTRY_ITERATE(entries, size, fn, args...) \
71 XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args)
72#endif
73
74/* Yes, Virginia, you have to zero the padding. */
75struct ipt_ip {
76 /* Source and destination IP addr */
77 struct in_addr src, dst;
78 /* Mask for src and dest IP addr */
79 struct in_addr smsk, dmsk;
80 char iniface[IFNAMSIZ], outiface[IFNAMSIZ];
81 unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
82
83 /* Protocol, 0 = ANY */
84 __u16 proto;
85
86 /* Flags word */
87 __u8 flags;
88 /* Inverse flags */
89 __u8 invflags;
90};
91
92/* Values for "flag" field in struct ipt_ip (general ip structure). */
93#define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */
94#define IPT_F_GOTO 0x02 /* Set if jump is a goto */
95#define IPT_F_MASK 0x03 /* All possible flag bits mask. */
96
97/* Values for "inv" field in struct ipt_ip. */
98#define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */
99#define IPT_INV_VIA_OUT 0x02 /* Invert the sense of OUT IFACE */
100#define IPT_INV_TOS 0x04 /* Invert the sense of TOS. */
101#define IPT_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */
102#define IPT_INV_DSTIP 0x10 /* Invert the sense of DST OP. */
103#define IPT_INV_FRAG 0x20 /* Invert the sense of FRAG. */
104#define IPT_INV_PROTO XT_INV_PROTO
105#define IPT_INV_MASK 0x7F /* All possible flag bits mask. */
106
107/* This structure defines each of the firewall rules. Consists of 3
108 parts which are 1) general IP header stuff 2) match specific
109 stuff 3) the target to perform if the rule matches */
110struct ipt_entry {
111 struct ipt_ip ip;
112
113 /* Mark with fields that we care about. */
114 unsigned int nfcache;
115
116 /* Size of ipt_entry + matches */
117 __u16 target_offset;
118 /* Size of ipt_entry + matches + target */
119 __u16 next_offset;
120
121 /* Back pointer */
122 unsigned int comefrom;
123
124 /* Packet and byte counters. */
125 struct xt_counters counters;
126
127 /* The matches (if any), then the target. */
128 unsigned char elems[0];
129};
130
131/*
132 * New IP firewall options for [gs]etsockopt at the RAW IP level.
133 * Unlike BSD Linux inherits IP options so you don't have to use a raw
134 * socket for this. Instead we check rights in the calls.
135 *
136 * ATTENTION: check linux/in.h before adding new number here.
137 */
138#define IPT_BASE_CTL 64
139
140#define IPT_SO_SET_REPLACE (IPT_BASE_CTL)
141#define IPT_SO_SET_ADD_COUNTERS (IPT_BASE_CTL + 1)
142#define IPT_SO_SET_MAX IPT_SO_SET_ADD_COUNTERS
143
144#define IPT_SO_GET_INFO (IPT_BASE_CTL)
145#define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1)
146#define IPT_SO_GET_REVISION_MATCH (IPT_BASE_CTL + 2)
147#define IPT_SO_GET_REVISION_TARGET (IPT_BASE_CTL + 3)
148#define IPT_SO_GET_MAX IPT_SO_GET_REVISION_TARGET
149
150/* ICMP matching stuff */
151struct ipt_icmp {
152 __u8 type; /* type to match */
153 __u8 code[2]; /* range of code */
154 __u8 invflags; /* Inverse flags */
155};
156
157/* Values for "inv" field for struct ipt_icmp. */
158#define IPT_ICMP_INV 0x01 /* Invert the sense of type/code test */
159
160/* The argument to IPT_SO_GET_INFO */
161struct ipt_getinfo {
162 /* Which table: caller fills this in. */
163 char name[XT_TABLE_MAXNAMELEN];
164
165 /* Kernel fills these in. */
166 /* Which hook entry points are valid: bitmask */
167 unsigned int valid_hooks;
168
169 /* Hook entry points: one per netfilter hook. */
170 unsigned int hook_entry[NF_INET_NUMHOOKS];
171
172 /* Underflow points. */
173 unsigned int underflow[NF_INET_NUMHOOKS];
174
175 /* Number of entries */
176 unsigned int num_entries;
177
178 /* Size of entries. */
179 unsigned int size;
180};
181
182/* The argument to IPT_SO_SET_REPLACE. */
183struct ipt_replace {
184 /* Which table. */
185 char name[XT_TABLE_MAXNAMELEN];
186
187 /* Which hook entry points are valid: bitmask. You can't
188 change this. */
189 unsigned int valid_hooks;
190
191 /* Number of entries */
192 unsigned int num_entries;
193
194 /* Total size of new entries */
195 unsigned int size;
196
197 /* Hook entry points. */
198 unsigned int hook_entry[NF_INET_NUMHOOKS];
199
200 /* Underflow points. */
201 unsigned int underflow[NF_INET_NUMHOOKS];
202
203 /* Information about old entries: */
204 /* Number of counters (must be equal to current number of entries). */
205 unsigned int num_counters;
206 /* The old entries' counters. */
207 struct xt_counters __user *counters;
208
209 /* The entries (hang off end: not really an array). */
210 struct ipt_entry entries[0];
211};
212
213/* The argument to IPT_SO_GET_ENTRIES. */
214struct ipt_get_entries {
215 /* Which table: user fills this in. */
216 char name[XT_TABLE_MAXNAMELEN];
217
218 /* User fills this in: total entry size. */
219 unsigned int size;
220
221 /* The entries. */
222 struct ipt_entry entrytable[0];
223};
224
225/* Helper functions */
226static __inline__ struct xt_entry_target *
227ipt_get_target(struct ipt_entry *e)
228{
229 return (void *)e + e->target_offset;
230}
231
232/*
233 * Main firewall chains definitions and global var's definitions.
234 */
235#ifdef __KERNEL__
236 21
237#include <linux/init.h> 22#include <linux/init.h>
23#include <uapi/linux/netfilter_ipv4/ip_tables.h>
24
238extern void ipt_init(void) __init; 25extern void ipt_init(void) __init;
239 26
240extern struct xt_table *ipt_register_table(struct net *net, 27extern struct xt_table *ipt_register_table(struct net *net,
@@ -303,5 +90,4 @@ compat_ipt_get_target(struct compat_ipt_entry *e)
303} 90}
304 91
305#endif /* CONFIG_COMPAT */ 92#endif /* CONFIG_COMPAT */
306#endif /*__KERNEL__*/
307#endif /* _IPTABLES_H */ 93#endif /* _IPTABLES_H */
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h
index 7c8a513ce7a3..98ffb54988b6 100644
--- a/include/linux/netfilter_ipv6.h
+++ b/include/linux/netfilter_ipv6.h
@@ -1,81 +1,14 @@
1#ifndef __LINUX_IP6_NETFILTER_H
2#define __LINUX_IP6_NETFILTER_H
3
4/* IPv6-specific defines for netfilter. 1/* IPv6-specific defines for netfilter.
5 * (C)1998 Rusty Russell -- This code is GPL. 2 * (C)1998 Rusty Russell -- This code is GPL.
6 * (C)1999 David Jeffery 3 * (C)1999 David Jeffery
7 * this header was blatantly ripped from netfilter_ipv4.h 4 * this header was blatantly ripped from netfilter_ipv4.h
8 * it's amazing what adding a bunch of 6s can do =8^) 5 * it's amazing what adding a bunch of 6s can do =8^)
9 */ 6 */
7#ifndef __LINUX_IP6_NETFILTER_H
8#define __LINUX_IP6_NETFILTER_H
10 9
11#include <linux/netfilter.h> 10#include <uapi/linux/netfilter_ipv6.h>
12
13/* only for userspace compatibility */
14#ifndef __KERNEL__
15
16#include <limits.h> /* for INT_MIN, INT_MAX */
17
18/* IP Cache bits. */
19/* Src IP address. */
20#define NFC_IP6_SRC 0x0001
21/* Dest IP address. */
22#define NFC_IP6_DST 0x0002
23/* Input device. */
24#define NFC_IP6_IF_IN 0x0004
25/* Output device. */
26#define NFC_IP6_IF_OUT 0x0008
27/* TOS. */
28#define NFC_IP6_TOS 0x0010
29/* Protocol. */
30#define NFC_IP6_PROTO 0x0020
31/* IP options. */
32#define NFC_IP6_OPTIONS 0x0040
33/* Frag & flags. */
34#define NFC_IP6_FRAG 0x0080
35
36
37/* Per-protocol information: only matters if proto match. */
38/* TCP flags. */
39#define NFC_IP6_TCPFLAGS 0x0100
40/* Source port. */
41#define NFC_IP6_SRC_PT 0x0200
42/* Dest port. */
43#define NFC_IP6_DST_PT 0x0400
44/* Something else about the proto */
45#define NFC_IP6_PROTO_UNKNOWN 0x2000
46
47/* IP6 Hooks */
48/* After promisc drops, checksum checks. */
49#define NF_IP6_PRE_ROUTING 0
50/* If the packet is destined for this box. */
51#define NF_IP6_LOCAL_IN 1
52/* If the packet is destined for another interface. */
53#define NF_IP6_FORWARD 2
54/* Packets coming from a local process. */
55#define NF_IP6_LOCAL_OUT 3
56/* Packets about to hit the wire. */
57#define NF_IP6_POST_ROUTING 4
58#define NF_IP6_NUMHOOKS 5
59#endif /* ! __KERNEL__ */
60
61
62enum nf_ip6_hook_priorities {
63 NF_IP6_PRI_FIRST = INT_MIN,
64 NF_IP6_PRI_CONNTRACK_DEFRAG = -400,
65 NF_IP6_PRI_RAW = -300,
66 NF_IP6_PRI_SELINUX_FIRST = -225,
67 NF_IP6_PRI_CONNTRACK = -200,
68 NF_IP6_PRI_MANGLE = -150,
69 NF_IP6_PRI_NAT_DST = -100,
70 NF_IP6_PRI_FILTER = 0,
71 NF_IP6_PRI_SECURITY = 50,
72 NF_IP6_PRI_NAT_SRC = 100,
73 NF_IP6_PRI_SELINUX_LAST = 225,
74 NF_IP6_PRI_CONNTRACK_HELPER = 300,
75 NF_IP6_PRI_LAST = INT_MAX,
76};
77 11
78#ifdef __KERNEL__
79 12
80#ifdef CONFIG_NETFILTER 13#ifdef CONFIG_NETFILTER
81extern int ip6_route_me_harder(struct sk_buff *skb); 14extern int ip6_route_me_harder(struct sk_buff *skb);
@@ -89,6 +22,4 @@ static inline int ipv6_netfilter_init(void) { return 0; }
89static inline void ipv6_netfilter_fini(void) { return; } 22static inline void ipv6_netfilter_fini(void) { return; }
90#endif /* CONFIG_NETFILTER */ 23#endif /* CONFIG_NETFILTER */
91 24
92#endif /* __KERNEL__ */
93
94#endif /*__LINUX_IP6_NETFILTER_H*/ 25#endif /*__LINUX_IP6_NETFILTER_H*/
diff --git a/include/linux/netfilter_ipv6/Kbuild b/include/linux/netfilter_ipv6/Kbuild
deleted file mode 100644
index b88c0058bf73..000000000000
--- a/include/linux/netfilter_ipv6/Kbuild
+++ /dev/null
@@ -1,12 +0,0 @@
1header-y += ip6_tables.h
2header-y += ip6t_HL.h
3header-y += ip6t_LOG.h
4header-y += ip6t_NPT.h
5header-y += ip6t_REJECT.h
6header-y += ip6t_ah.h
7header-y += ip6t_frag.h
8header-y += ip6t_hl.h
9header-y += ip6t_ipv6header.h
10header-y += ip6t_mh.h
11header-y += ip6t_opts.h
12header-y += ip6t_rt.h
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 08c2cbbaa32b..5f84c6229dc6 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -11,268 +11,17 @@
11 * flags are stored in host byte order (of course). 11 * flags are stored in host byte order (of course).
12 * Port numbers are stored in HOST byte order. 12 * Port numbers are stored in HOST byte order.
13 */ 13 */
14
15#ifndef _IP6_TABLES_H 14#ifndef _IP6_TABLES_H
16#define _IP6_TABLES_H 15#define _IP6_TABLES_H
17 16
18#ifdef __KERNEL__
19#include <linux/if.h> 17#include <linux/if.h>
20#include <linux/in6.h> 18#include <linux/in6.h>
21#include <linux/ipv6.h> 19#include <linux/ipv6.h>
22#include <linux/skbuff.h> 20#include <linux/skbuff.h>
23#endif
24#include <linux/types.h>
25#include <linux/compiler.h>
26#include <linux/netfilter_ipv6.h>
27
28#include <linux/netfilter/x_tables.h>
29
30#ifndef __KERNEL__
31#define IP6T_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
32#define IP6T_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
33#define ip6t_match xt_match
34#define ip6t_target xt_target
35#define ip6t_table xt_table
36#define ip6t_get_revision xt_get_revision
37#define ip6t_entry_match xt_entry_match
38#define ip6t_entry_target xt_entry_target
39#define ip6t_standard_target xt_standard_target
40#define ip6t_error_target xt_error_target
41#define ip6t_counters xt_counters
42#define IP6T_CONTINUE XT_CONTINUE
43#define IP6T_RETURN XT_RETURN
44
45/* Pre-iptables-1.4.0 */
46#include <linux/netfilter/xt_tcpudp.h>
47#define ip6t_tcp xt_tcp
48#define ip6t_udp xt_udp
49#define IP6T_TCP_INV_SRCPT XT_TCP_INV_SRCPT
50#define IP6T_TCP_INV_DSTPT XT_TCP_INV_DSTPT
51#define IP6T_TCP_INV_FLAGS XT_TCP_INV_FLAGS
52#define IP6T_TCP_INV_OPTION XT_TCP_INV_OPTION
53#define IP6T_TCP_INV_MASK XT_TCP_INV_MASK
54#define IP6T_UDP_INV_SRCPT XT_UDP_INV_SRCPT
55#define IP6T_UDP_INV_DSTPT XT_UDP_INV_DSTPT
56#define IP6T_UDP_INV_MASK XT_UDP_INV_MASK
57
58#define ip6t_counters_info xt_counters_info
59#define IP6T_STANDARD_TARGET XT_STANDARD_TARGET
60#define IP6T_ERROR_TARGET XT_ERROR_TARGET
61#define IP6T_MATCH_ITERATE(e, fn, args...) \
62 XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args)
63#define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \
64 XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args)
65#endif
66
67/* Yes, Virginia, you have to zero the padding. */
68struct ip6t_ip6 {
69 /* Source and destination IP6 addr */
70 struct in6_addr src, dst;
71 /* Mask for src and dest IP6 addr */
72 struct in6_addr smsk, dmsk;
73 char iniface[IFNAMSIZ], outiface[IFNAMSIZ];
74 unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
75
76 /* Upper protocol number
77 * - The allowed value is 0 (any) or protocol number of last parsable
78 * header, which is 50 (ESP), 59 (No Next Header), 135 (MH), or
79 * the non IPv6 extension headers.
80 * - The protocol numbers of IPv6 extension headers except of ESP and
81 * MH do not match any packets.
82 * - You also need to set IP6T_FLAGS_PROTO to "flags" to check protocol.
83 */
84 __u16 proto;
85 /* TOS to match iff flags & IP6T_F_TOS */
86 __u8 tos;
87
88 /* Flags word */
89 __u8 flags;
90 /* Inverse flags */
91 __u8 invflags;
92};
93
94/* Values for "flag" field in struct ip6t_ip6 (general ip6 structure). */
95#define IP6T_F_PROTO 0x01 /* Set if rule cares about upper
96 protocols */
97#define IP6T_F_TOS 0x02 /* Match the TOS. */
98#define IP6T_F_GOTO 0x04 /* Set if jump is a goto */
99#define IP6T_F_MASK 0x07 /* All possible flag bits mask. */
100
101/* Values for "inv" field in struct ip6t_ip6. */
102#define IP6T_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */
103#define IP6T_INV_VIA_OUT 0x02 /* Invert the sense of OUT IFACE */
104#define IP6T_INV_TOS 0x04 /* Invert the sense of TOS. */
105#define IP6T_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */
106#define IP6T_INV_DSTIP 0x10 /* Invert the sense of DST OP. */
107#define IP6T_INV_FRAG 0x20 /* Invert the sense of FRAG. */
108#define IP6T_INV_PROTO XT_INV_PROTO
109#define IP6T_INV_MASK 0x7F /* All possible flag bits mask. */
110
111/* This structure defines each of the firewall rules. Consists of 3
112 parts which are 1) general IP header stuff 2) match specific
113 stuff 3) the target to perform if the rule matches */
114struct ip6t_entry {
115 struct ip6t_ip6 ipv6;
116
117 /* Mark with fields that we care about. */
118 unsigned int nfcache;
119
120 /* Size of ipt_entry + matches */
121 __u16 target_offset;
122 /* Size of ipt_entry + matches + target */
123 __u16 next_offset;
124
125 /* Back pointer */
126 unsigned int comefrom;
127
128 /* Packet and byte counters. */
129 struct xt_counters counters;
130
131 /* The matches (if any), then the target. */
132 unsigned char elems[0];
133};
134
135/* Standard entry */
136struct ip6t_standard {
137 struct ip6t_entry entry;
138 struct xt_standard_target target;
139};
140
141struct ip6t_error {
142 struct ip6t_entry entry;
143 struct xt_error_target target;
144};
145
146#define IP6T_ENTRY_INIT(__size) \
147{ \
148 .target_offset = sizeof(struct ip6t_entry), \
149 .next_offset = (__size), \
150}
151
152#define IP6T_STANDARD_INIT(__verdict) \
153{ \
154 .entry = IP6T_ENTRY_INIT(sizeof(struct ip6t_standard)), \
155 .target = XT_TARGET_INIT(XT_STANDARD_TARGET, \
156 sizeof(struct xt_standard_target)), \
157 .target.verdict = -(__verdict) - 1, \
158}
159
160#define IP6T_ERROR_INIT \
161{ \
162 .entry = IP6T_ENTRY_INIT(sizeof(struct ip6t_error)), \
163 .target = XT_TARGET_INIT(XT_ERROR_TARGET, \
164 sizeof(struct xt_error_target)), \
165 .target.errorname = "ERROR", \
166}
167
168/*
169 * New IP firewall options for [gs]etsockopt at the RAW IP level.
170 * Unlike BSD Linux inherits IP options so you don't have to use
171 * a raw socket for this. Instead we check rights in the calls.
172 *
173 * ATTENTION: check linux/in6.h before adding new number here.
174 */
175#define IP6T_BASE_CTL 64
176
177#define IP6T_SO_SET_REPLACE (IP6T_BASE_CTL)
178#define IP6T_SO_SET_ADD_COUNTERS (IP6T_BASE_CTL + 1)
179#define IP6T_SO_SET_MAX IP6T_SO_SET_ADD_COUNTERS
180
181#define IP6T_SO_GET_INFO (IP6T_BASE_CTL)
182#define IP6T_SO_GET_ENTRIES (IP6T_BASE_CTL + 1)
183#define IP6T_SO_GET_REVISION_MATCH (IP6T_BASE_CTL + 4)
184#define IP6T_SO_GET_REVISION_TARGET (IP6T_BASE_CTL + 5)
185#define IP6T_SO_GET_MAX IP6T_SO_GET_REVISION_TARGET
186
187/* ICMP matching stuff */
188struct ip6t_icmp {
189 __u8 type; /* type to match */
190 __u8 code[2]; /* range of code */
191 __u8 invflags; /* Inverse flags */
192};
193
194/* Values for "inv" field for struct ipt_icmp. */
195#define IP6T_ICMP_INV 0x01 /* Invert the sense of type/code test */
196
197/* The argument to IP6T_SO_GET_INFO */
198struct ip6t_getinfo {
199 /* Which table: caller fills this in. */
200 char name[XT_TABLE_MAXNAMELEN];
201
202 /* Kernel fills these in. */
203 /* Which hook entry points are valid: bitmask */
204 unsigned int valid_hooks;
205
206 /* Hook entry points: one per netfilter hook. */
207 unsigned int hook_entry[NF_INET_NUMHOOKS];
208
209 /* Underflow points. */
210 unsigned int underflow[NF_INET_NUMHOOKS];
211
212 /* Number of entries */
213 unsigned int num_entries;
214
215 /* Size of entries. */
216 unsigned int size;
217};
218
219/* The argument to IP6T_SO_SET_REPLACE. */
220struct ip6t_replace {
221 /* Which table. */
222 char name[XT_TABLE_MAXNAMELEN];
223
224 /* Which hook entry points are valid: bitmask. You can't
225 change this. */
226 unsigned int valid_hooks;
227
228 /* Number of entries */
229 unsigned int num_entries;
230
231 /* Total size of new entries */
232 unsigned int size;
233
234 /* Hook entry points. */
235 unsigned int hook_entry[NF_INET_NUMHOOKS];
236
237 /* Underflow points. */
238 unsigned int underflow[NF_INET_NUMHOOKS];
239
240 /* Information about old entries: */
241 /* Number of counters (must be equal to current number of entries). */
242 unsigned int num_counters;
243 /* The old entries' counters. */
244 struct xt_counters __user *counters;
245
246 /* The entries (hang off end: not really an array). */
247 struct ip6t_entry entries[0];
248};
249
250/* The argument to IP6T_SO_GET_ENTRIES. */
251struct ip6t_get_entries {
252 /* Which table: user fills this in. */
253 char name[XT_TABLE_MAXNAMELEN];
254
255 /* User fills this in: total entry size. */
256 unsigned int size;
257
258 /* The entries. */
259 struct ip6t_entry entrytable[0];
260};
261
262/* Helper functions */
263static __inline__ struct xt_entry_target *
264ip6t_get_target(struct ip6t_entry *e)
265{
266 return (void *)e + e->target_offset;
267}
268
269/*
270 * Main firewall chains definitions and global var's definitions.
271 */
272
273#ifdef __KERNEL__
274 21
275#include <linux/init.h> 22#include <linux/init.h>
23#include <uapi/linux/netfilter_ipv6/ip6_tables.h>
24
276extern void ip6t_init(void) __init; 25extern void ip6t_init(void) __init;
277 26
278extern void *ip6t_alloc_initial_table(const struct xt_table *); 27extern void *ip6t_alloc_initial_table(const struct xt_table *);
@@ -327,5 +76,4 @@ compat_ip6t_get_target(struct compat_ip6t_entry *e)
327} 76}
328 77
329#endif /* CONFIG_COMPAT */ 78#endif /* CONFIG_COMPAT */
330#endif /*__KERNEL__*/
331#endif /* _IP6_TABLES_H */ 79#endif /* _IP6_TABLES_H */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index f80c56ac4d82..e0f746b7b95c 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -1,160 +1,12 @@
1#ifndef __LINUX_NETLINK_H 1#ifndef __LINUX_NETLINK_H
2#define __LINUX_NETLINK_H 2#define __LINUX_NETLINK_H
3 3
4#include <linux/socket.h> /* for __kernel_sa_family_t */
5#include <linux/types.h>
6
7#define NETLINK_ROUTE 0 /* Routing/device hook */
8#define NETLINK_UNUSED 1 /* Unused number */
9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */
10#define NETLINK_FIREWALL 3 /* Unused number, formerly ip_queue */
11#define NETLINK_SOCK_DIAG 4 /* socket monitoring */
12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */
13#define NETLINK_XFRM 6 /* ipsec */
14#define NETLINK_SELINUX 7 /* SELinux event notifications */
15#define NETLINK_ISCSI 8 /* Open-iSCSI */
16#define NETLINK_AUDIT 9 /* auditing */
17#define NETLINK_FIB_LOOKUP 10
18#define NETLINK_CONNECTOR 11
19#define NETLINK_NETFILTER 12 /* netfilter subsystem */
20#define NETLINK_IP6_FW 13
21#define NETLINK_DNRTMSG 14 /* DECnet routing messages */
22#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */
23#define NETLINK_GENERIC 16
24/* leave room for NETLINK_DM (DM Events) */
25#define NETLINK_SCSITRANSPORT 18 /* SCSI Transports */
26#define NETLINK_ECRYPTFS 19
27#define NETLINK_RDMA 20
28#define NETLINK_CRYPTO 21 /* Crypto layer */
29
30#define NETLINK_INET_DIAG NETLINK_SOCK_DIAG
31
32#define MAX_LINKS 32
33
34struct sockaddr_nl {
35 __kernel_sa_family_t nl_family; /* AF_NETLINK */
36 unsigned short nl_pad; /* zero */
37 __u32 nl_pid; /* port ID */
38 __u32 nl_groups; /* multicast groups mask */
39};
40
41struct nlmsghdr {
42 __u32 nlmsg_len; /* Length of message including header */
43 __u16 nlmsg_type; /* Message content */
44 __u16 nlmsg_flags; /* Additional flags */
45 __u32 nlmsg_seq; /* Sequence number */
46 __u32 nlmsg_pid; /* Sending process port ID */
47};
48
49/* Flags values */
50
51#define NLM_F_REQUEST 1 /* It is request message. */
52#define NLM_F_MULTI 2 /* Multipart message, terminated by NLMSG_DONE */
53#define NLM_F_ACK 4 /* Reply with ack, with zero or error code */
54#define NLM_F_ECHO 8 /* Echo this request */
55#define NLM_F_DUMP_INTR 16 /* Dump was inconsistent due to sequence change */
56
57/* Modifiers to GET request */
58#define NLM_F_ROOT 0x100 /* specify tree root */
59#define NLM_F_MATCH 0x200 /* return all matching */
60#define NLM_F_ATOMIC 0x400 /* atomic GET */
61#define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH)
62
63/* Modifiers to NEW request */
64#define NLM_F_REPLACE 0x100 /* Override existing */
65#define NLM_F_EXCL 0x200 /* Do not touch, if it exists */
66#define NLM_F_CREATE 0x400 /* Create, if it does not exist */
67#define NLM_F_APPEND 0x800 /* Add to end of list */
68
69/*
70 4.4BSD ADD NLM_F_CREATE|NLM_F_EXCL
71 4.4BSD CHANGE NLM_F_REPLACE
72
73 True CHANGE NLM_F_CREATE|NLM_F_REPLACE
74 Append NLM_F_CREATE
75 Check NLM_F_EXCL
76 */
77
78#define NLMSG_ALIGNTO 4U
79#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
80#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
81#define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN))
82#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
83#define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))
84#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
85 (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
86#define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \
87 (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
88 (nlh)->nlmsg_len <= (len))
89#define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
90
91#define NLMSG_NOOP 0x1 /* Nothing. */
92#define NLMSG_ERROR 0x2 /* Error */
93#define NLMSG_DONE 0x3 /* End of a dump */
94#define NLMSG_OVERRUN 0x4 /* Data lost */
95
96#define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */
97
98struct nlmsgerr {
99 int error;
100 struct nlmsghdr msg;
101};
102
103#define NETLINK_ADD_MEMBERSHIP 1
104#define NETLINK_DROP_MEMBERSHIP 2
105#define NETLINK_PKTINFO 3
106#define NETLINK_BROADCAST_ERROR 4
107#define NETLINK_NO_ENOBUFS 5
108
109struct nl_pktinfo {
110 __u32 group;
111};
112
113#define NET_MAJOR 36 /* Major 36 is reserved for networking */
114
115enum {
116 NETLINK_UNCONNECTED = 0,
117 NETLINK_CONNECTED,
118};
119
120/*
121 * <------- NLA_HDRLEN ------> <-- NLA_ALIGN(payload)-->
122 * +---------------------+- - -+- - - - - - - - - -+- - -+
123 * | Header | Pad | Payload | Pad |
124 * | (struct nlattr) | ing | | ing |
125 * +---------------------+- - -+- - - - - - - - - -+- - -+
126 * <-------------- nlattr->nla_len -------------->
127 */
128
129struct nlattr {
130 __u16 nla_len;
131 __u16 nla_type;
132};
133
134/*
135 * nla_type (16 bits)
136 * +---+---+-------------------------------+
137 * | N | O | Attribute Type |
138 * +---+---+-------------------------------+
139 * N := Carries nested attributes
140 * O := Payload stored in network byte order
141 *
142 * Note: The N and O flag are mutually exclusive.
143 */
144#define NLA_F_NESTED (1 << 15)
145#define NLA_F_NET_BYTEORDER (1 << 14)
146#define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER)
147
148#define NLA_ALIGNTO 4
149#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
150#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
151
152#ifdef __KERNEL__
153 4
154#include <linux/capability.h> 5#include <linux/capability.h>
155#include <linux/skbuff.h> 6#include <linux/skbuff.h>
156#include <linux/export.h> 7#include <linux/export.h>
157#include <net/scm.h> 8#include <net/scm.h>
9#include <uapi/linux/netlink.h>
158 10
159struct net; 11struct net;
160 12
@@ -245,6 +97,8 @@ struct netlink_callback {
245 struct netlink_callback *cb); 97 struct netlink_callback *cb);
246 int (*done)(struct netlink_callback *cb); 98 int (*done)(struct netlink_callback *cb);
247 void *data; 99 void *data;
100 /* the module that dump function belong to */
101 struct module *module;
248 u16 family; 102 u16 family;
249 u16 min_dump_alloc; 103 u16 min_dump_alloc;
250 unsigned int prev_seq, seq; 104 unsigned int prev_seq, seq;
@@ -262,15 +116,23 @@ __nlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, int type, int len, int fla
262 116
263struct netlink_dump_control { 117struct netlink_dump_control {
264 int (*dump)(struct sk_buff *skb, struct netlink_callback *); 118 int (*dump)(struct sk_buff *skb, struct netlink_callback *);
265 int (*done)(struct netlink_callback*); 119 int (*done)(struct netlink_callback *);
266 void *data; 120 void *data;
121 struct module *module;
267 u16 min_dump_alloc; 122 u16 min_dump_alloc;
268}; 123};
269 124
270extern int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, 125extern int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
271 const struct nlmsghdr *nlh, 126 const struct nlmsghdr *nlh,
272 struct netlink_dump_control *control); 127 struct netlink_dump_control *control);
128static inline int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
129 const struct nlmsghdr *nlh,
130 struct netlink_dump_control *control)
131{
132 if (!control->module)
133 control->module = THIS_MODULE;
273 134
274#endif /* __KERNEL__ */ 135 return __netlink_dump_start(ssk, skb, nlh, control);
136}
275 137
276#endif /* __LINUX_NETLINK_H */ 138#endif /* __LINUX_NETLINK_H */
diff --git a/include/linux/nfs.h b/include/linux/nfs.h
index 6d1fb63f5922..3e794c12e90a 100644
--- a/include/linux/nfs.h
+++ b/include/linux/nfs.h
@@ -7,130 +7,9 @@
7#ifndef _LINUX_NFS_H 7#ifndef _LINUX_NFS_H
8#define _LINUX_NFS_H 8#define _LINUX_NFS_H
9 9
10#define NFS_PROGRAM 100003
11#define NFS_PORT 2049
12#define NFS_MAXDATA 8192
13#define NFS_MAXPATHLEN 1024
14#define NFS_MAXNAMLEN 255
15#define NFS_MAXGROUPS 16
16#define NFS_FHSIZE 32
17#define NFS_COOKIESIZE 4
18#define NFS_FIFO_DEV (-1)
19#define NFSMODE_FMT 0170000
20#define NFSMODE_DIR 0040000
21#define NFSMODE_CHR 0020000
22#define NFSMODE_BLK 0060000
23#define NFSMODE_REG 0100000
24#define NFSMODE_LNK 0120000
25#define NFSMODE_SOCK 0140000
26#define NFSMODE_FIFO 0010000
27
28#define NFS_MNT_PROGRAM 100005
29#define NFS_MNT_VERSION 1
30#define NFS_MNT3_VERSION 3
31
32#define NFS_PIPE_DIRNAME "nfs"
33
34/*
35 * NFS stats. The good thing with these values is that NFSv3 errors are
36 * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which
37 * no-one uses anyway), so we can happily mix code as long as we make sure
38 * no NFSv3 errors are returned to NFSv2 clients.
39 * Error codes that have a `--' in the v2 column are not part of the
40 * standard, but seem to be widely used nevertheless.
41 */
42 enum nfs_stat {
43 NFS_OK = 0, /* v2 v3 v4 */
44 NFSERR_PERM = 1, /* v2 v3 v4 */
45 NFSERR_NOENT = 2, /* v2 v3 v4 */
46 NFSERR_IO = 5, /* v2 v3 v4 */
47 NFSERR_NXIO = 6, /* v2 v3 v4 */
48 NFSERR_EAGAIN = 11, /* v2 v3 */
49 NFSERR_ACCES = 13, /* v2 v3 v4 */
50 NFSERR_EXIST = 17, /* v2 v3 v4 */
51 NFSERR_XDEV = 18, /* v3 v4 */
52 NFSERR_NODEV = 19, /* v2 v3 v4 */
53 NFSERR_NOTDIR = 20, /* v2 v3 v4 */
54 NFSERR_ISDIR = 21, /* v2 v3 v4 */
55 NFSERR_INVAL = 22, /* v2 v3 v4 */
56 NFSERR_FBIG = 27, /* v2 v3 v4 */
57 NFSERR_NOSPC = 28, /* v2 v3 v4 */
58 NFSERR_ROFS = 30, /* v2 v3 v4 */
59 NFSERR_MLINK = 31, /* v3 v4 */
60 NFSERR_OPNOTSUPP = 45, /* v2 v3 */
61 NFSERR_NAMETOOLONG = 63, /* v2 v3 v4 */
62 NFSERR_NOTEMPTY = 66, /* v2 v3 v4 */
63 NFSERR_DQUOT = 69, /* v2 v3 v4 */
64 NFSERR_STALE = 70, /* v2 v3 v4 */
65 NFSERR_REMOTE = 71, /* v2 v3 */
66 NFSERR_WFLUSH = 99, /* v2 */
67 NFSERR_BADHANDLE = 10001, /* v3 v4 */
68 NFSERR_NOT_SYNC = 10002, /* v3 */
69 NFSERR_BAD_COOKIE = 10003, /* v3 v4 */
70 NFSERR_NOTSUPP = 10004, /* v3 v4 */
71 NFSERR_TOOSMALL = 10005, /* v3 v4 */
72 NFSERR_SERVERFAULT = 10006, /* v3 v4 */
73 NFSERR_BADTYPE = 10007, /* v3 v4 */
74 NFSERR_JUKEBOX = 10008, /* v3 v4 */
75 NFSERR_SAME = 10009, /* v4 */
76 NFSERR_DENIED = 10010, /* v4 */
77 NFSERR_EXPIRED = 10011, /* v4 */
78 NFSERR_LOCKED = 10012, /* v4 */
79 NFSERR_GRACE = 10013, /* v4 */
80 NFSERR_FHEXPIRED = 10014, /* v4 */
81 NFSERR_SHARE_DENIED = 10015, /* v4 */
82 NFSERR_WRONGSEC = 10016, /* v4 */
83 NFSERR_CLID_INUSE = 10017, /* v4 */
84 NFSERR_RESOURCE = 10018, /* v4 */
85 NFSERR_MOVED = 10019, /* v4 */
86 NFSERR_NOFILEHANDLE = 10020, /* v4 */
87 NFSERR_MINOR_VERS_MISMATCH = 10021, /* v4 */
88 NFSERR_STALE_CLIENTID = 10022, /* v4 */
89 NFSERR_STALE_STATEID = 10023, /* v4 */
90 NFSERR_OLD_STATEID = 10024, /* v4 */
91 NFSERR_BAD_STATEID = 10025, /* v4 */
92 NFSERR_BAD_SEQID = 10026, /* v4 */
93 NFSERR_NOT_SAME = 10027, /* v4 */
94 NFSERR_LOCK_RANGE = 10028, /* v4 */
95 NFSERR_SYMLINK = 10029, /* v4 */
96 NFSERR_RESTOREFH = 10030, /* v4 */
97 NFSERR_LEASE_MOVED = 10031, /* v4 */
98 NFSERR_ATTRNOTSUPP = 10032, /* v4 */
99 NFSERR_NO_GRACE = 10033, /* v4 */
100 NFSERR_RECLAIM_BAD = 10034, /* v4 */
101 NFSERR_RECLAIM_CONFLICT = 10035,/* v4 */
102 NFSERR_BAD_XDR = 10036, /* v4 */
103 NFSERR_LOCKS_HELD = 10037, /* v4 */
104 NFSERR_OPENMODE = 10038, /* v4 */
105 NFSERR_BADOWNER = 10039, /* v4 */
106 NFSERR_BADCHAR = 10040, /* v4 */
107 NFSERR_BADNAME = 10041, /* v4 */
108 NFSERR_BAD_RANGE = 10042, /* v4 */
109 NFSERR_LOCK_NOTSUPP = 10043, /* v4 */
110 NFSERR_OP_ILLEGAL = 10044, /* v4 */
111 NFSERR_DEADLOCK = 10045, /* v4 */
112 NFSERR_FILE_OPEN = 10046, /* v4 */
113 NFSERR_ADMIN_REVOKED = 10047, /* v4 */
114 NFSERR_CB_PATH_DOWN = 10048, /* v4 */
115};
116
117/* NFSv2 file types - beware, these are not the same in NFSv3 */
118
119enum nfs_ftype {
120 NFNON = 0,
121 NFREG = 1,
122 NFDIR = 2,
123 NFBLK = 3,
124 NFCHR = 4,
125 NFLNK = 5,
126 NFSOCK = 6,
127 NFBAD = 7,
128 NFFIFO = 8
129};
130
131#ifdef __KERNEL__
132#include <linux/sunrpc/msg_prot.h> 10#include <linux/sunrpc/msg_prot.h>
133#include <linux/string.h> 11#include <linux/string.h>
12#include <uapi/linux/nfs.h>
134 13
135/* 14/*
136 * This is the kernel NFS client file handle representation 15 * This is the kernel NFS client file handle representation
@@ -169,5 +48,4 @@ enum nfs3_stable_how {
169 NFS_DATA_SYNC = 1, 48 NFS_DATA_SYNC = 1,
170 NFS_FILE_SYNC = 2 49 NFS_FILE_SYNC = 2
171}; 50};
172#endif /* __KERNEL__ */
173#endif /* _LINUX_NFS_H */ 51#endif /* _LINUX_NFS_H */
diff --git a/include/linux/nfs3.h b/include/linux/nfs3.h
index 6ccfe3b641e1..a778ad8e3afd 100644
--- a/include/linux/nfs3.h
+++ b/include/linux/nfs3.h
@@ -4,100 +4,10 @@
4#ifndef _LINUX_NFS3_H 4#ifndef _LINUX_NFS3_H
5#define _LINUX_NFS3_H 5#define _LINUX_NFS3_H
6 6
7#define NFS3_PORT 2049 7#include <uapi/linux/nfs3.h>
8#define NFS3_MAXDATA 32768
9#define NFS3_MAXPATHLEN PATH_MAX
10#define NFS3_MAXNAMLEN NAME_MAX
11#define NFS3_MAXGROUPS 16
12#define NFS3_FHSIZE 64
13#define NFS3_COOKIESIZE 4
14#define NFS3_CREATEVERFSIZE 8
15#define NFS3_COOKIEVERFSIZE 8
16#define NFS3_WRITEVERFSIZE 8
17#define NFS3_FIFO_DEV (-1)
18#define NFS3MODE_FMT 0170000
19#define NFS3MODE_DIR 0040000
20#define NFS3MODE_CHR 0020000
21#define NFS3MODE_BLK 0060000
22#define NFS3MODE_REG 0100000
23#define NFS3MODE_LNK 0120000
24#define NFS3MODE_SOCK 0140000
25#define NFS3MODE_FIFO 0010000
26 8
27/* Flags for access() call */
28#define NFS3_ACCESS_READ 0x0001
29#define NFS3_ACCESS_LOOKUP 0x0002
30#define NFS3_ACCESS_MODIFY 0x0004
31#define NFS3_ACCESS_EXTEND 0x0008
32#define NFS3_ACCESS_DELETE 0x0010
33#define NFS3_ACCESS_EXECUTE 0x0020
34#define NFS3_ACCESS_FULL 0x003f
35
36/* Flags for create mode */
37enum nfs3_createmode {
38 NFS3_CREATE_UNCHECKED = 0,
39 NFS3_CREATE_GUARDED = 1,
40 NFS3_CREATE_EXCLUSIVE = 2
41};
42
43/* NFSv3 file system properties */
44#define NFS3_FSF_LINK 0x0001
45#define NFS3_FSF_SYMLINK 0x0002
46#define NFS3_FSF_HOMOGENEOUS 0x0008
47#define NFS3_FSF_CANSETTIME 0x0010
48/* Some shorthands. See fs/nfsd/nfs3proc.c */
49#define NFS3_FSF_DEFAULT 0x001B
50#define NFS3_FSF_BILLYBOY 0x0018
51#define NFS3_FSF_READONLY 0x0008
52
53enum nfs3_ftype {
54 NF3NON = 0,
55 NF3REG = 1,
56 NF3DIR = 2,
57 NF3BLK = 3,
58 NF3CHR = 4,
59 NF3LNK = 5,
60 NF3SOCK = 6,
61 NF3FIFO = 7, /* changed from NFSv2 (was 8) */
62 NF3BAD = 8
63};
64
65struct nfs3_fh {
66 unsigned short size;
67 unsigned char data[NFS3_FHSIZE];
68};
69
70#define NFS3_VERSION 3
71#define NFS3PROC_NULL 0
72#define NFS3PROC_GETATTR 1
73#define NFS3PROC_SETATTR 2
74#define NFS3PROC_LOOKUP 3
75#define NFS3PROC_ACCESS 4
76#define NFS3PROC_READLINK 5
77#define NFS3PROC_READ 6
78#define NFS3PROC_WRITE 7
79#define NFS3PROC_CREATE 8
80#define NFS3PROC_MKDIR 9
81#define NFS3PROC_SYMLINK 10
82#define NFS3PROC_MKNOD 11
83#define NFS3PROC_REMOVE 12
84#define NFS3PROC_RMDIR 13
85#define NFS3PROC_RENAME 14
86#define NFS3PROC_LINK 15
87#define NFS3PROC_READDIR 16
88#define NFS3PROC_READDIRPLUS 17
89#define NFS3PROC_FSSTAT 18
90#define NFS3PROC_FSINFO 19
91#define NFS3PROC_PATHCONF 20
92#define NFS3PROC_COMMIT 21
93
94#define NFS_MNT3_VERSION 3
95
96
97#if defined(__KERNEL__)
98 9
99/* Number of 32bit words in post_op_attr */ 10/* Number of 32bit words in post_op_attr */
100#define NFS3_POST_OP_ATTR_WORDS 22 11#define NFS3_POST_OP_ATTR_WORDS 22
101 12
102#endif /* __KERNEL__ */
103#endif /* _LINUX_NFS3_H */ 13#endif /* _LINUX_NFS3_H */
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index af2d2fa30eee..e111fa419a4e 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -9,168 +9,11 @@
9 * Kendrick Smith <kmsmith@umich.edu> 9 * Kendrick Smith <kmsmith@umich.edu>
10 * Andy Adamson <andros@umich.edu> 10 * Andy Adamson <andros@umich.edu>
11 */ 11 */
12
13#ifndef _LINUX_NFS4_H 12#ifndef _LINUX_NFS4_H
14#define _LINUX_NFS4_H 13#define _LINUX_NFS4_H
15 14
16#include <linux/types.h>
17
18#define NFS4_BITMAP_SIZE 2
19#define NFS4_VERIFIER_SIZE 8
20#define NFS4_STATEID_SEQID_SIZE 4
21#define NFS4_STATEID_OTHER_SIZE 12
22#define NFS4_STATEID_SIZE (NFS4_STATEID_SEQID_SIZE + NFS4_STATEID_OTHER_SIZE)
23#define NFS4_FHSIZE 128
24#define NFS4_MAXPATHLEN PATH_MAX
25#define NFS4_MAXNAMLEN NAME_MAX
26#define NFS4_OPAQUE_LIMIT 1024
27#define NFS4_MAX_SESSIONID_LEN 16
28
29#define NFS4_ACCESS_READ 0x0001
30#define NFS4_ACCESS_LOOKUP 0x0002
31#define NFS4_ACCESS_MODIFY 0x0004
32#define NFS4_ACCESS_EXTEND 0x0008
33#define NFS4_ACCESS_DELETE 0x0010
34#define NFS4_ACCESS_EXECUTE 0x0020
35
36#define NFS4_FH_PERSISTENT 0x0000
37#define NFS4_FH_NOEXPIRE_WITH_OPEN 0x0001
38#define NFS4_FH_VOLATILE_ANY 0x0002
39#define NFS4_FH_VOL_MIGRATION 0x0004
40#define NFS4_FH_VOL_RENAME 0x0008
41
42#define NFS4_OPEN_RESULT_CONFIRM 0x0002
43#define NFS4_OPEN_RESULT_LOCKTYPE_POSIX 0x0004
44
45#define NFS4_SHARE_ACCESS_MASK 0x000F
46#define NFS4_SHARE_ACCESS_READ 0x0001
47#define NFS4_SHARE_ACCESS_WRITE 0x0002
48#define NFS4_SHARE_ACCESS_BOTH 0x0003
49#define NFS4_SHARE_DENY_READ 0x0001
50#define NFS4_SHARE_DENY_WRITE 0x0002
51#define NFS4_SHARE_DENY_BOTH 0x0003
52
53/* nfs41 */
54#define NFS4_SHARE_WANT_MASK 0xFF00
55#define NFS4_SHARE_WANT_NO_PREFERENCE 0x0000
56#define NFS4_SHARE_WANT_READ_DELEG 0x0100
57#define NFS4_SHARE_WANT_WRITE_DELEG 0x0200
58#define NFS4_SHARE_WANT_ANY_DELEG 0x0300
59#define NFS4_SHARE_WANT_NO_DELEG 0x0400
60#define NFS4_SHARE_WANT_CANCEL 0x0500
61
62#define NFS4_SHARE_WHEN_MASK 0xF0000
63#define NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL 0x10000
64#define NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED 0x20000
65
66#define NFS4_CDFC4_FORE 0x1
67#define NFS4_CDFC4_BACK 0x2
68#define NFS4_CDFC4_BOTH 0x3
69#define NFS4_CDFC4_FORE_OR_BOTH 0x3
70#define NFS4_CDFC4_BACK_OR_BOTH 0x7
71
72#define NFS4_CDFS4_FORE 0x1
73#define NFS4_CDFS4_BACK 0x2
74#define NFS4_CDFS4_BOTH 0x3
75
76#define NFS4_SET_TO_SERVER_TIME 0
77#define NFS4_SET_TO_CLIENT_TIME 1
78
79#define NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE 0
80#define NFS4_ACE_ACCESS_DENIED_ACE_TYPE 1
81#define NFS4_ACE_SYSTEM_AUDIT_ACE_TYPE 2
82#define NFS4_ACE_SYSTEM_ALARM_ACE_TYPE 3
83
84#define ACL4_SUPPORT_ALLOW_ACL 0x01
85#define ACL4_SUPPORT_DENY_ACL 0x02
86#define ACL4_SUPPORT_AUDIT_ACL 0x04
87#define ACL4_SUPPORT_ALARM_ACL 0x08
88
89#define NFS4_ACE_FILE_INHERIT_ACE 0x00000001
90#define NFS4_ACE_DIRECTORY_INHERIT_ACE 0x00000002
91#define NFS4_ACE_NO_PROPAGATE_INHERIT_ACE 0x00000004
92#define NFS4_ACE_INHERIT_ONLY_ACE 0x00000008
93#define NFS4_ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010
94#define NFS4_ACE_FAILED_ACCESS_ACE_FLAG 0x00000020
95#define NFS4_ACE_IDENTIFIER_GROUP 0x00000040
96
97#define NFS4_ACE_READ_DATA 0x00000001
98#define NFS4_ACE_LIST_DIRECTORY 0x00000001
99#define NFS4_ACE_WRITE_DATA 0x00000002
100#define NFS4_ACE_ADD_FILE 0x00000002
101#define NFS4_ACE_APPEND_DATA 0x00000004
102#define NFS4_ACE_ADD_SUBDIRECTORY 0x00000004
103#define NFS4_ACE_READ_NAMED_ATTRS 0x00000008
104#define NFS4_ACE_WRITE_NAMED_ATTRS 0x00000010
105#define NFS4_ACE_EXECUTE 0x00000020
106#define NFS4_ACE_DELETE_CHILD 0x00000040
107#define NFS4_ACE_READ_ATTRIBUTES 0x00000080
108#define NFS4_ACE_WRITE_ATTRIBUTES 0x00000100
109#define NFS4_ACE_DELETE 0x00010000
110#define NFS4_ACE_READ_ACL 0x00020000
111#define NFS4_ACE_WRITE_ACL 0x00040000
112#define NFS4_ACE_WRITE_OWNER 0x00080000
113#define NFS4_ACE_SYNCHRONIZE 0x00100000
114#define NFS4_ACE_GENERIC_READ 0x00120081
115#define NFS4_ACE_GENERIC_WRITE 0x00160106
116#define NFS4_ACE_GENERIC_EXECUTE 0x001200A0
117#define NFS4_ACE_MASK_ALL 0x001F01FF
118
119#define EXCHGID4_FLAG_SUPP_MOVED_REFER 0x00000001
120#define EXCHGID4_FLAG_SUPP_MOVED_MIGR 0x00000002
121#define EXCHGID4_FLAG_BIND_PRINC_STATEID 0x00000100
122
123#define EXCHGID4_FLAG_USE_NON_PNFS 0x00010000
124#define EXCHGID4_FLAG_USE_PNFS_MDS 0x00020000
125#define EXCHGID4_FLAG_USE_PNFS_DS 0x00040000
126#define EXCHGID4_FLAG_MASK_PNFS 0x00070000
127
128#define EXCHGID4_FLAG_UPD_CONFIRMED_REC_A 0x40000000
129#define EXCHGID4_FLAG_CONFIRMED_R 0x80000000
130/*
131 * Since the validity of these bits depends on whether
132 * they're set in the argument or response, have separate
133 * invalid flag masks for arg (_A) and resp (_R).
134 */
135#define EXCHGID4_FLAG_MASK_A 0x40070103
136#define EXCHGID4_FLAG_MASK_R 0x80070103
137
138#define SEQ4_STATUS_CB_PATH_DOWN 0x00000001
139#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING 0x00000002
140#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED 0x00000004
141#define SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED 0x00000008
142#define SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED 0x00000010
143#define SEQ4_STATUS_ADMIN_STATE_REVOKED 0x00000020
144#define SEQ4_STATUS_RECALLABLE_STATE_REVOKED 0x00000040
145#define SEQ4_STATUS_LEASE_MOVED 0x00000080
146#define SEQ4_STATUS_RESTART_RECLAIM_NEEDED 0x00000100
147#define SEQ4_STATUS_CB_PATH_DOWN_SESSION 0x00000200
148#define SEQ4_STATUS_BACKCHANNEL_FAULT 0x00000400
149
150#define NFS4_SECINFO_STYLE4_CURRENT_FH 0
151#define NFS4_SECINFO_STYLE4_PARENT 1
152
153#define NFS4_MAX_UINT64 (~(u64)0)
154
155/* An NFS4 sessions server must support at least NFS4_MAX_OPS operations.
156 * If a compound requires more operations, adjust NFS4_MAX_OPS accordingly.
157 */
158#define NFS4_MAX_OPS 8
159
160/* Our NFS4 client back channel server only wants the cb_sequene and the
161 * actual operation per compound
162 */
163#define NFS4_MAX_BACK_CHANNEL_OPS 2
164
165enum nfs4_acl_whotype {
166 NFS4_ACL_WHO_NAMED = 0,
167 NFS4_ACL_WHO_OWNER,
168 NFS4_ACL_WHO_GROUP,
169 NFS4_ACL_WHO_EVERYONE,
170};
171
172#ifdef __KERNEL__
173#include <linux/list.h> 15#include <linux/list.h>
16#include <uapi/linux/nfs4.h>
174 17
175struct nfs4_ace { 18struct nfs4_ace {
176 uint32_t type; 19 uint32_t type;
@@ -673,10 +516,3 @@ struct nfs4_deviceid {
673}; 516};
674 517
675#endif 518#endif
676#endif
677
678/*
679 * Local variables:
680 * c-basic-offset: 8
681 * End:
682 */
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 4b03f56e280e..1cc25682b20b 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -5,38 +5,11 @@
5 * 5 *
6 * OS-specific nfs filesystem definitions and declarations 6 * OS-specific nfs filesystem definitions and declarations
7 */ 7 */
8
9#ifndef _LINUX_NFS_FS_H 8#ifndef _LINUX_NFS_FS_H
10#define _LINUX_NFS_FS_H 9#define _LINUX_NFS_FS_H
11 10
12#include <linux/magic.h> 11#include <uapi/linux/nfs_fs.h>
13
14/* Default timeout values */
15#define NFS_DEF_UDP_TIMEO (11)
16#define NFS_DEF_UDP_RETRANS (3)
17#define NFS_DEF_TCP_TIMEO (600)
18#define NFS_DEF_TCP_RETRANS (2)
19
20#define NFS_MAX_UDP_TIMEOUT (60*HZ)
21#define NFS_MAX_TCP_TIMEOUT (600*HZ)
22
23#define NFS_DEF_ACREGMIN (3)
24#define NFS_DEF_ACREGMAX (60)
25#define NFS_DEF_ACDIRMIN (30)
26#define NFS_DEF_ACDIRMAX (60)
27
28/*
29 * When flushing a cluster of dirty pages, there can be different
30 * strategies:
31 */
32#define FLUSH_SYNC 1 /* file being synced, or contention */
33#define FLUSH_STABLE 4 /* commit to stable storage */
34#define FLUSH_LOWPRI 8 /* low priority background flush */
35#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */
36#define FLUSH_COND_STABLE 32 /* conditional stable write - only stable
37 * if everything fits in one RPC */
38 12
39#ifdef __KERNEL__
40 13
41/* 14/*
42 * Enable dprintk() debugging support for nfs client. 15 * Enable dprintk() debugging support for nfs client.
@@ -81,12 +54,16 @@ struct nfs_access_entry {
81 int mask; 54 int mask;
82}; 55};
83 56
57struct nfs_lockowner {
58 fl_owner_t l_owner;
59 pid_t l_pid;
60};
61
84struct nfs_lock_context { 62struct nfs_lock_context {
85 atomic_t count; 63 atomic_t count;
86 struct list_head list; 64 struct list_head list;
87 struct nfs_open_context *open_context; 65 struct nfs_open_context *open_context;
88 fl_owner_t lockowner; 66 struct nfs_lockowner lockowner;
89 pid_t pid;
90}; 67};
91 68
92struct nfs4_state; 69struct nfs4_state;
@@ -99,6 +76,7 @@ struct nfs_open_context {
99 76
100 unsigned long flags; 77 unsigned long flags;
101#define NFS_CONTEXT_ERROR_WRITE (0) 78#define NFS_CONTEXT_ERROR_WRITE (0)
79#define NFS_CONTEXT_RESEND_WRITES (1)
102 int error; 80 int error;
103 81
104 struct list_head list; 82 struct list_head list;
@@ -355,6 +333,8 @@ extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *);
355extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); 333extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr);
356extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr); 334extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr);
357extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); 335extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
336extern void nfs_access_add_cache(struct inode *, struct nfs_access_entry *);
337extern void nfs_access_set_mask(struct nfs_access_entry *, u32);
358extern int nfs_permission(struct inode *, int); 338extern int nfs_permission(struct inode *, int);
359extern int nfs_open(struct inode *, struct file *); 339extern int nfs_open(struct inode *, struct file *);
360extern int nfs_release(struct inode *, struct file *); 340extern int nfs_release(struct inode *, struct file *);
@@ -606,29 +586,6 @@ nfs_fileid_to_ino_t(u64 fileid)
606 586
607#define NFS_JUKEBOX_RETRY_TIME (5 * HZ) 587#define NFS_JUKEBOX_RETRY_TIME (5 * HZ)
608 588
609#endif /* __KERNEL__ */
610
611/*
612 * NFS debug flags
613 */
614#define NFSDBG_VFS 0x0001
615#define NFSDBG_DIRCACHE 0x0002
616#define NFSDBG_LOOKUPCACHE 0x0004
617#define NFSDBG_PAGECACHE 0x0008
618#define NFSDBG_PROC 0x0010
619#define NFSDBG_XDR 0x0020
620#define NFSDBG_FILE 0x0040
621#define NFSDBG_ROOT 0x0080
622#define NFSDBG_CALLBACK 0x0100
623#define NFSDBG_CLIENT 0x0200
624#define NFSDBG_MOUNT 0x0400
625#define NFSDBG_FSCACHE 0x0800
626#define NFSDBG_PNFS 0x1000
627#define NFSDBG_PNFS_LD 0x2000
628#define NFSDBG_STATE 0x4000
629#define NFSDBG_ALL 0xFFFF
630
631#ifdef __KERNEL__
632 589
633# undef ifdebug 590# undef ifdebug
634# ifdef NFS_DEBUG 591# ifdef NFS_DEBUG
@@ -638,6 +595,4 @@ nfs_fileid_to_ino_t(u64 fileid)
638# define ifdebug(fac) if (0) 595# define ifdebug(fac) if (0)
639# define NFS_IFDEBUG(x) 596# define NFS_IFDEBUG(x)
640# endif 597# endif
641#endif /* __KERNEL */
642
643#endif 598#endif
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 310c63c8ab2c..a9e76ee1adca 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -39,6 +39,7 @@ struct nfs_client {
39 unsigned long cl_flags; /* behavior switches */ 39 unsigned long cl_flags; /* behavior switches */
40#define NFS_CS_NORESVPORT 0 /* - use ephemeral src port */ 40#define NFS_CS_NORESVPORT 0 /* - use ephemeral src port */
41#define NFS_CS_DISCRTRY 1 /* - disconnect on RPC retry */ 41#define NFS_CS_DISCRTRY 1 /* - disconnect on RPC retry */
42#define NFS_CS_MIGRATION 2 /* - transparent state migr */
42 struct sockaddr_storage cl_addr; /* server identifier */ 43 struct sockaddr_storage cl_addr; /* server identifier */
43 size_t cl_addrlen; 44 size_t cl_addrlen;
44 char * cl_hostname; /* hostname of server */ 45 char * cl_hostname; /* hostname of server */
@@ -81,6 +82,7 @@ struct nfs_client {
81 /* The flags used for obtaining the clientid during EXCHANGE_ID */ 82 /* The flags used for obtaining the clientid during EXCHANGE_ID */
82 u32 cl_exchange_flags; 83 u32 cl_exchange_flags;
83 struct nfs4_session *cl_session; /* shared session */ 84 struct nfs4_session *cl_session; /* shared session */
85 bool cl_preserve_clid;
84 struct nfs41_server_owner *cl_serverowner; 86 struct nfs41_server_owner *cl_serverowner;
85 struct nfs41_server_scope *cl_serverscope; 87 struct nfs41_server_scope *cl_serverscope;
86 struct nfs41_impl_id *cl_implid; 88 struct nfs41_impl_id *cl_implid;
@@ -125,6 +127,7 @@ struct nfs_server {
125 unsigned int namelen; 127 unsigned int namelen;
126 unsigned int options; /* extra options enabled by mount */ 128 unsigned int options; /* extra options enabled by mount */
127#define NFS_OPTION_FSCACHE 0x00000001 /* - local caching enabled */ 129#define NFS_OPTION_FSCACHE 0x00000001 /* - local caching enabled */
130#define NFS_OPTION_MIGRATION 0x00000002 /* - NFSv4 migration enabled */
128 131
129 struct nfs_fsid fsid; 132 struct nfs_fsid fsid;
130 __u64 maxfilesize; /* maximum file size */ 133 __u64 maxfilesize; /* maximum file size */
diff --git a/include/linux/nfs_idmap.h b/include/linux/nfs_idmap.h
index ece91c57ad79..2dcef3ab58b6 100644
--- a/include/linux/nfs_idmap.h
+++ b/include/linux/nfs_idmap.h
@@ -33,35 +33,11 @@
33 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 */ 35 */
36
37#ifndef NFS_IDMAP_H 36#ifndef NFS_IDMAP_H
38#define NFS_IDMAP_H 37#define NFS_IDMAP_H
39 38
40#include <linux/types.h> 39#include <uapi/linux/nfs_idmap.h>
41
42/* XXX from bits/utmp.h */
43#define IDMAP_NAMESZ 128
44
45#define IDMAP_TYPE_USER 0
46#define IDMAP_TYPE_GROUP 1
47
48#define IDMAP_CONV_IDTONAME 0
49#define IDMAP_CONV_NAMETOID 1
50 40
51#define IDMAP_STATUS_INVALIDMSG 0x01
52#define IDMAP_STATUS_AGAIN 0x02
53#define IDMAP_STATUS_LOOKUPFAIL 0x04
54#define IDMAP_STATUS_SUCCESS 0x08
55
56struct idmap_msg {
57 __u8 im_type;
58 __u8 im_conv;
59 char im_name[IDMAP_NAMESZ];
60 __u32 im_id;
61 __u8 im_status;
62};
63
64#ifdef __KERNEL__
65 41
66/* Forward declaration to make this header independent of others */ 42/* Forward declaration to make this header independent of others */
67struct nfs_client; 43struct nfs_client;
@@ -97,6 +73,4 @@ int nfs_map_uid_to_name(const struct nfs_server *, __u32, char *, size_t);
97int nfs_map_gid_to_group(const struct nfs_server *, __u32, char *, size_t); 73int nfs_map_gid_to_group(const struct nfs_server *, __u32, char *, size_t);
98 74
99extern unsigned int nfs_idmap_cache_timeout; 75extern unsigned int nfs_idmap_cache_timeout;
100#endif /* __KERNEL__ */
101
102#endif /* NFS_IDMAP_H */ 76#endif /* NFS_IDMAP_H */
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index be9cf3c7e79e..a73ea89789d1 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -251,7 +251,6 @@ struct nfs4_layoutget_res {
251struct nfs4_layoutget { 251struct nfs4_layoutget {
252 struct nfs4_layoutget_args args; 252 struct nfs4_layoutget_args args;
253 struct nfs4_layoutget_res res; 253 struct nfs4_layoutget_res res;
254 struct pnfs_layout_segment **lsegpp;
255 gfp_t gfp_flags; 254 gfp_t gfp_flags;
256}; 255};
257 256
@@ -335,6 +334,7 @@ struct nfs_openargs {
335 struct nfs_seqid * seqid; 334 struct nfs_seqid * seqid;
336 int open_flags; 335 int open_flags;
337 fmode_t fmode; 336 fmode_t fmode;
337 u32 access;
338 __u64 clientid; 338 __u64 clientid;
339 struct stateowner_id id; 339 struct stateowner_id id;
340 union { 340 union {
@@ -369,6 +369,9 @@ struct nfs_openres {
369 struct nfs4_string *owner; 369 struct nfs4_string *owner;
370 struct nfs4_string *group_owner; 370 struct nfs4_string *group_owner;
371 struct nfs4_sequence_res seq_res; 371 struct nfs4_sequence_res seq_res;
372 __u32 access_request;
373 __u32 access_supported;
374 __u32 access_result;
372}; 375};
373 376
374/* 377/*
diff --git a/include/linux/nfsacl.h b/include/linux/nfsacl.h
index fabcb1e5c460..5e69e67b31ab 100644
--- a/include/linux/nfsacl.h
+++ b/include/linux/nfsacl.h
@@ -6,30 +6,10 @@
6#ifndef __LINUX_NFSACL_H 6#ifndef __LINUX_NFSACL_H
7#define __LINUX_NFSACL_H 7#define __LINUX_NFSACL_H
8 8
9#define NFS_ACL_PROGRAM 100227
10
11#define ACLPROC2_GETACL 1
12#define ACLPROC2_SETACL 2
13#define ACLPROC2_GETATTR 3
14#define ACLPROC2_ACCESS 4
15
16#define ACLPROC3_GETACL 1
17#define ACLPROC3_SETACL 2
18
19
20/* Flags for the getacl/setacl mode */
21#define NFS_ACL 0x0001
22#define NFS_ACLCNT 0x0002
23#define NFS_DFACL 0x0004
24#define NFS_DFACLCNT 0x0008
25
26/* Flag for Default ACL entries */
27#define NFS_ACL_DEFAULT 0x1000
28
29#ifdef __KERNEL__
30 9
31#include <linux/posix_acl.h> 10#include <linux/posix_acl.h>
32#include <linux/sunrpc/xdr.h> 11#include <linux/sunrpc/xdr.h>
12#include <uapi/linux/nfsacl.h>
33 13
34/* Maximum number of ACL entries over NFS */ 14/* Maximum number of ACL entries over NFS */
35#define NFS_ACL_MAX_ENTRIES 1024 15#define NFS_ACL_MAX_ENTRIES 1024
@@ -58,5 +38,4 @@ extern int
58nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt, 38nfsacl_decode(struct xdr_buf *buf, unsigned int base, unsigned int *aclcnt,
59 struct posix_acl **pacl); 39 struct posix_acl **pacl);
60 40
61#endif /* __KERNEL__ */
62#endif /* __LINUX_NFSACL_H */ 41#endif /* __LINUX_NFSACL_H */
diff --git a/include/linux/nfsd/Kbuild b/include/linux/nfsd/Kbuild
deleted file mode 100644
index 5b7d84ac954a..000000000000
--- a/include/linux/nfsd/Kbuild
+++ /dev/null
@@ -1,5 +0,0 @@
1header-y += cld.h
2header-y += debug.h
3header-y += export.h
4header-y += nfsfh.h
5header-y += stats.h
diff --git a/include/linux/nfsd/debug.h b/include/linux/nfsd/debug.h
index ee4aa91788e7..19ef8375b577 100644
--- a/include/linux/nfsd/debug.h
+++ b/include/linux/nfsd/debug.h
@@ -5,44 +5,15 @@
5 * 5 *
6 * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de> 6 * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de>
7 */ 7 */
8
9#ifndef LINUX_NFSD_DEBUG_H 8#ifndef LINUX_NFSD_DEBUG_H
10#define LINUX_NFSD_DEBUG_H 9#define LINUX_NFSD_DEBUG_H
11 10
12#include <linux/sunrpc/debug.h> 11#include <uapi/linux/nfsd/debug.h>
13 12
14/*
15 * Enable debugging for nfsd.
16 * Requires RPC_DEBUG.
17 */
18#ifdef RPC_DEBUG
19# define NFSD_DEBUG 1
20#endif
21
22/*
23 * knfsd debug flags
24 */
25#define NFSDDBG_SOCK 0x0001
26#define NFSDDBG_FH 0x0002
27#define NFSDDBG_EXPORT 0x0004
28#define NFSDDBG_SVC 0x0008
29#define NFSDDBG_PROC 0x0010
30#define NFSDDBG_FILEOP 0x0020
31#define NFSDDBG_AUTH 0x0040
32#define NFSDDBG_REPCACHE 0x0080
33#define NFSDDBG_XDR 0x0100
34#define NFSDDBG_LOCKD 0x0200
35#define NFSDDBG_ALL 0x7FFF
36#define NFSDDBG_NOCHANGE 0xFFFF
37
38
39#ifdef __KERNEL__
40# undef ifdebug 13# undef ifdebug
41# ifdef NFSD_DEBUG 14# ifdef NFSD_DEBUG
42# define ifdebug(flag) if (nfsd_debug & NFSDDBG_##flag) 15# define ifdebug(flag) if (nfsd_debug & NFSDDBG_##flag)
43# else 16# else
44# define ifdebug(flag) if (0) 17# define ifdebug(flag) if (0)
45# endif 18# endif
46#endif /* __KERNEL__ */
47
48#endif /* LINUX_NFSD_DEBUG_H */ 19#endif /* LINUX_NFSD_DEBUG_H */
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index e33f747b173c..24c139288db4 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -6,58 +6,11 @@
6 * 6 *
7 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de> 7 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
8 */ 8 */
9
10#ifndef NFSD_EXPORT_H 9#ifndef NFSD_EXPORT_H
11#define NFSD_EXPORT_H 10#define NFSD_EXPORT_H
12 11
13# include <linux/types.h>
14#ifdef __KERNEL__
15# include <linux/nfsd/nfsfh.h> 12# include <linux/nfsd/nfsfh.h>
16#endif 13#include <uapi/linux/nfsd/export.h>
17
18/*
19 * Important limits for the exports stuff.
20 */
21#define NFSCLNT_IDMAX 1024
22#define NFSCLNT_ADDRMAX 16
23#define NFSCLNT_KEYMAX 32
24
25/*
26 * Export flags.
27 */
28#define NFSEXP_READONLY 0x0001
29#define NFSEXP_INSECURE_PORT 0x0002
30#define NFSEXP_ROOTSQUASH 0x0004
31#define NFSEXP_ALLSQUASH 0x0008
32#define NFSEXP_ASYNC 0x0010
33#define NFSEXP_GATHERED_WRITES 0x0020
34/* 40 80 100 currently unused */
35#define NFSEXP_NOHIDE 0x0200
36#define NFSEXP_NOSUBTREECHECK 0x0400
37#define NFSEXP_NOAUTHNLM 0x0800 /* Don't authenticate NLM requests - just trust */
38#define NFSEXP_MSNFS 0x1000 /* do silly things that MS clients expect; no longer supported */
39#define NFSEXP_FSID 0x2000
40#define NFSEXP_CROSSMOUNT 0x4000
41#define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */
42/*
43 * The NFSEXP_V4ROOT flag causes the kernel to give access only to NFSv4
44 * clients, and only to the single directory that is the root of the
45 * export; further lookup and readdir operations are treated as if every
46 * subdirectory was a mountpoint, and ignored if they are not themselves
47 * exported. This is used by nfsd and mountd to construct the NFSv4
48 * pseudofilesystem, which provides access only to paths leading to each
49 * exported filesystem.
50 */
51#define NFSEXP_V4ROOT 0x10000
52/* All flags that we claim to support. (Note we don't support NOACL.) */
53#define NFSEXP_ALLFLAGS 0x17E3F
54
55/* The flags that may vary depending on security flavor: */
56#define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \
57 | NFSEXP_ALLSQUASH \
58 | NFSEXP_INSECURE_PORT)
59
60#ifdef __KERNEL__
61 14
62/* 15/*
63 * FS Locations 16 * FS Locations
@@ -154,7 +107,4 @@ static inline void exp_get(struct svc_export *exp)
154} 107}
155struct svc_export * rqst_exp_find(struct svc_rqst *, int, u32 *); 108struct svc_export * rqst_exp_find(struct svc_rqst *, int, u32 *);
156 109
157#endif /* __KERNEL__ */
158
159#endif /* NFSD_EXPORT_H */ 110#endif /* NFSD_EXPORT_H */
160
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index fa63048fecff..a93593f1fa4e 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -10,117 +10,11 @@
10 * 10 *
11 * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> 11 * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
12 */ 12 */
13
14#ifndef _LINUX_NFSD_FH_H 13#ifndef _LINUX_NFSD_FH_H
15#define _LINUX_NFSD_FH_H 14#define _LINUX_NFSD_FH_H
16 15
17#include <linux/types.h>
18#include <linux/nfs.h>
19#include <linux/nfs2.h>
20#include <linux/nfs3.h>
21#include <linux/nfs4.h>
22#ifdef __KERNEL__
23# include <linux/sunrpc/svc.h> 16# include <linux/sunrpc/svc.h>
24#endif 17#include <uapi/linux/nfsd/nfsfh.h>
25
26/*
27 * This is the old "dentry style" Linux NFSv2 file handle.
28 *
29 * The xino and xdev fields are currently used to transport the
30 * ino/dev of the exported inode.
31 */
32struct nfs_fhbase_old {
33 __u32 fb_dcookie; /* dentry cookie - always 0xfeebbaca */
34 __u32 fb_ino; /* our inode number */
35 __u32 fb_dirino; /* dir inode number, 0 for directories */
36 __u32 fb_dev; /* our device */
37 __u32 fb_xdev;
38 __u32 fb_xino;
39 __u32 fb_generation;
40};
41
42/*
43 * This is the new flexible, extensible style NFSv2/v3 file handle.
44 * by Neil Brown <neilb@cse.unsw.edu.au> - March 2000
45 *
46 * The file handle starts with a sequence of four-byte words.
47 * The first word contains a version number (1) and three descriptor bytes
48 * that tell how the remaining 3 variable length fields should be handled.
49 * These three bytes are auth_type, fsid_type and fileid_type.
50 *
51 * All four-byte values are in host-byte-order.
52 *
53 * The auth_type field specifies how the filehandle can be authenticated
54 * This might allow a file to be confirmed to be in a writable part of a
55 * filetree without checking the path from it up to the root.
56 * Current values:
57 * 0 - No authentication. fb_auth is 0 bytes long
58 * Possible future values:
59 * 1 - 4 bytes taken from MD5 hash of the remainer of the file handle
60 * prefixed by a secret and with the important export flags.
61 *
62 * The fsid_type identifies how the filesystem (or export point) is
63 * encoded.
64 * Current values:
65 * 0 - 4 byte device id (ms-2-bytes major, ls-2-bytes minor), 4byte inode number
66 * NOTE: we cannot use the kdev_t device id value, because kdev_t.h
67 * says we mustn't. We must break it up and reassemble.
68 * 1 - 4 byte user specified identifier
69 * 2 - 4 byte major, 4 byte minor, 4 byte inode number - DEPRECATED
70 * 3 - 4 byte device id, encoded for user-space, 4 byte inode number
71 * 4 - 4 byte inode number and 4 byte uuid
72 * 5 - 8 byte uuid
73 * 6 - 16 byte uuid
74 * 7 - 8 byte inode number and 16 byte uuid
75 *
76 * The fileid_type identified how the file within the filesystem is encoded.
77 * This is (will be) passed to, and set by, the underlying filesystem if it supports
78 * filehandle operations. The filesystem must not use the value '0' or '0xff' and may
79 * only use the values 1 and 2 as defined below:
80 * Current values:
81 * 0 - The root, or export point, of the filesystem. fb_fileid is 0 bytes.
82 * 1 - 32bit inode number, 32 bit generation number.
83 * 2 - 32bit inode number, 32 bit generation number, 32 bit parent directory inode number.
84 *
85 */
86struct nfs_fhbase_new {
87 __u8 fb_version; /* == 1, even => nfs_fhbase_old */
88 __u8 fb_auth_type;
89 __u8 fb_fsid_type;
90 __u8 fb_fileid_type;
91 __u32 fb_auth[1];
92/* __u32 fb_fsid[0]; floating */
93/* __u32 fb_fileid[0]; floating */
94};
95
96struct knfsd_fh {
97 unsigned int fh_size; /* significant for NFSv3.
98 * Points to the current size while building
99 * a new file handle
100 */
101 union {
102 struct nfs_fhbase_old fh_old;
103 __u32 fh_pad[NFS4_FHSIZE/4];
104 struct nfs_fhbase_new fh_new;
105 } fh_base;
106};
107
108#define ofh_dcookie fh_base.fh_old.fb_dcookie
109#define ofh_ino fh_base.fh_old.fb_ino
110#define ofh_dirino fh_base.fh_old.fb_dirino
111#define ofh_dev fh_base.fh_old.fb_dev
112#define ofh_xdev fh_base.fh_old.fb_xdev
113#define ofh_xino fh_base.fh_old.fb_xino
114#define ofh_generation fh_base.fh_old.fb_generation
115
116#define fh_version fh_base.fh_new.fb_version
117#define fh_fsid_type fh_base.fh_new.fb_fsid_type
118#define fh_auth_type fh_base.fh_new.fb_auth_type
119#define fh_fileid_type fh_base.fh_new.fb_fileid_type
120#define fh_auth fh_base.fh_new.fb_auth
121#define fh_fsid fh_base.fh_new.fb_auth
122
123#ifdef __KERNEL__
124 18
125static inline __u32 ino_t_to_u32(ino_t ino) 19static inline __u32 ino_t_to_u32(ino_t ino)
126{ 20{
@@ -166,7 +60,4 @@ typedef struct svc_fh {
166 60
167} svc_fh; 61} svc_fh;
168 62
169#endif /* __KERNEL__ */
170
171
172#endif /* _LINUX_NFSD_FH_H */ 63#endif /* _LINUX_NFSD_FH_H */
diff --git a/include/linux/nfsd/stats.h b/include/linux/nfsd/stats.h
index 2693ef647df6..e75b2544ff12 100644
--- a/include/linux/nfsd/stats.h
+++ b/include/linux/nfsd/stats.h
@@ -5,16 +5,11 @@
5 * 5 *
6 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> 6 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
7 */ 7 */
8
9#ifndef LINUX_NFSD_STATS_H 8#ifndef LINUX_NFSD_STATS_H
10#define LINUX_NFSD_STATS_H 9#define LINUX_NFSD_STATS_H
11 10
12#include <linux/nfs4.h> 11#include <uapi/linux/nfsd/stats.h>
13
14/* thread usage wraps very million seconds (approx one fortnight) */
15#define NFSD_USAGE_WRAP (HZ*1000000)
16 12
17#ifdef __KERNEL__
18 13
19struct nfsd_stats { 14struct nfsd_stats {
20 unsigned int rchits; /* repcache hits */ 15 unsigned int rchits; /* repcache hits */
@@ -47,5 +42,4 @@ extern struct svc_stat nfsd_svcstats;
47void nfsd_stat_init(void); 42void nfsd_stat_init(void);
48void nfsd_stat_shutdown(void); 43void nfsd_stat_shutdown(void);
49 44
50#endif /* __KERNEL__ */
51#endif /* LINUX_NFSD_STATS_H */ 45#endif /* LINUX_NFSD_STATS_H */
diff --git a/include/linux/nubus.h b/include/linux/nubus.h
index e137b3c486a7..a8696bbdfbc4 100644
--- a/include/linux/nubus.h
+++ b/include/linux/nubus.h
@@ -8,236 +8,12 @@
8 Some of the constants in here are from the corresponding 8 Some of the constants in here are from the corresponding
9 NetBSD/OpenBSD header file, by Allen Briggs. We figured out the 9 NetBSD/OpenBSD header file, by Allen Briggs. We figured out the
10 rest of them on our own. */ 10 rest of them on our own. */
11
12#ifndef LINUX_NUBUS_H 11#ifndef LINUX_NUBUS_H
13#define LINUX_NUBUS_H 12#define LINUX_NUBUS_H
14 13
15#include <linux/types.h>
16#ifdef __KERNEL__
17#include <asm/nubus.h> 14#include <asm/nubus.h>
18#endif 15#include <uapi/linux/nubus.h>
19
20enum nubus_category {
21 NUBUS_CAT_BOARD = 0x0001,
22 NUBUS_CAT_DISPLAY = 0x0003,
23 NUBUS_CAT_NETWORK = 0x0004,
24 NUBUS_CAT_COMMUNICATIONS = 0x0006,
25 NUBUS_CAT_FONT = 0x0009,
26 NUBUS_CAT_CPU = 0x000A,
27 /* For lack of a better name */
28 NUBUS_CAT_DUODOCK = 0x0020
29};
30
31enum nubus_type_network {
32 NUBUS_TYPE_ETHERNET = 0x0001,
33 NUBUS_TYPE_RS232 = 0x0002
34};
35
36enum nubus_type_display {
37 NUBUS_TYPE_VIDEO = 0x0001
38};
39
40enum nubus_type_cpu {
41 NUBUS_TYPE_68020 = 0x0003,
42 NUBUS_TYPE_68030 = 0x0004,
43 NUBUS_TYPE_68040 = 0x0005
44};
45
46/* Known <Cat,Type,SW,HW> tuples: (according to TattleTech and Slots)
47 * 68030 motherboards: <10,4,0,24>
48 * 68040 motherboards: <10,5,0,24>
49 * DuoDock Plus: <32,1,1,2>
50 *
51 * Toby Frame Buffer card: <3,1,1,1>
52 * RBV built-in video (IIci): <3,1,1,24>
53 * Valkyrie built-in video (Q630): <3,1,1,46>
54 * Macintosh Display Card: <3,1,1,25>
55 * Sonora built-in video (P460): <3,1,1,34>
56 * Jet framebuffer (DuoDock Plus): <3,1,1,41>
57 *
58 * SONIC comm-slot/on-board and DuoDock Ethernet: <4,1,1,272>
59 * SONIC LC-PDS Ethernet (Dayna, but like Apple 16-bit, sort of): <4,1,1,271>
60 * Apple SONIC LC-PDS Ethernet ("Apple Ethernet LC Twisted-Pair Card"): <4,1,0,281>
61 * Sonic Systems Ethernet A-Series Card: <4,1,268,256>
62 * Asante MacCon NuBus-A: <4,1,260,256> (alpha-1.0,1.1 revision)
63 * ROM on the above card: <2,1,0,0>
64 * Cabletron ethernet card: <4,1,1,265>
65 * Farallon ethernet card: <4,1,268,256> (identical to Sonic Systems card)
66 * Kinetics EtherPort IIN: <4,1,259,262>
67 * API Engineering EtherRun_LCa PDS enet card: <4,1,282,256>
68 *
69 * Add your devices to the list! You can obtain the "Slots" utility
70 * from Apple's FTP site at:
71 * ftp://dev.apple.com/devworld/Tool_Chest/Devices_-_Hardware/NuBus_Slot_Manager/
72 *
73 * Alternately, TattleTech can be found at any Info-Mac mirror site.
74 * or from its distribution site: ftp://ftp.decismkr.com/dms
75 */
76
77/* DrSW: Uniquely identifies the software interface to a board. This
78 is usually the one you want to look at when writing a driver. It's
79 not as useful as you think, though, because as we should know by
80 now (duh), "Apple Compatible" can mean a lot of things... */
81
82/* Add known DrSW values here */
83enum nubus_drsw {
84 /* NUBUS_CAT_DISPLAY */
85 NUBUS_DRSW_APPLE = 0x0001,
86 NUBUS_DRSW_APPLE_HIRES = 0x0013, /* MacII HiRes card driver */
87
88 /* NUBUS_CAT_NETWORK */
89 NUBUS_DRSW_3COM = 0x0000,
90 NUBUS_DRSW_CABLETRON = 0x0001,
91 NUBUS_DRSW_SONIC_LC = 0x0001,
92 NUBUS_DRSW_KINETICS = 0x0103,
93 NUBUS_DRSW_ASANTE = 0x0104,
94 NUBUS_DRSW_TECHWORKS = 0x0109,
95 NUBUS_DRSW_DAYNA = 0x010b,
96 NUBUS_DRSW_FARALLON = 0x010c,
97 NUBUS_DRSW_APPLE_SN = 0x010f,
98 NUBUS_DRSW_DAYNA2 = 0x0115,
99 NUBUS_DRSW_FOCUS = 0x011a,
100 NUBUS_DRSW_ASANTE_CS = 0x011d, /* use asante SMC9194 driver */
101 NUBUS_DRSW_DAYNA_LC = 0x011e,
102
103 /* NUBUS_CAT_CPU */
104 NUBUS_DRSW_NONE = 0x0000,
105};
106
107/* DrHW: Uniquely identifies the hardware interface to a board (or at
108 least, it should... some video cards are known to incorrectly
109 identify themselves as Toby cards) */
110
111/* Add known DrHW values here */
112enum nubus_drhw {
113 /* NUBUS_CAT_DISPLAY */
114 NUBUS_DRHW_APPLE_TFB = 0x0001, /* Toby frame buffer card */
115 NUBUS_DRHW_APPLE_WVC = 0x0006, /* Apple Workstation Video Card */
116 NUBUS_DRHW_SIGMA_CLRMAX = 0x0007, /* Sigma Design ColorMax */
117 NUBUS_DRHW_APPLE_SE30 = 0x0009, /* Apple SE/30 video */
118 NUBUS_DRHW_APPLE_HRVC = 0x0013, /* Mac II High-Res Video Card */
119 NUBUS_DRHW_APPLE_PVC = 0x0017, /* Mac II Portrait Video Card */
120 NUBUS_DRHW_APPLE_RBV1 = 0x0018, /* IIci RBV video */
121 NUBUS_DRHW_APPLE_MDC = 0x0019, /* Macintosh Display Card */
122 NUBUS_DRHW_APPLE_SONORA = 0x0022, /* Sonora built-in video */
123 NUBUS_DRHW_APPLE_24AC = 0x002b, /* Mac 24AC Video Card */
124 NUBUS_DRHW_APPLE_VALKYRIE = 0x002e,
125 NUBUS_DRHW_APPLE_JET = 0x0029, /* Jet framebuffer (DuoDock) */
126 NUBUS_DRHW_SMAC_GFX = 0x0105, /* SuperMac GFX */
127 NUBUS_DRHW_RASTER_CB264 = 0x013B, /* RasterOps ColorBoard 264 */
128 NUBUS_DRHW_MICRON_XCEED = 0x0146, /* Micron Exceed color */
129 NUBUS_DRHW_RDIUS_GSC = 0x0153, /* Radius GS/C */
130 NUBUS_DRHW_SMAC_SPEC8 = 0x017B, /* SuperMac Spectrum/8 */
131 NUBUS_DRHW_SMAC_SPEC24 = 0x017C, /* SuperMac Spectrum/24 */
132 NUBUS_DRHW_RASTER_CB364 = 0x026F, /* RasterOps ColorBoard 364 */
133 NUBUS_DRHW_RDIUS_DCGX = 0x027C, /* Radius DirectColor/GX */
134 NUBUS_DRHW_RDIUS_PC8 = 0x0291, /* Radius PrecisionColor 8 */
135 NUBUS_DRHW_LAPIS_PCS8 = 0x0292, /* Lapis ProColorServer 8 */
136 NUBUS_DRHW_RASTER_24XLI = 0x02A0, /* RasterOps 8/24 XLi */
137 NUBUS_DRHW_RASTER_PBPGT = 0x02A5, /* RasterOps PaintBoard Prism GT */
138 NUBUS_DRHW_EMACH_FSX = 0x02AE, /* E-Machines Futura SX */
139 NUBUS_DRHW_RASTER_24XLTV = 0x02B7, /* RasterOps 24XLTV */
140 NUBUS_DRHW_SMAC_THUND24 = 0x02CB, /* SuperMac Thunder/24 */
141 NUBUS_DRHW_SMAC_THUNDLGHT = 0x03D9, /* SuperMac ThunderLight */
142 NUBUS_DRHW_RDIUS_PC24XP = 0x0406, /* Radius PrecisionColor 24Xp */
143 NUBUS_DRHW_RDIUS_PC24X = 0x040A, /* Radius PrecisionColor 24X */
144 NUBUS_DRHW_RDIUS_PC8XJ = 0x040B, /* Radius PrecisionColor 8XJ */
145
146 /* NUBUS_CAT_NETWORK */
147 NUBUS_DRHW_INTERLAN = 0x0100,
148 NUBUS_DRHW_SMC9194 = 0x0101,
149 NUBUS_DRHW_KINETICS = 0x0106,
150 NUBUS_DRHW_CABLETRON = 0x0109,
151 NUBUS_DRHW_ASANTE_LC = 0x010f,
152 NUBUS_DRHW_SONIC = 0x0110,
153 NUBUS_DRHW_TECHWORKS = 0x0112,
154 NUBUS_DRHW_APPLE_SONIC_NB = 0x0118,
155 NUBUS_DRHW_APPLE_SONIC_LC = 0x0119,
156 NUBUS_DRHW_FOCUS = 0x011c,
157 NUBUS_DRHW_SONNET = 0x011d,
158};
159 16
160/* Resource IDs: These are the identifiers for the various weird and
161 wonderful tidbits of information that may or may not reside in the
162 NuBus ROM directory. */
163enum nubus_res_id {
164 NUBUS_RESID_TYPE = 0x0001,
165 NUBUS_RESID_NAME = 0x0002,
166 NUBUS_RESID_ICON = 0x0003,
167 NUBUS_RESID_DRVRDIR = 0x0004,
168 NUBUS_RESID_LOADREC = 0x0005,
169 NUBUS_RESID_BOOTREC = 0x0006,
170 NUBUS_RESID_FLAGS = 0x0007,
171 NUBUS_RESID_HWDEVID = 0x0008,
172 NUBUS_RESID_MINOR_BASEOS = 0x000a,
173 NUBUS_RESID_MINOR_LENGTH = 0x000b,
174 NUBUS_RESID_MAJOR_BASEOS = 0x000c,
175 NUBUS_RESID_MAJOR_LENGTH = 0x000d,
176 NUBUS_RESID_CICN = 0x000f,
177 NUBUS_RESID_ICL8 = 0x0010,
178 NUBUS_RESID_ICL4 = 0x0011,
179};
180
181/* Category-specific resources. */
182enum nubus_board_res_id {
183 NUBUS_RESID_BOARDID = 0x0020,
184 NUBUS_RESID_PRAMINITDATA = 0x0021,
185 NUBUS_RESID_PRIMARYINIT = 0x0022,
186 NUBUS_RESID_TIMEOUTCONST = 0x0023,
187 NUBUS_RESID_VENDORINFO = 0x0024,
188 NUBUS_RESID_BOARDFLAGS = 0x0025,
189 NUBUS_RESID_SECONDINIT = 0x0026,
190
191 /* Not sure why Apple put these next two in here */
192 NUBUS_RESID_VIDNAMES = 0x0041,
193 NUBUS_RESID_VIDMODES = 0x007e
194};
195
196/* Fields within the vendor info directory */
197enum nubus_vendor_res_id {
198 NUBUS_RESID_VEND_ID = 0x0001,
199 NUBUS_RESID_VEND_SERIAL = 0x0002,
200 NUBUS_RESID_VEND_REV = 0x0003,
201 NUBUS_RESID_VEND_PART = 0x0004,
202 NUBUS_RESID_VEND_DATE = 0x0005
203};
204
205enum nubus_net_res_id {
206 NUBUS_RESID_MAC_ADDRESS = 0x0080
207};
208
209enum nubus_cpu_res_id {
210 NUBUS_RESID_MEMINFO = 0x0081,
211 NUBUS_RESID_ROMINFO = 0x0082
212};
213
214enum nubus_display_res_id {
215 NUBUS_RESID_GAMMADIR = 0x0040,
216 NUBUS_RESID_FIRSTMODE = 0x0080,
217 NUBUS_RESID_SECONDMODE = 0x0081,
218 NUBUS_RESID_THIRDMODE = 0x0082,
219 NUBUS_RESID_FOURTHMODE = 0x0083,
220 NUBUS_RESID_FIFTHMODE = 0x0084,
221 NUBUS_RESID_SIXTHMODE = 0x0085
222};
223
224struct nubus_dir
225{
226 unsigned char *base;
227 unsigned char *ptr;
228 int done;
229 int mask;
230};
231
232struct nubus_dirent
233{
234 unsigned char *base;
235 unsigned char type;
236 __u32 data; /* Actually 24bits used */
237 int mask;
238};
239
240#ifdef __KERNEL__
241struct nubus_board { 17struct nubus_board {
242 struct nubus_board* next; 18 struct nubus_board* next;
243 struct nubus_dev* first_dev; 19 struct nubus_dev* first_dev;
@@ -352,12 +128,4 @@ void nubus_get_rsrc_mem(void* dest,
352void nubus_get_rsrc_str(void* dest, 128void nubus_get_rsrc_str(void* dest,
353 const struct nubus_dirent *dirent, 129 const struct nubus_dirent *dirent,
354 int maxlen); 130 int maxlen);
355#endif /* __KERNEL__ */
356
357/* We'd like to get rid of this eventually. Only daynaport.c uses it now. */
358static inline void *nubus_slot_addr(int slot)
359{
360 return (void *)(0xF0000000|(slot<<24));
361}
362
363#endif /* LINUX_NUBUS_H */ 131#endif /* LINUX_NUBUS_H */
diff --git a/include/linux/nvram.h b/include/linux/nvram.h
index 9189829c131c..cf0ff555a6ac 100644
--- a/include/linux/nvram.h
+++ b/include/linux/nvram.h
@@ -1,18 +1,8 @@
1#ifndef _LINUX_NVRAM_H 1#ifndef _LINUX_NVRAM_H
2#define _LINUX_NVRAM_H 2#define _LINUX_NVRAM_H
3 3
4#include <linux/ioctl.h> 4#include <uapi/linux/nvram.h>
5 5
6/* /dev/nvram ioctls */
7#define NVRAM_INIT _IO('p', 0x40) /* initialize NVRAM and set checksum */
8#define NVRAM_SETCKS _IO('p', 0x41) /* recalculate checksum */
9
10/* for all current systems, this is where NVRAM starts */
11#define NVRAM_FIRST_BYTE 14
12/* all these functions expect an NVRAM offset, not an absolute */
13#define NVRAM_OFFSET(x) ((x)-NVRAM_FIRST_BYTE)
14
15#ifdef __KERNEL__
16/* __foo is foo without grabbing the rtc_lock - get it yourself */ 6/* __foo is foo without grabbing the rtc_lock - get it yourself */
17extern unsigned char __nvram_read_byte(int i); 7extern unsigned char __nvram_read_byte(int i);
18extern unsigned char nvram_read_byte(int i); 8extern unsigned char nvram_read_byte(int i);
@@ -20,6 +10,4 @@ extern void __nvram_write_byte(unsigned char c, int i);
20extern void nvram_write_byte(unsigned char c, int i); 10extern void nvram_write_byte(unsigned char c, int i);
21extern int __nvram_check_checksum(void); 11extern int __nvram_check_checksum(void);
22extern int nvram_check_checksum(void); 12extern int nvram_check_checksum(void);
23#endif
24
25#endif /* _LINUX_NVRAM_H */ 13#endif /* _LINUX_NVRAM_H */
diff --git a/include/linux/of.h b/include/linux/of.h
index f594c528842f..b4e50d56fc74 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -317,6 +317,12 @@ static inline const char* of_node_full_name(struct device_node *np)
317 return "<no-node>"; 317 return "<no-node>";
318} 318}
319 319
320static inline struct device_node *of_find_node_by_name(struct device_node *from,
321 const char *name)
322{
323 return NULL;
324}
325
320static inline bool of_have_populated_dt(void) 326static inline bool of_have_populated_dt(void)
321{ 327{
322 return false; 328 return false;
@@ -325,6 +331,13 @@ static inline bool of_have_populated_dt(void)
325#define for_each_child_of_node(parent, child) \ 331#define for_each_child_of_node(parent, child) \
326 while (0) 332 while (0)
327 333
334static inline struct device_node *of_get_child_by_name(
335 const struct device_node *node,
336 const char *name)
337{
338 return NULL;
339}
340
328static inline int of_get_child_count(const struct device_node *np) 341static inline int of_get_child_count(const struct device_node *np)
329{ 342{
330 return 0; 343 return 0;
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index c3cdc1025c30..a1984dd037da 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -19,7 +19,7 @@ extern void __iomem *of_iomap(struct device_node *device, int index);
19 * the address space flags too. The PCI version uses a BAR number 19 * the address space flags too. The PCI version uses a BAR number
20 * instead of an absolute index 20 * instead of an absolute index
21 */ 21 */
22extern const u32 *of_get_address(struct device_node *dev, int index, 22extern const __be32 *of_get_address(struct device_node *dev, int index,
23 u64 *size, unsigned int *flags); 23 u64 *size, unsigned int *flags);
24 24
25#ifndef pci_address_to_pio 25#ifndef pci_address_to_pio
@@ -44,7 +44,7 @@ static inline void __iomem *of_iomap(struct device_node *device, int index)
44{ 44{
45 return NULL; 45 return NULL;
46} 46}
47static inline const u32 *of_get_address(struct device_node *dev, int index, 47static inline const __be32 *of_get_address(struct device_node *dev, int index,
48 u64 *size, unsigned int *flags) 48 u64 *size, unsigned int *flags)
49{ 49{
50 return NULL; 50 return NULL;
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index b8e241125201..535cecf1e02f 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -58,8 +58,8 @@ static inline int of_irq_map_oldworld(struct device_node *device, int index,
58#endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */ 58#endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */
59 59
60 60
61extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec, 61extern int of_irq_map_raw(struct device_node *parent, const __be32 *intspec,
62 u32 ointsize, const u32 *addr, 62 u32 ointsize, const __be32 *addr,
63 struct of_irq *out_irq); 63 struct of_irq *out_irq);
64extern int of_irq_map_one(struct device_node *device, int index, 64extern int of_irq_map_one(struct device_node *device, int index,
65 struct of_irq *out_irq); 65 struct of_irq *out_irq);
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
index 6ef49b803efb..8163107b94b4 100644
--- a/include/linux/of_mdio.h
+++ b/include/linux/of_mdio.h
@@ -26,32 +26,32 @@ extern struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
26extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np); 26extern struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np);
27 27
28#else /* CONFIG_OF */ 28#else /* CONFIG_OF */
29int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) 29static inline int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
30{ 30{
31 return -ENOSYS; 31 return -ENOSYS;
32} 32}
33 33
34struct phy_device *of_phy_find_device(struct device_node *phy_np) 34static inline struct phy_device *of_phy_find_device(struct device_node *phy_np)
35{ 35{
36 return NULL; 36 return NULL;
37} 37}
38 38
39struct phy_device *of_phy_connect(struct net_device *dev, 39static inline struct phy_device *of_phy_connect(struct net_device *dev,
40 struct device_node *phy_np, 40 struct device_node *phy_np,
41 void (*hndlr)(struct net_device *), 41 void (*hndlr)(struct net_device *),
42 u32 flags, phy_interface_t iface) 42 u32 flags, phy_interface_t iface)
43{ 43{
44 return NULL; 44 return NULL;
45} 45}
46 46
47struct phy_device *of_phy_connect_fixed_link(struct net_device *dev, 47static inline struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
48 void (*hndlr)(struct net_device *), 48 void (*hndlr)(struct net_device *),
49 phy_interface_t iface) 49 phy_interface_t iface)
50{ 50{
51 return NULL; 51 return NULL;
52} 52}
53 53
54struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np) 54static inline struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np)
55{ 55{
56 return NULL; 56 return NULL;
57} 57}
diff --git a/include/linux/oid_registry.h b/include/linux/oid_registry.h
new file mode 100644
index 000000000000..6926db724258
--- /dev/null
+++ b/include/linux/oid_registry.h
@@ -0,0 +1,92 @@
1/* ASN.1 Object identifier (OID) registry
2 *
3 * Copyright (C) 2012 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
12#ifndef _LINUX_OID_REGISTRY_H
13#define _LINUX_OID_REGISTRY_H
14
15#include <linux/types.h>
16
17/*
18 * OIDs are turned into these values if possible, or OID__NR if not held here.
19 *
20 * NOTE! Do not mess with the format of each line as this is read by
21 * build_OID_registry.pl to generate the data for look_up_OID().
22 */
23enum OID {
24 OID_id_dsa_with_sha1, /* 1.2.840.10030.4.3 */
25 OID_id_dsa, /* 1.2.840.10040.4.1 */
26 OID_id_ecdsa_with_sha1, /* 1.2.840.10045.4.1 */
27 OID_id_ecPublicKey, /* 1.2.840.10045.2.1 */
28
29 /* PKCS#1 {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1)} */
30 OID_rsaEncryption, /* 1.2.840.113549.1.1.1 */
31 OID_md2WithRSAEncryption, /* 1.2.840.113549.1.1.2 */
32 OID_md3WithRSAEncryption, /* 1.2.840.113549.1.1.3 */
33 OID_md4WithRSAEncryption, /* 1.2.840.113549.1.1.4 */
34 OID_sha1WithRSAEncryption, /* 1.2.840.113549.1.1.5 */
35 OID_sha256WithRSAEncryption, /* 1.2.840.113549.1.1.11 */
36 OID_sha384WithRSAEncryption, /* 1.2.840.113549.1.1.12 */
37 OID_sha512WithRSAEncryption, /* 1.2.840.113549.1.1.13 */
38 OID_sha224WithRSAEncryption, /* 1.2.840.113549.1.1.14 */
39 /* PKCS#7 {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-7(7)} */
40 OID_data, /* 1.2.840.113549.1.7.1 */
41 OID_signed_data, /* 1.2.840.113549.1.7.2 */
42 /* PKCS#9 {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9)} */
43 OID_email_address, /* 1.2.840.113549.1.9.1 */
44 OID_content_type, /* 1.2.840.113549.1.9.3 */
45 OID_messageDigest, /* 1.2.840.113549.1.9.4 */
46 OID_signingTime, /* 1.2.840.113549.1.9.5 */
47 OID_smimeCapabilites, /* 1.2.840.113549.1.9.15 */
48 OID_smimeAuthenticatedAttrs, /* 1.2.840.113549.1.9.16.2.11 */
49
50 /* {iso(1) member-body(2) us(840) rsadsi(113549) digestAlgorithm(2)} */
51 OID_md2, /* 1.2.840.113549.2.2 */
52 OID_md4, /* 1.2.840.113549.2.4 */
53 OID_md5, /* 1.2.840.113549.2.5 */
54
55 OID_certAuthInfoAccess, /* 1.3.6.1.5.5.7.1.1 */
56 OID_msOutlookExpress, /* 1.3.6.1.4.1.311.16.4 */
57 OID_sha1, /* 1.3.14.3.2.26 */
58
59 /* Distinguished Name attribute IDs [RFC 2256] */
60 OID_commonName, /* 2.5.4.3 */
61 OID_surname, /* 2.5.4.4 */
62 OID_countryName, /* 2.5.4.6 */
63 OID_locality, /* 2.5.4.7 */
64 OID_stateOrProvinceName, /* 2.5.4.8 */
65 OID_organizationName, /* 2.5.4.10 */
66 OID_organizationUnitName, /* 2.5.4.11 */
67 OID_title, /* 2.5.4.12 */
68 OID_description, /* 2.5.4.13 */
69 OID_name, /* 2.5.4.41 */
70 OID_givenName, /* 2.5.4.42 */
71 OID_initials, /* 2.5.4.43 */
72 OID_generationalQualifier, /* 2.5.4.44 */
73
74 /* Certificate extension IDs */
75 OID_subjectKeyIdentifier, /* 2.5.29.14 */
76 OID_keyUsage, /* 2.5.29.15 */
77 OID_subjectAltName, /* 2.5.29.17 */
78 OID_issuerAltName, /* 2.5.29.18 */
79 OID_basicConstraints, /* 2.5.29.19 */
80 OID_crlDistributionPoints, /* 2.5.29.31 */
81 OID_certPolicies, /* 2.5.29.32 */
82 OID_authorityKeyIdentifier, /* 2.5.29.35 */
83 OID_extKeyUsage, /* 2.5.29.37 */
84
85 OID__NR
86};
87
88extern enum OID look_up_OID(const void *data, size_t datasize);
89extern int sprint_oid(const void *, size_t, char *, size_t);
90extern int sprint_OID(enum OID, char *, size_t);
91
92#endif /* _LINUX_OID_REGISTRY_H */
diff --git a/include/linux/omapfb.h b/include/linux/omapfb.h
index 85af8184691a..d1f4dccaeede 100644
--- a/include/linux/omapfb.h
+++ b/include/linux/omapfb.h
@@ -20,205 +20,11 @@
20 * with this program; if not, write to the Free Software Foundation, Inc., 20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */ 22 */
23
24#ifndef __LINUX_OMAPFB_H__ 23#ifndef __LINUX_OMAPFB_H__
25#define __LINUX_OMAPFB_H__ 24#define __LINUX_OMAPFB_H__
26 25
27#include <linux/fb.h> 26#include <uapi/linux/omapfb.h>
28#include <linux/ioctl.h>
29#include <linux/types.h>
30
31/* IOCTL commands. */
32
33#define OMAP_IOW(num, dtype) _IOW('O', num, dtype)
34#define OMAP_IOR(num, dtype) _IOR('O', num, dtype)
35#define OMAP_IOWR(num, dtype) _IOWR('O', num, dtype)
36#define OMAP_IO(num) _IO('O', num)
37
38#define OMAPFB_MIRROR OMAP_IOW(31, int)
39#define OMAPFB_SYNC_GFX OMAP_IO(37)
40#define OMAPFB_VSYNC OMAP_IO(38)
41#define OMAPFB_SET_UPDATE_MODE OMAP_IOW(40, int)
42#define OMAPFB_GET_CAPS OMAP_IOR(42, struct omapfb_caps)
43#define OMAPFB_GET_UPDATE_MODE OMAP_IOW(43, int)
44#define OMAPFB_LCD_TEST OMAP_IOW(45, int)
45#define OMAPFB_CTRL_TEST OMAP_IOW(46, int)
46#define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(47, struct omapfb_update_window_old)
47#define OMAPFB_SET_COLOR_KEY OMAP_IOW(50, struct omapfb_color_key)
48#define OMAPFB_GET_COLOR_KEY OMAP_IOW(51, struct omapfb_color_key)
49#define OMAPFB_SETUP_PLANE OMAP_IOW(52, struct omapfb_plane_info)
50#define OMAPFB_QUERY_PLANE OMAP_IOW(53, struct omapfb_plane_info)
51#define OMAPFB_UPDATE_WINDOW OMAP_IOW(54, struct omapfb_update_window)
52#define OMAPFB_SETUP_MEM OMAP_IOW(55, struct omapfb_mem_info)
53#define OMAPFB_QUERY_MEM OMAP_IOW(56, struct omapfb_mem_info)
54#define OMAPFB_WAITFORVSYNC OMAP_IO(57)
55#define OMAPFB_MEMORY_READ OMAP_IOR(58, struct omapfb_memory_read)
56#define OMAPFB_GET_OVERLAY_COLORMODE OMAP_IOR(59, struct omapfb_ovl_colormode)
57#define OMAPFB_WAITFORGO OMAP_IO(60)
58#define OMAPFB_GET_VRAM_INFO OMAP_IOR(61, struct omapfb_vram_info)
59#define OMAPFB_SET_TEARSYNC OMAP_IOW(62, struct omapfb_tearsync_info)
60#define OMAPFB_GET_DISPLAY_INFO OMAP_IOR(63, struct omapfb_display_info)
61
62#define OMAPFB_CAPS_GENERIC_MASK 0x00000fff
63#define OMAPFB_CAPS_LCDC_MASK 0x00fff000
64#define OMAPFB_CAPS_PANEL_MASK 0xff000000
65
66#define OMAPFB_CAPS_MANUAL_UPDATE 0x00001000
67#define OMAPFB_CAPS_TEARSYNC 0x00002000
68#define OMAPFB_CAPS_PLANE_RELOCATE_MEM 0x00004000
69#define OMAPFB_CAPS_PLANE_SCALE 0x00008000
70#define OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE 0x00010000
71#define OMAPFB_CAPS_WINDOW_SCALE 0x00020000
72#define OMAPFB_CAPS_WINDOW_OVERLAY 0x00040000
73#define OMAPFB_CAPS_WINDOW_ROTATE 0x00080000
74#define OMAPFB_CAPS_SET_BACKLIGHT 0x01000000
75
76/* Values from DSP must map to lower 16-bits */
77#define OMAPFB_FORMAT_MASK 0x00ff
78#define OMAPFB_FORMAT_FLAG_DOUBLE 0x0100
79#define OMAPFB_FORMAT_FLAG_TEARSYNC 0x0200
80#define OMAPFB_FORMAT_FLAG_FORCE_VSYNC 0x0400
81#define OMAPFB_FORMAT_FLAG_ENABLE_OVERLAY 0x0800
82#define OMAPFB_FORMAT_FLAG_DISABLE_OVERLAY 0x1000
83
84#define OMAPFB_MEMTYPE_SDRAM 0
85#define OMAPFB_MEMTYPE_SRAM 1
86#define OMAPFB_MEMTYPE_MAX 1
87
88#define OMAPFB_MEM_IDX_ENABLED 0x80
89#define OMAPFB_MEM_IDX_MASK 0x7f
90
91enum omapfb_color_format {
92 OMAPFB_COLOR_RGB565 = 0,
93 OMAPFB_COLOR_YUV422,
94 OMAPFB_COLOR_YUV420,
95 OMAPFB_COLOR_CLUT_8BPP,
96 OMAPFB_COLOR_CLUT_4BPP,
97 OMAPFB_COLOR_CLUT_2BPP,
98 OMAPFB_COLOR_CLUT_1BPP,
99 OMAPFB_COLOR_RGB444,
100 OMAPFB_COLOR_YUY422,
101
102 OMAPFB_COLOR_ARGB16,
103 OMAPFB_COLOR_RGB24U, /* RGB24, 32-bit container */
104 OMAPFB_COLOR_RGB24P, /* RGB24, 24-bit container */
105 OMAPFB_COLOR_ARGB32,
106 OMAPFB_COLOR_RGBA32,
107 OMAPFB_COLOR_RGBX32,
108};
109
110struct omapfb_update_window {
111 __u32 x, y;
112 __u32 width, height;
113 __u32 format;
114 __u32 out_x, out_y;
115 __u32 out_width, out_height;
116 __u32 reserved[8];
117};
118 27
119struct omapfb_update_window_old {
120 __u32 x, y;
121 __u32 width, height;
122 __u32 format;
123};
124
125enum omapfb_plane {
126 OMAPFB_PLANE_GFX = 0,
127 OMAPFB_PLANE_VID1,
128 OMAPFB_PLANE_VID2,
129};
130
131enum omapfb_channel_out {
132 OMAPFB_CHANNEL_OUT_LCD = 0,
133 OMAPFB_CHANNEL_OUT_DIGIT,
134};
135
136struct omapfb_plane_info {
137 __u32 pos_x;
138 __u32 pos_y;
139 __u8 enabled;
140 __u8 channel_out;
141 __u8 mirror;
142 __u8 mem_idx;
143 __u32 out_width;
144 __u32 out_height;
145 __u32 reserved2[12];
146};
147
148struct omapfb_mem_info {
149 __u32 size;
150 __u8 type;
151 __u8 reserved[3];
152};
153
154struct omapfb_caps {
155 __u32 ctrl;
156 __u32 plane_color;
157 __u32 wnd_color;
158};
159
160enum omapfb_color_key_type {
161 OMAPFB_COLOR_KEY_DISABLED = 0,
162 OMAPFB_COLOR_KEY_GFX_DST,
163 OMAPFB_COLOR_KEY_VID_SRC,
164};
165
166struct omapfb_color_key {
167 __u8 channel_out;
168 __u32 background;
169 __u32 trans_key;
170 __u8 key_type;
171};
172
173enum omapfb_update_mode {
174 OMAPFB_UPDATE_DISABLED = 0,
175 OMAPFB_AUTO_UPDATE,
176 OMAPFB_MANUAL_UPDATE
177};
178
179struct omapfb_memory_read {
180 __u16 x;
181 __u16 y;
182 __u16 w;
183 __u16 h;
184 size_t buffer_size;
185 void __user *buffer;
186};
187
188struct omapfb_ovl_colormode {
189 __u8 overlay_idx;
190 __u8 mode_idx;
191 __u32 bits_per_pixel;
192 __u32 nonstd;
193 struct fb_bitfield red;
194 struct fb_bitfield green;
195 struct fb_bitfield blue;
196 struct fb_bitfield transp;
197};
198
199struct omapfb_vram_info {
200 __u32 total;
201 __u32 free;
202 __u32 largest_free_block;
203 __u32 reserved[5];
204};
205
206struct omapfb_tearsync_info {
207 __u8 enabled;
208 __u8 reserved1[3];
209 __u16 line;
210 __u16 reserved2;
211};
212
213struct omapfb_display_info {
214 __u16 xres;
215 __u16 yres;
216 __u32 width; /* phys width of the display in micrometers */
217 __u32 height; /* phys height of the display in micrometers */
218 __u32 reserved[5];
219};
220
221#ifdef __KERNEL__
222 28
223struct omap_lcd_config { 29struct omap_lcd_config {
224 char panel_name[16]; 30 char panel_name[16];
@@ -233,6 +39,4 @@ struct omapfb_platform_data {
233 39
234void __init omapfb_set_lcd_config(const struct omap_lcd_config *config); 40void __init omapfb_set_lcd_config(const struct omap_lcd_config *config);
235 41
236#endif
237
238#endif /* __OMAPFB_H */ 42#endif /* __OMAPFB_H */
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 49a3031fda50..fb9826847b89 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -1,29 +1,11 @@
1#ifndef __INCLUDE_LINUX_OOM_H 1#ifndef __INCLUDE_LINUX_OOM_H
2#define __INCLUDE_LINUX_OOM_H 2#define __INCLUDE_LINUX_OOM_H
3 3
4/*
5 * /proc/<pid>/oom_adj is deprecated, see
6 * Documentation/feature-removal-schedule.txt.
7 *
8 * /proc/<pid>/oom_adj set to -17 protects from the oom-killer
9 */
10#define OOM_DISABLE (-17)
11/* inclusive */
12#define OOM_ADJUST_MIN (-16)
13#define OOM_ADJUST_MAX 15
14
15/*
16 * /proc/<pid>/oom_score_adj set to OOM_SCORE_ADJ_MIN disables oom killing for
17 * pid.
18 */
19#define OOM_SCORE_ADJ_MIN (-1000)
20#define OOM_SCORE_ADJ_MAX 1000
21
22#ifdef __KERNEL__
23 4
24#include <linux/sched.h> 5#include <linux/sched.h>
25#include <linux/types.h> 6#include <linux/types.h>
26#include <linux/nodemask.h> 7#include <linux/nodemask.h>
8#include <uapi/linux/oom.h>
27 9
28struct zonelist; 10struct zonelist;
29struct notifier_block; 11struct notifier_block;
@@ -93,5 +75,4 @@ extern struct task_struct *find_lock_task_mm(struct task_struct *p);
93extern int sysctl_oom_dump_tasks; 75extern int sysctl_oom_dump_tasks;
94extern int sysctl_oom_kill_allocating_task; 76extern int sysctl_oom_kill_allocating_task;
95extern int sysctl_panic_on_oom; 77extern int sysctl_panic_on_oom;
96#endif /* __KERNEL__*/
97#endif /* _INCLUDE_LINUX_OOM_H */ 78#endif /* _INCLUDE_LINUX_OOM_H */
diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h
index 105077aa7685..76a9539cfd3f 100644
--- a/include/linux/page-isolation.h
+++ b/include/linux/page-isolation.h
@@ -6,6 +6,10 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count);
6void set_pageblock_migratetype(struct page *page, int migratetype); 6void set_pageblock_migratetype(struct page *page, int migratetype);
7int move_freepages_block(struct zone *zone, struct page *page, 7int move_freepages_block(struct zone *zone, struct page *page,
8 int migratetype); 8 int migratetype);
9int move_freepages(struct zone *zone,
10 struct page *start_page, struct page *end_page,
11 int migratetype);
12
9/* 13/*
10 * Changes migrate type in [start_pfn, end_pfn) to be MIGRATE_ISOLATE. 14 * Changes migrate type in [start_pfn, end_pfn) to be MIGRATE_ISOLATE.
11 * If specified range includes migrate types other than MOVABLE or CMA, 15 * If specified range includes migrate types other than MOVABLE or CMA,
@@ -37,6 +41,7 @@ int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn);
37 */ 41 */
38int set_migratetype_isolate(struct page *page); 42int set_migratetype_isolate(struct page *page);
39void unset_migratetype_isolate(struct page *page, unsigned migratetype); 43void unset_migratetype_isolate(struct page *page, unsigned migratetype);
40 44struct page *alloc_migrate_target(struct page *page, unsigned long private,
45 int **resultp);
41 46
42#endif 47#endif
diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h
index 19ef95d293ae..be655e4a2a75 100644
--- a/include/linux/pageblock-flags.h
+++ b/include/linux/pageblock-flags.h
@@ -30,6 +30,9 @@ enum pageblock_bits {
30 PB_migrate, 30 PB_migrate,
31 PB_migrate_end = PB_migrate + 3 - 1, 31 PB_migrate_end = PB_migrate + 3 - 1,
32 /* 3 bits required for migrate types */ 32 /* 3 bits required for migrate types */
33#ifdef CONFIG_COMPACTION
34 PB_migrate_skip,/* If set the block is skipped by compaction */
35#endif /* CONFIG_COMPACTION */
33 NR_PAGEBLOCK_BITS 36 NR_PAGEBLOCK_BITS
34}; 37};
35 38
@@ -65,10 +68,22 @@ unsigned long get_pageblock_flags_group(struct page *page,
65void set_pageblock_flags_group(struct page *page, unsigned long flags, 68void set_pageblock_flags_group(struct page *page, unsigned long flags,
66 int start_bitidx, int end_bitidx); 69 int start_bitidx, int end_bitidx);
67 70
71#ifdef CONFIG_COMPACTION
72#define get_pageblock_skip(page) \
73 get_pageblock_flags_group(page, PB_migrate_skip, \
74 PB_migrate_skip)
75#define clear_pageblock_skip(page) \
76 set_pageblock_flags_group(page, 0, PB_migrate_skip, \
77 PB_migrate_skip)
78#define set_pageblock_skip(page) \
79 set_pageblock_flags_group(page, 1, PB_migrate_skip, \
80 PB_migrate_skip)
81#endif /* CONFIG_COMPACTION */
82
68#define get_pageblock_flags(page) \ 83#define get_pageblock_flags(page) \
69 get_pageblock_flags_group(page, 0, NR_PAGEBLOCK_BITS-1) 84 get_pageblock_flags_group(page, 0, PB_migrate_end)
70#define set_pageblock_flags(page, flags) \ 85#define set_pageblock_flags(page, flags) \
71 set_pageblock_flags_group(page, flags, \ 86 set_pageblock_flags_group(page, flags, \
72 0, NR_PAGEBLOCK_BITS-1) 87 0, PB_migrate_end)
73 88
74#endif /* PAGEBLOCK_FLAGS_H */ 89#endif /* PAGEBLOCK_FLAGS_H */
diff --git a/include/linux/parport.h b/include/linux/parport.h
index 106c2ca9440b..c22f12547324 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -3,96 +3,9 @@
3 * the GNU Free Documentation License, Version 1.1 or any later version 3 * the GNU Free Documentation License, Version 1.1 or any later version
4 * published by the Free Software Foundation. 4 * published by the Free Software Foundation.
5 */ 5 */
6
7#ifndef _PARPORT_H_ 6#ifndef _PARPORT_H_
8#define _PARPORT_H_ 7#define _PARPORT_H_
9 8
10/* Start off with user-visible constants */
11
12/* Maximum of 16 ports per machine */
13#define PARPORT_MAX 16
14
15/* Magic numbers */
16#define PARPORT_IRQ_NONE -1
17#define PARPORT_DMA_NONE -1
18#define PARPORT_IRQ_AUTO -2
19#define PARPORT_DMA_AUTO -2
20#define PARPORT_DMA_NOFIFO -3
21#define PARPORT_DISABLE -2
22#define PARPORT_IRQ_PROBEONLY -3
23#define PARPORT_IOHI_AUTO -1
24
25#define PARPORT_CONTROL_STROBE 0x1
26#define PARPORT_CONTROL_AUTOFD 0x2
27#define PARPORT_CONTROL_INIT 0x4
28#define PARPORT_CONTROL_SELECT 0x8
29
30#define PARPORT_STATUS_ERROR 0x8
31#define PARPORT_STATUS_SELECT 0x10
32#define PARPORT_STATUS_PAPEROUT 0x20
33#define PARPORT_STATUS_ACK 0x40
34#define PARPORT_STATUS_BUSY 0x80
35
36/* Type classes for Plug-and-Play probe. */
37typedef enum {
38 PARPORT_CLASS_LEGACY = 0, /* Non-IEEE1284 device */
39 PARPORT_CLASS_PRINTER,
40 PARPORT_CLASS_MODEM,
41 PARPORT_CLASS_NET,
42 PARPORT_CLASS_HDC, /* Hard disk controller */
43 PARPORT_CLASS_PCMCIA,
44 PARPORT_CLASS_MEDIA, /* Multimedia device */
45 PARPORT_CLASS_FDC, /* Floppy disk controller */
46 PARPORT_CLASS_PORTS,
47 PARPORT_CLASS_SCANNER,
48 PARPORT_CLASS_DIGCAM,
49 PARPORT_CLASS_OTHER, /* Anything else */
50 PARPORT_CLASS_UNSPEC, /* No CLS field in ID */
51 PARPORT_CLASS_SCSIADAPTER
52} parport_device_class;
53
54/* The "modes" entry in parport is a bit field representing the
55 capabilities of the hardware. */
56#define PARPORT_MODE_PCSPP (1<<0) /* IBM PC registers available. */
57#define PARPORT_MODE_TRISTATE (1<<1) /* Can tristate. */
58#define PARPORT_MODE_EPP (1<<2) /* Hardware EPP. */
59#define PARPORT_MODE_ECP (1<<3) /* Hardware ECP. */
60#define PARPORT_MODE_COMPAT (1<<4) /* Hardware 'printer protocol'. */
61#define PARPORT_MODE_DMA (1<<5) /* Hardware can DMA. */
62#define PARPORT_MODE_SAFEININT (1<<6) /* SPP registers accessible in IRQ. */
63
64/* IEEE1284 modes:
65 Nibble mode, byte mode, ECP, ECPRLE and EPP are their own
66 'extensibility request' values. Others are special.
67 'Real' ECP modes must have the IEEE1284_MODE_ECP bit set. */
68#define IEEE1284_MODE_NIBBLE 0
69#define IEEE1284_MODE_BYTE (1<<0)
70#define IEEE1284_MODE_COMPAT (1<<8)
71#define IEEE1284_MODE_BECP (1<<9) /* Bounded ECP mode */
72#define IEEE1284_MODE_ECP (1<<4)
73#define IEEE1284_MODE_ECPRLE (IEEE1284_MODE_ECP | (1<<5))
74#define IEEE1284_MODE_ECPSWE (1<<10) /* Software-emulated */
75#define IEEE1284_MODE_EPP (1<<6)
76#define IEEE1284_MODE_EPPSL (1<<11) /* EPP 1.7 */
77#define IEEE1284_MODE_EPPSWE (1<<12) /* Software-emulated */
78#define IEEE1284_DEVICEID (1<<2) /* This is a flag */
79#define IEEE1284_EXT_LINK (1<<14) /* This flag causes the
80 * extensibility link to
81 * be requested, using
82 * bits 0-6. */
83
84/* For the benefit of parport_read/write, you can use these with
85 * parport_negotiate to use address operations. They have no effect
86 * other than to make parport_read/write use address transfers. */
87#define IEEE1284_ADDR (1<<13) /* This is a flag */
88#define IEEE1284_DATA 0 /* So is this */
89
90/* Flags for block transfer operations. */
91#define PARPORT_EPP_FAST (1<<0) /* Unreliable counts. */
92#define PARPORT_W91284PIC (1<<1) /* have a Warp9 w91284pic in the device */
93
94/* The rest is for the kernel only */
95#ifdef __KERNEL__
96 9
97#include <linux/jiffies.h> 10#include <linux/jiffies.h>
98#include <linux/proc_fs.h> 11#include <linux/proc_fs.h>
@@ -101,6 +14,7 @@ typedef enum {
101#include <linux/irqreturn.h> 14#include <linux/irqreturn.h>
102#include <linux/semaphore.h> 15#include <linux/semaphore.h>
103#include <asm/ptrace.h> 16#include <asm/ptrace.h>
17#include <uapi/linux/parport.h>
104 18
105/* Define this later. */ 19/* Define this later. */
106struct parport; 20struct parport;
@@ -564,5 +478,4 @@ extern int parport_device_proc_unregister(struct pardevice *device);
564extern unsigned long parport_default_timeslice; 478extern unsigned long parport_default_timeslice;
565extern int parport_default_spintime; 479extern int parport_default_spintime;
566 480
567#endif /* __KERNEL__ */
568#endif /* _PARPORT_H_ */ 481#endif /* _PARPORT_H_ */
diff --git a/include/linux/patchkey.h b/include/linux/patchkey.h
index aefda0ec6e62..97a919fc9927 100644
--- a/include/linux/patchkey.h
+++ b/include/linux/patchkey.h
@@ -9,22 +9,12 @@
9 * Do not include this file directly. Please use <sys/soundcard.h> instead. 9 * Do not include this file directly. Please use <sys/soundcard.h> instead.
10 * For kernel code, use <linux/soundcard.h> 10 * For kernel code, use <linux/soundcard.h>
11 */ 11 */
12
13#ifndef _LINUX_PATCHKEY_H_INDIRECT
14#error "patchkey.h included directly"
15#endif
16
17#ifndef _LINUX_PATCHKEY_H 12#ifndef _LINUX_PATCHKEY_H
18#define _LINUX_PATCHKEY_H 13#define _LINUX_PATCHKEY_H
19 14
20/* Endian macros. */
21#ifdef __KERNEL__
22# include <asm/byteorder.h> 15# include <asm/byteorder.h>
23#else 16#include <uapi/linux/patchkey.h>
24# include <endian.h>
25#endif
26 17
27#if defined(__KERNEL__)
28# if defined(__BIG_ENDIAN) 18# if defined(__BIG_ENDIAN)
29# define _PATCHKEY(id) (0xfd00|id) 19# define _PATCHKEY(id) (0xfd00|id)
30# elif defined(__LITTLE_ENDIAN) 20# elif defined(__LITTLE_ENDIAN)
@@ -32,16 +22,4 @@
32# else 22# else
33# error "could not determine byte order" 23# error "could not determine byte order"
34# endif 24# endif
35#else
36#if defined(__BYTE_ORDER)
37# if __BYTE_ORDER == __BIG_ENDIAN
38# define _PATCHKEY(id) (0xfd00|id)
39# elif __BYTE_ORDER == __LITTLE_ENDIAN
40# define _PATCHKEY(id) ((id<<8)|0x00fd)
41# else
42# error "could not determine byte order"
43# endif
44#endif
45#endif
46
47#endif /* _LINUX_PATCHKEY_H */ 25#endif /* _LINUX_PATCHKEY_H */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index be1de01de1c4..ee2179546c63 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -13,32 +13,9 @@
13 * PCI to PCI Bridge Specification 13 * PCI to PCI Bridge Specification
14 * PCI System Design Guide 14 * PCI System Design Guide
15 */ 15 */
16
17#ifndef LINUX_PCI_H 16#ifndef LINUX_PCI_H
18#define LINUX_PCI_H 17#define LINUX_PCI_H
19 18
20#include <linux/pci_regs.h> /* The pci register defines */
21
22/*
23 * The PCI interface treats multi-function devices as independent
24 * devices. The slot/function address of each device is encoded
25 * in a single byte as follows:
26 *
27 * 7:3 = slot
28 * 2:0 = function
29 */
30#define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07))
31#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
32#define PCI_FUNC(devfn) ((devfn) & 0x07)
33
34/* Ioctls for /proc/bus/pci/X/Y nodes. */
35#define PCIIOC_BASE ('P' << 24 | 'C' << 16 | 'I' << 8)
36#define PCIIOC_CONTROLLER (PCIIOC_BASE | 0x00) /* Get controller for PCI device. */
37#define PCIIOC_MMAP_IS_IO (PCIIOC_BASE | 0x01) /* Set mmap state to I/O space. */
38#define PCIIOC_MMAP_IS_MEM (PCIIOC_BASE | 0x02) /* Set mmap state to MEM space. */
39#define PCIIOC_WRITE_COMBINE (PCIIOC_BASE | 0x03) /* Enable/disable write-combining. */
40
41#ifdef __KERNEL__
42 19
43#include <linux/mod_devicetable.h> 20#include <linux/mod_devicetable.h>
44 21
@@ -53,6 +30,7 @@
53#include <linux/device.h> 30#include <linux/device.h>
54#include <linux/io.h> 31#include <linux/io.h>
55#include <linux/irqreturn.h> 32#include <linux/irqreturn.h>
33#include <uapi/linux/pci.h>
56 34
57/* Include the ID list */ 35/* Include the ID list */
58#include <linux/pci_ids.h> 36#include <linux/pci_ids.h>
@@ -1831,5 +1809,4 @@ static inline struct eeh_dev *pci_dev_to_eeh_dev(struct pci_dev *pdev)
1831 */ 1809 */
1832struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev); 1810struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev);
1833 1811
1834#endif /* __KERNEL__ */
1835#endif /* LINUX_PCI_H */ 1812#endif /* LINUX_PCI_H */
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 33880f6f4e51..9d36b829533a 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1427,6 +1427,7 @@
1427#define PCI_DEVICE_ID_VIA_CX700_IDE 0x0581 1427#define PCI_DEVICE_ID_VIA_CX700_IDE 0x0581
1428#define PCI_DEVICE_ID_VIA_VX800 0x8353 1428#define PCI_DEVICE_ID_VIA_VX800 0x8353
1429#define PCI_DEVICE_ID_VIA_VX855 0x8409 1429#define PCI_DEVICE_ID_VIA_VX855 0x8409
1430#define PCI_DEVICE_ID_VIA_VX900 0x8410
1430#define PCI_DEVICE_ID_VIA_8371_1 0x8391 1431#define PCI_DEVICE_ID_VIA_8371_1 0x8391
1431#define PCI_DEVICE_ID_VIA_82C598_1 0x8598 1432#define PCI_DEVICE_ID_VIA_82C598_1 0x8598
1432#define PCI_DEVICE_ID_VIA_838X_1 0xB188 1433#define PCI_DEVICE_ID_VIA_838X_1 0xB188
diff --git a/include/linux/percpu-rwsem.h b/include/linux/percpu-rwsem.h
new file mode 100644
index 000000000000..250a4acddb2b
--- /dev/null
+++ b/include/linux/percpu-rwsem.h
@@ -0,0 +1,83 @@
1#ifndef _LINUX_PERCPU_RWSEM_H
2#define _LINUX_PERCPU_RWSEM_H
3
4#include <linux/mutex.h>
5#include <linux/percpu.h>
6#include <linux/rcupdate.h>
7#include <linux/delay.h>
8
9struct percpu_rw_semaphore {
10 unsigned __percpu *counters;
11 bool locked;
12 struct mutex mtx;
13};
14
15#define light_mb() barrier()
16#define heavy_mb() synchronize_sched()
17
18static inline void percpu_down_read(struct percpu_rw_semaphore *p)
19{
20 rcu_read_lock_sched();
21 if (unlikely(p->locked)) {
22 rcu_read_unlock_sched();
23 mutex_lock(&p->mtx);
24 this_cpu_inc(*p->counters);
25 mutex_unlock(&p->mtx);
26 return;
27 }
28 this_cpu_inc(*p->counters);
29 rcu_read_unlock_sched();
30 light_mb(); /* A, between read of p->locked and read of data, paired with D */
31}
32
33static inline void percpu_up_read(struct percpu_rw_semaphore *p)
34{
35 light_mb(); /* B, between read of the data and write to p->counter, paired with C */
36 this_cpu_dec(*p->counters);
37}
38
39static inline unsigned __percpu_count(unsigned __percpu *counters)
40{
41 unsigned total = 0;
42 int cpu;
43
44 for_each_possible_cpu(cpu)
45 total += ACCESS_ONCE(*per_cpu_ptr(counters, cpu));
46
47 return total;
48}
49
50static inline void percpu_down_write(struct percpu_rw_semaphore *p)
51{
52 mutex_lock(&p->mtx);
53 p->locked = true;
54 synchronize_sched(); /* make sure that all readers exit the rcu_read_lock_sched region */
55 while (__percpu_count(p->counters))
56 msleep(1);
57 heavy_mb(); /* C, between read of p->counter and write to data, paired with B */
58}
59
60static inline void percpu_up_write(struct percpu_rw_semaphore *p)
61{
62 heavy_mb(); /* D, between write to data and write to p->locked, paired with A */
63 p->locked = false;
64 mutex_unlock(&p->mtx);
65}
66
67static inline int percpu_init_rwsem(struct percpu_rw_semaphore *p)
68{
69 p->counters = alloc_percpu(unsigned);
70 if (unlikely(!p->counters))
71 return -ENOMEM;
72 p->locked = false;
73 mutex_init(&p->mtx);
74 return 0;
75}
76
77static inline void percpu_free_rwsem(struct percpu_rw_semaphore *p)
78{
79 free_percpu(p->counters);
80 p->counters = NULL; /* catch use after free bugs */
81}
82
83#endif
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 2b9f82c037c9..cc88172c7d9a 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -107,7 +107,7 @@ enum pcpu_fc {
107 107
108 PCPU_FC_NR, 108 PCPU_FC_NR,
109}; 109};
110extern const char *pcpu_fc_names[PCPU_FC_NR]; 110extern const char * const pcpu_fc_names[PCPU_FC_NR];
111 111
112extern enum pcpu_fc pcpu_chosen_fc; 112extern enum pcpu_fc pcpu_chosen_fc;
113 113
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 599afc4bb67e..6bfb2faa0b19 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -14,606 +14,9 @@
14#ifndef _LINUX_PERF_EVENT_H 14#ifndef _LINUX_PERF_EVENT_H
15#define _LINUX_PERF_EVENT_H 15#define _LINUX_PERF_EVENT_H
16 16
17#include <linux/types.h> 17#include <uapi/linux/perf_event.h>
18#include <linux/ioctl.h>
19#include <asm/byteorder.h>
20 18
21/* 19/*
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 PERF_TYPE_BREAKPOINT = 5,
35
36 PERF_TYPE_MAX, /* non-ABI */
37};
38
39/*
40 * Generalized performance event event_id types, used by the
41 * attr.event_id parameter of the sys_perf_event_open()
42 * syscall:
43 */
44enum perf_hw_id {
45 /*
46 * Common hardware events, generalized by the kernel:
47 */
48 PERF_COUNT_HW_CPU_CYCLES = 0,
49 PERF_COUNT_HW_INSTRUCTIONS = 1,
50 PERF_COUNT_HW_CACHE_REFERENCES = 2,
51 PERF_COUNT_HW_CACHE_MISSES = 3,
52 PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4,
53 PERF_COUNT_HW_BRANCH_MISSES = 5,
54 PERF_COUNT_HW_BUS_CYCLES = 6,
55 PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7,
56 PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8,
57 PERF_COUNT_HW_REF_CPU_CYCLES = 9,
58
59 PERF_COUNT_HW_MAX, /* non-ABI */
60};
61
62/*
63 * Generalized hardware cache events:
64 *
65 * { L1-D, L1-I, LLC, ITLB, DTLB, BPU, NODE } x
66 * { read, write, prefetch } x
67 * { accesses, misses }
68 */
69enum perf_hw_cache_id {
70 PERF_COUNT_HW_CACHE_L1D = 0,
71 PERF_COUNT_HW_CACHE_L1I = 1,
72 PERF_COUNT_HW_CACHE_LL = 2,
73 PERF_COUNT_HW_CACHE_DTLB = 3,
74 PERF_COUNT_HW_CACHE_ITLB = 4,
75 PERF_COUNT_HW_CACHE_BPU = 5,
76 PERF_COUNT_HW_CACHE_NODE = 6,
77
78 PERF_COUNT_HW_CACHE_MAX, /* non-ABI */
79};
80
81enum perf_hw_cache_op_id {
82 PERF_COUNT_HW_CACHE_OP_READ = 0,
83 PERF_COUNT_HW_CACHE_OP_WRITE = 1,
84 PERF_COUNT_HW_CACHE_OP_PREFETCH = 2,
85
86 PERF_COUNT_HW_CACHE_OP_MAX, /* non-ABI */
87};
88
89enum perf_hw_cache_op_result_id {
90 PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0,
91 PERF_COUNT_HW_CACHE_RESULT_MISS = 1,
92
93 PERF_COUNT_HW_CACHE_RESULT_MAX, /* non-ABI */
94};
95
96/*
97 * Special "software" events provided by the kernel, even if the hardware
98 * does not support performance events. These events measure various
99 * physical and sw events of the kernel (and allow the profiling of them as
100 * well):
101 */
102enum perf_sw_ids {
103 PERF_COUNT_SW_CPU_CLOCK = 0,
104 PERF_COUNT_SW_TASK_CLOCK = 1,
105 PERF_COUNT_SW_PAGE_FAULTS = 2,
106 PERF_COUNT_SW_CONTEXT_SWITCHES = 3,
107 PERF_COUNT_SW_CPU_MIGRATIONS = 4,
108 PERF_COUNT_SW_PAGE_FAULTS_MIN = 5,
109 PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6,
110 PERF_COUNT_SW_ALIGNMENT_FAULTS = 7,
111 PERF_COUNT_SW_EMULATION_FAULTS = 8,
112
113 PERF_COUNT_SW_MAX, /* non-ABI */
114};
115
116/*
117 * Bits that can be set in attr.sample_type to request information
118 * in the overflow packets.
119 */
120enum perf_event_sample_format {
121 PERF_SAMPLE_IP = 1U << 0,
122 PERF_SAMPLE_TID = 1U << 1,
123 PERF_SAMPLE_TIME = 1U << 2,
124 PERF_SAMPLE_ADDR = 1U << 3,
125 PERF_SAMPLE_READ = 1U << 4,
126 PERF_SAMPLE_CALLCHAIN = 1U << 5,
127 PERF_SAMPLE_ID = 1U << 6,
128 PERF_SAMPLE_CPU = 1U << 7,
129 PERF_SAMPLE_PERIOD = 1U << 8,
130 PERF_SAMPLE_STREAM_ID = 1U << 9,
131 PERF_SAMPLE_RAW = 1U << 10,
132 PERF_SAMPLE_BRANCH_STACK = 1U << 11,
133 PERF_SAMPLE_REGS_USER = 1U << 12,
134 PERF_SAMPLE_STACK_USER = 1U << 13,
135
136 PERF_SAMPLE_MAX = 1U << 14, /* non-ABI */
137};
138
139/*
140 * values to program into branch_sample_type when PERF_SAMPLE_BRANCH is set
141 *
142 * If the user does not pass priv level information via branch_sample_type,
143 * the kernel uses the event's priv level. Branch and event priv levels do
144 * not have to match. Branch priv level is checked for permissions.
145 *
146 * The branch types can be combined, however BRANCH_ANY covers all types
147 * of branches and therefore it supersedes all the other types.
148 */
149enum perf_branch_sample_type {
150 PERF_SAMPLE_BRANCH_USER = 1U << 0, /* user branches */
151 PERF_SAMPLE_BRANCH_KERNEL = 1U << 1, /* kernel branches */
152 PERF_SAMPLE_BRANCH_HV = 1U << 2, /* hypervisor branches */
153
154 PERF_SAMPLE_BRANCH_ANY = 1U << 3, /* any branch types */
155 PERF_SAMPLE_BRANCH_ANY_CALL = 1U << 4, /* any call branch */
156 PERF_SAMPLE_BRANCH_ANY_RETURN = 1U << 5, /* any return branch */
157 PERF_SAMPLE_BRANCH_IND_CALL = 1U << 6, /* indirect calls */
158
159 PERF_SAMPLE_BRANCH_MAX = 1U << 7, /* non-ABI */
160};
161
162#define PERF_SAMPLE_BRANCH_PLM_ALL \
163 (PERF_SAMPLE_BRANCH_USER|\
164 PERF_SAMPLE_BRANCH_KERNEL|\
165 PERF_SAMPLE_BRANCH_HV)
166
167/*
168 * Values to determine ABI of the registers dump.
169 */
170enum perf_sample_regs_abi {
171 PERF_SAMPLE_REGS_ABI_NONE = 0,
172 PERF_SAMPLE_REGS_ABI_32 = 1,
173 PERF_SAMPLE_REGS_ABI_64 = 2,
174};
175
176/*
177 * The format of the data returned by read() on a perf event fd,
178 * as specified by attr.read_format:
179 *
180 * struct read_format {
181 * { u64 value;
182 * { u64 time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED
183 * { u64 time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING
184 * { u64 id; } && PERF_FORMAT_ID
185 * } && !PERF_FORMAT_GROUP
186 *
187 * { u64 nr;
188 * { u64 time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED
189 * { u64 time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING
190 * { u64 value;
191 * { u64 id; } && PERF_FORMAT_ID
192 * } cntr[nr];
193 * } && PERF_FORMAT_GROUP
194 * };
195 */
196enum perf_event_read_format {
197 PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0,
198 PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1,
199 PERF_FORMAT_ID = 1U << 2,
200 PERF_FORMAT_GROUP = 1U << 3,
201
202 PERF_FORMAT_MAX = 1U << 4, /* non-ABI */
203};
204
205#define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */
206#define PERF_ATTR_SIZE_VER1 72 /* add: config2 */
207#define PERF_ATTR_SIZE_VER2 80 /* add: branch_sample_type */
208#define PERF_ATTR_SIZE_VER3 96 /* add: sample_regs_user */
209 /* add: sample_stack_user */
210
211/*
212 * Hardware event_id to monitor via a performance monitoring event:
213 */
214struct perf_event_attr {
215
216 /*
217 * Major type: hardware/software/tracepoint/etc.
218 */
219 __u32 type;
220
221 /*
222 * Size of the attr structure, for fwd/bwd compat.
223 */
224 __u32 size;
225
226 /*
227 * Type specific configuration information.
228 */
229 __u64 config;
230
231 union {
232 __u64 sample_period;
233 __u64 sample_freq;
234 };
235
236 __u64 sample_type;
237 __u64 read_format;
238
239 __u64 disabled : 1, /* off by default */
240 inherit : 1, /* children inherit it */
241 pinned : 1, /* must always be on PMU */
242 exclusive : 1, /* only group on PMU */
243 exclude_user : 1, /* don't count user */
244 exclude_kernel : 1, /* ditto kernel */
245 exclude_hv : 1, /* ditto hypervisor */
246 exclude_idle : 1, /* don't count when idle */
247 mmap : 1, /* include mmap data */
248 comm : 1, /* include comm data */
249 freq : 1, /* use freq, not period */
250 inherit_stat : 1, /* per task counts */
251 enable_on_exec : 1, /* next exec enables */
252 task : 1, /* trace fork/exit */
253 watermark : 1, /* wakeup_watermark */
254 /*
255 * precise_ip:
256 *
257 * 0 - SAMPLE_IP can have arbitrary skid
258 * 1 - SAMPLE_IP must have constant skid
259 * 2 - SAMPLE_IP requested to have 0 skid
260 * 3 - SAMPLE_IP must have 0 skid
261 *
262 * See also PERF_RECORD_MISC_EXACT_IP
263 */
264 precise_ip : 2, /* skid constraint */
265 mmap_data : 1, /* non-exec mmap data */
266 sample_id_all : 1, /* sample_type all events */
267
268 exclude_host : 1, /* don't count in host */
269 exclude_guest : 1, /* don't count in guest */
270
271 exclude_callchain_kernel : 1, /* exclude kernel callchains */
272 exclude_callchain_user : 1, /* exclude user callchains */
273
274 __reserved_1 : 41;
275
276 union {
277 __u32 wakeup_events; /* wakeup every n events */
278 __u32 wakeup_watermark; /* bytes before wakeup */
279 };
280
281 __u32 bp_type;
282 union {
283 __u64 bp_addr;
284 __u64 config1; /* extension of config */
285 };
286 union {
287 __u64 bp_len;
288 __u64 config2; /* extension of config1 */
289 };
290 __u64 branch_sample_type; /* enum perf_branch_sample_type */
291
292 /*
293 * Defines set of user regs to dump on samples.
294 * See asm/perf_regs.h for details.
295 */
296 __u64 sample_regs_user;
297
298 /*
299 * Defines size of the user stack to dump on samples.
300 */
301 __u32 sample_stack_user;
302
303 /* Align to u64. */
304 __u32 __reserved_2;
305};
306
307#define perf_flags(attr) (*(&(attr)->read_format + 1))
308
309/*
310 * Ioctls that can be done on a perf event fd:
311 */
312#define PERF_EVENT_IOC_ENABLE _IO ('$', 0)
313#define PERF_EVENT_IOC_DISABLE _IO ('$', 1)
314#define PERF_EVENT_IOC_REFRESH _IO ('$', 2)
315#define PERF_EVENT_IOC_RESET _IO ('$', 3)
316#define PERF_EVENT_IOC_PERIOD _IOW('$', 4, __u64)
317#define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5)
318#define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *)
319
320enum perf_event_ioc_flags {
321 PERF_IOC_FLAG_GROUP = 1U << 0,
322};
323
324/*
325 * Structure of the page that can be mapped via mmap
326 */
327struct perf_event_mmap_page {
328 __u32 version; /* version number of this structure */
329 __u32 compat_version; /* lowest version this is compat with */
330
331 /*
332 * Bits needed to read the hw events in user-space.
333 *
334 * u32 seq, time_mult, time_shift, idx, width;
335 * u64 count, enabled, running;
336 * u64 cyc, time_offset;
337 * s64 pmc = 0;
338 *
339 * do {
340 * seq = pc->lock;
341 * barrier()
342 *
343 * enabled = pc->time_enabled;
344 * running = pc->time_running;
345 *
346 * if (pc->cap_usr_time && enabled != running) {
347 * cyc = rdtsc();
348 * time_offset = pc->time_offset;
349 * time_mult = pc->time_mult;
350 * time_shift = pc->time_shift;
351 * }
352 *
353 * idx = pc->index;
354 * count = pc->offset;
355 * if (pc->cap_usr_rdpmc && idx) {
356 * width = pc->pmc_width;
357 * pmc = rdpmc(idx - 1);
358 * }
359 *
360 * barrier();
361 * } while (pc->lock != seq);
362 *
363 * NOTE: for obvious reason this only works on self-monitoring
364 * processes.
365 */
366 __u32 lock; /* seqlock for synchronization */
367 __u32 index; /* hardware event identifier */
368 __s64 offset; /* add to hardware event value */
369 __u64 time_enabled; /* time event active */
370 __u64 time_running; /* time event on cpu */
371 union {
372 __u64 capabilities;
373 __u64 cap_usr_time : 1,
374 cap_usr_rdpmc : 1,
375 cap_____res : 62;
376 };
377
378 /*
379 * If cap_usr_rdpmc this field provides the bit-width of the value
380 * read using the rdpmc() or equivalent instruction. This can be used
381 * to sign extend the result like:
382 *
383 * pmc <<= 64 - width;
384 * pmc >>= 64 - width; // signed shift right
385 * count += pmc;
386 */
387 __u16 pmc_width;
388
389 /*
390 * If cap_usr_time the below fields can be used to compute the time
391 * delta since time_enabled (in ns) using rdtsc or similar.
392 *
393 * u64 quot, rem;
394 * u64 delta;
395 *
396 * quot = (cyc >> time_shift);
397 * rem = cyc & ((1 << time_shift) - 1);
398 * delta = time_offset + quot * time_mult +
399 * ((rem * time_mult) >> time_shift);
400 *
401 * Where time_offset,time_mult,time_shift and cyc are read in the
402 * seqcount loop described above. This delta can then be added to
403 * enabled and possible running (if idx), improving the scaling:
404 *
405 * enabled += delta;
406 * if (idx)
407 * running += delta;
408 *
409 * quot = count / running;
410 * rem = count % running;
411 * count = quot * enabled + (rem * enabled) / running;
412 */
413 __u16 time_shift;
414 __u32 time_mult;
415 __u64 time_offset;
416
417 /*
418 * Hole for extension of the self monitor capabilities
419 */
420
421 __u64 __reserved[120]; /* align to 1k */
422
423 /*
424 * Control data for the mmap() data buffer.
425 *
426 * User-space reading the @data_head value should issue an rmb(), on
427 * SMP capable platforms, after reading this value -- see
428 * perf_event_wakeup().
429 *
430 * When the mapping is PROT_WRITE the @data_tail value should be
431 * written by userspace to reflect the last read data. In this case
432 * the kernel will not over-write unread data.
433 */
434 __u64 data_head; /* head in the data section */
435 __u64 data_tail; /* user-space written tail */
436};
437
438#define PERF_RECORD_MISC_CPUMODE_MASK (7 << 0)
439#define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0)
440#define PERF_RECORD_MISC_KERNEL (1 << 0)
441#define PERF_RECORD_MISC_USER (2 << 0)
442#define PERF_RECORD_MISC_HYPERVISOR (3 << 0)
443#define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0)
444#define PERF_RECORD_MISC_GUEST_USER (5 << 0)
445
446/*
447 * Indicates that the content of PERF_SAMPLE_IP points to
448 * the actual instruction that triggered the event. See also
449 * perf_event_attr::precise_ip.
450 */
451#define PERF_RECORD_MISC_EXACT_IP (1 << 14)
452/*
453 * Reserve the last bit to indicate some extended misc field
454 */
455#define PERF_RECORD_MISC_EXT_RESERVED (1 << 15)
456
457struct perf_event_header {
458 __u32 type;
459 __u16 misc;
460 __u16 size;
461};
462
463enum perf_event_type {
464
465 /*
466 * If perf_event_attr.sample_id_all is set then all event types will
467 * have the sample_type selected fields related to where/when
468 * (identity) an event took place (TID, TIME, ID, CPU, STREAM_ID)
469 * described in PERF_RECORD_SAMPLE below, it will be stashed just after
470 * the perf_event_header and the fields already present for the existing
471 * fields, i.e. at the end of the payload. That way a newer perf.data
472 * file will be supported by older perf tools, with these new optional
473 * fields being ignored.
474 *
475 * The MMAP events record the PROT_EXEC mappings so that we can
476 * correlate userspace IPs to code. They have the following structure:
477 *
478 * struct {
479 * struct perf_event_header header;
480 *
481 * u32 pid, tid;
482 * u64 addr;
483 * u64 len;
484 * u64 pgoff;
485 * char filename[];
486 * };
487 */
488 PERF_RECORD_MMAP = 1,
489
490 /*
491 * struct {
492 * struct perf_event_header header;
493 * u64 id;
494 * u64 lost;
495 * };
496 */
497 PERF_RECORD_LOST = 2,
498
499 /*
500 * struct {
501 * struct perf_event_header header;
502 *
503 * u32 pid, tid;
504 * char comm[];
505 * };
506 */
507 PERF_RECORD_COMM = 3,
508
509 /*
510 * struct {
511 * struct perf_event_header header;
512 * u32 pid, ppid;
513 * u32 tid, ptid;
514 * u64 time;
515 * };
516 */
517 PERF_RECORD_EXIT = 4,
518
519 /*
520 * struct {
521 * struct perf_event_header header;
522 * u64 time;
523 * u64 id;
524 * u64 stream_id;
525 * };
526 */
527 PERF_RECORD_THROTTLE = 5,
528 PERF_RECORD_UNTHROTTLE = 6,
529
530 /*
531 * struct {
532 * struct perf_event_header header;
533 * u32 pid, ppid;
534 * u32 tid, ptid;
535 * u64 time;
536 * };
537 */
538 PERF_RECORD_FORK = 7,
539
540 /*
541 * struct {
542 * struct perf_event_header header;
543 * u32 pid, tid;
544 *
545 * struct read_format values;
546 * };
547 */
548 PERF_RECORD_READ = 8,
549
550 /*
551 * struct {
552 * struct perf_event_header header;
553 *
554 * { u64 ip; } && PERF_SAMPLE_IP
555 * { u32 pid, tid; } && PERF_SAMPLE_TID
556 * { u64 time; } && PERF_SAMPLE_TIME
557 * { u64 addr; } && PERF_SAMPLE_ADDR
558 * { u64 id; } && PERF_SAMPLE_ID
559 * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID
560 * { u32 cpu, res; } && PERF_SAMPLE_CPU
561 * { u64 period; } && PERF_SAMPLE_PERIOD
562 *
563 * { struct read_format values; } && PERF_SAMPLE_READ
564 *
565 * { u64 nr,
566 * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN
567 *
568 * #
569 * # The RAW record below is opaque data wrt the ABI
570 * #
571 * # That is, the ABI doesn't make any promises wrt to
572 * # the stability of its content, it may vary depending
573 * # on event, hardware, kernel version and phase of
574 * # the moon.
575 * #
576 * # In other words, PERF_SAMPLE_RAW contents are not an ABI.
577 * #
578 *
579 * { u32 size;
580 * char data[size];}&& PERF_SAMPLE_RAW
581 *
582 * { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK
583 *
584 * { u64 abi; # enum perf_sample_regs_abi
585 * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_USER
586 *
587 * { u64 size;
588 * char data[size];
589 * u64 dyn_size; } && PERF_SAMPLE_STACK_USER
590 * };
591 */
592 PERF_RECORD_SAMPLE = 9,
593
594 PERF_RECORD_MAX, /* non-ABI */
595};
596
597#define PERF_MAX_STACK_DEPTH 127
598
599enum perf_callchain_context {
600 PERF_CONTEXT_HV = (__u64)-32,
601 PERF_CONTEXT_KERNEL = (__u64)-128,
602 PERF_CONTEXT_USER = (__u64)-512,
603
604 PERF_CONTEXT_GUEST = (__u64)-2048,
605 PERF_CONTEXT_GUEST_KERNEL = (__u64)-2176,
606 PERF_CONTEXT_GUEST_USER = (__u64)-2560,
607
608 PERF_CONTEXT_MAX = (__u64)-4095,
609};
610
611#define PERF_FLAG_FD_NO_GROUP (1U << 0)
612#define PERF_FLAG_FD_OUTPUT (1U << 1)
613#define PERF_FLAG_PID_CGROUP (1U << 2) /* pid=cgroup id, per-cpu mode only */
614
615#ifdef __KERNEL__
616/*
617 * Kernel-internal data types and definitions: 20 * Kernel-internal data types and definitions:
618 */ 21 */
619 22
@@ -1110,7 +513,7 @@ struct perf_cpu_context {
1110 int exclusive; 513 int exclusive;
1111 struct list_head rotation_list; 514 struct list_head rotation_list;
1112 int jiffies_interval; 515 int jiffies_interval;
1113 struct pmu *active_pmu; 516 struct pmu *unique_pmu;
1114 struct perf_cgroup *cgrp; 517 struct perf_cgroup *cgrp;
1115}; 518};
1116 519
@@ -1400,12 +803,16 @@ static inline void perf_event_task_tick(void) { }
1400do { \ 803do { \
1401 static struct notifier_block fn##_nb __cpuinitdata = \ 804 static struct notifier_block fn##_nb __cpuinitdata = \
1402 { .notifier_call = fn, .priority = CPU_PRI_PERF }; \ 805 { .notifier_call = fn, .priority = CPU_PRI_PERF }; \
806 unsigned long cpu = smp_processor_id(); \
807 unsigned long flags; \
1403 fn(&fn##_nb, (unsigned long)CPU_UP_PREPARE, \ 808 fn(&fn##_nb, (unsigned long)CPU_UP_PREPARE, \
1404 (void *)(unsigned long)smp_processor_id()); \ 809 (void *)(unsigned long)cpu); \
810 local_irq_save(flags); \
1405 fn(&fn##_nb, (unsigned long)CPU_STARTING, \ 811 fn(&fn##_nb, (unsigned long)CPU_STARTING, \
1406 (void *)(unsigned long)smp_processor_id()); \ 812 (void *)(unsigned long)cpu); \
813 local_irq_restore(flags); \
1407 fn(&fn##_nb, (unsigned long)CPU_ONLINE, \ 814 fn(&fn##_nb, (unsigned long)CPU_ONLINE, \
1408 (void *)(unsigned long)smp_processor_id()); \ 815 (void *)(unsigned long)cpu); \
1409 register_cpu_notifier(&fn##_nb); \ 816 register_cpu_notifier(&fn##_nb); \
1410} while (0) 817} while (0)
1411 818
@@ -1422,5 +829,4 @@ _name##_show(struct device *dev, \
1422 \ 829 \
1423static struct device_attribute format_attr_##_name = __ATTR_RO(_name) 830static struct device_attribute format_attr_##_name = __ATTR_RO(_name)
1424 831
1425#endif /* __KERNEL__ */
1426#endif /* _LINUX_PERF_EVENT_H */ 832#endif /* _LINUX_PERF_EVENT_H */
diff --git a/include/linux/personality.h b/include/linux/personality.h
index 8fc7dd1a57ff..646c0a7d50fa 100644
--- a/include/linux/personality.h
+++ b/include/linux/personality.h
@@ -1,7 +1,8 @@
1#ifndef _LINUX_PERSONALITY_H 1#ifndef _LINUX_PERSONALITY_H
2#define _LINUX_PERSONALITY_H 2#define _LINUX_PERSONALITY_H
3 3
4#ifdef __KERNEL__ 4#include <uapi/linux/personality.h>
5
5 6
6/* 7/*
7 * Handling of different ABIs (personalities). 8 * Handling of different ABIs (personalities).
@@ -14,72 +15,6 @@ extern int register_exec_domain(struct exec_domain *);
14extern int unregister_exec_domain(struct exec_domain *); 15extern int unregister_exec_domain(struct exec_domain *);
15extern int __set_personality(unsigned int); 16extern int __set_personality(unsigned int);
16 17
17#endif /* __KERNEL__ */
18
19/*
20 * Flags for bug emulation.
21 *
22 * These occupy the top three bytes.
23 */
24enum {
25 UNAME26 = 0x0020000,
26 ADDR_NO_RANDOMIZE = 0x0040000, /* disable randomization of VA space */
27 FDPIC_FUNCPTRS = 0x0080000, /* userspace function ptrs point to descriptors
28 * (signal handling)
29 */
30 MMAP_PAGE_ZERO = 0x0100000,
31 ADDR_COMPAT_LAYOUT = 0x0200000,
32 READ_IMPLIES_EXEC = 0x0400000,
33 ADDR_LIMIT_32BIT = 0x0800000,
34 SHORT_INODE = 0x1000000,
35 WHOLE_SECONDS = 0x2000000,
36 STICKY_TIMEOUTS = 0x4000000,
37 ADDR_LIMIT_3GB = 0x8000000,
38};
39
40/*
41 * Security-relevant compatibility flags that must be
42 * cleared upon setuid or setgid exec:
43 */
44#define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC | \
45 ADDR_NO_RANDOMIZE | \
46 ADDR_COMPAT_LAYOUT | \
47 MMAP_PAGE_ZERO)
48
49/*
50 * Personality types.
51 *
52 * These go in the low byte. Avoid using the top bit, it will
53 * conflict with error returns.
54 */
55enum {
56 PER_LINUX = 0x0000,
57 PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT,
58 PER_LINUX_FDPIC = 0x0000 | FDPIC_FUNCPTRS,
59 PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
60 PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE,
61 PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS |
62 WHOLE_SECONDS | SHORT_INODE,
63 PER_OSR5 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS,
64 PER_WYSEV386 = 0x0004 | STICKY_TIMEOUTS | SHORT_INODE,
65 PER_ISCR4 = 0x0005 | STICKY_TIMEOUTS,
66 PER_BSD = 0x0006,
67 PER_SUNOS = 0x0006 | STICKY_TIMEOUTS,
68 PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE,
69 PER_LINUX32 = 0x0008,
70 PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB,
71 PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS,/* IRIX5 32-bit */
72 PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS,/* IRIX6 new 32-bit */
73 PER_IRIX64 = 0x000b | STICKY_TIMEOUTS,/* IRIX6 64-bit */
74 PER_RISCOS = 0x000c,
75 PER_SOLARIS = 0x000d | STICKY_TIMEOUTS,
76 PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
77 PER_OSF4 = 0x000f, /* OSF/1 v4 */
78 PER_HPUX = 0x0010,
79 PER_MASK = 0x00ff,
80};
81
82#ifdef __KERNEL__
83 18
84/* 19/*
85 * Description of an execution domain. 20 * Description of an execution domain.
@@ -116,6 +51,4 @@ struct exec_domain {
116#define set_personality(pers) \ 51#define set_personality(pers) \
117 ((current->personality == (pers)) ? 0 : __set_personality(pers)) 52 ((current->personality == (pers)) ? 0 : __set_personality(pers))
118 53
119#endif /* __KERNEL__ */
120
121#endif /* _LINUX_PERSONALITY_H */ 54#endif /* _LINUX_PERSONALITY_H */
diff --git a/include/linux/phonet.h b/include/linux/phonet.h
index f48bfc80cb4b..f691b04fc5ce 100644
--- a/include/linux/phonet.h
+++ b/include/linux/phonet.h
@@ -19,169 +19,11 @@
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA 20 * 02110-1301 USA
21 */ 21 */
22
23#ifndef LINUX_PHONET_H 22#ifndef LINUX_PHONET_H
24#define LINUX_PHONET_H 23#define LINUX_PHONET_H
25 24
26#include <linux/types.h> 25#include <uapi/linux/phonet.h>
27#include <linux/socket.h>
28
29/* Automatic protocol selection */
30#define PN_PROTO_TRANSPORT 0
31/* Phonet datagram socket */
32#define PN_PROTO_PHONET 1
33/* Phonet pipe */
34#define PN_PROTO_PIPE 2
35#define PHONET_NPROTO 3
36
37/* Socket options for SOL_PNPIPE level */
38#define PNPIPE_ENCAP 1
39#define PNPIPE_IFINDEX 2
40#define PNPIPE_HANDLE 3
41#define PNPIPE_INITSTATE 4
42
43#define PNADDR_ANY 0
44#define PNADDR_BROADCAST 0xFC
45#define PNPORT_RESOURCE_ROUTING 0
46
47/* Values for PNPIPE_ENCAP option */
48#define PNPIPE_ENCAP_NONE 0
49#define PNPIPE_ENCAP_IP 1
50
51/* ioctls */
52#define SIOCPNGETOBJECT (SIOCPROTOPRIVATE + 0)
53#define SIOCPNENABLEPIPE (SIOCPROTOPRIVATE + 13)
54#define SIOCPNADDRESOURCE (SIOCPROTOPRIVATE + 14)
55#define SIOCPNDELRESOURCE (SIOCPROTOPRIVATE + 15)
56
57/* Phonet protocol header */
58struct phonethdr {
59 __u8 pn_rdev;
60 __u8 pn_sdev;
61 __u8 pn_res;
62 __be16 pn_length;
63 __u8 pn_robj;
64 __u8 pn_sobj;
65} __attribute__((packed));
66
67/* Common Phonet payload header */
68struct phonetmsg {
69 __u8 pn_trans_id; /* transaction ID */
70 __u8 pn_msg_id; /* message type */
71 union {
72 struct {
73 __u8 pn_submsg_id; /* message subtype */
74 __u8 pn_data[5];
75 } base;
76 struct {
77 __u16 pn_e_res_id; /* extended resource ID */
78 __u8 pn_e_submsg_id; /* message subtype */
79 __u8 pn_e_data[3];
80 } ext;
81 } pn_msg_u;
82};
83#define PN_COMMON_MESSAGE 0xF0
84#define PN_COMMGR 0x10
85#define PN_PREFIX 0xE0 /* resource for extended messages */
86#define pn_submsg_id pn_msg_u.base.pn_submsg_id
87#define pn_e_submsg_id pn_msg_u.ext.pn_e_submsg_id
88#define pn_e_res_id pn_msg_u.ext.pn_e_res_id
89#define pn_data pn_msg_u.base.pn_data
90#define pn_e_data pn_msg_u.ext.pn_e_data
91
92/* data for unreachable errors */
93#define PN_COMM_SERVICE_NOT_IDENTIFIED_RESP 0x01
94#define PN_COMM_ISA_ENTITY_NOT_REACHABLE_RESP 0x14
95#define pn_orig_msg_id pn_data[0]
96#define pn_status pn_data[1]
97#define pn_e_orig_msg_id pn_e_data[0]
98#define pn_e_status pn_e_data[1]
99
100/* Phonet socket address structure */
101struct sockaddr_pn {
102 __kernel_sa_family_t spn_family;
103 __u8 spn_obj;
104 __u8 spn_dev;
105 __u8 spn_resource;
106 __u8 spn_zero[sizeof(struct sockaddr) - sizeof(__kernel_sa_family_t) - 3];
107} __attribute__((packed));
108
109/* Well known address */
110#define PN_DEV_PC 0x10
111
112static inline __u16 pn_object(__u8 addr, __u16 port)
113{
114 return (addr << 8) | (port & 0x3ff);
115}
116 26
117static inline __u8 pn_obj(__u16 handle)
118{
119 return handle & 0xff;
120}
121
122static inline __u8 pn_dev(__u16 handle)
123{
124 return handle >> 8;
125}
126
127static inline __u16 pn_port(__u16 handle)
128{
129 return handle & 0x3ff;
130}
131
132static inline __u8 pn_addr(__u16 handle)
133{
134 return (handle >> 8) & 0xfc;
135}
136
137static inline void pn_sockaddr_set_addr(struct sockaddr_pn *spn, __u8 addr)
138{
139 spn->spn_dev &= 0x03;
140 spn->spn_dev |= addr & 0xfc;
141}
142
143static inline void pn_sockaddr_set_port(struct sockaddr_pn *spn, __u16 port)
144{
145 spn->spn_dev &= 0xfc;
146 spn->spn_dev |= (port >> 8) & 0x03;
147 spn->spn_obj = port & 0xff;
148}
149
150static inline void pn_sockaddr_set_object(struct sockaddr_pn *spn,
151 __u16 handle)
152{
153 spn->spn_dev = pn_dev(handle);
154 spn->spn_obj = pn_obj(handle);
155}
156
157static inline void pn_sockaddr_set_resource(struct sockaddr_pn *spn,
158 __u8 resource)
159{
160 spn->spn_resource = resource;
161}
162
163static inline __u8 pn_sockaddr_get_addr(const struct sockaddr_pn *spn)
164{
165 return spn->spn_dev & 0xfc;
166}
167
168static inline __u16 pn_sockaddr_get_port(const struct sockaddr_pn *spn)
169{
170 return ((spn->spn_dev & 0x03) << 8) | spn->spn_obj;
171}
172
173static inline __u16 pn_sockaddr_get_object(const struct sockaddr_pn *spn)
174{
175 return pn_object(spn->spn_dev, spn->spn_obj);
176}
177
178static inline __u8 pn_sockaddr_get_resource(const struct sockaddr_pn *spn)
179{
180 return spn->spn_resource;
181}
182
183/* Phonet device ioctl requests */
184#ifdef __KERNEL__
185#define SIOCPNGAUTOCONF (SIOCDEVPRIVATE + 0) 27#define SIOCPNGAUTOCONF (SIOCDEVPRIVATE + 0)
186 28
187struct if_phonet_autoconf { 29struct if_phonet_autoconf {
@@ -195,6 +37,4 @@ struct if_phonet_req {
195 } ifr_ifru; 37 } ifr_ifru;
196}; 38};
197#define ifr_phonet_autoconf ifr_ifru.ifru_phonet_autoconf 39#define ifr_phonet_autoconf ifr_ifru.ifru_phonet_autoconf
198#endif /* __KERNEL__ */
199
200#endif 40#endif
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 00474b047145..65e3e87eacc5 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -47,15 +47,9 @@ static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
47} 47}
48 48
49extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns); 49extern struct pid_namespace *copy_pid_ns(unsigned long flags, struct pid_namespace *ns);
50extern void free_pid_ns(struct kref *kref);
51extern void zap_pid_ns_processes(struct pid_namespace *pid_ns); 50extern void zap_pid_ns_processes(struct pid_namespace *pid_ns);
52extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd); 51extern int reboot_pid_ns(struct pid_namespace *pid_ns, int cmd);
53 52extern void put_pid_ns(struct pid_namespace *ns);
54static inline void put_pid_ns(struct pid_namespace *ns)
55{
56 if (ns != &init_pid_ns)
57 kref_put(&ns->kref, free_pid_ns);
58}
59 53
60#else /* !CONFIG_PID_NS */ 54#else /* !CONFIG_PID_NS */
61#include <linux/err.h> 55#include <linux/err.h>
diff --git a/include/linux/pktcdvd.h b/include/linux/pktcdvd.h
index 721301b0a908..93d142ad1528 100644
--- a/include/linux/pktcdvd.h
+++ b/include/linux/pktcdvd.h
@@ -12,108 +12,13 @@
12#ifndef __PKTCDVD_H 12#ifndef __PKTCDVD_H
13#define __PKTCDVD_H 13#define __PKTCDVD_H
14 14
15#include <linux/types.h>
16
17/*
18 * 1 for normal debug messages, 2 is very verbose. 0 to turn it off.
19 */
20#define PACKET_DEBUG 1
21
22#define MAX_WRITERS 8
23
24#define PKT_RB_POOL_SIZE 512
25
26/*
27 * How long we should hold a non-full packet before starting data gathering.
28 */
29#define PACKET_WAIT_TIME (HZ * 5 / 1000)
30
31/*
32 * use drive write caching -- we need deferred error handling to be
33 * able to successfully recover with this option (drive will return good
34 * status as soon as the cdb is validated).
35 */
36#if defined(CONFIG_CDROM_PKTCDVD_WCACHE)
37#define USE_WCACHING 1
38#else
39#define USE_WCACHING 0
40#endif
41
42/*
43 * No user-servicable parts beyond this point ->
44 */
45
46/*
47 * device types
48 */
49#define PACKET_CDR 1
50#define PACKET_CDRW 2
51#define PACKET_DVDR 3
52#define PACKET_DVDRW 4
53
54/*
55 * flags
56 */
57#define PACKET_WRITABLE 1 /* pd is writable */
58#define PACKET_NWA_VALID 2 /* next writable address valid */
59#define PACKET_LRA_VALID 3 /* last recorded address valid */
60#define PACKET_MERGE_SEGS 4 /* perform segment merging to keep */
61 /* underlying cdrom device happy */
62
63/*
64 * Disc status -- from READ_DISC_INFO
65 */
66#define PACKET_DISC_EMPTY 0
67#define PACKET_DISC_INCOMPLETE 1
68#define PACKET_DISC_COMPLETE 2
69#define PACKET_DISC_OTHER 3
70
71/*
72 * write type, and corresponding data block type
73 */
74#define PACKET_MODE1 1
75#define PACKET_MODE2 2
76#define PACKET_BLOCK_MODE1 8
77#define PACKET_BLOCK_MODE2 10
78
79/*
80 * Last session/border status
81 */
82#define PACKET_SESSION_EMPTY 0
83#define PACKET_SESSION_INCOMPLETE 1
84#define PACKET_SESSION_RESERVED 2
85#define PACKET_SESSION_COMPLETE 3
86
87#define PACKET_MCN "4a656e734178626f65323030300000"
88
89#undef PACKET_USE_LS
90
91#define PKT_CTRL_CMD_SETUP 0
92#define PKT_CTRL_CMD_TEARDOWN 1
93#define PKT_CTRL_CMD_STATUS 2
94
95struct pkt_ctrl_command {
96 __u32 command; /* in: Setup, teardown, status */
97 __u32 dev_index; /* in/out: Device index */
98 __u32 dev; /* in/out: Device nr for cdrw device */
99 __u32 pkt_dev; /* in/out: Device nr for packet device */
100 __u32 num_devices; /* out: Largest device index + 1 */
101 __u32 padding; /* Not used */
102};
103
104/*
105 * packet ioctls
106 */
107#define PACKET_IOCTL_MAGIC ('X')
108#define PACKET_CTRL_CMD _IOWR(PACKET_IOCTL_MAGIC, 1, struct pkt_ctrl_command)
109
110#ifdef __KERNEL__
111#include <linux/blkdev.h> 15#include <linux/blkdev.h>
112#include <linux/completion.h> 16#include <linux/completion.h>
113#include <linux/cdrom.h> 17#include <linux/cdrom.h>
114#include <linux/kobject.h> 18#include <linux/kobject.h>
115#include <linux/sysfs.h> 19#include <linux/sysfs.h>
116#include <linux/mempool.h> 20#include <linux/mempool.h>
21#include <uapi/linux/pktcdvd.h>
117 22
118/* default bio write queue congestion marks */ 23/* default bio write queue congestion marks */
119#define PKT_WRITE_CONGESTION_ON 10000 24#define PKT_WRITE_CONGESTION_ON 10000
@@ -297,6 +202,4 @@ struct pktcdvd_device
297 struct dentry *dfs_f_info; /* debugfs: info file */ 202 struct dentry *dfs_f_info; /* debugfs: info file */
298}; 203};
299 204
300#endif /* __KERNEL__ */
301
302#endif /* __PKTCDVD_H */ 205#endif /* __PKTCDVD_H */
diff --git a/include/linux/platform_data/asoc-mx27vis.h b/include/linux/platform_data/asoc-mx27vis.h
new file mode 100644
index 000000000000..409adcd04d04
--- /dev/null
+++ b/include/linux/platform_data/asoc-mx27vis.h
@@ -0,0 +1,11 @@
1#ifndef __PLATFORM_DATA_ASOC_MX27VIS_H
2#define __PLATFORM_DATA_ASOC_MX27VIS_H
3
4struct snd_mx27vis_platform_data {
5 int amp_gain0_gpio;
6 int amp_gain1_gpio;
7 int amp_mutel_gpio;
8 int amp_muter_gpio;
9};
10
11#endif /* __PLATFORM_DATA_ASOC_MX27VIS_H */
diff --git a/include/linux/platform_data/asoc-ti-mcbsp.h b/include/linux/platform_data/asoc-ti-mcbsp.h
index 18814127809a..c78d90b28b19 100644
--- a/include/linux/platform_data/asoc-ti-mcbsp.h
+++ b/include/linux/platform_data/asoc-ti-mcbsp.h
@@ -47,8 +47,6 @@ struct omap_mcbsp_platform_data {
47 bool has_wakeup; /* Wakeup capability */ 47 bool has_wakeup; /* Wakeup capability */
48 bool has_ccr; /* Transceiver has configuration control registers */ 48 bool has_ccr; /* Transceiver has configuration control registers */
49 int (*enable_st_clock)(unsigned int, bool); 49 int (*enable_st_clock)(unsigned int, bool);
50 int (*set_clk_src)(struct device *dev, struct clk *clk, const char *src);
51 int (*mux_signal)(struct device *dev, const char *signal, const char *src);
52}; 50};
53 51
54/** 52/**
diff --git a/include/linux/platform_data/davinci_asp.h b/include/linux/platform_data/davinci_asp.h
new file mode 100644
index 000000000000..d0c5825876f8
--- /dev/null
+++ b/include/linux/platform_data/davinci_asp.h
@@ -0,0 +1,105 @@
1/*
2 * TI DaVinci Audio Serial Port support
3 *
4 * Copyright (C) 2012 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 __DAVINCI_ASP_H
17#define __DAVINCI_ASP_H
18
19struct snd_platform_data {
20 u32 tx_dma_offset;
21 u32 rx_dma_offset;
22 int asp_chan_q; /* event queue number for ASP channel */
23 int ram_chan_q; /* event queue number for RAM channel */
24 unsigned int codec_fmt;
25 /*
26 * Allowing this is more efficient and eliminates left and right swaps
27 * caused by underruns, but will swap the left and right channels
28 * when compared to previous behavior.
29 */
30 unsigned enable_channel_combine:1;
31 unsigned sram_size_playback;
32 unsigned sram_size_capture;
33
34 /*
35 * If McBSP peripheral gets the clock from an external pin,
36 * there are three chooses, that are MCBSP_CLKX, MCBSP_CLKR
37 * and MCBSP_CLKS.
38 * Depending on different hardware connections it is possible
39 * to use this setting to change the behaviour of McBSP
40 * driver.
41 */
42 int clk_input_pin;
43
44 /*
45 * This flag works when both clock and FS are outputs for the cpu
46 * and makes clock more accurate (FS is not symmetrical and the
47 * clock is very fast.
48 * The clock becoming faster is named
49 * i2s continuous serial clock (I2S_SCK) and it is an externally
50 * visible bit clock.
51 *
52 * first line : WordSelect
53 * second line : ContinuousSerialClock
54 * third line: SerialData
55 *
56 * SYMMETRICAL APPROACH:
57 * _______________________ LEFT
58 * _| RIGHT |______________________|
59 * _ _ _ _ _ _ _ _
60 * _| |_| |_ x16 _| |_| |_| |_| |_ x16 _| |_| |_
61 * _ _ _ _ _ _ _ _
62 * _/ \_/ \_ ... _/ \_/ \_/ \_/ \_ ... _/ \_/ \_
63 * \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
64 *
65 * ACCURATE CLOCK APPROACH:
66 * ______________ LEFT
67 * _| RIGHT |_______________________________|
68 * _ _ _ _ _ _ _ _ _
69 * _| |_ x16 _| |_| |_ x16 _| |_| |_| |_| |_| |_| |
70 * _ _ _ _ dummy cycles
71 * _/ \_ ... _/ \_/ \_ ... _/ \__________________
72 * \_/ \_/ \_/ \_/
73 *
74 */
75 bool i2s_accurate_sck;
76
77 /* McASP specific fields */
78 int tdm_slots;
79 u8 op_mode;
80 u8 num_serializer;
81 u8 *serial_dir;
82 u8 version;
83 u8 txnumevt;
84 u8 rxnumevt;
85};
86
87enum {
88 MCASP_VERSION_1 = 0, /* DM646x */
89 MCASP_VERSION_2, /* DA8xx/OMAPL1x */
90 MCASP_VERSION_3, /* TI81xx/AM33xx */
91};
92
93enum mcbsp_clk_input_pin {
94 MCBSP_CLKR = 0, /* as in DM365 */
95 MCBSP_CLKS,
96};
97
98#define INACTIVE_MODE 0
99#define TX_MODE 1
100#define RX_MODE 2
101
102#define DAVINCI_MCASP_IIS_MODE 0
103#define DAVINCI_MCASP_DIT_MODE 1
104
105#endif
diff --git a/include/linux/platform_data/exynos4_tmu.h b/include/linux/platform_data/exynos_thermal.h
index 39e038cca590..a7bdb2f63b73 100644
--- a/include/linux/platform_data/exynos4_tmu.h
+++ b/include/linux/platform_data/exynos_thermal.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * exynos4_tmu.h - Samsung EXYNOS4 TMU (Thermal Management Unit) 2 * exynos_thermal.h - Samsung EXYNOS TMU (Thermal Management Unit)
3 * 3 *
4 * Copyright (C) 2011 Samsung Electronics 4 * Copyright (C) 2011 Samsung Electronics
5 * Donggeun Kim <dg77.kim@samsung.com> 5 * Donggeun Kim <dg77.kim@samsung.com>
@@ -19,8 +19,9 @@
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 20 */
21 21
22#ifndef _LINUX_EXYNOS4_TMU_H 22#ifndef _LINUX_EXYNOS_THERMAL_H
23#define _LINUX_EXYNOS4_TMU_H 23#define _LINUX_EXYNOS_THERMAL_H
24#include <linux/cpu_cooling.h>
24 25
25enum calibration_type { 26enum calibration_type {
26 TYPE_ONE_POINT_TRIMMING, 27 TYPE_ONE_POINT_TRIMMING,
@@ -28,8 +29,28 @@ enum calibration_type {
28 TYPE_NONE, 29 TYPE_NONE,
29}; 30};
30 31
32enum soc_type {
33 SOC_ARCH_EXYNOS4210 = 1,
34 SOC_ARCH_EXYNOS,
35};
36/**
37 * struct freq_clip_table
38 * @freq_clip_max: maximum frequency allowed for this cooling state.
39 * @temp_level: Temperature level at which the temperature clipping will
40 * happen.
41 * @mask_val: cpumask of the allowed cpu's where the clipping will take place.
42 *
43 * This structure is required to be filled and passed to the
44 * cpufreq_cooling_unregister function.
45 */
46struct freq_clip_table {
47 unsigned int freq_clip_max;
48 unsigned int temp_level;
49 const struct cpumask *mask_val;
50};
51
31/** 52/**
32 * struct exynos4_tmu_platform_data 53 * struct exynos_tmu_platform_data
33 * @threshold: basic temperature for generating interrupt 54 * @threshold: basic temperature for generating interrupt
34 * 25 <= threshold <= 125 [unit: degree Celsius] 55 * 25 <= threshold <= 125 [unit: degree Celsius]
35 * @trigger_levels: array for each interrupt levels 56 * @trigger_levels: array for each interrupt levels
@@ -63,11 +84,18 @@ enum calibration_type {
63 * @reference_voltage: reference voltage of amplifier 84 * @reference_voltage: reference voltage of amplifier
64 * in the positive-TC generator block 85 * in the positive-TC generator block
65 * 0 <= reference_voltage <= 31 86 * 0 <= reference_voltage <= 31
87 * @noise_cancel_mode: noise cancellation mode
88 * 000, 100, 101, 110 and 111 can be different modes
89 * @type: determines the type of SOC
90 * @efuse_value: platform defined fuse value
66 * @cal_type: calibration type for temperature 91 * @cal_type: calibration type for temperature
92 * @freq_clip_table: Table representing frequency reduction percentage.
93 * @freq_tab_count: Count of the above table as frequency reduction may
94 * applicable to only some of the trigger levels.
67 * 95 *
68 * This structure is required for configuration of exynos4_tmu driver. 96 * This structure is required for configuration of exynos_tmu driver.
69 */ 97 */
70struct exynos4_tmu_platform_data { 98struct exynos_tmu_platform_data {
71 u8 threshold; 99 u8 threshold;
72 u8 trigger_levels[4]; 100 u8 trigger_levels[4];
73 bool trigger_level0_en; 101 bool trigger_level0_en;
@@ -77,7 +105,12 @@ struct exynos4_tmu_platform_data {
77 105
78 u8 gain; 106 u8 gain;
79 u8 reference_voltage; 107 u8 reference_voltage;
108 u8 noise_cancel_mode;
109 u32 efuse_value;
80 110
81 enum calibration_type cal_type; 111 enum calibration_type cal_type;
112 enum soc_type type;
113 struct freq_clip_table freq_tab[4];
114 unsigned int freq_tab_count;
82}; 115};
83#endif /* _LINUX_EXYNOS4_TMU_H */ 116#endif /* _LINUX_EXYNOS_THERMAL_H */
diff --git a/include/linux/platform_data/i2c-nomadik.h b/include/linux/platform_data/i2c-nomadik.h
index c2303c3e4803..3a8be9cdc95c 100644
--- a/include/linux/platform_data/i2c-nomadik.h
+++ b/include/linux/platform_data/i2c-nomadik.h
@@ -28,7 +28,7 @@ enum i2c_freq_mode {
28 * @sm: speed mode 28 * @sm: speed mode
29 */ 29 */
30struct nmk_i2c_controller { 30struct nmk_i2c_controller {
31 unsigned long clk_freq; 31 u32 clk_freq;
32 unsigned short slsu; 32 unsigned short slsu;
33 unsigned char tft; 33 unsigned char tft;
34 unsigned char rft; 34 unsigned char rft;
diff --git a/include/linux/platform_data/leds-lm3556.h b/include/linux/platform_data/leds-lm3556.h
deleted file mode 100644
index 4b4e7d6b0527..000000000000
--- a/include/linux/platform_data/leds-lm3556.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * Simple driver for Texas Instruments LM3556 LED Flash driver chip (Rev0x03)
3 * Copyright (C) 2012 Texas Instruments
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 */
10
11#ifndef __LINUX_LM3556_H
12#define __LINUX_LM3556_H
13
14#define LM3556_NAME "leds-lm3556"
15
16enum lm3556_pin_polarity {
17 PIN_LOW_ACTIVE = 0,
18 PIN_HIGH_ACTIVE,
19};
20
21enum lm3556_pin_enable {
22 PIN_DISABLED = 0,
23 PIN_ENABLED,
24};
25
26enum lm3556_strobe_usuage {
27 STROBE_EDGE_DETECT = 0,
28 STROBE_LEVEL_DETECT,
29};
30
31enum lm3556_indic_mode {
32 INDIC_MODE_INTERNAL = 0,
33 INDIC_MODE_EXTERNAL,
34};
35
36struct lm3556_platform_data {
37 enum lm3556_pin_enable torch_pin_en;
38 enum lm3556_pin_polarity torch_pin_polarity;
39
40 enum lm3556_strobe_usuage strobe_usuage;
41 enum lm3556_pin_enable strobe_pin_en;
42 enum lm3556_pin_polarity strobe_pin_polarity;
43
44 enum lm3556_pin_enable tx_pin_en;
45 enum lm3556_pin_polarity tx_pin_polarity;
46
47 enum lm3556_indic_mode indicator_mode;
48};
49
50#endif /* __LINUX_LM3556_H */
diff --git a/include/linux/platform_data/leds-lm355x.h b/include/linux/platform_data/leds-lm355x.h
new file mode 100644
index 000000000000..b88724bb0b46
--- /dev/null
+++ b/include/linux/platform_data/leds-lm355x.h
@@ -0,0 +1,66 @@
1/*
2 * Copyright (C) 2012 Texas Instruments
3 *
4 * License Terms: GNU General Public License v2
5 *
6 * Simple driver for Texas Instruments LM355x LED driver chip
7 *
8 * Author: G.Shark Jeong <gshark.jeong@gmail.com>
9 * Daniel Jeong <daniel.jeong@ti.com>
10 */
11
12#define LM355x_NAME "leds-lm355x"
13#define LM3554_NAME "leds-lm3554"
14#define LM3556_NAME "leds-lm3556"
15
16/* lm3554 : strobe def. on */
17enum lm355x_strobe {
18 LM355x_PIN_STROBE_DISABLE = 0x00,
19 LM355x_PIN_STROBE_ENABLE = 0x01,
20};
21
22enum lm355x_torch {
23 LM355x_PIN_TORCH_DISABLE = 0,
24 LM3554_PIN_TORCH_ENABLE = 0x80,
25 LM3556_PIN_TORCH_ENABLE = 0x10,
26};
27
28enum lm355x_tx2 {
29 LM355x_PIN_TX_DISABLE = 0,
30 LM3554_PIN_TX_ENABLE = 0x20,
31 LM3556_PIN_TX_ENABLE = 0x40,
32};
33
34enum lm355x_ntc {
35 LM355x_PIN_NTC_DISABLE = 0,
36 LM3554_PIN_NTC_ENABLE = 0x08,
37 LM3556_PIN_NTC_ENABLE = 0x80,
38};
39
40enum lm355x_pmode {
41 LM355x_PMODE_DISABLE = 0,
42 LM355x_PMODE_ENABLE = 0x04,
43};
44
45/*
46 * struct lm3554_platform_data
47 * @pin_strobe: strobe input
48 * @pin_torch : input pin
49 * lm3554-tx1/torch/gpio1
50 * lm3556-torch
51 * @pin_tx2 : input pin
52 * lm3554-envm/tx2/gpio2
53 * lm3556-tx pin
54 * @ntc_pin : output pin
55 * lm3554-ledi/ntc
56 * lm3556-temp pin
57 * @pass_mode : pass mode
58 */
59struct lm355x_platform_data {
60 enum lm355x_strobe pin_strobe;
61 enum lm355x_torch pin_tx1;
62 enum lm355x_tx2 pin_tx2;
63 enum lm355x_ntc ntc_pin;
64
65 enum lm355x_pmode pass_mode;
66};
diff --git a/include/linux/platform_data/leds-lm3642.h b/include/linux/platform_data/leds-lm3642.h
new file mode 100644
index 000000000000..72d6ee6ade57
--- /dev/null
+++ b/include/linux/platform_data/leds-lm3642.h
@@ -0,0 +1,38 @@
1/*
2* Copyright (C) 2012 Texas Instruments
3*
4* License Terms: GNU General Public License v2
5*
6* Simple driver for Texas Instruments LM3642 LED driver chip
7*
8* Author: G.Shark Jeong <gshark.jeong@gmail.com>
9* Daniel Jeong <daniel.jeong@ti.com>
10*/
11
12#ifndef __LINUX_LM3642_H
13#define __LINUX_LM3642_H
14
15#define LM3642_NAME "leds-lm3642"
16
17enum lm3642_torch_pin_enable {
18 LM3642_TORCH_PIN_DISABLE = 0x00,
19 LM3642_TORCH_PIN_ENABLE = 0x10,
20};
21
22enum lm3642_strobe_pin_enable {
23 LM3642_STROBE_PIN_DISABLE = 0x00,
24 LM3642_STROBE_PIN_ENABLE = 0x20,
25};
26
27enum lm3642_tx_pin_enable {
28 LM3642_TX_PIN_DISABLE = 0x00,
29 LM3642_TX_PIN_ENABLE = 0x40,
30};
31
32struct lm3642_platform_data {
33 enum lm3642_torch_pin_enable torch_pin;
34 enum lm3642_strobe_pin_enable strobe_pin;
35 enum lm3642_tx_pin_enable tx_pin;
36};
37
38#endif /* __LINUX_LM3642_H */
diff --git a/include/linux/platform_data/leds-pca9633.h b/include/linux/platform_data/leds-pca9633.h
new file mode 100644
index 000000000000..c5bf29b6fa7f
--- /dev/null
+++ b/include/linux/platform_data/leds-pca9633.h
@@ -0,0 +1,35 @@
1/*
2 * PCA9633 LED chip driver.
3 *
4 * Copyright 2012 bct electronic GmbH
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 */
20
21#ifndef __LINUX_PCA9633_H
22#define __LINUX_PCA9633_H
23#include <linux/leds.h>
24
25enum pca9633_outdrv {
26 PCA9633_OPEN_DRAIN,
27 PCA9633_TOTEM_POLE, /* aka push-pull */
28};
29
30struct pca9633_platform_data {
31 struct led_platform_data leds;
32 enum pca9633_outdrv outdrv;
33};
34
35#endif /* __LINUX_PCA9633_H*/
diff --git a/include/linux/platform_data/lm3630_bl.h b/include/linux/platform_data/lm3630_bl.h
new file mode 100644
index 000000000000..9176dd3f2d63
--- /dev/null
+++ b/include/linux/platform_data/lm3630_bl.h
@@ -0,0 +1,57 @@
1/*
2* Simple driver for Texas Instruments LM3630 LED Flash driver chip
3* Copyright (C) 2012 Texas Instruments
4*
5* This program is free software; you can redistribute it and/or modify
6* it under the terms of the GNU General Public License version 2 as
7* published by the Free Software Foundation.
8*
9*/
10
11#ifndef __LINUX_LM3630_H
12#define __LINUX_LM3630_H
13
14#define LM3630_NAME "lm3630_bl"
15
16enum lm3630_pwm_ctrl {
17 PWM_CTRL_DISABLE = 0,
18 PWM_CTRL_BANK_A,
19 PWM_CTRL_BANK_B,
20 PWM_CTRL_BANK_ALL,
21};
22
23enum lm3630_pwm_active {
24 PWM_ACTIVE_HIGH = 0,
25 PWM_ACTIVE_LOW,
26};
27
28enum lm3630_bank_a_ctrl {
29 BANK_A_CTRL_DISABLE = 0x0,
30 BANK_A_CTRL_LED1 = 0x4,
31 BANK_A_CTRL_LED2 = 0x1,
32 BANK_A_CTRL_ALL = 0x5,
33};
34
35enum lm3630_bank_b_ctrl {
36 BANK_B_CTRL_DISABLE = 0,
37 BANK_B_CTRL_LED2,
38};
39
40struct lm3630_platform_data {
41
42 /* maximum brightness */
43 int max_brt_led1;
44 int max_brt_led2;
45
46 /* initial on brightness */
47 int init_brt_led1;
48 int init_brt_led2;
49 enum lm3630_pwm_ctrl pwm_ctrl;
50 enum lm3630_pwm_active pwm_active;
51 enum lm3630_bank_a_ctrl bank_a_ctrl;
52 enum lm3630_bank_b_ctrl bank_b_ctrl;
53 unsigned int pwm_period;
54 void (*pwm_set_intensity) (int brightness, int max_brightness);
55};
56
57#endif /* __LINUX_LM3630_H */
diff --git a/include/linux/platform_data/lm3639_bl.h b/include/linux/platform_data/lm3639_bl.h
new file mode 100644
index 000000000000..5234cd5ed166
--- /dev/null
+++ b/include/linux/platform_data/lm3639_bl.h
@@ -0,0 +1,69 @@
1/*
2* Simple driver for Texas Instruments LM3630 LED Flash driver chip
3* Copyright (C) 2012 Texas Instruments
4*
5* This program is free software; you can redistribute it and/or modify
6* it under the terms of the GNU General Public License version 2 as
7* published by the Free Software Foundation.
8*
9*/
10
11#ifndef __LINUX_LM3639_H
12#define __LINUX_LM3639_H
13
14#define LM3639_NAME "lm3639_bl"
15
16enum lm3639_pwm {
17 LM3639_PWM_DISABLE = 0x00,
18 LM3639_PWM_EN_ACTLOW = 0x48,
19 LM3639_PWM_EN_ACTHIGH = 0x40,
20};
21
22enum lm3639_strobe {
23 LM3639_STROBE_DISABLE = 0x00,
24 LM3639_STROBE_EN_ACTLOW = 0x10,
25 LM3639_STROBE_EN_ACTHIGH = 0x30,
26};
27
28enum lm3639_txpin {
29 LM3639_TXPIN_DISABLE = 0x00,
30 LM3639_TXPIN_EN_ACTLOW = 0x04,
31 LM3639_TXPIN_EN_ACTHIGH = 0x0C,
32};
33
34enum lm3639_fleds {
35 LM3639_FLED_DIASBLE_ALL = 0x00,
36 LM3639_FLED_EN_1 = 0x40,
37 LM3639_FLED_EN_2 = 0x20,
38 LM3639_FLED_EN_ALL = 0x60,
39};
40
41enum lm3639_bleds {
42 LM3639_BLED_DIASBLE_ALL = 0x00,
43 LM3639_BLED_EN_1 = 0x10,
44 LM3639_BLED_EN_2 = 0x08,
45 LM3639_BLED_EN_ALL = 0x18,
46};
47enum lm3639_bled_mode {
48 LM3639_BLED_MODE_EXPONETIAL = 0x00,
49 LM3639_BLED_MODE_LINEAR = 0x10,
50};
51
52struct lm3639_platform_data {
53 unsigned int max_brt_led;
54 unsigned int init_brt_led;
55
56 /* input pins */
57 enum lm3639_pwm pin_pwm;
58 enum lm3639_strobe pin_strobe;
59 enum lm3639_txpin pin_tx;
60
61 /* output pins */
62 enum lm3639_fleds fled_pins;
63 enum lm3639_bleds bled_pins;
64 enum lm3639_bled_mode bled_mode;
65
66 void (*pwm_set_intensity) (int brightness, int max_brightness);
67 int (*pwm_get_intensity) (void);
68};
69#endif /* __LINUX_LM3639_H */
diff --git a/include/linux/platform_data/lp855x.h b/include/linux/platform_data/lp855x.h
index cc76f1f18f18..761f31752367 100644
--- a/include/linux/platform_data/lp855x.h
+++ b/include/linux/platform_data/lp855x.h
@@ -46,6 +46,8 @@
46#define LP8556_I2C_CONFIG ((ENABLE_BL << BL_CTL_SHFT) | \ 46#define LP8556_I2C_CONFIG ((ENABLE_BL << BL_CTL_SHFT) | \
47 (LP8556_I2C_ONLY << BRT_MODE_SHFT)) 47 (LP8556_I2C_ONLY << BRT_MODE_SHFT))
48#define LP8556_COMB2_CONFIG (LP8556_COMBINED2 << BRT_MODE_SHFT) 48#define LP8556_COMB2_CONFIG (LP8556_COMBINED2 << BRT_MODE_SHFT)
49#define LP8556_FAST_CONFIG BIT(7) /* use it if EPROMs should be maintained
50 when exiting the low power mode */
49 51
50enum lp855x_chip_id { 52enum lp855x_chip_id {
51 LP8550, 53 LP8550,
diff --git a/include/linux/platform_data/lp8727.h b/include/linux/platform_data/lp8727.h
index ea98c6133d32..47128a50e04e 100644
--- a/include/linux/platform_data/lp8727.h
+++ b/include/linux/platform_data/lp8727.h
@@ -13,32 +13,32 @@
13#define _LP8727_H 13#define _LP8727_H
14 14
15enum lp8727_eoc_level { 15enum lp8727_eoc_level {
16 EOC_5P, 16 LP8727_EOC_5P,
17 EOC_10P, 17 LP8727_EOC_10P,
18 EOC_16P, 18 LP8727_EOC_16P,
19 EOC_20P, 19 LP8727_EOC_20P,
20 EOC_25P, 20 LP8727_EOC_25P,
21 EOC_33P, 21 LP8727_EOC_33P,
22 EOC_50P, 22 LP8727_EOC_50P,
23}; 23};
24 24
25enum lp8727_ichg { 25enum lp8727_ichg {
26 ICHG_90mA, 26 LP8727_ICHG_90mA,
27 ICHG_100mA, 27 LP8727_ICHG_100mA,
28 ICHG_400mA, 28 LP8727_ICHG_400mA,
29 ICHG_450mA, 29 LP8727_ICHG_450mA,
30 ICHG_500mA, 30 LP8727_ICHG_500mA,
31 ICHG_600mA, 31 LP8727_ICHG_600mA,
32 ICHG_700mA, 32 LP8727_ICHG_700mA,
33 ICHG_800mA, 33 LP8727_ICHG_800mA,
34 ICHG_900mA, 34 LP8727_ICHG_900mA,
35 ICHG_1000mA, 35 LP8727_ICHG_1000mA,
36}; 36};
37 37
38/** 38/**
39 * struct lp8727_chg_param 39 * struct lp8727_chg_param
40 * @eoc_level : end of charge level setting 40 * @eoc_level : end of charge level setting
41 * @ichg : charging current 41 * @ichg : charging current
42 */ 42 */
43struct lp8727_chg_param { 43struct lp8727_chg_param {
44 enum lp8727_eoc_level eoc_level; 44 enum lp8727_eoc_level eoc_level;
@@ -47,19 +47,22 @@ struct lp8727_chg_param {
47 47
48/** 48/**
49 * struct lp8727_platform_data 49 * struct lp8727_platform_data
50 * @get_batt_present : check battery status - exists or not 50 * @get_batt_present : check battery status - exists or not
51 * @get_batt_level : get battery voltage (mV) 51 * @get_batt_level : get battery voltage (mV)
52 * @get_batt_capacity : get battery capacity (%) 52 * @get_batt_capacity : get battery capacity (%)
53 * @get_batt_temp : get battery temperature 53 * @get_batt_temp : get battery temperature
54 * @ac, @usb : charging parameters each charger type 54 * @ac : charging parameters for AC type charger
55 * @usb : charging parameters for USB type charger
56 * @debounce_msec : interrupt debounce time
55 */ 57 */
56struct lp8727_platform_data { 58struct lp8727_platform_data {
57 u8 (*get_batt_present)(void); 59 u8 (*get_batt_present)(void);
58 u16 (*get_batt_level)(void); 60 u16 (*get_batt_level)(void);
59 u8 (*get_batt_capacity)(void); 61 u8 (*get_batt_capacity)(void);
60 u8 (*get_batt_temp)(void); 62 u8 (*get_batt_temp)(void);
61 struct lp8727_chg_param ac; 63 struct lp8727_chg_param *ac;
62 struct lp8727_chg_param usb; 64 struct lp8727_chg_param *usb;
65 unsigned int debounce_msec;
63}; 66};
64 67
65#endif 68#endif
diff --git a/include/linux/platform_data/mipi-csis.h b/include/linux/platform_data/mipi-csis.h
index c45b1e8d4c2e..bf34e17cee7f 100644
--- a/include/linux/platform_data/mipi-csis.h
+++ b/include/linux/platform_data/mipi-csis.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright (C) 2010-2011 Samsung Electronics Co., Ltd. 2 * Copyright (C) 2010 - 2012 Samsung Electronics Co., Ltd.
3 * 3 *
4 * S5P series MIPI CSI slave device support 4 * Samsung S5P/Exynos SoC series MIPI CSIS device support
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
@@ -11,33 +11,27 @@
11#ifndef __PLAT_SAMSUNG_MIPI_CSIS_H_ 11#ifndef __PLAT_SAMSUNG_MIPI_CSIS_H_
12#define __PLAT_SAMSUNG_MIPI_CSIS_H_ __FILE__ 12#define __PLAT_SAMSUNG_MIPI_CSIS_H_ __FILE__
13 13
14struct platform_device;
15
16/** 14/**
17 * struct s5p_platform_mipi_csis - platform data for S5P MIPI-CSIS driver 15 * struct s5p_platform_mipi_csis - platform data for S5P MIPI-CSIS driver
18 * @clk_rate: bus clock frequency 16 * @clk_rate: bus clock frequency
19 * @lanes: number of data lanes used 17 * @wclk_source: CSI wrapper clock selection: 0 - bus clock, 1 - ext. SCLK_CAM
20 * @alignment: data alignment in bits 18 * @lanes: number of data lanes used
21 * @hs_settle: HS-RX settle time 19 * @hs_settle: HS-RX settle time
22 * @fixed_phy_vdd: false to enable external D-PHY regulator management in the
23 * driver or true in case this regulator has no enable function
24 * @phy_enable: pointer to a callback controlling D-PHY enable/reset
25 */ 20 */
26struct s5p_platform_mipi_csis { 21struct s5p_platform_mipi_csis {
27 unsigned long clk_rate; 22 unsigned long clk_rate;
23 u8 wclk_source;
28 u8 lanes; 24 u8 lanes;
29 u8 alignment;
30 u8 hs_settle; 25 u8 hs_settle;
31 bool fixed_phy_vdd;
32 int (*phy_enable)(struct platform_device *pdev, bool on);
33}; 26};
34 27
35/** 28/**
36 * s5p_csis_phy_enable - global MIPI-CSI receiver D-PHY control 29 * s5p_csis_phy_enable - global MIPI-CSI receiver D-PHY control
37 * @pdev: MIPI-CSIS platform device 30 * @id: MIPI-CSIS harware instance index (0...1)
38 * @on: true to enable D-PHY and deassert its reset 31 * @on: true to enable D-PHY and deassert its reset
39 * false to disable D-PHY 32 * false to disable D-PHY
33 * @return: 0 on success, or negative error code on failure
40 */ 34 */
41int s5p_csis_phy_enable(struct platform_device *pdev, bool on); 35int s5p_csis_phy_enable(int id, bool on);
42 36
43#endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */ 37#endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */
diff --git a/include/linux/platform_data/mmp_dma.h b/include/linux/platform_data/mmp_dma.h
new file mode 100644
index 000000000000..2a330ec9e2af
--- /dev/null
+++ b/include/linux/platform_data/mmp_dma.h
@@ -0,0 +1,19 @@
1/*
2 * MMP Platform DMA Management
3 *
4 * Copyright (c) 2011 Marvell Semiconductors Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#ifndef MMP_DMA_H
13#define MMP_DMA_H
14
15struct mmp_dma_platdata {
16 int dma_channels;
17};
18
19#endif /* MMP_DMA_H */
diff --git a/include/linux/platform_data/omap-twl4030.h b/include/linux/platform_data/omap-twl4030.h
new file mode 100644
index 000000000000..c7bef788daab
--- /dev/null
+++ b/include/linux/platform_data/omap-twl4030.h
@@ -0,0 +1,32 @@
1/**
2 * omap-twl4030.h - ASoC machine driver for TI SoC based boards with twl4030
3 * codec, header.
4 *
5 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com
6 * All rights reserved.
7 *
8 * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * version 2 as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22 * 02110-1301 USA
23 */
24
25#ifndef _OMAP_TWL4030_H_
26#define _OMAP_TWL4030_H_
27
28struct omap_tw4030_pdata {
29 const char *card_name;
30};
31
32#endif /* _OMAP_TWL4030_H_ */
diff --git a/include/linux/platform_data/pxa_sdhci.h b/include/linux/platform_data/pxa_sdhci.h
index 51ad0995abac..59acd987ed34 100644
--- a/include/linux/platform_data/pxa_sdhci.h
+++ b/include/linux/platform_data/pxa_sdhci.h
@@ -49,6 +49,7 @@ struct sdhci_pxa_platdata {
49 bool ext_cd_gpio_invert; 49 bool ext_cd_gpio_invert;
50 unsigned int max_speed; 50 unsigned int max_speed;
51 unsigned int host_caps; 51 unsigned int host_caps;
52 unsigned int host_caps2;
52 unsigned int quirks; 53 unsigned int quirks;
53 unsigned int pm_caps; 54 unsigned int pm_caps;
54}; 55};
diff --git a/include/linux/pmu.h b/include/linux/pmu.h
index 84e6a55a1202..99b400b8a241 100644
--- a/include/linux/pmu.h
+++ b/include/linux/pmu.h
@@ -5,137 +5,11 @@
5 * 5 *
6 * Copyright (C) 1998 Paul Mackerras. 6 * Copyright (C) 1998 Paul Mackerras.
7 */ 7 */
8
9#ifndef _LINUX_PMU_H 8#ifndef _LINUX_PMU_H
10#define _LINUX_PMU_H 9#define _LINUX_PMU_H
11 10
12#define PMU_DRIVER_VERSION 2 11#include <uapi/linux/pmu.h>
13
14/*
15 * PMU commands
16 */
17#define PMU_POWER_CTRL0 0x10 /* control power of some devices */
18#define PMU_POWER_CTRL 0x11 /* control power of some devices */
19#define PMU_ADB_CMD 0x20 /* send ADB packet */
20#define PMU_ADB_POLL_OFF 0x21 /* disable ADB auto-poll */
21#define PMU_WRITE_NVRAM 0x33 /* write non-volatile RAM */
22#define PMU_READ_NVRAM 0x3b /* read non-volatile RAM */
23#define PMU_SET_RTC 0x30 /* set real-time clock */
24#define PMU_READ_RTC 0x38 /* read real-time clock */
25#define PMU_SET_VOLBUTTON 0x40 /* set volume up/down position */
26#define PMU_BACKLIGHT_BRIGHT 0x41 /* set backlight brightness */
27#define PMU_GET_VOLBUTTON 0x48 /* get volume up/down position */
28#define PMU_PCEJECT 0x4c /* eject PC-card from slot */
29#define PMU_BATTERY_STATE 0x6b /* report battery state etc. */
30#define PMU_SMART_BATTERY_STATE 0x6f /* report battery state (new way) */
31#define PMU_SET_INTR_MASK 0x70 /* set PMU interrupt mask */
32#define PMU_INT_ACK 0x78 /* read interrupt bits */
33#define PMU_SHUTDOWN 0x7e /* turn power off */
34#define PMU_CPU_SPEED 0x7d /* control CPU speed on some models */
35#define PMU_SLEEP 0x7f /* put CPU to sleep */
36#define PMU_POWER_EVENTS 0x8f /* Send power-event commands to PMU */
37#define PMU_I2C_CMD 0x9a /* I2C operations */
38#define PMU_RESET 0xd0 /* reset CPU */
39#define PMU_GET_BRIGHTBUTTON 0xd9 /* report brightness up/down pos */
40#define PMU_GET_COVER 0xdc /* report cover open/closed */
41#define PMU_SYSTEM_READY 0xdf /* tell PMU we are awake */
42#define PMU_GET_VERSION 0xea /* read the PMU version */
43
44/* Bits to use with the PMU_POWER_CTRL0 command */
45#define PMU_POW0_ON 0x80 /* OR this to power ON the device */
46#define PMU_POW0_OFF 0x00 /* leave bit 7 to 0 to power it OFF */
47#define PMU_POW0_HARD_DRIVE 0x04 /* Hard drive power (on wallstreet/lombard ?) */
48
49/* Bits to use with the PMU_POWER_CTRL command */
50#define PMU_POW_ON 0x80 /* OR this to power ON the device */
51#define PMU_POW_OFF 0x00 /* leave bit 7 to 0 to power it OFF */
52#define PMU_POW_BACKLIGHT 0x01 /* backlight power */
53#define PMU_POW_CHARGER 0x02 /* battery charger power */
54#define PMU_POW_IRLED 0x04 /* IR led power (on wallstreet) */
55#define PMU_POW_MEDIABAY 0x08 /* media bay power (wallstreet/lombard ?) */
56
57/* Bits in PMU interrupt and interrupt mask bytes */
58#define PMU_INT_PCEJECT 0x04 /* PC-card eject buttons */
59#define PMU_INT_SNDBRT 0x08 /* sound/brightness up/down buttons */
60#define PMU_INT_ADB 0x10 /* ADB autopoll or reply data */
61#define PMU_INT_BATTERY 0x20 /* Battery state change */
62#define PMU_INT_ENVIRONMENT 0x40 /* Environment interrupts */
63#define PMU_INT_TICK 0x80 /* 1-second tick interrupt */
64
65/* Other bits in PMU interrupt valid when PMU_INT_ADB is set */
66#define PMU_INT_ADB_AUTO 0x04 /* ADB autopoll, when PMU_INT_ADB */
67#define PMU_INT_WAITING_CHARGER 0x01 /* ??? */
68#define PMU_INT_AUTO_SRQ_POLL 0x02 /* ??? */
69
70/* Bits in the environement message (either obtained via PMU_GET_COVER,
71 * or via PMU_INT_ENVIRONMENT on core99 */
72#define PMU_ENV_LID_CLOSED 0x01 /* The lid is closed */
73
74/* I2C related definitions */
75#define PMU_I2C_MODE_SIMPLE 0
76#define PMU_I2C_MODE_STDSUB 1
77#define PMU_I2C_MODE_COMBINED 2
78
79#define PMU_I2C_BUS_STATUS 0
80#define PMU_I2C_BUS_SYSCLK 1
81#define PMU_I2C_BUS_POWER 2
82
83#define PMU_I2C_STATUS_OK 0
84#define PMU_I2C_STATUS_DATAREAD 1
85#define PMU_I2C_STATUS_BUSY 0xfe
86
87
88/* Kind of PMU (model) */
89enum {
90 PMU_UNKNOWN,
91 PMU_OHARE_BASED, /* 2400, 3400, 3500 (old G3 powerbook) */
92 PMU_HEATHROW_BASED, /* PowerBook G3 series */
93 PMU_PADDINGTON_BASED, /* 1999 PowerBook G3 */
94 PMU_KEYLARGO_BASED, /* Core99 motherboard (PMU99) */
95 PMU_68K_V1, /* 68K PMU, version 1 */
96 PMU_68K_V2, /* 68K PMU, version 2 */
97};
98 12
99/* PMU PMU_POWER_EVENTS commands */
100enum {
101 PMU_PWR_GET_POWERUP_EVENTS = 0x00,
102 PMU_PWR_SET_POWERUP_EVENTS = 0x01,
103 PMU_PWR_CLR_POWERUP_EVENTS = 0x02,
104 PMU_PWR_GET_WAKEUP_EVENTS = 0x03,
105 PMU_PWR_SET_WAKEUP_EVENTS = 0x04,
106 PMU_PWR_CLR_WAKEUP_EVENTS = 0x05,
107};
108
109/* Power events wakeup bits */
110enum {
111 PMU_PWR_WAKEUP_KEY = 0x01, /* Wake on key press */
112 PMU_PWR_WAKEUP_AC_INSERT = 0x02, /* Wake on AC adapter plug */
113 PMU_PWR_WAKEUP_AC_CHANGE = 0x04,
114 PMU_PWR_WAKEUP_LID_OPEN = 0x08,
115 PMU_PWR_WAKEUP_RING = 0x10,
116};
117
118/*
119 * Ioctl commands for the /dev/pmu device
120 */
121#include <linux/ioctl.h>
122
123/* no param */
124#define PMU_IOC_SLEEP _IO('B', 0)
125/* out param: u32* backlight value: 0 to 15 */
126#define PMU_IOC_GET_BACKLIGHT _IOR('B', 1, size_t)
127/* in param: u32 backlight value: 0 to 15 */
128#define PMU_IOC_SET_BACKLIGHT _IOW('B', 2, size_t)
129/* out param: u32* PMU model */
130#define PMU_IOC_GET_MODEL _IOR('B', 3, size_t)
131/* out param: u32* has_adb: 0 or 1 */
132#define PMU_IOC_HAS_ADB _IOR('B', 4, size_t)
133/* out param: u32* can_sleep: 0 or 1 */
134#define PMU_IOC_CAN_SLEEP _IOR('B', 5, size_t)
135/* no param, but historically was _IOR('B', 6, 0), meaning 4 bytes */
136#define PMU_IOC_GRAB_BACKLIGHT _IOR('B', 6, size_t)
137
138#ifdef __KERNEL__
139 13
140extern int find_via_pmu(void); 14extern int find_via_pmu(void);
141 15
@@ -208,6 +82,4 @@ extern int pmu_sys_suspended;
208#define pmu_sys_suspended 0 82#define pmu_sys_suspended 0
209#endif 83#endif
210 84
211#endif /* __KERNEL__ */
212
213#endif /* _LINUX_PMU_H */ 85#endif /* _LINUX_PMU_H */
diff --git a/include/linux/pnfs_osd_xdr.h b/include/linux/pnfs_osd_xdr.h
index 435dd5fa7453..fe25876c1a5d 100644
--- a/include/linux/pnfs_osd_xdr.h
+++ b/include/linux/pnfs_osd_xdr.h
@@ -40,7 +40,6 @@
40#define __PNFS_OSD_XDR_H__ 40#define __PNFS_OSD_XDR_H__
41 41
42#include <linux/nfs_fs.h> 42#include <linux/nfs_fs.h>
43#include <linux/nfs_page.h>
44 43
45/* 44/*
46 * draft-ietf-nfsv4-minorversion-22 45 * draft-ietf-nfsv4-minorversion-22
diff --git a/include/linux/poll.h b/include/linux/poll.h
index 48fe8bc398d1..c08386fb3e08 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -1,9 +1,6 @@
1#ifndef _LINUX_POLL_H 1#ifndef _LINUX_POLL_H
2#define _LINUX_POLL_H 2#define _LINUX_POLL_H
3 3
4#include <asm/poll.h>
5
6#ifdef __KERNEL__
7 4
8#include <linux/compiler.h> 5#include <linux/compiler.h>
9#include <linux/ktime.h> 6#include <linux/ktime.h>
@@ -12,6 +9,7 @@
12#include <linux/fs.h> 9#include <linux/fs.h>
13#include <linux/sysctl.h> 10#include <linux/sysctl.h>
14#include <asm/uaccess.h> 11#include <asm/uaccess.h>
12#include <uapi/linux/poll.h>
15 13
16extern struct ctl_table epoll_table[]; /* for sysctl */ 14extern struct ctl_table epoll_table[]; /* for sysctl */
17/* ~832 bytes of stack space used max in sys_select/sys_poll before allocating 15/* ~832 bytes of stack space used max in sys_select/sys_poll before allocating
@@ -163,6 +161,4 @@ extern int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
163 161
164extern int poll_select_set_timeout(struct timespec *to, long sec, long nsec); 162extern int poll_select_set_timeout(struct timespec *to, long sec, long nsec);
165 163
166#endif /* KERNEL */
167
168#endif /* _LINUX_POLL_H */ 164#endif /* _LINUX_POLL_H */
diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h
index cd22029e32aa..0e86840eb603 100644
--- a/include/linux/power/charger-manager.h
+++ b/include/linux/power/charger-manager.h
@@ -109,24 +109,43 @@ struct charger_cable {
109 * struct charger_regulator 109 * struct charger_regulator
110 * @regulator_name: the name of regulator for using charger. 110 * @regulator_name: the name of regulator for using charger.
111 * @consumer: the regulator consumer for the charger. 111 * @consumer: the regulator consumer for the charger.
112 * @externally_control:
113 * Set if the charger-manager cannot control charger,
114 * the charger will be maintained with disabled state.
112 * @cables: 115 * @cables:
113 * the array of charger cables to enable/disable charger 116 * the array of charger cables to enable/disable charger
114 * and set current limit according to constratint data of 117 * and set current limit according to constratint data of
115 * struct charger_cable if only charger cable included 118 * struct charger_cable if only charger cable included
116 * in the array of charger cables is attached/detached. 119 * in the array of charger cables is attached/detached.
117 * @num_cables: the number of charger cables. 120 * @num_cables: the number of charger cables.
121 * @attr_g: Attribute group for the charger(regulator)
122 * @attr_name: "name" sysfs entry
123 * @attr_state: "state" sysfs entry
124 * @attr_externally_control: "externally_control" sysfs entry
125 * @attrs: Arrays pointing to attr_name/state/externally_control for attr_g
118 */ 126 */
119struct charger_regulator { 127struct charger_regulator {
120 /* The name of regulator for charging */ 128 /* The name of regulator for charging */
121 const char *regulator_name; 129 const char *regulator_name;
122 struct regulator *consumer; 130 struct regulator *consumer;
123 131
132 /* charger never on when system is on */
133 int externally_control;
134
124 /* 135 /*
125 * Store constraint information related to current limit, 136 * Store constraint information related to current limit,
126 * each cable have different condition for charging. 137 * each cable have different condition for charging.
127 */ 138 */
128 struct charger_cable *cables; 139 struct charger_cable *cables;
129 int num_cables; 140 int num_cables;
141
142 struct attribute_group attr_g;
143 struct device_attribute attr_name;
144 struct device_attribute attr_state;
145 struct device_attribute attr_externally_control;
146 struct attribute *attrs[4];
147
148 struct charger_manager *cm;
130}; 149};
131 150
132/** 151/**
@@ -140,7 +159,11 @@ struct charger_regulator {
140 * If it has dropped more than fullbatt_vchkdrop_uV after 159 * If it has dropped more than fullbatt_vchkdrop_uV after
141 * fullbatt_vchkdrop_ms, CM will restart charging. 160 * fullbatt_vchkdrop_ms, CM will restart charging.
142 * @fullbatt_uV: voltage in microvolt 161 * @fullbatt_uV: voltage in microvolt
143 * If it is not being charged and VBATT >= fullbatt_uV, 162 * If VBATT >= fullbatt_uV, it is assumed to be full.
163 * @fullbatt_soc: state of Charge in %
164 * If state of Charge >= fullbatt_soc, it is assumed to be full.
165 * @fullbatt_full_capacity: full capacity measure
166 * If full capacity of battery >= fullbatt_full_capacity,
144 * it is assumed to be full. 167 * it is assumed to be full.
145 * @polling_interval_ms: interval in millisecond at which 168 * @polling_interval_ms: interval in millisecond at which
146 * charger manager will monitor battery health 169 * charger manager will monitor battery health
@@ -148,7 +171,7 @@ struct charger_regulator {
148 * Specify where information for existance of battery can be obtained 171 * Specify where information for existance of battery can be obtained
149 * @psy_charger_stat: the names of power-supply for chargers 172 * @psy_charger_stat: the names of power-supply for chargers
150 * @num_charger_regulator: the number of entries in charger_regulators 173 * @num_charger_regulator: the number of entries in charger_regulators
151 * @charger_regulators: array of regulator_bulk_data for chargers 174 * @charger_regulators: array of charger regulators
152 * @psy_fuel_gauge: the name of power-supply for fuel gauge 175 * @psy_fuel_gauge: the name of power-supply for fuel gauge
153 * @temperature_out_of_range: 176 * @temperature_out_of_range:
154 * Determine whether the status is overheat or cold or normal. 177 * Determine whether the status is overheat or cold or normal.
@@ -158,6 +181,13 @@ struct charger_regulator {
158 * @measure_battery_temp: 181 * @measure_battery_temp:
159 * true: measure battery temperature 182 * true: measure battery temperature
160 * false: measure ambient temperature 183 * false: measure ambient temperature
184 * @charging_max_duration_ms: Maximum possible duration for charging
185 * If whole charging duration exceed 'charging_max_duration_ms',
186 * cm stop charging.
187 * @discharging_max_duration_ms:
188 * Maximum possible duration for discharging with charger cable
189 * after full-batt. If discharging duration exceed 'discharging
190 * max_duration_ms', cm start charging.
161 */ 191 */
162struct charger_desc { 192struct charger_desc {
163 char *psy_name; 193 char *psy_name;
@@ -168,6 +198,8 @@ struct charger_desc {
168 unsigned int fullbatt_vchkdrop_ms; 198 unsigned int fullbatt_vchkdrop_ms;
169 unsigned int fullbatt_vchkdrop_uV; 199 unsigned int fullbatt_vchkdrop_uV;
170 unsigned int fullbatt_uV; 200 unsigned int fullbatt_uV;
201 unsigned int fullbatt_soc;
202 unsigned int fullbatt_full_capacity;
171 203
172 enum data_source battery_present; 204 enum data_source battery_present;
173 205
@@ -180,6 +212,9 @@ struct charger_desc {
180 212
181 int (*temperature_out_of_range)(int *mC); 213 int (*temperature_out_of_range)(int *mC);
182 bool measure_battery_temp; 214 bool measure_battery_temp;
215
216 u64 charging_max_duration_ms;
217 u64 discharging_max_duration_ms;
183}; 218};
184 219
185#define PSY_NAME_MAX 30 220#define PSY_NAME_MAX 30
@@ -194,8 +229,6 @@ struct charger_desc {
194 * @charger_enabled: the state of charger 229 * @charger_enabled: the state of charger
195 * @fullbatt_vchk_jiffies_at: 230 * @fullbatt_vchk_jiffies_at:
196 * jiffies at the time full battery check will occur. 231 * jiffies at the time full battery check will occur.
197 * @fullbatt_vchk_uV: voltage in microvolt
198 * criteria for full battery
199 * @fullbatt_vchk_work: work queue for full battery check 232 * @fullbatt_vchk_work: work queue for full battery check
200 * @emergency_stop: 233 * @emergency_stop:
201 * When setting true, stop charging 234 * When setting true, stop charging
@@ -206,6 +239,8 @@ struct charger_desc {
206 * saved status of external power before entering suspend-to-RAM 239 * saved status of external power before entering suspend-to-RAM
207 * @status_save_batt: 240 * @status_save_batt:
208 * saved status of battery before entering suspend-to-RAM 241 * saved status of battery before entering suspend-to-RAM
242 * @charging_start_time: saved start time of enabling charging
243 * @charging_end_time: saved end time of disabling charging
209 */ 244 */
210struct charger_manager { 245struct charger_manager {
211 struct list_head entry; 246 struct list_head entry;
@@ -218,7 +253,6 @@ struct charger_manager {
218 bool charger_enabled; 253 bool charger_enabled;
219 254
220 unsigned long fullbatt_vchk_jiffies_at; 255 unsigned long fullbatt_vchk_jiffies_at;
221 unsigned int fullbatt_vchk_uV;
222 struct delayed_work fullbatt_vchk_work; 256 struct delayed_work fullbatt_vchk_work;
223 257
224 int emergency_stop; 258 int emergency_stop;
@@ -229,6 +263,9 @@ struct charger_manager {
229 263
230 bool status_save_ext_pwr_inserted; 264 bool status_save_ext_pwr_inserted;
231 bool status_save_batt; 265 bool status_save_batt;
266
267 u64 charging_start_time;
268 u64 charging_end_time;
232}; 269};
233 270
234#ifdef CONFIG_CHARGER_MANAGER 271#ifdef CONFIG_CHARGER_MANAGER
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 0bafbb15f29c..e5ef45834c3c 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -88,6 +88,7 @@ enum power_supply_property {
88 POWER_SUPPLY_PROP_HEALTH, 88 POWER_SUPPLY_PROP_HEALTH,
89 POWER_SUPPLY_PROP_PRESENT, 89 POWER_SUPPLY_PROP_PRESENT,
90 POWER_SUPPLY_PROP_ONLINE, 90 POWER_SUPPLY_PROP_ONLINE,
91 POWER_SUPPLY_PROP_AUTHENTIC,
91 POWER_SUPPLY_PROP_TECHNOLOGY, 92 POWER_SUPPLY_PROP_TECHNOLOGY,
92 POWER_SUPPLY_PROP_CYCLE_COUNT, 93 POWER_SUPPLY_PROP_CYCLE_COUNT,
93 POWER_SUPPLY_PROP_VOLTAGE_MAX, 94 POWER_SUPPLY_PROP_VOLTAGE_MAX,
@@ -110,7 +111,9 @@ enum power_supply_property {
110 POWER_SUPPLY_PROP_CHARGE_AVG, 111 POWER_SUPPLY_PROP_CHARGE_AVG,
111 POWER_SUPPLY_PROP_CHARGE_COUNTER, 112 POWER_SUPPLY_PROP_CHARGE_COUNTER,
112 POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT, 113 POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT,
114 POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
113 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE, 115 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
116 POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
114 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, 117 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
115 POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN, 118 POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN,
116 POWER_SUPPLY_PROP_ENERGY_FULL, 119 POWER_SUPPLY_PROP_ENERGY_FULL,
@@ -248,6 +251,7 @@ static inline bool power_supply_is_amp_property(enum power_supply_property psp)
248 case POWER_SUPPLY_PROP_CHARGE_AVG: 251 case POWER_SUPPLY_PROP_CHARGE_AVG:
249 case POWER_SUPPLY_PROP_CHARGE_COUNTER: 252 case POWER_SUPPLY_PROP_CHARGE_COUNTER:
250 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT: 253 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
254 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:
251 case POWER_SUPPLY_PROP_CURRENT_MAX: 255 case POWER_SUPPLY_PROP_CURRENT_MAX:
252 case POWER_SUPPLY_PROP_CURRENT_NOW: 256 case POWER_SUPPLY_PROP_CURRENT_NOW:
253 case POWER_SUPPLY_PROP_CURRENT_AVG: 257 case POWER_SUPPLY_PROP_CURRENT_AVG:
@@ -276,6 +280,7 @@ static inline bool power_supply_is_watt_property(enum power_supply_property psp)
276 case POWER_SUPPLY_PROP_VOLTAGE_AVG: 280 case POWER_SUPPLY_PROP_VOLTAGE_AVG:
277 case POWER_SUPPLY_PROP_VOLTAGE_OCV: 281 case POWER_SUPPLY_PROP_VOLTAGE_OCV:
278 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE: 282 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
283 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
279 case POWER_SUPPLY_PROP_POWER_NOW: 284 case POWER_SUPPLY_PROP_POWER_NOW:
280 return 1; 285 return 1;
281 default: 286 default:
diff --git a/include/linux/ppp-comp.h b/include/linux/ppp-comp.h
index e53ff65935dd..4ea1d377e1ad 100644
--- a/include/linux/ppp-comp.h
+++ b/include/linux/ppp-comp.h
@@ -10,6 +10,9 @@
10#ifndef _NET_PPP_COMP_H 10#ifndef _NET_PPP_COMP_H
11#define _NET_PPP_COMP_H 11#define _NET_PPP_COMP_H
12 12
13#include <uapi/linux/ppp-comp.h>
14
15
13struct module; 16struct module;
14 17
15/* 18/*
@@ -98,87 +101,6 @@ struct compressor {
98#define DECOMP_ERROR -1 /* error detected before decomp. */ 101#define DECOMP_ERROR -1 /* error detected before decomp. */
99#define DECOMP_FATALERROR -2 /* error detected after decomp. */ 102#define DECOMP_FATALERROR -2 /* error detected after decomp. */
100 103
101/*
102 * CCP codes.
103 */
104
105#define CCP_CONFREQ 1
106#define CCP_CONFACK 2
107#define CCP_TERMREQ 5
108#define CCP_TERMACK 6
109#define CCP_RESETREQ 14
110#define CCP_RESETACK 15
111
112/*
113 * Max # bytes for a CCP option
114 */
115
116#define CCP_MAX_OPTION_LENGTH 32
117
118/*
119 * Parts of a CCP packet.
120 */
121
122#define CCP_CODE(dp) ((dp)[0])
123#define CCP_ID(dp) ((dp)[1])
124#define CCP_LENGTH(dp) (((dp)[2] << 8) + (dp)[3])
125#define CCP_HDRLEN 4
126
127#define CCP_OPT_CODE(dp) ((dp)[0])
128#define CCP_OPT_LENGTH(dp) ((dp)[1])
129#define CCP_OPT_MINLEN 2
130
131/*
132 * Definitions for BSD-Compress.
133 */
134
135#define CI_BSD_COMPRESS 21 /* config. option for BSD-Compress */
136#define CILEN_BSD_COMPRESS 3 /* length of config. option */
137
138/* Macros for handling the 3rd byte of the BSD-Compress config option. */
139#define BSD_NBITS(x) ((x) & 0x1F) /* number of bits requested */
140#define BSD_VERSION(x) ((x) >> 5) /* version of option format */
141#define BSD_CURRENT_VERSION 1 /* current version number */
142#define BSD_MAKE_OPT(v, n) (((v) << 5) | (n))
143
144#define BSD_MIN_BITS 9 /* smallest code size supported */
145#define BSD_MAX_BITS 15 /* largest code size supported */
146
147/*
148 * Definitions for Deflate.
149 */
150
151#define CI_DEFLATE 26 /* config option for Deflate */
152#define CI_DEFLATE_DRAFT 24 /* value used in original draft RFC */
153#define CILEN_DEFLATE 4 /* length of its config option */
154
155#define DEFLATE_MIN_SIZE 9
156#define DEFLATE_MAX_SIZE 15
157#define DEFLATE_METHOD_VAL 8
158#define DEFLATE_SIZE(x) (((x) >> 4) + 8)
159#define DEFLATE_METHOD(x) ((x) & 0x0F)
160#define DEFLATE_MAKE_OPT(w) ((((w) - 8) << 4) + DEFLATE_METHOD_VAL)
161#define DEFLATE_CHK_SEQUENCE 0
162
163/*
164 * Definitions for MPPE.
165 */
166
167#define CI_MPPE 18 /* config option for MPPE */
168#define CILEN_MPPE 6 /* length of config option */
169
170/*
171 * Definitions for other, as yet unsupported, compression methods.
172 */
173
174#define CI_PREDICTOR_1 1 /* config option for Predictor-1 */
175#define CILEN_PREDICTOR_1 2 /* length of its config option */
176#define CI_PREDICTOR_2 2 /* config option for Predictor-2 */
177#define CILEN_PREDICTOR_2 2 /* length of its config option */
178
179#ifdef __KERNEL__
180extern int ppp_register_compressor(struct compressor *); 104extern int ppp_register_compressor(struct compressor *);
181extern void ppp_unregister_compressor(struct compressor *); 105extern void ppp_unregister_compressor(struct compressor *);
182#endif /* __KERNEL__ */
183
184#endif /* _NET_PPP_COMP_H */ 106#endif /* _NET_PPP_COMP_H */
diff --git a/include/linux/ppp_defs.h b/include/linux/ppp_defs.h
index ba416f67eb62..28aa0237c8c3 100644
--- a/include/linux/ppp_defs.h
+++ b/include/linux/ppp_defs.h
@@ -7,148 +7,11 @@
7 * modify it under the terms of the GNU General Public License 7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation. 8 * version 2 as published by the Free Software Foundation.
9 */ 9 */
10#include <linux/types.h>
11
12#ifndef _PPP_DEFS_H_ 10#ifndef _PPP_DEFS_H_
13#define _PPP_DEFS_H_ 11#define _PPP_DEFS_H_
14 12
15/*
16 * The basic PPP frame.
17 */
18#define PPP_HDRLEN 4 /* octets for standard ppp header */
19#define PPP_FCSLEN 2 /* octets for FCS */
20#define PPP_MRU 1500 /* default MRU = max length of info field */
21
22#define PPP_ADDRESS(p) (((__u8 *)(p))[0])
23#define PPP_CONTROL(p) (((__u8 *)(p))[1])
24#define PPP_PROTOCOL(p) ((((__u8 *)(p))[2] << 8) + ((__u8 *)(p))[3])
25
26/*
27 * Significant octet values.
28 */
29#define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */
30#define PPP_UI 0x03 /* Unnumbered Information */
31#define PPP_FLAG 0x7e /* Flag Sequence */
32#define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */
33#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */
34
35/*
36 * Protocol field values.
37 */
38#define PPP_IP 0x21 /* Internet Protocol */
39#define PPP_AT 0x29 /* AppleTalk Protocol */
40#define PPP_IPX 0x2b /* IPX protocol */
41#define PPP_VJC_COMP 0x2d /* VJ compressed TCP */
42#define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */
43#define PPP_MP 0x3d /* Multilink protocol */
44#define PPP_IPV6 0x57 /* Internet Protocol Version 6 */
45#define PPP_COMPFRAG 0xfb /* fragment compressed below bundle */
46#define PPP_COMP 0xfd /* compressed packet */
47#define PPP_MPLS_UC 0x0281 /* Multi Protocol Label Switching - Unicast */
48#define PPP_MPLS_MC 0x0283 /* Multi Protocol Label Switching - Multicast */
49#define PPP_IPCP 0x8021 /* IP Control Protocol */
50#define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */
51#define PPP_IPXCP 0x802b /* IPX Control Protocol */
52#define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */
53#define PPP_CCPFRAG 0x80fb /* CCP at link level (below MP bundle) */
54#define PPP_CCP 0x80fd /* Compression Control Protocol */
55#define PPP_MPLSCP 0x80fd /* MPLS Control Protocol */
56#define PPP_LCP 0xc021 /* Link Control Protocol */
57#define PPP_PAP 0xc023 /* Password Authentication Protocol */
58#define PPP_LQR 0xc025 /* Link Quality Report protocol */
59#define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */
60#define PPP_CBCP 0xc029 /* Callback Control Protocol */
61
62/*
63 * Values for FCS calculations.
64 */
65
66#define PPP_INITFCS 0xffff /* Initial FCS value */
67#define PPP_GOODFCS 0xf0b8 /* Good final FCS value */
68
69#ifdef __KERNEL__
70#include <linux/crc-ccitt.h> 13#include <linux/crc-ccitt.h>
71#define PPP_FCS(fcs, c) crc_ccitt_byte(fcs, c) 14#include <uapi/linux/ppp_defs.h>
72#endif
73
74/*
75 * Extended asyncmap - allows any character to be escaped.
76 */
77
78typedef __u32 ext_accm[8];
79
80/*
81 * What to do with network protocol (NP) packets.
82 */
83enum NPmode {
84 NPMODE_PASS, /* pass the packet through */
85 NPMODE_DROP, /* silently drop the packet */
86 NPMODE_ERROR, /* return an error */
87 NPMODE_QUEUE /* save it up for later. */
88};
89
90/*
91 * Statistics for LQRP and pppstats
92 */
93struct pppstat {
94 __u32 ppp_discards; /* # frames discarded */
95
96 __u32 ppp_ibytes; /* bytes received */
97 __u32 ppp_ioctects; /* bytes received not in error */
98 __u32 ppp_ipackets; /* packets received */
99 __u32 ppp_ierrors; /* receive errors */
100 __u32 ppp_ilqrs; /* # LQR frames received */
101
102 __u32 ppp_obytes; /* raw bytes sent */
103 __u32 ppp_ooctects; /* frame bytes sent */
104 __u32 ppp_opackets; /* packets sent */
105 __u32 ppp_oerrors; /* transmit errors */
106 __u32 ppp_olqrs; /* # LQR frames sent */
107};
108
109struct vjstat {
110 __u32 vjs_packets; /* outbound packets */
111 __u32 vjs_compressed; /* outbound compressed packets */
112 __u32 vjs_searches; /* searches for connection state */
113 __u32 vjs_misses; /* times couldn't find conn. state */
114 __u32 vjs_uncompressedin; /* inbound uncompressed packets */
115 __u32 vjs_compressedin; /* inbound compressed packets */
116 __u32 vjs_errorin; /* inbound unknown type packets */
117 __u32 vjs_tossed; /* inbound packets tossed because of error */
118};
119
120struct compstat {
121 __u32 unc_bytes; /* total uncompressed bytes */
122 __u32 unc_packets; /* total uncompressed packets */
123 __u32 comp_bytes; /* compressed bytes */
124 __u32 comp_packets; /* compressed packets */
125 __u32 inc_bytes; /* incompressible bytes */
126 __u32 inc_packets; /* incompressible packets */
127
128 /* the compression ratio is defined as in_count / bytes_out */
129 __u32 in_count; /* Bytes received */
130 __u32 bytes_out; /* Bytes transmitted */
131
132 double ratio; /* not computed in kernel. */
133};
134
135struct ppp_stats {
136 struct pppstat p; /* basic PPP statistics */
137 struct vjstat vj; /* VJ header compression statistics */
138};
139
140struct ppp_comp_stats {
141 struct compstat c; /* packet compression statistics */
142 struct compstat d; /* packet decompression statistics */
143};
144
145/*
146 * The following structure records the time in seconds since
147 * the last NP packet was sent or received.
148 */
149struct ppp_idle {
150 __kernel_time_t xmit_idle; /* time since last NP packet sent */
151 __kernel_time_t recv_idle; /* time since last NP packet received */
152};
153 15
16#define PPP_FCS(fcs, c) crc_ccitt_byte(fcs, c)
154#endif /* _PPP_DEFS_H_ */ 17#endif /* _PPP_DEFS_H_ */
diff --git a/include/linux/prio_tree.h b/include/linux/prio_tree.h
deleted file mode 100644
index db04abb557e0..000000000000
--- a/include/linux/prio_tree.h
+++ /dev/null
@@ -1,120 +0,0 @@
1#ifndef _LINUX_PRIO_TREE_H
2#define _LINUX_PRIO_TREE_H
3
4/*
5 * K&R 2nd ed. A8.3 somewhat obliquely hints that initial sequences of struct
6 * fields with identical types should end up at the same location. We'll use
7 * this until we can scrap struct raw_prio_tree_node.
8 *
9 * Note: all this could be done more elegantly by using unnamed union/struct
10 * fields. However, gcc 2.95.3 and apparently also gcc 3.0.4 don't support this
11 * language extension.
12 */
13
14struct raw_prio_tree_node {
15 struct prio_tree_node *left;
16 struct prio_tree_node *right;
17 struct prio_tree_node *parent;
18};
19
20struct prio_tree_node {
21 struct prio_tree_node *left;
22 struct prio_tree_node *right;
23 struct prio_tree_node *parent;
24 unsigned long start;
25 unsigned long last; /* last location _in_ interval */
26};
27
28struct prio_tree_root {
29 struct prio_tree_node *prio_tree_node;
30 unsigned short index_bits;
31 unsigned short raw;
32 /*
33 * 0: nodes are of type struct prio_tree_node
34 * 1: nodes are of type raw_prio_tree_node
35 */
36};
37
38struct prio_tree_iter {
39 struct prio_tree_node *cur;
40 unsigned long mask;
41 unsigned long value;
42 int size_level;
43
44 struct prio_tree_root *root;
45 pgoff_t r_index;
46 pgoff_t h_index;
47};
48
49static inline void prio_tree_iter_init(struct prio_tree_iter *iter,
50 struct prio_tree_root *root, pgoff_t r_index, pgoff_t h_index)
51{
52 iter->root = root;
53 iter->r_index = r_index;
54 iter->h_index = h_index;
55 iter->cur = NULL;
56}
57
58#define __INIT_PRIO_TREE_ROOT(ptr, _raw) \
59do { \
60 (ptr)->prio_tree_node = NULL; \
61 (ptr)->index_bits = 1; \
62 (ptr)->raw = (_raw); \
63} while (0)
64
65#define INIT_PRIO_TREE_ROOT(ptr) __INIT_PRIO_TREE_ROOT(ptr, 0)
66#define INIT_RAW_PRIO_TREE_ROOT(ptr) __INIT_PRIO_TREE_ROOT(ptr, 1)
67
68#define INIT_PRIO_TREE_NODE(ptr) \
69do { \
70 (ptr)->left = (ptr)->right = (ptr)->parent = (ptr); \
71} while (0)
72
73#define INIT_PRIO_TREE_ITER(ptr) \
74do { \
75 (ptr)->cur = NULL; \
76 (ptr)->mask = 0UL; \
77 (ptr)->value = 0UL; \
78 (ptr)->size_level = 0; \
79} while (0)
80
81#define prio_tree_entry(ptr, type, member) \
82 ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
83
84static inline int prio_tree_empty(const struct prio_tree_root *root)
85{
86 return root->prio_tree_node == NULL;
87}
88
89static inline int prio_tree_root(const struct prio_tree_node *node)
90{
91 return node->parent == node;
92}
93
94static inline int prio_tree_left_empty(const struct prio_tree_node *node)
95{
96 return node->left == node;
97}
98
99static inline int prio_tree_right_empty(const struct prio_tree_node *node)
100{
101 return node->right == node;
102}
103
104
105struct prio_tree_node *prio_tree_replace(struct prio_tree_root *root,
106 struct prio_tree_node *old, struct prio_tree_node *node);
107struct prio_tree_node *prio_tree_insert(struct prio_tree_root *root,
108 struct prio_tree_node *node);
109void prio_tree_remove(struct prio_tree_root *root, struct prio_tree_node *node);
110struct prio_tree_node *prio_tree_next(struct prio_tree_iter *iter);
111
112#define raw_prio_tree_replace(root, old, node) \
113 prio_tree_replace(root, (struct prio_tree_node *) (old), \
114 (struct prio_tree_node *) (node))
115#define raw_prio_tree_insert(root, node) \
116 prio_tree_insert(root, (struct prio_tree_node *) (node))
117#define raw_prio_tree_remove(root, node) \
118 prio_tree_remove(root, (struct prio_tree_node *) (node))
119
120#endif /* _LINUX_PRIO_TREE_H */
diff --git a/include/linux/pstore.h b/include/linux/pstore.h
index c892587d9b81..ee3034a40884 100644
--- a/include/linux/pstore.h
+++ b/include/linux/pstore.h
@@ -64,14 +64,6 @@ struct pstore_info {
64 void *data; 64 void *data;
65}; 65};
66 66
67
68#ifdef CONFIG_PSTORE_FTRACE
69extern void pstore_ftrace_call(unsigned long ip, unsigned long parent_ip);
70#else
71static inline void pstore_ftrace_call(unsigned long ip, unsigned long parent_ip)
72{ }
73#endif
74
75#ifdef CONFIG_PSTORE 67#ifdef CONFIG_PSTORE
76extern int pstore_register(struct pstore_info *); 68extern int pstore_register(struct pstore_info *);
77#else 69#else
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 3db698aee34c..e0ff4689d35a 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -1,83 +1,13 @@
1#ifndef _LINUX_PTRACE_H 1#ifndef _LINUX_PTRACE_H
2#define _LINUX_PTRACE_H 2#define _LINUX_PTRACE_H
3/* ptrace.h */
4/* structs and defines to help the user use the ptrace system call. */
5 3
6/* has the defines to get at the registers. */ 4#include <linux/compiler.h> /* For unlikely. */
7 5#include <linux/sched.h> /* For struct task_struct. */
8#define PTRACE_TRACEME 0 6#include <linux/err.h> /* for IS_ERR_VALUE */
9#define PTRACE_PEEKTEXT 1 7#include <linux/bug.h> /* For BUG_ON. */
10#define PTRACE_PEEKDATA 2 8#include <uapi/linux/ptrace.h>
11#define PTRACE_PEEKUSR 3
12#define PTRACE_POKETEXT 4
13#define PTRACE_POKEDATA 5
14#define PTRACE_POKEUSR 6
15#define PTRACE_CONT 7
16#define PTRACE_KILL 8
17#define PTRACE_SINGLESTEP 9
18
19#define PTRACE_ATTACH 16
20#define PTRACE_DETACH 17
21
22#define PTRACE_SYSCALL 24
23
24/* 0x4200-0x4300 are reserved for architecture-independent additions. */
25#define PTRACE_SETOPTIONS 0x4200
26#define PTRACE_GETEVENTMSG 0x4201
27#define PTRACE_GETSIGINFO 0x4202
28#define PTRACE_SETSIGINFO 0x4203
29 9
30/* 10/*
31 * Generic ptrace interface that exports the architecture specific regsets
32 * using the corresponding NT_* types (which are also used in the core dump).
33 * Please note that the NT_PRSTATUS note type in a core dump contains a full
34 * 'struct elf_prstatus'. But the user_regset for NT_PRSTATUS contains just the
35 * elf_gregset_t that is the pr_reg field of 'struct elf_prstatus'. For all the
36 * other user_regset flavors, the user_regset layout and the ELF core dump note
37 * payload are exactly the same layout.
38 *
39 * This interface usage is as follows:
40 * struct iovec iov = { buf, len};
41 *
42 * ret = ptrace(PTRACE_GETREGSET/PTRACE_SETREGSET, pid, NT_XXX_TYPE, &iov);
43 *
44 * On the successful completion, iov.len will be updated by the kernel,
45 * specifying how much the kernel has written/read to/from the user's iov.buf.
46 */
47#define PTRACE_GETREGSET 0x4204
48#define PTRACE_SETREGSET 0x4205
49
50#define PTRACE_SEIZE 0x4206
51#define PTRACE_INTERRUPT 0x4207
52#define PTRACE_LISTEN 0x4208
53
54/* Wait extended result codes for the above trace options. */
55#define PTRACE_EVENT_FORK 1
56#define PTRACE_EVENT_VFORK 2
57#define PTRACE_EVENT_CLONE 3
58#define PTRACE_EVENT_EXEC 4
59#define PTRACE_EVENT_VFORK_DONE 5
60#define PTRACE_EVENT_EXIT 6
61#define PTRACE_EVENT_SECCOMP 7
62/* Extended result codes which enabled by means other than options. */
63#define PTRACE_EVENT_STOP 128
64
65/* Options set using PTRACE_SETOPTIONS or using PTRACE_SEIZE @data param */
66#define PTRACE_O_TRACESYSGOOD 1
67#define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK)
68#define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK)
69#define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE)
70#define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC)
71#define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE)
72#define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT)
73#define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP)
74
75#define PTRACE_O_MASK 0x000000ff
76
77#include <asm/ptrace.h>
78
79#ifdef __KERNEL__
80/*
81 * Ptrace flags 11 * Ptrace flags
82 * 12 *
83 * The owner ship rules for task->ptrace which holds the ptrace 13 * The owner ship rules for task->ptrace which holds the ptrace
@@ -108,12 +38,6 @@
108#define PT_BLOCKSTEP_BIT 30 38#define PT_BLOCKSTEP_BIT 30
109#define PT_BLOCKSTEP (1<<PT_BLOCKSTEP_BIT) 39#define PT_BLOCKSTEP (1<<PT_BLOCKSTEP_BIT)
110 40
111#include <linux/compiler.h> /* For unlikely. */
112#include <linux/sched.h> /* For struct task_struct. */
113#include <linux/err.h> /* for IS_ERR_VALUE */
114#include <linux/bug.h> /* For BUG_ON. */
115
116
117extern long arch_ptrace(struct task_struct *child, long request, 41extern long arch_ptrace(struct task_struct *child, long request,
118 unsigned long addr, unsigned long data); 42 unsigned long addr, unsigned long data);
119extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); 43extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len);
@@ -401,6 +325,10 @@ static inline void user_single_step_siginfo(struct task_struct *tsk,
401#define arch_ptrace_stop(code, info) do { } while (0) 325#define arch_ptrace_stop(code, info) do { } while (0)
402#endif 326#endif
403 327
328#ifndef current_pt_regs
329#define current_pt_regs() task_pt_regs(current)
330#endif
331
404extern int task_current_syscall(struct task_struct *target, long *callno, 332extern int task_current_syscall(struct task_struct *target, long *callno,
405 unsigned long args[6], unsigned int maxargs, 333 unsigned long args[6], unsigned int maxargs,
406 unsigned long *sp, unsigned long *pc); 334 unsigned long *sp, unsigned long *pc);
@@ -412,6 +340,4 @@ extern void ptrace_put_breakpoints(struct task_struct *tsk);
412static inline void ptrace_put_breakpoints(struct task_struct *tsk) { } 340static inline void ptrace_put_breakpoints(struct task_struct *tsk) { }
413#endif /* CONFIG_HAVE_HW_BREAKPOINT */ 341#endif /* CONFIG_HAVE_HW_BREAKPOINT */
414 342
415#endif /* __KERNEL */
416
417#endif 343#endif
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 21d076c5089e..112b31436848 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -1,11 +1,13 @@
1#ifndef __LINUX_PWM_H 1#ifndef __LINUX_PWM_H
2#define __LINUX_PWM_H 2#define __LINUX_PWM_H
3 3
4#include <linux/err.h>
4#include <linux/of.h> 5#include <linux/of.h>
5 6
6struct pwm_device; 7struct pwm_device;
7struct seq_file; 8struct seq_file;
8 9
10#if IS_ENABLED(CONFIG_PWM) || IS_ENABLED(CONFIG_HAVE_PWM)
9/* 11/*
10 * pwm_request - request a PWM device 12 * pwm_request - request a PWM device
11 */ 13 */
@@ -30,10 +32,47 @@ int pwm_enable(struct pwm_device *pwm);
30 * pwm_disable - stop a PWM output toggling 32 * pwm_disable - stop a PWM output toggling
31 */ 33 */
32void pwm_disable(struct pwm_device *pwm); 34void pwm_disable(struct pwm_device *pwm);
35#else
36static inline struct pwm_device *pwm_request(int pwm_id, const char *label)
37{
38 return ERR_PTR(-ENODEV);
39}
40
41static inline void pwm_free(struct pwm_device *pwm)
42{
43}
44
45static inline int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
46{
47 return -EINVAL;
48}
49
50static inline int pwm_enable(struct pwm_device *pwm)
51{
52 return -EINVAL;
53}
54
55static inline void pwm_disable(struct pwm_device *pwm)
56{
57}
58#endif
33 59
34#ifdef CONFIG_PWM
35struct pwm_chip; 60struct pwm_chip;
36 61
62/**
63 * enum pwm_polarity - polarity of a PWM signal
64 * @PWM_POLARITY_NORMAL: a high signal for the duration of the duty-
65 * cycle, followed by a low signal for the remainder of the pulse
66 * period
67 * @PWM_POLARITY_INVERSED: a low signal for the duration of the duty-
68 * cycle, followed by a high signal for the remainder of the pulse
69 * period
70 */
71enum pwm_polarity {
72 PWM_POLARITY_NORMAL,
73 PWM_POLARITY_INVERSED,
74};
75
37enum { 76enum {
38 PWMF_REQUESTED = 1 << 0, 77 PWMF_REQUESTED = 1 << 0,
39 PWMF_ENABLED = 1 << 1, 78 PWMF_ENABLED = 1 << 1,
@@ -61,11 +100,17 @@ static inline unsigned int pwm_get_period(struct pwm_device *pwm)
61 return pwm ? pwm->period : 0; 100 return pwm ? pwm->period : 0;
62} 101}
63 102
103/*
104 * pwm_set_polarity - configure the polarity of a PWM signal
105 */
106int pwm_set_polarity(struct pwm_device *pwm, enum pwm_polarity polarity);
107
64/** 108/**
65 * struct pwm_ops - PWM controller operations 109 * struct pwm_ops - PWM controller operations
66 * @request: optional hook for requesting a PWM 110 * @request: optional hook for requesting a PWM
67 * @free: optional hook for freeing a PWM 111 * @free: optional hook for freeing a PWM
68 * @config: configure duty cycles and period length for this PWM 112 * @config: configure duty cycles and period length for this PWM
113 * @set_polarity: configure the polarity of this PWM
69 * @enable: enable PWM output toggling 114 * @enable: enable PWM output toggling
70 * @disable: disable PWM output toggling 115 * @disable: disable PWM output toggling
71 * @dbg_show: optional routine to show contents in debugfs 116 * @dbg_show: optional routine to show contents in debugfs
@@ -79,6 +124,9 @@ struct pwm_ops {
79 int (*config)(struct pwm_chip *chip, 124 int (*config)(struct pwm_chip *chip,
80 struct pwm_device *pwm, 125 struct pwm_device *pwm,
81 int duty_ns, int period_ns); 126 int duty_ns, int period_ns);
127 int (*set_polarity)(struct pwm_chip *chip,
128 struct pwm_device *pwm,
129 enum pwm_polarity polarity);
82 int (*enable)(struct pwm_chip *chip, 130 int (*enable)(struct pwm_chip *chip,
83 struct pwm_device *pwm); 131 struct pwm_device *pwm);
84 void (*disable)(struct pwm_chip *chip, 132 void (*disable)(struct pwm_chip *chip,
@@ -113,6 +161,7 @@ struct pwm_chip {
113 unsigned int of_pwm_n_cells; 161 unsigned int of_pwm_n_cells;
114}; 162};
115 163
164#if IS_ENABLED(CONFIG_PWM)
116int pwm_set_chip_data(struct pwm_device *pwm, void *data); 165int pwm_set_chip_data(struct pwm_device *pwm, void *data);
117void *pwm_get_chip_data(struct pwm_device *pwm); 166void *pwm_get_chip_data(struct pwm_device *pwm);
118 167
@@ -125,6 +174,57 @@ struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip,
125struct pwm_device *pwm_get(struct device *dev, const char *consumer); 174struct pwm_device *pwm_get(struct device *dev, const char *consumer);
126void pwm_put(struct pwm_device *pwm); 175void pwm_put(struct pwm_device *pwm);
127 176
177struct pwm_device *devm_pwm_get(struct device *dev, const char *consumer);
178void devm_pwm_put(struct device *dev, struct pwm_device *pwm);
179#else
180static inline int pwm_set_chip_data(struct pwm_device *pwm, void *data)
181{
182 return -EINVAL;
183}
184
185static inline void *pwm_get_chip_data(struct pwm_device *pwm)
186{
187 return NULL;
188}
189
190static inline int pwmchip_add(struct pwm_chip *chip)
191{
192 return -EINVAL;
193}
194
195static inline int pwmchip_remove(struct pwm_chip *chip)
196{
197 return -EINVAL;
198}
199
200static inline struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip,
201 unsigned int index,
202 const char *label)
203{
204 return ERR_PTR(-ENODEV);
205}
206
207static inline struct pwm_device *pwm_get(struct device *dev,
208 const char *consumer)
209{
210 return ERR_PTR(-ENODEV);
211}
212
213static inline void pwm_put(struct pwm_device *pwm)
214{
215}
216
217static inline struct pwm_device *devm_pwm_get(struct device *dev,
218 const char *consumer)
219{
220 return ERR_PTR(-ENODEV);
221}
222
223static inline void devm_pwm_put(struct device *dev, struct pwm_device *pwm)
224{
225}
226#endif
227
128struct pwm_lookup { 228struct pwm_lookup {
129 struct list_head list; 229 struct list_head list;
130 const char *provider; 230 const char *provider;
@@ -141,8 +241,12 @@ struct pwm_lookup {
141 .con_id = _con_id, \ 241 .con_id = _con_id, \
142 } 242 }
143 243
244#if IS_ENABLED(CONFIG_PWM)
144void pwm_add_table(struct pwm_lookup *table, size_t num); 245void pwm_add_table(struct pwm_lookup *table, size_t num);
145 246#else
247static inline void pwm_add_table(struct pwm_lookup *table, size_t num)
248{
249}
146#endif 250#endif
147 251
148#endif /* __LINUX_PWM_H */ 252#endif /* __LINUX_PWM_H */
diff --git a/include/linux/quota.h b/include/linux/quota.h
index dcd5721e626d..58fdef125252 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -29,146 +29,9 @@
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE. 30 * SUCH DAMAGE.
31 */ 31 */
32
33#ifndef _LINUX_QUOTA_ 32#ifndef _LINUX_QUOTA_
34#define _LINUX_QUOTA_ 33#define _LINUX_QUOTA_
35 34
36#include <linux/errno.h>
37#include <linux/types.h>
38
39#define __DQUOT_VERSION__ "dquot_6.5.2"
40
41#define MAXQUOTAS 2
42#define USRQUOTA 0 /* element used for user quotas */
43#define GRPQUOTA 1 /* element used for group quotas */
44
45/*
46 * Definitions for the default names of the quotas files.
47 */
48#define INITQFNAMES { \
49 "user", /* USRQUOTA */ \
50 "group", /* GRPQUOTA */ \
51 "undefined", \
52};
53
54/*
55 * Command definitions for the 'quotactl' system call.
56 * The commands are broken into a main command defined below
57 * and a subcommand that is used to convey the type of
58 * quota that is being manipulated (see above).
59 */
60#define SUBCMDMASK 0x00ff
61#define SUBCMDSHIFT 8
62#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
63
64#define Q_SYNC 0x800001 /* sync disk copy of a filesystems quotas */
65#define Q_QUOTAON 0x800002 /* turn quotas on */
66#define Q_QUOTAOFF 0x800003 /* turn quotas off */
67#define Q_GETFMT 0x800004 /* get quota format used on given filesystem */
68#define Q_GETINFO 0x800005 /* get information about quota files */
69#define Q_SETINFO 0x800006 /* set information about quota files */
70#define Q_GETQUOTA 0x800007 /* get user quota structure */
71#define Q_SETQUOTA 0x800008 /* set user quota structure */
72
73/* Quota format type IDs */
74#define QFMT_VFS_OLD 1
75#define QFMT_VFS_V0 2
76#define QFMT_OCFS2 3
77#define QFMT_VFS_V1 4
78
79/* Size of block in which space limits are passed through the quota
80 * interface */
81#define QIF_DQBLKSIZE_BITS 10
82#define QIF_DQBLKSIZE (1 << QIF_DQBLKSIZE_BITS)
83
84/*
85 * Quota structure used for communication with userspace via quotactl
86 * Following flags are used to specify which fields are valid
87 */
88enum {
89 QIF_BLIMITS_B = 0,
90 QIF_SPACE_B,
91 QIF_ILIMITS_B,
92 QIF_INODES_B,
93 QIF_BTIME_B,
94 QIF_ITIME_B,
95};
96
97#define QIF_BLIMITS (1 << QIF_BLIMITS_B)
98#define QIF_SPACE (1 << QIF_SPACE_B)
99#define QIF_ILIMITS (1 << QIF_ILIMITS_B)
100#define QIF_INODES (1 << QIF_INODES_B)
101#define QIF_BTIME (1 << QIF_BTIME_B)
102#define QIF_ITIME (1 << QIF_ITIME_B)
103#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)
104#define QIF_USAGE (QIF_SPACE | QIF_INODES)
105#define QIF_TIMES (QIF_BTIME | QIF_ITIME)
106#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES)
107
108struct if_dqblk {
109 __u64 dqb_bhardlimit;
110 __u64 dqb_bsoftlimit;
111 __u64 dqb_curspace;
112 __u64 dqb_ihardlimit;
113 __u64 dqb_isoftlimit;
114 __u64 dqb_curinodes;
115 __u64 dqb_btime;
116 __u64 dqb_itime;
117 __u32 dqb_valid;
118};
119
120/*
121 * Structure used for setting quota information about file via quotactl
122 * Following flags are used to specify which fields are valid
123 */
124#define IIF_BGRACE 1
125#define IIF_IGRACE 2
126#define IIF_FLAGS 4
127#define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
128
129struct if_dqinfo {
130 __u64 dqi_bgrace;
131 __u64 dqi_igrace;
132 __u32 dqi_flags;
133 __u32 dqi_valid;
134};
135
136/*
137 * Definitions for quota netlink interface
138 */
139#define QUOTA_NL_NOWARN 0
140#define QUOTA_NL_IHARDWARN 1 /* Inode hardlimit reached */
141#define QUOTA_NL_ISOFTLONGWARN 2 /* Inode grace time expired */
142#define QUOTA_NL_ISOFTWARN 3 /* Inode softlimit reached */
143#define QUOTA_NL_BHARDWARN 4 /* Block hardlimit reached */
144#define QUOTA_NL_BSOFTLONGWARN 5 /* Block grace time expired */
145#define QUOTA_NL_BSOFTWARN 6 /* Block softlimit reached */
146#define QUOTA_NL_IHARDBELOW 7 /* Usage got below inode hardlimit */
147#define QUOTA_NL_ISOFTBELOW 8 /* Usage got below inode softlimit */
148#define QUOTA_NL_BHARDBELOW 9 /* Usage got below block hardlimit */
149#define QUOTA_NL_BSOFTBELOW 10 /* Usage got below block softlimit */
150
151enum {
152 QUOTA_NL_C_UNSPEC,
153 QUOTA_NL_C_WARNING,
154 __QUOTA_NL_C_MAX,
155};
156#define QUOTA_NL_C_MAX (__QUOTA_NL_C_MAX - 1)
157
158enum {
159 QUOTA_NL_A_UNSPEC,
160 QUOTA_NL_A_QTYPE,
161 QUOTA_NL_A_EXCESS_ID,
162 QUOTA_NL_A_WARNING,
163 QUOTA_NL_A_DEV_MAJOR,
164 QUOTA_NL_A_DEV_MINOR,
165 QUOTA_NL_A_CAUSED_ID,
166 __QUOTA_NL_A_MAX,
167};
168#define QUOTA_NL_A_MAX (__QUOTA_NL_A_MAX - 1)
169
170
171#ifdef __KERNEL__
172#include <linux/list.h> 35#include <linux/list.h>
173#include <linux/mutex.h> 36#include <linux/mutex.h>
174#include <linux/rwsem.h> 37#include <linux/rwsem.h>
@@ -183,6 +46,7 @@ enum {
183#include <linux/atomic.h> 46#include <linux/atomic.h>
184#include <linux/uidgid.h> 47#include <linux/uidgid.h>
185#include <linux/projid.h> 48#include <linux/projid.h>
49#include <uapi/linux/quota.h>
186 50
187#undef USRQUOTA 51#undef USRQUOTA
188#undef GRPQUOTA 52#undef GRPQUOTA
@@ -543,5 +407,4 @@ struct quota_module_name {
543 {QFMT_VFS_V0, "quota_v2"},\ 407 {QFMT_VFS_V0, "quota_v2"},\
544 {0, NULL}} 408 {0, NULL}}
545 409
546#endif /* __KERNEL__ */
547#endif /* _QUOTA_ */ 410#endif /* _QUOTA_ */
diff --git a/include/linux/random.h b/include/linux/random.h
index ac621ce886ca..6330ed47b38b 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -3,50 +3,11 @@
3 * 3 *
4 * Include file for the random number generator. 4 * Include file for the random number generator.
5 */ 5 */
6
7#ifndef _LINUX_RANDOM_H 6#ifndef _LINUX_RANDOM_H
8#define _LINUX_RANDOM_H 7#define _LINUX_RANDOM_H
9 8
10#include <linux/types.h> 9#include <uapi/linux/random.h>
11#include <linux/ioctl.h>
12#include <linux/irqnr.h>
13
14/* ioctl()'s for the random number generator */
15
16/* Get the entropy count. */
17#define RNDGETENTCNT _IOR( 'R', 0x00, int )
18
19/* Add to (or subtract from) the entropy count. (Superuser only.) */
20#define RNDADDTOENTCNT _IOW( 'R', 0x01, int )
21
22/* Get the contents of the entropy pool. (Superuser only.) */
23#define RNDGETPOOL _IOR( 'R', 0x02, int [2] )
24
25/*
26 * Write bytes into the entropy pool and add to the entropy count.
27 * (Superuser only.)
28 */
29#define RNDADDENTROPY _IOW( 'R', 0x03, int [2] )
30 10
31/* Clear entropy count to 0. (Superuser only.) */
32#define RNDZAPENTCNT _IO( 'R', 0x04 )
33
34/* Clear the entropy pool and associated counters. (Superuser only.) */
35#define RNDCLEARPOOL _IO( 'R', 0x06 )
36
37struct rand_pool_info {
38 int entropy_count;
39 int buf_size;
40 __u32 buf[0];
41};
42
43struct rnd_state {
44 __u32 s1, s2, s3;
45};
46
47/* Exported functions */
48
49#ifdef __KERNEL__
50 11
51extern void add_device_randomness(const void *, unsigned int); 12extern void add_device_randomness(const void *, unsigned int);
52extern void add_input_randomness(unsigned int type, unsigned int code, 13extern void add_input_randomness(unsigned int type, unsigned int code,
@@ -104,6 +65,4 @@ static inline int arch_get_random_int(unsigned int *v)
104} 65}
105#endif 66#endif
106 67
107#endif /* __KERNEL___ */
108
109#endif /* _LINUX_RANDOM_H */ 68#endif /* _LINUX_RANDOM_H */
diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
index e11ccb4cf48d..0a260d8a18bf 100644
--- a/include/linux/ratelimit.h
+++ b/include/linux/ratelimit.h
@@ -46,20 +46,17 @@ extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
46#define WARN_ON_RATELIMIT(condition, state) \ 46#define WARN_ON_RATELIMIT(condition, state) \
47 WARN_ON((condition) && __ratelimit(state)) 47 WARN_ON((condition) && __ratelimit(state))
48 48
49#define __WARN_RATELIMIT(condition, state, format...) \ 49#define WARN_RATELIMIT(condition, format, ...) \
50({ \
51 int rtn = 0; \
52 if (unlikely(__ratelimit(state))) \
53 rtn = WARN(condition, format); \
54 rtn; \
55})
56
57#define WARN_RATELIMIT(condition, format...) \
58({ \ 50({ \
59 static DEFINE_RATELIMIT_STATE(_rs, \ 51 static DEFINE_RATELIMIT_STATE(_rs, \
60 DEFAULT_RATELIMIT_INTERVAL, \ 52 DEFAULT_RATELIMIT_INTERVAL, \
61 DEFAULT_RATELIMIT_BURST); \ 53 DEFAULT_RATELIMIT_BURST); \
62 __WARN_RATELIMIT(condition, &_rs, format); \ 54 int rtn = !!(condition); \
55 \
56 if (unlikely(rtn && __ratelimit(&_rs))) \
57 WARN(rtn, format, ##__VA_ARGS__); \
58 \
59 rtn; \
63}) 60})
64 61
65#else 62#else
@@ -67,15 +64,9 @@ extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
67#define WARN_ON_RATELIMIT(condition, state) \ 64#define WARN_ON_RATELIMIT(condition, state) \
68 WARN_ON(condition) 65 WARN_ON(condition)
69 66
70#define __WARN_RATELIMIT(condition, state, format...) \ 67#define WARN_RATELIMIT(condition, format, ...) \
71({ \
72 int rtn = WARN(condition, format); \
73 rtn; \
74})
75
76#define WARN_RATELIMIT(condition, format...) \
77({ \ 68({ \
78 int rtn = WARN(condition, format); \ 69 int rtn = WARN(condition, format, ##__VA_ARGS__); \
79 rtn; \ 70 rtn; \
80}) 71})
81 72
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index 033b507b33b1..0022c1bb1e26 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -23,72 +23,7 @@
23 I know it's not the cleaner way, but in C (not in C++) to get 23 I know it's not the cleaner way, but in C (not in C++) to get
24 performances and genericity... 24 performances and genericity...
25 25
26 Some example of insert and search follows here. The search is a plain 26 See Documentation/rbtree.txt for documentation and samples.
27 normal search over an ordered tree. The insert instead must be implemented
28 in two steps: First, the code must insert the element in order as a red leaf
29 in the tree, and then the support library function rb_insert_color() must
30 be called. Such function will do the not trivial work to rebalance the
31 rbtree, if necessary.
32
33-----------------------------------------------------------------------
34static inline struct page * rb_search_page_cache(struct inode * inode,
35 unsigned long offset)
36{
37 struct rb_node * n = inode->i_rb_page_cache.rb_node;
38 struct page * page;
39
40 while (n)
41 {
42 page = rb_entry(n, struct page, rb_page_cache);
43
44 if (offset < page->offset)
45 n = n->rb_left;
46 else if (offset > page->offset)
47 n = n->rb_right;
48 else
49 return page;
50 }
51 return NULL;
52}
53
54static inline struct page * __rb_insert_page_cache(struct inode * inode,
55 unsigned long offset,
56 struct rb_node * node)
57{
58 struct rb_node ** p = &inode->i_rb_page_cache.rb_node;
59 struct rb_node * parent = NULL;
60 struct page * page;
61
62 while (*p)
63 {
64 parent = *p;
65 page = rb_entry(parent, struct page, rb_page_cache);
66
67 if (offset < page->offset)
68 p = &(*p)->rb_left;
69 else if (offset > page->offset)
70 p = &(*p)->rb_right;
71 else
72 return page;
73 }
74
75 rb_link_node(node, parent, p);
76
77 return NULL;
78}
79
80static inline struct page * rb_insert_page_cache(struct inode * inode,
81 unsigned long offset,
82 struct rb_node * node)
83{
84 struct page * ret;
85 if ((ret = __rb_insert_page_cache(inode, offset, node)))
86 goto out;
87 rb_insert_color(node, &inode->i_rb_page_cache);
88 out:
89 return ret;
90}
91-----------------------------------------------------------------------
92*/ 27*/
93 28
94#ifndef _LINUX_RBTREE_H 29#ifndef _LINUX_RBTREE_H
@@ -97,63 +32,35 @@ static inline struct page * rb_insert_page_cache(struct inode * inode,
97#include <linux/kernel.h> 32#include <linux/kernel.h>
98#include <linux/stddef.h> 33#include <linux/stddef.h>
99 34
100struct rb_node 35struct rb_node {
101{ 36 unsigned long __rb_parent_color;
102 unsigned long rb_parent_color;
103#define RB_RED 0
104#define RB_BLACK 1
105 struct rb_node *rb_right; 37 struct rb_node *rb_right;
106 struct rb_node *rb_left; 38 struct rb_node *rb_left;
107} __attribute__((aligned(sizeof(long)))); 39} __attribute__((aligned(sizeof(long))));
108 /* The alignment might seem pointless, but allegedly CRIS needs it */ 40 /* The alignment might seem pointless, but allegedly CRIS needs it */
109 41
110struct rb_root 42struct rb_root {
111{
112 struct rb_node *rb_node; 43 struct rb_node *rb_node;
113}; 44};
114 45
115 46
116#define rb_parent(r) ((struct rb_node *)((r)->rb_parent_color & ~3)) 47#define rb_parent(r) ((struct rb_node *)((r)->__rb_parent_color & ~3))
117#define rb_color(r) ((r)->rb_parent_color & 1)
118#define rb_is_red(r) (!rb_color(r))
119#define rb_is_black(r) rb_color(r)
120#define rb_set_red(r) do { (r)->rb_parent_color &= ~1; } while (0)
121#define rb_set_black(r) do { (r)->rb_parent_color |= 1; } while (0)
122
123static inline void rb_set_parent(struct rb_node *rb, struct rb_node *p)
124{
125 rb->rb_parent_color = (rb->rb_parent_color & 3) | (unsigned long)p;
126}
127static inline void rb_set_color(struct rb_node *rb, int color)
128{
129 rb->rb_parent_color = (rb->rb_parent_color & ~1) | color;
130}
131 48
132#define RB_ROOT (struct rb_root) { NULL, } 49#define RB_ROOT (struct rb_root) { NULL, }
133#define rb_entry(ptr, type, member) container_of(ptr, type, member) 50#define rb_entry(ptr, type, member) container_of(ptr, type, member)
134 51
135#define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL) 52#define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL)
136#define RB_EMPTY_NODE(node) (rb_parent(node) == node) 53
137#define RB_CLEAR_NODE(node) (rb_set_parent(node, node)) 54/* 'empty' nodes are nodes that are known not to be inserted in an rbree */
55#define RB_EMPTY_NODE(node) \
56 ((node)->__rb_parent_color == (unsigned long)(node))
57#define RB_CLEAR_NODE(node) \
58 ((node)->__rb_parent_color = (unsigned long)(node))
138 59
139static inline void rb_init_node(struct rb_node *rb)
140{
141 rb->rb_parent_color = 0;
142 rb->rb_right = NULL;
143 rb->rb_left = NULL;
144 RB_CLEAR_NODE(rb);
145}
146 60
147extern void rb_insert_color(struct rb_node *, struct rb_root *); 61extern void rb_insert_color(struct rb_node *, struct rb_root *);
148extern void rb_erase(struct rb_node *, struct rb_root *); 62extern void rb_erase(struct rb_node *, struct rb_root *);
149 63
150typedef void (*rb_augment_f)(struct rb_node *node, void *data);
151
152extern void rb_augment_insert(struct rb_node *node,
153 rb_augment_f func, void *data);
154extern struct rb_node *rb_augment_erase_begin(struct rb_node *node);
155extern void rb_augment_erase_end(struct rb_node *node,
156 rb_augment_f func, void *data);
157 64
158/* Find logical next and previous nodes in a tree */ 65/* Find logical next and previous nodes in a tree */
159extern struct rb_node *rb_next(const struct rb_node *); 66extern struct rb_node *rb_next(const struct rb_node *);
@@ -168,7 +75,7 @@ extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
168static inline void rb_link_node(struct rb_node * node, struct rb_node * parent, 75static inline void rb_link_node(struct rb_node * node, struct rb_node * parent,
169 struct rb_node ** rb_link) 76 struct rb_node ** rb_link)
170{ 77{
171 node->rb_parent_color = (unsigned long )parent; 78 node->__rb_parent_color = (unsigned long)parent;
172 node->rb_left = node->rb_right = NULL; 79 node->rb_left = node->rb_right = NULL;
173 80
174 *rb_link = node; 81 *rb_link = node;
diff --git a/include/linux/rbtree_augmented.h b/include/linux/rbtree_augmented.h
new file mode 100644
index 000000000000..2ac60c9cf644
--- /dev/null
+++ b/include/linux/rbtree_augmented.h
@@ -0,0 +1,224 @@
1/*
2 Red Black Trees
3 (C) 1999 Andrea Arcangeli <andrea@suse.de>
4 (C) 2002 David Woodhouse <dwmw2@infradead.org>
5 (C) 2012 Michel Lespinasse <walken@google.com>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
21 linux/include/linux/rbtree_augmented.h
22*/
23
24#ifndef _LINUX_RBTREE_AUGMENTED_H
25#define _LINUX_RBTREE_AUGMENTED_H
26
27#include <linux/compiler.h>
28#include <linux/rbtree.h>
29
30/*
31 * Please note - only struct rb_augment_callbacks and the prototypes for
32 * rb_insert_augmented() and rb_erase_augmented() are intended to be public.
33 * The rest are implementation details you are not expected to depend on.
34 *
35 * See Documentation/rbtree.txt for documentation and samples.
36 */
37
38struct rb_augment_callbacks {
39 void (*propagate)(struct rb_node *node, struct rb_node *stop);
40 void (*copy)(struct rb_node *old, struct rb_node *new);
41 void (*rotate)(struct rb_node *old, struct rb_node *new);
42};
43
44extern void __rb_insert_augmented(struct rb_node *node, struct rb_root *root,
45 void (*augment_rotate)(struct rb_node *old, struct rb_node *new));
46static inline void
47rb_insert_augmented(struct rb_node *node, struct rb_root *root,
48 const struct rb_augment_callbacks *augment)
49{
50 __rb_insert_augmented(node, root, augment->rotate);
51}
52
53#define RB_DECLARE_CALLBACKS(rbstatic, rbname, rbstruct, rbfield, \
54 rbtype, rbaugmented, rbcompute) \
55static inline void \
56rbname ## _propagate(struct rb_node *rb, struct rb_node *stop) \
57{ \
58 while (rb != stop) { \
59 rbstruct *node = rb_entry(rb, rbstruct, rbfield); \
60 rbtype augmented = rbcompute(node); \
61 if (node->rbaugmented == augmented) \
62 break; \
63 node->rbaugmented = augmented; \
64 rb = rb_parent(&node->rbfield); \
65 } \
66} \
67static inline void \
68rbname ## _copy(struct rb_node *rb_old, struct rb_node *rb_new) \
69{ \
70 rbstruct *old = rb_entry(rb_old, rbstruct, rbfield); \
71 rbstruct *new = rb_entry(rb_new, rbstruct, rbfield); \
72 new->rbaugmented = old->rbaugmented; \
73} \
74static void \
75rbname ## _rotate(struct rb_node *rb_old, struct rb_node *rb_new) \
76{ \
77 rbstruct *old = rb_entry(rb_old, rbstruct, rbfield); \
78 rbstruct *new = rb_entry(rb_new, rbstruct, rbfield); \
79 new->rbaugmented = old->rbaugmented; \
80 old->rbaugmented = rbcompute(old); \
81} \
82rbstatic const struct rb_augment_callbacks rbname = { \
83 rbname ## _propagate, rbname ## _copy, rbname ## _rotate \
84};
85
86
87#define RB_RED 0
88#define RB_BLACK 1
89
90#define __rb_parent(pc) ((struct rb_node *)(pc & ~3))
91
92#define __rb_color(pc) ((pc) & 1)
93#define __rb_is_black(pc) __rb_color(pc)
94#define __rb_is_red(pc) (!__rb_color(pc))
95#define rb_color(rb) __rb_color((rb)->__rb_parent_color)
96#define rb_is_red(rb) __rb_is_red((rb)->__rb_parent_color)
97#define rb_is_black(rb) __rb_is_black((rb)->__rb_parent_color)
98
99static inline void rb_set_parent(struct rb_node *rb, struct rb_node *p)
100{
101 rb->__rb_parent_color = rb_color(rb) | (unsigned long)p;
102}
103
104static inline void rb_set_parent_color(struct rb_node *rb,
105 struct rb_node *p, int color)
106{
107 rb->__rb_parent_color = (unsigned long)p | color;
108}
109
110static inline void
111__rb_change_child(struct rb_node *old, struct rb_node *new,
112 struct rb_node *parent, struct rb_root *root)
113{
114 if (parent) {
115 if (parent->rb_left == old)
116 parent->rb_left = new;
117 else
118 parent->rb_right = new;
119 } else
120 root->rb_node = new;
121}
122
123extern void __rb_erase_color(struct rb_node *parent, struct rb_root *root,
124 void (*augment_rotate)(struct rb_node *old, struct rb_node *new));
125
126static __always_inline void
127rb_erase_augmented(struct rb_node *node, struct rb_root *root,
128 const struct rb_augment_callbacks *augment)
129{
130 struct rb_node *child = node->rb_right, *tmp = node->rb_left;
131 struct rb_node *parent, *rebalance;
132 unsigned long pc;
133
134 if (!tmp) {
135 /*
136 * Case 1: node to erase has no more than 1 child (easy!)
137 *
138 * Note that if there is one child it must be red due to 5)
139 * and node must be black due to 4). We adjust colors locally
140 * so as to bypass __rb_erase_color() later on.
141 */
142 pc = node->__rb_parent_color;
143 parent = __rb_parent(pc);
144 __rb_change_child(node, child, parent, root);
145 if (child) {
146 child->__rb_parent_color = pc;
147 rebalance = NULL;
148 } else
149 rebalance = __rb_is_black(pc) ? parent : NULL;
150 tmp = parent;
151 } else if (!child) {
152 /* Still case 1, but this time the child is node->rb_left */
153 tmp->__rb_parent_color = pc = node->__rb_parent_color;
154 parent = __rb_parent(pc);
155 __rb_change_child(node, tmp, parent, root);
156 rebalance = NULL;
157 tmp = parent;
158 } else {
159 struct rb_node *successor = child, *child2;
160 tmp = child->rb_left;
161 if (!tmp) {
162 /*
163 * Case 2: node's successor is its right child
164 *
165 * (n) (s)
166 * / \ / \
167 * (x) (s) -> (x) (c)
168 * \
169 * (c)
170 */
171 parent = successor;
172 child2 = successor->rb_right;
173 augment->copy(node, successor);
174 } else {
175 /*
176 * Case 3: node's successor is leftmost under
177 * node's right child subtree
178 *
179 * (n) (s)
180 * / \ / \
181 * (x) (y) -> (x) (y)
182 * / /
183 * (p) (p)
184 * / /
185 * (s) (c)
186 * \
187 * (c)
188 */
189 do {
190 parent = successor;
191 successor = tmp;
192 tmp = tmp->rb_left;
193 } while (tmp);
194 parent->rb_left = child2 = successor->rb_right;
195 successor->rb_right = child;
196 rb_set_parent(child, successor);
197 augment->copy(node, successor);
198 augment->propagate(parent, successor);
199 }
200
201 successor->rb_left = tmp = node->rb_left;
202 rb_set_parent(tmp, successor);
203
204 pc = node->__rb_parent_color;
205 tmp = __rb_parent(pc);
206 __rb_change_child(node, successor, tmp, root);
207 if (child2) {
208 successor->__rb_parent_color = pc;
209 rb_set_parent_color(child2, parent, RB_BLACK);
210 rebalance = NULL;
211 } else {
212 unsigned long pc2 = successor->__rb_parent_color;
213 successor->__rb_parent_color = pc;
214 rebalance = __rb_is_black(pc2) ? parent : NULL;
215 }
216 tmp = successor;
217 }
218
219 augment->propagate(tmp, NULL);
220 if (rebalance)
221 __rb_erase_color(rebalance, root, augment->rotate);
222}
223
224#endif /* _LINUX_RBTREE_AUGMENTED_H */
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index e0879a70e830..23b36304cd88 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -1,43 +1,9 @@
1#ifndef _LINUX_REBOOT_H 1#ifndef _LINUX_REBOOT_H
2#define _LINUX_REBOOT_H 2#define _LINUX_REBOOT_H
3 3
4/*
5 * Magic values required to use _reboot() system call.
6 */
7
8#define LINUX_REBOOT_MAGIC1 0xfee1dead
9#define LINUX_REBOOT_MAGIC2 672274793
10#define LINUX_REBOOT_MAGIC2A 85072278
11#define LINUX_REBOOT_MAGIC2B 369367448
12#define LINUX_REBOOT_MAGIC2C 537993216
13
14
15/*
16 * Commands accepted by the _reboot() system call.
17 *
18 * RESTART Restart system using default command and mode.
19 * HALT Stop OS and give system control to ROM monitor, if any.
20 * CAD_ON Ctrl-Alt-Del sequence causes RESTART command.
21 * CAD_OFF Ctrl-Alt-Del sequence sends SIGINT to init task.
22 * POWER_OFF Stop OS and remove all power from system, if possible.
23 * RESTART2 Restart system using given command string.
24 * SW_SUSPEND Suspend system using software suspend if compiled in.
25 * KEXEC Restart system using a previously loaded Linux kernel
26 */
27
28#define LINUX_REBOOT_CMD_RESTART 0x01234567
29#define LINUX_REBOOT_CMD_HALT 0xCDEF0123
30#define LINUX_REBOOT_CMD_CAD_ON 0x89ABCDEF
31#define LINUX_REBOOT_CMD_CAD_OFF 0x00000000
32#define LINUX_REBOOT_CMD_POWER_OFF 0x4321FEDC
33#define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4
34#define LINUX_REBOOT_CMD_SW_SUSPEND 0xD000FCE2
35#define LINUX_REBOOT_CMD_KEXEC 0x45584543
36
37
38#ifdef __KERNEL__
39 4
40#include <linux/notifier.h> 5#include <linux/notifier.h>
6#include <uapi/linux/reboot.h>
41 7
42#define SYS_DOWN 0x0001 /* Notify of system down */ 8#define SYS_DOWN 0x0001 /* Notify of system down */
43#define SYS_RESTART SYS_DOWN 9#define SYS_RESTART SYS_DOWN
@@ -84,6 +50,4 @@ extern int orderly_poweroff(bool force);
84extern void emergency_restart(void); 50extern void emergency_restart(void);
85#include <asm/emergency-restart.h> 51#include <asm/emergency-restart.h>
86 52
87#endif
88
89#endif /* _LINUX_REBOOT_H */ 53#endif /* _LINUX_REBOOT_H */
diff --git a/include/linux/resource.h b/include/linux/resource.h
index d01c96c1966e..5bc3116e649c 100644
--- a/include/linux/resource.h
+++ b/include/linux/resource.h
@@ -1,82 +1,8 @@
1#ifndef _LINUX_RESOURCE_H 1#ifndef _LINUX_RESOURCE_H
2#define _LINUX_RESOURCE_H 2#define _LINUX_RESOURCE_H
3 3
4#include <linux/time.h> 4#include <uapi/linux/resource.h>
5#include <linux/types.h>
6 5
7/*
8 * Resource control/accounting header file for linux
9 */
10
11/*
12 * Definition of struct rusage taken from BSD 4.3 Reno
13 *
14 * We don't support all of these yet, but we might as well have them....
15 * Otherwise, each time we add new items, programs which depend on this
16 * structure will lose. This reduces the chances of that happening.
17 */
18#define RUSAGE_SELF 0
19#define RUSAGE_CHILDREN (-1)
20#define RUSAGE_BOTH (-2) /* sys_wait4() uses this */
21#define RUSAGE_THREAD 1 /* only the calling thread */
22
23struct rusage {
24 struct timeval ru_utime; /* user time used */
25 struct timeval ru_stime; /* system time used */
26 long ru_maxrss; /* maximum resident set size */
27 long ru_ixrss; /* integral shared memory size */
28 long ru_idrss; /* integral unshared data size */
29 long ru_isrss; /* integral unshared stack size */
30 long ru_minflt; /* page reclaims */
31 long ru_majflt; /* page faults */
32 long ru_nswap; /* swaps */
33 long ru_inblock; /* block input operations */
34 long ru_oublock; /* block output operations */
35 long ru_msgsnd; /* messages sent */
36 long ru_msgrcv; /* messages received */
37 long ru_nsignals; /* signals received */
38 long ru_nvcsw; /* voluntary context switches */
39 long ru_nivcsw; /* involuntary " */
40};
41
42struct rlimit {
43 unsigned long rlim_cur;
44 unsigned long rlim_max;
45};
46
47#define RLIM64_INFINITY (~0ULL)
48
49struct rlimit64 {
50 __u64 rlim_cur;
51 __u64 rlim_max;
52};
53
54#define PRIO_MIN (-20)
55#define PRIO_MAX 20
56
57#define PRIO_PROCESS 0
58#define PRIO_PGRP 1
59#define PRIO_USER 2
60
61/*
62 * Limit the stack by to some sane default: root can always
63 * increase this limit if needed.. 8MB seems reasonable.
64 */
65#define _STK_LIM (8*1024*1024)
66
67/*
68 * GPG2 wants 64kB of mlocked memory, to make sure pass phrases
69 * and other sensitive information are never written to disk.
70 */
71#define MLOCK_LIMIT ((PAGE_SIZE > 64*1024) ? PAGE_SIZE : 64*1024)
72
73/*
74 * Due to binary compatibility, the actual resource numbers
75 * may be different for different linux versions..
76 */
77#include <asm/resource.h>
78
79#ifdef __KERNEL__
80 6
81struct task_struct; 7struct task_struct;
82 8
@@ -84,6 +10,4 @@ int getrusage(struct task_struct *p, int who, struct rusage __user *ru);
84int do_prlimit(struct task_struct *tsk, unsigned int resource, 10int do_prlimit(struct task_struct *tsk, unsigned int resource,
85 struct rlimit *new_rlim, struct rlimit *old_rlim); 11 struct rlimit *new_rlim, struct rlimit *old_rlim);
86 12
87#endif /* __KERNEL__ */
88
89#endif 13#endif
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 0ec590bb3611..d9010789b4e8 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -1,6 +1,3 @@
1#ifndef __RFKILL_H
2#define __RFKILL_H
3
4/* 1/*
5 * Copyright (C) 2006 - 2007 Ivo van Doorn 2 * Copyright (C) 2006 - 2007 Ivo van Doorn
6 * Copyright (C) 2007 Dmitry Torokhov 3 * Copyright (C) 2007 Dmitry Torokhov
@@ -18,92 +15,11 @@
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 */ 17 */
18#ifndef __RFKILL_H
19#define __RFKILL_H
21 20
22#include <linux/types.h> 21#include <uapi/linux/rfkill.h>
23
24/* define userspace visible states */
25#define RFKILL_STATE_SOFT_BLOCKED 0
26#define RFKILL_STATE_UNBLOCKED 1
27#define RFKILL_STATE_HARD_BLOCKED 2
28
29/**
30 * enum rfkill_type - type of rfkill switch.
31 *
32 * @RFKILL_TYPE_ALL: toggles all switches (requests only - not a switch type)
33 * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device.
34 * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device.
35 * @RFKILL_TYPE_UWB: switch is on a ultra wideband device.
36 * @RFKILL_TYPE_WIMAX: switch is on a WiMAX device.
37 * @RFKILL_TYPE_WWAN: switch is on a wireless WAN device.
38 * @RFKILL_TYPE_GPS: switch is on a GPS device.
39 * @RFKILL_TYPE_FM: switch is on a FM radio device.
40 * @NUM_RFKILL_TYPES: number of defined rfkill types
41 */
42enum rfkill_type {
43 RFKILL_TYPE_ALL = 0,
44 RFKILL_TYPE_WLAN,
45 RFKILL_TYPE_BLUETOOTH,
46 RFKILL_TYPE_UWB,
47 RFKILL_TYPE_WIMAX,
48 RFKILL_TYPE_WWAN,
49 RFKILL_TYPE_GPS,
50 RFKILL_TYPE_FM,
51 NUM_RFKILL_TYPES,
52};
53
54/**
55 * enum rfkill_operation - operation types
56 * @RFKILL_OP_ADD: a device was added
57 * @RFKILL_OP_DEL: a device was removed
58 * @RFKILL_OP_CHANGE: a device's state changed -- userspace changes one device
59 * @RFKILL_OP_CHANGE_ALL: userspace changes all devices (of a type, or all)
60 */
61enum rfkill_operation {
62 RFKILL_OP_ADD = 0,
63 RFKILL_OP_DEL,
64 RFKILL_OP_CHANGE,
65 RFKILL_OP_CHANGE_ALL,
66};
67
68/**
69 * struct rfkill_event - events for userspace on /dev/rfkill
70 * @idx: index of dev rfkill
71 * @type: type of the rfkill struct
72 * @op: operation code
73 * @hard: hard state (0/1)
74 * @soft: soft state (0/1)
75 *
76 * Structure used for userspace communication on /dev/rfkill,
77 * used for events from the kernel and control to the kernel.
78 */
79struct rfkill_event {
80 __u32 idx;
81 __u8 type;
82 __u8 op;
83 __u8 soft, hard;
84} __attribute__((packed));
85
86/*
87 * We are planning to be backward and forward compatible with changes
88 * to the event struct, by adding new, optional, members at the end.
89 * When reading an event (whether the kernel from userspace or vice
90 * versa) we need to accept anything that's at least as large as the
91 * version 1 event size, but might be able to accept other sizes in
92 * the future.
93 *
94 * One exception is the kernel -- we already have two event sizes in
95 * that we've made the 'hard' member optional since our only option
96 * is to ignore it anyway.
97 */
98#define RFKILL_EVENT_SIZE_V1 8
99
100/* ioctl for turning off rfkill-input (if present) */
101#define RFKILL_IOC_MAGIC 'R'
102#define RFKILL_IOC_NOINPUT 1
103#define RFKILL_IOCTL_NOINPUT _IO(RFKILL_IOC_MAGIC, RFKILL_IOC_NOINPUT)
104 22
105/* and that's all userspace gets */
106#ifdef __KERNEL__
107/* don't allow anyone to use these in the kernel */ 23/* don't allow anyone to use these in the kernel */
108enum rfkill_user_states { 24enum rfkill_user_states {
109 RFKILL_USER_STATE_SOFT_BLOCKED = RFKILL_STATE_SOFT_BLOCKED, 25 RFKILL_USER_STATE_SOFT_BLOCKED = RFKILL_STATE_SOFT_BLOCKED,
@@ -385,6 +301,4 @@ rfkill_set_led_trigger_name(struct rfkill *rfkill, const char *name)
385} 301}
386#endif 302#endif
387 303
388#endif /* __KERNEL__ */
389
390#endif /* RFKILL_H */ 304#endif /* RFKILL_H */
diff --git a/include/linux/rio.h b/include/linux/rio.h
index a90ebadd9da0..4187da511006 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -30,6 +30,7 @@
30#define RIO_MAX_MPORTS 8 30#define RIO_MAX_MPORTS 8
31#define RIO_MAX_MPORT_RESOURCES 16 31#define RIO_MAX_MPORT_RESOURCES 16
32#define RIO_MAX_DEV_RESOURCES 16 32#define RIO_MAX_DEV_RESOURCES 16
33#define RIO_MAX_MPORT_NAME 40
33 34
34#define RIO_GLOBAL_TABLE 0xff /* Indicates access of a switch's 35#define RIO_GLOBAL_TABLE 0xff /* Indicates access of a switch's
35 global routing table if it 36 global routing table if it
@@ -62,7 +63,7 @@
62 * 63 *
63 * 0 RapidIO inbound doorbells 64 * 0 RapidIO inbound doorbells
64 * 1 RapidIO inbound mailboxes 65 * 1 RapidIO inbound mailboxes
65 * 1 RapidIO outbound mailboxes 66 * 2 RapidIO outbound mailboxes
66 */ 67 */
67#define RIO_DOORBELL_RESOURCE 0 68#define RIO_DOORBELL_RESOURCE 0
68#define RIO_INB_MBOX_RESOURCE 1 69#define RIO_INB_MBOX_RESOURCE 1
@@ -235,6 +236,7 @@ enum rio_phy_type {
235 * @phys_efptr: RIO port extended features pointer 236 * @phys_efptr: RIO port extended features pointer
236 * @name: Port name string 237 * @name: Port name string
237 * @priv: Master port private data 238 * @priv: Master port private data
239 * @dma: DMA device associated with mport
238 */ 240 */
239struct rio_mport { 241struct rio_mport {
240 struct list_head dbells; /* list of doorbell events */ 242 struct list_head dbells; /* list of doorbell events */
@@ -255,13 +257,20 @@ struct rio_mport {
255 */ 257 */
256 enum rio_phy_type phy_type; /* RapidIO phy type */ 258 enum rio_phy_type phy_type; /* RapidIO phy type */
257 u32 phys_efptr; 259 u32 phys_efptr;
258 unsigned char name[40]; 260 unsigned char name[RIO_MAX_MPORT_NAME];
259 void *priv; /* Master port private data */ 261 void *priv; /* Master port private data */
260#ifdef CONFIG_RAPIDIO_DMA_ENGINE 262#ifdef CONFIG_RAPIDIO_DMA_ENGINE
261 struct dma_device dma; 263 struct dma_device dma;
262#endif 264#endif
263}; 265};
264 266
267struct rio_id_table {
268 u16 start; /* logical minimal id */
269 u32 max; /* max number of IDs in table */
270 spinlock_t lock;
271 unsigned long *table;
272};
273
265/** 274/**
266 * struct rio_net - RIO network info 275 * struct rio_net - RIO network info
267 * @node: Node in global list of RIO networks 276 * @node: Node in global list of RIO networks
@@ -273,9 +282,11 @@ struct rio_mport {
273struct rio_net { 282struct rio_net {
274 struct list_head node; /* node in list of networks */ 283 struct list_head node; /* node in list of networks */
275 struct list_head devices; /* list of devices in this net */ 284 struct list_head devices; /* list of devices in this net */
285 struct list_head switches; /* list of switches in this net */
276 struct list_head mports; /* list of ports accessing net */ 286 struct list_head mports; /* list of ports accessing net */
277 struct rio_mport *hport; /* primary port for accessing net */ 287 struct rio_mport *hport; /* primary port for accessing net */
278 unsigned char id; /* RIO network ID */ 288 unsigned char id; /* RIO network ID */
289 struct rio_id_table destid_table; /* destID allocation table */
279}; 290};
280 291
281/* Definitions used by switch sysfs initialization callback */ 292/* Definitions used by switch sysfs initialization callback */
@@ -299,6 +310,8 @@ struct rio_net {
299 * @add_outb_message: Callback to add a message to an outbound mailbox queue. 310 * @add_outb_message: Callback to add a message to an outbound mailbox queue.
300 * @add_inb_buffer: Callback to add a buffer to an inbound mailbox queue. 311 * @add_inb_buffer: Callback to add a buffer to an inbound mailbox queue.
301 * @get_inb_message: Callback to get a message from an inbound mailbox queue. 312 * @get_inb_message: Callback to get a message from an inbound mailbox queue.
313 * @map_inb: Callback to map RapidIO address region into local memory space.
314 * @unmap_inb: Callback to unmap RapidIO address region mapped with map_inb().
302 */ 315 */
303struct rio_ops { 316struct rio_ops {
304 int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len, 317 int (*lcread) (struct rio_mport *mport, int index, u32 offset, int len,
@@ -321,6 +334,9 @@ struct rio_ops {
321 int mbox, void *buffer, size_t len); 334 int mbox, void *buffer, size_t len);
322 int (*add_inb_buffer)(struct rio_mport *mport, int mbox, void *buf); 335 int (*add_inb_buffer)(struct rio_mport *mport, int mbox, void *buf);
323 void *(*get_inb_message)(struct rio_mport *mport, int mbox); 336 void *(*get_inb_message)(struct rio_mport *mport, int mbox);
337 int (*map_inb)(struct rio_mport *mport, dma_addr_t lstart,
338 u64 rstart, u32 size, u32 flags);
339 void (*unmap_inb)(struct rio_mport *mport, dma_addr_t lstart);
324}; 340};
325 341
326#define RIO_RESOURCE_MEM 0x00000100 342#define RIO_RESOURCE_MEM 0x00000100
@@ -403,7 +419,7 @@ union rio_pw_msg {
403 419
404#ifdef CONFIG_RAPIDIO_DMA_ENGINE 420#ifdef CONFIG_RAPIDIO_DMA_ENGINE
405 421
406/** 422/*
407 * enum rio_write_type - RIO write transaction types used in DMA transfers 423 * enum rio_write_type - RIO write transaction types used in DMA transfers
408 * 424 *
409 * Note: RapidIO specification defines write (NWRITE) and 425 * Note: RapidIO specification defines write (NWRITE) and
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index 31ad146be316..b75c05920ab5 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -365,6 +365,11 @@ void rio_release_regions(struct rio_dev *);
365int rio_request_region(struct rio_dev *, int, char *); 365int rio_request_region(struct rio_dev *, int, char *);
366void rio_release_region(struct rio_dev *, int); 366void rio_release_region(struct rio_dev *, int);
367 367
368/* Memory mapping functions */
369extern int rio_map_inb_region(struct rio_mport *mport, dma_addr_t local,
370 u64 rbase, u32 size, u32 rflags);
371extern void rio_unmap_inb_region(struct rio_mport *mport, dma_addr_t lstart);
372
368/* Port-Write management */ 373/* Port-Write management */
369extern int rio_request_inb_pwrite(struct rio_dev *, 374extern int rio_request_inb_pwrite(struct rio_dev *,
370 int (*)(struct rio_dev *, union rio_pw_msg*, int)); 375 int (*)(struct rio_dev *, union rio_pw_msg*, int));
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 3fce545df394..bfe1f4780644 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -37,14 +37,14 @@ struct anon_vma {
37 atomic_t refcount; 37 atomic_t refcount;
38 38
39 /* 39 /*
40 * NOTE: the LSB of the head.next is set by 40 * NOTE: the LSB of the rb_root.rb_node is set by
41 * mm_take_all_locks() _after_ taking the above lock. So the 41 * mm_take_all_locks() _after_ taking the above lock. So the
42 * head must only be read/written after taking the above lock 42 * rb_root must only be read/written after taking the above lock
43 * to be sure to see a valid next pointer. The LSB bit itself 43 * to be sure to see a valid next pointer. The LSB bit itself
44 * is serialized by a system wide lock only visible to 44 * is serialized by a system wide lock only visible to
45 * mm_take_all_locks() (mm_all_locks_mutex). 45 * mm_take_all_locks() (mm_all_locks_mutex).
46 */ 46 */
47 struct list_head head; /* Chain of private "related" vmas */ 47 struct rb_root rb_root; /* Interval tree of private "related" vmas */
48}; 48};
49 49
50/* 50/*
@@ -57,14 +57,29 @@ struct anon_vma {
57 * with a VMA, or the VMAs associated with an anon_vma. 57 * with a VMA, or the VMAs associated with an anon_vma.
58 * The "same_vma" list contains the anon_vma_chains linking 58 * The "same_vma" list contains the anon_vma_chains linking
59 * all the anon_vmas associated with this VMA. 59 * all the anon_vmas associated with this VMA.
60 * The "same_anon_vma" list contains the anon_vma_chains 60 * The "rb" field indexes on an interval tree the anon_vma_chains
61 * which link all the VMAs associated with this anon_vma. 61 * which link all the VMAs associated with this anon_vma.
62 */ 62 */
63struct anon_vma_chain { 63struct anon_vma_chain {
64 struct vm_area_struct *vma; 64 struct vm_area_struct *vma;
65 struct anon_vma *anon_vma; 65 struct anon_vma *anon_vma;
66 struct list_head same_vma; /* locked by mmap_sem & page_table_lock */ 66 struct list_head same_vma; /* locked by mmap_sem & page_table_lock */
67 struct list_head same_anon_vma; /* locked by anon_vma->mutex */ 67 struct rb_node rb; /* locked by anon_vma->mutex */
68 unsigned long rb_subtree_last;
69#ifdef CONFIG_DEBUG_VM_RB
70 unsigned long cached_vma_start, cached_vma_last;
71#endif
72};
73
74enum ttu_flags {
75 TTU_UNMAP = 0, /* unmap mode */
76 TTU_MIGRATION = 1, /* migration mode */
77 TTU_MUNLOCK = 2, /* munlock mode */
78 TTU_ACTION_MASK = 0xff,
79
80 TTU_IGNORE_MLOCK = (1 << 8), /* ignore mlock */
81 TTU_IGNORE_ACCESS = (1 << 9), /* don't age */
82 TTU_IGNORE_HWPOISON = (1 << 10),/* corrupted page is recoverable */
68}; 83};
69 84
70#ifdef CONFIG_MMU 85#ifdef CONFIG_MMU
@@ -120,7 +135,6 @@ void anon_vma_init(void); /* create anon_vma_cachep */
120int anon_vma_prepare(struct vm_area_struct *); 135int anon_vma_prepare(struct vm_area_struct *);
121void unlink_anon_vmas(struct vm_area_struct *); 136void unlink_anon_vmas(struct vm_area_struct *);
122int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *); 137int anon_vma_clone(struct vm_area_struct *, struct vm_area_struct *);
123void anon_vma_moveto_tail(struct vm_area_struct *);
124int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *); 138int anon_vma_fork(struct vm_area_struct *, struct vm_area_struct *);
125 139
126static inline void anon_vma_merge(struct vm_area_struct *vma, 140static inline void anon_vma_merge(struct vm_area_struct *vma,
@@ -161,16 +175,6 @@ int page_referenced(struct page *, int is_locked,
161int page_referenced_one(struct page *, struct vm_area_struct *, 175int page_referenced_one(struct page *, struct vm_area_struct *,
162 unsigned long address, unsigned int *mapcount, unsigned long *vm_flags); 176 unsigned long address, unsigned int *mapcount, unsigned long *vm_flags);
163 177
164enum ttu_flags {
165 TTU_UNMAP = 0, /* unmap mode */
166 TTU_MIGRATION = 1, /* migration mode */
167 TTU_MUNLOCK = 2, /* munlock mode */
168 TTU_ACTION_MASK = 0xff,
169
170 TTU_IGNORE_MLOCK = (1 << 8), /* ignore mlock */
171 TTU_IGNORE_ACCESS = (1 << 9), /* don't age */
172 TTU_IGNORE_HWPOISON = (1 << 10),/* corrupted page is recoverable */
173};
174#define TTU_ACTION(x) ((x) & TTU_ACTION_MASK) 178#define TTU_ACTION(x) ((x) & TTU_ACTION_MASK)
175 179
176int try_to_unmap(struct page *, enum ttu_flags flags); 180int try_to_unmap(struct page *, enum ttu_flags flags);
diff --git a/include/linux/rtc-ds2404.h b/include/linux/rtc-ds2404.h
new file mode 100644
index 000000000000..22c53825528f
--- /dev/null
+++ b/include/linux/rtc-ds2404.h
@@ -0,0 +1,20 @@
1/*
2 * ds2404.h - platform data structure for the DS2404 RTC.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2012 Sven Schnelle <svens@stackframe.org>
9 */
10
11#ifndef __LINUX_DS2404_H
12#define __LINUX_DS2404_H
13
14struct ds2404_platform_data {
15
16 unsigned int gpio_rst;
17 unsigned int gpio_clk;
18 unsigned int gpio_dq;
19};
20#endif
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index f071b3922c67..9531845c419f 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -11,102 +11,10 @@
11#ifndef _LINUX_RTC_H_ 11#ifndef _LINUX_RTC_H_
12#define _LINUX_RTC_H_ 12#define _LINUX_RTC_H_
13 13
14/*
15 * The struct used to pass data via the following ioctl. Similar to the
16 * struct tm in <time.h>, but it needs to be here so that the kernel
17 * source is self contained, allowing cross-compiles, etc. etc.
18 */
19
20struct rtc_time {
21 int tm_sec;
22 int tm_min;
23 int tm_hour;
24 int tm_mday;
25 int tm_mon;
26 int tm_year;
27 int tm_wday;
28 int tm_yday;
29 int tm_isdst;
30};
31
32/*
33 * This data structure is inspired by the EFI (v0.92) wakeup
34 * alarm API.
35 */
36struct rtc_wkalrm {
37 unsigned char enabled; /* 0 = alarm disabled, 1 = alarm enabled */
38 unsigned char pending; /* 0 = alarm not pending, 1 = alarm pending */
39 struct rtc_time time; /* time the alarm is set to */
40};
41
42/*
43 * Data structure to control PLL correction some better RTC feature
44 * pll_value is used to get or set current value of correction,
45 * the rest of the struct is used to query HW capabilities.
46 * This is modeled after the RTC used in Q40/Q60 computers but
47 * should be sufficiently flexible for other devices
48 *
49 * +ve pll_value means clock will run faster by
50 * pll_value*pll_posmult/pll_clock
51 * -ve pll_value means clock will run slower by
52 * pll_value*pll_negmult/pll_clock
53 */
54
55struct rtc_pll_info {
56 int pll_ctrl; /* placeholder for fancier control */
57 int pll_value; /* get/set correction value */
58 int pll_max; /* max +ve (faster) adjustment value */
59 int pll_min; /* max -ve (slower) adjustment value */
60 int pll_posmult; /* factor for +ve correction */
61 int pll_negmult; /* factor for -ve correction */
62 long pll_clock; /* base PLL frequency */
63};
64
65/*
66 * ioctl calls that are permitted to the /dev/rtc interface, if
67 * any of the RTC drivers are enabled.
68 */
69
70#define RTC_AIE_ON _IO('p', 0x01) /* Alarm int. enable on */
71#define RTC_AIE_OFF _IO('p', 0x02) /* ... off */
72#define RTC_UIE_ON _IO('p', 0x03) /* Update int. enable on */
73#define RTC_UIE_OFF _IO('p', 0x04) /* ... off */
74#define RTC_PIE_ON _IO('p', 0x05) /* Periodic int. enable on */
75#define RTC_PIE_OFF _IO('p', 0x06) /* ... off */
76#define RTC_WIE_ON _IO('p', 0x0f) /* Watchdog int. enable on */
77#define RTC_WIE_OFF _IO('p', 0x10) /* ... off */
78
79#define RTC_ALM_SET _IOW('p', 0x07, struct rtc_time) /* Set alarm time */
80#define RTC_ALM_READ _IOR('p', 0x08, struct rtc_time) /* Read alarm time */
81#define RTC_RD_TIME _IOR('p', 0x09, struct rtc_time) /* Read RTC time */
82#define RTC_SET_TIME _IOW('p', 0x0a, struct rtc_time) /* Set RTC time */
83#define RTC_IRQP_READ _IOR('p', 0x0b, unsigned long) /* Read IRQ rate */
84#define RTC_IRQP_SET _IOW('p', 0x0c, unsigned long) /* Set IRQ rate */
85#define RTC_EPOCH_READ _IOR('p', 0x0d, unsigned long) /* Read epoch */
86#define RTC_EPOCH_SET _IOW('p', 0x0e, unsigned long) /* Set epoch */
87
88#define RTC_WKALM_SET _IOW('p', 0x0f, struct rtc_wkalrm)/* Set wakeup alarm*/
89#define RTC_WKALM_RD _IOR('p', 0x10, struct rtc_wkalrm)/* Get wakeup alarm*/
90
91#define RTC_PLL_GET _IOR('p', 0x11, struct rtc_pll_info) /* Get PLL correction */
92#define RTC_PLL_SET _IOW('p', 0x12, struct rtc_pll_info) /* Set PLL correction */
93
94#define RTC_VL_READ _IOR('p', 0x13, int) /* Voltage low detector */
95#define RTC_VL_CLR _IO('p', 0x14) /* Clear voltage low information */
96
97/* interrupt flags */
98#define RTC_IRQF 0x80 /* Any of the following is active */
99#define RTC_PF 0x40 /* Periodic interrupt */
100#define RTC_AF 0x20 /* Alarm interrupt */
101#define RTC_UF 0x10 /* Update interrupt for 1Hz RTC */
102
103
104#define RTC_MAX_FREQ 8192
105
106#ifdef __KERNEL__
107 14
108#include <linux/types.h> 15#include <linux/types.h>
109#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <uapi/linux/rtc.h>
110 18
111extern int rtc_month_days(unsigned int month, unsigned int year); 19extern int rtc_month_days(unsigned int month, unsigned int year);
112extern int rtc_year_days(unsigned int day, unsigned int month, unsigned int year); 20extern int rtc_year_days(unsigned int day, unsigned int month, unsigned int year);
@@ -276,12 +184,10 @@ static inline bool is_leap_year(unsigned int year)
276 return (!(year % 4) && (year % 100)) || !(year % 400); 184 return (!(year % 4) && (year % 100)) || !(year % 400);
277} 185}
278 186
279#ifdef CONFIG_RTC_HCTOSYS 187#ifdef CONFIG_RTC_HCTOSYS_DEVICE
280extern int rtc_hctosys_ret; 188extern int rtc_hctosys_ret;
281#else 189#else
282#define rtc_hctosys_ret -ENODEV 190#define rtc_hctosys_ret -ENODEV
283#endif 191#endif
284 192
285#endif /* __KERNEL__ */
286
287#endif /* _LINUX_RTC_H_ */ 193#endif /* _LINUX_RTC_H_ */
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index db71c4ad8624..7002bbfd5d4a 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -1,616 +1,10 @@
1#ifndef __LINUX_RTNETLINK_H 1#ifndef __LINUX_RTNETLINK_H
2#define __LINUX_RTNETLINK_H 2#define __LINUX_RTNETLINK_H
3 3
4#include <linux/types.h>
5#include <linux/netlink.h>
6#include <linux/if_link.h>
7#include <linux/if_addr.h>
8#include <linux/neighbour.h>
9
10/* rtnetlink families. Values up to 127 are reserved for real address
11 * families, values above 128 may be used arbitrarily.
12 */
13#define RTNL_FAMILY_IPMR 128
14#define RTNL_FAMILY_IP6MR 129
15#define RTNL_FAMILY_MAX 129
16
17/****
18 * Routing/neighbour discovery messages.
19 ****/
20
21/* Types of messages */
22
23enum {
24 RTM_BASE = 16,
25#define RTM_BASE RTM_BASE
26
27 RTM_NEWLINK = 16,
28#define RTM_NEWLINK RTM_NEWLINK
29 RTM_DELLINK,
30#define RTM_DELLINK RTM_DELLINK
31 RTM_GETLINK,
32#define RTM_GETLINK RTM_GETLINK
33 RTM_SETLINK,
34#define RTM_SETLINK RTM_SETLINK
35
36 RTM_NEWADDR = 20,
37#define RTM_NEWADDR RTM_NEWADDR
38 RTM_DELADDR,
39#define RTM_DELADDR RTM_DELADDR
40 RTM_GETADDR,
41#define RTM_GETADDR RTM_GETADDR
42
43 RTM_NEWROUTE = 24,
44#define RTM_NEWROUTE RTM_NEWROUTE
45 RTM_DELROUTE,
46#define RTM_DELROUTE RTM_DELROUTE
47 RTM_GETROUTE,
48#define RTM_GETROUTE RTM_GETROUTE
49
50 RTM_NEWNEIGH = 28,
51#define RTM_NEWNEIGH RTM_NEWNEIGH
52 RTM_DELNEIGH,
53#define RTM_DELNEIGH RTM_DELNEIGH
54 RTM_GETNEIGH,
55#define RTM_GETNEIGH RTM_GETNEIGH
56
57 RTM_NEWRULE = 32,
58#define RTM_NEWRULE RTM_NEWRULE
59 RTM_DELRULE,
60#define RTM_DELRULE RTM_DELRULE
61 RTM_GETRULE,
62#define RTM_GETRULE RTM_GETRULE
63
64 RTM_NEWQDISC = 36,
65#define RTM_NEWQDISC RTM_NEWQDISC
66 RTM_DELQDISC,
67#define RTM_DELQDISC RTM_DELQDISC
68 RTM_GETQDISC,
69#define RTM_GETQDISC RTM_GETQDISC
70
71 RTM_NEWTCLASS = 40,
72#define RTM_NEWTCLASS RTM_NEWTCLASS
73 RTM_DELTCLASS,
74#define RTM_DELTCLASS RTM_DELTCLASS
75 RTM_GETTCLASS,
76#define RTM_GETTCLASS RTM_GETTCLASS
77
78 RTM_NEWTFILTER = 44,
79#define RTM_NEWTFILTER RTM_NEWTFILTER
80 RTM_DELTFILTER,
81#define RTM_DELTFILTER RTM_DELTFILTER
82 RTM_GETTFILTER,
83#define RTM_GETTFILTER RTM_GETTFILTER
84
85 RTM_NEWACTION = 48,
86#define RTM_NEWACTION RTM_NEWACTION
87 RTM_DELACTION,
88#define RTM_DELACTION RTM_DELACTION
89 RTM_GETACTION,
90#define RTM_GETACTION RTM_GETACTION
91
92 RTM_NEWPREFIX = 52,
93#define RTM_NEWPREFIX RTM_NEWPREFIX
94
95 RTM_GETMULTICAST = 58,
96#define RTM_GETMULTICAST RTM_GETMULTICAST
97
98 RTM_GETANYCAST = 62,
99#define RTM_GETANYCAST RTM_GETANYCAST
100
101 RTM_NEWNEIGHTBL = 64,
102#define RTM_NEWNEIGHTBL RTM_NEWNEIGHTBL
103 RTM_GETNEIGHTBL = 66,
104#define RTM_GETNEIGHTBL RTM_GETNEIGHTBL
105 RTM_SETNEIGHTBL,
106#define RTM_SETNEIGHTBL RTM_SETNEIGHTBL
107
108 RTM_NEWNDUSEROPT = 68,
109#define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT
110
111 RTM_NEWADDRLABEL = 72,
112#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL
113 RTM_DELADDRLABEL,
114#define RTM_DELADDRLABEL RTM_DELADDRLABEL
115 RTM_GETADDRLABEL,
116#define RTM_GETADDRLABEL RTM_GETADDRLABEL
117
118 RTM_GETDCB = 78,
119#define RTM_GETDCB RTM_GETDCB
120 RTM_SETDCB,
121#define RTM_SETDCB RTM_SETDCB
122
123 __RTM_MAX,
124#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
125};
126
127#define RTM_NR_MSGTYPES (RTM_MAX + 1 - RTM_BASE)
128#define RTM_NR_FAMILIES (RTM_NR_MSGTYPES >> 2)
129#define RTM_FAM(cmd) (((cmd) - RTM_BASE) >> 2)
130
131/*
132 Generic structure for encapsulation of optional route information.
133 It is reminiscent of sockaddr, but with sa_family replaced
134 with attribute type.
135 */
136
137struct rtattr {
138 unsigned short rta_len;
139 unsigned short rta_type;
140};
141
142/* Macros to handle rtattributes */
143
144#define RTA_ALIGNTO 4
145#define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) )
146#define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \
147 (rta)->rta_len >= sizeof(struct rtattr) && \
148 (rta)->rta_len <= (len))
149#define RTA_NEXT(rta,attrlen) ((attrlen) -= RTA_ALIGN((rta)->rta_len), \
150 (struct rtattr*)(((char*)(rta)) + RTA_ALIGN((rta)->rta_len)))
151#define RTA_LENGTH(len) (RTA_ALIGN(sizeof(struct rtattr)) + (len))
152#define RTA_SPACE(len) RTA_ALIGN(RTA_LENGTH(len))
153#define RTA_DATA(rta) ((void*)(((char*)(rta)) + RTA_LENGTH(0)))
154#define RTA_PAYLOAD(rta) ((int)((rta)->rta_len) - RTA_LENGTH(0))
155
156
157
158
159/******************************************************************************
160 * Definitions used in routing table administration.
161 ****/
162
163struct rtmsg {
164 unsigned char rtm_family;
165 unsigned char rtm_dst_len;
166 unsigned char rtm_src_len;
167 unsigned char rtm_tos;
168
169 unsigned char rtm_table; /* Routing table id */
170 unsigned char rtm_protocol; /* Routing protocol; see below */
171 unsigned char rtm_scope; /* See below */
172 unsigned char rtm_type; /* See below */
173
174 unsigned rtm_flags;
175};
176
177/* rtm_type */
178
179enum {
180 RTN_UNSPEC,
181 RTN_UNICAST, /* Gateway or direct route */
182 RTN_LOCAL, /* Accept locally */
183 RTN_BROADCAST, /* Accept locally as broadcast,
184 send as broadcast */
185 RTN_ANYCAST, /* Accept locally as broadcast,
186 but send as unicast */
187 RTN_MULTICAST, /* Multicast route */
188 RTN_BLACKHOLE, /* Drop */
189 RTN_UNREACHABLE, /* Destination is unreachable */
190 RTN_PROHIBIT, /* Administratively prohibited */
191 RTN_THROW, /* Not in this table */
192 RTN_NAT, /* Translate this address */
193 RTN_XRESOLVE, /* Use external resolver */
194 __RTN_MAX
195};
196
197#define RTN_MAX (__RTN_MAX - 1)
198
199
200/* rtm_protocol */
201
202#define RTPROT_UNSPEC 0
203#define RTPROT_REDIRECT 1 /* Route installed by ICMP redirects;
204 not used by current IPv4 */
205#define RTPROT_KERNEL 2 /* Route installed by kernel */
206#define RTPROT_BOOT 3 /* Route installed during boot */
207#define RTPROT_STATIC 4 /* Route installed by administrator */
208
209/* Values of protocol >= RTPROT_STATIC are not interpreted by kernel;
210 they are just passed from user and back as is.
211 It will be used by hypothetical multiple routing daemons.
212 Note that protocol values should be standardized in order to
213 avoid conflicts.
214 */
215
216#define RTPROT_GATED 8 /* Apparently, GateD */
217#define RTPROT_RA 9 /* RDISC/ND router advertisements */
218#define RTPROT_MRT 10 /* Merit MRT */
219#define RTPROT_ZEBRA 11 /* Zebra */
220#define RTPROT_BIRD 12 /* BIRD */
221#define RTPROT_DNROUTED 13 /* DECnet routing daemon */
222#define RTPROT_XORP 14 /* XORP */
223#define RTPROT_NTK 15 /* Netsukuku */
224#define RTPROT_DHCP 16 /* DHCP client */
225
226/* rtm_scope
227
228 Really it is not scope, but sort of distance to the destination.
229 NOWHERE are reserved for not existing destinations, HOST is our
230 local addresses, LINK are destinations, located on directly attached
231 link and UNIVERSE is everywhere in the Universe.
232
233 Intermediate values are also possible f.e. interior routes
234 could be assigned a value between UNIVERSE and LINK.
235*/
236
237enum rt_scope_t {
238 RT_SCOPE_UNIVERSE=0,
239/* User defined values */
240 RT_SCOPE_SITE=200,
241 RT_SCOPE_LINK=253,
242 RT_SCOPE_HOST=254,
243 RT_SCOPE_NOWHERE=255
244};
245
246/* rtm_flags */
247
248#define RTM_F_NOTIFY 0x100 /* Notify user of route change */
249#define RTM_F_CLONED 0x200 /* This route is cloned */
250#define RTM_F_EQUALIZE 0x400 /* Multipath equalizer: NI */
251#define RTM_F_PREFIX 0x800 /* Prefix addresses */
252
253/* Reserved table identifiers */
254
255enum rt_class_t {
256 RT_TABLE_UNSPEC=0,
257/* User defined values */
258 RT_TABLE_COMPAT=252,
259 RT_TABLE_DEFAULT=253,
260 RT_TABLE_MAIN=254,
261 RT_TABLE_LOCAL=255,
262 RT_TABLE_MAX=0xFFFFFFFF
263};
264
265
266/* Routing message attributes */
267
268enum rtattr_type_t {
269 RTA_UNSPEC,
270 RTA_DST,
271 RTA_SRC,
272 RTA_IIF,
273 RTA_OIF,
274 RTA_GATEWAY,
275 RTA_PRIORITY,
276 RTA_PREFSRC,
277 RTA_METRICS,
278 RTA_MULTIPATH,
279 RTA_PROTOINFO, /* no longer used */
280 RTA_FLOW,
281 RTA_CACHEINFO,
282 RTA_SESSION, /* no longer used */
283 RTA_MP_ALGO, /* no longer used */
284 RTA_TABLE,
285 RTA_MARK,
286 __RTA_MAX
287};
288
289#define RTA_MAX (__RTA_MAX - 1)
290
291#define RTM_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg))))
292#define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg))
293
294/* RTM_MULTIPATH --- array of struct rtnexthop.
295 *
296 * "struct rtnexthop" describes all necessary nexthop information,
297 * i.e. parameters of path to a destination via this nexthop.
298 *
299 * At the moment it is impossible to set different prefsrc, mtu, window
300 * and rtt for different paths from multipath.
301 */
302
303struct rtnexthop {
304 unsigned short rtnh_len;
305 unsigned char rtnh_flags;
306 unsigned char rtnh_hops;
307 int rtnh_ifindex;
308};
309
310/* rtnh_flags */
311
312#define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */
313#define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */
314#define RTNH_F_ONLINK 4 /* Gateway is forced on link */
315
316/* Macros to handle hexthops */
317
318#define RTNH_ALIGNTO 4
319#define RTNH_ALIGN(len) ( ((len)+RTNH_ALIGNTO-1) & ~(RTNH_ALIGNTO-1) )
320#define RTNH_OK(rtnh,len) ((rtnh)->rtnh_len >= sizeof(struct rtnexthop) && \
321 ((int)(rtnh)->rtnh_len) <= (len))
322#define RTNH_NEXT(rtnh) ((struct rtnexthop*)(((char*)(rtnh)) + RTNH_ALIGN((rtnh)->rtnh_len)))
323#define RTNH_LENGTH(len) (RTNH_ALIGN(sizeof(struct rtnexthop)) + (len))
324#define RTNH_SPACE(len) RTNH_ALIGN(RTNH_LENGTH(len))
325#define RTNH_DATA(rtnh) ((struct rtattr*)(((char*)(rtnh)) + RTNH_LENGTH(0)))
326
327/* RTM_CACHEINFO */
328
329struct rta_cacheinfo {
330 __u32 rta_clntref;
331 __u32 rta_lastuse;
332 __s32 rta_expires;
333 __u32 rta_error;
334 __u32 rta_used;
335
336#define RTNETLINK_HAVE_PEERINFO 1
337 __u32 rta_id;
338 __u32 rta_ts;
339 __u32 rta_tsage;
340};
341
342/* RTM_METRICS --- array of struct rtattr with types of RTAX_* */
343
344enum {
345 RTAX_UNSPEC,
346#define RTAX_UNSPEC RTAX_UNSPEC
347 RTAX_LOCK,
348#define RTAX_LOCK RTAX_LOCK
349 RTAX_MTU,
350#define RTAX_MTU RTAX_MTU
351 RTAX_WINDOW,
352#define RTAX_WINDOW RTAX_WINDOW
353 RTAX_RTT,
354#define RTAX_RTT RTAX_RTT
355 RTAX_RTTVAR,
356#define RTAX_RTTVAR RTAX_RTTVAR
357 RTAX_SSTHRESH,
358#define RTAX_SSTHRESH RTAX_SSTHRESH
359 RTAX_CWND,
360#define RTAX_CWND RTAX_CWND
361 RTAX_ADVMSS,
362#define RTAX_ADVMSS RTAX_ADVMSS
363 RTAX_REORDERING,
364#define RTAX_REORDERING RTAX_REORDERING
365 RTAX_HOPLIMIT,
366#define RTAX_HOPLIMIT RTAX_HOPLIMIT
367 RTAX_INITCWND,
368#define RTAX_INITCWND RTAX_INITCWND
369 RTAX_FEATURES,
370#define RTAX_FEATURES RTAX_FEATURES
371 RTAX_RTO_MIN,
372#define RTAX_RTO_MIN RTAX_RTO_MIN
373 RTAX_INITRWND,
374#define RTAX_INITRWND RTAX_INITRWND
375 __RTAX_MAX
376};
377
378#define RTAX_MAX (__RTAX_MAX - 1)
379
380#define RTAX_FEATURE_ECN 0x00000001
381#define RTAX_FEATURE_SACK 0x00000002
382#define RTAX_FEATURE_TIMESTAMP 0x00000004
383#define RTAX_FEATURE_ALLFRAG 0x00000008
384
385struct rta_session {
386 __u8 proto;
387 __u8 pad1;
388 __u16 pad2;
389
390 union {
391 struct {
392 __u16 sport;
393 __u16 dport;
394 } ports;
395
396 struct {
397 __u8 type;
398 __u8 code;
399 __u16 ident;
400 } icmpt;
401
402 __u32 spi;
403 } u;
404};
405
406/****
407 * General form of address family dependent message.
408 ****/
409
410struct rtgenmsg {
411 unsigned char rtgen_family;
412};
413
414/*****************************************************************
415 * Link layer specific messages.
416 ****/
417
418/* struct ifinfomsg
419 * passes link level specific information, not dependent
420 * on network protocol.
421 */
422
423struct ifinfomsg {
424 unsigned char ifi_family;
425 unsigned char __ifi_pad;
426 unsigned short ifi_type; /* ARPHRD_* */
427 int ifi_index; /* Link index */
428 unsigned ifi_flags; /* IFF_* flags */
429 unsigned ifi_change; /* IFF_* change mask */
430};
431
432/********************************************************************
433 * prefix information
434 ****/
435
436struct prefixmsg {
437 unsigned char prefix_family;
438 unsigned char prefix_pad1;
439 unsigned short prefix_pad2;
440 int prefix_ifindex;
441 unsigned char prefix_type;
442 unsigned char prefix_len;
443 unsigned char prefix_flags;
444 unsigned char prefix_pad3;
445};
446
447enum
448{
449 PREFIX_UNSPEC,
450 PREFIX_ADDRESS,
451 PREFIX_CACHEINFO,
452 __PREFIX_MAX
453};
454
455#define PREFIX_MAX (__PREFIX_MAX - 1)
456
457struct prefix_cacheinfo {
458 __u32 preferred_time;
459 __u32 valid_time;
460};
461
462
463/*****************************************************************
464 * Traffic control messages.
465 ****/
466
467struct tcmsg {
468 unsigned char tcm_family;
469 unsigned char tcm__pad1;
470 unsigned short tcm__pad2;
471 int tcm_ifindex;
472 __u32 tcm_handle;
473 __u32 tcm_parent;
474 __u32 tcm_info;
475};
476
477enum {
478 TCA_UNSPEC,
479 TCA_KIND,
480 TCA_OPTIONS,
481 TCA_STATS,
482 TCA_XSTATS,
483 TCA_RATE,
484 TCA_FCNT,
485 TCA_STATS2,
486 TCA_STAB,
487 __TCA_MAX
488};
489
490#define TCA_MAX (__TCA_MAX - 1)
491
492#define TCA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg))))
493#define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg))
494
495/********************************************************************
496 * Neighbor Discovery userland options
497 ****/
498
499struct nduseroptmsg {
500 unsigned char nduseropt_family;
501 unsigned char nduseropt_pad1;
502 unsigned short nduseropt_opts_len; /* Total length of options */
503 int nduseropt_ifindex;
504 __u8 nduseropt_icmp_type;
505 __u8 nduseropt_icmp_code;
506 unsigned short nduseropt_pad2;
507 unsigned int nduseropt_pad3;
508 /* Followed by one or more ND options */
509};
510
511enum {
512 NDUSEROPT_UNSPEC,
513 NDUSEROPT_SRCADDR,
514 __NDUSEROPT_MAX
515};
516
517#define NDUSEROPT_MAX (__NDUSEROPT_MAX - 1)
518
519#ifndef __KERNEL__
520/* RTnetlink multicast groups - backwards compatibility for userspace */
521#define RTMGRP_LINK 1
522#define RTMGRP_NOTIFY 2
523#define RTMGRP_NEIGH 4
524#define RTMGRP_TC 8
525
526#define RTMGRP_IPV4_IFADDR 0x10
527#define RTMGRP_IPV4_MROUTE 0x20
528#define RTMGRP_IPV4_ROUTE 0x40
529#define RTMGRP_IPV4_RULE 0x80
530
531#define RTMGRP_IPV6_IFADDR 0x100
532#define RTMGRP_IPV6_MROUTE 0x200
533#define RTMGRP_IPV6_ROUTE 0x400
534#define RTMGRP_IPV6_IFINFO 0x800
535
536#define RTMGRP_DECnet_IFADDR 0x1000
537#define RTMGRP_DECnet_ROUTE 0x4000
538
539#define RTMGRP_IPV6_PREFIX 0x20000
540#endif
541
542/* RTnetlink multicast groups */
543enum rtnetlink_groups {
544 RTNLGRP_NONE,
545#define RTNLGRP_NONE RTNLGRP_NONE
546 RTNLGRP_LINK,
547#define RTNLGRP_LINK RTNLGRP_LINK
548 RTNLGRP_NOTIFY,
549#define RTNLGRP_NOTIFY RTNLGRP_NOTIFY
550 RTNLGRP_NEIGH,
551#define RTNLGRP_NEIGH RTNLGRP_NEIGH
552 RTNLGRP_TC,
553#define RTNLGRP_TC RTNLGRP_TC
554 RTNLGRP_IPV4_IFADDR,
555#define RTNLGRP_IPV4_IFADDR RTNLGRP_IPV4_IFADDR
556 RTNLGRP_IPV4_MROUTE,
557#define RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE
558 RTNLGRP_IPV4_ROUTE,
559#define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE
560 RTNLGRP_IPV4_RULE,
561#define RTNLGRP_IPV4_RULE RTNLGRP_IPV4_RULE
562 RTNLGRP_IPV6_IFADDR,
563#define RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_IFADDR
564 RTNLGRP_IPV6_MROUTE,
565#define RTNLGRP_IPV6_MROUTE RTNLGRP_IPV6_MROUTE
566 RTNLGRP_IPV6_ROUTE,
567#define RTNLGRP_IPV6_ROUTE RTNLGRP_IPV6_ROUTE
568 RTNLGRP_IPV6_IFINFO,
569#define RTNLGRP_IPV6_IFINFO RTNLGRP_IPV6_IFINFO
570 RTNLGRP_DECnet_IFADDR,
571#define RTNLGRP_DECnet_IFADDR RTNLGRP_DECnet_IFADDR
572 RTNLGRP_NOP2,
573 RTNLGRP_DECnet_ROUTE,
574#define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE
575 RTNLGRP_DECnet_RULE,
576#define RTNLGRP_DECnet_RULE RTNLGRP_DECnet_RULE
577 RTNLGRP_NOP4,
578 RTNLGRP_IPV6_PREFIX,
579#define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX
580 RTNLGRP_IPV6_RULE,
581#define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE
582 RTNLGRP_ND_USEROPT,
583#define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT
584 RTNLGRP_PHONET_IFADDR,
585#define RTNLGRP_PHONET_IFADDR RTNLGRP_PHONET_IFADDR
586 RTNLGRP_PHONET_ROUTE,
587#define RTNLGRP_PHONET_ROUTE RTNLGRP_PHONET_ROUTE
588 RTNLGRP_DCB,
589#define RTNLGRP_DCB RTNLGRP_DCB
590 __RTNLGRP_MAX
591};
592#define RTNLGRP_MAX (__RTNLGRP_MAX - 1)
593
594/* TC action piece */
595struct tcamsg {
596 unsigned char tca_family;
597 unsigned char tca__pad1;
598 unsigned short tca__pad2;
599};
600#define TA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcamsg))))
601#define TA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcamsg))
602#define TCA_ACT_TAB 1 /* attr type must be >=1 */
603#define TCAA_MAX 1
604
605/* New extended info filters for IFLA_EXT_MASK */
606#define RTEXT_FILTER_VF (1 << 0)
607
608/* End of information exported to user level */
609
610#ifdef __KERNEL__
611 4
612#include <linux/mutex.h> 5#include <linux/mutex.h>
613#include <linux/netdevice.h> 6#include <linux/netdevice.h>
7#include <uapi/linux/rtnetlink.h>
614 8
615extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo); 9extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo);
616extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid); 10extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid);
@@ -675,7 +69,4 @@ extern int ndo_dflt_fdb_dump(struct sk_buff *skb,
675 struct netlink_callback *cb, 69 struct netlink_callback *cb,
676 struct net_device *dev, 70 struct net_device *dev,
677 int idx); 71 int idx);
678#endif /* __KERNEL__ */
679
680
681#endif /* __LINUX_RTNETLINK_H */ 72#endif /* __LINUX_RTNETLINK_H */
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 7b600da9a635..4bd6c06eb28e 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -201,6 +201,7 @@ static inline void *sg_virt(struct scatterlist *sg)
201 return page_address(sg_page(sg)) + sg->offset; 201 return page_address(sg_page(sg)) + sg->offset;
202} 202}
203 203
204int sg_nents(struct scatterlist *sg);
204struct scatterlist *sg_next(struct scatterlist *); 205struct scatterlist *sg_next(struct scatterlist *);
205struct scatterlist *sg_last(struct scatterlist *s, unsigned int); 206struct scatterlist *sg_last(struct scatterlist *s, unsigned int);
206void sg_init_table(struct scatterlist *, unsigned int); 207void sg_init_table(struct scatterlist *, unsigned int);
diff --git a/include/linux/scc.h b/include/linux/scc.h
index 3495bd953cc6..c5a004962679 100644
--- a/include/linux/scc.h
+++ b/include/linux/scc.h
@@ -1,175 +1,9 @@
1/* $Id: scc.h,v 1.29 1997/04/02 14:56:45 jreuter Exp jreuter $ */ 1/* $Id: scc.h,v 1.29 1997/04/02 14:56:45 jreuter Exp jreuter $ */
2
3#ifndef _SCC_H 2#ifndef _SCC_H
4#define _SCC_H 3#define _SCC_H
5 4
5#include <uapi/linux/scc.h>
6 6
7/* selection of hardware types */
8
9#define PA0HZP 0x00 /* hardware type for PA0HZP SCC card and compatible */
10#define EAGLE 0x01 /* hardware type for EAGLE card */
11#define PC100 0x02 /* hardware type for PC100 card */
12#define PRIMUS 0x04 /* hardware type for PRIMUS-PC (DG9BL) card */
13#define DRSI 0x08 /* hardware type for DRSI PC*Packet card */
14#define BAYCOM 0x10 /* hardware type for BayCom (U)SCC */
15
16/* DEV ioctl() commands */
17
18enum SCC_ioctl_cmds {
19 SIOCSCCRESERVED = SIOCDEVPRIVATE,
20 SIOCSCCCFG,
21 SIOCSCCINI,
22 SIOCSCCCHANINI,
23 SIOCSCCSMEM,
24 SIOCSCCGKISS,
25 SIOCSCCSKISS,
26 SIOCSCCGSTAT,
27 SIOCSCCCAL
28};
29
30/* Device parameter control (from WAMPES) */
31
32enum L1_params {
33 PARAM_DATA,
34 PARAM_TXDELAY,
35 PARAM_PERSIST,
36 PARAM_SLOTTIME,
37 PARAM_TXTAIL,
38 PARAM_FULLDUP,
39 PARAM_SOFTDCD, /* was: PARAM_HW */
40 PARAM_MUTE, /* ??? */
41 PARAM_DTR,
42 PARAM_RTS,
43 PARAM_SPEED,
44 PARAM_ENDDELAY, /* ??? */
45 PARAM_GROUP,
46 PARAM_IDLE,
47 PARAM_MIN,
48 PARAM_MAXKEY,
49 PARAM_WAIT,
50 PARAM_MAXDEFER,
51 PARAM_TX,
52 PARAM_HWEVENT = 31,
53 PARAM_RETURN = 255 /* reset kiss mode */
54};
55
56/* fulldup parameter */
57
58enum FULLDUP_modes {
59 KISS_DUPLEX_HALF, /* normal CSMA operation */
60 KISS_DUPLEX_FULL, /* fullduplex, key down trx after transmission */
61 KISS_DUPLEX_LINK, /* fullduplex, key down trx after 'idletime' sec */
62 KISS_DUPLEX_OPTIMA /* fullduplex, let the protocol layer control the hw */
63};
64
65/* misc. parameters */
66
67#define TIMER_OFF 65535U /* to switch off timers */
68#define NO_SUCH_PARAM 65534U /* param not implemented */
69
70/* HWEVENT parameter */
71
72enum HWEVENT_opts {
73 HWEV_DCD_ON,
74 HWEV_DCD_OFF,
75 HWEV_ALL_SENT
76};
77
78/* channel grouping */
79
80#define RXGROUP 0100 /* if set, only tx when all channels clear */
81#define TXGROUP 0200 /* if set, don't transmit simultaneously */
82
83/* Tx/Rx clock sources */
84
85enum CLOCK_sources {
86 CLK_DPLL, /* normal halfduplex operation */
87 CLK_EXTERNAL, /* external clocking (G3RUH/DF9IC modems) */
88 CLK_DIVIDER, /* Rx = DPLL, Tx = divider (fullduplex with */
89 /* modems without clock regeneration */
90 CLK_BRG /* experimental fullduplex mode with DPLL/BRG for */
91 /* MODEMs without clock recovery */
92};
93
94/* Tx state */
95
96enum TX_state {
97 TXS_IDLE, /* Transmitter off, no data pending */
98 TXS_BUSY, /* waiting for permission to send / tailtime */
99 TXS_ACTIVE, /* Transmitter on, sending data */
100 TXS_NEWFRAME, /* reset CRC and send (next) frame */
101 TXS_IDLE2, /* Transmitter on, no data pending */
102 TXS_WAIT, /* Waiting for Mintime to expire */
103 TXS_TIMEOUT /* We had a transmission timeout */
104};
105
106typedef unsigned long io_port; /* type definition for an 'io port address' */
107
108/* SCC statistical information */
109
110struct scc_stat {
111 long rxints; /* Receiver interrupts */
112 long txints; /* Transmitter interrupts */
113 long exints; /* External/status interrupts */
114 long spints; /* Special receiver interrupts */
115
116 long txframes; /* Packets sent */
117 long rxframes; /* Number of Frames Actually Received */
118 long rxerrs; /* CRC Errors */
119 long txerrs; /* KISS errors */
120
121 unsigned int nospace; /* "Out of buffers" */
122 unsigned int rx_over; /* Receiver Overruns */
123 unsigned int tx_under; /* Transmitter Underruns */
124
125 unsigned int tx_state; /* Transmitter state */
126 int tx_queued; /* tx frames enqueued */
127
128 unsigned int maxqueue; /* allocated tx_buffers */
129 unsigned int bufsize; /* used buffersize */
130};
131
132struct scc_modem {
133 long speed; /* Line speed, bps */
134 char clocksrc; /* 0 = DPLL, 1 = external, 2 = divider */
135 char nrz; /* NRZ instead of NRZI */
136};
137
138struct scc_kiss_cmd {
139 int command; /* one of the KISS-Commands defined above */
140 unsigned param; /* KISS-Param */
141};
142
143struct scc_hw_config {
144 io_port data_a; /* data port channel A */
145 io_port ctrl_a; /* control port channel A */
146 io_port data_b; /* data port channel B */
147 io_port ctrl_b; /* control port channel B */
148 io_port vector_latch; /* INTACK-Latch (#) */
149 io_port special; /* special function port */
150
151 int irq; /* irq */
152 long clock; /* clock */
153 char option; /* command for function port */
154
155 char brand; /* hardware type */
156 char escc; /* use ext. features of a 8580/85180/85280 */
157};
158
159/* (#) only one INTACK latch allowed. */
160
161
162struct scc_mem_config {
163 unsigned int dummy;
164 unsigned int bufsize;
165};
166
167struct scc_calibrate {
168 unsigned int time;
169 unsigned char pattern;
170};
171
172#ifdef __KERNEL__
173 7
174enum {TX_OFF, TX_ON}; /* command for scc_key_trx() */ 8enum {TX_OFF, TX_ON}; /* command for scc_key_trx() */
175 9
@@ -248,5 +82,4 @@ struct scc_channel {
248 spinlock_t lock; /* Channel guard lock */ 82 spinlock_t lock; /* Channel guard lock */
249}; 83};
250 84
251#endif /* defined(__KERNEL__) */
252#endif /* defined(_SCC_H) */ 85#endif /* defined(_SCC_H) */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9d51e260bde0..0dd42a02df2e 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1,48 +1,8 @@
1#ifndef _LINUX_SCHED_H 1#ifndef _LINUX_SCHED_H
2#define _LINUX_SCHED_H 2#define _LINUX_SCHED_H
3 3
4/* 4#include <uapi/linux/sched.h>
5 * cloning flags:
6 */
7#define CSIGNAL 0x000000ff /* signal mask to be sent at exit */
8#define CLONE_VM 0x00000100 /* set if VM shared between processes */
9#define CLONE_FS 0x00000200 /* set if fs info shared between processes */
10#define CLONE_FILES 0x00000400 /* set if open files shared between processes */
11#define CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */
12#define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */
13#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */
14#define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */
15#define CLONE_THREAD 0x00010000 /* Same thread group? */
16#define CLONE_NEWNS 0x00020000 /* New namespace group? */
17#define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */
18#define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */
19#define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */
20#define CLONE_CHILD_CLEARTID 0x00200000 /* clear the TID in the child */
21#define CLONE_DETACHED 0x00400000 /* Unused, ignored */
22#define CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */
23#define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */
24/* 0x02000000 was previously the unused CLONE_STOPPED (Start in stopped state)
25 and is now available for re-use. */
26#define CLONE_NEWUTS 0x04000000 /* New utsname group? */
27#define CLONE_NEWIPC 0x08000000 /* New ipcs */
28#define CLONE_NEWUSER 0x10000000 /* New user namespace */
29#define CLONE_NEWPID 0x20000000 /* New pid namespace */
30#define CLONE_NEWNET 0x40000000 /* New network namespace */
31#define CLONE_IO 0x80000000 /* Clone io context */
32 5
33/*
34 * Scheduling policies
35 */
36#define SCHED_NORMAL 0
37#define SCHED_FIFO 1
38#define SCHED_RR 2
39#define SCHED_BATCH 3
40/* SCHED_ISO: reserved but not implemented yet */
41#define SCHED_IDLE 5
42/* Can be ORed in to make sure the process is reverted back to SCHED_NORMAL on fork */
43#define SCHED_RESET_ON_FORK 0x40000000
44
45#ifdef __KERNEL__
46 6
47struct sched_param { 7struct sched_param {
48 int sched_priority; 8 int sched_priority;
@@ -405,7 +365,6 @@ static inline void arch_pick_mmap_layout(struct mm_struct *mm) {}
405 365
406extern void set_dumpable(struct mm_struct *mm, int value); 366extern void set_dumpable(struct mm_struct *mm, int value);
407extern int get_dumpable(struct mm_struct *mm); 367extern int get_dumpable(struct mm_struct *mm);
408extern int __get_dumpable(unsigned long mm_flags);
409 368
410/* get/set_dumpable() values */ 369/* get/set_dumpable() values */
411#define SUID_DUMPABLE_DISABLED 0 370#define SUID_DUMPABLE_DISABLED 0
@@ -672,7 +631,6 @@ struct signal_struct {
672 struct rw_semaphore group_rwsem; 631 struct rw_semaphore group_rwsem;
673#endif 632#endif
674 633
675 int oom_adj; /* OOM kill score adjustment (bit shift) */
676 int oom_score_adj; /* OOM kill score adjustment */ 634 int oom_score_adj; /* OOM kill score adjustment */
677 int oom_score_adj_min; /* OOM kill score adjustment minimum value. 635 int oom_score_adj_min; /* OOM kill score adjustment minimum value.
678 * Only settable by CAP_SYS_RESOURCE. */ 636 * Only settable by CAP_SYS_RESOURCE. */
@@ -2334,6 +2292,9 @@ extern int do_execve(const char *,
2334 const char __user * const __user *, struct pt_regs *); 2292 const char __user * const __user *, struct pt_regs *);
2335extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *); 2293extern long do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int __user *, int __user *);
2336struct task_struct *fork_idle(int); 2294struct task_struct *fork_idle(int);
2295#ifdef CONFIG_GENERIC_KERNEL_THREAD
2296extern pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
2297#endif
2337 2298
2338extern void set_task_comm(struct task_struct *tsk, char *from); 2299extern void set_task_comm(struct task_struct *tsk, char *from);
2339extern char *get_task_comm(char *to, struct task_struct *tsk); 2300extern char *get_task_comm(char *to, struct task_struct *tsk);
@@ -2827,6 +2788,4 @@ static inline unsigned long rlimit_max(unsigned int limit)
2827 return task_rlimit_max(current, limit); 2788 return task_rlimit_max(current, limit);
2828} 2789}
2829 2790
2830#endif /* __KERNEL__ */
2831
2832#endif 2791#endif
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
index fb3c5a8fef3d..005bf3e38db5 100644
--- a/include/linux/screen_info.h
+++ b/include/linux/screen_info.h
@@ -1,76 +1,8 @@
1#ifndef _SCREEN_INFO_H 1#ifndef _SCREEN_INFO_H
2#define _SCREEN_INFO_H 2#define _SCREEN_INFO_H
3 3
4#include <linux/types.h> 4#include <uapi/linux/screen_info.h>
5 5
6/*
7 * These are set up by the setup-routine at boot-time:
8 */
9
10struct screen_info {
11 __u8 orig_x; /* 0x00 */
12 __u8 orig_y; /* 0x01 */
13 __u16 ext_mem_k; /* 0x02 */
14 __u16 orig_video_page; /* 0x04 */
15 __u8 orig_video_mode; /* 0x06 */
16 __u8 orig_video_cols; /* 0x07 */
17 __u8 flags; /* 0x08 */
18 __u8 unused2; /* 0x09 */
19 __u16 orig_video_ega_bx;/* 0x0a */
20 __u16 unused3; /* 0x0c */
21 __u8 orig_video_lines; /* 0x0e */
22 __u8 orig_video_isVGA; /* 0x0f */
23 __u16 orig_video_points;/* 0x10 */
24
25 /* VESA graphic mode -- linear frame buffer */
26 __u16 lfb_width; /* 0x12 */
27 __u16 lfb_height; /* 0x14 */
28 __u16 lfb_depth; /* 0x16 */
29 __u32 lfb_base; /* 0x18 */
30 __u32 lfb_size; /* 0x1c */
31 __u16 cl_magic, cl_offset; /* 0x20 */
32 __u16 lfb_linelength; /* 0x24 */
33 __u8 red_size; /* 0x26 */
34 __u8 red_pos; /* 0x27 */
35 __u8 green_size; /* 0x28 */
36 __u8 green_pos; /* 0x29 */
37 __u8 blue_size; /* 0x2a */
38 __u8 blue_pos; /* 0x2b */
39 __u8 rsvd_size; /* 0x2c */
40 __u8 rsvd_pos; /* 0x2d */
41 __u16 vesapm_seg; /* 0x2e */
42 __u16 vesapm_off; /* 0x30 */
43 __u16 pages; /* 0x32 */
44 __u16 vesa_attributes; /* 0x34 */
45 __u32 capabilities; /* 0x36 */
46 __u8 _reserved[6]; /* 0x3a */
47} __attribute__((packed));
48
49#define VIDEO_TYPE_MDA 0x10 /* Monochrome Text Display */
50#define VIDEO_TYPE_CGA 0x11 /* CGA Display */
51#define VIDEO_TYPE_EGAM 0x20 /* EGA/VGA in Monochrome Mode */
52#define VIDEO_TYPE_EGAC 0x21 /* EGA in Color Mode */
53#define VIDEO_TYPE_VGAC 0x22 /* VGA+ in Color Mode */
54#define VIDEO_TYPE_VLFB 0x23 /* VESA VGA in graphic mode */
55
56#define VIDEO_TYPE_PICA_S3 0x30 /* ACER PICA-61 local S3 video */
57#define VIDEO_TYPE_MIPS_G364 0x31 /* MIPS Magnum 4000 G364 video */
58#define VIDEO_TYPE_SGI 0x33 /* Various SGI graphics hardware */
59
60#define VIDEO_TYPE_TGAC 0x40 /* DEC TGA */
61
62#define VIDEO_TYPE_SUN 0x50 /* Sun frame buffer. */
63#define VIDEO_TYPE_SUNPCI 0x51 /* Sun PCI based frame buffer. */
64
65#define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */
66
67#define VIDEO_TYPE_EFI 0x70 /* EFI graphic mode */
68
69#define VIDEO_FLAGS_NOCURSOR (1 << 0) /* The video mode has no cursor set */
70
71#define VIDEO_CAPABILITY_SKIP_QUIRKS (1 << 0)
72
73#ifdef __KERNEL__
74extern struct screen_info screen_info; 6extern struct screen_info screen_info;
75 7
76#define ORIG_X (screen_info.orig_x) 8#define ORIG_X (screen_info.orig_x)
@@ -81,6 +13,4 @@ extern struct screen_info screen_info;
81#define ORIG_VIDEO_LINES (screen_info.orig_video_lines) 13#define ORIG_VIDEO_LINES (screen_info.orig_video_lines)
82#define ORIG_VIDEO_ISVGA (screen_info.orig_video_isVGA) 14#define ORIG_VIDEO_ISVGA (screen_info.orig_video_isVGA)
83#define ORIG_VIDEO_POINTS (screen_info.orig_video_points) 15#define ORIG_VIDEO_POINTS (screen_info.orig_video_points)
84#endif /* __KERNEL__ */
85
86#endif /* _SCREEN_INFO_H */ 16#endif /* _SCREEN_INFO_H */
diff --git a/include/linux/sdla.h b/include/linux/sdla.h
index 9995c7fc3f60..fe7a967d7de4 100644
--- a/include/linux/sdla.h
+++ b/include/linux/sdla.h
@@ -19,100 +19,11 @@
19 * as published by the Free Software Foundation; either version 19 * as published by the Free Software Foundation; either version
20 * 2 of the License, or (at your option) any later version. 20 * 2 of the License, or (at your option) any later version.
21 */ 21 */
22
23#ifndef SDLA_H 22#ifndef SDLA_H
24#define SDLA_H 23#define SDLA_H
25 24
26/* adapter type */ 25#include <uapi/linux/sdla.h>
27#define SDLA_TYPES
28#define SDLA_S502A 5020
29#define SDLA_S502E 5021
30#define SDLA_S503 5030
31#define SDLA_S507 5070
32#define SDLA_S508 5080
33#define SDLA_S509 5090
34#define SDLA_UNKNOWN -1
35
36/* port selection flags for the S508 */
37#define SDLA_S508_PORT_V35 0x00
38#define SDLA_S508_PORT_RS232 0x02
39
40/* Z80 CPU speeds */
41#define SDLA_CPU_3M 0x00
42#define SDLA_CPU_5M 0x01
43#define SDLA_CPU_7M 0x02
44#define SDLA_CPU_8M 0x03
45#define SDLA_CPU_10M 0x04
46#define SDLA_CPU_16M 0x05
47#define SDLA_CPU_12M 0x06
48
49/* some private IOCTLs */
50#define SDLA_IDENTIFY (FRAD_LAST_IOCTL + 1)
51#define SDLA_CPUSPEED (FRAD_LAST_IOCTL + 2)
52#define SDLA_PROTOCOL (FRAD_LAST_IOCTL + 3)
53
54#define SDLA_CLEARMEM (FRAD_LAST_IOCTL + 4)
55#define SDLA_WRITEMEM (FRAD_LAST_IOCTL + 5)
56#define SDLA_READMEM (FRAD_LAST_IOCTL + 6)
57
58struct sdla_mem {
59 int addr;
60 int len;
61 void __user *data;
62};
63
64#define SDLA_START (FRAD_LAST_IOCTL + 7)
65#define SDLA_STOP (FRAD_LAST_IOCTL + 8)
66 26
67/* some offsets in the Z80's memory space */
68#define SDLA_NMIADDR 0x0000
69#define SDLA_CONF_ADDR 0x0010
70#define SDLA_S502A_NMIADDR 0x0066
71#define SDLA_CODE_BASEADDR 0x0100
72#define SDLA_WINDOW_SIZE 0x2000
73#define SDLA_ADDR_MASK 0x1FFF
74
75/* largest handleable block of data */
76#define SDLA_MAX_DATA 4080
77#define SDLA_MAX_MTU 4072 /* MAX_DATA - sizeof(fradhdr) */
78#define SDLA_MAX_DLCI 24
79
80/* this should be the same as frad_conf */
81struct sdla_conf {
82 short station;
83 short config;
84 short kbaud;
85 short clocking;
86 short max_frm;
87 short T391;
88 short T392;
89 short N391;
90 short N392;
91 short N393;
92 short CIR_fwd;
93 short Bc_fwd;
94 short Be_fwd;
95 short CIR_bwd;
96 short Bc_bwd;
97 short Be_bwd;
98};
99
100/* this should be the same as dlci_conf */
101struct sdla_dlci_conf {
102 short config;
103 short CIR_fwd;
104 short Bc_fwd;
105 short Be_fwd;
106 short CIR_bwd;
107 short Bc_bwd;
108 short Be_bwd;
109 short Tc_fwd;
110 short Tc_bwd;
111 short Tf_max;
112 short Tb_max;
113};
114
115#ifdef __KERNEL__
116 27
117/* important Z80 window addresses */ 28/* important Z80 window addresses */
118#define SDLA_CONTROL_WND 0xE000 29#define SDLA_CONTROL_WND 0xE000
@@ -331,5 +242,3 @@ struct buf_entry {
331} __attribute__((packed)); 242} __attribute__((packed));
332 243
333#endif 244#endif
334
335#endif
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index 84f6320da50f..6f19cfd1840e 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -1,50 +1,8 @@
1#ifndef _LINUX_SECCOMP_H 1#ifndef _LINUX_SECCOMP_H
2#define _LINUX_SECCOMP_H 2#define _LINUX_SECCOMP_H
3 3
4#include <linux/compiler.h> 4#include <uapi/linux/seccomp.h>
5#include <linux/types.h>
6 5
7
8/* Valid values for seccomp.mode and prctl(PR_SET_SECCOMP, <mode>) */
9#define SECCOMP_MODE_DISABLED 0 /* seccomp is not in use. */
10#define SECCOMP_MODE_STRICT 1 /* uses hard-coded filter. */
11#define SECCOMP_MODE_FILTER 2 /* uses user-supplied filter. */
12
13/*
14 * All BPF programs must return a 32-bit value.
15 * The bottom 16-bits are for optional return data.
16 * The upper 16-bits are ordered from least permissive values to most.
17 *
18 * The ordering ensures that a min_t() over composed return values always
19 * selects the least permissive choice.
20 */
21#define SECCOMP_RET_KILL 0x00000000U /* kill the task immediately */
22#define SECCOMP_RET_TRAP 0x00030000U /* disallow and force a SIGSYS */
23#define SECCOMP_RET_ERRNO 0x00050000U /* returns an errno */
24#define SECCOMP_RET_TRACE 0x7ff00000U /* pass to a tracer or disallow */
25#define SECCOMP_RET_ALLOW 0x7fff0000U /* allow */
26
27/* Masks for the return value sections. */
28#define SECCOMP_RET_ACTION 0x7fff0000U
29#define SECCOMP_RET_DATA 0x0000ffffU
30
31/**
32 * struct seccomp_data - the format the BPF program executes over.
33 * @nr: the system call number
34 * @arch: indicates system call convention as an AUDIT_ARCH_* value
35 * as defined in <linux/audit.h>.
36 * @instruction_pointer: at the time of the system call.
37 * @args: up to 6 system call arguments always stored as 64-bit values
38 * regardless of the architecture.
39 */
40struct seccomp_data {
41 int nr;
42 __u32 arch;
43 __u64 instruction_pointer;
44 __u64 args[6];
45};
46
47#ifdef __KERNEL__
48#ifdef CONFIG_SECCOMP 6#ifdef CONFIG_SECCOMP
49 7
50#include <linux/thread_info.h> 8#include <linux/thread_info.h>
@@ -129,5 +87,4 @@ static inline void get_seccomp_filter(struct task_struct *tsk)
129 return; 87 return;
130} 88}
131#endif /* CONFIG_SECCOMP_FILTER */ 89#endif /* CONFIG_SECCOMP_FILTER */
132#endif /* __KERNEL__ */
133#endif /* _LINUX_SECCOMP_H */ 90#endif /* _LINUX_SECCOMP_H */
diff --git a/include/linux/securebits.h b/include/linux/securebits.h
index 33406174cbe8..da1b33b33af7 100644
--- a/include/linux/securebits.h
+++ b/include/linux/securebits.h
@@ -1,54 +1,7 @@
1#ifndef _LINUX_SECUREBITS_H 1#ifndef _LINUX_SECUREBITS_H
2#define _LINUX_SECUREBITS_H 1 2#define _LINUX_SECUREBITS_H 1
3 3
4/* Each securesetting is implemented using two bits. One bit specifies 4#include <uapi/linux/securebits.h>
5 whether the setting is on or off. The other bit specify whether the
6 setting is locked or not. A setting which is locked cannot be
7 changed from user-level. */
8#define issecure_mask(X) (1 << (X))
9#ifdef __KERNEL__
10#define issecure(X) (issecure_mask(X) & current_cred_xxx(securebits))
11#endif
12
13#define SECUREBITS_DEFAULT 0x00000000
14
15/* When set UID 0 has no special privileges. When unset, we support
16 inheritance of root-permissions and suid-root executable under
17 compatibility mode. We raise the effective and inheritable bitmasks
18 *of the executable file* if the effective uid of the new process is
19 0. If the real uid is 0, we raise the effective (legacy) bit of the
20 executable file. */
21#define SECURE_NOROOT 0
22#define SECURE_NOROOT_LOCKED 1 /* make bit-0 immutable */
23
24#define SECBIT_NOROOT (issecure_mask(SECURE_NOROOT))
25#define SECBIT_NOROOT_LOCKED (issecure_mask(SECURE_NOROOT_LOCKED))
26
27/* When set, setuid to/from uid 0 does not trigger capability-"fixup".
28 When unset, to provide compatiblility with old programs relying on
29 set*uid to gain/lose privilege, transitions to/from uid 0 cause
30 capabilities to be gained/lost. */
31#define SECURE_NO_SETUID_FIXUP 2
32#define SECURE_NO_SETUID_FIXUP_LOCKED 3 /* make bit-2 immutable */
33
34#define SECBIT_NO_SETUID_FIXUP (issecure_mask(SECURE_NO_SETUID_FIXUP))
35#define SECBIT_NO_SETUID_FIXUP_LOCKED \
36 (issecure_mask(SECURE_NO_SETUID_FIXUP_LOCKED))
37
38/* When set, a process can retain its capabilities even after
39 transitioning to a non-root user (the set-uid fixup suppressed by
40 bit 2). Bit-4 is cleared when a process calls exec(); setting both
41 bit 4 and 5 will create a barrier through exec that no exec()'d
42 child can use this feature again. */
43#define SECURE_KEEP_CAPS 4
44#define SECURE_KEEP_CAPS_LOCKED 5 /* make bit-4 immutable */
45
46#define SECBIT_KEEP_CAPS (issecure_mask(SECURE_KEEP_CAPS))
47#define SECBIT_KEEP_CAPS_LOCKED (issecure_mask(SECURE_KEEP_CAPS_LOCKED))
48
49#define SECURE_ALL_BITS (issecure_mask(SECURE_NOROOT) | \
50 issecure_mask(SECURE_NO_SETUID_FIXUP) | \
51 issecure_mask(SECURE_KEEP_CAPS))
52#define SECURE_ALL_LOCKS (SECURE_ALL_BITS << 1)
53 5
6#define issecure(X) (issecure_mask(X) & current_cred_xxx(securebits))
54#endif /* !_LINUX_SECUREBITS_H */ 7#endif /* !_LINUX_SECUREBITS_H */
diff --git a/include/linux/security.h b/include/linux/security.h
index 5b50c4e1a7c2..05e88bdcf7d9 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -1411,8 +1411,8 @@ struct security_operations {
1411 int (*sb_kern_mount) (struct super_block *sb, int flags, void *data); 1411 int (*sb_kern_mount) (struct super_block *sb, int flags, void *data);
1412 int (*sb_show_options) (struct seq_file *m, struct super_block *sb); 1412 int (*sb_show_options) (struct seq_file *m, struct super_block *sb);
1413 int (*sb_statfs) (struct dentry *dentry); 1413 int (*sb_statfs) (struct dentry *dentry);
1414 int (*sb_mount) (char *dev_name, struct path *path, 1414 int (*sb_mount) (const char *dev_name, struct path *path,
1415 char *type, unsigned long flags, void *data); 1415 const char *type, unsigned long flags, void *data);
1416 int (*sb_umount) (struct vfsmount *mnt, int flags); 1416 int (*sb_umount) (struct vfsmount *mnt, int flags);
1417 int (*sb_pivotroot) (struct path *old_path, 1417 int (*sb_pivotroot) (struct path *old_path,
1418 struct path *new_path); 1418 struct path *new_path);
@@ -1694,8 +1694,8 @@ int security_sb_remount(struct super_block *sb, void *data);
1694int security_sb_kern_mount(struct super_block *sb, int flags, void *data); 1694int security_sb_kern_mount(struct super_block *sb, int flags, void *data);
1695int security_sb_show_options(struct seq_file *m, struct super_block *sb); 1695int security_sb_show_options(struct seq_file *m, struct super_block *sb);
1696int security_sb_statfs(struct dentry *dentry); 1696int security_sb_statfs(struct dentry *dentry);
1697int security_sb_mount(char *dev_name, struct path *path, 1697int security_sb_mount(const char *dev_name, struct path *path,
1698 char *type, unsigned long flags, void *data); 1698 const char *type, unsigned long flags, void *data);
1699int security_sb_umount(struct vfsmount *mnt, int flags); 1699int security_sb_umount(struct vfsmount *mnt, int flags);
1700int security_sb_pivotroot(struct path *old_path, struct path *new_path); 1700int security_sb_pivotroot(struct path *old_path, struct path *new_path);
1701int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); 1701int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts);
@@ -1964,8 +1964,8 @@ static inline int security_sb_statfs(struct dentry *dentry)
1964 return 0; 1964 return 0;
1965} 1965}
1966 1966
1967static inline int security_sb_mount(char *dev_name, struct path *path, 1967static inline int security_sb_mount(const char *dev_name, struct path *path,
1968 char *type, unsigned long flags, 1968 const char *type, unsigned long flags,
1969 void *data) 1969 void *data)
1970{ 1970{
1971 return 0; 1971 return 0;
diff --git a/include/linux/sem.h b/include/linux/sem.h
index 10d6b226afc5..53d42650b193 100644
--- a/include/linux/sem.h
+++ b/include/linux/sem.h
@@ -1,85 +1,10 @@
1#ifndef _LINUX_SEM_H 1#ifndef _LINUX_SEM_H
2#define _LINUX_SEM_H 2#define _LINUX_SEM_H
3 3
4#include <linux/ipc.h>
5
6/* semop flags */
7#define SEM_UNDO 0x1000 /* undo the operation on exit */
8
9/* semctl Command Definitions. */
10#define GETPID 11 /* get sempid */
11#define GETVAL 12 /* get semval */
12#define GETALL 13 /* get all semval's */
13#define GETNCNT 14 /* get semncnt */
14#define GETZCNT 15 /* get semzcnt */
15#define SETVAL 16 /* set semval */
16#define SETALL 17 /* set all semval's */
17
18/* ipcs ctl cmds */
19#define SEM_STAT 18
20#define SEM_INFO 19
21
22/* Obsolete, used only for backwards compatibility and libc5 compiles */
23struct semid_ds {
24 struct ipc_perm sem_perm; /* permissions .. see ipc.h */
25 __kernel_time_t sem_otime; /* last semop time */
26 __kernel_time_t sem_ctime; /* last change time */
27 struct sem *sem_base; /* ptr to first semaphore in array */
28 struct sem_queue *sem_pending; /* pending operations to be processed */
29 struct sem_queue **sem_pending_last; /* last pending operation */
30 struct sem_undo *undo; /* undo requests on this array */
31 unsigned short sem_nsems; /* no. of semaphores in array */
32};
33
34/* Include the definition of semid64_ds */
35#include <asm/sembuf.h>
36
37/* semop system calls takes an array of these. */
38struct sembuf {
39 unsigned short sem_num; /* semaphore index in array */
40 short sem_op; /* semaphore operation */
41 short sem_flg; /* operation flags */
42};
43
44/* arg for semctl system calls. */
45union semun {
46 int val; /* value for SETVAL */
47 struct semid_ds __user *buf; /* buffer for IPC_STAT & IPC_SET */
48 unsigned short __user *array; /* array for GETALL & SETALL */
49 struct seminfo __user *__buf; /* buffer for IPC_INFO */
50 void __user *__pad;
51};
52
53struct seminfo {
54 int semmap;
55 int semmni;
56 int semmns;
57 int semmnu;
58 int semmsl;
59 int semopm;
60 int semume;
61 int semusz;
62 int semvmx;
63 int semaem;
64};
65
66#define SEMMNI 128 /* <= IPCMNI max # of semaphore identifiers */
67#define SEMMSL 250 /* <= 8 000 max num of semaphores per id */
68#define SEMMNS (SEMMNI*SEMMSL) /* <= INT_MAX max # of semaphores in system */
69#define SEMOPM 32 /* <= 1 000 max num of ops per semop call */
70#define SEMVMX 32767 /* <= 32767 semaphore maximum value */
71#define SEMAEM SEMVMX /* adjust on exit max value */
72
73/* unused */
74#define SEMUME SEMOPM /* max num of undo entries per process */
75#define SEMMNU SEMMNS /* num of undo structures system wide */
76#define SEMMAP SEMMNS /* # of entries in semaphore map */
77#define SEMUSZ 20 /* sizeof struct sem_undo */
78
79#ifdef __KERNEL__
80#include <linux/atomic.h> 4#include <linux/atomic.h>
81#include <linux/rcupdate.h> 5#include <linux/rcupdate.h>
82#include <linux/cache.h> 6#include <linux/cache.h>
7#include <uapi/linux/sem.h>
83 8
84struct task_struct; 9struct task_struct;
85 10
@@ -122,6 +47,4 @@ static inline void exit_sem(struct task_struct *tsk)
122} 47}
123#endif 48#endif
124 49
125#endif /* __KERNEL__ */
126
127#endif /* _LINUX_SEM_H */ 50#endif /* _LINUX_SEM_H */
diff --git a/include/linux/serial.h b/include/linux/serial.h
index 861e51de476b..0916107c77f9 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -6,16 +6,11 @@
6 * Redistribution of this file is permitted under the terms of the GNU 6 * Redistribution of this file is permitted under the terms of the GNU
7 * Public License (GPL) 7 * Public License (GPL)
8 */ 8 */
9
10#ifndef _LINUX_SERIAL_H 9#ifndef _LINUX_SERIAL_H
11#define _LINUX_SERIAL_H 10#define _LINUX_SERIAL_H
12 11
13#include <linux/types.h>
14
15#include <linux/tty_flags.h>
16
17#ifdef __KERNEL__
18#include <asm/page.h> 12#include <asm/page.h>
13#include <uapi/linux/serial.h>
19 14
20 15
21/* 16/*
@@ -33,118 +28,6 @@ struct async_icount {
33 */ 28 */
34#define SERIAL_XMIT_SIZE PAGE_SIZE 29#define SERIAL_XMIT_SIZE PAGE_SIZE
35 30
36#endif
37
38struct serial_struct {
39 int type;
40 int line;
41 unsigned int port;
42 int irq;
43 int flags;
44 int xmit_fifo_size;
45 int custom_divisor;
46 int baud_base;
47 unsigned short close_delay;
48 char io_type;
49 char reserved_char[1];
50 int hub6;
51 unsigned short closing_wait; /* time to wait before closing */
52 unsigned short closing_wait2; /* no longer used... */
53 unsigned char *iomem_base;
54 unsigned short iomem_reg_shift;
55 unsigned int port_high;
56 unsigned long iomap_base; /* cookie passed into ioremap */
57};
58
59/*
60 * For the close wait times, 0 means wait forever for serial port to
61 * flush its output. 65535 means don't wait at all.
62 */
63#define ASYNC_CLOSING_WAIT_INF 0
64#define ASYNC_CLOSING_WAIT_NONE 65535
65
66/*
67 * These are the supported serial types.
68 */
69#define PORT_UNKNOWN 0
70#define PORT_8250 1
71#define PORT_16450 2
72#define PORT_16550 3
73#define PORT_16550A 4
74#define PORT_CIRRUS 5 /* usurped by cyclades.c */
75#define PORT_16650 6
76#define PORT_16650V2 7
77#define PORT_16750 8
78#define PORT_STARTECH 9 /* usurped by cyclades.c */
79#define PORT_16C950 10 /* Oxford Semiconductor */
80#define PORT_16654 11
81#define PORT_16850 12
82#define PORT_RSA 13 /* RSA-DV II/S card */
83#define PORT_MAX 13
84
85#define SERIAL_IO_PORT 0
86#define SERIAL_IO_HUB6 1
87#define SERIAL_IO_MEM 2
88
89#define UART_CLEAR_FIFO 0x01
90#define UART_USE_FIFO 0x02
91#define UART_STARTECH 0x04
92#define UART_NATSEMI 0x08
93
94
95/*
96 * Multiport serial configuration structure --- external structure
97 */
98struct serial_multiport_struct {
99 int irq;
100 int port1;
101 unsigned char mask1, match1;
102 int port2;
103 unsigned char mask2, match2;
104 int port3;
105 unsigned char mask3, match3;
106 int port4;
107 unsigned char mask4, match4;
108 int port_monitor;
109 int reserved[32];
110};
111
112/*
113 * Serial input interrupt line counters -- external structure
114 * Four lines can interrupt: CTS, DSR, RI, DCD
115 */
116struct serial_icounter_struct {
117 int cts, dsr, rng, dcd;
118 int rx, tx;
119 int frame, overrun, parity, brk;
120 int buf_overrun;
121 int reserved[9];
122};
123
124/*
125 * Serial interface for controlling RS485 settings on chips with suitable
126 * support. Set with TIOCSRS485 and get with TIOCGRS485 if supported by your
127 * platform. The set function returns the new state, with any unsupported bits
128 * reverted appropriately.
129 */
130
131struct serial_rs485 {
132 __u32 flags; /* RS485 feature flags */
133#define SER_RS485_ENABLED (1 << 0) /* If enabled */
134#define SER_RS485_RTS_ON_SEND (1 << 1) /* Logical level for
135 RTS pin when
136 sending */
137#define SER_RS485_RTS_AFTER_SEND (1 << 2) /* Logical level for
138 RTS pin after sent*/
139#define SER_RS485_RX_DURING_TX (1 << 4)
140 __u32 delay_rts_before_send; /* Delay before send (milliseconds) */
141 __u32 delay_rts_after_send; /* Delay after send (milliseconds) */
142 __u32 padding[5]; /* Memory is cheap, new structs
143 are a royal PITA .. */
144};
145
146#ifdef __KERNEL__
147#include <linux/compiler.h> 31#include <linux/compiler.h>
148 32
149#endif /* __KERNEL__ */
150#endif /* _LINUX_SERIAL_H */ 33#endif /* _LINUX_SERIAL_H */
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index f9b22ec7a9f3..3c430228d232 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -20,202 +20,6 @@
20#ifndef LINUX_SERIAL_CORE_H 20#ifndef LINUX_SERIAL_CORE_H
21#define LINUX_SERIAL_CORE_H 21#define LINUX_SERIAL_CORE_H
22 22
23#include <linux/serial.h>
24
25/*
26 * The type definitions. These are from Ted Ts'o's serial.h
27 */
28#define PORT_UNKNOWN 0
29#define PORT_8250 1
30#define PORT_16450 2
31#define PORT_16550 3
32#define PORT_16550A 4
33#define PORT_CIRRUS 5
34#define PORT_16650 6
35#define PORT_16650V2 7
36#define PORT_16750 8
37#define PORT_STARTECH 9
38#define PORT_16C950 10
39#define PORT_16654 11
40#define PORT_16850 12
41#define PORT_RSA 13
42#define PORT_NS16550A 14
43#define PORT_XSCALE 15
44#define PORT_RM9000 16 /* PMC-Sierra RM9xxx internal UART */
45#define PORT_OCTEON 17 /* Cavium OCTEON internal UART */
46#define PORT_AR7 18 /* Texas Instruments AR7 internal UART */
47#define PORT_U6_16550A 19 /* ST-Ericsson U6xxx internal UART */
48#define PORT_TEGRA 20 /* NVIDIA Tegra internal UART */
49#define PORT_XR17D15X 21 /* Exar XR17D15x UART */
50#define PORT_LPC3220 22 /* NXP LPC32xx SoC "Standard" UART */
51#define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */
52#define PORT_MAX_8250 23 /* max port ID */
53
54/*
55 * ARM specific type numbers. These are not currently guaranteed
56 * to be implemented, and will change in the future. These are
57 * separate so any additions to the old serial.c that occur before
58 * we are merged can be easily merged here.
59 */
60#define PORT_PXA 31
61#define PORT_AMBA 32
62#define PORT_CLPS711X 33
63#define PORT_SA1100 34
64#define PORT_UART00 35
65#define PORT_21285 37
66
67/* Sparc type numbers. */
68#define PORT_SUNZILOG 38
69#define PORT_SUNSAB 39
70
71/* DEC */
72#define PORT_DZ 46
73#define PORT_ZS 47
74
75/* Parisc type numbers. */
76#define PORT_MUX 48
77
78/* Atmel AT91 / AT32 SoC */
79#define PORT_ATMEL 49
80
81/* Macintosh Zilog type numbers */
82#define PORT_MAC_ZILOG 50 /* m68k : not yet implemented */
83#define PORT_PMAC_ZILOG 51
84
85/* SH-SCI */
86#define PORT_SCI 52
87#define PORT_SCIF 53
88#define PORT_IRDA 54
89
90/* Samsung S3C2410 SoC and derivatives thereof */
91#define PORT_S3C2410 55
92
93/* SGI IP22 aka Indy / Challenge S / Indigo 2 */
94#define PORT_IP22ZILOG 56
95
96/* Sharp LH7a40x -- an ARM9 SoC series */
97#define PORT_LH7A40X 57
98
99/* PPC CPM type number */
100#define PORT_CPM 58
101
102/* MPC52xx (and MPC512x) type numbers */
103#define PORT_MPC52xx 59
104
105/* IBM icom */
106#define PORT_ICOM 60
107
108/* Samsung S3C2440 SoC */
109#define PORT_S3C2440 61
110
111/* Motorola i.MX SoC */
112#define PORT_IMX 62
113
114/* Marvell MPSC */
115#define PORT_MPSC 63
116
117/* TXX9 type number */
118#define PORT_TXX9 64
119
120/* NEC VR4100 series SIU/DSIU */
121#define PORT_VR41XX_SIU 65
122#define PORT_VR41XX_DSIU 66
123
124/* Samsung S3C2400 SoC */
125#define PORT_S3C2400 67
126
127/* M32R SIO */
128#define PORT_M32R_SIO 68
129
130/*Digi jsm */
131#define PORT_JSM 69
132
133#define PORT_PNX8XXX 70
134
135/* Hilscher netx */
136#define PORT_NETX 71
137
138/* SUN4V Hypervisor Console */
139#define PORT_SUNHV 72
140
141#define PORT_S3C2412 73
142
143/* Xilinx uartlite */
144#define PORT_UARTLITE 74
145
146/* Blackfin bf5xx */
147#define PORT_BFIN 75
148
149/* Micrel KS8695 */
150#define PORT_KS8695 76
151
152/* Broadcom SB1250, etc. SOC */
153#define PORT_SB1250_DUART 77
154
155/* Freescale ColdFire */
156#define PORT_MCF 78
157
158/* Blackfin SPORT */
159#define PORT_BFIN_SPORT 79
160
161/* MN10300 on-chip UART numbers */
162#define PORT_MN10300 80
163#define PORT_MN10300_CTS 81
164
165#define PORT_SC26XX 82
166
167/* SH-SCI */
168#define PORT_SCIFA 83
169
170#define PORT_S3C6400 84
171
172/* NWPSERIAL */
173#define PORT_NWPSERIAL 85
174
175/* MAX3100 */
176#define PORT_MAX3100 86
177
178/* Timberdale UART */
179#define PORT_TIMBUART 87
180
181/* Qualcomm MSM SoCs */
182#define PORT_MSM 88
183
184/* BCM63xx family SoCs */
185#define PORT_BCM63XX 89
186
187/* Aeroflex Gaisler GRLIB APBUART */
188#define PORT_APBUART 90
189
190/* Altera UARTs */
191#define PORT_ALTERA_JTAGUART 91
192#define PORT_ALTERA_UART 92
193
194/* SH-SCI */
195#define PORT_SCIFB 93
196
197/* MAX310X */
198#define PORT_MAX310X 94
199
200/* High Speed UART for Medfield */
201#define PORT_MFD 95
202
203/* TI OMAP-UART */
204#define PORT_OMAP 96
205
206/* VIA VT8500 SoC */
207#define PORT_VT8500 97
208
209/* Xilinx PSS UART */
210#define PORT_XUARTPS 98
211
212/* Atheros AR933X SoC */
213#define PORT_AR933X 99
214
215/* Energy Micro efm32 SoC */
216#define PORT_EFMUART 100
217
218#ifdef __KERNEL__
219 23
220#include <linux/compiler.h> 24#include <linux/compiler.h>
221#include <linux/interrupt.h> 25#include <linux/interrupt.h>
@@ -226,6 +30,7 @@
226#include <linux/mutex.h> 30#include <linux/mutex.h>
227#include <linux/sysrq.h> 31#include <linux/sysrq.h>
228#include <linux/pps_kernel.h> 32#include <linux/pps_kernel.h>
33#include <uapi/linux/serial_core.h>
229 34
230struct uart_port; 35struct uart_port;
231struct serial_struct; 36struct serial_struct;
@@ -562,6 +367,4 @@ static inline int uart_handle_break(struct uart_port *port)
562 (cflag) & CRTSCTS || \ 367 (cflag) & CRTSCTS || \
563 !((cflag) & CLOCAL)) 368 !((cflag) & CLOCAL))
564 369
565#endif
566
567#endif /* LINUX_SERIAL_CORE_H */ 370#endif /* LINUX_SERIAL_CORE_H */
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 6d6cfd3e94a3..36aac733840a 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -1,6 +1,3 @@
1#ifndef _SERIO_H
2#define _SERIO_H
3
4/* 1/*
5 * Copyright (C) 1999-2002 Vojtech Pavlik 2 * Copyright (C) 1999-2002 Vojtech Pavlik
6* 3*
@@ -8,12 +5,9 @@
8 * under the terms of the GNU General Public License version 2 as published by 5 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation. 6 * the Free Software Foundation.
10 */ 7 */
8#ifndef _SERIO_H
9#define _SERIO_H
11 10
12#include <linux/ioctl.h>
13
14#define SPIOCSTYPE _IOW('q', 0x01, unsigned long)
15
16#ifdef __KERNEL__
17 11
18#include <linux/types.h> 12#include <linux/types.h>
19#include <linux/interrupt.h> 13#include <linux/interrupt.h>
@@ -22,6 +16,7 @@
22#include <linux/mutex.h> 16#include <linux/mutex.h>
23#include <linux/device.h> 17#include <linux/device.h>
24#include <linux/mod_devicetable.h> 18#include <linux/mod_devicetable.h>
19#include <uapi/linux/serio.h>
25 20
26struct serio { 21struct serio {
27 void *port_data; 22 void *port_data;
@@ -152,68 +147,3 @@ static inline void serio_continue_rx(struct serio *serio)
152} 147}
153 148
154#endif 149#endif
155
156/*
157 * bit masks for use in "interrupt" flags (3rd argument)
158 */
159#define SERIO_TIMEOUT 1
160#define SERIO_PARITY 2
161#define SERIO_FRAME 4
162
163/*
164 * Serio types
165 */
166#define SERIO_XT 0x00
167#define SERIO_8042 0x01
168#define SERIO_RS232 0x02
169#define SERIO_HIL_MLC 0x03
170#define SERIO_PS_PSTHRU 0x05
171#define SERIO_8042_XL 0x06
172
173/*
174 * Serio protocols
175 */
176#define SERIO_UNKNOWN 0x00
177#define SERIO_MSC 0x01
178#define SERIO_SUN 0x02
179#define SERIO_MS 0x03
180#define SERIO_MP 0x04
181#define SERIO_MZ 0x05
182#define SERIO_MZP 0x06
183#define SERIO_MZPP 0x07
184#define SERIO_VSXXXAA 0x08
185#define SERIO_SUNKBD 0x10
186#define SERIO_WARRIOR 0x18
187#define SERIO_SPACEORB 0x19
188#define SERIO_MAGELLAN 0x1a
189#define SERIO_SPACEBALL 0x1b
190#define SERIO_GUNZE 0x1c
191#define SERIO_IFORCE 0x1d
192#define SERIO_STINGER 0x1e
193#define SERIO_NEWTON 0x1f
194#define SERIO_STOWAWAY 0x20
195#define SERIO_H3600 0x21
196#define SERIO_PS2SER 0x22
197#define SERIO_TWIDKBD 0x23
198#define SERIO_TWIDJOY 0x24
199#define SERIO_HIL 0x25
200#define SERIO_SNES232 0x26
201#define SERIO_SEMTECH 0x27
202#define SERIO_LKKBD 0x28
203#define SERIO_ELO 0x29
204#define SERIO_MICROTOUCH 0x30
205#define SERIO_PENMOUNT 0x31
206#define SERIO_TOUCHRIGHT 0x32
207#define SERIO_TOUCHWIN 0x33
208#define SERIO_TAOSEVM 0x34
209#define SERIO_FUJITSU 0x35
210#define SERIO_ZHENHUA 0x36
211#define SERIO_INEXIO 0x37
212#define SERIO_TOUCHIT213 0x38
213#define SERIO_W8001 0x39
214#define SERIO_DYNAPRO 0x3a
215#define SERIO_HAMPSHIRE 0x3b
216#define SERIO_PS2MULT 0x3c
217#define SERIO_TSC40 0x3d
218
219#endif
diff --git a/include/linux/shm.h b/include/linux/shm.h
index edd086883ccb..bcf8a6a3ec00 100644
--- a/include/linux/shm.h
+++ b/include/linux/shm.h
@@ -1,88 +1,11 @@
1#ifndef _LINUX_SHM_H_ 1#ifndef _LINUX_SHM_H_
2#define _LINUX_SHM_H_ 2#define _LINUX_SHM_H_
3 3
4#include <linux/ipc.h>
5#include <linux/errno.h>
6#ifdef __KERNEL__
7#include <asm/page.h> 4#include <asm/page.h>
8#else 5#include <uapi/linux/shm.h>
9#include <unistd.h>
10#endif
11
12/*
13 * SHMMAX, SHMMNI and SHMALL are upper limits are defaults which can
14 * be increased by sysctl
15 */
16 6
17#define SHMMAX 0x2000000 /* max shared seg size (bytes) */
18#define SHMMIN 1 /* min shared seg size (bytes) */
19#define SHMMNI 4096 /* max num of segs system wide */
20#ifdef __KERNEL__
21#define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide (pages) */ 7#define SHMALL (SHMMAX/PAGE_SIZE*(SHMMNI/16)) /* max shm system wide (pages) */
22#else
23#define SHMALL (SHMMAX/getpagesize()*(SHMMNI/16))
24#endif
25#define SHMSEG SHMMNI /* max shared segs per process */
26
27#ifdef __KERNEL__
28#include <asm/shmparam.h> 8#include <asm/shmparam.h>
29#endif
30
31/* Obsolete, used only for backwards compatibility and libc5 compiles */
32struct shmid_ds {
33 struct ipc_perm shm_perm; /* operation perms */
34 int shm_segsz; /* size of segment (bytes) */
35 __kernel_time_t shm_atime; /* last attach time */
36 __kernel_time_t shm_dtime; /* last detach time */
37 __kernel_time_t shm_ctime; /* last change time */
38 __kernel_ipc_pid_t shm_cpid; /* pid of creator */
39 __kernel_ipc_pid_t shm_lpid; /* pid of last operator */
40 unsigned short shm_nattch; /* no. of current attaches */
41 unsigned short shm_unused; /* compatibility */
42 void *shm_unused2; /* ditto - used by DIPC */
43 void *shm_unused3; /* unused */
44};
45
46/* Include the definition of shmid64_ds and shminfo64 */
47#include <asm/shmbuf.h>
48
49/* permission flag for shmget */
50#define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */
51#define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */
52
53/* mode for attach */
54#define SHM_RDONLY 010000 /* read-only access */
55#define SHM_RND 020000 /* round attach address to SHMLBA boundary */
56#define SHM_REMAP 040000 /* take-over region on attach */
57#define SHM_EXEC 0100000 /* execution access */
58
59/* super user shmctl commands */
60#define SHM_LOCK 11
61#define SHM_UNLOCK 12
62
63/* ipcs ctl commands */
64#define SHM_STAT 13
65#define SHM_INFO 14
66
67/* Obsolete, used only for backwards compatibility */
68struct shminfo {
69 int shmmax;
70 int shmmin;
71 int shmmni;
72 int shmseg;
73 int shmall;
74};
75
76struct shm_info {
77 int used_ids;
78 unsigned long shm_tot; /* total allocated shm */
79 unsigned long shm_rss; /* total resident shm */
80 unsigned long shm_swp; /* total swapped shm */
81 unsigned long swap_attempts;
82 unsigned long swap_successes;
83};
84
85#ifdef __KERNEL__
86struct shmid_kernel /* private to the kernel */ 9struct shmid_kernel /* private to the kernel */
87{ 10{
88 struct kern_ipc_perm shm_perm; 11 struct kern_ipc_perm shm_perm;
@@ -127,6 +50,4 @@ static inline void exit_shm(struct task_struct *task)
127} 50}
128#endif 51#endif
129 52
130#endif /* __KERNEL__ */
131
132#endif /* _LINUX_SHM_H_ */ 53#endif /* _LINUX_SHM_H_ */
diff --git a/include/linux/signal.h b/include/linux/signal.h
index 26b424adc842..e19a011b43b7 100644
--- a/include/linux/signal.h
+++ b/include/linux/signal.h
@@ -1,11 +1,8 @@
1#ifndef _LINUX_SIGNAL_H 1#ifndef _LINUX_SIGNAL_H
2#define _LINUX_SIGNAL_H 2#define _LINUX_SIGNAL_H
3 3
4#include <asm/signal.h>
5#include <asm/siginfo.h>
6
7#ifdef __KERNEL__
8#include <linux/list.h> 4#include <linux/list.h>
5#include <uapi/linux/signal.h>
9 6
10struct task_struct; 7struct task_struct;
11 8
@@ -388,6 +385,4 @@ int unhandled_signal(struct task_struct *tsk, int sig);
388 385
389void signals_init(void); 386void signals_init(void);
390 387
391#endif /* __KERNEL__ */
392
393#endif /* _LINUX_SIGNAL_H */ 388#endif /* _LINUX_SIGNAL_H */
diff --git a/include/linux/signalfd.h b/include/linux/signalfd.h
index 247399b2979a..eadbe227c256 100644
--- a/include/linux/signalfd.h
+++ b/include/linux/signalfd.h
@@ -4,51 +4,11 @@
4 * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org> 4 * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org>
5 * 5 *
6 */ 6 */
7
8#ifndef _LINUX_SIGNALFD_H 7#ifndef _LINUX_SIGNALFD_H
9#define _LINUX_SIGNALFD_H 8#define _LINUX_SIGNALFD_H
10 9
11#include <linux/types.h> 10#include <uapi/linux/signalfd.h>
12/* For O_CLOEXEC and O_NONBLOCK */
13#include <linux/fcntl.h>
14
15/* Flags for signalfd4. */
16#define SFD_CLOEXEC O_CLOEXEC
17#define SFD_NONBLOCK O_NONBLOCK
18
19struct signalfd_siginfo {
20 __u32 ssi_signo;
21 __s32 ssi_errno;
22 __s32 ssi_code;
23 __u32 ssi_pid;
24 __u32 ssi_uid;
25 __s32 ssi_fd;
26 __u32 ssi_tid;
27 __u32 ssi_band;
28 __u32 ssi_overrun;
29 __u32 ssi_trapno;
30 __s32 ssi_status;
31 __s32 ssi_int;
32 __u64 ssi_ptr;
33 __u64 ssi_utime;
34 __u64 ssi_stime;
35 __u64 ssi_addr;
36 __u16 ssi_addr_lsb;
37 11
38 /*
39 * Pad strcture to 128 bytes. Remember to update the
40 * pad size when you add new members. We use a fixed
41 * size structure to avoid compatibility problems with
42 * future versions, and we leave extra space for additional
43 * members. We use fixed size members because this strcture
44 * comes out of a read(2) and we really don't want to have
45 * a compat on read(2).
46 */
47 __u8 __pad[46];
48};
49
50
51#ifdef __KERNEL__
52 12
53#ifdef CONFIG_SIGNALFD 13#ifdef CONFIG_SIGNALFD
54 14
@@ -71,6 +31,4 @@ static inline void signalfd_cleanup(struct sighand_struct *sighand) { }
71 31
72#endif /* CONFIG_SIGNALFD */ 32#endif /* CONFIG_SIGNALFD */
73 33
74#endif /* __KERNEL__ */
75
76#endif /* _LINUX_SIGNALFD_H */ 34#endif /* _LINUX_SIGNALFD_H */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index b33a3a1f205e..6a2c34e6d962 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -589,9 +589,6 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
589 return __alloc_skb(size, priority, SKB_ALLOC_FCLONE, NUMA_NO_NODE); 589 return __alloc_skb(size, priority, SKB_ALLOC_FCLONE, NUMA_NO_NODE);
590} 590}
591 591
592extern void skb_recycle(struct sk_buff *skb);
593extern bool skb_recycle_check(struct sk_buff *skb, int skb_size);
594
595extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); 592extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
596extern int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask); 593extern int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask);
597extern struct sk_buff *skb_clone(struct sk_buff *skb, 594extern struct sk_buff *skb_clone(struct sk_buff *skb,
@@ -2645,27 +2642,6 @@ static inline void skb_checksum_none_assert(const struct sk_buff *skb)
2645 2642
2646bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off); 2643bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off);
2647 2644
2648static inline bool skb_is_recycleable(const struct sk_buff *skb, int skb_size)
2649{
2650 if (irqs_disabled())
2651 return false;
2652
2653 if (skb_shinfo(skb)->tx_flags & SKBTX_DEV_ZEROCOPY)
2654 return false;
2655
2656 if (skb_is_nonlinear(skb) || skb->fclone != SKB_FCLONE_UNAVAILABLE)
2657 return false;
2658
2659 skb_size = SKB_DATA_ALIGN(skb_size + NET_SKB_PAD);
2660 if (skb_end_offset(skb) < skb_size)
2661 return false;
2662
2663 if (skb_shared(skb) || skb_cloned(skb))
2664 return false;
2665
2666 return true;
2667}
2668
2669/** 2645/**
2670 * skb_head_is_locked - Determine if the skb->head is locked down 2646 * skb_head_is_locked - Determine if the skb->head is locked down
2671 * @skb: skb to check 2647 * @skb: skb to check
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 0dd2dfa7beca..83d1a1454b7e 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -321,7 +321,8 @@ static inline void *kmem_cache_alloc_node(struct kmem_cache *cachep,
321 * request comes from. 321 * request comes from.
322 */ 322 */
323#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \ 323#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \
324 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) 324 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) || \
325 (defined(CONFIG_SLOB) && defined(CONFIG_TRACING))
325extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long); 326extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long);
326#define kmalloc_track_caller(size, flags) \ 327#define kmalloc_track_caller(size, flags) \
327 __kmalloc_track_caller(size, flags, _RET_IP_) 328 __kmalloc_track_caller(size, flags, _RET_IP_)
@@ -340,7 +341,8 @@ extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long);
340 * allocation request comes from. 341 * allocation request comes from.
341 */ 342 */
342#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \ 343#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \
343 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) 344 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) || \
345 (defined(CONFIG_SLOB) && defined(CONFIG_TRACING))
344extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long); 346extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long);
345#define kmalloc_node_track_caller(size, flags, node) \ 347#define kmalloc_node_track_caller(size, flags, node) \
346 __kmalloc_node_track_caller(size, flags, node, \ 348 __kmalloc_node_track_caller(size, flags, node, \
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 0c634fa376c9..cc290f0bdb34 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -45,7 +45,6 @@ struct kmem_cache {
45 unsigned int colour_off; /* colour offset */ 45 unsigned int colour_off; /* colour offset */
46 struct kmem_cache *slabp_cache; 46 struct kmem_cache *slabp_cache;
47 unsigned int slab_size; 47 unsigned int slab_size;
48 unsigned int dflags; /* dynamic flags */
49 48
50 /* constructor func */ 49 /* constructor func */
51 void (*ctor)(void *obj); 50 void (*ctor)(void *obj);
@@ -112,19 +111,13 @@ void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
112void *__kmalloc(size_t size, gfp_t flags); 111void *__kmalloc(size_t size, gfp_t flags);
113 112
114#ifdef CONFIG_TRACING 113#ifdef CONFIG_TRACING
115extern void *kmem_cache_alloc_trace(size_t size, 114extern void *kmem_cache_alloc_trace(struct kmem_cache *, gfp_t, size_t);
116 struct kmem_cache *cachep, gfp_t flags);
117extern size_t slab_buffer_size(struct kmem_cache *cachep);
118#else 115#else
119static __always_inline void * 116static __always_inline void *
120kmem_cache_alloc_trace(size_t size, struct kmem_cache *cachep, gfp_t flags) 117kmem_cache_alloc_trace(struct kmem_cache *cachep, gfp_t flags, size_t size)
121{ 118{
122 return kmem_cache_alloc(cachep, flags); 119 return kmem_cache_alloc(cachep, flags);
123} 120}
124static inline size_t slab_buffer_size(struct kmem_cache *cachep)
125{
126 return 0;
127}
128#endif 121#endif
129 122
130static __always_inline void *kmalloc(size_t size, gfp_t flags) 123static __always_inline void *kmalloc(size_t size, gfp_t flags)
@@ -154,7 +147,7 @@ found:
154#endif 147#endif
155 cachep = malloc_sizes[i].cs_cachep; 148 cachep = malloc_sizes[i].cs_cachep;
156 149
157 ret = kmem_cache_alloc_trace(size, cachep, flags); 150 ret = kmem_cache_alloc_trace(cachep, flags, size);
158 151
159 return ret; 152 return ret;
160 } 153 }
@@ -166,16 +159,16 @@ extern void *__kmalloc_node(size_t size, gfp_t flags, int node);
166extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); 159extern void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
167 160
168#ifdef CONFIG_TRACING 161#ifdef CONFIG_TRACING
169extern void *kmem_cache_alloc_node_trace(size_t size, 162extern void *kmem_cache_alloc_node_trace(struct kmem_cache *cachep,
170 struct kmem_cache *cachep,
171 gfp_t flags, 163 gfp_t flags,
172 int nodeid); 164 int nodeid,
165 size_t size);
173#else 166#else
174static __always_inline void * 167static __always_inline void *
175kmem_cache_alloc_node_trace(size_t size, 168kmem_cache_alloc_node_trace(struct kmem_cache *cachep,
176 struct kmem_cache *cachep,
177 gfp_t flags, 169 gfp_t flags,
178 int nodeid) 170 int nodeid,
171 size_t size)
179{ 172{
180 return kmem_cache_alloc_node(cachep, flags, nodeid); 173 return kmem_cache_alloc_node(cachep, flags, nodeid);
181} 174}
@@ -207,7 +200,7 @@ found:
207#endif 200#endif
208 cachep = malloc_sizes[i].cs_cachep; 201 cachep = malloc_sizes[i].cs_cachep;
209 202
210 return kmem_cache_alloc_node_trace(size, cachep, flags, node); 203 return kmem_cache_alloc_node_trace(cachep, flags, node, size);
211 } 204 }
212 return __kmalloc_node(size, flags, node); 205 return __kmalloc_node(size, flags, node);
213} 206}
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h
index 0ec00b39d006..f28e14a12e3f 100644
--- a/include/linux/slob_def.h
+++ b/include/linux/slob_def.h
@@ -1,12 +1,14 @@
1#ifndef __LINUX_SLOB_DEF_H 1#ifndef __LINUX_SLOB_DEF_H
2#define __LINUX_SLOB_DEF_H 2#define __LINUX_SLOB_DEF_H
3 3
4#include <linux/numa.h>
5
4void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node); 6void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
5 7
6static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep, 8static __always_inline void *kmem_cache_alloc(struct kmem_cache *cachep,
7 gfp_t flags) 9 gfp_t flags)
8{ 10{
9 return kmem_cache_alloc_node(cachep, flags, -1); 11 return kmem_cache_alloc_node(cachep, flags, NUMA_NO_NODE);
10} 12}
11 13
12void *__kmalloc_node(size_t size, gfp_t flags, int node); 14void *__kmalloc_node(size_t size, gfp_t flags, int node);
@@ -26,7 +28,7 @@ static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
26 */ 28 */
27static __always_inline void *kmalloc(size_t size, gfp_t flags) 29static __always_inline void *kmalloc(size_t size, gfp_t flags)
28{ 30{
29 return __kmalloc_node(size, flags, -1); 31 return __kmalloc_node(size, flags, NUMA_NO_NODE);
30} 32}
31 33
32static __always_inline void *__kmalloc(size_t size, gfp_t flags) 34static __always_inline void *__kmalloc(size_t size, gfp_t flags)
diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h
index e3e395acc2fd..e8d702e0fd89 100644
--- a/include/linux/sock_diag.h
+++ b/include/linux/sock_diag.h
@@ -1,29 +1,8 @@
1#ifndef __SOCK_DIAG_H__ 1#ifndef __SOCK_DIAG_H__
2#define __SOCK_DIAG_H__ 2#define __SOCK_DIAG_H__
3 3
4#include <linux/types.h> 4#include <uapi/linux/sock_diag.h>
5 5
6#define SOCK_DIAG_BY_FAMILY 20
7
8struct sock_diag_req {
9 __u8 sdiag_family;
10 __u8 sdiag_protocol;
11};
12
13enum {
14 SK_MEMINFO_RMEM_ALLOC,
15 SK_MEMINFO_RCVBUF,
16 SK_MEMINFO_WMEM_ALLOC,
17 SK_MEMINFO_SNDBUF,
18 SK_MEMINFO_FWD_ALLOC,
19 SK_MEMINFO_WMEM_QUEUED,
20 SK_MEMINFO_OPTMEM,
21 SK_MEMINFO_BACKLOG,
22
23 SK_MEMINFO_VARS,
24};
25
26#ifdef __KERNEL__
27struct sk_buff; 6struct sk_buff;
28struct nlmsghdr; 7struct nlmsghdr;
29struct sock; 8struct sock;
@@ -44,5 +23,4 @@ void sock_diag_save_cookie(void *sk, __u32 *cookie);
44 23
45int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attr); 24int sock_diag_put_meminfo(struct sock *sk, struct sk_buff *skb, int attr);
46 25
47#endif /* KERNEL */
48#endif 26#endif
diff --git a/include/linux/socket.h b/include/linux/socket.h
index ba7b2e817cfa..9a546ff853dc 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -1,30 +1,13 @@
1#ifndef _LINUX_SOCKET_H 1#ifndef _LINUX_SOCKET_H
2#define _LINUX_SOCKET_H 2#define _LINUX_SOCKET_H
3 3
4/*
5 * Desired design of maximum size and alignment (see RFC2553)
6 */
7#define _K_SS_MAXSIZE 128 /* Implementation specific max size */
8#define _K_SS_ALIGNSIZE (__alignof__ (struct sockaddr *))
9 /* Implementation specific desired alignment */
10
11typedef unsigned short __kernel_sa_family_t;
12
13struct __kernel_sockaddr_storage {
14 __kernel_sa_family_t ss_family; /* address family */
15 /* Following field(s) are implementation specific */
16 char __data[_K_SS_MAXSIZE - sizeof(unsigned short)];
17 /* space to achieve desired size, */
18 /* _SS_MAXSIZE value minus size of ss_family */
19} __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */
20
21#ifdef __KERNEL__
22 4
23#include <asm/socket.h> /* arch-dependent defines */ 5#include <asm/socket.h> /* arch-dependent defines */
24#include <linux/sockios.h> /* the SIOCxxx I/O controls */ 6#include <linux/sockios.h> /* the SIOCxxx I/O controls */
25#include <linux/uio.h> /* iovec support */ 7#include <linux/uio.h> /* iovec support */
26#include <linux/types.h> /* pid_t */ 8#include <linux/types.h> /* pid_t */
27#include <linux/compiler.h> /* __user */ 9#include <linux/compiler.h> /* __user */
10#include <uapi/linux/socket.h>
28 11
29struct pid; 12struct pid;
30struct cred; 13struct cred;
@@ -340,5 +323,4 @@ extern int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen
340 unsigned int flags, struct timespec *timeout); 323 unsigned int flags, struct timespec *timeout);
341extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, 324extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg,
342 unsigned int vlen, unsigned int flags); 325 unsigned int vlen, unsigned int flags);
343#endif /* not kernel and not glibc */
344#endif /* _LINUX_SOCKET_H */ 326#endif /* _LINUX_SOCKET_H */
diff --git a/include/linux/sonet.h b/include/linux/sonet.h
index de8832dd272b..680f9a31df25 100644
--- a/include/linux/sonet.h
+++ b/include/linux/sonet.h
@@ -1,64 +1,10 @@
1/* sonet.h - SONET/SHD physical layer control */ 1/* sonet.h - SONET/SHD physical layer control */
2
3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
4
5
6#ifndef LINUX_SONET_H 2#ifndef LINUX_SONET_H
7#define LINUX_SONET_H 3#define LINUX_SONET_H
8 4
9#define __SONET_ITEMS \
10 __HANDLE_ITEM(section_bip); /* section parity errors (B1) */ \
11 __HANDLE_ITEM(line_bip); /* line parity errors (B2) */ \
12 __HANDLE_ITEM(path_bip); /* path parity errors (B3) */ \
13 __HANDLE_ITEM(line_febe); /* line parity errors at remote */ \
14 __HANDLE_ITEM(path_febe); /* path parity errors at remote */ \
15 __HANDLE_ITEM(corr_hcs); /* correctable header errors */ \
16 __HANDLE_ITEM(uncorr_hcs); /* uncorrectable header errors */ \
17 __HANDLE_ITEM(tx_cells); /* cells sent */ \
18 __HANDLE_ITEM(rx_cells); /* cells received */
19
20struct sonet_stats {
21#define __HANDLE_ITEM(i) int i
22 __SONET_ITEMS
23#undef __HANDLE_ITEM
24} __attribute__ ((packed));
25
26
27#define SONET_GETSTAT _IOR('a',ATMIOC_PHYTYP,struct sonet_stats)
28 /* get statistics */
29#define SONET_GETSTATZ _IOR('a',ATMIOC_PHYTYP+1,struct sonet_stats)
30 /* ... and zero counters */
31#define SONET_SETDIAG _IOWR('a',ATMIOC_PHYTYP+2,int)
32 /* set error insertion */
33#define SONET_CLRDIAG _IOWR('a',ATMIOC_PHYTYP+3,int)
34 /* clear error insertion */
35#define SONET_GETDIAG _IOR('a',ATMIOC_PHYTYP+4,int)
36 /* query error insertion */
37#define SONET_SETFRAMING _IOW('a',ATMIOC_PHYTYP+5,int)
38 /* set framing mode (SONET/SDH) */
39#define SONET_GETFRAMING _IOR('a',ATMIOC_PHYTYP+6,int)
40 /* get framing mode */
41#define SONET_GETFRSENSE _IOR('a',ATMIOC_PHYTYP+7, \
42 unsigned char[SONET_FRSENSE_SIZE]) /* get framing sense information */
43
44#define SONET_INS_SBIP 1 /* section BIP */
45#define SONET_INS_LBIP 2 /* line BIP */
46#define SONET_INS_PBIP 4 /* path BIP */
47#define SONET_INS_FRAME 8 /* out of frame */
48#define SONET_INS_LOS 16 /* set line to zero */
49#define SONET_INS_LAIS 32 /* line alarm indication signal */
50#define SONET_INS_PAIS 64 /* path alarm indication signal */
51#define SONET_INS_HCS 128 /* insert HCS error */
52
53#define SONET_FRAME_SONET 0 /* SONET STS-3 framing */
54#define SONET_FRAME_SDH 1 /* SDH STM-1 framing */
55
56#define SONET_FRSENSE_SIZE 6 /* C1[3],H1[3] (0xff for unknown) */
57
58
59#ifdef __KERNEL__
60 5
61#include <linux/atomic.h> 6#include <linux/atomic.h>
7#include <uapi/linux/sonet.h>
62 8
63struct k_sonet_stats { 9struct k_sonet_stats {
64#define __HANDLE_ITEM(i) atomic_t i 10#define __HANDLE_ITEM(i) atomic_t i
@@ -71,5 +17,3 @@ extern void sonet_subtract_stats(struct k_sonet_stats *from,
71 struct sonet_stats *to); 17 struct sonet_stats *to);
72 18
73#endif 19#endif
74
75#endif
diff --git a/include/linux/sonypi.h b/include/linux/sonypi.h
index c0f87da78f8a..0b7cc265cc0b 100644
--- a/include/linux/sonypi.h
+++ b/include/linux/sonypi.h
@@ -32,117 +32,11 @@
32 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 32 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
33 * 33 *
34 */ 34 */
35
36#ifndef _SONYPI_H_ 35#ifndef _SONYPI_H_
37#define _SONYPI_H_ 36#define _SONYPI_H_
38 37
39#include <linux/types.h> 38#include <uapi/linux/sonypi.h>
40
41/* events the user application reading /dev/sonypi can use */
42
43#define SONYPI_EVENT_IGNORE 0
44#define SONYPI_EVENT_JOGDIAL_DOWN 1
45#define SONYPI_EVENT_JOGDIAL_UP 2
46#define SONYPI_EVENT_JOGDIAL_DOWN_PRESSED 3
47#define SONYPI_EVENT_JOGDIAL_UP_PRESSED 4
48#define SONYPI_EVENT_JOGDIAL_PRESSED 5
49#define SONYPI_EVENT_JOGDIAL_RELEASED 6 /* obsolete */
50#define SONYPI_EVENT_CAPTURE_PRESSED 7
51#define SONYPI_EVENT_CAPTURE_RELEASED 8 /* obsolete */
52#define SONYPI_EVENT_CAPTURE_PARTIALPRESSED 9
53#define SONYPI_EVENT_CAPTURE_PARTIALRELEASED 10
54#define SONYPI_EVENT_FNKEY_ESC 11
55#define SONYPI_EVENT_FNKEY_F1 12
56#define SONYPI_EVENT_FNKEY_F2 13
57#define SONYPI_EVENT_FNKEY_F3 14
58#define SONYPI_EVENT_FNKEY_F4 15
59#define SONYPI_EVENT_FNKEY_F5 16
60#define SONYPI_EVENT_FNKEY_F6 17
61#define SONYPI_EVENT_FNKEY_F7 18
62#define SONYPI_EVENT_FNKEY_F8 19
63#define SONYPI_EVENT_FNKEY_F9 20
64#define SONYPI_EVENT_FNKEY_F10 21
65#define SONYPI_EVENT_FNKEY_F11 22
66#define SONYPI_EVENT_FNKEY_F12 23
67#define SONYPI_EVENT_FNKEY_1 24
68#define SONYPI_EVENT_FNKEY_2 25
69#define SONYPI_EVENT_FNKEY_D 26
70#define SONYPI_EVENT_FNKEY_E 27
71#define SONYPI_EVENT_FNKEY_F 28
72#define SONYPI_EVENT_FNKEY_S 29
73#define SONYPI_EVENT_FNKEY_B 30
74#define SONYPI_EVENT_BLUETOOTH_PRESSED 31
75#define SONYPI_EVENT_PKEY_P1 32
76#define SONYPI_EVENT_PKEY_P2 33
77#define SONYPI_EVENT_PKEY_P3 34
78#define SONYPI_EVENT_BACK_PRESSED 35
79#define SONYPI_EVENT_LID_CLOSED 36
80#define SONYPI_EVENT_LID_OPENED 37
81#define SONYPI_EVENT_BLUETOOTH_ON 38
82#define SONYPI_EVENT_BLUETOOTH_OFF 39
83#define SONYPI_EVENT_HELP_PRESSED 40
84#define SONYPI_EVENT_FNKEY_ONLY 41
85#define SONYPI_EVENT_JOGDIAL_FAST_DOWN 42
86#define SONYPI_EVENT_JOGDIAL_FAST_UP 43
87#define SONYPI_EVENT_JOGDIAL_FAST_DOWN_PRESSED 44
88#define SONYPI_EVENT_JOGDIAL_FAST_UP_PRESSED 45
89#define SONYPI_EVENT_JOGDIAL_VFAST_DOWN 46
90#define SONYPI_EVENT_JOGDIAL_VFAST_UP 47
91#define SONYPI_EVENT_JOGDIAL_VFAST_DOWN_PRESSED 48
92#define SONYPI_EVENT_JOGDIAL_VFAST_UP_PRESSED 49
93#define SONYPI_EVENT_ZOOM_PRESSED 50
94#define SONYPI_EVENT_THUMBPHRASE_PRESSED 51
95#define SONYPI_EVENT_MEYE_FACE 52
96#define SONYPI_EVENT_MEYE_OPPOSITE 53
97#define SONYPI_EVENT_MEMORYSTICK_INSERT 54
98#define SONYPI_EVENT_MEMORYSTICK_EJECT 55
99#define SONYPI_EVENT_ANYBUTTON_RELEASED 56
100#define SONYPI_EVENT_BATTERY_INSERT 57
101#define SONYPI_EVENT_BATTERY_REMOVE 58
102#define SONYPI_EVENT_FNKEY_RELEASED 59
103#define SONYPI_EVENT_WIRELESS_ON 60
104#define SONYPI_EVENT_WIRELESS_OFF 61
105#define SONYPI_EVENT_ZOOM_IN_PRESSED 62
106#define SONYPI_EVENT_ZOOM_OUT_PRESSED 63
107#define SONYPI_EVENT_CD_EJECT_PRESSED 64
108#define SONYPI_EVENT_MODEKEY_PRESSED 65
109#define SONYPI_EVENT_PKEY_P4 66
110#define SONYPI_EVENT_PKEY_P5 67
111#define SONYPI_EVENT_SETTINGKEY_PRESSED 68
112#define SONYPI_EVENT_VOLUME_INC_PRESSED 69
113#define SONYPI_EVENT_VOLUME_DEC_PRESSED 70
114#define SONYPI_EVENT_BRIGHTNESS_PRESSED 71
115#define SONYPI_EVENT_MEDIA_PRESSED 72
116#define SONYPI_EVENT_VENDOR_PRESSED 73
117
118/* get/set brightness */
119#define SONYPI_IOCGBRT _IOR('v', 0, __u8)
120#define SONYPI_IOCSBRT _IOW('v', 0, __u8)
121
122/* get battery full capacity/remaining capacity */
123#define SONYPI_IOCGBAT1CAP _IOR('v', 2, __u16)
124#define SONYPI_IOCGBAT1REM _IOR('v', 3, __u16)
125#define SONYPI_IOCGBAT2CAP _IOR('v', 4, __u16)
126#define SONYPI_IOCGBAT2REM _IOR('v', 5, __u16)
127 39
128/* get battery flags: battery1/battery2/ac adapter present */
129#define SONYPI_BFLAGS_B1 0x01
130#define SONYPI_BFLAGS_B2 0x02
131#define SONYPI_BFLAGS_AC 0x04
132#define SONYPI_IOCGBATFLAGS _IOR('v', 7, __u8)
133
134/* get/set bluetooth subsystem state on/off */
135#define SONYPI_IOCGBLUE _IOR('v', 8, __u8)
136#define SONYPI_IOCSBLUE _IOW('v', 9, __u8)
137
138/* get/set fan state on/off */
139#define SONYPI_IOCGFAN _IOR('v', 10, __u8)
140#define SONYPI_IOCSFAN _IOW('v', 11, __u8)
141
142/* get temperature (C) */
143#define SONYPI_IOCGTEMP _IOR('v', 12, __u8)
144
145#ifdef __KERNEL__
146 40
147/* used only for communication between v4l and sonypi */ 41/* used only for communication between v4l and sonypi */
148 42
@@ -166,6 +60,4 @@
166#define SONYPI_COMMAND_GETCAMERAROMVERSION 18 /* obsolete */ 60#define SONYPI_COMMAND_GETCAMERAROMVERSION 18 /* obsolete */
167#define SONYPI_COMMAND_GETCAMERAREVISION 19 /* obsolete */ 61#define SONYPI_COMMAND_GETCAMERAREVISION 19 /* obsolete */
168 62
169#endif /* __KERNEL__ */
170
171#endif /* _SONYPI_H_ */ 63#endif /* _SONYPI_H_ */
diff --git a/include/linux/sound.h b/include/linux/sound.h
index fae20ba01fbf..73ded040f1d7 100644
--- a/include/linux/sound.h
+++ b/include/linux/sound.h
@@ -1,33 +1,8 @@
1#ifndef _LINUX_SOUND_H 1#ifndef _LINUX_SOUND_H
2#define _LINUX_SOUND_H 2#define _LINUX_SOUND_H
3 3
4/* 4#include <uapi/linux/sound.h>
5 * Minor numbers for the sound driver.
6 */
7
8#include <linux/fs.h>
9 5
10#define SND_DEV_CTL 0 /* Control port /dev/mixer */
11#define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM
12 synthesizer and MIDI output) */
13#define SND_DEV_MIDIN 2 /* Raw midi access */
14#define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */
15#define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */
16#define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */
17/* #define SND_DEV_STATUS 6 */ /* /dev/sndstat (obsolete) */
18#define SND_DEV_UNUSED 6
19#define SND_DEV_AWFM 7 /* Reserved */
20#define SND_DEV_SEQ2 8 /* /dev/sequencer, level 2 interface */
21/* #define SND_DEV_SNDPROC 9 */ /* /dev/sndproc for programmable devices (not used) */
22/* #define SND_DEV_DMMIDI 9 */
23#define SND_DEV_SYNTH 9 /* Raw synth access /dev/synth (same as /dev/dmfm) */
24#define SND_DEV_DMFM 10 /* Raw synth access /dev/dmfm */
25#define SND_DEV_UNKNOWN11 11
26#define SND_DEV_ADSP 12 /* Like /dev/dsp (obsolete) */
27#define SND_DEV_AMIDI 13 /* Like /dev/midi (obsolete) */
28#define SND_DEV_ADMMIDI 14 /* Like /dev/dmmidi (onsolete) */
29
30#ifdef __KERNEL__
31/* 6/*
32 * Sound core interface functions 7 * Sound core interface functions
33 */ 8 */
@@ -43,6 +18,4 @@ extern void unregister_sound_special(int unit);
43extern void unregister_sound_mixer(int unit); 18extern void unregister_sound_mixer(int unit);
44extern void unregister_sound_midi(int unit); 19extern void unregister_sound_midi(int unit);
45extern void unregister_sound_dsp(int unit); 20extern void unregister_sound_dsp(int unit);
46#endif /* __KERNEL__ */
47
48#endif /* _LINUX_SOUND_H */ 21#endif /* _LINUX_SOUND_H */
diff --git a/include/linux/soundcard.h b/include/linux/soundcard.h
index dfcf86f013a9..96c79cbd79ef 100644
--- a/include/linux/soundcard.h
+++ b/include/linux/soundcard.h
@@ -1,5 +1,3 @@
1#ifndef SOUNDCARD_H
2#define SOUNDCARD_H
3/* 1/*
4 * Copyright by Hannu Savolainen 1993-1997 2 * Copyright by Hannu Savolainen 1993-1997
5 * 3 *
@@ -23,174 +21,12 @@
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 21 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE. 22 * SUCH DAMAGE.
25 */ 23 */
24#ifndef SOUNDCARD_H
25#define SOUNDCARD_H
26 26
27
28/*
29 * OSS interface version. With versions earlier than 3.6 this value is
30 * an integer with value less than 361. In versions 3.6 and later
31 * it's a six digit hexadecimal value. For example value
32 * of 0x030600 represents OSS version 3.6.0.
33 * Use ioctl(fd, OSS_GETVERSION, &int) to get the version number of
34 * the currently active driver.
35 */
36#define SOUND_VERSION 0x030802
37#define OPEN_SOUND_SYSTEM
38
39/* In Linux we need to be prepared for cross compiling */
40#include <linux/ioctl.h>
41
42/* Endian macros. */
43#ifdef __KERNEL__
44# include <asm/byteorder.h> 27# include <asm/byteorder.h>
45#else 28#include <uapi/linux/soundcard.h>
46# include <endian.h>
47#endif
48
49/*
50 * Supported card ID numbers (Should be somewhere else?)
51 */
52
53#define SNDCARD_ADLIB 1
54#define SNDCARD_SB 2
55#define SNDCARD_PAS 3
56#define SNDCARD_GUS 4
57#define SNDCARD_MPU401 5
58#define SNDCARD_SB16 6
59#define SNDCARD_SB16MIDI 7
60#define SNDCARD_UART6850 8
61#define SNDCARD_GUS16 9
62#define SNDCARD_MSS 10
63#define SNDCARD_PSS 11
64#define SNDCARD_SSCAPE 12
65#define SNDCARD_PSS_MPU 13
66#define SNDCARD_PSS_MSS 14
67#define SNDCARD_SSCAPE_MSS 15
68#define SNDCARD_TRXPRO 16
69#define SNDCARD_TRXPRO_SB 17
70#define SNDCARD_TRXPRO_MPU 18
71#define SNDCARD_MAD16 19
72#define SNDCARD_MAD16_MPU 20
73#define SNDCARD_CS4232 21
74#define SNDCARD_CS4232_MPU 22
75#define SNDCARD_MAUI 23
76#define SNDCARD_PSEUDO_MSS 24
77#define SNDCARD_GUSPNP 25
78#define SNDCARD_UART401 26
79/* Sound card numbers 27 to N are reserved. Don't add more numbers here. */
80
81/***********************************
82 * IOCTL Commands for /dev/sequencer
83 */
84
85#ifndef _SIOWR
86#if defined(_IOWR) && (defined(_AIX) || (!defined(sun) && !defined(sparc) && !defined(__sparc__) && !defined(__INCioctlh) && !defined(__Lynx__)))
87/* Use already defined ioctl defines if they exist (except with Sun or Sparc) */
88#define SIOCPARM_MASK IOCPARM_MASK
89#define SIOC_VOID IOC_VOID
90#define SIOC_OUT IOC_OUT
91#define SIOC_IN IOC_IN
92#define SIOC_INOUT IOC_INOUT
93#define _SIOC_SIZE _IOC_SIZE
94#define _SIOC_DIR _IOC_DIR
95#define _SIOC_NONE _IOC_NONE
96#define _SIOC_READ _IOC_READ
97#define _SIOC_WRITE _IOC_WRITE
98#define _SIO _IO
99#define _SIOR _IOR
100#define _SIOW _IOW
101#define _SIOWR _IOWR
102#else
103 29
104/* Ioctl's have the command encoded in the lower word,
105 * and the size of any in or out parameters in the upper
106 * word. The high 2 bits of the upper word are used
107 * to encode the in/out status of the parameter; for now
108 * we restrict parameters to at most 8191 bytes.
109 */
110/* #define SIOCTYPE (0xff<<8) */
111#define SIOCPARM_MASK 0x1fff /* parameters must be < 8192 bytes */
112#define SIOC_VOID 0x00000000 /* no parameters */
113#define SIOC_OUT 0x20000000 /* copy out parameters */
114#define SIOC_IN 0x40000000 /* copy in parameters */
115#define SIOC_INOUT (SIOC_IN|SIOC_OUT)
116/* the 0x20000000 is so we can distinguish new ioctl's from old */
117#define _SIO(x,y) ((int)(SIOC_VOID|(x<<8)|y))
118#define _SIOR(x,y,t) ((int)(SIOC_OUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
119#define _SIOW(x,y,t) ((int)(SIOC_IN|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
120/* this should be _SIORW, but stdio got there first */
121#define _SIOWR(x,y,t) ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
122#define _SIOC_SIZE(x) ((x>>16)&SIOCPARM_MASK)
123#define _SIOC_DIR(x) (x & 0xf0000000)
124#define _SIOC_NONE SIOC_VOID
125#define _SIOC_READ SIOC_OUT
126#define _SIOC_WRITE SIOC_IN
127# endif /* _IOWR */
128#endif /* !_SIOWR */
129
130#define SNDCTL_SEQ_RESET _SIO ('Q', 0)
131#define SNDCTL_SEQ_SYNC _SIO ('Q', 1)
132#define SNDCTL_SYNTH_INFO _SIOWR('Q', 2, struct synth_info)
133#define SNDCTL_SEQ_CTRLRATE _SIOWR('Q', 3, int) /* Set/get timer resolution (HZ) */
134#define SNDCTL_SEQ_GETOUTCOUNT _SIOR ('Q', 4, int)
135#define SNDCTL_SEQ_GETINCOUNT _SIOR ('Q', 5, int)
136#define SNDCTL_SEQ_PERCMODE _SIOW ('Q', 6, int)
137#define SNDCTL_FM_LOAD_INSTR _SIOW ('Q', 7, struct sbi_instrument) /* Obsolete. Don't use!!!!!! */
138#define SNDCTL_SEQ_TESTMIDI _SIOW ('Q', 8, int)
139#define SNDCTL_SEQ_RESETSAMPLES _SIOW ('Q', 9, int)
140#define SNDCTL_SEQ_NRSYNTHS _SIOR ('Q',10, int)
141#define SNDCTL_SEQ_NRMIDIS _SIOR ('Q',11, int)
142#define SNDCTL_MIDI_INFO _SIOWR('Q',12, struct midi_info)
143#define SNDCTL_SEQ_THRESHOLD _SIOW ('Q',13, int)
144#define SNDCTL_SYNTH_MEMAVL _SIOWR('Q',14, int) /* in=dev#, out=memsize */
145#define SNDCTL_FM_4OP_ENABLE _SIOW ('Q',15, int) /* in=dev# */
146#define SNDCTL_SEQ_PANIC _SIO ('Q',17)
147#define SNDCTL_SEQ_OUTOFBAND _SIOW ('Q',18, struct seq_event_rec)
148#define SNDCTL_SEQ_GETTIME _SIOR ('Q',19, int)
149#define SNDCTL_SYNTH_ID _SIOWR('Q',20, struct synth_info)
150#define SNDCTL_SYNTH_CONTROL _SIOWR('Q',21, struct synth_control)
151#define SNDCTL_SYNTH_REMOVESAMPLE _SIOWR('Q',22, struct remove_sample)
152
153typedef struct synth_control
154{
155 int devno; /* Synthesizer # */
156 char data[4000]; /* Device spesific command/data record */
157}synth_control;
158
159typedef struct remove_sample
160{
161 int devno; /* Synthesizer # */
162 int bankno; /* MIDI bank # (0=General MIDI) */
163 int instrno; /* MIDI instrument number */
164} remove_sample;
165
166typedef struct seq_event_rec {
167 unsigned char arr[8];
168} seq_event_rec;
169
170#define SNDCTL_TMR_TIMEBASE _SIOWR('T', 1, int)
171#define SNDCTL_TMR_START _SIO ('T', 2)
172#define SNDCTL_TMR_STOP _SIO ('T', 3)
173#define SNDCTL_TMR_CONTINUE _SIO ('T', 4)
174#define SNDCTL_TMR_TEMPO _SIOWR('T', 5, int)
175#define SNDCTL_TMR_SOURCE _SIOWR('T', 6, int)
176# define TMR_INTERNAL 0x00000001
177# define TMR_EXTERNAL 0x00000002
178# define TMR_MODE_MIDI 0x00000010
179# define TMR_MODE_FSK 0x00000020
180# define TMR_MODE_CLS 0x00000040
181# define TMR_MODE_SMPTE 0x00000080
182#define SNDCTL_TMR_METRONOME _SIOW ('T', 7, int)
183#define SNDCTL_TMR_SELECT _SIOW ('T', 8, int)
184
185/*
186 * Some big endian/little endian handling macros
187 */
188
189#define _LINUX_PATCHKEY_H_INDIRECT
190#include <linux/patchkey.h>
191#undef _LINUX_PATCHKEY_H_INDIRECT
192
193#if defined(__KERNEL__)
194# if defined(__BIG_ENDIAN) 30# if defined(__BIG_ENDIAN)
195# define AFMT_S16_NE AFMT_S16_BE 31# define AFMT_S16_NE AFMT_S16_BE
196# elif defined(__LITTLE_ENDIAN) 32# elif defined(__LITTLE_ENDIAN)
@@ -198,1095 +34,4 @@ typedef struct seq_event_rec {
198# else 34# else
199# error "could not determine byte order" 35# error "could not determine byte order"
200# endif 36# endif
201#else
202# if defined(__BYTE_ORDER)
203# if __BYTE_ORDER == __BIG_ENDIAN
204# define AFMT_S16_NE AFMT_S16_BE
205# elif __BYTE_ORDER == __LITTLE_ENDIAN
206# define AFMT_S16_NE AFMT_S16_LE
207# else
208# error "could not determine byte order"
209# endif
210# endif
211#endif
212
213/*
214 * Sample loading mechanism for internal synthesizers (/dev/sequencer)
215 * The following patch_info structure has been designed to support
216 * Gravis UltraSound. It tries to be universal format for uploading
217 * sample based patches but is probably too limited.
218 *
219 * (PBD) As Hannu guessed, the GUS structure is too limited for
220 * the WaveFront, but this is the right place for a constant definition.
221 */
222
223struct patch_info {
224 unsigned short key; /* Use WAVE_PATCH here */
225#define WAVE_PATCH _PATCHKEY(0x04)
226#define GUS_PATCH WAVE_PATCH
227#define WAVEFRONT_PATCH _PATCHKEY(0x06)
228
229 short device_no; /* Synthesizer number */
230 short instr_no; /* Midi pgm# */
231
232 unsigned int mode;
233/*
234 * The least significant byte has the same format than the GUS .PAT
235 * files
236 */
237#define WAVE_16_BITS 0x01 /* bit 0 = 8 or 16 bit wave data. */
238#define WAVE_UNSIGNED 0x02 /* bit 1 = Signed - Unsigned data. */
239#define WAVE_LOOPING 0x04 /* bit 2 = looping enabled-1. */
240#define WAVE_BIDIR_LOOP 0x08 /* bit 3 = Set is bidirectional looping. */
241#define WAVE_LOOP_BACK 0x10 /* bit 4 = Set is looping backward. */
242#define WAVE_SUSTAIN_ON 0x20 /* bit 5 = Turn sustaining on. (Env. pts. 3)*/
243#define WAVE_ENVELOPES 0x40 /* bit 6 = Enable envelopes - 1 */
244#define WAVE_FAST_RELEASE 0x80 /* bit 7 = Shut off immediately after note off */
245 /* (use the env_rate/env_offs fields). */
246/* Linux specific bits */
247#define WAVE_VIBRATO 0x00010000 /* The vibrato info is valid */
248#define WAVE_TREMOLO 0x00020000 /* The tremolo info is valid */
249#define WAVE_SCALE 0x00040000 /* The scaling info is valid */
250#define WAVE_FRACTIONS 0x00080000 /* Fraction information is valid */
251/* Reserved bits */
252#define WAVE_ROM 0x40000000 /* For future use */
253#define WAVE_MULAW 0x20000000 /* For future use */
254/* Other bits must be zeroed */
255
256 int len; /* Size of the wave data in bytes */
257 int loop_start, loop_end; /* Byte offsets from the beginning */
258
259/*
260 * The base_freq and base_note fields are used when computing the
261 * playback speed for a note. The base_note defines the tone frequency
262 * which is heard if the sample is played using the base_freq as the
263 * playback speed.
264 *
265 * The low_note and high_note fields define the minimum and maximum note
266 * frequencies for which this sample is valid. It is possible to define
267 * more than one samples for an instrument number at the same time. The
268 * low_note and high_note fields are used to select the most suitable one.
269 *
270 * The fields base_note, high_note and low_note should contain
271 * the note frequency multiplied by 1000. For example value for the
272 * middle A is 440*1000.
273 */
274
275 unsigned int base_freq;
276 unsigned int base_note;
277 unsigned int high_note;
278 unsigned int low_note;
279 int panning; /* -128=left, 127=right */
280 int detuning;
281
282/* New fields introduced in version 1.99.5 */
283
284 /* Envelope. Enabled by mode bit WAVE_ENVELOPES */
285 unsigned char env_rate[ 6 ]; /* GUS HW ramping rate */
286 unsigned char env_offset[ 6 ]; /* 255 == 100% */
287
288 /*
289 * The tremolo, vibrato and scale info are not supported yet.
290 * Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or
291 * WAVE_SCALE
292 */
293
294 unsigned char tremolo_sweep;
295 unsigned char tremolo_rate;
296 unsigned char tremolo_depth;
297
298 unsigned char vibrato_sweep;
299 unsigned char vibrato_rate;
300 unsigned char vibrato_depth;
301
302 int scale_frequency;
303 unsigned int scale_factor; /* from 0 to 2048 or 0 to 2 */
304
305 int volume;
306 int fractions;
307 int reserved1;
308 int spare[2];
309 char data[1]; /* The waveform data starts here */
310 };
311
312struct sysex_info {
313 short key; /* Use SYSEX_PATCH or MAUI_PATCH here */
314#define SYSEX_PATCH _PATCHKEY(0x05)
315#define MAUI_PATCH _PATCHKEY(0x06)
316 short device_no; /* Synthesizer number */
317 int len; /* Size of the sysex data in bytes */
318 unsigned char data[1]; /* Sysex data starts here */
319 };
320
321/*
322 * /dev/sequencer input events.
323 *
324 * The data written to the /dev/sequencer is a stream of events. Events
325 * are records of 4 or 8 bytes. The first byte defines the size.
326 * Any number of events can be written with a write call. There
327 * is a set of macros for sending these events. Use these macros if you
328 * want to maximize portability of your program.
329 *
330 * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events.
331 * (All input events are currently 4 bytes long. Be prepared to support
332 * 8 byte events also. If you receive any event having first byte >= 128,
333 * it's a 8 byte event.
334 *
335 * The events are documented at the end of this file.
336 *
337 * Normal events (4 bytes)
338 * There is also a 8 byte version of most of the 4 byte events. The
339 * 8 byte one is recommended.
340 */
341#define SEQ_NOTEOFF 0
342#define SEQ_FMNOTEOFF SEQ_NOTEOFF /* Just old name */
343#define SEQ_NOTEON 1
344#define SEQ_FMNOTEON SEQ_NOTEON
345#define SEQ_WAIT TMR_WAIT_ABS
346#define SEQ_PGMCHANGE 3
347#define SEQ_FMPGMCHANGE SEQ_PGMCHANGE
348#define SEQ_SYNCTIMER TMR_START
349#define SEQ_MIDIPUTC 5
350#define SEQ_DRUMON 6 /*** OBSOLETE ***/
351#define SEQ_DRUMOFF 7 /*** OBSOLETE ***/
352#define SEQ_ECHO TMR_ECHO /* For synching programs with output */
353#define SEQ_AFTERTOUCH 9
354#define SEQ_CONTROLLER 10
355
356/*******************************************
357 * Midi controller numbers
358 *******************************************
359 * Controllers 0 to 31 (0x00 to 0x1f) and
360 * 32 to 63 (0x20 to 0x3f) are continuous
361 * controllers.
362 * In the MIDI 1.0 these controllers are sent using
363 * two messages. Controller numbers 0 to 31 are used
364 * to send the MSB and the controller numbers 32 to 63
365 * are for the LSB. Note that just 7 bits are used in MIDI bytes.
366 */
367
368#define CTL_BANK_SELECT 0x00
369#define CTL_MODWHEEL 0x01
370#define CTL_BREATH 0x02
371/* undefined 0x03 */
372#define CTL_FOOT 0x04
373#define CTL_PORTAMENTO_TIME 0x05
374#define CTL_DATA_ENTRY 0x06
375#define CTL_MAIN_VOLUME 0x07
376#define CTL_BALANCE 0x08
377/* undefined 0x09 */
378#define CTL_PAN 0x0a
379#define CTL_EXPRESSION 0x0b
380/* undefined 0x0c */
381/* undefined 0x0d */
382/* undefined 0x0e */
383/* undefined 0x0f */
384#define CTL_GENERAL_PURPOSE1 0x10
385#define CTL_GENERAL_PURPOSE2 0x11
386#define CTL_GENERAL_PURPOSE3 0x12
387#define CTL_GENERAL_PURPOSE4 0x13
388/* undefined 0x14 - 0x1f */
389
390/* undefined 0x20 */
391/* The controller numbers 0x21 to 0x3f are reserved for the */
392/* least significant bytes of the controllers 0x00 to 0x1f. */
393/* These controllers are not recognised by the driver. */
394
395/* Controllers 64 to 69 (0x40 to 0x45) are on/off switches. */
396/* 0=OFF and 127=ON (intermediate values are possible) */
397#define CTL_DAMPER_PEDAL 0x40
398#define CTL_SUSTAIN 0x40 /* Alias */
399#define CTL_HOLD 0x40 /* Alias */
400#define CTL_PORTAMENTO 0x41
401#define CTL_SOSTENUTO 0x42
402#define CTL_SOFT_PEDAL 0x43
403/* undefined 0x44 */
404#define CTL_HOLD2 0x45
405/* undefined 0x46 - 0x4f */
406
407#define CTL_GENERAL_PURPOSE5 0x50
408#define CTL_GENERAL_PURPOSE6 0x51
409#define CTL_GENERAL_PURPOSE7 0x52
410#define CTL_GENERAL_PURPOSE8 0x53
411/* undefined 0x54 - 0x5a */
412#define CTL_EXT_EFF_DEPTH 0x5b
413#define CTL_TREMOLO_DEPTH 0x5c
414#define CTL_CHORUS_DEPTH 0x5d
415#define CTL_DETUNE_DEPTH 0x5e
416#define CTL_CELESTE_DEPTH 0x5e /* Alias for the above one */
417#define CTL_PHASER_DEPTH 0x5f
418#define CTL_DATA_INCREMENT 0x60
419#define CTL_DATA_DECREMENT 0x61
420#define CTL_NONREG_PARM_NUM_LSB 0x62
421#define CTL_NONREG_PARM_NUM_MSB 0x63
422#define CTL_REGIST_PARM_NUM_LSB 0x64
423#define CTL_REGIST_PARM_NUM_MSB 0x65
424/* undefined 0x66 - 0x78 */
425/* reserved 0x79 - 0x7f */
426
427/* Pseudo controllers (not midi compatible) */
428#define CTRL_PITCH_BENDER 255
429#define CTRL_PITCH_BENDER_RANGE 254
430#define CTRL_EXPRESSION 253 /* Obsolete */
431#define CTRL_MAIN_VOLUME 252 /* Obsolete */
432#define SEQ_BALANCE 11
433#define SEQ_VOLMODE 12
434
435/*
436 * Volume mode decides how volumes are used
437 */
438
439#define VOL_METHOD_ADAGIO 1
440#define VOL_METHOD_LINEAR 2
441
442/*
443 * Note! SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO are used also as
444 * input events.
445 */
446
447/*
448 * Event codes 0xf0 to 0xfc are reserved for future extensions.
449 */
450
451#define SEQ_FULLSIZE 0xfd /* Long events */
452/*
453 * SEQ_FULLSIZE events are used for loading patches/samples to the
454 * synthesizer devices. These events are passed directly to the driver
455 * of the associated synthesizer device. There is no limit to the size
456 * of the extended events. These events are not queued but executed
457 * immediately when the write() is called (execution can take several
458 * seconds of time).
459 *
460 * When a SEQ_FULLSIZE message is written to the device, it must
461 * be written using exactly one write() call. Other events cannot
462 * be mixed to the same write.
463 *
464 * For FM synths (YM3812/OPL3) use struct sbi_instrument and write it to the
465 * /dev/sequencer. Don't write other data together with the instrument structure
466 * Set the key field of the structure to FM_PATCH. The device field is used to
467 * route the patch to the corresponding device.
468 *
469 * For wave table use struct patch_info. Initialize the key field
470 * to WAVE_PATCH.
471 */
472#define SEQ_PRIVATE 0xfe /* Low level HW dependent events (8 bytes) */
473#define SEQ_EXTENDED 0xff /* Extended events (8 bytes) OBSOLETE */
474
475/*
476 * Record for FM patches
477 */
478
479typedef unsigned char sbi_instr_data[32];
480
481struct sbi_instrument {
482 unsigned short key; /* FM_PATCH or OPL3_PATCH */
483#define FM_PATCH _PATCHKEY(0x01)
484#define OPL3_PATCH _PATCHKEY(0x03)
485 short device; /* Synth# (0-4) */
486 int channel; /* Program# to be initialized */
487 sbi_instr_data operators; /* Register settings for operator cells (.SBI format) */
488 };
489
490struct synth_info { /* Read only */
491 char name[30];
492 int device; /* 0-N. INITIALIZE BEFORE CALLING */
493 int synth_type;
494#define SYNTH_TYPE_FM 0
495#define SYNTH_TYPE_SAMPLE 1
496#define SYNTH_TYPE_MIDI 2 /* Midi interface */
497
498 int synth_subtype;
499#define FM_TYPE_ADLIB 0x00
500#define FM_TYPE_OPL3 0x01
501#define MIDI_TYPE_MPU401 0x401
502
503#define SAMPLE_TYPE_BASIC 0x10
504#define SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC
505#define SAMPLE_TYPE_WAVEFRONT 0x11
506
507 int perc_mode; /* No longer supported */
508 int nr_voices;
509 int nr_drums; /* Obsolete field */
510 int instr_bank_size;
511 unsigned int capabilities;
512#define SYNTH_CAP_PERCMODE 0x00000001 /* No longer used */
513#define SYNTH_CAP_OPL3 0x00000002 /* Set if OPL3 supported */
514#define SYNTH_CAP_INPUT 0x00000004 /* Input (MIDI) device */
515 int dummies[19]; /* Reserve space */
516 };
517
518struct sound_timer_info {
519 char name[32];
520 int caps;
521 };
522
523#define MIDI_CAP_MPU401 1 /* MPU-401 intelligent mode */
524
525struct midi_info {
526 char name[30];
527 int device; /* 0-N. INITIALIZE BEFORE CALLING */
528 unsigned int capabilities; /* To be defined later */
529 int dev_type;
530 int dummies[18]; /* Reserve space */
531 };
532
533/********************************************
534 * ioctl commands for the /dev/midi##
535 */
536typedef struct {
537 unsigned char cmd;
538 char nr_args, nr_returns;
539 unsigned char data[30];
540 } mpu_command_rec;
541
542#define SNDCTL_MIDI_PRETIME _SIOWR('m', 0, int)
543#define SNDCTL_MIDI_MPUMODE _SIOWR('m', 1, int)
544#define SNDCTL_MIDI_MPUCMD _SIOWR('m', 2, mpu_command_rec)
545
546/********************************************
547 * IOCTL commands for /dev/dsp and /dev/audio
548 */
549
550#define SNDCTL_DSP_RESET _SIO ('P', 0)
551#define SNDCTL_DSP_SYNC _SIO ('P', 1)
552#define SNDCTL_DSP_SPEED _SIOWR('P', 2, int)
553#define SNDCTL_DSP_STEREO _SIOWR('P', 3, int)
554#define SNDCTL_DSP_GETBLKSIZE _SIOWR('P', 4, int)
555#define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT
556#define SNDCTL_DSP_CHANNELS _SIOWR('P', 6, int)
557#define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS
558#define SOUND_PCM_WRITE_FILTER _SIOWR('P', 7, int)
559#define SNDCTL_DSP_POST _SIO ('P', 8)
560#define SNDCTL_DSP_SUBDIVIDE _SIOWR('P', 9, int)
561#define SNDCTL_DSP_SETFRAGMENT _SIOWR('P',10, int)
562
563/* Audio data formats (Note! U8=8 and S16_LE=16 for compatibility) */
564#define SNDCTL_DSP_GETFMTS _SIOR ('P',11, int) /* Returns a mask */
565#define SNDCTL_DSP_SETFMT _SIOWR('P',5, int) /* Selects ONE fmt*/
566# define AFMT_QUERY 0x00000000 /* Return current fmt */
567# define AFMT_MU_LAW 0x00000001
568# define AFMT_A_LAW 0x00000002
569# define AFMT_IMA_ADPCM 0x00000004
570# define AFMT_U8 0x00000008
571# define AFMT_S16_LE 0x00000010 /* Little endian signed 16*/
572# define AFMT_S16_BE 0x00000020 /* Big endian signed 16 */
573# define AFMT_S8 0x00000040
574# define AFMT_U16_LE 0x00000080 /* Little endian U16 */
575# define AFMT_U16_BE 0x00000100 /* Big endian U16 */
576# define AFMT_MPEG 0x00000200 /* MPEG (2) audio */
577# define AFMT_AC3 0x00000400 /* Dolby Digital AC3 */
578
579/*
580 * Buffer status queries.
581 */
582typedef struct audio_buf_info {
583 int fragments; /* # of available fragments (partially usend ones not counted) */
584 int fragstotal; /* Total # of fragments allocated */
585 int fragsize; /* Size of a fragment in bytes */
586
587 int bytes; /* Available space in bytes (includes partially used fragments) */
588 /* Note! 'bytes' could be more than fragments*fragsize */
589 } audio_buf_info;
590
591#define SNDCTL_DSP_GETOSPACE _SIOR ('P',12, audio_buf_info)
592#define SNDCTL_DSP_GETISPACE _SIOR ('P',13, audio_buf_info)
593#define SNDCTL_DSP_NONBLOCK _SIO ('P',14)
594#define SNDCTL_DSP_GETCAPS _SIOR ('P',15, int)
595# define DSP_CAP_REVISION 0x000000ff /* Bits for revision level (0 to 255) */
596# define DSP_CAP_DUPLEX 0x00000100 /* Full duplex record/playback */
597# define DSP_CAP_REALTIME 0x00000200 /* Real time capability */
598# define DSP_CAP_BATCH 0x00000400 /* Device has some kind of */
599 /* internal buffers which may */
600 /* cause some delays and */
601 /* decrease precision of timing */
602# define DSP_CAP_COPROC 0x00000800 /* Has a coprocessor */
603 /* Sometimes it's a DSP */
604 /* but usually not */
605# define DSP_CAP_TRIGGER 0x00001000 /* Supports SETTRIGGER */
606# define DSP_CAP_MMAP 0x00002000 /* Supports mmap() */
607# define DSP_CAP_MULTI 0x00004000 /* support multiple open */
608# define DSP_CAP_BIND 0x00008000 /* channel binding to front/rear/cneter/lfe */
609
610
611#define SNDCTL_DSP_GETTRIGGER _SIOR ('P',16, int)
612#define SNDCTL_DSP_SETTRIGGER _SIOW ('P',16, int)
613# define PCM_ENABLE_INPUT 0x00000001
614# define PCM_ENABLE_OUTPUT 0x00000002
615
616typedef struct count_info {
617 int bytes; /* Total # of bytes processed */
618 int blocks; /* # of fragment transitions since last time */
619 int ptr; /* Current DMA pointer value */
620 } count_info;
621
622#define SNDCTL_DSP_GETIPTR _SIOR ('P',17, count_info)
623#define SNDCTL_DSP_GETOPTR _SIOR ('P',18, count_info)
624
625typedef struct buffmem_desc {
626 unsigned *buffer;
627 int size;
628 } buffmem_desc;
629#define SNDCTL_DSP_MAPINBUF _SIOR ('P', 19, buffmem_desc)
630#define SNDCTL_DSP_MAPOUTBUF _SIOR ('P', 20, buffmem_desc)
631#define SNDCTL_DSP_SETSYNCRO _SIO ('P', 21)
632#define SNDCTL_DSP_SETDUPLEX _SIO ('P', 22)
633#define SNDCTL_DSP_GETODELAY _SIOR ('P', 23, int)
634
635#define SNDCTL_DSP_GETCHANNELMASK _SIOWR('P', 64, int)
636#define SNDCTL_DSP_BIND_CHANNEL _SIOWR('P', 65, int)
637# define DSP_BIND_QUERY 0x00000000
638# define DSP_BIND_FRONT 0x00000001
639# define DSP_BIND_SURR 0x00000002
640# define DSP_BIND_CENTER_LFE 0x00000004
641# define DSP_BIND_HANDSET 0x00000008
642# define DSP_BIND_MIC 0x00000010
643# define DSP_BIND_MODEM1 0x00000020
644# define DSP_BIND_MODEM2 0x00000040
645# define DSP_BIND_I2S 0x00000080
646# define DSP_BIND_SPDIF 0x00000100
647
648#define SNDCTL_DSP_SETSPDIF _SIOW ('P', 66, int)
649#define SNDCTL_DSP_GETSPDIF _SIOR ('P', 67, int)
650# define SPDIF_PRO 0x0001
651# define SPDIF_N_AUD 0x0002
652# define SPDIF_COPY 0x0004
653# define SPDIF_PRE 0x0008
654# define SPDIF_CC 0x07f0
655# define SPDIF_L 0x0800
656# define SPDIF_DRS 0x4000
657# define SPDIF_V 0x8000
658
659/*
660 * Application's profile defines the way how playback underrun situations should be handled.
661 *
662 * APF_NORMAL (the default) and APF_NETWORK make the driver to cleanup the
663 * playback buffer whenever an underrun occurs. This consumes some time
664 * prevents looping the existing buffer.
665 * APF_CPUINTENS is intended to be set by CPU intensive applications which
666 * are likely to run out of time occasionally. In this mode the buffer cleanup is
667 * disabled which saves CPU time but also let's the previous buffer content to
668 * be played during the "pause" after the underrun.
669 */
670#define SNDCTL_DSP_PROFILE _SIOW ('P', 23, int)
671#define APF_NORMAL 0 /* Normal applications */
672#define APF_NETWORK 1 /* Underruns probably caused by an "external" delay */
673#define APF_CPUINTENS 2 /* Underruns probably caused by "overheating" the CPU */
674
675#define SOUND_PCM_READ_RATE _SIOR ('P', 2, int)
676#define SOUND_PCM_READ_CHANNELS _SIOR ('P', 6, int)
677#define SOUND_PCM_READ_BITS _SIOR ('P', 5, int)
678#define SOUND_PCM_READ_FILTER _SIOR ('P', 7, int)
679
680/* Some alias names */
681#define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT
682#define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED
683#define SOUND_PCM_POST SNDCTL_DSP_POST
684#define SOUND_PCM_RESET SNDCTL_DSP_RESET
685#define SOUND_PCM_SYNC SNDCTL_DSP_SYNC
686#define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE
687#define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT
688#define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS
689#define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT
690#define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE
691#define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE
692#define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK
693#define SOUND_PCM_GETCAPS SNDCTL_DSP_GETCAPS
694#define SOUND_PCM_GETTRIGGER SNDCTL_DSP_GETTRIGGER
695#define SOUND_PCM_SETTRIGGER SNDCTL_DSP_SETTRIGGER
696#define SOUND_PCM_SETSYNCRO SNDCTL_DSP_SETSYNCRO
697#define SOUND_PCM_GETIPTR SNDCTL_DSP_GETIPTR
698#define SOUND_PCM_GETOPTR SNDCTL_DSP_GETOPTR
699#define SOUND_PCM_MAPINBUF SNDCTL_DSP_MAPINBUF
700#define SOUND_PCM_MAPOUTBUF SNDCTL_DSP_MAPOUTBUF
701
702/*
703 * ioctl calls to be used in communication with coprocessors and
704 * DSP chips.
705 */
706
707typedef struct copr_buffer {
708 int command; /* Set to 0 if not used */
709 int flags;
710#define CPF_NONE 0x0000
711#define CPF_FIRST 0x0001 /* First block */
712#define CPF_LAST 0x0002 /* Last block */
713 int len;
714 int offs; /* If required by the device (0 if not used) */
715
716 unsigned char data[4000]; /* NOTE! 4000 is not 4k */
717 } copr_buffer;
718
719typedef struct copr_debug_buf {
720 int command; /* Used internally. Set to 0 */
721 int parm1;
722 int parm2;
723 int flags;
724 int len; /* Length of data in bytes */
725 } copr_debug_buf;
726
727typedef struct copr_msg {
728 int len;
729 unsigned char data[4000];
730 } copr_msg;
731
732#define SNDCTL_COPR_RESET _SIO ('C', 0)
733#define SNDCTL_COPR_LOAD _SIOWR('C', 1, copr_buffer)
734#define SNDCTL_COPR_RDATA _SIOWR('C', 2, copr_debug_buf)
735#define SNDCTL_COPR_RCODE _SIOWR('C', 3, copr_debug_buf)
736#define SNDCTL_COPR_WDATA _SIOW ('C', 4, copr_debug_buf)
737#define SNDCTL_COPR_WCODE _SIOW ('C', 5, copr_debug_buf)
738#define SNDCTL_COPR_RUN _SIOWR('C', 6, copr_debug_buf)
739#define SNDCTL_COPR_HALT _SIOWR('C', 7, copr_debug_buf)
740#define SNDCTL_COPR_SENDMSG _SIOWR('C', 8, copr_msg)
741#define SNDCTL_COPR_RCVMSG _SIOR ('C', 9, copr_msg)
742
743/*********************************************
744 * IOCTL commands for /dev/mixer
745 */
746
747/*
748 * Mixer devices
749 *
750 * There can be up to 20 different analog mixer channels. The
751 * SOUND_MIXER_NRDEVICES gives the currently supported maximum.
752 * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells
753 * the devices supported by the particular mixer.
754 */
755
756#define SOUND_MIXER_NRDEVICES 25
757#define SOUND_MIXER_VOLUME 0
758#define SOUND_MIXER_BASS 1
759#define SOUND_MIXER_TREBLE 2
760#define SOUND_MIXER_SYNTH 3
761#define SOUND_MIXER_PCM 4
762#define SOUND_MIXER_SPEAKER 5
763#define SOUND_MIXER_LINE 6
764#define SOUND_MIXER_MIC 7
765#define SOUND_MIXER_CD 8
766#define SOUND_MIXER_IMIX 9 /* Recording monitor */
767#define SOUND_MIXER_ALTPCM 10
768#define SOUND_MIXER_RECLEV 11 /* Recording level */
769#define SOUND_MIXER_IGAIN 12 /* Input gain */
770#define SOUND_MIXER_OGAIN 13 /* Output gain */
771/*
772 * The AD1848 codec and compatibles have three line level inputs
773 * (line, aux1 and aux2). Since each card manufacturer have assigned
774 * different meanings to these inputs, it's inpractical to assign
775 * specific meanings (line, cd, synth etc.) to them.
776 */
777#define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */
778#define SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */
779#define SOUND_MIXER_LINE3 16 /* Input source 3 (line) */
780#define SOUND_MIXER_DIGITAL1 17 /* Digital (input) 1 */
781#define SOUND_MIXER_DIGITAL2 18 /* Digital (input) 2 */
782#define SOUND_MIXER_DIGITAL3 19 /* Digital (input) 3 */
783#define SOUND_MIXER_PHONEIN 20 /* Phone input */
784#define SOUND_MIXER_PHONEOUT 21 /* Phone output */
785#define SOUND_MIXER_VIDEO 22 /* Video/TV (audio) in */
786#define SOUND_MIXER_RADIO 23 /* Radio in */
787#define SOUND_MIXER_MONITOR 24 /* Monitor (usually mic) volume */
788
789/* Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX) */
790/* Not counted to SOUND_MIXER_NRDEVICES, but use the same number space */
791#define SOUND_ONOFF_MIN 28
792#define SOUND_ONOFF_MAX 30
793
794/* Note! Number 31 cannot be used since the sign bit is reserved */
795#define SOUND_MIXER_NONE 31
796
797/*
798 * The following unsupported macros are no longer functional.
799 * Use SOUND_MIXER_PRIVATE# macros in future.
800 */
801#define SOUND_MIXER_ENHANCE SOUND_MIXER_NONE
802#define SOUND_MIXER_MUTE SOUND_MIXER_NONE
803#define SOUND_MIXER_LOUD SOUND_MIXER_NONE
804
805
806#define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \
807 "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \
808 "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \
809 "PhoneIn", "PhoneOut", "Video", "Radio", "Monitor"}
810
811#define SOUND_DEVICE_NAMES {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \
812 "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \
813 "line1", "line2", "line3", "dig1", "dig2", "dig3", \
814 "phin", "phout", "video", "radio", "monitor"}
815
816/* Device bitmask identifiers */
817
818#define SOUND_MIXER_RECSRC 0xff /* Arg contains a bit for each recording source */
819#define SOUND_MIXER_DEVMASK 0xfe /* Arg contains a bit for each supported device */
820#define SOUND_MIXER_RECMASK 0xfd /* Arg contains a bit for each supported recording source */
821#define SOUND_MIXER_CAPS 0xfc
822# define SOUND_CAP_EXCL_INPUT 0x00000001 /* Only one recording source at a time */
823#define SOUND_MIXER_STEREODEVS 0xfb /* Mixer channels supporting stereo */
824#define SOUND_MIXER_OUTSRC 0xfa /* Arg contains a bit for each input source to output */
825#define SOUND_MIXER_OUTMASK 0xf9 /* Arg contains a bit for each supported input source to output */
826
827/* Device mask bits */
828
829#define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME)
830#define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS)
831#define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE)
832#define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH)
833#define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM)
834#define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER)
835#define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE)
836#define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC)
837#define SOUND_MASK_CD (1 << SOUND_MIXER_CD)
838#define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX)
839#define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM)
840#define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV)
841#define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN)
842#define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN)
843#define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1)
844#define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2)
845#define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3)
846#define SOUND_MASK_DIGITAL1 (1 << SOUND_MIXER_DIGITAL1)
847#define SOUND_MASK_DIGITAL2 (1 << SOUND_MIXER_DIGITAL2)
848#define SOUND_MASK_DIGITAL3 (1 << SOUND_MIXER_DIGITAL3)
849#define SOUND_MASK_PHONEIN (1 << SOUND_MIXER_PHONEIN)
850#define SOUND_MASK_PHONEOUT (1 << SOUND_MIXER_PHONEOUT)
851#define SOUND_MASK_RADIO (1 << SOUND_MIXER_RADIO)
852#define SOUND_MASK_VIDEO (1 << SOUND_MIXER_VIDEO)
853#define SOUND_MASK_MONITOR (1 << SOUND_MIXER_MONITOR)
854
855/* Obsolete macros */
856#define SOUND_MASK_MUTE (1 << SOUND_MIXER_MUTE)
857#define SOUND_MASK_ENHANCE (1 << SOUND_MIXER_ENHANCE)
858#define SOUND_MASK_LOUD (1 << SOUND_MIXER_LOUD)
859
860#define MIXER_READ(dev) _SIOR('M', dev, int)
861#define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME)
862#define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS)
863#define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE)
864#define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH)
865#define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM)
866#define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER)
867#define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE)
868#define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC)
869#define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD)
870#define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX)
871#define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM)
872#define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV)
873#define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN)
874#define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN)
875#define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1)
876#define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2)
877#define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3)
878
879/* Obsolete macros */
880#define SOUND_MIXER_READ_MUTE MIXER_READ(SOUND_MIXER_MUTE)
881#define SOUND_MIXER_READ_ENHANCE MIXER_READ(SOUND_MIXER_ENHANCE)
882#define SOUND_MIXER_READ_LOUD MIXER_READ(SOUND_MIXER_LOUD)
883
884#define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC)
885#define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK)
886#define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK)
887#define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS)
888#define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS)
889
890#define MIXER_WRITE(dev) _SIOWR('M', dev, int)
891#define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME)
892#define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS)
893#define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE)
894#define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH)
895#define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM)
896#define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER)
897#define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE)
898#define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC)
899#define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD)
900#define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX)
901#define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM)
902#define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV)
903#define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN)
904#define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN)
905#define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1)
906#define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2)
907#define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3)
908
909/* Obsolete macros */
910#define SOUND_MIXER_WRITE_MUTE MIXER_WRITE(SOUND_MIXER_MUTE)
911#define SOUND_MIXER_WRITE_ENHANCE MIXER_WRITE(SOUND_MIXER_ENHANCE)
912#define SOUND_MIXER_WRITE_LOUD MIXER_WRITE(SOUND_MIXER_LOUD)
913
914#define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC)
915
916typedef struct mixer_info
917{
918 char id[16];
919 char name[32];
920 int modify_counter;
921 int fillers[10];
922} mixer_info;
923
924typedef struct _old_mixer_info /* Obsolete */
925{
926 char id[16];
927 char name[32];
928} _old_mixer_info;
929
930#define SOUND_MIXER_INFO _SIOR ('M', 101, mixer_info)
931#define SOUND_OLD_MIXER_INFO _SIOR ('M', 101, _old_mixer_info)
932
933/*
934 * A mechanism for accessing "proprietary" mixer features. This method
935 * permits passing 128 bytes of arbitrary data between a mixer application
936 * and the mixer driver. Interpretation of the record is defined by
937 * the particular mixer driver.
938 */
939typedef unsigned char mixer_record[128];
940
941#define SOUND_MIXER_ACCESS _SIOWR('M', 102, mixer_record)
942
943/*
944 * Two ioctls for special souncard function
945 */
946#define SOUND_MIXER_AGC _SIOWR('M', 103, int)
947#define SOUND_MIXER_3DSE _SIOWR('M', 104, int)
948
949/*
950 * The SOUND_MIXER_PRIVATE# commands can be redefined by low level drivers.
951 * These features can be used when accessing device specific features.
952 */
953#define SOUND_MIXER_PRIVATE1 _SIOWR('M', 111, int)
954#define SOUND_MIXER_PRIVATE2 _SIOWR('M', 112, int)
955#define SOUND_MIXER_PRIVATE3 _SIOWR('M', 113, int)
956#define SOUND_MIXER_PRIVATE4 _SIOWR('M', 114, int)
957#define SOUND_MIXER_PRIVATE5 _SIOWR('M', 115, int)
958
959/*
960 * SOUND_MIXER_GETLEVELS and SOUND_MIXER_SETLEVELS calls can be used
961 * for querying current mixer settings from the driver and for loading
962 * default volume settings _prior_ activating the mixer (loading
963 * doesn't affect current state of the mixer hardware). These calls
964 * are for internal use only.
965 */
966
967typedef struct mixer_vol_table {
968 int num; /* Index to volume table */
969 char name[32];
970 int levels[32];
971} mixer_vol_table;
972
973#define SOUND_MIXER_GETLEVELS _SIOWR('M', 116, mixer_vol_table)
974#define SOUND_MIXER_SETLEVELS _SIOWR('M', 117, mixer_vol_table)
975
976/*
977 * An ioctl for identifying the driver version. It will return value
978 * of the SOUND_VERSION macro used when compiling the driver.
979 * This call was introduced in OSS version 3.6 and it will not work
980 * with earlier versions (returns EINVAL).
981 */
982#define OSS_GETVERSION _SIOR ('M', 118, int)
983
984/*
985 * Level 2 event types for /dev/sequencer
986 */
987
988/*
989 * The 4 most significant bits of byte 0 specify the class of
990 * the event:
991 *
992 * 0x8X = system level events,
993 * 0x9X = device/port specific events, event[1] = device/port,
994 * The last 4 bits give the subtype:
995 * 0x02 = Channel event (event[3] = chn).
996 * 0x01 = note event (event[4] = note).
997 * (0x01 is not used alone but always with bit 0x02).
998 * event[2] = MIDI message code (0x80=note off etc.)
999 *
1000 */
1001
1002#define EV_SEQ_LOCAL 0x80
1003#define EV_TIMING 0x81
1004#define EV_CHN_COMMON 0x92
1005#define EV_CHN_VOICE 0x93
1006#define EV_SYSEX 0x94
1007/*
1008 * Event types 200 to 220 are reserved for application use.
1009 * These numbers will not be used by the driver.
1010 */
1011
1012/*
1013 * Events for event type EV_CHN_VOICE
1014 */
1015
1016#define MIDI_NOTEOFF 0x80
1017#define MIDI_NOTEON 0x90
1018#define MIDI_KEY_PRESSURE 0xA0
1019
1020/*
1021 * Events for event type EV_CHN_COMMON
1022 */
1023
1024#define MIDI_CTL_CHANGE 0xB0
1025#define MIDI_PGM_CHANGE 0xC0
1026#define MIDI_CHN_PRESSURE 0xD0
1027#define MIDI_PITCH_BEND 0xE0
1028
1029#define MIDI_SYSTEM_PREFIX 0xF0
1030
1031/*
1032 * Timer event types
1033 */
1034#define TMR_WAIT_REL 1 /* Time relative to the prev time */
1035#define TMR_WAIT_ABS 2 /* Absolute time since TMR_START */
1036#define TMR_STOP 3
1037#define TMR_START 4
1038#define TMR_CONTINUE 5
1039#define TMR_TEMPO 6
1040#define TMR_ECHO 8
1041#define TMR_CLOCK 9 /* MIDI clock */
1042#define TMR_SPP 10 /* Song position pointer */
1043#define TMR_TIMESIG 11 /* Time signature */
1044
1045/*
1046 * Local event types
1047 */
1048#define LOCL_STARTAUDIO 1
1049
1050#if !defined(__KERNEL__) || defined(USE_SEQ_MACROS)
1051/*
1052 * Some convenience macros to simplify programming of the
1053 * /dev/sequencer interface
1054 *
1055 * This is a legacy interface for applications written against
1056 * the OSSlib-3.8 style interface. It is no longer possible
1057 * to actually link against OSSlib with this header, but we
1058 * still provide these macros for programs using them.
1059 *
1060 * If you want to use OSSlib, it is recommended that you get
1061 * the GPL version of OSS-4.x and build against that version
1062 * of the header.
1063 *
1064 * We redefine the extern keyword so that make headers_check
1065 * does not complain about SEQ_USE_EXTBUF.
1066 */
1067#define SEQ_DECLAREBUF() SEQ_USE_EXTBUF()
1068
1069void seqbuf_dump(void); /* This function must be provided by programs */
1070
1071#define SEQ_PM_DEFINES int __foo_bar___
1072
1073#define SEQ_LOAD_GMINSTR(dev, instr)
1074#define SEQ_LOAD_GMDRUM(dev, drum)
1075
1076#define _SEQ_EXTERN extern
1077#define SEQ_USE_EXTBUF() \
1078 _SEQ_EXTERN unsigned char _seqbuf[]; \
1079 _SEQ_EXTERN int _seqbuflen; _SEQ_EXTERN int _seqbufptr
1080
1081#ifndef USE_SIMPLE_MACROS
1082/* Sample seqbuf_dump() implementation:
1083 *
1084 * SEQ_DEFINEBUF (2048); -- Defines a buffer for 2048 bytes
1085 *
1086 * int seqfd; -- The file descriptor for /dev/sequencer.
1087 *
1088 * void
1089 * seqbuf_dump ()
1090 * {
1091 * if (_seqbufptr)
1092 * if (write (seqfd, _seqbuf, _seqbufptr) == -1)
1093 * {
1094 * perror ("write /dev/sequencer");
1095 * exit (-1);
1096 * }
1097 * _seqbufptr = 0;
1098 * }
1099 */
1100
1101#define SEQ_DEFINEBUF(len) unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0
1102#define _SEQ_NEEDBUF(len) if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump()
1103#define _SEQ_ADVBUF(len) _seqbufptr += len
1104#define SEQ_DUMPBUF seqbuf_dump
1105#else
1106/*
1107 * This variation of the sequencer macros is used just to format one event
1108 * using fixed buffer.
1109 *
1110 * The program using the macro library must define the following macros before
1111 * using this library.
1112 *
1113 * #define _seqbuf name of the buffer (unsigned char[])
1114 * #define _SEQ_ADVBUF(len) If the applic needs to know the exact
1115 * size of the event, this macro can be used.
1116 * Otherwise this must be defined as empty.
1117 * #define _seqbufptr Define the name of index variable or 0 if
1118 * not required.
1119 */
1120#define _SEQ_NEEDBUF(len) /* empty */
1121#endif
1122
1123#define SEQ_VOLUME_MODE(dev, mode) {_SEQ_NEEDBUF(8);\
1124 _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
1125 _seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\
1126 _seqbuf[_seqbufptr+2] = (dev);\
1127 _seqbuf[_seqbufptr+3] = (mode);\
1128 _seqbuf[_seqbufptr+4] = 0;\
1129 _seqbuf[_seqbufptr+5] = 0;\
1130 _seqbuf[_seqbufptr+6] = 0;\
1131 _seqbuf[_seqbufptr+7] = 0;\
1132 _SEQ_ADVBUF(8);}
1133
1134/*
1135 * Midi voice messages
1136 */
1137
1138#define _CHN_VOICE(dev, event, chn, note, parm) \
1139 {_SEQ_NEEDBUF(8);\
1140 _seqbuf[_seqbufptr] = EV_CHN_VOICE;\
1141 _seqbuf[_seqbufptr+1] = (dev);\
1142 _seqbuf[_seqbufptr+2] = (event);\
1143 _seqbuf[_seqbufptr+3] = (chn);\
1144 _seqbuf[_seqbufptr+4] = (note);\
1145 _seqbuf[_seqbufptr+5] = (parm);\
1146 _seqbuf[_seqbufptr+6] = (0);\
1147 _seqbuf[_seqbufptr+7] = 0;\
1148 _SEQ_ADVBUF(8);}
1149
1150#define SEQ_START_NOTE(dev, chn, note, vol) \
1151 _CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol)
1152
1153#define SEQ_STOP_NOTE(dev, chn, note, vol) \
1154 _CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol)
1155
1156#define SEQ_KEY_PRESSURE(dev, chn, note, pressure) \
1157 _CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure)
1158
1159/*
1160 * Midi channel messages
1161 */
1162
1163#define _CHN_COMMON(dev, event, chn, p1, p2, w14) \
1164 {_SEQ_NEEDBUF(8);\
1165 _seqbuf[_seqbufptr] = EV_CHN_COMMON;\
1166 _seqbuf[_seqbufptr+1] = (dev);\
1167 _seqbuf[_seqbufptr+2] = (event);\
1168 _seqbuf[_seqbufptr+3] = (chn);\
1169 _seqbuf[_seqbufptr+4] = (p1);\
1170 _seqbuf[_seqbufptr+5] = (p2);\
1171 *(short *)&_seqbuf[_seqbufptr+6] = (w14);\
1172 _SEQ_ADVBUF(8);}
1173/*
1174 * SEQ_SYSEX permits sending of sysex messages. (It may look that it permits
1175 * sending any MIDI bytes but it's absolutely not possible. Trying to do
1176 * so _will_ cause problems with MPU401 intelligent mode).
1177 *
1178 * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be
1179 * sent by calling SEQ_SYSEX() several times (there must be no other events
1180 * between them). First sysex fragment must have 0xf0 in the first byte
1181 * and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte
1182 * between these sysex start and end markers cannot be larger than 0x7f. Also
1183 * lengths of each fragments (except the last one) must be 6.
1184 *
1185 * Breaking the above rules may work with some MIDI ports but is likely to
1186 * cause fatal problems with some other devices (such as MPU401).
1187 */
1188#define SEQ_SYSEX(dev, buf, len) \
1189 {int ii, ll=(len); \
1190 unsigned char *bufp=buf;\
1191 if (ll>6)ll=6;\
1192 _SEQ_NEEDBUF(8);\
1193 _seqbuf[_seqbufptr] = EV_SYSEX;\
1194 _seqbuf[_seqbufptr+1] = (dev);\
1195 for(ii=0;ii<ll;ii++)\
1196 _seqbuf[_seqbufptr+ii+2] = bufp[ii];\
1197 for(ii=ll;ii<6;ii++)\
1198 _seqbuf[_seqbufptr+ii+2] = 0xff;\
1199 _SEQ_ADVBUF(8);}
1200
1201#define SEQ_CHN_PRESSURE(dev, chn, pressure) \
1202 _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0)
1203
1204#define SEQ_SET_PATCH SEQ_PGM_CHANGE
1205#define SEQ_PGM_CHANGE(dev, chn, patch) \
1206 _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0)
1207
1208#define SEQ_CONTROL(dev, chn, controller, value) \
1209 _CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value)
1210
1211#define SEQ_BENDER(dev, chn, value) \
1212 _CHN_COMMON(dev, MIDI_PITCH_BEND, chn, 0, 0, value)
1213
1214
1215#define SEQ_V2_X_CONTROL(dev, voice, controller, value) {_SEQ_NEEDBUF(8);\
1216 _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
1217 _seqbuf[_seqbufptr+1] = SEQ_CONTROLLER;\
1218 _seqbuf[_seqbufptr+2] = (dev);\
1219 _seqbuf[_seqbufptr+3] = (voice);\
1220 _seqbuf[_seqbufptr+4] = (controller);\
1221 _seqbuf[_seqbufptr+5] = ((value)&0xff);\
1222 _seqbuf[_seqbufptr+6] = ((value>>8)&0xff);\
1223 _seqbuf[_seqbufptr+7] = 0;\
1224 _SEQ_ADVBUF(8);}
1225/*
1226 * The following 5 macros are incorrectly implemented and obsolete.
1227 * Use SEQ_BENDER and SEQ_CONTROL (with proper controller) instead.
1228 */
1229#define SEQ_PITCHBEND(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value)
1230#define SEQ_BENDER_RANGE(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value)
1231#define SEQ_EXPRESSION(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128)
1232#define SEQ_MAIN_VOLUME(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100)
1233#define SEQ_PANNING(dev, voice, pos) SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2)
1234
1235/*
1236 * Timing and synchronization macros
1237 */
1238
1239#define _TIMER_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\
1240 _seqbuf[_seqbufptr+0] = EV_TIMING; \
1241 _seqbuf[_seqbufptr+1] = (ev); \
1242 _seqbuf[_seqbufptr+2] = 0;\
1243 _seqbuf[_seqbufptr+3] = 0;\
1244 *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
1245 _SEQ_ADVBUF(8);}
1246
1247#define SEQ_START_TIMER() _TIMER_EVENT(TMR_START, 0)
1248#define SEQ_STOP_TIMER() _TIMER_EVENT(TMR_STOP, 0)
1249#define SEQ_CONTINUE_TIMER() _TIMER_EVENT(TMR_CONTINUE, 0)
1250#define SEQ_WAIT_TIME(ticks) _TIMER_EVENT(TMR_WAIT_ABS, ticks)
1251#define SEQ_DELTA_TIME(ticks) _TIMER_EVENT(TMR_WAIT_REL, ticks)
1252#define SEQ_ECHO_BACK(key) _TIMER_EVENT(TMR_ECHO, key)
1253#define SEQ_SET_TEMPO(value) _TIMER_EVENT(TMR_TEMPO, value)
1254#define SEQ_SONGPOS(pos) _TIMER_EVENT(TMR_SPP, pos)
1255#define SEQ_TIME_SIGNATURE(sig) _TIMER_EVENT(TMR_TIMESIG, sig)
1256
1257/*
1258 * Local control events
1259 */
1260
1261#define _LOCAL_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\
1262 _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \
1263 _seqbuf[_seqbufptr+1] = (ev); \
1264 _seqbuf[_seqbufptr+2] = 0;\
1265 _seqbuf[_seqbufptr+3] = 0;\
1266 *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
1267 _SEQ_ADVBUF(8);}
1268
1269#define SEQ_PLAYAUDIO(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO, devmask)
1270/*
1271 * Events for the level 1 interface only
1272 */
1273
1274#define SEQ_MIDIOUT(device, byte) {_SEQ_NEEDBUF(4);\
1275 _seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\
1276 _seqbuf[_seqbufptr+1] = (byte);\
1277 _seqbuf[_seqbufptr+2] = (device);\
1278 _seqbuf[_seqbufptr+3] = 0;\
1279 _SEQ_ADVBUF(4);}
1280
1281/*
1282 * Patch loading.
1283 */
1284#define SEQ_WRPATCH(patchx, len) \
1285 {if (_seqbufptr) SEQ_DUMPBUF();\
1286 if (write(seqfd, (char*)(patchx), len)==-1) \
1287 perror("Write patch: /dev/sequencer");}
1288#define SEQ_WRPATCH2(patchx, len) \
1289 (SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len))
1290
1291#endif
1292#endif 37#endif
diff --git a/include/linux/spi/Kbuild b/include/linux/spi/Kbuild
deleted file mode 100644
index d375a082986e..000000000000
--- a/include/linux/spi/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
1header-y += spidev.h
diff --git a/include/linux/spi/tsc2005.h b/include/linux/spi/tsc2005.h
index d9b0c84220c7..8f721e465e05 100644
--- a/include/linux/spi/tsc2005.h
+++ b/include/linux/spi/tsc2005.h
@@ -3,8 +3,6 @@
3 * 3 *
4 * Copyright (C) 2009-2010 Nokia Corporation 4 * Copyright (C) 2009-2010 Nokia Corporation
5 * 5 *
6 * Contact: Aaro Koskinen <aaro.koskinen@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or 8 * the Free Software Foundation; either version 2 of the License, or
diff --git a/include/linux/stat.h b/include/linux/stat.h
index 46132409a3f7..075cb0c7eb2a 100644
--- a/include/linux/stat.h
+++ b/include/linux/stat.h
@@ -1,52 +1,10 @@
1#ifndef _LINUX_STAT_H 1#ifndef _LINUX_STAT_H
2#define _LINUX_STAT_H 2#define _LINUX_STAT_H
3 3
4#ifdef __KERNEL__
5 4
6#include <asm/stat.h> 5#include <asm/stat.h>
6#include <uapi/linux/stat.h>
7 7
8#endif
9
10#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
11
12#define S_IFMT 00170000
13#define S_IFSOCK 0140000
14#define S_IFLNK 0120000
15#define S_IFREG 0100000
16#define S_IFBLK 0060000
17#define S_IFDIR 0040000
18#define S_IFCHR 0020000
19#define S_IFIFO 0010000
20#define S_ISUID 0004000
21#define S_ISGID 0002000
22#define S_ISVTX 0001000
23
24#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
25#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
26#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
27#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
28#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
29#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
30#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
31
32#define S_IRWXU 00700
33#define S_IRUSR 00400
34#define S_IWUSR 00200
35#define S_IXUSR 00100
36
37#define S_IRWXG 00070
38#define S_IRGRP 00040
39#define S_IWGRP 00020
40#define S_IXGRP 00010
41
42#define S_IRWXO 00007
43#define S_IROTH 00004
44#define S_IWOTH 00002
45#define S_IXOTH 00001
46
47#endif
48
49#ifdef __KERNEL__
50#define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO) 8#define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO)
51#define S_IALLUGO (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO) 9#define S_IALLUGO (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO)
52#define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH) 10#define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH)
@@ -77,5 +35,3 @@ struct kstat {
77}; 35};
78 36
79#endif 37#endif
80
81#endif
diff --git a/include/linux/stddef.h b/include/linux/stddef.h
index 1747b6787b9e..f4aec0e75c3a 100644
--- a/include/linux/stddef.h
+++ b/include/linux/stddef.h
@@ -1,9 +1,8 @@
1#ifndef _LINUX_STDDEF_H 1#ifndef _LINUX_STDDEF_H
2#define _LINUX_STDDEF_H 2#define _LINUX_STDDEF_H
3 3
4#include <linux/compiler.h> 4#include <uapi/linux/stddef.h>
5 5
6#ifdef __KERNEL__
7 6
8#undef NULL 7#undef NULL
9#define NULL ((void *)0) 8#define NULL ((void *)0)
@@ -19,6 +18,4 @@ enum {
19#else 18#else
20#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 19#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
21#endif 20#endif
22#endif /* __KERNEL__ */
23
24#endif 21#endif
diff --git a/include/linux/string.h b/include/linux/string.h
index b9178812d9df..630125818ca8 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -1,16 +1,12 @@
1#ifndef _LINUX_STRING_H_ 1#ifndef _LINUX_STRING_H_
2#define _LINUX_STRING_H_ 2#define _LINUX_STRING_H_
3 3
4/* We don't want strings.h stuff being used by user stuff by accident */
5
6#ifndef __KERNEL__
7#include <string.h>
8#else
9 4
10#include <linux/compiler.h> /* for inline */ 5#include <linux/compiler.h> /* for inline */
11#include <linux/types.h> /* for size_t */ 6#include <linux/types.h> /* for size_t */
12#include <linux/stddef.h> /* for NULL */ 7#include <linux/stddef.h> /* for NULL */
13#include <stdarg.h> 8#include <stdarg.h>
9#include <uapi/linux/string.h>
14 10
15extern char *strndup_user(const char __user *, long); 11extern char *strndup_user(const char __user *, long);
16extern void *memdup_user(const void __user *, size_t); 12extern void *memdup_user(const void __user *, size_t);
@@ -147,5 +143,4 @@ static inline bool strstarts(const char *str, const char *prefix)
147 143
148extern size_t memweight(const void *ptr, size_t bytes); 144extern size_t memweight(const void *ptr, size_t bytes);
149 145
150#endif /* __KERNEL__ */
151#endif /* _LINUX_STRING_H_ */ 146#endif /* _LINUX_STRING_H_ */
diff --git a/include/linux/sunrpc/Kbuild b/include/linux/sunrpc/Kbuild
deleted file mode 100644
index 98df21164a86..000000000000
--- a/include/linux/sunrpc/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
1header-y += debug.h
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 523547ecfee2..34206b84d8da 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -130,6 +130,8 @@ struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
130 const struct rpc_program *, u32); 130 const struct rpc_program *, u32);
131void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt); 131void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt);
132struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); 132struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
133struct rpc_clnt *rpc_clone_client_set_auth(struct rpc_clnt *,
134 rpc_authflavor_t);
133void rpc_shutdown_client(struct rpc_clnt *); 135void rpc_shutdown_client(struct rpc_clnt *);
134void rpc_release_client(struct rpc_clnt *); 136void rpc_release_client(struct rpc_clnt *);
135void rpc_task_release_client(struct rpc_task *); 137void rpc_task_release_client(struct rpc_task *);
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index a76cc20d98ce..9385bd74c860 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -5,28 +5,11 @@
5 * 5 *
6 * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> 6 * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
7 */ 7 */
8
9#ifndef _LINUX_SUNRPC_DEBUG_H_ 8#ifndef _LINUX_SUNRPC_DEBUG_H_
10#define _LINUX_SUNRPC_DEBUG_H_ 9#define _LINUX_SUNRPC_DEBUG_H_
11 10
12/* 11#include <uapi/linux/sunrpc/debug.h>
13 * RPC debug facilities
14 */
15#define RPCDBG_XPRT 0x0001
16#define RPCDBG_CALL 0x0002
17#define RPCDBG_DEBUG 0x0004
18#define RPCDBG_NFS 0x0008
19#define RPCDBG_AUTH 0x0010
20#define RPCDBG_BIND 0x0020
21#define RPCDBG_SCHED 0x0040
22#define RPCDBG_TRANS 0x0080
23#define RPCDBG_SVCXPRT 0x0100
24#define RPCDBG_SVCDSP 0x0200
25#define RPCDBG_MISC 0x0400
26#define RPCDBG_CACHE 0x0800
27#define RPCDBG_ALL 0x7fff
28 12
29#ifdef __KERNEL__
30 13
31/* 14/*
32 * Enable RPC debugging/profiling. 15 * Enable RPC debugging/profiling.
@@ -87,24 +70,4 @@ void rpc_register_sysctl(void);
87void rpc_unregister_sysctl(void); 70void rpc_unregister_sysctl(void);
88#endif 71#endif
89 72
90#endif /* __KERNEL__ */
91
92/*
93 * Declarations for the sysctl debug interface, which allows to read or
94 * change the debug flags for rpc, nfs, nfsd, and lockd. Since the sunrpc
95 * module currently registers its sysctl table dynamically, the sysctl path
96 * for module FOO is <CTL_SUNRPC, CTL_FOODEBUG>.
97 */
98
99enum {
100 CTL_RPCDEBUG = 1,
101 CTL_NFSDEBUG,
102 CTL_NFSDDEBUG,
103 CTL_NLMDEBUG,
104 CTL_SLOTTABLE_UDP,
105 CTL_SLOTTABLE_TCP,
106 CTL_MIN_RESVPORT,
107 CTL_MAX_RESVPORT,
108};
109
110#endif /* _LINUX_SUNRPC_DEBUG_H_ */ 73#endif /* _LINUX_SUNRPC_DEBUG_H_ */
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index b3f64b12f141..b05963f09ebf 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -114,7 +114,6 @@ void svc_xprt_init(struct net *, struct svc_xprt_class *, struct svc_xprt *,
114int svc_create_xprt(struct svc_serv *, const char *, struct net *, 114int svc_create_xprt(struct svc_serv *, const char *, struct net *,
115 const int, const unsigned short, int); 115 const int, const unsigned short, int);
116void svc_xprt_enqueue(struct svc_xprt *xprt); 116void svc_xprt_enqueue(struct svc_xprt *xprt);
117void svc_xprt_received(struct svc_xprt *);
118void svc_xprt_put(struct svc_xprt *xprt); 117void svc_xprt_put(struct svc_xprt *xprt);
119void svc_xprt_copy_addrs(struct svc_rqst *rqstp, struct svc_xprt *xprt); 118void svc_xprt_copy_addrs(struct svc_rqst *rqstp, struct svc_xprt *xprt);
120void svc_close_xprt(struct svc_xprt *xprt); 119void svc_close_xprt(struct svc_xprt *xprt);
@@ -124,6 +123,7 @@ struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name,
124 struct net *net, const sa_family_t af, 123 struct net *net, const sa_family_t af,
125 const unsigned short port); 124 const unsigned short port);
126int svc_xprt_names(struct svc_serv *serv, char *buf, const int buflen); 125int svc_xprt_names(struct svc_serv *serv, char *buf, const int buflen);
126void svc_add_new_perm_xprt(struct svc_serv *serv, struct svc_xprt *xprt);
127 127
128static inline void svc_xprt_get(struct svc_xprt *xprt) 128static inline void svc_xprt_get(struct svc_xprt *xprt)
129{ 129{
@@ -166,8 +166,7 @@ static inline size_t svc_addr_len(const struct sockaddr *sa)
166 case AF_INET6: 166 case AF_INET6:
167 return sizeof(struct sockaddr_in6); 167 return sizeof(struct sockaddr_in6);
168 } 168 }
169 169 BUG();
170 return 0;
171} 170}
172 171
173static inline unsigned short svc_xprt_local_port(const struct svc_xprt *xprt) 172static 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 cb4ac69e1f33..92ad02f0dcc0 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -39,9 +39,6 @@ int svc_recv(struct svc_rqst *, long);
39int svc_send(struct svc_rqst *); 39int svc_send(struct svc_rqst *);
40void svc_drop(struct svc_rqst *); 40void svc_drop(struct svc_rqst *);
41void svc_sock_update_bufs(struct svc_serv *serv); 41void svc_sock_update_bufs(struct svc_serv *serv);
42int svc_sock_names(struct svc_serv *serv, char *buf,
43 const size_t buflen,
44 const char *toclose);
45int svc_addsock(struct svc_serv *serv, const int fd, 42int svc_addsock(struct svc_serv *serv, const int fd,
46 char *name_return, const size_t len); 43 char *name_return, const size_t len);
47void svc_init_xprt_sock(void); 44void svc_init_xprt_sock(void);
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index bf8c49ff7530..951cb9b7d02b 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -173,8 +173,7 @@ struct rpc_xprt {
173 unsigned int min_reqs; /* min number of slots */ 173 unsigned int min_reqs; /* min number of slots */
174 atomic_t num_reqs; /* total slots */ 174 atomic_t num_reqs; /* total slots */
175 unsigned long state; /* transport state */ 175 unsigned long state; /* transport state */
176 unsigned char shutdown : 1, /* being shut down */ 176 unsigned char resvport : 1; /* use a reserved port */
177 resvport : 1; /* use a reserved port */
178 unsigned int swapper; /* we're swapping over this 177 unsigned int swapper; /* we're swapping over this
179 transport */ 178 transport */
180 unsigned int bind_index; /* bind function index */ 179 unsigned int bind_index; /* bind function index */
diff --git a/include/linux/swab.h b/include/linux/swab.h
index ea0c02fd5163..9ad3c60f6cae 100644
--- a/include/linux/swab.h
+++ b/include/linux/swab.h
@@ -1,284 +1,8 @@
1#ifndef _LINUX_SWAB_H 1#ifndef _LINUX_SWAB_H
2#define _LINUX_SWAB_H 2#define _LINUX_SWAB_H
3 3
4#include <linux/types.h> 4#include <uapi/linux/swab.h>
5#include <linux/compiler.h>
6#include <asm/swab.h>
7 5
8/*
9 * casts are necessary for constants, because we never know how for sure
10 * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
11 */
12#define ___constant_swab16(x) ((__u16)( \
13 (((__u16)(x) & (__u16)0x00ffU) << 8) | \
14 (((__u16)(x) & (__u16)0xff00U) >> 8)))
15
16#define ___constant_swab32(x) ((__u32)( \
17 (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
18 (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
19 (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
20 (((__u32)(x) & (__u32)0xff000000UL) >> 24)))
21
22#define ___constant_swab64(x) ((__u64)( \
23 (((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
24 (((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \
25 (((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \
26 (((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \
27 (((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \
28 (((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
29 (((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
30 (((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56)))
31
32#define ___constant_swahw32(x) ((__u32)( \
33 (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \
34 (((__u32)(x) & (__u32)0xffff0000UL) >> 16)))
35
36#define ___constant_swahb32(x) ((__u32)( \
37 (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \
38 (((__u32)(x) & (__u32)0xff00ff00UL) >> 8)))
39
40/*
41 * Implement the following as inlines, but define the interface using
42 * macros to allow constant folding when possible:
43 * ___swab16, ___swab32, ___swab64, ___swahw32, ___swahb32
44 */
45
46static inline __attribute_const__ __u16 __fswab16(__u16 val)
47{
48#ifdef __arch_swab16
49 return __arch_swab16(val);
50#else
51 return ___constant_swab16(val);
52#endif
53}
54
55static inline __attribute_const__ __u32 __fswab32(__u32 val)
56{
57#ifdef __arch_swab32
58 return __arch_swab32(val);
59#else
60 return ___constant_swab32(val);
61#endif
62}
63
64static inline __attribute_const__ __u64 __fswab64(__u64 val)
65{
66#ifdef __arch_swab64
67 return __arch_swab64(val);
68#elif defined(__SWAB_64_THRU_32__)
69 __u32 h = val >> 32;
70 __u32 l = val & ((1ULL << 32) - 1);
71 return (((__u64)__fswab32(l)) << 32) | ((__u64)(__fswab32(h)));
72#else
73 return ___constant_swab64(val);
74#endif
75}
76
77static inline __attribute_const__ __u32 __fswahw32(__u32 val)
78{
79#ifdef __arch_swahw32
80 return __arch_swahw32(val);
81#else
82 return ___constant_swahw32(val);
83#endif
84}
85
86static inline __attribute_const__ __u32 __fswahb32(__u32 val)
87{
88#ifdef __arch_swahb32
89 return __arch_swahb32(val);
90#else
91 return ___constant_swahb32(val);
92#endif
93}
94
95/**
96 * __swab16 - return a byteswapped 16-bit value
97 * @x: value to byteswap
98 */
99#define __swab16(x) \
100 (__builtin_constant_p((__u16)(x)) ? \
101 ___constant_swab16(x) : \
102 __fswab16(x))
103
104/**
105 * __swab32 - return a byteswapped 32-bit value
106 * @x: value to byteswap
107 */
108#define __swab32(x) \
109 (__builtin_constant_p((__u32)(x)) ? \
110 ___constant_swab32(x) : \
111 __fswab32(x))
112
113/**
114 * __swab64 - return a byteswapped 64-bit value
115 * @x: value to byteswap
116 */
117#define __swab64(x) \
118 (__builtin_constant_p((__u64)(x)) ? \
119 ___constant_swab64(x) : \
120 __fswab64(x))
121
122/**
123 * __swahw32 - return a word-swapped 32-bit value
124 * @x: value to wordswap
125 *
126 * __swahw32(0x12340000) is 0x00001234
127 */
128#define __swahw32(x) \
129 (__builtin_constant_p((__u32)(x)) ? \
130 ___constant_swahw32(x) : \
131 __fswahw32(x))
132
133/**
134 * __swahb32 - return a high and low byte-swapped 32-bit value
135 * @x: value to byteswap
136 *
137 * __swahb32(0x12345678) is 0x34127856
138 */
139#define __swahb32(x) \
140 (__builtin_constant_p((__u32)(x)) ? \
141 ___constant_swahb32(x) : \
142 __fswahb32(x))
143
144/**
145 * __swab16p - return a byteswapped 16-bit value from a pointer
146 * @p: pointer to a naturally-aligned 16-bit value
147 */
148static inline __u16 __swab16p(const __u16 *p)
149{
150#ifdef __arch_swab16p
151 return __arch_swab16p(p);
152#else
153 return __swab16(*p);
154#endif
155}
156
157/**
158 * __swab32p - return a byteswapped 32-bit value from a pointer
159 * @p: pointer to a naturally-aligned 32-bit value
160 */
161static inline __u32 __swab32p(const __u32 *p)
162{
163#ifdef __arch_swab32p
164 return __arch_swab32p(p);
165#else
166 return __swab32(*p);
167#endif
168}
169
170/**
171 * __swab64p - return a byteswapped 64-bit value from a pointer
172 * @p: pointer to a naturally-aligned 64-bit value
173 */
174static inline __u64 __swab64p(const __u64 *p)
175{
176#ifdef __arch_swab64p
177 return __arch_swab64p(p);
178#else
179 return __swab64(*p);
180#endif
181}
182
183/**
184 * __swahw32p - return a wordswapped 32-bit value from a pointer
185 * @p: pointer to a naturally-aligned 32-bit value
186 *
187 * See __swahw32() for details of wordswapping.
188 */
189static inline __u32 __swahw32p(const __u32 *p)
190{
191#ifdef __arch_swahw32p
192 return __arch_swahw32p(p);
193#else
194 return __swahw32(*p);
195#endif
196}
197
198/**
199 * __swahb32p - return a high and low byteswapped 32-bit value from a pointer
200 * @p: pointer to a naturally-aligned 32-bit value
201 *
202 * See __swahb32() for details of high/low byteswapping.
203 */
204static inline __u32 __swahb32p(const __u32 *p)
205{
206#ifdef __arch_swahb32p
207 return __arch_swahb32p(p);
208#else
209 return __swahb32(*p);
210#endif
211}
212
213/**
214 * __swab16s - byteswap a 16-bit value in-place
215 * @p: pointer to a naturally-aligned 16-bit value
216 */
217static inline void __swab16s(__u16 *p)
218{
219#ifdef __arch_swab16s
220 __arch_swab16s(p);
221#else
222 *p = __swab16p(p);
223#endif
224}
225/**
226 * __swab32s - byteswap a 32-bit value in-place
227 * @p: pointer to a naturally-aligned 32-bit value
228 */
229static inline void __swab32s(__u32 *p)
230{
231#ifdef __arch_swab32s
232 __arch_swab32s(p);
233#else
234 *p = __swab32p(p);
235#endif
236}
237
238/**
239 * __swab64s - byteswap a 64-bit value in-place
240 * @p: pointer to a naturally-aligned 64-bit value
241 */
242static inline void __swab64s(__u64 *p)
243{
244#ifdef __arch_swab64s
245 __arch_swab64s(p);
246#else
247 *p = __swab64p(p);
248#endif
249}
250
251/**
252 * __swahw32s - wordswap a 32-bit value in-place
253 * @p: pointer to a naturally-aligned 32-bit value
254 *
255 * See __swahw32() for details of wordswapping
256 */
257static inline void __swahw32s(__u32 *p)
258{
259#ifdef __arch_swahw32s
260 __arch_swahw32s(p);
261#else
262 *p = __swahw32p(p);
263#endif
264}
265
266/**
267 * __swahb32s - high and low byteswap a 32-bit value in-place
268 * @p: pointer to a naturally-aligned 32-bit value
269 *
270 * See __swahb32() for details of high and low byte swapping
271 */
272static inline void __swahb32s(__u32 *p)
273{
274#ifdef __arch_swahb32s
275 __arch_swahb32s(p);
276#else
277 *p = __swahb32p(p);
278#endif
279}
280
281#ifdef __KERNEL__
282# define swab16 __swab16 6# define swab16 __swab16
283# define swab32 __swab32 7# define swab32 __swab32
284# define swab64 __swab64 8# define swab64 __swab64
@@ -294,6 +18,4 @@ static inline void __swahb32s(__u32 *p)
294# define swab64s __swab64s 18# define swab64s __swab64s
295# define swahw32s __swahw32s 19# define swahw32s __swahw32s
296# define swahb32s __swahb32s 20# define swahb32s __swahb32s
297#endif /* __KERNEL__ */
298
299#endif /* _LINUX_SWAB_H */ 21#endif /* _LINUX_SWAB_H */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 388e70601413..68df9c17fbbb 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -281,7 +281,7 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
281} 281}
282#endif 282#endif
283 283
284extern int page_evictable(struct page *page, struct vm_area_struct *vma); 284extern int page_evictable(struct page *page);
285extern void check_move_unevictable_pages(struct page **, int nr_pages); 285extern void check_move_unevictable_pages(struct page **, int nr_pages);
286 286
287extern unsigned long scan_unevictable_pages; 287extern unsigned long scan_unevictable_pages;
diff --git a/include/linux/synclink.h b/include/linux/synclink.h
index 2e7d81c4e5ad..f1405b1c71ba 100644
--- a/include/linux/synclink.h
+++ b/include/linux/synclink.h
@@ -8,295 +8,11 @@
8 * Redistribution of this file is permitted under 8 * Redistribution of this file is permitted under
9 * the terms of the GNU Public License (GPL) 9 * the terms of the GNU Public License (GPL)
10 */ 10 */
11
12#ifndef _SYNCLINK_H_ 11#ifndef _SYNCLINK_H_
13#define _SYNCLINK_H_ 12#define _SYNCLINK_H_
14#define SYNCLINK_H_VERSION 3.6
15
16#include <linux/types.h>
17
18#define BIT0 0x0001
19#define BIT1 0x0002
20#define BIT2 0x0004
21#define BIT3 0x0008
22#define BIT4 0x0010
23#define BIT5 0x0020
24#define BIT6 0x0040
25#define BIT7 0x0080
26#define BIT8 0x0100
27#define BIT9 0x0200
28#define BIT10 0x0400
29#define BIT11 0x0800
30#define BIT12 0x1000
31#define BIT13 0x2000
32#define BIT14 0x4000
33#define BIT15 0x8000
34#define BIT16 0x00010000
35#define BIT17 0x00020000
36#define BIT18 0x00040000
37#define BIT19 0x00080000
38#define BIT20 0x00100000
39#define BIT21 0x00200000
40#define BIT22 0x00400000
41#define BIT23 0x00800000
42#define BIT24 0x01000000
43#define BIT25 0x02000000
44#define BIT26 0x04000000
45#define BIT27 0x08000000
46#define BIT28 0x10000000
47#define BIT29 0x20000000
48#define BIT30 0x40000000
49#define BIT31 0x80000000
50
51
52#define HDLC_MAX_FRAME_SIZE 65535
53#define MAX_ASYNC_TRANSMIT 4096
54#define MAX_ASYNC_BUFFER_SIZE 4096
55
56#define ASYNC_PARITY_NONE 0
57#define ASYNC_PARITY_EVEN 1
58#define ASYNC_PARITY_ODD 2
59#define ASYNC_PARITY_SPACE 3
60
61#define HDLC_FLAG_UNDERRUN_ABORT7 0x0000
62#define HDLC_FLAG_UNDERRUN_ABORT15 0x0001
63#define HDLC_FLAG_UNDERRUN_FLAG 0x0002
64#define HDLC_FLAG_UNDERRUN_CRC 0x0004
65#define HDLC_FLAG_SHARE_ZERO 0x0010
66#define HDLC_FLAG_AUTO_CTS 0x0020
67#define HDLC_FLAG_AUTO_DCD 0x0040
68#define HDLC_FLAG_AUTO_RTS 0x0080
69#define HDLC_FLAG_RXC_DPLL 0x0100
70#define HDLC_FLAG_RXC_BRG 0x0200
71#define HDLC_FLAG_RXC_TXCPIN 0x8000
72#define HDLC_FLAG_RXC_RXCPIN 0x0000
73#define HDLC_FLAG_TXC_DPLL 0x0400
74#define HDLC_FLAG_TXC_BRG 0x0800
75#define HDLC_FLAG_TXC_TXCPIN 0x0000
76#define HDLC_FLAG_TXC_RXCPIN 0x0008
77#define HDLC_FLAG_DPLL_DIV8 0x1000
78#define HDLC_FLAG_DPLL_DIV16 0x2000
79#define HDLC_FLAG_DPLL_DIV32 0x0000
80#define HDLC_FLAG_HDLC_LOOPMODE 0x4000
81
82#define HDLC_CRC_NONE 0
83#define HDLC_CRC_16_CCITT 1
84#define HDLC_CRC_32_CCITT 2
85#define HDLC_CRC_MASK 0x00ff
86#define HDLC_CRC_RETURN_EX 0x8000
87
88#define RX_OK 0
89#define RX_CRC_ERROR 1
90
91#define HDLC_TXIDLE_FLAGS 0
92#define HDLC_TXIDLE_ALT_ZEROS_ONES 1
93#define HDLC_TXIDLE_ZEROS 2
94#define HDLC_TXIDLE_ONES 3
95#define HDLC_TXIDLE_ALT_MARK_SPACE 4
96#define HDLC_TXIDLE_SPACE 5
97#define HDLC_TXIDLE_MARK 6
98#define HDLC_TXIDLE_CUSTOM_8 0x10000000
99#define HDLC_TXIDLE_CUSTOM_16 0x20000000
100
101#define HDLC_ENCODING_NRZ 0
102#define HDLC_ENCODING_NRZB 1
103#define HDLC_ENCODING_NRZI_MARK 2
104#define HDLC_ENCODING_NRZI_SPACE 3
105#define HDLC_ENCODING_NRZI HDLC_ENCODING_NRZI_SPACE
106#define HDLC_ENCODING_BIPHASE_MARK 4
107#define HDLC_ENCODING_BIPHASE_SPACE 5
108#define HDLC_ENCODING_BIPHASE_LEVEL 6
109#define HDLC_ENCODING_DIFF_BIPHASE_LEVEL 7
110
111#define HDLC_PREAMBLE_LENGTH_8BITS 0
112#define HDLC_PREAMBLE_LENGTH_16BITS 1
113#define HDLC_PREAMBLE_LENGTH_32BITS 2
114#define HDLC_PREAMBLE_LENGTH_64BITS 3
115
116#define HDLC_PREAMBLE_PATTERN_NONE 0
117#define HDLC_PREAMBLE_PATTERN_ZEROS 1
118#define HDLC_PREAMBLE_PATTERN_FLAGS 2
119#define HDLC_PREAMBLE_PATTERN_10 3
120#define HDLC_PREAMBLE_PATTERN_01 4
121#define HDLC_PREAMBLE_PATTERN_ONES 5
122
123#define MGSL_MODE_ASYNC 1
124#define MGSL_MODE_HDLC 2
125#define MGSL_MODE_MONOSYNC 3
126#define MGSL_MODE_BISYNC 4
127#define MGSL_MODE_RAW 6
128#define MGSL_MODE_BASE_CLOCK 7
129#define MGSL_MODE_XSYNC 8
130
131#define MGSL_BUS_TYPE_ISA 1
132#define MGSL_BUS_TYPE_EISA 2
133#define MGSL_BUS_TYPE_PCI 5
134
135#define MGSL_INTERFACE_MASK 0xf
136#define MGSL_INTERFACE_DISABLE 0
137#define MGSL_INTERFACE_RS232 1
138#define MGSL_INTERFACE_V35 2
139#define MGSL_INTERFACE_RS422 3
140#define MGSL_INTERFACE_RTS_EN 0x10
141#define MGSL_INTERFACE_LL 0x20
142#define MGSL_INTERFACE_RL 0x40
143#define MGSL_INTERFACE_MSB_FIRST 0x80
144
145typedef struct _MGSL_PARAMS
146{
147 /* Common */
148
149 unsigned long mode; /* Asynchronous or HDLC */
150 unsigned char loopback; /* internal loopback mode */
151
152 /* HDLC Only */
153
154 unsigned short flags;
155 unsigned char encoding; /* NRZ, NRZI, etc. */
156 unsigned long clock_speed; /* external clock speed in bits per second */
157 unsigned char addr_filter; /* receive HDLC address filter, 0xFF = disable */
158 unsigned short crc_type; /* None, CRC16-CCITT, or CRC32-CCITT */
159 unsigned char preamble_length;
160 unsigned char preamble;
161 13
162 /* Async Only */ 14#include <uapi/linux/synclink.h>
163 15
164 unsigned long data_rate; /* bits per second */
165 unsigned char data_bits; /* 7 or 8 data bits */
166 unsigned char stop_bits; /* 1 or 2 stop bits */
167 unsigned char parity; /* none, even, or odd */
168
169} MGSL_PARAMS, *PMGSL_PARAMS;
170
171#define MICROGATE_VENDOR_ID 0x13c0
172#define SYNCLINK_DEVICE_ID 0x0010
173#define MGSCC_DEVICE_ID 0x0020
174#define SYNCLINK_SCA_DEVICE_ID 0x0030
175#define SYNCLINK_GT_DEVICE_ID 0x0070
176#define SYNCLINK_GT4_DEVICE_ID 0x0080
177#define SYNCLINK_AC_DEVICE_ID 0x0090
178#define SYNCLINK_GT2_DEVICE_ID 0x00A0
179#define MGSL_MAX_SERIAL_NUMBER 30
180
181/*
182** device diagnostics status
183*/
184
185#define DiagStatus_OK 0
186#define DiagStatus_AddressFailure 1
187#define DiagStatus_AddressConflict 2
188#define DiagStatus_IrqFailure 3
189#define DiagStatus_IrqConflict 4
190#define DiagStatus_DmaFailure 5
191#define DiagStatus_DmaConflict 6
192#define DiagStatus_PciAdapterNotFound 7
193#define DiagStatus_CantAssignPciResources 8
194#define DiagStatus_CantAssignPciMemAddr 9
195#define DiagStatus_CantAssignPciIoAddr 10
196#define DiagStatus_CantAssignPciIrq 11
197#define DiagStatus_MemoryError 12
198
199#define SerialSignal_DCD 0x01 /* Data Carrier Detect */
200#define SerialSignal_TXD 0x02 /* Transmit Data */
201#define SerialSignal_RI 0x04 /* Ring Indicator */
202#define SerialSignal_RXD 0x08 /* Receive Data */
203#define SerialSignal_CTS 0x10 /* Clear to Send */
204#define SerialSignal_RTS 0x20 /* Request to Send */
205#define SerialSignal_DSR 0x40 /* Data Set Ready */
206#define SerialSignal_DTR 0x80 /* Data Terminal Ready */
207
208
209/*
210 * Counters of the input lines (CTS, DSR, RI, CD) interrupts
211 */
212struct mgsl_icount {
213 __u32 cts, dsr, rng, dcd, tx, rx;
214 __u32 frame, parity, overrun, brk;
215 __u32 buf_overrun;
216 __u32 txok;
217 __u32 txunder;
218 __u32 txabort;
219 __u32 txtimeout;
220 __u32 rxshort;
221 __u32 rxlong;
222 __u32 rxabort;
223 __u32 rxover;
224 __u32 rxcrc;
225 __u32 rxok;
226 __u32 exithunt;
227 __u32 rxidle;
228};
229
230struct gpio_desc {
231 __u32 state;
232 __u32 smask;
233 __u32 dir;
234 __u32 dmask;
235};
236
237#define DEBUG_LEVEL_DATA 1
238#define DEBUG_LEVEL_ERROR 2
239#define DEBUG_LEVEL_INFO 3
240#define DEBUG_LEVEL_BH 4
241#define DEBUG_LEVEL_ISR 5
242
243/*
244** Event bit flags for use with MgslWaitEvent
245*/
246
247#define MgslEvent_DsrActive 0x0001
248#define MgslEvent_DsrInactive 0x0002
249#define MgslEvent_Dsr 0x0003
250#define MgslEvent_CtsActive 0x0004
251#define MgslEvent_CtsInactive 0x0008
252#define MgslEvent_Cts 0x000c
253#define MgslEvent_DcdActive 0x0010
254#define MgslEvent_DcdInactive 0x0020
255#define MgslEvent_Dcd 0x0030
256#define MgslEvent_RiActive 0x0040
257#define MgslEvent_RiInactive 0x0080
258#define MgslEvent_Ri 0x00c0
259#define MgslEvent_ExitHuntMode 0x0100
260#define MgslEvent_IdleReceived 0x0200
261
262/* Private IOCTL codes:
263 *
264 * MGSL_IOCSPARAMS set MGSL_PARAMS structure values
265 * MGSL_IOCGPARAMS get current MGSL_PARAMS structure values
266 * MGSL_IOCSTXIDLE set current transmit idle mode
267 * MGSL_IOCGTXIDLE get current transmit idle mode
268 * MGSL_IOCTXENABLE enable or disable transmitter
269 * MGSL_IOCRXENABLE enable or disable receiver
270 * MGSL_IOCTXABORT abort transmitting frame (HDLC)
271 * MGSL_IOCGSTATS return current statistics
272 * MGSL_IOCWAITEVENT wait for specified event to occur
273 * MGSL_LOOPTXDONE transmit in HDLC LoopMode done
274 * MGSL_IOCSIF set the serial interface type
275 * MGSL_IOCGIF get the serial interface type
276 */
277#define MGSL_MAGIC_IOC 'm'
278#define MGSL_IOCSPARAMS _IOW(MGSL_MAGIC_IOC,0,struct _MGSL_PARAMS)
279#define MGSL_IOCGPARAMS _IOR(MGSL_MAGIC_IOC,1,struct _MGSL_PARAMS)
280#define MGSL_IOCSTXIDLE _IO(MGSL_MAGIC_IOC,2)
281#define MGSL_IOCGTXIDLE _IO(MGSL_MAGIC_IOC,3)
282#define MGSL_IOCTXENABLE _IO(MGSL_MAGIC_IOC,4)
283#define MGSL_IOCRXENABLE _IO(MGSL_MAGIC_IOC,5)
284#define MGSL_IOCTXABORT _IO(MGSL_MAGIC_IOC,6)
285#define MGSL_IOCGSTATS _IO(MGSL_MAGIC_IOC,7)
286#define MGSL_IOCWAITEVENT _IOWR(MGSL_MAGIC_IOC,8,int)
287#define MGSL_IOCCLRMODCOUNT _IO(MGSL_MAGIC_IOC,15)
288#define MGSL_IOCLOOPTXDONE _IO(MGSL_MAGIC_IOC,9)
289#define MGSL_IOCSIF _IO(MGSL_MAGIC_IOC,10)
290#define MGSL_IOCGIF _IO(MGSL_MAGIC_IOC,11)
291#define MGSL_IOCSGPIO _IOW(MGSL_MAGIC_IOC,16,struct gpio_desc)
292#define MGSL_IOCGGPIO _IOR(MGSL_MAGIC_IOC,17,struct gpio_desc)
293#define MGSL_IOCWAITGPIO _IOWR(MGSL_MAGIC_IOC,18,struct gpio_desc)
294#define MGSL_IOCSXSYNC _IO(MGSL_MAGIC_IOC, 19)
295#define MGSL_IOCGXSYNC _IO(MGSL_MAGIC_IOC, 20)
296#define MGSL_IOCSXCTRL _IO(MGSL_MAGIC_IOC, 21)
297#define MGSL_IOCGXCTRL _IO(MGSL_MAGIC_IOC, 22)
298
299#ifdef __KERNEL__
300/* provide 32 bit ioctl compatibility on 64 bit systems */ 16/* provide 32 bit ioctl compatibility on 64 bit systems */
301#ifdef CONFIG_COMPAT 17#ifdef CONFIG_COMPAT
302#include <linux/compat.h> 18#include <linux/compat.h>
@@ -318,6 +34,4 @@ struct MGSL_PARAMS32 {
318#define MGSL_IOCSPARAMS32 _IOW(MGSL_MAGIC_IOC,0,struct MGSL_PARAMS32) 34#define MGSL_IOCSPARAMS32 _IOW(MGSL_MAGIC_IOC,0,struct MGSL_PARAMS32)
319#define MGSL_IOCGPARAMS32 _IOR(MGSL_MAGIC_IOC,1,struct MGSL_PARAMS32) 35#define MGSL_IOCGPARAMS32 _IOR(MGSL_MAGIC_IOC,1,struct MGSL_PARAMS32)
320#endif 36#endif
321#endif
322
323#endif /* _SYNCLINK_H_ */ 37#endif /* _SYNCLINK_H_ */
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 19439c75c5b2..727f0cd73921 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -827,7 +827,15 @@ asmlinkage long sys_fanotify_mark(int fanotify_fd, unsigned int flags,
827 const char __user *pathname); 827 const char __user *pathname);
828asmlinkage long sys_syncfs(int fd); 828asmlinkage long sys_syncfs(int fd);
829 829
830#ifndef CONFIG_GENERIC_KERNEL_EXECVE
830int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]); 831int kernel_execve(const char *filename, const char *const argv[], const char *const envp[]);
832#else
833#define kernel_execve(filename, argv, envp) \
834 do_execve(filename, \
835 (const char __user *const __user *)argv, \
836 (const char __user *const __user *)envp, \
837 current_pt_regs())
838#endif
831 839
832 840
833asmlinkage long sys_perf_event_open( 841asmlinkage long sys_perf_event_open(
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index c34b4c82b0dc..cd844a6a8d5f 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -18,921 +18,14 @@
18 **************************************************************** 18 ****************************************************************
19 **************************************************************** 19 ****************************************************************
20 */ 20 */
21
22#ifndef _LINUX_SYSCTL_H 21#ifndef _LINUX_SYSCTL_H
23#define _LINUX_SYSCTL_H 22#define _LINUX_SYSCTL_H
24 23
25#include <linux/kernel.h>
26#include <linux/types.h>
27#include <linux/compiler.h>
28
29struct completion;
30
31#define CTL_MAXNAME 10 /* how many path components do we allow in a
32 call to sysctl? In other words, what is
33 the largest acceptable value for the nlen
34 member of a struct __sysctl_args to have? */
35
36struct __sysctl_args {
37 int __user *name;
38 int nlen;
39 void __user *oldval;
40 size_t __user *oldlenp;
41 void __user *newval;
42 size_t newlen;
43 unsigned long __unused[4];
44};
45
46/* Define sysctl names first */
47
48/* Top-level names: */
49
50enum
51{
52 CTL_KERN=1, /* General kernel info and control */
53 CTL_VM=2, /* VM management */
54 CTL_NET=3, /* Networking */
55 CTL_PROC=4, /* removal breaks strace(1) compilation */
56 CTL_FS=5, /* Filesystems */
57 CTL_DEBUG=6, /* Debugging */
58 CTL_DEV=7, /* Devices */
59 CTL_BUS=8, /* Busses */
60 CTL_ABI=9, /* Binary emulation */
61 CTL_CPU=10, /* CPU stuff (speed scaling, etc) */
62 CTL_ARLAN=254, /* arlan wireless driver */
63 CTL_S390DBF=5677, /* s390 debug */
64 CTL_SUNRPC=7249, /* sunrpc debug */
65 CTL_PM=9899, /* frv power management */
66 CTL_FRV=9898, /* frv specific sysctls */
67};
68
69/* CTL_BUS names: */
70enum
71{
72 CTL_BUS_ISA=1 /* ISA */
73};
74
75/* /proc/sys/fs/inotify/ */
76enum
77{
78 INOTIFY_MAX_USER_INSTANCES=1, /* max instances per user */
79 INOTIFY_MAX_USER_WATCHES=2, /* max watches per user */
80 INOTIFY_MAX_QUEUED_EVENTS=3 /* max queued events per instance */
81};
82
83/* CTL_KERN names: */
84enum
85{
86 KERN_OSTYPE=1, /* string: system version */
87 KERN_OSRELEASE=2, /* string: system release */
88 KERN_OSREV=3, /* int: system revision */
89 KERN_VERSION=4, /* string: compile time info */
90 KERN_SECUREMASK=5, /* struct: maximum rights mask */
91 KERN_PROF=6, /* table: profiling information */
92 KERN_NODENAME=7, /* string: hostname */
93 KERN_DOMAINNAME=8, /* string: domainname */
94
95 KERN_PANIC=15, /* int: panic timeout */
96 KERN_REALROOTDEV=16, /* real root device to mount after initrd */
97
98 KERN_SPARC_REBOOT=21, /* reboot command on Sparc */
99 KERN_CTLALTDEL=22, /* int: allow ctl-alt-del to reboot */
100 KERN_PRINTK=23, /* struct: control printk logging parameters */
101 KERN_NAMETRANS=24, /* Name translation */
102 KERN_PPC_HTABRECLAIM=25, /* turn htab reclaimation on/off on PPC */
103 KERN_PPC_ZEROPAGED=26, /* turn idle page zeroing on/off on PPC */
104 KERN_PPC_POWERSAVE_NAP=27, /* use nap mode for power saving */
105 KERN_MODPROBE=28, /* string: modprobe path */
106 KERN_SG_BIG_BUFF=29, /* int: sg driver reserved buffer size */
107 KERN_ACCT=30, /* BSD process accounting parameters */
108 KERN_PPC_L2CR=31, /* l2cr register on PPC */
109
110 KERN_RTSIGNR=32, /* Number of rt sigs queued */
111 KERN_RTSIGMAX=33, /* Max queuable */
112
113 KERN_SHMMAX=34, /* long: Maximum shared memory segment */
114 KERN_MSGMAX=35, /* int: Maximum size of a messege */
115 KERN_MSGMNB=36, /* int: Maximum message queue size */
116 KERN_MSGPOOL=37, /* int: Maximum system message pool size */
117 KERN_SYSRQ=38, /* int: Sysreq enable */
118 KERN_MAX_THREADS=39, /* int: Maximum nr of threads in the system */
119 KERN_RANDOM=40, /* Random driver */
120 KERN_SHMALL=41, /* int: Maximum size of shared memory */
121 KERN_MSGMNI=42, /* int: msg queue identifiers */
122 KERN_SEM=43, /* struct: sysv semaphore limits */
123 KERN_SPARC_STOP_A=44, /* int: Sparc Stop-A enable */
124 KERN_SHMMNI=45, /* int: shm array identifiers */
125 KERN_OVERFLOWUID=46, /* int: overflow UID */
126 KERN_OVERFLOWGID=47, /* int: overflow GID */
127 KERN_SHMPATH=48, /* string: path to shm fs */
128 KERN_HOTPLUG=49, /* string: path to uevent helper (deprecated) */
129 KERN_IEEE_EMULATION_WARNINGS=50, /* int: unimplemented ieee instructions */
130 KERN_S390_USER_DEBUG_LOGGING=51, /* int: dumps of user faults */
131 KERN_CORE_USES_PID=52, /* int: use core or core.%pid */
132 KERN_TAINTED=53, /* int: various kernel tainted flags */
133 KERN_CADPID=54, /* int: PID of the process to notify on CAD */
134 KERN_PIDMAX=55, /* int: PID # limit */
135 KERN_CORE_PATTERN=56, /* string: pattern for core-file names */
136 KERN_PANIC_ON_OOPS=57, /* int: whether we will panic on an oops */
137 KERN_HPPA_PWRSW=58, /* int: hppa soft-power enable */
138 KERN_HPPA_UNALIGNED=59, /* int: hppa unaligned-trap enable */
139 KERN_PRINTK_RATELIMIT=60, /* int: tune printk ratelimiting */
140 KERN_PRINTK_RATELIMIT_BURST=61, /* int: tune printk ratelimiting */
141 KERN_PTY=62, /* dir: pty driver */
142 KERN_NGROUPS_MAX=63, /* int: NGROUPS_MAX */
143 KERN_SPARC_SCONS_PWROFF=64, /* int: serial console power-off halt */
144 KERN_HZ_TIMER=65, /* int: hz timer on or off */
145 KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */
146 KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */
147 KERN_RANDOMIZE=68, /* int: randomize virtual address space */
148 KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */
149 KERN_SPIN_RETRY=70, /* int: number of spinlock retries */
150 KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */
151 KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */
152 KERN_COMPAT_LOG=73, /* int: print compat layer messages */
153 KERN_MAX_LOCK_DEPTH=74, /* int: rtmutex's maximum lock depth */
154 KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */
155 KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */
156};
157
158
159
160/* CTL_VM names: */
161enum
162{
163 VM_UNUSED1=1, /* was: struct: Set vm swapping control */
164 VM_UNUSED2=2, /* was; int: Linear or sqrt() swapout for hogs */
165 VM_UNUSED3=3, /* was: struct: Set free page thresholds */
166 VM_UNUSED4=4, /* Spare */
167 VM_OVERCOMMIT_MEMORY=5, /* Turn off the virtual memory safety limit */
168 VM_UNUSED5=6, /* was: struct: Set buffer memory thresholds */
169 VM_UNUSED7=7, /* was: struct: Set cache memory thresholds */
170 VM_UNUSED8=8, /* was: struct: Control kswapd behaviour */
171 VM_UNUSED9=9, /* was: struct: Set page table cache parameters */
172 VM_PAGE_CLUSTER=10, /* int: set number of pages to swap together */
173 VM_DIRTY_BACKGROUND=11, /* dirty_background_ratio */
174 VM_DIRTY_RATIO=12, /* dirty_ratio */
175 VM_DIRTY_WB_CS=13, /* dirty_writeback_centisecs */
176 VM_DIRTY_EXPIRE_CS=14, /* dirty_expire_centisecs */
177 VM_NR_PDFLUSH_THREADS=15, /* nr_pdflush_threads */
178 VM_OVERCOMMIT_RATIO=16, /* percent of RAM to allow overcommit in */
179 VM_PAGEBUF=17, /* struct: Control pagebuf parameters */
180 VM_HUGETLB_PAGES=18, /* int: Number of available Huge Pages */
181 VM_SWAPPINESS=19, /* Tendency to steal mapped memory */
182 VM_LOWMEM_RESERVE_RATIO=20,/* reservation ratio for lower memory zones */
183 VM_MIN_FREE_KBYTES=21, /* Minimum free kilobytes to maintain */
184 VM_MAX_MAP_COUNT=22, /* int: Maximum number of mmaps/address-space */
185 VM_LAPTOP_MODE=23, /* vm laptop mode */
186 VM_BLOCK_DUMP=24, /* block dump mode */
187 VM_HUGETLB_GROUP=25, /* permitted hugetlb group */
188 VM_VFS_CACHE_PRESSURE=26, /* dcache/icache reclaim pressure */
189 VM_LEGACY_VA_LAYOUT=27, /* legacy/compatibility virtual address space layout */
190 VM_SWAP_TOKEN_TIMEOUT=28, /* default time for token time out */
191 VM_DROP_PAGECACHE=29, /* int: nuke lots of pagecache */
192 VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */
193 VM_ZONE_RECLAIM_MODE=31, /* reclaim local zone memory before going off node */
194 VM_MIN_UNMAPPED=32, /* Set min percent of unmapped pages */
195 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */
196 VM_VDSO_ENABLED=34, /* map VDSO into new processes? */
197 VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */
198};
199
200
201/* CTL_NET names: */
202enum
203{
204 NET_CORE=1,
205 NET_ETHER=2,
206 NET_802=3,
207 NET_UNIX=4,
208 NET_IPV4=5,
209 NET_IPX=6,
210 NET_ATALK=7,
211 NET_NETROM=8,
212 NET_AX25=9,
213 NET_BRIDGE=10,
214 NET_ROSE=11,
215 NET_IPV6=12,
216 NET_X25=13,
217 NET_TR=14,
218 NET_DECNET=15,
219 NET_ECONET=16,
220 NET_SCTP=17,
221 NET_LLC=18,
222 NET_NETFILTER=19,
223 NET_DCCP=20,
224 NET_IRDA=412,
225};
226
227/* /proc/sys/kernel/random */
228enum
229{
230 RANDOM_POOLSIZE=1,
231 RANDOM_ENTROPY_COUNT=2,
232 RANDOM_READ_THRESH=3,
233 RANDOM_WRITE_THRESH=4,
234 RANDOM_BOOT_ID=5,
235 RANDOM_UUID=6
236};
237
238/* /proc/sys/kernel/pty */
239enum
240{
241 PTY_MAX=1,
242 PTY_NR=2
243};
244
245/* /proc/sys/bus/isa */
246enum
247{
248 BUS_ISA_MEM_BASE=1,
249 BUS_ISA_PORT_BASE=2,
250 BUS_ISA_PORT_SHIFT=3
251};
252
253/* /proc/sys/net/core */
254enum
255{
256 NET_CORE_WMEM_MAX=1,
257 NET_CORE_RMEM_MAX=2,
258 NET_CORE_WMEM_DEFAULT=3,
259 NET_CORE_RMEM_DEFAULT=4,
260/* was NET_CORE_DESTROY_DELAY */
261 NET_CORE_MAX_BACKLOG=6,
262 NET_CORE_FASTROUTE=7,
263 NET_CORE_MSG_COST=8,
264 NET_CORE_MSG_BURST=9,
265 NET_CORE_OPTMEM_MAX=10,
266 NET_CORE_HOT_LIST_LENGTH=11,
267 NET_CORE_DIVERT_VERSION=12,
268 NET_CORE_NO_CONG_THRESH=13,
269 NET_CORE_NO_CONG=14,
270 NET_CORE_LO_CONG=15,
271 NET_CORE_MOD_CONG=16,
272 NET_CORE_DEV_WEIGHT=17,
273 NET_CORE_SOMAXCONN=18,
274 NET_CORE_BUDGET=19,
275 NET_CORE_AEVENT_ETIME=20,
276 NET_CORE_AEVENT_RSEQTH=21,
277 NET_CORE_WARNINGS=22,
278};
279
280/* /proc/sys/net/ethernet */
281
282/* /proc/sys/net/802 */
283
284/* /proc/sys/net/unix */
285
286enum
287{
288 NET_UNIX_DESTROY_DELAY=1,
289 NET_UNIX_DELETE_DELAY=2,
290 NET_UNIX_MAX_DGRAM_QLEN=3,
291};
292
293/* /proc/sys/net/netfilter */
294enum
295{
296 NET_NF_CONNTRACK_MAX=1,
297 NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT=2,
298 NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV=3,
299 NET_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED=4,
300 NET_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT=5,
301 NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT=6,
302 NET_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK=7,
303 NET_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT=8,
304 NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE=9,
305 NET_NF_CONNTRACK_UDP_TIMEOUT=10,
306 NET_NF_CONNTRACK_UDP_TIMEOUT_STREAM=11,
307 NET_NF_CONNTRACK_ICMP_TIMEOUT=12,
308 NET_NF_CONNTRACK_GENERIC_TIMEOUT=13,
309 NET_NF_CONNTRACK_BUCKETS=14,
310 NET_NF_CONNTRACK_LOG_INVALID=15,
311 NET_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS=16,
312 NET_NF_CONNTRACK_TCP_LOOSE=17,
313 NET_NF_CONNTRACK_TCP_BE_LIBERAL=18,
314 NET_NF_CONNTRACK_TCP_MAX_RETRANS=19,
315 NET_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED=20,
316 NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT=21,
317 NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED=22,
318 NET_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED=23,
319 NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24,
320 NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25,
321 NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26,
322 NET_NF_CONNTRACK_COUNT=27,
323 NET_NF_CONNTRACK_ICMPV6_TIMEOUT=28,
324 NET_NF_CONNTRACK_FRAG6_TIMEOUT=29,
325 NET_NF_CONNTRACK_FRAG6_LOW_THRESH=30,
326 NET_NF_CONNTRACK_FRAG6_HIGH_THRESH=31,
327 NET_NF_CONNTRACK_CHECKSUM=32,
328};
329
330/* /proc/sys/net/ipv4 */
331enum
332{
333 /* v2.0 compatibile variables */
334 NET_IPV4_FORWARD=8,
335 NET_IPV4_DYNADDR=9,
336
337 NET_IPV4_CONF=16,
338 NET_IPV4_NEIGH=17,
339 NET_IPV4_ROUTE=18,
340 NET_IPV4_FIB_HASH=19,
341 NET_IPV4_NETFILTER=20,
342
343 NET_IPV4_TCP_TIMESTAMPS=33,
344 NET_IPV4_TCP_WINDOW_SCALING=34,
345 NET_IPV4_TCP_SACK=35,
346 NET_IPV4_TCP_RETRANS_COLLAPSE=36,
347 NET_IPV4_DEFAULT_TTL=37,
348 NET_IPV4_AUTOCONFIG=38,
349 NET_IPV4_NO_PMTU_DISC=39,
350 NET_IPV4_TCP_SYN_RETRIES=40,
351 NET_IPV4_IPFRAG_HIGH_THRESH=41,
352 NET_IPV4_IPFRAG_LOW_THRESH=42,
353 NET_IPV4_IPFRAG_TIME=43,
354 NET_IPV4_TCP_MAX_KA_PROBES=44,
355 NET_IPV4_TCP_KEEPALIVE_TIME=45,
356 NET_IPV4_TCP_KEEPALIVE_PROBES=46,
357 NET_IPV4_TCP_RETRIES1=47,
358 NET_IPV4_TCP_RETRIES2=48,
359 NET_IPV4_TCP_FIN_TIMEOUT=49,
360 NET_IPV4_IP_MASQ_DEBUG=50,
361 NET_TCP_SYNCOOKIES=51,
362 NET_TCP_STDURG=52,
363 NET_TCP_RFC1337=53,
364 NET_TCP_SYN_TAILDROP=54,
365 NET_TCP_MAX_SYN_BACKLOG=55,
366 NET_IPV4_LOCAL_PORT_RANGE=56,
367 NET_IPV4_ICMP_ECHO_IGNORE_ALL=57,
368 NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS=58,
369 NET_IPV4_ICMP_SOURCEQUENCH_RATE=59,
370 NET_IPV4_ICMP_DESTUNREACH_RATE=60,
371 NET_IPV4_ICMP_TIMEEXCEED_RATE=61,
372 NET_IPV4_ICMP_PARAMPROB_RATE=62,
373 NET_IPV4_ICMP_ECHOREPLY_RATE=63,
374 NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES=64,
375 NET_IPV4_IGMP_MAX_MEMBERSHIPS=65,
376 NET_TCP_TW_RECYCLE=66,
377 NET_IPV4_ALWAYS_DEFRAG=67,
378 NET_IPV4_TCP_KEEPALIVE_INTVL=68,
379 NET_IPV4_INET_PEER_THRESHOLD=69,
380 NET_IPV4_INET_PEER_MINTTL=70,
381 NET_IPV4_INET_PEER_MAXTTL=71,
382 NET_IPV4_INET_PEER_GC_MINTIME=72,
383 NET_IPV4_INET_PEER_GC_MAXTIME=73,
384 NET_TCP_ORPHAN_RETRIES=74,
385 NET_TCP_ABORT_ON_OVERFLOW=75,
386 NET_TCP_SYNACK_RETRIES=76,
387 NET_TCP_MAX_ORPHANS=77,
388 NET_TCP_MAX_TW_BUCKETS=78,
389 NET_TCP_FACK=79,
390 NET_TCP_REORDERING=80,
391 NET_TCP_ECN=81,
392 NET_TCP_DSACK=82,
393 NET_TCP_MEM=83,
394 NET_TCP_WMEM=84,
395 NET_TCP_RMEM=85,
396 NET_TCP_APP_WIN=86,
397 NET_TCP_ADV_WIN_SCALE=87,
398 NET_IPV4_NONLOCAL_BIND=88,
399 NET_IPV4_ICMP_RATELIMIT=89,
400 NET_IPV4_ICMP_RATEMASK=90,
401 NET_TCP_TW_REUSE=91,
402 NET_TCP_FRTO=92,
403 NET_TCP_LOW_LATENCY=93,
404 NET_IPV4_IPFRAG_SECRET_INTERVAL=94,
405 NET_IPV4_IGMP_MAX_MSF=96,
406 NET_TCP_NO_METRICS_SAVE=97,
407 NET_TCP_DEFAULT_WIN_SCALE=105,
408 NET_TCP_MODERATE_RCVBUF=106,
409 NET_TCP_TSO_WIN_DIVISOR=107,
410 NET_TCP_BIC_BETA=108,
411 NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109,
412 NET_TCP_CONG_CONTROL=110,
413 NET_TCP_ABC=111,
414 NET_IPV4_IPFRAG_MAX_DIST=112,
415 NET_TCP_MTU_PROBING=113,
416 NET_TCP_BASE_MSS=114,
417 NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115,
418 NET_TCP_DMA_COPYBREAK=116,
419 NET_TCP_SLOW_START_AFTER_IDLE=117,
420 NET_CIPSOV4_CACHE_ENABLE=118,
421 NET_CIPSOV4_CACHE_BUCKET_SIZE=119,
422 NET_CIPSOV4_RBM_OPTFMT=120,
423 NET_CIPSOV4_RBM_STRICTVALID=121,
424 NET_TCP_AVAIL_CONG_CONTROL=122,
425 NET_TCP_ALLOWED_CONG_CONTROL=123,
426 NET_TCP_MAX_SSTHRESH=124,
427 NET_TCP_FRTO_RESPONSE=125,
428};
429
430enum {
431 NET_IPV4_ROUTE_FLUSH=1,
432 NET_IPV4_ROUTE_MIN_DELAY=2, /* obsolete since 2.6.25 */
433 NET_IPV4_ROUTE_MAX_DELAY=3, /* obsolete since 2.6.25 */
434 NET_IPV4_ROUTE_GC_THRESH=4,
435 NET_IPV4_ROUTE_MAX_SIZE=5,
436 NET_IPV4_ROUTE_GC_MIN_INTERVAL=6,
437 NET_IPV4_ROUTE_GC_TIMEOUT=7,
438 NET_IPV4_ROUTE_GC_INTERVAL=8, /* obsolete since 2.6.38 */
439 NET_IPV4_ROUTE_REDIRECT_LOAD=9,
440 NET_IPV4_ROUTE_REDIRECT_NUMBER=10,
441 NET_IPV4_ROUTE_REDIRECT_SILENCE=11,
442 NET_IPV4_ROUTE_ERROR_COST=12,
443 NET_IPV4_ROUTE_ERROR_BURST=13,
444 NET_IPV4_ROUTE_GC_ELASTICITY=14,
445 NET_IPV4_ROUTE_MTU_EXPIRES=15,
446 NET_IPV4_ROUTE_MIN_PMTU=16,
447 NET_IPV4_ROUTE_MIN_ADVMSS=17,
448 NET_IPV4_ROUTE_SECRET_INTERVAL=18,
449 NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS=19,
450};
451
452enum
453{
454 NET_PROTO_CONF_ALL=-2,
455 NET_PROTO_CONF_DEFAULT=-3
456
457 /* And device ifindices ... */
458};
459
460enum
461{
462 NET_IPV4_CONF_FORWARDING=1,
463 NET_IPV4_CONF_MC_FORWARDING=2,
464 NET_IPV4_CONF_PROXY_ARP=3,
465 NET_IPV4_CONF_ACCEPT_REDIRECTS=4,
466 NET_IPV4_CONF_SECURE_REDIRECTS=5,
467 NET_IPV4_CONF_SEND_REDIRECTS=6,
468 NET_IPV4_CONF_SHARED_MEDIA=7,
469 NET_IPV4_CONF_RP_FILTER=8,
470 NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE=9,
471 NET_IPV4_CONF_BOOTP_RELAY=10,
472 NET_IPV4_CONF_LOG_MARTIANS=11,
473 NET_IPV4_CONF_TAG=12,
474 NET_IPV4_CONF_ARPFILTER=13,
475 NET_IPV4_CONF_MEDIUM_ID=14,
476 NET_IPV4_CONF_NOXFRM=15,
477 NET_IPV4_CONF_NOPOLICY=16,
478 NET_IPV4_CONF_FORCE_IGMP_VERSION=17,
479 NET_IPV4_CONF_ARP_ANNOUNCE=18,
480 NET_IPV4_CONF_ARP_IGNORE=19,
481 NET_IPV4_CONF_PROMOTE_SECONDARIES=20,
482 NET_IPV4_CONF_ARP_ACCEPT=21,
483 NET_IPV4_CONF_ARP_NOTIFY=22,
484};
485
486/* /proc/sys/net/ipv4/netfilter */
487enum
488{
489 NET_IPV4_NF_CONNTRACK_MAX=1,
490 NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT=2,
491 NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV=3,
492 NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED=4,
493 NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT=5,
494 NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT=6,
495 NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK=7,
496 NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT=8,
497 NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE=9,
498 NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT=10,
499 NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT_STREAM=11,
500 NET_IPV4_NF_CONNTRACK_ICMP_TIMEOUT=12,
501 NET_IPV4_NF_CONNTRACK_GENERIC_TIMEOUT=13,
502 NET_IPV4_NF_CONNTRACK_BUCKETS=14,
503 NET_IPV4_NF_CONNTRACK_LOG_INVALID=15,
504 NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS=16,
505 NET_IPV4_NF_CONNTRACK_TCP_LOOSE=17,
506 NET_IPV4_NF_CONNTRACK_TCP_BE_LIBERAL=18,
507 NET_IPV4_NF_CONNTRACK_TCP_MAX_RETRANS=19,
508 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED=20,
509 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT=21,
510 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED=22,
511 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED=23,
512 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24,
513 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25,
514 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26,
515 NET_IPV4_NF_CONNTRACK_COUNT=27,
516 NET_IPV4_NF_CONNTRACK_CHECKSUM=28,
517};
518
519/* /proc/sys/net/ipv6 */
520enum {
521 NET_IPV6_CONF=16,
522 NET_IPV6_NEIGH=17,
523 NET_IPV6_ROUTE=18,
524 NET_IPV6_ICMP=19,
525 NET_IPV6_BINDV6ONLY=20,
526 NET_IPV6_IP6FRAG_HIGH_THRESH=21,
527 NET_IPV6_IP6FRAG_LOW_THRESH=22,
528 NET_IPV6_IP6FRAG_TIME=23,
529 NET_IPV6_IP6FRAG_SECRET_INTERVAL=24,
530 NET_IPV6_MLD_MAX_MSF=25,
531};
532
533enum {
534 NET_IPV6_ROUTE_FLUSH=1,
535 NET_IPV6_ROUTE_GC_THRESH=2,
536 NET_IPV6_ROUTE_MAX_SIZE=3,
537 NET_IPV6_ROUTE_GC_MIN_INTERVAL=4,
538 NET_IPV6_ROUTE_GC_TIMEOUT=5,
539 NET_IPV6_ROUTE_GC_INTERVAL=6,
540 NET_IPV6_ROUTE_GC_ELASTICITY=7,
541 NET_IPV6_ROUTE_MTU_EXPIRES=8,
542 NET_IPV6_ROUTE_MIN_ADVMSS=9,
543 NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS=10
544};
545
546enum {
547 NET_IPV6_FORWARDING=1,
548 NET_IPV6_HOP_LIMIT=2,
549 NET_IPV6_MTU=3,
550 NET_IPV6_ACCEPT_RA=4,
551 NET_IPV6_ACCEPT_REDIRECTS=5,
552 NET_IPV6_AUTOCONF=6,
553 NET_IPV6_DAD_TRANSMITS=7,
554 NET_IPV6_RTR_SOLICITS=8,
555 NET_IPV6_RTR_SOLICIT_INTERVAL=9,
556 NET_IPV6_RTR_SOLICIT_DELAY=10,
557 NET_IPV6_USE_TEMPADDR=11,
558 NET_IPV6_TEMP_VALID_LFT=12,
559 NET_IPV6_TEMP_PREFERED_LFT=13,
560 NET_IPV6_REGEN_MAX_RETRY=14,
561 NET_IPV6_MAX_DESYNC_FACTOR=15,
562 NET_IPV6_MAX_ADDRESSES=16,
563 NET_IPV6_FORCE_MLD_VERSION=17,
564 NET_IPV6_ACCEPT_RA_DEFRTR=18,
565 NET_IPV6_ACCEPT_RA_PINFO=19,
566 NET_IPV6_ACCEPT_RA_RTR_PREF=20,
567 NET_IPV6_RTR_PROBE_INTERVAL=21,
568 NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22,
569 NET_IPV6_PROXY_NDP=23,
570 NET_IPV6_ACCEPT_SOURCE_ROUTE=25,
571 __NET_IPV6_MAX
572};
573
574/* /proc/sys/net/ipv6/icmp */
575enum {
576 NET_IPV6_ICMP_RATELIMIT=1
577};
578
579/* /proc/sys/net/<protocol>/neigh/<dev> */
580enum {
581 NET_NEIGH_MCAST_SOLICIT=1,
582 NET_NEIGH_UCAST_SOLICIT=2,
583 NET_NEIGH_APP_SOLICIT=3,
584 NET_NEIGH_RETRANS_TIME=4,
585 NET_NEIGH_REACHABLE_TIME=5,
586 NET_NEIGH_DELAY_PROBE_TIME=6,
587 NET_NEIGH_GC_STALE_TIME=7,
588 NET_NEIGH_UNRES_QLEN=8,
589 NET_NEIGH_PROXY_QLEN=9,
590 NET_NEIGH_ANYCAST_DELAY=10,
591 NET_NEIGH_PROXY_DELAY=11,
592 NET_NEIGH_LOCKTIME=12,
593 NET_NEIGH_GC_INTERVAL=13,
594 NET_NEIGH_GC_THRESH1=14,
595 NET_NEIGH_GC_THRESH2=15,
596 NET_NEIGH_GC_THRESH3=16,
597 NET_NEIGH_RETRANS_TIME_MS=17,
598 NET_NEIGH_REACHABLE_TIME_MS=18,
599};
600
601/* /proc/sys/net/dccp */
602enum {
603 NET_DCCP_DEFAULT=1,
604};
605
606/* /proc/sys/net/ipx */
607enum {
608 NET_IPX_PPROP_BROADCASTING=1,
609 NET_IPX_FORWARDING=2
610};
611
612/* /proc/sys/net/llc */
613enum {
614 NET_LLC2=1,
615 NET_LLC_STATION=2,
616};
617
618/* /proc/sys/net/llc/llc2 */
619enum {
620 NET_LLC2_TIMEOUT=1,
621};
622
623/* /proc/sys/net/llc/station */
624enum {
625 NET_LLC_STATION_ACK_TIMEOUT=1,
626};
627
628/* /proc/sys/net/llc/llc2/timeout */
629enum {
630 NET_LLC2_ACK_TIMEOUT=1,
631 NET_LLC2_P_TIMEOUT=2,
632 NET_LLC2_REJ_TIMEOUT=3,
633 NET_LLC2_BUSY_TIMEOUT=4,
634};
635
636/* /proc/sys/net/appletalk */
637enum {
638 NET_ATALK_AARP_EXPIRY_TIME=1,
639 NET_ATALK_AARP_TICK_TIME=2,
640 NET_ATALK_AARP_RETRANSMIT_LIMIT=3,
641 NET_ATALK_AARP_RESOLVE_TIME=4
642};
643
644
645/* /proc/sys/net/netrom */
646enum {
647 NET_NETROM_DEFAULT_PATH_QUALITY=1,
648 NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER=2,
649 NET_NETROM_NETWORK_TTL_INITIALISER=3,
650 NET_NETROM_TRANSPORT_TIMEOUT=4,
651 NET_NETROM_TRANSPORT_MAXIMUM_TRIES=5,
652 NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY=6,
653 NET_NETROM_TRANSPORT_BUSY_DELAY=7,
654 NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE=8,
655 NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT=9,
656 NET_NETROM_ROUTING_CONTROL=10,
657 NET_NETROM_LINK_FAILS_COUNT=11,
658 NET_NETROM_RESET=12
659};
660
661/* /proc/sys/net/ax25 */
662enum {
663 NET_AX25_IP_DEFAULT_MODE=1,
664 NET_AX25_DEFAULT_MODE=2,
665 NET_AX25_BACKOFF_TYPE=3,
666 NET_AX25_CONNECT_MODE=4,
667 NET_AX25_STANDARD_WINDOW=5,
668 NET_AX25_EXTENDED_WINDOW=6,
669 NET_AX25_T1_TIMEOUT=7,
670 NET_AX25_T2_TIMEOUT=8,
671 NET_AX25_T3_TIMEOUT=9,
672 NET_AX25_IDLE_TIMEOUT=10,
673 NET_AX25_N2=11,
674 NET_AX25_PACLEN=12,
675 NET_AX25_PROTOCOL=13,
676 NET_AX25_DAMA_SLAVE_TIMEOUT=14
677};
678
679/* /proc/sys/net/rose */
680enum {
681 NET_ROSE_RESTART_REQUEST_TIMEOUT=1,
682 NET_ROSE_CALL_REQUEST_TIMEOUT=2,
683 NET_ROSE_RESET_REQUEST_TIMEOUT=3,
684 NET_ROSE_CLEAR_REQUEST_TIMEOUT=4,
685 NET_ROSE_ACK_HOLD_BACK_TIMEOUT=5,
686 NET_ROSE_ROUTING_CONTROL=6,
687 NET_ROSE_LINK_FAIL_TIMEOUT=7,
688 NET_ROSE_MAX_VCS=8,
689 NET_ROSE_WINDOW_SIZE=9,
690 NET_ROSE_NO_ACTIVITY_TIMEOUT=10
691};
692
693/* /proc/sys/net/x25 */
694enum {
695 NET_X25_RESTART_REQUEST_TIMEOUT=1,
696 NET_X25_CALL_REQUEST_TIMEOUT=2,
697 NET_X25_RESET_REQUEST_TIMEOUT=3,
698 NET_X25_CLEAR_REQUEST_TIMEOUT=4,
699 NET_X25_ACK_HOLD_BACK_TIMEOUT=5,
700 NET_X25_FORWARD=6
701};
702
703/* /proc/sys/net/token-ring */
704enum
705{
706 NET_TR_RIF_TIMEOUT=1
707};
708
709/* /proc/sys/net/decnet/ */
710enum {
711 NET_DECNET_NODE_TYPE = 1,
712 NET_DECNET_NODE_ADDRESS = 2,
713 NET_DECNET_NODE_NAME = 3,
714 NET_DECNET_DEFAULT_DEVICE = 4,
715 NET_DECNET_TIME_WAIT = 5,
716 NET_DECNET_DN_COUNT = 6,
717 NET_DECNET_DI_COUNT = 7,
718 NET_DECNET_DR_COUNT = 8,
719 NET_DECNET_DST_GC_INTERVAL = 9,
720 NET_DECNET_CONF = 10,
721 NET_DECNET_NO_FC_MAX_CWND = 11,
722 NET_DECNET_MEM = 12,
723 NET_DECNET_RMEM = 13,
724 NET_DECNET_WMEM = 14,
725 NET_DECNET_DEBUG_LEVEL = 255
726};
727
728/* /proc/sys/net/decnet/conf/<dev> */
729enum {
730 NET_DECNET_CONF_LOOPBACK = -2,
731 NET_DECNET_CONF_DDCMP = -3,
732 NET_DECNET_CONF_PPP = -4,
733 NET_DECNET_CONF_X25 = -5,
734 NET_DECNET_CONF_GRE = -6,
735 NET_DECNET_CONF_ETHER = -7
736
737 /* ... and ifindex of devices */
738};
739
740/* /proc/sys/net/decnet/conf/<dev>/ */
741enum {
742 NET_DECNET_CONF_DEV_PRIORITY = 1,
743 NET_DECNET_CONF_DEV_T1 = 2,
744 NET_DECNET_CONF_DEV_T2 = 3,
745 NET_DECNET_CONF_DEV_T3 = 4,
746 NET_DECNET_CONF_DEV_FORWARDING = 5,
747 NET_DECNET_CONF_DEV_BLKSIZE = 6,
748 NET_DECNET_CONF_DEV_STATE = 7
749};
750
751/* /proc/sys/net/sctp */
752enum {
753 NET_SCTP_RTO_INITIAL = 1,
754 NET_SCTP_RTO_MIN = 2,
755 NET_SCTP_RTO_MAX = 3,
756 NET_SCTP_RTO_ALPHA = 4,
757 NET_SCTP_RTO_BETA = 5,
758 NET_SCTP_VALID_COOKIE_LIFE = 6,
759 NET_SCTP_ASSOCIATION_MAX_RETRANS = 7,
760 NET_SCTP_PATH_MAX_RETRANS = 8,
761 NET_SCTP_MAX_INIT_RETRANSMITS = 9,
762 NET_SCTP_HB_INTERVAL = 10,
763 NET_SCTP_PRESERVE_ENABLE = 11,
764 NET_SCTP_MAX_BURST = 12,
765 NET_SCTP_ADDIP_ENABLE = 13,
766 NET_SCTP_PRSCTP_ENABLE = 14,
767 NET_SCTP_SNDBUF_POLICY = 15,
768 NET_SCTP_SACK_TIMEOUT = 16,
769 NET_SCTP_RCVBUF_POLICY = 17,
770};
771
772/* /proc/sys/net/bridge */
773enum {
774 NET_BRIDGE_NF_CALL_ARPTABLES = 1,
775 NET_BRIDGE_NF_CALL_IPTABLES = 2,
776 NET_BRIDGE_NF_CALL_IP6TABLES = 3,
777 NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4,
778 NET_BRIDGE_NF_FILTER_PPPOE_TAGGED = 5,
779};
780
781/* proc/sys/net/irda */
782enum {
783 NET_IRDA_DISCOVERY=1,
784 NET_IRDA_DEVNAME=2,
785 NET_IRDA_DEBUG=3,
786 NET_IRDA_FAST_POLL=4,
787 NET_IRDA_DISCOVERY_SLOTS=5,
788 NET_IRDA_DISCOVERY_TIMEOUT=6,
789 NET_IRDA_SLOT_TIMEOUT=7,
790 NET_IRDA_MAX_BAUD_RATE=8,
791 NET_IRDA_MIN_TX_TURN_TIME=9,
792 NET_IRDA_MAX_TX_DATA_SIZE=10,
793 NET_IRDA_MAX_TX_WINDOW=11,
794 NET_IRDA_MAX_NOREPLY_TIME=12,
795 NET_IRDA_WARN_NOREPLY_TIME=13,
796 NET_IRDA_LAP_KEEPALIVE_TIME=14,
797};
798
799
800/* CTL_FS names: */
801enum
802{
803 FS_NRINODE=1, /* int:current number of allocated inodes */
804 FS_STATINODE=2,
805 FS_MAXINODE=3, /* int:maximum number of inodes that can be allocated */
806 FS_NRDQUOT=4, /* int:current number of allocated dquots */
807 FS_MAXDQUOT=5, /* int:maximum number of dquots that can be allocated */
808 FS_NRFILE=6, /* int:current number of allocated filedescriptors */
809 FS_MAXFILE=7, /* int:maximum number of filedescriptors that can be allocated */
810 FS_DENTRY=8,
811 FS_NRSUPER=9, /* int:current number of allocated super_blocks */
812 FS_MAXSUPER=10, /* int:maximum number of super_blocks that can be allocated */
813 FS_OVERFLOWUID=11, /* int: overflow UID */
814 FS_OVERFLOWGID=12, /* int: overflow GID */
815 FS_LEASES=13, /* int: leases enabled */
816 FS_DIR_NOTIFY=14, /* int: directory notification enabled */
817 FS_LEASE_TIME=15, /* int: maximum time to wait for a lease break */
818 FS_DQSTATS=16, /* disc quota usage statistics and control */
819 FS_XFS=17, /* struct: control xfs parameters */
820 FS_AIO_NR=18, /* current system-wide number of aio requests */
821 FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */
822 FS_INOTIFY=20, /* inotify submenu */
823 FS_OCFS2=988, /* ocfs2 */
824};
825
826/* /proc/sys/fs/quota/ */
827enum {
828 FS_DQ_LOOKUPS = 1,
829 FS_DQ_DROPS = 2,
830 FS_DQ_READS = 3,
831 FS_DQ_WRITES = 4,
832 FS_DQ_CACHE_HITS = 5,
833 FS_DQ_ALLOCATED = 6,
834 FS_DQ_FREE = 7,
835 FS_DQ_SYNCS = 8,
836 FS_DQ_WARNINGS = 9,
837};
838
839/* CTL_DEBUG names: */
840
841/* CTL_DEV names: */
842enum {
843 DEV_CDROM=1,
844 DEV_HWMON=2,
845 DEV_PARPORT=3,
846 DEV_RAID=4,
847 DEV_MAC_HID=5,
848 DEV_SCSI=6,
849 DEV_IPMI=7,
850};
851
852/* /proc/sys/dev/cdrom */
853enum {
854 DEV_CDROM_INFO=1,
855 DEV_CDROM_AUTOCLOSE=2,
856 DEV_CDROM_AUTOEJECT=3,
857 DEV_CDROM_DEBUG=4,
858 DEV_CDROM_LOCK=5,
859 DEV_CDROM_CHECK_MEDIA=6
860};
861
862/* /proc/sys/dev/parport */
863enum {
864 DEV_PARPORT_DEFAULT=-3
865};
866
867/* /proc/sys/dev/raid */
868enum {
869 DEV_RAID_SPEED_LIMIT_MIN=1,
870 DEV_RAID_SPEED_LIMIT_MAX=2
871};
872
873/* /proc/sys/dev/parport/default */
874enum {
875 DEV_PARPORT_DEFAULT_TIMESLICE=1,
876 DEV_PARPORT_DEFAULT_SPINTIME=2
877};
878
879/* /proc/sys/dev/parport/parport n */
880enum {
881 DEV_PARPORT_SPINTIME=1,
882 DEV_PARPORT_BASE_ADDR=2,
883 DEV_PARPORT_IRQ=3,
884 DEV_PARPORT_DMA=4,
885 DEV_PARPORT_MODES=5,
886 DEV_PARPORT_DEVICES=6,
887 DEV_PARPORT_AUTOPROBE=16
888};
889
890/* /proc/sys/dev/parport/parport n/devices/ */
891enum {
892 DEV_PARPORT_DEVICES_ACTIVE=-3,
893};
894
895/* /proc/sys/dev/parport/parport n/devices/device n */
896enum {
897 DEV_PARPORT_DEVICE_TIMESLICE=1,
898};
899
900/* /proc/sys/dev/mac_hid */
901enum {
902 DEV_MAC_HID_KEYBOARD_SENDS_LINUX_KEYCODES=1,
903 DEV_MAC_HID_KEYBOARD_LOCK_KEYCODES=2,
904 DEV_MAC_HID_MOUSE_BUTTON_EMULATION=3,
905 DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE=4,
906 DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE=5,
907 DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6
908};
909
910/* /proc/sys/dev/scsi */
911enum {
912 DEV_SCSI_LOGGING_LEVEL=1,
913};
914
915/* /proc/sys/dev/ipmi */
916enum {
917 DEV_IPMI_POWEROFF_POWERCYCLE=1,
918};
919
920/* /proc/sys/abi */
921enum
922{
923 ABI_DEFHANDLER_COFF=1, /* default handler for coff binaries */
924 ABI_DEFHANDLER_ELF=2, /* default handler for ELF binaries */
925 ABI_DEFHANDLER_LCALL7=3,/* default handler for procs using lcall7 */
926 ABI_DEFHANDLER_LIBCSO=4,/* default handler for an libc.so ELF interp */
927 ABI_TRACE=5, /* tracing flags */
928 ABI_FAKE_UTSNAME=6, /* fake target utsname information */
929};
930
931#ifdef __KERNEL__
932#include <linux/list.h> 24#include <linux/list.h>
933#include <linux/rcupdate.h> 25#include <linux/rcupdate.h>
934#include <linux/wait.h> 26#include <linux/wait.h>
935#include <linux/rbtree.h> 27#include <linux/rbtree.h>
28#include <uapi/linux/sysctl.h>
936 29
937/* For the /proc/sys support */ 30/* For the /proc/sys support */
938struct ctl_table; 31struct ctl_table;
@@ -1122,6 +215,4 @@ static inline void setup_sysctl_set(struct ctl_table_set *p,
1122 215
1123#endif /* CONFIG_SYSCTL */ 216#endif /* CONFIG_SYSCTL */
1124 217
1125#endif /* __KERNEL__ */
1126
1127#endif /* _LINUX_SYSCTL_H */ 218#endif /* _LINUX_SYSCTL_H */
diff --git a/include/linux/tc_act/Kbuild b/include/linux/tc_act/Kbuild
deleted file mode 100644
index 67b501c302b2..000000000000
--- a/include/linux/tc_act/Kbuild
+++ /dev/null
@@ -1,7 +0,0 @@
1header-y += tc_gact.h
2header-y += tc_ipt.h
3header-y += tc_mirred.h
4header-y += tc_pedit.h
5header-y += tc_nat.h
6header-y += tc_skbedit.h
7header-y += tc_csum.h
diff --git a/include/linux/tc_ematch/Kbuild b/include/linux/tc_ematch/Kbuild
deleted file mode 100644
index 4a58a1c32a00..000000000000
--- a/include/linux/tc_ematch/Kbuild
+++ /dev/null
@@ -1,4 +0,0 @@
1header-y += tc_em_cmp.h
2header-y += tc_em_meta.h
3header-y += tc_em_nbyte.h
4header-y += tc_em_text.h
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 67c789ae719c..60b7aac15e0e 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -17,217 +17,13 @@
17#ifndef _LINUX_TCP_H 17#ifndef _LINUX_TCP_H
18#define _LINUX_TCP_H 18#define _LINUX_TCP_H
19 19
20#include <linux/types.h>
21#include <asm/byteorder.h>
22#include <linux/socket.h>
23
24struct tcphdr {
25 __be16 source;
26 __be16 dest;
27 __be32 seq;
28 __be32 ack_seq;
29#if defined(__LITTLE_ENDIAN_BITFIELD)
30 __u16 res1:4,
31 doff:4,
32 fin:1,
33 syn:1,
34 rst:1,
35 psh:1,
36 ack:1,
37 urg:1,
38 ece:1,
39 cwr:1;
40#elif defined(__BIG_ENDIAN_BITFIELD)
41 __u16 doff:4,
42 res1:4,
43 cwr:1,
44 ece:1,
45 urg:1,
46 ack:1,
47 psh:1,
48 rst:1,
49 syn:1,
50 fin:1;
51#else
52#error "Adjust your <asm/byteorder.h> defines"
53#endif
54 __be16 window;
55 __sum16 check;
56 __be16 urg_ptr;
57};
58
59/*
60 * The union cast uses a gcc extension to avoid aliasing problems
61 * (union is compatible to any of its members)
62 * This means this part of the code is -fstrict-aliasing safe now.
63 */
64union tcp_word_hdr {
65 struct tcphdr hdr;
66 __be32 words[5];
67};
68
69#define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3])
70
71enum {
72 TCP_FLAG_CWR = __constant_cpu_to_be32(0x00800000),
73 TCP_FLAG_ECE = __constant_cpu_to_be32(0x00400000),
74 TCP_FLAG_URG = __constant_cpu_to_be32(0x00200000),
75 TCP_FLAG_ACK = __constant_cpu_to_be32(0x00100000),
76 TCP_FLAG_PSH = __constant_cpu_to_be32(0x00080000),
77 TCP_FLAG_RST = __constant_cpu_to_be32(0x00040000),
78 TCP_FLAG_SYN = __constant_cpu_to_be32(0x00020000),
79 TCP_FLAG_FIN = __constant_cpu_to_be32(0x00010000),
80 TCP_RESERVED_BITS = __constant_cpu_to_be32(0x0F000000),
81 TCP_DATA_OFFSET = __constant_cpu_to_be32(0xF0000000)
82};
83
84/*
85 * TCP general constants
86 */
87#define TCP_MSS_DEFAULT 536U /* IPv4 (RFC1122, RFC2581) */
88#define TCP_MSS_DESIRED 1220U /* IPv6 (tunneled), EDNS0 (RFC3226) */
89
90/* TCP socket options */
91#define TCP_NODELAY 1 /* Turn off Nagle's algorithm. */
92#define TCP_MAXSEG 2 /* Limit MSS */
93#define TCP_CORK 3 /* Never send partially complete segments */
94#define TCP_KEEPIDLE 4 /* Start keeplives after this period */
95#define TCP_KEEPINTVL 5 /* Interval between keepalives */
96#define TCP_KEEPCNT 6 /* Number of keepalives before death */
97#define TCP_SYNCNT 7 /* Number of SYN retransmits */
98#define TCP_LINGER2 8 /* Life time of orphaned FIN-WAIT-2 state */
99#define TCP_DEFER_ACCEPT 9 /* Wake up listener only when data arrive */
100#define TCP_WINDOW_CLAMP 10 /* Bound advertised window */
101#define TCP_INFO 11 /* Information about this connection. */
102#define TCP_QUICKACK 12 /* Block/reenable quick acks */
103#define TCP_CONGESTION 13 /* Congestion control algorithm */
104#define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */
105#define TCP_COOKIE_TRANSACTIONS 15 /* TCP Cookie Transactions */
106#define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/
107#define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */
108#define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */
109#define TCP_REPAIR 19 /* TCP sock is under repair right now */
110#define TCP_REPAIR_QUEUE 20
111#define TCP_QUEUE_SEQ 21
112#define TCP_REPAIR_OPTIONS 22
113#define TCP_FASTOPEN 23 /* Enable FastOpen on listeners */
114
115struct tcp_repair_opt {
116 __u32 opt_code;
117 __u32 opt_val;
118};
119
120enum {
121 TCP_NO_QUEUE,
122 TCP_RECV_QUEUE,
123 TCP_SEND_QUEUE,
124 TCP_QUEUES_NR,
125};
126
127/* for TCP_INFO socket option */
128#define TCPI_OPT_TIMESTAMPS 1
129#define TCPI_OPT_SACK 2
130#define TCPI_OPT_WSCALE 4
131#define TCPI_OPT_ECN 8 /* ECN was negociated at TCP session init */
132#define TCPI_OPT_ECN_SEEN 16 /* we received at least one packet with ECT */
133
134enum tcp_ca_state {
135 TCP_CA_Open = 0,
136#define TCPF_CA_Open (1<<TCP_CA_Open)
137 TCP_CA_Disorder = 1,
138#define TCPF_CA_Disorder (1<<TCP_CA_Disorder)
139 TCP_CA_CWR = 2,
140#define TCPF_CA_CWR (1<<TCP_CA_CWR)
141 TCP_CA_Recovery = 3,
142#define TCPF_CA_Recovery (1<<TCP_CA_Recovery)
143 TCP_CA_Loss = 4
144#define TCPF_CA_Loss (1<<TCP_CA_Loss)
145};
146
147struct tcp_info {
148 __u8 tcpi_state;
149 __u8 tcpi_ca_state;
150 __u8 tcpi_retransmits;
151 __u8 tcpi_probes;
152 __u8 tcpi_backoff;
153 __u8 tcpi_options;
154 __u8 tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
155
156 __u32 tcpi_rto;
157 __u32 tcpi_ato;
158 __u32 tcpi_snd_mss;
159 __u32 tcpi_rcv_mss;
160
161 __u32 tcpi_unacked;
162 __u32 tcpi_sacked;
163 __u32 tcpi_lost;
164 __u32 tcpi_retrans;
165 __u32 tcpi_fackets;
166
167 /* Times. */
168 __u32 tcpi_last_data_sent;
169 __u32 tcpi_last_ack_sent; /* Not remembered, sorry. */
170 __u32 tcpi_last_data_recv;
171 __u32 tcpi_last_ack_recv;
172
173 /* Metrics. */
174 __u32 tcpi_pmtu;
175 __u32 tcpi_rcv_ssthresh;
176 __u32 tcpi_rtt;
177 __u32 tcpi_rttvar;
178 __u32 tcpi_snd_ssthresh;
179 __u32 tcpi_snd_cwnd;
180 __u32 tcpi_advmss;
181 __u32 tcpi_reordering;
182
183 __u32 tcpi_rcv_rtt;
184 __u32 tcpi_rcv_space;
185
186 __u32 tcpi_total_retrans;
187};
188
189/* for TCP_MD5SIG socket option */
190#define TCP_MD5SIG_MAXKEYLEN 80
191
192struct tcp_md5sig {
193 struct __kernel_sockaddr_storage tcpm_addr; /* address associated */
194 __u16 __tcpm_pad1; /* zero */
195 __u16 tcpm_keylen; /* key length */
196 __u32 __tcpm_pad2; /* zero */
197 __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* key (binary) */
198};
199
200/* for TCP_COOKIE_TRANSACTIONS (TCPCT) socket option */
201#define TCP_COOKIE_MIN 8 /* 64-bits */
202#define TCP_COOKIE_MAX 16 /* 128-bits */
203#define TCP_COOKIE_PAIR_SIZE (2*TCP_COOKIE_MAX)
204
205/* Flags for both getsockopt and setsockopt */
206#define TCP_COOKIE_IN_ALWAYS (1 << 0) /* Discard SYN without cookie */
207#define TCP_COOKIE_OUT_NEVER (1 << 1) /* Prohibit outgoing cookies,
208 * supercedes everything. */
209
210/* Flags for getsockopt */
211#define TCP_S_DATA_IN (1 << 2) /* Was data received? */
212#define TCP_S_DATA_OUT (1 << 3) /* Was data sent? */
213
214/* TCP_COOKIE_TRANSACTIONS data */
215struct tcp_cookie_transactions {
216 __u16 tcpct_flags; /* see above */
217 __u8 __tcpct_pad1; /* zero */
218 __u8 tcpct_cookie_desired; /* bytes */
219 __u16 tcpct_s_data_desired; /* bytes of variable data */
220 __u16 tcpct_used; /* bytes in value */
221 __u8 tcpct_value[TCP_MSS_DEFAULT];
222};
223
224#ifdef __KERNEL__
225 20
226#include <linux/skbuff.h> 21#include <linux/skbuff.h>
227#include <linux/dmaengine.h> 22#include <linux/dmaengine.h>
228#include <net/sock.h> 23#include <net/sock.h>
229#include <net/inet_connection_sock.h> 24#include <net/inet_connection_sock.h>
230#include <net/inet_timewait_sock.h> 25#include <net/inet_timewait_sock.h>
26#include <uapi/linux/tcp.h>
231 27
232static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb) 28static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb)
233{ 29{
@@ -395,7 +191,8 @@ struct tcp_sock {
395 u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */ 191 u8 do_early_retrans:1,/* Enable RFC5827 early-retransmit */
396 early_retrans_delayed:1, /* Delayed ER timer installed */ 192 early_retrans_delayed:1, /* Delayed ER timer installed */
397 syn_data:1, /* SYN includes data */ 193 syn_data:1, /* SYN includes data */
398 syn_fastopen:1; /* SYN includes Fast Open option */ 194 syn_fastopen:1, /* SYN includes Fast Open option */
195 syn_data_acked:1;/* data in SYN is acked by SYN-ACK */
399 196
400/* RTT measurement */ 197/* RTT measurement */
401 u32 srtt; /* smoothed round trip time << 3 */ 198 u32 srtt; /* smoothed round trip time << 3 */
@@ -595,6 +392,4 @@ static inline int fastopen_init_queue(struct sock *sk, int backlog)
595 return 0; 392 return 0;
596} 393}
597 394
598#endif /* __KERNEL__ */
599
600#endif /* _LINUX_TCP_H */ 395#endif /* _LINUX_TCP_H */
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 4b94a61955df..91b34812cd84 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -44,6 +44,12 @@ enum thermal_trip_type {
44 THERMAL_TRIP_CRITICAL, 44 THERMAL_TRIP_CRITICAL,
45}; 45};
46 46
47enum thermal_trend {
48 THERMAL_TREND_STABLE, /* temperature is stable */
49 THERMAL_TREND_RAISING, /* temperature is raising */
50 THERMAL_TREND_DROPPING, /* temperature is dropping */
51};
52
47struct thermal_zone_device_ops { 53struct thermal_zone_device_ops {
48 int (*bind) (struct thermal_zone_device *, 54 int (*bind) (struct thermal_zone_device *,
49 struct thermal_cooling_device *); 55 struct thermal_cooling_device *);
@@ -65,6 +71,8 @@ struct thermal_zone_device_ops {
65 int (*set_trip_hyst) (struct thermal_zone_device *, int, 71 int (*set_trip_hyst) (struct thermal_zone_device *, int,
66 unsigned long); 72 unsigned long);
67 int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *); 73 int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *);
74 int (*get_trend) (struct thermal_zone_device *, int,
75 enum thermal_trend *);
68 int (*notify) (struct thermal_zone_device *, int, 76 int (*notify) (struct thermal_zone_device *, int,
69 enum thermal_trip_type); 77 enum thermal_trip_type);
70}; 78};
@@ -75,6 +83,8 @@ struct thermal_cooling_device_ops {
75 int (*set_cur_state) (struct thermal_cooling_device *, unsigned long); 83 int (*set_cur_state) (struct thermal_cooling_device *, unsigned long);
76}; 84};
77 85
86#define THERMAL_NO_LIMIT -1UL /* no upper/lower limit requirement */
87
78#define THERMAL_TRIPS_NONE -1 88#define THERMAL_TRIPS_NONE -1
79#define THERMAL_MAX_TRIPS 12 89#define THERMAL_MAX_TRIPS 12
80#define THERMAL_NAME_LENGTH 20 90#define THERMAL_NAME_LENGTH 20
@@ -84,6 +94,9 @@ struct thermal_cooling_device {
84 struct device device; 94 struct device device;
85 void *devdata; 95 void *devdata;
86 const struct thermal_cooling_device_ops *ops; 96 const struct thermal_cooling_device_ops *ops;
97 bool updated; /* true if the cooling device does not need update */
98 struct mutex lock; /* protect thermal_instances list */
99 struct list_head thermal_instances;
87 struct list_head node; 100 struct list_head node;
88}; 101};
89 102
@@ -105,17 +118,16 @@ struct thermal_zone_device {
105 struct thermal_attr *trip_hyst_attrs; 118 struct thermal_attr *trip_hyst_attrs;
106 void *devdata; 119 void *devdata;
107 int trips; 120 int trips;
108 int tc1;
109 int tc2;
110 int passive_delay; 121 int passive_delay;
111 int polling_delay; 122 int polling_delay;
123 int temperature;
112 int last_temperature; 124 int last_temperature;
113 bool passive; 125 int passive;
114 unsigned int forced_passive; 126 unsigned int forced_passive;
115 const struct thermal_zone_device_ops *ops; 127 const struct thermal_zone_device_ops *ops;
116 struct list_head cooling_devices; 128 struct list_head thermal_instances;
117 struct idr idr; 129 struct idr idr;
118 struct mutex lock; /* protect cooling devices list */ 130 struct mutex lock; /* protect thermal_instances list */
119 struct list_head node; 131 struct list_head node;
120 struct delayed_work poll_queue; 132 struct delayed_work poll_queue;
121}; 133};
@@ -152,12 +164,12 @@ enum {
152#define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1) 164#define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1)
153 165
154struct thermal_zone_device *thermal_zone_device_register(const char *, int, int, 166struct thermal_zone_device *thermal_zone_device_register(const char *, int, int,
155 void *, const struct thermal_zone_device_ops *, int tc1, 167 void *, const struct thermal_zone_device_ops *, int, int);
156 int tc2, int passive_freq, int polling_freq);
157void thermal_zone_device_unregister(struct thermal_zone_device *); 168void thermal_zone_device_unregister(struct thermal_zone_device *);
158 169
159int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, 170int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int,
160 struct thermal_cooling_device *); 171 struct thermal_cooling_device *,
172 unsigned long, unsigned long);
161int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, 173int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int,
162 struct thermal_cooling_device *); 174 struct thermal_cooling_device *);
163void thermal_zone_device_update(struct thermal_zone_device *); 175void thermal_zone_device_update(struct thermal_zone_device *);
diff --git a/include/linux/time.h b/include/linux/time.h
index b51e664c83e7..4d358e9d10f1 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -1,33 +1,10 @@
1#ifndef _LINUX_TIME_H 1#ifndef _LINUX_TIME_H
2#define _LINUX_TIME_H 2#define _LINUX_TIME_H
3 3
4#include <linux/types.h>
5
6#ifdef __KERNEL__
7# include <linux/cache.h> 4# include <linux/cache.h>
8# include <linux/seqlock.h> 5# include <linux/seqlock.h>
9# include <linux/math64.h> 6# include <linux/math64.h>
10#endif 7#include <uapi/linux/time.h>
11
12#ifndef _STRUCT_TIMESPEC
13#define _STRUCT_TIMESPEC
14struct timespec {
15 __kernel_time_t tv_sec; /* seconds */
16 long tv_nsec; /* nanoseconds */
17};
18#endif
19
20struct timeval {
21 __kernel_time_t tv_sec; /* seconds */
22 __kernel_suseconds_t tv_usec; /* microseconds */
23};
24
25struct timezone {
26 int tz_minuteswest; /* minutes west of Greenwich */
27 int tz_dsttime; /* type of dst correction */
28};
29
30#ifdef __KERNEL__
31 8
32extern struct timezone sys_tz; 9extern struct timezone sys_tz;
33 10
@@ -280,51 +257,4 @@ static __always_inline void timespec_add_ns(struct timespec *a, u64 ns)
280 a->tv_nsec = ns; 257 a->tv_nsec = ns;
281} 258}
282 259
283#endif /* __KERNEL__ */
284
285/*
286 * Names of the interval timers, and structure
287 * defining a timer setting:
288 */
289#define ITIMER_REAL 0
290#define ITIMER_VIRTUAL 1
291#define ITIMER_PROF 2
292
293struct itimerspec {
294 struct timespec it_interval; /* timer period */
295 struct timespec it_value; /* timer expiration */
296};
297
298struct itimerval {
299 struct timeval it_interval; /* timer interval */
300 struct timeval it_value; /* current value */
301};
302
303/*
304 * The IDs of the various system clocks (for POSIX.1b interval timers):
305 */
306#define CLOCK_REALTIME 0
307#define CLOCK_MONOTONIC 1
308#define CLOCK_PROCESS_CPUTIME_ID 2
309#define CLOCK_THREAD_CPUTIME_ID 3
310#define CLOCK_MONOTONIC_RAW 4
311#define CLOCK_REALTIME_COARSE 5
312#define CLOCK_MONOTONIC_COARSE 6
313#define CLOCK_BOOTTIME 7
314#define CLOCK_REALTIME_ALARM 8
315#define CLOCK_BOOTTIME_ALARM 9
316
317/*
318 * The IDs of various hardware clocks:
319 */
320#define CLOCK_SGI_CYCLE 10
321#define MAX_CLOCKS 16
322#define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC)
323#define CLOCKS_MONO CLOCK_MONOTONIC
324
325/*
326 * The various flags for setting POSIX.1b interval timers:
327 */
328#define TIMER_ABSTIME 0x01
329
330#endif 260#endif
diff --git a/include/linux/timekeeper_internal.h b/include/linux/timekeeper_internal.h
new file mode 100644
index 000000000000..e1d558e237ec
--- /dev/null
+++ b/include/linux/timekeeper_internal.h
@@ -0,0 +1,108 @@
1/*
2 * You SHOULD NOT be including this unless you're vsyscall
3 * handling code or timekeeping internal code!
4 */
5
6#ifndef _LINUX_TIMEKEEPER_INTERNAL_H
7#define _LINUX_TIMEKEEPER_INTERNAL_H
8
9#include <linux/clocksource.h>
10#include <linux/jiffies.h>
11#include <linux/time.h>
12
13/* Structure holding internal timekeeping values. */
14struct timekeeper {
15 /* Current clocksource used for timekeeping. */
16 struct clocksource *clock;
17 /* NTP adjusted clock multiplier */
18 u32 mult;
19 /* The shift value of the current clocksource. */
20 u32 shift;
21 /* Number of clock cycles in one NTP interval. */
22 cycle_t cycle_interval;
23 /* Number of clock shifted nano seconds in one NTP interval. */
24 u64 xtime_interval;
25 /* shifted nano seconds left over when rounding cycle_interval */
26 s64 xtime_remainder;
27 /* Raw nano seconds accumulated per NTP interval. */
28 u32 raw_interval;
29
30 /* Current CLOCK_REALTIME time in seconds */
31 u64 xtime_sec;
32 /* Clock shifted nano seconds */
33 u64 xtime_nsec;
34
35 /* Difference between accumulated time and NTP time in ntp
36 * shifted nano seconds. */
37 s64 ntp_error;
38 /* Shift conversion between clock shifted nano seconds and
39 * ntp shifted nano seconds. */
40 u32 ntp_error_shift;
41
42 /*
43 * wall_to_monotonic is what we need to add to xtime (or xtime corrected
44 * for sub jiffie times) to get to monotonic time. Monotonic is pegged
45 * at zero at system boot time, so wall_to_monotonic will be negative,
46 * however, we will ALWAYS keep the tv_nsec part positive so we can use
47 * the usual normalization.
48 *
49 * wall_to_monotonic is moved after resume from suspend for the
50 * monotonic time not to jump. We need to add total_sleep_time to
51 * wall_to_monotonic to get the real boot based time offset.
52 *
53 * - wall_to_monotonic is no longer the boot time, getboottime must be
54 * used instead.
55 */
56 struct timespec wall_to_monotonic;
57 /* Offset clock monotonic -> clock realtime */
58 ktime_t offs_real;
59 /* time spent in suspend */
60 struct timespec total_sleep_time;
61 /* Offset clock monotonic -> clock boottime */
62 ktime_t offs_boot;
63 /* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. */
64 struct timespec raw_time;
65 /* Seqlock for all timekeeper values */
66 seqlock_t lock;
67};
68
69static inline struct timespec tk_xtime(struct timekeeper *tk)
70{
71 struct timespec ts;
72
73 ts.tv_sec = tk->xtime_sec;
74 ts.tv_nsec = (long)(tk->xtime_nsec >> tk->shift);
75 return ts;
76}
77
78
79#ifdef CONFIG_GENERIC_TIME_VSYSCALL
80
81extern void update_vsyscall(struct timekeeper *tk);
82extern void update_vsyscall_tz(void);
83
84#elif defined(CONFIG_GENERIC_TIME_VSYSCALL_OLD)
85
86extern void update_vsyscall_old(struct timespec *ts, struct timespec *wtm,
87 struct clocksource *c, u32 mult);
88extern void update_vsyscall_tz(void);
89
90static inline void update_vsyscall(struct timekeeper *tk)
91{
92 struct timespec xt;
93
94 xt = tk_xtime(tk);
95 update_vsyscall_old(&xt, &tk->wall_to_monotonic, tk->clock, tk->mult);
96}
97
98#else
99
100static inline void update_vsyscall(struct timekeeper *tk)
101{
102}
103static inline void update_vsyscall_tz(void)
104{
105}
106#endif
107
108#endif /* _LINUX_TIMEKEEPER_INTERNAL_H */
diff --git a/include/linux/timerqueue.h b/include/linux/timerqueue.h
index 5088727478fd..a520fd70a59f 100644
--- a/include/linux/timerqueue.h
+++ b/include/linux/timerqueue.h
@@ -39,7 +39,7 @@ struct timerqueue_node *timerqueue_getnext(struct timerqueue_head *head)
39 39
40static inline void timerqueue_init(struct timerqueue_node *node) 40static inline void timerqueue_init(struct timerqueue_node *node)
41{ 41{
42 rb_init_node(&node->node); 42 RB_CLEAR_NODE(&node->node);
43} 43}
44 44
45static inline void timerqueue_init_head(struct timerqueue_head *head) 45static inline void timerqueue_init_head(struct timerqueue_head *head)
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 7c5ceb20e03a..5ec87c60b97c 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -53,120 +53,11 @@
53#ifndef _LINUX_TIMEX_H 53#ifndef _LINUX_TIMEX_H
54#define _LINUX_TIMEX_H 54#define _LINUX_TIMEX_H
55 55
56#include <linux/time.h> 56#include <uapi/linux/timex.h>
57 57
58#define NTP_API 4 /* NTP API version */
59
60/*
61 * syscall interface - used (mainly by NTP daemon)
62 * to discipline kernel clock oscillator
63 */
64struct timex {
65 unsigned int modes; /* mode selector */
66 long offset; /* time offset (usec) */
67 long freq; /* frequency offset (scaled ppm) */
68 long maxerror; /* maximum error (usec) */
69 long esterror; /* estimated error (usec) */
70 int status; /* clock command/status */
71 long constant; /* pll time constant */
72 long precision; /* clock precision (usec) (read only) */
73 long tolerance; /* clock frequency tolerance (ppm)
74 * (read only)
75 */
76 struct timeval time; /* (read only, except for ADJ_SETOFFSET) */
77 long tick; /* (modified) usecs between clock ticks */
78
79 long ppsfreq; /* pps frequency (scaled ppm) (ro) */
80 long jitter; /* pps jitter (us) (ro) */
81 int shift; /* interval duration (s) (shift) (ro) */
82 long stabil; /* pps stability (scaled ppm) (ro) */
83 long jitcnt; /* jitter limit exceeded (ro) */
84 long calcnt; /* calibration intervals (ro) */
85 long errcnt; /* calibration errors (ro) */
86 long stbcnt; /* stability limit exceeded (ro) */
87
88 int tai; /* TAI offset (ro) */
89
90 int :32; int :32; int :32; int :32;
91 int :32; int :32; int :32; int :32;
92 int :32; int :32; int :32;
93};
94
95/*
96 * Mode codes (timex.mode)
97 */
98#define ADJ_OFFSET 0x0001 /* time offset */
99#define ADJ_FREQUENCY 0x0002 /* frequency offset */
100#define ADJ_MAXERROR 0x0004 /* maximum time error */
101#define ADJ_ESTERROR 0x0008 /* estimated time error */
102#define ADJ_STATUS 0x0010 /* clock status */
103#define ADJ_TIMECONST 0x0020 /* pll time constant */
104#define ADJ_TAI 0x0080 /* set TAI offset */
105#define ADJ_SETOFFSET 0x0100 /* add 'time' to current time */
106#define ADJ_MICRO 0x1000 /* select microsecond resolution */
107#define ADJ_NANO 0x2000 /* select nanosecond resolution */
108#define ADJ_TICK 0x4000 /* tick value */
109
110#ifdef __KERNEL__
111#define ADJ_ADJTIME 0x8000 /* switch between adjtime/adjtimex modes */ 58#define ADJ_ADJTIME 0x8000 /* switch between adjtime/adjtimex modes */
112#define ADJ_OFFSET_SINGLESHOT 0x0001 /* old-fashioned adjtime */ 59#define ADJ_OFFSET_SINGLESHOT 0x0001 /* old-fashioned adjtime */
113#define ADJ_OFFSET_READONLY 0x2000 /* read-only adjtime */ 60#define ADJ_OFFSET_READONLY 0x2000 /* read-only adjtime */
114#else
115#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
116#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */
117#endif
118
119/* NTP userland likes the MOD_ prefix better */
120#define MOD_OFFSET ADJ_OFFSET
121#define MOD_FREQUENCY ADJ_FREQUENCY
122#define MOD_MAXERROR ADJ_MAXERROR
123#define MOD_ESTERROR ADJ_ESTERROR
124#define MOD_STATUS ADJ_STATUS
125#define MOD_TIMECONST ADJ_TIMECONST
126#define MOD_TAI ADJ_TAI
127#define MOD_MICRO ADJ_MICRO
128#define MOD_NANO ADJ_NANO
129
130
131/*
132 * Status codes (timex.status)
133 */
134#define STA_PLL 0x0001 /* enable PLL updates (rw) */
135#define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */
136#define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */
137#define STA_FLL 0x0008 /* select frequency-lock mode (rw) */
138
139#define STA_INS 0x0010 /* insert leap (rw) */
140#define STA_DEL 0x0020 /* delete leap (rw) */
141#define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */
142#define STA_FREQHOLD 0x0080 /* hold frequency (rw) */
143
144#define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */
145#define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */
146#define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */
147#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */
148
149#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */
150#define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */
151#define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */
152#define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */
153
154/* read-only bits */
155#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
156 STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
157
158/*
159 * Clock states (time_state)
160 */
161#define TIME_OK 0 /* clock synchronized, no leap second */
162#define TIME_INS 1 /* insert leap second */
163#define TIME_DEL 2 /* delete leap second */
164#define TIME_OOP 3 /* leap second in progress */
165#define TIME_WAIT 4 /* leap second has occurred */
166#define TIME_ERROR 5 /* clock not synchronized */
167#define TIME_BAD TIME_ERROR /* bw compat */
168
169#ifdef __KERNEL__
170#include <linux/compiler.h> 61#include <linux/compiler.h>
171#include <linux/types.h> 62#include <linux/types.h>
172#include <linux/param.h> 63#include <linux/param.h>
@@ -261,6 +152,4 @@ int read_current_timer(unsigned long *timer_val);
261/* The clock frequency of the i8253/i8254 PIT */ 152/* The clock frequency of the i8253/i8254 PIT */
262#define PIT_TICK_RATE 1193182ul 153#define PIT_TICK_RATE 1193182ul
263 154
264#endif /* KERNEL */
265
266#endif /* LINUX_TIMEX_H */ 155#endif /* LINUX_TIMEX_H */
diff --git a/include/linux/toshiba.h b/include/linux/toshiba.h
index 772dedbc3a22..915c3bb164ac 100644
--- a/include/linux/toshiba.h
+++ b/include/linux/toshiba.h
@@ -16,25 +16,10 @@
16 * General Public License for more details. 16 * General Public License for more details.
17 * 17 *
18 */ 18 */
19
20#ifndef _LINUX_TOSHIBA_H 19#ifndef _LINUX_TOSHIBA_H
21#define _LINUX_TOSHIBA_H 20#define _LINUX_TOSHIBA_H
22 21
23#define TOSH_PROC "/proc/toshiba" 22#include <uapi/linux/toshiba.h>
24#define TOSH_DEVICE "/dev/toshiba"
25#define TOSH_SMM _IOWR('t', 0x90, int) /* broken: meant 24 bytes */
26
27typedef struct {
28 unsigned int eax;
29 unsigned int ebx __attribute__ ((packed));
30 unsigned int ecx __attribute__ ((packed));
31 unsigned int edx __attribute__ ((packed));
32 unsigned int esi __attribute__ ((packed));
33 unsigned int edi __attribute__ ((packed));
34} SMMRegisters;
35 23
36#ifdef __KERNEL__
37int tosh_smm(SMMRegisters *regs); 24int tosh_smm(SMMRegisters *regs);
38#endif /* __KERNEL__ */
39
40#endif 25#endif
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 4f6c59a5fb79..f0b4eb47297c 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -1,41 +1,6 @@
1#ifndef _LINUX_TTY_H 1#ifndef _LINUX_TTY_H
2#define _LINUX_TTY_H 2#define _LINUX_TTY_H
3 3
4/*
5 * 'tty.h' defines some structures used by tty_io.c and some defines.
6 */
7
8#define NR_LDISCS 30
9
10/* line disciplines */
11#define N_TTY 0
12#define N_SLIP 1
13#define N_MOUSE 2
14#define N_PPP 3
15#define N_STRIP 4
16#define N_AX25 5
17#define N_X25 6 /* X.25 async */
18#define N_6PACK 7
19#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
20#define N_R3964 9 /* Reserved for Simatic R3964 module */
21#define N_PROFIBUS_FDL 10 /* Reserved for Profibus */
22#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
23#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data */
24 /* cards about SMS messages */
25#define N_HDLC 13 /* synchronous HDLC */
26#define N_SYNC_PPP 14 /* synchronous PPP */
27#define N_HCI 15 /* Bluetooth HCI UART */
28#define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */
29#define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */
30#define N_PPS 18 /* Pulse per Second */
31#define N_V253 19 /* Codec control over voice modem */
32#define N_CAIF 20 /* CAIF protocol for talking to modems */
33#define N_GSM0710 21 /* GSM 0710 Mux */
34#define N_TI_WL 22 /* for TI's WL BT, FM, GPS combo chips */
35#define N_TRACESINK 23 /* Trace data routing for MIPI P1149.7 */
36#define N_TRACEROUTER 24 /* Trace data routing for MIPI P1149.7 */
37
38#ifdef __KERNEL__
39#include <linux/fs.h> 4#include <linux/fs.h>
40#include <linux/major.h> 5#include <linux/major.h>
41#include <linux/termios.h> 6#include <linux/termios.h>
@@ -44,6 +9,7 @@
44#include <linux/tty_ldisc.h> 9#include <linux/tty_ldisc.h>
45#include <linux/mutex.h> 10#include <linux/mutex.h>
46#include <linux/tty_flags.h> 11#include <linux/tty_flags.h>
12#include <uapi/linux/tty.h>
47 13
48 14
49 15
@@ -694,5 +660,4 @@ do { \
694} while (0) 660} while (0)
695 661
696 662
697#endif /* __KERNEL__ */
698#endif 663#endif
diff --git a/include/linux/types.h b/include/linux/types.h
index bf0dd7524b2a..1cc0e4b9a048 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -1,22 +1,13 @@
1#ifndef _LINUX_TYPES_H 1#ifndef _LINUX_TYPES_H
2#define _LINUX_TYPES_H 2#define _LINUX_TYPES_H
3 3
4#include <asm/types.h> 4#define __EXPORTED_HEADERS__
5#include <uapi/linux/types.h>
5 6
6#ifndef __ASSEMBLY__ 7#ifndef __ASSEMBLY__
7#ifdef __KERNEL__
8 8
9#define DECLARE_BITMAP(name,bits) \ 9#define DECLARE_BITMAP(name,bits) \
10 unsigned long name[BITS_TO_LONGS(bits)] 10 unsigned long name[BITS_TO_LONGS(bits)]
11#else
12#ifndef __EXPORTED_HEADERS__
13#warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders"
14#endif /* __EXPORTED_HEADERS__ */
15#endif
16
17#include <linux/posix_types.h>
18
19#ifdef __KERNEL__
20 11
21typedef __u32 __kernel_dev_t; 12typedef __u32 __kernel_dev_t;
22 13
@@ -157,48 +148,12 @@ typedef u64 dma_addr_t;
157typedef u32 dma_addr_t; 148typedef u32 dma_addr_t;
158#endif /* dma_addr_t */ 149#endif /* dma_addr_t */
159 150
160#endif /* __KERNEL__ */
161
162/*
163 * Below are truly Linux-specific types that should never collide with
164 * any application/library that wants linux/types.h.
165 */
166
167#ifdef __CHECKER__ 151#ifdef __CHECKER__
168#define __bitwise__ __attribute__((bitwise))
169#else 152#else
170#define __bitwise__
171#endif 153#endif
172#ifdef __CHECK_ENDIAN__ 154#ifdef __CHECK_ENDIAN__
173#define __bitwise __bitwise__
174#else 155#else
175#define __bitwise
176#endif 156#endif
177
178typedef __u16 __bitwise __le16;
179typedef __u16 __bitwise __be16;
180typedef __u32 __bitwise __le32;
181typedef __u32 __bitwise __be32;
182typedef __u64 __bitwise __le64;
183typedef __u64 __bitwise __be64;
184
185typedef __u16 __bitwise __sum16;
186typedef __u32 __bitwise __wsum;
187
188/*
189 * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid
190 * common 32/64-bit compat problems.
191 * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other
192 * architectures) and to 8-byte boundaries on 64-bit architectures. The new
193 * aligned_64 type enforces 8-byte alignment so that structs containing
194 * aligned_64 values have the same alignment on 32-bit and 64-bit architectures.
195 * No conversions are necessary between 32-bit user-space and a 64-bit kernel.
196 */
197#define __aligned_u64 __u64 __attribute__((aligned(8)))
198#define __aligned_be64 __be64 __attribute__((aligned(8)))
199#define __aligned_le64 __le64 __attribute__((aligned(8)))
200
201#ifdef __KERNEL__
202typedef unsigned __bitwise__ gfp_t; 157typedef unsigned __bitwise__ gfp_t;
203typedef unsigned __bitwise__ fmode_t; 158typedef unsigned __bitwise__ fmode_t;
204 159
@@ -256,6 +211,5 @@ struct callback_head {
256}; 211};
257#define rcu_head callback_head 212#define rcu_head callback_head
258 213
259#endif /* __KERNEL__ */
260#endif /* __ASSEMBLY__ */ 214#endif /* __ASSEMBLY__ */
261#endif /* _LINUX_TYPES_H */ 215#endif /* _LINUX_TYPES_H */
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 03f72a2ba028..0b67d7793520 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -17,28 +17,10 @@
17#ifndef _LINUX_UDP_H 17#ifndef _LINUX_UDP_H
18#define _LINUX_UDP_H 18#define _LINUX_UDP_H
19 19
20#include <linux/types.h>
21
22struct udphdr {
23 __be16 source;
24 __be16 dest;
25 __be16 len;
26 __sum16 check;
27};
28
29/* UDP socket options */
30#define UDP_CORK 1 /* Never send partially complete segments */
31#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */
32
33/* UDP encapsulation types */
34#define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */
35#define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */
36#define UDP_ENCAP_L2TPINUDP 3 /* rfc2661 */
37
38#ifdef __KERNEL__
39#include <net/inet_sock.h> 20#include <net/inet_sock.h>
40#include <linux/skbuff.h> 21#include <linux/skbuff.h>
41#include <net/netns/hash.h> 22#include <net/netns/hash.h>
23#include <uapi/linux/udp.h>
42 24
43static inline struct udphdr *udp_hdr(const struct sk_buff *skb) 25static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
44{ 26{
@@ -96,6 +78,4 @@ static inline struct udp_sock *udp_sk(const struct sock *sk)
96 78
97#define IS_UDPLITE(__sk) (udp_sk(__sk)->pcflag) 79#define IS_UDPLITE(__sk) (udp_sk(__sk)->pcflag)
98 80
99#endif
100
101#endif /* _LINUX_UDP_H */ 81#endif /* _LINUX_UDP_H */
diff --git a/include/linux/uinput.h b/include/linux/uinput.h
index c454bbe39ee7..0a4487d3fb1e 100644
--- a/include/linux/uinput.h
+++ b/include/linux/uinput.h
@@ -1,5 +1,3 @@
1#ifndef __UINPUT_H_
2#define __UINPUT_H_
3/* 1/*
4 * User level driver support for input subsystem 2 * User level driver support for input subsystem
5 * 3 *
@@ -31,13 +29,11 @@
31 * 0.1 20/06/2002 29 * 0.1 20/06/2002
32 * - first public version 30 * - first public version
33 */ 31 */
32#ifndef __UINPUT_H_
33#define __UINPUT_H_
34 34
35#include <linux/types.h> 35#include <uapi/linux/uinput.h>
36#include <linux/input.h>
37
38#define UINPUT_VERSION 3
39 36
40#ifdef __KERNEL__
41#define UINPUT_NAME "uinput" 37#define UINPUT_NAME "uinput"
42#define UINPUT_BUFFER_SIZE 16 38#define UINPUT_BUFFER_SIZE 16
43#define UINPUT_NUM_REQUESTS 16 39#define UINPUT_NUM_REQUESTS 16
@@ -75,103 +71,4 @@ struct uinput_device {
75 wait_queue_head_t requests_waitq; 71 wait_queue_head_t requests_waitq;
76 spinlock_t requests_lock; 72 spinlock_t requests_lock;
77}; 73};
78#endif /* __KERNEL__ */
79
80struct uinput_ff_upload {
81 __u32 request_id;
82 __s32 retval;
83 struct ff_effect effect;
84 struct ff_effect old;
85};
86
87struct uinput_ff_erase {
88 __u32 request_id;
89 __s32 retval;
90 __u32 effect_id;
91};
92
93/* ioctl */
94#define UINPUT_IOCTL_BASE 'U'
95#define UI_DEV_CREATE _IO(UINPUT_IOCTL_BASE, 1)
96#define UI_DEV_DESTROY _IO(UINPUT_IOCTL_BASE, 2)
97
98#define UI_SET_EVBIT _IOW(UINPUT_IOCTL_BASE, 100, int)
99#define UI_SET_KEYBIT _IOW(UINPUT_IOCTL_BASE, 101, int)
100#define UI_SET_RELBIT _IOW(UINPUT_IOCTL_BASE, 102, int)
101#define UI_SET_ABSBIT _IOW(UINPUT_IOCTL_BASE, 103, int)
102#define UI_SET_MSCBIT _IOW(UINPUT_IOCTL_BASE, 104, int)
103#define UI_SET_LEDBIT _IOW(UINPUT_IOCTL_BASE, 105, int)
104#define UI_SET_SNDBIT _IOW(UINPUT_IOCTL_BASE, 106, int)
105#define UI_SET_FFBIT _IOW(UINPUT_IOCTL_BASE, 107, int)
106#define UI_SET_PHYS _IOW(UINPUT_IOCTL_BASE, 108, char*)
107#define UI_SET_SWBIT _IOW(UINPUT_IOCTL_BASE, 109, int)
108#define UI_SET_PROPBIT _IOW(UINPUT_IOCTL_BASE, 110, int)
109
110#define UI_BEGIN_FF_UPLOAD _IOWR(UINPUT_IOCTL_BASE, 200, struct uinput_ff_upload)
111#define UI_END_FF_UPLOAD _IOW(UINPUT_IOCTL_BASE, 201, struct uinput_ff_upload)
112#define UI_BEGIN_FF_ERASE _IOWR(UINPUT_IOCTL_BASE, 202, struct uinput_ff_erase)
113#define UI_END_FF_ERASE _IOW(UINPUT_IOCTL_BASE, 203, struct uinput_ff_erase)
114
115/*
116 * To write a force-feedback-capable driver, the upload_effect
117 * and erase_effect callbacks in input_dev must be implemented.
118 * The uinput driver will generate a fake input event when one of
119 * these callbacks are invoked. The userspace code then uses
120 * ioctls to retrieve additional parameters and send the return code.
121 * The callback blocks until this return code is sent.
122 *
123 * The described callback mechanism is only used if ff_effects_max
124 * is set.
125 *
126 * To implement upload_effect():
127 * 1. Wait for an event with type == EV_UINPUT and code == UI_FF_UPLOAD.
128 * A request ID will be given in 'value'.
129 * 2. Allocate a uinput_ff_upload struct, fill in request_id with
130 * the 'value' from the EV_UINPUT event.
131 * 3. Issue a UI_BEGIN_FF_UPLOAD ioctl, giving it the
132 * uinput_ff_upload struct. It will be filled in with the
133 * ff_effects passed to upload_effect().
134 * 4. Perform the effect upload, and place a return code back into
135 the uinput_ff_upload struct.
136 * 5. Issue a UI_END_FF_UPLOAD ioctl, also giving it the
137 * uinput_ff_upload_effect struct. This will complete execution
138 * of our upload_effect() handler.
139 *
140 * To implement erase_effect():
141 * 1. Wait for an event with type == EV_UINPUT and code == UI_FF_ERASE.
142 * A request ID will be given in 'value'.
143 * 2. Allocate a uinput_ff_erase struct, fill in request_id with
144 * the 'value' from the EV_UINPUT event.
145 * 3. Issue a UI_BEGIN_FF_ERASE ioctl, giving it the
146 * uinput_ff_erase struct. It will be filled in with the
147 * effect ID passed to erase_effect().
148 * 4. Perform the effect erasure, and place a return code back
149 * into the uinput_ff_erase struct.
150 * 5. Issue a UI_END_FF_ERASE ioctl, also giving it the
151 * uinput_ff_erase_effect struct. This will complete execution
152 * of our erase_effect() handler.
153 */
154
155/*
156 * This is the new event type, used only by uinput.
157 * 'code' is UI_FF_UPLOAD or UI_FF_ERASE, and 'value'
158 * is the unique request ID. This number was picked
159 * arbitrarily, above EV_MAX (since the input system
160 * never sees it) but in the range of a 16-bit int.
161 */
162#define EV_UINPUT 0x0101
163#define UI_FF_UPLOAD 1
164#define UI_FF_ERASE 2
165
166#define UINPUT_MAX_NAME_SIZE 80
167struct uinput_user_dev {
168 char name[UINPUT_MAX_NAME_SIZE];
169 struct input_id id;
170 __u32 ff_effects_max;
171 __s32 absmax[ABS_CNT];
172 __s32 absmin[ABS_CNT];
173 __s32 absfuzz[ABS_CNT];
174 __s32 absflat[ABS_CNT];
175};
176#endif /* __UINPUT_H_ */ 74#endif /* __UINPUT_H_ */
177
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 98c114323a8b..629aaf51f30b 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -1,9 +1,3 @@
1#ifndef __LINUX_UIO_H
2#define __LINUX_UIO_H
3
4#include <linux/compiler.h>
5#include <linux/types.h>
6
7/* 1/*
8 * Berkeley style UIO structures - Alan Cox 1994. 2 * Berkeley style UIO structures - Alan Cox 1994.
9 * 3 *
@@ -12,21 +6,11 @@
12 * as published by the Free Software Foundation; either version 6 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version. 7 * 2 of the License, or (at your option) any later version.
14 */ 8 */
9#ifndef __LINUX_UIO_H
10#define __LINUX_UIO_H
15 11
16struct iovec 12#include <uapi/linux/uio.h>
17{
18 void __user *iov_base; /* BSD uses caddr_t (1003.1g requires void *) */
19 __kernel_size_t iov_len; /* Must be size_t (1003.1g) */
20};
21
22/*
23 * UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1)
24 */
25
26#define UIO_FASTIOV 8
27#define UIO_MAXIOV 1024
28 13
29#ifdef __KERNEL__
30 14
31struct kvec { 15struct kvec {
32 void *iov_base; /* and that should *never* hold a userland pointer */ 16 void *iov_base; /* and that should *never* hold a userland pointer */
@@ -52,5 +36,3 @@ static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
52 36
53unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to); 37unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
54#endif 38#endif
55
56#endif
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index e6f0331e3d45..24594571c5a3 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -35,16 +35,6 @@ struct inode;
35# include <asm/uprobes.h> 35# include <asm/uprobes.h>
36#endif 36#endif
37 37
38/* flags that denote/change uprobes behaviour */
39
40/* Have a copy of original instruction */
41#define UPROBE_COPY_INSN 0x1
42
43/* Dont run handlers when first register/ last unregister in progress*/
44#define UPROBE_RUN_HANDLER 0x2
45/* Can skip singlestep */
46#define UPROBE_SKIP_SSTEP 0x4
47
48struct uprobe_consumer { 38struct uprobe_consumer {
49 int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs); 39 int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs);
50 /* 40 /*
@@ -59,7 +49,6 @@ struct uprobe_consumer {
59#ifdef CONFIG_UPROBES 49#ifdef CONFIG_UPROBES
60enum uprobe_task_state { 50enum uprobe_task_state {
61 UTASK_RUNNING, 51 UTASK_RUNNING,
62 UTASK_BP_HIT,
63 UTASK_SSTEP, 52 UTASK_SSTEP,
64 UTASK_SSTEP_ACK, 53 UTASK_SSTEP_ACK,
65 UTASK_SSTEP_TRAPPED, 54 UTASK_SSTEP_TRAPPED,
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 07915a32fb9d..10278d18709c 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1778,17 +1778,6 @@ static inline int usb_translate_errors(int error_code)
1778extern void usb_register_notify(struct notifier_block *nb); 1778extern void usb_register_notify(struct notifier_block *nb);
1779extern void usb_unregister_notify(struct notifier_block *nb); 1779extern void usb_unregister_notify(struct notifier_block *nb);
1780 1780
1781#ifdef DEBUG
1782#define dbg(format, arg...) \
1783 printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg)
1784#else
1785#define dbg(format, arg...) \
1786do { \
1787 if (0) \
1788 printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \
1789} while (0)
1790#endif
1791
1792/* debugfs stuff */ 1781/* debugfs stuff */
1793extern struct dentry *usb_debug_root; 1782extern struct dentry *usb_debug_root;
1794 1783
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild
index b607f3532e88..e69de29bb2d1 100644
--- a/include/linux/usb/Kbuild
+++ b/include/linux/usb/Kbuild
@@ -1,10 +0,0 @@
1header-y += audio.h
2header-y += cdc.h
3header-y += ch9.h
4header-y += ch11.h
5header-y += functionfs.h
6header-y += gadgetfs.h
7header-y += midi.h
8header-y += g_printer.h
9header-y += tmc.h
10header-y += video.h
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
index a54b8255d75f..3d84619110a4 100644
--- a/include/linux/usb/audio.h
+++ b/include/linux/usb/audio.h
@@ -17,531 +17,11 @@
17 * Types and defines in this file are either specific to version 1.0 of 17 * Types and defines in this file are either specific to version 1.0 of
18 * this standard or common for newer versions. 18 * this standard or common for newer versions.
19 */ 19 */
20
21#ifndef __LINUX_USB_AUDIO_H 20#ifndef __LINUX_USB_AUDIO_H
22#define __LINUX_USB_AUDIO_H 21#define __LINUX_USB_AUDIO_H
23 22
24#include <linux/types.h> 23#include <uapi/linux/usb/audio.h>
25
26/* bInterfaceProtocol values to denote the version of the standard used */
27#define UAC_VERSION_1 0x00
28#define UAC_VERSION_2 0x20
29
30/* A.2 Audio Interface Subclass Codes */
31#define USB_SUBCLASS_AUDIOCONTROL 0x01
32#define USB_SUBCLASS_AUDIOSTREAMING 0x02
33#define USB_SUBCLASS_MIDISTREAMING 0x03
34
35/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */
36#define UAC_HEADER 0x01
37#define UAC_INPUT_TERMINAL 0x02
38#define UAC_OUTPUT_TERMINAL 0x03
39#define UAC_MIXER_UNIT 0x04
40#define UAC_SELECTOR_UNIT 0x05
41#define UAC_FEATURE_UNIT 0x06
42#define UAC1_PROCESSING_UNIT 0x07
43#define UAC1_EXTENSION_UNIT 0x08
44
45/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */
46#define UAC_AS_GENERAL 0x01
47#define UAC_FORMAT_TYPE 0x02
48#define UAC_FORMAT_SPECIFIC 0x03
49
50/* A.7 Processing Unit Process Types */
51#define UAC_PROCESS_UNDEFINED 0x00
52#define UAC_PROCESS_UP_DOWNMIX 0x01
53#define UAC_PROCESS_DOLBY_PROLOGIC 0x02
54#define UAC_PROCESS_STEREO_EXTENDER 0x03
55#define UAC_PROCESS_REVERB 0x04
56#define UAC_PROCESS_CHORUS 0x05
57#define UAC_PROCESS_DYN_RANGE_COMP 0x06
58
59/* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */
60#define UAC_EP_GENERAL 0x01
61
62/* A.9 Audio Class-Specific Request Codes */
63#define UAC_SET_ 0x00
64#define UAC_GET_ 0x80
65
66#define UAC__CUR 0x1
67#define UAC__MIN 0x2
68#define UAC__MAX 0x3
69#define UAC__RES 0x4
70#define UAC__MEM 0x5
71
72#define UAC_SET_CUR (UAC_SET_ | UAC__CUR)
73#define UAC_GET_CUR (UAC_GET_ | UAC__CUR)
74#define UAC_SET_MIN (UAC_SET_ | UAC__MIN)
75#define UAC_GET_MIN (UAC_GET_ | UAC__MIN)
76#define UAC_SET_MAX (UAC_SET_ | UAC__MAX)
77#define UAC_GET_MAX (UAC_GET_ | UAC__MAX)
78#define UAC_SET_RES (UAC_SET_ | UAC__RES)
79#define UAC_GET_RES (UAC_GET_ | UAC__RES)
80#define UAC_SET_MEM (UAC_SET_ | UAC__MEM)
81#define UAC_GET_MEM (UAC_GET_ | UAC__MEM)
82
83#define UAC_GET_STAT 0xff
84
85/* A.10 Control Selector Codes */
86
87/* A.10.1 Terminal Control Selectors */
88#define UAC_TERM_COPY_PROTECT 0x01
89
90/* A.10.2 Feature Unit Control Selectors */
91#define UAC_FU_MUTE 0x01
92#define UAC_FU_VOLUME 0x02
93#define UAC_FU_BASS 0x03
94#define UAC_FU_MID 0x04
95#define UAC_FU_TREBLE 0x05
96#define UAC_FU_GRAPHIC_EQUALIZER 0x06
97#define UAC_FU_AUTOMATIC_GAIN 0x07
98#define UAC_FU_DELAY 0x08
99#define UAC_FU_BASS_BOOST 0x09
100#define UAC_FU_LOUDNESS 0x0a
101
102#define UAC_CONTROL_BIT(CS) (1 << ((CS) - 1))
103
104/* A.10.3.1 Up/Down-mix Processing Unit Controls Selectors */
105#define UAC_UD_ENABLE 0x01
106#define UAC_UD_MODE_SELECT 0x02
107
108/* A.10.3.2 Dolby Prologic (tm) Processing Unit Controls Selectors */
109#define UAC_DP_ENABLE 0x01
110#define UAC_DP_MODE_SELECT 0x02
111
112/* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */
113#define UAC_3D_ENABLE 0x01
114#define UAC_3D_SPACE 0x02
115
116/* A.10.3.4 Reverberation Processing Unit Control Selectors */
117#define UAC_REVERB_ENABLE 0x01
118#define UAC_REVERB_LEVEL 0x02
119#define UAC_REVERB_TIME 0x03
120#define UAC_REVERB_FEEDBACK 0x04
121
122/* A.10.3.5 Chorus Processing Unit Control Selectors */
123#define UAC_CHORUS_ENABLE 0x01
124#define UAC_CHORUS_LEVEL 0x02
125#define UAC_CHORUS_RATE 0x03
126#define UAC_CHORUS_DEPTH 0x04
127
128/* A.10.3.6 Dynamic Range Compressor Unit Control Selectors */
129#define UAC_DCR_ENABLE 0x01
130#define UAC_DCR_RATE 0x02
131#define UAC_DCR_MAXAMPL 0x03
132#define UAC_DCR_THRESHOLD 0x04
133#define UAC_DCR_ATTACK_TIME 0x05
134#define UAC_DCR_RELEASE_TIME 0x06
135
136/* A.10.4 Extension Unit Control Selectors */
137#define UAC_XU_ENABLE 0x01
138
139/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */
140#define UAC_MS_HEADER 0x01
141#define UAC_MIDI_IN_JACK 0x02
142#define UAC_MIDI_OUT_JACK 0x03
143
144/* MIDI - A.1 MS Class-Specific Endpoint Descriptor Subtypes */
145#define UAC_MS_GENERAL 0x01
146
147/* Terminals - 2.1 USB Terminal Types */
148#define UAC_TERMINAL_UNDEFINED 0x100
149#define UAC_TERMINAL_STREAMING 0x101
150#define UAC_TERMINAL_VENDOR_SPEC 0x1FF
151
152/* Terminal Control Selectors */
153/* 4.3.2 Class-Specific AC Interface Descriptor */
154struct uac1_ac_header_descriptor {
155 __u8 bLength; /* 8 + n */
156 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
157 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */
158 __le16 bcdADC; /* 0x0100 */
159 __le16 wTotalLength; /* includes Unit and Terminal desc. */
160 __u8 bInCollection; /* n */
161 __u8 baInterfaceNr[]; /* [n] */
162} __attribute__ ((packed));
163
164#define UAC_DT_AC_HEADER_SIZE(n) (8 + (n))
165
166/* As above, but more useful for defining your own descriptors: */
167#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \
168struct uac1_ac_header_descriptor_##n { \
169 __u8 bLength; \
170 __u8 bDescriptorType; \
171 __u8 bDescriptorSubtype; \
172 __le16 bcdADC; \
173 __le16 wTotalLength; \
174 __u8 bInCollection; \
175 __u8 baInterfaceNr[n]; \
176} __attribute__ ((packed))
177
178/* 4.3.2.1 Input Terminal Descriptor */
179struct uac_input_terminal_descriptor {
180 __u8 bLength; /* in bytes: 12 */
181 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
182 __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */
183 __u8 bTerminalID; /* Constant uniquely terminal ID */
184 __le16 wTerminalType; /* USB Audio Terminal Types */
185 __u8 bAssocTerminal; /* ID of the Output Terminal associated */
186 __u8 bNrChannels; /* Number of logical output channels */
187 __le16 wChannelConfig;
188 __u8 iChannelNames;
189 __u8 iTerminal;
190} __attribute__ ((packed));
191
192#define UAC_DT_INPUT_TERMINAL_SIZE 12
193
194/* Terminals - 2.2 Input Terminal Types */
195#define UAC_INPUT_TERMINAL_UNDEFINED 0x200
196#define UAC_INPUT_TERMINAL_MICROPHONE 0x201
197#define UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202
198#define UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203
199#define UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204
200#define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205
201#define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206
202
203/* Terminals - control selectors */
204
205#define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01
206
207/* 4.3.2.2 Output Terminal Descriptor */
208struct uac1_output_terminal_descriptor {
209 __u8 bLength; /* in bytes: 9 */
210 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
211 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */
212 __u8 bTerminalID; /* Constant uniquely terminal ID */
213 __le16 wTerminalType; /* USB Audio Terminal Types */
214 __u8 bAssocTerminal; /* ID of the Input Terminal associated */
215 __u8 bSourceID; /* ID of the connected Unit or Terminal*/
216 __u8 iTerminal;
217} __attribute__ ((packed));
218
219#define UAC_DT_OUTPUT_TERMINAL_SIZE 9
220
221/* Terminals - 2.3 Output Terminal Types */
222#define UAC_OUTPUT_TERMINAL_UNDEFINED 0x300
223#define UAC_OUTPUT_TERMINAL_SPEAKER 0x301
224#define UAC_OUTPUT_TERMINAL_HEADPHONES 0x302
225#define UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303
226#define UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304
227#define UAC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305
228#define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306
229#define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307
230
231/* Set bControlSize = 2 as default setting */
232#define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2)
233
234/* As above, but more useful for defining your own descriptors: */
235#define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \
236struct uac_feature_unit_descriptor_##ch { \
237 __u8 bLength; \
238 __u8 bDescriptorType; \
239 __u8 bDescriptorSubtype; \
240 __u8 bUnitID; \
241 __u8 bSourceID; \
242 __u8 bControlSize; \
243 __le16 bmaControls[ch + 1]; \
244 __u8 iFeature; \
245} __attribute__ ((packed))
246
247/* 4.3.2.3 Mixer Unit Descriptor */
248struct uac_mixer_unit_descriptor {
249 __u8 bLength;
250 __u8 bDescriptorType;
251 __u8 bDescriptorSubtype;
252 __u8 bUnitID;
253 __u8 bNrInPins;
254 __u8 baSourceID[];
255} __attribute__ ((packed));
256 24
257static inline __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *desc)
258{
259 return desc->baSourceID[desc->bNrInPins];
260}
261
262static inline __u32 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc,
263 int protocol)
264{
265 if (protocol == UAC_VERSION_1)
266 return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
267 desc->baSourceID[desc->bNrInPins + 1];
268 else
269 return (desc->baSourceID[desc->bNrInPins + 4] << 24) |
270 (desc->baSourceID[desc->bNrInPins + 3] << 16) |
271 (desc->baSourceID[desc->bNrInPins + 2] << 8) |
272 (desc->baSourceID[desc->bNrInPins + 1]);
273}
274
275static inline __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc,
276 int protocol)
277{
278 return (protocol == UAC_VERSION_1) ?
279 desc->baSourceID[desc->bNrInPins + 3] :
280 desc->baSourceID[desc->bNrInPins + 5];
281}
282
283static inline __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc,
284 int protocol)
285{
286 return (protocol == UAC_VERSION_1) ?
287 &desc->baSourceID[desc->bNrInPins + 4] :
288 &desc->baSourceID[desc->bNrInPins + 6];
289}
290
291static inline __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc)
292{
293 __u8 *raw = (__u8 *) desc;
294 return raw[desc->bLength - 1];
295}
296
297/* 4.3.2.4 Selector Unit Descriptor */
298struct uac_selector_unit_descriptor {
299 __u8 bLength;
300 __u8 bDescriptorType;
301 __u8 bDescriptorSubtype;
302 __u8 bUintID;
303 __u8 bNrInPins;
304 __u8 baSourceID[];
305} __attribute__ ((packed));
306
307static inline __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc)
308{
309 __u8 *raw = (__u8 *) desc;
310 return raw[desc->bLength - 1];
311}
312
313/* 4.3.2.5 Feature Unit Descriptor */
314struct uac_feature_unit_descriptor {
315 __u8 bLength;
316 __u8 bDescriptorType;
317 __u8 bDescriptorSubtype;
318 __u8 bUnitID;
319 __u8 bSourceID;
320 __u8 bControlSize;
321 __u8 bmaControls[0]; /* variable length */
322} __attribute__((packed));
323
324static inline __u8 uac_feature_unit_iFeature(struct uac_feature_unit_descriptor *desc)
325{
326 __u8 *raw = (__u8 *) desc;
327 return raw[desc->bLength - 1];
328}
329
330/* 4.3.2.6 Processing Unit Descriptors */
331struct uac_processing_unit_descriptor {
332 __u8 bLength;
333 __u8 bDescriptorType;
334 __u8 bDescriptorSubtype;
335 __u8 bUnitID;
336 __u16 wProcessType;
337 __u8 bNrInPins;
338 __u8 baSourceID[];
339} __attribute__ ((packed));
340
341static inline __u8 uac_processing_unit_bNrChannels(struct uac_processing_unit_descriptor *desc)
342{
343 return desc->baSourceID[desc->bNrInPins];
344}
345
346static inline __u32 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc,
347 int protocol)
348{
349 if (protocol == UAC_VERSION_1)
350 return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
351 desc->baSourceID[desc->bNrInPins + 1];
352 else
353 return (desc->baSourceID[desc->bNrInPins + 4] << 24) |
354 (desc->baSourceID[desc->bNrInPins + 3] << 16) |
355 (desc->baSourceID[desc->bNrInPins + 2] << 8) |
356 (desc->baSourceID[desc->bNrInPins + 1]);
357}
358
359static inline __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc,
360 int protocol)
361{
362 return (protocol == UAC_VERSION_1) ?
363 desc->baSourceID[desc->bNrInPins + 3] :
364 desc->baSourceID[desc->bNrInPins + 5];
365}
366
367static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc,
368 int protocol)
369{
370 return (protocol == UAC_VERSION_1) ?
371 desc->baSourceID[desc->bNrInPins + 4] :
372 desc->baSourceID[desc->bNrInPins + 6];
373}
374
375static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc,
376 int protocol)
377{
378 return (protocol == UAC_VERSION_1) ?
379 &desc->baSourceID[desc->bNrInPins + 5] :
380 &desc->baSourceID[desc->bNrInPins + 7];
381}
382
383static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc,
384 int protocol)
385{
386 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
387 return desc->baSourceID[desc->bNrInPins + control_size];
388}
389
390static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc,
391 int protocol)
392{
393 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
394 return &desc->baSourceID[desc->bNrInPins + control_size + 1];
395}
396
397/* 4.5.2 Class-Specific AS Interface Descriptor */
398struct uac1_as_header_descriptor {
399 __u8 bLength; /* in bytes: 7 */
400 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
401 __u8 bDescriptorSubtype; /* AS_GENERAL */
402 __u8 bTerminalLink; /* Terminal ID of connected Terminal */
403 __u8 bDelay; /* Delay introduced by the data path */
404 __le16 wFormatTag; /* The Audio Data Format */
405} __attribute__ ((packed));
406
407#define UAC_DT_AS_HEADER_SIZE 7
408
409/* Formats - A.1.1 Audio Data Format Type I Codes */
410#define UAC_FORMAT_TYPE_I_UNDEFINED 0x0
411#define UAC_FORMAT_TYPE_I_PCM 0x1
412#define UAC_FORMAT_TYPE_I_PCM8 0x2
413#define UAC_FORMAT_TYPE_I_IEEE_FLOAT 0x3
414#define UAC_FORMAT_TYPE_I_ALAW 0x4
415#define UAC_FORMAT_TYPE_I_MULAW 0x5
416
417struct uac_format_type_i_continuous_descriptor {
418 __u8 bLength; /* in bytes: 8 + (ns * 3) */
419 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
420 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
421 __u8 bFormatType; /* FORMAT_TYPE_1 */
422 __u8 bNrChannels; /* physical channels in the stream */
423 __u8 bSubframeSize; /* */
424 __u8 bBitResolution;
425 __u8 bSamFreqType;
426 __u8 tLowerSamFreq[3];
427 __u8 tUpperSamFreq[3];
428} __attribute__ ((packed));
429
430#define UAC_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14
431
432struct uac_format_type_i_discrete_descriptor {
433 __u8 bLength; /* in bytes: 8 + (ns * 3) */
434 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
435 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
436 __u8 bFormatType; /* FORMAT_TYPE_1 */
437 __u8 bNrChannels; /* physical channels in the stream */
438 __u8 bSubframeSize; /* */
439 __u8 bBitResolution;
440 __u8 bSamFreqType;
441 __u8 tSamFreq[][3];
442} __attribute__ ((packed));
443
444#define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \
445struct uac_format_type_i_discrete_descriptor_##n { \
446 __u8 bLength; \
447 __u8 bDescriptorType; \
448 __u8 bDescriptorSubtype; \
449 __u8 bFormatType; \
450 __u8 bNrChannels; \
451 __u8 bSubframeSize; \
452 __u8 bBitResolution; \
453 __u8 bSamFreqType; \
454 __u8 tSamFreq[n][3]; \
455} __attribute__ ((packed))
456
457#define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3))
458
459struct uac_format_type_i_ext_descriptor {
460 __u8 bLength;
461 __u8 bDescriptorType;
462 __u8 bDescriptorSubtype;
463 __u8 bFormatType;
464 __u8 bSubslotSize;
465 __u8 bBitResolution;
466 __u8 bHeaderLength;
467 __u8 bControlSize;
468 __u8 bSideBandProtocol;
469} __attribute__((packed));
470
471/* Formats - Audio Data Format Type I Codes */
472
473#define UAC_FORMAT_TYPE_II_MPEG 0x1001
474#define UAC_FORMAT_TYPE_II_AC3 0x1002
475
476struct uac_format_type_ii_discrete_descriptor {
477 __u8 bLength;
478 __u8 bDescriptorType;
479 __u8 bDescriptorSubtype;
480 __u8 bFormatType;
481 __le16 wMaxBitRate;
482 __le16 wSamplesPerFrame;
483 __u8 bSamFreqType;
484 __u8 tSamFreq[][3];
485} __attribute__((packed));
486
487struct uac_format_type_ii_ext_descriptor {
488 __u8 bLength;
489 __u8 bDescriptorType;
490 __u8 bDescriptorSubtype;
491 __u8 bFormatType;
492 __u16 wMaxBitRate;
493 __u16 wSamplesPerFrame;
494 __u8 bHeaderLength;
495 __u8 bSideBandProtocol;
496} __attribute__((packed));
497
498/* type III */
499#define UAC_FORMAT_TYPE_III_IEC1937_AC3 0x2001
500#define UAC_FORMAT_TYPE_III_IEC1937_MPEG1_LAYER1 0x2002
501#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_NOEXT 0x2003
502#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_EXT 0x2004
503#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER1_LS 0x2005
504#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER23_LS 0x2006
505
506/* Formats - A.2 Format Type Codes */
507#define UAC_FORMAT_TYPE_UNDEFINED 0x0
508#define UAC_FORMAT_TYPE_I 0x1
509#define UAC_FORMAT_TYPE_II 0x2
510#define UAC_FORMAT_TYPE_III 0x3
511#define UAC_EXT_FORMAT_TYPE_I 0x81
512#define UAC_EXT_FORMAT_TYPE_II 0x82
513#define UAC_EXT_FORMAT_TYPE_III 0x83
514
515struct uac_iso_endpoint_descriptor {
516 __u8 bLength; /* in bytes: 7 */
517 __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */
518 __u8 bDescriptorSubtype; /* EP_GENERAL */
519 __u8 bmAttributes;
520 __u8 bLockDelayUnits;
521 __le16 wLockDelay;
522} __attribute__((packed));
523#define UAC_ISO_ENDPOINT_DESC_SIZE 7
524
525#define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01
526#define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02
527#define UAC_EP_CS_ATTR_FILL_MAX 0x80
528
529/* status word format (3.7.1.1) */
530
531#define UAC1_STATUS_TYPE_ORIG_MASK 0x0f
532#define UAC1_STATUS_TYPE_ORIG_AUDIO_CONTROL_IF 0x0
533#define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_IF 0x1
534#define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_EP 0x2
535
536#define UAC1_STATUS_TYPE_IRQ_PENDING (1 << 7)
537#define UAC1_STATUS_TYPE_MEM_CHANGED (1 << 6)
538
539struct uac1_status_word {
540 __u8 bStatusType;
541 __u8 bOriginator;
542} __attribute__((packed));
543
544#ifdef __KERNEL__
545 25
546struct usb_audio_control { 26struct usb_audio_control {
547 struct list_head list; 27 struct list_head list;
@@ -561,6 +41,4 @@ struct usb_audio_control_selector {
561 struct usb_descriptor_header *desc; 41 struct usb_descriptor_header *desc;
562}; 42};
563 43
564#endif /* __KERNEL__ */
565
566#endif /* __LINUX_USB_AUDIO_H */ 44#endif /* __LINUX_USB_AUDIO_H */
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index d1d732c2838d..9c210f2283df 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -29,887 +29,11 @@
29 * someone that the two other points are non-issues for that 29 * someone that the two other points are non-issues for that
30 * particular descriptor type. 30 * particular descriptor type.
31 */ 31 */
32
33#ifndef __LINUX_USB_CH9_H 32#ifndef __LINUX_USB_CH9_H
34#define __LINUX_USB_CH9_H 33#define __LINUX_USB_CH9_H
35 34
36#include <linux/types.h> /* __u8 etc */ 35#include <uapi/linux/usb/ch9.h>
37#include <asm/byteorder.h> /* le16_to_cpu */
38
39/*-------------------------------------------------------------------------*/
40
41/* CONTROL REQUEST SUPPORT */
42
43/*
44 * USB directions
45 *
46 * This bit flag is used in endpoint descriptors' bEndpointAddress field.
47 * It's also one of three fields in control requests bRequestType.
48 */
49#define USB_DIR_OUT 0 /* to device */
50#define USB_DIR_IN 0x80 /* to host */
51
52/*
53 * USB types, the second of three bRequestType fields
54 */
55#define USB_TYPE_MASK (0x03 << 5)
56#define USB_TYPE_STANDARD (0x00 << 5)
57#define USB_TYPE_CLASS (0x01 << 5)
58#define USB_TYPE_VENDOR (0x02 << 5)
59#define USB_TYPE_RESERVED (0x03 << 5)
60
61/*
62 * USB recipients, the third of three bRequestType fields
63 */
64#define USB_RECIP_MASK 0x1f
65#define USB_RECIP_DEVICE 0x00
66#define USB_RECIP_INTERFACE 0x01
67#define USB_RECIP_ENDPOINT 0x02
68#define USB_RECIP_OTHER 0x03
69/* From Wireless USB 1.0 */
70#define USB_RECIP_PORT 0x04
71#define USB_RECIP_RPIPE 0x05
72
73/*
74 * Standard requests, for the bRequest field of a SETUP packet.
75 *
76 * These are qualified by the bRequestType field, so that for example
77 * TYPE_CLASS or TYPE_VENDOR specific feature flags could be retrieved
78 * by a GET_STATUS request.
79 */
80#define USB_REQ_GET_STATUS 0x00
81#define USB_REQ_CLEAR_FEATURE 0x01
82#define USB_REQ_SET_FEATURE 0x03
83#define USB_REQ_SET_ADDRESS 0x05
84#define USB_REQ_GET_DESCRIPTOR 0x06
85#define USB_REQ_SET_DESCRIPTOR 0x07
86#define USB_REQ_GET_CONFIGURATION 0x08
87#define USB_REQ_SET_CONFIGURATION 0x09
88#define USB_REQ_GET_INTERFACE 0x0A
89#define USB_REQ_SET_INTERFACE 0x0B
90#define USB_REQ_SYNCH_FRAME 0x0C
91#define USB_REQ_SET_SEL 0x30
92#define USB_REQ_SET_ISOCH_DELAY 0x31
93
94#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
95#define USB_REQ_GET_ENCRYPTION 0x0E
96#define USB_REQ_RPIPE_ABORT 0x0E
97#define USB_REQ_SET_HANDSHAKE 0x0F
98#define USB_REQ_RPIPE_RESET 0x0F
99#define USB_REQ_GET_HANDSHAKE 0x10
100#define USB_REQ_SET_CONNECTION 0x11
101#define USB_REQ_SET_SECURITY_DATA 0x12
102#define USB_REQ_GET_SECURITY_DATA 0x13
103#define USB_REQ_SET_WUSB_DATA 0x14
104#define USB_REQ_LOOPBACK_DATA_WRITE 0x15
105#define USB_REQ_LOOPBACK_DATA_READ 0x16
106#define USB_REQ_SET_INTERFACE_DS 0x17
107
108/* The Link Power Management (LPM) ECN defines USB_REQ_TEST_AND_SET command,
109 * used by hubs to put ports into a new L1 suspend state, except that it
110 * forgot to define its number ...
111 */
112
113/*
114 * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and
115 * are read as a bit array returned by USB_REQ_GET_STATUS. (So there
116 * are at most sixteen features of each type.) Hubs may also support a
117 * new USB_REQ_TEST_AND_SET_FEATURE to put ports into L1 suspend.
118 */
119#define USB_DEVICE_SELF_POWERED 0 /* (read only) */
120#define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */
121#define USB_DEVICE_TEST_MODE 2 /* (wired high speed only) */
122#define USB_DEVICE_BATTERY 2 /* (wireless) */
123#define USB_DEVICE_B_HNP_ENABLE 3 /* (otg) dev may initiate HNP */
124#define USB_DEVICE_WUSB_DEVICE 3 /* (wireless)*/
125#define USB_DEVICE_A_HNP_SUPPORT 4 /* (otg) RH port supports HNP */
126#define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* (otg) other RH port does */
127#define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */
128
129/*
130 * Test Mode Selectors
131 * See USB 2.0 spec Table 9-7
132 */
133#define TEST_J 1
134#define TEST_K 2
135#define TEST_SE0_NAK 3
136#define TEST_PACKET 4
137#define TEST_FORCE_EN 5
138
139/*
140 * New Feature Selectors as added by USB 3.0
141 * See USB 3.0 spec Table 9-6
142 */
143#define USB_DEVICE_U1_ENABLE 48 /* dev may initiate U1 transition */
144#define USB_DEVICE_U2_ENABLE 49 /* dev may initiate U2 transition */
145#define USB_DEVICE_LTM_ENABLE 50 /* dev may send LTM */
146#define USB_INTRF_FUNC_SUSPEND 0 /* function suspend */
147
148#define USB_INTR_FUNC_SUSPEND_OPT_MASK 0xFF00
149/*
150 * Suspend Options, Table 9-7 USB 3.0 spec
151 */
152#define USB_INTRF_FUNC_SUSPEND_LP (1 << (8 + 0))
153#define USB_INTRF_FUNC_SUSPEND_RW (1 << (8 + 1))
154
155#define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */
156
157/* Bit array elements as returned by the USB_REQ_GET_STATUS request. */
158#define USB_DEV_STAT_U1_ENABLED 2 /* transition into U1 state */
159#define USB_DEV_STAT_U2_ENABLED 3 /* transition into U2 state */
160#define USB_DEV_STAT_LTM_ENABLED 4 /* Latency tolerance messages */
161
162/**
163 * struct usb_ctrlrequest - SETUP data for a USB device control request
164 * @bRequestType: matches the USB bmRequestType field
165 * @bRequest: matches the USB bRequest field
166 * @wValue: matches the USB wValue field (le16 byte order)
167 * @wIndex: matches the USB wIndex field (le16 byte order)
168 * @wLength: matches the USB wLength field (le16 byte order)
169 *
170 * This structure is used to send control requests to a USB device. It matches
171 * the different fields of the USB 2.0 Spec section 9.3, table 9-2. See the
172 * USB spec for a fuller description of the different fields, and what they are
173 * used for.
174 *
175 * Note that the driver for any interface can issue control requests.
176 * For most devices, interfaces don't coordinate with each other, so
177 * such requests may be made at any time.
178 */
179struct usb_ctrlrequest {
180 __u8 bRequestType;
181 __u8 bRequest;
182 __le16 wValue;
183 __le16 wIndex;
184 __le16 wLength;
185} __attribute__ ((packed));
186
187/*-------------------------------------------------------------------------*/
188
189/*
190 * STANDARD DESCRIPTORS ... as returned by GET_DESCRIPTOR, or
191 * (rarely) accepted by SET_DESCRIPTOR.
192 *
193 * Note that all multi-byte values here are encoded in little endian
194 * byte order "on the wire". Within the kernel and when exposed
195 * through the Linux-USB APIs, they are not converted to cpu byte
196 * order; it is the responsibility of the client code to do this.
197 * The single exception is when device and configuration descriptors (but
198 * not other descriptors) are read from usbfs (i.e. /proc/bus/usb/BBB/DDD);
199 * in this case the fields are converted to host endianness by the kernel.
200 */
201
202/*
203 * Descriptor types ... USB 2.0 spec table 9.5
204 */
205#define USB_DT_DEVICE 0x01
206#define USB_DT_CONFIG 0x02
207#define USB_DT_STRING 0x03
208#define USB_DT_INTERFACE 0x04
209#define USB_DT_ENDPOINT 0x05
210#define USB_DT_DEVICE_QUALIFIER 0x06
211#define USB_DT_OTHER_SPEED_CONFIG 0x07
212#define USB_DT_INTERFACE_POWER 0x08
213/* these are from a minor usb 2.0 revision (ECN) */
214#define USB_DT_OTG 0x09
215#define USB_DT_DEBUG 0x0a
216#define USB_DT_INTERFACE_ASSOCIATION 0x0b
217/* these are from the Wireless USB spec */
218#define USB_DT_SECURITY 0x0c
219#define USB_DT_KEY 0x0d
220#define USB_DT_ENCRYPTION_TYPE 0x0e
221#define USB_DT_BOS 0x0f
222#define USB_DT_DEVICE_CAPABILITY 0x10
223#define USB_DT_WIRELESS_ENDPOINT_COMP 0x11
224#define USB_DT_WIRE_ADAPTER 0x21
225#define USB_DT_RPIPE 0x22
226#define USB_DT_CS_RADIO_CONTROL 0x23
227/* From the T10 UAS specification */
228#define USB_DT_PIPE_USAGE 0x24
229/* From the USB 3.0 spec */
230#define USB_DT_SS_ENDPOINT_COMP 0x30
231
232/* Conventional codes for class-specific descriptors. The convention is
233 * defined in the USB "Common Class" Spec (3.11). Individual class specs
234 * are authoritative for their usage, not the "common class" writeup.
235 */
236#define USB_DT_CS_DEVICE (USB_TYPE_CLASS | USB_DT_DEVICE)
237#define USB_DT_CS_CONFIG (USB_TYPE_CLASS | USB_DT_CONFIG)
238#define USB_DT_CS_STRING (USB_TYPE_CLASS | USB_DT_STRING)
239#define USB_DT_CS_INTERFACE (USB_TYPE_CLASS | USB_DT_INTERFACE)
240#define USB_DT_CS_ENDPOINT (USB_TYPE_CLASS | USB_DT_ENDPOINT)
241
242/* All standard descriptors have these 2 fields at the beginning */
243struct usb_descriptor_header {
244 __u8 bLength;
245 __u8 bDescriptorType;
246} __attribute__ ((packed));
247
248
249/*-------------------------------------------------------------------------*/
250
251/* USB_DT_DEVICE: Device descriptor */
252struct usb_device_descriptor {
253 __u8 bLength;
254 __u8 bDescriptorType;
255
256 __le16 bcdUSB;
257 __u8 bDeviceClass;
258 __u8 bDeviceSubClass;
259 __u8 bDeviceProtocol;
260 __u8 bMaxPacketSize0;
261 __le16 idVendor;
262 __le16 idProduct;
263 __le16 bcdDevice;
264 __u8 iManufacturer;
265 __u8 iProduct;
266 __u8 iSerialNumber;
267 __u8 bNumConfigurations;
268} __attribute__ ((packed));
269
270#define USB_DT_DEVICE_SIZE 18
271
272
273/*
274 * Device and/or Interface Class codes
275 * as found in bDeviceClass or bInterfaceClass
276 * and defined by www.usb.org documents
277 */
278#define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */
279#define USB_CLASS_AUDIO 1
280#define USB_CLASS_COMM 2
281#define USB_CLASS_HID 3
282#define USB_CLASS_PHYSICAL 5
283#define USB_CLASS_STILL_IMAGE 6
284#define USB_CLASS_PRINTER 7
285#define USB_CLASS_MASS_STORAGE 8
286#define USB_CLASS_HUB 9
287#define USB_CLASS_CDC_DATA 0x0a
288#define USB_CLASS_CSCID 0x0b /* chip+ smart card */
289#define USB_CLASS_CONTENT_SEC 0x0d /* content security */
290#define USB_CLASS_VIDEO 0x0e
291#define USB_CLASS_WIRELESS_CONTROLLER 0xe0
292#define USB_CLASS_MISC 0xef
293#define USB_CLASS_APP_SPEC 0xfe
294#define USB_CLASS_VENDOR_SPEC 0xff
295
296#define USB_SUBCLASS_VENDOR_SPEC 0xff
297
298/*-------------------------------------------------------------------------*/
299
300/* USB_DT_CONFIG: Configuration descriptor information.
301 *
302 * USB_DT_OTHER_SPEED_CONFIG is the same descriptor, except that the
303 * descriptor type is different. Highspeed-capable devices can look
304 * different depending on what speed they're currently running. Only
305 * devices with a USB_DT_DEVICE_QUALIFIER have any OTHER_SPEED_CONFIG
306 * descriptors.
307 */
308struct usb_config_descriptor {
309 __u8 bLength;
310 __u8 bDescriptorType;
311
312 __le16 wTotalLength;
313 __u8 bNumInterfaces;
314 __u8 bConfigurationValue;
315 __u8 iConfiguration;
316 __u8 bmAttributes;
317 __u8 bMaxPower;
318} __attribute__ ((packed));
319
320#define USB_DT_CONFIG_SIZE 9
321
322/* from config descriptor bmAttributes */
323#define USB_CONFIG_ATT_ONE (1 << 7) /* must be set */
324#define USB_CONFIG_ATT_SELFPOWER (1 << 6) /* self powered */
325#define USB_CONFIG_ATT_WAKEUP (1 << 5) /* can wakeup */
326#define USB_CONFIG_ATT_BATTERY (1 << 4) /* battery powered */
327
328/*-------------------------------------------------------------------------*/
329
330/* USB_DT_STRING: String descriptor */
331struct usb_string_descriptor {
332 __u8 bLength;
333 __u8 bDescriptorType;
334
335 __le16 wData[1]; /* UTF-16LE encoded */
336} __attribute__ ((packed));
337
338/* note that "string" zero is special, it holds language codes that
339 * the device supports, not Unicode characters.
340 */
341
342/*-------------------------------------------------------------------------*/
343
344/* USB_DT_INTERFACE: Interface descriptor */
345struct usb_interface_descriptor {
346 __u8 bLength;
347 __u8 bDescriptorType;
348
349 __u8 bInterfaceNumber;
350 __u8 bAlternateSetting;
351 __u8 bNumEndpoints;
352 __u8 bInterfaceClass;
353 __u8 bInterfaceSubClass;
354 __u8 bInterfaceProtocol;
355 __u8 iInterface;
356} __attribute__ ((packed));
357
358#define USB_DT_INTERFACE_SIZE 9
359
360/*-------------------------------------------------------------------------*/
361
362/* USB_DT_ENDPOINT: Endpoint descriptor */
363struct usb_endpoint_descriptor {
364 __u8 bLength;
365 __u8 bDescriptorType;
366
367 __u8 bEndpointAddress;
368 __u8 bmAttributes;
369 __le16 wMaxPacketSize;
370 __u8 bInterval;
371
372 /* NOTE: these two are _only_ in audio endpoints. */
373 /* use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof. */
374 __u8 bRefresh;
375 __u8 bSynchAddress;
376} __attribute__ ((packed));
377
378#define USB_DT_ENDPOINT_SIZE 7
379#define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
380
381
382/*
383 * Endpoints
384 */
385#define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */
386#define USB_ENDPOINT_DIR_MASK 0x80
387
388#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */
389#define USB_ENDPOINT_XFER_CONTROL 0
390#define USB_ENDPOINT_XFER_ISOC 1
391#define USB_ENDPOINT_XFER_BULK 2
392#define USB_ENDPOINT_XFER_INT 3
393#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
394
395/* The USB 3.0 spec redefines bits 5:4 of bmAttributes as interrupt ep type. */
396#define USB_ENDPOINT_INTRTYPE 0x30
397#define USB_ENDPOINT_INTR_PERIODIC (0 << 4)
398#define USB_ENDPOINT_INTR_NOTIFICATION (1 << 4)
399
400#define USB_ENDPOINT_SYNCTYPE 0x0c
401#define USB_ENDPOINT_SYNC_NONE (0 << 2)
402#define USB_ENDPOINT_SYNC_ASYNC (1 << 2)
403#define USB_ENDPOINT_SYNC_ADAPTIVE (2 << 2)
404#define USB_ENDPOINT_SYNC_SYNC (3 << 2)
405
406#define USB_ENDPOINT_USAGE_MASK 0x30
407#define USB_ENDPOINT_USAGE_DATA 0x00
408#define USB_ENDPOINT_USAGE_FEEDBACK 0x10
409#define USB_ENDPOINT_USAGE_IMPLICIT_FB 0x20 /* Implicit feedback Data endpoint */
410
411/*-------------------------------------------------------------------------*/
412
413/**
414 * usb_endpoint_num - get the endpoint's number
415 * @epd: endpoint to be checked
416 *
417 * Returns @epd's number: 0 to 15.
418 */
419static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
420{
421 return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
422}
423
424/**
425 * usb_endpoint_type - get the endpoint's transfer type
426 * @epd: endpoint to be checked
427 *
428 * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according
429 * to @epd's transfer type.
430 */
431static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
432{
433 return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
434}
435
436/**
437 * usb_endpoint_dir_in - check if the endpoint has IN direction
438 * @epd: endpoint to be checked
439 *
440 * Returns true if the endpoint is of type IN, otherwise it returns false.
441 */
442static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
443{
444 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
445}
446
447/**
448 * usb_endpoint_dir_out - check if the endpoint has OUT direction
449 * @epd: endpoint to be checked
450 *
451 * Returns true if the endpoint is of type OUT, otherwise it returns false.
452 */
453static inline int usb_endpoint_dir_out(
454 const struct usb_endpoint_descriptor *epd)
455{
456 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
457}
458
459/**
460 * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type
461 * @epd: endpoint to be checked
462 *
463 * Returns true if the endpoint is of type bulk, otherwise it returns false.
464 */
465static inline int usb_endpoint_xfer_bulk(
466 const struct usb_endpoint_descriptor *epd)
467{
468 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
469 USB_ENDPOINT_XFER_BULK);
470}
471
472/**
473 * usb_endpoint_xfer_control - check if the endpoint has control transfer type
474 * @epd: endpoint to be checked
475 *
476 * Returns true if the endpoint is of type control, otherwise it returns false.
477 */
478static inline int usb_endpoint_xfer_control(
479 const struct usb_endpoint_descriptor *epd)
480{
481 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
482 USB_ENDPOINT_XFER_CONTROL);
483}
484
485/**
486 * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
487 * @epd: endpoint to be checked
488 *
489 * Returns true if the endpoint is of type interrupt, otherwise it returns
490 * false.
491 */
492static inline int usb_endpoint_xfer_int(
493 const struct usb_endpoint_descriptor *epd)
494{
495 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
496 USB_ENDPOINT_XFER_INT);
497}
498
499/**
500 * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type
501 * @epd: endpoint to be checked
502 *
503 * Returns true if the endpoint is of type isochronous, otherwise it returns
504 * false.
505 */
506static inline int usb_endpoint_xfer_isoc(
507 const struct usb_endpoint_descriptor *epd)
508{
509 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
510 USB_ENDPOINT_XFER_ISOC);
511}
512
513/**
514 * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN
515 * @epd: endpoint to be checked
516 *
517 * Returns true if the endpoint has bulk transfer type and IN direction,
518 * otherwise it returns false.
519 */
520static inline int usb_endpoint_is_bulk_in(
521 const struct usb_endpoint_descriptor *epd)
522{
523 return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd);
524}
525
526/**
527 * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT
528 * @epd: endpoint to be checked
529 *
530 * Returns true if the endpoint has bulk transfer type and OUT direction,
531 * otherwise it returns false.
532 */
533static inline int usb_endpoint_is_bulk_out(
534 const struct usb_endpoint_descriptor *epd)
535{
536 return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd);
537}
538
539/**
540 * usb_endpoint_is_int_in - check if the endpoint is interrupt IN
541 * @epd: endpoint to be checked
542 *
543 * Returns true if the endpoint has interrupt transfer type and IN direction,
544 * otherwise it returns false.
545 */
546static inline int usb_endpoint_is_int_in(
547 const struct usb_endpoint_descriptor *epd)
548{
549 return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd);
550}
551
552/**
553 * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT
554 * @epd: endpoint to be checked
555 *
556 * Returns true if the endpoint has interrupt transfer type and OUT direction,
557 * otherwise it returns false.
558 */
559static inline int usb_endpoint_is_int_out(
560 const struct usb_endpoint_descriptor *epd)
561{
562 return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd);
563}
564
565/**
566 * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN
567 * @epd: endpoint to be checked
568 *
569 * Returns true if the endpoint has isochronous transfer type and IN direction,
570 * otherwise it returns false.
571 */
572static inline int usb_endpoint_is_isoc_in(
573 const struct usb_endpoint_descriptor *epd)
574{
575 return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd);
576}
577
578/**
579 * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT
580 * @epd: endpoint to be checked
581 *
582 * Returns true if the endpoint has isochronous transfer type and OUT direction,
583 * otherwise it returns false.
584 */
585static inline int usb_endpoint_is_isoc_out(
586 const struct usb_endpoint_descriptor *epd)
587{
588 return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd);
589}
590
591/**
592 * usb_endpoint_maxp - get endpoint's max packet size
593 * @epd: endpoint to be checked
594 *
595 * Returns @epd's max packet
596 */
597static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd)
598{
599 return __le16_to_cpu(epd->wMaxPacketSize);
600}
601
602static inline int usb_endpoint_interrupt_type(
603 const struct usb_endpoint_descriptor *epd)
604{
605 return epd->bmAttributes & USB_ENDPOINT_INTRTYPE;
606}
607
608/*-------------------------------------------------------------------------*/
609
610/* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */
611struct usb_ss_ep_comp_descriptor {
612 __u8 bLength;
613 __u8 bDescriptorType;
614
615 __u8 bMaxBurst;
616 __u8 bmAttributes;
617 __le16 wBytesPerInterval;
618} __attribute__ ((packed));
619
620#define USB_DT_SS_EP_COMP_SIZE 6
621
622/* Bits 4:0 of bmAttributes if this is a bulk endpoint */
623static inline int
624usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp)
625{
626 int max_streams;
627
628 if (!comp)
629 return 0;
630
631 max_streams = comp->bmAttributes & 0x1f;
632
633 if (!max_streams)
634 return 0;
635
636 max_streams = 1 << max_streams;
637
638 return max_streams;
639}
640
641/* Bits 1:0 of bmAttributes if this is an isoc endpoint */
642#define USB_SS_MULT(p) (1 + ((p) & 0x3))
643
644/*-------------------------------------------------------------------------*/
645
646/* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */
647struct usb_qualifier_descriptor {
648 __u8 bLength;
649 __u8 bDescriptorType;
650
651 __le16 bcdUSB;
652 __u8 bDeviceClass;
653 __u8 bDeviceSubClass;
654 __u8 bDeviceProtocol;
655 __u8 bMaxPacketSize0;
656 __u8 bNumConfigurations;
657 __u8 bRESERVED;
658} __attribute__ ((packed));
659
660
661/*-------------------------------------------------------------------------*/
662
663/* USB_DT_OTG (from OTG 1.0a supplement) */
664struct usb_otg_descriptor {
665 __u8 bLength;
666 __u8 bDescriptorType;
667
668 __u8 bmAttributes; /* support for HNP, SRP, etc */
669} __attribute__ ((packed));
670
671/* from usb_otg_descriptor.bmAttributes */
672#define USB_OTG_SRP (1 << 0)
673#define USB_OTG_HNP (1 << 1) /* swap host/device roles */
674
675/*-------------------------------------------------------------------------*/
676
677/* USB_DT_DEBUG: for special highspeed devices, replacing serial console */
678struct usb_debug_descriptor {
679 __u8 bLength;
680 __u8 bDescriptorType;
681
682 /* bulk endpoints with 8 byte maxpacket */
683 __u8 bDebugInEndpoint;
684 __u8 bDebugOutEndpoint;
685} __attribute__((packed));
686
687/*-------------------------------------------------------------------------*/
688
689/* USB_DT_INTERFACE_ASSOCIATION: groups interfaces */
690struct usb_interface_assoc_descriptor {
691 __u8 bLength;
692 __u8 bDescriptorType;
693
694 __u8 bFirstInterface;
695 __u8 bInterfaceCount;
696 __u8 bFunctionClass;
697 __u8 bFunctionSubClass;
698 __u8 bFunctionProtocol;
699 __u8 iFunction;
700} __attribute__ ((packed));
701
702
703/*-------------------------------------------------------------------------*/
704
705/* USB_DT_SECURITY: group of wireless security descriptors, including
706 * encryption types available for setting up a CC/association.
707 */
708struct usb_security_descriptor {
709 __u8 bLength;
710 __u8 bDescriptorType;
711
712 __le16 wTotalLength;
713 __u8 bNumEncryptionTypes;
714} __attribute__((packed));
715
716/*-------------------------------------------------------------------------*/
717
718/* USB_DT_KEY: used with {GET,SET}_SECURITY_DATA; only public keys
719 * may be retrieved.
720 */
721struct usb_key_descriptor {
722 __u8 bLength;
723 __u8 bDescriptorType;
724
725 __u8 tTKID[3];
726 __u8 bReserved;
727 __u8 bKeyData[0];
728} __attribute__((packed));
729
730/*-------------------------------------------------------------------------*/
731
732/* USB_DT_ENCRYPTION_TYPE: bundled in DT_SECURITY groups */
733struct usb_encryption_descriptor {
734 __u8 bLength;
735 __u8 bDescriptorType;
736
737 __u8 bEncryptionType;
738#define USB_ENC_TYPE_UNSECURE 0
739#define USB_ENC_TYPE_WIRED 1 /* non-wireless mode */
740#define USB_ENC_TYPE_CCM_1 2 /* aes128/cbc session */
741#define USB_ENC_TYPE_RSA_1 3 /* rsa3072/sha1 auth */
742 __u8 bEncryptionValue; /* use in SET_ENCRYPTION */
743 __u8 bAuthKeyIndex;
744} __attribute__((packed));
745
746
747/*-------------------------------------------------------------------------*/
748
749/* USB_DT_BOS: group of device-level capabilities */
750struct usb_bos_descriptor {
751 __u8 bLength;
752 __u8 bDescriptorType;
753
754 __le16 wTotalLength;
755 __u8 bNumDeviceCaps;
756} __attribute__((packed));
757
758#define USB_DT_BOS_SIZE 5
759/*-------------------------------------------------------------------------*/
760
761/* USB_DT_DEVICE_CAPABILITY: grouped with BOS */
762struct usb_dev_cap_header {
763 __u8 bLength;
764 __u8 bDescriptorType;
765 __u8 bDevCapabilityType;
766} __attribute__((packed));
767
768#define USB_CAP_TYPE_WIRELESS_USB 1
769
770struct usb_wireless_cap_descriptor { /* Ultra Wide Band */
771 __u8 bLength;
772 __u8 bDescriptorType;
773 __u8 bDevCapabilityType;
774
775 __u8 bmAttributes;
776#define USB_WIRELESS_P2P_DRD (1 << 1)
777#define USB_WIRELESS_BEACON_MASK (3 << 2)
778#define USB_WIRELESS_BEACON_SELF (1 << 2)
779#define USB_WIRELESS_BEACON_DIRECTED (2 << 2)
780#define USB_WIRELESS_BEACON_NONE (3 << 2)
781 __le16 wPHYRates; /* bit rates, Mbps */
782#define USB_WIRELESS_PHY_53 (1 << 0) /* always set */
783#define USB_WIRELESS_PHY_80 (1 << 1)
784#define USB_WIRELESS_PHY_107 (1 << 2) /* always set */
785#define USB_WIRELESS_PHY_160 (1 << 3)
786#define USB_WIRELESS_PHY_200 (1 << 4) /* always set */
787#define USB_WIRELESS_PHY_320 (1 << 5)
788#define USB_WIRELESS_PHY_400 (1 << 6)
789#define USB_WIRELESS_PHY_480 (1 << 7)
790 __u8 bmTFITXPowerInfo; /* TFI power levels */
791 __u8 bmFFITXPowerInfo; /* FFI power levels */
792 __le16 bmBandGroup;
793 __u8 bReserved;
794} __attribute__((packed));
795
796/* USB 2.0 Extension descriptor */
797#define USB_CAP_TYPE_EXT 2
798
799struct usb_ext_cap_descriptor { /* Link Power Management */
800 __u8 bLength;
801 __u8 bDescriptorType;
802 __u8 bDevCapabilityType;
803 __le32 bmAttributes;
804#define USB_LPM_SUPPORT (1 << 1) /* supports LPM */
805#define USB_BESL_SUPPORT (1 << 2) /* supports BESL */
806#define USB_BESL_BASELINE_VALID (1 << 3) /* Baseline BESL valid*/
807#define USB_BESL_DEEP_VALID (1 << 4) /* Deep BESL valid */
808#define USB_GET_BESL_BASELINE(p) (((p) & (0xf << 8)) >> 8)
809#define USB_GET_BESL_DEEP(p) (((p) & (0xf << 12)) >> 12)
810} __attribute__((packed));
811
812#define USB_DT_USB_EXT_CAP_SIZE 7
813
814/*
815 * SuperSpeed USB Capability descriptor: Defines the set of SuperSpeed USB
816 * specific device level capabilities
817 */
818#define USB_SS_CAP_TYPE 3
819struct usb_ss_cap_descriptor { /* Link Power Management */
820 __u8 bLength;
821 __u8 bDescriptorType;
822 __u8 bDevCapabilityType;
823 __u8 bmAttributes;
824#define USB_LTM_SUPPORT (1 << 1) /* supports LTM */
825 __le16 wSpeedSupported;
826#define USB_LOW_SPEED_OPERATION (1) /* Low speed operation */
827#define USB_FULL_SPEED_OPERATION (1 << 1) /* Full speed operation */
828#define USB_HIGH_SPEED_OPERATION (1 << 2) /* High speed operation */
829#define USB_5GBPS_OPERATION (1 << 3) /* Operation at 5Gbps */
830 __u8 bFunctionalitySupport;
831 __u8 bU1devExitLat;
832 __le16 bU2DevExitLat;
833} __attribute__((packed));
834
835#define USB_DT_USB_SS_CAP_SIZE 10
836
837/*
838 * Container ID Capability descriptor: Defines the instance unique ID used to
839 * identify the instance across all operating modes
840 */
841#define CONTAINER_ID_TYPE 4
842struct usb_ss_container_id_descriptor {
843 __u8 bLength;
844 __u8 bDescriptorType;
845 __u8 bDevCapabilityType;
846 __u8 bReserved;
847 __u8 ContainerID[16]; /* 128-bit number */
848} __attribute__((packed));
849
850#define USB_DT_USB_SS_CONTN_ID_SIZE 20
851/*-------------------------------------------------------------------------*/
852
853/* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with
854 * each endpoint descriptor for a wireless device
855 */
856struct usb_wireless_ep_comp_descriptor {
857 __u8 bLength;
858 __u8 bDescriptorType;
859
860 __u8 bMaxBurst;
861 __u8 bMaxSequence;
862 __le16 wMaxStreamDelay;
863 __le16 wOverTheAirPacketSize;
864 __u8 bOverTheAirInterval;
865 __u8 bmCompAttributes;
866#define USB_ENDPOINT_SWITCH_MASK 0x03 /* in bmCompAttributes */
867#define USB_ENDPOINT_SWITCH_NO 0
868#define USB_ENDPOINT_SWITCH_SWITCH 1
869#define USB_ENDPOINT_SWITCH_SCALE 2
870} __attribute__((packed));
871
872/*-------------------------------------------------------------------------*/
873
874/* USB_REQ_SET_HANDSHAKE is a four-way handshake used between a wireless
875 * host and a device for connection set up, mutual authentication, and
876 * exchanging short lived session keys. The handshake depends on a CC.
877 */
878struct usb_handshake {
879 __u8 bMessageNumber;
880 __u8 bStatus;
881 __u8 tTKID[3];
882 __u8 bReserved;
883 __u8 CDID[16];
884 __u8 nonce[16];
885 __u8 MIC[8];
886} __attribute__((packed));
887
888/*-------------------------------------------------------------------------*/
889
890/* USB_REQ_SET_CONNECTION modifies or revokes a connection context (CC).
891 * A CC may also be set up using non-wireless secure channels (including
892 * wired USB!), and some devices may support CCs with multiple hosts.
893 */
894struct usb_connection_context {
895 __u8 CHID[16]; /* persistent host id */
896 __u8 CDID[16]; /* device id (unique w/in host context) */
897 __u8 CK[16]; /* connection key */
898} __attribute__((packed));
899
900/*-------------------------------------------------------------------------*/
901 36
902/* USB 2.0 defines three speeds, here's how Linux identifies them */
903
904enum usb_device_speed {
905 USB_SPEED_UNKNOWN = 0, /* enumerating */
906 USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */
907 USB_SPEED_HIGH, /* usb 2.0 */
908 USB_SPEED_WIRELESS, /* wireless (usb 2.5) */
909 USB_SPEED_SUPER, /* usb 3.0 */
910};
911
912#ifdef __KERNEL__
913 37
914/** 38/**
915 * usb_speed_string() - Returns human readable-name of the speed. 39 * usb_speed_string() - Returns human readable-name of the speed.
@@ -919,86 +43,4 @@ enum usb_device_speed {
919 */ 43 */
920extern const char *usb_speed_string(enum usb_device_speed speed); 44extern const char *usb_speed_string(enum usb_device_speed speed);
921 45
922#endif
923
924enum usb_device_state {
925 /* NOTATTACHED isn't in the USB spec, and this state acts
926 * the same as ATTACHED ... but it's clearer this way.
927 */
928 USB_STATE_NOTATTACHED = 0,
929
930 /* chapter 9 and authentication (wireless) device states */
931 USB_STATE_ATTACHED,
932 USB_STATE_POWERED, /* wired */
933 USB_STATE_RECONNECTING, /* auth */
934 USB_STATE_UNAUTHENTICATED, /* auth */
935 USB_STATE_DEFAULT, /* limited function */
936 USB_STATE_ADDRESS,
937 USB_STATE_CONFIGURED, /* most functions */
938
939 USB_STATE_SUSPENDED
940
941 /* NOTE: there are actually four different SUSPENDED
942 * states, returning to POWERED, DEFAULT, ADDRESS, or
943 * CONFIGURED respectively when SOF tokens flow again.
944 * At this level there's no difference between L1 and L2
945 * suspend states. (L2 being original USB 1.1 suspend.)
946 */
947};
948
949enum usb3_link_state {
950 USB3_LPM_U0 = 0,
951 USB3_LPM_U1,
952 USB3_LPM_U2,
953 USB3_LPM_U3
954};
955
956/*
957 * A U1 timeout of 0x0 means the parent hub will reject any transitions to U1.
958 * 0xff means the parent hub will accept transitions to U1, but will not
959 * initiate a transition.
960 *
961 * A U1 timeout of 0x1 to 0x7F also causes the hub to initiate a transition to
962 * U1 after that many microseconds. Timeouts of 0x80 to 0xFE are reserved
963 * values.
964 *
965 * A U2 timeout of 0x0 means the parent hub will reject any transitions to U2.
966 * 0xff means the parent hub will accept transitions to U2, but will not
967 * initiate a transition.
968 *
969 * A U2 timeout of 0x1 to 0xFE also causes the hub to initiate a transition to
970 * U2 after N*256 microseconds. Therefore a U2 timeout value of 0x1 means a U2
971 * idle timer of 256 microseconds, 0x2 means 512 microseconds, 0xFE means
972 * 65.024ms.
973 */
974#define USB3_LPM_DISABLED 0x0
975#define USB3_LPM_U1_MAX_TIMEOUT 0x7F
976#define USB3_LPM_U2_MAX_TIMEOUT 0xFE
977#define USB3_LPM_DEVICE_INITIATED 0xFF
978
979struct usb_set_sel_req {
980 __u8 u1_sel;
981 __u8 u1_pel;
982 __le16 u2_sel;
983 __le16 u2_pel;
984} __attribute__ ((packed));
985
986/*
987 * The Set System Exit Latency control transfer provides one byte each for
988 * U1 SEL and U1 PEL, so the max exit latency is 0xFF. U2 SEL and U2 PEL each
989 * are two bytes long.
990 */
991#define USB3_LPM_MAX_U1_SEL_PEL 0xFF
992#define USB3_LPM_MAX_U2_SEL_PEL 0xFFFF
993
994/*-------------------------------------------------------------------------*/
995
996/*
997 * As per USB compliance update, a device that is actively drawing
998 * more than 100mA from USB must report itself as bus-powered in
999 * the GetStatus(DEVICE) call.
1000 * http://compliance.usb.org/index.asp?UpdateFile=Electrical&Format=Standard#34
1001 */
1002#define USB_SELF_POWER_VBUS_MAX_DRAW 100
1003
1004#endif /* __LINUX_USB_CH9_H */ 46#endif /* __LINUX_USB_CH9_H */
diff --git a/include/linux/usb/functionfs.h b/include/linux/usb/functionfs.h
index a843d0851364..65d0a88dbc67 100644
--- a/include/linux/usb/functionfs.h
+++ b/include/linux/usb/functionfs.h
@@ -1,171 +1,8 @@
1#ifndef __LINUX_FUNCTIONFS_H__ 1#ifndef __LINUX_FUNCTIONFS_H__
2#define __LINUX_FUNCTIONFS_H__ 1 2#define __LINUX_FUNCTIONFS_H__ 1
3 3
4#include <uapi/linux/usb/functionfs.h>
4 5
5#include <linux/types.h>
6#include <linux/ioctl.h>
7
8#include <linux/usb/ch9.h>
9
10
11enum {
12 FUNCTIONFS_DESCRIPTORS_MAGIC = 1,
13 FUNCTIONFS_STRINGS_MAGIC = 2
14};
15
16
17#ifndef __KERNEL__
18
19/* Descriptor of an non-audio endpoint */
20struct usb_endpoint_descriptor_no_audio {
21 __u8 bLength;
22 __u8 bDescriptorType;
23
24 __u8 bEndpointAddress;
25 __u8 bmAttributes;
26 __le16 wMaxPacketSize;
27 __u8 bInterval;
28} __attribute__((packed));
29
30
31/*
32 * All numbers must be in little endian order.
33 */
34
35struct usb_functionfs_descs_head {
36 __le32 magic;
37 __le32 length;
38 __le32 fs_count;
39 __le32 hs_count;
40} __attribute__((packed));
41
42/*
43 * Descriptors format:
44 *
45 * | off | name | type | description |
46 * |-----+-----------+--------------+--------------------------------------|
47 * | 0 | magic | LE32 | FUNCTIONFS_{FS,HS}_DESCRIPTORS_MAGIC |
48 * | 4 | length | LE32 | length of the whole data chunk |
49 * | 8 | fs_count | LE32 | number of full-speed descriptors |
50 * | 12 | hs_count | LE32 | number of high-speed descriptors |
51 * | 16 | fs_descrs | Descriptor[] | list of full-speed descriptors |
52 * | | hs_descrs | Descriptor[] | list of high-speed descriptors |
53 *
54 * descs are just valid USB descriptors and have the following format:
55 *
56 * | off | name | type | description |
57 * |-----+-----------------+------+--------------------------|
58 * | 0 | bLength | U8 | length of the descriptor |
59 * | 1 | bDescriptorType | U8 | descriptor type |
60 * | 2 | payload | | descriptor's payload |
61 */
62
63struct usb_functionfs_strings_head {
64 __le32 magic;
65 __le32 length;
66 __le32 str_count;
67 __le32 lang_count;
68} __attribute__((packed));
69
70/*
71 * Strings format:
72 *
73 * | off | name | type | description |
74 * |-----+------------+-----------------------+----------------------------|
75 * | 0 | magic | LE32 | FUNCTIONFS_STRINGS_MAGIC |
76 * | 4 | length | LE32 | length of the data chunk |
77 * | 8 | str_count | LE32 | number of strings |
78 * | 12 | lang_count | LE32 | number of languages |
79 * | 16 | stringtab | StringTab[lang_count] | table of strings per lang |
80 *
81 * For each language there is one stringtab entry (ie. there are lang_count
82 * stringtab entires). Each StringTab has following format:
83 *
84 * | off | name | type | description |
85 * |-----+---------+-------------------+------------------------------------|
86 * | 0 | lang | LE16 | language code |
87 * | 2 | strings | String[str_count] | array of strings in given language |
88 *
89 * For each string there is one strings entry (ie. there are str_count
90 * string entries). Each String is a NUL terminated string encoded in
91 * UTF-8.
92 */
93
94#endif
95
96
97/*
98 * Events are delivered on the ep0 file descriptor, when the user mode driver
99 * reads from this file descriptor after writing the descriptors. Don't
100 * stop polling this descriptor.
101 */
102
103enum usb_functionfs_event_type {
104 FUNCTIONFS_BIND,
105 FUNCTIONFS_UNBIND,
106
107 FUNCTIONFS_ENABLE,
108 FUNCTIONFS_DISABLE,
109
110 FUNCTIONFS_SETUP,
111
112 FUNCTIONFS_SUSPEND,
113 FUNCTIONFS_RESUME
114};
115
116/* NOTE: this structure must stay the same size and layout on
117 * both 32-bit and 64-bit kernels.
118 */
119struct usb_functionfs_event {
120 union {
121 /* SETUP: packet; DATA phase i/o precedes next event
122 *(setup.bmRequestType & USB_DIR_IN) flags direction */
123 struct usb_ctrlrequest setup;
124 } __attribute__((packed)) u;
125
126 /* enum usb_functionfs_event_type */
127 __u8 type;
128 __u8 _pad[3];
129} __attribute__((packed));
130
131
132/* Endpoint ioctls */
133/* The same as in gadgetfs */
134
135/* IN transfers may be reported to the gadget driver as complete
136 * when the fifo is loaded, before the host reads the data;
137 * OUT transfers may be reported to the host's "client" driver as
138 * complete when they're sitting in the FIFO unread.
139 * THIS returns how many bytes are "unclaimed" in the endpoint fifo
140 * (needed for precise fault handling, when the hardware allows it)
141 */
142#define FUNCTIONFS_FIFO_STATUS _IO('g', 1)
143
144/* discards any unclaimed data in the fifo. */
145#define FUNCTIONFS_FIFO_FLUSH _IO('g', 2)
146
147/* resets endpoint halt+toggle; used to implement set_interface.
148 * some hardware (like pxa2xx) can't support this.
149 */
150#define FUNCTIONFS_CLEAR_HALT _IO('g', 3)
151
152/* Specific for functionfs */
153
154/*
155 * Returns reverse mapping of an interface. Called on EP0. If there
156 * is no such interface returns -EDOM. If function is not active
157 * returns -ENODEV.
158 */
159#define FUNCTIONFS_INTERFACE_REVMAP _IO('g', 128)
160
161/*
162 * Returns real bEndpointAddress of an endpoint. If function is not
163 * active returns -ENODEV.
164 */
165#define FUNCTIONFS_ENDPOINT_REVMAP _IO('g', 129)
166
167
168#ifdef __KERNEL__
169 6
170struct ffs_data; 7struct ffs_data;
171struct usb_composite_dev; 8struct usb_composite_dev;
@@ -197,5 +34,3 @@ static void functionfs_release_dev_callback(struct ffs_data *ffs_data)
197 34
198 35
199#endif 36#endif
200
201#endif
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index f87cf622317f..ddbbb7de894b 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -68,6 +68,7 @@ struct usbnet {
68# define EVENT_RX_PAUSED 5 68# define EVENT_RX_PAUSED 5
69# define EVENT_DEV_ASLEEP 6 69# define EVENT_DEV_ASLEEP 6
70# define EVENT_DEV_OPEN 7 70# define EVENT_DEV_OPEN 7
71# define EVENT_DEVICE_REPORT_IDLE 8
71}; 72};
72 73
73static inline struct usb_driver *driver_of(struct usb_interface *intf) 74static inline struct usb_driver *driver_of(struct usb_interface *intf)
@@ -160,6 +161,7 @@ extern int usbnet_probe(struct usb_interface *, const struct usb_device_id *);
160extern int usbnet_suspend(struct usb_interface *, pm_message_t); 161extern int usbnet_suspend(struct usb_interface *, pm_message_t);
161extern int usbnet_resume(struct usb_interface *); 162extern int usbnet_resume(struct usb_interface *);
162extern void usbnet_disconnect(struct usb_interface *); 163extern void usbnet_disconnect(struct usb_interface *);
164extern void usbnet_device_suggests_idle(struct usbnet *dev);
163 165
164 166
165/* Drivers that reuse some of the standard USB CDC infrastructure 167/* Drivers that reuse some of the standard USB CDC infrastructure
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index 4abe28e41cbc..04a26285416c 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -25,126 +25,11 @@
25 */ 25 */
26 26
27/*****************************************************************************/ 27/*****************************************************************************/
28
29#ifndef _LINUX_USBDEVICE_FS_H 28#ifndef _LINUX_USBDEVICE_FS_H
30#define _LINUX_USBDEVICE_FS_H 29#define _LINUX_USBDEVICE_FS_H
31 30
32#include <linux/types.h> 31#include <uapi/linux/usbdevice_fs.h>
33#include <linux/magic.h>
34
35/* --------------------------------------------------------------------- */
36
37/* usbdevfs ioctl codes */
38
39struct usbdevfs_ctrltransfer {
40 __u8 bRequestType;
41 __u8 bRequest;
42 __u16 wValue;
43 __u16 wIndex;
44 __u16 wLength;
45 __u32 timeout; /* in milliseconds */
46 void __user *data;
47};
48
49struct usbdevfs_bulktransfer {
50 unsigned int ep;
51 unsigned int len;
52 unsigned int timeout; /* in milliseconds */
53 void __user *data;
54};
55
56struct usbdevfs_setinterface {
57 unsigned int interface;
58 unsigned int altsetting;
59};
60
61struct usbdevfs_disconnectsignal {
62 unsigned int signr;
63 void __user *context;
64};
65
66#define USBDEVFS_MAXDRIVERNAME 255
67
68struct usbdevfs_getdriver {
69 unsigned int interface;
70 char driver[USBDEVFS_MAXDRIVERNAME + 1];
71};
72
73struct usbdevfs_connectinfo {
74 unsigned int devnum;
75 unsigned char slow;
76};
77
78#define USBDEVFS_URB_SHORT_NOT_OK 0x01
79#define USBDEVFS_URB_ISO_ASAP 0x02
80#define USBDEVFS_URB_BULK_CONTINUATION 0x04
81#define USBDEVFS_URB_NO_FSBR 0x20
82#define USBDEVFS_URB_ZERO_PACKET 0x40
83#define USBDEVFS_URB_NO_INTERRUPT 0x80
84
85#define USBDEVFS_URB_TYPE_ISO 0
86#define USBDEVFS_URB_TYPE_INTERRUPT 1
87#define USBDEVFS_URB_TYPE_CONTROL 2
88#define USBDEVFS_URB_TYPE_BULK 3
89 32
90struct usbdevfs_iso_packet_desc {
91 unsigned int length;
92 unsigned int actual_length;
93 unsigned int status;
94};
95
96struct usbdevfs_urb {
97 unsigned char type;
98 unsigned char endpoint;
99 int status;
100 unsigned int flags;
101 void __user *buffer;
102 int buffer_length;
103 int actual_length;
104 int start_frame;
105 int number_of_packets;
106 int error_count;
107 unsigned int signr; /* signal to be sent on completion,
108 or 0 if none should be sent. */
109 void __user *usercontext;
110 struct usbdevfs_iso_packet_desc iso_frame_desc[0];
111};
112
113/* ioctls for talking directly to drivers */
114struct usbdevfs_ioctl {
115 int ifno; /* interface 0..N ; negative numbers reserved */
116 int ioctl_code; /* MUST encode size + direction of data so the
117 * macros in <asm/ioctl.h> give correct values */
118 void __user *data; /* param buffer (in, or out) */
119};
120
121/* You can do most things with hubs just through control messages,
122 * except find out what device connects to what port. */
123struct usbdevfs_hub_portinfo {
124 char nports; /* number of downstream ports in this hub */
125 char port [127]; /* e.g. port 3 connects to device 27 */
126};
127
128/* Device capability flags */
129#define USBDEVFS_CAP_ZERO_PACKET 0x01
130#define USBDEVFS_CAP_BULK_CONTINUATION 0x02
131#define USBDEVFS_CAP_NO_PACKET_SIZE_LIM 0x04
132#define USBDEVFS_CAP_BULK_SCATTER_GATHER 0x08
133
134/* USBDEVFS_DISCONNECT_CLAIM flags & struct */
135
136/* disconnect-and-claim if the driver matches the driver field */
137#define USBDEVFS_DISCONNECT_CLAIM_IF_DRIVER 0x01
138/* disconnect-and-claim except when the driver matches the driver field */
139#define USBDEVFS_DISCONNECT_CLAIM_EXCEPT_DRIVER 0x02
140
141struct usbdevfs_disconnect_claim {
142 unsigned int interface;
143 unsigned int flags;
144 char driver[USBDEVFS_MAXDRIVERNAME + 1];
145};
146
147#ifdef __KERNEL__
148#ifdef CONFIG_COMPAT 33#ifdef CONFIG_COMPAT
149#include <linux/compat.h> 34#include <linux/compat.h>
150 35
@@ -192,38 +77,4 @@ struct usbdevfs_ioctl32 {
192 compat_caddr_t data; 77 compat_caddr_t data;
193}; 78};
194#endif 79#endif
195#endif /* __KERNEL__ */
196
197#define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer)
198#define USBDEVFS_CONTROL32 _IOWR('U', 0, struct usbdevfs_ctrltransfer32)
199#define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer)
200#define USBDEVFS_BULK32 _IOWR('U', 2, struct usbdevfs_bulktransfer32)
201#define USBDEVFS_RESETEP _IOR('U', 3, unsigned int)
202#define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface)
203#define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int)
204#define USBDEVFS_GETDRIVER _IOW('U', 8, struct usbdevfs_getdriver)
205#define USBDEVFS_SUBMITURB _IOR('U', 10, struct usbdevfs_urb)
206#define USBDEVFS_SUBMITURB32 _IOR('U', 10, struct usbdevfs_urb32)
207#define USBDEVFS_DISCARDURB _IO('U', 11)
208#define USBDEVFS_REAPURB _IOW('U', 12, void *)
209#define USBDEVFS_REAPURB32 _IOW('U', 12, __u32)
210#define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *)
211#define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, __u32)
212#define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal)
213#define USBDEVFS_DISCSIGNAL32 _IOR('U', 14, struct usbdevfs_disconnectsignal32)
214#define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int)
215#define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int)
216#define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo)
217#define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl)
218#define USBDEVFS_IOCTL32 _IOWR('U', 18, struct usbdevfs_ioctl32)
219#define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo)
220#define USBDEVFS_RESET _IO('U', 20)
221#define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int)
222#define USBDEVFS_DISCONNECT _IO('U', 22)
223#define USBDEVFS_CONNECT _IO('U', 23)
224#define USBDEVFS_CLAIM_PORT _IOR('U', 24, unsigned int)
225#define USBDEVFS_RELEASE_PORT _IOR('U', 25, unsigned int)
226#define USBDEVFS_GET_CAPABILITIES _IOR('U', 26, __u32)
227#define USBDEVFS_DISCONNECT_CLAIM _IOR('U', 27, struct usbdevfs_disconnect_claim)
228
229#endif /* _LINUX_USBDEVICE_FS_H */ 80#endif /* _LINUX_USBDEVICE_FS_H */
diff --git a/include/linux/utsname.h b/include/linux/utsname.h
index c714ed75eae2..2b345206722a 100644
--- a/include/linux/utsname.h
+++ b/include/linux/utsname.h
@@ -1,41 +1,12 @@
1#ifndef _LINUX_UTSNAME_H 1#ifndef _LINUX_UTSNAME_H
2#define _LINUX_UTSNAME_H 2#define _LINUX_UTSNAME_H
3 3
4#define __OLD_UTS_LEN 8
5
6struct oldold_utsname {
7 char sysname[9];
8 char nodename[9];
9 char release[9];
10 char version[9];
11 char machine[9];
12};
13
14#define __NEW_UTS_LEN 64
15
16struct old_utsname {
17 char sysname[65];
18 char nodename[65];
19 char release[65];
20 char version[65];
21 char machine[65];
22};
23
24struct new_utsname {
25 char sysname[__NEW_UTS_LEN + 1];
26 char nodename[__NEW_UTS_LEN + 1];
27 char release[__NEW_UTS_LEN + 1];
28 char version[__NEW_UTS_LEN + 1];
29 char machine[__NEW_UTS_LEN + 1];
30 char domainname[__NEW_UTS_LEN + 1];
31};
32
33#ifdef __KERNEL__
34 4
35#include <linux/sched.h> 5#include <linux/sched.h>
36#include <linux/kref.h> 6#include <linux/kref.h>
37#include <linux/nsproxy.h> 7#include <linux/nsproxy.h>
38#include <linux/err.h> 8#include <linux/err.h>
9#include <uapi/linux/utsname.h>
39 10
40enum uts_proc { 11enum uts_proc {
41 UTS_PROC_OSTYPE, 12 UTS_PROC_OSTYPE,
@@ -108,6 +79,4 @@ static inline struct new_utsname *init_utsname(void)
108 79
109extern struct rw_semaphore uts_sem; 80extern struct rw_semaphore uts_sem;
110 81
111#endif /* __KERNEL__ */
112
113#endif /* _LINUX_UTSNAME_H */ 82#endif /* _LINUX_UTSNAME_H */
diff --git a/include/linux/uuid.h b/include/linux/uuid.h
index f86c37bfd4a0..6df2509033d7 100644
--- a/include/linux/uuid.h
+++ b/include/linux/uuid.h
@@ -17,44 +17,11 @@
17 * along with this program; if not, write to the Free Software 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 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20
21#ifndef _LINUX_UUID_H_ 20#ifndef _LINUX_UUID_H_
22#define _LINUX_UUID_H_ 21#define _LINUX_UUID_H_
23 22
24#include <linux/types.h> 23#include <uapi/linux/uuid.h>
25#include <linux/string.h>
26
27typedef struct {
28 __u8 b[16];
29} uuid_le;
30
31typedef struct {
32 __u8 b[16];
33} uuid_be;
34
35#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
36((uuid_le) \
37{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
38 (b) & 0xff, ((b) >> 8) & 0xff, \
39 (c) & 0xff, ((c) >> 8) & 0xff, \
40 (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
41 24
42#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
43((uuid_be) \
44{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
45 ((b) >> 8) & 0xff, (b) & 0xff, \
46 ((c) >> 8) & 0xff, (c) & 0xff, \
47 (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
48
49#define NULL_UUID_LE \
50 UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
51 0x00, 0x00, 0x00, 0x00)
52
53#define NULL_UUID_BE \
54 UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
55 0x00, 0x00, 0x00, 0x00)
56
57#ifdef __KERNEL__
58 25
59static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2) 26static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2)
60{ 27{
@@ -69,6 +36,4 @@ static inline int uuid_be_cmp(const uuid_be u1, const uuid_be u2)
69extern void uuid_le_gen(uuid_le *u); 36extern void uuid_le_gen(uuid_le *u);
70extern void uuid_be_gen(uuid_be *u); 37extern void uuid_be_gen(uuid_be *u);
71 38
72#endif /* __KERNEL__ */
73
74#endif 39#endif
diff --git a/include/linux/vfio.h b/include/linux/vfio.h
index 0a4f180a11d8..ab9e86224c54 100644
--- a/include/linux/vfio.h
+++ b/include/linux/vfio.h
@@ -11,15 +11,10 @@
11#ifndef VFIO_H 11#ifndef VFIO_H
12#define VFIO_H 12#define VFIO_H
13 13
14#include <linux/types.h>
15#include <linux/ioctl.h>
16
17#define VFIO_API_VERSION 0
18
19#ifdef __KERNEL__ /* Internal VFIO-core/bus driver API */
20 14
21#include <linux/iommu.h> 15#include <linux/iommu.h>
22#include <linux/mm.h> 16#include <linux/mm.h>
17#include <uapi/linux/vfio.h>
23 18
24/** 19/**
25 * struct vfio_device_ops - VFIO bus driver device callbacks 20 * struct vfio_device_ops - VFIO bus driver device callbacks
@@ -92,354 +87,4 @@ extern void vfio_unregister_iommu_driver(
92 TYPE tmp; \ 87 TYPE tmp; \
93 offsetof(TYPE, MEMBER) + sizeof(tmp.MEMBER); }) \ 88 offsetof(TYPE, MEMBER) + sizeof(tmp.MEMBER); }) \
94 89
95#endif /* __KERNEL__ */
96
97/* Kernel & User level defines for VFIO IOCTLs. */
98
99/* Extensions */
100
101#define VFIO_TYPE1_IOMMU 1
102
103/*
104 * The IOCTL interface is designed for extensibility by embedding the
105 * structure length (argsz) and flags into structures passed between
106 * kernel and userspace. We therefore use the _IO() macro for these
107 * defines to avoid implicitly embedding a size into the ioctl request.
108 * As structure fields are added, argsz will increase to match and flag
109 * bits will be defined to indicate additional fields with valid data.
110 * It's *always* the caller's responsibility to indicate the size of
111 * the structure passed by setting argsz appropriately.
112 */
113
114#define VFIO_TYPE (';')
115#define VFIO_BASE 100
116
117/* -------- IOCTLs for VFIO file descriptor (/dev/vfio/vfio) -------- */
118
119/**
120 * VFIO_GET_API_VERSION - _IO(VFIO_TYPE, VFIO_BASE + 0)
121 *
122 * Report the version of the VFIO API. This allows us to bump the entire
123 * API version should we later need to add or change features in incompatible
124 * ways.
125 * Return: VFIO_API_VERSION
126 * Availability: Always
127 */
128#define VFIO_GET_API_VERSION _IO(VFIO_TYPE, VFIO_BASE + 0)
129
130/**
131 * VFIO_CHECK_EXTENSION - _IOW(VFIO_TYPE, VFIO_BASE + 1, __u32)
132 *
133 * Check whether an extension is supported.
134 * Return: 0 if not supported, 1 (or some other positive integer) if supported.
135 * Availability: Always
136 */
137#define VFIO_CHECK_EXTENSION _IO(VFIO_TYPE, VFIO_BASE + 1)
138
139/**
140 * VFIO_SET_IOMMU - _IOW(VFIO_TYPE, VFIO_BASE + 2, __s32)
141 *
142 * Set the iommu to the given type. The type must be supported by an
143 * iommu driver as verified by calling CHECK_EXTENSION using the same
144 * type. A group must be set to this file descriptor before this
145 * ioctl is available. The IOMMU interfaces enabled by this call are
146 * specific to the value set.
147 * Return: 0 on success, -errno on failure
148 * Availability: When VFIO group attached
149 */
150#define VFIO_SET_IOMMU _IO(VFIO_TYPE, VFIO_BASE + 2)
151
152/* -------- IOCTLs for GROUP file descriptors (/dev/vfio/$GROUP) -------- */
153
154/**
155 * VFIO_GROUP_GET_STATUS - _IOR(VFIO_TYPE, VFIO_BASE + 3,
156 * struct vfio_group_status)
157 *
158 * Retrieve information about the group. Fills in provided
159 * struct vfio_group_info. Caller sets argsz.
160 * Return: 0 on succes, -errno on failure.
161 * Availability: Always
162 */
163struct vfio_group_status {
164 __u32 argsz;
165 __u32 flags;
166#define VFIO_GROUP_FLAGS_VIABLE (1 << 0)
167#define VFIO_GROUP_FLAGS_CONTAINER_SET (1 << 1)
168};
169#define VFIO_GROUP_GET_STATUS _IO(VFIO_TYPE, VFIO_BASE + 3)
170
171/**
172 * VFIO_GROUP_SET_CONTAINER - _IOW(VFIO_TYPE, VFIO_BASE + 4, __s32)
173 *
174 * Set the container for the VFIO group to the open VFIO file
175 * descriptor provided. Groups may only belong to a single
176 * container. Containers may, at their discretion, support multiple
177 * groups. Only when a container is set are all of the interfaces
178 * of the VFIO file descriptor and the VFIO group file descriptor
179 * available to the user.
180 * Return: 0 on success, -errno on failure.
181 * Availability: Always
182 */
183#define VFIO_GROUP_SET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 4)
184
185/**
186 * VFIO_GROUP_UNSET_CONTAINER - _IO(VFIO_TYPE, VFIO_BASE + 5)
187 *
188 * Remove the group from the attached container. This is the
189 * opposite of the SET_CONTAINER call and returns the group to
190 * an initial state. All device file descriptors must be released
191 * prior to calling this interface. When removing the last group
192 * from a container, the IOMMU will be disabled and all state lost,
193 * effectively also returning the VFIO file descriptor to an initial
194 * state.
195 * Return: 0 on success, -errno on failure.
196 * Availability: When attached to container
197 */
198#define VFIO_GROUP_UNSET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 5)
199
200/**
201 * VFIO_GROUP_GET_DEVICE_FD - _IOW(VFIO_TYPE, VFIO_BASE + 6, char)
202 *
203 * Return a new file descriptor for the device object described by
204 * the provided string. The string should match a device listed in
205 * the devices subdirectory of the IOMMU group sysfs entry. The
206 * group containing the device must already be added to this context.
207 * Return: new file descriptor on success, -errno on failure.
208 * Availability: When attached to container
209 */
210#define VFIO_GROUP_GET_DEVICE_FD _IO(VFIO_TYPE, VFIO_BASE + 6)
211
212/* --------------- IOCTLs for DEVICE file descriptors --------------- */
213
214/**
215 * VFIO_DEVICE_GET_INFO - _IOR(VFIO_TYPE, VFIO_BASE + 7,
216 * struct vfio_device_info)
217 *
218 * Retrieve information about the device. Fills in provided
219 * struct vfio_device_info. Caller sets argsz.
220 * Return: 0 on success, -errno on failure.
221 */
222struct vfio_device_info {
223 __u32 argsz;
224 __u32 flags;
225#define VFIO_DEVICE_FLAGS_RESET (1 << 0) /* Device supports reset */
226#define VFIO_DEVICE_FLAGS_PCI (1 << 1) /* vfio-pci device */
227 __u32 num_regions; /* Max region index + 1 */
228 __u32 num_irqs; /* Max IRQ index + 1 */
229};
230#define VFIO_DEVICE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 7)
231
232/**
233 * VFIO_DEVICE_GET_REGION_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 8,
234 * struct vfio_region_info)
235 *
236 * Retrieve information about a device region. Caller provides
237 * struct vfio_region_info with index value set. Caller sets argsz.
238 * Implementation of region mapping is bus driver specific. This is
239 * intended to describe MMIO, I/O port, as well as bus specific
240 * regions (ex. PCI config space). Zero sized regions may be used
241 * to describe unimplemented regions (ex. unimplemented PCI BARs).
242 * Return: 0 on success, -errno on failure.
243 */
244struct vfio_region_info {
245 __u32 argsz;
246 __u32 flags;
247#define VFIO_REGION_INFO_FLAG_READ (1 << 0) /* Region supports read */
248#define VFIO_REGION_INFO_FLAG_WRITE (1 << 1) /* Region supports write */
249#define VFIO_REGION_INFO_FLAG_MMAP (1 << 2) /* Region supports mmap */
250 __u32 index; /* Region index */
251 __u32 resv; /* Reserved for alignment */
252 __u64 size; /* Region size (bytes) */
253 __u64 offset; /* Region offset from start of device fd */
254};
255#define VFIO_DEVICE_GET_REGION_INFO _IO(VFIO_TYPE, VFIO_BASE + 8)
256
257/**
258 * VFIO_DEVICE_GET_IRQ_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 9,
259 * struct vfio_irq_info)
260 *
261 * Retrieve information about a device IRQ. Caller provides
262 * struct vfio_irq_info with index value set. Caller sets argsz.
263 * Implementation of IRQ mapping is bus driver specific. Indexes
264 * using multiple IRQs are primarily intended to support MSI-like
265 * interrupt blocks. Zero count irq blocks may be used to describe
266 * unimplemented interrupt types.
267 *
268 * The EVENTFD flag indicates the interrupt index supports eventfd based
269 * signaling.
270 *
271 * The MASKABLE flags indicates the index supports MASK and UNMASK
272 * actions described below.
273 *
274 * AUTOMASKED indicates that after signaling, the interrupt line is
275 * automatically masked by VFIO and the user needs to unmask the line
276 * to receive new interrupts. This is primarily intended to distinguish
277 * level triggered interrupts.
278 *
279 * The NORESIZE flag indicates that the interrupt lines within the index
280 * are setup as a set and new subindexes cannot be enabled without first
281 * disabling the entire index. This is used for interrupts like PCI MSI
282 * and MSI-X where the driver may only use a subset of the available
283 * indexes, but VFIO needs to enable a specific number of vectors
284 * upfront. In the case of MSI-X, where the user can enable MSI-X and
285 * then add and unmask vectors, it's up to userspace to make the decision
286 * whether to allocate the maximum supported number of vectors or tear
287 * down setup and incrementally increase the vectors as each is enabled.
288 */
289struct vfio_irq_info {
290 __u32 argsz;
291 __u32 flags;
292#define VFIO_IRQ_INFO_EVENTFD (1 << 0)
293#define VFIO_IRQ_INFO_MASKABLE (1 << 1)
294#define VFIO_IRQ_INFO_AUTOMASKED (1 << 2)
295#define VFIO_IRQ_INFO_NORESIZE (1 << 3)
296 __u32 index; /* IRQ index */
297 __u32 count; /* Number of IRQs within this index */
298};
299#define VFIO_DEVICE_GET_IRQ_INFO _IO(VFIO_TYPE, VFIO_BASE + 9)
300
301/**
302 * VFIO_DEVICE_SET_IRQS - _IOW(VFIO_TYPE, VFIO_BASE + 10, struct vfio_irq_set)
303 *
304 * Set signaling, masking, and unmasking of interrupts. Caller provides
305 * struct vfio_irq_set with all fields set. 'start' and 'count' indicate
306 * the range of subindexes being specified.
307 *
308 * The DATA flags specify the type of data provided. If DATA_NONE, the
309 * operation performs the specified action immediately on the specified
310 * interrupt(s). For example, to unmask AUTOMASKED interrupt [0,0]:
311 * flags = (DATA_NONE|ACTION_UNMASK), index = 0, start = 0, count = 1.
312 *
313 * DATA_BOOL allows sparse support for the same on arrays of interrupts.
314 * For example, to mask interrupts [0,1] and [0,3] (but not [0,2]):
315 * flags = (DATA_BOOL|ACTION_MASK), index = 0, start = 1, count = 3,
316 * data = {1,0,1}
317 *
318 * DATA_EVENTFD binds the specified ACTION to the provided __s32 eventfd.
319 * A value of -1 can be used to either de-assign interrupts if already
320 * assigned or skip un-assigned interrupts. For example, to set an eventfd
321 * to be trigger for interrupts [0,0] and [0,2]:
322 * flags = (DATA_EVENTFD|ACTION_TRIGGER), index = 0, start = 0, count = 3,
323 * data = {fd1, -1, fd2}
324 * If index [0,1] is previously set, two count = 1 ioctls calls would be
325 * required to set [0,0] and [0,2] without changing [0,1].
326 *
327 * Once a signaling mechanism is set, DATA_BOOL or DATA_NONE can be used
328 * with ACTION_TRIGGER to perform kernel level interrupt loopback testing
329 * from userspace (ie. simulate hardware triggering).
330 *
331 * Setting of an event triggering mechanism to userspace for ACTION_TRIGGER
332 * enables the interrupt index for the device. Individual subindex interrupts
333 * can be disabled using the -1 value for DATA_EVENTFD or the index can be
334 * disabled as a whole with: flags = (DATA_NONE|ACTION_TRIGGER), count = 0.
335 *
336 * Note that ACTION_[UN]MASK specify user->kernel signaling (irqfds) while
337 * ACTION_TRIGGER specifies kernel->user signaling.
338 */
339struct vfio_irq_set {
340 __u32 argsz;
341 __u32 flags;
342#define VFIO_IRQ_SET_DATA_NONE (1 << 0) /* Data not present */
343#define VFIO_IRQ_SET_DATA_BOOL (1 << 1) /* Data is bool (u8) */
344#define VFIO_IRQ_SET_DATA_EVENTFD (1 << 2) /* Data is eventfd (s32) */
345#define VFIO_IRQ_SET_ACTION_MASK (1 << 3) /* Mask interrupt */
346#define VFIO_IRQ_SET_ACTION_UNMASK (1 << 4) /* Unmask interrupt */
347#define VFIO_IRQ_SET_ACTION_TRIGGER (1 << 5) /* Trigger interrupt */
348 __u32 index;
349 __u32 start;
350 __u32 count;
351 __u8 data[];
352};
353#define VFIO_DEVICE_SET_IRQS _IO(VFIO_TYPE, VFIO_BASE + 10)
354
355#define VFIO_IRQ_SET_DATA_TYPE_MASK (VFIO_IRQ_SET_DATA_NONE | \
356 VFIO_IRQ_SET_DATA_BOOL | \
357 VFIO_IRQ_SET_DATA_EVENTFD)
358#define VFIO_IRQ_SET_ACTION_TYPE_MASK (VFIO_IRQ_SET_ACTION_MASK | \
359 VFIO_IRQ_SET_ACTION_UNMASK | \
360 VFIO_IRQ_SET_ACTION_TRIGGER)
361/**
362 * VFIO_DEVICE_RESET - _IO(VFIO_TYPE, VFIO_BASE + 11)
363 *
364 * Reset a device.
365 */
366#define VFIO_DEVICE_RESET _IO(VFIO_TYPE, VFIO_BASE + 11)
367
368/*
369 * The VFIO-PCI bus driver makes use of the following fixed region and
370 * IRQ index mapping. Unimplemented regions return a size of zero.
371 * Unimplemented IRQ types return a count of zero.
372 */
373
374enum {
375 VFIO_PCI_BAR0_REGION_INDEX,
376 VFIO_PCI_BAR1_REGION_INDEX,
377 VFIO_PCI_BAR2_REGION_INDEX,
378 VFIO_PCI_BAR3_REGION_INDEX,
379 VFIO_PCI_BAR4_REGION_INDEX,
380 VFIO_PCI_BAR5_REGION_INDEX,
381 VFIO_PCI_ROM_REGION_INDEX,
382 VFIO_PCI_CONFIG_REGION_INDEX,
383 VFIO_PCI_NUM_REGIONS
384};
385
386enum {
387 VFIO_PCI_INTX_IRQ_INDEX,
388 VFIO_PCI_MSI_IRQ_INDEX,
389 VFIO_PCI_MSIX_IRQ_INDEX,
390 VFIO_PCI_NUM_IRQS
391};
392
393/* -------- API for Type1 VFIO IOMMU -------- */
394
395/**
396 * VFIO_IOMMU_GET_INFO - _IOR(VFIO_TYPE, VFIO_BASE + 12, struct vfio_iommu_info)
397 *
398 * Retrieve information about the IOMMU object. Fills in provided
399 * struct vfio_iommu_info. Caller sets argsz.
400 *
401 * XXX Should we do these by CHECK_EXTENSION too?
402 */
403struct vfio_iommu_type1_info {
404 __u32 argsz;
405 __u32 flags;
406#define VFIO_IOMMU_INFO_PGSIZES (1 << 0) /* supported page sizes info */
407 __u64 iova_pgsizes; /* Bitmap of supported page sizes */
408};
409
410#define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
411
412/**
413 * VFIO_IOMMU_MAP_DMA - _IOW(VFIO_TYPE, VFIO_BASE + 13, struct vfio_dma_map)
414 *
415 * Map process virtual addresses to IO virtual addresses using the
416 * provided struct vfio_dma_map. Caller sets argsz. READ &/ WRITE required.
417 */
418struct vfio_iommu_type1_dma_map {
419 __u32 argsz;
420 __u32 flags;
421#define VFIO_DMA_MAP_FLAG_READ (1 << 0) /* readable from device */
422#define VFIO_DMA_MAP_FLAG_WRITE (1 << 1) /* writable from device */
423 __u64 vaddr; /* Process virtual address */
424 __u64 iova; /* IO virtual address */
425 __u64 size; /* Size of mapping (bytes) */
426};
427
428#define VFIO_IOMMU_MAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 13)
429
430/**
431 * VFIO_IOMMU_UNMAP_DMA - _IOW(VFIO_TYPE, VFIO_BASE + 14, struct vfio_dma_unmap)
432 *
433 * Unmap IO virtual addresses using the provided struct vfio_dma_unmap.
434 * Caller sets argsz.
435 */
436struct vfio_iommu_type1_dma_unmap {
437 __u32 argsz;
438 __u32 flags;
439 __u64 iova; /* IO virtual address */
440 __u64 size; /* Size of mapping (bytes) */
441};
442
443#define VFIO_IOMMU_UNMAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 14)
444
445#endif /* VFIO_H */ 90#endif /* VFIO_H */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 7a147c8299ab..73ea2fb04731 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Video for Linux Two header file 2 * Video for Linux Two header file
3 * 3 *
4 * Copyright (C) 1999-2007 the contributors 4 * Copyright (C) 1999-2012 the contributors
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -56,2606 +56,7 @@
56#ifndef __LINUX_VIDEODEV2_H 56#ifndef __LINUX_VIDEODEV2_H
57#define __LINUX_VIDEODEV2_H 57#define __LINUX_VIDEODEV2_H
58 58
59#ifdef __KERNEL__
60#include <linux/time.h> /* need struct timeval */ 59#include <linux/time.h> /* need struct timeval */
61#else 60#include <uapi/linux/videodev2.h>
62#include <sys/time.h>
63#endif
64#include <linux/compiler.h>
65#include <linux/ioctl.h>
66#include <linux/types.h>
67#include <linux/v4l2-common.h>
68
69/*
70 * Common stuff for both V4L1 and V4L2
71 * Moved from videodev.h
72 */
73#define VIDEO_MAX_FRAME 32
74#define VIDEO_MAX_PLANES 8
75
76#ifndef __KERNEL__
77
78/* These defines are V4L1 specific and should not be used with the V4L2 API!
79 They will be removed from this header in the future. */
80
81#define VID_TYPE_CAPTURE 1 /* Can capture */
82#define VID_TYPE_TUNER 2 /* Can tune */
83#define VID_TYPE_TELETEXT 4 /* Does teletext */
84#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
85#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
86#define VID_TYPE_CLIPPING 32 /* Can clip */
87#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
88#define VID_TYPE_SCALES 128 /* Scalable */
89#define VID_TYPE_MONOCHROME 256 /* Monochrome only */
90#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
91#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
92#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
93#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
94#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
95#endif
96
97/*
98 * M I S C E L L A N E O U S
99 */
100
101/* Four-character-code (FOURCC) */
102#define v4l2_fourcc(a, b, c, d)\
103 ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24))
104
105/*
106 * E N U M S
107 */
108enum v4l2_field {
109 V4L2_FIELD_ANY = 0, /* driver can choose from none,
110 top, bottom, interlaced
111 depending on whatever it thinks
112 is approximate ... */
113 V4L2_FIELD_NONE = 1, /* this device has no fields ... */
114 V4L2_FIELD_TOP = 2, /* top field only */
115 V4L2_FIELD_BOTTOM = 3, /* bottom field only */
116 V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */
117 V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one
118 buffer, top-bottom order */
119 V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */
120 V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into
121 separate buffers */
122 V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field
123 first and the top field is
124 transmitted first */
125 V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field
126 first and the bottom field is
127 transmitted first */
128};
129#define V4L2_FIELD_HAS_TOP(field) \
130 ((field) == V4L2_FIELD_TOP ||\
131 (field) == V4L2_FIELD_INTERLACED ||\
132 (field) == V4L2_FIELD_INTERLACED_TB ||\
133 (field) == V4L2_FIELD_INTERLACED_BT ||\
134 (field) == V4L2_FIELD_SEQ_TB ||\
135 (field) == V4L2_FIELD_SEQ_BT)
136#define V4L2_FIELD_HAS_BOTTOM(field) \
137 ((field) == V4L2_FIELD_BOTTOM ||\
138 (field) == V4L2_FIELD_INTERLACED ||\
139 (field) == V4L2_FIELD_INTERLACED_TB ||\
140 (field) == V4L2_FIELD_INTERLACED_BT ||\
141 (field) == V4L2_FIELD_SEQ_TB ||\
142 (field) == V4L2_FIELD_SEQ_BT)
143#define V4L2_FIELD_HAS_BOTH(field) \
144 ((field) == V4L2_FIELD_INTERLACED ||\
145 (field) == V4L2_FIELD_INTERLACED_TB ||\
146 (field) == V4L2_FIELD_INTERLACED_BT ||\
147 (field) == V4L2_FIELD_SEQ_TB ||\
148 (field) == V4L2_FIELD_SEQ_BT)
149
150enum v4l2_buf_type {
151 V4L2_BUF_TYPE_VIDEO_CAPTURE = 1,
152 V4L2_BUF_TYPE_VIDEO_OUTPUT = 2,
153 V4L2_BUF_TYPE_VIDEO_OVERLAY = 3,
154 V4L2_BUF_TYPE_VBI_CAPTURE = 4,
155 V4L2_BUF_TYPE_VBI_OUTPUT = 5,
156 V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6,
157 V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7,
158#if 1
159 /* Experimental */
160 V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8,
161#endif
162 V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9,
163 V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10,
164 V4L2_BUF_TYPE_PRIVATE = 0x80,
165};
166
167#define V4L2_TYPE_IS_MULTIPLANAR(type) \
168 ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE \
169 || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
170
171#define V4L2_TYPE_IS_OUTPUT(type) \
172 ((type) == V4L2_BUF_TYPE_VIDEO_OUTPUT \
173 || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE \
174 || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY \
175 || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY \
176 || (type) == V4L2_BUF_TYPE_VBI_OUTPUT \
177 || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT)
178
179enum v4l2_tuner_type {
180 V4L2_TUNER_RADIO = 1,
181 V4L2_TUNER_ANALOG_TV = 2,
182 V4L2_TUNER_DIGITAL_TV = 3,
183};
184
185enum v4l2_memory {
186 V4L2_MEMORY_MMAP = 1,
187 V4L2_MEMORY_USERPTR = 2,
188 V4L2_MEMORY_OVERLAY = 3,
189};
190
191/* see also http://vektor.theorem.ca/graphics/ycbcr/ */
192enum v4l2_colorspace {
193 /* ITU-R 601 -- broadcast NTSC/PAL */
194 V4L2_COLORSPACE_SMPTE170M = 1,
195
196 /* 1125-Line (US) HDTV */
197 V4L2_COLORSPACE_SMPTE240M = 2,
198
199 /* HD and modern captures. */
200 V4L2_COLORSPACE_REC709 = 3,
201
202 /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */
203 V4L2_COLORSPACE_BT878 = 4,
204
205 /* These should be useful. Assume 601 extents. */
206 V4L2_COLORSPACE_470_SYSTEM_M = 5,
207 V4L2_COLORSPACE_470_SYSTEM_BG = 6,
208
209 /* I know there will be cameras that send this. So, this is
210 * unspecified chromaticities and full 0-255 on each of the
211 * Y'CbCr components
212 */
213 V4L2_COLORSPACE_JPEG = 7,
214
215 /* For RGB colourspaces, this is probably a good start. */
216 V4L2_COLORSPACE_SRGB = 8,
217};
218
219enum v4l2_priority {
220 V4L2_PRIORITY_UNSET = 0, /* not initialized */
221 V4L2_PRIORITY_BACKGROUND = 1,
222 V4L2_PRIORITY_INTERACTIVE = 2,
223 V4L2_PRIORITY_RECORD = 3,
224 V4L2_PRIORITY_DEFAULT = V4L2_PRIORITY_INTERACTIVE,
225};
226
227struct v4l2_rect {
228 __s32 left;
229 __s32 top;
230 __s32 width;
231 __s32 height;
232};
233
234struct v4l2_fract {
235 __u32 numerator;
236 __u32 denominator;
237};
238
239/**
240 * struct v4l2_capability - Describes V4L2 device caps returned by VIDIOC_QUERYCAP
241 *
242 * @driver: name of the driver module (e.g. "bttv")
243 * @card: name of the card (e.g. "Hauppauge WinTV")
244 * @bus_info: name of the bus (e.g. "PCI:" + pci_name(pci_dev) )
245 * @version: KERNEL_VERSION
246 * @capabilities: capabilities of the physical device as a whole
247 * @device_caps: capabilities accessed via this particular device (node)
248 * @reserved: reserved fields for future extensions
249 */
250struct v4l2_capability {
251 __u8 driver[16];
252 __u8 card[32];
253 __u8 bus_info[32];
254 __u32 version;
255 __u32 capabilities;
256 __u32 device_caps;
257 __u32 reserved[3];
258};
259
260/* Values for 'capabilities' field */
261#define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */
262#define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */
263#define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */
264#define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */
265#define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */
266#define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */
267#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */
268#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */
269#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */
270#define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */
271#define V4L2_CAP_RDS_OUTPUT 0x00000800 /* Is an RDS encoder */
272
273/* Is a video capture device that supports multiplanar formats */
274#define V4L2_CAP_VIDEO_CAPTURE_MPLANE 0x00001000
275/* Is a video output device that supports multiplanar formats */
276#define V4L2_CAP_VIDEO_OUTPUT_MPLANE 0x00002000
277/* Is a video mem-to-mem device that supports multiplanar formats */
278#define V4L2_CAP_VIDEO_M2M_MPLANE 0x00004000
279/* Is a video mem-to-mem device */
280#define V4L2_CAP_VIDEO_M2M 0x00008000
281
282#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */
283#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */
284#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */
285#define V4L2_CAP_MODULATOR 0x00080000 /* has a modulator */
286
287#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */
288#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */
289#define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */
290
291#define V4L2_CAP_DEVICE_CAPS 0x80000000 /* sets device capabilities field */
292
293/*
294 * V I D E O I M A G E F O R M A T
295 */
296struct v4l2_pix_format {
297 __u32 width;
298 __u32 height;
299 __u32 pixelformat;
300 __u32 field; /* enum v4l2_field */
301 __u32 bytesperline; /* for padding, zero if unused */
302 __u32 sizeimage;
303 __u32 colorspace; /* enum v4l2_colorspace */
304 __u32 priv; /* private data, depends on pixelformat */
305};
306
307/* Pixel format FOURCC depth Description */
308
309/* RGB formats */
310#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */
311#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */
312#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */
313#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */
314#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */
315#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */
316#define V4L2_PIX_FMT_BGR666 v4l2_fourcc('B', 'G', 'R', 'H') /* 18 BGR-6-6-6 */
317#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */
318#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */
319#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */
320#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */
321
322/* Grey formats */
323#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */
324#define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */
325#define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */
326#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */
327#define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ') /* 12 Greyscale */
328#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */
329
330/* Grey bit-packed formats */
331#define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */
332
333/* Palette formats */
334#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */
335
336/* Luminance+Chrominance formats */
337#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */
338#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */
339#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */
340#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */
341#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
342#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */
343#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */
344#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */
345#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 16 YVU411 planar */
346#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */
347#define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y', '4', '4', '4') /* 16 xxxxyyyy uuuuvvvv */
348#define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */
349#define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */
350#define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */
351#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */
352#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */
353#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */
354#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */
355#define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0') /* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */
356
357/* two planes -- one Y, one Cr + Cb interleaved */
358#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */
359#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */
360#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */
361#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
362#define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */
363#define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */
364
365/* two non contiguous planes - one Y, one Cr + Cb interleaved */
366#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
367#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */
368
369/* three non contiguous planes - Y, Cb, Cr */
370#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12 YUV420 planar */
371
372/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
373#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */
374#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */
375#define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */
376#define V4L2_PIX_FMT_SRGGB8 v4l2_fourcc('R', 'G', 'G', 'B') /* 8 RGRG.. GBGB.. */
377#define V4L2_PIX_FMT_SBGGR10 v4l2_fourcc('B', 'G', '1', '0') /* 10 BGBG.. GRGR.. */
378#define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */
379#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */
380#define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */
381#define V4L2_PIX_FMT_SBGGR12 v4l2_fourcc('B', 'G', '1', '2') /* 12 BGBG.. GRGR.. */
382#define V4L2_PIX_FMT_SGBRG12 v4l2_fourcc('G', 'B', '1', '2') /* 12 GBGB.. RGRG.. */
383#define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12 GRGR.. BGBG.. */
384#define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12 RGRG.. GBGB.. */
385 /* 10bit raw bayer DPCM compressed to 8 bits */
386#define V4L2_PIX_FMT_SBGGR10DPCM8 v4l2_fourcc('b', 'B', 'A', '8')
387#define V4L2_PIX_FMT_SGBRG10DPCM8 v4l2_fourcc('b', 'G', 'A', '8')
388#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0')
389#define V4L2_PIX_FMT_SRGGB10DPCM8 v4l2_fourcc('b', 'R', 'A', '8')
390 /*
391 * 10bit raw bayer, expanded to 16 bits
392 * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb...
393 */
394#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */
395
396/* compressed formats */
397#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */
398#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */
399#define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */
400#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 Multiplexed */
401#define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4') /* H264 with start codes */
402#define V4L2_PIX_FMT_H264_NO_SC v4l2_fourcc('A', 'V', 'C', '1') /* H264 without start codes */
403#define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /* H263 */
404#define V4L2_PIX_FMT_MPEG1 v4l2_fourcc('M', 'P', 'G', '1') /* MPEG-1 ES */
405#define V4L2_PIX_FMT_MPEG2 v4l2_fourcc('M', 'P', 'G', '2') /* MPEG-2 ES */
406#define V4L2_PIX_FMT_MPEG4 v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4 ES */
407#define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid */
408#define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */
409#define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M Annex L compliant stream */
410
411/* Vendor-specific formats */
412#define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
413#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */
414#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */
415#define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */
416#define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P', 'W', 'C', '1') /* pwc older webcam */
417#define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P', 'W', 'C', '2') /* pwc newer webcam */
418#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5') /* ET61X251 compression */
419#define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S', '5', '0', '1') /* YUYV per line */
420#define V4L2_PIX_FMT_SPCA505 v4l2_fourcc('S', '5', '0', '5') /* YYUV per line */
421#define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */
422#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */
423#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */
424#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */
425#define V4L2_PIX_FMT_JL2005BCD v4l2_fourcc('J', 'L', '2', '0') /* compressed RGGB bayer */
426#define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */
427#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
428#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
429#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */
430#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */
431#define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */
432#define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */
433#define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */
434#define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */
435#define V4L2_PIX_FMT_JPGL v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */
436#define V4L2_PIX_FMT_SE401 v4l2_fourcc('S', '4', '0', '1') /* se401 janggu compressed rgb */
437
438/*
439 * F O R M A T E N U M E R A T I O N
440 */
441struct v4l2_fmtdesc {
442 __u32 index; /* Format number */
443 __u32 type; /* enum v4l2_buf_type */
444 __u32 flags;
445 __u8 description[32]; /* Description string */
446 __u32 pixelformat; /* Format fourcc */
447 __u32 reserved[4];
448};
449
450#define V4L2_FMT_FLAG_COMPRESSED 0x0001
451#define V4L2_FMT_FLAG_EMULATED 0x0002
452
453#if 1
454 /* Experimental Frame Size and frame rate enumeration */
455/*
456 * F R A M E S I Z E E N U M E R A T I O N
457 */
458enum v4l2_frmsizetypes {
459 V4L2_FRMSIZE_TYPE_DISCRETE = 1,
460 V4L2_FRMSIZE_TYPE_CONTINUOUS = 2,
461 V4L2_FRMSIZE_TYPE_STEPWISE = 3,
462};
463
464struct v4l2_frmsize_discrete {
465 __u32 width; /* Frame width [pixel] */
466 __u32 height; /* Frame height [pixel] */
467};
468
469struct v4l2_frmsize_stepwise {
470 __u32 min_width; /* Minimum frame width [pixel] */
471 __u32 max_width; /* Maximum frame width [pixel] */
472 __u32 step_width; /* Frame width step size [pixel] */
473 __u32 min_height; /* Minimum frame height [pixel] */
474 __u32 max_height; /* Maximum frame height [pixel] */
475 __u32 step_height; /* Frame height step size [pixel] */
476};
477
478struct v4l2_frmsizeenum {
479 __u32 index; /* Frame size number */
480 __u32 pixel_format; /* Pixel format */
481 __u32 type; /* Frame size type the device supports. */
482
483 union { /* Frame size */
484 struct v4l2_frmsize_discrete discrete;
485 struct v4l2_frmsize_stepwise stepwise;
486 };
487
488 __u32 reserved[2]; /* Reserved space for future use */
489};
490
491/*
492 * F R A M E R A T E E N U M E R A T I O N
493 */
494enum v4l2_frmivaltypes {
495 V4L2_FRMIVAL_TYPE_DISCRETE = 1,
496 V4L2_FRMIVAL_TYPE_CONTINUOUS = 2,
497 V4L2_FRMIVAL_TYPE_STEPWISE = 3,
498};
499
500struct v4l2_frmival_stepwise {
501 struct v4l2_fract min; /* Minimum frame interval [s] */
502 struct v4l2_fract max; /* Maximum frame interval [s] */
503 struct v4l2_fract step; /* Frame interval step size [s] */
504};
505
506struct v4l2_frmivalenum {
507 __u32 index; /* Frame format index */
508 __u32 pixel_format; /* Pixel format */
509 __u32 width; /* Frame width */
510 __u32 height; /* Frame height */
511 __u32 type; /* Frame interval type the device supports. */
512
513 union { /* Frame interval */
514 struct v4l2_fract discrete;
515 struct v4l2_frmival_stepwise stepwise;
516 };
517
518 __u32 reserved[2]; /* Reserved space for future use */
519};
520#endif
521
522/*
523 * T I M E C O D E
524 */
525struct v4l2_timecode {
526 __u32 type;
527 __u32 flags;
528 __u8 frames;
529 __u8 seconds;
530 __u8 minutes;
531 __u8 hours;
532 __u8 userbits[4];
533};
534
535/* Type */
536#define V4L2_TC_TYPE_24FPS 1
537#define V4L2_TC_TYPE_25FPS 2
538#define V4L2_TC_TYPE_30FPS 3
539#define V4L2_TC_TYPE_50FPS 4
540#define V4L2_TC_TYPE_60FPS 5
541
542/* Flags */
543#define V4L2_TC_FLAG_DROPFRAME 0x0001 /* "drop-frame" mode */
544#define V4L2_TC_FLAG_COLORFRAME 0x0002
545#define V4L2_TC_USERBITS_field 0x000C
546#define V4L2_TC_USERBITS_USERDEFINED 0x0000
547#define V4L2_TC_USERBITS_8BITCHARS 0x0008
548/* The above is based on SMPTE timecodes */
549
550struct v4l2_jpegcompression {
551 int quality;
552
553 int APPn; /* Number of APP segment to be written,
554 * must be 0..15 */
555 int APP_len; /* Length of data in JPEG APPn segment */
556 char APP_data[60]; /* Data in the JPEG APPn segment. */
557
558 int COM_len; /* Length of data in JPEG COM segment */
559 char COM_data[60]; /* Data in JPEG COM segment */
560
561 __u32 jpeg_markers; /* Which markers should go into the JPEG
562 * output. Unless you exactly know what
563 * you do, leave them untouched.
564 * Inluding less markers will make the
565 * resulting code smaller, but there will
566 * be fewer applications which can read it.
567 * The presence of the APP and COM marker
568 * is influenced by APP_len and COM_len
569 * ONLY, not by this property! */
570
571#define V4L2_JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */
572#define V4L2_JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */
573#define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */
574#define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */
575#define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will
576 * allways use APP0 */
577};
578
579/*
580 * M E M O R Y - M A P P I N G B U F F E R S
581 */
582struct v4l2_requestbuffers {
583 __u32 count;
584 __u32 type; /* enum v4l2_buf_type */
585 __u32 memory; /* enum v4l2_memory */
586 __u32 reserved[2];
587};
588
589/**
590 * struct v4l2_plane - plane info for multi-planar buffers
591 * @bytesused: number of bytes occupied by data in the plane (payload)
592 * @length: size of this plane (NOT the payload) in bytes
593 * @mem_offset: when memory in the associated struct v4l2_buffer is
594 * V4L2_MEMORY_MMAP, equals the offset from the start of
595 * the device memory for this plane (or is a "cookie" that
596 * should be passed to mmap() called on the video node)
597 * @userptr: when memory is V4L2_MEMORY_USERPTR, a userspace pointer
598 * pointing to this plane
599 * @data_offset: offset in the plane to the start of data; usually 0,
600 * unless there is a header in front of the data
601 *
602 * Multi-planar buffers consist of one or more planes, e.g. an YCbCr buffer
603 * with two planes can have one plane for Y, and another for interleaved CbCr
604 * components. Each plane can reside in a separate memory buffer, or even in
605 * a completely separate memory node (e.g. in embedded devices).
606 */
607struct v4l2_plane {
608 __u32 bytesused;
609 __u32 length;
610 union {
611 __u32 mem_offset;
612 unsigned long userptr;
613 } m;
614 __u32 data_offset;
615 __u32 reserved[11];
616};
617
618/**
619 * struct v4l2_buffer - video buffer info
620 * @index: id number of the buffer
621 * @type: enum v4l2_buf_type; buffer type (type == *_MPLANE for
622 * multiplanar buffers);
623 * @bytesused: number of bytes occupied by data in the buffer (payload);
624 * unused (set to 0) for multiplanar buffers
625 * @flags: buffer informational flags
626 * @field: enum v4l2_field; field order of the image in the buffer
627 * @timestamp: frame timestamp
628 * @timecode: frame timecode
629 * @sequence: sequence count of this frame
630 * @memory: enum v4l2_memory; the method, in which the actual video data is
631 * passed
632 * @offset: for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP;
633 * offset from the start of the device memory for this plane,
634 * (or a "cookie" that should be passed to mmap() as offset)
635 * @userptr: for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR;
636 * a userspace pointer pointing to this buffer
637 * @planes: for multiplanar buffers; userspace pointer to the array of plane
638 * info structs for this buffer
639 * @length: size in bytes of the buffer (NOT its payload) for single-plane
640 * buffers (when type != *_MPLANE); number of elements in the
641 * planes array for multi-plane buffers
642 * @input: input number from which the video data has has been captured
643 *
644 * Contains data exchanged by application and driver using one of the Streaming
645 * I/O methods.
646 */
647struct v4l2_buffer {
648 __u32 index;
649 __u32 type;
650 __u32 bytesused;
651 __u32 flags;
652 __u32 field;
653 struct timeval timestamp;
654 struct v4l2_timecode timecode;
655 __u32 sequence;
656
657 /* memory location */
658 __u32 memory;
659 union {
660 __u32 offset;
661 unsigned long userptr;
662 struct v4l2_plane *planes;
663 } m;
664 __u32 length;
665 __u32 reserved2;
666 __u32 reserved;
667};
668
669/* Flags for 'flags' field */
670#define V4L2_BUF_FLAG_MAPPED 0x0001 /* Buffer is mapped (flag) */
671#define V4L2_BUF_FLAG_QUEUED 0x0002 /* Buffer is queued for processing */
672#define V4L2_BUF_FLAG_DONE 0x0004 /* Buffer is ready */
673#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */
674#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */
675#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */
676/* Buffer is ready, but the data contained within is corrupted. */
677#define V4L2_BUF_FLAG_ERROR 0x0040
678#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */
679#define V4L2_BUF_FLAG_PREPARED 0x0400 /* Buffer is prepared for queuing */
680/* Cache handling flags */
681#define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x0800
682#define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x1000
683
684/*
685 * O V E R L A Y P R E V I E W
686 */
687struct v4l2_framebuffer {
688 __u32 capability;
689 __u32 flags;
690/* FIXME: in theory we should pass something like PCI device + memory
691 * region + offset instead of some physical address */
692 void *base;
693 struct v4l2_pix_format fmt;
694};
695/* Flags for the 'capability' field. Read only */
696#define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001
697#define V4L2_FBUF_CAP_CHROMAKEY 0x0002
698#define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004
699#define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008
700#define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010
701#define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020
702#define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040
703#define V4L2_FBUF_CAP_SRC_CHROMAKEY 0x0080
704/* Flags for the 'flags' field. */
705#define V4L2_FBUF_FLAG_PRIMARY 0x0001
706#define V4L2_FBUF_FLAG_OVERLAY 0x0002
707#define V4L2_FBUF_FLAG_CHROMAKEY 0x0004
708#define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008
709#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010
710#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020
711#define V4L2_FBUF_FLAG_SRC_CHROMAKEY 0x0040
712
713struct v4l2_clip {
714 struct v4l2_rect c;
715 struct v4l2_clip __user *next;
716};
717
718struct v4l2_window {
719 struct v4l2_rect w;
720 __u32 field; /* enum v4l2_field */
721 __u32 chromakey;
722 struct v4l2_clip __user *clips;
723 __u32 clipcount;
724 void __user *bitmap;
725 __u8 global_alpha;
726};
727
728/*
729 * C A P T U R E P A R A M E T E R S
730 */
731struct v4l2_captureparm {
732 __u32 capability; /* Supported modes */
733 __u32 capturemode; /* Current mode */
734 struct v4l2_fract timeperframe; /* Time per frame in .1us units */
735 __u32 extendedmode; /* Driver-specific extensions */
736 __u32 readbuffers; /* # of buffers for read */
737 __u32 reserved[4];
738};
739
740/* Flags for 'capability' and 'capturemode' fields */
741#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */
742#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */
743
744struct v4l2_outputparm {
745 __u32 capability; /* Supported modes */
746 __u32 outputmode; /* Current mode */
747 struct v4l2_fract timeperframe; /* Time per frame in seconds */
748 __u32 extendedmode; /* Driver-specific extensions */
749 __u32 writebuffers; /* # of buffers for write */
750 __u32 reserved[4];
751};
752
753/*
754 * I N P U T I M A G E C R O P P I N G
755 */
756struct v4l2_cropcap {
757 __u32 type; /* enum v4l2_buf_type */
758 struct v4l2_rect bounds;
759 struct v4l2_rect defrect;
760 struct v4l2_fract pixelaspect;
761};
762
763struct v4l2_crop {
764 __u32 type; /* enum v4l2_buf_type */
765 struct v4l2_rect c;
766};
767
768/**
769 * struct v4l2_selection - selection info
770 * @type: buffer type (do not use *_MPLANE types)
771 * @target: Selection target, used to choose one of possible rectangles;
772 * defined in v4l2-common.h; V4L2_SEL_TGT_* .
773 * @flags: constraints flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*.
774 * @r: coordinates of selection window
775 * @reserved: for future use, rounds structure size to 64 bytes, set to zero
776 *
777 * Hardware may use multiple helper windows to process a video stream.
778 * The structure is used to exchange this selection areas between
779 * an application and a driver.
780 */
781struct v4l2_selection {
782 __u32 type;
783 __u32 target;
784 __u32 flags;
785 struct v4l2_rect r;
786 __u32 reserved[9];
787};
788
789
790/*
791 * A N A L O G V I D E O S T A N D A R D
792 */
793
794typedef __u64 v4l2_std_id;
795
796/* one bit for each */
797#define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001)
798#define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002)
799#define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004)
800#define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008)
801#define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010)
802#define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020)
803#define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040)
804#define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080)
805
806#define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100)
807#define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200)
808#define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400)
809#define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800)
810
811#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) /* BTSC */
812#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) /* EIA-J */
813#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000)
814#define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) /* FM A2 */
815
816#define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000)
817#define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000)
818#define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000)
819#define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000)
820#define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000)
821#define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000)
822#define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000)
823#define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000)
824
825/* ATSC/HDTV */
826#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000)
827#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000)
828
829/* FIXME:
830 Although std_id is 64 bits, there is an issue on PPC32 architecture that
831 makes switch(__u64) to break. So, there's a hack on v4l2-common.c rounding
832 this value to 32 bits.
833 As, currently, the max value is for V4L2_STD_ATSC_16_VSB (30 bits wide),
834 it should work fine. However, if needed to add more than two standards,
835 v4l2-common.c should be fixed.
836 */
837
838/*
839 * Some macros to merge video standards in order to make live easier for the
840 * drivers and V4L2 applications
841 */
842
843/*
844 * "Common" NTSC/M - It should be noticed that V4L2_STD_NTSC_443 is
845 * Missing here.
846 */
847#define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\
848 V4L2_STD_NTSC_M_JP |\
849 V4L2_STD_NTSC_M_KR)
850/* Secam macros */
851#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\
852 V4L2_STD_SECAM_K |\
853 V4L2_STD_SECAM_K1)
854/* All Secam Standards */
855#define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\
856 V4L2_STD_SECAM_G |\
857 V4L2_STD_SECAM_H |\
858 V4L2_STD_SECAM_DK |\
859 V4L2_STD_SECAM_L |\
860 V4L2_STD_SECAM_LC)
861/* PAL macros */
862#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\
863 V4L2_STD_PAL_B1 |\
864 V4L2_STD_PAL_G)
865#define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\
866 V4L2_STD_PAL_D1 |\
867 V4L2_STD_PAL_K)
868/*
869 * "Common" PAL - This macro is there to be compatible with the old
870 * V4L1 concept of "PAL": /BGDKHI.
871 * Several PAL standards are mising here: /M, /N and /Nc
872 */
873#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\
874 V4L2_STD_PAL_DK |\
875 V4L2_STD_PAL_H |\
876 V4L2_STD_PAL_I)
877/* Chroma "agnostic" standards */
878#define V4L2_STD_B (V4L2_STD_PAL_B |\
879 V4L2_STD_PAL_B1 |\
880 V4L2_STD_SECAM_B)
881#define V4L2_STD_G (V4L2_STD_PAL_G |\
882 V4L2_STD_SECAM_G)
883#define V4L2_STD_H (V4L2_STD_PAL_H |\
884 V4L2_STD_SECAM_H)
885#define V4L2_STD_L (V4L2_STD_SECAM_L |\
886 V4L2_STD_SECAM_LC)
887#define V4L2_STD_GH (V4L2_STD_G |\
888 V4L2_STD_H)
889#define V4L2_STD_DK (V4L2_STD_PAL_DK |\
890 V4L2_STD_SECAM_DK)
891#define V4L2_STD_BG (V4L2_STD_B |\
892 V4L2_STD_G)
893#define V4L2_STD_MN (V4L2_STD_PAL_M |\
894 V4L2_STD_PAL_N |\
895 V4L2_STD_PAL_Nc |\
896 V4L2_STD_NTSC)
897
898/* Standards where MTS/BTSC stereo could be found */
899#define V4L2_STD_MTS (V4L2_STD_NTSC_M |\
900 V4L2_STD_PAL_M |\
901 V4L2_STD_PAL_N |\
902 V4L2_STD_PAL_Nc)
903
904/* Standards for Countries with 60Hz Line frequency */
905#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\
906 V4L2_STD_PAL_60 |\
907 V4L2_STD_NTSC |\
908 V4L2_STD_NTSC_443)
909/* Standards for Countries with 50Hz Line frequency */
910#define V4L2_STD_625_50 (V4L2_STD_PAL |\
911 V4L2_STD_PAL_N |\
912 V4L2_STD_PAL_Nc |\
913 V4L2_STD_SECAM)
914
915#define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\
916 V4L2_STD_ATSC_16_VSB)
917/* Macros with none and all analog standards */
918#define V4L2_STD_UNKNOWN 0
919#define V4L2_STD_ALL (V4L2_STD_525_60 |\
920 V4L2_STD_625_50)
921
922struct v4l2_standard {
923 __u32 index;
924 v4l2_std_id id;
925 __u8 name[24];
926 struct v4l2_fract frameperiod; /* Frames, not fields */
927 __u32 framelines;
928 __u32 reserved[4];
929};
930
931/* The DV Preset API is deprecated in favor of the DV Timings API.
932 New drivers shouldn't use this anymore! */
933
934/*
935 * V I D E O T I M I N G S D V P R E S E T
936 */
937struct v4l2_dv_preset {
938 __u32 preset;
939 __u32 reserved[4];
940};
941
942/*
943 * D V P R E S E T S E N U M E R A T I O N
944 */
945struct v4l2_dv_enum_preset {
946 __u32 index;
947 __u32 preset;
948 __u8 name[32]; /* Name of the preset timing */
949 __u32 width;
950 __u32 height;
951 __u32 reserved[4];
952};
953
954/*
955 * D V P R E S E T V A L U E S
956 */
957#define V4L2_DV_INVALID 0
958#define V4L2_DV_480P59_94 1 /* BT.1362 */
959#define V4L2_DV_576P50 2 /* BT.1362 */
960#define V4L2_DV_720P24 3 /* SMPTE 296M */
961#define V4L2_DV_720P25 4 /* SMPTE 296M */
962#define V4L2_DV_720P30 5 /* SMPTE 296M */
963#define V4L2_DV_720P50 6 /* SMPTE 296M */
964#define V4L2_DV_720P59_94 7 /* SMPTE 274M */
965#define V4L2_DV_720P60 8 /* SMPTE 274M/296M */
966#define V4L2_DV_1080I29_97 9 /* BT.1120/ SMPTE 274M */
967#define V4L2_DV_1080I30 10 /* BT.1120/ SMPTE 274M */
968#define V4L2_DV_1080I25 11 /* BT.1120 */
969#define V4L2_DV_1080I50 12 /* SMPTE 296M */
970#define V4L2_DV_1080I60 13 /* SMPTE 296M */
971#define V4L2_DV_1080P24 14 /* SMPTE 296M */
972#define V4L2_DV_1080P25 15 /* SMPTE 296M */
973#define V4L2_DV_1080P30 16 /* SMPTE 296M */
974#define V4L2_DV_1080P50 17 /* BT.1120 */
975#define V4L2_DV_1080P60 18 /* BT.1120 */
976
977/*
978 * D V B T T I M I N G S
979 */
980
981/** struct v4l2_bt_timings - BT.656/BT.1120 timing data
982 * @width: total width of the active video in pixels
983 * @height: total height of the active video in lines
984 * @interlaced: Interlaced or progressive
985 * @polarities: Positive or negative polarities
986 * @pixelclock: Pixel clock in HZ. Ex. 74.25MHz->74250000
987 * @hfrontporch:Horizontal front porch in pixels
988 * @hsync: Horizontal Sync length in pixels
989 * @hbackporch: Horizontal back porch in pixels
990 * @vfrontporch:Vertical front porch in lines
991 * @vsync: Vertical Sync length in lines
992 * @vbackporch: Vertical back porch in lines
993 * @il_vfrontporch:Vertical front porch for the even field
994 * (aka field 2) of interlaced field formats
995 * @il_vsync: Vertical Sync length for the even field
996 * (aka field 2) of interlaced field formats
997 * @il_vbackporch:Vertical back porch for the even field
998 * (aka field 2) of interlaced field formats
999 * @standards: Standards the timing belongs to
1000 * @flags: Flags
1001 * @reserved: Reserved fields, must be zeroed.
1002 *
1003 * A note regarding vertical interlaced timings: height refers to the total
1004 * height of the active video frame (= two fields). The blanking timings refer
1005 * to the blanking of each field. So the height of the total frame is
1006 * calculated as follows:
1007 *
1008 * tot_height = height + vfrontporch + vsync + vbackporch +
1009 * il_vfrontporch + il_vsync + il_vbackporch
1010 *
1011 * The active height of each field is height / 2.
1012 */
1013struct v4l2_bt_timings {
1014 __u32 width;
1015 __u32 height;
1016 __u32 interlaced;
1017 __u32 polarities;
1018 __u64 pixelclock;
1019 __u32 hfrontporch;
1020 __u32 hsync;
1021 __u32 hbackporch;
1022 __u32 vfrontporch;
1023 __u32 vsync;
1024 __u32 vbackporch;
1025 __u32 il_vfrontporch;
1026 __u32 il_vsync;
1027 __u32 il_vbackporch;
1028 __u32 standards;
1029 __u32 flags;
1030 __u32 reserved[14];
1031} __attribute__ ((packed));
1032
1033/* Interlaced or progressive format */
1034#define V4L2_DV_PROGRESSIVE 0
1035#define V4L2_DV_INTERLACED 1
1036
1037/* Polarities. If bit is not set, it is assumed to be negative polarity */
1038#define V4L2_DV_VSYNC_POS_POL 0x00000001
1039#define V4L2_DV_HSYNC_POS_POL 0x00000002
1040
1041/* Timings standards */
1042#define V4L2_DV_BT_STD_CEA861 (1 << 0) /* CEA-861 Digital TV Profile */
1043#define V4L2_DV_BT_STD_DMT (1 << 1) /* VESA Discrete Monitor Timings */
1044#define V4L2_DV_BT_STD_CVT (1 << 2) /* VESA Coordinated Video Timings */
1045#define V4L2_DV_BT_STD_GTF (1 << 3) /* VESA Generalized Timings Formula */
1046
1047/* Flags */
1048
1049/* CVT/GTF specific: timing uses reduced blanking (CVT) or the 'Secondary
1050 GTF' curve (GTF). In both cases the horizontal and/or vertical blanking
1051 intervals are reduced, allowing a higher resolution over the same
1052 bandwidth. This is a read-only flag. */
1053#define V4L2_DV_FL_REDUCED_BLANKING (1 << 0)
1054/* CEA-861 specific: set for CEA-861 formats with a framerate of a multiple
1055 of six. These formats can be optionally played at 1 / 1.001 speed.
1056 This is a read-only flag. */
1057#define V4L2_DV_FL_CAN_REDUCE_FPS (1 << 1)
1058/* CEA-861 specific: only valid for video transmitters, the flag is cleared
1059 by receivers.
1060 If the framerate of the format is a multiple of six, then the pixelclock
1061 used to set up the transmitter is divided by 1.001 to make it compatible
1062 with 60 Hz based standards such as NTSC and PAL-M that use a framerate of
1063 29.97 Hz. Otherwise this flag is cleared. If the transmitter can't generate
1064 such frequencies, then the flag will also be cleared. */
1065#define V4L2_DV_FL_REDUCED_FPS (1 << 2)
1066/* Specific to interlaced formats: if set, then field 1 is really one half-line
1067 longer and field 2 is really one half-line shorter, so each field has
1068 exactly the same number of half-lines. Whether half-lines can be detected
1069 or used depends on the hardware. */
1070#define V4L2_DV_FL_HALF_LINE (1 << 0)
1071
1072
1073/** struct v4l2_dv_timings - DV timings
1074 * @type: the type of the timings
1075 * @bt: BT656/1120 timings
1076 */
1077struct v4l2_dv_timings {
1078 __u32 type;
1079 union {
1080 struct v4l2_bt_timings bt;
1081 __u32 reserved[32];
1082 };
1083} __attribute__ ((packed));
1084
1085/* Values for the type field */
1086#define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */
1087
1088
1089/** struct v4l2_enum_dv_timings - DV timings enumeration
1090 * @index: enumeration index
1091 * @reserved: must be zeroed
1092 * @timings: the timings for the given index
1093 */
1094struct v4l2_enum_dv_timings {
1095 __u32 index;
1096 __u32 reserved[3];
1097 struct v4l2_dv_timings timings;
1098};
1099
1100/** struct v4l2_bt_timings_cap - BT.656/BT.1120 timing capabilities
1101 * @min_width: width in pixels
1102 * @max_width: width in pixels
1103 * @min_height: height in lines
1104 * @max_height: height in lines
1105 * @min_pixelclock: Pixel clock in HZ. Ex. 74.25MHz->74250000
1106 * @max_pixelclock: Pixel clock in HZ. Ex. 74.25MHz->74250000
1107 * @standards: Supported standards
1108 * @capabilities: Supported capabilities
1109 * @reserved: Must be zeroed
1110 */
1111struct v4l2_bt_timings_cap {
1112 __u32 min_width;
1113 __u32 max_width;
1114 __u32 min_height;
1115 __u32 max_height;
1116 __u64 min_pixelclock;
1117 __u64 max_pixelclock;
1118 __u32 standards;
1119 __u32 capabilities;
1120 __u32 reserved[16];
1121} __attribute__ ((packed));
1122
1123/* Supports interlaced formats */
1124#define V4L2_DV_BT_CAP_INTERLACED (1 << 0)
1125/* Supports progressive formats */
1126#define V4L2_DV_BT_CAP_PROGRESSIVE (1 << 1)
1127/* Supports CVT/GTF reduced blanking */
1128#define V4L2_DV_BT_CAP_REDUCED_BLANKING (1 << 2)
1129/* Supports custom formats */
1130#define V4L2_DV_BT_CAP_CUSTOM (1 << 3)
1131
1132/** struct v4l2_dv_timings_cap - DV timings capabilities
1133 * @type: the type of the timings (same as in struct v4l2_dv_timings)
1134 * @bt: the BT656/1120 timings capabilities
1135 */
1136struct v4l2_dv_timings_cap {
1137 __u32 type;
1138 __u32 reserved[3];
1139 union {
1140 struct v4l2_bt_timings_cap bt;
1141 __u32 raw_data[32];
1142 };
1143};
1144
1145
1146/*
1147 * V I D E O I N P U T S
1148 */
1149struct v4l2_input {
1150 __u32 index; /* Which input */
1151 __u8 name[32]; /* Label */
1152 __u32 type; /* Type of input */
1153 __u32 audioset; /* Associated audios (bitfield) */
1154 __u32 tuner; /* enum v4l2_tuner_type */
1155 v4l2_std_id std;
1156 __u32 status;
1157 __u32 capabilities;
1158 __u32 reserved[3];
1159};
1160
1161/* Values for the 'type' field */
1162#define V4L2_INPUT_TYPE_TUNER 1
1163#define V4L2_INPUT_TYPE_CAMERA 2
1164
1165/* field 'status' - general */
1166#define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */
1167#define V4L2_IN_ST_NO_SIGNAL 0x00000002
1168#define V4L2_IN_ST_NO_COLOR 0x00000004
1169
1170/* field 'status' - sensor orientation */
1171/* If sensor is mounted upside down set both bits */
1172#define V4L2_IN_ST_HFLIP 0x00000010 /* Frames are flipped horizontally */
1173#define V4L2_IN_ST_VFLIP 0x00000020 /* Frames are flipped vertically */
1174
1175/* field 'status' - analog */
1176#define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */
1177#define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */
1178
1179/* field 'status' - digital */
1180#define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */
1181#define V4L2_IN_ST_NO_EQU 0x00020000 /* No equalizer lock */
1182#define V4L2_IN_ST_NO_CARRIER 0x00040000 /* Carrier recovery failed */
1183
1184/* field 'status' - VCR and set-top box */
1185#define V4L2_IN_ST_MACROVISION 0x01000000 /* Macrovision detected */
1186#define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */
1187#define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */
1188
1189/* capabilities flags */
1190#define V4L2_IN_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */
1191#define V4L2_IN_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */
1192#define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */
1193
1194/*
1195 * V I D E O O U T P U T S
1196 */
1197struct v4l2_output {
1198 __u32 index; /* Which output */
1199 __u8 name[32]; /* Label */
1200 __u32 type; /* Type of output */
1201 __u32 audioset; /* Associated audios (bitfield) */
1202 __u32 modulator; /* Associated modulator */
1203 v4l2_std_id std;
1204 __u32 capabilities;
1205 __u32 reserved[3];
1206};
1207/* Values for the 'type' field */
1208#define V4L2_OUTPUT_TYPE_MODULATOR 1
1209#define V4L2_OUTPUT_TYPE_ANALOG 2
1210#define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3
1211
1212/* capabilities flags */
1213#define V4L2_OUT_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */
1214#define V4L2_OUT_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */
1215#define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */
1216
1217/*
1218 * C O N T R O L S
1219 */
1220struct v4l2_control {
1221 __u32 id;
1222 __s32 value;
1223};
1224
1225struct v4l2_ext_control {
1226 __u32 id;
1227 __u32 size;
1228 __u32 reserved2[1];
1229 union {
1230 __s32 value;
1231 __s64 value64;
1232 char *string;
1233 };
1234} __attribute__ ((packed));
1235
1236struct v4l2_ext_controls {
1237 __u32 ctrl_class;
1238 __u32 count;
1239 __u32 error_idx;
1240 __u32 reserved[2];
1241 struct v4l2_ext_control *controls;
1242};
1243
1244/* Values for ctrl_class field */
1245#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */
1246#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
1247#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
1248#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */
1249#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */
1250#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */
1251#define V4L2_CTRL_CLASS_IMAGE_SOURCE 0x009e0000 /* Image source controls */
1252#define V4L2_CTRL_CLASS_IMAGE_PROC 0x009f0000 /* Image processing controls */
1253
1254#define V4L2_CTRL_ID_MASK (0x0fffffff)
1255#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
1256#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
1257
1258enum v4l2_ctrl_type {
1259 V4L2_CTRL_TYPE_INTEGER = 1,
1260 V4L2_CTRL_TYPE_BOOLEAN = 2,
1261 V4L2_CTRL_TYPE_MENU = 3,
1262 V4L2_CTRL_TYPE_BUTTON = 4,
1263 V4L2_CTRL_TYPE_INTEGER64 = 5,
1264 V4L2_CTRL_TYPE_CTRL_CLASS = 6,
1265 V4L2_CTRL_TYPE_STRING = 7,
1266 V4L2_CTRL_TYPE_BITMASK = 8,
1267 V4L2_CTRL_TYPE_INTEGER_MENU = 9,
1268};
1269
1270/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
1271struct v4l2_queryctrl {
1272 __u32 id;
1273 __u32 type; /* enum v4l2_ctrl_type */
1274 __u8 name[32]; /* Whatever */
1275 __s32 minimum; /* Note signedness */
1276 __s32 maximum;
1277 __s32 step;
1278 __s32 default_value;
1279 __u32 flags;
1280 __u32 reserved[2];
1281};
1282
1283/* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
1284struct v4l2_querymenu {
1285 __u32 id;
1286 __u32 index;
1287 union {
1288 __u8 name[32]; /* Whatever */
1289 __s64 value;
1290 };
1291 __u32 reserved;
1292} __attribute__ ((packed));
1293
1294/* Control flags */
1295#define V4L2_CTRL_FLAG_DISABLED 0x0001
1296#define V4L2_CTRL_FLAG_GRABBED 0x0002
1297#define V4L2_CTRL_FLAG_READ_ONLY 0x0004
1298#define V4L2_CTRL_FLAG_UPDATE 0x0008
1299#define V4L2_CTRL_FLAG_INACTIVE 0x0010
1300#define V4L2_CTRL_FLAG_SLIDER 0x0020
1301#define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040
1302#define V4L2_CTRL_FLAG_VOLATILE 0x0080
1303
1304/* Query flag, to be ORed with the control ID */
1305#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
1306
1307/* User-class control IDs defined by V4L2 */
1308#define V4L2_CID_MAX_CTRLS 1024
1309#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900)
1310#define V4L2_CID_USER_BASE V4L2_CID_BASE
1311/* IDs reserved for driver specific controls */
1312#define V4L2_CID_PRIVATE_BASE 0x08000000
1313
1314#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1)
1315#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0)
1316#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1)
1317#define V4L2_CID_SATURATION (V4L2_CID_BASE+2)
1318#define V4L2_CID_HUE (V4L2_CID_BASE+3)
1319#define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5)
1320#define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6)
1321#define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7)
1322#define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8)
1323#define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9)
1324#define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10)
1325#define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) /* Deprecated */
1326#define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12)
1327#define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13)
1328#define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14)
1329#define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15)
1330#define V4L2_CID_GAMMA (V4L2_CID_BASE+16)
1331#define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* Deprecated */
1332#define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17)
1333#define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18)
1334#define V4L2_CID_GAIN (V4L2_CID_BASE+19)
1335#define V4L2_CID_HFLIP (V4L2_CID_BASE+20)
1336#define V4L2_CID_VFLIP (V4L2_CID_BASE+21)
1337
1338/* Deprecated; use V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET */
1339#define V4L2_CID_HCENTER (V4L2_CID_BASE+22)
1340#define V4L2_CID_VCENTER (V4L2_CID_BASE+23)
1341
1342#define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24)
1343enum v4l2_power_line_frequency {
1344 V4L2_CID_POWER_LINE_FREQUENCY_DISABLED = 0,
1345 V4L2_CID_POWER_LINE_FREQUENCY_50HZ = 1,
1346 V4L2_CID_POWER_LINE_FREQUENCY_60HZ = 2,
1347 V4L2_CID_POWER_LINE_FREQUENCY_AUTO = 3,
1348};
1349#define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25)
1350#define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26)
1351#define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27)
1352#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28)
1353#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29)
1354#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30)
1355#define V4L2_CID_COLORFX (V4L2_CID_BASE+31)
1356enum v4l2_colorfx {
1357 V4L2_COLORFX_NONE = 0,
1358 V4L2_COLORFX_BW = 1,
1359 V4L2_COLORFX_SEPIA = 2,
1360 V4L2_COLORFX_NEGATIVE = 3,
1361 V4L2_COLORFX_EMBOSS = 4,
1362 V4L2_COLORFX_SKETCH = 5,
1363 V4L2_COLORFX_SKY_BLUE = 6,
1364 V4L2_COLORFX_GRASS_GREEN = 7,
1365 V4L2_COLORFX_SKIN_WHITEN = 8,
1366 V4L2_COLORFX_VIVID = 9,
1367 V4L2_COLORFX_AQUA = 10,
1368 V4L2_COLORFX_ART_FREEZE = 11,
1369 V4L2_COLORFX_SILHOUETTE = 12,
1370 V4L2_COLORFX_SOLARIZATION = 13,
1371 V4L2_COLORFX_ANTIQUE = 14,
1372 V4L2_COLORFX_SET_CBCR = 15,
1373};
1374#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
1375#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
1376
1377#define V4L2_CID_ROTATE (V4L2_CID_BASE+34)
1378#define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35)
1379
1380#define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36)
1381
1382#define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+37)
1383#define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+38)
1384
1385#define V4L2_CID_MIN_BUFFERS_FOR_CAPTURE (V4L2_CID_BASE+39)
1386#define V4L2_CID_MIN_BUFFERS_FOR_OUTPUT (V4L2_CID_BASE+40)
1387
1388#define V4L2_CID_ALPHA_COMPONENT (V4L2_CID_BASE+41)
1389#define V4L2_CID_COLORFX_CBCR (V4L2_CID_BASE+42)
1390
1391/* last CID + 1 */
1392#define V4L2_CID_LASTP1 (V4L2_CID_BASE+43)
1393
1394/* MPEG-class control IDs defined by V4L2 */
1395#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
1396#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1)
1397
1398/* MPEG streams, specific to multiplexed streams */
1399#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0)
1400enum v4l2_mpeg_stream_type {
1401 V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */
1402 V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, /* MPEG-2 transport stream */
1403 V4L2_MPEG_STREAM_TYPE_MPEG1_SS = 2, /* MPEG-1 system stream */
1404 V4L2_MPEG_STREAM_TYPE_MPEG2_DVD = 3, /* MPEG-2 DVD-compatible stream */
1405 V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */
1406 V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */
1407};
1408#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1)
1409#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2)
1410#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3)
1411#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4)
1412#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5)
1413#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6)
1414#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7)
1415enum v4l2_mpeg_stream_vbi_fmt {
1416 V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */
1417 V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */
1418};
1419
1420/* MPEG audio controls specific to multiplexed streams */
1421#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100)
1422enum v4l2_mpeg_audio_sampling_freq {
1423 V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0,
1424 V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1,
1425 V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2,
1426};
1427#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101)
1428enum v4l2_mpeg_audio_encoding {
1429 V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0,
1430 V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1,
1431 V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2,
1432 V4L2_MPEG_AUDIO_ENCODING_AAC = 3,
1433 V4L2_MPEG_AUDIO_ENCODING_AC3 = 4,
1434};
1435#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102)
1436enum v4l2_mpeg_audio_l1_bitrate {
1437 V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0,
1438 V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1,
1439 V4L2_MPEG_AUDIO_L1_BITRATE_96K = 2,
1440 V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3,
1441 V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4,
1442 V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5,
1443 V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6,
1444 V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7,
1445 V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8,
1446 V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9,
1447 V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10,
1448 V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11,
1449 V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12,
1450 V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13,
1451};
1452#define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103)
1453enum v4l2_mpeg_audio_l2_bitrate {
1454 V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0,
1455 V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1,
1456 V4L2_MPEG_AUDIO_L2_BITRATE_56K = 2,
1457 V4L2_MPEG_AUDIO_L2_BITRATE_64K = 3,
1458 V4L2_MPEG_AUDIO_L2_BITRATE_80K = 4,
1459 V4L2_MPEG_AUDIO_L2_BITRATE_96K = 5,
1460 V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6,
1461 V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7,
1462 V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8,
1463 V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9,
1464 V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10,
1465 V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11,
1466 V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12,
1467 V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13,
1468};
1469#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104)
1470enum v4l2_mpeg_audio_l3_bitrate {
1471 V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0,
1472 V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1,
1473 V4L2_MPEG_AUDIO_L3_BITRATE_48K = 2,
1474 V4L2_MPEG_AUDIO_L3_BITRATE_56K = 3,
1475 V4L2_MPEG_AUDIO_L3_BITRATE_64K = 4,
1476 V4L2_MPEG_AUDIO_L3_BITRATE_80K = 5,
1477 V4L2_MPEG_AUDIO_L3_BITRATE_96K = 6,
1478 V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7,
1479 V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8,
1480 V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9,
1481 V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10,
1482 V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11,
1483 V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12,
1484 V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13,
1485};
1486#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105)
1487enum v4l2_mpeg_audio_mode {
1488 V4L2_MPEG_AUDIO_MODE_STEREO = 0,
1489 V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1,
1490 V4L2_MPEG_AUDIO_MODE_DUAL = 2,
1491 V4L2_MPEG_AUDIO_MODE_MONO = 3,
1492};
1493#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106)
1494enum v4l2_mpeg_audio_mode_extension {
1495 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0,
1496 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1,
1497 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2,
1498 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3,
1499};
1500#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107)
1501enum v4l2_mpeg_audio_emphasis {
1502 V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0,
1503 V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1,
1504 V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2,
1505};
1506#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108)
1507enum v4l2_mpeg_audio_crc {
1508 V4L2_MPEG_AUDIO_CRC_NONE = 0,
1509 V4L2_MPEG_AUDIO_CRC_CRC16 = 1,
1510};
1511#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109)
1512#define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110)
1513#define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111)
1514enum v4l2_mpeg_audio_ac3_bitrate {
1515 V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0,
1516 V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1,
1517 V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2,
1518 V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3,
1519 V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4,
1520 V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5,
1521 V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6,
1522 V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7,
1523 V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8,
1524 V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9,
1525 V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10,
1526 V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11,
1527 V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12,
1528 V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13,
1529 V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14,
1530 V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15,
1531 V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16,
1532 V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17,
1533 V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18,
1534};
1535#define V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK (V4L2_CID_MPEG_BASE+112)
1536enum v4l2_mpeg_audio_dec_playback {
1537 V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO = 0,
1538 V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO = 1,
1539 V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT = 2,
1540 V4L2_MPEG_AUDIO_DEC_PLAYBACK_RIGHT = 3,
1541 V4L2_MPEG_AUDIO_DEC_PLAYBACK_MONO = 4,
1542 V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO = 5,
1543};
1544#define V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK (V4L2_CID_MPEG_BASE+113)
1545
1546/* MPEG video controls specific to multiplexed streams */
1547#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
1548enum v4l2_mpeg_video_encoding {
1549 V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0,
1550 V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1,
1551 V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2,
1552};
1553#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201)
1554enum v4l2_mpeg_video_aspect {
1555 V4L2_MPEG_VIDEO_ASPECT_1x1 = 0,
1556 V4L2_MPEG_VIDEO_ASPECT_4x3 = 1,
1557 V4L2_MPEG_VIDEO_ASPECT_16x9 = 2,
1558 V4L2_MPEG_VIDEO_ASPECT_221x100 = 3,
1559};
1560#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202)
1561#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203)
1562#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204)
1563#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205)
1564#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206)
1565enum v4l2_mpeg_video_bitrate_mode {
1566 V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0,
1567 V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1,
1568};
1569#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207)
1570#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208)
1571#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209)
1572#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210)
1573#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211)
1574#define V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE (V4L2_CID_MPEG_BASE+212)
1575#define V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER (V4L2_CID_MPEG_BASE+213)
1576#define V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB (V4L2_CID_MPEG_BASE+214)
1577#define V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE (V4L2_CID_MPEG_BASE+215)
1578#define V4L2_CID_MPEG_VIDEO_HEADER_MODE (V4L2_CID_MPEG_BASE+216)
1579enum v4l2_mpeg_video_header_mode {
1580 V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE = 0,
1581 V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME = 1,
1582
1583};
1584#define V4L2_CID_MPEG_VIDEO_MAX_REF_PIC (V4L2_CID_MPEG_BASE+217)
1585#define V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE (V4L2_CID_MPEG_BASE+218)
1586#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES (V4L2_CID_MPEG_BASE+219)
1587#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB (V4L2_CID_MPEG_BASE+220)
1588#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE (V4L2_CID_MPEG_BASE+221)
1589enum v4l2_mpeg_video_multi_slice_mode {
1590 V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE = 0,
1591 V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB = 1,
1592 V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2,
1593};
1594#define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222)
1595#define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_MPEG_BASE+223)
1596#define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224)
1597
1598#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300)
1599#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301)
1600#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302)
1601#define V4L2_CID_MPEG_VIDEO_H263_MIN_QP (V4L2_CID_MPEG_BASE+303)
1602#define V4L2_CID_MPEG_VIDEO_H263_MAX_QP (V4L2_CID_MPEG_BASE+304)
1603#define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP (V4L2_CID_MPEG_BASE+350)
1604#define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP (V4L2_CID_MPEG_BASE+351)
1605#define V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP (V4L2_CID_MPEG_BASE+352)
1606#define V4L2_CID_MPEG_VIDEO_H264_MIN_QP (V4L2_CID_MPEG_BASE+353)
1607#define V4L2_CID_MPEG_VIDEO_H264_MAX_QP (V4L2_CID_MPEG_BASE+354)
1608#define V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM (V4L2_CID_MPEG_BASE+355)
1609#define V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE (V4L2_CID_MPEG_BASE+356)
1610#define V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE (V4L2_CID_MPEG_BASE+357)
1611enum v4l2_mpeg_video_h264_entropy_mode {
1612 V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC = 0,
1613 V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC = 1,
1614};
1615#define V4L2_CID_MPEG_VIDEO_H264_I_PERIOD (V4L2_CID_MPEG_BASE+358)
1616#define V4L2_CID_MPEG_VIDEO_H264_LEVEL (V4L2_CID_MPEG_BASE+359)
1617enum v4l2_mpeg_video_h264_level {
1618 V4L2_MPEG_VIDEO_H264_LEVEL_1_0 = 0,
1619 V4L2_MPEG_VIDEO_H264_LEVEL_1B = 1,
1620 V4L2_MPEG_VIDEO_H264_LEVEL_1_1 = 2,
1621 V4L2_MPEG_VIDEO_H264_LEVEL_1_2 = 3,
1622 V4L2_MPEG_VIDEO_H264_LEVEL_1_3 = 4,
1623 V4L2_MPEG_VIDEO_H264_LEVEL_2_0 = 5,
1624 V4L2_MPEG_VIDEO_H264_LEVEL_2_1 = 6,
1625 V4L2_MPEG_VIDEO_H264_LEVEL_2_2 = 7,
1626 V4L2_MPEG_VIDEO_H264_LEVEL_3_0 = 8,
1627 V4L2_MPEG_VIDEO_H264_LEVEL_3_1 = 9,
1628 V4L2_MPEG_VIDEO_H264_LEVEL_3_2 = 10,
1629 V4L2_MPEG_VIDEO_H264_LEVEL_4_0 = 11,
1630 V4L2_MPEG_VIDEO_H264_LEVEL_4_1 = 12,
1631 V4L2_MPEG_VIDEO_H264_LEVEL_4_2 = 13,
1632 V4L2_MPEG_VIDEO_H264_LEVEL_5_0 = 14,
1633 V4L2_MPEG_VIDEO_H264_LEVEL_5_1 = 15,
1634};
1635#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA (V4L2_CID_MPEG_BASE+360)
1636#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA (V4L2_CID_MPEG_BASE+361)
1637#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE (V4L2_CID_MPEG_BASE+362)
1638enum v4l2_mpeg_video_h264_loop_filter_mode {
1639 V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED = 0,
1640 V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED = 1,
1641 V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY = 2,
1642};
1643#define V4L2_CID_MPEG_VIDEO_H264_PROFILE (V4L2_CID_MPEG_BASE+363)
1644enum v4l2_mpeg_video_h264_profile {
1645 V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE = 0,
1646 V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE = 1,
1647 V4L2_MPEG_VIDEO_H264_PROFILE_MAIN = 2,
1648 V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED = 3,
1649 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH = 4,
1650 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10 = 5,
1651 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422 = 6,
1652 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_PREDICTIVE = 7,
1653 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10_INTRA = 8,
1654 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422_INTRA = 9,
1655 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_INTRA = 10,
1656 V4L2_MPEG_VIDEO_H264_PROFILE_CAVLC_444_INTRA = 11,
1657 V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_BASELINE = 12,
1658 V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH = 13,
1659 V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH_INTRA = 14,
1660 V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH = 15,
1661 V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH = 16,
1662};
1663#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT (V4L2_CID_MPEG_BASE+364)
1664#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH (V4L2_CID_MPEG_BASE+365)
1665#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE (V4L2_CID_MPEG_BASE+366)
1666#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC (V4L2_CID_MPEG_BASE+367)
1667enum v4l2_mpeg_video_h264_vui_sar_idc {
1668 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED = 0,
1669 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_1x1 = 1,
1670 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_12x11 = 2,
1671 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_10x11 = 3,
1672 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_16x11 = 4,
1673 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_40x33 = 5,
1674 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_24x11 = 6,
1675 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_20x11 = 7,
1676 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_32x11 = 8,
1677 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_80x33 = 9,
1678 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_18x11 = 10,
1679 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_15x11 = 11,
1680 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_64x33 = 12,
1681 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_160x99 = 13,
1682 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_4x3 = 14,
1683 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_3x2 = 15,
1684 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_2x1 = 16,
1685 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED = 17,
1686};
1687#define V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP (V4L2_CID_MPEG_BASE+400)
1688#define V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP (V4L2_CID_MPEG_BASE+401)
1689#define V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP (V4L2_CID_MPEG_BASE+402)
1690#define V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP (V4L2_CID_MPEG_BASE+403)
1691#define V4L2_CID_MPEG_VIDEO_MPEG4_MAX_QP (V4L2_CID_MPEG_BASE+404)
1692#define V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL (V4L2_CID_MPEG_BASE+405)
1693enum v4l2_mpeg_video_mpeg4_level {
1694 V4L2_MPEG_VIDEO_MPEG4_LEVEL_0 = 0,
1695 V4L2_MPEG_VIDEO_MPEG4_LEVEL_0B = 1,
1696 V4L2_MPEG_VIDEO_MPEG4_LEVEL_1 = 2,
1697 V4L2_MPEG_VIDEO_MPEG4_LEVEL_2 = 3,
1698 V4L2_MPEG_VIDEO_MPEG4_LEVEL_3 = 4,
1699 V4L2_MPEG_VIDEO_MPEG4_LEVEL_3B = 5,
1700 V4L2_MPEG_VIDEO_MPEG4_LEVEL_4 = 6,
1701 V4L2_MPEG_VIDEO_MPEG4_LEVEL_5 = 7,
1702};
1703#define V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE (V4L2_CID_MPEG_BASE+406)
1704enum v4l2_mpeg_video_mpeg4_profile {
1705 V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE = 0,
1706 V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE = 1,
1707 V4L2_MPEG_VIDEO_MPEG4_PROFILE_CORE = 2,
1708 V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE_SCALABLE = 3,
1709 V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY = 4,
1710};
1711#define V4L2_CID_MPEG_VIDEO_MPEG4_QPEL (V4L2_CID_MPEG_BASE+407)
1712
1713/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
1714#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)
1715#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0)
1716enum v4l2_mpeg_cx2341x_video_spatial_filter_mode {
1717 V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0,
1718 V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1,
1719};
1720#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1)
1721#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2)
1722enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type {
1723 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0,
1724 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
1725 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2,
1726 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3,
1727 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4,
1728};
1729#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3)
1730enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type {
1731 V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0,
1732 V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
1733};
1734#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4)
1735enum v4l2_mpeg_cx2341x_video_temporal_filter_mode {
1736 V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0,
1737 V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1,
1738};
1739#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5)
1740#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6)
1741enum v4l2_mpeg_cx2341x_video_median_filter_type {
1742 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0,
1743 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1,
1744 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT = 2,
1745 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3,
1746 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4,
1747};
1748#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7)
1749#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8)
1750#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9)
1751#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10)
1752#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11)
1753
1754/* MPEG-class control IDs specific to the Samsung MFC 5.1 driver as defined by V4L2 */
1755#define V4L2_CID_MPEG_MFC51_BASE (V4L2_CTRL_CLASS_MPEG | 0x1100)
1756
1757#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY (V4L2_CID_MPEG_MFC51_BASE+0)
1758#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE (V4L2_CID_MPEG_MFC51_BASE+1)
1759#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE (V4L2_CID_MPEG_MFC51_BASE+2)
1760enum v4l2_mpeg_mfc51_video_frame_skip_mode {
1761 V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_DISABLED = 0,
1762 V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_LEVEL_LIMIT = 1,
1763 V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT = 2,
1764};
1765#define V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE (V4L2_CID_MPEG_MFC51_BASE+3)
1766enum v4l2_mpeg_mfc51_video_force_frame_type {
1767 V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_DISABLED = 0,
1768 V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_I_FRAME = 1,
1769 V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_NOT_CODED = 2,
1770};
1771#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING (V4L2_CID_MPEG_MFC51_BASE+4)
1772#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING_YUV (V4L2_CID_MPEG_MFC51_BASE+5)
1773#define V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT (V4L2_CID_MPEG_MFC51_BASE+6)
1774#define V4L2_CID_MPEG_MFC51_VIDEO_RC_REACTION_COEFF (V4L2_CID_MPEG_MFC51_BASE+7)
1775#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_ACTIVITY (V4L2_CID_MPEG_MFC51_BASE+50)
1776#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_DARK (V4L2_CID_MPEG_MFC51_BASE+51)
1777#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_SMOOTH (V4L2_CID_MPEG_MFC51_BASE+52)
1778#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_STATIC (V4L2_CID_MPEG_MFC51_BASE+53)
1779#define V4L2_CID_MPEG_MFC51_VIDEO_H264_NUM_REF_PIC_FOR_P (V4L2_CID_MPEG_MFC51_BASE+54)
1780
1781/* Camera class control IDs */
1782#define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900)
1783#define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1)
1784
1785#define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1)
1786enum v4l2_exposure_auto_type {
1787 V4L2_EXPOSURE_AUTO = 0,
1788 V4L2_EXPOSURE_MANUAL = 1,
1789 V4L2_EXPOSURE_SHUTTER_PRIORITY = 2,
1790 V4L2_EXPOSURE_APERTURE_PRIORITY = 3
1791};
1792#define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2)
1793#define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3)
1794
1795#define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4)
1796#define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5)
1797#define V4L2_CID_PAN_RESET (V4L2_CID_CAMERA_CLASS_BASE+6)
1798#define V4L2_CID_TILT_RESET (V4L2_CID_CAMERA_CLASS_BASE+7)
1799
1800#define V4L2_CID_PAN_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+8)
1801#define V4L2_CID_TILT_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+9)
1802
1803#define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10)
1804#define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11)
1805#define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12)
1806
1807#define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13)
1808#define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14)
1809#define V4L2_CID_ZOOM_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE+15)
1810
1811#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16)
1812
1813#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17)
1814#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18)
1815
1816#define V4L2_CID_AUTO_EXPOSURE_BIAS (V4L2_CID_CAMERA_CLASS_BASE+19)
1817
1818#define V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE (V4L2_CID_CAMERA_CLASS_BASE+20)
1819enum v4l2_auto_n_preset_white_balance {
1820 V4L2_WHITE_BALANCE_MANUAL = 0,
1821 V4L2_WHITE_BALANCE_AUTO = 1,
1822 V4L2_WHITE_BALANCE_INCANDESCENT = 2,
1823 V4L2_WHITE_BALANCE_FLUORESCENT = 3,
1824 V4L2_WHITE_BALANCE_FLUORESCENT_H = 4,
1825 V4L2_WHITE_BALANCE_HORIZON = 5,
1826 V4L2_WHITE_BALANCE_DAYLIGHT = 6,
1827 V4L2_WHITE_BALANCE_FLASH = 7,
1828 V4L2_WHITE_BALANCE_CLOUDY = 8,
1829 V4L2_WHITE_BALANCE_SHADE = 9,
1830};
1831
1832#define V4L2_CID_WIDE_DYNAMIC_RANGE (V4L2_CID_CAMERA_CLASS_BASE+21)
1833#define V4L2_CID_IMAGE_STABILIZATION (V4L2_CID_CAMERA_CLASS_BASE+22)
1834
1835#define V4L2_CID_ISO_SENSITIVITY (V4L2_CID_CAMERA_CLASS_BASE+23)
1836#define V4L2_CID_ISO_SENSITIVITY_AUTO (V4L2_CID_CAMERA_CLASS_BASE+24)
1837enum v4l2_iso_sensitivity_auto_type {
1838 V4L2_ISO_SENSITIVITY_MANUAL = 0,
1839 V4L2_ISO_SENSITIVITY_AUTO = 1,
1840};
1841
1842#define V4L2_CID_EXPOSURE_METERING (V4L2_CID_CAMERA_CLASS_BASE+25)
1843enum v4l2_exposure_metering {
1844 V4L2_EXPOSURE_METERING_AVERAGE = 0,
1845 V4L2_EXPOSURE_METERING_CENTER_WEIGHTED = 1,
1846 V4L2_EXPOSURE_METERING_SPOT = 2,
1847};
1848
1849#define V4L2_CID_SCENE_MODE (V4L2_CID_CAMERA_CLASS_BASE+26)
1850enum v4l2_scene_mode {
1851 V4L2_SCENE_MODE_NONE = 0,
1852 V4L2_SCENE_MODE_BACKLIGHT = 1,
1853 V4L2_SCENE_MODE_BEACH_SNOW = 2,
1854 V4L2_SCENE_MODE_CANDLE_LIGHT = 3,
1855 V4L2_SCENE_MODE_DAWN_DUSK = 4,
1856 V4L2_SCENE_MODE_FALL_COLORS = 5,
1857 V4L2_SCENE_MODE_FIREWORKS = 6,
1858 V4L2_SCENE_MODE_LANDSCAPE = 7,
1859 V4L2_SCENE_MODE_NIGHT = 8,
1860 V4L2_SCENE_MODE_PARTY_INDOOR = 9,
1861 V4L2_SCENE_MODE_PORTRAIT = 10,
1862 V4L2_SCENE_MODE_SPORTS = 11,
1863 V4L2_SCENE_MODE_SUNSET = 12,
1864 V4L2_SCENE_MODE_TEXT = 13,
1865};
1866
1867#define V4L2_CID_3A_LOCK (V4L2_CID_CAMERA_CLASS_BASE+27)
1868#define V4L2_LOCK_EXPOSURE (1 << 0)
1869#define V4L2_LOCK_WHITE_BALANCE (1 << 1)
1870#define V4L2_LOCK_FOCUS (1 << 2)
1871
1872#define V4L2_CID_AUTO_FOCUS_START (V4L2_CID_CAMERA_CLASS_BASE+28)
1873#define V4L2_CID_AUTO_FOCUS_STOP (V4L2_CID_CAMERA_CLASS_BASE+29)
1874#define V4L2_CID_AUTO_FOCUS_STATUS (V4L2_CID_CAMERA_CLASS_BASE+30)
1875#define V4L2_AUTO_FOCUS_STATUS_IDLE (0 << 0)
1876#define V4L2_AUTO_FOCUS_STATUS_BUSY (1 << 0)
1877#define V4L2_AUTO_FOCUS_STATUS_REACHED (1 << 1)
1878#define V4L2_AUTO_FOCUS_STATUS_FAILED (1 << 2)
1879
1880#define V4L2_CID_AUTO_FOCUS_RANGE (V4L2_CID_CAMERA_CLASS_BASE+31)
1881enum v4l2_auto_focus_range {
1882 V4L2_AUTO_FOCUS_RANGE_AUTO = 0,
1883 V4L2_AUTO_FOCUS_RANGE_NORMAL = 1,
1884 V4L2_AUTO_FOCUS_RANGE_MACRO = 2,
1885 V4L2_AUTO_FOCUS_RANGE_INFINITY = 3,
1886};
1887
1888/* FM Modulator class control IDs */
1889#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)
1890#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
1891
1892#define V4L2_CID_RDS_TX_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 1)
1893#define V4L2_CID_RDS_TX_PI (V4L2_CID_FM_TX_CLASS_BASE + 2)
1894#define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3)
1895#define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5)
1896#define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6)
1897
1898#define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64)
1899#define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 65)
1900#define V4L2_CID_AUDIO_LIMITER_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 66)
1901
1902#define V4L2_CID_AUDIO_COMPRESSION_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 80)
1903#define V4L2_CID_AUDIO_COMPRESSION_GAIN (V4L2_CID_FM_TX_CLASS_BASE + 81)
1904#define V4L2_CID_AUDIO_COMPRESSION_THRESHOLD (V4L2_CID_FM_TX_CLASS_BASE + 82)
1905#define V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME (V4L2_CID_FM_TX_CLASS_BASE + 83)
1906#define V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 84)
1907
1908#define V4L2_CID_PILOT_TONE_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 96)
1909#define V4L2_CID_PILOT_TONE_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 97)
1910#define V4L2_CID_PILOT_TONE_FREQUENCY (V4L2_CID_FM_TX_CLASS_BASE + 98)
1911
1912#define V4L2_CID_TUNE_PREEMPHASIS (V4L2_CID_FM_TX_CLASS_BASE + 112)
1913enum v4l2_preemphasis {
1914 V4L2_PREEMPHASIS_DISABLED = 0,
1915 V4L2_PREEMPHASIS_50_uS = 1,
1916 V4L2_PREEMPHASIS_75_uS = 2,
1917};
1918#define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113)
1919#define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114)
1920
1921/* Flash and privacy (indicator) light controls */
1922#define V4L2_CID_FLASH_CLASS_BASE (V4L2_CTRL_CLASS_FLASH | 0x900)
1923#define V4L2_CID_FLASH_CLASS (V4L2_CTRL_CLASS_FLASH | 1)
1924
1925#define V4L2_CID_FLASH_LED_MODE (V4L2_CID_FLASH_CLASS_BASE + 1)
1926enum v4l2_flash_led_mode {
1927 V4L2_FLASH_LED_MODE_NONE,
1928 V4L2_FLASH_LED_MODE_FLASH,
1929 V4L2_FLASH_LED_MODE_TORCH,
1930};
1931
1932#define V4L2_CID_FLASH_STROBE_SOURCE (V4L2_CID_FLASH_CLASS_BASE + 2)
1933enum v4l2_flash_strobe_source {
1934 V4L2_FLASH_STROBE_SOURCE_SOFTWARE,
1935 V4L2_FLASH_STROBE_SOURCE_EXTERNAL,
1936};
1937
1938#define V4L2_CID_FLASH_STROBE (V4L2_CID_FLASH_CLASS_BASE + 3)
1939#define V4L2_CID_FLASH_STROBE_STOP (V4L2_CID_FLASH_CLASS_BASE + 4)
1940#define V4L2_CID_FLASH_STROBE_STATUS (V4L2_CID_FLASH_CLASS_BASE + 5)
1941
1942#define V4L2_CID_FLASH_TIMEOUT (V4L2_CID_FLASH_CLASS_BASE + 6)
1943#define V4L2_CID_FLASH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 7)
1944#define V4L2_CID_FLASH_TORCH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 8)
1945#define V4L2_CID_FLASH_INDICATOR_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 9)
1946
1947#define V4L2_CID_FLASH_FAULT (V4L2_CID_FLASH_CLASS_BASE + 10)
1948#define V4L2_FLASH_FAULT_OVER_VOLTAGE (1 << 0)
1949#define V4L2_FLASH_FAULT_TIMEOUT (1 << 1)
1950#define V4L2_FLASH_FAULT_OVER_TEMPERATURE (1 << 2)
1951#define V4L2_FLASH_FAULT_SHORT_CIRCUIT (1 << 3)
1952#define V4L2_FLASH_FAULT_OVER_CURRENT (1 << 4)
1953#define V4L2_FLASH_FAULT_INDICATOR (1 << 5)
1954
1955#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11)
1956#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12)
1957
1958/* JPEG-class control IDs defined by V4L2 */
1959#define V4L2_CID_JPEG_CLASS_BASE (V4L2_CTRL_CLASS_JPEG | 0x900)
1960#define V4L2_CID_JPEG_CLASS (V4L2_CTRL_CLASS_JPEG | 1)
1961
1962#define V4L2_CID_JPEG_CHROMA_SUBSAMPLING (V4L2_CID_JPEG_CLASS_BASE + 1)
1963enum v4l2_jpeg_chroma_subsampling {
1964 V4L2_JPEG_CHROMA_SUBSAMPLING_444 = 0,
1965 V4L2_JPEG_CHROMA_SUBSAMPLING_422 = 1,
1966 V4L2_JPEG_CHROMA_SUBSAMPLING_420 = 2,
1967 V4L2_JPEG_CHROMA_SUBSAMPLING_411 = 3,
1968 V4L2_JPEG_CHROMA_SUBSAMPLING_410 = 4,
1969 V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY = 5,
1970};
1971#define V4L2_CID_JPEG_RESTART_INTERVAL (V4L2_CID_JPEG_CLASS_BASE + 2)
1972#define V4L2_CID_JPEG_COMPRESSION_QUALITY (V4L2_CID_JPEG_CLASS_BASE + 3)
1973
1974#define V4L2_CID_JPEG_ACTIVE_MARKER (V4L2_CID_JPEG_CLASS_BASE + 4)
1975#define V4L2_JPEG_ACTIVE_MARKER_APP0 (1 << 0)
1976#define V4L2_JPEG_ACTIVE_MARKER_APP1 (1 << 1)
1977#define V4L2_JPEG_ACTIVE_MARKER_COM (1 << 16)
1978#define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17)
1979#define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18)
1980
1981/* Image source controls */
1982#define V4L2_CID_IMAGE_SOURCE_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_SOURCE | 0x900)
1983#define V4L2_CID_IMAGE_SOURCE_CLASS (V4L2_CTRL_CLASS_IMAGE_SOURCE | 1)
1984
1985#define V4L2_CID_VBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 1)
1986#define V4L2_CID_HBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 2)
1987#define V4L2_CID_ANALOGUE_GAIN (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 3)
1988
1989/* Image processing controls */
1990#define V4L2_CID_IMAGE_PROC_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_PROC | 0x900)
1991#define V4L2_CID_IMAGE_PROC_CLASS (V4L2_CTRL_CLASS_IMAGE_PROC | 1)
1992
1993#define V4L2_CID_LINK_FREQ (V4L2_CID_IMAGE_PROC_CLASS_BASE + 1)
1994#define V4L2_CID_PIXEL_RATE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 2)
1995
1996/*
1997 * T U N I N G
1998 */
1999struct v4l2_tuner {
2000 __u32 index;
2001 __u8 name[32];
2002 __u32 type; /* enum v4l2_tuner_type */
2003 __u32 capability;
2004 __u32 rangelow;
2005 __u32 rangehigh;
2006 __u32 rxsubchans;
2007 __u32 audmode;
2008 __s32 signal;
2009 __s32 afc;
2010 __u32 reserved[4];
2011};
2012
2013struct v4l2_modulator {
2014 __u32 index;
2015 __u8 name[32];
2016 __u32 capability;
2017 __u32 rangelow;
2018 __u32 rangehigh;
2019 __u32 txsubchans;
2020 __u32 reserved[4];
2021};
2022
2023/* Flags for the 'capability' field */
2024#define V4L2_TUNER_CAP_LOW 0x0001
2025#define V4L2_TUNER_CAP_NORM 0x0002
2026#define V4L2_TUNER_CAP_HWSEEK_BOUNDED 0x0004
2027#define V4L2_TUNER_CAP_HWSEEK_WRAP 0x0008
2028#define V4L2_TUNER_CAP_STEREO 0x0010
2029#define V4L2_TUNER_CAP_LANG2 0x0020
2030#define V4L2_TUNER_CAP_SAP 0x0020
2031#define V4L2_TUNER_CAP_LANG1 0x0040
2032#define V4L2_TUNER_CAP_RDS 0x0080
2033#define V4L2_TUNER_CAP_RDS_BLOCK_IO 0x0100
2034#define V4L2_TUNER_CAP_RDS_CONTROLS 0x0200
2035#define V4L2_TUNER_CAP_FREQ_BANDS 0x0400
2036#define V4L2_TUNER_CAP_HWSEEK_PROG_LIM 0x0800
2037
2038/* Flags for the 'rxsubchans' field */
2039#define V4L2_TUNER_SUB_MONO 0x0001
2040#define V4L2_TUNER_SUB_STEREO 0x0002
2041#define V4L2_TUNER_SUB_LANG2 0x0004
2042#define V4L2_TUNER_SUB_SAP 0x0004
2043#define V4L2_TUNER_SUB_LANG1 0x0008
2044#define V4L2_TUNER_SUB_RDS 0x0010
2045
2046/* Values for the 'audmode' field */
2047#define V4L2_TUNER_MODE_MONO 0x0000
2048#define V4L2_TUNER_MODE_STEREO 0x0001
2049#define V4L2_TUNER_MODE_LANG2 0x0002
2050#define V4L2_TUNER_MODE_SAP 0x0002
2051#define V4L2_TUNER_MODE_LANG1 0x0003
2052#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004
2053
2054struct v4l2_frequency {
2055 __u32 tuner;
2056 __u32 type; /* enum v4l2_tuner_type */
2057 __u32 frequency;
2058 __u32 reserved[8];
2059};
2060
2061#define V4L2_BAND_MODULATION_VSB (1 << 1)
2062#define V4L2_BAND_MODULATION_FM (1 << 2)
2063#define V4L2_BAND_MODULATION_AM (1 << 3)
2064
2065struct v4l2_frequency_band {
2066 __u32 tuner;
2067 __u32 type; /* enum v4l2_tuner_type */
2068 __u32 index;
2069 __u32 capability;
2070 __u32 rangelow;
2071 __u32 rangehigh;
2072 __u32 modulation;
2073 __u32 reserved[9];
2074};
2075
2076struct v4l2_hw_freq_seek {
2077 __u32 tuner;
2078 __u32 type; /* enum v4l2_tuner_type */
2079 __u32 seek_upward;
2080 __u32 wrap_around;
2081 __u32 spacing;
2082 __u32 rangelow;
2083 __u32 rangehigh;
2084 __u32 reserved[5];
2085};
2086
2087/*
2088 * R D S
2089 */
2090
2091struct v4l2_rds_data {
2092 __u8 lsb;
2093 __u8 msb;
2094 __u8 block;
2095} __attribute__ ((packed));
2096
2097#define V4L2_RDS_BLOCK_MSK 0x7
2098#define V4L2_RDS_BLOCK_A 0
2099#define V4L2_RDS_BLOCK_B 1
2100#define V4L2_RDS_BLOCK_C 2
2101#define V4L2_RDS_BLOCK_D 3
2102#define V4L2_RDS_BLOCK_C_ALT 4
2103#define V4L2_RDS_BLOCK_INVALID 7
2104
2105#define V4L2_RDS_BLOCK_CORRECTED 0x40
2106#define V4L2_RDS_BLOCK_ERROR 0x80
2107
2108/*
2109 * A U D I O
2110 */
2111struct v4l2_audio {
2112 __u32 index;
2113 __u8 name[32];
2114 __u32 capability;
2115 __u32 mode;
2116 __u32 reserved[2];
2117};
2118
2119/* Flags for the 'capability' field */
2120#define V4L2_AUDCAP_STEREO 0x00001
2121#define V4L2_AUDCAP_AVL 0x00002
2122
2123/* Flags for the 'mode' field */
2124#define V4L2_AUDMODE_AVL 0x00001
2125
2126struct v4l2_audioout {
2127 __u32 index;
2128 __u8 name[32];
2129 __u32 capability;
2130 __u32 mode;
2131 __u32 reserved[2];
2132};
2133
2134/*
2135 * M P E G S E R V I C E S
2136 *
2137 * NOTE: EXPERIMENTAL API
2138 */
2139#if 1
2140#define V4L2_ENC_IDX_FRAME_I (0)
2141#define V4L2_ENC_IDX_FRAME_P (1)
2142#define V4L2_ENC_IDX_FRAME_B (2)
2143#define V4L2_ENC_IDX_FRAME_MASK (0xf)
2144
2145struct v4l2_enc_idx_entry {
2146 __u64 offset;
2147 __u64 pts;
2148 __u32 length;
2149 __u32 flags;
2150 __u32 reserved[2];
2151};
2152
2153#define V4L2_ENC_IDX_ENTRIES (64)
2154struct v4l2_enc_idx {
2155 __u32 entries;
2156 __u32 entries_cap;
2157 __u32 reserved[4];
2158 struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES];
2159};
2160
2161
2162#define V4L2_ENC_CMD_START (0)
2163#define V4L2_ENC_CMD_STOP (1)
2164#define V4L2_ENC_CMD_PAUSE (2)
2165#define V4L2_ENC_CMD_RESUME (3)
2166
2167/* Flags for V4L2_ENC_CMD_STOP */
2168#define V4L2_ENC_CMD_STOP_AT_GOP_END (1 << 0)
2169
2170struct v4l2_encoder_cmd {
2171 __u32 cmd;
2172 __u32 flags;
2173 union {
2174 struct {
2175 __u32 data[8];
2176 } raw;
2177 };
2178};
2179
2180/* Decoder commands */
2181#define V4L2_DEC_CMD_START (0)
2182#define V4L2_DEC_CMD_STOP (1)
2183#define V4L2_DEC_CMD_PAUSE (2)
2184#define V4L2_DEC_CMD_RESUME (3)
2185
2186/* Flags for V4L2_DEC_CMD_START */
2187#define V4L2_DEC_CMD_START_MUTE_AUDIO (1 << 0)
2188
2189/* Flags for V4L2_DEC_CMD_PAUSE */
2190#define V4L2_DEC_CMD_PAUSE_TO_BLACK (1 << 0)
2191
2192/* Flags for V4L2_DEC_CMD_STOP */
2193#define V4L2_DEC_CMD_STOP_TO_BLACK (1 << 0)
2194#define V4L2_DEC_CMD_STOP_IMMEDIATELY (1 << 1)
2195
2196/* Play format requirements (returned by the driver): */
2197
2198/* The decoder has no special format requirements */
2199#define V4L2_DEC_START_FMT_NONE (0)
2200/* The decoder requires full GOPs */
2201#define V4L2_DEC_START_FMT_GOP (1)
2202
2203/* The structure must be zeroed before use by the application
2204 This ensures it can be extended safely in the future. */
2205struct v4l2_decoder_cmd {
2206 __u32 cmd;
2207 __u32 flags;
2208 union {
2209 struct {
2210 __u64 pts;
2211 } stop;
2212
2213 struct {
2214 /* 0 or 1000 specifies normal speed,
2215 1 specifies forward single stepping,
2216 -1 specifies backward single stepping,
2217 >1: playback at speed/1000 of the normal speed,
2218 <-1: reverse playback at (-speed/1000) of the normal speed. */
2219 __s32 speed;
2220 __u32 format;
2221 } start;
2222
2223 struct {
2224 __u32 data[16];
2225 } raw;
2226 };
2227};
2228#endif
2229
2230
2231/*
2232 * D A T A S E R V I C E S ( V B I )
2233 *
2234 * Data services API by Michael Schimek
2235 */
2236
2237/* Raw VBI */
2238struct v4l2_vbi_format {
2239 __u32 sampling_rate; /* in 1 Hz */
2240 __u32 offset;
2241 __u32 samples_per_line;
2242 __u32 sample_format; /* V4L2_PIX_FMT_* */
2243 __s32 start[2];
2244 __u32 count[2];
2245 __u32 flags; /* V4L2_VBI_* */
2246 __u32 reserved[2]; /* must be zero */
2247};
2248
2249/* VBI flags */
2250#define V4L2_VBI_UNSYNC (1 << 0)
2251#define V4L2_VBI_INTERLACED (1 << 1)
2252
2253/* Sliced VBI
2254 *
2255 * This implements is a proposal V4L2 API to allow SLICED VBI
2256 * required for some hardware encoders. It should change without
2257 * notice in the definitive implementation.
2258 */
2259
2260struct v4l2_sliced_vbi_format {
2261 __u16 service_set;
2262 /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
2263 service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
2264 (equals frame lines 313-336 for 625 line video
2265 standards, 263-286 for 525 line standards) */
2266 __u16 service_lines[2][24];
2267 __u32 io_size;
2268 __u32 reserved[2]; /* must be zero */
2269};
2270
2271/* Teletext World System Teletext
2272 (WST), defined on ITU-R BT.653-2 */
2273#define V4L2_SLICED_TELETEXT_B (0x0001)
2274/* Video Program System, defined on ETS 300 231*/
2275#define V4L2_SLICED_VPS (0x0400)
2276/* Closed Caption, defined on EIA-608 */
2277#define V4L2_SLICED_CAPTION_525 (0x1000)
2278/* Wide Screen System, defined on ITU-R BT1119.1 */
2279#define V4L2_SLICED_WSS_625 (0x4000)
2280
2281#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525)
2282#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625)
2283
2284struct v4l2_sliced_vbi_cap {
2285 __u16 service_set;
2286 /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
2287 service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
2288 (equals frame lines 313-336 for 625 line video
2289 standards, 263-286 for 525 line standards) */
2290 __u16 service_lines[2][24];
2291 __u32 type; /* enum v4l2_buf_type */
2292 __u32 reserved[3]; /* must be 0 */
2293};
2294
2295struct v4l2_sliced_vbi_data {
2296 __u32 id;
2297 __u32 field; /* 0: first field, 1: second field */
2298 __u32 line; /* 1-23 */
2299 __u32 reserved; /* must be 0 */
2300 __u8 data[48];
2301};
2302
2303/*
2304 * Sliced VBI data inserted into MPEG Streams
2305 */
2306
2307/*
2308 * V4L2_MPEG_STREAM_VBI_FMT_IVTV:
2309 *
2310 * Structure of payload contained in an MPEG 2 Private Stream 1 PES Packet in an
2311 * MPEG-2 Program Pack that contains V4L2_MPEG_STREAM_VBI_FMT_IVTV Sliced VBI
2312 * data
2313 *
2314 * Note, the MPEG-2 Program Pack and Private Stream 1 PES packet header
2315 * definitions are not included here. See the MPEG-2 specifications for details
2316 * on these headers.
2317 */
2318
2319/* Line type IDs */
2320#define V4L2_MPEG_VBI_IVTV_TELETEXT_B (1)
2321#define V4L2_MPEG_VBI_IVTV_CAPTION_525 (4)
2322#define V4L2_MPEG_VBI_IVTV_WSS_625 (5)
2323#define V4L2_MPEG_VBI_IVTV_VPS (7)
2324
2325struct v4l2_mpeg_vbi_itv0_line {
2326 __u8 id; /* One of V4L2_MPEG_VBI_IVTV_* above */
2327 __u8 data[42]; /* Sliced VBI data for the line */
2328} __attribute__ ((packed));
2329
2330struct v4l2_mpeg_vbi_itv0 {
2331 __le32 linemask[2]; /* Bitmasks of VBI service lines present */
2332 struct v4l2_mpeg_vbi_itv0_line line[35];
2333} __attribute__ ((packed));
2334
2335struct v4l2_mpeg_vbi_ITV0 {
2336 struct v4l2_mpeg_vbi_itv0_line line[36];
2337} __attribute__ ((packed));
2338
2339#define V4L2_MPEG_VBI_IVTV_MAGIC0 "itv0"
2340#define V4L2_MPEG_VBI_IVTV_MAGIC1 "ITV0"
2341
2342struct v4l2_mpeg_vbi_fmt_ivtv {
2343 __u8 magic[4];
2344 union {
2345 struct v4l2_mpeg_vbi_itv0 itv0;
2346 struct v4l2_mpeg_vbi_ITV0 ITV0;
2347 };
2348} __attribute__ ((packed));
2349
2350/*
2351 * A G G R E G A T E S T R U C T U R E S
2352 */
2353
2354/**
2355 * struct v4l2_plane_pix_format - additional, per-plane format definition
2356 * @sizeimage: maximum size in bytes required for data, for which
2357 * this plane will be used
2358 * @bytesperline: distance in bytes between the leftmost pixels in two
2359 * adjacent lines
2360 */
2361struct v4l2_plane_pix_format {
2362 __u32 sizeimage;
2363 __u16 bytesperline;
2364 __u16 reserved[7];
2365} __attribute__ ((packed));
2366
2367/**
2368 * struct v4l2_pix_format_mplane - multiplanar format definition
2369 * @width: image width in pixels
2370 * @height: image height in pixels
2371 * @pixelformat: little endian four character code (fourcc)
2372 * @field: enum v4l2_field; field order (for interlaced video)
2373 * @colorspace: enum v4l2_colorspace; supplemental to pixelformat
2374 * @plane_fmt: per-plane information
2375 * @num_planes: number of planes for this format
2376 */
2377struct v4l2_pix_format_mplane {
2378 __u32 width;
2379 __u32 height;
2380 __u32 pixelformat;
2381 __u32 field;
2382 __u32 colorspace;
2383
2384 struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES];
2385 __u8 num_planes;
2386 __u8 reserved[11];
2387} __attribute__ ((packed));
2388
2389/**
2390 * struct v4l2_format - stream data format
2391 * @type: enum v4l2_buf_type; type of the data stream
2392 * @pix: definition of an image format
2393 * @pix_mp: definition of a multiplanar image format
2394 * @win: definition of an overlaid image
2395 * @vbi: raw VBI capture or output parameters
2396 * @sliced: sliced VBI capture or output parameters
2397 * @raw_data: placeholder for future extensions and custom formats
2398 */
2399struct v4l2_format {
2400 __u32 type;
2401 union {
2402 struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
2403 struct v4l2_pix_format_mplane pix_mp; /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */
2404 struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
2405 struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */
2406 struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */
2407 __u8 raw_data[200]; /* user-defined */
2408 } fmt;
2409};
2410
2411/* Stream type-dependent parameters
2412 */
2413struct v4l2_streamparm {
2414 __u32 type; /* enum v4l2_buf_type */
2415 union {
2416 struct v4l2_captureparm capture;
2417 struct v4l2_outputparm output;
2418 __u8 raw_data[200]; /* user-defined */
2419 } parm;
2420};
2421
2422/*
2423 * E V E N T S
2424 */
2425
2426#define V4L2_EVENT_ALL 0
2427#define V4L2_EVENT_VSYNC 1
2428#define V4L2_EVENT_EOS 2
2429#define V4L2_EVENT_CTRL 3
2430#define V4L2_EVENT_FRAME_SYNC 4
2431#define V4L2_EVENT_PRIVATE_START 0x08000000
2432
2433/* Payload for V4L2_EVENT_VSYNC */
2434struct v4l2_event_vsync {
2435 /* Can be V4L2_FIELD_ANY, _NONE, _TOP or _BOTTOM */
2436 __u8 field;
2437} __attribute__ ((packed));
2438
2439/* Payload for V4L2_EVENT_CTRL */
2440#define V4L2_EVENT_CTRL_CH_VALUE (1 << 0)
2441#define V4L2_EVENT_CTRL_CH_FLAGS (1 << 1)
2442
2443struct v4l2_event_ctrl {
2444 __u32 changes;
2445 __u32 type;
2446 union {
2447 __s32 value;
2448 __s64 value64;
2449 };
2450 __u32 flags;
2451 __s32 minimum;
2452 __s32 maximum;
2453 __s32 step;
2454 __s32 default_value;
2455};
2456
2457struct v4l2_event_frame_sync {
2458 __u32 frame_sequence;
2459};
2460
2461struct v4l2_event {
2462 __u32 type;
2463 union {
2464 struct v4l2_event_vsync vsync;
2465 struct v4l2_event_ctrl ctrl;
2466 struct v4l2_event_frame_sync frame_sync;
2467 __u8 data[64];
2468 } u;
2469 __u32 pending;
2470 __u32 sequence;
2471 struct timespec timestamp;
2472 __u32 id;
2473 __u32 reserved[8];
2474};
2475
2476#define V4L2_EVENT_SUB_FL_SEND_INITIAL (1 << 0)
2477#define V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK (1 << 1)
2478
2479struct v4l2_event_subscription {
2480 __u32 type;
2481 __u32 id;
2482 __u32 flags;
2483 __u32 reserved[5];
2484};
2485
2486/*
2487 * A D V A N C E D D E B U G G I N G
2488 *
2489 * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS!
2490 * FOR DEBUGGING, TESTING AND INTERNAL USE ONLY!
2491 */
2492
2493/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */
2494
2495#define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */
2496#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */
2497#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */
2498#define V4L2_CHIP_MATCH_AC97 3 /* Match against anciliary AC97 chip */
2499
2500struct v4l2_dbg_match {
2501 __u32 type; /* Match type */
2502 union { /* Match this chip, meaning determined by type */
2503 __u32 addr;
2504 char name[32];
2505 };
2506} __attribute__ ((packed));
2507
2508struct v4l2_dbg_register {
2509 struct v4l2_dbg_match match;
2510 __u32 size; /* register size in bytes */
2511 __u64 reg;
2512 __u64 val;
2513} __attribute__ ((packed));
2514
2515/* VIDIOC_DBG_G_CHIP_IDENT */
2516struct v4l2_dbg_chip_ident {
2517 struct v4l2_dbg_match match;
2518 __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */
2519 __u32 revision; /* chip revision, chip specific */
2520} __attribute__ ((packed));
2521
2522/**
2523 * struct v4l2_create_buffers - VIDIOC_CREATE_BUFS argument
2524 * @index: on return, index of the first created buffer
2525 * @count: entry: number of requested buffers,
2526 * return: number of created buffers
2527 * @memory: enum v4l2_memory; buffer memory type
2528 * @format: frame format, for which buffers are requested
2529 * @reserved: future extensions
2530 */
2531struct v4l2_create_buffers {
2532 __u32 index;
2533 __u32 count;
2534 __u32 memory;
2535 struct v4l2_format format;
2536 __u32 reserved[8];
2537};
2538
2539/*
2540 * I O C T L C O D E S F O R V I D E O D E V I C E S
2541 *
2542 */
2543#define VIDIOC_QUERYCAP _IOR('V', 0, struct v4l2_capability)
2544#define VIDIOC_RESERVED _IO('V', 1)
2545#define VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc)
2546#define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format)
2547#define VIDIOC_S_FMT _IOWR('V', 5, struct v4l2_format)
2548#define VIDIOC_REQBUFS _IOWR('V', 8, struct v4l2_requestbuffers)
2549#define VIDIOC_QUERYBUF _IOWR('V', 9, struct v4l2_buffer)
2550#define VIDIOC_G_FBUF _IOR('V', 10, struct v4l2_framebuffer)
2551#define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer)
2552#define VIDIOC_OVERLAY _IOW('V', 14, int)
2553#define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer)
2554#define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer)
2555#define VIDIOC_STREAMON _IOW('V', 18, int)
2556#define VIDIOC_STREAMOFF _IOW('V', 19, int)
2557#define VIDIOC_G_PARM _IOWR('V', 21, struct v4l2_streamparm)
2558#define VIDIOC_S_PARM _IOWR('V', 22, struct v4l2_streamparm)
2559#define VIDIOC_G_STD _IOR('V', 23, v4l2_std_id)
2560#define VIDIOC_S_STD _IOW('V', 24, v4l2_std_id)
2561#define VIDIOC_ENUMSTD _IOWR('V', 25, struct v4l2_standard)
2562#define VIDIOC_ENUMINPUT _IOWR('V', 26, struct v4l2_input)
2563#define VIDIOC_G_CTRL _IOWR('V', 27, struct v4l2_control)
2564#define VIDIOC_S_CTRL _IOWR('V', 28, struct v4l2_control)
2565#define VIDIOC_G_TUNER _IOWR('V', 29, struct v4l2_tuner)
2566#define VIDIOC_S_TUNER _IOW('V', 30, struct v4l2_tuner)
2567#define VIDIOC_G_AUDIO _IOR('V', 33, struct v4l2_audio)
2568#define VIDIOC_S_AUDIO _IOW('V', 34, struct v4l2_audio)
2569#define VIDIOC_QUERYCTRL _IOWR('V', 36, struct v4l2_queryctrl)
2570#define VIDIOC_QUERYMENU _IOWR('V', 37, struct v4l2_querymenu)
2571#define VIDIOC_G_INPUT _IOR('V', 38, int)
2572#define VIDIOC_S_INPUT _IOWR('V', 39, int)
2573#define VIDIOC_G_OUTPUT _IOR('V', 46, int)
2574#define VIDIOC_S_OUTPUT _IOWR('V', 47, int)
2575#define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output)
2576#define VIDIOC_G_AUDOUT _IOR('V', 49, struct v4l2_audioout)
2577#define VIDIOC_S_AUDOUT _IOW('V', 50, struct v4l2_audioout)
2578#define VIDIOC_G_MODULATOR _IOWR('V', 54, struct v4l2_modulator)
2579#define VIDIOC_S_MODULATOR _IOW('V', 55, struct v4l2_modulator)
2580#define VIDIOC_G_FREQUENCY _IOWR('V', 56, struct v4l2_frequency)
2581#define VIDIOC_S_FREQUENCY _IOW('V', 57, struct v4l2_frequency)
2582#define VIDIOC_CROPCAP _IOWR('V', 58, struct v4l2_cropcap)
2583#define VIDIOC_G_CROP _IOWR('V', 59, struct v4l2_crop)
2584#define VIDIOC_S_CROP _IOW('V', 60, struct v4l2_crop)
2585#define VIDIOC_G_JPEGCOMP _IOR('V', 61, struct v4l2_jpegcompression)
2586#define VIDIOC_S_JPEGCOMP _IOW('V', 62, struct v4l2_jpegcompression)
2587#define VIDIOC_QUERYSTD _IOR('V', 63, v4l2_std_id)
2588#define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format)
2589#define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio)
2590#define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout)
2591#define VIDIOC_G_PRIORITY _IOR('V', 67, __u32) /* enum v4l2_priority */
2592#define VIDIOC_S_PRIORITY _IOW('V', 68, __u32) /* enum v4l2_priority */
2593#define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap)
2594#define VIDIOC_LOG_STATUS _IO('V', 70)
2595#define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls)
2596#define VIDIOC_S_EXT_CTRLS _IOWR('V', 72, struct v4l2_ext_controls)
2597#define VIDIOC_TRY_EXT_CTRLS _IOWR('V', 73, struct v4l2_ext_controls)
2598#if 1
2599#define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum)
2600#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum)
2601#define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx)
2602#define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd)
2603#define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd)
2604#endif
2605
2606#if 1
2607/* Experimental, meant for debugging, testing and internal use.
2608 Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined.
2609 You must be root to use these ioctls. Never use these in applications! */
2610#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register)
2611#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register)
2612
2613/* Experimental, meant for debugging, testing and internal use.
2614 Never use this ioctl in applications! */
2615#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident)
2616#endif
2617
2618#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
2619
2620/* These four DV Preset ioctls are deprecated in favor of the DV Timings
2621 ioctls. */
2622#define VIDIOC_ENUM_DV_PRESETS _IOWR('V', 83, struct v4l2_dv_enum_preset)
2623#define VIDIOC_S_DV_PRESET _IOWR('V', 84, struct v4l2_dv_preset)
2624#define VIDIOC_G_DV_PRESET _IOWR('V', 85, struct v4l2_dv_preset)
2625#define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset)
2626#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
2627#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings)
2628#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event)
2629#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription)
2630#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
2631
2632/* Experimental, the below two ioctls may change over the next couple of kernel
2633 versions */
2634#define VIDIOC_CREATE_BUFS _IOWR('V', 92, struct v4l2_create_buffers)
2635#define VIDIOC_PREPARE_BUF _IOWR('V', 93, struct v4l2_buffer)
2636
2637/* Experimental selection API */
2638#define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection)
2639#define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection)
2640
2641/* Experimental, these two ioctls may change over the next couple of kernel
2642 versions. */
2643#define VIDIOC_DECODER_CMD _IOWR('V', 96, struct v4l2_decoder_cmd)
2644#define VIDIOC_TRY_DECODER_CMD _IOWR('V', 97, struct v4l2_decoder_cmd)
2645
2646/* Experimental, these three ioctls may change over the next couple of kernel
2647 versions. */
2648#define VIDIOC_ENUM_DV_TIMINGS _IOWR('V', 98, struct v4l2_enum_dv_timings)
2649#define VIDIOC_QUERY_DV_TIMINGS _IOR('V', 99, struct v4l2_dv_timings)
2650#define VIDIOC_DV_TIMINGS_CAP _IOWR('V', 100, struct v4l2_dv_timings_cap)
2651
2652/* Experimental, this ioctl may change over the next couple of kernel
2653 versions. */
2654#define VIDIOC_ENUM_FREQ_BANDS _IOWR('V', 101, struct v4l2_frequency_band)
2655
2656/* Reminder: when adding new ioctls please add support for them to
2657 drivers/media/video/v4l2-compat-ioctl32.c as well! */
2658
2659#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
2660 61
2661#endif /* __LINUX_VIDEODEV2_H */ 62#endif /* __LINUX_VIDEODEV2_H */
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index a1ba8bbd9fbe..533b1157f22e 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -50,6 +50,8 @@ void *virtqueue_detach_unused_buf(struct virtqueue *vq);
50 50
51unsigned int virtqueue_get_vring_size(struct virtqueue *vq); 51unsigned int virtqueue_get_vring_size(struct virtqueue *vq);
52 52
53int virtqueue_get_queue_index(struct virtqueue *vq);
54
53/** 55/**
54 * virtio_device - representation of a device using virtio 56 * virtio_device - representation of a device using virtio
55 * @index: unique position on the virtio bus 57 * @index: unique position on the virtio bus
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index fc457f452f64..29b9104232b4 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -1,60 +1,10 @@
1#ifndef _LINUX_VIRTIO_CONFIG_H 1#ifndef _LINUX_VIRTIO_CONFIG_H
2#define _LINUX_VIRTIO_CONFIG_H 2#define _LINUX_VIRTIO_CONFIG_H
3/* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
4 * anyone can use the definitions to implement compatible drivers/servers.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of IBM nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE. */
28
29/* Virtio devices use a standardized configuration space to define their
30 * features and pass configuration information, but each implementation can
31 * store and access that space differently. */
32#include <linux/types.h>
33
34/* Status byte for guest to report progress, and synchronize features. */
35/* We have seen device and processed generic fields (VIRTIO_CONFIG_F_VIRTIO) */
36#define VIRTIO_CONFIG_S_ACKNOWLEDGE 1
37/* We have found a driver for the device. */
38#define VIRTIO_CONFIG_S_DRIVER 2
39/* Driver has used its parts of the config, and is happy */
40#define VIRTIO_CONFIG_S_DRIVER_OK 4
41/* We've given up on this device. */
42#define VIRTIO_CONFIG_S_FAILED 0x80
43
44/* Some virtio feature bits (currently bits 28 through 31) are reserved for the
45 * transport being used (eg. virtio_ring), the rest are per-device feature
46 * bits. */
47#define VIRTIO_TRANSPORT_F_START 28
48#define VIRTIO_TRANSPORT_F_END 32
49 3
50/* Do we get callbacks when the ring is completely used, even if we've
51 * suppressed them? */
52#define VIRTIO_F_NOTIFY_ON_EMPTY 24
53
54#ifdef __KERNEL__
55#include <linux/err.h> 4#include <linux/err.h>
56#include <linux/bug.h> 5#include <linux/bug.h>
57#include <linux/virtio.h> 6#include <linux/virtio.h>
7#include <uapi/linux/virtio_config.h>
58 8
59/** 9/**
60 * virtio_config_ops - operations for configuring a virtio device 10 * virtio_config_ops - operations for configuring a virtio device
@@ -84,7 +34,9 @@
84 * nvqs: the number of virtqueues to find 34 * nvqs: the number of virtqueues to find
85 * vqs: on success, includes new virtqueues 35 * vqs: on success, includes new virtqueues
86 * callbacks: array of callbacks, for each virtqueue 36 * callbacks: array of callbacks, for each virtqueue
37 * include a NULL entry for vqs that do not need a callback
87 * names: array of virtqueue names (mainly for debugging) 38 * names: array of virtqueue names (mainly for debugging)
39 * include a NULL entry for vqs unused by driver
88 * Returns 0 on success or error status 40 * Returns 0 on success or error status
89 * @del_vqs: free virtqueues found by find_vqs(). 41 * @del_vqs: free virtqueues found by find_vqs().
90 * @get_features: get the array of feature bits for this device. 42 * @get_features: get the array of feature bits for this device.
@@ -98,6 +50,7 @@
98 * vdev: the virtio_device 50 * vdev: the virtio_device
99 * This returns a pointer to the bus name a la pci_name from which 51 * This returns a pointer to the bus name a la pci_name from which
100 * the caller can then copy. 52 * the caller can then copy.
53 * @set_vq_affinity: set the affinity for a virtqueue.
101 */ 54 */
102typedef void vq_callback_t(struct virtqueue *); 55typedef void vq_callback_t(struct virtqueue *);
103struct virtio_config_ops { 56struct virtio_config_ops {
@@ -116,6 +69,7 @@ struct virtio_config_ops {
116 u32 (*get_features)(struct virtio_device *vdev); 69 u32 (*get_features)(struct virtio_device *vdev);
117 void (*finalize_features)(struct virtio_device *vdev); 70 void (*finalize_features)(struct virtio_device *vdev);
118 const char *(*bus_name)(struct virtio_device *vdev); 71 const char *(*bus_name)(struct virtio_device *vdev);
72 int (*set_vq_affinity)(struct virtqueue *vq, int cpu);
119}; 73};
120 74
121/* If driver didn't advertise the feature, it will never appear. */ 75/* If driver didn't advertise the feature, it will never appear. */
@@ -190,5 +144,23 @@ const char *virtio_bus_name(struct virtio_device *vdev)
190 return vdev->config->bus_name(vdev); 144 return vdev->config->bus_name(vdev);
191} 145}
192 146
193#endif /* __KERNEL__ */ 147/**
148 * virtqueue_set_affinity - setting affinity for a virtqueue
149 * @vq: the virtqueue
150 * @cpu: the cpu no.
151 *
152 * Pay attention the function are best-effort: the affinity hint may not be set
153 * due to config support, irq type and sharing.
154 *
155 */
156static inline
157int virtqueue_set_affinity(struct virtqueue *vq, int cpu)
158{
159 struct virtio_device *vdev = vq->vdev;
160 if (vdev->config->set_vq_affinity)
161 return vdev->config->set_vq_affinity(vq, cpu);
162 return 0;
163}
164
165
194#endif /* _LINUX_VIRTIO_CONFIG_H */ 166#endif /* _LINUX_VIRTIO_CONFIG_H */
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h
index bdf4b0034739..d2e2785af602 100644
--- a/include/linux/virtio_console.h
+++ b/include/linux/virtio_console.h
@@ -1,8 +1,3 @@
1#ifndef _LINUX_VIRTIO_CONSOLE_H
2#define _LINUX_VIRTIO_CONSOLE_H
3#include <linux/types.h>
4#include <linux/virtio_ids.h>
5#include <linux/virtio_config.h>
6/* 1/*
7 * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so 2 * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
8 * anyone can use the definitions to implement compatible drivers/servers: 3 * anyone can use the definitions to implement compatible drivers/servers:
@@ -34,44 +29,10 @@
34 * Copyright (C) Red Hat, Inc., 2009, 2010, 2011 29 * Copyright (C) Red Hat, Inc., 2009, 2010, 2011
35 * Copyright (C) Amit Shah <amit.shah@redhat.com>, 2009, 2010, 2011 30 * Copyright (C) Amit Shah <amit.shah@redhat.com>, 2009, 2010, 2011
36 */ 31 */
32#ifndef _LINUX_VIRTIO_CONSOLE_H
33#define _LINUX_VIRTIO_CONSOLE_H
37 34
38/* Feature bits */ 35#include <uapi/linux/virtio_console.h>
39#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */
40#define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */
41
42#define VIRTIO_CONSOLE_BAD_ID (~(u32)0)
43
44struct virtio_console_config {
45 /* colums of the screens */
46 __u16 cols;
47 /* rows of the screens */
48 __u16 rows;
49 /* max. number of ports this device can hold */
50 __u32 max_nr_ports;
51} __attribute__((packed));
52
53/*
54 * A message that's passed between the Host and the Guest for a
55 * particular port.
56 */
57struct virtio_console_control {
58 __u32 id; /* Port number */
59 __u16 event; /* The kind of control event (see below) */
60 __u16 value; /* Extra information for the key */
61};
62
63/* Some events for control messages */
64#define VIRTIO_CONSOLE_DEVICE_READY 0
65#define VIRTIO_CONSOLE_PORT_ADD 1
66#define VIRTIO_CONSOLE_PORT_REMOVE 2
67#define VIRTIO_CONSOLE_PORT_READY 3
68#define VIRTIO_CONSOLE_CONSOLE_PORT 4
69#define VIRTIO_CONSOLE_RESIZE 5
70#define VIRTIO_CONSOLE_PORT_OPEN 6
71#define VIRTIO_CONSOLE_PORT_NAME 7
72 36
73#ifdef __KERNEL__
74int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int)); 37int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int));
75#endif /* __KERNEL__ */
76
77#endif /* _LINUX_VIRTIO_CONSOLE_H */ 38#endif /* _LINUX_VIRTIO_CONSOLE_H */
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index e338730c2660..63c6ea199519 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -1,171 +1,14 @@
1#ifndef _LINUX_VIRTIO_RING_H 1#ifndef _LINUX_VIRTIO_RING_H
2#define _LINUX_VIRTIO_RING_H 2#define _LINUX_VIRTIO_RING_H
3/* An interface for efficient virtio implementation, currently for use by KVM
4 * and lguest, but hopefully others soon. Do NOT change this since it will
5 * break existing servers and clients.
6 *
7 * This header is BSD licensed so anyone can use the definitions to implement
8 * compatible drivers/servers.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of IBM nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * Copyright Rusty Russell IBM Corporation 2007. */
34#include <linux/types.h>
35 3
36/* This marks a buffer as continuing via the next field. */
37#define VRING_DESC_F_NEXT 1
38/* This marks a buffer as write-only (otherwise read-only). */
39#define VRING_DESC_F_WRITE 2
40/* This means the buffer contains a list of buffer descriptors. */
41#define VRING_DESC_F_INDIRECT 4
42
43/* The Host uses this in used->flags to advise the Guest: don't kick me when
44 * you add a buffer. It's unreliable, so it's simply an optimization. Guest
45 * will still kick if it's out of buffers. */
46#define VRING_USED_F_NO_NOTIFY 1
47/* The Guest uses this in avail->flags to advise the Host: don't interrupt me
48 * when you consume a buffer. It's unreliable, so it's simply an
49 * optimization. */
50#define VRING_AVAIL_F_NO_INTERRUPT 1
51
52/* We support indirect buffer descriptors */
53#define VIRTIO_RING_F_INDIRECT_DESC 28
54
55/* The Guest publishes the used index for which it expects an interrupt
56 * at the end of the avail ring. Host should ignore the avail->flags field. */
57/* The Host publishes the avail index for which it expects a kick
58 * at the end of the used ring. Guest should ignore the used->flags field. */
59#define VIRTIO_RING_F_EVENT_IDX 29
60
61/* Virtio ring descriptors: 16 bytes. These can chain together via "next". */
62struct vring_desc {
63 /* Address (guest-physical). */
64 __u64 addr;
65 /* Length. */
66 __u32 len;
67 /* The flags as indicated above. */
68 __u16 flags;
69 /* We chain unused descriptors via this, too */
70 __u16 next;
71};
72
73struct vring_avail {
74 __u16 flags;
75 __u16 idx;
76 __u16 ring[];
77};
78
79/* u32 is used here for ids for padding reasons. */
80struct vring_used_elem {
81 /* Index of start of used descriptor chain. */
82 __u32 id;
83 /* Total length of the descriptor chain which was used (written to) */
84 __u32 len;
85};
86
87struct vring_used {
88 __u16 flags;
89 __u16 idx;
90 struct vring_used_elem ring[];
91};
92
93struct vring {
94 unsigned int num;
95
96 struct vring_desc *desc;
97
98 struct vring_avail *avail;
99
100 struct vring_used *used;
101};
102
103/* The standard layout for the ring is a continuous chunk of memory which looks
104 * like this. We assume num is a power of 2.
105 *
106 * struct vring
107 * {
108 * // The actual descriptors (16 bytes each)
109 * struct vring_desc desc[num];
110 *
111 * // A ring of available descriptor heads with free-running index.
112 * __u16 avail_flags;
113 * __u16 avail_idx;
114 * __u16 available[num];
115 * __u16 used_event_idx;
116 *
117 * // Padding to the next align boundary.
118 * char pad[];
119 *
120 * // A ring of used descriptor heads with free-running index.
121 * __u16 used_flags;
122 * __u16 used_idx;
123 * struct vring_used_elem used[num];
124 * __u16 avail_event_idx;
125 * };
126 */
127/* We publish the used event index at the end of the available ring, and vice
128 * versa. They are at the end for backwards compatibility. */
129#define vring_used_event(vr) ((vr)->avail->ring[(vr)->num])
130#define vring_avail_event(vr) (*(__u16 *)&(vr)->used->ring[(vr)->num])
131
132static inline void vring_init(struct vring *vr, unsigned int num, void *p,
133 unsigned long align)
134{
135 vr->num = num;
136 vr->desc = p;
137 vr->avail = p + num*sizeof(struct vring_desc);
138 vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + sizeof(__u16)
139 + align-1) & ~(align - 1));
140}
141
142static inline unsigned vring_size(unsigned int num, unsigned long align)
143{
144 return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (3 + num)
145 + align - 1) & ~(align - 1))
146 + sizeof(__u16) * 3 + sizeof(struct vring_used_elem) * num;
147}
148
149/* The following is used with USED_EVENT_IDX and AVAIL_EVENT_IDX */
150/* Assuming a given event_idx value from the other size, if
151 * we have just incremented index from old to new_idx,
152 * should we trigger an event? */
153static inline int vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old)
154{
155 /* Note: Xen has similar logic for notification hold-off
156 * in include/xen/interface/io/ring.h with req_event and req_prod
157 * corresponding to event_idx + 1 and new_idx respectively.
158 * Note also that req_event and req_prod in Xen start at 1,
159 * event indexes in virtio start at 0. */
160 return (__u16)(new_idx - event_idx - 1) < (__u16)(new_idx - old);
161}
162
163#ifdef __KERNEL__
164#include <linux/irqreturn.h> 4#include <linux/irqreturn.h>
5#include <uapi/linux/virtio_ring.h>
6
165struct virtio_device; 7struct virtio_device;
166struct virtqueue; 8struct virtqueue;
167 9
168struct virtqueue *vring_new_virtqueue(unsigned int num, 10struct virtqueue *vring_new_virtqueue(unsigned int index,
11 unsigned int num,
169 unsigned int vring_align, 12 unsigned int vring_align,
170 struct virtio_device *vdev, 13 struct virtio_device *vdev,
171 bool weak_barriers, 14 bool weak_barriers,
@@ -178,5 +21,4 @@ void vring_del_virtqueue(struct virtqueue *vq);
178void vring_transport_features(struct virtio_device *vdev); 21void vring_transport_features(struct virtio_device *vdev);
179 22
180irqreturn_t vring_interrupt(int irq, void *_vq); 23irqreturn_t vring_interrupt(int irq, void *_vq);
181#endif /* __KERNEL__ */
182#endif /* _LINUX_VIRTIO_RING_H */ 24#endif /* _LINUX_VIRTIO_RING_H */
diff --git a/include/linux/virtio_scsi.h b/include/linux/virtio_scsi.h
index dc8d305b0e05..d6b4440387b7 100644
--- a/include/linux/virtio_scsi.h
+++ b/include/linux/virtio_scsi.h
@@ -72,6 +72,7 @@ struct virtio_scsi_config {
72/* Feature Bits */ 72/* Feature Bits */
73#define VIRTIO_SCSI_F_INOUT 0 73#define VIRTIO_SCSI_F_INOUT 0
74#define VIRTIO_SCSI_F_HOTPLUG 1 74#define VIRTIO_SCSI_F_HOTPLUG 1
75#define VIRTIO_SCSI_F_CHANGE 2
75 76
76/* Response codes */ 77/* Response codes */
77#define VIRTIO_SCSI_S_OK 0 78#define VIRTIO_SCSI_S_OK 0
@@ -108,6 +109,7 @@ struct virtio_scsi_config {
108#define VIRTIO_SCSI_T_NO_EVENT 0 109#define VIRTIO_SCSI_T_NO_EVENT 0
109#define VIRTIO_SCSI_T_TRANSPORT_RESET 1 110#define VIRTIO_SCSI_T_TRANSPORT_RESET 1
110#define VIRTIO_SCSI_T_ASYNC_NOTIFY 2 111#define VIRTIO_SCSI_T_ASYNC_NOTIFY 2
112#define VIRTIO_SCSI_T_PARAM_CHANGE 3
111 113
112/* Reasons of transport reset event */ 114/* Reasons of transport reset event */
113#define VIRTIO_SCSI_EVT_RESET_HARD 0 115#define VIRTIO_SCSI_EVT_RESET_HARD 0
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index 57f7b1091511..3d3114594370 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -52,7 +52,6 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
52 UNEVICTABLE_PGMUNLOCKED, 52 UNEVICTABLE_PGMUNLOCKED,
53 UNEVICTABLE_PGCLEARED, /* on COW, page truncate */ 53 UNEVICTABLE_PGCLEARED, /* on COW, page truncate */
54 UNEVICTABLE_PGSTRANDED, /* unable to isolate on unlock */ 54 UNEVICTABLE_PGSTRANDED, /* unable to isolate on unlock */
55 UNEVICTABLE_MLOCKFREED,
56#ifdef CONFIG_TRANSPARENT_HUGEPAGE 55#ifdef CONFIG_TRANSPARENT_HUGEPAGE
57 THP_FAULT_ALLOC, 56 THP_FAULT_ALLOC,
58 THP_FAULT_FALLBACK, 57 THP_FAULT_FALLBACK,
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index ad2cfd53dadc..92a86b2cce33 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -198,6 +198,8 @@ extern void __dec_zone_state(struct zone *, enum zone_stat_item);
198void refresh_cpu_vm_stats(int); 198void refresh_cpu_vm_stats(int);
199void refresh_zone_stat_thresholds(void); 199void refresh_zone_stat_thresholds(void);
200 200
201void drain_zonestat(struct zone *zone, struct per_cpu_pageset *);
202
201int calculate_pressure_threshold(struct zone *zone); 203int calculate_pressure_threshold(struct zone *zone);
202int calculate_normal_threshold(struct zone *zone); 204int calculate_normal_threshold(struct zone *zone);
203void set_pgdat_percpu_threshold(pg_data_t *pgdat, 205void set_pgdat_percpu_threshold(pg_data_t *pgdat,
@@ -251,8 +253,18 @@ static inline void __dec_zone_page_state(struct page *page,
251static inline void refresh_cpu_vm_stats(int cpu) { } 253static inline void refresh_cpu_vm_stats(int cpu) { }
252static inline void refresh_zone_stat_thresholds(void) { } 254static inline void refresh_zone_stat_thresholds(void) { }
253 255
256static inline void drain_zonestat(struct zone *zone,
257 struct per_cpu_pageset *pset) { }
254#endif /* CONFIG_SMP */ 258#endif /* CONFIG_SMP */
255 259
260static inline void __mod_zone_freepage_state(struct zone *zone, int nr_pages,
261 int migratetype)
262{
263 __mod_zone_page_state(zone, NR_FREE_PAGES, nr_pages);
264 if (is_migrate_cma(migratetype))
265 __mod_zone_page_state(zone, NR_FREE_CMA_PAGES, nr_pages);
266}
267
256extern const char * const vmstat_text[]; 268extern const char * const vmstat_text[];
257 269
258#endif /* _LINUX_VMSTAT_H */ 270#endif /* _LINUX_VMSTAT_H */
diff --git a/include/linux/vt.h b/include/linux/vt.h
index 30a8dd9c83ff..b186e0435239 100644
--- a/include/linux/vt.h
+++ b/include/linux/vt.h
@@ -1,90 +1,8 @@
1#ifndef _LINUX_VT_H 1#ifndef _LINUX_VT_H
2#define _LINUX_VT_H 2#define _LINUX_VT_H
3 3
4#include <uapi/linux/vt.h>
4 5
5/*
6 * These constants are also useful for user-level apps (e.g., VC
7 * resizing).
8 */
9#define MIN_NR_CONSOLES 1 /* must be at least 1 */
10#define MAX_NR_CONSOLES 63 /* serial lines start at 64 */
11#define MAX_NR_USER_CONSOLES 63 /* must be root to allocate above this */
12 /* Note: the ioctl VT_GETSTATE does not work for
13 consoles 16 and higher (since it returns a short) */
14
15/* 0x56 is 'V', to avoid collision with termios and kd */
16
17#define VT_OPENQRY 0x5600 /* find available vt */
18
19struct vt_mode {
20 char mode; /* vt mode */
21 char waitv; /* if set, hang on writes if not active */
22 short relsig; /* signal to raise on release req */
23 short acqsig; /* signal to raise on acquisition */
24 short frsig; /* unused (set to 0) */
25};
26#define VT_GETMODE 0x5601 /* get mode of active vt */
27#define VT_SETMODE 0x5602 /* set mode of active vt */
28#define VT_AUTO 0x00 /* auto vt switching */
29#define VT_PROCESS 0x01 /* process controls switching */
30#define VT_ACKACQ 0x02 /* acknowledge switch */
31
32struct vt_stat {
33 unsigned short v_active; /* active vt */
34 unsigned short v_signal; /* signal to send */
35 unsigned short v_state; /* vt bitmask */
36};
37#define VT_GETSTATE 0x5603 /* get global vt state info */
38#define VT_SENDSIG 0x5604 /* signal to send to bitmask of vts */
39
40#define VT_RELDISP 0x5605 /* release display */
41
42#define VT_ACTIVATE 0x5606 /* make vt active */
43#define VT_WAITACTIVE 0x5607 /* wait for vt active */
44#define VT_DISALLOCATE 0x5608 /* free memory associated to vt */
45
46struct vt_sizes {
47 unsigned short v_rows; /* number of rows */
48 unsigned short v_cols; /* number of columns */
49 unsigned short v_scrollsize; /* number of lines of scrollback */
50};
51#define VT_RESIZE 0x5609 /* set kernel's idea of screensize */
52
53struct vt_consize {
54 unsigned short v_rows; /* number of rows */
55 unsigned short v_cols; /* number of columns */
56 unsigned short v_vlin; /* number of pixel rows on screen */
57 unsigned short v_clin; /* number of pixel rows per character */
58 unsigned short v_vcol; /* number of pixel columns on screen */
59 unsigned short v_ccol; /* number of pixel columns per character */
60};
61#define VT_RESIZEX 0x560A /* set kernel's idea of screensize + more */
62#define VT_LOCKSWITCH 0x560B /* disallow vt switching */
63#define VT_UNLOCKSWITCH 0x560C /* allow vt switching */
64#define VT_GETHIFONTMASK 0x560D /* return hi font mask */
65
66struct vt_event {
67 unsigned int event;
68#define VT_EVENT_SWITCH 0x0001 /* Console switch */
69#define VT_EVENT_BLANK 0x0002 /* Screen blank */
70#define VT_EVENT_UNBLANK 0x0004 /* Screen unblank */
71#define VT_EVENT_RESIZE 0x0008 /* Resize display */
72#define VT_MAX_EVENT 0x000F
73 unsigned int oldev; /* Old console */
74 unsigned int newev; /* New console (if changing) */
75 unsigned int pad[4]; /* Padding for expansion */
76};
77
78#define VT_WAITEVENT 0x560E /* Wait for an event */
79
80struct vt_setactivate {
81 unsigned int console;
82 struct vt_mode mode;
83};
84
85#define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */
86
87#ifdef __KERNEL__
88 6
89/* Virtual Terminal events. */ 7/* Virtual Terminal events. */
90#define VT_ALLOCATE 0x0001 /* Console got allocated */ 8#define VT_ALLOCATE 0x0001 /* Console got allocated */
@@ -106,8 +24,4 @@ static inline int vt_kmsg_redirect(int new)
106 24
107#endif 25#endif
108 26
109#endif /* __KERNEL__ */
110
111#define vt_get_kmsg_redirect() vt_kmsg_redirect(-1)
112
113#endif /* _LINUX_VT_H */ 27#endif /* _LINUX_VT_H */
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 1dee81c41ff1..168dfe122dd3 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -1,28 +1,12 @@
1#ifndef _LINUX_WAIT_H 1#ifndef _LINUX_WAIT_H
2#define _LINUX_WAIT_H 2#define _LINUX_WAIT_H
3 3
4#define WNOHANG 0x00000001
5#define WUNTRACED 0x00000002
6#define WSTOPPED WUNTRACED
7#define WEXITED 0x00000004
8#define WCONTINUED 0x00000008
9#define WNOWAIT 0x01000000 /* Don't reap, just poll status. */
10
11#define __WNOTHREAD 0x20000000 /* Don't wait on children of other threads in this group */
12#define __WALL 0x40000000 /* Wait on all children, regardless of type */
13#define __WCLONE 0x80000000 /* Wait only on non-SIGCHLD children */
14
15/* First argument to waitid: */
16#define P_ALL 0
17#define P_PID 1
18#define P_PGID 2
19
20#ifdef __KERNEL__
21 4
22#include <linux/list.h> 5#include <linux/list.h>
23#include <linux/stddef.h> 6#include <linux/stddef.h>
24#include <linux/spinlock.h> 7#include <linux/spinlock.h>
25#include <asm/current.h> 8#include <asm/current.h>
9#include <uapi/linux/wait.h>
26 10
27typedef struct __wait_queue wait_queue_t; 11typedef struct __wait_queue wait_queue_t;
28typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int flags, void *key); 12typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int flags, void *key);
@@ -663,6 +647,4 @@ static inline int wait_on_bit_lock(void *word, int bit,
663 return out_of_line_wait_on_bit_lock(word, bit, action, mode); 647 return out_of_line_wait_on_bit_lock(word, bit, action, mode);
664} 648}
665 649
666#endif /* __KERNEL__ */
667
668#endif 650#endif
diff --git a/include/linux/wanrouter.h b/include/linux/wanrouter.h
index 3157cc1fada6..cec4b4159767 100644
--- a/include/linux/wanrouter.h
+++ b/include/linux/wanrouter.h
@@ -43,413 +43,11 @@
43* Jan 16, 1997 Gene Kozin router_devlist made public 43* Jan 16, 1997 Gene Kozin router_devlist made public
44* Jan 02, 1997 Gene Kozin Initial version (based on wanpipe.h). 44* Jan 02, 1997 Gene Kozin Initial version (based on wanpipe.h).
45*****************************************************************************/ 45*****************************************************************************/
46
47#ifndef _ROUTER_H 46#ifndef _ROUTER_H
48#define _ROUTER_H 47#define _ROUTER_H
49 48
50#define ROUTER_NAME "wanrouter" /* in case we ever change it */ 49#include <uapi/linux/wanrouter.h>
51#define ROUTER_VERSION 1 /* version number */
52#define ROUTER_RELEASE 1 /* release (minor version) number */
53#define ROUTER_IOCTL 'W' /* for IOCTL calls */
54#define ROUTER_MAGIC 0x524D4157L /* signature: 'WANR' reversed */
55
56/* IOCTL codes for /proc/router/<device> entries (up to 255) */
57enum router_ioctls
58{
59 ROUTER_SETUP = ROUTER_IOCTL<<8, /* configure device */
60 ROUTER_DOWN, /* shut down device */
61 ROUTER_STAT, /* get device status */
62 ROUTER_IFNEW, /* add interface */
63 ROUTER_IFDEL, /* delete interface */
64 ROUTER_IFSTAT, /* get interface status */
65 ROUTER_USER = (ROUTER_IOCTL<<8)+16, /* driver-specific calls */
66 ROUTER_USER_MAX = (ROUTER_IOCTL<<8)+31
67};
68
69/* identifiers for displaying proc file data for dual port adapters */
70#define PROC_DATA_PORT_0 0x8000 /* the data is for port 0 */
71#define PROC_DATA_PORT_1 0x8001 /* the data is for port 1 */
72
73/* NLPID for packet encapsulation (ISO/IEC TR 9577) */
74#define NLPID_IP 0xCC /* Internet Protocol Datagram */
75#define NLPID_SNAP 0x80 /* IEEE Subnetwork Access Protocol */
76#define NLPID_CLNP 0x81 /* ISO/IEC 8473 */
77#define NLPID_ESIS 0x82 /* ISO/IEC 9542 */
78#define NLPID_ISIS 0x83 /* ISO/IEC ISIS */
79#define NLPID_Q933 0x08 /* CCITT Q.933 */
80
81/* Miscellaneous */
82#define WAN_IFNAME_SZ 15 /* max length of the interface name */
83#define WAN_DRVNAME_SZ 15 /* max length of the link driver name */
84#define WAN_ADDRESS_SZ 31 /* max length of the WAN media address */
85#define USED_BY_FIELD 8 /* max length of the used by field */
86
87/* Defines for UDP PACKET TYPE */
88#define UDP_PTPIPE_TYPE 0x01
89#define UDP_FPIPE_TYPE 0x02
90#define UDP_CPIPE_TYPE 0x03
91#define UDP_DRVSTATS_TYPE 0x04
92#define UDP_INVALID_TYPE 0x05
93
94/* Command return code */
95#define CMD_OK 0 /* normal firmware return code */
96#define CMD_TIMEOUT 0xFF /* firmware command timed out */
97
98/* UDP Packet Management */
99#define UDP_PKT_FRM_STACK 0x00
100#define UDP_PKT_FRM_NETWORK 0x01
101
102/* Maximum interrupt test counter */
103#define MAX_INTR_TEST_COUNTER 100
104
105/* Critical Values for RACE conditions*/
106#define CRITICAL_IN_ISR 0xA1
107#define CRITICAL_INTR_HANDLED 0xB1
108
109/****** Data Types **********************************************************/
110
111/*----------------------------------------------------------------------------
112 * X.25-specific link-level configuration.
113 */
114typedef struct wan_x25_conf
115{
116 unsigned lo_pvc; /* lowest permanent circuit number */
117 unsigned hi_pvc; /* highest permanent circuit number */
118 unsigned lo_svc; /* lowest switched circuit number */
119 unsigned hi_svc; /* highest switched circuit number */
120 unsigned hdlc_window; /* HDLC window size (1..7) */
121 unsigned pkt_window; /* X.25 packet window size (1..7) */
122 unsigned t1; /* HDLC timer T1, sec (1..30) */
123 unsigned t2; /* HDLC timer T2, sec (0..29) */
124 unsigned t4; /* HDLC supervisory frame timer = T4 * T1 */
125 unsigned n2; /* HDLC retransmission limit (1..30) */
126 unsigned t10_t20; /* X.25 RESTART timeout, sec (1..255) */
127 unsigned t11_t21; /* X.25 CALL timeout, sec (1..255) */
128 unsigned t12_t22; /* X.25 RESET timeout, sec (1..255) */
129 unsigned t13_t23; /* X.25 CLEAR timeout, sec (1..255) */
130 unsigned t16_t26; /* X.25 INTERRUPT timeout, sec (1..255) */
131 unsigned t28; /* X.25 REGISTRATION timeout, sec (1..255) */
132 unsigned r10_r20; /* RESTART retransmission limit (0..250) */
133 unsigned r12_r22; /* RESET retransmission limit (0..250) */
134 unsigned r13_r23; /* CLEAR retransmission limit (0..250) */
135 unsigned ccitt_compat; /* compatibility mode: 1988/1984/1980 */
136 unsigned x25_conf_opt; /* User defined x25 config optoins */
137 unsigned char LAPB_hdlc_only; /* Run in HDLC only mode */
138 unsigned char logging; /* Control connection logging */
139 unsigned char oob_on_modem; /* Whether to send modem status to the user app */
140} wan_x25_conf_t;
141
142/*----------------------------------------------------------------------------
143 * Frame relay specific link-level configuration.
144 */
145typedef struct wan_fr_conf
146{
147 unsigned signalling; /* local in-channel signalling type */
148 unsigned t391; /* link integrity verification timer */
149 unsigned t392; /* polling verification timer */
150 unsigned n391; /* full status polling cycle counter */
151 unsigned n392; /* error threshold counter */
152 unsigned n393; /* monitored events counter */
153 unsigned dlci_num; /* number of DLCs (access node) */
154 unsigned dlci[100]; /* List of all DLCIs */
155} wan_fr_conf_t;
156
157/*----------------------------------------------------------------------------
158 * PPP-specific link-level configuration.
159 */
160typedef struct wan_ppp_conf
161{
162 unsigned restart_tmr; /* restart timer */
163 unsigned auth_rsrt_tmr; /* authentication timer */
164 unsigned auth_wait_tmr; /* authentication timer */
165 unsigned mdm_fail_tmr; /* modem failure timer */
166 unsigned dtr_drop_tmr; /* DTR drop timer */
167 unsigned connect_tmout; /* connection timeout */
168 unsigned conf_retry; /* max. retry */
169 unsigned term_retry; /* max. retry */
170 unsigned fail_retry; /* max. retry */
171 unsigned auth_retry; /* max. retry */
172 unsigned auth_options; /* authentication opt. */
173 unsigned ip_options; /* IP options */
174 char authenticator; /* AUTHENTICATOR or not */
175 char ip_mode; /* Static/Host/Peer */
176} wan_ppp_conf_t;
177
178/*----------------------------------------------------------------------------
179 * CHDLC-specific link-level configuration.
180 */
181typedef struct wan_chdlc_conf
182{
183 unsigned char ignore_dcd; /* Protocol options: */
184 unsigned char ignore_cts; /* Ignore these to determine */
185 unsigned char ignore_keepalive; /* link status (Yes or No) */
186 unsigned char hdlc_streaming; /* hdlc_streaming mode (Y/N) */
187 unsigned char receive_only; /* no transmit buffering (Y/N) */
188 unsigned keepalive_tx_tmr; /* transmit keepalive timer */
189 unsigned keepalive_rx_tmr; /* receive keepalive timer */
190 unsigned keepalive_err_margin; /* keepalive_error_tolerance */
191 unsigned slarp_timer; /* SLARP request timer */
192} wan_chdlc_conf_t;
193
194
195/*----------------------------------------------------------------------------
196 * WAN device configuration. Passed to ROUTER_SETUP IOCTL.
197 */
198typedef struct wandev_conf
199{
200 unsigned magic; /* magic number (for verification) */
201 unsigned config_id; /* configuration structure identifier */
202 /****** hardware configuration ******/
203 unsigned ioport; /* adapter I/O port base */
204 unsigned long maddr; /* dual-port memory address */
205 unsigned msize; /* dual-port memory size */
206 int irq; /* interrupt request level */
207 int dma; /* DMA request level */
208 char S514_CPU_no[1]; /* S514 PCI adapter CPU number ('A' or 'B') */
209 unsigned PCI_slot_no; /* S514 PCI adapter slot number */
210 char auto_pci_cfg; /* S515 PCI automatic slot detection */
211 char comm_port; /* Communication Port (PRI=0, SEC=1) */
212 unsigned bps; /* data transfer rate */
213 unsigned mtu; /* maximum transmit unit size */
214 unsigned udp_port; /* UDP port for management */
215 unsigned char ttl; /* Time To Live for UDP security */
216 unsigned char ft1; /* FT1 Configurator Option */
217 char interface; /* RS-232/V.35, etc. */
218 char clocking; /* external/internal */
219 char line_coding; /* NRZ/NRZI/FM0/FM1, etc. */
220 char station; /* DTE/DCE, primary/secondary, etc. */
221 char connection; /* permanent/switched/on-demand */
222 char read_mode; /* read mode: Polling or interrupt */
223 char receive_only; /* disable tx buffers */
224 char tty; /* Create a fake tty device */
225 unsigned tty_major; /* Major number for wanpipe tty device */
226 unsigned tty_minor; /* Minor number for wanpipe tty device */
227 unsigned tty_mode; /* TTY operation mode SYNC or ASYNC */
228 char backup; /* Backup Mode */
229 unsigned hw_opt[4]; /* other hardware options */
230 unsigned reserved[4];
231 /****** arbitrary data ***************/
232 unsigned data_size; /* data buffer size */
233 void* data; /* data buffer, e.g. firmware */
234 union /****** protocol-specific ************/
235 {
236 wan_x25_conf_t x25; /* X.25 configuration */
237 wan_ppp_conf_t ppp; /* PPP configuration */
238 wan_fr_conf_t fr; /* frame relay configuration */
239 wan_chdlc_conf_t chdlc; /* Cisco HDLC configuration */
240 } u;
241} wandev_conf_t;
242
243/* 'config_id' definitions */
244#define WANCONFIG_X25 101 /* X.25 link */
245#define WANCONFIG_FR 102 /* frame relay link */
246#define WANCONFIG_PPP 103 /* synchronous PPP link */
247#define WANCONFIG_CHDLC 104 /* Cisco HDLC Link */
248#define WANCONFIG_BSC 105 /* BiSync Streaming */
249#define WANCONFIG_HDLC 106 /* HDLC Support */
250#define WANCONFIG_MPPP 107 /* Multi Port PPP over RAW CHDLC */
251
252/*
253 * Configuration options defines.
254 */
255/* general options */
256#define WANOPT_OFF 0
257#define WANOPT_ON 1
258#define WANOPT_NO 0
259#define WANOPT_YES 1
260
261/* intercace options */
262#define WANOPT_RS232 0
263#define WANOPT_V35 1
264
265/* data encoding options */
266#define WANOPT_NRZ 0
267#define WANOPT_NRZI 1
268#define WANOPT_FM0 2
269#define WANOPT_FM1 3
270
271/* link type options */
272#define WANOPT_POINTTOPOINT 0 /* RTS always active */
273#define WANOPT_MULTIDROP 1 /* RTS is active when transmitting */
274
275/* clocking options */
276#define WANOPT_EXTERNAL 0
277#define WANOPT_INTERNAL 1
278
279/* station options */
280#define WANOPT_DTE 0
281#define WANOPT_DCE 1
282#define WANOPT_CPE 0
283#define WANOPT_NODE 1
284#define WANOPT_SECONDARY 0
285#define WANOPT_PRIMARY 1
286
287/* connection options */
288#define WANOPT_PERMANENT 0 /* DTR always active */
289#define WANOPT_SWITCHED 1 /* use DTR to setup link (dial-up) */
290#define WANOPT_ONDEMAND 2 /* activate DTR only before sending */
291
292/* frame relay in-channel signalling */
293#define WANOPT_FR_ANSI 1 /* ANSI T1.617 Annex D */
294#define WANOPT_FR_Q933 2 /* ITU Q.933A */
295#define WANOPT_FR_LMI 3 /* LMI */
296
297/* PPP IP Mode Options */
298#define WANOPT_PPP_STATIC 0
299#define WANOPT_PPP_HOST 1
300#define WANOPT_PPP_PEER 2
301
302/* ASY Mode Options */
303#define WANOPT_ONE 1
304#define WANOPT_TWO 2
305#define WANOPT_ONE_AND_HALF 3
306
307#define WANOPT_NONE 0
308#define WANOPT_ODD 1
309#define WANOPT_EVEN 2
310
311/* CHDLC Protocol Options */
312/* DF Commented out for now.
313
314#define WANOPT_CHDLC_NO_DCD IGNORE_DCD_FOR_LINK_STAT
315#define WANOPT_CHDLC_NO_CTS IGNORE_CTS_FOR_LINK_STAT
316#define WANOPT_CHDLC_NO_KEEPALIVE IGNORE_KPALV_FOR_LINK_STAT
317*/
318
319/* Port options */
320#define WANOPT_PRI 0
321#define WANOPT_SEC 1
322/* read mode */
323#define WANOPT_INTR 0
324#define WANOPT_POLL 1
325
326
327#define WANOPT_TTY_SYNC 0
328#define WANOPT_TTY_ASYNC 1
329/*----------------------------------------------------------------------------
330 * WAN Link Status Info (for ROUTER_STAT IOCTL).
331 */
332typedef struct wandev_stat
333{
334 unsigned state; /* link state */
335 unsigned ndev; /* number of configured interfaces */
336
337 /* link/interface configuration */
338 unsigned connection; /* permanent/switched/on-demand */
339 unsigned media_type; /* Frame relay/PPP/X.25/SDLC, etc. */
340 unsigned mtu; /* max. transmit unit for this device */
341
342 /* physical level statistics */
343 unsigned modem_status; /* modem status */
344 unsigned rx_frames; /* received frames count */
345 unsigned rx_overruns; /* receiver overrun error count */
346 unsigned rx_crc_err; /* receive CRC error count */
347 unsigned rx_aborts; /* received aborted frames count */
348 unsigned rx_bad_length; /* unexpetedly long/short frames count */
349 unsigned rx_dropped; /* frames discarded at device level */
350 unsigned tx_frames; /* transmitted frames count */
351 unsigned tx_underruns; /* aborted transmissions (underruns) count */
352 unsigned tx_timeouts; /* transmission timeouts */
353 unsigned tx_rejects; /* other transmit errors */
354
355 /* media level statistics */
356 unsigned rx_bad_format; /* frames with invalid format */
357 unsigned rx_bad_addr; /* frames with invalid media address */
358 unsigned tx_retries; /* frames re-transmitted */
359 unsigned reserved[16]; /* reserved for future use */
360} wandev_stat_t;
361
362/* 'state' defines */
363enum wan_states
364{
365 WAN_UNCONFIGURED, /* link/channel is not configured */
366 WAN_DISCONNECTED, /* link/channel is disconnected */
367 WAN_CONNECTING, /* connection is in progress */
368 WAN_CONNECTED, /* link/channel is operational */
369 WAN_LIMIT, /* for verification only */
370 WAN_DUALPORT, /* for Dual Port cards */
371 WAN_DISCONNECTING,
372 WAN_FT1_READY /* FT1 Configurator Ready */
373};
374
375enum {
376 WAN_LOCAL_IP,
377 WAN_POINTOPOINT_IP,
378 WAN_NETMASK_IP,
379 WAN_BROADCAST_IP
380};
381
382/* 'modem_status' masks */
383#define WAN_MODEM_CTS 0x0001 /* CTS line active */
384#define WAN_MODEM_DCD 0x0002 /* DCD line active */
385#define WAN_MODEM_DTR 0x0010 /* DTR line active */
386#define WAN_MODEM_RTS 0x0020 /* RTS line active */
387
388/*----------------------------------------------------------------------------
389 * WAN interface (logical channel) configuration (for ROUTER_IFNEW IOCTL).
390 */
391typedef struct wanif_conf
392{
393 unsigned magic; /* magic number */
394 unsigned config_id; /* configuration identifier */
395 char name[WAN_IFNAME_SZ+1]; /* interface name, ASCIIZ */
396 char addr[WAN_ADDRESS_SZ+1]; /* media address, ASCIIZ */
397 char usedby[USED_BY_FIELD]; /* used by API or WANPIPE */
398 unsigned idle_timeout; /* sec, before disconnecting */
399 unsigned hold_timeout; /* sec, before re-connecting */
400 unsigned cir; /* Committed Information Rate fwd,bwd*/
401 unsigned bc; /* Committed Burst Size fwd, bwd */
402 unsigned be; /* Excess Burst Size fwd, bwd */
403 unsigned char enable_IPX; /* Enable or Disable IPX */
404 unsigned char inarp; /* Send Inverse ARP requests Y/N */
405 unsigned inarp_interval; /* sec, between InARP requests */
406 unsigned long network_number; /* Network Number for IPX */
407 char mc; /* Multicast on or off */
408 char local_addr[WAN_ADDRESS_SZ+1];/* local media address, ASCIIZ */
409 unsigned char port; /* board port */
410 unsigned char protocol; /* prococol used in this channel (TCPOX25 or X25) */
411 char pap; /* PAP enabled or disabled */
412 char chap; /* CHAP enabled or disabled */
413 unsigned char userid[511]; /* List of User Id */
414 unsigned char passwd[511]; /* List of passwords */
415 unsigned char sysname[31]; /* Name of the system */
416 unsigned char ignore_dcd; /* Protocol options: */
417 unsigned char ignore_cts; /* Ignore these to determine */
418 unsigned char ignore_keepalive; /* link status (Yes or No) */
419 unsigned char hdlc_streaming; /* Hdlc streaming mode (Y/N) */
420 unsigned keepalive_tx_tmr; /* transmit keepalive timer */
421 unsigned keepalive_rx_tmr; /* receive keepalive timer */
422 unsigned keepalive_err_margin; /* keepalive_error_tolerance */
423 unsigned slarp_timer; /* SLARP request timer */
424 unsigned char ttl; /* Time To Live for UDP security */
425 char interface; /* RS-232/V.35, etc. */
426 char clocking; /* external/internal */
427 unsigned bps; /* data transfer rate */
428 unsigned mtu; /* maximum transmit unit size */
429 unsigned char if_down; /* brind down interface when disconnected */
430 unsigned char gateway; /* Is this interface a gateway */
431 unsigned char true_if_encoding; /* Set the dev->type to true board protocol */
432
433 unsigned char asy_data_trans; /* async API options */
434 unsigned char rts_hs_for_receive; /* async Protocol options */
435 unsigned char xon_xoff_hs_for_receive;
436 unsigned char xon_xoff_hs_for_transmit;
437 unsigned char dcd_hs_for_transmit;
438 unsigned char cts_hs_for_transmit;
439 unsigned char async_mode;
440 unsigned tx_bits_per_char;
441 unsigned rx_bits_per_char;
442 unsigned stop_bits;
443 unsigned char parity;
444 unsigned break_timer;
445 unsigned inter_char_timer;
446 unsigned rx_complete_length;
447 unsigned xon_char;
448 unsigned xoff_char;
449 unsigned char receive_only; /* no transmit buffering (Y/N) */
450} wanif_conf_t;
451 50
452#ifdef __KERNEL__
453/****** Kernel Interface ****************************************************/ 51/****** Kernel Interface ****************************************************/
454 52
455#include <linux/fs.h> /* support for device drivers */ 53#include <linux/fs.h> /* support for device drivers */
@@ -528,5 +126,4 @@ extern long wanrouter_ioctl(struct file *file, unsigned int cmd, unsigned long a
528/* list of registered devices */ 126/* list of registered devices */
529extern struct wan_device *wanrouter_router_devlist; 127extern struct wan_device *wanrouter_router_devlist;
530 128
531#endif /* __KERNEL__ */
532#endif /* _ROUTER_H */ 129#endif /* _ROUTER_H */
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index da70f0facd2b..b7f45d48b2de 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -5,59 +5,14 @@
5 * by Ken Hollis <khollis@bitgate.com> 5 * by Ken Hollis <khollis@bitgate.com>
6 * 6 *
7 */ 7 */
8
9#ifndef _LINUX_WATCHDOG_H 8#ifndef _LINUX_WATCHDOG_H
10#define _LINUX_WATCHDOG_H 9#define _LINUX_WATCHDOG_H
11 10
12#include <linux/ioctl.h>
13#include <linux/types.h>
14
15#define WATCHDOG_IOCTL_BASE 'W'
16
17struct watchdog_info {
18 __u32 options; /* Options the card/driver supports */
19 __u32 firmware_version; /* Firmware version of the card */
20 __u8 identity[32]; /* Identity of the board */
21};
22
23#define WDIOC_GETSUPPORT _IOR(WATCHDOG_IOCTL_BASE, 0, struct watchdog_info)
24#define WDIOC_GETSTATUS _IOR(WATCHDOG_IOCTL_BASE, 1, int)
25#define WDIOC_GETBOOTSTATUS _IOR(WATCHDOG_IOCTL_BASE, 2, int)
26#define WDIOC_GETTEMP _IOR(WATCHDOG_IOCTL_BASE, 3, int)
27#define WDIOC_SETOPTIONS _IOR(WATCHDOG_IOCTL_BASE, 4, int)
28#define WDIOC_KEEPALIVE _IOR(WATCHDOG_IOCTL_BASE, 5, int)
29#define WDIOC_SETTIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 6, int)
30#define WDIOC_GETTIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 7, int)
31#define WDIOC_SETPRETIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 8, int)
32#define WDIOC_GETPRETIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 9, int)
33#define WDIOC_GETTIMELEFT _IOR(WATCHDOG_IOCTL_BASE, 10, int)
34
35#define WDIOF_UNKNOWN -1 /* Unknown flag error */
36#define WDIOS_UNKNOWN -1 /* Unknown status error */
37
38#define WDIOF_OVERHEAT 0x0001 /* Reset due to CPU overheat */
39#define WDIOF_FANFAULT 0x0002 /* Fan failed */
40#define WDIOF_EXTERN1 0x0004 /* External relay 1 */
41#define WDIOF_EXTERN2 0x0008 /* External relay 2 */
42#define WDIOF_POWERUNDER 0x0010 /* Power bad/power fault */
43#define WDIOF_CARDRESET 0x0020 /* Card previously reset the CPU */
44#define WDIOF_POWEROVER 0x0040 /* Power over voltage */
45#define WDIOF_SETTIMEOUT 0x0080 /* Set timeout (in seconds) */
46#define WDIOF_MAGICCLOSE 0x0100 /* Supports magic close char */
47#define WDIOF_PRETIMEOUT 0x0200 /* Pretimeout (in seconds), get/set */
48#define WDIOF_ALARMONLY 0x0400 /* Watchdog triggers a management or
49 other external alarm not a reboot */
50#define WDIOF_KEEPALIVEPING 0x8000 /* Keep alive ping reply */
51
52#define WDIOS_DISABLECARD 0x0001 /* Turn off the watchdog timer */
53#define WDIOS_ENABLECARD 0x0002 /* Turn on the watchdog timer */
54#define WDIOS_TEMPPANIC 0x0004 /* Kernel panic on temperature trip */
55
56#ifdef __KERNEL__
57 11
58#include <linux/bitops.h> 12#include <linux/bitops.h>
59#include <linux/device.h> 13#include <linux/device.h>
60#include <linux/cdev.h> 14#include <linux/cdev.h>
15#include <uapi/linux/watchdog.h>
61 16
62struct watchdog_ops; 17struct watchdog_ops;
63struct watchdog_device; 18struct watchdog_device;
@@ -178,6 +133,4 @@ static inline void *watchdog_get_drvdata(struct watchdog_device *wdd)
178extern int watchdog_register_device(struct watchdog_device *); 133extern int watchdog_register_device(struct watchdog_device *);
179extern void watchdog_unregister_device(struct watchdog_device *); 134extern void watchdog_unregister_device(struct watchdog_device *);
180 135
181#endif /* __KERNEL__ */
182
183#endif /* ifndef _LINUX_WATCHDOG_H */ 136#endif /* ifndef _LINUX_WATCHDOG_H */
diff --git a/include/linux/wimax/Kbuild b/include/linux/wimax/Kbuild
deleted file mode 100644
index 3cb4f269bb09..000000000000
--- a/include/linux/wimax/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
1header-y += i2400m.h
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 4395b28bb86c..4ea4c6e2383d 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -6,690 +6,11 @@
6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> 6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com>
7 * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved. 7 * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved.
8 */ 8 */
9
10#ifndef _LINUX_WIRELESS_H 9#ifndef _LINUX_WIRELESS_H
11#define _LINUX_WIRELESS_H 10#define _LINUX_WIRELESS_H
12 11
13/************************** DOCUMENTATION **************************/ 12#include <uapi/linux/wireless.h>
14/*
15 * Initial APIs (1996 -> onward) :
16 * -----------------------------
17 * Basically, the wireless extensions are for now a set of standard ioctl
18 * call + /proc/net/wireless
19 *
20 * The entry /proc/net/wireless give statistics and information on the
21 * driver.
22 * This is better than having each driver having its entry because
23 * its centralised and we may remove the driver module safely.
24 *
25 * Ioctl are used to configure the driver and issue commands. This is
26 * better than command line options of insmod because we may want to
27 * change dynamically (while the driver is running) some parameters.
28 *
29 * The ioctl mechanimsm are copied from standard devices ioctl.
30 * We have the list of command plus a structure descibing the
31 * data exchanged...
32 * Note that to add these ioctl, I was obliged to modify :
33 * # net/core/dev.c (two place + add include)
34 * # net/ipv4/af_inet.c (one place + add include)
35 *
36 * /proc/net/wireless is a copy of /proc/net/dev.
37 * We have a structure for data passed from the driver to /proc/net/wireless
38 * Too add this, I've modified :
39 * # net/core/dev.c (two other places)
40 * # include/linux/netdevice.h (one place)
41 * # include/linux/proc_fs.h (one place)
42 *
43 * New driver API (2002 -> onward) :
44 * -------------------------------
45 * This file is only concerned with the user space API and common definitions.
46 * The new driver API is defined and documented in :
47 * # include/net/iw_handler.h
48 *
49 * Note as well that /proc/net/wireless implementation has now moved in :
50 * # net/core/wireless.c
51 *
52 * Wireless Events (2002 -> onward) :
53 * --------------------------------
54 * Events are defined at the end of this file, and implemented in :
55 * # net/core/wireless.c
56 *
57 * Other comments :
58 * --------------
59 * Do not add here things that are redundant with other mechanisms
60 * (drivers init, ifconfig, /proc/net/dev, ...) and with are not
61 * wireless specific.
62 *
63 * These wireless extensions are not magic : each driver has to provide
64 * support for them...
65 *
66 * IMPORTANT NOTE : As everything in the kernel, this is very much a
67 * work in progress. Contact me if you have ideas of improvements...
68 */
69
70/***************************** INCLUDES *****************************/
71
72#include <linux/types.h> /* for __u* and __s* typedefs */
73#include <linux/socket.h> /* for "struct sockaddr" et al */
74#include <linux/if.h> /* for IFNAMSIZ and co... */
75
76/***************************** VERSION *****************************/
77/*
78 * This constant is used to know the availability of the wireless
79 * extensions and to know which version of wireless extensions it is
80 * (there is some stuff that will be added in the future...)
81 * I just plan to increment with each new version.
82 */
83#define WIRELESS_EXT 22
84
85/*
86 * Changes :
87 *
88 * V2 to V3
89 * --------
90 * Alan Cox start some incompatibles changes. I've integrated a bit more.
91 * - Encryption renamed to Encode to avoid US regulation problems
92 * - Frequency changed from float to struct to avoid problems on old 386
93 *
94 * V3 to V4
95 * --------
96 * - Add sensitivity
97 *
98 * V4 to V5
99 * --------
100 * - Missing encoding definitions in range
101 * - Access points stuff
102 *
103 * V5 to V6
104 * --------
105 * - 802.11 support (ESSID ioctls)
106 *
107 * V6 to V7
108 * --------
109 * - define IW_ESSID_MAX_SIZE and IW_MAX_AP
110 *
111 * V7 to V8
112 * --------
113 * - Changed my e-mail address
114 * - More 802.11 support (nickname, rate, rts, frag)
115 * - List index in frequencies
116 *
117 * V8 to V9
118 * --------
119 * - Support for 'mode of operation' (ad-hoc, managed...)
120 * - Support for unicast and multicast power saving
121 * - Change encoding to support larger tokens (>64 bits)
122 * - Updated iw_params (disable, flags) and use it for NWID
123 * - Extracted iw_point from iwreq for clarity
124 *
125 * V9 to V10
126 * ---------
127 * - Add PM capability to range structure
128 * - Add PM modifier : MAX/MIN/RELATIVE
129 * - Add encoding option : IW_ENCODE_NOKEY
130 * - Add TxPower ioctls (work like TxRate)
131 *
132 * V10 to V11
133 * ----------
134 * - Add WE version in range (help backward/forward compatibility)
135 * - Add retry ioctls (work like PM)
136 *
137 * V11 to V12
138 * ----------
139 * - Add SIOCSIWSTATS to get /proc/net/wireless programatically
140 * - Add DEV PRIVATE IOCTL to avoid collisions in SIOCDEVPRIVATE space
141 * - Add new statistics (frag, retry, beacon)
142 * - Add average quality (for user space calibration)
143 *
144 * V12 to V13
145 * ----------
146 * - Document creation of new driver API.
147 * - Extract union iwreq_data from struct iwreq (for new driver API).
148 * - Rename SIOCSIWNAME as SIOCSIWCOMMIT
149 *
150 * V13 to V14
151 * ----------
152 * - Wireless Events support : define struct iw_event
153 * - Define additional specific event numbers
154 * - Add "addr" and "param" fields in union iwreq_data
155 * - AP scanning stuff (SIOCSIWSCAN and friends)
156 *
157 * V14 to V15
158 * ----------
159 * - Add IW_PRIV_TYPE_ADDR for struct sockaddr private arg
160 * - Make struct iw_freq signed (both m & e), add explicit padding
161 * - Add IWEVCUSTOM for driver specific event/scanning token
162 * - Add IW_MAX_GET_SPY for driver returning a lot of addresses
163 * - Add IW_TXPOW_RANGE for range of Tx Powers
164 * - Add IWEVREGISTERED & IWEVEXPIRED events for Access Points
165 * - Add IW_MODE_MONITOR for passive monitor
166 *
167 * V15 to V16
168 * ----------
169 * - Increase the number of bitrates in iw_range to 32 (for 802.11g)
170 * - Increase the number of frequencies in iw_range to 32 (for 802.11b+a)
171 * - Reshuffle struct iw_range for increases, add filler
172 * - Increase IW_MAX_AP to 64 for driver returning a lot of addresses
173 * - Remove IW_MAX_GET_SPY because conflict with enhanced spy support
174 * - Add SIOCSIWTHRSPY/SIOCGIWTHRSPY and "struct iw_thrspy"
175 * - Add IW_ENCODE_TEMP and iw_range->encoding_login_index
176 *
177 * V16 to V17
178 * ----------
179 * - Add flags to frequency -> auto/fixed
180 * - Document (struct iw_quality *)->updated, add new flags (INVALID)
181 * - Wireless Event capability in struct iw_range
182 * - Add support for relative TxPower (yick !)
183 *
184 * V17 to V18 (From Jouni Malinen <j@w1.fi>)
185 * ----------
186 * - Add support for WPA/WPA2
187 * - Add extended encoding configuration (SIOCSIWENCODEEXT and
188 * SIOCGIWENCODEEXT)
189 * - Add SIOCSIWGENIE/SIOCGIWGENIE
190 * - Add SIOCSIWMLME
191 * - Add SIOCSIWPMKSA
192 * - Add struct iw_range bit field for supported encoding capabilities
193 * - Add optional scan request parameters for SIOCSIWSCAN
194 * - Add SIOCSIWAUTH/SIOCGIWAUTH for setting authentication and WPA
195 * related parameters (extensible up to 4096 parameter values)
196 * - Add wireless events: IWEVGENIE, IWEVMICHAELMICFAILURE,
197 * IWEVASSOCREQIE, IWEVASSOCRESPIE, IWEVPMKIDCAND
198 *
199 * V18 to V19
200 * ----------
201 * - Remove (struct iw_point *)->pointer from events and streams
202 * - Remove header includes to help user space
203 * - Increase IW_ENCODING_TOKEN_MAX from 32 to 64
204 * - Add IW_QUAL_ALL_UPDATED and IW_QUAL_ALL_INVALID macros
205 * - Add explicit flag to tell stats are in dBm : IW_QUAL_DBM
206 * - Add IW_IOCTL_IDX() and IW_EVENT_IDX() macros
207 *
208 * V19 to V20
209 * ----------
210 * - RtNetlink requests support (SET/GET)
211 *
212 * V20 to V21
213 * ----------
214 * - Remove (struct net_device *)->get_wireless_stats()
215 * - Change length in ESSID and NICK to strlen() instead of strlen()+1
216 * - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers
217 * - Power/Retry relative values no longer * 100000
218 * - Add explicit flag to tell stats are in 802.11k RCPI : IW_QUAL_RCPI
219 *
220 * V21 to V22
221 * ----------
222 * - Prevent leaking of kernel space in stream on 64 bits.
223 */
224
225/**************************** CONSTANTS ****************************/
226
227/* -------------------------- IOCTL LIST -------------------------- */
228
229/* Wireless Identification */
230#define SIOCSIWCOMMIT 0x8B00 /* Commit pending changes to driver */
231#define SIOCGIWNAME 0x8B01 /* get name == wireless protocol */
232/* SIOCGIWNAME is used to verify the presence of Wireless Extensions.
233 * Common values : "IEEE 802.11-DS", "IEEE 802.11-FH", "IEEE 802.11b"...
234 * Don't put the name of your driver there, it's useless. */
235
236/* Basic operations */
237#define SIOCSIWNWID 0x8B02 /* set network id (pre-802.11) */
238#define SIOCGIWNWID 0x8B03 /* get network id (the cell) */
239#define SIOCSIWFREQ 0x8B04 /* set channel/frequency (Hz) */
240#define SIOCGIWFREQ 0x8B05 /* get channel/frequency (Hz) */
241#define SIOCSIWMODE 0x8B06 /* set operation mode */
242#define SIOCGIWMODE 0x8B07 /* get operation mode */
243#define SIOCSIWSENS 0x8B08 /* set sensitivity (dBm) */
244#define SIOCGIWSENS 0x8B09 /* get sensitivity (dBm) */
245
246/* Informative stuff */
247#define SIOCSIWRANGE 0x8B0A /* Unused */
248#define SIOCGIWRANGE 0x8B0B /* Get range of parameters */
249#define SIOCSIWPRIV 0x8B0C /* Unused */
250#define SIOCGIWPRIV 0x8B0D /* get private ioctl interface info */
251#define SIOCSIWSTATS 0x8B0E /* Unused */
252#define SIOCGIWSTATS 0x8B0F /* Get /proc/net/wireless stats */
253/* SIOCGIWSTATS is strictly used between user space and the kernel, and
254 * is never passed to the driver (i.e. the driver will never see it). */
255
256/* Spy support (statistics per MAC address - used for Mobile IP support) */
257#define SIOCSIWSPY 0x8B10 /* set spy addresses */
258#define SIOCGIWSPY 0x8B11 /* get spy info (quality of link) */
259#define SIOCSIWTHRSPY 0x8B12 /* set spy threshold (spy event) */
260#define SIOCGIWTHRSPY 0x8B13 /* get spy threshold */
261
262/* Access Point manipulation */
263#define SIOCSIWAP 0x8B14 /* set access point MAC addresses */
264#define SIOCGIWAP 0x8B15 /* get access point MAC addresses */
265#define SIOCGIWAPLIST 0x8B17 /* Deprecated in favor of scanning */
266#define SIOCSIWSCAN 0x8B18 /* trigger scanning (list cells) */
267#define SIOCGIWSCAN 0x8B19 /* get scanning results */
268
269/* 802.11 specific support */
270#define SIOCSIWESSID 0x8B1A /* set ESSID (network name) */
271#define SIOCGIWESSID 0x8B1B /* get ESSID */
272#define SIOCSIWNICKN 0x8B1C /* set node name/nickname */
273#define SIOCGIWNICKN 0x8B1D /* get node name/nickname */
274/* As the ESSID and NICKN are strings up to 32 bytes long, it doesn't fit
275 * within the 'iwreq' structure, so we need to use the 'data' member to
276 * point to a string in user space, like it is done for RANGE... */
277
278/* Other parameters useful in 802.11 and some other devices */
279#define SIOCSIWRATE 0x8B20 /* set default bit rate (bps) */
280#define SIOCGIWRATE 0x8B21 /* get default bit rate (bps) */
281#define SIOCSIWRTS 0x8B22 /* set RTS/CTS threshold (bytes) */
282#define SIOCGIWRTS 0x8B23 /* get RTS/CTS threshold (bytes) */
283#define SIOCSIWFRAG 0x8B24 /* set fragmentation thr (bytes) */
284#define SIOCGIWFRAG 0x8B25 /* get fragmentation thr (bytes) */
285#define SIOCSIWTXPOW 0x8B26 /* set transmit power (dBm) */
286#define SIOCGIWTXPOW 0x8B27 /* get transmit power (dBm) */
287#define SIOCSIWRETRY 0x8B28 /* set retry limits and lifetime */
288#define SIOCGIWRETRY 0x8B29 /* get retry limits and lifetime */
289
290/* Encoding stuff (scrambling, hardware security, WEP...) */
291#define SIOCSIWENCODE 0x8B2A /* set encoding token & mode */
292#define SIOCGIWENCODE 0x8B2B /* get encoding token & mode */
293/* Power saving stuff (power management, unicast and multicast) */
294#define SIOCSIWPOWER 0x8B2C /* set Power Management settings */
295#define SIOCGIWPOWER 0x8B2D /* get Power Management settings */
296
297/* WPA : Generic IEEE 802.11 informatiom element (e.g., for WPA/RSN/WMM).
298 * This ioctl uses struct iw_point and data buffer that includes IE id and len
299 * fields. More than one IE may be included in the request. Setting the generic
300 * IE to empty buffer (len=0) removes the generic IE from the driver. Drivers
301 * are allowed to generate their own WPA/RSN IEs, but in these cases, drivers
302 * are required to report the used IE as a wireless event, e.g., when
303 * associating with an AP. */
304#define SIOCSIWGENIE 0x8B30 /* set generic IE */
305#define SIOCGIWGENIE 0x8B31 /* get generic IE */
306
307/* WPA : IEEE 802.11 MLME requests */
308#define SIOCSIWMLME 0x8B16 /* request MLME operation; uses
309 * struct iw_mlme */
310/* WPA : Authentication mode parameters */
311#define SIOCSIWAUTH 0x8B32 /* set authentication mode params */
312#define SIOCGIWAUTH 0x8B33 /* get authentication mode params */
313
314/* WPA : Extended version of encoding configuration */
315#define SIOCSIWENCODEEXT 0x8B34 /* set encoding token & mode */
316#define SIOCGIWENCODEEXT 0x8B35 /* get encoding token & mode */
317
318/* WPA2 : PMKSA cache management */
319#define SIOCSIWPMKSA 0x8B36 /* PMKSA cache operation */
320
321/* -------------------- DEV PRIVATE IOCTL LIST -------------------- */
322
323/* These 32 ioctl are wireless device private, for 16 commands.
324 * Each driver is free to use them for whatever purpose it chooses,
325 * however the driver *must* export the description of those ioctls
326 * with SIOCGIWPRIV and *must* use arguments as defined below.
327 * If you don't follow those rules, DaveM is going to hate you (reason :
328 * it make mixed 32/64bit operation impossible).
329 */
330#define SIOCIWFIRSTPRIV 0x8BE0
331#define SIOCIWLASTPRIV 0x8BFF
332/* Previously, we were using SIOCDEVPRIVATE, but we now have our
333 * separate range because of collisions with other tools such as
334 * 'mii-tool'.
335 * We now have 32 commands, so a bit more space ;-).
336 * Also, all 'even' commands are only usable by root and don't return the
337 * content of ifr/iwr to user (but you are not obliged to use the set/get
338 * convention, just use every other two command). More details in iwpriv.c.
339 * And I repeat : you are not forced to use them with iwpriv, but you
340 * must be compliant with it.
341 */
342
343/* ------------------------- IOCTL STUFF ------------------------- */
344
345/* The first and the last (range) */
346#define SIOCIWFIRST 0x8B00
347#define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF */
348#define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST)
349#define IW_HANDLER(id, func) \
350 [IW_IOCTL_IDX(id)] = func
351
352/* Odd : get (world access), even : set (root access) */
353#define IW_IS_SET(cmd) (!((cmd) & 0x1))
354#define IW_IS_GET(cmd) ((cmd) & 0x1)
355
356/* ----------------------- WIRELESS EVENTS ----------------------- */
357/* Those are *NOT* ioctls, do not issue request on them !!! */
358/* Most events use the same identifier as ioctl requests */
359
360#define IWEVTXDROP 0x8C00 /* Packet dropped to excessive retry */
361#define IWEVQUAL 0x8C01 /* Quality part of statistics (scan) */
362#define IWEVCUSTOM 0x8C02 /* Driver specific ascii string */
363#define IWEVREGISTERED 0x8C03 /* Discovered a new node (AP mode) */
364#define IWEVEXPIRED 0x8C04 /* Expired a node (AP mode) */
365#define IWEVGENIE 0x8C05 /* Generic IE (WPA, RSN, WMM, ..)
366 * (scan results); This includes id and
367 * length fields. One IWEVGENIE may
368 * contain more than one IE. Scan
369 * results may contain one or more
370 * IWEVGENIE events. */
371#define IWEVMICHAELMICFAILURE 0x8C06 /* Michael MIC failure
372 * (struct iw_michaelmicfailure)
373 */
374#define IWEVASSOCREQIE 0x8C07 /* IEs used in (Re)Association Request.
375 * The data includes id and length
376 * fields and may contain more than one
377 * IE. This event is required in
378 * Managed mode if the driver
379 * generates its own WPA/RSN IE. This
380 * should be sent just before
381 * IWEVREGISTERED event for the
382 * association. */
383#define IWEVASSOCRESPIE 0x8C08 /* IEs used in (Re)Association
384 * Response. The data includes id and
385 * length fields and may contain more
386 * than one IE. This may be sent
387 * between IWEVASSOCREQIE and
388 * IWEVREGISTERED events for the
389 * association. */
390#define IWEVPMKIDCAND 0x8C09 /* PMKID candidate for RSN
391 * pre-authentication
392 * (struct iw_pmkid_cand) */
393
394#define IWEVFIRST 0x8C00
395#define IW_EVENT_IDX(cmd) ((cmd) - IWEVFIRST)
396
397/* ------------------------- PRIVATE INFO ------------------------- */
398/*
399 * The following is used with SIOCGIWPRIV. It allow a driver to define
400 * the interface (name, type of data) for its private ioctl.
401 * Privates ioctl are SIOCIWFIRSTPRIV -> SIOCIWLASTPRIV
402 */
403
404#define IW_PRIV_TYPE_MASK 0x7000 /* Type of arguments */
405#define IW_PRIV_TYPE_NONE 0x0000
406#define IW_PRIV_TYPE_BYTE 0x1000 /* Char as number */
407#define IW_PRIV_TYPE_CHAR 0x2000 /* Char as character */
408#define IW_PRIV_TYPE_INT 0x4000 /* 32 bits int */
409#define IW_PRIV_TYPE_FLOAT 0x5000 /* struct iw_freq */
410#define IW_PRIV_TYPE_ADDR 0x6000 /* struct sockaddr */
411
412#define IW_PRIV_SIZE_FIXED 0x0800 /* Variable or fixed number of args */
413
414#define IW_PRIV_SIZE_MASK 0x07FF /* Max number of those args */
415
416/*
417 * Note : if the number of args is fixed and the size < 16 octets,
418 * instead of passing a pointer we will put args in the iwreq struct...
419 */
420
421/* ----------------------- OTHER CONSTANTS ----------------------- */
422
423/* Maximum frequencies in the range struct */
424#define IW_MAX_FREQUENCIES 32
425/* Note : if you have something like 80 frequencies,
426 * don't increase this constant and don't fill the frequency list.
427 * The user will be able to set by channel anyway... */
428
429/* Maximum bit rates in the range struct */
430#define IW_MAX_BITRATES 32
431
432/* Maximum tx powers in the range struct */
433#define IW_MAX_TXPOWER 8
434/* Note : if you more than 8 TXPowers, just set the max and min or
435 * a few of them in the struct iw_range. */
436
437/* Maximum of address that you may set with SPY */
438#define IW_MAX_SPY 8
439
440/* Maximum of address that you may get in the
441 list of access points in range */
442#define IW_MAX_AP 64
443
444/* Maximum size of the ESSID and NICKN strings */
445#define IW_ESSID_MAX_SIZE 32
446
447/* Modes of operation */
448#define IW_MODE_AUTO 0 /* Let the driver decides */
449#define IW_MODE_ADHOC 1 /* Single cell network */
450#define IW_MODE_INFRA 2 /* Multi cell network, roaming, ... */
451#define IW_MODE_MASTER 3 /* Synchronisation master or Access Point */
452#define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */
453#define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */
454#define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */
455#define IW_MODE_MESH 7 /* Mesh (IEEE 802.11s) network */
456
457/* Statistics flags (bitmask in updated) */
458#define IW_QUAL_QUAL_UPDATED 0x01 /* Value was updated since last read */
459#define IW_QUAL_LEVEL_UPDATED 0x02
460#define IW_QUAL_NOISE_UPDATED 0x04
461#define IW_QUAL_ALL_UPDATED 0x07
462#define IW_QUAL_DBM 0x08 /* Level + Noise are dBm */
463#define IW_QUAL_QUAL_INVALID 0x10 /* Driver doesn't provide value */
464#define IW_QUAL_LEVEL_INVALID 0x20
465#define IW_QUAL_NOISE_INVALID 0x40
466#define IW_QUAL_RCPI 0x80 /* Level + Noise are 802.11k RCPI */
467#define IW_QUAL_ALL_INVALID 0x70
468
469/* Frequency flags */
470#define IW_FREQ_AUTO 0x00 /* Let the driver decides */
471#define IW_FREQ_FIXED 0x01 /* Force a specific value */
472
473/* Maximum number of size of encoding token available
474 * they are listed in the range structure */
475#define IW_MAX_ENCODING_SIZES 8
476
477/* Maximum size of the encoding token in bytes */
478#define IW_ENCODING_TOKEN_MAX 64 /* 512 bits (for now) */
479
480/* Flags for encoding (along with the token) */
481#define IW_ENCODE_INDEX 0x00FF /* Token index (if needed) */
482#define IW_ENCODE_FLAGS 0xFF00 /* Flags defined below */
483#define IW_ENCODE_MODE 0xF000 /* Modes defined below */
484#define IW_ENCODE_DISABLED 0x8000 /* Encoding disabled */
485#define IW_ENCODE_ENABLED 0x0000 /* Encoding enabled */
486#define IW_ENCODE_RESTRICTED 0x4000 /* Refuse non-encoded packets */
487#define IW_ENCODE_OPEN 0x2000 /* Accept non-encoded packets */
488#define IW_ENCODE_NOKEY 0x0800 /* Key is write only, so not present */
489#define IW_ENCODE_TEMP 0x0400 /* Temporary key */
490
491/* Power management flags available (along with the value, if any) */
492#define IW_POWER_ON 0x0000 /* No details... */
493#define IW_POWER_TYPE 0xF000 /* Type of parameter */
494#define IW_POWER_PERIOD 0x1000 /* Value is a period/duration of */
495#define IW_POWER_TIMEOUT 0x2000 /* Value is a timeout (to go asleep) */
496#define IW_POWER_MODE 0x0F00 /* Power Management mode */
497#define IW_POWER_UNICAST_R 0x0100 /* Receive only unicast messages */
498#define IW_POWER_MULTICAST_R 0x0200 /* Receive only multicast messages */
499#define IW_POWER_ALL_R 0x0300 /* Receive all messages though PM */
500#define IW_POWER_FORCE_S 0x0400 /* Force PM procedure for sending unicast */
501#define IW_POWER_REPEATER 0x0800 /* Repeat broadcast messages in PM period */
502#define IW_POWER_MODIFIER 0x000F /* Modify a parameter */
503#define IW_POWER_MIN 0x0001 /* Value is a minimum */
504#define IW_POWER_MAX 0x0002 /* Value is a maximum */
505#define IW_POWER_RELATIVE 0x0004 /* Value is not in seconds/ms/us */
506
507/* Transmit Power flags available */
508#define IW_TXPOW_TYPE 0x00FF /* Type of value */
509#define IW_TXPOW_DBM 0x0000 /* Value is in dBm */
510#define IW_TXPOW_MWATT 0x0001 /* Value is in mW */
511#define IW_TXPOW_RELATIVE 0x0002 /* Value is in arbitrary units */
512#define IW_TXPOW_RANGE 0x1000 /* Range of value between min/max */
513
514/* Retry limits and lifetime flags available */
515#define IW_RETRY_ON 0x0000 /* No details... */
516#define IW_RETRY_TYPE 0xF000 /* Type of parameter */
517#define IW_RETRY_LIMIT 0x1000 /* Maximum number of retries*/
518#define IW_RETRY_LIFETIME 0x2000 /* Maximum duration of retries in us */
519#define IW_RETRY_MODIFIER 0x00FF /* Modify a parameter */
520#define IW_RETRY_MIN 0x0001 /* Value is a minimum */
521#define IW_RETRY_MAX 0x0002 /* Value is a maximum */
522#define IW_RETRY_RELATIVE 0x0004 /* Value is not in seconds/ms/us */
523#define IW_RETRY_SHORT 0x0010 /* Value is for short packets */
524#define IW_RETRY_LONG 0x0020 /* Value is for long packets */
525
526/* Scanning request flags */
527#define IW_SCAN_DEFAULT 0x0000 /* Default scan of the driver */
528#define IW_SCAN_ALL_ESSID 0x0001 /* Scan all ESSIDs */
529#define IW_SCAN_THIS_ESSID 0x0002 /* Scan only this ESSID */
530#define IW_SCAN_ALL_FREQ 0x0004 /* Scan all Frequencies */
531#define IW_SCAN_THIS_FREQ 0x0008 /* Scan only this Frequency */
532#define IW_SCAN_ALL_MODE 0x0010 /* Scan all Modes */
533#define IW_SCAN_THIS_MODE 0x0020 /* Scan only this Mode */
534#define IW_SCAN_ALL_RATE 0x0040 /* Scan all Bit-Rates */
535#define IW_SCAN_THIS_RATE 0x0080 /* Scan only this Bit-Rate */
536/* struct iw_scan_req scan_type */
537#define IW_SCAN_TYPE_ACTIVE 0
538#define IW_SCAN_TYPE_PASSIVE 1
539/* Maximum size of returned data */
540#define IW_SCAN_MAX_DATA 4096 /* In bytes */
541
542/* Scan capability flags - in (struct iw_range *)->scan_capa */
543#define IW_SCAN_CAPA_NONE 0x00
544#define IW_SCAN_CAPA_ESSID 0x01
545#define IW_SCAN_CAPA_BSSID 0x02
546#define IW_SCAN_CAPA_CHANNEL 0x04
547#define IW_SCAN_CAPA_MODE 0x08
548#define IW_SCAN_CAPA_RATE 0x10
549#define IW_SCAN_CAPA_TYPE 0x20
550#define IW_SCAN_CAPA_TIME 0x40
551
552/* Max number of char in custom event - use multiple of them if needed */
553#define IW_CUSTOM_MAX 256 /* In bytes */
554
555/* Generic information element */
556#define IW_GENERIC_IE_MAX 1024
557
558/* MLME requests (SIOCSIWMLME / struct iw_mlme) */
559#define IW_MLME_DEAUTH 0
560#define IW_MLME_DISASSOC 1
561#define IW_MLME_AUTH 2
562#define IW_MLME_ASSOC 3
563
564/* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */
565#define IW_AUTH_INDEX 0x0FFF
566#define IW_AUTH_FLAGS 0xF000
567/* SIOCSIWAUTH/SIOCGIWAUTH parameters (0 .. 4095)
568 * (IW_AUTH_INDEX mask in struct iw_param flags; this is the index of the
569 * parameter that is being set/get to; value will be read/written to
570 * struct iw_param value field) */
571#define IW_AUTH_WPA_VERSION 0
572#define IW_AUTH_CIPHER_PAIRWISE 1
573#define IW_AUTH_CIPHER_GROUP 2
574#define IW_AUTH_KEY_MGMT 3
575#define IW_AUTH_TKIP_COUNTERMEASURES 4
576#define IW_AUTH_DROP_UNENCRYPTED 5
577#define IW_AUTH_80211_AUTH_ALG 6
578#define IW_AUTH_WPA_ENABLED 7
579#define IW_AUTH_RX_UNENCRYPTED_EAPOL 8
580#define IW_AUTH_ROAMING_CONTROL 9
581#define IW_AUTH_PRIVACY_INVOKED 10
582#define IW_AUTH_CIPHER_GROUP_MGMT 11
583#define IW_AUTH_MFP 12
584
585/* IW_AUTH_WPA_VERSION values (bit field) */
586#define IW_AUTH_WPA_VERSION_DISABLED 0x00000001
587#define IW_AUTH_WPA_VERSION_WPA 0x00000002
588#define IW_AUTH_WPA_VERSION_WPA2 0x00000004
589
590/* IW_AUTH_PAIRWISE_CIPHER, IW_AUTH_GROUP_CIPHER, and IW_AUTH_CIPHER_GROUP_MGMT
591 * values (bit field) */
592#define IW_AUTH_CIPHER_NONE 0x00000001
593#define IW_AUTH_CIPHER_WEP40 0x00000002
594#define IW_AUTH_CIPHER_TKIP 0x00000004
595#define IW_AUTH_CIPHER_CCMP 0x00000008
596#define IW_AUTH_CIPHER_WEP104 0x00000010
597#define IW_AUTH_CIPHER_AES_CMAC 0x00000020
598
599/* IW_AUTH_KEY_MGMT values (bit field) */
600#define IW_AUTH_KEY_MGMT_802_1X 1
601#define IW_AUTH_KEY_MGMT_PSK 2
602
603/* IW_AUTH_80211_AUTH_ALG values (bit field) */
604#define IW_AUTH_ALG_OPEN_SYSTEM 0x00000001
605#define IW_AUTH_ALG_SHARED_KEY 0x00000002
606#define IW_AUTH_ALG_LEAP 0x00000004
607
608/* IW_AUTH_ROAMING_CONTROL values */
609#define IW_AUTH_ROAMING_ENABLE 0 /* driver/firmware based roaming */
610#define IW_AUTH_ROAMING_DISABLE 1 /* user space program used for roaming
611 * control */
612
613/* IW_AUTH_MFP (management frame protection) values */
614#define IW_AUTH_MFP_DISABLED 0 /* MFP disabled */
615#define IW_AUTH_MFP_OPTIONAL 1 /* MFP optional */
616#define IW_AUTH_MFP_REQUIRED 2 /* MFP required */
617
618/* SIOCSIWENCODEEXT definitions */
619#define IW_ENCODE_SEQ_MAX_SIZE 8
620/* struct iw_encode_ext ->alg */
621#define IW_ENCODE_ALG_NONE 0
622#define IW_ENCODE_ALG_WEP 1
623#define IW_ENCODE_ALG_TKIP 2
624#define IW_ENCODE_ALG_CCMP 3
625#define IW_ENCODE_ALG_PMK 4
626#define IW_ENCODE_ALG_AES_CMAC 5
627/* struct iw_encode_ext ->ext_flags */
628#define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001
629#define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002
630#define IW_ENCODE_EXT_GROUP_KEY 0x00000004
631#define IW_ENCODE_EXT_SET_TX_KEY 0x00000008
632
633/* IWEVMICHAELMICFAILURE : struct iw_michaelmicfailure ->flags */
634#define IW_MICFAILURE_KEY_ID 0x00000003 /* Key ID 0..3 */
635#define IW_MICFAILURE_GROUP 0x00000004
636#define IW_MICFAILURE_PAIRWISE 0x00000008
637#define IW_MICFAILURE_STAKEY 0x00000010
638#define IW_MICFAILURE_COUNT 0x00000060 /* 1 or 2 (0 = count not supported)
639 */
640
641/* Bit field values for enc_capa in struct iw_range */
642#define IW_ENC_CAPA_WPA 0x00000001
643#define IW_ENC_CAPA_WPA2 0x00000002
644#define IW_ENC_CAPA_CIPHER_TKIP 0x00000004
645#define IW_ENC_CAPA_CIPHER_CCMP 0x00000008
646#define IW_ENC_CAPA_4WAY_HANDSHAKE 0x00000010
647
648/* Event capability macros - in (struct iw_range *)->event_capa
649 * Because we have more than 32 possible events, we use an array of
650 * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */
651#define IW_EVENT_CAPA_BASE(cmd) ((cmd >= SIOCIWFIRSTPRIV) ? \
652 (cmd - SIOCIWFIRSTPRIV + 0x60) : \
653 (cmd - SIOCIWFIRST))
654#define IW_EVENT_CAPA_INDEX(cmd) (IW_EVENT_CAPA_BASE(cmd) >> 5)
655#define IW_EVENT_CAPA_MASK(cmd) (1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F))
656/* Event capability constants - event autogenerated by the kernel
657 * This list is valid for most 802.11 devices, customise as needed... */
658#define IW_EVENT_CAPA_K_0 (IW_EVENT_CAPA_MASK(0x8B04) | \
659 IW_EVENT_CAPA_MASK(0x8B06) | \
660 IW_EVENT_CAPA_MASK(0x8B1A))
661#define IW_EVENT_CAPA_K_1 (IW_EVENT_CAPA_MASK(0x8B2A))
662/* "Easy" macro to set events in iw_range (less efficient) */
663#define IW_EVENT_CAPA_SET(event_capa, cmd) (event_capa[IW_EVENT_CAPA_INDEX(cmd)] |= IW_EVENT_CAPA_MASK(cmd))
664#define IW_EVENT_CAPA_SET_KERNEL(event_capa) {event_capa[0] |= IW_EVENT_CAPA_K_0; event_capa[1] |= IW_EVENT_CAPA_K_1; }
665
666
667/****************************** TYPES ******************************/
668
669/* --------------------------- SUBTYPES --------------------------- */
670/*
671 * Generic format for most parameters that fit in an int
672 */
673struct iw_param
674{
675 __s32 value; /* The value of the parameter itself */
676 __u8 fixed; /* Hardware should not use auto select */
677 __u8 disabled; /* Disable the feature */
678 __u16 flags; /* Various specifc flags (if any) */
679};
680
681/*
682 * For all data larger than 16 octets, we need to use a
683 * pointer to memory allocated in user space.
684 */
685struct iw_point
686{
687 void __user *pointer; /* Pointer to the data (in user space) */
688 __u16 length; /* number of fields or size in bytes */
689 __u16 flags; /* Optional params */
690};
691 13
692#ifdef __KERNEL__
693#ifdef CONFIG_COMPAT 14#ifdef CONFIG_COMPAT
694 15
695#include <linux/compat.h> 16#include <linux/compat.h>
@@ -700,432 +21,6 @@ struct compat_iw_point {
700 __u16 flags; 21 __u16 flags;
701}; 22};
702#endif 23#endif
703#endif
704
705/*
706 * A frequency
707 * For numbers lower than 10^9, we encode the number in 'm' and
708 * set 'e' to 0
709 * For number greater than 10^9, we divide it by the lowest power
710 * of 10 to get 'm' lower than 10^9, with 'm'= f / (10^'e')...
711 * The power of 10 is in 'e', the result of the division is in 'm'.
712 */
713struct iw_freq
714{
715 __s32 m; /* Mantissa */
716 __s16 e; /* Exponent */
717 __u8 i; /* List index (when in range struct) */
718 __u8 flags; /* Flags (fixed/auto) */
719};
720
721/*
722 * Quality of the link
723 */
724struct iw_quality
725{
726 __u8 qual; /* link quality (%retries, SNR,
727 %missed beacons or better...) */
728 __u8 level; /* signal level (dBm) */
729 __u8 noise; /* noise level (dBm) */
730 __u8 updated; /* Flags to know if updated */
731};
732
733/*
734 * Packet discarded in the wireless adapter due to
735 * "wireless" specific problems...
736 * Note : the list of counter and statistics in net_device_stats
737 * is already pretty exhaustive, and you should use that first.
738 * This is only additional stats...
739 */
740struct iw_discarded
741{
742 __u32 nwid; /* Rx : Wrong nwid/essid */
743 __u32 code; /* Rx : Unable to code/decode (WEP) */
744 __u32 fragment; /* Rx : Can't perform MAC reassembly */
745 __u32 retries; /* Tx : Max MAC retries num reached */
746 __u32 misc; /* Others cases */
747};
748
749/*
750 * Packet/Time period missed in the wireless adapter due to
751 * "wireless" specific problems...
752 */
753struct iw_missed
754{
755 __u32 beacon; /* Missed beacons/superframe */
756};
757
758/*
759 * Quality range (for spy threshold)
760 */
761struct iw_thrspy
762{
763 struct sockaddr addr; /* Source address (hw/mac) */
764 struct iw_quality qual; /* Quality of the link */
765 struct iw_quality low; /* Low threshold */
766 struct iw_quality high; /* High threshold */
767};
768
769/*
770 * Optional data for scan request
771 *
772 * Note: these optional parameters are controlling parameters for the
773 * scanning behavior, these do not apply to getting scan results
774 * (SIOCGIWSCAN). Drivers are expected to keep a local BSS table and
775 * provide a merged results with all BSSes even if the previous scan
776 * request limited scanning to a subset, e.g., by specifying an SSID.
777 * Especially, scan results are required to include an entry for the
778 * current BSS if the driver is in Managed mode and associated with an AP.
779 */
780struct iw_scan_req
781{
782 __u8 scan_type; /* IW_SCAN_TYPE_{ACTIVE,PASSIVE} */
783 __u8 essid_len;
784 __u8 num_channels; /* num entries in channel_list;
785 * 0 = scan all allowed channels */
786 __u8 flags; /* reserved as padding; use zero, this may
787 * be used in the future for adding flags
788 * to request different scan behavior */
789 struct sockaddr bssid; /* ff:ff:ff:ff:ff:ff for broadcast BSSID or
790 * individual address of a specific BSS */
791
792 /*
793 * Use this ESSID if IW_SCAN_THIS_ESSID flag is used instead of using
794 * the current ESSID. This allows scan requests for specific ESSID
795 * without having to change the current ESSID and potentially breaking
796 * the current association.
797 */
798 __u8 essid[IW_ESSID_MAX_SIZE];
799
800 /*
801 * Optional parameters for changing the default scanning behavior.
802 * These are based on the MLME-SCAN.request from IEEE Std 802.11.
803 * TU is 1.024 ms. If these are set to 0, driver is expected to use
804 * reasonable default values. min_channel_time defines the time that
805 * will be used to wait for the first reply on each channel. If no
806 * replies are received, next channel will be scanned after this. If
807 * replies are received, total time waited on the channel is defined by
808 * max_channel_time.
809 */
810 __u32 min_channel_time; /* in TU */
811 __u32 max_channel_time; /* in TU */
812
813 struct iw_freq channel_list[IW_MAX_FREQUENCIES];
814};
815
816/* ------------------------- WPA SUPPORT ------------------------- */
817
818/*
819 * Extended data structure for get/set encoding (this is used with
820 * SIOCSIWENCODEEXT/SIOCGIWENCODEEXT. struct iw_point and IW_ENCODE_*
821 * flags are used in the same way as with SIOCSIWENCODE/SIOCGIWENCODE and
822 * only the data contents changes (key data -> this structure, including
823 * key data).
824 *
825 * If the new key is the first group key, it will be set as the default
826 * TX key. Otherwise, default TX key index is only changed if
827 * IW_ENCODE_EXT_SET_TX_KEY flag is set.
828 *
829 * Key will be changed with SIOCSIWENCODEEXT in all cases except for
830 * special "change TX key index" operation which is indicated by setting
831 * key_len = 0 and ext_flags |= IW_ENCODE_EXT_SET_TX_KEY.
832 *
833 * tx_seq/rx_seq are only used when respective
834 * IW_ENCODE_EXT_{TX,RX}_SEQ_VALID flag is set in ext_flags. Normal
835 * TKIP/CCMP operation is to set RX seq with SIOCSIWENCODEEXT and start
836 * TX seq from zero whenever key is changed. SIOCGIWENCODEEXT is normally
837 * used only by an Authenticator (AP or an IBSS station) to get the
838 * current TX sequence number. Using TX_SEQ_VALID for SIOCSIWENCODEEXT and
839 * RX_SEQ_VALID for SIOCGIWENCODEEXT are optional, but can be useful for
840 * debugging/testing.
841 */
842struct iw_encode_ext
843{
844 __u32 ext_flags; /* IW_ENCODE_EXT_* */
845 __u8 tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
846 __u8 rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
847 struct sockaddr addr; /* ff:ff:ff:ff:ff:ff for broadcast/multicast
848 * (group) keys or unicast address for
849 * individual keys */
850 __u16 alg; /* IW_ENCODE_ALG_* */
851 __u16 key_len;
852 __u8 key[0];
853};
854
855/* SIOCSIWMLME data */
856struct iw_mlme
857{
858 __u16 cmd; /* IW_MLME_* */
859 __u16 reason_code;
860 struct sockaddr addr;
861};
862
863/* SIOCSIWPMKSA data */
864#define IW_PMKSA_ADD 1
865#define IW_PMKSA_REMOVE 2
866#define IW_PMKSA_FLUSH 3
867
868#define IW_PMKID_LEN 16
869
870struct iw_pmksa
871{
872 __u32 cmd; /* IW_PMKSA_* */
873 struct sockaddr bssid;
874 __u8 pmkid[IW_PMKID_LEN];
875};
876
877/* IWEVMICHAELMICFAILURE data */
878struct iw_michaelmicfailure
879{
880 __u32 flags;
881 struct sockaddr src_addr;
882 __u8 tsc[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
883};
884
885/* IWEVPMKIDCAND data */
886#define IW_PMKID_CAND_PREAUTH 0x00000001 /* RNS pre-authentication enabled */
887struct iw_pmkid_cand
888{
889 __u32 flags; /* IW_PMKID_CAND_* */
890 __u32 index; /* the smaller the index, the higher the
891 * priority */
892 struct sockaddr bssid;
893};
894
895/* ------------------------ WIRELESS STATS ------------------------ */
896/*
897 * Wireless statistics (used for /proc/net/wireless)
898 */
899struct iw_statistics
900{
901 __u16 status; /* Status
902 * - device dependent for now */
903
904 struct iw_quality qual; /* Quality of the link
905 * (instant/mean/max) */
906 struct iw_discarded discard; /* Packet discarded counts */
907 struct iw_missed miss; /* Packet missed counts */
908};
909
910/* ------------------------ IOCTL REQUEST ------------------------ */
911/*
912 * This structure defines the payload of an ioctl, and is used
913 * below.
914 *
915 * Note that this structure should fit on the memory footprint
916 * of iwreq (which is the same as ifreq), which mean a max size of
917 * 16 octets = 128 bits. Warning, pointers might be 64 bits wide...
918 * You should check this when increasing the structures defined
919 * above in this file...
920 */
921union iwreq_data
922{
923 /* Config - generic */
924 char name[IFNAMSIZ];
925 /* Name : used to verify the presence of wireless extensions.
926 * Name of the protocol/provider... */
927
928 struct iw_point essid; /* Extended network name */
929 struct iw_param nwid; /* network id (or domain - the cell) */
930 struct iw_freq freq; /* frequency or channel :
931 * 0-1000 = channel
932 * > 1000 = frequency in Hz */
933
934 struct iw_param sens; /* signal level threshold */
935 struct iw_param bitrate; /* default bit rate */
936 struct iw_param txpower; /* default transmit power */
937 struct iw_param rts; /* RTS threshold threshold */
938 struct iw_param frag; /* Fragmentation threshold */
939 __u32 mode; /* Operation mode */
940 struct iw_param retry; /* Retry limits & lifetime */
941
942 struct iw_point encoding; /* Encoding stuff : tokens */
943 struct iw_param power; /* PM duration/timeout */
944 struct iw_quality qual; /* Quality part of statistics */
945
946 struct sockaddr ap_addr; /* Access point address */
947 struct sockaddr addr; /* Destination address (hw/mac) */
948
949 struct iw_param param; /* Other small parameters */
950 struct iw_point data; /* Other large parameters */
951};
952
953/*
954 * The structure to exchange data for ioctl.
955 * This structure is the same as 'struct ifreq', but (re)defined for
956 * convenience...
957 * Do I need to remind you about structure size (32 octets) ?
958 */
959struct iwreq
960{
961 union
962 {
963 char ifrn_name[IFNAMSIZ]; /* if name, e.g. "eth0" */
964 } ifr_ifrn;
965
966 /* Data part (defined just above) */
967 union iwreq_data u;
968};
969
970/* -------------------------- IOCTL DATA -------------------------- */
971/*
972 * For those ioctl which want to exchange mode data that what could
973 * fit in the above structure...
974 */
975
976/*
977 * Range of parameters
978 */
979
980struct iw_range
981{
982 /* Informative stuff (to choose between different interface) */
983 __u32 throughput; /* To give an idea... */
984 /* In theory this value should be the maximum benchmarked
985 * TCP/IP throughput, because with most of these devices the
986 * bit rate is meaningless (overhead an co) to estimate how
987 * fast the connection will go and pick the fastest one.
988 * I suggest people to play with Netperf or any benchmark...
989 */
990
991 /* NWID (or domain id) */
992 __u32 min_nwid; /* Minimal NWID we are able to set */
993 __u32 max_nwid; /* Maximal NWID we are able to set */
994
995 /* Old Frequency (backward compat - moved lower ) */
996 __u16 old_num_channels;
997 __u8 old_num_frequency;
998
999 /* Scan capabilities */
1000 __u8 scan_capa; /* IW_SCAN_CAPA_* bit field */
1001
1002 /* Wireless event capability bitmasks */
1003 __u32 event_capa[6];
1004
1005 /* signal level threshold range */
1006 __s32 sensitivity;
1007
1008 /* Quality of link & SNR stuff */
1009 /* Quality range (link, level, noise)
1010 * If the quality is absolute, it will be in the range [0 ; max_qual],
1011 * if the quality is dBm, it will be in the range [max_qual ; 0].
1012 * Don't forget that we use 8 bit arithmetics... */
1013 struct iw_quality max_qual; /* Quality of the link */
1014 /* This should contain the average/typical values of the quality
1015 * indicator. This should be the threshold between a "good" and
1016 * a "bad" link (example : monitor going from green to orange).
1017 * Currently, user space apps like quality monitors don't have any
1018 * way to calibrate the measurement. With this, they can split
1019 * the range between 0 and max_qual in different quality level
1020 * (using a geometric subdivision centered on the average).
1021 * I expect that people doing the user space apps will feedback
1022 * us on which value we need to put in each driver... */
1023 struct iw_quality avg_qual; /* Quality of the link */
1024
1025 /* Rates */
1026 __u8 num_bitrates; /* Number of entries in the list */
1027 __s32 bitrate[IW_MAX_BITRATES]; /* list, in bps */
1028
1029 /* RTS threshold */
1030 __s32 min_rts; /* Minimal RTS threshold */
1031 __s32 max_rts; /* Maximal RTS threshold */
1032
1033 /* Frag threshold */
1034 __s32 min_frag; /* Minimal frag threshold */
1035 __s32 max_frag; /* Maximal frag threshold */
1036
1037 /* Power Management duration & timeout */
1038 __s32 min_pmp; /* Minimal PM period */
1039 __s32 max_pmp; /* Maximal PM period */
1040 __s32 min_pmt; /* Minimal PM timeout */
1041 __s32 max_pmt; /* Maximal PM timeout */
1042 __u16 pmp_flags; /* How to decode max/min PM period */
1043 __u16 pmt_flags; /* How to decode max/min PM timeout */
1044 __u16 pm_capa; /* What PM options are supported */
1045
1046 /* Encoder stuff */
1047 __u16 encoding_size[IW_MAX_ENCODING_SIZES]; /* Different token sizes */
1048 __u8 num_encoding_sizes; /* Number of entry in the list */
1049 __u8 max_encoding_tokens; /* Max number of tokens */
1050 /* For drivers that need a "login/passwd" form */
1051 __u8 encoding_login_index; /* token index for login token */
1052
1053 /* Transmit power */
1054 __u16 txpower_capa; /* What options are supported */
1055 __u8 num_txpower; /* Number of entries in the list */
1056 __s32 txpower[IW_MAX_TXPOWER]; /* list, in bps */
1057
1058 /* Wireless Extension version info */
1059 __u8 we_version_compiled; /* Must be WIRELESS_EXT */
1060 __u8 we_version_source; /* Last update of source */
1061
1062 /* Retry limits and lifetime */
1063 __u16 retry_capa; /* What retry options are supported */
1064 __u16 retry_flags; /* How to decode max/min retry limit */
1065 __u16 r_time_flags; /* How to decode max/min retry life */
1066 __s32 min_retry; /* Minimal number of retries */
1067 __s32 max_retry; /* Maximal number of retries */
1068 __s32 min_r_time; /* Minimal retry lifetime */
1069 __s32 max_r_time; /* Maximal retry lifetime */
1070
1071 /* Frequency */
1072 __u16 num_channels; /* Number of channels [0; num - 1] */
1073 __u8 num_frequency; /* Number of entry in the list */
1074 struct iw_freq freq[IW_MAX_FREQUENCIES]; /* list */
1075 /* Note : this frequency list doesn't need to fit channel numbers,
1076 * because each entry contain its channel index */
1077
1078 __u32 enc_capa; /* IW_ENC_CAPA_* bit field */
1079};
1080
1081/*
1082 * Private ioctl interface information
1083 */
1084
1085struct iw_priv_args
1086{
1087 __u32 cmd; /* Number of the ioctl to issue */
1088 __u16 set_args; /* Type and number of args */
1089 __u16 get_args; /* Type and number of args */
1090 char name[IFNAMSIZ]; /* Name of the extension */
1091};
1092
1093/* ----------------------- WIRELESS EVENTS ----------------------- */
1094/*
1095 * Wireless events are carried through the rtnetlink socket to user
1096 * space. They are encapsulated in the IFLA_WIRELESS field of
1097 * a RTM_NEWLINK message.
1098 */
1099
1100/*
1101 * A Wireless Event. Contains basically the same data as the ioctl...
1102 */
1103struct iw_event
1104{
1105 __u16 len; /* Real length of this stuff */
1106 __u16 cmd; /* Wireless IOCTL */
1107 union iwreq_data u; /* IOCTL fixed payload */
1108};
1109
1110/* Size of the Event prefix (including padding and alignement junk) */
1111#define IW_EV_LCP_LEN (sizeof(struct iw_event) - sizeof(union iwreq_data))
1112/* Size of the various events */
1113#define IW_EV_CHAR_LEN (IW_EV_LCP_LEN + IFNAMSIZ)
1114#define IW_EV_UINT_LEN (IW_EV_LCP_LEN + sizeof(__u32))
1115#define IW_EV_FREQ_LEN (IW_EV_LCP_LEN + sizeof(struct iw_freq))
1116#define IW_EV_PARAM_LEN (IW_EV_LCP_LEN + sizeof(struct iw_param))
1117#define IW_EV_ADDR_LEN (IW_EV_LCP_LEN + sizeof(struct sockaddr))
1118#define IW_EV_QUAL_LEN (IW_EV_LCP_LEN + sizeof(struct iw_quality))
1119
1120/* iw_point events are special. First, the payload (extra data) come at
1121 * the end of the event, so they are bigger than IW_EV_POINT_LEN. Second,
1122 * we omit the pointer, so start at an offset. */
1123#define IW_EV_POINT_OFF (((char *) &(((struct iw_point *) NULL)->length)) - \
1124 (char *) NULL)
1125#define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \
1126 IW_EV_POINT_OFF)
1127
1128#ifdef __KERNEL__
1129#ifdef CONFIG_COMPAT 24#ifdef CONFIG_COMPAT
1130struct __compat_iw_event { 25struct __compat_iw_event {
1131 __u16 len; /* Real length of this stuff */ 26 __u16 len; /* Real length of this stuff */
@@ -1146,17 +41,4 @@ struct __compat_iw_event {
1146 (IW_EV_COMPAT_LCP_LEN + sizeof(struct compat_iw_point) - \ 41 (IW_EV_COMPAT_LCP_LEN + sizeof(struct compat_iw_point) - \
1147 IW_EV_COMPAT_POINT_OFF) 42 IW_EV_COMPAT_POINT_OFF)
1148#endif 43#endif
1149#endif
1150
1151/* Size of the Event prefix when packed in stream */
1152#define IW_EV_LCP_PK_LEN (4)
1153/* Size of the various events when packed in stream */
1154#define IW_EV_CHAR_PK_LEN (IW_EV_LCP_PK_LEN + IFNAMSIZ)
1155#define IW_EV_UINT_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(__u32))
1156#define IW_EV_FREQ_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_freq))
1157#define IW_EV_PARAM_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_param))
1158#define IW_EV_ADDR_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct sockaddr))
1159#define IW_EV_QUAL_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_quality))
1160#define IW_EV_POINT_PK_LEN (IW_EV_LCP_PK_LEN + 4)
1161
1162#endif /* _LINUX_WIRELESS_H */ 44#endif /* _LINUX_WIRELESS_H */
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index cc13e1115970..fdbafc6841cf 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -10,61 +10,11 @@
10#ifndef _LINUX_XATTR_H 10#ifndef _LINUX_XATTR_H
11#define _LINUX_XATTR_H 11#define _LINUX_XATTR_H
12 12
13#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */
14#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
15
16/* Namespaces */
17#define XATTR_OS2_PREFIX "os2."
18#define XATTR_OS2_PREFIX_LEN (sizeof (XATTR_OS2_PREFIX) - 1)
19
20#define XATTR_SECURITY_PREFIX "security."
21#define XATTR_SECURITY_PREFIX_LEN (sizeof (XATTR_SECURITY_PREFIX) - 1)
22
23#define XATTR_SYSTEM_PREFIX "system."
24#define XATTR_SYSTEM_PREFIX_LEN (sizeof (XATTR_SYSTEM_PREFIX) - 1)
25
26#define XATTR_TRUSTED_PREFIX "trusted."
27#define XATTR_TRUSTED_PREFIX_LEN (sizeof (XATTR_TRUSTED_PREFIX) - 1)
28
29#define XATTR_USER_PREFIX "user."
30#define XATTR_USER_PREFIX_LEN (sizeof (XATTR_USER_PREFIX) - 1)
31
32/* Security namespace */
33#define XATTR_EVM_SUFFIX "evm"
34#define XATTR_NAME_EVM XATTR_SECURITY_PREFIX XATTR_EVM_SUFFIX
35
36#define XATTR_IMA_SUFFIX "ima"
37#define XATTR_NAME_IMA XATTR_SECURITY_PREFIX XATTR_IMA_SUFFIX
38
39#define XATTR_SELINUX_SUFFIX "selinux"
40#define XATTR_NAME_SELINUX XATTR_SECURITY_PREFIX XATTR_SELINUX_SUFFIX
41
42#define XATTR_SMACK_SUFFIX "SMACK64"
43#define XATTR_SMACK_IPIN "SMACK64IPIN"
44#define XATTR_SMACK_IPOUT "SMACK64IPOUT"
45#define XATTR_SMACK_EXEC "SMACK64EXEC"
46#define XATTR_SMACK_TRANSMUTE "SMACK64TRANSMUTE"
47#define XATTR_SMACK_MMAP "SMACK64MMAP"
48#define XATTR_NAME_SMACK XATTR_SECURITY_PREFIX XATTR_SMACK_SUFFIX
49#define XATTR_NAME_SMACKIPIN XATTR_SECURITY_PREFIX XATTR_SMACK_IPIN
50#define XATTR_NAME_SMACKIPOUT XATTR_SECURITY_PREFIX XATTR_SMACK_IPOUT
51#define XATTR_NAME_SMACKEXEC XATTR_SECURITY_PREFIX XATTR_SMACK_EXEC
52#define XATTR_NAME_SMACKTRANSMUTE XATTR_SECURITY_PREFIX XATTR_SMACK_TRANSMUTE
53#define XATTR_NAME_SMACKMMAP XATTR_SECURITY_PREFIX XATTR_SMACK_MMAP
54
55#define XATTR_CAPS_SUFFIX "capability"
56#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX
57
58#define XATTR_POSIX_ACL_ACCESS "posix_acl_access"
59#define XATTR_NAME_POSIX_ACL_ACCESS XATTR_SYSTEM_PREFIX XATTR_POSIX_ACL_ACCESS
60#define XATTR_POSIX_ACL_DEFAULT "posix_acl_default"
61#define XATTR_NAME_POSIX_ACL_DEFAULT XATTR_SYSTEM_PREFIX XATTR_POSIX_ACL_DEFAULT
62
63#ifdef __KERNEL__
64 13
65#include <linux/slab.h> 14#include <linux/slab.h>
66#include <linux/types.h> 15#include <linux/types.h>
67#include <linux/spinlock.h> 16#include <linux/spinlock.h>
17#include <uapi/linux/xattr.h>
68 18
69struct inode; 19struct inode;
70struct dentry; 20struct dentry;
@@ -147,6 +97,4 @@ ssize_t simple_xattr_list(struct simple_xattrs *xattrs, char *buffer,
147void simple_xattr_list_add(struct simple_xattrs *xattrs, 97void simple_xattr_list_add(struct simple_xattrs *xattrs,
148 struct simple_xattr *new_xattr); 98 struct simple_xattr *new_xattr);
149 99
150#endif /* __KERNEL__ */
151
152#endif /* _LINUX_XATTR_H */ 100#endif /* _LINUX_XATTR_H */
diff --git a/include/media/ad9389b.h b/include/media/ad9389b.h
new file mode 100644
index 000000000000..5ba9af869b8b
--- /dev/null
+++ b/include/media/ad9389b.h
@@ -0,0 +1,49 @@
1/*
2 * Analog Devices AD9389B/AD9889B video encoder driver header
3 *
4 * Copyright 2012 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
5 *
6 * This program is free software; you may redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
11 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
12 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
13 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
14 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
15 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17 * SOFTWARE.
18 */
19
20#ifndef AD9389B_H
21#define AD9389B_H
22
23enum ad9389b_tmds_pll_gear {
24 AD9389B_TMDS_PLL_GEAR_AUTOMATIC,
25 AD9389B_TMDS_PLL_GEAR_SEMI_AUTOMATIC,
26};
27
28/* Platform dependent definitions */
29struct ad9389b_platform_data {
30 enum ad9389b_tmds_pll_gear tmds_pll_gear ;
31 /* Differential Data/Clock Output Drive Strength (reg. 0xa2/0xa3) */
32 u8 diff_data_drive_strength;
33 u8 diff_clk_drive_strength;
34};
35
36/* notify events */
37#define AD9389B_MONITOR_DETECT 0
38#define AD9389B_EDID_DETECT 1
39
40struct ad9389b_monitor_detect {
41 int present;
42};
43
44struct ad9389b_edid_detect {
45 int present;
46 int segment;
47};
48
49#endif
diff --git a/include/media/adv7604.h b/include/media/adv7604.h
new file mode 100644
index 000000000000..171b957db743
--- /dev/null
+++ b/include/media/adv7604.h
@@ -0,0 +1,153 @@
1/*
2 * adv7604 - Analog Devices ADV7604 video decoder driver
3 *
4 * Copyright 2012 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
5 *
6 * This program is free software; you may redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
11 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
12 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
13 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
14 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
15 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17 * SOFTWARE.
18 *
19 */
20
21#ifndef _ADV7604_
22#define _ADV7604_
23
24/* Analog input muxing modes (AFE register 0x02, [2:0]) */
25enum adv7604_ain_sel {
26 ADV7604_AIN1_2_3_NC_SYNC_1_2 = 0,
27 ADV7604_AIN4_5_6_NC_SYNC_2_1 = 1,
28 ADV7604_AIN7_8_9_NC_SYNC_3_1 = 2,
29 ADV7604_AIN10_11_12_NC_SYNC_4_1 = 3,
30 ADV7604_AIN9_4_5_6_SYNC_2_1 = 4,
31};
32
33/* Bus rotation and reordering (IO register 0x04, [7:5]) */
34enum adv7604_op_ch_sel {
35 ADV7604_OP_CH_SEL_GBR = 0,
36 ADV7604_OP_CH_SEL_GRB = 1,
37 ADV7604_OP_CH_SEL_BGR = 2,
38 ADV7604_OP_CH_SEL_RGB = 3,
39 ADV7604_OP_CH_SEL_BRG = 4,
40 ADV7604_OP_CH_SEL_RBG = 5,
41};
42
43/* Primary mode (IO register 0x01, [3:0]) */
44enum adv7604_prim_mode {
45 ADV7604_PRIM_MODE_COMP = 1,
46 ADV7604_PRIM_MODE_RGB = 2,
47 ADV7604_PRIM_MODE_HDMI_COMP = 5,
48 ADV7604_PRIM_MODE_HDMI_GR = 6,
49};
50
51/* Input Color Space (IO register 0x02, [7:4]) */
52enum adv7604_inp_color_space {
53 ADV7604_INP_COLOR_SPACE_LIM_RGB = 0,
54 ADV7604_INP_COLOR_SPACE_FULL_RGB = 1,
55 ADV7604_INP_COLOR_SPACE_LIM_YCbCr_601 = 2,
56 ADV7604_INP_COLOR_SPACE_LIM_YCbCr_709 = 3,
57 ADV7604_INP_COLOR_SPACE_XVYCC_601 = 4,
58 ADV7604_INP_COLOR_SPACE_XVYCC_709 = 5,
59 ADV7604_INP_COLOR_SPACE_FULL_YCbCr_601 = 6,
60 ADV7604_INP_COLOR_SPACE_FULL_YCbCr_709 = 7,
61 ADV7604_INP_COLOR_SPACE_AUTO = 0xf,
62};
63
64/* Select output format (IO register 0x03, [7:0]) */
65enum adv7604_op_format_sel {
66 ADV7604_OP_FORMAT_SEL_SDR_ITU656_8 = 0x00,
67 ADV7604_OP_FORMAT_SEL_SDR_ITU656_10 = 0x01,
68 ADV7604_OP_FORMAT_SEL_SDR_ITU656_12_MODE0 = 0x02,
69 ADV7604_OP_FORMAT_SEL_SDR_ITU656_12_MODE1 = 0x06,
70 ADV7604_OP_FORMAT_SEL_SDR_ITU656_12_MODE2 = 0x0a,
71 ADV7604_OP_FORMAT_SEL_DDR_422_8 = 0x20,
72 ADV7604_OP_FORMAT_SEL_DDR_422_10 = 0x21,
73 ADV7604_OP_FORMAT_SEL_DDR_422_12_MODE0 = 0x22,
74 ADV7604_OP_FORMAT_SEL_DDR_422_12_MODE1 = 0x23,
75 ADV7604_OP_FORMAT_SEL_DDR_422_12_MODE2 = 0x24,
76 ADV7604_OP_FORMAT_SEL_SDR_444_24 = 0x40,
77 ADV7604_OP_FORMAT_SEL_SDR_444_30 = 0x41,
78 ADV7604_OP_FORMAT_SEL_SDR_444_36_MODE0 = 0x42,
79 ADV7604_OP_FORMAT_SEL_DDR_444_24 = 0x60,
80 ADV7604_OP_FORMAT_SEL_DDR_444_30 = 0x61,
81 ADV7604_OP_FORMAT_SEL_DDR_444_36 = 0x62,
82 ADV7604_OP_FORMAT_SEL_SDR_ITU656_16 = 0x80,
83 ADV7604_OP_FORMAT_SEL_SDR_ITU656_20 = 0x81,
84 ADV7604_OP_FORMAT_SEL_SDR_ITU656_24_MODE0 = 0x82,
85 ADV7604_OP_FORMAT_SEL_SDR_ITU656_24_MODE1 = 0x86,
86 ADV7604_OP_FORMAT_SEL_SDR_ITU656_24_MODE2 = 0x8a,
87};
88
89/* Platform dependent definition */
90struct adv7604_platform_data {
91 /* connector - HDMI or DVI? */
92 unsigned connector_hdmi:1;
93
94 /* DIS_PWRDNB: 1 if the PWRDNB pin is unused and unconnected */
95 unsigned disable_pwrdnb:1;
96
97 /* DIS_CABLE_DET_RST: 1 if the 5V pins are unused and unconnected */
98 unsigned disable_cable_det_rst:1;
99
100 /* Analog input muxing mode */
101 enum adv7604_ain_sel ain_sel;
102
103 /* Bus rotation and reordering */
104 enum adv7604_op_ch_sel op_ch_sel;
105
106 /* Primary mode */
107 enum adv7604_prim_mode prim_mode;
108
109 /* Select output format */
110 enum adv7604_op_format_sel op_format_sel;
111
112 /* IO register 0x02 */
113 unsigned alt_gamma:1;
114 unsigned op_656_range:1;
115 unsigned rgb_out:1;
116 unsigned alt_data_sat:1;
117
118 /* IO register 0x05 */
119 unsigned blank_data:1;
120 unsigned insert_av_codes:1;
121 unsigned replicate_av_codes:1;
122 unsigned invert_cbcr:1;
123
124 /* IO register 0x30 */
125 unsigned output_bus_lsb_to_msb:1;
126
127 /* Free run */
128 unsigned hdmi_free_run_mode;
129
130 /* i2c addresses: 0 == use default */
131 u8 i2c_avlink;
132 u8 i2c_cec;
133 u8 i2c_infoframe;
134 u8 i2c_esdp;
135 u8 i2c_dpp;
136 u8 i2c_afe;
137 u8 i2c_repeater;
138 u8 i2c_edid;
139 u8 i2c_hdmi;
140 u8 i2c_test;
141 u8 i2c_cp;
142 u8 i2c_vdp;
143};
144
145#define V4L2_CID_ADV_RX_ANALOG_SAMPLING_PHASE (V4L2_CID_DV_CLASS_BASE + 0x1000)
146#define V4L2_CID_ADV_RX_FREE_RUN_COLOR_MANUAL (V4L2_CID_DV_CLASS_BASE + 0x1001)
147#define V4L2_CID_ADV_RX_FREE_RUN_COLOR (V4L2_CID_DV_CLASS_BASE + 0x1002)
148
149/* notify events */
150#define ADV7604_HOTPLUG 1
151#define ADV7604_FMT_CHANGE 2
152
153#endif
diff --git a/include/media/davinci/vpbe.h b/include/media/davinci/vpbe.h
index 8bc1b3c0e679..a7ca4884c46c 100644
--- a/include/media/davinci/vpbe.h
+++ b/include/media/davinci/vpbe.h
@@ -35,7 +35,7 @@ struct osd_config_info {
35struct vpbe_output { 35struct vpbe_output {
36 struct v4l2_output output; 36 struct v4l2_output output;
37 /* 37 /*
38 * If output capabilities include dv_preset, list supported presets 38 * If output capabilities include dv_timings, list supported timings
39 * below 39 * below
40 */ 40 */
41 char *subdev_name; 41 char *subdev_name;
@@ -120,16 +120,16 @@ struct vpbe_device_ops {
120 unsigned int (*get_output)(struct vpbe_device *vpbe_dev); 120 unsigned int (*get_output)(struct vpbe_device *vpbe_dev);
121 121
122 /* Set DV preset at current output */ 122 /* Set DV preset at current output */
123 int (*s_dv_preset)(struct vpbe_device *vpbe_dev, 123 int (*s_dv_timings)(struct vpbe_device *vpbe_dev,
124 struct v4l2_dv_preset *dv_preset); 124 struct v4l2_dv_timings *dv_timings);
125 125
126 /* Get DV presets supported at the output */ 126 /* Get DV presets supported at the output */
127 int (*g_dv_preset)(struct vpbe_device *vpbe_dev, 127 int (*g_dv_timings)(struct vpbe_device *vpbe_dev,
128 struct v4l2_dv_preset *dv_preset); 128 struct v4l2_dv_timings *dv_timings);
129 129
130 /* Enumerate the DV Presets supported at the output */ 130 /* Enumerate the DV Presets supported at the output */
131 int (*enum_dv_presets)(struct vpbe_device *vpbe_dev, 131 int (*enum_dv_timings)(struct vpbe_device *vpbe_dev,
132 struct v4l2_dv_enum_preset *preset_info); 132 struct v4l2_enum_dv_timings *timings_info);
133 133
134 /* Set std at the output */ 134 /* Set std at the output */
135 int (*s_std)(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id); 135 int (*s_std)(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id);
diff --git a/include/media/davinci/vpbe_types.h b/include/media/davinci/vpbe_types.h
index 727f55170e41..9b85396514be 100644
--- a/include/media/davinci/vpbe_types.h
+++ b/include/media/davinci/vpbe_types.h
@@ -32,11 +32,6 @@ enum vpbe_enc_timings_type {
32 VPBE_ENC_TIMINGS_INVALID = 0x8, 32 VPBE_ENC_TIMINGS_INVALID = 0x8,
33}; 33};
34 34
35union vpbe_timings {
36 v4l2_std_id std_id;
37 unsigned int dv_preset;
38};
39
40/* 35/*
41 * struct vpbe_enc_mode_info 36 * struct vpbe_enc_mode_info
42 * @name: ptr to name string of the standard, "NTSC", "PAL" etc 37 * @name: ptr to name string of the standard, "NTSC", "PAL" etc
@@ -73,7 +68,8 @@ union vpbe_timings {
73struct vpbe_enc_mode_info { 68struct vpbe_enc_mode_info {
74 unsigned char *name; 69 unsigned char *name;
75 enum vpbe_enc_timings_type timings_type; 70 enum vpbe_enc_timings_type timings_type;
76 union vpbe_timings timings; 71 v4l2_std_id std_id;
72 struct v4l2_dv_timings dv_timings;
77 unsigned int interlaced; 73 unsigned int interlaced;
78 unsigned int xres; 74 unsigned int xres;
79 unsigned int yres; 75 unsigned int yres;
diff --git a/include/media/davinci/vpbe_venc.h b/include/media/davinci/vpbe_venc.h
index 6b57334f4029..cc78c2eb16da 100644
--- a/include/media/davinci/vpbe_venc.h
+++ b/include/media/davinci/vpbe_venc.h
@@ -32,7 +32,7 @@ struct venc_platform_data {
32 int (*setup_pinmux)(enum v4l2_mbus_pixelcode if_type, 32 int (*setup_pinmux)(enum v4l2_mbus_pixelcode if_type,
33 int field); 33 int field);
34 int (*setup_clock)(enum vpbe_enc_timings_type type, 34 int (*setup_clock)(enum vpbe_enc_timings_type type,
35 unsigned int mode); 35 unsigned int pixclock);
36 int (*setup_if_config)(enum v4l2_mbus_pixelcode pixcode); 36 int (*setup_if_config)(enum v4l2_mbus_pixelcode pixcode);
37 /* Number of LCD outputs supported */ 37 /* Number of LCD outputs supported */
38 int num_lcd_outputs; 38 int num_lcd_outputs;
diff --git a/include/media/davinci/vpif_types.h b/include/media/davinci/vpif_types.h
index d8f6ab1943e4..3882e0675ccf 100644
--- a/include/media/davinci/vpif_types.h
+++ b/include/media/davinci/vpif_types.h
@@ -20,6 +20,7 @@
20#include <linux/i2c.h> 20#include <linux/i2c.h>
21 21
22#define VPIF_CAPTURE_MAX_CHANNELS 2 22#define VPIF_CAPTURE_MAX_CHANNELS 2
23#define VPIF_DISPLAY_MAX_CHANNELS 2
23 24
24enum vpif_if_type { 25enum vpif_if_type {
25 VPIF_IF_BT656, 26 VPIF_IF_BT656,
@@ -37,29 +38,38 @@ struct vpif_interface {
37struct vpif_subdev_info { 38struct vpif_subdev_info {
38 const char *name; 39 const char *name;
39 struct i2c_board_info board_info; 40 struct i2c_board_info board_info;
40 u32 input; 41};
41 u32 output; 42
42 unsigned can_route:1; 43struct vpif_output {
43 struct vpif_interface vpif_if; 44 struct v4l2_output output;
45 const char *subdev_name;
46 u32 input_route;
47 u32 output_route;
48};
49
50struct vpif_display_chan_config {
51 const struct vpif_output *outputs;
52 int output_count;
53 bool clip_en;
44}; 54};
45 55
46struct vpif_display_config { 56struct vpif_display_config {
47 int (*set_clock)(int, int); 57 int (*set_clock)(int, int);
48 struct vpif_subdev_info *subdevinfo; 58 struct vpif_subdev_info *subdevinfo;
49 int subdev_count; 59 int subdev_count;
50 const char **output; 60 struct vpif_display_chan_config chan_config[VPIF_DISPLAY_MAX_CHANNELS];
51 int output_count;
52 const char *card_name; 61 const char *card_name;
53 bool ch2_clip_en;
54 bool ch3_clip_en;
55}; 62};
56 63
57struct vpif_input { 64struct vpif_input {
58 struct v4l2_input input; 65 struct v4l2_input input;
59 const char *subdev_name; 66 const char *subdev_name;
67 u32 input_route;
68 u32 output_route;
60}; 69};
61 70
62struct vpif_capture_chan_config { 71struct vpif_capture_chan_config {
72 struct vpif_interface vpif_if;
63 const struct vpif_input *inputs; 73 const struct vpif_input *inputs;
64 int input_count; 74 int input_count;
65}; 75};
diff --git a/include/media/ir-rx51.h b/include/media/ir-rx51.h
new file mode 100644
index 000000000000..104aa892f31b
--- /dev/null
+++ b/include/media/ir-rx51.h
@@ -0,0 +1,10 @@
1#ifndef _LIRC_RX51_H
2#define _LIRC_RX51_H
3
4struct lirc_rx51_platform_data {
5 int pwm_timer;
6
7 int(*set_max_mpu_wakeup_lat)(struct device *dev, long t);
8};
9
10#endif
diff --git a/include/media/mt9v032.h b/include/media/mt9v032.h
index 5e27f9be6b95..78fd39eac219 100644
--- a/include/media/mt9v032.h
+++ b/include/media/mt9v032.h
@@ -7,6 +7,9 @@ struct mt9v032_platform_data {
7 unsigned int clk_pol:1; 7 unsigned int clk_pol:1;
8 8
9 void (*set_clock)(struct v4l2_subdev *subdev, unsigned int rate); 9 void (*set_clock)(struct v4l2_subdev *subdev, unsigned int rate);
10
11 const s64 *link_freqs;
12 s64 link_def_freq;
10}; 13};
11 14
12#endif 15#endif
diff --git a/include/media/omap3isp.h b/include/media/omap3isp.h
index 4d94be5226af..95842696857f 100644
--- a/include/media/omap3isp.h
+++ b/include/media/omap3isp.h
@@ -42,12 +42,6 @@ enum isp_interface_type {
42}; 42};
43 43
44enum { 44enum {
45 ISP_BRIDGE_DISABLE = 0,
46 ISP_BRIDGE_LITTLE_ENDIAN = 2,
47 ISP_BRIDGE_BIG_ENDIAN = 3,
48};
49
50enum {
51 ISP_LANE_SHIFT_0 = 0, 45 ISP_LANE_SHIFT_0 = 0,
52 ISP_LANE_SHIFT_2 = 1, 46 ISP_LANE_SHIFT_2 = 1,
53 ISP_LANE_SHIFT_4 = 2, 47 ISP_LANE_SHIFT_4 = 2,
@@ -67,17 +61,15 @@ enum {
67 * 0 - Active high, 1 - Active low 61 * 0 - Active high, 1 - Active low
68 * @vs_pol: Vertical synchronization polarity 62 * @vs_pol: Vertical synchronization polarity
69 * 0 - Active high, 1 - Active low 63 * 0 - Active high, 1 - Active low
70 * @bridge: CCDC Bridge input control 64 * @data_pol: Data polarity
71 * ISP_BRIDGE_DISABLE - Disable 65 * 0 - Normal, 1 - One's complement
72 * ISP_BRIDGE_LITTLE_ENDIAN - Little endian
73 * ISP_BRIDGE_BIG_ENDIAN - Big endian
74 */ 66 */
75struct isp_parallel_platform_data { 67struct isp_parallel_platform_data {
76 unsigned int data_lane_shift:2; 68 unsigned int data_lane_shift:2;
77 unsigned int clk_pol:1; 69 unsigned int clk_pol:1;
78 unsigned int hs_pol:1; 70 unsigned int hs_pol:1;
79 unsigned int vs_pol:1; 71 unsigned int vs_pol:1;
80 unsigned int bridge:2; 72 unsigned int data_pol:1;
81}; 73};
82 74
83enum { 75enum {
diff --git a/include/media/s5k4ecgx.h b/include/media/s5k4ecgx.h
new file mode 100644
index 000000000000..90c1be792ffe
--- /dev/null
+++ b/include/media/s5k4ecgx.h
@@ -0,0 +1,37 @@
1/*
2 * S5K4ECGX image sensor header file
3 *
4 * Copyright (C) 2012, Linaro
5 * Copyright (C) 2012, Samsung Electronics Co., Ltd.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef S5K4ECGX_H
14#define S5K4ECGX_H
15
16/**
17 * struct s5k4ecgx_gpio - data structure describing a GPIO
18 * @gpio : GPIO number
19 * @level: indicates active state of the @gpio
20 */
21struct s5k4ecgx_gpio {
22 int gpio;
23 int level;
24};
25
26/**
27 * struct ss5k4ecgx_platform_data- s5k4ecgx driver platform data
28 * @gpio_reset: GPIO driving RESET pin
29 * @gpio_stby : GPIO driving STBY pin
30 */
31
32struct s5k4ecgx_platform_data {
33 struct s5k4ecgx_gpio gpio_reset;
34 struct s5k4ecgx_gpio gpio_stby;
35};
36
37#endif /* S5K4ECGX_H */
diff --git a/include/media/s5p_fimc.h b/include/media/s5p_fimc.h
index 8587aaf73646..eaea62a382f8 100644
--- a/include/media/s5p_fimc.h
+++ b/include/media/s5p_fimc.h
@@ -12,6 +12,8 @@
12#ifndef S5P_FIMC_H_ 12#ifndef S5P_FIMC_H_
13#define S5P_FIMC_H_ 13#define S5P_FIMC_H_
14 14
15#include <media/media-entity.h>
16
15enum cam_bus_type { 17enum cam_bus_type {
16 FIMC_ITU_601 = 1, 18 FIMC_ITU_601 = 1,
17 FIMC_ITU_656, 19 FIMC_ITU_656,
@@ -28,7 +30,6 @@ struct i2c_board_info;
28 * @board_info: pointer to I2C subdevice's board info 30 * @board_info: pointer to I2C subdevice's board info
29 * @clk_frequency: frequency of the clock the host interface provides to sensor 31 * @clk_frequency: frequency of the clock the host interface provides to sensor
30 * @bus_type: determines bus type, MIPI, ITU-R BT.601 etc. 32 * @bus_type: determines bus type, MIPI, ITU-R BT.601 etc.
31 * @csi_data_align: MIPI-CSI interface data alignment in bits
32 * @i2c_bus_num: i2c control bus id the sensor is attached to 33 * @i2c_bus_num: i2c control bus id the sensor is attached to
33 * @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU) 34 * @mux_id: FIMC camera interface multiplexer index (separate for MIPI and ITU)
34 * @clk_id: index of the SoC peripheral clock for sensors 35 * @clk_id: index of the SoC peripheral clock for sensors
@@ -38,7 +39,6 @@ struct s5p_fimc_isp_info {
38 struct i2c_board_info *board_info; 39 struct i2c_board_info *board_info;
39 unsigned long clk_frequency; 40 unsigned long clk_frequency;
40 enum cam_bus_type bus_type; 41 enum cam_bus_type bus_type;
41 u16 csi_data_align;
42 u16 i2c_bus_num; 42 u16 i2c_bus_num;
43 u16 mux_id; 43 u16 mux_id;
44 u16 flags; 44 u16 flags;
@@ -80,4 +80,20 @@ struct fimc_pipeline {
80 struct media_pipeline *m_pipeline; 80 struct media_pipeline *m_pipeline;
81}; 81};
82 82
83/*
84 * Media pipeline operations to be called from within the fimc(-lite)
85 * video node when it is the last entity of the pipeline. Implemented
86 * by corresponding media device driver.
87 */
88struct fimc_pipeline_ops {
89 int (*open)(struct fimc_pipeline *p, struct media_entity *me,
90 bool resume);
91 int (*close)(struct fimc_pipeline *p);
92 int (*set_stream)(struct fimc_pipeline *p, bool state);
93};
94
95#define fimc_pipeline_call(f, op, p, args...) \
96 (!(f) ? -ENODEV : (((f)->pipeline_ops && (f)->pipeline_ops->op) ? \
97 (f)->pipeline_ops->op((p), ##args) : -ENOIOCTLCMD))
98
83#endif /* S5P_FIMC_H_ */ 99#endif /* S5P_FIMC_H_ */
diff --git a/include/media/s5p_hdmi.h b/include/media/s5p_hdmi.h
index 361a751f73af..181642b8d0a5 100644
--- a/include/media/s5p_hdmi.h
+++ b/include/media/s5p_hdmi.h
@@ -20,6 +20,7 @@ struct i2c_board_info;
20 * @hdmiphy_info: template for HDMIPHY I2C device 20 * @hdmiphy_info: template for HDMIPHY I2C device
21 * @mhl_bus: controller id for MHL control bus 21 * @mhl_bus: controller id for MHL control bus
22 * @mhl_info: template for MHL I2C device 22 * @mhl_info: template for MHL I2C device
23 * @hpd_gpio: GPIO for Hot-Plug-Detect pin
23 * 24 *
24 * NULL pointer for *_info fields indicates that 25 * NULL pointer for *_info fields indicates that
25 * the corresponding chip is not present 26 * the corresponding chip is not present
@@ -29,6 +30,7 @@ struct s5p_hdmi_platform_data {
29 struct i2c_board_info *hdmiphy_info; 30 struct i2c_board_info *hdmiphy_info;
30 int mhl_bus; 31 int mhl_bus;
31 struct i2c_board_info *mhl_info; 32 struct i2c_board_info *mhl_info;
33 int hpd_gpio;
32}; 34};
33 35
34#endif /* S5P_HDMI_H */ 36#endif /* S5P_HDMI_H */
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index 773e527deabe..96058a5a4acc 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -117,8 +117,6 @@ struct saa7146_dev
117{ 117{
118 struct module *module; 118 struct module *module;
119 119
120 struct list_head item;
121
122 struct v4l2_device v4l2_dev; 120 struct v4l2_device v4l2_dev;
123 struct v4l2_ctrl_handler ctrl_handler; 121 struct v4l2_ctrl_handler ctrl_handler;
124 122
@@ -166,8 +164,6 @@ static inline struct saa7146_dev *to_saa7146_dev(struct v4l2_device *v4l2_dev)
166int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate); 164int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate);
167 165
168/* from saa7146_core.c */ 166/* from saa7146_core.c */
169extern struct list_head saa7146_devices;
170extern struct mutex saa7146_devices_lock;
171int saa7146_register_extension(struct saa7146_extension*); 167int saa7146_register_extension(struct saa7146_extension*);
172int saa7146_unregister_extension(struct saa7146_extension*); 168int saa7146_unregister_extension(struct saa7146_extension*);
173struct saa7146_format* saa7146_format_by_fourcc(struct saa7146_dev *dev, int fourcc); 169struct saa7146_format* saa7146_format_by_fourcc(struct saa7146_dev *dev, int fourcc);
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index d865dcf9879f..6442edc2a151 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -85,12 +85,14 @@ struct soc_camera_host_ops {
85 void (*put_formats)(struct soc_camera_device *); 85 void (*put_formats)(struct soc_camera_device *);
86 int (*cropcap)(struct soc_camera_device *, struct v4l2_cropcap *); 86 int (*cropcap)(struct soc_camera_device *, struct v4l2_cropcap *);
87 int (*get_crop)(struct soc_camera_device *, struct v4l2_crop *); 87 int (*get_crop)(struct soc_camera_device *, struct v4l2_crop *);
88 int (*set_crop)(struct soc_camera_device *, struct v4l2_crop *); 88 int (*set_crop)(struct soc_camera_device *, const struct v4l2_crop *);
89 int (*get_selection)(struct soc_camera_device *, struct v4l2_selection *);
90 int (*set_selection)(struct soc_camera_device *, struct v4l2_selection *);
89 /* 91 /*
90 * The difference to .set_crop() is, that .set_livecrop is not allowed 92 * The difference to .set_crop() is, that .set_livecrop is not allowed
91 * to change the output sizes 93 * to change the output sizes
92 */ 94 */
93 int (*set_livecrop)(struct soc_camera_device *, struct v4l2_crop *); 95 int (*set_livecrop)(struct soc_camera_device *, const struct v4l2_crop *);
94 int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *); 96 int (*set_fmt)(struct soc_camera_device *, struct v4l2_format *);
95 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *); 97 int (*try_fmt)(struct soc_camera_device *, struct v4l2_format *);
96 void (*init_videobuf)(struct videobuf_queue *, 98 void (*init_videobuf)(struct videobuf_queue *,
@@ -254,6 +256,16 @@ unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl,
254unsigned long soc_camera_apply_board_flags(struct soc_camera_link *icl, 256unsigned long soc_camera_apply_board_flags(struct soc_camera_link *icl,
255 const struct v4l2_mbus_config *cfg); 257 const struct v4l2_mbus_config *cfg);
256 258
259int soc_camera_power_on(struct device *dev, struct soc_camera_link *icl);
260int soc_camera_power_off(struct device *dev, struct soc_camera_link *icl);
261
262static inline int soc_camera_set_power(struct device *dev,
263 struct soc_camera_link *icl, bool on)
264{
265 return on ? soc_camera_power_on(dev, icl)
266 : soc_camera_power_off(dev, icl);
267}
268
257/* This is only temporary here - until v4l2-subdev begins to link to video_device */ 269/* This is only temporary here - until v4l2-subdev begins to link to video_device */
258#include <linux/i2c.h> 270#include <linux/i2c.h>
259static inline struct video_device *soc_camera_i2c_to_vdev(const struct i2c_client *client) 271static inline struct video_device *soc_camera_i2c_to_vdev(const struct i2c_client *client)
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index 58f914a40b20..4ee125bae719 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -183,6 +183,9 @@ enum {
183 /* module adv7393: just ident 7393 */ 183 /* module adv7393: just ident 7393 */
184 V4L2_IDENT_ADV7393 = 7393, 184 V4L2_IDENT_ADV7393 = 7393,
185 185
186 /* module adv7604: just ident 7604 */
187 V4L2_IDENT_ADV7604 = 7604,
188
186 /* module saa7706h: just ident 7706 */ 189 /* module saa7706h: just ident 7706 */
187 V4L2_IDENT_SAA7706H = 7706, 190 V4L2_IDENT_SAA7706H = 7706,
188 191
@@ -212,6 +215,9 @@ enum {
212 V4L2_IDENT_CX23888_AV = 8881, /* Integrated A/V decoder */ 215 V4L2_IDENT_CX23888_AV = 8881, /* Integrated A/V decoder */
213 V4L2_IDENT_CX23888_IR = 8882, /* Integrated infrared controller */ 216 V4L2_IDENT_CX23888_IR = 8882, /* Integrated infrared controller */
214 217
218 /* module ad9389b: just ident 9389 */
219 V4L2_IDENT_AD9389B = 9389,
220
215 /* module tda9840: just ident 9840 */ 221 /* module tda9840: just ident 9840 */
216 V4L2_IDENT_TDA9840 = 9840, 222 V4L2_IDENT_TDA9840 = 9840,
217 223
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index a298ec49ddc4..1a0b2db4c5d3 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -133,7 +133,7 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev,
133 struct i2c_adapter *adapter, struct i2c_board_info *info, 133 struct i2c_adapter *adapter, struct i2c_board_info *info,
134 const unsigned short *probe_addrs); 134 const unsigned short *probe_addrs);
135 135
136/* Initialize an v4l2_subdev with data from an i2c_client struct */ 136/* Initialize a v4l2_subdev with data from an i2c_client struct */
137void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client, 137void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client,
138 const struct v4l2_subdev_ops *ops); 138 const struct v4l2_subdev_ops *ops);
139/* Return i2c client address of v4l2_subdev. */ 139/* Return i2c client address of v4l2_subdev. */
@@ -166,7 +166,7 @@ struct spi_device;
166struct v4l2_subdev *v4l2_spi_new_subdev(struct v4l2_device *v4l2_dev, 166struct v4l2_subdev *v4l2_spi_new_subdev(struct v4l2_device *v4l2_dev,
167 struct spi_master *master, struct spi_board_info *info); 167 struct spi_master *master, struct spi_board_info *info);
168 168
169/* Initialize an v4l2_subdev with data from an spi_device struct */ 169/* Initialize a v4l2_subdev with data from an spi_device struct */
170void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi, 170void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi,
171 const struct v4l2_subdev_ops *ops); 171 const struct v4l2_subdev_ops *ops);
172#endif 172#endif
@@ -212,4 +212,17 @@ const struct v4l2_frmsize_discrete *v4l2_find_nearest_format(
212 const struct v4l2_discrete_probe *probe, 212 const struct v4l2_discrete_probe *probe,
213 s32 width, s32 height); 213 s32 width, s32 height);
214 214
215bool v4l_match_dv_timings(const struct v4l2_dv_timings *t1,
216 const struct v4l2_dv_timings *t2,
217 unsigned pclock_delta);
218
219bool v4l2_detect_cvt(unsigned frame_height, unsigned hfreq, unsigned vsync,
220 u32 polarities, struct v4l2_dv_timings *fmt);
221
222bool v4l2_detect_gtf(unsigned frame_height, unsigned hfreq, unsigned vsync,
223 u32 polarities, struct v4l2_fract aspect,
224 struct v4l2_dv_timings *fmt);
225
226struct v4l2_fract v4l2_calc_aspect_ratio(u8 hor_landscape, u8 vert_portrait);
227
215#endif /* V4L2_COMMON_H_ */ 228#endif /* V4L2_COMMON_H_ */
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 776605f1cbe2..96509119f28f 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -351,6 +351,29 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
351 const struct v4l2_ctrl_ops *ops, 351 const struct v4l2_ctrl_ops *ops,
352 u32 id, s32 max, s32 mask, s32 def); 352 u32 id, s32 max, s32 mask, s32 def);
353 353
354/** v4l2_ctrl_new_std_menu_items() - Create a new standard V4L2 menu control
355 * with driver specific menu.
356 * @hdl: The control handler.
357 * @ops: The control ops.
358 * @id: The control ID.
359 * @max: The control's maximum value.
360 * @mask: The control's skip mask for menu controls. This makes it
361 * easy to skip menu items that are not valid. If bit X is set,
362 * then menu item X is skipped. Of course, this only works for
363 * menus with <= 32 menu items. There are no menus that come
364 * close to that number, so this is OK. Should we ever need more,
365 * then this will have to be extended to a u64 or a bit array.
366 * @def: The control's default value.
367 * @qmenu: The new menu.
368 *
369 * Same as v4l2_ctrl_new_std_menu(), but @qmenu will be the driver specific
370 * menu of this control.
371 *
372 */
373struct v4l2_ctrl *v4l2_ctrl_new_std_menu_items(struct v4l2_ctrl_handler *hdl,
374 const struct v4l2_ctrl_ops *ops, u32 id, s32 max,
375 s32 mask, s32 def, const char * const *qmenu);
376
354/** v4l2_ctrl_new_int_menu() - Create a new standard V4L2 integer menu control. 377/** v4l2_ctrl_new_int_menu() - Create a new standard V4L2 integer menu control.
355 * @hdl: The control handler. 378 * @hdl: The control handler.
356 * @ops: The control ops. 379 * @ops: The control ops.
@@ -384,14 +407,28 @@ struct v4l2_ctrl *v4l2_ctrl_add_ctrl(struct v4l2_ctrl_handler *hdl,
384 * @hdl: The control handler. 407 * @hdl: The control handler.
385 * @add: The control handler whose controls you want to add to 408 * @add: The control handler whose controls you want to add to
386 * the @hdl control handler. 409 * the @hdl control handler.
410 * @filter: This function will filter which controls should be added.
387 * 411 *
388 * Does nothing if either of the two is a NULL pointer. 412 * Does nothing if either of the two handlers is a NULL pointer.
413 * If @filter is NULL, then all controls are added. Otherwise only those
414 * controls for which @filter returns true will be added.
389 * In case of an error @hdl->error will be set to the error code (if it 415 * In case of an error @hdl->error will be set to the error code (if it
390 * wasn't set already). 416 * wasn't set already).
391 */ 417 */
392int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl, 418int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl,
393 struct v4l2_ctrl_handler *add); 419 struct v4l2_ctrl_handler *add,
420 bool (*filter)(const struct v4l2_ctrl *ctrl));
394 421
422/** v4l2_ctrl_radio_filter() - Standard filter for radio controls.
423 * @ctrl: The control that is filtered.
424 *
425 * This will return true for any controls that are valid for radio device
426 * nodes. Those are all of the V4L2_CID_AUDIO_* user controls and all FM
427 * transmitter class controls.
428 *
429 * This function is to be used with v4l2_ctrl_add_handler().
430 */
431bool v4l2_ctrl_radio_filter(const struct v4l2_ctrl *ctrl);
395 432
396/** v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging to that cluster. 433/** v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging to that cluster.
397 * @ncontrols: The number of controls in this cluster. 434 * @ncontrols: The number of controls in this cluster.
@@ -511,6 +548,29 @@ s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl);
511 */ 548 */
512int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val); 549int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val);
513 550
551/** v4l2_ctrl_g_ctrl_int64() - Helper function to get a 64-bit control's value from within a driver.
552 * @ctrl: The control.
553 *
554 * This returns the control's value safely by going through the control
555 * framework. This function will lock the control's handler, so it cannot be
556 * used from within the &v4l2_ctrl_ops functions.
557 *
558 * This function is for 64-bit integer type controls only.
559 */
560s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *ctrl);
561
562/** v4l2_ctrl_s_ctrl_int64() - Helper function to set a 64-bit control's value from within a driver.
563 * @ctrl: The control.
564 * @val: The new value.
565 *
566 * This set the control's new value safely by going through the control
567 * framework. This function will lock the control's handler, so it cannot be
568 * used from within the &v4l2_ctrl_ops functions.
569 *
570 * This function is for 64-bit integer type controls only.
571 */
572int v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val);
573
514/* Internal helper functions that deal with control events. */ 574/* Internal helper functions that deal with control events. */
515extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops; 575extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops;
516void v4l2_ctrl_replace(struct v4l2_event *old, const struct v4l2_event *new); 576void v4l2_ctrl_replace(struct v4l2_event *old, const struct v4l2_event *new);
@@ -523,7 +583,7 @@ int v4l2_ctrl_log_status(struct file *file, void *fh);
523/* Can be used as a vidioc_subscribe_event function that just subscribes 583/* Can be used as a vidioc_subscribe_event function that just subscribes
524 control events. */ 584 control events. */
525int v4l2_ctrl_subscribe_event(struct v4l2_fh *fh, 585int v4l2_ctrl_subscribe_event(struct v4l2_fh *fh,
526 struct v4l2_event_subscription *sub); 586 const struct v4l2_event_subscription *sub);
527 587
528/* Can be used as a poll function that just polls for control events. */ 588/* Can be used as a poll function that just polls for control events. */
529unsigned int v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait); 589unsigned int v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait);
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 5c416cdc88d5..95d1c91770f4 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -26,6 +26,12 @@
26#define VFL_TYPE_SUBDEV 3 26#define VFL_TYPE_SUBDEV 3
27#define VFL_TYPE_MAX 4 27#define VFL_TYPE_MAX 4
28 28
29/* Is this a receiver, transmitter or mem-to-mem? */
30/* Ignored for VFL_TYPE_SUBDEV. */
31#define VFL_DIR_RX 0
32#define VFL_DIR_TX 1
33#define VFL_DIR_M2M 2
34
29struct v4l2_ioctl_callbacks; 35struct v4l2_ioctl_callbacks;
30struct video_device; 36struct video_device;
31struct v4l2_device; 37struct v4l2_device;
@@ -39,9 +45,6 @@ struct v4l2_ctrl_handler;
39#define V4L2_FL_USES_V4L2_FH (1) 45#define V4L2_FL_USES_V4L2_FH (1)
40/* Use the prio field of v4l2_fh for core priority checking */ 46/* Use the prio field of v4l2_fh for core priority checking */
41#define V4L2_FL_USE_FH_PRIO (2) 47#define V4L2_FL_USE_FH_PRIO (2)
42/* If ioctl core locking is in use, then apply that also to all
43 file operations. Don't use this flag in new drivers! */
44#define V4L2_FL_LOCK_ALL_FOPS (3)
45 48
46/* Priority helper functions */ 49/* Priority helper functions */
47 50
@@ -108,7 +111,8 @@ struct video_device
108 111
109 /* device info */ 112 /* device info */
110 char name[32]; 113 char name[32];
111 int vfl_type; 114 int vfl_type; /* device type */
115 int vfl_dir; /* receiver, transmitter or m2m */
112 /* 'minor' is set to -1 if the registration failed */ 116 /* 'minor' is set to -1 if the registration failed */
113 int minor; 117 int minor;
114 u16 num; 118 u16 num;
diff --git a/include/media/v4l2-event.h b/include/media/v4l2-event.h
index 2885a810a128..e7c5d170a9cd 100644
--- a/include/media/v4l2-event.h
+++ b/include/media/v4l2-event.h
@@ -124,10 +124,10 @@ void v4l2_event_queue(struct video_device *vdev, const struct v4l2_event *ev);
124void v4l2_event_queue_fh(struct v4l2_fh *fh, const struct v4l2_event *ev); 124void v4l2_event_queue_fh(struct v4l2_fh *fh, const struct v4l2_event *ev);
125int v4l2_event_pending(struct v4l2_fh *fh); 125int v4l2_event_pending(struct v4l2_fh *fh);
126int v4l2_event_subscribe(struct v4l2_fh *fh, 126int v4l2_event_subscribe(struct v4l2_fh *fh,
127 struct v4l2_event_subscription *sub, unsigned elems, 127 const struct v4l2_event_subscription *sub, unsigned elems,
128 const struct v4l2_subscribed_event_ops *ops); 128 const struct v4l2_subscribed_event_ops *ops);
129int v4l2_event_unsubscribe(struct v4l2_fh *fh, 129int v4l2_event_unsubscribe(struct v4l2_fh *fh,
130 struct v4l2_event_subscription *sub); 130 const struct v4l2_event_subscription *sub);
131void v4l2_event_unsubscribe_all(struct v4l2_fh *fh); 131void v4l2_event_unsubscribe_all(struct v4l2_fh *fh);
132 132
133#endif /* V4L2_EVENT_H */ 133#endif /* V4L2_EVENT_H */
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index e614c9c15e56..e48b571ca37d 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -40,8 +40,6 @@ struct v4l2_ioctl_ops {
40 struct v4l2_fmtdesc *f); 40 struct v4l2_fmtdesc *f);
41 int (*vidioc_enum_fmt_vid_out_mplane)(struct file *file, void *fh, 41 int (*vidioc_enum_fmt_vid_out_mplane)(struct file *file, void *fh,
42 struct v4l2_fmtdesc *f); 42 struct v4l2_fmtdesc *f);
43 int (*vidioc_enum_fmt_type_private)(struct file *file, void *fh,
44 struct v4l2_fmtdesc *f);
45 43
46 /* VIDIOC_G_FMT handlers */ 44 /* VIDIOC_G_FMT handlers */
47 int (*vidioc_g_fmt_vid_cap) (struct file *file, void *fh, 45 int (*vidioc_g_fmt_vid_cap) (struct file *file, void *fh,
@@ -64,8 +62,6 @@ struct v4l2_ioctl_ops {
64 struct v4l2_format *f); 62 struct v4l2_format *f);
65 int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh, 63 int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh,
66 struct v4l2_format *f); 64 struct v4l2_format *f);
67 int (*vidioc_g_fmt_type_private)(struct file *file, void *fh,
68 struct v4l2_format *f);
69 65
70 /* VIDIOC_S_FMT handlers */ 66 /* VIDIOC_S_FMT handlers */
71 int (*vidioc_s_fmt_vid_cap) (struct file *file, void *fh, 67 int (*vidioc_s_fmt_vid_cap) (struct file *file, void *fh,
@@ -88,8 +84,6 @@ struct v4l2_ioctl_ops {
88 struct v4l2_format *f); 84 struct v4l2_format *f);
89 int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh, 85 int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh,
90 struct v4l2_format *f); 86 struct v4l2_format *f);
91 int (*vidioc_s_fmt_type_private)(struct file *file, void *fh,
92 struct v4l2_format *f);
93 87
94 /* VIDIOC_TRY_FMT handlers */ 88 /* VIDIOC_TRY_FMT handlers */
95 int (*vidioc_try_fmt_vid_cap) (struct file *file, void *fh, 89 int (*vidioc_try_fmt_vid_cap) (struct file *file, void *fh,
@@ -112,8 +106,6 @@ struct v4l2_ioctl_ops {
112 struct v4l2_format *f); 106 struct v4l2_format *f);
113 int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh, 107 int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh,
114 struct v4l2_format *f); 108 struct v4l2_format *f);
115 int (*vidioc_try_fmt_type_private)(struct file *file, void *fh,
116 struct v4l2_format *f);
117 109
118 /* Buffer handlers */ 110 /* Buffer handlers */
119 int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b); 111 int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b);
@@ -128,7 +120,7 @@ struct v4l2_ioctl_ops {
128 int (*vidioc_g_fbuf) (struct file *file, void *fh, 120 int (*vidioc_g_fbuf) (struct file *file, void *fh,
129 struct v4l2_framebuffer *a); 121 struct v4l2_framebuffer *a);
130 int (*vidioc_s_fbuf) (struct file *file, void *fh, 122 int (*vidioc_s_fbuf) (struct file *file, void *fh,
131 struct v4l2_framebuffer *a); 123 const struct v4l2_framebuffer *a);
132 124
133 /* Stream on/off */ 125 /* Stream on/off */
134 int (*vidioc_streamon) (struct file *file, void *fh, enum v4l2_buf_type i); 126 int (*vidioc_streamon) (struct file *file, void *fh, enum v4l2_buf_type i);
@@ -175,7 +167,7 @@ struct v4l2_ioctl_ops {
175 int (*vidioc_g_audio) (struct file *file, void *fh, 167 int (*vidioc_g_audio) (struct file *file, void *fh,
176 struct v4l2_audio *a); 168 struct v4l2_audio *a);
177 int (*vidioc_s_audio) (struct file *file, void *fh, 169 int (*vidioc_s_audio) (struct file *file, void *fh,
178 struct v4l2_audio *a); 170 const struct v4l2_audio *a);
179 171
180 /* Audio out ioctls */ 172 /* Audio out ioctls */
181 int (*vidioc_enumaudout) (struct file *file, void *fh, 173 int (*vidioc_enumaudout) (struct file *file, void *fh,
@@ -183,18 +175,18 @@ struct v4l2_ioctl_ops {
183 int (*vidioc_g_audout) (struct file *file, void *fh, 175 int (*vidioc_g_audout) (struct file *file, void *fh,
184 struct v4l2_audioout *a); 176 struct v4l2_audioout *a);
185 int (*vidioc_s_audout) (struct file *file, void *fh, 177 int (*vidioc_s_audout) (struct file *file, void *fh,
186 struct v4l2_audioout *a); 178 const struct v4l2_audioout *a);
187 int (*vidioc_g_modulator) (struct file *file, void *fh, 179 int (*vidioc_g_modulator) (struct file *file, void *fh,
188 struct v4l2_modulator *a); 180 struct v4l2_modulator *a);
189 int (*vidioc_s_modulator) (struct file *file, void *fh, 181 int (*vidioc_s_modulator) (struct file *file, void *fh,
190 struct v4l2_modulator *a); 182 const struct v4l2_modulator *a);
191 /* Crop ioctls */ 183 /* Crop ioctls */
192 int (*vidioc_cropcap) (struct file *file, void *fh, 184 int (*vidioc_cropcap) (struct file *file, void *fh,
193 struct v4l2_cropcap *a); 185 struct v4l2_cropcap *a);
194 int (*vidioc_g_crop) (struct file *file, void *fh, 186 int (*vidioc_g_crop) (struct file *file, void *fh,
195 struct v4l2_crop *a); 187 struct v4l2_crop *a);
196 int (*vidioc_s_crop) (struct file *file, void *fh, 188 int (*vidioc_s_crop) (struct file *file, void *fh,
197 struct v4l2_crop *a); 189 const struct v4l2_crop *a);
198 int (*vidioc_g_selection) (struct file *file, void *fh, 190 int (*vidioc_g_selection) (struct file *file, void *fh,
199 struct v4l2_selection *s); 191 struct v4l2_selection *s);
200 int (*vidioc_s_selection) (struct file *file, void *fh, 192 int (*vidioc_s_selection) (struct file *file, void *fh,
@@ -203,7 +195,7 @@ struct v4l2_ioctl_ops {
203 int (*vidioc_g_jpegcomp) (struct file *file, void *fh, 195 int (*vidioc_g_jpegcomp) (struct file *file, void *fh,
204 struct v4l2_jpegcompression *a); 196 struct v4l2_jpegcompression *a);
205 int (*vidioc_s_jpegcomp) (struct file *file, void *fh, 197 int (*vidioc_s_jpegcomp) (struct file *file, void *fh,
206 struct v4l2_jpegcompression *a); 198 const struct v4l2_jpegcompression *a);
207 int (*vidioc_g_enc_index) (struct file *file, void *fh, 199 int (*vidioc_g_enc_index) (struct file *file, void *fh,
208 struct v4l2_enc_idx *a); 200 struct v4l2_enc_idx *a);
209 int (*vidioc_encoder_cmd) (struct file *file, void *fh, 201 int (*vidioc_encoder_cmd) (struct file *file, void *fh,
@@ -241,7 +233,7 @@ struct v4l2_ioctl_ops {
241 int (*vidioc_log_status) (struct file *file, void *fh); 233 int (*vidioc_log_status) (struct file *file, void *fh);
242 234
243 int (*vidioc_s_hw_freq_seek) (struct file *file, void *fh, 235 int (*vidioc_s_hw_freq_seek) (struct file *file, void *fh,
244 struct v4l2_hw_freq_seek *a); 236 const struct v4l2_hw_freq_seek *a);
245 237
246 /* Debugging ioctls */ 238 /* Debugging ioctls */
247#ifdef CONFIG_VIDEO_ADV_DEBUG 239#ifdef CONFIG_VIDEO_ADV_DEBUG
@@ -281,9 +273,9 @@ struct v4l2_ioctl_ops {
281 struct v4l2_dv_timings_cap *cap); 273 struct v4l2_dv_timings_cap *cap);
282 274
283 int (*vidioc_subscribe_event) (struct v4l2_fh *fh, 275 int (*vidioc_subscribe_event) (struct v4l2_fh *fh,
284 struct v4l2_event_subscription *sub); 276 const struct v4l2_event_subscription *sub);
285 int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh, 277 int (*vidioc_unsubscribe_event)(struct v4l2_fh *fh,
286 struct v4l2_event_subscription *sub); 278 const struct v4l2_event_subscription *sub);
287 279
288 /* For other private ioctls */ 280 /* For other private ioctls */
289 long (*vidioc_default) (struct file *file, void *fh, 281 long (*vidioc_default) (struct file *file, void *fh,
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
index 16ac4733e80d..131cc4a53675 100644
--- a/include/media/v4l2-mem2mem.h
+++ b/include/media/v4l2-mem2mem.h
@@ -140,7 +140,7 @@ void v4l2_m2m_buf_queue(struct v4l2_m2m_ctx *m2m_ctx, struct vb2_buffer *vb);
140static inline 140static inline
141unsigned int v4l2_m2m_num_src_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx) 141unsigned int v4l2_m2m_num_src_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx)
142{ 142{
143 return m2m_ctx->cap_q_ctx.num_rdy; 143 return m2m_ctx->out_q_ctx.num_rdy;
144} 144}
145 145
146/** 146/**
@@ -150,7 +150,7 @@ unsigned int v4l2_m2m_num_src_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx)
150static inline 150static inline
151unsigned int v4l2_m2m_num_dst_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx) 151unsigned int v4l2_m2m_num_dst_bufs_ready(struct v4l2_m2m_ctx *m2m_ctx)
152{ 152{
153 return m2m_ctx->out_q_ctx.num_rdy; 153 return m2m_ctx->cap_q_ctx.num_rdy;
154} 154}
155 155
156void *v4l2_m2m_next_buf(struct v4l2_m2m_queue_ctx *q_ctx); 156void *v4l2_m2m_next_buf(struct v4l2_m2m_queue_ctx *q_ctx);
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index c35a3545e273..b137a5e1151a 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -21,6 +21,7 @@
21#ifndef _V4L2_SUBDEV_H 21#ifndef _V4L2_SUBDEV_H
22#define _V4L2_SUBDEV_H 22#define _V4L2_SUBDEV_H
23 23
24#include <linux/types.h>
24#include <linux/v4l2-subdev.h> 25#include <linux/v4l2-subdev.h>
25#include <media/media-entity.h> 26#include <media/media-entity.h>
26#include <media/v4l2-common.h> 27#include <media/v4l2-common.h>
@@ -45,6 +46,7 @@ struct v4l2_fh;
45struct v4l2_subdev; 46struct v4l2_subdev;
46struct v4l2_subdev_fh; 47struct v4l2_subdev_fh;
47struct tuner_setup; 48struct tuner_setup;
49struct v4l2_mbus_frame_desc;
48 50
49/* decode_vbi_line */ 51/* decode_vbi_line */
50struct v4l2_decode_vbi_line { 52struct v4l2_decode_vbi_line {
@@ -120,7 +122,7 @@ struct v4l2_subdev_io_pin_config {
120 each pin being configured. This function could be called at times 122 each pin being configured. This function could be called at times
121 other than just subdevice initialization. 123 other than just subdevice initialization.
122 124
123 init: initialize the sensor registors to some sort of reasonable default 125 init: initialize the sensor registers to some sort of reasonable default
124 values. Do not use for new drivers and should be removed in existing 126 values. Do not use for new drivers and should be removed in existing
125 drivers. 127 drivers.
126 128
@@ -194,7 +196,7 @@ struct v4l2_subdev_tuner_ops {
194 int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt); 196 int (*g_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
195 int (*s_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt); 197 int (*s_tuner)(struct v4l2_subdev *sd, struct v4l2_tuner *vt);
196 int (*g_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm); 198 int (*g_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm);
197 int (*s_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm); 199 int (*s_modulator)(struct v4l2_subdev *sd, const struct v4l2_modulator *vm);
198 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type); 200 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type);
199 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config); 201 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config);
200}; 202};
@@ -226,6 +228,36 @@ struct v4l2_subdev_audio_ops {
226 int (*s_stream)(struct v4l2_subdev *sd, int enable); 228 int (*s_stream)(struct v4l2_subdev *sd, int enable);
227}; 229};
228 230
231/* Indicates the @length field specifies maximum data length. */
232#define V4L2_MBUS_FRAME_DESC_FL_LEN_MAX (1U << 0)
233/* Indicates user defined data format, i.e. non standard frame format. */
234#define V4L2_MBUS_FRAME_DESC_FL_BLOB (1U << 1)
235
236/**
237 * struct v4l2_mbus_frame_desc_entry - media bus frame description structure
238 * @flags: V4L2_MBUS_FRAME_DESC_FL_* flags
239 * @pixelcode: media bus pixel code, valid if FRAME_DESC_FL_BLOB is not set
240 * @length: number of octets per frame, valid for compressed or unspecified
241 * formats
242 */
243struct v4l2_mbus_frame_desc_entry {
244 u16 flags;
245 u32 pixelcode;
246 u32 length;
247};
248
249#define V4L2_FRAME_DESC_ENTRY_MAX 4
250
251/**
252 * struct v4l2_mbus_frame_desc - media bus data frame description
253 * @entry: frame descriptors array
254 * @num_entries: number of entries in @entry array
255 */
256struct v4l2_mbus_frame_desc {
257 struct v4l2_mbus_frame_desc_entry entry[V4L2_FRAME_DESC_ENTRY_MAX];
258 unsigned short num_entries;
259};
260
229/* 261/*
230 s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by 262 s_std_output: set v4l2_std_id for video OUTPUT devices. This is ignored by
231 video input devices. 263 video input devices.
@@ -274,6 +306,10 @@ struct v4l2_subdev_audio_ops {
274 s_mbus_config: set a certain mediabus configuration. This operation is added 306 s_mbus_config: set a certain mediabus configuration. This operation is added
275 for compatibility with soc-camera drivers and should not be used by new 307 for compatibility with soc-camera drivers and should not be used by new
276 software. 308 software.
309
310 s_rx_buffer: set a host allocated memory buffer for the subdev. The subdev
311 can adjust @size to a lower value and must not write more data to the
312 buffer starting at @data than the original value of @size.
277 */ 313 */
278struct v4l2_subdev_video_ops { 314struct v4l2_subdev_video_ops {
279 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config); 315 int (*s_routing)(struct v4l2_subdev *sd, u32 input, u32 output, u32 config);
@@ -286,7 +322,7 @@ struct v4l2_subdev_video_ops {
286 int (*s_stream)(struct v4l2_subdev *sd, int enable); 322 int (*s_stream)(struct v4l2_subdev *sd, int enable);
287 int (*cropcap)(struct v4l2_subdev *sd, struct v4l2_cropcap *cc); 323 int (*cropcap)(struct v4l2_subdev *sd, struct v4l2_cropcap *cc);
288 int (*g_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop); 324 int (*g_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop);
289 int (*s_crop)(struct v4l2_subdev *sd, struct v4l2_crop *crop); 325 int (*s_crop)(struct v4l2_subdev *sd, const struct v4l2_crop *crop);
290 int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); 326 int (*g_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
291 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param); 327 int (*s_parm)(struct v4l2_subdev *sd, struct v4l2_streamparm *param);
292 int (*g_frame_interval)(struct v4l2_subdev *sd, 328 int (*g_frame_interval)(struct v4l2_subdev *sd,
@@ -327,6 +363,8 @@ struct v4l2_subdev_video_ops {
327 struct v4l2_mbus_config *cfg); 363 struct v4l2_mbus_config *cfg);
328 int (*s_mbus_config)(struct v4l2_subdev *sd, 364 int (*s_mbus_config)(struct v4l2_subdev *sd,
329 const struct v4l2_mbus_config *cfg); 365 const struct v4l2_mbus_config *cfg);
366 int (*s_rx_buffer)(struct v4l2_subdev *sd, void *buf,
367 unsigned int *size);
330}; 368};
331 369
332/* 370/*
@@ -455,6 +493,12 @@ struct v4l2_subdev_ir_ops {
455 struct v4l2_subdev_ir_parameters *params); 493 struct v4l2_subdev_ir_parameters *params);
456}; 494};
457 495
496/**
497 * struct v4l2_subdev_pad_ops - v4l2-subdev pad level operations
498 * @get_frame_desc: get the current low level media bus frame parameters.
499 * @get_frame_desc: set the low level media bus frame parameters, @fd array
500 * may be adjusted by the subdev driver to device capabilities.
501 */
458struct v4l2_subdev_pad_ops { 502struct v4l2_subdev_pad_ops {
459 int (*enum_mbus_code)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 503 int (*enum_mbus_code)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
460 struct v4l2_subdev_mbus_code_enum *code); 504 struct v4l2_subdev_mbus_code_enum *code);
@@ -476,11 +520,17 @@ struct v4l2_subdev_pad_ops {
476 struct v4l2_subdev_selection *sel); 520 struct v4l2_subdev_selection *sel);
477 int (*set_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 521 int (*set_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
478 struct v4l2_subdev_selection *sel); 522 struct v4l2_subdev_selection *sel);
523 int (*get_edid)(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid);
524 int (*set_edid)(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid);
479#ifdef CONFIG_MEDIA_CONTROLLER 525#ifdef CONFIG_MEDIA_CONTROLLER
480 int (*link_validate)(struct v4l2_subdev *sd, struct media_link *link, 526 int (*link_validate)(struct v4l2_subdev *sd, struct media_link *link,
481 struct v4l2_subdev_format *source_fmt, 527 struct v4l2_subdev_format *source_fmt,
482 struct v4l2_subdev_format *sink_fmt); 528 struct v4l2_subdev_format *sink_fmt);
483#endif /* CONFIG_MEDIA_CONTROLLER */ 529#endif /* CONFIG_MEDIA_CONTROLLER */
530 int (*get_frame_desc)(struct v4l2_subdev *sd, unsigned int pad,
531 struct v4l2_mbus_frame_desc *fd);
532 int (*set_frame_desc)(struct v4l2_subdev *sd, unsigned int pad,
533 struct v4l2_mbus_frame_desc *fd);
484}; 534};
485 535
486struct v4l2_subdev_ops { 536struct v4l2_subdev_ops {
diff --git a/include/media/videobuf-dvb.h b/include/media/videobuf-dvb.h
index bf365721d6b0..d63965a1faaf 100644
--- a/include/media/videobuf-dvb.h
+++ b/include/media/videobuf-dvb.h
@@ -45,9 +45,7 @@ int videobuf_dvb_register_bus(struct videobuf_dvb_frontends *f,
45 void *adapter_priv, 45 void *adapter_priv,
46 struct device *device, 46 struct device *device,
47 short *adapter_nr, 47 short *adapter_nr,
48 int mfe_shared, 48 int mfe_shared);
49 int (*fe_ioctl_override)(struct dvb_frontend *,
50 unsigned int, void *, unsigned int));
51 49
52void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f); 50void videobuf_dvb_unregister_bus(struct videobuf_dvb_frontends *f);
53 51
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index 8dd9b6cc296b..e04252a9fea6 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -324,7 +324,7 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req);
324int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create); 324int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create);
325int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b); 325int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b);
326 326
327int vb2_queue_init(struct vb2_queue *q); 327int __must_check vb2_queue_init(struct vb2_queue *q);
328 328
329void vb2_queue_release(struct vb2_queue *q); 329void vb2_queue_release(struct vb2_queue *q);
330 330
diff --git a/include/mtd/Kbuild b/include/mtd/Kbuild
deleted file mode 100644
index 192f8fb7d546..000000000000
--- a/include/mtd/Kbuild
+++ /dev/null
@@ -1,5 +0,0 @@
1header-y += inftl-user.h
2header-y += mtd-abi.h
3header-y += mtd-user.h
4header-y += nftl-user.h
5header-y += ubi-user.h
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 1b4989082244..f8cd4cf3fad8 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1218,6 +1218,7 @@ struct cfg80211_deauth_request {
1218 const u8 *ie; 1218 const u8 *ie;
1219 size_t ie_len; 1219 size_t ie_len;
1220 u16 reason_code; 1220 u16 reason_code;
1221 bool local_state_change;
1221}; 1222};
1222 1223
1223/** 1224/**
diff --git a/include/net/flow.h b/include/net/flow.h
index e1dd5082ec7e..628e11b98c58 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -21,6 +21,7 @@ struct flowi_common {
21 __u8 flowic_flags; 21 __u8 flowic_flags;
22#define FLOWI_FLAG_ANYSRC 0x01 22#define FLOWI_FLAG_ANYSRC 0x01
23#define FLOWI_FLAG_CAN_SLEEP 0x02 23#define FLOWI_FLAG_CAN_SLEEP 0x02
24#define FLOWI_FLAG_KNOWN_NH 0x04
24 __u32 flowic_secid; 25 __u32 flowic_secid;
25}; 26};
26 27
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 926142ed8d7a..9497be1ad4c0 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -102,6 +102,7 @@ struct fib_info {
102 unsigned char fib_dead; 102 unsigned char fib_dead;
103 unsigned char fib_protocol; 103 unsigned char fib_protocol;
104 unsigned char fib_scope; 104 unsigned char fib_scope;
105 unsigned char fib_type;
105 __be32 fib_prefsrc; 106 __be32 fib_prefsrc;
106 u32 fib_priority; 107 u32 fib_priority;
107 u32 *fib_metrics; 108 u32 *fib_metrics;
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 4faf6612ecac..95e646641184 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -257,10 +257,12 @@ static inline struct net *read_pnet(struct net * const *pnet)
257#define __net_init 257#define __net_init
258#define __net_exit 258#define __net_exit
259#define __net_initdata 259#define __net_initdata
260#define __net_initconst
260#else 261#else
261#define __net_init __init 262#define __net_init __init
262#define __net_exit __exit_refok 263#define __net_exit __exit_refok
263#define __net_initdata __initdata 264#define __net_initdata __initdata
265#define __net_initconst __initconst
264#endif 266#endif
265 267
266struct pernet_operations { 268struct pernet_operations {
diff --git a/include/net/route.h b/include/net/route.h
index da22243d2760..bc40b633a5c4 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -48,7 +48,8 @@ struct rtable {
48 int rt_genid; 48 int rt_genid;
49 unsigned int rt_flags; 49 unsigned int rt_flags;
50 __u16 rt_type; 50 __u16 rt_type;
51 __u16 rt_is_input; 51 __u8 rt_is_input;
52 __u8 rt_uses_gateway;
52 53
53 int rt_iif; 54 int rt_iif;
54 55
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 0fef00f5d3ce..64158aa1bb5f 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -1068,7 +1068,7 @@ void sctp_outq_init(struct sctp_association *, struct sctp_outq *);
1068void sctp_outq_teardown(struct sctp_outq *); 1068void sctp_outq_teardown(struct sctp_outq *);
1069void sctp_outq_free(struct sctp_outq*); 1069void sctp_outq_free(struct sctp_outq*);
1070int sctp_outq_tail(struct sctp_outq *, struct sctp_chunk *chunk); 1070int sctp_outq_tail(struct sctp_outq *, struct sctp_chunk *chunk);
1071int sctp_outq_sack(struct sctp_outq *, struct sctp_sackhdr *); 1071int sctp_outq_sack(struct sctp_outq *, struct sctp_chunk *);
1072int sctp_outq_is_empty(const struct sctp_outq *); 1072int sctp_outq_is_empty(const struct sctp_outq *);
1073void sctp_outq_restart(struct sctp_outq *); 1073void sctp_outq_restart(struct sctp_outq *);
1074 1074
diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h
index 3c5363ab867b..bd3d8b24b420 100644
--- a/include/rdma/rdma_netlink.h
+++ b/include/rdma/rdma_netlink.h
@@ -39,6 +39,7 @@ struct rdma_cm_id_stats {
39 39
40struct ibnl_client_cbs { 40struct ibnl_client_cbs {
41 int (*dump)(struct sk_buff *skb, struct netlink_callback *nlcb); 41 int (*dump)(struct sk_buff *skb, struct netlink_callback *nlcb);
42 struct module *module;
42}; 43};
43 44
44int ibnl_init(void); 45int ibnl_init(void);
diff --git a/include/scsi/fc/fc_fcp.h b/include/scsi/fc/fc_fcp.h
index 0d7d67e96d43..9c8702942b61 100644
--- a/include/scsi/fc/fc_fcp.h
+++ b/include/scsi/fc/fc_fcp.h
@@ -127,6 +127,9 @@ struct fcp_txrdy {
127 * 127 *
128 * All response frames will always contain the fcp_resp template. Some 128 * All response frames will always contain the fcp_resp template. Some
129 * will also include the fcp_resp_len template. 129 * will also include the fcp_resp_len template.
130 *
131 * From Table 23, the FCP_RSP_INFO can either be 4 bytes or 8 bytes, both
132 * are valid length.
130 */ 133 */
131struct fcp_resp { 134struct fcp_resp {
132 __u8 _fr_resvd[8]; /* reserved */ 135 __u8 _fr_resvd[8]; /* reserved */
@@ -156,6 +159,9 @@ struct fcp_resp_rsp_info {
156 __u8 _fr_resvd2[4]; /* reserved */ 159 __u8 _fr_resvd2[4]; /* reserved */
157}; 160};
158 161
162#define FCP_RESP_RSP_INFO_LEN4 4 /* without reserved field */
163#define FCP_RESP_RSP_INFO_LEN8 8 /* with reserved field */
164
159struct fcp_resp_with_ext { 165struct fcp_resp_with_ext {
160 struct fcp_resp resp; 166 struct fcp_resp resp;
161 struct fcp_resp_ext ext; 167 struct fcp_resp_ext ext;
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index 22b07cc99808..8742d853a3b8 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -327,7 +327,6 @@ struct fcoe_percpu_s {
327 * @lport: The associated local port 327 * @lport: The associated local port
328 * @fcoe_pending_queue: The pending Rx queue of skbs 328 * @fcoe_pending_queue: The pending Rx queue of skbs
329 * @fcoe_pending_queue_active: Indicates if the pending queue is active 329 * @fcoe_pending_queue_active: Indicates if the pending queue is active
330 * @priority: Packet priority (DCB)
331 * @max_queue_depth: Max queue depth of pending queue 330 * @max_queue_depth: Max queue depth of pending queue
332 * @min_queue_depth: Min queue depth of pending queue 331 * @min_queue_depth: Min queue depth of pending queue
333 * @timer: The queue timer 332 * @timer: The queue timer
@@ -343,7 +342,6 @@ struct fcoe_port {
343 struct fc_lport *lport; 342 struct fc_lport *lport;
344 struct sk_buff_head fcoe_pending_queue; 343 struct sk_buff_head fcoe_pending_queue;
345 u8 fcoe_pending_queue_active; 344 u8 fcoe_pending_queue_active;
346 u8 priority;
347 u32 max_queue_depth; 345 u32 max_queue_depth;
348 u32 min_queue_depth; 346 u32 min_queue_depth;
349 struct timer_list timer; 347 struct timer_list timer;
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index ac06cc595890..de5f5d8f1f8a 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -132,18 +132,10 @@ struct scsi_cmnd {
132 unsigned char tag; /* SCSI-II queued command tag */ 132 unsigned char tag; /* SCSI-II queued command tag */
133}; 133};
134 134
135/* make sure not to use it with REQ_TYPE_BLOCK_PC commands */
135static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd) 136static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
136{ 137{
137 struct scsi_driver **sdp; 138 return *(struct scsi_driver **)cmd->request->rq_disk->private_data;
138
139 if (!cmd->request->rq_disk)
140 return NULL;
141
142 sdp = (struct scsi_driver **)cmd->request->rq_disk->private_data;
143 if (!sdp)
144 return NULL;
145
146 return *sdp;
147} 139}
148 140
149extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t); 141extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t);
diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
index fdeb8dceec0f..d315a08d6c6d 100644
--- a/include/sound/ac97_codec.h
+++ b/include/sound/ac97_codec.h
@@ -422,6 +422,7 @@
422 */ 422 */
423 423
424struct snd_ac97; 424struct snd_ac97;
425struct snd_pcm_chmap;
425 426
426struct snd_ac97_build_ops { 427struct snd_ac97_build_ops {
427 int (*build_3d) (struct snd_ac97 *ac97); 428 int (*build_3d) (struct snd_ac97 *ac97);
@@ -528,6 +529,8 @@ struct snd_ac97 {
528 struct delayed_work power_work; 529 struct delayed_work power_work;
529#endif 530#endif
530 struct device dev; 531 struct device dev;
532
533 struct snd_pcm_chmap *chmaps[2]; /* channel-maps (optional) */
531}; 534};
532 535
533#define to_ac97_t(d) container_of(d, struct snd_ac97, dev) 536#define to_ac97_t(d) container_of(d, struct snd_ac97, dev)
diff --git a/include/sound/ad1816a.h b/include/sound/ad1816a.h
index a7d8dc782e7c..abdf609c5918 100644
--- a/include/sound/ad1816a.h
+++ b/include/sound/ad1816a.h
@@ -147,6 +147,9 @@ struct snd_ad1816a {
147 unsigned int c_dma_size; 147 unsigned int c_dma_size;
148 148
149 struct snd_timer *timer; 149 struct snd_timer *timer;
150#ifdef CONFIG_PM
151 unsigned short image[48];
152#endif
150}; 153};
151 154
152 155
@@ -165,11 +168,15 @@ struct snd_ad1816a {
165 168
166extern int snd_ad1816a_create(struct snd_card *card, unsigned long port, 169extern int snd_ad1816a_create(struct snd_card *card, unsigned long port,
167 int irq, int dma1, int dma2, 170 int irq, int dma1, int dma2,
168 struct snd_ad1816a **chip); 171 struct snd_ad1816a *chip);
169 172
170extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm); 173extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm);
171extern int snd_ad1816a_mixer(struct snd_ad1816a *chip); 174extern int snd_ad1816a_mixer(struct snd_ad1816a *chip);
172extern int snd_ad1816a_timer(struct snd_ad1816a *chip, int device, 175extern int snd_ad1816a_timer(struct snd_ad1816a *chip, int device,
173 struct snd_timer **rtimer); 176 struct snd_timer **rtimer);
177#ifdef CONFIG_PM
178extern void snd_ad1816a_suspend(struct snd_ad1816a *chip);
179extern void snd_ad1816a_resume(struct snd_ad1816a *chip);
180#endif
174 181
175#endif /* __SOUND_AD1816A_H */ 182#endif /* __SOUND_AD1816A_H */
diff --git a/include/sound/asound.h b/include/sound/asound.h
index 0876a1e76aef..dfe7d441748c 100644
--- a/include/sound/asound.h
+++ b/include/sound/asound.h
@@ -472,6 +472,45 @@ enum {
472 SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, 472 SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,
473}; 473};
474 474
475/* channel positions */
476enum {
477 SNDRV_CHMAP_UNKNOWN = 0,
478 SNDRV_CHMAP_NA, /* N/A, silent */
479 SNDRV_CHMAP_MONO, /* mono stream */
480 /* this follows the alsa-lib mixer channel value + 3 */
481 SNDRV_CHMAP_FL, /* front left */
482 SNDRV_CHMAP_FR, /* front right */
483 SNDRV_CHMAP_RL, /* rear left */
484 SNDRV_CHMAP_RR, /* rear right */
485 SNDRV_CHMAP_FC, /* front center */
486 SNDRV_CHMAP_LFE, /* LFE */
487 SNDRV_CHMAP_SL, /* side left */
488 SNDRV_CHMAP_SR, /* side right */
489 SNDRV_CHMAP_RC, /* rear center */
490 /* new definitions */
491 SNDRV_CHMAP_FLC, /* front left center */
492 SNDRV_CHMAP_FRC, /* front right center */
493 SNDRV_CHMAP_RLC, /* rear left center */
494 SNDRV_CHMAP_RRC, /* rear right center */
495 SNDRV_CHMAP_FLW, /* front left wide */
496 SNDRV_CHMAP_FRW, /* front right wide */
497 SNDRV_CHMAP_FLH, /* front left high */
498 SNDRV_CHMAP_FCH, /* front center high */
499 SNDRV_CHMAP_FRH, /* front right high */
500 SNDRV_CHMAP_TC, /* top center */
501 SNDRV_CHMAP_TFL, /* top front left */
502 SNDRV_CHMAP_TFR, /* top front right */
503 SNDRV_CHMAP_TFC, /* top front center */
504 SNDRV_CHMAP_TRL, /* top rear left */
505 SNDRV_CHMAP_TRR, /* top rear right */
506 SNDRV_CHMAP_TRC, /* top rear center */
507 SNDRV_CHMAP_LAST = SNDRV_CHMAP_TRC,
508};
509
510#define SNDRV_CHMAP_POSITION_MASK 0xffff
511#define SNDRV_CHMAP_PHASE_INVERSE (0x01 << 16)
512#define SNDRV_CHMAP_DRIVER_SPEC (0x02 << 16)
513
475#define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int) 514#define SNDRV_PCM_IOCTL_PVERSION _IOR('A', 0x00, int)
476#define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info) 515#define SNDRV_PCM_IOCTL_INFO _IOR('A', 0x01, struct snd_pcm_info)
477#define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int) 516#define SNDRV_PCM_IOCTL_TSTAMP _IOW('A', 0x02, int)
diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
index 48f2a1ff2bbc..f2912abacdf3 100644
--- a/include/sound/compress_driver.h
+++ b/include/sound/compress_driver.h
@@ -61,6 +61,7 @@ struct snd_compr_runtime {
61 u64 total_bytes_available; 61 u64 total_bytes_available;
62 u64 total_bytes_transferred; 62 u64 total_bytes_transferred;
63 wait_queue_head_t sleep; 63 wait_queue_head_t sleep;
64 void *private_data;
64}; 65};
65 66
66/** 67/**
diff --git a/include/sound/compress_params.h b/include/sound/compress_params.h
index da4a456de032..602dc6c45d1a 100644
--- a/include/sound/compress_params.h
+++ b/include/sound/compress_params.h
@@ -72,6 +72,7 @@
72#define SND_AUDIOCODEC_IEC61937 ((__u32) 0x0000000B) 72#define SND_AUDIOCODEC_IEC61937 ((__u32) 0x0000000B)
73#define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C) 73#define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C)
74#define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D) 74#define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D)
75#define SND_AUDIOCODEC_MAX SND_AUDIOCODEC_G729
75 76
76/* 77/*
77 * Profile and modes are listed with bit masks. This allows for a 78 * Profile and modes are listed with bit masks. This allows for a
diff --git a/include/sound/da9055.h b/include/sound/da9055.h
new file mode 100644
index 000000000000..cf1241b64d89
--- /dev/null
+++ b/include/sound/da9055.h
@@ -0,0 +1,33 @@
1/*
2 * DA9055 ALSA Soc codec driver
3 *
4 * Copyright (c) 2012 Dialog Semiconductor
5 *
6 * Tested on (Samsung SMDK6410 board + DA9055 EVB) using I2S and I2C
7 * Written by David Chen <david.chen@diasemi.com> and
8 * Ashish Chavan <ashish.chavan@kpitcummins.com>
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#ifndef __SOUND_DA9055_H__
17#define __SOUND_DA9055_H__
18
19enum da9055_micbias_voltage {
20 DA9055_MICBIAS_1_6V = 0,
21 DA9055_MICBIAS_1_8V = 1,
22 DA9055_MICBIAS_2_1V = 2,
23 DA9055_MICBIAS_2_2V = 3,
24};
25
26struct da9055_platform_data {
27 /* Selects which of the two MicBias pins acts as the bias source */
28 bool micbias_source;
29 /* Selects the micbias voltage */
30 enum da9055_micbias_voltage micbias;
31};
32
33#endif
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 4f865df42f0f..1a33f48ebe78 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -1788,7 +1788,7 @@ struct snd_emu10k1 {
1788 unsigned int efx_voices_mask[2]; 1788 unsigned int efx_voices_mask[2];
1789 unsigned int next_free_voice; 1789 unsigned int next_free_voice;
1790 1790
1791#ifdef CONFIG_PM 1791#ifdef CONFIG_PM_SLEEP
1792 unsigned int *saved_ptr; 1792 unsigned int *saved_ptr;
1793 unsigned int *saved_gpr; 1793 unsigned int *saved_gpr;
1794 unsigned int *tram_val_saved; 1794 unsigned int *tram_val_saved;
@@ -1856,7 +1856,7 @@ unsigned short snd_emu10k1_ac97_read(struct snd_ac97 *ac97, unsigned short reg);
1856void snd_emu10k1_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short data); 1856void snd_emu10k1_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigned short data);
1857unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate); 1857unsigned int snd_emu10k1_rate_to_pitch(unsigned int rate);
1858 1858
1859#ifdef CONFIG_PM 1859#ifdef CONFIG_PM_SLEEP
1860void snd_emu10k1_suspend_regs(struct snd_emu10k1 *emu); 1860void snd_emu10k1_suspend_regs(struct snd_emu10k1 *emu);
1861void snd_emu10k1_resume_init(struct snd_emu10k1 *emu); 1861void snd_emu10k1_resume_init(struct snd_emu10k1 *emu);
1862void snd_emu10k1_resume_regs(struct snd_emu10k1 *emu); 1862void snd_emu10k1_resume_regs(struct snd_emu10k1 *emu);
diff --git a/include/sound/initval.h b/include/sound/initval.h
index f99a0d2ddfe7..ac62c67e6f42 100644
--- a/include/sound/initval.h
+++ b/include/sound/initval.h
@@ -50,6 +50,20 @@
50#define SNDRV_DEFAULT_DMA_SIZE { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE } 50#define SNDRV_DEFAULT_DMA_SIZE { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE }
51#define SNDRV_DEFAULT_PTR SNDRV_DEFAULT_STR 51#define SNDRV_DEFAULT_PTR SNDRV_DEFAULT_STR
52 52
53#ifdef SNDRV_LEGACY_FIND_FREE_IOPORT
54static long snd_legacy_find_free_ioport(long *port_table, long size)
55{
56 while (*port_table != -1) {
57 if (request_region(*port_table, size, "ALSA test")) {
58 release_region(*port_table, size);
59 return *port_table;
60 }
61 port_table++;
62 }
63 return -1;
64}
65#endif
66
53#ifdef SNDRV_LEGACY_FIND_FREE_IRQ 67#ifdef SNDRV_LEGACY_FIND_FREE_IRQ
54#include <linux/interrupt.h> 68#include <linux/interrupt.h>
55 69
diff --git a/include/sound/memalloc.h b/include/sound/memalloc.h
index c42506212649..844af65af626 100644
--- a/include/sound/memalloc.h
+++ b/include/sound/memalloc.h
@@ -98,8 +98,10 @@ static inline unsigned int snd_sgbuf_aligned_pages(size_t size)
98/* 98/*
99 * return the physical address at the corresponding offset 99 * return the physical address at the corresponding offset
100 */ 100 */
101static inline dma_addr_t snd_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t offset) 101static inline dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab,
102 size_t offset)
102{ 103{
104 struct snd_sg_buf *sgbuf = dmab->private_data;
103 dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr; 105 dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr;
104 addr &= PAGE_MASK; 106 addr &= PAGE_MASK;
105 return addr + offset % PAGE_SIZE; 107 return addr + offset % PAGE_SIZE;
@@ -108,10 +110,31 @@ static inline dma_addr_t snd_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t off
108/* 110/*
109 * return the virtual address at the corresponding offset 111 * return the virtual address at the corresponding offset
110 */ 112 */
111static inline void *snd_sgbuf_get_ptr(struct snd_sg_buf *sgbuf, size_t offset) 113static inline void *snd_sgbuf_get_ptr(struct snd_dma_buffer *dmab,
114 size_t offset)
112{ 115{
116 struct snd_sg_buf *sgbuf = dmab->private_data;
113 return sgbuf->table[offset >> PAGE_SHIFT].buf + offset % PAGE_SIZE; 117 return sgbuf->table[offset >> PAGE_SHIFT].buf + offset % PAGE_SIZE;
114} 118}
119
120unsigned int snd_sgbuf_get_chunk_size(struct snd_dma_buffer *dmab,
121 unsigned int ofs, unsigned int size);
122#else
123/* non-SG versions */
124static inline dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab,
125 size_t offset)
126{
127 return dmab->addr + offset;
128}
129
130static inline void *snd_sgbuf_get_ptr(struct snd_dma_buffer *dmab,
131 size_t offset)
132{
133 return dmab->area + offset;
134}
135
136#define snd_sgbuf_get_chunk_size(dmab, ofs, size) (size)
137
115#endif /* CONFIG_SND_DMA_SGBUF */ 138#endif /* CONFIG_SND_DMA_SGBUF */
116 139
117/* allocate/release a buffer */ 140/* allocate/release a buffer */
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index d0711bc8c914..6268a4192d5c 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -437,6 +437,7 @@ struct snd_pcm_str {
437 struct snd_info_entry *proc_xrun_debug_entry; 437 struct snd_info_entry *proc_xrun_debug_entry;
438#endif 438#endif
439#endif 439#endif
440 struct snd_kcontrol *chmap_kctl; /* channel-mapping controls */
440}; 441};
441 442
442struct snd_pcm { 443struct snd_pcm {
@@ -982,53 +983,42 @@ static int snd_pcm_lib_alloc_vmalloc_32_buffer
982 _snd_pcm_lib_alloc_vmalloc_buffer \ 983 _snd_pcm_lib_alloc_vmalloc_buffer \
983 (subs, size, GFP_KERNEL | GFP_DMA32 | __GFP_ZERO) 984 (subs, size, GFP_KERNEL | GFP_DMA32 | __GFP_ZERO)
984 985
986#define snd_pcm_get_dma_buf(substream) ((substream)->runtime->dma_buffer_p)
987
985#ifdef CONFIG_SND_DMA_SGBUF 988#ifdef CONFIG_SND_DMA_SGBUF
986/* 989/*
987 * SG-buffer handling 990 * SG-buffer handling
988 */ 991 */
989#define snd_pcm_substream_sgbuf(substream) \ 992#define snd_pcm_substream_sgbuf(substream) \
990 ((substream)->runtime->dma_buffer_p->private_data) 993 snd_pcm_get_dma_buf(substream)->private_data
991
992static inline dma_addr_t
993snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs)
994{
995 struct snd_sg_buf *sg = snd_pcm_substream_sgbuf(substream);
996 return snd_sgbuf_get_addr(sg, ofs);
997}
998
999static inline void *
1000snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs)
1001{
1002 struct snd_sg_buf *sg = snd_pcm_substream_sgbuf(substream);
1003 return snd_sgbuf_get_ptr(sg, ofs);
1004}
1005 994
1006struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, 995struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream,
1007 unsigned long offset); 996 unsigned long offset);
1008unsigned int snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream,
1009 unsigned int ofs, unsigned int size);
1010
1011#else /* !SND_DMA_SGBUF */ 997#else /* !SND_DMA_SGBUF */
1012/* 998/*
1013 * fake using a continuous buffer 999 * fake using a continuous buffer
1014 */ 1000 */
1001#define snd_pcm_sgbuf_ops_page NULL
1002#endif /* SND_DMA_SGBUF */
1003
1015static inline dma_addr_t 1004static inline dma_addr_t
1016snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs) 1005snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs)
1017{ 1006{
1018 return substream->runtime->dma_addr + ofs; 1007 return snd_sgbuf_get_addr(snd_pcm_get_dma_buf(substream), ofs);
1019} 1008}
1020 1009
1021static inline void * 1010static inline void *
1022snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs) 1011snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs)
1023{ 1012{
1024 return substream->runtime->dma_area + ofs; 1013 return snd_sgbuf_get_ptr(snd_pcm_get_dma_buf(substream), ofs);
1025} 1014}
1026 1015
1027#define snd_pcm_sgbuf_ops_page NULL 1016static inline unsigned int
1028 1017snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream,
1029#define snd_pcm_sgbuf_get_chunk_size(subs, ofs, size) (size) 1018 unsigned int ofs, unsigned int size)
1030 1019{
1031#endif /* SND_DMA_SGBUF */ 1020 return snd_sgbuf_get_chunk_size(snd_pcm_get_dma_buf(substream), ofs, size);
1021}
1032 1022
1033/* handle mmap counter - PCM mmap callback should handle this counter properly */ 1023/* handle mmap counter - PCM mmap callback should handle this counter properly */
1034static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) 1024static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area)
@@ -1086,4 +1076,51 @@ static inline const char *snd_pcm_stream_str(struct snd_pcm_substream *substream
1086 return "Capture"; 1076 return "Capture";
1087} 1077}
1088 1078
1079/*
1080 * PCM channel-mapping control API
1081 */
1082/* array element of channel maps */
1083struct snd_pcm_chmap_elem {
1084 unsigned char channels;
1085 unsigned char map[15];
1086};
1087
1088/* channel map information; retrieved via snd_kcontrol_chip() */
1089struct snd_pcm_chmap {
1090 struct snd_pcm *pcm; /* assigned PCM instance */
1091 int stream; /* PLAYBACK or CAPTURE */
1092 struct snd_kcontrol *kctl;
1093 const struct snd_pcm_chmap_elem *chmap;
1094 unsigned int max_channels;
1095 unsigned int channel_mask; /* optional: active channels bitmask */
1096 void *private_data; /* optional: private data pointer */
1097};
1098
1099/* get the PCM substream assigned to the given chmap info */
1100static inline struct snd_pcm_substream *
1101snd_pcm_chmap_substream(struct snd_pcm_chmap *info, unsigned int idx)
1102{
1103 struct snd_pcm_substream *s;
1104 for (s = info->pcm->streams[info->stream].substream; s; s = s->next)
1105 if (s->number == idx)
1106 return s;
1107 return NULL;
1108}
1109
1110/* ALSA-standard channel maps (RL/RR prior to C/LFE) */
1111extern const struct snd_pcm_chmap_elem snd_pcm_std_chmaps[];
1112/* Other world's standard channel maps (C/LFE prior to RL/RR) */
1113extern const struct snd_pcm_chmap_elem snd_pcm_alt_chmaps[];
1114
1115/* bit masks to be passed to snd_pcm_chmap.channel_mask field */
1116#define SND_PCM_CHMAP_MASK_24 ((1U << 2) | (1U << 4))
1117#define SND_PCM_CHMAP_MASK_246 (SND_PCM_CHMAP_MASK_24 | (1U << 6))
1118#define SND_PCM_CHMAP_MASK_2468 (SND_PCM_CHMAP_MASK_246 | (1U << 8))
1119
1120int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream,
1121 const struct snd_pcm_chmap_elem *chmap,
1122 int max_channels,
1123 unsigned long private_value,
1124 struct snd_pcm_chmap **info_ret);
1125
1089#endif /* __SOUND_PCM_H */ 1126#endif /* __SOUND_PCM_H */
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 1f69e0af2941..628db7bca4fd 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -18,6 +18,7 @@
18 18
19struct snd_pcm_substream; 19struct snd_pcm_substream;
20struct snd_soc_dapm_widget; 20struct snd_soc_dapm_widget;
21struct snd_compr_stream;
21 22
22/* 23/*
23 * DAI hardware audio formats. 24 * DAI hardware audio formats.
@@ -205,6 +206,8 @@ struct snd_soc_dai_driver {
205 int (*remove)(struct snd_soc_dai *dai); 206 int (*remove)(struct snd_soc_dai *dai);
206 int (*suspend)(struct snd_soc_dai *dai); 207 int (*suspend)(struct snd_soc_dai *dai);
207 int (*resume)(struct snd_soc_dai *dai); 208 int (*resume)(struct snd_soc_dai *dai);
209 /* compress dai */
210 bool compress_dai;
208 211
209 /* ops */ 212 /* ops */
210 const struct snd_soc_dai_ops *ops; 213 const struct snd_soc_dai_ops *ops;
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index abe373d57adc..e1ef63d4a5c4 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -244,10 +244,11 @@ struct device;
244{ .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \ 244{ .id = snd_soc_dapm_supply, .name = wname, .reg = wreg, \
245 .shift = wshift, .invert = winvert, .event = wevent, \ 245 .shift = wshift, .invert = winvert, .event = wevent, \
246 .event_flags = wflags} 246 .event_flags = wflags}
247#define SND_SOC_DAPM_REGULATOR_SUPPLY(wname, wdelay) \ 247#define SND_SOC_DAPM_REGULATOR_SUPPLY(wname, wdelay, wflags) \
248{ .id = snd_soc_dapm_regulator_supply, .name = wname, \ 248{ .id = snd_soc_dapm_regulator_supply, .name = wname, \
249 .reg = SND_SOC_NOPM, .shift = wdelay, .event = dapm_regulator_event, \ 249 .reg = SND_SOC_NOPM, .shift = wdelay, .event = dapm_regulator_event, \
250 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD } 250 .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD, \
251 .invert = wflags}
251 252
252 253
253/* dapm kcontrol types */ 254/* dapm kcontrol types */
@@ -319,6 +320,9 @@ struct device;
319#define SND_SOC_DAPM_EVENT_OFF(e) \ 320#define SND_SOC_DAPM_EVENT_OFF(e) \
320 (e & (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD)) 321 (e & (SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD))
321 322
323/* regulator widget flags */
324#define SND_SOC_DAPM_REGULATOR_BYPASS 0x1 /* bypass when disabled */
325
322struct snd_soc_dapm_widget; 326struct snd_soc_dapm_widget;
323enum snd_soc_dapm_type; 327enum snd_soc_dapm_type;
324struct snd_soc_dapm_path; 328struct snd_soc_dapm_path;
@@ -412,6 +416,7 @@ void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec);
412 416
413/* Mostly internal - should not normally be used */ 417/* Mostly internal - should not normally be used */
414void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason); 418void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason);
419void dapm_mark_io_dirty(struct snd_soc_dapm_context *dapm);
415 420
416/* dapm path query */ 421/* dapm path query */
417int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream, 422int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
@@ -510,7 +515,6 @@ struct snd_soc_dapm_widget {
510 /* dapm control */ 515 /* dapm control */
511 int reg; /* negative reg = no direct dapm */ 516 int reg; /* negative reg = no direct dapm */
512 unsigned char shift; /* bits to shift */ 517 unsigned char shift; /* bits to shift */
513 unsigned int saved_value; /* widget saved value */
514 unsigned int value; /* widget current value */ 518 unsigned int value; /* widget current value */
515 unsigned int mask; /* non-shifted mask */ 519 unsigned int mask; /* non-shifted mask */
516 unsigned int on_val; /* on state value */ 520 unsigned int on_val; /* on state value */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index e063380f63a2..91244a096c19 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -20,8 +20,10 @@
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/regmap.h> 22#include <linux/regmap.h>
23#include <linux/log2.h>
23#include <sound/core.h> 24#include <sound/core.h>
24#include <sound/pcm.h> 25#include <sound/pcm.h>
26#include <sound/compress_driver.h>
25#include <sound/control.h> 27#include <sound/control.h>
26#include <sound/ac97_codec.h> 28#include <sound/ac97_codec.h>
27 29
@@ -159,7 +161,8 @@
159 .platform_max = xmax} } 161 .platform_max = xmax} }
160#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \ 162#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \
161{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ 163{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
162 .max = xmax, .texts = xtexts } 164 .max = xmax, .texts = xtexts, \
165 .mask = xmax ? roundup_pow_of_two(xmax) - 1 : 0}
163#define SOC_ENUM_SINGLE(xreg, xshift, xmax, xtexts) \ 166#define SOC_ENUM_SINGLE(xreg, xshift, xmax, xtexts) \
164 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts) 167 SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts)
165#define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \ 168#define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \
@@ -399,6 +402,7 @@ int snd_soc_platform_read(struct snd_soc_platform *platform,
399int snd_soc_platform_write(struct snd_soc_platform *platform, 402int snd_soc_platform_write(struct snd_soc_platform *platform,
400 unsigned int reg, unsigned int val); 403 unsigned int reg, unsigned int val);
401int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num); 404int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num);
405int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num);
402 406
403struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card, 407struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card,
404 const char *dai_link, int stream); 408 const char *dai_link, int stream);
@@ -632,6 +636,13 @@ struct snd_soc_ops {
632 int (*trigger)(struct snd_pcm_substream *, int); 636 int (*trigger)(struct snd_pcm_substream *, int);
633}; 637};
634 638
639struct snd_soc_compr_ops {
640 int (*startup)(struct snd_compr_stream *);
641 void (*shutdown)(struct snd_compr_stream *);
642 int (*set_params)(struct snd_compr_stream *);
643 int (*trigger)(struct snd_compr_stream *);
644};
645
635/* SoC cache ops */ 646/* SoC cache ops */
636struct snd_soc_cache_ops { 647struct snd_soc_cache_ops {
637 const char *name; 648 const char *name;
@@ -787,9 +798,12 @@ struct snd_soc_platform_driver {
787 snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *, 798 snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *,
788 struct snd_soc_dai *); 799 struct snd_soc_dai *);
789 800
790 /* platform stream ops */ 801 /* platform stream pcm ops */
791 struct snd_pcm_ops *ops; 802 struct snd_pcm_ops *ops;
792 803
804 /* platform stream compress ops */
805 struct snd_compr_ops *compr_ops;
806
793 /* platform stream completion event */ 807 /* platform stream completion event */
794 int (*stream_event)(struct snd_soc_dapm_context *dapm, int event); 808 int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
795 809
@@ -891,6 +905,7 @@ struct snd_soc_dai_link {
891 905
892 /* machine stream operations */ 906 /* machine stream operations */
893 struct snd_soc_ops *ops; 907 struct snd_soc_ops *ops;
908 struct snd_soc_compr_ops *compr_ops;
894}; 909};
895 910
896struct snd_soc_codec_conf { 911struct snd_soc_codec_conf {
@@ -1027,6 +1042,7 @@ struct snd_soc_pcm_runtime {
1027 1042
1028 /* runtime devices */ 1043 /* runtime devices */
1029 struct snd_pcm *pcm; 1044 struct snd_pcm *pcm;
1045 struct snd_compr *compr;
1030 struct snd_soc_codec *codec; 1046 struct snd_soc_codec *codec;
1031 struct snd_soc_platform *platform; 1047 struct snd_soc_platform *platform;
1032 struct snd_soc_dai *codec_dai; 1048 struct snd_soc_dai *codec_dai;
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h
index fe8590cac5c2..098c4de44945 100644
--- a/include/sound/tea575x-tuner.h
+++ b/include/sound/tea575x-tuner.h
@@ -28,6 +28,7 @@
28#include <media/v4l2-device.h> 28#include <media/v4l2-device.h>
29 29
30#define TEA575X_FMIF 10700 30#define TEA575X_FMIF 10700
31#define TEA575X_AMIF 450
31 32
32#define TEA575X_DATA (1 << 0) 33#define TEA575X_DATA (1 << 0)
33#define TEA575X_CLK (1 << 1) 34#define TEA575X_CLK (1 << 1)
@@ -52,12 +53,14 @@ struct snd_tea575x {
52 struct video_device vd; /* video device */ 53 struct video_device vd; /* video device */
53 int radio_nr; /* radio_nr */ 54 int radio_nr; /* radio_nr */
54 bool tea5759; /* 5759 chip is present */ 55 bool tea5759; /* 5759 chip is present */
56 bool has_am; /* Device can tune to AM freqs */
55 bool cannot_read_data; /* Device cannot read the data pin */ 57 bool cannot_read_data; /* Device cannot read the data pin */
56 bool cannot_mute; /* Device cannot mute */ 58 bool cannot_mute; /* Device cannot mute */
57 bool mute; /* Device is muted? */ 59 bool mute; /* Device is muted? */
58 bool stereo; /* receiving stereo */ 60 bool stereo; /* receiving stereo */
59 bool tuned; /* tuned to a station */ 61 bool tuned; /* tuned to a station */
60 unsigned int val; /* hw value */ 62 unsigned int val; /* hw value */
63 u32 band; /* 0: FM, 1: FM-Japan, 2: AM */
61 u32 freq; /* frequency */ 64 u32 freq; /* frequency */
62 struct mutex mutex; 65 struct mutex mutex;
63 struct snd_tea575x_ops *ops; 66 struct snd_tea575x_ops *ops;
@@ -70,5 +73,6 @@ struct snd_tea575x {
70 73
71int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner); 74int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner);
72void snd_tea575x_exit(struct snd_tea575x *tea); 75void snd_tea575x_exit(struct snd_tea575x *tea);
76void snd_tea575x_set_freq(struct snd_tea575x *tea);
73 77
74#endif /* __SOUND_TEA575X_TUNER_H */ 78#endif /* __SOUND_TEA575X_TUNER_H */
diff --git a/include/sound/tegra_wm8903.h b/include/sound/tegra_wm8903.h
new file mode 100644
index 000000000000..57b202ee97c3
--- /dev/null
+++ b/include/sound/tegra_wm8903.h
@@ -0,0 +1,26 @@
1/*
2 * Copyright 2011 NVIDIA, Inc.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 */
14
15#ifndef __SOUND_TEGRA_WM38903_H
16#define __SOUND_TEGRA_WM38903_H
17
18struct tegra_wm8903_platform_data {
19 int gpio_spkr_en;
20 int gpio_hp_det;
21 int gpio_hp_mute;
22 int gpio_int_mic_en;
23 int gpio_ext_mic_en;
24};
25
26#endif
diff --git a/include/sound/tlv.h b/include/sound/tlv.h
index a64d8fe3f855..28c65e1ada21 100644
--- a/include/sound/tlv.h
+++ b/include/sound/tlv.h
@@ -86,4 +86,12 @@
86 86
87#define TLV_DB_GAIN_MUTE -9999999 87#define TLV_DB_GAIN_MUTE -9999999
88 88
89/*
90 * channel-mapping TLV items
91 * TLV length must match with num_channels
92 */
93#define SNDRV_CTL_TLVT_CHMAP_FIXED 0x101 /* fixed channel position */
94#define SNDRV_CTL_TLVT_CHMAP_VAR 0x102 /* channels freely swappable */
95#define SNDRV_CTL_TLVT_CHMAP_PAIRED 0x103 /* pair-wise swappable */
96
89#endif /* __SOUND_TLV_H */ 97#endif /* __SOUND_TLV_H */
diff --git a/include/sound/version.h b/include/sound/version.h
deleted file mode 100644
index cc75024c1089..000000000000
--- a/include/sound/version.h
+++ /dev/null
@@ -1,3 +0,0 @@
1/* include/version.h */
2#define CONFIG_SND_VERSION "1.0.25"
3#define CONFIG_SND_DATE ""
diff --git a/include/sound/wm0010.h b/include/sound/wm0010.h
new file mode 100644
index 000000000000..3261e90815af
--- /dev/null
+++ b/include/sound/wm0010.h
@@ -0,0 +1,27 @@
1/*
2 * wm0010.h -- Platform data for WM0010 DSP Driver
3 *
4 * Copyright 2012 Wolfson Microelectronics PLC.
5 *
6 * Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#ifndef WM0010_PDATA_H
15#define WM0010_PDATA_H
16
17struct wm0010_pdata {
18 int gpio_reset;
19
20 /* Set if there is an inverter between the GPIO controlling
21 * the reset signal and the device.
22 */
23 int reset_active_high;
24 int irq_flags;
25};
26
27#endif
diff --git a/include/sound/wm8960.h b/include/sound/wm8960.h
index 74e9a95529c5..e8ce8ee7d62d 100644
--- a/include/sound/wm8960.h
+++ b/include/sound/wm8960.h
@@ -18,7 +18,7 @@
18struct wm8960_data { 18struct wm8960_data {
19 bool capless; /* Headphone outputs configured in capless mode */ 19 bool capless; /* Headphone outputs configured in capless mode */
20 20
21 int dres; /* Discharge resistance for headphone outputs */ 21 bool shared_lrclk; /* DAC and ADC LRCLKs are wired together */
22}; 22};
23 23
24#endif 24#endif
diff --git a/include/sound/wm8993.h b/include/sound/wm8993.h
index eee19f63c0d8..8016fd826f5a 100644
--- a/include/sound/wm8993.h
+++ b/include/sound/wm8993.h
@@ -32,6 +32,10 @@ struct wm8993_platform_data {
32 unsigned int lineout1fb:1; 32 unsigned int lineout1fb:1;
33 unsigned int lineout2fb:1; 33 unsigned int lineout2fb:1;
34 34
35 /* Delay to add for microphones to stabalise after power up */
36 int micbias1_delay;
37 int micbias2_delay;
38
35 /* Microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */ 39 /* Microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */
36 unsigned int micbias1_lvl:1; 40 unsigned int micbias1_lvl:1;
37 unsigned int micbias2_lvl:1; 41 unsigned int micbias2_lvl:1;
diff --git a/include/target/target_core_backend.h b/include/target/target_core_backend.h
index 941c84bf1065..2acd54018b64 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -13,9 +13,6 @@ struct se_subsystem_api {
13 13
14 u8 transport_type; 14 u8 transport_type;
15 15
16 unsigned int fua_write_emulated : 1;
17 unsigned int write_cache_emulated : 1;
18
19 int (*attach_hba)(struct se_hba *, u32); 16 int (*attach_hba)(struct se_hba *, u32);
20 void (*detach_hba)(struct se_hba *); 17 void (*detach_hba)(struct se_hba *);
21 int (*pmode_enable_hba)(struct se_hba *, unsigned long); 18 int (*pmode_enable_hba)(struct se_hba *, unsigned long);
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h
index 69fb3cfd02d7..81ddb4ae6c3f 100644
--- a/include/target/target_core_fabric.h
+++ b/include/target/target_core_fabric.h
@@ -62,8 +62,6 @@ struct target_core_fabric_ops {
62 int (*queue_data_in)(struct se_cmd *); 62 int (*queue_data_in)(struct se_cmd *);
63 int (*queue_status)(struct se_cmd *); 63 int (*queue_status)(struct se_cmd *);
64 int (*queue_tm_rsp)(struct se_cmd *); 64 int (*queue_tm_rsp)(struct se_cmd *);
65 u16 (*set_fabric_sense_len)(struct se_cmd *, u32);
66 u16 (*get_fabric_sense_len)(void);
67 /* 65 /*
68 * fabric module calls for target_core_fabric_configfs.c 66 * fabric module calls for target_core_fabric_configfs.c
69 */ 67 */
@@ -102,6 +100,9 @@ void transport_init_se_cmd(struct se_cmd *, struct target_core_fabric_ops *,
102 struct se_session *, u32, int, int, unsigned char *); 100 struct se_session *, u32, int, int, unsigned char *);
103int transport_lookup_cmd_lun(struct se_cmd *, u32); 101int transport_lookup_cmd_lun(struct se_cmd *, u32);
104int target_setup_cmd_from_cdb(struct se_cmd *, unsigned char *); 102int target_setup_cmd_from_cdb(struct se_cmd *, unsigned char *);
103int target_submit_cmd_map_sgls(struct se_cmd *, struct se_session *,
104 unsigned char *, unsigned char *, u32, u32, int, int, int,
105 struct scatterlist *, u32, struct scatterlist *, u32);
105int target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *, 106int target_submit_cmd(struct se_cmd *, struct se_session *, unsigned char *,
106 unsigned char *, u32, u32, int, int, int); 107 unsigned char *, u32, u32, int, int, int);
107int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, 108int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h
index 91b91e805673..54fab041b22a 100644
--- a/include/trace/events/btrfs.h
+++ b/include/trace/events/btrfs.h
@@ -445,6 +445,7 @@ TRACE_EVENT(btrfs_delayed_tree_ref,
445 __field( u64, ref_root ) 445 __field( u64, ref_root )
446 __field( int, level ) 446 __field( int, level )
447 __field( int, type ) 447 __field( int, type )
448 __field( u64, seq )
448 ), 449 ),
449 450
450 TP_fast_assign( 451 TP_fast_assign(
@@ -455,17 +456,19 @@ TRACE_EVENT(btrfs_delayed_tree_ref,
455 __entry->ref_root = full_ref->root; 456 __entry->ref_root = full_ref->root;
456 __entry->level = full_ref->level; 457 __entry->level = full_ref->level;
457 __entry->type = ref->type; 458 __entry->type = ref->type;
459 __entry->seq = ref->seq;
458 ), 460 ),
459 461
460 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " 462 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
461 "parent = %llu(%s), ref_root = %llu(%s), level = %d, " 463 "parent = %llu(%s), ref_root = %llu(%s), level = %d, "
462 "type = %s", 464 "type = %s, seq = %llu",
463 (unsigned long long)__entry->bytenr, 465 (unsigned long long)__entry->bytenr,
464 (unsigned long long)__entry->num_bytes, 466 (unsigned long long)__entry->num_bytes,
465 show_ref_action(__entry->action), 467 show_ref_action(__entry->action),
466 show_root_type(__entry->parent), 468 show_root_type(__entry->parent),
467 show_root_type(__entry->ref_root), 469 show_root_type(__entry->ref_root),
468 __entry->level, show_ref_type(__entry->type)) 470 __entry->level, show_ref_type(__entry->type),
471 (unsigned long long)__entry->seq)
469); 472);
470 473
471TRACE_EVENT(btrfs_delayed_data_ref, 474TRACE_EVENT(btrfs_delayed_data_ref,
@@ -485,6 +488,7 @@ TRACE_EVENT(btrfs_delayed_data_ref,
485 __field( u64, owner ) 488 __field( u64, owner )
486 __field( u64, offset ) 489 __field( u64, offset )
487 __field( int, type ) 490 __field( int, type )
491 __field( u64, seq )
488 ), 492 ),
489 493
490 TP_fast_assign( 494 TP_fast_assign(
@@ -496,11 +500,12 @@ TRACE_EVENT(btrfs_delayed_data_ref,
496 __entry->owner = full_ref->objectid; 500 __entry->owner = full_ref->objectid;
497 __entry->offset = full_ref->offset; 501 __entry->offset = full_ref->offset;
498 __entry->type = ref->type; 502 __entry->type = ref->type;
503 __entry->seq = ref->seq;
499 ), 504 ),
500 505
501 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " 506 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, "
502 "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, " 507 "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, "
503 "offset = %llu, type = %s", 508 "offset = %llu, type = %s, seq = %llu",
504 (unsigned long long)__entry->bytenr, 509 (unsigned long long)__entry->bytenr,
505 (unsigned long long)__entry->num_bytes, 510 (unsigned long long)__entry->num_bytes,
506 show_ref_action(__entry->action), 511 show_ref_action(__entry->action),
@@ -508,7 +513,8 @@ TRACE_EVENT(btrfs_delayed_data_ref,
508 show_root_type(__entry->ref_root), 513 show_root_type(__entry->ref_root),
509 (unsigned long long)__entry->owner, 514 (unsigned long long)__entry->owner,
510 (unsigned long long)__entry->offset, 515 (unsigned long long)__entry->offset,
511 show_ref_type(__entry->type)) 516 show_ref_type(__entry->type),
517 (unsigned long long)__entry->seq)
512); 518);
513 519
514TRACE_EVENT(btrfs_delayed_ref_head, 520TRACE_EVENT(btrfs_delayed_ref_head,
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 69d8a69ea831..d49b285385e8 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -26,19 +26,19 @@ TRACE_EVENT(ext4_free_inode,
26 TP_STRUCT__entry( 26 TP_STRUCT__entry(
27 __field( dev_t, dev ) 27 __field( dev_t, dev )
28 __field( ino_t, ino ) 28 __field( ino_t, ino )
29 __field( __u16, mode )
30 __field( uid_t, uid ) 29 __field( uid_t, uid )
31 __field( gid_t, gid ) 30 __field( gid_t, gid )
32 __field( __u64, blocks ) 31 __field( __u64, blocks )
32 __field( __u16, mode )
33 ), 33 ),
34 34
35 TP_fast_assign( 35 TP_fast_assign(
36 __entry->dev = inode->i_sb->s_dev; 36 __entry->dev = inode->i_sb->s_dev;
37 __entry->ino = inode->i_ino; 37 __entry->ino = inode->i_ino;
38 __entry->mode = inode->i_mode;
39 __entry->uid = i_uid_read(inode); 38 __entry->uid = i_uid_read(inode);
40 __entry->gid = i_gid_read(inode); 39 __entry->gid = i_gid_read(inode);
41 __entry->blocks = inode->i_blocks; 40 __entry->blocks = inode->i_blocks;
41 __entry->mode = inode->i_mode;
42 ), 42 ),
43 43
44 TP_printk("dev %d,%d ino %lu mode 0%o uid %u gid %u blocks %llu", 44 TP_printk("dev %d,%d ino %lu mode 0%o uid %u gid %u blocks %llu",
@@ -300,10 +300,10 @@ TRACE_EVENT(ext4_da_writepages,
300 __field( long, pages_skipped ) 300 __field( long, pages_skipped )
301 __field( loff_t, range_start ) 301 __field( loff_t, range_start )
302 __field( loff_t, range_end ) 302 __field( loff_t, range_end )
303 __field( pgoff_t, writeback_index )
303 __field( int, sync_mode ) 304 __field( int, sync_mode )
304 __field( char, for_kupdate ) 305 __field( char, for_kupdate )
305 __field( char, range_cyclic ) 306 __field( char, range_cyclic )
306 __field( pgoff_t, writeback_index )
307 ), 307 ),
308 308
309 TP_fast_assign( 309 TP_fast_assign(
@@ -313,14 +313,14 @@ TRACE_EVENT(ext4_da_writepages,
313 __entry->pages_skipped = wbc->pages_skipped; 313 __entry->pages_skipped = wbc->pages_skipped;
314 __entry->range_start = wbc->range_start; 314 __entry->range_start = wbc->range_start;
315 __entry->range_end = wbc->range_end; 315 __entry->range_end = wbc->range_end;
316 __entry->writeback_index = inode->i_mapping->writeback_index;
316 __entry->sync_mode = wbc->sync_mode; 317 __entry->sync_mode = wbc->sync_mode;
317 __entry->for_kupdate = wbc->for_kupdate; 318 __entry->for_kupdate = wbc->for_kupdate;
318 __entry->range_cyclic = wbc->range_cyclic; 319 __entry->range_cyclic = wbc->range_cyclic;
319 __entry->writeback_index = inode->i_mapping->writeback_index;
320 ), 320 ),
321 321
322 TP_printk("dev %d,%d ino %lu nr_to_write %ld pages_skipped %ld " 322 TP_printk("dev %d,%d ino %lu nr_to_write %ld pages_skipped %ld "
323 "range_start %lld range_end %lld sync_mode %d" 323 "range_start %lld range_end %lld sync_mode %d "
324 "for_kupdate %d range_cyclic %d writeback_index %lu", 324 "for_kupdate %d range_cyclic %d writeback_index %lu",
325 MAJOR(__entry->dev), MINOR(__entry->dev), 325 MAJOR(__entry->dev), MINOR(__entry->dev),
326 (unsigned long) __entry->ino, __entry->nr_to_write, 326 (unsigned long) __entry->ino, __entry->nr_to_write,
@@ -382,8 +382,8 @@ TRACE_EVENT(ext4_da_writepages_result,
382 __field( int, ret ) 382 __field( int, ret )
383 __field( int, pages_written ) 383 __field( int, pages_written )
384 __field( long, pages_skipped ) 384 __field( long, pages_skipped )
385 __field( int, sync_mode )
386 __field( pgoff_t, writeback_index ) 385 __field( pgoff_t, writeback_index )
386 __field( int, sync_mode )
387 ), 387 ),
388 388
389 TP_fast_assign( 389 TP_fast_assign(
@@ -392,8 +392,8 @@ TRACE_EVENT(ext4_da_writepages_result,
392 __entry->ret = ret; 392 __entry->ret = ret;
393 __entry->pages_written = pages_written; 393 __entry->pages_written = pages_written;
394 __entry->pages_skipped = wbc->pages_skipped; 394 __entry->pages_skipped = wbc->pages_skipped;
395 __entry->sync_mode = wbc->sync_mode;
396 __entry->writeback_index = inode->i_mapping->writeback_index; 395 __entry->writeback_index = inode->i_mapping->writeback_index;
396 __entry->sync_mode = wbc->sync_mode;
397 ), 397 ),
398 398
399 TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld " 399 TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld "
@@ -411,16 +411,16 @@ DECLARE_EVENT_CLASS(ext4__page_op,
411 TP_ARGS(page), 411 TP_ARGS(page),
412 412
413 TP_STRUCT__entry( 413 TP_STRUCT__entry(
414 __field( pgoff_t, index )
415 __field( ino_t, ino )
416 __field( dev_t, dev ) 414 __field( dev_t, dev )
415 __field( ino_t, ino )
416 __field( pgoff_t, index )
417 417
418 ), 418 ),
419 419
420 TP_fast_assign( 420 TP_fast_assign(
421 __entry->index = page->index;
422 __entry->ino = page->mapping->host->i_ino;
423 __entry->dev = page->mapping->host->i_sb->s_dev; 421 __entry->dev = page->mapping->host->i_sb->s_dev;
422 __entry->ino = page->mapping->host->i_ino;
423 __entry->index = page->index;
424 ), 424 ),
425 425
426 TP_printk("dev %d,%d ino %lu page_index %lu", 426 TP_printk("dev %d,%d ino %lu page_index %lu",
@@ -456,18 +456,18 @@ TRACE_EVENT(ext4_invalidatepage,
456 TP_ARGS(page, offset), 456 TP_ARGS(page, offset),
457 457
458 TP_STRUCT__entry( 458 TP_STRUCT__entry(
459 __field( dev_t, dev )
460 __field( ino_t, ino )
459 __field( pgoff_t, index ) 461 __field( pgoff_t, index )
460 __field( unsigned long, offset ) 462 __field( unsigned long, offset )
461 __field( ino_t, ino )
462 __field( dev_t, dev )
463 463
464 ), 464 ),
465 465
466 TP_fast_assign( 466 TP_fast_assign(
467 __entry->dev = page->mapping->host->i_sb->s_dev;
468 __entry->ino = page->mapping->host->i_ino;
467 __entry->index = page->index; 469 __entry->index = page->index;
468 __entry->offset = offset; 470 __entry->offset = offset;
469 __entry->ino = page->mapping->host->i_ino;
470 __entry->dev = page->mapping->host->i_sb->s_dev;
471 ), 471 ),
472 472
473 TP_printk("dev %d,%d ino %lu page_index %lu offset %lu", 473 TP_printk("dev %d,%d ino %lu page_index %lu offset %lu",
@@ -510,8 +510,8 @@ DECLARE_EVENT_CLASS(ext4__mb_new_pa,
510 __field( dev_t, dev ) 510 __field( dev_t, dev )
511 __field( ino_t, ino ) 511 __field( ino_t, ino )
512 __field( __u64, pa_pstart ) 512 __field( __u64, pa_pstart )
513 __field( __u32, pa_len )
514 __field( __u64, pa_lstart ) 513 __field( __u64, pa_lstart )
514 __field( __u32, pa_len )
515 515
516 ), 516 ),
517 517
@@ -519,8 +519,8 @@ DECLARE_EVENT_CLASS(ext4__mb_new_pa,
519 __entry->dev = ac->ac_sb->s_dev; 519 __entry->dev = ac->ac_sb->s_dev;
520 __entry->ino = ac->ac_inode->i_ino; 520 __entry->ino = ac->ac_inode->i_ino;
521 __entry->pa_pstart = pa->pa_pstart; 521 __entry->pa_pstart = pa->pa_pstart;
522 __entry->pa_len = pa->pa_len;
523 __entry->pa_lstart = pa->pa_lstart; 522 __entry->pa_lstart = pa->pa_lstart;
523 __entry->pa_len = pa->pa_len;
524 ), 524 ),
525 525
526 TP_printk("dev %d,%d ino %lu pstart %llu len %u lstart %llu", 526 TP_printk("dev %d,%d ino %lu pstart %llu len %u lstart %llu",
@@ -645,7 +645,6 @@ TRACE_EVENT(ext4_request_blocks,
645 TP_STRUCT__entry( 645 TP_STRUCT__entry(
646 __field( dev_t, dev ) 646 __field( dev_t, dev )
647 __field( ino_t, ino ) 647 __field( ino_t, ino )
648 __field( unsigned int, flags )
649 __field( unsigned int, len ) 648 __field( unsigned int, len )
650 __field( __u32, logical ) 649 __field( __u32, logical )
651 __field( __u32, lleft ) 650 __field( __u32, lleft )
@@ -653,12 +652,12 @@ TRACE_EVENT(ext4_request_blocks,
653 __field( __u64, goal ) 652 __field( __u64, goal )
654 __field( __u64, pleft ) 653 __field( __u64, pleft )
655 __field( __u64, pright ) 654 __field( __u64, pright )
655 __field( unsigned int, flags )
656 ), 656 ),
657 657
658 TP_fast_assign( 658 TP_fast_assign(
659 __entry->dev = ar->inode->i_sb->s_dev; 659 __entry->dev = ar->inode->i_sb->s_dev;
660 __entry->ino = ar->inode->i_ino; 660 __entry->ino = ar->inode->i_ino;
661 __entry->flags = ar->flags;
662 __entry->len = ar->len; 661 __entry->len = ar->len;
663 __entry->logical = ar->logical; 662 __entry->logical = ar->logical;
664 __entry->goal = ar->goal; 663 __entry->goal = ar->goal;
@@ -666,6 +665,7 @@ TRACE_EVENT(ext4_request_blocks,
666 __entry->lright = ar->lright; 665 __entry->lright = ar->lright;
667 __entry->pleft = ar->pleft; 666 __entry->pleft = ar->pleft;
668 __entry->pright = ar->pright; 667 __entry->pright = ar->pright;
668 __entry->flags = ar->flags;
669 ), 669 ),
670 670
671 TP_printk("dev %d,%d ino %lu flags %u len %u lblk %u goal %llu " 671 TP_printk("dev %d,%d ino %lu flags %u len %u lblk %u goal %llu "
@@ -686,7 +686,6 @@ TRACE_EVENT(ext4_allocate_blocks,
686 __field( dev_t, dev ) 686 __field( dev_t, dev )
687 __field( ino_t, ino ) 687 __field( ino_t, ino )
688 __field( __u64, block ) 688 __field( __u64, block )
689 __field( unsigned int, flags )
690 __field( unsigned int, len ) 689 __field( unsigned int, len )
691 __field( __u32, logical ) 690 __field( __u32, logical )
692 __field( __u32, lleft ) 691 __field( __u32, lleft )
@@ -694,13 +693,13 @@ TRACE_EVENT(ext4_allocate_blocks,
694 __field( __u64, goal ) 693 __field( __u64, goal )
695 __field( __u64, pleft ) 694 __field( __u64, pleft )
696 __field( __u64, pright ) 695 __field( __u64, pright )
696 __field( unsigned int, flags )
697 ), 697 ),
698 698
699 TP_fast_assign( 699 TP_fast_assign(
700 __entry->dev = ar->inode->i_sb->s_dev; 700 __entry->dev = ar->inode->i_sb->s_dev;
701 __entry->ino = ar->inode->i_ino; 701 __entry->ino = ar->inode->i_ino;
702 __entry->block = block; 702 __entry->block = block;
703 __entry->flags = ar->flags;
704 __entry->len = ar->len; 703 __entry->len = ar->len;
705 __entry->logical = ar->logical; 704 __entry->logical = ar->logical;
706 __entry->goal = ar->goal; 705 __entry->goal = ar->goal;
@@ -708,6 +707,7 @@ TRACE_EVENT(ext4_allocate_blocks,
708 __entry->lright = ar->lright; 707 __entry->lright = ar->lright;
709 __entry->pleft = ar->pleft; 708 __entry->pleft = ar->pleft;
710 __entry->pright = ar->pright; 709 __entry->pright = ar->pright;
710 __entry->flags = ar->flags;
711 ), 711 ),
712 712
713 TP_printk("dev %d,%d ino %lu flags %u len %u block %llu lblk %u " 713 TP_printk("dev %d,%d ino %lu flags %u len %u block %llu lblk %u "
@@ -728,19 +728,19 @@ TRACE_EVENT(ext4_free_blocks,
728 TP_STRUCT__entry( 728 TP_STRUCT__entry(
729 __field( dev_t, dev ) 729 __field( dev_t, dev )
730 __field( ino_t, ino ) 730 __field( ino_t, ino )
731 __field( __u16, mode )
732 __field( __u64, block ) 731 __field( __u64, block )
733 __field( unsigned long, count ) 732 __field( unsigned long, count )
734 __field( int, flags ) 733 __field( int, flags )
734 __field( __u16, mode )
735 ), 735 ),
736 736
737 TP_fast_assign( 737 TP_fast_assign(
738 __entry->dev = inode->i_sb->s_dev; 738 __entry->dev = inode->i_sb->s_dev;
739 __entry->ino = inode->i_ino; 739 __entry->ino = inode->i_ino;
740 __entry->mode = inode->i_mode;
741 __entry->block = block; 740 __entry->block = block;
742 __entry->count = count; 741 __entry->count = count;
743 __entry->flags = flags; 742 __entry->flags = flags;
743 __entry->mode = inode->i_mode;
744 ), 744 ),
745 745
746 TP_printk("dev %d,%d ino %lu mode 0%o block %llu count %lu flags %d", 746 TP_printk("dev %d,%d ino %lu mode 0%o block %llu count %lu flags %d",
@@ -783,15 +783,15 @@ TRACE_EVENT(ext4_sync_file_exit,
783 TP_ARGS(inode, ret), 783 TP_ARGS(inode, ret),
784 784
785 TP_STRUCT__entry( 785 TP_STRUCT__entry(
786 __field( int, ret )
787 __field( ino_t, ino )
788 __field( dev_t, dev ) 786 __field( dev_t, dev )
787 __field( ino_t, ino )
788 __field( int, ret )
789 ), 789 ),
790 790
791 TP_fast_assign( 791 TP_fast_assign(
792 __entry->ret = ret;
793 __entry->ino = inode->i_ino;
794 __entry->dev = inode->i_sb->s_dev; 792 __entry->dev = inode->i_sb->s_dev;
793 __entry->ino = inode->i_ino;
794 __entry->ret = ret;
795 ), 795 ),
796 796
797 TP_printk("dev %d,%d ino %lu ret %d", 797 TP_printk("dev %d,%d ino %lu ret %d",
@@ -854,12 +854,6 @@ TRACE_EVENT(ext4_mballoc_alloc,
854 TP_STRUCT__entry( 854 TP_STRUCT__entry(
855 __field( dev_t, dev ) 855 __field( dev_t, dev )
856 __field( ino_t, ino ) 856 __field( ino_t, ino )
857 __field( __u16, found )
858 __field( __u16, groups )
859 __field( __u16, buddy )
860 __field( __u16, flags )
861 __field( __u16, tail )
862 __field( __u8, cr )
863 __field( __u32, orig_logical ) 857 __field( __u32, orig_logical )
864 __field( int, orig_start ) 858 __field( int, orig_start )
865 __field( __u32, orig_group ) 859 __field( __u32, orig_group )
@@ -872,17 +866,17 @@ TRACE_EVENT(ext4_mballoc_alloc,
872 __field( int, result_start ) 866 __field( int, result_start )
873 __field( __u32, result_group ) 867 __field( __u32, result_group )
874 __field( int, result_len ) 868 __field( int, result_len )
869 __field( __u16, found )
870 __field( __u16, groups )
871 __field( __u16, buddy )
872 __field( __u16, flags )
873 __field( __u16, tail )
874 __field( __u8, cr )
875 ), 875 ),
876 876
877 TP_fast_assign( 877 TP_fast_assign(
878 __entry->dev = ac->ac_inode->i_sb->s_dev; 878 __entry->dev = ac->ac_inode->i_sb->s_dev;
879 __entry->ino = ac->ac_inode->i_ino; 879 __entry->ino = ac->ac_inode->i_ino;
880 __entry->found = ac->ac_found;
881 __entry->flags = ac->ac_flags;
882 __entry->groups = ac->ac_groups_scanned;
883 __entry->buddy = ac->ac_buddy;
884 __entry->tail = ac->ac_tail;
885 __entry->cr = ac->ac_criteria;
886 __entry->orig_logical = ac->ac_o_ex.fe_logical; 880 __entry->orig_logical = ac->ac_o_ex.fe_logical;
887 __entry->orig_start = ac->ac_o_ex.fe_start; 881 __entry->orig_start = ac->ac_o_ex.fe_start;
888 __entry->orig_group = ac->ac_o_ex.fe_group; 882 __entry->orig_group = ac->ac_o_ex.fe_group;
@@ -895,6 +889,12 @@ TRACE_EVENT(ext4_mballoc_alloc,
895 __entry->result_start = ac->ac_f_ex.fe_start; 889 __entry->result_start = ac->ac_f_ex.fe_start;
896 __entry->result_group = ac->ac_f_ex.fe_group; 890 __entry->result_group = ac->ac_f_ex.fe_group;
897 __entry->result_len = ac->ac_f_ex.fe_len; 891 __entry->result_len = ac->ac_f_ex.fe_len;
892 __entry->found = ac->ac_found;
893 __entry->flags = ac->ac_flags;
894 __entry->groups = ac->ac_groups_scanned;
895 __entry->buddy = ac->ac_buddy;
896 __entry->tail = ac->ac_tail;
897 __entry->cr = ac->ac_criteria;
898 ), 898 ),
899 899
900 TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u " 900 TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u "
@@ -1015,17 +1015,17 @@ TRACE_EVENT(ext4_forget,
1015 TP_STRUCT__entry( 1015 TP_STRUCT__entry(
1016 __field( dev_t, dev ) 1016 __field( dev_t, dev )
1017 __field( ino_t, ino ) 1017 __field( ino_t, ino )
1018 __field( __u16, mode )
1019 __field( int, is_metadata )
1020 __field( __u64, block ) 1018 __field( __u64, block )
1019 __field( int, is_metadata )
1020 __field( __u16, mode )
1021 ), 1021 ),
1022 1022
1023 TP_fast_assign( 1023 TP_fast_assign(
1024 __entry->dev = inode->i_sb->s_dev; 1024 __entry->dev = inode->i_sb->s_dev;
1025 __entry->ino = inode->i_ino; 1025 __entry->ino = inode->i_ino;
1026 __entry->mode = inode->i_mode;
1027 __entry->is_metadata = is_metadata;
1028 __entry->block = block; 1026 __entry->block = block;
1027 __entry->is_metadata = is_metadata;
1028 __entry->mode = inode->i_mode;
1029 ), 1029 ),
1030 1030
1031 TP_printk("dev %d,%d ino %lu mode 0%o is_metadata %d block %llu", 1031 TP_printk("dev %d,%d ino %lu mode 0%o is_metadata %d block %llu",
@@ -1042,19 +1042,18 @@ TRACE_EVENT(ext4_da_update_reserve_space,
1042 TP_STRUCT__entry( 1042 TP_STRUCT__entry(
1043 __field( dev_t, dev ) 1043 __field( dev_t, dev )
1044 __field( ino_t, ino ) 1044 __field( ino_t, ino )
1045 __field( __u16, mode )
1046 __field( __u64, i_blocks ) 1045 __field( __u64, i_blocks )
1047 __field( int, used_blocks ) 1046 __field( int, used_blocks )
1048 __field( int, reserved_data_blocks ) 1047 __field( int, reserved_data_blocks )
1049 __field( int, reserved_meta_blocks ) 1048 __field( int, reserved_meta_blocks )
1050 __field( int, allocated_meta_blocks ) 1049 __field( int, allocated_meta_blocks )
1051 __field( int, quota_claim ) 1050 __field( int, quota_claim )
1051 __field( __u16, mode )
1052 ), 1052 ),
1053 1053
1054 TP_fast_assign( 1054 TP_fast_assign(
1055 __entry->dev = inode->i_sb->s_dev; 1055 __entry->dev = inode->i_sb->s_dev;
1056 __entry->ino = inode->i_ino; 1056 __entry->ino = inode->i_ino;
1057 __entry->mode = inode->i_mode;
1058 __entry->i_blocks = inode->i_blocks; 1057 __entry->i_blocks = inode->i_blocks;
1059 __entry->used_blocks = used_blocks; 1058 __entry->used_blocks = used_blocks;
1060 __entry->reserved_data_blocks = 1059 __entry->reserved_data_blocks =
@@ -1064,6 +1063,7 @@ TRACE_EVENT(ext4_da_update_reserve_space,
1064 __entry->allocated_meta_blocks = 1063 __entry->allocated_meta_blocks =
1065 EXT4_I(inode)->i_allocated_meta_blocks; 1064 EXT4_I(inode)->i_allocated_meta_blocks;
1066 __entry->quota_claim = quota_claim; 1065 __entry->quota_claim = quota_claim;
1066 __entry->mode = inode->i_mode;
1067 ), 1067 ),
1068 1068
1069 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu used_blocks %d " 1069 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu used_blocks %d "
@@ -1085,21 +1085,21 @@ TRACE_EVENT(ext4_da_reserve_space,
1085 TP_STRUCT__entry( 1085 TP_STRUCT__entry(
1086 __field( dev_t, dev ) 1086 __field( dev_t, dev )
1087 __field( ino_t, ino ) 1087 __field( ino_t, ino )
1088 __field( __u16, mode )
1089 __field( __u64, i_blocks ) 1088 __field( __u64, i_blocks )
1090 __field( int, md_needed ) 1089 __field( int, md_needed )
1091 __field( int, reserved_data_blocks ) 1090 __field( int, reserved_data_blocks )
1092 __field( int, reserved_meta_blocks ) 1091 __field( int, reserved_meta_blocks )
1092 __field( __u16, mode )
1093 ), 1093 ),
1094 1094
1095 TP_fast_assign( 1095 TP_fast_assign(
1096 __entry->dev = inode->i_sb->s_dev; 1096 __entry->dev = inode->i_sb->s_dev;
1097 __entry->ino = inode->i_ino; 1097 __entry->ino = inode->i_ino;
1098 __entry->mode = inode->i_mode;
1099 __entry->i_blocks = inode->i_blocks; 1098 __entry->i_blocks = inode->i_blocks;
1100 __entry->md_needed = md_needed; 1099 __entry->md_needed = md_needed;
1101 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks; 1100 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
1102 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks; 1101 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
1102 __entry->mode = inode->i_mode;
1103 ), 1103 ),
1104 1104
1105 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu md_needed %d " 1105 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu md_needed %d "
@@ -1119,23 +1119,23 @@ TRACE_EVENT(ext4_da_release_space,
1119 TP_STRUCT__entry( 1119 TP_STRUCT__entry(
1120 __field( dev_t, dev ) 1120 __field( dev_t, dev )
1121 __field( ino_t, ino ) 1121 __field( ino_t, ino )
1122 __field( __u16, mode )
1123 __field( __u64, i_blocks ) 1122 __field( __u64, i_blocks )
1124 __field( int, freed_blocks ) 1123 __field( int, freed_blocks )
1125 __field( int, reserved_data_blocks ) 1124 __field( int, reserved_data_blocks )
1126 __field( int, reserved_meta_blocks ) 1125 __field( int, reserved_meta_blocks )
1127 __field( int, allocated_meta_blocks ) 1126 __field( int, allocated_meta_blocks )
1127 __field( __u16, mode )
1128 ), 1128 ),
1129 1129
1130 TP_fast_assign( 1130 TP_fast_assign(
1131 __entry->dev = inode->i_sb->s_dev; 1131 __entry->dev = inode->i_sb->s_dev;
1132 __entry->ino = inode->i_ino; 1132 __entry->ino = inode->i_ino;
1133 __entry->mode = inode->i_mode;
1134 __entry->i_blocks = inode->i_blocks; 1133 __entry->i_blocks = inode->i_blocks;
1135 __entry->freed_blocks = freed_blocks; 1134 __entry->freed_blocks = freed_blocks;
1136 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks; 1135 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
1137 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks; 1136 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
1138 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks; 1137 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
1138 __entry->mode = inode->i_mode;
1139 ), 1139 ),
1140 1140
1141 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu freed_blocks %d " 1141 TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu freed_blocks %d "
@@ -1203,16 +1203,16 @@ TRACE_EVENT(ext4_direct_IO_enter,
1203 TP_ARGS(inode, offset, len, rw), 1203 TP_ARGS(inode, offset, len, rw),
1204 1204
1205 TP_STRUCT__entry( 1205 TP_STRUCT__entry(
1206 __field( ino_t, ino )
1207 __field( dev_t, dev ) 1206 __field( dev_t, dev )
1207 __field( ino_t, ino )
1208 __field( loff_t, pos ) 1208 __field( loff_t, pos )
1209 __field( unsigned long, len ) 1209 __field( unsigned long, len )
1210 __field( int, rw ) 1210 __field( int, rw )
1211 ), 1211 ),
1212 1212
1213 TP_fast_assign( 1213 TP_fast_assign(
1214 __entry->ino = inode->i_ino;
1215 __entry->dev = inode->i_sb->s_dev; 1214 __entry->dev = inode->i_sb->s_dev;
1215 __entry->ino = inode->i_ino;
1216 __entry->pos = offset; 1216 __entry->pos = offset;
1217 __entry->len = len; 1217 __entry->len = len;
1218 __entry->rw = rw; 1218 __entry->rw = rw;
@@ -1231,8 +1231,8 @@ TRACE_EVENT(ext4_direct_IO_exit,
1231 TP_ARGS(inode, offset, len, rw, ret), 1231 TP_ARGS(inode, offset, len, rw, ret),
1232 1232
1233 TP_STRUCT__entry( 1233 TP_STRUCT__entry(
1234 __field( ino_t, ino )
1235 __field( dev_t, dev ) 1234 __field( dev_t, dev )
1235 __field( ino_t, ino )
1236 __field( loff_t, pos ) 1236 __field( loff_t, pos )
1237 __field( unsigned long, len ) 1237 __field( unsigned long, len )
1238 __field( int, rw ) 1238 __field( int, rw )
@@ -1240,8 +1240,8 @@ TRACE_EVENT(ext4_direct_IO_exit,
1240 ), 1240 ),
1241 1241
1242 TP_fast_assign( 1242 TP_fast_assign(
1243 __entry->ino = inode->i_ino;
1244 __entry->dev = inode->i_sb->s_dev; 1243 __entry->dev = inode->i_sb->s_dev;
1244 __entry->ino = inode->i_ino;
1245 __entry->pos = offset; 1245 __entry->pos = offset;
1246 __entry->len = len; 1246 __entry->len = len;
1247 __entry->rw = rw; 1247 __entry->rw = rw;
@@ -1261,16 +1261,16 @@ TRACE_EVENT(ext4_fallocate_enter,
1261 TP_ARGS(inode, offset, len, mode), 1261 TP_ARGS(inode, offset, len, mode),
1262 1262
1263 TP_STRUCT__entry( 1263 TP_STRUCT__entry(
1264 __field( ino_t, ino )
1265 __field( dev_t, dev ) 1264 __field( dev_t, dev )
1265 __field( ino_t, ino )
1266 __field( loff_t, pos ) 1266 __field( loff_t, pos )
1267 __field( loff_t, len ) 1267 __field( loff_t, len )
1268 __field( int, mode ) 1268 __field( int, mode )
1269 ), 1269 ),
1270 1270
1271 TP_fast_assign( 1271 TP_fast_assign(
1272 __entry->ino = inode->i_ino;
1273 __entry->dev = inode->i_sb->s_dev; 1272 __entry->dev = inode->i_sb->s_dev;
1273 __entry->ino = inode->i_ino;
1274 __entry->pos = offset; 1274 __entry->pos = offset;
1275 __entry->len = len; 1275 __entry->len = len;
1276 __entry->mode = mode; 1276 __entry->mode = mode;
@@ -1289,16 +1289,16 @@ TRACE_EVENT(ext4_fallocate_exit,
1289 TP_ARGS(inode, offset, max_blocks, ret), 1289 TP_ARGS(inode, offset, max_blocks, ret),
1290 1290
1291 TP_STRUCT__entry( 1291 TP_STRUCT__entry(
1292 __field( ino_t, ino )
1293 __field( dev_t, dev ) 1292 __field( dev_t, dev )
1293 __field( ino_t, ino )
1294 __field( loff_t, pos ) 1294 __field( loff_t, pos )
1295 __field( unsigned int, blocks ) 1295 __field( unsigned int, blocks )
1296 __field( int, ret ) 1296 __field( int, ret )
1297 ), 1297 ),
1298 1298
1299 TP_fast_assign( 1299 TP_fast_assign(
1300 __entry->ino = inode->i_ino;
1301 __entry->dev = inode->i_sb->s_dev; 1300 __entry->dev = inode->i_sb->s_dev;
1301 __entry->ino = inode->i_ino;
1302 __entry->pos = offset; 1302 __entry->pos = offset;
1303 __entry->blocks = max_blocks; 1303 __entry->blocks = max_blocks;
1304 __entry->ret = ret; 1304 __entry->ret = ret;
@@ -1317,17 +1317,17 @@ TRACE_EVENT(ext4_unlink_enter,
1317 TP_ARGS(parent, dentry), 1317 TP_ARGS(parent, dentry),
1318 1318
1319 TP_STRUCT__entry( 1319 TP_STRUCT__entry(
1320 __field( ino_t, parent ) 1320 __field( dev_t, dev )
1321 __field( ino_t, ino ) 1321 __field( ino_t, ino )
1322 __field( ino_t, parent )
1322 __field( loff_t, size ) 1323 __field( loff_t, size )
1323 __field( dev_t, dev )
1324 ), 1324 ),
1325 1325
1326 TP_fast_assign( 1326 TP_fast_assign(
1327 __entry->parent = parent->i_ino; 1327 __entry->dev = dentry->d_inode->i_sb->s_dev;
1328 __entry->ino = dentry->d_inode->i_ino; 1328 __entry->ino = dentry->d_inode->i_ino;
1329 __entry->parent = parent->i_ino;
1329 __entry->size = dentry->d_inode->i_size; 1330 __entry->size = dentry->d_inode->i_size;
1330 __entry->dev = dentry->d_inode->i_sb->s_dev;
1331 ), 1331 ),
1332 1332
1333 TP_printk("dev %d,%d ino %lu size %lld parent %lu", 1333 TP_printk("dev %d,%d ino %lu size %lld parent %lu",
@@ -1342,14 +1342,14 @@ TRACE_EVENT(ext4_unlink_exit,
1342 TP_ARGS(dentry, ret), 1342 TP_ARGS(dentry, ret),
1343 1343
1344 TP_STRUCT__entry( 1344 TP_STRUCT__entry(
1345 __field( ino_t, ino )
1346 __field( dev_t, dev ) 1345 __field( dev_t, dev )
1346 __field( ino_t, ino )
1347 __field( int, ret ) 1347 __field( int, ret )
1348 ), 1348 ),
1349 1349
1350 TP_fast_assign( 1350 TP_fast_assign(
1351 __entry->ino = dentry->d_inode->i_ino;
1352 __entry->dev = dentry->d_inode->i_sb->s_dev; 1351 __entry->dev = dentry->d_inode->i_sb->s_dev;
1352 __entry->ino = dentry->d_inode->i_ino;
1353 __entry->ret = ret; 1353 __entry->ret = ret;
1354 ), 1354 ),
1355 1355
@@ -1365,14 +1365,14 @@ DECLARE_EVENT_CLASS(ext4__truncate,
1365 TP_ARGS(inode), 1365 TP_ARGS(inode),
1366 1366
1367 TP_STRUCT__entry( 1367 TP_STRUCT__entry(
1368 __field( ino_t, ino ) 1368 __field( dev_t, dev )
1369 __field( dev_t, dev ) 1369 __field( ino_t, ino )
1370 __field( __u64, blocks ) 1370 __field( __u64, blocks )
1371 ), 1371 ),
1372 1372
1373 TP_fast_assign( 1373 TP_fast_assign(
1374 __entry->ino = inode->i_ino;
1375 __entry->dev = inode->i_sb->s_dev; 1374 __entry->dev = inode->i_sb->s_dev;
1375 __entry->ino = inode->i_ino;
1376 __entry->blocks = inode->i_blocks; 1376 __entry->blocks = inode->i_blocks;
1377 ), 1377 ),
1378 1378
@@ -1403,8 +1403,8 @@ TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
1403 TP_ARGS(inode, map, ux), 1403 TP_ARGS(inode, map, ux),
1404 1404
1405 TP_STRUCT__entry( 1405 TP_STRUCT__entry(
1406 __field( ino_t, ino )
1407 __field( dev_t, dev ) 1406 __field( dev_t, dev )
1407 __field( ino_t, ino )
1408 __field( ext4_lblk_t, m_lblk ) 1408 __field( ext4_lblk_t, m_lblk )
1409 __field( unsigned, m_len ) 1409 __field( unsigned, m_len )
1410 __field( ext4_lblk_t, u_lblk ) 1410 __field( ext4_lblk_t, u_lblk )
@@ -1413,8 +1413,8 @@ TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
1413 ), 1413 ),
1414 1414
1415 TP_fast_assign( 1415 TP_fast_assign(
1416 __entry->ino = inode->i_ino;
1417 __entry->dev = inode->i_sb->s_dev; 1416 __entry->dev = inode->i_sb->s_dev;
1417 __entry->ino = inode->i_ino;
1418 __entry->m_lblk = map->m_lblk; 1418 __entry->m_lblk = map->m_lblk;
1419 __entry->m_len = map->m_len; 1419 __entry->m_len = map->m_len;
1420 __entry->u_lblk = le32_to_cpu(ux->ee_block); 1420 __entry->u_lblk = le32_to_cpu(ux->ee_block);
@@ -1441,8 +1441,8 @@ TRACE_EVENT(ext4_ext_convert_to_initialized_fastpath,
1441 TP_ARGS(inode, map, ux, ix), 1441 TP_ARGS(inode, map, ux, ix),
1442 1442
1443 TP_STRUCT__entry( 1443 TP_STRUCT__entry(
1444 __field( ino_t, ino )
1445 __field( dev_t, dev ) 1444 __field( dev_t, dev )
1445 __field( ino_t, ino )
1446 __field( ext4_lblk_t, m_lblk ) 1446 __field( ext4_lblk_t, m_lblk )
1447 __field( unsigned, m_len ) 1447 __field( unsigned, m_len )
1448 __field( ext4_lblk_t, u_lblk ) 1448 __field( ext4_lblk_t, u_lblk )
@@ -1454,8 +1454,8 @@ TRACE_EVENT(ext4_ext_convert_to_initialized_fastpath,
1454 ), 1454 ),
1455 1455
1456 TP_fast_assign( 1456 TP_fast_assign(
1457 __entry->ino = inode->i_ino;
1458 __entry->dev = inode->i_sb->s_dev; 1457 __entry->dev = inode->i_sb->s_dev;
1458 __entry->ino = inode->i_ino;
1459 __entry->m_lblk = map->m_lblk; 1459 __entry->m_lblk = map->m_lblk;
1460 __entry->m_len = map->m_len; 1460 __entry->m_len = map->m_len;
1461 __entry->u_lblk = le32_to_cpu(ux->ee_block); 1461 __entry->u_lblk = le32_to_cpu(ux->ee_block);
@@ -1483,16 +1483,16 @@ DECLARE_EVENT_CLASS(ext4__map_blocks_enter,
1483 TP_ARGS(inode, lblk, len, flags), 1483 TP_ARGS(inode, lblk, len, flags),
1484 1484
1485 TP_STRUCT__entry( 1485 TP_STRUCT__entry(
1486 __field( ino_t, ino ) 1486 __field( dev_t, dev )
1487 __field( dev_t, dev ) 1487 __field( ino_t, ino )
1488 __field( ext4_lblk_t, lblk ) 1488 __field( ext4_lblk_t, lblk )
1489 __field( unsigned int, len ) 1489 __field( unsigned int, len )
1490 __field( unsigned int, flags ) 1490 __field( unsigned int, flags )
1491 ), 1491 ),
1492 1492
1493 TP_fast_assign( 1493 TP_fast_assign(
1494 __entry->ino = inode->i_ino;
1495 __entry->dev = inode->i_sb->s_dev; 1494 __entry->dev = inode->i_sb->s_dev;
1495 __entry->ino = inode->i_ino;
1496 __entry->lblk = lblk; 1496 __entry->lblk = lblk;
1497 __entry->len = len; 1497 __entry->len = len;
1498 __entry->flags = flags; 1498 __entry->flags = flags;
@@ -1525,19 +1525,19 @@ DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
1525 TP_ARGS(inode, lblk, pblk, len, ret), 1525 TP_ARGS(inode, lblk, pblk, len, ret),
1526 1526
1527 TP_STRUCT__entry( 1527 TP_STRUCT__entry(
1528 __field( ino_t, ino )
1529 __field( dev_t, dev ) 1528 __field( dev_t, dev )
1530 __field( ext4_lblk_t, lblk ) 1529 __field( ino_t, ino )
1531 __field( ext4_fsblk_t, pblk ) 1530 __field( ext4_fsblk_t, pblk )
1531 __field( ext4_lblk_t, lblk )
1532 __field( unsigned int, len ) 1532 __field( unsigned int, len )
1533 __field( int, ret ) 1533 __field( int, ret )
1534 ), 1534 ),
1535 1535
1536 TP_fast_assign( 1536 TP_fast_assign(
1537 __entry->ino = inode->i_ino;
1538 __entry->dev = inode->i_sb->s_dev; 1537 __entry->dev = inode->i_sb->s_dev;
1539 __entry->lblk = lblk; 1538 __entry->ino = inode->i_ino;
1540 __entry->pblk = pblk; 1539 __entry->pblk = pblk;
1540 __entry->lblk = lblk;
1541 __entry->len = len; 1541 __entry->len = len;
1542 __entry->ret = ret; 1542 __entry->ret = ret;
1543 ), 1543 ),
@@ -1569,17 +1569,17 @@ TRACE_EVENT(ext4_ext_load_extent,
1569 TP_ARGS(inode, lblk, pblk), 1569 TP_ARGS(inode, lblk, pblk),
1570 1570
1571 TP_STRUCT__entry( 1571 TP_STRUCT__entry(
1572 __field( ino_t, ino )
1573 __field( dev_t, dev ) 1572 __field( dev_t, dev )
1574 __field( ext4_lblk_t, lblk ) 1573 __field( ino_t, ino )
1575 __field( ext4_fsblk_t, pblk ) 1574 __field( ext4_fsblk_t, pblk )
1575 __field( ext4_lblk_t, lblk )
1576 ), 1576 ),
1577 1577
1578 TP_fast_assign( 1578 TP_fast_assign(
1579 __entry->ino = inode->i_ino;
1580 __entry->dev = inode->i_sb->s_dev; 1579 __entry->dev = inode->i_sb->s_dev;
1581 __entry->lblk = lblk; 1580 __entry->ino = inode->i_ino;
1582 __entry->pblk = pblk; 1581 __entry->pblk = pblk;
1582 __entry->lblk = lblk;
1583 ), 1583 ),
1584 1584
1585 TP_printk("dev %d,%d ino %lu lblk %u pblk %llu", 1585 TP_printk("dev %d,%d ino %lu lblk %u pblk %llu",
@@ -1594,13 +1594,13 @@ TRACE_EVENT(ext4_load_inode,
1594 TP_ARGS(inode), 1594 TP_ARGS(inode),
1595 1595
1596 TP_STRUCT__entry( 1596 TP_STRUCT__entry(
1597 __field( ino_t, ino )
1598 __field( dev_t, dev ) 1597 __field( dev_t, dev )
1598 __field( ino_t, ino )
1599 ), 1599 ),
1600 1600
1601 TP_fast_assign( 1601 TP_fast_assign(
1602 __entry->ino = inode->i_ino;
1603 __entry->dev = inode->i_sb->s_dev; 1602 __entry->dev = inode->i_sb->s_dev;
1603 __entry->ino = inode->i_ino;
1604 ), 1604 ),
1605 1605
1606 TP_printk("dev %d,%d ino %ld", 1606 TP_printk("dev %d,%d ino %ld",
@@ -1615,14 +1615,14 @@ TRACE_EVENT(ext4_journal_start,
1615 1615
1616 TP_STRUCT__entry( 1616 TP_STRUCT__entry(
1617 __field( dev_t, dev ) 1617 __field( dev_t, dev )
1618 __field( int, nblocks )
1619 __field(unsigned long, ip ) 1618 __field(unsigned long, ip )
1619 __field( int, nblocks )
1620 ), 1620 ),
1621 1621
1622 TP_fast_assign( 1622 TP_fast_assign(
1623 __entry->dev = sb->s_dev; 1623 __entry->dev = sb->s_dev;
1624 __entry->nblocks = nblocks;
1625 __entry->ip = IP; 1624 __entry->ip = IP;
1625 __entry->nblocks = nblocks;
1626 ), 1626 ),
1627 1627
1628 TP_printk("dev %d,%d nblocks %d caller %pF", 1628 TP_printk("dev %d,%d nblocks %d caller %pF",
@@ -1686,23 +1686,23 @@ TRACE_EVENT(ext4_ext_handle_uninitialized_extents,
1686 TP_ARGS(inode, map, allocated, newblock), 1686 TP_ARGS(inode, map, allocated, newblock),
1687 1687
1688 TP_STRUCT__entry( 1688 TP_STRUCT__entry(
1689 __field( ino_t, ino )
1690 __field( dev_t, dev ) 1689 __field( dev_t, dev )
1690 __field( ino_t, ino )
1691 __field( int, flags )
1691 __field( ext4_lblk_t, lblk ) 1692 __field( ext4_lblk_t, lblk )
1692 __field( ext4_fsblk_t, pblk ) 1693 __field( ext4_fsblk_t, pblk )
1693 __field( unsigned int, len ) 1694 __field( unsigned int, len )
1694 __field( int, flags )
1695 __field( unsigned int, allocated ) 1695 __field( unsigned int, allocated )
1696 __field( ext4_fsblk_t, newblk ) 1696 __field( ext4_fsblk_t, newblk )
1697 ), 1697 ),
1698 1698
1699 TP_fast_assign( 1699 TP_fast_assign(
1700 __entry->ino = inode->i_ino;
1701 __entry->dev = inode->i_sb->s_dev; 1700 __entry->dev = inode->i_sb->s_dev;
1701 __entry->ino = inode->i_ino;
1702 __entry->flags = map->m_flags;
1702 __entry->lblk = map->m_lblk; 1703 __entry->lblk = map->m_lblk;
1703 __entry->pblk = map->m_pblk; 1704 __entry->pblk = map->m_pblk;
1704 __entry->len = map->m_len; 1705 __entry->len = map->m_len;
1705 __entry->flags = map->m_flags;
1706 __entry->allocated = allocated; 1706 __entry->allocated = allocated;
1707 __entry->newblk = newblock; 1707 __entry->newblk = newblock;
1708 ), 1708 ),
@@ -1724,19 +1724,19 @@ TRACE_EVENT(ext4_get_implied_cluster_alloc_exit,
1724 1724
1725 TP_STRUCT__entry( 1725 TP_STRUCT__entry(
1726 __field( dev_t, dev ) 1726 __field( dev_t, dev )
1727 __field( unsigned int, flags )
1727 __field( ext4_lblk_t, lblk ) 1728 __field( ext4_lblk_t, lblk )
1728 __field( ext4_fsblk_t, pblk ) 1729 __field( ext4_fsblk_t, pblk )
1729 __field( unsigned int, len ) 1730 __field( unsigned int, len )
1730 __field( unsigned int, flags )
1731 __field( int, ret ) 1731 __field( int, ret )
1732 ), 1732 ),
1733 1733
1734 TP_fast_assign( 1734 TP_fast_assign(
1735 __entry->dev = sb->s_dev; 1735 __entry->dev = sb->s_dev;
1736 __entry->flags = map->m_flags;
1736 __entry->lblk = map->m_lblk; 1737 __entry->lblk = map->m_lblk;
1737 __entry->pblk = map->m_pblk; 1738 __entry->pblk = map->m_pblk;
1738 __entry->len = map->m_len; 1739 __entry->len = map->m_len;
1739 __entry->flags = map->m_flags;
1740 __entry->ret = ret; 1740 __entry->ret = ret;
1741 ), 1741 ),
1742 1742
@@ -1753,16 +1753,16 @@ TRACE_EVENT(ext4_ext_put_in_cache,
1753 TP_ARGS(inode, lblk, len, start), 1753 TP_ARGS(inode, lblk, len, start),
1754 1754
1755 TP_STRUCT__entry( 1755 TP_STRUCT__entry(
1756 __field( ino_t, ino )
1757 __field( dev_t, dev ) 1756 __field( dev_t, dev )
1757 __field( ino_t, ino )
1758 __field( ext4_lblk_t, lblk ) 1758 __field( ext4_lblk_t, lblk )
1759 __field( unsigned int, len ) 1759 __field( unsigned int, len )
1760 __field( ext4_fsblk_t, start ) 1760 __field( ext4_fsblk_t, start )
1761 ), 1761 ),
1762 1762
1763 TP_fast_assign( 1763 TP_fast_assign(
1764 __entry->ino = inode->i_ino;
1765 __entry->dev = inode->i_sb->s_dev; 1764 __entry->dev = inode->i_sb->s_dev;
1765 __entry->ino = inode->i_ino;
1766 __entry->lblk = lblk; 1766 __entry->lblk = lblk;
1767 __entry->len = len; 1767 __entry->len = len;
1768 __entry->start = start; 1768 __entry->start = start;
@@ -1782,15 +1782,15 @@ TRACE_EVENT(ext4_ext_in_cache,
1782 TP_ARGS(inode, lblk, ret), 1782 TP_ARGS(inode, lblk, ret),
1783 1783
1784 TP_STRUCT__entry( 1784 TP_STRUCT__entry(
1785 __field( ino_t, ino )
1786 __field( dev_t, dev ) 1785 __field( dev_t, dev )
1786 __field( ino_t, ino )
1787 __field( ext4_lblk_t, lblk ) 1787 __field( ext4_lblk_t, lblk )
1788 __field( int, ret ) 1788 __field( int, ret )
1789 ), 1789 ),
1790 1790
1791 TP_fast_assign( 1791 TP_fast_assign(
1792 __entry->ino = inode->i_ino;
1793 __entry->dev = inode->i_sb->s_dev; 1792 __entry->dev = inode->i_sb->s_dev;
1793 __entry->ino = inode->i_ino;
1794 __entry->lblk = lblk; 1794 __entry->lblk = lblk;
1795 __entry->ret = ret; 1795 __entry->ret = ret;
1796 ), 1796 ),
@@ -1810,8 +1810,8 @@ TRACE_EVENT(ext4_find_delalloc_range,
1810 TP_ARGS(inode, from, to, reverse, found, found_blk), 1810 TP_ARGS(inode, from, to, reverse, found, found_blk),
1811 1811
1812 TP_STRUCT__entry( 1812 TP_STRUCT__entry(
1813 __field( ino_t, ino )
1814 __field( dev_t, dev ) 1813 __field( dev_t, dev )
1814 __field( ino_t, ino )
1815 __field( ext4_lblk_t, from ) 1815 __field( ext4_lblk_t, from )
1816 __field( ext4_lblk_t, to ) 1816 __field( ext4_lblk_t, to )
1817 __field( int, reverse ) 1817 __field( int, reverse )
@@ -1820,8 +1820,8 @@ TRACE_EVENT(ext4_find_delalloc_range,
1820 ), 1820 ),
1821 1821
1822 TP_fast_assign( 1822 TP_fast_assign(
1823 __entry->ino = inode->i_ino;
1824 __entry->dev = inode->i_sb->s_dev; 1823 __entry->dev = inode->i_sb->s_dev;
1824 __entry->ino = inode->i_ino;
1825 __entry->from = from; 1825 __entry->from = from;
1826 __entry->to = to; 1826 __entry->to = to;
1827 __entry->reverse = reverse; 1827 __entry->reverse = reverse;
@@ -1844,15 +1844,15 @@ TRACE_EVENT(ext4_get_reserved_cluster_alloc,
1844 TP_ARGS(inode, lblk, len), 1844 TP_ARGS(inode, lblk, len),
1845 1845
1846 TP_STRUCT__entry( 1846 TP_STRUCT__entry(
1847 __field( ino_t, ino )
1848 __field( dev_t, dev ) 1847 __field( dev_t, dev )
1848 __field( ino_t, ino )
1849 __field( ext4_lblk_t, lblk ) 1849 __field( ext4_lblk_t, lblk )
1850 __field( unsigned int, len ) 1850 __field( unsigned int, len )
1851 ), 1851 ),
1852 1852
1853 TP_fast_assign( 1853 TP_fast_assign(
1854 __entry->ino = inode->i_ino;
1855 __entry->dev = inode->i_sb->s_dev; 1854 __entry->dev = inode->i_sb->s_dev;
1855 __entry->ino = inode->i_ino;
1856 __entry->lblk = lblk; 1856 __entry->lblk = lblk;
1857 __entry->len = len; 1857 __entry->len = len;
1858 ), 1858 ),
@@ -1871,18 +1871,18 @@ TRACE_EVENT(ext4_ext_show_extent,
1871 TP_ARGS(inode, lblk, pblk, len), 1871 TP_ARGS(inode, lblk, pblk, len),
1872 1872
1873 TP_STRUCT__entry( 1873 TP_STRUCT__entry(
1874 __field( ino_t, ino )
1875 __field( dev_t, dev ) 1874 __field( dev_t, dev )
1876 __field( ext4_lblk_t, lblk ) 1875 __field( ino_t, ino )
1877 __field( ext4_fsblk_t, pblk ) 1876 __field( ext4_fsblk_t, pblk )
1877 __field( ext4_lblk_t, lblk )
1878 __field( unsigned short, len ) 1878 __field( unsigned short, len )
1879 ), 1879 ),
1880 1880
1881 TP_fast_assign( 1881 TP_fast_assign(
1882 __entry->ino = inode->i_ino;
1883 __entry->dev = inode->i_sb->s_dev; 1882 __entry->dev = inode->i_sb->s_dev;
1884 __entry->lblk = lblk; 1883 __entry->ino = inode->i_ino;
1885 __entry->pblk = pblk; 1884 __entry->pblk = pblk;
1885 __entry->lblk = lblk;
1886 __entry->len = len; 1886 __entry->len = len;
1887 ), 1887 ),
1888 1888
@@ -1902,25 +1902,25 @@ TRACE_EVENT(ext4_remove_blocks,
1902 TP_ARGS(inode, ex, from, to, partial_cluster), 1902 TP_ARGS(inode, ex, from, to, partial_cluster),
1903 1903
1904 TP_STRUCT__entry( 1904 TP_STRUCT__entry(
1905 __field( ino_t, ino )
1906 __field( dev_t, dev ) 1905 __field( dev_t, dev )
1907 __field( ext4_lblk_t, ee_lblk ) 1906 __field( ino_t, ino )
1908 __field( ext4_fsblk_t, ee_pblk )
1909 __field( unsigned short, ee_len )
1910 __field( ext4_lblk_t, from ) 1907 __field( ext4_lblk_t, from )
1911 __field( ext4_lblk_t, to ) 1908 __field( ext4_lblk_t, to )
1912 __field( ext4_fsblk_t, partial ) 1909 __field( ext4_fsblk_t, partial )
1910 __field( ext4_fsblk_t, ee_pblk )
1911 __field( ext4_lblk_t, ee_lblk )
1912 __field( unsigned short, ee_len )
1913 ), 1913 ),
1914 1914
1915 TP_fast_assign( 1915 TP_fast_assign(
1916 __entry->ino = inode->i_ino;
1917 __entry->dev = inode->i_sb->s_dev; 1916 __entry->dev = inode->i_sb->s_dev;
1918 __entry->ee_lblk = cpu_to_le32(ex->ee_block); 1917 __entry->ino = inode->i_ino;
1919 __entry->ee_pblk = ext4_ext_pblock(ex);
1920 __entry->ee_len = ext4_ext_get_actual_len(ex);
1921 __entry->from = from; 1918 __entry->from = from;
1922 __entry->to = to; 1919 __entry->to = to;
1923 __entry->partial = partial_cluster; 1920 __entry->partial = partial_cluster;
1921 __entry->ee_pblk = ext4_ext_pblock(ex);
1922 __entry->ee_lblk = cpu_to_le32(ex->ee_block);
1923 __entry->ee_len = ext4_ext_get_actual_len(ex);
1924 ), 1924 ),
1925 1925
1926 TP_printk("dev %d,%d ino %lu extent [%u(%llu), %u]" 1926 TP_printk("dev %d,%d ino %lu extent [%u(%llu), %u]"
@@ -1942,23 +1942,23 @@ TRACE_EVENT(ext4_ext_rm_leaf,
1942 TP_ARGS(inode, start, ex, partial_cluster), 1942 TP_ARGS(inode, start, ex, partial_cluster),
1943 1943
1944 TP_STRUCT__entry( 1944 TP_STRUCT__entry(
1945 __field( ino_t, ino )
1946 __field( dev_t, dev ) 1945 __field( dev_t, dev )
1946 __field( ino_t, ino )
1947 __field( ext4_fsblk_t, partial )
1947 __field( ext4_lblk_t, start ) 1948 __field( ext4_lblk_t, start )
1948 __field( ext4_lblk_t, ee_lblk ) 1949 __field( ext4_lblk_t, ee_lblk )
1949 __field( ext4_fsblk_t, ee_pblk ) 1950 __field( ext4_fsblk_t, ee_pblk )
1950 __field( short, ee_len ) 1951 __field( short, ee_len )
1951 __field( ext4_fsblk_t, partial )
1952 ), 1952 ),
1953 1953
1954 TP_fast_assign( 1954 TP_fast_assign(
1955 __entry->ino = inode->i_ino;
1956 __entry->dev = inode->i_sb->s_dev; 1955 __entry->dev = inode->i_sb->s_dev;
1956 __entry->ino = inode->i_ino;
1957 __entry->partial = partial_cluster;
1957 __entry->start = start; 1958 __entry->start = start;
1958 __entry->ee_lblk = le32_to_cpu(ex->ee_block); 1959 __entry->ee_lblk = le32_to_cpu(ex->ee_block);
1959 __entry->ee_pblk = ext4_ext_pblock(ex); 1960 __entry->ee_pblk = ext4_ext_pblock(ex);
1960 __entry->ee_len = ext4_ext_get_actual_len(ex); 1961 __entry->ee_len = ext4_ext_get_actual_len(ex);
1961 __entry->partial = partial_cluster;
1962 ), 1962 ),
1963 1963
1964 TP_printk("dev %d,%d ino %lu start_lblk %u last_extent [%u(%llu), %u]" 1964 TP_printk("dev %d,%d ino %lu start_lblk %u last_extent [%u(%llu), %u]"
@@ -1978,14 +1978,14 @@ TRACE_EVENT(ext4_ext_rm_idx,
1978 TP_ARGS(inode, pblk), 1978 TP_ARGS(inode, pblk),
1979 1979
1980 TP_STRUCT__entry( 1980 TP_STRUCT__entry(
1981 __field( ino_t, ino )
1982 __field( dev_t, dev ) 1981 __field( dev_t, dev )
1982 __field( ino_t, ino )
1983 __field( ext4_fsblk_t, pblk ) 1983 __field( ext4_fsblk_t, pblk )
1984 ), 1984 ),
1985 1985
1986 TP_fast_assign( 1986 TP_fast_assign(
1987 __entry->ino = inode->i_ino;
1988 __entry->dev = inode->i_sb->s_dev; 1987 __entry->dev = inode->i_sb->s_dev;
1988 __entry->ino = inode->i_ino;
1989 __entry->pblk = pblk; 1989 __entry->pblk = pblk;
1990 ), 1990 ),
1991 1991
@@ -2001,15 +2001,15 @@ TRACE_EVENT(ext4_ext_remove_space,
2001 TP_ARGS(inode, start, depth), 2001 TP_ARGS(inode, start, depth),
2002 2002
2003 TP_STRUCT__entry( 2003 TP_STRUCT__entry(
2004 __field( ino_t, ino )
2005 __field( dev_t, dev ) 2004 __field( dev_t, dev )
2005 __field( ino_t, ino )
2006 __field( ext4_lblk_t, start ) 2006 __field( ext4_lblk_t, start )
2007 __field( int, depth ) 2007 __field( int, depth )
2008 ), 2008 ),
2009 2009
2010 TP_fast_assign( 2010 TP_fast_assign(
2011 __entry->ino = inode->i_ino;
2012 __entry->dev = inode->i_sb->s_dev; 2011 __entry->dev = inode->i_sb->s_dev;
2012 __entry->ino = inode->i_ino;
2013 __entry->start = start; 2013 __entry->start = start;
2014 __entry->depth = depth; 2014 __entry->depth = depth;
2015 ), 2015 ),
@@ -2028,8 +2028,8 @@ TRACE_EVENT(ext4_ext_remove_space_done,
2028 TP_ARGS(inode, start, depth, partial, eh_entries), 2028 TP_ARGS(inode, start, depth, partial, eh_entries),
2029 2029
2030 TP_STRUCT__entry( 2030 TP_STRUCT__entry(
2031 __field( ino_t, ino )
2032 __field( dev_t, dev ) 2031 __field( dev_t, dev )
2032 __field( ino_t, ino )
2033 __field( ext4_lblk_t, start ) 2033 __field( ext4_lblk_t, start )
2034 __field( int, depth ) 2034 __field( int, depth )
2035 __field( ext4_lblk_t, partial ) 2035 __field( ext4_lblk_t, partial )
@@ -2037,8 +2037,8 @@ TRACE_EVENT(ext4_ext_remove_space_done,
2037 ), 2037 ),
2038 2038
2039 TP_fast_assign( 2039 TP_fast_assign(
2040 __entry->ino = inode->i_ino;
2041 __entry->dev = inode->i_sb->s_dev; 2040 __entry->dev = inode->i_sb->s_dev;
2041 __entry->ino = inode->i_ino;
2042 __entry->start = start; 2042 __entry->start = start;
2043 __entry->depth = depth; 2043 __entry->depth = depth;
2044 __entry->partial = partial; 2044 __entry->partial = partial;
diff --git a/include/trace/events/gfpflags.h b/include/trace/events/gfpflags.h
index d6fd8e5b14b7..9391706e9254 100644
--- a/include/trace/events/gfpflags.h
+++ b/include/trace/events/gfpflags.h
@@ -36,7 +36,6 @@
36 {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \ 36 {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \
37 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"}, \ 37 {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"}, \
38 {(unsigned long)__GFP_NOTRACK, "GFP_NOTRACK"}, \ 38 {(unsigned long)__GFP_NOTRACK, "GFP_NOTRACK"}, \
39 {(unsigned long)__GFP_NO_KSWAPD, "GFP_NO_KSWAPD"}, \
40 {(unsigned long)__GFP_OTHER_NODE, "GFP_OTHER_NODE"} \ 39 {(unsigned long)__GFP_OTHER_NODE, "GFP_OTHER_NODE"} \
41 ) : "GFP_NOWAIT" 40 ) : "GFP_NOWAIT"
42 41
diff --git a/include/uapi/asm-generic/Kbuild b/include/uapi/asm-generic/Kbuild
index aafaa5aa54d4..b73de7bb7a62 100644
--- a/include/uapi/asm-generic/Kbuild
+++ b/include/uapi/asm-generic/Kbuild
@@ -1 +1,36 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += auxvec.h
3header-y += bitsperlong.h
4header-y += errno-base.h
5header-y += errno.h
6header-y += fcntl.h
7header-y += int-l64.h
8header-y += int-ll64.h
9header-y += ioctl.h
10header-y += ioctls.h
11header-y += ipcbuf.h
12header-y += kvm_para.h
13header-y += mman-common.h
14header-y += mman.h
15header-y += msgbuf.h
16header-y += param.h
17header-y += poll.h
18header-y += posix_types.h
19header-y += resource.h
20header-y += sembuf.h
21header-y += setup.h
22header-y += shmbuf.h
23header-y += shmparam.h
24header-y += siginfo.h
25header-y += signal-defs.h
26header-y += signal.h
27header-y += socket.h
28header-y += sockios.h
29header-y += stat.h
30header-y += statfs.h
31header-y += swab.h
32header-y += termbits.h
33header-y += termios.h
34header-y += types.h
35header-y += ucontext.h
36header-y += unistd.h
diff --git a/include/asm-generic/auxvec.h b/include/uapi/asm-generic/auxvec.h
index b99573b0ad12..b99573b0ad12 100644
--- a/include/asm-generic/auxvec.h
+++ b/include/uapi/asm-generic/auxvec.h
diff --git a/include/uapi/asm-generic/bitsperlong.h b/include/uapi/asm-generic/bitsperlong.h
new file mode 100644
index 000000000000..23e6c416b85f
--- /dev/null
+++ b/include/uapi/asm-generic/bitsperlong.h
@@ -0,0 +1,15 @@
1#ifndef _UAPI__ASM_GENERIC_BITS_PER_LONG
2#define _UAPI__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#endif /* _UAPI__ASM_GENERIC_BITS_PER_LONG */
diff --git a/include/asm-generic/errno-base.h b/include/uapi/asm-generic/errno-base.h
index 65115978510f..65115978510f 100644
--- a/include/asm-generic/errno-base.h
+++ b/include/uapi/asm-generic/errno-base.h
diff --git a/include/asm-generic/errno.h b/include/uapi/asm-generic/errno.h
index a1331ce50445..a1331ce50445 100644
--- a/include/asm-generic/errno.h
+++ b/include/uapi/asm-generic/errno.h
diff --git a/include/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h
index a48937d4a5ea..a48937d4a5ea 100644
--- a/include/asm-generic/fcntl.h
+++ b/include/uapi/asm-generic/fcntl.h
diff --git a/include/uapi/asm-generic/int-l64.h b/include/uapi/asm-generic/int-l64.h
new file mode 100644
index 000000000000..978f21cae2f4
--- /dev/null
+++ b/include/uapi/asm-generic/int-l64.h
@@ -0,0 +1,34 @@
1/*
2 * asm-generic/int-l64.h
3 *
4 * Integer declarations for architectures which use "long"
5 * for 64-bit types.
6 */
7
8#ifndef _UAPI_ASM_GENERIC_INT_L64_H
9#define _UAPI_ASM_GENERIC_INT_L64_H
10
11#include <asm/bitsperlong.h>
12
13#ifndef __ASSEMBLY__
14/*
15 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
16 * header files exported to user space
17 */
18
19typedef __signed__ char __s8;
20typedef unsigned char __u8;
21
22typedef __signed__ short __s16;
23typedef unsigned short __u16;
24
25typedef __signed__ int __s32;
26typedef unsigned int __u32;
27
28typedef __signed__ long __s64;
29typedef unsigned long __u64;
30
31#endif /* __ASSEMBLY__ */
32
33
34#endif /* _UAPI_ASM_GENERIC_INT_L64_H */
diff --git a/include/uapi/asm-generic/int-ll64.h b/include/uapi/asm-generic/int-ll64.h
new file mode 100644
index 000000000000..a8658b2423ba
--- /dev/null
+++ b/include/uapi/asm-generic/int-ll64.h
@@ -0,0 +1,39 @@
1/*
2 * asm-generic/int-ll64.h
3 *
4 * Integer declarations for architectures which use "long long"
5 * for 64-bit types.
6 */
7
8#ifndef _UAPI_ASM_GENERIC_INT_LL64_H
9#define _UAPI_ASM_GENERIC_INT_LL64_H
10
11#include <asm/bitsperlong.h>
12
13#ifndef __ASSEMBLY__
14/*
15 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
16 * header files exported to user space
17 */
18
19typedef __signed__ char __s8;
20typedef unsigned char __u8;
21
22typedef __signed__ short __s16;
23typedef unsigned short __u16;
24
25typedef __signed__ int __s32;
26typedef unsigned int __u32;
27
28#ifdef __GNUC__
29__extension__ typedef __signed__ long long __s64;
30__extension__ typedef unsigned long long __u64;
31#else
32typedef __signed__ long long __s64;
33typedef unsigned long long __u64;
34#endif
35
36#endif /* __ASSEMBLY__ */
37
38
39#endif /* _UAPI_ASM_GENERIC_INT_LL64_H */
diff --git a/include/uapi/asm-generic/ioctl.h b/include/uapi/asm-generic/ioctl.h
new file mode 100644
index 000000000000..7e7c11b52143
--- /dev/null
+++ b/include/uapi/asm-generic/ioctl.h
@@ -0,0 +1,98 @@
1#ifndef _UAPI_ASM_GENERIC_IOCTL_H
2#define _UAPI_ASM_GENERIC_IOCTL_H
3
4/* ioctl command encoding: 32 bits total, command in lower 16 bits,
5 * size of the parameter structure in the lower 14 bits of the
6 * upper 16 bits.
7 * Encoding the size of the parameter structure in the ioctl request
8 * is useful for catching programs compiled with old versions
9 * and to avoid overwriting user space outside the user buffer area.
10 * The highest 2 bits are reserved for indicating the ``access mode''.
11 * NOTE: This limits the max parameter size to 16kB -1 !
12 */
13
14/*
15 * The following is for compatibility across the various Linux
16 * platforms. The generic ioctl numbering scheme doesn't really enforce
17 * a type field. De facto, however, the top 8 bits of the lower 16
18 * bits are indeed used as a type field, so we might just as well make
19 * this explicit here. Please be sure to use the decoding macros
20 * below from now on.
21 */
22#define _IOC_NRBITS 8
23#define _IOC_TYPEBITS 8
24
25/*
26 * Let any architecture override either of the following before
27 * including this file.
28 */
29
30#ifndef _IOC_SIZEBITS
31# define _IOC_SIZEBITS 14
32#endif
33
34#ifndef _IOC_DIRBITS
35# define _IOC_DIRBITS 2
36#endif
37
38#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
39#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
40#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
41#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
42
43#define _IOC_NRSHIFT 0
44#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
45#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
46#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
47
48/*
49 * Direction bits, which any architecture can choose to override
50 * before including this file.
51 */
52
53#ifndef _IOC_NONE
54# define _IOC_NONE 0U
55#endif
56
57#ifndef _IOC_WRITE
58# define _IOC_WRITE 1U
59#endif
60
61#ifndef _IOC_READ
62# define _IOC_READ 2U
63#endif
64
65#define _IOC(dir,type,nr,size) \
66 (((dir) << _IOC_DIRSHIFT) | \
67 ((type) << _IOC_TYPESHIFT) | \
68 ((nr) << _IOC_NRSHIFT) | \
69 ((size) << _IOC_SIZESHIFT))
70
71#ifndef __KERNEL__
72#define _IOC_TYPECHECK(t) (sizeof(t))
73#endif
74
75/* used to create numbers */
76#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
77#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
78#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
79#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
80#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
81#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
82#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
83
84/* used to decode ioctl numbers.. */
85#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
86#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
87#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
88#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
89
90/* ...and for the drivers/sound files... */
91
92#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
93#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
94#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
95#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
96#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
97
98#endif /* _UAPI_ASM_GENERIC_IOCTL_H */
diff --git a/include/asm-generic/ioctls.h b/include/uapi/asm-generic/ioctls.h
index 199975fac395..199975fac395 100644
--- a/include/asm-generic/ioctls.h
+++ b/include/uapi/asm-generic/ioctls.h
diff --git a/include/asm-generic/ipcbuf.h b/include/uapi/asm-generic/ipcbuf.h
index 76982b2a1b58..76982b2a1b58 100644
--- a/include/asm-generic/ipcbuf.h
+++ b/include/uapi/asm-generic/ipcbuf.h
diff --git a/include/uapi/asm-generic/kvm_para.h b/include/uapi/asm-generic/kvm_para.h
new file mode 100644
index 000000000000..486f0af73c39
--- /dev/null
+++ b/include/uapi/asm-generic/kvm_para.h
@@ -0,0 +1,4 @@
1/*
2 * There isn't anything here, but the file must not be empty or patch
3 * will delete it.
4 */
diff --git a/include/asm-generic/mman-common.h b/include/uapi/asm-generic/mman-common.h
index d030d2c2647a..d030d2c2647a 100644
--- a/include/asm-generic/mman-common.h
+++ b/include/uapi/asm-generic/mman-common.h
diff --git a/include/asm-generic/mman.h b/include/uapi/asm-generic/mman.h
index 32c8bd6a196d..32c8bd6a196d 100644
--- a/include/asm-generic/mman.h
+++ b/include/uapi/asm-generic/mman.h
diff --git a/include/asm-generic/msgbuf.h b/include/uapi/asm-generic/msgbuf.h
index aec850d9159e..aec850d9159e 100644
--- a/include/asm-generic/msgbuf.h
+++ b/include/uapi/asm-generic/msgbuf.h
diff --git a/include/uapi/asm-generic/param.h b/include/uapi/asm-generic/param.h
new file mode 100644
index 000000000000..5becc84396b8
--- /dev/null
+++ b/include/uapi/asm-generic/param.h
@@ -0,0 +1,19 @@
1#ifndef _UAPI__ASM_GENERIC_PARAM_H
2#define _UAPI__ASM_GENERIC_PARAM_H
3
4#ifndef HZ
5#define HZ 100
6#endif
7
8#ifndef EXEC_PAGESIZE
9#define EXEC_PAGESIZE 4096
10#endif
11
12#ifndef NOGROUP
13#define NOGROUP (-1)
14#endif
15
16#define MAXHOSTNAMELEN 64 /* max length of hostname */
17
18
19#endif /* _UAPI__ASM_GENERIC_PARAM_H */
diff --git a/include/asm-generic/poll.h b/include/uapi/asm-generic/poll.h
index 9ce7f44aebd2..9ce7f44aebd2 100644
--- a/include/asm-generic/poll.h
+++ b/include/uapi/asm-generic/poll.h
diff --git a/include/asm-generic/posix_types.h b/include/uapi/asm-generic/posix_types.h
index fe74fccf18db..fe74fccf18db 100644
--- a/include/asm-generic/posix_types.h
+++ b/include/uapi/asm-generic/posix_types.h
diff --git a/include/uapi/asm-generic/resource.h b/include/uapi/asm-generic/resource.h
new file mode 100644
index 000000000000..f863428796d5
--- /dev/null
+++ b/include/uapi/asm-generic/resource.h
@@ -0,0 +1,68 @@
1#ifndef _UAPI_ASM_GENERIC_RESOURCE_H
2#define _UAPI_ASM_GENERIC_RESOURCE_H
3
4/*
5 * Resource limit IDs
6 *
7 * ( Compatibility detail: there are architectures that have
8 * a different rlimit ID order in the 5-9 range and want
9 * to keep that order for binary compatibility. The reasons
10 * are historic and all new rlimits are identical across all
11 * arches. If an arch has such special order for some rlimits
12 * then it defines them prior including asm-generic/resource.h. )
13 */
14
15#define RLIMIT_CPU 0 /* CPU time in sec */
16#define RLIMIT_FSIZE 1 /* Maximum filesize */
17#define RLIMIT_DATA 2 /* max data size */
18#define RLIMIT_STACK 3 /* max stack size */
19#define RLIMIT_CORE 4 /* max core file size */
20
21#ifndef RLIMIT_RSS
22# define RLIMIT_RSS 5 /* max resident set size */
23#endif
24
25#ifndef RLIMIT_NPROC
26# define RLIMIT_NPROC 6 /* max number of processes */
27#endif
28
29#ifndef RLIMIT_NOFILE
30# define RLIMIT_NOFILE 7 /* max number of open files */
31#endif
32
33#ifndef RLIMIT_MEMLOCK
34# define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */
35#endif
36
37#ifndef RLIMIT_AS
38# define RLIMIT_AS 9 /* address space limit */
39#endif
40
41#define RLIMIT_LOCKS 10 /* maximum file locks held */
42#define RLIMIT_SIGPENDING 11 /* max number of pending signals */
43#define RLIMIT_MSGQUEUE 12 /* maximum bytes in POSIX mqueues */
44#define RLIMIT_NICE 13 /* max nice prio allowed to raise to
45 0-39 for nice level 19 .. -20 */
46#define RLIMIT_RTPRIO 14 /* maximum realtime priority */
47#define RLIMIT_RTTIME 15 /* timeout for RT tasks in us */
48#define RLIM_NLIMITS 16
49
50/*
51 * SuS says limits have to be unsigned.
52 * Which makes a ton more sense anyway.
53 *
54 * Some architectures override this (for compatibility reasons):
55 */
56#ifndef RLIM_INFINITY
57# define RLIM_INFINITY (~0UL)
58#endif
59
60/*
61 * RLIMIT_STACK default maximum - some architectures override it:
62 */
63#ifndef _STK_LIM_MAX
64# define _STK_LIM_MAX RLIM_INFINITY
65#endif
66
67
68#endif /* _UAPI_ASM_GENERIC_RESOURCE_H */
diff --git a/include/asm-generic/sembuf.h b/include/uapi/asm-generic/sembuf.h
index 4cb2c13e5090..4cb2c13e5090 100644
--- a/include/asm-generic/sembuf.h
+++ b/include/uapi/asm-generic/sembuf.h
diff --git a/include/asm-generic/setup.h b/include/uapi/asm-generic/setup.h
index 6fc26a51003c..6fc26a51003c 100644
--- a/include/asm-generic/setup.h
+++ b/include/uapi/asm-generic/setup.h
diff --git a/include/asm-generic/shmbuf.h b/include/uapi/asm-generic/shmbuf.h
index 5768fa60ac82..5768fa60ac82 100644
--- a/include/asm-generic/shmbuf.h
+++ b/include/uapi/asm-generic/shmbuf.h
diff --git a/include/asm-generic/shmparam.h b/include/uapi/asm-generic/shmparam.h
index 51a3852de733..51a3852de733 100644
--- a/include/asm-generic/shmparam.h
+++ b/include/uapi/asm-generic/shmparam.h
diff --git a/include/uapi/asm-generic/siginfo.h b/include/uapi/asm-generic/siginfo.h
new file mode 100644
index 000000000000..ba5be7fdbdfe
--- /dev/null
+++ b/include/uapi/asm-generic/siginfo.h
@@ -0,0 +1,298 @@
1#ifndef _UAPI_ASM_GENERIC_SIGINFO_H
2#define _UAPI_ASM_GENERIC_SIGINFO_H
3
4#include <linux/compiler.h>
5#include <linux/types.h>
6
7typedef union sigval {
8 int sival_int;
9 void __user *sival_ptr;
10} sigval_t;
11
12/*
13 * This is the size (including padding) of the part of the
14 * struct siginfo that is before the union.
15 */
16#ifndef __ARCH_SI_PREAMBLE_SIZE
17#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
18#endif
19
20#define SI_MAX_SIZE 128
21#ifndef SI_PAD_SIZE
22#define SI_PAD_SIZE ((SI_MAX_SIZE - __ARCH_SI_PREAMBLE_SIZE) / sizeof(int))
23#endif
24
25#ifndef __ARCH_SI_UID_T
26#define __ARCH_SI_UID_T __kernel_uid32_t
27#endif
28
29/*
30 * The default "si_band" type is "long", as specified by POSIX.
31 * However, some architectures want to override this to "int"
32 * for historical compatibility reasons, so we allow that.
33 */
34#ifndef __ARCH_SI_BAND_T
35#define __ARCH_SI_BAND_T long
36#endif
37
38#ifndef __ARCH_SI_CLOCK_T
39#define __ARCH_SI_CLOCK_T __kernel_clock_t
40#endif
41
42#ifndef __ARCH_SI_ATTRIBUTES
43#define __ARCH_SI_ATTRIBUTES
44#endif
45
46#ifndef HAVE_ARCH_SIGINFO_T
47
48typedef struct siginfo {
49 int si_signo;
50 int si_errno;
51 int si_code;
52
53 union {
54 int _pad[SI_PAD_SIZE];
55
56 /* kill() */
57 struct {
58 __kernel_pid_t _pid; /* sender's pid */
59 __ARCH_SI_UID_T _uid; /* sender's uid */
60 } _kill;
61
62 /* POSIX.1b timers */
63 struct {
64 __kernel_timer_t _tid; /* timer id */
65 int _overrun; /* overrun count */
66 char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
67 sigval_t _sigval; /* same as below */
68 int _sys_private; /* not to be passed to user */
69 } _timer;
70
71 /* POSIX.1b signals */
72 struct {
73 __kernel_pid_t _pid; /* sender's pid */
74 __ARCH_SI_UID_T _uid; /* sender's uid */
75 sigval_t _sigval;
76 } _rt;
77
78 /* SIGCHLD */
79 struct {
80 __kernel_pid_t _pid; /* which child */
81 __ARCH_SI_UID_T _uid; /* sender's uid */
82 int _status; /* exit code */
83 __ARCH_SI_CLOCK_T _utime;
84 __ARCH_SI_CLOCK_T _stime;
85 } _sigchld;
86
87 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
88 struct {
89 void __user *_addr; /* faulting insn/memory ref. */
90#ifdef __ARCH_SI_TRAPNO
91 int _trapno; /* TRAP # which caused the signal */
92#endif
93 short _addr_lsb; /* LSB of the reported address */
94 } _sigfault;
95
96 /* SIGPOLL */
97 struct {
98 __ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
99 int _fd;
100 } _sigpoll;
101
102 /* SIGSYS */
103 struct {
104 void __user *_call_addr; /* calling user insn */
105 int _syscall; /* triggering system call number */
106 unsigned int _arch; /* AUDIT_ARCH_* of syscall */
107 } _sigsys;
108 } _sifields;
109} __ARCH_SI_ATTRIBUTES siginfo_t;
110
111/* If the arch shares siginfo, then it has SIGSYS. */
112#define __ARCH_SIGSYS
113#endif
114
115/*
116 * How these fields are to be accessed.
117 */
118#define si_pid _sifields._kill._pid
119#define si_uid _sifields._kill._uid
120#define si_tid _sifields._timer._tid
121#define si_overrun _sifields._timer._overrun
122#define si_sys_private _sifields._timer._sys_private
123#define si_status _sifields._sigchld._status
124#define si_utime _sifields._sigchld._utime
125#define si_stime _sifields._sigchld._stime
126#define si_value _sifields._rt._sigval
127#define si_int _sifields._rt._sigval.sival_int
128#define si_ptr _sifields._rt._sigval.sival_ptr
129#define si_addr _sifields._sigfault._addr
130#ifdef __ARCH_SI_TRAPNO
131#define si_trapno _sifields._sigfault._trapno
132#endif
133#define si_addr_lsb _sifields._sigfault._addr_lsb
134#define si_band _sifields._sigpoll._band
135#define si_fd _sifields._sigpoll._fd
136#ifdef __ARCH_SIGSYS
137#define si_call_addr _sifields._sigsys._call_addr
138#define si_syscall _sifields._sigsys._syscall
139#define si_arch _sifields._sigsys._arch
140#endif
141
142#ifndef __KERNEL__
143#define __SI_KILL 0
144#define __SI_TIMER 0
145#define __SI_POLL 0
146#define __SI_FAULT 0
147#define __SI_CHLD 0
148#define __SI_RT 0
149#define __SI_MESGQ 0
150#define __SI_SYS 0
151#define __SI_CODE(T,N) (N)
152#endif
153
154/*
155 * si_code values
156 * Digital reserves positive values for kernel-generated signals.
157 */
158#define SI_USER 0 /* sent by kill, sigsend, raise */
159#define SI_KERNEL 0x80 /* sent by the kernel from somewhere */
160#define SI_QUEUE -1 /* sent by sigqueue */
161#define SI_TIMER __SI_CODE(__SI_TIMER,-2) /* sent by timer expiration */
162#define SI_MESGQ __SI_CODE(__SI_MESGQ,-3) /* sent by real time mesq state change */
163#define SI_ASYNCIO -4 /* sent by AIO completion */
164#define SI_SIGIO -5 /* sent by queued SIGIO */
165#define SI_TKILL -6 /* sent by tkill system call */
166#define SI_DETHREAD -7 /* sent by execve() killing subsidiary threads */
167
168#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
169#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
170
171/*
172 * SIGILL si_codes
173 */
174#define ILL_ILLOPC (__SI_FAULT|1) /* illegal opcode */
175#define ILL_ILLOPN (__SI_FAULT|2) /* illegal operand */
176#define ILL_ILLADR (__SI_FAULT|3) /* illegal addressing mode */
177#define ILL_ILLTRP (__SI_FAULT|4) /* illegal trap */
178#define ILL_PRVOPC (__SI_FAULT|5) /* privileged opcode */
179#define ILL_PRVREG (__SI_FAULT|6) /* privileged register */
180#define ILL_COPROC (__SI_FAULT|7) /* coprocessor error */
181#define ILL_BADSTK (__SI_FAULT|8) /* internal stack error */
182#define NSIGILL 8
183
184/*
185 * SIGFPE si_codes
186 */
187#define FPE_INTDIV (__SI_FAULT|1) /* integer divide by zero */
188#define FPE_INTOVF (__SI_FAULT|2) /* integer overflow */
189#define FPE_FLTDIV (__SI_FAULT|3) /* floating point divide by zero */
190#define FPE_FLTOVF (__SI_FAULT|4) /* floating point overflow */
191#define FPE_FLTUND (__SI_FAULT|5) /* floating point underflow */
192#define FPE_FLTRES (__SI_FAULT|6) /* floating point inexact result */
193#define FPE_FLTINV (__SI_FAULT|7) /* floating point invalid operation */
194#define FPE_FLTSUB (__SI_FAULT|8) /* subscript out of range */
195#define NSIGFPE 8
196
197/*
198 * SIGSEGV si_codes
199 */
200#define SEGV_MAPERR (__SI_FAULT|1) /* address not mapped to object */
201#define SEGV_ACCERR (__SI_FAULT|2) /* invalid permissions for mapped object */
202#define NSIGSEGV 2
203
204/*
205 * SIGBUS si_codes
206 */
207#define BUS_ADRALN (__SI_FAULT|1) /* invalid address alignment */
208#define BUS_ADRERR (__SI_FAULT|2) /* non-existent physical address */
209#define BUS_OBJERR (__SI_FAULT|3) /* object specific hardware error */
210/* hardware memory error consumed on a machine check: action required */
211#define BUS_MCEERR_AR (__SI_FAULT|4)
212/* hardware memory error detected in process but not consumed: action optional*/
213#define BUS_MCEERR_AO (__SI_FAULT|5)
214#define NSIGBUS 5
215
216/*
217 * SIGTRAP si_codes
218 */
219#define TRAP_BRKPT (__SI_FAULT|1) /* process breakpoint */
220#define TRAP_TRACE (__SI_FAULT|2) /* process trace trap */
221#define TRAP_BRANCH (__SI_FAULT|3) /* process taken branch trap */
222#define TRAP_HWBKPT (__SI_FAULT|4) /* hardware breakpoint/watchpoint */
223#define NSIGTRAP 4
224
225/*
226 * SIGCHLD si_codes
227 */
228#define CLD_EXITED (__SI_CHLD|1) /* child has exited */
229#define CLD_KILLED (__SI_CHLD|2) /* child was killed */
230#define CLD_DUMPED (__SI_CHLD|3) /* child terminated abnormally */
231#define CLD_TRAPPED (__SI_CHLD|4) /* traced child has trapped */
232#define CLD_STOPPED (__SI_CHLD|5) /* child has stopped */
233#define CLD_CONTINUED (__SI_CHLD|6) /* stopped child has continued */
234#define NSIGCHLD 6
235
236/*
237 * SIGPOLL si_codes
238 */
239#define POLL_IN (__SI_POLL|1) /* data input available */
240#define POLL_OUT (__SI_POLL|2) /* output buffers available */
241#define POLL_MSG (__SI_POLL|3) /* input message available */
242#define POLL_ERR (__SI_POLL|4) /* i/o error */
243#define POLL_PRI (__SI_POLL|5) /* high priority input available */
244#define POLL_HUP (__SI_POLL|6) /* device disconnected */
245#define NSIGPOLL 6
246
247/*
248 * SIGSYS si_codes
249 */
250#define SYS_SECCOMP (__SI_SYS|1) /* seccomp triggered */
251#define NSIGSYS 1
252
253/*
254 * sigevent definitions
255 *
256 * It seems likely that SIGEV_THREAD will have to be handled from
257 * userspace, libpthread transmuting it to SIGEV_SIGNAL, which the
258 * thread manager then catches and does the appropriate nonsense.
259 * However, everything is written out here so as to not get lost.
260 */
261#define SIGEV_SIGNAL 0 /* notify via signal */
262#define SIGEV_NONE 1 /* other notification: meaningless */
263#define SIGEV_THREAD 2 /* deliver via thread creation */
264#define SIGEV_THREAD_ID 4 /* deliver to thread */
265
266/*
267 * This works because the alignment is ok on all current architectures
268 * but we leave open this being overridden in the future
269 */
270#ifndef __ARCH_SIGEV_PREAMBLE_SIZE
271#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_t))
272#endif
273
274#define SIGEV_MAX_SIZE 64
275#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) \
276 / sizeof(int))
277
278typedef struct sigevent {
279 sigval_t sigev_value;
280 int sigev_signo;
281 int sigev_notify;
282 union {
283 int _pad[SIGEV_PAD_SIZE];
284 int _tid;
285
286 struct {
287 void (*_function)(sigval_t);
288 void *_attribute; /* really pthread_attr_t */
289 } _sigev_thread;
290 } _sigev_un;
291} sigevent_t;
292
293#define sigev_notify_function _sigev_un._sigev_thread._function
294#define sigev_notify_attributes _sigev_un._sigev_thread._attribute
295#define sigev_notify_thread_id _sigev_un._tid
296
297
298#endif /* _UAPI_ASM_GENERIC_SIGINFO_H */
diff --git a/include/asm-generic/signal-defs.h b/include/uapi/asm-generic/signal-defs.h
index 00f95df54297..00f95df54297 100644
--- a/include/asm-generic/signal-defs.h
+++ b/include/uapi/asm-generic/signal-defs.h
diff --git a/include/uapi/asm-generic/signal.h b/include/uapi/asm-generic/signal.h
new file mode 100644
index 000000000000..0a78028984de
--- /dev/null
+++ b/include/uapi/asm-generic/signal.h
@@ -0,0 +1,123 @@
1#ifndef _UAPI__ASM_GENERIC_SIGNAL_H
2#define _UAPI__ASM_GENERIC_SIGNAL_H
3
4#include <linux/types.h>
5
6#define _NSIG 64
7#define _NSIG_BPW __BITS_PER_LONG
8#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
9
10#define SIGHUP 1
11#define SIGINT 2
12#define SIGQUIT 3
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
52#endif
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
92#ifndef __ASSEMBLY__
93typedef struct {
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;
99
100#include <asm-generic/signal-defs.h>
101
102struct sigaction {
103 __sighandler_t sa_handler;
104 unsigned long sa_flags;
105#ifdef SA_RESTORER
106 __sigrestore_t sa_restorer;
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#endif /* __ASSEMBLY__ */
122
123#endif /* _UAPI__ASM_GENERIC_SIGNAL_H */
diff --git a/include/asm-generic/socket.h b/include/uapi/asm-generic/socket.h
index b1bea03274d5..b1bea03274d5 100644
--- a/include/asm-generic/socket.h
+++ b/include/uapi/asm-generic/socket.h
diff --git a/include/asm-generic/sockios.h b/include/uapi/asm-generic/sockios.h
index 9a61a369b901..9a61a369b901 100644
--- a/include/asm-generic/sockios.h
+++ b/include/uapi/asm-generic/sockios.h
diff --git a/include/asm-generic/stat.h b/include/uapi/asm-generic/stat.h
index bd8cad21998e..bd8cad21998e 100644
--- a/include/asm-generic/stat.h
+++ b/include/uapi/asm-generic/stat.h
diff --git a/include/uapi/asm-generic/statfs.h b/include/uapi/asm-generic/statfs.h
new file mode 100644
index 000000000000..0999647fca13
--- /dev/null
+++ b/include/uapi/asm-generic/statfs.h
@@ -0,0 +1,83 @@
1#ifndef _UAPI_GENERIC_STATFS_H
2#define _UAPI_GENERIC_STATFS_H
3
4#include <linux/types.h>
5
6
7/*
8 * Most 64-bit platforms use 'long', while most 32-bit platforms use '__u32'.
9 * Yes, they differ in signedness as well as size.
10 * Special cases can override it for themselves -- except for S390x, which
11 * is just a little too special for us. And MIPS, which I'm not touching
12 * with a 10' pole.
13 */
14#ifndef __statfs_word
15#if __BITS_PER_LONG == 64
16#define __statfs_word long
17#else
18#define __statfs_word __u32
19#endif
20#endif
21
22struct statfs {
23 __statfs_word f_type;
24 __statfs_word f_bsize;
25 __statfs_word f_blocks;
26 __statfs_word f_bfree;
27 __statfs_word f_bavail;
28 __statfs_word f_files;
29 __statfs_word f_ffree;
30 __kernel_fsid_t f_fsid;
31 __statfs_word f_namelen;
32 __statfs_word f_frsize;
33 __statfs_word f_flags;
34 __statfs_word f_spare[4];
35};
36
37/*
38 * ARM needs to avoid the 32-bit padding at the end, for consistency
39 * between EABI and OABI
40 */
41#ifndef ARCH_PACK_STATFS64
42#define ARCH_PACK_STATFS64
43#endif
44
45struct statfs64 {
46 __statfs_word f_type;
47 __statfs_word f_bsize;
48 __u64 f_blocks;
49 __u64 f_bfree;
50 __u64 f_bavail;
51 __u64 f_files;
52 __u64 f_ffree;
53 __kernel_fsid_t f_fsid;
54 __statfs_word f_namelen;
55 __statfs_word f_frsize;
56 __statfs_word f_flags;
57 __statfs_word f_spare[4];
58} ARCH_PACK_STATFS64;
59
60/*
61 * IA64 and x86_64 need to avoid the 32-bit padding at the end,
62 * to be compatible with the i386 ABI
63 */
64#ifndef ARCH_PACK_COMPAT_STATFS64
65#define ARCH_PACK_COMPAT_STATFS64
66#endif
67
68struct compat_statfs64 {
69 __u32 f_type;
70 __u32 f_bsize;
71 __u64 f_blocks;
72 __u64 f_bfree;
73 __u64 f_bavail;
74 __u64 f_files;
75 __u64 f_ffree;
76 __kernel_fsid_t f_fsid;
77 __u32 f_namelen;
78 __u32 f_frsize;
79 __u32 f_flags;
80 __u32 f_spare[4];
81} ARCH_PACK_COMPAT_STATFS64;
82
83#endif /* _UAPI_GENERIC_STATFS_H */
diff --git a/include/asm-generic/swab.h b/include/uapi/asm-generic/swab.h
index a8e9029d9eba..a8e9029d9eba 100644
--- a/include/asm-generic/swab.h
+++ b/include/uapi/asm-generic/swab.h
diff --git a/include/asm-generic/termbits.h b/include/uapi/asm-generic/termbits.h
index 232b4781aef3..232b4781aef3 100644
--- a/include/asm-generic/termbits.h
+++ b/include/uapi/asm-generic/termbits.h
diff --git a/include/uapi/asm-generic/termios.h b/include/uapi/asm-generic/termios.h
new file mode 100644
index 000000000000..088176062133
--- /dev/null
+++ b/include/uapi/asm-generic/termios.h
@@ -0,0 +1,50 @@
1#ifndef _UAPI_ASM_GENERIC_TERMIOS_H
2#define _UAPI_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
50#endif /* _UAPI_ASM_GENERIC_TERMIOS_H */
diff --git a/include/asm-generic/types.h b/include/uapi/asm-generic/types.h
index bd39806013b5..bd39806013b5 100644
--- a/include/asm-generic/types.h
+++ b/include/uapi/asm-generic/types.h
diff --git a/include/asm-generic/ucontext.h b/include/uapi/asm-generic/ucontext.h
index ad77343e8a9a..ad77343e8a9a 100644
--- a/include/asm-generic/ucontext.h
+++ b/include/uapi/asm-generic/ucontext.h
diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
new file mode 100644
index 000000000000..6e595ba545f4
--- /dev/null
+++ b/include/uapi/asm-generic/unistd.h
@@ -0,0 +1,902 @@
1#include <asm/bitsperlong.h>
2
3/*
4 * This file contains the system call numbers, based on the
5 * layout of the x86-64 architecture, which embeds the
6 * pointer to the syscall in the table.
7 *
8 * As a basic principle, no duplication of functionality
9 * should be added, e.g. we don't use lseek when llseek
10 * is present. New architectures should use this file
11 * and implement the less feature-full calls in user space.
12 */
13
14#ifndef __SYSCALL
15#define __SYSCALL(x, y)
16#endif
17
18#if __BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)
19#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _32)
20#else
21#define __SC_3264(_nr, _32, _64) __SYSCALL(_nr, _64)
22#endif
23
24#ifdef __SYSCALL_COMPAT
25#define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _comp)
26#define __SC_COMP_3264(_nr, _32, _64, _comp) __SYSCALL(_nr, _comp)
27#else
28#define __SC_COMP(_nr, _sys, _comp) __SYSCALL(_nr, _sys)
29#define __SC_COMP_3264(_nr, _32, _64, _comp) __SC_3264(_nr, _32, _64)
30#endif
31
32#define __NR_io_setup 0
33__SC_COMP(__NR_io_setup, sys_io_setup, compat_sys_io_setup)
34#define __NR_io_destroy 1
35__SYSCALL(__NR_io_destroy, sys_io_destroy)
36#define __NR_io_submit 2
37__SC_COMP(__NR_io_submit, sys_io_submit, compat_sys_io_submit)
38#define __NR_io_cancel 3
39__SYSCALL(__NR_io_cancel, sys_io_cancel)
40#define __NR_io_getevents 4
41__SC_COMP(__NR_io_getevents, sys_io_getevents, compat_sys_io_getevents)
42
43/* fs/xattr.c */
44#define __NR_setxattr 5
45__SYSCALL(__NR_setxattr, sys_setxattr)
46#define __NR_lsetxattr 6
47__SYSCALL(__NR_lsetxattr, sys_lsetxattr)
48#define __NR_fsetxattr 7
49__SYSCALL(__NR_fsetxattr, sys_fsetxattr)
50#define __NR_getxattr 8
51__SYSCALL(__NR_getxattr, sys_getxattr)
52#define __NR_lgetxattr 9
53__SYSCALL(__NR_lgetxattr, sys_lgetxattr)
54#define __NR_fgetxattr 10
55__SYSCALL(__NR_fgetxattr, sys_fgetxattr)
56#define __NR_listxattr 11
57__SYSCALL(__NR_listxattr, sys_listxattr)
58#define __NR_llistxattr 12
59__SYSCALL(__NR_llistxattr, sys_llistxattr)
60#define __NR_flistxattr 13
61__SYSCALL(__NR_flistxattr, sys_flistxattr)
62#define __NR_removexattr 14
63__SYSCALL(__NR_removexattr, sys_removexattr)
64#define __NR_lremovexattr 15
65__SYSCALL(__NR_lremovexattr, sys_lremovexattr)
66#define __NR_fremovexattr 16
67__SYSCALL(__NR_fremovexattr, sys_fremovexattr)
68
69/* fs/dcache.c */
70#define __NR_getcwd 17
71__SYSCALL(__NR_getcwd, sys_getcwd)
72
73/* fs/cookies.c */
74#define __NR_lookup_dcookie 18
75__SC_COMP(__NR_lookup_dcookie, sys_lookup_dcookie, compat_sys_lookup_dcookie)
76
77/* fs/eventfd.c */
78#define __NR_eventfd2 19
79__SYSCALL(__NR_eventfd2, sys_eventfd2)
80
81/* fs/eventpoll.c */
82#define __NR_epoll_create1 20
83__SYSCALL(__NR_epoll_create1, sys_epoll_create1)
84#define __NR_epoll_ctl 21
85__SYSCALL(__NR_epoll_ctl, sys_epoll_ctl)
86#define __NR_epoll_pwait 22
87__SC_COMP(__NR_epoll_pwait, sys_epoll_pwait, compat_sys_epoll_pwait)
88
89/* fs/fcntl.c */
90#define __NR_dup 23
91__SYSCALL(__NR_dup, sys_dup)
92#define __NR_dup3 24
93__SYSCALL(__NR_dup3, sys_dup3)
94#define __NR3264_fcntl 25
95__SC_COMP_3264(__NR3264_fcntl, sys_fcntl64, sys_fcntl, compat_sys_fcntl64)
96
97/* fs/inotify_user.c */
98#define __NR_inotify_init1 26
99__SYSCALL(__NR_inotify_init1, sys_inotify_init1)
100#define __NR_inotify_add_watch 27
101__SYSCALL(__NR_inotify_add_watch, sys_inotify_add_watch)
102#define __NR_inotify_rm_watch 28
103__SYSCALL(__NR_inotify_rm_watch, sys_inotify_rm_watch)
104
105/* fs/ioctl.c */
106#define __NR_ioctl 29
107__SC_COMP(__NR_ioctl, sys_ioctl, compat_sys_ioctl)
108
109/* fs/ioprio.c */
110#define __NR_ioprio_set 30
111__SYSCALL(__NR_ioprio_set, sys_ioprio_set)
112#define __NR_ioprio_get 31
113__SYSCALL(__NR_ioprio_get, sys_ioprio_get)
114
115/* fs/locks.c */
116#define __NR_flock 32
117__SYSCALL(__NR_flock, sys_flock)
118
119/* fs/namei.c */
120#define __NR_mknodat 33
121__SYSCALL(__NR_mknodat, sys_mknodat)
122#define __NR_mkdirat 34
123__SYSCALL(__NR_mkdirat, sys_mkdirat)
124#define __NR_unlinkat 35
125__SYSCALL(__NR_unlinkat, sys_unlinkat)
126#define __NR_symlinkat 36
127__SYSCALL(__NR_symlinkat, sys_symlinkat)
128#define __NR_linkat 37
129__SYSCALL(__NR_linkat, sys_linkat)
130#define __NR_renameat 38
131__SYSCALL(__NR_renameat, sys_renameat)
132
133/* fs/namespace.c */
134#define __NR_umount2 39
135__SYSCALL(__NR_umount2, sys_umount)
136#define __NR_mount 40
137__SC_COMP(__NR_mount, sys_mount, compat_sys_mount)
138#define __NR_pivot_root 41
139__SYSCALL(__NR_pivot_root, sys_pivot_root)
140
141/* fs/nfsctl.c */
142#define __NR_nfsservctl 42
143__SYSCALL(__NR_nfsservctl, sys_ni_syscall)
144
145/* fs/open.c */
146#define __NR3264_statfs 43
147__SC_COMP_3264(__NR3264_statfs, sys_statfs64, sys_statfs, \
148 compat_sys_statfs64)
149#define __NR3264_fstatfs 44
150__SC_COMP_3264(__NR3264_fstatfs, sys_fstatfs64, sys_fstatfs, \
151 compat_sys_fstatfs64)
152#define __NR3264_truncate 45
153__SC_COMP_3264(__NR3264_truncate, sys_truncate64, sys_truncate, \
154 compat_sys_truncate64)
155#define __NR3264_ftruncate 46
156__SC_COMP_3264(__NR3264_ftruncate, sys_ftruncate64, sys_ftruncate, \
157 compat_sys_ftruncate64)
158
159#define __NR_fallocate 47
160__SC_COMP(__NR_fallocate, sys_fallocate, compat_sys_fallocate)
161#define __NR_faccessat 48
162__SYSCALL(__NR_faccessat, sys_faccessat)
163#define __NR_chdir 49
164__SYSCALL(__NR_chdir, sys_chdir)
165#define __NR_fchdir 50
166__SYSCALL(__NR_fchdir, sys_fchdir)
167#define __NR_chroot 51
168__SYSCALL(__NR_chroot, sys_chroot)
169#define __NR_fchmod 52
170__SYSCALL(__NR_fchmod, sys_fchmod)
171#define __NR_fchmodat 53
172__SYSCALL(__NR_fchmodat, sys_fchmodat)
173#define __NR_fchownat 54
174__SYSCALL(__NR_fchownat, sys_fchownat)
175#define __NR_fchown 55
176__SYSCALL(__NR_fchown, sys_fchown)
177#define __NR_openat 56
178__SC_COMP(__NR_openat, sys_openat, compat_sys_openat)
179#define __NR_close 57
180__SYSCALL(__NR_close, sys_close)
181#define __NR_vhangup 58
182__SYSCALL(__NR_vhangup, sys_vhangup)
183
184/* fs/pipe.c */
185#define __NR_pipe2 59
186__SYSCALL(__NR_pipe2, sys_pipe2)
187
188/* fs/quota.c */
189#define __NR_quotactl 60
190__SYSCALL(__NR_quotactl, sys_quotactl)
191
192/* fs/readdir.c */
193#define __NR_getdents64 61
194__SC_COMP(__NR_getdents64, sys_getdents64, compat_sys_getdents64)
195
196/* fs/read_write.c */
197#define __NR3264_lseek 62
198__SC_3264(__NR3264_lseek, sys_llseek, sys_lseek)
199#define __NR_read 63
200__SYSCALL(__NR_read, sys_read)
201#define __NR_write 64
202__SYSCALL(__NR_write, sys_write)
203#define __NR_readv 65
204__SC_COMP(__NR_readv, sys_readv, compat_sys_readv)
205#define __NR_writev 66
206__SC_COMP(__NR_writev, sys_writev, compat_sys_writev)
207#define __NR_pread64 67
208__SC_COMP(__NR_pread64, sys_pread64, compat_sys_pread64)
209#define __NR_pwrite64 68
210__SC_COMP(__NR_pwrite64, sys_pwrite64, compat_sys_pwrite64)
211#define __NR_preadv 69
212__SC_COMP(__NR_preadv, sys_preadv, compat_sys_preadv)
213#define __NR_pwritev 70
214__SC_COMP(__NR_pwritev, sys_pwritev, compat_sys_pwritev)
215
216/* fs/sendfile.c */
217#define __NR3264_sendfile 71
218__SYSCALL(__NR3264_sendfile, sys_sendfile64)
219
220/* fs/select.c */
221#define __NR_pselect6 72
222__SC_COMP(__NR_pselect6, sys_pselect6, compat_sys_pselect6)
223#define __NR_ppoll 73
224__SC_COMP(__NR_ppoll, sys_ppoll, compat_sys_ppoll)
225
226/* fs/signalfd.c */
227#define __NR_signalfd4 74
228__SC_COMP(__NR_signalfd4, sys_signalfd4, compat_sys_signalfd4)
229
230/* fs/splice.c */
231#define __NR_vmsplice 75
232__SC_COMP(__NR_vmsplice, sys_vmsplice, compat_sys_vmsplice)
233#define __NR_splice 76
234__SYSCALL(__NR_splice, sys_splice)
235#define __NR_tee 77
236__SYSCALL(__NR_tee, sys_tee)
237
238/* fs/stat.c */
239#define __NR_readlinkat 78
240__SYSCALL(__NR_readlinkat, sys_readlinkat)
241#define __NR3264_fstatat 79
242__SC_3264(__NR3264_fstatat, sys_fstatat64, sys_newfstatat)
243#define __NR3264_fstat 80
244__SC_3264(__NR3264_fstat, sys_fstat64, sys_newfstat)
245
246/* fs/sync.c */
247#define __NR_sync 81
248__SYSCALL(__NR_sync, sys_sync)
249#define __NR_fsync 82
250__SYSCALL(__NR_fsync, sys_fsync)
251#define __NR_fdatasync 83
252__SYSCALL(__NR_fdatasync, sys_fdatasync)
253#ifdef __ARCH_WANT_SYNC_FILE_RANGE2
254#define __NR_sync_file_range2 84
255__SC_COMP(__NR_sync_file_range2, sys_sync_file_range2, \
256 compat_sys_sync_file_range2)
257#else
258#define __NR_sync_file_range 84
259__SC_COMP(__NR_sync_file_range, sys_sync_file_range, \
260 compat_sys_sync_file_range)
261#endif
262
263/* fs/timerfd.c */
264#define __NR_timerfd_create 85
265__SYSCALL(__NR_timerfd_create, sys_timerfd_create)
266#define __NR_timerfd_settime 86
267__SC_COMP(__NR_timerfd_settime, sys_timerfd_settime, \
268 compat_sys_timerfd_settime)
269#define __NR_timerfd_gettime 87
270__SC_COMP(__NR_timerfd_gettime, sys_timerfd_gettime, \
271 compat_sys_timerfd_gettime)
272
273/* fs/utimes.c */
274#define __NR_utimensat 88
275__SC_COMP(__NR_utimensat, sys_utimensat, compat_sys_utimensat)
276
277/* kernel/acct.c */
278#define __NR_acct 89
279__SYSCALL(__NR_acct, sys_acct)
280
281/* kernel/capability.c */
282#define __NR_capget 90
283__SYSCALL(__NR_capget, sys_capget)
284#define __NR_capset 91
285__SYSCALL(__NR_capset, sys_capset)
286
287/* kernel/exec_domain.c */
288#define __NR_personality 92
289__SYSCALL(__NR_personality, sys_personality)
290
291/* kernel/exit.c */
292#define __NR_exit 93
293__SYSCALL(__NR_exit, sys_exit)
294#define __NR_exit_group 94
295__SYSCALL(__NR_exit_group, sys_exit_group)
296#define __NR_waitid 95
297__SC_COMP(__NR_waitid, sys_waitid, compat_sys_waitid)
298
299/* kernel/fork.c */
300#define __NR_set_tid_address 96
301__SYSCALL(__NR_set_tid_address, sys_set_tid_address)
302#define __NR_unshare 97
303__SYSCALL(__NR_unshare, sys_unshare)
304
305/* kernel/futex.c */
306#define __NR_futex 98
307__SC_COMP(__NR_futex, sys_futex, compat_sys_futex)
308#define __NR_set_robust_list 99
309__SC_COMP(__NR_set_robust_list, sys_set_robust_list, \
310 compat_sys_set_robust_list)
311#define __NR_get_robust_list 100
312__SC_COMP(__NR_get_robust_list, sys_get_robust_list, \
313 compat_sys_get_robust_list)
314
315/* kernel/hrtimer.c */
316#define __NR_nanosleep 101
317__SC_COMP(__NR_nanosleep, sys_nanosleep, compat_sys_nanosleep)
318
319/* kernel/itimer.c */
320#define __NR_getitimer 102
321__SC_COMP(__NR_getitimer, sys_getitimer, compat_sys_getitimer)
322#define __NR_setitimer 103
323__SC_COMP(__NR_setitimer, sys_setitimer, compat_sys_setitimer)
324
325/* kernel/kexec.c */
326#define __NR_kexec_load 104
327__SC_COMP(__NR_kexec_load, sys_kexec_load, compat_sys_kexec_load)
328
329/* kernel/module.c */
330#define __NR_init_module 105
331__SYSCALL(__NR_init_module, sys_init_module)
332#define __NR_delete_module 106
333__SYSCALL(__NR_delete_module, sys_delete_module)
334
335/* kernel/posix-timers.c */
336#define __NR_timer_create 107
337__SC_COMP(__NR_timer_create, sys_timer_create, compat_sys_timer_create)
338#define __NR_timer_gettime 108
339__SC_COMP(__NR_timer_gettime, sys_timer_gettime, compat_sys_timer_gettime)
340#define __NR_timer_getoverrun 109
341__SYSCALL(__NR_timer_getoverrun, sys_timer_getoverrun)
342#define __NR_timer_settime 110
343__SC_COMP(__NR_timer_settime, sys_timer_settime, compat_sys_timer_settime)
344#define __NR_timer_delete 111
345__SYSCALL(__NR_timer_delete, sys_timer_delete)
346#define __NR_clock_settime 112
347__SC_COMP(__NR_clock_settime, sys_clock_settime, compat_sys_clock_settime)
348#define __NR_clock_gettime 113
349__SC_COMP(__NR_clock_gettime, sys_clock_gettime, compat_sys_clock_gettime)
350#define __NR_clock_getres 114
351__SC_COMP(__NR_clock_getres, sys_clock_getres, compat_sys_clock_getres)
352#define __NR_clock_nanosleep 115
353__SC_COMP(__NR_clock_nanosleep, sys_clock_nanosleep, \
354 compat_sys_clock_nanosleep)
355
356/* kernel/printk.c */
357#define __NR_syslog 116
358__SYSCALL(__NR_syslog, sys_syslog)
359
360/* kernel/ptrace.c */
361#define __NR_ptrace 117
362__SYSCALL(__NR_ptrace, sys_ptrace)
363
364/* kernel/sched.c */
365#define __NR_sched_setparam 118
366__SYSCALL(__NR_sched_setparam, sys_sched_setparam)
367#define __NR_sched_setscheduler 119
368__SYSCALL(__NR_sched_setscheduler, sys_sched_setscheduler)
369#define __NR_sched_getscheduler 120
370__SYSCALL(__NR_sched_getscheduler, sys_sched_getscheduler)
371#define __NR_sched_getparam 121
372__SYSCALL(__NR_sched_getparam, sys_sched_getparam)
373#define __NR_sched_setaffinity 122
374__SC_COMP(__NR_sched_setaffinity, sys_sched_setaffinity, \
375 compat_sys_sched_setaffinity)
376#define __NR_sched_getaffinity 123
377__SC_COMP(__NR_sched_getaffinity, sys_sched_getaffinity, \
378 compat_sys_sched_getaffinity)
379#define __NR_sched_yield 124
380__SYSCALL(__NR_sched_yield, sys_sched_yield)
381#define __NR_sched_get_priority_max 125
382__SYSCALL(__NR_sched_get_priority_max, sys_sched_get_priority_max)
383#define __NR_sched_get_priority_min 126
384__SYSCALL(__NR_sched_get_priority_min, sys_sched_get_priority_min)
385#define __NR_sched_rr_get_interval 127
386__SC_COMP(__NR_sched_rr_get_interval, sys_sched_rr_get_interval, \
387 compat_sys_sched_rr_get_interval)
388
389/* kernel/signal.c */
390#define __NR_restart_syscall 128
391__SYSCALL(__NR_restart_syscall, sys_restart_syscall)
392#define __NR_kill 129
393__SYSCALL(__NR_kill, sys_kill)
394#define __NR_tkill 130
395__SYSCALL(__NR_tkill, sys_tkill)
396#define __NR_tgkill 131
397__SYSCALL(__NR_tgkill, sys_tgkill)
398#define __NR_sigaltstack 132
399__SC_COMP(__NR_sigaltstack, sys_sigaltstack, compat_sys_sigaltstack)
400#define __NR_rt_sigsuspend 133
401__SC_COMP(__NR_rt_sigsuspend, sys_rt_sigsuspend, compat_sys_rt_sigsuspend)
402#define __NR_rt_sigaction 134
403__SC_COMP(__NR_rt_sigaction, sys_rt_sigaction, compat_sys_rt_sigaction)
404#define __NR_rt_sigprocmask 135
405__SYSCALL(__NR_rt_sigprocmask, sys_rt_sigprocmask)
406#define __NR_rt_sigpending 136
407__SYSCALL(__NR_rt_sigpending, sys_rt_sigpending)
408#define __NR_rt_sigtimedwait 137
409__SC_COMP(__NR_rt_sigtimedwait, sys_rt_sigtimedwait, \
410 compat_sys_rt_sigtimedwait)
411#define __NR_rt_sigqueueinfo 138
412__SC_COMP(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo, \
413 compat_sys_rt_sigqueueinfo)
414#define __NR_rt_sigreturn 139
415__SC_COMP(__NR_rt_sigreturn, sys_rt_sigreturn, compat_sys_rt_sigreturn)
416
417/* kernel/sys.c */
418#define __NR_setpriority 140
419__SYSCALL(__NR_setpriority, sys_setpriority)
420#define __NR_getpriority 141
421__SYSCALL(__NR_getpriority, sys_getpriority)
422#define __NR_reboot 142
423__SYSCALL(__NR_reboot, sys_reboot)
424#define __NR_setregid 143
425__SYSCALL(__NR_setregid, sys_setregid)
426#define __NR_setgid 144
427__SYSCALL(__NR_setgid, sys_setgid)
428#define __NR_setreuid 145
429__SYSCALL(__NR_setreuid, sys_setreuid)
430#define __NR_setuid 146
431__SYSCALL(__NR_setuid, sys_setuid)
432#define __NR_setresuid 147
433__SYSCALL(__NR_setresuid, sys_setresuid)
434#define __NR_getresuid 148
435__SYSCALL(__NR_getresuid, sys_getresuid)
436#define __NR_setresgid 149
437__SYSCALL(__NR_setresgid, sys_setresgid)
438#define __NR_getresgid 150
439__SYSCALL(__NR_getresgid, sys_getresgid)
440#define __NR_setfsuid 151
441__SYSCALL(__NR_setfsuid, sys_setfsuid)
442#define __NR_setfsgid 152
443__SYSCALL(__NR_setfsgid, sys_setfsgid)
444#define __NR_times 153
445__SC_COMP(__NR_times, sys_times, compat_sys_times)
446#define __NR_setpgid 154
447__SYSCALL(__NR_setpgid, sys_setpgid)
448#define __NR_getpgid 155
449__SYSCALL(__NR_getpgid, sys_getpgid)
450#define __NR_getsid 156
451__SYSCALL(__NR_getsid, sys_getsid)
452#define __NR_setsid 157
453__SYSCALL(__NR_setsid, sys_setsid)
454#define __NR_getgroups 158
455__SYSCALL(__NR_getgroups, sys_getgroups)
456#define __NR_setgroups 159
457__SYSCALL(__NR_setgroups, sys_setgroups)
458#define __NR_uname 160
459__SYSCALL(__NR_uname, sys_newuname)
460#define __NR_sethostname 161
461__SYSCALL(__NR_sethostname, sys_sethostname)
462#define __NR_setdomainname 162
463__SYSCALL(__NR_setdomainname, sys_setdomainname)
464#define __NR_getrlimit 163
465__SC_COMP(__NR_getrlimit, sys_getrlimit, compat_sys_getrlimit)
466#define __NR_setrlimit 164
467__SC_COMP(__NR_setrlimit, sys_setrlimit, compat_sys_setrlimit)
468#define __NR_getrusage 165
469__SC_COMP(__NR_getrusage, sys_getrusage, compat_sys_getrusage)
470#define __NR_umask 166
471__SYSCALL(__NR_umask, sys_umask)
472#define __NR_prctl 167
473__SYSCALL(__NR_prctl, sys_prctl)
474#define __NR_getcpu 168
475__SYSCALL(__NR_getcpu, sys_getcpu)
476
477/* kernel/time.c */
478#define __NR_gettimeofday 169
479__SC_COMP(__NR_gettimeofday, sys_gettimeofday, compat_sys_gettimeofday)
480#define __NR_settimeofday 170
481__SC_COMP(__NR_settimeofday, sys_settimeofday, compat_sys_settimeofday)
482#define __NR_adjtimex 171
483__SC_COMP(__NR_adjtimex, sys_adjtimex, compat_sys_adjtimex)
484
485/* kernel/timer.c */
486#define __NR_getpid 172
487__SYSCALL(__NR_getpid, sys_getpid)
488#define __NR_getppid 173
489__SYSCALL(__NR_getppid, sys_getppid)
490#define __NR_getuid 174
491__SYSCALL(__NR_getuid, sys_getuid)
492#define __NR_geteuid 175
493__SYSCALL(__NR_geteuid, sys_geteuid)
494#define __NR_getgid 176
495__SYSCALL(__NR_getgid, sys_getgid)
496#define __NR_getegid 177
497__SYSCALL(__NR_getegid, sys_getegid)
498#define __NR_gettid 178
499__SYSCALL(__NR_gettid, sys_gettid)
500#define __NR_sysinfo 179
501__SC_COMP(__NR_sysinfo, sys_sysinfo, compat_sys_sysinfo)
502
503/* ipc/mqueue.c */
504#define __NR_mq_open 180
505__SC_COMP(__NR_mq_open, sys_mq_open, compat_sys_mq_open)
506#define __NR_mq_unlink 181
507__SYSCALL(__NR_mq_unlink, sys_mq_unlink)
508#define __NR_mq_timedsend 182
509__SC_COMP(__NR_mq_timedsend, sys_mq_timedsend, compat_sys_mq_timedsend)
510#define __NR_mq_timedreceive 183
511__SC_COMP(__NR_mq_timedreceive, sys_mq_timedreceive, \
512 compat_sys_mq_timedreceive)
513#define __NR_mq_notify 184
514__SC_COMP(__NR_mq_notify, sys_mq_notify, compat_sys_mq_notify)
515#define __NR_mq_getsetattr 185
516__SC_COMP(__NR_mq_getsetattr, sys_mq_getsetattr, compat_sys_mq_getsetattr)
517
518/* ipc/msg.c */
519#define __NR_msgget 186
520__SYSCALL(__NR_msgget, sys_msgget)
521#define __NR_msgctl 187
522__SC_COMP(__NR_msgctl, sys_msgctl, compat_sys_msgctl)
523#define __NR_msgrcv 188
524__SC_COMP(__NR_msgrcv, sys_msgrcv, compat_sys_msgrcv)
525#define __NR_msgsnd 189
526__SC_COMP(__NR_msgsnd, sys_msgsnd, compat_sys_msgsnd)
527
528/* ipc/sem.c */
529#define __NR_semget 190
530__SYSCALL(__NR_semget, sys_semget)
531#define __NR_semctl 191
532__SC_COMP(__NR_semctl, sys_semctl, compat_sys_semctl)
533#define __NR_semtimedop 192
534__SC_COMP(__NR_semtimedop, sys_semtimedop, compat_sys_semtimedop)
535#define __NR_semop 193
536__SYSCALL(__NR_semop, sys_semop)
537
538/* ipc/shm.c */
539#define __NR_shmget 194
540__SYSCALL(__NR_shmget, sys_shmget)
541#define __NR_shmctl 195
542__SC_COMP(__NR_shmctl, sys_shmctl, compat_sys_shmctl)
543#define __NR_shmat 196
544__SC_COMP(__NR_shmat, sys_shmat, compat_sys_shmat)
545#define __NR_shmdt 197
546__SYSCALL(__NR_shmdt, sys_shmdt)
547
548/* net/socket.c */
549#define __NR_socket 198
550__SYSCALL(__NR_socket, sys_socket)
551#define __NR_socketpair 199
552__SYSCALL(__NR_socketpair, sys_socketpair)
553#define __NR_bind 200
554__SYSCALL(__NR_bind, sys_bind)
555#define __NR_listen 201
556__SYSCALL(__NR_listen, sys_listen)
557#define __NR_accept 202
558__SYSCALL(__NR_accept, sys_accept)
559#define __NR_connect 203
560__SYSCALL(__NR_connect, sys_connect)
561#define __NR_getsockname 204
562__SYSCALL(__NR_getsockname, sys_getsockname)
563#define __NR_getpeername 205
564__SYSCALL(__NR_getpeername, sys_getpeername)
565#define __NR_sendto 206
566__SYSCALL(__NR_sendto, sys_sendto)
567#define __NR_recvfrom 207
568__SC_COMP(__NR_recvfrom, sys_recvfrom, compat_sys_recvfrom)
569#define __NR_setsockopt 208
570__SC_COMP(__NR_setsockopt, sys_setsockopt, compat_sys_setsockopt)
571#define __NR_getsockopt 209
572__SC_COMP(__NR_getsockopt, sys_getsockopt, compat_sys_getsockopt)
573#define __NR_shutdown 210
574__SYSCALL(__NR_shutdown, sys_shutdown)
575#define __NR_sendmsg 211
576__SC_COMP(__NR_sendmsg, sys_sendmsg, compat_sys_sendmsg)
577#define __NR_recvmsg 212
578__SC_COMP(__NR_recvmsg, sys_recvmsg, compat_sys_recvmsg)
579
580/* mm/filemap.c */
581#define __NR_readahead 213
582__SC_COMP(__NR_readahead, sys_readahead, compat_sys_readahead)
583
584/* mm/nommu.c, also with MMU */
585#define __NR_brk 214
586__SYSCALL(__NR_brk, sys_brk)
587#define __NR_munmap 215
588__SYSCALL(__NR_munmap, sys_munmap)
589#define __NR_mremap 216
590__SYSCALL(__NR_mremap, sys_mremap)
591
592/* security/keys/keyctl.c */
593#define __NR_add_key 217
594__SYSCALL(__NR_add_key, sys_add_key)
595#define __NR_request_key 218
596__SYSCALL(__NR_request_key, sys_request_key)
597#define __NR_keyctl 219
598__SC_COMP(__NR_keyctl, sys_keyctl, compat_sys_keyctl)
599
600/* arch/example/kernel/sys_example.c */
601#define __NR_clone 220
602__SYSCALL(__NR_clone, sys_clone)
603#define __NR_execve 221
604__SC_COMP(__NR_execve, sys_execve, compat_sys_execve)
605
606#define __NR3264_mmap 222
607__SC_3264(__NR3264_mmap, sys_mmap2, sys_mmap)
608/* mm/fadvise.c */
609#define __NR3264_fadvise64 223
610__SC_COMP(__NR3264_fadvise64, sys_fadvise64_64, compat_sys_fadvise64_64)
611
612/* mm/, CONFIG_MMU only */
613#ifndef __ARCH_NOMMU
614#define __NR_swapon 224
615__SYSCALL(__NR_swapon, sys_swapon)
616#define __NR_swapoff 225
617__SYSCALL(__NR_swapoff, sys_swapoff)
618#define __NR_mprotect 226
619__SYSCALL(__NR_mprotect, sys_mprotect)
620#define __NR_msync 227
621__SYSCALL(__NR_msync, sys_msync)
622#define __NR_mlock 228
623__SYSCALL(__NR_mlock, sys_mlock)
624#define __NR_munlock 229
625__SYSCALL(__NR_munlock, sys_munlock)
626#define __NR_mlockall 230
627__SYSCALL(__NR_mlockall, sys_mlockall)
628#define __NR_munlockall 231
629__SYSCALL(__NR_munlockall, sys_munlockall)
630#define __NR_mincore 232
631__SYSCALL(__NR_mincore, sys_mincore)
632#define __NR_madvise 233
633__SYSCALL(__NR_madvise, sys_madvise)
634#define __NR_remap_file_pages 234
635__SYSCALL(__NR_remap_file_pages, sys_remap_file_pages)
636#define __NR_mbind 235
637__SC_COMP(__NR_mbind, sys_mbind, compat_sys_mbind)
638#define __NR_get_mempolicy 236
639__SC_COMP(__NR_get_mempolicy, sys_get_mempolicy, compat_sys_get_mempolicy)
640#define __NR_set_mempolicy 237
641__SC_COMP(__NR_set_mempolicy, sys_set_mempolicy, compat_sys_set_mempolicy)
642#define __NR_migrate_pages 238
643__SC_COMP(__NR_migrate_pages, sys_migrate_pages, compat_sys_migrate_pages)
644#define __NR_move_pages 239
645__SC_COMP(__NR_move_pages, sys_move_pages, compat_sys_move_pages)
646#endif
647
648#define __NR_rt_tgsigqueueinfo 240
649__SC_COMP(__NR_rt_tgsigqueueinfo, sys_rt_tgsigqueueinfo, \
650 compat_sys_rt_tgsigqueueinfo)
651#define __NR_perf_event_open 241
652__SYSCALL(__NR_perf_event_open, sys_perf_event_open)
653#define __NR_accept4 242
654__SYSCALL(__NR_accept4, sys_accept4)
655#define __NR_recvmmsg 243
656__SC_COMP(__NR_recvmmsg, sys_recvmmsg, compat_sys_recvmmsg)
657
658/*
659 * Architectures may provide up to 16 syscalls of their own
660 * starting with this value.
661 */
662#define __NR_arch_specific_syscall 244
663
664#define __NR_wait4 260
665__SC_COMP(__NR_wait4, sys_wait4, compat_sys_wait4)
666#define __NR_prlimit64 261
667__SYSCALL(__NR_prlimit64, sys_prlimit64)
668#define __NR_fanotify_init 262
669__SYSCALL(__NR_fanotify_init, sys_fanotify_init)
670#define __NR_fanotify_mark 263
671__SYSCALL(__NR_fanotify_mark, sys_fanotify_mark)
672#define __NR_name_to_handle_at 264
673__SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at)
674#define __NR_open_by_handle_at 265
675__SC_COMP(__NR_open_by_handle_at, sys_open_by_handle_at, \
676 compat_sys_open_by_handle_at)
677#define __NR_clock_adjtime 266
678__SC_COMP(__NR_clock_adjtime, sys_clock_adjtime, compat_sys_clock_adjtime)
679#define __NR_syncfs 267
680__SYSCALL(__NR_syncfs, sys_syncfs)
681#define __NR_setns 268
682__SYSCALL(__NR_setns, sys_setns)
683#define __NR_sendmmsg 269
684__SC_COMP(__NR_sendmmsg, sys_sendmmsg, compat_sys_sendmmsg)
685#define __NR_process_vm_readv 270
686__SC_COMP(__NR_process_vm_readv, sys_process_vm_readv, \
687 compat_sys_process_vm_readv)
688#define __NR_process_vm_writev 271
689__SC_COMP(__NR_process_vm_writev, sys_process_vm_writev, \
690 compat_sys_process_vm_writev)
691#define __NR_kcmp 272
692__SYSCALL(__NR_kcmp, sys_kcmp)
693
694#undef __NR_syscalls
695#define __NR_syscalls 273
696
697/*
698 * All syscalls below here should go away really,
699 * these are provided for both review and as a porting
700 * help for the C library version.
701*
702 * Last chance: are any of these important enough to
703 * enable by default?
704 */
705#ifdef __ARCH_WANT_SYSCALL_NO_AT
706#define __NR_open 1024
707__SYSCALL(__NR_open, sys_open)
708#define __NR_link 1025
709__SYSCALL(__NR_link, sys_link)
710#define __NR_unlink 1026
711__SYSCALL(__NR_unlink, sys_unlink)
712#define __NR_mknod 1027
713__SYSCALL(__NR_mknod, sys_mknod)
714#define __NR_chmod 1028
715__SYSCALL(__NR_chmod, sys_chmod)
716#define __NR_chown 1029
717__SYSCALL(__NR_chown, sys_chown)
718#define __NR_mkdir 1030
719__SYSCALL(__NR_mkdir, sys_mkdir)
720#define __NR_rmdir 1031
721__SYSCALL(__NR_rmdir, sys_rmdir)
722#define __NR_lchown 1032
723__SYSCALL(__NR_lchown, sys_lchown)
724#define __NR_access 1033
725__SYSCALL(__NR_access, sys_access)
726#define __NR_rename 1034
727__SYSCALL(__NR_rename, sys_rename)
728#define __NR_readlink 1035
729__SYSCALL(__NR_readlink, sys_readlink)
730#define __NR_symlink 1036
731__SYSCALL(__NR_symlink, sys_symlink)
732#define __NR_utimes 1037
733__SYSCALL(__NR_utimes, sys_utimes)
734#define __NR3264_stat 1038
735__SC_3264(__NR3264_stat, sys_stat64, sys_newstat)
736#define __NR3264_lstat 1039
737__SC_3264(__NR3264_lstat, sys_lstat64, sys_newlstat)
738
739#undef __NR_syscalls
740#define __NR_syscalls (__NR3264_lstat+1)
741#endif /* __ARCH_WANT_SYSCALL_NO_AT */
742
743#ifdef __ARCH_WANT_SYSCALL_NO_FLAGS
744#define __NR_pipe 1040
745__SYSCALL(__NR_pipe, sys_pipe)
746#define __NR_dup2 1041
747__SYSCALL(__NR_dup2, sys_dup2)
748#define __NR_epoll_create 1042
749__SYSCALL(__NR_epoll_create, sys_epoll_create)
750#define __NR_inotify_init 1043
751__SYSCALL(__NR_inotify_init, sys_inotify_init)
752#define __NR_eventfd 1044
753__SYSCALL(__NR_eventfd, sys_eventfd)
754#define __NR_signalfd 1045
755__SYSCALL(__NR_signalfd, sys_signalfd)
756
757#undef __NR_syscalls
758#define __NR_syscalls (__NR_signalfd+1)
759#endif /* __ARCH_WANT_SYSCALL_NO_FLAGS */
760
761#if (__BITS_PER_LONG == 32 || defined(__SYSCALL_COMPAT)) && \
762 defined(__ARCH_WANT_SYSCALL_OFF_T)
763#define __NR_sendfile 1046
764__SYSCALL(__NR_sendfile, sys_sendfile)
765#define __NR_ftruncate 1047
766__SYSCALL(__NR_ftruncate, sys_ftruncate)
767#define __NR_truncate 1048
768__SYSCALL(__NR_truncate, sys_truncate)
769#define __NR_stat 1049
770__SYSCALL(__NR_stat, sys_newstat)
771#define __NR_lstat 1050
772__SYSCALL(__NR_lstat, sys_newlstat)
773#define __NR_fstat 1051
774__SYSCALL(__NR_fstat, sys_newfstat)
775#define __NR_fcntl 1052
776__SYSCALL(__NR_fcntl, sys_fcntl)
777#define __NR_fadvise64 1053
778#define __ARCH_WANT_SYS_FADVISE64
779__SYSCALL(__NR_fadvise64, sys_fadvise64)
780#define __NR_newfstatat 1054
781#define __ARCH_WANT_SYS_NEWFSTATAT
782__SYSCALL(__NR_newfstatat, sys_newfstatat)
783#define __NR_fstatfs 1055
784__SYSCALL(__NR_fstatfs, sys_fstatfs)
785#define __NR_statfs 1056
786__SYSCALL(__NR_statfs, sys_statfs)
787#define __NR_lseek 1057
788__SYSCALL(__NR_lseek, sys_lseek)
789#define __NR_mmap 1058
790__SYSCALL(__NR_mmap, sys_mmap)
791
792#undef __NR_syscalls
793#define __NR_syscalls (__NR_mmap+1)
794#endif /* 32 bit off_t syscalls */
795
796#ifdef __ARCH_WANT_SYSCALL_DEPRECATED
797#define __NR_alarm 1059
798#define __ARCH_WANT_SYS_ALARM
799__SYSCALL(__NR_alarm, sys_alarm)
800#define __NR_getpgrp 1060
801#define __ARCH_WANT_SYS_GETPGRP
802__SYSCALL(__NR_getpgrp, sys_getpgrp)
803#define __NR_pause 1061
804#define __ARCH_WANT_SYS_PAUSE
805__SYSCALL(__NR_pause, sys_pause)
806#define __NR_time 1062
807#define __ARCH_WANT_SYS_TIME
808#define __ARCH_WANT_COMPAT_SYS_TIME
809__SYSCALL(__NR_time, sys_time)
810#define __NR_utime 1063
811#define __ARCH_WANT_SYS_UTIME
812__SYSCALL(__NR_utime, sys_utime)
813
814#define __NR_creat 1064
815__SYSCALL(__NR_creat, sys_creat)
816#define __NR_getdents 1065
817#define __ARCH_WANT_SYS_GETDENTS
818__SYSCALL(__NR_getdents, sys_getdents)
819#define __NR_futimesat 1066
820__SYSCALL(__NR_futimesat, sys_futimesat)
821#define __NR_select 1067
822#define __ARCH_WANT_SYS_SELECT
823__SYSCALL(__NR_select, sys_select)
824#define __NR_poll 1068
825__SYSCALL(__NR_poll, sys_poll)
826#define __NR_epoll_wait 1069
827__SYSCALL(__NR_epoll_wait, sys_epoll_wait)
828#define __NR_ustat 1070
829__SYSCALL(__NR_ustat, sys_ustat)
830#define __NR_vfork 1071
831__SYSCALL(__NR_vfork, sys_vfork)
832#define __NR_oldwait4 1072
833__SYSCALL(__NR_oldwait4, sys_wait4)
834#define __NR_recv 1073
835__SYSCALL(__NR_recv, sys_recv)
836#define __NR_send 1074
837__SYSCALL(__NR_send, sys_send)
838#define __NR_bdflush 1075
839__SYSCALL(__NR_bdflush, sys_bdflush)
840#define __NR_umount 1076
841__SYSCALL(__NR_umount, sys_oldumount)
842#define __ARCH_WANT_SYS_OLDUMOUNT
843#define __NR_uselib 1077
844__SYSCALL(__NR_uselib, sys_uselib)
845#define __NR__sysctl 1078
846__SYSCALL(__NR__sysctl, sys_sysctl)
847
848#define __NR_fork 1079
849#ifdef CONFIG_MMU
850__SYSCALL(__NR_fork, sys_fork)
851#else
852__SYSCALL(__NR_fork, sys_ni_syscall)
853#endif /* CONFIG_MMU */
854
855#undef __NR_syscalls
856#define __NR_syscalls (__NR_fork+1)
857
858#endif /* __ARCH_WANT_SYSCALL_DEPRECATED */
859
860/*
861 * 32 bit systems traditionally used different
862 * syscalls for off_t and loff_t arguments, while
863 * 64 bit systems only need the off_t version.
864 * For new 32 bit platforms, there is no need to
865 * implement the old 32 bit off_t syscalls, so
866 * they take different names.
867 * Here we map the numbers so that both versions
868 * use the same syscall table layout.
869 */
870#if __BITS_PER_LONG == 64 && !defined(__SYSCALL_COMPAT)
871#define __NR_fcntl __NR3264_fcntl
872#define __NR_statfs __NR3264_statfs
873#define __NR_fstatfs __NR3264_fstatfs
874#define __NR_truncate __NR3264_truncate
875#define __NR_ftruncate __NR3264_ftruncate
876#define __NR_lseek __NR3264_lseek
877#define __NR_sendfile __NR3264_sendfile
878#define __NR_newfstatat __NR3264_fstatat
879#define __NR_fstat __NR3264_fstat
880#define __NR_mmap __NR3264_mmap
881#define __NR_fadvise64 __NR3264_fadvise64
882#ifdef __NR3264_stat
883#define __NR_stat __NR3264_stat
884#define __NR_lstat __NR3264_lstat
885#endif
886#else
887#define __NR_fcntl64 __NR3264_fcntl
888#define __NR_statfs64 __NR3264_statfs
889#define __NR_fstatfs64 __NR3264_fstatfs
890#define __NR_truncate64 __NR3264_truncate
891#define __NR_ftruncate64 __NR3264_ftruncate
892#define __NR_llseek __NR3264_lseek
893#define __NR_sendfile64 __NR3264_sendfile
894#define __NR_fstatat64 __NR3264_fstatat
895#define __NR_fstat64 __NR3264_fstat
896#define __NR_mmap2 __NR3264_mmap
897#define __NR_fadvise64_64 __NR3264_fadvise64
898#ifdef __NR3264_stat
899#define __NR_stat64 __NR3264_stat
900#define __NR_lstat64 __NR3264_lstat
901#endif
902#endif
diff --git a/include/uapi/drm/Kbuild b/include/uapi/drm/Kbuild
index aafaa5aa54d4..ba99ce3f7372 100644
--- a/include/uapi/drm/Kbuild
+++ b/include/uapi/drm/Kbuild
@@ -1 +1,16 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += drm.h
3header-y += drm_fourcc.h
4header-y += drm_mode.h
5header-y += drm_sarea.h
6header-y += exynos_drm.h
7header-y += i810_drm.h
8header-y += i915_drm.h
9header-y += mga_drm.h
10header-y += nouveau_drm.h
11header-y += r128_drm.h
12header-y += radeon_drm.h
13header-y += savage_drm.h
14header-y += sis_drm.h
15header-y += via_drm.h
16header-y += vmwgfx_drm.h
diff --git a/include/drm/drm.h b/include/uapi/drm/drm.h
index 1e3481edf062..1e3481edf062 100644
--- a/include/drm/drm.h
+++ b/include/uapi/drm/drm.h
diff --git a/include/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
index 646ae5f39f42..646ae5f39f42 100644
--- a/include/drm/drm_fourcc.h
+++ b/include/uapi/drm/drm_fourcc.h
diff --git a/include/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 3d6301b6ec16..3d6301b6ec16 100644
--- a/include/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
diff --git a/include/drm/drm_sarea.h b/include/uapi/drm/drm_sarea.h
index 413a5642d49f..413a5642d49f 100644
--- a/include/drm/drm_sarea.h
+++ b/include/uapi/drm/drm_sarea.h
diff --git a/include/uapi/drm/exynos_drm.h b/include/uapi/drm/exynos_drm.h
new file mode 100644
index 000000000000..c0494d586e23
--- /dev/null
+++ b/include/uapi/drm/exynos_drm.h
@@ -0,0 +1,203 @@
1/* exynos_drm.h
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * Authors:
5 * Inki Dae <inki.dae@samsung.com>
6 * Joonyoung Shim <jy0922.shim@samsung.com>
7 * Seung-Woo Kim <sw0312.kim@samsung.com>
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice (including the next
17 * paragraph) shall be included in all copies or substantial portions of the
18 * Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */
28
29#ifndef _UAPI_EXYNOS_DRM_H_
30#define _UAPI_EXYNOS_DRM_H_
31
32#include <drm/drm.h>
33
34/**
35 * User-desired buffer creation information structure.
36 *
37 * @size: user-desired memory allocation size.
38 * - this size value would be page-aligned internally.
39 * @flags: user request for setting memory type or cache attributes.
40 * @handle: returned a handle to created gem object.
41 * - this handle will be set by gem module of kernel side.
42 */
43struct drm_exynos_gem_create {
44 uint64_t size;
45 unsigned int flags;
46 unsigned int handle;
47};
48
49/**
50 * A structure for getting buffer offset.
51 *
52 * @handle: a pointer to gem object created.
53 * @pad: just padding to be 64-bit aligned.
54 * @offset: relatived offset value of the memory region allocated.
55 * - this value should be set by user.
56 */
57struct drm_exynos_gem_map_off {
58 unsigned int handle;
59 unsigned int pad;
60 uint64_t offset;
61};
62
63/**
64 * A structure for mapping buffer.
65 *
66 * @handle: a handle to gem object created.
67 * @pad: just padding to be 64-bit aligned.
68 * @size: memory size to be mapped.
69 * @mapped: having user virtual address mmaped.
70 * - this variable would be filled by exynos gem module
71 * of kernel side with user virtual address which is allocated
72 * by do_mmap().
73 */
74struct drm_exynos_gem_mmap {
75 unsigned int handle;
76 unsigned int pad;
77 uint64_t size;
78 uint64_t mapped;
79};
80
81/**
82 * A structure to gem information.
83 *
84 * @handle: a handle to gem object created.
85 * @flags: flag value including memory type and cache attribute and
86 * this value would be set by driver.
87 * @size: size to memory region allocated by gem and this size would
88 * be set by driver.
89 */
90struct drm_exynos_gem_info {
91 unsigned int handle;
92 unsigned int flags;
93 uint64_t size;
94};
95
96/**
97 * A structure for user connection request of virtual display.
98 *
99 * @connection: indicate whether doing connetion or not by user.
100 * @extensions: if this value is 1 then the vidi driver would need additional
101 * 128bytes edid data.
102 * @edid: the edid data pointer from user side.
103 */
104struct drm_exynos_vidi_connection {
105 unsigned int connection;
106 unsigned int extensions;
107 uint64_t edid;
108};
109
110/* memory type definitions. */
111enum e_drm_exynos_gem_mem_type {
112 /* Physically Continuous memory and used as default. */
113 EXYNOS_BO_CONTIG = 0 << 0,
114 /* Physically Non-Continuous memory. */
115 EXYNOS_BO_NONCONTIG = 1 << 0,
116 /* non-cachable mapping and used as default. */
117 EXYNOS_BO_NONCACHABLE = 0 << 1,
118 /* cachable mapping. */
119 EXYNOS_BO_CACHABLE = 1 << 1,
120 /* write-combine mapping. */
121 EXYNOS_BO_WC = 1 << 2,
122 EXYNOS_BO_MASK = EXYNOS_BO_NONCONTIG | EXYNOS_BO_CACHABLE |
123 EXYNOS_BO_WC
124};
125
126struct drm_exynos_g2d_get_ver {
127 __u32 major;
128 __u32 minor;
129};
130
131struct drm_exynos_g2d_cmd {
132 __u32 offset;
133 __u32 data;
134};
135
136enum drm_exynos_g2d_event_type {
137 G2D_EVENT_NOT,
138 G2D_EVENT_NONSTOP,
139 G2D_EVENT_STOP, /* not yet */
140};
141
142struct drm_exynos_g2d_set_cmdlist {
143 __u64 cmd;
144 __u64 cmd_gem;
145 __u32 cmd_nr;
146 __u32 cmd_gem_nr;
147
148 /* for g2d event */
149 __u64 event_type;
150 __u64 user_data;
151};
152
153struct drm_exynos_g2d_exec {
154 __u64 async;
155};
156
157#define DRM_EXYNOS_GEM_CREATE 0x00
158#define DRM_EXYNOS_GEM_MAP_OFFSET 0x01
159#define DRM_EXYNOS_GEM_MMAP 0x02
160/* Reserved 0x03 ~ 0x05 for exynos specific gem ioctl */
161#define DRM_EXYNOS_GEM_GET 0x04
162#define DRM_EXYNOS_VIDI_CONNECTION 0x07
163
164/* G2D */
165#define DRM_EXYNOS_G2D_GET_VER 0x20
166#define DRM_EXYNOS_G2D_SET_CMDLIST 0x21
167#define DRM_EXYNOS_G2D_EXEC 0x22
168
169#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
170 DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
171
172#define DRM_IOCTL_EXYNOS_GEM_MAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + \
173 DRM_EXYNOS_GEM_MAP_OFFSET, struct drm_exynos_gem_map_off)
174
175#define DRM_IOCTL_EXYNOS_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + \
176 DRM_EXYNOS_GEM_MMAP, struct drm_exynos_gem_mmap)
177
178#define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \
179 DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info)
180
181#define DRM_IOCTL_EXYNOS_VIDI_CONNECTION DRM_IOWR(DRM_COMMAND_BASE + \
182 DRM_EXYNOS_VIDI_CONNECTION, struct drm_exynos_vidi_connection)
183
184#define DRM_IOCTL_EXYNOS_G2D_GET_VER DRM_IOWR(DRM_COMMAND_BASE + \
185 DRM_EXYNOS_G2D_GET_VER, struct drm_exynos_g2d_get_ver)
186#define DRM_IOCTL_EXYNOS_G2D_SET_CMDLIST DRM_IOWR(DRM_COMMAND_BASE + \
187 DRM_EXYNOS_G2D_SET_CMDLIST, struct drm_exynos_g2d_set_cmdlist)
188#define DRM_IOCTL_EXYNOS_G2D_EXEC DRM_IOWR(DRM_COMMAND_BASE + \
189 DRM_EXYNOS_G2D_EXEC, struct drm_exynos_g2d_exec)
190
191/* EXYNOS specific events */
192#define DRM_EXYNOS_G2D_EVENT 0x80000000
193
194struct drm_exynos_g2d_event {
195 struct drm_event base;
196 __u64 user_data;
197 __u32 tv_sec;
198 __u32 tv_usec;
199 __u32 cmdlist_no;
200 __u32 reserved;
201};
202
203#endif /* _UAPI_EXYNOS_DRM_H_ */
diff --git a/include/drm/i810_drm.h b/include/uapi/drm/i810_drm.h
index 7a10bb6f2c0f..7a10bb6f2c0f 100644
--- a/include/drm/i810_drm.h
+++ b/include/uapi/drm/i810_drm.h
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
new file mode 100644
index 000000000000..4322b1e7d2ed
--- /dev/null
+++ b/include/uapi/drm/i915_drm.h
@@ -0,0 +1,947 @@
1/*
2 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
15 * of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 */
26
27#ifndef _UAPI_I915_DRM_H_
28#define _UAPI_I915_DRM_H_
29
30#include <drm/drm.h>
31
32/* Please note that modifications to all structs defined here are
33 * subject to backwards-compatibility constraints.
34 */
35
36
37/* Each region is a minimum of 16k, and there are at most 255 of them.
38 */
39#define I915_NR_TEX_REGIONS 255 /* table size 2k - maximum due to use
40 * of chars for next/prev indices */
41#define I915_LOG_MIN_TEX_REGION_SIZE 14
42
43typedef struct _drm_i915_init {
44 enum {
45 I915_INIT_DMA = 0x01,
46 I915_CLEANUP_DMA = 0x02,
47 I915_RESUME_DMA = 0x03
48 } func;
49 unsigned int mmio_offset;
50 int sarea_priv_offset;
51 unsigned int ring_start;
52 unsigned int ring_end;
53 unsigned int ring_size;
54 unsigned int front_offset;
55 unsigned int back_offset;
56 unsigned int depth_offset;
57 unsigned int w;
58 unsigned int h;
59 unsigned int pitch;
60 unsigned int pitch_bits;
61 unsigned int back_pitch;
62 unsigned int depth_pitch;
63 unsigned int cpp;
64 unsigned int chipset;
65} drm_i915_init_t;
66
67typedef struct _drm_i915_sarea {
68 struct drm_tex_region texList[I915_NR_TEX_REGIONS + 1];
69 int last_upload; /* last time texture was uploaded */
70 int last_enqueue; /* last time a buffer was enqueued */
71 int last_dispatch; /* age of the most recently dispatched buffer */
72 int ctxOwner; /* last context to upload state */
73 int texAge;
74 int pf_enabled; /* is pageflipping allowed? */
75 int pf_active;
76 int pf_current_page; /* which buffer is being displayed? */
77 int perf_boxes; /* performance boxes to be displayed */
78 int width, height; /* screen size in pixels */
79
80 drm_handle_t front_handle;
81 int front_offset;
82 int front_size;
83
84 drm_handle_t back_handle;
85 int back_offset;
86 int back_size;
87
88 drm_handle_t depth_handle;
89 int depth_offset;
90 int depth_size;
91
92 drm_handle_t tex_handle;
93 int tex_offset;
94 int tex_size;
95 int log_tex_granularity;
96 int pitch;
97 int rotation; /* 0, 90, 180 or 270 */
98 int rotated_offset;
99 int rotated_size;
100 int rotated_pitch;
101 int virtualX, virtualY;
102
103 unsigned int front_tiled;
104 unsigned int back_tiled;
105 unsigned int depth_tiled;
106 unsigned int rotated_tiled;
107 unsigned int rotated2_tiled;
108
109 int pipeA_x;
110 int pipeA_y;
111 int pipeA_w;
112 int pipeA_h;
113 int pipeB_x;
114 int pipeB_y;
115 int pipeB_w;
116 int pipeB_h;
117
118 /* fill out some space for old userspace triple buffer */
119 drm_handle_t unused_handle;
120 __u32 unused1, unused2, unused3;
121
122 /* buffer object handles for static buffers. May change
123 * over the lifetime of the client.
124 */
125 __u32 front_bo_handle;
126 __u32 back_bo_handle;
127 __u32 unused_bo_handle;
128 __u32 depth_bo_handle;
129
130} drm_i915_sarea_t;
131
132/* due to userspace building against these headers we need some compat here */
133#define planeA_x pipeA_x
134#define planeA_y pipeA_y
135#define planeA_w pipeA_w
136#define planeA_h pipeA_h
137#define planeB_x pipeB_x
138#define planeB_y pipeB_y
139#define planeB_w pipeB_w
140#define planeB_h pipeB_h
141
142/* Flags for perf_boxes
143 */
144#define I915_BOX_RING_EMPTY 0x1
145#define I915_BOX_FLIP 0x2
146#define I915_BOX_WAIT 0x4
147#define I915_BOX_TEXTURE_LOAD 0x8
148#define I915_BOX_LOST_CONTEXT 0x10
149
150/* I915 specific ioctls
151 * The device specific ioctl range is 0x40 to 0x79.
152 */
153#define DRM_I915_INIT 0x00
154#define DRM_I915_FLUSH 0x01
155#define DRM_I915_FLIP 0x02
156#define DRM_I915_BATCHBUFFER 0x03
157#define DRM_I915_IRQ_EMIT 0x04
158#define DRM_I915_IRQ_WAIT 0x05
159#define DRM_I915_GETPARAM 0x06
160#define DRM_I915_SETPARAM 0x07
161#define DRM_I915_ALLOC 0x08
162#define DRM_I915_FREE 0x09
163#define DRM_I915_INIT_HEAP 0x0a
164#define DRM_I915_CMDBUFFER 0x0b
165#define DRM_I915_DESTROY_HEAP 0x0c
166#define DRM_I915_SET_VBLANK_PIPE 0x0d
167#define DRM_I915_GET_VBLANK_PIPE 0x0e
168#define DRM_I915_VBLANK_SWAP 0x0f
169#define DRM_I915_HWS_ADDR 0x11
170#define DRM_I915_GEM_INIT 0x13
171#define DRM_I915_GEM_EXECBUFFER 0x14
172#define DRM_I915_GEM_PIN 0x15
173#define DRM_I915_GEM_UNPIN 0x16
174#define DRM_I915_GEM_BUSY 0x17
175#define DRM_I915_GEM_THROTTLE 0x18
176#define DRM_I915_GEM_ENTERVT 0x19
177#define DRM_I915_GEM_LEAVEVT 0x1a
178#define DRM_I915_GEM_CREATE 0x1b
179#define DRM_I915_GEM_PREAD 0x1c
180#define DRM_I915_GEM_PWRITE 0x1d
181#define DRM_I915_GEM_MMAP 0x1e
182#define DRM_I915_GEM_SET_DOMAIN 0x1f
183#define DRM_I915_GEM_SW_FINISH 0x20
184#define DRM_I915_GEM_SET_TILING 0x21
185#define DRM_I915_GEM_GET_TILING 0x22
186#define DRM_I915_GEM_GET_APERTURE 0x23
187#define DRM_I915_GEM_MMAP_GTT 0x24
188#define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25
189#define DRM_I915_GEM_MADVISE 0x26
190#define DRM_I915_OVERLAY_PUT_IMAGE 0x27
191#define DRM_I915_OVERLAY_ATTRS 0x28
192#define DRM_I915_GEM_EXECBUFFER2 0x29
193#define DRM_I915_GET_SPRITE_COLORKEY 0x2a
194#define DRM_I915_SET_SPRITE_COLORKEY 0x2b
195#define DRM_I915_GEM_WAIT 0x2c
196#define DRM_I915_GEM_CONTEXT_CREATE 0x2d
197#define DRM_I915_GEM_CONTEXT_DESTROY 0x2e
198#define DRM_I915_GEM_SET_CACHING 0x2f
199#define DRM_I915_GEM_GET_CACHING 0x30
200#define DRM_I915_REG_READ 0x31
201
202#define DRM_IOCTL_I915_INIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
203#define DRM_IOCTL_I915_FLUSH DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
204#define DRM_IOCTL_I915_FLIP DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLIP)
205#define DRM_IOCTL_I915_BATCHBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_BATCHBUFFER, drm_i915_batchbuffer_t)
206#define DRM_IOCTL_I915_IRQ_EMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_IRQ_EMIT, drm_i915_irq_emit_t)
207#define DRM_IOCTL_I915_IRQ_WAIT DRM_IOW( DRM_COMMAND_BASE + DRM_I915_IRQ_WAIT, drm_i915_irq_wait_t)
208#define DRM_IOCTL_I915_GETPARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GETPARAM, drm_i915_getparam_t)
209#define DRM_IOCTL_I915_SETPARAM DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SETPARAM, drm_i915_setparam_t)
210#define DRM_IOCTL_I915_ALLOC DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_ALLOC, drm_i915_mem_alloc_t)
211#define DRM_IOCTL_I915_FREE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_FREE, drm_i915_mem_free_t)
212#define DRM_IOCTL_I915_INIT_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT_HEAP, drm_i915_mem_init_heap_t)
213#define DRM_IOCTL_I915_CMDBUFFER DRM_IOW( DRM_COMMAND_BASE + DRM_I915_CMDBUFFER, drm_i915_cmdbuffer_t)
214#define DRM_IOCTL_I915_DESTROY_HEAP DRM_IOW( DRM_COMMAND_BASE + DRM_I915_DESTROY_HEAP, drm_i915_mem_destroy_heap_t)
215#define DRM_IOCTL_I915_SET_VBLANK_PIPE DRM_IOW( DRM_COMMAND_BASE + DRM_I915_SET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
216#define DRM_IOCTL_I915_GET_VBLANK_PIPE DRM_IOR( DRM_COMMAND_BASE + DRM_I915_GET_VBLANK_PIPE, drm_i915_vblank_pipe_t)
217#define DRM_IOCTL_I915_VBLANK_SWAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_VBLANK_SWAP, drm_i915_vblank_swap_t)
218#define DRM_IOCTL_I915_HWS_ADDR DRM_IOW(DRM_COMMAND_BASE + DRM_I915_HWS_ADDR, struct drm_i915_gem_init)
219#define DRM_IOCTL_I915_GEM_INIT DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_INIT, struct drm_i915_gem_init)
220#define DRM_IOCTL_I915_GEM_EXECBUFFER DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER, struct drm_i915_gem_execbuffer)
221#define DRM_IOCTL_I915_GEM_EXECBUFFER2 DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_EXECBUFFER2, struct drm_i915_gem_execbuffer2)
222#define DRM_IOCTL_I915_GEM_PIN DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_PIN, struct drm_i915_gem_pin)
223#define DRM_IOCTL_I915_GEM_UNPIN DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_UNPIN, struct drm_i915_gem_unpin)
224#define DRM_IOCTL_I915_GEM_BUSY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_BUSY, struct drm_i915_gem_busy)
225#define DRM_IOCTL_I915_GEM_SET_CACHING DRM_IOW(DRM_COMMAND_BASE + DRM_I915_GEM_SET_CACHING, struct drm_i915_gem_caching)
226#define DRM_IOCTL_I915_GEM_GET_CACHING DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_GET_CACHING, struct drm_i915_gem_caching)
227#define DRM_IOCTL_I915_GEM_THROTTLE DRM_IO ( DRM_COMMAND_BASE + DRM_I915_GEM_THROTTLE)
228#define DRM_IOCTL_I915_GEM_ENTERVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_ENTERVT)
229#define DRM_IOCTL_I915_GEM_LEAVEVT DRM_IO(DRM_COMMAND_BASE + DRM_I915_GEM_LEAVEVT)
230#define DRM_IOCTL_I915_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_CREATE, struct drm_i915_gem_create)
231#define DRM_IOCTL_I915_GEM_PREAD DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PREAD, struct drm_i915_gem_pread)
232#define DRM_IOCTL_I915_GEM_PWRITE DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_PWRITE, struct drm_i915_gem_pwrite)
233#define DRM_IOCTL_I915_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP, struct drm_i915_gem_mmap)
234#define DRM_IOCTL_I915_GEM_MMAP_GTT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MMAP_GTT, struct drm_i915_gem_mmap_gtt)
235#define DRM_IOCTL_I915_GEM_SET_DOMAIN DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SET_DOMAIN, struct drm_i915_gem_set_domain)
236#define DRM_IOCTL_I915_GEM_SW_FINISH DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_SW_FINISH, struct drm_i915_gem_sw_finish)
237#define DRM_IOCTL_I915_GEM_SET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_SET_TILING, struct drm_i915_gem_set_tiling)
238#define DRM_IOCTL_I915_GEM_GET_TILING DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling)
239#define DRM_IOCTL_I915_GEM_GET_APERTURE DRM_IOR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_APERTURE, struct drm_i915_gem_get_aperture)
240#define DRM_IOCTL_I915_GET_PIPE_FROM_CRTC_ID DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GET_PIPE_FROM_CRTC_ID, struct drm_i915_get_pipe_from_crtc_id)
241#define DRM_IOCTL_I915_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_MADVISE, struct drm_i915_gem_madvise)
242#define DRM_IOCTL_I915_OVERLAY_PUT_IMAGE DRM_IOW(DRM_COMMAND_BASE + DRM_I915_OVERLAY_PUT_IMAGE, struct drm_intel_overlay_put_image)
243#define DRM_IOCTL_I915_OVERLAY_ATTRS DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_OVERLAY_ATTRS, struct drm_intel_overlay_attrs)
244#define DRM_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
245#define DRM_IOCTL_I915_GET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct drm_intel_sprite_colorkey)
246#define DRM_IOCTL_I915_GEM_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_GEM_WAIT, struct drm_i915_gem_wait)
247#define DRM_IOCTL_I915_GEM_CONTEXT_CREATE DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_CREATE, struct drm_i915_gem_context_create)
248#define DRM_IOCTL_I915_GEM_CONTEXT_DESTROY DRM_IOW (DRM_COMMAND_BASE + DRM_I915_GEM_CONTEXT_DESTROY, struct drm_i915_gem_context_destroy)
249#define DRM_IOCTL_I915_REG_READ DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_REG_READ, struct drm_i915_reg_read)
250
251/* Allow drivers to submit batchbuffers directly to hardware, relying
252 * on the security mechanisms provided by hardware.
253 */
254typedef struct drm_i915_batchbuffer {
255 int start; /* agp offset */
256 int used; /* nr bytes in use */
257 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
258 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
259 int num_cliprects; /* mulitpass with multiple cliprects? */
260 struct drm_clip_rect __user *cliprects; /* pointer to userspace cliprects */
261} drm_i915_batchbuffer_t;
262
263/* As above, but pass a pointer to userspace buffer which can be
264 * validated by the kernel prior to sending to hardware.
265 */
266typedef struct _drm_i915_cmdbuffer {
267 char __user *buf; /* pointer to userspace command buffer */
268 int sz; /* nr bytes in buf */
269 int DR1; /* hw flags for GFX_OP_DRAWRECT_INFO */
270 int DR4; /* window origin for GFX_OP_DRAWRECT_INFO */
271 int num_cliprects; /* mulitpass with multiple cliprects? */
272 struct drm_clip_rect __user *cliprects; /* pointer to userspace cliprects */
273} drm_i915_cmdbuffer_t;
274
275/* Userspace can request & wait on irq's:
276 */
277typedef struct drm_i915_irq_emit {
278 int __user *irq_seq;
279} drm_i915_irq_emit_t;
280
281typedef struct drm_i915_irq_wait {
282 int irq_seq;
283} drm_i915_irq_wait_t;
284
285/* Ioctl to query kernel params:
286 */
287#define I915_PARAM_IRQ_ACTIVE 1
288#define I915_PARAM_ALLOW_BATCHBUFFER 2
289#define I915_PARAM_LAST_DISPATCH 3
290#define I915_PARAM_CHIPSET_ID 4
291#define I915_PARAM_HAS_GEM 5
292#define I915_PARAM_NUM_FENCES_AVAIL 6
293#define I915_PARAM_HAS_OVERLAY 7
294#define I915_PARAM_HAS_PAGEFLIPPING 8
295#define I915_PARAM_HAS_EXECBUF2 9
296#define I915_PARAM_HAS_BSD 10
297#define I915_PARAM_HAS_BLT 11
298#define I915_PARAM_HAS_RELAXED_FENCING 12
299#define I915_PARAM_HAS_COHERENT_RINGS 13
300#define I915_PARAM_HAS_EXEC_CONSTANTS 14
301#define I915_PARAM_HAS_RELAXED_DELTA 15
302#define I915_PARAM_HAS_GEN7_SOL_RESET 16
303#define I915_PARAM_HAS_LLC 17
304#define I915_PARAM_HAS_ALIASING_PPGTT 18
305#define I915_PARAM_HAS_WAIT_TIMEOUT 19
306#define I915_PARAM_HAS_SEMAPHORES 20
307#define I915_PARAM_HAS_PRIME_VMAP_FLUSH 21
308#define I915_PARAM_RSVD_FOR_FUTURE_USE 22
309
310typedef struct drm_i915_getparam {
311 int param;
312 int __user *value;
313} drm_i915_getparam_t;
314
315/* Ioctl to set kernel params:
316 */
317#define I915_SETPARAM_USE_MI_BATCHBUFFER_START 1
318#define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY 2
319#define I915_SETPARAM_ALLOW_BATCHBUFFER 3
320#define I915_SETPARAM_NUM_USED_FENCES 4
321
322typedef struct drm_i915_setparam {
323 int param;
324 int value;
325} drm_i915_setparam_t;
326
327/* A memory manager for regions of shared memory:
328 */
329#define I915_MEM_REGION_AGP 1
330
331typedef struct drm_i915_mem_alloc {
332 int region;
333 int alignment;
334 int size;
335 int __user *region_offset; /* offset from start of fb or agp */
336} drm_i915_mem_alloc_t;
337
338typedef struct drm_i915_mem_free {
339 int region;
340 int region_offset;
341} drm_i915_mem_free_t;
342
343typedef struct drm_i915_mem_init_heap {
344 int region;
345 int size;
346 int start;
347} drm_i915_mem_init_heap_t;
348
349/* Allow memory manager to be torn down and re-initialized (eg on
350 * rotate):
351 */
352typedef struct drm_i915_mem_destroy_heap {
353 int region;
354} drm_i915_mem_destroy_heap_t;
355
356/* Allow X server to configure which pipes to monitor for vblank signals
357 */
358#define DRM_I915_VBLANK_PIPE_A 1
359#define DRM_I915_VBLANK_PIPE_B 2
360
361typedef struct drm_i915_vblank_pipe {
362 int pipe;
363} drm_i915_vblank_pipe_t;
364
365/* Schedule buffer swap at given vertical blank:
366 */
367typedef struct drm_i915_vblank_swap {
368 drm_drawable_t drawable;
369 enum drm_vblank_seq_type seqtype;
370 unsigned int sequence;
371} drm_i915_vblank_swap_t;
372
373typedef struct drm_i915_hws_addr {
374 __u64 addr;
375} drm_i915_hws_addr_t;
376
377struct drm_i915_gem_init {
378 /**
379 * Beginning offset in the GTT to be managed by the DRM memory
380 * manager.
381 */
382 __u64 gtt_start;
383 /**
384 * Ending offset in the GTT to be managed by the DRM memory
385 * manager.
386 */
387 __u64 gtt_end;
388};
389
390struct drm_i915_gem_create {
391 /**
392 * Requested size for the object.
393 *
394 * The (page-aligned) allocated size for the object will be returned.
395 */
396 __u64 size;
397 /**
398 * Returned handle for the object.
399 *
400 * Object handles are nonzero.
401 */
402 __u32 handle;
403 __u32 pad;
404};
405
406struct drm_i915_gem_pread {
407 /** Handle for the object being read. */
408 __u32 handle;
409 __u32 pad;
410 /** Offset into the object to read from */
411 __u64 offset;
412 /** Length of data to read */
413 __u64 size;
414 /**
415 * Pointer to write the data into.
416 *
417 * This is a fixed-size type for 32/64 compatibility.
418 */
419 __u64 data_ptr;
420};
421
422struct drm_i915_gem_pwrite {
423 /** Handle for the object being written to. */
424 __u32 handle;
425 __u32 pad;
426 /** Offset into the object to write to */
427 __u64 offset;
428 /** Length of data to write */
429 __u64 size;
430 /**
431 * Pointer to read the data from.
432 *
433 * This is a fixed-size type for 32/64 compatibility.
434 */
435 __u64 data_ptr;
436};
437
438struct drm_i915_gem_mmap {
439 /** Handle for the object being mapped. */
440 __u32 handle;
441 __u32 pad;
442 /** Offset in the object to map. */
443 __u64 offset;
444 /**
445 * Length of data to map.
446 *
447 * The value will be page-aligned.
448 */
449 __u64 size;
450 /**
451 * Returned pointer the data was mapped at.
452 *
453 * This is a fixed-size type for 32/64 compatibility.
454 */
455 __u64 addr_ptr;
456};
457
458struct drm_i915_gem_mmap_gtt {
459 /** Handle for the object being mapped. */
460 __u32 handle;
461 __u32 pad;
462 /**
463 * Fake offset to use for subsequent mmap call
464 *
465 * This is a fixed-size type for 32/64 compatibility.
466 */
467 __u64 offset;
468};
469
470struct drm_i915_gem_set_domain {
471 /** Handle for the object */
472 __u32 handle;
473
474 /** New read domains */
475 __u32 read_domains;
476
477 /** New write domain */
478 __u32 write_domain;
479};
480
481struct drm_i915_gem_sw_finish {
482 /** Handle for the object */
483 __u32 handle;
484};
485
486struct drm_i915_gem_relocation_entry {
487 /**
488 * Handle of the buffer being pointed to by this relocation entry.
489 *
490 * It's appealing to make this be an index into the mm_validate_entry
491 * list to refer to the buffer, but this allows the driver to create
492 * a relocation list for state buffers and not re-write it per
493 * exec using the buffer.
494 */
495 __u32 target_handle;
496
497 /**
498 * Value to be added to the offset of the target buffer to make up
499 * the relocation entry.
500 */
501 __u32 delta;
502
503 /** Offset in the buffer the relocation entry will be written into */
504 __u64 offset;
505
506 /**
507 * Offset value of the target buffer that the relocation entry was last
508 * written as.
509 *
510 * If the buffer has the same offset as last time, we can skip syncing
511 * and writing the relocation. This value is written back out by
512 * the execbuffer ioctl when the relocation is written.
513 */
514 __u64 presumed_offset;
515
516 /**
517 * Target memory domains read by this operation.
518 */
519 __u32 read_domains;
520
521 /**
522 * Target memory domains written by this operation.
523 *
524 * Note that only one domain may be written by the whole
525 * execbuffer operation, so that where there are conflicts,
526 * the application will get -EINVAL back.
527 */
528 __u32 write_domain;
529};
530
531/** @{
532 * Intel memory domains
533 *
534 * Most of these just align with the various caches in
535 * the system and are used to flush and invalidate as
536 * objects end up cached in different domains.
537 */
538/** CPU cache */
539#define I915_GEM_DOMAIN_CPU 0x00000001
540/** Render cache, used by 2D and 3D drawing */
541#define I915_GEM_DOMAIN_RENDER 0x00000002
542/** Sampler cache, used by texture engine */
543#define I915_GEM_DOMAIN_SAMPLER 0x00000004
544/** Command queue, used to load batch buffers */
545#define I915_GEM_DOMAIN_COMMAND 0x00000008
546/** Instruction cache, used by shader programs */
547#define I915_GEM_DOMAIN_INSTRUCTION 0x00000010
548/** Vertex address cache */
549#define I915_GEM_DOMAIN_VERTEX 0x00000020
550/** GTT domain - aperture and scanout */
551#define I915_GEM_DOMAIN_GTT 0x00000040
552/** @} */
553
554struct drm_i915_gem_exec_object {
555 /**
556 * User's handle for a buffer to be bound into the GTT for this
557 * operation.
558 */
559 __u32 handle;
560
561 /** Number of relocations to be performed on this buffer */
562 __u32 relocation_count;
563 /**
564 * Pointer to array of struct drm_i915_gem_relocation_entry containing
565 * the relocations to be performed in this buffer.
566 */
567 __u64 relocs_ptr;
568
569 /** Required alignment in graphics aperture */
570 __u64 alignment;
571
572 /**
573 * Returned value of the updated offset of the object, for future
574 * presumed_offset writes.
575 */
576 __u64 offset;
577};
578
579struct drm_i915_gem_execbuffer {
580 /**
581 * List of buffers to be validated with their relocations to be
582 * performend on them.
583 *
584 * This is a pointer to an array of struct drm_i915_gem_validate_entry.
585 *
586 * These buffers must be listed in an order such that all relocations
587 * a buffer is performing refer to buffers that have already appeared
588 * in the validate list.
589 */
590 __u64 buffers_ptr;
591 __u32 buffer_count;
592
593 /** Offset in the batchbuffer to start execution from. */
594 __u32 batch_start_offset;
595 /** Bytes used in batchbuffer from batch_start_offset */
596 __u32 batch_len;
597 __u32 DR1;
598 __u32 DR4;
599 __u32 num_cliprects;
600 /** This is a struct drm_clip_rect *cliprects */
601 __u64 cliprects_ptr;
602};
603
604struct drm_i915_gem_exec_object2 {
605 /**
606 * User's handle for a buffer to be bound into the GTT for this
607 * operation.
608 */
609 __u32 handle;
610
611 /** Number of relocations to be performed on this buffer */
612 __u32 relocation_count;
613 /**
614 * Pointer to array of struct drm_i915_gem_relocation_entry containing
615 * the relocations to be performed in this buffer.
616 */
617 __u64 relocs_ptr;
618
619 /** Required alignment in graphics aperture */
620 __u64 alignment;
621
622 /**
623 * Returned value of the updated offset of the object, for future
624 * presumed_offset writes.
625 */
626 __u64 offset;
627
628#define EXEC_OBJECT_NEEDS_FENCE (1<<0)
629 __u64 flags;
630 __u64 rsvd1;
631 __u64 rsvd2;
632};
633
634struct drm_i915_gem_execbuffer2 {
635 /**
636 * List of gem_exec_object2 structs
637 */
638 __u64 buffers_ptr;
639 __u32 buffer_count;
640
641 /** Offset in the batchbuffer to start execution from. */
642 __u32 batch_start_offset;
643 /** Bytes used in batchbuffer from batch_start_offset */
644 __u32 batch_len;
645 __u32 DR1;
646 __u32 DR4;
647 __u32 num_cliprects;
648 /** This is a struct drm_clip_rect *cliprects */
649 __u64 cliprects_ptr;
650#define I915_EXEC_RING_MASK (7<<0)
651#define I915_EXEC_DEFAULT (0<<0)
652#define I915_EXEC_RENDER (1<<0)
653#define I915_EXEC_BSD (2<<0)
654#define I915_EXEC_BLT (3<<0)
655
656/* Used for switching the constants addressing mode on gen4+ RENDER ring.
657 * Gen6+ only supports relative addressing to dynamic state (default) and
658 * absolute addressing.
659 *
660 * These flags are ignored for the BSD and BLT rings.
661 */
662#define I915_EXEC_CONSTANTS_MASK (3<<6)
663#define I915_EXEC_CONSTANTS_REL_GENERAL (0<<6) /* default */
664#define I915_EXEC_CONSTANTS_ABSOLUTE (1<<6)
665#define I915_EXEC_CONSTANTS_REL_SURFACE (2<<6) /* gen4/5 only */
666 __u64 flags;
667 __u64 rsvd1; /* now used for context info */
668 __u64 rsvd2;
669};
670
671/** Resets the SO write offset registers for transform feedback on gen7. */
672#define I915_EXEC_GEN7_SOL_RESET (1<<8)
673
674#define I915_EXEC_CONTEXT_ID_MASK (0xffffffff)
675#define i915_execbuffer2_set_context_id(eb2, context) \
676 (eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK
677#define i915_execbuffer2_get_context_id(eb2) \
678 ((eb2).rsvd1 & I915_EXEC_CONTEXT_ID_MASK)
679
680struct drm_i915_gem_pin {
681 /** Handle of the buffer to be pinned. */
682 __u32 handle;
683 __u32 pad;
684
685 /** alignment required within the aperture */
686 __u64 alignment;
687
688 /** Returned GTT offset of the buffer. */
689 __u64 offset;
690};
691
692struct drm_i915_gem_unpin {
693 /** Handle of the buffer to be unpinned. */
694 __u32 handle;
695 __u32 pad;
696};
697
698struct drm_i915_gem_busy {
699 /** Handle of the buffer to check for busy */
700 __u32 handle;
701
702 /** Return busy status (1 if busy, 0 if idle).
703 * The high word is used to indicate on which rings the object
704 * currently resides:
705 * 16:31 - busy (r or r/w) rings (16 render, 17 bsd, 18 blt, etc)
706 */
707 __u32 busy;
708};
709
710#define I915_CACHING_NONE 0
711#define I915_CACHING_CACHED 1
712
713struct drm_i915_gem_caching {
714 /**
715 * Handle of the buffer to set/get the caching level of. */
716 __u32 handle;
717
718 /**
719 * Cacheing level to apply or return value
720 *
721 * bits0-15 are for generic caching control (i.e. the above defined
722 * values). bits16-31 are reserved for platform-specific variations
723 * (e.g. l3$ caching on gen7). */
724 __u32 caching;
725};
726
727#define I915_TILING_NONE 0
728#define I915_TILING_X 1
729#define I915_TILING_Y 2
730
731#define I915_BIT_6_SWIZZLE_NONE 0
732#define I915_BIT_6_SWIZZLE_9 1
733#define I915_BIT_6_SWIZZLE_9_10 2
734#define I915_BIT_6_SWIZZLE_9_11 3
735#define I915_BIT_6_SWIZZLE_9_10_11 4
736/* Not seen by userland */
737#define I915_BIT_6_SWIZZLE_UNKNOWN 5
738/* Seen by userland. */
739#define I915_BIT_6_SWIZZLE_9_17 6
740#define I915_BIT_6_SWIZZLE_9_10_17 7
741
742struct drm_i915_gem_set_tiling {
743 /** Handle of the buffer to have its tiling state updated */
744 __u32 handle;
745
746 /**
747 * Tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
748 * I915_TILING_Y).
749 *
750 * This value is to be set on request, and will be updated by the
751 * kernel on successful return with the actual chosen tiling layout.
752 *
753 * The tiling mode may be demoted to I915_TILING_NONE when the system
754 * has bit 6 swizzling that can't be managed correctly by GEM.
755 *
756 * Buffer contents become undefined when changing tiling_mode.
757 */
758 __u32 tiling_mode;
759
760 /**
761 * Stride in bytes for the object when in I915_TILING_X or
762 * I915_TILING_Y.
763 */
764 __u32 stride;
765
766 /**
767 * Returned address bit 6 swizzling required for CPU access through
768 * mmap mapping.
769 */
770 __u32 swizzle_mode;
771};
772
773struct drm_i915_gem_get_tiling {
774 /** Handle of the buffer to get tiling state for. */
775 __u32 handle;
776
777 /**
778 * Current tiling mode for the object (I915_TILING_NONE, I915_TILING_X,
779 * I915_TILING_Y).
780 */
781 __u32 tiling_mode;
782
783 /**
784 * Returned address bit 6 swizzling required for CPU access through
785 * mmap mapping.
786 */
787 __u32 swizzle_mode;
788};
789
790struct drm_i915_gem_get_aperture {
791 /** Total size of the aperture used by i915_gem_execbuffer, in bytes */
792 __u64 aper_size;
793
794 /**
795 * Available space in the aperture used by i915_gem_execbuffer, in
796 * bytes
797 */
798 __u64 aper_available_size;
799};
800
801struct drm_i915_get_pipe_from_crtc_id {
802 /** ID of CRTC being requested **/
803 __u32 crtc_id;
804
805 /** pipe of requested CRTC **/
806 __u32 pipe;
807};
808
809#define I915_MADV_WILLNEED 0
810#define I915_MADV_DONTNEED 1
811#define __I915_MADV_PURGED 2 /* internal state */
812
813struct drm_i915_gem_madvise {
814 /** Handle of the buffer to change the backing store advice */
815 __u32 handle;
816
817 /* Advice: either the buffer will be needed again in the near future,
818 * or wont be and could be discarded under memory pressure.
819 */
820 __u32 madv;
821
822 /** Whether the backing store still exists. */
823 __u32 retained;
824};
825
826/* flags */
827#define I915_OVERLAY_TYPE_MASK 0xff
828#define I915_OVERLAY_YUV_PLANAR 0x01
829#define I915_OVERLAY_YUV_PACKED 0x02
830#define I915_OVERLAY_RGB 0x03
831
832#define I915_OVERLAY_DEPTH_MASK 0xff00
833#define I915_OVERLAY_RGB24 0x1000
834#define I915_OVERLAY_RGB16 0x2000
835#define I915_OVERLAY_RGB15 0x3000
836#define I915_OVERLAY_YUV422 0x0100
837#define I915_OVERLAY_YUV411 0x0200
838#define I915_OVERLAY_YUV420 0x0300
839#define I915_OVERLAY_YUV410 0x0400
840
841#define I915_OVERLAY_SWAP_MASK 0xff0000
842#define I915_OVERLAY_NO_SWAP 0x000000
843#define I915_OVERLAY_UV_SWAP 0x010000
844#define I915_OVERLAY_Y_SWAP 0x020000
845#define I915_OVERLAY_Y_AND_UV_SWAP 0x030000
846
847#define I915_OVERLAY_FLAGS_MASK 0xff000000
848#define I915_OVERLAY_ENABLE 0x01000000
849
850struct drm_intel_overlay_put_image {
851 /* various flags and src format description */
852 __u32 flags;
853 /* source picture description */
854 __u32 bo_handle;
855 /* stride values and offsets are in bytes, buffer relative */
856 __u16 stride_Y; /* stride for packed formats */
857 __u16 stride_UV;
858 __u32 offset_Y; /* offset for packet formats */
859 __u32 offset_U;
860 __u32 offset_V;
861 /* in pixels */
862 __u16 src_width;
863 __u16 src_height;
864 /* to compensate the scaling factors for partially covered surfaces */
865 __u16 src_scan_width;
866 __u16 src_scan_height;
867 /* output crtc description */
868 __u32 crtc_id;
869 __u16 dst_x;
870 __u16 dst_y;
871 __u16 dst_width;
872 __u16 dst_height;
873};
874
875/* flags */
876#define I915_OVERLAY_UPDATE_ATTRS (1<<0)
877#define I915_OVERLAY_UPDATE_GAMMA (1<<1)
878struct drm_intel_overlay_attrs {
879 __u32 flags;
880 __u32 color_key;
881 __s32 brightness;
882 __u32 contrast;
883 __u32 saturation;
884 __u32 gamma0;
885 __u32 gamma1;
886 __u32 gamma2;
887 __u32 gamma3;
888 __u32 gamma4;
889 __u32 gamma5;
890};
891
892/*
893 * Intel sprite handling
894 *
895 * Color keying works with a min/mask/max tuple. Both source and destination
896 * color keying is allowed.
897 *
898 * Source keying:
899 * Sprite pixels within the min & max values, masked against the color channels
900 * specified in the mask field, will be transparent. All other pixels will
901 * be displayed on top of the primary plane. For RGB surfaces, only the min
902 * and mask fields will be used; ranged compares are not allowed.
903 *
904 * Destination keying:
905 * Primary plane pixels that match the min value, masked against the color
906 * channels specified in the mask field, will be replaced by corresponding
907 * pixels from the sprite plane.
908 *
909 * Note that source & destination keying are exclusive; only one can be
910 * active on a given plane.
911 */
912
913#define I915_SET_COLORKEY_NONE (1<<0) /* disable color key matching */
914#define I915_SET_COLORKEY_DESTINATION (1<<1)
915#define I915_SET_COLORKEY_SOURCE (1<<2)
916struct drm_intel_sprite_colorkey {
917 __u32 plane_id;
918 __u32 min_value;
919 __u32 channel_mask;
920 __u32 max_value;
921 __u32 flags;
922};
923
924struct drm_i915_gem_wait {
925 /** Handle of BO we shall wait on */
926 __u32 bo_handle;
927 __u32 flags;
928 /** Number of nanoseconds to wait, Returns time remaining. */
929 __s64 timeout_ns;
930};
931
932struct drm_i915_gem_context_create {
933 /* output: id of new context*/
934 __u32 ctx_id;
935 __u32 pad;
936};
937
938struct drm_i915_gem_context_destroy {
939 __u32 ctx_id;
940 __u32 pad;
941};
942
943struct drm_i915_reg_read {
944 __u64 offset;
945 __u64 val; /* Return value */
946};
947#endif /* _UAPI_I915_DRM_H_ */
diff --git a/include/drm/mga_drm.h b/include/uapi/drm/mga_drm.h
index 2375bfd6e5e9..2375bfd6e5e9 100644
--- a/include/drm/mga_drm.h
+++ b/include/uapi/drm/mga_drm.h
diff --git a/include/drm/nouveau_drm.h b/include/uapi/drm/nouveau_drm.h
index 2a5769fdf8ba..2a5769fdf8ba 100644
--- a/include/drm/nouveau_drm.h
+++ b/include/uapi/drm/nouveau_drm.h
diff --git a/include/drm/r128_drm.h b/include/uapi/drm/r128_drm.h
index 8d8878b55f55..8d8878b55f55 100644
--- a/include/drm/r128_drm.h
+++ b/include/uapi/drm/r128_drm.h
diff --git a/include/drm/radeon_drm.h b/include/uapi/drm/radeon_drm.h
index 4766c0f6a838..4766c0f6a838 100644
--- a/include/drm/radeon_drm.h
+++ b/include/uapi/drm/radeon_drm.h
diff --git a/include/drm/savage_drm.h b/include/uapi/drm/savage_drm.h
index 818d49be2e6e..818d49be2e6e 100644
--- a/include/drm/savage_drm.h
+++ b/include/uapi/drm/savage_drm.h
diff --git a/include/drm/sis_drm.h b/include/uapi/drm/sis_drm.h
index df3763222d73..df3763222d73 100644
--- a/include/drm/sis_drm.h
+++ b/include/uapi/drm/sis_drm.h
diff --git a/include/drm/via_drm.h b/include/uapi/drm/via_drm.h
index 8b0533ccbd5a..8b0533ccbd5a 100644
--- a/include/drm/via_drm.h
+++ b/include/uapi/drm/via_drm.h
diff --git a/include/drm/vmwgfx_drm.h b/include/uapi/drm/vmwgfx_drm.h
index bcb0912afe7a..bcb0912afe7a 100644
--- a/include/drm/vmwgfx_drm.h
+++ b/include/uapi/drm/vmwgfx_drm.h
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index b0fd4d03499d..e194387ef784 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -22,3 +22,396 @@ header-y += usb/
22header-y += wimax/ 22header-y += wimax/
23 23
24genhdr-y += version.h 24genhdr-y += version.h
25
26ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/a.out.h \
27 $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h),)
28header-y += a.out.h
29endif
30
31header-y += acct.h
32header-y += adb.h
33header-y += adfs_fs.h
34header-y += affs_hardblocks.h
35header-y += agpgart.h
36header-y += aio_abi.h
37header-y += apm_bios.h
38header-y += arcfb.h
39header-y += atalk.h
40header-y += atm.h
41header-y += atm_eni.h
42header-y += atm_he.h
43header-y += atm_idt77105.h
44header-y += atm_nicstar.h
45header-y += atm_tcp.h
46header-y += atm_zatm.h
47header-y += atmapi.h
48header-y += atmarp.h
49header-y += atmbr2684.h
50header-y += atmclip.h
51header-y += atmdev.h
52header-y += atmioc.h
53header-y += atmlec.h
54header-y += atmmpc.h
55header-y += atmppp.h
56header-y += atmsap.h
57header-y += atmsvc.h
58header-y += audit.h
59header-y += auto_fs.h
60header-y += auto_fs4.h
61header-y += auxvec.h
62header-y += ax25.h
63header-y += b1lli.h
64header-y += baycom.h
65header-y += bfs_fs.h
66header-y += binfmts.h
67header-y += blkpg.h
68header-y += blktrace_api.h
69header-y += bpqether.h
70header-y += bsg.h
71header-y += can.h
72header-y += capability.h
73header-y += capi.h
74header-y += cciss_defs.h
75header-y += cciss_ioctl.h
76header-y += cdrom.h
77header-y += cgroupstats.h
78header-y += chio.h
79header-y += cm4000_cs.h
80header-y += cn_proc.h
81header-y += coda.h
82header-y += coda_psdev.h
83header-y += coff.h
84header-y += connector.h
85header-y += const.h
86header-y += cramfs_fs.h
87header-y += cuda.h
88header-y += cyclades.h
89header-y += cycx_cfm.h
90header-y += dcbnl.h
91header-y += dccp.h
92header-y += dlm.h
93header-y += dlm_device.h
94header-y += dlm_netlink.h
95header-y += dlm_plock.h
96header-y += dlmconstants.h
97header-y += dm-ioctl.h
98header-y += dm-log-userspace.h
99header-y += dn.h
100header-y += dqblk_xfs.h
101header-y += edd.h
102header-y += efs_fs_sb.h
103header-y += elf-em.h
104header-y += elf-fdpic.h
105header-y += elf.h
106header-y += elfcore.h
107header-y += errno.h
108header-y += errqueue.h
109header-y += ethtool.h
110header-y += eventpoll.h
111header-y += fadvise.h
112header-y += falloc.h
113header-y += fanotify.h
114header-y += fb.h
115header-y += fcntl.h
116header-y += fd.h
117header-y += fdreg.h
118header-y += fib_rules.h
119header-y += fiemap.h
120header-y += filter.h
121header-y += firewire-cdev.h
122header-y += firewire-constants.h
123header-y += flat.h
124header-y += fs.h
125header-y += fsl_hypervisor.h
126header-y += fuse.h
127header-y += futex.h
128header-y += gameport.h
129header-y += gen_stats.h
130header-y += genetlink.h
131header-y += gfs2_ondisk.h
132header-y += gigaset_dev.h
133header-y += hdlc.h
134header-y += hdlcdrv.h
135header-y += hdreg.h
136header-y += hid.h
137header-y += hiddev.h
138header-y += hidraw.h
139header-y += hpet.h
140header-y += hysdn_if.h
141header-y += i2c-dev.h
142header-y += i2c.h
143header-y += i2o-dev.h
144header-y += i8k.h
145header-y += icmp.h
146header-y += icmpv6.h
147header-y += if.h
148header-y += if_addr.h
149header-y += if_addrlabel.h
150header-y += if_alg.h
151header-y += if_arcnet.h
152header-y += if_arp.h
153header-y += if_bonding.h
154header-y += if_bridge.h
155header-y += if_cablemodem.h
156header-y += if_eql.h
157header-y += if_ether.h
158header-y += if_fc.h
159header-y += if_fddi.h
160header-y += if_frad.h
161header-y += if_hippi.h
162header-y += if_infiniband.h
163header-y += if_link.h
164header-y += if_ltalk.h
165header-y += if_packet.h
166header-y += if_phonet.h
167header-y += if_plip.h
168header-y += if_ppp.h
169header-y += if_pppol2tp.h
170header-y += if_pppox.h
171header-y += if_slip.h
172header-y += if_team.h
173header-y += if_tun.h
174header-y += if_tunnel.h
175header-y += if_vlan.h
176header-y += if_x25.h
177header-y += igmp.h
178header-y += in.h
179header-y += in6.h
180header-y += in_route.h
181header-y += inet_diag.h
182header-y += inotify.h
183header-y += input.h
184header-y += ioctl.h
185header-y += ip.h
186header-y += ip6_tunnel.h
187header-y += ip_vs.h
188header-y += ipc.h
189header-y += ipmi.h
190header-y += ipmi_msgdefs.h
191header-y += ipsec.h
192header-y += ipv6.h
193header-y += ipv6_route.h
194header-y += ipx.h
195header-y += irda.h
196header-y += irqnr.h
197header-y += isdn.h
198header-y += isdn_divertif.h
199header-y += isdn_ppp.h
200header-y += isdnif.h
201header-y += iso_fs.h
202header-y += ivtv.h
203header-y += ivtvfb.h
204header-y += ixjuser.h
205header-y += jffs2.h
206header-y += joystick.h
207header-y += kd.h
208header-y += kdev_t.h
209header-y += kernel-page-flags.h
210header-y += kernel.h
211header-y += kernelcapi.h
212header-y += kexec.h
213header-y += keyboard.h
214header-y += keyctl.h
215
216ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm.h \
217 $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h),)
218header-y += kvm.h
219endif
220
221
222ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm_para.h \
223 $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h),)
224header-y += kvm_para.h
225endif
226
227header-y += l2tp.h
228header-y += limits.h
229header-y += llc.h
230header-y += loop.h
231header-y += lp.h
232header-y += magic.h
233header-y += major.h
234header-y += map_to_7segment.h
235header-y += matroxfb.h
236header-y += mdio.h
237header-y += media.h
238header-y += mei.h
239header-y += mempolicy.h
240header-y += meye.h
241header-y += mii.h
242header-y += minix_fs.h
243header-y += mman.h
244header-y += mmtimer.h
245header-y += mqueue.h
246header-y += mroute.h
247header-y += mroute6.h
248header-y += msdos_fs.h
249header-y += msg.h
250header-y += mtio.h
251header-y += n_r3964.h
252header-y += nbd.h
253header-y += ncp.h
254header-y += ncp_fs.h
255header-y += ncp_mount.h
256header-y += ncp_no.h
257header-y += neighbour.h
258header-y += net.h
259header-y += net_dropmon.h
260header-y += net_tstamp.h
261header-y += netdevice.h
262header-y += netfilter.h
263header-y += netfilter_arp.h
264header-y += netfilter_bridge.h
265header-y += netfilter_decnet.h
266header-y += netfilter_ipv4.h
267header-y += netfilter_ipv6.h
268header-y += netlink.h
269header-y += netrom.h
270header-y += nfc.h
271header-y += nfs.h
272header-y += nfs2.h
273header-y += nfs3.h
274header-y += nfs4.h
275header-y += nfs4_mount.h
276header-y += nfs_fs.h
277header-y += nfs_idmap.h
278header-y += nfs_mount.h
279header-y += nfsacl.h
280header-y += nl80211.h
281header-y += nubus.h
282header-y += nvram.h
283header-y += omap3isp.h
284header-y += omapfb.h
285header-y += oom.h
286header-y += packet_diag.h
287header-y += param.h
288header-y += parport.h
289header-y += patchkey.h
290header-y += pci.h
291header-y += pci_regs.h
292header-y += perf_event.h
293header-y += personality.h
294header-y += pfkeyv2.h
295header-y += pg.h
296header-y += phantom.h
297header-y += phonet.h
298header-y += pkt_cls.h
299header-y += pkt_sched.h
300header-y += pktcdvd.h
301header-y += pmu.h
302header-y += poll.h
303header-y += posix_types.h
304header-y += ppdev.h
305header-y += ppp-comp.h
306header-y += ppp-ioctl.h
307header-y += ppp_defs.h
308header-y += pps.h
309header-y += prctl.h
310header-y += ptp_clock.h
311header-y += ptrace.h
312header-y += qnx4_fs.h
313header-y += qnxtypes.h
314header-y += quota.h
315header-y += radeonfb.h
316header-y += random.h
317header-y += raw.h
318header-y += rds.h
319header-y += reboot.h
320header-y += reiserfs_fs.h
321header-y += reiserfs_xattr.h
322header-y += resource.h
323header-y += rfkill.h
324header-y += romfs_fs.h
325header-y += rose.h
326header-y += route.h
327header-y += rtc.h
328header-y += rtnetlink.h
329header-y += scc.h
330header-y += sched.h
331header-y += screen_info.h
332header-y += sdla.h
333header-y += seccomp.h
334header-y += securebits.h
335header-y += selinux_netlink.h
336header-y += sem.h
337header-y += serial.h
338header-y += serial_core.h
339header-y += serial_reg.h
340header-y += serio.h
341header-y += shm.h
342header-y += signal.h
343header-y += signalfd.h
344header-y += snmp.h
345header-y += sock_diag.h
346header-y += socket.h
347header-y += sockios.h
348header-y += som.h
349header-y += sonet.h
350header-y += sonypi.h
351header-y += sound.h
352header-y += soundcard.h
353header-y += stat.h
354header-y += stddef.h
355header-y += string.h
356header-y += suspend_ioctls.h
357header-y += swab.h
358header-y += synclink.h
359header-y += sysctl.h
360header-y += sysinfo.h
361header-y += taskstats.h
362header-y += tcp.h
363header-y += tcp_metrics.h
364header-y += telephony.h
365header-y += termios.h
366header-y += time.h
367header-y += times.h
368header-y += timex.h
369header-y += tiocl.h
370header-y += tipc.h
371header-y += tipc_config.h
372header-y += toshiba.h
373header-y += tty.h
374header-y += tty_flags.h
375header-y += types.h
376header-y += udf_fs_i.h
377header-y += udp.h
378header-y += uhid.h
379header-y += uinput.h
380header-y += uio.h
381header-y += ultrasound.h
382header-y += un.h
383header-y += unistd.h
384header-y += unix_diag.h
385header-y += usbdevice_fs.h
386header-y += utime.h
387header-y += utsname.h
388header-y += uuid.h
389header-y += uvcvideo.h
390header-y += v4l2-common.h
391header-y += v4l2-controls.h
392header-y += v4l2-dv-timings.h
393header-y += v4l2-mediabus.h
394header-y += v4l2-subdev.h
395header-y += veth.h
396header-y += vfio.h
397header-y += vhost.h
398header-y += videodev2.h
399header-y += virtio_9p.h
400header-y += virtio_balloon.h
401header-y += virtio_blk.h
402header-y += virtio_config.h
403header-y += virtio_console.h
404header-y += virtio_ids.h
405header-y += virtio_net.h
406header-y += virtio_pci.h
407header-y += virtio_ring.h
408header-y += virtio_rng.h
409header-y += vt.h
410header-y += wait.h
411header-y += wanrouter.h
412header-y += watchdog.h
413header-y += wimax.h
414header-y += wireless.h
415header-y += x25.h
416header-y += xattr.h
417header-y += xfrm.h
diff --git a/include/uapi/linux/a.out.h b/include/uapi/linux/a.out.h
new file mode 100644
index 000000000000..7caf44c7fa51
--- /dev/null
+++ b/include/uapi/linux/a.out.h
@@ -0,0 +1,274 @@
1#ifndef _UAPI__A_OUT_GNU_H__
2#define _UAPI__A_OUT_GNU_H__
3
4#define __GNU_EXEC_MACROS__
5
6#ifndef __STRUCT_EXEC_OVERRIDE__
7
8#include <asm/a.out.h>
9
10#endif /* __STRUCT_EXEC_OVERRIDE__ */
11
12#ifndef __ASSEMBLY__
13
14/* these go in the N_MACHTYPE field */
15enum machine_type {
16#if defined (M_OLDSUN2)
17 M__OLDSUN2 = M_OLDSUN2,
18#else
19 M_OLDSUN2 = 0,
20#endif
21#if defined (M_68010)
22 M__68010 = M_68010,
23#else
24 M_68010 = 1,
25#endif
26#if defined (M_68020)
27 M__68020 = M_68020,
28#else
29 M_68020 = 2,
30#endif
31#if defined (M_SPARC)
32 M__SPARC = M_SPARC,
33#else
34 M_SPARC = 3,
35#endif
36 /* skip a bunch so we don't run into any of sun's numbers */
37 M_386 = 100,
38 M_MIPS1 = 151, /* MIPS R3000/R3000 binary */
39 M_MIPS2 = 152 /* MIPS R6000/R4000 binary */
40};
41
42#if !defined (N_MAGIC)
43#define N_MAGIC(exec) ((exec).a_info & 0xffff)
44#endif
45#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
46#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
47#define N_SET_INFO(exec, magic, type, flags) \
48 ((exec).a_info = ((magic) & 0xffff) \
49 | (((int)(type) & 0xff) << 16) \
50 | (((flags) & 0xff) << 24))
51#define N_SET_MAGIC(exec, magic) \
52 ((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
53
54#define N_SET_MACHTYPE(exec, machtype) \
55 ((exec).a_info = \
56 ((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
57
58#define N_SET_FLAGS(exec, flags) \
59 ((exec).a_info = \
60 ((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
61
62/* Code indicating object file or impure executable. */
63#define OMAGIC 0407
64/* Code indicating pure executable. */
65#define NMAGIC 0410
66/* Code indicating demand-paged executable. */
67#define ZMAGIC 0413
68/* This indicates a demand-paged executable with the header in the text.
69 The first page is unmapped to help trap NULL pointer references */
70#define QMAGIC 0314
71
72/* Code indicating core file. */
73#define CMAGIC 0421
74
75#if !defined (N_BADMAG)
76#define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
77 && N_MAGIC(x) != NMAGIC \
78 && N_MAGIC(x) != ZMAGIC \
79 && N_MAGIC(x) != QMAGIC)
80#endif
81
82#define _N_HDROFF(x) (1024 - sizeof (struct exec))
83
84#if !defined (N_TXTOFF)
85#define N_TXTOFF(x) \
86 (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \
87 (N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
88#endif
89
90#if !defined (N_DATOFF)
91#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
92#endif
93
94#if !defined (N_TRELOFF)
95#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
96#endif
97
98#if !defined (N_DRELOFF)
99#define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x))
100#endif
101
102#if !defined (N_SYMOFF)
103#define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x))
104#endif
105
106#if !defined (N_STROFF)
107#define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x))
108#endif
109
110/* Address of text segment in memory after it is loaded. */
111#if !defined (N_TXTADDR)
112#define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0)
113#endif
114
115/* Address of data segment in memory after it is loaded.
116 Note that it is up to you to define SEGMENT_SIZE
117 on machines not listed here. */
118#if defined(vax) || defined(hp300) || defined(pyr)
119#define SEGMENT_SIZE page_size
120#endif
121#ifdef sony
122#define SEGMENT_SIZE 0x2000
123#endif /* Sony. */
124#ifdef is68k
125#define SEGMENT_SIZE 0x20000
126#endif
127#if defined(m68k) && defined(PORTAR)
128#define PAGE_SIZE 0x400
129#define SEGMENT_SIZE PAGE_SIZE
130#endif
131
132#ifdef linux
133#ifndef __KERNEL__
134#include <unistd.h>
135#endif
136#if defined(__i386__) || defined(__mc68000__)
137#define SEGMENT_SIZE 1024
138#else
139#ifndef SEGMENT_SIZE
140#ifndef __KERNEL__
141#define SEGMENT_SIZE getpagesize()
142#endif
143#endif
144#endif
145#endif
146
147#define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE)
148
149#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
150
151#ifndef N_DATADDR
152#define N_DATADDR(x) \
153 (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
154 : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
155#endif
156
157/* Address of bss segment in memory after it is loaded. */
158#if !defined (N_BSSADDR)
159#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
160#endif
161
162#if !defined (N_NLIST_DECLARED)
163struct nlist {
164 union {
165 char *n_name;
166 struct nlist *n_next;
167 long n_strx;
168 } n_un;
169 unsigned char n_type;
170 char n_other;
171 short n_desc;
172 unsigned long n_value;
173};
174#endif /* no N_NLIST_DECLARED. */
175
176#if !defined (N_UNDF)
177#define N_UNDF 0
178#endif
179#if !defined (N_ABS)
180#define N_ABS 2
181#endif
182#if !defined (N_TEXT)
183#define N_TEXT 4
184#endif
185#if !defined (N_DATA)
186#define N_DATA 6
187#endif
188#if !defined (N_BSS)
189#define N_BSS 8
190#endif
191#if !defined (N_FN)
192#define N_FN 15
193#endif
194
195#if !defined (N_EXT)
196#define N_EXT 1
197#endif
198#if !defined (N_TYPE)
199#define N_TYPE 036
200#endif
201#if !defined (N_STAB)
202#define N_STAB 0340
203#endif
204
205/* The following type indicates the definition of a symbol as being
206 an indirect reference to another symbol. The other symbol
207 appears as an undefined reference, immediately following this symbol.
208
209 Indirection is asymmetrical. The other symbol's value will be used
210 to satisfy requests for the indirect symbol, but not vice versa.
211 If the other symbol does not have a definition, libraries will
212 be searched to find a definition. */
213#define N_INDR 0xa
214
215/* The following symbols refer to set elements.
216 All the N_SET[ATDB] symbols with the same name form one set.
217 Space is allocated for the set in the text section, and each set
218 element's value is stored into one word of the space.
219 The first word of the space is the length of the set (number of elements).
220
221 The address of the set is made into an N_SETV symbol
222 whose name is the same as the name of the set.
223 This symbol acts like a N_DATA global symbol
224 in that it can satisfy undefined external references. */
225
226/* These appear as input to LD, in a .o file. */
227#define N_SETA 0x14 /* Absolute set element symbol */
228#define N_SETT 0x16 /* Text set element symbol */
229#define N_SETD 0x18 /* Data set element symbol */
230#define N_SETB 0x1A /* Bss set element symbol */
231
232/* This is output from LD. */
233#define N_SETV 0x1C /* Pointer to set vector in data area. */
234
235#if !defined (N_RELOCATION_INFO_DECLARED)
236/* This structure describes a single relocation to be performed.
237 The text-relocation section of the file is a vector of these structures,
238 all of which apply to the text section.
239 Likewise, the data-relocation section applies to the data section. */
240
241struct relocation_info
242{
243 /* Address (within segment) to be relocated. */
244 int r_address;
245 /* The meaning of r_symbolnum depends on r_extern. */
246 unsigned int r_symbolnum:24;
247 /* Nonzero means value is a pc-relative offset
248 and it should be relocated for changes in its own address
249 as well as for changes in the symbol or section specified. */
250 unsigned int r_pcrel:1;
251 /* Length (as exponent of 2) of the field to be relocated.
252 Thus, a value of 2 indicates 1<<2 bytes. */
253 unsigned int r_length:2;
254 /* 1 => relocate with value of symbol.
255 r_symbolnum is the index of the symbol
256 in file's the symbol table.
257 0 => relocate with the address of a segment.
258 r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
259 (the N_EXT bit may be set also, but signifies nothing). */
260 unsigned int r_extern:1;
261 /* Four bits that aren't used, but when writing an object file
262 it is desirable to clear them. */
263#ifdef NS32K
264 unsigned r_bsr:1;
265 unsigned r_disp:1;
266 unsigned r_pad:2;
267#else
268 unsigned int r_pad:4;
269#endif
270};
271#endif /* no N_RELOCATION_INFO_DECLARED. */
272
273#endif /*__ASSEMBLY__ */
274#endif /* _UAPI__A_OUT_GNU_H__ */
diff --git a/include/uapi/linux/acct.h b/include/uapi/linux/acct.h
new file mode 100644
index 000000000000..11b6ca3e0873
--- /dev/null
+++ b/include/uapi/linux/acct.h
@@ -0,0 +1,122 @@
1/*
2 * BSD Process Accounting for Linux - Definitions
3 *
4 * Author: Marco van Wieringen (mvw@planets.elm.net)
5 *
6 * This header file contains the definitions needed to implement
7 * BSD-style process accounting. The kernel accounting code and all
8 * user-level programs that try to do something useful with the
9 * process accounting log must include this file.
10 *
11 * Copyright (C) 1995 - 1997 Marco van Wieringen - ELM Consultancy B.V.
12 *
13 */
14
15#ifndef _UAPI_LINUX_ACCT_H
16#define _UAPI_LINUX_ACCT_H
17
18#include <linux/types.h>
19
20#include <asm/param.h>
21#include <asm/byteorder.h>
22
23/*
24 * comp_t is a 16-bit "floating" point number with a 3-bit base 8
25 * exponent and a 13-bit fraction.
26 * comp2_t is 24-bit with 5-bit base 2 exponent and 20 bit fraction
27 * (leading 1 not stored).
28 * See linux/kernel/acct.c for the specific encoding systems used.
29 */
30
31typedef __u16 comp_t;
32typedef __u32 comp2_t;
33
34/*
35 * accounting file record
36 *
37 * This structure contains all of the information written out to the
38 * process accounting file whenever a process exits.
39 */
40
41#define ACCT_COMM 16
42
43struct acct
44{
45 char ac_flag; /* Flags */
46 char ac_version; /* Always set to ACCT_VERSION */
47 /* for binary compatibility back until 2.0 */
48 __u16 ac_uid16; /* LSB of Real User ID */
49 __u16 ac_gid16; /* LSB of Real Group ID */
50 __u16 ac_tty; /* Control Terminal */
51 __u32 ac_btime; /* Process Creation Time */
52 comp_t ac_utime; /* User Time */
53 comp_t ac_stime; /* System Time */
54 comp_t ac_etime; /* Elapsed Time */
55 comp_t ac_mem; /* Average Memory Usage */
56 comp_t ac_io; /* Chars Transferred */
57 comp_t ac_rw; /* Blocks Read or Written */
58 comp_t ac_minflt; /* Minor Pagefaults */
59 comp_t ac_majflt; /* Major Pagefaults */
60 comp_t ac_swaps; /* Number of Swaps */
61/* m68k had no padding here. */
62#if !defined(CONFIG_M68K) || !defined(__KERNEL__)
63 __u16 ac_ahz; /* AHZ */
64#endif
65 __u32 ac_exitcode; /* Exitcode */
66 char ac_comm[ACCT_COMM + 1]; /* Command Name */
67 __u8 ac_etime_hi; /* Elapsed Time MSB */
68 __u16 ac_etime_lo; /* Elapsed Time LSB */
69 __u32 ac_uid; /* Real User ID */
70 __u32 ac_gid; /* Real Group ID */
71};
72
73struct acct_v3
74{
75 char ac_flag; /* Flags */
76 char ac_version; /* Always set to ACCT_VERSION */
77 __u16 ac_tty; /* Control Terminal */
78 __u32 ac_exitcode; /* Exitcode */
79 __u32 ac_uid; /* Real User ID */
80 __u32 ac_gid; /* Real Group ID */
81 __u32 ac_pid; /* Process ID */
82 __u32 ac_ppid; /* Parent Process ID */
83 __u32 ac_btime; /* Process Creation Time */
84#ifdef __KERNEL__
85 __u32 ac_etime; /* Elapsed Time */
86#else
87 float ac_etime; /* Elapsed Time */
88#endif
89 comp_t ac_utime; /* User Time */
90 comp_t ac_stime; /* System Time */
91 comp_t ac_mem; /* Average Memory Usage */
92 comp_t ac_io; /* Chars Transferred */
93 comp_t ac_rw; /* Blocks Read or Written */
94 comp_t ac_minflt; /* Minor Pagefaults */
95 comp_t ac_majflt; /* Major Pagefaults */
96 comp_t ac_swaps; /* Number of Swaps */
97 char ac_comm[ACCT_COMM]; /* Command Name */
98};
99
100/*
101 * accounting flags
102 */
103 /* bit set when the process ... */
104#define AFORK 0x01 /* ... executed fork, but did not exec */
105#define ASU 0x02 /* ... used super-user privileges */
106#define ACOMPAT 0x04 /* ... used compatibility mode (VAX only not used) */
107#define ACORE 0x08 /* ... dumped core */
108#define AXSIG 0x10 /* ... was killed by a signal */
109
110#ifdef __BIG_ENDIAN
111#define ACCT_BYTEORDER 0x80 /* accounting file is big endian */
112#else
113#define ACCT_BYTEORDER 0x00 /* accounting file is little endian */
114#endif
115
116#ifndef __KERNEL__
117#define ACCT_VERSION 2
118#define AHZ (HZ)
119#endif /* __KERNEL */
120
121
122#endif /* _UAPI_LINUX_ACCT_H */
diff --git a/include/uapi/linux/adb.h b/include/uapi/linux/adb.h
new file mode 100644
index 000000000000..0ea1075fc4a0
--- /dev/null
+++ b/include/uapi/linux/adb.h
@@ -0,0 +1,44 @@
1/*
2 * Definitions for ADB (Apple Desktop Bus) support.
3 */
4#ifndef _UAPI__ADB_H
5#define _UAPI__ADB_H
6
7/* ADB commands */
8#define ADB_BUSRESET 0
9#define ADB_FLUSH(id) (0x01 | ((id) << 4))
10#define ADB_WRITEREG(id, reg) (0x08 | (reg) | ((id) << 4))
11#define ADB_READREG(id, reg) (0x0C | (reg) | ((id) << 4))
12
13/* ADB default device IDs (upper 4 bits of ADB command byte) */
14#define ADB_DONGLE 1 /* "software execution control" devices */
15#define ADB_KEYBOARD 2
16#define ADB_MOUSE 3
17#define ADB_TABLET 4
18#define ADB_MODEM 5
19#define ADB_MISC 7 /* maybe a monitor */
20
21#define ADB_RET_OK 0
22#define ADB_RET_TIMEOUT 3
23
24/* The kind of ADB request. The controller may emulate some
25 or all of those CUDA/PMU packet kinds */
26#define ADB_PACKET 0
27#define CUDA_PACKET 1
28#define ERROR_PACKET 2
29#define TIMER_PACKET 3
30#define POWER_PACKET 4
31#define MACIIC_PACKET 5
32#define PMU_PACKET 6
33#define ADB_QUERY 7
34
35/* ADB queries */
36
37/* ADB_QUERY_GETDEVINFO
38 * Query ADB slot for device presence
39 * data[2] = id, rep[0] = orig addr, rep[1] = handler_id
40 */
41#define ADB_QUERY_GETDEVINFO 1
42
43
44#endif /* _UAPI__ADB_H */
diff --git a/include/uapi/linux/adfs_fs.h b/include/uapi/linux/adfs_fs.h
new file mode 100644
index 000000000000..a1bf43754ddd
--- /dev/null
+++ b/include/uapi/linux/adfs_fs.h
@@ -0,0 +1,44 @@
1#ifndef _UAPI_ADFS_FS_H
2#define _UAPI_ADFS_FS_H
3
4#include <linux/types.h>
5#include <linux/magic.h>
6
7/*
8 * Disc Record at disc address 0xc00
9 */
10struct adfs_discrecord {
11 __u8 log2secsize;
12 __u8 secspertrack;
13 __u8 heads;
14 __u8 density;
15 __u8 idlen;
16 __u8 log2bpmb;
17 __u8 skew;
18 __u8 bootoption;
19 __u8 lowsector;
20 __u8 nzones;
21 __le16 zone_spare;
22 __le32 root;
23 __le32 disc_size;
24 __le16 disc_id;
25 __u8 disc_name[10];
26 __le32 disc_type;
27 __le32 disc_size_high;
28 __u8 log2sharesize:4;
29 __u8 unused40:4;
30 __u8 big_flag:1;
31 __u8 unused41:1;
32 __u8 nzones_high;
33 __le32 format_version;
34 __le32 root_size;
35 __u8 unused52[60 - 52];
36};
37
38#define ADFS_DISCRECORD (0xc00)
39#define ADFS_DR_OFFSET (0x1c0)
40#define ADFS_DR_SIZE 60
41#define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3)
42
43
44#endif /* _UAPI_ADFS_FS_H */
diff --git a/include/linux/affs_hardblocks.h b/include/uapi/linux/affs_hardblocks.h
index f1b948c1f592..f1b948c1f592 100644
--- a/include/linux/affs_hardblocks.h
+++ b/include/uapi/linux/affs_hardblocks.h
diff --git a/include/uapi/linux/agpgart.h b/include/uapi/linux/agpgart.h
new file mode 100644
index 000000000000..4e828cf487bc
--- /dev/null
+++ b/include/uapi/linux/agpgart.h
@@ -0,0 +1,113 @@
1/*
2 * AGPGART module version 0.99
3 * Copyright (C) 1999 Jeff Hartmann
4 * Copyright (C) 1999 Precision Insight, Inc.
5 * Copyright (C) 1999 Xi Graphics, Inc.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
23 * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 *
25 */
26
27#ifndef _UAPI_AGP_H
28#define _UAPI_AGP_H
29
30#define AGPIOC_BASE 'A'
31#define AGPIOC_INFO _IOR (AGPIOC_BASE, 0, struct agp_info*)
32#define AGPIOC_ACQUIRE _IO (AGPIOC_BASE, 1)
33#define AGPIOC_RELEASE _IO (AGPIOC_BASE, 2)
34#define AGPIOC_SETUP _IOW (AGPIOC_BASE, 3, struct agp_setup*)
35#define AGPIOC_RESERVE _IOW (AGPIOC_BASE, 4, struct agp_region*)
36#define AGPIOC_PROTECT _IOW (AGPIOC_BASE, 5, struct agp_region*)
37#define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 6, struct agp_allocate*)
38#define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int)
39#define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, struct agp_bind*)
40#define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, struct agp_unbind*)
41#define AGPIOC_CHIPSET_FLUSH _IO (AGPIOC_BASE, 10)
42
43#define AGP_DEVICE "/dev/agpgart"
44
45#ifndef TRUE
46#define TRUE 1
47#endif
48
49#ifndef FALSE
50#define FALSE 0
51#endif
52
53#ifndef __KERNEL__
54#include <linux/types.h>
55
56struct agp_version {
57 __u16 major;
58 __u16 minor;
59};
60
61typedef struct _agp_info {
62 struct agp_version version; /* version of the driver */
63 __u32 bridge_id; /* bridge vendor/device */
64 __u32 agp_mode; /* mode info of bridge */
65 unsigned long aper_base;/* base of aperture */
66 size_t aper_size; /* size of aperture */
67 size_t pg_total; /* max pages (swap + system) */
68 size_t pg_system; /* max pages (system) */
69 size_t pg_used; /* current pages used */
70} agp_info;
71
72typedef struct _agp_setup {
73 __u32 agp_mode; /* mode info of bridge */
74} agp_setup;
75
76/*
77 * The "prot" down below needs still a "sleep" flag somehow ...
78 */
79typedef struct _agp_segment {
80 __kernel_off_t pg_start; /* starting page to populate */
81 __kernel_size_t pg_count; /* number of pages */
82 int prot; /* prot flags for mmap */
83} agp_segment;
84
85typedef struct _agp_region {
86 __kernel_pid_t pid; /* pid of process */
87 __kernel_size_t seg_count; /* number of segments */
88 struct _agp_segment *seg_list;
89} agp_region;
90
91typedef struct _agp_allocate {
92 int key; /* tag of allocation */
93 __kernel_size_t pg_count;/* number of pages */
94 __u32 type; /* 0 == normal, other devspec */
95 __u32 physical; /* device specific (some devices
96 * need a phys address of the
97 * actual page behind the gatt
98 * table) */
99} agp_allocate;
100
101typedef struct _agp_bind {
102 int key; /* tag of allocation */
103 __kernel_off_t pg_start;/* starting page to populate */
104} agp_bind;
105
106typedef struct _agp_unbind {
107 int key; /* tag of allocation */
108 __u32 priority; /* priority for paging out */
109} agp_unbind;
110
111#endif /* __KERNEL__ */
112
113#endif /* _UAPI_AGP_H */
diff --git a/include/linux/aio_abi.h b/include/uapi/linux/aio_abi.h
index 86fa7a71336a..86fa7a71336a 100644
--- a/include/linux/aio_abi.h
+++ b/include/uapi/linux/aio_abi.h
diff --git a/include/uapi/linux/apm_bios.h b/include/uapi/linux/apm_bios.h
new file mode 100644
index 000000000000..724f409adae0
--- /dev/null
+++ b/include/uapi/linux/apm_bios.h
@@ -0,0 +1,135 @@
1/*
2 * Include file for the interface to an APM BIOS
3 * Copyright 1994-2001 Stephen Rothwell (sfr@canb.auug.org.au)
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 as published by the
7 * Free Software Foundation; either version 2, or (at your option) any
8 * later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 */
15#ifndef _UAPI_LINUX_APM_H
16#define _UAPI_LINUX_APM_H
17
18
19#include <linux/types.h>
20
21typedef unsigned short apm_event_t;
22typedef unsigned short apm_eventinfo_t;
23
24struct apm_bios_info {
25 __u16 version;
26 __u16 cseg;
27 __u32 offset;
28 __u16 cseg_16;
29 __u16 dseg;
30 __u16 flags;
31 __u16 cseg_len;
32 __u16 cseg_16_len;
33 __u16 dseg_len;
34};
35
36
37/*
38 * Power states
39 */
40#define APM_STATE_READY 0x0000
41#define APM_STATE_STANDBY 0x0001
42#define APM_STATE_SUSPEND 0x0002
43#define APM_STATE_OFF 0x0003
44#define APM_STATE_BUSY 0x0004
45#define APM_STATE_REJECT 0x0005
46#define APM_STATE_OEM_SYS 0x0020
47#define APM_STATE_OEM_DEV 0x0040
48
49#define APM_STATE_DISABLE 0x0000
50#define APM_STATE_ENABLE 0x0001
51
52#define APM_STATE_DISENGAGE 0x0000
53#define APM_STATE_ENGAGE 0x0001
54
55/*
56 * Events (results of Get PM Event)
57 */
58#define APM_SYS_STANDBY 0x0001
59#define APM_SYS_SUSPEND 0x0002
60#define APM_NORMAL_RESUME 0x0003
61#define APM_CRITICAL_RESUME 0x0004
62#define APM_LOW_BATTERY 0x0005
63#define APM_POWER_STATUS_CHANGE 0x0006
64#define APM_UPDATE_TIME 0x0007
65#define APM_CRITICAL_SUSPEND 0x0008
66#define APM_USER_STANDBY 0x0009
67#define APM_USER_SUSPEND 0x000a
68#define APM_STANDBY_RESUME 0x000b
69#define APM_CAPABILITY_CHANGE 0x000c
70
71/*
72 * Error codes
73 */
74#define APM_SUCCESS 0x00
75#define APM_DISABLED 0x01
76#define APM_CONNECTED 0x02
77#define APM_NOT_CONNECTED 0x03
78#define APM_16_CONNECTED 0x05
79#define APM_16_UNSUPPORTED 0x06
80#define APM_32_CONNECTED 0x07
81#define APM_32_UNSUPPORTED 0x08
82#define APM_BAD_DEVICE 0x09
83#define APM_BAD_PARAM 0x0a
84#define APM_NOT_ENGAGED 0x0b
85#define APM_BAD_FUNCTION 0x0c
86#define APM_RESUME_DISABLED 0x0d
87#define APM_NO_ERROR 0x53
88#define APM_BAD_STATE 0x60
89#define APM_NO_EVENTS 0x80
90#define APM_NOT_PRESENT 0x86
91
92/*
93 * APM Device IDs
94 */
95#define APM_DEVICE_BIOS 0x0000
96#define APM_DEVICE_ALL 0x0001
97#define APM_DEVICE_DISPLAY 0x0100
98#define APM_DEVICE_STORAGE 0x0200
99#define APM_DEVICE_PARALLEL 0x0300
100#define APM_DEVICE_SERIAL 0x0400
101#define APM_DEVICE_NETWORK 0x0500
102#define APM_DEVICE_PCMCIA 0x0600
103#define APM_DEVICE_BATTERY 0x8000
104#define APM_DEVICE_OEM 0xe000
105#define APM_DEVICE_OLD_ALL 0xffff
106#define APM_DEVICE_CLASS 0x00ff
107#define APM_DEVICE_MASK 0xff00
108
109
110/*
111 * Battery status
112 */
113#define APM_MAX_BATTERIES 2
114
115/*
116 * APM defined capability bit flags
117 */
118#define APM_CAP_GLOBAL_STANDBY 0x0001
119#define APM_CAP_GLOBAL_SUSPEND 0x0002
120#define APM_CAP_RESUME_STANDBY_TIMER 0x0004 /* Timer resume from standby */
121#define APM_CAP_RESUME_SUSPEND_TIMER 0x0008 /* Timer resume from suspend */
122#define APM_CAP_RESUME_STANDBY_RING 0x0010 /* Resume on Ring fr standby */
123#define APM_CAP_RESUME_SUSPEND_RING 0x0020 /* Resume on Ring fr suspend */
124#define APM_CAP_RESUME_STANDBY_PCMCIA 0x0040 /* Resume on PCMCIA Ring */
125#define APM_CAP_RESUME_SUSPEND_PCMCIA 0x0080 /* Resume on PCMCIA Ring */
126
127/*
128 * ioctl operations
129 */
130#include <linux/ioctl.h>
131
132#define APM_IOC_STANDBY _IO('A', 1)
133#define APM_IOC_SUSPEND _IO('A', 2)
134
135#endif /* _UAPI_LINUX_APM_H */
diff --git a/include/linux/arcfb.h b/include/uapi/linux/arcfb.h
index 721e7654daeb..721e7654daeb 100644
--- a/include/linux/arcfb.h
+++ b/include/uapi/linux/arcfb.h
diff --git a/include/uapi/linux/atalk.h b/include/uapi/linux/atalk.h
new file mode 100644
index 000000000000..4bcd596e6388
--- /dev/null
+++ b/include/uapi/linux/atalk.h
@@ -0,0 +1,44 @@
1#ifndef _UAPI__LINUX_ATALK_H__
2#define _UAPI__LINUX_ATALK_H__
3
4#include <linux/types.h>
5#include <asm/byteorder.h>
6#include <linux/socket.h>
7
8/*
9 * AppleTalk networking structures
10 *
11 * The following are directly referenced from the University Of Michigan
12 * netatalk for compatibility reasons.
13 */
14#define ATPORT_FIRST 1
15#define ATPORT_RESERVED 128
16#define ATPORT_LAST 254 /* 254 is only legal on localtalk */
17#define ATADDR_ANYNET (__u16)0
18#define ATADDR_ANYNODE (__u8)0
19#define ATADDR_ANYPORT (__u8)0
20#define ATADDR_BCAST (__u8)255
21#define DDP_MAXSZ 587
22#define DDP_MAXHOPS 15 /* 4 bits of hop counter */
23
24#define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0)
25
26struct atalk_addr {
27 __be16 s_net;
28 __u8 s_node;
29};
30
31struct sockaddr_at {
32 __kernel_sa_family_t sat_family;
33 __u8 sat_port;
34 struct atalk_addr sat_addr;
35 char sat_zero[8];
36};
37
38struct atalk_netrange {
39 __u8 nr_phase;
40 __be16 nr_firstnet;
41 __be16 nr_lastnet;
42};
43
44#endif /* _UAPI__LINUX_ATALK_H__ */
diff --git a/include/uapi/linux/atm.h b/include/uapi/linux/atm.h
new file mode 100644
index 000000000000..88399db602ac
--- /dev/null
+++ b/include/uapi/linux/atm.h
@@ -0,0 +1,241 @@
1/* atm.h - general ATM declarations */
2
3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
4
5
6/*
7 * WARNING: User-space programs should not #include <linux/atm.h> directly.
8 * Instead, #include <atm.h>
9 */
10
11#ifndef _UAPI_LINUX_ATM_H
12#define _UAPI_LINUX_ATM_H
13
14/*
15 * BEGIN_xx and END_xx markers are used for automatic generation of
16 * documentation. Do not change them.
17 */
18
19#include <linux/compiler.h>
20#include <linux/atmapi.h>
21#include <linux/atmsap.h>
22#include <linux/atmioc.h>
23#include <linux/types.h>
24
25
26/* general ATM constants */
27#define ATM_CELL_SIZE 53 /* ATM cell size incl. header */
28#define ATM_CELL_PAYLOAD 48 /* ATM payload size */
29#define ATM_AAL0_SDU 52 /* AAL0 SDU size */
30#define ATM_MAX_AAL34_PDU 65535 /* maximum AAL3/4 PDU payload */
31#define ATM_AAL5_TRAILER 8 /* AAL5 trailer size */
32#define ATM_MAX_AAL5_PDU 65535 /* maximum AAL5 PDU payload */
33#define ATM_MAX_CDV 9999 /* maximum (default) CDV */
34#define ATM_NOT_RSV_VCI 32 /* first non-reserved VCI value */
35
36#define ATM_MAX_VPI 255 /* maximum VPI at the UNI */
37#define ATM_MAX_VPI_NNI 4096 /* maximum VPI at the NNI */
38#define ATM_MAX_VCI 65535 /* maximum VCI */
39
40
41/* "protcol" values for the socket system call */
42#define ATM_NO_AAL 0 /* AAL not specified */
43#define ATM_AAL0 13 /* "raw" ATM cells */
44#define ATM_AAL1 1 /* AAL1 (CBR) */
45#define ATM_AAL2 2 /* AAL2 (VBR) */
46#define ATM_AAL34 3 /* AAL3/4 (data) */
47#define ATM_AAL5 5 /* AAL5 (data) */
48
49/*
50 * socket option name coding functions
51 *
52 * Note that __SO_ENCODE and __SO_LEVEL are somewhat a hack since the
53 * << 22 only reserves 9 bits for the level. On some architectures
54 * SOL_SOCKET is 0xFFFF, so that's a bit of a problem
55 */
56
57#define __SO_ENCODE(l,n,t) ((((l) & 0x1FF) << 22) | ((n) << 16) | \
58 sizeof(t))
59#define __SO_LEVEL_MATCH(c,m) (((c) >> 22) == ((m) & 0x1FF))
60#define __SO_NUMBER(c) (((c) >> 16) & 0x3f)
61#define __SO_SIZE(c) ((c) & 0x3fff)
62
63/*
64 * ATM layer
65 */
66
67#define SO_SETCLP __SO_ENCODE(SOL_ATM,0,int)
68 /* set CLP bit value - TODO */
69#define SO_CIRANGE __SO_ENCODE(SOL_ATM,1,struct atm_cirange)
70 /* connection identifier range; socket must be
71 bound or connected */
72#define SO_ATMQOS __SO_ENCODE(SOL_ATM,2,struct atm_qos)
73 /* Quality of Service setting */
74#define SO_ATMSAP __SO_ENCODE(SOL_ATM,3,struct atm_sap)
75 /* Service Access Point */
76#define SO_ATMPVC __SO_ENCODE(SOL_ATM,4,struct sockaddr_atmpvc)
77 /* "PVC" address (also for SVCs); get only */
78#define SO_MULTIPOINT __SO_ENCODE(SOL_ATM, 5, int)
79 /* make this vc a p2mp */
80
81
82/*
83 * Note @@@: since the socket layers don't really distinguish the control and
84 * the data plane but generally seems to be data plane-centric, any layer is
85 * about equally wrong for the SAP. If you have a better idea about this,
86 * please speak up ...
87 */
88
89
90/* ATM cell header (for AAL0) */
91
92/* BEGIN_CH */
93#define ATM_HDR_GFC_MASK 0xf0000000
94#define ATM_HDR_GFC_SHIFT 28
95#define ATM_HDR_VPI_MASK 0x0ff00000
96#define ATM_HDR_VPI_SHIFT 20
97#define ATM_HDR_VCI_MASK 0x000ffff0
98#define ATM_HDR_VCI_SHIFT 4
99#define ATM_HDR_PTI_MASK 0x0000000e
100#define ATM_HDR_PTI_SHIFT 1
101#define ATM_HDR_CLP 0x00000001
102/* END_CH */
103
104
105/* PTI codings */
106
107/* BEGIN_PTI */
108#define ATM_PTI_US0 0 /* user data cell, congestion not exp, SDU-type 0 */
109#define ATM_PTI_US1 1 /* user data cell, congestion not exp, SDU-type 1 */
110#define ATM_PTI_UCES0 2 /* user data cell, cong. experienced, SDU-type 0 */
111#define ATM_PTI_UCES1 3 /* user data cell, cong. experienced, SDU-type 1 */
112#define ATM_PTI_SEGF5 4 /* segment OAM F5 flow related cell */
113#define ATM_PTI_E2EF5 5 /* end-to-end OAM F5 flow related cell */
114#define ATM_PTI_RSV_RM 6 /* reserved for traffic control/resource mgmt */
115#define ATM_PTI_RSV 7 /* reserved */
116/* END_PTI */
117
118
119/*
120 * The following items should stay in linux/atm.h, which should be linked to
121 * netatm/atm.h
122 */
123
124/* Traffic description */
125
126#define ATM_NONE 0 /* no traffic */
127#define ATM_UBR 1
128#define ATM_CBR 2
129#define ATM_VBR 3
130#define ATM_ABR 4
131#define ATM_ANYCLASS 5 /* compatible with everything */
132
133#define ATM_MAX_PCR -1 /* maximum available PCR */
134
135struct atm_trafprm {
136 unsigned char traffic_class; /* traffic class (ATM_UBR, ...) */
137 int max_pcr; /* maximum PCR in cells per second */
138 int pcr; /* desired PCR in cells per second */
139 int min_pcr; /* minimum PCR in cells per second */
140 int max_cdv; /* maximum CDV in microseconds */
141 int max_sdu; /* maximum SDU in bytes */
142 /* extra params for ABR */
143 unsigned int icr; /* Initial Cell Rate (24-bit) */
144 unsigned int tbe; /* Transient Buffer Exposure (24-bit) */
145 unsigned int frtt : 24; /* Fixed Round Trip Time (24-bit) */
146 unsigned int rif : 4; /* Rate Increment Factor (4-bit) */
147 unsigned int rdf : 4; /* Rate Decrease Factor (4-bit) */
148 unsigned int nrm_pres :1; /* nrm present bit */
149 unsigned int trm_pres :1; /* rm present bit */
150 unsigned int adtf_pres :1; /* adtf present bit */
151 unsigned int cdf_pres :1; /* cdf present bit*/
152 unsigned int nrm :3; /* Max # of Cells for each forward RM cell (3-bit) */
153 unsigned int trm :3; /* Time between forward RM cells (3-bit) */
154 unsigned int adtf :10; /* ACR Decrease Time Factor (10-bit) */
155 unsigned int cdf :3; /* Cutoff Decrease Factor (3-bit) */
156 unsigned int spare :9; /* spare bits */
157};
158
159struct atm_qos {
160 struct atm_trafprm txtp; /* parameters in TX direction */
161 struct atm_trafprm rxtp __ATM_API_ALIGN;
162 /* parameters in RX direction */
163 unsigned char aal __ATM_API_ALIGN;
164};
165
166/* PVC addressing */
167
168#define ATM_ITF_ANY -1 /* "magic" PVC address values */
169#define ATM_VPI_ANY -1
170#define ATM_VCI_ANY -1
171#define ATM_VPI_UNSPEC -2
172#define ATM_VCI_UNSPEC -2
173
174
175struct sockaddr_atmpvc {
176 unsigned short sap_family; /* address family, AF_ATMPVC */
177 struct { /* PVC address */
178 short itf; /* ATM interface */
179 short vpi; /* VPI (only 8 bits at UNI) */
180 int vci; /* VCI (only 16 bits at UNI) */
181 } sap_addr __ATM_API_ALIGN; /* PVC address */
182};
183
184/* SVC addressing */
185
186#define ATM_ESA_LEN 20 /* ATM End System Address length */
187#define ATM_E164_LEN 12 /* maximum E.164 number length */
188
189#define ATM_AFI_DCC 0x39 /* DCC ATM Format */
190#define ATM_AFI_ICD 0x47 /* ICD ATM Format */
191#define ATM_AFI_E164 0x45 /* E.164 ATM Format */
192#define ATM_AFI_LOCAL 0x49 /* Local ATM Format */
193
194#define ATM_AFI_DCC_GROUP 0xBD /* DCC ATM Group Format */
195#define ATM_AFI_ICD_GROUP 0xC5 /* ICD ATM Group Format */
196#define ATM_AFI_E164_GROUP 0xC3 /* E.164 ATM Group Format */
197#define ATM_AFI_LOCAL_GROUP 0xC7 /* Local ATM Group Format */
198
199#define ATM_LIJ_NONE 0 /* no leaf-initiated join */
200#define ATM_LIJ 1 /* request joining */
201#define ATM_LIJ_RPJ 2 /* set to root-prompted join */
202#define ATM_LIJ_NJ 3 /* set to network join */
203
204
205struct sockaddr_atmsvc {
206 unsigned short sas_family; /* address family, AF_ATMSVC */
207 struct { /* SVC address */
208 unsigned char prv[ATM_ESA_LEN];/* private ATM address */
209 char pub[ATM_E164_LEN+1]; /* public address (E.164) */
210 /* unused addresses must be bzero'ed */
211 char lij_type; /* role in LIJ call; one of ATM_LIJ* */
212 __u32 lij_id; /* LIJ call identifier */
213 } sas_addr __ATM_API_ALIGN; /* SVC address */
214};
215
216
217static __inline__ int atmsvc_addr_in_use(struct sockaddr_atmsvc addr)
218{
219 return *addr.sas_addr.prv || *addr.sas_addr.pub;
220}
221
222
223static __inline__ int atmpvc_addr_in_use(struct sockaddr_atmpvc addr)
224{
225 return addr.sap_addr.itf || addr.sap_addr.vpi || addr.sap_addr.vci;
226}
227
228
229/*
230 * Some stuff for linux/sockios.h
231 */
232
233struct atmif_sioc {
234 int number;
235 int length;
236 void __user *arg;
237};
238
239
240typedef unsigned short atm_backend_t;
241#endif /* _UAPI_LINUX_ATM_H */
diff --git a/include/linux/atm_eni.h b/include/uapi/linux/atm_eni.h
index 34f317972551..34f317972551 100644
--- a/include/linux/atm_eni.h
+++ b/include/uapi/linux/atm_eni.h
diff --git a/include/linux/atm_he.h b/include/uapi/linux/atm_he.h
index 2a7713b597cf..2a7713b597cf 100644
--- a/include/linux/atm_he.h
+++ b/include/uapi/linux/atm_he.h
diff --git a/include/linux/atm_idt77105.h b/include/uapi/linux/atm_idt77105.h
index 8b724000aa50..8b724000aa50 100644
--- a/include/linux/atm_idt77105.h
+++ b/include/uapi/linux/atm_idt77105.h
diff --git a/include/linux/atm_nicstar.h b/include/uapi/linux/atm_nicstar.h
index 577b79f33e8d..577b79f33e8d 100644
--- a/include/linux/atm_nicstar.h
+++ b/include/uapi/linux/atm_nicstar.h
diff --git a/include/uapi/linux/atm_tcp.h b/include/uapi/linux/atm_tcp.h
new file mode 100644
index 000000000000..914e821da64d
--- /dev/null
+++ b/include/uapi/linux/atm_tcp.h
@@ -0,0 +1,61 @@
1/* atm_tcp.h - Driver-specific declarations of the ATMTCP driver (for use by
2 driver-specific utilities) */
3
4/* Written 1997-2000 by Werner Almesberger, EPFL LRC/ICA */
5
6
7#ifndef _UAPILINUX_ATM_TCP_H
8#define _UAPILINUX_ATM_TCP_H
9
10#include <linux/atmapi.h>
11#include <linux/atm.h>
12#include <linux/atmioc.h>
13#include <linux/types.h>
14
15
16/*
17 * All values in struct atmtcp_hdr are in network byte order
18 */
19
20struct atmtcp_hdr {
21 __u16 vpi;
22 __u16 vci;
23 __u32 length; /* ... of data part */
24};
25
26/*
27 * All values in struct atmtcp_command are in host byte order
28 */
29
30#define ATMTCP_HDR_MAGIC (~0) /* this length indicates a command */
31#define ATMTCP_CTRL_OPEN 1 /* request/reply */
32#define ATMTCP_CTRL_CLOSE 2 /* request/reply */
33
34struct atmtcp_control {
35 struct atmtcp_hdr hdr; /* must be first */
36 int type; /* message type; both directions */
37 atm_kptr_t vcc; /* both directions */
38 struct sockaddr_atmpvc addr; /* suggested value from kernel */
39 struct atm_qos qos; /* both directions */
40 int result; /* to kernel only */
41} __ATM_API_ALIGN;
42
43/*
44 * Field usage:
45 * Messge type dir. hdr.v?i type addr qos vcc result
46 * ----------- ---- ------- ---- ---- --- --- ------
47 * OPEN K->D Y Y Y Y Y 0
48 * OPEN D->K - Y Y Y Y Y
49 * CLOSE K->D - - Y - Y 0
50 * CLOSE D->K - - - - Y Y
51 */
52
53#define SIOCSIFATMTCP _IO('a',ATMIOC_ITF) /* set ATMTCP mode */
54#define ATMTCP_CREATE _IO('a',ATMIOC_ITF+14) /* create persistent ATMTCP
55 interface */
56#define ATMTCP_REMOVE _IO('a',ATMIOC_ITF+15) /* destroy persistent ATMTCP
57 interface */
58
59
60
61#endif /* _UAPILINUX_ATM_TCP_H */
diff --git a/include/linux/atm_zatm.h b/include/uapi/linux/atm_zatm.h
index 10f0fa29454f..10f0fa29454f 100644
--- a/include/linux/atm_zatm.h
+++ b/include/uapi/linux/atm_zatm.h
diff --git a/include/linux/atmapi.h b/include/uapi/linux/atmapi.h
index 8fe54d90d95b..8fe54d90d95b 100644
--- a/include/linux/atmapi.h
+++ b/include/uapi/linux/atmapi.h
diff --git a/include/linux/atmarp.h b/include/uapi/linux/atmarp.h
index 231f4bdec730..231f4bdec730 100644
--- a/include/linux/atmarp.h
+++ b/include/uapi/linux/atmarp.h
diff --git a/include/linux/atmbr2684.h b/include/uapi/linux/atmbr2684.h
index fdb2629b6189..fdb2629b6189 100644
--- a/include/linux/atmbr2684.h
+++ b/include/uapi/linux/atmbr2684.h
diff --git a/include/linux/atmclip.h b/include/uapi/linux/atmclip.h
index 02c94c448dd6..02c94c448dd6 100644
--- a/include/linux/atmclip.h
+++ b/include/uapi/linux/atmclip.h
diff --git a/include/uapi/linux/atmdev.h b/include/uapi/linux/atmdev.h
new file mode 100644
index 000000000000..93e0ec008ca8
--- /dev/null
+++ b/include/uapi/linux/atmdev.h
@@ -0,0 +1,215 @@
1/* atmdev.h - ATM device driver declarations and various related items */
2
3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
4
5
6#ifndef _UAPILINUX_ATMDEV_H
7#define _UAPILINUX_ATMDEV_H
8
9
10#include <linux/atmapi.h>
11#include <linux/atm.h>
12#include <linux/atmioc.h>
13
14
15#define ESI_LEN 6
16
17#define ATM_OC3_PCR (155520000/270*260/8/53)
18 /* OC3 link rate: 155520000 bps
19 SONET overhead: /270*260 (9 section, 1 path)
20 bits per cell: /8/53
21 max cell rate: 353207.547 cells/sec */
22#define ATM_25_PCR ((25600000/8-8000)/54)
23 /* 25 Mbps ATM cell rate (59111) */
24#define ATM_OC12_PCR (622080000/1080*1040/8/53)
25 /* OC12 link rate: 622080000 bps
26 SONET overhead: /1080*1040
27 bits per cell: /8/53
28 max cell rate: 1412830.188 cells/sec */
29#define ATM_DS3_PCR (8000*12)
30 /* DS3: 12 cells in a 125 usec time slot */
31
32
33#define __AAL_STAT_ITEMS \
34 __HANDLE_ITEM(tx); /* TX okay */ \
35 __HANDLE_ITEM(tx_err); /* TX errors */ \
36 __HANDLE_ITEM(rx); /* RX okay */ \
37 __HANDLE_ITEM(rx_err); /* RX errors */ \
38 __HANDLE_ITEM(rx_drop); /* RX out of memory */
39
40struct atm_aal_stats {
41#define __HANDLE_ITEM(i) int i
42 __AAL_STAT_ITEMS
43#undef __HANDLE_ITEM
44};
45
46
47struct atm_dev_stats {
48 struct atm_aal_stats aal0;
49 struct atm_aal_stats aal34;
50 struct atm_aal_stats aal5;
51} __ATM_API_ALIGN;
52
53
54#define ATM_GETLINKRATE _IOW('a',ATMIOC_ITF+1,struct atmif_sioc)
55 /* get link rate */
56#define ATM_GETNAMES _IOW('a',ATMIOC_ITF+3,struct atm_iobuf)
57 /* get interface names (numbers) */
58#define ATM_GETTYPE _IOW('a',ATMIOC_ITF+4,struct atmif_sioc)
59 /* get interface type name */
60#define ATM_GETESI _IOW('a',ATMIOC_ITF+5,struct atmif_sioc)
61 /* get interface ESI */
62#define ATM_GETADDR _IOW('a',ATMIOC_ITF+6,struct atmif_sioc)
63 /* get itf's local ATM addr. list */
64#define ATM_RSTADDR _IOW('a',ATMIOC_ITF+7,struct atmif_sioc)
65 /* reset itf's ATM address list */
66#define ATM_ADDADDR _IOW('a',ATMIOC_ITF+8,struct atmif_sioc)
67 /* add a local ATM address */
68#define ATM_DELADDR _IOW('a',ATMIOC_ITF+9,struct atmif_sioc)
69 /* remove a local ATM address */
70#define ATM_GETCIRANGE _IOW('a',ATMIOC_ITF+10,struct atmif_sioc)
71 /* get connection identifier range */
72#define ATM_SETCIRANGE _IOW('a',ATMIOC_ITF+11,struct atmif_sioc)
73 /* set connection identifier range */
74#define ATM_SETESI _IOW('a',ATMIOC_ITF+12,struct atmif_sioc)
75 /* set interface ESI */
76#define ATM_SETESIF _IOW('a',ATMIOC_ITF+13,struct atmif_sioc)
77 /* force interface ESI */
78#define ATM_ADDLECSADDR _IOW('a', ATMIOC_ITF+14, struct atmif_sioc)
79 /* register a LECS address */
80#define ATM_DELLECSADDR _IOW('a', ATMIOC_ITF+15, struct atmif_sioc)
81 /* unregister a LECS address */
82#define ATM_GETLECSADDR _IOW('a', ATMIOC_ITF+16, struct atmif_sioc)
83 /* retrieve LECS address(es) */
84
85#define ATM_GETSTAT _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc)
86 /* get AAL layer statistics */
87#define ATM_GETSTATZ _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc)
88 /* get AAL layer statistics and zero */
89#define ATM_GETLOOP _IOW('a',ATMIOC_SARCOM+2,struct atmif_sioc)
90 /* get loopback mode */
91#define ATM_SETLOOP _IOW('a',ATMIOC_SARCOM+3,struct atmif_sioc)
92 /* set loopback mode */
93#define ATM_QUERYLOOP _IOW('a',ATMIOC_SARCOM+4,struct atmif_sioc)
94 /* query supported loopback modes */
95#define ATM_SETSC _IOW('a',ATMIOC_SPECIAL+1,int)
96 /* enable or disable single-copy */
97#define ATM_SETBACKEND _IOW('a',ATMIOC_SPECIAL+2,atm_backend_t)
98 /* set backend handler */
99#define ATM_NEWBACKENDIF _IOW('a',ATMIOC_SPECIAL+3,atm_backend_t)
100 /* use backend to make new if */
101#define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf)
102 /* add party to p2mp call */
103#ifdef CONFIG_COMPAT
104/* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */
105#define COMPAT_ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct compat_atm_iobuf)
106#endif
107#define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int)
108 /* drop party from p2mp call */
109
110/*
111 * These are backend handkers that can be set via the ATM_SETBACKEND call
112 * above. In the future we may support dynamic loading of these - for now,
113 * they're just being used to share the ATMIOC_BACKEND ioctls
114 */
115#define ATM_BACKEND_RAW 0
116#define ATM_BACKEND_PPP 1 /* PPPoATM - RFC2364 */
117#define ATM_BACKEND_BR2684 2 /* Bridged RFC1483/2684 */
118
119/* for ATM_GETTYPE */
120#define ATM_ITFTYP_LEN 8 /* maximum length of interface type name */
121
122/*
123 * Loopback modes for ATM_{PHY,SAR}_{GET,SET}LOOP
124 */
125
126/* Point of loopback CPU-->SAR-->PHY-->line--> ... */
127#define __ATM_LM_NONE 0 /* no loop back ^ ^ ^ ^ */
128#define __ATM_LM_AAL 1 /* loop back PDUs --' | | | */
129#define __ATM_LM_ATM 2 /* loop back ATM cells ---' | | */
130/* RESERVED 4 loop back on PHY side ---' */
131#define __ATM_LM_PHY 8 /* loop back bits (digital) ----' | */
132#define __ATM_LM_ANALOG 16 /* loop back the analog signal --------' */
133
134/* Direction of loopback */
135#define __ATM_LM_MKLOC(n) ((n)) /* Local (i.e. loop TX to RX) */
136#define __ATM_LM_MKRMT(n) ((n) << 8) /* Remote (i.e. loop RX to TX) */
137
138#define __ATM_LM_XTLOC(n) ((n) & 0xff)
139#define __ATM_LM_XTRMT(n) (((n) >> 8) & 0xff)
140
141#define ATM_LM_NONE 0 /* no loopback */
142
143#define ATM_LM_LOC_AAL __ATM_LM_MKLOC(__ATM_LM_AAL)
144#define ATM_LM_LOC_ATM __ATM_LM_MKLOC(__ATM_LM_ATM)
145#define ATM_LM_LOC_PHY __ATM_LM_MKLOC(__ATM_LM_PHY)
146#define ATM_LM_LOC_ANALOG __ATM_LM_MKLOC(__ATM_LM_ANALOG)
147
148#define ATM_LM_RMT_AAL __ATM_LM_MKRMT(__ATM_LM_AAL)
149#define ATM_LM_RMT_ATM __ATM_LM_MKRMT(__ATM_LM_ATM)
150#define ATM_LM_RMT_PHY __ATM_LM_MKRMT(__ATM_LM_PHY)
151#define ATM_LM_RMT_ANALOG __ATM_LM_MKRMT(__ATM_LM_ANALOG)
152
153/*
154 * Note: ATM_LM_LOC_* and ATM_LM_RMT_* can be combined, provided that
155 * __ATM_LM_XTLOC(x) <= __ATM_LM_XTRMT(x)
156 */
157
158
159struct atm_iobuf {
160 int length;
161 void __user *buffer;
162};
163
164/* for ATM_GETCIRANGE / ATM_SETCIRANGE */
165
166#define ATM_CI_MAX -1 /* use maximum range of VPI/VCI */
167
168struct atm_cirange {
169 signed char vpi_bits; /* 1..8, ATM_CI_MAX (-1) for maximum */
170 signed char vci_bits; /* 1..16, ATM_CI_MAX (-1) for maximum */
171};
172
173/* for ATM_SETSC; actually taken from the ATM_VF number space */
174
175#define ATM_SC_RX 1024 /* enable RX single-copy */
176#define ATM_SC_TX 2048 /* enable TX single-copy */
177
178#define ATM_BACKLOG_DEFAULT 32 /* if we get more, we're likely to time out
179 anyway */
180
181/* MF: change_qos (Modify) flags */
182
183#define ATM_MF_IMMED 1 /* Block until change is effective */
184#define ATM_MF_INC_RSV 2 /* Change reservation on increase */
185#define ATM_MF_INC_SHP 4 /* Change shaping on increase */
186#define ATM_MF_DEC_RSV 8 /* Change reservation on decrease */
187#define ATM_MF_DEC_SHP 16 /* Change shaping on decrease */
188#define ATM_MF_BWD 32 /* Set the backward direction parameters */
189
190#define ATM_MF_SET (ATM_MF_INC_RSV | ATM_MF_INC_SHP | ATM_MF_DEC_RSV | \
191 ATM_MF_DEC_SHP | ATM_MF_BWD)
192
193/*
194 * ATM_VS_* are used to express VC state in a human-friendly way.
195 */
196
197#define ATM_VS_IDLE 0 /* VC is not used */
198#define ATM_VS_CONNECTED 1 /* VC is connected */
199#define ATM_VS_CLOSING 2 /* VC is closing */
200#define ATM_VS_LISTEN 3 /* VC is listening for incoming setups */
201#define ATM_VS_INUSE 4 /* VC is in use (registered with atmsigd) */
202#define ATM_VS_BOUND 5 /* VC is bound */
203
204#define ATM_VS2TXT_MAP \
205 "IDLE", "CONNECTED", "CLOSING", "LISTEN", "INUSE", "BOUND"
206
207#define ATM_VF2TXT_MAP \
208 "ADDR", "READY", "PARTIAL", "REGIS", \
209 "RELEASED", "HASQOS", "LISTEN", "META", \
210 "256", "512", "1024", "2048", \
211 "SESSION", "HASSAP", "BOUND", "CLOSE"
212
213
214
215#endif /* _UAPILINUX_ATMDEV_H */
diff --git a/include/linux/atmioc.h b/include/uapi/linux/atmioc.h
index 37f67aa8f1c1..37f67aa8f1c1 100644
--- a/include/linux/atmioc.h
+++ b/include/uapi/linux/atmioc.h
diff --git a/include/linux/atmlec.h b/include/uapi/linux/atmlec.h
index 302791e3ab2b..302791e3ab2b 100644
--- a/include/linux/atmlec.h
+++ b/include/uapi/linux/atmlec.h
diff --git a/include/linux/atmmpc.h b/include/uapi/linux/atmmpc.h
index 2aba5787fa63..2aba5787fa63 100644
--- a/include/linux/atmmpc.h
+++ b/include/uapi/linux/atmmpc.h
diff --git a/include/linux/atmppp.h b/include/uapi/linux/atmppp.h
index 300dcce0c83f..300dcce0c83f 100644
--- a/include/linux/atmppp.h
+++ b/include/uapi/linux/atmppp.h
diff --git a/include/linux/atmsap.h b/include/uapi/linux/atmsap.h
index 799b104515d7..799b104515d7 100644
--- a/include/linux/atmsap.h
+++ b/include/uapi/linux/atmsap.h
diff --git a/include/linux/atmsvc.h b/include/uapi/linux/atmsvc.h
index aa71583b8da7..aa71583b8da7 100644
--- a/include/linux/atmsvc.h
+++ b/include/uapi/linux/atmsvc.h
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
new file mode 100644
index 000000000000..76352ac45f24
--- /dev/null
+++ b/include/uapi/linux/audit.h
@@ -0,0 +1,404 @@
1/* audit.h -- Auditing support
2 *
3 * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina.
4 * All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
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 * Written by Rickard E. (Rik) Faith <faith@redhat.com>
21 *
22 */
23
24#ifndef _UAPI_LINUX_AUDIT_H_
25#define _UAPI_LINUX_AUDIT_H_
26
27#include <linux/types.h>
28#include <linux/elf-em.h>
29#include <linux/ptrace.h>
30
31/* The netlink messages for the audit system is divided into blocks:
32 * 1000 - 1099 are for commanding the audit system
33 * 1100 - 1199 user space trusted application messages
34 * 1200 - 1299 messages internal to the audit daemon
35 * 1300 - 1399 audit event messages
36 * 1400 - 1499 SE Linux use
37 * 1500 - 1599 kernel LSPP events
38 * 1600 - 1699 kernel crypto events
39 * 1700 - 1799 kernel anomaly records
40 * 1800 - 1899 kernel integrity events
41 * 1900 - 1999 future kernel use
42 * 2000 is for otherwise unclassified kernel audit messages (legacy)
43 * 2001 - 2099 unused (kernel)
44 * 2100 - 2199 user space anomaly records
45 * 2200 - 2299 user space actions taken in response to anomalies
46 * 2300 - 2399 user space generated LSPP events
47 * 2400 - 2499 user space crypto events
48 * 2500 - 2999 future user space (maybe integrity labels and related events)
49 *
50 * Messages from 1000-1199 are bi-directional. 1200-1299 & 2100 - 2999 are
51 * exclusively user space. 1300-2099 is kernel --> user space
52 * communication.
53 */
54#define AUDIT_GET 1000 /* Get status */
55#define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */
56#define AUDIT_LIST 1002 /* List syscall rules -- deprecated */
57#define AUDIT_ADD 1003 /* Add syscall rule -- deprecated */
58#define AUDIT_DEL 1004 /* Delete syscall rule -- deprecated */
59#define AUDIT_USER 1005 /* Message from userspace -- deprecated */
60#define AUDIT_LOGIN 1006 /* Define the login id and information */
61#define AUDIT_WATCH_INS 1007 /* Insert file/dir watch entry */
62#define AUDIT_WATCH_REM 1008 /* Remove file/dir watch entry */
63#define AUDIT_WATCH_LIST 1009 /* List all file/dir watches */
64#define AUDIT_SIGNAL_INFO 1010 /* Get info about sender of signal to auditd */
65#define AUDIT_ADD_RULE 1011 /* Add syscall filtering rule */
66#define AUDIT_DEL_RULE 1012 /* Delete syscall filtering rule */
67#define AUDIT_LIST_RULES 1013 /* List syscall filtering rules */
68#define AUDIT_TRIM 1014 /* Trim junk from watched tree */
69#define AUDIT_MAKE_EQUIV 1015 /* Append to watched tree */
70#define AUDIT_TTY_GET 1016 /* Get TTY auditing status */
71#define AUDIT_TTY_SET 1017 /* Set TTY auditing status */
72
73#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */
74#define AUDIT_USER_AVC 1107 /* We filter this differently */
75#define AUDIT_USER_TTY 1124 /* Non-ICANON TTY input meaning */
76#define AUDIT_LAST_USER_MSG 1199
77#define AUDIT_FIRST_USER_MSG2 2100 /* More user space messages */
78#define AUDIT_LAST_USER_MSG2 2999
79
80#define AUDIT_DAEMON_START 1200 /* Daemon startup record */
81#define AUDIT_DAEMON_END 1201 /* Daemon normal stop record */
82#define AUDIT_DAEMON_ABORT 1202 /* Daemon error stop record */
83#define AUDIT_DAEMON_CONFIG 1203 /* Daemon config change */
84
85#define AUDIT_SYSCALL 1300 /* Syscall event */
86/* #define AUDIT_FS_WATCH 1301 * Deprecated */
87#define AUDIT_PATH 1302 /* Filename path information */
88#define AUDIT_IPC 1303 /* IPC record */
89#define AUDIT_SOCKETCALL 1304 /* sys_socketcall arguments */
90#define AUDIT_CONFIG_CHANGE 1305 /* Audit system configuration change */
91#define AUDIT_SOCKADDR 1306 /* sockaddr copied as syscall arg */
92#define AUDIT_CWD 1307 /* Current working directory */
93#define AUDIT_EXECVE 1309 /* execve arguments */
94#define AUDIT_IPC_SET_PERM 1311 /* IPC new permissions record type */
95#define AUDIT_MQ_OPEN 1312 /* POSIX MQ open record type */
96#define AUDIT_MQ_SENDRECV 1313 /* POSIX MQ send/receive record type */
97#define AUDIT_MQ_NOTIFY 1314 /* POSIX MQ notify record type */
98#define AUDIT_MQ_GETSETATTR 1315 /* POSIX MQ get/set attribute record type */
99#define AUDIT_KERNEL_OTHER 1316 /* For use by 3rd party modules */
100#define AUDIT_FD_PAIR 1317 /* audit record for pipe/socketpair */
101#define AUDIT_OBJ_PID 1318 /* ptrace target */
102#define AUDIT_TTY 1319 /* Input on an administrative TTY */
103#define AUDIT_EOE 1320 /* End of multi-record event */
104#define AUDIT_BPRM_FCAPS 1321 /* Information about fcaps increasing perms */
105#define AUDIT_CAPSET 1322 /* Record showing argument to sys_capset */
106#define AUDIT_MMAP 1323 /* Record showing descriptor and flags in mmap */
107#define AUDIT_NETFILTER_PKT 1324 /* Packets traversing netfilter chains */
108#define AUDIT_NETFILTER_CFG 1325 /* Netfilter chain modifications */
109
110#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
111#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
112#define AUDIT_AVC_PATH 1402 /* dentry, vfsmount pair from avc */
113#define AUDIT_MAC_POLICY_LOAD 1403 /* Policy file load */
114#define AUDIT_MAC_STATUS 1404 /* Changed enforcing,permissive,off */
115#define AUDIT_MAC_CONFIG_CHANGE 1405 /* Changes to booleans */
116#define AUDIT_MAC_UNLBL_ALLOW 1406 /* NetLabel: allow unlabeled traffic */
117#define AUDIT_MAC_CIPSOV4_ADD 1407 /* NetLabel: add CIPSOv4 DOI entry */
118#define AUDIT_MAC_CIPSOV4_DEL 1408 /* NetLabel: del CIPSOv4 DOI entry */
119#define AUDIT_MAC_MAP_ADD 1409 /* NetLabel: add LSM domain mapping */
120#define AUDIT_MAC_MAP_DEL 1410 /* NetLabel: del LSM domain mapping */
121#define AUDIT_MAC_IPSEC_ADDSA 1411 /* Not used */
122#define AUDIT_MAC_IPSEC_DELSA 1412 /* Not used */
123#define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Not used */
124#define AUDIT_MAC_IPSEC_DELSPD 1414 /* Not used */
125#define AUDIT_MAC_IPSEC_EVENT 1415 /* Audit an IPSec event */
126#define AUDIT_MAC_UNLBL_STCADD 1416 /* NetLabel: add a static label */
127#define AUDIT_MAC_UNLBL_STCDEL 1417 /* NetLabel: del a static label */
128
129#define AUDIT_FIRST_KERN_ANOM_MSG 1700
130#define AUDIT_LAST_KERN_ANOM_MSG 1799
131#define AUDIT_ANOM_PROMISCUOUS 1700 /* Device changed promiscuous mode */
132#define AUDIT_ANOM_ABEND 1701 /* Process ended abnormally */
133#define AUDIT_ANOM_LINK 1702 /* Suspicious use of file links */
134#define AUDIT_INTEGRITY_DATA 1800 /* Data integrity verification */
135#define AUDIT_INTEGRITY_METADATA 1801 /* Metadata integrity verification */
136#define AUDIT_INTEGRITY_STATUS 1802 /* Integrity enable status */
137#define AUDIT_INTEGRITY_HASH 1803 /* Integrity HASH type */
138#define AUDIT_INTEGRITY_PCR 1804 /* PCR invalidation msgs */
139#define AUDIT_INTEGRITY_RULE 1805 /* policy rule */
140
141#define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */
142
143/* Rule flags */
144#define AUDIT_FILTER_USER 0x00 /* Apply rule to user-generated messages */
145#define AUDIT_FILTER_TASK 0x01 /* Apply rule at task creation (not syscall) */
146#define AUDIT_FILTER_ENTRY 0x02 /* Apply rule at syscall entry */
147#define AUDIT_FILTER_WATCH 0x03 /* Apply rule to file system watches */
148#define AUDIT_FILTER_EXIT 0x04 /* Apply rule at syscall exit */
149#define AUDIT_FILTER_TYPE 0x05 /* Apply rule at audit_log_start */
150
151#define AUDIT_NR_FILTERS 6
152
153#define AUDIT_FILTER_PREPEND 0x10 /* Prepend to front of list */
154
155/* Rule actions */
156#define AUDIT_NEVER 0 /* Do not build context if rule matches */
157#define AUDIT_POSSIBLE 1 /* Build context if rule matches */
158#define AUDIT_ALWAYS 2 /* Generate audit record if rule matches */
159
160/* Rule structure sizes -- if these change, different AUDIT_ADD and
161 * AUDIT_LIST commands must be implemented. */
162#define AUDIT_MAX_FIELDS 64
163#define AUDIT_MAX_KEY_LEN 256
164#define AUDIT_BITMASK_SIZE 64
165#define AUDIT_WORD(nr) ((__u32)((nr)/32))
166#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32))
167
168#define AUDIT_SYSCALL_CLASSES 16
169#define AUDIT_CLASS_DIR_WRITE 0
170#define AUDIT_CLASS_DIR_WRITE_32 1
171#define AUDIT_CLASS_CHATTR 2
172#define AUDIT_CLASS_CHATTR_32 3
173#define AUDIT_CLASS_READ 4
174#define AUDIT_CLASS_READ_32 5
175#define AUDIT_CLASS_WRITE 6
176#define AUDIT_CLASS_WRITE_32 7
177#define AUDIT_CLASS_SIGNAL 8
178#define AUDIT_CLASS_SIGNAL_32 9
179
180/* This bitmask is used to validate user input. It represents all bits that
181 * are currently used in an audit field constant understood by the kernel.
182 * If you are adding a new #define AUDIT_<whatever>, please ensure that
183 * AUDIT_UNUSED_BITS is updated if need be. */
184#define AUDIT_UNUSED_BITS 0x07FFFC00
185
186/* AUDIT_FIELD_COMPARE rule list */
187#define AUDIT_COMPARE_UID_TO_OBJ_UID 1
188#define AUDIT_COMPARE_GID_TO_OBJ_GID 2
189#define AUDIT_COMPARE_EUID_TO_OBJ_UID 3
190#define AUDIT_COMPARE_EGID_TO_OBJ_GID 4
191#define AUDIT_COMPARE_AUID_TO_OBJ_UID 5
192#define AUDIT_COMPARE_SUID_TO_OBJ_UID 6
193#define AUDIT_COMPARE_SGID_TO_OBJ_GID 7
194#define AUDIT_COMPARE_FSUID_TO_OBJ_UID 8
195#define AUDIT_COMPARE_FSGID_TO_OBJ_GID 9
196
197#define AUDIT_COMPARE_UID_TO_AUID 10
198#define AUDIT_COMPARE_UID_TO_EUID 11
199#define AUDIT_COMPARE_UID_TO_FSUID 12
200#define AUDIT_COMPARE_UID_TO_SUID 13
201
202#define AUDIT_COMPARE_AUID_TO_FSUID 14
203#define AUDIT_COMPARE_AUID_TO_SUID 15
204#define AUDIT_COMPARE_AUID_TO_EUID 16
205
206#define AUDIT_COMPARE_EUID_TO_SUID 17
207#define AUDIT_COMPARE_EUID_TO_FSUID 18
208
209#define AUDIT_COMPARE_SUID_TO_FSUID 19
210
211#define AUDIT_COMPARE_GID_TO_EGID 20
212#define AUDIT_COMPARE_GID_TO_FSGID 21
213#define AUDIT_COMPARE_GID_TO_SGID 22
214
215#define AUDIT_COMPARE_EGID_TO_FSGID 23
216#define AUDIT_COMPARE_EGID_TO_SGID 24
217#define AUDIT_COMPARE_SGID_TO_FSGID 25
218
219#define AUDIT_MAX_FIELD_COMPARE AUDIT_COMPARE_SGID_TO_FSGID
220
221/* Rule fields */
222 /* These are useful when checking the
223 * task structure at task creation time
224 * (AUDIT_PER_TASK). */
225#define AUDIT_PID 0
226#define AUDIT_UID 1
227#define AUDIT_EUID 2
228#define AUDIT_SUID 3
229#define AUDIT_FSUID 4
230#define AUDIT_GID 5
231#define AUDIT_EGID 6
232#define AUDIT_SGID 7
233#define AUDIT_FSGID 8
234#define AUDIT_LOGINUID 9
235#define AUDIT_PERS 10
236#define AUDIT_ARCH 11
237#define AUDIT_MSGTYPE 12
238#define AUDIT_SUBJ_USER 13 /* security label user */
239#define AUDIT_SUBJ_ROLE 14 /* security label role */
240#define AUDIT_SUBJ_TYPE 15 /* security label type */
241#define AUDIT_SUBJ_SEN 16 /* security label sensitivity label */
242#define AUDIT_SUBJ_CLR 17 /* security label clearance label */
243#define AUDIT_PPID 18
244#define AUDIT_OBJ_USER 19
245#define AUDIT_OBJ_ROLE 20
246#define AUDIT_OBJ_TYPE 21
247#define AUDIT_OBJ_LEV_LOW 22
248#define AUDIT_OBJ_LEV_HIGH 23
249
250 /* These are ONLY useful when checking
251 * at syscall exit time (AUDIT_AT_EXIT). */
252#define AUDIT_DEVMAJOR 100
253#define AUDIT_DEVMINOR 101
254#define AUDIT_INODE 102
255#define AUDIT_EXIT 103
256#define AUDIT_SUCCESS 104 /* exit >= 0; value ignored */
257#define AUDIT_WATCH 105
258#define AUDIT_PERM 106
259#define AUDIT_DIR 107
260#define AUDIT_FILETYPE 108
261#define AUDIT_OBJ_UID 109
262#define AUDIT_OBJ_GID 110
263#define AUDIT_FIELD_COMPARE 111
264
265#define AUDIT_ARG0 200
266#define AUDIT_ARG1 (AUDIT_ARG0+1)
267#define AUDIT_ARG2 (AUDIT_ARG0+2)
268#define AUDIT_ARG3 (AUDIT_ARG0+3)
269
270#define AUDIT_FILTERKEY 210
271
272#define AUDIT_NEGATE 0x80000000
273
274/* These are the supported operators.
275 * 4 2 1 8
276 * = > < ?
277 * ----------
278 * 0 0 0 0 00 nonsense
279 * 0 0 0 1 08 & bit mask
280 * 0 0 1 0 10 <
281 * 0 1 0 0 20 >
282 * 0 1 1 0 30 !=
283 * 1 0 0 0 40 =
284 * 1 0 0 1 48 &= bit test
285 * 1 0 1 0 50 <=
286 * 1 1 0 0 60 >=
287 * 1 1 1 1 78 all operators
288 */
289#define AUDIT_BIT_MASK 0x08000000
290#define AUDIT_LESS_THAN 0x10000000
291#define AUDIT_GREATER_THAN 0x20000000
292#define AUDIT_NOT_EQUAL 0x30000000
293#define AUDIT_EQUAL 0x40000000
294#define AUDIT_BIT_TEST (AUDIT_BIT_MASK|AUDIT_EQUAL)
295#define AUDIT_LESS_THAN_OR_EQUAL (AUDIT_LESS_THAN|AUDIT_EQUAL)
296#define AUDIT_GREATER_THAN_OR_EQUAL (AUDIT_GREATER_THAN|AUDIT_EQUAL)
297#define AUDIT_OPERATORS (AUDIT_EQUAL|AUDIT_NOT_EQUAL|AUDIT_BIT_MASK)
298
299enum {
300 Audit_equal,
301 Audit_not_equal,
302 Audit_bitmask,
303 Audit_bittest,
304 Audit_lt,
305 Audit_gt,
306 Audit_le,
307 Audit_ge,
308 Audit_bad
309};
310
311/* Status symbols */
312 /* Mask values */
313#define AUDIT_STATUS_ENABLED 0x0001
314#define AUDIT_STATUS_FAILURE 0x0002
315#define AUDIT_STATUS_PID 0x0004
316#define AUDIT_STATUS_RATE_LIMIT 0x0008
317#define AUDIT_STATUS_BACKLOG_LIMIT 0x0010
318 /* Failure-to-log actions */
319#define AUDIT_FAIL_SILENT 0
320#define AUDIT_FAIL_PRINTK 1
321#define AUDIT_FAIL_PANIC 2
322
323/* distinguish syscall tables */
324#define __AUDIT_ARCH_64BIT 0x80000000
325#define __AUDIT_ARCH_LE 0x40000000
326#define AUDIT_ARCH_ALPHA (EM_ALPHA|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
327#define AUDIT_ARCH_ARM (EM_ARM|__AUDIT_ARCH_LE)
328#define AUDIT_ARCH_ARMEB (EM_ARM)
329#define AUDIT_ARCH_CRIS (EM_CRIS|__AUDIT_ARCH_LE)
330#define AUDIT_ARCH_FRV (EM_FRV)
331#define AUDIT_ARCH_H8300 (EM_H8_300)
332#define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE)
333#define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
334#define AUDIT_ARCH_M32R (EM_M32R)
335#define AUDIT_ARCH_M68K (EM_68K)
336#define AUDIT_ARCH_MIPS (EM_MIPS)
337#define AUDIT_ARCH_MIPSEL (EM_MIPS|__AUDIT_ARCH_LE)
338#define AUDIT_ARCH_MIPS64 (EM_MIPS|__AUDIT_ARCH_64BIT)
339#define AUDIT_ARCH_MIPSEL64 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
340#define AUDIT_ARCH_OPENRISC (EM_OPENRISC)
341#define AUDIT_ARCH_PARISC (EM_PARISC)
342#define AUDIT_ARCH_PARISC64 (EM_PARISC|__AUDIT_ARCH_64BIT)
343#define AUDIT_ARCH_PPC (EM_PPC)
344#define AUDIT_ARCH_PPC64 (EM_PPC64|__AUDIT_ARCH_64BIT)
345#define AUDIT_ARCH_S390 (EM_S390)
346#define AUDIT_ARCH_S390X (EM_S390|__AUDIT_ARCH_64BIT)
347#define AUDIT_ARCH_SH (EM_SH)
348#define AUDIT_ARCH_SHEL (EM_SH|__AUDIT_ARCH_LE)
349#define AUDIT_ARCH_SH64 (EM_SH|__AUDIT_ARCH_64BIT)
350#define AUDIT_ARCH_SHEL64 (EM_SH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
351#define AUDIT_ARCH_SPARC (EM_SPARC)
352#define AUDIT_ARCH_SPARC64 (EM_SPARCV9|__AUDIT_ARCH_64BIT)
353#define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
354
355#define AUDIT_PERM_EXEC 1
356#define AUDIT_PERM_WRITE 2
357#define AUDIT_PERM_READ 4
358#define AUDIT_PERM_ATTR 8
359
360struct audit_status {
361 __u32 mask; /* Bit mask for valid entries */
362 __u32 enabled; /* 1 = enabled, 0 = disabled */
363 __u32 failure; /* Failure-to-log action */
364 __u32 pid; /* pid of auditd process */
365 __u32 rate_limit; /* messages rate limit (per second) */
366 __u32 backlog_limit; /* waiting messages limit */
367 __u32 lost; /* messages lost */
368 __u32 backlog; /* messages waiting in queue */
369};
370
371struct audit_tty_status {
372 __u32 enabled; /* 1 = enabled, 0 = disabled */
373};
374
375/* audit_rule_data supports filter rules with both integer and string
376 * fields. It corresponds with AUDIT_ADD_RULE, AUDIT_DEL_RULE and
377 * AUDIT_LIST_RULES requests.
378 */
379struct audit_rule_data {
380 __u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */
381 __u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */
382 __u32 field_count;
383 __u32 mask[AUDIT_BITMASK_SIZE]; /* syscall(s) affected */
384 __u32 fields[AUDIT_MAX_FIELDS];
385 __u32 values[AUDIT_MAX_FIELDS];
386 __u32 fieldflags[AUDIT_MAX_FIELDS];
387 __u32 buflen; /* total length of string fields */
388 char buf[0]; /* string fields buffer */
389};
390
391/* audit_rule is supported to maintain backward compatibility with
392 * userspace. It supports integer fields only and corresponds to
393 * AUDIT_ADD, AUDIT_DEL and AUDIT_LIST requests.
394 */
395struct audit_rule { /* for AUDIT_LIST, AUDIT_ADD, and AUDIT_DEL */
396 __u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */
397 __u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */
398 __u32 field_count;
399 __u32 mask[AUDIT_BITMASK_SIZE];
400 __u32 fields[AUDIT_MAX_FIELDS];
401 __u32 values[AUDIT_MAX_FIELDS];
402};
403
404#endif /* _UAPI_LINUX_AUDIT_H_ */
diff --git a/include/uapi/linux/auto_fs.h b/include/uapi/linux/auto_fs.h
new file mode 100644
index 000000000000..77cdba9df274
--- /dev/null
+++ b/include/uapi/linux/auto_fs.h
@@ -0,0 +1,83 @@
1/* -*- linux-c -*- ------------------------------------------------------- *
2 *
3 * linux/include/linux/auto_fs.h
4 *
5 * Copyright 1997 Transmeta Corporation - All Rights Reserved
6 *
7 * This file is part of the Linux kernel and is made available under
8 * the terms of the GNU General Public License, version 2, or at your
9 * option, any later version, incorporated herein by reference.
10 *
11 * ----------------------------------------------------------------------- */
12
13
14#ifndef _UAPI_LINUX_AUTO_FS_H
15#define _UAPI_LINUX_AUTO_FS_H
16
17#include <linux/types.h>
18#ifndef __KERNEL__
19#include <sys/ioctl.h>
20#endif /* __KERNEL__ */
21
22
23/* This file describes autofs v3 */
24#define AUTOFS_PROTO_VERSION 3
25
26/* Range of protocol versions defined */
27#define AUTOFS_MAX_PROTO_VERSION AUTOFS_PROTO_VERSION
28#define AUTOFS_MIN_PROTO_VERSION AUTOFS_PROTO_VERSION
29
30/*
31 * Architectures where both 32- and 64-bit binaries can be executed
32 * on 64-bit kernels need this. This keeps the structure format
33 * uniform, and makes sure the wait_queue_token isn't too big to be
34 * passed back down to the kernel.
35 *
36 * This assumes that on these architectures:
37 * mode 32 bit 64 bit
38 * -------------------------
39 * int 32 bit 32 bit
40 * long 32 bit 64 bit
41 *
42 * If so, 32-bit user-space code should be backwards compatible.
43 */
44
45#if defined(__sparc__) || defined(__mips__) || defined(__x86_64__) \
46 || defined(__powerpc__) || defined(__s390__)
47typedef unsigned int autofs_wqt_t;
48#else
49typedef unsigned long autofs_wqt_t;
50#endif
51
52/* Packet types */
53#define autofs_ptype_missing 0 /* Missing entry (mount request) */
54#define autofs_ptype_expire 1 /* Expire entry (umount request) */
55
56struct autofs_packet_hdr {
57 int proto_version; /* Protocol version */
58 int type; /* Type of packet */
59};
60
61struct autofs_packet_missing {
62 struct autofs_packet_hdr hdr;
63 autofs_wqt_t wait_queue_token;
64 int len;
65 char name[NAME_MAX+1];
66};
67
68/* v3 expire (via ioctl) */
69struct autofs_packet_expire {
70 struct autofs_packet_hdr hdr;
71 int len;
72 char name[NAME_MAX+1];
73};
74
75#define AUTOFS_IOC_READY _IO(0x93,0x60)
76#define AUTOFS_IOC_FAIL _IO(0x93,0x61)
77#define AUTOFS_IOC_CATATONIC _IO(0x93,0x62)
78#define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int)
79#define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,compat_ulong_t)
80#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long)
81#define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire)
82
83#endif /* _UAPI_LINUX_AUTO_FS_H */
diff --git a/include/linux/auto_fs4.h b/include/uapi/linux/auto_fs4.h
index e02982fa2953..e02982fa2953 100644
--- a/include/linux/auto_fs4.h
+++ b/include/uapi/linux/auto_fs4.h
diff --git a/include/uapi/linux/auxvec.h b/include/uapi/linux/auxvec.h
new file mode 100644
index 000000000000..61594d598e7b
--- /dev/null
+++ b/include/uapi/linux/auxvec.h
@@ -0,0 +1,35 @@
1#ifndef _UAPI_LINUX_AUXVEC_H
2#define _UAPI_LINUX_AUXVEC_H
3
4#include <asm/auxvec.h>
5
6/* Symbolic values for the entries in the auxiliary table
7 put on the initial stack */
8#define AT_NULL 0 /* end of vector */
9#define AT_IGNORE 1 /* entry should be ignored */
10#define AT_EXECFD 2 /* file descriptor of program */
11#define AT_PHDR 3 /* program headers for program */
12#define AT_PHENT 4 /* size of program header entry */
13#define AT_PHNUM 5 /* number of program headers */
14#define AT_PAGESZ 6 /* system page size */
15#define AT_BASE 7 /* base address of interpreter */
16#define AT_FLAGS 8 /* flags */
17#define AT_ENTRY 9 /* entry point of program */
18#define AT_NOTELF 10 /* program is not ELF */
19#define AT_UID 11 /* real uid */
20#define AT_EUID 12 /* effective uid */
21#define AT_GID 13 /* real gid */
22#define AT_EGID 14 /* effective gid */
23#define AT_PLATFORM 15 /* string identifying CPU for optimizations */
24#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */
25#define AT_CLKTCK 17 /* frequency at which times() increments */
26/* AT_* values 18 through 22 are reserved */
27#define AT_SECURE 23 /* secure mode boolean */
28#define AT_BASE_PLATFORM 24 /* string identifying real platform, may
29 * differ from AT_PLATFORM. */
30#define AT_RANDOM 25 /* address of 16 random bytes */
31
32#define AT_EXECFN 31 /* filename of program */
33
34
35#endif /* _UAPI_LINUX_AUXVEC_H */
diff --git a/include/linux/ax25.h b/include/uapi/linux/ax25.h
index 74c89a41732d..74c89a41732d 100644
--- a/include/linux/ax25.h
+++ b/include/uapi/linux/ax25.h
diff --git a/include/linux/b1lli.h b/include/uapi/linux/b1lli.h
index 713f712685d3..713f712685d3 100644
--- a/include/linux/b1lli.h
+++ b/include/uapi/linux/b1lli.h
diff --git a/include/linux/baycom.h b/include/uapi/linux/baycom.h
index 81249e029dad..81249e029dad 100644
--- a/include/linux/baycom.h
+++ b/include/uapi/linux/baycom.h
diff --git a/include/linux/bfs_fs.h b/include/uapi/linux/bfs_fs.h
index 1c0b355aa515..1c0b355aa515 100644
--- a/include/linux/bfs_fs.h
+++ b/include/uapi/linux/bfs_fs.h
diff --git a/include/uapi/linux/binfmts.h b/include/uapi/linux/binfmts.h
new file mode 100644
index 000000000000..4eb5972867c0
--- /dev/null
+++ b/include/uapi/linux/binfmts.h
@@ -0,0 +1,20 @@
1#ifndef _UAPI_LINUX_BINFMTS_H
2#define _UAPI_LINUX_BINFMTS_H
3
4#include <linux/capability.h>
5
6struct pt_regs;
7
8/*
9 * These are the maximum length and maximum number of strings passed to the
10 * execve() system call. MAX_ARG_STRLEN is essentially random but serves to
11 * prevent the kernel from being unduly impacted by misaddressed pointers.
12 * MAX_ARG_STRINGS is chosen to fit in a signed 32-bit integer.
13 */
14#define MAX_ARG_STRLEN (PAGE_SIZE * 32)
15#define MAX_ARG_STRINGS 0x7FFFFFFF
16
17/* sizeof(linux_binprm->buf) */
18#define BINPRM_BUF_SIZE 128
19
20#endif /* _UAPI_LINUX_BINFMTS_H */
diff --git a/include/linux/blkpg.h b/include/uapi/linux/blkpg.h
index a8519446c111..a8519446c111 100644
--- a/include/linux/blkpg.h
+++ b/include/uapi/linux/blkpg.h
diff --git a/include/uapi/linux/blktrace_api.h b/include/uapi/linux/blktrace_api.h
new file mode 100644
index 000000000000..c590ca6bfbd9
--- /dev/null
+++ b/include/uapi/linux/blktrace_api.h
@@ -0,0 +1,142 @@
1#ifndef _UAPIBLKTRACE_H
2#define _UAPIBLKTRACE_H
3
4#include <linux/types.h>
5
6/*
7 * Trace categories
8 */
9enum blktrace_cat {
10 BLK_TC_READ = 1 << 0, /* reads */
11 BLK_TC_WRITE = 1 << 1, /* writes */
12 BLK_TC_FLUSH = 1 << 2, /* flush */
13 BLK_TC_SYNC = 1 << 3, /* sync IO */
14 BLK_TC_SYNCIO = BLK_TC_SYNC,
15 BLK_TC_QUEUE = 1 << 4, /* queueing/merging */
16 BLK_TC_REQUEUE = 1 << 5, /* requeueing */
17 BLK_TC_ISSUE = 1 << 6, /* issue */
18 BLK_TC_COMPLETE = 1 << 7, /* completions */
19 BLK_TC_FS = 1 << 8, /* fs requests */
20 BLK_TC_PC = 1 << 9, /* pc requests */
21 BLK_TC_NOTIFY = 1 << 10, /* special message */
22 BLK_TC_AHEAD = 1 << 11, /* readahead */
23 BLK_TC_META = 1 << 12, /* metadata */
24 BLK_TC_DISCARD = 1 << 13, /* discard requests */
25 BLK_TC_DRV_DATA = 1 << 14, /* binary per-driver data */
26 BLK_TC_FUA = 1 << 15, /* fua requests */
27
28 BLK_TC_END = 1 << 15, /* we've run out of bits! */
29};
30
31#define BLK_TC_SHIFT (16)
32#define BLK_TC_ACT(act) ((act) << BLK_TC_SHIFT)
33
34/*
35 * Basic trace actions
36 */
37enum blktrace_act {
38 __BLK_TA_QUEUE = 1, /* queued */
39 __BLK_TA_BACKMERGE, /* back merged to existing rq */
40 __BLK_TA_FRONTMERGE, /* front merge to existing rq */
41 __BLK_TA_GETRQ, /* allocated new request */
42 __BLK_TA_SLEEPRQ, /* sleeping on rq allocation */
43 __BLK_TA_REQUEUE, /* request requeued */
44 __BLK_TA_ISSUE, /* sent to driver */
45 __BLK_TA_COMPLETE, /* completed by driver */
46 __BLK_TA_PLUG, /* queue was plugged */
47 __BLK_TA_UNPLUG_IO, /* queue was unplugged by io */
48 __BLK_TA_UNPLUG_TIMER, /* queue was unplugged by timer */
49 __BLK_TA_INSERT, /* insert request */
50 __BLK_TA_SPLIT, /* bio was split */
51 __BLK_TA_BOUNCE, /* bio was bounced */
52 __BLK_TA_REMAP, /* bio was remapped */
53 __BLK_TA_ABORT, /* request aborted */
54 __BLK_TA_DRV_DATA, /* driver-specific binary data */
55};
56
57/*
58 * Notify events.
59 */
60enum blktrace_notify {
61 __BLK_TN_PROCESS = 0, /* establish pid/name mapping */
62 __BLK_TN_TIMESTAMP, /* include system clock */
63 __BLK_TN_MESSAGE, /* Character string message */
64};
65
66
67/*
68 * Trace actions in full. Additionally, read or write is masked
69 */
70#define BLK_TA_QUEUE (__BLK_TA_QUEUE | BLK_TC_ACT(BLK_TC_QUEUE))
71#define BLK_TA_BACKMERGE (__BLK_TA_BACKMERGE | BLK_TC_ACT(BLK_TC_QUEUE))
72#define BLK_TA_FRONTMERGE (__BLK_TA_FRONTMERGE | BLK_TC_ACT(BLK_TC_QUEUE))
73#define BLK_TA_GETRQ (__BLK_TA_GETRQ | BLK_TC_ACT(BLK_TC_QUEUE))
74#define BLK_TA_SLEEPRQ (__BLK_TA_SLEEPRQ | BLK_TC_ACT(BLK_TC_QUEUE))
75#define BLK_TA_REQUEUE (__BLK_TA_REQUEUE | BLK_TC_ACT(BLK_TC_REQUEUE))
76#define BLK_TA_ISSUE (__BLK_TA_ISSUE | BLK_TC_ACT(BLK_TC_ISSUE))
77#define BLK_TA_COMPLETE (__BLK_TA_COMPLETE| BLK_TC_ACT(BLK_TC_COMPLETE))
78#define BLK_TA_PLUG (__BLK_TA_PLUG | BLK_TC_ACT(BLK_TC_QUEUE))
79#define BLK_TA_UNPLUG_IO (__BLK_TA_UNPLUG_IO | BLK_TC_ACT(BLK_TC_QUEUE))
80#define BLK_TA_UNPLUG_TIMER (__BLK_TA_UNPLUG_TIMER | BLK_TC_ACT(BLK_TC_QUEUE))
81#define BLK_TA_INSERT (__BLK_TA_INSERT | BLK_TC_ACT(BLK_TC_QUEUE))
82#define BLK_TA_SPLIT (__BLK_TA_SPLIT)
83#define BLK_TA_BOUNCE (__BLK_TA_BOUNCE)
84#define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE))
85#define BLK_TA_ABORT (__BLK_TA_ABORT | BLK_TC_ACT(BLK_TC_QUEUE))
86#define BLK_TA_DRV_DATA (__BLK_TA_DRV_DATA | BLK_TC_ACT(BLK_TC_DRV_DATA))
87
88#define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY))
89#define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY))
90#define BLK_TN_MESSAGE (__BLK_TN_MESSAGE | BLK_TC_ACT(BLK_TC_NOTIFY))
91
92#define BLK_IO_TRACE_MAGIC 0x65617400
93#define BLK_IO_TRACE_VERSION 0x07
94
95/*
96 * The trace itself
97 */
98struct blk_io_trace {
99 __u32 magic; /* MAGIC << 8 | version */
100 __u32 sequence; /* event number */
101 __u64 time; /* in microseconds */
102 __u64 sector; /* disk offset */
103 __u32 bytes; /* transfer length */
104 __u32 action; /* what happened */
105 __u32 pid; /* who did it */
106 __u32 device; /* device number */
107 __u32 cpu; /* on what cpu did it happen */
108 __u16 error; /* completion error */
109 __u16 pdu_len; /* length of data after this trace */
110};
111
112/*
113 * The remap event
114 */
115struct blk_io_trace_remap {
116 __be32 device_from;
117 __be32 device_to;
118 __be64 sector_from;
119};
120
121enum {
122 Blktrace_setup = 1,
123 Blktrace_running,
124 Blktrace_stopped,
125};
126
127#define BLKTRACE_BDEV_SIZE 32
128
129/*
130 * User setup structure passed with BLKTRACESTART
131 */
132struct blk_user_trace_setup {
133 char name[BLKTRACE_BDEV_SIZE]; /* output */
134 __u16 act_mask; /* input */
135 __u32 buf_size; /* input */
136 __u32 buf_nr; /* input */
137 __u64 start_lba;
138 __u64 end_lba;
139 __u32 pid;
140};
141
142#endif /* _UAPIBLKTRACE_H */
diff --git a/include/linux/bpqether.h b/include/uapi/linux/bpqether.h
index a6c35e1a89ad..a6c35e1a89ad 100644
--- a/include/linux/bpqether.h
+++ b/include/uapi/linux/bpqether.h
diff --git a/include/uapi/linux/bsg.h b/include/uapi/linux/bsg.h
new file mode 100644
index 000000000000..7a12e1c0f371
--- /dev/null
+++ b/include/uapi/linux/bsg.h
@@ -0,0 +1,65 @@
1#ifndef _UAPIBSG_H
2#define _UAPIBSG_H
3
4#include <linux/types.h>
5
6#define BSG_PROTOCOL_SCSI 0
7
8#define BSG_SUB_PROTOCOL_SCSI_CMD 0
9#define BSG_SUB_PROTOCOL_SCSI_TMF 1
10#define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2
11
12/*
13 * For flags member below
14 * sg.h sg_io_hdr also has bits defined for it's flags member. However
15 * none of these bits are implemented/used by bsg. The bits below are
16 * allocated to not conflict with sg.h ones anyway.
17 */
18#define BSG_FLAG_Q_AT_TAIL 0x10 /* default, == 0 at this bit, is Q_AT_HEAD */
19
20struct sg_io_v4 {
21 __s32 guard; /* [i] 'Q' to differentiate from v3 */
22 __u32 protocol; /* [i] 0 -> SCSI , .... */
23 __u32 subprotocol; /* [i] 0 -> SCSI command, 1 -> SCSI task
24 management function, .... */
25
26 __u32 request_len; /* [i] in bytes */
27 __u64 request; /* [i], [*i] {SCSI: cdb} */
28 __u64 request_tag; /* [i] {SCSI: task tag (only if flagged)} */
29 __u32 request_attr; /* [i] {SCSI: task attribute} */
30 __u32 request_priority; /* [i] {SCSI: task priority} */
31 __u32 request_extra; /* [i] {spare, for padding} */
32 __u32 max_response_len; /* [i] in bytes */
33 __u64 response; /* [i], [*o] {SCSI: (auto)sense data} */
34
35 /* "dout_": data out (to device); "din_": data in (from device) */
36 __u32 dout_iovec_count; /* [i] 0 -> "flat" dout transfer else
37 dout_xfer points to array of iovec */
38 __u32 dout_xfer_len; /* [i] bytes to be transferred to device */
39 __u32 din_iovec_count; /* [i] 0 -> "flat" din transfer */
40 __u32 din_xfer_len; /* [i] bytes to be transferred from device */
41 __u64 dout_xferp; /* [i], [*i] */
42 __u64 din_xferp; /* [i], [*o] */
43
44 __u32 timeout; /* [i] units: millisecond */
45 __u32 flags; /* [i] bit mask */
46 __u64 usr_ptr; /* [i->o] unused internally */
47 __u32 spare_in; /* [i] */
48
49 __u32 driver_status; /* [o] 0 -> ok */
50 __u32 transport_status; /* [o] 0 -> ok */
51 __u32 device_status; /* [o] {SCSI: command completion status} */
52 __u32 retry_delay; /* [o] {SCSI: status auxiliary information} */
53 __u32 info; /* [o] additional information */
54 __u32 duration; /* [o] time to complete, in milliseconds */
55 __u32 response_len; /* [o] bytes of response actually written */
56 __s32 din_resid; /* [o] din_xfer_len - actual_din_xfer_len */
57 __s32 dout_resid; /* [o] dout_xfer_len - actual_dout_xfer_len */
58 __u64 generated_tag; /* [o] {SCSI: transport generated task tag} */
59 __u32 spare_out; /* [o] */
60
61 __u32 padding;
62};
63
64
65#endif /* _UAPIBSG_H */
diff --git a/include/uapi/linux/byteorder/Kbuild b/include/uapi/linux/byteorder/Kbuild
index aafaa5aa54d4..619225b9ff2e 100644
--- a/include/uapi/linux/byteorder/Kbuild
+++ b/include/uapi/linux/byteorder/Kbuild
@@ -1 +1,3 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += big_endian.h
3header-y += little_endian.h
diff --git a/include/uapi/linux/byteorder/big_endian.h b/include/uapi/linux/byteorder/big_endian.h
new file mode 100644
index 000000000000..672374450095
--- /dev/null
+++ b/include/uapi/linux/byteorder/big_endian.h
@@ -0,0 +1,105 @@
1#ifndef _UAPI_LINUX_BYTEORDER_BIG_ENDIAN_H
2#define _UAPI_LINUX_BYTEORDER_BIG_ENDIAN_H
3
4#ifndef __BIG_ENDIAN
5#define __BIG_ENDIAN 4321
6#endif
7#ifndef __BIG_ENDIAN_BITFIELD
8#define __BIG_ENDIAN_BITFIELD
9#endif
10
11#include <linux/types.h>
12#include <linux/swab.h>
13
14#define __constant_htonl(x) ((__force __be32)(__u32)(x))
15#define __constant_ntohl(x) ((__force __u32)(__be32)(x))
16#define __constant_htons(x) ((__force __be16)(__u16)(x))
17#define __constant_ntohs(x) ((__force __u16)(__be16)(x))
18#define __constant_cpu_to_le64(x) ((__force __le64)___constant_swab64((x)))
19#define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x))
20#define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x)))
21#define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le32)(x))
22#define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x)))
23#define __constant_le16_to_cpu(x) ___constant_swab16((__force __u16)(__le16)(x))
24#define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x))
25#define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x))
26#define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x))
27#define __constant_be32_to_cpu(x) ((__force __u32)(__be32)(x))
28#define __constant_cpu_to_be16(x) ((__force __be16)(__u16)(x))
29#define __constant_be16_to_cpu(x) ((__force __u16)(__be16)(x))
30#define __cpu_to_le64(x) ((__force __le64)__swab64((x)))
31#define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x))
32#define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
33#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
34#define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
35#define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
36#define __cpu_to_be64(x) ((__force __be64)(__u64)(x))
37#define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
38#define __cpu_to_be32(x) ((__force __be32)(__u32)(x))
39#define __be32_to_cpu(x) ((__force __u32)(__be32)(x))
40#define __cpu_to_be16(x) ((__force __be16)(__u16)(x))
41#define __be16_to_cpu(x) ((__force __u16)(__be16)(x))
42
43static inline __le64 __cpu_to_le64p(const __u64 *p)
44{
45 return (__force __le64)__swab64p(p);
46}
47static inline __u64 __le64_to_cpup(const __le64 *p)
48{
49 return __swab64p((__u64 *)p);
50}
51static inline __le32 __cpu_to_le32p(const __u32 *p)
52{
53 return (__force __le32)__swab32p(p);
54}
55static inline __u32 __le32_to_cpup(const __le32 *p)
56{
57 return __swab32p((__u32 *)p);
58}
59static inline __le16 __cpu_to_le16p(const __u16 *p)
60{
61 return (__force __le16)__swab16p(p);
62}
63static inline __u16 __le16_to_cpup(const __le16 *p)
64{
65 return __swab16p((__u16 *)p);
66}
67static inline __be64 __cpu_to_be64p(const __u64 *p)
68{
69 return (__force __be64)*p;
70}
71static inline __u64 __be64_to_cpup(const __be64 *p)
72{
73 return (__force __u64)*p;
74}
75static inline __be32 __cpu_to_be32p(const __u32 *p)
76{
77 return (__force __be32)*p;
78}
79static inline __u32 __be32_to_cpup(const __be32 *p)
80{
81 return (__force __u32)*p;
82}
83static inline __be16 __cpu_to_be16p(const __u16 *p)
84{
85 return (__force __be16)*p;
86}
87static inline __u16 __be16_to_cpup(const __be16 *p)
88{
89 return (__force __u16)*p;
90}
91#define __cpu_to_le64s(x) __swab64s((x))
92#define __le64_to_cpus(x) __swab64s((x))
93#define __cpu_to_le32s(x) __swab32s((x))
94#define __le32_to_cpus(x) __swab32s((x))
95#define __cpu_to_le16s(x) __swab16s((x))
96#define __le16_to_cpus(x) __swab16s((x))
97#define __cpu_to_be64s(x) do { (void)(x); } while (0)
98#define __be64_to_cpus(x) do { (void)(x); } while (0)
99#define __cpu_to_be32s(x) do { (void)(x); } while (0)
100#define __be32_to_cpus(x) do { (void)(x); } while (0)
101#define __cpu_to_be16s(x) do { (void)(x); } while (0)
102#define __be16_to_cpus(x) do { (void)(x); } while (0)
103
104
105#endif /* _UAPI_LINUX_BYTEORDER_BIG_ENDIAN_H */
diff --git a/include/uapi/linux/byteorder/little_endian.h b/include/uapi/linux/byteorder/little_endian.h
new file mode 100644
index 000000000000..d876736a0017
--- /dev/null
+++ b/include/uapi/linux/byteorder/little_endian.h
@@ -0,0 +1,105 @@
1#ifndef _UAPI_LINUX_BYTEORDER_LITTLE_ENDIAN_H
2#define _UAPI_LINUX_BYTEORDER_LITTLE_ENDIAN_H
3
4#ifndef __LITTLE_ENDIAN
5#define __LITTLE_ENDIAN 1234
6#endif
7#ifndef __LITTLE_ENDIAN_BITFIELD
8#define __LITTLE_ENDIAN_BITFIELD
9#endif
10
11#include <linux/types.h>
12#include <linux/swab.h>
13
14#define __constant_htonl(x) ((__force __be32)___constant_swab32((x)))
15#define __constant_ntohl(x) ___constant_swab32((__force __be32)(x))
16#define __constant_htons(x) ((__force __be16)___constant_swab16((x)))
17#define __constant_ntohs(x) ___constant_swab16((__force __be16)(x))
18#define __constant_cpu_to_le64(x) ((__force __le64)(__u64)(x))
19#define __constant_le64_to_cpu(x) ((__force __u64)(__le64)(x))
20#define __constant_cpu_to_le32(x) ((__force __le32)(__u32)(x))
21#define __constant_le32_to_cpu(x) ((__force __u32)(__le32)(x))
22#define __constant_cpu_to_le16(x) ((__force __le16)(__u16)(x))
23#define __constant_le16_to_cpu(x) ((__force __u16)(__le16)(x))
24#define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x)))
25#define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x))
26#define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x)))
27#define __constant_be32_to_cpu(x) ___constant_swab32((__force __u32)(__be32)(x))
28#define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x)))
29#define __constant_be16_to_cpu(x) ___constant_swab16((__force __u16)(__be16)(x))
30#define __cpu_to_le64(x) ((__force __le64)(__u64)(x))
31#define __le64_to_cpu(x) ((__force __u64)(__le64)(x))
32#define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
33#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
34#define __cpu_to_le16(x) ((__force __le16)(__u16)(x))
35#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
36#define __cpu_to_be64(x) ((__force __be64)__swab64((x)))
37#define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x))
38#define __cpu_to_be32(x) ((__force __be32)__swab32((x)))
39#define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
40#define __cpu_to_be16(x) ((__force __be16)__swab16((x)))
41#define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x))
42
43static inline __le64 __cpu_to_le64p(const __u64 *p)
44{
45 return (__force __le64)*p;
46}
47static inline __u64 __le64_to_cpup(const __le64 *p)
48{
49 return (__force __u64)*p;
50}
51static inline __le32 __cpu_to_le32p(const __u32 *p)
52{
53 return (__force __le32)*p;
54}
55static inline __u32 __le32_to_cpup(const __le32 *p)
56{
57 return (__force __u32)*p;
58}
59static inline __le16 __cpu_to_le16p(const __u16 *p)
60{
61 return (__force __le16)*p;
62}
63static inline __u16 __le16_to_cpup(const __le16 *p)
64{
65 return (__force __u16)*p;
66}
67static inline __be64 __cpu_to_be64p(const __u64 *p)
68{
69 return (__force __be64)__swab64p(p);
70}
71static inline __u64 __be64_to_cpup(const __be64 *p)
72{
73 return __swab64p((__u64 *)p);
74}
75static inline __be32 __cpu_to_be32p(const __u32 *p)
76{
77 return (__force __be32)__swab32p(p);
78}
79static inline __u32 __be32_to_cpup(const __be32 *p)
80{
81 return __swab32p((__u32 *)p);
82}
83static inline __be16 __cpu_to_be16p(const __u16 *p)
84{
85 return (__force __be16)__swab16p(p);
86}
87static inline __u16 __be16_to_cpup(const __be16 *p)
88{
89 return __swab16p((__u16 *)p);
90}
91#define __cpu_to_le64s(x) do { (void)(x); } while (0)
92#define __le64_to_cpus(x) do { (void)(x); } while (0)
93#define __cpu_to_le32s(x) do { (void)(x); } while (0)
94#define __le32_to_cpus(x) do { (void)(x); } while (0)
95#define __cpu_to_le16s(x) do { (void)(x); } while (0)
96#define __le16_to_cpus(x) do { (void)(x); } while (0)
97#define __cpu_to_be64s(x) __swab64s((x))
98#define __be64_to_cpus(x) __swab64s((x))
99#define __cpu_to_be32s(x) __swab32s((x))
100#define __be32_to_cpus(x) __swab32s((x))
101#define __cpu_to_be16s(x) __swab16s((x))
102#define __be16_to_cpus(x) __swab16s((x))
103
104
105#endif /* _UAPI_LINUX_BYTEORDER_LITTLE_ENDIAN_H */
diff --git a/include/uapi/linux/caif/Kbuild b/include/uapi/linux/caif/Kbuild
index aafaa5aa54d4..43396612d3a3 100644
--- a/include/uapi/linux/caif/Kbuild
+++ b/include/uapi/linux/caif/Kbuild
@@ -1 +1,3 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += caif_socket.h
3header-y += if_caif.h
diff --git a/include/linux/caif/caif_socket.h b/include/uapi/linux/caif/caif_socket.h
index 3f3bac6af7bc..3f3bac6af7bc 100644
--- a/include/linux/caif/caif_socket.h
+++ b/include/uapi/linux/caif/caif_socket.h
diff --git a/include/linux/caif/if_caif.h b/include/uapi/linux/caif/if_caif.h
index 5e7eed4edf51..5e7eed4edf51 100644
--- a/include/linux/caif/if_caif.h
+++ b/include/uapi/linux/caif/if_caif.h
diff --git a/include/linux/can.h b/include/uapi/linux/can.h
index e52958d7c2d1..e52958d7c2d1 100644
--- a/include/linux/can.h
+++ b/include/uapi/linux/can.h
diff --git a/include/uapi/linux/can/Kbuild b/include/uapi/linux/can/Kbuild
index aafaa5aa54d4..21c91bf25a29 100644
--- a/include/uapi/linux/can/Kbuild
+++ b/include/uapi/linux/can/Kbuild
@@ -1 +1,6 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += bcm.h
3header-y += error.h
4header-y += gw.h
5header-y += netlink.h
6header-y += raw.h
diff --git a/include/linux/can/bcm.h b/include/uapi/linux/can/bcm.h
index 3ebe387fea4d..3ebe387fea4d 100644
--- a/include/linux/can/bcm.h
+++ b/include/uapi/linux/can/bcm.h
diff --git a/include/linux/can/error.h b/include/uapi/linux/can/error.h
index 7b7148bded71..7b7148bded71 100644
--- a/include/linux/can/error.h
+++ b/include/uapi/linux/can/error.h
diff --git a/include/linux/can/gw.h b/include/uapi/linux/can/gw.h
index 8e1db18c3cb6..8e1db18c3cb6 100644
--- a/include/linux/can/gw.h
+++ b/include/uapi/linux/can/gw.h
diff --git a/include/linux/can/netlink.h b/include/uapi/linux/can/netlink.h
index 14966ddb7df1..14966ddb7df1 100644
--- a/include/linux/can/netlink.h
+++ b/include/uapi/linux/can/netlink.h
diff --git a/include/linux/can/raw.h b/include/uapi/linux/can/raw.h
index a814062b0719..a814062b0719 100644
--- a/include/linux/can/raw.h
+++ b/include/uapi/linux/can/raw.h
diff --git a/include/uapi/linux/capability.h b/include/uapi/linux/capability.h
new file mode 100644
index 000000000000..ba478fa3012e
--- /dev/null
+++ b/include/uapi/linux/capability.h
@@ -0,0 +1,358 @@
1/*
2 * This is <linux/capability.h>
3 *
4 * Andrew G. Morgan <morgan@kernel.org>
5 * Alexander Kjeldaas <astor@guardian.no>
6 * with help from Aleph1, Roland Buresund and Andrew Main.
7 *
8 * See here for the libcap library ("POSIX draft" compliance):
9 *
10 * ftp://www.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.6/
11 */
12
13#ifndef _UAPI_LINUX_CAPABILITY_H
14#define _UAPI_LINUX_CAPABILITY_H
15
16#include <linux/types.h>
17
18struct task_struct;
19
20/* User-level do most of the mapping between kernel and user
21 capabilities based on the version tag given by the kernel. The
22 kernel might be somewhat backwards compatible, but don't bet on
23 it. */
24
25/* Note, cap_t, is defined by POSIX (draft) to be an "opaque" pointer to
26 a set of three capability sets. The transposition of 3*the
27 following structure to such a composite is better handled in a user
28 library since the draft standard requires the use of malloc/free
29 etc.. */
30
31#define _LINUX_CAPABILITY_VERSION_1 0x19980330
32#define _LINUX_CAPABILITY_U32S_1 1
33
34#define _LINUX_CAPABILITY_VERSION_2 0x20071026 /* deprecated - use v3 */
35#define _LINUX_CAPABILITY_U32S_2 2
36
37#define _LINUX_CAPABILITY_VERSION_3 0x20080522
38#define _LINUX_CAPABILITY_U32S_3 2
39
40typedef struct __user_cap_header_struct {
41 __u32 version;
42 int pid;
43} __user *cap_user_header_t;
44
45typedef struct __user_cap_data_struct {
46 __u32 effective;
47 __u32 permitted;
48 __u32 inheritable;
49} __user *cap_user_data_t;
50
51
52#define VFS_CAP_REVISION_MASK 0xFF000000
53#define VFS_CAP_REVISION_SHIFT 24
54#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK
55#define VFS_CAP_FLAGS_EFFECTIVE 0x000001
56
57#define VFS_CAP_REVISION_1 0x01000000
58#define VFS_CAP_U32_1 1
59#define XATTR_CAPS_SZ_1 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_1))
60
61#define VFS_CAP_REVISION_2 0x02000000
62#define VFS_CAP_U32_2 2
63#define XATTR_CAPS_SZ_2 (sizeof(__le32)*(1 + 2*VFS_CAP_U32_2))
64
65#define XATTR_CAPS_SZ XATTR_CAPS_SZ_2
66#define VFS_CAP_U32 VFS_CAP_U32_2
67#define VFS_CAP_REVISION VFS_CAP_REVISION_2
68
69struct vfs_cap_data {
70 __le32 magic_etc; /* Little endian */
71 struct {
72 __le32 permitted; /* Little endian */
73 __le32 inheritable; /* Little endian */
74 } data[VFS_CAP_U32];
75};
76
77#ifndef __KERNEL__
78
79/*
80 * Backwardly compatible definition for source code - trapped in a
81 * 32-bit world. If you find you need this, please consider using
82 * libcap to untrap yourself...
83 */
84#define _LINUX_CAPABILITY_VERSION _LINUX_CAPABILITY_VERSION_1
85#define _LINUX_CAPABILITY_U32S _LINUX_CAPABILITY_U32S_1
86
87#endif
88
89
90/**
91 ** POSIX-draft defined capabilities.
92 **/
93
94/* In a system with the [_POSIX_CHOWN_RESTRICTED] option defined, this
95 overrides the restriction of changing file ownership and group
96 ownership. */
97
98#define CAP_CHOWN 0
99
100/* Override all DAC access, including ACL execute access if
101 [_POSIX_ACL] is defined. Excluding DAC access covered by
102 CAP_LINUX_IMMUTABLE. */
103
104#define CAP_DAC_OVERRIDE 1
105
106/* Overrides all DAC restrictions regarding read and search on files
107 and directories, including ACL restrictions if [_POSIX_ACL] is
108 defined. Excluding DAC access covered by CAP_LINUX_IMMUTABLE. */
109
110#define CAP_DAC_READ_SEARCH 2
111
112/* Overrides all restrictions about allowed operations on files, where
113 file owner ID must be equal to the user ID, except where CAP_FSETID
114 is applicable. It doesn't override MAC and DAC restrictions. */
115
116#define CAP_FOWNER 3
117
118/* Overrides the following restrictions that the effective user ID
119 shall match the file owner ID when setting the S_ISUID and S_ISGID
120 bits on that file; that the effective group ID (or one of the
121 supplementary group IDs) shall match the file owner ID when setting
122 the S_ISGID bit on that file; that the S_ISUID and S_ISGID bits are
123 cleared on successful return from chown(2) (not implemented). */
124
125#define CAP_FSETID 4
126
127/* Overrides the restriction that the real or effective user ID of a
128 process sending a signal must match the real or effective user ID
129 of the process receiving the signal. */
130
131#define CAP_KILL 5
132
133/* Allows setgid(2) manipulation */
134/* Allows setgroups(2) */
135/* Allows forged gids on socket credentials passing. */
136
137#define CAP_SETGID 6
138
139/* Allows set*uid(2) manipulation (including fsuid). */
140/* Allows forged pids on socket credentials passing. */
141
142#define CAP_SETUID 7
143
144
145/**
146 ** Linux-specific capabilities
147 **/
148
149/* Without VFS support for capabilities:
150 * Transfer any capability in your permitted set to any pid,
151 * remove any capability in your permitted set from any pid
152 * With VFS support for capabilities (neither of above, but)
153 * Add any capability from current's capability bounding set
154 * to the current process' inheritable set
155 * Allow taking bits out of capability bounding set
156 * Allow modification of the securebits for a process
157 */
158
159#define CAP_SETPCAP 8
160
161/* Allow modification of S_IMMUTABLE and S_APPEND file attributes */
162
163#define CAP_LINUX_IMMUTABLE 9
164
165/* Allows binding to TCP/UDP sockets below 1024 */
166/* Allows binding to ATM VCIs below 32 */
167
168#define CAP_NET_BIND_SERVICE 10
169
170/* Allow broadcasting, listen to multicast */
171
172#define CAP_NET_BROADCAST 11
173
174/* Allow interface configuration */
175/* Allow administration of IP firewall, masquerading and accounting */
176/* Allow setting debug option on sockets */
177/* Allow modification of routing tables */
178/* Allow setting arbitrary process / process group ownership on
179 sockets */
180/* Allow binding to any address for transparent proxying (also via NET_RAW) */
181/* Allow setting TOS (type of service) */
182/* Allow setting promiscuous mode */
183/* Allow clearing driver statistics */
184/* Allow multicasting */
185/* Allow read/write of device-specific registers */
186/* Allow activation of ATM control sockets */
187
188#define CAP_NET_ADMIN 12
189
190/* Allow use of RAW sockets */
191/* Allow use of PACKET sockets */
192/* Allow binding to any address for transparent proxying (also via NET_ADMIN) */
193
194#define CAP_NET_RAW 13
195
196/* Allow locking of shared memory segments */
197/* Allow mlock and mlockall (which doesn't really have anything to do
198 with IPC) */
199
200#define CAP_IPC_LOCK 14
201
202/* Override IPC ownership checks */
203
204#define CAP_IPC_OWNER 15
205
206/* Insert and remove kernel modules - modify kernel without limit */
207#define CAP_SYS_MODULE 16
208
209/* Allow ioperm/iopl access */
210/* Allow sending USB messages to any device via /proc/bus/usb */
211
212#define CAP_SYS_RAWIO 17
213
214/* Allow use of chroot() */
215
216#define CAP_SYS_CHROOT 18
217
218/* Allow ptrace() of any process */
219
220#define CAP_SYS_PTRACE 19
221
222/* Allow configuration of process accounting */
223
224#define CAP_SYS_PACCT 20
225
226/* Allow configuration of the secure attention key */
227/* Allow administration of the random device */
228/* Allow examination and configuration of disk quotas */
229/* Allow setting the domainname */
230/* Allow setting the hostname */
231/* Allow calling bdflush() */
232/* Allow mount() and umount(), setting up new smb connection */
233/* Allow some autofs root ioctls */
234/* Allow nfsservctl */
235/* Allow VM86_REQUEST_IRQ */
236/* Allow to read/write pci config on alpha */
237/* Allow irix_prctl on mips (setstacksize) */
238/* Allow flushing all cache on m68k (sys_cacheflush) */
239/* Allow removing semaphores */
240/* Used instead of CAP_CHOWN to "chown" IPC message queues, semaphores
241 and shared memory */
242/* Allow locking/unlocking of shared memory segment */
243/* Allow turning swap on/off */
244/* Allow forged pids on socket credentials passing */
245/* Allow setting readahead and flushing buffers on block devices */
246/* Allow setting geometry in floppy driver */
247/* Allow turning DMA on/off in xd driver */
248/* Allow administration of md devices (mostly the above, but some
249 extra ioctls) */
250/* Allow tuning the ide driver */
251/* Allow access to the nvram device */
252/* Allow administration of apm_bios, serial and bttv (TV) device */
253/* Allow manufacturer commands in isdn CAPI support driver */
254/* Allow reading non-standardized portions of pci configuration space */
255/* Allow DDI debug ioctl on sbpcd driver */
256/* Allow setting up serial ports */
257/* Allow sending raw qic-117 commands */
258/* Allow enabling/disabling tagged queuing on SCSI controllers and sending
259 arbitrary SCSI commands */
260/* Allow setting encryption key on loopback filesystem */
261/* Allow setting zone reclaim policy */
262
263#define CAP_SYS_ADMIN 21
264
265/* Allow use of reboot() */
266
267#define CAP_SYS_BOOT 22
268
269/* Allow raising priority and setting priority on other (different
270 UID) processes */
271/* Allow use of FIFO and round-robin (realtime) scheduling on own
272 processes and setting the scheduling algorithm used by another
273 process. */
274/* Allow setting cpu affinity on other processes */
275
276#define CAP_SYS_NICE 23
277
278/* Override resource limits. Set resource limits. */
279/* Override quota limits. */
280/* Override reserved space on ext2 filesystem */
281/* Modify data journaling mode on ext3 filesystem (uses journaling
282 resources) */
283/* NOTE: ext2 honors fsuid when checking for resource overrides, so
284 you can override using fsuid too */
285/* Override size restrictions on IPC message queues */
286/* Allow more than 64hz interrupts from the real-time clock */
287/* Override max number of consoles on console allocation */
288/* Override max number of keymaps */
289
290#define CAP_SYS_RESOURCE 24
291
292/* Allow manipulation of system clock */
293/* Allow irix_stime on mips */
294/* Allow setting the real-time clock */
295
296#define CAP_SYS_TIME 25
297
298/* Allow configuration of tty devices */
299/* Allow vhangup() of tty */
300
301#define CAP_SYS_TTY_CONFIG 26
302
303/* Allow the privileged aspects of mknod() */
304
305#define CAP_MKNOD 27
306
307/* Allow taking of leases on files */
308
309#define CAP_LEASE 28
310
311#define CAP_AUDIT_WRITE 29
312
313#define CAP_AUDIT_CONTROL 30
314
315#define CAP_SETFCAP 31
316
317/* Override MAC access.
318 The base kernel enforces no MAC policy.
319 An LSM may enforce a MAC policy, and if it does and it chooses
320 to implement capability based overrides of that policy, this is
321 the capability it should use to do so. */
322
323#define CAP_MAC_OVERRIDE 32
324
325/* Allow MAC configuration or state changes.
326 The base kernel requires no MAC configuration.
327 An LSM may enforce a MAC policy, and if it does and it chooses
328 to implement capability based checks on modifications to that
329 policy or the data required to maintain it, this is the
330 capability it should use to do so. */
331
332#define CAP_MAC_ADMIN 33
333
334/* Allow configuring the kernel's syslog (printk behaviour) */
335
336#define CAP_SYSLOG 34
337
338/* Allow triggering something that will wake the system */
339
340#define CAP_WAKE_ALARM 35
341
342/* Allow preventing system suspends */
343
344#define CAP_BLOCK_SUSPEND 36
345
346#define CAP_LAST_CAP CAP_BLOCK_SUSPEND
347
348#define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
349
350/*
351 * Bit location of each capability (used by user-space library and kernel)
352 */
353
354#define CAP_TO_INDEX(x) ((x) >> 5) /* 1 << 5 == bits in __u32 */
355#define CAP_TO_MASK(x) (1 << ((x) & 31)) /* mask for indexed __u32 */
356
357
358#endif /* _UAPI_LINUX_CAPABILITY_H */
diff --git a/include/linux/capi.h b/include/uapi/linux/capi.h
index 65100d6cb89b..65100d6cb89b 100644
--- a/include/linux/capi.h
+++ b/include/uapi/linux/capi.h
diff --git a/include/linux/cciss_defs.h b/include/uapi/linux/cciss_defs.h
index 316b670d4e33..316b670d4e33 100644
--- a/include/linux/cciss_defs.h
+++ b/include/uapi/linux/cciss_defs.h
diff --git a/include/uapi/linux/cciss_ioctl.h b/include/uapi/linux/cciss_ioctl.h
new file mode 100644
index 000000000000..bb0b9ddf7eeb
--- /dev/null
+++ b/include/uapi/linux/cciss_ioctl.h
@@ -0,0 +1,88 @@
1#ifndef _UAPICCISS_IOCTLH
2#define _UAPICCISS_IOCTLH
3
4#include <linux/types.h>
5#include <linux/ioctl.h>
6#include <linux/cciss_defs.h>
7
8#define CCISS_IOC_MAGIC 'B'
9
10
11typedef struct _cciss_pci_info_struct
12{
13 unsigned char bus;
14 unsigned char dev_fn;
15 unsigned short domain;
16 __u32 board_id;
17} cciss_pci_info_struct;
18
19typedef struct _cciss_coalint_struct
20{
21 __u32 delay;
22 __u32 count;
23} cciss_coalint_struct;
24
25typedef char NodeName_type[16];
26
27typedef __u32 Heartbeat_type;
28
29#define CISS_PARSCSIU2 0x0001
30#define CISS_PARCSCIU3 0x0002
31#define CISS_FIBRE1G 0x0100
32#define CISS_FIBRE2G 0x0200
33typedef __u32 BusTypes_type;
34
35typedef char FirmwareVer_type[4];
36typedef __u32 DriverVer_type;
37
38#define MAX_KMALLOC_SIZE 128000
39
40typedef struct _IOCTL_Command_struct {
41 LUNAddr_struct LUN_info;
42 RequestBlock_struct Request;
43 ErrorInfo_struct error_info;
44 WORD buf_size; /* size in bytes of the buf */
45 BYTE __user *buf;
46} IOCTL_Command_struct;
47
48typedef struct _BIG_IOCTL_Command_struct {
49 LUNAddr_struct LUN_info;
50 RequestBlock_struct Request;
51 ErrorInfo_struct error_info;
52 DWORD malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */
53 DWORD buf_size; /* size in bytes of the buf */
54 /* < malloc_size * MAXSGENTRIES */
55 BYTE __user *buf;
56} BIG_IOCTL_Command_struct;
57
58typedef struct _LogvolInfo_struct{
59 __u32 LunID;
60 int num_opens; /* number of opens on the logical volume */
61 int num_parts; /* number of partitions configured on logvol */
62} LogvolInfo_struct;
63
64#define CCISS_GETPCIINFO _IOR(CCISS_IOC_MAGIC, 1, cciss_pci_info_struct)
65
66#define CCISS_GETINTINFO _IOR(CCISS_IOC_MAGIC, 2, cciss_coalint_struct)
67#define CCISS_SETINTINFO _IOW(CCISS_IOC_MAGIC, 3, cciss_coalint_struct)
68
69#define CCISS_GETNODENAME _IOR(CCISS_IOC_MAGIC, 4, NodeName_type)
70#define CCISS_SETNODENAME _IOW(CCISS_IOC_MAGIC, 5, NodeName_type)
71
72#define CCISS_GETHEARTBEAT _IOR(CCISS_IOC_MAGIC, 6, Heartbeat_type)
73#define CCISS_GETBUSTYPES _IOR(CCISS_IOC_MAGIC, 7, BusTypes_type)
74#define CCISS_GETFIRMVER _IOR(CCISS_IOC_MAGIC, 8, FirmwareVer_type)
75#define CCISS_GETDRIVVER _IOR(CCISS_IOC_MAGIC, 9, DriverVer_type)
76#define CCISS_REVALIDVOLS _IO(CCISS_IOC_MAGIC, 10)
77#define CCISS_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 11, IOCTL_Command_struct)
78#define CCISS_DEREGDISK _IO(CCISS_IOC_MAGIC, 12)
79
80/* no longer used... use REGNEWD instead */
81#define CCISS_REGNEWDISK _IOW(CCISS_IOC_MAGIC, 13, int)
82
83#define CCISS_REGNEWD _IO(CCISS_IOC_MAGIC, 14)
84#define CCISS_RESCANDISK _IO(CCISS_IOC_MAGIC, 16)
85#define CCISS_GETLUNINFO _IOR(CCISS_IOC_MAGIC, 17, LogvolInfo_struct)
86#define CCISS_BIG_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL_Command_struct)
87
88#endif /* _UAPICCISS_IOCTLH */
diff --git a/include/uapi/linux/cdrom.h b/include/uapi/linux/cdrom.h
new file mode 100644
index 000000000000..898b866b300c
--- /dev/null
+++ b/include/uapi/linux/cdrom.h
@@ -0,0 +1,912 @@
1/*
2 * -- <linux/cdrom.h>
3 * General header file for linux CD-ROM drivers
4 * Copyright (C) 1992 David Giller, rafetmad@oxy.edu
5 * 1994, 1995 Eberhard Mönkeberg, emoenke@gwdg.de
6 * 1996 David van Leeuwen, david@tm.tno.nl
7 * 1997, 1998 Erik Andersen, andersee@debian.org
8 * 1998-2002 Jens Axboe, axboe@suse.de
9 */
10
11#ifndef _UAPI_LINUX_CDROM_H
12#define _UAPI_LINUX_CDROM_H
13
14#include <linux/types.h>
15#include <asm/byteorder.h>
16
17/*******************************************************
18 * As of Linux 2.1.x, all Linux CD-ROM application programs will use this
19 * (and only this) include file. It is my hope to provide Linux with
20 * a uniform interface between software accessing CD-ROMs and the various
21 * device drivers that actually talk to the drives. There may still be
22 * 23 different kinds of strange CD-ROM drives, but at least there will
23 * now be one, and only one, Linux CD-ROM interface.
24 *
25 * Additionally, as of Linux 2.1.x, all Linux application programs
26 * should use the O_NONBLOCK option when opening a CD-ROM device
27 * for subsequent ioctl commands. This allows for neat system errors
28 * like "No medium found" or "Wrong medium type" upon attempting to
29 * mount or play an empty slot, mount an audio disc, or play a data disc.
30 * Generally, changing an application program to support O_NONBLOCK
31 * is as easy as the following:
32 * - drive = open("/dev/cdrom", O_RDONLY);
33 * + drive = open("/dev/cdrom", O_RDONLY | O_NONBLOCK);
34 * It is worth the small change.
35 *
36 * Patches for many common CD programs (provided by David A. van Leeuwen)
37 * can be found at: ftp://ftp.gwdg.de/pub/linux/cdrom/drivers/cm206/
38 *
39 *******************************************************/
40
41/* When a driver supports a certain function, but the cdrom drive we are
42 * using doesn't, we will return the error EDRIVE_CANT_DO_THIS. We will
43 * borrow the "Operation not supported" error from the network folks to
44 * accomplish this. Maybe someday we will get a more targeted error code,
45 * but this will do for now... */
46#define EDRIVE_CANT_DO_THIS EOPNOTSUPP
47
48/*******************************************************
49 * The CD-ROM IOCTL commands -- these should be supported by
50 * all the various cdrom drivers. For the CD-ROM ioctls, we
51 * will commandeer byte 0x53, or 'S'.
52 *******************************************************/
53#define CDROMPAUSE 0x5301 /* Pause Audio Operation */
54#define CDROMRESUME 0x5302 /* Resume paused Audio Operation */
55#define CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */
56#define CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index
57 (struct cdrom_ti) */
58#define CDROMREADTOCHDR 0x5305 /* Read TOC header
59 (struct cdrom_tochdr) */
60#define CDROMREADTOCENTRY 0x5306 /* Read TOC entry
61 (struct cdrom_tocentry) */
62#define CDROMSTOP 0x5307 /* Stop the cdrom drive */
63#define CDROMSTART 0x5308 /* Start the cdrom drive */
64#define CDROMEJECT 0x5309 /* Ejects the cdrom media */
65#define CDROMVOLCTRL 0x530a /* Control output volume
66 (struct cdrom_volctrl) */
67#define CDROMSUBCHNL 0x530b /* Read subchannel data
68 (struct cdrom_subchnl) */
69#define CDROMREADMODE2 0x530c /* Read CDROM mode 2 data (2336 Bytes)
70 (struct cdrom_read) */
71#define CDROMREADMODE1 0x530d /* Read CDROM mode 1 data (2048 Bytes)
72 (struct cdrom_read) */
73#define CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */
74#define CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */
75#define CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session
76 address of multi session disks
77 (struct cdrom_multisession) */
78#define CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code"
79 if available (struct cdrom_mcn) */
80#define CDROM_GET_UPC CDROM_GET_MCN /* This one is deprecated,
81 but here anyway for compatibility */
82#define CDROMRESET 0x5312 /* hard-reset the drive */
83#define CDROMVOLREAD 0x5313 /* Get the drive's volume setting
84 (struct cdrom_volctrl) */
85#define CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes)
86 (struct cdrom_read) */
87/*
88 * These ioctls are used only used in aztcd.c and optcd.c
89 */
90#define CDROMREADCOOKED 0x5315 /* read data in cooked mode */
91#define CDROMSEEK 0x5316 /* seek msf address */
92
93/*
94 * This ioctl is only used by the scsi-cd driver.
95 It is for playing audio in logical block addressing mode.
96 */
97#define CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */
98
99/*
100 * These ioctls are only used in optcd.c
101 */
102#define CDROMREADALL 0x5318 /* read all 2646 bytes */
103
104/*
105 * These ioctls are (now) only in ide-cd.c for controlling
106 * drive spindown time. They should be implemented in the
107 * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10,
108 * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE...
109 * -Erik
110 */
111#define CDROMGETSPINDOWN 0x531d
112#define CDROMSETSPINDOWN 0x531e
113
114/*
115 * These ioctls are implemented through the uniform CD-ROM driver
116 * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM
117 * drivers are eventually ported to the uniform CD-ROM driver interface.
118 */
119#define CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */
120#define CDROM_SET_OPTIONS 0x5320 /* Set behavior options */
121#define CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */
122#define CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */
123#define CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */
124#define CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */
125#define CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */
126#define CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */
127#define CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */
128#define CDROM_LOCKDOOR 0x5329 /* lock or unlock door */
129#define CDROM_DEBUG 0x5330 /* Turn debug messages on/off */
130#define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */
131
132/* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386.
133 * Future CDROM ioctls should be kept below 0x537F
134 */
135
136/* This ioctl is only used by sbpcd at the moment */
137#define CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */
138 /* conflict with SCSI_IOCTL_GET_IDLUN */
139
140/* DVD-ROM Specific ioctls */
141#define DVD_READ_STRUCT 0x5390 /* Read structure */
142#define DVD_WRITE_STRUCT 0x5391 /* Write structure */
143#define DVD_AUTH 0x5392 /* Authentication */
144
145#define CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */
146#define CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */
147#define CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */
148
149/*******************************************************
150 * CDROM IOCTL structures
151 *******************************************************/
152
153/* Address in MSF format */
154struct cdrom_msf0
155{
156 __u8 minute;
157 __u8 second;
158 __u8 frame;
159};
160
161/* Address in either MSF or logical format */
162union cdrom_addr
163{
164 struct cdrom_msf0 msf;
165 int lba;
166};
167
168/* This struct is used by the CDROMPLAYMSF ioctl */
169struct cdrom_msf
170{
171 __u8 cdmsf_min0; /* start minute */
172 __u8 cdmsf_sec0; /* start second */
173 __u8 cdmsf_frame0; /* start frame */
174 __u8 cdmsf_min1; /* end minute */
175 __u8 cdmsf_sec1; /* end second */
176 __u8 cdmsf_frame1; /* end frame */
177};
178
179/* This struct is used by the CDROMPLAYTRKIND ioctl */
180struct cdrom_ti
181{
182 __u8 cdti_trk0; /* start track */
183 __u8 cdti_ind0; /* start index */
184 __u8 cdti_trk1; /* end track */
185 __u8 cdti_ind1; /* end index */
186};
187
188/* This struct is used by the CDROMREADTOCHDR ioctl */
189struct cdrom_tochdr
190{
191 __u8 cdth_trk0; /* start track */
192 __u8 cdth_trk1; /* end track */
193};
194
195/* This struct is used by the CDROMVOLCTRL and CDROMVOLREAD ioctls */
196struct cdrom_volctrl
197{
198 __u8 channel0;
199 __u8 channel1;
200 __u8 channel2;
201 __u8 channel3;
202};
203
204/* This struct is used by the CDROMSUBCHNL ioctl */
205struct cdrom_subchnl
206{
207 __u8 cdsc_format;
208 __u8 cdsc_audiostatus;
209 __u8 cdsc_adr: 4;
210 __u8 cdsc_ctrl: 4;
211 __u8 cdsc_trk;
212 __u8 cdsc_ind;
213 union cdrom_addr cdsc_absaddr;
214 union cdrom_addr cdsc_reladdr;
215};
216
217
218/* This struct is used by the CDROMREADTOCENTRY ioctl */
219struct cdrom_tocentry
220{
221 __u8 cdte_track;
222 __u8 cdte_adr :4;
223 __u8 cdte_ctrl :4;
224 __u8 cdte_format;
225 union cdrom_addr cdte_addr;
226 __u8 cdte_datamode;
227};
228
229/* This struct is used by the CDROMREADMODE1, and CDROMREADMODE2 ioctls */
230struct cdrom_read
231{
232 int cdread_lba;
233 char *cdread_bufaddr;
234 int cdread_buflen;
235};
236
237/* This struct is used by the CDROMREADAUDIO ioctl */
238struct cdrom_read_audio
239{
240 union cdrom_addr addr; /* frame address */
241 __u8 addr_format; /* CDROM_LBA or CDROM_MSF */
242 int nframes; /* number of 2352-byte-frames to read at once */
243 __u8 __user *buf; /* frame buffer (size: nframes*2352 bytes) */
244};
245
246/* This struct is used with the CDROMMULTISESSION ioctl */
247struct cdrom_multisession
248{
249 union cdrom_addr addr; /* frame address: start-of-last-session
250 (not the new "frame 16"!). Only valid
251 if the "xa_flag" is true. */
252 __u8 xa_flag; /* 1: "is XA disk" */
253 __u8 addr_format; /* CDROM_LBA or CDROM_MSF */
254};
255
256/* This struct is used with the CDROM_GET_MCN ioctl.
257 * Very few audio discs actually have Universal Product Code information,
258 * which should just be the Medium Catalog Number on the box. Also note
259 * that the way the codeis written on CD is _not_ uniform across all discs!
260 */
261struct cdrom_mcn
262{
263 __u8 medium_catalog_number[14]; /* 13 ASCII digits, null-terminated */
264};
265
266/* This is used by the CDROMPLAYBLK ioctl */
267struct cdrom_blk
268{
269 unsigned from;
270 unsigned short len;
271};
272
273#define CDROM_PACKET_SIZE 12
274
275#define CGC_DATA_UNKNOWN 0
276#define CGC_DATA_WRITE 1
277#define CGC_DATA_READ 2
278#define CGC_DATA_NONE 3
279
280/* for CDROM_PACKET_COMMAND ioctl */
281struct cdrom_generic_command
282{
283 unsigned char cmd[CDROM_PACKET_SIZE];
284 unsigned char __user *buffer;
285 unsigned int buflen;
286 int stat;
287 struct request_sense __user *sense;
288 unsigned char data_direction;
289 int quiet;
290 int timeout;
291 void __user *reserved[1]; /* unused, actually */
292};
293
294/*
295 * A CD-ROM physical sector size is 2048, 2052, 2056, 2324, 2332, 2336,
296 * 2340, or 2352 bytes long.
297
298* Sector types of the standard CD-ROM data formats:
299 *
300 * format sector type user data size (bytes)
301 * -----------------------------------------------------------------------------
302 * 1 (Red Book) CD-DA 2352 (CD_FRAMESIZE_RAW)
303 * 2 (Yellow Book) Mode1 Form1 2048 (CD_FRAMESIZE)
304 * 3 (Yellow Book) Mode1 Form2 2336 (CD_FRAMESIZE_RAW0)
305 * 4 (Green Book) Mode2 Form1 2048 (CD_FRAMESIZE)
306 * 5 (Green Book) Mode2 Form2 2328 (2324+4 spare bytes)
307 *
308 *
309 * The layout of the standard CD-ROM data formats:
310 * -----------------------------------------------------------------------------
311 * - audio (red): | audio_sample_bytes |
312 * | 2352 |
313 *
314 * - data (yellow, mode1): | sync - head - data - EDC - zero - ECC |
315 * | 12 - 4 - 2048 - 4 - 8 - 276 |
316 *
317 * - data (yellow, mode2): | sync - head - data |
318 * | 12 - 4 - 2336 |
319 *
320 * - XA data (green, mode2 form1): | sync - head - sub - data - EDC - ECC |
321 * | 12 - 4 - 8 - 2048 - 4 - 276 |
322 *
323 * - XA data (green, mode2 form2): | sync - head - sub - data - Spare |
324 * | 12 - 4 - 8 - 2324 - 4 |
325 *
326 */
327
328/* Some generally useful CD-ROM information -- mostly based on the above */
329#define CD_MINS 74 /* max. minutes per CD, not really a limit */
330#define CD_SECS 60 /* seconds per minute */
331#define CD_FRAMES 75 /* frames per second */
332#define CD_SYNC_SIZE 12 /* 12 sync bytes per raw data frame */
333#define CD_MSF_OFFSET 150 /* MSF numbering offset of first frame */
334#define CD_CHUNK_SIZE 24 /* lowest-level "data bytes piece" */
335#define CD_NUM_OF_CHUNKS 98 /* chunks per frame */
336#define CD_FRAMESIZE_SUB 96 /* subchannel data "frame" size */
337#define CD_HEAD_SIZE 4 /* header (address) bytes per raw data frame */
338#define CD_SUBHEAD_SIZE 8 /* subheader bytes per raw XA data frame */
339#define CD_EDC_SIZE 4 /* bytes EDC per most raw data frame types */
340#define CD_ZERO_SIZE 8 /* bytes zero per yellow book mode 1 frame */
341#define CD_ECC_SIZE 276 /* bytes ECC per most raw data frame types */
342#define CD_FRAMESIZE 2048 /* bytes per frame, "cooked" mode */
343#define CD_FRAMESIZE_RAW 2352 /* bytes per frame, "raw" mode */
344#define CD_FRAMESIZE_RAWER 2646 /* The maximum possible returned bytes */
345/* most drives don't deliver everything: */
346#define CD_FRAMESIZE_RAW1 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE) /*2340*/
347#define CD_FRAMESIZE_RAW0 (CD_FRAMESIZE_RAW-CD_SYNC_SIZE-CD_HEAD_SIZE) /*2336*/
348
349#define CD_XA_HEAD (CD_HEAD_SIZE+CD_SUBHEAD_SIZE) /* "before data" part of raw XA frame */
350#define CD_XA_TAIL (CD_EDC_SIZE+CD_ECC_SIZE) /* "after data" part of raw XA frame */
351#define CD_XA_SYNC_HEAD (CD_SYNC_SIZE+CD_XA_HEAD) /* sync bytes + header of XA frame */
352
353/* CD-ROM address types (cdrom_tocentry.cdte_format) */
354#define CDROM_LBA 0x01 /* "logical block": first frame is #0 */
355#define CDROM_MSF 0x02 /* "minute-second-frame": binary, not bcd here! */
356
357/* bit to tell whether track is data or audio (cdrom_tocentry.cdte_ctrl) */
358#define CDROM_DATA_TRACK 0x04
359
360/* The leadout track is always 0xAA, regardless of # of tracks on disc */
361#define CDROM_LEADOUT 0xAA
362
363/* audio states (from SCSI-2, but seen with other drives, too) */
364#define CDROM_AUDIO_INVALID 0x00 /* audio status not supported */
365#define CDROM_AUDIO_PLAY 0x11 /* audio play operation in progress */
366#define CDROM_AUDIO_PAUSED 0x12 /* audio play operation paused */
367#define CDROM_AUDIO_COMPLETED 0x13 /* audio play successfully completed */
368#define CDROM_AUDIO_ERROR 0x14 /* audio play stopped due to error */
369#define CDROM_AUDIO_NO_STATUS 0x15 /* no current audio status to return */
370
371/* capability flags used with the uniform CD-ROM driver */
372#define CDC_CLOSE_TRAY 0x1 /* caddy systems _can't_ close */
373#define CDC_OPEN_TRAY 0x2 /* but _can_ eject. */
374#define CDC_LOCK 0x4 /* disable manual eject */
375#define CDC_SELECT_SPEED 0x8 /* programmable speed */
376#define CDC_SELECT_DISC 0x10 /* select disc from juke-box */
377#define CDC_MULTI_SESSION 0x20 /* read sessions>1 */
378#define CDC_MCN 0x40 /* Medium Catalog Number */
379#define CDC_MEDIA_CHANGED 0x80 /* media changed */
380#define CDC_PLAY_AUDIO 0x100 /* audio functions */
381#define CDC_RESET 0x200 /* hard reset device */
382#define CDC_DRIVE_STATUS 0x800 /* driver implements drive status */
383#define CDC_GENERIC_PACKET 0x1000 /* driver implements generic packets */
384#define CDC_CD_R 0x2000 /* drive is a CD-R */
385#define CDC_CD_RW 0x4000 /* drive is a CD-RW */
386#define CDC_DVD 0x8000 /* drive is a DVD */
387#define CDC_DVD_R 0x10000 /* drive can write DVD-R */
388#define CDC_DVD_RAM 0x20000 /* drive can write DVD-RAM */
389#define CDC_MO_DRIVE 0x40000 /* drive is an MO device */
390#define CDC_MRW 0x80000 /* drive can read MRW */
391#define CDC_MRW_W 0x100000 /* drive can write MRW */
392#define CDC_RAM 0x200000 /* ok to open for WRITE */
393
394/* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */
395#define CDS_NO_INFO 0 /* if not implemented */
396#define CDS_NO_DISC 1
397#define CDS_TRAY_OPEN 2
398#define CDS_DRIVE_NOT_READY 3
399#define CDS_DISC_OK 4
400
401/* return values for the CDROM_DISC_STATUS ioctl */
402/* can also return CDS_NO_[INFO|DISC], from above */
403#define CDS_AUDIO 100
404#define CDS_DATA_1 101
405#define CDS_DATA_2 102
406#define CDS_XA_2_1 103
407#define CDS_XA_2_2 104
408#define CDS_MIXED 105
409
410/* User-configurable behavior options for the uniform CD-ROM driver */
411#define CDO_AUTO_CLOSE 0x1 /* close tray on first open() */
412#define CDO_AUTO_EJECT 0x2 /* open tray on last release() */
413#define CDO_USE_FFLAGS 0x4 /* use O_NONBLOCK information on open */
414#define CDO_LOCK 0x8 /* lock tray on open files */
415#define CDO_CHECK_TYPE 0x10 /* check type on open for data */
416
417/* Special codes used when specifying changer slots. */
418#define CDSL_NONE (INT_MAX-1)
419#define CDSL_CURRENT INT_MAX
420
421/* For partition based multisession access. IDE can handle 64 partitions
422 * per drive - SCSI CD-ROM's use minors to differentiate between the
423 * various drives, so we can't do multisessions the same way there.
424 * Use the -o session=x option to mount on them.
425 */
426#define CD_PART_MAX 64
427#define CD_PART_MASK (CD_PART_MAX - 1)
428
429/*********************************************************************
430 * Generic Packet commands, MMC commands, and such
431 *********************************************************************/
432
433 /* The generic packet command opcodes for CD/DVD Logical Units,
434 * From Table 57 of the SFF8090 Ver. 3 (Mt. Fuji) draft standard. */
435#define GPCMD_BLANK 0xa1
436#define GPCMD_CLOSE_TRACK 0x5b
437#define GPCMD_FLUSH_CACHE 0x35
438#define GPCMD_FORMAT_UNIT 0x04
439#define GPCMD_GET_CONFIGURATION 0x46
440#define GPCMD_GET_EVENT_STATUS_NOTIFICATION 0x4a
441#define GPCMD_GET_PERFORMANCE 0xac
442#define GPCMD_INQUIRY 0x12
443#define GPCMD_LOAD_UNLOAD 0xa6
444#define GPCMD_MECHANISM_STATUS 0xbd
445#define GPCMD_MODE_SELECT_10 0x55
446#define GPCMD_MODE_SENSE_10 0x5a
447#define GPCMD_PAUSE_RESUME 0x4b
448#define GPCMD_PLAY_AUDIO_10 0x45
449#define GPCMD_PLAY_AUDIO_MSF 0x47
450#define GPCMD_PLAY_AUDIO_TI 0x48
451#define GPCMD_PLAY_CD 0xbc
452#define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e
453#define GPCMD_READ_10 0x28
454#define GPCMD_READ_12 0xa8
455#define GPCMD_READ_BUFFER 0x3c
456#define GPCMD_READ_BUFFER_CAPACITY 0x5c
457#define GPCMD_READ_CDVD_CAPACITY 0x25
458#define GPCMD_READ_CD 0xbe
459#define GPCMD_READ_CD_MSF 0xb9
460#define GPCMD_READ_DISC_INFO 0x51
461#define GPCMD_READ_DVD_STRUCTURE 0xad
462#define GPCMD_READ_FORMAT_CAPACITIES 0x23
463#define GPCMD_READ_HEADER 0x44
464#define GPCMD_READ_TRACK_RZONE_INFO 0x52
465#define GPCMD_READ_SUBCHANNEL 0x42
466#define GPCMD_READ_TOC_PMA_ATIP 0x43
467#define GPCMD_REPAIR_RZONE_TRACK 0x58
468#define GPCMD_REPORT_KEY 0xa4
469#define GPCMD_REQUEST_SENSE 0x03
470#define GPCMD_RESERVE_RZONE_TRACK 0x53
471#define GPCMD_SEND_CUE_SHEET 0x5d
472#define GPCMD_SCAN 0xba
473#define GPCMD_SEEK 0x2b
474#define GPCMD_SEND_DVD_STRUCTURE 0xbf
475#define GPCMD_SEND_EVENT 0xa2
476#define GPCMD_SEND_KEY 0xa3
477#define GPCMD_SEND_OPC 0x54
478#define GPCMD_SET_READ_AHEAD 0xa7
479#define GPCMD_SET_STREAMING 0xb6
480#define GPCMD_START_STOP_UNIT 0x1b
481#define GPCMD_STOP_PLAY_SCAN 0x4e
482#define GPCMD_TEST_UNIT_READY 0x00
483#define GPCMD_VERIFY_10 0x2f
484#define GPCMD_WRITE_10 0x2a
485#define GPCMD_WRITE_12 0xaa
486#define GPCMD_WRITE_AND_VERIFY_10 0x2e
487#define GPCMD_WRITE_BUFFER 0x3b
488/* This is listed as optional in ATAPI 2.6, but is (curiously)
489 * missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji
490 * Table 377 as an MMC command for SCSi devices though... Most ATAPI
491 * drives support it. */
492#define GPCMD_SET_SPEED 0xbb
493/* This seems to be a SCSI specific CD-ROM opcode
494 * to play data at track/index */
495#define GPCMD_PLAYAUDIO_TI 0x48
496/*
497 * From MS Media Status Notification Support Specification. For
498 * older drives only.
499 */
500#define GPCMD_GET_MEDIA_STATUS 0xda
501
502/* Mode page codes for mode sense/set */
503#define GPMODE_VENDOR_PAGE 0x00
504#define GPMODE_R_W_ERROR_PAGE 0x01
505#define GPMODE_WRITE_PARMS_PAGE 0x05
506#define GPMODE_WCACHING_PAGE 0x08
507#define GPMODE_AUDIO_CTL_PAGE 0x0e
508#define GPMODE_POWER_PAGE 0x1a
509#define GPMODE_FAULT_FAIL_PAGE 0x1c
510#define GPMODE_TO_PROTECT_PAGE 0x1d
511#define GPMODE_CAPABILITIES_PAGE 0x2a
512#define GPMODE_ALL_PAGES 0x3f
513/* Not in Mt. Fuji, but in ATAPI 2.6 -- deprecated now in favor
514 * of MODE_SENSE_POWER_PAGE */
515#define GPMODE_CDROM_PAGE 0x0d
516
517
518
519/* DVD struct types */
520#define DVD_STRUCT_PHYSICAL 0x00
521#define DVD_STRUCT_COPYRIGHT 0x01
522#define DVD_STRUCT_DISCKEY 0x02
523#define DVD_STRUCT_BCA 0x03
524#define DVD_STRUCT_MANUFACT 0x04
525
526struct dvd_layer {
527 __u8 book_version : 4;
528 __u8 book_type : 4;
529 __u8 min_rate : 4;
530 __u8 disc_size : 4;
531 __u8 layer_type : 4;
532 __u8 track_path : 1;
533 __u8 nlayers : 2;
534 __u8 track_density : 4;
535 __u8 linear_density : 4;
536 __u8 bca : 1;
537 __u32 start_sector;
538 __u32 end_sector;
539 __u32 end_sector_l0;
540};
541
542#define DVD_LAYERS 4
543
544struct dvd_physical {
545 __u8 type;
546 __u8 layer_num;
547 struct dvd_layer layer[DVD_LAYERS];
548};
549
550struct dvd_copyright {
551 __u8 type;
552
553 __u8 layer_num;
554 __u8 cpst;
555 __u8 rmi;
556};
557
558struct dvd_disckey {
559 __u8 type;
560
561 unsigned agid : 2;
562 __u8 value[2048];
563};
564
565struct dvd_bca {
566 __u8 type;
567
568 int len;
569 __u8 value[188];
570};
571
572struct dvd_manufact {
573 __u8 type;
574
575 __u8 layer_num;
576 int len;
577 __u8 value[2048];
578};
579
580typedef union {
581 __u8 type;
582
583 struct dvd_physical physical;
584 struct dvd_copyright copyright;
585 struct dvd_disckey disckey;
586 struct dvd_bca bca;
587 struct dvd_manufact manufact;
588} dvd_struct;
589
590/*
591 * DVD authentication ioctl
592 */
593
594/* Authentication states */
595#define DVD_LU_SEND_AGID 0
596#define DVD_HOST_SEND_CHALLENGE 1
597#define DVD_LU_SEND_KEY1 2
598#define DVD_LU_SEND_CHALLENGE 3
599#define DVD_HOST_SEND_KEY2 4
600
601/* Termination states */
602#define DVD_AUTH_ESTABLISHED 5
603#define DVD_AUTH_FAILURE 6
604
605/* Other functions */
606#define DVD_LU_SEND_TITLE_KEY 7
607#define DVD_LU_SEND_ASF 8
608#define DVD_INVALIDATE_AGID 9
609#define DVD_LU_SEND_RPC_STATE 10
610#define DVD_HOST_SEND_RPC_STATE 11
611
612/* State data */
613typedef __u8 dvd_key[5]; /* 40-bit value, MSB is first elem. */
614typedef __u8 dvd_challenge[10]; /* 80-bit value, MSB is first elem. */
615
616struct dvd_lu_send_agid {
617 __u8 type;
618 unsigned agid : 2;
619};
620
621struct dvd_host_send_challenge {
622 __u8 type;
623 unsigned agid : 2;
624
625 dvd_challenge chal;
626};
627
628struct dvd_send_key {
629 __u8 type;
630 unsigned agid : 2;
631
632 dvd_key key;
633};
634
635struct dvd_lu_send_challenge {
636 __u8 type;
637 unsigned agid : 2;
638
639 dvd_challenge chal;
640};
641
642#define DVD_CPM_NO_COPYRIGHT 0
643#define DVD_CPM_COPYRIGHTED 1
644
645#define DVD_CP_SEC_NONE 0
646#define DVD_CP_SEC_EXIST 1
647
648#define DVD_CGMS_UNRESTRICTED 0
649#define DVD_CGMS_SINGLE 2
650#define DVD_CGMS_RESTRICTED 3
651
652struct dvd_lu_send_title_key {
653 __u8 type;
654 unsigned agid : 2;
655
656 dvd_key title_key;
657 int lba;
658 unsigned cpm : 1;
659 unsigned cp_sec : 1;
660 unsigned cgms : 2;
661};
662
663struct dvd_lu_send_asf {
664 __u8 type;
665 unsigned agid : 2;
666
667 unsigned asf : 1;
668};
669
670struct dvd_host_send_rpcstate {
671 __u8 type;
672 __u8 pdrc;
673};
674
675struct dvd_lu_send_rpcstate {
676 __u8 type : 2;
677 __u8 vra : 3;
678 __u8 ucca : 3;
679 __u8 region_mask;
680 __u8 rpc_scheme;
681};
682
683typedef union {
684 __u8 type;
685
686 struct dvd_lu_send_agid lsa;
687 struct dvd_host_send_challenge hsc;
688 struct dvd_send_key lsk;
689 struct dvd_lu_send_challenge lsc;
690 struct dvd_send_key hsk;
691 struct dvd_lu_send_title_key lstk;
692 struct dvd_lu_send_asf lsasf;
693 struct dvd_host_send_rpcstate hrpcs;
694 struct dvd_lu_send_rpcstate lrpcs;
695} dvd_authinfo;
696
697struct request_sense {
698#if defined(__BIG_ENDIAN_BITFIELD)
699 __u8 valid : 1;
700 __u8 error_code : 7;
701#elif defined(__LITTLE_ENDIAN_BITFIELD)
702 __u8 error_code : 7;
703 __u8 valid : 1;
704#endif
705 __u8 segment_number;
706#if defined(__BIG_ENDIAN_BITFIELD)
707 __u8 reserved1 : 2;
708 __u8 ili : 1;
709 __u8 reserved2 : 1;
710 __u8 sense_key : 4;
711#elif defined(__LITTLE_ENDIAN_BITFIELD)
712 __u8 sense_key : 4;
713 __u8 reserved2 : 1;
714 __u8 ili : 1;
715 __u8 reserved1 : 2;
716#endif
717 __u8 information[4];
718 __u8 add_sense_len;
719 __u8 command_info[4];
720 __u8 asc;
721 __u8 ascq;
722 __u8 fruc;
723 __u8 sks[3];
724 __u8 asb[46];
725};
726
727/*
728 * feature profile
729 */
730#define CDF_RWRT 0x0020 /* "Random Writable" */
731#define CDF_HWDM 0x0024 /* "Hardware Defect Management" */
732#define CDF_MRW 0x0028
733
734/*
735 * media status bits
736 */
737#define CDM_MRW_NOTMRW 0
738#define CDM_MRW_BGFORMAT_INACTIVE 1
739#define CDM_MRW_BGFORMAT_ACTIVE 2
740#define CDM_MRW_BGFORMAT_COMPLETE 3
741
742/*
743 * mrw address spaces
744 */
745#define MRW_LBA_DMA 0
746#define MRW_LBA_GAA 1
747
748/*
749 * mrw mode pages (first is deprecated) -- probed at init time and
750 * cdi->mrw_mode_page is set
751 */
752#define MRW_MODE_PC_PRE1 0x2c
753#define MRW_MODE_PC 0x03
754
755struct mrw_feature_desc {
756 __be16 feature_code;
757#if defined(__BIG_ENDIAN_BITFIELD)
758 __u8 reserved1 : 2;
759 __u8 feature_version : 4;
760 __u8 persistent : 1;
761 __u8 curr : 1;
762#elif defined(__LITTLE_ENDIAN_BITFIELD)
763 __u8 curr : 1;
764 __u8 persistent : 1;
765 __u8 feature_version : 4;
766 __u8 reserved1 : 2;
767#endif
768 __u8 add_len;
769#if defined(__BIG_ENDIAN_BITFIELD)
770 __u8 reserved2 : 7;
771 __u8 write : 1;
772#elif defined(__LITTLE_ENDIAN_BITFIELD)
773 __u8 write : 1;
774 __u8 reserved2 : 7;
775#endif
776 __u8 reserved3;
777 __u8 reserved4;
778 __u8 reserved5;
779};
780
781/* cf. mmc4r02g.pdf 5.3.10 Random Writable Feature (0020h) pg 197 of 635 */
782struct rwrt_feature_desc {
783 __be16 feature_code;
784#if defined(__BIG_ENDIAN_BITFIELD)
785 __u8 reserved1 : 2;
786 __u8 feature_version : 4;
787 __u8 persistent : 1;
788 __u8 curr : 1;
789#elif defined(__LITTLE_ENDIAN_BITFIELD)
790 __u8 curr : 1;
791 __u8 persistent : 1;
792 __u8 feature_version : 4;
793 __u8 reserved1 : 2;
794#endif
795 __u8 add_len;
796 __u32 last_lba;
797 __u32 block_size;
798 __u16 blocking;
799#if defined(__BIG_ENDIAN_BITFIELD)
800 __u8 reserved2 : 7;
801 __u8 page_present : 1;
802#elif defined(__LITTLE_ENDIAN_BITFIELD)
803 __u8 page_present : 1;
804 __u8 reserved2 : 7;
805#endif
806 __u8 reserved3;
807};
808
809typedef struct {
810 __be16 disc_information_length;
811#if defined(__BIG_ENDIAN_BITFIELD)
812 __u8 reserved1 : 3;
813 __u8 erasable : 1;
814 __u8 border_status : 2;
815 __u8 disc_status : 2;
816#elif defined(__LITTLE_ENDIAN_BITFIELD)
817 __u8 disc_status : 2;
818 __u8 border_status : 2;
819 __u8 erasable : 1;
820 __u8 reserved1 : 3;
821#else
822#error "Please fix <asm/byteorder.h>"
823#endif
824 __u8 n_first_track;
825 __u8 n_sessions_lsb;
826 __u8 first_track_lsb;
827 __u8 last_track_lsb;
828#if defined(__BIG_ENDIAN_BITFIELD)
829 __u8 did_v : 1;
830 __u8 dbc_v : 1;
831 __u8 uru : 1;
832 __u8 reserved2 : 2;
833 __u8 dbit : 1;
834 __u8 mrw_status : 2;
835#elif defined(__LITTLE_ENDIAN_BITFIELD)
836 __u8 mrw_status : 2;
837 __u8 dbit : 1;
838 __u8 reserved2 : 2;
839 __u8 uru : 1;
840 __u8 dbc_v : 1;
841 __u8 did_v : 1;
842#endif
843 __u8 disc_type;
844 __u8 n_sessions_msb;
845 __u8 first_track_msb;
846 __u8 last_track_msb;
847 __u32 disc_id;
848 __u32 lead_in;
849 __u32 lead_out;
850 __u8 disc_bar_code[8];
851 __u8 reserved3;
852 __u8 n_opc;
853} disc_information;
854
855typedef struct {
856 __be16 track_information_length;
857 __u8 track_lsb;
858 __u8 session_lsb;
859 __u8 reserved1;
860#if defined(__BIG_ENDIAN_BITFIELD)
861 __u8 reserved2 : 2;
862 __u8 damage : 1;
863 __u8 copy : 1;
864 __u8 track_mode : 4;
865 __u8 rt : 1;
866 __u8 blank : 1;
867 __u8 packet : 1;
868 __u8 fp : 1;
869 __u8 data_mode : 4;
870 __u8 reserved3 : 6;
871 __u8 lra_v : 1;
872 __u8 nwa_v : 1;
873#elif defined(__LITTLE_ENDIAN_BITFIELD)
874 __u8 track_mode : 4;
875 __u8 copy : 1;
876 __u8 damage : 1;
877 __u8 reserved2 : 2;
878 __u8 data_mode : 4;
879 __u8 fp : 1;
880 __u8 packet : 1;
881 __u8 blank : 1;
882 __u8 rt : 1;
883 __u8 nwa_v : 1;
884 __u8 lra_v : 1;
885 __u8 reserved3 : 6;
886#endif
887 __be32 track_start;
888 __be32 next_writable;
889 __be32 free_blocks;
890 __be32 fixed_packet_size;
891 __be32 track_size;
892 __be32 last_rec_address;
893} track_information;
894
895struct feature_header {
896 __u32 data_len;
897 __u8 reserved1;
898 __u8 reserved2;
899 __u16 curr_profile;
900};
901
902struct mode_page_header {
903 __be16 mode_data_length;
904 __u8 medium_type;
905 __u8 reserved1;
906 __u8 reserved2;
907 __u8 reserved3;
908 __be16 desc_length;
909};
910
911
912#endif /* _UAPI_LINUX_CDROM_H */
diff --git a/include/linux/cgroupstats.h b/include/uapi/linux/cgroupstats.h
index 3753c33160d1..3753c33160d1 100644
--- a/include/linux/cgroupstats.h
+++ b/include/uapi/linux/cgroupstats.h
diff --git a/include/linux/chio.h b/include/uapi/linux/chio.h
index d9bac7f97282..d9bac7f97282 100644
--- a/include/linux/chio.h
+++ b/include/uapi/linux/chio.h
diff --git a/include/uapi/linux/cm4000_cs.h b/include/uapi/linux/cm4000_cs.h
new file mode 100644
index 000000000000..bc51f77db918
--- /dev/null
+++ b/include/uapi/linux/cm4000_cs.h
@@ -0,0 +1,62 @@
1#ifndef _UAPI_CM4000_H_
2#define _UAPI_CM4000_H_
3
4#include <linux/types.h>
5
6#define MAX_ATR 33
7
8#define CM4000_MAX_DEV 4
9
10/* those two structures are passed via ioctl() from/to userspace. They are
11 * used by existing userspace programs, so I kepth the awkward "bIFSD" naming
12 * not to break compilation of userspace apps. -HW */
13
14typedef struct atreq {
15 __s32 atr_len;
16 unsigned char atr[64];
17 __s32 power_act;
18 unsigned char bIFSD;
19 unsigned char bIFSC;
20} atreq_t;
21
22
23/* what is particularly stupid in the original driver is the arch-dependent
24 * member sizes. This leads to CONFIG_COMPAT breakage, since 32bit userspace
25 * will lay out the structure members differently than the 64bit kernel.
26 *
27 * I've changed "ptsreq.protocol" from "unsigned long" to "__u32".
28 * On 32bit this will make no difference. With 64bit kernels, it will make
29 * 32bit apps work, too.
30 */
31
32typedef struct ptsreq {
33 __u32 protocol; /*T=0: 2^0, T=1: 2^1*/
34 unsigned char flags;
35 unsigned char pts1;
36 unsigned char pts2;
37 unsigned char pts3;
38} ptsreq_t;
39
40#define CM_IOC_MAGIC 'c'
41#define CM_IOC_MAXNR 255
42
43#define CM_IOCGSTATUS _IOR (CM_IOC_MAGIC, 0, unsigned char *)
44#define CM_IOCGATR _IOWR(CM_IOC_MAGIC, 1, atreq_t *)
45#define CM_IOCSPTS _IOW (CM_IOC_MAGIC, 2, ptsreq_t *)
46#define CM_IOCSRDR _IO (CM_IOC_MAGIC, 3)
47#define CM_IOCARDOFF _IO (CM_IOC_MAGIC, 4)
48
49#define CM_IOSDBGLVL _IOW(CM_IOC_MAGIC, 250, int*)
50
51/* card and device states */
52#define CM_CARD_INSERTED 0x01
53#define CM_CARD_POWERED 0x02
54#define CM_ATR_PRESENT 0x04
55#define CM_ATR_VALID 0x08
56#define CM_STATE_VALID 0x0f
57/* extra info only from CM4000 */
58#define CM_NO_READER 0x10
59#define CM_BAD_CARD 0x20
60
61
62#endif /* _UAPI_CM4000_H_ */
diff --git a/include/uapi/linux/cn_proc.h b/include/uapi/linux/cn_proc.h
new file mode 100644
index 000000000000..0d7b49973bb3
--- /dev/null
+++ b/include/uapi/linux/cn_proc.h
@@ -0,0 +1,121 @@
1/*
2 * cn_proc.h - process events connector
3 *
4 * Copyright (C) Matt Helsley, IBM Corp. 2005
5 * Based on cn_fork.h by Nguyen Anh Quynh and Guillaume Thouvenin
6 * Copyright (C) 2005 Nguyen Anh Quynh <aquynh@gmail.com>
7 * Copyright (C) 2005 Guillaume Thouvenin <guillaume.thouvenin@bull.net>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of version 2.1 of the GNU Lesser General Public License
11 * as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it would be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 */
17
18#ifndef _UAPICN_PROC_H
19#define _UAPICN_PROC_H
20
21#include <linux/types.h>
22
23/*
24 * Userspace sends this enum to register with the kernel that it is listening
25 * for events on the connector.
26 */
27enum proc_cn_mcast_op {
28 PROC_CN_MCAST_LISTEN = 1,
29 PROC_CN_MCAST_IGNORE = 2
30};
31
32/*
33 * From the user's point of view, the process
34 * ID is the thread group ID and thread ID is the internal
35 * kernel "pid". So, fields are assigned as follow:
36 *
37 * In user space - In kernel space
38 *
39 * parent process ID = parent->tgid
40 * parent thread ID = parent->pid
41 * child process ID = child->tgid
42 * child thread ID = child->pid
43 */
44
45struct proc_event {
46 enum what {
47 /* Use successive bits so the enums can be used to record
48 * sets of events as well
49 */
50 PROC_EVENT_NONE = 0x00000000,
51 PROC_EVENT_FORK = 0x00000001,
52 PROC_EVENT_EXEC = 0x00000002,
53 PROC_EVENT_UID = 0x00000004,
54 PROC_EVENT_GID = 0x00000040,
55 PROC_EVENT_SID = 0x00000080,
56 PROC_EVENT_PTRACE = 0x00000100,
57 PROC_EVENT_COMM = 0x00000200,
58 /* "next" should be 0x00000400 */
59 /* "last" is the last process event: exit */
60 PROC_EVENT_EXIT = 0x80000000
61 } what;
62 __u32 cpu;
63 __u64 __attribute__((aligned(8))) timestamp_ns;
64 /* Number of nano seconds since system boot */
65 union { /* must be last field of proc_event struct */
66 struct {
67 __u32 err;
68 } ack;
69
70 struct fork_proc_event {
71 __kernel_pid_t parent_pid;
72 __kernel_pid_t parent_tgid;
73 __kernel_pid_t child_pid;
74 __kernel_pid_t child_tgid;
75 } fork;
76
77 struct exec_proc_event {
78 __kernel_pid_t process_pid;
79 __kernel_pid_t process_tgid;
80 } exec;
81
82 struct id_proc_event {
83 __kernel_pid_t process_pid;
84 __kernel_pid_t process_tgid;
85 union {
86 __u32 ruid; /* task uid */
87 __u32 rgid; /* task gid */
88 } r;
89 union {
90 __u32 euid;
91 __u32 egid;
92 } e;
93 } id;
94
95 struct sid_proc_event {
96 __kernel_pid_t process_pid;
97 __kernel_pid_t process_tgid;
98 } sid;
99
100 struct ptrace_proc_event {
101 __kernel_pid_t process_pid;
102 __kernel_pid_t process_tgid;
103 __kernel_pid_t tracer_pid;
104 __kernel_pid_t tracer_tgid;
105 } ptrace;
106
107 struct comm_proc_event {
108 __kernel_pid_t process_pid;
109 __kernel_pid_t process_tgid;
110 char comm[16];
111 } comm;
112
113 struct exit_proc_event {
114 __kernel_pid_t process_pid;
115 __kernel_pid_t process_tgid;
116 __u32 exit_code, exit_signal;
117 } exit;
118 } event_data;
119};
120
121#endif /* _UAPICN_PROC_H */
diff --git a/include/uapi/linux/coda.h b/include/uapi/linux/coda.h
new file mode 100644
index 000000000000..695fade33c64
--- /dev/null
+++ b/include/uapi/linux/coda.h
@@ -0,0 +1,741 @@
1/*
2 You may distribute this file under either of the two licenses that
3 follow at your discretion.
4*/
5
6/* BLURB lgpl
7
8 Coda File System
9 Release 5
10
11 Copyright (c) 1987-1999 Carnegie Mellon University
12 Additional copyrights listed below
13
14This code is distributed "AS IS" without warranty of any kind under
15the terms of the GNU Library General Public Licence Version 2, as
16shown in the file LICENSE, or under the license shown below. The
17technical and financial contributors to Coda are listed in the file
18CREDITS.
19
20 Additional copyrights
21*/
22
23/*
24
25 Coda: an Experimental Distributed File System
26 Release 4.0
27
28 Copyright (c) 1987-1999 Carnegie Mellon University
29 All Rights Reserved
30
31Permission to use, copy, modify and distribute this software and its
32documentation is hereby granted, provided that both the copyright
33notice and this permission notice appear in all copies of the
34software, derivative works or modified versions, and any portions
35thereof, and that both notices appear in supporting documentation, and
36that credit is given to Carnegie Mellon University in all documents
37and publicity pertaining to direct or indirect use of this code or its
38derivatives.
39
40CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
41SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS
42FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON
43DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER
44RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
45ANY DERIVATIVE WORK.
46
47Carnegie Mellon encourages users of this software to return any
48improvements or extensions that they make, and to grant Carnegie
49Mellon the rights to redistribute these changes without encumbrance.
50*/
51
52/*
53 *
54 * Based on cfs.h from Mach, but revamped for increased simplicity.
55 * Linux modifications by
56 * Peter Braam, Aug 1996
57 */
58
59#ifndef _UAPI_CODA_HEADER_
60#define _UAPI_CODA_HEADER_
61
62
63/* Catch new _KERNEL defn for NetBSD and DJGPP/__CYGWIN32__ */
64#if defined(__NetBSD__) || \
65 ((defined(DJGPP) || defined(__CYGWIN32__)) && !defined(KERNEL))
66#include <sys/types.h>
67#endif
68
69#ifndef CODA_MAXSYMLINKS
70#define CODA_MAXSYMLINKS 10
71#endif
72
73#if defined(DJGPP) || defined(__CYGWIN32__)
74#ifdef KERNEL
75typedef unsigned long u_long;
76typedef unsigned int u_int;
77typedef unsigned short u_short;
78typedef u_long ino_t;
79typedef u_long dev_t;
80typedef void * caddr_t;
81#ifdef DOS
82typedef unsigned __int64 u_quad_t;
83#else
84typedef unsigned long long u_quad_t;
85#endif
86
87#define inline
88
89struct timespec {
90 long ts_sec;
91 long ts_nsec;
92};
93#else /* DJGPP but not KERNEL */
94#include <sys/time.h>
95typedef unsigned long long u_quad_t;
96#endif /* !KERNEL */
97#endif /* !DJGPP */
98
99
100#if defined(__linux__)
101#include <linux/time.h>
102#define cdev_t u_quad_t
103#ifndef __KERNEL__
104#if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2)
105#define _UQUAD_T_ 1
106typedef unsigned long long u_quad_t;
107#endif
108#endif /* __KERNEL__ */
109#else
110#define cdev_t dev_t
111#endif
112
113#ifdef __CYGWIN32__
114struct timespec {
115 time_t tv_sec; /* seconds */
116 long tv_nsec; /* nanoseconds */
117};
118#endif
119
120#ifndef __BIT_TYPES_DEFINED__
121#define __BIT_TYPES_DEFINED__
122typedef signed char int8_t;
123typedef unsigned char u_int8_t;
124typedef short int16_t;
125typedef unsigned short u_int16_t;
126typedef int int32_t;
127typedef unsigned int u_int32_t;
128#endif
129
130
131/*
132 * Cfs constants
133 */
134#define CODA_MAXNAMLEN 255
135#define CODA_MAXPATHLEN 1024
136#define CODA_MAXSYMLINK 10
137
138/* these are Coda's version of O_RDONLY etc combinations
139 * to deal with VFS open modes
140 */
141#define C_O_READ 0x001
142#define C_O_WRITE 0x002
143#define C_O_TRUNC 0x010
144#define C_O_EXCL 0x100
145#define C_O_CREAT 0x200
146
147/* these are to find mode bits in Venus */
148#define C_M_READ 00400
149#define C_M_WRITE 00200
150
151/* for access Venus will use */
152#define C_A_C_OK 8 /* Test for writing upon create. */
153#define C_A_R_OK 4 /* Test for read permission. */
154#define C_A_W_OK 2 /* Test for write permission. */
155#define C_A_X_OK 1 /* Test for execute permission. */
156#define C_A_F_OK 0 /* Test for existence. */
157
158
159
160#ifndef _VENUS_DIRENT_T_
161#define _VENUS_DIRENT_T_ 1
162struct venus_dirent {
163 u_int32_t d_fileno; /* file number of entry */
164 u_int16_t d_reclen; /* length of this record */
165 u_int8_t d_type; /* file type, see below */
166 u_int8_t d_namlen; /* length of string in d_name */
167 char d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */
168};
169#undef DIRSIZ
170#define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \
171 (((dp)->d_namlen+1 + 3) &~ 3))
172
173/*
174 * File types
175 */
176#define CDT_UNKNOWN 0
177#define CDT_FIFO 1
178#define CDT_CHR 2
179#define CDT_DIR 4
180#define CDT_BLK 6
181#define CDT_REG 8
182#define CDT_LNK 10
183#define CDT_SOCK 12
184#define CDT_WHT 14
185
186/*
187 * Convert between stat structure types and directory types.
188 */
189#define IFTOCDT(mode) (((mode) & 0170000) >> 12)
190#define CDTTOIF(dirtype) ((dirtype) << 12)
191
192#endif
193
194#ifndef _VUID_T_
195#define _VUID_T_
196typedef u_int32_t vuid_t;
197typedef u_int32_t vgid_t;
198#endif /*_VUID_T_ */
199
200struct CodaFid {
201 u_int32_t opaque[4];
202};
203
204#define coda_f2i(fid)\
205 (fid ? (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]) : 0)
206
207#ifndef _VENUS_VATTR_T_
208#define _VENUS_VATTR_T_
209/*
210 * Vnode types. VNON means no type.
211 */
212enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD };
213
214struct coda_vattr {
215 long va_type; /* vnode type (for create) */
216 u_short va_mode; /* files access mode and type */
217 short va_nlink; /* number of references to file */
218 vuid_t va_uid; /* owner user id */
219 vgid_t va_gid; /* owner group id */
220 long va_fileid; /* file id */
221 u_quad_t va_size; /* file size in bytes */
222 long va_blocksize; /* blocksize preferred for i/o */
223 struct timespec va_atime; /* time of last access */
224 struct timespec va_mtime; /* time of last modification */
225 struct timespec va_ctime; /* time file changed */
226 u_long va_gen; /* generation number of file */
227 u_long va_flags; /* flags defined for file */
228 cdev_t va_rdev; /* device special file represents */
229 u_quad_t va_bytes; /* bytes of disk space held by file */
230 u_quad_t va_filerev; /* file modification number */
231};
232
233#endif
234
235/* structure used by CODA_STATFS for getting cache information from venus */
236struct coda_statfs {
237 int32_t f_blocks;
238 int32_t f_bfree;
239 int32_t f_bavail;
240 int32_t f_files;
241 int32_t f_ffree;
242};
243
244/*
245 * Kernel <--> Venus communications.
246 */
247
248#define CODA_ROOT 2
249#define CODA_OPEN_BY_FD 3
250#define CODA_OPEN 4
251#define CODA_CLOSE 5
252#define CODA_IOCTL 6
253#define CODA_GETATTR 7
254#define CODA_SETATTR 8
255#define CODA_ACCESS 9
256#define CODA_LOOKUP 10
257#define CODA_CREATE 11
258#define CODA_REMOVE 12
259#define CODA_LINK 13
260#define CODA_RENAME 14
261#define CODA_MKDIR 15
262#define CODA_RMDIR 16
263#define CODA_SYMLINK 18
264#define CODA_READLINK 19
265#define CODA_FSYNC 20
266#define CODA_VGET 22
267#define CODA_SIGNAL 23
268#define CODA_REPLACE 24 /* DOWNCALL */
269#define CODA_FLUSH 25 /* DOWNCALL */
270#define CODA_PURGEUSER 26 /* DOWNCALL */
271#define CODA_ZAPFILE 27 /* DOWNCALL */
272#define CODA_ZAPDIR 28 /* DOWNCALL */
273#define CODA_PURGEFID 30 /* DOWNCALL */
274#define CODA_OPEN_BY_PATH 31
275#define CODA_RESOLVE 32
276#define CODA_REINTEGRATE 33
277#define CODA_STATFS 34
278#define CODA_STORE 35
279#define CODA_RELEASE 36
280#define CODA_NCALLS 37
281
282#define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID)
283
284#define VC_MAXDATASIZE 8192
285#define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\
286 VC_MAXDATASIZE
287
288#define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t)
289
290#define CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */
291
292/*
293 * Venus <-> Coda RPC arguments
294 */
295struct coda_in_hdr {
296 u_int32_t opcode;
297 u_int32_t unique; /* Keep multiple outstanding msgs distinct */
298 pid_t pid;
299 pid_t pgid;
300 vuid_t uid;
301};
302
303/* Really important that opcode and unique are 1st two fields! */
304struct coda_out_hdr {
305 u_int32_t opcode;
306 u_int32_t unique;
307 u_int32_t result;
308};
309
310/* coda_root: NO_IN */
311struct coda_root_out {
312 struct coda_out_hdr oh;
313 struct CodaFid VFid;
314};
315
316struct coda_root_in {
317 struct coda_in_hdr in;
318};
319
320/* coda_open: */
321struct coda_open_in {
322 struct coda_in_hdr ih;
323 struct CodaFid VFid;
324 int flags;
325};
326
327struct coda_open_out {
328 struct coda_out_hdr oh;
329 cdev_t dev;
330 ino_t inode;
331};
332
333
334/* coda_store: */
335struct coda_store_in {
336 struct coda_in_hdr ih;
337 struct CodaFid VFid;
338 int flags;
339};
340
341struct coda_store_out {
342 struct coda_out_hdr out;
343};
344
345/* coda_release: */
346struct coda_release_in {
347 struct coda_in_hdr ih;
348 struct CodaFid VFid;
349 int flags;
350};
351
352struct coda_release_out {
353 struct coda_out_hdr out;
354};
355
356/* coda_close: */
357struct coda_close_in {
358 struct coda_in_hdr ih;
359 struct CodaFid VFid;
360 int flags;
361};
362
363struct coda_close_out {
364 struct coda_out_hdr out;
365};
366
367/* coda_ioctl: */
368struct coda_ioctl_in {
369 struct coda_in_hdr ih;
370 struct CodaFid VFid;
371 int cmd;
372 int len;
373 int rwflag;
374 char *data; /* Place holder for data. */
375};
376
377struct coda_ioctl_out {
378 struct coda_out_hdr oh;
379 int len;
380 caddr_t data; /* Place holder for data. */
381};
382
383
384/* coda_getattr: */
385struct coda_getattr_in {
386 struct coda_in_hdr ih;
387 struct CodaFid VFid;
388};
389
390struct coda_getattr_out {
391 struct coda_out_hdr oh;
392 struct coda_vattr attr;
393};
394
395
396/* coda_setattr: NO_OUT */
397struct coda_setattr_in {
398 struct coda_in_hdr ih;
399 struct CodaFid VFid;
400 struct coda_vattr attr;
401};
402
403struct coda_setattr_out {
404 struct coda_out_hdr out;
405};
406
407/* coda_access: NO_OUT */
408struct coda_access_in {
409 struct coda_in_hdr ih;
410 struct CodaFid VFid;
411 int flags;
412};
413
414struct coda_access_out {
415 struct coda_out_hdr out;
416};
417
418
419/* lookup flags */
420#define CLU_CASE_SENSITIVE 0x01
421#define CLU_CASE_INSENSITIVE 0x02
422
423/* coda_lookup: */
424struct coda_lookup_in {
425 struct coda_in_hdr ih;
426 struct CodaFid VFid;
427 int name; /* Place holder for data. */
428 int flags;
429};
430
431struct coda_lookup_out {
432 struct coda_out_hdr oh;
433 struct CodaFid VFid;
434 int vtype;
435};
436
437
438/* coda_create: */
439struct coda_create_in {
440 struct coda_in_hdr ih;
441 struct CodaFid VFid;
442 struct coda_vattr attr;
443 int excl;
444 int mode;
445 int name; /* Place holder for data. */
446};
447
448struct coda_create_out {
449 struct coda_out_hdr oh;
450 struct CodaFid VFid;
451 struct coda_vattr attr;
452};
453
454
455/* coda_remove: NO_OUT */
456struct coda_remove_in {
457 struct coda_in_hdr ih;
458 struct CodaFid VFid;
459 int name; /* Place holder for data. */
460};
461
462struct coda_remove_out {
463 struct coda_out_hdr out;
464};
465
466/* coda_link: NO_OUT */
467struct coda_link_in {
468 struct coda_in_hdr ih;
469 struct CodaFid sourceFid; /* cnode to link *to* */
470 struct CodaFid destFid; /* Directory in which to place link */
471 int tname; /* Place holder for data. */
472};
473
474struct coda_link_out {
475 struct coda_out_hdr out;
476};
477
478
479/* coda_rename: NO_OUT */
480struct coda_rename_in {
481 struct coda_in_hdr ih;
482 struct CodaFid sourceFid;
483 int srcname;
484 struct CodaFid destFid;
485 int destname;
486};
487
488struct coda_rename_out {
489 struct coda_out_hdr out;
490};
491
492/* coda_mkdir: */
493struct coda_mkdir_in {
494 struct coda_in_hdr ih;
495 struct CodaFid VFid;
496 struct coda_vattr attr;
497 int name; /* Place holder for data. */
498};
499
500struct coda_mkdir_out {
501 struct coda_out_hdr oh;
502 struct CodaFid VFid;
503 struct coda_vattr attr;
504};
505
506
507/* coda_rmdir: NO_OUT */
508struct coda_rmdir_in {
509 struct coda_in_hdr ih;
510 struct CodaFid VFid;
511 int name; /* Place holder for data. */
512};
513
514struct coda_rmdir_out {
515 struct coda_out_hdr out;
516};
517
518/* coda_symlink: NO_OUT */
519struct coda_symlink_in {
520 struct coda_in_hdr ih;
521 struct CodaFid VFid; /* Directory to put symlink in */
522 int srcname;
523 struct coda_vattr attr;
524 int tname;
525};
526
527struct coda_symlink_out {
528 struct coda_out_hdr out;
529};
530
531/* coda_readlink: */
532struct coda_readlink_in {
533 struct coda_in_hdr ih;
534 struct CodaFid VFid;
535};
536
537struct coda_readlink_out {
538 struct coda_out_hdr oh;
539 int count;
540 caddr_t data; /* Place holder for data. */
541};
542
543
544/* coda_fsync: NO_OUT */
545struct coda_fsync_in {
546 struct coda_in_hdr ih;
547 struct CodaFid VFid;
548};
549
550struct coda_fsync_out {
551 struct coda_out_hdr out;
552};
553
554/* coda_vget: */
555struct coda_vget_in {
556 struct coda_in_hdr ih;
557 struct CodaFid VFid;
558};
559
560struct coda_vget_out {
561 struct coda_out_hdr oh;
562 struct CodaFid VFid;
563 int vtype;
564};
565
566
567/* CODA_SIGNAL is out-of-band, doesn't need data. */
568/* CODA_INVALIDATE is a venus->kernel call */
569/* CODA_FLUSH is a venus->kernel call */
570
571/* coda_purgeuser: */
572/* CODA_PURGEUSER is a venus->kernel call */
573struct coda_purgeuser_out {
574 struct coda_out_hdr oh;
575 vuid_t uid;
576};
577
578/* coda_zapfile: */
579/* CODA_ZAPFILE is a venus->kernel call */
580struct coda_zapfile_out {
581 struct coda_out_hdr oh;
582 struct CodaFid CodaFid;
583};
584
585/* coda_zapdir: */
586/* CODA_ZAPDIR is a venus->kernel call */
587struct coda_zapdir_out {
588 struct coda_out_hdr oh;
589 struct CodaFid CodaFid;
590};
591
592/* coda_purgefid: */
593/* CODA_PURGEFID is a venus->kernel call */
594struct coda_purgefid_out {
595 struct coda_out_hdr oh;
596 struct CodaFid CodaFid;
597};
598
599/* coda_replace: */
600/* CODA_REPLACE is a venus->kernel call */
601struct coda_replace_out { /* coda_replace is a venus->kernel call */
602 struct coda_out_hdr oh;
603 struct CodaFid NewFid;
604 struct CodaFid OldFid;
605};
606
607/* coda_open_by_fd: */
608struct coda_open_by_fd_in {
609 struct coda_in_hdr ih;
610 struct CodaFid VFid;
611 int flags;
612};
613
614struct coda_open_by_fd_out {
615 struct coda_out_hdr oh;
616 int fd;
617
618#ifdef __KERNEL__
619 struct file *fh; /* not passed from userspace but used in-kernel only */
620#endif
621};
622
623/* coda_open_by_path: */
624struct coda_open_by_path_in {
625 struct coda_in_hdr ih;
626 struct CodaFid VFid;
627 int flags;
628};
629
630struct coda_open_by_path_out {
631 struct coda_out_hdr oh;
632 int path;
633};
634
635/* coda_statfs: NO_IN */
636struct coda_statfs_in {
637 struct coda_in_hdr in;
638};
639
640struct coda_statfs_out {
641 struct coda_out_hdr oh;
642 struct coda_statfs stat;
643};
644
645/*
646 * Occasionally, we don't cache the fid returned by CODA_LOOKUP.
647 * For instance, if the fid is inconsistent.
648 * This case is handled by setting the top bit of the type result parameter.
649 */
650#define CODA_NOCACHE 0x80000000
651
652union inputArgs {
653 struct coda_in_hdr ih; /* NB: every struct below begins with an ih */
654 struct coda_open_in coda_open;
655 struct coda_store_in coda_store;
656 struct coda_release_in coda_release;
657 struct coda_close_in coda_close;
658 struct coda_ioctl_in coda_ioctl;
659 struct coda_getattr_in coda_getattr;
660 struct coda_setattr_in coda_setattr;
661 struct coda_access_in coda_access;
662 struct coda_lookup_in coda_lookup;
663 struct coda_create_in coda_create;
664 struct coda_remove_in coda_remove;
665 struct coda_link_in coda_link;
666 struct coda_rename_in coda_rename;
667 struct coda_mkdir_in coda_mkdir;
668 struct coda_rmdir_in coda_rmdir;
669 struct coda_symlink_in coda_symlink;
670 struct coda_readlink_in coda_readlink;
671 struct coda_fsync_in coda_fsync;
672 struct coda_vget_in coda_vget;
673 struct coda_open_by_fd_in coda_open_by_fd;
674 struct coda_open_by_path_in coda_open_by_path;
675 struct coda_statfs_in coda_statfs;
676};
677
678union outputArgs {
679 struct coda_out_hdr oh; /* NB: every struct below begins with an oh */
680 struct coda_root_out coda_root;
681 struct coda_open_out coda_open;
682 struct coda_ioctl_out coda_ioctl;
683 struct coda_getattr_out coda_getattr;
684 struct coda_lookup_out coda_lookup;
685 struct coda_create_out coda_create;
686 struct coda_mkdir_out coda_mkdir;
687 struct coda_readlink_out coda_readlink;
688 struct coda_vget_out coda_vget;
689 struct coda_purgeuser_out coda_purgeuser;
690 struct coda_zapfile_out coda_zapfile;
691 struct coda_zapdir_out coda_zapdir;
692 struct coda_purgefid_out coda_purgefid;
693 struct coda_replace_out coda_replace;
694 struct coda_open_by_fd_out coda_open_by_fd;
695 struct coda_open_by_path_out coda_open_by_path;
696 struct coda_statfs_out coda_statfs;
697};
698
699union coda_downcalls {
700 /* CODA_INVALIDATE is a venus->kernel call */
701 /* CODA_FLUSH is a venus->kernel call */
702 struct coda_purgeuser_out purgeuser;
703 struct coda_zapfile_out zapfile;
704 struct coda_zapdir_out zapdir;
705 struct coda_purgefid_out purgefid;
706 struct coda_replace_out replace;
707};
708
709
710/*
711 * Used for identifying usage of "Control" and pioctls
712 */
713
714#define PIOCPARM_MASK 0x0000ffff
715struct ViceIoctl {
716 void __user *in; /* Data to be transferred in */
717 void __user *out; /* Data to be transferred out */
718 u_short in_size; /* Size of input buffer <= 2K */
719 u_short out_size; /* Maximum size of output buffer, <= 2K */
720};
721
722struct PioctlData {
723 const char __user *path;
724 int follow;
725 struct ViceIoctl vi;
726};
727
728#define CODA_CONTROL ".CONTROL"
729#define CODA_CONTROLLEN 8
730#define CTL_INO -1
731
732/* Data passed to mount */
733
734#define CODA_MOUNT_VERSION 1
735
736struct coda_mount_data {
737 int version;
738 int fd; /* Opened device */
739};
740
741#endif /* _UAPI_CODA_HEADER_ */
diff --git a/include/uapi/linux/coda_psdev.h b/include/uapi/linux/coda_psdev.h
new file mode 100644
index 000000000000..79d05981fc4b
--- /dev/null
+++ b/include/uapi/linux/coda_psdev.h
@@ -0,0 +1,27 @@
1#ifndef _UAPI__CODA_PSDEV_H
2#define _UAPI__CODA_PSDEV_H
3
4#include <linux/magic.h>
5
6#define CODA_PSDEV_MAJOR 67
7#define MAX_CODADEVS 5 /* how many do we allow */
8
9
10/* messages between coda filesystem in kernel and Venus */
11struct upc_req {
12 struct list_head uc_chain;
13 caddr_t uc_data;
14 u_short uc_flags;
15 u_short uc_inSize; /* Size is at most 5000 bytes */
16 u_short uc_outSize;
17 u_short uc_opcode; /* copied from data to save lookup */
18 int uc_unique;
19 wait_queue_head_t uc_sleep; /* process' wait queue */
20};
21
22#define CODA_REQ_ASYNC 0x1
23#define CODA_REQ_READ 0x2
24#define CODA_REQ_WRITE 0x4
25#define CODA_REQ_ABORT 0x8
26
27#endif /* _UAPI__CODA_PSDEV_H */
diff --git a/include/linux/coff.h b/include/uapi/linux/coff.h
index 6354a7fe22b2..6354a7fe22b2 100644
--- a/include/linux/coff.h
+++ b/include/uapi/linux/coff.h
diff --git a/include/uapi/linux/connector.h b/include/uapi/linux/connector.h
new file mode 100644
index 000000000000..8761a0349c74
--- /dev/null
+++ b/include/uapi/linux/connector.h
@@ -0,0 +1,77 @@
1/*
2 * connector.h
3 *
4 * 2004-2005 Copyright (c) Evgeniy Polyakov <zbr@ioremap.net>
5 * All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef _UAPI__CONNECTOR_H
23#define _UAPI__CONNECTOR_H
24
25#include <linux/types.h>
26
27/*
28 * Process Events connector unique ids -- used for message routing
29 */
30#define CN_IDX_PROC 0x1
31#define CN_VAL_PROC 0x1
32#define CN_IDX_CIFS 0x2
33#define CN_VAL_CIFS 0x1
34#define CN_W1_IDX 0x3 /* w1 communication */
35#define CN_W1_VAL 0x1
36#define CN_IDX_V86D 0x4
37#define CN_VAL_V86D_UVESAFB 0x1
38#define CN_IDX_BB 0x5 /* BlackBoard, from the TSP GPL sampling framework */
39#define CN_DST_IDX 0x6
40#define CN_DST_VAL 0x1
41#define CN_IDX_DM 0x7 /* Device Mapper */
42#define CN_VAL_DM_USERSPACE_LOG 0x1
43#define CN_IDX_DRBD 0x8
44#define CN_VAL_DRBD 0x1
45#define CN_KVP_IDX 0x9 /* HyperV KVP */
46#define CN_KVP_VAL 0x1 /* queries from the kernel */
47
48#define CN_NETLINK_USERS 10 /* Highest index + 1 */
49
50/*
51 * Maximum connector's message size.
52 */
53#define CONNECTOR_MAX_MSG_SIZE 16384
54
55/*
56 * idx and val are unique identifiers which
57 * are used for message routing and
58 * must be registered in connector.h for in-kernel usage.
59 */
60
61struct cb_id {
62 __u32 idx;
63 __u32 val;
64};
65
66struct cn_msg {
67 struct cb_id id;
68
69 __u32 seq;
70 __u32 ack;
71
72 __u16 len; /* Length of the following data */
73 __u16 flags;
74 __u8 data[0];
75};
76
77#endif /* _UAPI__CONNECTOR_H */
diff --git a/include/linux/const.h b/include/uapi/linux/const.h
index c22c707c455d..c22c707c455d 100644
--- a/include/linux/const.h
+++ b/include/uapi/linux/const.h
diff --git a/include/uapi/linux/cramfs_fs.h b/include/uapi/linux/cramfs_fs.h
new file mode 100644
index 000000000000..e4611a9b9243
--- /dev/null
+++ b/include/uapi/linux/cramfs_fs.h
@@ -0,0 +1,88 @@
1#ifndef _UAPI__CRAMFS_H
2#define _UAPI__CRAMFS_H
3
4#include <linux/types.h>
5#include <linux/magic.h>
6
7#define CRAMFS_SIGNATURE "Compressed ROMFS"
8
9/*
10 * Width of various bitfields in struct cramfs_inode.
11 * Primarily used to generate warnings in mkcramfs.
12 */
13#define CRAMFS_MODE_WIDTH 16
14#define CRAMFS_UID_WIDTH 16
15#define CRAMFS_SIZE_WIDTH 24
16#define CRAMFS_GID_WIDTH 8
17#define CRAMFS_NAMELEN_WIDTH 6
18#define CRAMFS_OFFSET_WIDTH 26
19
20/*
21 * Since inode.namelen is a unsigned 6-bit number, the maximum cramfs
22 * path length is 63 << 2 = 252.
23 */
24#define CRAMFS_MAXPATHLEN (((1 << CRAMFS_NAMELEN_WIDTH) - 1) << 2)
25
26/*
27 * Reasonably terse representation of the inode data.
28 */
29struct cramfs_inode {
30 __u32 mode:CRAMFS_MODE_WIDTH, uid:CRAMFS_UID_WIDTH;
31 /* SIZE for device files is i_rdev */
32 __u32 size:CRAMFS_SIZE_WIDTH, gid:CRAMFS_GID_WIDTH;
33 /* NAMELEN is the length of the file name, divided by 4 and
34 rounded up. (cramfs doesn't support hard links.) */
35 /* OFFSET: For symlinks and non-empty regular files, this
36 contains the offset (divided by 4) of the file data in
37 compressed form (starting with an array of block pointers;
38 see README). For non-empty directories it is the offset
39 (divided by 4) of the inode of the first file in that
40 directory. For anything else, offset is zero. */
41 __u32 namelen:CRAMFS_NAMELEN_WIDTH, offset:CRAMFS_OFFSET_WIDTH;
42};
43
44struct cramfs_info {
45 __u32 crc;
46 __u32 edition;
47 __u32 blocks;
48 __u32 files;
49};
50
51/*
52 * Superblock information at the beginning of the FS.
53 */
54struct cramfs_super {
55 __u32 magic; /* 0x28cd3d45 - random number */
56 __u32 size; /* length in bytes */
57 __u32 flags; /* feature flags */
58 __u32 future; /* reserved for future use */
59 __u8 signature[16]; /* "Compressed ROMFS" */
60 struct cramfs_info fsid; /* unique filesystem info */
61 __u8 name[16]; /* user-defined name */
62 struct cramfs_inode root; /* root inode data */
63};
64
65/*
66 * Feature flags
67 *
68 * 0x00000000 - 0x000000ff: features that work for all past kernels
69 * 0x00000100 - 0xffffffff: features that don't work for past kernels
70 */
71#define CRAMFS_FLAG_FSID_VERSION_2 0x00000001 /* fsid version #2 */
72#define CRAMFS_FLAG_SORTED_DIRS 0x00000002 /* sorted dirs */
73#define CRAMFS_FLAG_HOLES 0x00000100 /* support for holes */
74#define CRAMFS_FLAG_WRONG_SIGNATURE 0x00000200 /* reserved */
75#define CRAMFS_FLAG_SHIFTED_ROOT_OFFSET 0x00000400 /* shifted root fs */
76
77/*
78 * Valid values in super.flags. Currently we refuse to mount
79 * if (flags & ~CRAMFS_SUPPORTED_FLAGS). Maybe that should be
80 * changed to test super.future instead.
81 */
82#define CRAMFS_SUPPORTED_FLAGS ( 0x000000ff \
83 | CRAMFS_FLAG_HOLES \
84 | CRAMFS_FLAG_WRONG_SIGNATURE \
85 | CRAMFS_FLAG_SHIFTED_ROOT_OFFSET )
86
87
88#endif /* _UAPI__CRAMFS_H */
diff --git a/include/uapi/linux/cuda.h b/include/uapi/linux/cuda.h
new file mode 100644
index 000000000000..286f9f10fce8
--- /dev/null
+++ b/include/uapi/linux/cuda.h
@@ -0,0 +1,33 @@
1/*
2 * Definitions for talking to the CUDA. The CUDA is a microcontroller
3 * which controls the ADB, system power, RTC, and various other things.
4 *
5 * Copyright (C) 1996 Paul Mackerras.
6 */
7
8#ifndef _UAPI_LINUX_CUDA_H
9#define _UAPI_LINUX_CUDA_H
10
11/* CUDA commands (2nd byte) */
12#define CUDA_WARM_START 0
13#define CUDA_AUTOPOLL 1
14#define CUDA_GET_6805_ADDR 2
15#define CUDA_GET_TIME 3
16#define CUDA_GET_PRAM 7
17#define CUDA_SET_6805_ADDR 8
18#define CUDA_SET_TIME 9
19#define CUDA_POWERDOWN 0xa
20#define CUDA_POWERUP_TIME 0xb
21#define CUDA_SET_PRAM 0xc
22#define CUDA_MS_RESET 0xd
23#define CUDA_SEND_DFAC 0xe
24#define CUDA_RESET_SYSTEM 0x11
25#define CUDA_SET_IPL 0x12
26#define CUDA_SET_AUTO_RATE 0x14
27#define CUDA_GET_AUTO_RATE 0x16
28#define CUDA_SET_DEVICE_LIST 0x19
29#define CUDA_GET_DEVICE_LIST 0x1a
30#define CUDA_GET_SET_IIC 0x22
31
32
33#endif /* _UAPI_LINUX_CUDA_H */
diff --git a/include/uapi/linux/cyclades.h b/include/uapi/linux/cyclades.h
new file mode 100644
index 000000000000..12b587aa361c
--- /dev/null
+++ b/include/uapi/linux/cyclades.h
@@ -0,0 +1,493 @@
1/* $Revision: 3.0 $$Date: 1998/11/02 14:20:59 $
2 * linux/include/linux/cyclades.h
3 *
4 * This file was initially written by
5 * Randolph Bentson <bentson@grieg.seaslug.org> and is maintained by
6 * Ivan Passos <ivan@cyclades.com>.
7 *
8 * This file contains the general definitions for the cyclades.c driver
9 *$Log: cyclades.h,v $
10 *Revision 3.1 2002/01/29 11:36:16 henrique
11 *added throttle field on struct cyclades_port to indicate whether the
12 *port is throttled or not
13 *
14 *Revision 3.1 2000/04/19 18:52:52 ivan
15 *converted address fields to unsigned long and added fields for physical
16 *addresses on cyclades_card structure;
17 *
18 *Revision 3.0 1998/11/02 14:20:59 ivan
19 *added nports field on cyclades_card structure;
20 *
21 *Revision 2.5 1998/08/03 16:57:01 ivan
22 *added cyclades_idle_stats structure;
23 *
24 *Revision 2.4 1998/06/01 12:09:53 ivan
25 *removed closing_wait2 from cyclades_port structure;
26 *
27 *Revision 2.3 1998/03/16 18:01:12 ivan
28 *changes in the cyclades_port structure to get it closer to the
29 *standard serial port structure;
30 *added constants for new ioctls;
31 *
32 *Revision 2.2 1998/02/17 16:50:00 ivan
33 *changes in the cyclades_port structure (addition of shutdown_wait and
34 *chip_rev variables);
35 *added constants for new ioctls and for CD1400 rev. numbers.
36 *
37 *Revision 2.1 1997/10/24 16:03:00 ivan
38 *added rflow (which allows enabling the CD1400 special flow control
39 *feature) and rtsdtr_inv (which allows DTR/RTS pin inversion) to
40 *cyclades_port structure;
41 *added Alpha support
42 *
43 *Revision 2.0 1997/06/30 10:30:00 ivan
44 *added some new doorbell command constants related to IOCTLW and
45 *UART error signaling
46 *
47 *Revision 1.8 1997/06/03 15:30:00 ivan
48 *added constant ZFIRM_HLT
49 *added constant CyPCI_Ze_win ( = 2 * Cy_PCI_Zwin)
50 *
51 *Revision 1.7 1997/03/26 10:30:00 daniel
52 *new entries at the end of cyclades_port struct to reallocate
53 *variables illegally allocated within card memory.
54 *
55 *Revision 1.6 1996/09/09 18:35:30 bentson
56 *fold in changes for Cyclom-Z -- including structures for
57 *communicating with board as well modest changes to original
58 *structures to support new features.
59 *
60 *Revision 1.5 1995/11/13 21:13:31 bentson
61 *changes suggested by Michael Chastain <mec@duracef.shout.net>
62 *to support use of this file in non-kernel applications
63 *
64 *
65 */
66
67#ifndef _UAPI_LINUX_CYCLADES_H
68#define _UAPI_LINUX_CYCLADES_H
69
70#include <linux/types.h>
71
72struct cyclades_monitor {
73 unsigned long int_count;
74 unsigned long char_count;
75 unsigned long char_max;
76 unsigned long char_last;
77};
78
79/*
80 * These stats all reflect activity since the device was last initialized.
81 * (i.e., since the port was opened with no other processes already having it
82 * open)
83 */
84struct cyclades_idle_stats {
85 __kernel_time_t in_use; /* Time device has been in use (secs) */
86 __kernel_time_t recv_idle; /* Time since last char received (secs) */
87 __kernel_time_t xmit_idle; /* Time since last char transmitted (secs) */
88 unsigned long recv_bytes; /* Bytes received */
89 unsigned long xmit_bytes; /* Bytes transmitted */
90 unsigned long overruns; /* Input overruns */
91 unsigned long frame_errs; /* Input framing errors */
92 unsigned long parity_errs; /* Input parity errors */
93};
94
95#define CYCLADES_MAGIC 0x4359
96
97#define CYGETMON 0x435901
98#define CYGETTHRESH 0x435902
99#define CYSETTHRESH 0x435903
100#define CYGETDEFTHRESH 0x435904
101#define CYSETDEFTHRESH 0x435905
102#define CYGETTIMEOUT 0x435906
103#define CYSETTIMEOUT 0x435907
104#define CYGETDEFTIMEOUT 0x435908
105#define CYSETDEFTIMEOUT 0x435909
106#define CYSETRFLOW 0x43590a
107#define CYGETRFLOW 0x43590b
108#define CYSETRTSDTR_INV 0x43590c
109#define CYGETRTSDTR_INV 0x43590d
110#define CYZSETPOLLCYCLE 0x43590e
111#define CYZGETPOLLCYCLE 0x43590f
112#define CYGETCD1400VER 0x435910
113#define CYSETWAIT 0x435912
114#define CYGETWAIT 0x435913
115
116/*************** CYCLOM-Z ADDITIONS ***************/
117
118#define CZIOC ('M' << 8)
119#define CZ_NBOARDS (CZIOC|0xfa)
120#define CZ_BOOT_START (CZIOC|0xfb)
121#define CZ_BOOT_DATA (CZIOC|0xfc)
122#define CZ_BOOT_END (CZIOC|0xfd)
123#define CZ_TEST (CZIOC|0xfe)
124
125#define CZ_DEF_POLL (HZ/25)
126
127#define MAX_BOARD 4 /* Max number of boards */
128#define MAX_DEV 256 /* Max number of ports total */
129#define CYZ_MAX_SPEED 921600
130
131#define CYZ_FIFO_SIZE 16
132
133#define CYZ_BOOT_NWORDS 0x100
134struct CYZ_BOOT_CTRL {
135 unsigned short nboard;
136 int status[MAX_BOARD];
137 int nchannel[MAX_BOARD];
138 int fw_rev[MAX_BOARD];
139 unsigned long offset;
140 unsigned long data[CYZ_BOOT_NWORDS];
141};
142
143
144#ifndef DP_WINDOW_SIZE
145/*
146 * Memory Window Sizes
147 */
148
149#define DP_WINDOW_SIZE (0x00080000) /* window size 512 Kb */
150#define ZE_DP_WINDOW_SIZE (0x00100000) /* window size 1 Mb (Ze and
151 8Zo V.2 */
152#define CTRL_WINDOW_SIZE (0x00000080) /* runtime regs 128 bytes */
153
154/*
155 * CUSTOM_REG - Cyclom-Z/PCI Custom Registers Set. The driver
156 * normally will access only interested on the fpga_id, fpga_version,
157 * start_cpu and stop_cpu.
158 */
159
160struct CUSTOM_REG {
161 __u32 fpga_id; /* FPGA Identification Register */
162 __u32 fpga_version; /* FPGA Version Number Register */
163 __u32 cpu_start; /* CPU start Register (write) */
164 __u32 cpu_stop; /* CPU stop Register (write) */
165 __u32 misc_reg; /* Miscellaneous Register */
166 __u32 idt_mode; /* IDT mode Register */
167 __u32 uart_irq_status; /* UART IRQ status Register */
168 __u32 clear_timer0_irq; /* Clear timer interrupt Register */
169 __u32 clear_timer1_irq; /* Clear timer interrupt Register */
170 __u32 clear_timer2_irq; /* Clear timer interrupt Register */
171 __u32 test_register; /* Test Register */
172 __u32 test_count; /* Test Count Register */
173 __u32 timer_select; /* Timer select register */
174 __u32 pr_uart_irq_status; /* Prioritized UART IRQ stat Reg */
175 __u32 ram_wait_state; /* RAM wait-state Register */
176 __u32 uart_wait_state; /* UART wait-state Register */
177 __u32 timer_wait_state; /* timer wait-state Register */
178 __u32 ack_wait_state; /* ACK wait State Register */
179};
180
181/*
182 * RUNTIME_9060 - PLX PCI9060ES local configuration and shared runtime
183 * registers. This structure can be used to access the 9060 registers
184 * (memory mapped).
185 */
186
187struct RUNTIME_9060 {
188 __u32 loc_addr_range; /* 00h - Local Address Range */
189 __u32 loc_addr_base; /* 04h - Local Address Base */
190 __u32 loc_arbitr; /* 08h - Local Arbitration */
191 __u32 endian_descr; /* 0Ch - Big/Little Endian Descriptor */
192 __u32 loc_rom_range; /* 10h - Local ROM Range */
193 __u32 loc_rom_base; /* 14h - Local ROM Base */
194 __u32 loc_bus_descr; /* 18h - Local Bus descriptor */
195 __u32 loc_range_mst; /* 1Ch - Local Range for Master to PCI */
196 __u32 loc_base_mst; /* 20h - Local Base for Master PCI */
197 __u32 loc_range_io; /* 24h - Local Range for Master IO */
198 __u32 pci_base_mst; /* 28h - PCI Base for Master PCI */
199 __u32 pci_conf_io; /* 2Ch - PCI configuration for Master IO */
200 __u32 filler1; /* 30h */
201 __u32 filler2; /* 34h */
202 __u32 filler3; /* 38h */
203 __u32 filler4; /* 3Ch */
204 __u32 mail_box_0; /* 40h - Mail Box 0 */
205 __u32 mail_box_1; /* 44h - Mail Box 1 */
206 __u32 mail_box_2; /* 48h - Mail Box 2 */
207 __u32 mail_box_3; /* 4Ch - Mail Box 3 */
208 __u32 filler5; /* 50h */
209 __u32 filler6; /* 54h */
210 __u32 filler7; /* 58h */
211 __u32 filler8; /* 5Ch */
212 __u32 pci_doorbell; /* 60h - PCI to Local Doorbell */
213 __u32 loc_doorbell; /* 64h - Local to PCI Doorbell */
214 __u32 intr_ctrl_stat; /* 68h - Interrupt Control/Status */
215 __u32 init_ctrl; /* 6Ch - EEPROM control, Init Control, etc */
216};
217
218/* Values for the Local Base Address re-map register */
219
220#define WIN_RAM 0x00000001L /* set the sliding window to RAM */
221#define WIN_CREG 0x14000001L /* set the window to custom Registers */
222
223/* Values timer select registers */
224
225#define TIMER_BY_1M 0x00 /* clock divided by 1M */
226#define TIMER_BY_256K 0x01 /* clock divided by 256k */
227#define TIMER_BY_128K 0x02 /* clock divided by 128k */
228#define TIMER_BY_32K 0x03 /* clock divided by 32k */
229
230/****************** ****************** *******************/
231#endif
232
233#ifndef ZFIRM_ID
234/* #include "zfwint.h" */
235/****************** ****************** *******************/
236/*
237 * This file contains the definitions for interfacing with the
238 * Cyclom-Z ZFIRM Firmware.
239 */
240
241/* General Constant definitions */
242
243#define MAX_CHAN 64 /* max number of channels per board */
244
245/* firmware id structure (set after boot) */
246
247#define ID_ADDRESS 0x00000180L /* signature/pointer address */
248#define ZFIRM_ID 0x5557465AL /* ZFIRM/U signature */
249#define ZFIRM_HLT 0x59505B5CL /* ZFIRM needs external power supply */
250#define ZFIRM_RST 0x56040674L /* RST signal (due to FW reset) */
251
252#define ZF_TINACT_DEF 1000 /* default inactivity timeout
253 (1000 ms) */
254#define ZF_TINACT ZF_TINACT_DEF
255
256struct FIRM_ID {
257 __u32 signature; /* ZFIRM/U signature */
258 __u32 zfwctrl_addr; /* pointer to ZFW_CTRL structure */
259};
260
261/* Op. System id */
262
263#define C_OS_LINUX 0x00000030 /* generic Linux system */
264
265/* channel op_mode */
266
267#define C_CH_DISABLE 0x00000000 /* channel is disabled */
268#define C_CH_TXENABLE 0x00000001 /* channel Tx enabled */
269#define C_CH_RXENABLE 0x00000002 /* channel Rx enabled */
270#define C_CH_ENABLE 0x00000003 /* channel Tx/Rx enabled */
271#define C_CH_LOOPBACK 0x00000004 /* Loopback mode */
272
273/* comm_parity - parity */
274
275#define C_PR_NONE 0x00000000 /* None */
276#define C_PR_ODD 0x00000001 /* Odd */
277#define C_PR_EVEN 0x00000002 /* Even */
278#define C_PR_MARK 0x00000004 /* Mark */
279#define C_PR_SPACE 0x00000008 /* Space */
280#define C_PR_PARITY 0x000000ff
281
282#define C_PR_DISCARD 0x00000100 /* discard char with frame/par error */
283#define C_PR_IGNORE 0x00000200 /* ignore frame/par error */
284
285/* comm_data_l - data length and stop bits */
286
287#define C_DL_CS5 0x00000001
288#define C_DL_CS6 0x00000002
289#define C_DL_CS7 0x00000004
290#define C_DL_CS8 0x00000008
291#define C_DL_CS 0x0000000f
292#define C_DL_1STOP 0x00000010
293#define C_DL_15STOP 0x00000020
294#define C_DL_2STOP 0x00000040
295#define C_DL_STOP 0x000000f0
296
297/* interrupt enabling/status */
298
299#define C_IN_DISABLE 0x00000000 /* zero, disable interrupts */
300#define C_IN_TXBEMPTY 0x00000001 /* tx buffer empty */
301#define C_IN_TXLOWWM 0x00000002 /* tx buffer below LWM */
302#define C_IN_RXHIWM 0x00000010 /* rx buffer above HWM */
303#define C_IN_RXNNDT 0x00000020 /* rx no new data timeout */
304#define C_IN_MDCD 0x00000100 /* modem DCD change */
305#define C_IN_MDSR 0x00000200 /* modem DSR change */
306#define C_IN_MRI 0x00000400 /* modem RI change */
307#define C_IN_MCTS 0x00000800 /* modem CTS change */
308#define C_IN_RXBRK 0x00001000 /* Break received */
309#define C_IN_PR_ERROR 0x00002000 /* parity error */
310#define C_IN_FR_ERROR 0x00004000 /* frame error */
311#define C_IN_OVR_ERROR 0x00008000 /* overrun error */
312#define C_IN_RXOFL 0x00010000 /* RX buffer overflow */
313#define C_IN_IOCTLW 0x00020000 /* I/O control w/ wait */
314#define C_IN_MRTS 0x00040000 /* modem RTS drop */
315#define C_IN_ICHAR 0x00080000
316
317/* flow control */
318
319#define C_FL_OXX 0x00000001 /* output Xon/Xoff flow control */
320#define C_FL_IXX 0x00000002 /* output Xon/Xoff flow control */
321#define C_FL_OIXANY 0x00000004 /* output Xon/Xoff (any xon) */
322#define C_FL_SWFLOW 0x0000000f
323
324/* flow status */
325
326#define C_FS_TXIDLE 0x00000000 /* no Tx data in the buffer or UART */
327#define C_FS_SENDING 0x00000001 /* UART is sending data */
328#define C_FS_SWFLOW 0x00000002 /* Tx is stopped by received Xoff */
329
330/* rs_control/rs_status RS-232 signals */
331
332#define C_RS_PARAM 0x80000000 /* Indicates presence of parameter in
333 IOCTLM command */
334#define C_RS_RTS 0x00000001 /* RTS */
335#define C_RS_DTR 0x00000004 /* DTR */
336#define C_RS_DCD 0x00000100 /* CD */
337#define C_RS_DSR 0x00000200 /* DSR */
338#define C_RS_RI 0x00000400 /* RI */
339#define C_RS_CTS 0x00000800 /* CTS */
340
341/* commands Host <-> Board */
342
343#define C_CM_RESET 0x01 /* reset/flush buffers */
344#define C_CM_IOCTL 0x02 /* re-read CH_CTRL */
345#define C_CM_IOCTLW 0x03 /* re-read CH_CTRL, intr when done */
346#define C_CM_IOCTLM 0x04 /* RS-232 outputs change */
347#define C_CM_SENDXOFF 0x10 /* send Xoff */
348#define C_CM_SENDXON 0x11 /* send Xon */
349#define C_CM_CLFLOW 0x12 /* Clear flow control (resume) */
350#define C_CM_SENDBRK 0x41 /* send break */
351#define C_CM_INTBACK 0x42 /* Interrupt back */
352#define C_CM_SET_BREAK 0x43 /* Tx break on */
353#define C_CM_CLR_BREAK 0x44 /* Tx break off */
354#define C_CM_CMD_DONE 0x45 /* Previous command done */
355#define C_CM_INTBACK2 0x46 /* Alternate Interrupt back */
356#define C_CM_TINACT 0x51 /* set inactivity detection */
357#define C_CM_IRQ_ENBL 0x52 /* enable generation of interrupts */
358#define C_CM_IRQ_DSBL 0x53 /* disable generation of interrupts */
359#define C_CM_ACK_ENBL 0x54 /* enable acknowledged interrupt mode */
360#define C_CM_ACK_DSBL 0x55 /* disable acknowledged intr mode */
361#define C_CM_FLUSH_RX 0x56 /* flushes Rx buffer */
362#define C_CM_FLUSH_TX 0x57 /* flushes Tx buffer */
363#define C_CM_Q_ENABLE 0x58 /* enables queue access from the
364 driver */
365#define C_CM_Q_DISABLE 0x59 /* disables queue access from the
366 driver */
367
368#define C_CM_TXBEMPTY 0x60 /* Tx buffer is empty */
369#define C_CM_TXLOWWM 0x61 /* Tx buffer low water mark */
370#define C_CM_RXHIWM 0x62 /* Rx buffer high water mark */
371#define C_CM_RXNNDT 0x63 /* rx no new data timeout */
372#define C_CM_TXFEMPTY 0x64
373#define C_CM_ICHAR 0x65
374#define C_CM_MDCD 0x70 /* modem DCD change */
375#define C_CM_MDSR 0x71 /* modem DSR change */
376#define C_CM_MRI 0x72 /* modem RI change */
377#define C_CM_MCTS 0x73 /* modem CTS change */
378#define C_CM_MRTS 0x74 /* modem RTS drop */
379#define C_CM_RXBRK 0x84 /* Break received */
380#define C_CM_PR_ERROR 0x85 /* Parity error */
381#define C_CM_FR_ERROR 0x86 /* Frame error */
382#define C_CM_OVR_ERROR 0x87 /* Overrun error */
383#define C_CM_RXOFL 0x88 /* RX buffer overflow */
384#define C_CM_CMDERROR 0x90 /* command error */
385#define C_CM_FATAL 0x91 /* fatal error */
386#define C_CM_HW_RESET 0x92 /* reset board */
387
388/*
389 * CH_CTRL - This per port structure contains all parameters
390 * that control an specific port. It can be seen as the
391 * configuration registers of a "super-serial-controller".
392 */
393
394struct CH_CTRL {
395 __u32 op_mode; /* operation mode */
396 __u32 intr_enable; /* interrupt masking */
397 __u32 sw_flow; /* SW flow control */
398 __u32 flow_status; /* output flow status */
399 __u32 comm_baud; /* baud rate - numerically specified */
400 __u32 comm_parity; /* parity */
401 __u32 comm_data_l; /* data length/stop */
402 __u32 comm_flags; /* other flags */
403 __u32 hw_flow; /* HW flow control */
404 __u32 rs_control; /* RS-232 outputs */
405 __u32 rs_status; /* RS-232 inputs */
406 __u32 flow_xon; /* xon char */
407 __u32 flow_xoff; /* xoff char */
408 __u32 hw_overflow; /* hw overflow counter */
409 __u32 sw_overflow; /* sw overflow counter */
410 __u32 comm_error; /* frame/parity error counter */
411 __u32 ichar;
412 __u32 filler[7];
413};
414
415
416/*
417 * BUF_CTRL - This per channel structure contains
418 * all Tx and Rx buffer control for a given channel.
419 */
420
421struct BUF_CTRL {
422 __u32 flag_dma; /* buffers are in Host memory */
423 __u32 tx_bufaddr; /* address of the tx buffer */
424 __u32 tx_bufsize; /* tx buffer size */
425 __u32 tx_threshold; /* tx low water mark */
426 __u32 tx_get; /* tail index tx buf */
427 __u32 tx_put; /* head index tx buf */
428 __u32 rx_bufaddr; /* address of the rx buffer */
429 __u32 rx_bufsize; /* rx buffer size */
430 __u32 rx_threshold; /* rx high water mark */
431 __u32 rx_get; /* tail index rx buf */
432 __u32 rx_put; /* head index rx buf */
433 __u32 filler[5]; /* filler to align structures */
434};
435
436/*
437 * BOARD_CTRL - This per board structure contains all global
438 * control fields related to the board.
439 */
440
441struct BOARD_CTRL {
442
443 /* static info provided by the on-board CPU */
444 __u32 n_channel; /* number of channels */
445 __u32 fw_version; /* firmware version */
446
447 /* static info provided by the driver */
448 __u32 op_system; /* op_system id */
449 __u32 dr_version; /* driver version */
450
451 /* board control area */
452 __u32 inactivity; /* inactivity control */
453
454 /* host to FW commands */
455 __u32 hcmd_channel; /* channel number */
456 __u32 hcmd_param; /* pointer to parameters */
457
458 /* FW to Host commands */
459 __u32 fwcmd_channel; /* channel number */
460 __u32 fwcmd_param; /* pointer to parameters */
461 __u32 zf_int_queue_addr; /* offset for INT_QUEUE structure */
462
463 /* filler so the structures are aligned */
464 __u32 filler[6];
465};
466
467/* Host Interrupt Queue */
468
469#define QUEUE_SIZE (10*MAX_CHAN)
470
471struct INT_QUEUE {
472 unsigned char intr_code[QUEUE_SIZE];
473 unsigned long channel[QUEUE_SIZE];
474 unsigned long param[QUEUE_SIZE];
475 unsigned long put;
476 unsigned long get;
477};
478
479/*
480 * ZFW_CTRL - This is the data structure that includes all other
481 * data structures used by the Firmware.
482 */
483
484struct ZFW_CTRL {
485 struct BOARD_CTRL board_ctrl;
486 struct CH_CTRL ch_ctrl[MAX_CHAN];
487 struct BUF_CTRL buf_ctrl[MAX_CHAN];
488};
489
490/****************** ****************** *******************/
491#endif
492
493#endif /* _UAPI_LINUX_CYCLADES_H */
diff --git a/include/linux/cycx_cfm.h b/include/uapi/linux/cycx_cfm.h
index 032d26ed8384..032d26ed8384 100644
--- a/include/linux/cycx_cfm.h
+++ b/include/uapi/linux/cycx_cfm.h
diff --git a/include/linux/dcbnl.h b/include/uapi/linux/dcbnl.h
index 6bb43382f3f3..6bb43382f3f3 100644
--- a/include/linux/dcbnl.h
+++ b/include/uapi/linux/dcbnl.h
diff --git a/include/uapi/linux/dccp.h b/include/uapi/linux/dccp.h
new file mode 100644
index 000000000000..52a9cd7307e7
--- /dev/null
+++ b/include/uapi/linux/dccp.h
@@ -0,0 +1,237 @@
1#ifndef _UAPI_LINUX_DCCP_H
2#define _UAPI_LINUX_DCCP_H
3
4#include <linux/types.h>
5#include <asm/byteorder.h>
6
7/**
8 * struct dccp_hdr - generic part of DCCP packet header
9 *
10 * @dccph_sport - Relevant port on the endpoint that sent this packet
11 * @dccph_dport - Relevant port on the other endpoint
12 * @dccph_doff - Data Offset from the start of the DCCP header, in 32-bit words
13 * @dccph_ccval - Used by the HC-Sender CCID
14 * @dccph_cscov - Parts of the packet that are covered by the Checksum field
15 * @dccph_checksum - Internet checksum, depends on dccph_cscov
16 * @dccph_x - 0 = 24 bit sequence number, 1 = 48
17 * @dccph_type - packet type, see DCCP_PKT_ prefixed macros
18 * @dccph_seq - sequence number high or low order 24 bits, depends on dccph_x
19 */
20struct dccp_hdr {
21 __be16 dccph_sport,
22 dccph_dport;
23 __u8 dccph_doff;
24#if defined(__LITTLE_ENDIAN_BITFIELD)
25 __u8 dccph_cscov:4,
26 dccph_ccval:4;
27#elif defined(__BIG_ENDIAN_BITFIELD)
28 __u8 dccph_ccval:4,
29 dccph_cscov:4;
30#else
31#error "Adjust your <asm/byteorder.h> defines"
32#endif
33 __sum16 dccph_checksum;
34#if defined(__LITTLE_ENDIAN_BITFIELD)
35 __u8 dccph_x:1,
36 dccph_type:4,
37 dccph_reserved:3;
38#elif defined(__BIG_ENDIAN_BITFIELD)
39 __u8 dccph_reserved:3,
40 dccph_type:4,
41 dccph_x:1;
42#else
43#error "Adjust your <asm/byteorder.h> defines"
44#endif
45 __u8 dccph_seq2;
46 __be16 dccph_seq;
47};
48
49/**
50 * struct dccp_hdr_ext - the low bits of a 48 bit seq packet
51 *
52 * @dccph_seq_low - low 24 bits of a 48 bit seq packet
53 */
54struct dccp_hdr_ext {
55 __be32 dccph_seq_low;
56};
57
58/**
59 * struct dccp_hdr_request - Connection initiation request header
60 *
61 * @dccph_req_service - Service to which the client app wants to connect
62 */
63struct dccp_hdr_request {
64 __be32 dccph_req_service;
65};
66/**
67 * struct dccp_hdr_ack_bits - acknowledgment bits common to most packets
68 *
69 * @dccph_resp_ack_nr_high - 48 bit ack number high order bits, contains GSR
70 * @dccph_resp_ack_nr_low - 48 bit ack number low order bits, contains GSR
71 */
72struct dccp_hdr_ack_bits {
73 __be16 dccph_reserved1;
74 __be16 dccph_ack_nr_high;
75 __be32 dccph_ack_nr_low;
76};
77/**
78 * struct dccp_hdr_response - Connection initiation response header
79 *
80 * @dccph_resp_ack - 48 bit Acknowledgment Number Subheader (5.3)
81 * @dccph_resp_service - Echoes the Service Code on a received DCCP-Request
82 */
83struct dccp_hdr_response {
84 struct dccp_hdr_ack_bits dccph_resp_ack;
85 __be32 dccph_resp_service;
86};
87
88/**
89 * struct dccp_hdr_reset - Unconditionally shut down a connection
90 *
91 * @dccph_reset_ack - 48 bit Acknowledgment Number Subheader (5.6)
92 * @dccph_reset_code - one of %dccp_reset_codes
93 * @dccph_reset_data - the Data 1 ... Data 3 fields from 5.6
94 */
95struct dccp_hdr_reset {
96 struct dccp_hdr_ack_bits dccph_reset_ack;
97 __u8 dccph_reset_code,
98 dccph_reset_data[3];
99};
100
101enum dccp_pkt_type {
102 DCCP_PKT_REQUEST = 0,
103 DCCP_PKT_RESPONSE,
104 DCCP_PKT_DATA,
105 DCCP_PKT_ACK,
106 DCCP_PKT_DATAACK,
107 DCCP_PKT_CLOSEREQ,
108 DCCP_PKT_CLOSE,
109 DCCP_PKT_RESET,
110 DCCP_PKT_SYNC,
111 DCCP_PKT_SYNCACK,
112 DCCP_PKT_INVALID,
113};
114
115#define DCCP_NR_PKT_TYPES DCCP_PKT_INVALID
116
117static inline unsigned int dccp_packet_hdr_len(const __u8 type)
118{
119 if (type == DCCP_PKT_DATA)
120 return 0;
121 if (type == DCCP_PKT_DATAACK ||
122 type == DCCP_PKT_ACK ||
123 type == DCCP_PKT_SYNC ||
124 type == DCCP_PKT_SYNCACK ||
125 type == DCCP_PKT_CLOSE ||
126 type == DCCP_PKT_CLOSEREQ)
127 return sizeof(struct dccp_hdr_ack_bits);
128 if (type == DCCP_PKT_REQUEST)
129 return sizeof(struct dccp_hdr_request);
130 if (type == DCCP_PKT_RESPONSE)
131 return sizeof(struct dccp_hdr_response);
132 return sizeof(struct dccp_hdr_reset);
133}
134enum dccp_reset_codes {
135 DCCP_RESET_CODE_UNSPECIFIED = 0,
136 DCCP_RESET_CODE_CLOSED,
137 DCCP_RESET_CODE_ABORTED,
138 DCCP_RESET_CODE_NO_CONNECTION,
139 DCCP_RESET_CODE_PACKET_ERROR,
140 DCCP_RESET_CODE_OPTION_ERROR,
141 DCCP_RESET_CODE_MANDATORY_ERROR,
142 DCCP_RESET_CODE_CONNECTION_REFUSED,
143 DCCP_RESET_CODE_BAD_SERVICE_CODE,
144 DCCP_RESET_CODE_TOO_BUSY,
145 DCCP_RESET_CODE_BAD_INIT_COOKIE,
146 DCCP_RESET_CODE_AGGRESSION_PENALTY,
147
148 DCCP_MAX_RESET_CODES /* Leave at the end! */
149};
150
151/* DCCP options */
152enum {
153 DCCPO_PADDING = 0,
154 DCCPO_MANDATORY = 1,
155 DCCPO_MIN_RESERVED = 3,
156 DCCPO_MAX_RESERVED = 31,
157 DCCPO_CHANGE_L = 32,
158 DCCPO_CONFIRM_L = 33,
159 DCCPO_CHANGE_R = 34,
160 DCCPO_CONFIRM_R = 35,
161 DCCPO_NDP_COUNT = 37,
162 DCCPO_ACK_VECTOR_0 = 38,
163 DCCPO_ACK_VECTOR_1 = 39,
164 DCCPO_TIMESTAMP = 41,
165 DCCPO_TIMESTAMP_ECHO = 42,
166 DCCPO_ELAPSED_TIME = 43,
167 DCCPO_MAX = 45,
168 DCCPO_MIN_RX_CCID_SPECIFIC = 128, /* from sender to receiver */
169 DCCPO_MAX_RX_CCID_SPECIFIC = 191,
170 DCCPO_MIN_TX_CCID_SPECIFIC = 192, /* from receiver to sender */
171 DCCPO_MAX_TX_CCID_SPECIFIC = 255,
172};
173/* maximum size of a single TLV-encoded DCCP option (sans type/len bytes) */
174#define DCCP_SINGLE_OPT_MAXLEN 253
175
176/* DCCP CCIDS */
177enum {
178 DCCPC_CCID2 = 2,
179 DCCPC_CCID3 = 3,
180};
181
182/* DCCP features (RFC 4340 section 6.4) */
183enum dccp_feature_numbers {
184 DCCPF_RESERVED = 0,
185 DCCPF_CCID = 1,
186 DCCPF_SHORT_SEQNOS = 2,
187 DCCPF_SEQUENCE_WINDOW = 3,
188 DCCPF_ECN_INCAPABLE = 4,
189 DCCPF_ACK_RATIO = 5,
190 DCCPF_SEND_ACK_VECTOR = 6,
191 DCCPF_SEND_NDP_COUNT = 7,
192 DCCPF_MIN_CSUM_COVER = 8,
193 DCCPF_DATA_CHECKSUM = 9,
194 /* 10-127 reserved */
195 DCCPF_MIN_CCID_SPECIFIC = 128,
196 DCCPF_SEND_LEV_RATE = 192, /* RFC 4342, sec. 8.4 */
197 DCCPF_MAX_CCID_SPECIFIC = 255,
198};
199
200/* DCCP socket control message types for cmsg */
201enum dccp_cmsg_type {
202 DCCP_SCM_PRIORITY = 1,
203 DCCP_SCM_QPOLICY_MAX = 0xFFFF,
204 /* ^-- Up to here reserved exclusively for qpolicy parameters */
205 DCCP_SCM_MAX
206};
207
208/* DCCP priorities for outgoing/queued packets */
209enum dccp_packet_dequeueing_policy {
210 DCCPQ_POLICY_SIMPLE,
211 DCCPQ_POLICY_PRIO,
212 DCCPQ_POLICY_MAX
213};
214
215/* DCCP socket options */
216#define DCCP_SOCKOPT_PACKET_SIZE 1 /* XXX deprecated, without effect */
217#define DCCP_SOCKOPT_SERVICE 2
218#define DCCP_SOCKOPT_CHANGE_L 3
219#define DCCP_SOCKOPT_CHANGE_R 4
220#define DCCP_SOCKOPT_GET_CUR_MPS 5
221#define DCCP_SOCKOPT_SERVER_TIMEWAIT 6
222#define DCCP_SOCKOPT_SEND_CSCOV 10
223#define DCCP_SOCKOPT_RECV_CSCOV 11
224#define DCCP_SOCKOPT_AVAILABLE_CCIDS 12
225#define DCCP_SOCKOPT_CCID 13
226#define DCCP_SOCKOPT_TX_CCID 14
227#define DCCP_SOCKOPT_RX_CCID 15
228#define DCCP_SOCKOPT_QPOLICY_ID 16
229#define DCCP_SOCKOPT_QPOLICY_TXQLEN 17
230#define DCCP_SOCKOPT_CCID_RX_INFO 128
231#define DCCP_SOCKOPT_CCID_TX_INFO 192
232
233/* maximum number of services provided on the same listening port */
234#define DCCP_SERVICE_LIST_MAX_LEN 32
235
236
237#endif /* _UAPI_LINUX_DCCP_H */
diff --git a/include/uapi/linux/dlm.h b/include/uapi/linux/dlm.h
new file mode 100644
index 000000000000..1f73cc06168f
--- /dev/null
+++ b/include/uapi/linux/dlm.h
@@ -0,0 +1,75 @@
1/******************************************************************************
2*******************************************************************************
3**
4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
5** Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
6**
7** This copyrighted material is made available to anyone wishing to use,
8** modify, copy, or redistribute it subject to the terms and conditions
9** of the GNU General Public License v.2.
10**
11*******************************************************************************
12******************************************************************************/
13
14#ifndef _UAPI__DLM_DOT_H__
15#define _UAPI__DLM_DOT_H__
16
17/*
18 * Interface to Distributed Lock Manager (DLM)
19 * routines and structures to use DLM lockspaces
20 */
21
22/* Lock levels and flags are here */
23#include <linux/dlmconstants.h>
24#include <linux/types.h>
25
26typedef void dlm_lockspace_t;
27
28/*
29 * Lock status block
30 *
31 * Use this structure to specify the contents of the lock value block. For a
32 * conversion request, this structure is used to specify the lock ID of the
33 * lock. DLM writes the status of the lock request and the lock ID assigned
34 * to the request in the lock status block.
35 *
36 * sb_lkid: the returned lock ID. It is set on new (non-conversion) requests.
37 * It is available when dlm_lock returns.
38 *
39 * sb_lvbptr: saves or returns the contents of the lock's LVB according to rules
40 * shown for the DLM_LKF_VALBLK flag.
41 *
42 * sb_flags: DLM_SBF_DEMOTED is returned if in the process of promoting a lock,
43 * it was first demoted to NL to avoid conversion deadlock.
44 * DLM_SBF_VALNOTVALID is returned if the resource's LVB is marked invalid.
45 *
46 * sb_status: the returned status of the lock request set prior to AST
47 * execution. Possible return values:
48 *
49 * 0 if lock request was successful
50 * -EAGAIN if request would block and is flagged DLM_LKF_NOQUEUE
51 * -DLM_EUNLOCK if unlock request was successful
52 * -DLM_ECANCEL if a cancel completed successfully
53 * -EDEADLK if a deadlock was detected
54 * -ETIMEDOUT if the lock request was canceled due to a timeout
55 */
56
57#define DLM_SBF_DEMOTED 0x01
58#define DLM_SBF_VALNOTVALID 0x02
59#define DLM_SBF_ALTMODE 0x04
60
61struct dlm_lksb {
62 int sb_status;
63 __u32 sb_lkid;
64 char sb_flags;
65 char * sb_lvbptr;
66};
67
68/* dlm_new_lockspace() flags */
69
70#define DLM_LSFL_TIMEWARN 0x00000002
71#define DLM_LSFL_FS 0x00000004
72#define DLM_LSFL_NEWEXCL 0x00000008
73
74
75#endif /* _UAPI__DLM_DOT_H__ */
diff --git a/include/linux/dlm_device.h b/include/uapi/linux/dlm_device.h
index 3060783c4191..3060783c4191 100644
--- a/include/linux/dlm_device.h
+++ b/include/uapi/linux/dlm_device.h
diff --git a/include/linux/dlm_netlink.h b/include/uapi/linux/dlm_netlink.h
index 647c8ef27227..647c8ef27227 100644
--- a/include/linux/dlm_netlink.h
+++ b/include/uapi/linux/dlm_netlink.h
diff --git a/include/uapi/linux/dlm_plock.h b/include/uapi/linux/dlm_plock.h
new file mode 100644
index 000000000000..6ae692c909cb
--- /dev/null
+++ b/include/uapi/linux/dlm_plock.h
@@ -0,0 +1,45 @@
1/*
2 * Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved.
3 *
4 * This copyrighted material is made available to anyone wishing to use,
5 * modify, copy, or redistribute it subject to the terms and conditions
6 * of the GNU General Public License v.2.
7 */
8
9#ifndef _UAPI__DLM_PLOCK_DOT_H__
10#define _UAPI__DLM_PLOCK_DOT_H__
11
12#include <linux/types.h>
13
14#define DLM_PLOCK_MISC_NAME "dlm_plock"
15
16#define DLM_PLOCK_VERSION_MAJOR 1
17#define DLM_PLOCK_VERSION_MINOR 2
18#define DLM_PLOCK_VERSION_PATCH 0
19
20enum {
21 DLM_PLOCK_OP_LOCK = 1,
22 DLM_PLOCK_OP_UNLOCK,
23 DLM_PLOCK_OP_GET,
24};
25
26#define DLM_PLOCK_FL_CLOSE 1
27
28struct dlm_plock_info {
29 __u32 version[3];
30 __u8 optype;
31 __u8 ex;
32 __u8 wait;
33 __u8 flags;
34 __u32 pid;
35 __s32 nodeid;
36 __s32 rv;
37 __u32 fsid;
38 __u64 number;
39 __u64 start;
40 __u64 end;
41 __u64 owner;
42};
43
44
45#endif /* _UAPI__DLM_PLOCK_DOT_H__ */
diff --git a/include/linux/dlmconstants.h b/include/uapi/linux/dlmconstants.h
index 47bf08dc7566..47bf08dc7566 100644
--- a/include/linux/dlmconstants.h
+++ b/include/uapi/linux/dlmconstants.h
diff --git a/include/linux/dm-ioctl.h b/include/uapi/linux/dm-ioctl.h
index 91e3a360f611..91e3a360f611 100644
--- a/include/linux/dm-ioctl.h
+++ b/include/uapi/linux/dm-ioctl.h
diff --git a/include/linux/dm-log-userspace.h b/include/uapi/linux/dm-log-userspace.h
index 0678c2adc421..0678c2adc421 100644
--- a/include/linux/dm-log-userspace.h
+++ b/include/uapi/linux/dm-log-userspace.h
diff --git a/include/linux/dn.h b/include/uapi/linux/dn.h
index 9c50445462d9..9c50445462d9 100644
--- a/include/linux/dn.h
+++ b/include/uapi/linux/dn.h
diff --git a/include/linux/dqblk_xfs.h b/include/uapi/linux/dqblk_xfs.h
index 86552807aed9..86552807aed9 100644
--- a/include/linux/dqblk_xfs.h
+++ b/include/uapi/linux/dqblk_xfs.h
diff --git a/include/uapi/linux/dvb/Kbuild b/include/uapi/linux/dvb/Kbuild
index aafaa5aa54d4..d40942cfc627 100644
--- a/include/uapi/linux/dvb/Kbuild
+++ b/include/uapi/linux/dvb/Kbuild
@@ -1 +1,9 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += audio.h
3header-y += ca.h
4header-y += dmx.h
5header-y += frontend.h
6header-y += net.h
7header-y += osd.h
8header-y += version.h
9header-y += video.h
diff --git a/include/linux/dvb/audio.h b/include/uapi/linux/dvb/audio.h
index d47bccd604e4..d47bccd604e4 100644
--- a/include/linux/dvb/audio.h
+++ b/include/uapi/linux/dvb/audio.h
diff --git a/include/linux/dvb/ca.h b/include/uapi/linux/dvb/ca.h
index c18537f3e449..c18537f3e449 100644
--- a/include/linux/dvb/ca.h
+++ b/include/uapi/linux/dvb/ca.h
diff --git a/include/uapi/linux/dvb/dmx.h b/include/uapi/linux/dvb/dmx.h
new file mode 100644
index 000000000000..b2a9ad8cafdc
--- /dev/null
+++ b/include/uapi/linux/dvb/dmx.h
@@ -0,0 +1,155 @@
1/*
2 * dmx.h
3 *
4 * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
5 * & Ralph Metzler <ralph@convergence.de>
6 * for convergence integrated media GmbH
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 *
22 */
23
24#ifndef _UAPI_DVBDMX_H_
25#define _UAPI_DVBDMX_H_
26
27#include <linux/types.h>
28#ifndef __KERNEL__
29#include <time.h>
30#endif
31
32
33#define DMX_FILTER_SIZE 16
34
35typedef enum
36{
37 DMX_OUT_DECODER, /* Streaming directly to decoder. */
38 DMX_OUT_TAP, /* Output going to a memory buffer */
39 /* (to be retrieved via the read command).*/
40 DMX_OUT_TS_TAP, /* Output multiplexed into a new TS */
41 /* (to be retrieved by reading from the */
42 /* logical DVR device). */
43 DMX_OUT_TSDEMUX_TAP /* Like TS_TAP but retrieved from the DMX device */
44} dmx_output_t;
45
46
47typedef enum
48{
49 DMX_IN_FRONTEND, /* Input from a front-end device. */
50 DMX_IN_DVR /* Input from the logical DVR device. */
51} dmx_input_t;
52
53
54typedef enum
55{
56 DMX_PES_AUDIO0,
57 DMX_PES_VIDEO0,
58 DMX_PES_TELETEXT0,
59 DMX_PES_SUBTITLE0,
60 DMX_PES_PCR0,
61
62 DMX_PES_AUDIO1,
63 DMX_PES_VIDEO1,
64 DMX_PES_TELETEXT1,
65 DMX_PES_SUBTITLE1,
66 DMX_PES_PCR1,
67
68 DMX_PES_AUDIO2,
69 DMX_PES_VIDEO2,
70 DMX_PES_TELETEXT2,
71 DMX_PES_SUBTITLE2,
72 DMX_PES_PCR2,
73
74 DMX_PES_AUDIO3,
75 DMX_PES_VIDEO3,
76 DMX_PES_TELETEXT3,
77 DMX_PES_SUBTITLE3,
78 DMX_PES_PCR3,
79
80 DMX_PES_OTHER
81} dmx_pes_type_t;
82
83#define DMX_PES_AUDIO DMX_PES_AUDIO0
84#define DMX_PES_VIDEO DMX_PES_VIDEO0
85#define DMX_PES_TELETEXT DMX_PES_TELETEXT0
86#define DMX_PES_SUBTITLE DMX_PES_SUBTITLE0
87#define DMX_PES_PCR DMX_PES_PCR0
88
89
90typedef struct dmx_filter
91{
92 __u8 filter[DMX_FILTER_SIZE];
93 __u8 mask[DMX_FILTER_SIZE];
94 __u8 mode[DMX_FILTER_SIZE];
95} dmx_filter_t;
96
97
98struct dmx_sct_filter_params
99{
100 __u16 pid;
101 dmx_filter_t filter;
102 __u32 timeout;
103 __u32 flags;
104#define DMX_CHECK_CRC 1
105#define DMX_ONESHOT 2
106#define DMX_IMMEDIATE_START 4
107#define DMX_KERNEL_CLIENT 0x8000
108};
109
110
111struct dmx_pes_filter_params
112{
113 __u16 pid;
114 dmx_input_t input;
115 dmx_output_t output;
116 dmx_pes_type_t pes_type;
117 __u32 flags;
118};
119
120typedef struct dmx_caps {
121 __u32 caps;
122 int num_decoders;
123} dmx_caps_t;
124
125typedef enum {
126 DMX_SOURCE_FRONT0 = 0,
127 DMX_SOURCE_FRONT1,
128 DMX_SOURCE_FRONT2,
129 DMX_SOURCE_FRONT3,
130 DMX_SOURCE_DVR0 = 16,
131 DMX_SOURCE_DVR1,
132 DMX_SOURCE_DVR2,
133 DMX_SOURCE_DVR3
134} dmx_source_t;
135
136struct dmx_stc {
137 unsigned int num; /* input : which STC? 0..N */
138 unsigned int base; /* output: divisor for stc to get 90 kHz clock */
139 __u64 stc; /* output: stc in 'base'*90 kHz units */
140};
141
142
143#define DMX_START _IO('o', 41)
144#define DMX_STOP _IO('o', 42)
145#define DMX_SET_FILTER _IOW('o', 43, struct dmx_sct_filter_params)
146#define DMX_SET_PES_FILTER _IOW('o', 44, struct dmx_pes_filter_params)
147#define DMX_SET_BUFFER_SIZE _IO('o', 45)
148#define DMX_GET_PES_PIDS _IOR('o', 47, __u16[5])
149#define DMX_GET_CAPS _IOR('o', 48, dmx_caps_t)
150#define DMX_SET_SOURCE _IOW('o', 49, dmx_source_t)
151#define DMX_GET_STC _IOWR('o', 50, struct dmx_stc)
152#define DMX_ADD_PID _IOW('o', 51, __u16)
153#define DMX_REMOVE_PID _IOW('o', 52, __u16)
154
155#endif /* _UAPI_DVBDMX_H_ */
diff --git a/include/linux/dvb/frontend.h b/include/uapi/linux/dvb/frontend.h
index f50d4058c5fb..c12d452cb40d 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/uapi/linux/dvb/frontend.h
@@ -62,6 +62,7 @@ typedef enum fe_caps {
62 FE_CAN_8VSB = 0x200000, 62 FE_CAN_8VSB = 0x200000,
63 FE_CAN_16VSB = 0x400000, 63 FE_CAN_16VSB = 0x400000,
64 FE_HAS_EXTENDED_CAPS = 0x800000, /* We need more bitspace for newer APIs, indicate this. */ 64 FE_HAS_EXTENDED_CAPS = 0x800000, /* We need more bitspace for newer APIs, indicate this. */
65 FE_CAN_MULTISTREAM = 0x4000000, /* frontend supports multistream filtering */
65 FE_CAN_TURBO_FEC = 0x8000000, /* frontend supports "turbo fec modulation" */ 66 FE_CAN_TURBO_FEC = 0x8000000, /* frontend supports "turbo fec modulation" */
66 FE_CAN_2G_MODULATION = 0x10000000, /* frontend supports "2nd generation modulation" (DVB-S2) */ 67 FE_CAN_2G_MODULATION = 0x10000000, /* frontend supports "2nd generation modulation" (DVB-S2) */
67 FE_NEEDS_BENDING = 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */ 68 FE_NEEDS_BENDING = 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */
@@ -121,16 +122,27 @@ typedef enum fe_sec_mini_cmd {
121} fe_sec_mini_cmd_t; 122} fe_sec_mini_cmd_t;
122 123
123 124
125/**
126 * enum fe_status - enumerates the possible frontend status
127 * @FE_HAS_SIGNAL: found something above the noise level
128 * @FE_HAS_CARRIER: found a DVB signal
129 * @FE_HAS_VITERBI: FEC is stable
130 * @FE_HAS_SYNC: found sync bytes
131 * @FE_HAS_LOCK: everything's working
132 * @FE_TIMEDOUT: no lock within the last ~2 seconds
133 * @FE_REINIT: frontend was reinitialized, application is recommended
134 * to reset DiSEqC, tone and parameters
135 */
136
124typedef enum fe_status { 137typedef enum fe_status {
125 FE_HAS_SIGNAL = 0x01, /* found something above the noise level */ 138 FE_HAS_SIGNAL = 0x01,
126 FE_HAS_CARRIER = 0x02, /* found a DVB signal */ 139 FE_HAS_CARRIER = 0x02,
127 FE_HAS_VITERBI = 0x04, /* FEC is stable */ 140 FE_HAS_VITERBI = 0x04,
128 FE_HAS_SYNC = 0x08, /* found sync bytes */ 141 FE_HAS_SYNC = 0x08,
129 FE_HAS_LOCK = 0x10, /* everything's working... */ 142 FE_HAS_LOCK = 0x10,
130 FE_TIMEDOUT = 0x20, /* no lock within the last ~2 seconds */ 143 FE_TIMEDOUT = 0x20,
131 FE_REINIT = 0x40 /* frontend was reinitialized, */ 144 FE_REINIT = 0x40,
132} fe_status_t; /* application is recommended to reset */ 145} fe_status_t;
133 /* DiSEqC, tone and parameters */
134 146
135typedef enum fe_spectral_inversion { 147typedef enum fe_spectral_inversion {
136 INVERSION_OFF, 148 INVERSION_OFF,
@@ -152,6 +164,7 @@ typedef enum fe_code_rate {
152 FEC_AUTO, 164 FEC_AUTO,
153 FEC_3_5, 165 FEC_3_5,
154 FEC_9_10, 166 FEC_9_10,
167 FEC_2_5,
155} fe_code_rate_t; 168} fe_code_rate_t;
156 169
157 170
@@ -169,6 +182,7 @@ typedef enum fe_modulation {
169 APSK_16, 182 APSK_16,
170 APSK_32, 183 APSK_32,
171 DQPSK, 184 DQPSK,
185 QAM_4_NR,
172} fe_modulation_t; 186} fe_modulation_t;
173 187
174typedef enum fe_transmit_mode { 188typedef enum fe_transmit_mode {
@@ -179,6 +193,8 @@ typedef enum fe_transmit_mode {
179 TRANSMISSION_MODE_1K, 193 TRANSMISSION_MODE_1K,
180 TRANSMISSION_MODE_16K, 194 TRANSMISSION_MODE_16K,
181 TRANSMISSION_MODE_32K, 195 TRANSMISSION_MODE_32K,
196 TRANSMISSION_MODE_C1,
197 TRANSMISSION_MODE_C3780,
182} fe_transmit_mode_t; 198} fe_transmit_mode_t;
183 199
184#if defined(__DVB_CORE__) || !defined (__KERNEL__) 200#if defined(__DVB_CORE__) || !defined (__KERNEL__)
@@ -202,6 +218,9 @@ typedef enum fe_guard_interval {
202 GUARD_INTERVAL_1_128, 218 GUARD_INTERVAL_1_128,
203 GUARD_INTERVAL_19_128, 219 GUARD_INTERVAL_19_128,
204 GUARD_INTERVAL_19_256, 220 GUARD_INTERVAL_19_256,
221 GUARD_INTERVAL_PN420,
222 GUARD_INTERVAL_PN595,
223 GUARD_INTERVAL_PN945,
205} fe_guard_interval_t; 224} fe_guard_interval_t;
206 225
207 226
@@ -213,6 +232,12 @@ typedef enum fe_hierarchy {
213 HIERARCHY_AUTO 232 HIERARCHY_AUTO
214} fe_hierarchy_t; 233} fe_hierarchy_t;
215 234
235enum fe_interleaving {
236 INTERLEAVING_NONE,
237 INTERLEAVING_AUTO,
238 INTERLEAVING_240,
239 INTERLEAVING_720,
240};
216 241
217#if defined(__DVB_CORE__) || !defined (__KERNEL__) 242#if defined(__DVB_CORE__) || !defined (__KERNEL__)
218struct dvb_qpsk_parameters { 243struct dvb_qpsk_parameters {
@@ -314,9 +339,9 @@ struct dvb_frontend_event {
314 339
315#define DTV_ISDBT_LAYER_ENABLED 41 340#define DTV_ISDBT_LAYER_ENABLED 41
316 341
317#define DTV_ISDBS_TS_ID 42 342#define DTV_STREAM_ID 42
318 343#define DTV_ISDBS_TS_ID_LEGACY DTV_STREAM_ID
319#define DTV_DVBT2_PLP_ID 43 344#define DTV_DVBT2_PLP_ID_LEGACY 43
320 345
321#define DTV_ENUM_DELSYS 44 346#define DTV_ENUM_DELSYS 44
322 347
@@ -337,7 +362,10 @@ struct dvb_frontend_event {
337#define DTV_ATSCMH_SCCC_CODE_MODE_C 58 362#define DTV_ATSCMH_SCCC_CODE_MODE_C 58
338#define DTV_ATSCMH_SCCC_CODE_MODE_D 59 363#define DTV_ATSCMH_SCCC_CODE_MODE_D 59
339 364
340#define DTV_MAX_COMMAND DTV_ATSCMH_SCCC_CODE_MODE_D 365#define DTV_INTERLEAVING 60
366#define DTV_LNA 61
367
368#define DTV_MAX_COMMAND DTV_LNA
341 369
342typedef enum fe_pilot { 370typedef enum fe_pilot {
343 PILOT_ON, 371 PILOT_ON,
@@ -366,7 +394,7 @@ typedef enum fe_delivery_system {
366 SYS_ISDBC, 394 SYS_ISDBC,
367 SYS_ATSC, 395 SYS_ATSC,
368 SYS_ATSCMH, 396 SYS_ATSCMH,
369 SYS_DMBTH, 397 SYS_DTMB,
370 SYS_CMMB, 398 SYS_CMMB,
371 SYS_DAB, 399 SYS_DAB,
372 SYS_DVBT2, 400 SYS_DVBT2,
@@ -374,8 +402,9 @@ typedef enum fe_delivery_system {
374 SYS_DVBC_ANNEX_C, 402 SYS_DVBC_ANNEX_C,
375} fe_delivery_system_t; 403} fe_delivery_system_t;
376 404
377 405/* backward compatibility */
378#define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A 406#define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A
407#define SYS_DMBTH SYS_DTMB /* DMB-TH is legacy name, use DTMB instead */
379 408
380/* ATSC-MH */ 409/* ATSC-MH */
381 410
@@ -409,6 +438,8 @@ enum atscmh_rs_code_mode {
409 ATSCMH_RSCODE_RES = 3, 438 ATSCMH_RSCODE_RES = 3,
410}; 439};
411 440
441#define NO_STREAM_ID_FILTER (~0U)
442#define LNA_AUTO (~0U)
412 443
413struct dtv_cmds_h { 444struct dtv_cmds_h {
414 char *name; /* A display name for debugging purposes */ 445 char *name; /* A display name for debugging purposes */
diff --git a/include/linux/dvb/net.h b/include/uapi/linux/dvb/net.h
index f451e7eb0b0b..f451e7eb0b0b 100644
--- a/include/linux/dvb/net.h
+++ b/include/uapi/linux/dvb/net.h
diff --git a/include/linux/dvb/osd.h b/include/uapi/linux/dvb/osd.h
index 880e68435832..880e68435832 100644
--- a/include/linux/dvb/osd.h
+++ b/include/uapi/linux/dvb/osd.h
diff --git a/include/linux/dvb/version.h b/include/uapi/linux/dvb/version.h
index 43d9e8d462d4..827cce7e33e3 100644
--- a/include/linux/dvb/version.h
+++ b/include/uapi/linux/dvb/version.h
@@ -24,6 +24,6 @@
24#define _DVBVERSION_H_ 24#define _DVBVERSION_H_
25 25
26#define DVB_API_VERSION 5 26#define DVB_API_VERSION 5
27#define DVB_API_VERSION_MINOR 6 27#define DVB_API_VERSION_MINOR 9
28 28
29#endif /*_DVBVERSION_H_*/ 29#endif /*_DVBVERSION_H_*/
diff --git a/include/uapi/linux/dvb/video.h b/include/uapi/linux/dvb/video.h
new file mode 100644
index 000000000000..d3d14a59d2d5
--- /dev/null
+++ b/include/uapi/linux/dvb/video.h
@@ -0,0 +1,274 @@
1/*
2 * video.h
3 *
4 * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de>
5 * & Ralph Metzler <ralph@convergence.de>
6 * for convergence integrated media GmbH
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 *
22 */
23
24#ifndef _UAPI_DVBVIDEO_H_
25#define _UAPI_DVBVIDEO_H_
26
27#include <linux/types.h>
28#ifndef __KERNEL__
29#include <stdint.h>
30#include <time.h>
31#endif
32
33typedef enum {
34 VIDEO_FORMAT_4_3, /* Select 4:3 format */
35 VIDEO_FORMAT_16_9, /* Select 16:9 format. */
36 VIDEO_FORMAT_221_1 /* 2.21:1 */
37} video_format_t;
38
39
40typedef enum {
41 VIDEO_SYSTEM_PAL,
42 VIDEO_SYSTEM_NTSC,
43 VIDEO_SYSTEM_PALN,
44 VIDEO_SYSTEM_PALNc,
45 VIDEO_SYSTEM_PALM,
46 VIDEO_SYSTEM_NTSC60,
47 VIDEO_SYSTEM_PAL60,
48 VIDEO_SYSTEM_PALM60
49} video_system_t;
50
51
52typedef enum {
53 VIDEO_PAN_SCAN, /* use pan and scan format */
54 VIDEO_LETTER_BOX, /* use letterbox format */
55 VIDEO_CENTER_CUT_OUT /* use center cut out format */
56} video_displayformat_t;
57
58typedef struct {
59 int w;
60 int h;
61 video_format_t aspect_ratio;
62} video_size_t;
63
64typedef enum {
65 VIDEO_SOURCE_DEMUX, /* Select the demux as the main source */
66 VIDEO_SOURCE_MEMORY /* If this source is selected, the stream
67 comes from the user through the write
68 system call */
69} video_stream_source_t;
70
71
72typedef enum {
73 VIDEO_STOPPED, /* Video is stopped */
74 VIDEO_PLAYING, /* Video is currently playing */
75 VIDEO_FREEZED /* Video is freezed */
76} video_play_state_t;
77
78
79/* Decoder commands */
80#define VIDEO_CMD_PLAY (0)
81#define VIDEO_CMD_STOP (1)
82#define VIDEO_CMD_FREEZE (2)
83#define VIDEO_CMD_CONTINUE (3)
84
85/* Flags for VIDEO_CMD_FREEZE */
86#define VIDEO_CMD_FREEZE_TO_BLACK (1 << 0)
87
88/* Flags for VIDEO_CMD_STOP */
89#define VIDEO_CMD_STOP_TO_BLACK (1 << 0)
90#define VIDEO_CMD_STOP_IMMEDIATELY (1 << 1)
91
92/* Play input formats: */
93/* The decoder has no special format requirements */
94#define VIDEO_PLAY_FMT_NONE (0)
95/* The decoder requires full GOPs */
96#define VIDEO_PLAY_FMT_GOP (1)
97
98/* The structure must be zeroed before use by the application
99 This ensures it can be extended safely in the future. */
100struct video_command {
101 __u32 cmd;
102 __u32 flags;
103 union {
104 struct {
105 __u64 pts;
106 } stop;
107
108 struct {
109 /* 0 or 1000 specifies normal speed,
110 1 specifies forward single stepping,
111 -1 specifies backward single stepping,
112 >1: playback at speed/1000 of the normal speed,
113 <-1: reverse playback at (-speed/1000) of the normal speed. */
114 __s32 speed;
115 __u32 format;
116 } play;
117
118 struct {
119 __u32 data[16];
120 } raw;
121 };
122};
123
124/* FIELD_UNKNOWN can be used if the hardware does not know whether
125 the Vsync is for an odd, even or progressive (i.e. non-interlaced)
126 field. */
127#define VIDEO_VSYNC_FIELD_UNKNOWN (0)
128#define VIDEO_VSYNC_FIELD_ODD (1)
129#define VIDEO_VSYNC_FIELD_EVEN (2)
130#define VIDEO_VSYNC_FIELD_PROGRESSIVE (3)
131
132struct video_event {
133 __s32 type;
134#define VIDEO_EVENT_SIZE_CHANGED 1
135#define VIDEO_EVENT_FRAME_RATE_CHANGED 2
136#define VIDEO_EVENT_DECODER_STOPPED 3
137#define VIDEO_EVENT_VSYNC 4
138 __kernel_time_t timestamp;
139 union {
140 video_size_t size;
141 unsigned int frame_rate; /* in frames per 1000sec */
142 unsigned char vsync_field; /* unknown/odd/even/progressive */
143 } u;
144};
145
146
147struct video_status {
148 int video_blank; /* blank video on freeze? */
149 video_play_state_t play_state; /* current state of playback */
150 video_stream_source_t stream_source; /* current source (demux/memory) */
151 video_format_t video_format; /* current aspect ratio of stream*/
152 video_displayformat_t display_format;/* selected cropping mode */
153};
154
155
156struct video_still_picture {
157 char __user *iFrame; /* pointer to a single iframe in memory */
158 __s32 size;
159};
160
161
162typedef
163struct video_highlight {
164 int active; /* 1=show highlight, 0=hide highlight */
165 __u8 contrast1; /* 7- 4 Pattern pixel contrast */
166 /* 3- 0 Background pixel contrast */
167 __u8 contrast2; /* 7- 4 Emphasis pixel-2 contrast */
168 /* 3- 0 Emphasis pixel-1 contrast */
169 __u8 color1; /* 7- 4 Pattern pixel color */
170 /* 3- 0 Background pixel color */
171 __u8 color2; /* 7- 4 Emphasis pixel-2 color */
172 /* 3- 0 Emphasis pixel-1 color */
173 __u32 ypos; /* 23-22 auto action mode */
174 /* 21-12 start y */
175 /* 9- 0 end y */
176 __u32 xpos; /* 23-22 button color number */
177 /* 21-12 start x */
178 /* 9- 0 end x */
179} video_highlight_t;
180
181
182typedef struct video_spu {
183 int active;
184 int stream_id;
185} video_spu_t;
186
187
188typedef struct video_spu_palette { /* SPU Palette information */
189 int length;
190 __u8 __user *palette;
191} video_spu_palette_t;
192
193
194typedef struct video_navi_pack {
195 int length; /* 0 ... 1024 */
196 __u8 data[1024];
197} video_navi_pack_t;
198
199
200typedef __u16 video_attributes_t;
201/* bits: descr. */
202/* 15-14 Video compression mode (0=MPEG-1, 1=MPEG-2) */
203/* 13-12 TV system (0=525/60, 1=625/50) */
204/* 11-10 Aspect ratio (0=4:3, 3=16:9) */
205/* 9- 8 permitted display mode on 4:3 monitor (0=both, 1=only pan-sca */
206/* 7 line 21-1 data present in GOP (1=yes, 0=no) */
207/* 6 line 21-2 data present in GOP (1=yes, 0=no) */
208/* 5- 3 source resolution (0=720x480/576, 1=704x480/576, 2=352x480/57 */
209/* 2 source letterboxed (1=yes, 0=no) */
210/* 0 film/camera mode (0=camera, 1=film (625/50 only)) */
211
212
213/* bit definitions for capabilities: */
214/* can the hardware decode MPEG1 and/or MPEG2? */
215#define VIDEO_CAP_MPEG1 1
216#define VIDEO_CAP_MPEG2 2
217/* can you send a system and/or program stream to video device?
218 (you still have to open the video and the audio device but only
219 send the stream to the video device) */
220#define VIDEO_CAP_SYS 4
221#define VIDEO_CAP_PROG 8
222/* can the driver also handle SPU, NAVI and CSS encoded data?
223 (CSS API is not present yet) */
224#define VIDEO_CAP_SPU 16
225#define VIDEO_CAP_NAVI 32
226#define VIDEO_CAP_CSS 64
227
228
229#define VIDEO_STOP _IO('o', 21)
230#define VIDEO_PLAY _IO('o', 22)
231#define VIDEO_FREEZE _IO('o', 23)
232#define VIDEO_CONTINUE _IO('o', 24)
233#define VIDEO_SELECT_SOURCE _IO('o', 25)
234#define VIDEO_SET_BLANK _IO('o', 26)
235#define VIDEO_GET_STATUS _IOR('o', 27, struct video_status)
236#define VIDEO_GET_EVENT _IOR('o', 28, struct video_event)
237#define VIDEO_SET_DISPLAY_FORMAT _IO('o', 29)
238#define VIDEO_STILLPICTURE _IOW('o', 30, struct video_still_picture)
239#define VIDEO_FAST_FORWARD _IO('o', 31)
240#define VIDEO_SLOWMOTION _IO('o', 32)
241#define VIDEO_GET_CAPABILITIES _IOR('o', 33, unsigned int)
242#define VIDEO_CLEAR_BUFFER _IO('o', 34)
243#define VIDEO_SET_ID _IO('o', 35)
244#define VIDEO_SET_STREAMTYPE _IO('o', 36)
245#define VIDEO_SET_FORMAT _IO('o', 37)
246#define VIDEO_SET_SYSTEM _IO('o', 38)
247#define VIDEO_SET_HIGHLIGHT _IOW('o', 39, video_highlight_t)
248#define VIDEO_SET_SPU _IOW('o', 50, video_spu_t)
249#define VIDEO_SET_SPU_PALETTE _IOW('o', 51, video_spu_palette_t)
250#define VIDEO_GET_NAVI _IOR('o', 52, video_navi_pack_t)
251#define VIDEO_SET_ATTRIBUTES _IO('o', 53)
252#define VIDEO_GET_SIZE _IOR('o', 55, video_size_t)
253#define VIDEO_GET_FRAME_RATE _IOR('o', 56, unsigned int)
254
255/**
256 * VIDEO_GET_PTS
257 *
258 * Read the 33 bit presentation time stamp as defined
259 * in ITU T-REC-H.222.0 / ISO/IEC 13818-1.
260 *
261 * The PTS should belong to the currently played
262 * frame if possible, but may also be a value close to it
263 * like the PTS of the last decoded frame or the last PTS
264 * extracted by the PES parser.
265 */
266#define VIDEO_GET_PTS _IOR('o', 57, __u64)
267
268/* Read the number of displayed frames since the decoder was started */
269#define VIDEO_GET_FRAME_COUNT _IOR('o', 58, __u64)
270
271#define VIDEO_COMMAND _IOWR('o', 59, struct video_command)
272#define VIDEO_TRY_COMMAND _IOWR('o', 60, struct video_command)
273
274#endif /* _UAPI_DVBVIDEO_H_ */
diff --git a/include/uapi/linux/edd.h b/include/uapi/linux/edd.h
new file mode 100644
index 000000000000..89240a04e4c8
--- /dev/null
+++ b/include/uapi/linux/edd.h
@@ -0,0 +1,191 @@
1/*
2 * linux/include/linux/edd.h
3 * Copyright (C) 2002, 2003, 2004 Dell Inc.
4 * by Matt Domsch <Matt_Domsch@dell.com>
5 *
6 * structures and definitions for the int 13h, ax={41,48}h
7 * BIOS Enhanced Disk Drive Services
8 * This is based on the T13 group document D1572 Revision 0 (August 14 2002)
9 * available at http://www.t13.org/docs2002/d1572r0.pdf. It is
10 * very similar to D1484 Revision 3 http://www.t13.org/docs2002/d1484r3.pdf
11 *
12 * In a nutshell, arch/{i386,x86_64}/boot/setup.S populates a scratch
13 * table in the boot_params that contains a list of BIOS-enumerated
14 * boot devices.
15 * In arch/{i386,x86_64}/kernel/setup.c, this information is
16 * transferred into the edd structure, and in drivers/firmware/edd.c, that
17 * information is used to identify BIOS boot disk. The code in setup.S
18 * is very sensitive to the size of these structures.
19 *
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License v2.0 as published by
22 * the Free Software Foundation
23 *
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
28 *
29 */
30#ifndef _UAPI_LINUX_EDD_H
31#define _UAPI_LINUX_EDD_H
32
33#include <linux/types.h>
34
35#define EDDNR 0x1e9 /* addr of number of edd_info structs at EDDBUF
36 in boot_params - treat this as 1 byte */
37#define EDDBUF 0xd00 /* addr of edd_info structs in boot_params */
38#define EDDMAXNR 6 /* number of edd_info structs starting at EDDBUF */
39#define EDDEXTSIZE 8 /* change these if you muck with the structures */
40#define EDDPARMSIZE 74
41#define CHECKEXTENSIONSPRESENT 0x41
42#define GETDEVICEPARAMETERS 0x48
43#define LEGACYGETDEVICEPARAMETERS 0x08
44#define EDDMAGIC1 0x55AA
45#define EDDMAGIC2 0xAA55
46
47
48#define READ_SECTORS 0x02 /* int13 AH=0x02 is READ_SECTORS command */
49#define EDD_MBR_SIG_OFFSET 0x1B8 /* offset of signature in the MBR */
50#define EDD_MBR_SIG_BUF 0x290 /* addr in boot params */
51#define EDD_MBR_SIG_MAX 16 /* max number of signatures to store */
52#define EDD_MBR_SIG_NR_BUF 0x1ea /* addr of number of MBR signtaures at EDD_MBR_SIG_BUF
53 in boot_params - treat this as 1 byte */
54
55#ifndef __ASSEMBLY__
56
57#define EDD_EXT_FIXED_DISK_ACCESS (1 << 0)
58#define EDD_EXT_DEVICE_LOCKING_AND_EJECTING (1 << 1)
59#define EDD_EXT_ENHANCED_DISK_DRIVE_SUPPORT (1 << 2)
60#define EDD_EXT_64BIT_EXTENSIONS (1 << 3)
61
62#define EDD_INFO_DMA_BOUNDARY_ERROR_TRANSPARENT (1 << 0)
63#define EDD_INFO_GEOMETRY_VALID (1 << 1)
64#define EDD_INFO_REMOVABLE (1 << 2)
65#define EDD_INFO_WRITE_VERIFY (1 << 3)
66#define EDD_INFO_MEDIA_CHANGE_NOTIFICATION (1 << 4)
67#define EDD_INFO_LOCKABLE (1 << 5)
68#define EDD_INFO_NO_MEDIA_PRESENT (1 << 6)
69#define EDD_INFO_USE_INT13_FN50 (1 << 7)
70
71struct edd_device_params {
72 __u16 length;
73 __u16 info_flags;
74 __u32 num_default_cylinders;
75 __u32 num_default_heads;
76 __u32 sectors_per_track;
77 __u64 number_of_sectors;
78 __u16 bytes_per_sector;
79 __u32 dpte_ptr; /* 0xFFFFFFFF for our purposes */
80 __u16 key; /* = 0xBEDD */
81 __u8 device_path_info_length; /* = 44 */
82 __u8 reserved2;
83 __u16 reserved3;
84 __u8 host_bus_type[4];
85 __u8 interface_type[8];
86 union {
87 struct {
88 __u16 base_address;
89 __u16 reserved1;
90 __u32 reserved2;
91 } __attribute__ ((packed)) isa;
92 struct {
93 __u8 bus;
94 __u8 slot;
95 __u8 function;
96 __u8 channel;
97 __u32 reserved;
98 } __attribute__ ((packed)) pci;
99 /* pcix is same as pci */
100 struct {
101 __u64 reserved;
102 } __attribute__ ((packed)) ibnd;
103 struct {
104 __u64 reserved;
105 } __attribute__ ((packed)) xprs;
106 struct {
107 __u64 reserved;
108 } __attribute__ ((packed)) htpt;
109 struct {
110 __u64 reserved;
111 } __attribute__ ((packed)) unknown;
112 } interface_path;
113 union {
114 struct {
115 __u8 device;
116 __u8 reserved1;
117 __u16 reserved2;
118 __u32 reserved3;
119 __u64 reserved4;
120 } __attribute__ ((packed)) ata;
121 struct {
122 __u8 device;
123 __u8 lun;
124 __u8 reserved1;
125 __u8 reserved2;
126 __u32 reserved3;
127 __u64 reserved4;
128 } __attribute__ ((packed)) atapi;
129 struct {
130 __u16 id;
131 __u64 lun;
132 __u16 reserved1;
133 __u32 reserved2;
134 } __attribute__ ((packed)) scsi;
135 struct {
136 __u64 serial_number;
137 __u64 reserved;
138 } __attribute__ ((packed)) usb;
139 struct {
140 __u64 eui;
141 __u64 reserved;
142 } __attribute__ ((packed)) i1394;
143 struct {
144 __u64 wwid;
145 __u64 lun;
146 } __attribute__ ((packed)) fibre;
147 struct {
148 __u64 identity_tag;
149 __u64 reserved;
150 } __attribute__ ((packed)) i2o;
151 struct {
152 __u32 array_number;
153 __u32 reserved1;
154 __u64 reserved2;
155 } __attribute__ ((packed)) raid;
156 struct {
157 __u8 device;
158 __u8 reserved1;
159 __u16 reserved2;
160 __u32 reserved3;
161 __u64 reserved4;
162 } __attribute__ ((packed)) sata;
163 struct {
164 __u64 reserved1;
165 __u64 reserved2;
166 } __attribute__ ((packed)) unknown;
167 } device_path;
168 __u8 reserved4;
169 __u8 checksum;
170} __attribute__ ((packed));
171
172struct edd_info {
173 __u8 device;
174 __u8 version;
175 __u16 interface_support;
176 __u16 legacy_max_cylinder;
177 __u8 legacy_max_head;
178 __u8 legacy_sectors_per_track;
179 struct edd_device_params params;
180} __attribute__ ((packed));
181
182struct edd {
183 unsigned int mbr_signature[EDD_MBR_SIG_MAX];
184 struct edd_info edd_info[EDDMAXNR];
185 unsigned char mbr_signature_nr;
186 unsigned char edd_info_nr;
187};
188
189#endif /*!__ASSEMBLY__ */
190
191#endif /* _UAPI_LINUX_EDD_H */
diff --git a/include/linux/efs_fs_sb.h b/include/uapi/linux/efs_fs_sb.h
index a01be90c58cc..a01be90c58cc 100644
--- a/include/linux/efs_fs_sb.h
+++ b/include/uapi/linux/efs_fs_sb.h
diff --git a/include/linux/elf-em.h b/include/uapi/linux/elf-em.h
index 8e2b7bac4378..8e2b7bac4378 100644
--- a/include/linux/elf-em.h
+++ b/include/uapi/linux/elf-em.h
diff --git a/include/uapi/linux/elf-fdpic.h b/include/uapi/linux/elf-fdpic.h
new file mode 100644
index 000000000000..3921e33aec8e
--- /dev/null
+++ b/include/uapi/linux/elf-fdpic.h
@@ -0,0 +1,34 @@
1/* elf-fdpic.h: FDPIC ELF load map
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _UAPI_LINUX_ELF_FDPIC_H
13#define _UAPI_LINUX_ELF_FDPIC_H
14
15#include <linux/elf.h>
16
17#define PT_GNU_STACK (PT_LOOS + 0x474e551)
18
19/* segment mappings for ELF FDPIC libraries/executables/interpreters */
20struct elf32_fdpic_loadseg {
21 Elf32_Addr addr; /* core address to which mapped */
22 Elf32_Addr p_vaddr; /* VMA recorded in file */
23 Elf32_Word p_memsz; /* allocation size recorded in file */
24};
25
26struct elf32_fdpic_loadmap {
27 Elf32_Half version; /* version of these structures, just in case... */
28 Elf32_Half nsegs; /* number of segments */
29 struct elf32_fdpic_loadseg segs[];
30};
31
32#define ELF32_FDPIC_LOADMAP_VERSION 0x0000
33
34#endif /* _UAPI_LINUX_ELF_FDPIC_H */
diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h
new file mode 100644
index 000000000000..126a8175e3e2
--- /dev/null
+++ b/include/uapi/linux/elf.h
@@ -0,0 +1,414 @@
1#ifndef _UAPI_LINUX_ELF_H
2#define _UAPI_LINUX_ELF_H
3
4#include <linux/types.h>
5#include <linux/elf-em.h>
6
7/* 32-bit ELF base types. */
8typedef __u32 Elf32_Addr;
9typedef __u16 Elf32_Half;
10typedef __u32 Elf32_Off;
11typedef __s32 Elf32_Sword;
12typedef __u32 Elf32_Word;
13
14/* 64-bit ELF base types. */
15typedef __u64 Elf64_Addr;
16typedef __u16 Elf64_Half;
17typedef __s16 Elf64_SHalf;
18typedef __u64 Elf64_Off;
19typedef __s32 Elf64_Sword;
20typedef __u32 Elf64_Word;
21typedef __u64 Elf64_Xword;
22typedef __s64 Elf64_Sxword;
23
24/* These constants are for the segment types stored in the image headers */
25#define PT_NULL 0
26#define PT_LOAD 1
27#define PT_DYNAMIC 2
28#define PT_INTERP 3
29#define PT_NOTE 4
30#define PT_SHLIB 5
31#define PT_PHDR 6
32#define PT_TLS 7 /* Thread local storage segment */
33#define PT_LOOS 0x60000000 /* OS-specific */
34#define PT_HIOS 0x6fffffff /* OS-specific */
35#define PT_LOPROC 0x70000000
36#define PT_HIPROC 0x7fffffff
37#define PT_GNU_EH_FRAME 0x6474e550
38
39#define PT_GNU_STACK (PT_LOOS + 0x474e551)
40
41/*
42 * Extended Numbering
43 *
44 * If the real number of program header table entries is larger than
45 * or equal to PN_XNUM(0xffff), it is set to sh_info field of the
46 * section header at index 0, and PN_XNUM is set to e_phnum
47 * field. Otherwise, the section header at index 0 is zero
48 * initialized, if it exists.
49 *
50 * Specifications are available in:
51 *
52 * - Sun microsystems: Linker and Libraries.
53 * Part No: 817-1984-17, September 2008.
54 * URL: http://docs.sun.com/app/docs/doc/817-1984
55 *
56 * - System V ABI AMD64 Architecture Processor Supplement
57 * Draft Version 0.99.,
58 * May 11, 2009.
59 * URL: http://www.x86-64.org/
60 */
61#define PN_XNUM 0xffff
62
63/* These constants define the different elf file types */
64#define ET_NONE 0
65#define ET_REL 1
66#define ET_EXEC 2
67#define ET_DYN 3
68#define ET_CORE 4
69#define ET_LOPROC 0xff00
70#define ET_HIPROC 0xffff
71
72/* This is the info that is needed to parse the dynamic section of the file */
73#define DT_NULL 0
74#define DT_NEEDED 1
75#define DT_PLTRELSZ 2
76#define DT_PLTGOT 3
77#define DT_HASH 4
78#define DT_STRTAB 5
79#define DT_SYMTAB 6
80#define DT_RELA 7
81#define DT_RELASZ 8
82#define DT_RELAENT 9
83#define DT_STRSZ 10
84#define DT_SYMENT 11
85#define DT_INIT 12
86#define DT_FINI 13
87#define DT_SONAME 14
88#define DT_RPATH 15
89#define DT_SYMBOLIC 16
90#define DT_REL 17
91#define DT_RELSZ 18
92#define DT_RELENT 19
93#define DT_PLTREL 20
94#define DT_DEBUG 21
95#define DT_TEXTREL 22
96#define DT_JMPREL 23
97#define DT_ENCODING 32
98#define OLD_DT_LOOS 0x60000000
99#define DT_LOOS 0x6000000d
100#define DT_HIOS 0x6ffff000
101#define DT_VALRNGLO 0x6ffffd00
102#define DT_VALRNGHI 0x6ffffdff
103#define DT_ADDRRNGLO 0x6ffffe00
104#define DT_ADDRRNGHI 0x6ffffeff
105#define DT_VERSYM 0x6ffffff0
106#define DT_RELACOUNT 0x6ffffff9
107#define DT_RELCOUNT 0x6ffffffa
108#define DT_FLAGS_1 0x6ffffffb
109#define DT_VERDEF 0x6ffffffc
110#define DT_VERDEFNUM 0x6ffffffd
111#define DT_VERNEED 0x6ffffffe
112#define DT_VERNEEDNUM 0x6fffffff
113#define OLD_DT_HIOS 0x6fffffff
114#define DT_LOPROC 0x70000000
115#define DT_HIPROC 0x7fffffff
116
117/* This info is needed when parsing the symbol table */
118#define STB_LOCAL 0
119#define STB_GLOBAL 1
120#define STB_WEAK 2
121
122#define STT_NOTYPE 0
123#define STT_OBJECT 1
124#define STT_FUNC 2
125#define STT_SECTION 3
126#define STT_FILE 4
127#define STT_COMMON 5
128#define STT_TLS 6
129
130#define ELF_ST_BIND(x) ((x) >> 4)
131#define ELF_ST_TYPE(x) (((unsigned int) x) & 0xf)
132#define ELF32_ST_BIND(x) ELF_ST_BIND(x)
133#define ELF32_ST_TYPE(x) ELF_ST_TYPE(x)
134#define ELF64_ST_BIND(x) ELF_ST_BIND(x)
135#define ELF64_ST_TYPE(x) ELF_ST_TYPE(x)
136
137typedef struct dynamic{
138 Elf32_Sword d_tag;
139 union{
140 Elf32_Sword d_val;
141 Elf32_Addr d_ptr;
142 } d_un;
143} Elf32_Dyn;
144
145typedef struct {
146 Elf64_Sxword d_tag; /* entry tag value */
147 union {
148 Elf64_Xword d_val;
149 Elf64_Addr d_ptr;
150 } d_un;
151} Elf64_Dyn;
152
153/* The following are used with relocations */
154#define ELF32_R_SYM(x) ((x) >> 8)
155#define ELF32_R_TYPE(x) ((x) & 0xff)
156
157#define ELF64_R_SYM(i) ((i) >> 32)
158#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
159
160typedef struct elf32_rel {
161 Elf32_Addr r_offset;
162 Elf32_Word r_info;
163} Elf32_Rel;
164
165typedef struct elf64_rel {
166 Elf64_Addr r_offset; /* Location at which to apply the action */
167 Elf64_Xword r_info; /* index and type of relocation */
168} Elf64_Rel;
169
170typedef struct elf32_rela{
171 Elf32_Addr r_offset;
172 Elf32_Word r_info;
173 Elf32_Sword r_addend;
174} Elf32_Rela;
175
176typedef struct elf64_rela {
177 Elf64_Addr r_offset; /* Location at which to apply the action */
178 Elf64_Xword r_info; /* index and type of relocation */
179 Elf64_Sxword r_addend; /* Constant addend used to compute value */
180} Elf64_Rela;
181
182typedef struct elf32_sym{
183 Elf32_Word st_name;
184 Elf32_Addr st_value;
185 Elf32_Word st_size;
186 unsigned char st_info;
187 unsigned char st_other;
188 Elf32_Half st_shndx;
189} Elf32_Sym;
190
191typedef struct elf64_sym {
192 Elf64_Word st_name; /* Symbol name, index in string tbl */
193 unsigned char st_info; /* Type and binding attributes */
194 unsigned char st_other; /* No defined meaning, 0 */
195 Elf64_Half st_shndx; /* Associated section index */
196 Elf64_Addr st_value; /* Value of the symbol */
197 Elf64_Xword st_size; /* Associated symbol size */
198} Elf64_Sym;
199
200
201#define EI_NIDENT 16
202
203typedef struct elf32_hdr{
204 unsigned char e_ident[EI_NIDENT];
205 Elf32_Half e_type;
206 Elf32_Half e_machine;
207 Elf32_Word e_version;
208 Elf32_Addr e_entry; /* Entry point */
209 Elf32_Off e_phoff;
210 Elf32_Off e_shoff;
211 Elf32_Word e_flags;
212 Elf32_Half e_ehsize;
213 Elf32_Half e_phentsize;
214 Elf32_Half e_phnum;
215 Elf32_Half e_shentsize;
216 Elf32_Half e_shnum;
217 Elf32_Half e_shstrndx;
218} Elf32_Ehdr;
219
220typedef struct elf64_hdr {
221 unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */
222 Elf64_Half e_type;
223 Elf64_Half e_machine;
224 Elf64_Word e_version;
225 Elf64_Addr e_entry; /* Entry point virtual address */
226 Elf64_Off e_phoff; /* Program header table file offset */
227 Elf64_Off e_shoff; /* Section header table file offset */
228 Elf64_Word e_flags;
229 Elf64_Half e_ehsize;
230 Elf64_Half e_phentsize;
231 Elf64_Half e_phnum;
232 Elf64_Half e_shentsize;
233 Elf64_Half e_shnum;
234 Elf64_Half e_shstrndx;
235} Elf64_Ehdr;
236
237/* These constants define the permissions on sections in the program
238 header, p_flags. */
239#define PF_R 0x4
240#define PF_W 0x2
241#define PF_X 0x1
242
243typedef struct elf32_phdr{
244 Elf32_Word p_type;
245 Elf32_Off p_offset;
246 Elf32_Addr p_vaddr;
247 Elf32_Addr p_paddr;
248 Elf32_Word p_filesz;
249 Elf32_Word p_memsz;
250 Elf32_Word p_flags;
251 Elf32_Word p_align;
252} Elf32_Phdr;
253
254typedef struct elf64_phdr {
255 Elf64_Word p_type;
256 Elf64_Word p_flags;
257 Elf64_Off p_offset; /* Segment file offset */
258 Elf64_Addr p_vaddr; /* Segment virtual address */
259 Elf64_Addr p_paddr; /* Segment physical address */
260 Elf64_Xword p_filesz; /* Segment size in file */
261 Elf64_Xword p_memsz; /* Segment size in memory */
262 Elf64_Xword p_align; /* Segment alignment, file & memory */
263} Elf64_Phdr;
264
265/* sh_type */
266#define SHT_NULL 0
267#define SHT_PROGBITS 1
268#define SHT_SYMTAB 2
269#define SHT_STRTAB 3
270#define SHT_RELA 4
271#define SHT_HASH 5
272#define SHT_DYNAMIC 6
273#define SHT_NOTE 7
274#define SHT_NOBITS 8
275#define SHT_REL 9
276#define SHT_SHLIB 10
277#define SHT_DYNSYM 11
278#define SHT_NUM 12
279#define SHT_LOPROC 0x70000000
280#define SHT_HIPROC 0x7fffffff
281#define SHT_LOUSER 0x80000000
282#define SHT_HIUSER 0xffffffff
283
284/* sh_flags */
285#define SHF_WRITE 0x1
286#define SHF_ALLOC 0x2
287#define SHF_EXECINSTR 0x4
288#define SHF_MASKPROC 0xf0000000
289
290/* special section indexes */
291#define SHN_UNDEF 0
292#define SHN_LORESERVE 0xff00
293#define SHN_LOPROC 0xff00
294#define SHN_HIPROC 0xff1f
295#define SHN_ABS 0xfff1
296#define SHN_COMMON 0xfff2
297#define SHN_HIRESERVE 0xffff
298
299typedef struct elf32_shdr {
300 Elf32_Word sh_name;
301 Elf32_Word sh_type;
302 Elf32_Word sh_flags;
303 Elf32_Addr sh_addr;
304 Elf32_Off sh_offset;
305 Elf32_Word sh_size;
306 Elf32_Word sh_link;
307 Elf32_Word sh_info;
308 Elf32_Word sh_addralign;
309 Elf32_Word sh_entsize;
310} Elf32_Shdr;
311
312typedef struct elf64_shdr {
313 Elf64_Word sh_name; /* Section name, index in string tbl */
314 Elf64_Word sh_type; /* Type of section */
315 Elf64_Xword sh_flags; /* Miscellaneous section attributes */
316 Elf64_Addr sh_addr; /* Section virtual addr at execution */
317 Elf64_Off sh_offset; /* Section file offset */
318 Elf64_Xword sh_size; /* Size of section in bytes */
319 Elf64_Word sh_link; /* Index of another section */
320 Elf64_Word sh_info; /* Additional section information */
321 Elf64_Xword sh_addralign; /* Section alignment */
322 Elf64_Xword sh_entsize; /* Entry size if section holds table */
323} Elf64_Shdr;
324
325#define EI_MAG0 0 /* e_ident[] indexes */
326#define EI_MAG1 1
327#define EI_MAG2 2
328#define EI_MAG3 3
329#define EI_CLASS 4
330#define EI_DATA 5
331#define EI_VERSION 6
332#define EI_OSABI 7
333#define EI_PAD 8
334
335#define ELFMAG0 0x7f /* EI_MAG */
336#define ELFMAG1 'E'
337#define ELFMAG2 'L'
338#define ELFMAG3 'F'
339#define ELFMAG "\177ELF"
340#define SELFMAG 4
341
342#define ELFCLASSNONE 0 /* EI_CLASS */
343#define ELFCLASS32 1
344#define ELFCLASS64 2
345#define ELFCLASSNUM 3
346
347#define ELFDATANONE 0 /* e_ident[EI_DATA] */
348#define ELFDATA2LSB 1
349#define ELFDATA2MSB 2
350
351#define EV_NONE 0 /* e_version, EI_VERSION */
352#define EV_CURRENT 1
353#define EV_NUM 2
354
355#define ELFOSABI_NONE 0
356#define ELFOSABI_LINUX 3
357
358#ifndef ELF_OSABI
359#define ELF_OSABI ELFOSABI_NONE
360#endif
361
362/*
363 * Notes used in ET_CORE. Architectures export some of the arch register sets
364 * using the corresponding note types via the PTRACE_GETREGSET and
365 * PTRACE_SETREGSET requests.
366 */
367#define NT_PRSTATUS 1
368#define NT_PRFPREG 2
369#define NT_PRPSINFO 3
370#define NT_TASKSTRUCT 4
371#define NT_AUXV 6
372/*
373 * Note to userspace developers: size of NT_SIGINFO note may increase
374 * in the future to accomodate more fields, don't assume it is fixed!
375 */
376#define NT_SIGINFO 0x53494749
377#define NT_FILE 0x46494c45
378#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
379#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
380#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */
381#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
382#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
383#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
384#define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */
385#define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */
386#define NT_S390_TIMER 0x301 /* s390 timer register */
387#define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */
388#define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */
389#define NT_S390_CTRS 0x304 /* s390 control registers */
390#define NT_S390_PREFIX 0x305 /* s390 prefix register */
391#define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */
392#define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */
393#define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */
394#define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */
395#define NT_ARM_TLS 0x401 /* ARM TLS register */
396#define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */
397#define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */
398
399
400/* Note header in a PT_NOTE section */
401typedef struct elf32_note {
402 Elf32_Word n_namesz; /* Name size */
403 Elf32_Word n_descsz; /* Content size */
404 Elf32_Word n_type; /* Content type */
405} Elf32_Nhdr;
406
407/* Note header in a PT_NOTE section */
408typedef struct elf64_note {
409 Elf64_Word n_namesz; /* Name size */
410 Elf64_Word n_descsz; /* Content size */
411 Elf64_Word n_type; /* Content type */
412} Elf64_Nhdr;
413
414#endif /* _UAPI_LINUX_ELF_H */
diff --git a/include/uapi/linux/elfcore.h b/include/uapi/linux/elfcore.h
new file mode 100644
index 000000000000..569737cfb557
--- /dev/null
+++ b/include/uapi/linux/elfcore.h
@@ -0,0 +1,100 @@
1#ifndef _UAPI_LINUX_ELFCORE_H
2#define _UAPI_LINUX_ELFCORE_H
3
4#include <linux/types.h>
5#include <linux/signal.h>
6#include <linux/time.h>
7#include <linux/ptrace.h>
8#include <linux/elf.h>
9#include <linux/fs.h>
10
11struct elf_siginfo
12{
13 int si_signo; /* signal number */
14 int si_code; /* extra code */
15 int si_errno; /* errno */
16};
17
18
19#ifndef __KERNEL__
20typedef elf_greg_t greg_t;
21typedef elf_gregset_t gregset_t;
22typedef elf_fpregset_t fpregset_t;
23typedef elf_fpxregset_t fpxregset_t;
24#define NGREG ELF_NGREG
25#endif
26
27/*
28 * Definitions to generate Intel SVR4-like core files.
29 * These mostly have the same names as the SVR4 types with "elf_"
30 * tacked on the front to prevent clashes with linux definitions,
31 * and the typedef forms have been avoided. This is mostly like
32 * the SVR4 structure, but more Linuxy, with things that Linux does
33 * not support and which gdb doesn't really use excluded.
34 * Fields present but not used are marked with "XXX".
35 */
36struct elf_prstatus
37{
38#if 0
39 long pr_flags; /* XXX Process flags */
40 short pr_why; /* XXX Reason for process halt */
41 short pr_what; /* XXX More detailed reason */
42#endif
43 struct elf_siginfo pr_info; /* Info associated with signal */
44 short pr_cursig; /* Current signal */
45 unsigned long pr_sigpend; /* Set of pending signals */
46 unsigned long pr_sighold; /* Set of held signals */
47#if 0
48 struct sigaltstack pr_altstack; /* Alternate stack info */
49 struct sigaction pr_action; /* Signal action for current sig */
50#endif
51 pid_t pr_pid;
52 pid_t pr_ppid;
53 pid_t pr_pgrp;
54 pid_t pr_sid;
55 struct timeval pr_utime; /* User time */
56 struct timeval pr_stime; /* System time */
57 struct timeval pr_cutime; /* Cumulative user time */
58 struct timeval pr_cstime; /* Cumulative system time */
59#if 0
60 long pr_instr; /* Current instruction */
61#endif
62 elf_gregset_t pr_reg; /* GP registers */
63#ifdef CONFIG_BINFMT_ELF_FDPIC
64 /* When using FDPIC, the loadmap addresses need to be communicated
65 * to GDB in order for GDB to do the necessary relocations. The
66 * fields (below) used to communicate this information are placed
67 * immediately after ``pr_reg'', so that the loadmap addresses may
68 * be viewed as part of the register set if so desired.
69 */
70 unsigned long pr_exec_fdpic_loadmap;
71 unsigned long pr_interp_fdpic_loadmap;
72#endif
73 int pr_fpvalid; /* True if math co-processor being used. */
74};
75
76#define ELF_PRARGSZ (80) /* Number of chars for args */
77
78struct elf_prpsinfo
79{
80 char pr_state; /* numeric process state */
81 char pr_sname; /* char for pr_state */
82 char pr_zomb; /* zombie */
83 char pr_nice; /* nice val */
84 unsigned long pr_flag; /* flags */
85 __kernel_uid_t pr_uid;
86 __kernel_gid_t pr_gid;
87 pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid;
88 /* Lots missing */
89 char pr_fname[16]; /* filename of executable */
90 char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */
91};
92
93#ifndef __KERNEL__
94typedef struct elf_prstatus prstatus_t;
95typedef struct elf_prpsinfo prpsinfo_t;
96#define PRARGSZ ELF_PRARGSZ
97#endif
98
99
100#endif /* _UAPI_LINUX_ELFCORE_H */
diff --git a/include/uapi/linux/errno.h b/include/uapi/linux/errno.h
new file mode 100644
index 000000000000..70f2bd34e335
--- /dev/null
+++ b/include/uapi/linux/errno.h
@@ -0,0 +1 @@
#include <asm/errno.h>
diff --git a/include/uapi/linux/errqueue.h b/include/uapi/linux/errqueue.h
new file mode 100644
index 000000000000..aacd4fb7102a
--- /dev/null
+++ b/include/uapi/linux/errqueue.h
@@ -0,0 +1,26 @@
1#ifndef _UAPI_LINUX_ERRQUEUE_H
2#define _UAPI_LINUX_ERRQUEUE_H
3
4#include <linux/types.h>
5
6struct sock_extended_err {
7 __u32 ee_errno;
8 __u8 ee_origin;
9 __u8 ee_type;
10 __u8 ee_code;
11 __u8 ee_pad;
12 __u32 ee_info;
13 __u32 ee_data;
14};
15
16#define SO_EE_ORIGIN_NONE 0
17#define SO_EE_ORIGIN_LOCAL 1
18#define SO_EE_ORIGIN_ICMP 2
19#define SO_EE_ORIGIN_ICMP6 3
20#define SO_EE_ORIGIN_TXSTATUS 4
21#define SO_EE_ORIGIN_TIMESTAMPING SO_EE_ORIGIN_TXSTATUS
22
23#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1))
24
25
26#endif /* _UAPI_LINUX_ERRQUEUE_H */
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
new file mode 100644
index 000000000000..d3eaaaf1009e
--- /dev/null
+++ b/include/uapi/linux/ethtool.h
@@ -0,0 +1,1085 @@
1/*
2 * ethtool.h: Defines for Linux ethtool.
3 *
4 * Copyright (C) 1998 David S. Miller (davem@redhat.com)
5 * Copyright 2001 Jeff Garzik <jgarzik@pobox.com>
6 * Portions Copyright 2001 Sun Microsystems (thockin@sun.com)
7 * Portions Copyright 2002 Intel (eli.kupermann@intel.com,
8 * christopher.leech@intel.com,
9 * scott.feldman@intel.com)
10 * Portions Copyright (C) Sun Microsystems 2008
11 */
12
13#ifndef _UAPI_LINUX_ETHTOOL_H
14#define _UAPI_LINUX_ETHTOOL_H
15
16#include <linux/types.h>
17#include <linux/if_ether.h>
18
19/* This should work for both 32 and 64 bit userland. */
20struct ethtool_cmd {
21 __u32 cmd;
22 __u32 supported; /* Features this interface supports */
23 __u32 advertising; /* Features this interface advertises */
24 __u16 speed; /* The forced speed (lower bits) in
25 * Mbps. Please use
26 * ethtool_cmd_speed()/_set() to
27 * access it */
28 __u8 duplex; /* Duplex, half or full */
29 __u8 port; /* Which connector port */
30 __u8 phy_address; /* MDIO PHY address (PRTAD for clause 45).
31 * May be read-only or read-write
32 * depending on the driver.
33 */
34 __u8 transceiver; /* Which transceiver to use */
35 __u8 autoneg; /* Enable or disable autonegotiation */
36 __u8 mdio_support; /* MDIO protocols supported. Read-only.
37 * Not set by all drivers.
38 */
39 __u32 maxtxpkt; /* Tx pkts before generating tx int */
40 __u32 maxrxpkt; /* Rx pkts before generating rx int */
41 __u16 speed_hi; /* The forced speed (upper
42 * bits) in Mbps. Please use
43 * ethtool_cmd_speed()/_set() to
44 * access it */
45 __u8 eth_tp_mdix; /* twisted pair MDI-X status */
46 __u8 eth_tp_mdix_ctrl; /* twisted pair MDI-X control, when set,
47 * link should be renegotiated if necessary
48 */
49 __u32 lp_advertising; /* Features the link partner advertises */
50 __u32 reserved[2];
51};
52
53static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
54 __u32 speed)
55{
56
57 ep->speed = (__u16)speed;
58 ep->speed_hi = (__u16)(speed >> 16);
59}
60
61static inline __u32 ethtool_cmd_speed(const struct ethtool_cmd *ep)
62{
63 return (ep->speed_hi << 16) | ep->speed;
64}
65
66/* Device supports clause 22 register access to PHY or peripherals
67 * using the interface defined in <linux/mii.h>. This should not be
68 * set if there are known to be no such peripherals present or if
69 * the driver only emulates clause 22 registers for compatibility.
70 */
71#define ETH_MDIO_SUPPORTS_C22 1
72
73/* Device supports clause 45 register access to PHY or peripherals
74 * using the interface defined in <linux/mii.h> and <linux/mdio.h>.
75 * This should not be set if there are known to be no such peripherals
76 * present.
77 */
78#define ETH_MDIO_SUPPORTS_C45 2
79
80#define ETHTOOL_FWVERS_LEN 32
81#define ETHTOOL_BUSINFO_LEN 32
82/* these strings are set to whatever the driver author decides... */
83struct ethtool_drvinfo {
84 __u32 cmd;
85 char driver[32]; /* driver short name, "tulip", "eepro100" */
86 char version[32]; /* driver version string */
87 char fw_version[ETHTOOL_FWVERS_LEN]; /* firmware version string */
88 char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */
89 /* For PCI devices, use pci_name(pci_dev). */
90 char reserved1[32];
91 char reserved2[12];
92 /*
93 * Some struct members below are filled in
94 * using ops->get_sset_count(). Obtaining
95 * this info from ethtool_drvinfo is now
96 * deprecated; Use ETHTOOL_GSSET_INFO
97 * instead.
98 */
99 __u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */
100 __u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */
101 __u32 testinfo_len;
102 __u32 eedump_len; /* Size of data from ETHTOOL_GEEPROM (bytes) */
103 __u32 regdump_len; /* Size of data from ETHTOOL_GREGS (bytes) */
104};
105
106#define SOPASS_MAX 6
107/* wake-on-lan settings */
108struct ethtool_wolinfo {
109 __u32 cmd;
110 __u32 supported;
111 __u32 wolopts;
112 __u8 sopass[SOPASS_MAX]; /* SecureOn(tm) password */
113};
114
115/* for passing single values */
116struct ethtool_value {
117 __u32 cmd;
118 __u32 data;
119};
120
121/* for passing big chunks of data */
122struct ethtool_regs {
123 __u32 cmd;
124 __u32 version; /* driver-specific, indicates different chips/revs */
125 __u32 len; /* bytes */
126 __u8 data[0];
127};
128
129/* for passing EEPROM chunks */
130struct ethtool_eeprom {
131 __u32 cmd;
132 __u32 magic;
133 __u32 offset; /* in bytes */
134 __u32 len; /* in bytes */
135 __u8 data[0];
136};
137
138/**
139 * struct ethtool_eee - Energy Efficient Ethernet information
140 * @cmd: ETHTOOL_{G,S}EEE
141 * @supported: Mask of %SUPPORTED_* flags for the speed/duplex combinations
142 * for which there is EEE support.
143 * @advertised: Mask of %ADVERTISED_* flags for the speed/duplex combinations
144 * advertised as eee capable.
145 * @lp_advertised: Mask of %ADVERTISED_* flags for the speed/duplex
146 * combinations advertised by the link partner as eee capable.
147 * @eee_active: Result of the eee auto negotiation.
148 * @eee_enabled: EEE configured mode (enabled/disabled).
149 * @tx_lpi_enabled: Whether the interface should assert its tx lpi, given
150 * that eee was negotiated.
151 * @tx_lpi_timer: Time in microseconds the interface delays prior to asserting
152 * its tx lpi (after reaching 'idle' state). Effective only when eee
153 * was negotiated and tx_lpi_enabled was set.
154 */
155struct ethtool_eee {
156 __u32 cmd;
157 __u32 supported;
158 __u32 advertised;
159 __u32 lp_advertised;
160 __u32 eee_active;
161 __u32 eee_enabled;
162 __u32 tx_lpi_enabled;
163 __u32 tx_lpi_timer;
164 __u32 reserved[2];
165};
166
167/**
168 * struct ethtool_modinfo - plugin module eeprom information
169 * @cmd: %ETHTOOL_GMODULEINFO
170 * @type: Standard the module information conforms to %ETH_MODULE_SFF_xxxx
171 * @eeprom_len: Length of the eeprom
172 *
173 * This structure is used to return the information to
174 * properly size memory for a subsequent call to %ETHTOOL_GMODULEEEPROM.
175 * The type code indicates the eeprom data format
176 */
177struct ethtool_modinfo {
178 __u32 cmd;
179 __u32 type;
180 __u32 eeprom_len;
181 __u32 reserved[8];
182};
183
184/**
185 * struct ethtool_coalesce - coalescing parameters for IRQs and stats updates
186 * @cmd: ETHTOOL_{G,S}COALESCE
187 * @rx_coalesce_usecs: How many usecs to delay an RX interrupt after
188 * a packet arrives.
189 * @rx_max_coalesced_frames: Maximum number of packets to receive
190 * before an RX interrupt.
191 * @rx_coalesce_usecs_irq: Same as @rx_coalesce_usecs, except that
192 * this value applies while an IRQ is being serviced by the host.
193 * @rx_max_coalesced_frames_irq: Same as @rx_max_coalesced_frames,
194 * except that this value applies while an IRQ is being serviced
195 * by the host.
196 * @tx_coalesce_usecs: How many usecs to delay a TX interrupt after
197 * a packet is sent.
198 * @tx_max_coalesced_frames: Maximum number of packets to be sent
199 * before a TX interrupt.
200 * @tx_coalesce_usecs_irq: Same as @tx_coalesce_usecs, except that
201 * this value applies while an IRQ is being serviced by the host.
202 * @tx_max_coalesced_frames_irq: Same as @tx_max_coalesced_frames,
203 * except that this value applies while an IRQ is being serviced
204 * by the host.
205 * @stats_block_coalesce_usecs: How many usecs to delay in-memory
206 * statistics block updates. Some drivers do not have an
207 * in-memory statistic block, and in such cases this value is
208 * ignored. This value must not be zero.
209 * @use_adaptive_rx_coalesce: Enable adaptive RX coalescing.
210 * @use_adaptive_tx_coalesce: Enable adaptive TX coalescing.
211 * @pkt_rate_low: Threshold for low packet rate (packets per second).
212 * @rx_coalesce_usecs_low: How many usecs to delay an RX interrupt after
213 * a packet arrives, when the packet rate is below @pkt_rate_low.
214 * @rx_max_coalesced_frames_low: Maximum number of packets to be received
215 * before an RX interrupt, when the packet rate is below @pkt_rate_low.
216 * @tx_coalesce_usecs_low: How many usecs to delay a TX interrupt after
217 * a packet is sent, when the packet rate is below @pkt_rate_low.
218 * @tx_max_coalesced_frames_low: Maximum nuumber of packets to be sent before
219 * a TX interrupt, when the packet rate is below @pkt_rate_low.
220 * @pkt_rate_high: Threshold for high packet rate (packets per second).
221 * @rx_coalesce_usecs_high: How many usecs to delay an RX interrupt after
222 * a packet arrives, when the packet rate is above @pkt_rate_high.
223 * @rx_max_coalesced_frames_high: Maximum number of packets to be received
224 * before an RX interrupt, when the packet rate is above @pkt_rate_high.
225 * @tx_coalesce_usecs_high: How many usecs to delay a TX interrupt after
226 * a packet is sent, when the packet rate is above @pkt_rate_high.
227 * @tx_max_coalesced_frames_high: Maximum number of packets to be sent before
228 * a TX interrupt, when the packet rate is above @pkt_rate_high.
229 * @rate_sample_interval: How often to do adaptive coalescing packet rate
230 * sampling, measured in seconds. Must not be zero.
231 *
232 * Each pair of (usecs, max_frames) fields specifies this exit
233 * condition for interrupt coalescing:
234 * (usecs > 0 && time_since_first_completion >= usecs) ||
235 * (max_frames > 0 && completed_frames >= max_frames)
236 * It is illegal to set both usecs and max_frames to zero as this
237 * would cause interrupts to never be generated. To disable
238 * coalescing, set usecs = 0 and max_frames = 1.
239 *
240 * Some implementations ignore the value of max_frames and use the
241 * condition:
242 * time_since_first_completion >= usecs
243 * This is deprecated. Drivers for hardware that does not support
244 * counting completions should validate that max_frames == !rx_usecs.
245 *
246 * Adaptive RX/TX coalescing is an algorithm implemented by some
247 * drivers to improve latency under low packet rates and improve
248 * throughput under high packet rates. Some drivers only implement
249 * one of RX or TX adaptive coalescing. Anything not implemented by
250 * the driver causes these values to be silently ignored.
251 *
252 * When the packet rate is below @pkt_rate_high but above
253 * @pkt_rate_low (both measured in packets per second) the
254 * normal {rx,tx}_* coalescing parameters are used.
255 */
256struct ethtool_coalesce {
257 __u32 cmd;
258 __u32 rx_coalesce_usecs;
259 __u32 rx_max_coalesced_frames;
260 __u32 rx_coalesce_usecs_irq;
261 __u32 rx_max_coalesced_frames_irq;
262 __u32 tx_coalesce_usecs;
263 __u32 tx_max_coalesced_frames;
264 __u32 tx_coalesce_usecs_irq;
265 __u32 tx_max_coalesced_frames_irq;
266 __u32 stats_block_coalesce_usecs;
267 __u32 use_adaptive_rx_coalesce;
268 __u32 use_adaptive_tx_coalesce;
269 __u32 pkt_rate_low;
270 __u32 rx_coalesce_usecs_low;
271 __u32 rx_max_coalesced_frames_low;
272 __u32 tx_coalesce_usecs_low;
273 __u32 tx_max_coalesced_frames_low;
274 __u32 pkt_rate_high;
275 __u32 rx_coalesce_usecs_high;
276 __u32 rx_max_coalesced_frames_high;
277 __u32 tx_coalesce_usecs_high;
278 __u32 tx_max_coalesced_frames_high;
279 __u32 rate_sample_interval;
280};
281
282/* for configuring RX/TX ring parameters */
283struct ethtool_ringparam {
284 __u32 cmd; /* ETHTOOL_{G,S}RINGPARAM */
285
286 /* Read only attributes. These indicate the maximum number
287 * of pending RX/TX ring entries the driver will allow the
288 * user to set.
289 */
290 __u32 rx_max_pending;
291 __u32 rx_mini_max_pending;
292 __u32 rx_jumbo_max_pending;
293 __u32 tx_max_pending;
294
295 /* Values changeable by the user. The valid values are
296 * in the range 1 to the "*_max_pending" counterpart above.
297 */
298 __u32 rx_pending;
299 __u32 rx_mini_pending;
300 __u32 rx_jumbo_pending;
301 __u32 tx_pending;
302};
303
304/**
305 * struct ethtool_channels - configuring number of network channel
306 * @cmd: ETHTOOL_{G,S}CHANNELS
307 * @max_rx: Read only. Maximum number of receive channel the driver support.
308 * @max_tx: Read only. Maximum number of transmit channel the driver support.
309 * @max_other: Read only. Maximum number of other channel the driver support.
310 * @max_combined: Read only. Maximum number of combined channel the driver
311 * support. Set of queues RX, TX or other.
312 * @rx_count: Valid values are in the range 1 to the max_rx.
313 * @tx_count: Valid values are in the range 1 to the max_tx.
314 * @other_count: Valid values are in the range 1 to the max_other.
315 * @combined_count: Valid values are in the range 1 to the max_combined.
316 *
317 * This can be used to configure RX, TX and other channels.
318 */
319
320struct ethtool_channels {
321 __u32 cmd;
322 __u32 max_rx;
323 __u32 max_tx;
324 __u32 max_other;
325 __u32 max_combined;
326 __u32 rx_count;
327 __u32 tx_count;
328 __u32 other_count;
329 __u32 combined_count;
330};
331
332/* for configuring link flow control parameters */
333struct ethtool_pauseparam {
334 __u32 cmd; /* ETHTOOL_{G,S}PAUSEPARAM */
335
336 /* If the link is being auto-negotiated (via ethtool_cmd.autoneg
337 * being true) the user may set 'autoneg' here non-zero to have the
338 * pause parameters be auto-negotiated too. In such a case, the
339 * {rx,tx}_pause values below determine what capabilities are
340 * advertised.
341 *
342 * If 'autoneg' is zero or the link is not being auto-negotiated,
343 * then {rx,tx}_pause force the driver to use/not-use pause
344 * flow control.
345 */
346 __u32 autoneg;
347 __u32 rx_pause;
348 __u32 tx_pause;
349};
350
351#define ETH_GSTRING_LEN 32
352enum ethtool_stringset {
353 ETH_SS_TEST = 0,
354 ETH_SS_STATS,
355 ETH_SS_PRIV_FLAGS,
356 ETH_SS_NTUPLE_FILTERS, /* Do not use, GRXNTUPLE is now deprecated */
357 ETH_SS_FEATURES,
358};
359
360/* for passing string sets for data tagging */
361struct ethtool_gstrings {
362 __u32 cmd; /* ETHTOOL_GSTRINGS */
363 __u32 string_set; /* string set id e.c. ETH_SS_TEST, etc*/
364 __u32 len; /* number of strings in the string set */
365 __u8 data[0];
366};
367
368struct ethtool_sset_info {
369 __u32 cmd; /* ETHTOOL_GSSET_INFO */
370 __u32 reserved;
371 __u64 sset_mask; /* input: each bit selects an sset to query */
372 /* output: each bit a returned sset */
373 __u32 data[0]; /* ETH_SS_xxx count, in order, based on bits
374 in sset_mask. One bit implies one
375 __u32, two bits implies two
376 __u32's, etc. */
377};
378
379/**
380 * enum ethtool_test_flags - flags definition of ethtool_test
381 * @ETH_TEST_FL_OFFLINE: if set perform online and offline tests, otherwise
382 * only online tests.
383 * @ETH_TEST_FL_FAILED: Driver set this flag if test fails.
384 * @ETH_TEST_FL_EXTERNAL_LB: Application request to perform external loopback
385 * test.
386 * @ETH_TEST_FL_EXTERNAL_LB_DONE: Driver performed the external loopback test
387 */
388
389enum ethtool_test_flags {
390 ETH_TEST_FL_OFFLINE = (1 << 0),
391 ETH_TEST_FL_FAILED = (1 << 1),
392 ETH_TEST_FL_EXTERNAL_LB = (1 << 2),
393 ETH_TEST_FL_EXTERNAL_LB_DONE = (1 << 3),
394};
395
396/* for requesting NIC test and getting results*/
397struct ethtool_test {
398 __u32 cmd; /* ETHTOOL_TEST */
399 __u32 flags; /* ETH_TEST_FL_xxx */
400 __u32 reserved;
401 __u32 len; /* result length, in number of u64 elements */
402 __u64 data[0];
403};
404
405/* for dumping NIC-specific statistics */
406struct ethtool_stats {
407 __u32 cmd; /* ETHTOOL_GSTATS */
408 __u32 n_stats; /* number of u64's being returned */
409 __u64 data[0];
410};
411
412struct ethtool_perm_addr {
413 __u32 cmd; /* ETHTOOL_GPERMADDR */
414 __u32 size;
415 __u8 data[0];
416};
417
418/* boolean flags controlling per-interface behavior characteristics.
419 * When reading, the flag indicates whether or not a certain behavior
420 * is enabled/present. When writing, the flag indicates whether
421 * or not the driver should turn on (set) or off (clear) a behavior.
422 *
423 * Some behaviors may read-only (unconditionally absent or present).
424 * If such is the case, return EINVAL in the set-flags operation if the
425 * flag differs from the read-only value.
426 */
427enum ethtool_flags {
428 ETH_FLAG_TXVLAN = (1 << 7), /* TX VLAN offload enabled */
429 ETH_FLAG_RXVLAN = (1 << 8), /* RX VLAN offload enabled */
430 ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
431 ETH_FLAG_NTUPLE = (1 << 27), /* N-tuple filters enabled */
432 ETH_FLAG_RXHASH = (1 << 28),
433};
434
435/* The following structures are for supporting RX network flow
436 * classification and RX n-tuple configuration. Note, all multibyte
437 * fields, e.g., ip4src, ip4dst, psrc, pdst, spi, etc. are expected to
438 * be in network byte order.
439 */
440
441/**
442 * struct ethtool_tcpip4_spec - flow specification for TCP/IPv4 etc.
443 * @ip4src: Source host
444 * @ip4dst: Destination host
445 * @psrc: Source port
446 * @pdst: Destination port
447 * @tos: Type-of-service
448 *
449 * This can be used to specify a TCP/IPv4, UDP/IPv4 or SCTP/IPv4 flow.
450 */
451struct ethtool_tcpip4_spec {
452 __be32 ip4src;
453 __be32 ip4dst;
454 __be16 psrc;
455 __be16 pdst;
456 __u8 tos;
457};
458
459/**
460 * struct ethtool_ah_espip4_spec - flow specification for IPsec/IPv4
461 * @ip4src: Source host
462 * @ip4dst: Destination host
463 * @spi: Security parameters index
464 * @tos: Type-of-service
465 *
466 * This can be used to specify an IPsec transport or tunnel over IPv4.
467 */
468struct ethtool_ah_espip4_spec {
469 __be32 ip4src;
470 __be32 ip4dst;
471 __be32 spi;
472 __u8 tos;
473};
474
475#define ETH_RX_NFC_IP4 1
476
477/**
478 * struct ethtool_usrip4_spec - general flow specification for IPv4
479 * @ip4src: Source host
480 * @ip4dst: Destination host
481 * @l4_4_bytes: First 4 bytes of transport (layer 4) header
482 * @tos: Type-of-service
483 * @ip_ver: Value must be %ETH_RX_NFC_IP4; mask must be 0
484 * @proto: Transport protocol number; mask must be 0
485 */
486struct ethtool_usrip4_spec {
487 __be32 ip4src;
488 __be32 ip4dst;
489 __be32 l4_4_bytes;
490 __u8 tos;
491 __u8 ip_ver;
492 __u8 proto;
493};
494
495union ethtool_flow_union {
496 struct ethtool_tcpip4_spec tcp_ip4_spec;
497 struct ethtool_tcpip4_spec udp_ip4_spec;
498 struct ethtool_tcpip4_spec sctp_ip4_spec;
499 struct ethtool_ah_espip4_spec ah_ip4_spec;
500 struct ethtool_ah_espip4_spec esp_ip4_spec;
501 struct ethtool_usrip4_spec usr_ip4_spec;
502 struct ethhdr ether_spec;
503 __u8 hdata[60];
504};
505
506struct ethtool_flow_ext {
507 __be16 vlan_etype;
508 __be16 vlan_tci;
509 __be32 data[2];
510};
511
512/**
513 * struct ethtool_rx_flow_spec - classification rule for RX flows
514 * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
515 * @h_u: Flow fields to match (dependent on @flow_type)
516 * @h_ext: Additional fields to match
517 * @m_u: Masks for flow field bits to be matched
518 * @m_ext: Masks for additional field bits to be matched
519 * Note, all additional fields must be ignored unless @flow_type
520 * includes the %FLOW_EXT flag.
521 * @ring_cookie: RX ring/queue index to deliver to, or %RX_CLS_FLOW_DISC
522 * if packets should be discarded
523 * @location: Location of rule in the table. Locations must be
524 * numbered such that a flow matching multiple rules will be
525 * classified according to the first (lowest numbered) rule.
526 */
527struct ethtool_rx_flow_spec {
528 __u32 flow_type;
529 union ethtool_flow_union h_u;
530 struct ethtool_flow_ext h_ext;
531 union ethtool_flow_union m_u;
532 struct ethtool_flow_ext m_ext;
533 __u64 ring_cookie;
534 __u32 location;
535};
536
537/**
538 * struct ethtool_rxnfc - command to get or set RX flow classification rules
539 * @cmd: Specific command number - %ETHTOOL_GRXFH, %ETHTOOL_SRXFH,
540 * %ETHTOOL_GRXRINGS, %ETHTOOL_GRXCLSRLCNT, %ETHTOOL_GRXCLSRULE,
541 * %ETHTOOL_GRXCLSRLALL, %ETHTOOL_SRXCLSRLDEL or %ETHTOOL_SRXCLSRLINS
542 * @flow_type: Type of flow to be affected, e.g. %TCP_V4_FLOW
543 * @data: Command-dependent value
544 * @fs: Flow classification rule
545 * @rule_cnt: Number of rules to be affected
546 * @rule_locs: Array of used rule locations
547 *
548 * For %ETHTOOL_GRXFH and %ETHTOOL_SRXFH, @data is a bitmask indicating
549 * the fields included in the flow hash, e.g. %RXH_IP_SRC. The following
550 * structure fields must not be used.
551 *
552 * For %ETHTOOL_GRXRINGS, @data is set to the number of RX rings/queues
553 * on return.
554 *
555 * For %ETHTOOL_GRXCLSRLCNT, @rule_cnt is set to the number of defined
556 * rules on return. If @data is non-zero on return then it is the
557 * size of the rule table, plus the flag %RX_CLS_LOC_SPECIAL if the
558 * driver supports any special location values. If that flag is not
559 * set in @data then special location values should not be used.
560 *
561 * For %ETHTOOL_GRXCLSRULE, @fs.@location specifies the location of an
562 * existing rule on entry and @fs contains the rule on return.
563 *
564 * For %ETHTOOL_GRXCLSRLALL, @rule_cnt specifies the array size of the
565 * user buffer for @rule_locs on entry. On return, @data is the size
566 * of the rule table, @rule_cnt is the number of defined rules, and
567 * @rule_locs contains the locations of the defined rules. Drivers
568 * must use the second parameter to get_rxnfc() instead of @rule_locs.
569 *
570 * For %ETHTOOL_SRXCLSRLINS, @fs specifies the rule to add or update.
571 * @fs.@location either specifies the location to use or is a special
572 * location value with %RX_CLS_LOC_SPECIAL flag set. On return,
573 * @fs.@location is the actual rule location.
574 *
575 * For %ETHTOOL_SRXCLSRLDEL, @fs.@location specifies the location of an
576 * existing rule on entry.
577 *
578 * A driver supporting the special location values for
579 * %ETHTOOL_SRXCLSRLINS may add the rule at any suitable unused
580 * location, and may remove a rule at a later location (lower
581 * priority) that matches exactly the same set of flows. The special
582 * values are: %RX_CLS_LOC_ANY, selecting any location;
583 * %RX_CLS_LOC_FIRST, selecting the first suitable location (maximum
584 * priority); and %RX_CLS_LOC_LAST, selecting the last suitable
585 * location (minimum priority). Additional special values may be
586 * defined in future and drivers must return -%EINVAL for any
587 * unrecognised value.
588 */
589struct ethtool_rxnfc {
590 __u32 cmd;
591 __u32 flow_type;
592 __u64 data;
593 struct ethtool_rx_flow_spec fs;
594 __u32 rule_cnt;
595 __u32 rule_locs[0];
596};
597
598
599/**
600 * struct ethtool_rxfh_indir - command to get or set RX flow hash indirection
601 * @cmd: Specific command number - %ETHTOOL_GRXFHINDIR or %ETHTOOL_SRXFHINDIR
602 * @size: On entry, the array size of the user buffer, which may be zero.
603 * On return from %ETHTOOL_GRXFHINDIR, the array size of the hardware
604 * indirection table.
605 * @ring_index: RX ring/queue index for each hash value
606 *
607 * For %ETHTOOL_GRXFHINDIR, a @size of zero means that only the size
608 * should be returned. For %ETHTOOL_SRXFHINDIR, a @size of zero means
609 * the table should be reset to default values. This last feature
610 * is not supported by the original implementations.
611 */
612struct ethtool_rxfh_indir {
613 __u32 cmd;
614 __u32 size;
615 __u32 ring_index[0];
616};
617
618/**
619 * struct ethtool_rx_ntuple_flow_spec - specification for RX flow filter
620 * @flow_type: Type of match to perform, e.g. %TCP_V4_FLOW
621 * @h_u: Flow field values to match (dependent on @flow_type)
622 * @m_u: Masks for flow field value bits to be ignored
623 * @vlan_tag: VLAN tag to match
624 * @vlan_tag_mask: Mask for VLAN tag bits to be ignored
625 * @data: Driver-dependent data to match
626 * @data_mask: Mask for driver-dependent data bits to be ignored
627 * @action: RX ring/queue index to deliver to (non-negative) or other action
628 * (negative, e.g. %ETHTOOL_RXNTUPLE_ACTION_DROP)
629 *
630 * For flow types %TCP_V4_FLOW, %UDP_V4_FLOW and %SCTP_V4_FLOW, where
631 * a field value and mask are both zero this is treated as if all mask
632 * bits are set i.e. the field is ignored.
633 */
634struct ethtool_rx_ntuple_flow_spec {
635 __u32 flow_type;
636 union {
637 struct ethtool_tcpip4_spec tcp_ip4_spec;
638 struct ethtool_tcpip4_spec udp_ip4_spec;
639 struct ethtool_tcpip4_spec sctp_ip4_spec;
640 struct ethtool_ah_espip4_spec ah_ip4_spec;
641 struct ethtool_ah_espip4_spec esp_ip4_spec;
642 struct ethtool_usrip4_spec usr_ip4_spec;
643 struct ethhdr ether_spec;
644 __u8 hdata[72];
645 } h_u, m_u;
646
647 __u16 vlan_tag;
648 __u16 vlan_tag_mask;
649 __u64 data;
650 __u64 data_mask;
651
652 __s32 action;
653#define ETHTOOL_RXNTUPLE_ACTION_DROP (-1) /* drop packet */
654#define ETHTOOL_RXNTUPLE_ACTION_CLEAR (-2) /* clear filter */
655};
656
657/**
658 * struct ethtool_rx_ntuple - command to set or clear RX flow filter
659 * @cmd: Command number - %ETHTOOL_SRXNTUPLE
660 * @fs: Flow filter specification
661 */
662struct ethtool_rx_ntuple {
663 __u32 cmd;
664 struct ethtool_rx_ntuple_flow_spec fs;
665};
666
667#define ETHTOOL_FLASH_MAX_FILENAME 128
668enum ethtool_flash_op_type {
669 ETHTOOL_FLASH_ALL_REGIONS = 0,
670};
671
672/* for passing firmware flashing related parameters */
673struct ethtool_flash {
674 __u32 cmd;
675 __u32 region;
676 char data[ETHTOOL_FLASH_MAX_FILENAME];
677};
678
679/**
680 * struct ethtool_dump - used for retrieving, setting device dump
681 * @cmd: Command number - %ETHTOOL_GET_DUMP_FLAG, %ETHTOOL_GET_DUMP_DATA, or
682 * %ETHTOOL_SET_DUMP
683 * @version: FW version of the dump, filled in by driver
684 * @flag: driver dependent flag for dump setting, filled in by driver during
685 * get and filled in by ethtool for set operation.
686 * flag must be initialized by macro ETH_FW_DUMP_DISABLE value when
687 * firmware dump is disabled.
688 * @len: length of dump data, used as the length of the user buffer on entry to
689 * %ETHTOOL_GET_DUMP_DATA and this is returned as dump length by driver
690 * for %ETHTOOL_GET_DUMP_FLAG command
691 * @data: data collected for get dump data operation
692 */
693
694#define ETH_FW_DUMP_DISABLE 0
695
696struct ethtool_dump {
697 __u32 cmd;
698 __u32 version;
699 __u32 flag;
700 __u32 len;
701 __u8 data[0];
702};
703
704/* for returning and changing feature sets */
705
706/**
707 * struct ethtool_get_features_block - block with state of 32 features
708 * @available: mask of changeable features
709 * @requested: mask of features requested to be enabled if possible
710 * @active: mask of currently enabled features
711 * @never_changed: mask of features not changeable for any device
712 */
713struct ethtool_get_features_block {
714 __u32 available;
715 __u32 requested;
716 __u32 active;
717 __u32 never_changed;
718};
719
720/**
721 * struct ethtool_gfeatures - command to get state of device's features
722 * @cmd: command number = %ETHTOOL_GFEATURES
723 * @size: in: number of elements in the features[] array;
724 * out: number of elements in features[] needed to hold all features
725 * @features: state of features
726 */
727struct ethtool_gfeatures {
728 __u32 cmd;
729 __u32 size;
730 struct ethtool_get_features_block features[0];
731};
732
733/**
734 * struct ethtool_set_features_block - block with request for 32 features
735 * @valid: mask of features to be changed
736 * @requested: values of features to be changed
737 */
738struct ethtool_set_features_block {
739 __u32 valid;
740 __u32 requested;
741};
742
743/**
744 * struct ethtool_sfeatures - command to request change in device's features
745 * @cmd: command number = %ETHTOOL_SFEATURES
746 * @size: array size of the features[] array
747 * @features: feature change masks
748 */
749struct ethtool_sfeatures {
750 __u32 cmd;
751 __u32 size;
752 struct ethtool_set_features_block features[0];
753};
754
755/**
756 * struct ethtool_ts_info - holds a device's timestamping and PHC association
757 * @cmd: command number = %ETHTOOL_GET_TS_INFO
758 * @so_timestamping: bit mask of the sum of the supported SO_TIMESTAMPING flags
759 * @phc_index: device index of the associated PHC, or -1 if there is none
760 * @tx_types: bit mask of the supported hwtstamp_tx_types enumeration values
761 * @rx_filters: bit mask of the supported hwtstamp_rx_filters enumeration values
762 *
763 * The bits in the 'tx_types' and 'rx_filters' fields correspond to
764 * the 'hwtstamp_tx_types' and 'hwtstamp_rx_filters' enumeration values,
765 * respectively. For example, if the device supports HWTSTAMP_TX_ON,
766 * then (1 << HWTSTAMP_TX_ON) in 'tx_types' will be set.
767 */
768struct ethtool_ts_info {
769 __u32 cmd;
770 __u32 so_timestamping;
771 __s32 phc_index;
772 __u32 tx_types;
773 __u32 tx_reserved[3];
774 __u32 rx_filters;
775 __u32 rx_reserved[3];
776};
777
778/*
779 * %ETHTOOL_SFEATURES changes features present in features[].valid to the
780 * values of corresponding bits in features[].requested. Bits in .requested
781 * not set in .valid or not changeable are ignored.
782 *
783 * Returns %EINVAL when .valid contains undefined or never-changeable bits
784 * or size is not equal to required number of features words (32-bit blocks).
785 * Returns >= 0 if request was completed; bits set in the value mean:
786 * %ETHTOOL_F_UNSUPPORTED - there were bits set in .valid that are not
787 * changeable (not present in %ETHTOOL_GFEATURES' features[].available)
788 * those bits were ignored.
789 * %ETHTOOL_F_WISH - some or all changes requested were recorded but the
790 * resulting state of bits masked by .valid is not equal to .requested.
791 * Probably there are other device-specific constraints on some features
792 * in the set. When %ETHTOOL_F_UNSUPPORTED is set, .valid is considered
793 * here as though ignored bits were cleared.
794 * %ETHTOOL_F_COMPAT - some or all changes requested were made by calling
795 * compatibility functions. Requested offload state cannot be properly
796 * managed by kernel.
797 *
798 * Meaning of bits in the masks are obtained by %ETHTOOL_GSSET_INFO (number of
799 * bits in the arrays - always multiple of 32) and %ETHTOOL_GSTRINGS commands
800 * for ETH_SS_FEATURES string set. First entry in the table corresponds to least
801 * significant bit in features[0] fields. Empty strings mark undefined features.
802 */
803enum ethtool_sfeatures_retval_bits {
804 ETHTOOL_F_UNSUPPORTED__BIT,
805 ETHTOOL_F_WISH__BIT,
806 ETHTOOL_F_COMPAT__BIT,
807};
808
809#define ETHTOOL_F_UNSUPPORTED (1 << ETHTOOL_F_UNSUPPORTED__BIT)
810#define ETHTOOL_F_WISH (1 << ETHTOOL_F_WISH__BIT)
811#define ETHTOOL_F_COMPAT (1 << ETHTOOL_F_COMPAT__BIT)
812
813
814/* CMDs currently supported */
815#define ETHTOOL_GSET 0x00000001 /* Get settings. */
816#define ETHTOOL_SSET 0x00000002 /* Set settings. */
817#define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */
818#define ETHTOOL_GREGS 0x00000004 /* Get NIC registers. */
819#define ETHTOOL_GWOL 0x00000005 /* Get wake-on-lan options. */
820#define ETHTOOL_SWOL 0x00000006 /* Set wake-on-lan options. */
821#define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */
822#define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */
823#define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */
824/* Get link status for host, i.e. whether the interface *and* the
825 * physical port (if there is one) are up (ethtool_value). */
826#define ETHTOOL_GLINK 0x0000000a
827#define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */
828#define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */
829#define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */
830#define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */
831#define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */
832#define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters. */
833#define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */
834#define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */
835#define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */
836#define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */
837#define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */
838#define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */
839#define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable
840 * (ethtool_value) */
841#define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable
842 * (ethtool_value). */
843#define ETHTOOL_TEST 0x0000001a /* execute NIC self-test. */
844#define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */
845#define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */
846#define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */
847#define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */
848#define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */
849#define ETHTOOL_GPERMADDR 0x00000020 /* Get permanent hardware address */
850#define ETHTOOL_GUFO 0x00000021 /* Get UFO enable (ethtool_value) */
851#define ETHTOOL_SUFO 0x00000022 /* Set UFO enable (ethtool_value) */
852#define ETHTOOL_GGSO 0x00000023 /* Get GSO enable (ethtool_value) */
853#define ETHTOOL_SGSO 0x00000024 /* Set GSO enable (ethtool_value) */
854#define ETHTOOL_GFLAGS 0x00000025 /* Get flags bitmap(ethtool_value) */
855#define ETHTOOL_SFLAGS 0x00000026 /* Set flags bitmap(ethtool_value) */
856#define ETHTOOL_GPFLAGS 0x00000027 /* Get driver-private flags bitmap */
857#define ETHTOOL_SPFLAGS 0x00000028 /* Set driver-private flags bitmap */
858
859#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */
860#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */
861#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */
862#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */
863#define ETHTOOL_GRXRINGS 0x0000002d /* Get RX rings available for LB */
864#define ETHTOOL_GRXCLSRLCNT 0x0000002e /* Get RX class rule count */
865#define ETHTOOL_GRXCLSRULE 0x0000002f /* Get RX classification rule */
866#define ETHTOOL_GRXCLSRLALL 0x00000030 /* Get all RX classification rule */
867#define ETHTOOL_SRXCLSRLDEL 0x00000031 /* Delete RX classification rule */
868#define ETHTOOL_SRXCLSRLINS 0x00000032 /* Insert RX classification rule */
869#define ETHTOOL_FLASHDEV 0x00000033 /* Flash firmware to device */
870#define ETHTOOL_RESET 0x00000034 /* Reset hardware */
871#define ETHTOOL_SRXNTUPLE 0x00000035 /* Add an n-tuple filter to device */
872#define ETHTOOL_GRXNTUPLE 0x00000036 /* deprecated */
873#define ETHTOOL_GSSET_INFO 0x00000037 /* Get string set info */
874#define ETHTOOL_GRXFHINDIR 0x00000038 /* Get RX flow hash indir'n table */
875#define ETHTOOL_SRXFHINDIR 0x00000039 /* Set RX flow hash indir'n table */
876
877#define ETHTOOL_GFEATURES 0x0000003a /* Get device offload settings */
878#define ETHTOOL_SFEATURES 0x0000003b /* Change device offload settings */
879#define ETHTOOL_GCHANNELS 0x0000003c /* Get no of channels */
880#define ETHTOOL_SCHANNELS 0x0000003d /* Set no of channels */
881#define ETHTOOL_SET_DUMP 0x0000003e /* Set dump settings */
882#define ETHTOOL_GET_DUMP_FLAG 0x0000003f /* Get dump settings */
883#define ETHTOOL_GET_DUMP_DATA 0x00000040 /* Get dump data */
884#define ETHTOOL_GET_TS_INFO 0x00000041 /* Get time stamping and PHC info */
885#define ETHTOOL_GMODULEINFO 0x00000042 /* Get plug-in module information */
886#define ETHTOOL_GMODULEEEPROM 0x00000043 /* Get plug-in module eeprom */
887#define ETHTOOL_GEEE 0x00000044 /* Get EEE settings */
888#define ETHTOOL_SEEE 0x00000045 /* Set EEE settings */
889
890/* compatibility with older code */
891#define SPARC_ETH_GSET ETHTOOL_GSET
892#define SPARC_ETH_SSET ETHTOOL_SSET
893
894/* Indicates what features are supported by the interface. */
895#define SUPPORTED_10baseT_Half (1 << 0)
896#define SUPPORTED_10baseT_Full (1 << 1)
897#define SUPPORTED_100baseT_Half (1 << 2)
898#define SUPPORTED_100baseT_Full (1 << 3)
899#define SUPPORTED_1000baseT_Half (1 << 4)
900#define SUPPORTED_1000baseT_Full (1 << 5)
901#define SUPPORTED_Autoneg (1 << 6)
902#define SUPPORTED_TP (1 << 7)
903#define SUPPORTED_AUI (1 << 8)
904#define SUPPORTED_MII (1 << 9)
905#define SUPPORTED_FIBRE (1 << 10)
906#define SUPPORTED_BNC (1 << 11)
907#define SUPPORTED_10000baseT_Full (1 << 12)
908#define SUPPORTED_Pause (1 << 13)
909#define SUPPORTED_Asym_Pause (1 << 14)
910#define SUPPORTED_2500baseX_Full (1 << 15)
911#define SUPPORTED_Backplane (1 << 16)
912#define SUPPORTED_1000baseKX_Full (1 << 17)
913#define SUPPORTED_10000baseKX4_Full (1 << 18)
914#define SUPPORTED_10000baseKR_Full (1 << 19)
915#define SUPPORTED_10000baseR_FEC (1 << 20)
916#define SUPPORTED_20000baseMLD2_Full (1 << 21)
917#define SUPPORTED_20000baseKR2_Full (1 << 22)
918#define SUPPORTED_40000baseKR4_Full (1 << 23)
919#define SUPPORTED_40000baseCR4_Full (1 << 24)
920#define SUPPORTED_40000baseSR4_Full (1 << 25)
921#define SUPPORTED_40000baseLR4_Full (1 << 26)
922
923/* Indicates what features are advertised by the interface. */
924#define ADVERTISED_10baseT_Half (1 << 0)
925#define ADVERTISED_10baseT_Full (1 << 1)
926#define ADVERTISED_100baseT_Half (1 << 2)
927#define ADVERTISED_100baseT_Full (1 << 3)
928#define ADVERTISED_1000baseT_Half (1 << 4)
929#define ADVERTISED_1000baseT_Full (1 << 5)
930#define ADVERTISED_Autoneg (1 << 6)
931#define ADVERTISED_TP (1 << 7)
932#define ADVERTISED_AUI (1 << 8)
933#define ADVERTISED_MII (1 << 9)
934#define ADVERTISED_FIBRE (1 << 10)
935#define ADVERTISED_BNC (1 << 11)
936#define ADVERTISED_10000baseT_Full (1 << 12)
937#define ADVERTISED_Pause (1 << 13)
938#define ADVERTISED_Asym_Pause (1 << 14)
939#define ADVERTISED_2500baseX_Full (1 << 15)
940#define ADVERTISED_Backplane (1 << 16)
941#define ADVERTISED_1000baseKX_Full (1 << 17)
942#define ADVERTISED_10000baseKX4_Full (1 << 18)
943#define ADVERTISED_10000baseKR_Full (1 << 19)
944#define ADVERTISED_10000baseR_FEC (1 << 20)
945#define ADVERTISED_20000baseMLD2_Full (1 << 21)
946#define ADVERTISED_20000baseKR2_Full (1 << 22)
947#define ADVERTISED_40000baseKR4_Full (1 << 23)
948#define ADVERTISED_40000baseCR4_Full (1 << 24)
949#define ADVERTISED_40000baseSR4_Full (1 << 25)
950#define ADVERTISED_40000baseLR4_Full (1 << 26)
951
952/* The following are all involved in forcing a particular link
953 * mode for the device for setting things. When getting the
954 * devices settings, these indicate the current mode and whether
955 * it was forced up into this mode or autonegotiated.
956 */
957
958/* The forced speed, 10Mb, 100Mb, gigabit, 2.5Gb, 10GbE. */
959#define SPEED_10 10
960#define SPEED_100 100
961#define SPEED_1000 1000
962#define SPEED_2500 2500
963#define SPEED_10000 10000
964#define SPEED_UNKNOWN -1
965
966/* Duplex, half or full. */
967#define DUPLEX_HALF 0x00
968#define DUPLEX_FULL 0x01
969#define DUPLEX_UNKNOWN 0xff
970
971/* Which connector port. */
972#define PORT_TP 0x00
973#define PORT_AUI 0x01
974#define PORT_MII 0x02
975#define PORT_FIBRE 0x03
976#define PORT_BNC 0x04
977#define PORT_DA 0x05
978#define PORT_NONE 0xef
979#define PORT_OTHER 0xff
980
981/* Which transceiver to use. */
982#define XCVR_INTERNAL 0x00
983#define XCVR_EXTERNAL 0x01
984#define XCVR_DUMMY1 0x02
985#define XCVR_DUMMY2 0x03
986#define XCVR_DUMMY3 0x04
987
988/* Enable or disable autonegotiation. If this is set to enable,
989 * the forced link modes above are completely ignored.
990 */
991#define AUTONEG_DISABLE 0x00
992#define AUTONEG_ENABLE 0x01
993
994/* MDI or MDI-X status/control - if MDI/MDI_X/AUTO is set then
995 * the driver is required to renegotiate link
996 */
997#define ETH_TP_MDI_INVALID 0x00 /* status: unknown; control: unsupported */
998#define ETH_TP_MDI 0x01 /* status: MDI; control: force MDI */
999#define ETH_TP_MDI_X 0x02 /* status: MDI-X; control: force MDI-X */
1000#define ETH_TP_MDI_AUTO 0x03 /* control: auto-select */
1001
1002/* Wake-On-Lan options. */
1003#define WAKE_PHY (1 << 0)
1004#define WAKE_UCAST (1 << 1)
1005#define WAKE_MCAST (1 << 2)
1006#define WAKE_BCAST (1 << 3)
1007#define WAKE_ARP (1 << 4)
1008#define WAKE_MAGIC (1 << 5)
1009#define WAKE_MAGICSECURE (1 << 6) /* only meaningful if WAKE_MAGIC */
1010
1011/* L2-L4 network traffic flow types */
1012#define TCP_V4_FLOW 0x01 /* hash or spec (tcp_ip4_spec) */
1013#define UDP_V4_FLOW 0x02 /* hash or spec (udp_ip4_spec) */
1014#define SCTP_V4_FLOW 0x03 /* hash or spec (sctp_ip4_spec) */
1015#define AH_ESP_V4_FLOW 0x04 /* hash only */
1016#define TCP_V6_FLOW 0x05 /* hash only */
1017#define UDP_V6_FLOW 0x06 /* hash only */
1018#define SCTP_V6_FLOW 0x07 /* hash only */
1019#define AH_ESP_V6_FLOW 0x08 /* hash only */
1020#define AH_V4_FLOW 0x09 /* hash or spec (ah_ip4_spec) */
1021#define ESP_V4_FLOW 0x0a /* hash or spec (esp_ip4_spec) */
1022#define AH_V6_FLOW 0x0b /* hash only */
1023#define ESP_V6_FLOW 0x0c /* hash only */
1024#define IP_USER_FLOW 0x0d /* spec only (usr_ip4_spec) */
1025#define IPV4_FLOW 0x10 /* hash only */
1026#define IPV6_FLOW 0x11 /* hash only */
1027#define ETHER_FLOW 0x12 /* spec only (ether_spec) */
1028/* Flag to enable additional fields in struct ethtool_rx_flow_spec */
1029#define FLOW_EXT 0x80000000
1030
1031/* L3-L4 network traffic flow hash options */
1032#define RXH_L2DA (1 << 1)
1033#define RXH_VLAN (1 << 2)
1034#define RXH_L3_PROTO (1 << 3)
1035#define RXH_IP_SRC (1 << 4)
1036#define RXH_IP_DST (1 << 5)
1037#define RXH_L4_B_0_1 (1 << 6) /* src port in case of TCP/UDP/SCTP */
1038#define RXH_L4_B_2_3 (1 << 7) /* dst port in case of TCP/UDP/SCTP */
1039#define RXH_DISCARD (1 << 31)
1040
1041#define RX_CLS_FLOW_DISC 0xffffffffffffffffULL
1042
1043/* Special RX classification rule insert location values */
1044#define RX_CLS_LOC_SPECIAL 0x80000000 /* flag */
1045#define RX_CLS_LOC_ANY 0xffffffff
1046#define RX_CLS_LOC_FIRST 0xfffffffe
1047#define RX_CLS_LOC_LAST 0xfffffffd
1048
1049/* EEPROM Standards for plug in modules */
1050#define ETH_MODULE_SFF_8079 0x1
1051#define ETH_MODULE_SFF_8079_LEN 256
1052#define ETH_MODULE_SFF_8472 0x2
1053#define ETH_MODULE_SFF_8472_LEN 512
1054
1055/* Reset flags */
1056/* The reset() operation must clear the flags for the components which
1057 * were actually reset. On successful return, the flags indicate the
1058 * components which were not reset, either because they do not exist
1059 * in the hardware or because they cannot be reset independently. The
1060 * driver must never reset any components that were not requested.
1061 */
1062enum ethtool_reset_flags {
1063 /* These flags represent components dedicated to the interface
1064 * the command is addressed to. Shift any flag left by
1065 * ETH_RESET_SHARED_SHIFT to reset a shared component of the
1066 * same type.
1067 */
1068 ETH_RESET_MGMT = 1 << 0, /* Management processor */
1069 ETH_RESET_IRQ = 1 << 1, /* Interrupt requester */
1070 ETH_RESET_DMA = 1 << 2, /* DMA engine */
1071 ETH_RESET_FILTER = 1 << 3, /* Filtering/flow direction */
1072 ETH_RESET_OFFLOAD = 1 << 4, /* Protocol offload */
1073 ETH_RESET_MAC = 1 << 5, /* Media access controller */
1074 ETH_RESET_PHY = 1 << 6, /* Transceiver/PHY */
1075 ETH_RESET_RAM = 1 << 7, /* RAM shared between
1076 * multiple components */
1077
1078 ETH_RESET_DEDICATED = 0x0000ffff, /* All components dedicated to
1079 * this interface */
1080 ETH_RESET_ALL = 0xffffffff, /* All components used by this
1081 * interface, even if shared */
1082};
1083#define ETH_RESET_SHARED_SHIFT 16
1084
1085#endif /* _UAPI_LINUX_ETHTOOL_H */
diff --git a/include/uapi/linux/eventpoll.h b/include/uapi/linux/eventpoll.h
new file mode 100644
index 000000000000..8c99ce7202c5
--- /dev/null
+++ b/include/uapi/linux/eventpoll.h
@@ -0,0 +1,66 @@
1/*
2 * include/linux/eventpoll.h ( Efficient event polling implementation )
3 * Copyright (C) 2001,...,2006 Davide Libenzi
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 * Davide Libenzi <davidel@xmailserver.org>
11 *
12 */
13
14#ifndef _UAPI_LINUX_EVENTPOLL_H
15#define _UAPI_LINUX_EVENTPOLL_H
16
17/* For O_CLOEXEC */
18#include <linux/fcntl.h>
19#include <linux/types.h>
20
21/* Flags for epoll_create1. */
22#define EPOLL_CLOEXEC O_CLOEXEC
23
24/* Valid opcodes to issue to sys_epoll_ctl() */
25#define EPOLL_CTL_ADD 1
26#define EPOLL_CTL_DEL 2
27#define EPOLL_CTL_MOD 3
28#define EPOLL_CTL_DISABLE 4
29
30/*
31 * Request the handling of system wakeup events so as to prevent system suspends
32 * from happening while those events are being processed.
33 *
34 * Assuming neither EPOLLET nor EPOLLONESHOT is set, system suspends will not be
35 * re-allowed until epoll_wait is called again after consuming the wakeup
36 * event(s).
37 *
38 * Requires CAP_BLOCK_SUSPEND
39 */
40#define EPOLLWAKEUP (1 << 29)
41
42/* Set the One Shot behaviour for the target file descriptor */
43#define EPOLLONESHOT (1 << 30)
44
45/* Set the Edge Triggered behaviour for the target file descriptor */
46#define EPOLLET (1 << 31)
47
48/*
49 * On x86-64 make the 64bit structure have the same alignment as the
50 * 32bit structure. This makes 32bit emulation easier.
51 *
52 * UML/x86_64 needs the same packing as x86_64
53 */
54#ifdef __x86_64__
55#define EPOLL_PACKED __attribute__((packed))
56#else
57#define EPOLL_PACKED
58#endif
59
60struct epoll_event {
61 __u32 events;
62 __u64 data;
63} EPOLL_PACKED;
64
65
66#endif /* _UAPI_LINUX_EVENTPOLL_H */
diff --git a/include/linux/fadvise.h b/include/uapi/linux/fadvise.h
index e8e747139b9a..e8e747139b9a 100644
--- a/include/linux/fadvise.h
+++ b/include/uapi/linux/fadvise.h
diff --git a/include/uapi/linux/falloc.h b/include/uapi/linux/falloc.h
new file mode 100644
index 000000000000..990c4ccf8b61
--- /dev/null
+++ b/include/uapi/linux/falloc.h
@@ -0,0 +1,9 @@
1#ifndef _UAPI_FALLOC_H_
2#define _UAPI_FALLOC_H_
3
4#define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */
5#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */
6#define FALLOC_FL_NO_HIDE_STALE 0x04 /* reserved codepoint */
7
8
9#endif /* _UAPI_FALLOC_H_ */
diff --git a/include/uapi/linux/fanotify.h b/include/uapi/linux/fanotify.h
new file mode 100644
index 000000000000..030508d195d3
--- /dev/null
+++ b/include/uapi/linux/fanotify.h
@@ -0,0 +1,116 @@
1#ifndef _UAPI_LINUX_FANOTIFY_H
2#define _UAPI_LINUX_FANOTIFY_H
3
4#include <linux/types.h>
5
6/* the following events that user-space can register for */
7#define FAN_ACCESS 0x00000001 /* File was accessed */
8#define FAN_MODIFY 0x00000002 /* File was modified */
9#define FAN_CLOSE_WRITE 0x00000008 /* Writtable file closed */
10#define FAN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed */
11#define FAN_OPEN 0x00000020 /* File was opened */
12
13#define FAN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */
14
15#define FAN_OPEN_PERM 0x00010000 /* File open in perm check */
16#define FAN_ACCESS_PERM 0x00020000 /* File accessed in perm check */
17
18#define FAN_ONDIR 0x40000000 /* event occurred against dir */
19
20#define FAN_EVENT_ON_CHILD 0x08000000 /* interested in child events */
21
22/* helper events */
23#define FAN_CLOSE (FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE) /* close */
24
25/* flags used for fanotify_init() */
26#define FAN_CLOEXEC 0x00000001
27#define FAN_NONBLOCK 0x00000002
28
29/* These are NOT bitwise flags. Both bits are used togther. */
30#define FAN_CLASS_NOTIF 0x00000000
31#define FAN_CLASS_CONTENT 0x00000004
32#define FAN_CLASS_PRE_CONTENT 0x00000008
33#define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | \
34 FAN_CLASS_PRE_CONTENT)
35
36#define FAN_UNLIMITED_QUEUE 0x00000010
37#define FAN_UNLIMITED_MARKS 0x00000020
38
39#define FAN_ALL_INIT_FLAGS (FAN_CLOEXEC | FAN_NONBLOCK | \
40 FAN_ALL_CLASS_BITS | FAN_UNLIMITED_QUEUE |\
41 FAN_UNLIMITED_MARKS)
42
43/* flags used for fanotify_modify_mark() */
44#define FAN_MARK_ADD 0x00000001
45#define FAN_MARK_REMOVE 0x00000002
46#define FAN_MARK_DONT_FOLLOW 0x00000004
47#define FAN_MARK_ONLYDIR 0x00000008
48#define FAN_MARK_MOUNT 0x00000010
49#define FAN_MARK_IGNORED_MASK 0x00000020
50#define FAN_MARK_IGNORED_SURV_MODIFY 0x00000040
51#define FAN_MARK_FLUSH 0x00000080
52
53#define FAN_ALL_MARK_FLAGS (FAN_MARK_ADD |\
54 FAN_MARK_REMOVE |\
55 FAN_MARK_DONT_FOLLOW |\
56 FAN_MARK_ONLYDIR |\
57 FAN_MARK_MOUNT |\
58 FAN_MARK_IGNORED_MASK |\
59 FAN_MARK_IGNORED_SURV_MODIFY |\
60 FAN_MARK_FLUSH)
61
62/*
63 * All of the events - we build the list by hand so that we can add flags in
64 * the future and not break backward compatibility. Apps will get only the
65 * events that they originally wanted. Be sure to add new events here!
66 */
67#define FAN_ALL_EVENTS (FAN_ACCESS |\
68 FAN_MODIFY |\
69 FAN_CLOSE |\
70 FAN_OPEN)
71
72/*
73 * All events which require a permission response from userspace
74 */
75#define FAN_ALL_PERM_EVENTS (FAN_OPEN_PERM |\
76 FAN_ACCESS_PERM)
77
78#define FAN_ALL_OUTGOING_EVENTS (FAN_ALL_EVENTS |\
79 FAN_ALL_PERM_EVENTS |\
80 FAN_Q_OVERFLOW)
81
82#define FANOTIFY_METADATA_VERSION 3
83
84struct fanotify_event_metadata {
85 __u32 event_len;
86 __u8 vers;
87 __u8 reserved;
88 __u16 metadata_len;
89 __aligned_u64 mask;
90 __s32 fd;
91 __s32 pid;
92};
93
94struct fanotify_response {
95 __s32 fd;
96 __u32 response;
97};
98
99/* Legit userspace responses to a _PERM event */
100#define FAN_ALLOW 0x01
101#define FAN_DENY 0x02
102/* No fd set in event */
103#define FAN_NOFD -1
104
105/* Helper functions to deal with fanotify_event_metadata buffers */
106#define FAN_EVENT_METADATA_LEN (sizeof(struct fanotify_event_metadata))
107
108#define FAN_EVENT_NEXT(meta, len) ((len) -= (meta)->event_len, \
109 (struct fanotify_event_metadata*)(((char *)(meta)) + \
110 (meta)->event_len))
111
112#define FAN_EVENT_OK(meta, len) ((long)(len) >= (long)FAN_EVENT_METADATA_LEN && \
113 (long)(meta)->event_len >= (long)FAN_EVENT_METADATA_LEN && \
114 (long)(meta)->event_len <= (long)(len))
115
116#endif /* _UAPI_LINUX_FANOTIFY_H */
diff --git a/include/uapi/linux/fb.h b/include/uapi/linux/fb.h
new file mode 100644
index 000000000000..fb795c3b3c17
--- /dev/null
+++ b/include/uapi/linux/fb.h
@@ -0,0 +1,402 @@
1#ifndef _UAPI_LINUX_FB_H
2#define _UAPI_LINUX_FB_H
3
4#include <linux/types.h>
5#include <linux/i2c.h>
6
7/* Definitions of frame buffers */
8
9#define FB_MAX 32 /* sufficient for now */
10
11/* ioctls
12 0x46 is 'F' */
13#define FBIOGET_VSCREENINFO 0x4600
14#define FBIOPUT_VSCREENINFO 0x4601
15#define FBIOGET_FSCREENINFO 0x4602
16#define FBIOGETCMAP 0x4604
17#define FBIOPUTCMAP 0x4605
18#define FBIOPAN_DISPLAY 0x4606
19#ifndef __KERNEL__
20#define FBIO_CURSOR _IOWR('F', 0x08, struct fb_cursor)
21#endif
22/* 0x4607-0x460B are defined below */
23/* #define FBIOGET_MONITORSPEC 0x460C */
24/* #define FBIOPUT_MONITORSPEC 0x460D */
25/* #define FBIOSWITCH_MONIBIT 0x460E */
26#define FBIOGET_CON2FBMAP 0x460F
27#define FBIOPUT_CON2FBMAP 0x4610
28#define FBIOBLANK 0x4611 /* arg: 0 or vesa level + 1 */
29#define FBIOGET_VBLANK _IOR('F', 0x12, struct fb_vblank)
30#define FBIO_ALLOC 0x4613
31#define FBIO_FREE 0x4614
32#define FBIOGET_GLYPH 0x4615
33#define FBIOGET_HWCINFO 0x4616
34#define FBIOPUT_MODEINFO 0x4617
35#define FBIOGET_DISPINFO 0x4618
36#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
37
38#define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */
39#define FB_TYPE_PLANES 1 /* Non interleaved planes */
40#define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */
41#define FB_TYPE_TEXT 3 /* Text/attributes */
42#define FB_TYPE_VGA_PLANES 4 /* EGA/VGA planes */
43#define FB_TYPE_FOURCC 5 /* Type identified by a V4L2 FOURCC */
44
45#define FB_AUX_TEXT_MDA 0 /* Monochrome text */
46#define FB_AUX_TEXT_CGA 1 /* CGA/EGA/VGA Color text */
47#define FB_AUX_TEXT_S3_MMIO 2 /* S3 MMIO fasttext */
48#define FB_AUX_TEXT_MGA_STEP16 3 /* MGA Millenium I: text, attr, 14 reserved bytes */
49#define FB_AUX_TEXT_MGA_STEP8 4 /* other MGAs: text, attr, 6 reserved bytes */
50#define FB_AUX_TEXT_SVGA_GROUP 8 /* 8-15: SVGA tileblit compatible modes */
51#define FB_AUX_TEXT_SVGA_MASK 7 /* lower three bits says step */
52#define FB_AUX_TEXT_SVGA_STEP2 8 /* SVGA text mode: text, attr */
53#define FB_AUX_TEXT_SVGA_STEP4 9 /* SVGA text mode: text, attr, 2 reserved bytes */
54#define FB_AUX_TEXT_SVGA_STEP8 10 /* SVGA text mode: text, attr, 6 reserved bytes */
55#define FB_AUX_TEXT_SVGA_STEP16 11 /* SVGA text mode: text, attr, 14 reserved bytes */
56#define FB_AUX_TEXT_SVGA_LAST 15 /* reserved up to 15 */
57
58#define FB_AUX_VGA_PLANES_VGA4 0 /* 16 color planes (EGA/VGA) */
59#define FB_AUX_VGA_PLANES_CFB4 1 /* CFB4 in planes (VGA) */
60#define FB_AUX_VGA_PLANES_CFB8 2 /* CFB8 in planes (VGA) */
61
62#define FB_VISUAL_MONO01 0 /* Monochr. 1=Black 0=White */
63#define FB_VISUAL_MONO10 1 /* Monochr. 1=White 0=Black */
64#define FB_VISUAL_TRUECOLOR 2 /* True color */
65#define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */
66#define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */
67#define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */
68#define FB_VISUAL_FOURCC 6 /* Visual identified by a V4L2 FOURCC */
69
70#define FB_ACCEL_NONE 0 /* no hardware accelerator */
71#define FB_ACCEL_ATARIBLITT 1 /* Atari Blitter */
72#define FB_ACCEL_AMIGABLITT 2 /* Amiga Blitter */
73#define FB_ACCEL_S3_TRIO64 3 /* Cybervision64 (S3 Trio64) */
74#define FB_ACCEL_NCR_77C32BLT 4 /* RetinaZ3 (NCR 77C32BLT) */
75#define FB_ACCEL_S3_VIRGE 5 /* Cybervision64/3D (S3 ViRGE) */
76#define FB_ACCEL_ATI_MACH64GX 6 /* ATI Mach 64GX family */
77#define FB_ACCEL_DEC_TGA 7 /* DEC 21030 TGA */
78#define FB_ACCEL_ATI_MACH64CT 8 /* ATI Mach 64CT family */
79#define FB_ACCEL_ATI_MACH64VT 9 /* ATI Mach 64CT family VT class */
80#define FB_ACCEL_ATI_MACH64GT 10 /* ATI Mach 64CT family GT class */
81#define FB_ACCEL_SUN_CREATOR 11 /* Sun Creator/Creator3D */
82#define FB_ACCEL_SUN_CGSIX 12 /* Sun cg6 */
83#define FB_ACCEL_SUN_LEO 13 /* Sun leo/zx */
84#define FB_ACCEL_IMS_TWINTURBO 14 /* IMS Twin Turbo */
85#define FB_ACCEL_3DLABS_PERMEDIA2 15 /* 3Dlabs Permedia 2 */
86#define FB_ACCEL_MATROX_MGA2064W 16 /* Matrox MGA2064W (Millenium) */
87#define FB_ACCEL_MATROX_MGA1064SG 17 /* Matrox MGA1064SG (Mystique) */
88#define FB_ACCEL_MATROX_MGA2164W 18 /* Matrox MGA2164W (Millenium II) */
89#define FB_ACCEL_MATROX_MGA2164W_AGP 19 /* Matrox MGA2164W (Millenium II) */
90#define FB_ACCEL_MATROX_MGAG100 20 /* Matrox G100 (Productiva G100) */
91#define FB_ACCEL_MATROX_MGAG200 21 /* Matrox G200 (Myst, Mill, ...) */
92#define FB_ACCEL_SUN_CG14 22 /* Sun cgfourteen */
93#define FB_ACCEL_SUN_BWTWO 23 /* Sun bwtwo */
94#define FB_ACCEL_SUN_CGTHREE 24 /* Sun cgthree */
95#define FB_ACCEL_SUN_TCX 25 /* Sun tcx */
96#define FB_ACCEL_MATROX_MGAG400 26 /* Matrox G400 */
97#define FB_ACCEL_NV3 27 /* nVidia RIVA 128 */
98#define FB_ACCEL_NV4 28 /* nVidia RIVA TNT */
99#define FB_ACCEL_NV5 29 /* nVidia RIVA TNT2 */
100#define FB_ACCEL_CT_6555x 30 /* C&T 6555x */
101#define FB_ACCEL_3DFX_BANSHEE 31 /* 3Dfx Banshee */
102#define FB_ACCEL_ATI_RAGE128 32 /* ATI Rage128 family */
103#define FB_ACCEL_IGS_CYBER2000 33 /* CyberPro 2000 */
104#define FB_ACCEL_IGS_CYBER2010 34 /* CyberPro 2010 */
105#define FB_ACCEL_IGS_CYBER5000 35 /* CyberPro 5000 */
106#define FB_ACCEL_SIS_GLAMOUR 36 /* SiS 300/630/540 */
107#define FB_ACCEL_3DLABS_PERMEDIA3 37 /* 3Dlabs Permedia 3 */
108#define FB_ACCEL_ATI_RADEON 38 /* ATI Radeon family */
109#define FB_ACCEL_I810 39 /* Intel 810/815 */
110#define FB_ACCEL_SIS_GLAMOUR_2 40 /* SiS 315, 650, 740 */
111#define FB_ACCEL_SIS_XABRE 41 /* SiS 330 ("Xabre") */
112#define FB_ACCEL_I830 42 /* Intel 830M/845G/85x/865G */
113#define FB_ACCEL_NV_10 43 /* nVidia Arch 10 */
114#define FB_ACCEL_NV_20 44 /* nVidia Arch 20 */
115#define FB_ACCEL_NV_30 45 /* nVidia Arch 30 */
116#define FB_ACCEL_NV_40 46 /* nVidia Arch 40 */
117#define FB_ACCEL_XGI_VOLARI_V 47 /* XGI Volari V3XT, V5, V8 */
118#define FB_ACCEL_XGI_VOLARI_Z 48 /* XGI Volari Z7 */
119#define FB_ACCEL_OMAP1610 49 /* TI OMAP16xx */
120#define FB_ACCEL_TRIDENT_TGUI 50 /* Trident TGUI */
121#define FB_ACCEL_TRIDENT_3DIMAGE 51 /* Trident 3DImage */
122#define FB_ACCEL_TRIDENT_BLADE3D 52 /* Trident Blade3D */
123#define FB_ACCEL_TRIDENT_BLADEXP 53 /* Trident BladeXP */
124#define FB_ACCEL_CIRRUS_ALPINE 53 /* Cirrus Logic 543x/544x/5480 */
125#define FB_ACCEL_NEOMAGIC_NM2070 90 /* NeoMagic NM2070 */
126#define FB_ACCEL_NEOMAGIC_NM2090 91 /* NeoMagic NM2090 */
127#define FB_ACCEL_NEOMAGIC_NM2093 92 /* NeoMagic NM2093 */
128#define FB_ACCEL_NEOMAGIC_NM2097 93 /* NeoMagic NM2097 */
129#define FB_ACCEL_NEOMAGIC_NM2160 94 /* NeoMagic NM2160 */
130#define FB_ACCEL_NEOMAGIC_NM2200 95 /* NeoMagic NM2200 */
131#define FB_ACCEL_NEOMAGIC_NM2230 96 /* NeoMagic NM2230 */
132#define FB_ACCEL_NEOMAGIC_NM2360 97 /* NeoMagic NM2360 */
133#define FB_ACCEL_NEOMAGIC_NM2380 98 /* NeoMagic NM2380 */
134#define FB_ACCEL_PXA3XX 99 /* PXA3xx */
135
136#define FB_ACCEL_SAVAGE4 0x80 /* S3 Savage4 */
137#define FB_ACCEL_SAVAGE3D 0x81 /* S3 Savage3D */
138#define FB_ACCEL_SAVAGE3D_MV 0x82 /* S3 Savage3D-MV */
139#define FB_ACCEL_SAVAGE2000 0x83 /* S3 Savage2000 */
140#define FB_ACCEL_SAVAGE_MX_MV 0x84 /* S3 Savage/MX-MV */
141#define FB_ACCEL_SAVAGE_MX 0x85 /* S3 Savage/MX */
142#define FB_ACCEL_SAVAGE_IX_MV 0x86 /* S3 Savage/IX-MV */
143#define FB_ACCEL_SAVAGE_IX 0x87 /* S3 Savage/IX */
144#define FB_ACCEL_PROSAVAGE_PM 0x88 /* S3 ProSavage PM133 */
145#define FB_ACCEL_PROSAVAGE_KM 0x89 /* S3 ProSavage KM133 */
146#define FB_ACCEL_S3TWISTER_P 0x8a /* S3 Twister */
147#define FB_ACCEL_S3TWISTER_K 0x8b /* S3 TwisterK */
148#define FB_ACCEL_SUPERSAVAGE 0x8c /* S3 Supersavage */
149#define FB_ACCEL_PROSAVAGE_DDR 0x8d /* S3 ProSavage DDR */
150#define FB_ACCEL_PROSAVAGE_DDRK 0x8e /* S3 ProSavage DDR-K */
151
152#define FB_ACCEL_PUV3_UNIGFX 0xa0 /* PKUnity-v3 Unigfx */
153
154#define FB_CAP_FOURCC 1 /* Device supports FOURCC-based formats */
155
156struct fb_fix_screeninfo {
157 char id[16]; /* identification string eg "TT Builtin" */
158 unsigned long smem_start; /* Start of frame buffer mem */
159 /* (physical address) */
160 __u32 smem_len; /* Length of frame buffer mem */
161 __u32 type; /* see FB_TYPE_* */
162 __u32 type_aux; /* Interleave for interleaved Planes */
163 __u32 visual; /* see FB_VISUAL_* */
164 __u16 xpanstep; /* zero if no hardware panning */
165 __u16 ypanstep; /* zero if no hardware panning */
166 __u16 ywrapstep; /* zero if no hardware ywrap */
167 __u32 line_length; /* length of a line in bytes */
168 unsigned long mmio_start; /* Start of Memory Mapped I/O */
169 /* (physical address) */
170 __u32 mmio_len; /* Length of Memory Mapped I/O */
171 __u32 accel; /* Indicate to driver which */
172 /* specific chip/card we have */
173 __u16 capabilities; /* see FB_CAP_* */
174 __u16 reserved[2]; /* Reserved for future compatibility */
175};
176
177/* Interpretation of offset for color fields: All offsets are from the right,
178 * inside a "pixel" value, which is exactly 'bits_per_pixel' wide (means: you
179 * can use the offset as right argument to <<). A pixel afterwards is a bit
180 * stream and is written to video memory as that unmodified.
181 *
182 * For pseudocolor: offset and length should be the same for all color
183 * components. Offset specifies the position of the least significant bit
184 * of the pallette index in a pixel value. Length indicates the number
185 * of available palette entries (i.e. # of entries = 1 << length).
186 */
187struct fb_bitfield {
188 __u32 offset; /* beginning of bitfield */
189 __u32 length; /* length of bitfield */
190 __u32 msb_right; /* != 0 : Most significant bit is */
191 /* right */
192};
193
194#define FB_NONSTD_HAM 1 /* Hold-And-Modify (HAM) */
195#define FB_NONSTD_REV_PIX_IN_B 2 /* order of pixels in each byte is reversed */
196
197#define FB_ACTIVATE_NOW 0 /* set values immediately (or vbl)*/
198#define FB_ACTIVATE_NXTOPEN 1 /* activate on next open */
199#define FB_ACTIVATE_TEST 2 /* don't set, round up impossible */
200#define FB_ACTIVATE_MASK 15
201 /* values */
202#define FB_ACTIVATE_VBL 16 /* activate values on next vbl */
203#define FB_CHANGE_CMAP_VBL 32 /* change colormap on vbl */
204#define FB_ACTIVATE_ALL 64 /* change all VCs on this fb */
205#define FB_ACTIVATE_FORCE 128 /* force apply even when no change*/
206#define FB_ACTIVATE_INV_MODE 256 /* invalidate videomode */
207
208#define FB_ACCELF_TEXT 1 /* (OBSOLETE) see fb_info.flags and vc_mode */
209
210#define FB_SYNC_HOR_HIGH_ACT 1 /* horizontal sync high active */
211#define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */
212#define FB_SYNC_EXT 4 /* external sync */
213#define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */
214#define FB_SYNC_BROADCAST 16 /* broadcast video timings */
215 /* vtotal = 144d/288n/576i => PAL */
216 /* vtotal = 121d/242n/484i => NTSC */
217#define FB_SYNC_ON_GREEN 32 /* sync on green */
218
219#define FB_VMODE_NONINTERLACED 0 /* non interlaced */
220#define FB_VMODE_INTERLACED 1 /* interlaced */
221#define FB_VMODE_DOUBLE 2 /* double scan */
222#define FB_VMODE_ODD_FLD_FIRST 4 /* interlaced: top line first */
223#define FB_VMODE_MASK 255
224
225#define FB_VMODE_YWRAP 256 /* ywrap instead of panning */
226#define FB_VMODE_SMOOTH_XPAN 512 /* smooth xpan possible (internally used) */
227#define FB_VMODE_CONUPDATE 512 /* don't update x/yoffset */
228
229/*
230 * Display rotation support
231 */
232#define FB_ROTATE_UR 0
233#define FB_ROTATE_CW 1
234#define FB_ROTATE_UD 2
235#define FB_ROTATE_CCW 3
236
237#define PICOS2KHZ(a) (1000000000UL/(a))
238#define KHZ2PICOS(a) (1000000000UL/(a))
239
240struct fb_var_screeninfo {
241 __u32 xres; /* visible resolution */
242 __u32 yres;
243 __u32 xres_virtual; /* virtual resolution */
244 __u32 yres_virtual;
245 __u32 xoffset; /* offset from virtual to visible */
246 __u32 yoffset; /* resolution */
247
248 __u32 bits_per_pixel; /* guess what */
249 __u32 grayscale; /* 0 = color, 1 = grayscale, */
250 /* >1 = FOURCC */
251 struct fb_bitfield red; /* bitfield in fb mem if true color, */
252 struct fb_bitfield green; /* else only length is significant */
253 struct fb_bitfield blue;
254 struct fb_bitfield transp; /* transparency */
255
256 __u32 nonstd; /* != 0 Non standard pixel format */
257
258 __u32 activate; /* see FB_ACTIVATE_* */
259
260 __u32 height; /* height of picture in mm */
261 __u32 width; /* width of picture in mm */
262
263 __u32 accel_flags; /* (OBSOLETE) see fb_info.flags */
264
265 /* Timing: All values in pixclocks, except pixclock (of course) */
266 __u32 pixclock; /* pixel clock in ps (pico seconds) */
267 __u32 left_margin; /* time from sync to picture */
268 __u32 right_margin; /* time from picture to sync */
269 __u32 upper_margin; /* time from sync to picture */
270 __u32 lower_margin;
271 __u32 hsync_len; /* length of horizontal sync */
272 __u32 vsync_len; /* length of vertical sync */
273 __u32 sync; /* see FB_SYNC_* */
274 __u32 vmode; /* see FB_VMODE_* */
275 __u32 rotate; /* angle we rotate counter clockwise */
276 __u32 colorspace; /* colorspace for FOURCC-based modes */
277 __u32 reserved[4]; /* Reserved for future compatibility */
278};
279
280struct fb_cmap {
281 __u32 start; /* First entry */
282 __u32 len; /* Number of entries */
283 __u16 *red; /* Red values */
284 __u16 *green;
285 __u16 *blue;
286 __u16 *transp; /* transparency, can be NULL */
287};
288
289struct fb_con2fbmap {
290 __u32 console;
291 __u32 framebuffer;
292};
293
294/* VESA Blanking Levels */
295#define VESA_NO_BLANKING 0
296#define VESA_VSYNC_SUSPEND 1
297#define VESA_HSYNC_SUSPEND 2
298#define VESA_POWERDOWN 3
299
300
301enum {
302 /* screen: unblanked, hsync: on, vsync: on */
303 FB_BLANK_UNBLANK = VESA_NO_BLANKING,
304
305 /* screen: blanked, hsync: on, vsync: on */
306 FB_BLANK_NORMAL = VESA_NO_BLANKING + 1,
307
308 /* screen: blanked, hsync: on, vsync: off */
309 FB_BLANK_VSYNC_SUSPEND = VESA_VSYNC_SUSPEND + 1,
310
311 /* screen: blanked, hsync: off, vsync: on */
312 FB_BLANK_HSYNC_SUSPEND = VESA_HSYNC_SUSPEND + 1,
313
314 /* screen: blanked, hsync: off, vsync: off */
315 FB_BLANK_POWERDOWN = VESA_POWERDOWN + 1
316};
317
318#define FB_VBLANK_VBLANKING 0x001 /* currently in a vertical blank */
319#define FB_VBLANK_HBLANKING 0x002 /* currently in a horizontal blank */
320#define FB_VBLANK_HAVE_VBLANK 0x004 /* vertical blanks can be detected */
321#define FB_VBLANK_HAVE_HBLANK 0x008 /* horizontal blanks can be detected */
322#define FB_VBLANK_HAVE_COUNT 0x010 /* global retrace counter is available */
323#define FB_VBLANK_HAVE_VCOUNT 0x020 /* the vcount field is valid */
324#define FB_VBLANK_HAVE_HCOUNT 0x040 /* the hcount field is valid */
325#define FB_VBLANK_VSYNCING 0x080 /* currently in a vsync */
326#define FB_VBLANK_HAVE_VSYNC 0x100 /* verical syncs can be detected */
327
328struct fb_vblank {
329 __u32 flags; /* FB_VBLANK flags */
330 __u32 count; /* counter of retraces since boot */
331 __u32 vcount; /* current scanline position */
332 __u32 hcount; /* current scandot position */
333 __u32 reserved[4]; /* reserved for future compatibility */
334};
335
336/* Internal HW accel */
337#define ROP_COPY 0
338#define ROP_XOR 1
339
340struct fb_copyarea {
341 __u32 dx;
342 __u32 dy;
343 __u32 width;
344 __u32 height;
345 __u32 sx;
346 __u32 sy;
347};
348
349struct fb_fillrect {
350 __u32 dx; /* screen-relative */
351 __u32 dy;
352 __u32 width;
353 __u32 height;
354 __u32 color;
355 __u32 rop;
356};
357
358struct fb_image {
359 __u32 dx; /* Where to place image */
360 __u32 dy;
361 __u32 width; /* Size of image */
362 __u32 height;
363 __u32 fg_color; /* Only used when a mono bitmap */
364 __u32 bg_color;
365 __u8 depth; /* Depth of the image */
366 const char *data; /* Pointer to image data */
367 struct fb_cmap cmap; /* color map info */
368};
369
370/*
371 * hardware cursor control
372 */
373
374#define FB_CUR_SETIMAGE 0x01
375#define FB_CUR_SETPOS 0x02
376#define FB_CUR_SETHOT 0x04
377#define FB_CUR_SETCMAP 0x08
378#define FB_CUR_SETSHAPE 0x10
379#define FB_CUR_SETSIZE 0x20
380#define FB_CUR_SETALL 0xFF
381
382struct fbcurpos {
383 __u16 x, y;
384};
385
386struct fb_cursor {
387 __u16 set; /* what to set */
388 __u16 enable; /* cursor on/off */
389 __u16 rop; /* bitop operation */
390 const char *mask; /* cursor mask bits */
391 struct fbcurpos hot; /* cursor hot spot */
392 struct fb_image image; /* Cursor image */
393};
394
395#ifdef CONFIG_FB_BACKLIGHT
396/* Settings for the generic backlight code */
397#define FB_BACKLIGHT_LEVELS 128
398#define FB_BACKLIGHT_MAX 0xFF
399#endif
400
401
402#endif /* _UAPI_LINUX_FB_H */
diff --git a/include/uapi/linux/fcntl.h b/include/uapi/linux/fcntl.h
new file mode 100644
index 000000000000..074b886c6be0
--- /dev/null
+++ b/include/uapi/linux/fcntl.h
@@ -0,0 +1,52 @@
1#ifndef _UAPI_LINUX_FCNTL_H
2#define _UAPI_LINUX_FCNTL_H
3
4#include <asm/fcntl.h>
5
6#define F_SETLEASE (F_LINUX_SPECIFIC_BASE + 0)
7#define F_GETLEASE (F_LINUX_SPECIFIC_BASE + 1)
8
9/*
10 * Cancel a blocking posix lock; internal use only until we expose an
11 * asynchronous lock api to userspace:
12 */
13#define F_CANCELLK (F_LINUX_SPECIFIC_BASE + 5)
14
15/* Create a file descriptor with FD_CLOEXEC set. */
16#define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6)
17
18/*
19 * Request nofications on a directory.
20 * See below for events that may be notified.
21 */
22#define F_NOTIFY (F_LINUX_SPECIFIC_BASE+2)
23
24/*
25 * Set and get of pipe page size array
26 */
27#define F_SETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 7)
28#define F_GETPIPE_SZ (F_LINUX_SPECIFIC_BASE + 8)
29
30/*
31 * Types of directory notifications that may be requested.
32 */
33#define DN_ACCESS 0x00000001 /* File accessed */
34#define DN_MODIFY 0x00000002 /* File modified */
35#define DN_CREATE 0x00000004 /* File created */
36#define DN_DELETE 0x00000008 /* File removed */
37#define DN_RENAME 0x00000010 /* File renamed */
38#define DN_ATTRIB 0x00000020 /* File changed attibutes */
39#define DN_MULTISHOT 0x80000000 /* Don't remove notifier */
40
41#define AT_FDCWD -100 /* Special value used to indicate
42 openat should use the current
43 working directory. */
44#define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
45#define AT_REMOVEDIR 0x200 /* Remove directory instead of
46 unlinking file. */
47#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
48#define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */
49#define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */
50
51
52#endif /* _UAPI_LINUX_FCNTL_H */
diff --git a/include/uapi/linux/fd.h b/include/uapi/linux/fd.h
new file mode 100644
index 000000000000..f1f3dd5981b2
--- /dev/null
+++ b/include/uapi/linux/fd.h
@@ -0,0 +1,382 @@
1#ifndef _UAPI_LINUX_FD_H
2#define _UAPI_LINUX_FD_H
3
4#include <linux/ioctl.h>
5#include <linux/compiler.h>
6
7/* New file layout: Now the ioctl definitions immediately follow the
8 * definitions of the structures that they use */
9
10/*
11 * Geometry
12 */
13struct floppy_struct {
14 unsigned int size, /* nr of sectors total */
15 sect, /* sectors per track */
16 head, /* nr of heads */
17 track, /* nr of tracks */
18 stretch; /* bit 0 !=0 means double track steps */
19 /* bit 1 != 0 means swap sides */
20 /* bits 2..9 give the first sector */
21 /* number (the LSB is flipped) */
22#define FD_STRETCH 1
23#define FD_SWAPSIDES 2
24#define FD_ZEROBASED 4
25#define FD_SECTBASEMASK 0x3FC
26#define FD_MKSECTBASE(s) (((s) ^ 1) << 2)
27#define FD_SECTBASE(floppy) ((((floppy)->stretch & FD_SECTBASEMASK) >> 2) ^ 1)
28
29 unsigned char gap, /* gap1 size */
30
31 rate, /* data rate. |= 0x40 for perpendicular */
32#define FD_2M 0x4
33#define FD_SIZECODEMASK 0x38
34#define FD_SIZECODE(floppy) (((((floppy)->rate&FD_SIZECODEMASK)>> 3)+ 2) %8)
35#define FD_SECTSIZE(floppy) ( (floppy)->rate & FD_2M ? \
36 512 : 128 << FD_SIZECODE(floppy) )
37#define FD_PERP 0x40
38
39 spec1, /* stepping rate, head unload time */
40 fmt_gap; /* gap2 size */
41 const char * name; /* used only for predefined formats */
42};
43
44
45/* commands needing write access have 0x40 set */
46/* commands needing super user access have 0x80 set */
47
48#define FDCLRPRM _IO(2, 0x41)
49/* clear user-defined parameters */
50
51#define FDSETPRM _IOW(2, 0x42, struct floppy_struct)
52#define FDSETMEDIAPRM FDSETPRM
53/* set user-defined parameters for current media */
54
55#define FDDEFPRM _IOW(2, 0x43, struct floppy_struct)
56#define FDGETPRM _IOR(2, 0x04, struct floppy_struct)
57#define FDDEFMEDIAPRM FDDEFPRM
58#define FDGETMEDIAPRM FDGETPRM
59/* set/get disk parameters */
60
61
62#define FDMSGON _IO(2,0x45)
63#define FDMSGOFF _IO(2,0x46)
64/* issue/don't issue kernel messages on media type change */
65
66
67/*
68 * Formatting (obsolete)
69 */
70#define FD_FILL_BYTE 0xF6 /* format fill byte. */
71
72struct format_descr {
73 unsigned int device,head,track;
74};
75
76#define FDFMTBEG _IO(2,0x47)
77/* begin formatting a disk */
78#define FDFMTTRK _IOW(2,0x48, struct format_descr)
79/* format the specified track */
80#define FDFMTEND _IO(2,0x49)
81/* end formatting a disk */
82
83
84/*
85 * Error thresholds
86 */
87struct floppy_max_errors {
88 unsigned int
89 abort, /* number of errors to be reached before aborting */
90 read_track, /* maximal number of errors permitted to read an
91 * entire track at once */
92 reset, /* maximal number of errors before a reset is tried */
93 recal, /* maximal number of errors before a recalibrate is
94 * tried */
95
96 /*
97 * Threshold for reporting FDC errors to the console.
98 * Setting this to zero may flood your screen when using
99 * ultra cheap floppies ;-)
100 */
101 reporting;
102
103};
104
105#define FDSETEMSGTRESH _IO(2,0x4a)
106/* set fdc error reporting threshold */
107
108#define FDFLUSH _IO(2,0x4b)
109/* flush buffers for media; either for verifying media, or for
110 * handling a media change without closing the file descriptor */
111
112#define FDSETMAXERRS _IOW(2, 0x4c, struct floppy_max_errors)
113#define FDGETMAXERRS _IOR(2, 0x0e, struct floppy_max_errors)
114/* set/get abortion and read_track threshold. See also floppy_drive_params
115 * structure */
116
117
118typedef char floppy_drive_name[16];
119#define FDGETDRVTYP _IOR(2, 0x0f, floppy_drive_name)
120/* get drive type: 5 1/4 or 3 1/2 */
121
122
123/*
124 * Drive parameters (user modifiable)
125 */
126struct floppy_drive_params {
127 signed char cmos; /* CMOS type */
128
129 /* Spec2 is (HLD<<1 | ND), where HLD is head load time (1=2ms, 2=4 ms
130 * etc) and ND is set means no DMA. Hardcoded to 6 (HLD=6ms, use DMA).
131 */
132 unsigned long max_dtr; /* Step rate, usec */
133 unsigned long hlt; /* Head load/settle time, msec */
134 unsigned long hut; /* Head unload time (remnant of
135 * 8" drives) */
136 unsigned long srt; /* Step rate, usec */
137
138 unsigned long spinup; /* time needed for spinup (expressed
139 * in jiffies) */
140 unsigned long spindown; /* timeout needed for spindown */
141 unsigned char spindown_offset; /* decides in which position the disk
142 * will stop */
143 unsigned char select_delay; /* delay to wait after select */
144 unsigned char rps; /* rotations per second */
145 unsigned char tracks; /* maximum number of tracks */
146 unsigned long timeout; /* timeout for interrupt requests */
147
148 unsigned char interleave_sect; /* if there are more sectors, use
149 * interleave */
150
151 struct floppy_max_errors max_errors;
152
153 char flags; /* various flags, including ftd_msg */
154/*
155 * Announce successful media type detection and media information loss after
156 * disk changes.
157 * Also used to enable/disable printing of overrun warnings.
158 */
159
160#define FTD_MSG 0x10
161#define FD_BROKEN_DCL 0x20
162#define FD_DEBUG 0x02
163#define FD_SILENT_DCL_CLEAR 0x4
164#define FD_INVERTED_DCL 0x80 /* must be 0x80, because of hardware
165 considerations */
166
167 char read_track; /* use readtrack during probing? */
168
169/*
170 * Auto-detection. Each drive type has eight formats which are
171 * used in succession to try to read the disk. If the FDC cannot lock onto
172 * the disk, the next format is tried. This uses the variable 'probing'.
173 */
174 short autodetect[8]; /* autodetected formats */
175
176 int checkfreq; /* how often should the drive be checked for disk
177 * changes */
178 int native_format; /* native format of this drive */
179};
180
181enum {
182 FD_NEED_TWADDLE_BIT, /* more magic */
183 FD_VERIFY_BIT, /* inquire for write protection */
184 FD_DISK_NEWCHANGE_BIT, /* change detected, and no action undertaken yet
185 * to clear media change status */
186 FD_UNUSED_BIT,
187 FD_DISK_CHANGED_BIT, /* disk has been changed since last i/o */
188 FD_DISK_WRITABLE_BIT /* disk is writable */
189};
190
191#define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params)
192#define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params)
193/* set/get drive parameters */
194
195
196/*
197 * Current drive state (not directly modifiable by user, readonly)
198 */
199struct floppy_drive_struct {
200 unsigned long flags;
201/* values for these flags */
202#define FD_NEED_TWADDLE (1 << FD_NEED_TWADDLE_BIT)
203#define FD_VERIFY (1 << FD_VERIFY_BIT)
204#define FD_DISK_NEWCHANGE (1 << FD_DISK_NEWCHANGE_BIT)
205#define FD_DISK_CHANGED (1 << FD_DISK_CHANGED_BIT)
206#define FD_DISK_WRITABLE (1 << FD_DISK_WRITABLE_BIT)
207
208 unsigned long spinup_date;
209 unsigned long select_date;
210 unsigned long first_read_date;
211 short probed_format;
212 short track; /* current track */
213 short maxblock; /* id of highest block read */
214 short maxtrack; /* id of highest half track read */
215 int generation; /* how many diskchanges? */
216
217/*
218 * (User-provided) media information is _not_ discarded after a media change
219 * if the corresponding keep_data flag is non-zero. Positive values are
220 * decremented after each probe.
221 */
222 int keep_data;
223
224 /* Prevent "aliased" accesses. */
225 int fd_ref;
226 int fd_device;
227 unsigned long last_checked; /* when was the drive last checked for a disk
228 * change? */
229
230 char *dmabuf;
231 int bufblocks;
232};
233
234#define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct)
235#define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct)
236/* get drive state: GET returns the cached state, POLL polls for new state */
237
238
239/*
240 * reset FDC
241 */
242enum reset_mode {
243 FD_RESET_IF_NEEDED, /* reset only if the reset flags is set */
244 FD_RESET_IF_RAWCMD, /* obsolete */
245 FD_RESET_ALWAYS /* reset always */
246};
247#define FDRESET _IO(2, 0x54)
248
249
250/*
251 * FDC state
252 */
253struct floppy_fdc_state {
254 int spec1; /* spec1 value last used */
255 int spec2; /* spec2 value last used */
256 int dtr;
257 unsigned char version; /* FDC version code */
258 unsigned char dor;
259 unsigned long address; /* io address */
260 unsigned int rawcmd:2;
261 unsigned int reset:1;
262 unsigned int need_configure:1;
263 unsigned int perp_mode:2;
264 unsigned int has_fifo:1;
265 unsigned int driver_version; /* version code for floppy driver */
266#define FD_DRIVER_VERSION 0x100
267/* user programs using the floppy API should use floppy_fdc_state to
268 * get the version number of the floppy driver that they are running
269 * on. If this version number is bigger than the one compiled into the
270 * user program (the FD_DRIVER_VERSION define), it should be prepared
271 * to bigger structures
272 */
273
274 unsigned char track[4];
275 /* Position of the heads of the 4 units attached to this FDC,
276 * as stored on the FDC. In the future, the position as stored
277 * on the FDC might not agree with the actual physical
278 * position of these drive heads. By allowing such
279 * disagreement, it will be possible to reset the FDC without
280 * incurring the expensive cost of repositioning all heads.
281 * Right now, these positions are hard wired to 0. */
282
283};
284
285#define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state)
286
287
288/*
289 * Asynchronous Write error tracking
290 */
291struct floppy_write_errors {
292 /* Write error logging.
293 *
294 * These fields can be cleared with the FDWERRORCLR ioctl.
295 * Only writes that were attempted but failed due to a physical media
296 * error are logged. write(2) calls that fail and return an error code
297 * to the user process are not counted.
298 */
299
300 unsigned int write_errors; /* number of physical write errors
301 * encountered */
302
303 /* position of first and last write errors */
304 unsigned long first_error_sector;
305 int first_error_generation;
306 unsigned long last_error_sector;
307 int last_error_generation;
308
309 unsigned int badness; /* highest retry count for a read or write
310 * operation */
311};
312
313#define FDWERRORCLR _IO(2, 0x56)
314/* clear write error and badness information */
315#define FDWERRORGET _IOR(2, 0x17, struct floppy_write_errors)
316/* get write error and badness information */
317
318
319/*
320 * Raw commands
321 */
322/* new interface flag: now we can do them in batches */
323#define FDHAVEBATCHEDRAWCMD
324
325struct floppy_raw_cmd {
326 unsigned int flags;
327#define FD_RAW_READ 1
328#define FD_RAW_WRITE 2
329#define FD_RAW_NO_MOTOR 4
330#define FD_RAW_DISK_CHANGE 4 /* out: disk change flag was set */
331#define FD_RAW_INTR 8 /* wait for an interrupt */
332#define FD_RAW_SPIN 0x10 /* spin up the disk for this command */
333#define FD_RAW_NO_MOTOR_AFTER 0x20 /* switch the motor off after command
334 * completion */
335#define FD_RAW_NEED_DISK 0x40 /* this command needs a disk to be present */
336#define FD_RAW_NEED_SEEK 0x80 /* this command uses an implied seek (soft) */
337
338/* more "in" flags */
339#define FD_RAW_MORE 0x100 /* more records follow */
340#define FD_RAW_STOP_IF_FAILURE 0x200 /* stop if we encounter a failure */
341#define FD_RAW_STOP_IF_SUCCESS 0x400 /* stop if command successful */
342#define FD_RAW_SOFTFAILURE 0x800 /* consider the return value for failure
343 * detection too */
344
345/* more "out" flags */
346#define FD_RAW_FAILURE 0x10000 /* command sent to fdc, fdc returned error */
347#define FD_RAW_HARDFAILURE 0x20000 /* fdc had to be reset, or timed out */
348
349 void __user *data;
350 char *kernel_data; /* location of data buffer in the kernel */
351 struct floppy_raw_cmd *next; /* used for chaining of raw cmd's
352 * within the kernel */
353 long length; /* in: length of dma transfer. out: remaining bytes */
354 long phys_length; /* physical length, if different from dma length */
355 int buffer_length; /* length of allocated buffer */
356
357 unsigned char rate;
358 unsigned char cmd_count;
359 unsigned char cmd[16];
360 unsigned char reply_count;
361 unsigned char reply[16];
362 int track;
363 int resultcode;
364
365 int reserved1;
366 int reserved2;
367};
368
369#define FDRAWCMD _IO(2, 0x58)
370/* send a raw command to the fdc. Structure size not included, because of
371 * batches */
372
373#define FDTWADDLE _IO(2, 0x59)
374/* flicker motor-on bit before reading a sector. Experimental */
375
376
377#define FDEJECT _IO(2, 0x5a)
378/* eject the disk */
379
380
381
382#endif /* _UAPI_LINUX_FD_H */
diff --git a/include/linux/fdreg.h b/include/uapi/linux/fdreg.h
index 61ce64169004..61ce64169004 100644
--- a/include/linux/fdreg.h
+++ b/include/uapi/linux/fdreg.h
diff --git a/include/linux/fib_rules.h b/include/uapi/linux/fib_rules.h
index 51da65b68b85..51da65b68b85 100644
--- a/include/linux/fib_rules.h
+++ b/include/uapi/linux/fib_rules.h
diff --git a/include/linux/fiemap.h b/include/uapi/linux/fiemap.h
index d830747f5c0b..d830747f5c0b 100644
--- a/include/linux/fiemap.h
+++ b/include/uapi/linux/fiemap.h
diff --git a/include/uapi/linux/filter.h b/include/uapi/linux/filter.h
new file mode 100644
index 000000000000..3d7922433aba
--- /dev/null
+++ b/include/uapi/linux/filter.h
@@ -0,0 +1,135 @@
1/*
2 * Linux Socket Filter Data Structures
3 */
4
5#ifndef _UAPI__LINUX_FILTER_H__
6#define _UAPI__LINUX_FILTER_H__
7
8#include <linux/compiler.h>
9#include <linux/types.h>
10
11
12/*
13 * Current version of the filter code architecture.
14 */
15#define BPF_MAJOR_VERSION 1
16#define BPF_MINOR_VERSION 1
17
18/*
19 * Try and keep these values and structures similar to BSD, especially
20 * the BPF code definitions which need to match so you can share filters
21 */
22
23struct sock_filter { /* Filter block */
24 __u16 code; /* Actual filter code */
25 __u8 jt; /* Jump true */
26 __u8 jf; /* Jump false */
27 __u32 k; /* Generic multiuse field */
28};
29
30struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
31 unsigned short len; /* Number of filter blocks */
32 struct sock_filter __user *filter;
33};
34
35/*
36 * Instruction classes
37 */
38
39#define BPF_CLASS(code) ((code) & 0x07)
40#define BPF_LD 0x00
41#define BPF_LDX 0x01
42#define BPF_ST 0x02
43#define BPF_STX 0x03
44#define BPF_ALU 0x04
45#define BPF_JMP 0x05
46#define BPF_RET 0x06
47#define BPF_MISC 0x07
48
49/* ld/ldx fields */
50#define BPF_SIZE(code) ((code) & 0x18)
51#define BPF_W 0x00
52#define BPF_H 0x08
53#define BPF_B 0x10
54#define BPF_MODE(code) ((code) & 0xe0)
55#define BPF_IMM 0x00
56#define BPF_ABS 0x20
57#define BPF_IND 0x40
58#define BPF_MEM 0x60
59#define BPF_LEN 0x80
60#define BPF_MSH 0xa0
61
62/* alu/jmp fields */
63#define BPF_OP(code) ((code) & 0xf0)
64#define BPF_ADD 0x00
65#define BPF_SUB 0x10
66#define BPF_MUL 0x20
67#define BPF_DIV 0x30
68#define BPF_OR 0x40
69#define BPF_AND 0x50
70#define BPF_LSH 0x60
71#define BPF_RSH 0x70
72#define BPF_NEG 0x80
73#define BPF_MOD 0x90
74#define BPF_XOR 0xa0
75
76#define BPF_JA 0x00
77#define BPF_JEQ 0x10
78#define BPF_JGT 0x20
79#define BPF_JGE 0x30
80#define BPF_JSET 0x40
81#define BPF_SRC(code) ((code) & 0x08)
82#define BPF_K 0x00
83#define BPF_X 0x08
84
85/* ret - BPF_K and BPF_X also apply */
86#define BPF_RVAL(code) ((code) & 0x18)
87#define BPF_A 0x10
88
89/* misc */
90#define BPF_MISCOP(code) ((code) & 0xf8)
91#define BPF_TAX 0x00
92#define BPF_TXA 0x80
93
94#ifndef BPF_MAXINSNS
95#define BPF_MAXINSNS 4096
96#endif
97
98/*
99 * Macros for filter block array initializers.
100 */
101#ifndef BPF_STMT
102#define BPF_STMT(code, k) { (unsigned short)(code), 0, 0, k }
103#endif
104#ifndef BPF_JUMP
105#define BPF_JUMP(code, k, jt, jf) { (unsigned short)(code), jt, jf, k }
106#endif
107
108/*
109 * Number of scratch memory words for: BPF_ST and BPF_STX
110 */
111#define BPF_MEMWORDS 16
112
113/* RATIONALE. Negative offsets are invalid in BPF.
114 We use them to reference ancillary data.
115 Unlike introduction new instructions, it does not break
116 existing compilers/optimizers.
117 */
118#define SKF_AD_OFF (-0x1000)
119#define SKF_AD_PROTOCOL 0
120#define SKF_AD_PKTTYPE 4
121#define SKF_AD_IFINDEX 8
122#define SKF_AD_NLATTR 12
123#define SKF_AD_NLATTR_NEST 16
124#define SKF_AD_MARK 20
125#define SKF_AD_QUEUE 24
126#define SKF_AD_HATYPE 28
127#define SKF_AD_RXHASH 32
128#define SKF_AD_CPU 36
129#define SKF_AD_ALU_XOR_X 40
130#define SKF_AD_MAX 44
131#define SKF_NET_OFF (-0x100000)
132#define SKF_LL_OFF (-0x200000)
133
134
135#endif /* _UAPI__LINUX_FILTER_H__ */
diff --git a/include/linux/firewire-cdev.h b/include/uapi/linux/firewire-cdev.h
index d50036953497..d50036953497 100644
--- a/include/linux/firewire-cdev.h
+++ b/include/uapi/linux/firewire-cdev.h
diff --git a/include/linux/firewire-constants.h b/include/uapi/linux/firewire-constants.h
index 9b4bb5fbba4b..9b4bb5fbba4b 100644
--- a/include/linux/firewire-constants.h
+++ b/include/uapi/linux/firewire-constants.h
diff --git a/include/uapi/linux/flat.h b/include/uapi/linux/flat.h
new file mode 100644
index 000000000000..88cd6baba8f3
--- /dev/null
+++ b/include/uapi/linux/flat.h
@@ -0,0 +1,58 @@
1/*
2 * Copyright (C) 2002-2003 David McCullough <davidm@snapgear.com>
3 * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>
4 * The Silver Hammer Group, Ltd.
5 *
6 * This file provides the definitions and structures needed to
7 * support uClinux flat-format executables.
8 */
9
10#ifndef _UAPI_LINUX_FLAT_H
11#define _UAPI_LINUX_FLAT_H
12
13
14#define FLAT_VERSION 0x00000004L
15
16#ifdef CONFIG_BINFMT_SHARED_FLAT
17#define MAX_SHARED_LIBS (4)
18#else
19#define MAX_SHARED_LIBS (1)
20#endif
21
22/*
23 * To make everything easier to port and manage cross platform
24 * development, all fields are in network byte order.
25 */
26
27struct flat_hdr {
28 char magic[4];
29 unsigned long rev; /* version (as above) */
30 unsigned long entry; /* Offset of first executable instruction
31 with text segment from beginning of file */
32 unsigned long data_start; /* Offset of data segment from beginning of
33 file */
34 unsigned long data_end; /* Offset of end of data segment
35 from beginning of file */
36 unsigned long bss_end; /* Offset of end of bss segment from beginning
37 of file */
38
39 /* (It is assumed that data_end through bss_end forms the bss segment.) */
40
41 unsigned long stack_size; /* Size of stack, in bytes */
42 unsigned long reloc_start; /* Offset of relocation records from
43 beginning of file */
44 unsigned long reloc_count; /* Number of relocation records */
45 unsigned long flags;
46 unsigned long build_date; /* When the program/library was built */
47 unsigned long filler[5]; /* Reservered, set to zero */
48};
49
50#define FLAT_FLAG_RAM 0x0001 /* load program entirely into RAM */
51#define FLAT_FLAG_GOTPIC 0x0002 /* program is PIC with GOT */
52#define FLAT_FLAG_GZIP 0x0004 /* all but the header is compressed */
53#define FLAT_FLAG_GZDATA 0x0008 /* only data/relocs are compressed (for XIP) */
54#define FLAT_FLAG_KTRACE 0x0010 /* output useful kernel trace for debugging */
55
56
57
58#endif /* _UAPI_LINUX_FLAT_H */
diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
new file mode 100644
index 000000000000..780d4c6093eb
--- /dev/null
+++ b/include/uapi/linux/fs.h
@@ -0,0 +1,202 @@
1#ifndef _UAPI_LINUX_FS_H
2#define _UAPI_LINUX_FS_H
3
4/*
5 * This file has definitions for some important file table
6 * structures etc.
7 */
8
9#include <linux/limits.h>
10#include <linux/ioctl.h>
11#include <linux/types.h>
12
13/*
14 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
15 * the file limit at runtime and only root can increase the per-process
16 * nr_file rlimit, so it's safe to set up a ridiculously high absolute
17 * upper limit on files-per-process.
18 *
19 * Some programs (notably those using select()) may have to be
20 * recompiled to take full advantage of the new limits..
21 */
22
23/* Fixed constants first: */
24#undef NR_OPEN
25#define INR_OPEN_CUR 1024 /* Initial setting for nfile rlimits */
26#define INR_OPEN_MAX 4096 /* Hard limit for nfile rlimits */
27
28#define BLOCK_SIZE_BITS 10
29#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
30
31#define SEEK_SET 0 /* seek relative to beginning of file */
32#define SEEK_CUR 1 /* seek relative to current file position */
33#define SEEK_END 2 /* seek relative to end of file */
34#define SEEK_DATA 3 /* seek to the next data */
35#define SEEK_HOLE 4 /* seek to the next hole */
36#define SEEK_MAX SEEK_HOLE
37
38struct fstrim_range {
39 __u64 start;
40 __u64 len;
41 __u64 minlen;
42};
43
44/* And dynamically-tunable limits and defaults: */
45struct files_stat_struct {
46 unsigned long nr_files; /* read only */
47 unsigned long nr_free_files; /* read only */
48 unsigned long max_files; /* tunable */
49};
50
51struct inodes_stat_t {
52 int nr_inodes;
53 int nr_unused;
54 int dummy[5]; /* padding for sysctl ABI compatibility */
55};
56
57
58#define NR_FILE 8192 /* this can well be larger on a larger system */
59
60
61/*
62 * These are the fs-independent mount-flags: up to 32 flags are supported
63 */
64#define MS_RDONLY 1 /* Mount read-only */
65#define MS_NOSUID 2 /* Ignore suid and sgid bits */
66#define MS_NODEV 4 /* Disallow access to device special files */
67#define MS_NOEXEC 8 /* Disallow program execution */
68#define MS_SYNCHRONOUS 16 /* Writes are synced at once */
69#define MS_REMOUNT 32 /* Alter flags of a mounted FS */
70#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */
71#define MS_DIRSYNC 128 /* Directory modifications are synchronous */
72#define MS_NOATIME 1024 /* Do not update access times. */
73#define MS_NODIRATIME 2048 /* Do not update directory access times */
74#define MS_BIND 4096
75#define MS_MOVE 8192
76#define MS_REC 16384
77#define MS_VERBOSE 32768 /* War is peace. Verbosity is silence.
78 MS_VERBOSE is deprecated. */
79#define MS_SILENT 32768
80#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
81#define MS_UNBINDABLE (1<<17) /* change to unbindable */
82#define MS_PRIVATE (1<<18) /* change to private */
83#define MS_SLAVE (1<<19) /* change to slave */
84#define MS_SHARED (1<<20) /* change to shared */
85#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
86#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
87#define MS_I_VERSION (1<<23) /* Update inode I_version field */
88#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
89#define MS_NOSEC (1<<28)
90#define MS_BORN (1<<29)
91#define MS_ACTIVE (1<<30)
92#define MS_NOUSER (1<<31)
93
94/*
95 * Superblock flags that can be altered by MS_REMOUNT
96 */
97#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION)
98
99/*
100 * Old magic mount flag and mask
101 */
102#define MS_MGC_VAL 0xC0ED0000
103#define MS_MGC_MSK 0xffff0000
104
105/* the read-only stuff doesn't really belong here, but any other place is
106 probably as bad and I don't want to create yet another include file. */
107
108#define BLKROSET _IO(0x12,93) /* set device read-only (0 = read-write) */
109#define BLKROGET _IO(0x12,94) /* get read-only status (0 = read_write) */
110#define BLKRRPART _IO(0x12,95) /* re-read partition table */
111#define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */
112#define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */
113#define BLKRASET _IO(0x12,98) /* set read ahead for block device */
114#define BLKRAGET _IO(0x12,99) /* get current read ahead setting */
115#define BLKFRASET _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
116#define BLKFRAGET _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
117#define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
118#define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
119#define BLKSSZGET _IO(0x12,104)/* get block device sector size */
120#if 0
121#define BLKPG _IO(0x12,105)/* See blkpg.h */
122
123/* Some people are morons. Do not use sizeof! */
124
125#define BLKELVGET _IOR(0x12,106,size_t)/* elevator get */
126#define BLKELVSET _IOW(0x12,107,size_t)/* elevator set */
127/* This was here just to show that the number is taken -
128 probably all these _IO(0x12,*) ioctls should be moved to blkpg.h. */
129#endif
130/* A jump here: 108-111 have been used for various private purposes. */
131#define BLKBSZGET _IOR(0x12,112,size_t)
132#define BLKBSZSET _IOW(0x12,113,size_t)
133#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size in bytes (u64 *arg) */
134#define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup)
135#define BLKTRACESTART _IO(0x12,116)
136#define BLKTRACESTOP _IO(0x12,117)
137#define BLKTRACETEARDOWN _IO(0x12,118)
138#define BLKDISCARD _IO(0x12,119)
139#define BLKIOMIN _IO(0x12,120)
140#define BLKIOOPT _IO(0x12,121)
141#define BLKALIGNOFF _IO(0x12,122)
142#define BLKPBSZGET _IO(0x12,123)
143#define BLKDISCARDZEROES _IO(0x12,124)
144#define BLKSECDISCARD _IO(0x12,125)
145#define BLKROTATIONAL _IO(0x12,126)
146#define BLKZEROOUT _IO(0x12,127)
147
148#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
149#define FIBMAP _IO(0x00,1) /* bmap access */
150#define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */
151#define FIFREEZE _IOWR('X', 119, int) /* Freeze */
152#define FITHAW _IOWR('X', 120, int) /* Thaw */
153#define FITRIM _IOWR('X', 121, struct fstrim_range) /* Trim */
154
155#define FS_IOC_GETFLAGS _IOR('f', 1, long)
156#define FS_IOC_SETFLAGS _IOW('f', 2, long)
157#define FS_IOC_GETVERSION _IOR('v', 1, long)
158#define FS_IOC_SETVERSION _IOW('v', 2, long)
159#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
160#define FS_IOC32_GETFLAGS _IOR('f', 1, int)
161#define FS_IOC32_SETFLAGS _IOW('f', 2, int)
162#define FS_IOC32_GETVERSION _IOR('v', 1, int)
163#define FS_IOC32_SETVERSION _IOW('v', 2, int)
164
165/*
166 * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)
167 */
168#define FS_SECRM_FL 0x00000001 /* Secure deletion */
169#define FS_UNRM_FL 0x00000002 /* Undelete */
170#define FS_COMPR_FL 0x00000004 /* Compress file */
171#define FS_SYNC_FL 0x00000008 /* Synchronous updates */
172#define FS_IMMUTABLE_FL 0x00000010 /* Immutable file */
173#define FS_APPEND_FL 0x00000020 /* writes to file may only append */
174#define FS_NODUMP_FL 0x00000040 /* do not dump file */
175#define FS_NOATIME_FL 0x00000080 /* do not update atime */
176/* Reserved for compression usage... */
177#define FS_DIRTY_FL 0x00000100
178#define FS_COMPRBLK_FL 0x00000200 /* One or more compressed clusters */
179#define FS_NOCOMP_FL 0x00000400 /* Don't compress */
180#define FS_ECOMPR_FL 0x00000800 /* Compression error */
181/* End compression flags --- maybe not all used */
182#define FS_BTREE_FL 0x00001000 /* btree format dir */
183#define FS_INDEX_FL 0x00001000 /* hash-indexed directory */
184#define FS_IMAGIC_FL 0x00002000 /* AFS directory */
185#define FS_JOURNAL_DATA_FL 0x00004000 /* Reserved for ext3 */
186#define FS_NOTAIL_FL 0x00008000 /* file tail should not be merged */
187#define FS_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
188#define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
189#define FS_EXTENT_FL 0x00080000 /* Extents */
190#define FS_DIRECTIO_FL 0x00100000 /* Use direct i/o */
191#define FS_NOCOW_FL 0x00800000 /* Do not cow file */
192#define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
193
194#define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
195#define FS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
196
197
198#define SYNC_FILE_RANGE_WAIT_BEFORE 1
199#define SYNC_FILE_RANGE_WRITE 2
200#define SYNC_FILE_RANGE_WAIT_AFTER 4
201
202#endif /* _UAPI_LINUX_FS_H */
diff --git a/include/uapi/linux/fsl_hypervisor.h b/include/uapi/linux/fsl_hypervisor.h
new file mode 100644
index 000000000000..1bf04967fec4
--- /dev/null
+++ b/include/uapi/linux/fsl_hypervisor.h
@@ -0,0 +1,220 @@
1/*
2 * Freescale hypervisor ioctl and kernel interface
3 *
4 * Copyright (C) 2008-2011 Freescale Semiconductor, Inc.
5 * Author: Timur Tabi <timur@freescale.com>
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of Freescale Semiconductor nor the
15 * names of its contributors may be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 *
19 * ALTERNATIVELY, this software may be distributed under the terms of the
20 * GNU General Public License ("GPL") as published by the Free Software
21 * Foundation, either version 2 of that License or (at your option) any
22 * later version.
23 *
24 * This software is provided by Freescale Semiconductor "as is" and any
25 * express or implied warranties, including, but not limited to, the implied
26 * warranties of merchantability and fitness for a particular purpose are
27 * disclaimed. In no event shall Freescale Semiconductor be liable for any
28 * direct, indirect, incidental, special, exemplary, or consequential damages
29 * (including, but not limited to, procurement of substitute goods or services;
30 * loss of use, data, or profits; or business interruption) however caused and
31 * on any theory of liability, whether in contract, strict liability, or tort
32 * (including negligence or otherwise) arising in any way out of the use of this
33 * software, even if advised of the possibility of such damage.
34 *
35 * This file is used by the Freescale hypervisor management driver. It can
36 * also be included by applications that need to communicate with the driver
37 * via the ioctl interface.
38 */
39
40#ifndef _UAPIFSL_HYPERVISOR_H
41#define _UAPIFSL_HYPERVISOR_H
42
43#include <linux/types.h>
44
45/**
46 * struct fsl_hv_ioctl_restart - restart a partition
47 * @ret: return error code from the hypervisor
48 * @partition: the ID of the partition to restart, or -1 for the
49 * calling partition
50 *
51 * Used by FSL_HV_IOCTL_PARTITION_RESTART
52 */
53struct fsl_hv_ioctl_restart {
54 __u32 ret;
55 __u32 partition;
56};
57
58/**
59 * struct fsl_hv_ioctl_status - get a partition's status
60 * @ret: return error code from the hypervisor
61 * @partition: the ID of the partition to query, or -1 for the
62 * calling partition
63 * @status: The returned status of the partition
64 *
65 * Used by FSL_HV_IOCTL_PARTITION_GET_STATUS
66 *
67 * Values of 'status':
68 * 0 = Stopped
69 * 1 = Running
70 * 2 = Starting
71 * 3 = Stopping
72 */
73struct fsl_hv_ioctl_status {
74 __u32 ret;
75 __u32 partition;
76 __u32 status;
77};
78
79/**
80 * struct fsl_hv_ioctl_start - start a partition
81 * @ret: return error code from the hypervisor
82 * @partition: the ID of the partition to control
83 * @entry_point: The offset within the guest IMA to start execution
84 * @load: If non-zero, reload the partition's images before starting
85 *
86 * Used by FSL_HV_IOCTL_PARTITION_START
87 */
88struct fsl_hv_ioctl_start {
89 __u32 ret;
90 __u32 partition;
91 __u32 entry_point;
92 __u32 load;
93};
94
95/**
96 * struct fsl_hv_ioctl_stop - stop a partition
97 * @ret: return error code from the hypervisor
98 * @partition: the ID of the partition to stop, or -1 for the calling
99 * partition
100 *
101 * Used by FSL_HV_IOCTL_PARTITION_STOP
102 */
103struct fsl_hv_ioctl_stop {
104 __u32 ret;
105 __u32 partition;
106};
107
108/**
109 * struct fsl_hv_ioctl_memcpy - copy memory between partitions
110 * @ret: return error code from the hypervisor
111 * @source: the partition ID of the source partition, or -1 for this
112 * partition
113 * @target: the partition ID of the target partition, or -1 for this
114 * partition
115 * @reserved: reserved, must be set to 0
116 * @local_addr: user-space virtual address of a buffer in the local
117 * partition
118 * @remote_addr: guest physical address of a buffer in the
119 * remote partition
120 * @count: the number of bytes to copy. Both the local and remote
121 * buffers must be at least 'count' bytes long
122 *
123 * Used by FSL_HV_IOCTL_MEMCPY
124 *
125 * The 'local' partition is the partition that calls this ioctl. The
126 * 'remote' partition is a different partition. The data is copied from
127 * the 'source' paritition' to the 'target' partition.
128 *
129 * The buffer in the remote partition must be guest physically
130 * contiguous.
131 *
132 * This ioctl does not support copying memory between two remote
133 * partitions or within the same partition, so either 'source' or
134 * 'target' (but not both) must be -1. In other words, either
135 *
136 * source == local and target == remote
137 * or
138 * source == remote and target == local
139 */
140struct fsl_hv_ioctl_memcpy {
141 __u32 ret;
142 __u32 source;
143 __u32 target;
144 __u32 reserved; /* padding to ensure local_vaddr is aligned */
145 __u64 local_vaddr;
146 __u64 remote_paddr;
147 __u64 count;
148};
149
150/**
151 * struct fsl_hv_ioctl_doorbell - ring a doorbell
152 * @ret: return error code from the hypervisor
153 * @doorbell: the handle of the doorbell to ring doorbell
154 *
155 * Used by FSL_HV_IOCTL_DOORBELL
156 */
157struct fsl_hv_ioctl_doorbell {
158 __u32 ret;
159 __u32 doorbell;
160};
161
162/**
163 * struct fsl_hv_ioctl_prop - get/set a device tree property
164 * @ret: return error code from the hypervisor
165 * @handle: handle of partition whose tree to access
166 * @path: virtual address of path name of node to access
167 * @propname: virtual address of name of property to access
168 * @propval: virtual address of property data buffer
169 * @proplen: Size of property data buffer
170 * @reserved: reserved, must be set to 0
171 *
172 * Used by FSL_HV_IOCTL_DOORBELL
173 */
174struct fsl_hv_ioctl_prop {
175 __u32 ret;
176 __u32 handle;
177 __u64 path;
178 __u64 propname;
179 __u64 propval;
180 __u32 proplen;
181 __u32 reserved; /* padding to ensure structure is aligned */
182};
183
184/* The ioctl type, documented in ioctl-number.txt */
185#define FSL_HV_IOCTL_TYPE 0xAF
186
187/* Restart another partition */
188#define FSL_HV_IOCTL_PARTITION_RESTART \
189 _IOWR(FSL_HV_IOCTL_TYPE, 1, struct fsl_hv_ioctl_restart)
190
191/* Get a partition's status */
192#define FSL_HV_IOCTL_PARTITION_GET_STATUS \
193 _IOWR(FSL_HV_IOCTL_TYPE, 2, struct fsl_hv_ioctl_status)
194
195/* Boot another partition */
196#define FSL_HV_IOCTL_PARTITION_START \
197 _IOWR(FSL_HV_IOCTL_TYPE, 3, struct fsl_hv_ioctl_start)
198
199/* Stop this or another partition */
200#define FSL_HV_IOCTL_PARTITION_STOP \
201 _IOWR(FSL_HV_IOCTL_TYPE, 4, struct fsl_hv_ioctl_stop)
202
203/* Copy data from one partition to another */
204#define FSL_HV_IOCTL_MEMCPY \
205 _IOWR(FSL_HV_IOCTL_TYPE, 5, struct fsl_hv_ioctl_memcpy)
206
207/* Ring a doorbell */
208#define FSL_HV_IOCTL_DOORBELL \
209 _IOWR(FSL_HV_IOCTL_TYPE, 6, struct fsl_hv_ioctl_doorbell)
210
211/* Get a property from another guest's device tree */
212#define FSL_HV_IOCTL_GETPROP \
213 _IOWR(FSL_HV_IOCTL_TYPE, 7, struct fsl_hv_ioctl_prop)
214
215/* Set a property in another guest's device tree */
216#define FSL_HV_IOCTL_SETPROP \
217 _IOWR(FSL_HV_IOCTL_TYPE, 8, struct fsl_hv_ioctl_prop)
218
219
220#endif /* _UAPIFSL_HYPERVISOR_H */
diff --git a/include/linux/fuse.h b/include/uapi/linux/fuse.h
index d8c713e148e3..d8c713e148e3 100644
--- a/include/linux/fuse.h
+++ b/include/uapi/linux/fuse.h
diff --git a/include/uapi/linux/futex.h b/include/uapi/linux/futex.h
new file mode 100644
index 000000000000..0b1f716373c7
--- /dev/null
+++ b/include/uapi/linux/futex.h
@@ -0,0 +1,152 @@
1#ifndef _UAPI_LINUX_FUTEX_H
2#define _UAPI_LINUX_FUTEX_H
3
4#include <linux/compiler.h>
5#include <linux/types.h>
6
7/* Second argument to futex syscall */
8
9
10#define FUTEX_WAIT 0
11#define FUTEX_WAKE 1
12#define FUTEX_FD 2
13#define FUTEX_REQUEUE 3
14#define FUTEX_CMP_REQUEUE 4
15#define FUTEX_WAKE_OP 5
16#define FUTEX_LOCK_PI 6
17#define FUTEX_UNLOCK_PI 7
18#define FUTEX_TRYLOCK_PI 8
19#define FUTEX_WAIT_BITSET 9
20#define FUTEX_WAKE_BITSET 10
21#define FUTEX_WAIT_REQUEUE_PI 11
22#define FUTEX_CMP_REQUEUE_PI 12
23
24#define FUTEX_PRIVATE_FLAG 128
25#define FUTEX_CLOCK_REALTIME 256
26#define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
27
28#define FUTEX_WAIT_PRIVATE (FUTEX_WAIT | FUTEX_PRIVATE_FLAG)
29#define FUTEX_WAKE_PRIVATE (FUTEX_WAKE | FUTEX_PRIVATE_FLAG)
30#define FUTEX_REQUEUE_PRIVATE (FUTEX_REQUEUE | FUTEX_PRIVATE_FLAG)
31#define FUTEX_CMP_REQUEUE_PRIVATE (FUTEX_CMP_REQUEUE | FUTEX_PRIVATE_FLAG)
32#define FUTEX_WAKE_OP_PRIVATE (FUTEX_WAKE_OP | FUTEX_PRIVATE_FLAG)
33#define FUTEX_LOCK_PI_PRIVATE (FUTEX_LOCK_PI | FUTEX_PRIVATE_FLAG)
34#define FUTEX_UNLOCK_PI_PRIVATE (FUTEX_UNLOCK_PI | FUTEX_PRIVATE_FLAG)
35#define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG)
36#define FUTEX_WAIT_BITSET_PRIVATE (FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG)
37#define FUTEX_WAKE_BITSET_PRIVATE (FUTEX_WAKE_BITSET | FUTEX_PRIVATE_FLAG)
38#define FUTEX_WAIT_REQUEUE_PI_PRIVATE (FUTEX_WAIT_REQUEUE_PI | \
39 FUTEX_PRIVATE_FLAG)
40#define FUTEX_CMP_REQUEUE_PI_PRIVATE (FUTEX_CMP_REQUEUE_PI | \
41 FUTEX_PRIVATE_FLAG)
42
43/*
44 * Support for robust futexes: the kernel cleans up held futexes at
45 * thread exit time.
46 */
47
48/*
49 * Per-lock list entry - embedded in user-space locks, somewhere close
50 * to the futex field. (Note: user-space uses a double-linked list to
51 * achieve O(1) list add and remove, but the kernel only needs to know
52 * about the forward link)
53 *
54 * NOTE: this structure is part of the syscall ABI, and must not be
55 * changed.
56 */
57struct robust_list {
58 struct robust_list __user *next;
59};
60
61/*
62 * Per-thread list head:
63 *
64 * NOTE: this structure is part of the syscall ABI, and must only be
65 * changed if the change is first communicated with the glibc folks.
66 * (When an incompatible change is done, we'll increase the structure
67 * size, which glibc will detect)
68 */
69struct robust_list_head {
70 /*
71 * The head of the list. Points back to itself if empty:
72 */
73 struct robust_list list;
74
75 /*
76 * This relative offset is set by user-space, it gives the kernel
77 * the relative position of the futex field to examine. This way
78 * we keep userspace flexible, to freely shape its data-structure,
79 * without hardcoding any particular offset into the kernel:
80 */
81 long futex_offset;
82
83 /*
84 * The death of the thread may race with userspace setting
85 * up a lock's links. So to handle this race, userspace first
86 * sets this field to the address of the to-be-taken lock,
87 * then does the lock acquire, and then adds itself to the
88 * list, and then clears this field. Hence the kernel will
89 * always have full knowledge of all locks that the thread
90 * _might_ have taken. We check the owner TID in any case,
91 * so only truly owned locks will be handled.
92 */
93 struct robust_list __user *list_op_pending;
94};
95
96/*
97 * Are there any waiters for this robust futex:
98 */
99#define FUTEX_WAITERS 0x80000000
100
101/*
102 * The kernel signals via this bit that a thread holding a futex
103 * has exited without unlocking the futex. The kernel also does
104 * a FUTEX_WAKE on such futexes, after setting the bit, to wake
105 * up any possible waiters:
106 */
107#define FUTEX_OWNER_DIED 0x40000000
108
109/*
110 * The rest of the robust-futex field is for the TID:
111 */
112#define FUTEX_TID_MASK 0x3fffffff
113
114/*
115 * This limit protects against a deliberately circular list.
116 * (Not worth introducing an rlimit for it)
117 */
118#define ROBUST_LIST_LIMIT 2048
119
120/*
121 * bitset with all bits set for the FUTEX_xxx_BITSET OPs to request a
122 * match of any bit.
123 */
124#define FUTEX_BITSET_MATCH_ANY 0xffffffff
125
126
127#define FUTEX_OP_SET 0 /* *(int *)UADDR2 = OPARG; */
128#define FUTEX_OP_ADD 1 /* *(int *)UADDR2 += OPARG; */
129#define FUTEX_OP_OR 2 /* *(int *)UADDR2 |= OPARG; */
130#define FUTEX_OP_ANDN 3 /* *(int *)UADDR2 &= ~OPARG; */
131#define FUTEX_OP_XOR 4 /* *(int *)UADDR2 ^= OPARG; */
132
133#define FUTEX_OP_OPARG_SHIFT 8 /* Use (1 << OPARG) instead of OPARG. */
134
135#define FUTEX_OP_CMP_EQ 0 /* if (oldval == CMPARG) wake */
136#define FUTEX_OP_CMP_NE 1 /* if (oldval != CMPARG) wake */
137#define FUTEX_OP_CMP_LT 2 /* if (oldval < CMPARG) wake */
138#define FUTEX_OP_CMP_LE 3 /* if (oldval <= CMPARG) wake */
139#define FUTEX_OP_CMP_GT 4 /* if (oldval > CMPARG) wake */
140#define FUTEX_OP_CMP_GE 5 /* if (oldval >= CMPARG) wake */
141
142/* FUTEX_WAKE_OP will perform atomically
143 int oldval = *(int *)UADDR2;
144 *(int *)UADDR2 = oldval OP OPARG;
145 if (oldval CMP CMPARG)
146 wake UADDR2; */
147
148#define FUTEX_OP(op, oparg, cmp, cmparg) \
149 (((op & 0xf) << 28) | ((cmp & 0xf) << 24) \
150 | ((oparg & 0xfff) << 12) | (cmparg & 0xfff))
151
152#endif /* _UAPI_LINUX_FUTEX_H */
diff --git a/include/uapi/linux/gameport.h b/include/uapi/linux/gameport.h
new file mode 100644
index 000000000000..49b29b068f40
--- /dev/null
+++ b/include/uapi/linux/gameport.h
@@ -0,0 +1,28 @@
1/*
2 * Copyright (c) 1999-2002 Vojtech Pavlik
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 as published by
6 * the Free Software Foundation.
7 */
8#ifndef _UAPI_GAMEPORT_H
9#define _UAPI_GAMEPORT_H
10
11
12
13#define GAMEPORT_MODE_DISABLED 0
14#define GAMEPORT_MODE_RAW 1
15#define GAMEPORT_MODE_COOKED 2
16
17#define GAMEPORT_ID_VENDOR_ANALOG 0x0001
18#define GAMEPORT_ID_VENDOR_MADCATZ 0x0002
19#define GAMEPORT_ID_VENDOR_LOGITECH 0x0003
20#define GAMEPORT_ID_VENDOR_CREATIVE 0x0004
21#define GAMEPORT_ID_VENDOR_GENIUS 0x0005
22#define GAMEPORT_ID_VENDOR_INTERACT 0x0006
23#define GAMEPORT_ID_VENDOR_MICROSOFT 0x0007
24#define GAMEPORT_ID_VENDOR_THRUSTMASTER 0x0008
25#define GAMEPORT_ID_VENDOR_GRAVIS 0x0009
26#define GAMEPORT_ID_VENDOR_GUILLEMOT 0x000a
27
28#endif /* _UAPI_GAMEPORT_H */
diff --git a/include/linux/gen_stats.h b/include/uapi/linux/gen_stats.h
index 552c8a0a12d1..552c8a0a12d1 100644
--- a/include/linux/gen_stats.h
+++ b/include/uapi/linux/gen_stats.h
diff --git a/include/uapi/linux/genetlink.h b/include/uapi/linux/genetlink.h
new file mode 100644
index 000000000000..c880a417d8a9
--- /dev/null
+++ b/include/uapi/linux/genetlink.h
@@ -0,0 +1,84 @@
1#ifndef _UAPI__LINUX_GENERIC_NETLINK_H
2#define _UAPI__LINUX_GENERIC_NETLINK_H
3
4#include <linux/types.h>
5#include <linux/netlink.h>
6
7#define GENL_NAMSIZ 16 /* length of family name */
8
9#define GENL_MIN_ID NLMSG_MIN_TYPE
10#define GENL_MAX_ID 1023
11
12struct genlmsghdr {
13 __u8 cmd;
14 __u8 version;
15 __u16 reserved;
16};
17
18#define GENL_HDRLEN NLMSG_ALIGN(sizeof(struct genlmsghdr))
19
20#define GENL_ADMIN_PERM 0x01
21#define GENL_CMD_CAP_DO 0x02
22#define GENL_CMD_CAP_DUMP 0x04
23#define GENL_CMD_CAP_HASPOL 0x08
24
25/*
26 * List of reserved static generic netlink identifiers:
27 */
28#define GENL_ID_GENERATE 0
29#define GENL_ID_CTRL NLMSG_MIN_TYPE
30
31/**************************************************************************
32 * Controller
33 **************************************************************************/
34
35enum {
36 CTRL_CMD_UNSPEC,
37 CTRL_CMD_NEWFAMILY,
38 CTRL_CMD_DELFAMILY,
39 CTRL_CMD_GETFAMILY,
40 CTRL_CMD_NEWOPS,
41 CTRL_CMD_DELOPS,
42 CTRL_CMD_GETOPS,
43 CTRL_CMD_NEWMCAST_GRP,
44 CTRL_CMD_DELMCAST_GRP,
45 CTRL_CMD_GETMCAST_GRP, /* unused */
46 __CTRL_CMD_MAX,
47};
48
49#define CTRL_CMD_MAX (__CTRL_CMD_MAX - 1)
50
51enum {
52 CTRL_ATTR_UNSPEC,
53 CTRL_ATTR_FAMILY_ID,
54 CTRL_ATTR_FAMILY_NAME,
55 CTRL_ATTR_VERSION,
56 CTRL_ATTR_HDRSIZE,
57 CTRL_ATTR_MAXATTR,
58 CTRL_ATTR_OPS,
59 CTRL_ATTR_MCAST_GROUPS,
60 __CTRL_ATTR_MAX,
61};
62
63#define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1)
64
65enum {
66 CTRL_ATTR_OP_UNSPEC,
67 CTRL_ATTR_OP_ID,
68 CTRL_ATTR_OP_FLAGS,
69 __CTRL_ATTR_OP_MAX,
70};
71
72#define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1)
73
74enum {
75 CTRL_ATTR_MCAST_GRP_UNSPEC,
76 CTRL_ATTR_MCAST_GRP_NAME,
77 CTRL_ATTR_MCAST_GRP_ID,
78 __CTRL_ATTR_MCAST_GRP_MAX,
79};
80
81#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
82
83
84#endif /* _UAPI__LINUX_GENERIC_NETLINK_H */
diff --git a/include/linux/gfs2_ondisk.h b/include/uapi/linux/gfs2_ondisk.h
index b2de1f9a88d6..b2de1f9a88d6 100644
--- a/include/linux/gfs2_ondisk.h
+++ b/include/uapi/linux/gfs2_ondisk.h
diff --git a/include/linux/gigaset_dev.h b/include/uapi/linux/gigaset_dev.h
index 258ba82937e7..258ba82937e7 100644
--- a/include/linux/gigaset_dev.h
+++ b/include/uapi/linux/gigaset_dev.h
diff --git a/include/uapi/linux/hdlc.h b/include/uapi/linux/hdlc.h
new file mode 100644
index 000000000000..2c5f0aff4cf9
--- /dev/null
+++ b/include/uapi/linux/hdlc.h
@@ -0,0 +1,23 @@
1/*
2 * Generic HDLC support routines for Linux
3 *
4 * Copyright (C) 1999-2005 Krzysztof Halasa <khc@pm.waw.pl>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of version 2 of the GNU General Public License
8 * as published by the Free Software Foundation.
9 */
10
11#ifndef _UAPI__HDLC_H
12#define _UAPI__HDLC_H
13
14
15#define HDLC_MAX_MTU 1500 /* Ethernet 1500 bytes */
16#if 0
17#define HDLC_MAX_MRU (HDLC_MAX_MTU + 10 + 14 + 4) /* for ETH+VLAN over FR */
18#else
19#define HDLC_MAX_MRU 1600 /* as required for FR network */
20#endif
21
22
23#endif /* _UAPI__HDLC_H */
diff --git a/include/uapi/linux/hdlcdrv.h b/include/uapi/linux/hdlcdrv.h
new file mode 100644
index 000000000000..ffc79c0b44a8
--- /dev/null
+++ b/include/uapi/linux/hdlcdrv.h
@@ -0,0 +1,110 @@
1/*
2 * hdlcdrv.h -- HDLC packet radio network driver.
3 * The Linux soundcard driver for 1200 baud and 9600 baud packet radio
4 * (C) 1996-1998 by Thomas Sailer, HB9JNX/AE4WA
5 */
6
7#ifndef _UAPI_HDLCDRV_H
8#define _UAPI_HDLCDRV_H
9
10/* -------------------------------------------------------------------- */
11/*
12 * structs for the IOCTL commands
13 */
14
15struct hdlcdrv_params {
16 int iobase;
17 int irq;
18 int dma;
19 int dma2;
20 int seriobase;
21 int pariobase;
22 int midiiobase;
23};
24
25struct hdlcdrv_channel_params {
26 int tx_delay; /* the transmitter keyup delay in 10ms units */
27 int tx_tail; /* the transmitter keyoff delay in 10ms units */
28 int slottime; /* the slottime in 10ms; usually 10 = 100ms */
29 int ppersist; /* the p-persistence 0..255 */
30 int fulldup; /* some driver do not support full duplex, setting */
31 /* this just makes them send even if DCD is on */
32};
33
34struct hdlcdrv_old_channel_state {
35 int ptt;
36 int dcd;
37 int ptt_keyed;
38};
39
40struct hdlcdrv_channel_state {
41 int ptt;
42 int dcd;
43 int ptt_keyed;
44 unsigned long tx_packets;
45 unsigned long tx_errors;
46 unsigned long rx_packets;
47 unsigned long rx_errors;
48};
49
50struct hdlcdrv_ioctl {
51 int cmd;
52 union {
53 struct hdlcdrv_params mp;
54 struct hdlcdrv_channel_params cp;
55 struct hdlcdrv_channel_state cs;
56 struct hdlcdrv_old_channel_state ocs;
57 unsigned int calibrate;
58 unsigned char bits;
59 char modename[128];
60 char drivername[32];
61 } data;
62};
63
64/* -------------------------------------------------------------------- */
65
66/*
67 * ioctl values
68 */
69#define HDLCDRVCTL_GETMODEMPAR 0
70#define HDLCDRVCTL_SETMODEMPAR 1
71#define HDLCDRVCTL_MODEMPARMASK 2 /* not handled by hdlcdrv */
72#define HDLCDRVCTL_GETCHANNELPAR 10
73#define HDLCDRVCTL_SETCHANNELPAR 11
74#define HDLCDRVCTL_OLDGETSTAT 20
75#define HDLCDRVCTL_CALIBRATE 21
76#define HDLCDRVCTL_GETSTAT 22
77
78/*
79 * these are mainly for debugging purposes
80 */
81#define HDLCDRVCTL_GETSAMPLES 30
82#define HDLCDRVCTL_GETBITS 31
83
84/*
85 * not handled by hdlcdrv, but by its depending drivers
86 */
87#define HDLCDRVCTL_GETMODE 40
88#define HDLCDRVCTL_SETMODE 41
89#define HDLCDRVCTL_MODELIST 42
90#define HDLCDRVCTL_DRIVERNAME 43
91
92/*
93 * mask of needed modem parameters, returned by HDLCDRVCTL_MODEMPARMASK
94 */
95#define HDLCDRV_PARMASK_IOBASE (1<<0)
96#define HDLCDRV_PARMASK_IRQ (1<<1)
97#define HDLCDRV_PARMASK_DMA (1<<2)
98#define HDLCDRV_PARMASK_DMA2 (1<<3)
99#define HDLCDRV_PARMASK_SERIOBASE (1<<4)
100#define HDLCDRV_PARMASK_PARIOBASE (1<<5)
101#define HDLCDRV_PARMASK_MIDIIOBASE (1<<6)
102
103/* -------------------------------------------------------------------- */
104
105
106/* -------------------------------------------------------------------- */
107
108#endif /* _UAPI_HDLCDRV_H */
109
110/* -------------------------------------------------------------------- */
diff --git a/include/linux/hdreg.h b/include/uapi/linux/hdreg.h
index 29ee2873f4a8..29ee2873f4a8 100644
--- a/include/linux/hdreg.h
+++ b/include/uapi/linux/hdreg.h
diff --git a/include/uapi/linux/hid.h b/include/uapi/linux/hid.h
new file mode 100644
index 000000000000..b60f4842bd97
--- /dev/null
+++ b/include/uapi/linux/hid.h
@@ -0,0 +1,66 @@
1/*
2 * Copyright (c) 1999 Andreas Gal
3 * Copyright (c) 2000-2001 Vojtech Pavlik
4 * Copyright (c) 2006-2007 Jiri Kosina
5 */
6/*
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * Should you need to contact me, the author, you can do so either by
22 * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
23 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
24 */
25#ifndef _UAPI__HID_H
26#define _UAPI__HID_H
27
28
29
30/*
31 * USB HID (Human Interface Device) interface class code
32 */
33
34#define USB_INTERFACE_CLASS_HID 3
35
36/*
37 * USB HID interface subclass and protocol codes
38 */
39
40#define USB_INTERFACE_SUBCLASS_BOOT 1
41#define USB_INTERFACE_PROTOCOL_KEYBOARD 1
42#define USB_INTERFACE_PROTOCOL_MOUSE 2
43
44/*
45 * HID class requests
46 */
47
48#define HID_REQ_GET_REPORT 0x01
49#define HID_REQ_GET_IDLE 0x02
50#define HID_REQ_GET_PROTOCOL 0x03
51#define HID_REQ_SET_REPORT 0x09
52#define HID_REQ_SET_IDLE 0x0A
53#define HID_REQ_SET_PROTOCOL 0x0B
54
55/*
56 * HID class descriptor types
57 */
58
59#define HID_DT_HID (USB_TYPE_CLASS | 0x01)
60#define HID_DT_REPORT (USB_TYPE_CLASS | 0x02)
61#define HID_DT_PHYSICAL (USB_TYPE_CLASS | 0x03)
62
63#define HID_MAX_DESCRIPTOR_SIZE 4096
64
65
66#endif /* _UAPI__HID_H */
diff --git a/include/uapi/linux/hiddev.h b/include/uapi/linux/hiddev.h
new file mode 100644
index 000000000000..7df7884bf5c4
--- /dev/null
+++ b/include/uapi/linux/hiddev.h
@@ -0,0 +1,212 @@
1/*
2 * Copyright (c) 1999-2000 Vojtech Pavlik
3 *
4 * Sponsored by SuSE
5 */
6/*
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * Should you need to contact me, the author, you can do so either by
22 * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
23 * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
24 */
25#ifndef _UAPI_HIDDEV_H
26#define _UAPI_HIDDEV_H
27
28
29
30#include <linux/types.h>
31
32/*
33 * The event structure itself
34 */
35
36struct hiddev_event {
37 unsigned hid;
38 signed int value;
39};
40
41struct hiddev_devinfo {
42 __u32 bustype;
43 __u32 busnum;
44 __u32 devnum;
45 __u32 ifnum;
46 __s16 vendor;
47 __s16 product;
48 __s16 version;
49 __u32 num_applications;
50};
51
52struct hiddev_collection_info {
53 __u32 index;
54 __u32 type;
55 __u32 usage;
56 __u32 level;
57};
58
59#define HID_STRING_SIZE 256
60struct hiddev_string_descriptor {
61 __s32 index;
62 char value[HID_STRING_SIZE];
63};
64
65struct hiddev_report_info {
66 __u32 report_type;
67 __u32 report_id;
68 __u32 num_fields;
69};
70
71/* To do a GUSAGE/SUSAGE, fill in at least usage_code, report_type and
72 * report_id. Set report_id to REPORT_ID_UNKNOWN if the rest of the fields
73 * are unknown. Otherwise use a usage_ref struct filled in from a previous
74 * successful GUSAGE call to save time. To actually send a value to the
75 * device, perform a SUSAGE first, followed by a SREPORT. An INITREPORT or a
76 * GREPORT isn't necessary for a GUSAGE to return valid data.
77 */
78#define HID_REPORT_ID_UNKNOWN 0xffffffff
79#define HID_REPORT_ID_FIRST 0x00000100
80#define HID_REPORT_ID_NEXT 0x00000200
81#define HID_REPORT_ID_MASK 0x000000ff
82#define HID_REPORT_ID_MAX 0x000000ff
83
84#define HID_REPORT_TYPE_INPUT 1
85#define HID_REPORT_TYPE_OUTPUT 2
86#define HID_REPORT_TYPE_FEATURE 3
87#define HID_REPORT_TYPE_MIN 1
88#define HID_REPORT_TYPE_MAX 3
89
90struct hiddev_field_info {
91 __u32 report_type;
92 __u32 report_id;
93 __u32 field_index;
94 __u32 maxusage;
95 __u32 flags;
96 __u32 physical; /* physical usage for this field */
97 __u32 logical; /* logical usage for this field */
98 __u32 application; /* application usage for this field */
99 __s32 logical_minimum;
100 __s32 logical_maximum;
101 __s32 physical_minimum;
102 __s32 physical_maximum;
103 __u32 unit_exponent;
104 __u32 unit;
105};
106
107/* Fill in report_type, report_id and field_index to get the information on a
108 * field.
109 */
110#define HID_FIELD_CONSTANT 0x001
111#define HID_FIELD_VARIABLE 0x002
112#define HID_FIELD_RELATIVE 0x004
113#define HID_FIELD_WRAP 0x008
114#define HID_FIELD_NONLINEAR 0x010
115#define HID_FIELD_NO_PREFERRED 0x020
116#define HID_FIELD_NULL_STATE 0x040
117#define HID_FIELD_VOLATILE 0x080
118#define HID_FIELD_BUFFERED_BYTE 0x100
119
120struct hiddev_usage_ref {
121 __u32 report_type;
122 __u32 report_id;
123 __u32 field_index;
124 __u32 usage_index;
125 __u32 usage_code;
126 __s32 value;
127};
128
129/* hiddev_usage_ref_multi is used for sending multiple bytes to a control.
130 * It really manifests itself as setting the value of consecutive usages */
131#define HID_MAX_MULTI_USAGES 1024
132struct hiddev_usage_ref_multi {
133 struct hiddev_usage_ref uref;
134 __u32 num_values;
135 __s32 values[HID_MAX_MULTI_USAGES];
136};
137
138/* FIELD_INDEX_NONE is returned in read() data from the kernel when flags
139 * is set to (HIDDEV_FLAG_UREF | HIDDEV_FLAG_REPORT) and a new report has
140 * been sent by the device
141 */
142#define HID_FIELD_INDEX_NONE 0xffffffff
143
144/*
145 * Protocol version.
146 */
147
148#define HID_VERSION 0x010004
149
150/*
151 * IOCTLs (0x00 - 0x7f)
152 */
153
154#define HIDIOCGVERSION _IOR('H', 0x01, int)
155#define HIDIOCAPPLICATION _IO('H', 0x02)
156#define HIDIOCGDEVINFO _IOR('H', 0x03, struct hiddev_devinfo)
157#define HIDIOCGSTRING _IOR('H', 0x04, struct hiddev_string_descriptor)
158#define HIDIOCINITREPORT _IO('H', 0x05)
159#define HIDIOCGNAME(len) _IOC(_IOC_READ, 'H', 0x06, len)
160#define HIDIOCGREPORT _IOW('H', 0x07, struct hiddev_report_info)
161#define HIDIOCSREPORT _IOW('H', 0x08, struct hiddev_report_info)
162#define HIDIOCGREPORTINFO _IOWR('H', 0x09, struct hiddev_report_info)
163#define HIDIOCGFIELDINFO _IOWR('H', 0x0A, struct hiddev_field_info)
164#define HIDIOCGUSAGE _IOWR('H', 0x0B, struct hiddev_usage_ref)
165#define HIDIOCSUSAGE _IOW('H', 0x0C, struct hiddev_usage_ref)
166#define HIDIOCGUCODE _IOWR('H', 0x0D, struct hiddev_usage_ref)
167#define HIDIOCGFLAG _IOR('H', 0x0E, int)
168#define HIDIOCSFLAG _IOW('H', 0x0F, int)
169#define HIDIOCGCOLLECTIONINDEX _IOW('H', 0x10, struct hiddev_usage_ref)
170#define HIDIOCGCOLLECTIONINFO _IOWR('H', 0x11, struct hiddev_collection_info)
171#define HIDIOCGPHYS(len) _IOC(_IOC_READ, 'H', 0x12, len)
172
173/* For writing/reading to multiple/consecutive usages */
174#define HIDIOCGUSAGES _IOWR('H', 0x13, struct hiddev_usage_ref_multi)
175#define HIDIOCSUSAGES _IOW('H', 0x14, struct hiddev_usage_ref_multi)
176
177/*
178 * Flags to be used in HIDIOCSFLAG
179 */
180#define HIDDEV_FLAG_UREF 0x1
181#define HIDDEV_FLAG_REPORT 0x2
182#define HIDDEV_FLAGS 0x3
183
184/* To traverse the input report descriptor info for a HID device, perform the
185 * following:
186 *
187 * rinfo.report_type = HID_REPORT_TYPE_INPUT;
188 * rinfo.report_id = HID_REPORT_ID_FIRST;
189 * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo);
190 *
191 * while (ret >= 0) {
192 * for (i = 0; i < rinfo.num_fields; i++) {
193 * finfo.report_type = rinfo.report_type;
194 * finfo.report_id = rinfo.report_id;
195 * finfo.field_index = i;
196 * ioctl(fd, HIDIOCGFIELDINFO, &finfo);
197 * for (j = 0; j < finfo.maxusage; j++) {
198 * uref.report_type = rinfo.report_type;
199 * uref.report_id = rinfo.report_id;
200 * uref.field_index = i;
201 * uref.usage_index = j;
202 * ioctl(fd, HIDIOCGUCODE, &uref);
203 * ioctl(fd, HIDIOCGUSAGE, &uref);
204 * }
205 * }
206 * rinfo.report_id |= HID_REPORT_ID_NEXT;
207 * ret = ioctl(fd, HIDIOCGREPORTINFO, &rinfo);
208 * }
209 */
210
211
212#endif /* _UAPI_HIDDEV_H */
diff --git a/include/uapi/linux/hidraw.h b/include/uapi/linux/hidraw.h
new file mode 100644
index 000000000000..f5b732979a7c
--- /dev/null
+++ b/include/uapi/linux/hidraw.h
@@ -0,0 +1,50 @@
1/*
2 * Copyright (c) 2007 Jiri Kosina
3 */
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 * You should have received a copy of the GNU General Public License along with
10 * this program; if not, write to the Free Software Foundation, Inc.,
11 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
12 */
13#ifndef _UAPI_HIDRAW_H
14#define _UAPI_HIDRAW_H
15
16
17
18#include <linux/hid.h>
19#include <linux/types.h>
20
21struct hidraw_report_descriptor {
22 __u32 size;
23 __u8 value[HID_MAX_DESCRIPTOR_SIZE];
24};
25
26struct hidraw_devinfo {
27 __u32 bustype;
28 __s16 vendor;
29 __s16 product;
30};
31
32/* ioctl interface */
33#define HIDIOCGRDESCSIZE _IOR('H', 0x01, int)
34#define HIDIOCGRDESC _IOR('H', 0x02, struct hidraw_report_descriptor)
35#define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo)
36#define HIDIOCGRAWNAME(len) _IOC(_IOC_READ, 'H', 0x04, len)
37#define HIDIOCGRAWPHYS(len) _IOC(_IOC_READ, 'H', 0x05, len)
38/* The first byte of SFEATURE and GFEATURE is the report number */
39#define HIDIOCSFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len)
40#define HIDIOCGFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x07, len)
41
42#define HIDRAW_FIRST_MINOR 0
43#define HIDRAW_MAX_DEVICES 64
44/* number of reports to buffer */
45#define HIDRAW_BUFFER_SIZE 64
46
47
48/* kernel-only API declarations */
49
50#endif /* _UAPI_HIDRAW_H */
diff --git a/include/uapi/linux/hpet.h b/include/uapi/linux/hpet.h
new file mode 100644
index 000000000000..8af3c70abc8c
--- /dev/null
+++ b/include/uapi/linux/hpet.h
@@ -0,0 +1,25 @@
1#ifndef _UAPI__HPET__
2#define _UAPI__HPET__
3
4#include <linux/compiler.h>
5
6
7struct hpet_info {
8 unsigned long hi_ireqfreq; /* Hz */
9 unsigned long hi_flags; /* information */
10 unsigned short hi_hpet;
11 unsigned short hi_timer;
12};
13
14#define HPET_INFO_PERIODIC 0x0010 /* periodic-capable comparator */
15
16#define HPET_IE_ON _IO('h', 0x01) /* interrupt on */
17#define HPET_IE_OFF _IO('h', 0x02) /* interrupt off */
18#define HPET_INFO _IOR('h', 0x03, struct hpet_info)
19#define HPET_EPI _IO('h', 0x04) /* enable periodic */
20#define HPET_DPI _IO('h', 0x05) /* disable periodic */
21#define HPET_IRQFREQ _IOW('h', 0x6, unsigned long) /* IRQFREQ usec */
22
23#define MAX_HPET_TBS 8 /* maximum hpet timer blocks */
24
25#endif /* _UAPI__HPET__ */
diff --git a/include/uapi/linux/hsi/Kbuild b/include/uapi/linux/hsi/Kbuild
index aafaa5aa54d4..30ab3cd3b8a5 100644
--- a/include/uapi/linux/hsi/Kbuild
+++ b/include/uapi/linux/hsi/Kbuild
@@ -1 +1,2 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += hsi_char.h
diff --git a/include/linux/hsi/hsi_char.h b/include/uapi/linux/hsi/hsi_char.h
index 76160b4f455d..76160b4f455d 100644
--- a/include/linux/hsi/hsi_char.h
+++ b/include/uapi/linux/hsi/hsi_char.h
diff --git a/include/linux/hysdn_if.h b/include/uapi/linux/hysdn_if.h
index 00236ae3b04e..00236ae3b04e 100644
--- a/include/linux/hysdn_if.h
+++ b/include/uapi/linux/hysdn_if.h
diff --git a/include/uapi/linux/i2c-dev.h b/include/uapi/linux/i2c-dev.h
new file mode 100644
index 000000000000..3f311551795d
--- /dev/null
+++ b/include/uapi/linux/i2c-dev.h
@@ -0,0 +1,72 @@
1/*
2 i2c-dev.h - i2c-bus driver, char device interface
3
4 Copyright (C) 1995-97 Simon G. Vogl
5 Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 MA 02110-1301 USA.
21*/
22
23#ifndef _UAPI_LINUX_I2C_DEV_H
24#define _UAPI_LINUX_I2C_DEV_H
25
26#include <linux/types.h>
27#include <linux/compiler.h>
28
29/* /dev/i2c-X ioctl commands. The ioctl's parameter is always an
30 * unsigned long, except for:
31 * - I2C_FUNCS, takes pointer to an unsigned long
32 * - I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data
33 * - I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data
34 */
35#define I2C_RETRIES 0x0701 /* number of times a device address should
36 be polled when not acknowledging */
37#define I2C_TIMEOUT 0x0702 /* set timeout in units of 10 ms */
38
39/* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses
40 * are NOT supported! (due to code brokenness)
41 */
42#define I2C_SLAVE 0x0703 /* Use this slave address */
43#define I2C_SLAVE_FORCE 0x0706 /* Use this slave address, even if it
44 is already in use by a driver! */
45#define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */
46
47#define I2C_FUNCS 0x0705 /* Get the adapter functionality mask */
48
49#define I2C_RDWR 0x0707 /* Combined R/W transfer (one STOP only) */
50
51#define I2C_PEC 0x0708 /* != 0 to use PEC with SMBus */
52#define I2C_SMBUS 0x0720 /* SMBus transfer */
53
54
55/* This is the structure as used in the I2C_SMBUS ioctl call */
56struct i2c_smbus_ioctl_data {
57 __u8 read_write;
58 __u8 command;
59 __u32 size;
60 union i2c_smbus_data __user *data;
61};
62
63/* This is the structure as used in the I2C_RDWR ioctl call */
64struct i2c_rdwr_ioctl_data {
65 struct i2c_msg __user *msgs; /* pointers to i2c_msgs */
66 __u32 nmsgs; /* number of i2c_msgs */
67};
68
69#define I2C_RDRW_IOCTL_MAX_MSGS 42
70
71
72#endif /* _UAPI_LINUX_I2C_DEV_H */
diff --git a/include/uapi/linux/i2c.h b/include/uapi/linux/i2c.h
new file mode 100644
index 000000000000..0e949cbfd333
--- /dev/null
+++ b/include/uapi/linux/i2c.h
@@ -0,0 +1,151 @@
1/* ------------------------------------------------------------------------- */
2/* */
3/* i2c.h - definitions for the i2c-bus interface */
4/* */
5/* ------------------------------------------------------------------------- */
6/* Copyright (C) 1995-2000 Simon G. Vogl
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21 MA 02110-1301 USA. */
22/* ------------------------------------------------------------------------- */
23
24/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
25 Frodo Looijaard <frodol@dds.nl> */
26
27#ifndef _UAPI_LINUX_I2C_H
28#define _UAPI_LINUX_I2C_H
29
30#include <linux/types.h>
31
32/**
33 * struct i2c_msg - an I2C transaction segment beginning with START
34 * @addr: Slave address, either seven or ten bits. When this is a ten
35 * bit address, I2C_M_TEN must be set in @flags and the adapter
36 * must support I2C_FUNC_10BIT_ADDR.
37 * @flags: I2C_M_RD is handled by all adapters. No other flags may be
38 * provided unless the adapter exported the relevant I2C_FUNC_*
39 * flags through i2c_check_functionality().
40 * @len: Number of data bytes in @buf being read from or written to the
41 * I2C slave address. For read transactions where I2C_M_RECV_LEN
42 * is set, the caller guarantees that this buffer can hold up to
43 * 32 bytes in addition to the initial length byte sent by the
44 * slave (plus, if used, the SMBus PEC); and this value will be
45 * incremented by the number of block data bytes received.
46 * @buf: The buffer into which data is read, or from which it's written.
47 *
48 * An i2c_msg is the low level representation of one segment of an I2C
49 * transaction. It is visible to drivers in the @i2c_transfer() procedure,
50 * to userspace from i2c-dev, and to I2C adapter drivers through the
51 * @i2c_adapter.@master_xfer() method.
52 *
53 * Except when I2C "protocol mangling" is used, all I2C adapters implement
54 * the standard rules for I2C transactions. Each transaction begins with a
55 * START. That is followed by the slave address, and a bit encoding read
56 * versus write. Then follow all the data bytes, possibly including a byte
57 * with SMBus PEC. The transfer terminates with a NAK, or when all those
58 * bytes have been transferred and ACKed. If this is the last message in a
59 * group, it is followed by a STOP. Otherwise it is followed by the next
60 * @i2c_msg transaction segment, beginning with a (repeated) START.
61 *
62 * Alternatively, when the adapter supports I2C_FUNC_PROTOCOL_MANGLING then
63 * passing certain @flags may have changed those standard protocol behaviors.
64 * Those flags are only for use with broken/nonconforming slaves, and with
65 * adapters which are known to support the specific mangling options they
66 * need (one or more of IGNORE_NAK, NO_RD_ACK, NOSTART, and REV_DIR_ADDR).
67 */
68struct i2c_msg {
69 __u16 addr; /* slave address */
70 __u16 flags;
71#define I2C_M_TEN 0x0010 /* this is a ten bit chip address */
72#define I2C_M_RD 0x0001 /* read data, from slave to master */
73#define I2C_M_STOP 0x8000 /* if I2C_FUNC_PROTOCOL_MANGLING */
74#define I2C_M_NOSTART 0x4000 /* if I2C_FUNC_NOSTART */
75#define I2C_M_REV_DIR_ADDR 0x2000 /* if I2C_FUNC_PROTOCOL_MANGLING */
76#define I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */
77#define I2C_M_NO_RD_ACK 0x0800 /* if I2C_FUNC_PROTOCOL_MANGLING */
78#define I2C_M_RECV_LEN 0x0400 /* length will be first received byte */
79 __u16 len; /* msg length */
80 __u8 *buf; /* pointer to msg data */
81};
82
83/* To determine what functionality is present */
84
85#define I2C_FUNC_I2C 0x00000001
86#define I2C_FUNC_10BIT_ADDR 0x00000002
87#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_IGNORE_NAK etc. */
88#define I2C_FUNC_SMBUS_PEC 0x00000008
89#define I2C_FUNC_NOSTART 0x00000010 /* I2C_M_NOSTART */
90#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */
91#define I2C_FUNC_SMBUS_QUICK 0x00010000
92#define I2C_FUNC_SMBUS_READ_BYTE 0x00020000
93#define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000
94#define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000
95#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000
96#define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000
97#define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000
98#define I2C_FUNC_SMBUS_PROC_CALL 0x00800000
99#define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000
100#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000
101#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */
102#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */
103
104#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \
105 I2C_FUNC_SMBUS_WRITE_BYTE)
106#define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \
107 I2C_FUNC_SMBUS_WRITE_BYTE_DATA)
108#define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \
109 I2C_FUNC_SMBUS_WRITE_WORD_DATA)
110#define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \
111 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA)
112#define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \
113 I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)
114
115#define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \
116 I2C_FUNC_SMBUS_BYTE | \
117 I2C_FUNC_SMBUS_BYTE_DATA | \
118 I2C_FUNC_SMBUS_WORD_DATA | \
119 I2C_FUNC_SMBUS_PROC_CALL | \
120 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \
121 I2C_FUNC_SMBUS_I2C_BLOCK | \
122 I2C_FUNC_SMBUS_PEC)
123
124/*
125 * Data for SMBus Messages
126 */
127#define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */
128union i2c_smbus_data {
129 __u8 byte;
130 __u16 word;
131 __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; /* block[0] is used for length */
132 /* and one more for user-space compatibility */
133};
134
135/* i2c_smbus_xfer read or write markers */
136#define I2C_SMBUS_READ 1
137#define I2C_SMBUS_WRITE 0
138
139/* SMBus transaction types (size parameter in the above functions)
140 Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */
141#define I2C_SMBUS_QUICK 0
142#define I2C_SMBUS_BYTE 1
143#define I2C_SMBUS_BYTE_DATA 2
144#define I2C_SMBUS_WORD_DATA 3
145#define I2C_SMBUS_PROC_CALL 4
146#define I2C_SMBUS_BLOCK_DATA 5
147#define I2C_SMBUS_I2C_BLOCK_BROKEN 6
148#define I2C_SMBUS_BLOCK_PROC_CALL 7 /* SMBus 2.0 */
149#define I2C_SMBUS_I2C_BLOCK_DATA 8
150
151#endif /* _UAPI_LINUX_I2C_H */
diff --git a/include/linux/i2o-dev.h b/include/uapi/linux/i2o-dev.h
index a8093bfec3a6..a8093bfec3a6 100644
--- a/include/linux/i2o-dev.h
+++ b/include/uapi/linux/i2o-dev.h
diff --git a/include/linux/i8k.h b/include/uapi/linux/i8k.h
index 1c45ba505115..1c45ba505115 100644
--- a/include/linux/i8k.h
+++ b/include/uapi/linux/i8k.h
diff --git a/include/uapi/linux/icmp.h b/include/uapi/linux/icmp.h
new file mode 100644
index 000000000000..16fff055f734
--- /dev/null
+++ b/include/uapi/linux/icmp.h
@@ -0,0 +1,97 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for the ICMP protocol.
7 *
8 * Version: @(#)icmp.h 1.0.3 04/28/93
9 *
10 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17#ifndef _UAPI_LINUX_ICMP_H
18#define _UAPI_LINUX_ICMP_H
19
20#include <linux/types.h>
21
22#define ICMP_ECHOREPLY 0 /* Echo Reply */
23#define ICMP_DEST_UNREACH 3 /* Destination Unreachable */
24#define ICMP_SOURCE_QUENCH 4 /* Source Quench */
25#define ICMP_REDIRECT 5 /* Redirect (change route) */
26#define ICMP_ECHO 8 /* Echo Request */
27#define ICMP_TIME_EXCEEDED 11 /* Time Exceeded */
28#define ICMP_PARAMETERPROB 12 /* Parameter Problem */
29#define ICMP_TIMESTAMP 13 /* Timestamp Request */
30#define ICMP_TIMESTAMPREPLY 14 /* Timestamp Reply */
31#define ICMP_INFO_REQUEST 15 /* Information Request */
32#define ICMP_INFO_REPLY 16 /* Information Reply */
33#define ICMP_ADDRESS 17 /* Address Mask Request */
34#define ICMP_ADDRESSREPLY 18 /* Address Mask Reply */
35#define NR_ICMP_TYPES 18
36
37
38/* Codes for UNREACH. */
39#define ICMP_NET_UNREACH 0 /* Network Unreachable */
40#define ICMP_HOST_UNREACH 1 /* Host Unreachable */
41#define ICMP_PROT_UNREACH 2 /* Protocol Unreachable */
42#define ICMP_PORT_UNREACH 3 /* Port Unreachable */
43#define ICMP_FRAG_NEEDED 4 /* Fragmentation Needed/DF set */
44#define ICMP_SR_FAILED 5 /* Source Route failed */
45#define ICMP_NET_UNKNOWN 6
46#define ICMP_HOST_UNKNOWN 7
47#define ICMP_HOST_ISOLATED 8
48#define ICMP_NET_ANO 9
49#define ICMP_HOST_ANO 10
50#define ICMP_NET_UNR_TOS 11
51#define ICMP_HOST_UNR_TOS 12
52#define ICMP_PKT_FILTERED 13 /* Packet filtered */
53#define ICMP_PREC_VIOLATION 14 /* Precedence violation */
54#define ICMP_PREC_CUTOFF 15 /* Precedence cut off */
55#define NR_ICMP_UNREACH 15 /* instead of hardcoding immediate value */
56
57/* Codes for REDIRECT. */
58#define ICMP_REDIR_NET 0 /* Redirect Net */
59#define ICMP_REDIR_HOST 1 /* Redirect Host */
60#define ICMP_REDIR_NETTOS 2 /* Redirect Net for TOS */
61#define ICMP_REDIR_HOSTTOS 3 /* Redirect Host for TOS */
62
63/* Codes for TIME_EXCEEDED. */
64#define ICMP_EXC_TTL 0 /* TTL count exceeded */
65#define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */
66
67
68struct icmphdr {
69 __u8 type;
70 __u8 code;
71 __sum16 checksum;
72 union {
73 struct {
74 __be16 id;
75 __be16 sequence;
76 } echo;
77 __be32 gateway;
78 struct {
79 __be16 __unused;
80 __be16 mtu;
81 } frag;
82 } un;
83};
84
85
86/*
87 * constants for (set|get)sockopt
88 */
89
90#define ICMP_FILTER 1
91
92struct icmp_filter {
93 __u32 data;
94};
95
96
97#endif /* _UAPI_LINUX_ICMP_H */
diff --git a/include/uapi/linux/icmpv6.h b/include/uapi/linux/icmpv6.h
new file mode 100644
index 000000000000..e0133c73c304
--- /dev/null
+++ b/include/uapi/linux/icmpv6.h
@@ -0,0 +1,164 @@
1#ifndef _UAPI_LINUX_ICMPV6_H
2#define _UAPI_LINUX_ICMPV6_H
3
4#include <linux/types.h>
5#include <asm/byteorder.h>
6
7struct icmp6hdr {
8
9 __u8 icmp6_type;
10 __u8 icmp6_code;
11 __sum16 icmp6_cksum;
12
13
14 union {
15 __be32 un_data32[1];
16 __be16 un_data16[2];
17 __u8 un_data8[4];
18
19 struct icmpv6_echo {
20 __be16 identifier;
21 __be16 sequence;
22 } u_echo;
23
24 struct icmpv6_nd_advt {
25#if defined(__LITTLE_ENDIAN_BITFIELD)
26 __u32 reserved:5,
27 override:1,
28 solicited:1,
29 router:1,
30 reserved2:24;
31#elif defined(__BIG_ENDIAN_BITFIELD)
32 __u32 router:1,
33 solicited:1,
34 override:1,
35 reserved:29;
36#else
37#error "Please fix <asm/byteorder.h>"
38#endif
39 } u_nd_advt;
40
41 struct icmpv6_nd_ra {
42 __u8 hop_limit;
43#if defined(__LITTLE_ENDIAN_BITFIELD)
44 __u8 reserved:3,
45 router_pref:2,
46 home_agent:1,
47 other:1,
48 managed:1;
49
50#elif defined(__BIG_ENDIAN_BITFIELD)
51 __u8 managed:1,
52 other:1,
53 home_agent:1,
54 router_pref:2,
55 reserved:3;
56#else
57#error "Please fix <asm/byteorder.h>"
58#endif
59 __be16 rt_lifetime;
60 } u_nd_ra;
61
62 } icmp6_dataun;
63
64#define icmp6_identifier icmp6_dataun.u_echo.identifier
65#define icmp6_sequence icmp6_dataun.u_echo.sequence
66#define icmp6_pointer icmp6_dataun.un_data32[0]
67#define icmp6_mtu icmp6_dataun.un_data32[0]
68#define icmp6_unused icmp6_dataun.un_data32[0]
69#define icmp6_maxdelay icmp6_dataun.un_data16[0]
70#define icmp6_router icmp6_dataun.u_nd_advt.router
71#define icmp6_solicited icmp6_dataun.u_nd_advt.solicited
72#define icmp6_override icmp6_dataun.u_nd_advt.override
73#define icmp6_ndiscreserved icmp6_dataun.u_nd_advt.reserved
74#define icmp6_hop_limit icmp6_dataun.u_nd_ra.hop_limit
75#define icmp6_addrconf_managed icmp6_dataun.u_nd_ra.managed
76#define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other
77#define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime
78#define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref
79};
80
81
82#define ICMPV6_ROUTER_PREF_LOW 0x3
83#define ICMPV6_ROUTER_PREF_MEDIUM 0x0
84#define ICMPV6_ROUTER_PREF_HIGH 0x1
85#define ICMPV6_ROUTER_PREF_INVALID 0x2
86
87#define ICMPV6_DEST_UNREACH 1
88#define ICMPV6_PKT_TOOBIG 2
89#define ICMPV6_TIME_EXCEED 3
90#define ICMPV6_PARAMPROB 4
91
92#define ICMPV6_INFOMSG_MASK 0x80
93
94#define ICMPV6_ECHO_REQUEST 128
95#define ICMPV6_ECHO_REPLY 129
96#define ICMPV6_MGM_QUERY 130
97#define ICMPV6_MGM_REPORT 131
98#define ICMPV6_MGM_REDUCTION 132
99
100#define ICMPV6_NI_QUERY 139
101#define ICMPV6_NI_REPLY 140
102
103#define ICMPV6_MLD2_REPORT 143
104
105#define ICMPV6_DHAAD_REQUEST 144
106#define ICMPV6_DHAAD_REPLY 145
107#define ICMPV6_MOBILE_PREFIX_SOL 146
108#define ICMPV6_MOBILE_PREFIX_ADV 147
109
110/*
111 * Codes for Destination Unreachable
112 */
113#define ICMPV6_NOROUTE 0
114#define ICMPV6_ADM_PROHIBITED 1
115#define ICMPV6_NOT_NEIGHBOUR 2
116#define ICMPV6_ADDR_UNREACH 3
117#define ICMPV6_PORT_UNREACH 4
118
119/*
120 * Codes for Time Exceeded
121 */
122#define ICMPV6_EXC_HOPLIMIT 0
123#define ICMPV6_EXC_FRAGTIME 1
124
125/*
126 * Codes for Parameter Problem
127 */
128#define ICMPV6_HDR_FIELD 0
129#define ICMPV6_UNK_NEXTHDR 1
130#define ICMPV6_UNK_OPTION 2
131
132/*
133 * constants for (set|get)sockopt
134 */
135
136#define ICMPV6_FILTER 1
137
138/*
139 * ICMPV6 filter
140 */
141
142#define ICMPV6_FILTER_BLOCK 1
143#define ICMPV6_FILTER_PASS 2
144#define ICMPV6_FILTER_BLOCKOTHERS 3
145#define ICMPV6_FILTER_PASSONLY 4
146
147struct icmp6_filter {
148 __u32 data[8];
149};
150
151/*
152 * Definitions for MLDv2
153 */
154#define MLD2_MODE_IS_INCLUDE 1
155#define MLD2_MODE_IS_EXCLUDE 2
156#define MLD2_CHANGE_TO_INCLUDE 3
157#define MLD2_CHANGE_TO_EXCLUDE 4
158#define MLD2_ALLOW_NEW_SOURCES 5
159#define MLD2_BLOCK_OLD_SOURCES 6
160
161#define MLD2_ALL_MCR_INIT { { { 0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,0x16 } } }
162
163
164#endif /* _UAPI_LINUX_ICMPV6_H */
diff --git a/include/linux/if.h b/include/uapi/linux/if.h
index 1ec407b01e46..1ec407b01e46 100644
--- a/include/linux/if.h
+++ b/include/uapi/linux/if.h
diff --git a/include/linux/if_addr.h b/include/uapi/linux/if_addr.h
index 23357ab81a77..23357ab81a77 100644
--- a/include/linux/if_addr.h
+++ b/include/uapi/linux/if_addr.h
diff --git a/include/linux/if_addrlabel.h b/include/uapi/linux/if_addrlabel.h
index 54580c298187..54580c298187 100644
--- a/include/linux/if_addrlabel.h
+++ b/include/uapi/linux/if_addrlabel.h
diff --git a/include/linux/if_alg.h b/include/uapi/linux/if_alg.h
index 0f9acce5b1ff..0f9acce5b1ff 100644
--- a/include/linux/if_alg.h
+++ b/include/uapi/linux/if_alg.h
diff --git a/include/linux/if_arcnet.h b/include/uapi/linux/if_arcnet.h
index 46e34bd0e783..46e34bd0e783 100644
--- a/include/linux/if_arcnet.h
+++ b/include/uapi/linux/if_arcnet.h
diff --git a/include/uapi/linux/if_arp.h b/include/uapi/linux/if_arp.h
new file mode 100644
index 000000000000..82c7d1bdadeb
--- /dev/null
+++ b/include/uapi/linux/if_arp.h
@@ -0,0 +1,159 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Global definitions for the ARP (RFC 826) protocol.
7 *
8 * Version: @(#)if_arp.h 1.0.1 04/16/93
9 *
10 * Authors: Original taken from Berkeley UNIX 4.3, (c) UCB 1986-1988
11 * Portions taken from the KA9Q/NOS (v2.00m PA0GRI) source.
12 * Ross Biro
13 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
14 * Florian La Roche,
15 * Jonathan Layes <layes@loran.com>
16 * Arnaldo Carvalho de Melo <acme@conectiva.com.br> ARPHRD_HWX25
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version
21 * 2 of the License, or (at your option) any later version.
22 */
23#ifndef _UAPI_LINUX_IF_ARP_H
24#define _UAPI_LINUX_IF_ARP_H
25
26#include <linux/netdevice.h>
27
28/* ARP protocol HARDWARE identifiers. */
29#define ARPHRD_NETROM 0 /* from KA9Q: NET/ROM pseudo */
30#define ARPHRD_ETHER 1 /* Ethernet 10Mbps */
31#define ARPHRD_EETHER 2 /* Experimental Ethernet */
32#define ARPHRD_AX25 3 /* AX.25 Level 2 */
33#define ARPHRD_PRONET 4 /* PROnet token ring */
34#define ARPHRD_CHAOS 5 /* Chaosnet */
35#define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB */
36#define ARPHRD_ARCNET 7 /* ARCnet */
37#define ARPHRD_APPLETLK 8 /* APPLEtalk */
38#define ARPHRD_DLCI 15 /* Frame Relay DLCI */
39#define ARPHRD_ATM 19 /* ATM */
40#define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id) */
41#define ARPHRD_IEEE1394 24 /* IEEE 1394 IPv4 - RFC 2734 */
42#define ARPHRD_EUI64 27 /* EUI-64 */
43#define ARPHRD_INFINIBAND 32 /* InfiniBand */
44
45/* Dummy types for non ARP hardware */
46#define ARPHRD_SLIP 256
47#define ARPHRD_CSLIP 257
48#define ARPHRD_SLIP6 258
49#define ARPHRD_CSLIP6 259
50#define ARPHRD_RSRVD 260 /* Notional KISS type */
51#define ARPHRD_ADAPT 264
52#define ARPHRD_ROSE 270
53#define ARPHRD_X25 271 /* CCITT X.25 */
54#define ARPHRD_HWX25 272 /* Boards with X.25 in firmware */
55#define ARPHRD_CAN 280 /* Controller Area Network */
56#define ARPHRD_PPP 512
57#define ARPHRD_CISCO 513 /* Cisco HDLC */
58#define ARPHRD_HDLC ARPHRD_CISCO
59#define ARPHRD_LAPB 516 /* LAPB */
60#define ARPHRD_DDCMP 517 /* Digital's DDCMP protocol */
61#define ARPHRD_RAWHDLC 518 /* Raw HDLC */
62
63#define ARPHRD_TUNNEL 768 /* IPIP tunnel */
64#define ARPHRD_TUNNEL6 769 /* IP6IP6 tunnel */
65#define ARPHRD_FRAD 770 /* Frame Relay Access Device */
66#define ARPHRD_SKIP 771 /* SKIP vif */
67#define ARPHRD_LOOPBACK 772 /* Loopback device */
68#define ARPHRD_LOCALTLK 773 /* Localtalk device */
69#define ARPHRD_FDDI 774 /* Fiber Distributed Data Interface */
70#define ARPHRD_BIF 775 /* AP1000 BIF */
71#define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4 */
72#define ARPHRD_IPDDP 777 /* IP over DDP tunneller */
73#define ARPHRD_IPGRE 778 /* GRE over IP */
74#define ARPHRD_PIMREG 779 /* PIMSM register interface */
75#define ARPHRD_HIPPI 780 /* High Performance Parallel Interface */
76#define ARPHRD_ASH 781 /* Nexus 64Mbps Ash */
77#define ARPHRD_ECONET 782 /* Acorn Econet */
78#define ARPHRD_IRDA 783 /* Linux-IrDA */
79/* ARP works differently on different FC media .. so */
80#define ARPHRD_FCPP 784 /* Point to point fibrechannel */
81#define ARPHRD_FCAL 785 /* Fibrechannel arbitrated loop */
82#define ARPHRD_FCPL 786 /* Fibrechannel public loop */
83#define ARPHRD_FCFABRIC 787 /* Fibrechannel fabric */
84 /* 787->799 reserved for fibrechannel media types */
85#define ARPHRD_IEEE802_TR 800 /* Magic type ident for TR */
86#define ARPHRD_IEEE80211 801 /* IEEE 802.11 */
87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */
88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */
89#define ARPHRD_IEEE802154 804
90#define ARPHRD_IEEE802154_MONITOR 805 /* IEEE 802.15.4 network monitor */
91
92#define ARPHRD_PHONET 820 /* PhoNet media type */
93#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
94#define ARPHRD_CAIF 822 /* CAIF media type */
95#define ARPHRD_IP6GRE 823 /* GRE over IPv6 */
96
97#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */
98#define ARPHRD_NONE 0xFFFE /* zero header length */
99
100/* ARP protocol opcodes. */
101#define ARPOP_REQUEST 1 /* ARP request */
102#define ARPOP_REPLY 2 /* ARP reply */
103#define ARPOP_RREQUEST 3 /* RARP request */
104#define ARPOP_RREPLY 4 /* RARP reply */
105#define ARPOP_InREQUEST 8 /* InARP request */
106#define ARPOP_InREPLY 9 /* InARP reply */
107#define ARPOP_NAK 10 /* (ATM)ARP NAK */
108
109
110/* ARP ioctl request. */
111struct arpreq {
112 struct sockaddr arp_pa; /* protocol address */
113 struct sockaddr arp_ha; /* hardware address */
114 int arp_flags; /* flags */
115 struct sockaddr arp_netmask; /* netmask (only for proxy arps) */
116 char arp_dev[16];
117};
118
119struct arpreq_old {
120 struct sockaddr arp_pa; /* protocol address */
121 struct sockaddr arp_ha; /* hardware address */
122 int arp_flags; /* flags */
123 struct sockaddr arp_netmask; /* netmask (only for proxy arps) */
124};
125
126/* ARP Flag values. */
127#define ATF_COM 0x02 /* completed entry (ha valid) */
128#define ATF_PERM 0x04 /* permanent entry */
129#define ATF_PUBL 0x08 /* publish entry */
130#define ATF_USETRAILERS 0x10 /* has requested trailers */
131#define ATF_NETMASK 0x20 /* want to use a netmask (only
132 for proxy entries) */
133#define ATF_DONTPUB 0x40 /* don't answer this addresses */
134
135/*
136 * This structure defines an ethernet arp header.
137 */
138
139struct arphdr {
140 __be16 ar_hrd; /* format of hardware address */
141 __be16 ar_pro; /* format of protocol address */
142 unsigned char ar_hln; /* length of hardware address */
143 unsigned char ar_pln; /* length of protocol address */
144 __be16 ar_op; /* ARP opcode (command) */
145
146#if 0
147 /*
148 * Ethernet looks like this : This bit is variable sized however...
149 */
150 unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */
151 unsigned char ar_sip[4]; /* sender IP address */
152 unsigned char ar_tha[ETH_ALEN]; /* target hardware address */
153 unsigned char ar_tip[4]; /* target IP address */
154#endif
155
156};
157
158
159#endif /* _UAPI_LINUX_IF_ARP_H */
diff --git a/include/linux/if_bonding.h b/include/uapi/linux/if_bonding.h
index a17edda8a781..a17edda8a781 100644
--- a/include/linux/if_bonding.h
+++ b/include/uapi/linux/if_bonding.h
diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h
new file mode 100644
index 000000000000..a8fe9549ddbc
--- /dev/null
+++ b/include/uapi/linux/if_bridge.h
@@ -0,0 +1,101 @@
1/*
2 * Linux ethernet bridge
3 *
4 * Authors:
5 * Lennert Buytenhek <buytenh@gnu.org>
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
13#ifndef _UAPI_LINUX_IF_BRIDGE_H
14#define _UAPI_LINUX_IF_BRIDGE_H
15
16#include <linux/types.h>
17
18#define SYSFS_BRIDGE_ATTR "bridge"
19#define SYSFS_BRIDGE_FDB "brforward"
20#define SYSFS_BRIDGE_PORT_SUBDIR "brif"
21#define SYSFS_BRIDGE_PORT_ATTR "brport"
22#define SYSFS_BRIDGE_PORT_LINK "bridge"
23
24#define BRCTL_VERSION 1
25
26#define BRCTL_GET_VERSION 0
27#define BRCTL_GET_BRIDGES 1
28#define BRCTL_ADD_BRIDGE 2
29#define BRCTL_DEL_BRIDGE 3
30#define BRCTL_ADD_IF 4
31#define BRCTL_DEL_IF 5
32#define BRCTL_GET_BRIDGE_INFO 6
33#define BRCTL_GET_PORT_LIST 7
34#define BRCTL_SET_BRIDGE_FORWARD_DELAY 8
35#define BRCTL_SET_BRIDGE_HELLO_TIME 9
36#define BRCTL_SET_BRIDGE_MAX_AGE 10
37#define BRCTL_SET_AGEING_TIME 11
38#define BRCTL_SET_GC_INTERVAL 12
39#define BRCTL_GET_PORT_INFO 13
40#define BRCTL_SET_BRIDGE_STP_STATE 14
41#define BRCTL_SET_BRIDGE_PRIORITY 15
42#define BRCTL_SET_PORT_PRIORITY 16
43#define BRCTL_SET_PATH_COST 17
44#define BRCTL_GET_FDB_ENTRIES 18
45
46#define BR_STATE_DISABLED 0
47#define BR_STATE_LISTENING 1
48#define BR_STATE_LEARNING 2
49#define BR_STATE_FORWARDING 3
50#define BR_STATE_BLOCKING 4
51
52struct __bridge_info {
53 __u64 designated_root;
54 __u64 bridge_id;
55 __u32 root_path_cost;
56 __u32 max_age;
57 __u32 hello_time;
58 __u32 forward_delay;
59 __u32 bridge_max_age;
60 __u32 bridge_hello_time;
61 __u32 bridge_forward_delay;
62 __u8 topology_change;
63 __u8 topology_change_detected;
64 __u8 root_port;
65 __u8 stp_enabled;
66 __u32 ageing_time;
67 __u32 gc_interval;
68 __u32 hello_timer_value;
69 __u32 tcn_timer_value;
70 __u32 topology_change_timer_value;
71 __u32 gc_timer_value;
72};
73
74struct __port_info {
75 __u64 designated_root;
76 __u64 designated_bridge;
77 __u16 port_id;
78 __u16 designated_port;
79 __u32 path_cost;
80 __u32 designated_cost;
81 __u8 state;
82 __u8 top_change_ack;
83 __u8 config_pending;
84 __u8 unused0;
85 __u32 message_age_timer_value;
86 __u32 forward_delay_timer_value;
87 __u32 hold_timer_value;
88};
89
90struct __fdb_entry {
91 __u8 mac_addr[6];
92 __u8 port_no;
93 __u8 is_local;
94 __u32 ageing_timer_value;
95 __u8 port_hi;
96 __u8 pad0;
97 __u16 unused;
98};
99
100
101#endif /* _UAPI_LINUX_IF_BRIDGE_H */
diff --git a/include/linux/if_cablemodem.h b/include/uapi/linux/if_cablemodem.h
index 9ca1007edd93..9ca1007edd93 100644
--- a/include/linux/if_cablemodem.h
+++ b/include/uapi/linux/if_cablemodem.h
diff --git a/include/uapi/linux/if_eql.h b/include/uapi/linux/if_eql.h
new file mode 100644
index 000000000000..06e818c9e7cb
--- /dev/null
+++ b/include/uapi/linux/if_eql.h
@@ -0,0 +1,54 @@
1/*
2 * Equalizer Load-balancer for serial network interfaces.
3 *
4 * (c) Copyright 1995 Simon "Guru Aleph-Null" Janes
5 * NCM: Network and Communications Management, Inc.
6 *
7 *
8 * This software may be used and distributed according to the terms
9 * of the GNU General Public License, incorporated herein by reference.
10 *
11 * The author may be reached as simon@ncm.com, or C/O
12 * NCM
13 * Attn: Simon Janes
14 * 6803 Whittier Ave
15 * McLean VA 22101
16 * Phone: 1-703-847-0040 ext 103
17 */
18
19#ifndef _UAPI_LINUX_IF_EQL_H
20#define _UAPI_LINUX_IF_EQL_H
21
22#define EQL_DEFAULT_SLAVE_PRIORITY 28800
23#define EQL_DEFAULT_MAX_SLAVES 4
24#define EQL_DEFAULT_MTU 576
25#define EQL_DEFAULT_RESCHED_IVAL HZ
26
27#define EQL_ENSLAVE (SIOCDEVPRIVATE)
28#define EQL_EMANCIPATE (SIOCDEVPRIVATE + 1)
29
30#define EQL_GETSLAVECFG (SIOCDEVPRIVATE + 2)
31#define EQL_SETSLAVECFG (SIOCDEVPRIVATE + 3)
32
33#define EQL_GETMASTRCFG (SIOCDEVPRIVATE + 4)
34#define EQL_SETMASTRCFG (SIOCDEVPRIVATE + 5)
35
36
37typedef struct master_config {
38 char master_name[16];
39 int max_slaves;
40 int min_slaves;
41} master_config_t;
42
43typedef struct slave_config {
44 char slave_name[16];
45 long priority;
46} slave_config_t;
47
48typedef struct slaving_request {
49 char slave_name[16];
50 long priority;
51} slaving_request_t;
52
53
54#endif /* _UAPI_LINUX_IF_EQL_H */
diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h
new file mode 100644
index 000000000000..0343e1f0582c
--- /dev/null
+++ b/include/uapi/linux/if_ether.h
@@ -0,0 +1,135 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Global definitions for the Ethernet IEEE 802.3 interface.
7 *
8 * Version: @(#)if_ether.h 1.0.1a 02/08/94
9 *
10 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
11 * Donald Becker, <becker@super.org>
12 * Alan Cox, <alan@lxorguk.ukuu.org.uk>
13 * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk>
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version.
19 */
20
21#ifndef _UAPI_LINUX_IF_ETHER_H
22#define _UAPI_LINUX_IF_ETHER_H
23
24#include <linux/types.h>
25
26/*
27 * IEEE 802.3 Ethernet magic constants. The frame sizes omit the preamble
28 * and FCS/CRC (frame check sequence).
29 */
30
31#define ETH_ALEN 6 /* Octets in one ethernet addr */
32#define ETH_HLEN 14 /* Total octets in header. */
33#define ETH_ZLEN 60 /* Min. octets in frame sans FCS */
34#define ETH_DATA_LEN 1500 /* Max. octets in payload */
35#define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */
36#define ETH_FCS_LEN 4 /* Octets in the FCS */
37
38/*
39 * These are the defined Ethernet Protocol ID's.
40 */
41
42#define ETH_P_LOOP 0x0060 /* Ethernet Loopback packet */
43#define ETH_P_PUP 0x0200 /* Xerox PUP packet */
44#define ETH_P_PUPAT 0x0201 /* Xerox PUP Addr Trans packet */
45#define ETH_P_IP 0x0800 /* Internet Protocol packet */
46#define ETH_P_X25 0x0805 /* CCITT X.25 */
47#define ETH_P_ARP 0x0806 /* Address Resolution packet */
48#define ETH_P_BPQ 0x08FF /* G8BPQ AX.25 Ethernet Packet [ NOT AN OFFICIALLY REGISTERED ID ] */
49#define ETH_P_IEEEPUP 0x0a00 /* Xerox IEEE802.3 PUP packet */
50#define ETH_P_IEEEPUPAT 0x0a01 /* Xerox IEEE802.3 PUP Addr Trans packet */
51#define ETH_P_DEC 0x6000 /* DEC Assigned proto */
52#define ETH_P_DNA_DL 0x6001 /* DEC DNA Dump/Load */
53#define ETH_P_DNA_RC 0x6002 /* DEC DNA Remote Console */
54#define ETH_P_DNA_RT 0x6003 /* DEC DNA Routing */
55#define ETH_P_LAT 0x6004 /* DEC LAT */
56#define ETH_P_DIAG 0x6005 /* DEC Diagnostics */
57#define ETH_P_CUST 0x6006 /* DEC Customer use */
58#define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */
59#define ETH_P_TEB 0x6558 /* Trans Ether Bridging */
60#define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */
61#define ETH_P_ATALK 0x809B /* Appletalk DDP */
62#define ETH_P_AARP 0x80F3 /* Appletalk AARP */
63#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */
64#define ETH_P_IPX 0x8137 /* IPX over DIX */
65#define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */
66#define ETH_P_PAUSE 0x8808 /* IEEE Pause frames. See 802.3 31B */
67#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */
68#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol
69 * defined in draft-wilson-wrec-wccp-v2-00.txt */
70#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */
71#define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */
72#define ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */
73#define ETH_P_MPLS_MC 0x8848 /* MPLS Multicast traffic */
74#define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */
75#define ETH_P_LINK_CTL 0x886c /* HPNA, wlan link local tunnel */
76#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport
77 * over Ethernet
78 */
79#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
80#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */
81#define ETH_P_8021AD 0x88A8 /* 802.1ad Service VLAN */
82#define ETH_P_802_EX1 0x88B5 /* 802.1 Local Experimental 1. */
83#define ETH_P_TIPC 0x88CA /* TIPC */
84#define ETH_P_8021AH 0x88E7 /* 802.1ah Backbone Service Tag */
85#define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */
86#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */
87#define ETH_P_TDLS 0x890D /* TDLS */
88#define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */
89#define ETH_P_QINQ1 0x9100 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
90#define ETH_P_QINQ2 0x9200 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
91#define ETH_P_QINQ3 0x9300 /* deprecated QinQ VLAN [ NOT AN OFFICIALLY REGISTERED ID ] */
92#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
93#define ETH_P_AF_IUCV 0xFBFB /* IBM af_iucv [ NOT AN OFFICIALLY REGISTERED ID ] */
94
95/*
96 * Non DIX types. Won't clash for 1500 types.
97 */
98
99#define ETH_P_802_3 0x0001 /* Dummy type for 802.3 frames */
100#define ETH_P_AX25 0x0002 /* Dummy protocol id for AX.25 */
101#define ETH_P_ALL 0x0003 /* Every packet (be careful!!!) */
102#define ETH_P_802_2 0x0004 /* 802.2 frames */
103#define ETH_P_SNAP 0x0005 /* Internal only */
104#define ETH_P_DDCMP 0x0006 /* DEC DDCMP: Internal only */
105#define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/
106#define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */
107#define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */
108#define ETH_P_CAN 0x000C /* CAN: Controller Area Network */
109#define ETH_P_CANFD 0x000D /* CANFD: CAN flexible data rate*/
110#define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/
111#define ETH_P_TR_802_2 0x0011 /* 802.2 frames */
112#define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */
113#define ETH_P_CONTROL 0x0016 /* Card specific control frames */
114#define ETH_P_IRDA 0x0017 /* Linux-IrDA */
115#define ETH_P_ECONET 0x0018 /* Acorn Econet */
116#define ETH_P_HDLC 0x0019 /* HDLC frames */
117#define ETH_P_ARCNET 0x001A /* 1A for ArcNet :-) */
118#define ETH_P_DSA 0x001B /* Distributed Switch Arch. */
119#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */
120#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */
121#define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */
122#define ETH_P_CAIF 0x00F7 /* ST-Ericsson CAIF protocol */
123
124/*
125 * This is an Ethernet frame header.
126 */
127
128struct ethhdr {
129 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
130 unsigned char h_source[ETH_ALEN]; /* source ether addr */
131 __be16 h_proto; /* packet type ID field */
132} __attribute__((packed));
133
134
135#endif /* _UAPI_LINUX_IF_ETHER_H */
diff --git a/include/linux/if_fc.h b/include/uapi/linux/if_fc.h
index 6ed7f1bf35c8..6ed7f1bf35c8 100644
--- a/include/linux/if_fc.h
+++ b/include/uapi/linux/if_fc.h
diff --git a/include/uapi/linux/if_fddi.h b/include/uapi/linux/if_fddi.h
new file mode 100644
index 000000000000..0d36909c3aef
--- /dev/null
+++ b/include/uapi/linux/if_fddi.h
@@ -0,0 +1,104 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Global definitions for the ANSI FDDI interface.
7 *
8 * Version: @(#)if_fddi.h 1.0.2 Sep 29 2004
9 *
10 * Author: Lawrence V. Stefani, <stefani@lkg.dec.com>
11 *
12 * if_fddi.h is based on previous if_ether.h and if_tr.h work by
13 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
14 * Donald Becker, <becker@super.org>
15 * Alan Cox, <alan@lxorguk.ukuu.org.uk>
16 * Steve Whitehouse, <gw7rrm@eeshack3.swan.ac.uk>
17 * Peter De Schrijver, <stud11@cc4.kuleuven.ac.be>
18 *
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License
21 * as published by the Free Software Foundation; either version
22 * 2 of the License, or (at your option) any later version.
23 */
24#ifndef _UAPI_LINUX_IF_FDDI_H
25#define _UAPI_LINUX_IF_FDDI_H
26
27#include <linux/types.h>
28
29/*
30 * Define max and min legal sizes. The frame sizes do not include
31 * 4 byte FCS/CRC (frame check sequence).
32 */
33#define FDDI_K_ALEN 6 /* Octets in one FDDI address */
34#define FDDI_K_8022_HLEN 16 /* Total octets in 802.2 header */
35#define FDDI_K_SNAP_HLEN 21 /* Total octets in 802.2 SNAP header */
36#define FDDI_K_8022_ZLEN 16 /* Min octets in 802.2 frame sans FCS */
37#define FDDI_K_SNAP_ZLEN 21 /* Min octets in 802.2 SNAP frame sans FCS */
38#define FDDI_K_8022_DLEN 4475 /* Max octets in 802.2 payload */
39#define FDDI_K_SNAP_DLEN 4470 /* Max octets in 802.2 SNAP payload */
40#define FDDI_K_LLC_ZLEN 13 /* Min octets in LLC frame sans FCS */
41#define FDDI_K_LLC_LEN 4491 /* Max octets in LLC frame sans FCS */
42
43/* Define FDDI Frame Control (FC) Byte values */
44#define FDDI_FC_K_VOID 0x00
45#define FDDI_FC_K_NON_RESTRICTED_TOKEN 0x80
46#define FDDI_FC_K_RESTRICTED_TOKEN 0xC0
47#define FDDI_FC_K_SMT_MIN 0x41
48#define FDDI_FC_K_SMT_MAX 0x4F
49#define FDDI_FC_K_MAC_MIN 0xC1
50#define FDDI_FC_K_MAC_MAX 0xCF
51#define FDDI_FC_K_ASYNC_LLC_MIN 0x50
52#define FDDI_FC_K_ASYNC_LLC_DEF 0x54
53#define FDDI_FC_K_ASYNC_LLC_MAX 0x5F
54#define FDDI_FC_K_SYNC_LLC_MIN 0xD0
55#define FDDI_FC_K_SYNC_LLC_MAX 0xD7
56#define FDDI_FC_K_IMPLEMENTOR_MIN 0x60
57#define FDDI_FC_K_IMPLEMENTOR_MAX 0x6F
58#define FDDI_FC_K_RESERVED_MIN 0x70
59#define FDDI_FC_K_RESERVED_MAX 0x7F
60
61/* Define LLC and SNAP constants */
62#define FDDI_EXTENDED_SAP 0xAA
63#define FDDI_UI_CMD 0x03
64
65/* Define 802.2 Type 1 header */
66struct fddi_8022_1_hdr {
67 __u8 dsap; /* destination service access point */
68 __u8 ssap; /* source service access point */
69 __u8 ctrl; /* control byte #1 */
70} __attribute__((packed));
71
72/* Define 802.2 Type 2 header */
73struct fddi_8022_2_hdr {
74 __u8 dsap; /* destination service access point */
75 __u8 ssap; /* source service access point */
76 __u8 ctrl_1; /* control byte #1 */
77 __u8 ctrl_2; /* control byte #2 */
78} __attribute__((packed));
79
80/* Define 802.2 SNAP header */
81#define FDDI_K_OUI_LEN 3
82struct fddi_snap_hdr {
83 __u8 dsap; /* always 0xAA */
84 __u8 ssap; /* always 0xAA */
85 __u8 ctrl; /* always 0x03 */
86 __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */
87 __be16 ethertype; /* packet type ID field */
88} __attribute__((packed));
89
90/* Define FDDI LLC frame header */
91struct fddihdr {
92 __u8 fc; /* frame control */
93 __u8 daddr[FDDI_K_ALEN]; /* destination address */
94 __u8 saddr[FDDI_K_ALEN]; /* source address */
95 union
96 {
97 struct fddi_8022_1_hdr llc_8022_1;
98 struct fddi_8022_2_hdr llc_8022_2;
99 struct fddi_snap_hdr llc_snap;
100 } hdr;
101} __attribute__((packed));
102
103
104#endif /* _UAPI_LINUX_IF_FDDI_H */
diff --git a/include/uapi/linux/if_frad.h b/include/uapi/linux/if_frad.h
new file mode 100644
index 000000000000..f25b08d5eb6b
--- /dev/null
+++ b/include/uapi/linux/if_frad.h
@@ -0,0 +1,122 @@
1/*
2 * DLCI/FRAD Definitions for Frame Relay Access Devices. DLCI devices are
3 * created for each DLCI associated with a FRAD. The FRAD driver
4 * is not truly a network device, but the lower level device
5 * handler. This allows other FRAD manufacturers to use the DLCI
6 * code, including its RFC1490 encapsulation alongside the current
7 * implementation for the Sangoma cards.
8 *
9 * Version: @(#)if_ifrad.h 0.15 31 Mar 96
10 *
11 * Author: Mike McLagan <mike.mclagan@linux.org>
12 *
13 * Changes:
14 * 0.15 Mike McLagan changed structure defs (packed)
15 * re-arranged flags
16 * added DLCI_RET vars
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version
21 * 2 of the License, or (at your option) any later version.
22 */
23
24#ifndef _UAPI_FRAD_H_
25#define _UAPI_FRAD_H_
26
27#include <linux/if.h>
28
29/* Structures and constants associated with the DLCI device driver */
30
31struct dlci_add
32{
33 char devname[IFNAMSIZ];
34 short dlci;
35};
36
37#define DLCI_GET_CONF (SIOCDEVPRIVATE + 2)
38#define DLCI_SET_CONF (SIOCDEVPRIVATE + 3)
39
40/*
41 * These are related to the Sangoma SDLA and should remain in order.
42 * Code within the SDLA module is based on the specifics of this
43 * structure. Change at your own peril.
44 */
45struct dlci_conf {
46 short flags;
47 short CIR_fwd;
48 short Bc_fwd;
49 short Be_fwd;
50 short CIR_bwd;
51 short Bc_bwd;
52 short Be_bwd;
53
54/* these are part of the status read */
55 short Tc_fwd;
56 short Tc_bwd;
57 short Tf_max;
58 short Tb_max;
59
60/* add any new fields here above is a mirror of sdla_dlci_conf */
61};
62
63#define DLCI_GET_SLAVE (SIOCDEVPRIVATE + 4)
64
65/* configuration flags for DLCI */
66#define DLCI_IGNORE_CIR_OUT 0x0001
67#define DLCI_ACCOUNT_CIR_IN 0x0002
68#define DLCI_BUFFER_IF 0x0008
69
70#define DLCI_VALID_FLAGS 0x000B
71
72/* defines for the actual Frame Relay hardware */
73#define FRAD_GET_CONF (SIOCDEVPRIVATE)
74#define FRAD_SET_CONF (SIOCDEVPRIVATE + 1)
75
76#define FRAD_LAST_IOCTL FRAD_SET_CONF
77
78/*
79 * Based on the setup for the Sangoma SDLA. If changes are
80 * necessary to this structure, a routine will need to be
81 * added to that module to copy fields.
82 */
83struct frad_conf
84{
85 short station;
86 short flags;
87 short kbaud;
88 short clocking;
89 short mtu;
90 short T391;
91 short T392;
92 short N391;
93 short N392;
94 short N393;
95 short CIR_fwd;
96 short Bc_fwd;
97 short Be_fwd;
98 short CIR_bwd;
99 short Bc_bwd;
100 short Be_bwd;
101
102/* Add new fields here, above is a mirror of the sdla_conf */
103
104};
105
106#define FRAD_STATION_CPE 0x0000
107#define FRAD_STATION_NODE 0x0001
108
109#define FRAD_TX_IGNORE_CIR 0x0001
110#define FRAD_RX_ACCOUNT_CIR 0x0002
111#define FRAD_DROP_ABORTED 0x0004
112#define FRAD_BUFFERIF 0x0008
113#define FRAD_STATS 0x0010
114#define FRAD_MCI 0x0100
115#define FRAD_AUTODLCI 0x8000
116#define FRAD_VALID_FLAGS 0x811F
117
118#define FRAD_CLOCK_INT 0x0001
119#define FRAD_CLOCK_EXT 0x0000
120
121
122#endif /* _UAPI_FRAD_H_ */
diff --git a/include/linux/if_hippi.h b/include/uapi/linux/if_hippi.h
index cdc049f1829a..cdc049f1829a 100644
--- a/include/linux/if_hippi.h
+++ b/include/uapi/linux/if_hippi.h
diff --git a/include/linux/if_infiniband.h b/include/uapi/linux/if_infiniband.h
index 7d958475d4ac..7d958475d4ac 100644
--- a/include/linux/if_infiniband.h
+++ b/include/uapi/linux/if_infiniband.h
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
new file mode 100644
index 000000000000..5c80cb11518b
--- /dev/null
+++ b/include/uapi/linux/if_link.h
@@ -0,0 +1,429 @@
1#ifndef _UAPI_LINUX_IF_LINK_H
2#define _UAPI_LINUX_IF_LINK_H
3
4#include <linux/types.h>
5#include <linux/netlink.h>
6
7/* This struct should be in sync with struct rtnl_link_stats64 */
8struct rtnl_link_stats {
9 __u32 rx_packets; /* total packets received */
10 __u32 tx_packets; /* total packets transmitted */
11 __u32 rx_bytes; /* total bytes received */
12 __u32 tx_bytes; /* total bytes transmitted */
13 __u32 rx_errors; /* bad packets received */
14 __u32 tx_errors; /* packet transmit problems */
15 __u32 rx_dropped; /* no space in linux buffers */
16 __u32 tx_dropped; /* no space available in linux */
17 __u32 multicast; /* multicast packets received */
18 __u32 collisions;
19
20 /* detailed rx_errors: */
21 __u32 rx_length_errors;
22 __u32 rx_over_errors; /* receiver ring buff overflow */
23 __u32 rx_crc_errors; /* recved pkt with crc error */
24 __u32 rx_frame_errors; /* recv'd frame alignment error */
25 __u32 rx_fifo_errors; /* recv'r fifo overrun */
26 __u32 rx_missed_errors; /* receiver missed packet */
27
28 /* detailed tx_errors */
29 __u32 tx_aborted_errors;
30 __u32 tx_carrier_errors;
31 __u32 tx_fifo_errors;
32 __u32 tx_heartbeat_errors;
33 __u32 tx_window_errors;
34
35 /* for cslip etc */
36 __u32 rx_compressed;
37 __u32 tx_compressed;
38};
39
40/* The main device statistics structure */
41struct rtnl_link_stats64 {
42 __u64 rx_packets; /* total packets received */
43 __u64 tx_packets; /* total packets transmitted */
44 __u64 rx_bytes; /* total bytes received */
45 __u64 tx_bytes; /* total bytes transmitted */
46 __u64 rx_errors; /* bad packets received */
47 __u64 tx_errors; /* packet transmit problems */
48 __u64 rx_dropped; /* no space in linux buffers */
49 __u64 tx_dropped; /* no space available in linux */
50 __u64 multicast; /* multicast packets received */
51 __u64 collisions;
52
53 /* detailed rx_errors: */
54 __u64 rx_length_errors;
55 __u64 rx_over_errors; /* receiver ring buff overflow */
56 __u64 rx_crc_errors; /* recved pkt with crc error */
57 __u64 rx_frame_errors; /* recv'd frame alignment error */
58 __u64 rx_fifo_errors; /* recv'r fifo overrun */
59 __u64 rx_missed_errors; /* receiver missed packet */
60
61 /* detailed tx_errors */
62 __u64 tx_aborted_errors;
63 __u64 tx_carrier_errors;
64 __u64 tx_fifo_errors;
65 __u64 tx_heartbeat_errors;
66 __u64 tx_window_errors;
67
68 /* for cslip etc */
69 __u64 rx_compressed;
70 __u64 tx_compressed;
71};
72
73/* The struct should be in sync with struct ifmap */
74struct rtnl_link_ifmap {
75 __u64 mem_start;
76 __u64 mem_end;
77 __u64 base_addr;
78 __u16 irq;
79 __u8 dma;
80 __u8 port;
81};
82
83/*
84 * IFLA_AF_SPEC
85 * Contains nested attributes for address family specific attributes.
86 * Each address family may create a attribute with the address family
87 * number as type and create its own attribute structure in it.
88 *
89 * Example:
90 * [IFLA_AF_SPEC] = {
91 * [AF_INET] = {
92 * [IFLA_INET_CONF] = ...,
93 * },
94 * [AF_INET6] = {
95 * [IFLA_INET6_FLAGS] = ...,
96 * [IFLA_INET6_CONF] = ...,
97 * }
98 * }
99 */
100
101enum {
102 IFLA_UNSPEC,
103 IFLA_ADDRESS,
104 IFLA_BROADCAST,
105 IFLA_IFNAME,
106 IFLA_MTU,
107 IFLA_LINK,
108 IFLA_QDISC,
109 IFLA_STATS,
110 IFLA_COST,
111#define IFLA_COST IFLA_COST
112 IFLA_PRIORITY,
113#define IFLA_PRIORITY IFLA_PRIORITY
114 IFLA_MASTER,
115#define IFLA_MASTER IFLA_MASTER
116 IFLA_WIRELESS, /* Wireless Extension event - see wireless.h */
117#define IFLA_WIRELESS IFLA_WIRELESS
118 IFLA_PROTINFO, /* Protocol specific information for a link */
119#define IFLA_PROTINFO IFLA_PROTINFO
120 IFLA_TXQLEN,
121#define IFLA_TXQLEN IFLA_TXQLEN
122 IFLA_MAP,
123#define IFLA_MAP IFLA_MAP
124 IFLA_WEIGHT,
125#define IFLA_WEIGHT IFLA_WEIGHT
126 IFLA_OPERSTATE,
127 IFLA_LINKMODE,
128 IFLA_LINKINFO,
129#define IFLA_LINKINFO IFLA_LINKINFO
130 IFLA_NET_NS_PID,
131 IFLA_IFALIAS,
132 IFLA_NUM_VF, /* Number of VFs if device is SR-IOV PF */
133 IFLA_VFINFO_LIST,
134 IFLA_STATS64,
135 IFLA_VF_PORTS,
136 IFLA_PORT_SELF,
137 IFLA_AF_SPEC,
138 IFLA_GROUP, /* Group the device belongs to */
139 IFLA_NET_NS_FD,
140 IFLA_EXT_MASK, /* Extended info mask, VFs, etc */
141 IFLA_PROMISCUITY, /* Promiscuity count: > 0 means acts PROMISC */
142#define IFLA_PROMISCUITY IFLA_PROMISCUITY
143 IFLA_NUM_TX_QUEUES,
144 IFLA_NUM_RX_QUEUES,
145 __IFLA_MAX
146};
147
148
149#define IFLA_MAX (__IFLA_MAX - 1)
150
151/* backwards compatibility for userspace */
152#ifndef __KERNEL__
153#define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg))))
154#define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg))
155#endif
156
157enum {
158 IFLA_INET_UNSPEC,
159 IFLA_INET_CONF,
160 __IFLA_INET_MAX,
161};
162
163#define IFLA_INET_MAX (__IFLA_INET_MAX - 1)
164
165/* ifi_flags.
166
167 IFF_* flags.
168
169 The only change is:
170 IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are
171 more not changeable by user. They describe link media
172 characteristics and set by device driver.
173
174 Comments:
175 - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid
176 - If neither of these three flags are set;
177 the interface is NBMA.
178
179 - IFF_MULTICAST does not mean anything special:
180 multicasts can be used on all not-NBMA links.
181 IFF_MULTICAST means that this media uses special encapsulation
182 for multicast frames. Apparently, all IFF_POINTOPOINT and
183 IFF_BROADCAST devices are able to use multicasts too.
184 */
185
186/* IFLA_LINK.
187 For usual devices it is equal ifi_index.
188 If it is a "virtual interface" (f.e. tunnel), ifi_link
189 can point to real physical interface (f.e. for bandwidth calculations),
190 or maybe 0, what means, that real media is unknown (usual
191 for IPIP tunnels, when route to endpoint is allowed to change)
192 */
193
194/* Subtype attributes for IFLA_PROTINFO */
195enum {
196 IFLA_INET6_UNSPEC,
197 IFLA_INET6_FLAGS, /* link flags */
198 IFLA_INET6_CONF, /* sysctl parameters */
199 IFLA_INET6_STATS, /* statistics */
200 IFLA_INET6_MCAST, /* MC things. What of them? */
201 IFLA_INET6_CACHEINFO, /* time values and max reasm size */
202 IFLA_INET6_ICMP6STATS, /* statistics (icmpv6) */
203 __IFLA_INET6_MAX
204};
205
206#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1)
207
208struct ifla_cacheinfo {
209 __u32 max_reasm_len;
210 __u32 tstamp; /* ipv6InterfaceTable updated timestamp */
211 __u32 reachable_time;
212 __u32 retrans_time;
213};
214
215enum {
216 IFLA_INFO_UNSPEC,
217 IFLA_INFO_KIND,
218 IFLA_INFO_DATA,
219 IFLA_INFO_XSTATS,
220 __IFLA_INFO_MAX,
221};
222
223#define IFLA_INFO_MAX (__IFLA_INFO_MAX - 1)
224
225/* VLAN section */
226
227enum {
228 IFLA_VLAN_UNSPEC,
229 IFLA_VLAN_ID,
230 IFLA_VLAN_FLAGS,
231 IFLA_VLAN_EGRESS_QOS,
232 IFLA_VLAN_INGRESS_QOS,
233 __IFLA_VLAN_MAX,
234};
235
236#define IFLA_VLAN_MAX (__IFLA_VLAN_MAX - 1)
237
238struct ifla_vlan_flags {
239 __u32 flags;
240 __u32 mask;
241};
242
243enum {
244 IFLA_VLAN_QOS_UNSPEC,
245 IFLA_VLAN_QOS_MAPPING,
246 __IFLA_VLAN_QOS_MAX
247};
248
249#define IFLA_VLAN_QOS_MAX (__IFLA_VLAN_QOS_MAX - 1)
250
251struct ifla_vlan_qos_mapping {
252 __u32 from;
253 __u32 to;
254};
255
256/* MACVLAN section */
257enum {
258 IFLA_MACVLAN_UNSPEC,
259 IFLA_MACVLAN_MODE,
260 IFLA_MACVLAN_FLAGS,
261 __IFLA_MACVLAN_MAX,
262};
263
264#define IFLA_MACVLAN_MAX (__IFLA_MACVLAN_MAX - 1)
265
266enum macvlan_mode {
267 MACVLAN_MODE_PRIVATE = 1, /* don't talk to other macvlans */
268 MACVLAN_MODE_VEPA = 2, /* talk to other ports through ext bridge */
269 MACVLAN_MODE_BRIDGE = 4, /* talk to bridge ports directly */
270 MACVLAN_MODE_PASSTHRU = 8,/* take over the underlying device */
271};
272
273#define MACVLAN_FLAG_NOPROMISC 1
274
275/* VXLAN section */
276enum {
277 IFLA_VXLAN_UNSPEC,
278 IFLA_VXLAN_ID,
279 IFLA_VXLAN_GROUP,
280 IFLA_VXLAN_LINK,
281 IFLA_VXLAN_LOCAL,
282 IFLA_VXLAN_TTL,
283 IFLA_VXLAN_TOS,
284 IFLA_VXLAN_LEARNING,
285 IFLA_VXLAN_AGEING,
286 IFLA_VXLAN_LIMIT,
287 IFLA_VXLAN_PORT_RANGE,
288 __IFLA_VXLAN_MAX
289};
290#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
291
292struct ifla_vxlan_port_range {
293 __be16 low;
294 __be16 high;
295};
296
297/* SR-IOV virtual function management section */
298
299enum {
300 IFLA_VF_INFO_UNSPEC,
301 IFLA_VF_INFO,
302 __IFLA_VF_INFO_MAX,
303};
304
305#define IFLA_VF_INFO_MAX (__IFLA_VF_INFO_MAX - 1)
306
307enum {
308 IFLA_VF_UNSPEC,
309 IFLA_VF_MAC, /* Hardware queue specific attributes */
310 IFLA_VF_VLAN,
311 IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */
312 IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */
313 __IFLA_VF_MAX,
314};
315
316#define IFLA_VF_MAX (__IFLA_VF_MAX - 1)
317
318struct ifla_vf_mac {
319 __u32 vf;
320 __u8 mac[32]; /* MAX_ADDR_LEN */
321};
322
323struct ifla_vf_vlan {
324 __u32 vf;
325 __u32 vlan; /* 0 - 4095, 0 disables VLAN filter */
326 __u32 qos;
327};
328
329struct ifla_vf_tx_rate {
330 __u32 vf;
331 __u32 rate; /* Max TX bandwidth in Mbps, 0 disables throttling */
332};
333
334struct ifla_vf_spoofchk {
335 __u32 vf;
336 __u32 setting;
337};
338
339/* VF ports management section
340 *
341 * Nested layout of set/get msg is:
342 *
343 * [IFLA_NUM_VF]
344 * [IFLA_VF_PORTS]
345 * [IFLA_VF_PORT]
346 * [IFLA_PORT_*], ...
347 * [IFLA_VF_PORT]
348 * [IFLA_PORT_*], ...
349 * ...
350 * [IFLA_PORT_SELF]
351 * [IFLA_PORT_*], ...
352 */
353
354enum {
355 IFLA_VF_PORT_UNSPEC,
356 IFLA_VF_PORT, /* nest */
357 __IFLA_VF_PORT_MAX,
358};
359
360#define IFLA_VF_PORT_MAX (__IFLA_VF_PORT_MAX - 1)
361
362enum {
363 IFLA_PORT_UNSPEC,
364 IFLA_PORT_VF, /* __u32 */
365 IFLA_PORT_PROFILE, /* string */
366 IFLA_PORT_VSI_TYPE, /* 802.1Qbg (pre-)standard VDP */
367 IFLA_PORT_INSTANCE_UUID, /* binary UUID */
368 IFLA_PORT_HOST_UUID, /* binary UUID */
369 IFLA_PORT_REQUEST, /* __u8 */
370 IFLA_PORT_RESPONSE, /* __u16, output only */
371 __IFLA_PORT_MAX,
372};
373
374#define IFLA_PORT_MAX (__IFLA_PORT_MAX - 1)
375
376#define PORT_PROFILE_MAX 40
377#define PORT_UUID_MAX 16
378#define PORT_SELF_VF -1
379
380enum {
381 PORT_REQUEST_PREASSOCIATE = 0,
382 PORT_REQUEST_PREASSOCIATE_RR,
383 PORT_REQUEST_ASSOCIATE,
384 PORT_REQUEST_DISASSOCIATE,
385};
386
387enum {
388 PORT_VDP_RESPONSE_SUCCESS = 0,
389 PORT_VDP_RESPONSE_INVALID_FORMAT,
390 PORT_VDP_RESPONSE_INSUFFICIENT_RESOURCES,
391 PORT_VDP_RESPONSE_UNUSED_VTID,
392 PORT_VDP_RESPONSE_VTID_VIOLATION,
393 PORT_VDP_RESPONSE_VTID_VERSION_VIOALTION,
394 PORT_VDP_RESPONSE_OUT_OF_SYNC,
395 /* 0x08-0xFF reserved for future VDP use */
396 PORT_PROFILE_RESPONSE_SUCCESS = 0x100,
397 PORT_PROFILE_RESPONSE_INPROGRESS,
398 PORT_PROFILE_RESPONSE_INVALID,
399 PORT_PROFILE_RESPONSE_BADSTATE,
400 PORT_PROFILE_RESPONSE_INSUFFICIENT_RESOURCES,
401 PORT_PROFILE_RESPONSE_ERROR,
402};
403
404struct ifla_port_vsi {
405 __u8 vsi_mgr_id;
406 __u8 vsi_type_id[3];
407 __u8 vsi_type_version;
408 __u8 pad[3];
409};
410
411
412/* IPoIB section */
413
414enum {
415 IFLA_IPOIB_UNSPEC,
416 IFLA_IPOIB_PKEY,
417 IFLA_IPOIB_MODE,
418 IFLA_IPOIB_UMCAST,
419 __IFLA_IPOIB_MAX
420};
421
422enum {
423 IPOIB_MODE_DATAGRAM = 0, /* using unreliable datagram QPs */
424 IPOIB_MODE_CONNECTED = 1, /* using connected QPs */
425};
426
427#define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1)
428
429#endif /* _UAPI_LINUX_IF_LINK_H */
diff --git a/include/uapi/linux/if_ltalk.h b/include/uapi/linux/if_ltalk.h
new file mode 100644
index 000000000000..b92c1fb6ac16
--- /dev/null
+++ b/include/uapi/linux/if_ltalk.h
@@ -0,0 +1,9 @@
1#ifndef _UAPI__LINUX_LTALK_H
2#define _UAPI__LINUX_LTALK_H
3
4#define LTALK_HLEN 1
5#define LTALK_MTU 600
6#define LTALK_ALEN 1
7
8
9#endif /* _UAPI__LINUX_LTALK_H */
diff --git a/include/linux/if_packet.h b/include/uapi/linux/if_packet.h
index f3799295d231..f3799295d231 100644
--- a/include/linux/if_packet.h
+++ b/include/uapi/linux/if_packet.h
diff --git a/include/uapi/linux/if_phonet.h b/include/uapi/linux/if_phonet.h
new file mode 100644
index 000000000000..f7ad9e24eb3d
--- /dev/null
+++ b/include/uapi/linux/if_phonet.h
@@ -0,0 +1,16 @@
1/*
2 * File: if_phonet.h
3 *
4 * Phonet interface kernel definitions
5 *
6 * Copyright (C) 2008 Nokia Corporation. All rights reserved.
7 */
8#ifndef _UAPILINUX_IF_PHONET_H
9#define _UAPILINUX_IF_PHONET_H
10
11#define PHONET_MIN_MTU 6 /* pn_length = 0 */
12#define PHONET_MAX_MTU 65541 /* pn_length = 0xffff */
13#define PHONET_DEV_MTU PHONET_MAX_MTU
14
15
16#endif /* _UAPILINUX_IF_PHONET_H */
diff --git a/include/linux/if_plip.h b/include/uapi/linux/if_plip.h
index 6298c7e88b2b..6298c7e88b2b 100644
--- a/include/linux/if_plip.h
+++ b/include/uapi/linux/if_plip.h
diff --git a/include/linux/if_ppp.h b/include/uapi/linux/if_ppp.h
index 9048fabb7a4e..9048fabb7a4e 100644
--- a/include/linux/if_ppp.h
+++ b/include/uapi/linux/if_ppp.h
diff --git a/include/uapi/linux/if_pppol2tp.h b/include/uapi/linux/if_pppol2tp.h
new file mode 100644
index 000000000000..163e8adac2d6
--- /dev/null
+++ b/include/uapi/linux/if_pppol2tp.h
@@ -0,0 +1,104 @@
1/***************************************************************************
2 * Linux PPP over L2TP (PPPoL2TP) Socket Implementation (RFC 2661)
3 *
4 * This file supplies definitions required by the PPP over L2TP driver
5 * (l2tp_ppp.c). All version information wrt this file is located in l2tp_ppp.c
6 *
7 * License:
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 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 *
13 */
14
15#ifndef _UAPI__LINUX_IF_PPPOL2TP_H
16#define _UAPI__LINUX_IF_PPPOL2TP_H
17
18#include <linux/types.h>
19
20
21/* Structure used to connect() the socket to a particular tunnel UDP
22 * socket over IPv4.
23 */
24struct pppol2tp_addr {
25 __kernel_pid_t pid; /* pid that owns the fd.
26 * 0 => current */
27 int fd; /* FD of UDP socket to use */
28
29 struct sockaddr_in addr; /* IP address and port to send to */
30
31 __u16 s_tunnel, s_session; /* For matching incoming packets */
32 __u16 d_tunnel, d_session; /* For sending outgoing packets */
33};
34
35/* Structure used to connect() the socket to a particular tunnel UDP
36 * socket over IPv6.
37 */
38struct pppol2tpin6_addr {
39 __kernel_pid_t pid; /* pid that owns the fd.
40 * 0 => current */
41 int fd; /* FD of UDP socket to use */
42
43 __u16 s_tunnel, s_session; /* For matching incoming packets */
44 __u16 d_tunnel, d_session; /* For sending outgoing packets */
45
46 struct sockaddr_in6 addr; /* IP address and port to send to */
47};
48
49/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
50 * bits. So we need a different sockaddr structure.
51 */
52struct pppol2tpv3_addr {
53 __kernel_pid_t pid; /* pid that owns the fd.
54 * 0 => current */
55 int fd; /* FD of UDP or IP socket to use */
56
57 struct sockaddr_in addr; /* IP address and port to send to */
58
59 __u32 s_tunnel, s_session; /* For matching incoming packets */
60 __u32 d_tunnel, d_session; /* For sending outgoing packets */
61};
62
63struct pppol2tpv3in6_addr {
64 __kernel_pid_t pid; /* pid that owns the fd.
65 * 0 => current */
66 int fd; /* FD of UDP or IP socket to use */
67
68 __u32 s_tunnel, s_session; /* For matching incoming packets */
69 __u32 d_tunnel, d_session; /* For sending outgoing packets */
70
71 struct sockaddr_in6 addr; /* IP address and port to send to */
72};
73
74/* Socket options:
75 * DEBUG - bitmask of debug message categories
76 * SENDSEQ - 0 => don't send packets with sequence numbers
77 * 1 => send packets with sequence numbers
78 * RECVSEQ - 0 => receive packet sequence numbers are optional
79 * 1 => drop receive packets without sequence numbers
80 * LNSMODE - 0 => act as LAC.
81 * 1 => act as LNS.
82 * REORDERTO - reorder timeout (in millisecs). If 0, don't try to reorder.
83 */
84enum {
85 PPPOL2TP_SO_DEBUG = 1,
86 PPPOL2TP_SO_RECVSEQ = 2,
87 PPPOL2TP_SO_SENDSEQ = 3,
88 PPPOL2TP_SO_LNSMODE = 4,
89 PPPOL2TP_SO_REORDERTO = 5,
90};
91
92/* Debug message categories for the DEBUG socket option */
93enum {
94 PPPOL2TP_MSG_DEBUG = (1 << 0), /* verbose debug (if
95 * compiled in) */
96 PPPOL2TP_MSG_CONTROL = (1 << 1), /* userspace - kernel
97 * interface */
98 PPPOL2TP_MSG_SEQ = (1 << 2), /* sequence numbers */
99 PPPOL2TP_MSG_DATA = (1 << 3), /* data packets */
100};
101
102
103
104#endif /* _UAPI__LINUX_IF_PPPOL2TP_H */
diff --git a/include/uapi/linux/if_pppox.h b/include/uapi/linux/if_pppox.h
new file mode 100644
index 000000000000..0b46fd57c8f6
--- /dev/null
+++ b/include/uapi/linux/if_pppox.h
@@ -0,0 +1,156 @@
1/***************************************************************************
2 * Linux PPP over X - Generic PPP transport layer sockets
3 * Linux PPP over Ethernet (PPPoE) Socket Implementation (RFC 2516)
4 *
5 * This file supplies definitions required by the PPP over Ethernet driver
6 * (pppox.c). All version information wrt this file is located in pppox.c
7 *
8 * License:
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 *
14 */
15
16#ifndef _UAPI__LINUX_IF_PPPOX_H
17#define _UAPI__LINUX_IF_PPPOX_H
18
19
20#include <linux/types.h>
21#include <asm/byteorder.h>
22
23#include <linux/socket.h>
24#include <linux/if_ether.h>
25#include <linux/if_pppol2tp.h>
26
27/* For user-space programs to pick up these definitions
28 * which they wouldn't get otherwise without defining __KERNEL__
29 */
30#ifndef AF_PPPOX
31#define AF_PPPOX 24
32#define PF_PPPOX AF_PPPOX
33#endif /* !(AF_PPPOX) */
34
35/************************************************************************
36 * PPPoE addressing definition
37 */
38typedef __be16 sid_t;
39struct pppoe_addr {
40 sid_t sid; /* Session identifier */
41 unsigned char remote[ETH_ALEN]; /* Remote address */
42 char dev[IFNAMSIZ]; /* Local device to use */
43};
44
45/************************************************************************
46 * PPTP addressing definition
47 */
48struct pptp_addr {
49 __be16 call_id;
50 struct in_addr sin_addr;
51};
52
53/************************************************************************
54 * Protocols supported by AF_PPPOX
55 */
56#define PX_PROTO_OE 0 /* Currently just PPPoE */
57#define PX_PROTO_OL2TP 1 /* Now L2TP also */
58#define PX_PROTO_PPTP 2
59#define PX_MAX_PROTO 3
60
61struct sockaddr_pppox {
62 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
63 unsigned int sa_protocol; /* protocol identifier */
64 union {
65 struct pppoe_addr pppoe;
66 struct pptp_addr pptp;
67 } sa_addr;
68} __packed;
69
70/* The use of the above union isn't viable because the size of this
71 * struct must stay fixed over time -- applications use sizeof(struct
72 * sockaddr_pppox) to fill it. We use a protocol specific sockaddr
73 * type instead.
74 */
75struct sockaddr_pppol2tp {
76 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
77 unsigned int sa_protocol; /* protocol identifier */
78 struct pppol2tp_addr pppol2tp;
79} __packed;
80
81struct sockaddr_pppol2tpin6 {
82 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
83 unsigned int sa_protocol; /* protocol identifier */
84 struct pppol2tpin6_addr pppol2tp;
85} __packed;
86
87/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
88 * bits. So we need a different sockaddr structure.
89 */
90struct sockaddr_pppol2tpv3 {
91 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
92 unsigned int sa_protocol; /* protocol identifier */
93 struct pppol2tpv3_addr pppol2tp;
94} __packed;
95
96struct sockaddr_pppol2tpv3in6 {
97 __kernel_sa_family_t sa_family; /* address family, AF_PPPOX */
98 unsigned int sa_protocol; /* protocol identifier */
99 struct pppol2tpv3in6_addr pppol2tp;
100} __packed;
101
102/*********************************************************************
103 *
104 * ioctl interface for defining forwarding of connections
105 *
106 ********************************************************************/
107
108#define PPPOEIOCSFWD _IOW(0xB1 ,0, size_t)
109#define PPPOEIOCDFWD _IO(0xB1 ,1)
110/*#define PPPOEIOCGFWD _IOWR(0xB1,2, size_t)*/
111
112/* Codes to identify message types */
113#define PADI_CODE 0x09
114#define PADO_CODE 0x07
115#define PADR_CODE 0x19
116#define PADS_CODE 0x65
117#define PADT_CODE 0xa7
118struct pppoe_tag {
119 __be16 tag_type;
120 __be16 tag_len;
121 char tag_data[0];
122} __attribute__ ((packed));
123
124/* Tag identifiers */
125#define PTT_EOL __cpu_to_be16(0x0000)
126#define PTT_SRV_NAME __cpu_to_be16(0x0101)
127#define PTT_AC_NAME __cpu_to_be16(0x0102)
128#define PTT_HOST_UNIQ __cpu_to_be16(0x0103)
129#define PTT_AC_COOKIE __cpu_to_be16(0x0104)
130#define PTT_VENDOR __cpu_to_be16(0x0105)
131#define PTT_RELAY_SID __cpu_to_be16(0x0110)
132#define PTT_SRV_ERR __cpu_to_be16(0x0201)
133#define PTT_SYS_ERR __cpu_to_be16(0x0202)
134#define PTT_GEN_ERR __cpu_to_be16(0x0203)
135
136struct pppoe_hdr {
137#if defined(__LITTLE_ENDIAN_BITFIELD)
138 __u8 ver : 4;
139 __u8 type : 4;
140#elif defined(__BIG_ENDIAN_BITFIELD)
141 __u8 type : 4;
142 __u8 ver : 4;
143#else
144#error "Please fix <asm/byteorder.h>"
145#endif
146 __u8 code;
147 __be16 sid;
148 __be16 length;
149 struct pppoe_tag tag[0];
150} __packed;
151
152/* Length of entire PPPoE + PPP header */
153#define PPPOE_SES_HLEN 8
154
155
156#endif /* _UAPI__LINUX_IF_PPPOX_H */
diff --git a/include/linux/if_slip.h b/include/uapi/linux/if_slip.h
index 1eb4e3a8397a..1eb4e3a8397a 100644
--- a/include/linux/if_slip.h
+++ b/include/uapi/linux/if_slip.h
diff --git a/include/uapi/linux/if_team.h b/include/uapi/linux/if_team.h
new file mode 100644
index 000000000000..7b8fa339de30
--- /dev/null
+++ b/include/uapi/linux/if_team.h
@@ -0,0 +1,107 @@
1/*
2 * include/linux/if_team.h - Network team device driver header
3 * Copyright (c) 2011 Jiri Pirko <jpirko@redhat.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 */
10
11#ifndef _UAPI_LINUX_IF_TEAM_H_
12#define _UAPI_LINUX_IF_TEAM_H_
13
14
15#define TEAM_STRING_MAX_LEN 32
16
17/**********************************
18 * NETLINK_GENERIC netlink family.
19 **********************************/
20
21enum {
22 TEAM_CMD_NOOP,
23 TEAM_CMD_OPTIONS_SET,
24 TEAM_CMD_OPTIONS_GET,
25 TEAM_CMD_PORT_LIST_GET,
26
27 __TEAM_CMD_MAX,
28 TEAM_CMD_MAX = (__TEAM_CMD_MAX - 1),
29};
30
31enum {
32 TEAM_ATTR_UNSPEC,
33 TEAM_ATTR_TEAM_IFINDEX, /* u32 */
34 TEAM_ATTR_LIST_OPTION, /* nest */
35 TEAM_ATTR_LIST_PORT, /* nest */
36
37 __TEAM_ATTR_MAX,
38 TEAM_ATTR_MAX = __TEAM_ATTR_MAX - 1,
39};
40
41/* Nested layout of get/set msg:
42 *
43 * [TEAM_ATTR_LIST_OPTION]
44 * [TEAM_ATTR_ITEM_OPTION]
45 * [TEAM_ATTR_OPTION_*], ...
46 * [TEAM_ATTR_ITEM_OPTION]
47 * [TEAM_ATTR_OPTION_*], ...
48 * ...
49 * [TEAM_ATTR_LIST_PORT]
50 * [TEAM_ATTR_ITEM_PORT]
51 * [TEAM_ATTR_PORT_*], ...
52 * [TEAM_ATTR_ITEM_PORT]
53 * [TEAM_ATTR_PORT_*], ...
54 * ...
55 */
56
57enum {
58 TEAM_ATTR_ITEM_OPTION_UNSPEC,
59 TEAM_ATTR_ITEM_OPTION, /* nest */
60
61 __TEAM_ATTR_ITEM_OPTION_MAX,
62 TEAM_ATTR_ITEM_OPTION_MAX = __TEAM_ATTR_ITEM_OPTION_MAX - 1,
63};
64
65enum {
66 TEAM_ATTR_OPTION_UNSPEC,
67 TEAM_ATTR_OPTION_NAME, /* string */
68 TEAM_ATTR_OPTION_CHANGED, /* flag */
69 TEAM_ATTR_OPTION_TYPE, /* u8 */
70 TEAM_ATTR_OPTION_DATA, /* dynamic */
71 TEAM_ATTR_OPTION_REMOVED, /* flag */
72 TEAM_ATTR_OPTION_PORT_IFINDEX, /* u32 */ /* for per-port options */
73 TEAM_ATTR_OPTION_ARRAY_INDEX, /* u32 */ /* for array options */
74
75 __TEAM_ATTR_OPTION_MAX,
76 TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1,
77};
78
79enum {
80 TEAM_ATTR_ITEM_PORT_UNSPEC,
81 TEAM_ATTR_ITEM_PORT, /* nest */
82
83 __TEAM_ATTR_ITEM_PORT_MAX,
84 TEAM_ATTR_ITEM_PORT_MAX = __TEAM_ATTR_ITEM_PORT_MAX - 1,
85};
86
87enum {
88 TEAM_ATTR_PORT_UNSPEC,
89 TEAM_ATTR_PORT_IFINDEX, /* u32 */
90 TEAM_ATTR_PORT_CHANGED, /* flag */
91 TEAM_ATTR_PORT_LINKUP, /* flag */
92 TEAM_ATTR_PORT_SPEED, /* u32 */
93 TEAM_ATTR_PORT_DUPLEX, /* u8 */
94 TEAM_ATTR_PORT_REMOVED, /* flag */
95
96 __TEAM_ATTR_PORT_MAX,
97 TEAM_ATTR_PORT_MAX = __TEAM_ATTR_PORT_MAX - 1,
98};
99
100/*
101 * NETLINK_GENERIC related info
102 */
103#define TEAM_GENL_NAME "team"
104#define TEAM_GENL_VERSION 0x1
105#define TEAM_GENL_CHANGE_EVENT_MC_GRP_NAME "change_event"
106
107#endif /* _UAPI_LINUX_IF_TEAM_H_ */
diff --git a/include/uapi/linux/if_tun.h b/include/uapi/linux/if_tun.h
new file mode 100644
index 000000000000..25a585ce23e6
--- /dev/null
+++ b/include/uapi/linux/if_tun.h
@@ -0,0 +1,94 @@
1/*
2 * Universal TUN/TAP device driver.
3 * Copyright (C) 1999-2000 Maxim Krasnyansky <max_mk@yahoo.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef _UAPI__IF_TUN_H
17#define _UAPI__IF_TUN_H
18
19#include <linux/types.h>
20#include <linux/if_ether.h>
21#include <linux/filter.h>
22
23/* Read queue size */
24#define TUN_READQ_SIZE 500
25
26/* TUN device flags */
27#define TUN_TUN_DEV 0x0001
28#define TUN_TAP_DEV 0x0002
29#define TUN_TYPE_MASK 0x000f
30
31#define TUN_FASYNC 0x0010
32#define TUN_NOCHECKSUM 0x0020
33#define TUN_NO_PI 0x0040
34#define TUN_ONE_QUEUE 0x0080
35#define TUN_PERSIST 0x0100
36#define TUN_VNET_HDR 0x0200
37
38/* Ioctl defines */
39#define TUNSETNOCSUM _IOW('T', 200, int)
40#define TUNSETDEBUG _IOW('T', 201, int)
41#define TUNSETIFF _IOW('T', 202, int)
42#define TUNSETPERSIST _IOW('T', 203, int)
43#define TUNSETOWNER _IOW('T', 204, int)
44#define TUNSETLINK _IOW('T', 205, int)
45#define TUNSETGROUP _IOW('T', 206, int)
46#define TUNGETFEATURES _IOR('T', 207, unsigned int)
47#define TUNSETOFFLOAD _IOW('T', 208, unsigned int)
48#define TUNSETTXFILTER _IOW('T', 209, unsigned int)
49#define TUNGETIFF _IOR('T', 210, unsigned int)
50#define TUNGETSNDBUF _IOR('T', 211, int)
51#define TUNSETSNDBUF _IOW('T', 212, int)
52#define TUNATTACHFILTER _IOW('T', 213, struct sock_fprog)
53#define TUNDETACHFILTER _IOW('T', 214, struct sock_fprog)
54#define TUNGETVNETHDRSZ _IOR('T', 215, int)
55#define TUNSETVNETHDRSZ _IOW('T', 216, int)
56
57/* TUNSETIFF ifr flags */
58#define IFF_TUN 0x0001
59#define IFF_TAP 0x0002
60#define IFF_NO_PI 0x1000
61#define IFF_ONE_QUEUE 0x2000
62#define IFF_VNET_HDR 0x4000
63#define IFF_TUN_EXCL 0x8000
64
65/* Features for GSO (TUNSETOFFLOAD). */
66#define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */
67#define TUN_F_TSO4 0x02 /* I can handle TSO for IPv4 packets */
68#define TUN_F_TSO6 0x04 /* I can handle TSO for IPv6 packets */
69#define TUN_F_TSO_ECN 0x08 /* I can handle TSO with ECN bits. */
70#define TUN_F_UFO 0x10 /* I can handle UFO packets */
71
72/* Protocol info prepended to the packets (when IFF_NO_PI is not set) */
73#define TUN_PKT_STRIP 0x0001
74struct tun_pi {
75 __u16 flags;
76 __be16 proto;
77};
78
79/*
80 * Filter spec (used for SETXXFILTER ioctls)
81 * This stuff is applicable only to the TAP (Ethernet) devices.
82 * If the count is zero the filter is disabled and the driver accepts
83 * all packets (promisc mode).
84 * If the filter is enabled in order to accept broadcast packets
85 * broadcast addr must be explicitly included in the addr list.
86 */
87#define TUN_FLT_ALLMULTI 0x0001 /* Accept all multicast packets */
88struct tun_filter {
89 __u16 flags; /* TUN_FLT_ flags see above */
90 __u16 count; /* Number of addresses */
91 __u8 addr[0][ETH_ALEN];
92};
93
94#endif /* _UAPI__IF_TUN_H */
diff --git a/include/uapi/linux/if_tunnel.h b/include/uapi/linux/if_tunnel.h
new file mode 100644
index 000000000000..5db5942575fe
--- /dev/null
+++ b/include/uapi/linux/if_tunnel.h
@@ -0,0 +1,96 @@
1#ifndef _UAPI_IF_TUNNEL_H_
2#define _UAPI_IF_TUNNEL_H_
3
4#include <linux/types.h>
5#include <asm/byteorder.h>
6
7
8#define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0)
9#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1)
10#define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2)
11#define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3)
12#define SIOCGETPRL (SIOCDEVPRIVATE + 4)
13#define SIOCADDPRL (SIOCDEVPRIVATE + 5)
14#define SIOCDELPRL (SIOCDEVPRIVATE + 6)
15#define SIOCCHGPRL (SIOCDEVPRIVATE + 7)
16#define SIOCGET6RD (SIOCDEVPRIVATE + 8)
17#define SIOCADD6RD (SIOCDEVPRIVATE + 9)
18#define SIOCDEL6RD (SIOCDEVPRIVATE + 10)
19#define SIOCCHG6RD (SIOCDEVPRIVATE + 11)
20
21#define GRE_CSUM __cpu_to_be16(0x8000)
22#define GRE_ROUTING __cpu_to_be16(0x4000)
23#define GRE_KEY __cpu_to_be16(0x2000)
24#define GRE_SEQ __cpu_to_be16(0x1000)
25#define GRE_STRICT __cpu_to_be16(0x0800)
26#define GRE_REC __cpu_to_be16(0x0700)
27#define GRE_FLAGS __cpu_to_be16(0x00F8)
28#define GRE_VERSION __cpu_to_be16(0x0007)
29
30struct ip_tunnel_parm {
31 char name[IFNAMSIZ];
32 int link;
33 __be16 i_flags;
34 __be16 o_flags;
35 __be32 i_key;
36 __be32 o_key;
37 struct iphdr iph;
38};
39
40/* SIT-mode i_flags */
41#define SIT_ISATAP 0x0001
42
43struct ip_tunnel_prl {
44 __be32 addr;
45 __u16 flags;
46 __u16 __reserved;
47 __u32 datalen;
48 __u32 __reserved2;
49 /* data follows */
50};
51
52/* PRL flags */
53#define PRL_DEFAULT 0x0001
54
55struct ip_tunnel_6rd {
56 struct in6_addr prefix;
57 __be32 relay_prefix;
58 __u16 prefixlen;
59 __u16 relay_prefixlen;
60};
61
62enum {
63 IFLA_GRE_UNSPEC,
64 IFLA_GRE_LINK,
65 IFLA_GRE_IFLAGS,
66 IFLA_GRE_OFLAGS,
67 IFLA_GRE_IKEY,
68 IFLA_GRE_OKEY,
69 IFLA_GRE_LOCAL,
70 IFLA_GRE_REMOTE,
71 IFLA_GRE_TTL,
72 IFLA_GRE_TOS,
73 IFLA_GRE_PMTUDISC,
74 IFLA_GRE_ENCAP_LIMIT,
75 IFLA_GRE_FLOWINFO,
76 IFLA_GRE_FLAGS,
77 __IFLA_GRE_MAX,
78};
79
80#define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1)
81
82/* VTI-mode i_flags */
83#define VTI_ISVTI 0x0001
84
85enum {
86 IFLA_VTI_UNSPEC,
87 IFLA_VTI_LINK,
88 IFLA_VTI_IKEY,
89 IFLA_VTI_OKEY,
90 IFLA_VTI_LOCAL,
91 IFLA_VTI_REMOTE,
92 __IFLA_VTI_MAX,
93};
94
95#define IFLA_VTI_MAX (__IFLA_VTI_MAX - 1)
96#endif /* _UAPI_IF_TUNNEL_H_ */
diff --git a/include/uapi/linux/if_vlan.h b/include/uapi/linux/if_vlan.h
new file mode 100644
index 000000000000..0744f8e65d15
--- /dev/null
+++ b/include/uapi/linux/if_vlan.h
@@ -0,0 +1,63 @@
1/*
2 * VLAN An implementation of 802.1Q VLAN tagging.
3 *
4 * Authors: Ben Greear <greearb@candelatech.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 */
12
13#ifndef _UAPI_LINUX_IF_VLAN_H_
14#define _UAPI_LINUX_IF_VLAN_H_
15
16
17/* VLAN IOCTLs are found in sockios.h */
18
19/* Passed in vlan_ioctl_args structure to determine behaviour. */
20enum vlan_ioctl_cmds {
21 ADD_VLAN_CMD,
22 DEL_VLAN_CMD,
23 SET_VLAN_INGRESS_PRIORITY_CMD,
24 SET_VLAN_EGRESS_PRIORITY_CMD,
25 GET_VLAN_INGRESS_PRIORITY_CMD,
26 GET_VLAN_EGRESS_PRIORITY_CMD,
27 SET_VLAN_NAME_TYPE_CMD,
28 SET_VLAN_FLAG_CMD,
29 GET_VLAN_REALDEV_NAME_CMD, /* If this works, you know it's a VLAN device, btw */
30 GET_VLAN_VID_CMD /* Get the VID of this VLAN (specified by name) */
31};
32
33enum vlan_flags {
34 VLAN_FLAG_REORDER_HDR = 0x1,
35 VLAN_FLAG_GVRP = 0x2,
36 VLAN_FLAG_LOOSE_BINDING = 0x4,
37};
38
39enum vlan_name_types {
40 VLAN_NAME_TYPE_PLUS_VID, /* Name will look like: vlan0005 */
41 VLAN_NAME_TYPE_RAW_PLUS_VID, /* name will look like: eth1.0005 */
42 VLAN_NAME_TYPE_PLUS_VID_NO_PAD, /* Name will look like: vlan5 */
43 VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD, /* Name will look like: eth0.5 */
44 VLAN_NAME_TYPE_HIGHEST
45};
46
47struct vlan_ioctl_args {
48 int cmd; /* Should be one of the vlan_ioctl_cmds enum above. */
49 char device1[24];
50
51 union {
52 char device2[24];
53 int VID;
54 unsigned int skb_priority;
55 unsigned int name_type;
56 unsigned int bind_type;
57 unsigned int flag; /* Matches vlan_dev_priv flags */
58 } u;
59
60 short vlan_qos;
61};
62
63#endif /* _UAPI_LINUX_IF_VLAN_H_ */
diff --git a/include/linux/if_x25.h b/include/uapi/linux/if_x25.h
index 897765f5feb8..897765f5feb8 100644
--- a/include/linux/if_x25.h
+++ b/include/uapi/linux/if_x25.h
diff --git a/include/uapi/linux/igmp.h b/include/uapi/linux/igmp.h
new file mode 100644
index 000000000000..ccbb32aa6704
--- /dev/null
+++ b/include/uapi/linux/igmp.h
@@ -0,0 +1,128 @@
1/*
2 * Linux NET3: Internet Group Management Protocol [IGMP]
3 *
4 * Authors:
5 * Alan Cox <alan@lxorguk.ukuu.org.uk>
6 *
7 * Extended to talk the BSD extended IGMP protocol of mrouted 3.6
8 *
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15
16#ifndef _UAPI_LINUX_IGMP_H
17#define _UAPI_LINUX_IGMP_H
18
19#include <linux/types.h>
20#include <asm/byteorder.h>
21
22/*
23 * IGMP protocol structures
24 */
25
26/*
27 * Header in on cable format
28 */
29
30struct igmphdr {
31 __u8 type;
32 __u8 code; /* For newer IGMP */
33 __sum16 csum;
34 __be32 group;
35};
36
37/* V3 group record types [grec_type] */
38#define IGMPV3_MODE_IS_INCLUDE 1
39#define IGMPV3_MODE_IS_EXCLUDE 2
40#define IGMPV3_CHANGE_TO_INCLUDE 3
41#define IGMPV3_CHANGE_TO_EXCLUDE 4
42#define IGMPV3_ALLOW_NEW_SOURCES 5
43#define IGMPV3_BLOCK_OLD_SOURCES 6
44
45struct igmpv3_grec {
46 __u8 grec_type;
47 __u8 grec_auxwords;
48 __be16 grec_nsrcs;
49 __be32 grec_mca;
50 __be32 grec_src[0];
51};
52
53struct igmpv3_report {
54 __u8 type;
55 __u8 resv1;
56 __be16 csum;
57 __be16 resv2;
58 __be16 ngrec;
59 struct igmpv3_grec grec[0];
60};
61
62struct igmpv3_query {
63 __u8 type;
64 __u8 code;
65 __be16 csum;
66 __be32 group;
67#if defined(__LITTLE_ENDIAN_BITFIELD)
68 __u8 qrv:3,
69 suppress:1,
70 resv:4;
71#elif defined(__BIG_ENDIAN_BITFIELD)
72 __u8 resv:4,
73 suppress:1,
74 qrv:3;
75#else
76#error "Please fix <asm/byteorder.h>"
77#endif
78 __u8 qqic;
79 __be16 nsrcs;
80 __be32 srcs[0];
81};
82
83#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */
84#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */
85#define IGMP_DVMRP 0x13 /* DVMRP routing */
86#define IGMP_PIM 0x14 /* PIM routing */
87#define IGMP_TRACE 0x15
88#define IGMPV2_HOST_MEMBERSHIP_REPORT 0x16 /* V2 version of 0x12 */
89#define IGMP_HOST_LEAVE_MESSAGE 0x17
90#define IGMPV3_HOST_MEMBERSHIP_REPORT 0x22 /* V3 version of 0x12 */
91
92#define IGMP_MTRACE_RESP 0x1e
93#define IGMP_MTRACE 0x1f
94
95
96/*
97 * Use the BSD names for these for compatibility
98 */
99
100#define IGMP_DELAYING_MEMBER 0x01
101#define IGMP_IDLE_MEMBER 0x02
102#define IGMP_LAZY_MEMBER 0x03
103#define IGMP_SLEEPING_MEMBER 0x04
104#define IGMP_AWAKENING_MEMBER 0x05
105
106#define IGMP_MINLEN 8
107
108#define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */
109 /* query (in seconds) */
110
111#define IGMP_TIMER_SCALE 10 /* denotes that the igmphdr->timer field */
112 /* specifies time in 10th of seconds */
113
114#define IGMP_AGE_THRESHOLD 400 /* If this host don't hear any IGMP V1 */
115 /* message in this period of time, */
116 /* revert to IGMP v2 router. */
117
118#define IGMP_ALL_HOSTS htonl(0xE0000001L)
119#define IGMP_ALL_ROUTER htonl(0xE0000002L)
120#define IGMPV3_ALL_MCR htonl(0xE0000016L)
121#define IGMP_LOCAL_GROUP htonl(0xE0000000L)
122#define IGMP_LOCAL_GROUP_MASK htonl(0xFFFFFF00L)
123
124/*
125 * struct for keeping the multicast list in
126 */
127
128#endif /* _UAPI_LINUX_IGMP_H */
diff --git a/include/uapi/linux/in.h b/include/uapi/linux/in.h
new file mode 100644
index 000000000000..9edb441df827
--- /dev/null
+++ b/include/uapi/linux/in.h
@@ -0,0 +1,253 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions of the Internet Protocol.
7 *
8 * Version: @(#)in.h 1.0.1 04/21/93
9 *
10 * Authors: Original taken from the GNU Project <netinet/in.h> file.
11 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version
16 * 2 of the License, or (at your option) any later version.
17 */
18#ifndef _UAPI_LINUX_IN_H
19#define _UAPI_LINUX_IN_H
20
21#include <linux/types.h>
22#include <linux/socket.h>
23
24/* Standard well-defined IP protocols. */
25enum {
26 IPPROTO_IP = 0, /* Dummy protocol for TCP */
27 IPPROTO_ICMP = 1, /* Internet Control Message Protocol */
28 IPPROTO_IGMP = 2, /* Internet Group Management Protocol */
29 IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94) */
30 IPPROTO_TCP = 6, /* Transmission Control Protocol */
31 IPPROTO_EGP = 8, /* Exterior Gateway Protocol */
32 IPPROTO_PUP = 12, /* PUP protocol */
33 IPPROTO_UDP = 17, /* User Datagram Protocol */
34 IPPROTO_IDP = 22, /* XNS IDP protocol */
35 IPPROTO_DCCP = 33, /* Datagram Congestion Control Protocol */
36 IPPROTO_RSVP = 46, /* RSVP protocol */
37 IPPROTO_GRE = 47, /* Cisco GRE tunnels (rfc 1701,1702) */
38
39 IPPROTO_IPV6 = 41, /* IPv6-in-IPv4 tunnelling */
40
41 IPPROTO_ESP = 50, /* Encapsulation Security Payload protocol */
42 IPPROTO_AH = 51, /* Authentication Header protocol */
43 IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET */
44 IPPROTO_PIM = 103, /* Protocol Independent Multicast */
45
46 IPPROTO_COMP = 108, /* Compression Header protocol */
47 IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */
48 IPPROTO_UDPLITE = 136, /* UDP-Lite (RFC 3828) */
49
50 IPPROTO_RAW = 255, /* Raw IP packets */
51 IPPROTO_MAX
52};
53
54
55/* Internet address. */
56struct in_addr {
57 __be32 s_addr;
58};
59
60#define IP_TOS 1
61#define IP_TTL 2
62#define IP_HDRINCL 3
63#define IP_OPTIONS 4
64#define IP_ROUTER_ALERT 5
65#define IP_RECVOPTS 6
66#define IP_RETOPTS 7
67#define IP_PKTINFO 8
68#define IP_PKTOPTIONS 9
69#define IP_MTU_DISCOVER 10
70#define IP_RECVERR 11
71#define IP_RECVTTL 12
72#define IP_RECVTOS 13
73#define IP_MTU 14
74#define IP_FREEBIND 15
75#define IP_IPSEC_POLICY 16
76#define IP_XFRM_POLICY 17
77#define IP_PASSSEC 18
78#define IP_TRANSPARENT 19
79
80/* BSD compatibility */
81#define IP_RECVRETOPTS IP_RETOPTS
82
83/* TProxy original addresses */
84#define IP_ORIGDSTADDR 20
85#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
86
87#define IP_MINTTL 21
88#define IP_NODEFRAG 22
89
90/* IP_MTU_DISCOVER values */
91#define IP_PMTUDISC_DONT 0 /* Never send DF frames */
92#define IP_PMTUDISC_WANT 1 /* Use per route hints */
93#define IP_PMTUDISC_DO 2 /* Always DF */
94#define IP_PMTUDISC_PROBE 3 /* Ignore dst pmtu */
95
96#define IP_MULTICAST_IF 32
97#define IP_MULTICAST_TTL 33
98#define IP_MULTICAST_LOOP 34
99#define IP_ADD_MEMBERSHIP 35
100#define IP_DROP_MEMBERSHIP 36
101#define IP_UNBLOCK_SOURCE 37
102#define IP_BLOCK_SOURCE 38
103#define IP_ADD_SOURCE_MEMBERSHIP 39
104#define IP_DROP_SOURCE_MEMBERSHIP 40
105#define IP_MSFILTER 41
106#define MCAST_JOIN_GROUP 42
107#define MCAST_BLOCK_SOURCE 43
108#define MCAST_UNBLOCK_SOURCE 44
109#define MCAST_LEAVE_GROUP 45
110#define MCAST_JOIN_SOURCE_GROUP 46
111#define MCAST_LEAVE_SOURCE_GROUP 47
112#define MCAST_MSFILTER 48
113#define IP_MULTICAST_ALL 49
114#define IP_UNICAST_IF 50
115
116#define MCAST_EXCLUDE 0
117#define MCAST_INCLUDE 1
118
119/* These need to appear somewhere around here */
120#define IP_DEFAULT_MULTICAST_TTL 1
121#define IP_DEFAULT_MULTICAST_LOOP 1
122
123/* Request struct for multicast socket ops */
124
125struct ip_mreq {
126 struct in_addr imr_multiaddr; /* IP multicast address of group */
127 struct in_addr imr_interface; /* local IP address of interface */
128};
129
130struct ip_mreqn {
131 struct in_addr imr_multiaddr; /* IP multicast address of group */
132 struct in_addr imr_address; /* local IP address of interface */
133 int imr_ifindex; /* Interface index */
134};
135
136struct ip_mreq_source {
137 __be32 imr_multiaddr;
138 __be32 imr_interface;
139 __be32 imr_sourceaddr;
140};
141
142struct ip_msfilter {
143 __be32 imsf_multiaddr;
144 __be32 imsf_interface;
145 __u32 imsf_fmode;
146 __u32 imsf_numsrc;
147 __be32 imsf_slist[1];
148};
149
150#define IP_MSFILTER_SIZE(numsrc) \
151 (sizeof(struct ip_msfilter) - sizeof(__u32) \
152 + (numsrc) * sizeof(__u32))
153
154struct group_req {
155 __u32 gr_interface; /* interface index */
156 struct __kernel_sockaddr_storage gr_group; /* group address */
157};
158
159struct group_source_req {
160 __u32 gsr_interface; /* interface index */
161 struct __kernel_sockaddr_storage gsr_group; /* group address */
162 struct __kernel_sockaddr_storage gsr_source; /* source address */
163};
164
165struct group_filter {
166 __u32 gf_interface; /* interface index */
167 struct __kernel_sockaddr_storage gf_group; /* multicast address */
168 __u32 gf_fmode; /* filter mode */
169 __u32 gf_numsrc; /* number of sources */
170 struct __kernel_sockaddr_storage gf_slist[1]; /* interface index */
171};
172
173#define GROUP_FILTER_SIZE(numsrc) \
174 (sizeof(struct group_filter) - sizeof(struct __kernel_sockaddr_storage) \
175 + (numsrc) * sizeof(struct __kernel_sockaddr_storage))
176
177struct in_pktinfo {
178 int ipi_ifindex;
179 struct in_addr ipi_spec_dst;
180 struct in_addr ipi_addr;
181};
182
183/* Structure describing an Internet (IP) socket address. */
184#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */
185struct sockaddr_in {
186 __kernel_sa_family_t sin_family; /* Address family */
187 __be16 sin_port; /* Port number */
188 struct in_addr sin_addr; /* Internet address */
189
190 /* Pad to size of `struct sockaddr'. */
191 unsigned char __pad[__SOCK_SIZE__ - sizeof(short int) -
192 sizeof(unsigned short int) - sizeof(struct in_addr)];
193};
194#define sin_zero __pad /* for BSD UNIX comp. -FvK */
195
196
197/*
198 * Definitions of the bits in an Internet address integer.
199 * On subnets, host and network parts are found according
200 * to the subnet mask, not these masks.
201 */
202#define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0)
203#define IN_CLASSA_NET 0xff000000
204#define IN_CLASSA_NSHIFT 24
205#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET)
206#define IN_CLASSA_MAX 128
207
208#define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000)
209#define IN_CLASSB_NET 0xffff0000
210#define IN_CLASSB_NSHIFT 16
211#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET)
212#define IN_CLASSB_MAX 65536
213
214#define IN_CLASSC(a) ((((long int) (a)) & 0xe0000000) == 0xc0000000)
215#define IN_CLASSC_NET 0xffffff00
216#define IN_CLASSC_NSHIFT 8
217#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET)
218
219#define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000)
220#define IN_MULTICAST(a) IN_CLASSD(a)
221#define IN_MULTICAST_NET 0xF0000000
222
223#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000)
224#define IN_BADCLASS(a) IN_EXPERIMENTAL((a))
225
226/* Address to accept any incoming messages. */
227#define INADDR_ANY ((unsigned long int) 0x00000000)
228
229/* Address to send to all hosts. */
230#define INADDR_BROADCAST ((unsigned long int) 0xffffffff)
231
232/* Address indicating an error return. */
233#define INADDR_NONE ((unsigned long int) 0xffffffff)
234
235/* Network number for local host loopback. */
236#define IN_LOOPBACKNET 127
237
238/* Address to loopback in software to local host. */
239#define INADDR_LOOPBACK 0x7f000001 /* 127.0.0.1 */
240#define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000)
241
242/* Defines for Multicast INADDR */
243#define INADDR_UNSPEC_GROUP 0xe0000000U /* 224.0.0.0 */
244#define INADDR_ALLHOSTS_GROUP 0xe0000001U /* 224.0.0.1 */
245#define INADDR_ALLRTRS_GROUP 0xe0000002U /* 224.0.0.2 */
246#define INADDR_MAX_LOCAL_GROUP 0xe00000ffU /* 224.0.0.255 */
247
248
249/* <asm/byteorder.h> contains the htonl type stuff.. */
250#include <asm/byteorder.h>
251
252
253#endif /* _UAPI_LINUX_IN_H */
diff --git a/include/uapi/linux/in6.h b/include/uapi/linux/in6.h
new file mode 100644
index 000000000000..1e3159989958
--- /dev/null
+++ b/include/uapi/linux/in6.h
@@ -0,0 +1,279 @@
1/*
2 * Types and definitions for AF_INET6
3 * Linux INET6 implementation
4 *
5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt>
7 *
8 * Sources:
9 * IPv6 Program Interfaces for BSD Systems
10 * <draft-ietf-ipngwg-bsd-api-05.txt>
11 *
12 * Advanced Sockets API for IPv6
13 * <draft-stevens-advanced-api-00.txt>
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version.
19 */
20
21#ifndef _UAPI_LINUX_IN6_H
22#define _UAPI_LINUX_IN6_H
23
24#include <linux/types.h>
25
26/*
27 * IPv6 address structure
28 */
29
30struct in6_addr {
31 union {
32 __u8 u6_addr8[16];
33 __be16 u6_addr16[8];
34 __be32 u6_addr32[4];
35 } in6_u;
36#define s6_addr in6_u.u6_addr8
37#define s6_addr16 in6_u.u6_addr16
38#define s6_addr32 in6_u.u6_addr32
39};
40
41/* IPv6 Wildcard Address (::) and Loopback Address (::1) defined in RFC2553
42 * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined
43 * in network byte order, not in host byte order as are the IPv4 equivalents
44 */
45
46struct sockaddr_in6 {
47 unsigned short int sin6_family; /* AF_INET6 */
48 __be16 sin6_port; /* Transport layer port # */
49 __be32 sin6_flowinfo; /* IPv6 flow information */
50 struct in6_addr sin6_addr; /* IPv6 address */
51 __u32 sin6_scope_id; /* scope id (new in RFC2553) */
52};
53
54struct ipv6_mreq {
55 /* IPv6 multicast address of group */
56 struct in6_addr ipv6mr_multiaddr;
57
58 /* local IPv6 address of interface */
59 int ipv6mr_ifindex;
60};
61
62#define ipv6mr_acaddr ipv6mr_multiaddr
63
64struct in6_flowlabel_req {
65 struct in6_addr flr_dst;
66 __be32 flr_label;
67 __u8 flr_action;
68 __u8 flr_share;
69 __u16 flr_flags;
70 __u16 flr_expires;
71 __u16 flr_linger;
72 __u32 __flr_pad;
73 /* Options in format of IPV6_PKTOPTIONS */
74};
75
76#define IPV6_FL_A_GET 0
77#define IPV6_FL_A_PUT 1
78#define IPV6_FL_A_RENEW 2
79
80#define IPV6_FL_F_CREATE 1
81#define IPV6_FL_F_EXCL 2
82
83#define IPV6_FL_S_NONE 0
84#define IPV6_FL_S_EXCL 1
85#define IPV6_FL_S_PROCESS 2
86#define IPV6_FL_S_USER 3
87#define IPV6_FL_S_ANY 255
88
89
90/*
91 * Bitmask constant declarations to help applications select out the
92 * flow label and priority fields.
93 *
94 * Note that this are in host byte order while the flowinfo field of
95 * sockaddr_in6 is in network byte order.
96 */
97
98#define IPV6_FLOWINFO_FLOWLABEL 0x000fffff
99#define IPV6_FLOWINFO_PRIORITY 0x0ff00000
100
101/* These definitions are obsolete */
102#define IPV6_PRIORITY_UNCHARACTERIZED 0x0000
103#define IPV6_PRIORITY_FILLER 0x0100
104#define IPV6_PRIORITY_UNATTENDED 0x0200
105#define IPV6_PRIORITY_RESERVED1 0x0300
106#define IPV6_PRIORITY_BULK 0x0400
107#define IPV6_PRIORITY_RESERVED2 0x0500
108#define IPV6_PRIORITY_INTERACTIVE 0x0600
109#define IPV6_PRIORITY_CONTROL 0x0700
110#define IPV6_PRIORITY_8 0x0800
111#define IPV6_PRIORITY_9 0x0900
112#define IPV6_PRIORITY_10 0x0a00
113#define IPV6_PRIORITY_11 0x0b00
114#define IPV6_PRIORITY_12 0x0c00
115#define IPV6_PRIORITY_13 0x0d00
116#define IPV6_PRIORITY_14 0x0e00
117#define IPV6_PRIORITY_15 0x0f00
118
119/*
120 * IPV6 extension headers
121 */
122#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */
123#define IPPROTO_ROUTING 43 /* IPv6 routing header */
124#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */
125#define IPPROTO_ICMPV6 58 /* ICMPv6 */
126#define IPPROTO_NONE 59 /* IPv6 no next header */
127#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */
128#define IPPROTO_MH 135 /* IPv6 mobility header */
129
130/*
131 * IPv6 TLV options.
132 */
133#define IPV6_TLV_PAD1 0
134#define IPV6_TLV_PADN 1
135#define IPV6_TLV_ROUTERALERT 5
136#define IPV6_TLV_JUMBO 194
137#define IPV6_TLV_HAO 201 /* home address option */
138
139/*
140 * IPV6 socket options
141 */
142
143#define IPV6_ADDRFORM 1
144#define IPV6_2292PKTINFO 2
145#define IPV6_2292HOPOPTS 3
146#define IPV6_2292DSTOPTS 4
147#define IPV6_2292RTHDR 5
148#define IPV6_2292PKTOPTIONS 6
149#define IPV6_CHECKSUM 7
150#define IPV6_2292HOPLIMIT 8
151#define IPV6_NEXTHOP 9
152#define IPV6_AUTHHDR 10 /* obsolete */
153#define IPV6_FLOWINFO 11
154
155#define IPV6_UNICAST_HOPS 16
156#define IPV6_MULTICAST_IF 17
157#define IPV6_MULTICAST_HOPS 18
158#define IPV6_MULTICAST_LOOP 19
159#define IPV6_ADD_MEMBERSHIP 20
160#define IPV6_DROP_MEMBERSHIP 21
161#define IPV6_ROUTER_ALERT 22
162#define IPV6_MTU_DISCOVER 23
163#define IPV6_MTU 24
164#define IPV6_RECVERR 25
165#define IPV6_V6ONLY 26
166#define IPV6_JOIN_ANYCAST 27
167#define IPV6_LEAVE_ANYCAST 28
168
169/* IPV6_MTU_DISCOVER values */
170#define IPV6_PMTUDISC_DONT 0
171#define IPV6_PMTUDISC_WANT 1
172#define IPV6_PMTUDISC_DO 2
173#define IPV6_PMTUDISC_PROBE 3
174
175/* Flowlabel */
176#define IPV6_FLOWLABEL_MGR 32
177#define IPV6_FLOWINFO_SEND 33
178
179#define IPV6_IPSEC_POLICY 34
180#define IPV6_XFRM_POLICY 35
181
182/*
183 * Multicast:
184 * Following socket options are shared between IPv4 and IPv6.
185 *
186 * MCAST_JOIN_GROUP 42
187 * MCAST_BLOCK_SOURCE 43
188 * MCAST_UNBLOCK_SOURCE 44
189 * MCAST_LEAVE_GROUP 45
190 * MCAST_JOIN_SOURCE_GROUP 46
191 * MCAST_LEAVE_SOURCE_GROUP 47
192 * MCAST_MSFILTER 48
193 */
194
195/*
196 * Advanced API (RFC3542) (1)
197 *
198 * Note: IPV6_RECVRTHDRDSTOPTS does not exist. see net/ipv6/datagram.c.
199 */
200
201#define IPV6_RECVPKTINFO 49
202#define IPV6_PKTINFO 50
203#define IPV6_RECVHOPLIMIT 51
204#define IPV6_HOPLIMIT 52
205#define IPV6_RECVHOPOPTS 53
206#define IPV6_HOPOPTS 54
207#define IPV6_RTHDRDSTOPTS 55
208#define IPV6_RECVRTHDR 56
209#define IPV6_RTHDR 57
210#define IPV6_RECVDSTOPTS 58
211#define IPV6_DSTOPTS 59
212#define IPV6_RECVPATHMTU 60
213#define IPV6_PATHMTU 61
214#define IPV6_DONTFRAG 62
215#if 0 /* not yet */
216#define IPV6_USE_MIN_MTU 63
217#endif
218
219/*
220 * Netfilter (1)
221 *
222 * Following socket options are used in ip6_tables;
223 * see include/linux/netfilter_ipv6/ip6_tables.h.
224 *
225 * IP6T_SO_SET_REPLACE / IP6T_SO_GET_INFO 64
226 * IP6T_SO_SET_ADD_COUNTERS / IP6T_SO_GET_ENTRIES 65
227 */
228
229/*
230 * Advanced API (RFC3542) (2)
231 */
232#define IPV6_RECVTCLASS 66
233#define IPV6_TCLASS 67
234
235/*
236 * Netfilter (2)
237 *
238 * Following socket options are used in ip6_tables;
239 * see include/linux/netfilter_ipv6/ip6_tables.h.
240 *
241 * IP6T_SO_GET_REVISION_MATCH 68
242 * IP6T_SO_GET_REVISION_TARGET 69
243 */
244
245/* RFC5014: Source address selection */
246#define IPV6_ADDR_PREFERENCES 72
247
248#define IPV6_PREFER_SRC_TMP 0x0001
249#define IPV6_PREFER_SRC_PUBLIC 0x0002
250#define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100
251#define IPV6_PREFER_SRC_COA 0x0004
252#define IPV6_PREFER_SRC_HOME 0x0400
253#define IPV6_PREFER_SRC_CGA 0x0008
254#define IPV6_PREFER_SRC_NONCGA 0x0800
255
256/* RFC5082: Generalized Ttl Security Mechanism */
257#define IPV6_MINHOPCOUNT 73
258
259#define IPV6_ORIGDSTADDR 74
260#define IPV6_RECVORIGDSTADDR IPV6_ORIGDSTADDR
261#define IPV6_TRANSPARENT 75
262#define IPV6_UNICAST_IF 76
263
264/*
265 * Multicast Routing:
266 * see include/linux/mroute6.h.
267 *
268 * MRT6_INIT 200
269 * MRT6_DONE 201
270 * MRT6_ADD_MIF 202
271 * MRT6_DEL_MIF 203
272 * MRT6_ADD_MFC 204
273 * MRT6_DEL_MFC 205
274 * MRT6_VERSION 206
275 * MRT6_ASSERT 207
276 * MRT6_PIM 208
277 * (reserved) 209
278 */
279#endif /* _UAPI_LINUX_IN6_H */
diff --git a/include/linux/in_route.h b/include/uapi/linux/in_route.h
index b261b8c915f0..b261b8c915f0 100644
--- a/include/linux/in_route.h
+++ b/include/uapi/linux/in_route.h
diff --git a/include/uapi/linux/inet_diag.h b/include/uapi/linux/inet_diag.h
new file mode 100644
index 000000000000..8c469af939aa
--- /dev/null
+++ b/include/uapi/linux/inet_diag.h
@@ -0,0 +1,136 @@
1#ifndef _UAPI_INET_DIAG_H_
2#define _UAPI_INET_DIAG_H_
3
4#include <linux/types.h>
5
6/* Just some random number */
7#define TCPDIAG_GETSOCK 18
8#define DCCPDIAG_GETSOCK 19
9
10#define INET_DIAG_GETSOCK_MAX 24
11
12/* Socket identity */
13struct inet_diag_sockid {
14 __be16 idiag_sport;
15 __be16 idiag_dport;
16 __be32 idiag_src[4];
17 __be32 idiag_dst[4];
18 __u32 idiag_if;
19 __u32 idiag_cookie[2];
20#define INET_DIAG_NOCOOKIE (~0U)
21};
22
23/* Request structure */
24
25struct inet_diag_req {
26 __u8 idiag_family; /* Family of addresses. */
27 __u8 idiag_src_len;
28 __u8 idiag_dst_len;
29 __u8 idiag_ext; /* Query extended information */
30
31 struct inet_diag_sockid id;
32
33 __u32 idiag_states; /* States to dump */
34 __u32 idiag_dbs; /* Tables to dump (NI) */
35};
36
37struct inet_diag_req_v2 {
38 __u8 sdiag_family;
39 __u8 sdiag_protocol;
40 __u8 idiag_ext;
41 __u8 pad;
42 __u32 idiag_states;
43 struct inet_diag_sockid id;
44};
45
46enum {
47 INET_DIAG_REQ_NONE,
48 INET_DIAG_REQ_BYTECODE,
49};
50
51#define INET_DIAG_REQ_MAX INET_DIAG_REQ_BYTECODE
52
53/* Bytecode is sequence of 4 byte commands followed by variable arguments.
54 * All the commands identified by "code" are conditional jumps forward:
55 * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be
56 * length of the command and its arguments.
57 */
58
59struct inet_diag_bc_op {
60 unsigned char code;
61 unsigned char yes;
62 unsigned short no;
63};
64
65enum {
66 INET_DIAG_BC_NOP,
67 INET_DIAG_BC_JMP,
68 INET_DIAG_BC_S_GE,
69 INET_DIAG_BC_S_LE,
70 INET_DIAG_BC_D_GE,
71 INET_DIAG_BC_D_LE,
72 INET_DIAG_BC_AUTO,
73 INET_DIAG_BC_S_COND,
74 INET_DIAG_BC_D_COND,
75};
76
77struct inet_diag_hostcond {
78 __u8 family;
79 __u8 prefix_len;
80 int port;
81 __be32 addr[0];
82};
83
84/* Base info structure. It contains socket identity (addrs/ports/cookie)
85 * and, alas, the information shown by netstat. */
86struct inet_diag_msg {
87 __u8 idiag_family;
88 __u8 idiag_state;
89 __u8 idiag_timer;
90 __u8 idiag_retrans;
91
92 struct inet_diag_sockid id;
93
94 __u32 idiag_expires;
95 __u32 idiag_rqueue;
96 __u32 idiag_wqueue;
97 __u32 idiag_uid;
98 __u32 idiag_inode;
99};
100
101/* Extensions */
102
103enum {
104 INET_DIAG_NONE,
105 INET_DIAG_MEMINFO,
106 INET_DIAG_INFO,
107 INET_DIAG_VEGASINFO,
108 INET_DIAG_CONG,
109 INET_DIAG_TOS,
110 INET_DIAG_TCLASS,
111 INET_DIAG_SKMEMINFO,
112};
113
114#define INET_DIAG_MAX INET_DIAG_SKMEMINFO
115
116
117/* INET_DIAG_MEM */
118
119struct inet_diag_meminfo {
120 __u32 idiag_rmem;
121 __u32 idiag_wmem;
122 __u32 idiag_fmem;
123 __u32 idiag_tmem;
124};
125
126/* INET_DIAG_VEGASINFO */
127
128struct tcpvegas_info {
129 __u32 tcpv_enabled;
130 __u32 tcpv_rttcnt;
131 __u32 tcpv_rtt;
132 __u32 tcpv_minrtt;
133};
134
135
136#endif /* _UAPI_INET_DIAG_H_ */
diff --git a/include/uapi/linux/inotify.h b/include/uapi/linux/inotify.h
new file mode 100644
index 000000000000..e6bf35b2dd34
--- /dev/null
+++ b/include/uapi/linux/inotify.h
@@ -0,0 +1,74 @@
1/*
2 * Inode based directory notification for Linux
3 *
4 * Copyright (C) 2005 John McCutchan
5 */
6
7#ifndef _UAPI_LINUX_INOTIFY_H
8#define _UAPI_LINUX_INOTIFY_H
9
10/* For O_CLOEXEC and O_NONBLOCK */
11#include <linux/fcntl.h>
12#include <linux/types.h>
13
14/*
15 * struct inotify_event - structure read from the inotify device for each event
16 *
17 * When you are watching a directory, you will receive the filename for events
18 * such as IN_CREATE, IN_DELETE, IN_OPEN, IN_CLOSE, ..., relative to the wd.
19 */
20struct inotify_event {
21 __s32 wd; /* watch descriptor */
22 __u32 mask; /* watch mask */
23 __u32 cookie; /* cookie to synchronize two events */
24 __u32 len; /* length (including nulls) of name */
25 char name[0]; /* stub for possible name */
26};
27
28/* the following are legal, implemented events that user-space can watch for */
29#define IN_ACCESS 0x00000001 /* File was accessed */
30#define IN_MODIFY 0x00000002 /* File was modified */
31#define IN_ATTRIB 0x00000004 /* Metadata changed */
32#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed */
33#define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed */
34#define IN_OPEN 0x00000020 /* File was opened */
35#define IN_MOVED_FROM 0x00000040 /* File was moved from X */
36#define IN_MOVED_TO 0x00000080 /* File was moved to Y */
37#define IN_CREATE 0x00000100 /* Subfile was created */
38#define IN_DELETE 0x00000200 /* Subfile was deleted */
39#define IN_DELETE_SELF 0x00000400 /* Self was deleted */
40#define IN_MOVE_SELF 0x00000800 /* Self was moved */
41
42/* the following are legal events. they are sent as needed to any watch */
43#define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted */
44#define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */
45#define IN_IGNORED 0x00008000 /* File was ignored */
46
47/* helper events */
48#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* close */
49#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */
50
51/* special flags */
52#define IN_ONLYDIR 0x01000000 /* only watch the path if it is a directory */
53#define IN_DONT_FOLLOW 0x02000000 /* don't follow a sym link */
54#define IN_EXCL_UNLINK 0x04000000 /* exclude events on unlinked objects */
55#define IN_MASK_ADD 0x20000000 /* add to the mask of an already existing watch */
56#define IN_ISDIR 0x40000000 /* event occurred against dir */
57#define IN_ONESHOT 0x80000000 /* only send event once */
58
59/*
60 * All of the events - we build the list by hand so that we can add flags in
61 * the future and not break backward compatibility. Apps will get only the
62 * events that they originally wanted. Be sure to add new events here!
63 */
64#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
65 IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \
66 IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \
67 IN_MOVE_SELF)
68
69/* Flags for sys_inotify_init1. */
70#define IN_CLOEXEC O_CLOEXEC
71#define IN_NONBLOCK O_NONBLOCK
72
73
74#endif /* _UAPI_LINUX_INOTIFY_H */
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h
new file mode 100644
index 000000000000..558828590a69
--- /dev/null
+++ b/include/uapi/linux/input.h
@@ -0,0 +1,1153 @@
1/*
2 * Copyright (c) 1999-2002 Vojtech Pavlik
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 as published by
6 * the Free Software Foundation.
7 */
8#ifndef _UAPI_INPUT_H
9#define _UAPI_INPUT_H
10
11
12#ifndef __KERNEL__
13#include <sys/time.h>
14#include <sys/ioctl.h>
15#include <sys/types.h>
16#include <linux/types.h>
17#endif
18
19
20/*
21 * The event structure itself
22 */
23
24struct input_event {
25 struct timeval time;
26 __u16 type;
27 __u16 code;
28 __s32 value;
29};
30
31/*
32 * Protocol version.
33 */
34
35#define EV_VERSION 0x010001
36
37/*
38 * IOCTLs (0x00 - 0x7f)
39 */
40
41struct input_id {
42 __u16 bustype;
43 __u16 vendor;
44 __u16 product;
45 __u16 version;
46};
47
48/**
49 * struct input_absinfo - used by EVIOCGABS/EVIOCSABS ioctls
50 * @value: latest reported value for the axis.
51 * @minimum: specifies minimum value for the axis.
52 * @maximum: specifies maximum value for the axis.
53 * @fuzz: specifies fuzz value that is used to filter noise from
54 * the event stream.
55 * @flat: values that are within this value will be discarded by
56 * joydev interface and reported as 0 instead.
57 * @resolution: specifies resolution for the values reported for
58 * the axis.
59 *
60 * Note that input core does not clamp reported values to the
61 * [minimum, maximum] limits, such task is left to userspace.
62 *
63 * Resolution for main axes (ABS_X, ABS_Y, ABS_Z) is reported in
64 * units per millimeter (units/mm), resolution for rotational axes
65 * (ABS_RX, ABS_RY, ABS_RZ) is reported in units per radian.
66 */
67struct input_absinfo {
68 __s32 value;
69 __s32 minimum;
70 __s32 maximum;
71 __s32 fuzz;
72 __s32 flat;
73 __s32 resolution;
74};
75
76/**
77 * struct input_keymap_entry - used by EVIOCGKEYCODE/EVIOCSKEYCODE ioctls
78 * @scancode: scancode represented in machine-endian form.
79 * @len: length of the scancode that resides in @scancode buffer.
80 * @index: index in the keymap, may be used instead of scancode
81 * @flags: allows to specify how kernel should handle the request. For
82 * example, setting INPUT_KEYMAP_BY_INDEX flag indicates that kernel
83 * should perform lookup in keymap by @index instead of @scancode
84 * @keycode: key code assigned to this scancode
85 *
86 * The structure is used to retrieve and modify keymap data. Users have
87 * option of performing lookup either by @scancode itself or by @index
88 * in keymap entry. EVIOCGKEYCODE will also return scancode or index
89 * (depending on which element was used to perform lookup).
90 */
91struct input_keymap_entry {
92#define INPUT_KEYMAP_BY_INDEX (1 << 0)
93 __u8 flags;
94 __u8 len;
95 __u16 index;
96 __u32 keycode;
97 __u8 scancode[32];
98};
99
100#define EVIOCGVERSION _IOR('E', 0x01, int) /* get driver version */
101#define EVIOCGID _IOR('E', 0x02, struct input_id) /* get device ID */
102#define EVIOCGREP _IOR('E', 0x03, unsigned int[2]) /* get repeat settings */
103#define EVIOCSREP _IOW('E', 0x03, unsigned int[2]) /* set repeat settings */
104
105#define EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2]) /* get keycode */
106#define EVIOCGKEYCODE_V2 _IOR('E', 0x04, struct input_keymap_entry)
107#define EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2]) /* set keycode */
108#define EVIOCSKEYCODE_V2 _IOW('E', 0x04, struct input_keymap_entry)
109
110#define EVIOCGNAME(len) _IOC(_IOC_READ, 'E', 0x06, len) /* get device name */
111#define EVIOCGPHYS(len) _IOC(_IOC_READ, 'E', 0x07, len) /* get physical location */
112#define EVIOCGUNIQ(len) _IOC(_IOC_READ, 'E', 0x08, len) /* get unique identifier */
113#define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len) /* get device properties */
114
115/**
116 * EVIOCGMTSLOTS(len) - get MT slot values
117 * @len: size of the data buffer in bytes
118 *
119 * The ioctl buffer argument should be binary equivalent to
120 *
121 * struct input_mt_request_layout {
122 * __u32 code;
123 * __s32 values[num_slots];
124 * };
125 *
126 * where num_slots is the (arbitrary) number of MT slots to extract.
127 *
128 * The ioctl size argument (len) is the size of the buffer, which
129 * should satisfy len = (num_slots + 1) * sizeof(__s32). If len is
130 * too small to fit all available slots, the first num_slots are
131 * returned.
132 *
133 * Before the call, code is set to the wanted ABS_MT event type. On
134 * return, values[] is filled with the slot values for the specified
135 * ABS_MT code.
136 *
137 * If the request code is not an ABS_MT value, -EINVAL is returned.
138 */
139#define EVIOCGMTSLOTS(len) _IOC(_IOC_READ, 'E', 0x0a, len)
140
141#define EVIOCGKEY(len) _IOC(_IOC_READ, 'E', 0x18, len) /* get global key state */
142#define EVIOCGLED(len) _IOC(_IOC_READ, 'E', 0x19, len) /* get all LEDs */
143#define EVIOCGSND(len) _IOC(_IOC_READ, 'E', 0x1a, len) /* get all sounds status */
144#define EVIOCGSW(len) _IOC(_IOC_READ, 'E', 0x1b, len) /* get all switch states */
145
146#define EVIOCGBIT(ev,len) _IOC(_IOC_READ, 'E', 0x20 + (ev), len) /* get event bits */
147#define EVIOCGABS(abs) _IOR('E', 0x40 + (abs), struct input_absinfo) /* get abs value/limits */
148#define EVIOCSABS(abs) _IOW('E', 0xc0 + (abs), struct input_absinfo) /* set abs value/limits */
149
150#define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect)) /* send a force effect to a force feedback device */
151#define EVIOCRMFF _IOW('E', 0x81, int) /* Erase a force effect */
152#define EVIOCGEFFECTS _IOR('E', 0x84, int) /* Report number of effects playable at the same time */
153
154#define EVIOCGRAB _IOW('E', 0x90, int) /* Grab/Release device */
155
156#define EVIOCSCLOCKID _IOW('E', 0xa0, int) /* Set clockid to be used for timestamps */
157
158/*
159 * Device properties and quirks
160 */
161
162#define INPUT_PROP_POINTER 0x00 /* needs a pointer */
163#define INPUT_PROP_DIRECT 0x01 /* direct input devices */
164#define INPUT_PROP_BUTTONPAD 0x02 /* has button(s) under pad */
165#define INPUT_PROP_SEMI_MT 0x03 /* touch rectangle only */
166
167#define INPUT_PROP_MAX 0x1f
168#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
169
170/*
171 * Event types
172 */
173
174#define EV_SYN 0x00
175#define EV_KEY 0x01
176#define EV_REL 0x02
177#define EV_ABS 0x03
178#define EV_MSC 0x04
179#define EV_SW 0x05
180#define EV_LED 0x11
181#define EV_SND 0x12
182#define EV_REP 0x14
183#define EV_FF 0x15
184#define EV_PWR 0x16
185#define EV_FF_STATUS 0x17
186#define EV_MAX 0x1f
187#define EV_CNT (EV_MAX+1)
188
189/*
190 * Synchronization events.
191 */
192
193#define SYN_REPORT 0
194#define SYN_CONFIG 1
195#define SYN_MT_REPORT 2
196#define SYN_DROPPED 3
197
198/*
199 * Keys and buttons
200 *
201 * Most of the keys/buttons are modeled after USB HUT 1.12
202 * (see http://www.usb.org/developers/hidpage).
203 * Abbreviations in the comments:
204 * AC - Application Control
205 * AL - Application Launch Button
206 * SC - System Control
207 */
208
209#define KEY_RESERVED 0
210#define KEY_ESC 1
211#define KEY_1 2
212#define KEY_2 3
213#define KEY_3 4
214#define KEY_4 5
215#define KEY_5 6
216#define KEY_6 7
217#define KEY_7 8
218#define KEY_8 9
219#define KEY_9 10
220#define KEY_0 11
221#define KEY_MINUS 12
222#define KEY_EQUAL 13
223#define KEY_BACKSPACE 14
224#define KEY_TAB 15
225#define KEY_Q 16
226#define KEY_W 17
227#define KEY_E 18
228#define KEY_R 19
229#define KEY_T 20
230#define KEY_Y 21
231#define KEY_U 22
232#define KEY_I 23
233#define KEY_O 24
234#define KEY_P 25
235#define KEY_LEFTBRACE 26
236#define KEY_RIGHTBRACE 27
237#define KEY_ENTER 28
238#define KEY_LEFTCTRL 29
239#define KEY_A 30
240#define KEY_S 31
241#define KEY_D 32
242#define KEY_F 33
243#define KEY_G 34
244#define KEY_H 35
245#define KEY_J 36
246#define KEY_K 37
247#define KEY_L 38
248#define KEY_SEMICOLON 39
249#define KEY_APOSTROPHE 40
250#define KEY_GRAVE 41
251#define KEY_LEFTSHIFT 42
252#define KEY_BACKSLASH 43
253#define KEY_Z 44
254#define KEY_X 45
255#define KEY_C 46
256#define KEY_V 47
257#define KEY_B 48
258#define KEY_N 49
259#define KEY_M 50
260#define KEY_COMMA 51
261#define KEY_DOT 52
262#define KEY_SLASH 53
263#define KEY_RIGHTSHIFT 54
264#define KEY_KPASTERISK 55
265#define KEY_LEFTALT 56
266#define KEY_SPACE 57
267#define KEY_CAPSLOCK 58
268#define KEY_F1 59
269#define KEY_F2 60
270#define KEY_F3 61
271#define KEY_F4 62
272#define KEY_F5 63
273#define KEY_F6 64
274#define KEY_F7 65
275#define KEY_F8 66
276#define KEY_F9 67
277#define KEY_F10 68
278#define KEY_NUMLOCK 69
279#define KEY_SCROLLLOCK 70
280#define KEY_KP7 71
281#define KEY_KP8 72
282#define KEY_KP9 73
283#define KEY_KPMINUS 74
284#define KEY_KP4 75
285#define KEY_KP5 76
286#define KEY_KP6 77
287#define KEY_KPPLUS 78
288#define KEY_KP1 79
289#define KEY_KP2 80
290#define KEY_KP3 81
291#define KEY_KP0 82
292#define KEY_KPDOT 83
293
294#define KEY_ZENKAKUHANKAKU 85
295#define KEY_102ND 86
296#define KEY_F11 87
297#define KEY_F12 88
298#define KEY_RO 89
299#define KEY_KATAKANA 90
300#define KEY_HIRAGANA 91
301#define KEY_HENKAN 92
302#define KEY_KATAKANAHIRAGANA 93
303#define KEY_MUHENKAN 94
304#define KEY_KPJPCOMMA 95
305#define KEY_KPENTER 96
306#define KEY_RIGHTCTRL 97
307#define KEY_KPSLASH 98
308#define KEY_SYSRQ 99
309#define KEY_RIGHTALT 100
310#define KEY_LINEFEED 101
311#define KEY_HOME 102
312#define KEY_UP 103
313#define KEY_PAGEUP 104
314#define KEY_LEFT 105
315#define KEY_RIGHT 106
316#define KEY_END 107
317#define KEY_DOWN 108
318#define KEY_PAGEDOWN 109
319#define KEY_INSERT 110
320#define KEY_DELETE 111
321#define KEY_MACRO 112
322#define KEY_MUTE 113
323#define KEY_VOLUMEDOWN 114
324#define KEY_VOLUMEUP 115
325#define KEY_POWER 116 /* SC System Power Down */
326#define KEY_KPEQUAL 117
327#define KEY_KPPLUSMINUS 118
328#define KEY_PAUSE 119
329#define KEY_SCALE 120 /* AL Compiz Scale (Expose) */
330
331#define KEY_KPCOMMA 121
332#define KEY_HANGEUL 122
333#define KEY_HANGUEL KEY_HANGEUL
334#define KEY_HANJA 123
335#define KEY_YEN 124
336#define KEY_LEFTMETA 125
337#define KEY_RIGHTMETA 126
338#define KEY_COMPOSE 127
339
340#define KEY_STOP 128 /* AC Stop */
341#define KEY_AGAIN 129
342#define KEY_PROPS 130 /* AC Properties */
343#define KEY_UNDO 131 /* AC Undo */
344#define KEY_FRONT 132
345#define KEY_COPY 133 /* AC Copy */
346#define KEY_OPEN 134 /* AC Open */
347#define KEY_PASTE 135 /* AC Paste */
348#define KEY_FIND 136 /* AC Search */
349#define KEY_CUT 137 /* AC Cut */
350#define KEY_HELP 138 /* AL Integrated Help Center */
351#define KEY_MENU 139 /* Menu (show menu) */
352#define KEY_CALC 140 /* AL Calculator */
353#define KEY_SETUP 141
354#define KEY_SLEEP 142 /* SC System Sleep */
355#define KEY_WAKEUP 143 /* System Wake Up */
356#define KEY_FILE 144 /* AL Local Machine Browser */
357#define KEY_SENDFILE 145
358#define KEY_DELETEFILE 146
359#define KEY_XFER 147
360#define KEY_PROG1 148
361#define KEY_PROG2 149
362#define KEY_WWW 150 /* AL Internet Browser */
363#define KEY_MSDOS 151
364#define KEY_COFFEE 152 /* AL Terminal Lock/Screensaver */
365#define KEY_SCREENLOCK KEY_COFFEE
366#define KEY_DIRECTION 153
367#define KEY_CYCLEWINDOWS 154
368#define KEY_MAIL 155
369#define KEY_BOOKMARKS 156 /* AC Bookmarks */
370#define KEY_COMPUTER 157
371#define KEY_BACK 158 /* AC Back */
372#define KEY_FORWARD 159 /* AC Forward */
373#define KEY_CLOSECD 160
374#define KEY_EJECTCD 161
375#define KEY_EJECTCLOSECD 162
376#define KEY_NEXTSONG 163
377#define KEY_PLAYPAUSE 164
378#define KEY_PREVIOUSSONG 165
379#define KEY_STOPCD 166
380#define KEY_RECORD 167
381#define KEY_REWIND 168
382#define KEY_PHONE 169 /* Media Select Telephone */
383#define KEY_ISO 170
384#define KEY_CONFIG 171 /* AL Consumer Control Configuration */
385#define KEY_HOMEPAGE 172 /* AC Home */
386#define KEY_REFRESH 173 /* AC Refresh */
387#define KEY_EXIT 174 /* AC Exit */
388#define KEY_MOVE 175
389#define KEY_EDIT 176
390#define KEY_SCROLLUP 177
391#define KEY_SCROLLDOWN 178
392#define KEY_KPLEFTPAREN 179
393#define KEY_KPRIGHTPAREN 180
394#define KEY_NEW 181 /* AC New */
395#define KEY_REDO 182 /* AC Redo/Repeat */
396
397#define KEY_F13 183
398#define KEY_F14 184
399#define KEY_F15 185
400#define KEY_F16 186
401#define KEY_F17 187
402#define KEY_F18 188
403#define KEY_F19 189
404#define KEY_F20 190
405#define KEY_F21 191
406#define KEY_F22 192
407#define KEY_F23 193
408#define KEY_F24 194
409
410#define KEY_PLAYCD 200
411#define KEY_PAUSECD 201
412#define KEY_PROG3 202
413#define KEY_PROG4 203
414#define KEY_DASHBOARD 204 /* AL Dashboard */
415#define KEY_SUSPEND 205
416#define KEY_CLOSE 206 /* AC Close */
417#define KEY_PLAY 207
418#define KEY_FASTFORWARD 208
419#define KEY_BASSBOOST 209
420#define KEY_PRINT 210 /* AC Print */
421#define KEY_HP 211
422#define KEY_CAMERA 212
423#define KEY_SOUND 213
424#define KEY_QUESTION 214
425#define KEY_EMAIL 215
426#define KEY_CHAT 216
427#define KEY_SEARCH 217
428#define KEY_CONNECT 218
429#define KEY_FINANCE 219 /* AL Checkbook/Finance */
430#define KEY_SPORT 220
431#define KEY_SHOP 221
432#define KEY_ALTERASE 222
433#define KEY_CANCEL 223 /* AC Cancel */
434#define KEY_BRIGHTNESSDOWN 224
435#define KEY_BRIGHTNESSUP 225
436#define KEY_MEDIA 226
437
438#define KEY_SWITCHVIDEOMODE 227 /* Cycle between available video
439 outputs (Monitor/LCD/TV-out/etc) */
440#define KEY_KBDILLUMTOGGLE 228
441#define KEY_KBDILLUMDOWN 229
442#define KEY_KBDILLUMUP 230
443
444#define KEY_SEND 231 /* AC Send */
445#define KEY_REPLY 232 /* AC Reply */
446#define KEY_FORWARDMAIL 233 /* AC Forward Msg */
447#define KEY_SAVE 234 /* AC Save */
448#define KEY_DOCUMENTS 235
449
450#define KEY_BATTERY 236
451
452#define KEY_BLUETOOTH 237
453#define KEY_WLAN 238
454#define KEY_UWB 239
455
456#define KEY_UNKNOWN 240
457
458#define KEY_VIDEO_NEXT 241 /* drive next video source */
459#define KEY_VIDEO_PREV 242 /* drive previous video source */
460#define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */
461#define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */
462#define KEY_DISPLAY_OFF 245 /* display device to off state */
463
464#define KEY_WIMAX 246
465#define KEY_RFKILL 247 /* Key that controls all radios */
466
467#define KEY_MICMUTE 248 /* Mute / unmute the microphone */
468
469/* Code 255 is reserved for special needs of AT keyboard driver */
470
471#define BTN_MISC 0x100
472#define BTN_0 0x100
473#define BTN_1 0x101
474#define BTN_2 0x102
475#define BTN_3 0x103
476#define BTN_4 0x104
477#define BTN_5 0x105
478#define BTN_6 0x106
479#define BTN_7 0x107
480#define BTN_8 0x108
481#define BTN_9 0x109
482
483#define BTN_MOUSE 0x110
484#define BTN_LEFT 0x110
485#define BTN_RIGHT 0x111
486#define BTN_MIDDLE 0x112
487#define BTN_SIDE 0x113
488#define BTN_EXTRA 0x114
489#define BTN_FORWARD 0x115
490#define BTN_BACK 0x116
491#define BTN_TASK 0x117
492
493#define BTN_JOYSTICK 0x120
494#define BTN_TRIGGER 0x120
495#define BTN_THUMB 0x121
496#define BTN_THUMB2 0x122
497#define BTN_TOP 0x123
498#define BTN_TOP2 0x124
499#define BTN_PINKIE 0x125
500#define BTN_BASE 0x126
501#define BTN_BASE2 0x127
502#define BTN_BASE3 0x128
503#define BTN_BASE4 0x129
504#define BTN_BASE5 0x12a
505#define BTN_BASE6 0x12b
506#define BTN_DEAD 0x12f
507
508#define BTN_GAMEPAD 0x130
509#define BTN_A 0x130
510#define BTN_B 0x131
511#define BTN_C 0x132
512#define BTN_X 0x133
513#define BTN_Y 0x134
514#define BTN_Z 0x135
515#define BTN_TL 0x136
516#define BTN_TR 0x137
517#define BTN_TL2 0x138
518#define BTN_TR2 0x139
519#define BTN_SELECT 0x13a
520#define BTN_START 0x13b
521#define BTN_MODE 0x13c
522#define BTN_THUMBL 0x13d
523#define BTN_THUMBR 0x13e
524
525#define BTN_DIGI 0x140
526#define BTN_TOOL_PEN 0x140
527#define BTN_TOOL_RUBBER 0x141
528#define BTN_TOOL_BRUSH 0x142
529#define BTN_TOOL_PENCIL 0x143
530#define BTN_TOOL_AIRBRUSH 0x144
531#define BTN_TOOL_FINGER 0x145
532#define BTN_TOOL_MOUSE 0x146
533#define BTN_TOOL_LENS 0x147
534#define BTN_TOOL_QUINTTAP 0x148 /* Five fingers on trackpad */
535#define BTN_TOUCH 0x14a
536#define BTN_STYLUS 0x14b
537#define BTN_STYLUS2 0x14c
538#define BTN_TOOL_DOUBLETAP 0x14d
539#define BTN_TOOL_TRIPLETAP 0x14e
540#define BTN_TOOL_QUADTAP 0x14f /* Four fingers on trackpad */
541
542#define BTN_WHEEL 0x150
543#define BTN_GEAR_DOWN 0x150
544#define BTN_GEAR_UP 0x151
545
546#define KEY_OK 0x160
547#define KEY_SELECT 0x161
548#define KEY_GOTO 0x162
549#define KEY_CLEAR 0x163
550#define KEY_POWER2 0x164
551#define KEY_OPTION 0x165
552#define KEY_INFO 0x166 /* AL OEM Features/Tips/Tutorial */
553#define KEY_TIME 0x167
554#define KEY_VENDOR 0x168
555#define KEY_ARCHIVE 0x169
556#define KEY_PROGRAM 0x16a /* Media Select Program Guide */
557#define KEY_CHANNEL 0x16b
558#define KEY_FAVORITES 0x16c
559#define KEY_EPG 0x16d
560#define KEY_PVR 0x16e /* Media Select Home */
561#define KEY_MHP 0x16f
562#define KEY_LANGUAGE 0x170
563#define KEY_TITLE 0x171
564#define KEY_SUBTITLE 0x172
565#define KEY_ANGLE 0x173
566#define KEY_ZOOM 0x174
567#define KEY_MODE 0x175
568#define KEY_KEYBOARD 0x176
569#define KEY_SCREEN 0x177
570#define KEY_PC 0x178 /* Media Select Computer */
571#define KEY_TV 0x179 /* Media Select TV */
572#define KEY_TV2 0x17a /* Media Select Cable */
573#define KEY_VCR 0x17b /* Media Select VCR */
574#define KEY_VCR2 0x17c /* VCR Plus */
575#define KEY_SAT 0x17d /* Media Select Satellite */
576#define KEY_SAT2 0x17e
577#define KEY_CD 0x17f /* Media Select CD */
578#define KEY_TAPE 0x180 /* Media Select Tape */
579#define KEY_RADIO 0x181
580#define KEY_TUNER 0x182 /* Media Select Tuner */
581#define KEY_PLAYER 0x183
582#define KEY_TEXT 0x184
583#define KEY_DVD 0x185 /* Media Select DVD */
584#define KEY_AUX 0x186
585#define KEY_MP3 0x187
586#define KEY_AUDIO 0x188 /* AL Audio Browser */
587#define KEY_VIDEO 0x189 /* AL Movie Browser */
588#define KEY_DIRECTORY 0x18a
589#define KEY_LIST 0x18b
590#define KEY_MEMO 0x18c /* Media Select Messages */
591#define KEY_CALENDAR 0x18d
592#define KEY_RED 0x18e
593#define KEY_GREEN 0x18f
594#define KEY_YELLOW 0x190
595#define KEY_BLUE 0x191
596#define KEY_CHANNELUP 0x192 /* Channel Increment */
597#define KEY_CHANNELDOWN 0x193 /* Channel Decrement */
598#define KEY_FIRST 0x194
599#define KEY_LAST 0x195 /* Recall Last */
600#define KEY_AB 0x196
601#define KEY_NEXT 0x197
602#define KEY_RESTART 0x198
603#define KEY_SLOW 0x199
604#define KEY_SHUFFLE 0x19a
605#define KEY_BREAK 0x19b
606#define KEY_PREVIOUS 0x19c
607#define KEY_DIGITS 0x19d
608#define KEY_TEEN 0x19e
609#define KEY_TWEN 0x19f
610#define KEY_VIDEOPHONE 0x1a0 /* Media Select Video Phone */
611#define KEY_GAMES 0x1a1 /* Media Select Games */
612#define KEY_ZOOMIN 0x1a2 /* AC Zoom In */
613#define KEY_ZOOMOUT 0x1a3 /* AC Zoom Out */
614#define KEY_ZOOMRESET 0x1a4 /* AC Zoom */
615#define KEY_WORDPROCESSOR 0x1a5 /* AL Word Processor */
616#define KEY_EDITOR 0x1a6 /* AL Text Editor */
617#define KEY_SPREADSHEET 0x1a7 /* AL Spreadsheet */
618#define KEY_GRAPHICSEDITOR 0x1a8 /* AL Graphics Editor */
619#define KEY_PRESENTATION 0x1a9 /* AL Presentation App */
620#define KEY_DATABASE 0x1aa /* AL Database App */
621#define KEY_NEWS 0x1ab /* AL Newsreader */
622#define KEY_VOICEMAIL 0x1ac /* AL Voicemail */
623#define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */
624#define KEY_MESSENGER 0x1ae /* AL Instant Messaging */
625#define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */
626#define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */
627#define KEY_LOGOFF 0x1b1 /* AL Logoff */
628
629#define KEY_DOLLAR 0x1b2
630#define KEY_EURO 0x1b3
631
632#define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */
633#define KEY_FRAMEFORWARD 0x1b5
634#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */
635#define KEY_MEDIA_REPEAT 0x1b7 /* Consumer - transport control */
636#define KEY_10CHANNELSUP 0x1b8 /* 10 channels up (10+) */
637#define KEY_10CHANNELSDOWN 0x1b9 /* 10 channels down (10-) */
638#define KEY_IMAGES 0x1ba /* AL Image Browser */
639
640#define KEY_DEL_EOL 0x1c0
641#define KEY_DEL_EOS 0x1c1
642#define KEY_INS_LINE 0x1c2
643#define KEY_DEL_LINE 0x1c3
644
645#define KEY_FN 0x1d0
646#define KEY_FN_ESC 0x1d1
647#define KEY_FN_F1 0x1d2
648#define KEY_FN_F2 0x1d3
649#define KEY_FN_F3 0x1d4
650#define KEY_FN_F4 0x1d5
651#define KEY_FN_F5 0x1d6
652#define KEY_FN_F6 0x1d7
653#define KEY_FN_F7 0x1d8
654#define KEY_FN_F8 0x1d9
655#define KEY_FN_F9 0x1da
656#define KEY_FN_F10 0x1db
657#define KEY_FN_F11 0x1dc
658#define KEY_FN_F12 0x1dd
659#define KEY_FN_1 0x1de
660#define KEY_FN_2 0x1df
661#define KEY_FN_D 0x1e0
662#define KEY_FN_E 0x1e1
663#define KEY_FN_F 0x1e2
664#define KEY_FN_S 0x1e3
665#define KEY_FN_B 0x1e4
666
667#define KEY_BRL_DOT1 0x1f1
668#define KEY_BRL_DOT2 0x1f2
669#define KEY_BRL_DOT3 0x1f3
670#define KEY_BRL_DOT4 0x1f4
671#define KEY_BRL_DOT5 0x1f5
672#define KEY_BRL_DOT6 0x1f6
673#define KEY_BRL_DOT7 0x1f7
674#define KEY_BRL_DOT8 0x1f8
675#define KEY_BRL_DOT9 0x1f9
676#define KEY_BRL_DOT10 0x1fa
677
678#define KEY_NUMERIC_0 0x200 /* used by phones, remote controls, */
679#define KEY_NUMERIC_1 0x201 /* and other keypads */
680#define KEY_NUMERIC_2 0x202
681#define KEY_NUMERIC_3 0x203
682#define KEY_NUMERIC_4 0x204
683#define KEY_NUMERIC_5 0x205
684#define KEY_NUMERIC_6 0x206
685#define KEY_NUMERIC_7 0x207
686#define KEY_NUMERIC_8 0x208
687#define KEY_NUMERIC_9 0x209
688#define KEY_NUMERIC_STAR 0x20a
689#define KEY_NUMERIC_POUND 0x20b
690
691#define KEY_CAMERA_FOCUS 0x210
692#define KEY_WPS_BUTTON 0x211 /* WiFi Protected Setup key */
693
694#define KEY_TOUCHPAD_TOGGLE 0x212 /* Request switch touchpad on or off */
695#define KEY_TOUCHPAD_ON 0x213
696#define KEY_TOUCHPAD_OFF 0x214
697
698#define KEY_CAMERA_ZOOMIN 0x215
699#define KEY_CAMERA_ZOOMOUT 0x216
700#define KEY_CAMERA_UP 0x217
701#define KEY_CAMERA_DOWN 0x218
702#define KEY_CAMERA_LEFT 0x219
703#define KEY_CAMERA_RIGHT 0x21a
704
705#define BTN_TRIGGER_HAPPY 0x2c0
706#define BTN_TRIGGER_HAPPY1 0x2c0
707#define BTN_TRIGGER_HAPPY2 0x2c1
708#define BTN_TRIGGER_HAPPY3 0x2c2
709#define BTN_TRIGGER_HAPPY4 0x2c3
710#define BTN_TRIGGER_HAPPY5 0x2c4
711#define BTN_TRIGGER_HAPPY6 0x2c5
712#define BTN_TRIGGER_HAPPY7 0x2c6
713#define BTN_TRIGGER_HAPPY8 0x2c7
714#define BTN_TRIGGER_HAPPY9 0x2c8
715#define BTN_TRIGGER_HAPPY10 0x2c9
716#define BTN_TRIGGER_HAPPY11 0x2ca
717#define BTN_TRIGGER_HAPPY12 0x2cb
718#define BTN_TRIGGER_HAPPY13 0x2cc
719#define BTN_TRIGGER_HAPPY14 0x2cd
720#define BTN_TRIGGER_HAPPY15 0x2ce
721#define BTN_TRIGGER_HAPPY16 0x2cf
722#define BTN_TRIGGER_HAPPY17 0x2d0
723#define BTN_TRIGGER_HAPPY18 0x2d1
724#define BTN_TRIGGER_HAPPY19 0x2d2
725#define BTN_TRIGGER_HAPPY20 0x2d3
726#define BTN_TRIGGER_HAPPY21 0x2d4
727#define BTN_TRIGGER_HAPPY22 0x2d5
728#define BTN_TRIGGER_HAPPY23 0x2d6
729#define BTN_TRIGGER_HAPPY24 0x2d7
730#define BTN_TRIGGER_HAPPY25 0x2d8
731#define BTN_TRIGGER_HAPPY26 0x2d9
732#define BTN_TRIGGER_HAPPY27 0x2da
733#define BTN_TRIGGER_HAPPY28 0x2db
734#define BTN_TRIGGER_HAPPY29 0x2dc
735#define BTN_TRIGGER_HAPPY30 0x2dd
736#define BTN_TRIGGER_HAPPY31 0x2de
737#define BTN_TRIGGER_HAPPY32 0x2df
738#define BTN_TRIGGER_HAPPY33 0x2e0
739#define BTN_TRIGGER_HAPPY34 0x2e1
740#define BTN_TRIGGER_HAPPY35 0x2e2
741#define BTN_TRIGGER_HAPPY36 0x2e3
742#define BTN_TRIGGER_HAPPY37 0x2e4
743#define BTN_TRIGGER_HAPPY38 0x2e5
744#define BTN_TRIGGER_HAPPY39 0x2e6
745#define BTN_TRIGGER_HAPPY40 0x2e7
746
747/* We avoid low common keys in module aliases so they don't get huge. */
748#define KEY_MIN_INTERESTING KEY_MUTE
749#define KEY_MAX 0x2ff
750#define KEY_CNT (KEY_MAX+1)
751
752/*
753 * Relative axes
754 */
755
756#define REL_X 0x00
757#define REL_Y 0x01
758#define REL_Z 0x02
759#define REL_RX 0x03
760#define REL_RY 0x04
761#define REL_RZ 0x05
762#define REL_HWHEEL 0x06
763#define REL_DIAL 0x07
764#define REL_WHEEL 0x08
765#define REL_MISC 0x09
766#define REL_MAX 0x0f
767#define REL_CNT (REL_MAX+1)
768
769/*
770 * Absolute axes
771 */
772
773#define ABS_X 0x00
774#define ABS_Y 0x01
775#define ABS_Z 0x02
776#define ABS_RX 0x03
777#define ABS_RY 0x04
778#define ABS_RZ 0x05
779#define ABS_THROTTLE 0x06
780#define ABS_RUDDER 0x07
781#define ABS_WHEEL 0x08
782#define ABS_GAS 0x09
783#define ABS_BRAKE 0x0a
784#define ABS_HAT0X 0x10
785#define ABS_HAT0Y 0x11
786#define ABS_HAT1X 0x12
787#define ABS_HAT1Y 0x13
788#define ABS_HAT2X 0x14
789#define ABS_HAT2Y 0x15
790#define ABS_HAT3X 0x16
791#define ABS_HAT3Y 0x17
792#define ABS_PRESSURE 0x18
793#define ABS_DISTANCE 0x19
794#define ABS_TILT_X 0x1a
795#define ABS_TILT_Y 0x1b
796#define ABS_TOOL_WIDTH 0x1c
797
798#define ABS_VOLUME 0x20
799
800#define ABS_MISC 0x28
801
802#define ABS_MT_SLOT 0x2f /* MT slot being modified */
803#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */
804#define ABS_MT_TOUCH_MINOR 0x31 /* Minor axis (omit if circular) */
805#define ABS_MT_WIDTH_MAJOR 0x32 /* Major axis of approaching ellipse */
806#define ABS_MT_WIDTH_MINOR 0x33 /* Minor axis (omit if circular) */
807#define ABS_MT_ORIENTATION 0x34 /* Ellipse orientation */
808#define ABS_MT_POSITION_X 0x35 /* Center X touch position */
809#define ABS_MT_POSITION_Y 0x36 /* Center Y touch position */
810#define ABS_MT_TOOL_TYPE 0x37 /* Type of touching device */
811#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */
812#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */
813#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */
814#define ABS_MT_DISTANCE 0x3b /* Contact hover distance */
815#define ABS_MT_TOOL_X 0x3c /* Center X tool position */
816#define ABS_MT_TOOL_Y 0x3d /* Center Y tool position */
817
818
819#define ABS_MAX 0x3f
820#define ABS_CNT (ABS_MAX+1)
821
822/*
823 * Switch events
824 */
825
826#define SW_LID 0x00 /* set = lid shut */
827#define SW_TABLET_MODE 0x01 /* set = tablet mode */
828#define SW_HEADPHONE_INSERT 0x02 /* set = inserted */
829#define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any"
830 set = radio enabled */
831#define SW_RADIO SW_RFKILL_ALL /* deprecated */
832#define SW_MICROPHONE_INSERT 0x04 /* set = inserted */
833#define SW_DOCK 0x05 /* set = plugged into dock */
834#define SW_LINEOUT_INSERT 0x06 /* set = inserted */
835#define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */
836#define SW_VIDEOOUT_INSERT 0x08 /* set = inserted */
837#define SW_CAMERA_LENS_COVER 0x09 /* set = lens covered */
838#define SW_KEYPAD_SLIDE 0x0a /* set = keypad slide out */
839#define SW_FRONT_PROXIMITY 0x0b /* set = front proximity sensor active */
840#define SW_ROTATE_LOCK 0x0c /* set = rotate locked/disabled */
841#define SW_LINEIN_INSERT 0x0d /* set = inserted */
842#define SW_MAX 0x0f
843#define SW_CNT (SW_MAX+1)
844
845/*
846 * Misc events
847 */
848
849#define MSC_SERIAL 0x00
850#define MSC_PULSELED 0x01
851#define MSC_GESTURE 0x02
852#define MSC_RAW 0x03
853#define MSC_SCAN 0x04
854#define MSC_MAX 0x07
855#define MSC_CNT (MSC_MAX+1)
856
857/*
858 * LEDs
859 */
860
861#define LED_NUML 0x00
862#define LED_CAPSL 0x01
863#define LED_SCROLLL 0x02
864#define LED_COMPOSE 0x03
865#define LED_KANA 0x04
866#define LED_SLEEP 0x05
867#define LED_SUSPEND 0x06
868#define LED_MUTE 0x07
869#define LED_MISC 0x08
870#define LED_MAIL 0x09
871#define LED_CHARGING 0x0a
872#define LED_MAX 0x0f
873#define LED_CNT (LED_MAX+1)
874
875/*
876 * Autorepeat values
877 */
878
879#define REP_DELAY 0x00
880#define REP_PERIOD 0x01
881#define REP_MAX 0x01
882#define REP_CNT (REP_MAX+1)
883
884/*
885 * Sounds
886 */
887
888#define SND_CLICK 0x00
889#define SND_BELL 0x01
890#define SND_TONE 0x02
891#define SND_MAX 0x07
892#define SND_CNT (SND_MAX+1)
893
894/*
895 * IDs.
896 */
897
898#define ID_BUS 0
899#define ID_VENDOR 1
900#define ID_PRODUCT 2
901#define ID_VERSION 3
902
903#define BUS_PCI 0x01
904#define BUS_ISAPNP 0x02
905#define BUS_USB 0x03
906#define BUS_HIL 0x04
907#define BUS_BLUETOOTH 0x05
908#define BUS_VIRTUAL 0x06
909
910#define BUS_ISA 0x10
911#define BUS_I8042 0x11
912#define BUS_XTKBD 0x12
913#define BUS_RS232 0x13
914#define BUS_GAMEPORT 0x14
915#define BUS_PARPORT 0x15
916#define BUS_AMIGA 0x16
917#define BUS_ADB 0x17
918#define BUS_I2C 0x18
919#define BUS_HOST 0x19
920#define BUS_GSC 0x1A
921#define BUS_ATARI 0x1B
922#define BUS_SPI 0x1C
923
924/*
925 * MT_TOOL types
926 */
927#define MT_TOOL_FINGER 0
928#define MT_TOOL_PEN 1
929#define MT_TOOL_MAX 1
930
931/*
932 * Values describing the status of a force-feedback effect
933 */
934#define FF_STATUS_STOPPED 0x00
935#define FF_STATUS_PLAYING 0x01
936#define FF_STATUS_MAX 0x01
937
938/*
939 * Structures used in ioctls to upload effects to a device
940 * They are pieces of a bigger structure (called ff_effect)
941 */
942
943/*
944 * All duration values are expressed in ms. Values above 32767 ms (0x7fff)
945 * should not be used and have unspecified results.
946 */
947
948/**
949 * struct ff_replay - defines scheduling of the force-feedback effect
950 * @length: duration of the effect
951 * @delay: delay before effect should start playing
952 */
953struct ff_replay {
954 __u16 length;
955 __u16 delay;
956};
957
958/**
959 * struct ff_trigger - defines what triggers the force-feedback effect
960 * @button: number of the button triggering the effect
961 * @interval: controls how soon the effect can be re-triggered
962 */
963struct ff_trigger {
964 __u16 button;
965 __u16 interval;
966};
967
968/**
969 * struct ff_envelope - generic force-feedback effect envelope
970 * @attack_length: duration of the attack (ms)
971 * @attack_level: level at the beginning of the attack
972 * @fade_length: duration of fade (ms)
973 * @fade_level: level at the end of fade
974 *
975 * The @attack_level and @fade_level are absolute values; when applying
976 * envelope force-feedback core will convert to positive/negative
977 * value based on polarity of the default level of the effect.
978 * Valid range for the attack and fade levels is 0x0000 - 0x7fff
979 */
980struct ff_envelope {
981 __u16 attack_length;
982 __u16 attack_level;
983 __u16 fade_length;
984 __u16 fade_level;
985};
986
987/**
988 * struct ff_constant_effect - defines parameters of a constant force-feedback effect
989 * @level: strength of the effect; may be negative
990 * @envelope: envelope data
991 */
992struct ff_constant_effect {
993 __s16 level;
994 struct ff_envelope envelope;
995};
996
997/**
998 * struct ff_ramp_effect - defines parameters of a ramp force-feedback effect
999 * @start_level: beginning strength of the effect; may be negative
1000 * @end_level: final strength of the effect; may be negative
1001 * @envelope: envelope data
1002 */
1003struct ff_ramp_effect {
1004 __s16 start_level;
1005 __s16 end_level;
1006 struct ff_envelope envelope;
1007};
1008
1009/**
1010 * struct ff_condition_effect - defines a spring or friction force-feedback effect
1011 * @right_saturation: maximum level when joystick moved all way to the right
1012 * @left_saturation: same for the left side
1013 * @right_coeff: controls how fast the force grows when the joystick moves
1014 * to the right
1015 * @left_coeff: same for the left side
1016 * @deadband: size of the dead zone, where no force is produced
1017 * @center: position of the dead zone
1018 */
1019struct ff_condition_effect {
1020 __u16 right_saturation;
1021 __u16 left_saturation;
1022
1023 __s16 right_coeff;
1024 __s16 left_coeff;
1025
1026 __u16 deadband;
1027 __s16 center;
1028};
1029
1030/**
1031 * struct ff_periodic_effect - defines parameters of a periodic force-feedback effect
1032 * @waveform: kind of the effect (wave)
1033 * @period: period of the wave (ms)
1034 * @magnitude: peak value
1035 * @offset: mean value of the wave (roughly)
1036 * @phase: 'horizontal' shift
1037 * @envelope: envelope data
1038 * @custom_len: number of samples (FF_CUSTOM only)
1039 * @custom_data: buffer of samples (FF_CUSTOM only)
1040 *
1041 * Known waveforms - FF_SQUARE, FF_TRIANGLE, FF_SINE, FF_SAW_UP,
1042 * FF_SAW_DOWN, FF_CUSTOM. The exact syntax FF_CUSTOM is undefined
1043 * for the time being as no driver supports it yet.
1044 *
1045 * Note: the data pointed by custom_data is copied by the driver.
1046 * You can therefore dispose of the memory after the upload/update.
1047 */
1048struct ff_periodic_effect {
1049 __u16 waveform;
1050 __u16 period;
1051 __s16 magnitude;
1052 __s16 offset;
1053 __u16 phase;
1054
1055 struct ff_envelope envelope;
1056
1057 __u32 custom_len;
1058 __s16 __user *custom_data;
1059};
1060
1061/**
1062 * struct ff_rumble_effect - defines parameters of a periodic force-feedback effect
1063 * @strong_magnitude: magnitude of the heavy motor
1064 * @weak_magnitude: magnitude of the light one
1065 *
1066 * Some rumble pads have two motors of different weight. Strong_magnitude
1067 * represents the magnitude of the vibration generated by the heavy one.
1068 */
1069struct ff_rumble_effect {
1070 __u16 strong_magnitude;
1071 __u16 weak_magnitude;
1072};
1073
1074/**
1075 * struct ff_effect - defines force feedback effect
1076 * @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING,
1077 * FF_FRICTION, FF_DAMPER, FF_RUMBLE, FF_INERTIA, or FF_CUSTOM)
1078 * @id: an unique id assigned to an effect
1079 * @direction: direction of the effect
1080 * @trigger: trigger conditions (struct ff_trigger)
1081 * @replay: scheduling of the effect (struct ff_replay)
1082 * @u: effect-specific structure (one of ff_constant_effect, ff_ramp_effect,
1083 * ff_periodic_effect, ff_condition_effect, ff_rumble_effect) further
1084 * defining effect parameters
1085 *
1086 * This structure is sent through ioctl from the application to the driver.
1087 * To create a new effect application should set its @id to -1; the kernel
1088 * will return assigned @id which can later be used to update or delete
1089 * this effect.
1090 *
1091 * Direction of the effect is encoded as follows:
1092 * 0 deg -> 0x0000 (down)
1093 * 90 deg -> 0x4000 (left)
1094 * 180 deg -> 0x8000 (up)
1095 * 270 deg -> 0xC000 (right)
1096 */
1097struct ff_effect {
1098 __u16 type;
1099 __s16 id;
1100 __u16 direction;
1101 struct ff_trigger trigger;
1102 struct ff_replay replay;
1103
1104 union {
1105 struct ff_constant_effect constant;
1106 struct ff_ramp_effect ramp;
1107 struct ff_periodic_effect periodic;
1108 struct ff_condition_effect condition[2]; /* One for each axis */
1109 struct ff_rumble_effect rumble;
1110 } u;
1111};
1112
1113/*
1114 * Force feedback effect types
1115 */
1116
1117#define FF_RUMBLE 0x50
1118#define FF_PERIODIC 0x51
1119#define FF_CONSTANT 0x52
1120#define FF_SPRING 0x53
1121#define FF_FRICTION 0x54
1122#define FF_DAMPER 0x55
1123#define FF_INERTIA 0x56
1124#define FF_RAMP 0x57
1125
1126#define FF_EFFECT_MIN FF_RUMBLE
1127#define FF_EFFECT_MAX FF_RAMP
1128
1129/*
1130 * Force feedback periodic effect types
1131 */
1132
1133#define FF_SQUARE 0x58
1134#define FF_TRIANGLE 0x59
1135#define FF_SINE 0x5a
1136#define FF_SAW_UP 0x5b
1137#define FF_SAW_DOWN 0x5c
1138#define FF_CUSTOM 0x5d
1139
1140#define FF_WAVEFORM_MIN FF_SQUARE
1141#define FF_WAVEFORM_MAX FF_CUSTOM
1142
1143/*
1144 * Set ff device properties
1145 */
1146
1147#define FF_GAIN 0x60
1148#define FF_AUTOCENTER 0x61
1149
1150#define FF_MAX 0x7f
1151#define FF_CNT (FF_MAX+1)
1152
1153#endif /* _UAPI_INPUT_H */
diff --git a/include/linux/ioctl.h b/include/uapi/linux/ioctl.h
index aa91eb3951ef..aa91eb3951ef 100644
--- a/include/linux/ioctl.h
+++ b/include/uapi/linux/ioctl.h
diff --git a/include/uapi/linux/ip.h b/include/uapi/linux/ip.h
new file mode 100644
index 000000000000..6cf06bfd841b
--- /dev/null
+++ b/include/uapi/linux/ip.h
@@ -0,0 +1,136 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for the IP protocol.
7 *
8 * Version: @(#)ip.h 1.0.2 04/28/93
9 *
10 * Authors: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17#ifndef _UAPI_LINUX_IP_H
18#define _UAPI_LINUX_IP_H
19#include <linux/types.h>
20#include <asm/byteorder.h>
21
22#define IPTOS_TOS_MASK 0x1E
23#define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK)
24#define IPTOS_LOWDELAY 0x10
25#define IPTOS_THROUGHPUT 0x08
26#define IPTOS_RELIABILITY 0x04
27#define IPTOS_MINCOST 0x02
28
29#define IPTOS_PREC_MASK 0xE0
30#define IPTOS_PREC(tos) ((tos)&IPTOS_PREC_MASK)
31#define IPTOS_PREC_NETCONTROL 0xe0
32#define IPTOS_PREC_INTERNETCONTROL 0xc0
33#define IPTOS_PREC_CRITIC_ECP 0xa0
34#define IPTOS_PREC_FLASHOVERRIDE 0x80
35#define IPTOS_PREC_FLASH 0x60
36#define IPTOS_PREC_IMMEDIATE 0x40
37#define IPTOS_PREC_PRIORITY 0x20
38#define IPTOS_PREC_ROUTINE 0x00
39
40
41/* IP options */
42#define IPOPT_COPY 0x80
43#define IPOPT_CLASS_MASK 0x60
44#define IPOPT_NUMBER_MASK 0x1f
45
46#define IPOPT_COPIED(o) ((o)&IPOPT_COPY)
47#define IPOPT_CLASS(o) ((o)&IPOPT_CLASS_MASK)
48#define IPOPT_NUMBER(o) ((o)&IPOPT_NUMBER_MASK)
49
50#define IPOPT_CONTROL 0x00
51#define IPOPT_RESERVED1 0x20
52#define IPOPT_MEASUREMENT 0x40
53#define IPOPT_RESERVED2 0x60
54
55#define IPOPT_END (0 |IPOPT_CONTROL)
56#define IPOPT_NOOP (1 |IPOPT_CONTROL)
57#define IPOPT_SEC (2 |IPOPT_CONTROL|IPOPT_COPY)
58#define IPOPT_LSRR (3 |IPOPT_CONTROL|IPOPT_COPY)
59#define IPOPT_TIMESTAMP (4 |IPOPT_MEASUREMENT)
60#define IPOPT_CIPSO (6 |IPOPT_CONTROL|IPOPT_COPY)
61#define IPOPT_RR (7 |IPOPT_CONTROL)
62#define IPOPT_SID (8 |IPOPT_CONTROL|IPOPT_COPY)
63#define IPOPT_SSRR (9 |IPOPT_CONTROL|IPOPT_COPY)
64#define IPOPT_RA (20|IPOPT_CONTROL|IPOPT_COPY)
65
66#define IPVERSION 4
67#define MAXTTL 255
68#define IPDEFTTL 64
69
70#define IPOPT_OPTVAL 0
71#define IPOPT_OLEN 1
72#define IPOPT_OFFSET 2
73#define IPOPT_MINOFF 4
74#define MAX_IPOPTLEN 40
75#define IPOPT_NOP IPOPT_NOOP
76#define IPOPT_EOL IPOPT_END
77#define IPOPT_TS IPOPT_TIMESTAMP
78
79#define IPOPT_TS_TSONLY 0 /* timestamps only */
80#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
81#define IPOPT_TS_PRESPEC 3 /* specified modules only */
82
83#define IPV4_BEET_PHMAXLEN 8
84
85struct iphdr {
86#if defined(__LITTLE_ENDIAN_BITFIELD)
87 __u8 ihl:4,
88 version:4;
89#elif defined (__BIG_ENDIAN_BITFIELD)
90 __u8 version:4,
91 ihl:4;
92#else
93#error "Please fix <asm/byteorder.h>"
94#endif
95 __u8 tos;
96 __be16 tot_len;
97 __be16 id;
98 __be16 frag_off;
99 __u8 ttl;
100 __u8 protocol;
101 __sum16 check;
102 __be32 saddr;
103 __be32 daddr;
104 /*The options start here. */
105};
106
107
108struct ip_auth_hdr {
109 __u8 nexthdr;
110 __u8 hdrlen; /* This one is measured in 32 bit units! */
111 __be16 reserved;
112 __be32 spi;
113 __be32 seq_no; /* Sequence number */
114 __u8 auth_data[0]; /* Variable len but >=4. Mind the 64 bit alignment! */
115};
116
117struct ip_esp_hdr {
118 __be32 spi;
119 __be32 seq_no; /* Sequence number */
120 __u8 enc_data[0]; /* Variable len but >=8. Mind the 64 bit alignment! */
121};
122
123struct ip_comp_hdr {
124 __u8 nexthdr;
125 __u8 flags;
126 __be16 cpi;
127};
128
129struct ip_beet_phdr {
130 __u8 nexthdr;
131 __u8 hdrlen;
132 __u8 padlen;
133 __u8 reserved;
134};
135
136#endif /* _UAPI_LINUX_IP_H */
diff --git a/include/linux/ip6_tunnel.h b/include/uapi/linux/ip6_tunnel.h
index 48af63c9a48d..48af63c9a48d 100644
--- a/include/linux/ip6_tunnel.h
+++ b/include/uapi/linux/ip6_tunnel.h
diff --git a/include/linux/ip_vs.h b/include/uapi/linux/ip_vs.h
index 8a2d438dc499..8a2d438dc499 100644
--- a/include/linux/ip_vs.h
+++ b/include/uapi/linux/ip_vs.h
diff --git a/include/uapi/linux/ipc.h b/include/uapi/linux/ipc.h
new file mode 100644
index 000000000000..de08dd46ddae
--- /dev/null
+++ b/include/uapi/linux/ipc.h
@@ -0,0 +1,81 @@
1#ifndef _UAPI_LINUX_IPC_H
2#define _UAPI_LINUX_IPC_H
3
4#include <linux/types.h>
5
6#define IPC_PRIVATE ((__kernel_key_t) 0)
7
8/* Obsolete, used only for backwards compatibility and libc5 compiles */
9struct ipc_perm
10{
11 __kernel_key_t key;
12 __kernel_uid_t uid;
13 __kernel_gid_t gid;
14 __kernel_uid_t cuid;
15 __kernel_gid_t cgid;
16 __kernel_mode_t mode;
17 unsigned short seq;
18};
19
20/* Include the definition of ipc64_perm */
21#include <asm/ipcbuf.h>
22
23/* resource get request flags */
24#define IPC_CREAT 00001000 /* create if key is nonexistent */
25#define IPC_EXCL 00002000 /* fail if key exists */
26#define IPC_NOWAIT 00004000 /* return error on wait */
27
28/* these fields are used by the DIPC package so the kernel as standard
29 should avoid using them if possible */
30
31#define IPC_DIPC 00010000 /* make it distributed */
32#define IPC_OWN 00020000 /* this machine is the DIPC owner */
33
34/*
35 * Control commands used with semctl, msgctl and shmctl
36 * see also specific commands in sem.h, msg.h and shm.h
37 */
38#define IPC_RMID 0 /* remove resource */
39#define IPC_SET 1 /* set ipc_perm options */
40#define IPC_STAT 2 /* get ipc_perm options */
41#define IPC_INFO 3 /* see ipcs */
42
43/*
44 * Version flags for semctl, msgctl, and shmctl commands
45 * These are passed as bitflags or-ed with the actual command
46 */
47#define IPC_OLD 0 /* Old version (no 32-bit UID support on many
48 architectures) */
49#define IPC_64 0x0100 /* New version (support 32-bit UIDs, bigger
50 message sizes, etc. */
51
52/*
53 * These are used to wrap system calls.
54 *
55 * See architecture code for ugly details..
56 */
57struct ipc_kludge {
58 struct msgbuf __user *msgp;
59 long msgtyp;
60};
61
62#define SEMOP 1
63#define SEMGET 2
64#define SEMCTL 3
65#define SEMTIMEDOP 4
66#define MSGSND 11
67#define MSGRCV 12
68#define MSGGET 13
69#define MSGCTL 14
70#define SHMAT 21
71#define SHMDT 22
72#define SHMGET 23
73#define SHMCTL 24
74
75/* Used by the DIPC package, try and avoid reusing it */
76#define DIPC 25
77
78#define IPCCALL(version,op) ((version)<<16 | (op))
79
80
81#endif /* _UAPI_LINUX_IPC_H */
diff --git a/include/uapi/linux/ipmi.h b/include/uapi/linux/ipmi.h
new file mode 100644
index 000000000000..33fbc99b3812
--- /dev/null
+++ b/include/uapi/linux/ipmi.h
@@ -0,0 +1,456 @@
1/*
2 * ipmi.h
3 *
4 * MontaVista IPMI interface
5 *
6 * Author: MontaVista Software, Inc.
7 * Corey Minyard <minyard@mvista.com>
8 * source@mvista.com
9 *
10 * Copyright 2002 MontaVista Software Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 *
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
24 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
26 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
27 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * You should have received a copy of the GNU General Public License along
30 * with this program; if not, write to the Free Software Foundation, Inc.,
31 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 */
33
34#ifndef _UAPI__LINUX_IPMI_H
35#define _UAPI__LINUX_IPMI_H
36
37#include <linux/ipmi_msgdefs.h>
38#include <linux/compiler.h>
39
40/*
41 * This file describes an interface to an IPMI driver. You have to
42 * have a fairly good understanding of IPMI to use this, so go read
43 * the specs first before actually trying to do anything.
44 *
45 * With that said, this driver provides a multi-user interface to the
46 * IPMI driver, and it allows multiple IPMI physical interfaces below
47 * the driver. The physical interfaces bind as a lower layer on the
48 * driver. They appear as interfaces to the application using this
49 * interface.
50 *
51 * Multi-user means that multiple applications may use the driver,
52 * send commands, receive responses, etc. The driver keeps track of
53 * commands the user sends and tracks the responses. The responses
54 * will go back to the application that send the command. If the
55 * response doesn't come back in time, the driver will return a
56 * timeout error response to the application. Asynchronous events
57 * from the BMC event queue will go to all users bound to the driver.
58 * The incoming event queue in the BMC will automatically be flushed
59 * if it becomes full and it is queried once a second to see if
60 * anything is in it. Incoming commands to the driver will get
61 * delivered as commands.
62 *
63 * This driver provides two main interfaces: one for in-kernel
64 * applications and another for userland applications. The
65 * capabilities are basically the same for both interface, although
66 * the interfaces are somewhat different. The stuff in the
67 * #ifdef __KERNEL__ below is the in-kernel interface. The userland
68 * interface is defined later in the file. */
69
70
71
72/*
73 * This is an overlay for all the address types, so it's easy to
74 * determine the actual address type. This is kind of like addresses
75 * work for sockets.
76 */
77#define IPMI_MAX_ADDR_SIZE 32
78struct ipmi_addr {
79 /* Try to take these from the "Channel Medium Type" table
80 in section 6.5 of the IPMI 1.5 manual. */
81 int addr_type;
82 short channel;
83 char data[IPMI_MAX_ADDR_SIZE];
84};
85
86/*
87 * When the address is not used, the type will be set to this value.
88 * The channel is the BMC's channel number for the channel (usually
89 * 0), or IPMC_BMC_CHANNEL if communicating directly with the BMC.
90 */
91#define IPMI_SYSTEM_INTERFACE_ADDR_TYPE 0x0c
92struct ipmi_system_interface_addr {
93 int addr_type;
94 short channel;
95 unsigned char lun;
96};
97
98/* An IPMB Address. */
99#define IPMI_IPMB_ADDR_TYPE 0x01
100/* Used for broadcast get device id as described in section 17.9 of the
101 IPMI 1.5 manual. */
102#define IPMI_IPMB_BROADCAST_ADDR_TYPE 0x41
103struct ipmi_ipmb_addr {
104 int addr_type;
105 short channel;
106 unsigned char slave_addr;
107 unsigned char lun;
108};
109
110/*
111 * A LAN Address. This is an address to/from a LAN interface bridged
112 * by the BMC, not an address actually out on the LAN.
113 *
114 * A conscious decision was made here to deviate slightly from the IPMI
115 * spec. We do not use rqSWID and rsSWID like it shows in the
116 * message. Instead, we use remote_SWID and local_SWID. This means
117 * that any message (a request or response) from another device will
118 * always have exactly the same address. If you didn't do this,
119 * requests and responses from the same device would have different
120 * addresses, and that's not too cool.
121 *
122 * In this address, the remote_SWID is always the SWID the remote
123 * message came from, or the SWID we are sending the message to.
124 * local_SWID is always our SWID. Note that having our SWID in the
125 * message is a little weird, but this is required.
126 */
127#define IPMI_LAN_ADDR_TYPE 0x04
128struct ipmi_lan_addr {
129 int addr_type;
130 short channel;
131 unsigned char privilege;
132 unsigned char session_handle;
133 unsigned char remote_SWID;
134 unsigned char local_SWID;
135 unsigned char lun;
136};
137
138
139/*
140 * Channel for talking directly with the BMC. When using this
141 * channel, This is for the system interface address type only. FIXME
142 * - is this right, or should we use -1?
143 */
144#define IPMI_BMC_CHANNEL 0xf
145#define IPMI_NUM_CHANNELS 0x10
146
147/*
148 * Used to signify an "all channel" bitmask. This is more than the
149 * actual number of channels because this is used in userland and
150 * will cover us if the number of channels is extended.
151 */
152#define IPMI_CHAN_ALL (~0)
153
154
155/*
156 * A raw IPMI message without any addressing. This covers both
157 * commands and responses. The completion code is always the first
158 * byte of data in the response (as the spec shows the messages laid
159 * out).
160 */
161struct ipmi_msg {
162 unsigned char netfn;
163 unsigned char cmd;
164 unsigned short data_len;
165 unsigned char __user *data;
166};
167
168struct kernel_ipmi_msg {
169 unsigned char netfn;
170 unsigned char cmd;
171 unsigned short data_len;
172 unsigned char *data;
173};
174
175/*
176 * Various defines that are useful for IPMI applications.
177 */
178#define IPMI_INVALID_CMD_COMPLETION_CODE 0xC1
179#define IPMI_TIMEOUT_COMPLETION_CODE 0xC3
180#define IPMI_UNKNOWN_ERR_COMPLETION_CODE 0xff
181
182
183/*
184 * Receive types for messages coming from the receive interface. This
185 * is used for the receive in-kernel interface and in the receive
186 * IOCTL.
187 *
188 * The "IPMI_RESPONSE_RESPNOSE_TYPE" is a little strange sounding, but
189 * it allows you to get the message results when you send a response
190 * message.
191 */
192#define IPMI_RESPONSE_RECV_TYPE 1 /* A response to a command */
193#define IPMI_ASYNC_EVENT_RECV_TYPE 2 /* Something from the event queue */
194#define IPMI_CMD_RECV_TYPE 3 /* A command from somewhere else */
195#define IPMI_RESPONSE_RESPONSE_TYPE 4 /* The response for
196 a sent response, giving any
197 error status for sending the
198 response. When you send a
199 response message, this will
200 be returned. */
201#define IPMI_OEM_RECV_TYPE 5 /* The response for OEM Channels */
202
203/* Note that async events and received commands do not have a completion
204 code as the first byte of the incoming data, unlike a response. */
205
206
207/*
208 * Modes for ipmi_set_maint_mode() and the userland IOCTL. The AUTO
209 * setting is the default and means it will be set on certain
210 * commands. Hard setting it on and off will override automatic
211 * operation.
212 */
213#define IPMI_MAINTENANCE_MODE_AUTO 0
214#define IPMI_MAINTENANCE_MODE_OFF 1
215#define IPMI_MAINTENANCE_MODE_ON 2
216
217
218
219/*
220 * The userland interface
221 */
222
223/*
224 * The userland interface for the IPMI driver is a standard character
225 * device, with each instance of an interface registered as a minor
226 * number under the major character device.
227 *
228 * The read and write calls do not work, to get messages in and out
229 * requires ioctl calls because of the complexity of the data. select
230 * and poll do work, so you can wait for input using the file
231 * descriptor, you just can use read to get it.
232 *
233 * In general, you send a command down to the interface and receive
234 * responses back. You can use the msgid value to correlate commands
235 * and responses, the driver will take care of figuring out which
236 * incoming messages are for which command and find the proper msgid
237 * value to report. You will only receive reponses for commands you
238 * send. Asynchronous events, however, go to all open users, so you
239 * must be ready to handle these (or ignore them if you don't care).
240 *
241 * The address type depends upon the channel type. When talking
242 * directly to the BMC (IPMC_BMC_CHANNEL), the address is ignored
243 * (IPMI_UNUSED_ADDR_TYPE). When talking to an IPMB channel, you must
244 * supply a valid IPMB address with the addr_type set properly.
245 *
246 * When talking to normal channels, the driver takes care of the
247 * details of formatting and sending messages on that channel. You do
248 * not, for instance, have to format a send command, you just send
249 * whatever command you want to the channel, the driver will create
250 * the send command, automatically issue receive command and get even
251 * commands, and pass those up to the proper user.
252 */
253
254
255/* The magic IOCTL value for this interface. */
256#define IPMI_IOC_MAGIC 'i'
257
258
259/* Messages sent to the interface are this format. */
260struct ipmi_req {
261 unsigned char __user *addr; /* Address to send the message to. */
262 unsigned int addr_len;
263
264 long msgid; /* The sequence number for the message. This
265 exact value will be reported back in the
266 response to this request if it is a command.
267 If it is a response, this will be used as
268 the sequence value for the response. */
269
270 struct ipmi_msg msg;
271};
272/*
273 * Send a message to the interfaces. error values are:
274 * - EFAULT - an address supplied was invalid.
275 * - EINVAL - The address supplied was not valid, or the command
276 * was not allowed.
277 * - EMSGSIZE - The message to was too large.
278 * - ENOMEM - Buffers could not be allocated for the command.
279 */
280#define IPMICTL_SEND_COMMAND _IOR(IPMI_IOC_MAGIC, 13, \
281 struct ipmi_req)
282
283/* Messages sent to the interface with timing parameters are this
284 format. */
285struct ipmi_req_settime {
286 struct ipmi_req req;
287
288 /* See ipmi_request_settime() above for details on these
289 values. */
290 int retries;
291 unsigned int retry_time_ms;
292};
293/*
294 * Send a message to the interfaces with timing parameters. error values
295 * are:
296 * - EFAULT - an address supplied was invalid.
297 * - EINVAL - The address supplied was not valid, or the command
298 * was not allowed.
299 * - EMSGSIZE - The message to was too large.
300 * - ENOMEM - Buffers could not be allocated for the command.
301 */
302#define IPMICTL_SEND_COMMAND_SETTIME _IOR(IPMI_IOC_MAGIC, 21, \
303 struct ipmi_req_settime)
304
305/* Messages received from the interface are this format. */
306struct ipmi_recv {
307 int recv_type; /* Is this a command, response or an
308 asyncronous event. */
309
310 unsigned char __user *addr; /* Address the message was from is put
311 here. The caller must supply the
312 memory. */
313 unsigned int addr_len; /* The size of the address buffer.
314 The caller supplies the full buffer
315 length, this value is updated to
316 the actual message length when the
317 message is received. */
318
319 long msgid; /* The sequence number specified in the request
320 if this is a response. If this is a command,
321 this will be the sequence number from the
322 command. */
323
324 struct ipmi_msg msg; /* The data field must point to a buffer.
325 The data_size field must be set to the
326 size of the message buffer. The
327 caller supplies the full buffer
328 length, this value is updated to the
329 actual message length when the message
330 is received. */
331};
332
333/*
334 * Receive a message. error values:
335 * - EAGAIN - no messages in the queue.
336 * - EFAULT - an address supplied was invalid.
337 * - EINVAL - The address supplied was not valid.
338 * - EMSGSIZE - The message to was too large to fit into the message buffer,
339 * the message will be left in the buffer. */
340#define IPMICTL_RECEIVE_MSG _IOWR(IPMI_IOC_MAGIC, 12, \
341 struct ipmi_recv)
342
343/*
344 * Like RECEIVE_MSG, but if the message won't fit in the buffer, it
345 * will truncate the contents instead of leaving the data in the
346 * buffer.
347 */
348#define IPMICTL_RECEIVE_MSG_TRUNC _IOWR(IPMI_IOC_MAGIC, 11, \
349 struct ipmi_recv)
350
351/* Register to get commands from other entities on this interface. */
352struct ipmi_cmdspec {
353 unsigned char netfn;
354 unsigned char cmd;
355};
356
357/*
358 * Register to receive a specific command. error values:
359 * - EFAULT - an address supplied was invalid.
360 * - EBUSY - The netfn/cmd supplied was already in use.
361 * - ENOMEM - could not allocate memory for the entry.
362 */
363#define IPMICTL_REGISTER_FOR_CMD _IOR(IPMI_IOC_MAGIC, 14, \
364 struct ipmi_cmdspec)
365/*
366 * Unregister a regsitered command. error values:
367 * - EFAULT - an address supplied was invalid.
368 * - ENOENT - The netfn/cmd was not found registered for this user.
369 */
370#define IPMICTL_UNREGISTER_FOR_CMD _IOR(IPMI_IOC_MAGIC, 15, \
371 struct ipmi_cmdspec)
372
373/*
374 * Register to get commands from other entities on specific channels.
375 * This way, you can only listen on specific channels, or have messages
376 * from some channels go to one place and other channels to someplace
377 * else. The chans field is a bitmask, (1 << channel) for each channel.
378 * It may be IPMI_CHAN_ALL for all channels.
379 */
380struct ipmi_cmdspec_chans {
381 unsigned int netfn;
382 unsigned int cmd;
383 unsigned int chans;
384};
385
386/*
387 * Register to receive a specific command on specific channels. error values:
388 * - EFAULT - an address supplied was invalid.
389 * - EBUSY - One of the netfn/cmd/chans supplied was already in use.
390 * - ENOMEM - could not allocate memory for the entry.
391 */
392#define IPMICTL_REGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 28, \
393 struct ipmi_cmdspec_chans)
394/*
395 * Unregister some netfn/cmd/chans. error values:
396 * - EFAULT - an address supplied was invalid.
397 * - ENOENT - None of the netfn/cmd/chans were found registered for this user.
398 */
399#define IPMICTL_UNREGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 29, \
400 struct ipmi_cmdspec_chans)
401
402/*
403 * Set whether this interface receives events. Note that the first
404 * user registered for events will get all pending events for the
405 * interface. error values:
406 * - EFAULT - an address supplied was invalid.
407 */
408#define IPMICTL_SET_GETS_EVENTS_CMD _IOR(IPMI_IOC_MAGIC, 16, int)
409
410/*
411 * Set and get the slave address and LUN that we will use for our
412 * source messages. Note that this affects the interface, not just
413 * this user, so it will affect all users of this interface. This is
414 * so some initialization code can come in and do the OEM-specific
415 * things it takes to determine your address (if not the BMC) and set
416 * it for everyone else. You should probably leave the LUN alone.
417 */
418struct ipmi_channel_lun_address_set {
419 unsigned short channel;
420 unsigned char value;
421};
422#define IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD \
423 _IOR(IPMI_IOC_MAGIC, 24, struct ipmi_channel_lun_address_set)
424#define IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD \
425 _IOR(IPMI_IOC_MAGIC, 25, struct ipmi_channel_lun_address_set)
426#define IPMICTL_SET_MY_CHANNEL_LUN_CMD \
427 _IOR(IPMI_IOC_MAGIC, 26, struct ipmi_channel_lun_address_set)
428#define IPMICTL_GET_MY_CHANNEL_LUN_CMD \
429 _IOR(IPMI_IOC_MAGIC, 27, struct ipmi_channel_lun_address_set)
430/* Legacy interfaces, these only set IPMB 0. */
431#define IPMICTL_SET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 17, unsigned int)
432#define IPMICTL_GET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 18, unsigned int)
433#define IPMICTL_SET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 19, unsigned int)
434#define IPMICTL_GET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 20, unsigned int)
435
436/*
437 * Get/set the default timing values for an interface. You shouldn't
438 * generally mess with these.
439 */
440struct ipmi_timing_parms {
441 int retries;
442 unsigned int retry_time_ms;
443};
444#define IPMICTL_SET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 22, \
445 struct ipmi_timing_parms)
446#define IPMICTL_GET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 23, \
447 struct ipmi_timing_parms)
448
449/*
450 * Set the maintenance mode. See ipmi_set_maintenance_mode() above
451 * for a description of what this does.
452 */
453#define IPMICTL_GET_MAINTENANCE_MODE_CMD _IOR(IPMI_IOC_MAGIC, 30, int)
454#define IPMICTL_SET_MAINTENANCE_MODE_CMD _IOW(IPMI_IOC_MAGIC, 31, int)
455
456#endif /* _UAPI__LINUX_IPMI_H */
diff --git a/include/linux/ipmi_msgdefs.h b/include/uapi/linux/ipmi_msgdefs.h
index df97e6e31e87..df97e6e31e87 100644
--- a/include/linux/ipmi_msgdefs.h
+++ b/include/uapi/linux/ipmi_msgdefs.h
diff --git a/include/linux/ipsec.h b/include/uapi/linux/ipsec.h
index d17a6302a0e9..d17a6302a0e9 100644
--- a/include/linux/ipsec.h
+++ b/include/uapi/linux/ipsec.h
diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h
new file mode 100644
index 000000000000..a6d7d1c536c3
--- /dev/null
+++ b/include/uapi/linux/ipv6.h
@@ -0,0 +1,164 @@
1#ifndef _UAPI_IPV6_H
2#define _UAPI_IPV6_H
3
4#include <linux/types.h>
5#include <linux/in6.h>
6#include <asm/byteorder.h>
7
8/* The latest drafts declared increase in minimal mtu up to 1280. */
9
10#define IPV6_MIN_MTU 1280
11
12/*
13 * Advanced API
14 * source interface/address selection, source routing, etc...
15 * *under construction*
16 */
17
18
19struct in6_pktinfo {
20 struct in6_addr ipi6_addr;
21 int ipi6_ifindex;
22};
23
24struct ip6_mtuinfo {
25 struct sockaddr_in6 ip6m_addr;
26 __u32 ip6m_mtu;
27};
28
29struct in6_ifreq {
30 struct in6_addr ifr6_addr;
31 __u32 ifr6_prefixlen;
32 int ifr6_ifindex;
33};
34
35#define IPV6_SRCRT_STRICT 0x01 /* Deprecated; will be removed */
36#define IPV6_SRCRT_TYPE_0 0 /* Deprecated; will be removed */
37#define IPV6_SRCRT_TYPE_2 2 /* IPv6 type 2 Routing Header */
38
39/*
40 * routing header
41 */
42struct ipv6_rt_hdr {
43 __u8 nexthdr;
44 __u8 hdrlen;
45 __u8 type;
46 __u8 segments_left;
47
48 /*
49 * type specific data
50 * variable length field
51 */
52};
53
54
55struct ipv6_opt_hdr {
56 __u8 nexthdr;
57 __u8 hdrlen;
58 /*
59 * TLV encoded option data follows.
60 */
61} __attribute__((packed)); /* required for some archs */
62
63#define ipv6_destopt_hdr ipv6_opt_hdr
64#define ipv6_hopopt_hdr ipv6_opt_hdr
65
66
67/*
68 * routing header type 0 (used in cmsghdr struct)
69 */
70
71struct rt0_hdr {
72 struct ipv6_rt_hdr rt_hdr;
73 __u32 reserved;
74 struct in6_addr addr[0];
75
76#define rt0_type rt_hdr.type
77};
78
79/*
80 * routing header type 2
81 */
82
83struct rt2_hdr {
84 struct ipv6_rt_hdr rt_hdr;
85 __u32 reserved;
86 struct in6_addr addr;
87
88#define rt2_type rt_hdr.type
89};
90
91/*
92 * home address option in destination options header
93 */
94
95struct ipv6_destopt_hao {
96 __u8 type;
97 __u8 length;
98 struct in6_addr addr;
99} __attribute__((packed));
100
101/*
102 * IPv6 fixed header
103 *
104 * BEWARE, it is incorrect. The first 4 bits of flow_lbl
105 * are glued to priority now, forming "class".
106 */
107
108struct ipv6hdr {
109#if defined(__LITTLE_ENDIAN_BITFIELD)
110 __u8 priority:4,
111 version:4;
112#elif defined(__BIG_ENDIAN_BITFIELD)
113 __u8 version:4,
114 priority:4;
115#else
116#error "Please fix <asm/byteorder.h>"
117#endif
118 __u8 flow_lbl[3];
119
120 __be16 payload_len;
121 __u8 nexthdr;
122 __u8 hop_limit;
123
124 struct in6_addr saddr;
125 struct in6_addr daddr;
126};
127
128
129/* index values for the variables in ipv6_devconf */
130enum {
131 DEVCONF_FORWARDING = 0,
132 DEVCONF_HOPLIMIT,
133 DEVCONF_MTU6,
134 DEVCONF_ACCEPT_RA,
135 DEVCONF_ACCEPT_REDIRECTS,
136 DEVCONF_AUTOCONF,
137 DEVCONF_DAD_TRANSMITS,
138 DEVCONF_RTR_SOLICITS,
139 DEVCONF_RTR_SOLICIT_INTERVAL,
140 DEVCONF_RTR_SOLICIT_DELAY,
141 DEVCONF_USE_TEMPADDR,
142 DEVCONF_TEMP_VALID_LFT,
143 DEVCONF_TEMP_PREFERED_LFT,
144 DEVCONF_REGEN_MAX_RETRY,
145 DEVCONF_MAX_DESYNC_FACTOR,
146 DEVCONF_MAX_ADDRESSES,
147 DEVCONF_FORCE_MLD_VERSION,
148 DEVCONF_ACCEPT_RA_DEFRTR,
149 DEVCONF_ACCEPT_RA_PINFO,
150 DEVCONF_ACCEPT_RA_RTR_PREF,
151 DEVCONF_RTR_PROBE_INTERVAL,
152 DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
153 DEVCONF_PROXY_NDP,
154 DEVCONF_OPTIMISTIC_DAD,
155 DEVCONF_ACCEPT_SOURCE_ROUTE,
156 DEVCONF_MC_FORWARDING,
157 DEVCONF_DISABLE_IPV6,
158 DEVCONF_ACCEPT_DAD,
159 DEVCONF_FORCE_TLLAO,
160 DEVCONF_MAX
161};
162
163
164#endif /* _UAPI_IPV6_H */
diff --git a/include/uapi/linux/ipv6_route.h b/include/uapi/linux/ipv6_route.h
new file mode 100644
index 000000000000..0459664c2636
--- /dev/null
+++ b/include/uapi/linux/ipv6_route.h
@@ -0,0 +1,58 @@
1/*
2 * Linux INET6 implementation
3 *
4 * Authors:
5 * Pedro Roque <roque@di.fc.ul.pt>
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
13#ifndef _UAPI_LINUX_IPV6_ROUTE_H
14#define _UAPI_LINUX_IPV6_ROUTE_H
15
16#include <linux/types.h>
17
18#define RTF_DEFAULT 0x00010000 /* default - learned via ND */
19#define RTF_ALLONLINK 0x00020000 /* (deprecated and will be removed)
20 fallback, no routers on link */
21#define RTF_ADDRCONF 0x00040000 /* addrconf route - RA */
22#define RTF_PREFIX_RT 0x00080000 /* A prefix only route - RA */
23#define RTF_ANYCAST 0x00100000 /* Anycast */
24
25#define RTF_NONEXTHOP 0x00200000 /* route with no nexthop */
26#define RTF_EXPIRES 0x00400000
27
28#define RTF_ROUTEINFO 0x00800000 /* route information - RA */
29
30#define RTF_CACHE 0x01000000 /* cache entry */
31#define RTF_FLOW 0x02000000 /* flow significant route */
32#define RTF_POLICY 0x04000000 /* policy route */
33
34#define RTF_PREF(pref) ((pref) << 27)
35#define RTF_PREF_MASK 0x18000000
36
37#define RTF_LOCAL 0x80000000
38
39
40struct in6_rtmsg {
41 struct in6_addr rtmsg_dst;
42 struct in6_addr rtmsg_src;
43 struct in6_addr rtmsg_gateway;
44 __u32 rtmsg_type;
45 __u16 rtmsg_dst_len;
46 __u16 rtmsg_src_len;
47 __u32 rtmsg_metric;
48 unsigned long rtmsg_info;
49 __u32 rtmsg_flags;
50 int rtmsg_ifindex;
51};
52
53#define RTMSG_NEWDEVICE 0x11
54#define RTMSG_DELDEVICE 0x12
55#define RTMSG_NEWROUTE 0x21
56#define RTMSG_DELROUTE 0x22
57
58#endif /* _UAPI_LINUX_IPV6_ROUTE_H */
diff --git a/include/linux/ipx.h b/include/uapi/linux/ipx.h
index 3d48014cdd71..3d48014cdd71 100644
--- a/include/linux/ipx.h
+++ b/include/uapi/linux/ipx.h
diff --git a/include/linux/irda.h b/include/uapi/linux/irda.h
index a014c3252311..a014c3252311 100644
--- a/include/linux/irda.h
+++ b/include/uapi/linux/irda.h
diff --git a/include/uapi/linux/irqnr.h b/include/uapi/linux/irqnr.h
new file mode 100644
index 000000000000..ae5704fa77ad
--- /dev/null
+++ b/include/uapi/linux/irqnr.h
@@ -0,0 +1,4 @@
1/*
2 * There isn't anything here anymore, but the file must not be empty or patch
3 * will delete it.
4 */
diff --git a/include/uapi/linux/isdn.h b/include/uapi/linux/isdn.h
new file mode 100644
index 000000000000..eb1995fffc39
--- /dev/null
+++ b/include/uapi/linux/isdn.h
@@ -0,0 +1,143 @@
1/* $Id: isdn.h,v 1.125.2.3 2004/02/10 01:07:14 keil Exp $
2 *
3 * Main header for the Linux ISDN subsystem (linklevel).
4 *
5 * Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de)
6 * Copyright 1995,96 by Thinking Objects Software GmbH Wuerzburg
7 * Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de)
8 *
9 * This software may be used and distributed according to the terms
10 * of the GNU General Public License, incorporated herein by reference.
11 *
12 */
13
14#ifndef _UAPI__ISDN_H__
15#define _UAPI__ISDN_H__
16
17#include <linux/ioctl.h>
18#include <linux/tty.h>
19
20#define ISDN_MAX_DRIVERS 32
21#define ISDN_MAX_CHANNELS 64
22
23/* New ioctl-codes */
24#define IIOCNETAIF _IO('I',1)
25#define IIOCNETDIF _IO('I',2)
26#define IIOCNETSCF _IO('I',3)
27#define IIOCNETGCF _IO('I',4)
28#define IIOCNETANM _IO('I',5)
29#define IIOCNETDNM _IO('I',6)
30#define IIOCNETGNM _IO('I',7)
31#define IIOCGETSET _IO('I',8) /* no longer supported */
32#define IIOCSETSET _IO('I',9) /* no longer supported */
33#define IIOCSETVER _IO('I',10)
34#define IIOCNETHUP _IO('I',11)
35#define IIOCSETGST _IO('I',12)
36#define IIOCSETBRJ _IO('I',13)
37#define IIOCSIGPRF _IO('I',14)
38#define IIOCGETPRF _IO('I',15)
39#define IIOCSETPRF _IO('I',16)
40#define IIOCGETMAP _IO('I',17)
41#define IIOCSETMAP _IO('I',18)
42#define IIOCNETASL _IO('I',19)
43#define IIOCNETDIL _IO('I',20)
44#define IIOCGETCPS _IO('I',21)
45#define IIOCGETDVR _IO('I',22)
46#define IIOCNETLCR _IO('I',23) /* dwabc ioctl for LCR from isdnlog */
47#define IIOCNETDWRSET _IO('I',24) /* dwabc ioctl to reset abc-values to default on a net-interface */
48
49#define IIOCNETALN _IO('I',32)
50#define IIOCNETDLN _IO('I',33)
51
52#define IIOCNETGPN _IO('I',34)
53
54#define IIOCDBGVAR _IO('I',127)
55
56#define IIOCDRVCTL _IO('I',128)
57
58/* cisco hdlck device private ioctls */
59#define SIOCGKEEPPERIOD (SIOCDEVPRIVATE + 0)
60#define SIOCSKEEPPERIOD (SIOCDEVPRIVATE + 1)
61#define SIOCGDEBSERINT (SIOCDEVPRIVATE + 2)
62#define SIOCSDEBSERINT (SIOCDEVPRIVATE + 3)
63
64/* Packet encapsulations for net-interfaces */
65#define ISDN_NET_ENCAP_ETHER 0
66#define ISDN_NET_ENCAP_RAWIP 1
67#define ISDN_NET_ENCAP_IPTYP 2
68#define ISDN_NET_ENCAP_CISCOHDLC 3 /* Without SLARP and keepalive */
69#define ISDN_NET_ENCAP_SYNCPPP 4
70#define ISDN_NET_ENCAP_UIHDLC 5
71#define ISDN_NET_ENCAP_CISCOHDLCK 6 /* With SLARP and keepalive */
72#define ISDN_NET_ENCAP_X25IFACE 7 /* Documentation/networking/x25-iface.txt */
73#define ISDN_NET_ENCAP_MAX_ENCAP ISDN_NET_ENCAP_X25IFACE
74
75/* Facility which currently uses an ISDN-channel */
76#define ISDN_USAGE_NONE 0
77#define ISDN_USAGE_RAW 1
78#define ISDN_USAGE_MODEM 2
79#define ISDN_USAGE_NET 3
80#define ISDN_USAGE_VOICE 4
81#define ISDN_USAGE_FAX 5
82#define ISDN_USAGE_MASK 7 /* Mask to get plain usage */
83#define ISDN_USAGE_DISABLED 32 /* This bit is set, if channel is disabled */
84#define ISDN_USAGE_EXCLUSIVE 64 /* This bit is set, if channel is exclusive */
85#define ISDN_USAGE_OUTGOING 128 /* This bit is set, if channel is outgoing */
86
87#define ISDN_MODEM_NUMREG 24 /* Number of Modem-Registers */
88#define ISDN_LMSNLEN 255 /* Length of tty's Listen-MSN string */
89#define ISDN_CMSGLEN 50 /* Length of CONNECT-Message to add for Modem */
90
91#define ISDN_MSNLEN 32
92#define NET_DV 0x06 /* Data version for isdn_net_ioctl_cfg */
93#define TTY_DV 0x06 /* Data version for iprofd etc. */
94
95#define INF_DV 0x01 /* Data version for /dev/isdninfo */
96
97typedef struct {
98 char drvid[25];
99 unsigned long arg;
100} isdn_ioctl_struct;
101
102typedef struct {
103 char name[10];
104 char phone[ISDN_MSNLEN];
105 int outgoing;
106} isdn_net_ioctl_phone;
107
108typedef struct {
109 char name[10]; /* Name of interface */
110 char master[10]; /* Name of Master for Bundling */
111 char slave[10]; /* Name of Slave for Bundling */
112 char eaz[256]; /* EAZ/MSN */
113 char drvid[25]; /* DriverId for Bindings */
114 int onhtime; /* Hangup-Timeout */
115 int charge; /* Charge-Units */
116 int l2_proto; /* Layer-2 protocol */
117 int l3_proto; /* Layer-3 protocol */
118 int p_encap; /* Encapsulation */
119 int exclusive; /* Channel, if bound exclusive */
120 int dialmax; /* Dial Retry-Counter */
121 int slavedelay; /* Delay until slave starts up */
122 int cbdelay; /* Delay before Callback */
123 int chargehup; /* Flag: Charge-Hangup */
124 int ihup; /* Flag: Hangup-Timeout on incoming line */
125 int secure; /* Flag: Secure */
126 int callback; /* Flag: Callback */
127 int cbhup; /* Flag: Reject Call before Callback */
128 int pppbind; /* ippp device for bindings */
129 int chargeint; /* Use fixed charge interval length */
130 int triggercps; /* BogoCPS needed for triggering slave */
131 int dialtimeout; /* Dial-Timeout */
132 int dialwait; /* Time to wait after failed dial */
133 int dialmode; /* Flag: off / on / auto */
134} isdn_net_ioctl_cfg;
135
136#define ISDN_NET_DIALMODE_MASK 0xC0 /* bits for status */
137#define ISDN_NET_DM_OFF 0x00 /* this interface is stopped */
138#define ISDN_NET_DM_MANUAL 0x40 /* this interface is on (manual) */
139#define ISDN_NET_DM_AUTO 0x80 /* this interface is autodial */
140#define ISDN_NET_DIALMODE(x) ((&(x))->flags & ISDN_NET_DIALMODE_MASK)
141
142
143#endif /* _UAPI__ISDN_H__ */
diff --git a/include/uapi/linux/isdn/Kbuild b/include/uapi/linux/isdn/Kbuild
index aafaa5aa54d4..89e52850bf29 100644
--- a/include/uapi/linux/isdn/Kbuild
+++ b/include/uapi/linux/isdn/Kbuild
@@ -1 +1,2 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += capicmd.h
diff --git a/include/linux/isdn/capicmd.h b/include/uapi/linux/isdn/capicmd.h
index b58635f722da..b58635f722da 100644
--- a/include/linux/isdn/capicmd.h
+++ b/include/uapi/linux/isdn/capicmd.h
diff --git a/include/uapi/linux/isdn_divertif.h b/include/uapi/linux/isdn_divertif.h
new file mode 100644
index 000000000000..3e3c2d898416
--- /dev/null
+++ b/include/uapi/linux/isdn_divertif.h
@@ -0,0 +1,30 @@
1/* $Id: isdn_divertif.h,v 1.4.6.1 2001/09/23 22:25:05 kai Exp $
2 *
3 * Header for the diversion supplementary interface for i4l.
4 *
5 * Author Werner Cornelius (werner@titro.de)
6 * Copyright by Werner Cornelius (werner@titro.de)
7 *
8 * This software may be used and distributed according to the terms
9 * of the GNU General Public License, incorporated herein by reference.
10 *
11 */
12
13#ifndef _UAPI_LINUX_ISDN_DIVERTIF_H
14#define _UAPI_LINUX_ISDN_DIVERTIF_H
15
16/***********************************************************/
17/* magic value is also used to control version information */
18/***********************************************************/
19#define DIVERT_IF_MAGIC 0x25873401
20#define DIVERT_CMD_REG 0x00 /* register command */
21#define DIVERT_CMD_REL 0x01 /* release command */
22#define DIVERT_NO_ERR 0x00 /* return value no error */
23#define DIVERT_CMD_ERR 0x01 /* invalid cmd */
24#define DIVERT_VER_ERR 0x02 /* magic/version invalid */
25#define DIVERT_REG_ERR 0x03 /* module already registered */
26#define DIVERT_REL_ERR 0x04 /* module not registered */
27#define DIVERT_REG_NAME isdn_register_divert
28
29
30#endif /* _UAPI_LINUX_ISDN_DIVERTIF_H */
diff --git a/include/uapi/linux/isdn_ppp.h b/include/uapi/linux/isdn_ppp.h
new file mode 100644
index 000000000000..e7d7bd2aed3f
--- /dev/null
+++ b/include/uapi/linux/isdn_ppp.h
@@ -0,0 +1,67 @@
1/* Linux ISDN subsystem, sync PPP, interface to ipppd
2 *
3 * Copyright 1994-1999 by Fritz Elfert (fritz@isdn4linux.de)
4 * Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg
5 * Copyright 1995,96 by Michael Hipp (Michael.Hipp@student.uni-tuebingen.de)
6 * Copyright 2000-2002 by Kai Germaschewski (kai@germaschewski.name)
7 *
8 * This software may be used and distributed according to the terms
9 * of the GNU General Public License, incorporated herein by reference.
10 *
11 */
12
13#ifndef _UAPI_LINUX_ISDN_PPP_H
14#define _UAPI_LINUX_ISDN_PPP_H
15
16#define CALLTYPE_INCOMING 0x1
17#define CALLTYPE_OUTGOING 0x2
18#define CALLTYPE_CALLBACK 0x4
19
20#define IPPP_VERSION "2.2.0"
21
22struct pppcallinfo
23{
24 int calltype;
25 unsigned char local_num[64];
26 unsigned char remote_num[64];
27 int charge_units;
28};
29
30#define PPPIOCGCALLINFO _IOWR('t',128,struct pppcallinfo)
31#define PPPIOCBUNDLE _IOW('t',129,int)
32#define PPPIOCGMPFLAGS _IOR('t',130,int)
33#define PPPIOCSMPFLAGS _IOW('t',131,int)
34#define PPPIOCSMPMTU _IOW('t',132,int)
35#define PPPIOCSMPMRU _IOW('t',133,int)
36#define PPPIOCGCOMPRESSORS _IOR('t',134,unsigned long [8])
37#define PPPIOCSCOMPRESSOR _IOW('t',135,int)
38#define PPPIOCGIFNAME _IOR('t',136, char [IFNAMSIZ] )
39
40
41#define SC_MP_PROT 0x00000200
42#define SC_REJ_MP_PROT 0x00000400
43#define SC_OUT_SHORT_SEQ 0x00000800
44#define SC_IN_SHORT_SEQ 0x00004000
45
46#define SC_DECOMP_ON 0x01
47#define SC_COMP_ON 0x02
48#define SC_DECOMP_DISCARD 0x04
49#define SC_COMP_DISCARD 0x08
50#define SC_LINK_DECOMP_ON 0x10
51#define SC_LINK_COMP_ON 0x20
52#define SC_LINK_DECOMP_DISCARD 0x40
53#define SC_LINK_COMP_DISCARD 0x80
54
55#define ISDN_PPP_COMP_MAX_OPTIONS 16
56
57#define IPPP_COMP_FLAG_XMIT 0x1
58#define IPPP_COMP_FLAG_LINK 0x2
59
60struct isdn_ppp_comp_data {
61 int num;
62 unsigned char options[ISDN_PPP_COMP_MAX_OPTIONS];
63 int optlen;
64 int flags;
65};
66
67#endif /* _UAPI_LINUX_ISDN_PPP_H */
diff --git a/include/uapi/linux/isdnif.h b/include/uapi/linux/isdnif.h
new file mode 100644
index 000000000000..246138c01c4d
--- /dev/null
+++ b/include/uapi/linux/isdnif.h
@@ -0,0 +1,56 @@
1/* $Id: isdnif.h,v 1.43.2.2 2004/01/12 23:08:35 keil Exp $
2 *
3 * Linux ISDN subsystem
4 * Definition of the interface between the subsystem and its low-level drivers.
5 *
6 * Copyright 1994,95,96 by Fritz Elfert (fritz@isdn4linux.de)
7 * Copyright 1995,96 Thinking Objects Software GmbH Wuerzburg
8 *
9 * This software may be used and distributed according to the terms
10 * of the GNU General Public License, incorporated herein by reference.
11 *
12 */
13
14#ifndef _UAPI__ISDNIF_H__
15#define _UAPI__ISDNIF_H__
16
17
18/*
19 * Values for general protocol-selection
20 */
21#define ISDN_PTYPE_UNKNOWN 0 /* Protocol undefined */
22#define ISDN_PTYPE_1TR6 1 /* german 1TR6-protocol */
23#define ISDN_PTYPE_EURO 2 /* EDSS1-protocol */
24#define ISDN_PTYPE_LEASED 3 /* for leased lines */
25#define ISDN_PTYPE_NI1 4 /* US NI-1 protocol */
26#define ISDN_PTYPE_MAX 7 /* Max. 8 Protocols */
27
28/*
29 * Values for Layer-2-protocol-selection
30 */
31#define ISDN_PROTO_L2_X75I 0 /* X75/LAPB with I-Frames */
32#define ISDN_PROTO_L2_X75UI 1 /* X75/LAPB with UI-Frames */
33#define ISDN_PROTO_L2_X75BUI 2 /* X75/LAPB with UI-Frames */
34#define ISDN_PROTO_L2_HDLC 3 /* HDLC */
35#define ISDN_PROTO_L2_TRANS 4 /* Transparent (Voice) */
36#define ISDN_PROTO_L2_X25DTE 5 /* X25/LAPB DTE mode */
37#define ISDN_PROTO_L2_X25DCE 6 /* X25/LAPB DCE mode */
38#define ISDN_PROTO_L2_V11096 7 /* V.110 bitrate adaption 9600 Baud */
39#define ISDN_PROTO_L2_V11019 8 /* V.110 bitrate adaption 19200 Baud */
40#define ISDN_PROTO_L2_V11038 9 /* V.110 bitrate adaption 38400 Baud */
41#define ISDN_PROTO_L2_MODEM 10 /* Analog Modem on Board */
42#define ISDN_PROTO_L2_FAX 11 /* Fax Group 2/3 */
43#define ISDN_PROTO_L2_HDLC_56K 12 /* HDLC 56k */
44#define ISDN_PROTO_L2_MAX 15 /* Max. 16 Protocols */
45
46/*
47 * Values for Layer-3-protocol-selection
48 */
49#define ISDN_PROTO_L3_TRANS 0 /* Transparent */
50#define ISDN_PROTO_L3_TRANSDSP 1 /* Transparent with DSP */
51#define ISDN_PROTO_L3_FCLASS2 2 /* Fax Group 2/3 CLASS 2 */
52#define ISDN_PROTO_L3_FCLASS1 3 /* Fax Group 2/3 CLASS 1 */
53#define ISDN_PROTO_L3_MAX 7 /* Max. 8 Protocols */
54
55
56#endif /* _UAPI__ISDNIF_H__ */
diff --git a/include/linux/iso_fs.h b/include/uapi/linux/iso_fs.h
index 4688ac4284e2..4688ac4284e2 100644
--- a/include/linux/iso_fs.h
+++ b/include/uapi/linux/iso_fs.h
diff --git a/include/linux/ivtv.h b/include/uapi/linux/ivtv.h
index 42bf725751af..42bf725751af 100644
--- a/include/linux/ivtv.h
+++ b/include/uapi/linux/ivtv.h
diff --git a/include/linux/ivtvfb.h b/include/uapi/linux/ivtvfb.h
index e8b92f67f10d..e8b92f67f10d 100644
--- a/include/linux/ivtvfb.h
+++ b/include/uapi/linux/ivtvfb.h
diff --git a/include/linux/ixjuser.h b/include/uapi/linux/ixjuser.h
index 94ab5e942e53..94ab5e942e53 100644
--- a/include/linux/ixjuser.h
+++ b/include/uapi/linux/ixjuser.h
diff --git a/include/linux/jffs2.h b/include/uapi/linux/jffs2.h
index a18b719f49d4..a18b719f49d4 100644
--- a/include/linux/jffs2.h
+++ b/include/uapi/linux/jffs2.h
diff --git a/include/uapi/linux/joystick.h b/include/uapi/linux/joystick.h
new file mode 100644
index 000000000000..b856fd11c70e
--- /dev/null
+++ b/include/uapi/linux/joystick.h
@@ -0,0 +1,136 @@
1/*
2 * Copyright (C) 1996-2000 Vojtech Pavlik
3 *
4 * Sponsored by SuSE
5 */
6/*
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * Should you need to contact me, the author, you can do so either by
22 * e-mail - mail your message to <vojtech@suse.cz>, or by paper mail:
23 * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic
24 */
25#ifndef _UAPI_LINUX_JOYSTICK_H
26#define _UAPI_LINUX_JOYSTICK_H
27
28
29
30#include <linux/types.h>
31#include <linux/input.h>
32
33/*
34 * Version
35 */
36
37#define JS_VERSION 0x020100
38
39/*
40 * Types and constants for reading from /dev/js
41 */
42
43#define JS_EVENT_BUTTON 0x01 /* button pressed/released */
44#define JS_EVENT_AXIS 0x02 /* joystick moved */
45#define JS_EVENT_INIT 0x80 /* initial state of device */
46
47struct js_event {
48 __u32 time; /* event timestamp in milliseconds */
49 __s16 value; /* value */
50 __u8 type; /* event type */
51 __u8 number; /* axis/button number */
52};
53
54/*
55 * IOCTL commands for joystick driver
56 */
57
58#define JSIOCGVERSION _IOR('j', 0x01, __u32) /* get driver version */
59
60#define JSIOCGAXES _IOR('j', 0x11, __u8) /* get number of axes */
61#define JSIOCGBUTTONS _IOR('j', 0x12, __u8) /* get number of buttons */
62#define JSIOCGNAME(len) _IOC(_IOC_READ, 'j', 0x13, len) /* get identifier string */
63
64#define JSIOCSCORR _IOW('j', 0x21, struct js_corr) /* set correction values */
65#define JSIOCGCORR _IOR('j', 0x22, struct js_corr) /* get correction values */
66
67#define JSIOCSAXMAP _IOW('j', 0x31, __u8[ABS_CNT]) /* set axis mapping */
68#define JSIOCGAXMAP _IOR('j', 0x32, __u8[ABS_CNT]) /* get axis mapping */
69#define JSIOCSBTNMAP _IOW('j', 0x33, __u16[KEY_MAX - BTN_MISC + 1]) /* set button mapping */
70#define JSIOCGBTNMAP _IOR('j', 0x34, __u16[KEY_MAX - BTN_MISC + 1]) /* get button mapping */
71
72/*
73 * Types and constants for get/set correction
74 */
75
76#define JS_CORR_NONE 0x00 /* returns raw values */
77#define JS_CORR_BROKEN 0x01 /* broken line */
78
79struct js_corr {
80 __s32 coef[8];
81 __s16 prec;
82 __u16 type;
83};
84
85/*
86 * v0.x compatibility definitions
87 */
88
89#define JS_RETURN sizeof(struct JS_DATA_TYPE)
90#define JS_TRUE 1
91#define JS_FALSE 0
92#define JS_X_0 0x01
93#define JS_Y_0 0x02
94#define JS_X_1 0x04
95#define JS_Y_1 0x08
96#define JS_MAX 2
97
98#define JS_DEF_TIMEOUT 0x1300
99#define JS_DEF_CORR 0
100#define JS_DEF_TIMELIMIT 10L
101
102#define JS_SET_CAL 1
103#define JS_GET_CAL 2
104#define JS_SET_TIMEOUT 3
105#define JS_GET_TIMEOUT 4
106#define JS_SET_TIMELIMIT 5
107#define JS_GET_TIMELIMIT 6
108#define JS_GET_ALL 7
109#define JS_SET_ALL 8
110
111struct JS_DATA_TYPE {
112 __s32 buttons;
113 __s32 x;
114 __s32 y;
115};
116
117struct JS_DATA_SAVE_TYPE_32 {
118 __s32 JS_TIMEOUT;
119 __s32 BUSY;
120 __s32 JS_EXPIRETIME;
121 __s32 JS_TIMELIMIT;
122 struct JS_DATA_TYPE JS_SAVE;
123 struct JS_DATA_TYPE JS_CORR;
124};
125
126struct JS_DATA_SAVE_TYPE_64 {
127 __s32 JS_TIMEOUT;
128 __s32 BUSY;
129 __s64 JS_EXPIRETIME;
130 __s64 JS_TIMELIMIT;
131 struct JS_DATA_TYPE JS_SAVE;
132 struct JS_DATA_TYPE JS_CORR;
133};
134
135
136#endif /* _UAPI_LINUX_JOYSTICK_H */
diff --git a/include/uapi/linux/kd.h b/include/uapi/linux/kd.h
new file mode 100644
index 000000000000..87b7cc439d7c
--- /dev/null
+++ b/include/uapi/linux/kd.h
@@ -0,0 +1,183 @@
1#ifndef _UAPI_LINUX_KD_H
2#define _UAPI_LINUX_KD_H
3#include <linux/types.h>
4#include <linux/compiler.h>
5
6/* 0x4B is 'K', to avoid collision with termios and vt */
7
8#define GIO_FONT 0x4B60 /* gets font in expanded form */
9#define PIO_FONT 0x4B61 /* use font in expanded form */
10
11#define GIO_FONTX 0x4B6B /* get font using struct consolefontdesc */
12#define PIO_FONTX 0x4B6C /* set font using struct consolefontdesc */
13struct consolefontdesc {
14 unsigned short charcount; /* characters in font (256 or 512) */
15 unsigned short charheight; /* scan lines per character (1-32) */
16 char __user *chardata; /* font data in expanded form */
17};
18
19#define PIO_FONTRESET 0x4B6D /* reset to default font */
20
21#define GIO_CMAP 0x4B70 /* gets colour palette on VGA+ */
22#define PIO_CMAP 0x4B71 /* sets colour palette on VGA+ */
23
24#define KIOCSOUND 0x4B2F /* start sound generation (0 for off) */
25#define KDMKTONE 0x4B30 /* generate tone */
26
27#define KDGETLED 0x4B31 /* return current led state */
28#define KDSETLED 0x4B32 /* set led state [lights, not flags] */
29#define LED_SCR 0x01 /* scroll lock led */
30#define LED_NUM 0x02 /* num lock led */
31#define LED_CAP 0x04 /* caps lock led */
32
33#define KDGKBTYPE 0x4B33 /* get keyboard type */
34#define KB_84 0x01
35#define KB_101 0x02 /* this is what we always answer */
36#define KB_OTHER 0x03
37
38#define KDADDIO 0x4B34 /* add i/o port as valid */
39#define KDDELIO 0x4B35 /* del i/o port as valid */
40#define KDENABIO 0x4B36 /* enable i/o to video board */
41#define KDDISABIO 0x4B37 /* disable i/o to video board */
42
43#define KDSETMODE 0x4B3A /* set text/graphics mode */
44#define KD_TEXT 0x00
45#define KD_GRAPHICS 0x01
46#define KD_TEXT0 0x02 /* obsolete */
47#define KD_TEXT1 0x03 /* obsolete */
48#define KDGETMODE 0x4B3B /* get current mode */
49
50#define KDMAPDISP 0x4B3C /* map display into address space */
51#define KDUNMAPDISP 0x4B3D /* unmap display from address space */
52
53typedef char scrnmap_t;
54#define E_TABSZ 256
55#define GIO_SCRNMAP 0x4B40 /* get screen mapping from kernel */
56#define PIO_SCRNMAP 0x4B41 /* put screen mapping table in kernel */
57#define GIO_UNISCRNMAP 0x4B69 /* get full Unicode screen mapping */
58#define PIO_UNISCRNMAP 0x4B6A /* set full Unicode screen mapping */
59
60#define GIO_UNIMAP 0x4B66 /* get unicode-to-font mapping from kernel */
61struct unipair {
62 unsigned short unicode;
63 unsigned short fontpos;
64};
65struct unimapdesc {
66 unsigned short entry_ct;
67 struct unipair __user *entries;
68};
69#define PIO_UNIMAP 0x4B67 /* put unicode-to-font mapping in kernel */
70#define PIO_UNIMAPCLR 0x4B68 /* clear table, possibly advise hash algorithm */
71struct unimapinit {
72 unsigned short advised_hashsize; /* 0 if no opinion */
73 unsigned short advised_hashstep; /* 0 if no opinion */
74 unsigned short advised_hashlevel; /* 0 if no opinion */
75};
76
77#define UNI_DIRECT_BASE 0xF000 /* start of Direct Font Region */
78#define UNI_DIRECT_MASK 0x01FF /* Direct Font Region bitmask */
79
80#define K_RAW 0x00
81#define K_XLATE 0x01
82#define K_MEDIUMRAW 0x02
83#define K_UNICODE 0x03
84#define K_OFF 0x04
85#define KDGKBMODE 0x4B44 /* gets current keyboard mode */
86#define KDSKBMODE 0x4B45 /* sets current keyboard mode */
87
88#define K_METABIT 0x03
89#define K_ESCPREFIX 0x04
90#define KDGKBMETA 0x4B62 /* gets meta key handling mode */
91#define KDSKBMETA 0x4B63 /* sets meta key handling mode */
92
93#define K_SCROLLLOCK 0x01
94#define K_NUMLOCK 0x02
95#define K_CAPSLOCK 0x04
96#define KDGKBLED 0x4B64 /* get led flags (not lights) */
97#define KDSKBLED 0x4B65 /* set led flags (not lights) */
98
99struct kbentry {
100 unsigned char kb_table;
101 unsigned char kb_index;
102 unsigned short kb_value;
103};
104#define K_NORMTAB 0x00
105#define K_SHIFTTAB 0x01
106#define K_ALTTAB 0x02
107#define K_ALTSHIFTTAB 0x03
108
109#define KDGKBENT 0x4B46 /* gets one entry in translation table */
110#define KDSKBENT 0x4B47 /* sets one entry in translation table */
111
112struct kbsentry {
113 unsigned char kb_func;
114 unsigned char kb_string[512];
115};
116#define KDGKBSENT 0x4B48 /* gets one function key string entry */
117#define KDSKBSENT 0x4B49 /* sets one function key string entry */
118
119struct kbdiacr {
120 unsigned char diacr, base, result;
121};
122struct kbdiacrs {
123 unsigned int kb_cnt; /* number of entries in following array */
124 struct kbdiacr kbdiacr[256]; /* MAX_DIACR from keyboard.h */
125};
126#define KDGKBDIACR 0x4B4A /* read kernel accent table */
127#define KDSKBDIACR 0x4B4B /* write kernel accent table */
128
129struct kbdiacruc {
130 unsigned int diacr, base, result;
131};
132struct kbdiacrsuc {
133 unsigned int kb_cnt; /* number of entries in following array */
134 struct kbdiacruc kbdiacruc[256]; /* MAX_DIACR from keyboard.h */
135};
136#define KDGKBDIACRUC 0x4BFA /* read kernel accent table - UCS */
137#define KDSKBDIACRUC 0x4BFB /* write kernel accent table - UCS */
138
139struct kbkeycode {
140 unsigned int scancode, keycode;
141};
142#define KDGETKEYCODE 0x4B4C /* read kernel keycode table entry */
143#define KDSETKEYCODE 0x4B4D /* write kernel keycode table entry */
144
145#define KDSIGACCEPT 0x4B4E /* accept kbd generated signals */
146
147struct kbd_repeat {
148 int delay; /* in msec; <= 0: don't change */
149 int period; /* in msec; <= 0: don't change */
150 /* earlier this field was misnamed "rate" */
151};
152
153#define KDKBDREP 0x4B52 /* set keyboard delay/repeat rate;
154 * actually used values are returned */
155
156#define KDFONTOP 0x4B72 /* font operations */
157
158struct console_font_op {
159 unsigned int op; /* operation code KD_FONT_OP_* */
160 unsigned int flags; /* KD_FONT_FLAG_* */
161 unsigned int width, height; /* font size */
162 unsigned int charcount;
163 unsigned char __user *data; /* font data with height fixed to 32 */
164};
165
166struct console_font {
167 unsigned int width, height; /* font size */
168 unsigned int charcount;
169 unsigned char *data; /* font data with height fixed to 32 */
170};
171
172#define KD_FONT_OP_SET 0 /* Set font */
173#define KD_FONT_OP_GET 1 /* Get font */
174#define KD_FONT_OP_SET_DEFAULT 2 /* Set font to default, data points to name / NULL */
175#define KD_FONT_OP_COPY 3 /* Copy from another console */
176
177#define KD_FONT_FLAG_DONT_RECALC 1 /* Don't recalculate hw charcell size [compat] */
178
179/* note: 0x4B00-0x4B4E all have had a value at some time;
180 don't reuse for the time being */
181/* note: 0x4B60-0x4B6D, 0x4B70-0x4B72 used above */
182
183#endif /* _UAPI_LINUX_KD_H */
diff --git a/include/uapi/linux/kdev_t.h b/include/uapi/linux/kdev_t.h
new file mode 100644
index 000000000000..0d881fa7eb9c
--- /dev/null
+++ b/include/uapi/linux/kdev_t.h
@@ -0,0 +1,13 @@
1#ifndef _UAPI_LINUX_KDEV_T_H
2#define _UAPI_LINUX_KDEV_T_H
3#ifndef __KERNEL__
4
5/*
6Some programs want their definitions of MAJOR and MINOR and MKDEV
7from the kernel sources. These must be the externally visible ones.
8*/
9#define MAJOR(dev) ((dev)>>8)
10#define MINOR(dev) ((dev) & 0xff)
11#define MKDEV(ma,mi) ((ma)<<8 | (mi))
12#endif /* __KERNEL__ */
13#endif /* _UAPI_LINUX_KDEV_T_H */
diff --git a/include/uapi/linux/kernel-page-flags.h b/include/uapi/linux/kernel-page-flags.h
new file mode 100644
index 000000000000..5116a0e48172
--- /dev/null
+++ b/include/uapi/linux/kernel-page-flags.h
@@ -0,0 +1,36 @@
1#ifndef _UAPILINUX_KERNEL_PAGE_FLAGS_H
2#define _UAPILINUX_KERNEL_PAGE_FLAGS_H
3
4/*
5 * Stable page flag bits exported to user space
6 */
7
8#define KPF_LOCKED 0
9#define KPF_ERROR 1
10#define KPF_REFERENCED 2
11#define KPF_UPTODATE 3
12#define KPF_DIRTY 4
13#define KPF_LRU 5
14#define KPF_ACTIVE 6
15#define KPF_SLAB 7
16#define KPF_WRITEBACK 8
17#define KPF_RECLAIM 9
18#define KPF_BUDDY 10
19
20/* 11-20: new additions in 2.6.31 */
21#define KPF_MMAP 11
22#define KPF_ANON 12
23#define KPF_SWAPCACHE 13
24#define KPF_SWAPBACKED 14
25#define KPF_COMPOUND_HEAD 15
26#define KPF_COMPOUND_TAIL 16
27#define KPF_HUGE 17
28#define KPF_UNEVICTABLE 18
29#define KPF_HWPOISON 19
30#define KPF_NOPAGE 20
31
32#define KPF_KSM 21
33#define KPF_THP 22
34
35
36#endif /* _UAPILINUX_KERNEL_PAGE_FLAGS_H */
diff --git a/include/uapi/linux/kernel.h b/include/uapi/linux/kernel.h
new file mode 100644
index 000000000000..321e399457f5
--- /dev/null
+++ b/include/uapi/linux/kernel.h
@@ -0,0 +1,13 @@
1#ifndef _UAPI_LINUX_KERNEL_H
2#define _UAPI_LINUX_KERNEL_H
3
4#include <linux/sysinfo.h>
5
6/*
7 * 'kernel.h' contains some often-used function prototypes etc
8 */
9#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
10#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
11
12
13#endif /* _UAPI_LINUX_KERNEL_H */
diff --git a/include/uapi/linux/kernelcapi.h b/include/uapi/linux/kernelcapi.h
new file mode 100644
index 000000000000..89bf40d36d2a
--- /dev/null
+++ b/include/uapi/linux/kernelcapi.h
@@ -0,0 +1,47 @@
1/*
2 * $Id: kernelcapi.h,v 1.8.6.2 2001/02/07 11:31:31 kai Exp $
3 *
4 * Kernel CAPI 2.0 Interface for Linux
5 *
6 * (c) Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
7 *
8 */
9
10#ifndef _UAPI__KERNELCAPI_H__
11#define _UAPI__KERNELCAPI_H__
12
13#define CAPI_MAXAPPL 240 /* maximum number of applications */
14#define CAPI_MAXCONTR 32 /* maximum number of controller */
15#define CAPI_MAXDATAWINDOW 8
16
17
18typedef struct kcapi_flagdef {
19 int contr;
20 int flag;
21} kcapi_flagdef;
22
23typedef struct kcapi_carddef {
24 char driver[32];
25 unsigned int port;
26 unsigned irq;
27 unsigned int membase;
28 int cardnr;
29} kcapi_carddef;
30
31/* new ioctls >= 10 */
32#define KCAPI_CMD_TRACE 10
33#define KCAPI_CMD_ADDCARD 11 /* OBSOLETE */
34
35/*
36 * flag > 2 => trace also data
37 * flag & 1 => show trace
38 */
39#define KCAPI_TRACE_OFF 0
40#define KCAPI_TRACE_SHORT_NO_DATA 1
41#define KCAPI_TRACE_FULL_NO_DATA 2
42#define KCAPI_TRACE_SHORT 3
43#define KCAPI_TRACE_FULL 4
44
45
46
47#endif /* _UAPI__KERNELCAPI_H__ */
diff --git a/include/uapi/linux/kexec.h b/include/uapi/linux/kexec.h
new file mode 100644
index 000000000000..104838f65bc1
--- /dev/null
+++ b/include/uapi/linux/kexec.h
@@ -0,0 +1,54 @@
1#ifndef _UAPILINUX_KEXEC_H
2#define _UAPILINUX_KEXEC_H
3
4/* kexec system call - It loads the new kernel to boot into.
5 * kexec does not sync, or unmount filesystems so if you need
6 * that to happen you need to do that yourself.
7 */
8
9#include <linux/types.h>
10
11/* kexec flags for different usage scenarios */
12#define KEXEC_ON_CRASH 0x00000001
13#define KEXEC_PRESERVE_CONTEXT 0x00000002
14#define KEXEC_ARCH_MASK 0xffff0000
15
16/* These values match the ELF architecture values.
17 * Unless there is a good reason that should continue to be the case.
18 */
19#define KEXEC_ARCH_DEFAULT ( 0 << 16)
20#define KEXEC_ARCH_386 ( 3 << 16)
21#define KEXEC_ARCH_X86_64 (62 << 16)
22#define KEXEC_ARCH_PPC (20 << 16)
23#define KEXEC_ARCH_PPC64 (21 << 16)
24#define KEXEC_ARCH_IA_64 (50 << 16)
25#define KEXEC_ARCH_ARM (40 << 16)
26#define KEXEC_ARCH_S390 (22 << 16)
27#define KEXEC_ARCH_SH (42 << 16)
28#define KEXEC_ARCH_MIPS_LE (10 << 16)
29#define KEXEC_ARCH_MIPS ( 8 << 16)
30
31/* The artificial cap on the number of segments passed to kexec_load. */
32#define KEXEC_SEGMENT_MAX 16
33
34#ifndef __KERNEL__
35/*
36 * This structure is used to hold the arguments that are used when
37 * loading kernel binaries.
38 */
39struct kexec_segment {
40 const void *buf;
41 size_t bufsz;
42 const void *mem;
43 size_t memsz;
44};
45
46/* Load a new kernel image as described by the kexec_segment array
47 * consisting of passed number of segments at the entry-point address.
48 * The flags allow different useage types.
49 */
50extern int kexec_load(void *, size_t, struct kexec_segment *,
51 unsigned long int);
52#endif /* __KERNEL__ */
53
54#endif /* _UAPILINUX_KEXEC_H */
diff --git a/include/uapi/linux/keyboard.h b/include/uapi/linux/keyboard.h
new file mode 100644
index 000000000000..5a6849721ab6
--- /dev/null
+++ b/include/uapi/linux/keyboard.h
@@ -0,0 +1,443 @@
1#ifndef _UAPI__LINUX_KEYBOARD_H
2#define _UAPI__LINUX_KEYBOARD_H
3
4#include <linux/wait.h>
5
6#define KG_SHIFT 0
7#define KG_CTRL 2
8#define KG_ALT 3
9#define KG_ALTGR 1
10#define KG_SHIFTL 4
11#define KG_KANASHIFT 4
12#define KG_SHIFTR 5
13#define KG_CTRLL 6
14#define KG_CTRLR 7
15#define KG_CAPSSHIFT 8
16
17#define NR_SHIFT 9
18
19#define NR_KEYS 256
20#define MAX_NR_KEYMAPS 256
21/* This means 128Kb if all keymaps are allocated. Only the superuser
22 may increase the number of keymaps beyond MAX_NR_OF_USER_KEYMAPS. */
23#define MAX_NR_OF_USER_KEYMAPS 256 /* should be at least 7 */
24
25
26#define MAX_NR_FUNC 256 /* max nr of strings assigned to keys */
27
28#define KT_LATIN 0 /* we depend on this being zero */
29#define KT_LETTER 11 /* symbol that can be acted upon by CapsLock */
30#define KT_FN 1
31#define KT_SPEC 2
32#define KT_PAD 3
33#define KT_DEAD 4
34#define KT_CONS 5
35#define KT_CUR 6
36#define KT_SHIFT 7
37#define KT_META 8
38#define KT_ASCII 9
39#define KT_LOCK 10
40#define KT_SLOCK 12
41#define KT_DEAD2 13
42#define KT_BRL 14
43
44#define K(t,v) (((t)<<8)|(v))
45#define KTYP(x) ((x) >> 8)
46#define KVAL(x) ((x) & 0xff)
47
48#define K_F1 K(KT_FN,0)
49#define K_F2 K(KT_FN,1)
50#define K_F3 K(KT_FN,2)
51#define K_F4 K(KT_FN,3)
52#define K_F5 K(KT_FN,4)
53#define K_F6 K(KT_FN,5)
54#define K_F7 K(KT_FN,6)
55#define K_F8 K(KT_FN,7)
56#define K_F9 K(KT_FN,8)
57#define K_F10 K(KT_FN,9)
58#define K_F11 K(KT_FN,10)
59#define K_F12 K(KT_FN,11)
60#define K_F13 K(KT_FN,12)
61#define K_F14 K(KT_FN,13)
62#define K_F15 K(KT_FN,14)
63#define K_F16 K(KT_FN,15)
64#define K_F17 K(KT_FN,16)
65#define K_F18 K(KT_FN,17)
66#define K_F19 K(KT_FN,18)
67#define K_F20 K(KT_FN,19)
68#define K_FIND K(KT_FN,20)
69#define K_INSERT K(KT_FN,21)
70#define K_REMOVE K(KT_FN,22)
71#define K_SELECT K(KT_FN,23)
72#define K_PGUP K(KT_FN,24) /* PGUP is a synonym for PRIOR */
73#define K_PGDN K(KT_FN,25) /* PGDN is a synonym for NEXT */
74#define K_MACRO K(KT_FN,26)
75#define K_HELP K(KT_FN,27)
76#define K_DO K(KT_FN,28)
77#define K_PAUSE K(KT_FN,29)
78#define K_F21 K(KT_FN,30)
79#define K_F22 K(KT_FN,31)
80#define K_F23 K(KT_FN,32)
81#define K_F24 K(KT_FN,33)
82#define K_F25 K(KT_FN,34)
83#define K_F26 K(KT_FN,35)
84#define K_F27 K(KT_FN,36)
85#define K_F28 K(KT_FN,37)
86#define K_F29 K(KT_FN,38)
87#define K_F30 K(KT_FN,39)
88#define K_F31 K(KT_FN,40)
89#define K_F32 K(KT_FN,41)
90#define K_F33 K(KT_FN,42)
91#define K_F34 K(KT_FN,43)
92#define K_F35 K(KT_FN,44)
93#define K_F36 K(KT_FN,45)
94#define K_F37 K(KT_FN,46)
95#define K_F38 K(KT_FN,47)
96#define K_F39 K(KT_FN,48)
97#define K_F40 K(KT_FN,49)
98#define K_F41 K(KT_FN,50)
99#define K_F42 K(KT_FN,51)
100#define K_F43 K(KT_FN,52)
101#define K_F44 K(KT_FN,53)
102#define K_F45 K(KT_FN,54)
103#define K_F46 K(KT_FN,55)
104#define K_F47 K(KT_FN,56)
105#define K_F48 K(KT_FN,57)
106#define K_F49 K(KT_FN,58)
107#define K_F50 K(KT_FN,59)
108#define K_F51 K(KT_FN,60)
109#define K_F52 K(KT_FN,61)
110#define K_F53 K(KT_FN,62)
111#define K_F54 K(KT_FN,63)
112#define K_F55 K(KT_FN,64)
113#define K_F56 K(KT_FN,65)
114#define K_F57 K(KT_FN,66)
115#define K_F58 K(KT_FN,67)
116#define K_F59 K(KT_FN,68)
117#define K_F60 K(KT_FN,69)
118#define K_F61 K(KT_FN,70)
119#define K_F62 K(KT_FN,71)
120#define K_F63 K(KT_FN,72)
121#define K_F64 K(KT_FN,73)
122#define K_F65 K(KT_FN,74)
123#define K_F66 K(KT_FN,75)
124#define K_F67 K(KT_FN,76)
125#define K_F68 K(KT_FN,77)
126#define K_F69 K(KT_FN,78)
127#define K_F70 K(KT_FN,79)
128#define K_F71 K(KT_FN,80)
129#define K_F72 K(KT_FN,81)
130#define K_F73 K(KT_FN,82)
131#define K_F74 K(KT_FN,83)
132#define K_F75 K(KT_FN,84)
133#define K_F76 K(KT_FN,85)
134#define K_F77 K(KT_FN,86)
135#define K_F78 K(KT_FN,87)
136#define K_F79 K(KT_FN,88)
137#define K_F80 K(KT_FN,89)
138#define K_F81 K(KT_FN,90)
139#define K_F82 K(KT_FN,91)
140#define K_F83 K(KT_FN,92)
141#define K_F84 K(KT_FN,93)
142#define K_F85 K(KT_FN,94)
143#define K_F86 K(KT_FN,95)
144#define K_F87 K(KT_FN,96)
145#define K_F88 K(KT_FN,97)
146#define K_F89 K(KT_FN,98)
147#define K_F90 K(KT_FN,99)
148#define K_F91 K(KT_FN,100)
149#define K_F92 K(KT_FN,101)
150#define K_F93 K(KT_FN,102)
151#define K_F94 K(KT_FN,103)
152#define K_F95 K(KT_FN,104)
153#define K_F96 K(KT_FN,105)
154#define K_F97 K(KT_FN,106)
155#define K_F98 K(KT_FN,107)
156#define K_F99 K(KT_FN,108)
157#define K_F100 K(KT_FN,109)
158#define K_F101 K(KT_FN,110)
159#define K_F102 K(KT_FN,111)
160#define K_F103 K(KT_FN,112)
161#define K_F104 K(KT_FN,113)
162#define K_F105 K(KT_FN,114)
163#define K_F106 K(KT_FN,115)
164#define K_F107 K(KT_FN,116)
165#define K_F108 K(KT_FN,117)
166#define K_F109 K(KT_FN,118)
167#define K_F110 K(KT_FN,119)
168#define K_F111 K(KT_FN,120)
169#define K_F112 K(KT_FN,121)
170#define K_F113 K(KT_FN,122)
171#define K_F114 K(KT_FN,123)
172#define K_F115 K(KT_FN,124)
173#define K_F116 K(KT_FN,125)
174#define K_F117 K(KT_FN,126)
175#define K_F118 K(KT_FN,127)
176#define K_F119 K(KT_FN,128)
177#define K_F120 K(KT_FN,129)
178#define K_F121 K(KT_FN,130)
179#define K_F122 K(KT_FN,131)
180#define K_F123 K(KT_FN,132)
181#define K_F124 K(KT_FN,133)
182#define K_F125 K(KT_FN,134)
183#define K_F126 K(KT_FN,135)
184#define K_F127 K(KT_FN,136)
185#define K_F128 K(KT_FN,137)
186#define K_F129 K(KT_FN,138)
187#define K_F130 K(KT_FN,139)
188#define K_F131 K(KT_FN,140)
189#define K_F132 K(KT_FN,141)
190#define K_F133 K(KT_FN,142)
191#define K_F134 K(KT_FN,143)
192#define K_F135 K(KT_FN,144)
193#define K_F136 K(KT_FN,145)
194#define K_F137 K(KT_FN,146)
195#define K_F138 K(KT_FN,147)
196#define K_F139 K(KT_FN,148)
197#define K_F140 K(KT_FN,149)
198#define K_F141 K(KT_FN,150)
199#define K_F142 K(KT_FN,151)
200#define K_F143 K(KT_FN,152)
201#define K_F144 K(KT_FN,153)
202#define K_F145 K(KT_FN,154)
203#define K_F146 K(KT_FN,155)
204#define K_F147 K(KT_FN,156)
205#define K_F148 K(KT_FN,157)
206#define K_F149 K(KT_FN,158)
207#define K_F150 K(KT_FN,159)
208#define K_F151 K(KT_FN,160)
209#define K_F152 K(KT_FN,161)
210#define K_F153 K(KT_FN,162)
211#define K_F154 K(KT_FN,163)
212#define K_F155 K(KT_FN,164)
213#define K_F156 K(KT_FN,165)
214#define K_F157 K(KT_FN,166)
215#define K_F158 K(KT_FN,167)
216#define K_F159 K(KT_FN,168)
217#define K_F160 K(KT_FN,169)
218#define K_F161 K(KT_FN,170)
219#define K_F162 K(KT_FN,171)
220#define K_F163 K(KT_FN,172)
221#define K_F164 K(KT_FN,173)
222#define K_F165 K(KT_FN,174)
223#define K_F166 K(KT_FN,175)
224#define K_F167 K(KT_FN,176)
225#define K_F168 K(KT_FN,177)
226#define K_F169 K(KT_FN,178)
227#define K_F170 K(KT_FN,179)
228#define K_F171 K(KT_FN,180)
229#define K_F172 K(KT_FN,181)
230#define K_F173 K(KT_FN,182)
231#define K_F174 K(KT_FN,183)
232#define K_F175 K(KT_FN,184)
233#define K_F176 K(KT_FN,185)
234#define K_F177 K(KT_FN,186)
235#define K_F178 K(KT_FN,187)
236#define K_F179 K(KT_FN,188)
237#define K_F180 K(KT_FN,189)
238#define K_F181 K(KT_FN,190)
239#define K_F182 K(KT_FN,191)
240#define K_F183 K(KT_FN,192)
241#define K_F184 K(KT_FN,193)
242#define K_F185 K(KT_FN,194)
243#define K_F186 K(KT_FN,195)
244#define K_F187 K(KT_FN,196)
245#define K_F188 K(KT_FN,197)
246#define K_F189 K(KT_FN,198)
247#define K_F190 K(KT_FN,199)
248#define K_F191 K(KT_FN,200)
249#define K_F192 K(KT_FN,201)
250#define K_F193 K(KT_FN,202)
251#define K_F194 K(KT_FN,203)
252#define K_F195 K(KT_FN,204)
253#define K_F196 K(KT_FN,205)
254#define K_F197 K(KT_FN,206)
255#define K_F198 K(KT_FN,207)
256#define K_F199 K(KT_FN,208)
257#define K_F200 K(KT_FN,209)
258#define K_F201 K(KT_FN,210)
259#define K_F202 K(KT_FN,211)
260#define K_F203 K(KT_FN,212)
261#define K_F204 K(KT_FN,213)
262#define K_F205 K(KT_FN,214)
263#define K_F206 K(KT_FN,215)
264#define K_F207 K(KT_FN,216)
265#define K_F208 K(KT_FN,217)
266#define K_F209 K(KT_FN,218)
267#define K_F210 K(KT_FN,219)
268#define K_F211 K(KT_FN,220)
269#define K_F212 K(KT_FN,221)
270#define K_F213 K(KT_FN,222)
271#define K_F214 K(KT_FN,223)
272#define K_F215 K(KT_FN,224)
273#define K_F216 K(KT_FN,225)
274#define K_F217 K(KT_FN,226)
275#define K_F218 K(KT_FN,227)
276#define K_F219 K(KT_FN,228)
277#define K_F220 K(KT_FN,229)
278#define K_F221 K(KT_FN,230)
279#define K_F222 K(KT_FN,231)
280#define K_F223 K(KT_FN,232)
281#define K_F224 K(KT_FN,233)
282#define K_F225 K(KT_FN,234)
283#define K_F226 K(KT_FN,235)
284#define K_F227 K(KT_FN,236)
285#define K_F228 K(KT_FN,237)
286#define K_F229 K(KT_FN,238)
287#define K_F230 K(KT_FN,239)
288#define K_F231 K(KT_FN,240)
289#define K_F232 K(KT_FN,241)
290#define K_F233 K(KT_FN,242)
291#define K_F234 K(KT_FN,243)
292#define K_F235 K(KT_FN,244)
293#define K_F236 K(KT_FN,245)
294#define K_F237 K(KT_FN,246)
295#define K_F238 K(KT_FN,247)
296#define K_F239 K(KT_FN,248)
297#define K_F240 K(KT_FN,249)
298#define K_F241 K(KT_FN,250)
299#define K_F242 K(KT_FN,251)
300#define K_F243 K(KT_FN,252)
301#define K_F244 K(KT_FN,253)
302#define K_F245 K(KT_FN,254)
303#define K_UNDO K(KT_FN,255)
304
305
306#define K_HOLE K(KT_SPEC,0)
307#define K_ENTER K(KT_SPEC,1)
308#define K_SH_REGS K(KT_SPEC,2)
309#define K_SH_MEM K(KT_SPEC,3)
310#define K_SH_STAT K(KT_SPEC,4)
311#define K_BREAK K(KT_SPEC,5)
312#define K_CONS K(KT_SPEC,6)
313#define K_CAPS K(KT_SPEC,7)
314#define K_NUM K(KT_SPEC,8)
315#define K_HOLD K(KT_SPEC,9)
316#define K_SCROLLFORW K(KT_SPEC,10)
317#define K_SCROLLBACK K(KT_SPEC,11)
318#define K_BOOT K(KT_SPEC,12)
319#define K_CAPSON K(KT_SPEC,13)
320#define K_COMPOSE K(KT_SPEC,14)
321#define K_SAK K(KT_SPEC,15)
322#define K_DECRCONSOLE K(KT_SPEC,16)
323#define K_INCRCONSOLE K(KT_SPEC,17)
324#define K_SPAWNCONSOLE K(KT_SPEC,18)
325#define K_BARENUMLOCK K(KT_SPEC,19)
326
327#define K_ALLOCATED K(KT_SPEC,126) /* dynamically allocated keymap */
328#define K_NOSUCHMAP K(KT_SPEC,127) /* returned by KDGKBENT */
329
330#define K_P0 K(KT_PAD,0)
331#define K_P1 K(KT_PAD,1)
332#define K_P2 K(KT_PAD,2)
333#define K_P3 K(KT_PAD,3)
334#define K_P4 K(KT_PAD,4)
335#define K_P5 K(KT_PAD,5)
336#define K_P6 K(KT_PAD,6)
337#define K_P7 K(KT_PAD,7)
338#define K_P8 K(KT_PAD,8)
339#define K_P9 K(KT_PAD,9)
340#define K_PPLUS K(KT_PAD,10) /* key-pad plus */
341#define K_PMINUS K(KT_PAD,11) /* key-pad minus */
342#define K_PSTAR K(KT_PAD,12) /* key-pad asterisk (star) */
343#define K_PSLASH K(KT_PAD,13) /* key-pad slash */
344#define K_PENTER K(KT_PAD,14) /* key-pad enter */
345#define K_PCOMMA K(KT_PAD,15) /* key-pad comma: kludge... */
346#define K_PDOT K(KT_PAD,16) /* key-pad dot (period): kludge... */
347#define K_PPLUSMINUS K(KT_PAD,17) /* key-pad plus/minus */
348#define K_PPARENL K(KT_PAD,18) /* key-pad left parenthesis */
349#define K_PPARENR K(KT_PAD,19) /* key-pad right parenthesis */
350
351#define NR_PAD 20
352
353#define K_DGRAVE K(KT_DEAD,0)
354#define K_DACUTE K(KT_DEAD,1)
355#define K_DCIRCM K(KT_DEAD,2)
356#define K_DTILDE K(KT_DEAD,3)
357#define K_DDIERE K(KT_DEAD,4)
358#define K_DCEDIL K(KT_DEAD,5)
359
360#define NR_DEAD 6
361
362#define K_DOWN K(KT_CUR,0)
363#define K_LEFT K(KT_CUR,1)
364#define K_RIGHT K(KT_CUR,2)
365#define K_UP K(KT_CUR,3)
366
367#define K_SHIFT K(KT_SHIFT,KG_SHIFT)
368#define K_CTRL K(KT_SHIFT,KG_CTRL)
369#define K_ALT K(KT_SHIFT,KG_ALT)
370#define K_ALTGR K(KT_SHIFT,KG_ALTGR)
371#define K_SHIFTL K(KT_SHIFT,KG_SHIFTL)
372#define K_SHIFTR K(KT_SHIFT,KG_SHIFTR)
373#define K_CTRLL K(KT_SHIFT,KG_CTRLL)
374#define K_CTRLR K(KT_SHIFT,KG_CTRLR)
375#define K_CAPSSHIFT K(KT_SHIFT,KG_CAPSSHIFT)
376
377#define K_ASC0 K(KT_ASCII,0)
378#define K_ASC1 K(KT_ASCII,1)
379#define K_ASC2 K(KT_ASCII,2)
380#define K_ASC3 K(KT_ASCII,3)
381#define K_ASC4 K(KT_ASCII,4)
382#define K_ASC5 K(KT_ASCII,5)
383#define K_ASC6 K(KT_ASCII,6)
384#define K_ASC7 K(KT_ASCII,7)
385#define K_ASC8 K(KT_ASCII,8)
386#define K_ASC9 K(KT_ASCII,9)
387#define K_HEX0 K(KT_ASCII,10)
388#define K_HEX1 K(KT_ASCII,11)
389#define K_HEX2 K(KT_ASCII,12)
390#define K_HEX3 K(KT_ASCII,13)
391#define K_HEX4 K(KT_ASCII,14)
392#define K_HEX5 K(KT_ASCII,15)
393#define K_HEX6 K(KT_ASCII,16)
394#define K_HEX7 K(KT_ASCII,17)
395#define K_HEX8 K(KT_ASCII,18)
396#define K_HEX9 K(KT_ASCII,19)
397#define K_HEXa K(KT_ASCII,20)
398#define K_HEXb K(KT_ASCII,21)
399#define K_HEXc K(KT_ASCII,22)
400#define K_HEXd K(KT_ASCII,23)
401#define K_HEXe K(KT_ASCII,24)
402#define K_HEXf K(KT_ASCII,25)
403
404#define NR_ASCII 26
405
406#define K_SHIFTLOCK K(KT_LOCK,KG_SHIFT)
407#define K_CTRLLOCK K(KT_LOCK,KG_CTRL)
408#define K_ALTLOCK K(KT_LOCK,KG_ALT)
409#define K_ALTGRLOCK K(KT_LOCK,KG_ALTGR)
410#define K_SHIFTLLOCK K(KT_LOCK,KG_SHIFTL)
411#define K_SHIFTRLOCK K(KT_LOCK,KG_SHIFTR)
412#define K_CTRLLLOCK K(KT_LOCK,KG_CTRLL)
413#define K_CTRLRLOCK K(KT_LOCK,KG_CTRLR)
414#define K_CAPSSHIFTLOCK K(KT_LOCK,KG_CAPSSHIFT)
415
416#define K_SHIFT_SLOCK K(KT_SLOCK,KG_SHIFT)
417#define K_CTRL_SLOCK K(KT_SLOCK,KG_CTRL)
418#define K_ALT_SLOCK K(KT_SLOCK,KG_ALT)
419#define K_ALTGR_SLOCK K(KT_SLOCK,KG_ALTGR)
420#define K_SHIFTL_SLOCK K(KT_SLOCK,KG_SHIFTL)
421#define K_SHIFTR_SLOCK K(KT_SLOCK,KG_SHIFTR)
422#define K_CTRLL_SLOCK K(KT_SLOCK,KG_CTRLL)
423#define K_CTRLR_SLOCK K(KT_SLOCK,KG_CTRLR)
424#define K_CAPSSHIFT_SLOCK K(KT_SLOCK,KG_CAPSSHIFT)
425
426#define NR_LOCK 9
427
428#define K_BRL_BLANK K(KT_BRL, 0)
429#define K_BRL_DOT1 K(KT_BRL, 1)
430#define K_BRL_DOT2 K(KT_BRL, 2)
431#define K_BRL_DOT3 K(KT_BRL, 3)
432#define K_BRL_DOT4 K(KT_BRL, 4)
433#define K_BRL_DOT5 K(KT_BRL, 5)
434#define K_BRL_DOT6 K(KT_BRL, 6)
435#define K_BRL_DOT7 K(KT_BRL, 7)
436#define K_BRL_DOT8 K(KT_BRL, 8)
437#define K_BRL_DOT9 K(KT_BRL, 9)
438#define K_BRL_DOT10 K(KT_BRL, 10)
439
440#define NR_BRL 11
441
442#define MAX_DIACR 256
443#endif /* _UAPI__LINUX_KEYBOARD_H */
diff --git a/include/linux/keyctl.h b/include/uapi/linux/keyctl.h
index c9b7f4faf97a..c9b7f4faf97a 100644
--- a/include/linux/keyctl.h
+++ b/include/uapi/linux/keyctl.h
diff --git a/include/linux/kvm.h b/include/uapi/linux/kvm.h
index 494a84c37c3e..494a84c37c3e 100644
--- a/include/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
diff --git a/include/uapi/linux/kvm_para.h b/include/uapi/linux/kvm_para.h
new file mode 100644
index 000000000000..cea2c5c72d26
--- /dev/null
+++ b/include/uapi/linux/kvm_para.h
@@ -0,0 +1,28 @@
1#ifndef _UAPI__LINUX_KVM_PARA_H
2#define _UAPI__LINUX_KVM_PARA_H
3
4/*
5 * This header file provides a method for making a hypercall to the host
6 * Architectures should define:
7 * - kvm_hypercall0, kvm_hypercall1...
8 * - kvm_arch_para_features
9 * - kvm_para_available
10 */
11
12/* Return values for hypercalls */
13#define KVM_ENOSYS 1000
14#define KVM_EFAULT EFAULT
15#define KVM_E2BIG E2BIG
16#define KVM_EPERM EPERM
17
18#define KVM_HC_VAPIC_POLL_IRQ 1
19#define KVM_HC_MMU_OP 2
20#define KVM_HC_FEATURES 3
21#define KVM_HC_PPC_MAP_MAGIC_PAGE 4
22
23/*
24 * hypercalls use architecture specific
25 */
26#include <asm/kvm_para.h>
27
28#endif /* _UAPI__LINUX_KVM_PARA_H */
diff --git a/include/uapi/linux/l2tp.h b/include/uapi/linux/l2tp.h
new file mode 100644
index 000000000000..8adb68160327
--- /dev/null
+++ b/include/uapi/linux/l2tp.h
@@ -0,0 +1,180 @@
1/*
2 * L2TP-over-IP socket for L2TPv3.
3 *
4 * Author: James Chapman <jchapman@katalix.com>
5 */
6
7#ifndef _UAPI_LINUX_L2TP_H_
8#define _UAPI_LINUX_L2TP_H_
9
10#include <linux/types.h>
11#include <linux/socket.h>
12#ifndef __KERNEL__
13#include <netinet/in.h>
14#endif
15
16#define IPPROTO_L2TP 115
17
18/**
19 * struct sockaddr_l2tpip - the sockaddr structure for L2TP-over-IP sockets
20 * @l2tp_family: address family number AF_L2TPIP.
21 * @l2tp_addr: protocol specific address information
22 * @l2tp_conn_id: connection id of tunnel
23 */
24#define __SOCK_SIZE__ 16 /* sizeof(struct sockaddr) */
25struct sockaddr_l2tpip {
26 /* The first fields must match struct sockaddr_in */
27 __kernel_sa_family_t l2tp_family; /* AF_INET */
28 __be16 l2tp_unused; /* INET port number (unused) */
29 struct in_addr l2tp_addr; /* Internet address */
30
31 __u32 l2tp_conn_id; /* Connection ID of tunnel */
32
33 /* Pad to size of `struct sockaddr'. */
34 unsigned char __pad[sizeof(struct sockaddr) -
35 sizeof(__kernel_sa_family_t) -
36 sizeof(__be16) - sizeof(struct in_addr) -
37 sizeof(__u32)];
38};
39
40/**
41 * struct sockaddr_l2tpip6 - the sockaddr structure for L2TP-over-IPv6 sockets
42 * @l2tp_family: address family number AF_L2TPIP.
43 * @l2tp_addr: protocol specific address information
44 * @l2tp_conn_id: connection id of tunnel
45 */
46struct sockaddr_l2tpip6 {
47 /* The first fields must match struct sockaddr_in6 */
48 __kernel_sa_family_t l2tp_family; /* AF_INET6 */
49 __be16 l2tp_unused; /* INET port number (unused) */
50 __be32 l2tp_flowinfo; /* IPv6 flow information */
51 struct in6_addr l2tp_addr; /* IPv6 address */
52 __u32 l2tp_scope_id; /* scope id (new in RFC2553) */
53 __u32 l2tp_conn_id; /* Connection ID of tunnel */
54};
55
56/*****************************************************************************
57 * NETLINK_GENERIC netlink family.
58 *****************************************************************************/
59
60/*
61 * Commands.
62 * Valid TLVs of each command are:-
63 * TUNNEL_CREATE - CONN_ID, pw_type, netns, ifname, ipinfo, udpinfo, udpcsum, vlanid
64 * TUNNEL_DELETE - CONN_ID
65 * TUNNEL_MODIFY - CONN_ID, udpcsum
66 * TUNNEL_GETSTATS - CONN_ID, (stats)
67 * TUNNEL_GET - CONN_ID, (...)
68 * SESSION_CREATE - SESSION_ID, PW_TYPE, offset, data_seq, cookie, peer_cookie, offset, l2spec
69 * SESSION_DELETE - SESSION_ID
70 * SESSION_MODIFY - SESSION_ID, data_seq
71 * SESSION_GET - SESSION_ID, (...)
72 * SESSION_GETSTATS - SESSION_ID, (stats)
73 *
74 */
75enum {
76 L2TP_CMD_NOOP,
77 L2TP_CMD_TUNNEL_CREATE,
78 L2TP_CMD_TUNNEL_DELETE,
79 L2TP_CMD_TUNNEL_MODIFY,
80 L2TP_CMD_TUNNEL_GET,
81 L2TP_CMD_SESSION_CREATE,
82 L2TP_CMD_SESSION_DELETE,
83 L2TP_CMD_SESSION_MODIFY,
84 L2TP_CMD_SESSION_GET,
85 __L2TP_CMD_MAX,
86};
87
88#define L2TP_CMD_MAX (__L2TP_CMD_MAX - 1)
89
90/*
91 * ATTR types defined for L2TP
92 */
93enum {
94 L2TP_ATTR_NONE, /* no data */
95 L2TP_ATTR_PW_TYPE, /* u16, enum l2tp_pwtype */
96 L2TP_ATTR_ENCAP_TYPE, /* u16, enum l2tp_encap_type */
97 L2TP_ATTR_OFFSET, /* u16 */
98 L2TP_ATTR_DATA_SEQ, /* u16 */
99 L2TP_ATTR_L2SPEC_TYPE, /* u8, enum l2tp_l2spec_type */
100 L2TP_ATTR_L2SPEC_LEN, /* u8, enum l2tp_l2spec_type */
101 L2TP_ATTR_PROTO_VERSION, /* u8 */
102 L2TP_ATTR_IFNAME, /* string */
103 L2TP_ATTR_CONN_ID, /* u32 */
104 L2TP_ATTR_PEER_CONN_ID, /* u32 */
105 L2TP_ATTR_SESSION_ID, /* u32 */
106 L2TP_ATTR_PEER_SESSION_ID, /* u32 */
107 L2TP_ATTR_UDP_CSUM, /* u8 */
108 L2TP_ATTR_VLAN_ID, /* u16 */
109 L2TP_ATTR_COOKIE, /* 0, 4 or 8 bytes */
110 L2TP_ATTR_PEER_COOKIE, /* 0, 4 or 8 bytes */
111 L2TP_ATTR_DEBUG, /* u32 */
112 L2TP_ATTR_RECV_SEQ, /* u8 */
113 L2TP_ATTR_SEND_SEQ, /* u8 */
114 L2TP_ATTR_LNS_MODE, /* u8 */
115 L2TP_ATTR_USING_IPSEC, /* u8 */
116 L2TP_ATTR_RECV_TIMEOUT, /* msec */
117 L2TP_ATTR_FD, /* int */
118 L2TP_ATTR_IP_SADDR, /* u32 */
119 L2TP_ATTR_IP_DADDR, /* u32 */
120 L2TP_ATTR_UDP_SPORT, /* u16 */
121 L2TP_ATTR_UDP_DPORT, /* u16 */
122 L2TP_ATTR_MTU, /* u16 */
123 L2TP_ATTR_MRU, /* u16 */
124 L2TP_ATTR_STATS, /* nested */
125 L2TP_ATTR_IP6_SADDR, /* struct in6_addr */
126 L2TP_ATTR_IP6_DADDR, /* struct in6_addr */
127 __L2TP_ATTR_MAX,
128};
129
130#define L2TP_ATTR_MAX (__L2TP_ATTR_MAX - 1)
131
132/* Nested in L2TP_ATTR_STATS */
133enum {
134 L2TP_ATTR_STATS_NONE, /* no data */
135 L2TP_ATTR_TX_PACKETS, /* u64 */
136 L2TP_ATTR_TX_BYTES, /* u64 */
137 L2TP_ATTR_TX_ERRORS, /* u64 */
138 L2TP_ATTR_RX_PACKETS, /* u64 */
139 L2TP_ATTR_RX_BYTES, /* u64 */
140 L2TP_ATTR_RX_SEQ_DISCARDS, /* u64 */
141 L2TP_ATTR_RX_OOS_PACKETS, /* u64 */
142 L2TP_ATTR_RX_ERRORS, /* u64 */
143 __L2TP_ATTR_STATS_MAX,
144};
145
146#define L2TP_ATTR_STATS_MAX (__L2TP_ATTR_STATS_MAX - 1)
147
148enum l2tp_pwtype {
149 L2TP_PWTYPE_NONE = 0x0000,
150 L2TP_PWTYPE_ETH_VLAN = 0x0004,
151 L2TP_PWTYPE_ETH = 0x0005,
152 L2TP_PWTYPE_PPP = 0x0007,
153 L2TP_PWTYPE_PPP_AC = 0x0008,
154 L2TP_PWTYPE_IP = 0x000b,
155 __L2TP_PWTYPE_MAX
156};
157
158enum l2tp_l2spec_type {
159 L2TP_L2SPECTYPE_NONE,
160 L2TP_L2SPECTYPE_DEFAULT,
161};
162
163enum l2tp_encap_type {
164 L2TP_ENCAPTYPE_UDP,
165 L2TP_ENCAPTYPE_IP,
166};
167
168enum l2tp_seqmode {
169 L2TP_SEQ_NONE = 0,
170 L2TP_SEQ_IP = 1,
171 L2TP_SEQ_ALL = 2,
172};
173
174/*
175 * NETLINK_GENERIC related info
176 */
177#define L2TP_GENL_NAME "l2tp"
178#define L2TP_GENL_VERSION 0x1
179
180#endif /* _UAPI_LINUX_L2TP_H_ */
diff --git a/include/linux/limits.h b/include/uapi/linux/limits.h
index 2d0f94162fb3..2d0f94162fb3 100644
--- a/include/linux/limits.h
+++ b/include/uapi/linux/limits.h
diff --git a/include/uapi/linux/llc.h b/include/uapi/linux/llc.h
new file mode 100644
index 000000000000..9c987a402473
--- /dev/null
+++ b/include/uapi/linux/llc.h
@@ -0,0 +1,84 @@
1/*
2 * IEEE 802.2 User Interface SAPs for Linux, data structures and indicators.
3 *
4 * Copyright (c) 2001 by Jay Schulist <jschlst@samba.org>
5 *
6 * This program can be redistributed or modified under the terms of the
7 * GNU General Public License as published by the Free Software Foundation.
8 * This program is distributed without any warranty or implied warranty
9 * of merchantability or fitness for a particular purpose.
10 *
11 * See the GNU General Public License for more details.
12 */
13#ifndef _UAPI__LINUX_LLC_H
14#define _UAPI__LINUX_LLC_H
15
16#include <linux/socket.h>
17
18#define __LLC_SOCK_SIZE__ 16 /* sizeof(sockaddr_llc), word align. */
19struct sockaddr_llc {
20 __kernel_sa_family_t sllc_family; /* AF_LLC */
21 __kernel_sa_family_t sllc_arphrd; /* ARPHRD_ETHER */
22 unsigned char sllc_test;
23 unsigned char sllc_xid;
24 unsigned char sllc_ua; /* UA data, only for SOCK_STREAM. */
25 unsigned char sllc_sap;
26 unsigned char sllc_mac[IFHWADDRLEN];
27 unsigned char __pad[__LLC_SOCK_SIZE__ -
28 sizeof(__kernel_sa_family_t) * 2 -
29 sizeof(unsigned char) * 4 - IFHWADDRLEN];
30};
31
32/* sockopt definitions. */
33enum llc_sockopts {
34 LLC_OPT_UNKNOWN = 0,
35 LLC_OPT_RETRY, /* max retrans attempts. */
36 LLC_OPT_SIZE, /* max PDU size (octets). */
37 LLC_OPT_ACK_TMR_EXP, /* ack expire time (secs). */
38 LLC_OPT_P_TMR_EXP, /* pf cycle expire time (secs). */
39 LLC_OPT_REJ_TMR_EXP, /* rej sent expire time (secs). */
40 LLC_OPT_BUSY_TMR_EXP, /* busy state expire time (secs). */
41 LLC_OPT_TX_WIN, /* tx window size. */
42 LLC_OPT_RX_WIN, /* rx window size. */
43 LLC_OPT_PKTINFO, /* ancillary packet information. */
44 LLC_OPT_MAX
45};
46
47#define LLC_OPT_MAX_RETRY 100
48#define LLC_OPT_MAX_SIZE 4196
49#define LLC_OPT_MAX_WIN 127
50#define LLC_OPT_MAX_ACK_TMR_EXP 60
51#define LLC_OPT_MAX_P_TMR_EXP 60
52#define LLC_OPT_MAX_REJ_TMR_EXP 60
53#define LLC_OPT_MAX_BUSY_TMR_EXP 60
54
55/* LLC SAP types. */
56#define LLC_SAP_NULL 0x00 /* NULL SAP. */
57#define LLC_SAP_LLC 0x02 /* LLC Sublayer Management. */
58#define LLC_SAP_SNA 0x04 /* SNA Path Control. */
59#define LLC_SAP_PNM 0x0E /* Proway Network Management. */
60#define LLC_SAP_IP 0x06 /* TCP/IP. */
61#define LLC_SAP_BSPAN 0x42 /* Bridge Spanning Tree Proto */
62#define LLC_SAP_MMS 0x4E /* Manufacturing Message Srv. */
63#define LLC_SAP_8208 0x7E /* ISO 8208 */
64#define LLC_SAP_3COM 0x80 /* 3COM. */
65#define LLC_SAP_PRO 0x8E /* Proway Active Station List */
66#define LLC_SAP_SNAP 0xAA /* SNAP. */
67#define LLC_SAP_BANYAN 0xBC /* Banyan. */
68#define LLC_SAP_IPX 0xE0 /* IPX/SPX. */
69#define LLC_SAP_NETBEUI 0xF0 /* NetBEUI. */
70#define LLC_SAP_LANMGR 0xF4 /* LanManager. */
71#define LLC_SAP_IMPL 0xF8 /* IMPL */
72#define LLC_SAP_DISC 0xFC /* Discovery */
73#define LLC_SAP_OSI 0xFE /* OSI Network Layers. */
74#define LLC_SAP_LAR 0xDC /* LAN Address Resolution */
75#define LLC_SAP_RM 0xD4 /* Resource Management */
76#define LLC_SAP_GLOBAL 0xFF /* Global SAP. */
77
78struct llc_pktinfo {
79 int lpi_ifindex;
80 unsigned char lpi_sap;
81 unsigned char lpi_mac[IFHWADDRLEN];
82};
83
84#endif /* _UAPI__LINUX_LLC_H */
diff --git a/include/uapi/linux/loop.h b/include/uapi/linux/loop.h
new file mode 100644
index 000000000000..e0cecd2eabdc
--- /dev/null
+++ b/include/uapi/linux/loop.h
@@ -0,0 +1,94 @@
1/*
2 * include/linux/loop.h
3 *
4 * Written by Theodore Ts'o, 3/29/93.
5 *
6 * Copyright 1993 by Theodore Ts'o. Redistribution of this file is
7 * permitted under the GNU General Public License.
8 */
9#ifndef _UAPI_LINUX_LOOP_H
10#define _UAPI_LINUX_LOOP_H
11
12
13#define LO_NAME_SIZE 64
14#define LO_KEY_SIZE 32
15
16
17/*
18 * Loop flags
19 */
20enum {
21 LO_FLAGS_READ_ONLY = 1,
22 LO_FLAGS_AUTOCLEAR = 4,
23 LO_FLAGS_PARTSCAN = 8,
24};
25
26#include <asm/posix_types.h> /* for __kernel_old_dev_t */
27#include <linux/types.h> /* for __u64 */
28
29/* Backwards compatibility version */
30struct loop_info {
31 int lo_number; /* ioctl r/o */
32 __kernel_old_dev_t lo_device; /* ioctl r/o */
33 unsigned long lo_inode; /* ioctl r/o */
34 __kernel_old_dev_t lo_rdevice; /* ioctl r/o */
35 int lo_offset;
36 int lo_encrypt_type;
37 int lo_encrypt_key_size; /* ioctl w/o */
38 int lo_flags; /* ioctl r/o */
39 char lo_name[LO_NAME_SIZE];
40 unsigned char lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
41 unsigned long lo_init[2];
42 char reserved[4];
43};
44
45struct loop_info64 {
46 __u64 lo_device; /* ioctl r/o */
47 __u64 lo_inode; /* ioctl r/o */
48 __u64 lo_rdevice; /* ioctl r/o */
49 __u64 lo_offset;
50 __u64 lo_sizelimit;/* bytes, 0 == max available */
51 __u32 lo_number; /* ioctl r/o */
52 __u32 lo_encrypt_type;
53 __u32 lo_encrypt_key_size; /* ioctl w/o */
54 __u32 lo_flags; /* ioctl r/o */
55 __u8 lo_file_name[LO_NAME_SIZE];
56 __u8 lo_crypt_name[LO_NAME_SIZE];
57 __u8 lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
58 __u64 lo_init[2];
59};
60
61/*
62 * Loop filter types
63 */
64
65#define LO_CRYPT_NONE 0
66#define LO_CRYPT_XOR 1
67#define LO_CRYPT_DES 2
68#define LO_CRYPT_FISH2 3 /* Twofish encryption */
69#define LO_CRYPT_BLOW 4
70#define LO_CRYPT_CAST128 5
71#define LO_CRYPT_IDEA 6
72#define LO_CRYPT_DUMMY 9
73#define LO_CRYPT_SKIPJACK 10
74#define LO_CRYPT_CRYPTOAPI 18
75#define MAX_LO_CRYPT 20
76
77/*
78 * IOCTL commands --- we will commandeer 0x4C ('L')
79 */
80
81#define LOOP_SET_FD 0x4C00
82#define LOOP_CLR_FD 0x4C01
83#define LOOP_SET_STATUS 0x4C02
84#define LOOP_GET_STATUS 0x4C03
85#define LOOP_SET_STATUS64 0x4C04
86#define LOOP_GET_STATUS64 0x4C05
87#define LOOP_CHANGE_FD 0x4C06
88#define LOOP_SET_CAPACITY 0x4C07
89
90/* /dev/loop-control interface */
91#define LOOP_CTL_ADD 0x4C80
92#define LOOP_CTL_REMOVE 0x4C81
93#define LOOP_CTL_GET_FREE 0x4C82
94#endif /* _UAPI_LINUX_LOOP_H */
diff --git a/include/uapi/linux/lp.h b/include/uapi/linux/lp.h
new file mode 100644
index 000000000000..a3406a51f196
--- /dev/null
+++ b/include/uapi/linux/lp.h
@@ -0,0 +1,100 @@
1/*
2 * usr/include/linux/lp.h c.1991-1992 James Wiegand
3 * many modifications copyright (C) 1992 Michael K. Johnson
4 * Interrupt support added 1993 Nigel Gamble
5 * Removed 8255 status defines from inside __KERNEL__ Marcelo Tosatti
6 */
7#ifndef _UAPI_LINUX_LP_H
8#define _UAPI_LINUX_LP_H
9
10
11/*
12 * Per POSIX guidelines, this module reserves the LP and lp prefixes
13 * These are the lp_table[minor].flags flags...
14 */
15#define LP_EXIST 0x0001
16#define LP_SELEC 0x0002
17#define LP_BUSY 0x0004
18#define LP_BUSY_BIT_POS 2
19#define LP_OFFL 0x0008
20#define LP_NOPA 0x0010
21#define LP_ERR 0x0020
22#define LP_ABORT 0x0040
23#define LP_CAREFUL 0x0080 /* obsoleted -arca */
24#define LP_ABORTOPEN 0x0100
25
26#define LP_TRUST_IRQ_ 0x0200 /* obsolete */
27#define LP_NO_REVERSE 0x0400 /* No reverse mode available. */
28#define LP_DATA_AVAIL 0x0800 /* Data is available. */
29
30/*
31 * bit defines for 8255 status port
32 * base + 1
33 * accessed with LP_S(minor), which gets the byte...
34 */
35#define LP_PBUSY 0x80 /* inverted input, active high */
36#define LP_PACK 0x40 /* unchanged input, active low */
37#define LP_POUTPA 0x20 /* unchanged input, active high */
38#define LP_PSELECD 0x10 /* unchanged input, active high */
39#define LP_PERRORP 0x08 /* unchanged input, active low */
40
41/* timeout for each character. This is relative to bus cycles -- it
42 * is the count in a busy loop. THIS IS THE VALUE TO CHANGE if you
43 * have extremely slow printing, or if the machine seems to slow down
44 * a lot when you print. If you have slow printing, increase this
45 * number and recompile, and if your system gets bogged down, decrease
46 * this number. This can be changed with the tunelp(8) command as well.
47 */
48
49#define LP_INIT_CHAR 1000
50
51/* The parallel port specs apparently say that there needs to be
52 * a .5usec wait before and after the strobe.
53 */
54
55#define LP_INIT_WAIT 1
56
57/* This is the amount of time that the driver waits for the printer to
58 * catch up when the printer's buffer appears to be filled. If you
59 * want to tune this and have a fast printer (i.e. HPIIIP), decrease
60 * this number, and if you have a slow printer, increase this number.
61 * This is in hundredths of a second, the default 2 being .05 second.
62 * Or use the tunelp(8) command, which is especially nice if you want
63 * change back and forth between character and graphics printing, which
64 * are wildly different...
65 */
66
67#define LP_INIT_TIME 2
68
69/* IOCTL numbers */
70#define LPCHAR 0x0601 /* corresponds to LP_INIT_CHAR */
71#define LPTIME 0x0602 /* corresponds to LP_INIT_TIME */
72#define LPABORT 0x0604 /* call with TRUE arg to abort on error,
73 FALSE to retry. Default is retry. */
74#define LPSETIRQ 0x0605 /* call with new IRQ number,
75 or 0 for polling (no IRQ) */
76#define LPGETIRQ 0x0606 /* get the current IRQ number */
77#define LPWAIT 0x0608 /* corresponds to LP_INIT_WAIT */
78/* NOTE: LPCAREFUL is obsoleted and it' s always the default right now -arca */
79#define LPCAREFUL 0x0609 /* call with TRUE arg to require out-of-paper, off-
80 line, and error indicators good on all writes,
81 FALSE to ignore them. Default is ignore. */
82#define LPABORTOPEN 0x060a /* call with TRUE arg to abort open() on error,
83 FALSE to ignore error. Default is ignore. */
84#define LPGETSTATUS 0x060b /* return LP_S(minor) */
85#define LPRESET 0x060c /* reset printer */
86#ifdef LP_STATS
87#define LPGETSTATS 0x060d /* get statistics (struct lp_stats) */
88#endif
89#define LPGETFLAGS 0x060e /* get status flags */
90#define LPSETTIMEOUT 0x060f /* set parport timeout */
91
92/* timeout for printk'ing a timeout, in jiffies (100ths of a second).
93 This is also used for re-checking error conditions if LP_ABORT is
94 not set. This is the default behavior. */
95
96#define LP_TIMEOUT_INTERRUPT (60 * HZ)
97#define LP_TIMEOUT_POLLED (10 * HZ)
98
99
100#endif /* _UAPI_LINUX_LP_H */
diff --git a/include/linux/magic.h b/include/uapi/linux/magic.h
index e15192cb9cf4..e15192cb9cf4 100644
--- a/include/linux/magic.h
+++ b/include/uapi/linux/magic.h
diff --git a/include/linux/major.h b/include/uapi/linux/major.h
index 6a8ca98c9a96..6a8ca98c9a96 100644
--- a/include/linux/major.h
+++ b/include/uapi/linux/major.h
diff --git a/include/linux/map_to_7segment.h b/include/uapi/linux/map_to_7segment.h
index 12d62a54d470..12d62a54d470 100644
--- a/include/linux/map_to_7segment.h
+++ b/include/uapi/linux/map_to_7segment.h
diff --git a/include/linux/matroxfb.h b/include/uapi/linux/matroxfb.h
index 8c22a8938642..8c22a8938642 100644
--- a/include/linux/matroxfb.h
+++ b/include/uapi/linux/matroxfb.h
diff --git a/include/uapi/linux/mdio.h b/include/uapi/linux/mdio.h
new file mode 100644
index 000000000000..c94a510a577e
--- /dev/null
+++ b/include/uapi/linux/mdio.h
@@ -0,0 +1,297 @@
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 _UAPI__LINUX_MDIO_H__
11#define _UAPI__LINUX_MDIO_H__
12
13#include <linux/types.h>
14#include <linux/mii.h>
15
16/* MDIO Manageable Devices (MMDs). */
17#define MDIO_MMD_PMAPMD 1 /* Physical Medium Attachment/
18 * Physical Medium Dependent */
19#define MDIO_MMD_WIS 2 /* WAN Interface Sublayer */
20#define MDIO_MMD_PCS 3 /* Physical Coding Sublayer */
21#define MDIO_MMD_PHYXS 4 /* PHY Extender Sublayer */
22#define MDIO_MMD_DTEXS 5 /* DTE Extender Sublayer */
23#define MDIO_MMD_TC 6 /* Transmission Convergence */
24#define MDIO_MMD_AN 7 /* Auto-Negotiation */
25#define MDIO_MMD_C22EXT 29 /* Clause 22 extension */
26#define MDIO_MMD_VEND1 30 /* Vendor specific 1 */
27#define MDIO_MMD_VEND2 31 /* Vendor specific 2 */
28
29/* Generic MDIO registers. */
30#define MDIO_CTRL1 MII_BMCR
31#define MDIO_STAT1 MII_BMSR
32#define MDIO_DEVID1 MII_PHYSID1
33#define MDIO_DEVID2 MII_PHYSID2
34#define MDIO_SPEED 4 /* Speed ability */
35#define MDIO_DEVS1 5 /* Devices in package */
36#define MDIO_DEVS2 6
37#define MDIO_CTRL2 7 /* 10G control 2 */
38#define MDIO_STAT2 8 /* 10G status 2 */
39#define MDIO_PMA_TXDIS 9 /* 10G PMA/PMD transmit disable */
40#define MDIO_PMA_RXDET 10 /* 10G PMA/PMD receive signal detect */
41#define MDIO_PMA_EXTABLE 11 /* 10G PMA/PMD extended ability */
42#define MDIO_PKGID1 14 /* Package identifier */
43#define MDIO_PKGID2 15
44#define MDIO_AN_ADVERTISE 16 /* AN advertising (base page) */
45#define MDIO_AN_LPA 19 /* AN LP abilities (base page) */
46#define MDIO_PCS_EEE_ABLE 20 /* EEE Capability register */
47#define MDIO_PCS_EEE_WK_ERR 22 /* EEE wake error counter */
48#define MDIO_PHYXS_LNSTAT 24 /* PHY XGXS lane state */
49#define MDIO_AN_EEE_ADV 60 /* EEE advertisement */
50#define MDIO_AN_EEE_LPABLE 61 /* EEE link partner ability */
51
52/* Media-dependent registers. */
53#define MDIO_PMA_10GBT_SWAPPOL 130 /* 10GBASE-T pair swap & polarity */
54#define MDIO_PMA_10GBT_TXPWR 131 /* 10GBASE-T TX power control */
55#define MDIO_PMA_10GBT_SNR 133 /* 10GBASE-T SNR margin, lane A.
56 * Lanes B-D are numbered 134-136. */
57#define MDIO_PMA_10GBR_FECABLE 170 /* 10GBASE-R FEC ability */
58#define MDIO_PCS_10GBX_STAT1 24 /* 10GBASE-X PCS status 1 */
59#define MDIO_PCS_10GBRT_STAT1 32 /* 10GBASE-R/-T PCS status 1 */
60#define MDIO_PCS_10GBRT_STAT2 33 /* 10GBASE-R/-T PCS status 2 */
61#define MDIO_AN_10GBT_CTRL 32 /* 10GBASE-T auto-negotiation control */
62#define MDIO_AN_10GBT_STAT 33 /* 10GBASE-T auto-negotiation status */
63
64/* LASI (Link Alarm Status Interrupt) registers, defined by XENPAK MSA. */
65#define MDIO_PMA_LASI_RXCTRL 0x9000 /* RX_ALARM control */
66#define MDIO_PMA_LASI_TXCTRL 0x9001 /* TX_ALARM control */
67#define MDIO_PMA_LASI_CTRL 0x9002 /* LASI control */
68#define MDIO_PMA_LASI_RXSTAT 0x9003 /* RX_ALARM status */
69#define MDIO_PMA_LASI_TXSTAT 0x9004 /* TX_ALARM status */
70#define MDIO_PMA_LASI_STAT 0x9005 /* LASI status */
71
72/* Control register 1. */
73/* Enable extended speed selection */
74#define MDIO_CTRL1_SPEEDSELEXT (BMCR_SPEED1000 | BMCR_SPEED100)
75/* All speed selection bits */
76#define MDIO_CTRL1_SPEEDSEL (MDIO_CTRL1_SPEEDSELEXT | 0x003c)
77#define MDIO_CTRL1_FULLDPLX BMCR_FULLDPLX
78#define MDIO_CTRL1_LPOWER BMCR_PDOWN
79#define MDIO_CTRL1_RESET BMCR_RESET
80#define MDIO_PMA_CTRL1_LOOPBACK 0x0001
81#define MDIO_PMA_CTRL1_SPEED1000 BMCR_SPEED1000
82#define MDIO_PMA_CTRL1_SPEED100 BMCR_SPEED100
83#define MDIO_PCS_CTRL1_LOOPBACK BMCR_LOOPBACK
84#define MDIO_PHYXS_CTRL1_LOOPBACK BMCR_LOOPBACK
85#define MDIO_AN_CTRL1_RESTART BMCR_ANRESTART
86#define MDIO_AN_CTRL1_ENABLE BMCR_ANENABLE
87#define MDIO_AN_CTRL1_XNP 0x2000 /* Enable extended next page */
88#define MDIO_PCS_CTRL1_CLKSTOP_EN 0x400 /* Stop the clock during LPI */
89
90/* 10 Gb/s */
91#define MDIO_CTRL1_SPEED10G (MDIO_CTRL1_SPEEDSELEXT | 0x00)
92/* 10PASS-TS/2BASE-TL */
93#define MDIO_CTRL1_SPEED10P2B (MDIO_CTRL1_SPEEDSELEXT | 0x04)
94
95/* Status register 1. */
96#define MDIO_STAT1_LPOWERABLE 0x0002 /* Low-power ability */
97#define MDIO_STAT1_LSTATUS BMSR_LSTATUS
98#define MDIO_STAT1_FAULT 0x0080 /* Fault */
99#define MDIO_AN_STAT1_LPABLE 0x0001 /* Link partner AN ability */
100#define MDIO_AN_STAT1_ABLE BMSR_ANEGCAPABLE
101#define MDIO_AN_STAT1_RFAULT BMSR_RFAULT
102#define MDIO_AN_STAT1_COMPLETE BMSR_ANEGCOMPLETE
103#define MDIO_AN_STAT1_PAGE 0x0040 /* Page received */
104#define MDIO_AN_STAT1_XNP 0x0080 /* Extended next page status */
105
106/* Speed register. */
107#define MDIO_SPEED_10G 0x0001 /* 10G capable */
108#define MDIO_PMA_SPEED_2B 0x0002 /* 2BASE-TL capable */
109#define MDIO_PMA_SPEED_10P 0x0004 /* 10PASS-TS capable */
110#define MDIO_PMA_SPEED_1000 0x0010 /* 1000M capable */
111#define MDIO_PMA_SPEED_100 0x0020 /* 100M capable */
112#define MDIO_PMA_SPEED_10 0x0040 /* 10M capable */
113#define MDIO_PCS_SPEED_10P2B 0x0002 /* 10PASS-TS/2BASE-TL capable */
114
115/* Device present registers. */
116#define MDIO_DEVS_PRESENT(devad) (1 << (devad))
117#define MDIO_DEVS_PMAPMD MDIO_DEVS_PRESENT(MDIO_MMD_PMAPMD)
118#define MDIO_DEVS_WIS MDIO_DEVS_PRESENT(MDIO_MMD_WIS)
119#define MDIO_DEVS_PCS MDIO_DEVS_PRESENT(MDIO_MMD_PCS)
120#define MDIO_DEVS_PHYXS MDIO_DEVS_PRESENT(MDIO_MMD_PHYXS)
121#define MDIO_DEVS_DTEXS MDIO_DEVS_PRESENT(MDIO_MMD_DTEXS)
122#define MDIO_DEVS_TC MDIO_DEVS_PRESENT(MDIO_MMD_TC)
123#define MDIO_DEVS_AN MDIO_DEVS_PRESENT(MDIO_MMD_AN)
124#define MDIO_DEVS_C22EXT MDIO_DEVS_PRESENT(MDIO_MMD_C22EXT)
125
126/* Control register 2. */
127#define MDIO_PMA_CTRL2_TYPE 0x000f /* PMA/PMD type selection */
128#define MDIO_PMA_CTRL2_10GBCX4 0x0000 /* 10GBASE-CX4 type */
129#define MDIO_PMA_CTRL2_10GBEW 0x0001 /* 10GBASE-EW type */
130#define MDIO_PMA_CTRL2_10GBLW 0x0002 /* 10GBASE-LW type */
131#define MDIO_PMA_CTRL2_10GBSW 0x0003 /* 10GBASE-SW type */
132#define MDIO_PMA_CTRL2_10GBLX4 0x0004 /* 10GBASE-LX4 type */
133#define MDIO_PMA_CTRL2_10GBER 0x0005 /* 10GBASE-ER type */
134#define MDIO_PMA_CTRL2_10GBLR 0x0006 /* 10GBASE-LR type */
135#define MDIO_PMA_CTRL2_10GBSR 0x0007 /* 10GBASE-SR type */
136#define MDIO_PMA_CTRL2_10GBLRM 0x0008 /* 10GBASE-LRM type */
137#define MDIO_PMA_CTRL2_10GBT 0x0009 /* 10GBASE-T type */
138#define MDIO_PMA_CTRL2_10GBKX4 0x000a /* 10GBASE-KX4 type */
139#define MDIO_PMA_CTRL2_10GBKR 0x000b /* 10GBASE-KR type */
140#define MDIO_PMA_CTRL2_1000BT 0x000c /* 1000BASE-T type */
141#define MDIO_PMA_CTRL2_1000BKX 0x000d /* 1000BASE-KX type */
142#define MDIO_PMA_CTRL2_100BTX 0x000e /* 100BASE-TX type */
143#define MDIO_PMA_CTRL2_10BT 0x000f /* 10BASE-T type */
144#define MDIO_PCS_CTRL2_TYPE 0x0003 /* PCS type selection */
145#define MDIO_PCS_CTRL2_10GBR 0x0000 /* 10GBASE-R type */
146#define MDIO_PCS_CTRL2_10GBX 0x0001 /* 10GBASE-X type */
147#define MDIO_PCS_CTRL2_10GBW 0x0002 /* 10GBASE-W type */
148#define MDIO_PCS_CTRL2_10GBT 0x0003 /* 10GBASE-T type */
149
150/* Status register 2. */
151#define MDIO_STAT2_RXFAULT 0x0400 /* Receive fault */
152#define MDIO_STAT2_TXFAULT 0x0800 /* Transmit fault */
153#define MDIO_STAT2_DEVPRST 0xc000 /* Device present */
154#define MDIO_STAT2_DEVPRST_VAL 0x8000 /* Device present value */
155#define MDIO_PMA_STAT2_LBABLE 0x0001 /* PMA loopback ability */
156#define MDIO_PMA_STAT2_10GBEW 0x0002 /* 10GBASE-EW ability */
157#define MDIO_PMA_STAT2_10GBLW 0x0004 /* 10GBASE-LW ability */
158#define MDIO_PMA_STAT2_10GBSW 0x0008 /* 10GBASE-SW ability */
159#define MDIO_PMA_STAT2_10GBLX4 0x0010 /* 10GBASE-LX4 ability */
160#define MDIO_PMA_STAT2_10GBER 0x0020 /* 10GBASE-ER ability */
161#define MDIO_PMA_STAT2_10GBLR 0x0040 /* 10GBASE-LR ability */
162#define MDIO_PMA_STAT2_10GBSR 0x0080 /* 10GBASE-SR ability */
163#define MDIO_PMD_STAT2_TXDISAB 0x0100 /* PMD TX disable ability */
164#define MDIO_PMA_STAT2_EXTABLE 0x0200 /* Extended abilities */
165#define MDIO_PMA_STAT2_RXFLTABLE 0x1000 /* Receive fault ability */
166#define MDIO_PMA_STAT2_TXFLTABLE 0x2000 /* Transmit fault ability */
167#define MDIO_PCS_STAT2_10GBR 0x0001 /* 10GBASE-R capable */
168#define MDIO_PCS_STAT2_10GBX 0x0002 /* 10GBASE-X capable */
169#define MDIO_PCS_STAT2_10GBW 0x0004 /* 10GBASE-W capable */
170#define MDIO_PCS_STAT2_RXFLTABLE 0x1000 /* Receive fault ability */
171#define MDIO_PCS_STAT2_TXFLTABLE 0x2000 /* Transmit fault ability */
172
173/* Transmit disable register. */
174#define MDIO_PMD_TXDIS_GLOBAL 0x0001 /* Global PMD TX disable */
175#define MDIO_PMD_TXDIS_0 0x0002 /* PMD TX disable 0 */
176#define MDIO_PMD_TXDIS_1 0x0004 /* PMD TX disable 1 */
177#define MDIO_PMD_TXDIS_2 0x0008 /* PMD TX disable 2 */
178#define MDIO_PMD_TXDIS_3 0x0010 /* PMD TX disable 3 */
179
180/* Receive signal detect register. */
181#define MDIO_PMD_RXDET_GLOBAL 0x0001 /* Global PMD RX signal detect */
182#define MDIO_PMD_RXDET_0 0x0002 /* PMD RX signal detect 0 */
183#define MDIO_PMD_RXDET_1 0x0004 /* PMD RX signal detect 1 */
184#define MDIO_PMD_RXDET_2 0x0008 /* PMD RX signal detect 2 */
185#define MDIO_PMD_RXDET_3 0x0010 /* PMD RX signal detect 3 */
186
187/* Extended abilities register. */
188#define MDIO_PMA_EXTABLE_10GCX4 0x0001 /* 10GBASE-CX4 ability */
189#define MDIO_PMA_EXTABLE_10GBLRM 0x0002 /* 10GBASE-LRM ability */
190#define MDIO_PMA_EXTABLE_10GBT 0x0004 /* 10GBASE-T ability */
191#define MDIO_PMA_EXTABLE_10GBKX4 0x0008 /* 10GBASE-KX4 ability */
192#define MDIO_PMA_EXTABLE_10GBKR 0x0010 /* 10GBASE-KR ability */
193#define MDIO_PMA_EXTABLE_1000BT 0x0020 /* 1000BASE-T ability */
194#define MDIO_PMA_EXTABLE_1000BKX 0x0040 /* 1000BASE-KX ability */
195#define MDIO_PMA_EXTABLE_100BTX 0x0080 /* 100BASE-TX ability */
196#define MDIO_PMA_EXTABLE_10BT 0x0100 /* 10BASE-T ability */
197
198/* PHY XGXS lane state register. */
199#define MDIO_PHYXS_LNSTAT_SYNC0 0x0001
200#define MDIO_PHYXS_LNSTAT_SYNC1 0x0002
201#define MDIO_PHYXS_LNSTAT_SYNC2 0x0004
202#define MDIO_PHYXS_LNSTAT_SYNC3 0x0008
203#define MDIO_PHYXS_LNSTAT_ALIGN 0x1000
204
205/* PMA 10GBASE-T pair swap & polarity */
206#define MDIO_PMA_10GBT_SWAPPOL_ABNX 0x0001 /* Pair A/B uncrossed */
207#define MDIO_PMA_10GBT_SWAPPOL_CDNX 0x0002 /* Pair C/D uncrossed */
208#define MDIO_PMA_10GBT_SWAPPOL_AREV 0x0100 /* Pair A polarity reversed */
209#define MDIO_PMA_10GBT_SWAPPOL_BREV 0x0200 /* Pair B polarity reversed */
210#define MDIO_PMA_10GBT_SWAPPOL_CREV 0x0400 /* Pair C polarity reversed */
211#define MDIO_PMA_10GBT_SWAPPOL_DREV 0x0800 /* Pair D polarity reversed */
212
213/* PMA 10GBASE-T TX power register. */
214#define MDIO_PMA_10GBT_TXPWR_SHORT 0x0001 /* Short-reach mode */
215
216/* PMA 10GBASE-T SNR registers. */
217/* Value is SNR margin in dB, clamped to range [-127, 127], plus 0x8000. */
218#define MDIO_PMA_10GBT_SNR_BIAS 0x8000
219#define MDIO_PMA_10GBT_SNR_MAX 127
220
221/* PMA 10GBASE-R FEC ability register. */
222#define MDIO_PMA_10GBR_FECABLE_ABLE 0x0001 /* FEC ability */
223#define MDIO_PMA_10GBR_FECABLE_ERRABLE 0x0002 /* FEC error indic. ability */
224
225/* PCS 10GBASE-R/-T status register 1. */
226#define MDIO_PCS_10GBRT_STAT1_BLKLK 0x0001 /* Block lock attained */
227
228/* PCS 10GBASE-R/-T status register 2. */
229#define MDIO_PCS_10GBRT_STAT2_ERR 0x00ff
230#define MDIO_PCS_10GBRT_STAT2_BER 0x3f00
231
232/* AN 10GBASE-T control register. */
233#define MDIO_AN_10GBT_CTRL_ADV10G 0x1000 /* Advertise 10GBASE-T */
234
235/* AN 10GBASE-T status register. */
236#define MDIO_AN_10GBT_STAT_LPTRR 0x0200 /* LP training reset req. */
237#define MDIO_AN_10GBT_STAT_LPLTABLE 0x0400 /* LP loop timing ability */
238#define MDIO_AN_10GBT_STAT_LP10G 0x0800 /* LP is 10GBT capable */
239#define MDIO_AN_10GBT_STAT_REMOK 0x1000 /* Remote OK */
240#define MDIO_AN_10GBT_STAT_LOCOK 0x2000 /* Local OK */
241#define MDIO_AN_10GBT_STAT_MS 0x4000 /* Master/slave config */
242#define MDIO_AN_10GBT_STAT_MSFLT 0x8000 /* Master/slave config fault */
243
244/* EEE Supported/Advertisement/LP Advertisement registers.
245 *
246 * EEE capability Register (3.20), Advertisement (7.60) and
247 * Link partner ability (7.61) registers have and can use the same identical
248 * bit masks.
249 */
250#define MDIO_AN_EEE_ADV_100TX 0x0002 /* Advertise 100TX EEE cap */
251#define MDIO_AN_EEE_ADV_1000T 0x0004 /* Advertise 1000T EEE cap */
252/* Note: the two defines above can be potentially used by the user-land
253 * and cannot remove them now.
254 * So, we define the new generic MDIO_EEE_100TX and MDIO_EEE_1000T macros
255 * using the previous ones (that can be considered obsolete).
256 */
257#define MDIO_EEE_100TX MDIO_AN_EEE_ADV_100TX /* 100TX EEE cap */
258#define MDIO_EEE_1000T MDIO_AN_EEE_ADV_1000T /* 1000T EEE cap */
259#define MDIO_EEE_10GT 0x0008 /* 10GT EEE cap */
260#define MDIO_EEE_1000KX 0x0010 /* 1000KX EEE cap */
261#define MDIO_EEE_10GKX4 0x0020 /* 10G KX4 EEE cap */
262#define MDIO_EEE_10GKR 0x0040 /* 10G KR EEE cap */
263
264/* LASI RX_ALARM control/status registers. */
265#define MDIO_PMA_LASI_RX_PHYXSLFLT 0x0001 /* PHY XS RX local fault */
266#define MDIO_PMA_LASI_RX_PCSLFLT 0x0008 /* PCS RX local fault */
267#define MDIO_PMA_LASI_RX_PMALFLT 0x0010 /* PMA/PMD RX local fault */
268#define MDIO_PMA_LASI_RX_OPTICPOWERFLT 0x0020 /* RX optical power fault */
269#define MDIO_PMA_LASI_RX_WISLFLT 0x0200 /* WIS local fault */
270
271/* LASI TX_ALARM control/status registers. */
272#define MDIO_PMA_LASI_TX_PHYXSLFLT 0x0001 /* PHY XS TX local fault */
273#define MDIO_PMA_LASI_TX_PCSLFLT 0x0008 /* PCS TX local fault */
274#define MDIO_PMA_LASI_TX_PMALFLT 0x0010 /* PMA/PMD TX local fault */
275#define MDIO_PMA_LASI_TX_LASERPOWERFLT 0x0080 /* Laser output power fault */
276#define MDIO_PMA_LASI_TX_LASERTEMPFLT 0x0100 /* Laser temperature fault */
277#define MDIO_PMA_LASI_TX_LASERBICURRFLT 0x0200 /* Laser bias current fault */
278
279/* LASI control/status registers. */
280#define MDIO_PMA_LASI_LSALARM 0x0001 /* LS_ALARM enable/status */
281#define MDIO_PMA_LASI_TXALARM 0x0002 /* TX_ALARM enable/status */
282#define MDIO_PMA_LASI_RXALARM 0x0004 /* RX_ALARM enable/status */
283
284/* Mapping between MDIO PRTAD/DEVAD and mii_ioctl_data::phy_id */
285
286#define MDIO_PHY_ID_C45 0x8000
287#define MDIO_PHY_ID_PRTAD 0x03e0
288#define MDIO_PHY_ID_DEVAD 0x001f
289#define MDIO_PHY_ID_C45_MASK \
290 (MDIO_PHY_ID_C45 | MDIO_PHY_ID_PRTAD | MDIO_PHY_ID_DEVAD)
291
292static inline __u16 mdio_phy_id_c45(int prtad, int devad)
293{
294 return MDIO_PHY_ID_C45 | (prtad << 5) | devad;
295}
296
297#endif /* _UAPI__LINUX_MDIO_H__ */
diff --git a/include/linux/media.h b/include/uapi/linux/media.h
index 0ef883327de2..0ef883327de2 100644
--- a/include/linux/media.h
+++ b/include/uapi/linux/media.h
diff --git a/include/linux/mei.h b/include/uapi/linux/mei.h
index bc0d8b69c49e..bc0d8b69c49e 100644
--- a/include/linux/mei.h
+++ b/include/uapi/linux/mei.h
diff --git a/include/uapi/linux/mempolicy.h b/include/uapi/linux/mempolicy.h
new file mode 100644
index 000000000000..23e62e0537e2
--- /dev/null
+++ b/include/uapi/linux/mempolicy.h
@@ -0,0 +1,64 @@
1/*
2 * NUMA memory policies for Linux.
3 * Copyright 2003,2004 Andi Kleen SuSE Labs
4 */
5#ifndef _UAPI_LINUX_MEMPOLICY_H
6#define _UAPI_LINUX_MEMPOLICY_H
7
8#include <linux/errno.h>
9
10
11/*
12 * Both the MPOL_* mempolicy mode and the MPOL_F_* optional mode flags are
13 * passed by the user to either set_mempolicy() or mbind() in an 'int' actual.
14 * The MPOL_MODE_FLAGS macro determines the legal set of optional mode flags.
15 */
16
17/* Policies */
18enum {
19 MPOL_DEFAULT,
20 MPOL_PREFERRED,
21 MPOL_BIND,
22 MPOL_INTERLEAVE,
23 MPOL_MAX, /* always last member of enum */
24};
25
26enum mpol_rebind_step {
27 MPOL_REBIND_ONCE, /* do rebind work at once(not by two step) */
28 MPOL_REBIND_STEP1, /* first step(set all the newly nodes) */
29 MPOL_REBIND_STEP2, /* second step(clean all the disallowed nodes)*/
30 MPOL_REBIND_NSTEP,
31};
32
33/* Flags for set_mempolicy */
34#define MPOL_F_STATIC_NODES (1 << 15)
35#define MPOL_F_RELATIVE_NODES (1 << 14)
36
37/*
38 * MPOL_MODE_FLAGS is the union of all possible optional mode flags passed to
39 * either set_mempolicy() or mbind().
40 */
41#define MPOL_MODE_FLAGS (MPOL_F_STATIC_NODES | MPOL_F_RELATIVE_NODES)
42
43/* Flags for get_mempolicy */
44#define MPOL_F_NODE (1<<0) /* return next IL mode instead of node mask */
45#define MPOL_F_ADDR (1<<1) /* look up vma using address */
46#define MPOL_F_MEMS_ALLOWED (1<<2) /* return allowed memories */
47
48/* Flags for mbind */
49#define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */
50#define MPOL_MF_MOVE (1<<1) /* Move pages owned by this process to conform to mapping */
51#define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to mapping */
52#define MPOL_MF_INTERNAL (1<<3) /* Internal flags start here */
53
54/*
55 * Internal flags that share the struct mempolicy flags word with
56 * "mode flags". These flags are allocated from bit 0 up, as they
57 * are never OR'ed into the mode in mempolicy API arguments.
58 */
59#define MPOL_F_SHARED (1 << 0) /* identify shared policies */
60#define MPOL_F_LOCAL (1 << 1) /* preferred local allocation */
61#define MPOL_F_REBINDING (1 << 2) /* identify policies in rebinding */
62
63
64#endif /* _UAPI_LINUX_MEMPOLICY_H */
diff --git a/include/linux/meye.h b/include/uapi/linux/meye.h
index 0dd49954f746..0dd49954f746 100644
--- a/include/linux/meye.h
+++ b/include/uapi/linux/meye.h
diff --git a/include/uapi/linux/mii.h b/include/uapi/linux/mii.h
new file mode 100644
index 000000000000..237fac4bc17b
--- /dev/null
+++ b/include/uapi/linux/mii.h
@@ -0,0 +1,161 @@
1/*
2 * linux/mii.h: definitions for MII-compatible transceivers
3 * Originally drivers/net/sunhme.h.
4 *
5 * Copyright (C) 1996, 1999, 2001 David S. Miller (davem@redhat.com)
6 */
7
8#ifndef _UAPI__LINUX_MII_H__
9#define _UAPI__LINUX_MII_H__
10
11#include <linux/types.h>
12#include <linux/ethtool.h>
13
14/* Generic MII registers. */
15#define MII_BMCR 0x00 /* Basic mode control register */
16#define MII_BMSR 0x01 /* Basic mode status register */
17#define MII_PHYSID1 0x02 /* PHYS ID 1 */
18#define MII_PHYSID2 0x03 /* PHYS ID 2 */
19#define MII_ADVERTISE 0x04 /* Advertisement control reg */
20#define MII_LPA 0x05 /* Link partner ability reg */
21#define MII_EXPANSION 0x06 /* Expansion register */
22#define MII_CTRL1000 0x09 /* 1000BASE-T control */
23#define MII_STAT1000 0x0a /* 1000BASE-T status */
24#define MII_MMD_CTRL 0x0d /* MMD Access Control Register */
25#define MII_MMD_DATA 0x0e /* MMD Access Data Register */
26#define MII_ESTATUS 0x0f /* Extended Status */
27#define MII_DCOUNTER 0x12 /* Disconnect counter */
28#define MII_FCSCOUNTER 0x13 /* False carrier counter */
29#define MII_NWAYTEST 0x14 /* N-way auto-neg test reg */
30#define MII_RERRCOUNTER 0x15 /* Receive error counter */
31#define MII_SREVISION 0x16 /* Silicon revision */
32#define MII_RESV1 0x17 /* Reserved... */
33#define MII_LBRERROR 0x18 /* Lpback, rx, bypass error */
34#define MII_PHYADDR 0x19 /* PHY address */
35#define MII_RESV2 0x1a /* Reserved... */
36#define MII_TPISTATUS 0x1b /* TPI status for 10mbps */
37#define MII_NCONFIG 0x1c /* Network interface config */
38
39/* Basic mode control register. */
40#define BMCR_RESV 0x003f /* Unused... */
41#define BMCR_SPEED1000 0x0040 /* MSB of Speed (1000) */
42#define BMCR_CTST 0x0080 /* Collision test */
43#define BMCR_FULLDPLX 0x0100 /* Full duplex */
44#define BMCR_ANRESTART 0x0200 /* Auto negotiation restart */
45#define BMCR_ISOLATE 0x0400 /* Isolate data paths from MII */
46#define BMCR_PDOWN 0x0800 /* Enable low power state */
47#define BMCR_ANENABLE 0x1000 /* Enable auto negotiation */
48#define BMCR_SPEED100 0x2000 /* Select 100Mbps */
49#define BMCR_LOOPBACK 0x4000 /* TXD loopback bits */
50#define BMCR_RESET 0x8000 /* Reset to default state */
51
52/* Basic mode status register. */
53#define BMSR_ERCAP 0x0001 /* Ext-reg capability */
54#define BMSR_JCD 0x0002 /* Jabber detected */
55#define BMSR_LSTATUS 0x0004 /* Link status */
56#define BMSR_ANEGCAPABLE 0x0008 /* Able to do auto-negotiation */
57#define BMSR_RFAULT 0x0010 /* Remote fault detected */
58#define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */
59#define BMSR_RESV 0x00c0 /* Unused... */
60#define BMSR_ESTATEN 0x0100 /* Extended Status in R15 */
61#define BMSR_100HALF2 0x0200 /* Can do 100BASE-T2 HDX */
62#define BMSR_100FULL2 0x0400 /* Can do 100BASE-T2 FDX */
63#define BMSR_10HALF 0x0800 /* Can do 10mbps, half-duplex */
64#define BMSR_10FULL 0x1000 /* Can do 10mbps, full-duplex */
65#define BMSR_100HALF 0x2000 /* Can do 100mbps, half-duplex */
66#define BMSR_100FULL 0x4000 /* Can do 100mbps, full-duplex */
67#define BMSR_100BASE4 0x8000 /* Can do 100mbps, 4k packets */
68
69/* Advertisement control register. */
70#define ADVERTISE_SLCT 0x001f /* Selector bits */
71#define ADVERTISE_CSMA 0x0001 /* Only selector supported */
72#define ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */
73#define ADVERTISE_1000XFULL 0x0020 /* Try for 1000BASE-X full-duplex */
74#define ADVERTISE_10FULL 0x0040 /* Try for 10mbps full-duplex */
75#define ADVERTISE_1000XHALF 0x0040 /* Try for 1000BASE-X half-duplex */
76#define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */
77#define ADVERTISE_1000XPAUSE 0x0080 /* Try for 1000BASE-X pause */
78#define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */
79#define ADVERTISE_1000XPSE_ASYM 0x0100 /* Try for 1000BASE-X asym pause */
80#define ADVERTISE_100BASE4 0x0200 /* Try for 100mbps 4k packets */
81#define ADVERTISE_PAUSE_CAP 0x0400 /* Try for pause */
82#define ADVERTISE_PAUSE_ASYM 0x0800 /* Try for asymetric pause */
83#define ADVERTISE_RESV 0x1000 /* Unused... */
84#define ADVERTISE_RFAULT 0x2000 /* Say we can detect faults */
85#define ADVERTISE_LPACK 0x4000 /* Ack link partners response */
86#define ADVERTISE_NPAGE 0x8000 /* Next page bit */
87
88#define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \
89 ADVERTISE_CSMA)
90#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \
91 ADVERTISE_100HALF | ADVERTISE_100FULL)
92
93/* Link partner ability register. */
94#define LPA_SLCT 0x001f /* Same as advertise selector */
95#define LPA_10HALF 0x0020 /* Can do 10mbps half-duplex */
96#define LPA_1000XFULL 0x0020 /* Can do 1000BASE-X full-duplex */
97#define LPA_10FULL 0x0040 /* Can do 10mbps full-duplex */
98#define LPA_1000XHALF 0x0040 /* Can do 1000BASE-X half-duplex */
99#define LPA_100HALF 0x0080 /* Can do 100mbps half-duplex */
100#define LPA_1000XPAUSE 0x0080 /* Can do 1000BASE-X pause */
101#define LPA_100FULL 0x0100 /* Can do 100mbps full-duplex */
102#define LPA_1000XPAUSE_ASYM 0x0100 /* Can do 1000BASE-X pause asym*/
103#define LPA_100BASE4 0x0200 /* Can do 100mbps 4k packets */
104#define LPA_PAUSE_CAP 0x0400 /* Can pause */
105#define LPA_PAUSE_ASYM 0x0800 /* Can pause asymetrically */
106#define LPA_RESV 0x1000 /* Unused... */
107#define LPA_RFAULT 0x2000 /* Link partner faulted */
108#define LPA_LPACK 0x4000 /* Link partner acked us */
109#define LPA_NPAGE 0x8000 /* Next page bit */
110
111#define LPA_DUPLEX (LPA_10FULL | LPA_100FULL)
112#define LPA_100 (LPA_100FULL | LPA_100HALF | LPA_100BASE4)
113
114/* Expansion register for auto-negotiation. */
115#define EXPANSION_NWAY 0x0001 /* Can do N-way auto-nego */
116#define EXPANSION_LCWP 0x0002 /* Got new RX page code word */
117#define EXPANSION_ENABLENPAGE 0x0004 /* This enables npage words */
118#define EXPANSION_NPCAPABLE 0x0008 /* Link partner supports npage */
119#define EXPANSION_MFAULTS 0x0010 /* Multiple faults detected */
120#define EXPANSION_RESV 0xffe0 /* Unused... */
121
122#define ESTATUS_1000_TFULL 0x2000 /* Can do 1000BT Full */
123#define ESTATUS_1000_THALF 0x1000 /* Can do 1000BT Half */
124
125/* N-way test register. */
126#define NWAYTEST_RESV1 0x00ff /* Unused... */
127#define NWAYTEST_LOOPBACK 0x0100 /* Enable loopback for N-way */
128#define NWAYTEST_RESV2 0xfe00 /* Unused... */
129
130/* 1000BASE-T Control register */
131#define ADVERTISE_1000FULL 0x0200 /* Advertise 1000BASE-T full duplex */
132#define ADVERTISE_1000HALF 0x0100 /* Advertise 1000BASE-T half duplex */
133#define CTL1000_AS_MASTER 0x0800
134#define CTL1000_ENABLE_MASTER 0x1000
135
136/* 1000BASE-T Status register */
137#define LPA_1000LOCALRXOK 0x2000 /* Link partner local receiver status */
138#define LPA_1000REMRXOK 0x1000 /* Link partner remote receiver status */
139#define LPA_1000FULL 0x0800 /* Link partner 1000BASE-T full duplex */
140#define LPA_1000HALF 0x0400 /* Link partner 1000BASE-T half duplex */
141
142/* Flow control flags */
143#define FLOW_CTRL_TX 0x01
144#define FLOW_CTRL_RX 0x02
145
146/* MMD Access Control register fields */
147#define MII_MMD_CTRL_DEVAD_MASK 0x1f /* Mask MMD DEVAD*/
148#define MII_MMD_CTRL_ADDR 0x0000 /* Address */
149#define MII_MMD_CTRL_NOINCR 0x4000 /* no post increment */
150#define MII_MMD_CTRL_INCR_RDWT 0x8000 /* post increment on reads & writes */
151#define MII_MMD_CTRL_INCR_ON_WT 0xC000 /* post increment on writes only */
152
153/* This structure is used in all SIOCxMIIxxx ioctl calls */
154struct mii_ioctl_data {
155 __u16 phy_id;
156 __u16 reg_num;
157 __u16 val_in;
158 __u16 val_out;
159};
160
161#endif /* _UAPI__LINUX_MII_H__ */
diff --git a/include/linux/minix_fs.h b/include/uapi/linux/minix_fs.h
index 13fe09e0576a..13fe09e0576a 100644
--- a/include/linux/minix_fs.h
+++ b/include/uapi/linux/minix_fs.h
diff --git a/include/uapi/linux/mman.h b/include/uapi/linux/mman.h
new file mode 100644
index 000000000000..ade4acd3a90c
--- /dev/null
+++ b/include/uapi/linux/mman.h
@@ -0,0 +1,13 @@
1#ifndef _UAPI_LINUX_MMAN_H
2#define _UAPI_LINUX_MMAN_H
3
4#include <asm/mman.h>
5
6#define MREMAP_MAYMOVE 1
7#define MREMAP_FIXED 2
8
9#define OVERCOMMIT_GUESS 0
10#define OVERCOMMIT_ALWAYS 1
11#define OVERCOMMIT_NEVER 2
12
13#endif /* _UAPI_LINUX_MMAN_H */
diff --git a/include/uapi/linux/mmc/Kbuild b/include/uapi/linux/mmc/Kbuild
index aafaa5aa54d4..8c1d2cb75e33 100644
--- a/include/uapi/linux/mmc/Kbuild
+++ b/include/uapi/linux/mmc/Kbuild
@@ -1 +1,2 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += ioctl.h
diff --git a/include/linux/mmc/ioctl.h b/include/uapi/linux/mmc/ioctl.h
index 1f5e68923929..1f5e68923929 100644
--- a/include/linux/mmc/ioctl.h
+++ b/include/uapi/linux/mmc/ioctl.h
diff --git a/include/linux/mmtimer.h b/include/uapi/linux/mmtimer.h
index 884cabf16088..884cabf16088 100644
--- a/include/linux/mmtimer.h
+++ b/include/uapi/linux/mmtimer.h
diff --git a/include/linux/mqueue.h b/include/uapi/linux/mqueue.h
index 8b5a79615fbf..8b5a79615fbf 100644
--- a/include/linux/mqueue.h
+++ b/include/uapi/linux/mqueue.h
diff --git a/include/uapi/linux/mroute.h b/include/uapi/linux/mroute.h
new file mode 100644
index 000000000000..16929993acc4
--- /dev/null
+++ b/include/uapi/linux/mroute.h
@@ -0,0 +1,143 @@
1#ifndef _UAPI__LINUX_MROUTE_H
2#define _UAPI__LINUX_MROUTE_H
3
4#include <linux/sockios.h>
5#include <linux/types.h>
6
7/*
8 * Based on the MROUTING 3.5 defines primarily to keep
9 * source compatibility with BSD.
10 *
11 * See the mrouted code for the original history.
12 *
13 * Protocol Independent Multicast (PIM) data structures included
14 * Carlos Picoto (cap@di.fc.ul.pt)
15 *
16 */
17
18#define MRT_BASE 200
19#define MRT_INIT (MRT_BASE) /* Activate the kernel mroute code */
20#define MRT_DONE (MRT_BASE+1) /* Shutdown the kernel mroute */
21#define MRT_ADD_VIF (MRT_BASE+2) /* Add a virtual interface */
22#define MRT_DEL_VIF (MRT_BASE+3) /* Delete a virtual interface */
23#define MRT_ADD_MFC (MRT_BASE+4) /* Add a multicast forwarding entry */
24#define MRT_DEL_MFC (MRT_BASE+5) /* Delete a multicast forwarding entry */
25#define MRT_VERSION (MRT_BASE+6) /* Get the kernel multicast version */
26#define MRT_ASSERT (MRT_BASE+7) /* Activate PIM assert mode */
27#define MRT_PIM (MRT_BASE+8) /* enable PIM code */
28#define MRT_TABLE (MRT_BASE+9) /* Specify mroute table ID */
29
30#define SIOCGETVIFCNT SIOCPROTOPRIVATE /* IP protocol privates */
31#define SIOCGETSGCNT (SIOCPROTOPRIVATE+1)
32#define SIOCGETRPF (SIOCPROTOPRIVATE+2)
33
34#define MAXVIFS 32
35typedef unsigned long vifbitmap_t; /* User mode code depends on this lot */
36typedef unsigned short vifi_t;
37#define ALL_VIFS ((vifi_t)(-1))
38
39/*
40 * Same idea as select
41 */
42
43#define VIFM_SET(n,m) ((m)|=(1<<(n)))
44#define VIFM_CLR(n,m) ((m)&=~(1<<(n)))
45#define VIFM_ISSET(n,m) ((m)&(1<<(n)))
46#define VIFM_CLRALL(m) ((m)=0)
47#define VIFM_COPY(mfrom,mto) ((mto)=(mfrom))
48#define VIFM_SAME(m1,m2) ((m1)==(m2))
49
50/*
51 * Passed by mrouted for an MRT_ADD_VIF - again we use the
52 * mrouted 3.6 structures for compatibility
53 */
54
55struct vifctl {
56 vifi_t vifc_vifi; /* Index of VIF */
57 unsigned char vifc_flags; /* VIFF_ flags */
58 unsigned char vifc_threshold; /* ttl limit */
59 unsigned int vifc_rate_limit; /* Rate limiter values (NI) */
60 union {
61 struct in_addr vifc_lcl_addr; /* Local interface address */
62 int vifc_lcl_ifindex; /* Local interface index */
63 };
64 struct in_addr vifc_rmt_addr; /* IPIP tunnel addr */
65};
66
67#define VIFF_TUNNEL 0x1 /* IPIP tunnel */
68#define VIFF_SRCRT 0x2 /* NI */
69#define VIFF_REGISTER 0x4 /* register vif */
70#define VIFF_USE_IFINDEX 0x8 /* use vifc_lcl_ifindex instead of
71 vifc_lcl_addr to find an interface */
72
73/*
74 * Cache manipulation structures for mrouted and PIMd
75 */
76
77struct mfcctl {
78 struct in_addr mfcc_origin; /* Origin of mcast */
79 struct in_addr mfcc_mcastgrp; /* Group in question */
80 vifi_t mfcc_parent; /* Where it arrived */
81 unsigned char mfcc_ttls[MAXVIFS]; /* Where it is going */
82 unsigned int mfcc_pkt_cnt; /* pkt count for src-grp */
83 unsigned int mfcc_byte_cnt;
84 unsigned int mfcc_wrong_if;
85 int mfcc_expire;
86};
87
88/*
89 * Group count retrieval for mrouted
90 */
91
92struct sioc_sg_req {
93 struct in_addr src;
94 struct in_addr grp;
95 unsigned long pktcnt;
96 unsigned long bytecnt;
97 unsigned long wrong_if;
98};
99
100/*
101 * To get vif packet counts
102 */
103
104struct sioc_vif_req {
105 vifi_t vifi; /* Which iface */
106 unsigned long icount; /* In packets */
107 unsigned long ocount; /* Out packets */
108 unsigned long ibytes; /* In bytes */
109 unsigned long obytes; /* Out bytes */
110};
111
112/*
113 * This is the format the mroute daemon expects to see IGMP control
114 * data. Magically happens to be like an IP packet as per the original
115 */
116
117struct igmpmsg {
118 __u32 unused1,unused2;
119 unsigned char im_msgtype; /* What is this */
120 unsigned char im_mbz; /* Must be zero */
121 unsigned char im_vif; /* Interface (this ought to be a vifi_t!) */
122 unsigned char unused3;
123 struct in_addr im_src,im_dst;
124};
125
126/*
127 * That's all usermode folks
128 */
129
130
131
132#define MFC_ASSERT_THRESH (3*HZ) /* Maximal freq. of asserts */
133
134/*
135 * Pseudo messages used by mrouted
136 */
137
138#define IGMPMSG_NOCACHE 1 /* Kern cache fill request to mrouted */
139#define IGMPMSG_WRONGVIF 2 /* For PIM assert processing (unused) */
140#define IGMPMSG_WHOLEPKT 3 /* For PIM Register processing */
141
142
143#endif /* _UAPI__LINUX_MROUTE_H */
diff --git a/include/uapi/linux/mroute6.h b/include/uapi/linux/mroute6.h
new file mode 100644
index 000000000000..3e89b5e7f9e3
--- /dev/null
+++ b/include/uapi/linux/mroute6.h
@@ -0,0 +1,137 @@
1#ifndef _UAPI__LINUX_MROUTE6_H
2#define _UAPI__LINUX_MROUTE6_H
3
4#include <linux/types.h>
5#include <linux/sockios.h>
6
7/*
8 * Based on the MROUTING 3.5 defines primarily to keep
9 * source compatibility with BSD.
10 *
11 * See the pim6sd code for the original history.
12 *
13 * Protocol Independent Multicast (PIM) data structures included
14 * Carlos Picoto (cap@di.fc.ul.pt)
15 *
16 */
17
18#define MRT6_BASE 200
19#define MRT6_INIT (MRT6_BASE) /* Activate the kernel mroute code */
20#define MRT6_DONE (MRT6_BASE+1) /* Shutdown the kernel mroute */
21#define MRT6_ADD_MIF (MRT6_BASE+2) /* Add a virtual interface */
22#define MRT6_DEL_MIF (MRT6_BASE+3) /* Delete a virtual interface */
23#define MRT6_ADD_MFC (MRT6_BASE+4) /* Add a multicast forwarding entry */
24#define MRT6_DEL_MFC (MRT6_BASE+5) /* Delete a multicast forwarding entry */
25#define MRT6_VERSION (MRT6_BASE+6) /* Get the kernel multicast version */
26#define MRT6_ASSERT (MRT6_BASE+7) /* Activate PIM assert mode */
27#define MRT6_PIM (MRT6_BASE+8) /* enable PIM code */
28#define MRT6_TABLE (MRT6_BASE+9) /* Specify mroute table ID */
29
30#define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE /* IP protocol privates */
31#define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1)
32#define SIOCGETRPF (SIOCPROTOPRIVATE+2)
33
34#define MAXMIFS 32
35typedef unsigned long mifbitmap_t; /* User mode code depends on this lot */
36typedef unsigned short mifi_t;
37#define ALL_MIFS ((mifi_t)(-1))
38
39#ifndef IF_SETSIZE
40#define IF_SETSIZE 256
41#endif
42
43typedef __u32 if_mask;
44#define NIFBITS (sizeof(if_mask) * 8) /* bits per mask */
45
46#if !defined(__KERNEL__)
47#if !defined(DIV_ROUND_UP)
48#define DIV_ROUND_UP(x,y) (((x) + ((y) - 1)) / (y))
49#endif
50#endif
51
52typedef struct if_set {
53 if_mask ifs_bits[DIV_ROUND_UP(IF_SETSIZE, NIFBITS)];
54} if_set;
55
56#define IF_SET(n, p) ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS)))
57#define IF_CLR(n, p) ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS)))
58#define IF_ISSET(n, p) ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS)))
59#define IF_COPY(f, t) bcopy(f, t, sizeof(*(f)))
60#define IF_ZERO(p) bzero(p, sizeof(*(p)))
61
62/*
63 * Passed by mrouted for an MRT_ADD_MIF - again we use the
64 * mrouted 3.6 structures for compatibility
65 */
66
67struct mif6ctl {
68 mifi_t mif6c_mifi; /* Index of MIF */
69 unsigned char mif6c_flags; /* MIFF_ flags */
70 unsigned char vifc_threshold; /* ttl limit */
71 __u16 mif6c_pifi; /* the index of the physical IF */
72 unsigned int vifc_rate_limit; /* Rate limiter values (NI) */
73};
74
75#define MIFF_REGISTER 0x1 /* register vif */
76
77/*
78 * Cache manipulation structures for mrouted and PIMd
79 */
80
81struct mf6cctl {
82 struct sockaddr_in6 mf6cc_origin; /* Origin of mcast */
83 struct sockaddr_in6 mf6cc_mcastgrp; /* Group in question */
84 mifi_t mf6cc_parent; /* Where it arrived */
85 struct if_set mf6cc_ifset; /* Where it is going */
86};
87
88/*
89 * Group count retrieval for pim6sd
90 */
91
92struct sioc_sg_req6 {
93 struct sockaddr_in6 src;
94 struct sockaddr_in6 grp;
95 unsigned long pktcnt;
96 unsigned long bytecnt;
97 unsigned long wrong_if;
98};
99
100/*
101 * To get vif packet counts
102 */
103
104struct sioc_mif_req6 {
105 mifi_t mifi; /* Which iface */
106 unsigned long icount; /* In packets */
107 unsigned long ocount; /* Out packets */
108 unsigned long ibytes; /* In bytes */
109 unsigned long obytes; /* Out bytes */
110};
111
112/*
113 * That's all usermode folks
114 */
115
116
117
118/*
119 * Structure used to communicate from kernel to multicast router.
120 * We'll overlay the structure onto an MLD header (not an IPv6 heder like igmpmsg{}
121 * used for IPv4 implementation). This is because this structure will be passed via an
122 * IPv6 raw socket, on which an application will only receiver the payload i.e the data after
123 * the IPv6 header and all the extension headers. (See section 3 of RFC 3542)
124 */
125
126struct mrt6msg {
127#define MRT6MSG_NOCACHE 1
128#define MRT6MSG_WRONGMIF 2
129#define MRT6MSG_WHOLEPKT 3 /* used for use level encap */
130 __u8 im6_mbz; /* must be zero */
131 __u8 im6_msgtype; /* what type of message */
132 __u16 im6_mif; /* mif rec'd on */
133 __u32 im6_pad; /* padding for 64 bit arch */
134 struct in6_addr im6_src, im6_dst;
135};
136
137#endif /* _UAPI__LINUX_MROUTE6_H */
diff --git a/include/uapi/linux/msdos_fs.h b/include/uapi/linux/msdos_fs.h
new file mode 100644
index 000000000000..996719f82e28
--- /dev/null
+++ b/include/uapi/linux/msdos_fs.h
@@ -0,0 +1,167 @@
1#ifndef _UAPI_LINUX_MSDOS_FS_H
2#define _UAPI_LINUX_MSDOS_FS_H
3
4#include <linux/types.h>
5#include <linux/magic.h>
6#include <asm/byteorder.h>
7
8/*
9 * The MS-DOS filesystem constants/structures
10 */
11
12#define SECTOR_SIZE 512 /* sector size (bytes) */
13#define SECTOR_BITS 9 /* log2(SECTOR_SIZE) */
14#define MSDOS_DPB (MSDOS_DPS) /* dir entries per block */
15#define MSDOS_DPB_BITS 4 /* log2(MSDOS_DPB) */
16#define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry))
17#define MSDOS_DPS_BITS 4 /* log2(MSDOS_DPS) */
18#define MSDOS_LONGNAME 256 /* maximum name length */
19#define CF_LE_W(v) le16_to_cpu(v)
20#define CF_LE_L(v) le32_to_cpu(v)
21#define CT_LE_W(v) cpu_to_le16(v)
22#define CT_LE_L(v) cpu_to_le32(v)
23
24#define MSDOS_ROOT_INO 1 /* The root inode number */
25#define MSDOS_FSINFO_INO 2 /* Used for managing the FSINFO block */
26
27#define MSDOS_DIR_BITS 5 /* log2(sizeof(struct msdos_dir_entry)) */
28
29/* directory limit */
30#define FAT_MAX_DIR_ENTRIES (65536)
31#define FAT_MAX_DIR_SIZE (FAT_MAX_DIR_ENTRIES << MSDOS_DIR_BITS)
32
33#define ATTR_NONE 0 /* no attribute bits */
34#define ATTR_RO 1 /* read-only */
35#define ATTR_HIDDEN 2 /* hidden */
36#define ATTR_SYS 4 /* system */
37#define ATTR_VOLUME 8 /* volume label */
38#define ATTR_DIR 16 /* directory */
39#define ATTR_ARCH 32 /* archived */
40
41/* attribute bits that are copied "as is" */
42#define ATTR_UNUSED (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN)
43/* bits that are used by the Windows 95/Windows NT extended FAT */
44#define ATTR_EXT (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME)
45
46#define CASE_LOWER_BASE 8 /* base is lower case */
47#define CASE_LOWER_EXT 16 /* extension is lower case */
48
49#define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */
50#define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG)
51
52#define FAT_LFN_LEN 255 /* maximum long name length */
53#define MSDOS_NAME 11 /* maximum name length */
54#define MSDOS_SLOTS 21 /* max # of slots for short and long names */
55#define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */
56#define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */
57
58#define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : \
59 MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x))
60
61/* start of data cluster's entry (number of reserved clusters) */
62#define FAT_START_ENT 2
63
64/* maximum number of clusters */
65#define MAX_FAT12 0xFF4
66#define MAX_FAT16 0xFFF4
67#define MAX_FAT32 0x0FFFFFF6
68#define MAX_FAT(s) (MSDOS_SB(s)->fat_bits == 32 ? MAX_FAT32 : \
69 MSDOS_SB(s)->fat_bits == 16 ? MAX_FAT16 : MAX_FAT12)
70
71/* bad cluster mark */
72#define BAD_FAT12 0xFF7
73#define BAD_FAT16 0xFFF7
74#define BAD_FAT32 0x0FFFFFF7
75
76/* standard EOF */
77#define EOF_FAT12 0xFFF
78#define EOF_FAT16 0xFFFF
79#define EOF_FAT32 0x0FFFFFFF
80
81#define FAT_ENT_FREE (0)
82#define FAT_ENT_BAD (BAD_FAT32)
83#define FAT_ENT_EOF (EOF_FAT32)
84
85#define FAT_FSINFO_SIG1 0x41615252
86#define FAT_FSINFO_SIG2 0x61417272
87#define IS_FSINFO(x) (le32_to_cpu((x)->signature1) == FAT_FSINFO_SIG1 \
88 && le32_to_cpu((x)->signature2) == FAT_FSINFO_SIG2)
89
90struct __fat_dirent {
91 long d_ino;
92 __kernel_off_t d_off;
93 unsigned short d_reclen;
94 char d_name[256]; /* We must not include limits.h! */
95};
96
97/*
98 * ioctl commands
99 */
100#define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, struct __fat_dirent[2])
101#define VFAT_IOCTL_READDIR_SHORT _IOR('r', 2, struct __fat_dirent[2])
102/* <linux/videotext.h> has used 0x72 ('r') in collision, so skip a few */
103#define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32)
104#define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32)
105
106struct fat_boot_sector {
107 __u8 ignored[3]; /* Boot strap short or near jump */
108 __u8 system_id[8]; /* Name - can be used to special case
109 partition manager volumes */
110 __u8 sector_size[2]; /* bytes per logical sector */
111 __u8 sec_per_clus; /* sectors/cluster */
112 __le16 reserved; /* reserved sectors */
113 __u8 fats; /* number of FATs */
114 __u8 dir_entries[2]; /* root directory entries */
115 __u8 sectors[2]; /* number of sectors */
116 __u8 media; /* media code */
117 __le16 fat_length; /* sectors/FAT */
118 __le16 secs_track; /* sectors per track */
119 __le16 heads; /* number of heads */
120 __le32 hidden; /* hidden sectors (unused) */
121 __le32 total_sect; /* number of sectors (if sectors == 0) */
122
123 /* The following fields are only used by FAT32 */
124 __le32 fat32_length; /* sectors/FAT */
125 __le16 flags; /* bit 8: fat mirroring, low 4: active fat */
126 __u8 version[2]; /* major, minor filesystem version */
127 __le32 root_cluster; /* first cluster in root directory */
128 __le16 info_sector; /* filesystem info sector */
129 __le16 backup_boot; /* backup boot sector */
130 __le16 reserved2[6]; /* Unused */
131};
132
133struct fat_boot_fsinfo {
134 __le32 signature1; /* 0x41615252L */
135 __le32 reserved1[120]; /* Nothing as far as I can tell */
136 __le32 signature2; /* 0x61417272L */
137 __le32 free_clusters; /* Free cluster count. -1 if unknown */
138 __le32 next_cluster; /* Most recently allocated cluster */
139 __le32 reserved2[4];
140};
141
142struct msdos_dir_entry {
143 __u8 name[MSDOS_NAME];/* name and extension */
144 __u8 attr; /* attribute bits */
145 __u8 lcase; /* Case for base and extension */
146 __u8 ctime_cs; /* Creation time, centiseconds (0-199) */
147 __le16 ctime; /* Creation time */
148 __le16 cdate; /* Creation date */
149 __le16 adate; /* Last access date */
150 __le16 starthi; /* High 16 bits of cluster in FAT32 */
151 __le16 time,date,start;/* time, date and first cluster */
152 __le32 size; /* file size (in bytes) */
153};
154
155/* Up to 13 characters of the name */
156struct msdos_dir_slot {
157 __u8 id; /* sequence number for slot */
158 __u8 name0_4[10]; /* first 5 characters in name */
159 __u8 attr; /* attribute byte */
160 __u8 reserved; /* always 0 */
161 __u8 alias_checksum; /* checksum for 8.3 alias */
162 __u8 name5_10[12]; /* 6 more characters in name */
163 __le16 start; /* starting cluster number, 0 in long slots */
164 __u8 name11_12[4]; /* last 2 characters in name */
165};
166
167#endif /* _UAPI_LINUX_MSDOS_FS_H */
diff --git a/include/uapi/linux/msg.h b/include/uapi/linux/msg.h
new file mode 100644
index 000000000000..78dbd2f996a3
--- /dev/null
+++ b/include/uapi/linux/msg.h
@@ -0,0 +1,75 @@
1#ifndef _UAPI_LINUX_MSG_H
2#define _UAPI_LINUX_MSG_H
3
4#include <linux/ipc.h>
5
6/* ipcs ctl commands */
7#define MSG_STAT 11
8#define MSG_INFO 12
9
10/* msgrcv options */
11#define MSG_NOERROR 010000 /* no error if message is too big */
12#define MSG_EXCEPT 020000 /* recv any msg except of specified type.*/
13
14/* Obsolete, used only for backwards compatibility and libc5 compiles */
15struct msqid_ds {
16 struct ipc_perm msg_perm;
17 struct msg *msg_first; /* first message on queue,unused */
18 struct msg *msg_last; /* last message in queue,unused */
19 __kernel_time_t msg_stime; /* last msgsnd time */
20 __kernel_time_t msg_rtime; /* last msgrcv time */
21 __kernel_time_t msg_ctime; /* last change time */
22 unsigned long msg_lcbytes; /* Reuse junk fields for 32 bit */
23 unsigned long msg_lqbytes; /* ditto */
24 unsigned short msg_cbytes; /* current number of bytes on queue */
25 unsigned short msg_qnum; /* number of messages in queue */
26 unsigned short msg_qbytes; /* max number of bytes on queue */
27 __kernel_ipc_pid_t msg_lspid; /* pid of last msgsnd */
28 __kernel_ipc_pid_t msg_lrpid; /* last receive pid */
29};
30
31/* Include the definition of msqid64_ds */
32#include <asm/msgbuf.h>
33
34/* message buffer for msgsnd and msgrcv calls */
35struct msgbuf {
36 long mtype; /* type of message */
37 char mtext[1]; /* message text */
38};
39
40/* buffer for msgctl calls IPC_INFO, MSG_INFO */
41struct msginfo {
42 int msgpool;
43 int msgmap;
44 int msgmax;
45 int msgmnb;
46 int msgmni;
47 int msgssz;
48 int msgtql;
49 unsigned short msgseg;
50};
51
52/*
53 * Scaling factor to compute msgmni:
54 * the memory dedicated to msg queues (msgmni * msgmnb) should occupy
55 * at most 1/MSG_MEM_SCALE of the lowmem (see the formula in ipc/msg.c):
56 * up to 8MB : msgmni = 16 (MSGMNI)
57 * 4 GB : msgmni = 8K
58 * more than 16 GB : msgmni = 32K (IPCMNI)
59 */
60#define MSG_MEM_SCALE 32
61
62#define MSGMNI 16 /* <= IPCMNI */ /* max # of msg queue identifiers */
63#define MSGMAX 8192 /* <= INT_MAX */ /* max size of message (bytes) */
64#define MSGMNB 16384 /* <= INT_MAX */ /* default max size of a message queue */
65
66/* unused */
67#define MSGPOOL (MSGMNI * MSGMNB / 1024) /* size in kbytes of message pool */
68#define MSGTQL MSGMNB /* number of system message headers */
69#define MSGMAP MSGMNB /* number of entries in message map */
70#define MSGSSZ 16 /* message segment size */
71#define __MSGSEG ((MSGPOOL * 1024) / MSGSSZ) /* max no. of segments */
72#define MSGSEG (__MSGSEG <= 0xffff ? __MSGSEG : 0xffff)
73
74
75#endif /* _UAPI_LINUX_MSG_H */
diff --git a/include/linux/mtio.h b/include/uapi/linux/mtio.h
index 18543e2db06f..18543e2db06f 100644
--- a/include/linux/mtio.h
+++ b/include/uapi/linux/mtio.h
diff --git a/include/uapi/linux/n_r3964.h b/include/uapi/linux/n_r3964.h
new file mode 100644
index 000000000000..81337cbf40b7
--- /dev/null
+++ b/include/uapi/linux/n_r3964.h
@@ -0,0 +1,98 @@
1/* r3964 linediscipline for linux
2 *
3 * -----------------------------------------------------------
4 * Copyright by
5 * Philips Automation Projects
6 * Kassel (Germany)
7 * -----------------------------------------------------------
8 * This software may be used and distributed according to the terms of
9 * the GNU General Public License, incorporated herein by reference.
10 *
11 * Author:
12 * L. Haag
13 *
14 * $Log: r3964.h,v $
15 * Revision 1.4 2005/12/21 19:54:24 Kurt Huwig <kurt huwig de>
16 * Fixed HZ usage on 2.6 kernels
17 * Removed unnecessary include
18 *
19 * Revision 1.3 2001/03/18 13:02:24 dwmw2
20 * Fix timer usage, use spinlocks properly.
21 *
22 * Revision 1.2 2001/03/18 12:53:15 dwmw2
23 * Merge changes in 2.4.2
24 *
25 * Revision 1.1.1.1 1998/10/13 16:43:14 dwmw2
26 * This'll screw the version control
27 *
28 * Revision 1.6 1998/09/30 00:40:38 dwmw2
29 * Updated to use kernel's N_R3964 if available
30 *
31 * Revision 1.4 1998/04/02 20:29:44 lhaag
32 * select, blocking, ...
33 *
34 * Revision 1.3 1998/02/12 18:58:43 root
35 * fixed some memory leaks
36 * calculation of checksum characters
37 *
38 * Revision 1.2 1998/02/07 13:03:17 root
39 * ioctl read_telegram
40 *
41 * Revision 1.1 1998/02/06 19:19:43 root
42 * Initial revision
43 *
44 *
45 */
46
47#ifndef _UAPI__LINUX_N_R3964_H__
48#define _UAPI__LINUX_N_R3964_H__
49
50/* line disciplines for r3964 protocol */
51
52
53/*
54 * Ioctl-commands
55 */
56
57#define R3964_ENABLE_SIGNALS 0x5301
58#define R3964_SETPRIORITY 0x5302
59#define R3964_USE_BCC 0x5303
60#define R3964_READ_TELEGRAM 0x5304
61
62/* Options for R3964_SETPRIORITY */
63#define R3964_MASTER 0
64#define R3964_SLAVE 1
65
66/* Options for R3964_ENABLE_SIGNALS */
67#define R3964_SIG_ACK 0x0001
68#define R3964_SIG_DATA 0x0002
69#define R3964_SIG_ALL 0x000f
70#define R3964_SIG_NONE 0x0000
71#define R3964_USE_SIGIO 0x1000
72
73/*
74 * r3964 operation states:
75 */
76
77/* types for msg_id: */
78enum {R3964_MSG_ACK=1, R3964_MSG_DATA };
79
80#define R3964_MAX_MSG_COUNT 32
81
82/* error codes for client messages */
83#define R3964_OK 0 /* no error. */
84#define R3964_TX_FAIL -1 /* transmission error, block NOT sent */
85#define R3964_OVERFLOW -2 /* msg queue overflow */
86
87/* the client gets this struct when calling read(fd,...): */
88struct r3964_client_message {
89 int msg_id;
90 int arg;
91 int error_code;
92};
93
94#define R3964_MTU 256
95
96
97
98#endif /* _UAPI__LINUX_N_R3964_H__ */
diff --git a/include/uapi/linux/nbd.h b/include/uapi/linux/nbd.h
new file mode 100644
index 000000000000..dfb514472cbc
--- /dev/null
+++ b/include/uapi/linux/nbd.h
@@ -0,0 +1,77 @@
1/*
2 * 1999 Copyright (C) Pavel Machek, pavel@ucw.cz. This code is GPL.
3 * 1999/11/04 Copyright (C) 1999 VMware, Inc. (Regis "HPReg" Duchesne)
4 * Made nbd_end_request() use the io_request_lock
5 * 2001 Copyright (C) Steven Whitehouse
6 * New nbd_end_request() for compatibility with new linux block
7 * layer code.
8 * 2003/06/24 Louis D. Langholtz <ldl@aros.net>
9 * Removed unneeded blksize_bits field from nbd_device struct.
10 * Cleanup PARANOIA usage & code.
11 * 2004/02/19 Paul Clements
12 * Removed PARANOIA, plus various cleanup and comments
13 */
14
15#ifndef _UAPILINUX_NBD_H
16#define _UAPILINUX_NBD_H
17
18#include <linux/types.h>
19
20#define NBD_SET_SOCK _IO( 0xab, 0 )
21#define NBD_SET_BLKSIZE _IO( 0xab, 1 )
22#define NBD_SET_SIZE _IO( 0xab, 2 )
23#define NBD_DO_IT _IO( 0xab, 3 )
24#define NBD_CLEAR_SOCK _IO( 0xab, 4 )
25#define NBD_CLEAR_QUE _IO( 0xab, 5 )
26#define NBD_PRINT_DEBUG _IO( 0xab, 6 )
27#define NBD_SET_SIZE_BLOCKS _IO( 0xab, 7 )
28#define NBD_DISCONNECT _IO( 0xab, 8 )
29#define NBD_SET_TIMEOUT _IO( 0xab, 9 )
30#define NBD_SET_FLAGS _IO( 0xab, 10)
31
32enum {
33 NBD_CMD_READ = 0,
34 NBD_CMD_WRITE = 1,
35 NBD_CMD_DISC = 2,
36 /* there is a gap here to match userspace */
37 NBD_CMD_TRIM = 4
38};
39
40/* values for flags field */
41#define NBD_FLAG_HAS_FLAGS (1 << 0) /* nbd-server supports flags */
42#define NBD_FLAG_READ_ONLY (1 << 1) /* device is read-only */
43/* there is a gap here to match userspace */
44#define NBD_FLAG_SEND_TRIM (1 << 5) /* send trim/discard */
45
46#define nbd_cmd(req) ((req)->cmd[0])
47
48/* userspace doesn't need the nbd_device structure */
49
50/* These are sent over the network in the request/reply magic fields */
51
52#define NBD_REQUEST_MAGIC 0x25609513
53#define NBD_REPLY_MAGIC 0x67446698
54/* Do *not* use magics: 0x12560953 0x96744668. */
55
56/*
57 * This is the packet used for communication between client and
58 * server. All data are in network byte order.
59 */
60struct nbd_request {
61 __be32 magic;
62 __be32 type; /* == READ || == WRITE */
63 char handle[8];
64 __be64 from;
65 __be32 len;
66} __attribute__((packed));
67
68/*
69 * This is the reply packet that nbd-server sends back to the client after
70 * it has completed an I/O request (or an error occurs).
71 */
72struct nbd_reply {
73 __be32 magic;
74 __be32 error; /* 0 = ok, else error */
75 char handle[8]; /* handle you got from request */
76};
77#endif /* _UAPILINUX_NBD_H */
diff --git a/include/linux/ncp.h b/include/uapi/linux/ncp.h
index 99f0adeeb3f3..99f0adeeb3f3 100644
--- a/include/linux/ncp.h
+++ b/include/uapi/linux/ncp.h
diff --git a/include/linux/ncp_fs.h b/include/uapi/linux/ncp_fs.h
index e13eefef0653..e13eefef0653 100644
--- a/include/linux/ncp_fs.h
+++ b/include/uapi/linux/ncp_fs.h
diff --git a/include/linux/ncp_mount.h b/include/uapi/linux/ncp_mount.h
index dfcbea2d889f..dfcbea2d889f 100644
--- a/include/linux/ncp_mount.h
+++ b/include/uapi/linux/ncp_mount.h
diff --git a/include/linux/ncp_no.h b/include/uapi/linux/ncp_no.h
index cddaa48fb182..cddaa48fb182 100644
--- a/include/linux/ncp_no.h
+++ b/include/uapi/linux/ncp_no.h
diff --git a/include/linux/neighbour.h b/include/uapi/linux/neighbour.h
index 275e5d65dcb2..275e5d65dcb2 100644
--- a/include/linux/neighbour.h
+++ b/include/uapi/linux/neighbour.h
diff --git a/include/uapi/linux/net.h b/include/uapi/linux/net.h
new file mode 100644
index 000000000000..9457239ed219
--- /dev/null
+++ b/include/uapi/linux/net.h
@@ -0,0 +1,57 @@
1/*
2 * NET An implementation of the SOCKET network access protocol.
3 * This is the master header file for the Linux NET layer,
4 * or, in plain English: the networking handling part of the
5 * kernel.
6 *
7 * Version: @(#)net.h 1.0.3 05/25/93
8 *
9 * Authors: Orest Zborowski, <obz@Kodak.COM>
10 * Ross Biro
11 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version
16 * 2 of the License, or (at your option) any later version.
17 */
18#ifndef _UAPI_LINUX_NET_H
19#define _UAPI_LINUX_NET_H
20
21#include <linux/socket.h>
22#include <asm/socket.h>
23
24#define NPROTO AF_MAX
25
26#define SYS_SOCKET 1 /* sys_socket(2) */
27#define SYS_BIND 2 /* sys_bind(2) */
28#define SYS_CONNECT 3 /* sys_connect(2) */
29#define SYS_LISTEN 4 /* sys_listen(2) */
30#define SYS_ACCEPT 5 /* sys_accept(2) */
31#define SYS_GETSOCKNAME 6 /* sys_getsockname(2) */
32#define SYS_GETPEERNAME 7 /* sys_getpeername(2) */
33#define SYS_SOCKETPAIR 8 /* sys_socketpair(2) */
34#define SYS_SEND 9 /* sys_send(2) */
35#define SYS_RECV 10 /* sys_recv(2) */
36#define SYS_SENDTO 11 /* sys_sendto(2) */
37#define SYS_RECVFROM 12 /* sys_recvfrom(2) */
38#define SYS_SHUTDOWN 13 /* sys_shutdown(2) */
39#define SYS_SETSOCKOPT 14 /* sys_setsockopt(2) */
40#define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */
41#define SYS_SENDMSG 16 /* sys_sendmsg(2) */
42#define SYS_RECVMSG 17 /* sys_recvmsg(2) */
43#define SYS_ACCEPT4 18 /* sys_accept4(2) */
44#define SYS_RECVMMSG 19 /* sys_recvmmsg(2) */
45#define SYS_SENDMMSG 20 /* sys_sendmmsg(2) */
46
47typedef enum {
48 SS_FREE = 0, /* not allocated */
49 SS_UNCONNECTED, /* unconnected to any socket */
50 SS_CONNECTING, /* in process of connecting */
51 SS_CONNECTED, /* connected to socket */
52 SS_DISCONNECTING /* in process of disconnecting */
53} socket_state;
54
55#define __SO_ACCEPTCON (1 << 16) /* performed a listen */
56
57#endif /* _UAPI_LINUX_NET_H */
diff --git a/include/linux/net_dropmon.h b/include/uapi/linux/net_dropmon.h
index 2a739462caeb..2a739462caeb 100644
--- a/include/linux/net_dropmon.h
+++ b/include/uapi/linux/net_dropmon.h
diff --git a/include/linux/net_tstamp.h b/include/uapi/linux/net_tstamp.h
index ae5df122e42f..ae5df122e42f 100644
--- a/include/linux/net_tstamp.h
+++ b/include/uapi/linux/net_tstamp.h
diff --git a/include/uapi/linux/netdevice.h b/include/uapi/linux/netdevice.h
new file mode 100644
index 000000000000..6b9500bc2d56
--- /dev/null
+++ b/include/uapi/linux/netdevice.h
@@ -0,0 +1,53 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for the Interfaces handler.
7 *
8 * Version: @(#)dev.h 1.0.10 08/12/93
9 *
10 * Authors: Ross Biro
11 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
12 * Corey Minyard <wf-rch!minyard@relay.EU.net>
13 * Donald J. Becker, <becker@cesdis.gsfc.nasa.gov>
14 * Alan Cox, <alan@lxorguk.ukuu.org.uk>
15 * Bjorn Ekwall. <bj0rn@blox.se>
16 * Pekka Riikonen <priikone@poseidon.pspt.fi>
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version
21 * 2 of the License, or (at your option) any later version.
22 *
23 * Moved to /usr/include/linux for NET3
24 */
25#ifndef _UAPI_LINUX_NETDEVICE_H
26#define _UAPI_LINUX_NETDEVICE_H
27
28#include <linux/if.h>
29#include <linux/if_ether.h>
30#include <linux/if_packet.h>
31#include <linux/if_link.h>
32
33
34#define MAX_ADDR_LEN 32 /* Largest hardware address length */
35
36/* Initial net device group. All devices belong to group 0 by default. */
37#define INIT_NETDEV_GROUP 0
38
39
40
41/* Media selection options. */
42enum {
43 IF_PORT_UNKNOWN = 0,
44 IF_PORT_10BASE2,
45 IF_PORT_10BASET,
46 IF_PORT_AUI,
47 IF_PORT_100BASET,
48 IF_PORT_100BASETX,
49 IF_PORT_100BASEFX
50};
51
52
53#endif /* _UAPI_LINUX_NETDEVICE_H */
diff --git a/include/uapi/linux/netfilter.h b/include/uapi/linux/netfilter.h
new file mode 100644
index 000000000000..f7dc0ebeeba5
--- /dev/null
+++ b/include/uapi/linux/netfilter.h
@@ -0,0 +1,72 @@
1#ifndef _UAPI__LINUX_NETFILTER_H
2#define _UAPI__LINUX_NETFILTER_H
3
4#include <linux/types.h>
5#include <linux/compiler.h>
6#include <linux/sysctl.h>
7
8
9/* Responses from hook functions. */
10#define NF_DROP 0
11#define NF_ACCEPT 1
12#define NF_STOLEN 2
13#define NF_QUEUE 3
14#define NF_REPEAT 4
15#define NF_STOP 5
16#define NF_MAX_VERDICT NF_STOP
17
18/* we overload the higher bits for encoding auxiliary data such as the queue
19 * number or errno values. Not nice, but better than additional function
20 * arguments. */
21#define NF_VERDICT_MASK 0x000000ff
22
23/* extra verdict flags have mask 0x0000ff00 */
24#define NF_VERDICT_FLAG_QUEUE_BYPASS 0x00008000
25
26/* queue number (NF_QUEUE) or errno (NF_DROP) */
27#define NF_VERDICT_QMASK 0xffff0000
28#define NF_VERDICT_QBITS 16
29
30#define NF_QUEUE_NR(x) ((((x) << 16) & NF_VERDICT_QMASK) | NF_QUEUE)
31
32#define NF_DROP_ERR(x) (((-x) << 16) | NF_DROP)
33
34/* only for userspace compatibility */
35#ifndef __KERNEL__
36/* Generic cache responses from hook functions.
37 <= 0x2000 is used for protocol-flags. */
38#define NFC_UNKNOWN 0x4000
39#define NFC_ALTERED 0x8000
40
41/* NF_VERDICT_BITS should be 8 now, but userspace might break if this changes */
42#define NF_VERDICT_BITS 16
43#endif
44
45enum nf_inet_hooks {
46 NF_INET_PRE_ROUTING,
47 NF_INET_LOCAL_IN,
48 NF_INET_FORWARD,
49 NF_INET_LOCAL_OUT,
50 NF_INET_POST_ROUTING,
51 NF_INET_NUMHOOKS
52};
53
54enum {
55 NFPROTO_UNSPEC = 0,
56 NFPROTO_IPV4 = 2,
57 NFPROTO_ARP = 3,
58 NFPROTO_BRIDGE = 7,
59 NFPROTO_IPV6 = 10,
60 NFPROTO_DECNET = 12,
61 NFPROTO_NUMPROTO,
62};
63
64union nf_inet_addr {
65 __u32 all[4];
66 __be32 ip;
67 __be32 ip6[4];
68 struct in_addr in;
69 struct in6_addr in6;
70};
71
72#endif /* _UAPI__LINUX_NETFILTER_H */
diff --git a/include/uapi/linux/netfilter/Kbuild b/include/uapi/linux/netfilter/Kbuild
index 4afbace8e869..08f555fef13f 100644
--- a/include/uapi/linux/netfilter/Kbuild
+++ b/include/uapi/linux/netfilter/Kbuild
@@ -1,2 +1,78 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += ipset/ 2header-y += ipset/
3header-y += nf_conntrack_common.h
4header-y += nf_conntrack_ftp.h
5header-y += nf_conntrack_sctp.h
6header-y += nf_conntrack_tcp.h
7header-y += nf_conntrack_tuple_common.h
8header-y += nf_nat.h
9header-y += nfnetlink.h
10header-y += nfnetlink_acct.h
11header-y += nfnetlink_compat.h
12header-y += nfnetlink_conntrack.h
13header-y += nfnetlink_cthelper.h
14header-y += nfnetlink_cttimeout.h
15header-y += nfnetlink_log.h
16header-y += nfnetlink_queue.h
17header-y += x_tables.h
18header-y += xt_AUDIT.h
19header-y += xt_CHECKSUM.h
20header-y += xt_CLASSIFY.h
21header-y += xt_CONNMARK.h
22header-y += xt_CONNSECMARK.h
23header-y += xt_CT.h
24header-y += xt_DSCP.h
25header-y += xt_IDLETIMER.h
26header-y += xt_LED.h
27header-y += xt_LOG.h
28header-y += xt_MARK.h
29header-y += xt_NFLOG.h
30header-y += xt_NFQUEUE.h
31header-y += xt_RATEEST.h
32header-y += xt_SECMARK.h
33header-y += xt_TCPMSS.h
34header-y += xt_TCPOPTSTRIP.h
35header-y += xt_TEE.h
36header-y += xt_TPROXY.h
37header-y += xt_addrtype.h
38header-y += xt_cluster.h
39header-y += xt_comment.h
40header-y += xt_connbytes.h
41header-y += xt_connlimit.h
42header-y += xt_connmark.h
43header-y += xt_conntrack.h
44header-y += xt_cpu.h
45header-y += xt_dccp.h
46header-y += xt_devgroup.h
47header-y += xt_dscp.h
48header-y += xt_ecn.h
49header-y += xt_esp.h
50header-y += xt_hashlimit.h
51header-y += xt_helper.h
52header-y += xt_iprange.h
53header-y += xt_ipvs.h
54header-y += xt_length.h
55header-y += xt_limit.h
56header-y += xt_mac.h
57header-y += xt_mark.h
58header-y += xt_multiport.h
59header-y += xt_nfacct.h
60header-y += xt_osf.h
61header-y += xt_owner.h
62header-y += xt_physdev.h
63header-y += xt_pkttype.h
64header-y += xt_policy.h
65header-y += xt_quota.h
66header-y += xt_rateest.h
67header-y += xt_realm.h
68header-y += xt_recent.h
69header-y += xt_sctp.h
70header-y += xt_set.h
71header-y += xt_socket.h
72header-y += xt_state.h
73header-y += xt_statistic.h
74header-y += xt_string.h
75header-y += xt_tcpmss.h
76header-y += xt_tcpudp.h
77header-y += xt_time.h
78header-y += xt_u32.h
diff --git a/include/uapi/linux/netfilter/ipset/Kbuild b/include/uapi/linux/netfilter/ipset/Kbuild
index aafaa5aa54d4..d2680423d9ab 100644
--- a/include/uapi/linux/netfilter/ipset/Kbuild
+++ b/include/uapi/linux/netfilter/ipset/Kbuild
@@ -1 +1,5 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += ip_set.h
3header-y += ip_set_bitmap.h
4header-y += ip_set_hash.h
5header-y += ip_set_list.h
diff --git a/include/uapi/linux/netfilter/ipset/ip_set.h b/include/uapi/linux/netfilter/ipset/ip_set.h
new file mode 100644
index 000000000000..fbee42807a11
--- /dev/null
+++ b/include/uapi/linux/netfilter/ipset/ip_set.h
@@ -0,0 +1,231 @@
1/* Copyright (C) 2000-2002 Joakim Axelsson <gozem@linux.nu>
2 * Patrick Schaaf <bof@bof.de>
3 * Martin Josefsson <gandalf@wlug.westbo.se>
4 * Copyright (C) 2003-2011 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef _UAPI_IP_SET_H
11#define _UAPI_IP_SET_H
12
13
14#include <linux/types.h>
15
16/* The protocol version */
17#define IPSET_PROTOCOL 6
18
19/* The max length of strings including NUL: set and type identifiers */
20#define IPSET_MAXNAMELEN 32
21
22/* Message types and commands */
23enum ipset_cmd {
24 IPSET_CMD_NONE,
25 IPSET_CMD_PROTOCOL, /* 1: Return protocol version */
26 IPSET_CMD_CREATE, /* 2: Create a new (empty) set */
27 IPSET_CMD_DESTROY, /* 3: Destroy a (empty) set */
28 IPSET_CMD_FLUSH, /* 4: Remove all elements from a set */
29 IPSET_CMD_RENAME, /* 5: Rename a set */
30 IPSET_CMD_SWAP, /* 6: Swap two sets */
31 IPSET_CMD_LIST, /* 7: List sets */
32 IPSET_CMD_SAVE, /* 8: Save sets */
33 IPSET_CMD_ADD, /* 9: Add an element to a set */
34 IPSET_CMD_DEL, /* 10: Delete an element from a set */
35 IPSET_CMD_TEST, /* 11: Test an element in a set */
36 IPSET_CMD_HEADER, /* 12: Get set header data only */
37 IPSET_CMD_TYPE, /* 13: Get set type */
38 IPSET_MSG_MAX, /* Netlink message commands */
39
40 /* Commands in userspace: */
41 IPSET_CMD_RESTORE = IPSET_MSG_MAX, /* 14: Enter restore mode */
42 IPSET_CMD_HELP, /* 15: Get help */
43 IPSET_CMD_VERSION, /* 16: Get program version */
44 IPSET_CMD_QUIT, /* 17: Quit from interactive mode */
45
46 IPSET_CMD_MAX,
47
48 IPSET_CMD_COMMIT = IPSET_CMD_MAX, /* 18: Commit buffered commands */
49};
50
51/* Attributes at command level */
52enum {
53 IPSET_ATTR_UNSPEC,
54 IPSET_ATTR_PROTOCOL, /* 1: Protocol version */
55 IPSET_ATTR_SETNAME, /* 2: Name of the set */
56 IPSET_ATTR_TYPENAME, /* 3: Typename */
57 IPSET_ATTR_SETNAME2 = IPSET_ATTR_TYPENAME, /* Setname at rename/swap */
58 IPSET_ATTR_REVISION, /* 4: Settype revision */
59 IPSET_ATTR_FAMILY, /* 5: Settype family */
60 IPSET_ATTR_FLAGS, /* 6: Flags at command level */
61 IPSET_ATTR_DATA, /* 7: Nested attributes */
62 IPSET_ATTR_ADT, /* 8: Multiple data containers */
63 IPSET_ATTR_LINENO, /* 9: Restore lineno */
64 IPSET_ATTR_PROTOCOL_MIN, /* 10: Minimal supported version number */
65 IPSET_ATTR_REVISION_MIN = IPSET_ATTR_PROTOCOL_MIN, /* type rev min */
66 __IPSET_ATTR_CMD_MAX,
67};
68#define IPSET_ATTR_CMD_MAX (__IPSET_ATTR_CMD_MAX - 1)
69
70/* CADT specific attributes */
71enum {
72 IPSET_ATTR_IP = IPSET_ATTR_UNSPEC + 1,
73 IPSET_ATTR_IP_FROM = IPSET_ATTR_IP,
74 IPSET_ATTR_IP_TO, /* 2 */
75 IPSET_ATTR_CIDR, /* 3 */
76 IPSET_ATTR_PORT, /* 4 */
77 IPSET_ATTR_PORT_FROM = IPSET_ATTR_PORT,
78 IPSET_ATTR_PORT_TO, /* 5 */
79 IPSET_ATTR_TIMEOUT, /* 6 */
80 IPSET_ATTR_PROTO, /* 7 */
81 IPSET_ATTR_CADT_FLAGS, /* 8 */
82 IPSET_ATTR_CADT_LINENO = IPSET_ATTR_LINENO, /* 9 */
83 /* Reserve empty slots */
84 IPSET_ATTR_CADT_MAX = 16,
85 /* Create-only specific attributes */
86 IPSET_ATTR_GC,
87 IPSET_ATTR_HASHSIZE,
88 IPSET_ATTR_MAXELEM,
89 IPSET_ATTR_NETMASK,
90 IPSET_ATTR_PROBES,
91 IPSET_ATTR_RESIZE,
92 IPSET_ATTR_SIZE,
93 /* Kernel-only */
94 IPSET_ATTR_ELEMENTS,
95 IPSET_ATTR_REFERENCES,
96 IPSET_ATTR_MEMSIZE,
97
98 __IPSET_ATTR_CREATE_MAX,
99};
100#define IPSET_ATTR_CREATE_MAX (__IPSET_ATTR_CREATE_MAX - 1)
101
102/* ADT specific attributes */
103enum {
104 IPSET_ATTR_ETHER = IPSET_ATTR_CADT_MAX + 1,
105 IPSET_ATTR_NAME,
106 IPSET_ATTR_NAMEREF,
107 IPSET_ATTR_IP2,
108 IPSET_ATTR_CIDR2,
109 IPSET_ATTR_IP2_TO,
110 IPSET_ATTR_IFACE,
111 __IPSET_ATTR_ADT_MAX,
112};
113#define IPSET_ATTR_ADT_MAX (__IPSET_ATTR_ADT_MAX - 1)
114
115/* IP specific attributes */
116enum {
117 IPSET_ATTR_IPADDR_IPV4 = IPSET_ATTR_UNSPEC + 1,
118 IPSET_ATTR_IPADDR_IPV6,
119 __IPSET_ATTR_IPADDR_MAX,
120};
121#define IPSET_ATTR_IPADDR_MAX (__IPSET_ATTR_IPADDR_MAX - 1)
122
123/* Error codes */
124enum ipset_errno {
125 IPSET_ERR_PRIVATE = 4096,
126 IPSET_ERR_PROTOCOL,
127 IPSET_ERR_FIND_TYPE,
128 IPSET_ERR_MAX_SETS,
129 IPSET_ERR_BUSY,
130 IPSET_ERR_EXIST_SETNAME2,
131 IPSET_ERR_TYPE_MISMATCH,
132 IPSET_ERR_EXIST,
133 IPSET_ERR_INVALID_CIDR,
134 IPSET_ERR_INVALID_NETMASK,
135 IPSET_ERR_INVALID_FAMILY,
136 IPSET_ERR_TIMEOUT,
137 IPSET_ERR_REFERENCED,
138 IPSET_ERR_IPADDR_IPV4,
139 IPSET_ERR_IPADDR_IPV6,
140
141 /* Type specific error codes */
142 IPSET_ERR_TYPE_SPECIFIC = 4352,
143};
144
145/* Flags at command level */
146enum ipset_cmd_flags {
147 IPSET_FLAG_BIT_EXIST = 0,
148 IPSET_FLAG_EXIST = (1 << IPSET_FLAG_BIT_EXIST),
149 IPSET_FLAG_BIT_LIST_SETNAME = 1,
150 IPSET_FLAG_LIST_SETNAME = (1 << IPSET_FLAG_BIT_LIST_SETNAME),
151 IPSET_FLAG_BIT_LIST_HEADER = 2,
152 IPSET_FLAG_LIST_HEADER = (1 << IPSET_FLAG_BIT_LIST_HEADER),
153 IPSET_FLAG_CMD_MAX = 15, /* Lower half */
154};
155
156/* Flags at CADT attribute level */
157enum ipset_cadt_flags {
158 IPSET_FLAG_BIT_BEFORE = 0,
159 IPSET_FLAG_BEFORE = (1 << IPSET_FLAG_BIT_BEFORE),
160 IPSET_FLAG_BIT_PHYSDEV = 1,
161 IPSET_FLAG_PHYSDEV = (1 << IPSET_FLAG_BIT_PHYSDEV),
162 IPSET_FLAG_BIT_NOMATCH = 2,
163 IPSET_FLAG_NOMATCH = (1 << IPSET_FLAG_BIT_NOMATCH),
164 IPSET_FLAG_CADT_MAX = 15, /* Upper half */
165};
166
167/* Commands with settype-specific attributes */
168enum ipset_adt {
169 IPSET_ADD,
170 IPSET_DEL,
171 IPSET_TEST,
172 IPSET_ADT_MAX,
173 IPSET_CREATE = IPSET_ADT_MAX,
174 IPSET_CADT_MAX,
175};
176
177/* Sets are identified by an index in kernel space. Tweak with ip_set_id_t
178 * and IPSET_INVALID_ID if you want to increase the max number of sets.
179 */
180typedef __u16 ip_set_id_t;
181
182#define IPSET_INVALID_ID 65535
183
184enum ip_set_dim {
185 IPSET_DIM_ZERO = 0,
186 IPSET_DIM_ONE,
187 IPSET_DIM_TWO,
188 IPSET_DIM_THREE,
189 /* Max dimension in elements.
190 * If changed, new revision of iptables match/target is required.
191 */
192 IPSET_DIM_MAX = 6,
193 IPSET_BIT_RETURN_NOMATCH = 7,
194};
195
196/* Option flags for kernel operations */
197enum ip_set_kopt {
198 IPSET_INV_MATCH = (1 << IPSET_DIM_ZERO),
199 IPSET_DIM_ONE_SRC = (1 << IPSET_DIM_ONE),
200 IPSET_DIM_TWO_SRC = (1 << IPSET_DIM_TWO),
201 IPSET_DIM_THREE_SRC = (1 << IPSET_DIM_THREE),
202 IPSET_RETURN_NOMATCH = (1 << IPSET_BIT_RETURN_NOMATCH),
203};
204
205
206/* Interface to iptables/ip6tables */
207
208#define SO_IP_SET 83
209
210union ip_set_name_index {
211 char name[IPSET_MAXNAMELEN];
212 ip_set_id_t index;
213};
214
215#define IP_SET_OP_GET_BYNAME 0x00000006 /* Get set index by name */
216struct ip_set_req_get_set {
217 unsigned int op;
218 unsigned int version;
219 union ip_set_name_index set;
220};
221
222#define IP_SET_OP_GET_BYINDEX 0x00000007 /* Get set name by index */
223/* Uses ip_set_req_get_set */
224
225#define IP_SET_OP_VERSION 0x00000100 /* Ask kernel version */
226struct ip_set_req_version {
227 unsigned int op;
228 unsigned int version;
229};
230
231#endif /* _UAPI_IP_SET_H */
diff --git a/include/uapi/linux/netfilter/ipset/ip_set_bitmap.h b/include/uapi/linux/netfilter/ipset/ip_set_bitmap.h
new file mode 100644
index 000000000000..6a2c038d1888
--- /dev/null
+++ b/include/uapi/linux/netfilter/ipset/ip_set_bitmap.h
@@ -0,0 +1,13 @@
1#ifndef _UAPI__IP_SET_BITMAP_H
2#define _UAPI__IP_SET_BITMAP_H
3
4/* Bitmap type specific error codes */
5enum {
6 /* The element is out of the range of the set */
7 IPSET_ERR_BITMAP_RANGE = IPSET_ERR_TYPE_SPECIFIC,
8 /* The range exceeds the size limit of the set type */
9 IPSET_ERR_BITMAP_RANGE_SIZE,
10};
11
12
13#endif /* _UAPI__IP_SET_BITMAP_H */
diff --git a/include/uapi/linux/netfilter/ipset/ip_set_hash.h b/include/uapi/linux/netfilter/ipset/ip_set_hash.h
new file mode 100644
index 000000000000..352eeccdc7f2
--- /dev/null
+++ b/include/uapi/linux/netfilter/ipset/ip_set_hash.h
@@ -0,0 +1,21 @@
1#ifndef _UAPI__IP_SET_HASH_H
2#define _UAPI__IP_SET_HASH_H
3
4/* Hash type specific error codes */
5enum {
6 /* Hash is full */
7 IPSET_ERR_HASH_FULL = IPSET_ERR_TYPE_SPECIFIC,
8 /* Null-valued element */
9 IPSET_ERR_HASH_ELEM,
10 /* Invalid protocol */
11 IPSET_ERR_INVALID_PROTO,
12 /* Protocol missing but must be specified */
13 IPSET_ERR_MISSING_PROTO,
14 /* Range not supported */
15 IPSET_ERR_HASH_RANGE_UNSUPPORTED,
16 /* Invalid range */
17 IPSET_ERR_HASH_RANGE,
18};
19
20
21#endif /* _UAPI__IP_SET_HASH_H */
diff --git a/include/uapi/linux/netfilter/ipset/ip_set_list.h b/include/uapi/linux/netfilter/ipset/ip_set_list.h
new file mode 100644
index 000000000000..a44efaa98213
--- /dev/null
+++ b/include/uapi/linux/netfilter/ipset/ip_set_list.h
@@ -0,0 +1,21 @@
1#ifndef _UAPI__IP_SET_LIST_H
2#define _UAPI__IP_SET_LIST_H
3
4/* List type specific error codes */
5enum {
6 /* Set name to be added/deleted/tested does not exist. */
7 IPSET_ERR_NAME = IPSET_ERR_TYPE_SPECIFIC,
8 /* list:set type is not permitted to add */
9 IPSET_ERR_LOOP,
10 /* Missing reference set */
11 IPSET_ERR_BEFORE,
12 /* Reference set does not exist */
13 IPSET_ERR_NAMEREF,
14 /* Set is full */
15 IPSET_ERR_LIST_FULL,
16 /* Reference set is not added to the set */
17 IPSET_ERR_REF_EXIST,
18};
19
20
21#endif /* _UAPI__IP_SET_LIST_H */
diff --git a/include/uapi/linux/netfilter/nf_conntrack_common.h b/include/uapi/linux/netfilter/nf_conntrack_common.h
new file mode 100644
index 000000000000..1644cdd8be91
--- /dev/null
+++ b/include/uapi/linux/netfilter/nf_conntrack_common.h
@@ -0,0 +1,117 @@
1#ifndef _UAPI_NF_CONNTRACK_COMMON_H
2#define _UAPI_NF_CONNTRACK_COMMON_H
3/* Connection state tracking for netfilter. This is separated from,
4 but required by, the NAT layer; it can also be used by an iptables
5 extension. */
6enum ip_conntrack_info {
7 /* Part of an established connection (either direction). */
8 IP_CT_ESTABLISHED,
9
10 /* Like NEW, but related to an existing connection, or ICMP error
11 (in either direction). */
12 IP_CT_RELATED,
13
14 /* Started a new connection to track (only
15 IP_CT_DIR_ORIGINAL); may be a retransmission. */
16 IP_CT_NEW,
17
18 /* >= this indicates reply direction */
19 IP_CT_IS_REPLY,
20
21 IP_CT_ESTABLISHED_REPLY = IP_CT_ESTABLISHED + IP_CT_IS_REPLY,
22 IP_CT_RELATED_REPLY = IP_CT_RELATED + IP_CT_IS_REPLY,
23 IP_CT_NEW_REPLY = IP_CT_NEW + IP_CT_IS_REPLY,
24 /* Number of distinct IP_CT types (no NEW in reply dirn). */
25 IP_CT_NUMBER = IP_CT_IS_REPLY * 2 - 1
26};
27
28/* Bitset representing status of connection. */
29enum ip_conntrack_status {
30 /* It's an expected connection: bit 0 set. This bit never changed */
31 IPS_EXPECTED_BIT = 0,
32 IPS_EXPECTED = (1 << IPS_EXPECTED_BIT),
33
34 /* We've seen packets both ways: bit 1 set. Can be set, not unset. */
35 IPS_SEEN_REPLY_BIT = 1,
36 IPS_SEEN_REPLY = (1 << IPS_SEEN_REPLY_BIT),
37
38 /* Conntrack should never be early-expired. */
39 IPS_ASSURED_BIT = 2,
40 IPS_ASSURED = (1 << IPS_ASSURED_BIT),
41
42 /* Connection is confirmed: originating packet has left box */
43 IPS_CONFIRMED_BIT = 3,
44 IPS_CONFIRMED = (1 << IPS_CONFIRMED_BIT),
45
46 /* Connection needs src nat in orig dir. This bit never changed. */
47 IPS_SRC_NAT_BIT = 4,
48 IPS_SRC_NAT = (1 << IPS_SRC_NAT_BIT),
49
50 /* Connection needs dst nat in orig dir. This bit never changed. */
51 IPS_DST_NAT_BIT = 5,
52 IPS_DST_NAT = (1 << IPS_DST_NAT_BIT),
53
54 /* Both together. */
55 IPS_NAT_MASK = (IPS_DST_NAT | IPS_SRC_NAT),
56
57 /* Connection needs TCP sequence adjusted. */
58 IPS_SEQ_ADJUST_BIT = 6,
59 IPS_SEQ_ADJUST = (1 << IPS_SEQ_ADJUST_BIT),
60
61 /* NAT initialization bits. */
62 IPS_SRC_NAT_DONE_BIT = 7,
63 IPS_SRC_NAT_DONE = (1 << IPS_SRC_NAT_DONE_BIT),
64
65 IPS_DST_NAT_DONE_BIT = 8,
66 IPS_DST_NAT_DONE = (1 << IPS_DST_NAT_DONE_BIT),
67
68 /* Both together */
69 IPS_NAT_DONE_MASK = (IPS_DST_NAT_DONE | IPS_SRC_NAT_DONE),
70
71 /* Connection is dying (removed from lists), can not be unset. */
72 IPS_DYING_BIT = 9,
73 IPS_DYING = (1 << IPS_DYING_BIT),
74
75 /* Connection has fixed timeout. */
76 IPS_FIXED_TIMEOUT_BIT = 10,
77 IPS_FIXED_TIMEOUT = (1 << IPS_FIXED_TIMEOUT_BIT),
78
79 /* Conntrack is a template */
80 IPS_TEMPLATE_BIT = 11,
81 IPS_TEMPLATE = (1 << IPS_TEMPLATE_BIT),
82
83 /* Conntrack is a fake untracked entry */
84 IPS_UNTRACKED_BIT = 12,
85 IPS_UNTRACKED = (1 << IPS_UNTRACKED_BIT),
86
87 /* Conntrack got a helper explicitly attached via CT target. */
88 IPS_HELPER_BIT = 13,
89 IPS_HELPER = (1 << IPS_HELPER_BIT),
90};
91
92/* Connection tracking event types */
93enum ip_conntrack_events {
94 IPCT_NEW, /* new conntrack */
95 IPCT_RELATED, /* related conntrack */
96 IPCT_DESTROY, /* destroyed conntrack */
97 IPCT_REPLY, /* connection has seen two-way traffic */
98 IPCT_ASSURED, /* connection status has changed to assured */
99 IPCT_PROTOINFO, /* protocol information has changed */
100 IPCT_HELPER, /* new helper has been set */
101 IPCT_MARK, /* new mark has been set */
102 IPCT_NATSEQADJ, /* NAT is doing sequence adjustment */
103 IPCT_SECMARK, /* new security mark has been set */
104};
105
106enum ip_conntrack_expect_events {
107 IPEXP_NEW, /* new expectation */
108 IPEXP_DESTROY, /* destroyed expectation */
109};
110
111/* expectation flags */
112#define NF_CT_EXPECT_PERMANENT 0x1
113#define NF_CT_EXPECT_INACTIVE 0x2
114#define NF_CT_EXPECT_USERSPACE 0x4
115
116
117#endif /* _UAPI_NF_CONNTRACK_COMMON_H */
diff --git a/include/uapi/linux/netfilter/nf_conntrack_ftp.h b/include/uapi/linux/netfilter/nf_conntrack_ftp.h
new file mode 100644
index 000000000000..1030315a41b5
--- /dev/null
+++ b/include/uapi/linux/netfilter/nf_conntrack_ftp.h
@@ -0,0 +1,18 @@
1#ifndef _UAPI_NF_CONNTRACK_FTP_H
2#define _UAPI_NF_CONNTRACK_FTP_H
3/* FTP tracking. */
4
5/* This enum is exposed to userspace */
6enum nf_ct_ftp_type {
7 /* PORT command from client */
8 NF_CT_FTP_PORT,
9 /* PASV response from server */
10 NF_CT_FTP_PASV,
11 /* EPRT command from client */
12 NF_CT_FTP_EPRT,
13 /* EPSV response from server */
14 NF_CT_FTP_EPSV,
15};
16
17
18#endif /* _UAPI_NF_CONNTRACK_FTP_H */
diff --git a/include/linux/netfilter/nf_conntrack_sctp.h b/include/uapi/linux/netfilter/nf_conntrack_sctp.h
index ceeefe6681b5..ceeefe6681b5 100644
--- a/include/linux/netfilter/nf_conntrack_sctp.h
+++ b/include/uapi/linux/netfilter/nf_conntrack_sctp.h
diff --git a/include/uapi/linux/netfilter/nf_conntrack_tcp.h b/include/uapi/linux/netfilter/nf_conntrack_tcp.h
new file mode 100644
index 000000000000..9993a421201c
--- /dev/null
+++ b/include/uapi/linux/netfilter/nf_conntrack_tcp.h
@@ -0,0 +1,51 @@
1#ifndef _UAPI_NF_CONNTRACK_TCP_H
2#define _UAPI_NF_CONNTRACK_TCP_H
3/* TCP tracking. */
4
5#include <linux/types.h>
6
7/* This is exposed to userspace (ctnetlink) */
8enum tcp_conntrack {
9 TCP_CONNTRACK_NONE,
10 TCP_CONNTRACK_SYN_SENT,
11 TCP_CONNTRACK_SYN_RECV,
12 TCP_CONNTRACK_ESTABLISHED,
13 TCP_CONNTRACK_FIN_WAIT,
14 TCP_CONNTRACK_CLOSE_WAIT,
15 TCP_CONNTRACK_LAST_ACK,
16 TCP_CONNTRACK_TIME_WAIT,
17 TCP_CONNTRACK_CLOSE,
18 TCP_CONNTRACK_LISTEN, /* obsolete */
19#define TCP_CONNTRACK_SYN_SENT2 TCP_CONNTRACK_LISTEN
20 TCP_CONNTRACK_MAX,
21 TCP_CONNTRACK_IGNORE,
22 TCP_CONNTRACK_RETRANS,
23 TCP_CONNTRACK_UNACK,
24 TCP_CONNTRACK_TIMEOUT_MAX
25};
26
27/* Window scaling is advertised by the sender */
28#define IP_CT_TCP_FLAG_WINDOW_SCALE 0x01
29
30/* SACK is permitted by the sender */
31#define IP_CT_TCP_FLAG_SACK_PERM 0x02
32
33/* This sender sent FIN first */
34#define IP_CT_TCP_FLAG_CLOSE_INIT 0x04
35
36/* Be liberal in window checking */
37#define IP_CT_TCP_FLAG_BE_LIBERAL 0x08
38
39/* Has unacknowledged data */
40#define IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED 0x10
41
42/* The field td_maxack has been set */
43#define IP_CT_TCP_FLAG_MAXACK_SET 0x20
44
45struct nf_ct_tcp_flags {
46 __u8 flags;
47 __u8 mask;
48};
49
50
51#endif /* _UAPI_NF_CONNTRACK_TCP_H */
diff --git a/include/linux/netfilter/nf_conntrack_tuple_common.h b/include/uapi/linux/netfilter/nf_conntrack_tuple_common.h
index 2f6bbc5b8125..2f6bbc5b8125 100644
--- a/include/linux/netfilter/nf_conntrack_tuple_common.h
+++ b/include/uapi/linux/netfilter/nf_conntrack_tuple_common.h
diff --git a/include/linux/netfilter/nf_nat.h b/include/uapi/linux/netfilter/nf_nat.h
index bf0cc373ffb6..bf0cc373ffb6 100644
--- a/include/linux/netfilter/nf_nat.h
+++ b/include/uapi/linux/netfilter/nf_nat.h
diff --git a/include/uapi/linux/netfilter/nfnetlink.h b/include/uapi/linux/netfilter/nfnetlink.h
new file mode 100644
index 000000000000..4a4efafad5f4
--- /dev/null
+++ b/include/uapi/linux/netfilter/nfnetlink.h
@@ -0,0 +1,56 @@
1#ifndef _UAPI_NFNETLINK_H
2#define _UAPI_NFNETLINK_H
3#include <linux/types.h>
4#include <linux/netfilter/nfnetlink_compat.h>
5
6enum nfnetlink_groups {
7 NFNLGRP_NONE,
8#define NFNLGRP_NONE NFNLGRP_NONE
9 NFNLGRP_CONNTRACK_NEW,
10#define NFNLGRP_CONNTRACK_NEW NFNLGRP_CONNTRACK_NEW
11 NFNLGRP_CONNTRACK_UPDATE,
12#define NFNLGRP_CONNTRACK_UPDATE NFNLGRP_CONNTRACK_UPDATE
13 NFNLGRP_CONNTRACK_DESTROY,
14#define NFNLGRP_CONNTRACK_DESTROY NFNLGRP_CONNTRACK_DESTROY
15 NFNLGRP_CONNTRACK_EXP_NEW,
16#define NFNLGRP_CONNTRACK_EXP_NEW NFNLGRP_CONNTRACK_EXP_NEW
17 NFNLGRP_CONNTRACK_EXP_UPDATE,
18#define NFNLGRP_CONNTRACK_EXP_UPDATE NFNLGRP_CONNTRACK_EXP_UPDATE
19 NFNLGRP_CONNTRACK_EXP_DESTROY,
20#define NFNLGRP_CONNTRACK_EXP_DESTROY NFNLGRP_CONNTRACK_EXP_DESTROY
21 __NFNLGRP_MAX,
22};
23#define NFNLGRP_MAX (__NFNLGRP_MAX - 1)
24
25/* General form of address family dependent message.
26 */
27struct nfgenmsg {
28 __u8 nfgen_family; /* AF_xxx */
29 __u8 version; /* nfnetlink version */
30 __be16 res_id; /* resource id */
31};
32
33#define NFNETLINK_V0 0
34
35/* netfilter netlink message types are split in two pieces:
36 * 8 bit subsystem, 8bit operation.
37 */
38
39#define NFNL_SUBSYS_ID(x) ((x & 0xff00) >> 8)
40#define NFNL_MSG_TYPE(x) (x & 0x00ff)
41
42/* No enum here, otherwise __stringify() trick of MODULE_ALIAS_NFNL_SUBSYS()
43 * won't work anymore */
44#define NFNL_SUBSYS_NONE 0
45#define NFNL_SUBSYS_CTNETLINK 1
46#define NFNL_SUBSYS_CTNETLINK_EXP 2
47#define NFNL_SUBSYS_QUEUE 3
48#define NFNL_SUBSYS_ULOG 4
49#define NFNL_SUBSYS_OSF 5
50#define NFNL_SUBSYS_IPSET 6
51#define NFNL_SUBSYS_ACCT 7
52#define NFNL_SUBSYS_CTNETLINK_TIMEOUT 8
53#define NFNL_SUBSYS_CTHELPER 9
54#define NFNL_SUBSYS_COUNT 10
55
56#endif /* _UAPI_NFNETLINK_H */
diff --git a/include/uapi/linux/netfilter/nfnetlink_acct.h b/include/uapi/linux/netfilter/nfnetlink_acct.h
new file mode 100644
index 000000000000..c7b6269e760b
--- /dev/null
+++ b/include/uapi/linux/netfilter/nfnetlink_acct.h
@@ -0,0 +1,27 @@
1#ifndef _UAPI_NFNL_ACCT_H_
2#define _UAPI_NFNL_ACCT_H_
3
4#ifndef NFACCT_NAME_MAX
5#define NFACCT_NAME_MAX 32
6#endif
7
8enum nfnl_acct_msg_types {
9 NFNL_MSG_ACCT_NEW,
10 NFNL_MSG_ACCT_GET,
11 NFNL_MSG_ACCT_GET_CTRZERO,
12 NFNL_MSG_ACCT_DEL,
13 NFNL_MSG_ACCT_MAX
14};
15
16enum nfnl_acct_type {
17 NFACCT_UNSPEC,
18 NFACCT_NAME,
19 NFACCT_PKTS,
20 NFACCT_BYTES,
21 NFACCT_USE,
22 __NFACCT_MAX
23};
24#define NFACCT_MAX (__NFACCT_MAX - 1)
25
26
27#endif /* _UAPI_NFNL_ACCT_H_ */
diff --git a/include/linux/netfilter/nfnetlink_compat.h b/include/uapi/linux/netfilter/nfnetlink_compat.h
index ffb95036bbd4..ffb95036bbd4 100644
--- a/include/linux/netfilter/nfnetlink_compat.h
+++ b/include/uapi/linux/netfilter/nfnetlink_compat.h
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/uapi/linux/netfilter/nfnetlink_conntrack.h
index 43bfe3e1685b..43bfe3e1685b 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/uapi/linux/netfilter/nfnetlink_conntrack.h
diff --git a/include/linux/netfilter/nfnetlink_cthelper.h b/include/uapi/linux/netfilter/nfnetlink_cthelper.h
index 33659f6fad3e..33659f6fad3e 100644
--- a/include/linux/netfilter/nfnetlink_cthelper.h
+++ b/include/uapi/linux/netfilter/nfnetlink_cthelper.h
diff --git a/include/linux/netfilter/nfnetlink_cttimeout.h b/include/uapi/linux/netfilter/nfnetlink_cttimeout.h
index a2810a7c5e30..a2810a7c5e30 100644
--- a/include/linux/netfilter/nfnetlink_cttimeout.h
+++ b/include/uapi/linux/netfilter/nfnetlink_cttimeout.h
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/uapi/linux/netfilter/nfnetlink_log.h
index 90c2c9575bac..90c2c9575bac 100644
--- a/include/linux/netfilter/nfnetlink_log.h
+++ b/include/uapi/linux/netfilter/nfnetlink_log.h
diff --git a/include/linux/netfilter/nfnetlink_queue.h b/include/uapi/linux/netfilter/nfnetlink_queue.h
index 70ec8c2bc11a..70ec8c2bc11a 100644
--- a/include/linux/netfilter/nfnetlink_queue.h
+++ b/include/uapi/linux/netfilter/nfnetlink_queue.h
diff --git a/include/uapi/linux/netfilter/x_tables.h b/include/uapi/linux/netfilter/x_tables.h
new file mode 100644
index 000000000000..c36969b91533
--- /dev/null
+++ b/include/uapi/linux/netfilter/x_tables.h
@@ -0,0 +1,187 @@
1#ifndef _UAPI_X_TABLES_H
2#define _UAPI_X_TABLES_H
3#include <linux/kernel.h>
4#include <linux/types.h>
5
6#define XT_FUNCTION_MAXNAMELEN 30
7#define XT_EXTENSION_MAXNAMELEN 29
8#define XT_TABLE_MAXNAMELEN 32
9
10struct xt_entry_match {
11 union {
12 struct {
13 __u16 match_size;
14
15 /* Used by userspace */
16 char name[XT_EXTENSION_MAXNAMELEN];
17 __u8 revision;
18 } user;
19 struct {
20 __u16 match_size;
21
22 /* Used inside the kernel */
23 struct xt_match *match;
24 } kernel;
25
26 /* Total length */
27 __u16 match_size;
28 } u;
29
30 unsigned char data[0];
31};
32
33struct xt_entry_target {
34 union {
35 struct {
36 __u16 target_size;
37
38 /* Used by userspace */
39 char name[XT_EXTENSION_MAXNAMELEN];
40 __u8 revision;
41 } user;
42 struct {
43 __u16 target_size;
44
45 /* Used inside the kernel */
46 struct xt_target *target;
47 } kernel;
48
49 /* Total length */
50 __u16 target_size;
51 } u;
52
53 unsigned char data[0];
54};
55
56#define XT_TARGET_INIT(__name, __size) \
57{ \
58 .target.u.user = { \
59 .target_size = XT_ALIGN(__size), \
60 .name = __name, \
61 }, \
62}
63
64struct xt_standard_target {
65 struct xt_entry_target target;
66 int verdict;
67};
68
69struct xt_error_target {
70 struct xt_entry_target target;
71 char errorname[XT_FUNCTION_MAXNAMELEN];
72};
73
74/* The argument to IPT_SO_GET_REVISION_*. Returns highest revision
75 * kernel supports, if >= revision. */
76struct xt_get_revision {
77 char name[XT_EXTENSION_MAXNAMELEN];
78 __u8 revision;
79};
80
81/* CONTINUE verdict for targets */
82#define XT_CONTINUE 0xFFFFFFFF
83
84/* For standard target */
85#define XT_RETURN (-NF_REPEAT - 1)
86
87/* this is a dummy structure to find out the alignment requirement for a struct
88 * containing all the fundamental data types that are used in ipt_entry,
89 * ip6t_entry and arpt_entry. This sucks, and it is a hack. It will be my
90 * personal pleasure to remove it -HW
91 */
92struct _xt_align {
93 __u8 u8;
94 __u16 u16;
95 __u32 u32;
96 __u64 u64;
97};
98
99#define XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _xt_align))
100
101/* Standard return verdict, or do jump. */
102#define XT_STANDARD_TARGET ""
103/* Error verdict. */
104#define XT_ERROR_TARGET "ERROR"
105
106#define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0)
107#define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0)
108
109struct xt_counters {
110 __u64 pcnt, bcnt; /* Packet and byte counters */
111};
112
113/* The argument to IPT_SO_ADD_COUNTERS. */
114struct xt_counters_info {
115 /* Which table. */
116 char name[XT_TABLE_MAXNAMELEN];
117
118 unsigned int num_counters;
119
120 /* The counters (actually `number' of these). */
121 struct xt_counters counters[0];
122};
123
124#define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */
125
126#ifndef __KERNEL__
127/* fn returns 0 to continue iteration */
128#define XT_MATCH_ITERATE(type, e, fn, args...) \
129({ \
130 unsigned int __i; \
131 int __ret = 0; \
132 struct xt_entry_match *__m; \
133 \
134 for (__i = sizeof(type); \
135 __i < (e)->target_offset; \
136 __i += __m->u.match_size) { \
137 __m = (void *)e + __i; \
138 \
139 __ret = fn(__m , ## args); \
140 if (__ret != 0) \
141 break; \
142 } \
143 __ret; \
144})
145
146/* fn returns 0 to continue iteration */
147#define XT_ENTRY_ITERATE_CONTINUE(type, entries, size, n, fn, args...) \
148({ \
149 unsigned int __i, __n; \
150 int __ret = 0; \
151 type *__entry; \
152 \
153 for (__i = 0, __n = 0; __i < (size); \
154 __i += __entry->next_offset, __n++) { \
155 __entry = (void *)(entries) + __i; \
156 if (__n < n) \
157 continue; \
158 \
159 __ret = fn(__entry , ## args); \
160 if (__ret != 0) \
161 break; \
162 } \
163 __ret; \
164})
165
166/* fn returns 0 to continue iteration */
167#define XT_ENTRY_ITERATE(type, entries, size, fn, args...) \
168 XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args)
169
170#endif /* !__KERNEL__ */
171
172/* pos is normally a struct ipt_entry/ip6t_entry/etc. */
173#define xt_entry_foreach(pos, ehead, esize) \
174 for ((pos) = (typeof(pos))(ehead); \
175 (pos) < (typeof(pos))((char *)(ehead) + (esize)); \
176 (pos) = (typeof(pos))((char *)(pos) + (pos)->next_offset))
177
178/* can only be xt_entry_match, so no use of typeof here */
179#define xt_ematch_foreach(pos, entry) \
180 for ((pos) = (struct xt_entry_match *)entry->elems; \
181 (pos) < (struct xt_entry_match *)((char *)(entry) + \
182 (entry)->target_offset); \
183 (pos) = (struct xt_entry_match *)((char *)(pos) + \
184 (pos)->u.match_size))
185
186
187#endif /* _UAPI_X_TABLES_H */
diff --git a/include/linux/netfilter/xt_AUDIT.h b/include/uapi/linux/netfilter/xt_AUDIT.h
index 38751d2ea52b..38751d2ea52b 100644
--- a/include/linux/netfilter/xt_AUDIT.h
+++ b/include/uapi/linux/netfilter/xt_AUDIT.h
diff --git a/include/linux/netfilter/xt_CHECKSUM.h b/include/uapi/linux/netfilter/xt_CHECKSUM.h
index 9a2e4661654e..9a2e4661654e 100644
--- a/include/linux/netfilter/xt_CHECKSUM.h
+++ b/include/uapi/linux/netfilter/xt_CHECKSUM.h
diff --git a/include/linux/netfilter/xt_CLASSIFY.h b/include/uapi/linux/netfilter/xt_CLASSIFY.h
index a813bf14dd63..a813bf14dd63 100644
--- a/include/linux/netfilter/xt_CLASSIFY.h
+++ b/include/uapi/linux/netfilter/xt_CLASSIFY.h
diff --git a/include/linux/netfilter/xt_CONNMARK.h b/include/uapi/linux/netfilter/xt_CONNMARK.h
index 2f2e48ec8023..2f2e48ec8023 100644
--- a/include/linux/netfilter/xt_CONNMARK.h
+++ b/include/uapi/linux/netfilter/xt_CONNMARK.h
diff --git a/include/linux/netfilter/xt_CONNSECMARK.h b/include/uapi/linux/netfilter/xt_CONNSECMARK.h
index b973ff80fa1e..b973ff80fa1e 100644
--- a/include/linux/netfilter/xt_CONNSECMARK.h
+++ b/include/uapi/linux/netfilter/xt_CONNSECMARK.h
diff --git a/include/linux/netfilter/xt_CT.h b/include/uapi/linux/netfilter/xt_CT.h
index a064b8af360c..a064b8af360c 100644
--- a/include/linux/netfilter/xt_CT.h
+++ b/include/uapi/linux/netfilter/xt_CT.h
diff --git a/include/linux/netfilter/xt_DSCP.h b/include/uapi/linux/netfilter/xt_DSCP.h
index 648e0b3bed29..648e0b3bed29 100644
--- a/include/linux/netfilter/xt_DSCP.h
+++ b/include/uapi/linux/netfilter/xt_DSCP.h
diff --git a/include/linux/netfilter/xt_IDLETIMER.h b/include/uapi/linux/netfilter/xt_IDLETIMER.h
index 208ae9387331..208ae9387331 100644
--- a/include/linux/netfilter/xt_IDLETIMER.h
+++ b/include/uapi/linux/netfilter/xt_IDLETIMER.h
diff --git a/include/linux/netfilter/xt_LED.h b/include/uapi/linux/netfilter/xt_LED.h
index f5509e7524d3..f5509e7524d3 100644
--- a/include/linux/netfilter/xt_LED.h
+++ b/include/uapi/linux/netfilter/xt_LED.h
diff --git a/include/linux/netfilter/xt_LOG.h b/include/uapi/linux/netfilter/xt_LOG.h
index cac079095305..cac079095305 100644
--- a/include/linux/netfilter/xt_LOG.h
+++ b/include/uapi/linux/netfilter/xt_LOG.h
diff --git a/include/linux/netfilter/xt_MARK.h b/include/uapi/linux/netfilter/xt_MARK.h
index 41c456deba22..41c456deba22 100644
--- a/include/linux/netfilter/xt_MARK.h
+++ b/include/uapi/linux/netfilter/xt_MARK.h
diff --git a/include/linux/netfilter/xt_NFLOG.h b/include/uapi/linux/netfilter/xt_NFLOG.h
index 87b58311ce6b..87b58311ce6b 100644
--- a/include/linux/netfilter/xt_NFLOG.h
+++ b/include/uapi/linux/netfilter/xt_NFLOG.h
diff --git a/include/linux/netfilter/xt_NFQUEUE.h b/include/uapi/linux/netfilter/xt_NFQUEUE.h
index 9eafdbbb401c..9eafdbbb401c 100644
--- a/include/linux/netfilter/xt_NFQUEUE.h
+++ b/include/uapi/linux/netfilter/xt_NFQUEUE.h
diff --git a/include/linux/netfilter/xt_RATEEST.h b/include/uapi/linux/netfilter/xt_RATEEST.h
index 6605e20ad8cf..6605e20ad8cf 100644
--- a/include/linux/netfilter/xt_RATEEST.h
+++ b/include/uapi/linux/netfilter/xt_RATEEST.h
diff --git a/include/linux/netfilter/xt_SECMARK.h b/include/uapi/linux/netfilter/xt_SECMARK.h
index 989092bd6274..989092bd6274 100644
--- a/include/linux/netfilter/xt_SECMARK.h
+++ b/include/uapi/linux/netfilter/xt_SECMARK.h
diff --git a/include/linux/netfilter/xt_TCPMSS.h b/include/uapi/linux/netfilter/xt_TCPMSS.h
index 9a6960afc134..9a6960afc134 100644
--- a/include/linux/netfilter/xt_TCPMSS.h
+++ b/include/uapi/linux/netfilter/xt_TCPMSS.h
diff --git a/include/linux/netfilter/xt_TCPOPTSTRIP.h b/include/uapi/linux/netfilter/xt_TCPOPTSTRIP.h
index 7157318499c2..7157318499c2 100644
--- a/include/linux/netfilter/xt_TCPOPTSTRIP.h
+++ b/include/uapi/linux/netfilter/xt_TCPOPTSTRIP.h
diff --git a/include/linux/netfilter/xt_TEE.h b/include/uapi/linux/netfilter/xt_TEE.h
index 5c21d5c829af..5c21d5c829af 100644
--- a/include/linux/netfilter/xt_TEE.h
+++ b/include/uapi/linux/netfilter/xt_TEE.h
diff --git a/include/linux/netfilter/xt_TPROXY.h b/include/uapi/linux/netfilter/xt_TPROXY.h
index 902043c2073f..902043c2073f 100644
--- a/include/linux/netfilter/xt_TPROXY.h
+++ b/include/uapi/linux/netfilter/xt_TPROXY.h
diff --git a/include/linux/netfilter/xt_addrtype.h b/include/uapi/linux/netfilter/xt_addrtype.h
index b156baa9d55e..b156baa9d55e 100644
--- a/include/linux/netfilter/xt_addrtype.h
+++ b/include/uapi/linux/netfilter/xt_addrtype.h
diff --git a/include/linux/netfilter/xt_cluster.h b/include/uapi/linux/netfilter/xt_cluster.h
index 9b883c8fbf54..9b883c8fbf54 100644
--- a/include/linux/netfilter/xt_cluster.h
+++ b/include/uapi/linux/netfilter/xt_cluster.h
diff --git a/include/linux/netfilter/xt_comment.h b/include/uapi/linux/netfilter/xt_comment.h
index 0ea5e79f5bd7..0ea5e79f5bd7 100644
--- a/include/linux/netfilter/xt_comment.h
+++ b/include/uapi/linux/netfilter/xt_comment.h
diff --git a/include/linux/netfilter/xt_connbytes.h b/include/uapi/linux/netfilter/xt_connbytes.h
index f1d6c15bd9e3..f1d6c15bd9e3 100644
--- a/include/linux/netfilter/xt_connbytes.h
+++ b/include/uapi/linux/netfilter/xt_connbytes.h
diff --git a/include/linux/netfilter/xt_connlimit.h b/include/uapi/linux/netfilter/xt_connlimit.h
index f1656096121e..f1656096121e 100644
--- a/include/linux/netfilter/xt_connlimit.h
+++ b/include/uapi/linux/netfilter/xt_connlimit.h
diff --git a/include/linux/netfilter/xt_connmark.h b/include/uapi/linux/netfilter/xt_connmark.h
index efc17a8305fb..efc17a8305fb 100644
--- a/include/linux/netfilter/xt_connmark.h
+++ b/include/uapi/linux/netfilter/xt_connmark.h
diff --git a/include/linux/netfilter/xt_conntrack.h b/include/uapi/linux/netfilter/xt_conntrack.h
index e3c041d54020..e3c041d54020 100644
--- a/include/linux/netfilter/xt_conntrack.h
+++ b/include/uapi/linux/netfilter/xt_conntrack.h
diff --git a/include/linux/netfilter/xt_cpu.h b/include/uapi/linux/netfilter/xt_cpu.h
index 93c7f11d8f42..93c7f11d8f42 100644
--- a/include/linux/netfilter/xt_cpu.h
+++ b/include/uapi/linux/netfilter/xt_cpu.h
diff --git a/include/linux/netfilter/xt_dccp.h b/include/uapi/linux/netfilter/xt_dccp.h
index a579e1b6f040..a579e1b6f040 100644
--- a/include/linux/netfilter/xt_dccp.h
+++ b/include/uapi/linux/netfilter/xt_dccp.h
diff --git a/include/linux/netfilter/xt_devgroup.h b/include/uapi/linux/netfilter/xt_devgroup.h
index 1babde0ec900..1babde0ec900 100644
--- a/include/linux/netfilter/xt_devgroup.h
+++ b/include/uapi/linux/netfilter/xt_devgroup.h
diff --git a/include/linux/netfilter/xt_dscp.h b/include/uapi/linux/netfilter/xt_dscp.h
index 15f8932ad5ce..15f8932ad5ce 100644
--- a/include/linux/netfilter/xt_dscp.h
+++ b/include/uapi/linux/netfilter/xt_dscp.h
diff --git a/include/linux/netfilter/xt_ecn.h b/include/uapi/linux/netfilter/xt_ecn.h
index 7158fca364f2..7158fca364f2 100644
--- a/include/linux/netfilter/xt_ecn.h
+++ b/include/uapi/linux/netfilter/xt_ecn.h
diff --git a/include/linux/netfilter/xt_esp.h b/include/uapi/linux/netfilter/xt_esp.h
index ee6882408000..ee6882408000 100644
--- a/include/linux/netfilter/xt_esp.h
+++ b/include/uapi/linux/netfilter/xt_esp.h
diff --git a/include/uapi/linux/netfilter/xt_hashlimit.h b/include/uapi/linux/netfilter/xt_hashlimit.h
new file mode 100644
index 000000000000..cbfc43d1af68
--- /dev/null
+++ b/include/uapi/linux/netfilter/xt_hashlimit.h
@@ -0,0 +1,73 @@
1#ifndef _UAPI_XT_HASHLIMIT_H
2#define _UAPI_XT_HASHLIMIT_H
3
4#include <linux/types.h>
5
6/* timings are in milliseconds. */
7#define XT_HASHLIMIT_SCALE 10000
8/* 1/10,000 sec period => max of 10,000/sec. Min rate is then 429490
9 * seconds, or one packet every 59 hours.
10 */
11
12/* packet length accounting is done in 16-byte steps */
13#define XT_HASHLIMIT_BYTE_SHIFT 4
14
15/* details of this structure hidden by the implementation */
16struct xt_hashlimit_htable;
17
18enum {
19 XT_HASHLIMIT_HASH_DIP = 1 << 0,
20 XT_HASHLIMIT_HASH_DPT = 1 << 1,
21 XT_HASHLIMIT_HASH_SIP = 1 << 2,
22 XT_HASHLIMIT_HASH_SPT = 1 << 3,
23 XT_HASHLIMIT_INVERT = 1 << 4,
24 XT_HASHLIMIT_BYTES = 1 << 5,
25};
26
27struct hashlimit_cfg {
28 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */
29 __u32 avg; /* Average secs between packets * scale */
30 __u32 burst; /* Period multiplier for upper limit. */
31
32 /* user specified */
33 __u32 size; /* how many buckets */
34 __u32 max; /* max number of entries */
35 __u32 gc_interval; /* gc interval */
36 __u32 expire; /* when do entries expire? */
37};
38
39struct xt_hashlimit_info {
40 char name [IFNAMSIZ]; /* name */
41 struct hashlimit_cfg cfg;
42
43 /* Used internally by the kernel */
44 struct xt_hashlimit_htable *hinfo;
45 union {
46 void *ptr;
47 struct xt_hashlimit_info *master;
48 } u;
49};
50
51struct hashlimit_cfg1 {
52 __u32 mode; /* bitmask of XT_HASHLIMIT_HASH_* */
53 __u32 avg; /* Average secs between packets * scale */
54 __u32 burst; /* Period multiplier for upper limit. */
55
56 /* user specified */
57 __u32 size; /* how many buckets */
58 __u32 max; /* max number of entries */
59 __u32 gc_interval; /* gc interval */
60 __u32 expire; /* when do entries expire? */
61
62 __u8 srcmask, dstmask;
63};
64
65struct xt_hashlimit_mtinfo1 {
66 char name[IFNAMSIZ];
67 struct hashlimit_cfg1 cfg;
68
69 /* Used internally by the kernel */
70 struct xt_hashlimit_htable *hinfo __attribute__((aligned(8)));
71};
72
73#endif /* _UAPI_XT_HASHLIMIT_H */
diff --git a/include/linux/netfilter/xt_helper.h b/include/uapi/linux/netfilter/xt_helper.h
index 6b42763f999d..6b42763f999d 100644
--- a/include/linux/netfilter/xt_helper.h
+++ b/include/uapi/linux/netfilter/xt_helper.h
diff --git a/include/linux/netfilter/xt_iprange.h b/include/uapi/linux/netfilter/xt_iprange.h
index 25fd7cf851f0..25fd7cf851f0 100644
--- a/include/linux/netfilter/xt_iprange.h
+++ b/include/uapi/linux/netfilter/xt_iprange.h
diff --git a/include/linux/netfilter/xt_ipvs.h b/include/uapi/linux/netfilter/xt_ipvs.h
index eff34ac18808..eff34ac18808 100644
--- a/include/linux/netfilter/xt_ipvs.h
+++ b/include/uapi/linux/netfilter/xt_ipvs.h
diff --git a/include/linux/netfilter/xt_length.h b/include/uapi/linux/netfilter/xt_length.h
index b82ed7c4b1e0..b82ed7c4b1e0 100644
--- a/include/linux/netfilter/xt_length.h
+++ b/include/uapi/linux/netfilter/xt_length.h
diff --git a/include/linux/netfilter/xt_limit.h b/include/uapi/linux/netfilter/xt_limit.h
index bb47fc4d2ade..bb47fc4d2ade 100644
--- a/include/linux/netfilter/xt_limit.h
+++ b/include/uapi/linux/netfilter/xt_limit.h
diff --git a/include/linux/netfilter/xt_mac.h b/include/uapi/linux/netfilter/xt_mac.h
index b892cdc67e06..b892cdc67e06 100644
--- a/include/linux/netfilter/xt_mac.h
+++ b/include/uapi/linux/netfilter/xt_mac.h
diff --git a/include/linux/netfilter/xt_mark.h b/include/uapi/linux/netfilter/xt_mark.h
index ecadc40d5cde..ecadc40d5cde 100644
--- a/include/linux/netfilter/xt_mark.h
+++ b/include/uapi/linux/netfilter/xt_mark.h
diff --git a/include/linux/netfilter/xt_multiport.h b/include/uapi/linux/netfilter/xt_multiport.h
index 5b7e72dfffc5..5b7e72dfffc5 100644
--- a/include/linux/netfilter/xt_multiport.h
+++ b/include/uapi/linux/netfilter/xt_multiport.h
diff --git a/include/linux/netfilter/xt_nfacct.h b/include/uapi/linux/netfilter/xt_nfacct.h
index 3e19c8a86576..3e19c8a86576 100644
--- a/include/linux/netfilter/xt_nfacct.h
+++ b/include/uapi/linux/netfilter/xt_nfacct.h
diff --git a/include/linux/netfilter/xt_osf.h b/include/uapi/linux/netfilter/xt_osf.h
index 18afa495f973..18afa495f973 100644
--- a/include/linux/netfilter/xt_osf.h
+++ b/include/uapi/linux/netfilter/xt_osf.h
diff --git a/include/linux/netfilter/xt_owner.h b/include/uapi/linux/netfilter/xt_owner.h
index 2081761714b5..2081761714b5 100644
--- a/include/linux/netfilter/xt_owner.h
+++ b/include/uapi/linux/netfilter/xt_owner.h
diff --git a/include/uapi/linux/netfilter/xt_physdev.h b/include/uapi/linux/netfilter/xt_physdev.h
new file mode 100644
index 000000000000..db7a2982e9c0
--- /dev/null
+++ b/include/uapi/linux/netfilter/xt_physdev.h
@@ -0,0 +1,23 @@
1#ifndef _UAPI_XT_PHYSDEV_H
2#define _UAPI_XT_PHYSDEV_H
3
4#include <linux/types.h>
5
6
7#define XT_PHYSDEV_OP_IN 0x01
8#define XT_PHYSDEV_OP_OUT 0x02
9#define XT_PHYSDEV_OP_BRIDGED 0x04
10#define XT_PHYSDEV_OP_ISIN 0x08
11#define XT_PHYSDEV_OP_ISOUT 0x10
12#define XT_PHYSDEV_OP_MASK (0x20 - 1)
13
14struct xt_physdev_info {
15 char physindev[IFNAMSIZ];
16 char in_mask[IFNAMSIZ];
17 char physoutdev[IFNAMSIZ];
18 char out_mask[IFNAMSIZ];
19 __u8 invert;
20 __u8 bitmask;
21};
22
23#endif /* _UAPI_XT_PHYSDEV_H */
diff --git a/include/linux/netfilter/xt_pkttype.h b/include/uapi/linux/netfilter/xt_pkttype.h
index f265cf52faea..f265cf52faea 100644
--- a/include/linux/netfilter/xt_pkttype.h
+++ b/include/uapi/linux/netfilter/xt_pkttype.h
diff --git a/include/linux/netfilter/xt_policy.h b/include/uapi/linux/netfilter/xt_policy.h
index be8ead05c316..be8ead05c316 100644
--- a/include/linux/netfilter/xt_policy.h
+++ b/include/uapi/linux/netfilter/xt_policy.h
diff --git a/include/linux/netfilter/xt_quota.h b/include/uapi/linux/netfilter/xt_quota.h
index 9314723f39ca..9314723f39ca 100644
--- a/include/linux/netfilter/xt_quota.h
+++ b/include/uapi/linux/netfilter/xt_quota.h
diff --git a/include/linux/netfilter/xt_rateest.h b/include/uapi/linux/netfilter/xt_rateest.h
index d40a6196842a..d40a6196842a 100644
--- a/include/linux/netfilter/xt_rateest.h
+++ b/include/uapi/linux/netfilter/xt_rateest.h
diff --git a/include/linux/netfilter/xt_realm.h b/include/uapi/linux/netfilter/xt_realm.h
index d4a82ee56a02..d4a82ee56a02 100644
--- a/include/linux/netfilter/xt_realm.h
+++ b/include/uapi/linux/netfilter/xt_realm.h
diff --git a/include/linux/netfilter/xt_recent.h b/include/uapi/linux/netfilter/xt_recent.h
index 6ef36c113e89..6ef36c113e89 100644
--- a/include/linux/netfilter/xt_recent.h
+++ b/include/uapi/linux/netfilter/xt_recent.h
diff --git a/include/linux/netfilter/xt_sctp.h b/include/uapi/linux/netfilter/xt_sctp.h
index 29287be696a2..29287be696a2 100644
--- a/include/linux/netfilter/xt_sctp.h
+++ b/include/uapi/linux/netfilter/xt_sctp.h
diff --git a/include/linux/netfilter/xt_set.h b/include/uapi/linux/netfilter/xt_set.h
index e3a9978f259f..e3a9978f259f 100644
--- a/include/linux/netfilter/xt_set.h
+++ b/include/uapi/linux/netfilter/xt_set.h
diff --git a/include/linux/netfilter/xt_socket.h b/include/uapi/linux/netfilter/xt_socket.h
index 26d7217bd4f1..26d7217bd4f1 100644
--- a/include/linux/netfilter/xt_socket.h
+++ b/include/uapi/linux/netfilter/xt_socket.h
diff --git a/include/linux/netfilter/xt_state.h b/include/uapi/linux/netfilter/xt_state.h
index 7b32de886613..7b32de886613 100644
--- a/include/linux/netfilter/xt_state.h
+++ b/include/uapi/linux/netfilter/xt_state.h
diff --git a/include/linux/netfilter/xt_statistic.h b/include/uapi/linux/netfilter/xt_statistic.h
index 4e983ef0c968..4e983ef0c968 100644
--- a/include/linux/netfilter/xt_statistic.h
+++ b/include/uapi/linux/netfilter/xt_statistic.h
diff --git a/include/linux/netfilter/xt_string.h b/include/uapi/linux/netfilter/xt_string.h
index 235347c02eab..235347c02eab 100644
--- a/include/linux/netfilter/xt_string.h
+++ b/include/uapi/linux/netfilter/xt_string.h
diff --git a/include/linux/netfilter/xt_tcpmss.h b/include/uapi/linux/netfilter/xt_tcpmss.h
index fbac56b9e667..fbac56b9e667 100644
--- a/include/linux/netfilter/xt_tcpmss.h
+++ b/include/uapi/linux/netfilter/xt_tcpmss.h
diff --git a/include/linux/netfilter/xt_tcpudp.h b/include/uapi/linux/netfilter/xt_tcpudp.h
index 38aa7b399021..38aa7b399021 100644
--- a/include/linux/netfilter/xt_tcpudp.h
+++ b/include/uapi/linux/netfilter/xt_tcpudp.h
diff --git a/include/linux/netfilter/xt_time.h b/include/uapi/linux/netfilter/xt_time.h
index 095886019396..095886019396 100644
--- a/include/linux/netfilter/xt_time.h
+++ b/include/uapi/linux/netfilter/xt_time.h
diff --git a/include/linux/netfilter/xt_u32.h b/include/uapi/linux/netfilter/xt_u32.h
index 04d1bfea03c2..04d1bfea03c2 100644
--- a/include/linux/netfilter/xt_u32.h
+++ b/include/uapi/linux/netfilter/xt_u32.h
diff --git a/include/linux/netfilter_arp.h b/include/uapi/linux/netfilter_arp.h
index 92bc6ddcbf73..92bc6ddcbf73 100644
--- a/include/linux/netfilter_arp.h
+++ b/include/uapi/linux/netfilter_arp.h
diff --git a/include/uapi/linux/netfilter_arp/Kbuild b/include/uapi/linux/netfilter_arp/Kbuild
index aafaa5aa54d4..62d5637cc0ac 100644
--- a/include/uapi/linux/netfilter_arp/Kbuild
+++ b/include/uapi/linux/netfilter_arp/Kbuild
@@ -1 +1,3 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += arp_tables.h
3header-y += arpt_mangle.h
diff --git a/include/uapi/linux/netfilter_arp/arp_tables.h b/include/uapi/linux/netfilter_arp/arp_tables.h
new file mode 100644
index 000000000000..a5a86a4db6b3
--- /dev/null
+++ b/include/uapi/linux/netfilter_arp/arp_tables.h
@@ -0,0 +1,206 @@
1/*
2 * Format of an ARP firewall descriptor
3 *
4 * src, tgt, src_mask, tgt_mask, arpop, arpop_mask are always stored in
5 * network byte order.
6 * flags are stored in host byte order (of course).
7 */
8
9#ifndef _UAPI_ARPTABLES_H
10#define _UAPI_ARPTABLES_H
11
12#include <linux/types.h>
13#include <linux/compiler.h>
14#include <linux/netfilter_arp.h>
15
16#include <linux/netfilter/x_tables.h>
17
18#ifndef __KERNEL__
19#define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
20#define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
21#define arpt_entry_target xt_entry_target
22#define arpt_standard_target xt_standard_target
23#define arpt_error_target xt_error_target
24#define ARPT_CONTINUE XT_CONTINUE
25#define ARPT_RETURN XT_RETURN
26#define arpt_counters_info xt_counters_info
27#define arpt_counters xt_counters
28#define ARPT_STANDARD_TARGET XT_STANDARD_TARGET
29#define ARPT_ERROR_TARGET XT_ERROR_TARGET
30#define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \
31 XT_ENTRY_ITERATE(struct arpt_entry, entries, size, fn, ## args)
32#endif
33
34#define ARPT_DEV_ADDR_LEN_MAX 16
35
36struct arpt_devaddr_info {
37 char addr[ARPT_DEV_ADDR_LEN_MAX];
38 char mask[ARPT_DEV_ADDR_LEN_MAX];
39};
40
41/* Yes, Virginia, you have to zero the padding. */
42struct arpt_arp {
43 /* Source and target IP addr */
44 struct in_addr src, tgt;
45 /* Mask for src and target IP addr */
46 struct in_addr smsk, tmsk;
47
48 /* Device hw address length, src+target device addresses */
49 __u8 arhln, arhln_mask;
50 struct arpt_devaddr_info src_devaddr;
51 struct arpt_devaddr_info tgt_devaddr;
52
53 /* ARP operation code. */
54 __be16 arpop, arpop_mask;
55
56 /* ARP hardware address and protocol address format. */
57 __be16 arhrd, arhrd_mask;
58 __be16 arpro, arpro_mask;
59
60 /* The protocol address length is only accepted if it is 4
61 * so there is no use in offering a way to do filtering on it.
62 */
63
64 char iniface[IFNAMSIZ], outiface[IFNAMSIZ];
65 unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
66
67 /* Flags word */
68 __u8 flags;
69 /* Inverse flags */
70 __u16 invflags;
71};
72
73/* Values for "flag" field in struct arpt_ip (general arp structure).
74 * No flags defined yet.
75 */
76#define ARPT_F_MASK 0x00 /* All possible flag bits mask. */
77
78/* Values for "inv" field in struct arpt_arp. */
79#define ARPT_INV_VIA_IN 0x0001 /* Invert the sense of IN IFACE. */
80#define ARPT_INV_VIA_OUT 0x0002 /* Invert the sense of OUT IFACE */
81#define ARPT_INV_SRCIP 0x0004 /* Invert the sense of SRC IP. */
82#define ARPT_INV_TGTIP 0x0008 /* Invert the sense of TGT IP. */
83#define ARPT_INV_SRCDEVADDR 0x0010 /* Invert the sense of SRC DEV ADDR. */
84#define ARPT_INV_TGTDEVADDR 0x0020 /* Invert the sense of TGT DEV ADDR. */
85#define ARPT_INV_ARPOP 0x0040 /* Invert the sense of ARP OP. */
86#define ARPT_INV_ARPHRD 0x0080 /* Invert the sense of ARP HRD. */
87#define ARPT_INV_ARPPRO 0x0100 /* Invert the sense of ARP PRO. */
88#define ARPT_INV_ARPHLN 0x0200 /* Invert the sense of ARP HLN. */
89#define ARPT_INV_MASK 0x03FF /* All possible flag bits mask. */
90
91/* This structure defines each of the firewall rules. Consists of 3
92 parts which are 1) general ARP header stuff 2) match specific
93 stuff 3) the target to perform if the rule matches */
94struct arpt_entry
95{
96 struct arpt_arp arp;
97
98 /* Size of arpt_entry + matches */
99 __u16 target_offset;
100 /* Size of arpt_entry + matches + target */
101 __u16 next_offset;
102
103 /* Back pointer */
104 unsigned int comefrom;
105
106 /* Packet and byte counters. */
107 struct xt_counters counters;
108
109 /* The matches (if any), then the target. */
110 unsigned char elems[0];
111};
112
113/*
114 * New IP firewall options for [gs]etsockopt at the RAW IP level.
115 * Unlike BSD Linux inherits IP options so you don't have to use a raw
116 * socket for this. Instead we check rights in the calls.
117 *
118 * ATTENTION: check linux/in.h before adding new number here.
119 */
120#define ARPT_BASE_CTL 96
121
122#define ARPT_SO_SET_REPLACE (ARPT_BASE_CTL)
123#define ARPT_SO_SET_ADD_COUNTERS (ARPT_BASE_CTL + 1)
124#define ARPT_SO_SET_MAX ARPT_SO_SET_ADD_COUNTERS
125
126#define ARPT_SO_GET_INFO (ARPT_BASE_CTL)
127#define ARPT_SO_GET_ENTRIES (ARPT_BASE_CTL + 1)
128/* #define ARPT_SO_GET_REVISION_MATCH (APRT_BASE_CTL + 2) */
129#define ARPT_SO_GET_REVISION_TARGET (ARPT_BASE_CTL + 3)
130#define ARPT_SO_GET_MAX (ARPT_SO_GET_REVISION_TARGET)
131
132/* The argument to ARPT_SO_GET_INFO */
133struct arpt_getinfo {
134 /* Which table: caller fills this in. */
135 char name[XT_TABLE_MAXNAMELEN];
136
137 /* Kernel fills these in. */
138 /* Which hook entry points are valid: bitmask */
139 unsigned int valid_hooks;
140
141 /* Hook entry points: one per netfilter hook. */
142 unsigned int hook_entry[NF_ARP_NUMHOOKS];
143
144 /* Underflow points. */
145 unsigned int underflow[NF_ARP_NUMHOOKS];
146
147 /* Number of entries */
148 unsigned int num_entries;
149
150 /* Size of entries. */
151 unsigned int size;
152};
153
154/* The argument to ARPT_SO_SET_REPLACE. */
155struct arpt_replace {
156 /* Which table. */
157 char name[XT_TABLE_MAXNAMELEN];
158
159 /* Which hook entry points are valid: bitmask. You can't
160 change this. */
161 unsigned int valid_hooks;
162
163 /* Number of entries */
164 unsigned int num_entries;
165
166 /* Total size of new entries */
167 unsigned int size;
168
169 /* Hook entry points. */
170 unsigned int hook_entry[NF_ARP_NUMHOOKS];
171
172 /* Underflow points. */
173 unsigned int underflow[NF_ARP_NUMHOOKS];
174
175 /* Information about old entries: */
176 /* Number of counters (must be equal to current number of entries). */
177 unsigned int num_counters;
178 /* The old entries' counters. */
179 struct xt_counters __user *counters;
180
181 /* The entries (hang off end: not really an array). */
182 struct arpt_entry entries[0];
183};
184
185/* The argument to ARPT_SO_GET_ENTRIES. */
186struct arpt_get_entries {
187 /* Which table: user fills this in. */
188 char name[XT_TABLE_MAXNAMELEN];
189
190 /* User fills this in: total entry size. */
191 unsigned int size;
192
193 /* The entries. */
194 struct arpt_entry entrytable[0];
195};
196
197/* Helper functions */
198static __inline__ struct xt_entry_target *arpt_get_target(struct arpt_entry *e)
199{
200 return (void *)e + e->target_offset;
201}
202
203/*
204 * Main firewall chains definitions and global var's definitions.
205 */
206#endif /* _UAPI_ARPTABLES_H */
diff --git a/include/linux/netfilter_arp/arpt_mangle.h b/include/uapi/linux/netfilter_arp/arpt_mangle.h
index 250f502902bb..250f502902bb 100644
--- a/include/linux/netfilter_arp/arpt_mangle.h
+++ b/include/uapi/linux/netfilter_arp/arpt_mangle.h
diff --git a/include/uapi/linux/netfilter_bridge.h b/include/uapi/linux/netfilter_bridge.h
new file mode 100644
index 000000000000..a5eda6db8d79
--- /dev/null
+++ b/include/uapi/linux/netfilter_bridge.h
@@ -0,0 +1,27 @@
1#ifndef _UAPI__LINUX_BRIDGE_NETFILTER_H
2#define _UAPI__LINUX_BRIDGE_NETFILTER_H
3
4/* bridge-specific defines for netfilter.
5 */
6
7#include <linux/netfilter.h>
8#include <linux/if_ether.h>
9#include <linux/if_vlan.h>
10#include <linux/if_pppox.h>
11
12/* Bridge Hooks */
13/* After promisc drops, checksum checks. */
14#define NF_BR_PRE_ROUTING 0
15/* If the packet is destined for this box. */
16#define NF_BR_LOCAL_IN 1
17/* If the packet is destined for another interface. */
18#define NF_BR_FORWARD 2
19/* Packets coming from a local process. */
20#define NF_BR_LOCAL_OUT 3
21/* Packets about to hit the wire. */
22#define NF_BR_POST_ROUTING 4
23/* Not really a hook, but used for the ebtables broute table */
24#define NF_BR_BROUTING 5
25#define NF_BR_NUMHOOKS 6
26
27#endif /* _UAPI__LINUX_BRIDGE_NETFILTER_H */
diff --git a/include/uapi/linux/netfilter_bridge/Kbuild b/include/uapi/linux/netfilter_bridge/Kbuild
index aafaa5aa54d4..348717c3a22f 100644
--- a/include/uapi/linux/netfilter_bridge/Kbuild
+++ b/include/uapi/linux/netfilter_bridge/Kbuild
@@ -1 +1,19 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += ebt_802_3.h
3header-y += ebt_among.h
4header-y += ebt_arp.h
5header-y += ebt_arpreply.h
6header-y += ebt_ip.h
7header-y += ebt_ip6.h
8header-y += ebt_limit.h
9header-y += ebt_log.h
10header-y += ebt_mark_m.h
11header-y += ebt_mark_t.h
12header-y += ebt_nat.h
13header-y += ebt_nflog.h
14header-y += ebt_pkttype.h
15header-y += ebt_redirect.h
16header-y += ebt_stp.h
17header-y += ebt_ulog.h
18header-y += ebt_vlan.h
19header-y += ebtables.h
diff --git a/include/uapi/linux/netfilter_bridge/ebt_802_3.h b/include/uapi/linux/netfilter_bridge/ebt_802_3.h
new file mode 100644
index 000000000000..5bf84912a082
--- /dev/null
+++ b/include/uapi/linux/netfilter_bridge/ebt_802_3.h
@@ -0,0 +1,62 @@
1#ifndef _UAPI__LINUX_BRIDGE_EBT_802_3_H
2#define _UAPI__LINUX_BRIDGE_EBT_802_3_H
3
4#include <linux/types.h>
5
6#define EBT_802_3_SAP 0x01
7#define EBT_802_3_TYPE 0x02
8
9#define EBT_802_3_MATCH "802_3"
10
11/*
12 * If frame has DSAP/SSAP value 0xaa you must check the SNAP type
13 * to discover what kind of packet we're carrying.
14 */
15#define CHECK_TYPE 0xaa
16
17/*
18 * Control field may be one or two bytes. If the first byte has
19 * the value 0x03 then the entire length is one byte, otherwise it is two.
20 * One byte controls are used in Unnumbered Information frames.
21 * Two byte controls are used in Numbered Information frames.
22 */
23#define IS_UI 0x03
24
25#define EBT_802_3_MASK (EBT_802_3_SAP | EBT_802_3_TYPE | EBT_802_3)
26
27/* ui has one byte ctrl, ni has two */
28struct hdr_ui {
29 __u8 dsap;
30 __u8 ssap;
31 __u8 ctrl;
32 __u8 orig[3];
33 __be16 type;
34};
35
36struct hdr_ni {
37 __u8 dsap;
38 __u8 ssap;
39 __be16 ctrl;
40 __u8 orig[3];
41 __be16 type;
42};
43
44struct ebt_802_3_hdr {
45 __u8 daddr[6];
46 __u8 saddr[6];
47 __be16 len;
48 union {
49 struct hdr_ui ui;
50 struct hdr_ni ni;
51 } llc;
52};
53
54
55struct ebt_802_3_info {
56 __u8 sap;
57 __be16 type;
58 __u8 bitmask;
59 __u8 invflags;
60};
61
62#endif /* _UAPI__LINUX_BRIDGE_EBT_802_3_H */
diff --git a/include/linux/netfilter_bridge/ebt_among.h b/include/uapi/linux/netfilter_bridge/ebt_among.h
index bd4e3ad0b706..bd4e3ad0b706 100644
--- a/include/linux/netfilter_bridge/ebt_among.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_among.h
diff --git a/include/linux/netfilter_bridge/ebt_arp.h b/include/uapi/linux/netfilter_bridge/ebt_arp.h
index 522f3e427f49..522f3e427f49 100644
--- a/include/linux/netfilter_bridge/ebt_arp.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_arp.h
diff --git a/include/linux/netfilter_bridge/ebt_arpreply.h b/include/uapi/linux/netfilter_bridge/ebt_arpreply.h
index 7e77896e1fbf..7e77896e1fbf 100644
--- a/include/linux/netfilter_bridge/ebt_arpreply.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_arpreply.h
diff --git a/include/linux/netfilter_bridge/ebt_ip.h b/include/uapi/linux/netfilter_bridge/ebt_ip.h
index c4bbc41b0ea4..c4bbc41b0ea4 100644
--- a/include/linux/netfilter_bridge/ebt_ip.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_ip.h
diff --git a/include/linux/netfilter_bridge/ebt_ip6.h b/include/uapi/linux/netfilter_bridge/ebt_ip6.h
index 42b889682721..42b889682721 100644
--- a/include/linux/netfilter_bridge/ebt_ip6.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_ip6.h
diff --git a/include/linux/netfilter_bridge/ebt_limit.h b/include/uapi/linux/netfilter_bridge/ebt_limit.h
index 66d80b30ba0e..66d80b30ba0e 100644
--- a/include/linux/netfilter_bridge/ebt_limit.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_limit.h
diff --git a/include/linux/netfilter_bridge/ebt_log.h b/include/uapi/linux/netfilter_bridge/ebt_log.h
index 7e7f1d1fe494..7e7f1d1fe494 100644
--- a/include/linux/netfilter_bridge/ebt_log.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_log.h
diff --git a/include/linux/netfilter_bridge/ebt_mark_m.h b/include/uapi/linux/netfilter_bridge/ebt_mark_m.h
index 410f9e5a71d4..410f9e5a71d4 100644
--- a/include/linux/netfilter_bridge/ebt_mark_m.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_mark_m.h
diff --git a/include/linux/netfilter_bridge/ebt_mark_t.h b/include/uapi/linux/netfilter_bridge/ebt_mark_t.h
index 7d5a268a4311..7d5a268a4311 100644
--- a/include/linux/netfilter_bridge/ebt_mark_t.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_mark_t.h
diff --git a/include/linux/netfilter_bridge/ebt_nat.h b/include/uapi/linux/netfilter_bridge/ebt_nat.h
index 5e74e3b03bd6..5e74e3b03bd6 100644
--- a/include/linux/netfilter_bridge/ebt_nat.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_nat.h
diff --git a/include/linux/netfilter_bridge/ebt_nflog.h b/include/uapi/linux/netfilter_bridge/ebt_nflog.h
index df829fce9125..df829fce9125 100644
--- a/include/linux/netfilter_bridge/ebt_nflog.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_nflog.h
diff --git a/include/linux/netfilter_bridge/ebt_pkttype.h b/include/uapi/linux/netfilter_bridge/ebt_pkttype.h
index c241badcd036..c241badcd036 100644
--- a/include/linux/netfilter_bridge/ebt_pkttype.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_pkttype.h
diff --git a/include/linux/netfilter_bridge/ebt_redirect.h b/include/uapi/linux/netfilter_bridge/ebt_redirect.h
index dd9622ce8488..dd9622ce8488 100644
--- a/include/linux/netfilter_bridge/ebt_redirect.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_redirect.h
diff --git a/include/linux/netfilter_bridge/ebt_stp.h b/include/uapi/linux/netfilter_bridge/ebt_stp.h
index 1025b9f5fb7d..1025b9f5fb7d 100644
--- a/include/linux/netfilter_bridge/ebt_stp.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_stp.h
diff --git a/include/linux/netfilter_bridge/ebt_ulog.h b/include/uapi/linux/netfilter_bridge/ebt_ulog.h
index 89a6becb5269..89a6becb5269 100644
--- a/include/linux/netfilter_bridge/ebt_ulog.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_ulog.h
diff --git a/include/linux/netfilter_bridge/ebt_vlan.h b/include/uapi/linux/netfilter_bridge/ebt_vlan.h
index 967d1d5cf98d..967d1d5cf98d 100644
--- a/include/linux/netfilter_bridge/ebt_vlan.h
+++ b/include/uapi/linux/netfilter_bridge/ebt_vlan.h
diff --git a/include/uapi/linux/netfilter_bridge/ebtables.h b/include/uapi/linux/netfilter_bridge/ebtables.h
new file mode 100644
index 000000000000..ba993360dbe9
--- /dev/null
+++ b/include/uapi/linux/netfilter_bridge/ebtables.h
@@ -0,0 +1,268 @@
1/*
2 * ebtables
3 *
4 * Authors:
5 * Bart De Schuymer <bdschuym@pandora.be>
6 *
7 * ebtables.c,v 2.0, April, 2002
8 *
9 * This code is stongly inspired on the iptables code which is
10 * Copyright (C) 1999 Paul `Rusty' Russell & Michael J. Neuling
11 */
12
13#ifndef _UAPI__LINUX_BRIDGE_EFF_H
14#define _UAPI__LINUX_BRIDGE_EFF_H
15#include <linux/if.h>
16#include <linux/netfilter_bridge.h>
17#include <linux/if_ether.h>
18
19#define EBT_TABLE_MAXNAMELEN 32
20#define EBT_CHAIN_MAXNAMELEN EBT_TABLE_MAXNAMELEN
21#define EBT_FUNCTION_MAXNAMELEN EBT_TABLE_MAXNAMELEN
22
23/* verdicts >0 are "branches" */
24#define EBT_ACCEPT -1
25#define EBT_DROP -2
26#define EBT_CONTINUE -3
27#define EBT_RETURN -4
28#define NUM_STANDARD_TARGETS 4
29/* ebtables target modules store the verdict inside an int. We can
30 * reclaim a part of this int for backwards compatible extensions.
31 * The 4 lsb are more than enough to store the verdict. */
32#define EBT_VERDICT_BITS 0x0000000F
33
34struct xt_match;
35struct xt_target;
36
37struct ebt_counter {
38 uint64_t pcnt;
39 uint64_t bcnt;
40};
41
42struct ebt_replace {
43 char name[EBT_TABLE_MAXNAMELEN];
44 unsigned int valid_hooks;
45 /* nr of rules in the table */
46 unsigned int nentries;
47 /* total size of the entries */
48 unsigned int entries_size;
49 /* start of the chains */
50 struct ebt_entries __user *hook_entry[NF_BR_NUMHOOKS];
51 /* nr of counters userspace expects back */
52 unsigned int num_counters;
53 /* where the kernel will put the old counters */
54 struct ebt_counter __user *counters;
55 char __user *entries;
56};
57
58struct ebt_replace_kernel {
59 char name[EBT_TABLE_MAXNAMELEN];
60 unsigned int valid_hooks;
61 /* nr of rules in the table */
62 unsigned int nentries;
63 /* total size of the entries */
64 unsigned int entries_size;
65 /* start of the chains */
66 struct ebt_entries *hook_entry[NF_BR_NUMHOOKS];
67 /* nr of counters userspace expects back */
68 unsigned int num_counters;
69 /* where the kernel will put the old counters */
70 struct ebt_counter *counters;
71 char *entries;
72};
73
74struct ebt_entries {
75 /* this field is always set to zero
76 * See EBT_ENTRY_OR_ENTRIES.
77 * Must be same size as ebt_entry.bitmask */
78 unsigned int distinguisher;
79 /* the chain name */
80 char name[EBT_CHAIN_MAXNAMELEN];
81 /* counter offset for this chain */
82 unsigned int counter_offset;
83 /* one standard (accept, drop, return) per hook */
84 int policy;
85 /* nr. of entries */
86 unsigned int nentries;
87 /* entry list */
88 char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace))));
89};
90
91/* used for the bitmask of struct ebt_entry */
92
93/* This is a hack to make a difference between an ebt_entry struct and an
94 * ebt_entries struct when traversing the entries from start to end.
95 * Using this simplifies the code a lot, while still being able to use
96 * ebt_entries.
97 * Contrary, iptables doesn't use something like ebt_entries and therefore uses
98 * different techniques for naming the policy and such. So, iptables doesn't
99 * need a hack like this.
100 */
101#define EBT_ENTRY_OR_ENTRIES 0x01
102/* these are the normal masks */
103#define EBT_NOPROTO 0x02
104#define EBT_802_3 0x04
105#define EBT_SOURCEMAC 0x08
106#define EBT_DESTMAC 0x10
107#define EBT_F_MASK (EBT_NOPROTO | EBT_802_3 | EBT_SOURCEMAC | EBT_DESTMAC \
108 | EBT_ENTRY_OR_ENTRIES)
109
110#define EBT_IPROTO 0x01
111#define EBT_IIN 0x02
112#define EBT_IOUT 0x04
113#define EBT_ISOURCE 0x8
114#define EBT_IDEST 0x10
115#define EBT_ILOGICALIN 0x20
116#define EBT_ILOGICALOUT 0x40
117#define EBT_INV_MASK (EBT_IPROTO | EBT_IIN | EBT_IOUT | EBT_ILOGICALIN \
118 | EBT_ILOGICALOUT | EBT_ISOURCE | EBT_IDEST)
119
120struct ebt_entry_match {
121 union {
122 char name[EBT_FUNCTION_MAXNAMELEN];
123 struct xt_match *match;
124 } u;
125 /* size of data */
126 unsigned int match_size;
127 unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace))));
128};
129
130struct ebt_entry_watcher {
131 union {
132 char name[EBT_FUNCTION_MAXNAMELEN];
133 struct xt_target *watcher;
134 } u;
135 /* size of data */
136 unsigned int watcher_size;
137 unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace))));
138};
139
140struct ebt_entry_target {
141 union {
142 char name[EBT_FUNCTION_MAXNAMELEN];
143 struct xt_target *target;
144 } u;
145 /* size of data */
146 unsigned int target_size;
147 unsigned char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace))));
148};
149
150#define EBT_STANDARD_TARGET "standard"
151struct ebt_standard_target {
152 struct ebt_entry_target target;
153 int verdict;
154};
155
156/* one entry */
157struct ebt_entry {
158 /* this needs to be the first field */
159 unsigned int bitmask;
160 unsigned int invflags;
161 __be16 ethproto;
162 /* the physical in-dev */
163 char in[IFNAMSIZ];
164 /* the logical in-dev */
165 char logical_in[IFNAMSIZ];
166 /* the physical out-dev */
167 char out[IFNAMSIZ];
168 /* the logical out-dev */
169 char logical_out[IFNAMSIZ];
170 unsigned char sourcemac[ETH_ALEN];
171 unsigned char sourcemsk[ETH_ALEN];
172 unsigned char destmac[ETH_ALEN];
173 unsigned char destmsk[ETH_ALEN];
174 /* sizeof ebt_entry + matches */
175 unsigned int watchers_offset;
176 /* sizeof ebt_entry + matches + watchers */
177 unsigned int target_offset;
178 /* sizeof ebt_entry + matches + watchers + target */
179 unsigned int next_offset;
180 unsigned char elems[0] __attribute__ ((aligned (__alignof__(struct ebt_replace))));
181};
182
183/* {g,s}etsockopt numbers */
184#define EBT_BASE_CTL 128
185
186#define EBT_SO_SET_ENTRIES (EBT_BASE_CTL)
187#define EBT_SO_SET_COUNTERS (EBT_SO_SET_ENTRIES+1)
188#define EBT_SO_SET_MAX (EBT_SO_SET_COUNTERS+1)
189
190#define EBT_SO_GET_INFO (EBT_BASE_CTL)
191#define EBT_SO_GET_ENTRIES (EBT_SO_GET_INFO+1)
192#define EBT_SO_GET_INIT_INFO (EBT_SO_GET_ENTRIES+1)
193#define EBT_SO_GET_INIT_ENTRIES (EBT_SO_GET_INIT_INFO+1)
194#define EBT_SO_GET_MAX (EBT_SO_GET_INIT_ENTRIES+1)
195
196
197/* blatently stolen from ip_tables.h
198 * fn returns 0 to continue iteration */
199#define EBT_MATCH_ITERATE(e, fn, args...) \
200({ \
201 unsigned int __i; \
202 int __ret = 0; \
203 struct ebt_entry_match *__match; \
204 \
205 for (__i = sizeof(struct ebt_entry); \
206 __i < (e)->watchers_offset; \
207 __i += __match->match_size + \
208 sizeof(struct ebt_entry_match)) { \
209 __match = (void *)(e) + __i; \
210 \
211 __ret = fn(__match , ## args); \
212 if (__ret != 0) \
213 break; \
214 } \
215 if (__ret == 0) { \
216 if (__i != (e)->watchers_offset) \
217 __ret = -EINVAL; \
218 } \
219 __ret; \
220})
221
222#define EBT_WATCHER_ITERATE(e, fn, args...) \
223({ \
224 unsigned int __i; \
225 int __ret = 0; \
226 struct ebt_entry_watcher *__watcher; \
227 \
228 for (__i = e->watchers_offset; \
229 __i < (e)->target_offset; \
230 __i += __watcher->watcher_size + \
231 sizeof(struct ebt_entry_watcher)) { \
232 __watcher = (void *)(e) + __i; \
233 \
234 __ret = fn(__watcher , ## args); \
235 if (__ret != 0) \
236 break; \
237 } \
238 if (__ret == 0) { \
239 if (__i != (e)->target_offset) \
240 __ret = -EINVAL; \
241 } \
242 __ret; \
243})
244
245#define EBT_ENTRY_ITERATE(entries, size, fn, args...) \
246({ \
247 unsigned int __i; \
248 int __ret = 0; \
249 struct ebt_entry *__entry; \
250 \
251 for (__i = 0; __i < (size);) { \
252 __entry = (void *)(entries) + __i; \
253 __ret = fn(__entry , ## args); \
254 if (__ret != 0) \
255 break; \
256 if (__entry->bitmask != 0) \
257 __i += __entry->next_offset; \
258 else \
259 __i += sizeof(struct ebt_entries); \
260 } \
261 if (__ret == 0) { \
262 if (__i != (size)) \
263 __ret = -EINVAL; \
264 } \
265 __ret; \
266})
267
268#endif /* _UAPI__LINUX_BRIDGE_EFF_H */
diff --git a/include/linux/netfilter_decnet.h b/include/uapi/linux/netfilter_decnet.h
index 0b09732aacd5..0b09732aacd5 100644
--- a/include/linux/netfilter_decnet.h
+++ b/include/uapi/linux/netfilter_decnet.h
diff --git a/include/uapi/linux/netfilter_ipv4.h b/include/uapi/linux/netfilter_ipv4.h
new file mode 100644
index 000000000000..91ddd1f6fd4b
--- /dev/null
+++ b/include/uapi/linux/netfilter_ipv4.h
@@ -0,0 +1,81 @@
1/* IPv4-specific defines for netfilter.
2 * (C)1998 Rusty Russell -- This code is GPL.
3 */
4#ifndef _UAPI__LINUX_IP_NETFILTER_H
5#define _UAPI__LINUX_IP_NETFILTER_H
6
7
8#include <linux/netfilter.h>
9
10/* only for userspace compatibility */
11#ifndef __KERNEL__
12
13#include <limits.h> /* for INT_MIN, INT_MAX */
14
15/* IP Cache bits. */
16/* Src IP address. */
17#define NFC_IP_SRC 0x0001
18/* Dest IP address. */
19#define NFC_IP_DST 0x0002
20/* Input device. */
21#define NFC_IP_IF_IN 0x0004
22/* Output device. */
23#define NFC_IP_IF_OUT 0x0008
24/* TOS. */
25#define NFC_IP_TOS 0x0010
26/* Protocol. */
27#define NFC_IP_PROTO 0x0020
28/* IP options. */
29#define NFC_IP_OPTIONS 0x0040
30/* Frag & flags. */
31#define NFC_IP_FRAG 0x0080
32
33/* Per-protocol information: only matters if proto match. */
34/* TCP flags. */
35#define NFC_IP_TCPFLAGS 0x0100
36/* Source port. */
37#define NFC_IP_SRC_PT 0x0200
38/* Dest port. */
39#define NFC_IP_DST_PT 0x0400
40/* Something else about the proto */
41#define NFC_IP_PROTO_UNKNOWN 0x2000
42
43/* IP Hooks */
44/* After promisc drops, checksum checks. */
45#define NF_IP_PRE_ROUTING 0
46/* If the packet is destined for this box. */
47#define NF_IP_LOCAL_IN 1
48/* If the packet is destined for another interface. */
49#define NF_IP_FORWARD 2
50/* Packets coming from a local process. */
51#define NF_IP_LOCAL_OUT 3
52/* Packets about to hit the wire. */
53#define NF_IP_POST_ROUTING 4
54#define NF_IP_NUMHOOKS 5
55#endif /* ! __KERNEL__ */
56
57enum nf_ip_hook_priorities {
58 NF_IP_PRI_FIRST = INT_MIN,
59 NF_IP_PRI_CONNTRACK_DEFRAG = -400,
60 NF_IP_PRI_RAW = -300,
61 NF_IP_PRI_SELINUX_FIRST = -225,
62 NF_IP_PRI_CONNTRACK = -200,
63 NF_IP_PRI_MANGLE = -150,
64 NF_IP_PRI_NAT_DST = -100,
65 NF_IP_PRI_FILTER = 0,
66 NF_IP_PRI_SECURITY = 50,
67 NF_IP_PRI_NAT_SRC = 100,
68 NF_IP_PRI_SELINUX_LAST = 225,
69 NF_IP_PRI_CONNTRACK_HELPER = 300,
70 NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX,
71 NF_IP_PRI_LAST = INT_MAX,
72};
73
74/* Arguments for setsockopt SOL_IP: */
75/* 2.0 firewalling went from 64 through 71 (and +256, +512, etc). */
76/* 2.2 firewalling (+ masq) went from 64 through 76 */
77/* 2.4 firewalling went 64 through 67. */
78#define SO_ORIGINAL_DST 80
79
80
81#endif /* _UAPI__LINUX_IP_NETFILTER_H */
diff --git a/include/uapi/linux/netfilter_ipv4/Kbuild b/include/uapi/linux/netfilter_ipv4/Kbuild
index aafaa5aa54d4..fb008437dde1 100644
--- a/include/uapi/linux/netfilter_ipv4/Kbuild
+++ b/include/uapi/linux/netfilter_ipv4/Kbuild
@@ -1 +1,11 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += ip_tables.h
3header-y += ipt_CLUSTERIP.h
4header-y += ipt_ECN.h
5header-y += ipt_LOG.h
6header-y += ipt_REJECT.h
7header-y += ipt_TTL.h
8header-y += ipt_ULOG.h
9header-y += ipt_ah.h
10header-y += ipt_ecn.h
11header-y += ipt_ttl.h
diff --git a/include/uapi/linux/netfilter_ipv4/ip_tables.h b/include/uapi/linux/netfilter_ipv4/ip_tables.h
new file mode 100644
index 000000000000..f1e6ef256034
--- /dev/null
+++ b/include/uapi/linux/netfilter_ipv4/ip_tables.h
@@ -0,0 +1,229 @@
1/*
2 * 25-Jul-1998 Major changes to allow for ip chain table
3 *
4 * 3-Jan-2000 Named tables to allow packet selection for different uses.
5 */
6
7/*
8 * Format of an IP firewall descriptor
9 *
10 * src, dst, src_mask, dst_mask are always stored in network byte order.
11 * flags are stored in host byte order (of course).
12 * Port numbers are stored in HOST byte order.
13 */
14
15#ifndef _UAPI_IPTABLES_H
16#define _UAPI_IPTABLES_H
17
18#include <linux/types.h>
19#include <linux/compiler.h>
20#include <linux/netfilter_ipv4.h>
21
22#include <linux/netfilter/x_tables.h>
23
24#ifndef __KERNEL__
25#define IPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
26#define IPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
27#define ipt_match xt_match
28#define ipt_target xt_target
29#define ipt_table xt_table
30#define ipt_get_revision xt_get_revision
31#define ipt_entry_match xt_entry_match
32#define ipt_entry_target xt_entry_target
33#define ipt_standard_target xt_standard_target
34#define ipt_error_target xt_error_target
35#define ipt_counters xt_counters
36#define IPT_CONTINUE XT_CONTINUE
37#define IPT_RETURN XT_RETURN
38
39/* This group is older than old (iptables < v1.4.0-rc1~89) */
40#include <linux/netfilter/xt_tcpudp.h>
41#define ipt_udp xt_udp
42#define ipt_tcp xt_tcp
43#define IPT_TCP_INV_SRCPT XT_TCP_INV_SRCPT
44#define IPT_TCP_INV_DSTPT XT_TCP_INV_DSTPT
45#define IPT_TCP_INV_FLAGS XT_TCP_INV_FLAGS
46#define IPT_TCP_INV_OPTION XT_TCP_INV_OPTION
47#define IPT_TCP_INV_MASK XT_TCP_INV_MASK
48#define IPT_UDP_INV_SRCPT XT_UDP_INV_SRCPT
49#define IPT_UDP_INV_DSTPT XT_UDP_INV_DSTPT
50#define IPT_UDP_INV_MASK XT_UDP_INV_MASK
51
52/* The argument to IPT_SO_ADD_COUNTERS. */
53#define ipt_counters_info xt_counters_info
54/* Standard return verdict, or do jump. */
55#define IPT_STANDARD_TARGET XT_STANDARD_TARGET
56/* Error verdict. */
57#define IPT_ERROR_TARGET XT_ERROR_TARGET
58
59/* fn returns 0 to continue iteration */
60#define IPT_MATCH_ITERATE(e, fn, args...) \
61 XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args)
62
63/* fn returns 0 to continue iteration */
64#define IPT_ENTRY_ITERATE(entries, size, fn, args...) \
65 XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args)
66#endif
67
68/* Yes, Virginia, you have to zero the padding. */
69struct ipt_ip {
70 /* Source and destination IP addr */
71 struct in_addr src, dst;
72 /* Mask for src and dest IP addr */
73 struct in_addr smsk, dmsk;
74 char iniface[IFNAMSIZ], outiface[IFNAMSIZ];
75 unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
76
77 /* Protocol, 0 = ANY */
78 __u16 proto;
79
80 /* Flags word */
81 __u8 flags;
82 /* Inverse flags */
83 __u8 invflags;
84};
85
86/* Values for "flag" field in struct ipt_ip (general ip structure). */
87#define IPT_F_FRAG 0x01 /* Set if rule is a fragment rule */
88#define IPT_F_GOTO 0x02 /* Set if jump is a goto */
89#define IPT_F_MASK 0x03 /* All possible flag bits mask. */
90
91/* Values for "inv" field in struct ipt_ip. */
92#define IPT_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */
93#define IPT_INV_VIA_OUT 0x02 /* Invert the sense of OUT IFACE */
94#define IPT_INV_TOS 0x04 /* Invert the sense of TOS. */
95#define IPT_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */
96#define IPT_INV_DSTIP 0x10 /* Invert the sense of DST OP. */
97#define IPT_INV_FRAG 0x20 /* Invert the sense of FRAG. */
98#define IPT_INV_PROTO XT_INV_PROTO
99#define IPT_INV_MASK 0x7F /* All possible flag bits mask. */
100
101/* This structure defines each of the firewall rules. Consists of 3
102 parts which are 1) general IP header stuff 2) match specific
103 stuff 3) the target to perform if the rule matches */
104struct ipt_entry {
105 struct ipt_ip ip;
106
107 /* Mark with fields that we care about. */
108 unsigned int nfcache;
109
110 /* Size of ipt_entry + matches */
111 __u16 target_offset;
112 /* Size of ipt_entry + matches + target */
113 __u16 next_offset;
114
115 /* Back pointer */
116 unsigned int comefrom;
117
118 /* Packet and byte counters. */
119 struct xt_counters counters;
120
121 /* The matches (if any), then the target. */
122 unsigned char elems[0];
123};
124
125/*
126 * New IP firewall options for [gs]etsockopt at the RAW IP level.
127 * Unlike BSD Linux inherits IP options so you don't have to use a raw
128 * socket for this. Instead we check rights in the calls.
129 *
130 * ATTENTION: check linux/in.h before adding new number here.
131 */
132#define IPT_BASE_CTL 64
133
134#define IPT_SO_SET_REPLACE (IPT_BASE_CTL)
135#define IPT_SO_SET_ADD_COUNTERS (IPT_BASE_CTL + 1)
136#define IPT_SO_SET_MAX IPT_SO_SET_ADD_COUNTERS
137
138#define IPT_SO_GET_INFO (IPT_BASE_CTL)
139#define IPT_SO_GET_ENTRIES (IPT_BASE_CTL + 1)
140#define IPT_SO_GET_REVISION_MATCH (IPT_BASE_CTL + 2)
141#define IPT_SO_GET_REVISION_TARGET (IPT_BASE_CTL + 3)
142#define IPT_SO_GET_MAX IPT_SO_GET_REVISION_TARGET
143
144/* ICMP matching stuff */
145struct ipt_icmp {
146 __u8 type; /* type to match */
147 __u8 code[2]; /* range of code */
148 __u8 invflags; /* Inverse flags */
149};
150
151/* Values for "inv" field for struct ipt_icmp. */
152#define IPT_ICMP_INV 0x01 /* Invert the sense of type/code test */
153
154/* The argument to IPT_SO_GET_INFO */
155struct ipt_getinfo {
156 /* Which table: caller fills this in. */
157 char name[XT_TABLE_MAXNAMELEN];
158
159 /* Kernel fills these in. */
160 /* Which hook entry points are valid: bitmask */
161 unsigned int valid_hooks;
162
163 /* Hook entry points: one per netfilter hook. */
164 unsigned int hook_entry[NF_INET_NUMHOOKS];
165
166 /* Underflow points. */
167 unsigned int underflow[NF_INET_NUMHOOKS];
168
169 /* Number of entries */
170 unsigned int num_entries;
171
172 /* Size of entries. */
173 unsigned int size;
174};
175
176/* The argument to IPT_SO_SET_REPLACE. */
177struct ipt_replace {
178 /* Which table. */
179 char name[XT_TABLE_MAXNAMELEN];
180
181 /* Which hook entry points are valid: bitmask. You can't
182 change this. */
183 unsigned int valid_hooks;
184
185 /* Number of entries */
186 unsigned int num_entries;
187
188 /* Total size of new entries */
189 unsigned int size;
190
191 /* Hook entry points. */
192 unsigned int hook_entry[NF_INET_NUMHOOKS];
193
194 /* Underflow points. */
195 unsigned int underflow[NF_INET_NUMHOOKS];
196
197 /* Information about old entries: */
198 /* Number of counters (must be equal to current number of entries). */
199 unsigned int num_counters;
200 /* The old entries' counters. */
201 struct xt_counters __user *counters;
202
203 /* The entries (hang off end: not really an array). */
204 struct ipt_entry entries[0];
205};
206
207/* The argument to IPT_SO_GET_ENTRIES. */
208struct ipt_get_entries {
209 /* Which table: user fills this in. */
210 char name[XT_TABLE_MAXNAMELEN];
211
212 /* User fills this in: total entry size. */
213 unsigned int size;
214
215 /* The entries. */
216 struct ipt_entry entrytable[0];
217};
218
219/* Helper functions */
220static __inline__ struct xt_entry_target *
221ipt_get_target(struct ipt_entry *e)
222{
223 return (void *)e + e->target_offset;
224}
225
226/*
227 * Main firewall chains definitions and global var's definitions.
228 */
229#endif /* _UAPI_IPTABLES_H */
diff --git a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h b/include/uapi/linux/netfilter_ipv4/ipt_CLUSTERIP.h
index c6a204c97047..c6a204c97047 100644
--- a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
+++ b/include/uapi/linux/netfilter_ipv4/ipt_CLUSTERIP.h
diff --git a/include/linux/netfilter_ipv4/ipt_ECN.h b/include/uapi/linux/netfilter_ipv4/ipt_ECN.h
index bb88d5315a4d..bb88d5315a4d 100644
--- a/include/linux/netfilter_ipv4/ipt_ECN.h
+++ b/include/uapi/linux/netfilter_ipv4/ipt_ECN.h
diff --git a/include/linux/netfilter_ipv4/ipt_LOG.h b/include/uapi/linux/netfilter_ipv4/ipt_LOG.h
index 5d8152077d71..5d8152077d71 100644
--- a/include/linux/netfilter_ipv4/ipt_LOG.h
+++ b/include/uapi/linux/netfilter_ipv4/ipt_LOG.h
diff --git a/include/linux/netfilter_ipv4/ipt_REJECT.h b/include/uapi/linux/netfilter_ipv4/ipt_REJECT.h
index 4293a1ad1b01..4293a1ad1b01 100644
--- a/include/linux/netfilter_ipv4/ipt_REJECT.h
+++ b/include/uapi/linux/netfilter_ipv4/ipt_REJECT.h
diff --git a/include/linux/netfilter_ipv4/ipt_TTL.h b/include/uapi/linux/netfilter_ipv4/ipt_TTL.h
index f6ac169d92f9..f6ac169d92f9 100644
--- a/include/linux/netfilter_ipv4/ipt_TTL.h
+++ b/include/uapi/linux/netfilter_ipv4/ipt_TTL.h
diff --git a/include/linux/netfilter_ipv4/ipt_ULOG.h b/include/uapi/linux/netfilter_ipv4/ipt_ULOG.h
index 417aad280bcc..417aad280bcc 100644
--- a/include/linux/netfilter_ipv4/ipt_ULOG.h
+++ b/include/uapi/linux/netfilter_ipv4/ipt_ULOG.h
diff --git a/include/linux/netfilter_ipv4/ipt_ah.h b/include/uapi/linux/netfilter_ipv4/ipt_ah.h
index 4e02bb0119e3..4e02bb0119e3 100644
--- a/include/linux/netfilter_ipv4/ipt_ah.h
+++ b/include/uapi/linux/netfilter_ipv4/ipt_ah.h
diff --git a/include/linux/netfilter_ipv4/ipt_ecn.h b/include/uapi/linux/netfilter_ipv4/ipt_ecn.h
index 0e0c063dbf60..0e0c063dbf60 100644
--- a/include/linux/netfilter_ipv4/ipt_ecn.h
+++ b/include/uapi/linux/netfilter_ipv4/ipt_ecn.h
diff --git a/include/linux/netfilter_ipv4/ipt_ttl.h b/include/uapi/linux/netfilter_ipv4/ipt_ttl.h
index 37bee4442486..37bee4442486 100644
--- a/include/linux/netfilter_ipv4/ipt_ttl.h
+++ b/include/uapi/linux/netfilter_ipv4/ipt_ttl.h
diff --git a/include/uapi/linux/netfilter_ipv6.h b/include/uapi/linux/netfilter_ipv6.h
new file mode 100644
index 000000000000..12497c6c7949
--- /dev/null
+++ b/include/uapi/linux/netfilter_ipv6.h
@@ -0,0 +1,79 @@
1/* IPv6-specific defines for netfilter.
2 * (C)1998 Rusty Russell -- This code is GPL.
3 * (C)1999 David Jeffery
4 * this header was blatantly ripped from netfilter_ipv4.h
5 * it's amazing what adding a bunch of 6s can do =8^)
6 */
7#ifndef _UAPI__LINUX_IP6_NETFILTER_H
8#define _UAPI__LINUX_IP6_NETFILTER_H
9
10
11#include <linux/netfilter.h>
12
13/* only for userspace compatibility */
14#ifndef __KERNEL__
15
16#include <limits.h> /* for INT_MIN, INT_MAX */
17
18/* IP Cache bits. */
19/* Src IP address. */
20#define NFC_IP6_SRC 0x0001
21/* Dest IP address. */
22#define NFC_IP6_DST 0x0002
23/* Input device. */
24#define NFC_IP6_IF_IN 0x0004
25/* Output device. */
26#define NFC_IP6_IF_OUT 0x0008
27/* TOS. */
28#define NFC_IP6_TOS 0x0010
29/* Protocol. */
30#define NFC_IP6_PROTO 0x0020
31/* IP options. */
32#define NFC_IP6_OPTIONS 0x0040
33/* Frag & flags. */
34#define NFC_IP6_FRAG 0x0080
35
36
37/* Per-protocol information: only matters if proto match. */
38/* TCP flags. */
39#define NFC_IP6_TCPFLAGS 0x0100
40/* Source port. */
41#define NFC_IP6_SRC_PT 0x0200
42/* Dest port. */
43#define NFC_IP6_DST_PT 0x0400
44/* Something else about the proto */
45#define NFC_IP6_PROTO_UNKNOWN 0x2000
46
47/* IP6 Hooks */
48/* After promisc drops, checksum checks. */
49#define NF_IP6_PRE_ROUTING 0
50/* If the packet is destined for this box. */
51#define NF_IP6_LOCAL_IN 1
52/* If the packet is destined for another interface. */
53#define NF_IP6_FORWARD 2
54/* Packets coming from a local process. */
55#define NF_IP6_LOCAL_OUT 3
56/* Packets about to hit the wire. */
57#define NF_IP6_POST_ROUTING 4
58#define NF_IP6_NUMHOOKS 5
59#endif /* ! __KERNEL__ */
60
61
62enum nf_ip6_hook_priorities {
63 NF_IP6_PRI_FIRST = INT_MIN,
64 NF_IP6_PRI_CONNTRACK_DEFRAG = -400,
65 NF_IP6_PRI_RAW = -300,
66 NF_IP6_PRI_SELINUX_FIRST = -225,
67 NF_IP6_PRI_CONNTRACK = -200,
68 NF_IP6_PRI_MANGLE = -150,
69 NF_IP6_PRI_NAT_DST = -100,
70 NF_IP6_PRI_FILTER = 0,
71 NF_IP6_PRI_SECURITY = 50,
72 NF_IP6_PRI_NAT_SRC = 100,
73 NF_IP6_PRI_SELINUX_LAST = 225,
74 NF_IP6_PRI_CONNTRACK_HELPER = 300,
75 NF_IP6_PRI_LAST = INT_MAX,
76};
77
78
79#endif /* _UAPI__LINUX_IP6_NETFILTER_H */
diff --git a/include/uapi/linux/netfilter_ipv6/Kbuild b/include/uapi/linux/netfilter_ipv6/Kbuild
index aafaa5aa54d4..75a668ca2353 100644
--- a/include/uapi/linux/netfilter_ipv6/Kbuild
+++ b/include/uapi/linux/netfilter_ipv6/Kbuild
@@ -1 +1,13 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += ip6_tables.h
3header-y += ip6t_HL.h
4header-y += ip6t_LOG.h
5header-y += ip6t_NPT.h
6header-y += ip6t_REJECT.h
7header-y += ip6t_ah.h
8header-y += ip6t_frag.h
9header-y += ip6t_hl.h
10header-y += ip6t_ipv6header.h
11header-y += ip6t_mh.h
12header-y += ip6t_opts.h
13header-y += ip6t_rt.h
diff --git a/include/uapi/linux/netfilter_ipv6/ip6_tables.h b/include/uapi/linux/netfilter_ipv6/ip6_tables.h
new file mode 100644
index 000000000000..bf1ef65cc582
--- /dev/null
+++ b/include/uapi/linux/netfilter_ipv6/ip6_tables.h
@@ -0,0 +1,267 @@
1/*
2 * 25-Jul-1998 Major changes to allow for ip chain table
3 *
4 * 3-Jan-2000 Named tables to allow packet selection for different uses.
5 */
6
7/*
8 * Format of an IP6 firewall descriptor
9 *
10 * src, dst, src_mask, dst_mask are always stored in network byte order.
11 * flags are stored in host byte order (of course).
12 * Port numbers are stored in HOST byte order.
13 */
14
15#ifndef _UAPI_IP6_TABLES_H
16#define _UAPI_IP6_TABLES_H
17
18#include <linux/types.h>
19#include <linux/compiler.h>
20#include <linux/netfilter_ipv6.h>
21
22#include <linux/netfilter/x_tables.h>
23
24#ifndef __KERNEL__
25#define IP6T_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
26#define IP6T_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
27#define ip6t_match xt_match
28#define ip6t_target xt_target
29#define ip6t_table xt_table
30#define ip6t_get_revision xt_get_revision
31#define ip6t_entry_match xt_entry_match
32#define ip6t_entry_target xt_entry_target
33#define ip6t_standard_target xt_standard_target
34#define ip6t_error_target xt_error_target
35#define ip6t_counters xt_counters
36#define IP6T_CONTINUE XT_CONTINUE
37#define IP6T_RETURN XT_RETURN
38
39/* Pre-iptables-1.4.0 */
40#include <linux/netfilter/xt_tcpudp.h>
41#define ip6t_tcp xt_tcp
42#define ip6t_udp xt_udp
43#define IP6T_TCP_INV_SRCPT XT_TCP_INV_SRCPT
44#define IP6T_TCP_INV_DSTPT XT_TCP_INV_DSTPT
45#define IP6T_TCP_INV_FLAGS XT_TCP_INV_FLAGS
46#define IP6T_TCP_INV_OPTION XT_TCP_INV_OPTION
47#define IP6T_TCP_INV_MASK XT_TCP_INV_MASK
48#define IP6T_UDP_INV_SRCPT XT_UDP_INV_SRCPT
49#define IP6T_UDP_INV_DSTPT XT_UDP_INV_DSTPT
50#define IP6T_UDP_INV_MASK XT_UDP_INV_MASK
51
52#define ip6t_counters_info xt_counters_info
53#define IP6T_STANDARD_TARGET XT_STANDARD_TARGET
54#define IP6T_ERROR_TARGET XT_ERROR_TARGET
55#define IP6T_MATCH_ITERATE(e, fn, args...) \
56 XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args)
57#define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \
58 XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args)
59#endif
60
61/* Yes, Virginia, you have to zero the padding. */
62struct ip6t_ip6 {
63 /* Source and destination IP6 addr */
64 struct in6_addr src, dst;
65 /* Mask for src and dest IP6 addr */
66 struct in6_addr smsk, dmsk;
67 char iniface[IFNAMSIZ], outiface[IFNAMSIZ];
68 unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ];
69
70 /* Upper protocol number
71 * - The allowed value is 0 (any) or protocol number of last parsable
72 * header, which is 50 (ESP), 59 (No Next Header), 135 (MH), or
73 * the non IPv6 extension headers.
74 * - The protocol numbers of IPv6 extension headers except of ESP and
75 * MH do not match any packets.
76 * - You also need to set IP6T_FLAGS_PROTO to "flags" to check protocol.
77 */
78 __u16 proto;
79 /* TOS to match iff flags & IP6T_F_TOS */
80 __u8 tos;
81
82 /* Flags word */
83 __u8 flags;
84 /* Inverse flags */
85 __u8 invflags;
86};
87
88/* Values for "flag" field in struct ip6t_ip6 (general ip6 structure). */
89#define IP6T_F_PROTO 0x01 /* Set if rule cares about upper
90 protocols */
91#define IP6T_F_TOS 0x02 /* Match the TOS. */
92#define IP6T_F_GOTO 0x04 /* Set if jump is a goto */
93#define IP6T_F_MASK 0x07 /* All possible flag bits mask. */
94
95/* Values for "inv" field in struct ip6t_ip6. */
96#define IP6T_INV_VIA_IN 0x01 /* Invert the sense of IN IFACE. */
97#define IP6T_INV_VIA_OUT 0x02 /* Invert the sense of OUT IFACE */
98#define IP6T_INV_TOS 0x04 /* Invert the sense of TOS. */
99#define IP6T_INV_SRCIP 0x08 /* Invert the sense of SRC IP. */
100#define IP6T_INV_DSTIP 0x10 /* Invert the sense of DST OP. */
101#define IP6T_INV_FRAG 0x20 /* Invert the sense of FRAG. */
102#define IP6T_INV_PROTO XT_INV_PROTO
103#define IP6T_INV_MASK 0x7F /* All possible flag bits mask. */
104
105/* This structure defines each of the firewall rules. Consists of 3
106 parts which are 1) general IP header stuff 2) match specific
107 stuff 3) the target to perform if the rule matches */
108struct ip6t_entry {
109 struct ip6t_ip6 ipv6;
110
111 /* Mark with fields that we care about. */
112 unsigned int nfcache;
113
114 /* Size of ipt_entry + matches */
115 __u16 target_offset;
116 /* Size of ipt_entry + matches + target */
117 __u16 next_offset;
118
119 /* Back pointer */
120 unsigned int comefrom;
121
122 /* Packet and byte counters. */
123 struct xt_counters counters;
124
125 /* The matches (if any), then the target. */
126 unsigned char elems[0];
127};
128
129/* Standard entry */
130struct ip6t_standard {
131 struct ip6t_entry entry;
132 struct xt_standard_target target;
133};
134
135struct ip6t_error {
136 struct ip6t_entry entry;
137 struct xt_error_target target;
138};
139
140#define IP6T_ENTRY_INIT(__size) \
141{ \
142 .target_offset = sizeof(struct ip6t_entry), \
143 .next_offset = (__size), \
144}
145
146#define IP6T_STANDARD_INIT(__verdict) \
147{ \
148 .entry = IP6T_ENTRY_INIT(sizeof(struct ip6t_standard)), \
149 .target = XT_TARGET_INIT(XT_STANDARD_TARGET, \
150 sizeof(struct xt_standard_target)), \
151 .target.verdict = -(__verdict) - 1, \
152}
153
154#define IP6T_ERROR_INIT \
155{ \
156 .entry = IP6T_ENTRY_INIT(sizeof(struct ip6t_error)), \
157 .target = XT_TARGET_INIT(XT_ERROR_TARGET, \
158 sizeof(struct xt_error_target)), \
159 .target.errorname = "ERROR", \
160}
161
162/*
163 * New IP firewall options for [gs]etsockopt at the RAW IP level.
164 * Unlike BSD Linux inherits IP options so you don't have to use
165 * a raw socket for this. Instead we check rights in the calls.
166 *
167 * ATTENTION: check linux/in6.h before adding new number here.
168 */
169#define IP6T_BASE_CTL 64
170
171#define IP6T_SO_SET_REPLACE (IP6T_BASE_CTL)
172#define IP6T_SO_SET_ADD_COUNTERS (IP6T_BASE_CTL + 1)
173#define IP6T_SO_SET_MAX IP6T_SO_SET_ADD_COUNTERS
174
175#define IP6T_SO_GET_INFO (IP6T_BASE_CTL)
176#define IP6T_SO_GET_ENTRIES (IP6T_BASE_CTL + 1)
177#define IP6T_SO_GET_REVISION_MATCH (IP6T_BASE_CTL + 4)
178#define IP6T_SO_GET_REVISION_TARGET (IP6T_BASE_CTL + 5)
179#define IP6T_SO_GET_MAX IP6T_SO_GET_REVISION_TARGET
180
181/* ICMP matching stuff */
182struct ip6t_icmp {
183 __u8 type; /* type to match */
184 __u8 code[2]; /* range of code */
185 __u8 invflags; /* Inverse flags */
186};
187
188/* Values for "inv" field for struct ipt_icmp. */
189#define IP6T_ICMP_INV 0x01 /* Invert the sense of type/code test */
190
191/* The argument to IP6T_SO_GET_INFO */
192struct ip6t_getinfo {
193 /* Which table: caller fills this in. */
194 char name[XT_TABLE_MAXNAMELEN];
195
196 /* Kernel fills these in. */
197 /* Which hook entry points are valid: bitmask */
198 unsigned int valid_hooks;
199
200 /* Hook entry points: one per netfilter hook. */
201 unsigned int hook_entry[NF_INET_NUMHOOKS];
202
203 /* Underflow points. */
204 unsigned int underflow[NF_INET_NUMHOOKS];
205
206 /* Number of entries */
207 unsigned int num_entries;
208
209 /* Size of entries. */
210 unsigned int size;
211};
212
213/* The argument to IP6T_SO_SET_REPLACE. */
214struct ip6t_replace {
215 /* Which table. */
216 char name[XT_TABLE_MAXNAMELEN];
217
218 /* Which hook entry points are valid: bitmask. You can't
219 change this. */
220 unsigned int valid_hooks;
221
222 /* Number of entries */
223 unsigned int num_entries;
224
225 /* Total size of new entries */
226 unsigned int size;
227
228 /* Hook entry points. */
229 unsigned int hook_entry[NF_INET_NUMHOOKS];
230
231 /* Underflow points. */
232 unsigned int underflow[NF_INET_NUMHOOKS];
233
234 /* Information about old entries: */
235 /* Number of counters (must be equal to current number of entries). */
236 unsigned int num_counters;
237 /* The old entries' counters. */
238 struct xt_counters __user *counters;
239
240 /* The entries (hang off end: not really an array). */
241 struct ip6t_entry entries[0];
242};
243
244/* The argument to IP6T_SO_GET_ENTRIES. */
245struct ip6t_get_entries {
246 /* Which table: user fills this in. */
247 char name[XT_TABLE_MAXNAMELEN];
248
249 /* User fills this in: total entry size. */
250 unsigned int size;
251
252 /* The entries. */
253 struct ip6t_entry entrytable[0];
254};
255
256/* Helper functions */
257static __inline__ struct xt_entry_target *
258ip6t_get_target(struct ip6t_entry *e)
259{
260 return (void *)e + e->target_offset;
261}
262
263/*
264 * Main firewall chains definitions and global var's definitions.
265 */
266
267#endif /* _UAPI_IP6_TABLES_H */
diff --git a/include/linux/netfilter_ipv6/ip6t_HL.h b/include/uapi/linux/netfilter_ipv6/ip6t_HL.h
index ebd8ead1bb63..ebd8ead1bb63 100644
--- a/include/linux/netfilter_ipv6/ip6t_HL.h
+++ b/include/uapi/linux/netfilter_ipv6/ip6t_HL.h
diff --git a/include/linux/netfilter_ipv6/ip6t_LOG.h b/include/uapi/linux/netfilter_ipv6/ip6t_LOG.h
index 3dd0bc4e0735..3dd0bc4e0735 100644
--- a/include/linux/netfilter_ipv6/ip6t_LOG.h
+++ b/include/uapi/linux/netfilter_ipv6/ip6t_LOG.h
diff --git a/include/linux/netfilter_ipv6/ip6t_NPT.h b/include/uapi/linux/netfilter_ipv6/ip6t_NPT.h
index f763355481b5..f763355481b5 100644
--- a/include/linux/netfilter_ipv6/ip6t_NPT.h
+++ b/include/uapi/linux/netfilter_ipv6/ip6t_NPT.h
diff --git a/include/linux/netfilter_ipv6/ip6t_REJECT.h b/include/uapi/linux/netfilter_ipv6/ip6t_REJECT.h
index 205ed62e4605..205ed62e4605 100644
--- a/include/linux/netfilter_ipv6/ip6t_REJECT.h
+++ b/include/uapi/linux/netfilter_ipv6/ip6t_REJECT.h
diff --git a/include/linux/netfilter_ipv6/ip6t_ah.h b/include/uapi/linux/netfilter_ipv6/ip6t_ah.h
index 5da2b65cb3ad..5da2b65cb3ad 100644
--- a/include/linux/netfilter_ipv6/ip6t_ah.h
+++ b/include/uapi/linux/netfilter_ipv6/ip6t_ah.h
diff --git a/include/linux/netfilter_ipv6/ip6t_frag.h b/include/uapi/linux/netfilter_ipv6/ip6t_frag.h
index b47f61b9e082..b47f61b9e082 100644
--- a/include/linux/netfilter_ipv6/ip6t_frag.h
+++ b/include/uapi/linux/netfilter_ipv6/ip6t_frag.h
diff --git a/include/linux/netfilter_ipv6/ip6t_hl.h b/include/uapi/linux/netfilter_ipv6/ip6t_hl.h
index 6e76dbc6c19a..6e76dbc6c19a 100644
--- a/include/linux/netfilter_ipv6/ip6t_hl.h
+++ b/include/uapi/linux/netfilter_ipv6/ip6t_hl.h
diff --git a/include/linux/netfilter_ipv6/ip6t_ipv6header.h b/include/uapi/linux/netfilter_ipv6/ip6t_ipv6header.h
index efae3a20c214..efae3a20c214 100644
--- a/include/linux/netfilter_ipv6/ip6t_ipv6header.h
+++ b/include/uapi/linux/netfilter_ipv6/ip6t_ipv6header.h
diff --git a/include/linux/netfilter_ipv6/ip6t_mh.h b/include/uapi/linux/netfilter_ipv6/ip6t_mh.h
index a7729a5025cd..a7729a5025cd 100644
--- a/include/linux/netfilter_ipv6/ip6t_mh.h
+++ b/include/uapi/linux/netfilter_ipv6/ip6t_mh.h
diff --git a/include/linux/netfilter_ipv6/ip6t_opts.h b/include/uapi/linux/netfilter_ipv6/ip6t_opts.h
index 17d419a811fd..17d419a811fd 100644
--- a/include/linux/netfilter_ipv6/ip6t_opts.h
+++ b/include/uapi/linux/netfilter_ipv6/ip6t_opts.h
diff --git a/include/linux/netfilter_ipv6/ip6t_rt.h b/include/uapi/linux/netfilter_ipv6/ip6t_rt.h
index 7605a5ff81cd..7605a5ff81cd 100644
--- a/include/linux/netfilter_ipv6/ip6t_rt.h
+++ b/include/uapi/linux/netfilter_ipv6/ip6t_rt.h
diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h
new file mode 100644
index 000000000000..78d5b8a546d6
--- /dev/null
+++ b/include/uapi/linux/netlink.h
@@ -0,0 +1,153 @@
1#ifndef _UAPI__LINUX_NETLINK_H
2#define _UAPI__LINUX_NETLINK_H
3
4#include <linux/socket.h> /* for __kernel_sa_family_t */
5#include <linux/types.h>
6
7#define NETLINK_ROUTE 0 /* Routing/device hook */
8#define NETLINK_UNUSED 1 /* Unused number */
9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */
10#define NETLINK_FIREWALL 3 /* Unused number, formerly ip_queue */
11#define NETLINK_SOCK_DIAG 4 /* socket monitoring */
12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */
13#define NETLINK_XFRM 6 /* ipsec */
14#define NETLINK_SELINUX 7 /* SELinux event notifications */
15#define NETLINK_ISCSI 8 /* Open-iSCSI */
16#define NETLINK_AUDIT 9 /* auditing */
17#define NETLINK_FIB_LOOKUP 10
18#define NETLINK_CONNECTOR 11
19#define NETLINK_NETFILTER 12 /* netfilter subsystem */
20#define NETLINK_IP6_FW 13
21#define NETLINK_DNRTMSG 14 /* DECnet routing messages */
22#define NETLINK_KOBJECT_UEVENT 15 /* Kernel messages to userspace */
23#define NETLINK_GENERIC 16
24/* leave room for NETLINK_DM (DM Events) */
25#define NETLINK_SCSITRANSPORT 18 /* SCSI Transports */
26#define NETLINK_ECRYPTFS 19
27#define NETLINK_RDMA 20
28#define NETLINK_CRYPTO 21 /* Crypto layer */
29
30#define NETLINK_INET_DIAG NETLINK_SOCK_DIAG
31
32#define MAX_LINKS 32
33
34struct sockaddr_nl {
35 __kernel_sa_family_t nl_family; /* AF_NETLINK */
36 unsigned short nl_pad; /* zero */
37 __u32 nl_pid; /* port ID */
38 __u32 nl_groups; /* multicast groups mask */
39};
40
41struct nlmsghdr {
42 __u32 nlmsg_len; /* Length of message including header */
43 __u16 nlmsg_type; /* Message content */
44 __u16 nlmsg_flags; /* Additional flags */
45 __u32 nlmsg_seq; /* Sequence number */
46 __u32 nlmsg_pid; /* Sending process port ID */
47};
48
49/* Flags values */
50
51#define NLM_F_REQUEST 1 /* It is request message. */
52#define NLM_F_MULTI 2 /* Multipart message, terminated by NLMSG_DONE */
53#define NLM_F_ACK 4 /* Reply with ack, with zero or error code */
54#define NLM_F_ECHO 8 /* Echo this request */
55#define NLM_F_DUMP_INTR 16 /* Dump was inconsistent due to sequence change */
56
57/* Modifiers to GET request */
58#define NLM_F_ROOT 0x100 /* specify tree root */
59#define NLM_F_MATCH 0x200 /* return all matching */
60#define NLM_F_ATOMIC 0x400 /* atomic GET */
61#define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH)
62
63/* Modifiers to NEW request */
64#define NLM_F_REPLACE 0x100 /* Override existing */
65#define NLM_F_EXCL 0x200 /* Do not touch, if it exists */
66#define NLM_F_CREATE 0x400 /* Create, if it does not exist */
67#define NLM_F_APPEND 0x800 /* Add to end of list */
68
69/*
70 4.4BSD ADD NLM_F_CREATE|NLM_F_EXCL
71 4.4BSD CHANGE NLM_F_REPLACE
72
73 True CHANGE NLM_F_CREATE|NLM_F_REPLACE
74 Append NLM_F_CREATE
75 Check NLM_F_EXCL
76 */
77
78#define NLMSG_ALIGNTO 4U
79#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )
80#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))
81#define NLMSG_LENGTH(len) ((len)+NLMSG_ALIGN(NLMSG_HDRLEN))
82#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))
83#define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))
84#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), \
85 (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))
86#define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && \
87 (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \
88 (nlh)->nlmsg_len <= (len))
89#define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))
90
91#define NLMSG_NOOP 0x1 /* Nothing. */
92#define NLMSG_ERROR 0x2 /* Error */
93#define NLMSG_DONE 0x3 /* End of a dump */
94#define NLMSG_OVERRUN 0x4 /* Data lost */
95
96#define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */
97
98struct nlmsgerr {
99 int error;
100 struct nlmsghdr msg;
101};
102
103#define NETLINK_ADD_MEMBERSHIP 1
104#define NETLINK_DROP_MEMBERSHIP 2
105#define NETLINK_PKTINFO 3
106#define NETLINK_BROADCAST_ERROR 4
107#define NETLINK_NO_ENOBUFS 5
108
109struct nl_pktinfo {
110 __u32 group;
111};
112
113#define NET_MAJOR 36 /* Major 36 is reserved for networking */
114
115enum {
116 NETLINK_UNCONNECTED = 0,
117 NETLINK_CONNECTED,
118};
119
120/*
121 * <------- NLA_HDRLEN ------> <-- NLA_ALIGN(payload)-->
122 * +---------------------+- - -+- - - - - - - - - -+- - -+
123 * | Header | Pad | Payload | Pad |
124 * | (struct nlattr) | ing | | ing |
125 * +---------------------+- - -+- - - - - - - - - -+- - -+
126 * <-------------- nlattr->nla_len -------------->
127 */
128
129struct nlattr {
130 __u16 nla_len;
131 __u16 nla_type;
132};
133
134/*
135 * nla_type (16 bits)
136 * +---+---+-------------------------------+
137 * | N | O | Attribute Type |
138 * +---+---+-------------------------------+
139 * N := Carries nested attributes
140 * O := Payload stored in network byte order
141 *
142 * Note: The N and O flag are mutually exclusive.
143 */
144#define NLA_F_NESTED (1 << 15)
145#define NLA_F_NET_BYTEORDER (1 << 14)
146#define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER)
147
148#define NLA_ALIGNTO 4
149#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))
150#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))
151
152
153#endif /* _UAPI__LINUX_NETLINK_H */
diff --git a/include/linux/netrom.h b/include/uapi/linux/netrom.h
index af7313cc9cb6..af7313cc9cb6 100644
--- a/include/linux/netrom.h
+++ b/include/uapi/linux/netrom.h
diff --git a/include/linux/nfc.h b/include/uapi/linux/nfc.h
index d908d17da56d..d908d17da56d 100644
--- a/include/linux/nfc.h
+++ b/include/uapi/linux/nfc.h
diff --git a/include/uapi/linux/nfs.h b/include/uapi/linux/nfs.h
new file mode 100644
index 000000000000..5199a36dd574
--- /dev/null
+++ b/include/uapi/linux/nfs.h
@@ -0,0 +1,131 @@
1/*
2 * NFS protocol definitions
3 *
4 * This file contains constants mostly for Version 2 of the protocol,
5 * but also has a couple of NFSv3 bits in (notably the error codes).
6 */
7#ifndef _UAPI_LINUX_NFS_H
8#define _UAPI_LINUX_NFS_H
9
10#define NFS_PROGRAM 100003
11#define NFS_PORT 2049
12#define NFS_MAXDATA 8192
13#define NFS_MAXPATHLEN 1024
14#define NFS_MAXNAMLEN 255
15#define NFS_MAXGROUPS 16
16#define NFS_FHSIZE 32
17#define NFS_COOKIESIZE 4
18#define NFS_FIFO_DEV (-1)
19#define NFSMODE_FMT 0170000
20#define NFSMODE_DIR 0040000
21#define NFSMODE_CHR 0020000
22#define NFSMODE_BLK 0060000
23#define NFSMODE_REG 0100000
24#define NFSMODE_LNK 0120000
25#define NFSMODE_SOCK 0140000
26#define NFSMODE_FIFO 0010000
27
28#define NFS_MNT_PROGRAM 100005
29#define NFS_MNT_VERSION 1
30#define NFS_MNT3_VERSION 3
31
32#define NFS_PIPE_DIRNAME "nfs"
33
34/*
35 * NFS stats. The good thing with these values is that NFSv3 errors are
36 * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which
37 * no-one uses anyway), so we can happily mix code as long as we make sure
38 * no NFSv3 errors are returned to NFSv2 clients.
39 * Error codes that have a `--' in the v2 column are not part of the
40 * standard, but seem to be widely used nevertheless.
41 */
42 enum nfs_stat {
43 NFS_OK = 0, /* v2 v3 v4 */
44 NFSERR_PERM = 1, /* v2 v3 v4 */
45 NFSERR_NOENT = 2, /* v2 v3 v4 */
46 NFSERR_IO = 5, /* v2 v3 v4 */
47 NFSERR_NXIO = 6, /* v2 v3 v4 */
48 NFSERR_EAGAIN = 11, /* v2 v3 */
49 NFSERR_ACCES = 13, /* v2 v3 v4 */
50 NFSERR_EXIST = 17, /* v2 v3 v4 */
51 NFSERR_XDEV = 18, /* v3 v4 */
52 NFSERR_NODEV = 19, /* v2 v3 v4 */
53 NFSERR_NOTDIR = 20, /* v2 v3 v4 */
54 NFSERR_ISDIR = 21, /* v2 v3 v4 */
55 NFSERR_INVAL = 22, /* v2 v3 v4 */
56 NFSERR_FBIG = 27, /* v2 v3 v4 */
57 NFSERR_NOSPC = 28, /* v2 v3 v4 */
58 NFSERR_ROFS = 30, /* v2 v3 v4 */
59 NFSERR_MLINK = 31, /* v3 v4 */
60 NFSERR_OPNOTSUPP = 45, /* v2 v3 */
61 NFSERR_NAMETOOLONG = 63, /* v2 v3 v4 */
62 NFSERR_NOTEMPTY = 66, /* v2 v3 v4 */
63 NFSERR_DQUOT = 69, /* v2 v3 v4 */
64 NFSERR_STALE = 70, /* v2 v3 v4 */
65 NFSERR_REMOTE = 71, /* v2 v3 */
66 NFSERR_WFLUSH = 99, /* v2 */
67 NFSERR_BADHANDLE = 10001, /* v3 v4 */
68 NFSERR_NOT_SYNC = 10002, /* v3 */
69 NFSERR_BAD_COOKIE = 10003, /* v3 v4 */
70 NFSERR_NOTSUPP = 10004, /* v3 v4 */
71 NFSERR_TOOSMALL = 10005, /* v3 v4 */
72 NFSERR_SERVERFAULT = 10006, /* v3 v4 */
73 NFSERR_BADTYPE = 10007, /* v3 v4 */
74 NFSERR_JUKEBOX = 10008, /* v3 v4 */
75 NFSERR_SAME = 10009, /* v4 */
76 NFSERR_DENIED = 10010, /* v4 */
77 NFSERR_EXPIRED = 10011, /* v4 */
78 NFSERR_LOCKED = 10012, /* v4 */
79 NFSERR_GRACE = 10013, /* v4 */
80 NFSERR_FHEXPIRED = 10014, /* v4 */
81 NFSERR_SHARE_DENIED = 10015, /* v4 */
82 NFSERR_WRONGSEC = 10016, /* v4 */
83 NFSERR_CLID_INUSE = 10017, /* v4 */
84 NFSERR_RESOURCE = 10018, /* v4 */
85 NFSERR_MOVED = 10019, /* v4 */
86 NFSERR_NOFILEHANDLE = 10020, /* v4 */
87 NFSERR_MINOR_VERS_MISMATCH = 10021, /* v4 */
88 NFSERR_STALE_CLIENTID = 10022, /* v4 */
89 NFSERR_STALE_STATEID = 10023, /* v4 */
90 NFSERR_OLD_STATEID = 10024, /* v4 */
91 NFSERR_BAD_STATEID = 10025, /* v4 */
92 NFSERR_BAD_SEQID = 10026, /* v4 */
93 NFSERR_NOT_SAME = 10027, /* v4 */
94 NFSERR_LOCK_RANGE = 10028, /* v4 */
95 NFSERR_SYMLINK = 10029, /* v4 */
96 NFSERR_RESTOREFH = 10030, /* v4 */
97 NFSERR_LEASE_MOVED = 10031, /* v4 */
98 NFSERR_ATTRNOTSUPP = 10032, /* v4 */
99 NFSERR_NO_GRACE = 10033, /* v4 */
100 NFSERR_RECLAIM_BAD = 10034, /* v4 */
101 NFSERR_RECLAIM_CONFLICT = 10035,/* v4 */
102 NFSERR_BAD_XDR = 10036, /* v4 */
103 NFSERR_LOCKS_HELD = 10037, /* v4 */
104 NFSERR_OPENMODE = 10038, /* v4 */
105 NFSERR_BADOWNER = 10039, /* v4 */
106 NFSERR_BADCHAR = 10040, /* v4 */
107 NFSERR_BADNAME = 10041, /* v4 */
108 NFSERR_BAD_RANGE = 10042, /* v4 */
109 NFSERR_LOCK_NOTSUPP = 10043, /* v4 */
110 NFSERR_OP_ILLEGAL = 10044, /* v4 */
111 NFSERR_DEADLOCK = 10045, /* v4 */
112 NFSERR_FILE_OPEN = 10046, /* v4 */
113 NFSERR_ADMIN_REVOKED = 10047, /* v4 */
114 NFSERR_CB_PATH_DOWN = 10048, /* v4 */
115};
116
117/* NFSv2 file types - beware, these are not the same in NFSv3 */
118
119enum nfs_ftype {
120 NFNON = 0,
121 NFREG = 1,
122 NFDIR = 2,
123 NFBLK = 3,
124 NFCHR = 4,
125 NFLNK = 5,
126 NFSOCK = 6,
127 NFBAD = 7,
128 NFFIFO = 8
129};
130
131#endif /* _UAPI_LINUX_NFS_H */
diff --git a/include/linux/nfs2.h b/include/uapi/linux/nfs2.h
index fde24b30cc9e..fde24b30cc9e 100644
--- a/include/linux/nfs2.h
+++ b/include/uapi/linux/nfs2.h
diff --git a/include/uapi/linux/nfs3.h b/include/uapi/linux/nfs3.h
new file mode 100644
index 000000000000..231ef4e69829
--- /dev/null
+++ b/include/uapi/linux/nfs3.h
@@ -0,0 +1,97 @@
1/*
2 * NFSv3 protocol definitions
3 */
4#ifndef _UAPI_LINUX_NFS3_H
5#define _UAPI_LINUX_NFS3_H
6
7#define NFS3_PORT 2049
8#define NFS3_MAXDATA 32768
9#define NFS3_MAXPATHLEN PATH_MAX
10#define NFS3_MAXNAMLEN NAME_MAX
11#define NFS3_MAXGROUPS 16
12#define NFS3_FHSIZE 64
13#define NFS3_COOKIESIZE 4
14#define NFS3_CREATEVERFSIZE 8
15#define NFS3_COOKIEVERFSIZE 8
16#define NFS3_WRITEVERFSIZE 8
17#define NFS3_FIFO_DEV (-1)
18#define NFS3MODE_FMT 0170000
19#define NFS3MODE_DIR 0040000
20#define NFS3MODE_CHR 0020000
21#define NFS3MODE_BLK 0060000
22#define NFS3MODE_REG 0100000
23#define NFS3MODE_LNK 0120000
24#define NFS3MODE_SOCK 0140000
25#define NFS3MODE_FIFO 0010000
26
27/* Flags for access() call */
28#define NFS3_ACCESS_READ 0x0001
29#define NFS3_ACCESS_LOOKUP 0x0002
30#define NFS3_ACCESS_MODIFY 0x0004
31#define NFS3_ACCESS_EXTEND 0x0008
32#define NFS3_ACCESS_DELETE 0x0010
33#define NFS3_ACCESS_EXECUTE 0x0020
34#define NFS3_ACCESS_FULL 0x003f
35
36/* Flags for create mode */
37enum nfs3_createmode {
38 NFS3_CREATE_UNCHECKED = 0,
39 NFS3_CREATE_GUARDED = 1,
40 NFS3_CREATE_EXCLUSIVE = 2
41};
42
43/* NFSv3 file system properties */
44#define NFS3_FSF_LINK 0x0001
45#define NFS3_FSF_SYMLINK 0x0002
46#define NFS3_FSF_HOMOGENEOUS 0x0008
47#define NFS3_FSF_CANSETTIME 0x0010
48/* Some shorthands. See fs/nfsd/nfs3proc.c */
49#define NFS3_FSF_DEFAULT 0x001B
50#define NFS3_FSF_BILLYBOY 0x0018
51#define NFS3_FSF_READONLY 0x0008
52
53enum nfs3_ftype {
54 NF3NON = 0,
55 NF3REG = 1,
56 NF3DIR = 2,
57 NF3BLK = 3,
58 NF3CHR = 4,
59 NF3LNK = 5,
60 NF3SOCK = 6,
61 NF3FIFO = 7, /* changed from NFSv2 (was 8) */
62 NF3BAD = 8
63};
64
65struct nfs3_fh {
66 unsigned short size;
67 unsigned char data[NFS3_FHSIZE];
68};
69
70#define NFS3_VERSION 3
71#define NFS3PROC_NULL 0
72#define NFS3PROC_GETATTR 1
73#define NFS3PROC_SETATTR 2
74#define NFS3PROC_LOOKUP 3
75#define NFS3PROC_ACCESS 4
76#define NFS3PROC_READLINK 5
77#define NFS3PROC_READ 6
78#define NFS3PROC_WRITE 7
79#define NFS3PROC_CREATE 8
80#define NFS3PROC_MKDIR 9
81#define NFS3PROC_SYMLINK 10
82#define NFS3PROC_MKNOD 11
83#define NFS3PROC_REMOVE 12
84#define NFS3PROC_RMDIR 13
85#define NFS3PROC_RENAME 14
86#define NFS3PROC_LINK 15
87#define NFS3PROC_READDIR 16
88#define NFS3PROC_READDIRPLUS 17
89#define NFS3PROC_FSSTAT 18
90#define NFS3PROC_FSINFO 19
91#define NFS3PROC_PATHCONF 20
92#define NFS3PROC_COMMIT 21
93
94#define NFS_MNT3_VERSION 3
95
96
97#endif /* _UAPI_LINUX_NFS3_H */
diff --git a/include/uapi/linux/nfs4.h b/include/uapi/linux/nfs4.h
new file mode 100644
index 000000000000..788128ebac45
--- /dev/null
+++ b/include/uapi/linux/nfs4.h
@@ -0,0 +1,178 @@
1/*
2 * include/linux/nfs4.h
3 *
4 * NFSv4 protocol definitions.
5 *
6 * Copyright (c) 2002 The Regents of the University of Michigan.
7 * All rights reserved.
8 *
9 * Kendrick Smith <kmsmith@umich.edu>
10 * Andy Adamson <andros@umich.edu>
11 */
12
13#ifndef _UAPI_LINUX_NFS4_H
14#define _UAPI_LINUX_NFS4_H
15
16#include <linux/types.h>
17
18#define NFS4_BITMAP_SIZE 2
19#define NFS4_VERIFIER_SIZE 8
20#define NFS4_STATEID_SEQID_SIZE 4
21#define NFS4_STATEID_OTHER_SIZE 12
22#define NFS4_STATEID_SIZE (NFS4_STATEID_SEQID_SIZE + NFS4_STATEID_OTHER_SIZE)
23#define NFS4_FHSIZE 128
24#define NFS4_MAXPATHLEN PATH_MAX
25#define NFS4_MAXNAMLEN NAME_MAX
26#define NFS4_OPAQUE_LIMIT 1024
27#define NFS4_MAX_SESSIONID_LEN 16
28
29#define NFS4_ACCESS_READ 0x0001
30#define NFS4_ACCESS_LOOKUP 0x0002
31#define NFS4_ACCESS_MODIFY 0x0004
32#define NFS4_ACCESS_EXTEND 0x0008
33#define NFS4_ACCESS_DELETE 0x0010
34#define NFS4_ACCESS_EXECUTE 0x0020
35
36#define NFS4_FH_PERSISTENT 0x0000
37#define NFS4_FH_NOEXPIRE_WITH_OPEN 0x0001
38#define NFS4_FH_VOLATILE_ANY 0x0002
39#define NFS4_FH_VOL_MIGRATION 0x0004
40#define NFS4_FH_VOL_RENAME 0x0008
41
42#define NFS4_OPEN_RESULT_CONFIRM 0x0002
43#define NFS4_OPEN_RESULT_LOCKTYPE_POSIX 0x0004
44
45#define NFS4_SHARE_ACCESS_MASK 0x000F
46#define NFS4_SHARE_ACCESS_READ 0x0001
47#define NFS4_SHARE_ACCESS_WRITE 0x0002
48#define NFS4_SHARE_ACCESS_BOTH 0x0003
49#define NFS4_SHARE_DENY_READ 0x0001
50#define NFS4_SHARE_DENY_WRITE 0x0002
51#define NFS4_SHARE_DENY_BOTH 0x0003
52
53/* nfs41 */
54#define NFS4_SHARE_WANT_MASK 0xFF00
55#define NFS4_SHARE_WANT_NO_PREFERENCE 0x0000
56#define NFS4_SHARE_WANT_READ_DELEG 0x0100
57#define NFS4_SHARE_WANT_WRITE_DELEG 0x0200
58#define NFS4_SHARE_WANT_ANY_DELEG 0x0300
59#define NFS4_SHARE_WANT_NO_DELEG 0x0400
60#define NFS4_SHARE_WANT_CANCEL 0x0500
61
62#define NFS4_SHARE_WHEN_MASK 0xF0000
63#define NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL 0x10000
64#define NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED 0x20000
65
66#define NFS4_CDFC4_FORE 0x1
67#define NFS4_CDFC4_BACK 0x2
68#define NFS4_CDFC4_BOTH 0x3
69#define NFS4_CDFC4_FORE_OR_BOTH 0x3
70#define NFS4_CDFC4_BACK_OR_BOTH 0x7
71
72#define NFS4_CDFS4_FORE 0x1
73#define NFS4_CDFS4_BACK 0x2
74#define NFS4_CDFS4_BOTH 0x3
75
76#define NFS4_SET_TO_SERVER_TIME 0
77#define NFS4_SET_TO_CLIENT_TIME 1
78
79#define NFS4_ACE_ACCESS_ALLOWED_ACE_TYPE 0
80#define NFS4_ACE_ACCESS_DENIED_ACE_TYPE 1
81#define NFS4_ACE_SYSTEM_AUDIT_ACE_TYPE 2
82#define NFS4_ACE_SYSTEM_ALARM_ACE_TYPE 3
83
84#define ACL4_SUPPORT_ALLOW_ACL 0x01
85#define ACL4_SUPPORT_DENY_ACL 0x02
86#define ACL4_SUPPORT_AUDIT_ACL 0x04
87#define ACL4_SUPPORT_ALARM_ACL 0x08
88
89#define NFS4_ACE_FILE_INHERIT_ACE 0x00000001
90#define NFS4_ACE_DIRECTORY_INHERIT_ACE 0x00000002
91#define NFS4_ACE_NO_PROPAGATE_INHERIT_ACE 0x00000004
92#define NFS4_ACE_INHERIT_ONLY_ACE 0x00000008
93#define NFS4_ACE_SUCCESSFUL_ACCESS_ACE_FLAG 0x00000010
94#define NFS4_ACE_FAILED_ACCESS_ACE_FLAG 0x00000020
95#define NFS4_ACE_IDENTIFIER_GROUP 0x00000040
96
97#define NFS4_ACE_READ_DATA 0x00000001
98#define NFS4_ACE_LIST_DIRECTORY 0x00000001
99#define NFS4_ACE_WRITE_DATA 0x00000002
100#define NFS4_ACE_ADD_FILE 0x00000002
101#define NFS4_ACE_APPEND_DATA 0x00000004
102#define NFS4_ACE_ADD_SUBDIRECTORY 0x00000004
103#define NFS4_ACE_READ_NAMED_ATTRS 0x00000008
104#define NFS4_ACE_WRITE_NAMED_ATTRS 0x00000010
105#define NFS4_ACE_EXECUTE 0x00000020
106#define NFS4_ACE_DELETE_CHILD 0x00000040
107#define NFS4_ACE_READ_ATTRIBUTES 0x00000080
108#define NFS4_ACE_WRITE_ATTRIBUTES 0x00000100
109#define NFS4_ACE_DELETE 0x00010000
110#define NFS4_ACE_READ_ACL 0x00020000
111#define NFS4_ACE_WRITE_ACL 0x00040000
112#define NFS4_ACE_WRITE_OWNER 0x00080000
113#define NFS4_ACE_SYNCHRONIZE 0x00100000
114#define NFS4_ACE_GENERIC_READ 0x00120081
115#define NFS4_ACE_GENERIC_WRITE 0x00160106
116#define NFS4_ACE_GENERIC_EXECUTE 0x001200A0
117#define NFS4_ACE_MASK_ALL 0x001F01FF
118
119#define EXCHGID4_FLAG_SUPP_MOVED_REFER 0x00000001
120#define EXCHGID4_FLAG_SUPP_MOVED_MIGR 0x00000002
121#define EXCHGID4_FLAG_BIND_PRINC_STATEID 0x00000100
122
123#define EXCHGID4_FLAG_USE_NON_PNFS 0x00010000
124#define EXCHGID4_FLAG_USE_PNFS_MDS 0x00020000
125#define EXCHGID4_FLAG_USE_PNFS_DS 0x00040000
126#define EXCHGID4_FLAG_MASK_PNFS 0x00070000
127
128#define EXCHGID4_FLAG_UPD_CONFIRMED_REC_A 0x40000000
129#define EXCHGID4_FLAG_CONFIRMED_R 0x80000000
130/*
131 * Since the validity of these bits depends on whether
132 * they're set in the argument or response, have separate
133 * invalid flag masks for arg (_A) and resp (_R).
134 */
135#define EXCHGID4_FLAG_MASK_A 0x40070103
136#define EXCHGID4_FLAG_MASK_R 0x80070103
137
138#define SEQ4_STATUS_CB_PATH_DOWN 0x00000001
139#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING 0x00000002
140#define SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED 0x00000004
141#define SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED 0x00000008
142#define SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED 0x00000010
143#define SEQ4_STATUS_ADMIN_STATE_REVOKED 0x00000020
144#define SEQ4_STATUS_RECALLABLE_STATE_REVOKED 0x00000040
145#define SEQ4_STATUS_LEASE_MOVED 0x00000080
146#define SEQ4_STATUS_RESTART_RECLAIM_NEEDED 0x00000100
147#define SEQ4_STATUS_CB_PATH_DOWN_SESSION 0x00000200
148#define SEQ4_STATUS_BACKCHANNEL_FAULT 0x00000400
149
150#define NFS4_SECINFO_STYLE4_CURRENT_FH 0
151#define NFS4_SECINFO_STYLE4_PARENT 1
152
153#define NFS4_MAX_UINT64 (~(u64)0)
154
155/* An NFS4 sessions server must support at least NFS4_MAX_OPS operations.
156 * If a compound requires more operations, adjust NFS4_MAX_OPS accordingly.
157 */
158#define NFS4_MAX_OPS 8
159
160/* Our NFS4 client back channel server only wants the cb_sequene and the
161 * actual operation per compound
162 */
163#define NFS4_MAX_BACK_CHANNEL_OPS 2
164
165enum nfs4_acl_whotype {
166 NFS4_ACL_WHO_NAMED = 0,
167 NFS4_ACL_WHO_OWNER,
168 NFS4_ACL_WHO_GROUP,
169 NFS4_ACL_WHO_EVERYONE,
170};
171
172#endif /* _UAPI_LINUX_NFS4_H */
173
174/*
175 * Local variables:
176 * c-basic-offset: 8
177 * End:
178 */
diff --git a/include/linux/nfs4_mount.h b/include/uapi/linux/nfs4_mount.h
index a0dcf6655657..a0dcf6655657 100644
--- a/include/linux/nfs4_mount.h
+++ b/include/uapi/linux/nfs4_mount.h
diff --git a/include/uapi/linux/nfs_fs.h b/include/uapi/linux/nfs_fs.h
new file mode 100644
index 000000000000..49142287999c
--- /dev/null
+++ b/include/uapi/linux/nfs_fs.h
@@ -0,0 +1,61 @@
1/*
2 * linux/include/linux/nfs_fs.h
3 *
4 * Copyright (C) 1992 Rick Sladkey
5 *
6 * OS-specific nfs filesystem definitions and declarations
7 */
8
9#ifndef _UAPI_LINUX_NFS_FS_H
10#define _UAPI_LINUX_NFS_FS_H
11
12#include <linux/magic.h>
13
14/* Default timeout values */
15#define NFS_DEF_UDP_TIMEO (11)
16#define NFS_DEF_UDP_RETRANS (3)
17#define NFS_DEF_TCP_TIMEO (600)
18#define NFS_DEF_TCP_RETRANS (2)
19
20#define NFS_MAX_UDP_TIMEOUT (60*HZ)
21#define NFS_MAX_TCP_TIMEOUT (600*HZ)
22
23#define NFS_DEF_ACREGMIN (3)
24#define NFS_DEF_ACREGMAX (60)
25#define NFS_DEF_ACDIRMIN (30)
26#define NFS_DEF_ACDIRMAX (60)
27
28/*
29 * When flushing a cluster of dirty pages, there can be different
30 * strategies:
31 */
32#define FLUSH_SYNC 1 /* file being synced, or contention */
33#define FLUSH_STABLE 4 /* commit to stable storage */
34#define FLUSH_LOWPRI 8 /* low priority background flush */
35#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */
36#define FLUSH_COND_STABLE 32 /* conditional stable write - only stable
37 * if everything fits in one RPC */
38
39
40/*
41 * NFS debug flags
42 */
43#define NFSDBG_VFS 0x0001
44#define NFSDBG_DIRCACHE 0x0002
45#define NFSDBG_LOOKUPCACHE 0x0004
46#define NFSDBG_PAGECACHE 0x0008
47#define NFSDBG_PROC 0x0010
48#define NFSDBG_XDR 0x0020
49#define NFSDBG_FILE 0x0040
50#define NFSDBG_ROOT 0x0080
51#define NFSDBG_CALLBACK 0x0100
52#define NFSDBG_CLIENT 0x0200
53#define NFSDBG_MOUNT 0x0400
54#define NFSDBG_FSCACHE 0x0800
55#define NFSDBG_PNFS 0x1000
56#define NFSDBG_PNFS_LD 0x2000
57#define NFSDBG_STATE 0x4000
58#define NFSDBG_ALL 0xFFFF
59
60
61#endif /* _UAPI_LINUX_NFS_FS_H */
diff --git a/include/uapi/linux/nfs_idmap.h b/include/uapi/linux/nfs_idmap.h
new file mode 100644
index 000000000000..8d4b1c7b24d4
--- /dev/null
+++ b/include/uapi/linux/nfs_idmap.h
@@ -0,0 +1,65 @@
1/*
2 * include/linux/nfs_idmap.h
3 *
4 * UID and GID to name mapping for clients.
5 *
6 * Copyright (c) 2002 The Regents of the University of Michigan.
7 * All rights reserved.
8 *
9 * Marius Aamodt Eriksen <marius@umich.edu>
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
25 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
31 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#ifndef _UAPINFS_IDMAP_H
38#define _UAPINFS_IDMAP_H
39
40#include <linux/types.h>
41
42/* XXX from bits/utmp.h */
43#define IDMAP_NAMESZ 128
44
45#define IDMAP_TYPE_USER 0
46#define IDMAP_TYPE_GROUP 1
47
48#define IDMAP_CONV_IDTONAME 0
49#define IDMAP_CONV_NAMETOID 1
50
51#define IDMAP_STATUS_INVALIDMSG 0x01
52#define IDMAP_STATUS_AGAIN 0x02
53#define IDMAP_STATUS_LOOKUPFAIL 0x04
54#define IDMAP_STATUS_SUCCESS 0x08
55
56struct idmap_msg {
57 __u8 im_type;
58 __u8 im_conv;
59 char im_name[IDMAP_NAMESZ];
60 __u32 im_id;
61 __u8 im_status;
62};
63
64
65#endif /* _UAPINFS_IDMAP_H */
diff --git a/include/linux/nfs_mount.h b/include/uapi/linux/nfs_mount.h
index 576bddd72e04..576bddd72e04 100644
--- a/include/linux/nfs_mount.h
+++ b/include/uapi/linux/nfs_mount.h
diff --git a/include/uapi/linux/nfsacl.h b/include/uapi/linux/nfsacl.h
new file mode 100644
index 000000000000..9bb9771a107f
--- /dev/null
+++ b/include/uapi/linux/nfsacl.h
@@ -0,0 +1,29 @@
1/*
2 * File: linux/nfsacl.h
3 *
4 * (C) 2003 Andreas Gruenbacher <agruen@suse.de>
5 */
6#ifndef _UAPI__LINUX_NFSACL_H
7#define _UAPI__LINUX_NFSACL_H
8
9#define NFS_ACL_PROGRAM 100227
10
11#define ACLPROC2_GETACL 1
12#define ACLPROC2_SETACL 2
13#define ACLPROC2_GETATTR 3
14#define ACLPROC2_ACCESS 4
15
16#define ACLPROC3_GETACL 1
17#define ACLPROC3_SETACL 2
18
19
20/* Flags for the getacl/setacl mode */
21#define NFS_ACL 0x0001
22#define NFS_ACLCNT 0x0002
23#define NFS_DFACL 0x0004
24#define NFS_DFACLCNT 0x0008
25
26/* Flag for Default ACL entries */
27#define NFS_ACL_DEFAULT 0x1000
28
29#endif /* _UAPI__LINUX_NFSACL_H */
diff --git a/include/uapi/linux/nfsd/Kbuild b/include/uapi/linux/nfsd/Kbuild
index aafaa5aa54d4..c11bc404053c 100644
--- a/include/uapi/linux/nfsd/Kbuild
+++ b/include/uapi/linux/nfsd/Kbuild
@@ -1 +1,6 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += cld.h
3header-y += debug.h
4header-y += export.h
5header-y += nfsfh.h
6header-y += stats.h
diff --git a/include/linux/nfsd/cld.h b/include/uapi/linux/nfsd/cld.h
index f14a9ab06f1f..f14a9ab06f1f 100644
--- a/include/linux/nfsd/cld.h
+++ b/include/uapi/linux/nfsd/cld.h
diff --git a/include/uapi/linux/nfsd/debug.h b/include/uapi/linux/nfsd/debug.h
new file mode 100644
index 000000000000..a6f453c740b8
--- /dev/null
+++ b/include/uapi/linux/nfsd/debug.h
@@ -0,0 +1,40 @@
1/*
2 * linux/include/linux/nfsd/debug.h
3 *
4 * Debugging-related stuff for nfsd
5 *
6 * Copyright (C) 1995 Olaf Kirch <okir@monad.swb.de>
7 */
8
9#ifndef _UAPILINUX_NFSD_DEBUG_H
10#define _UAPILINUX_NFSD_DEBUG_H
11
12#include <linux/sunrpc/debug.h>
13
14/*
15 * Enable debugging for nfsd.
16 * Requires RPC_DEBUG.
17 */
18#ifdef RPC_DEBUG
19# define NFSD_DEBUG 1
20#endif
21
22/*
23 * knfsd debug flags
24 */
25#define NFSDDBG_SOCK 0x0001
26#define NFSDDBG_FH 0x0002
27#define NFSDDBG_EXPORT 0x0004
28#define NFSDDBG_SVC 0x0008
29#define NFSDDBG_PROC 0x0010
30#define NFSDDBG_FILEOP 0x0020
31#define NFSDDBG_AUTH 0x0040
32#define NFSDDBG_REPCACHE 0x0080
33#define NFSDDBG_XDR 0x0100
34#define NFSDDBG_LOCKD 0x0200
35#define NFSDDBG_ALL 0x7FFF
36#define NFSDDBG_NOCHANGE 0xFFFF
37
38
39
40#endif /* _UAPILINUX_NFSD_DEBUG_H */
diff --git a/include/uapi/linux/nfsd/export.h b/include/uapi/linux/nfsd/export.h
new file mode 100644
index 000000000000..cf47c313794e
--- /dev/null
+++ b/include/uapi/linux/nfsd/export.h
@@ -0,0 +1,58 @@
1/*
2 * include/linux/nfsd/export.h
3 *
4 * Public declarations for NFS exports. The definitions for the
5 * syscall interface are in nfsctl.h
6 *
7 * Copyright (C) 1995-1997 Olaf Kirch <okir@monad.swb.de>
8 */
9
10#ifndef _UAPINFSD_EXPORT_H
11#define _UAPINFSD_EXPORT_H
12
13# include <linux/types.h>
14
15/*
16 * Important limits for the exports stuff.
17 */
18#define NFSCLNT_IDMAX 1024
19#define NFSCLNT_ADDRMAX 16
20#define NFSCLNT_KEYMAX 32
21
22/*
23 * Export flags.
24 */
25#define NFSEXP_READONLY 0x0001
26#define NFSEXP_INSECURE_PORT 0x0002
27#define NFSEXP_ROOTSQUASH 0x0004
28#define NFSEXP_ALLSQUASH 0x0008
29#define NFSEXP_ASYNC 0x0010
30#define NFSEXP_GATHERED_WRITES 0x0020
31/* 40 80 100 currently unused */
32#define NFSEXP_NOHIDE 0x0200
33#define NFSEXP_NOSUBTREECHECK 0x0400
34#define NFSEXP_NOAUTHNLM 0x0800 /* Don't authenticate NLM requests - just trust */
35#define NFSEXP_MSNFS 0x1000 /* do silly things that MS clients expect; no longer supported */
36#define NFSEXP_FSID 0x2000
37#define NFSEXP_CROSSMOUNT 0x4000
38#define NFSEXP_NOACL 0x8000 /* reserved for possible ACL related use */
39/*
40 * The NFSEXP_V4ROOT flag causes the kernel to give access only to NFSv4
41 * clients, and only to the single directory that is the root of the
42 * export; further lookup and readdir operations are treated as if every
43 * subdirectory was a mountpoint, and ignored if they are not themselves
44 * exported. This is used by nfsd and mountd to construct the NFSv4
45 * pseudofilesystem, which provides access only to paths leading to each
46 * exported filesystem.
47 */
48#define NFSEXP_V4ROOT 0x10000
49/* All flags that we claim to support. (Note we don't support NOACL.) */
50#define NFSEXP_ALLFLAGS 0x17E3F
51
52/* The flags that may vary depending on security flavor: */
53#define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \
54 | NFSEXP_ALLSQUASH \
55 | NFSEXP_INSECURE_PORT)
56
57
58#endif /* _UAPINFSD_EXPORT_H */
diff --git a/include/uapi/linux/nfsd/nfsfh.h b/include/uapi/linux/nfsd/nfsfh.h
new file mode 100644
index 000000000000..616e3b396476
--- /dev/null
+++ b/include/uapi/linux/nfsd/nfsfh.h
@@ -0,0 +1,122 @@
1/*
2 * include/linux/nfsd/nfsfh.h
3 *
4 * This file describes the layout of the file handles as passed
5 * over the wire.
6 *
7 * Earlier versions of knfsd used to sign file handles using keyed MD5
8 * or SHA. I've removed this code, because it doesn't give you more
9 * security than blocking external access to port 2049 on your firewall.
10 *
11 * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de>
12 */
13
14#ifndef _UAPI_LINUX_NFSD_FH_H
15#define _UAPI_LINUX_NFSD_FH_H
16
17#include <linux/types.h>
18#include <linux/nfs.h>
19#include <linux/nfs2.h>
20#include <linux/nfs3.h>
21#include <linux/nfs4.h>
22
23/*
24 * This is the old "dentry style" Linux NFSv2 file handle.
25 *
26 * The xino and xdev fields are currently used to transport the
27 * ino/dev of the exported inode.
28 */
29struct nfs_fhbase_old {
30 __u32 fb_dcookie; /* dentry cookie - always 0xfeebbaca */
31 __u32 fb_ino; /* our inode number */
32 __u32 fb_dirino; /* dir inode number, 0 for directories */
33 __u32 fb_dev; /* our device */
34 __u32 fb_xdev;
35 __u32 fb_xino;
36 __u32 fb_generation;
37};
38
39/*
40 * This is the new flexible, extensible style NFSv2/v3 file handle.
41 * by Neil Brown <neilb@cse.unsw.edu.au> - March 2000
42 *
43 * The file handle starts with a sequence of four-byte words.
44 * The first word contains a version number (1) and three descriptor bytes
45 * that tell how the remaining 3 variable length fields should be handled.
46 * These three bytes are auth_type, fsid_type and fileid_type.
47 *
48 * All four-byte values are in host-byte-order.
49 *
50 * The auth_type field specifies how the filehandle can be authenticated
51 * This might allow a file to be confirmed to be in a writable part of a
52 * filetree without checking the path from it up to the root.
53 * Current values:
54 * 0 - No authentication. fb_auth is 0 bytes long
55 * Possible future values:
56 * 1 - 4 bytes taken from MD5 hash of the remainer of the file handle
57 * prefixed by a secret and with the important export flags.
58 *
59 * The fsid_type identifies how the filesystem (or export point) is
60 * encoded.
61 * Current values:
62 * 0 - 4 byte device id (ms-2-bytes major, ls-2-bytes minor), 4byte inode number
63 * NOTE: we cannot use the kdev_t device id value, because kdev_t.h
64 * says we mustn't. We must break it up and reassemble.
65 * 1 - 4 byte user specified identifier
66 * 2 - 4 byte major, 4 byte minor, 4 byte inode number - DEPRECATED
67 * 3 - 4 byte device id, encoded for user-space, 4 byte inode number
68 * 4 - 4 byte inode number and 4 byte uuid
69 * 5 - 8 byte uuid
70 * 6 - 16 byte uuid
71 * 7 - 8 byte inode number and 16 byte uuid
72 *
73 * The fileid_type identified how the file within the filesystem is encoded.
74 * This is (will be) passed to, and set by, the underlying filesystem if it supports
75 * filehandle operations. The filesystem must not use the value '0' or '0xff' and may
76 * only use the values 1 and 2 as defined below:
77 * Current values:
78 * 0 - The root, or export point, of the filesystem. fb_fileid is 0 bytes.
79 * 1 - 32bit inode number, 32 bit generation number.
80 * 2 - 32bit inode number, 32 bit generation number, 32 bit parent directory inode number.
81 *
82 */
83struct nfs_fhbase_new {
84 __u8 fb_version; /* == 1, even => nfs_fhbase_old */
85 __u8 fb_auth_type;
86 __u8 fb_fsid_type;
87 __u8 fb_fileid_type;
88 __u32 fb_auth[1];
89/* __u32 fb_fsid[0]; floating */
90/* __u32 fb_fileid[0]; floating */
91};
92
93struct knfsd_fh {
94 unsigned int fh_size; /* significant for NFSv3.
95 * Points to the current size while building
96 * a new file handle
97 */
98 union {
99 struct nfs_fhbase_old fh_old;
100 __u32 fh_pad[NFS4_FHSIZE/4];
101 struct nfs_fhbase_new fh_new;
102 } fh_base;
103};
104
105#define ofh_dcookie fh_base.fh_old.fb_dcookie
106#define ofh_ino fh_base.fh_old.fb_ino
107#define ofh_dirino fh_base.fh_old.fb_dirino
108#define ofh_dev fh_base.fh_old.fb_dev
109#define ofh_xdev fh_base.fh_old.fb_xdev
110#define ofh_xino fh_base.fh_old.fb_xino
111#define ofh_generation fh_base.fh_old.fb_generation
112
113#define fh_version fh_base.fh_new.fb_version
114#define fh_fsid_type fh_base.fh_new.fb_fsid_type
115#define fh_auth_type fh_base.fh_new.fb_auth_type
116#define fh_fileid_type fh_base.fh_new.fb_fileid_type
117#define fh_auth fh_base.fh_new.fb_auth
118#define fh_fsid fh_base.fh_new.fb_auth
119
120
121
122#endif /* _UAPI_LINUX_NFSD_FH_H */
diff --git a/include/uapi/linux/nfsd/stats.h b/include/uapi/linux/nfsd/stats.h
new file mode 100644
index 000000000000..9fb7a0644263
--- /dev/null
+++ b/include/uapi/linux/nfsd/stats.h
@@ -0,0 +1,17 @@
1/*
2 * linux/include/linux/nfsd/stats.h
3 *
4 * Statistics for NFS server.
5 *
6 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
7 */
8
9#ifndef _UAPILINUX_NFSD_STATS_H
10#define _UAPILINUX_NFSD_STATS_H
11
12#include <linux/nfs4.h>
13
14/* thread usage wraps very million seconds (approx one fortnight) */
15#define NFSD_USAGE_WRAP (HZ*1000000)
16
17#endif /* _UAPILINUX_NFSD_STATS_H */
diff --git a/include/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 7df9b500c804..7df9b500c804 100644
--- a/include/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
diff --git a/include/uapi/linux/nubus.h b/include/uapi/linux/nubus.h
new file mode 100644
index 000000000000..77513d2b5638
--- /dev/null
+++ b/include/uapi/linux/nubus.h
@@ -0,0 +1,244 @@
1/*
2 nubus.h: various definitions and prototypes for NuBus drivers to use.
3
4 Originally written by Alan Cox.
5
6 Hacked to death by C. Scott Ananian and David Huggins-Daines.
7
8 Some of the constants in here are from the corresponding
9 NetBSD/OpenBSD header file, by Allen Briggs. We figured out the
10 rest of them on our own. */
11
12#ifndef _UAPILINUX_NUBUS_H
13#define _UAPILINUX_NUBUS_H
14
15#include <linux/types.h>
16
17enum nubus_category {
18 NUBUS_CAT_BOARD = 0x0001,
19 NUBUS_CAT_DISPLAY = 0x0003,
20 NUBUS_CAT_NETWORK = 0x0004,
21 NUBUS_CAT_COMMUNICATIONS = 0x0006,
22 NUBUS_CAT_FONT = 0x0009,
23 NUBUS_CAT_CPU = 0x000A,
24 /* For lack of a better name */
25 NUBUS_CAT_DUODOCK = 0x0020
26};
27
28enum nubus_type_network {
29 NUBUS_TYPE_ETHERNET = 0x0001,
30 NUBUS_TYPE_RS232 = 0x0002
31};
32
33enum nubus_type_display {
34 NUBUS_TYPE_VIDEO = 0x0001
35};
36
37enum nubus_type_cpu {
38 NUBUS_TYPE_68020 = 0x0003,
39 NUBUS_TYPE_68030 = 0x0004,
40 NUBUS_TYPE_68040 = 0x0005
41};
42
43/* Known <Cat,Type,SW,HW> tuples: (according to TattleTech and Slots)
44 * 68030 motherboards: <10,4,0,24>
45 * 68040 motherboards: <10,5,0,24>
46 * DuoDock Plus: <32,1,1,2>
47 *
48 * Toby Frame Buffer card: <3,1,1,1>
49 * RBV built-in video (IIci): <3,1,1,24>
50 * Valkyrie built-in video (Q630): <3,1,1,46>
51 * Macintosh Display Card: <3,1,1,25>
52 * Sonora built-in video (P460): <3,1,1,34>
53 * Jet framebuffer (DuoDock Plus): <3,1,1,41>
54 *
55 * SONIC comm-slot/on-board and DuoDock Ethernet: <4,1,1,272>
56 * SONIC LC-PDS Ethernet (Dayna, but like Apple 16-bit, sort of): <4,1,1,271>
57 * Apple SONIC LC-PDS Ethernet ("Apple Ethernet LC Twisted-Pair Card"): <4,1,0,281>
58 * Sonic Systems Ethernet A-Series Card: <4,1,268,256>
59 * Asante MacCon NuBus-A: <4,1,260,256> (alpha-1.0,1.1 revision)
60 * ROM on the above card: <2,1,0,0>
61 * Cabletron ethernet card: <4,1,1,265>
62 * Farallon ethernet card: <4,1,268,256> (identical to Sonic Systems card)
63 * Kinetics EtherPort IIN: <4,1,259,262>
64 * API Engineering EtherRun_LCa PDS enet card: <4,1,282,256>
65 *
66 * Add your devices to the list! You can obtain the "Slots" utility
67 * from Apple's FTP site at:
68 * ftp://dev.apple.com/devworld/Tool_Chest/Devices_-_Hardware/NuBus_Slot_Manager/
69 *
70 * Alternately, TattleTech can be found at any Info-Mac mirror site.
71 * or from its distribution site: ftp://ftp.decismkr.com/dms
72 */
73
74/* DrSW: Uniquely identifies the software interface to a board. This
75 is usually the one you want to look at when writing a driver. It's
76 not as useful as you think, though, because as we should know by
77 now (duh), "Apple Compatible" can mean a lot of things... */
78
79/* Add known DrSW values here */
80enum nubus_drsw {
81 /* NUBUS_CAT_DISPLAY */
82 NUBUS_DRSW_APPLE = 0x0001,
83 NUBUS_DRSW_APPLE_HIRES = 0x0013, /* MacII HiRes card driver */
84
85 /* NUBUS_CAT_NETWORK */
86 NUBUS_DRSW_3COM = 0x0000,
87 NUBUS_DRSW_CABLETRON = 0x0001,
88 NUBUS_DRSW_SONIC_LC = 0x0001,
89 NUBUS_DRSW_KINETICS = 0x0103,
90 NUBUS_DRSW_ASANTE = 0x0104,
91 NUBUS_DRSW_TECHWORKS = 0x0109,
92 NUBUS_DRSW_DAYNA = 0x010b,
93 NUBUS_DRSW_FARALLON = 0x010c,
94 NUBUS_DRSW_APPLE_SN = 0x010f,
95 NUBUS_DRSW_DAYNA2 = 0x0115,
96 NUBUS_DRSW_FOCUS = 0x011a,
97 NUBUS_DRSW_ASANTE_CS = 0x011d, /* use asante SMC9194 driver */
98 NUBUS_DRSW_DAYNA_LC = 0x011e,
99
100 /* NUBUS_CAT_CPU */
101 NUBUS_DRSW_NONE = 0x0000,
102};
103
104/* DrHW: Uniquely identifies the hardware interface to a board (or at
105 least, it should... some video cards are known to incorrectly
106 identify themselves as Toby cards) */
107
108/* Add known DrHW values here */
109enum nubus_drhw {
110 /* NUBUS_CAT_DISPLAY */
111 NUBUS_DRHW_APPLE_TFB = 0x0001, /* Toby frame buffer card */
112 NUBUS_DRHW_APPLE_WVC = 0x0006, /* Apple Workstation Video Card */
113 NUBUS_DRHW_SIGMA_CLRMAX = 0x0007, /* Sigma Design ColorMax */
114 NUBUS_DRHW_APPLE_SE30 = 0x0009, /* Apple SE/30 video */
115 NUBUS_DRHW_APPLE_HRVC = 0x0013, /* Mac II High-Res Video Card */
116 NUBUS_DRHW_APPLE_PVC = 0x0017, /* Mac II Portrait Video Card */
117 NUBUS_DRHW_APPLE_RBV1 = 0x0018, /* IIci RBV video */
118 NUBUS_DRHW_APPLE_MDC = 0x0019, /* Macintosh Display Card */
119 NUBUS_DRHW_APPLE_SONORA = 0x0022, /* Sonora built-in video */
120 NUBUS_DRHW_APPLE_24AC = 0x002b, /* Mac 24AC Video Card */
121 NUBUS_DRHW_APPLE_VALKYRIE = 0x002e,
122 NUBUS_DRHW_APPLE_JET = 0x0029, /* Jet framebuffer (DuoDock) */
123 NUBUS_DRHW_SMAC_GFX = 0x0105, /* SuperMac GFX */
124 NUBUS_DRHW_RASTER_CB264 = 0x013B, /* RasterOps ColorBoard 264 */
125 NUBUS_DRHW_MICRON_XCEED = 0x0146, /* Micron Exceed color */
126 NUBUS_DRHW_RDIUS_GSC = 0x0153, /* Radius GS/C */
127 NUBUS_DRHW_SMAC_SPEC8 = 0x017B, /* SuperMac Spectrum/8 */
128 NUBUS_DRHW_SMAC_SPEC24 = 0x017C, /* SuperMac Spectrum/24 */
129 NUBUS_DRHW_RASTER_CB364 = 0x026F, /* RasterOps ColorBoard 364 */
130 NUBUS_DRHW_RDIUS_DCGX = 0x027C, /* Radius DirectColor/GX */
131 NUBUS_DRHW_RDIUS_PC8 = 0x0291, /* Radius PrecisionColor 8 */
132 NUBUS_DRHW_LAPIS_PCS8 = 0x0292, /* Lapis ProColorServer 8 */
133 NUBUS_DRHW_RASTER_24XLI = 0x02A0, /* RasterOps 8/24 XLi */
134 NUBUS_DRHW_RASTER_PBPGT = 0x02A5, /* RasterOps PaintBoard Prism GT */
135 NUBUS_DRHW_EMACH_FSX = 0x02AE, /* E-Machines Futura SX */
136 NUBUS_DRHW_RASTER_24XLTV = 0x02B7, /* RasterOps 24XLTV */
137 NUBUS_DRHW_SMAC_THUND24 = 0x02CB, /* SuperMac Thunder/24 */
138 NUBUS_DRHW_SMAC_THUNDLGHT = 0x03D9, /* SuperMac ThunderLight */
139 NUBUS_DRHW_RDIUS_PC24XP = 0x0406, /* Radius PrecisionColor 24Xp */
140 NUBUS_DRHW_RDIUS_PC24X = 0x040A, /* Radius PrecisionColor 24X */
141 NUBUS_DRHW_RDIUS_PC8XJ = 0x040B, /* Radius PrecisionColor 8XJ */
142
143 /* NUBUS_CAT_NETWORK */
144 NUBUS_DRHW_INTERLAN = 0x0100,
145 NUBUS_DRHW_SMC9194 = 0x0101,
146 NUBUS_DRHW_KINETICS = 0x0106,
147 NUBUS_DRHW_CABLETRON = 0x0109,
148 NUBUS_DRHW_ASANTE_LC = 0x010f,
149 NUBUS_DRHW_SONIC = 0x0110,
150 NUBUS_DRHW_TECHWORKS = 0x0112,
151 NUBUS_DRHW_APPLE_SONIC_NB = 0x0118,
152 NUBUS_DRHW_APPLE_SONIC_LC = 0x0119,
153 NUBUS_DRHW_FOCUS = 0x011c,
154 NUBUS_DRHW_SONNET = 0x011d,
155};
156
157/* Resource IDs: These are the identifiers for the various weird and
158 wonderful tidbits of information that may or may not reside in the
159 NuBus ROM directory. */
160enum nubus_res_id {
161 NUBUS_RESID_TYPE = 0x0001,
162 NUBUS_RESID_NAME = 0x0002,
163 NUBUS_RESID_ICON = 0x0003,
164 NUBUS_RESID_DRVRDIR = 0x0004,
165 NUBUS_RESID_LOADREC = 0x0005,
166 NUBUS_RESID_BOOTREC = 0x0006,
167 NUBUS_RESID_FLAGS = 0x0007,
168 NUBUS_RESID_HWDEVID = 0x0008,
169 NUBUS_RESID_MINOR_BASEOS = 0x000a,
170 NUBUS_RESID_MINOR_LENGTH = 0x000b,
171 NUBUS_RESID_MAJOR_BASEOS = 0x000c,
172 NUBUS_RESID_MAJOR_LENGTH = 0x000d,
173 NUBUS_RESID_CICN = 0x000f,
174 NUBUS_RESID_ICL8 = 0x0010,
175 NUBUS_RESID_ICL4 = 0x0011,
176};
177
178/* Category-specific resources. */
179enum nubus_board_res_id {
180 NUBUS_RESID_BOARDID = 0x0020,
181 NUBUS_RESID_PRAMINITDATA = 0x0021,
182 NUBUS_RESID_PRIMARYINIT = 0x0022,
183 NUBUS_RESID_TIMEOUTCONST = 0x0023,
184 NUBUS_RESID_VENDORINFO = 0x0024,
185 NUBUS_RESID_BOARDFLAGS = 0x0025,
186 NUBUS_RESID_SECONDINIT = 0x0026,
187
188 /* Not sure why Apple put these next two in here */
189 NUBUS_RESID_VIDNAMES = 0x0041,
190 NUBUS_RESID_VIDMODES = 0x007e
191};
192
193/* Fields within the vendor info directory */
194enum nubus_vendor_res_id {
195 NUBUS_RESID_VEND_ID = 0x0001,
196 NUBUS_RESID_VEND_SERIAL = 0x0002,
197 NUBUS_RESID_VEND_REV = 0x0003,
198 NUBUS_RESID_VEND_PART = 0x0004,
199 NUBUS_RESID_VEND_DATE = 0x0005
200};
201
202enum nubus_net_res_id {
203 NUBUS_RESID_MAC_ADDRESS = 0x0080
204};
205
206enum nubus_cpu_res_id {
207 NUBUS_RESID_MEMINFO = 0x0081,
208 NUBUS_RESID_ROMINFO = 0x0082
209};
210
211enum nubus_display_res_id {
212 NUBUS_RESID_GAMMADIR = 0x0040,
213 NUBUS_RESID_FIRSTMODE = 0x0080,
214 NUBUS_RESID_SECONDMODE = 0x0081,
215 NUBUS_RESID_THIRDMODE = 0x0082,
216 NUBUS_RESID_FOURTHMODE = 0x0083,
217 NUBUS_RESID_FIFTHMODE = 0x0084,
218 NUBUS_RESID_SIXTHMODE = 0x0085
219};
220
221struct nubus_dir
222{
223 unsigned char *base;
224 unsigned char *ptr;
225 int done;
226 int mask;
227};
228
229struct nubus_dirent
230{
231 unsigned char *base;
232 unsigned char type;
233 __u32 data; /* Actually 24bits used */
234 int mask;
235};
236
237
238/* We'd like to get rid of this eventually. Only daynaport.c uses it now. */
239static inline void *nubus_slot_addr(int slot)
240{
241 return (void *)(0xF0000000|(slot<<24));
242}
243
244#endif /* _UAPILINUX_NUBUS_H */
diff --git a/include/uapi/linux/nvram.h b/include/uapi/linux/nvram.h
new file mode 100644
index 000000000000..0986c4337383
--- /dev/null
+++ b/include/uapi/linux/nvram.h
@@ -0,0 +1,16 @@
1#ifndef _UAPI_LINUX_NVRAM_H
2#define _UAPI_LINUX_NVRAM_H
3
4#include <linux/ioctl.h>
5
6/* /dev/nvram ioctls */
7#define NVRAM_INIT _IO('p', 0x40) /* initialize NVRAM and set checksum */
8#define NVRAM_SETCKS _IO('p', 0x41) /* recalculate checksum */
9
10/* for all current systems, this is where NVRAM starts */
11#define NVRAM_FIRST_BYTE 14
12/* all these functions expect an NVRAM offset, not an absolute */
13#define NVRAM_OFFSET(x) ((x)-NVRAM_FIRST_BYTE)
14
15
16#endif /* _UAPI_LINUX_NVRAM_H */
diff --git a/include/linux/omap3isp.h b/include/uapi/linux/omap3isp.h
index c73a34c3434d..c090cf9249bb 100644
--- a/include/linux/omap3isp.h
+++ b/include/uapi/linux/omap3isp.h
@@ -28,6 +28,7 @@
28#define OMAP3_ISP_USER_H 28#define OMAP3_ISP_USER_H
29 29
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/videodev2.h>
31 32
32/* 33/*
33 * Private IOCTLs 34 * Private IOCTLs
@@ -427,7 +428,7 @@ struct omap3isp_ccdc_update_config {
427#define OMAP3ISP_PREV_COLOR_CONV (1 << 8) 428#define OMAP3ISP_PREV_COLOR_CONV (1 << 8)
428#define OMAP3ISP_PREV_YC_LIMIT (1 << 9) 429#define OMAP3ISP_PREV_YC_LIMIT (1 << 9)
429#define OMAP3ISP_PREV_DEFECT_COR (1 << 10) 430#define OMAP3ISP_PREV_DEFECT_COR (1 << 10)
430#define OMAP3ISP_PREV_GAMMABYPASS (1 << 11) 431/* Bit 11 was OMAP3ISP_PREV_GAMMABYPASS, now merged with OMAP3ISP_PREV_GAMMA */
431#define OMAP3ISP_PREV_DRK_FRM_CAPTURE (1 << 12) 432#define OMAP3ISP_PREV_DRK_FRM_CAPTURE (1 << 12)
432#define OMAP3ISP_PREV_DRK_FRM_SUBTRACT (1 << 13) 433#define OMAP3ISP_PREV_DRK_FRM_SUBTRACT (1 << 13)
433#define OMAP3ISP_PREV_LENS_SHADING (1 << 14) 434#define OMAP3ISP_PREV_LENS_SHADING (1 << 14)
@@ -436,6 +437,7 @@ struct omap3isp_ccdc_update_config {
436 437
437#define OMAP3ISP_PREV_NF_TBL_SIZE 64 438#define OMAP3ISP_PREV_NF_TBL_SIZE 64
438#define OMAP3ISP_PREV_CFA_TBL_SIZE 576 439#define OMAP3ISP_PREV_CFA_TBL_SIZE 576
440#define OMAP3ISP_PREV_CFA_BLK_SIZE (OMAP3ISP_PREV_CFA_TBL_SIZE / 4)
439#define OMAP3ISP_PREV_GAMMA_TBL_SIZE 1024 441#define OMAP3ISP_PREV_GAMMA_TBL_SIZE 1024
440#define OMAP3ISP_PREV_YENH_TBL_SIZE 128 442#define OMAP3ISP_PREV_YENH_TBL_SIZE 128
441 443
@@ -477,7 +479,7 @@ struct omap3isp_prev_cfa {
477 enum omap3isp_cfa_fmt format; 479 enum omap3isp_cfa_fmt format;
478 __u8 gradthrs_vert; 480 __u8 gradthrs_vert;
479 __u8 gradthrs_horz; 481 __u8 gradthrs_horz;
480 __u32 table[OMAP3ISP_PREV_CFA_TBL_SIZE]; 482 __u32 table[4][OMAP3ISP_PREV_CFA_BLK_SIZE];
481}; 483};
482 484
483/** 485/**
diff --git a/include/uapi/linux/omapfb.h b/include/uapi/linux/omapfb.h
new file mode 100644
index 000000000000..7c97bc00ac6d
--- /dev/null
+++ b/include/uapi/linux/omapfb.h
@@ -0,0 +1,222 @@
1/*
2 * File: include/linux/omapfb.h
3 *
4 * Framebuffer driver for TI OMAP boards
5 *
6 * Copyright (C) 2004 Nokia Corporation
7 * Author: Imre Deak <imre.deak@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24#ifndef _UAPI__LINUX_OMAPFB_H__
25#define _UAPI__LINUX_OMAPFB_H__
26
27#include <linux/fb.h>
28#include <linux/ioctl.h>
29#include <linux/types.h>
30
31/* IOCTL commands. */
32
33#define OMAP_IOW(num, dtype) _IOW('O', num, dtype)
34#define OMAP_IOR(num, dtype) _IOR('O', num, dtype)
35#define OMAP_IOWR(num, dtype) _IOWR('O', num, dtype)
36#define OMAP_IO(num) _IO('O', num)
37
38#define OMAPFB_MIRROR OMAP_IOW(31, int)
39#define OMAPFB_SYNC_GFX OMAP_IO(37)
40#define OMAPFB_VSYNC OMAP_IO(38)
41#define OMAPFB_SET_UPDATE_MODE OMAP_IOW(40, int)
42#define OMAPFB_GET_CAPS OMAP_IOR(42, struct omapfb_caps)
43#define OMAPFB_GET_UPDATE_MODE OMAP_IOW(43, int)
44#define OMAPFB_LCD_TEST OMAP_IOW(45, int)
45#define OMAPFB_CTRL_TEST OMAP_IOW(46, int)
46#define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(47, struct omapfb_update_window_old)
47#define OMAPFB_SET_COLOR_KEY OMAP_IOW(50, struct omapfb_color_key)
48#define OMAPFB_GET_COLOR_KEY OMAP_IOW(51, struct omapfb_color_key)
49#define OMAPFB_SETUP_PLANE OMAP_IOW(52, struct omapfb_plane_info)
50#define OMAPFB_QUERY_PLANE OMAP_IOW(53, struct omapfb_plane_info)
51#define OMAPFB_UPDATE_WINDOW OMAP_IOW(54, struct omapfb_update_window)
52#define OMAPFB_SETUP_MEM OMAP_IOW(55, struct omapfb_mem_info)
53#define OMAPFB_QUERY_MEM OMAP_IOW(56, struct omapfb_mem_info)
54#define OMAPFB_WAITFORVSYNC OMAP_IO(57)
55#define OMAPFB_MEMORY_READ OMAP_IOR(58, struct omapfb_memory_read)
56#define OMAPFB_GET_OVERLAY_COLORMODE OMAP_IOR(59, struct omapfb_ovl_colormode)
57#define OMAPFB_WAITFORGO OMAP_IO(60)
58#define OMAPFB_GET_VRAM_INFO OMAP_IOR(61, struct omapfb_vram_info)
59#define OMAPFB_SET_TEARSYNC OMAP_IOW(62, struct omapfb_tearsync_info)
60#define OMAPFB_GET_DISPLAY_INFO OMAP_IOR(63, struct omapfb_display_info)
61
62#define OMAPFB_CAPS_GENERIC_MASK 0x00000fff
63#define OMAPFB_CAPS_LCDC_MASK 0x00fff000
64#define OMAPFB_CAPS_PANEL_MASK 0xff000000
65
66#define OMAPFB_CAPS_MANUAL_UPDATE 0x00001000
67#define OMAPFB_CAPS_TEARSYNC 0x00002000
68#define OMAPFB_CAPS_PLANE_RELOCATE_MEM 0x00004000
69#define OMAPFB_CAPS_PLANE_SCALE 0x00008000
70#define OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE 0x00010000
71#define OMAPFB_CAPS_WINDOW_SCALE 0x00020000
72#define OMAPFB_CAPS_WINDOW_OVERLAY 0x00040000
73#define OMAPFB_CAPS_WINDOW_ROTATE 0x00080000
74#define OMAPFB_CAPS_SET_BACKLIGHT 0x01000000
75
76/* Values from DSP must map to lower 16-bits */
77#define OMAPFB_FORMAT_MASK 0x00ff
78#define OMAPFB_FORMAT_FLAG_DOUBLE 0x0100
79#define OMAPFB_FORMAT_FLAG_TEARSYNC 0x0200
80#define OMAPFB_FORMAT_FLAG_FORCE_VSYNC 0x0400
81#define OMAPFB_FORMAT_FLAG_ENABLE_OVERLAY 0x0800
82#define OMAPFB_FORMAT_FLAG_DISABLE_OVERLAY 0x1000
83
84#define OMAPFB_MEMTYPE_SDRAM 0
85#define OMAPFB_MEMTYPE_SRAM 1
86#define OMAPFB_MEMTYPE_MAX 1
87
88#define OMAPFB_MEM_IDX_ENABLED 0x80
89#define OMAPFB_MEM_IDX_MASK 0x7f
90
91enum omapfb_color_format {
92 OMAPFB_COLOR_RGB565 = 0,
93 OMAPFB_COLOR_YUV422,
94 OMAPFB_COLOR_YUV420,
95 OMAPFB_COLOR_CLUT_8BPP,
96 OMAPFB_COLOR_CLUT_4BPP,
97 OMAPFB_COLOR_CLUT_2BPP,
98 OMAPFB_COLOR_CLUT_1BPP,
99 OMAPFB_COLOR_RGB444,
100 OMAPFB_COLOR_YUY422,
101
102 OMAPFB_COLOR_ARGB16,
103 OMAPFB_COLOR_RGB24U, /* RGB24, 32-bit container */
104 OMAPFB_COLOR_RGB24P, /* RGB24, 24-bit container */
105 OMAPFB_COLOR_ARGB32,
106 OMAPFB_COLOR_RGBA32,
107 OMAPFB_COLOR_RGBX32,
108};
109
110struct omapfb_update_window {
111 __u32 x, y;
112 __u32 width, height;
113 __u32 format;
114 __u32 out_x, out_y;
115 __u32 out_width, out_height;
116 __u32 reserved[8];
117};
118
119struct omapfb_update_window_old {
120 __u32 x, y;
121 __u32 width, height;
122 __u32 format;
123};
124
125enum omapfb_plane {
126 OMAPFB_PLANE_GFX = 0,
127 OMAPFB_PLANE_VID1,
128 OMAPFB_PLANE_VID2,
129};
130
131enum omapfb_channel_out {
132 OMAPFB_CHANNEL_OUT_LCD = 0,
133 OMAPFB_CHANNEL_OUT_DIGIT,
134};
135
136struct omapfb_plane_info {
137 __u32 pos_x;
138 __u32 pos_y;
139 __u8 enabled;
140 __u8 channel_out;
141 __u8 mirror;
142 __u8 mem_idx;
143 __u32 out_width;
144 __u32 out_height;
145 __u32 reserved2[12];
146};
147
148struct omapfb_mem_info {
149 __u32 size;
150 __u8 type;
151 __u8 reserved[3];
152};
153
154struct omapfb_caps {
155 __u32 ctrl;
156 __u32 plane_color;
157 __u32 wnd_color;
158};
159
160enum omapfb_color_key_type {
161 OMAPFB_COLOR_KEY_DISABLED = 0,
162 OMAPFB_COLOR_KEY_GFX_DST,
163 OMAPFB_COLOR_KEY_VID_SRC,
164};
165
166struct omapfb_color_key {
167 __u8 channel_out;
168 __u32 background;
169 __u32 trans_key;
170 __u8 key_type;
171};
172
173enum omapfb_update_mode {
174 OMAPFB_UPDATE_DISABLED = 0,
175 OMAPFB_AUTO_UPDATE,
176 OMAPFB_MANUAL_UPDATE
177};
178
179struct omapfb_memory_read {
180 __u16 x;
181 __u16 y;
182 __u16 w;
183 __u16 h;
184 size_t buffer_size;
185 void __user *buffer;
186};
187
188struct omapfb_ovl_colormode {
189 __u8 overlay_idx;
190 __u8 mode_idx;
191 __u32 bits_per_pixel;
192 __u32 nonstd;
193 struct fb_bitfield red;
194 struct fb_bitfield green;
195 struct fb_bitfield blue;
196 struct fb_bitfield transp;
197};
198
199struct omapfb_vram_info {
200 __u32 total;
201 __u32 free;
202 __u32 largest_free_block;
203 __u32 reserved[5];
204};
205
206struct omapfb_tearsync_info {
207 __u8 enabled;
208 __u8 reserved1[3];
209 __u16 line;
210 __u16 reserved2;
211};
212
213struct omapfb_display_info {
214 __u16 xres;
215 __u16 yres;
216 __u32 width; /* phys width of the display in micrometers */
217 __u32 height; /* phys height of the display in micrometers */
218 __u32 reserved[5];
219};
220
221
222#endif /* _UAPI__LINUX_OMAPFB_H__ */
diff --git a/include/uapi/linux/oom.h b/include/uapi/linux/oom.h
new file mode 100644
index 000000000000..a49c4afc7060
--- /dev/null
+++ b/include/uapi/linux/oom.h
@@ -0,0 +1,11 @@
1#ifndef _UAPI__INCLUDE_LINUX_OOM_H
2#define _UAPI__INCLUDE_LINUX_OOM_H
3
4/*
5 * /proc/<pid>/oom_score_adj set to OOM_SCORE_ADJ_MIN disables oom killing for
6 * pid.
7 */
8#define OOM_SCORE_ADJ_MIN (-1000)
9#define OOM_SCORE_ADJ_MAX 1000
10
11#endif /* _UAPI__INCLUDE_LINUX_OOM_H */
diff --git a/include/linux/packet_diag.h b/include/uapi/linux/packet_diag.h
index 93f5fa94a431..93f5fa94a431 100644
--- a/include/linux/packet_diag.h
+++ b/include/uapi/linux/packet_diag.h
diff --git a/include/linux/param.h b/include/uapi/linux/param.h
index 092e92f67b50..092e92f67b50 100644
--- a/include/linux/param.h
+++ b/include/uapi/linux/param.h
diff --git a/include/uapi/linux/parport.h b/include/uapi/linux/parport.h
new file mode 100644
index 000000000000..f41388f88dc3
--- /dev/null
+++ b/include/uapi/linux/parport.h
@@ -0,0 +1,95 @@
1/*
2 * Any part of this program may be used in documents licensed under
3 * the GNU Free Documentation License, Version 1.1 or any later version
4 * published by the Free Software Foundation.
5 */
6
7#ifndef _UAPI_PARPORT_H_
8#define _UAPI_PARPORT_H_
9
10/* Start off with user-visible constants */
11
12/* Maximum of 16 ports per machine */
13#define PARPORT_MAX 16
14
15/* Magic numbers */
16#define PARPORT_IRQ_NONE -1
17#define PARPORT_DMA_NONE -1
18#define PARPORT_IRQ_AUTO -2
19#define PARPORT_DMA_AUTO -2
20#define PARPORT_DMA_NOFIFO -3
21#define PARPORT_DISABLE -2
22#define PARPORT_IRQ_PROBEONLY -3
23#define PARPORT_IOHI_AUTO -1
24
25#define PARPORT_CONTROL_STROBE 0x1
26#define PARPORT_CONTROL_AUTOFD 0x2
27#define PARPORT_CONTROL_INIT 0x4
28#define PARPORT_CONTROL_SELECT 0x8
29
30#define PARPORT_STATUS_ERROR 0x8
31#define PARPORT_STATUS_SELECT 0x10
32#define PARPORT_STATUS_PAPEROUT 0x20
33#define PARPORT_STATUS_ACK 0x40
34#define PARPORT_STATUS_BUSY 0x80
35
36/* Type classes for Plug-and-Play probe. */
37typedef enum {
38 PARPORT_CLASS_LEGACY = 0, /* Non-IEEE1284 device */
39 PARPORT_CLASS_PRINTER,
40 PARPORT_CLASS_MODEM,
41 PARPORT_CLASS_NET,
42 PARPORT_CLASS_HDC, /* Hard disk controller */
43 PARPORT_CLASS_PCMCIA,
44 PARPORT_CLASS_MEDIA, /* Multimedia device */
45 PARPORT_CLASS_FDC, /* Floppy disk controller */
46 PARPORT_CLASS_PORTS,
47 PARPORT_CLASS_SCANNER,
48 PARPORT_CLASS_DIGCAM,
49 PARPORT_CLASS_OTHER, /* Anything else */
50 PARPORT_CLASS_UNSPEC, /* No CLS field in ID */
51 PARPORT_CLASS_SCSIADAPTER
52} parport_device_class;
53
54/* The "modes" entry in parport is a bit field representing the
55 capabilities of the hardware. */
56#define PARPORT_MODE_PCSPP (1<<0) /* IBM PC registers available. */
57#define PARPORT_MODE_TRISTATE (1<<1) /* Can tristate. */
58#define PARPORT_MODE_EPP (1<<2) /* Hardware EPP. */
59#define PARPORT_MODE_ECP (1<<3) /* Hardware ECP. */
60#define PARPORT_MODE_COMPAT (1<<4) /* Hardware 'printer protocol'. */
61#define PARPORT_MODE_DMA (1<<5) /* Hardware can DMA. */
62#define PARPORT_MODE_SAFEININT (1<<6) /* SPP registers accessible in IRQ. */
63
64/* IEEE1284 modes:
65 Nibble mode, byte mode, ECP, ECPRLE and EPP are their own
66 'extensibility request' values. Others are special.
67 'Real' ECP modes must have the IEEE1284_MODE_ECP bit set. */
68#define IEEE1284_MODE_NIBBLE 0
69#define IEEE1284_MODE_BYTE (1<<0)
70#define IEEE1284_MODE_COMPAT (1<<8)
71#define IEEE1284_MODE_BECP (1<<9) /* Bounded ECP mode */
72#define IEEE1284_MODE_ECP (1<<4)
73#define IEEE1284_MODE_ECPRLE (IEEE1284_MODE_ECP | (1<<5))
74#define IEEE1284_MODE_ECPSWE (1<<10) /* Software-emulated */
75#define IEEE1284_MODE_EPP (1<<6)
76#define IEEE1284_MODE_EPPSL (1<<11) /* EPP 1.7 */
77#define IEEE1284_MODE_EPPSWE (1<<12) /* Software-emulated */
78#define IEEE1284_DEVICEID (1<<2) /* This is a flag */
79#define IEEE1284_EXT_LINK (1<<14) /* This flag causes the
80 * extensibility link to
81 * be requested, using
82 * bits 0-6. */
83
84/* For the benefit of parport_read/write, you can use these with
85 * parport_negotiate to use address operations. They have no effect
86 * other than to make parport_read/write use address transfers. */
87#define IEEE1284_ADDR (1<<13) /* This is a flag */
88#define IEEE1284_DATA 0 /* So is this */
89
90/* Flags for block transfer operations. */
91#define PARPORT_EPP_FAST (1<<0) /* Unreliable counts. */
92#define PARPORT_W91284PIC (1<<1) /* have a Warp9 w91284pic in the device */
93
94/* The rest is for the kernel only */
95#endif /* _UAPI_PARPORT_H_ */
diff --git a/include/uapi/linux/patchkey.h b/include/uapi/linux/patchkey.h
new file mode 100644
index 000000000000..1bda0e56bc5e
--- /dev/null
+++ b/include/uapi/linux/patchkey.h
@@ -0,0 +1,37 @@
1/*
2 * <linux/patchkey.h> -- definition of _PATCHKEY macro
3 *
4 * Copyright (C) 2005 Stuart Brady
5 *
6 * This exists because awe_voice.h defined its own _PATCHKEY and it wasn't
7 * clear whether removing this would break anything in userspace.
8 *
9 * Do not include this file directly. Please use <sys/soundcard.h> instead.
10 * For kernel code, use <linux/soundcard.h>
11 */
12
13#ifndef _LINUX_PATCHKEY_H_INDIRECT
14#error "patchkey.h included directly"
15#endif
16
17#ifndef _UAPI_LINUX_PATCHKEY_H
18#define _UAPI_LINUX_PATCHKEY_H
19
20/* Endian macros. */
21#ifndef __KERNEL__
22# include <endian.h>
23#endif
24
25#if !defined(__KERNEL__)
26#if defined(__BYTE_ORDER)
27# if __BYTE_ORDER == __BIG_ENDIAN
28# define _PATCHKEY(id) (0xfd00|id)
29# elif __BYTE_ORDER == __LITTLE_ENDIAN
30# define _PATCHKEY(id) ((id<<8)|0x00fd)
31# else
32# error "could not determine byte order"
33# endif
34#endif
35#endif
36
37#endif /* _UAPI_LINUX_PATCHKEY_H */
diff --git a/include/uapi/linux/pci.h b/include/uapi/linux/pci.h
new file mode 100644
index 000000000000..3c292bc0d1c1
--- /dev/null
+++ b/include/uapi/linux/pci.h
@@ -0,0 +1,41 @@
1/*
2 * pci.h
3 *
4 * PCI defines and function prototypes
5 * Copyright 1994, Drew Eckhardt
6 * Copyright 1997--1999 Martin Mares <mj@ucw.cz>
7 *
8 * For more information, please consult the following manuals (look at
9 * http://www.pcisig.com/ for how to get them):
10 *
11 * PCI BIOS Specification
12 * PCI Local Bus Specification
13 * PCI to PCI Bridge Specification
14 * PCI System Design Guide
15 */
16
17#ifndef _UAPILINUX_PCI_H
18#define _UAPILINUX_PCI_H
19
20#include <linux/pci_regs.h> /* The pci register defines */
21
22/*
23 * The PCI interface treats multi-function devices as independent
24 * devices. The slot/function address of each device is encoded
25 * in a single byte as follows:
26 *
27 * 7:3 = slot
28 * 2:0 = function
29 */
30#define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07))
31#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
32#define PCI_FUNC(devfn) ((devfn) & 0x07)
33
34/* Ioctls for /proc/bus/pci/X/Y nodes. */
35#define PCIIOC_BASE ('P' << 24 | 'C' << 16 | 'I' << 8)
36#define PCIIOC_CONTROLLER (PCIIOC_BASE | 0x00) /* Get controller for PCI device. */
37#define PCIIOC_MMAP_IS_IO (PCIIOC_BASE | 0x01) /* Set mmap state to I/O space. */
38#define PCIIOC_MMAP_IS_MEM (PCIIOC_BASE | 0x02) /* Set mmap state to MEM space. */
39#define PCIIOC_WRITE_COMBINE (PCIIOC_BASE | 0x03) /* Enable/disable write-combining. */
40
41#endif /* _UAPILINUX_PCI_H */
diff --git a/include/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index 20ae747ddf34..20ae747ddf34 100644
--- a/include/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
new file mode 100644
index 000000000000..4f63c05d27c9
--- /dev/null
+++ b/include/uapi/linux/perf_event.h
@@ -0,0 +1,615 @@
1/*
2 * Performance events:
3 *
4 * Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de>
5 * Copyright (C) 2008-2011, Red Hat, Inc., Ingo Molnar
6 * Copyright (C) 2008-2011, 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 _UAPI_LINUX_PERF_EVENT_H
15#define _UAPI_LINUX_PERF_EVENT_H
16
17#include <linux/types.h>
18#include <linux/ioctl.h>
19#include <asm/byteorder.h>
20
21/*
22 * User-space ABI bits:
23 */
24
25/*
26 * attr.type
27 */
28enum perf_type_id {
29 PERF_TYPE_HARDWARE = 0,
30 PERF_TYPE_SOFTWARE = 1,
31 PERF_TYPE_TRACEPOINT = 2,
32 PERF_TYPE_HW_CACHE = 3,
33 PERF_TYPE_RAW = 4,
34 PERF_TYPE_BREAKPOINT = 5,
35
36 PERF_TYPE_MAX, /* non-ABI */
37};
38
39/*
40 * Generalized performance event event_id types, used by the
41 * attr.event_id parameter of the sys_perf_event_open()
42 * syscall:
43 */
44enum perf_hw_id {
45 /*
46 * Common hardware events, generalized by the kernel:
47 */
48 PERF_COUNT_HW_CPU_CYCLES = 0,
49 PERF_COUNT_HW_INSTRUCTIONS = 1,
50 PERF_COUNT_HW_CACHE_REFERENCES = 2,
51 PERF_COUNT_HW_CACHE_MISSES = 3,
52 PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4,
53 PERF_COUNT_HW_BRANCH_MISSES = 5,
54 PERF_COUNT_HW_BUS_CYCLES = 6,
55 PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7,
56 PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8,
57 PERF_COUNT_HW_REF_CPU_CYCLES = 9,
58
59 PERF_COUNT_HW_MAX, /* non-ABI */
60};
61
62/*
63 * Generalized hardware cache events:
64 *
65 * { L1-D, L1-I, LLC, ITLB, DTLB, BPU, NODE } x
66 * { read, write, prefetch } x
67 * { accesses, misses }
68 */
69enum perf_hw_cache_id {
70 PERF_COUNT_HW_CACHE_L1D = 0,
71 PERF_COUNT_HW_CACHE_L1I = 1,
72 PERF_COUNT_HW_CACHE_LL = 2,
73 PERF_COUNT_HW_CACHE_DTLB = 3,
74 PERF_COUNT_HW_CACHE_ITLB = 4,
75 PERF_COUNT_HW_CACHE_BPU = 5,
76 PERF_COUNT_HW_CACHE_NODE = 6,
77
78 PERF_COUNT_HW_CACHE_MAX, /* non-ABI */
79};
80
81enum perf_hw_cache_op_id {
82 PERF_COUNT_HW_CACHE_OP_READ = 0,
83 PERF_COUNT_HW_CACHE_OP_WRITE = 1,
84 PERF_COUNT_HW_CACHE_OP_PREFETCH = 2,
85
86 PERF_COUNT_HW_CACHE_OP_MAX, /* non-ABI */
87};
88
89enum perf_hw_cache_op_result_id {
90 PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0,
91 PERF_COUNT_HW_CACHE_RESULT_MISS = 1,
92
93 PERF_COUNT_HW_CACHE_RESULT_MAX, /* non-ABI */
94};
95
96/*
97 * Special "software" events provided by the kernel, even if the hardware
98 * does not support performance events. These events measure various
99 * physical and sw events of the kernel (and allow the profiling of them as
100 * well):
101 */
102enum perf_sw_ids {
103 PERF_COUNT_SW_CPU_CLOCK = 0,
104 PERF_COUNT_SW_TASK_CLOCK = 1,
105 PERF_COUNT_SW_PAGE_FAULTS = 2,
106 PERF_COUNT_SW_CONTEXT_SWITCHES = 3,
107 PERF_COUNT_SW_CPU_MIGRATIONS = 4,
108 PERF_COUNT_SW_PAGE_FAULTS_MIN = 5,
109 PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6,
110 PERF_COUNT_SW_ALIGNMENT_FAULTS = 7,
111 PERF_COUNT_SW_EMULATION_FAULTS = 8,
112
113 PERF_COUNT_SW_MAX, /* non-ABI */
114};
115
116/*
117 * Bits that can be set in attr.sample_type to request information
118 * in the overflow packets.
119 */
120enum perf_event_sample_format {
121 PERF_SAMPLE_IP = 1U << 0,
122 PERF_SAMPLE_TID = 1U << 1,
123 PERF_SAMPLE_TIME = 1U << 2,
124 PERF_SAMPLE_ADDR = 1U << 3,
125 PERF_SAMPLE_READ = 1U << 4,
126 PERF_SAMPLE_CALLCHAIN = 1U << 5,
127 PERF_SAMPLE_ID = 1U << 6,
128 PERF_SAMPLE_CPU = 1U << 7,
129 PERF_SAMPLE_PERIOD = 1U << 8,
130 PERF_SAMPLE_STREAM_ID = 1U << 9,
131 PERF_SAMPLE_RAW = 1U << 10,
132 PERF_SAMPLE_BRANCH_STACK = 1U << 11,
133 PERF_SAMPLE_REGS_USER = 1U << 12,
134 PERF_SAMPLE_STACK_USER = 1U << 13,
135
136 PERF_SAMPLE_MAX = 1U << 14, /* non-ABI */
137};
138
139/*
140 * values to program into branch_sample_type when PERF_SAMPLE_BRANCH is set
141 *
142 * If the user does not pass priv level information via branch_sample_type,
143 * the kernel uses the event's priv level. Branch and event priv levels do
144 * not have to match. Branch priv level is checked for permissions.
145 *
146 * The branch types can be combined, however BRANCH_ANY covers all types
147 * of branches and therefore it supersedes all the other types.
148 */
149enum perf_branch_sample_type {
150 PERF_SAMPLE_BRANCH_USER = 1U << 0, /* user branches */
151 PERF_SAMPLE_BRANCH_KERNEL = 1U << 1, /* kernel branches */
152 PERF_SAMPLE_BRANCH_HV = 1U << 2, /* hypervisor branches */
153
154 PERF_SAMPLE_BRANCH_ANY = 1U << 3, /* any branch types */
155 PERF_SAMPLE_BRANCH_ANY_CALL = 1U << 4, /* any call branch */
156 PERF_SAMPLE_BRANCH_ANY_RETURN = 1U << 5, /* any return branch */
157 PERF_SAMPLE_BRANCH_IND_CALL = 1U << 6, /* indirect calls */
158
159 PERF_SAMPLE_BRANCH_MAX = 1U << 7, /* non-ABI */
160};
161
162#define PERF_SAMPLE_BRANCH_PLM_ALL \
163 (PERF_SAMPLE_BRANCH_USER|\
164 PERF_SAMPLE_BRANCH_KERNEL|\
165 PERF_SAMPLE_BRANCH_HV)
166
167/*
168 * Values to determine ABI of the registers dump.
169 */
170enum perf_sample_regs_abi {
171 PERF_SAMPLE_REGS_ABI_NONE = 0,
172 PERF_SAMPLE_REGS_ABI_32 = 1,
173 PERF_SAMPLE_REGS_ABI_64 = 2,
174};
175
176/*
177 * The format of the data returned by read() on a perf event fd,
178 * as specified by attr.read_format:
179 *
180 * struct read_format {
181 * { u64 value;
182 * { u64 time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED
183 * { u64 time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING
184 * { u64 id; } && PERF_FORMAT_ID
185 * } && !PERF_FORMAT_GROUP
186 *
187 * { u64 nr;
188 * { u64 time_enabled; } && PERF_FORMAT_TOTAL_TIME_ENABLED
189 * { u64 time_running; } && PERF_FORMAT_TOTAL_TIME_RUNNING
190 * { u64 value;
191 * { u64 id; } && PERF_FORMAT_ID
192 * } cntr[nr];
193 * } && PERF_FORMAT_GROUP
194 * };
195 */
196enum perf_event_read_format {
197 PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0,
198 PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1,
199 PERF_FORMAT_ID = 1U << 2,
200 PERF_FORMAT_GROUP = 1U << 3,
201
202 PERF_FORMAT_MAX = 1U << 4, /* non-ABI */
203};
204
205#define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */
206#define PERF_ATTR_SIZE_VER1 72 /* add: config2 */
207#define PERF_ATTR_SIZE_VER2 80 /* add: branch_sample_type */
208#define PERF_ATTR_SIZE_VER3 96 /* add: sample_regs_user */
209 /* add: sample_stack_user */
210
211/*
212 * Hardware event_id to monitor via a performance monitoring event:
213 */
214struct perf_event_attr {
215
216 /*
217 * Major type: hardware/software/tracepoint/etc.
218 */
219 __u32 type;
220
221 /*
222 * Size of the attr structure, for fwd/bwd compat.
223 */
224 __u32 size;
225
226 /*
227 * Type specific configuration information.
228 */
229 __u64 config;
230
231 union {
232 __u64 sample_period;
233 __u64 sample_freq;
234 };
235
236 __u64 sample_type;
237 __u64 read_format;
238
239 __u64 disabled : 1, /* off by default */
240 inherit : 1, /* children inherit it */
241 pinned : 1, /* must always be on PMU */
242 exclusive : 1, /* only group on PMU */
243 exclude_user : 1, /* don't count user */
244 exclude_kernel : 1, /* ditto kernel */
245 exclude_hv : 1, /* ditto hypervisor */
246 exclude_idle : 1, /* don't count when idle */
247 mmap : 1, /* include mmap data */
248 comm : 1, /* include comm data */
249 freq : 1, /* use freq, not period */
250 inherit_stat : 1, /* per task counts */
251 enable_on_exec : 1, /* next exec enables */
252 task : 1, /* trace fork/exit */
253 watermark : 1, /* wakeup_watermark */
254 /*
255 * precise_ip:
256 *
257 * 0 - SAMPLE_IP can have arbitrary skid
258 * 1 - SAMPLE_IP must have constant skid
259 * 2 - SAMPLE_IP requested to have 0 skid
260 * 3 - SAMPLE_IP must have 0 skid
261 *
262 * See also PERF_RECORD_MISC_EXACT_IP
263 */
264 precise_ip : 2, /* skid constraint */
265 mmap_data : 1, /* non-exec mmap data */
266 sample_id_all : 1, /* sample_type all events */
267
268 exclude_host : 1, /* don't count in host */
269 exclude_guest : 1, /* don't count in guest */
270
271 exclude_callchain_kernel : 1, /* exclude kernel callchains */
272 exclude_callchain_user : 1, /* exclude user callchains */
273
274 __reserved_1 : 41;
275
276 union {
277 __u32 wakeup_events; /* wakeup every n events */
278 __u32 wakeup_watermark; /* bytes before wakeup */
279 };
280
281 __u32 bp_type;
282 union {
283 __u64 bp_addr;
284 __u64 config1; /* extension of config */
285 };
286 union {
287 __u64 bp_len;
288 __u64 config2; /* extension of config1 */
289 };
290 __u64 branch_sample_type; /* enum perf_branch_sample_type */
291
292 /*
293 * Defines set of user regs to dump on samples.
294 * See asm/perf_regs.h for details.
295 */
296 __u64 sample_regs_user;
297
298 /*
299 * Defines size of the user stack to dump on samples.
300 */
301 __u32 sample_stack_user;
302
303 /* Align to u64. */
304 __u32 __reserved_2;
305};
306
307#define perf_flags(attr) (*(&(attr)->read_format + 1))
308
309/*
310 * Ioctls that can be done on a perf event fd:
311 */
312#define PERF_EVENT_IOC_ENABLE _IO ('$', 0)
313#define PERF_EVENT_IOC_DISABLE _IO ('$', 1)
314#define PERF_EVENT_IOC_REFRESH _IO ('$', 2)
315#define PERF_EVENT_IOC_RESET _IO ('$', 3)
316#define PERF_EVENT_IOC_PERIOD _IOW('$', 4, __u64)
317#define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5)
318#define PERF_EVENT_IOC_SET_FILTER _IOW('$', 6, char *)
319
320enum perf_event_ioc_flags {
321 PERF_IOC_FLAG_GROUP = 1U << 0,
322};
323
324/*
325 * Structure of the page that can be mapped via mmap
326 */
327struct perf_event_mmap_page {
328 __u32 version; /* version number of this structure */
329 __u32 compat_version; /* lowest version this is compat with */
330
331 /*
332 * Bits needed to read the hw events in user-space.
333 *
334 * u32 seq, time_mult, time_shift, idx, width;
335 * u64 count, enabled, running;
336 * u64 cyc, time_offset;
337 * s64 pmc = 0;
338 *
339 * do {
340 * seq = pc->lock;
341 * barrier()
342 *
343 * enabled = pc->time_enabled;
344 * running = pc->time_running;
345 *
346 * if (pc->cap_usr_time && enabled != running) {
347 * cyc = rdtsc();
348 * time_offset = pc->time_offset;
349 * time_mult = pc->time_mult;
350 * time_shift = pc->time_shift;
351 * }
352 *
353 * idx = pc->index;
354 * count = pc->offset;
355 * if (pc->cap_usr_rdpmc && idx) {
356 * width = pc->pmc_width;
357 * pmc = rdpmc(idx - 1);
358 * }
359 *
360 * barrier();
361 * } while (pc->lock != seq);
362 *
363 * NOTE: for obvious reason this only works on self-monitoring
364 * processes.
365 */
366 __u32 lock; /* seqlock for synchronization */
367 __u32 index; /* hardware event identifier */
368 __s64 offset; /* add to hardware event value */
369 __u64 time_enabled; /* time event active */
370 __u64 time_running; /* time event on cpu */
371 union {
372 __u64 capabilities;
373 __u64 cap_usr_time : 1,
374 cap_usr_rdpmc : 1,
375 cap_____res : 62;
376 };
377
378 /*
379 * If cap_usr_rdpmc this field provides the bit-width of the value
380 * read using the rdpmc() or equivalent instruction. This can be used
381 * to sign extend the result like:
382 *
383 * pmc <<= 64 - width;
384 * pmc >>= 64 - width; // signed shift right
385 * count += pmc;
386 */
387 __u16 pmc_width;
388
389 /*
390 * If cap_usr_time the below fields can be used to compute the time
391 * delta since time_enabled (in ns) using rdtsc or similar.
392 *
393 * u64 quot, rem;
394 * u64 delta;
395 *
396 * quot = (cyc >> time_shift);
397 * rem = cyc & ((1 << time_shift) - 1);
398 * delta = time_offset + quot * time_mult +
399 * ((rem * time_mult) >> time_shift);
400 *
401 * Where time_offset,time_mult,time_shift and cyc are read in the
402 * seqcount loop described above. This delta can then be added to
403 * enabled and possible running (if idx), improving the scaling:
404 *
405 * enabled += delta;
406 * if (idx)
407 * running += delta;
408 *
409 * quot = count / running;
410 * rem = count % running;
411 * count = quot * enabled + (rem * enabled) / running;
412 */
413 __u16 time_shift;
414 __u32 time_mult;
415 __u64 time_offset;
416
417 /*
418 * Hole for extension of the self monitor capabilities
419 */
420
421 __u64 __reserved[120]; /* align to 1k */
422
423 /*
424 * Control data for the mmap() data buffer.
425 *
426 * User-space reading the @data_head value should issue an rmb(), on
427 * SMP capable platforms, after reading this value -- see
428 * perf_event_wakeup().
429 *
430 * When the mapping is PROT_WRITE the @data_tail value should be
431 * written by userspace to reflect the last read data. In this case
432 * the kernel will not over-write unread data.
433 */
434 __u64 data_head; /* head in the data section */
435 __u64 data_tail; /* user-space written tail */
436};
437
438#define PERF_RECORD_MISC_CPUMODE_MASK (7 << 0)
439#define PERF_RECORD_MISC_CPUMODE_UNKNOWN (0 << 0)
440#define PERF_RECORD_MISC_KERNEL (1 << 0)
441#define PERF_RECORD_MISC_USER (2 << 0)
442#define PERF_RECORD_MISC_HYPERVISOR (3 << 0)
443#define PERF_RECORD_MISC_GUEST_KERNEL (4 << 0)
444#define PERF_RECORD_MISC_GUEST_USER (5 << 0)
445
446/*
447 * Indicates that the content of PERF_SAMPLE_IP points to
448 * the actual instruction that triggered the event. See also
449 * perf_event_attr::precise_ip.
450 */
451#define PERF_RECORD_MISC_EXACT_IP (1 << 14)
452/*
453 * Reserve the last bit to indicate some extended misc field
454 */
455#define PERF_RECORD_MISC_EXT_RESERVED (1 << 15)
456
457struct perf_event_header {
458 __u32 type;
459 __u16 misc;
460 __u16 size;
461};
462
463enum perf_event_type {
464
465 /*
466 * If perf_event_attr.sample_id_all is set then all event types will
467 * have the sample_type selected fields related to where/when
468 * (identity) an event took place (TID, TIME, ID, CPU, STREAM_ID)
469 * described in PERF_RECORD_SAMPLE below, it will be stashed just after
470 * the perf_event_header and the fields already present for the existing
471 * fields, i.e. at the end of the payload. That way a newer perf.data
472 * file will be supported by older perf tools, with these new optional
473 * fields being ignored.
474 *
475 * The MMAP events record the PROT_EXEC mappings so that we can
476 * correlate userspace IPs to code. They have the following structure:
477 *
478 * struct {
479 * struct perf_event_header header;
480 *
481 * u32 pid, tid;
482 * u64 addr;
483 * u64 len;
484 * u64 pgoff;
485 * char filename[];
486 * };
487 */
488 PERF_RECORD_MMAP = 1,
489
490 /*
491 * struct {
492 * struct perf_event_header header;
493 * u64 id;
494 * u64 lost;
495 * };
496 */
497 PERF_RECORD_LOST = 2,
498
499 /*
500 * struct {
501 * struct perf_event_header header;
502 *
503 * u32 pid, tid;
504 * char comm[];
505 * };
506 */
507 PERF_RECORD_COMM = 3,
508
509 /*
510 * struct {
511 * struct perf_event_header header;
512 * u32 pid, ppid;
513 * u32 tid, ptid;
514 * u64 time;
515 * };
516 */
517 PERF_RECORD_EXIT = 4,
518
519 /*
520 * struct {
521 * struct perf_event_header header;
522 * u64 time;
523 * u64 id;
524 * u64 stream_id;
525 * };
526 */
527 PERF_RECORD_THROTTLE = 5,
528 PERF_RECORD_UNTHROTTLE = 6,
529
530 /*
531 * struct {
532 * struct perf_event_header header;
533 * u32 pid, ppid;
534 * u32 tid, ptid;
535 * u64 time;
536 * };
537 */
538 PERF_RECORD_FORK = 7,
539
540 /*
541 * struct {
542 * struct perf_event_header header;
543 * u32 pid, tid;
544 *
545 * struct read_format values;
546 * };
547 */
548 PERF_RECORD_READ = 8,
549
550 /*
551 * struct {
552 * struct perf_event_header header;
553 *
554 * { u64 ip; } && PERF_SAMPLE_IP
555 * { u32 pid, tid; } && PERF_SAMPLE_TID
556 * { u64 time; } && PERF_SAMPLE_TIME
557 * { u64 addr; } && PERF_SAMPLE_ADDR
558 * { u64 id; } && PERF_SAMPLE_ID
559 * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID
560 * { u32 cpu, res; } && PERF_SAMPLE_CPU
561 * { u64 period; } && PERF_SAMPLE_PERIOD
562 *
563 * { struct read_format values; } && PERF_SAMPLE_READ
564 *
565 * { u64 nr,
566 * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN
567 *
568 * #
569 * # The RAW record below is opaque data wrt the ABI
570 * #
571 * # That is, the ABI doesn't make any promises wrt to
572 * # the stability of its content, it may vary depending
573 * # on event, hardware, kernel version and phase of
574 * # the moon.
575 * #
576 * # In other words, PERF_SAMPLE_RAW contents are not an ABI.
577 * #
578 *
579 * { u32 size;
580 * char data[size];}&& PERF_SAMPLE_RAW
581 *
582 * { u64 from, to, flags } lbr[nr];} && PERF_SAMPLE_BRANCH_STACK
583 *
584 * { u64 abi; # enum perf_sample_regs_abi
585 * u64 regs[weight(mask)]; } && PERF_SAMPLE_REGS_USER
586 *
587 * { u64 size;
588 * char data[size];
589 * u64 dyn_size; } && PERF_SAMPLE_STACK_USER
590 * };
591 */
592 PERF_RECORD_SAMPLE = 9,
593
594 PERF_RECORD_MAX, /* non-ABI */
595};
596
597#define PERF_MAX_STACK_DEPTH 127
598
599enum perf_callchain_context {
600 PERF_CONTEXT_HV = (__u64)-32,
601 PERF_CONTEXT_KERNEL = (__u64)-128,
602 PERF_CONTEXT_USER = (__u64)-512,
603
604 PERF_CONTEXT_GUEST = (__u64)-2048,
605 PERF_CONTEXT_GUEST_KERNEL = (__u64)-2176,
606 PERF_CONTEXT_GUEST_USER = (__u64)-2560,
607
608 PERF_CONTEXT_MAX = (__u64)-4095,
609};
610
611#define PERF_FLAG_FD_NO_GROUP (1U << 0)
612#define PERF_FLAG_FD_OUTPUT (1U << 1)
613#define PERF_FLAG_PID_CGROUP (1U << 2) /* pid=cgroup id, per-cpu mode only */
614
615#endif /* _UAPI_LINUX_PERF_EVENT_H */
diff --git a/include/uapi/linux/personality.h b/include/uapi/linux/personality.h
new file mode 100644
index 000000000000..aa169c4339d2
--- /dev/null
+++ b/include/uapi/linux/personality.h
@@ -0,0 +1,69 @@
1#ifndef _UAPI_LINUX_PERSONALITY_H
2#define _UAPI_LINUX_PERSONALITY_H
3
4
5/*
6 * Flags for bug emulation.
7 *
8 * These occupy the top three bytes.
9 */
10enum {
11 UNAME26 = 0x0020000,
12 ADDR_NO_RANDOMIZE = 0x0040000, /* disable randomization of VA space */
13 FDPIC_FUNCPTRS = 0x0080000, /* userspace function ptrs point to descriptors
14 * (signal handling)
15 */
16 MMAP_PAGE_ZERO = 0x0100000,
17 ADDR_COMPAT_LAYOUT = 0x0200000,
18 READ_IMPLIES_EXEC = 0x0400000,
19 ADDR_LIMIT_32BIT = 0x0800000,
20 SHORT_INODE = 0x1000000,
21 WHOLE_SECONDS = 0x2000000,
22 STICKY_TIMEOUTS = 0x4000000,
23 ADDR_LIMIT_3GB = 0x8000000,
24};
25
26/*
27 * Security-relevant compatibility flags that must be
28 * cleared upon setuid or setgid exec:
29 */
30#define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC | \
31 ADDR_NO_RANDOMIZE | \
32 ADDR_COMPAT_LAYOUT | \
33 MMAP_PAGE_ZERO)
34
35/*
36 * Personality types.
37 *
38 * These go in the low byte. Avoid using the top bit, it will
39 * conflict with error returns.
40 */
41enum {
42 PER_LINUX = 0x0000,
43 PER_LINUX_32BIT = 0x0000 | ADDR_LIMIT_32BIT,
44 PER_LINUX_FDPIC = 0x0000 | FDPIC_FUNCPTRS,
45 PER_SVR4 = 0x0001 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
46 PER_SVR3 = 0x0002 | STICKY_TIMEOUTS | SHORT_INODE,
47 PER_SCOSVR3 = 0x0003 | STICKY_TIMEOUTS |
48 WHOLE_SECONDS | SHORT_INODE,
49 PER_OSR5 = 0x0003 | STICKY_TIMEOUTS | WHOLE_SECONDS,
50 PER_WYSEV386 = 0x0004 | STICKY_TIMEOUTS | SHORT_INODE,
51 PER_ISCR4 = 0x0005 | STICKY_TIMEOUTS,
52 PER_BSD = 0x0006,
53 PER_SUNOS = 0x0006 | STICKY_TIMEOUTS,
54 PER_XENIX = 0x0007 | STICKY_TIMEOUTS | SHORT_INODE,
55 PER_LINUX32 = 0x0008,
56 PER_LINUX32_3GB = 0x0008 | ADDR_LIMIT_3GB,
57 PER_IRIX32 = 0x0009 | STICKY_TIMEOUTS,/* IRIX5 32-bit */
58 PER_IRIXN32 = 0x000a | STICKY_TIMEOUTS,/* IRIX6 new 32-bit */
59 PER_IRIX64 = 0x000b | STICKY_TIMEOUTS,/* IRIX6 64-bit */
60 PER_RISCOS = 0x000c,
61 PER_SOLARIS = 0x000d | STICKY_TIMEOUTS,
62 PER_UW7 = 0x000e | STICKY_TIMEOUTS | MMAP_PAGE_ZERO,
63 PER_OSF4 = 0x000f, /* OSF/1 v4 */
64 PER_HPUX = 0x0010,
65 PER_MASK = 0x00ff,
66};
67
68
69#endif /* _UAPI_LINUX_PERSONALITY_H */
diff --git a/include/linux/pfkeyv2.h b/include/uapi/linux/pfkeyv2.h
index 0b80c806631f..0b80c806631f 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/uapi/linux/pfkeyv2.h
diff --git a/include/linux/pg.h b/include/uapi/linux/pg.h
index db994bb0c794..db994bb0c794 100644
--- a/include/linux/pg.h
+++ b/include/uapi/linux/pg.h
diff --git a/include/linux/phantom.h b/include/uapi/linux/phantom.h
index 94dd6645c60a..94dd6645c60a 100644
--- a/include/linux/phantom.h
+++ b/include/uapi/linux/phantom.h
diff --git a/include/uapi/linux/phonet.h b/include/uapi/linux/phonet.h
new file mode 100644
index 000000000000..a3e1d65b3ed9
--- /dev/null
+++ b/include/uapi/linux/phonet.h
@@ -0,0 +1,185 @@
1/**
2 * file phonet.h
3 *
4 * Phonet sockets kernel interface
5 *
6 * Copyright (C) 2008 Nokia Corporation. All rights reserved.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23#ifndef _UAPILINUX_PHONET_H
24#define _UAPILINUX_PHONET_H
25
26#include <linux/types.h>
27#include <linux/socket.h>
28
29/* Automatic protocol selection */
30#define PN_PROTO_TRANSPORT 0
31/* Phonet datagram socket */
32#define PN_PROTO_PHONET 1
33/* Phonet pipe */
34#define PN_PROTO_PIPE 2
35#define PHONET_NPROTO 3
36
37/* Socket options for SOL_PNPIPE level */
38#define PNPIPE_ENCAP 1
39#define PNPIPE_IFINDEX 2
40#define PNPIPE_HANDLE 3
41#define PNPIPE_INITSTATE 4
42
43#define PNADDR_ANY 0
44#define PNADDR_BROADCAST 0xFC
45#define PNPORT_RESOURCE_ROUTING 0
46
47/* Values for PNPIPE_ENCAP option */
48#define PNPIPE_ENCAP_NONE 0
49#define PNPIPE_ENCAP_IP 1
50
51/* ioctls */
52#define SIOCPNGETOBJECT (SIOCPROTOPRIVATE + 0)
53#define SIOCPNENABLEPIPE (SIOCPROTOPRIVATE + 13)
54#define SIOCPNADDRESOURCE (SIOCPROTOPRIVATE + 14)
55#define SIOCPNDELRESOURCE (SIOCPROTOPRIVATE + 15)
56
57/* Phonet protocol header */
58struct phonethdr {
59 __u8 pn_rdev;
60 __u8 pn_sdev;
61 __u8 pn_res;
62 __be16 pn_length;
63 __u8 pn_robj;
64 __u8 pn_sobj;
65} __attribute__((packed));
66
67/* Common Phonet payload header */
68struct phonetmsg {
69 __u8 pn_trans_id; /* transaction ID */
70 __u8 pn_msg_id; /* message type */
71 union {
72 struct {
73 __u8 pn_submsg_id; /* message subtype */
74 __u8 pn_data[5];
75 } base;
76 struct {
77 __u16 pn_e_res_id; /* extended resource ID */
78 __u8 pn_e_submsg_id; /* message subtype */
79 __u8 pn_e_data[3];
80 } ext;
81 } pn_msg_u;
82};
83#define PN_COMMON_MESSAGE 0xF0
84#define PN_COMMGR 0x10
85#define PN_PREFIX 0xE0 /* resource for extended messages */
86#define pn_submsg_id pn_msg_u.base.pn_submsg_id
87#define pn_e_submsg_id pn_msg_u.ext.pn_e_submsg_id
88#define pn_e_res_id pn_msg_u.ext.pn_e_res_id
89#define pn_data pn_msg_u.base.pn_data
90#define pn_e_data pn_msg_u.ext.pn_e_data
91
92/* data for unreachable errors */
93#define PN_COMM_SERVICE_NOT_IDENTIFIED_RESP 0x01
94#define PN_COMM_ISA_ENTITY_NOT_REACHABLE_RESP 0x14
95#define pn_orig_msg_id pn_data[0]
96#define pn_status pn_data[1]
97#define pn_e_orig_msg_id pn_e_data[0]
98#define pn_e_status pn_e_data[1]
99
100/* Phonet socket address structure */
101struct sockaddr_pn {
102 __kernel_sa_family_t spn_family;
103 __u8 spn_obj;
104 __u8 spn_dev;
105 __u8 spn_resource;
106 __u8 spn_zero[sizeof(struct sockaddr) - sizeof(__kernel_sa_family_t) - 3];
107} __attribute__((packed));
108
109/* Well known address */
110#define PN_DEV_PC 0x10
111
112static inline __u16 pn_object(__u8 addr, __u16 port)
113{
114 return (addr << 8) | (port & 0x3ff);
115}
116
117static inline __u8 pn_obj(__u16 handle)
118{
119 return handle & 0xff;
120}
121
122static inline __u8 pn_dev(__u16 handle)
123{
124 return handle >> 8;
125}
126
127static inline __u16 pn_port(__u16 handle)
128{
129 return handle & 0x3ff;
130}
131
132static inline __u8 pn_addr(__u16 handle)
133{
134 return (handle >> 8) & 0xfc;
135}
136
137static inline void pn_sockaddr_set_addr(struct sockaddr_pn *spn, __u8 addr)
138{
139 spn->spn_dev &= 0x03;
140 spn->spn_dev |= addr & 0xfc;
141}
142
143static inline void pn_sockaddr_set_port(struct sockaddr_pn *spn, __u16 port)
144{
145 spn->spn_dev &= 0xfc;
146 spn->spn_dev |= (port >> 8) & 0x03;
147 spn->spn_obj = port & 0xff;
148}
149
150static inline void pn_sockaddr_set_object(struct sockaddr_pn *spn,
151 __u16 handle)
152{
153 spn->spn_dev = pn_dev(handle);
154 spn->spn_obj = pn_obj(handle);
155}
156
157static inline void pn_sockaddr_set_resource(struct sockaddr_pn *spn,
158 __u8 resource)
159{
160 spn->spn_resource = resource;
161}
162
163static inline __u8 pn_sockaddr_get_addr(const struct sockaddr_pn *spn)
164{
165 return spn->spn_dev & 0xfc;
166}
167
168static inline __u16 pn_sockaddr_get_port(const struct sockaddr_pn *spn)
169{
170 return ((spn->spn_dev & 0x03) << 8) | spn->spn_obj;
171}
172
173static inline __u16 pn_sockaddr_get_object(const struct sockaddr_pn *spn)
174{
175 return pn_object(spn->spn_dev, spn->spn_obj);
176}
177
178static inline __u8 pn_sockaddr_get_resource(const struct sockaddr_pn *spn)
179{
180 return spn->spn_resource;
181}
182
183/* Phonet device ioctl requests */
184
185#endif /* _UAPILINUX_PHONET_H */
diff --git a/include/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index 082eafaf026b..082eafaf026b 100644
--- a/include/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
diff --git a/include/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h
index 32aef0a439ef..32aef0a439ef 100644
--- a/include/linux/pkt_sched.h
+++ b/include/uapi/linux/pkt_sched.h
diff --git a/include/uapi/linux/pktcdvd.h b/include/uapi/linux/pktcdvd.h
new file mode 100644
index 000000000000..2640b9d4e243
--- /dev/null
+++ b/include/uapi/linux/pktcdvd.h
@@ -0,0 +1,111 @@
1/*
2 * Copyright (C) 2000 Jens Axboe <axboe@suse.de>
3 * Copyright (C) 2001-2004 Peter Osterlund <petero2@telia.com>
4 *
5 * May be copied or modified under the terms of the GNU General Public
6 * License. See linux/COPYING for more information.
7 *
8 * Packet writing layer for ATAPI and SCSI CD-R, CD-RW, DVD-R, and
9 * DVD-RW devices.
10 *
11 */
12#ifndef _UAPI__PKTCDVD_H
13#define _UAPI__PKTCDVD_H
14
15#include <linux/types.h>
16
17/*
18 * 1 for normal debug messages, 2 is very verbose. 0 to turn it off.
19 */
20#define PACKET_DEBUG 1
21
22#define MAX_WRITERS 8
23
24#define PKT_RB_POOL_SIZE 512
25
26/*
27 * How long we should hold a non-full packet before starting data gathering.
28 */
29#define PACKET_WAIT_TIME (HZ * 5 / 1000)
30
31/*
32 * use drive write caching -- we need deferred error handling to be
33 * able to successfully recover with this option (drive will return good
34 * status as soon as the cdb is validated).
35 */
36#if defined(CONFIG_CDROM_PKTCDVD_WCACHE)
37#define USE_WCACHING 1
38#else
39#define USE_WCACHING 0
40#endif
41
42/*
43 * No user-servicable parts beyond this point ->
44 */
45
46/*
47 * device types
48 */
49#define PACKET_CDR 1
50#define PACKET_CDRW 2
51#define PACKET_DVDR 3
52#define PACKET_DVDRW 4
53
54/*
55 * flags
56 */
57#define PACKET_WRITABLE 1 /* pd is writable */
58#define PACKET_NWA_VALID 2 /* next writable address valid */
59#define PACKET_LRA_VALID 3 /* last recorded address valid */
60#define PACKET_MERGE_SEGS 4 /* perform segment merging to keep */
61 /* underlying cdrom device happy */
62
63/*
64 * Disc status -- from READ_DISC_INFO
65 */
66#define PACKET_DISC_EMPTY 0
67#define PACKET_DISC_INCOMPLETE 1
68#define PACKET_DISC_COMPLETE 2
69#define PACKET_DISC_OTHER 3
70
71/*
72 * write type, and corresponding data block type
73 */
74#define PACKET_MODE1 1
75#define PACKET_MODE2 2
76#define PACKET_BLOCK_MODE1 8
77#define PACKET_BLOCK_MODE2 10
78
79/*
80 * Last session/border status
81 */
82#define PACKET_SESSION_EMPTY 0
83#define PACKET_SESSION_INCOMPLETE 1
84#define PACKET_SESSION_RESERVED 2
85#define PACKET_SESSION_COMPLETE 3
86
87#define PACKET_MCN "4a656e734178626f65323030300000"
88
89#undef PACKET_USE_LS
90
91#define PKT_CTRL_CMD_SETUP 0
92#define PKT_CTRL_CMD_TEARDOWN 1
93#define PKT_CTRL_CMD_STATUS 2
94
95struct pkt_ctrl_command {
96 __u32 command; /* in: Setup, teardown, status */
97 __u32 dev_index; /* in/out: Device index */
98 __u32 dev; /* in/out: Device nr for cdrw device */
99 __u32 pkt_dev; /* in/out: Device nr for packet device */
100 __u32 num_devices; /* out: Largest device index + 1 */
101 __u32 padding; /* Not used */
102};
103
104/*
105 * packet ioctls
106 */
107#define PACKET_IOCTL_MAGIC ('X')
108#define PACKET_CTRL_CMD _IOWR(PACKET_IOCTL_MAGIC, 1, struct pkt_ctrl_command)
109
110
111#endif /* _UAPI__PKTCDVD_H */
diff --git a/include/uapi/linux/pmu.h b/include/uapi/linux/pmu.h
new file mode 100644
index 000000000000..caead364b6eb
--- /dev/null
+++ b/include/uapi/linux/pmu.h
@@ -0,0 +1,139 @@
1/*
2 * Definitions for talking to the PMU. The PMU is a microcontroller
3 * which controls battery charging and system power on PowerBook 3400
4 * and 2400 models as well as the RTC and various other things.
5 *
6 * Copyright (C) 1998 Paul Mackerras.
7 */
8
9#ifndef _UAPI_LINUX_PMU_H
10#define _UAPI_LINUX_PMU_H
11
12#define PMU_DRIVER_VERSION 2
13
14/*
15 * PMU commands
16 */
17#define PMU_POWER_CTRL0 0x10 /* control power of some devices */
18#define PMU_POWER_CTRL 0x11 /* control power of some devices */
19#define PMU_ADB_CMD 0x20 /* send ADB packet */
20#define PMU_ADB_POLL_OFF 0x21 /* disable ADB auto-poll */
21#define PMU_WRITE_NVRAM 0x33 /* write non-volatile RAM */
22#define PMU_READ_NVRAM 0x3b /* read non-volatile RAM */
23#define PMU_SET_RTC 0x30 /* set real-time clock */
24#define PMU_READ_RTC 0x38 /* read real-time clock */
25#define PMU_SET_VOLBUTTON 0x40 /* set volume up/down position */
26#define PMU_BACKLIGHT_BRIGHT 0x41 /* set backlight brightness */
27#define PMU_GET_VOLBUTTON 0x48 /* get volume up/down position */
28#define PMU_PCEJECT 0x4c /* eject PC-card from slot */
29#define PMU_BATTERY_STATE 0x6b /* report battery state etc. */
30#define PMU_SMART_BATTERY_STATE 0x6f /* report battery state (new way) */
31#define PMU_SET_INTR_MASK 0x70 /* set PMU interrupt mask */
32#define PMU_INT_ACK 0x78 /* read interrupt bits */
33#define PMU_SHUTDOWN 0x7e /* turn power off */
34#define PMU_CPU_SPEED 0x7d /* control CPU speed on some models */
35#define PMU_SLEEP 0x7f /* put CPU to sleep */
36#define PMU_POWER_EVENTS 0x8f /* Send power-event commands to PMU */
37#define PMU_I2C_CMD 0x9a /* I2C operations */
38#define PMU_RESET 0xd0 /* reset CPU */
39#define PMU_GET_BRIGHTBUTTON 0xd9 /* report brightness up/down pos */
40#define PMU_GET_COVER 0xdc /* report cover open/closed */
41#define PMU_SYSTEM_READY 0xdf /* tell PMU we are awake */
42#define PMU_GET_VERSION 0xea /* read the PMU version */
43
44/* Bits to use with the PMU_POWER_CTRL0 command */
45#define PMU_POW0_ON 0x80 /* OR this to power ON the device */
46#define PMU_POW0_OFF 0x00 /* leave bit 7 to 0 to power it OFF */
47#define PMU_POW0_HARD_DRIVE 0x04 /* Hard drive power (on wallstreet/lombard ?) */
48
49/* Bits to use with the PMU_POWER_CTRL command */
50#define PMU_POW_ON 0x80 /* OR this to power ON the device */
51#define PMU_POW_OFF 0x00 /* leave bit 7 to 0 to power it OFF */
52#define PMU_POW_BACKLIGHT 0x01 /* backlight power */
53#define PMU_POW_CHARGER 0x02 /* battery charger power */
54#define PMU_POW_IRLED 0x04 /* IR led power (on wallstreet) */
55#define PMU_POW_MEDIABAY 0x08 /* media bay power (wallstreet/lombard ?) */
56
57/* Bits in PMU interrupt and interrupt mask bytes */
58#define PMU_INT_PCEJECT 0x04 /* PC-card eject buttons */
59#define PMU_INT_SNDBRT 0x08 /* sound/brightness up/down buttons */
60#define PMU_INT_ADB 0x10 /* ADB autopoll or reply data */
61#define PMU_INT_BATTERY 0x20 /* Battery state change */
62#define PMU_INT_ENVIRONMENT 0x40 /* Environment interrupts */
63#define PMU_INT_TICK 0x80 /* 1-second tick interrupt */
64
65/* Other bits in PMU interrupt valid when PMU_INT_ADB is set */
66#define PMU_INT_ADB_AUTO 0x04 /* ADB autopoll, when PMU_INT_ADB */
67#define PMU_INT_WAITING_CHARGER 0x01 /* ??? */
68#define PMU_INT_AUTO_SRQ_POLL 0x02 /* ??? */
69
70/* Bits in the environement message (either obtained via PMU_GET_COVER,
71 * or via PMU_INT_ENVIRONMENT on core99 */
72#define PMU_ENV_LID_CLOSED 0x01 /* The lid is closed */
73
74/* I2C related definitions */
75#define PMU_I2C_MODE_SIMPLE 0
76#define PMU_I2C_MODE_STDSUB 1
77#define PMU_I2C_MODE_COMBINED 2
78
79#define PMU_I2C_BUS_STATUS 0
80#define PMU_I2C_BUS_SYSCLK 1
81#define PMU_I2C_BUS_POWER 2
82
83#define PMU_I2C_STATUS_OK 0
84#define PMU_I2C_STATUS_DATAREAD 1
85#define PMU_I2C_STATUS_BUSY 0xfe
86
87
88/* Kind of PMU (model) */
89enum {
90 PMU_UNKNOWN,
91 PMU_OHARE_BASED, /* 2400, 3400, 3500 (old G3 powerbook) */
92 PMU_HEATHROW_BASED, /* PowerBook G3 series */
93 PMU_PADDINGTON_BASED, /* 1999 PowerBook G3 */
94 PMU_KEYLARGO_BASED, /* Core99 motherboard (PMU99) */
95 PMU_68K_V1, /* 68K PMU, version 1 */
96 PMU_68K_V2, /* 68K PMU, version 2 */
97};
98
99/* PMU PMU_POWER_EVENTS commands */
100enum {
101 PMU_PWR_GET_POWERUP_EVENTS = 0x00,
102 PMU_PWR_SET_POWERUP_EVENTS = 0x01,
103 PMU_PWR_CLR_POWERUP_EVENTS = 0x02,
104 PMU_PWR_GET_WAKEUP_EVENTS = 0x03,
105 PMU_PWR_SET_WAKEUP_EVENTS = 0x04,
106 PMU_PWR_CLR_WAKEUP_EVENTS = 0x05,
107};
108
109/* Power events wakeup bits */
110enum {
111 PMU_PWR_WAKEUP_KEY = 0x01, /* Wake on key press */
112 PMU_PWR_WAKEUP_AC_INSERT = 0x02, /* Wake on AC adapter plug */
113 PMU_PWR_WAKEUP_AC_CHANGE = 0x04,
114 PMU_PWR_WAKEUP_LID_OPEN = 0x08,
115 PMU_PWR_WAKEUP_RING = 0x10,
116};
117
118/*
119 * Ioctl commands for the /dev/pmu device
120 */
121#include <linux/ioctl.h>
122
123/* no param */
124#define PMU_IOC_SLEEP _IO('B', 0)
125/* out param: u32* backlight value: 0 to 15 */
126#define PMU_IOC_GET_BACKLIGHT _IOR('B', 1, size_t)
127/* in param: u32 backlight value: 0 to 15 */
128#define PMU_IOC_SET_BACKLIGHT _IOW('B', 2, size_t)
129/* out param: u32* PMU model */
130#define PMU_IOC_GET_MODEL _IOR('B', 3, size_t)
131/* out param: u32* has_adb: 0 or 1 */
132#define PMU_IOC_HAS_ADB _IOR('B', 4, size_t)
133/* out param: u32* can_sleep: 0 or 1 */
134#define PMU_IOC_CAN_SLEEP _IOR('B', 5, size_t)
135/* no param, but historically was _IOR('B', 6, 0), meaning 4 bytes */
136#define PMU_IOC_GRAB_BACKLIGHT _IOR('B', 6, size_t)
137
138
139#endif /* _UAPI_LINUX_PMU_H */
diff --git a/include/uapi/linux/poll.h b/include/uapi/linux/poll.h
new file mode 100644
index 000000000000..2001fedfb223
--- /dev/null
+++ b/include/uapi/linux/poll.h
@@ -0,0 +1 @@
#include <asm/poll.h>
diff --git a/include/linux/posix_types.h b/include/uapi/linux/posix_types.h
index 988f76e636e3..988f76e636e3 100644
--- a/include/linux/posix_types.h
+++ b/include/uapi/linux/posix_types.h
diff --git a/include/linux/ppdev.h b/include/uapi/linux/ppdev.h
index dc18c5d23ebe..dc18c5d23ebe 100644
--- a/include/linux/ppdev.h
+++ b/include/uapi/linux/ppdev.h
diff --git a/include/uapi/linux/ppp-comp.h b/include/uapi/linux/ppp-comp.h
new file mode 100644
index 000000000000..0a15bbb04e19
--- /dev/null
+++ b/include/uapi/linux/ppp-comp.h
@@ -0,0 +1,93 @@
1/*
2 * ppp-comp.h - Definitions for doing PPP packet compression.
3 *
4 * Copyright 1994-1998 Paul Mackerras.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 */
10#ifndef _UAPI_NET_PPP_COMP_H
11#define _UAPI_NET_PPP_COMP_H
12
13
14/*
15 * CCP codes.
16 */
17
18#define CCP_CONFREQ 1
19#define CCP_CONFACK 2
20#define CCP_TERMREQ 5
21#define CCP_TERMACK 6
22#define CCP_RESETREQ 14
23#define CCP_RESETACK 15
24
25/*
26 * Max # bytes for a CCP option
27 */
28
29#define CCP_MAX_OPTION_LENGTH 32
30
31/*
32 * Parts of a CCP packet.
33 */
34
35#define CCP_CODE(dp) ((dp)[0])
36#define CCP_ID(dp) ((dp)[1])
37#define CCP_LENGTH(dp) (((dp)[2] << 8) + (dp)[3])
38#define CCP_HDRLEN 4
39
40#define CCP_OPT_CODE(dp) ((dp)[0])
41#define CCP_OPT_LENGTH(dp) ((dp)[1])
42#define CCP_OPT_MINLEN 2
43
44/*
45 * Definitions for BSD-Compress.
46 */
47
48#define CI_BSD_COMPRESS 21 /* config. option for BSD-Compress */
49#define CILEN_BSD_COMPRESS 3 /* length of config. option */
50
51/* Macros for handling the 3rd byte of the BSD-Compress config option. */
52#define BSD_NBITS(x) ((x) & 0x1F) /* number of bits requested */
53#define BSD_VERSION(x) ((x) >> 5) /* version of option format */
54#define BSD_CURRENT_VERSION 1 /* current version number */
55#define BSD_MAKE_OPT(v, n) (((v) << 5) | (n))
56
57#define BSD_MIN_BITS 9 /* smallest code size supported */
58#define BSD_MAX_BITS 15 /* largest code size supported */
59
60/*
61 * Definitions for Deflate.
62 */
63
64#define CI_DEFLATE 26 /* config option for Deflate */
65#define CI_DEFLATE_DRAFT 24 /* value used in original draft RFC */
66#define CILEN_DEFLATE 4 /* length of its config option */
67
68#define DEFLATE_MIN_SIZE 9
69#define DEFLATE_MAX_SIZE 15
70#define DEFLATE_METHOD_VAL 8
71#define DEFLATE_SIZE(x) (((x) >> 4) + 8)
72#define DEFLATE_METHOD(x) ((x) & 0x0F)
73#define DEFLATE_MAKE_OPT(w) ((((w) - 8) << 4) + DEFLATE_METHOD_VAL)
74#define DEFLATE_CHK_SEQUENCE 0
75
76/*
77 * Definitions for MPPE.
78 */
79
80#define CI_MPPE 18 /* config option for MPPE */
81#define CILEN_MPPE 6 /* length of config option */
82
83/*
84 * Definitions for other, as yet unsupported, compression methods.
85 */
86
87#define CI_PREDICTOR_1 1 /* config option for Predictor-1 */
88#define CILEN_PREDICTOR_1 2 /* length of its config option */
89#define CI_PREDICTOR_2 2 /* config option for Predictor-2 */
90#define CILEN_PREDICTOR_2 2 /* length of its config option */
91
92
93#endif /* _UAPI_NET_PPP_COMP_H */
diff --git a/include/linux/ppp-ioctl.h b/include/uapi/linux/ppp-ioctl.h
index 2d9a8859550a..2d9a8859550a 100644
--- a/include/linux/ppp-ioctl.h
+++ b/include/uapi/linux/ppp-ioctl.h
diff --git a/include/uapi/linux/ppp_defs.h b/include/uapi/linux/ppp_defs.h
new file mode 100644
index 000000000000..283fc05dbbda
--- /dev/null
+++ b/include/uapi/linux/ppp_defs.h
@@ -0,0 +1,150 @@
1/*
2 * ppp_defs.h - PPP definitions.
3 *
4 * Copyright 1994-2000 Paul Mackerras.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 */
10#include <linux/types.h>
11
12#ifndef _UAPI_PPP_DEFS_H_
13#define _UAPI_PPP_DEFS_H_
14
15/*
16 * The basic PPP frame.
17 */
18#define PPP_HDRLEN 4 /* octets for standard ppp header */
19#define PPP_FCSLEN 2 /* octets for FCS */
20#define PPP_MRU 1500 /* default MRU = max length of info field */
21
22#define PPP_ADDRESS(p) (((__u8 *)(p))[0])
23#define PPP_CONTROL(p) (((__u8 *)(p))[1])
24#define PPP_PROTOCOL(p) ((((__u8 *)(p))[2] << 8) + ((__u8 *)(p))[3])
25
26/*
27 * Significant octet values.
28 */
29#define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */
30#define PPP_UI 0x03 /* Unnumbered Information */
31#define PPP_FLAG 0x7e /* Flag Sequence */
32#define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */
33#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */
34
35/*
36 * Protocol field values.
37 */
38#define PPP_IP 0x21 /* Internet Protocol */
39#define PPP_AT 0x29 /* AppleTalk Protocol */
40#define PPP_IPX 0x2b /* IPX protocol */
41#define PPP_VJC_COMP 0x2d /* VJ compressed TCP */
42#define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */
43#define PPP_MP 0x3d /* Multilink protocol */
44#define PPP_IPV6 0x57 /* Internet Protocol Version 6 */
45#define PPP_COMPFRAG 0xfb /* fragment compressed below bundle */
46#define PPP_COMP 0xfd /* compressed packet */
47#define PPP_MPLS_UC 0x0281 /* Multi Protocol Label Switching - Unicast */
48#define PPP_MPLS_MC 0x0283 /* Multi Protocol Label Switching - Multicast */
49#define PPP_IPCP 0x8021 /* IP Control Protocol */
50#define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */
51#define PPP_IPXCP 0x802b /* IPX Control Protocol */
52#define PPP_IPV6CP 0x8057 /* IPv6 Control Protocol */
53#define PPP_CCPFRAG 0x80fb /* CCP at link level (below MP bundle) */
54#define PPP_CCP 0x80fd /* Compression Control Protocol */
55#define PPP_MPLSCP 0x80fd /* MPLS Control Protocol */
56#define PPP_LCP 0xc021 /* Link Control Protocol */
57#define PPP_PAP 0xc023 /* Password Authentication Protocol */
58#define PPP_LQR 0xc025 /* Link Quality Report protocol */
59#define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */
60#define PPP_CBCP 0xc029 /* Callback Control Protocol */
61
62/*
63 * Values for FCS calculations.
64 */
65
66#define PPP_INITFCS 0xffff /* Initial FCS value */
67#define PPP_GOODFCS 0xf0b8 /* Good final FCS value */
68
69
70/*
71 * Extended asyncmap - allows any character to be escaped.
72 */
73
74typedef __u32 ext_accm[8];
75
76/*
77 * What to do with network protocol (NP) packets.
78 */
79enum NPmode {
80 NPMODE_PASS, /* pass the packet through */
81 NPMODE_DROP, /* silently drop the packet */
82 NPMODE_ERROR, /* return an error */
83 NPMODE_QUEUE /* save it up for later. */
84};
85
86/*
87 * Statistics for LQRP and pppstats
88 */
89struct pppstat {
90 __u32 ppp_discards; /* # frames discarded */
91
92 __u32 ppp_ibytes; /* bytes received */
93 __u32 ppp_ioctects; /* bytes received not in error */
94 __u32 ppp_ipackets; /* packets received */
95 __u32 ppp_ierrors; /* receive errors */
96 __u32 ppp_ilqrs; /* # LQR frames received */
97
98 __u32 ppp_obytes; /* raw bytes sent */
99 __u32 ppp_ooctects; /* frame bytes sent */
100 __u32 ppp_opackets; /* packets sent */
101 __u32 ppp_oerrors; /* transmit errors */
102 __u32 ppp_olqrs; /* # LQR frames sent */
103};
104
105struct vjstat {
106 __u32 vjs_packets; /* outbound packets */
107 __u32 vjs_compressed; /* outbound compressed packets */
108 __u32 vjs_searches; /* searches for connection state */
109 __u32 vjs_misses; /* times couldn't find conn. state */
110 __u32 vjs_uncompressedin; /* inbound uncompressed packets */
111 __u32 vjs_compressedin; /* inbound compressed packets */
112 __u32 vjs_errorin; /* inbound unknown type packets */
113 __u32 vjs_tossed; /* inbound packets tossed because of error */
114};
115
116struct compstat {
117 __u32 unc_bytes; /* total uncompressed bytes */
118 __u32 unc_packets; /* total uncompressed packets */
119 __u32 comp_bytes; /* compressed bytes */
120 __u32 comp_packets; /* compressed packets */
121 __u32 inc_bytes; /* incompressible bytes */
122 __u32 inc_packets; /* incompressible packets */
123
124 /* the compression ratio is defined as in_count / bytes_out */
125 __u32 in_count; /* Bytes received */
126 __u32 bytes_out; /* Bytes transmitted */
127
128 double ratio; /* not computed in kernel. */
129};
130
131struct ppp_stats {
132 struct pppstat p; /* basic PPP statistics */
133 struct vjstat vj; /* VJ header compression statistics */
134};
135
136struct ppp_comp_stats {
137 struct compstat c; /* packet compression statistics */
138 struct compstat d; /* packet decompression statistics */
139};
140
141/*
142 * The following structure records the time in seconds since
143 * the last NP packet was sent or received.
144 */
145struct ppp_idle {
146 __kernel_time_t xmit_idle; /* time since last NP packet sent */
147 __kernel_time_t recv_idle; /* time since last NP packet received */
148};
149
150#endif /* _UAPI_PPP_DEFS_H_ */
diff --git a/include/linux/pps.h b/include/uapi/linux/pps.h
index a9bb1d93451a..a9bb1d93451a 100644
--- a/include/linux/pps.h
+++ b/include/uapi/linux/pps.h
diff --git a/include/linux/prctl.h b/include/uapi/linux/prctl.h
index 289760f424aa..289760f424aa 100644
--- a/include/linux/prctl.h
+++ b/include/uapi/linux/prctl.h
diff --git a/include/linux/ptp_clock.h b/include/uapi/linux/ptp_clock.h
index 94e981f810a2..94e981f810a2 100644
--- a/include/linux/ptp_clock.h
+++ b/include/uapi/linux/ptp_clock.h
diff --git a/include/uapi/linux/ptrace.h b/include/uapi/linux/ptrace.h
new file mode 100644
index 000000000000..1ef6c056a9e4
--- /dev/null
+++ b/include/uapi/linux/ptrace.h
@@ -0,0 +1,81 @@
1#ifndef _UAPI_LINUX_PTRACE_H
2#define _UAPI_LINUX_PTRACE_H
3/* ptrace.h */
4/* structs and defines to help the user use the ptrace system call. */
5
6/* has the defines to get at the registers. */
7
8
9#define PTRACE_TRACEME 0
10#define PTRACE_PEEKTEXT 1
11#define PTRACE_PEEKDATA 2
12#define PTRACE_PEEKUSR 3
13#define PTRACE_POKETEXT 4
14#define PTRACE_POKEDATA 5
15#define PTRACE_POKEUSR 6
16#define PTRACE_CONT 7
17#define PTRACE_KILL 8
18#define PTRACE_SINGLESTEP 9
19
20#define PTRACE_ATTACH 16
21#define PTRACE_DETACH 17
22
23#define PTRACE_SYSCALL 24
24
25/* 0x4200-0x4300 are reserved for architecture-independent additions. */
26#define PTRACE_SETOPTIONS 0x4200
27#define PTRACE_GETEVENTMSG 0x4201
28#define PTRACE_GETSIGINFO 0x4202
29#define PTRACE_SETSIGINFO 0x4203
30
31/*
32 * Generic ptrace interface that exports the architecture specific regsets
33 * using the corresponding NT_* types (which are also used in the core dump).
34 * Please note that the NT_PRSTATUS note type in a core dump contains a full
35 * 'struct elf_prstatus'. But the user_regset for NT_PRSTATUS contains just the
36 * elf_gregset_t that is the pr_reg field of 'struct elf_prstatus'. For all the
37 * other user_regset flavors, the user_regset layout and the ELF core dump note
38 * payload are exactly the same layout.
39 *
40 * This interface usage is as follows:
41 * struct iovec iov = { buf, len};
42 *
43 * ret = ptrace(PTRACE_GETREGSET/PTRACE_SETREGSET, pid, NT_XXX_TYPE, &iov);
44 *
45 * On the successful completion, iov.len will be updated by the kernel,
46 * specifying how much the kernel has written/read to/from the user's iov.buf.
47 */
48#define PTRACE_GETREGSET 0x4204
49#define PTRACE_SETREGSET 0x4205
50
51#define PTRACE_SEIZE 0x4206
52#define PTRACE_INTERRUPT 0x4207
53#define PTRACE_LISTEN 0x4208
54
55/* Wait extended result codes for the above trace options. */
56#define PTRACE_EVENT_FORK 1
57#define PTRACE_EVENT_VFORK 2
58#define PTRACE_EVENT_CLONE 3
59#define PTRACE_EVENT_EXEC 4
60#define PTRACE_EVENT_VFORK_DONE 5
61#define PTRACE_EVENT_EXIT 6
62#define PTRACE_EVENT_SECCOMP 7
63/* Extended result codes which enabled by means other than options. */
64#define PTRACE_EVENT_STOP 128
65
66/* Options set using PTRACE_SETOPTIONS or using PTRACE_SEIZE @data param */
67#define PTRACE_O_TRACESYSGOOD 1
68#define PTRACE_O_TRACEFORK (1 << PTRACE_EVENT_FORK)
69#define PTRACE_O_TRACEVFORK (1 << PTRACE_EVENT_VFORK)
70#define PTRACE_O_TRACECLONE (1 << PTRACE_EVENT_CLONE)
71#define PTRACE_O_TRACEEXEC (1 << PTRACE_EVENT_EXEC)
72#define PTRACE_O_TRACEVFORKDONE (1 << PTRACE_EVENT_VFORK_DONE)
73#define PTRACE_O_TRACEEXIT (1 << PTRACE_EVENT_EXIT)
74#define PTRACE_O_TRACESECCOMP (1 << PTRACE_EVENT_SECCOMP)
75
76#define PTRACE_O_MASK 0x000000ff
77
78#include <asm/ptrace.h>
79
80
81#endif /* _UAPI_LINUX_PTRACE_H */
diff --git a/include/linux/qnx4_fs.h b/include/uapi/linux/qnx4_fs.h
index 8b9aee1a9ce3..8b9aee1a9ce3 100644
--- a/include/linux/qnx4_fs.h
+++ b/include/uapi/linux/qnx4_fs.h
diff --git a/include/linux/qnxtypes.h b/include/uapi/linux/qnxtypes.h
index bebbe5cc4fb8..bebbe5cc4fb8 100644
--- a/include/linux/qnxtypes.h
+++ b/include/uapi/linux/qnxtypes.h
diff --git a/include/uapi/linux/quota.h b/include/uapi/linux/quota.h
new file mode 100644
index 000000000000..3b6cfbeb086d
--- /dev/null
+++ b/include/uapi/linux/quota.h
@@ -0,0 +1,171 @@
1/*
2 * Copyright (c) 1982, 1986 Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Robert Elz at The University of Melbourne.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the University nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#ifndef _UAPI_LINUX_QUOTA_
34#define _UAPI_LINUX_QUOTA_
35
36#include <linux/errno.h>
37#include <linux/types.h>
38
39#define __DQUOT_VERSION__ "dquot_6.5.2"
40
41#define MAXQUOTAS 2
42#define USRQUOTA 0 /* element used for user quotas */
43#define GRPQUOTA 1 /* element used for group quotas */
44
45/*
46 * Definitions for the default names of the quotas files.
47 */
48#define INITQFNAMES { \
49 "user", /* USRQUOTA */ \
50 "group", /* GRPQUOTA */ \
51 "undefined", \
52};
53
54/*
55 * Command definitions for the 'quotactl' system call.
56 * The commands are broken into a main command defined below
57 * and a subcommand that is used to convey the type of
58 * quota that is being manipulated (see above).
59 */
60#define SUBCMDMASK 0x00ff
61#define SUBCMDSHIFT 8
62#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
63
64#define Q_SYNC 0x800001 /* sync disk copy of a filesystems quotas */
65#define Q_QUOTAON 0x800002 /* turn quotas on */
66#define Q_QUOTAOFF 0x800003 /* turn quotas off */
67#define Q_GETFMT 0x800004 /* get quota format used on given filesystem */
68#define Q_GETINFO 0x800005 /* get information about quota files */
69#define Q_SETINFO 0x800006 /* set information about quota files */
70#define Q_GETQUOTA 0x800007 /* get user quota structure */
71#define Q_SETQUOTA 0x800008 /* set user quota structure */
72
73/* Quota format type IDs */
74#define QFMT_VFS_OLD 1
75#define QFMT_VFS_V0 2
76#define QFMT_OCFS2 3
77#define QFMT_VFS_V1 4
78
79/* Size of block in which space limits are passed through the quota
80 * interface */
81#define QIF_DQBLKSIZE_BITS 10
82#define QIF_DQBLKSIZE (1 << QIF_DQBLKSIZE_BITS)
83
84/*
85 * Quota structure used for communication with userspace via quotactl
86 * Following flags are used to specify which fields are valid
87 */
88enum {
89 QIF_BLIMITS_B = 0,
90 QIF_SPACE_B,
91 QIF_ILIMITS_B,
92 QIF_INODES_B,
93 QIF_BTIME_B,
94 QIF_ITIME_B,
95};
96
97#define QIF_BLIMITS (1 << QIF_BLIMITS_B)
98#define QIF_SPACE (1 << QIF_SPACE_B)
99#define QIF_ILIMITS (1 << QIF_ILIMITS_B)
100#define QIF_INODES (1 << QIF_INODES_B)
101#define QIF_BTIME (1 << QIF_BTIME_B)
102#define QIF_ITIME (1 << QIF_ITIME_B)
103#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)
104#define QIF_USAGE (QIF_SPACE | QIF_INODES)
105#define QIF_TIMES (QIF_BTIME | QIF_ITIME)
106#define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES)
107
108struct if_dqblk {
109 __u64 dqb_bhardlimit;
110 __u64 dqb_bsoftlimit;
111 __u64 dqb_curspace;
112 __u64 dqb_ihardlimit;
113 __u64 dqb_isoftlimit;
114 __u64 dqb_curinodes;
115 __u64 dqb_btime;
116 __u64 dqb_itime;
117 __u32 dqb_valid;
118};
119
120/*
121 * Structure used for setting quota information about file via quotactl
122 * Following flags are used to specify which fields are valid
123 */
124#define IIF_BGRACE 1
125#define IIF_IGRACE 2
126#define IIF_FLAGS 4
127#define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
128
129struct if_dqinfo {
130 __u64 dqi_bgrace;
131 __u64 dqi_igrace;
132 __u32 dqi_flags;
133 __u32 dqi_valid;
134};
135
136/*
137 * Definitions for quota netlink interface
138 */
139#define QUOTA_NL_NOWARN 0
140#define QUOTA_NL_IHARDWARN 1 /* Inode hardlimit reached */
141#define QUOTA_NL_ISOFTLONGWARN 2 /* Inode grace time expired */
142#define QUOTA_NL_ISOFTWARN 3 /* Inode softlimit reached */
143#define QUOTA_NL_BHARDWARN 4 /* Block hardlimit reached */
144#define QUOTA_NL_BSOFTLONGWARN 5 /* Block grace time expired */
145#define QUOTA_NL_BSOFTWARN 6 /* Block softlimit reached */
146#define QUOTA_NL_IHARDBELOW 7 /* Usage got below inode hardlimit */
147#define QUOTA_NL_ISOFTBELOW 8 /* Usage got below inode softlimit */
148#define QUOTA_NL_BHARDBELOW 9 /* Usage got below block hardlimit */
149#define QUOTA_NL_BSOFTBELOW 10 /* Usage got below block softlimit */
150
151enum {
152 QUOTA_NL_C_UNSPEC,
153 QUOTA_NL_C_WARNING,
154 __QUOTA_NL_C_MAX,
155};
156#define QUOTA_NL_C_MAX (__QUOTA_NL_C_MAX - 1)
157
158enum {
159 QUOTA_NL_A_UNSPEC,
160 QUOTA_NL_A_QTYPE,
161 QUOTA_NL_A_EXCESS_ID,
162 QUOTA_NL_A_WARNING,
163 QUOTA_NL_A_DEV_MAJOR,
164 QUOTA_NL_A_DEV_MINOR,
165 QUOTA_NL_A_CAUSED_ID,
166 __QUOTA_NL_A_MAX,
167};
168#define QUOTA_NL_A_MAX (__QUOTA_NL_A_MAX - 1)
169
170
171#endif /* _UAPI_LINUX_QUOTA_ */
diff --git a/include/linux/radeonfb.h b/include/uapi/linux/radeonfb.h
index 8c4bbdecc44f..8c4bbdecc44f 100644
--- a/include/linux/radeonfb.h
+++ b/include/uapi/linux/radeonfb.h
diff --git a/include/uapi/linux/random.h b/include/uapi/linux/random.h
new file mode 100644
index 000000000000..7471b5b3b8ba
--- /dev/null
+++ b/include/uapi/linux/random.h
@@ -0,0 +1,50 @@
1/*
2 * include/linux/random.h
3 *
4 * Include file for the random number generator.
5 */
6
7#ifndef _UAPI_LINUX_RANDOM_H
8#define _UAPI_LINUX_RANDOM_H
9
10#include <linux/types.h>
11#include <linux/ioctl.h>
12#include <linux/irqnr.h>
13
14/* ioctl()'s for the random number generator */
15
16/* Get the entropy count. */
17#define RNDGETENTCNT _IOR( 'R', 0x00, int )
18
19/* Add to (or subtract from) the entropy count. (Superuser only.) */
20#define RNDADDTOENTCNT _IOW( 'R', 0x01, int )
21
22/* Get the contents of the entropy pool. (Superuser only.) */
23#define RNDGETPOOL _IOR( 'R', 0x02, int [2] )
24
25/*
26 * Write bytes into the entropy pool and add to the entropy count.
27 * (Superuser only.)
28 */
29#define RNDADDENTROPY _IOW( 'R', 0x03, int [2] )
30
31/* Clear entropy count to 0. (Superuser only.) */
32#define RNDZAPENTCNT _IO( 'R', 0x04 )
33
34/* Clear the entropy pool and associated counters. (Superuser only.) */
35#define RNDCLEARPOOL _IO( 'R', 0x06 )
36
37struct rand_pool_info {
38 int entropy_count;
39 int buf_size;
40 __u32 buf[0];
41};
42
43struct rnd_state {
44 __u32 s1, s2, s3;
45};
46
47/* Exported functions */
48
49
50#endif /* _UAPI_LINUX_RANDOM_H */
diff --git a/include/linux/raw.h b/include/uapi/linux/raw.h
index 62d543e70603..62d543e70603 100644
--- a/include/linux/raw.h
+++ b/include/uapi/linux/raw.h
diff --git a/include/linux/rds.h b/include/uapi/linux/rds.h
index 91950950aa59..91950950aa59 100644
--- a/include/linux/rds.h
+++ b/include/uapi/linux/rds.h
diff --git a/include/uapi/linux/reboot.h b/include/uapi/linux/reboot.h
new file mode 100644
index 000000000000..09d056d4fc50
--- /dev/null
+++ b/include/uapi/linux/reboot.h
@@ -0,0 +1,39 @@
1#ifndef _UAPI_LINUX_REBOOT_H
2#define _UAPI_LINUX_REBOOT_H
3
4/*
5 * Magic values required to use _reboot() system call.
6 */
7
8#define LINUX_REBOOT_MAGIC1 0xfee1dead
9#define LINUX_REBOOT_MAGIC2 672274793
10#define LINUX_REBOOT_MAGIC2A 85072278
11#define LINUX_REBOOT_MAGIC2B 369367448
12#define LINUX_REBOOT_MAGIC2C 537993216
13
14
15/*
16 * Commands accepted by the _reboot() system call.
17 *
18 * RESTART Restart system using default command and mode.
19 * HALT Stop OS and give system control to ROM monitor, if any.
20 * CAD_ON Ctrl-Alt-Del sequence causes RESTART command.
21 * CAD_OFF Ctrl-Alt-Del sequence sends SIGINT to init task.
22 * POWER_OFF Stop OS and remove all power from system, if possible.
23 * RESTART2 Restart system using given command string.
24 * SW_SUSPEND Suspend system using software suspend if compiled in.
25 * KEXEC Restart system using a previously loaded Linux kernel
26 */
27
28#define LINUX_REBOOT_CMD_RESTART 0x01234567
29#define LINUX_REBOOT_CMD_HALT 0xCDEF0123
30#define LINUX_REBOOT_CMD_CAD_ON 0x89ABCDEF
31#define LINUX_REBOOT_CMD_CAD_OFF 0x00000000
32#define LINUX_REBOOT_CMD_POWER_OFF 0x4321FEDC
33#define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4
34#define LINUX_REBOOT_CMD_SW_SUSPEND 0xD000FCE2
35#define LINUX_REBOOT_CMD_KEXEC 0x45584543
36
37
38
39#endif /* _UAPI_LINUX_REBOOT_H */
diff --git a/include/linux/reiserfs_fs.h b/include/uapi/linux/reiserfs_fs.h
index ea3700cd7367..ea3700cd7367 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/uapi/linux/reiserfs_fs.h
diff --git a/include/linux/reiserfs_xattr.h b/include/uapi/linux/reiserfs_xattr.h
index d8ce17c2459a..d8ce17c2459a 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/uapi/linux/reiserfs_xattr.h
diff --git a/include/uapi/linux/resource.h b/include/uapi/linux/resource.h
new file mode 100644
index 000000000000..e0ed28477f48
--- /dev/null
+++ b/include/uapi/linux/resource.h
@@ -0,0 +1,80 @@
1#ifndef _UAPI_LINUX_RESOURCE_H
2#define _UAPI_LINUX_RESOURCE_H
3
4#include <linux/time.h>
5#include <linux/types.h>
6
7/*
8 * Resource control/accounting header file for linux
9 */
10
11/*
12 * Definition of struct rusage taken from BSD 4.3 Reno
13 *
14 * We don't support all of these yet, but we might as well have them....
15 * Otherwise, each time we add new items, programs which depend on this
16 * structure will lose. This reduces the chances of that happening.
17 */
18#define RUSAGE_SELF 0
19#define RUSAGE_CHILDREN (-1)
20#define RUSAGE_BOTH (-2) /* sys_wait4() uses this */
21#define RUSAGE_THREAD 1 /* only the calling thread */
22
23struct rusage {
24 struct timeval ru_utime; /* user time used */
25 struct timeval ru_stime; /* system time used */
26 long ru_maxrss; /* maximum resident set size */
27 long ru_ixrss; /* integral shared memory size */
28 long ru_idrss; /* integral unshared data size */
29 long ru_isrss; /* integral unshared stack size */
30 long ru_minflt; /* page reclaims */
31 long ru_majflt; /* page faults */
32 long ru_nswap; /* swaps */
33 long ru_inblock; /* block input operations */
34 long ru_oublock; /* block output operations */
35 long ru_msgsnd; /* messages sent */
36 long ru_msgrcv; /* messages received */
37 long ru_nsignals; /* signals received */
38 long ru_nvcsw; /* voluntary context switches */
39 long ru_nivcsw; /* involuntary " */
40};
41
42struct rlimit {
43 unsigned long rlim_cur;
44 unsigned long rlim_max;
45};
46
47#define RLIM64_INFINITY (~0ULL)
48
49struct rlimit64 {
50 __u64 rlim_cur;
51 __u64 rlim_max;
52};
53
54#define PRIO_MIN (-20)
55#define PRIO_MAX 20
56
57#define PRIO_PROCESS 0
58#define PRIO_PGRP 1
59#define PRIO_USER 2
60
61/*
62 * Limit the stack by to some sane default: root can always
63 * increase this limit if needed.. 8MB seems reasonable.
64 */
65#define _STK_LIM (8*1024*1024)
66
67/*
68 * GPG2 wants 64kB of mlocked memory, to make sure pass phrases
69 * and other sensitive information are never written to disk.
70 */
71#define MLOCK_LIMIT ((PAGE_SIZE > 64*1024) ? PAGE_SIZE : 64*1024)
72
73/*
74 * Due to binary compatibility, the actual resource numbers
75 * may be different for different linux versions..
76 */
77#include <asm/resource.h>
78
79
80#endif /* _UAPI_LINUX_RESOURCE_H */
diff --git a/include/uapi/linux/rfkill.h b/include/uapi/linux/rfkill.h
new file mode 100644
index 000000000000..2753c6cc9740
--- /dev/null
+++ b/include/uapi/linux/rfkill.h
@@ -0,0 +1,107 @@
1/*
2 * Copyright (C) 2006 - 2007 Ivo van Doorn
3 * Copyright (C) 2007 Dmitry Torokhov
4 * Copyright 2009 Johannes Berg <johannes@sipsolutions.net>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18#ifndef _UAPI__RFKILL_H
19#define _UAPI__RFKILL_H
20
21
22#include <linux/types.h>
23
24/* define userspace visible states */
25#define RFKILL_STATE_SOFT_BLOCKED 0
26#define RFKILL_STATE_UNBLOCKED 1
27#define RFKILL_STATE_HARD_BLOCKED 2
28
29/**
30 * enum rfkill_type - type of rfkill switch.
31 *
32 * @RFKILL_TYPE_ALL: toggles all switches (requests only - not a switch type)
33 * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device.
34 * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device.
35 * @RFKILL_TYPE_UWB: switch is on a ultra wideband device.
36 * @RFKILL_TYPE_WIMAX: switch is on a WiMAX device.
37 * @RFKILL_TYPE_WWAN: switch is on a wireless WAN device.
38 * @RFKILL_TYPE_GPS: switch is on a GPS device.
39 * @RFKILL_TYPE_FM: switch is on a FM radio device.
40 * @NUM_RFKILL_TYPES: number of defined rfkill types
41 */
42enum rfkill_type {
43 RFKILL_TYPE_ALL = 0,
44 RFKILL_TYPE_WLAN,
45 RFKILL_TYPE_BLUETOOTH,
46 RFKILL_TYPE_UWB,
47 RFKILL_TYPE_WIMAX,
48 RFKILL_TYPE_WWAN,
49 RFKILL_TYPE_GPS,
50 RFKILL_TYPE_FM,
51 NUM_RFKILL_TYPES,
52};
53
54/**
55 * enum rfkill_operation - operation types
56 * @RFKILL_OP_ADD: a device was added
57 * @RFKILL_OP_DEL: a device was removed
58 * @RFKILL_OP_CHANGE: a device's state changed -- userspace changes one device
59 * @RFKILL_OP_CHANGE_ALL: userspace changes all devices (of a type, or all)
60 */
61enum rfkill_operation {
62 RFKILL_OP_ADD = 0,
63 RFKILL_OP_DEL,
64 RFKILL_OP_CHANGE,
65 RFKILL_OP_CHANGE_ALL,
66};
67
68/**
69 * struct rfkill_event - events for userspace on /dev/rfkill
70 * @idx: index of dev rfkill
71 * @type: type of the rfkill struct
72 * @op: operation code
73 * @hard: hard state (0/1)
74 * @soft: soft state (0/1)
75 *
76 * Structure used for userspace communication on /dev/rfkill,
77 * used for events from the kernel and control to the kernel.
78 */
79struct rfkill_event {
80 __u32 idx;
81 __u8 type;
82 __u8 op;
83 __u8 soft, hard;
84} __attribute__((packed));
85
86/*
87 * We are planning to be backward and forward compatible with changes
88 * to the event struct, by adding new, optional, members at the end.
89 * When reading an event (whether the kernel from userspace or vice
90 * versa) we need to accept anything that's at least as large as the
91 * version 1 event size, but might be able to accept other sizes in
92 * the future.
93 *
94 * One exception is the kernel -- we already have two event sizes in
95 * that we've made the 'hard' member optional since our only option
96 * is to ignore it anyway.
97 */
98#define RFKILL_EVENT_SIZE_V1 8
99
100/* ioctl for turning off rfkill-input (if present) */
101#define RFKILL_IOC_MAGIC 'R'
102#define RFKILL_IOC_NOINPUT 1
103#define RFKILL_IOCTL_NOINPUT _IO(RFKILL_IOC_MAGIC, RFKILL_IOC_NOINPUT)
104
105/* and that's all userspace gets */
106
107#endif /* _UAPI__RFKILL_H */
diff --git a/include/linux/romfs_fs.h b/include/uapi/linux/romfs_fs.h
index 5f57f93b284f..5f57f93b284f 100644
--- a/include/linux/romfs_fs.h
+++ b/include/uapi/linux/romfs_fs.h
diff --git a/include/linux/rose.h b/include/uapi/linux/rose.h
index 1fcfe95893b8..1fcfe95893b8 100644
--- a/include/linux/rose.h
+++ b/include/uapi/linux/rose.h
diff --git a/include/linux/route.h b/include/uapi/linux/route.h
index 6600708311c8..6600708311c8 100644
--- a/include/linux/route.h
+++ b/include/uapi/linux/route.h
diff --git a/include/uapi/linux/rtc.h b/include/uapi/linux/rtc.h
new file mode 100644
index 000000000000..f8c82e6f25d5
--- /dev/null
+++ b/include/uapi/linux/rtc.h
@@ -0,0 +1,107 @@
1/*
2 * Generic RTC interface.
3 * This version contains the part of the user interface to the Real Time Clock
4 * service. It is used with both the legacy mc146818 and also EFI
5 * Struct rtc_time and first 12 ioctl by Paul Gortmaker, 1996 - separated out
6 * from <linux/mc146818rtc.h> to this file for 2.4 kernels.
7 *
8 * Copyright (C) 1999 Hewlett-Packard Co.
9 * Copyright (C) 1999 Stephane Eranian <eranian@hpl.hp.com>
10 */
11#ifndef _UAPI_LINUX_RTC_H_
12#define _UAPI_LINUX_RTC_H_
13
14/*
15 * The struct used to pass data via the following ioctl. Similar to the
16 * struct tm in <time.h>, but it needs to be here so that the kernel
17 * source is self contained, allowing cross-compiles, etc. etc.
18 */
19
20struct rtc_time {
21 int tm_sec;
22 int tm_min;
23 int tm_hour;
24 int tm_mday;
25 int tm_mon;
26 int tm_year;
27 int tm_wday;
28 int tm_yday;
29 int tm_isdst;
30};
31
32/*
33 * This data structure is inspired by the EFI (v0.92) wakeup
34 * alarm API.
35 */
36struct rtc_wkalrm {
37 unsigned char enabled; /* 0 = alarm disabled, 1 = alarm enabled */
38 unsigned char pending; /* 0 = alarm not pending, 1 = alarm pending */
39 struct rtc_time time; /* time the alarm is set to */
40};
41
42/*
43 * Data structure to control PLL correction some better RTC feature
44 * pll_value is used to get or set current value of correction,
45 * the rest of the struct is used to query HW capabilities.
46 * This is modeled after the RTC used in Q40/Q60 computers but
47 * should be sufficiently flexible for other devices
48 *
49 * +ve pll_value means clock will run faster by
50 * pll_value*pll_posmult/pll_clock
51 * -ve pll_value means clock will run slower by
52 * pll_value*pll_negmult/pll_clock
53 */
54
55struct rtc_pll_info {
56 int pll_ctrl; /* placeholder for fancier control */
57 int pll_value; /* get/set correction value */
58 int pll_max; /* max +ve (faster) adjustment value */
59 int pll_min; /* max -ve (slower) adjustment value */
60 int pll_posmult; /* factor for +ve correction */
61 int pll_negmult; /* factor for -ve correction */
62 long pll_clock; /* base PLL frequency */
63};
64
65/*
66 * ioctl calls that are permitted to the /dev/rtc interface, if
67 * any of the RTC drivers are enabled.
68 */
69
70#define RTC_AIE_ON _IO('p', 0x01) /* Alarm int. enable on */
71#define RTC_AIE_OFF _IO('p', 0x02) /* ... off */
72#define RTC_UIE_ON _IO('p', 0x03) /* Update int. enable on */
73#define RTC_UIE_OFF _IO('p', 0x04) /* ... off */
74#define RTC_PIE_ON _IO('p', 0x05) /* Periodic int. enable on */
75#define RTC_PIE_OFF _IO('p', 0x06) /* ... off */
76#define RTC_WIE_ON _IO('p', 0x0f) /* Watchdog int. enable on */
77#define RTC_WIE_OFF _IO('p', 0x10) /* ... off */
78
79#define RTC_ALM_SET _IOW('p', 0x07, struct rtc_time) /* Set alarm time */
80#define RTC_ALM_READ _IOR('p', 0x08, struct rtc_time) /* Read alarm time */
81#define RTC_RD_TIME _IOR('p', 0x09, struct rtc_time) /* Read RTC time */
82#define RTC_SET_TIME _IOW('p', 0x0a, struct rtc_time) /* Set RTC time */
83#define RTC_IRQP_READ _IOR('p', 0x0b, unsigned long) /* Read IRQ rate */
84#define RTC_IRQP_SET _IOW('p', 0x0c, unsigned long) /* Set IRQ rate */
85#define RTC_EPOCH_READ _IOR('p', 0x0d, unsigned long) /* Read epoch */
86#define RTC_EPOCH_SET _IOW('p', 0x0e, unsigned long) /* Set epoch */
87
88#define RTC_WKALM_SET _IOW('p', 0x0f, struct rtc_wkalrm)/* Set wakeup alarm*/
89#define RTC_WKALM_RD _IOR('p', 0x10, struct rtc_wkalrm)/* Get wakeup alarm*/
90
91#define RTC_PLL_GET _IOR('p', 0x11, struct rtc_pll_info) /* Get PLL correction */
92#define RTC_PLL_SET _IOW('p', 0x12, struct rtc_pll_info) /* Set PLL correction */
93
94#define RTC_VL_READ _IOR('p', 0x13, int) /* Voltage low detector */
95#define RTC_VL_CLR _IO('p', 0x14) /* Clear voltage low information */
96
97/* interrupt flags */
98#define RTC_IRQF 0x80 /* Any of the following is active */
99#define RTC_PF 0x40 /* Periodic interrupt */
100#define RTC_AF 0x20 /* Alarm interrupt */
101#define RTC_UF 0x10 /* Update interrupt for 1Hz RTC */
102
103
104#define RTC_MAX_FREQ 8192
105
106
107#endif /* _UAPI_LINUX_RTC_H_ */
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h
new file mode 100644
index 000000000000..fcd768b09f6e
--- /dev/null
+++ b/include/uapi/linux/rtnetlink.h
@@ -0,0 +1,612 @@
1#ifndef _UAPI__LINUX_RTNETLINK_H
2#define _UAPI__LINUX_RTNETLINK_H
3
4#include <linux/types.h>
5#include <linux/netlink.h>
6#include <linux/if_link.h>
7#include <linux/if_addr.h>
8#include <linux/neighbour.h>
9
10/* rtnetlink families. Values up to 127 are reserved for real address
11 * families, values above 128 may be used arbitrarily.
12 */
13#define RTNL_FAMILY_IPMR 128
14#define RTNL_FAMILY_IP6MR 129
15#define RTNL_FAMILY_MAX 129
16
17/****
18 * Routing/neighbour discovery messages.
19 ****/
20
21/* Types of messages */
22
23enum {
24 RTM_BASE = 16,
25#define RTM_BASE RTM_BASE
26
27 RTM_NEWLINK = 16,
28#define RTM_NEWLINK RTM_NEWLINK
29 RTM_DELLINK,
30#define RTM_DELLINK RTM_DELLINK
31 RTM_GETLINK,
32#define RTM_GETLINK RTM_GETLINK
33 RTM_SETLINK,
34#define RTM_SETLINK RTM_SETLINK
35
36 RTM_NEWADDR = 20,
37#define RTM_NEWADDR RTM_NEWADDR
38 RTM_DELADDR,
39#define RTM_DELADDR RTM_DELADDR
40 RTM_GETADDR,
41#define RTM_GETADDR RTM_GETADDR
42
43 RTM_NEWROUTE = 24,
44#define RTM_NEWROUTE RTM_NEWROUTE
45 RTM_DELROUTE,
46#define RTM_DELROUTE RTM_DELROUTE
47 RTM_GETROUTE,
48#define RTM_GETROUTE RTM_GETROUTE
49
50 RTM_NEWNEIGH = 28,
51#define RTM_NEWNEIGH RTM_NEWNEIGH
52 RTM_DELNEIGH,
53#define RTM_DELNEIGH RTM_DELNEIGH
54 RTM_GETNEIGH,
55#define RTM_GETNEIGH RTM_GETNEIGH
56
57 RTM_NEWRULE = 32,
58#define RTM_NEWRULE RTM_NEWRULE
59 RTM_DELRULE,
60#define RTM_DELRULE RTM_DELRULE
61 RTM_GETRULE,
62#define RTM_GETRULE RTM_GETRULE
63
64 RTM_NEWQDISC = 36,
65#define RTM_NEWQDISC RTM_NEWQDISC
66 RTM_DELQDISC,
67#define RTM_DELQDISC RTM_DELQDISC
68 RTM_GETQDISC,
69#define RTM_GETQDISC RTM_GETQDISC
70
71 RTM_NEWTCLASS = 40,
72#define RTM_NEWTCLASS RTM_NEWTCLASS
73 RTM_DELTCLASS,
74#define RTM_DELTCLASS RTM_DELTCLASS
75 RTM_GETTCLASS,
76#define RTM_GETTCLASS RTM_GETTCLASS
77
78 RTM_NEWTFILTER = 44,
79#define RTM_NEWTFILTER RTM_NEWTFILTER
80 RTM_DELTFILTER,
81#define RTM_DELTFILTER RTM_DELTFILTER
82 RTM_GETTFILTER,
83#define RTM_GETTFILTER RTM_GETTFILTER
84
85 RTM_NEWACTION = 48,
86#define RTM_NEWACTION RTM_NEWACTION
87 RTM_DELACTION,
88#define RTM_DELACTION RTM_DELACTION
89 RTM_GETACTION,
90#define RTM_GETACTION RTM_GETACTION
91
92 RTM_NEWPREFIX = 52,
93#define RTM_NEWPREFIX RTM_NEWPREFIX
94
95 RTM_GETMULTICAST = 58,
96#define RTM_GETMULTICAST RTM_GETMULTICAST
97
98 RTM_GETANYCAST = 62,
99#define RTM_GETANYCAST RTM_GETANYCAST
100
101 RTM_NEWNEIGHTBL = 64,
102#define RTM_NEWNEIGHTBL RTM_NEWNEIGHTBL
103 RTM_GETNEIGHTBL = 66,
104#define RTM_GETNEIGHTBL RTM_GETNEIGHTBL
105 RTM_SETNEIGHTBL,
106#define RTM_SETNEIGHTBL RTM_SETNEIGHTBL
107
108 RTM_NEWNDUSEROPT = 68,
109#define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT
110
111 RTM_NEWADDRLABEL = 72,
112#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL
113 RTM_DELADDRLABEL,
114#define RTM_DELADDRLABEL RTM_DELADDRLABEL
115 RTM_GETADDRLABEL,
116#define RTM_GETADDRLABEL RTM_GETADDRLABEL
117
118 RTM_GETDCB = 78,
119#define RTM_GETDCB RTM_GETDCB
120 RTM_SETDCB,
121#define RTM_SETDCB RTM_SETDCB
122
123 __RTM_MAX,
124#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
125};
126
127#define RTM_NR_MSGTYPES (RTM_MAX + 1 - RTM_BASE)
128#define RTM_NR_FAMILIES (RTM_NR_MSGTYPES >> 2)
129#define RTM_FAM(cmd) (((cmd) - RTM_BASE) >> 2)
130
131/*
132 Generic structure for encapsulation of optional route information.
133 It is reminiscent of sockaddr, but with sa_family replaced
134 with attribute type.
135 */
136
137struct rtattr {
138 unsigned short rta_len;
139 unsigned short rta_type;
140};
141
142/* Macros to handle rtattributes */
143
144#define RTA_ALIGNTO 4
145#define RTA_ALIGN(len) ( ((len)+RTA_ALIGNTO-1) & ~(RTA_ALIGNTO-1) )
146#define RTA_OK(rta,len) ((len) >= (int)sizeof(struct rtattr) && \
147 (rta)->rta_len >= sizeof(struct rtattr) && \
148 (rta)->rta_len <= (len))
149#define RTA_NEXT(rta,attrlen) ((attrlen) -= RTA_ALIGN((rta)->rta_len), \
150 (struct rtattr*)(((char*)(rta)) + RTA_ALIGN((rta)->rta_len)))
151#define RTA_LENGTH(len) (RTA_ALIGN(sizeof(struct rtattr)) + (len))
152#define RTA_SPACE(len) RTA_ALIGN(RTA_LENGTH(len))
153#define RTA_DATA(rta) ((void*)(((char*)(rta)) + RTA_LENGTH(0)))
154#define RTA_PAYLOAD(rta) ((int)((rta)->rta_len) - RTA_LENGTH(0))
155
156
157
158
159/******************************************************************************
160 * Definitions used in routing table administration.
161 ****/
162
163struct rtmsg {
164 unsigned char rtm_family;
165 unsigned char rtm_dst_len;
166 unsigned char rtm_src_len;
167 unsigned char rtm_tos;
168
169 unsigned char rtm_table; /* Routing table id */
170 unsigned char rtm_protocol; /* Routing protocol; see below */
171 unsigned char rtm_scope; /* See below */
172 unsigned char rtm_type; /* See below */
173
174 unsigned rtm_flags;
175};
176
177/* rtm_type */
178
179enum {
180 RTN_UNSPEC,
181 RTN_UNICAST, /* Gateway or direct route */
182 RTN_LOCAL, /* Accept locally */
183 RTN_BROADCAST, /* Accept locally as broadcast,
184 send as broadcast */
185 RTN_ANYCAST, /* Accept locally as broadcast,
186 but send as unicast */
187 RTN_MULTICAST, /* Multicast route */
188 RTN_BLACKHOLE, /* Drop */
189 RTN_UNREACHABLE, /* Destination is unreachable */
190 RTN_PROHIBIT, /* Administratively prohibited */
191 RTN_THROW, /* Not in this table */
192 RTN_NAT, /* Translate this address */
193 RTN_XRESOLVE, /* Use external resolver */
194 __RTN_MAX
195};
196
197#define RTN_MAX (__RTN_MAX - 1)
198
199
200/* rtm_protocol */
201
202#define RTPROT_UNSPEC 0
203#define RTPROT_REDIRECT 1 /* Route installed by ICMP redirects;
204 not used by current IPv4 */
205#define RTPROT_KERNEL 2 /* Route installed by kernel */
206#define RTPROT_BOOT 3 /* Route installed during boot */
207#define RTPROT_STATIC 4 /* Route installed by administrator */
208
209/* Values of protocol >= RTPROT_STATIC are not interpreted by kernel;
210 they are just passed from user and back as is.
211 It will be used by hypothetical multiple routing daemons.
212 Note that protocol values should be standardized in order to
213 avoid conflicts.
214 */
215
216#define RTPROT_GATED 8 /* Apparently, GateD */
217#define RTPROT_RA 9 /* RDISC/ND router advertisements */
218#define RTPROT_MRT 10 /* Merit MRT */
219#define RTPROT_ZEBRA 11 /* Zebra */
220#define RTPROT_BIRD 12 /* BIRD */
221#define RTPROT_DNROUTED 13 /* DECnet routing daemon */
222#define RTPROT_XORP 14 /* XORP */
223#define RTPROT_NTK 15 /* Netsukuku */
224#define RTPROT_DHCP 16 /* DHCP client */
225
226/* rtm_scope
227
228 Really it is not scope, but sort of distance to the destination.
229 NOWHERE are reserved for not existing destinations, HOST is our
230 local addresses, LINK are destinations, located on directly attached
231 link and UNIVERSE is everywhere in the Universe.
232
233 Intermediate values are also possible f.e. interior routes
234 could be assigned a value between UNIVERSE and LINK.
235*/
236
237enum rt_scope_t {
238 RT_SCOPE_UNIVERSE=0,
239/* User defined values */
240 RT_SCOPE_SITE=200,
241 RT_SCOPE_LINK=253,
242 RT_SCOPE_HOST=254,
243 RT_SCOPE_NOWHERE=255
244};
245
246/* rtm_flags */
247
248#define RTM_F_NOTIFY 0x100 /* Notify user of route change */
249#define RTM_F_CLONED 0x200 /* This route is cloned */
250#define RTM_F_EQUALIZE 0x400 /* Multipath equalizer: NI */
251#define RTM_F_PREFIX 0x800 /* Prefix addresses */
252
253/* Reserved table identifiers */
254
255enum rt_class_t {
256 RT_TABLE_UNSPEC=0,
257/* User defined values */
258 RT_TABLE_COMPAT=252,
259 RT_TABLE_DEFAULT=253,
260 RT_TABLE_MAIN=254,
261 RT_TABLE_LOCAL=255,
262 RT_TABLE_MAX=0xFFFFFFFF
263};
264
265
266/* Routing message attributes */
267
268enum rtattr_type_t {
269 RTA_UNSPEC,
270 RTA_DST,
271 RTA_SRC,
272 RTA_IIF,
273 RTA_OIF,
274 RTA_GATEWAY,
275 RTA_PRIORITY,
276 RTA_PREFSRC,
277 RTA_METRICS,
278 RTA_MULTIPATH,
279 RTA_PROTOINFO, /* no longer used */
280 RTA_FLOW,
281 RTA_CACHEINFO,
282 RTA_SESSION, /* no longer used */
283 RTA_MP_ALGO, /* no longer used */
284 RTA_TABLE,
285 RTA_MARK,
286 __RTA_MAX
287};
288
289#define RTA_MAX (__RTA_MAX - 1)
290
291#define RTM_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct rtmsg))))
292#define RTM_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct rtmsg))
293
294/* RTM_MULTIPATH --- array of struct rtnexthop.
295 *
296 * "struct rtnexthop" describes all necessary nexthop information,
297 * i.e. parameters of path to a destination via this nexthop.
298 *
299 * At the moment it is impossible to set different prefsrc, mtu, window
300 * and rtt for different paths from multipath.
301 */
302
303struct rtnexthop {
304 unsigned short rtnh_len;
305 unsigned char rtnh_flags;
306 unsigned char rtnh_hops;
307 int rtnh_ifindex;
308};
309
310/* rtnh_flags */
311
312#define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */
313#define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */
314#define RTNH_F_ONLINK 4 /* Gateway is forced on link */
315
316/* Macros to handle hexthops */
317
318#define RTNH_ALIGNTO 4
319#define RTNH_ALIGN(len) ( ((len)+RTNH_ALIGNTO-1) & ~(RTNH_ALIGNTO-1) )
320#define RTNH_OK(rtnh,len) ((rtnh)->rtnh_len >= sizeof(struct rtnexthop) && \
321 ((int)(rtnh)->rtnh_len) <= (len))
322#define RTNH_NEXT(rtnh) ((struct rtnexthop*)(((char*)(rtnh)) + RTNH_ALIGN((rtnh)->rtnh_len)))
323#define RTNH_LENGTH(len) (RTNH_ALIGN(sizeof(struct rtnexthop)) + (len))
324#define RTNH_SPACE(len) RTNH_ALIGN(RTNH_LENGTH(len))
325#define RTNH_DATA(rtnh) ((struct rtattr*)(((char*)(rtnh)) + RTNH_LENGTH(0)))
326
327/* RTM_CACHEINFO */
328
329struct rta_cacheinfo {
330 __u32 rta_clntref;
331 __u32 rta_lastuse;
332 __s32 rta_expires;
333 __u32 rta_error;
334 __u32 rta_used;
335
336#define RTNETLINK_HAVE_PEERINFO 1
337 __u32 rta_id;
338 __u32 rta_ts;
339 __u32 rta_tsage;
340};
341
342/* RTM_METRICS --- array of struct rtattr with types of RTAX_* */
343
344enum {
345 RTAX_UNSPEC,
346#define RTAX_UNSPEC RTAX_UNSPEC
347 RTAX_LOCK,
348#define RTAX_LOCK RTAX_LOCK
349 RTAX_MTU,
350#define RTAX_MTU RTAX_MTU
351 RTAX_WINDOW,
352#define RTAX_WINDOW RTAX_WINDOW
353 RTAX_RTT,
354#define RTAX_RTT RTAX_RTT
355 RTAX_RTTVAR,
356#define RTAX_RTTVAR RTAX_RTTVAR
357 RTAX_SSTHRESH,
358#define RTAX_SSTHRESH RTAX_SSTHRESH
359 RTAX_CWND,
360#define RTAX_CWND RTAX_CWND
361 RTAX_ADVMSS,
362#define RTAX_ADVMSS RTAX_ADVMSS
363 RTAX_REORDERING,
364#define RTAX_REORDERING RTAX_REORDERING
365 RTAX_HOPLIMIT,
366#define RTAX_HOPLIMIT RTAX_HOPLIMIT
367 RTAX_INITCWND,
368#define RTAX_INITCWND RTAX_INITCWND
369 RTAX_FEATURES,
370#define RTAX_FEATURES RTAX_FEATURES
371 RTAX_RTO_MIN,
372#define RTAX_RTO_MIN RTAX_RTO_MIN
373 RTAX_INITRWND,
374#define RTAX_INITRWND RTAX_INITRWND
375 __RTAX_MAX
376};
377
378#define RTAX_MAX (__RTAX_MAX - 1)
379
380#define RTAX_FEATURE_ECN 0x00000001
381#define RTAX_FEATURE_SACK 0x00000002
382#define RTAX_FEATURE_TIMESTAMP 0x00000004
383#define RTAX_FEATURE_ALLFRAG 0x00000008
384
385struct rta_session {
386 __u8 proto;
387 __u8 pad1;
388 __u16 pad2;
389
390 union {
391 struct {
392 __u16 sport;
393 __u16 dport;
394 } ports;
395
396 struct {
397 __u8 type;
398 __u8 code;
399 __u16 ident;
400 } icmpt;
401
402 __u32 spi;
403 } u;
404};
405
406/****
407 * General form of address family dependent message.
408 ****/
409
410struct rtgenmsg {
411 unsigned char rtgen_family;
412};
413
414/*****************************************************************
415 * Link layer specific messages.
416 ****/
417
418/* struct ifinfomsg
419 * passes link level specific information, not dependent
420 * on network protocol.
421 */
422
423struct ifinfomsg {
424 unsigned char ifi_family;
425 unsigned char __ifi_pad;
426 unsigned short ifi_type; /* ARPHRD_* */
427 int ifi_index; /* Link index */
428 unsigned ifi_flags; /* IFF_* flags */
429 unsigned ifi_change; /* IFF_* change mask */
430};
431
432/********************************************************************
433 * prefix information
434 ****/
435
436struct prefixmsg {
437 unsigned char prefix_family;
438 unsigned char prefix_pad1;
439 unsigned short prefix_pad2;
440 int prefix_ifindex;
441 unsigned char prefix_type;
442 unsigned char prefix_len;
443 unsigned char prefix_flags;
444 unsigned char prefix_pad3;
445};
446
447enum
448{
449 PREFIX_UNSPEC,
450 PREFIX_ADDRESS,
451 PREFIX_CACHEINFO,
452 __PREFIX_MAX
453};
454
455#define PREFIX_MAX (__PREFIX_MAX - 1)
456
457struct prefix_cacheinfo {
458 __u32 preferred_time;
459 __u32 valid_time;
460};
461
462
463/*****************************************************************
464 * Traffic control messages.
465 ****/
466
467struct tcmsg {
468 unsigned char tcm_family;
469 unsigned char tcm__pad1;
470 unsigned short tcm__pad2;
471 int tcm_ifindex;
472 __u32 tcm_handle;
473 __u32 tcm_parent;
474 __u32 tcm_info;
475};
476
477enum {
478 TCA_UNSPEC,
479 TCA_KIND,
480 TCA_OPTIONS,
481 TCA_STATS,
482 TCA_XSTATS,
483 TCA_RATE,
484 TCA_FCNT,
485 TCA_STATS2,
486 TCA_STAB,
487 __TCA_MAX
488};
489
490#define TCA_MAX (__TCA_MAX - 1)
491
492#define TCA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg))))
493#define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg))
494
495/********************************************************************
496 * Neighbor Discovery userland options
497 ****/
498
499struct nduseroptmsg {
500 unsigned char nduseropt_family;
501 unsigned char nduseropt_pad1;
502 unsigned short nduseropt_opts_len; /* Total length of options */
503 int nduseropt_ifindex;
504 __u8 nduseropt_icmp_type;
505 __u8 nduseropt_icmp_code;
506 unsigned short nduseropt_pad2;
507 unsigned int nduseropt_pad3;
508 /* Followed by one or more ND options */
509};
510
511enum {
512 NDUSEROPT_UNSPEC,
513 NDUSEROPT_SRCADDR,
514 __NDUSEROPT_MAX
515};
516
517#define NDUSEROPT_MAX (__NDUSEROPT_MAX - 1)
518
519#ifndef __KERNEL__
520/* RTnetlink multicast groups - backwards compatibility for userspace */
521#define RTMGRP_LINK 1
522#define RTMGRP_NOTIFY 2
523#define RTMGRP_NEIGH 4
524#define RTMGRP_TC 8
525
526#define RTMGRP_IPV4_IFADDR 0x10
527#define RTMGRP_IPV4_MROUTE 0x20
528#define RTMGRP_IPV4_ROUTE 0x40
529#define RTMGRP_IPV4_RULE 0x80
530
531#define RTMGRP_IPV6_IFADDR 0x100
532#define RTMGRP_IPV6_MROUTE 0x200
533#define RTMGRP_IPV6_ROUTE 0x400
534#define RTMGRP_IPV6_IFINFO 0x800
535
536#define RTMGRP_DECnet_IFADDR 0x1000
537#define RTMGRP_DECnet_ROUTE 0x4000
538
539#define RTMGRP_IPV6_PREFIX 0x20000
540#endif
541
542/* RTnetlink multicast groups */
543enum rtnetlink_groups {
544 RTNLGRP_NONE,
545#define RTNLGRP_NONE RTNLGRP_NONE
546 RTNLGRP_LINK,
547#define RTNLGRP_LINK RTNLGRP_LINK
548 RTNLGRP_NOTIFY,
549#define RTNLGRP_NOTIFY RTNLGRP_NOTIFY
550 RTNLGRP_NEIGH,
551#define RTNLGRP_NEIGH RTNLGRP_NEIGH
552 RTNLGRP_TC,
553#define RTNLGRP_TC RTNLGRP_TC
554 RTNLGRP_IPV4_IFADDR,
555#define RTNLGRP_IPV4_IFADDR RTNLGRP_IPV4_IFADDR
556 RTNLGRP_IPV4_MROUTE,
557#define RTNLGRP_IPV4_MROUTE RTNLGRP_IPV4_MROUTE
558 RTNLGRP_IPV4_ROUTE,
559#define RTNLGRP_IPV4_ROUTE RTNLGRP_IPV4_ROUTE
560 RTNLGRP_IPV4_RULE,
561#define RTNLGRP_IPV4_RULE RTNLGRP_IPV4_RULE
562 RTNLGRP_IPV6_IFADDR,
563#define RTNLGRP_IPV6_IFADDR RTNLGRP_IPV6_IFADDR
564 RTNLGRP_IPV6_MROUTE,
565#define RTNLGRP_IPV6_MROUTE RTNLGRP_IPV6_MROUTE
566 RTNLGRP_IPV6_ROUTE,
567#define RTNLGRP_IPV6_ROUTE RTNLGRP_IPV6_ROUTE
568 RTNLGRP_IPV6_IFINFO,
569#define RTNLGRP_IPV6_IFINFO RTNLGRP_IPV6_IFINFO
570 RTNLGRP_DECnet_IFADDR,
571#define RTNLGRP_DECnet_IFADDR RTNLGRP_DECnet_IFADDR
572 RTNLGRP_NOP2,
573 RTNLGRP_DECnet_ROUTE,
574#define RTNLGRP_DECnet_ROUTE RTNLGRP_DECnet_ROUTE
575 RTNLGRP_DECnet_RULE,
576#define RTNLGRP_DECnet_RULE RTNLGRP_DECnet_RULE
577 RTNLGRP_NOP4,
578 RTNLGRP_IPV6_PREFIX,
579#define RTNLGRP_IPV6_PREFIX RTNLGRP_IPV6_PREFIX
580 RTNLGRP_IPV6_RULE,
581#define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE
582 RTNLGRP_ND_USEROPT,
583#define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT
584 RTNLGRP_PHONET_IFADDR,
585#define RTNLGRP_PHONET_IFADDR RTNLGRP_PHONET_IFADDR
586 RTNLGRP_PHONET_ROUTE,
587#define RTNLGRP_PHONET_ROUTE RTNLGRP_PHONET_ROUTE
588 RTNLGRP_DCB,
589#define RTNLGRP_DCB RTNLGRP_DCB
590 __RTNLGRP_MAX
591};
592#define RTNLGRP_MAX (__RTNLGRP_MAX - 1)
593
594/* TC action piece */
595struct tcamsg {
596 unsigned char tca_family;
597 unsigned char tca__pad1;
598 unsigned short tca__pad2;
599};
600#define TA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcamsg))))
601#define TA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcamsg))
602#define TCA_ACT_TAB 1 /* attr type must be >=1 */
603#define TCAA_MAX 1
604
605/* New extended info filters for IFLA_EXT_MASK */
606#define RTEXT_FILTER_VF (1 << 0)
607
608/* End of information exported to user level */
609
610
611
612#endif /* _UAPI__LINUX_RTNETLINK_H */
diff --git a/include/uapi/linux/scc.h b/include/uapi/linux/scc.h
new file mode 100644
index 000000000000..72b6b8153374
--- /dev/null
+++ b/include/uapi/linux/scc.h
@@ -0,0 +1,172 @@
1/* $Id: scc.h,v 1.29 1997/04/02 14:56:45 jreuter Exp jreuter $ */
2
3#ifndef _UAPI_SCC_H
4#define _UAPI_SCC_H
5
6
7/* selection of hardware types */
8
9#define PA0HZP 0x00 /* hardware type for PA0HZP SCC card and compatible */
10#define EAGLE 0x01 /* hardware type for EAGLE card */
11#define PC100 0x02 /* hardware type for PC100 card */
12#define PRIMUS 0x04 /* hardware type for PRIMUS-PC (DG9BL) card */
13#define DRSI 0x08 /* hardware type for DRSI PC*Packet card */
14#define BAYCOM 0x10 /* hardware type for BayCom (U)SCC */
15
16/* DEV ioctl() commands */
17
18enum SCC_ioctl_cmds {
19 SIOCSCCRESERVED = SIOCDEVPRIVATE,
20 SIOCSCCCFG,
21 SIOCSCCINI,
22 SIOCSCCCHANINI,
23 SIOCSCCSMEM,
24 SIOCSCCGKISS,
25 SIOCSCCSKISS,
26 SIOCSCCGSTAT,
27 SIOCSCCCAL
28};
29
30/* Device parameter control (from WAMPES) */
31
32enum L1_params {
33 PARAM_DATA,
34 PARAM_TXDELAY,
35 PARAM_PERSIST,
36 PARAM_SLOTTIME,
37 PARAM_TXTAIL,
38 PARAM_FULLDUP,
39 PARAM_SOFTDCD, /* was: PARAM_HW */
40 PARAM_MUTE, /* ??? */
41 PARAM_DTR,
42 PARAM_RTS,
43 PARAM_SPEED,
44 PARAM_ENDDELAY, /* ??? */
45 PARAM_GROUP,
46 PARAM_IDLE,
47 PARAM_MIN,
48 PARAM_MAXKEY,
49 PARAM_WAIT,
50 PARAM_MAXDEFER,
51 PARAM_TX,
52 PARAM_HWEVENT = 31,
53 PARAM_RETURN = 255 /* reset kiss mode */
54};
55
56/* fulldup parameter */
57
58enum FULLDUP_modes {
59 KISS_DUPLEX_HALF, /* normal CSMA operation */
60 KISS_DUPLEX_FULL, /* fullduplex, key down trx after transmission */
61 KISS_DUPLEX_LINK, /* fullduplex, key down trx after 'idletime' sec */
62 KISS_DUPLEX_OPTIMA /* fullduplex, let the protocol layer control the hw */
63};
64
65/* misc. parameters */
66
67#define TIMER_OFF 65535U /* to switch off timers */
68#define NO_SUCH_PARAM 65534U /* param not implemented */
69
70/* HWEVENT parameter */
71
72enum HWEVENT_opts {
73 HWEV_DCD_ON,
74 HWEV_DCD_OFF,
75 HWEV_ALL_SENT
76};
77
78/* channel grouping */
79
80#define RXGROUP 0100 /* if set, only tx when all channels clear */
81#define TXGROUP 0200 /* if set, don't transmit simultaneously */
82
83/* Tx/Rx clock sources */
84
85enum CLOCK_sources {
86 CLK_DPLL, /* normal halfduplex operation */
87 CLK_EXTERNAL, /* external clocking (G3RUH/DF9IC modems) */
88 CLK_DIVIDER, /* Rx = DPLL, Tx = divider (fullduplex with */
89 /* modems without clock regeneration */
90 CLK_BRG /* experimental fullduplex mode with DPLL/BRG for */
91 /* MODEMs without clock recovery */
92};
93
94/* Tx state */
95
96enum TX_state {
97 TXS_IDLE, /* Transmitter off, no data pending */
98 TXS_BUSY, /* waiting for permission to send / tailtime */
99 TXS_ACTIVE, /* Transmitter on, sending data */
100 TXS_NEWFRAME, /* reset CRC and send (next) frame */
101 TXS_IDLE2, /* Transmitter on, no data pending */
102 TXS_WAIT, /* Waiting for Mintime to expire */
103 TXS_TIMEOUT /* We had a transmission timeout */
104};
105
106typedef unsigned long io_port; /* type definition for an 'io port address' */
107
108/* SCC statistical information */
109
110struct scc_stat {
111 long rxints; /* Receiver interrupts */
112 long txints; /* Transmitter interrupts */
113 long exints; /* External/status interrupts */
114 long spints; /* Special receiver interrupts */
115
116 long txframes; /* Packets sent */
117 long rxframes; /* Number of Frames Actually Received */
118 long rxerrs; /* CRC Errors */
119 long txerrs; /* KISS errors */
120
121 unsigned int nospace; /* "Out of buffers" */
122 unsigned int rx_over; /* Receiver Overruns */
123 unsigned int tx_under; /* Transmitter Underruns */
124
125 unsigned int tx_state; /* Transmitter state */
126 int tx_queued; /* tx frames enqueued */
127
128 unsigned int maxqueue; /* allocated tx_buffers */
129 unsigned int bufsize; /* used buffersize */
130};
131
132struct scc_modem {
133 long speed; /* Line speed, bps */
134 char clocksrc; /* 0 = DPLL, 1 = external, 2 = divider */
135 char nrz; /* NRZ instead of NRZI */
136};
137
138struct scc_kiss_cmd {
139 int command; /* one of the KISS-Commands defined above */
140 unsigned param; /* KISS-Param */
141};
142
143struct scc_hw_config {
144 io_port data_a; /* data port channel A */
145 io_port ctrl_a; /* control port channel A */
146 io_port data_b; /* data port channel B */
147 io_port ctrl_b; /* control port channel B */
148 io_port vector_latch; /* INTACK-Latch (#) */
149 io_port special; /* special function port */
150
151 int irq; /* irq */
152 long clock; /* clock */
153 char option; /* command for function port */
154
155 char brand; /* hardware type */
156 char escc; /* use ext. features of a 8580/85180/85280 */
157};
158
159/* (#) only one INTACK latch allowed. */
160
161
162struct scc_mem_config {
163 unsigned int dummy;
164 unsigned int bufsize;
165};
166
167struct scc_calibrate {
168 unsigned int time;
169 unsigned char pattern;
170};
171
172#endif /* _UAPI_SCC_H */
diff --git a/include/uapi/linux/sched.h b/include/uapi/linux/sched.h
new file mode 100644
index 000000000000..5a0f945927ac
--- /dev/null
+++ b/include/uapi/linux/sched.h
@@ -0,0 +1,46 @@
1#ifndef _UAPI_LINUX_SCHED_H
2#define _UAPI_LINUX_SCHED_H
3
4/*
5 * cloning flags:
6 */
7#define CSIGNAL 0x000000ff /* signal mask to be sent at exit */
8#define CLONE_VM 0x00000100 /* set if VM shared between processes */
9#define CLONE_FS 0x00000200 /* set if fs info shared between processes */
10#define CLONE_FILES 0x00000400 /* set if open files shared between processes */
11#define CLONE_SIGHAND 0x00000800 /* set if signal handlers and blocked signals shared */
12#define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */
13#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */
14#define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */
15#define CLONE_THREAD 0x00010000 /* Same thread group? */
16#define CLONE_NEWNS 0x00020000 /* New namespace group? */
17#define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */
18#define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */
19#define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */
20#define CLONE_CHILD_CLEARTID 0x00200000 /* clear the TID in the child */
21#define CLONE_DETACHED 0x00400000 /* Unused, ignored */
22#define CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */
23#define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */
24/* 0x02000000 was previously the unused CLONE_STOPPED (Start in stopped state)
25 and is now available for re-use. */
26#define CLONE_NEWUTS 0x04000000 /* New utsname group? */
27#define CLONE_NEWIPC 0x08000000 /* New ipcs */
28#define CLONE_NEWUSER 0x10000000 /* New user namespace */
29#define CLONE_NEWPID 0x20000000 /* New pid namespace */
30#define CLONE_NEWNET 0x40000000 /* New network namespace */
31#define CLONE_IO 0x80000000 /* Clone io context */
32
33/*
34 * Scheduling policies
35 */
36#define SCHED_NORMAL 0
37#define SCHED_FIFO 1
38#define SCHED_RR 2
39#define SCHED_BATCH 3
40/* SCHED_ISO: reserved but not implemented yet */
41#define SCHED_IDLE 5
42/* Can be ORed in to make sure the process is reverted back to SCHED_NORMAL on fork */
43#define SCHED_RESET_ON_FORK 0x40000000
44
45
46#endif /* _UAPI_LINUX_SCHED_H */
diff --git a/include/uapi/linux/screen_info.h b/include/uapi/linux/screen_info.h
new file mode 100644
index 000000000000..7530e7447620
--- /dev/null
+++ b/include/uapi/linux/screen_info.h
@@ -0,0 +1,74 @@
1#ifndef _UAPI_SCREEN_INFO_H
2#define _UAPI_SCREEN_INFO_H
3
4#include <linux/types.h>
5
6/*
7 * These are set up by the setup-routine at boot-time:
8 */
9
10struct screen_info {
11 __u8 orig_x; /* 0x00 */
12 __u8 orig_y; /* 0x01 */
13 __u16 ext_mem_k; /* 0x02 */
14 __u16 orig_video_page; /* 0x04 */
15 __u8 orig_video_mode; /* 0x06 */
16 __u8 orig_video_cols; /* 0x07 */
17 __u8 flags; /* 0x08 */
18 __u8 unused2; /* 0x09 */
19 __u16 orig_video_ega_bx;/* 0x0a */
20 __u16 unused3; /* 0x0c */
21 __u8 orig_video_lines; /* 0x0e */
22 __u8 orig_video_isVGA; /* 0x0f */
23 __u16 orig_video_points;/* 0x10 */
24
25 /* VESA graphic mode -- linear frame buffer */
26 __u16 lfb_width; /* 0x12 */
27 __u16 lfb_height; /* 0x14 */
28 __u16 lfb_depth; /* 0x16 */
29 __u32 lfb_base; /* 0x18 */
30 __u32 lfb_size; /* 0x1c */
31 __u16 cl_magic, cl_offset; /* 0x20 */
32 __u16 lfb_linelength; /* 0x24 */
33 __u8 red_size; /* 0x26 */
34 __u8 red_pos; /* 0x27 */
35 __u8 green_size; /* 0x28 */
36 __u8 green_pos; /* 0x29 */
37 __u8 blue_size; /* 0x2a */
38 __u8 blue_pos; /* 0x2b */
39 __u8 rsvd_size; /* 0x2c */
40 __u8 rsvd_pos; /* 0x2d */
41 __u16 vesapm_seg; /* 0x2e */
42 __u16 vesapm_off; /* 0x30 */
43 __u16 pages; /* 0x32 */
44 __u16 vesa_attributes; /* 0x34 */
45 __u32 capabilities; /* 0x36 */
46 __u8 _reserved[6]; /* 0x3a */
47} __attribute__((packed));
48
49#define VIDEO_TYPE_MDA 0x10 /* Monochrome Text Display */
50#define VIDEO_TYPE_CGA 0x11 /* CGA Display */
51#define VIDEO_TYPE_EGAM 0x20 /* EGA/VGA in Monochrome Mode */
52#define VIDEO_TYPE_EGAC 0x21 /* EGA in Color Mode */
53#define VIDEO_TYPE_VGAC 0x22 /* VGA+ in Color Mode */
54#define VIDEO_TYPE_VLFB 0x23 /* VESA VGA in graphic mode */
55
56#define VIDEO_TYPE_PICA_S3 0x30 /* ACER PICA-61 local S3 video */
57#define VIDEO_TYPE_MIPS_G364 0x31 /* MIPS Magnum 4000 G364 video */
58#define VIDEO_TYPE_SGI 0x33 /* Various SGI graphics hardware */
59
60#define VIDEO_TYPE_TGAC 0x40 /* DEC TGA */
61
62#define VIDEO_TYPE_SUN 0x50 /* Sun frame buffer. */
63#define VIDEO_TYPE_SUNPCI 0x51 /* Sun PCI based frame buffer. */
64
65#define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */
66
67#define VIDEO_TYPE_EFI 0x70 /* EFI graphic mode */
68
69#define VIDEO_FLAGS_NOCURSOR (1 << 0) /* The video mode has no cursor set */
70
71#define VIDEO_CAPABILITY_SKIP_QUIRKS (1 << 0)
72
73
74#endif /* _UAPI_SCREEN_INFO_H */
diff --git a/include/uapi/linux/sdla.h b/include/uapi/linux/sdla.h
new file mode 100644
index 000000000000..95eaff9c9e49
--- /dev/null
+++ b/include/uapi/linux/sdla.h
@@ -0,0 +1,116 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Global definitions for the Frame relay interface.
7 *
8 * Version: @(#)if_ifrad.h 0.20 13 Apr 96
9 *
10 * Author: Mike McLagan <mike.mclagan@linux.org>
11 *
12 * Changes:
13 * 0.15 Mike McLagan Structure packing
14 *
15 * 0.20 Mike McLagan New flags for S508 buffer handling
16 *
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation; either version
20 * 2 of the License, or (at your option) any later version.
21 */
22
23#ifndef _UAPISDLA_H
24#define _UAPISDLA_H
25
26/* adapter type */
27#define SDLA_TYPES
28#define SDLA_S502A 5020
29#define SDLA_S502E 5021
30#define SDLA_S503 5030
31#define SDLA_S507 5070
32#define SDLA_S508 5080
33#define SDLA_S509 5090
34#define SDLA_UNKNOWN -1
35
36/* port selection flags for the S508 */
37#define SDLA_S508_PORT_V35 0x00
38#define SDLA_S508_PORT_RS232 0x02
39
40/* Z80 CPU speeds */
41#define SDLA_CPU_3M 0x00
42#define SDLA_CPU_5M 0x01
43#define SDLA_CPU_7M 0x02
44#define SDLA_CPU_8M 0x03
45#define SDLA_CPU_10M 0x04
46#define SDLA_CPU_16M 0x05
47#define SDLA_CPU_12M 0x06
48
49/* some private IOCTLs */
50#define SDLA_IDENTIFY (FRAD_LAST_IOCTL + 1)
51#define SDLA_CPUSPEED (FRAD_LAST_IOCTL + 2)
52#define SDLA_PROTOCOL (FRAD_LAST_IOCTL + 3)
53
54#define SDLA_CLEARMEM (FRAD_LAST_IOCTL + 4)
55#define SDLA_WRITEMEM (FRAD_LAST_IOCTL + 5)
56#define SDLA_READMEM (FRAD_LAST_IOCTL + 6)
57
58struct sdla_mem {
59 int addr;
60 int len;
61 void __user *data;
62};
63
64#define SDLA_START (FRAD_LAST_IOCTL + 7)
65#define SDLA_STOP (FRAD_LAST_IOCTL + 8)
66
67/* some offsets in the Z80's memory space */
68#define SDLA_NMIADDR 0x0000
69#define SDLA_CONF_ADDR 0x0010
70#define SDLA_S502A_NMIADDR 0x0066
71#define SDLA_CODE_BASEADDR 0x0100
72#define SDLA_WINDOW_SIZE 0x2000
73#define SDLA_ADDR_MASK 0x1FFF
74
75/* largest handleable block of data */
76#define SDLA_MAX_DATA 4080
77#define SDLA_MAX_MTU 4072 /* MAX_DATA - sizeof(fradhdr) */
78#define SDLA_MAX_DLCI 24
79
80/* this should be the same as frad_conf */
81struct sdla_conf {
82 short station;
83 short config;
84 short kbaud;
85 short clocking;
86 short max_frm;
87 short T391;
88 short T392;
89 short N391;
90 short N392;
91 short N393;
92 short CIR_fwd;
93 short Bc_fwd;
94 short Be_fwd;
95 short CIR_bwd;
96 short Bc_bwd;
97 short Be_bwd;
98};
99
100/* this should be the same as dlci_conf */
101struct sdla_dlci_conf {
102 short config;
103 short CIR_fwd;
104 short Bc_fwd;
105 short Be_fwd;
106 short CIR_bwd;
107 short Bc_bwd;
108 short Be_bwd;
109 short Tc_fwd;
110 short Tc_bwd;
111 short Tf_max;
112 short Tb_max;
113};
114
115
116#endif /* _UAPISDLA_H */
diff --git a/include/uapi/linux/seccomp.h b/include/uapi/linux/seccomp.h
new file mode 100644
index 000000000000..ac2dc9f72973
--- /dev/null
+++ b/include/uapi/linux/seccomp.h
@@ -0,0 +1,47 @@
1#ifndef _UAPI_LINUX_SECCOMP_H
2#define _UAPI_LINUX_SECCOMP_H
3
4#include <linux/compiler.h>
5#include <linux/types.h>
6
7
8/* Valid values for seccomp.mode and prctl(PR_SET_SECCOMP, <mode>) */
9#define SECCOMP_MODE_DISABLED 0 /* seccomp is not in use. */
10#define SECCOMP_MODE_STRICT 1 /* uses hard-coded filter. */
11#define SECCOMP_MODE_FILTER 2 /* uses user-supplied filter. */
12
13/*
14 * All BPF programs must return a 32-bit value.
15 * The bottom 16-bits are for optional return data.
16 * The upper 16-bits are ordered from least permissive values to most.
17 *
18 * The ordering ensures that a min_t() over composed return values always
19 * selects the least permissive choice.
20 */
21#define SECCOMP_RET_KILL 0x00000000U /* kill the task immediately */
22#define SECCOMP_RET_TRAP 0x00030000U /* disallow and force a SIGSYS */
23#define SECCOMP_RET_ERRNO 0x00050000U /* returns an errno */
24#define SECCOMP_RET_TRACE 0x7ff00000U /* pass to a tracer or disallow */
25#define SECCOMP_RET_ALLOW 0x7fff0000U /* allow */
26
27/* Masks for the return value sections. */
28#define SECCOMP_RET_ACTION 0x7fff0000U
29#define SECCOMP_RET_DATA 0x0000ffffU
30
31/**
32 * struct seccomp_data - the format the BPF program executes over.
33 * @nr: the system call number
34 * @arch: indicates system call convention as an AUDIT_ARCH_* value
35 * as defined in <linux/audit.h>.
36 * @instruction_pointer: at the time of the system call.
37 * @args: up to 6 system call arguments always stored as 64-bit values
38 * regardless of the architecture.
39 */
40struct seccomp_data {
41 int nr;
42 __u32 arch;
43 __u64 instruction_pointer;
44 __u64 args[6];
45};
46
47#endif /* _UAPI_LINUX_SECCOMP_H */
diff --git a/include/uapi/linux/securebits.h b/include/uapi/linux/securebits.h
new file mode 100644
index 000000000000..985aac9e6bf8
--- /dev/null
+++ b/include/uapi/linux/securebits.h
@@ -0,0 +1,51 @@
1#ifndef _UAPI_LINUX_SECUREBITS_H
2#define _UAPI_LINUX_SECUREBITS_H
3
4/* Each securesetting is implemented using two bits. One bit specifies
5 whether the setting is on or off. The other bit specify whether the
6 setting is locked or not. A setting which is locked cannot be
7 changed from user-level. */
8#define issecure_mask(X) (1 << (X))
9
10#define SECUREBITS_DEFAULT 0x00000000
11
12/* When set UID 0 has no special privileges. When unset, we support
13 inheritance of root-permissions and suid-root executable under
14 compatibility mode. We raise the effective and inheritable bitmasks
15 *of the executable file* if the effective uid of the new process is
16 0. If the real uid is 0, we raise the effective (legacy) bit of the
17 executable file. */
18#define SECURE_NOROOT 0
19#define SECURE_NOROOT_LOCKED 1 /* make bit-0 immutable */
20
21#define SECBIT_NOROOT (issecure_mask(SECURE_NOROOT))
22#define SECBIT_NOROOT_LOCKED (issecure_mask(SECURE_NOROOT_LOCKED))
23
24/* When set, setuid to/from uid 0 does not trigger capability-"fixup".
25 When unset, to provide compatiblility with old programs relying on
26 set*uid to gain/lose privilege, transitions to/from uid 0 cause
27 capabilities to be gained/lost. */
28#define SECURE_NO_SETUID_FIXUP 2
29#define SECURE_NO_SETUID_FIXUP_LOCKED 3 /* make bit-2 immutable */
30
31#define SECBIT_NO_SETUID_FIXUP (issecure_mask(SECURE_NO_SETUID_FIXUP))
32#define SECBIT_NO_SETUID_FIXUP_LOCKED \
33 (issecure_mask(SECURE_NO_SETUID_FIXUP_LOCKED))
34
35/* When set, a process can retain its capabilities even after
36 transitioning to a non-root user (the set-uid fixup suppressed by
37 bit 2). Bit-4 is cleared when a process calls exec(); setting both
38 bit 4 and 5 will create a barrier through exec that no exec()'d
39 child can use this feature again. */
40#define SECURE_KEEP_CAPS 4
41#define SECURE_KEEP_CAPS_LOCKED 5 /* make bit-4 immutable */
42
43#define SECBIT_KEEP_CAPS (issecure_mask(SECURE_KEEP_CAPS))
44#define SECBIT_KEEP_CAPS_LOCKED (issecure_mask(SECURE_KEEP_CAPS_LOCKED))
45
46#define SECURE_ALL_BITS (issecure_mask(SECURE_NOROOT) | \
47 issecure_mask(SECURE_NO_SETUID_FIXUP) | \
48 issecure_mask(SECURE_KEEP_CAPS))
49#define SECURE_ALL_LOCKS (SECURE_ALL_BITS << 1)
50
51#endif /* _UAPI_LINUX_SECUREBITS_H */
diff --git a/include/linux/selinux_netlink.h b/include/uapi/linux/selinux_netlink.h
index d239797785cf..d239797785cf 100644
--- a/include/linux/selinux_netlink.h
+++ b/include/uapi/linux/selinux_netlink.h
diff --git a/include/uapi/linux/sem.h b/include/uapi/linux/sem.h
new file mode 100644
index 000000000000..541fce03b50c
--- /dev/null
+++ b/include/uapi/linux/sem.h
@@ -0,0 +1,80 @@
1#ifndef _UAPI_LINUX_SEM_H
2#define _UAPI_LINUX_SEM_H
3
4#include <linux/ipc.h>
5
6/* semop flags */
7#define SEM_UNDO 0x1000 /* undo the operation on exit */
8
9/* semctl Command Definitions. */
10#define GETPID 11 /* get sempid */
11#define GETVAL 12 /* get semval */
12#define GETALL 13 /* get all semval's */
13#define GETNCNT 14 /* get semncnt */
14#define GETZCNT 15 /* get semzcnt */
15#define SETVAL 16 /* set semval */
16#define SETALL 17 /* set all semval's */
17
18/* ipcs ctl cmds */
19#define SEM_STAT 18
20#define SEM_INFO 19
21
22/* Obsolete, used only for backwards compatibility and libc5 compiles */
23struct semid_ds {
24 struct ipc_perm sem_perm; /* permissions .. see ipc.h */
25 __kernel_time_t sem_otime; /* last semop time */
26 __kernel_time_t sem_ctime; /* last change time */
27 struct sem *sem_base; /* ptr to first semaphore in array */
28 struct sem_queue *sem_pending; /* pending operations to be processed */
29 struct sem_queue **sem_pending_last; /* last pending operation */
30 struct sem_undo *undo; /* undo requests on this array */
31 unsigned short sem_nsems; /* no. of semaphores in array */
32};
33
34/* Include the definition of semid64_ds */
35#include <asm/sembuf.h>
36
37/* semop system calls takes an array of these. */
38struct sembuf {
39 unsigned short sem_num; /* semaphore index in array */
40 short sem_op; /* semaphore operation */
41 short sem_flg; /* operation flags */
42};
43
44/* arg for semctl system calls. */
45union semun {
46 int val; /* value for SETVAL */
47 struct semid_ds __user *buf; /* buffer for IPC_STAT & IPC_SET */
48 unsigned short __user *array; /* array for GETALL & SETALL */
49 struct seminfo __user *__buf; /* buffer for IPC_INFO */
50 void __user *__pad;
51};
52
53struct seminfo {
54 int semmap;
55 int semmni;
56 int semmns;
57 int semmnu;
58 int semmsl;
59 int semopm;
60 int semume;
61 int semusz;
62 int semvmx;
63 int semaem;
64};
65
66#define SEMMNI 128 /* <= IPCMNI max # of semaphore identifiers */
67#define SEMMSL 250 /* <= 8 000 max num of semaphores per id */
68#define SEMMNS (SEMMNI*SEMMSL) /* <= INT_MAX max # of semaphores in system */
69#define SEMOPM 32 /* <= 1 000 max num of ops per semop call */
70#define SEMVMX 32767 /* <= 32767 semaphore maximum value */
71#define SEMAEM SEMVMX /* adjust on exit max value */
72
73/* unused */
74#define SEMUME SEMOPM /* max num of undo entries per process */
75#define SEMMNU SEMMNS /* num of undo structures system wide */
76#define SEMMAP SEMMNS /* # of entries in semaphore map */
77#define SEMUSZ 20 /* sizeof struct sem_undo */
78
79
80#endif /* _UAPI_LINUX_SEM_H */
diff --git a/include/uapi/linux/serial.h b/include/uapi/linux/serial.h
new file mode 100644
index 000000000000..5e0d0ed61cf3
--- /dev/null
+++ b/include/uapi/linux/serial.h
@@ -0,0 +1,126 @@
1/*
2 * include/linux/serial.h
3 *
4 * Copyright (C) 1992 by Theodore Ts'o.
5 *
6 * Redistribution of this file is permitted under the terms of the GNU
7 * Public License (GPL)
8 */
9
10#ifndef _UAPI_LINUX_SERIAL_H
11#define _UAPI_LINUX_SERIAL_H
12
13#include <linux/types.h>
14
15#include <linux/tty_flags.h>
16
17
18struct serial_struct {
19 int type;
20 int line;
21 unsigned int port;
22 int irq;
23 int flags;
24 int xmit_fifo_size;
25 int custom_divisor;
26 int baud_base;
27 unsigned short close_delay;
28 char io_type;
29 char reserved_char[1];
30 int hub6;
31 unsigned short closing_wait; /* time to wait before closing */
32 unsigned short closing_wait2; /* no longer used... */
33 unsigned char *iomem_base;
34 unsigned short iomem_reg_shift;
35 unsigned int port_high;
36 unsigned long iomap_base; /* cookie passed into ioremap */
37};
38
39/*
40 * For the close wait times, 0 means wait forever for serial port to
41 * flush its output. 65535 means don't wait at all.
42 */
43#define ASYNC_CLOSING_WAIT_INF 0
44#define ASYNC_CLOSING_WAIT_NONE 65535
45
46/*
47 * These are the supported serial types.
48 */
49#define PORT_UNKNOWN 0
50#define PORT_8250 1
51#define PORT_16450 2
52#define PORT_16550 3
53#define PORT_16550A 4
54#define PORT_CIRRUS 5 /* usurped by cyclades.c */
55#define PORT_16650 6
56#define PORT_16650V2 7
57#define PORT_16750 8
58#define PORT_STARTECH 9 /* usurped by cyclades.c */
59#define PORT_16C950 10 /* Oxford Semiconductor */
60#define PORT_16654 11
61#define PORT_16850 12
62#define PORT_RSA 13 /* RSA-DV II/S card */
63#define PORT_MAX 13
64
65#define SERIAL_IO_PORT 0
66#define SERIAL_IO_HUB6 1
67#define SERIAL_IO_MEM 2
68
69#define UART_CLEAR_FIFO 0x01
70#define UART_USE_FIFO 0x02
71#define UART_STARTECH 0x04
72#define UART_NATSEMI 0x08
73
74
75/*
76 * Multiport serial configuration structure --- external structure
77 */
78struct serial_multiport_struct {
79 int irq;
80 int port1;
81 unsigned char mask1, match1;
82 int port2;
83 unsigned char mask2, match2;
84 int port3;
85 unsigned char mask3, match3;
86 int port4;
87 unsigned char mask4, match4;
88 int port_monitor;
89 int reserved[32];
90};
91
92/*
93 * Serial input interrupt line counters -- external structure
94 * Four lines can interrupt: CTS, DSR, RI, DCD
95 */
96struct serial_icounter_struct {
97 int cts, dsr, rng, dcd;
98 int rx, tx;
99 int frame, overrun, parity, brk;
100 int buf_overrun;
101 int reserved[9];
102};
103
104/*
105 * Serial interface for controlling RS485 settings on chips with suitable
106 * support. Set with TIOCSRS485 and get with TIOCGRS485 if supported by your
107 * platform. The set function returns the new state, with any unsupported bits
108 * reverted appropriately.
109 */
110
111struct serial_rs485 {
112 __u32 flags; /* RS485 feature flags */
113#define SER_RS485_ENABLED (1 << 0) /* If enabled */
114#define SER_RS485_RTS_ON_SEND (1 << 1) /* Logical level for
115 RTS pin when
116 sending */
117#define SER_RS485_RTS_AFTER_SEND (1 << 2) /* Logical level for
118 RTS pin after sent*/
119#define SER_RS485_RX_DURING_TX (1 << 4)
120 __u32 delay_rts_before_send; /* Delay before send (milliseconds) */
121 __u32 delay_rts_after_send; /* Delay after send (milliseconds) */
122 __u32 padding[5]; /* Memory is cheap, new structs
123 are a royal PITA .. */
124};
125
126#endif /* _UAPI_LINUX_SERIAL_H */
diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
new file mode 100644
index 000000000000..7e1ab20adc03
--- /dev/null
+++ b/include/uapi/linux/serial_core.h
@@ -0,0 +1,219 @@
1/*
2 * linux/drivers/char/serial_core.h
3 *
4 * Copyright (C) 2000 Deep Blue Solutions 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 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#ifndef _UAPILINUX_SERIAL_CORE_H
21#define _UAPILINUX_SERIAL_CORE_H
22
23#include <linux/serial.h>
24
25/*
26 * The type definitions. These are from Ted Ts'o's serial.h
27 */
28#define PORT_UNKNOWN 0
29#define PORT_8250 1
30#define PORT_16450 2
31#define PORT_16550 3
32#define PORT_16550A 4
33#define PORT_CIRRUS 5
34#define PORT_16650 6
35#define PORT_16650V2 7
36#define PORT_16750 8
37#define PORT_STARTECH 9
38#define PORT_16C950 10
39#define PORT_16654 11
40#define PORT_16850 12
41#define PORT_RSA 13
42#define PORT_NS16550A 14
43#define PORT_XSCALE 15
44#define PORT_RM9000 16 /* PMC-Sierra RM9xxx internal UART */
45#define PORT_OCTEON 17 /* Cavium OCTEON internal UART */
46#define PORT_AR7 18 /* Texas Instruments AR7 internal UART */
47#define PORT_U6_16550A 19 /* ST-Ericsson U6xxx internal UART */
48#define PORT_TEGRA 20 /* NVIDIA Tegra internal UART */
49#define PORT_XR17D15X 21 /* Exar XR17D15x UART */
50#define PORT_LPC3220 22 /* NXP LPC32xx SoC "Standard" UART */
51#define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */
52#define PORT_MAX_8250 23 /* max port ID */
53
54/*
55 * ARM specific type numbers. These are not currently guaranteed
56 * to be implemented, and will change in the future. These are
57 * separate so any additions to the old serial.c that occur before
58 * we are merged can be easily merged here.
59 */
60#define PORT_PXA 31
61#define PORT_AMBA 32
62#define PORT_CLPS711X 33
63#define PORT_SA1100 34
64#define PORT_UART00 35
65#define PORT_21285 37
66
67/* Sparc type numbers. */
68#define PORT_SUNZILOG 38
69#define PORT_SUNSAB 39
70
71/* DEC */
72#define PORT_DZ 46
73#define PORT_ZS 47
74
75/* Parisc type numbers. */
76#define PORT_MUX 48
77
78/* Atmel AT91 / AT32 SoC */
79#define PORT_ATMEL 49
80
81/* Macintosh Zilog type numbers */
82#define PORT_MAC_ZILOG 50 /* m68k : not yet implemented */
83#define PORT_PMAC_ZILOG 51
84
85/* SH-SCI */
86#define PORT_SCI 52
87#define PORT_SCIF 53
88#define PORT_IRDA 54
89
90/* Samsung S3C2410 SoC and derivatives thereof */
91#define PORT_S3C2410 55
92
93/* SGI IP22 aka Indy / Challenge S / Indigo 2 */
94#define PORT_IP22ZILOG 56
95
96/* Sharp LH7a40x -- an ARM9 SoC series */
97#define PORT_LH7A40X 57
98
99/* PPC CPM type number */
100#define PORT_CPM 58
101
102/* MPC52xx (and MPC512x) type numbers */
103#define PORT_MPC52xx 59
104
105/* IBM icom */
106#define PORT_ICOM 60
107
108/* Samsung S3C2440 SoC */
109#define PORT_S3C2440 61
110
111/* Motorola i.MX SoC */
112#define PORT_IMX 62
113
114/* Marvell MPSC */
115#define PORT_MPSC 63
116
117/* TXX9 type number */
118#define PORT_TXX9 64
119
120/* NEC VR4100 series SIU/DSIU */
121#define PORT_VR41XX_SIU 65
122#define PORT_VR41XX_DSIU 66
123
124/* Samsung S3C2400 SoC */
125#define PORT_S3C2400 67
126
127/* M32R SIO */
128#define PORT_M32R_SIO 68
129
130/*Digi jsm */
131#define PORT_JSM 69
132
133#define PORT_PNX8XXX 70
134
135/* Hilscher netx */
136#define PORT_NETX 71
137
138/* SUN4V Hypervisor Console */
139#define PORT_SUNHV 72
140
141#define PORT_S3C2412 73
142
143/* Xilinx uartlite */
144#define PORT_UARTLITE 74
145
146/* Blackfin bf5xx */
147#define PORT_BFIN 75
148
149/* Micrel KS8695 */
150#define PORT_KS8695 76
151
152/* Broadcom SB1250, etc. SOC */
153#define PORT_SB1250_DUART 77
154
155/* Freescale ColdFire */
156#define PORT_MCF 78
157
158/* Blackfin SPORT */
159#define PORT_BFIN_SPORT 79
160
161/* MN10300 on-chip UART numbers */
162#define PORT_MN10300 80
163#define PORT_MN10300_CTS 81
164
165#define PORT_SC26XX 82
166
167/* SH-SCI */
168#define PORT_SCIFA 83
169
170#define PORT_S3C6400 84
171
172/* NWPSERIAL */
173#define PORT_NWPSERIAL 85
174
175/* MAX3100 */
176#define PORT_MAX3100 86
177
178/* Timberdale UART */
179#define PORT_TIMBUART 87
180
181/* Qualcomm MSM SoCs */
182#define PORT_MSM 88
183
184/* BCM63xx family SoCs */
185#define PORT_BCM63XX 89
186
187/* Aeroflex Gaisler GRLIB APBUART */
188#define PORT_APBUART 90
189
190/* Altera UARTs */
191#define PORT_ALTERA_JTAGUART 91
192#define PORT_ALTERA_UART 92
193
194/* SH-SCI */
195#define PORT_SCIFB 93
196
197/* MAX310X */
198#define PORT_MAX310X 94
199
200/* High Speed UART for Medfield */
201#define PORT_MFD 95
202
203/* TI OMAP-UART */
204#define PORT_OMAP 96
205
206/* VIA VT8500 SoC */
207#define PORT_VT8500 97
208
209/* Xilinx PSS UART */
210#define PORT_XUARTPS 98
211
212/* Atheros AR933X SoC */
213#define PORT_AR933X 99
214
215/* Energy Micro efm32 SoC */
216#define PORT_EFMUART 100
217
218
219#endif /* _UAPILINUX_SERIAL_CORE_H */
diff --git a/include/linux/serial_reg.h b/include/uapi/linux/serial_reg.h
index 5ed325e88a81..5ed325e88a81 100644
--- a/include/linux/serial_reg.h
+++ b/include/uapi/linux/serial_reg.h
diff --git a/include/uapi/linux/serio.h b/include/uapi/linux/serio.h
new file mode 100644
index 000000000000..9f53fa7fc132
--- /dev/null
+++ b/include/uapi/linux/serio.h
@@ -0,0 +1,80 @@
1/*
2 * Copyright (C) 1999-2002 Vojtech Pavlik
3*
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 as published by
6 * the Free Software Foundation.
7 */
8#ifndef _UAPI_SERIO_H
9#define _UAPI_SERIO_H
10
11
12#include <linux/ioctl.h>
13
14#define SPIOCSTYPE _IOW('q', 0x01, unsigned long)
15
16
17/*
18 * bit masks for use in "interrupt" flags (3rd argument)
19 */
20#define SERIO_TIMEOUT 1
21#define SERIO_PARITY 2
22#define SERIO_FRAME 4
23
24/*
25 * Serio types
26 */
27#define SERIO_XT 0x00
28#define SERIO_8042 0x01
29#define SERIO_RS232 0x02
30#define SERIO_HIL_MLC 0x03
31#define SERIO_PS_PSTHRU 0x05
32#define SERIO_8042_XL 0x06
33
34/*
35 * Serio protocols
36 */
37#define SERIO_UNKNOWN 0x00
38#define SERIO_MSC 0x01
39#define SERIO_SUN 0x02
40#define SERIO_MS 0x03
41#define SERIO_MP 0x04
42#define SERIO_MZ 0x05
43#define SERIO_MZP 0x06
44#define SERIO_MZPP 0x07
45#define SERIO_VSXXXAA 0x08
46#define SERIO_SUNKBD 0x10
47#define SERIO_WARRIOR 0x18
48#define SERIO_SPACEORB 0x19
49#define SERIO_MAGELLAN 0x1a
50#define SERIO_SPACEBALL 0x1b
51#define SERIO_GUNZE 0x1c
52#define SERIO_IFORCE 0x1d
53#define SERIO_STINGER 0x1e
54#define SERIO_NEWTON 0x1f
55#define SERIO_STOWAWAY 0x20
56#define SERIO_H3600 0x21
57#define SERIO_PS2SER 0x22
58#define SERIO_TWIDKBD 0x23
59#define SERIO_TWIDJOY 0x24
60#define SERIO_HIL 0x25
61#define SERIO_SNES232 0x26
62#define SERIO_SEMTECH 0x27
63#define SERIO_LKKBD 0x28
64#define SERIO_ELO 0x29
65#define SERIO_MICROTOUCH 0x30
66#define SERIO_PENMOUNT 0x31
67#define SERIO_TOUCHRIGHT 0x32
68#define SERIO_TOUCHWIN 0x33
69#define SERIO_TAOSEVM 0x34
70#define SERIO_FUJITSU 0x35
71#define SERIO_ZHENHUA 0x36
72#define SERIO_INEXIO 0x37
73#define SERIO_TOUCHIT213 0x38
74#define SERIO_W8001 0x39
75#define SERIO_DYNAPRO 0x3a
76#define SERIO_HAMPSHIRE 0x3b
77#define SERIO_PS2MULT 0x3c
78#define SERIO_TSC40 0x3d
79
80#endif /* _UAPI_SERIO_H */
diff --git a/include/uapi/linux/shm.h b/include/uapi/linux/shm.h
new file mode 100644
index 000000000000..ec36fa1a83a4
--- /dev/null
+++ b/include/uapi/linux/shm.h
@@ -0,0 +1,79 @@
1#ifndef _UAPI_LINUX_SHM_H_
2#define _UAPI_LINUX_SHM_H_
3
4#include <linux/ipc.h>
5#include <linux/errno.h>
6#ifndef __KERNEL__
7#include <unistd.h>
8#endif
9
10/*
11 * SHMMAX, SHMMNI and SHMALL are upper limits are defaults which can
12 * be increased by sysctl
13 */
14
15#define SHMMAX 0x2000000 /* max shared seg size (bytes) */
16#define SHMMIN 1 /* min shared seg size (bytes) */
17#define SHMMNI 4096 /* max num of segs system wide */
18#ifndef __KERNEL__
19#define SHMALL (SHMMAX/getpagesize()*(SHMMNI/16))
20#endif
21#define SHMSEG SHMMNI /* max shared segs per process */
22
23
24/* Obsolete, used only for backwards compatibility and libc5 compiles */
25struct shmid_ds {
26 struct ipc_perm shm_perm; /* operation perms */
27 int shm_segsz; /* size of segment (bytes) */
28 __kernel_time_t shm_atime; /* last attach time */
29 __kernel_time_t shm_dtime; /* last detach time */
30 __kernel_time_t shm_ctime; /* last change time */
31 __kernel_ipc_pid_t shm_cpid; /* pid of creator */
32 __kernel_ipc_pid_t shm_lpid; /* pid of last operator */
33 unsigned short shm_nattch; /* no. of current attaches */
34 unsigned short shm_unused; /* compatibility */
35 void *shm_unused2; /* ditto - used by DIPC */
36 void *shm_unused3; /* unused */
37};
38
39/* Include the definition of shmid64_ds and shminfo64 */
40#include <asm/shmbuf.h>
41
42/* permission flag for shmget */
43#define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */
44#define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */
45
46/* mode for attach */
47#define SHM_RDONLY 010000 /* read-only access */
48#define SHM_RND 020000 /* round attach address to SHMLBA boundary */
49#define SHM_REMAP 040000 /* take-over region on attach */
50#define SHM_EXEC 0100000 /* execution access */
51
52/* super user shmctl commands */
53#define SHM_LOCK 11
54#define SHM_UNLOCK 12
55
56/* ipcs ctl commands */
57#define SHM_STAT 13
58#define SHM_INFO 14
59
60/* Obsolete, used only for backwards compatibility */
61struct shminfo {
62 int shmmax;
63 int shmmin;
64 int shmmni;
65 int shmseg;
66 int shmall;
67};
68
69struct shm_info {
70 int used_ids;
71 unsigned long shm_tot; /* total allocated shm */
72 unsigned long shm_rss; /* total resident shm */
73 unsigned long shm_swp; /* total swapped shm */
74 unsigned long swap_attempts;
75 unsigned long swap_successes;
76};
77
78
79#endif /* _UAPI_LINUX_SHM_H_ */
diff --git a/include/uapi/linux/signal.h b/include/uapi/linux/signal.h
new file mode 100644
index 000000000000..dff452ed6d00
--- /dev/null
+++ b/include/uapi/linux/signal.h
@@ -0,0 +1,8 @@
1#ifndef _UAPI_LINUX_SIGNAL_H
2#define _UAPI_LINUX_SIGNAL_H
3
4#include <asm/signal.h>
5#include <asm/siginfo.h>
6
7
8#endif /* _UAPI_LINUX_SIGNAL_H */
diff --git a/include/uapi/linux/signalfd.h b/include/uapi/linux/signalfd.h
new file mode 100644
index 000000000000..492c6def340d
--- /dev/null
+++ b/include/uapi/linux/signalfd.h
@@ -0,0 +1,52 @@
1/*
2 * include/linux/signalfd.h
3 *
4 * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org>
5 *
6 */
7
8#ifndef _UAPI_LINUX_SIGNALFD_H
9#define _UAPI_LINUX_SIGNALFD_H
10
11#include <linux/types.h>
12/* For O_CLOEXEC and O_NONBLOCK */
13#include <linux/fcntl.h>
14
15/* Flags for signalfd4. */
16#define SFD_CLOEXEC O_CLOEXEC
17#define SFD_NONBLOCK O_NONBLOCK
18
19struct signalfd_siginfo {
20 __u32 ssi_signo;
21 __s32 ssi_errno;
22 __s32 ssi_code;
23 __u32 ssi_pid;
24 __u32 ssi_uid;
25 __s32 ssi_fd;
26 __u32 ssi_tid;
27 __u32 ssi_band;
28 __u32 ssi_overrun;
29 __u32 ssi_trapno;
30 __s32 ssi_status;
31 __s32 ssi_int;
32 __u64 ssi_ptr;
33 __u64 ssi_utime;
34 __u64 ssi_stime;
35 __u64 ssi_addr;
36 __u16 ssi_addr_lsb;
37
38 /*
39 * Pad strcture to 128 bytes. Remember to update the
40 * pad size when you add new members. We use a fixed
41 * size structure to avoid compatibility problems with
42 * future versions, and we leave extra space for additional
43 * members. We use fixed size members because this strcture
44 * comes out of a read(2) and we really don't want to have
45 * a compat on read(2).
46 */
47 __u8 __pad[46];
48};
49
50
51
52#endif /* _UAPI_LINUX_SIGNALFD_H */
diff --git a/include/linux/snmp.h b/include/uapi/linux/snmp.h
index fdfba235f9f1..fdfba235f9f1 100644
--- a/include/linux/snmp.h
+++ b/include/uapi/linux/snmp.h
diff --git a/include/uapi/linux/sock_diag.h b/include/uapi/linux/sock_diag.h
new file mode 100644
index 000000000000..b00e29efb161
--- /dev/null
+++ b/include/uapi/linux/sock_diag.h
@@ -0,0 +1,26 @@
1#ifndef _UAPI__SOCK_DIAG_H__
2#define _UAPI__SOCK_DIAG_H__
3
4#include <linux/types.h>
5
6#define SOCK_DIAG_BY_FAMILY 20
7
8struct sock_diag_req {
9 __u8 sdiag_family;
10 __u8 sdiag_protocol;
11};
12
13enum {
14 SK_MEMINFO_RMEM_ALLOC,
15 SK_MEMINFO_RCVBUF,
16 SK_MEMINFO_WMEM_ALLOC,
17 SK_MEMINFO_SNDBUF,
18 SK_MEMINFO_FWD_ALLOC,
19 SK_MEMINFO_WMEM_QUEUED,
20 SK_MEMINFO_OPTMEM,
21 SK_MEMINFO_BACKLOG,
22
23 SK_MEMINFO_VARS,
24};
25
26#endif /* _UAPI__SOCK_DIAG_H__ */
diff --git a/include/uapi/linux/socket.h b/include/uapi/linux/socket.h
new file mode 100644
index 000000000000..76ab0c68561e
--- /dev/null
+++ b/include/uapi/linux/socket.h
@@ -0,0 +1,21 @@
1#ifndef _UAPI_LINUX_SOCKET_H
2#define _UAPI_LINUX_SOCKET_H
3
4/*
5 * Desired design of maximum size and alignment (see RFC2553)
6 */
7#define _K_SS_MAXSIZE 128 /* Implementation specific max size */
8#define _K_SS_ALIGNSIZE (__alignof__ (struct sockaddr *))
9 /* Implementation specific desired alignment */
10
11typedef unsigned short __kernel_sa_family_t;
12
13struct __kernel_sockaddr_storage {
14 __kernel_sa_family_t ss_family; /* address family */
15 /* Following field(s) are implementation specific */
16 char __data[_K_SS_MAXSIZE - sizeof(unsigned short)];
17 /* space to achieve desired size, */
18 /* _SS_MAXSIZE value minus size of ss_family */
19} __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */
20
21#endif /* _UAPI_LINUX_SOCKET_H */
diff --git a/include/linux/sockios.h b/include/uapi/linux/sockios.h
index 7997a506ad41..7997a506ad41 100644
--- a/include/linux/sockios.h
+++ b/include/uapi/linux/sockios.h
diff --git a/include/linux/som.h b/include/uapi/linux/som.h
index 166594e4e7be..166594e4e7be 100644
--- a/include/linux/som.h
+++ b/include/uapi/linux/som.h
diff --git a/include/uapi/linux/sonet.h b/include/uapi/linux/sonet.h
new file mode 100644
index 000000000000..cc54acee81ba
--- /dev/null
+++ b/include/uapi/linux/sonet.h
@@ -0,0 +1,60 @@
1/* sonet.h - SONET/SHD physical layer control */
2
3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
4
5
6#ifndef _UAPILINUX_SONET_H
7#define _UAPILINUX_SONET_H
8
9#define __SONET_ITEMS \
10 __HANDLE_ITEM(section_bip); /* section parity errors (B1) */ \
11 __HANDLE_ITEM(line_bip); /* line parity errors (B2) */ \
12 __HANDLE_ITEM(path_bip); /* path parity errors (B3) */ \
13 __HANDLE_ITEM(line_febe); /* line parity errors at remote */ \
14 __HANDLE_ITEM(path_febe); /* path parity errors at remote */ \
15 __HANDLE_ITEM(corr_hcs); /* correctable header errors */ \
16 __HANDLE_ITEM(uncorr_hcs); /* uncorrectable header errors */ \
17 __HANDLE_ITEM(tx_cells); /* cells sent */ \
18 __HANDLE_ITEM(rx_cells); /* cells received */
19
20struct sonet_stats {
21#define __HANDLE_ITEM(i) int i
22 __SONET_ITEMS
23#undef __HANDLE_ITEM
24} __attribute__ ((packed));
25
26
27#define SONET_GETSTAT _IOR('a',ATMIOC_PHYTYP,struct sonet_stats)
28 /* get statistics */
29#define SONET_GETSTATZ _IOR('a',ATMIOC_PHYTYP+1,struct sonet_stats)
30 /* ... and zero counters */
31#define SONET_SETDIAG _IOWR('a',ATMIOC_PHYTYP+2,int)
32 /* set error insertion */
33#define SONET_CLRDIAG _IOWR('a',ATMIOC_PHYTYP+3,int)
34 /* clear error insertion */
35#define SONET_GETDIAG _IOR('a',ATMIOC_PHYTYP+4,int)
36 /* query error insertion */
37#define SONET_SETFRAMING _IOW('a',ATMIOC_PHYTYP+5,int)
38 /* set framing mode (SONET/SDH) */
39#define SONET_GETFRAMING _IOR('a',ATMIOC_PHYTYP+6,int)
40 /* get framing mode */
41#define SONET_GETFRSENSE _IOR('a',ATMIOC_PHYTYP+7, \
42 unsigned char[SONET_FRSENSE_SIZE]) /* get framing sense information */
43
44#define SONET_INS_SBIP 1 /* section BIP */
45#define SONET_INS_LBIP 2 /* line BIP */
46#define SONET_INS_PBIP 4 /* path BIP */
47#define SONET_INS_FRAME 8 /* out of frame */
48#define SONET_INS_LOS 16 /* set line to zero */
49#define SONET_INS_LAIS 32 /* line alarm indication signal */
50#define SONET_INS_PAIS 64 /* path alarm indication signal */
51#define SONET_INS_HCS 128 /* insert HCS error */
52
53#define SONET_FRAME_SONET 0 /* SONET STS-3 framing */
54#define SONET_FRAME_SDH 1 /* SDH STM-1 framing */
55
56#define SONET_FRSENSE_SIZE 6 /* C1[3],H1[3] (0xff for unknown) */
57
58
59
60#endif /* _UAPILINUX_SONET_H */
diff --git a/include/uapi/linux/sonypi.h b/include/uapi/linux/sonypi.h
new file mode 100644
index 000000000000..85078a283573
--- /dev/null
+++ b/include/uapi/linux/sonypi.h
@@ -0,0 +1,146 @@
1/*
2 * Sony Programmable I/O Control Device driver for VAIO
3 *
4 * Copyright (C) 2001-2005 Stelian Pop <stelian@popies.net>
5 *
6 * Copyright (C) 2005 Narayanan R S <nars@kadamba.org>
7
8 * Copyright (C) 2001-2002 Alcôve <www.alcove.com>
9 *
10 * Copyright (C) 2001 Michael Ashley <m.ashley@unsw.edu.au>
11 *
12 * Copyright (C) 2001 Junichi Morita <jun1m@mars.dti.ne.jp>
13 *
14 * Copyright (C) 2000 Takaya Kinjo <t-kinjo@tc4.so-net.ne.jp>
15 *
16 * Copyright (C) 2000 Andrew Tridgell <tridge@valinux.com>
17 *
18 * Earlier work by Werner Almesberger, Paul `Rusty' Russell and Paul Mackerras.
19 *
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation; either version 2 of the License, or
23 * (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * You should have received a copy of the GNU General Public License
31 * along with this program; if not, write to the Free Software
32 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
33 *
34 */
35
36#ifndef _UAPI_SONYPI_H_
37#define _UAPI_SONYPI_H_
38
39#include <linux/types.h>
40
41/* events the user application reading /dev/sonypi can use */
42
43#define SONYPI_EVENT_IGNORE 0
44#define SONYPI_EVENT_JOGDIAL_DOWN 1
45#define SONYPI_EVENT_JOGDIAL_UP 2
46#define SONYPI_EVENT_JOGDIAL_DOWN_PRESSED 3
47#define SONYPI_EVENT_JOGDIAL_UP_PRESSED 4
48#define SONYPI_EVENT_JOGDIAL_PRESSED 5
49#define SONYPI_EVENT_JOGDIAL_RELEASED 6 /* obsolete */
50#define SONYPI_EVENT_CAPTURE_PRESSED 7
51#define SONYPI_EVENT_CAPTURE_RELEASED 8 /* obsolete */
52#define SONYPI_EVENT_CAPTURE_PARTIALPRESSED 9
53#define SONYPI_EVENT_CAPTURE_PARTIALRELEASED 10
54#define SONYPI_EVENT_FNKEY_ESC 11
55#define SONYPI_EVENT_FNKEY_F1 12
56#define SONYPI_EVENT_FNKEY_F2 13
57#define SONYPI_EVENT_FNKEY_F3 14
58#define SONYPI_EVENT_FNKEY_F4 15
59#define SONYPI_EVENT_FNKEY_F5 16
60#define SONYPI_EVENT_FNKEY_F6 17
61#define SONYPI_EVENT_FNKEY_F7 18
62#define SONYPI_EVENT_FNKEY_F8 19
63#define SONYPI_EVENT_FNKEY_F9 20
64#define SONYPI_EVENT_FNKEY_F10 21
65#define SONYPI_EVENT_FNKEY_F11 22
66#define SONYPI_EVENT_FNKEY_F12 23
67#define SONYPI_EVENT_FNKEY_1 24
68#define SONYPI_EVENT_FNKEY_2 25
69#define SONYPI_EVENT_FNKEY_D 26
70#define SONYPI_EVENT_FNKEY_E 27
71#define SONYPI_EVENT_FNKEY_F 28
72#define SONYPI_EVENT_FNKEY_S 29
73#define SONYPI_EVENT_FNKEY_B 30
74#define SONYPI_EVENT_BLUETOOTH_PRESSED 31
75#define SONYPI_EVENT_PKEY_P1 32
76#define SONYPI_EVENT_PKEY_P2 33
77#define SONYPI_EVENT_PKEY_P3 34
78#define SONYPI_EVENT_BACK_PRESSED 35
79#define SONYPI_EVENT_LID_CLOSED 36
80#define SONYPI_EVENT_LID_OPENED 37
81#define SONYPI_EVENT_BLUETOOTH_ON 38
82#define SONYPI_EVENT_BLUETOOTH_OFF 39
83#define SONYPI_EVENT_HELP_PRESSED 40
84#define SONYPI_EVENT_FNKEY_ONLY 41
85#define SONYPI_EVENT_JOGDIAL_FAST_DOWN 42
86#define SONYPI_EVENT_JOGDIAL_FAST_UP 43
87#define SONYPI_EVENT_JOGDIAL_FAST_DOWN_PRESSED 44
88#define SONYPI_EVENT_JOGDIAL_FAST_UP_PRESSED 45
89#define SONYPI_EVENT_JOGDIAL_VFAST_DOWN 46
90#define SONYPI_EVENT_JOGDIAL_VFAST_UP 47
91#define SONYPI_EVENT_JOGDIAL_VFAST_DOWN_PRESSED 48
92#define SONYPI_EVENT_JOGDIAL_VFAST_UP_PRESSED 49
93#define SONYPI_EVENT_ZOOM_PRESSED 50
94#define SONYPI_EVENT_THUMBPHRASE_PRESSED 51
95#define SONYPI_EVENT_MEYE_FACE 52
96#define SONYPI_EVENT_MEYE_OPPOSITE 53
97#define SONYPI_EVENT_MEMORYSTICK_INSERT 54
98#define SONYPI_EVENT_MEMORYSTICK_EJECT 55
99#define SONYPI_EVENT_ANYBUTTON_RELEASED 56
100#define SONYPI_EVENT_BATTERY_INSERT 57
101#define SONYPI_EVENT_BATTERY_REMOVE 58
102#define SONYPI_EVENT_FNKEY_RELEASED 59
103#define SONYPI_EVENT_WIRELESS_ON 60
104#define SONYPI_EVENT_WIRELESS_OFF 61
105#define SONYPI_EVENT_ZOOM_IN_PRESSED 62
106#define SONYPI_EVENT_ZOOM_OUT_PRESSED 63
107#define SONYPI_EVENT_CD_EJECT_PRESSED 64
108#define SONYPI_EVENT_MODEKEY_PRESSED 65
109#define SONYPI_EVENT_PKEY_P4 66
110#define SONYPI_EVENT_PKEY_P5 67
111#define SONYPI_EVENT_SETTINGKEY_PRESSED 68
112#define SONYPI_EVENT_VOLUME_INC_PRESSED 69
113#define SONYPI_EVENT_VOLUME_DEC_PRESSED 70
114#define SONYPI_EVENT_BRIGHTNESS_PRESSED 71
115#define SONYPI_EVENT_MEDIA_PRESSED 72
116#define SONYPI_EVENT_VENDOR_PRESSED 73
117
118/* get/set brightness */
119#define SONYPI_IOCGBRT _IOR('v', 0, __u8)
120#define SONYPI_IOCSBRT _IOW('v', 0, __u8)
121
122/* get battery full capacity/remaining capacity */
123#define SONYPI_IOCGBAT1CAP _IOR('v', 2, __u16)
124#define SONYPI_IOCGBAT1REM _IOR('v', 3, __u16)
125#define SONYPI_IOCGBAT2CAP _IOR('v', 4, __u16)
126#define SONYPI_IOCGBAT2REM _IOR('v', 5, __u16)
127
128/* get battery flags: battery1/battery2/ac adapter present */
129#define SONYPI_BFLAGS_B1 0x01
130#define SONYPI_BFLAGS_B2 0x02
131#define SONYPI_BFLAGS_AC 0x04
132#define SONYPI_IOCGBATFLAGS _IOR('v', 7, __u8)
133
134/* get/set bluetooth subsystem state on/off */
135#define SONYPI_IOCGBLUE _IOR('v', 8, __u8)
136#define SONYPI_IOCSBLUE _IOW('v', 9, __u8)
137
138/* get/set fan state on/off */
139#define SONYPI_IOCGFAN _IOR('v', 10, __u8)
140#define SONYPI_IOCSFAN _IOW('v', 11, __u8)
141
142/* get temperature (C) */
143#define SONYPI_IOCGTEMP _IOR('v', 12, __u8)
144
145
146#endif /* _UAPI_SONYPI_H_ */
diff --git a/include/uapi/linux/sound.h b/include/uapi/linux/sound.h
new file mode 100644
index 000000000000..014c9117c224
--- /dev/null
+++ b/include/uapi/linux/sound.h
@@ -0,0 +1,31 @@
1#ifndef _UAPI_LINUX_SOUND_H
2#define _UAPI_LINUX_SOUND_H
3
4/*
5 * Minor numbers for the sound driver.
6 */
7
8#include <linux/fs.h>
9
10#define SND_DEV_CTL 0 /* Control port /dev/mixer */
11#define SND_DEV_SEQ 1 /* Sequencer output /dev/sequencer (FM
12 synthesizer and MIDI output) */
13#define SND_DEV_MIDIN 2 /* Raw midi access */
14#define SND_DEV_DSP 3 /* Digitized voice /dev/dsp */
15#define SND_DEV_AUDIO 4 /* Sparc compatible /dev/audio */
16#define SND_DEV_DSP16 5 /* Like /dev/dsp but 16 bits/sample */
17/* #define SND_DEV_STATUS 6 */ /* /dev/sndstat (obsolete) */
18#define SND_DEV_UNUSED 6
19#define SND_DEV_AWFM 7 /* Reserved */
20#define SND_DEV_SEQ2 8 /* /dev/sequencer, level 2 interface */
21/* #define SND_DEV_SNDPROC 9 */ /* /dev/sndproc for programmable devices (not used) */
22/* #define SND_DEV_DMMIDI 9 */
23#define SND_DEV_SYNTH 9 /* Raw synth access /dev/synth (same as /dev/dmfm) */
24#define SND_DEV_DMFM 10 /* Raw synth access /dev/dmfm */
25#define SND_DEV_UNKNOWN11 11
26#define SND_DEV_ADSP 12 /* Like /dev/dsp (obsolete) */
27#define SND_DEV_AMIDI 13 /* Like /dev/midi (obsolete) */
28#define SND_DEV_ADMMIDI 14 /* Like /dev/dmmidi (onsolete) */
29
30
31#endif /* _UAPI_LINUX_SOUND_H */
diff --git a/include/uapi/linux/soundcard.h b/include/uapi/linux/soundcard.h
new file mode 100644
index 000000000000..f3b21f989872
--- /dev/null
+++ b/include/uapi/linux/soundcard.h
@@ -0,0 +1,1282 @@
1/*
2 * Copyright by Hannu Savolainen 1993-1997
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: 1. Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer. 2.
8 * Redistributions in binary form must reproduce the above copyright notice,
9 * this list of conditions and the following disclaimer in the documentation
10 * and/or other materials provided with the distribution.
11 *
12 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
13 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
15 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
16 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
18 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
19 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22 * SUCH DAMAGE.
23 */
24#ifndef _UAPISOUNDCARD_H
25#define _UAPISOUNDCARD_H
26
27
28/*
29 * OSS interface version. With versions earlier than 3.6 this value is
30 * an integer with value less than 361. In versions 3.6 and later
31 * it's a six digit hexadecimal value. For example value
32 * of 0x030600 represents OSS version 3.6.0.
33 * Use ioctl(fd, OSS_GETVERSION, &int) to get the version number of
34 * the currently active driver.
35 */
36#define SOUND_VERSION 0x030802
37#define OPEN_SOUND_SYSTEM
38
39/* In Linux we need to be prepared for cross compiling */
40#include <linux/ioctl.h>
41
42/* Endian macros. */
43#ifndef __KERNEL__
44# include <endian.h>
45#endif
46
47/*
48 * Supported card ID numbers (Should be somewhere else?)
49 */
50
51#define SNDCARD_ADLIB 1
52#define SNDCARD_SB 2
53#define SNDCARD_PAS 3
54#define SNDCARD_GUS 4
55#define SNDCARD_MPU401 5
56#define SNDCARD_SB16 6
57#define SNDCARD_SB16MIDI 7
58#define SNDCARD_UART6850 8
59#define SNDCARD_GUS16 9
60#define SNDCARD_MSS 10
61#define SNDCARD_PSS 11
62#define SNDCARD_SSCAPE 12
63#define SNDCARD_PSS_MPU 13
64#define SNDCARD_PSS_MSS 14
65#define SNDCARD_SSCAPE_MSS 15
66#define SNDCARD_TRXPRO 16
67#define SNDCARD_TRXPRO_SB 17
68#define SNDCARD_TRXPRO_MPU 18
69#define SNDCARD_MAD16 19
70#define SNDCARD_MAD16_MPU 20
71#define SNDCARD_CS4232 21
72#define SNDCARD_CS4232_MPU 22
73#define SNDCARD_MAUI 23
74#define SNDCARD_PSEUDO_MSS 24
75#define SNDCARD_GUSPNP 25
76#define SNDCARD_UART401 26
77/* Sound card numbers 27 to N are reserved. Don't add more numbers here. */
78
79/***********************************
80 * IOCTL Commands for /dev/sequencer
81 */
82
83#ifndef _SIOWR
84#if defined(_IOWR) && (defined(_AIX) || (!defined(sun) && !defined(sparc) && !defined(__sparc__) && !defined(__INCioctlh) && !defined(__Lynx__)))
85/* Use already defined ioctl defines if they exist (except with Sun or Sparc) */
86#define SIOCPARM_MASK IOCPARM_MASK
87#define SIOC_VOID IOC_VOID
88#define SIOC_OUT IOC_OUT
89#define SIOC_IN IOC_IN
90#define SIOC_INOUT IOC_INOUT
91#define _SIOC_SIZE _IOC_SIZE
92#define _SIOC_DIR _IOC_DIR
93#define _SIOC_NONE _IOC_NONE
94#define _SIOC_READ _IOC_READ
95#define _SIOC_WRITE _IOC_WRITE
96#define _SIO _IO
97#define _SIOR _IOR
98#define _SIOW _IOW
99#define _SIOWR _IOWR
100#else
101
102/* Ioctl's have the command encoded in the lower word,
103 * and the size of any in or out parameters in the upper
104 * word. The high 2 bits of the upper word are used
105 * to encode the in/out status of the parameter; for now
106 * we restrict parameters to at most 8191 bytes.
107 */
108/* #define SIOCTYPE (0xff<<8) */
109#define SIOCPARM_MASK 0x1fff /* parameters must be < 8192 bytes */
110#define SIOC_VOID 0x00000000 /* no parameters */
111#define SIOC_OUT 0x20000000 /* copy out parameters */
112#define SIOC_IN 0x40000000 /* copy in parameters */
113#define SIOC_INOUT (SIOC_IN|SIOC_OUT)
114/* the 0x20000000 is so we can distinguish new ioctl's from old */
115#define _SIO(x,y) ((int)(SIOC_VOID|(x<<8)|y))
116#define _SIOR(x,y,t) ((int)(SIOC_OUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
117#define _SIOW(x,y,t) ((int)(SIOC_IN|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
118/* this should be _SIORW, but stdio got there first */
119#define _SIOWR(x,y,t) ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
120#define _SIOC_SIZE(x) ((x>>16)&SIOCPARM_MASK)
121#define _SIOC_DIR(x) (x & 0xf0000000)
122#define _SIOC_NONE SIOC_VOID
123#define _SIOC_READ SIOC_OUT
124#define _SIOC_WRITE SIOC_IN
125# endif /* _IOWR */
126#endif /* !_SIOWR */
127
128#define SNDCTL_SEQ_RESET _SIO ('Q', 0)
129#define SNDCTL_SEQ_SYNC _SIO ('Q', 1)
130#define SNDCTL_SYNTH_INFO _SIOWR('Q', 2, struct synth_info)
131#define SNDCTL_SEQ_CTRLRATE _SIOWR('Q', 3, int) /* Set/get timer resolution (HZ) */
132#define SNDCTL_SEQ_GETOUTCOUNT _SIOR ('Q', 4, int)
133#define SNDCTL_SEQ_GETINCOUNT _SIOR ('Q', 5, int)
134#define SNDCTL_SEQ_PERCMODE _SIOW ('Q', 6, int)
135#define SNDCTL_FM_LOAD_INSTR _SIOW ('Q', 7, struct sbi_instrument) /* Obsolete. Don't use!!!!!! */
136#define SNDCTL_SEQ_TESTMIDI _SIOW ('Q', 8, int)
137#define SNDCTL_SEQ_RESETSAMPLES _SIOW ('Q', 9, int)
138#define SNDCTL_SEQ_NRSYNTHS _SIOR ('Q',10, int)
139#define SNDCTL_SEQ_NRMIDIS _SIOR ('Q',11, int)
140#define SNDCTL_MIDI_INFO _SIOWR('Q',12, struct midi_info)
141#define SNDCTL_SEQ_THRESHOLD _SIOW ('Q',13, int)
142#define SNDCTL_SYNTH_MEMAVL _SIOWR('Q',14, int) /* in=dev#, out=memsize */
143#define SNDCTL_FM_4OP_ENABLE _SIOW ('Q',15, int) /* in=dev# */
144#define SNDCTL_SEQ_PANIC _SIO ('Q',17)
145#define SNDCTL_SEQ_OUTOFBAND _SIOW ('Q',18, struct seq_event_rec)
146#define SNDCTL_SEQ_GETTIME _SIOR ('Q',19, int)
147#define SNDCTL_SYNTH_ID _SIOWR('Q',20, struct synth_info)
148#define SNDCTL_SYNTH_CONTROL _SIOWR('Q',21, struct synth_control)
149#define SNDCTL_SYNTH_REMOVESAMPLE _SIOWR('Q',22, struct remove_sample)
150
151typedef struct synth_control
152{
153 int devno; /* Synthesizer # */
154 char data[4000]; /* Device spesific command/data record */
155}synth_control;
156
157typedef struct remove_sample
158{
159 int devno; /* Synthesizer # */
160 int bankno; /* MIDI bank # (0=General MIDI) */
161 int instrno; /* MIDI instrument number */
162} remove_sample;
163
164typedef struct seq_event_rec {
165 unsigned char arr[8];
166} seq_event_rec;
167
168#define SNDCTL_TMR_TIMEBASE _SIOWR('T', 1, int)
169#define SNDCTL_TMR_START _SIO ('T', 2)
170#define SNDCTL_TMR_STOP _SIO ('T', 3)
171#define SNDCTL_TMR_CONTINUE _SIO ('T', 4)
172#define SNDCTL_TMR_TEMPO _SIOWR('T', 5, int)
173#define SNDCTL_TMR_SOURCE _SIOWR('T', 6, int)
174# define TMR_INTERNAL 0x00000001
175# define TMR_EXTERNAL 0x00000002
176# define TMR_MODE_MIDI 0x00000010
177# define TMR_MODE_FSK 0x00000020
178# define TMR_MODE_CLS 0x00000040
179# define TMR_MODE_SMPTE 0x00000080
180#define SNDCTL_TMR_METRONOME _SIOW ('T', 7, int)
181#define SNDCTL_TMR_SELECT _SIOW ('T', 8, int)
182
183/*
184 * Some big endian/little endian handling macros
185 */
186
187#define _LINUX_PATCHKEY_H_INDIRECT
188#include <linux/patchkey.h>
189#undef _LINUX_PATCHKEY_H_INDIRECT
190
191#if !defined(__KERNEL__)
192# if defined(__BYTE_ORDER)
193# if __BYTE_ORDER == __BIG_ENDIAN
194# define AFMT_S16_NE AFMT_S16_BE
195# elif __BYTE_ORDER == __LITTLE_ENDIAN
196# define AFMT_S16_NE AFMT_S16_LE
197# else
198# error "could not determine byte order"
199# endif
200# endif
201#endif
202
203/*
204 * Sample loading mechanism for internal synthesizers (/dev/sequencer)
205 * The following patch_info structure has been designed to support
206 * Gravis UltraSound. It tries to be universal format for uploading
207 * sample based patches but is probably too limited.
208 *
209 * (PBD) As Hannu guessed, the GUS structure is too limited for
210 * the WaveFront, but this is the right place for a constant definition.
211 */
212
213struct patch_info {
214 unsigned short key; /* Use WAVE_PATCH here */
215#define WAVE_PATCH _PATCHKEY(0x04)
216#define GUS_PATCH WAVE_PATCH
217#define WAVEFRONT_PATCH _PATCHKEY(0x06)
218
219 short device_no; /* Synthesizer number */
220 short instr_no; /* Midi pgm# */
221
222 unsigned int mode;
223/*
224 * The least significant byte has the same format than the GUS .PAT
225 * files
226 */
227#define WAVE_16_BITS 0x01 /* bit 0 = 8 or 16 bit wave data. */
228#define WAVE_UNSIGNED 0x02 /* bit 1 = Signed - Unsigned data. */
229#define WAVE_LOOPING 0x04 /* bit 2 = looping enabled-1. */
230#define WAVE_BIDIR_LOOP 0x08 /* bit 3 = Set is bidirectional looping. */
231#define WAVE_LOOP_BACK 0x10 /* bit 4 = Set is looping backward. */
232#define WAVE_SUSTAIN_ON 0x20 /* bit 5 = Turn sustaining on. (Env. pts. 3)*/
233#define WAVE_ENVELOPES 0x40 /* bit 6 = Enable envelopes - 1 */
234#define WAVE_FAST_RELEASE 0x80 /* bit 7 = Shut off immediately after note off */
235 /* (use the env_rate/env_offs fields). */
236/* Linux specific bits */
237#define WAVE_VIBRATO 0x00010000 /* The vibrato info is valid */
238#define WAVE_TREMOLO 0x00020000 /* The tremolo info is valid */
239#define WAVE_SCALE 0x00040000 /* The scaling info is valid */
240#define WAVE_FRACTIONS 0x00080000 /* Fraction information is valid */
241/* Reserved bits */
242#define WAVE_ROM 0x40000000 /* For future use */
243#define WAVE_MULAW 0x20000000 /* For future use */
244/* Other bits must be zeroed */
245
246 int len; /* Size of the wave data in bytes */
247 int loop_start, loop_end; /* Byte offsets from the beginning */
248
249/*
250 * The base_freq and base_note fields are used when computing the
251 * playback speed for a note. The base_note defines the tone frequency
252 * which is heard if the sample is played using the base_freq as the
253 * playback speed.
254 *
255 * The low_note and high_note fields define the minimum and maximum note
256 * frequencies for which this sample is valid. It is possible to define
257 * more than one samples for an instrument number at the same time. The
258 * low_note and high_note fields are used to select the most suitable one.
259 *
260 * The fields base_note, high_note and low_note should contain
261 * the note frequency multiplied by 1000. For example value for the
262 * middle A is 440*1000.
263 */
264
265 unsigned int base_freq;
266 unsigned int base_note;
267 unsigned int high_note;
268 unsigned int low_note;
269 int panning; /* -128=left, 127=right */
270 int detuning;
271
272/* New fields introduced in version 1.99.5 */
273
274 /* Envelope. Enabled by mode bit WAVE_ENVELOPES */
275 unsigned char env_rate[ 6 ]; /* GUS HW ramping rate */
276 unsigned char env_offset[ 6 ]; /* 255 == 100% */
277
278 /*
279 * The tremolo, vibrato and scale info are not supported yet.
280 * Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or
281 * WAVE_SCALE
282 */
283
284 unsigned char tremolo_sweep;
285 unsigned char tremolo_rate;
286 unsigned char tremolo_depth;
287
288 unsigned char vibrato_sweep;
289 unsigned char vibrato_rate;
290 unsigned char vibrato_depth;
291
292 int scale_frequency;
293 unsigned int scale_factor; /* from 0 to 2048 or 0 to 2 */
294
295 int volume;
296 int fractions;
297 int reserved1;
298 int spare[2];
299 char data[1]; /* The waveform data starts here */
300 };
301
302struct sysex_info {
303 short key; /* Use SYSEX_PATCH or MAUI_PATCH here */
304#define SYSEX_PATCH _PATCHKEY(0x05)
305#define MAUI_PATCH _PATCHKEY(0x06)
306 short device_no; /* Synthesizer number */
307 int len; /* Size of the sysex data in bytes */
308 unsigned char data[1]; /* Sysex data starts here */
309 };
310
311/*
312 * /dev/sequencer input events.
313 *
314 * The data written to the /dev/sequencer is a stream of events. Events
315 * are records of 4 or 8 bytes. The first byte defines the size.
316 * Any number of events can be written with a write call. There
317 * is a set of macros for sending these events. Use these macros if you
318 * want to maximize portability of your program.
319 *
320 * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events.
321 * (All input events are currently 4 bytes long. Be prepared to support
322 * 8 byte events also. If you receive any event having first byte >= 128,
323 * it's a 8 byte event.
324 *
325 * The events are documented at the end of this file.
326 *
327 * Normal events (4 bytes)
328 * There is also a 8 byte version of most of the 4 byte events. The
329 * 8 byte one is recommended.
330 */
331#define SEQ_NOTEOFF 0
332#define SEQ_FMNOTEOFF SEQ_NOTEOFF /* Just old name */
333#define SEQ_NOTEON 1
334#define SEQ_FMNOTEON SEQ_NOTEON
335#define SEQ_WAIT TMR_WAIT_ABS
336#define SEQ_PGMCHANGE 3
337#define SEQ_FMPGMCHANGE SEQ_PGMCHANGE
338#define SEQ_SYNCTIMER TMR_START
339#define SEQ_MIDIPUTC 5
340#define SEQ_DRUMON 6 /*** OBSOLETE ***/
341#define SEQ_DRUMOFF 7 /*** OBSOLETE ***/
342#define SEQ_ECHO TMR_ECHO /* For synching programs with output */
343#define SEQ_AFTERTOUCH 9
344#define SEQ_CONTROLLER 10
345
346/*******************************************
347 * Midi controller numbers
348 *******************************************
349 * Controllers 0 to 31 (0x00 to 0x1f) and
350 * 32 to 63 (0x20 to 0x3f) are continuous
351 * controllers.
352 * In the MIDI 1.0 these controllers are sent using
353 * two messages. Controller numbers 0 to 31 are used
354 * to send the MSB and the controller numbers 32 to 63
355 * are for the LSB. Note that just 7 bits are used in MIDI bytes.
356 */
357
358#define CTL_BANK_SELECT 0x00
359#define CTL_MODWHEEL 0x01
360#define CTL_BREATH 0x02
361/* undefined 0x03 */
362#define CTL_FOOT 0x04
363#define CTL_PORTAMENTO_TIME 0x05
364#define CTL_DATA_ENTRY 0x06
365#define CTL_MAIN_VOLUME 0x07
366#define CTL_BALANCE 0x08
367/* undefined 0x09 */
368#define CTL_PAN 0x0a
369#define CTL_EXPRESSION 0x0b
370/* undefined 0x0c */
371/* undefined 0x0d */
372/* undefined 0x0e */
373/* undefined 0x0f */
374#define CTL_GENERAL_PURPOSE1 0x10
375#define CTL_GENERAL_PURPOSE2 0x11
376#define CTL_GENERAL_PURPOSE3 0x12
377#define CTL_GENERAL_PURPOSE4 0x13
378/* undefined 0x14 - 0x1f */
379
380/* undefined 0x20 */
381/* The controller numbers 0x21 to 0x3f are reserved for the */
382/* least significant bytes of the controllers 0x00 to 0x1f. */
383/* These controllers are not recognised by the driver. */
384
385/* Controllers 64 to 69 (0x40 to 0x45) are on/off switches. */
386/* 0=OFF and 127=ON (intermediate values are possible) */
387#define CTL_DAMPER_PEDAL 0x40
388#define CTL_SUSTAIN 0x40 /* Alias */
389#define CTL_HOLD 0x40 /* Alias */
390#define CTL_PORTAMENTO 0x41
391#define CTL_SOSTENUTO 0x42
392#define CTL_SOFT_PEDAL 0x43
393/* undefined 0x44 */
394#define CTL_HOLD2 0x45
395/* undefined 0x46 - 0x4f */
396
397#define CTL_GENERAL_PURPOSE5 0x50
398#define CTL_GENERAL_PURPOSE6 0x51
399#define CTL_GENERAL_PURPOSE7 0x52
400#define CTL_GENERAL_PURPOSE8 0x53
401/* undefined 0x54 - 0x5a */
402#define CTL_EXT_EFF_DEPTH 0x5b
403#define CTL_TREMOLO_DEPTH 0x5c
404#define CTL_CHORUS_DEPTH 0x5d
405#define CTL_DETUNE_DEPTH 0x5e
406#define CTL_CELESTE_DEPTH 0x5e /* Alias for the above one */
407#define CTL_PHASER_DEPTH 0x5f
408#define CTL_DATA_INCREMENT 0x60
409#define CTL_DATA_DECREMENT 0x61
410#define CTL_NONREG_PARM_NUM_LSB 0x62
411#define CTL_NONREG_PARM_NUM_MSB 0x63
412#define CTL_REGIST_PARM_NUM_LSB 0x64
413#define CTL_REGIST_PARM_NUM_MSB 0x65
414/* undefined 0x66 - 0x78 */
415/* reserved 0x79 - 0x7f */
416
417/* Pseudo controllers (not midi compatible) */
418#define CTRL_PITCH_BENDER 255
419#define CTRL_PITCH_BENDER_RANGE 254
420#define CTRL_EXPRESSION 253 /* Obsolete */
421#define CTRL_MAIN_VOLUME 252 /* Obsolete */
422#define SEQ_BALANCE 11
423#define SEQ_VOLMODE 12
424
425/*
426 * Volume mode decides how volumes are used
427 */
428
429#define VOL_METHOD_ADAGIO 1
430#define VOL_METHOD_LINEAR 2
431
432/*
433 * Note! SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO are used also as
434 * input events.
435 */
436
437/*
438 * Event codes 0xf0 to 0xfc are reserved for future extensions.
439 */
440
441#define SEQ_FULLSIZE 0xfd /* Long events */
442/*
443 * SEQ_FULLSIZE events are used for loading patches/samples to the
444 * synthesizer devices. These events are passed directly to the driver
445 * of the associated synthesizer device. There is no limit to the size
446 * of the extended events. These events are not queued but executed
447 * immediately when the write() is called (execution can take several
448 * seconds of time).
449 *
450 * When a SEQ_FULLSIZE message is written to the device, it must
451 * be written using exactly one write() call. Other events cannot
452 * be mixed to the same write.
453 *
454 * For FM synths (YM3812/OPL3) use struct sbi_instrument and write it to the
455 * /dev/sequencer. Don't write other data together with the instrument structure
456 * Set the key field of the structure to FM_PATCH. The device field is used to
457 * route the patch to the corresponding device.
458 *
459 * For wave table use struct patch_info. Initialize the key field
460 * to WAVE_PATCH.
461 */
462#define SEQ_PRIVATE 0xfe /* Low level HW dependent events (8 bytes) */
463#define SEQ_EXTENDED 0xff /* Extended events (8 bytes) OBSOLETE */
464
465/*
466 * Record for FM patches
467 */
468
469typedef unsigned char sbi_instr_data[32];
470
471struct sbi_instrument {
472 unsigned short key; /* FM_PATCH or OPL3_PATCH */
473#define FM_PATCH _PATCHKEY(0x01)
474#define OPL3_PATCH _PATCHKEY(0x03)
475 short device; /* Synth# (0-4) */
476 int channel; /* Program# to be initialized */
477 sbi_instr_data operators; /* Register settings for operator cells (.SBI format) */
478 };
479
480struct synth_info { /* Read only */
481 char name[30];
482 int device; /* 0-N. INITIALIZE BEFORE CALLING */
483 int synth_type;
484#define SYNTH_TYPE_FM 0
485#define SYNTH_TYPE_SAMPLE 1
486#define SYNTH_TYPE_MIDI 2 /* Midi interface */
487
488 int synth_subtype;
489#define FM_TYPE_ADLIB 0x00
490#define FM_TYPE_OPL3 0x01
491#define MIDI_TYPE_MPU401 0x401
492
493#define SAMPLE_TYPE_BASIC 0x10
494#define SAMPLE_TYPE_GUS SAMPLE_TYPE_BASIC
495#define SAMPLE_TYPE_WAVEFRONT 0x11
496
497 int perc_mode; /* No longer supported */
498 int nr_voices;
499 int nr_drums; /* Obsolete field */
500 int instr_bank_size;
501 unsigned int capabilities;
502#define SYNTH_CAP_PERCMODE 0x00000001 /* No longer used */
503#define SYNTH_CAP_OPL3 0x00000002 /* Set if OPL3 supported */
504#define SYNTH_CAP_INPUT 0x00000004 /* Input (MIDI) device */
505 int dummies[19]; /* Reserve space */
506 };
507
508struct sound_timer_info {
509 char name[32];
510 int caps;
511 };
512
513#define MIDI_CAP_MPU401 1 /* MPU-401 intelligent mode */
514
515struct midi_info {
516 char name[30];
517 int device; /* 0-N. INITIALIZE BEFORE CALLING */
518 unsigned int capabilities; /* To be defined later */
519 int dev_type;
520 int dummies[18]; /* Reserve space */
521 };
522
523/********************************************
524 * ioctl commands for the /dev/midi##
525 */
526typedef struct {
527 unsigned char cmd;
528 char nr_args, nr_returns;
529 unsigned char data[30];
530 } mpu_command_rec;
531
532#define SNDCTL_MIDI_PRETIME _SIOWR('m', 0, int)
533#define SNDCTL_MIDI_MPUMODE _SIOWR('m', 1, int)
534#define SNDCTL_MIDI_MPUCMD _SIOWR('m', 2, mpu_command_rec)
535
536/********************************************
537 * IOCTL commands for /dev/dsp and /dev/audio
538 */
539
540#define SNDCTL_DSP_RESET _SIO ('P', 0)
541#define SNDCTL_DSP_SYNC _SIO ('P', 1)
542#define SNDCTL_DSP_SPEED _SIOWR('P', 2, int)
543#define SNDCTL_DSP_STEREO _SIOWR('P', 3, int)
544#define SNDCTL_DSP_GETBLKSIZE _SIOWR('P', 4, int)
545#define SNDCTL_DSP_SAMPLESIZE SNDCTL_DSP_SETFMT
546#define SNDCTL_DSP_CHANNELS _SIOWR('P', 6, int)
547#define SOUND_PCM_WRITE_CHANNELS SNDCTL_DSP_CHANNELS
548#define SOUND_PCM_WRITE_FILTER _SIOWR('P', 7, int)
549#define SNDCTL_DSP_POST _SIO ('P', 8)
550#define SNDCTL_DSP_SUBDIVIDE _SIOWR('P', 9, int)
551#define SNDCTL_DSP_SETFRAGMENT _SIOWR('P',10, int)
552
553/* Audio data formats (Note! U8=8 and S16_LE=16 for compatibility) */
554#define SNDCTL_DSP_GETFMTS _SIOR ('P',11, int) /* Returns a mask */
555#define SNDCTL_DSP_SETFMT _SIOWR('P',5, int) /* Selects ONE fmt*/
556# define AFMT_QUERY 0x00000000 /* Return current fmt */
557# define AFMT_MU_LAW 0x00000001
558# define AFMT_A_LAW 0x00000002
559# define AFMT_IMA_ADPCM 0x00000004
560# define AFMT_U8 0x00000008
561# define AFMT_S16_LE 0x00000010 /* Little endian signed 16*/
562# define AFMT_S16_BE 0x00000020 /* Big endian signed 16 */
563# define AFMT_S8 0x00000040
564# define AFMT_U16_LE 0x00000080 /* Little endian U16 */
565# define AFMT_U16_BE 0x00000100 /* Big endian U16 */
566# define AFMT_MPEG 0x00000200 /* MPEG (2) audio */
567# define AFMT_AC3 0x00000400 /* Dolby Digital AC3 */
568
569/*
570 * Buffer status queries.
571 */
572typedef struct audio_buf_info {
573 int fragments; /* # of available fragments (partially usend ones not counted) */
574 int fragstotal; /* Total # of fragments allocated */
575 int fragsize; /* Size of a fragment in bytes */
576
577 int bytes; /* Available space in bytes (includes partially used fragments) */
578 /* Note! 'bytes' could be more than fragments*fragsize */
579 } audio_buf_info;
580
581#define SNDCTL_DSP_GETOSPACE _SIOR ('P',12, audio_buf_info)
582#define SNDCTL_DSP_GETISPACE _SIOR ('P',13, audio_buf_info)
583#define SNDCTL_DSP_NONBLOCK _SIO ('P',14)
584#define SNDCTL_DSP_GETCAPS _SIOR ('P',15, int)
585# define DSP_CAP_REVISION 0x000000ff /* Bits for revision level (0 to 255) */
586# define DSP_CAP_DUPLEX 0x00000100 /* Full duplex record/playback */
587# define DSP_CAP_REALTIME 0x00000200 /* Real time capability */
588# define DSP_CAP_BATCH 0x00000400 /* Device has some kind of */
589 /* internal buffers which may */
590 /* cause some delays and */
591 /* decrease precision of timing */
592# define DSP_CAP_COPROC 0x00000800 /* Has a coprocessor */
593 /* Sometimes it's a DSP */
594 /* but usually not */
595# define DSP_CAP_TRIGGER 0x00001000 /* Supports SETTRIGGER */
596# define DSP_CAP_MMAP 0x00002000 /* Supports mmap() */
597# define DSP_CAP_MULTI 0x00004000 /* support multiple open */
598# define DSP_CAP_BIND 0x00008000 /* channel binding to front/rear/cneter/lfe */
599
600
601#define SNDCTL_DSP_GETTRIGGER _SIOR ('P',16, int)
602#define SNDCTL_DSP_SETTRIGGER _SIOW ('P',16, int)
603# define PCM_ENABLE_INPUT 0x00000001
604# define PCM_ENABLE_OUTPUT 0x00000002
605
606typedef struct count_info {
607 int bytes; /* Total # of bytes processed */
608 int blocks; /* # of fragment transitions since last time */
609 int ptr; /* Current DMA pointer value */
610 } count_info;
611
612#define SNDCTL_DSP_GETIPTR _SIOR ('P',17, count_info)
613#define SNDCTL_DSP_GETOPTR _SIOR ('P',18, count_info)
614
615typedef struct buffmem_desc {
616 unsigned *buffer;
617 int size;
618 } buffmem_desc;
619#define SNDCTL_DSP_MAPINBUF _SIOR ('P', 19, buffmem_desc)
620#define SNDCTL_DSP_MAPOUTBUF _SIOR ('P', 20, buffmem_desc)
621#define SNDCTL_DSP_SETSYNCRO _SIO ('P', 21)
622#define SNDCTL_DSP_SETDUPLEX _SIO ('P', 22)
623#define SNDCTL_DSP_GETODELAY _SIOR ('P', 23, int)
624
625#define SNDCTL_DSP_GETCHANNELMASK _SIOWR('P', 64, int)
626#define SNDCTL_DSP_BIND_CHANNEL _SIOWR('P', 65, int)
627# define DSP_BIND_QUERY 0x00000000
628# define DSP_BIND_FRONT 0x00000001
629# define DSP_BIND_SURR 0x00000002
630# define DSP_BIND_CENTER_LFE 0x00000004
631# define DSP_BIND_HANDSET 0x00000008
632# define DSP_BIND_MIC 0x00000010
633# define DSP_BIND_MODEM1 0x00000020
634# define DSP_BIND_MODEM2 0x00000040
635# define DSP_BIND_I2S 0x00000080
636# define DSP_BIND_SPDIF 0x00000100
637
638#define SNDCTL_DSP_SETSPDIF _SIOW ('P', 66, int)
639#define SNDCTL_DSP_GETSPDIF _SIOR ('P', 67, int)
640# define SPDIF_PRO 0x0001
641# define SPDIF_N_AUD 0x0002
642# define SPDIF_COPY 0x0004
643# define SPDIF_PRE 0x0008
644# define SPDIF_CC 0x07f0
645# define SPDIF_L 0x0800
646# define SPDIF_DRS 0x4000
647# define SPDIF_V 0x8000
648
649/*
650 * Application's profile defines the way how playback underrun situations should be handled.
651 *
652 * APF_NORMAL (the default) and APF_NETWORK make the driver to cleanup the
653 * playback buffer whenever an underrun occurs. This consumes some time
654 * prevents looping the existing buffer.
655 * APF_CPUINTENS is intended to be set by CPU intensive applications which
656 * are likely to run out of time occasionally. In this mode the buffer cleanup is
657 * disabled which saves CPU time but also let's the previous buffer content to
658 * be played during the "pause" after the underrun.
659 */
660#define SNDCTL_DSP_PROFILE _SIOW ('P', 23, int)
661#define APF_NORMAL 0 /* Normal applications */
662#define APF_NETWORK 1 /* Underruns probably caused by an "external" delay */
663#define APF_CPUINTENS 2 /* Underruns probably caused by "overheating" the CPU */
664
665#define SOUND_PCM_READ_RATE _SIOR ('P', 2, int)
666#define SOUND_PCM_READ_CHANNELS _SIOR ('P', 6, int)
667#define SOUND_PCM_READ_BITS _SIOR ('P', 5, int)
668#define SOUND_PCM_READ_FILTER _SIOR ('P', 7, int)
669
670/* Some alias names */
671#define SOUND_PCM_WRITE_BITS SNDCTL_DSP_SETFMT
672#define SOUND_PCM_WRITE_RATE SNDCTL_DSP_SPEED
673#define SOUND_PCM_POST SNDCTL_DSP_POST
674#define SOUND_PCM_RESET SNDCTL_DSP_RESET
675#define SOUND_PCM_SYNC SNDCTL_DSP_SYNC
676#define SOUND_PCM_SUBDIVIDE SNDCTL_DSP_SUBDIVIDE
677#define SOUND_PCM_SETFRAGMENT SNDCTL_DSP_SETFRAGMENT
678#define SOUND_PCM_GETFMTS SNDCTL_DSP_GETFMTS
679#define SOUND_PCM_SETFMT SNDCTL_DSP_SETFMT
680#define SOUND_PCM_GETOSPACE SNDCTL_DSP_GETOSPACE
681#define SOUND_PCM_GETISPACE SNDCTL_DSP_GETISPACE
682#define SOUND_PCM_NONBLOCK SNDCTL_DSP_NONBLOCK
683#define SOUND_PCM_GETCAPS SNDCTL_DSP_GETCAPS
684#define SOUND_PCM_GETTRIGGER SNDCTL_DSP_GETTRIGGER
685#define SOUND_PCM_SETTRIGGER SNDCTL_DSP_SETTRIGGER
686#define SOUND_PCM_SETSYNCRO SNDCTL_DSP_SETSYNCRO
687#define SOUND_PCM_GETIPTR SNDCTL_DSP_GETIPTR
688#define SOUND_PCM_GETOPTR SNDCTL_DSP_GETOPTR
689#define SOUND_PCM_MAPINBUF SNDCTL_DSP_MAPINBUF
690#define SOUND_PCM_MAPOUTBUF SNDCTL_DSP_MAPOUTBUF
691
692/*
693 * ioctl calls to be used in communication with coprocessors and
694 * DSP chips.
695 */
696
697typedef struct copr_buffer {
698 int command; /* Set to 0 if not used */
699 int flags;
700#define CPF_NONE 0x0000
701#define CPF_FIRST 0x0001 /* First block */
702#define CPF_LAST 0x0002 /* Last block */
703 int len;
704 int offs; /* If required by the device (0 if not used) */
705
706 unsigned char data[4000]; /* NOTE! 4000 is not 4k */
707 } copr_buffer;
708
709typedef struct copr_debug_buf {
710 int command; /* Used internally. Set to 0 */
711 int parm1;
712 int parm2;
713 int flags;
714 int len; /* Length of data in bytes */
715 } copr_debug_buf;
716
717typedef struct copr_msg {
718 int len;
719 unsigned char data[4000];
720 } copr_msg;
721
722#define SNDCTL_COPR_RESET _SIO ('C', 0)
723#define SNDCTL_COPR_LOAD _SIOWR('C', 1, copr_buffer)
724#define SNDCTL_COPR_RDATA _SIOWR('C', 2, copr_debug_buf)
725#define SNDCTL_COPR_RCODE _SIOWR('C', 3, copr_debug_buf)
726#define SNDCTL_COPR_WDATA _SIOW ('C', 4, copr_debug_buf)
727#define SNDCTL_COPR_WCODE _SIOW ('C', 5, copr_debug_buf)
728#define SNDCTL_COPR_RUN _SIOWR('C', 6, copr_debug_buf)
729#define SNDCTL_COPR_HALT _SIOWR('C', 7, copr_debug_buf)
730#define SNDCTL_COPR_SENDMSG _SIOWR('C', 8, copr_msg)
731#define SNDCTL_COPR_RCVMSG _SIOR ('C', 9, copr_msg)
732
733/*********************************************
734 * IOCTL commands for /dev/mixer
735 */
736
737/*
738 * Mixer devices
739 *
740 * There can be up to 20 different analog mixer channels. The
741 * SOUND_MIXER_NRDEVICES gives the currently supported maximum.
742 * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells
743 * the devices supported by the particular mixer.
744 */
745
746#define SOUND_MIXER_NRDEVICES 25
747#define SOUND_MIXER_VOLUME 0
748#define SOUND_MIXER_BASS 1
749#define SOUND_MIXER_TREBLE 2
750#define SOUND_MIXER_SYNTH 3
751#define SOUND_MIXER_PCM 4
752#define SOUND_MIXER_SPEAKER 5
753#define SOUND_MIXER_LINE 6
754#define SOUND_MIXER_MIC 7
755#define SOUND_MIXER_CD 8
756#define SOUND_MIXER_IMIX 9 /* Recording monitor */
757#define SOUND_MIXER_ALTPCM 10
758#define SOUND_MIXER_RECLEV 11 /* Recording level */
759#define SOUND_MIXER_IGAIN 12 /* Input gain */
760#define SOUND_MIXER_OGAIN 13 /* Output gain */
761/*
762 * The AD1848 codec and compatibles have three line level inputs
763 * (line, aux1 and aux2). Since each card manufacturer have assigned
764 * different meanings to these inputs, it's inpractical to assign
765 * specific meanings (line, cd, synth etc.) to them.
766 */
767#define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */
768#define SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */
769#define SOUND_MIXER_LINE3 16 /* Input source 3 (line) */
770#define SOUND_MIXER_DIGITAL1 17 /* Digital (input) 1 */
771#define SOUND_MIXER_DIGITAL2 18 /* Digital (input) 2 */
772#define SOUND_MIXER_DIGITAL3 19 /* Digital (input) 3 */
773#define SOUND_MIXER_PHONEIN 20 /* Phone input */
774#define SOUND_MIXER_PHONEOUT 21 /* Phone output */
775#define SOUND_MIXER_VIDEO 22 /* Video/TV (audio) in */
776#define SOUND_MIXER_RADIO 23 /* Radio in */
777#define SOUND_MIXER_MONITOR 24 /* Monitor (usually mic) volume */
778
779/* Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX) */
780/* Not counted to SOUND_MIXER_NRDEVICES, but use the same number space */
781#define SOUND_ONOFF_MIN 28
782#define SOUND_ONOFF_MAX 30
783
784/* Note! Number 31 cannot be used since the sign bit is reserved */
785#define SOUND_MIXER_NONE 31
786
787/*
788 * The following unsupported macros are no longer functional.
789 * Use SOUND_MIXER_PRIVATE# macros in future.
790 */
791#define SOUND_MIXER_ENHANCE SOUND_MIXER_NONE
792#define SOUND_MIXER_MUTE SOUND_MIXER_NONE
793#define SOUND_MIXER_LOUD SOUND_MIXER_NONE
794
795
796#define SOUND_DEVICE_LABELS {"Vol ", "Bass ", "Trebl", "Synth", "Pcm ", "Spkr ", "Line ", \
797 "Mic ", "CD ", "Mix ", "Pcm2 ", "Rec ", "IGain", "OGain", \
798 "Line1", "Line2", "Line3", "Digital1", "Digital2", "Digital3", \
799 "PhoneIn", "PhoneOut", "Video", "Radio", "Monitor"}
800
801#define SOUND_DEVICE_NAMES {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \
802 "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \
803 "line1", "line2", "line3", "dig1", "dig2", "dig3", \
804 "phin", "phout", "video", "radio", "monitor"}
805
806/* Device bitmask identifiers */
807
808#define SOUND_MIXER_RECSRC 0xff /* Arg contains a bit for each recording source */
809#define SOUND_MIXER_DEVMASK 0xfe /* Arg contains a bit for each supported device */
810#define SOUND_MIXER_RECMASK 0xfd /* Arg contains a bit for each supported recording source */
811#define SOUND_MIXER_CAPS 0xfc
812# define SOUND_CAP_EXCL_INPUT 0x00000001 /* Only one recording source at a time */
813#define SOUND_MIXER_STEREODEVS 0xfb /* Mixer channels supporting stereo */
814#define SOUND_MIXER_OUTSRC 0xfa /* Arg contains a bit for each input source to output */
815#define SOUND_MIXER_OUTMASK 0xf9 /* Arg contains a bit for each supported input source to output */
816
817/* Device mask bits */
818
819#define SOUND_MASK_VOLUME (1 << SOUND_MIXER_VOLUME)
820#define SOUND_MASK_BASS (1 << SOUND_MIXER_BASS)
821#define SOUND_MASK_TREBLE (1 << SOUND_MIXER_TREBLE)
822#define SOUND_MASK_SYNTH (1 << SOUND_MIXER_SYNTH)
823#define SOUND_MASK_PCM (1 << SOUND_MIXER_PCM)
824#define SOUND_MASK_SPEAKER (1 << SOUND_MIXER_SPEAKER)
825#define SOUND_MASK_LINE (1 << SOUND_MIXER_LINE)
826#define SOUND_MASK_MIC (1 << SOUND_MIXER_MIC)
827#define SOUND_MASK_CD (1 << SOUND_MIXER_CD)
828#define SOUND_MASK_IMIX (1 << SOUND_MIXER_IMIX)
829#define SOUND_MASK_ALTPCM (1 << SOUND_MIXER_ALTPCM)
830#define SOUND_MASK_RECLEV (1 << SOUND_MIXER_RECLEV)
831#define SOUND_MASK_IGAIN (1 << SOUND_MIXER_IGAIN)
832#define SOUND_MASK_OGAIN (1 << SOUND_MIXER_OGAIN)
833#define SOUND_MASK_LINE1 (1 << SOUND_MIXER_LINE1)
834#define SOUND_MASK_LINE2 (1 << SOUND_MIXER_LINE2)
835#define SOUND_MASK_LINE3 (1 << SOUND_MIXER_LINE3)
836#define SOUND_MASK_DIGITAL1 (1 << SOUND_MIXER_DIGITAL1)
837#define SOUND_MASK_DIGITAL2 (1 << SOUND_MIXER_DIGITAL2)
838#define SOUND_MASK_DIGITAL3 (1 << SOUND_MIXER_DIGITAL3)
839#define SOUND_MASK_PHONEIN (1 << SOUND_MIXER_PHONEIN)
840#define SOUND_MASK_PHONEOUT (1 << SOUND_MIXER_PHONEOUT)
841#define SOUND_MASK_RADIO (1 << SOUND_MIXER_RADIO)
842#define SOUND_MASK_VIDEO (1 << SOUND_MIXER_VIDEO)
843#define SOUND_MASK_MONITOR (1 << SOUND_MIXER_MONITOR)
844
845/* Obsolete macros */
846#define SOUND_MASK_MUTE (1 << SOUND_MIXER_MUTE)
847#define SOUND_MASK_ENHANCE (1 << SOUND_MIXER_ENHANCE)
848#define SOUND_MASK_LOUD (1 << SOUND_MIXER_LOUD)
849
850#define MIXER_READ(dev) _SIOR('M', dev, int)
851#define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME)
852#define SOUND_MIXER_READ_BASS MIXER_READ(SOUND_MIXER_BASS)
853#define SOUND_MIXER_READ_TREBLE MIXER_READ(SOUND_MIXER_TREBLE)
854#define SOUND_MIXER_READ_SYNTH MIXER_READ(SOUND_MIXER_SYNTH)
855#define SOUND_MIXER_READ_PCM MIXER_READ(SOUND_MIXER_PCM)
856#define SOUND_MIXER_READ_SPEAKER MIXER_READ(SOUND_MIXER_SPEAKER)
857#define SOUND_MIXER_READ_LINE MIXER_READ(SOUND_MIXER_LINE)
858#define SOUND_MIXER_READ_MIC MIXER_READ(SOUND_MIXER_MIC)
859#define SOUND_MIXER_READ_CD MIXER_READ(SOUND_MIXER_CD)
860#define SOUND_MIXER_READ_IMIX MIXER_READ(SOUND_MIXER_IMIX)
861#define SOUND_MIXER_READ_ALTPCM MIXER_READ(SOUND_MIXER_ALTPCM)
862#define SOUND_MIXER_READ_RECLEV MIXER_READ(SOUND_MIXER_RECLEV)
863#define SOUND_MIXER_READ_IGAIN MIXER_READ(SOUND_MIXER_IGAIN)
864#define SOUND_MIXER_READ_OGAIN MIXER_READ(SOUND_MIXER_OGAIN)
865#define SOUND_MIXER_READ_LINE1 MIXER_READ(SOUND_MIXER_LINE1)
866#define SOUND_MIXER_READ_LINE2 MIXER_READ(SOUND_MIXER_LINE2)
867#define SOUND_MIXER_READ_LINE3 MIXER_READ(SOUND_MIXER_LINE3)
868
869/* Obsolete macros */
870#define SOUND_MIXER_READ_MUTE MIXER_READ(SOUND_MIXER_MUTE)
871#define SOUND_MIXER_READ_ENHANCE MIXER_READ(SOUND_MIXER_ENHANCE)
872#define SOUND_MIXER_READ_LOUD MIXER_READ(SOUND_MIXER_LOUD)
873
874#define SOUND_MIXER_READ_RECSRC MIXER_READ(SOUND_MIXER_RECSRC)
875#define SOUND_MIXER_READ_DEVMASK MIXER_READ(SOUND_MIXER_DEVMASK)
876#define SOUND_MIXER_READ_RECMASK MIXER_READ(SOUND_MIXER_RECMASK)
877#define SOUND_MIXER_READ_STEREODEVS MIXER_READ(SOUND_MIXER_STEREODEVS)
878#define SOUND_MIXER_READ_CAPS MIXER_READ(SOUND_MIXER_CAPS)
879
880#define MIXER_WRITE(dev) _SIOWR('M', dev, int)
881#define SOUND_MIXER_WRITE_VOLUME MIXER_WRITE(SOUND_MIXER_VOLUME)
882#define SOUND_MIXER_WRITE_BASS MIXER_WRITE(SOUND_MIXER_BASS)
883#define SOUND_MIXER_WRITE_TREBLE MIXER_WRITE(SOUND_MIXER_TREBLE)
884#define SOUND_MIXER_WRITE_SYNTH MIXER_WRITE(SOUND_MIXER_SYNTH)
885#define SOUND_MIXER_WRITE_PCM MIXER_WRITE(SOUND_MIXER_PCM)
886#define SOUND_MIXER_WRITE_SPEAKER MIXER_WRITE(SOUND_MIXER_SPEAKER)
887#define SOUND_MIXER_WRITE_LINE MIXER_WRITE(SOUND_MIXER_LINE)
888#define SOUND_MIXER_WRITE_MIC MIXER_WRITE(SOUND_MIXER_MIC)
889#define SOUND_MIXER_WRITE_CD MIXER_WRITE(SOUND_MIXER_CD)
890#define SOUND_MIXER_WRITE_IMIX MIXER_WRITE(SOUND_MIXER_IMIX)
891#define SOUND_MIXER_WRITE_ALTPCM MIXER_WRITE(SOUND_MIXER_ALTPCM)
892#define SOUND_MIXER_WRITE_RECLEV MIXER_WRITE(SOUND_MIXER_RECLEV)
893#define SOUND_MIXER_WRITE_IGAIN MIXER_WRITE(SOUND_MIXER_IGAIN)
894#define SOUND_MIXER_WRITE_OGAIN MIXER_WRITE(SOUND_MIXER_OGAIN)
895#define SOUND_MIXER_WRITE_LINE1 MIXER_WRITE(SOUND_MIXER_LINE1)
896#define SOUND_MIXER_WRITE_LINE2 MIXER_WRITE(SOUND_MIXER_LINE2)
897#define SOUND_MIXER_WRITE_LINE3 MIXER_WRITE(SOUND_MIXER_LINE3)
898
899/* Obsolete macros */
900#define SOUND_MIXER_WRITE_MUTE MIXER_WRITE(SOUND_MIXER_MUTE)
901#define SOUND_MIXER_WRITE_ENHANCE MIXER_WRITE(SOUND_MIXER_ENHANCE)
902#define SOUND_MIXER_WRITE_LOUD MIXER_WRITE(SOUND_MIXER_LOUD)
903
904#define SOUND_MIXER_WRITE_RECSRC MIXER_WRITE(SOUND_MIXER_RECSRC)
905
906typedef struct mixer_info
907{
908 char id[16];
909 char name[32];
910 int modify_counter;
911 int fillers[10];
912} mixer_info;
913
914typedef struct _old_mixer_info /* Obsolete */
915{
916 char id[16];
917 char name[32];
918} _old_mixer_info;
919
920#define SOUND_MIXER_INFO _SIOR ('M', 101, mixer_info)
921#define SOUND_OLD_MIXER_INFO _SIOR ('M', 101, _old_mixer_info)
922
923/*
924 * A mechanism for accessing "proprietary" mixer features. This method
925 * permits passing 128 bytes of arbitrary data between a mixer application
926 * and the mixer driver. Interpretation of the record is defined by
927 * the particular mixer driver.
928 */
929typedef unsigned char mixer_record[128];
930
931#define SOUND_MIXER_ACCESS _SIOWR('M', 102, mixer_record)
932
933/*
934 * Two ioctls for special souncard function
935 */
936#define SOUND_MIXER_AGC _SIOWR('M', 103, int)
937#define SOUND_MIXER_3DSE _SIOWR('M', 104, int)
938
939/*
940 * The SOUND_MIXER_PRIVATE# commands can be redefined by low level drivers.
941 * These features can be used when accessing device specific features.
942 */
943#define SOUND_MIXER_PRIVATE1 _SIOWR('M', 111, int)
944#define SOUND_MIXER_PRIVATE2 _SIOWR('M', 112, int)
945#define SOUND_MIXER_PRIVATE3 _SIOWR('M', 113, int)
946#define SOUND_MIXER_PRIVATE4 _SIOWR('M', 114, int)
947#define SOUND_MIXER_PRIVATE5 _SIOWR('M', 115, int)
948
949/*
950 * SOUND_MIXER_GETLEVELS and SOUND_MIXER_SETLEVELS calls can be used
951 * for querying current mixer settings from the driver and for loading
952 * default volume settings _prior_ activating the mixer (loading
953 * doesn't affect current state of the mixer hardware). These calls
954 * are for internal use only.
955 */
956
957typedef struct mixer_vol_table {
958 int num; /* Index to volume table */
959 char name[32];
960 int levels[32];
961} mixer_vol_table;
962
963#define SOUND_MIXER_GETLEVELS _SIOWR('M', 116, mixer_vol_table)
964#define SOUND_MIXER_SETLEVELS _SIOWR('M', 117, mixer_vol_table)
965
966/*
967 * An ioctl for identifying the driver version. It will return value
968 * of the SOUND_VERSION macro used when compiling the driver.
969 * This call was introduced in OSS version 3.6 and it will not work
970 * with earlier versions (returns EINVAL).
971 */
972#define OSS_GETVERSION _SIOR ('M', 118, int)
973
974/*
975 * Level 2 event types for /dev/sequencer
976 */
977
978/*
979 * The 4 most significant bits of byte 0 specify the class of
980 * the event:
981 *
982 * 0x8X = system level events,
983 * 0x9X = device/port specific events, event[1] = device/port,
984 * The last 4 bits give the subtype:
985 * 0x02 = Channel event (event[3] = chn).
986 * 0x01 = note event (event[4] = note).
987 * (0x01 is not used alone but always with bit 0x02).
988 * event[2] = MIDI message code (0x80=note off etc.)
989 *
990 */
991
992#define EV_SEQ_LOCAL 0x80
993#define EV_TIMING 0x81
994#define EV_CHN_COMMON 0x92
995#define EV_CHN_VOICE 0x93
996#define EV_SYSEX 0x94
997/*
998 * Event types 200 to 220 are reserved for application use.
999 * These numbers will not be used by the driver.
1000 */
1001
1002/*
1003 * Events for event type EV_CHN_VOICE
1004 */
1005
1006#define MIDI_NOTEOFF 0x80
1007#define MIDI_NOTEON 0x90
1008#define MIDI_KEY_PRESSURE 0xA0
1009
1010/*
1011 * Events for event type EV_CHN_COMMON
1012 */
1013
1014#define MIDI_CTL_CHANGE 0xB0
1015#define MIDI_PGM_CHANGE 0xC0
1016#define MIDI_CHN_PRESSURE 0xD0
1017#define MIDI_PITCH_BEND 0xE0
1018
1019#define MIDI_SYSTEM_PREFIX 0xF0
1020
1021/*
1022 * Timer event types
1023 */
1024#define TMR_WAIT_REL 1 /* Time relative to the prev time */
1025#define TMR_WAIT_ABS 2 /* Absolute time since TMR_START */
1026#define TMR_STOP 3
1027#define TMR_START 4
1028#define TMR_CONTINUE 5
1029#define TMR_TEMPO 6
1030#define TMR_ECHO 8
1031#define TMR_CLOCK 9 /* MIDI clock */
1032#define TMR_SPP 10 /* Song position pointer */
1033#define TMR_TIMESIG 11 /* Time signature */
1034
1035/*
1036 * Local event types
1037 */
1038#define LOCL_STARTAUDIO 1
1039
1040#if !defined(__KERNEL__) || defined(USE_SEQ_MACROS)
1041/*
1042 * Some convenience macros to simplify programming of the
1043 * /dev/sequencer interface
1044 *
1045 * This is a legacy interface for applications written against
1046 * the OSSlib-3.8 style interface. It is no longer possible
1047 * to actually link against OSSlib with this header, but we
1048 * still provide these macros for programs using them.
1049 *
1050 * If you want to use OSSlib, it is recommended that you get
1051 * the GPL version of OSS-4.x and build against that version
1052 * of the header.
1053 *
1054 * We redefine the extern keyword so that make headers_check
1055 * does not complain about SEQ_USE_EXTBUF.
1056 */
1057#define SEQ_DECLAREBUF() SEQ_USE_EXTBUF()
1058
1059void seqbuf_dump(void); /* This function must be provided by programs */
1060
1061#define SEQ_PM_DEFINES int __foo_bar___
1062
1063#define SEQ_LOAD_GMINSTR(dev, instr)
1064#define SEQ_LOAD_GMDRUM(dev, drum)
1065
1066#define _SEQ_EXTERN extern
1067#define SEQ_USE_EXTBUF() \
1068 _SEQ_EXTERN unsigned char _seqbuf[]; \
1069 _SEQ_EXTERN int _seqbuflen; _SEQ_EXTERN int _seqbufptr
1070
1071#ifndef USE_SIMPLE_MACROS
1072/* Sample seqbuf_dump() implementation:
1073 *
1074 * SEQ_DEFINEBUF (2048); -- Defines a buffer for 2048 bytes
1075 *
1076 * int seqfd; -- The file descriptor for /dev/sequencer.
1077 *
1078 * void
1079 * seqbuf_dump ()
1080 * {
1081 * if (_seqbufptr)
1082 * if (write (seqfd, _seqbuf, _seqbufptr) == -1)
1083 * {
1084 * perror ("write /dev/sequencer");
1085 * exit (-1);
1086 * }
1087 * _seqbufptr = 0;
1088 * }
1089 */
1090
1091#define SEQ_DEFINEBUF(len) unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0
1092#define _SEQ_NEEDBUF(len) if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump()
1093#define _SEQ_ADVBUF(len) _seqbufptr += len
1094#define SEQ_DUMPBUF seqbuf_dump
1095#else
1096/*
1097 * This variation of the sequencer macros is used just to format one event
1098 * using fixed buffer.
1099 *
1100 * The program using the macro library must define the following macros before
1101 * using this library.
1102 *
1103 * #define _seqbuf name of the buffer (unsigned char[])
1104 * #define _SEQ_ADVBUF(len) If the applic needs to know the exact
1105 * size of the event, this macro can be used.
1106 * Otherwise this must be defined as empty.
1107 * #define _seqbufptr Define the name of index variable or 0 if
1108 * not required.
1109 */
1110#define _SEQ_NEEDBUF(len) /* empty */
1111#endif
1112
1113#define SEQ_VOLUME_MODE(dev, mode) {_SEQ_NEEDBUF(8);\
1114 _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
1115 _seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\
1116 _seqbuf[_seqbufptr+2] = (dev);\
1117 _seqbuf[_seqbufptr+3] = (mode);\
1118 _seqbuf[_seqbufptr+4] = 0;\
1119 _seqbuf[_seqbufptr+5] = 0;\
1120 _seqbuf[_seqbufptr+6] = 0;\
1121 _seqbuf[_seqbufptr+7] = 0;\
1122 _SEQ_ADVBUF(8);}
1123
1124/*
1125 * Midi voice messages
1126 */
1127
1128#define _CHN_VOICE(dev, event, chn, note, parm) \
1129 {_SEQ_NEEDBUF(8);\
1130 _seqbuf[_seqbufptr] = EV_CHN_VOICE;\
1131 _seqbuf[_seqbufptr+1] = (dev);\
1132 _seqbuf[_seqbufptr+2] = (event);\
1133 _seqbuf[_seqbufptr+3] = (chn);\
1134 _seqbuf[_seqbufptr+4] = (note);\
1135 _seqbuf[_seqbufptr+5] = (parm);\
1136 _seqbuf[_seqbufptr+6] = (0);\
1137 _seqbuf[_seqbufptr+7] = 0;\
1138 _SEQ_ADVBUF(8);}
1139
1140#define SEQ_START_NOTE(dev, chn, note, vol) \
1141 _CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol)
1142
1143#define SEQ_STOP_NOTE(dev, chn, note, vol) \
1144 _CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol)
1145
1146#define SEQ_KEY_PRESSURE(dev, chn, note, pressure) \
1147 _CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure)
1148
1149/*
1150 * Midi channel messages
1151 */
1152
1153#define _CHN_COMMON(dev, event, chn, p1, p2, w14) \
1154 {_SEQ_NEEDBUF(8);\
1155 _seqbuf[_seqbufptr] = EV_CHN_COMMON;\
1156 _seqbuf[_seqbufptr+1] = (dev);\
1157 _seqbuf[_seqbufptr+2] = (event);\
1158 _seqbuf[_seqbufptr+3] = (chn);\
1159 _seqbuf[_seqbufptr+4] = (p1);\
1160 _seqbuf[_seqbufptr+5] = (p2);\
1161 *(short *)&_seqbuf[_seqbufptr+6] = (w14);\
1162 _SEQ_ADVBUF(8);}
1163/*
1164 * SEQ_SYSEX permits sending of sysex messages. (It may look that it permits
1165 * sending any MIDI bytes but it's absolutely not possible. Trying to do
1166 * so _will_ cause problems with MPU401 intelligent mode).
1167 *
1168 * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be
1169 * sent by calling SEQ_SYSEX() several times (there must be no other events
1170 * between them). First sysex fragment must have 0xf0 in the first byte
1171 * and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte
1172 * between these sysex start and end markers cannot be larger than 0x7f. Also
1173 * lengths of each fragments (except the last one) must be 6.
1174 *
1175 * Breaking the above rules may work with some MIDI ports but is likely to
1176 * cause fatal problems with some other devices (such as MPU401).
1177 */
1178#define SEQ_SYSEX(dev, buf, len) \
1179 {int ii, ll=(len); \
1180 unsigned char *bufp=buf;\
1181 if (ll>6)ll=6;\
1182 _SEQ_NEEDBUF(8);\
1183 _seqbuf[_seqbufptr] = EV_SYSEX;\
1184 _seqbuf[_seqbufptr+1] = (dev);\
1185 for(ii=0;ii<ll;ii++)\
1186 _seqbuf[_seqbufptr+ii+2] = bufp[ii];\
1187 for(ii=ll;ii<6;ii++)\
1188 _seqbuf[_seqbufptr+ii+2] = 0xff;\
1189 _SEQ_ADVBUF(8);}
1190
1191#define SEQ_CHN_PRESSURE(dev, chn, pressure) \
1192 _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0)
1193
1194#define SEQ_SET_PATCH SEQ_PGM_CHANGE
1195#define SEQ_PGM_CHANGE(dev, chn, patch) \
1196 _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0)
1197
1198#define SEQ_CONTROL(dev, chn, controller, value) \
1199 _CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value)
1200
1201#define SEQ_BENDER(dev, chn, value) \
1202 _CHN_COMMON(dev, MIDI_PITCH_BEND, chn, 0, 0, value)
1203
1204
1205#define SEQ_V2_X_CONTROL(dev, voice, controller, value) {_SEQ_NEEDBUF(8);\
1206 _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
1207 _seqbuf[_seqbufptr+1] = SEQ_CONTROLLER;\
1208 _seqbuf[_seqbufptr+2] = (dev);\
1209 _seqbuf[_seqbufptr+3] = (voice);\
1210 _seqbuf[_seqbufptr+4] = (controller);\
1211 _seqbuf[_seqbufptr+5] = ((value)&0xff);\
1212 _seqbuf[_seqbufptr+6] = ((value>>8)&0xff);\
1213 _seqbuf[_seqbufptr+7] = 0;\
1214 _SEQ_ADVBUF(8);}
1215/*
1216 * The following 5 macros are incorrectly implemented and obsolete.
1217 * Use SEQ_BENDER and SEQ_CONTROL (with proper controller) instead.
1218 */
1219#define SEQ_PITCHBEND(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value)
1220#define SEQ_BENDER_RANGE(dev, voice, value) SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value)
1221#define SEQ_EXPRESSION(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128)
1222#define SEQ_MAIN_VOLUME(dev, voice, value) SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100)
1223#define SEQ_PANNING(dev, voice, pos) SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2)
1224
1225/*
1226 * Timing and synchronization macros
1227 */
1228
1229#define _TIMER_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\
1230 _seqbuf[_seqbufptr+0] = EV_TIMING; \
1231 _seqbuf[_seqbufptr+1] = (ev); \
1232 _seqbuf[_seqbufptr+2] = 0;\
1233 _seqbuf[_seqbufptr+3] = 0;\
1234 *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
1235 _SEQ_ADVBUF(8);}
1236
1237#define SEQ_START_TIMER() _TIMER_EVENT(TMR_START, 0)
1238#define SEQ_STOP_TIMER() _TIMER_EVENT(TMR_STOP, 0)
1239#define SEQ_CONTINUE_TIMER() _TIMER_EVENT(TMR_CONTINUE, 0)
1240#define SEQ_WAIT_TIME(ticks) _TIMER_EVENT(TMR_WAIT_ABS, ticks)
1241#define SEQ_DELTA_TIME(ticks) _TIMER_EVENT(TMR_WAIT_REL, ticks)
1242#define SEQ_ECHO_BACK(key) _TIMER_EVENT(TMR_ECHO, key)
1243#define SEQ_SET_TEMPO(value) _TIMER_EVENT(TMR_TEMPO, value)
1244#define SEQ_SONGPOS(pos) _TIMER_EVENT(TMR_SPP, pos)
1245#define SEQ_TIME_SIGNATURE(sig) _TIMER_EVENT(TMR_TIMESIG, sig)
1246
1247/*
1248 * Local control events
1249 */
1250
1251#define _LOCAL_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\
1252 _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \
1253 _seqbuf[_seqbufptr+1] = (ev); \
1254 _seqbuf[_seqbufptr+2] = 0;\
1255 _seqbuf[_seqbufptr+3] = 0;\
1256 *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
1257 _SEQ_ADVBUF(8);}
1258
1259#define SEQ_PLAYAUDIO(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO, devmask)
1260/*
1261 * Events for the level 1 interface only
1262 */
1263
1264#define SEQ_MIDIOUT(device, byte) {_SEQ_NEEDBUF(4);\
1265 _seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\
1266 _seqbuf[_seqbufptr+1] = (byte);\
1267 _seqbuf[_seqbufptr+2] = (device);\
1268 _seqbuf[_seqbufptr+3] = 0;\
1269 _SEQ_ADVBUF(4);}
1270
1271/*
1272 * Patch loading.
1273 */
1274#define SEQ_WRPATCH(patchx, len) \
1275 {if (_seqbufptr) SEQ_DUMPBUF();\
1276 if (write(seqfd, (char*)(patchx), len)==-1) \
1277 perror("Write patch: /dev/sequencer");}
1278#define SEQ_WRPATCH2(patchx, len) \
1279 (SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len))
1280
1281#endif
1282#endif /* _UAPISOUNDCARD_H */
diff --git a/include/uapi/linux/spi/Kbuild b/include/uapi/linux/spi/Kbuild
index aafaa5aa54d4..0cc747eff165 100644
--- a/include/uapi/linux/spi/Kbuild
+++ b/include/uapi/linux/spi/Kbuild
@@ -1 +1,2 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += spidev.h
diff --git a/include/linux/spi/spidev.h b/include/uapi/linux/spi/spidev.h
index 52d9ed01855f..52d9ed01855f 100644
--- a/include/linux/spi/spidev.h
+++ b/include/uapi/linux/spi/spidev.h
diff --git a/include/uapi/linux/stat.h b/include/uapi/linux/stat.h
new file mode 100644
index 000000000000..7fec7e36d921
--- /dev/null
+++ b/include/uapi/linux/stat.h
@@ -0,0 +1,45 @@
1#ifndef _UAPI_LINUX_STAT_H
2#define _UAPI_LINUX_STAT_H
3
4
5#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
6
7#define S_IFMT 00170000
8#define S_IFSOCK 0140000
9#define S_IFLNK 0120000
10#define S_IFREG 0100000
11#define S_IFBLK 0060000
12#define S_IFDIR 0040000
13#define S_IFCHR 0020000
14#define S_IFIFO 0010000
15#define S_ISUID 0004000
16#define S_ISGID 0002000
17#define S_ISVTX 0001000
18
19#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
20#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
21#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
22#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
23#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
24#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
25#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
26
27#define S_IRWXU 00700
28#define S_IRUSR 00400
29#define S_IWUSR 00200
30#define S_IXUSR 00100
31
32#define S_IRWXG 00070
33#define S_IRGRP 00040
34#define S_IWGRP 00020
35#define S_IXGRP 00010
36
37#define S_IRWXO 00007
38#define S_IROTH 00004
39#define S_IWOTH 00002
40#define S_IXOTH 00001
41
42#endif
43
44
45#endif /* _UAPI_LINUX_STAT_H */
diff --git a/include/uapi/linux/stddef.h b/include/uapi/linux/stddef.h
new file mode 100644
index 000000000000..aa9f10428743
--- /dev/null
+++ b/include/uapi/linux/stddef.h
@@ -0,0 +1 @@
#include <linux/compiler.h>
diff --git a/include/uapi/linux/string.h b/include/uapi/linux/string.h
new file mode 100644
index 000000000000..e32e545cff5a
--- /dev/null
+++ b/include/uapi/linux/string.h
@@ -0,0 +1,9 @@
1#ifndef _UAPI_LINUX_STRING_H_
2#define _UAPI_LINUX_STRING_H_
3
4/* We don't want strings.h stuff being used by user stuff by accident */
5
6#ifndef __KERNEL__
7#include <string.h>
8#endif /* __KERNEL__ */
9#endif /* _UAPI_LINUX_STRING_H_ */
diff --git a/include/uapi/linux/sunrpc/Kbuild b/include/uapi/linux/sunrpc/Kbuild
index aafaa5aa54d4..8e02e47c20fb 100644
--- a/include/uapi/linux/sunrpc/Kbuild
+++ b/include/uapi/linux/sunrpc/Kbuild
@@ -1 +1,2 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += debug.h
diff --git a/include/uapi/linux/sunrpc/debug.h b/include/uapi/linux/sunrpc/debug.h
new file mode 100644
index 000000000000..830e34493a8c
--- /dev/null
+++ b/include/uapi/linux/sunrpc/debug.h
@@ -0,0 +1,48 @@
1/*
2 * linux/include/linux/sunrpc/debug.h
3 *
4 * Debugging support for sunrpc module
5 *
6 * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
7 */
8
9#ifndef _UAPI_LINUX_SUNRPC_DEBUG_H_
10#define _UAPI_LINUX_SUNRPC_DEBUG_H_
11
12/*
13 * RPC debug facilities
14 */
15#define RPCDBG_XPRT 0x0001
16#define RPCDBG_CALL 0x0002
17#define RPCDBG_DEBUG 0x0004
18#define RPCDBG_NFS 0x0008
19#define RPCDBG_AUTH 0x0010
20#define RPCDBG_BIND 0x0020
21#define RPCDBG_SCHED 0x0040
22#define RPCDBG_TRANS 0x0080
23#define RPCDBG_SVCXPRT 0x0100
24#define RPCDBG_SVCDSP 0x0200
25#define RPCDBG_MISC 0x0400
26#define RPCDBG_CACHE 0x0800
27#define RPCDBG_ALL 0x7fff
28
29
30/*
31 * Declarations for the sysctl debug interface, which allows to read or
32 * change the debug flags for rpc, nfs, nfsd, and lockd. Since the sunrpc
33 * module currently registers its sysctl table dynamically, the sysctl path
34 * for module FOO is <CTL_SUNRPC, CTL_FOODEBUG>.
35 */
36
37enum {
38 CTL_RPCDEBUG = 1,
39 CTL_NFSDEBUG,
40 CTL_NFSDDEBUG,
41 CTL_NLMDEBUG,
42 CTL_SLOTTABLE_UDP,
43 CTL_SLOTTABLE_TCP,
44 CTL_MIN_RESVPORT,
45 CTL_MAX_RESVPORT,
46};
47
48#endif /* _UAPI_LINUX_SUNRPC_DEBUG_H_ */
diff --git a/include/linux/suspend_ioctls.h b/include/uapi/linux/suspend_ioctls.h
index 0b30382984fe..0b30382984fe 100644
--- a/include/linux/suspend_ioctls.h
+++ b/include/uapi/linux/suspend_ioctls.h
diff --git a/include/uapi/linux/swab.h b/include/uapi/linux/swab.h
new file mode 100644
index 000000000000..e811474724c2
--- /dev/null
+++ b/include/uapi/linux/swab.h
@@ -0,0 +1,282 @@
1#ifndef _UAPI_LINUX_SWAB_H
2#define _UAPI_LINUX_SWAB_H
3
4#include <linux/types.h>
5#include <linux/compiler.h>
6#include <asm/swab.h>
7
8/*
9 * casts are necessary for constants, because we never know how for sure
10 * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
11 */
12#define ___constant_swab16(x) ((__u16)( \
13 (((__u16)(x) & (__u16)0x00ffU) << 8) | \
14 (((__u16)(x) & (__u16)0xff00U) >> 8)))
15
16#define ___constant_swab32(x) ((__u32)( \
17 (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
18 (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
19 (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
20 (((__u32)(x) & (__u32)0xff000000UL) >> 24)))
21
22#define ___constant_swab64(x) ((__u64)( \
23 (((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
24 (((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \
25 (((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \
26 (((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \
27 (((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \
28 (((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
29 (((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
30 (((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56)))
31
32#define ___constant_swahw32(x) ((__u32)( \
33 (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \
34 (((__u32)(x) & (__u32)0xffff0000UL) >> 16)))
35
36#define ___constant_swahb32(x) ((__u32)( \
37 (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \
38 (((__u32)(x) & (__u32)0xff00ff00UL) >> 8)))
39
40/*
41 * Implement the following as inlines, but define the interface using
42 * macros to allow constant folding when possible:
43 * ___swab16, ___swab32, ___swab64, ___swahw32, ___swahb32
44 */
45
46static inline __attribute_const__ __u16 __fswab16(__u16 val)
47{
48#ifdef __arch_swab16
49 return __arch_swab16(val);
50#else
51 return ___constant_swab16(val);
52#endif
53}
54
55static inline __attribute_const__ __u32 __fswab32(__u32 val)
56{
57#ifdef __arch_swab32
58 return __arch_swab32(val);
59#else
60 return ___constant_swab32(val);
61#endif
62}
63
64static inline __attribute_const__ __u64 __fswab64(__u64 val)
65{
66#ifdef __arch_swab64
67 return __arch_swab64(val);
68#elif defined(__SWAB_64_THRU_32__)
69 __u32 h = val >> 32;
70 __u32 l = val & ((1ULL << 32) - 1);
71 return (((__u64)__fswab32(l)) << 32) | ((__u64)(__fswab32(h)));
72#else
73 return ___constant_swab64(val);
74#endif
75}
76
77static inline __attribute_const__ __u32 __fswahw32(__u32 val)
78{
79#ifdef __arch_swahw32
80 return __arch_swahw32(val);
81#else
82 return ___constant_swahw32(val);
83#endif
84}
85
86static inline __attribute_const__ __u32 __fswahb32(__u32 val)
87{
88#ifdef __arch_swahb32
89 return __arch_swahb32(val);
90#else
91 return ___constant_swahb32(val);
92#endif
93}
94
95/**
96 * __swab16 - return a byteswapped 16-bit value
97 * @x: value to byteswap
98 */
99#define __swab16(x) \
100 (__builtin_constant_p((__u16)(x)) ? \
101 ___constant_swab16(x) : \
102 __fswab16(x))
103
104/**
105 * __swab32 - return a byteswapped 32-bit value
106 * @x: value to byteswap
107 */
108#define __swab32(x) \
109 (__builtin_constant_p((__u32)(x)) ? \
110 ___constant_swab32(x) : \
111 __fswab32(x))
112
113/**
114 * __swab64 - return a byteswapped 64-bit value
115 * @x: value to byteswap
116 */
117#define __swab64(x) \
118 (__builtin_constant_p((__u64)(x)) ? \
119 ___constant_swab64(x) : \
120 __fswab64(x))
121
122/**
123 * __swahw32 - return a word-swapped 32-bit value
124 * @x: value to wordswap
125 *
126 * __swahw32(0x12340000) is 0x00001234
127 */
128#define __swahw32(x) \
129 (__builtin_constant_p((__u32)(x)) ? \
130 ___constant_swahw32(x) : \
131 __fswahw32(x))
132
133/**
134 * __swahb32 - return a high and low byte-swapped 32-bit value
135 * @x: value to byteswap
136 *
137 * __swahb32(0x12345678) is 0x34127856
138 */
139#define __swahb32(x) \
140 (__builtin_constant_p((__u32)(x)) ? \
141 ___constant_swahb32(x) : \
142 __fswahb32(x))
143
144/**
145 * __swab16p - return a byteswapped 16-bit value from a pointer
146 * @p: pointer to a naturally-aligned 16-bit value
147 */
148static inline __u16 __swab16p(const __u16 *p)
149{
150#ifdef __arch_swab16p
151 return __arch_swab16p(p);
152#else
153 return __swab16(*p);
154#endif
155}
156
157/**
158 * __swab32p - return a byteswapped 32-bit value from a pointer
159 * @p: pointer to a naturally-aligned 32-bit value
160 */
161static inline __u32 __swab32p(const __u32 *p)
162{
163#ifdef __arch_swab32p
164 return __arch_swab32p(p);
165#else
166 return __swab32(*p);
167#endif
168}
169
170/**
171 * __swab64p - return a byteswapped 64-bit value from a pointer
172 * @p: pointer to a naturally-aligned 64-bit value
173 */
174static inline __u64 __swab64p(const __u64 *p)
175{
176#ifdef __arch_swab64p
177 return __arch_swab64p(p);
178#else
179 return __swab64(*p);
180#endif
181}
182
183/**
184 * __swahw32p - return a wordswapped 32-bit value from a pointer
185 * @p: pointer to a naturally-aligned 32-bit value
186 *
187 * See __swahw32() for details of wordswapping.
188 */
189static inline __u32 __swahw32p(const __u32 *p)
190{
191#ifdef __arch_swahw32p
192 return __arch_swahw32p(p);
193#else
194 return __swahw32(*p);
195#endif
196}
197
198/**
199 * __swahb32p - return a high and low byteswapped 32-bit value from a pointer
200 * @p: pointer to a naturally-aligned 32-bit value
201 *
202 * See __swahb32() for details of high/low byteswapping.
203 */
204static inline __u32 __swahb32p(const __u32 *p)
205{
206#ifdef __arch_swahb32p
207 return __arch_swahb32p(p);
208#else
209 return __swahb32(*p);
210#endif
211}
212
213/**
214 * __swab16s - byteswap a 16-bit value in-place
215 * @p: pointer to a naturally-aligned 16-bit value
216 */
217static inline void __swab16s(__u16 *p)
218{
219#ifdef __arch_swab16s
220 __arch_swab16s(p);
221#else
222 *p = __swab16p(p);
223#endif
224}
225/**
226 * __swab32s - byteswap a 32-bit value in-place
227 * @p: pointer to a naturally-aligned 32-bit value
228 */
229static inline void __swab32s(__u32 *p)
230{
231#ifdef __arch_swab32s
232 __arch_swab32s(p);
233#else
234 *p = __swab32p(p);
235#endif
236}
237
238/**
239 * __swab64s - byteswap a 64-bit value in-place
240 * @p: pointer to a naturally-aligned 64-bit value
241 */
242static inline void __swab64s(__u64 *p)
243{
244#ifdef __arch_swab64s
245 __arch_swab64s(p);
246#else
247 *p = __swab64p(p);
248#endif
249}
250
251/**
252 * __swahw32s - wordswap a 32-bit value in-place
253 * @p: pointer to a naturally-aligned 32-bit value
254 *
255 * See __swahw32() for details of wordswapping
256 */
257static inline void __swahw32s(__u32 *p)
258{
259#ifdef __arch_swahw32s
260 __arch_swahw32s(p);
261#else
262 *p = __swahw32p(p);
263#endif
264}
265
266/**
267 * __swahb32s - high and low byteswap a 32-bit value in-place
268 * @p: pointer to a naturally-aligned 32-bit value
269 *
270 * See __swahb32() for details of high and low byte swapping
271 */
272static inline void __swahb32s(__u32 *p)
273{
274#ifdef __arch_swahb32s
275 __arch_swahb32s(p);
276#else
277 *p = __swahb32p(p);
278#endif
279}
280
281
282#endif /* _UAPI_LINUX_SWAB_H */
diff --git a/include/uapi/linux/synclink.h b/include/uapi/linux/synclink.h
new file mode 100644
index 000000000000..7dcb065a5f76
--- /dev/null
+++ b/include/uapi/linux/synclink.h
@@ -0,0 +1,300 @@
1/*
2 * SyncLink Multiprotocol Serial Adapter Driver
3 *
4 * $Id: synclink.h,v 3.14 2006/07/17 20:15:43 paulkf Exp $
5 *
6 * Copyright (C) 1998-2000 by Microgate Corporation
7 *
8 * Redistribution of this file is permitted under
9 * the terms of the GNU Public License (GPL)
10 */
11
12#ifndef _UAPI_SYNCLINK_H_
13#define _UAPI_SYNCLINK_H_
14#define SYNCLINK_H_VERSION 3.6
15
16#include <linux/types.h>
17
18#define BIT0 0x0001
19#define BIT1 0x0002
20#define BIT2 0x0004
21#define BIT3 0x0008
22#define BIT4 0x0010
23#define BIT5 0x0020
24#define BIT6 0x0040
25#define BIT7 0x0080
26#define BIT8 0x0100
27#define BIT9 0x0200
28#define BIT10 0x0400
29#define BIT11 0x0800
30#define BIT12 0x1000
31#define BIT13 0x2000
32#define BIT14 0x4000
33#define BIT15 0x8000
34#define BIT16 0x00010000
35#define BIT17 0x00020000
36#define BIT18 0x00040000
37#define BIT19 0x00080000
38#define BIT20 0x00100000
39#define BIT21 0x00200000
40#define BIT22 0x00400000
41#define BIT23 0x00800000
42#define BIT24 0x01000000
43#define BIT25 0x02000000
44#define BIT26 0x04000000
45#define BIT27 0x08000000
46#define BIT28 0x10000000
47#define BIT29 0x20000000
48#define BIT30 0x40000000
49#define BIT31 0x80000000
50
51
52#define HDLC_MAX_FRAME_SIZE 65535
53#define MAX_ASYNC_TRANSMIT 4096
54#define MAX_ASYNC_BUFFER_SIZE 4096
55
56#define ASYNC_PARITY_NONE 0
57#define ASYNC_PARITY_EVEN 1
58#define ASYNC_PARITY_ODD 2
59#define ASYNC_PARITY_SPACE 3
60
61#define HDLC_FLAG_UNDERRUN_ABORT7 0x0000
62#define HDLC_FLAG_UNDERRUN_ABORT15 0x0001
63#define HDLC_FLAG_UNDERRUN_FLAG 0x0002
64#define HDLC_FLAG_UNDERRUN_CRC 0x0004
65#define HDLC_FLAG_SHARE_ZERO 0x0010
66#define HDLC_FLAG_AUTO_CTS 0x0020
67#define HDLC_FLAG_AUTO_DCD 0x0040
68#define HDLC_FLAG_AUTO_RTS 0x0080
69#define HDLC_FLAG_RXC_DPLL 0x0100
70#define HDLC_FLAG_RXC_BRG 0x0200
71#define HDLC_FLAG_RXC_TXCPIN 0x8000
72#define HDLC_FLAG_RXC_RXCPIN 0x0000
73#define HDLC_FLAG_TXC_DPLL 0x0400
74#define HDLC_FLAG_TXC_BRG 0x0800
75#define HDLC_FLAG_TXC_TXCPIN 0x0000
76#define HDLC_FLAG_TXC_RXCPIN 0x0008
77#define HDLC_FLAG_DPLL_DIV8 0x1000
78#define HDLC_FLAG_DPLL_DIV16 0x2000
79#define HDLC_FLAG_DPLL_DIV32 0x0000
80#define HDLC_FLAG_HDLC_LOOPMODE 0x4000
81
82#define HDLC_CRC_NONE 0
83#define HDLC_CRC_16_CCITT 1
84#define HDLC_CRC_32_CCITT 2
85#define HDLC_CRC_MASK 0x00ff
86#define HDLC_CRC_RETURN_EX 0x8000
87
88#define RX_OK 0
89#define RX_CRC_ERROR 1
90
91#define HDLC_TXIDLE_FLAGS 0
92#define HDLC_TXIDLE_ALT_ZEROS_ONES 1
93#define HDLC_TXIDLE_ZEROS 2
94#define HDLC_TXIDLE_ONES 3
95#define HDLC_TXIDLE_ALT_MARK_SPACE 4
96#define HDLC_TXIDLE_SPACE 5
97#define HDLC_TXIDLE_MARK 6
98#define HDLC_TXIDLE_CUSTOM_8 0x10000000
99#define HDLC_TXIDLE_CUSTOM_16 0x20000000
100
101#define HDLC_ENCODING_NRZ 0
102#define HDLC_ENCODING_NRZB 1
103#define HDLC_ENCODING_NRZI_MARK 2
104#define HDLC_ENCODING_NRZI_SPACE 3
105#define HDLC_ENCODING_NRZI HDLC_ENCODING_NRZI_SPACE
106#define HDLC_ENCODING_BIPHASE_MARK 4
107#define HDLC_ENCODING_BIPHASE_SPACE 5
108#define HDLC_ENCODING_BIPHASE_LEVEL 6
109#define HDLC_ENCODING_DIFF_BIPHASE_LEVEL 7
110
111#define HDLC_PREAMBLE_LENGTH_8BITS 0
112#define HDLC_PREAMBLE_LENGTH_16BITS 1
113#define HDLC_PREAMBLE_LENGTH_32BITS 2
114#define HDLC_PREAMBLE_LENGTH_64BITS 3
115
116#define HDLC_PREAMBLE_PATTERN_NONE 0
117#define HDLC_PREAMBLE_PATTERN_ZEROS 1
118#define HDLC_PREAMBLE_PATTERN_FLAGS 2
119#define HDLC_PREAMBLE_PATTERN_10 3
120#define HDLC_PREAMBLE_PATTERN_01 4
121#define HDLC_PREAMBLE_PATTERN_ONES 5
122
123#define MGSL_MODE_ASYNC 1
124#define MGSL_MODE_HDLC 2
125#define MGSL_MODE_MONOSYNC 3
126#define MGSL_MODE_BISYNC 4
127#define MGSL_MODE_RAW 6
128#define MGSL_MODE_BASE_CLOCK 7
129#define MGSL_MODE_XSYNC 8
130
131#define MGSL_BUS_TYPE_ISA 1
132#define MGSL_BUS_TYPE_EISA 2
133#define MGSL_BUS_TYPE_PCI 5
134
135#define MGSL_INTERFACE_MASK 0xf
136#define MGSL_INTERFACE_DISABLE 0
137#define MGSL_INTERFACE_RS232 1
138#define MGSL_INTERFACE_V35 2
139#define MGSL_INTERFACE_RS422 3
140#define MGSL_INTERFACE_RTS_EN 0x10
141#define MGSL_INTERFACE_LL 0x20
142#define MGSL_INTERFACE_RL 0x40
143#define MGSL_INTERFACE_MSB_FIRST 0x80
144
145typedef struct _MGSL_PARAMS
146{
147 /* Common */
148
149 unsigned long mode; /* Asynchronous or HDLC */
150 unsigned char loopback; /* internal loopback mode */
151
152 /* HDLC Only */
153
154 unsigned short flags;
155 unsigned char encoding; /* NRZ, NRZI, etc. */
156 unsigned long clock_speed; /* external clock speed in bits per second */
157 unsigned char addr_filter; /* receive HDLC address filter, 0xFF = disable */
158 unsigned short crc_type; /* None, CRC16-CCITT, or CRC32-CCITT */
159 unsigned char preamble_length;
160 unsigned char preamble;
161
162 /* Async Only */
163
164 unsigned long data_rate; /* bits per second */
165 unsigned char data_bits; /* 7 or 8 data bits */
166 unsigned char stop_bits; /* 1 or 2 stop bits */
167 unsigned char parity; /* none, even, or odd */
168
169} MGSL_PARAMS, *PMGSL_PARAMS;
170
171#define MICROGATE_VENDOR_ID 0x13c0
172#define SYNCLINK_DEVICE_ID 0x0010
173#define MGSCC_DEVICE_ID 0x0020
174#define SYNCLINK_SCA_DEVICE_ID 0x0030
175#define SYNCLINK_GT_DEVICE_ID 0x0070
176#define SYNCLINK_GT4_DEVICE_ID 0x0080
177#define SYNCLINK_AC_DEVICE_ID 0x0090
178#define SYNCLINK_GT2_DEVICE_ID 0x00A0
179#define MGSL_MAX_SERIAL_NUMBER 30
180
181/*
182** device diagnostics status
183*/
184
185#define DiagStatus_OK 0
186#define DiagStatus_AddressFailure 1
187#define DiagStatus_AddressConflict 2
188#define DiagStatus_IrqFailure 3
189#define DiagStatus_IrqConflict 4
190#define DiagStatus_DmaFailure 5
191#define DiagStatus_DmaConflict 6
192#define DiagStatus_PciAdapterNotFound 7
193#define DiagStatus_CantAssignPciResources 8
194#define DiagStatus_CantAssignPciMemAddr 9
195#define DiagStatus_CantAssignPciIoAddr 10
196#define DiagStatus_CantAssignPciIrq 11
197#define DiagStatus_MemoryError 12
198
199#define SerialSignal_DCD 0x01 /* Data Carrier Detect */
200#define SerialSignal_TXD 0x02 /* Transmit Data */
201#define SerialSignal_RI 0x04 /* Ring Indicator */
202#define SerialSignal_RXD 0x08 /* Receive Data */
203#define SerialSignal_CTS 0x10 /* Clear to Send */
204#define SerialSignal_RTS 0x20 /* Request to Send */
205#define SerialSignal_DSR 0x40 /* Data Set Ready */
206#define SerialSignal_DTR 0x80 /* Data Terminal Ready */
207
208
209/*
210 * Counters of the input lines (CTS, DSR, RI, CD) interrupts
211 */
212struct mgsl_icount {
213 __u32 cts, dsr, rng, dcd, tx, rx;
214 __u32 frame, parity, overrun, brk;
215 __u32 buf_overrun;
216 __u32 txok;
217 __u32 txunder;
218 __u32 txabort;
219 __u32 txtimeout;
220 __u32 rxshort;
221 __u32 rxlong;
222 __u32 rxabort;
223 __u32 rxover;
224 __u32 rxcrc;
225 __u32 rxok;
226 __u32 exithunt;
227 __u32 rxidle;
228};
229
230struct gpio_desc {
231 __u32 state;
232 __u32 smask;
233 __u32 dir;
234 __u32 dmask;
235};
236
237#define DEBUG_LEVEL_DATA 1
238#define DEBUG_LEVEL_ERROR 2
239#define DEBUG_LEVEL_INFO 3
240#define DEBUG_LEVEL_BH 4
241#define DEBUG_LEVEL_ISR 5
242
243/*
244** Event bit flags for use with MgslWaitEvent
245*/
246
247#define MgslEvent_DsrActive 0x0001
248#define MgslEvent_DsrInactive 0x0002
249#define MgslEvent_Dsr 0x0003
250#define MgslEvent_CtsActive 0x0004
251#define MgslEvent_CtsInactive 0x0008
252#define MgslEvent_Cts 0x000c
253#define MgslEvent_DcdActive 0x0010
254#define MgslEvent_DcdInactive 0x0020
255#define MgslEvent_Dcd 0x0030
256#define MgslEvent_RiActive 0x0040
257#define MgslEvent_RiInactive 0x0080
258#define MgslEvent_Ri 0x00c0
259#define MgslEvent_ExitHuntMode 0x0100
260#define MgslEvent_IdleReceived 0x0200
261
262/* Private IOCTL codes:
263 *
264 * MGSL_IOCSPARAMS set MGSL_PARAMS structure values
265 * MGSL_IOCGPARAMS get current MGSL_PARAMS structure values
266 * MGSL_IOCSTXIDLE set current transmit idle mode
267 * MGSL_IOCGTXIDLE get current transmit idle mode
268 * MGSL_IOCTXENABLE enable or disable transmitter
269 * MGSL_IOCRXENABLE enable or disable receiver
270 * MGSL_IOCTXABORT abort transmitting frame (HDLC)
271 * MGSL_IOCGSTATS return current statistics
272 * MGSL_IOCWAITEVENT wait for specified event to occur
273 * MGSL_LOOPTXDONE transmit in HDLC LoopMode done
274 * MGSL_IOCSIF set the serial interface type
275 * MGSL_IOCGIF get the serial interface type
276 */
277#define MGSL_MAGIC_IOC 'm'
278#define MGSL_IOCSPARAMS _IOW(MGSL_MAGIC_IOC,0,struct _MGSL_PARAMS)
279#define MGSL_IOCGPARAMS _IOR(MGSL_MAGIC_IOC,1,struct _MGSL_PARAMS)
280#define MGSL_IOCSTXIDLE _IO(MGSL_MAGIC_IOC,2)
281#define MGSL_IOCGTXIDLE _IO(MGSL_MAGIC_IOC,3)
282#define MGSL_IOCTXENABLE _IO(MGSL_MAGIC_IOC,4)
283#define MGSL_IOCRXENABLE _IO(MGSL_MAGIC_IOC,5)
284#define MGSL_IOCTXABORT _IO(MGSL_MAGIC_IOC,6)
285#define MGSL_IOCGSTATS _IO(MGSL_MAGIC_IOC,7)
286#define MGSL_IOCWAITEVENT _IOWR(MGSL_MAGIC_IOC,8,int)
287#define MGSL_IOCCLRMODCOUNT _IO(MGSL_MAGIC_IOC,15)
288#define MGSL_IOCLOOPTXDONE _IO(MGSL_MAGIC_IOC,9)
289#define MGSL_IOCSIF _IO(MGSL_MAGIC_IOC,10)
290#define MGSL_IOCGIF _IO(MGSL_MAGIC_IOC,11)
291#define MGSL_IOCSGPIO _IOW(MGSL_MAGIC_IOC,16,struct gpio_desc)
292#define MGSL_IOCGGPIO _IOR(MGSL_MAGIC_IOC,17,struct gpio_desc)
293#define MGSL_IOCWAITGPIO _IOWR(MGSL_MAGIC_IOC,18,struct gpio_desc)
294#define MGSL_IOCSXSYNC _IO(MGSL_MAGIC_IOC, 19)
295#define MGSL_IOCGXSYNC _IO(MGSL_MAGIC_IOC, 20)
296#define MGSL_IOCSXCTRL _IO(MGSL_MAGIC_IOC, 21)
297#define MGSL_IOCGXCTRL _IO(MGSL_MAGIC_IOC, 22)
298
299
300#endif /* _UAPI_SYNCLINK_H_ */
diff --git a/include/uapi/linux/sysctl.h b/include/uapi/linux/sysctl.h
new file mode 100644
index 000000000000..6d6721341f49
--- /dev/null
+++ b/include/uapi/linux/sysctl.h
@@ -0,0 +1,932 @@
1/*
2 * sysctl.h: General linux system control interface
3 *
4 * Begun 24 March 1995, Stephen Tweedie
5 *
6 ****************************************************************
7 ****************************************************************
8 **
9 ** WARNING:
10 ** The values in this file are exported to user space via
11 ** the sysctl() binary interface. Do *NOT* change the
12 ** numbering of any existing values here, and do not change
13 ** any numbers within any one set of values. If you have to
14 ** redefine an existing interface, use a new number for it.
15 ** The kernel will then return -ENOTDIR to any application using
16 ** the old binary interface.
17 **
18 ****************************************************************
19 ****************************************************************
20 */
21
22#ifndef _UAPI_LINUX_SYSCTL_H
23#define _UAPI_LINUX_SYSCTL_H
24
25#include <linux/kernel.h>
26#include <linux/types.h>
27#include <linux/compiler.h>
28
29struct completion;
30
31#define CTL_MAXNAME 10 /* how many path components do we allow in a
32 call to sysctl? In other words, what is
33 the largest acceptable value for the nlen
34 member of a struct __sysctl_args to have? */
35
36struct __sysctl_args {
37 int __user *name;
38 int nlen;
39 void __user *oldval;
40 size_t __user *oldlenp;
41 void __user *newval;
42 size_t newlen;
43 unsigned long __unused[4];
44};
45
46/* Define sysctl names first */
47
48/* Top-level names: */
49
50enum
51{
52 CTL_KERN=1, /* General kernel info and control */
53 CTL_VM=2, /* VM management */
54 CTL_NET=3, /* Networking */
55 CTL_PROC=4, /* removal breaks strace(1) compilation */
56 CTL_FS=5, /* Filesystems */
57 CTL_DEBUG=6, /* Debugging */
58 CTL_DEV=7, /* Devices */
59 CTL_BUS=8, /* Busses */
60 CTL_ABI=9, /* Binary emulation */
61 CTL_CPU=10, /* CPU stuff (speed scaling, etc) */
62 CTL_ARLAN=254, /* arlan wireless driver */
63 CTL_S390DBF=5677, /* s390 debug */
64 CTL_SUNRPC=7249, /* sunrpc debug */
65 CTL_PM=9899, /* frv power management */
66 CTL_FRV=9898, /* frv specific sysctls */
67};
68
69/* CTL_BUS names: */
70enum
71{
72 CTL_BUS_ISA=1 /* ISA */
73};
74
75/* /proc/sys/fs/inotify/ */
76enum
77{
78 INOTIFY_MAX_USER_INSTANCES=1, /* max instances per user */
79 INOTIFY_MAX_USER_WATCHES=2, /* max watches per user */
80 INOTIFY_MAX_QUEUED_EVENTS=3 /* max queued events per instance */
81};
82
83/* CTL_KERN names: */
84enum
85{
86 KERN_OSTYPE=1, /* string: system version */
87 KERN_OSRELEASE=2, /* string: system release */
88 KERN_OSREV=3, /* int: system revision */
89 KERN_VERSION=4, /* string: compile time info */
90 KERN_SECUREMASK=5, /* struct: maximum rights mask */
91 KERN_PROF=6, /* table: profiling information */
92 KERN_NODENAME=7, /* string: hostname */
93 KERN_DOMAINNAME=8, /* string: domainname */
94
95 KERN_PANIC=15, /* int: panic timeout */
96 KERN_REALROOTDEV=16, /* real root device to mount after initrd */
97
98 KERN_SPARC_REBOOT=21, /* reboot command on Sparc */
99 KERN_CTLALTDEL=22, /* int: allow ctl-alt-del to reboot */
100 KERN_PRINTK=23, /* struct: control printk logging parameters */
101 KERN_NAMETRANS=24, /* Name translation */
102 KERN_PPC_HTABRECLAIM=25, /* turn htab reclaimation on/off on PPC */
103 KERN_PPC_ZEROPAGED=26, /* turn idle page zeroing on/off on PPC */
104 KERN_PPC_POWERSAVE_NAP=27, /* use nap mode for power saving */
105 KERN_MODPROBE=28, /* string: modprobe path */
106 KERN_SG_BIG_BUFF=29, /* int: sg driver reserved buffer size */
107 KERN_ACCT=30, /* BSD process accounting parameters */
108 KERN_PPC_L2CR=31, /* l2cr register on PPC */
109
110 KERN_RTSIGNR=32, /* Number of rt sigs queued */
111 KERN_RTSIGMAX=33, /* Max queuable */
112
113 KERN_SHMMAX=34, /* long: Maximum shared memory segment */
114 KERN_MSGMAX=35, /* int: Maximum size of a messege */
115 KERN_MSGMNB=36, /* int: Maximum message queue size */
116 KERN_MSGPOOL=37, /* int: Maximum system message pool size */
117 KERN_SYSRQ=38, /* int: Sysreq enable */
118 KERN_MAX_THREADS=39, /* int: Maximum nr of threads in the system */
119 KERN_RANDOM=40, /* Random driver */
120 KERN_SHMALL=41, /* int: Maximum size of shared memory */
121 KERN_MSGMNI=42, /* int: msg queue identifiers */
122 KERN_SEM=43, /* struct: sysv semaphore limits */
123 KERN_SPARC_STOP_A=44, /* int: Sparc Stop-A enable */
124 KERN_SHMMNI=45, /* int: shm array identifiers */
125 KERN_OVERFLOWUID=46, /* int: overflow UID */
126 KERN_OVERFLOWGID=47, /* int: overflow GID */
127 KERN_SHMPATH=48, /* string: path to shm fs */
128 KERN_HOTPLUG=49, /* string: path to uevent helper (deprecated) */
129 KERN_IEEE_EMULATION_WARNINGS=50, /* int: unimplemented ieee instructions */
130 KERN_S390_USER_DEBUG_LOGGING=51, /* int: dumps of user faults */
131 KERN_CORE_USES_PID=52, /* int: use core or core.%pid */
132 KERN_TAINTED=53, /* int: various kernel tainted flags */
133 KERN_CADPID=54, /* int: PID of the process to notify on CAD */
134 KERN_PIDMAX=55, /* int: PID # limit */
135 KERN_CORE_PATTERN=56, /* string: pattern for core-file names */
136 KERN_PANIC_ON_OOPS=57, /* int: whether we will panic on an oops */
137 KERN_HPPA_PWRSW=58, /* int: hppa soft-power enable */
138 KERN_HPPA_UNALIGNED=59, /* int: hppa unaligned-trap enable */
139 KERN_PRINTK_RATELIMIT=60, /* int: tune printk ratelimiting */
140 KERN_PRINTK_RATELIMIT_BURST=61, /* int: tune printk ratelimiting */
141 KERN_PTY=62, /* dir: pty driver */
142 KERN_NGROUPS_MAX=63, /* int: NGROUPS_MAX */
143 KERN_SPARC_SCONS_PWROFF=64, /* int: serial console power-off halt */
144 KERN_HZ_TIMER=65, /* int: hz timer on or off */
145 KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */
146 KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */
147 KERN_RANDOMIZE=68, /* int: randomize virtual address space */
148 KERN_SETUID_DUMPABLE=69, /* int: behaviour of dumps for setuid core */
149 KERN_SPIN_RETRY=70, /* int: number of spinlock retries */
150 KERN_ACPI_VIDEO_FLAGS=71, /* int: flags for setting up video after ACPI sleep */
151 KERN_IA64_UNALIGNED=72, /* int: ia64 unaligned userland trap enable */
152 KERN_COMPAT_LOG=73, /* int: print compat layer messages */
153 KERN_MAX_LOCK_DEPTH=74, /* int: rtmutex's maximum lock depth */
154 KERN_NMI_WATCHDOG=75, /* int: enable/disable nmi watchdog */
155 KERN_PANIC_ON_NMI=76, /* int: whether we will panic on an unrecovered */
156};
157
158
159
160/* CTL_VM names: */
161enum
162{
163 VM_UNUSED1=1, /* was: struct: Set vm swapping control */
164 VM_UNUSED2=2, /* was; int: Linear or sqrt() swapout for hogs */
165 VM_UNUSED3=3, /* was: struct: Set free page thresholds */
166 VM_UNUSED4=4, /* Spare */
167 VM_OVERCOMMIT_MEMORY=5, /* Turn off the virtual memory safety limit */
168 VM_UNUSED5=6, /* was: struct: Set buffer memory thresholds */
169 VM_UNUSED7=7, /* was: struct: Set cache memory thresholds */
170 VM_UNUSED8=8, /* was: struct: Control kswapd behaviour */
171 VM_UNUSED9=9, /* was: struct: Set page table cache parameters */
172 VM_PAGE_CLUSTER=10, /* int: set number of pages to swap together */
173 VM_DIRTY_BACKGROUND=11, /* dirty_background_ratio */
174 VM_DIRTY_RATIO=12, /* dirty_ratio */
175 VM_DIRTY_WB_CS=13, /* dirty_writeback_centisecs */
176 VM_DIRTY_EXPIRE_CS=14, /* dirty_expire_centisecs */
177 VM_NR_PDFLUSH_THREADS=15, /* nr_pdflush_threads */
178 VM_OVERCOMMIT_RATIO=16, /* percent of RAM to allow overcommit in */
179 VM_PAGEBUF=17, /* struct: Control pagebuf parameters */
180 VM_HUGETLB_PAGES=18, /* int: Number of available Huge Pages */
181 VM_SWAPPINESS=19, /* Tendency to steal mapped memory */
182 VM_LOWMEM_RESERVE_RATIO=20,/* reservation ratio for lower memory zones */
183 VM_MIN_FREE_KBYTES=21, /* Minimum free kilobytes to maintain */
184 VM_MAX_MAP_COUNT=22, /* int: Maximum number of mmaps/address-space */
185 VM_LAPTOP_MODE=23, /* vm laptop mode */
186 VM_BLOCK_DUMP=24, /* block dump mode */
187 VM_HUGETLB_GROUP=25, /* permitted hugetlb group */
188 VM_VFS_CACHE_PRESSURE=26, /* dcache/icache reclaim pressure */
189 VM_LEGACY_VA_LAYOUT=27, /* legacy/compatibility virtual address space layout */
190 VM_SWAP_TOKEN_TIMEOUT=28, /* default time for token time out */
191 VM_DROP_PAGECACHE=29, /* int: nuke lots of pagecache */
192 VM_PERCPU_PAGELIST_FRACTION=30,/* int: fraction of pages in each percpu_pagelist */
193 VM_ZONE_RECLAIM_MODE=31, /* reclaim local zone memory before going off node */
194 VM_MIN_UNMAPPED=32, /* Set min percent of unmapped pages */
195 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */
196 VM_VDSO_ENABLED=34, /* map VDSO into new processes? */
197 VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */
198};
199
200
201/* CTL_NET names: */
202enum
203{
204 NET_CORE=1,
205 NET_ETHER=2,
206 NET_802=3,
207 NET_UNIX=4,
208 NET_IPV4=5,
209 NET_IPX=6,
210 NET_ATALK=7,
211 NET_NETROM=8,
212 NET_AX25=9,
213 NET_BRIDGE=10,
214 NET_ROSE=11,
215 NET_IPV6=12,
216 NET_X25=13,
217 NET_TR=14,
218 NET_DECNET=15,
219 NET_ECONET=16,
220 NET_SCTP=17,
221 NET_LLC=18,
222 NET_NETFILTER=19,
223 NET_DCCP=20,
224 NET_IRDA=412,
225};
226
227/* /proc/sys/kernel/random */
228enum
229{
230 RANDOM_POOLSIZE=1,
231 RANDOM_ENTROPY_COUNT=2,
232 RANDOM_READ_THRESH=3,
233 RANDOM_WRITE_THRESH=4,
234 RANDOM_BOOT_ID=5,
235 RANDOM_UUID=6
236};
237
238/* /proc/sys/kernel/pty */
239enum
240{
241 PTY_MAX=1,
242 PTY_NR=2
243};
244
245/* /proc/sys/bus/isa */
246enum
247{
248 BUS_ISA_MEM_BASE=1,
249 BUS_ISA_PORT_BASE=2,
250 BUS_ISA_PORT_SHIFT=3
251};
252
253/* /proc/sys/net/core */
254enum
255{
256 NET_CORE_WMEM_MAX=1,
257 NET_CORE_RMEM_MAX=2,
258 NET_CORE_WMEM_DEFAULT=3,
259 NET_CORE_RMEM_DEFAULT=4,
260/* was NET_CORE_DESTROY_DELAY */
261 NET_CORE_MAX_BACKLOG=6,
262 NET_CORE_FASTROUTE=7,
263 NET_CORE_MSG_COST=8,
264 NET_CORE_MSG_BURST=9,
265 NET_CORE_OPTMEM_MAX=10,
266 NET_CORE_HOT_LIST_LENGTH=11,
267 NET_CORE_DIVERT_VERSION=12,
268 NET_CORE_NO_CONG_THRESH=13,
269 NET_CORE_NO_CONG=14,
270 NET_CORE_LO_CONG=15,
271 NET_CORE_MOD_CONG=16,
272 NET_CORE_DEV_WEIGHT=17,
273 NET_CORE_SOMAXCONN=18,
274 NET_CORE_BUDGET=19,
275 NET_CORE_AEVENT_ETIME=20,
276 NET_CORE_AEVENT_RSEQTH=21,
277 NET_CORE_WARNINGS=22,
278};
279
280/* /proc/sys/net/ethernet */
281
282/* /proc/sys/net/802 */
283
284/* /proc/sys/net/unix */
285
286enum
287{
288 NET_UNIX_DESTROY_DELAY=1,
289 NET_UNIX_DELETE_DELAY=2,
290 NET_UNIX_MAX_DGRAM_QLEN=3,
291};
292
293/* /proc/sys/net/netfilter */
294enum
295{
296 NET_NF_CONNTRACK_MAX=1,
297 NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT=2,
298 NET_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV=3,
299 NET_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED=4,
300 NET_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT=5,
301 NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT=6,
302 NET_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK=7,
303 NET_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT=8,
304 NET_NF_CONNTRACK_TCP_TIMEOUT_CLOSE=9,
305 NET_NF_CONNTRACK_UDP_TIMEOUT=10,
306 NET_NF_CONNTRACK_UDP_TIMEOUT_STREAM=11,
307 NET_NF_CONNTRACK_ICMP_TIMEOUT=12,
308 NET_NF_CONNTRACK_GENERIC_TIMEOUT=13,
309 NET_NF_CONNTRACK_BUCKETS=14,
310 NET_NF_CONNTRACK_LOG_INVALID=15,
311 NET_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS=16,
312 NET_NF_CONNTRACK_TCP_LOOSE=17,
313 NET_NF_CONNTRACK_TCP_BE_LIBERAL=18,
314 NET_NF_CONNTRACK_TCP_MAX_RETRANS=19,
315 NET_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED=20,
316 NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT=21,
317 NET_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED=22,
318 NET_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED=23,
319 NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24,
320 NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25,
321 NET_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26,
322 NET_NF_CONNTRACK_COUNT=27,
323 NET_NF_CONNTRACK_ICMPV6_TIMEOUT=28,
324 NET_NF_CONNTRACK_FRAG6_TIMEOUT=29,
325 NET_NF_CONNTRACK_FRAG6_LOW_THRESH=30,
326 NET_NF_CONNTRACK_FRAG6_HIGH_THRESH=31,
327 NET_NF_CONNTRACK_CHECKSUM=32,
328};
329
330/* /proc/sys/net/ipv4 */
331enum
332{
333 /* v2.0 compatibile variables */
334 NET_IPV4_FORWARD=8,
335 NET_IPV4_DYNADDR=9,
336
337 NET_IPV4_CONF=16,
338 NET_IPV4_NEIGH=17,
339 NET_IPV4_ROUTE=18,
340 NET_IPV4_FIB_HASH=19,
341 NET_IPV4_NETFILTER=20,
342
343 NET_IPV4_TCP_TIMESTAMPS=33,
344 NET_IPV4_TCP_WINDOW_SCALING=34,
345 NET_IPV4_TCP_SACK=35,
346 NET_IPV4_TCP_RETRANS_COLLAPSE=36,
347 NET_IPV4_DEFAULT_TTL=37,
348 NET_IPV4_AUTOCONFIG=38,
349 NET_IPV4_NO_PMTU_DISC=39,
350 NET_IPV4_TCP_SYN_RETRIES=40,
351 NET_IPV4_IPFRAG_HIGH_THRESH=41,
352 NET_IPV4_IPFRAG_LOW_THRESH=42,
353 NET_IPV4_IPFRAG_TIME=43,
354 NET_IPV4_TCP_MAX_KA_PROBES=44,
355 NET_IPV4_TCP_KEEPALIVE_TIME=45,
356 NET_IPV4_TCP_KEEPALIVE_PROBES=46,
357 NET_IPV4_TCP_RETRIES1=47,
358 NET_IPV4_TCP_RETRIES2=48,
359 NET_IPV4_TCP_FIN_TIMEOUT=49,
360 NET_IPV4_IP_MASQ_DEBUG=50,
361 NET_TCP_SYNCOOKIES=51,
362 NET_TCP_STDURG=52,
363 NET_TCP_RFC1337=53,
364 NET_TCP_SYN_TAILDROP=54,
365 NET_TCP_MAX_SYN_BACKLOG=55,
366 NET_IPV4_LOCAL_PORT_RANGE=56,
367 NET_IPV4_ICMP_ECHO_IGNORE_ALL=57,
368 NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS=58,
369 NET_IPV4_ICMP_SOURCEQUENCH_RATE=59,
370 NET_IPV4_ICMP_DESTUNREACH_RATE=60,
371 NET_IPV4_ICMP_TIMEEXCEED_RATE=61,
372 NET_IPV4_ICMP_PARAMPROB_RATE=62,
373 NET_IPV4_ICMP_ECHOREPLY_RATE=63,
374 NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES=64,
375 NET_IPV4_IGMP_MAX_MEMBERSHIPS=65,
376 NET_TCP_TW_RECYCLE=66,
377 NET_IPV4_ALWAYS_DEFRAG=67,
378 NET_IPV4_TCP_KEEPALIVE_INTVL=68,
379 NET_IPV4_INET_PEER_THRESHOLD=69,
380 NET_IPV4_INET_PEER_MINTTL=70,
381 NET_IPV4_INET_PEER_MAXTTL=71,
382 NET_IPV4_INET_PEER_GC_MINTIME=72,
383 NET_IPV4_INET_PEER_GC_MAXTIME=73,
384 NET_TCP_ORPHAN_RETRIES=74,
385 NET_TCP_ABORT_ON_OVERFLOW=75,
386 NET_TCP_SYNACK_RETRIES=76,
387 NET_TCP_MAX_ORPHANS=77,
388 NET_TCP_MAX_TW_BUCKETS=78,
389 NET_TCP_FACK=79,
390 NET_TCP_REORDERING=80,
391 NET_TCP_ECN=81,
392 NET_TCP_DSACK=82,
393 NET_TCP_MEM=83,
394 NET_TCP_WMEM=84,
395 NET_TCP_RMEM=85,
396 NET_TCP_APP_WIN=86,
397 NET_TCP_ADV_WIN_SCALE=87,
398 NET_IPV4_NONLOCAL_BIND=88,
399 NET_IPV4_ICMP_RATELIMIT=89,
400 NET_IPV4_ICMP_RATEMASK=90,
401 NET_TCP_TW_REUSE=91,
402 NET_TCP_FRTO=92,
403 NET_TCP_LOW_LATENCY=93,
404 NET_IPV4_IPFRAG_SECRET_INTERVAL=94,
405 NET_IPV4_IGMP_MAX_MSF=96,
406 NET_TCP_NO_METRICS_SAVE=97,
407 NET_TCP_DEFAULT_WIN_SCALE=105,
408 NET_TCP_MODERATE_RCVBUF=106,
409 NET_TCP_TSO_WIN_DIVISOR=107,
410 NET_TCP_BIC_BETA=108,
411 NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109,
412 NET_TCP_CONG_CONTROL=110,
413 NET_TCP_ABC=111,
414 NET_IPV4_IPFRAG_MAX_DIST=112,
415 NET_TCP_MTU_PROBING=113,
416 NET_TCP_BASE_MSS=114,
417 NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS=115,
418 NET_TCP_DMA_COPYBREAK=116,
419 NET_TCP_SLOW_START_AFTER_IDLE=117,
420 NET_CIPSOV4_CACHE_ENABLE=118,
421 NET_CIPSOV4_CACHE_BUCKET_SIZE=119,
422 NET_CIPSOV4_RBM_OPTFMT=120,
423 NET_CIPSOV4_RBM_STRICTVALID=121,
424 NET_TCP_AVAIL_CONG_CONTROL=122,
425 NET_TCP_ALLOWED_CONG_CONTROL=123,
426 NET_TCP_MAX_SSTHRESH=124,
427 NET_TCP_FRTO_RESPONSE=125,
428};
429
430enum {
431 NET_IPV4_ROUTE_FLUSH=1,
432 NET_IPV4_ROUTE_MIN_DELAY=2, /* obsolete since 2.6.25 */
433 NET_IPV4_ROUTE_MAX_DELAY=3, /* obsolete since 2.6.25 */
434 NET_IPV4_ROUTE_GC_THRESH=4,
435 NET_IPV4_ROUTE_MAX_SIZE=5,
436 NET_IPV4_ROUTE_GC_MIN_INTERVAL=6,
437 NET_IPV4_ROUTE_GC_TIMEOUT=7,
438 NET_IPV4_ROUTE_GC_INTERVAL=8, /* obsolete since 2.6.38 */
439 NET_IPV4_ROUTE_REDIRECT_LOAD=9,
440 NET_IPV4_ROUTE_REDIRECT_NUMBER=10,
441 NET_IPV4_ROUTE_REDIRECT_SILENCE=11,
442 NET_IPV4_ROUTE_ERROR_COST=12,
443 NET_IPV4_ROUTE_ERROR_BURST=13,
444 NET_IPV4_ROUTE_GC_ELASTICITY=14,
445 NET_IPV4_ROUTE_MTU_EXPIRES=15,
446 NET_IPV4_ROUTE_MIN_PMTU=16,
447 NET_IPV4_ROUTE_MIN_ADVMSS=17,
448 NET_IPV4_ROUTE_SECRET_INTERVAL=18,
449 NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS=19,
450};
451
452enum
453{
454 NET_PROTO_CONF_ALL=-2,
455 NET_PROTO_CONF_DEFAULT=-3
456
457 /* And device ifindices ... */
458};
459
460enum
461{
462 NET_IPV4_CONF_FORWARDING=1,
463 NET_IPV4_CONF_MC_FORWARDING=2,
464 NET_IPV4_CONF_PROXY_ARP=3,
465 NET_IPV4_CONF_ACCEPT_REDIRECTS=4,
466 NET_IPV4_CONF_SECURE_REDIRECTS=5,
467 NET_IPV4_CONF_SEND_REDIRECTS=6,
468 NET_IPV4_CONF_SHARED_MEDIA=7,
469 NET_IPV4_CONF_RP_FILTER=8,
470 NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE=9,
471 NET_IPV4_CONF_BOOTP_RELAY=10,
472 NET_IPV4_CONF_LOG_MARTIANS=11,
473 NET_IPV4_CONF_TAG=12,
474 NET_IPV4_CONF_ARPFILTER=13,
475 NET_IPV4_CONF_MEDIUM_ID=14,
476 NET_IPV4_CONF_NOXFRM=15,
477 NET_IPV4_CONF_NOPOLICY=16,
478 NET_IPV4_CONF_FORCE_IGMP_VERSION=17,
479 NET_IPV4_CONF_ARP_ANNOUNCE=18,
480 NET_IPV4_CONF_ARP_IGNORE=19,
481 NET_IPV4_CONF_PROMOTE_SECONDARIES=20,
482 NET_IPV4_CONF_ARP_ACCEPT=21,
483 NET_IPV4_CONF_ARP_NOTIFY=22,
484};
485
486/* /proc/sys/net/ipv4/netfilter */
487enum
488{
489 NET_IPV4_NF_CONNTRACK_MAX=1,
490 NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_SENT=2,
491 NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_SYN_RECV=3,
492 NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_ESTABLISHED=4,
493 NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_FIN_WAIT=5,
494 NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE_WAIT=6,
495 NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_LAST_ACK=7,
496 NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_TIME_WAIT=8,
497 NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_CLOSE=9,
498 NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT=10,
499 NET_IPV4_NF_CONNTRACK_UDP_TIMEOUT_STREAM=11,
500 NET_IPV4_NF_CONNTRACK_ICMP_TIMEOUT=12,
501 NET_IPV4_NF_CONNTRACK_GENERIC_TIMEOUT=13,
502 NET_IPV4_NF_CONNTRACK_BUCKETS=14,
503 NET_IPV4_NF_CONNTRACK_LOG_INVALID=15,
504 NET_IPV4_NF_CONNTRACK_TCP_TIMEOUT_MAX_RETRANS=16,
505 NET_IPV4_NF_CONNTRACK_TCP_LOOSE=17,
506 NET_IPV4_NF_CONNTRACK_TCP_BE_LIBERAL=18,
507 NET_IPV4_NF_CONNTRACK_TCP_MAX_RETRANS=19,
508 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_CLOSED=20,
509 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_WAIT=21,
510 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_COOKIE_ECHOED=22,
511 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_ESTABLISHED=23,
512 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_SENT=24,
513 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_RECD=25,
514 NET_IPV4_NF_CONNTRACK_SCTP_TIMEOUT_SHUTDOWN_ACK_SENT=26,
515 NET_IPV4_NF_CONNTRACK_COUNT=27,
516 NET_IPV4_NF_CONNTRACK_CHECKSUM=28,
517};
518
519/* /proc/sys/net/ipv6 */
520enum {
521 NET_IPV6_CONF=16,
522 NET_IPV6_NEIGH=17,
523 NET_IPV6_ROUTE=18,
524 NET_IPV6_ICMP=19,
525 NET_IPV6_BINDV6ONLY=20,
526 NET_IPV6_IP6FRAG_HIGH_THRESH=21,
527 NET_IPV6_IP6FRAG_LOW_THRESH=22,
528 NET_IPV6_IP6FRAG_TIME=23,
529 NET_IPV6_IP6FRAG_SECRET_INTERVAL=24,
530 NET_IPV6_MLD_MAX_MSF=25,
531};
532
533enum {
534 NET_IPV6_ROUTE_FLUSH=1,
535 NET_IPV6_ROUTE_GC_THRESH=2,
536 NET_IPV6_ROUTE_MAX_SIZE=3,
537 NET_IPV6_ROUTE_GC_MIN_INTERVAL=4,
538 NET_IPV6_ROUTE_GC_TIMEOUT=5,
539 NET_IPV6_ROUTE_GC_INTERVAL=6,
540 NET_IPV6_ROUTE_GC_ELASTICITY=7,
541 NET_IPV6_ROUTE_MTU_EXPIRES=8,
542 NET_IPV6_ROUTE_MIN_ADVMSS=9,
543 NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS=10
544};
545
546enum {
547 NET_IPV6_FORWARDING=1,
548 NET_IPV6_HOP_LIMIT=2,
549 NET_IPV6_MTU=3,
550 NET_IPV6_ACCEPT_RA=4,
551 NET_IPV6_ACCEPT_REDIRECTS=5,
552 NET_IPV6_AUTOCONF=6,
553 NET_IPV6_DAD_TRANSMITS=7,
554 NET_IPV6_RTR_SOLICITS=8,
555 NET_IPV6_RTR_SOLICIT_INTERVAL=9,
556 NET_IPV6_RTR_SOLICIT_DELAY=10,
557 NET_IPV6_USE_TEMPADDR=11,
558 NET_IPV6_TEMP_VALID_LFT=12,
559 NET_IPV6_TEMP_PREFERED_LFT=13,
560 NET_IPV6_REGEN_MAX_RETRY=14,
561 NET_IPV6_MAX_DESYNC_FACTOR=15,
562 NET_IPV6_MAX_ADDRESSES=16,
563 NET_IPV6_FORCE_MLD_VERSION=17,
564 NET_IPV6_ACCEPT_RA_DEFRTR=18,
565 NET_IPV6_ACCEPT_RA_PINFO=19,
566 NET_IPV6_ACCEPT_RA_RTR_PREF=20,
567 NET_IPV6_RTR_PROBE_INTERVAL=21,
568 NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN=22,
569 NET_IPV6_PROXY_NDP=23,
570 NET_IPV6_ACCEPT_SOURCE_ROUTE=25,
571 __NET_IPV6_MAX
572};
573
574/* /proc/sys/net/ipv6/icmp */
575enum {
576 NET_IPV6_ICMP_RATELIMIT=1
577};
578
579/* /proc/sys/net/<protocol>/neigh/<dev> */
580enum {
581 NET_NEIGH_MCAST_SOLICIT=1,
582 NET_NEIGH_UCAST_SOLICIT=2,
583 NET_NEIGH_APP_SOLICIT=3,
584 NET_NEIGH_RETRANS_TIME=4,
585 NET_NEIGH_REACHABLE_TIME=5,
586 NET_NEIGH_DELAY_PROBE_TIME=6,
587 NET_NEIGH_GC_STALE_TIME=7,
588 NET_NEIGH_UNRES_QLEN=8,
589 NET_NEIGH_PROXY_QLEN=9,
590 NET_NEIGH_ANYCAST_DELAY=10,
591 NET_NEIGH_PROXY_DELAY=11,
592 NET_NEIGH_LOCKTIME=12,
593 NET_NEIGH_GC_INTERVAL=13,
594 NET_NEIGH_GC_THRESH1=14,
595 NET_NEIGH_GC_THRESH2=15,
596 NET_NEIGH_GC_THRESH3=16,
597 NET_NEIGH_RETRANS_TIME_MS=17,
598 NET_NEIGH_REACHABLE_TIME_MS=18,
599};
600
601/* /proc/sys/net/dccp */
602enum {
603 NET_DCCP_DEFAULT=1,
604};
605
606/* /proc/sys/net/ipx */
607enum {
608 NET_IPX_PPROP_BROADCASTING=1,
609 NET_IPX_FORWARDING=2
610};
611
612/* /proc/sys/net/llc */
613enum {
614 NET_LLC2=1,
615 NET_LLC_STATION=2,
616};
617
618/* /proc/sys/net/llc/llc2 */
619enum {
620 NET_LLC2_TIMEOUT=1,
621};
622
623/* /proc/sys/net/llc/station */
624enum {
625 NET_LLC_STATION_ACK_TIMEOUT=1,
626};
627
628/* /proc/sys/net/llc/llc2/timeout */
629enum {
630 NET_LLC2_ACK_TIMEOUT=1,
631 NET_LLC2_P_TIMEOUT=2,
632 NET_LLC2_REJ_TIMEOUT=3,
633 NET_LLC2_BUSY_TIMEOUT=4,
634};
635
636/* /proc/sys/net/appletalk */
637enum {
638 NET_ATALK_AARP_EXPIRY_TIME=1,
639 NET_ATALK_AARP_TICK_TIME=2,
640 NET_ATALK_AARP_RETRANSMIT_LIMIT=3,
641 NET_ATALK_AARP_RESOLVE_TIME=4
642};
643
644
645/* /proc/sys/net/netrom */
646enum {
647 NET_NETROM_DEFAULT_PATH_QUALITY=1,
648 NET_NETROM_OBSOLESCENCE_COUNT_INITIALISER=2,
649 NET_NETROM_NETWORK_TTL_INITIALISER=3,
650 NET_NETROM_TRANSPORT_TIMEOUT=4,
651 NET_NETROM_TRANSPORT_MAXIMUM_TRIES=5,
652 NET_NETROM_TRANSPORT_ACKNOWLEDGE_DELAY=6,
653 NET_NETROM_TRANSPORT_BUSY_DELAY=7,
654 NET_NETROM_TRANSPORT_REQUESTED_WINDOW_SIZE=8,
655 NET_NETROM_TRANSPORT_NO_ACTIVITY_TIMEOUT=9,
656 NET_NETROM_ROUTING_CONTROL=10,
657 NET_NETROM_LINK_FAILS_COUNT=11,
658 NET_NETROM_RESET=12
659};
660
661/* /proc/sys/net/ax25 */
662enum {
663 NET_AX25_IP_DEFAULT_MODE=1,
664 NET_AX25_DEFAULT_MODE=2,
665 NET_AX25_BACKOFF_TYPE=3,
666 NET_AX25_CONNECT_MODE=4,
667 NET_AX25_STANDARD_WINDOW=5,
668 NET_AX25_EXTENDED_WINDOW=6,
669 NET_AX25_T1_TIMEOUT=7,
670 NET_AX25_T2_TIMEOUT=8,
671 NET_AX25_T3_TIMEOUT=9,
672 NET_AX25_IDLE_TIMEOUT=10,
673 NET_AX25_N2=11,
674 NET_AX25_PACLEN=12,
675 NET_AX25_PROTOCOL=13,
676 NET_AX25_DAMA_SLAVE_TIMEOUT=14
677};
678
679/* /proc/sys/net/rose */
680enum {
681 NET_ROSE_RESTART_REQUEST_TIMEOUT=1,
682 NET_ROSE_CALL_REQUEST_TIMEOUT=2,
683 NET_ROSE_RESET_REQUEST_TIMEOUT=3,
684 NET_ROSE_CLEAR_REQUEST_TIMEOUT=4,
685 NET_ROSE_ACK_HOLD_BACK_TIMEOUT=5,
686 NET_ROSE_ROUTING_CONTROL=6,
687 NET_ROSE_LINK_FAIL_TIMEOUT=7,
688 NET_ROSE_MAX_VCS=8,
689 NET_ROSE_WINDOW_SIZE=9,
690 NET_ROSE_NO_ACTIVITY_TIMEOUT=10
691};
692
693/* /proc/sys/net/x25 */
694enum {
695 NET_X25_RESTART_REQUEST_TIMEOUT=1,
696 NET_X25_CALL_REQUEST_TIMEOUT=2,
697 NET_X25_RESET_REQUEST_TIMEOUT=3,
698 NET_X25_CLEAR_REQUEST_TIMEOUT=4,
699 NET_X25_ACK_HOLD_BACK_TIMEOUT=5,
700 NET_X25_FORWARD=6
701};
702
703/* /proc/sys/net/token-ring */
704enum
705{
706 NET_TR_RIF_TIMEOUT=1
707};
708
709/* /proc/sys/net/decnet/ */
710enum {
711 NET_DECNET_NODE_TYPE = 1,
712 NET_DECNET_NODE_ADDRESS = 2,
713 NET_DECNET_NODE_NAME = 3,
714 NET_DECNET_DEFAULT_DEVICE = 4,
715 NET_DECNET_TIME_WAIT = 5,
716 NET_DECNET_DN_COUNT = 6,
717 NET_DECNET_DI_COUNT = 7,
718 NET_DECNET_DR_COUNT = 8,
719 NET_DECNET_DST_GC_INTERVAL = 9,
720 NET_DECNET_CONF = 10,
721 NET_DECNET_NO_FC_MAX_CWND = 11,
722 NET_DECNET_MEM = 12,
723 NET_DECNET_RMEM = 13,
724 NET_DECNET_WMEM = 14,
725 NET_DECNET_DEBUG_LEVEL = 255
726};
727
728/* /proc/sys/net/decnet/conf/<dev> */
729enum {
730 NET_DECNET_CONF_LOOPBACK = -2,
731 NET_DECNET_CONF_DDCMP = -3,
732 NET_DECNET_CONF_PPP = -4,
733 NET_DECNET_CONF_X25 = -5,
734 NET_DECNET_CONF_GRE = -6,
735 NET_DECNET_CONF_ETHER = -7
736
737 /* ... and ifindex of devices */
738};
739
740/* /proc/sys/net/decnet/conf/<dev>/ */
741enum {
742 NET_DECNET_CONF_DEV_PRIORITY = 1,
743 NET_DECNET_CONF_DEV_T1 = 2,
744 NET_DECNET_CONF_DEV_T2 = 3,
745 NET_DECNET_CONF_DEV_T3 = 4,
746 NET_DECNET_CONF_DEV_FORWARDING = 5,
747 NET_DECNET_CONF_DEV_BLKSIZE = 6,
748 NET_DECNET_CONF_DEV_STATE = 7
749};
750
751/* /proc/sys/net/sctp */
752enum {
753 NET_SCTP_RTO_INITIAL = 1,
754 NET_SCTP_RTO_MIN = 2,
755 NET_SCTP_RTO_MAX = 3,
756 NET_SCTP_RTO_ALPHA = 4,
757 NET_SCTP_RTO_BETA = 5,
758 NET_SCTP_VALID_COOKIE_LIFE = 6,
759 NET_SCTP_ASSOCIATION_MAX_RETRANS = 7,
760 NET_SCTP_PATH_MAX_RETRANS = 8,
761 NET_SCTP_MAX_INIT_RETRANSMITS = 9,
762 NET_SCTP_HB_INTERVAL = 10,
763 NET_SCTP_PRESERVE_ENABLE = 11,
764 NET_SCTP_MAX_BURST = 12,
765 NET_SCTP_ADDIP_ENABLE = 13,
766 NET_SCTP_PRSCTP_ENABLE = 14,
767 NET_SCTP_SNDBUF_POLICY = 15,
768 NET_SCTP_SACK_TIMEOUT = 16,
769 NET_SCTP_RCVBUF_POLICY = 17,
770};
771
772/* /proc/sys/net/bridge */
773enum {
774 NET_BRIDGE_NF_CALL_ARPTABLES = 1,
775 NET_BRIDGE_NF_CALL_IPTABLES = 2,
776 NET_BRIDGE_NF_CALL_IP6TABLES = 3,
777 NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4,
778 NET_BRIDGE_NF_FILTER_PPPOE_TAGGED = 5,
779};
780
781/* proc/sys/net/irda */
782enum {
783 NET_IRDA_DISCOVERY=1,
784 NET_IRDA_DEVNAME=2,
785 NET_IRDA_DEBUG=3,
786 NET_IRDA_FAST_POLL=4,
787 NET_IRDA_DISCOVERY_SLOTS=5,
788 NET_IRDA_DISCOVERY_TIMEOUT=6,
789 NET_IRDA_SLOT_TIMEOUT=7,
790 NET_IRDA_MAX_BAUD_RATE=8,
791 NET_IRDA_MIN_TX_TURN_TIME=9,
792 NET_IRDA_MAX_TX_DATA_SIZE=10,
793 NET_IRDA_MAX_TX_WINDOW=11,
794 NET_IRDA_MAX_NOREPLY_TIME=12,
795 NET_IRDA_WARN_NOREPLY_TIME=13,
796 NET_IRDA_LAP_KEEPALIVE_TIME=14,
797};
798
799
800/* CTL_FS names: */
801enum
802{
803 FS_NRINODE=1, /* int:current number of allocated inodes */
804 FS_STATINODE=2,
805 FS_MAXINODE=3, /* int:maximum number of inodes that can be allocated */
806 FS_NRDQUOT=4, /* int:current number of allocated dquots */
807 FS_MAXDQUOT=5, /* int:maximum number of dquots that can be allocated */
808 FS_NRFILE=6, /* int:current number of allocated filedescriptors */
809 FS_MAXFILE=7, /* int:maximum number of filedescriptors that can be allocated */
810 FS_DENTRY=8,
811 FS_NRSUPER=9, /* int:current number of allocated super_blocks */
812 FS_MAXSUPER=10, /* int:maximum number of super_blocks that can be allocated */
813 FS_OVERFLOWUID=11, /* int: overflow UID */
814 FS_OVERFLOWGID=12, /* int: overflow GID */
815 FS_LEASES=13, /* int: leases enabled */
816 FS_DIR_NOTIFY=14, /* int: directory notification enabled */
817 FS_LEASE_TIME=15, /* int: maximum time to wait for a lease break */
818 FS_DQSTATS=16, /* disc quota usage statistics and control */
819 FS_XFS=17, /* struct: control xfs parameters */
820 FS_AIO_NR=18, /* current system-wide number of aio requests */
821 FS_AIO_MAX_NR=19, /* system-wide maximum number of aio requests */
822 FS_INOTIFY=20, /* inotify submenu */
823 FS_OCFS2=988, /* ocfs2 */
824};
825
826/* /proc/sys/fs/quota/ */
827enum {
828 FS_DQ_LOOKUPS = 1,
829 FS_DQ_DROPS = 2,
830 FS_DQ_READS = 3,
831 FS_DQ_WRITES = 4,
832 FS_DQ_CACHE_HITS = 5,
833 FS_DQ_ALLOCATED = 6,
834 FS_DQ_FREE = 7,
835 FS_DQ_SYNCS = 8,
836 FS_DQ_WARNINGS = 9,
837};
838
839/* CTL_DEBUG names: */
840
841/* CTL_DEV names: */
842enum {
843 DEV_CDROM=1,
844 DEV_HWMON=2,
845 DEV_PARPORT=3,
846 DEV_RAID=4,
847 DEV_MAC_HID=5,
848 DEV_SCSI=6,
849 DEV_IPMI=7,
850};
851
852/* /proc/sys/dev/cdrom */
853enum {
854 DEV_CDROM_INFO=1,
855 DEV_CDROM_AUTOCLOSE=2,
856 DEV_CDROM_AUTOEJECT=3,
857 DEV_CDROM_DEBUG=4,
858 DEV_CDROM_LOCK=5,
859 DEV_CDROM_CHECK_MEDIA=6
860};
861
862/* /proc/sys/dev/parport */
863enum {
864 DEV_PARPORT_DEFAULT=-3
865};
866
867/* /proc/sys/dev/raid */
868enum {
869 DEV_RAID_SPEED_LIMIT_MIN=1,
870 DEV_RAID_SPEED_LIMIT_MAX=2
871};
872
873/* /proc/sys/dev/parport/default */
874enum {
875 DEV_PARPORT_DEFAULT_TIMESLICE=1,
876 DEV_PARPORT_DEFAULT_SPINTIME=2
877};
878
879/* /proc/sys/dev/parport/parport n */
880enum {
881 DEV_PARPORT_SPINTIME=1,
882 DEV_PARPORT_BASE_ADDR=2,
883 DEV_PARPORT_IRQ=3,
884 DEV_PARPORT_DMA=4,
885 DEV_PARPORT_MODES=5,
886 DEV_PARPORT_DEVICES=6,
887 DEV_PARPORT_AUTOPROBE=16
888};
889
890/* /proc/sys/dev/parport/parport n/devices/ */
891enum {
892 DEV_PARPORT_DEVICES_ACTIVE=-3,
893};
894
895/* /proc/sys/dev/parport/parport n/devices/device n */
896enum {
897 DEV_PARPORT_DEVICE_TIMESLICE=1,
898};
899
900/* /proc/sys/dev/mac_hid */
901enum {
902 DEV_MAC_HID_KEYBOARD_SENDS_LINUX_KEYCODES=1,
903 DEV_MAC_HID_KEYBOARD_LOCK_KEYCODES=2,
904 DEV_MAC_HID_MOUSE_BUTTON_EMULATION=3,
905 DEV_MAC_HID_MOUSE_BUTTON2_KEYCODE=4,
906 DEV_MAC_HID_MOUSE_BUTTON3_KEYCODE=5,
907 DEV_MAC_HID_ADB_MOUSE_SENDS_KEYCODES=6
908};
909
910/* /proc/sys/dev/scsi */
911enum {
912 DEV_SCSI_LOGGING_LEVEL=1,
913};
914
915/* /proc/sys/dev/ipmi */
916enum {
917 DEV_IPMI_POWEROFF_POWERCYCLE=1,
918};
919
920/* /proc/sys/abi */
921enum
922{
923 ABI_DEFHANDLER_COFF=1, /* default handler for coff binaries */
924 ABI_DEFHANDLER_ELF=2, /* default handler for ELF binaries */
925 ABI_DEFHANDLER_LCALL7=3,/* default handler for procs using lcall7 */
926 ABI_DEFHANDLER_LIBCSO=4,/* default handler for an libc.so ELF interp */
927 ABI_TRACE=5, /* tracing flags */
928 ABI_FAKE_UTSNAME=6, /* fake target utsname information */
929};
930
931
932#endif /* _UAPI_LINUX_SYSCTL_H */
diff --git a/include/linux/sysinfo.h b/include/uapi/linux/sysinfo.h
index 934335a22522..934335a22522 100644
--- a/include/linux/sysinfo.h
+++ b/include/uapi/linux/sysinfo.h
diff --git a/include/linux/taskstats.h b/include/uapi/linux/taskstats.h
index 2466e550a41d..2466e550a41d 100644
--- a/include/linux/taskstats.h
+++ b/include/uapi/linux/taskstats.h
diff --git a/include/uapi/linux/tc_act/Kbuild b/include/uapi/linux/tc_act/Kbuild
index aafaa5aa54d4..0623ec4e728f 100644
--- a/include/uapi/linux/tc_act/Kbuild
+++ b/include/uapi/linux/tc_act/Kbuild
@@ -1 +1,8 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += tc_csum.h
3header-y += tc_gact.h
4header-y += tc_ipt.h
5header-y += tc_mirred.h
6header-y += tc_nat.h
7header-y += tc_pedit.h
8header-y += tc_skbedit.h
diff --git a/include/linux/tc_act/tc_csum.h b/include/uapi/linux/tc_act/tc_csum.h
index a047c49a3153..a047c49a3153 100644
--- a/include/linux/tc_act/tc_csum.h
+++ b/include/uapi/linux/tc_act/tc_csum.h
diff --git a/include/linux/tc_act/tc_gact.h b/include/uapi/linux/tc_act/tc_gact.h
index f7bf94eed510..f7bf94eed510 100644
--- a/include/linux/tc_act/tc_gact.h
+++ b/include/uapi/linux/tc_act/tc_gact.h
diff --git a/include/linux/tc_act/tc_ipt.h b/include/uapi/linux/tc_act/tc_ipt.h
index a2335563d21f..a2335563d21f 100644
--- a/include/linux/tc_act/tc_ipt.h
+++ b/include/uapi/linux/tc_act/tc_ipt.h
diff --git a/include/linux/tc_act/tc_mirred.h b/include/uapi/linux/tc_act/tc_mirred.h
index 7561750e8fd6..7561750e8fd6 100644
--- a/include/linux/tc_act/tc_mirred.h
+++ b/include/uapi/linux/tc_act/tc_mirred.h
diff --git a/include/linux/tc_act/tc_nat.h b/include/uapi/linux/tc_act/tc_nat.h
index 6663aeba0b9a..6663aeba0b9a 100644
--- a/include/linux/tc_act/tc_nat.h
+++ b/include/uapi/linux/tc_act/tc_nat.h
diff --git a/include/linux/tc_act/tc_pedit.h b/include/uapi/linux/tc_act/tc_pedit.h
index 716cfabcd5b2..716cfabcd5b2 100644
--- a/include/linux/tc_act/tc_pedit.h
+++ b/include/uapi/linux/tc_act/tc_pedit.h
diff --git a/include/linux/tc_act/tc_skbedit.h b/include/uapi/linux/tc_act/tc_skbedit.h
index 7a2e910a5f08..7a2e910a5f08 100644
--- a/include/linux/tc_act/tc_skbedit.h
+++ b/include/uapi/linux/tc_act/tc_skbedit.h
diff --git a/include/uapi/linux/tc_ematch/Kbuild b/include/uapi/linux/tc_ematch/Kbuild
index aafaa5aa54d4..53fca3925535 100644
--- a/include/uapi/linux/tc_ematch/Kbuild
+++ b/include/uapi/linux/tc_ematch/Kbuild
@@ -1 +1,5 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += tc_em_cmp.h
3header-y += tc_em_meta.h
4header-y += tc_em_nbyte.h
5header-y += tc_em_text.h
diff --git a/include/linux/tc_ematch/tc_em_cmp.h b/include/uapi/linux/tc_ematch/tc_em_cmp.h
index f34bb1bae083..f34bb1bae083 100644
--- a/include/linux/tc_ematch/tc_em_cmp.h
+++ b/include/uapi/linux/tc_ematch/tc_em_cmp.h
diff --git a/include/linux/tc_ematch/tc_em_meta.h b/include/uapi/linux/tc_ematch/tc_em_meta.h
index b11f8ce2d3c0..b11f8ce2d3c0 100644
--- a/include/linux/tc_ematch/tc_em_meta.h
+++ b/include/uapi/linux/tc_ematch/tc_em_meta.h
diff --git a/include/linux/tc_ematch/tc_em_nbyte.h b/include/uapi/linux/tc_ematch/tc_em_nbyte.h
index 7172cfb999c1..7172cfb999c1 100644
--- a/include/linux/tc_ematch/tc_em_nbyte.h
+++ b/include/uapi/linux/tc_ematch/tc_em_nbyte.h
diff --git a/include/linux/tc_ematch/tc_em_text.h b/include/uapi/linux/tc_ematch/tc_em_text.h
index 5aac4045ba88..5aac4045ba88 100644
--- a/include/linux/tc_ematch/tc_em_text.h
+++ b/include/uapi/linux/tc_ematch/tc_em_text.h
diff --git a/include/uapi/linux/tcp.h b/include/uapi/linux/tcp.h
new file mode 100644
index 000000000000..e962faa5ab0d
--- /dev/null
+++ b/include/uapi/linux/tcp.h
@@ -0,0 +1,226 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for the TCP protocol.
7 *
8 * Version: @(#)tcp.h 1.0.2 04/28/93
9 *
10 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17#ifndef _UAPI_LINUX_TCP_H
18#define _UAPI_LINUX_TCP_H
19
20#include <linux/types.h>
21#include <asm/byteorder.h>
22#include <linux/socket.h>
23
24struct tcphdr {
25 __be16 source;
26 __be16 dest;
27 __be32 seq;
28 __be32 ack_seq;
29#if defined(__LITTLE_ENDIAN_BITFIELD)
30 __u16 res1:4,
31 doff:4,
32 fin:1,
33 syn:1,
34 rst:1,
35 psh:1,
36 ack:1,
37 urg:1,
38 ece:1,
39 cwr:1;
40#elif defined(__BIG_ENDIAN_BITFIELD)
41 __u16 doff:4,
42 res1:4,
43 cwr:1,
44 ece:1,
45 urg:1,
46 ack:1,
47 psh:1,
48 rst:1,
49 syn:1,
50 fin:1;
51#else
52#error "Adjust your <asm/byteorder.h> defines"
53#endif
54 __be16 window;
55 __sum16 check;
56 __be16 urg_ptr;
57};
58
59/*
60 * The union cast uses a gcc extension to avoid aliasing problems
61 * (union is compatible to any of its members)
62 * This means this part of the code is -fstrict-aliasing safe now.
63 */
64union tcp_word_hdr {
65 struct tcphdr hdr;
66 __be32 words[5];
67};
68
69#define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3])
70
71enum {
72 TCP_FLAG_CWR = __constant_cpu_to_be32(0x00800000),
73 TCP_FLAG_ECE = __constant_cpu_to_be32(0x00400000),
74 TCP_FLAG_URG = __constant_cpu_to_be32(0x00200000),
75 TCP_FLAG_ACK = __constant_cpu_to_be32(0x00100000),
76 TCP_FLAG_PSH = __constant_cpu_to_be32(0x00080000),
77 TCP_FLAG_RST = __constant_cpu_to_be32(0x00040000),
78 TCP_FLAG_SYN = __constant_cpu_to_be32(0x00020000),
79 TCP_FLAG_FIN = __constant_cpu_to_be32(0x00010000),
80 TCP_RESERVED_BITS = __constant_cpu_to_be32(0x0F000000),
81 TCP_DATA_OFFSET = __constant_cpu_to_be32(0xF0000000)
82};
83
84/*
85 * TCP general constants
86 */
87#define TCP_MSS_DEFAULT 536U /* IPv4 (RFC1122, RFC2581) */
88#define TCP_MSS_DESIRED 1220U /* IPv6 (tunneled), EDNS0 (RFC3226) */
89
90/* TCP socket options */
91#define TCP_NODELAY 1 /* Turn off Nagle's algorithm. */
92#define TCP_MAXSEG 2 /* Limit MSS */
93#define TCP_CORK 3 /* Never send partially complete segments */
94#define TCP_KEEPIDLE 4 /* Start keeplives after this period */
95#define TCP_KEEPINTVL 5 /* Interval between keepalives */
96#define TCP_KEEPCNT 6 /* Number of keepalives before death */
97#define TCP_SYNCNT 7 /* Number of SYN retransmits */
98#define TCP_LINGER2 8 /* Life time of orphaned FIN-WAIT-2 state */
99#define TCP_DEFER_ACCEPT 9 /* Wake up listener only when data arrive */
100#define TCP_WINDOW_CLAMP 10 /* Bound advertised window */
101#define TCP_INFO 11 /* Information about this connection. */
102#define TCP_QUICKACK 12 /* Block/reenable quick acks */
103#define TCP_CONGESTION 13 /* Congestion control algorithm */
104#define TCP_MD5SIG 14 /* TCP MD5 Signature (RFC2385) */
105#define TCP_COOKIE_TRANSACTIONS 15 /* TCP Cookie Transactions */
106#define TCP_THIN_LINEAR_TIMEOUTS 16 /* Use linear timeouts for thin streams*/
107#define TCP_THIN_DUPACK 17 /* Fast retrans. after 1 dupack */
108#define TCP_USER_TIMEOUT 18 /* How long for loss retry before timeout */
109#define TCP_REPAIR 19 /* TCP sock is under repair right now */
110#define TCP_REPAIR_QUEUE 20
111#define TCP_QUEUE_SEQ 21
112#define TCP_REPAIR_OPTIONS 22
113#define TCP_FASTOPEN 23 /* Enable FastOpen on listeners */
114
115struct tcp_repair_opt {
116 __u32 opt_code;
117 __u32 opt_val;
118};
119
120enum {
121 TCP_NO_QUEUE,
122 TCP_RECV_QUEUE,
123 TCP_SEND_QUEUE,
124 TCP_QUEUES_NR,
125};
126
127/* for TCP_INFO socket option */
128#define TCPI_OPT_TIMESTAMPS 1
129#define TCPI_OPT_SACK 2
130#define TCPI_OPT_WSCALE 4
131#define TCPI_OPT_ECN 8 /* ECN was negociated at TCP session init */
132#define TCPI_OPT_ECN_SEEN 16 /* we received at least one packet with ECT */
133#define TCPI_OPT_SYN_DATA 32 /* SYN-ACK acked data in SYN sent or rcvd */
134
135enum tcp_ca_state {
136 TCP_CA_Open = 0,
137#define TCPF_CA_Open (1<<TCP_CA_Open)
138 TCP_CA_Disorder = 1,
139#define TCPF_CA_Disorder (1<<TCP_CA_Disorder)
140 TCP_CA_CWR = 2,
141#define TCPF_CA_CWR (1<<TCP_CA_CWR)
142 TCP_CA_Recovery = 3,
143#define TCPF_CA_Recovery (1<<TCP_CA_Recovery)
144 TCP_CA_Loss = 4
145#define TCPF_CA_Loss (1<<TCP_CA_Loss)
146};
147
148struct tcp_info {
149 __u8 tcpi_state;
150 __u8 tcpi_ca_state;
151 __u8 tcpi_retransmits;
152 __u8 tcpi_probes;
153 __u8 tcpi_backoff;
154 __u8 tcpi_options;
155 __u8 tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4;
156
157 __u32 tcpi_rto;
158 __u32 tcpi_ato;
159 __u32 tcpi_snd_mss;
160 __u32 tcpi_rcv_mss;
161
162 __u32 tcpi_unacked;
163 __u32 tcpi_sacked;
164 __u32 tcpi_lost;
165 __u32 tcpi_retrans;
166 __u32 tcpi_fackets;
167
168 /* Times. */
169 __u32 tcpi_last_data_sent;
170 __u32 tcpi_last_ack_sent; /* Not remembered, sorry. */
171 __u32 tcpi_last_data_recv;
172 __u32 tcpi_last_ack_recv;
173
174 /* Metrics. */
175 __u32 tcpi_pmtu;
176 __u32 tcpi_rcv_ssthresh;
177 __u32 tcpi_rtt;
178 __u32 tcpi_rttvar;
179 __u32 tcpi_snd_ssthresh;
180 __u32 tcpi_snd_cwnd;
181 __u32 tcpi_advmss;
182 __u32 tcpi_reordering;
183
184 __u32 tcpi_rcv_rtt;
185 __u32 tcpi_rcv_space;
186
187 __u32 tcpi_total_retrans;
188};
189
190/* for TCP_MD5SIG socket option */
191#define TCP_MD5SIG_MAXKEYLEN 80
192
193struct tcp_md5sig {
194 struct __kernel_sockaddr_storage tcpm_addr; /* address associated */
195 __u16 __tcpm_pad1; /* zero */
196 __u16 tcpm_keylen; /* key length */
197 __u32 __tcpm_pad2; /* zero */
198 __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* key (binary) */
199};
200
201/* for TCP_COOKIE_TRANSACTIONS (TCPCT) socket option */
202#define TCP_COOKIE_MIN 8 /* 64-bits */
203#define TCP_COOKIE_MAX 16 /* 128-bits */
204#define TCP_COOKIE_PAIR_SIZE (2*TCP_COOKIE_MAX)
205
206/* Flags for both getsockopt and setsockopt */
207#define TCP_COOKIE_IN_ALWAYS (1 << 0) /* Discard SYN without cookie */
208#define TCP_COOKIE_OUT_NEVER (1 << 1) /* Prohibit outgoing cookies,
209 * supercedes everything. */
210
211/* Flags for getsockopt */
212#define TCP_S_DATA_IN (1 << 2) /* Was data received? */
213#define TCP_S_DATA_OUT (1 << 3) /* Was data sent? */
214
215/* TCP_COOKIE_TRANSACTIONS data */
216struct tcp_cookie_transactions {
217 __u16 tcpct_flags; /* see above */
218 __u8 __tcpct_pad1; /* zero */
219 __u8 tcpct_cookie_desired; /* bytes */
220 __u16 tcpct_s_data_desired; /* bytes of variable data */
221 __u16 tcpct_used; /* bytes in value */
222 __u8 tcpct_value[TCP_MSS_DEFAULT];
223};
224
225
226#endif /* _UAPI_LINUX_TCP_H */
diff --git a/include/linux/tcp_metrics.h b/include/uapi/linux/tcp_metrics.h
index cb5157b55f32..cb5157b55f32 100644
--- a/include/linux/tcp_metrics.h
+++ b/include/uapi/linux/tcp_metrics.h
diff --git a/include/linux/telephony.h b/include/uapi/linux/telephony.h
index f63afe330add..f63afe330add 100644
--- a/include/linux/telephony.h
+++ b/include/uapi/linux/telephony.h
diff --git a/include/linux/termios.h b/include/uapi/linux/termios.h
index 2acd0c1f8a2a..2acd0c1f8a2a 100644
--- a/include/linux/termios.h
+++ b/include/uapi/linux/termios.h
diff --git a/include/uapi/linux/time.h b/include/uapi/linux/time.h
new file mode 100644
index 000000000000..0d3c0edc3eda
--- /dev/null
+++ b/include/uapi/linux/time.h
@@ -0,0 +1,71 @@
1#ifndef _UAPI_LINUX_TIME_H
2#define _UAPI_LINUX_TIME_H
3
4#include <linux/types.h>
5
6
7#ifndef _STRUCT_TIMESPEC
8#define _STRUCT_TIMESPEC
9struct timespec {
10 __kernel_time_t tv_sec; /* seconds */
11 long tv_nsec; /* nanoseconds */
12};
13#endif
14
15struct timeval {
16 __kernel_time_t tv_sec; /* seconds */
17 __kernel_suseconds_t tv_usec; /* microseconds */
18};
19
20struct timezone {
21 int tz_minuteswest; /* minutes west of Greenwich */
22 int tz_dsttime; /* type of dst correction */
23};
24
25
26/*
27 * Names of the interval timers, and structure
28 * defining a timer setting:
29 */
30#define ITIMER_REAL 0
31#define ITIMER_VIRTUAL 1
32#define ITIMER_PROF 2
33
34struct itimerspec {
35 struct timespec it_interval; /* timer period */
36 struct timespec it_value; /* timer expiration */
37};
38
39struct itimerval {
40 struct timeval it_interval; /* timer interval */
41 struct timeval it_value; /* current value */
42};
43
44/*
45 * The IDs of the various system clocks (for POSIX.1b interval timers):
46 */
47#define CLOCK_REALTIME 0
48#define CLOCK_MONOTONIC 1
49#define CLOCK_PROCESS_CPUTIME_ID 2
50#define CLOCK_THREAD_CPUTIME_ID 3
51#define CLOCK_MONOTONIC_RAW 4
52#define CLOCK_REALTIME_COARSE 5
53#define CLOCK_MONOTONIC_COARSE 6
54#define CLOCK_BOOTTIME 7
55#define CLOCK_REALTIME_ALARM 8
56#define CLOCK_BOOTTIME_ALARM 9
57
58/*
59 * The IDs of various hardware clocks:
60 */
61#define CLOCK_SGI_CYCLE 10
62#define MAX_CLOCKS 16
63#define CLOCKS_MASK (CLOCK_REALTIME | CLOCK_MONOTONIC)
64#define CLOCKS_MONO CLOCK_MONOTONIC
65
66/*
67 * The various flags for setting POSIX.1b interval timers:
68 */
69#define TIMER_ABSTIME 0x01
70
71#endif /* _UAPI_LINUX_TIME_H */
diff --git a/include/linux/times.h b/include/uapi/linux/times.h
index 87b62615cedd..87b62615cedd 100644
--- a/include/linux/times.h
+++ b/include/uapi/linux/times.h
diff --git a/include/uapi/linux/timex.h b/include/uapi/linux/timex.h
new file mode 100644
index 000000000000..a7ea81f13711
--- /dev/null
+++ b/include/uapi/linux/timex.h
@@ -0,0 +1,166 @@
1/*****************************************************************************
2 * *
3 * Copyright (c) David L. Mills 1993 *
4 * *
5 * Permission to use, copy, modify, and distribute this software and its *
6 * documentation for any purpose and without fee is hereby granted, provided *
7 * that the above copyright notice appears in all copies and that both the *
8 * copyright notice and this permission notice appear in supporting *
9 * documentation, and that the name University of Delaware not be used in *
10 * advertising or publicity pertaining to distribution of the software *
11 * without specific, written prior permission. The University of Delaware *
12 * makes no representations about the suitability this software for any *
13 * purpose. It is provided "as is" without express or implied warranty. *
14 * *
15 *****************************************************************************/
16
17/*
18 * Modification history timex.h
19 *
20 * 29 Dec 97 Russell King
21 * Moved CLOCK_TICK_RATE, CLOCK_TICK_FACTOR and FINETUNE to asm/timex.h
22 * for ARM machines
23 *
24 * 9 Jan 97 Adrian Sun
25 * Shifted LATCH define to allow access to alpha machines.
26 *
27 * 26 Sep 94 David L. Mills
28 * Added defines for hybrid phase/frequency-lock loop.
29 *
30 * 19 Mar 94 David L. Mills
31 * Moved defines from kernel routines to header file and added new
32 * defines for PPS phase-lock loop.
33 *
34 * 20 Feb 94 David L. Mills
35 * Revised status codes and structures for external clock and PPS
36 * signal discipline.
37 *
38 * 28 Nov 93 David L. Mills
39 * Adjusted parameters to improve stability and increase poll
40 * interval.
41 *
42 * 17 Sep 93 David L. Mills
43 * Created file $NTP/include/sys/timex.h
44 * 07 Oct 93 Torsten Duwe
45 * Derived linux/timex.h
46 * 1995-08-13 Torsten Duwe
47 * kernel PLL updated to 1994-12-13 specs (rfc-1589)
48 * 1997-08-30 Ulrich Windl
49 * Added new constant NTP_PHASE_LIMIT
50 * 2004-08-12 Christoph Lameter
51 * Reworked time interpolation logic
52 */
53#ifndef _UAPI_LINUX_TIMEX_H
54#define _UAPI_LINUX_TIMEX_H
55
56#include <linux/time.h>
57
58#define NTP_API 4 /* NTP API version */
59
60/*
61 * syscall interface - used (mainly by NTP daemon)
62 * to discipline kernel clock oscillator
63 */
64struct timex {
65 unsigned int modes; /* mode selector */
66 long offset; /* time offset (usec) */
67 long freq; /* frequency offset (scaled ppm) */
68 long maxerror; /* maximum error (usec) */
69 long esterror; /* estimated error (usec) */
70 int status; /* clock command/status */
71 long constant; /* pll time constant */
72 long precision; /* clock precision (usec) (read only) */
73 long tolerance; /* clock frequency tolerance (ppm)
74 * (read only)
75 */
76 struct timeval time; /* (read only, except for ADJ_SETOFFSET) */
77 long tick; /* (modified) usecs between clock ticks */
78
79 long ppsfreq; /* pps frequency (scaled ppm) (ro) */
80 long jitter; /* pps jitter (us) (ro) */
81 int shift; /* interval duration (s) (shift) (ro) */
82 long stabil; /* pps stability (scaled ppm) (ro) */
83 long jitcnt; /* jitter limit exceeded (ro) */
84 long calcnt; /* calibration intervals (ro) */
85 long errcnt; /* calibration errors (ro) */
86 long stbcnt; /* stability limit exceeded (ro) */
87
88 int tai; /* TAI offset (ro) */
89
90 int :32; int :32; int :32; int :32;
91 int :32; int :32; int :32; int :32;
92 int :32; int :32; int :32;
93};
94
95/*
96 * Mode codes (timex.mode)
97 */
98#define ADJ_OFFSET 0x0001 /* time offset */
99#define ADJ_FREQUENCY 0x0002 /* frequency offset */
100#define ADJ_MAXERROR 0x0004 /* maximum time error */
101#define ADJ_ESTERROR 0x0008 /* estimated time error */
102#define ADJ_STATUS 0x0010 /* clock status */
103#define ADJ_TIMECONST 0x0020 /* pll time constant */
104#define ADJ_TAI 0x0080 /* set TAI offset */
105#define ADJ_SETOFFSET 0x0100 /* add 'time' to current time */
106#define ADJ_MICRO 0x1000 /* select microsecond resolution */
107#define ADJ_NANO 0x2000 /* select nanosecond resolution */
108#define ADJ_TICK 0x4000 /* tick value */
109
110#ifndef __KERNEL__
111#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
112#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */
113#endif
114
115/* NTP userland likes the MOD_ prefix better */
116#define MOD_OFFSET ADJ_OFFSET
117#define MOD_FREQUENCY ADJ_FREQUENCY
118#define MOD_MAXERROR ADJ_MAXERROR
119#define MOD_ESTERROR ADJ_ESTERROR
120#define MOD_STATUS ADJ_STATUS
121#define MOD_TIMECONST ADJ_TIMECONST
122#define MOD_TAI ADJ_TAI
123#define MOD_MICRO ADJ_MICRO
124#define MOD_NANO ADJ_NANO
125
126
127/*
128 * Status codes (timex.status)
129 */
130#define STA_PLL 0x0001 /* enable PLL updates (rw) */
131#define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */
132#define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */
133#define STA_FLL 0x0008 /* select frequency-lock mode (rw) */
134
135#define STA_INS 0x0010 /* insert leap (rw) */
136#define STA_DEL 0x0020 /* delete leap (rw) */
137#define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */
138#define STA_FREQHOLD 0x0080 /* hold frequency (rw) */
139
140#define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */
141#define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */
142#define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */
143#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */
144
145#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */
146#define STA_NANO 0x2000 /* resolution (0 = us, 1 = ns) (ro) */
147#define STA_MODE 0x4000 /* mode (0 = PLL, 1 = FLL) (ro) */
148#define STA_CLK 0x8000 /* clock source (0 = A, 1 = B) (ro) */
149
150/* read-only bits */
151#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
152 STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)
153
154/*
155 * Clock states (time_state)
156 */
157#define TIME_OK 0 /* clock synchronized, no leap second */
158#define TIME_INS 1 /* insert leap second */
159#define TIME_DEL 2 /* delete leap second */
160#define TIME_OOP 3 /* leap second in progress */
161#define TIME_WAIT 4 /* leap second has occurred */
162#define TIME_ERROR 5 /* clock not synchronized */
163#define TIME_BAD TIME_ERROR /* bw compat */
164
165
166#endif /* _UAPI_LINUX_TIMEX_H */
diff --git a/include/linux/tiocl.h b/include/uapi/linux/tiocl.h
index 4756862c4ed4..4756862c4ed4 100644
--- a/include/linux/tiocl.h
+++ b/include/uapi/linux/tiocl.h
diff --git a/include/linux/tipc.h b/include/uapi/linux/tipc.h
index f2d90091cc20..f2d90091cc20 100644
--- a/include/linux/tipc.h
+++ b/include/uapi/linux/tipc.h
diff --git a/include/linux/tipc_config.h b/include/uapi/linux/tipc_config.h
index 0b1e3f218a36..0b1e3f218a36 100644
--- a/include/linux/tipc_config.h
+++ b/include/uapi/linux/tipc_config.h
diff --git a/include/uapi/linux/toshiba.h b/include/uapi/linux/toshiba.h
new file mode 100644
index 000000000000..e9bef5b2f91e
--- /dev/null
+++ b/include/uapi/linux/toshiba.h
@@ -0,0 +1,37 @@
1/* toshiba.h -- Linux driver for accessing the SMM on Toshiba laptops
2 *
3 * Copyright (c) 1996-2000 Jonathan A. Buzzard (jonathan@buzzard.org.uk)
4 *
5 * Thanks to Juergen Heinzl <juergen@monocerus.demon.co.uk> for the pointers
6 * on making sure the structure is aligned and packed.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 */
19
20#ifndef _UAPI_LINUX_TOSHIBA_H
21#define _UAPI_LINUX_TOSHIBA_H
22
23#define TOSH_PROC "/proc/toshiba"
24#define TOSH_DEVICE "/dev/toshiba"
25#define TOSH_SMM _IOWR('t', 0x90, int) /* broken: meant 24 bytes */
26
27typedef struct {
28 unsigned int eax;
29 unsigned int ebx __attribute__ ((packed));
30 unsigned int ecx __attribute__ ((packed));
31 unsigned int edx __attribute__ ((packed));
32 unsigned int esi __attribute__ ((packed));
33 unsigned int edi __attribute__ ((packed));
34} SMMRegisters;
35
36
37#endif /* _UAPI_LINUX_TOSHIBA_H */
diff --git a/include/uapi/linux/tty.h b/include/uapi/linux/tty.h
new file mode 100644
index 000000000000..dac199a2dba5
--- /dev/null
+++ b/include/uapi/linux/tty.h
@@ -0,0 +1,38 @@
1#ifndef _UAPI_LINUX_TTY_H
2#define _UAPI_LINUX_TTY_H
3
4/*
5 * 'tty.h' defines some structures used by tty_io.c and some defines.
6 */
7
8#define NR_LDISCS 30
9
10/* line disciplines */
11#define N_TTY 0
12#define N_SLIP 1
13#define N_MOUSE 2
14#define N_PPP 3
15#define N_STRIP 4
16#define N_AX25 5
17#define N_X25 6 /* X.25 async */
18#define N_6PACK 7
19#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */
20#define N_R3964 9 /* Reserved for Simatic R3964 module */
21#define N_PROFIBUS_FDL 10 /* Reserved for Profibus */
22#define N_IRDA 11 /* Linux IrDa - http://irda.sourceforge.net/ */
23#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data */
24 /* cards about SMS messages */
25#define N_HDLC 13 /* synchronous HDLC */
26#define N_SYNC_PPP 14 /* synchronous PPP */
27#define N_HCI 15 /* Bluetooth HCI UART */
28#define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */
29#define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */
30#define N_PPS 18 /* Pulse per Second */
31#define N_V253 19 /* Codec control over voice modem */
32#define N_CAIF 20 /* CAIF protocol for talking to modems */
33#define N_GSM0710 21 /* GSM 0710 Mux */
34#define N_TI_WL 22 /* for TI's WL BT, FM, GPS combo chips */
35#define N_TRACESINK 23 /* Trace data routing for MIPI P1149.7 */
36#define N_TRACEROUTER 24 /* Trace data routing for MIPI P1149.7 */
37
38#endif /* _UAPI_LINUX_TTY_H */
diff --git a/include/linux/tty_flags.h b/include/uapi/linux/tty_flags.h
index eefcb483a2c0..eefcb483a2c0 100644
--- a/include/linux/tty_flags.h
+++ b/include/uapi/linux/tty_flags.h
diff --git a/include/uapi/linux/types.h b/include/uapi/linux/types.h
new file mode 100644
index 000000000000..acf0979b790a
--- /dev/null
+++ b/include/uapi/linux/types.h
@@ -0,0 +1,56 @@
1#ifndef _UAPI_LINUX_TYPES_H
2#define _UAPI_LINUX_TYPES_H
3
4#include <asm/types.h>
5
6#ifndef __ASSEMBLY__
7#ifndef __KERNEL__
8#ifndef __EXPORTED_HEADERS__
9#warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders"
10#endif /* __EXPORTED_HEADERS__ */
11#endif
12
13#include <linux/posix_types.h>
14
15
16/*
17 * Below are truly Linux-specific types that should never collide with
18 * any application/library that wants linux/types.h.
19 */
20
21#ifdef __CHECKER__
22#define __bitwise__ __attribute__((bitwise))
23#else
24#define __bitwise__
25#endif
26#ifdef __CHECK_ENDIAN__
27#define __bitwise __bitwise__
28#else
29#define __bitwise
30#endif
31
32typedef __u16 __bitwise __le16;
33typedef __u16 __bitwise __be16;
34typedef __u32 __bitwise __le32;
35typedef __u32 __bitwise __be32;
36typedef __u64 __bitwise __le64;
37typedef __u64 __bitwise __be64;
38
39typedef __u16 __bitwise __sum16;
40typedef __u32 __bitwise __wsum;
41
42/*
43 * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid
44 * common 32/64-bit compat problems.
45 * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other
46 * architectures) and to 8-byte boundaries on 64-bit architectures. The new
47 * aligned_64 type enforces 8-byte alignment so that structs containing
48 * aligned_64 values have the same alignment on 32-bit and 64-bit architectures.
49 * No conversions are necessary between 32-bit user-space and a 64-bit kernel.
50 */
51#define __aligned_u64 __u64 __attribute__((aligned(8)))
52#define __aligned_be64 __be64 __attribute__((aligned(8)))
53#define __aligned_le64 __le64 __attribute__((aligned(8)))
54
55#endif /* __ASSEMBLY__ */
56#endif /* _UAPI_LINUX_TYPES_H */
diff --git a/include/linux/udf_fs_i.h b/include/uapi/linux/udf_fs_i.h
index 3536965913b0..3536965913b0 100644
--- a/include/linux/udf_fs_i.h
+++ b/include/uapi/linux/udf_fs_i.h
diff --git a/include/uapi/linux/udp.h b/include/uapi/linux/udp.h
new file mode 100644
index 000000000000..e2bcfd75a30d
--- /dev/null
+++ b/include/uapi/linux/udp.h
@@ -0,0 +1,39 @@
1/*
2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
5 *
6 * Definitions for the UDP protocol.
7 *
8 * Version: @(#)udp.h 1.0.2 04/28/93
9 *
10 * Author: Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17#ifndef _UAPI_LINUX_UDP_H
18#define _UAPI_LINUX_UDP_H
19
20#include <linux/types.h>
21
22struct udphdr {
23 __be16 source;
24 __be16 dest;
25 __be16 len;
26 __sum16 check;
27};
28
29/* UDP socket options */
30#define UDP_CORK 1 /* Never send partially complete segments */
31#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */
32
33/* UDP encapsulation types */
34#define UDP_ENCAP_ESPINUDP_NON_IKE 1 /* draft-ietf-ipsec-nat-t-ike-00/01 */
35#define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */
36#define UDP_ENCAP_L2TPINUDP 3 /* rfc2661 */
37
38
39#endif /* _UAPI_LINUX_UDP_H */
diff --git a/include/linux/uhid.h b/include/uapi/linux/uhid.h
index 9c6974f16966..9c6974f16966 100644
--- a/include/linux/uhid.h
+++ b/include/uapi/linux/uhid.h
diff --git a/include/uapi/linux/uinput.h b/include/uapi/linux/uinput.h
new file mode 100644
index 000000000000..fe46431593f9
--- /dev/null
+++ b/include/uapi/linux/uinput.h
@@ -0,0 +1,137 @@
1/*
2 * User level driver support for input subsystem
3 *
4 * Heavily based on evdev.c by Vojtech Pavlik
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 * Author: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
21 *
22 * Changes/Revisions:
23 * 0.3 24/05/2006 (Anssi Hannula <anssi.hannulagmail.com>)
24 * - update ff support for the changes in kernel interface
25 * - add UINPUT_VERSION
26 * 0.2 16/10/2004 (Micah Dowty <micah@navi.cx>)
27 * - added force feedback support
28 * - added UI_SET_PHYS
29 * 0.1 20/06/2002
30 * - first public version
31 */
32#ifndef _UAPI__UINPUT_H_
33#define _UAPI__UINPUT_H_
34
35#include <linux/types.h>
36#include <linux/input.h>
37
38#define UINPUT_VERSION 3
39
40
41struct uinput_ff_upload {
42 __u32 request_id;
43 __s32 retval;
44 struct ff_effect effect;
45 struct ff_effect old;
46};
47
48struct uinput_ff_erase {
49 __u32 request_id;
50 __s32 retval;
51 __u32 effect_id;
52};
53
54/* ioctl */
55#define UINPUT_IOCTL_BASE 'U'
56#define UI_DEV_CREATE _IO(UINPUT_IOCTL_BASE, 1)
57#define UI_DEV_DESTROY _IO(UINPUT_IOCTL_BASE, 2)
58
59#define UI_SET_EVBIT _IOW(UINPUT_IOCTL_BASE, 100, int)
60#define UI_SET_KEYBIT _IOW(UINPUT_IOCTL_BASE, 101, int)
61#define UI_SET_RELBIT _IOW(UINPUT_IOCTL_BASE, 102, int)
62#define UI_SET_ABSBIT _IOW(UINPUT_IOCTL_BASE, 103, int)
63#define UI_SET_MSCBIT _IOW(UINPUT_IOCTL_BASE, 104, int)
64#define UI_SET_LEDBIT _IOW(UINPUT_IOCTL_BASE, 105, int)
65#define UI_SET_SNDBIT _IOW(UINPUT_IOCTL_BASE, 106, int)
66#define UI_SET_FFBIT _IOW(UINPUT_IOCTL_BASE, 107, int)
67#define UI_SET_PHYS _IOW(UINPUT_IOCTL_BASE, 108, char*)
68#define UI_SET_SWBIT _IOW(UINPUT_IOCTL_BASE, 109, int)
69#define UI_SET_PROPBIT _IOW(UINPUT_IOCTL_BASE, 110, int)
70
71#define UI_BEGIN_FF_UPLOAD _IOWR(UINPUT_IOCTL_BASE, 200, struct uinput_ff_upload)
72#define UI_END_FF_UPLOAD _IOW(UINPUT_IOCTL_BASE, 201, struct uinput_ff_upload)
73#define UI_BEGIN_FF_ERASE _IOWR(UINPUT_IOCTL_BASE, 202, struct uinput_ff_erase)
74#define UI_END_FF_ERASE _IOW(UINPUT_IOCTL_BASE, 203, struct uinput_ff_erase)
75
76/*
77 * To write a force-feedback-capable driver, the upload_effect
78 * and erase_effect callbacks in input_dev must be implemented.
79 * The uinput driver will generate a fake input event when one of
80 * these callbacks are invoked. The userspace code then uses
81 * ioctls to retrieve additional parameters and send the return code.
82 * The callback blocks until this return code is sent.
83 *
84 * The described callback mechanism is only used if ff_effects_max
85 * is set.
86 *
87 * To implement upload_effect():
88 * 1. Wait for an event with type == EV_UINPUT and code == UI_FF_UPLOAD.
89 * A request ID will be given in 'value'.
90 * 2. Allocate a uinput_ff_upload struct, fill in request_id with
91 * the 'value' from the EV_UINPUT event.
92 * 3. Issue a UI_BEGIN_FF_UPLOAD ioctl, giving it the
93 * uinput_ff_upload struct. It will be filled in with the
94 * ff_effects passed to upload_effect().
95 * 4. Perform the effect upload, and place a return code back into
96 the uinput_ff_upload struct.
97 * 5. Issue a UI_END_FF_UPLOAD ioctl, also giving it the
98 * uinput_ff_upload_effect struct. This will complete execution
99 * of our upload_effect() handler.
100 *
101 * To implement erase_effect():
102 * 1. Wait for an event with type == EV_UINPUT and code == UI_FF_ERASE.
103 * A request ID will be given in 'value'.
104 * 2. Allocate a uinput_ff_erase struct, fill in request_id with
105 * the 'value' from the EV_UINPUT event.
106 * 3. Issue a UI_BEGIN_FF_ERASE ioctl, giving it the
107 * uinput_ff_erase struct. It will be filled in with the
108 * effect ID passed to erase_effect().
109 * 4. Perform the effect erasure, and place a return code back
110 * into the uinput_ff_erase struct.
111 * 5. Issue a UI_END_FF_ERASE ioctl, also giving it the
112 * uinput_ff_erase_effect struct. This will complete execution
113 * of our erase_effect() handler.
114 */
115
116/*
117 * This is the new event type, used only by uinput.
118 * 'code' is UI_FF_UPLOAD or UI_FF_ERASE, and 'value'
119 * is the unique request ID. This number was picked
120 * arbitrarily, above EV_MAX (since the input system
121 * never sees it) but in the range of a 16-bit int.
122 */
123#define EV_UINPUT 0x0101
124#define UI_FF_UPLOAD 1
125#define UI_FF_ERASE 2
126
127#define UINPUT_MAX_NAME_SIZE 80
128struct uinput_user_dev {
129 char name[UINPUT_MAX_NAME_SIZE];
130 struct input_id id;
131 __u32 ff_effects_max;
132 __s32 absmax[ABS_CNT];
133 __s32 absmin[ABS_CNT];
134 __s32 absfuzz[ABS_CNT];
135 __s32 absflat[ABS_CNT];
136};
137#endif /* _UAPI__UINPUT_H_ */
diff --git a/include/uapi/linux/uio.h b/include/uapi/linux/uio.h
new file mode 100644
index 000000000000..2731d56a5484
--- /dev/null
+++ b/include/uapi/linux/uio.h
@@ -0,0 +1,30 @@
1/*
2 * Berkeley style UIO structures - Alan Cox 1994.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#ifndef _UAPI__LINUX_UIO_H
10#define _UAPI__LINUX_UIO_H
11
12#include <linux/compiler.h>
13#include <linux/types.h>
14
15
16struct iovec
17{
18 void __user *iov_base; /* BSD uses caddr_t (1003.1g requires void *) */
19 __kernel_size_t iov_len; /* Must be size_t (1003.1g) */
20};
21
22/*
23 * UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1)
24 */
25
26#define UIO_FASTIOV 8
27#define UIO_MAXIOV 1024
28
29
30#endif /* _UAPI__LINUX_UIO_H */
diff --git a/include/linux/ultrasound.h b/include/uapi/linux/ultrasound.h
index 71339dc531c5..71339dc531c5 100644
--- a/include/linux/ultrasound.h
+++ b/include/uapi/linux/ultrasound.h
diff --git a/include/linux/un.h b/include/uapi/linux/un.h
index 3ed3e46c1b1f..3ed3e46c1b1f 100644
--- a/include/linux/un.h
+++ b/include/uapi/linux/un.h
diff --git a/include/linux/unistd.h b/include/uapi/linux/unistd.h
index aa8d5b5e2e3e..aa8d5b5e2e3e 100644
--- a/include/linux/unistd.h
+++ b/include/uapi/linux/unistd.h
diff --git a/include/linux/unix_diag.h b/include/uapi/linux/unix_diag.h
index b1d2bf16b33c..b1d2bf16b33c 100644
--- a/include/linux/unix_diag.h
+++ b/include/uapi/linux/unix_diag.h
diff --git a/include/uapi/linux/usb/Kbuild b/include/uapi/linux/usb/Kbuild
index aafaa5aa54d4..6cb4ea826834 100644
--- a/include/uapi/linux/usb/Kbuild
+++ b/include/uapi/linux/usb/Kbuild
@@ -1 +1,11 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += audio.h
3header-y += cdc.h
4header-y += ch11.h
5header-y += ch9.h
6header-y += functionfs.h
7header-y += g_printer.h
8header-y += gadgetfs.h
9header-y += midi.h
10header-y += tmc.h
11header-y += video.h
diff --git a/include/uapi/linux/usb/audio.h b/include/uapi/linux/usb/audio.h
new file mode 100644
index 000000000000..ac90037894d9
--- /dev/null
+++ b/include/uapi/linux/usb/audio.h
@@ -0,0 +1,545 @@
1/*
2 * <linux/usb/audio.h> -- USB Audio definitions.
3 *
4 * Copyright (C) 2006 Thumtronics Pty Ltd.
5 * Developed for Thumtronics by Grey Innovation
6 * Ben Williamson <ben.williamson@greyinnovation.com>
7 *
8 * This software is distributed under the terms of the GNU General Public
9 * License ("GPL") version 2, as published by the Free Software Foundation.
10 *
11 * This file holds USB constants and structures defined
12 * by the USB Device Class Definition for Audio Devices.
13 * Comments below reference relevant sections of that document:
14 *
15 * http://www.usb.org/developers/devclass_docs/audio10.pdf
16 *
17 * Types and defines in this file are either specific to version 1.0 of
18 * this standard or common for newer versions.
19 */
20
21#ifndef _UAPI__LINUX_USB_AUDIO_H
22#define _UAPI__LINUX_USB_AUDIO_H
23
24#include <linux/types.h>
25
26/* bInterfaceProtocol values to denote the version of the standard used */
27#define UAC_VERSION_1 0x00
28#define UAC_VERSION_2 0x20
29
30/* A.2 Audio Interface Subclass Codes */
31#define USB_SUBCLASS_AUDIOCONTROL 0x01
32#define USB_SUBCLASS_AUDIOSTREAMING 0x02
33#define USB_SUBCLASS_MIDISTREAMING 0x03
34
35/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */
36#define UAC_HEADER 0x01
37#define UAC_INPUT_TERMINAL 0x02
38#define UAC_OUTPUT_TERMINAL 0x03
39#define UAC_MIXER_UNIT 0x04
40#define UAC_SELECTOR_UNIT 0x05
41#define UAC_FEATURE_UNIT 0x06
42#define UAC1_PROCESSING_UNIT 0x07
43#define UAC1_EXTENSION_UNIT 0x08
44
45/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */
46#define UAC_AS_GENERAL 0x01
47#define UAC_FORMAT_TYPE 0x02
48#define UAC_FORMAT_SPECIFIC 0x03
49
50/* A.7 Processing Unit Process Types */
51#define UAC_PROCESS_UNDEFINED 0x00
52#define UAC_PROCESS_UP_DOWNMIX 0x01
53#define UAC_PROCESS_DOLBY_PROLOGIC 0x02
54#define UAC_PROCESS_STEREO_EXTENDER 0x03
55#define UAC_PROCESS_REVERB 0x04
56#define UAC_PROCESS_CHORUS 0x05
57#define UAC_PROCESS_DYN_RANGE_COMP 0x06
58
59/* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */
60#define UAC_EP_GENERAL 0x01
61
62/* A.9 Audio Class-Specific Request Codes */
63#define UAC_SET_ 0x00
64#define UAC_GET_ 0x80
65
66#define UAC__CUR 0x1
67#define UAC__MIN 0x2
68#define UAC__MAX 0x3
69#define UAC__RES 0x4
70#define UAC__MEM 0x5
71
72#define UAC_SET_CUR (UAC_SET_ | UAC__CUR)
73#define UAC_GET_CUR (UAC_GET_ | UAC__CUR)
74#define UAC_SET_MIN (UAC_SET_ | UAC__MIN)
75#define UAC_GET_MIN (UAC_GET_ | UAC__MIN)
76#define UAC_SET_MAX (UAC_SET_ | UAC__MAX)
77#define UAC_GET_MAX (UAC_GET_ | UAC__MAX)
78#define UAC_SET_RES (UAC_SET_ | UAC__RES)
79#define UAC_GET_RES (UAC_GET_ | UAC__RES)
80#define UAC_SET_MEM (UAC_SET_ | UAC__MEM)
81#define UAC_GET_MEM (UAC_GET_ | UAC__MEM)
82
83#define UAC_GET_STAT 0xff
84
85/* A.10 Control Selector Codes */
86
87/* A.10.1 Terminal Control Selectors */
88#define UAC_TERM_COPY_PROTECT 0x01
89
90/* A.10.2 Feature Unit Control Selectors */
91#define UAC_FU_MUTE 0x01
92#define UAC_FU_VOLUME 0x02
93#define UAC_FU_BASS 0x03
94#define UAC_FU_MID 0x04
95#define UAC_FU_TREBLE 0x05
96#define UAC_FU_GRAPHIC_EQUALIZER 0x06
97#define UAC_FU_AUTOMATIC_GAIN 0x07
98#define UAC_FU_DELAY 0x08
99#define UAC_FU_BASS_BOOST 0x09
100#define UAC_FU_LOUDNESS 0x0a
101
102#define UAC_CONTROL_BIT(CS) (1 << ((CS) - 1))
103
104/* A.10.3.1 Up/Down-mix Processing Unit Controls Selectors */
105#define UAC_UD_ENABLE 0x01
106#define UAC_UD_MODE_SELECT 0x02
107
108/* A.10.3.2 Dolby Prologic (tm) Processing Unit Controls Selectors */
109#define UAC_DP_ENABLE 0x01
110#define UAC_DP_MODE_SELECT 0x02
111
112/* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */
113#define UAC_3D_ENABLE 0x01
114#define UAC_3D_SPACE 0x02
115
116/* A.10.3.4 Reverberation Processing Unit Control Selectors */
117#define UAC_REVERB_ENABLE 0x01
118#define UAC_REVERB_LEVEL 0x02
119#define UAC_REVERB_TIME 0x03
120#define UAC_REVERB_FEEDBACK 0x04
121
122/* A.10.3.5 Chorus Processing Unit Control Selectors */
123#define UAC_CHORUS_ENABLE 0x01
124#define UAC_CHORUS_LEVEL 0x02
125#define UAC_CHORUS_RATE 0x03
126#define UAC_CHORUS_DEPTH 0x04
127
128/* A.10.3.6 Dynamic Range Compressor Unit Control Selectors */
129#define UAC_DCR_ENABLE 0x01
130#define UAC_DCR_RATE 0x02
131#define UAC_DCR_MAXAMPL 0x03
132#define UAC_DCR_THRESHOLD 0x04
133#define UAC_DCR_ATTACK_TIME 0x05
134#define UAC_DCR_RELEASE_TIME 0x06
135
136/* A.10.4 Extension Unit Control Selectors */
137#define UAC_XU_ENABLE 0x01
138
139/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */
140#define UAC_MS_HEADER 0x01
141#define UAC_MIDI_IN_JACK 0x02
142#define UAC_MIDI_OUT_JACK 0x03
143
144/* MIDI - A.1 MS Class-Specific Endpoint Descriptor Subtypes */
145#define UAC_MS_GENERAL 0x01
146
147/* Terminals - 2.1 USB Terminal Types */
148#define UAC_TERMINAL_UNDEFINED 0x100
149#define UAC_TERMINAL_STREAMING 0x101
150#define UAC_TERMINAL_VENDOR_SPEC 0x1FF
151
152/* Terminal Control Selectors */
153/* 4.3.2 Class-Specific AC Interface Descriptor */
154struct uac1_ac_header_descriptor {
155 __u8 bLength; /* 8 + n */
156 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
157 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */
158 __le16 bcdADC; /* 0x0100 */
159 __le16 wTotalLength; /* includes Unit and Terminal desc. */
160 __u8 bInCollection; /* n */
161 __u8 baInterfaceNr[]; /* [n] */
162} __attribute__ ((packed));
163
164#define UAC_DT_AC_HEADER_SIZE(n) (8 + (n))
165
166/* As above, but more useful for defining your own descriptors: */
167#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \
168struct uac1_ac_header_descriptor_##n { \
169 __u8 bLength; \
170 __u8 bDescriptorType; \
171 __u8 bDescriptorSubtype; \
172 __le16 bcdADC; \
173 __le16 wTotalLength; \
174 __u8 bInCollection; \
175 __u8 baInterfaceNr[n]; \
176} __attribute__ ((packed))
177
178/* 4.3.2.1 Input Terminal Descriptor */
179struct uac_input_terminal_descriptor {
180 __u8 bLength; /* in bytes: 12 */
181 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
182 __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */
183 __u8 bTerminalID; /* Constant uniquely terminal ID */
184 __le16 wTerminalType; /* USB Audio Terminal Types */
185 __u8 bAssocTerminal; /* ID of the Output Terminal associated */
186 __u8 bNrChannels; /* Number of logical output channels */
187 __le16 wChannelConfig;
188 __u8 iChannelNames;
189 __u8 iTerminal;
190} __attribute__ ((packed));
191
192#define UAC_DT_INPUT_TERMINAL_SIZE 12
193
194/* Terminals - 2.2 Input Terminal Types */
195#define UAC_INPUT_TERMINAL_UNDEFINED 0x200
196#define UAC_INPUT_TERMINAL_MICROPHONE 0x201
197#define UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202
198#define UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203
199#define UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204
200#define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205
201#define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206
202
203/* Terminals - control selectors */
204
205#define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01
206
207/* 4.3.2.2 Output Terminal Descriptor */
208struct uac1_output_terminal_descriptor {
209 __u8 bLength; /* in bytes: 9 */
210 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */
211 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */
212 __u8 bTerminalID; /* Constant uniquely terminal ID */
213 __le16 wTerminalType; /* USB Audio Terminal Types */
214 __u8 bAssocTerminal; /* ID of the Input Terminal associated */
215 __u8 bSourceID; /* ID of the connected Unit or Terminal*/
216 __u8 iTerminal;
217} __attribute__ ((packed));
218
219#define UAC_DT_OUTPUT_TERMINAL_SIZE 9
220
221/* Terminals - 2.3 Output Terminal Types */
222#define UAC_OUTPUT_TERMINAL_UNDEFINED 0x300
223#define UAC_OUTPUT_TERMINAL_SPEAKER 0x301
224#define UAC_OUTPUT_TERMINAL_HEADPHONES 0x302
225#define UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303
226#define UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304
227#define UAC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305
228#define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306
229#define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307
230
231/* Set bControlSize = 2 as default setting */
232#define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2)
233
234/* As above, but more useful for defining your own descriptors: */
235#define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \
236struct uac_feature_unit_descriptor_##ch { \
237 __u8 bLength; \
238 __u8 bDescriptorType; \
239 __u8 bDescriptorSubtype; \
240 __u8 bUnitID; \
241 __u8 bSourceID; \
242 __u8 bControlSize; \
243 __le16 bmaControls[ch + 1]; \
244 __u8 iFeature; \
245} __attribute__ ((packed))
246
247/* 4.3.2.3 Mixer Unit Descriptor */
248struct uac_mixer_unit_descriptor {
249 __u8 bLength;
250 __u8 bDescriptorType;
251 __u8 bDescriptorSubtype;
252 __u8 bUnitID;
253 __u8 bNrInPins;
254 __u8 baSourceID[];
255} __attribute__ ((packed));
256
257static inline __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *desc)
258{
259 return desc->baSourceID[desc->bNrInPins];
260}
261
262static inline __u32 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc,
263 int protocol)
264{
265 if (protocol == UAC_VERSION_1)
266 return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
267 desc->baSourceID[desc->bNrInPins + 1];
268 else
269 return (desc->baSourceID[desc->bNrInPins + 4] << 24) |
270 (desc->baSourceID[desc->bNrInPins + 3] << 16) |
271 (desc->baSourceID[desc->bNrInPins + 2] << 8) |
272 (desc->baSourceID[desc->bNrInPins + 1]);
273}
274
275static inline __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc,
276 int protocol)
277{
278 return (protocol == UAC_VERSION_1) ?
279 desc->baSourceID[desc->bNrInPins + 3] :
280 desc->baSourceID[desc->bNrInPins + 5];
281}
282
283static inline __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc,
284 int protocol)
285{
286 return (protocol == UAC_VERSION_1) ?
287 &desc->baSourceID[desc->bNrInPins + 4] :
288 &desc->baSourceID[desc->bNrInPins + 6];
289}
290
291static inline __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc)
292{
293 __u8 *raw = (__u8 *) desc;
294 return raw[desc->bLength - 1];
295}
296
297/* 4.3.2.4 Selector Unit Descriptor */
298struct uac_selector_unit_descriptor {
299 __u8 bLength;
300 __u8 bDescriptorType;
301 __u8 bDescriptorSubtype;
302 __u8 bUintID;
303 __u8 bNrInPins;
304 __u8 baSourceID[];
305} __attribute__ ((packed));
306
307static inline __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc)
308{
309 __u8 *raw = (__u8 *) desc;
310 return raw[desc->bLength - 1];
311}
312
313/* 4.3.2.5 Feature Unit Descriptor */
314struct uac_feature_unit_descriptor {
315 __u8 bLength;
316 __u8 bDescriptorType;
317 __u8 bDescriptorSubtype;
318 __u8 bUnitID;
319 __u8 bSourceID;
320 __u8 bControlSize;
321 __u8 bmaControls[0]; /* variable length */
322} __attribute__((packed));
323
324static inline __u8 uac_feature_unit_iFeature(struct uac_feature_unit_descriptor *desc)
325{
326 __u8 *raw = (__u8 *) desc;
327 return raw[desc->bLength - 1];
328}
329
330/* 4.3.2.6 Processing Unit Descriptors */
331struct uac_processing_unit_descriptor {
332 __u8 bLength;
333 __u8 bDescriptorType;
334 __u8 bDescriptorSubtype;
335 __u8 bUnitID;
336 __u16 wProcessType;
337 __u8 bNrInPins;
338 __u8 baSourceID[];
339} __attribute__ ((packed));
340
341static inline __u8 uac_processing_unit_bNrChannels(struct uac_processing_unit_descriptor *desc)
342{
343 return desc->baSourceID[desc->bNrInPins];
344}
345
346static inline __u32 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc,
347 int protocol)
348{
349 if (protocol == UAC_VERSION_1)
350 return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
351 desc->baSourceID[desc->bNrInPins + 1];
352 else
353 return (desc->baSourceID[desc->bNrInPins + 4] << 24) |
354 (desc->baSourceID[desc->bNrInPins + 3] << 16) |
355 (desc->baSourceID[desc->bNrInPins + 2] << 8) |
356 (desc->baSourceID[desc->bNrInPins + 1]);
357}
358
359static inline __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc,
360 int protocol)
361{
362 return (protocol == UAC_VERSION_1) ?
363 desc->baSourceID[desc->bNrInPins + 3] :
364 desc->baSourceID[desc->bNrInPins + 5];
365}
366
367static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc,
368 int protocol)
369{
370 return (protocol == UAC_VERSION_1) ?
371 desc->baSourceID[desc->bNrInPins + 4] :
372 desc->baSourceID[desc->bNrInPins + 6];
373}
374
375static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc,
376 int protocol)
377{
378 return (protocol == UAC_VERSION_1) ?
379 &desc->baSourceID[desc->bNrInPins + 5] :
380 &desc->baSourceID[desc->bNrInPins + 7];
381}
382
383static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc,
384 int protocol)
385{
386 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
387 return desc->baSourceID[desc->bNrInPins + control_size];
388}
389
390static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc,
391 int protocol)
392{
393 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
394 return &desc->baSourceID[desc->bNrInPins + control_size + 1];
395}
396
397/* 4.5.2 Class-Specific AS Interface Descriptor */
398struct uac1_as_header_descriptor {
399 __u8 bLength; /* in bytes: 7 */
400 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
401 __u8 bDescriptorSubtype; /* AS_GENERAL */
402 __u8 bTerminalLink; /* Terminal ID of connected Terminal */
403 __u8 bDelay; /* Delay introduced by the data path */
404 __le16 wFormatTag; /* The Audio Data Format */
405} __attribute__ ((packed));
406
407#define UAC_DT_AS_HEADER_SIZE 7
408
409/* Formats - A.1.1 Audio Data Format Type I Codes */
410#define UAC_FORMAT_TYPE_I_UNDEFINED 0x0
411#define UAC_FORMAT_TYPE_I_PCM 0x1
412#define UAC_FORMAT_TYPE_I_PCM8 0x2
413#define UAC_FORMAT_TYPE_I_IEEE_FLOAT 0x3
414#define UAC_FORMAT_TYPE_I_ALAW 0x4
415#define UAC_FORMAT_TYPE_I_MULAW 0x5
416
417struct uac_format_type_i_continuous_descriptor {
418 __u8 bLength; /* in bytes: 8 + (ns * 3) */
419 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
420 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
421 __u8 bFormatType; /* FORMAT_TYPE_1 */
422 __u8 bNrChannels; /* physical channels in the stream */
423 __u8 bSubframeSize; /* */
424 __u8 bBitResolution;
425 __u8 bSamFreqType;
426 __u8 tLowerSamFreq[3];
427 __u8 tUpperSamFreq[3];
428} __attribute__ ((packed));
429
430#define UAC_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14
431
432struct uac_format_type_i_discrete_descriptor {
433 __u8 bLength; /* in bytes: 8 + (ns * 3) */
434 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
435 __u8 bDescriptorSubtype; /* FORMAT_TYPE */
436 __u8 bFormatType; /* FORMAT_TYPE_1 */
437 __u8 bNrChannels; /* physical channels in the stream */
438 __u8 bSubframeSize; /* */
439 __u8 bBitResolution;
440 __u8 bSamFreqType;
441 __u8 tSamFreq[][3];
442} __attribute__ ((packed));
443
444#define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \
445struct uac_format_type_i_discrete_descriptor_##n { \
446 __u8 bLength; \
447 __u8 bDescriptorType; \
448 __u8 bDescriptorSubtype; \
449 __u8 bFormatType; \
450 __u8 bNrChannels; \
451 __u8 bSubframeSize; \
452 __u8 bBitResolution; \
453 __u8 bSamFreqType; \
454 __u8 tSamFreq[n][3]; \
455} __attribute__ ((packed))
456
457#define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3))
458
459struct uac_format_type_i_ext_descriptor {
460 __u8 bLength;
461 __u8 bDescriptorType;
462 __u8 bDescriptorSubtype;
463 __u8 bFormatType;
464 __u8 bSubslotSize;
465 __u8 bBitResolution;
466 __u8 bHeaderLength;
467 __u8 bControlSize;
468 __u8 bSideBandProtocol;
469} __attribute__((packed));
470
471/* Formats - Audio Data Format Type I Codes */
472
473#define UAC_FORMAT_TYPE_II_MPEG 0x1001
474#define UAC_FORMAT_TYPE_II_AC3 0x1002
475
476struct uac_format_type_ii_discrete_descriptor {
477 __u8 bLength;
478 __u8 bDescriptorType;
479 __u8 bDescriptorSubtype;
480 __u8 bFormatType;
481 __le16 wMaxBitRate;
482 __le16 wSamplesPerFrame;
483 __u8 bSamFreqType;
484 __u8 tSamFreq[][3];
485} __attribute__((packed));
486
487struct uac_format_type_ii_ext_descriptor {
488 __u8 bLength;
489 __u8 bDescriptorType;
490 __u8 bDescriptorSubtype;
491 __u8 bFormatType;
492 __u16 wMaxBitRate;
493 __u16 wSamplesPerFrame;
494 __u8 bHeaderLength;
495 __u8 bSideBandProtocol;
496} __attribute__((packed));
497
498/* type III */
499#define UAC_FORMAT_TYPE_III_IEC1937_AC3 0x2001
500#define UAC_FORMAT_TYPE_III_IEC1937_MPEG1_LAYER1 0x2002
501#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_NOEXT 0x2003
502#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_EXT 0x2004
503#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER1_LS 0x2005
504#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER23_LS 0x2006
505
506/* Formats - A.2 Format Type Codes */
507#define UAC_FORMAT_TYPE_UNDEFINED 0x0
508#define UAC_FORMAT_TYPE_I 0x1
509#define UAC_FORMAT_TYPE_II 0x2
510#define UAC_FORMAT_TYPE_III 0x3
511#define UAC_EXT_FORMAT_TYPE_I 0x81
512#define UAC_EXT_FORMAT_TYPE_II 0x82
513#define UAC_EXT_FORMAT_TYPE_III 0x83
514
515struct uac_iso_endpoint_descriptor {
516 __u8 bLength; /* in bytes: 7 */
517 __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */
518 __u8 bDescriptorSubtype; /* EP_GENERAL */
519 __u8 bmAttributes;
520 __u8 bLockDelayUnits;
521 __le16 wLockDelay;
522} __attribute__((packed));
523#define UAC_ISO_ENDPOINT_DESC_SIZE 7
524
525#define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01
526#define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02
527#define UAC_EP_CS_ATTR_FILL_MAX 0x80
528
529/* status word format (3.7.1.1) */
530
531#define UAC1_STATUS_TYPE_ORIG_MASK 0x0f
532#define UAC1_STATUS_TYPE_ORIG_AUDIO_CONTROL_IF 0x0
533#define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_IF 0x1
534#define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_EP 0x2
535
536#define UAC1_STATUS_TYPE_IRQ_PENDING (1 << 7)
537#define UAC1_STATUS_TYPE_MEM_CHANGED (1 << 6)
538
539struct uac1_status_word {
540 __u8 bStatusType;
541 __u8 bOriginator;
542} __attribute__((packed));
543
544
545#endif /* _UAPI__LINUX_USB_AUDIO_H */
diff --git a/include/linux/usb/cdc.h b/include/uapi/linux/usb/cdc.h
index 81a927930bfd..81a927930bfd 100644
--- a/include/linux/usb/cdc.h
+++ b/include/uapi/linux/usb/cdc.h
diff --git a/include/linux/usb/ch11.h b/include/uapi/linux/usb/ch11.h
index 7692dc69ccf7..7692dc69ccf7 100644
--- a/include/linux/usb/ch11.h
+++ b/include/uapi/linux/usb/ch11.h
diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h
new file mode 100644
index 000000000000..50598472dc41
--- /dev/null
+++ b/include/uapi/linux/usb/ch9.h
@@ -0,0 +1,993 @@
1/*
2 * This file holds USB constants and structures that are needed for
3 * USB device APIs. These are used by the USB device model, which is
4 * defined in chapter 9 of the USB 2.0 specification and in the
5 * Wireless USB 1.0 (spread around). Linux has several APIs in C that
6 * need these:
7 *
8 * - the master/host side Linux-USB kernel driver API;
9 * - the "usbfs" user space API; and
10 * - the Linux "gadget" slave/device/peripheral side driver API.
11 *
12 * USB 2.0 adds an additional "On The Go" (OTG) mode, which lets systems
13 * act either as a USB master/host or as a USB slave/device. That means
14 * the master and slave side APIs benefit from working well together.
15 *
16 * There's also "Wireless USB", using low power short range radios for
17 * peripheral interconnection but otherwise building on the USB framework.
18 *
19 * Note all descriptors are declared '__attribute__((packed))' so that:
20 *
21 * [a] they never get padded, either internally (USB spec writers
22 * probably handled that) or externally;
23 *
24 * [b] so that accessing bigger-than-a-bytes fields will never
25 * generate bus errors on any platform, even when the location of
26 * its descriptor inside a bundle isn't "naturally aligned", and
27 *
28 * [c] for consistency, removing all doubt even when it appears to
29 * someone that the two other points are non-issues for that
30 * particular descriptor type.
31 */
32
33#ifndef _UAPI__LINUX_USB_CH9_H
34#define _UAPI__LINUX_USB_CH9_H
35
36#include <linux/types.h> /* __u8 etc */
37#include <asm/byteorder.h> /* le16_to_cpu */
38
39/*-------------------------------------------------------------------------*/
40
41/* CONTROL REQUEST SUPPORT */
42
43/*
44 * USB directions
45 *
46 * This bit flag is used in endpoint descriptors' bEndpointAddress field.
47 * It's also one of three fields in control requests bRequestType.
48 */
49#define USB_DIR_OUT 0 /* to device */
50#define USB_DIR_IN 0x80 /* to host */
51
52/*
53 * USB types, the second of three bRequestType fields
54 */
55#define USB_TYPE_MASK (0x03 << 5)
56#define USB_TYPE_STANDARD (0x00 << 5)
57#define USB_TYPE_CLASS (0x01 << 5)
58#define USB_TYPE_VENDOR (0x02 << 5)
59#define USB_TYPE_RESERVED (0x03 << 5)
60
61/*
62 * USB recipients, the third of three bRequestType fields
63 */
64#define USB_RECIP_MASK 0x1f
65#define USB_RECIP_DEVICE 0x00
66#define USB_RECIP_INTERFACE 0x01
67#define USB_RECIP_ENDPOINT 0x02
68#define USB_RECIP_OTHER 0x03
69/* From Wireless USB 1.0 */
70#define USB_RECIP_PORT 0x04
71#define USB_RECIP_RPIPE 0x05
72
73/*
74 * Standard requests, for the bRequest field of a SETUP packet.
75 *
76 * These are qualified by the bRequestType field, so that for example
77 * TYPE_CLASS or TYPE_VENDOR specific feature flags could be retrieved
78 * by a GET_STATUS request.
79 */
80#define USB_REQ_GET_STATUS 0x00
81#define USB_REQ_CLEAR_FEATURE 0x01
82#define USB_REQ_SET_FEATURE 0x03
83#define USB_REQ_SET_ADDRESS 0x05
84#define USB_REQ_GET_DESCRIPTOR 0x06
85#define USB_REQ_SET_DESCRIPTOR 0x07
86#define USB_REQ_GET_CONFIGURATION 0x08
87#define USB_REQ_SET_CONFIGURATION 0x09
88#define USB_REQ_GET_INTERFACE 0x0A
89#define USB_REQ_SET_INTERFACE 0x0B
90#define USB_REQ_SYNCH_FRAME 0x0C
91#define USB_REQ_SET_SEL 0x30
92#define USB_REQ_SET_ISOCH_DELAY 0x31
93
94#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
95#define USB_REQ_GET_ENCRYPTION 0x0E
96#define USB_REQ_RPIPE_ABORT 0x0E
97#define USB_REQ_SET_HANDSHAKE 0x0F
98#define USB_REQ_RPIPE_RESET 0x0F
99#define USB_REQ_GET_HANDSHAKE 0x10
100#define USB_REQ_SET_CONNECTION 0x11
101#define USB_REQ_SET_SECURITY_DATA 0x12
102#define USB_REQ_GET_SECURITY_DATA 0x13
103#define USB_REQ_SET_WUSB_DATA 0x14
104#define USB_REQ_LOOPBACK_DATA_WRITE 0x15
105#define USB_REQ_LOOPBACK_DATA_READ 0x16
106#define USB_REQ_SET_INTERFACE_DS 0x17
107
108/* The Link Power Management (LPM) ECN defines USB_REQ_TEST_AND_SET command,
109 * used by hubs to put ports into a new L1 suspend state, except that it
110 * forgot to define its number ...
111 */
112
113/*
114 * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and
115 * are read as a bit array returned by USB_REQ_GET_STATUS. (So there
116 * are at most sixteen features of each type.) Hubs may also support a
117 * new USB_REQ_TEST_AND_SET_FEATURE to put ports into L1 suspend.
118 */
119#define USB_DEVICE_SELF_POWERED 0 /* (read only) */
120#define USB_DEVICE_REMOTE_WAKEUP 1 /* dev may initiate wakeup */
121#define USB_DEVICE_TEST_MODE 2 /* (wired high speed only) */
122#define USB_DEVICE_BATTERY 2 /* (wireless) */
123#define USB_DEVICE_B_HNP_ENABLE 3 /* (otg) dev may initiate HNP */
124#define USB_DEVICE_WUSB_DEVICE 3 /* (wireless)*/
125#define USB_DEVICE_A_HNP_SUPPORT 4 /* (otg) RH port supports HNP */
126#define USB_DEVICE_A_ALT_HNP_SUPPORT 5 /* (otg) other RH port does */
127#define USB_DEVICE_DEBUG_MODE 6 /* (special devices only) */
128
129/*
130 * Test Mode Selectors
131 * See USB 2.0 spec Table 9-7
132 */
133#define TEST_J 1
134#define TEST_K 2
135#define TEST_SE0_NAK 3
136#define TEST_PACKET 4
137#define TEST_FORCE_EN 5
138
139/*
140 * New Feature Selectors as added by USB 3.0
141 * See USB 3.0 spec Table 9-6
142 */
143#define USB_DEVICE_U1_ENABLE 48 /* dev may initiate U1 transition */
144#define USB_DEVICE_U2_ENABLE 49 /* dev may initiate U2 transition */
145#define USB_DEVICE_LTM_ENABLE 50 /* dev may send LTM */
146#define USB_INTRF_FUNC_SUSPEND 0 /* function suspend */
147
148#define USB_INTR_FUNC_SUSPEND_OPT_MASK 0xFF00
149/*
150 * Suspend Options, Table 9-7 USB 3.0 spec
151 */
152#define USB_INTRF_FUNC_SUSPEND_LP (1 << (8 + 0))
153#define USB_INTRF_FUNC_SUSPEND_RW (1 << (8 + 1))
154
155#define USB_ENDPOINT_HALT 0 /* IN/OUT will STALL */
156
157/* Bit array elements as returned by the USB_REQ_GET_STATUS request. */
158#define USB_DEV_STAT_U1_ENABLED 2 /* transition into U1 state */
159#define USB_DEV_STAT_U2_ENABLED 3 /* transition into U2 state */
160#define USB_DEV_STAT_LTM_ENABLED 4 /* Latency tolerance messages */
161
162/**
163 * struct usb_ctrlrequest - SETUP data for a USB device control request
164 * @bRequestType: matches the USB bmRequestType field
165 * @bRequest: matches the USB bRequest field
166 * @wValue: matches the USB wValue field (le16 byte order)
167 * @wIndex: matches the USB wIndex field (le16 byte order)
168 * @wLength: matches the USB wLength field (le16 byte order)
169 *
170 * This structure is used to send control requests to a USB device. It matches
171 * the different fields of the USB 2.0 Spec section 9.3, table 9-2. See the
172 * USB spec for a fuller description of the different fields, and what they are
173 * used for.
174 *
175 * Note that the driver for any interface can issue control requests.
176 * For most devices, interfaces don't coordinate with each other, so
177 * such requests may be made at any time.
178 */
179struct usb_ctrlrequest {
180 __u8 bRequestType;
181 __u8 bRequest;
182 __le16 wValue;
183 __le16 wIndex;
184 __le16 wLength;
185} __attribute__ ((packed));
186
187/*-------------------------------------------------------------------------*/
188
189/*
190 * STANDARD DESCRIPTORS ... as returned by GET_DESCRIPTOR, or
191 * (rarely) accepted by SET_DESCRIPTOR.
192 *
193 * Note that all multi-byte values here are encoded in little endian
194 * byte order "on the wire". Within the kernel and when exposed
195 * through the Linux-USB APIs, they are not converted to cpu byte
196 * order; it is the responsibility of the client code to do this.
197 * The single exception is when device and configuration descriptors (but
198 * not other descriptors) are read from usbfs (i.e. /proc/bus/usb/BBB/DDD);
199 * in this case the fields are converted to host endianness by the kernel.
200 */
201
202/*
203 * Descriptor types ... USB 2.0 spec table 9.5
204 */
205#define USB_DT_DEVICE 0x01
206#define USB_DT_CONFIG 0x02
207#define USB_DT_STRING 0x03
208#define USB_DT_INTERFACE 0x04
209#define USB_DT_ENDPOINT 0x05
210#define USB_DT_DEVICE_QUALIFIER 0x06
211#define USB_DT_OTHER_SPEED_CONFIG 0x07
212#define USB_DT_INTERFACE_POWER 0x08
213/* these are from a minor usb 2.0 revision (ECN) */
214#define USB_DT_OTG 0x09
215#define USB_DT_DEBUG 0x0a
216#define USB_DT_INTERFACE_ASSOCIATION 0x0b
217/* these are from the Wireless USB spec */
218#define USB_DT_SECURITY 0x0c
219#define USB_DT_KEY 0x0d
220#define USB_DT_ENCRYPTION_TYPE 0x0e
221#define USB_DT_BOS 0x0f
222#define USB_DT_DEVICE_CAPABILITY 0x10
223#define USB_DT_WIRELESS_ENDPOINT_COMP 0x11
224#define USB_DT_WIRE_ADAPTER 0x21
225#define USB_DT_RPIPE 0x22
226#define USB_DT_CS_RADIO_CONTROL 0x23
227/* From the T10 UAS specification */
228#define USB_DT_PIPE_USAGE 0x24
229/* From the USB 3.0 spec */
230#define USB_DT_SS_ENDPOINT_COMP 0x30
231
232/* Conventional codes for class-specific descriptors. The convention is
233 * defined in the USB "Common Class" Spec (3.11). Individual class specs
234 * are authoritative for their usage, not the "common class" writeup.
235 */
236#define USB_DT_CS_DEVICE (USB_TYPE_CLASS | USB_DT_DEVICE)
237#define USB_DT_CS_CONFIG (USB_TYPE_CLASS | USB_DT_CONFIG)
238#define USB_DT_CS_STRING (USB_TYPE_CLASS | USB_DT_STRING)
239#define USB_DT_CS_INTERFACE (USB_TYPE_CLASS | USB_DT_INTERFACE)
240#define USB_DT_CS_ENDPOINT (USB_TYPE_CLASS | USB_DT_ENDPOINT)
241
242/* All standard descriptors have these 2 fields at the beginning */
243struct usb_descriptor_header {
244 __u8 bLength;
245 __u8 bDescriptorType;
246} __attribute__ ((packed));
247
248
249/*-------------------------------------------------------------------------*/
250
251/* USB_DT_DEVICE: Device descriptor */
252struct usb_device_descriptor {
253 __u8 bLength;
254 __u8 bDescriptorType;
255
256 __le16 bcdUSB;
257 __u8 bDeviceClass;
258 __u8 bDeviceSubClass;
259 __u8 bDeviceProtocol;
260 __u8 bMaxPacketSize0;
261 __le16 idVendor;
262 __le16 idProduct;
263 __le16 bcdDevice;
264 __u8 iManufacturer;
265 __u8 iProduct;
266 __u8 iSerialNumber;
267 __u8 bNumConfigurations;
268} __attribute__ ((packed));
269
270#define USB_DT_DEVICE_SIZE 18
271
272
273/*
274 * Device and/or Interface Class codes
275 * as found in bDeviceClass or bInterfaceClass
276 * and defined by www.usb.org documents
277 */
278#define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */
279#define USB_CLASS_AUDIO 1
280#define USB_CLASS_COMM 2
281#define USB_CLASS_HID 3
282#define USB_CLASS_PHYSICAL 5
283#define USB_CLASS_STILL_IMAGE 6
284#define USB_CLASS_PRINTER 7
285#define USB_CLASS_MASS_STORAGE 8
286#define USB_CLASS_HUB 9
287#define USB_CLASS_CDC_DATA 0x0a
288#define USB_CLASS_CSCID 0x0b /* chip+ smart card */
289#define USB_CLASS_CONTENT_SEC 0x0d /* content security */
290#define USB_CLASS_VIDEO 0x0e
291#define USB_CLASS_WIRELESS_CONTROLLER 0xe0
292#define USB_CLASS_MISC 0xef
293#define USB_CLASS_APP_SPEC 0xfe
294#define USB_CLASS_VENDOR_SPEC 0xff
295
296#define USB_SUBCLASS_VENDOR_SPEC 0xff
297
298/*-------------------------------------------------------------------------*/
299
300/* USB_DT_CONFIG: Configuration descriptor information.
301 *
302 * USB_DT_OTHER_SPEED_CONFIG is the same descriptor, except that the
303 * descriptor type is different. Highspeed-capable devices can look
304 * different depending on what speed they're currently running. Only
305 * devices with a USB_DT_DEVICE_QUALIFIER have any OTHER_SPEED_CONFIG
306 * descriptors.
307 */
308struct usb_config_descriptor {
309 __u8 bLength;
310 __u8 bDescriptorType;
311
312 __le16 wTotalLength;
313 __u8 bNumInterfaces;
314 __u8 bConfigurationValue;
315 __u8 iConfiguration;
316 __u8 bmAttributes;
317 __u8 bMaxPower;
318} __attribute__ ((packed));
319
320#define USB_DT_CONFIG_SIZE 9
321
322/* from config descriptor bmAttributes */
323#define USB_CONFIG_ATT_ONE (1 << 7) /* must be set */
324#define USB_CONFIG_ATT_SELFPOWER (1 << 6) /* self powered */
325#define USB_CONFIG_ATT_WAKEUP (1 << 5) /* can wakeup */
326#define USB_CONFIG_ATT_BATTERY (1 << 4) /* battery powered */
327
328/*-------------------------------------------------------------------------*/
329
330/* USB_DT_STRING: String descriptor */
331struct usb_string_descriptor {
332 __u8 bLength;
333 __u8 bDescriptorType;
334
335 __le16 wData[1]; /* UTF-16LE encoded */
336} __attribute__ ((packed));
337
338/* note that "string" zero is special, it holds language codes that
339 * the device supports, not Unicode characters.
340 */
341
342/*-------------------------------------------------------------------------*/
343
344/* USB_DT_INTERFACE: Interface descriptor */
345struct usb_interface_descriptor {
346 __u8 bLength;
347 __u8 bDescriptorType;
348
349 __u8 bInterfaceNumber;
350 __u8 bAlternateSetting;
351 __u8 bNumEndpoints;
352 __u8 bInterfaceClass;
353 __u8 bInterfaceSubClass;
354 __u8 bInterfaceProtocol;
355 __u8 iInterface;
356} __attribute__ ((packed));
357
358#define USB_DT_INTERFACE_SIZE 9
359
360/*-------------------------------------------------------------------------*/
361
362/* USB_DT_ENDPOINT: Endpoint descriptor */
363struct usb_endpoint_descriptor {
364 __u8 bLength;
365 __u8 bDescriptorType;
366
367 __u8 bEndpointAddress;
368 __u8 bmAttributes;
369 __le16 wMaxPacketSize;
370 __u8 bInterval;
371
372 /* NOTE: these two are _only_ in audio endpoints. */
373 /* use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof. */
374 __u8 bRefresh;
375 __u8 bSynchAddress;
376} __attribute__ ((packed));
377
378#define USB_DT_ENDPOINT_SIZE 7
379#define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */
380
381
382/*
383 * Endpoints
384 */
385#define USB_ENDPOINT_NUMBER_MASK 0x0f /* in bEndpointAddress */
386#define USB_ENDPOINT_DIR_MASK 0x80
387
388#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */
389#define USB_ENDPOINT_XFER_CONTROL 0
390#define USB_ENDPOINT_XFER_ISOC 1
391#define USB_ENDPOINT_XFER_BULK 2
392#define USB_ENDPOINT_XFER_INT 3
393#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
394
395/* The USB 3.0 spec redefines bits 5:4 of bmAttributes as interrupt ep type. */
396#define USB_ENDPOINT_INTRTYPE 0x30
397#define USB_ENDPOINT_INTR_PERIODIC (0 << 4)
398#define USB_ENDPOINT_INTR_NOTIFICATION (1 << 4)
399
400#define USB_ENDPOINT_SYNCTYPE 0x0c
401#define USB_ENDPOINT_SYNC_NONE (0 << 2)
402#define USB_ENDPOINT_SYNC_ASYNC (1 << 2)
403#define USB_ENDPOINT_SYNC_ADAPTIVE (2 << 2)
404#define USB_ENDPOINT_SYNC_SYNC (3 << 2)
405
406#define USB_ENDPOINT_USAGE_MASK 0x30
407#define USB_ENDPOINT_USAGE_DATA 0x00
408#define USB_ENDPOINT_USAGE_FEEDBACK 0x10
409#define USB_ENDPOINT_USAGE_IMPLICIT_FB 0x20 /* Implicit feedback Data endpoint */
410
411/*-------------------------------------------------------------------------*/
412
413/**
414 * usb_endpoint_num - get the endpoint's number
415 * @epd: endpoint to be checked
416 *
417 * Returns @epd's number: 0 to 15.
418 */
419static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
420{
421 return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
422}
423
424/**
425 * usb_endpoint_type - get the endpoint's transfer type
426 * @epd: endpoint to be checked
427 *
428 * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according
429 * to @epd's transfer type.
430 */
431static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
432{
433 return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
434}
435
436/**
437 * usb_endpoint_dir_in - check if the endpoint has IN direction
438 * @epd: endpoint to be checked
439 *
440 * Returns true if the endpoint is of type IN, otherwise it returns false.
441 */
442static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
443{
444 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
445}
446
447/**
448 * usb_endpoint_dir_out - check if the endpoint has OUT direction
449 * @epd: endpoint to be checked
450 *
451 * Returns true if the endpoint is of type OUT, otherwise it returns false.
452 */
453static inline int usb_endpoint_dir_out(
454 const struct usb_endpoint_descriptor *epd)
455{
456 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
457}
458
459/**
460 * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type
461 * @epd: endpoint to be checked
462 *
463 * Returns true if the endpoint is of type bulk, otherwise it returns false.
464 */
465static inline int usb_endpoint_xfer_bulk(
466 const struct usb_endpoint_descriptor *epd)
467{
468 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
469 USB_ENDPOINT_XFER_BULK);
470}
471
472/**
473 * usb_endpoint_xfer_control - check if the endpoint has control transfer type
474 * @epd: endpoint to be checked
475 *
476 * Returns true if the endpoint is of type control, otherwise it returns false.
477 */
478static inline int usb_endpoint_xfer_control(
479 const struct usb_endpoint_descriptor *epd)
480{
481 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
482 USB_ENDPOINT_XFER_CONTROL);
483}
484
485/**
486 * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
487 * @epd: endpoint to be checked
488 *
489 * Returns true if the endpoint is of type interrupt, otherwise it returns
490 * false.
491 */
492static inline int usb_endpoint_xfer_int(
493 const struct usb_endpoint_descriptor *epd)
494{
495 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
496 USB_ENDPOINT_XFER_INT);
497}
498
499/**
500 * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type
501 * @epd: endpoint to be checked
502 *
503 * Returns true if the endpoint is of type isochronous, otherwise it returns
504 * false.
505 */
506static inline int usb_endpoint_xfer_isoc(
507 const struct usb_endpoint_descriptor *epd)
508{
509 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
510 USB_ENDPOINT_XFER_ISOC);
511}
512
513/**
514 * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN
515 * @epd: endpoint to be checked
516 *
517 * Returns true if the endpoint has bulk transfer type and IN direction,
518 * otherwise it returns false.
519 */
520static inline int usb_endpoint_is_bulk_in(
521 const struct usb_endpoint_descriptor *epd)
522{
523 return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd);
524}
525
526/**
527 * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT
528 * @epd: endpoint to be checked
529 *
530 * Returns true if the endpoint has bulk transfer type and OUT direction,
531 * otherwise it returns false.
532 */
533static inline int usb_endpoint_is_bulk_out(
534 const struct usb_endpoint_descriptor *epd)
535{
536 return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd);
537}
538
539/**
540 * usb_endpoint_is_int_in - check if the endpoint is interrupt IN
541 * @epd: endpoint to be checked
542 *
543 * Returns true if the endpoint has interrupt transfer type and IN direction,
544 * otherwise it returns false.
545 */
546static inline int usb_endpoint_is_int_in(
547 const struct usb_endpoint_descriptor *epd)
548{
549 return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd);
550}
551
552/**
553 * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT
554 * @epd: endpoint to be checked
555 *
556 * Returns true if the endpoint has interrupt transfer type and OUT direction,
557 * otherwise it returns false.
558 */
559static inline int usb_endpoint_is_int_out(
560 const struct usb_endpoint_descriptor *epd)
561{
562 return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd);
563}
564
565/**
566 * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN
567 * @epd: endpoint to be checked
568 *
569 * Returns true if the endpoint has isochronous transfer type and IN direction,
570 * otherwise it returns false.
571 */
572static inline int usb_endpoint_is_isoc_in(
573 const struct usb_endpoint_descriptor *epd)
574{
575 return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd);
576}
577
578/**
579 * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT
580 * @epd: endpoint to be checked
581 *
582 * Returns true if the endpoint has isochronous transfer type and OUT direction,
583 * otherwise it returns false.
584 */
585static inline int usb_endpoint_is_isoc_out(
586 const struct usb_endpoint_descriptor *epd)
587{
588 return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd);
589}
590
591/**
592 * usb_endpoint_maxp - get endpoint's max packet size
593 * @epd: endpoint to be checked
594 *
595 * Returns @epd's max packet
596 */
597static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd)
598{
599 return __le16_to_cpu(epd->wMaxPacketSize);
600}
601
602static inline int usb_endpoint_interrupt_type(
603 const struct usb_endpoint_descriptor *epd)
604{
605 return epd->bmAttributes & USB_ENDPOINT_INTRTYPE;
606}
607
608/*-------------------------------------------------------------------------*/
609
610/* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */
611struct usb_ss_ep_comp_descriptor {
612 __u8 bLength;
613 __u8 bDescriptorType;
614
615 __u8 bMaxBurst;
616 __u8 bmAttributes;
617 __le16 wBytesPerInterval;
618} __attribute__ ((packed));
619
620#define USB_DT_SS_EP_COMP_SIZE 6
621
622/* Bits 4:0 of bmAttributes if this is a bulk endpoint */
623static inline int
624usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp)
625{
626 int max_streams;
627
628 if (!comp)
629 return 0;
630
631 max_streams = comp->bmAttributes & 0x1f;
632
633 if (!max_streams)
634 return 0;
635
636 max_streams = 1 << max_streams;
637
638 return max_streams;
639}
640
641/* Bits 1:0 of bmAttributes if this is an isoc endpoint */
642#define USB_SS_MULT(p) (1 + ((p) & 0x3))
643
644/*-------------------------------------------------------------------------*/
645
646/* USB_DT_DEVICE_QUALIFIER: Device Qualifier descriptor */
647struct usb_qualifier_descriptor {
648 __u8 bLength;
649 __u8 bDescriptorType;
650
651 __le16 bcdUSB;
652 __u8 bDeviceClass;
653 __u8 bDeviceSubClass;
654 __u8 bDeviceProtocol;
655 __u8 bMaxPacketSize0;
656 __u8 bNumConfigurations;
657 __u8 bRESERVED;
658} __attribute__ ((packed));
659
660
661/*-------------------------------------------------------------------------*/
662
663/* USB_DT_OTG (from OTG 1.0a supplement) */
664struct usb_otg_descriptor {
665 __u8 bLength;
666 __u8 bDescriptorType;
667
668 __u8 bmAttributes; /* support for HNP, SRP, etc */
669} __attribute__ ((packed));
670
671/* from usb_otg_descriptor.bmAttributes */
672#define USB_OTG_SRP (1 << 0)
673#define USB_OTG_HNP (1 << 1) /* swap host/device roles */
674
675/*-------------------------------------------------------------------------*/
676
677/* USB_DT_DEBUG: for special highspeed devices, replacing serial console */
678struct usb_debug_descriptor {
679 __u8 bLength;
680 __u8 bDescriptorType;
681
682 /* bulk endpoints with 8 byte maxpacket */
683 __u8 bDebugInEndpoint;
684 __u8 bDebugOutEndpoint;
685} __attribute__((packed));
686
687/*-------------------------------------------------------------------------*/
688
689/* USB_DT_INTERFACE_ASSOCIATION: groups interfaces */
690struct usb_interface_assoc_descriptor {
691 __u8 bLength;
692 __u8 bDescriptorType;
693
694 __u8 bFirstInterface;
695 __u8 bInterfaceCount;
696 __u8 bFunctionClass;
697 __u8 bFunctionSubClass;
698 __u8 bFunctionProtocol;
699 __u8 iFunction;
700} __attribute__ ((packed));
701
702
703/*-------------------------------------------------------------------------*/
704
705/* USB_DT_SECURITY: group of wireless security descriptors, including
706 * encryption types available for setting up a CC/association.
707 */
708struct usb_security_descriptor {
709 __u8 bLength;
710 __u8 bDescriptorType;
711
712 __le16 wTotalLength;
713 __u8 bNumEncryptionTypes;
714} __attribute__((packed));
715
716/*-------------------------------------------------------------------------*/
717
718/* USB_DT_KEY: used with {GET,SET}_SECURITY_DATA; only public keys
719 * may be retrieved.
720 */
721struct usb_key_descriptor {
722 __u8 bLength;
723 __u8 bDescriptorType;
724
725 __u8 tTKID[3];
726 __u8 bReserved;
727 __u8 bKeyData[0];
728} __attribute__((packed));
729
730/*-------------------------------------------------------------------------*/
731
732/* USB_DT_ENCRYPTION_TYPE: bundled in DT_SECURITY groups */
733struct usb_encryption_descriptor {
734 __u8 bLength;
735 __u8 bDescriptorType;
736
737 __u8 bEncryptionType;
738#define USB_ENC_TYPE_UNSECURE 0
739#define USB_ENC_TYPE_WIRED 1 /* non-wireless mode */
740#define USB_ENC_TYPE_CCM_1 2 /* aes128/cbc session */
741#define USB_ENC_TYPE_RSA_1 3 /* rsa3072/sha1 auth */
742 __u8 bEncryptionValue; /* use in SET_ENCRYPTION */
743 __u8 bAuthKeyIndex;
744} __attribute__((packed));
745
746
747/*-------------------------------------------------------------------------*/
748
749/* USB_DT_BOS: group of device-level capabilities */
750struct usb_bos_descriptor {
751 __u8 bLength;
752 __u8 bDescriptorType;
753
754 __le16 wTotalLength;
755 __u8 bNumDeviceCaps;
756} __attribute__((packed));
757
758#define USB_DT_BOS_SIZE 5
759/*-------------------------------------------------------------------------*/
760
761/* USB_DT_DEVICE_CAPABILITY: grouped with BOS */
762struct usb_dev_cap_header {
763 __u8 bLength;
764 __u8 bDescriptorType;
765 __u8 bDevCapabilityType;
766} __attribute__((packed));
767
768#define USB_CAP_TYPE_WIRELESS_USB 1
769
770struct usb_wireless_cap_descriptor { /* Ultra Wide Band */
771 __u8 bLength;
772 __u8 bDescriptorType;
773 __u8 bDevCapabilityType;
774
775 __u8 bmAttributes;
776#define USB_WIRELESS_P2P_DRD (1 << 1)
777#define USB_WIRELESS_BEACON_MASK (3 << 2)
778#define USB_WIRELESS_BEACON_SELF (1 << 2)
779#define USB_WIRELESS_BEACON_DIRECTED (2 << 2)
780#define USB_WIRELESS_BEACON_NONE (3 << 2)
781 __le16 wPHYRates; /* bit rates, Mbps */
782#define USB_WIRELESS_PHY_53 (1 << 0) /* always set */
783#define USB_WIRELESS_PHY_80 (1 << 1)
784#define USB_WIRELESS_PHY_107 (1 << 2) /* always set */
785#define USB_WIRELESS_PHY_160 (1 << 3)
786#define USB_WIRELESS_PHY_200 (1 << 4) /* always set */
787#define USB_WIRELESS_PHY_320 (1 << 5)
788#define USB_WIRELESS_PHY_400 (1 << 6)
789#define USB_WIRELESS_PHY_480 (1 << 7)
790 __u8 bmTFITXPowerInfo; /* TFI power levels */
791 __u8 bmFFITXPowerInfo; /* FFI power levels */
792 __le16 bmBandGroup;
793 __u8 bReserved;
794} __attribute__((packed));
795
796/* USB 2.0 Extension descriptor */
797#define USB_CAP_TYPE_EXT 2
798
799struct usb_ext_cap_descriptor { /* Link Power Management */
800 __u8 bLength;
801 __u8 bDescriptorType;
802 __u8 bDevCapabilityType;
803 __le32 bmAttributes;
804#define USB_LPM_SUPPORT (1 << 1) /* supports LPM */
805#define USB_BESL_SUPPORT (1 << 2) /* supports BESL */
806#define USB_BESL_BASELINE_VALID (1 << 3) /* Baseline BESL valid*/
807#define USB_BESL_DEEP_VALID (1 << 4) /* Deep BESL valid */
808#define USB_GET_BESL_BASELINE(p) (((p) & (0xf << 8)) >> 8)
809#define USB_GET_BESL_DEEP(p) (((p) & (0xf << 12)) >> 12)
810} __attribute__((packed));
811
812#define USB_DT_USB_EXT_CAP_SIZE 7
813
814/*
815 * SuperSpeed USB Capability descriptor: Defines the set of SuperSpeed USB
816 * specific device level capabilities
817 */
818#define USB_SS_CAP_TYPE 3
819struct usb_ss_cap_descriptor { /* Link Power Management */
820 __u8 bLength;
821 __u8 bDescriptorType;
822 __u8 bDevCapabilityType;
823 __u8 bmAttributes;
824#define USB_LTM_SUPPORT (1 << 1) /* supports LTM */
825 __le16 wSpeedSupported;
826#define USB_LOW_SPEED_OPERATION (1) /* Low speed operation */
827#define USB_FULL_SPEED_OPERATION (1 << 1) /* Full speed operation */
828#define USB_HIGH_SPEED_OPERATION (1 << 2) /* High speed operation */
829#define USB_5GBPS_OPERATION (1 << 3) /* Operation at 5Gbps */
830 __u8 bFunctionalitySupport;
831 __u8 bU1devExitLat;
832 __le16 bU2DevExitLat;
833} __attribute__((packed));
834
835#define USB_DT_USB_SS_CAP_SIZE 10
836
837/*
838 * Container ID Capability descriptor: Defines the instance unique ID used to
839 * identify the instance across all operating modes
840 */
841#define CONTAINER_ID_TYPE 4
842struct usb_ss_container_id_descriptor {
843 __u8 bLength;
844 __u8 bDescriptorType;
845 __u8 bDevCapabilityType;
846 __u8 bReserved;
847 __u8 ContainerID[16]; /* 128-bit number */
848} __attribute__((packed));
849
850#define USB_DT_USB_SS_CONTN_ID_SIZE 20
851/*-------------------------------------------------------------------------*/
852
853/* USB_DT_WIRELESS_ENDPOINT_COMP: companion descriptor associated with
854 * each endpoint descriptor for a wireless device
855 */
856struct usb_wireless_ep_comp_descriptor {
857 __u8 bLength;
858 __u8 bDescriptorType;
859
860 __u8 bMaxBurst;
861 __u8 bMaxSequence;
862 __le16 wMaxStreamDelay;
863 __le16 wOverTheAirPacketSize;
864 __u8 bOverTheAirInterval;
865 __u8 bmCompAttributes;
866#define USB_ENDPOINT_SWITCH_MASK 0x03 /* in bmCompAttributes */
867#define USB_ENDPOINT_SWITCH_NO 0
868#define USB_ENDPOINT_SWITCH_SWITCH 1
869#define USB_ENDPOINT_SWITCH_SCALE 2
870} __attribute__((packed));
871
872/*-------------------------------------------------------------------------*/
873
874/* USB_REQ_SET_HANDSHAKE is a four-way handshake used between a wireless
875 * host and a device for connection set up, mutual authentication, and
876 * exchanging short lived session keys. The handshake depends on a CC.
877 */
878struct usb_handshake {
879 __u8 bMessageNumber;
880 __u8 bStatus;
881 __u8 tTKID[3];
882 __u8 bReserved;
883 __u8 CDID[16];
884 __u8 nonce[16];
885 __u8 MIC[8];
886} __attribute__((packed));
887
888/*-------------------------------------------------------------------------*/
889
890/* USB_REQ_SET_CONNECTION modifies or revokes a connection context (CC).
891 * A CC may also be set up using non-wireless secure channels (including
892 * wired USB!), and some devices may support CCs with multiple hosts.
893 */
894struct usb_connection_context {
895 __u8 CHID[16]; /* persistent host id */
896 __u8 CDID[16]; /* device id (unique w/in host context) */
897 __u8 CK[16]; /* connection key */
898} __attribute__((packed));
899
900/*-------------------------------------------------------------------------*/
901
902/* USB 2.0 defines three speeds, here's how Linux identifies them */
903
904enum usb_device_speed {
905 USB_SPEED_UNKNOWN = 0, /* enumerating */
906 USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */
907 USB_SPEED_HIGH, /* usb 2.0 */
908 USB_SPEED_WIRELESS, /* wireless (usb 2.5) */
909 USB_SPEED_SUPER, /* usb 3.0 */
910};
911
912
913enum usb_device_state {
914 /* NOTATTACHED isn't in the USB spec, and this state acts
915 * the same as ATTACHED ... but it's clearer this way.
916 */
917 USB_STATE_NOTATTACHED = 0,
918
919 /* chapter 9 and authentication (wireless) device states */
920 USB_STATE_ATTACHED,
921 USB_STATE_POWERED, /* wired */
922 USB_STATE_RECONNECTING, /* auth */
923 USB_STATE_UNAUTHENTICATED, /* auth */
924 USB_STATE_DEFAULT, /* limited function */
925 USB_STATE_ADDRESS,
926 USB_STATE_CONFIGURED, /* most functions */
927
928 USB_STATE_SUSPENDED
929
930 /* NOTE: there are actually four different SUSPENDED
931 * states, returning to POWERED, DEFAULT, ADDRESS, or
932 * CONFIGURED respectively when SOF tokens flow again.
933 * At this level there's no difference between L1 and L2
934 * suspend states. (L2 being original USB 1.1 suspend.)
935 */
936};
937
938enum usb3_link_state {
939 USB3_LPM_U0 = 0,
940 USB3_LPM_U1,
941 USB3_LPM_U2,
942 USB3_LPM_U3
943};
944
945/*
946 * A U1 timeout of 0x0 means the parent hub will reject any transitions to U1.
947 * 0xff means the parent hub will accept transitions to U1, but will not
948 * initiate a transition.
949 *
950 * A U1 timeout of 0x1 to 0x7F also causes the hub to initiate a transition to
951 * U1 after that many microseconds. Timeouts of 0x80 to 0xFE are reserved
952 * values.
953 *
954 * A U2 timeout of 0x0 means the parent hub will reject any transitions to U2.
955 * 0xff means the parent hub will accept transitions to U2, but will not
956 * initiate a transition.
957 *
958 * A U2 timeout of 0x1 to 0xFE also causes the hub to initiate a transition to
959 * U2 after N*256 microseconds. Therefore a U2 timeout value of 0x1 means a U2
960 * idle timer of 256 microseconds, 0x2 means 512 microseconds, 0xFE means
961 * 65.024ms.
962 */
963#define USB3_LPM_DISABLED 0x0
964#define USB3_LPM_U1_MAX_TIMEOUT 0x7F
965#define USB3_LPM_U2_MAX_TIMEOUT 0xFE
966#define USB3_LPM_DEVICE_INITIATED 0xFF
967
968struct usb_set_sel_req {
969 __u8 u1_sel;
970 __u8 u1_pel;
971 __le16 u2_sel;
972 __le16 u2_pel;
973} __attribute__ ((packed));
974
975/*
976 * The Set System Exit Latency control transfer provides one byte each for
977 * U1 SEL and U1 PEL, so the max exit latency is 0xFF. U2 SEL and U2 PEL each
978 * are two bytes long.
979 */
980#define USB3_LPM_MAX_U1_SEL_PEL 0xFF
981#define USB3_LPM_MAX_U2_SEL_PEL 0xFFFF
982
983/*-------------------------------------------------------------------------*/
984
985/*
986 * As per USB compliance update, a device that is actively drawing
987 * more than 100mA from USB must report itself as bus-powered in
988 * the GetStatus(DEVICE) call.
989 * http://compliance.usb.org/index.asp?UpdateFile=Electrical&Format=Standard#34
990 */
991#define USB_SELF_POWER_VBUS_MAX_DRAW 100
992
993#endif /* _UAPI__LINUX_USB_CH9_H */
diff --git a/include/uapi/linux/usb/functionfs.h b/include/uapi/linux/usb/functionfs.h
new file mode 100644
index 000000000000..d6b01283f85c
--- /dev/null
+++ b/include/uapi/linux/usb/functionfs.h
@@ -0,0 +1,169 @@
1#ifndef _UAPI__LINUX_FUNCTIONFS_H__
2#define _UAPI__LINUX_FUNCTIONFS_H__
3
4
5#include <linux/types.h>
6#include <linux/ioctl.h>
7
8#include <linux/usb/ch9.h>
9
10
11enum {
12 FUNCTIONFS_DESCRIPTORS_MAGIC = 1,
13 FUNCTIONFS_STRINGS_MAGIC = 2
14};
15
16
17#ifndef __KERNEL__
18
19/* Descriptor of an non-audio endpoint */
20struct usb_endpoint_descriptor_no_audio {
21 __u8 bLength;
22 __u8 bDescriptorType;
23
24 __u8 bEndpointAddress;
25 __u8 bmAttributes;
26 __le16 wMaxPacketSize;
27 __u8 bInterval;
28} __attribute__((packed));
29
30
31/*
32 * All numbers must be in little endian order.
33 */
34
35struct usb_functionfs_descs_head {
36 __le32 magic;
37 __le32 length;
38 __le32 fs_count;
39 __le32 hs_count;
40} __attribute__((packed));
41
42/*
43 * Descriptors format:
44 *
45 * | off | name | type | description |
46 * |-----+-----------+--------------+--------------------------------------|
47 * | 0 | magic | LE32 | FUNCTIONFS_{FS,HS}_DESCRIPTORS_MAGIC |
48 * | 4 | length | LE32 | length of the whole data chunk |
49 * | 8 | fs_count | LE32 | number of full-speed descriptors |
50 * | 12 | hs_count | LE32 | number of high-speed descriptors |
51 * | 16 | fs_descrs | Descriptor[] | list of full-speed descriptors |
52 * | | hs_descrs | Descriptor[] | list of high-speed descriptors |
53 *
54 * descs are just valid USB descriptors and have the following format:
55 *
56 * | off | name | type | description |
57 * |-----+-----------------+------+--------------------------|
58 * | 0 | bLength | U8 | length of the descriptor |
59 * | 1 | bDescriptorType | U8 | descriptor type |
60 * | 2 | payload | | descriptor's payload |
61 */
62
63struct usb_functionfs_strings_head {
64 __le32 magic;
65 __le32 length;
66 __le32 str_count;
67 __le32 lang_count;
68} __attribute__((packed));
69
70/*
71 * Strings format:
72 *
73 * | off | name | type | description |
74 * |-----+------------+-----------------------+----------------------------|
75 * | 0 | magic | LE32 | FUNCTIONFS_STRINGS_MAGIC |
76 * | 4 | length | LE32 | length of the data chunk |
77 * | 8 | str_count | LE32 | number of strings |
78 * | 12 | lang_count | LE32 | number of languages |
79 * | 16 | stringtab | StringTab[lang_count] | table of strings per lang |
80 *
81 * For each language there is one stringtab entry (ie. there are lang_count
82 * stringtab entires). Each StringTab has following format:
83 *
84 * | off | name | type | description |
85 * |-----+---------+-------------------+------------------------------------|
86 * | 0 | lang | LE16 | language code |
87 * | 2 | strings | String[str_count] | array of strings in given language |
88 *
89 * For each string there is one strings entry (ie. there are str_count
90 * string entries). Each String is a NUL terminated string encoded in
91 * UTF-8.
92 */
93
94#endif
95
96
97/*
98 * Events are delivered on the ep0 file descriptor, when the user mode driver
99 * reads from this file descriptor after writing the descriptors. Don't
100 * stop polling this descriptor.
101 */
102
103enum usb_functionfs_event_type {
104 FUNCTIONFS_BIND,
105 FUNCTIONFS_UNBIND,
106
107 FUNCTIONFS_ENABLE,
108 FUNCTIONFS_DISABLE,
109
110 FUNCTIONFS_SETUP,
111
112 FUNCTIONFS_SUSPEND,
113 FUNCTIONFS_RESUME
114};
115
116/* NOTE: this structure must stay the same size and layout on
117 * both 32-bit and 64-bit kernels.
118 */
119struct usb_functionfs_event {
120 union {
121 /* SETUP: packet; DATA phase i/o precedes next event
122 *(setup.bmRequestType & USB_DIR_IN) flags direction */
123 struct usb_ctrlrequest setup;
124 } __attribute__((packed)) u;
125
126 /* enum usb_functionfs_event_type */
127 __u8 type;
128 __u8 _pad[3];
129} __attribute__((packed));
130
131
132/* Endpoint ioctls */
133/* The same as in gadgetfs */
134
135/* IN transfers may be reported to the gadget driver as complete
136 * when the fifo is loaded, before the host reads the data;
137 * OUT transfers may be reported to the host's "client" driver as
138 * complete when they're sitting in the FIFO unread.
139 * THIS returns how many bytes are "unclaimed" in the endpoint fifo
140 * (needed for precise fault handling, when the hardware allows it)
141 */
142#define FUNCTIONFS_FIFO_STATUS _IO('g', 1)
143
144/* discards any unclaimed data in the fifo. */
145#define FUNCTIONFS_FIFO_FLUSH _IO('g', 2)
146
147/* resets endpoint halt+toggle; used to implement set_interface.
148 * some hardware (like pxa2xx) can't support this.
149 */
150#define FUNCTIONFS_CLEAR_HALT _IO('g', 3)
151
152/* Specific for functionfs */
153
154/*
155 * Returns reverse mapping of an interface. Called on EP0. If there
156 * is no such interface returns -EDOM. If function is not active
157 * returns -ENODEV.
158 */
159#define FUNCTIONFS_INTERFACE_REVMAP _IO('g', 128)
160
161/*
162 * Returns real bEndpointAddress of an endpoint. If function is not
163 * active returns -ENODEV.
164 */
165#define FUNCTIONFS_ENDPOINT_REVMAP _IO('g', 129)
166
167
168
169#endif /* _UAPI__LINUX_FUNCTIONFS_H__ */
diff --git a/include/linux/usb/g_printer.h b/include/uapi/linux/usb/g_printer.h
index 6178fde50f74..6178fde50f74 100644
--- a/include/linux/usb/g_printer.h
+++ b/include/uapi/linux/usb/g_printer.h
diff --git a/include/linux/usb/gadgetfs.h b/include/uapi/linux/usb/gadgetfs.h
index 0bb12e0d4f8f..0bb12e0d4f8f 100644
--- a/include/linux/usb/gadgetfs.h
+++ b/include/uapi/linux/usb/gadgetfs.h
diff --git a/include/linux/usb/midi.h b/include/uapi/linux/usb/midi.h
index c8c52e3c91de..c8c52e3c91de 100644
--- a/include/linux/usb/midi.h
+++ b/include/uapi/linux/usb/midi.h
diff --git a/include/linux/usb/tmc.h b/include/uapi/linux/usb/tmc.h
index c045ae12556c..c045ae12556c 100644
--- a/include/linux/usb/tmc.h
+++ b/include/uapi/linux/usb/tmc.h
diff --git a/include/linux/usb/video.h b/include/uapi/linux/usb/video.h
index 3b3b95e01f71..3b3b95e01f71 100644
--- a/include/linux/usb/video.h
+++ b/include/uapi/linux/usb/video.h
diff --git a/include/uapi/linux/usbdevice_fs.h b/include/uapi/linux/usbdevice_fs.h
new file mode 100644
index 000000000000..0c65e4b12617
--- /dev/null
+++ b/include/uapi/linux/usbdevice_fs.h
@@ -0,0 +1,180 @@
1/*****************************************************************************/
2
3/*
4 * usbdevice_fs.h -- USB device file system.
5 *
6 * Copyright (C) 2000
7 * Thomas Sailer (sailer@ife.ee.ethz.ch)
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 * History:
24 * 0.1 04.01.2000 Created
25 */
26
27/*****************************************************************************/
28
29#ifndef _UAPI_LINUX_USBDEVICE_FS_H
30#define _UAPI_LINUX_USBDEVICE_FS_H
31
32#include <linux/types.h>
33#include <linux/magic.h>
34
35/* --------------------------------------------------------------------- */
36
37/* usbdevfs ioctl codes */
38
39struct usbdevfs_ctrltransfer {
40 __u8 bRequestType;
41 __u8 bRequest;
42 __u16 wValue;
43 __u16 wIndex;
44 __u16 wLength;
45 __u32 timeout; /* in milliseconds */
46 void __user *data;
47};
48
49struct usbdevfs_bulktransfer {
50 unsigned int ep;
51 unsigned int len;
52 unsigned int timeout; /* in milliseconds */
53 void __user *data;
54};
55
56struct usbdevfs_setinterface {
57 unsigned int interface;
58 unsigned int altsetting;
59};
60
61struct usbdevfs_disconnectsignal {
62 unsigned int signr;
63 void __user *context;
64};
65
66#define USBDEVFS_MAXDRIVERNAME 255
67
68struct usbdevfs_getdriver {
69 unsigned int interface;
70 char driver[USBDEVFS_MAXDRIVERNAME + 1];
71};
72
73struct usbdevfs_connectinfo {
74 unsigned int devnum;
75 unsigned char slow;
76};
77
78#define USBDEVFS_URB_SHORT_NOT_OK 0x01
79#define USBDEVFS_URB_ISO_ASAP 0x02
80#define USBDEVFS_URB_BULK_CONTINUATION 0x04
81#define USBDEVFS_URB_NO_FSBR 0x20
82#define USBDEVFS_URB_ZERO_PACKET 0x40
83#define USBDEVFS_URB_NO_INTERRUPT 0x80
84
85#define USBDEVFS_URB_TYPE_ISO 0
86#define USBDEVFS_URB_TYPE_INTERRUPT 1
87#define USBDEVFS_URB_TYPE_CONTROL 2
88#define USBDEVFS_URB_TYPE_BULK 3
89
90struct usbdevfs_iso_packet_desc {
91 unsigned int length;
92 unsigned int actual_length;
93 unsigned int status;
94};
95
96struct usbdevfs_urb {
97 unsigned char type;
98 unsigned char endpoint;
99 int status;
100 unsigned int flags;
101 void __user *buffer;
102 int buffer_length;
103 int actual_length;
104 int start_frame;
105 int number_of_packets;
106 int error_count;
107 unsigned int signr; /* signal to be sent on completion,
108 or 0 if none should be sent. */
109 void __user *usercontext;
110 struct usbdevfs_iso_packet_desc iso_frame_desc[0];
111};
112
113/* ioctls for talking directly to drivers */
114struct usbdevfs_ioctl {
115 int ifno; /* interface 0..N ; negative numbers reserved */
116 int ioctl_code; /* MUST encode size + direction of data so the
117 * macros in <asm/ioctl.h> give correct values */
118 void __user *data; /* param buffer (in, or out) */
119};
120
121/* You can do most things with hubs just through control messages,
122 * except find out what device connects to what port. */
123struct usbdevfs_hub_portinfo {
124 char nports; /* number of downstream ports in this hub */
125 char port [127]; /* e.g. port 3 connects to device 27 */
126};
127
128/* Device capability flags */
129#define USBDEVFS_CAP_ZERO_PACKET 0x01
130#define USBDEVFS_CAP_BULK_CONTINUATION 0x02
131#define USBDEVFS_CAP_NO_PACKET_SIZE_LIM 0x04
132#define USBDEVFS_CAP_BULK_SCATTER_GATHER 0x08
133
134/* USBDEVFS_DISCONNECT_CLAIM flags & struct */
135
136/* disconnect-and-claim if the driver matches the driver field */
137#define USBDEVFS_DISCONNECT_CLAIM_IF_DRIVER 0x01
138/* disconnect-and-claim except when the driver matches the driver field */
139#define USBDEVFS_DISCONNECT_CLAIM_EXCEPT_DRIVER 0x02
140
141struct usbdevfs_disconnect_claim {
142 unsigned int interface;
143 unsigned int flags;
144 char driver[USBDEVFS_MAXDRIVERNAME + 1];
145};
146
147
148#define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer)
149#define USBDEVFS_CONTROL32 _IOWR('U', 0, struct usbdevfs_ctrltransfer32)
150#define USBDEVFS_BULK _IOWR('U', 2, struct usbdevfs_bulktransfer)
151#define USBDEVFS_BULK32 _IOWR('U', 2, struct usbdevfs_bulktransfer32)
152#define USBDEVFS_RESETEP _IOR('U', 3, unsigned int)
153#define USBDEVFS_SETINTERFACE _IOR('U', 4, struct usbdevfs_setinterface)
154#define USBDEVFS_SETCONFIGURATION _IOR('U', 5, unsigned int)
155#define USBDEVFS_GETDRIVER _IOW('U', 8, struct usbdevfs_getdriver)
156#define USBDEVFS_SUBMITURB _IOR('U', 10, struct usbdevfs_urb)
157#define USBDEVFS_SUBMITURB32 _IOR('U', 10, struct usbdevfs_urb32)
158#define USBDEVFS_DISCARDURB _IO('U', 11)
159#define USBDEVFS_REAPURB _IOW('U', 12, void *)
160#define USBDEVFS_REAPURB32 _IOW('U', 12, __u32)
161#define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *)
162#define USBDEVFS_REAPURBNDELAY32 _IOW('U', 13, __u32)
163#define USBDEVFS_DISCSIGNAL _IOR('U', 14, struct usbdevfs_disconnectsignal)
164#define USBDEVFS_DISCSIGNAL32 _IOR('U', 14, struct usbdevfs_disconnectsignal32)
165#define USBDEVFS_CLAIMINTERFACE _IOR('U', 15, unsigned int)
166#define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int)
167#define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo)
168#define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl)
169#define USBDEVFS_IOCTL32 _IOWR('U', 18, struct usbdevfs_ioctl32)
170#define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo)
171#define USBDEVFS_RESET _IO('U', 20)
172#define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int)
173#define USBDEVFS_DISCONNECT _IO('U', 22)
174#define USBDEVFS_CONNECT _IO('U', 23)
175#define USBDEVFS_CLAIM_PORT _IOR('U', 24, unsigned int)
176#define USBDEVFS_RELEASE_PORT _IOR('U', 25, unsigned int)
177#define USBDEVFS_GET_CAPABILITIES _IOR('U', 26, __u32)
178#define USBDEVFS_DISCONNECT_CLAIM _IOR('U', 27, struct usbdevfs_disconnect_claim)
179
180#endif /* _UAPI_LINUX_USBDEVICE_FS_H */
diff --git a/include/linux/utime.h b/include/uapi/linux/utime.h
index 5cdf673afbdb..5cdf673afbdb 100644
--- a/include/linux/utime.h
+++ b/include/uapi/linux/utime.h
diff --git a/include/uapi/linux/utsname.h b/include/uapi/linux/utsname.h
new file mode 100644
index 000000000000..872c2df10de7
--- /dev/null
+++ b/include/uapi/linux/utsname.h
@@ -0,0 +1,34 @@
1#ifndef _UAPI_LINUX_UTSNAME_H
2#define _UAPI_LINUX_UTSNAME_H
3
4#define __OLD_UTS_LEN 8
5
6struct oldold_utsname {
7 char sysname[9];
8 char nodename[9];
9 char release[9];
10 char version[9];
11 char machine[9];
12};
13
14#define __NEW_UTS_LEN 64
15
16struct old_utsname {
17 char sysname[65];
18 char nodename[65];
19 char release[65];
20 char version[65];
21 char machine[65];
22};
23
24struct new_utsname {
25 char sysname[__NEW_UTS_LEN + 1];
26 char nodename[__NEW_UTS_LEN + 1];
27 char release[__NEW_UTS_LEN + 1];
28 char version[__NEW_UTS_LEN + 1];
29 char machine[__NEW_UTS_LEN + 1];
30 char domainname[__NEW_UTS_LEN + 1];
31};
32
33
34#endif /* _UAPI_LINUX_UTSNAME_H */
diff --git a/include/uapi/linux/uuid.h b/include/uapi/linux/uuid.h
new file mode 100644
index 000000000000..786f0773cc33
--- /dev/null
+++ b/include/uapi/linux/uuid.h
@@ -0,0 +1,58 @@
1/*
2 * UUID/GUID definition
3 *
4 * Copyright (C) 2010, Intel Corp.
5 * Huang Ying <ying.huang@intel.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 version
9 * 2 as 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 _UAPI_LINUX_UUID_H_
22#define _UAPI_LINUX_UUID_H_
23
24#include <linux/types.h>
25#include <linux/string.h>
26
27typedef struct {
28 __u8 b[16];
29} uuid_le;
30
31typedef struct {
32 __u8 b[16];
33} uuid_be;
34
35#define UUID_LE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
36((uuid_le) \
37{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
38 (b) & 0xff, ((b) >> 8) & 0xff, \
39 (c) & 0xff, ((c) >> 8) & 0xff, \
40 (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
41
42#define UUID_BE(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
43((uuid_be) \
44{{ ((a) >> 24) & 0xff, ((a) >> 16) & 0xff, ((a) >> 8) & 0xff, (a) & 0xff, \
45 ((b) >> 8) & 0xff, (b) & 0xff, \
46 ((c) >> 8) & 0xff, (c) & 0xff, \
47 (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
48
49#define NULL_UUID_LE \
50 UUID_LE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
51 0x00, 0x00, 0x00, 0x00)
52
53#define NULL_UUID_BE \
54 UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \
55 0x00, 0x00, 0x00, 0x00)
56
57
58#endif /* _UAPI_LINUX_UUID_H_ */
diff --git a/include/linux/uvcvideo.h b/include/uapi/linux/uvcvideo.h
index 3b081862b9e8..3b081862b9e8 100644
--- a/include/linux/uvcvideo.h
+++ b/include/uapi/linux/uvcvideo.h
diff --git a/include/linux/v4l2-common.h b/include/uapi/linux/v4l2-common.h
index 0fa8b64c3cdb..4f0667e010dd 100644
--- a/include/linux/v4l2-common.h
+++ b/include/uapi/linux/v4l2-common.h
@@ -53,10 +53,10 @@
53/* Backward compatibility target definitions --- to be removed. */ 53/* Backward compatibility target definitions --- to be removed. */
54#define V4L2_SEL_TGT_CROP_ACTIVE V4L2_SEL_TGT_CROP 54#define V4L2_SEL_TGT_CROP_ACTIVE V4L2_SEL_TGT_CROP
55#define V4L2_SEL_TGT_COMPOSE_ACTIVE V4L2_SEL_TGT_COMPOSE 55#define V4L2_SEL_TGT_COMPOSE_ACTIVE V4L2_SEL_TGT_COMPOSE
56#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL \ 56#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL V4L2_SEL_TGT_CROP
57 V4L2_SEL_TGT_CROP 57#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL V4L2_SEL_TGT_COMPOSE
58#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL \ 58#define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS V4L2_SEL_TGT_CROP_BOUNDS
59 V4L2_SEL_TGT_COMPOSE 59#define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS V4L2_SEL_TGT_COMPOSE_BOUNDS
60 60
61/* Selection flags */ 61/* Selection flags */
62#define V4L2_SEL_FLAG_GE (1 << 0) 62#define V4L2_SEL_FLAG_GE (1 << 0)
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
new file mode 100644
index 000000000000..f56c945cecd4
--- /dev/null
+++ b/include/uapi/linux/v4l2-controls.h
@@ -0,0 +1,803 @@
1/*
2 * Video for Linux Two controls header file
3 *
4 * Copyright (C) 1999-2012 the contributors
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 * Alternatively you can redistribute this file under the terms of the
17 * BSD license as stated below:
18 *
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions
21 * are met:
22 * 1. Redistributions of source code must retain the above copyright
23 * notice, this list of conditions and the following disclaimer.
24 * 2. Redistributions in binary form must reproduce the above copyright
25 * notice, this list of conditions and the following disclaimer in
26 * the documentation and/or other materials provided with the
27 * distribution.
28 * 3. The names of its contributors may not be used to endorse or promote
29 * products derived from this software without specific prior written
30 * permission.
31 *
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
37 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
38 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
39 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
40 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 *
44 * The contents of this header was split off from videodev2.h. All control
45 * definitions should be added to this header, which is included by
46 * videodev2.h.
47 */
48
49#ifndef __LINUX_V4L2_CONTROLS_H
50#define __LINUX_V4L2_CONTROLS_H
51
52/* Control classes */
53#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */
54#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
55#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
56#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */
57#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */
58#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */
59#define V4L2_CTRL_CLASS_IMAGE_SOURCE 0x009e0000 /* Image source controls */
60#define V4L2_CTRL_CLASS_IMAGE_PROC 0x009f0000 /* Image processing controls */
61#define V4L2_CTRL_CLASS_DV 0x00a00000 /* Digital Video controls */
62
63/* User-class control IDs */
64
65#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900)
66#define V4L2_CID_USER_BASE V4L2_CID_BASE
67#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1)
68#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0)
69#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1)
70#define V4L2_CID_SATURATION (V4L2_CID_BASE+2)
71#define V4L2_CID_HUE (V4L2_CID_BASE+3)
72#define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5)
73#define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6)
74#define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7)
75#define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8)
76#define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9)
77#define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10)
78#define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) /* Deprecated */
79#define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12)
80#define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13)
81#define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14)
82#define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15)
83#define V4L2_CID_GAMMA (V4L2_CID_BASE+16)
84#define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* Deprecated */
85#define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17)
86#define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18)
87#define V4L2_CID_GAIN (V4L2_CID_BASE+19)
88#define V4L2_CID_HFLIP (V4L2_CID_BASE+20)
89#define V4L2_CID_VFLIP (V4L2_CID_BASE+21)
90
91/* Deprecated; use V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET */
92#define V4L2_CID_HCENTER (V4L2_CID_BASE+22)
93#define V4L2_CID_VCENTER (V4L2_CID_BASE+23)
94
95#define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24)
96enum v4l2_power_line_frequency {
97 V4L2_CID_POWER_LINE_FREQUENCY_DISABLED = 0,
98 V4L2_CID_POWER_LINE_FREQUENCY_50HZ = 1,
99 V4L2_CID_POWER_LINE_FREQUENCY_60HZ = 2,
100 V4L2_CID_POWER_LINE_FREQUENCY_AUTO = 3,
101};
102#define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25)
103#define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26)
104#define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27)
105#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28)
106#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29)
107#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30)
108#define V4L2_CID_COLORFX (V4L2_CID_BASE+31)
109enum v4l2_colorfx {
110 V4L2_COLORFX_NONE = 0,
111 V4L2_COLORFX_BW = 1,
112 V4L2_COLORFX_SEPIA = 2,
113 V4L2_COLORFX_NEGATIVE = 3,
114 V4L2_COLORFX_EMBOSS = 4,
115 V4L2_COLORFX_SKETCH = 5,
116 V4L2_COLORFX_SKY_BLUE = 6,
117 V4L2_COLORFX_GRASS_GREEN = 7,
118 V4L2_COLORFX_SKIN_WHITEN = 8,
119 V4L2_COLORFX_VIVID = 9,
120 V4L2_COLORFX_AQUA = 10,
121 V4L2_COLORFX_ART_FREEZE = 11,
122 V4L2_COLORFX_SILHOUETTE = 12,
123 V4L2_COLORFX_SOLARIZATION = 13,
124 V4L2_COLORFX_ANTIQUE = 14,
125 V4L2_COLORFX_SET_CBCR = 15,
126};
127#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32)
128#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33)
129
130#define V4L2_CID_ROTATE (V4L2_CID_BASE+34)
131#define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35)
132
133#define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36)
134
135#define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+37)
136#define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+38)
137
138#define V4L2_CID_MIN_BUFFERS_FOR_CAPTURE (V4L2_CID_BASE+39)
139#define V4L2_CID_MIN_BUFFERS_FOR_OUTPUT (V4L2_CID_BASE+40)
140
141#define V4L2_CID_ALPHA_COMPONENT (V4L2_CID_BASE+41)
142#define V4L2_CID_COLORFX_CBCR (V4L2_CID_BASE+42)
143
144/* last CID + 1 */
145#define V4L2_CID_LASTP1 (V4L2_CID_BASE+43)
146
147
148/* MPEG-class control IDs */
149
150#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
151#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1)
152
153/* MPEG streams, specific to multiplexed streams */
154#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0)
155enum v4l2_mpeg_stream_type {
156 V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */
157 V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, /* MPEG-2 transport stream */
158 V4L2_MPEG_STREAM_TYPE_MPEG1_SS = 2, /* MPEG-1 system stream */
159 V4L2_MPEG_STREAM_TYPE_MPEG2_DVD = 3, /* MPEG-2 DVD-compatible stream */
160 V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */
161 V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */
162};
163#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1)
164#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2)
165#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3)
166#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4)
167#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5)
168#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6)
169#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7)
170enum v4l2_mpeg_stream_vbi_fmt {
171 V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */
172 V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */
173};
174
175/* MPEG audio controls specific to multiplexed streams */
176#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100)
177enum v4l2_mpeg_audio_sampling_freq {
178 V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0,
179 V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1,
180 V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2,
181};
182#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101)
183enum v4l2_mpeg_audio_encoding {
184 V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0,
185 V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1,
186 V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2,
187 V4L2_MPEG_AUDIO_ENCODING_AAC = 3,
188 V4L2_MPEG_AUDIO_ENCODING_AC3 = 4,
189};
190#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102)
191enum v4l2_mpeg_audio_l1_bitrate {
192 V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0,
193 V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1,
194 V4L2_MPEG_AUDIO_L1_BITRATE_96K = 2,
195 V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3,
196 V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4,
197 V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5,
198 V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6,
199 V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7,
200 V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8,
201 V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9,
202 V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10,
203 V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11,
204 V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12,
205 V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13,
206};
207#define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103)
208enum v4l2_mpeg_audio_l2_bitrate {
209 V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0,
210 V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1,
211 V4L2_MPEG_AUDIO_L2_BITRATE_56K = 2,
212 V4L2_MPEG_AUDIO_L2_BITRATE_64K = 3,
213 V4L2_MPEG_AUDIO_L2_BITRATE_80K = 4,
214 V4L2_MPEG_AUDIO_L2_BITRATE_96K = 5,
215 V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6,
216 V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7,
217 V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8,
218 V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9,
219 V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10,
220 V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11,
221 V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12,
222 V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13,
223};
224#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104)
225enum v4l2_mpeg_audio_l3_bitrate {
226 V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0,
227 V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1,
228 V4L2_MPEG_AUDIO_L3_BITRATE_48K = 2,
229 V4L2_MPEG_AUDIO_L3_BITRATE_56K = 3,
230 V4L2_MPEG_AUDIO_L3_BITRATE_64K = 4,
231 V4L2_MPEG_AUDIO_L3_BITRATE_80K = 5,
232 V4L2_MPEG_AUDIO_L3_BITRATE_96K = 6,
233 V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7,
234 V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8,
235 V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9,
236 V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10,
237 V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11,
238 V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12,
239 V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13,
240};
241#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105)
242enum v4l2_mpeg_audio_mode {
243 V4L2_MPEG_AUDIO_MODE_STEREO = 0,
244 V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1,
245 V4L2_MPEG_AUDIO_MODE_DUAL = 2,
246 V4L2_MPEG_AUDIO_MODE_MONO = 3,
247};
248#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106)
249enum v4l2_mpeg_audio_mode_extension {
250 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0,
251 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1,
252 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2,
253 V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3,
254};
255#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107)
256enum v4l2_mpeg_audio_emphasis {
257 V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0,
258 V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1,
259 V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2,
260};
261#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108)
262enum v4l2_mpeg_audio_crc {
263 V4L2_MPEG_AUDIO_CRC_NONE = 0,
264 V4L2_MPEG_AUDIO_CRC_CRC16 = 1,
265};
266#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109)
267#define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110)
268#define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111)
269enum v4l2_mpeg_audio_ac3_bitrate {
270 V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0,
271 V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1,
272 V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2,
273 V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3,
274 V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4,
275 V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5,
276 V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6,
277 V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7,
278 V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8,
279 V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9,
280 V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10,
281 V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11,
282 V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12,
283 V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13,
284 V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14,
285 V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15,
286 V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16,
287 V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17,
288 V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18,
289};
290#define V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK (V4L2_CID_MPEG_BASE+112)
291enum v4l2_mpeg_audio_dec_playback {
292 V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO = 0,
293 V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO = 1,
294 V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT = 2,
295 V4L2_MPEG_AUDIO_DEC_PLAYBACK_RIGHT = 3,
296 V4L2_MPEG_AUDIO_DEC_PLAYBACK_MONO = 4,
297 V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO = 5,
298};
299#define V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK (V4L2_CID_MPEG_BASE+113)
300
301/* MPEG video controls specific to multiplexed streams */
302#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
303enum v4l2_mpeg_video_encoding {
304 V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0,
305 V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1,
306 V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2,
307};
308#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201)
309enum v4l2_mpeg_video_aspect {
310 V4L2_MPEG_VIDEO_ASPECT_1x1 = 0,
311 V4L2_MPEG_VIDEO_ASPECT_4x3 = 1,
312 V4L2_MPEG_VIDEO_ASPECT_16x9 = 2,
313 V4L2_MPEG_VIDEO_ASPECT_221x100 = 3,
314};
315#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202)
316#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203)
317#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204)
318#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205)
319#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206)
320enum v4l2_mpeg_video_bitrate_mode {
321 V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0,
322 V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1,
323};
324#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207)
325#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208)
326#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209)
327#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210)
328#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211)
329#define V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE (V4L2_CID_MPEG_BASE+212)
330#define V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER (V4L2_CID_MPEG_BASE+213)
331#define V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB (V4L2_CID_MPEG_BASE+214)
332#define V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE (V4L2_CID_MPEG_BASE+215)
333#define V4L2_CID_MPEG_VIDEO_HEADER_MODE (V4L2_CID_MPEG_BASE+216)
334enum v4l2_mpeg_video_header_mode {
335 V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE = 0,
336 V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME = 1,
337
338};
339#define V4L2_CID_MPEG_VIDEO_MAX_REF_PIC (V4L2_CID_MPEG_BASE+217)
340#define V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE (V4L2_CID_MPEG_BASE+218)
341#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES (V4L2_CID_MPEG_BASE+219)
342#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB (V4L2_CID_MPEG_BASE+220)
343#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE (V4L2_CID_MPEG_BASE+221)
344enum v4l2_mpeg_video_multi_slice_mode {
345 V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE = 0,
346 V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB = 1,
347 V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2,
348};
349#define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222)
350#define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_MPEG_BASE+223)
351#define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224)
352#define V4L2_CID_MPEG_VIDEO_VBV_DELAY (V4L2_CID_MPEG_BASE+225)
353
354#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300)
355#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301)
356#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302)
357#define V4L2_CID_MPEG_VIDEO_H263_MIN_QP (V4L2_CID_MPEG_BASE+303)
358#define V4L2_CID_MPEG_VIDEO_H263_MAX_QP (V4L2_CID_MPEG_BASE+304)
359#define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP (V4L2_CID_MPEG_BASE+350)
360#define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP (V4L2_CID_MPEG_BASE+351)
361#define V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP (V4L2_CID_MPEG_BASE+352)
362#define V4L2_CID_MPEG_VIDEO_H264_MIN_QP (V4L2_CID_MPEG_BASE+353)
363#define V4L2_CID_MPEG_VIDEO_H264_MAX_QP (V4L2_CID_MPEG_BASE+354)
364#define V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM (V4L2_CID_MPEG_BASE+355)
365#define V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE (V4L2_CID_MPEG_BASE+356)
366#define V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE (V4L2_CID_MPEG_BASE+357)
367enum v4l2_mpeg_video_h264_entropy_mode {
368 V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC = 0,
369 V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC = 1,
370};
371#define V4L2_CID_MPEG_VIDEO_H264_I_PERIOD (V4L2_CID_MPEG_BASE+358)
372#define V4L2_CID_MPEG_VIDEO_H264_LEVEL (V4L2_CID_MPEG_BASE+359)
373enum v4l2_mpeg_video_h264_level {
374 V4L2_MPEG_VIDEO_H264_LEVEL_1_0 = 0,
375 V4L2_MPEG_VIDEO_H264_LEVEL_1B = 1,
376 V4L2_MPEG_VIDEO_H264_LEVEL_1_1 = 2,
377 V4L2_MPEG_VIDEO_H264_LEVEL_1_2 = 3,
378 V4L2_MPEG_VIDEO_H264_LEVEL_1_3 = 4,
379 V4L2_MPEG_VIDEO_H264_LEVEL_2_0 = 5,
380 V4L2_MPEG_VIDEO_H264_LEVEL_2_1 = 6,
381 V4L2_MPEG_VIDEO_H264_LEVEL_2_2 = 7,
382 V4L2_MPEG_VIDEO_H264_LEVEL_3_0 = 8,
383 V4L2_MPEG_VIDEO_H264_LEVEL_3_1 = 9,
384 V4L2_MPEG_VIDEO_H264_LEVEL_3_2 = 10,
385 V4L2_MPEG_VIDEO_H264_LEVEL_4_0 = 11,
386 V4L2_MPEG_VIDEO_H264_LEVEL_4_1 = 12,
387 V4L2_MPEG_VIDEO_H264_LEVEL_4_2 = 13,
388 V4L2_MPEG_VIDEO_H264_LEVEL_5_0 = 14,
389 V4L2_MPEG_VIDEO_H264_LEVEL_5_1 = 15,
390};
391#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA (V4L2_CID_MPEG_BASE+360)
392#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA (V4L2_CID_MPEG_BASE+361)
393#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE (V4L2_CID_MPEG_BASE+362)
394enum v4l2_mpeg_video_h264_loop_filter_mode {
395 V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED = 0,
396 V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED = 1,
397 V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY = 2,
398};
399#define V4L2_CID_MPEG_VIDEO_H264_PROFILE (V4L2_CID_MPEG_BASE+363)
400enum v4l2_mpeg_video_h264_profile {
401 V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE = 0,
402 V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE = 1,
403 V4L2_MPEG_VIDEO_H264_PROFILE_MAIN = 2,
404 V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED = 3,
405 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH = 4,
406 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10 = 5,
407 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422 = 6,
408 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_PREDICTIVE = 7,
409 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10_INTRA = 8,
410 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422_INTRA = 9,
411 V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_INTRA = 10,
412 V4L2_MPEG_VIDEO_H264_PROFILE_CAVLC_444_INTRA = 11,
413 V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_BASELINE = 12,
414 V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH = 13,
415 V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH_INTRA = 14,
416 V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH = 15,
417 V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH = 16,
418};
419#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT (V4L2_CID_MPEG_BASE+364)
420#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH (V4L2_CID_MPEG_BASE+365)
421#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE (V4L2_CID_MPEG_BASE+366)
422#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC (V4L2_CID_MPEG_BASE+367)
423enum v4l2_mpeg_video_h264_vui_sar_idc {
424 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED = 0,
425 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_1x1 = 1,
426 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_12x11 = 2,
427 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_10x11 = 3,
428 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_16x11 = 4,
429 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_40x33 = 5,
430 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_24x11 = 6,
431 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_20x11 = 7,
432 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_32x11 = 8,
433 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_80x33 = 9,
434 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_18x11 = 10,
435 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_15x11 = 11,
436 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_64x33 = 12,
437 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_160x99 = 13,
438 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_4x3 = 14,
439 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_3x2 = 15,
440 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_2x1 = 16,
441 V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED = 17,
442};
443#define V4L2_CID_MPEG_VIDEO_H264_SEI_FRAME_PACKING (V4L2_CID_MPEG_BASE+368)
444#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_CURRENT_FRAME_0 (V4L2_CID_MPEG_BASE+369)
445#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE (V4L2_CID_MPEG_BASE+370)
446enum v4l2_mpeg_video_h264_sei_fp_arrangement_type {
447 V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_CHECKERBOARD = 0,
448 V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_COLUMN = 1,
449 V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_ROW = 2,
450 V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_SIDE_BY_SIDE = 3,
451 V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_TOP_BOTTOM = 4,
452 V4L2_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE_TEMPORAL = 5,
453};
454#define V4L2_CID_MPEG_VIDEO_H264_FMO (V4L2_CID_MPEG_BASE+371)
455#define V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE (V4L2_CID_MPEG_BASE+372)
456enum v4l2_mpeg_video_h264_fmo_map_type {
457 V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_INTERLEAVED_SLICES = 0,
458 V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_SCATTERED_SLICES = 1,
459 V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_FOREGROUND_WITH_LEFT_OVER = 2,
460 V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_BOX_OUT = 3,
461 V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_RASTER_SCAN = 4,
462 V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_WIPE_SCAN = 5,
463 V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_EXPLICIT = 6,
464};
465#define V4L2_CID_MPEG_VIDEO_H264_FMO_SLICE_GROUP (V4L2_CID_MPEG_BASE+373)
466#define V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_DIRECTION (V4L2_CID_MPEG_BASE+374)
467enum v4l2_mpeg_video_h264_fmo_change_dir {
468 V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_RIGHT = 0,
469 V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_LEFT = 1,
470};
471#define V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_RATE (V4L2_CID_MPEG_BASE+375)
472#define V4L2_CID_MPEG_VIDEO_H264_FMO_RUN_LENGTH (V4L2_CID_MPEG_BASE+376)
473#define V4L2_CID_MPEG_VIDEO_H264_ASO (V4L2_CID_MPEG_BASE+377)
474#define V4L2_CID_MPEG_VIDEO_H264_ASO_SLICE_ORDER (V4L2_CID_MPEG_BASE+378)
475#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING (V4L2_CID_MPEG_BASE+379)
476#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_TYPE (V4L2_CID_MPEG_BASE+380)
477enum v4l2_mpeg_video_h264_hierarchical_coding_type {
478 V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_B = 0,
479 V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_P = 1,
480};
481#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER (V4L2_CID_MPEG_BASE+381)
482#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER_QP (V4L2_CID_MPEG_BASE+382)
483#define V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP (V4L2_CID_MPEG_BASE+400)
484#define V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP (V4L2_CID_MPEG_BASE+401)
485#define V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP (V4L2_CID_MPEG_BASE+402)
486#define V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP (V4L2_CID_MPEG_BASE+403)
487#define V4L2_CID_MPEG_VIDEO_MPEG4_MAX_QP (V4L2_CID_MPEG_BASE+404)
488#define V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL (V4L2_CID_MPEG_BASE+405)
489enum v4l2_mpeg_video_mpeg4_level {
490 V4L2_MPEG_VIDEO_MPEG4_LEVEL_0 = 0,
491 V4L2_MPEG_VIDEO_MPEG4_LEVEL_0B = 1,
492 V4L2_MPEG_VIDEO_MPEG4_LEVEL_1 = 2,
493 V4L2_MPEG_VIDEO_MPEG4_LEVEL_2 = 3,
494 V4L2_MPEG_VIDEO_MPEG4_LEVEL_3 = 4,
495 V4L2_MPEG_VIDEO_MPEG4_LEVEL_3B = 5,
496 V4L2_MPEG_VIDEO_MPEG4_LEVEL_4 = 6,
497 V4L2_MPEG_VIDEO_MPEG4_LEVEL_5 = 7,
498};
499#define V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE (V4L2_CID_MPEG_BASE+406)
500enum v4l2_mpeg_video_mpeg4_profile {
501 V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE = 0,
502 V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE = 1,
503 V4L2_MPEG_VIDEO_MPEG4_PROFILE_CORE = 2,
504 V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE_SCALABLE = 3,
505 V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY = 4,
506};
507#define V4L2_CID_MPEG_VIDEO_MPEG4_QPEL (V4L2_CID_MPEG_BASE+407)
508
509/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
510#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)
511#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0)
512enum v4l2_mpeg_cx2341x_video_spatial_filter_mode {
513 V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0,
514 V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1,
515};
516#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1)
517#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2)
518enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type {
519 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0,
520 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
521 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2,
522 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3,
523 V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4,
524};
525#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3)
526enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type {
527 V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0,
528 V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1,
529};
530#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4)
531enum v4l2_mpeg_cx2341x_video_temporal_filter_mode {
532 V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0,
533 V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1,
534};
535#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5)
536#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6)
537enum v4l2_mpeg_cx2341x_video_median_filter_type {
538 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0,
539 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1,
540 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT = 2,
541 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3,
542 V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4,
543};
544#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7)
545#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8)
546#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9)
547#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10)
548#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11)
549
550/* MPEG-class control IDs specific to the Samsung MFC 5.1 driver as defined by V4L2 */
551#define V4L2_CID_MPEG_MFC51_BASE (V4L2_CTRL_CLASS_MPEG | 0x1100)
552
553#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY (V4L2_CID_MPEG_MFC51_BASE+0)
554#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE (V4L2_CID_MPEG_MFC51_BASE+1)
555#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE (V4L2_CID_MPEG_MFC51_BASE+2)
556enum v4l2_mpeg_mfc51_video_frame_skip_mode {
557 V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_DISABLED = 0,
558 V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_LEVEL_LIMIT = 1,
559 V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT = 2,
560};
561#define V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE (V4L2_CID_MPEG_MFC51_BASE+3)
562enum v4l2_mpeg_mfc51_video_force_frame_type {
563 V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_DISABLED = 0,
564 V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_I_FRAME = 1,
565 V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_NOT_CODED = 2,
566};
567#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING (V4L2_CID_MPEG_MFC51_BASE+4)
568#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING_YUV (V4L2_CID_MPEG_MFC51_BASE+5)
569#define V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT (V4L2_CID_MPEG_MFC51_BASE+6)
570#define V4L2_CID_MPEG_MFC51_VIDEO_RC_REACTION_COEFF (V4L2_CID_MPEG_MFC51_BASE+7)
571#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_ACTIVITY (V4L2_CID_MPEG_MFC51_BASE+50)
572#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_DARK (V4L2_CID_MPEG_MFC51_BASE+51)
573#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_SMOOTH (V4L2_CID_MPEG_MFC51_BASE+52)
574#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_STATIC (V4L2_CID_MPEG_MFC51_BASE+53)
575#define V4L2_CID_MPEG_MFC51_VIDEO_H264_NUM_REF_PIC_FOR_P (V4L2_CID_MPEG_MFC51_BASE+54)
576
577
578/* Camera class control IDs */
579
580#define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900)
581#define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1)
582
583#define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1)
584enum v4l2_exposure_auto_type {
585 V4L2_EXPOSURE_AUTO = 0,
586 V4L2_EXPOSURE_MANUAL = 1,
587 V4L2_EXPOSURE_SHUTTER_PRIORITY = 2,
588 V4L2_EXPOSURE_APERTURE_PRIORITY = 3
589};
590#define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2)
591#define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3)
592
593#define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4)
594#define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5)
595#define V4L2_CID_PAN_RESET (V4L2_CID_CAMERA_CLASS_BASE+6)
596#define V4L2_CID_TILT_RESET (V4L2_CID_CAMERA_CLASS_BASE+7)
597
598#define V4L2_CID_PAN_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+8)
599#define V4L2_CID_TILT_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+9)
600
601#define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10)
602#define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11)
603#define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12)
604
605#define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13)
606#define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14)
607#define V4L2_CID_ZOOM_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE+15)
608
609#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16)
610
611#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17)
612#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18)
613
614#define V4L2_CID_AUTO_EXPOSURE_BIAS (V4L2_CID_CAMERA_CLASS_BASE+19)
615
616#define V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE (V4L2_CID_CAMERA_CLASS_BASE+20)
617enum v4l2_auto_n_preset_white_balance {
618 V4L2_WHITE_BALANCE_MANUAL = 0,
619 V4L2_WHITE_BALANCE_AUTO = 1,
620 V4L2_WHITE_BALANCE_INCANDESCENT = 2,
621 V4L2_WHITE_BALANCE_FLUORESCENT = 3,
622 V4L2_WHITE_BALANCE_FLUORESCENT_H = 4,
623 V4L2_WHITE_BALANCE_HORIZON = 5,
624 V4L2_WHITE_BALANCE_DAYLIGHT = 6,
625 V4L2_WHITE_BALANCE_FLASH = 7,
626 V4L2_WHITE_BALANCE_CLOUDY = 8,
627 V4L2_WHITE_BALANCE_SHADE = 9,
628};
629
630#define V4L2_CID_WIDE_DYNAMIC_RANGE (V4L2_CID_CAMERA_CLASS_BASE+21)
631#define V4L2_CID_IMAGE_STABILIZATION (V4L2_CID_CAMERA_CLASS_BASE+22)
632
633#define V4L2_CID_ISO_SENSITIVITY (V4L2_CID_CAMERA_CLASS_BASE+23)
634#define V4L2_CID_ISO_SENSITIVITY_AUTO (V4L2_CID_CAMERA_CLASS_BASE+24)
635enum v4l2_iso_sensitivity_auto_type {
636 V4L2_ISO_SENSITIVITY_MANUAL = 0,
637 V4L2_ISO_SENSITIVITY_AUTO = 1,
638};
639
640#define V4L2_CID_EXPOSURE_METERING (V4L2_CID_CAMERA_CLASS_BASE+25)
641enum v4l2_exposure_metering {
642 V4L2_EXPOSURE_METERING_AVERAGE = 0,
643 V4L2_EXPOSURE_METERING_CENTER_WEIGHTED = 1,
644 V4L2_EXPOSURE_METERING_SPOT = 2,
645};
646
647#define V4L2_CID_SCENE_MODE (V4L2_CID_CAMERA_CLASS_BASE+26)
648enum v4l2_scene_mode {
649 V4L2_SCENE_MODE_NONE = 0,
650 V4L2_SCENE_MODE_BACKLIGHT = 1,
651 V4L2_SCENE_MODE_BEACH_SNOW = 2,
652 V4L2_SCENE_MODE_CANDLE_LIGHT = 3,
653 V4L2_SCENE_MODE_DAWN_DUSK = 4,
654 V4L2_SCENE_MODE_FALL_COLORS = 5,
655 V4L2_SCENE_MODE_FIREWORKS = 6,
656 V4L2_SCENE_MODE_LANDSCAPE = 7,
657 V4L2_SCENE_MODE_NIGHT = 8,
658 V4L2_SCENE_MODE_PARTY_INDOOR = 9,
659 V4L2_SCENE_MODE_PORTRAIT = 10,
660 V4L2_SCENE_MODE_SPORTS = 11,
661 V4L2_SCENE_MODE_SUNSET = 12,
662 V4L2_SCENE_MODE_TEXT = 13,
663};
664
665#define V4L2_CID_3A_LOCK (V4L2_CID_CAMERA_CLASS_BASE+27)
666#define V4L2_LOCK_EXPOSURE (1 << 0)
667#define V4L2_LOCK_WHITE_BALANCE (1 << 1)
668#define V4L2_LOCK_FOCUS (1 << 2)
669
670#define V4L2_CID_AUTO_FOCUS_START (V4L2_CID_CAMERA_CLASS_BASE+28)
671#define V4L2_CID_AUTO_FOCUS_STOP (V4L2_CID_CAMERA_CLASS_BASE+29)
672#define V4L2_CID_AUTO_FOCUS_STATUS (V4L2_CID_CAMERA_CLASS_BASE+30)
673#define V4L2_AUTO_FOCUS_STATUS_IDLE (0 << 0)
674#define V4L2_AUTO_FOCUS_STATUS_BUSY (1 << 0)
675#define V4L2_AUTO_FOCUS_STATUS_REACHED (1 << 1)
676#define V4L2_AUTO_FOCUS_STATUS_FAILED (1 << 2)
677
678#define V4L2_CID_AUTO_FOCUS_RANGE (V4L2_CID_CAMERA_CLASS_BASE+31)
679enum v4l2_auto_focus_range {
680 V4L2_AUTO_FOCUS_RANGE_AUTO = 0,
681 V4L2_AUTO_FOCUS_RANGE_NORMAL = 1,
682 V4L2_AUTO_FOCUS_RANGE_MACRO = 2,
683 V4L2_AUTO_FOCUS_RANGE_INFINITY = 3,
684};
685
686
687/* FM Modulator class control IDs */
688
689#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900)
690#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1)
691
692#define V4L2_CID_RDS_TX_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 1)
693#define V4L2_CID_RDS_TX_PI (V4L2_CID_FM_TX_CLASS_BASE + 2)
694#define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3)
695#define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5)
696#define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6)
697
698#define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64)
699#define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 65)
700#define V4L2_CID_AUDIO_LIMITER_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 66)
701
702#define V4L2_CID_AUDIO_COMPRESSION_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 80)
703#define V4L2_CID_AUDIO_COMPRESSION_GAIN (V4L2_CID_FM_TX_CLASS_BASE + 81)
704#define V4L2_CID_AUDIO_COMPRESSION_THRESHOLD (V4L2_CID_FM_TX_CLASS_BASE + 82)
705#define V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME (V4L2_CID_FM_TX_CLASS_BASE + 83)
706#define V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 84)
707
708#define V4L2_CID_PILOT_TONE_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 96)
709#define V4L2_CID_PILOT_TONE_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 97)
710#define V4L2_CID_PILOT_TONE_FREQUENCY (V4L2_CID_FM_TX_CLASS_BASE + 98)
711
712#define V4L2_CID_TUNE_PREEMPHASIS (V4L2_CID_FM_TX_CLASS_BASE + 112)
713enum v4l2_preemphasis {
714 V4L2_PREEMPHASIS_DISABLED = 0,
715 V4L2_PREEMPHASIS_50_uS = 1,
716 V4L2_PREEMPHASIS_75_uS = 2,
717};
718#define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113)
719#define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114)
720
721
722/* Flash and privacy (indicator) light controls */
723
724#define V4L2_CID_FLASH_CLASS_BASE (V4L2_CTRL_CLASS_FLASH | 0x900)
725#define V4L2_CID_FLASH_CLASS (V4L2_CTRL_CLASS_FLASH | 1)
726
727#define V4L2_CID_FLASH_LED_MODE (V4L2_CID_FLASH_CLASS_BASE + 1)
728enum v4l2_flash_led_mode {
729 V4L2_FLASH_LED_MODE_NONE,
730 V4L2_FLASH_LED_MODE_FLASH,
731 V4L2_FLASH_LED_MODE_TORCH,
732};
733
734#define V4L2_CID_FLASH_STROBE_SOURCE (V4L2_CID_FLASH_CLASS_BASE + 2)
735enum v4l2_flash_strobe_source {
736 V4L2_FLASH_STROBE_SOURCE_SOFTWARE,
737 V4L2_FLASH_STROBE_SOURCE_EXTERNAL,
738};
739
740#define V4L2_CID_FLASH_STROBE (V4L2_CID_FLASH_CLASS_BASE + 3)
741#define V4L2_CID_FLASH_STROBE_STOP (V4L2_CID_FLASH_CLASS_BASE + 4)
742#define V4L2_CID_FLASH_STROBE_STATUS (V4L2_CID_FLASH_CLASS_BASE + 5)
743
744#define V4L2_CID_FLASH_TIMEOUT (V4L2_CID_FLASH_CLASS_BASE + 6)
745#define V4L2_CID_FLASH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 7)
746#define V4L2_CID_FLASH_TORCH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 8)
747#define V4L2_CID_FLASH_INDICATOR_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 9)
748
749#define V4L2_CID_FLASH_FAULT (V4L2_CID_FLASH_CLASS_BASE + 10)
750#define V4L2_FLASH_FAULT_OVER_VOLTAGE (1 << 0)
751#define V4L2_FLASH_FAULT_TIMEOUT (1 << 1)
752#define V4L2_FLASH_FAULT_OVER_TEMPERATURE (1 << 2)
753#define V4L2_FLASH_FAULT_SHORT_CIRCUIT (1 << 3)
754#define V4L2_FLASH_FAULT_OVER_CURRENT (1 << 4)
755#define V4L2_FLASH_FAULT_INDICATOR (1 << 5)
756
757#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11)
758#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12)
759
760
761/* JPEG-class control IDs */
762
763#define V4L2_CID_JPEG_CLASS_BASE (V4L2_CTRL_CLASS_JPEG | 0x900)
764#define V4L2_CID_JPEG_CLASS (V4L2_CTRL_CLASS_JPEG | 1)
765
766#define V4L2_CID_JPEG_CHROMA_SUBSAMPLING (V4L2_CID_JPEG_CLASS_BASE + 1)
767enum v4l2_jpeg_chroma_subsampling {
768 V4L2_JPEG_CHROMA_SUBSAMPLING_444 = 0,
769 V4L2_JPEG_CHROMA_SUBSAMPLING_422 = 1,
770 V4L2_JPEG_CHROMA_SUBSAMPLING_420 = 2,
771 V4L2_JPEG_CHROMA_SUBSAMPLING_411 = 3,
772 V4L2_JPEG_CHROMA_SUBSAMPLING_410 = 4,
773 V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY = 5,
774};
775#define V4L2_CID_JPEG_RESTART_INTERVAL (V4L2_CID_JPEG_CLASS_BASE + 2)
776#define V4L2_CID_JPEG_COMPRESSION_QUALITY (V4L2_CID_JPEG_CLASS_BASE + 3)
777
778#define V4L2_CID_JPEG_ACTIVE_MARKER (V4L2_CID_JPEG_CLASS_BASE + 4)
779#define V4L2_JPEG_ACTIVE_MARKER_APP0 (1 << 0)
780#define V4L2_JPEG_ACTIVE_MARKER_APP1 (1 << 1)
781#define V4L2_JPEG_ACTIVE_MARKER_COM (1 << 16)
782#define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17)
783#define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18)
784
785/* Image source controls */
786#define V4L2_CID_IMAGE_SOURCE_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_SOURCE | 0x900)
787#define V4L2_CID_IMAGE_SOURCE_CLASS (V4L2_CTRL_CLASS_IMAGE_SOURCE | 1)
788
789#define V4L2_CID_VBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 1)
790#define V4L2_CID_HBLANK (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 2)
791#define V4L2_CID_ANALOGUE_GAIN (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 3)
792
793
794/* Image processing controls */
795
796#define V4L2_CID_IMAGE_PROC_CLASS_BASE (V4L2_CTRL_CLASS_IMAGE_PROC | 0x900)
797#define V4L2_CID_IMAGE_PROC_CLASS (V4L2_CTRL_CLASS_IMAGE_PROC | 1)
798
799#define V4L2_CID_LINK_FREQ (V4L2_CID_IMAGE_PROC_CLASS_BASE + 1)
800#define V4L2_CID_PIXEL_RATE (V4L2_CID_IMAGE_PROC_CLASS_BASE + 2)
801#define V4L2_CID_TEST_PATTERN (V4L2_CID_IMAGE_PROC_CLASS_BASE + 3)
802
803#endif
diff --git a/include/linux/v4l2-dv-timings.h b/include/uapi/linux/v4l2-dv-timings.h
index 9ef8172e5ed0..9ef8172e5ed0 100644
--- a/include/linux/v4l2-dv-timings.h
+++ b/include/uapi/linux/v4l2-dv-timings.h
diff --git a/include/linux/v4l2-mediabus.h b/include/uapi/linux/v4l2-mediabus.h
index 5ea7f753a348..7d64e0e1a18b 100644
--- a/include/linux/v4l2-mediabus.h
+++ b/include/uapi/linux/v4l2-mediabus.h
@@ -92,6 +92,11 @@ enum v4l2_mbus_pixelcode {
92 92
93 /* JPEG compressed formats - next is 0x4002 */ 93 /* JPEG compressed formats - next is 0x4002 */
94 V4L2_MBUS_FMT_JPEG_1X8 = 0x4001, 94 V4L2_MBUS_FMT_JPEG_1X8 = 0x4001,
95
96 /* Vendor specific formats - next is 0x5002 */
97
98 /* S5C73M3 sensor specific interleaved UYVY and JPEG */
99 V4L2_MBUS_FMT_S5C_UYVY_JPEG_1X8 = 0x5001,
95}; 100};
96 101
97/** 102/**
diff --git a/include/linux/v4l2-subdev.h b/include/uapi/linux/v4l2-subdev.h
index 8c57ee9872bb..a33c4daadce3 100644
--- a/include/linux/v4l2-subdev.h
+++ b/include/uapi/linux/v4l2-subdev.h
@@ -148,6 +148,14 @@ struct v4l2_subdev_selection {
148 __u32 reserved[8]; 148 __u32 reserved[8];
149}; 149};
150 150
151struct v4l2_subdev_edid {
152 __u32 pad;
153 __u32 start_block;
154 __u32 blocks;
155 __u32 reserved[5];
156 __u8 __user *edid;
157};
158
151#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format) 159#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format)
152#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format) 160#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format)
153#define VIDIOC_SUBDEV_G_FRAME_INTERVAL \ 161#define VIDIOC_SUBDEV_G_FRAME_INTERVAL \
@@ -166,5 +174,7 @@ struct v4l2_subdev_selection {
166 _IOWR('V', 61, struct v4l2_subdev_selection) 174 _IOWR('V', 61, struct v4l2_subdev_selection)
167#define VIDIOC_SUBDEV_S_SELECTION \ 175#define VIDIOC_SUBDEV_S_SELECTION \
168 _IOWR('V', 62, struct v4l2_subdev_selection) 176 _IOWR('V', 62, struct v4l2_subdev_selection)
177#define VIDIOC_SUBDEV_G_EDID _IOWR('V', 40, struct v4l2_subdev_edid)
178#define VIDIOC_SUBDEV_S_EDID _IOWR('V', 41, struct v4l2_subdev_edid)
169 179
170#endif 180#endif
diff --git a/include/linux/veth.h b/include/uapi/linux/veth.h
index 3354c1eb424e..3354c1eb424e 100644
--- a/include/linux/veth.h
+++ b/include/uapi/linux/veth.h
diff --git a/include/uapi/linux/vfio.h b/include/uapi/linux/vfio.h
new file mode 100644
index 000000000000..4758d1bfcf41
--- /dev/null
+++ b/include/uapi/linux/vfio.h
@@ -0,0 +1,368 @@
1/*
2 * VFIO API definition
3 *
4 * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
5 * Author: Alex Williamson <alex.williamson@redhat.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#ifndef _UAPIVFIO_H
12#define _UAPIVFIO_H
13
14#include <linux/types.h>
15#include <linux/ioctl.h>
16
17#define VFIO_API_VERSION 0
18
19
20/* Kernel & User level defines for VFIO IOCTLs. */
21
22/* Extensions */
23
24#define VFIO_TYPE1_IOMMU 1
25
26/*
27 * The IOCTL interface is designed for extensibility by embedding the
28 * structure length (argsz) and flags into structures passed between
29 * kernel and userspace. We therefore use the _IO() macro for these
30 * defines to avoid implicitly embedding a size into the ioctl request.
31 * As structure fields are added, argsz will increase to match and flag
32 * bits will be defined to indicate additional fields with valid data.
33 * It's *always* the caller's responsibility to indicate the size of
34 * the structure passed by setting argsz appropriately.
35 */
36
37#define VFIO_TYPE (';')
38#define VFIO_BASE 100
39
40/* -------- IOCTLs for VFIO file descriptor (/dev/vfio/vfio) -------- */
41
42/**
43 * VFIO_GET_API_VERSION - _IO(VFIO_TYPE, VFIO_BASE + 0)
44 *
45 * Report the version of the VFIO API. This allows us to bump the entire
46 * API version should we later need to add or change features in incompatible
47 * ways.
48 * Return: VFIO_API_VERSION
49 * Availability: Always
50 */
51#define VFIO_GET_API_VERSION _IO(VFIO_TYPE, VFIO_BASE + 0)
52
53/**
54 * VFIO_CHECK_EXTENSION - _IOW(VFIO_TYPE, VFIO_BASE + 1, __u32)
55 *
56 * Check whether an extension is supported.
57 * Return: 0 if not supported, 1 (or some other positive integer) if supported.
58 * Availability: Always
59 */
60#define VFIO_CHECK_EXTENSION _IO(VFIO_TYPE, VFIO_BASE + 1)
61
62/**
63 * VFIO_SET_IOMMU - _IOW(VFIO_TYPE, VFIO_BASE + 2, __s32)
64 *
65 * Set the iommu to the given type. The type must be supported by an
66 * iommu driver as verified by calling CHECK_EXTENSION using the same
67 * type. A group must be set to this file descriptor before this
68 * ioctl is available. The IOMMU interfaces enabled by this call are
69 * specific to the value set.
70 * Return: 0 on success, -errno on failure
71 * Availability: When VFIO group attached
72 */
73#define VFIO_SET_IOMMU _IO(VFIO_TYPE, VFIO_BASE + 2)
74
75/* -------- IOCTLs for GROUP file descriptors (/dev/vfio/$GROUP) -------- */
76
77/**
78 * VFIO_GROUP_GET_STATUS - _IOR(VFIO_TYPE, VFIO_BASE + 3,
79 * struct vfio_group_status)
80 *
81 * Retrieve information about the group. Fills in provided
82 * struct vfio_group_info. Caller sets argsz.
83 * Return: 0 on succes, -errno on failure.
84 * Availability: Always
85 */
86struct vfio_group_status {
87 __u32 argsz;
88 __u32 flags;
89#define VFIO_GROUP_FLAGS_VIABLE (1 << 0)
90#define VFIO_GROUP_FLAGS_CONTAINER_SET (1 << 1)
91};
92#define VFIO_GROUP_GET_STATUS _IO(VFIO_TYPE, VFIO_BASE + 3)
93
94/**
95 * VFIO_GROUP_SET_CONTAINER - _IOW(VFIO_TYPE, VFIO_BASE + 4, __s32)
96 *
97 * Set the container for the VFIO group to the open VFIO file
98 * descriptor provided. Groups may only belong to a single
99 * container. Containers may, at their discretion, support multiple
100 * groups. Only when a container is set are all of the interfaces
101 * of the VFIO file descriptor and the VFIO group file descriptor
102 * available to the user.
103 * Return: 0 on success, -errno on failure.
104 * Availability: Always
105 */
106#define VFIO_GROUP_SET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 4)
107
108/**
109 * VFIO_GROUP_UNSET_CONTAINER - _IO(VFIO_TYPE, VFIO_BASE + 5)
110 *
111 * Remove the group from the attached container. This is the
112 * opposite of the SET_CONTAINER call and returns the group to
113 * an initial state. All device file descriptors must be released
114 * prior to calling this interface. When removing the last group
115 * from a container, the IOMMU will be disabled and all state lost,
116 * effectively also returning the VFIO file descriptor to an initial
117 * state.
118 * Return: 0 on success, -errno on failure.
119 * Availability: When attached to container
120 */
121#define VFIO_GROUP_UNSET_CONTAINER _IO(VFIO_TYPE, VFIO_BASE + 5)
122
123/**
124 * VFIO_GROUP_GET_DEVICE_FD - _IOW(VFIO_TYPE, VFIO_BASE + 6, char)
125 *
126 * Return a new file descriptor for the device object described by
127 * the provided string. The string should match a device listed in
128 * the devices subdirectory of the IOMMU group sysfs entry. The
129 * group containing the device must already be added to this context.
130 * Return: new file descriptor on success, -errno on failure.
131 * Availability: When attached to container
132 */
133#define VFIO_GROUP_GET_DEVICE_FD _IO(VFIO_TYPE, VFIO_BASE + 6)
134
135/* --------------- IOCTLs for DEVICE file descriptors --------------- */
136
137/**
138 * VFIO_DEVICE_GET_INFO - _IOR(VFIO_TYPE, VFIO_BASE + 7,
139 * struct vfio_device_info)
140 *
141 * Retrieve information about the device. Fills in provided
142 * struct vfio_device_info. Caller sets argsz.
143 * Return: 0 on success, -errno on failure.
144 */
145struct vfio_device_info {
146 __u32 argsz;
147 __u32 flags;
148#define VFIO_DEVICE_FLAGS_RESET (1 << 0) /* Device supports reset */
149#define VFIO_DEVICE_FLAGS_PCI (1 << 1) /* vfio-pci device */
150 __u32 num_regions; /* Max region index + 1 */
151 __u32 num_irqs; /* Max IRQ index + 1 */
152};
153#define VFIO_DEVICE_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 7)
154
155/**
156 * VFIO_DEVICE_GET_REGION_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 8,
157 * struct vfio_region_info)
158 *
159 * Retrieve information about a device region. Caller provides
160 * struct vfio_region_info with index value set. Caller sets argsz.
161 * Implementation of region mapping is bus driver specific. This is
162 * intended to describe MMIO, I/O port, as well as bus specific
163 * regions (ex. PCI config space). Zero sized regions may be used
164 * to describe unimplemented regions (ex. unimplemented PCI BARs).
165 * Return: 0 on success, -errno on failure.
166 */
167struct vfio_region_info {
168 __u32 argsz;
169 __u32 flags;
170#define VFIO_REGION_INFO_FLAG_READ (1 << 0) /* Region supports read */
171#define VFIO_REGION_INFO_FLAG_WRITE (1 << 1) /* Region supports write */
172#define VFIO_REGION_INFO_FLAG_MMAP (1 << 2) /* Region supports mmap */
173 __u32 index; /* Region index */
174 __u32 resv; /* Reserved for alignment */
175 __u64 size; /* Region size (bytes) */
176 __u64 offset; /* Region offset from start of device fd */
177};
178#define VFIO_DEVICE_GET_REGION_INFO _IO(VFIO_TYPE, VFIO_BASE + 8)
179
180/**
181 * VFIO_DEVICE_GET_IRQ_INFO - _IOWR(VFIO_TYPE, VFIO_BASE + 9,
182 * struct vfio_irq_info)
183 *
184 * Retrieve information about a device IRQ. Caller provides
185 * struct vfio_irq_info with index value set. Caller sets argsz.
186 * Implementation of IRQ mapping is bus driver specific. Indexes
187 * using multiple IRQs are primarily intended to support MSI-like
188 * interrupt blocks. Zero count irq blocks may be used to describe
189 * unimplemented interrupt types.
190 *
191 * The EVENTFD flag indicates the interrupt index supports eventfd based
192 * signaling.
193 *
194 * The MASKABLE flags indicates the index supports MASK and UNMASK
195 * actions described below.
196 *
197 * AUTOMASKED indicates that after signaling, the interrupt line is
198 * automatically masked by VFIO and the user needs to unmask the line
199 * to receive new interrupts. This is primarily intended to distinguish
200 * level triggered interrupts.
201 *
202 * The NORESIZE flag indicates that the interrupt lines within the index
203 * are setup as a set and new subindexes cannot be enabled without first
204 * disabling the entire index. This is used for interrupts like PCI MSI
205 * and MSI-X where the driver may only use a subset of the available
206 * indexes, but VFIO needs to enable a specific number of vectors
207 * upfront. In the case of MSI-X, where the user can enable MSI-X and
208 * then add and unmask vectors, it's up to userspace to make the decision
209 * whether to allocate the maximum supported number of vectors or tear
210 * down setup and incrementally increase the vectors as each is enabled.
211 */
212struct vfio_irq_info {
213 __u32 argsz;
214 __u32 flags;
215#define VFIO_IRQ_INFO_EVENTFD (1 << 0)
216#define VFIO_IRQ_INFO_MASKABLE (1 << 1)
217#define VFIO_IRQ_INFO_AUTOMASKED (1 << 2)
218#define VFIO_IRQ_INFO_NORESIZE (1 << 3)
219 __u32 index; /* IRQ index */
220 __u32 count; /* Number of IRQs within this index */
221};
222#define VFIO_DEVICE_GET_IRQ_INFO _IO(VFIO_TYPE, VFIO_BASE + 9)
223
224/**
225 * VFIO_DEVICE_SET_IRQS - _IOW(VFIO_TYPE, VFIO_BASE + 10, struct vfio_irq_set)
226 *
227 * Set signaling, masking, and unmasking of interrupts. Caller provides
228 * struct vfio_irq_set with all fields set. 'start' and 'count' indicate
229 * the range of subindexes being specified.
230 *
231 * The DATA flags specify the type of data provided. If DATA_NONE, the
232 * operation performs the specified action immediately on the specified
233 * interrupt(s). For example, to unmask AUTOMASKED interrupt [0,0]:
234 * flags = (DATA_NONE|ACTION_UNMASK), index = 0, start = 0, count = 1.
235 *
236 * DATA_BOOL allows sparse support for the same on arrays of interrupts.
237 * For example, to mask interrupts [0,1] and [0,3] (but not [0,2]):
238 * flags = (DATA_BOOL|ACTION_MASK), index = 0, start = 1, count = 3,
239 * data = {1,0,1}
240 *
241 * DATA_EVENTFD binds the specified ACTION to the provided __s32 eventfd.
242 * A value of -1 can be used to either de-assign interrupts if already
243 * assigned or skip un-assigned interrupts. For example, to set an eventfd
244 * to be trigger for interrupts [0,0] and [0,2]:
245 * flags = (DATA_EVENTFD|ACTION_TRIGGER), index = 0, start = 0, count = 3,
246 * data = {fd1, -1, fd2}
247 * If index [0,1] is previously set, two count = 1 ioctls calls would be
248 * required to set [0,0] and [0,2] without changing [0,1].
249 *
250 * Once a signaling mechanism is set, DATA_BOOL or DATA_NONE can be used
251 * with ACTION_TRIGGER to perform kernel level interrupt loopback testing
252 * from userspace (ie. simulate hardware triggering).
253 *
254 * Setting of an event triggering mechanism to userspace for ACTION_TRIGGER
255 * enables the interrupt index for the device. Individual subindex interrupts
256 * can be disabled using the -1 value for DATA_EVENTFD or the index can be
257 * disabled as a whole with: flags = (DATA_NONE|ACTION_TRIGGER), count = 0.
258 *
259 * Note that ACTION_[UN]MASK specify user->kernel signaling (irqfds) while
260 * ACTION_TRIGGER specifies kernel->user signaling.
261 */
262struct vfio_irq_set {
263 __u32 argsz;
264 __u32 flags;
265#define VFIO_IRQ_SET_DATA_NONE (1 << 0) /* Data not present */
266#define VFIO_IRQ_SET_DATA_BOOL (1 << 1) /* Data is bool (u8) */
267#define VFIO_IRQ_SET_DATA_EVENTFD (1 << 2) /* Data is eventfd (s32) */
268#define VFIO_IRQ_SET_ACTION_MASK (1 << 3) /* Mask interrupt */
269#define VFIO_IRQ_SET_ACTION_UNMASK (1 << 4) /* Unmask interrupt */
270#define VFIO_IRQ_SET_ACTION_TRIGGER (1 << 5) /* Trigger interrupt */
271 __u32 index;
272 __u32 start;
273 __u32 count;
274 __u8 data[];
275};
276#define VFIO_DEVICE_SET_IRQS _IO(VFIO_TYPE, VFIO_BASE + 10)
277
278#define VFIO_IRQ_SET_DATA_TYPE_MASK (VFIO_IRQ_SET_DATA_NONE | \
279 VFIO_IRQ_SET_DATA_BOOL | \
280 VFIO_IRQ_SET_DATA_EVENTFD)
281#define VFIO_IRQ_SET_ACTION_TYPE_MASK (VFIO_IRQ_SET_ACTION_MASK | \
282 VFIO_IRQ_SET_ACTION_UNMASK | \
283 VFIO_IRQ_SET_ACTION_TRIGGER)
284/**
285 * VFIO_DEVICE_RESET - _IO(VFIO_TYPE, VFIO_BASE + 11)
286 *
287 * Reset a device.
288 */
289#define VFIO_DEVICE_RESET _IO(VFIO_TYPE, VFIO_BASE + 11)
290
291/*
292 * The VFIO-PCI bus driver makes use of the following fixed region and
293 * IRQ index mapping. Unimplemented regions return a size of zero.
294 * Unimplemented IRQ types return a count of zero.
295 */
296
297enum {
298 VFIO_PCI_BAR0_REGION_INDEX,
299 VFIO_PCI_BAR1_REGION_INDEX,
300 VFIO_PCI_BAR2_REGION_INDEX,
301 VFIO_PCI_BAR3_REGION_INDEX,
302 VFIO_PCI_BAR4_REGION_INDEX,
303 VFIO_PCI_BAR5_REGION_INDEX,
304 VFIO_PCI_ROM_REGION_INDEX,
305 VFIO_PCI_CONFIG_REGION_INDEX,
306 VFIO_PCI_NUM_REGIONS
307};
308
309enum {
310 VFIO_PCI_INTX_IRQ_INDEX,
311 VFIO_PCI_MSI_IRQ_INDEX,
312 VFIO_PCI_MSIX_IRQ_INDEX,
313 VFIO_PCI_NUM_IRQS
314};
315
316/* -------- API for Type1 VFIO IOMMU -------- */
317
318/**
319 * VFIO_IOMMU_GET_INFO - _IOR(VFIO_TYPE, VFIO_BASE + 12, struct vfio_iommu_info)
320 *
321 * Retrieve information about the IOMMU object. Fills in provided
322 * struct vfio_iommu_info. Caller sets argsz.
323 *
324 * XXX Should we do these by CHECK_EXTENSION too?
325 */
326struct vfio_iommu_type1_info {
327 __u32 argsz;
328 __u32 flags;
329#define VFIO_IOMMU_INFO_PGSIZES (1 << 0) /* supported page sizes info */
330 __u64 iova_pgsizes; /* Bitmap of supported page sizes */
331};
332
333#define VFIO_IOMMU_GET_INFO _IO(VFIO_TYPE, VFIO_BASE + 12)
334
335/**
336 * VFIO_IOMMU_MAP_DMA - _IOW(VFIO_TYPE, VFIO_BASE + 13, struct vfio_dma_map)
337 *
338 * Map process virtual addresses to IO virtual addresses using the
339 * provided struct vfio_dma_map. Caller sets argsz. READ &/ WRITE required.
340 */
341struct vfio_iommu_type1_dma_map {
342 __u32 argsz;
343 __u32 flags;
344#define VFIO_DMA_MAP_FLAG_READ (1 << 0) /* readable from device */
345#define VFIO_DMA_MAP_FLAG_WRITE (1 << 1) /* writable from device */
346 __u64 vaddr; /* Process virtual address */
347 __u64 iova; /* IO virtual address */
348 __u64 size; /* Size of mapping (bytes) */
349};
350
351#define VFIO_IOMMU_MAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 13)
352
353/**
354 * VFIO_IOMMU_UNMAP_DMA - _IOW(VFIO_TYPE, VFIO_BASE + 14, struct vfio_dma_unmap)
355 *
356 * Unmap IO virtual addresses using the provided struct vfio_dma_unmap.
357 * Caller sets argsz.
358 */
359struct vfio_iommu_type1_dma_unmap {
360 __u32 argsz;
361 __u32 flags;
362 __u64 iova; /* IO virtual address */
363 __u64 size; /* Size of mapping (bytes) */
364};
365
366#define VFIO_IOMMU_UNMAP_DMA _IO(VFIO_TYPE, VFIO_BASE + 14)
367
368#endif /* _UAPIVFIO_H */
diff --git a/include/linux/vhost.h b/include/uapi/linux/vhost.h
index e847f1e30756..e847f1e30756 100644
--- a/include/linux/vhost.h
+++ b/include/uapi/linux/vhost.h
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
new file mode 100644
index 000000000000..57bfa59cda74
--- /dev/null
+++ b/include/uapi/linux/videodev2.h
@@ -0,0 +1,1998 @@
1/*
2 * Video for Linux Two header file
3 *
4 * Copyright (C) 1999-2012 the contributors
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 * Alternatively you can redistribute this file under the terms of the
17 * BSD license as stated below:
18 *
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions
21 * are met:
22 * 1. Redistributions of source code must retain the above copyright
23 * notice, this list of conditions and the following disclaimer.
24 * 2. Redistributions in binary form must reproduce the above copyright
25 * notice, this list of conditions and the following disclaimer in
26 * the documentation and/or other materials provided with the
27 * distribution.
28 * 3. The names of its contributors may not be used to endorse or promote
29 * products derived from this software without specific prior written
30 * permission.
31 *
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
35 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
36 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
37 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
38 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
39 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
40 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 *
44 * Header file for v4l or V4L2 drivers and applications
45 * with public API.
46 * All kernel-specific stuff were moved to media/v4l2-dev.h, so
47 * no #if __KERNEL tests are allowed here
48 *
49 * See http://linuxtv.org for more info
50 *
51 * Author: Bill Dirks <bill@thedirks.org>
52 * Justin Schoeman
53 * Hans Verkuil <hverkuil@xs4all.nl>
54 * et al.
55 */
56#ifndef _UAPI__LINUX_VIDEODEV2_H
57#define _UAPI__LINUX_VIDEODEV2_H
58
59#ifndef __KERNEL__
60#include <sys/time.h>
61#endif
62#include <linux/compiler.h>
63#include <linux/ioctl.h>
64#include <linux/types.h>
65#include <linux/v4l2-common.h>
66#include <linux/v4l2-controls.h>
67
68/*
69 * Common stuff for both V4L1 and V4L2
70 * Moved from videodev.h
71 */
72#define VIDEO_MAX_FRAME 32
73#define VIDEO_MAX_PLANES 8
74
75#ifndef __KERNEL__
76
77/* These defines are V4L1 specific and should not be used with the V4L2 API!
78 They will be removed from this header in the future. */
79
80#define VID_TYPE_CAPTURE 1 /* Can capture */
81#define VID_TYPE_TUNER 2 /* Can tune */
82#define VID_TYPE_TELETEXT 4 /* Does teletext */
83#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
84#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
85#define VID_TYPE_CLIPPING 32 /* Can clip */
86#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
87#define VID_TYPE_SCALES 128 /* Scalable */
88#define VID_TYPE_MONOCHROME 256 /* Monochrome only */
89#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
90#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
91#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
92#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
93#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
94#endif
95
96/*
97 * M I S C E L L A N E O U S
98 */
99
100/* Four-character-code (FOURCC) */
101#define v4l2_fourcc(a, b, c, d)\
102 ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24))
103
104/*
105 * E N U M S
106 */
107enum v4l2_field {
108 V4L2_FIELD_ANY = 0, /* driver can choose from none,
109 top, bottom, interlaced
110 depending on whatever it thinks
111 is approximate ... */
112 V4L2_FIELD_NONE = 1, /* this device has no fields ... */
113 V4L2_FIELD_TOP = 2, /* top field only */
114 V4L2_FIELD_BOTTOM = 3, /* bottom field only */
115 V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */
116 V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one
117 buffer, top-bottom order */
118 V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */
119 V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into
120 separate buffers */
121 V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field
122 first and the top field is
123 transmitted first */
124 V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field
125 first and the bottom field is
126 transmitted first */
127};
128#define V4L2_FIELD_HAS_TOP(field) \
129 ((field) == V4L2_FIELD_TOP ||\
130 (field) == V4L2_FIELD_INTERLACED ||\
131 (field) == V4L2_FIELD_INTERLACED_TB ||\
132 (field) == V4L2_FIELD_INTERLACED_BT ||\
133 (field) == V4L2_FIELD_SEQ_TB ||\
134 (field) == V4L2_FIELD_SEQ_BT)
135#define V4L2_FIELD_HAS_BOTTOM(field) \
136 ((field) == V4L2_FIELD_BOTTOM ||\
137 (field) == V4L2_FIELD_INTERLACED ||\
138 (field) == V4L2_FIELD_INTERLACED_TB ||\
139 (field) == V4L2_FIELD_INTERLACED_BT ||\
140 (field) == V4L2_FIELD_SEQ_TB ||\
141 (field) == V4L2_FIELD_SEQ_BT)
142#define V4L2_FIELD_HAS_BOTH(field) \
143 ((field) == V4L2_FIELD_INTERLACED ||\
144 (field) == V4L2_FIELD_INTERLACED_TB ||\
145 (field) == V4L2_FIELD_INTERLACED_BT ||\
146 (field) == V4L2_FIELD_SEQ_TB ||\
147 (field) == V4L2_FIELD_SEQ_BT)
148
149enum v4l2_buf_type {
150 V4L2_BUF_TYPE_VIDEO_CAPTURE = 1,
151 V4L2_BUF_TYPE_VIDEO_OUTPUT = 2,
152 V4L2_BUF_TYPE_VIDEO_OVERLAY = 3,
153 V4L2_BUF_TYPE_VBI_CAPTURE = 4,
154 V4L2_BUF_TYPE_VBI_OUTPUT = 5,
155 V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6,
156 V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7,
157#if 1
158 /* Experimental */
159 V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8,
160#endif
161 V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9,
162 V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10,
163 /* Deprecated, do not use */
164 V4L2_BUF_TYPE_PRIVATE = 0x80,
165};
166
167#define V4L2_TYPE_IS_MULTIPLANAR(type) \
168 ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE \
169 || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
170
171#define V4L2_TYPE_IS_OUTPUT(type) \
172 ((type) == V4L2_BUF_TYPE_VIDEO_OUTPUT \
173 || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE \
174 || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY \
175 || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY \
176 || (type) == V4L2_BUF_TYPE_VBI_OUTPUT \
177 || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT)
178
179enum v4l2_tuner_type {
180 V4L2_TUNER_RADIO = 1,
181 V4L2_TUNER_ANALOG_TV = 2,
182 V4L2_TUNER_DIGITAL_TV = 3,
183};
184
185enum v4l2_memory {
186 V4L2_MEMORY_MMAP = 1,
187 V4L2_MEMORY_USERPTR = 2,
188 V4L2_MEMORY_OVERLAY = 3,
189};
190
191/* see also http://vektor.theorem.ca/graphics/ycbcr/ */
192enum v4l2_colorspace {
193 /* ITU-R 601 -- broadcast NTSC/PAL */
194 V4L2_COLORSPACE_SMPTE170M = 1,
195
196 /* 1125-Line (US) HDTV */
197 V4L2_COLORSPACE_SMPTE240M = 2,
198
199 /* HD and modern captures. */
200 V4L2_COLORSPACE_REC709 = 3,
201
202 /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */
203 V4L2_COLORSPACE_BT878 = 4,
204
205 /* These should be useful. Assume 601 extents. */
206 V4L2_COLORSPACE_470_SYSTEM_M = 5,
207 V4L2_COLORSPACE_470_SYSTEM_BG = 6,
208
209 /* I know there will be cameras that send this. So, this is
210 * unspecified chromaticities and full 0-255 on each of the
211 * Y'CbCr components
212 */
213 V4L2_COLORSPACE_JPEG = 7,
214
215 /* For RGB colourspaces, this is probably a good start. */
216 V4L2_COLORSPACE_SRGB = 8,
217};
218
219enum v4l2_priority {
220 V4L2_PRIORITY_UNSET = 0, /* not initialized */
221 V4L2_PRIORITY_BACKGROUND = 1,
222 V4L2_PRIORITY_INTERACTIVE = 2,
223 V4L2_PRIORITY_RECORD = 3,
224 V4L2_PRIORITY_DEFAULT = V4L2_PRIORITY_INTERACTIVE,
225};
226
227struct v4l2_rect {
228 __s32 left;
229 __s32 top;
230 __s32 width;
231 __s32 height;
232};
233
234struct v4l2_fract {
235 __u32 numerator;
236 __u32 denominator;
237};
238
239/**
240 * struct v4l2_capability - Describes V4L2 device caps returned by VIDIOC_QUERYCAP
241 *
242 * @driver: name of the driver module (e.g. "bttv")
243 * @card: name of the card (e.g. "Hauppauge WinTV")
244 * @bus_info: name of the bus (e.g. "PCI:" + pci_name(pci_dev) )
245 * @version: KERNEL_VERSION
246 * @capabilities: capabilities of the physical device as a whole
247 * @device_caps: capabilities accessed via this particular device (node)
248 * @reserved: reserved fields for future extensions
249 */
250struct v4l2_capability {
251 __u8 driver[16];
252 __u8 card[32];
253 __u8 bus_info[32];
254 __u32 version;
255 __u32 capabilities;
256 __u32 device_caps;
257 __u32 reserved[3];
258};
259
260/* Values for 'capabilities' field */
261#define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */
262#define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */
263#define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */
264#define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */
265#define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */
266#define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */
267#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */
268#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */
269#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */
270#define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */
271#define V4L2_CAP_RDS_OUTPUT 0x00000800 /* Is an RDS encoder */
272
273/* Is a video capture device that supports multiplanar formats */
274#define V4L2_CAP_VIDEO_CAPTURE_MPLANE 0x00001000
275/* Is a video output device that supports multiplanar formats */
276#define V4L2_CAP_VIDEO_OUTPUT_MPLANE 0x00002000
277/* Is a video mem-to-mem device that supports multiplanar formats */
278#define V4L2_CAP_VIDEO_M2M_MPLANE 0x00004000
279/* Is a video mem-to-mem device */
280#define V4L2_CAP_VIDEO_M2M 0x00008000
281
282#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */
283#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */
284#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */
285#define V4L2_CAP_MODULATOR 0x00080000 /* has a modulator */
286
287#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */
288#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */
289#define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */
290
291#define V4L2_CAP_DEVICE_CAPS 0x80000000 /* sets device capabilities field */
292
293/*
294 * V I D E O I M A G E F O R M A T
295 */
296struct v4l2_pix_format {
297 __u32 width;
298 __u32 height;
299 __u32 pixelformat;
300 __u32 field; /* enum v4l2_field */
301 __u32 bytesperline; /* for padding, zero if unused */
302 __u32 sizeimage;
303 __u32 colorspace; /* enum v4l2_colorspace */
304 __u32 priv; /* private data, depends on pixelformat */
305};
306
307/* Pixel format FOURCC depth Description */
308
309/* RGB formats */
310#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */
311#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */
312#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */
313#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */
314#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */
315#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */
316#define V4L2_PIX_FMT_BGR666 v4l2_fourcc('B', 'G', 'R', 'H') /* 18 BGR-6-6-6 */
317#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */
318#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */
319#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */
320#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */
321
322/* Grey formats */
323#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */
324#define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */
325#define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */
326#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */
327#define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ') /* 12 Greyscale */
328#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */
329
330/* Grey bit-packed formats */
331#define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */
332
333/* Palette formats */
334#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */
335
336/* Luminance+Chrominance formats */
337#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */
338#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */
339#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */
340#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */
341#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
342#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */
343#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */
344#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */
345#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 16 YVU411 planar */
346#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */
347#define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y', '4', '4', '4') /* 16 xxxxyyyy uuuuvvvv */
348#define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */
349#define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */
350#define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */
351#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */
352#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */
353#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */
354#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */
355#define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0') /* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */
356
357/* two planes -- one Y, one Cr + Cb interleaved */
358#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */
359#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */
360#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */
361#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
362#define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */
363#define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */
364
365/* two non contiguous planes - one Y, one Cr + Cb interleaved */
366#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
367#define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1') /* 21 Y/CrCb 4:2:0 */
368#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */
369#define V4L2_PIX_FMT_NV12MT_16X16 v4l2_fourcc('V', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 16x16 macroblocks */
370
371/* three non contiguous planes - Y, Cb, Cr */
372#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12 YUV420 planar */
373#define V4L2_PIX_FMT_YVU420M v4l2_fourcc('Y', 'M', '2', '1') /* 12 YVU420 planar */
374
375/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
376#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */
377#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */
378#define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */
379#define V4L2_PIX_FMT_SRGGB8 v4l2_fourcc('R', 'G', 'G', 'B') /* 8 RGRG.. GBGB.. */
380#define V4L2_PIX_FMT_SBGGR10 v4l2_fourcc('B', 'G', '1', '0') /* 10 BGBG.. GRGR.. */
381#define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */
382#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */
383#define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */
384#define V4L2_PIX_FMT_SBGGR12 v4l2_fourcc('B', 'G', '1', '2') /* 12 BGBG.. GRGR.. */
385#define V4L2_PIX_FMT_SGBRG12 v4l2_fourcc('G', 'B', '1', '2') /* 12 GBGB.. RGRG.. */
386#define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12 GRGR.. BGBG.. */
387#define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12 RGRG.. GBGB.. */
388 /* 10bit raw bayer DPCM compressed to 8 bits */
389#define V4L2_PIX_FMT_SBGGR10DPCM8 v4l2_fourcc('b', 'B', 'A', '8')
390#define V4L2_PIX_FMT_SGBRG10DPCM8 v4l2_fourcc('b', 'G', 'A', '8')
391#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0')
392#define V4L2_PIX_FMT_SRGGB10DPCM8 v4l2_fourcc('b', 'R', 'A', '8')
393 /*
394 * 10bit raw bayer, expanded to 16 bits
395 * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb...
396 */
397#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */
398
399/* compressed formats */
400#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */
401#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */
402#define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */
403#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 Multiplexed */
404#define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4') /* H264 with start codes */
405#define V4L2_PIX_FMT_H264_NO_SC v4l2_fourcc('A', 'V', 'C', '1') /* H264 without start codes */
406#define V4L2_PIX_FMT_H264_MVC v4l2_fourcc('M', '2', '6', '4') /* H264 MVC */
407#define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /* H263 */
408#define V4L2_PIX_FMT_MPEG1 v4l2_fourcc('M', 'P', 'G', '1') /* MPEG-1 ES */
409#define V4L2_PIX_FMT_MPEG2 v4l2_fourcc('M', 'P', 'G', '2') /* MPEG-2 ES */
410#define V4L2_PIX_FMT_MPEG4 v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4 ES */
411#define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid */
412#define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */
413#define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M Annex L compliant stream */
414#define V4L2_PIX_FMT_VP8 v4l2_fourcc('V', 'P', '8', '0') /* VP8 */
415
416/* Vendor-specific formats */
417#define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
418#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */
419#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */
420#define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */
421#define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P', 'W', 'C', '1') /* pwc older webcam */
422#define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P', 'W', 'C', '2') /* pwc newer webcam */
423#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5') /* ET61X251 compression */
424#define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S', '5', '0', '1') /* YUYV per line */
425#define V4L2_PIX_FMT_SPCA505 v4l2_fourcc('S', '5', '0', '5') /* YYUV per line */
426#define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */
427#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */
428#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */
429#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */
430#define V4L2_PIX_FMT_JL2005BCD v4l2_fourcc('J', 'L', '2', '0') /* compressed RGGB bayer */
431#define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */
432#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
433#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
434#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */
435#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */
436#define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */
437#define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */
438#define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */
439#define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */
440#define V4L2_PIX_FMT_JPGL v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */
441#define V4L2_PIX_FMT_SE401 v4l2_fourcc('S', '4', '0', '1') /* se401 janggu compressed rgb */
442#define V4L2_PIX_FMT_S5C_UYVY_JPG v4l2_fourcc('S', '5', 'C', 'I') /* S5C73M3 interleaved UYVY/JPEG */
443
444/*
445 * F O R M A T E N U M E R A T I O N
446 */
447struct v4l2_fmtdesc {
448 __u32 index; /* Format number */
449 __u32 type; /* enum v4l2_buf_type */
450 __u32 flags;
451 __u8 description[32]; /* Description string */
452 __u32 pixelformat; /* Format fourcc */
453 __u32 reserved[4];
454};
455
456#define V4L2_FMT_FLAG_COMPRESSED 0x0001
457#define V4L2_FMT_FLAG_EMULATED 0x0002
458
459#if 1
460 /* Experimental Frame Size and frame rate enumeration */
461/*
462 * F R A M E S I Z E E N U M E R A T I O N
463 */
464enum v4l2_frmsizetypes {
465 V4L2_FRMSIZE_TYPE_DISCRETE = 1,
466 V4L2_FRMSIZE_TYPE_CONTINUOUS = 2,
467 V4L2_FRMSIZE_TYPE_STEPWISE = 3,
468};
469
470struct v4l2_frmsize_discrete {
471 __u32 width; /* Frame width [pixel] */
472 __u32 height; /* Frame height [pixel] */
473};
474
475struct v4l2_frmsize_stepwise {
476 __u32 min_width; /* Minimum frame width [pixel] */
477 __u32 max_width; /* Maximum frame width [pixel] */
478 __u32 step_width; /* Frame width step size [pixel] */
479 __u32 min_height; /* Minimum frame height [pixel] */
480 __u32 max_height; /* Maximum frame height [pixel] */
481 __u32 step_height; /* Frame height step size [pixel] */
482};
483
484struct v4l2_frmsizeenum {
485 __u32 index; /* Frame size number */
486 __u32 pixel_format; /* Pixel format */
487 __u32 type; /* Frame size type the device supports. */
488
489 union { /* Frame size */
490 struct v4l2_frmsize_discrete discrete;
491 struct v4l2_frmsize_stepwise stepwise;
492 };
493
494 __u32 reserved[2]; /* Reserved space for future use */
495};
496
497/*
498 * F R A M E R A T E E N U M E R A T I O N
499 */
500enum v4l2_frmivaltypes {
501 V4L2_FRMIVAL_TYPE_DISCRETE = 1,
502 V4L2_FRMIVAL_TYPE_CONTINUOUS = 2,
503 V4L2_FRMIVAL_TYPE_STEPWISE = 3,
504};
505
506struct v4l2_frmival_stepwise {
507 struct v4l2_fract min; /* Minimum frame interval [s] */
508 struct v4l2_fract max; /* Maximum frame interval [s] */
509 struct v4l2_fract step; /* Frame interval step size [s] */
510};
511
512struct v4l2_frmivalenum {
513 __u32 index; /* Frame format index */
514 __u32 pixel_format; /* Pixel format */
515 __u32 width; /* Frame width */
516 __u32 height; /* Frame height */
517 __u32 type; /* Frame interval type the device supports. */
518
519 union { /* Frame interval */
520 struct v4l2_fract discrete;
521 struct v4l2_frmival_stepwise stepwise;
522 };
523
524 __u32 reserved[2]; /* Reserved space for future use */
525};
526#endif
527
528/*
529 * T I M E C O D E
530 */
531struct v4l2_timecode {
532 __u32 type;
533 __u32 flags;
534 __u8 frames;
535 __u8 seconds;
536 __u8 minutes;
537 __u8 hours;
538 __u8 userbits[4];
539};
540
541/* Type */
542#define V4L2_TC_TYPE_24FPS 1
543#define V4L2_TC_TYPE_25FPS 2
544#define V4L2_TC_TYPE_30FPS 3
545#define V4L2_TC_TYPE_50FPS 4
546#define V4L2_TC_TYPE_60FPS 5
547
548/* Flags */
549#define V4L2_TC_FLAG_DROPFRAME 0x0001 /* "drop-frame" mode */
550#define V4L2_TC_FLAG_COLORFRAME 0x0002
551#define V4L2_TC_USERBITS_field 0x000C
552#define V4L2_TC_USERBITS_USERDEFINED 0x0000
553#define V4L2_TC_USERBITS_8BITCHARS 0x0008
554/* The above is based on SMPTE timecodes */
555
556struct v4l2_jpegcompression {
557 int quality;
558
559 int APPn; /* Number of APP segment to be written,
560 * must be 0..15 */
561 int APP_len; /* Length of data in JPEG APPn segment */
562 char APP_data[60]; /* Data in the JPEG APPn segment. */
563
564 int COM_len; /* Length of data in JPEG COM segment */
565 char COM_data[60]; /* Data in JPEG COM segment */
566
567 __u32 jpeg_markers; /* Which markers should go into the JPEG
568 * output. Unless you exactly know what
569 * you do, leave them untouched.
570 * Inluding less markers will make the
571 * resulting code smaller, but there will
572 * be fewer applications which can read it.
573 * The presence of the APP and COM marker
574 * is influenced by APP_len and COM_len
575 * ONLY, not by this property! */
576
577#define V4L2_JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */
578#define V4L2_JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */
579#define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */
580#define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */
581#define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will
582 * allways use APP0 */
583};
584
585/*
586 * M E M O R Y - M A P P I N G B U F F E R S
587 */
588struct v4l2_requestbuffers {
589 __u32 count;
590 __u32 type; /* enum v4l2_buf_type */
591 __u32 memory; /* enum v4l2_memory */
592 __u32 reserved[2];
593};
594
595/**
596 * struct v4l2_plane - plane info for multi-planar buffers
597 * @bytesused: number of bytes occupied by data in the plane (payload)
598 * @length: size of this plane (NOT the payload) in bytes
599 * @mem_offset: when memory in the associated struct v4l2_buffer is
600 * V4L2_MEMORY_MMAP, equals the offset from the start of
601 * the device memory for this plane (or is a "cookie" that
602 * should be passed to mmap() called on the video node)
603 * @userptr: when memory is V4L2_MEMORY_USERPTR, a userspace pointer
604 * pointing to this plane
605 * @data_offset: offset in the plane to the start of data; usually 0,
606 * unless there is a header in front of the data
607 *
608 * Multi-planar buffers consist of one or more planes, e.g. an YCbCr buffer
609 * with two planes can have one plane for Y, and another for interleaved CbCr
610 * components. Each plane can reside in a separate memory buffer, or even in
611 * a completely separate memory node (e.g. in embedded devices).
612 */
613struct v4l2_plane {
614 __u32 bytesused;
615 __u32 length;
616 union {
617 __u32 mem_offset;
618 unsigned long userptr;
619 } m;
620 __u32 data_offset;
621 __u32 reserved[11];
622};
623
624/**
625 * struct v4l2_buffer - video buffer info
626 * @index: id number of the buffer
627 * @type: enum v4l2_buf_type; buffer type (type == *_MPLANE for
628 * multiplanar buffers);
629 * @bytesused: number of bytes occupied by data in the buffer (payload);
630 * unused (set to 0) for multiplanar buffers
631 * @flags: buffer informational flags
632 * @field: enum v4l2_field; field order of the image in the buffer
633 * @timestamp: frame timestamp
634 * @timecode: frame timecode
635 * @sequence: sequence count of this frame
636 * @memory: enum v4l2_memory; the method, in which the actual video data is
637 * passed
638 * @offset: for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP;
639 * offset from the start of the device memory for this plane,
640 * (or a "cookie" that should be passed to mmap() as offset)
641 * @userptr: for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR;
642 * a userspace pointer pointing to this buffer
643 * @planes: for multiplanar buffers; userspace pointer to the array of plane
644 * info structs for this buffer
645 * @length: size in bytes of the buffer (NOT its payload) for single-plane
646 * buffers (when type != *_MPLANE); number of elements in the
647 * planes array for multi-plane buffers
648 * @input: input number from which the video data has has been captured
649 *
650 * Contains data exchanged by application and driver using one of the Streaming
651 * I/O methods.
652 */
653struct v4l2_buffer {
654 __u32 index;
655 __u32 type;
656 __u32 bytesused;
657 __u32 flags;
658 __u32 field;
659 struct timeval timestamp;
660 struct v4l2_timecode timecode;
661 __u32 sequence;
662
663 /* memory location */
664 __u32 memory;
665 union {
666 __u32 offset;
667 unsigned long userptr;
668 struct v4l2_plane *planes;
669 } m;
670 __u32 length;
671 __u32 reserved2;
672 __u32 reserved;
673};
674
675/* Flags for 'flags' field */
676#define V4L2_BUF_FLAG_MAPPED 0x0001 /* Buffer is mapped (flag) */
677#define V4L2_BUF_FLAG_QUEUED 0x0002 /* Buffer is queued for processing */
678#define V4L2_BUF_FLAG_DONE 0x0004 /* Buffer is ready */
679#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */
680#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */
681#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */
682/* Buffer is ready, but the data contained within is corrupted. */
683#define V4L2_BUF_FLAG_ERROR 0x0040
684#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */
685#define V4L2_BUF_FLAG_PREPARED 0x0400 /* Buffer is prepared for queuing */
686/* Cache handling flags */
687#define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x0800
688#define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x1000
689
690/*
691 * O V E R L A Y P R E V I E W
692 */
693struct v4l2_framebuffer {
694 __u32 capability;
695 __u32 flags;
696/* FIXME: in theory we should pass something like PCI device + memory
697 * region + offset instead of some physical address */
698 void *base;
699 struct v4l2_pix_format fmt;
700};
701/* Flags for the 'capability' field. Read only */
702#define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001
703#define V4L2_FBUF_CAP_CHROMAKEY 0x0002
704#define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004
705#define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008
706#define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010
707#define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020
708#define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040
709#define V4L2_FBUF_CAP_SRC_CHROMAKEY 0x0080
710/* Flags for the 'flags' field. */
711#define V4L2_FBUF_FLAG_PRIMARY 0x0001
712#define V4L2_FBUF_FLAG_OVERLAY 0x0002
713#define V4L2_FBUF_FLAG_CHROMAKEY 0x0004
714#define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008
715#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010
716#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020
717#define V4L2_FBUF_FLAG_SRC_CHROMAKEY 0x0040
718
719struct v4l2_clip {
720 struct v4l2_rect c;
721 struct v4l2_clip __user *next;
722};
723
724struct v4l2_window {
725 struct v4l2_rect w;
726 __u32 field; /* enum v4l2_field */
727 __u32 chromakey;
728 struct v4l2_clip __user *clips;
729 __u32 clipcount;
730 void __user *bitmap;
731 __u8 global_alpha;
732};
733
734/*
735 * C A P T U R E P A R A M E T E R S
736 */
737struct v4l2_captureparm {
738 __u32 capability; /* Supported modes */
739 __u32 capturemode; /* Current mode */
740 struct v4l2_fract timeperframe; /* Time per frame in .1us units */
741 __u32 extendedmode; /* Driver-specific extensions */
742 __u32 readbuffers; /* # of buffers for read */
743 __u32 reserved[4];
744};
745
746/* Flags for 'capability' and 'capturemode' fields */
747#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */
748#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */
749
750struct v4l2_outputparm {
751 __u32 capability; /* Supported modes */
752 __u32 outputmode; /* Current mode */
753 struct v4l2_fract timeperframe; /* Time per frame in seconds */
754 __u32 extendedmode; /* Driver-specific extensions */
755 __u32 writebuffers; /* # of buffers for write */
756 __u32 reserved[4];
757};
758
759/*
760 * I N P U T I M A G E C R O P P I N G
761 */
762struct v4l2_cropcap {
763 __u32 type; /* enum v4l2_buf_type */
764 struct v4l2_rect bounds;
765 struct v4l2_rect defrect;
766 struct v4l2_fract pixelaspect;
767};
768
769struct v4l2_crop {
770 __u32 type; /* enum v4l2_buf_type */
771 struct v4l2_rect c;
772};
773
774/**
775 * struct v4l2_selection - selection info
776 * @type: buffer type (do not use *_MPLANE types)
777 * @target: Selection target, used to choose one of possible rectangles;
778 * defined in v4l2-common.h; V4L2_SEL_TGT_* .
779 * @flags: constraints flags, defined in v4l2-common.h; V4L2_SEL_FLAG_*.
780 * @r: coordinates of selection window
781 * @reserved: for future use, rounds structure size to 64 bytes, set to zero
782 *
783 * Hardware may use multiple helper windows to process a video stream.
784 * The structure is used to exchange this selection areas between
785 * an application and a driver.
786 */
787struct v4l2_selection {
788 __u32 type;
789 __u32 target;
790 __u32 flags;
791 struct v4l2_rect r;
792 __u32 reserved[9];
793};
794
795
796/*
797 * A N A L O G V I D E O S T A N D A R D
798 */
799
800typedef __u64 v4l2_std_id;
801
802/* one bit for each */
803#define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001)
804#define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002)
805#define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004)
806#define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008)
807#define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010)
808#define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020)
809#define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040)
810#define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080)
811
812#define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100)
813#define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200)
814#define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400)
815#define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800)
816
817#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) /* BTSC */
818#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) /* EIA-J */
819#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000)
820#define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) /* FM A2 */
821
822#define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000)
823#define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000)
824#define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000)
825#define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000)
826#define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000)
827#define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000)
828#define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000)
829#define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000)
830
831/* ATSC/HDTV */
832#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000)
833#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000)
834
835/* FIXME:
836 Although std_id is 64 bits, there is an issue on PPC32 architecture that
837 makes switch(__u64) to break. So, there's a hack on v4l2-common.c rounding
838 this value to 32 bits.
839 As, currently, the max value is for V4L2_STD_ATSC_16_VSB (30 bits wide),
840 it should work fine. However, if needed to add more than two standards,
841 v4l2-common.c should be fixed.
842 */
843
844/*
845 * Some macros to merge video standards in order to make live easier for the
846 * drivers and V4L2 applications
847 */
848
849/*
850 * "Common" NTSC/M - It should be noticed that V4L2_STD_NTSC_443 is
851 * Missing here.
852 */
853#define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\
854 V4L2_STD_NTSC_M_JP |\
855 V4L2_STD_NTSC_M_KR)
856/* Secam macros */
857#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\
858 V4L2_STD_SECAM_K |\
859 V4L2_STD_SECAM_K1)
860/* All Secam Standards */
861#define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\
862 V4L2_STD_SECAM_G |\
863 V4L2_STD_SECAM_H |\
864 V4L2_STD_SECAM_DK |\
865 V4L2_STD_SECAM_L |\
866 V4L2_STD_SECAM_LC)
867/* PAL macros */
868#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\
869 V4L2_STD_PAL_B1 |\
870 V4L2_STD_PAL_G)
871#define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\
872 V4L2_STD_PAL_D1 |\
873 V4L2_STD_PAL_K)
874/*
875 * "Common" PAL - This macro is there to be compatible with the old
876 * V4L1 concept of "PAL": /BGDKHI.
877 * Several PAL standards are mising here: /M, /N and /Nc
878 */
879#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\
880 V4L2_STD_PAL_DK |\
881 V4L2_STD_PAL_H |\
882 V4L2_STD_PAL_I)
883/* Chroma "agnostic" standards */
884#define V4L2_STD_B (V4L2_STD_PAL_B |\
885 V4L2_STD_PAL_B1 |\
886 V4L2_STD_SECAM_B)
887#define V4L2_STD_G (V4L2_STD_PAL_G |\
888 V4L2_STD_SECAM_G)
889#define V4L2_STD_H (V4L2_STD_PAL_H |\
890 V4L2_STD_SECAM_H)
891#define V4L2_STD_L (V4L2_STD_SECAM_L |\
892 V4L2_STD_SECAM_LC)
893#define V4L2_STD_GH (V4L2_STD_G |\
894 V4L2_STD_H)
895#define V4L2_STD_DK (V4L2_STD_PAL_DK |\
896 V4L2_STD_SECAM_DK)
897#define V4L2_STD_BG (V4L2_STD_B |\
898 V4L2_STD_G)
899#define V4L2_STD_MN (V4L2_STD_PAL_M |\
900 V4L2_STD_PAL_N |\
901 V4L2_STD_PAL_Nc |\
902 V4L2_STD_NTSC)
903
904/* Standards where MTS/BTSC stereo could be found */
905#define V4L2_STD_MTS (V4L2_STD_NTSC_M |\
906 V4L2_STD_PAL_M |\
907 V4L2_STD_PAL_N |\
908 V4L2_STD_PAL_Nc)
909
910/* Standards for Countries with 60Hz Line frequency */
911#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\
912 V4L2_STD_PAL_60 |\
913 V4L2_STD_NTSC |\
914 V4L2_STD_NTSC_443)
915/* Standards for Countries with 50Hz Line frequency */
916#define V4L2_STD_625_50 (V4L2_STD_PAL |\
917 V4L2_STD_PAL_N |\
918 V4L2_STD_PAL_Nc |\
919 V4L2_STD_SECAM)
920
921#define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\
922 V4L2_STD_ATSC_16_VSB)
923/* Macros with none and all analog standards */
924#define V4L2_STD_UNKNOWN 0
925#define V4L2_STD_ALL (V4L2_STD_525_60 |\
926 V4L2_STD_625_50)
927
928struct v4l2_standard {
929 __u32 index;
930 v4l2_std_id id;
931 __u8 name[24];
932 struct v4l2_fract frameperiod; /* Frames, not fields */
933 __u32 framelines;
934 __u32 reserved[4];
935};
936
937/* The DV Preset API is deprecated in favor of the DV Timings API.
938 New drivers shouldn't use this anymore! */
939
940/*
941 * V I D E O T I M I N G S D V P R E S E T
942 */
943struct v4l2_dv_preset {
944 __u32 preset;
945 __u32 reserved[4];
946};
947
948/*
949 * D V P R E S E T S E N U M E R A T I O N
950 */
951struct v4l2_dv_enum_preset {
952 __u32 index;
953 __u32 preset;
954 __u8 name[32]; /* Name of the preset timing */
955 __u32 width;
956 __u32 height;
957 __u32 reserved[4];
958};
959
960/*
961 * D V P R E S E T V A L U E S
962 */
963#define V4L2_DV_INVALID 0
964#define V4L2_DV_480P59_94 1 /* BT.1362 */
965#define V4L2_DV_576P50 2 /* BT.1362 */
966#define V4L2_DV_720P24 3 /* SMPTE 296M */
967#define V4L2_DV_720P25 4 /* SMPTE 296M */
968#define V4L2_DV_720P30 5 /* SMPTE 296M */
969#define V4L2_DV_720P50 6 /* SMPTE 296M */
970#define V4L2_DV_720P59_94 7 /* SMPTE 274M */
971#define V4L2_DV_720P60 8 /* SMPTE 274M/296M */
972#define V4L2_DV_1080I29_97 9 /* BT.1120/ SMPTE 274M */
973#define V4L2_DV_1080I30 10 /* BT.1120/ SMPTE 274M */
974#define V4L2_DV_1080I25 11 /* BT.1120 */
975#define V4L2_DV_1080I50 12 /* SMPTE 296M */
976#define V4L2_DV_1080I60 13 /* SMPTE 296M */
977#define V4L2_DV_1080P24 14 /* SMPTE 296M */
978#define V4L2_DV_1080P25 15 /* SMPTE 296M */
979#define V4L2_DV_1080P30 16 /* SMPTE 296M */
980#define V4L2_DV_1080P50 17 /* BT.1120 */
981#define V4L2_DV_1080P60 18 /* BT.1120 */
982
983/*
984 * D V B T T I M I N G S
985 */
986
987/** struct v4l2_bt_timings - BT.656/BT.1120 timing data
988 * @width: total width of the active video in pixels
989 * @height: total height of the active video in lines
990 * @interlaced: Interlaced or progressive
991 * @polarities: Positive or negative polarities
992 * @pixelclock: Pixel clock in HZ. Ex. 74.25MHz->74250000
993 * @hfrontporch:Horizontal front porch in pixels
994 * @hsync: Horizontal Sync length in pixels
995 * @hbackporch: Horizontal back porch in pixels
996 * @vfrontporch:Vertical front porch in lines
997 * @vsync: Vertical Sync length in lines
998 * @vbackporch: Vertical back porch in lines
999 * @il_vfrontporch:Vertical front porch for the even field
1000 * (aka field 2) of interlaced field formats
1001 * @il_vsync: Vertical Sync length for the even field
1002 * (aka field 2) of interlaced field formats
1003 * @il_vbackporch:Vertical back porch for the even field
1004 * (aka field 2) of interlaced field formats
1005 * @standards: Standards the timing belongs to
1006 * @flags: Flags
1007 * @reserved: Reserved fields, must be zeroed.
1008 *
1009 * A note regarding vertical interlaced timings: height refers to the total
1010 * height of the active video frame (= two fields). The blanking timings refer
1011 * to the blanking of each field. So the height of the total frame is
1012 * calculated as follows:
1013 *
1014 * tot_height = height + vfrontporch + vsync + vbackporch +
1015 * il_vfrontporch + il_vsync + il_vbackporch
1016 *
1017 * The active height of each field is height / 2.
1018 */
1019struct v4l2_bt_timings {
1020 __u32 width;
1021 __u32 height;
1022 __u32 interlaced;
1023 __u32 polarities;
1024 __u64 pixelclock;
1025 __u32 hfrontporch;
1026 __u32 hsync;
1027 __u32 hbackporch;
1028 __u32 vfrontporch;
1029 __u32 vsync;
1030 __u32 vbackporch;
1031 __u32 il_vfrontporch;
1032 __u32 il_vsync;
1033 __u32 il_vbackporch;
1034 __u32 standards;
1035 __u32 flags;
1036 __u32 reserved[14];
1037} __attribute__ ((packed));
1038
1039/* Interlaced or progressive format */
1040#define V4L2_DV_PROGRESSIVE 0
1041#define V4L2_DV_INTERLACED 1
1042
1043/* Polarities. If bit is not set, it is assumed to be negative polarity */
1044#define V4L2_DV_VSYNC_POS_POL 0x00000001
1045#define V4L2_DV_HSYNC_POS_POL 0x00000002
1046
1047/* Timings standards */
1048#define V4L2_DV_BT_STD_CEA861 (1 << 0) /* CEA-861 Digital TV Profile */
1049#define V4L2_DV_BT_STD_DMT (1 << 1) /* VESA Discrete Monitor Timings */
1050#define V4L2_DV_BT_STD_CVT (1 << 2) /* VESA Coordinated Video Timings */
1051#define V4L2_DV_BT_STD_GTF (1 << 3) /* VESA Generalized Timings Formula */
1052
1053/* Flags */
1054
1055/* CVT/GTF specific: timing uses reduced blanking (CVT) or the 'Secondary
1056 GTF' curve (GTF). In both cases the horizontal and/or vertical blanking
1057 intervals are reduced, allowing a higher resolution over the same
1058 bandwidth. This is a read-only flag. */
1059#define V4L2_DV_FL_REDUCED_BLANKING (1 << 0)
1060/* CEA-861 specific: set for CEA-861 formats with a framerate of a multiple
1061 of six. These formats can be optionally played at 1 / 1.001 speed.
1062 This is a read-only flag. */
1063#define V4L2_DV_FL_CAN_REDUCE_FPS (1 << 1)
1064/* CEA-861 specific: only valid for video transmitters, the flag is cleared
1065 by receivers.
1066 If the framerate of the format is a multiple of six, then the pixelclock
1067 used to set up the transmitter is divided by 1.001 to make it compatible
1068 with 60 Hz based standards such as NTSC and PAL-M that use a framerate of
1069 29.97 Hz. Otherwise this flag is cleared. If the transmitter can't generate
1070 such frequencies, then the flag will also be cleared. */
1071#define V4L2_DV_FL_REDUCED_FPS (1 << 2)
1072/* Specific to interlaced formats: if set, then field 1 is really one half-line
1073 longer and field 2 is really one half-line shorter, so each field has
1074 exactly the same number of half-lines. Whether half-lines can be detected
1075 or used depends on the hardware. */
1076#define V4L2_DV_FL_HALF_LINE (1 << 0)
1077
1078
1079/** struct v4l2_dv_timings - DV timings
1080 * @type: the type of the timings
1081 * @bt: BT656/1120 timings
1082 */
1083struct v4l2_dv_timings {
1084 __u32 type;
1085 union {
1086 struct v4l2_bt_timings bt;
1087 __u32 reserved[32];
1088 };
1089} __attribute__ ((packed));
1090
1091/* Values for the type field */
1092#define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */
1093
1094
1095/** struct v4l2_enum_dv_timings - DV timings enumeration
1096 * @index: enumeration index
1097 * @reserved: must be zeroed
1098 * @timings: the timings for the given index
1099 */
1100struct v4l2_enum_dv_timings {
1101 __u32 index;
1102 __u32 reserved[3];
1103 struct v4l2_dv_timings timings;
1104};
1105
1106/** struct v4l2_bt_timings_cap - BT.656/BT.1120 timing capabilities
1107 * @min_width: width in pixels
1108 * @max_width: width in pixels
1109 * @min_height: height in lines
1110 * @max_height: height in lines
1111 * @min_pixelclock: Pixel clock in HZ. Ex. 74.25MHz->74250000
1112 * @max_pixelclock: Pixel clock in HZ. Ex. 74.25MHz->74250000
1113 * @standards: Supported standards
1114 * @capabilities: Supported capabilities
1115 * @reserved: Must be zeroed
1116 */
1117struct v4l2_bt_timings_cap {
1118 __u32 min_width;
1119 __u32 max_width;
1120 __u32 min_height;
1121 __u32 max_height;
1122 __u64 min_pixelclock;
1123 __u64 max_pixelclock;
1124 __u32 standards;
1125 __u32 capabilities;
1126 __u32 reserved[16];
1127} __attribute__ ((packed));
1128
1129/* Supports interlaced formats */
1130#define V4L2_DV_BT_CAP_INTERLACED (1 << 0)
1131/* Supports progressive formats */
1132#define V4L2_DV_BT_CAP_PROGRESSIVE (1 << 1)
1133/* Supports CVT/GTF reduced blanking */
1134#define V4L2_DV_BT_CAP_REDUCED_BLANKING (1 << 2)
1135/* Supports custom formats */
1136#define V4L2_DV_BT_CAP_CUSTOM (1 << 3)
1137
1138/** struct v4l2_dv_timings_cap - DV timings capabilities
1139 * @type: the type of the timings (same as in struct v4l2_dv_timings)
1140 * @bt: the BT656/1120 timings capabilities
1141 */
1142struct v4l2_dv_timings_cap {
1143 __u32 type;
1144 __u32 reserved[3];
1145 union {
1146 struct v4l2_bt_timings_cap bt;
1147 __u32 raw_data[32];
1148 };
1149};
1150
1151
1152/*
1153 * V I D E O I N P U T S
1154 */
1155struct v4l2_input {
1156 __u32 index; /* Which input */
1157 __u8 name[32]; /* Label */
1158 __u32 type; /* Type of input */
1159 __u32 audioset; /* Associated audios (bitfield) */
1160 __u32 tuner; /* enum v4l2_tuner_type */
1161 v4l2_std_id std;
1162 __u32 status;
1163 __u32 capabilities;
1164 __u32 reserved[3];
1165};
1166
1167/* Values for the 'type' field */
1168#define V4L2_INPUT_TYPE_TUNER 1
1169#define V4L2_INPUT_TYPE_CAMERA 2
1170
1171/* field 'status' - general */
1172#define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */
1173#define V4L2_IN_ST_NO_SIGNAL 0x00000002
1174#define V4L2_IN_ST_NO_COLOR 0x00000004
1175
1176/* field 'status' - sensor orientation */
1177/* If sensor is mounted upside down set both bits */
1178#define V4L2_IN_ST_HFLIP 0x00000010 /* Frames are flipped horizontally */
1179#define V4L2_IN_ST_VFLIP 0x00000020 /* Frames are flipped vertically */
1180
1181/* field 'status' - analog */
1182#define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */
1183#define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */
1184
1185/* field 'status' - digital */
1186#define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */
1187#define V4L2_IN_ST_NO_EQU 0x00020000 /* No equalizer lock */
1188#define V4L2_IN_ST_NO_CARRIER 0x00040000 /* Carrier recovery failed */
1189
1190/* field 'status' - VCR and set-top box */
1191#define V4L2_IN_ST_MACROVISION 0x01000000 /* Macrovision detected */
1192#define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */
1193#define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */
1194
1195/* capabilities flags */
1196#define V4L2_IN_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */
1197#define V4L2_IN_CAP_DV_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */
1198#define V4L2_IN_CAP_CUSTOM_TIMINGS V4L2_IN_CAP_DV_TIMINGS /* For compatibility */
1199#define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */
1200
1201/*
1202 * V I D E O O U T P U T S
1203 */
1204struct v4l2_output {
1205 __u32 index; /* Which output */
1206 __u8 name[32]; /* Label */
1207 __u32 type; /* Type of output */
1208 __u32 audioset; /* Associated audios (bitfield) */
1209 __u32 modulator; /* Associated modulator */
1210 v4l2_std_id std;
1211 __u32 capabilities;
1212 __u32 reserved[3];
1213};
1214/* Values for the 'type' field */
1215#define V4L2_OUTPUT_TYPE_MODULATOR 1
1216#define V4L2_OUTPUT_TYPE_ANALOG 2
1217#define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3
1218
1219/* capabilities flags */
1220#define V4L2_OUT_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */
1221#define V4L2_OUT_CAP_DV_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */
1222#define V4L2_OUT_CAP_CUSTOM_TIMINGS V4L2_OUT_CAP_DV_TIMINGS /* For compatibility */
1223#define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */
1224
1225/*
1226 * C O N T R O L S
1227 */
1228struct v4l2_control {
1229 __u32 id;
1230 __s32 value;
1231};
1232
1233struct v4l2_ext_control {
1234 __u32 id;
1235 __u32 size;
1236 __u32 reserved2[1];
1237 union {
1238 __s32 value;
1239 __s64 value64;
1240 char *string;
1241 };
1242} __attribute__ ((packed));
1243
1244struct v4l2_ext_controls {
1245 __u32 ctrl_class;
1246 __u32 count;
1247 __u32 error_idx;
1248 __u32 reserved[2];
1249 struct v4l2_ext_control *controls;
1250};
1251
1252#define V4L2_CTRL_ID_MASK (0x0fffffff)
1253#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
1254#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
1255
1256enum v4l2_ctrl_type {
1257 V4L2_CTRL_TYPE_INTEGER = 1,
1258 V4L2_CTRL_TYPE_BOOLEAN = 2,
1259 V4L2_CTRL_TYPE_MENU = 3,
1260 V4L2_CTRL_TYPE_BUTTON = 4,
1261 V4L2_CTRL_TYPE_INTEGER64 = 5,
1262 V4L2_CTRL_TYPE_CTRL_CLASS = 6,
1263 V4L2_CTRL_TYPE_STRING = 7,
1264 V4L2_CTRL_TYPE_BITMASK = 8,
1265 V4L2_CTRL_TYPE_INTEGER_MENU = 9,
1266};
1267
1268/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
1269struct v4l2_queryctrl {
1270 __u32 id;
1271 __u32 type; /* enum v4l2_ctrl_type */
1272 __u8 name[32]; /* Whatever */
1273 __s32 minimum; /* Note signedness */
1274 __s32 maximum;
1275 __s32 step;
1276 __s32 default_value;
1277 __u32 flags;
1278 __u32 reserved[2];
1279};
1280
1281/* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
1282struct v4l2_querymenu {
1283 __u32 id;
1284 __u32 index;
1285 union {
1286 __u8 name[32]; /* Whatever */
1287 __s64 value;
1288 };
1289 __u32 reserved;
1290} __attribute__ ((packed));
1291
1292/* Control flags */
1293#define V4L2_CTRL_FLAG_DISABLED 0x0001
1294#define V4L2_CTRL_FLAG_GRABBED 0x0002
1295#define V4L2_CTRL_FLAG_READ_ONLY 0x0004
1296#define V4L2_CTRL_FLAG_UPDATE 0x0008
1297#define V4L2_CTRL_FLAG_INACTIVE 0x0010
1298#define V4L2_CTRL_FLAG_SLIDER 0x0020
1299#define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040
1300#define V4L2_CTRL_FLAG_VOLATILE 0x0080
1301
1302/* Query flag, to be ORed with the control ID */
1303#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
1304
1305/* User-class control IDs defined by V4L2 */
1306#define V4L2_CID_MAX_CTRLS 1024
1307/* IDs reserved for driver specific controls */
1308#define V4L2_CID_PRIVATE_BASE 0x08000000
1309
1310
1311/* DV-class control IDs defined by V4L2 */
1312#define V4L2_CID_DV_CLASS_BASE (V4L2_CTRL_CLASS_DV | 0x900)
1313#define V4L2_CID_DV_CLASS (V4L2_CTRL_CLASS_DV | 1)
1314
1315#define V4L2_CID_DV_TX_HOTPLUG (V4L2_CID_DV_CLASS_BASE + 1)
1316#define V4L2_CID_DV_TX_RXSENSE (V4L2_CID_DV_CLASS_BASE + 2)
1317#define V4L2_CID_DV_TX_EDID_PRESENT (V4L2_CID_DV_CLASS_BASE + 3)
1318#define V4L2_CID_DV_TX_MODE (V4L2_CID_DV_CLASS_BASE + 4)
1319enum v4l2_dv_tx_mode {
1320 V4L2_DV_TX_MODE_DVI_D = 0,
1321 V4L2_DV_TX_MODE_HDMI = 1,
1322};
1323#define V4L2_CID_DV_TX_RGB_RANGE (V4L2_CID_DV_CLASS_BASE + 5)
1324enum v4l2_dv_rgb_range {
1325 V4L2_DV_RGB_RANGE_AUTO = 0,
1326 V4L2_DV_RGB_RANGE_LIMITED = 1,
1327 V4L2_DV_RGB_RANGE_FULL = 2,
1328};
1329
1330#define V4L2_CID_DV_RX_POWER_PRESENT (V4L2_CID_DV_CLASS_BASE + 100)
1331#define V4L2_CID_DV_RX_RGB_RANGE (V4L2_CID_DV_CLASS_BASE + 101)
1332
1333/*
1334 * T U N I N G
1335 */
1336struct v4l2_tuner {
1337 __u32 index;
1338 __u8 name[32];
1339 __u32 type; /* enum v4l2_tuner_type */
1340 __u32 capability;
1341 __u32 rangelow;
1342 __u32 rangehigh;
1343 __u32 rxsubchans;
1344 __u32 audmode;
1345 __s32 signal;
1346 __s32 afc;
1347 __u32 reserved[4];
1348};
1349
1350struct v4l2_modulator {
1351 __u32 index;
1352 __u8 name[32];
1353 __u32 capability;
1354 __u32 rangelow;
1355 __u32 rangehigh;
1356 __u32 txsubchans;
1357 __u32 reserved[4];
1358};
1359
1360/* Flags for the 'capability' field */
1361#define V4L2_TUNER_CAP_LOW 0x0001
1362#define V4L2_TUNER_CAP_NORM 0x0002
1363#define V4L2_TUNER_CAP_HWSEEK_BOUNDED 0x0004
1364#define V4L2_TUNER_CAP_HWSEEK_WRAP 0x0008
1365#define V4L2_TUNER_CAP_STEREO 0x0010
1366#define V4L2_TUNER_CAP_LANG2 0x0020
1367#define V4L2_TUNER_CAP_SAP 0x0020
1368#define V4L2_TUNER_CAP_LANG1 0x0040
1369#define V4L2_TUNER_CAP_RDS 0x0080
1370#define V4L2_TUNER_CAP_RDS_BLOCK_IO 0x0100
1371#define V4L2_TUNER_CAP_RDS_CONTROLS 0x0200
1372#define V4L2_TUNER_CAP_FREQ_BANDS 0x0400
1373#define V4L2_TUNER_CAP_HWSEEK_PROG_LIM 0x0800
1374
1375/* Flags for the 'rxsubchans' field */
1376#define V4L2_TUNER_SUB_MONO 0x0001
1377#define V4L2_TUNER_SUB_STEREO 0x0002
1378#define V4L2_TUNER_SUB_LANG2 0x0004
1379#define V4L2_TUNER_SUB_SAP 0x0004
1380#define V4L2_TUNER_SUB_LANG1 0x0008
1381#define V4L2_TUNER_SUB_RDS 0x0010
1382
1383/* Values for the 'audmode' field */
1384#define V4L2_TUNER_MODE_MONO 0x0000
1385#define V4L2_TUNER_MODE_STEREO 0x0001
1386#define V4L2_TUNER_MODE_LANG2 0x0002
1387#define V4L2_TUNER_MODE_SAP 0x0002
1388#define V4L2_TUNER_MODE_LANG1 0x0003
1389#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004
1390
1391struct v4l2_frequency {
1392 __u32 tuner;
1393 __u32 type; /* enum v4l2_tuner_type */
1394 __u32 frequency;
1395 __u32 reserved[8];
1396};
1397
1398#define V4L2_BAND_MODULATION_VSB (1 << 1)
1399#define V4L2_BAND_MODULATION_FM (1 << 2)
1400#define V4L2_BAND_MODULATION_AM (1 << 3)
1401
1402struct v4l2_frequency_band {
1403 __u32 tuner;
1404 __u32 type; /* enum v4l2_tuner_type */
1405 __u32 index;
1406 __u32 capability;
1407 __u32 rangelow;
1408 __u32 rangehigh;
1409 __u32 modulation;
1410 __u32 reserved[9];
1411};
1412
1413struct v4l2_hw_freq_seek {
1414 __u32 tuner;
1415 __u32 type; /* enum v4l2_tuner_type */
1416 __u32 seek_upward;
1417 __u32 wrap_around;
1418 __u32 spacing;
1419 __u32 rangelow;
1420 __u32 rangehigh;
1421 __u32 reserved[5];
1422};
1423
1424/*
1425 * R D S
1426 */
1427
1428struct v4l2_rds_data {
1429 __u8 lsb;
1430 __u8 msb;
1431 __u8 block;
1432} __attribute__ ((packed));
1433
1434#define V4L2_RDS_BLOCK_MSK 0x7
1435#define V4L2_RDS_BLOCK_A 0
1436#define V4L2_RDS_BLOCK_B 1
1437#define V4L2_RDS_BLOCK_C 2
1438#define V4L2_RDS_BLOCK_D 3
1439#define V4L2_RDS_BLOCK_C_ALT 4
1440#define V4L2_RDS_BLOCK_INVALID 7
1441
1442#define V4L2_RDS_BLOCK_CORRECTED 0x40
1443#define V4L2_RDS_BLOCK_ERROR 0x80
1444
1445/*
1446 * A U D I O
1447 */
1448struct v4l2_audio {
1449 __u32 index;
1450 __u8 name[32];
1451 __u32 capability;
1452 __u32 mode;
1453 __u32 reserved[2];
1454};
1455
1456/* Flags for the 'capability' field */
1457#define V4L2_AUDCAP_STEREO 0x00001
1458#define V4L2_AUDCAP_AVL 0x00002
1459
1460/* Flags for the 'mode' field */
1461#define V4L2_AUDMODE_AVL 0x00001
1462
1463struct v4l2_audioout {
1464 __u32 index;
1465 __u8 name[32];
1466 __u32 capability;
1467 __u32 mode;
1468 __u32 reserved[2];
1469};
1470
1471/*
1472 * M P E G S E R V I C E S
1473 *
1474 * NOTE: EXPERIMENTAL API
1475 */
1476#if 1
1477#define V4L2_ENC_IDX_FRAME_I (0)
1478#define V4L2_ENC_IDX_FRAME_P (1)
1479#define V4L2_ENC_IDX_FRAME_B (2)
1480#define V4L2_ENC_IDX_FRAME_MASK (0xf)
1481
1482struct v4l2_enc_idx_entry {
1483 __u64 offset;
1484 __u64 pts;
1485 __u32 length;
1486 __u32 flags;
1487 __u32 reserved[2];
1488};
1489
1490#define V4L2_ENC_IDX_ENTRIES (64)
1491struct v4l2_enc_idx {
1492 __u32 entries;
1493 __u32 entries_cap;
1494 __u32 reserved[4];
1495 struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES];
1496};
1497
1498
1499#define V4L2_ENC_CMD_START (0)
1500#define V4L2_ENC_CMD_STOP (1)
1501#define V4L2_ENC_CMD_PAUSE (2)
1502#define V4L2_ENC_CMD_RESUME (3)
1503
1504/* Flags for V4L2_ENC_CMD_STOP */
1505#define V4L2_ENC_CMD_STOP_AT_GOP_END (1 << 0)
1506
1507struct v4l2_encoder_cmd {
1508 __u32 cmd;
1509 __u32 flags;
1510 union {
1511 struct {
1512 __u32 data[8];
1513 } raw;
1514 };
1515};
1516
1517/* Decoder commands */
1518#define V4L2_DEC_CMD_START (0)
1519#define V4L2_DEC_CMD_STOP (1)
1520#define V4L2_DEC_CMD_PAUSE (2)
1521#define V4L2_DEC_CMD_RESUME (3)
1522
1523/* Flags for V4L2_DEC_CMD_START */
1524#define V4L2_DEC_CMD_START_MUTE_AUDIO (1 << 0)
1525
1526/* Flags for V4L2_DEC_CMD_PAUSE */
1527#define V4L2_DEC_CMD_PAUSE_TO_BLACK (1 << 0)
1528
1529/* Flags for V4L2_DEC_CMD_STOP */
1530#define V4L2_DEC_CMD_STOP_TO_BLACK (1 << 0)
1531#define V4L2_DEC_CMD_STOP_IMMEDIATELY (1 << 1)
1532
1533/* Play format requirements (returned by the driver): */
1534
1535/* The decoder has no special format requirements */
1536#define V4L2_DEC_START_FMT_NONE (0)
1537/* The decoder requires full GOPs */
1538#define V4L2_DEC_START_FMT_GOP (1)
1539
1540/* The structure must be zeroed before use by the application
1541 This ensures it can be extended safely in the future. */
1542struct v4l2_decoder_cmd {
1543 __u32 cmd;
1544 __u32 flags;
1545 union {
1546 struct {
1547 __u64 pts;
1548 } stop;
1549
1550 struct {
1551 /* 0 or 1000 specifies normal speed,
1552 1 specifies forward single stepping,
1553 -1 specifies backward single stepping,
1554 >1: playback at speed/1000 of the normal speed,
1555 <-1: reverse playback at (-speed/1000) of the normal speed. */
1556 __s32 speed;
1557 __u32 format;
1558 } start;
1559
1560 struct {
1561 __u32 data[16];
1562 } raw;
1563 };
1564};
1565#endif
1566
1567
1568/*
1569 * D A T A S E R V I C E S ( V B I )
1570 *
1571 * Data services API by Michael Schimek
1572 */
1573
1574/* Raw VBI */
1575struct v4l2_vbi_format {
1576 __u32 sampling_rate; /* in 1 Hz */
1577 __u32 offset;
1578 __u32 samples_per_line;
1579 __u32 sample_format; /* V4L2_PIX_FMT_* */
1580 __s32 start[2];
1581 __u32 count[2];
1582 __u32 flags; /* V4L2_VBI_* */
1583 __u32 reserved[2]; /* must be zero */
1584};
1585
1586/* VBI flags */
1587#define V4L2_VBI_UNSYNC (1 << 0)
1588#define V4L2_VBI_INTERLACED (1 << 1)
1589
1590/* Sliced VBI
1591 *
1592 * This implements is a proposal V4L2 API to allow SLICED VBI
1593 * required for some hardware encoders. It should change without
1594 * notice in the definitive implementation.
1595 */
1596
1597struct v4l2_sliced_vbi_format {
1598 __u16 service_set;
1599 /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
1600 service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
1601 (equals frame lines 313-336 for 625 line video
1602 standards, 263-286 for 525 line standards) */
1603 __u16 service_lines[2][24];
1604 __u32 io_size;
1605 __u32 reserved[2]; /* must be zero */
1606};
1607
1608/* Teletext World System Teletext
1609 (WST), defined on ITU-R BT.653-2 */
1610#define V4L2_SLICED_TELETEXT_B (0x0001)
1611/* Video Program System, defined on ETS 300 231*/
1612#define V4L2_SLICED_VPS (0x0400)
1613/* Closed Caption, defined on EIA-608 */
1614#define V4L2_SLICED_CAPTION_525 (0x1000)
1615/* Wide Screen System, defined on ITU-R BT1119.1 */
1616#define V4L2_SLICED_WSS_625 (0x4000)
1617
1618#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525)
1619#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625)
1620
1621struct v4l2_sliced_vbi_cap {
1622 __u16 service_set;
1623 /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
1624 service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
1625 (equals frame lines 313-336 for 625 line video
1626 standards, 263-286 for 525 line standards) */
1627 __u16 service_lines[2][24];
1628 __u32 type; /* enum v4l2_buf_type */
1629 __u32 reserved[3]; /* must be 0 */
1630};
1631
1632struct v4l2_sliced_vbi_data {
1633 __u32 id;
1634 __u32 field; /* 0: first field, 1: second field */
1635 __u32 line; /* 1-23 */
1636 __u32 reserved; /* must be 0 */
1637 __u8 data[48];
1638};
1639
1640/*
1641 * Sliced VBI data inserted into MPEG Streams
1642 */
1643
1644/*
1645 * V4L2_MPEG_STREAM_VBI_FMT_IVTV:
1646 *
1647 * Structure of payload contained in an MPEG 2 Private Stream 1 PES Packet in an
1648 * MPEG-2 Program Pack that contains V4L2_MPEG_STREAM_VBI_FMT_IVTV Sliced VBI
1649 * data
1650 *
1651 * Note, the MPEG-2 Program Pack and Private Stream 1 PES packet header
1652 * definitions are not included here. See the MPEG-2 specifications for details
1653 * on these headers.
1654 */
1655
1656/* Line type IDs */
1657#define V4L2_MPEG_VBI_IVTV_TELETEXT_B (1)
1658#define V4L2_MPEG_VBI_IVTV_CAPTION_525 (4)
1659#define V4L2_MPEG_VBI_IVTV_WSS_625 (5)
1660#define V4L2_MPEG_VBI_IVTV_VPS (7)
1661
1662struct v4l2_mpeg_vbi_itv0_line {
1663 __u8 id; /* One of V4L2_MPEG_VBI_IVTV_* above */
1664 __u8 data[42]; /* Sliced VBI data for the line */
1665} __attribute__ ((packed));
1666
1667struct v4l2_mpeg_vbi_itv0 {
1668 __le32 linemask[2]; /* Bitmasks of VBI service lines present */
1669 struct v4l2_mpeg_vbi_itv0_line line[35];
1670} __attribute__ ((packed));
1671
1672struct v4l2_mpeg_vbi_ITV0 {
1673 struct v4l2_mpeg_vbi_itv0_line line[36];
1674} __attribute__ ((packed));
1675
1676#define V4L2_MPEG_VBI_IVTV_MAGIC0 "itv0"
1677#define V4L2_MPEG_VBI_IVTV_MAGIC1 "ITV0"
1678
1679struct v4l2_mpeg_vbi_fmt_ivtv {
1680 __u8 magic[4];
1681 union {
1682 struct v4l2_mpeg_vbi_itv0 itv0;
1683 struct v4l2_mpeg_vbi_ITV0 ITV0;
1684 };
1685} __attribute__ ((packed));
1686
1687/*
1688 * A G G R E G A T E S T R U C T U R E S
1689 */
1690
1691/**
1692 * struct v4l2_plane_pix_format - additional, per-plane format definition
1693 * @sizeimage: maximum size in bytes required for data, for which
1694 * this plane will be used
1695 * @bytesperline: distance in bytes between the leftmost pixels in two
1696 * adjacent lines
1697 */
1698struct v4l2_plane_pix_format {
1699 __u32 sizeimage;
1700 __u16 bytesperline;
1701 __u16 reserved[7];
1702} __attribute__ ((packed));
1703
1704/**
1705 * struct v4l2_pix_format_mplane - multiplanar format definition
1706 * @width: image width in pixels
1707 * @height: image height in pixels
1708 * @pixelformat: little endian four character code (fourcc)
1709 * @field: enum v4l2_field; field order (for interlaced video)
1710 * @colorspace: enum v4l2_colorspace; supplemental to pixelformat
1711 * @plane_fmt: per-plane information
1712 * @num_planes: number of planes for this format
1713 */
1714struct v4l2_pix_format_mplane {
1715 __u32 width;
1716 __u32 height;
1717 __u32 pixelformat;
1718 __u32 field;
1719 __u32 colorspace;
1720
1721 struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES];
1722 __u8 num_planes;
1723 __u8 reserved[11];
1724} __attribute__ ((packed));
1725
1726/**
1727 * struct v4l2_format - stream data format
1728 * @type: enum v4l2_buf_type; type of the data stream
1729 * @pix: definition of an image format
1730 * @pix_mp: definition of a multiplanar image format
1731 * @win: definition of an overlaid image
1732 * @vbi: raw VBI capture or output parameters
1733 * @sliced: sliced VBI capture or output parameters
1734 * @raw_data: placeholder for future extensions and custom formats
1735 */
1736struct v4l2_format {
1737 __u32 type;
1738 union {
1739 struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
1740 struct v4l2_pix_format_mplane pix_mp; /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */
1741 struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
1742 struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */
1743 struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */
1744 __u8 raw_data[200]; /* user-defined */
1745 } fmt;
1746};
1747
1748/* Stream type-dependent parameters
1749 */
1750struct v4l2_streamparm {
1751 __u32 type; /* enum v4l2_buf_type */
1752 union {
1753 struct v4l2_captureparm capture;
1754 struct v4l2_outputparm output;
1755 __u8 raw_data[200]; /* user-defined */
1756 } parm;
1757};
1758
1759/*
1760 * E V E N T S
1761 */
1762
1763#define V4L2_EVENT_ALL 0
1764#define V4L2_EVENT_VSYNC 1
1765#define V4L2_EVENT_EOS 2
1766#define V4L2_EVENT_CTRL 3
1767#define V4L2_EVENT_FRAME_SYNC 4
1768#define V4L2_EVENT_PRIVATE_START 0x08000000
1769
1770/* Payload for V4L2_EVENT_VSYNC */
1771struct v4l2_event_vsync {
1772 /* Can be V4L2_FIELD_ANY, _NONE, _TOP or _BOTTOM */
1773 __u8 field;
1774} __attribute__ ((packed));
1775
1776/* Payload for V4L2_EVENT_CTRL */
1777#define V4L2_EVENT_CTRL_CH_VALUE (1 << 0)
1778#define V4L2_EVENT_CTRL_CH_FLAGS (1 << 1)
1779
1780struct v4l2_event_ctrl {
1781 __u32 changes;
1782 __u32 type;
1783 union {
1784 __s32 value;
1785 __s64 value64;
1786 };
1787 __u32 flags;
1788 __s32 minimum;
1789 __s32 maximum;
1790 __s32 step;
1791 __s32 default_value;
1792};
1793
1794struct v4l2_event_frame_sync {
1795 __u32 frame_sequence;
1796};
1797
1798struct v4l2_event {
1799 __u32 type;
1800 union {
1801 struct v4l2_event_vsync vsync;
1802 struct v4l2_event_ctrl ctrl;
1803 struct v4l2_event_frame_sync frame_sync;
1804 __u8 data[64];
1805 } u;
1806 __u32 pending;
1807 __u32 sequence;
1808 struct timespec timestamp;
1809 __u32 id;
1810 __u32 reserved[8];
1811};
1812
1813#define V4L2_EVENT_SUB_FL_SEND_INITIAL (1 << 0)
1814#define V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK (1 << 1)
1815
1816struct v4l2_event_subscription {
1817 __u32 type;
1818 __u32 id;
1819 __u32 flags;
1820 __u32 reserved[5];
1821};
1822
1823/*
1824 * A D V A N C E D D E B U G G I N G
1825 *
1826 * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS!
1827 * FOR DEBUGGING, TESTING AND INTERNAL USE ONLY!
1828 */
1829
1830/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */
1831
1832#define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */
1833#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */
1834#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */
1835#define V4L2_CHIP_MATCH_AC97 3 /* Match against anciliary AC97 chip */
1836
1837struct v4l2_dbg_match {
1838 __u32 type; /* Match type */
1839 union { /* Match this chip, meaning determined by type */
1840 __u32 addr;
1841 char name[32];
1842 };
1843} __attribute__ ((packed));
1844
1845struct v4l2_dbg_register {
1846 struct v4l2_dbg_match match;
1847 __u32 size; /* register size in bytes */
1848 __u64 reg;
1849 __u64 val;
1850} __attribute__ ((packed));
1851
1852/* VIDIOC_DBG_G_CHIP_IDENT */
1853struct v4l2_dbg_chip_ident {
1854 struct v4l2_dbg_match match;
1855 __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */
1856 __u32 revision; /* chip revision, chip specific */
1857} __attribute__ ((packed));
1858
1859/**
1860 * struct v4l2_create_buffers - VIDIOC_CREATE_BUFS argument
1861 * @index: on return, index of the first created buffer
1862 * @count: entry: number of requested buffers,
1863 * return: number of created buffers
1864 * @memory: enum v4l2_memory; buffer memory type
1865 * @format: frame format, for which buffers are requested
1866 * @reserved: future extensions
1867 */
1868struct v4l2_create_buffers {
1869 __u32 index;
1870 __u32 count;
1871 __u32 memory;
1872 struct v4l2_format format;
1873 __u32 reserved[8];
1874};
1875
1876/*
1877 * I O C T L C O D E S F O R V I D E O D E V I C E S
1878 *
1879 */
1880#define VIDIOC_QUERYCAP _IOR('V', 0, struct v4l2_capability)
1881#define VIDIOC_RESERVED _IO('V', 1)
1882#define VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc)
1883#define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format)
1884#define VIDIOC_S_FMT _IOWR('V', 5, struct v4l2_format)
1885#define VIDIOC_REQBUFS _IOWR('V', 8, struct v4l2_requestbuffers)
1886#define VIDIOC_QUERYBUF _IOWR('V', 9, struct v4l2_buffer)
1887#define VIDIOC_G_FBUF _IOR('V', 10, struct v4l2_framebuffer)
1888#define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer)
1889#define VIDIOC_OVERLAY _IOW('V', 14, int)
1890#define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer)
1891#define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer)
1892#define VIDIOC_STREAMON _IOW('V', 18, int)
1893#define VIDIOC_STREAMOFF _IOW('V', 19, int)
1894#define VIDIOC_G_PARM _IOWR('V', 21, struct v4l2_streamparm)
1895#define VIDIOC_S_PARM _IOWR('V', 22, struct v4l2_streamparm)
1896#define VIDIOC_G_STD _IOR('V', 23, v4l2_std_id)
1897#define VIDIOC_S_STD _IOW('V', 24, v4l2_std_id)
1898#define VIDIOC_ENUMSTD _IOWR('V', 25, struct v4l2_standard)
1899#define VIDIOC_ENUMINPUT _IOWR('V', 26, struct v4l2_input)
1900#define VIDIOC_G_CTRL _IOWR('V', 27, struct v4l2_control)
1901#define VIDIOC_S_CTRL _IOWR('V', 28, struct v4l2_control)
1902#define VIDIOC_G_TUNER _IOWR('V', 29, struct v4l2_tuner)
1903#define VIDIOC_S_TUNER _IOW('V', 30, struct v4l2_tuner)
1904#define VIDIOC_G_AUDIO _IOR('V', 33, struct v4l2_audio)
1905#define VIDIOC_S_AUDIO _IOW('V', 34, struct v4l2_audio)
1906#define VIDIOC_QUERYCTRL _IOWR('V', 36, struct v4l2_queryctrl)
1907#define VIDIOC_QUERYMENU _IOWR('V', 37, struct v4l2_querymenu)
1908#define VIDIOC_G_INPUT _IOR('V', 38, int)
1909#define VIDIOC_S_INPUT _IOWR('V', 39, int)
1910#define VIDIOC_G_OUTPUT _IOR('V', 46, int)
1911#define VIDIOC_S_OUTPUT _IOWR('V', 47, int)
1912#define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output)
1913#define VIDIOC_G_AUDOUT _IOR('V', 49, struct v4l2_audioout)
1914#define VIDIOC_S_AUDOUT _IOW('V', 50, struct v4l2_audioout)
1915#define VIDIOC_G_MODULATOR _IOWR('V', 54, struct v4l2_modulator)
1916#define VIDIOC_S_MODULATOR _IOW('V', 55, struct v4l2_modulator)
1917#define VIDIOC_G_FREQUENCY _IOWR('V', 56, struct v4l2_frequency)
1918#define VIDIOC_S_FREQUENCY _IOW('V', 57, struct v4l2_frequency)
1919#define VIDIOC_CROPCAP _IOWR('V', 58, struct v4l2_cropcap)
1920#define VIDIOC_G_CROP _IOWR('V', 59, struct v4l2_crop)
1921#define VIDIOC_S_CROP _IOW('V', 60, struct v4l2_crop)
1922#define VIDIOC_G_JPEGCOMP _IOR('V', 61, struct v4l2_jpegcompression)
1923#define VIDIOC_S_JPEGCOMP _IOW('V', 62, struct v4l2_jpegcompression)
1924#define VIDIOC_QUERYSTD _IOR('V', 63, v4l2_std_id)
1925#define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format)
1926#define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio)
1927#define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout)
1928#define VIDIOC_G_PRIORITY _IOR('V', 67, __u32) /* enum v4l2_priority */
1929#define VIDIOC_S_PRIORITY _IOW('V', 68, __u32) /* enum v4l2_priority */
1930#define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap)
1931#define VIDIOC_LOG_STATUS _IO('V', 70)
1932#define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls)
1933#define VIDIOC_S_EXT_CTRLS _IOWR('V', 72, struct v4l2_ext_controls)
1934#define VIDIOC_TRY_EXT_CTRLS _IOWR('V', 73, struct v4l2_ext_controls)
1935#if 1
1936#define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum)
1937#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum)
1938#define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx)
1939#define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd)
1940#define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd)
1941#endif
1942
1943#if 1
1944/* Experimental, meant for debugging, testing and internal use.
1945 Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined.
1946 You must be root to use these ioctls. Never use these in applications! */
1947#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register)
1948#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register)
1949
1950/* Experimental, meant for debugging, testing and internal use.
1951 Never use this ioctl in applications! */
1952#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident)
1953#endif
1954
1955#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
1956
1957/* These four DV Preset ioctls are deprecated in favor of the DV Timings
1958 ioctls. */
1959#define VIDIOC_ENUM_DV_PRESETS _IOWR('V', 83, struct v4l2_dv_enum_preset)
1960#define VIDIOC_S_DV_PRESET _IOWR('V', 84, struct v4l2_dv_preset)
1961#define VIDIOC_G_DV_PRESET _IOWR('V', 85, struct v4l2_dv_preset)
1962#define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset)
1963#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings)
1964#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings)
1965#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event)
1966#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription)
1967#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
1968
1969/* Experimental, the below two ioctls may change over the next couple of kernel
1970 versions */
1971#define VIDIOC_CREATE_BUFS _IOWR('V', 92, struct v4l2_create_buffers)
1972#define VIDIOC_PREPARE_BUF _IOWR('V', 93, struct v4l2_buffer)
1973
1974/* Experimental selection API */
1975#define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection)
1976#define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection)
1977
1978/* Experimental, these two ioctls may change over the next couple of kernel
1979 versions. */
1980#define VIDIOC_DECODER_CMD _IOWR('V', 96, struct v4l2_decoder_cmd)
1981#define VIDIOC_TRY_DECODER_CMD _IOWR('V', 97, struct v4l2_decoder_cmd)
1982
1983/* Experimental, these three ioctls may change over the next couple of kernel
1984 versions. */
1985#define VIDIOC_ENUM_DV_TIMINGS _IOWR('V', 98, struct v4l2_enum_dv_timings)
1986#define VIDIOC_QUERY_DV_TIMINGS _IOR('V', 99, struct v4l2_dv_timings)
1987#define VIDIOC_DV_TIMINGS_CAP _IOWR('V', 100, struct v4l2_dv_timings_cap)
1988
1989/* Experimental, this ioctl may change over the next couple of kernel
1990 versions. */
1991#define VIDIOC_ENUM_FREQ_BANDS _IOWR('V', 101, struct v4l2_frequency_band)
1992
1993/* Reminder: when adding new ioctls please add support for them to
1994 drivers/media/video/v4l2-compat-ioctl32.c as well! */
1995
1996#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
1997
1998#endif /* _UAPI__LINUX_VIDEODEV2_H */
diff --git a/include/linux/virtio_9p.h b/include/uapi/linux/virtio_9p.h
index 277c4ad44e84..277c4ad44e84 100644
--- a/include/linux/virtio_9p.h
+++ b/include/uapi/linux/virtio_9p.h
diff --git a/include/linux/virtio_balloon.h b/include/uapi/linux/virtio_balloon.h
index 652dc8bea921..652dc8bea921 100644
--- a/include/linux/virtio_balloon.h
+++ b/include/uapi/linux/virtio_balloon.h
diff --git a/include/linux/virtio_blk.h b/include/uapi/linux/virtio_blk.h
index 6d8e61c48563..6d8e61c48563 100644
--- a/include/linux/virtio_blk.h
+++ b/include/uapi/linux/virtio_blk.h
diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h
new file mode 100644
index 000000000000..b7cda390fd00
--- /dev/null
+++ b/include/uapi/linux/virtio_config.h
@@ -0,0 +1,54 @@
1#ifndef _UAPI_LINUX_VIRTIO_CONFIG_H
2#define _UAPI_LINUX_VIRTIO_CONFIG_H
3/* This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
4 * anyone can use the definitions to implement compatible drivers/servers.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of IBM nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE. */
28
29/* Virtio devices use a standardized configuration space to define their
30 * features and pass configuration information, but each implementation can
31 * store and access that space differently. */
32#include <linux/types.h>
33
34/* Status byte for guest to report progress, and synchronize features. */
35/* We have seen device and processed generic fields (VIRTIO_CONFIG_F_VIRTIO) */
36#define VIRTIO_CONFIG_S_ACKNOWLEDGE 1
37/* We have found a driver for the device. */
38#define VIRTIO_CONFIG_S_DRIVER 2
39/* Driver has used its parts of the config, and is happy */
40#define VIRTIO_CONFIG_S_DRIVER_OK 4
41/* We've given up on this device. */
42#define VIRTIO_CONFIG_S_FAILED 0x80
43
44/* Some virtio feature bits (currently bits 28 through 31) are reserved for the
45 * transport being used (eg. virtio_ring), the rest are per-device feature
46 * bits. */
47#define VIRTIO_TRANSPORT_F_START 28
48#define VIRTIO_TRANSPORT_F_END 32
49
50/* Do we get callbacks when the ring is completely used, even if we've
51 * suppressed them? */
52#define VIRTIO_F_NOTIFY_ON_EMPTY 24
53
54#endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */
diff --git a/include/uapi/linux/virtio_console.h b/include/uapi/linux/virtio_console.h
new file mode 100644
index 000000000000..ee13ab6c3614
--- /dev/null
+++ b/include/uapi/linux/virtio_console.h
@@ -0,0 +1,74 @@
1/*
2 * This header, excluding the #ifdef __KERNEL__ part, is BSD licensed so
3 * anyone can use the definitions to implement compatible drivers/servers:
4 *
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of IBM nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * Copyright (C) Red Hat, Inc., 2009, 2010, 2011
30 * Copyright (C) Amit Shah <amit.shah@redhat.com>, 2009, 2010, 2011
31 */
32#ifndef _UAPI_LINUX_VIRTIO_CONSOLE_H
33#define _UAPI_LINUX_VIRTIO_CONSOLE_H
34#include <linux/types.h>
35#include <linux/virtio_ids.h>
36#include <linux/virtio_config.h>
37
38/* Feature bits */
39#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */
40#define VIRTIO_CONSOLE_F_MULTIPORT 1 /* Does host provide multiple ports? */
41
42#define VIRTIO_CONSOLE_BAD_ID (~(u32)0)
43
44struct virtio_console_config {
45 /* colums of the screens */
46 __u16 cols;
47 /* rows of the screens */
48 __u16 rows;
49 /* max. number of ports this device can hold */
50 __u32 max_nr_ports;
51} __attribute__((packed));
52
53/*
54 * A message that's passed between the Host and the Guest for a
55 * particular port.
56 */
57struct virtio_console_control {
58 __u32 id; /* Port number */
59 __u16 event; /* The kind of control event (see below) */
60 __u16 value; /* Extra information for the key */
61};
62
63/* Some events for control messages */
64#define VIRTIO_CONSOLE_DEVICE_READY 0
65#define VIRTIO_CONSOLE_PORT_ADD 1
66#define VIRTIO_CONSOLE_PORT_REMOVE 2
67#define VIRTIO_CONSOLE_PORT_READY 3
68#define VIRTIO_CONSOLE_CONSOLE_PORT 4
69#define VIRTIO_CONSOLE_RESIZE 5
70#define VIRTIO_CONSOLE_PORT_OPEN 6
71#define VIRTIO_CONSOLE_PORT_NAME 7
72
73
74#endif /* _UAPI_LINUX_VIRTIO_CONSOLE_H */
diff --git a/include/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h
index 270fb22c5811..270fb22c5811 100644
--- a/include/linux/virtio_ids.h
+++ b/include/uapi/linux/virtio_ids.h
diff --git a/include/linux/virtio_net.h b/include/uapi/linux/virtio_net.h
index 2470f541af50..2470f541af50 100644
--- a/include/linux/virtio_net.h
+++ b/include/uapi/linux/virtio_net.h
diff --git a/include/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h
index ea66f3f60d63..ea66f3f60d63 100644
--- a/include/linux/virtio_pci.h
+++ b/include/uapi/linux/virtio_pci.h
diff --git a/include/uapi/linux/virtio_ring.h b/include/uapi/linux/virtio_ring.h
new file mode 100644
index 000000000000..a99f9b7caa67
--- /dev/null
+++ b/include/uapi/linux/virtio_ring.h
@@ -0,0 +1,163 @@
1#ifndef _UAPI_LINUX_VIRTIO_RING_H
2#define _UAPI_LINUX_VIRTIO_RING_H
3/* An interface for efficient virtio implementation, currently for use by KVM
4 * and lguest, but hopefully others soon. Do NOT change this since it will
5 * break existing servers and clients.
6 *
7 * This header is BSD licensed so anyone can use the definitions to implement
8 * compatible drivers/servers.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of IBM nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * Copyright Rusty Russell IBM Corporation 2007. */
34#include <linux/types.h>
35
36/* This marks a buffer as continuing via the next field. */
37#define VRING_DESC_F_NEXT 1
38/* This marks a buffer as write-only (otherwise read-only). */
39#define VRING_DESC_F_WRITE 2
40/* This means the buffer contains a list of buffer descriptors. */
41#define VRING_DESC_F_INDIRECT 4
42
43/* The Host uses this in used->flags to advise the Guest: don't kick me when
44 * you add a buffer. It's unreliable, so it's simply an optimization. Guest
45 * will still kick if it's out of buffers. */
46#define VRING_USED_F_NO_NOTIFY 1
47/* The Guest uses this in avail->flags to advise the Host: don't interrupt me
48 * when you consume a buffer. It's unreliable, so it's simply an
49 * optimization. */
50#define VRING_AVAIL_F_NO_INTERRUPT 1
51
52/* We support indirect buffer descriptors */
53#define VIRTIO_RING_F_INDIRECT_DESC 28
54
55/* The Guest publishes the used index for which it expects an interrupt
56 * at the end of the avail ring. Host should ignore the avail->flags field. */
57/* The Host publishes the avail index for which it expects a kick
58 * at the end of the used ring. Guest should ignore the used->flags field. */
59#define VIRTIO_RING_F_EVENT_IDX 29
60
61/* Virtio ring descriptors: 16 bytes. These can chain together via "next". */
62struct vring_desc {
63 /* Address (guest-physical). */
64 __u64 addr;
65 /* Length. */
66 __u32 len;
67 /* The flags as indicated above. */
68 __u16 flags;
69 /* We chain unused descriptors via this, too */
70 __u16 next;
71};
72
73struct vring_avail {
74 __u16 flags;
75 __u16 idx;
76 __u16 ring[];
77};
78
79/* u32 is used here for ids for padding reasons. */
80struct vring_used_elem {
81 /* Index of start of used descriptor chain. */
82 __u32 id;
83 /* Total length of the descriptor chain which was used (written to) */
84 __u32 len;
85};
86
87struct vring_used {
88 __u16 flags;
89 __u16 idx;
90 struct vring_used_elem ring[];
91};
92
93struct vring {
94 unsigned int num;
95
96 struct vring_desc *desc;
97
98 struct vring_avail *avail;
99
100 struct vring_used *used;
101};
102
103/* The standard layout for the ring is a continuous chunk of memory which looks
104 * like this. We assume num is a power of 2.
105 *
106 * struct vring
107 * {
108 * // The actual descriptors (16 bytes each)
109 * struct vring_desc desc[num];
110 *
111 * // A ring of available descriptor heads with free-running index.
112 * __u16 avail_flags;
113 * __u16 avail_idx;
114 * __u16 available[num];
115 * __u16 used_event_idx;
116 *
117 * // Padding to the next align boundary.
118 * char pad[];
119 *
120 * // A ring of used descriptor heads with free-running index.
121 * __u16 used_flags;
122 * __u16 used_idx;
123 * struct vring_used_elem used[num];
124 * __u16 avail_event_idx;
125 * };
126 */
127/* We publish the used event index at the end of the available ring, and vice
128 * versa. They are at the end for backwards compatibility. */
129#define vring_used_event(vr) ((vr)->avail->ring[(vr)->num])
130#define vring_avail_event(vr) (*(__u16 *)&(vr)->used->ring[(vr)->num])
131
132static inline void vring_init(struct vring *vr, unsigned int num, void *p,
133 unsigned long align)
134{
135 vr->num = num;
136 vr->desc = p;
137 vr->avail = p + num*sizeof(struct vring_desc);
138 vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + sizeof(__u16)
139 + align-1) & ~(align - 1));
140}
141
142static inline unsigned vring_size(unsigned int num, unsigned long align)
143{
144 return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (3 + num)
145 + align - 1) & ~(align - 1))
146 + sizeof(__u16) * 3 + sizeof(struct vring_used_elem) * num;
147}
148
149/* The following is used with USED_EVENT_IDX and AVAIL_EVENT_IDX */
150/* Assuming a given event_idx value from the other size, if
151 * we have just incremented index from old to new_idx,
152 * should we trigger an event? */
153static inline int vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old)
154{
155 /* Note: Xen has similar logic for notification hold-off
156 * in include/xen/interface/io/ring.h with req_event and req_prod
157 * corresponding to event_idx + 1 and new_idx respectively.
158 * Note also that req_event and req_prod in Xen start at 1,
159 * event indexes in virtio start at 0. */
160 return (__u16)(new_idx - event_idx - 1) < (__u16)(new_idx - old);
161}
162
163#endif /* _UAPI_LINUX_VIRTIO_RING_H */
diff --git a/include/linux/virtio_rng.h b/include/uapi/linux/virtio_rng.h
index c4d5de896f0c..c4d5de896f0c 100644
--- a/include/linux/virtio_rng.h
+++ b/include/uapi/linux/virtio_rng.h
diff --git a/include/uapi/linux/vt.h b/include/uapi/linux/vt.h
new file mode 100644
index 000000000000..4b59a26799a3
--- /dev/null
+++ b/include/uapi/linux/vt.h
@@ -0,0 +1,90 @@
1#ifndef _UAPI_LINUX_VT_H
2#define _UAPI_LINUX_VT_H
3
4
5/*
6 * These constants are also useful for user-level apps (e.g., VC
7 * resizing).
8 */
9#define MIN_NR_CONSOLES 1 /* must be at least 1 */
10#define MAX_NR_CONSOLES 63 /* serial lines start at 64 */
11#define MAX_NR_USER_CONSOLES 63 /* must be root to allocate above this */
12 /* Note: the ioctl VT_GETSTATE does not work for
13 consoles 16 and higher (since it returns a short) */
14
15/* 0x56 is 'V', to avoid collision with termios and kd */
16
17#define VT_OPENQRY 0x5600 /* find available vt */
18
19struct vt_mode {
20 char mode; /* vt mode */
21 char waitv; /* if set, hang on writes if not active */
22 short relsig; /* signal to raise on release req */
23 short acqsig; /* signal to raise on acquisition */
24 short frsig; /* unused (set to 0) */
25};
26#define VT_GETMODE 0x5601 /* get mode of active vt */
27#define VT_SETMODE 0x5602 /* set mode of active vt */
28#define VT_AUTO 0x00 /* auto vt switching */
29#define VT_PROCESS 0x01 /* process controls switching */
30#define VT_ACKACQ 0x02 /* acknowledge switch */
31
32struct vt_stat {
33 unsigned short v_active; /* active vt */
34 unsigned short v_signal; /* signal to send */
35 unsigned short v_state; /* vt bitmask */
36};
37#define VT_GETSTATE 0x5603 /* get global vt state info */
38#define VT_SENDSIG 0x5604 /* signal to send to bitmask of vts */
39
40#define VT_RELDISP 0x5605 /* release display */
41
42#define VT_ACTIVATE 0x5606 /* make vt active */
43#define VT_WAITACTIVE 0x5607 /* wait for vt active */
44#define VT_DISALLOCATE 0x5608 /* free memory associated to vt */
45
46struct vt_sizes {
47 unsigned short v_rows; /* number of rows */
48 unsigned short v_cols; /* number of columns */
49 unsigned short v_scrollsize; /* number of lines of scrollback */
50};
51#define VT_RESIZE 0x5609 /* set kernel's idea of screensize */
52
53struct vt_consize {
54 unsigned short v_rows; /* number of rows */
55 unsigned short v_cols; /* number of columns */
56 unsigned short v_vlin; /* number of pixel rows on screen */
57 unsigned short v_clin; /* number of pixel rows per character */
58 unsigned short v_vcol; /* number of pixel columns on screen */
59 unsigned short v_ccol; /* number of pixel columns per character */
60};
61#define VT_RESIZEX 0x560A /* set kernel's idea of screensize + more */
62#define VT_LOCKSWITCH 0x560B /* disallow vt switching */
63#define VT_UNLOCKSWITCH 0x560C /* allow vt switching */
64#define VT_GETHIFONTMASK 0x560D /* return hi font mask */
65
66struct vt_event {
67 unsigned int event;
68#define VT_EVENT_SWITCH 0x0001 /* Console switch */
69#define VT_EVENT_BLANK 0x0002 /* Screen blank */
70#define VT_EVENT_UNBLANK 0x0004 /* Screen unblank */
71#define VT_EVENT_RESIZE 0x0008 /* Resize display */
72#define VT_MAX_EVENT 0x000F
73 unsigned int oldev; /* Old console */
74 unsigned int newev; /* New console (if changing) */
75 unsigned int pad[4]; /* Padding for expansion */
76};
77
78#define VT_WAITEVENT 0x560E /* Wait for an event */
79
80struct vt_setactivate {
81 unsigned int console;
82 struct vt_mode mode;
83};
84
85#define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */
86
87
88#define vt_get_kmsg_redirect() vt_kmsg_redirect(-1)
89
90#endif /* _UAPI_LINUX_VT_H */
diff --git a/include/uapi/linux/wait.h b/include/uapi/linux/wait.h
new file mode 100644
index 000000000000..9393eead23e2
--- /dev/null
+++ b/include/uapi/linux/wait.h
@@ -0,0 +1,21 @@
1#ifndef _UAPI_LINUX_WAIT_H
2#define _UAPI_LINUX_WAIT_H
3
4#define WNOHANG 0x00000001
5#define WUNTRACED 0x00000002
6#define WSTOPPED WUNTRACED
7#define WEXITED 0x00000004
8#define WCONTINUED 0x00000008
9#define WNOWAIT 0x01000000 /* Don't reap, just poll status. */
10
11#define __WNOTHREAD 0x20000000 /* Don't wait on children of other threads in this group */
12#define __WALL 0x40000000 /* Wait on all children, regardless of type */
13#define __WCLONE 0x80000000 /* Wait only on non-SIGCHLD children */
14
15/* First argument to waitid: */
16#define P_ALL 0
17#define P_PID 1
18#define P_PGID 2
19
20
21#endif /* _UAPI_LINUX_WAIT_H */
diff --git a/include/uapi/linux/wanrouter.h b/include/uapi/linux/wanrouter.h
new file mode 100644
index 000000000000..7617df2833d5
--- /dev/null
+++ b/include/uapi/linux/wanrouter.h
@@ -0,0 +1,452 @@
1/*****************************************************************************
2* wanrouter.h Definitions for the WAN Multiprotocol Router Module.
3* This module provides API and common services for WAN Link
4* Drivers and is completely hardware-independent.
5*
6* Author: Nenad Corbic <ncorbic@sangoma.com>
7* Gideon Hack
8* Additions: Arnaldo Melo
9*
10* Copyright: (c) 1995-2000 Sangoma Technologies Inc.
11*
12* This program is free software; you can redistribute it and/or
13* modify it under the terms of the GNU General Public License
14* as published by the Free Software Foundation; either version
15* 2 of the License, or (at your option) any later version.
16* ============================================================================
17* Jul 21, 2000 Nenad Corbic Added WAN_FT1_READY State
18* Feb 24, 2000 Nenad Corbic Added support for socket based x25api
19* Jan 28, 2000 Nenad Corbic Added support for the ASYNC protocol.
20* Oct 04, 1999 Nenad Corbic Updated for 2.1.0 release
21* Jun 02, 1999 Gideon Hack Added support for the S514 adapter.
22* May 23, 1999 Arnaldo Melo Added local_addr to wanif_conf_t
23* WAN_DISCONNECTING state added
24* Jul 20, 1998 David Fong Added Inverse ARP options to 'wanif_conf_t'
25* Jun 12, 1998 David Fong Added Cisco HDLC support.
26* Dec 16, 1997 Jaspreet Singh Moved 'enable_IPX' and 'network_number' to
27* 'wanif_conf_t'
28* Dec 05, 1997 Jaspreet Singh Added 'pap', 'chap' to 'wanif_conf_t'
29* Added 'authenticator' to 'wan_ppp_conf_t'
30* Nov 06, 1997 Jaspreet Singh Changed Router Driver version to 1.1 from 1.0
31* Oct 20, 1997 Jaspreet Singh Added 'cir','bc','be' and 'mc' to 'wanif_conf_t'
32* Added 'enable_IPX' and 'network_number' to
33* 'wan_device_t'. Also added defines for
34* UDP PACKET TYPE, Interrupt test, critical values
35* for RACE conditions.
36* Oct 05, 1997 Jaspreet Singh Added 'dlci_num' and 'dlci[100]' to
37* 'wan_fr_conf_t' to configure a list of dlci(s)
38* for a NODE
39* Jul 07, 1997 Jaspreet Singh Added 'ttl' to 'wandev_conf_t' & 'wan_device_t'
40* May 29, 1997 Jaspreet Singh Added 'tx_int_enabled' to 'wan_device_t'
41* May 21, 1997 Jaspreet Singh Added 'udp_port' to 'wan_device_t'
42* Apr 25, 1997 Farhan Thawar Added 'udp_port' to 'wandev_conf_t'
43* Jan 16, 1997 Gene Kozin router_devlist made public
44* Jan 02, 1997 Gene Kozin Initial version (based on wanpipe.h).
45*****************************************************************************/
46
47#ifndef _UAPI_ROUTER_H
48#define _UAPI_ROUTER_H
49
50#define ROUTER_NAME "wanrouter" /* in case we ever change it */
51#define ROUTER_VERSION 1 /* version number */
52#define ROUTER_RELEASE 1 /* release (minor version) number */
53#define ROUTER_IOCTL 'W' /* for IOCTL calls */
54#define ROUTER_MAGIC 0x524D4157L /* signature: 'WANR' reversed */
55
56/* IOCTL codes for /proc/router/<device> entries (up to 255) */
57enum router_ioctls
58{
59 ROUTER_SETUP = ROUTER_IOCTL<<8, /* configure device */
60 ROUTER_DOWN, /* shut down device */
61 ROUTER_STAT, /* get device status */
62 ROUTER_IFNEW, /* add interface */
63 ROUTER_IFDEL, /* delete interface */
64 ROUTER_IFSTAT, /* get interface status */
65 ROUTER_USER = (ROUTER_IOCTL<<8)+16, /* driver-specific calls */
66 ROUTER_USER_MAX = (ROUTER_IOCTL<<8)+31
67};
68
69/* identifiers for displaying proc file data for dual port adapters */
70#define PROC_DATA_PORT_0 0x8000 /* the data is for port 0 */
71#define PROC_DATA_PORT_1 0x8001 /* the data is for port 1 */
72
73/* NLPID for packet encapsulation (ISO/IEC TR 9577) */
74#define NLPID_IP 0xCC /* Internet Protocol Datagram */
75#define NLPID_SNAP 0x80 /* IEEE Subnetwork Access Protocol */
76#define NLPID_CLNP 0x81 /* ISO/IEC 8473 */
77#define NLPID_ESIS 0x82 /* ISO/IEC 9542 */
78#define NLPID_ISIS 0x83 /* ISO/IEC ISIS */
79#define NLPID_Q933 0x08 /* CCITT Q.933 */
80
81/* Miscellaneous */
82#define WAN_IFNAME_SZ 15 /* max length of the interface name */
83#define WAN_DRVNAME_SZ 15 /* max length of the link driver name */
84#define WAN_ADDRESS_SZ 31 /* max length of the WAN media address */
85#define USED_BY_FIELD 8 /* max length of the used by field */
86
87/* Defines for UDP PACKET TYPE */
88#define UDP_PTPIPE_TYPE 0x01
89#define UDP_FPIPE_TYPE 0x02
90#define UDP_CPIPE_TYPE 0x03
91#define UDP_DRVSTATS_TYPE 0x04
92#define UDP_INVALID_TYPE 0x05
93
94/* Command return code */
95#define CMD_OK 0 /* normal firmware return code */
96#define CMD_TIMEOUT 0xFF /* firmware command timed out */
97
98/* UDP Packet Management */
99#define UDP_PKT_FRM_STACK 0x00
100#define UDP_PKT_FRM_NETWORK 0x01
101
102/* Maximum interrupt test counter */
103#define MAX_INTR_TEST_COUNTER 100
104
105/* Critical Values for RACE conditions*/
106#define CRITICAL_IN_ISR 0xA1
107#define CRITICAL_INTR_HANDLED 0xB1
108
109/****** Data Types **********************************************************/
110
111/*----------------------------------------------------------------------------
112 * X.25-specific link-level configuration.
113 */
114typedef struct wan_x25_conf
115{
116 unsigned lo_pvc; /* lowest permanent circuit number */
117 unsigned hi_pvc; /* highest permanent circuit number */
118 unsigned lo_svc; /* lowest switched circuit number */
119 unsigned hi_svc; /* highest switched circuit number */
120 unsigned hdlc_window; /* HDLC window size (1..7) */
121 unsigned pkt_window; /* X.25 packet window size (1..7) */
122 unsigned t1; /* HDLC timer T1, sec (1..30) */
123 unsigned t2; /* HDLC timer T2, sec (0..29) */
124 unsigned t4; /* HDLC supervisory frame timer = T4 * T1 */
125 unsigned n2; /* HDLC retransmission limit (1..30) */
126 unsigned t10_t20; /* X.25 RESTART timeout, sec (1..255) */
127 unsigned t11_t21; /* X.25 CALL timeout, sec (1..255) */
128 unsigned t12_t22; /* X.25 RESET timeout, sec (1..255) */
129 unsigned t13_t23; /* X.25 CLEAR timeout, sec (1..255) */
130 unsigned t16_t26; /* X.25 INTERRUPT timeout, sec (1..255) */
131 unsigned t28; /* X.25 REGISTRATION timeout, sec (1..255) */
132 unsigned r10_r20; /* RESTART retransmission limit (0..250) */
133 unsigned r12_r22; /* RESET retransmission limit (0..250) */
134 unsigned r13_r23; /* CLEAR retransmission limit (0..250) */
135 unsigned ccitt_compat; /* compatibility mode: 1988/1984/1980 */
136 unsigned x25_conf_opt; /* User defined x25 config optoins */
137 unsigned char LAPB_hdlc_only; /* Run in HDLC only mode */
138 unsigned char logging; /* Control connection logging */
139 unsigned char oob_on_modem; /* Whether to send modem status to the user app */
140} wan_x25_conf_t;
141
142/*----------------------------------------------------------------------------
143 * Frame relay specific link-level configuration.
144 */
145typedef struct wan_fr_conf
146{
147 unsigned signalling; /* local in-channel signalling type */
148 unsigned t391; /* link integrity verification timer */
149 unsigned t392; /* polling verification timer */
150 unsigned n391; /* full status polling cycle counter */
151 unsigned n392; /* error threshold counter */
152 unsigned n393; /* monitored events counter */
153 unsigned dlci_num; /* number of DLCs (access node) */
154 unsigned dlci[100]; /* List of all DLCIs */
155} wan_fr_conf_t;
156
157/*----------------------------------------------------------------------------
158 * PPP-specific link-level configuration.
159 */
160typedef struct wan_ppp_conf
161{
162 unsigned restart_tmr; /* restart timer */
163 unsigned auth_rsrt_tmr; /* authentication timer */
164 unsigned auth_wait_tmr; /* authentication timer */
165 unsigned mdm_fail_tmr; /* modem failure timer */
166 unsigned dtr_drop_tmr; /* DTR drop timer */
167 unsigned connect_tmout; /* connection timeout */
168 unsigned conf_retry; /* max. retry */
169 unsigned term_retry; /* max. retry */
170 unsigned fail_retry; /* max. retry */
171 unsigned auth_retry; /* max. retry */
172 unsigned auth_options; /* authentication opt. */
173 unsigned ip_options; /* IP options */
174 char authenticator; /* AUTHENTICATOR or not */
175 char ip_mode; /* Static/Host/Peer */
176} wan_ppp_conf_t;
177
178/*----------------------------------------------------------------------------
179 * CHDLC-specific link-level configuration.
180 */
181typedef struct wan_chdlc_conf
182{
183 unsigned char ignore_dcd; /* Protocol options: */
184 unsigned char ignore_cts; /* Ignore these to determine */
185 unsigned char ignore_keepalive; /* link status (Yes or No) */
186 unsigned char hdlc_streaming; /* hdlc_streaming mode (Y/N) */
187 unsigned char receive_only; /* no transmit buffering (Y/N) */
188 unsigned keepalive_tx_tmr; /* transmit keepalive timer */
189 unsigned keepalive_rx_tmr; /* receive keepalive timer */
190 unsigned keepalive_err_margin; /* keepalive_error_tolerance */
191 unsigned slarp_timer; /* SLARP request timer */
192} wan_chdlc_conf_t;
193
194
195/*----------------------------------------------------------------------------
196 * WAN device configuration. Passed to ROUTER_SETUP IOCTL.
197 */
198typedef struct wandev_conf
199{
200 unsigned magic; /* magic number (for verification) */
201 unsigned config_id; /* configuration structure identifier */
202 /****** hardware configuration ******/
203 unsigned ioport; /* adapter I/O port base */
204 unsigned long maddr; /* dual-port memory address */
205 unsigned msize; /* dual-port memory size */
206 int irq; /* interrupt request level */
207 int dma; /* DMA request level */
208 char S514_CPU_no[1]; /* S514 PCI adapter CPU number ('A' or 'B') */
209 unsigned PCI_slot_no; /* S514 PCI adapter slot number */
210 char auto_pci_cfg; /* S515 PCI automatic slot detection */
211 char comm_port; /* Communication Port (PRI=0, SEC=1) */
212 unsigned bps; /* data transfer rate */
213 unsigned mtu; /* maximum transmit unit size */
214 unsigned udp_port; /* UDP port for management */
215 unsigned char ttl; /* Time To Live for UDP security */
216 unsigned char ft1; /* FT1 Configurator Option */
217 char interface; /* RS-232/V.35, etc. */
218 char clocking; /* external/internal */
219 char line_coding; /* NRZ/NRZI/FM0/FM1, etc. */
220 char station; /* DTE/DCE, primary/secondary, etc. */
221 char connection; /* permanent/switched/on-demand */
222 char read_mode; /* read mode: Polling or interrupt */
223 char receive_only; /* disable tx buffers */
224 char tty; /* Create a fake tty device */
225 unsigned tty_major; /* Major number for wanpipe tty device */
226 unsigned tty_minor; /* Minor number for wanpipe tty device */
227 unsigned tty_mode; /* TTY operation mode SYNC or ASYNC */
228 char backup; /* Backup Mode */
229 unsigned hw_opt[4]; /* other hardware options */
230 unsigned reserved[4];
231 /****** arbitrary data ***************/
232 unsigned data_size; /* data buffer size */
233 void* data; /* data buffer, e.g. firmware */
234 union /****** protocol-specific ************/
235 {
236 wan_x25_conf_t x25; /* X.25 configuration */
237 wan_ppp_conf_t ppp; /* PPP configuration */
238 wan_fr_conf_t fr; /* frame relay configuration */
239 wan_chdlc_conf_t chdlc; /* Cisco HDLC configuration */
240 } u;
241} wandev_conf_t;
242
243/* 'config_id' definitions */
244#define WANCONFIG_X25 101 /* X.25 link */
245#define WANCONFIG_FR 102 /* frame relay link */
246#define WANCONFIG_PPP 103 /* synchronous PPP link */
247#define WANCONFIG_CHDLC 104 /* Cisco HDLC Link */
248#define WANCONFIG_BSC 105 /* BiSync Streaming */
249#define WANCONFIG_HDLC 106 /* HDLC Support */
250#define WANCONFIG_MPPP 107 /* Multi Port PPP over RAW CHDLC */
251
252/*
253 * Configuration options defines.
254 */
255/* general options */
256#define WANOPT_OFF 0
257#define WANOPT_ON 1
258#define WANOPT_NO 0
259#define WANOPT_YES 1
260
261/* intercace options */
262#define WANOPT_RS232 0
263#define WANOPT_V35 1
264
265/* data encoding options */
266#define WANOPT_NRZ 0
267#define WANOPT_NRZI 1
268#define WANOPT_FM0 2
269#define WANOPT_FM1 3
270
271/* link type options */
272#define WANOPT_POINTTOPOINT 0 /* RTS always active */
273#define WANOPT_MULTIDROP 1 /* RTS is active when transmitting */
274
275/* clocking options */
276#define WANOPT_EXTERNAL 0
277#define WANOPT_INTERNAL 1
278
279/* station options */
280#define WANOPT_DTE 0
281#define WANOPT_DCE 1
282#define WANOPT_CPE 0
283#define WANOPT_NODE 1
284#define WANOPT_SECONDARY 0
285#define WANOPT_PRIMARY 1
286
287/* connection options */
288#define WANOPT_PERMANENT 0 /* DTR always active */
289#define WANOPT_SWITCHED 1 /* use DTR to setup link (dial-up) */
290#define WANOPT_ONDEMAND 2 /* activate DTR only before sending */
291
292/* frame relay in-channel signalling */
293#define WANOPT_FR_ANSI 1 /* ANSI T1.617 Annex D */
294#define WANOPT_FR_Q933 2 /* ITU Q.933A */
295#define WANOPT_FR_LMI 3 /* LMI */
296
297/* PPP IP Mode Options */
298#define WANOPT_PPP_STATIC 0
299#define WANOPT_PPP_HOST 1
300#define WANOPT_PPP_PEER 2
301
302/* ASY Mode Options */
303#define WANOPT_ONE 1
304#define WANOPT_TWO 2
305#define WANOPT_ONE_AND_HALF 3
306
307#define WANOPT_NONE 0
308#define WANOPT_ODD 1
309#define WANOPT_EVEN 2
310
311/* CHDLC Protocol Options */
312/* DF Commented out for now.
313
314#define WANOPT_CHDLC_NO_DCD IGNORE_DCD_FOR_LINK_STAT
315#define WANOPT_CHDLC_NO_CTS IGNORE_CTS_FOR_LINK_STAT
316#define WANOPT_CHDLC_NO_KEEPALIVE IGNORE_KPALV_FOR_LINK_STAT
317*/
318
319/* Port options */
320#define WANOPT_PRI 0
321#define WANOPT_SEC 1
322/* read mode */
323#define WANOPT_INTR 0
324#define WANOPT_POLL 1
325
326
327#define WANOPT_TTY_SYNC 0
328#define WANOPT_TTY_ASYNC 1
329/*----------------------------------------------------------------------------
330 * WAN Link Status Info (for ROUTER_STAT IOCTL).
331 */
332typedef struct wandev_stat
333{
334 unsigned state; /* link state */
335 unsigned ndev; /* number of configured interfaces */
336
337 /* link/interface configuration */
338 unsigned connection; /* permanent/switched/on-demand */
339 unsigned media_type; /* Frame relay/PPP/X.25/SDLC, etc. */
340 unsigned mtu; /* max. transmit unit for this device */
341
342 /* physical level statistics */
343 unsigned modem_status; /* modem status */
344 unsigned rx_frames; /* received frames count */
345 unsigned rx_overruns; /* receiver overrun error count */
346 unsigned rx_crc_err; /* receive CRC error count */
347 unsigned rx_aborts; /* received aborted frames count */
348 unsigned rx_bad_length; /* unexpetedly long/short frames count */
349 unsigned rx_dropped; /* frames discarded at device level */
350 unsigned tx_frames; /* transmitted frames count */
351 unsigned tx_underruns; /* aborted transmissions (underruns) count */
352 unsigned tx_timeouts; /* transmission timeouts */
353 unsigned tx_rejects; /* other transmit errors */
354
355 /* media level statistics */
356 unsigned rx_bad_format; /* frames with invalid format */
357 unsigned rx_bad_addr; /* frames with invalid media address */
358 unsigned tx_retries; /* frames re-transmitted */
359 unsigned reserved[16]; /* reserved for future use */
360} wandev_stat_t;
361
362/* 'state' defines */
363enum wan_states
364{
365 WAN_UNCONFIGURED, /* link/channel is not configured */
366 WAN_DISCONNECTED, /* link/channel is disconnected */
367 WAN_CONNECTING, /* connection is in progress */
368 WAN_CONNECTED, /* link/channel is operational */
369 WAN_LIMIT, /* for verification only */
370 WAN_DUALPORT, /* for Dual Port cards */
371 WAN_DISCONNECTING,
372 WAN_FT1_READY /* FT1 Configurator Ready */
373};
374
375enum {
376 WAN_LOCAL_IP,
377 WAN_POINTOPOINT_IP,
378 WAN_NETMASK_IP,
379 WAN_BROADCAST_IP
380};
381
382/* 'modem_status' masks */
383#define WAN_MODEM_CTS 0x0001 /* CTS line active */
384#define WAN_MODEM_DCD 0x0002 /* DCD line active */
385#define WAN_MODEM_DTR 0x0010 /* DTR line active */
386#define WAN_MODEM_RTS 0x0020 /* RTS line active */
387
388/*----------------------------------------------------------------------------
389 * WAN interface (logical channel) configuration (for ROUTER_IFNEW IOCTL).
390 */
391typedef struct wanif_conf
392{
393 unsigned magic; /* magic number */
394 unsigned config_id; /* configuration identifier */
395 char name[WAN_IFNAME_SZ+1]; /* interface name, ASCIIZ */
396 char addr[WAN_ADDRESS_SZ+1]; /* media address, ASCIIZ */
397 char usedby[USED_BY_FIELD]; /* used by API or WANPIPE */
398 unsigned idle_timeout; /* sec, before disconnecting */
399 unsigned hold_timeout; /* sec, before re-connecting */
400 unsigned cir; /* Committed Information Rate fwd,bwd*/
401 unsigned bc; /* Committed Burst Size fwd, bwd */
402 unsigned be; /* Excess Burst Size fwd, bwd */
403 unsigned char enable_IPX; /* Enable or Disable IPX */
404 unsigned char inarp; /* Send Inverse ARP requests Y/N */
405 unsigned inarp_interval; /* sec, between InARP requests */
406 unsigned long network_number; /* Network Number for IPX */
407 char mc; /* Multicast on or off */
408 char local_addr[WAN_ADDRESS_SZ+1];/* local media address, ASCIIZ */
409 unsigned char port; /* board port */
410 unsigned char protocol; /* prococol used in this channel (TCPOX25 or X25) */
411 char pap; /* PAP enabled or disabled */
412 char chap; /* CHAP enabled or disabled */
413 unsigned char userid[511]; /* List of User Id */
414 unsigned char passwd[511]; /* List of passwords */
415 unsigned char sysname[31]; /* Name of the system */
416 unsigned char ignore_dcd; /* Protocol options: */
417 unsigned char ignore_cts; /* Ignore these to determine */
418 unsigned char ignore_keepalive; /* link status (Yes or No) */
419 unsigned char hdlc_streaming; /* Hdlc streaming mode (Y/N) */
420 unsigned keepalive_tx_tmr; /* transmit keepalive timer */
421 unsigned keepalive_rx_tmr; /* receive keepalive timer */
422 unsigned keepalive_err_margin; /* keepalive_error_tolerance */
423 unsigned slarp_timer; /* SLARP request timer */
424 unsigned char ttl; /* Time To Live for UDP security */
425 char interface; /* RS-232/V.35, etc. */
426 char clocking; /* external/internal */
427 unsigned bps; /* data transfer rate */
428 unsigned mtu; /* maximum transmit unit size */
429 unsigned char if_down; /* brind down interface when disconnected */
430 unsigned char gateway; /* Is this interface a gateway */
431 unsigned char true_if_encoding; /* Set the dev->type to true board protocol */
432
433 unsigned char asy_data_trans; /* async API options */
434 unsigned char rts_hs_for_receive; /* async Protocol options */
435 unsigned char xon_xoff_hs_for_receive;
436 unsigned char xon_xoff_hs_for_transmit;
437 unsigned char dcd_hs_for_transmit;
438 unsigned char cts_hs_for_transmit;
439 unsigned char async_mode;
440 unsigned tx_bits_per_char;
441 unsigned rx_bits_per_char;
442 unsigned stop_bits;
443 unsigned char parity;
444 unsigned break_timer;
445 unsigned inter_char_timer;
446 unsigned rx_complete_length;
447 unsigned xon_char;
448 unsigned xoff_char;
449 unsigned char receive_only; /* no transmit buffering (Y/N) */
450} wanif_conf_t;
451
452#endif /* _UAPI_ROUTER_H */
diff --git a/include/uapi/linux/watchdog.h b/include/uapi/linux/watchdog.h
new file mode 100644
index 000000000000..2babe72870ba
--- /dev/null
+++ b/include/uapi/linux/watchdog.h
@@ -0,0 +1,57 @@
1/*
2 * Generic watchdog defines. Derived from..
3 *
4 * Berkshire PC Watchdog Defines
5 * by Ken Hollis <khollis@bitgate.com>
6 *
7 */
8
9#ifndef _UAPI_LINUX_WATCHDOG_H
10#define _UAPI_LINUX_WATCHDOG_H
11
12#include <linux/ioctl.h>
13#include <linux/types.h>
14
15#define WATCHDOG_IOCTL_BASE 'W'
16
17struct watchdog_info {
18 __u32 options; /* Options the card/driver supports */
19 __u32 firmware_version; /* Firmware version of the card */
20 __u8 identity[32]; /* Identity of the board */
21};
22
23#define WDIOC_GETSUPPORT _IOR(WATCHDOG_IOCTL_BASE, 0, struct watchdog_info)
24#define WDIOC_GETSTATUS _IOR(WATCHDOG_IOCTL_BASE, 1, int)
25#define WDIOC_GETBOOTSTATUS _IOR(WATCHDOG_IOCTL_BASE, 2, int)
26#define WDIOC_GETTEMP _IOR(WATCHDOG_IOCTL_BASE, 3, int)
27#define WDIOC_SETOPTIONS _IOR(WATCHDOG_IOCTL_BASE, 4, int)
28#define WDIOC_KEEPALIVE _IOR(WATCHDOG_IOCTL_BASE, 5, int)
29#define WDIOC_SETTIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 6, int)
30#define WDIOC_GETTIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 7, int)
31#define WDIOC_SETPRETIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 8, int)
32#define WDIOC_GETPRETIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 9, int)
33#define WDIOC_GETTIMELEFT _IOR(WATCHDOG_IOCTL_BASE, 10, int)
34
35#define WDIOF_UNKNOWN -1 /* Unknown flag error */
36#define WDIOS_UNKNOWN -1 /* Unknown status error */
37
38#define WDIOF_OVERHEAT 0x0001 /* Reset due to CPU overheat */
39#define WDIOF_FANFAULT 0x0002 /* Fan failed */
40#define WDIOF_EXTERN1 0x0004 /* External relay 1 */
41#define WDIOF_EXTERN2 0x0008 /* External relay 2 */
42#define WDIOF_POWERUNDER 0x0010 /* Power bad/power fault */
43#define WDIOF_CARDRESET 0x0020 /* Card previously reset the CPU */
44#define WDIOF_POWEROVER 0x0040 /* Power over voltage */
45#define WDIOF_SETTIMEOUT 0x0080 /* Set timeout (in seconds) */
46#define WDIOF_MAGICCLOSE 0x0100 /* Supports magic close char */
47#define WDIOF_PRETIMEOUT 0x0200 /* Pretimeout (in seconds), get/set */
48#define WDIOF_ALARMONLY 0x0400 /* Watchdog triggers a management or
49 other external alarm not a reboot */
50#define WDIOF_KEEPALIVEPING 0x8000 /* Keep alive ping reply */
51
52#define WDIOS_DISABLECARD 0x0001 /* Turn off the watchdog timer */
53#define WDIOS_ENABLECARD 0x0002 /* Turn on the watchdog timer */
54#define WDIOS_TEMPPANIC 0x0004 /* Kernel panic on temperature trip */
55
56
57#endif /* _UAPI_LINUX_WATCHDOG_H */
diff --git a/include/linux/wimax.h b/include/uapi/linux/wimax.h
index 9f6b77af2f6d..9f6b77af2f6d 100644
--- a/include/linux/wimax.h
+++ b/include/uapi/linux/wimax.h
diff --git a/include/uapi/linux/wimax/Kbuild b/include/uapi/linux/wimax/Kbuild
index aafaa5aa54d4..1c97be49971f 100644
--- a/include/uapi/linux/wimax/Kbuild
+++ b/include/uapi/linux/wimax/Kbuild
@@ -1 +1,2 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += i2400m.h
diff --git a/include/linux/wimax/i2400m.h b/include/uapi/linux/wimax/i2400m.h
index 62d356153565..62d356153565 100644
--- a/include/linux/wimax/i2400m.h
+++ b/include/uapi/linux/wimax/i2400m.h
diff --git a/include/uapi/linux/wireless.h b/include/uapi/linux/wireless.h
new file mode 100644
index 000000000000..c1592e3e4036
--- /dev/null
+++ b/include/uapi/linux/wireless.h
@@ -0,0 +1,1128 @@
1/*
2 * This file define a set of standard wireless extensions
3 *
4 * Version : 22 16.3.07
5 *
6 * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com>
7 * Copyright (c) 1997-2007 Jean Tourrilhes, All Rights Reserved.
8 */
9
10#ifndef _UAPI_LINUX_WIRELESS_H
11#define _UAPI_LINUX_WIRELESS_H
12
13/************************** DOCUMENTATION **************************/
14/*
15 * Initial APIs (1996 -> onward) :
16 * -----------------------------
17 * Basically, the wireless extensions are for now a set of standard ioctl
18 * call + /proc/net/wireless
19 *
20 * The entry /proc/net/wireless give statistics and information on the
21 * driver.
22 * This is better than having each driver having its entry because
23 * its centralised and we may remove the driver module safely.
24 *
25 * Ioctl are used to configure the driver and issue commands. This is
26 * better than command line options of insmod because we may want to
27 * change dynamically (while the driver is running) some parameters.
28 *
29 * The ioctl mechanimsm are copied from standard devices ioctl.
30 * We have the list of command plus a structure descibing the
31 * data exchanged...
32 * Note that to add these ioctl, I was obliged to modify :
33 * # net/core/dev.c (two place + add include)
34 * # net/ipv4/af_inet.c (one place + add include)
35 *
36 * /proc/net/wireless is a copy of /proc/net/dev.
37 * We have a structure for data passed from the driver to /proc/net/wireless
38 * Too add this, I've modified :
39 * # net/core/dev.c (two other places)
40 * # include/linux/netdevice.h (one place)
41 * # include/linux/proc_fs.h (one place)
42 *
43 * New driver API (2002 -> onward) :
44 * -------------------------------
45 * This file is only concerned with the user space API and common definitions.
46 * The new driver API is defined and documented in :
47 * # include/net/iw_handler.h
48 *
49 * Note as well that /proc/net/wireless implementation has now moved in :
50 * # net/core/wireless.c
51 *
52 * Wireless Events (2002 -> onward) :
53 * --------------------------------
54 * Events are defined at the end of this file, and implemented in :
55 * # net/core/wireless.c
56 *
57 * Other comments :
58 * --------------
59 * Do not add here things that are redundant with other mechanisms
60 * (drivers init, ifconfig, /proc/net/dev, ...) and with are not
61 * wireless specific.
62 *
63 * These wireless extensions are not magic : each driver has to provide
64 * support for them...
65 *
66 * IMPORTANT NOTE : As everything in the kernel, this is very much a
67 * work in progress. Contact me if you have ideas of improvements...
68 */
69
70/***************************** INCLUDES *****************************/
71
72#include <linux/types.h> /* for __u* and __s* typedefs */
73#include <linux/socket.h> /* for "struct sockaddr" et al */
74#include <linux/if.h> /* for IFNAMSIZ and co... */
75
76/***************************** VERSION *****************************/
77/*
78 * This constant is used to know the availability of the wireless
79 * extensions and to know which version of wireless extensions it is
80 * (there is some stuff that will be added in the future...)
81 * I just plan to increment with each new version.
82 */
83#define WIRELESS_EXT 22
84
85/*
86 * Changes :
87 *
88 * V2 to V3
89 * --------
90 * Alan Cox start some incompatibles changes. I've integrated a bit more.
91 * - Encryption renamed to Encode to avoid US regulation problems
92 * - Frequency changed from float to struct to avoid problems on old 386
93 *
94 * V3 to V4
95 * --------
96 * - Add sensitivity
97 *
98 * V4 to V5
99 * --------
100 * - Missing encoding definitions in range
101 * - Access points stuff
102 *
103 * V5 to V6
104 * --------
105 * - 802.11 support (ESSID ioctls)
106 *
107 * V6 to V7
108 * --------
109 * - define IW_ESSID_MAX_SIZE and IW_MAX_AP
110 *
111 * V7 to V8
112 * --------
113 * - Changed my e-mail address
114 * - More 802.11 support (nickname, rate, rts, frag)
115 * - List index in frequencies
116 *
117 * V8 to V9
118 * --------
119 * - Support for 'mode of operation' (ad-hoc, managed...)
120 * - Support for unicast and multicast power saving
121 * - Change encoding to support larger tokens (>64 bits)
122 * - Updated iw_params (disable, flags) and use it for NWID
123 * - Extracted iw_point from iwreq for clarity
124 *
125 * V9 to V10
126 * ---------
127 * - Add PM capability to range structure
128 * - Add PM modifier : MAX/MIN/RELATIVE
129 * - Add encoding option : IW_ENCODE_NOKEY
130 * - Add TxPower ioctls (work like TxRate)
131 *
132 * V10 to V11
133 * ----------
134 * - Add WE version in range (help backward/forward compatibility)
135 * - Add retry ioctls (work like PM)
136 *
137 * V11 to V12
138 * ----------
139 * - Add SIOCSIWSTATS to get /proc/net/wireless programatically
140 * - Add DEV PRIVATE IOCTL to avoid collisions in SIOCDEVPRIVATE space
141 * - Add new statistics (frag, retry, beacon)
142 * - Add average quality (for user space calibration)
143 *
144 * V12 to V13
145 * ----------
146 * - Document creation of new driver API.
147 * - Extract union iwreq_data from struct iwreq (for new driver API).
148 * - Rename SIOCSIWNAME as SIOCSIWCOMMIT
149 *
150 * V13 to V14
151 * ----------
152 * - Wireless Events support : define struct iw_event
153 * - Define additional specific event numbers
154 * - Add "addr" and "param" fields in union iwreq_data
155 * - AP scanning stuff (SIOCSIWSCAN and friends)
156 *
157 * V14 to V15
158 * ----------
159 * - Add IW_PRIV_TYPE_ADDR for struct sockaddr private arg
160 * - Make struct iw_freq signed (both m & e), add explicit padding
161 * - Add IWEVCUSTOM for driver specific event/scanning token
162 * - Add IW_MAX_GET_SPY for driver returning a lot of addresses
163 * - Add IW_TXPOW_RANGE for range of Tx Powers
164 * - Add IWEVREGISTERED & IWEVEXPIRED events for Access Points
165 * - Add IW_MODE_MONITOR for passive monitor
166 *
167 * V15 to V16
168 * ----------
169 * - Increase the number of bitrates in iw_range to 32 (for 802.11g)
170 * - Increase the number of frequencies in iw_range to 32 (for 802.11b+a)
171 * - Reshuffle struct iw_range for increases, add filler
172 * - Increase IW_MAX_AP to 64 for driver returning a lot of addresses
173 * - Remove IW_MAX_GET_SPY because conflict with enhanced spy support
174 * - Add SIOCSIWTHRSPY/SIOCGIWTHRSPY and "struct iw_thrspy"
175 * - Add IW_ENCODE_TEMP and iw_range->encoding_login_index
176 *
177 * V16 to V17
178 * ----------
179 * - Add flags to frequency -> auto/fixed
180 * - Document (struct iw_quality *)->updated, add new flags (INVALID)
181 * - Wireless Event capability in struct iw_range
182 * - Add support for relative TxPower (yick !)
183 *
184 * V17 to V18 (From Jouni Malinen <j@w1.fi>)
185 * ----------
186 * - Add support for WPA/WPA2
187 * - Add extended encoding configuration (SIOCSIWENCODEEXT and
188 * SIOCGIWENCODEEXT)
189 * - Add SIOCSIWGENIE/SIOCGIWGENIE
190 * - Add SIOCSIWMLME
191 * - Add SIOCSIWPMKSA
192 * - Add struct iw_range bit field for supported encoding capabilities
193 * - Add optional scan request parameters for SIOCSIWSCAN
194 * - Add SIOCSIWAUTH/SIOCGIWAUTH for setting authentication and WPA
195 * related parameters (extensible up to 4096 parameter values)
196 * - Add wireless events: IWEVGENIE, IWEVMICHAELMICFAILURE,
197 * IWEVASSOCREQIE, IWEVASSOCRESPIE, IWEVPMKIDCAND
198 *
199 * V18 to V19
200 * ----------
201 * - Remove (struct iw_point *)->pointer from events and streams
202 * - Remove header includes to help user space
203 * - Increase IW_ENCODING_TOKEN_MAX from 32 to 64
204 * - Add IW_QUAL_ALL_UPDATED and IW_QUAL_ALL_INVALID macros
205 * - Add explicit flag to tell stats are in dBm : IW_QUAL_DBM
206 * - Add IW_IOCTL_IDX() and IW_EVENT_IDX() macros
207 *
208 * V19 to V20
209 * ----------
210 * - RtNetlink requests support (SET/GET)
211 *
212 * V20 to V21
213 * ----------
214 * - Remove (struct net_device *)->get_wireless_stats()
215 * - Change length in ESSID and NICK to strlen() instead of strlen()+1
216 * - Add IW_RETRY_SHORT/IW_RETRY_LONG retry modifiers
217 * - Power/Retry relative values no longer * 100000
218 * - Add explicit flag to tell stats are in 802.11k RCPI : IW_QUAL_RCPI
219 *
220 * V21 to V22
221 * ----------
222 * - Prevent leaking of kernel space in stream on 64 bits.
223 */
224
225/**************************** CONSTANTS ****************************/
226
227/* -------------------------- IOCTL LIST -------------------------- */
228
229/* Wireless Identification */
230#define SIOCSIWCOMMIT 0x8B00 /* Commit pending changes to driver */
231#define SIOCGIWNAME 0x8B01 /* get name == wireless protocol */
232/* SIOCGIWNAME is used to verify the presence of Wireless Extensions.
233 * Common values : "IEEE 802.11-DS", "IEEE 802.11-FH", "IEEE 802.11b"...
234 * Don't put the name of your driver there, it's useless. */
235
236/* Basic operations */
237#define SIOCSIWNWID 0x8B02 /* set network id (pre-802.11) */
238#define SIOCGIWNWID 0x8B03 /* get network id (the cell) */
239#define SIOCSIWFREQ 0x8B04 /* set channel/frequency (Hz) */
240#define SIOCGIWFREQ 0x8B05 /* get channel/frequency (Hz) */
241#define SIOCSIWMODE 0x8B06 /* set operation mode */
242#define SIOCGIWMODE 0x8B07 /* get operation mode */
243#define SIOCSIWSENS 0x8B08 /* set sensitivity (dBm) */
244#define SIOCGIWSENS 0x8B09 /* get sensitivity (dBm) */
245
246/* Informative stuff */
247#define SIOCSIWRANGE 0x8B0A /* Unused */
248#define SIOCGIWRANGE 0x8B0B /* Get range of parameters */
249#define SIOCSIWPRIV 0x8B0C /* Unused */
250#define SIOCGIWPRIV 0x8B0D /* get private ioctl interface info */
251#define SIOCSIWSTATS 0x8B0E /* Unused */
252#define SIOCGIWSTATS 0x8B0F /* Get /proc/net/wireless stats */
253/* SIOCGIWSTATS is strictly used between user space and the kernel, and
254 * is never passed to the driver (i.e. the driver will never see it). */
255
256/* Spy support (statistics per MAC address - used for Mobile IP support) */
257#define SIOCSIWSPY 0x8B10 /* set spy addresses */
258#define SIOCGIWSPY 0x8B11 /* get spy info (quality of link) */
259#define SIOCSIWTHRSPY 0x8B12 /* set spy threshold (spy event) */
260#define SIOCGIWTHRSPY 0x8B13 /* get spy threshold */
261
262/* Access Point manipulation */
263#define SIOCSIWAP 0x8B14 /* set access point MAC addresses */
264#define SIOCGIWAP 0x8B15 /* get access point MAC addresses */
265#define SIOCGIWAPLIST 0x8B17 /* Deprecated in favor of scanning */
266#define SIOCSIWSCAN 0x8B18 /* trigger scanning (list cells) */
267#define SIOCGIWSCAN 0x8B19 /* get scanning results */
268
269/* 802.11 specific support */
270#define SIOCSIWESSID 0x8B1A /* set ESSID (network name) */
271#define SIOCGIWESSID 0x8B1B /* get ESSID */
272#define SIOCSIWNICKN 0x8B1C /* set node name/nickname */
273#define SIOCGIWNICKN 0x8B1D /* get node name/nickname */
274/* As the ESSID and NICKN are strings up to 32 bytes long, it doesn't fit
275 * within the 'iwreq' structure, so we need to use the 'data' member to
276 * point to a string in user space, like it is done for RANGE... */
277
278/* Other parameters useful in 802.11 and some other devices */
279#define SIOCSIWRATE 0x8B20 /* set default bit rate (bps) */
280#define SIOCGIWRATE 0x8B21 /* get default bit rate (bps) */
281#define SIOCSIWRTS 0x8B22 /* set RTS/CTS threshold (bytes) */
282#define SIOCGIWRTS 0x8B23 /* get RTS/CTS threshold (bytes) */
283#define SIOCSIWFRAG 0x8B24 /* set fragmentation thr (bytes) */
284#define SIOCGIWFRAG 0x8B25 /* get fragmentation thr (bytes) */
285#define SIOCSIWTXPOW 0x8B26 /* set transmit power (dBm) */
286#define SIOCGIWTXPOW 0x8B27 /* get transmit power (dBm) */
287#define SIOCSIWRETRY 0x8B28 /* set retry limits and lifetime */
288#define SIOCGIWRETRY 0x8B29 /* get retry limits and lifetime */
289
290/* Encoding stuff (scrambling, hardware security, WEP...) */
291#define SIOCSIWENCODE 0x8B2A /* set encoding token & mode */
292#define SIOCGIWENCODE 0x8B2B /* get encoding token & mode */
293/* Power saving stuff (power management, unicast and multicast) */
294#define SIOCSIWPOWER 0x8B2C /* set Power Management settings */
295#define SIOCGIWPOWER 0x8B2D /* get Power Management settings */
296
297/* WPA : Generic IEEE 802.11 informatiom element (e.g., for WPA/RSN/WMM).
298 * This ioctl uses struct iw_point and data buffer that includes IE id and len
299 * fields. More than one IE may be included in the request. Setting the generic
300 * IE to empty buffer (len=0) removes the generic IE from the driver. Drivers
301 * are allowed to generate their own WPA/RSN IEs, but in these cases, drivers
302 * are required to report the used IE as a wireless event, e.g., when
303 * associating with an AP. */
304#define SIOCSIWGENIE 0x8B30 /* set generic IE */
305#define SIOCGIWGENIE 0x8B31 /* get generic IE */
306
307/* WPA : IEEE 802.11 MLME requests */
308#define SIOCSIWMLME 0x8B16 /* request MLME operation; uses
309 * struct iw_mlme */
310/* WPA : Authentication mode parameters */
311#define SIOCSIWAUTH 0x8B32 /* set authentication mode params */
312#define SIOCGIWAUTH 0x8B33 /* get authentication mode params */
313
314/* WPA : Extended version of encoding configuration */
315#define SIOCSIWENCODEEXT 0x8B34 /* set encoding token & mode */
316#define SIOCGIWENCODEEXT 0x8B35 /* get encoding token & mode */
317
318/* WPA2 : PMKSA cache management */
319#define SIOCSIWPMKSA 0x8B36 /* PMKSA cache operation */
320
321/* -------------------- DEV PRIVATE IOCTL LIST -------------------- */
322
323/* These 32 ioctl are wireless device private, for 16 commands.
324 * Each driver is free to use them for whatever purpose it chooses,
325 * however the driver *must* export the description of those ioctls
326 * with SIOCGIWPRIV and *must* use arguments as defined below.
327 * If you don't follow those rules, DaveM is going to hate you (reason :
328 * it make mixed 32/64bit operation impossible).
329 */
330#define SIOCIWFIRSTPRIV 0x8BE0
331#define SIOCIWLASTPRIV 0x8BFF
332/* Previously, we were using SIOCDEVPRIVATE, but we now have our
333 * separate range because of collisions with other tools such as
334 * 'mii-tool'.
335 * We now have 32 commands, so a bit more space ;-).
336 * Also, all 'even' commands are only usable by root and don't return the
337 * content of ifr/iwr to user (but you are not obliged to use the set/get
338 * convention, just use every other two command). More details in iwpriv.c.
339 * And I repeat : you are not forced to use them with iwpriv, but you
340 * must be compliant with it.
341 */
342
343/* ------------------------- IOCTL STUFF ------------------------- */
344
345/* The first and the last (range) */
346#define SIOCIWFIRST 0x8B00
347#define SIOCIWLAST SIOCIWLASTPRIV /* 0x8BFF */
348#define IW_IOCTL_IDX(cmd) ((cmd) - SIOCIWFIRST)
349#define IW_HANDLER(id, func) \
350 [IW_IOCTL_IDX(id)] = func
351
352/* Odd : get (world access), even : set (root access) */
353#define IW_IS_SET(cmd) (!((cmd) & 0x1))
354#define IW_IS_GET(cmd) ((cmd) & 0x1)
355
356/* ----------------------- WIRELESS EVENTS ----------------------- */
357/* Those are *NOT* ioctls, do not issue request on them !!! */
358/* Most events use the same identifier as ioctl requests */
359
360#define IWEVTXDROP 0x8C00 /* Packet dropped to excessive retry */
361#define IWEVQUAL 0x8C01 /* Quality part of statistics (scan) */
362#define IWEVCUSTOM 0x8C02 /* Driver specific ascii string */
363#define IWEVREGISTERED 0x8C03 /* Discovered a new node (AP mode) */
364#define IWEVEXPIRED 0x8C04 /* Expired a node (AP mode) */
365#define IWEVGENIE 0x8C05 /* Generic IE (WPA, RSN, WMM, ..)
366 * (scan results); This includes id and
367 * length fields. One IWEVGENIE may
368 * contain more than one IE. Scan
369 * results may contain one or more
370 * IWEVGENIE events. */
371#define IWEVMICHAELMICFAILURE 0x8C06 /* Michael MIC failure
372 * (struct iw_michaelmicfailure)
373 */
374#define IWEVASSOCREQIE 0x8C07 /* IEs used in (Re)Association Request.
375 * The data includes id and length
376 * fields and may contain more than one
377 * IE. This event is required in
378 * Managed mode if the driver
379 * generates its own WPA/RSN IE. This
380 * should be sent just before
381 * IWEVREGISTERED event for the
382 * association. */
383#define IWEVASSOCRESPIE 0x8C08 /* IEs used in (Re)Association
384 * Response. The data includes id and
385 * length fields and may contain more
386 * than one IE. This may be sent
387 * between IWEVASSOCREQIE and
388 * IWEVREGISTERED events for the
389 * association. */
390#define IWEVPMKIDCAND 0x8C09 /* PMKID candidate for RSN
391 * pre-authentication
392 * (struct iw_pmkid_cand) */
393
394#define IWEVFIRST 0x8C00
395#define IW_EVENT_IDX(cmd) ((cmd) - IWEVFIRST)
396
397/* ------------------------- PRIVATE INFO ------------------------- */
398/*
399 * The following is used with SIOCGIWPRIV. It allow a driver to define
400 * the interface (name, type of data) for its private ioctl.
401 * Privates ioctl are SIOCIWFIRSTPRIV -> SIOCIWLASTPRIV
402 */
403
404#define IW_PRIV_TYPE_MASK 0x7000 /* Type of arguments */
405#define IW_PRIV_TYPE_NONE 0x0000
406#define IW_PRIV_TYPE_BYTE 0x1000 /* Char as number */
407#define IW_PRIV_TYPE_CHAR 0x2000 /* Char as character */
408#define IW_PRIV_TYPE_INT 0x4000 /* 32 bits int */
409#define IW_PRIV_TYPE_FLOAT 0x5000 /* struct iw_freq */
410#define IW_PRIV_TYPE_ADDR 0x6000 /* struct sockaddr */
411
412#define IW_PRIV_SIZE_FIXED 0x0800 /* Variable or fixed number of args */
413
414#define IW_PRIV_SIZE_MASK 0x07FF /* Max number of those args */
415
416/*
417 * Note : if the number of args is fixed and the size < 16 octets,
418 * instead of passing a pointer we will put args in the iwreq struct...
419 */
420
421/* ----------------------- OTHER CONSTANTS ----------------------- */
422
423/* Maximum frequencies in the range struct */
424#define IW_MAX_FREQUENCIES 32
425/* Note : if you have something like 80 frequencies,
426 * don't increase this constant and don't fill the frequency list.
427 * The user will be able to set by channel anyway... */
428
429/* Maximum bit rates in the range struct */
430#define IW_MAX_BITRATES 32
431
432/* Maximum tx powers in the range struct */
433#define IW_MAX_TXPOWER 8
434/* Note : if you more than 8 TXPowers, just set the max and min or
435 * a few of them in the struct iw_range. */
436
437/* Maximum of address that you may set with SPY */
438#define IW_MAX_SPY 8
439
440/* Maximum of address that you may get in the
441 list of access points in range */
442#define IW_MAX_AP 64
443
444/* Maximum size of the ESSID and NICKN strings */
445#define IW_ESSID_MAX_SIZE 32
446
447/* Modes of operation */
448#define IW_MODE_AUTO 0 /* Let the driver decides */
449#define IW_MODE_ADHOC 1 /* Single cell network */
450#define IW_MODE_INFRA 2 /* Multi cell network, roaming, ... */
451#define IW_MODE_MASTER 3 /* Synchronisation master or Access Point */
452#define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */
453#define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */
454#define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */
455#define IW_MODE_MESH 7 /* Mesh (IEEE 802.11s) network */
456
457/* Statistics flags (bitmask in updated) */
458#define IW_QUAL_QUAL_UPDATED 0x01 /* Value was updated since last read */
459#define IW_QUAL_LEVEL_UPDATED 0x02
460#define IW_QUAL_NOISE_UPDATED 0x04
461#define IW_QUAL_ALL_UPDATED 0x07
462#define IW_QUAL_DBM 0x08 /* Level + Noise are dBm */
463#define IW_QUAL_QUAL_INVALID 0x10 /* Driver doesn't provide value */
464#define IW_QUAL_LEVEL_INVALID 0x20
465#define IW_QUAL_NOISE_INVALID 0x40
466#define IW_QUAL_RCPI 0x80 /* Level + Noise are 802.11k RCPI */
467#define IW_QUAL_ALL_INVALID 0x70
468
469/* Frequency flags */
470#define IW_FREQ_AUTO 0x00 /* Let the driver decides */
471#define IW_FREQ_FIXED 0x01 /* Force a specific value */
472
473/* Maximum number of size of encoding token available
474 * they are listed in the range structure */
475#define IW_MAX_ENCODING_SIZES 8
476
477/* Maximum size of the encoding token in bytes */
478#define IW_ENCODING_TOKEN_MAX 64 /* 512 bits (for now) */
479
480/* Flags for encoding (along with the token) */
481#define IW_ENCODE_INDEX 0x00FF /* Token index (if needed) */
482#define IW_ENCODE_FLAGS 0xFF00 /* Flags defined below */
483#define IW_ENCODE_MODE 0xF000 /* Modes defined below */
484#define IW_ENCODE_DISABLED 0x8000 /* Encoding disabled */
485#define IW_ENCODE_ENABLED 0x0000 /* Encoding enabled */
486#define IW_ENCODE_RESTRICTED 0x4000 /* Refuse non-encoded packets */
487#define IW_ENCODE_OPEN 0x2000 /* Accept non-encoded packets */
488#define IW_ENCODE_NOKEY 0x0800 /* Key is write only, so not present */
489#define IW_ENCODE_TEMP 0x0400 /* Temporary key */
490
491/* Power management flags available (along with the value, if any) */
492#define IW_POWER_ON 0x0000 /* No details... */
493#define IW_POWER_TYPE 0xF000 /* Type of parameter */
494#define IW_POWER_PERIOD 0x1000 /* Value is a period/duration of */
495#define IW_POWER_TIMEOUT 0x2000 /* Value is a timeout (to go asleep) */
496#define IW_POWER_MODE 0x0F00 /* Power Management mode */
497#define IW_POWER_UNICAST_R 0x0100 /* Receive only unicast messages */
498#define IW_POWER_MULTICAST_R 0x0200 /* Receive only multicast messages */
499#define IW_POWER_ALL_R 0x0300 /* Receive all messages though PM */
500#define IW_POWER_FORCE_S 0x0400 /* Force PM procedure for sending unicast */
501#define IW_POWER_REPEATER 0x0800 /* Repeat broadcast messages in PM period */
502#define IW_POWER_MODIFIER 0x000F /* Modify a parameter */
503#define IW_POWER_MIN 0x0001 /* Value is a minimum */
504#define IW_POWER_MAX 0x0002 /* Value is a maximum */
505#define IW_POWER_RELATIVE 0x0004 /* Value is not in seconds/ms/us */
506
507/* Transmit Power flags available */
508#define IW_TXPOW_TYPE 0x00FF /* Type of value */
509#define IW_TXPOW_DBM 0x0000 /* Value is in dBm */
510#define IW_TXPOW_MWATT 0x0001 /* Value is in mW */
511#define IW_TXPOW_RELATIVE 0x0002 /* Value is in arbitrary units */
512#define IW_TXPOW_RANGE 0x1000 /* Range of value between min/max */
513
514/* Retry limits and lifetime flags available */
515#define IW_RETRY_ON 0x0000 /* No details... */
516#define IW_RETRY_TYPE 0xF000 /* Type of parameter */
517#define IW_RETRY_LIMIT 0x1000 /* Maximum number of retries*/
518#define IW_RETRY_LIFETIME 0x2000 /* Maximum duration of retries in us */
519#define IW_RETRY_MODIFIER 0x00FF /* Modify a parameter */
520#define IW_RETRY_MIN 0x0001 /* Value is a minimum */
521#define IW_RETRY_MAX 0x0002 /* Value is a maximum */
522#define IW_RETRY_RELATIVE 0x0004 /* Value is not in seconds/ms/us */
523#define IW_RETRY_SHORT 0x0010 /* Value is for short packets */
524#define IW_RETRY_LONG 0x0020 /* Value is for long packets */
525
526/* Scanning request flags */
527#define IW_SCAN_DEFAULT 0x0000 /* Default scan of the driver */
528#define IW_SCAN_ALL_ESSID 0x0001 /* Scan all ESSIDs */
529#define IW_SCAN_THIS_ESSID 0x0002 /* Scan only this ESSID */
530#define IW_SCAN_ALL_FREQ 0x0004 /* Scan all Frequencies */
531#define IW_SCAN_THIS_FREQ 0x0008 /* Scan only this Frequency */
532#define IW_SCAN_ALL_MODE 0x0010 /* Scan all Modes */
533#define IW_SCAN_THIS_MODE 0x0020 /* Scan only this Mode */
534#define IW_SCAN_ALL_RATE 0x0040 /* Scan all Bit-Rates */
535#define IW_SCAN_THIS_RATE 0x0080 /* Scan only this Bit-Rate */
536/* struct iw_scan_req scan_type */
537#define IW_SCAN_TYPE_ACTIVE 0
538#define IW_SCAN_TYPE_PASSIVE 1
539/* Maximum size of returned data */
540#define IW_SCAN_MAX_DATA 4096 /* In bytes */
541
542/* Scan capability flags - in (struct iw_range *)->scan_capa */
543#define IW_SCAN_CAPA_NONE 0x00
544#define IW_SCAN_CAPA_ESSID 0x01
545#define IW_SCAN_CAPA_BSSID 0x02
546#define IW_SCAN_CAPA_CHANNEL 0x04
547#define IW_SCAN_CAPA_MODE 0x08
548#define IW_SCAN_CAPA_RATE 0x10
549#define IW_SCAN_CAPA_TYPE 0x20
550#define IW_SCAN_CAPA_TIME 0x40
551
552/* Max number of char in custom event - use multiple of them if needed */
553#define IW_CUSTOM_MAX 256 /* In bytes */
554
555/* Generic information element */
556#define IW_GENERIC_IE_MAX 1024
557
558/* MLME requests (SIOCSIWMLME / struct iw_mlme) */
559#define IW_MLME_DEAUTH 0
560#define IW_MLME_DISASSOC 1
561#define IW_MLME_AUTH 2
562#define IW_MLME_ASSOC 3
563
564/* SIOCSIWAUTH/SIOCGIWAUTH struct iw_param flags */
565#define IW_AUTH_INDEX 0x0FFF
566#define IW_AUTH_FLAGS 0xF000
567/* SIOCSIWAUTH/SIOCGIWAUTH parameters (0 .. 4095)
568 * (IW_AUTH_INDEX mask in struct iw_param flags; this is the index of the
569 * parameter that is being set/get to; value will be read/written to
570 * struct iw_param value field) */
571#define IW_AUTH_WPA_VERSION 0
572#define IW_AUTH_CIPHER_PAIRWISE 1
573#define IW_AUTH_CIPHER_GROUP 2
574#define IW_AUTH_KEY_MGMT 3
575#define IW_AUTH_TKIP_COUNTERMEASURES 4
576#define IW_AUTH_DROP_UNENCRYPTED 5
577#define IW_AUTH_80211_AUTH_ALG 6
578#define IW_AUTH_WPA_ENABLED 7
579#define IW_AUTH_RX_UNENCRYPTED_EAPOL 8
580#define IW_AUTH_ROAMING_CONTROL 9
581#define IW_AUTH_PRIVACY_INVOKED 10
582#define IW_AUTH_CIPHER_GROUP_MGMT 11
583#define IW_AUTH_MFP 12
584
585/* IW_AUTH_WPA_VERSION values (bit field) */
586#define IW_AUTH_WPA_VERSION_DISABLED 0x00000001
587#define IW_AUTH_WPA_VERSION_WPA 0x00000002
588#define IW_AUTH_WPA_VERSION_WPA2 0x00000004
589
590/* IW_AUTH_PAIRWISE_CIPHER, IW_AUTH_GROUP_CIPHER, and IW_AUTH_CIPHER_GROUP_MGMT
591 * values (bit field) */
592#define IW_AUTH_CIPHER_NONE 0x00000001
593#define IW_AUTH_CIPHER_WEP40 0x00000002
594#define IW_AUTH_CIPHER_TKIP 0x00000004
595#define IW_AUTH_CIPHER_CCMP 0x00000008
596#define IW_AUTH_CIPHER_WEP104 0x00000010
597#define IW_AUTH_CIPHER_AES_CMAC 0x00000020
598
599/* IW_AUTH_KEY_MGMT values (bit field) */
600#define IW_AUTH_KEY_MGMT_802_1X 1
601#define IW_AUTH_KEY_MGMT_PSK 2
602
603/* IW_AUTH_80211_AUTH_ALG values (bit field) */
604#define IW_AUTH_ALG_OPEN_SYSTEM 0x00000001
605#define IW_AUTH_ALG_SHARED_KEY 0x00000002
606#define IW_AUTH_ALG_LEAP 0x00000004
607
608/* IW_AUTH_ROAMING_CONTROL values */
609#define IW_AUTH_ROAMING_ENABLE 0 /* driver/firmware based roaming */
610#define IW_AUTH_ROAMING_DISABLE 1 /* user space program used for roaming
611 * control */
612
613/* IW_AUTH_MFP (management frame protection) values */
614#define IW_AUTH_MFP_DISABLED 0 /* MFP disabled */
615#define IW_AUTH_MFP_OPTIONAL 1 /* MFP optional */
616#define IW_AUTH_MFP_REQUIRED 2 /* MFP required */
617
618/* SIOCSIWENCODEEXT definitions */
619#define IW_ENCODE_SEQ_MAX_SIZE 8
620/* struct iw_encode_ext ->alg */
621#define IW_ENCODE_ALG_NONE 0
622#define IW_ENCODE_ALG_WEP 1
623#define IW_ENCODE_ALG_TKIP 2
624#define IW_ENCODE_ALG_CCMP 3
625#define IW_ENCODE_ALG_PMK 4
626#define IW_ENCODE_ALG_AES_CMAC 5
627/* struct iw_encode_ext ->ext_flags */
628#define IW_ENCODE_EXT_TX_SEQ_VALID 0x00000001
629#define IW_ENCODE_EXT_RX_SEQ_VALID 0x00000002
630#define IW_ENCODE_EXT_GROUP_KEY 0x00000004
631#define IW_ENCODE_EXT_SET_TX_KEY 0x00000008
632
633/* IWEVMICHAELMICFAILURE : struct iw_michaelmicfailure ->flags */
634#define IW_MICFAILURE_KEY_ID 0x00000003 /* Key ID 0..3 */
635#define IW_MICFAILURE_GROUP 0x00000004
636#define IW_MICFAILURE_PAIRWISE 0x00000008
637#define IW_MICFAILURE_STAKEY 0x00000010
638#define IW_MICFAILURE_COUNT 0x00000060 /* 1 or 2 (0 = count not supported)
639 */
640
641/* Bit field values for enc_capa in struct iw_range */
642#define IW_ENC_CAPA_WPA 0x00000001
643#define IW_ENC_CAPA_WPA2 0x00000002
644#define IW_ENC_CAPA_CIPHER_TKIP 0x00000004
645#define IW_ENC_CAPA_CIPHER_CCMP 0x00000008
646#define IW_ENC_CAPA_4WAY_HANDSHAKE 0x00000010
647
648/* Event capability macros - in (struct iw_range *)->event_capa
649 * Because we have more than 32 possible events, we use an array of
650 * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */
651#define IW_EVENT_CAPA_BASE(cmd) ((cmd >= SIOCIWFIRSTPRIV) ? \
652 (cmd - SIOCIWFIRSTPRIV + 0x60) : \
653 (cmd - SIOCIWFIRST))
654#define IW_EVENT_CAPA_INDEX(cmd) (IW_EVENT_CAPA_BASE(cmd) >> 5)
655#define IW_EVENT_CAPA_MASK(cmd) (1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F))
656/* Event capability constants - event autogenerated by the kernel
657 * This list is valid for most 802.11 devices, customise as needed... */
658#define IW_EVENT_CAPA_K_0 (IW_EVENT_CAPA_MASK(0x8B04) | \
659 IW_EVENT_CAPA_MASK(0x8B06) | \
660 IW_EVENT_CAPA_MASK(0x8B1A))
661#define IW_EVENT_CAPA_K_1 (IW_EVENT_CAPA_MASK(0x8B2A))
662/* "Easy" macro to set events in iw_range (less efficient) */
663#define IW_EVENT_CAPA_SET(event_capa, cmd) (event_capa[IW_EVENT_CAPA_INDEX(cmd)] |= IW_EVENT_CAPA_MASK(cmd))
664#define IW_EVENT_CAPA_SET_KERNEL(event_capa) {event_capa[0] |= IW_EVENT_CAPA_K_0; event_capa[1] |= IW_EVENT_CAPA_K_1; }
665
666
667/****************************** TYPES ******************************/
668
669/* --------------------------- SUBTYPES --------------------------- */
670/*
671 * Generic format for most parameters that fit in an int
672 */
673struct iw_param
674{
675 __s32 value; /* The value of the parameter itself */
676 __u8 fixed; /* Hardware should not use auto select */
677 __u8 disabled; /* Disable the feature */
678 __u16 flags; /* Various specifc flags (if any) */
679};
680
681/*
682 * For all data larger than 16 octets, we need to use a
683 * pointer to memory allocated in user space.
684 */
685struct iw_point
686{
687 void __user *pointer; /* Pointer to the data (in user space) */
688 __u16 length; /* number of fields or size in bytes */
689 __u16 flags; /* Optional params */
690};
691
692
693/*
694 * A frequency
695 * For numbers lower than 10^9, we encode the number in 'm' and
696 * set 'e' to 0
697 * For number greater than 10^9, we divide it by the lowest power
698 * of 10 to get 'm' lower than 10^9, with 'm'= f / (10^'e')...
699 * The power of 10 is in 'e', the result of the division is in 'm'.
700 */
701struct iw_freq
702{
703 __s32 m; /* Mantissa */
704 __s16 e; /* Exponent */
705 __u8 i; /* List index (when in range struct) */
706 __u8 flags; /* Flags (fixed/auto) */
707};
708
709/*
710 * Quality of the link
711 */
712struct iw_quality
713{
714 __u8 qual; /* link quality (%retries, SNR,
715 %missed beacons or better...) */
716 __u8 level; /* signal level (dBm) */
717 __u8 noise; /* noise level (dBm) */
718 __u8 updated; /* Flags to know if updated */
719};
720
721/*
722 * Packet discarded in the wireless adapter due to
723 * "wireless" specific problems...
724 * Note : the list of counter and statistics in net_device_stats
725 * is already pretty exhaustive, and you should use that first.
726 * This is only additional stats...
727 */
728struct iw_discarded
729{
730 __u32 nwid; /* Rx : Wrong nwid/essid */
731 __u32 code; /* Rx : Unable to code/decode (WEP) */
732 __u32 fragment; /* Rx : Can't perform MAC reassembly */
733 __u32 retries; /* Tx : Max MAC retries num reached */
734 __u32 misc; /* Others cases */
735};
736
737/*
738 * Packet/Time period missed in the wireless adapter due to
739 * "wireless" specific problems...
740 */
741struct iw_missed
742{
743 __u32 beacon; /* Missed beacons/superframe */
744};
745
746/*
747 * Quality range (for spy threshold)
748 */
749struct iw_thrspy
750{
751 struct sockaddr addr; /* Source address (hw/mac) */
752 struct iw_quality qual; /* Quality of the link */
753 struct iw_quality low; /* Low threshold */
754 struct iw_quality high; /* High threshold */
755};
756
757/*
758 * Optional data for scan request
759 *
760 * Note: these optional parameters are controlling parameters for the
761 * scanning behavior, these do not apply to getting scan results
762 * (SIOCGIWSCAN). Drivers are expected to keep a local BSS table and
763 * provide a merged results with all BSSes even if the previous scan
764 * request limited scanning to a subset, e.g., by specifying an SSID.
765 * Especially, scan results are required to include an entry for the
766 * current BSS if the driver is in Managed mode and associated with an AP.
767 */
768struct iw_scan_req
769{
770 __u8 scan_type; /* IW_SCAN_TYPE_{ACTIVE,PASSIVE} */
771 __u8 essid_len;
772 __u8 num_channels; /* num entries in channel_list;
773 * 0 = scan all allowed channels */
774 __u8 flags; /* reserved as padding; use zero, this may
775 * be used in the future for adding flags
776 * to request different scan behavior */
777 struct sockaddr bssid; /* ff:ff:ff:ff:ff:ff for broadcast BSSID or
778 * individual address of a specific BSS */
779
780 /*
781 * Use this ESSID if IW_SCAN_THIS_ESSID flag is used instead of using
782 * the current ESSID. This allows scan requests for specific ESSID
783 * without having to change the current ESSID and potentially breaking
784 * the current association.
785 */
786 __u8 essid[IW_ESSID_MAX_SIZE];
787
788 /*
789 * Optional parameters for changing the default scanning behavior.
790 * These are based on the MLME-SCAN.request from IEEE Std 802.11.
791 * TU is 1.024 ms. If these are set to 0, driver is expected to use
792 * reasonable default values. min_channel_time defines the time that
793 * will be used to wait for the first reply on each channel. If no
794 * replies are received, next channel will be scanned after this. If
795 * replies are received, total time waited on the channel is defined by
796 * max_channel_time.
797 */
798 __u32 min_channel_time; /* in TU */
799 __u32 max_channel_time; /* in TU */
800
801 struct iw_freq channel_list[IW_MAX_FREQUENCIES];
802};
803
804/* ------------------------- WPA SUPPORT ------------------------- */
805
806/*
807 * Extended data structure for get/set encoding (this is used with
808 * SIOCSIWENCODEEXT/SIOCGIWENCODEEXT. struct iw_point and IW_ENCODE_*
809 * flags are used in the same way as with SIOCSIWENCODE/SIOCGIWENCODE and
810 * only the data contents changes (key data -> this structure, including
811 * key data).
812 *
813 * If the new key is the first group key, it will be set as the default
814 * TX key. Otherwise, default TX key index is only changed if
815 * IW_ENCODE_EXT_SET_TX_KEY flag is set.
816 *
817 * Key will be changed with SIOCSIWENCODEEXT in all cases except for
818 * special "change TX key index" operation which is indicated by setting
819 * key_len = 0 and ext_flags |= IW_ENCODE_EXT_SET_TX_KEY.
820 *
821 * tx_seq/rx_seq are only used when respective
822 * IW_ENCODE_EXT_{TX,RX}_SEQ_VALID flag is set in ext_flags. Normal
823 * TKIP/CCMP operation is to set RX seq with SIOCSIWENCODEEXT and start
824 * TX seq from zero whenever key is changed. SIOCGIWENCODEEXT is normally
825 * used only by an Authenticator (AP or an IBSS station) to get the
826 * current TX sequence number. Using TX_SEQ_VALID for SIOCSIWENCODEEXT and
827 * RX_SEQ_VALID for SIOCGIWENCODEEXT are optional, but can be useful for
828 * debugging/testing.
829 */
830struct iw_encode_ext
831{
832 __u32 ext_flags; /* IW_ENCODE_EXT_* */
833 __u8 tx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
834 __u8 rx_seq[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
835 struct sockaddr addr; /* ff:ff:ff:ff:ff:ff for broadcast/multicast
836 * (group) keys or unicast address for
837 * individual keys */
838 __u16 alg; /* IW_ENCODE_ALG_* */
839 __u16 key_len;
840 __u8 key[0];
841};
842
843/* SIOCSIWMLME data */
844struct iw_mlme
845{
846 __u16 cmd; /* IW_MLME_* */
847 __u16 reason_code;
848 struct sockaddr addr;
849};
850
851/* SIOCSIWPMKSA data */
852#define IW_PMKSA_ADD 1
853#define IW_PMKSA_REMOVE 2
854#define IW_PMKSA_FLUSH 3
855
856#define IW_PMKID_LEN 16
857
858struct iw_pmksa
859{
860 __u32 cmd; /* IW_PMKSA_* */
861 struct sockaddr bssid;
862 __u8 pmkid[IW_PMKID_LEN];
863};
864
865/* IWEVMICHAELMICFAILURE data */
866struct iw_michaelmicfailure
867{
868 __u32 flags;
869 struct sockaddr src_addr;
870 __u8 tsc[IW_ENCODE_SEQ_MAX_SIZE]; /* LSB first */
871};
872
873/* IWEVPMKIDCAND data */
874#define IW_PMKID_CAND_PREAUTH 0x00000001 /* RNS pre-authentication enabled */
875struct iw_pmkid_cand
876{
877 __u32 flags; /* IW_PMKID_CAND_* */
878 __u32 index; /* the smaller the index, the higher the
879 * priority */
880 struct sockaddr bssid;
881};
882
883/* ------------------------ WIRELESS STATS ------------------------ */
884/*
885 * Wireless statistics (used for /proc/net/wireless)
886 */
887struct iw_statistics
888{
889 __u16 status; /* Status
890 * - device dependent for now */
891
892 struct iw_quality qual; /* Quality of the link
893 * (instant/mean/max) */
894 struct iw_discarded discard; /* Packet discarded counts */
895 struct iw_missed miss; /* Packet missed counts */
896};
897
898/* ------------------------ IOCTL REQUEST ------------------------ */
899/*
900 * This structure defines the payload of an ioctl, and is used
901 * below.
902 *
903 * Note that this structure should fit on the memory footprint
904 * of iwreq (which is the same as ifreq), which mean a max size of
905 * 16 octets = 128 bits. Warning, pointers might be 64 bits wide...
906 * You should check this when increasing the structures defined
907 * above in this file...
908 */
909union iwreq_data
910{
911 /* Config - generic */
912 char name[IFNAMSIZ];
913 /* Name : used to verify the presence of wireless extensions.
914 * Name of the protocol/provider... */
915
916 struct iw_point essid; /* Extended network name */
917 struct iw_param nwid; /* network id (or domain - the cell) */
918 struct iw_freq freq; /* frequency or channel :
919 * 0-1000 = channel
920 * > 1000 = frequency in Hz */
921
922 struct iw_param sens; /* signal level threshold */
923 struct iw_param bitrate; /* default bit rate */
924 struct iw_param txpower; /* default transmit power */
925 struct iw_param rts; /* RTS threshold threshold */
926 struct iw_param frag; /* Fragmentation threshold */
927 __u32 mode; /* Operation mode */
928 struct iw_param retry; /* Retry limits & lifetime */
929
930 struct iw_point encoding; /* Encoding stuff : tokens */
931 struct iw_param power; /* PM duration/timeout */
932 struct iw_quality qual; /* Quality part of statistics */
933
934 struct sockaddr ap_addr; /* Access point address */
935 struct sockaddr addr; /* Destination address (hw/mac) */
936
937 struct iw_param param; /* Other small parameters */
938 struct iw_point data; /* Other large parameters */
939};
940
941/*
942 * The structure to exchange data for ioctl.
943 * This structure is the same as 'struct ifreq', but (re)defined for
944 * convenience...
945 * Do I need to remind you about structure size (32 octets) ?
946 */
947struct iwreq
948{
949 union
950 {
951 char ifrn_name[IFNAMSIZ]; /* if name, e.g. "eth0" */
952 } ifr_ifrn;
953
954 /* Data part (defined just above) */
955 union iwreq_data u;
956};
957
958/* -------------------------- IOCTL DATA -------------------------- */
959/*
960 * For those ioctl which want to exchange mode data that what could
961 * fit in the above structure...
962 */
963
964/*
965 * Range of parameters
966 */
967
968struct iw_range
969{
970 /* Informative stuff (to choose between different interface) */
971 __u32 throughput; /* To give an idea... */
972 /* In theory this value should be the maximum benchmarked
973 * TCP/IP throughput, because with most of these devices the
974 * bit rate is meaningless (overhead an co) to estimate how
975 * fast the connection will go and pick the fastest one.
976 * I suggest people to play with Netperf or any benchmark...
977 */
978
979 /* NWID (or domain id) */
980 __u32 min_nwid; /* Minimal NWID we are able to set */
981 __u32 max_nwid; /* Maximal NWID we are able to set */
982
983 /* Old Frequency (backward compat - moved lower ) */
984 __u16 old_num_channels;
985 __u8 old_num_frequency;
986
987 /* Scan capabilities */
988 __u8 scan_capa; /* IW_SCAN_CAPA_* bit field */
989
990 /* Wireless event capability bitmasks */
991 __u32 event_capa[6];
992
993 /* signal level threshold range */
994 __s32 sensitivity;
995
996 /* Quality of link & SNR stuff */
997 /* Quality range (link, level, noise)
998 * If the quality is absolute, it will be in the range [0 ; max_qual],
999 * if the quality is dBm, it will be in the range [max_qual ; 0].
1000 * Don't forget that we use 8 bit arithmetics... */
1001 struct iw_quality max_qual; /* Quality of the link */
1002 /* This should contain the average/typical values of the quality
1003 * indicator. This should be the threshold between a "good" and
1004 * a "bad" link (example : monitor going from green to orange).
1005 * Currently, user space apps like quality monitors don't have any
1006 * way to calibrate the measurement. With this, they can split
1007 * the range between 0 and max_qual in different quality level
1008 * (using a geometric subdivision centered on the average).
1009 * I expect that people doing the user space apps will feedback
1010 * us on which value we need to put in each driver... */
1011 struct iw_quality avg_qual; /* Quality of the link */
1012
1013 /* Rates */
1014 __u8 num_bitrates; /* Number of entries in the list */
1015 __s32 bitrate[IW_MAX_BITRATES]; /* list, in bps */
1016
1017 /* RTS threshold */
1018 __s32 min_rts; /* Minimal RTS threshold */
1019 __s32 max_rts; /* Maximal RTS threshold */
1020
1021 /* Frag threshold */
1022 __s32 min_frag; /* Minimal frag threshold */
1023 __s32 max_frag; /* Maximal frag threshold */
1024
1025 /* Power Management duration & timeout */
1026 __s32 min_pmp; /* Minimal PM period */
1027 __s32 max_pmp; /* Maximal PM period */
1028 __s32 min_pmt; /* Minimal PM timeout */
1029 __s32 max_pmt; /* Maximal PM timeout */
1030 __u16 pmp_flags; /* How to decode max/min PM period */
1031 __u16 pmt_flags; /* How to decode max/min PM timeout */
1032 __u16 pm_capa; /* What PM options are supported */
1033
1034 /* Encoder stuff */
1035 __u16 encoding_size[IW_MAX_ENCODING_SIZES]; /* Different token sizes */
1036 __u8 num_encoding_sizes; /* Number of entry in the list */
1037 __u8 max_encoding_tokens; /* Max number of tokens */
1038 /* For drivers that need a "login/passwd" form */
1039 __u8 encoding_login_index; /* token index for login token */
1040
1041 /* Transmit power */
1042 __u16 txpower_capa; /* What options are supported */
1043 __u8 num_txpower; /* Number of entries in the list */
1044 __s32 txpower[IW_MAX_TXPOWER]; /* list, in bps */
1045
1046 /* Wireless Extension version info */
1047 __u8 we_version_compiled; /* Must be WIRELESS_EXT */
1048 __u8 we_version_source; /* Last update of source */
1049
1050 /* Retry limits and lifetime */
1051 __u16 retry_capa; /* What retry options are supported */
1052 __u16 retry_flags; /* How to decode max/min retry limit */
1053 __u16 r_time_flags; /* How to decode max/min retry life */
1054 __s32 min_retry; /* Minimal number of retries */
1055 __s32 max_retry; /* Maximal number of retries */
1056 __s32 min_r_time; /* Minimal retry lifetime */
1057 __s32 max_r_time; /* Maximal retry lifetime */
1058
1059 /* Frequency */
1060 __u16 num_channels; /* Number of channels [0; num - 1] */
1061 __u8 num_frequency; /* Number of entry in the list */
1062 struct iw_freq freq[IW_MAX_FREQUENCIES]; /* list */
1063 /* Note : this frequency list doesn't need to fit channel numbers,
1064 * because each entry contain its channel index */
1065
1066 __u32 enc_capa; /* IW_ENC_CAPA_* bit field */
1067};
1068
1069/*
1070 * Private ioctl interface information
1071 */
1072
1073struct iw_priv_args
1074{
1075 __u32 cmd; /* Number of the ioctl to issue */
1076 __u16 set_args; /* Type and number of args */
1077 __u16 get_args; /* Type and number of args */
1078 char name[IFNAMSIZ]; /* Name of the extension */
1079};
1080
1081/* ----------------------- WIRELESS EVENTS ----------------------- */
1082/*
1083 * Wireless events are carried through the rtnetlink socket to user
1084 * space. They are encapsulated in the IFLA_WIRELESS field of
1085 * a RTM_NEWLINK message.
1086 */
1087
1088/*
1089 * A Wireless Event. Contains basically the same data as the ioctl...
1090 */
1091struct iw_event
1092{
1093 __u16 len; /* Real length of this stuff */
1094 __u16 cmd; /* Wireless IOCTL */
1095 union iwreq_data u; /* IOCTL fixed payload */
1096};
1097
1098/* Size of the Event prefix (including padding and alignement junk) */
1099#define IW_EV_LCP_LEN (sizeof(struct iw_event) - sizeof(union iwreq_data))
1100/* Size of the various events */
1101#define IW_EV_CHAR_LEN (IW_EV_LCP_LEN + IFNAMSIZ)
1102#define IW_EV_UINT_LEN (IW_EV_LCP_LEN + sizeof(__u32))
1103#define IW_EV_FREQ_LEN (IW_EV_LCP_LEN + sizeof(struct iw_freq))
1104#define IW_EV_PARAM_LEN (IW_EV_LCP_LEN + sizeof(struct iw_param))
1105#define IW_EV_ADDR_LEN (IW_EV_LCP_LEN + sizeof(struct sockaddr))
1106#define IW_EV_QUAL_LEN (IW_EV_LCP_LEN + sizeof(struct iw_quality))
1107
1108/* iw_point events are special. First, the payload (extra data) come at
1109 * the end of the event, so they are bigger than IW_EV_POINT_LEN. Second,
1110 * we omit the pointer, so start at an offset. */
1111#define IW_EV_POINT_OFF (((char *) &(((struct iw_point *) NULL)->length)) - \
1112 (char *) NULL)
1113#define IW_EV_POINT_LEN (IW_EV_LCP_LEN + sizeof(struct iw_point) - \
1114 IW_EV_POINT_OFF)
1115
1116
1117/* Size of the Event prefix when packed in stream */
1118#define IW_EV_LCP_PK_LEN (4)
1119/* Size of the various events when packed in stream */
1120#define IW_EV_CHAR_PK_LEN (IW_EV_LCP_PK_LEN + IFNAMSIZ)
1121#define IW_EV_UINT_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(__u32))
1122#define IW_EV_FREQ_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_freq))
1123#define IW_EV_PARAM_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_param))
1124#define IW_EV_ADDR_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct sockaddr))
1125#define IW_EV_QUAL_PK_LEN (IW_EV_LCP_PK_LEN + sizeof(struct iw_quality))
1126#define IW_EV_POINT_PK_LEN (IW_EV_LCP_PK_LEN + 4)
1127
1128#endif /* _UAPI_LINUX_WIRELESS_H */
diff --git a/include/linux/x25.h b/include/uapi/linux/x25.h
index 810cce6737ea..810cce6737ea 100644
--- a/include/linux/x25.h
+++ b/include/uapi/linux/x25.h
diff --git a/include/uapi/linux/xattr.h b/include/uapi/linux/xattr.h
new file mode 100644
index 000000000000..26607bd965fa
--- /dev/null
+++ b/include/uapi/linux/xattr.h
@@ -0,0 +1,64 @@
1/*
2 File: linux/xattr.h
3
4 Extended attributes handling.
5
6 Copyright (C) 2001 by Andreas Gruenbacher <a.gruenbacher@computer.org>
7 Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved.
8 Copyright (c) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com>
9*/
10#ifndef _UAPI_LINUX_XATTR_H
11#define _UAPI_LINUX_XATTR_H
12
13#define XATTR_CREATE 0x1 /* set value, fail if attr already exists */
14#define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
15
16/* Namespaces */
17#define XATTR_OS2_PREFIX "os2."
18#define XATTR_OS2_PREFIX_LEN (sizeof (XATTR_OS2_PREFIX) - 1)
19
20#define XATTR_SECURITY_PREFIX "security."
21#define XATTR_SECURITY_PREFIX_LEN (sizeof (XATTR_SECURITY_PREFIX) - 1)
22
23#define XATTR_SYSTEM_PREFIX "system."
24#define XATTR_SYSTEM_PREFIX_LEN (sizeof (XATTR_SYSTEM_PREFIX) - 1)
25
26#define XATTR_TRUSTED_PREFIX "trusted."
27#define XATTR_TRUSTED_PREFIX_LEN (sizeof (XATTR_TRUSTED_PREFIX) - 1)
28
29#define XATTR_USER_PREFIX "user."
30#define XATTR_USER_PREFIX_LEN (sizeof (XATTR_USER_PREFIX) - 1)
31
32/* Security namespace */
33#define XATTR_EVM_SUFFIX "evm"
34#define XATTR_NAME_EVM XATTR_SECURITY_PREFIX XATTR_EVM_SUFFIX
35
36#define XATTR_IMA_SUFFIX "ima"
37#define XATTR_NAME_IMA XATTR_SECURITY_PREFIX XATTR_IMA_SUFFIX
38
39#define XATTR_SELINUX_SUFFIX "selinux"
40#define XATTR_NAME_SELINUX XATTR_SECURITY_PREFIX XATTR_SELINUX_SUFFIX
41
42#define XATTR_SMACK_SUFFIX "SMACK64"
43#define XATTR_SMACK_IPIN "SMACK64IPIN"
44#define XATTR_SMACK_IPOUT "SMACK64IPOUT"
45#define XATTR_SMACK_EXEC "SMACK64EXEC"
46#define XATTR_SMACK_TRANSMUTE "SMACK64TRANSMUTE"
47#define XATTR_SMACK_MMAP "SMACK64MMAP"
48#define XATTR_NAME_SMACK XATTR_SECURITY_PREFIX XATTR_SMACK_SUFFIX
49#define XATTR_NAME_SMACKIPIN XATTR_SECURITY_PREFIX XATTR_SMACK_IPIN
50#define XATTR_NAME_SMACKIPOUT XATTR_SECURITY_PREFIX XATTR_SMACK_IPOUT
51#define XATTR_NAME_SMACKEXEC XATTR_SECURITY_PREFIX XATTR_SMACK_EXEC
52#define XATTR_NAME_SMACKTRANSMUTE XATTR_SECURITY_PREFIX XATTR_SMACK_TRANSMUTE
53#define XATTR_NAME_SMACKMMAP XATTR_SECURITY_PREFIX XATTR_SMACK_MMAP
54
55#define XATTR_CAPS_SUFFIX "capability"
56#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX
57
58#define XATTR_POSIX_ACL_ACCESS "posix_acl_access"
59#define XATTR_NAME_POSIX_ACL_ACCESS XATTR_SYSTEM_PREFIX XATTR_POSIX_ACL_ACCESS
60#define XATTR_POSIX_ACL_DEFAULT "posix_acl_default"
61#define XATTR_NAME_POSIX_ACL_DEFAULT XATTR_SYSTEM_PREFIX XATTR_POSIX_ACL_DEFAULT
62
63
64#endif /* _UAPI_LINUX_XATTR_H */
diff --git a/include/linux/xfrm.h b/include/uapi/linux/xfrm.h
index 28e493b5b94c..28e493b5b94c 100644
--- a/include/linux/xfrm.h
+++ b/include/uapi/linux/xfrm.h
diff --git a/include/uapi/mtd/Kbuild b/include/uapi/mtd/Kbuild
index aafaa5aa54d4..5a691e10cd0e 100644
--- a/include/uapi/mtd/Kbuild
+++ b/include/uapi/mtd/Kbuild
@@ -1 +1,6 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += inftl-user.h
3header-y += mtd-abi.h
4header-y += mtd-user.h
5header-y += nftl-user.h
6header-y += ubi-user.h
diff --git a/include/mtd/inftl-user.h b/include/uapi/mtd/inftl-user.h
index 8376bd1a9e01..8376bd1a9e01 100644
--- a/include/mtd/inftl-user.h
+++ b/include/uapi/mtd/inftl-user.h
diff --git a/include/mtd/mtd-abi.h b/include/uapi/mtd/mtd-abi.h
index 36eace03b2ac..36eace03b2ac 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/uapi/mtd/mtd-abi.h
diff --git a/include/mtd/mtd-user.h b/include/uapi/mtd/mtd-user.h
index 83327c808c86..83327c808c86 100644
--- a/include/mtd/mtd-user.h
+++ b/include/uapi/mtd/mtd-user.h
diff --git a/include/mtd/nftl-user.h b/include/uapi/mtd/nftl-user.h
index bdeabd86ad99..bdeabd86ad99 100644
--- a/include/mtd/nftl-user.h
+++ b/include/uapi/mtd/nftl-user.h
diff --git a/include/mtd/ubi-user.h b/include/uapi/mtd/ubi-user.h
index 53cae1e11e57..53cae1e11e57 100644
--- a/include/mtd/ubi-user.h
+++ b/include/uapi/mtd/ubi-user.h
diff --git a/include/uapi/xen/Kbuild b/include/uapi/xen/Kbuild
index aafaa5aa54d4..61257cb14653 100644
--- a/include/uapi/xen/Kbuild
+++ b/include/uapi/xen/Kbuild
@@ -1 +1,3 @@
1# UAPI Header export list 1# UAPI Header export list
2header-y += evtchn.h
3header-y += privcmd.h
diff --git a/include/xen/evtchn.h b/include/uapi/xen/evtchn.h
index 14e833ee4e0b..14e833ee4e0b 100644
--- a/include/xen/evtchn.h
+++ b/include/uapi/xen/evtchn.h
diff --git a/include/xen/privcmd.h b/include/uapi/xen/privcmd.h
index a85316811d79..a85316811d79 100644
--- a/include/xen/privcmd.h
+++ b/include/uapi/xen/privcmd.h
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index a6267a2d292b..3729173b7fbc 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -48,10 +48,10 @@
48#define DISPC_IRQ_FRAMEDONEWB (1 << 23) 48#define DISPC_IRQ_FRAMEDONEWB (1 << 23)
49#define DISPC_IRQ_FRAMEDONETV (1 << 24) 49#define DISPC_IRQ_FRAMEDONETV (1 << 24)
50#define DISPC_IRQ_WBBUFFEROVERFLOW (1 << 25) 50#define DISPC_IRQ_WBBUFFEROVERFLOW (1 << 25)
51#define DISPC_IRQ_FRAMEDONE3 (1 << 26) 51#define DISPC_IRQ_SYNC_LOST3 (1 << 27)
52#define DISPC_IRQ_VSYNC3 (1 << 27) 52#define DISPC_IRQ_VSYNC3 (1 << 28)
53#define DISPC_IRQ_ACBIAS_COUNT_STAT3 (1 << 28) 53#define DISPC_IRQ_ACBIAS_COUNT_STAT3 (1 << 29)
54#define DISPC_IRQ_SYNC_LOST3 (1 << 29) 54#define DISPC_IRQ_FRAMEDONE3 (1 << 30)
55 55
56struct omap_dss_device; 56struct omap_dss_device;
57struct omap_overlay_manager; 57struct omap_overlay_manager;
@@ -73,6 +73,7 @@ enum omap_plane {
73 OMAP_DSS_VIDEO1 = 1, 73 OMAP_DSS_VIDEO1 = 1,
74 OMAP_DSS_VIDEO2 = 2, 74 OMAP_DSS_VIDEO2 = 2,
75 OMAP_DSS_VIDEO3 = 3, 75 OMAP_DSS_VIDEO3 = 3,
76 OMAP_DSS_WB = 4,
76}; 77};
77 78
78enum omap_channel { 79enum omap_channel {
@@ -186,6 +187,8 @@ enum omap_overlay_caps {
186 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA = 1 << 1, 187 OMAP_DSS_OVL_CAP_GLOBAL_ALPHA = 1 << 1,
187 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA = 1 << 2, 188 OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA = 1 << 2,
188 OMAP_DSS_OVL_CAP_ZORDER = 1 << 3, 189 OMAP_DSS_OVL_CAP_ZORDER = 1 << 3,
190 OMAP_DSS_OVL_CAP_POS = 1 << 4,
191 OMAP_DSS_OVL_CAP_REPLICATION = 1 << 5,
189}; 192};
190 193
191enum omap_overlay_manager_caps { 194enum omap_overlay_manager_caps {
@@ -207,6 +210,16 @@ enum omap_hdmi_flags {
207 OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1 << 0, 210 OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1 << 0,
208}; 211};
209 212
213enum omap_dss_output_id {
214 OMAP_DSS_OUTPUT_DPI = 1 << 0,
215 OMAP_DSS_OUTPUT_DBI = 1 << 1,
216 OMAP_DSS_OUTPUT_SDI = 1 << 2,
217 OMAP_DSS_OUTPUT_DSI1 = 1 << 3,
218 OMAP_DSS_OUTPUT_DSI2 = 1 << 4,
219 OMAP_DSS_OUTPUT_VENC = 1 << 5,
220 OMAP_DSS_OUTPUT_HDMI = 1 << 6,
221};
222
210/* RFBI */ 223/* RFBI */
211 224
212struct rfbi_timings { 225struct rfbi_timings {
@@ -243,7 +256,7 @@ void rfbi_bus_unlock(void);
243 256
244/* DSI */ 257/* DSI */
245 258
246struct omap_dss_dsi_videomode_data { 259struct omap_dss_dsi_videomode_timings {
247 /* DSI video mode blanking data */ 260 /* DSI video mode blanking data */
248 /* Unit: byte clock cycles */ 261 /* Unit: byte clock cycles */
249 u16 hsa; 262 u16 hsa;
@@ -424,6 +437,8 @@ struct omap_overlay {
424 struct omap_overlay_info *info); 437 struct omap_overlay_info *info);
425 438
426 int (*wait_for_go)(struct omap_overlay *ovl); 439 int (*wait_for_go)(struct omap_overlay *ovl);
440
441 struct omap_dss_device *(*get_device)(struct omap_overlay *ovl);
427}; 442};
428 443
429struct omap_overlay_manager_info { 444struct omap_overlay_manager_info {
@@ -448,9 +463,10 @@ struct omap_overlay_manager {
448 enum omap_overlay_manager_caps caps; 463 enum omap_overlay_manager_caps caps;
449 struct list_head overlays; 464 struct list_head overlays;
450 enum omap_display_type supported_displays; 465 enum omap_display_type supported_displays;
466 enum omap_dss_output_id supported_outputs;
451 467
452 /* dynamic fields */ 468 /* dynamic fields */
453 struct omap_dss_device *device; 469 struct omap_dss_output *output;
454 470
455 /* 471 /*
456 * The following functions do not block: 472 * The following functions do not block:
@@ -463,9 +479,9 @@ struct omap_overlay_manager {
463 * interrupt context 479 * interrupt context
464 */ 480 */
465 481
466 int (*set_device)(struct omap_overlay_manager *mgr, 482 int (*set_output)(struct omap_overlay_manager *mgr,
467 struct omap_dss_device *dssdev); 483 struct omap_dss_output *output);
468 int (*unset_device)(struct omap_overlay_manager *mgr); 484 int (*unset_output)(struct omap_overlay_manager *mgr);
469 485
470 int (*set_manager_info)(struct omap_overlay_manager *mgr, 486 int (*set_manager_info)(struct omap_overlay_manager *mgr,
471 struct omap_overlay_manager_info *info); 487 struct omap_overlay_manager_info *info);
@@ -475,6 +491,8 @@ struct omap_overlay_manager {
475 int (*apply)(struct omap_overlay_manager *mgr); 491 int (*apply)(struct omap_overlay_manager *mgr);
476 int (*wait_for_go)(struct omap_overlay_manager *mgr); 492 int (*wait_for_go)(struct omap_overlay_manager *mgr);
477 int (*wait_for_vsync)(struct omap_overlay_manager *mgr); 493 int (*wait_for_vsync)(struct omap_overlay_manager *mgr);
494
495 struct omap_dss_device *(*get_device)(struct omap_overlay_manager *mgr);
478}; 496};
479 497
480/* 22 pins means 1 clk lane and 10 data lanes */ 498/* 22 pins means 1 clk lane and 10 data lanes */
@@ -492,6 +510,37 @@ struct omap_dsi_pin_config {
492 int pins[OMAP_DSS_MAX_DSI_PINS]; 510 int pins[OMAP_DSS_MAX_DSI_PINS];
493}; 511};
494 512
513struct omap_dss_writeback_info {
514 u32 paddr;
515 u32 p_uv_addr;
516 u16 buf_width;
517 u16 width;
518 u16 height;
519 enum omap_color_mode color_mode;
520 u8 rotation;
521 enum omap_dss_rotation_type rotation_type;
522 bool mirror;
523 u8 pre_mult_alpha;
524};
525
526struct omap_dss_output {
527 struct list_head list;
528
529 /* display type supported by the output */
530 enum omap_display_type type;
531
532 /* output instance */
533 enum omap_dss_output_id id;
534
535 /* output's platform device pointer */
536 struct platform_device *pdev;
537
538 /* dynamic fields */
539 struct omap_overlay_manager *manager;
540
541 struct omap_dss_device *device;
542};
543
495struct omap_dss_device { 544struct omap_dss_device {
496 struct device dev; 545 struct device dev;
497 546
@@ -564,7 +613,7 @@ struct omap_dss_device {
564 613
565 enum omap_dss_dsi_pixel_format dsi_pix_fmt; 614 enum omap_dss_dsi_pixel_format dsi_pix_fmt;
566 enum omap_dss_dsi_mode dsi_mode; 615 enum omap_dss_dsi_mode dsi_mode;
567 struct omap_dss_dsi_videomode_data dsi_vm_data; 616 struct omap_dss_dsi_videomode_timings dsi_vm_timings;
568 } panel; 617 } panel;
569 618
570 struct { 619 struct {
@@ -590,7 +639,7 @@ struct omap_dss_device {
590 639
591 enum omap_display_caps caps; 640 enum omap_display_caps caps;
592 641
593 struct omap_overlay_manager *manager; 642 struct omap_dss_output *output;
594 643
595 enum omap_dss_display_state state; 644 enum omap_dss_display_state state;
596 645
@@ -605,6 +654,8 @@ struct omap_dss_device {
605 654
606struct omap_dss_hdmi_data 655struct omap_dss_hdmi_data
607{ 656{
657 int ct_cp_hpd_gpio;
658 int ls_oe_gpio;
608 int hpd_gpio; 659 int hpd_gpio;
609}; 660};
610 661
@@ -699,6 +750,11 @@ struct omap_overlay_manager *omap_dss_get_overlay_manager(int num);
699int omap_dss_get_num_overlays(void); 750int omap_dss_get_num_overlays(void);
700struct omap_overlay *omap_dss_get_overlay(int num); 751struct omap_overlay *omap_dss_get_overlay(int num);
701 752
753struct omap_dss_output *omap_dss_get_output(enum omap_dss_output_id id);
754int omapdss_output_set_device(struct omap_dss_output *out,
755 struct omap_dss_device *dssdev);
756int omapdss_output_unset_device(struct omap_dss_output *out);
757
702void omapdss_default_get_resolution(struct omap_dss_device *dssdev, 758void omapdss_default_get_resolution(struct omap_dss_device *dssdev,
703 u16 *xres, u16 *yres); 759 u16 *xres, u16 *yres);
704int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev); 760int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev);
@@ -719,6 +775,15 @@ int omap_dispc_wait_for_irq_interruptible_timeout(u32 irqmask,
719void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel, 775void omapdss_dsi_vc_enable_hs(struct omap_dss_device *dssdev, int channel,
720 bool enable); 776 bool enable);
721int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable); 777int omapdss_dsi_enable_te(struct omap_dss_device *dssdev, bool enable);
778void omapdss_dsi_set_timings(struct omap_dss_device *dssdev,
779 struct omap_video_timings *timings);
780void omapdss_dsi_set_size(struct omap_dss_device *dssdev, u16 w, u16 h);
781void omapdss_dsi_set_pixel_format(struct omap_dss_device *dssdev,
782 enum omap_dss_dsi_pixel_format fmt);
783void omapdss_dsi_set_operation_mode(struct omap_dss_device *dssdev,
784 enum omap_dss_dsi_mode mode);
785void omapdss_dsi_set_videomode_timings(struct omap_dss_device *dssdev,
786 struct omap_dss_dsi_videomode_timings *timings);
722 787
723int omap_dsi_update(struct omap_dss_device *dssdev, int channel, 788int omap_dsi_update(struct omap_dss_device *dssdev, int channel,
724 void (*callback)(int, void *), void *data); 789 void (*callback)(int, void *), void *data);
@@ -727,6 +792,8 @@ int omap_dsi_set_vc_id(struct omap_dss_device *dssdev, int channel, int vc_id);
727void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel); 792void omap_dsi_release_vc(struct omap_dss_device *dssdev, int channel);
728int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev, 793int omapdss_dsi_configure_pins(struct omap_dss_device *dssdev,
729 const struct omap_dsi_pin_config *pin_cfg); 794 const struct omap_dsi_pin_config *pin_cfg);
795int omapdss_dsi_set_clocks(struct omap_dss_device *dssdev,
796 unsigned long ddr_clk, unsigned long lp_clk);
730 797
731int omapdss_dsi_display_enable(struct omap_dss_device *dssdev); 798int omapdss_dsi_display_enable(struct omap_dss_device *dssdev);
732void omapdss_dsi_display_disable(struct omap_dss_device *dssdev, 799void omapdss_dsi_display_disable(struct omap_dss_device *dssdev,
@@ -734,22 +801,29 @@ void omapdss_dsi_display_disable(struct omap_dss_device *dssdev,
734 801
735int omapdss_dpi_display_enable(struct omap_dss_device *dssdev); 802int omapdss_dpi_display_enable(struct omap_dss_device *dssdev);
736void omapdss_dpi_display_disable(struct omap_dss_device *dssdev); 803void omapdss_dpi_display_disable(struct omap_dss_device *dssdev);
737void dpi_set_timings(struct omap_dss_device *dssdev, 804void omapdss_dpi_set_timings(struct omap_dss_device *dssdev,
738 struct omap_video_timings *timings); 805 struct omap_video_timings *timings);
739int dpi_check_timings(struct omap_dss_device *dssdev, 806int dpi_check_timings(struct omap_dss_device *dssdev,
740 struct omap_video_timings *timings); 807 struct omap_video_timings *timings);
808void omapdss_dpi_set_data_lines(struct omap_dss_device *dssdev, int data_lines);
741 809
742int omapdss_sdi_display_enable(struct omap_dss_device *dssdev); 810int omapdss_sdi_display_enable(struct omap_dss_device *dssdev);
743void omapdss_sdi_display_disable(struct omap_dss_device *dssdev); 811void omapdss_sdi_display_disable(struct omap_dss_device *dssdev);
812void omapdss_sdi_set_timings(struct omap_dss_device *dssdev,
813 struct omap_video_timings *timings);
814void omapdss_sdi_set_datapairs(struct omap_dss_device *dssdev, int datapairs);
744 815
745int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev); 816int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev);
746void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev); 817void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev);
747int omap_rfbi_prepare_update(struct omap_dss_device *dssdev, 818int omap_rfbi_update(struct omap_dss_device *dssdev, void (*callback)(void *),
748 u16 *x, u16 *y, u16 *w, u16 *h); 819 void *data);
749int omap_rfbi_update(struct omap_dss_device *dssdev, 820int omap_rfbi_configure(struct omap_dss_device *dssdev);
750 u16 x, u16 y, u16 w, u16 h, 821void omapdss_rfbi_set_size(struct omap_dss_device *dssdev, u16 w, u16 h);
751 void (*callback)(void *), void *data); 822void omapdss_rfbi_set_pixel_size(struct omap_dss_device *dssdev,
752int omap_rfbi_configure(struct omap_dss_device *dssdev, int pixel_size, 823 int pixel_size);
824void omapdss_rfbi_set_data_lines(struct omap_dss_device *dssdev,
753 int data_lines); 825 int data_lines);
826void omapdss_rfbi_set_interface_timings(struct omap_dss_device *dssdev,
827 struct rfbi_timings *timings);
754 828
755#endif 829#endif
diff --git a/include/video/samsung_fimd.h b/include/video/samsung_fimd.h
new file mode 100644
index 000000000000..7ae6c07f2ef8
--- /dev/null
+++ b/include/video/samsung_fimd.h
@@ -0,0 +1,533 @@
1/* include/video/samsung_fimd.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * S3C Platform - new-style fimd and framebuffer register definitions
9 *
10 * This is the register set for the fimd and new style framebuffer interface
11 * found from the S3C2443 onwards into the S3C2416, S3C2450 and the
12 * S3C64XX series such as the S3C6400 and S3C6410.
13 *
14 * The file does not contain the cpu specific items which are based on
15 * whichever architecture is selected, it only contains the core of the
16 * register set. See <mach/regs-fb.h> to get the specifics.
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License version 2 as
20 * published by the Free Software Foundation.
21*/
22
23/* VIDCON0 */
24
25#define VIDCON0 (0x00)
26#define VIDCON0_INTERLACE (1 << 29)
27#define VIDCON0_VIDOUT_MASK (0x3 << 26)
28#define VIDCON0_VIDOUT_SHIFT (26)
29#define VIDCON0_VIDOUT_RGB (0x0 << 26)
30#define VIDCON0_VIDOUT_TV (0x1 << 26)
31#define VIDCON0_VIDOUT_I80_LDI0 (0x2 << 26)
32#define VIDCON0_VIDOUT_I80_LDI1 (0x3 << 26)
33
34#define VIDCON0_L1_DATA_MASK (0x7 << 23)
35#define VIDCON0_L1_DATA_SHIFT (23)
36#define VIDCON0_L1_DATA_16BPP (0x0 << 23)
37#define VIDCON0_L1_DATA_18BPP16 (0x1 << 23)
38#define VIDCON0_L1_DATA_18BPP9 (0x2 << 23)
39#define VIDCON0_L1_DATA_24BPP (0x3 << 23)
40#define VIDCON0_L1_DATA_18BPP (0x4 << 23)
41#define VIDCON0_L1_DATA_16BPP8 (0x5 << 23)
42
43#define VIDCON0_L0_DATA_MASK (0x7 << 20)
44#define VIDCON0_L0_DATA_SHIFT (20)
45#define VIDCON0_L0_DATA_16BPP (0x0 << 20)
46#define VIDCON0_L0_DATA_18BPP16 (0x1 << 20)
47#define VIDCON0_L0_DATA_18BPP9 (0x2 << 20)
48#define VIDCON0_L0_DATA_24BPP (0x3 << 20)
49#define VIDCON0_L0_DATA_18BPP (0x4 << 20)
50#define VIDCON0_L0_DATA_16BPP8 (0x5 << 20)
51
52#define VIDCON0_PNRMODE_MASK (0x3 << 17)
53#define VIDCON0_PNRMODE_SHIFT (17)
54#define VIDCON0_PNRMODE_RGB (0x0 << 17)
55#define VIDCON0_PNRMODE_BGR (0x1 << 17)
56#define VIDCON0_PNRMODE_SERIAL_RGB (0x2 << 17)
57#define VIDCON0_PNRMODE_SERIAL_BGR (0x3 << 17)
58
59#define VIDCON0_CLKVALUP (1 << 16)
60#define VIDCON0_CLKVAL_F_MASK (0xff << 6)
61#define VIDCON0_CLKVAL_F_SHIFT (6)
62#define VIDCON0_CLKVAL_F_LIMIT (0xff)
63#define VIDCON0_CLKVAL_F(_x) ((_x) << 6)
64#define VIDCON0_VLCKFREE (1 << 5)
65#define VIDCON0_CLKDIR (1 << 4)
66
67#define VIDCON0_CLKSEL_MASK (0x3 << 2)
68#define VIDCON0_CLKSEL_SHIFT (2)
69#define VIDCON0_CLKSEL_HCLK (0x0 << 2)
70#define VIDCON0_CLKSEL_LCD (0x1 << 2)
71#define VIDCON0_CLKSEL_27M (0x3 << 2)
72
73#define VIDCON0_ENVID (1 << 1)
74#define VIDCON0_ENVID_F (1 << 0)
75
76#define VIDCON1 (0x04)
77#define VIDCON1_LINECNT_MASK (0x7ff << 16)
78#define VIDCON1_LINECNT_SHIFT (16)
79#define VIDCON1_LINECNT_GET(_v) (((_v) >> 16) & 0x7ff)
80#define VIDCON1_VSTATUS_MASK (0x3 << 13)
81#define VIDCON1_VSTATUS_SHIFT (13)
82#define VIDCON1_VSTATUS_VSYNC (0x0 << 13)
83#define VIDCON1_VSTATUS_BACKPORCH (0x1 << 13)
84#define VIDCON1_VSTATUS_ACTIVE (0x2 << 13)
85#define VIDCON1_VSTATUS_FRONTPORCH (0x0 << 13)
86#define VIDCON1_VCLK_MASK (0x3 << 9)
87#define VIDCON1_VCLK_HOLD (0x0 << 9)
88#define VIDCON1_VCLK_RUN (0x1 << 9)
89
90#define VIDCON1_INV_VCLK (1 << 7)
91#define VIDCON1_INV_HSYNC (1 << 6)
92#define VIDCON1_INV_VSYNC (1 << 5)
93#define VIDCON1_INV_VDEN (1 << 4)
94
95/* VIDCON2 */
96
97#define VIDCON2 (0x08)
98#define VIDCON2_EN601 (1 << 23)
99#define VIDCON2_TVFMTSEL_SW (1 << 14)
100
101#define VIDCON2_TVFMTSEL1_MASK (0x3 << 12)
102#define VIDCON2_TVFMTSEL1_SHIFT (12)
103#define VIDCON2_TVFMTSEL1_RGB (0x0 << 12)
104#define VIDCON2_TVFMTSEL1_YUV422 (0x1 << 12)
105#define VIDCON2_TVFMTSEL1_YUV444 (0x2 << 12)
106
107#define VIDCON2_ORGYCbCr (1 << 8)
108#define VIDCON2_YUVORDCrCb (1 << 7)
109
110/* PRTCON (S3C6410, S5PC100)
111 * Might not be present in the S3C6410 documentation,
112 * but tests prove it's there almost for sure; shouldn't hurt in any case.
113 */
114#define PRTCON (0x0c)
115#define PRTCON_PROTECT (1 << 11)
116
117/* VIDTCON0 */
118
119#define VIDTCON0_VBPDE_MASK (0xff << 24)
120#define VIDTCON0_VBPDE_SHIFT (24)
121#define VIDTCON0_VBPDE_LIMIT (0xff)
122#define VIDTCON0_VBPDE(_x) ((_x) << 24)
123
124#define VIDTCON0_VBPD_MASK (0xff << 16)
125#define VIDTCON0_VBPD_SHIFT (16)
126#define VIDTCON0_VBPD_LIMIT (0xff)
127#define VIDTCON0_VBPD(_x) ((_x) << 16)
128
129#define VIDTCON0_VFPD_MASK (0xff << 8)
130#define VIDTCON0_VFPD_SHIFT (8)
131#define VIDTCON0_VFPD_LIMIT (0xff)
132#define VIDTCON0_VFPD(_x) ((_x) << 8)
133
134#define VIDTCON0_VSPW_MASK (0xff << 0)
135#define VIDTCON0_VSPW_SHIFT (0)
136#define VIDTCON0_VSPW_LIMIT (0xff)
137#define VIDTCON0_VSPW(_x) ((_x) << 0)
138
139/* VIDTCON1 */
140
141#define VIDTCON1_VFPDE_MASK (0xff << 24)
142#define VIDTCON1_VFPDE_SHIFT (24)
143#define VIDTCON1_VFPDE_LIMIT (0xff)
144#define VIDTCON1_VFPDE(_x) ((_x) << 24)
145
146#define VIDTCON1_HBPD_MASK (0xff << 16)
147#define VIDTCON1_HBPD_SHIFT (16)
148#define VIDTCON1_HBPD_LIMIT (0xff)
149#define VIDTCON1_HBPD(_x) ((_x) << 16)
150
151#define VIDTCON1_HFPD_MASK (0xff << 8)
152#define VIDTCON1_HFPD_SHIFT (8)
153#define VIDTCON1_HFPD_LIMIT (0xff)
154#define VIDTCON1_HFPD(_x) ((_x) << 8)
155
156#define VIDTCON1_HSPW_MASK (0xff << 0)
157#define VIDTCON1_HSPW_SHIFT (0)
158#define VIDTCON1_HSPW_LIMIT (0xff)
159#define VIDTCON1_HSPW(_x) ((_x) << 0)
160
161#define VIDTCON2 (0x18)
162#define VIDTCON2_LINEVAL_E(_x) ((((_x) & 0x800) >> 11) << 23)
163#define VIDTCON2_LINEVAL_MASK (0x7ff << 11)
164#define VIDTCON2_LINEVAL_SHIFT (11)
165#define VIDTCON2_LINEVAL_LIMIT (0x7ff)
166#define VIDTCON2_LINEVAL(_x) (((_x) & 0x7ff) << 11)
167
168#define VIDTCON2_HOZVAL_E(_x) ((((_x) & 0x800) >> 11) << 22)
169#define VIDTCON2_HOZVAL_MASK (0x7ff << 0)
170#define VIDTCON2_HOZVAL_SHIFT (0)
171#define VIDTCON2_HOZVAL_LIMIT (0x7ff)
172#define VIDTCON2_HOZVAL(_x) (((_x) & 0x7ff) << 0)
173
174/* WINCONx */
175
176
177#define WINCONx_BITSWP (1 << 18)
178#define WINCONx_BYTSWP (1 << 17)
179#define WINCONx_HAWSWP (1 << 16)
180#define WINCONx_WSWP (1 << 15)
181#define WINCONx_BURSTLEN_MASK (0x3 << 9)
182#define WINCONx_BURSTLEN_SHIFT (9)
183#define WINCONx_BURSTLEN_16WORD (0x0 << 9)
184#define WINCONx_BURSTLEN_8WORD (0x1 << 9)
185#define WINCONx_BURSTLEN_4WORD (0x2 << 9)
186
187#define WINCONx_ENWIN (1 << 0)
188#define WINCON0_BPPMODE_MASK (0xf << 2)
189#define WINCON0_BPPMODE_SHIFT (2)
190#define WINCON0_BPPMODE_1BPP (0x0 << 2)
191#define WINCON0_BPPMODE_2BPP (0x1 << 2)
192#define WINCON0_BPPMODE_4BPP (0x2 << 2)
193#define WINCON0_BPPMODE_8BPP_PALETTE (0x3 << 2)
194#define WINCON0_BPPMODE_16BPP_565 (0x5 << 2)
195#define WINCON0_BPPMODE_16BPP_1555 (0x7 << 2)
196#define WINCON0_BPPMODE_18BPP_666 (0x8 << 2)
197#define WINCON0_BPPMODE_24BPP_888 (0xb << 2)
198
199#define WINCON1_BLD_PIX (1 << 6)
200
201#define WINCON1_ALPHA_SEL (1 << 1)
202#define WINCON1_BPPMODE_MASK (0xf << 2)
203#define WINCON1_BPPMODE_SHIFT (2)
204#define WINCON1_BPPMODE_1BPP (0x0 << 2)
205#define WINCON1_BPPMODE_2BPP (0x1 << 2)
206#define WINCON1_BPPMODE_4BPP (0x2 << 2)
207#define WINCON1_BPPMODE_8BPP_PALETTE (0x3 << 2)
208#define WINCON1_BPPMODE_8BPP_1232 (0x4 << 2)
209#define WINCON1_BPPMODE_16BPP_565 (0x5 << 2)
210#define WINCON1_BPPMODE_16BPP_A1555 (0x6 << 2)
211#define WINCON1_BPPMODE_16BPP_I1555 (0x7 << 2)
212#define WINCON1_BPPMODE_18BPP_666 (0x8 << 2)
213#define WINCON1_BPPMODE_18BPP_A1665 (0x9 << 2)
214#define WINCON1_BPPMODE_19BPP_A1666 (0xa << 2)
215#define WINCON1_BPPMODE_24BPP_888 (0xb << 2)
216#define WINCON1_BPPMODE_24BPP_A1887 (0xc << 2)
217#define WINCON1_BPPMODE_25BPP_A1888 (0xd << 2)
218#define WINCON1_BPPMODE_28BPP_A4888 (0xd << 2)
219
220/* S5PV210 */
221#define SHADOWCON (0x34)
222#define SHADOWCON_WINx_PROTECT(_win) (1 << (10 + (_win)))
223/* DMA channels (all windows) */
224#define SHADOWCON_CHx_ENABLE(_win) (1 << (_win))
225/* Local input channels (windows 0-2) */
226#define SHADOWCON_CHx_LOCAL_ENABLE(_win) (1 << (5 + (_win)))
227
228#define VIDOSDxA_TOPLEFT_X_E(_x) ((((_x) & 0x800) >> 11) << 23)
229#define VIDOSDxA_TOPLEFT_X_MASK (0x7ff << 11)
230#define VIDOSDxA_TOPLEFT_X_SHIFT (11)
231#define VIDOSDxA_TOPLEFT_X_LIMIT (0x7ff)
232#define VIDOSDxA_TOPLEFT_X(_x) (((_x) & 0x7ff) << 11)
233
234#define VIDOSDxA_TOPLEFT_Y_E(_x) ((((_x) & 0x800) >> 11) << 22)
235#define VIDOSDxA_TOPLEFT_Y_MASK (0x7ff << 0)
236#define VIDOSDxA_TOPLEFT_Y_SHIFT (0)
237#define VIDOSDxA_TOPLEFT_Y_LIMIT (0x7ff)
238#define VIDOSDxA_TOPLEFT_Y(_x) (((_x) & 0x7ff) << 0)
239
240#define VIDOSDxB_BOTRIGHT_X_E(_x) ((((_x) & 0x800) >> 11) << 23)
241#define VIDOSDxB_BOTRIGHT_X_MASK (0x7ff << 11)
242#define VIDOSDxB_BOTRIGHT_X_SHIFT (11)
243#define VIDOSDxB_BOTRIGHT_X_LIMIT (0x7ff)
244#define VIDOSDxB_BOTRIGHT_X(_x) (((_x) & 0x7ff) << 11)
245
246#define VIDOSDxB_BOTRIGHT_Y_E(_x) ((((_x) & 0x800) >> 11) << 22)
247#define VIDOSDxB_BOTRIGHT_Y_MASK (0x7ff << 0)
248#define VIDOSDxB_BOTRIGHT_Y_SHIFT (0)
249#define VIDOSDxB_BOTRIGHT_Y_LIMIT (0x7ff)
250#define VIDOSDxB_BOTRIGHT_Y(_x) (((_x) & 0x7ff) << 0)
251
252/* For VIDOSD[1..4]C */
253#define VIDISD14C_ALPHA0_R(_x) ((_x) << 20)
254#define VIDISD14C_ALPHA0_G_MASK (0xf << 16)
255#define VIDISD14C_ALPHA0_G_SHIFT (16)
256#define VIDISD14C_ALPHA0_G_LIMIT (0xf)
257#define VIDISD14C_ALPHA0_G(_x) ((_x) << 16)
258#define VIDISD14C_ALPHA0_B_MASK (0xf << 12)
259#define VIDISD14C_ALPHA0_B_SHIFT (12)
260#define VIDISD14C_ALPHA0_B_LIMIT (0xf)
261#define VIDISD14C_ALPHA0_B(_x) ((_x) << 12)
262#define VIDISD14C_ALPHA1_R_MASK (0xf << 8)
263#define VIDISD14C_ALPHA1_R_SHIFT (8)
264#define VIDISD14C_ALPHA1_R_LIMIT (0xf)
265#define VIDISD14C_ALPHA1_R(_x) ((_x) << 8)
266#define VIDISD14C_ALPHA1_G_MASK (0xf << 4)
267#define VIDISD14C_ALPHA1_G_SHIFT (4)
268#define VIDISD14C_ALPHA1_G_LIMIT (0xf)
269#define VIDISD14C_ALPHA1_G(_x) ((_x) << 4)
270#define VIDISD14C_ALPHA1_B_MASK (0xf << 0)
271#define VIDISD14C_ALPHA1_B_SHIFT (0)
272#define VIDISD14C_ALPHA1_B_LIMIT (0xf)
273#define VIDISD14C_ALPHA1_B(_x) ((_x) << 0)
274
275/* Video buffer addresses */
276#define VIDW_BUF_START(_buff) (0xA0 + ((_buff) * 8))
277#define VIDW_BUF_START1(_buff) (0xA4 + ((_buff) * 8))
278#define VIDW_BUF_END(_buff) (0xD0 + ((_buff) * 8))
279#define VIDW_BUF_END1(_buff) (0xD4 + ((_buff) * 8))
280#define VIDW_BUF_SIZE(_buff) (0x100 + ((_buff) * 4))
281
282#define VIDW_BUF_SIZE_OFFSET_E(_x) ((((_x) & 0x2000) >> 13) << 27)
283#define VIDW_BUF_SIZE_OFFSET_MASK (0x1fff << 13)
284#define VIDW_BUF_SIZE_OFFSET_SHIFT (13)
285#define VIDW_BUF_SIZE_OFFSET_LIMIT (0x1fff)
286#define VIDW_BUF_SIZE_OFFSET(_x) (((_x) & 0x1fff) << 13)
287
288#define VIDW_BUF_SIZE_PAGEWIDTH_E(_x) ((((_x) & 0x2000) >> 13) << 26)
289#define VIDW_BUF_SIZE_PAGEWIDTH_MASK (0x1fff << 0)
290#define VIDW_BUF_SIZE_PAGEWIDTH_SHIFT (0)
291#define VIDW_BUF_SIZE_PAGEWIDTH_LIMIT (0x1fff)
292#define VIDW_BUF_SIZE_PAGEWIDTH(_x) (((_x) & 0x1fff) << 0)
293
294/* Interrupt controls and status */
295
296#define VIDINTCON0_FIFOINTERVAL_MASK (0x3f << 20)
297#define VIDINTCON0_FIFOINTERVAL_SHIFT (20)
298#define VIDINTCON0_FIFOINTERVAL_LIMIT (0x3f)
299#define VIDINTCON0_FIFOINTERVAL(_x) ((_x) << 20)
300
301#define VIDINTCON0_INT_SYSMAINCON (1 << 19)
302#define VIDINTCON0_INT_SYSSUBCON (1 << 18)
303#define VIDINTCON0_INT_I80IFDONE (1 << 17)
304
305#define VIDINTCON0_FRAMESEL0_MASK (0x3 << 15)
306#define VIDINTCON0_FRAMESEL0_SHIFT (15)
307#define VIDINTCON0_FRAMESEL0_BACKPORCH (0x0 << 15)
308#define VIDINTCON0_FRAMESEL0_VSYNC (0x1 << 15)
309#define VIDINTCON0_FRAMESEL0_ACTIVE (0x2 << 15)
310#define VIDINTCON0_FRAMESEL0_FRONTPORCH (0x3 << 15)
311
312#define VIDINTCON0_FRAMESEL1 (1 << 13)
313#define VIDINTCON0_FRAMESEL1_MASK (0x3 << 13)
314#define VIDINTCON0_FRAMESEL1_NONE (0x0 << 13)
315#define VIDINTCON0_FRAMESEL1_BACKPORCH (0x1 << 13)
316#define VIDINTCON0_FRAMESEL1_VSYNC (0x2 << 13)
317#define VIDINTCON0_FRAMESEL1_FRONTPORCH (0x3 << 13)
318
319#define VIDINTCON0_INT_FRAME (1 << 12)
320#define VIDINTCON0_FIFIOSEL_MASK (0x7f << 5)
321#define VIDINTCON0_FIFIOSEL_SHIFT (5)
322#define VIDINTCON0_FIFIOSEL_WINDOW0 (0x1 << 5)
323#define VIDINTCON0_FIFIOSEL_WINDOW1 (0x2 << 5)
324
325#define VIDINTCON0_FIFOLEVEL_MASK (0x7 << 2)
326#define VIDINTCON0_FIFOLEVEL_SHIFT (2)
327#define VIDINTCON0_FIFOLEVEL_TO25PC (0x0 << 2)
328#define VIDINTCON0_FIFOLEVEL_TO50PC (0x1 << 2)
329#define VIDINTCON0_FIFOLEVEL_TO75PC (0x2 << 2)
330#define VIDINTCON0_FIFOLEVEL_EMPTY (0x3 << 2)
331#define VIDINTCON0_FIFOLEVEL_FULL (0x4 << 2)
332
333#define VIDINTCON0_INT_FIFO_MASK (0x3 << 0)
334#define VIDINTCON0_INT_FIFO_SHIFT (0)
335#define VIDINTCON0_INT_ENABLE (1 << 0)
336
337#define VIDINTCON1 (0x134)
338#define VIDINTCON1_INT_I180 (1 << 2)
339#define VIDINTCON1_INT_FRAME (1 << 1)
340#define VIDINTCON1_INT_FIFO (1 << 0)
341
342/* Window colour-key control registers */
343#define WKEYCON (0x140) /* 6410,V210 */
344
345#define WKEYCON0 (0x00)
346#define WKEYCON1 (0x04)
347
348#define WxKEYCON0_KEYBL_EN (1 << 26)
349#define WxKEYCON0_KEYEN_F (1 << 25)
350#define WxKEYCON0_DIRCON (1 << 24)
351#define WxKEYCON0_COMPKEY_MASK (0xffffff << 0)
352#define WxKEYCON0_COMPKEY_SHIFT (0)
353#define WxKEYCON0_COMPKEY_LIMIT (0xffffff)
354#define WxKEYCON0_COMPKEY(_x) ((_x) << 0)
355#define WxKEYCON1_COLVAL_MASK (0xffffff << 0)
356#define WxKEYCON1_COLVAL_SHIFT (0)
357#define WxKEYCON1_COLVAL_LIMIT (0xffffff)
358#define WxKEYCON1_COLVAL(_x) ((_x) << 0)
359
360
361/* Window blanking (MAP) */
362
363#define WINxMAP_MAP (1 << 24)
364#define WINxMAP_MAP_COLOUR_MASK (0xffffff << 0)
365#define WINxMAP_MAP_COLOUR_SHIFT (0)
366#define WINxMAP_MAP_COLOUR_LIMIT (0xffffff)
367#define WINxMAP_MAP_COLOUR(_x) ((_x) << 0)
368
369#define WPALCON_PAL_UPDATE (1 << 9)
370#define WPALCON_W1PAL_MASK (0x7 << 3)
371#define WPALCON_W1PAL_SHIFT (3)
372#define WPALCON_W1PAL_25BPP_A888 (0x0 << 3)
373#define WPALCON_W1PAL_24BPP (0x1 << 3)
374#define WPALCON_W1PAL_19BPP_A666 (0x2 << 3)
375#define WPALCON_W1PAL_18BPP_A665 (0x3 << 3)
376#define WPALCON_W1PAL_18BPP (0x4 << 3)
377#define WPALCON_W1PAL_16BPP_A555 (0x5 << 3)
378#define WPALCON_W1PAL_16BPP_565 (0x6 << 3)
379
380#define WPALCON_W0PAL_MASK (0x7 << 0)
381#define WPALCON_W0PAL_SHIFT (0)
382#define WPALCON_W0PAL_25BPP_A888 (0x0 << 0)
383#define WPALCON_W0PAL_24BPP (0x1 << 0)
384#define WPALCON_W0PAL_19BPP_A666 (0x2 << 0)
385#define WPALCON_W0PAL_18BPP_A665 (0x3 << 0)
386#define WPALCON_W0PAL_18BPP (0x4 << 0)
387#define WPALCON_W0PAL_16BPP_A555 (0x5 << 0)
388#define WPALCON_W0PAL_16BPP_565 (0x6 << 0)
389
390/* Blending equation control */
391#define BLENDCON (0x260)
392#define BLENDCON_NEW_MASK (1 << 0)
393#define BLENDCON_NEW_8BIT_ALPHA_VALUE (1 << 0)
394#define BLENDCON_NEW_4BIT_ALPHA_VALUE (0 << 0)
395
396#define S3C_FB_MAX_WIN (5) /* number of hardware windows available. */
397#define VIDCON1_FSTATUS_EVEN (1 << 15)
398
399/* Video timing controls */
400#define VIDTCON0 (0x10)
401#define VIDTCON1 (0x14)
402#define VIDTCON2 (0x18)
403
404/* Window position controls */
405
406#define WINCON(_win) (0x20 + ((_win) * 4))
407
408/* OSD1 and OSD4 do not have register D */
409
410#define VIDOSD_BASE (0x40)
411
412#define VIDINTCON0 (0x130)
413
414/* WINCONx */
415
416#define WINCONx_CSCWIDTH_MASK (0x3 << 26)
417#define WINCONx_CSCWIDTH_SHIFT (26)
418#define WINCONx_CSCWIDTH_WIDE (0x0 << 26)
419#define WINCONx_CSCWIDTH_NARROW (0x3 << 26)
420
421#define WINCONx_ENLOCAL (1 << 22)
422#define WINCONx_BUFSTATUS (1 << 21)
423#define WINCONx_BUFSEL (1 << 20)
424#define WINCONx_BUFAUTOEN (1 << 19)
425#define WINCONx_YCbCr (1 << 13)
426
427#define WINCON1_LOCALSEL_CAMIF (1 << 23)
428
429#define WINCON2_LOCALSEL_CAMIF (1 << 23)
430#define WINCON2_BLD_PIX (1 << 6)
431
432#define WINCON2_ALPHA_SEL (1 << 1)
433#define WINCON2_BPPMODE_MASK (0xf << 2)
434#define WINCON2_BPPMODE_SHIFT (2)
435#define WINCON2_BPPMODE_1BPP (0x0 << 2)
436#define WINCON2_BPPMODE_2BPP (0x1 << 2)
437#define WINCON2_BPPMODE_4BPP (0x2 << 2)
438#define WINCON2_BPPMODE_8BPP_1232 (0x4 << 2)
439#define WINCON2_BPPMODE_16BPP_565 (0x5 << 2)
440#define WINCON2_BPPMODE_16BPP_A1555 (0x6 << 2)
441#define WINCON2_BPPMODE_16BPP_I1555 (0x7 << 2)
442#define WINCON2_BPPMODE_18BPP_666 (0x8 << 2)
443#define WINCON2_BPPMODE_18BPP_A1665 (0x9 << 2)
444#define WINCON2_BPPMODE_19BPP_A1666 (0xa << 2)
445#define WINCON2_BPPMODE_24BPP_888 (0xb << 2)
446#define WINCON2_BPPMODE_24BPP_A1887 (0xc << 2)
447#define WINCON2_BPPMODE_25BPP_A1888 (0xd << 2)
448#define WINCON2_BPPMODE_28BPP_A4888 (0xd << 2)
449
450#define WINCON3_BLD_PIX (1 << 6)
451
452#define WINCON3_ALPHA_SEL (1 << 1)
453#define WINCON3_BPPMODE_MASK (0xf << 2)
454#define WINCON3_BPPMODE_SHIFT (2)
455#define WINCON3_BPPMODE_1BPP (0x0 << 2)
456#define WINCON3_BPPMODE_2BPP (0x1 << 2)
457#define WINCON3_BPPMODE_4BPP (0x2 << 2)
458#define WINCON3_BPPMODE_16BPP_565 (0x5 << 2)
459#define WINCON3_BPPMODE_16BPP_A1555 (0x6 << 2)
460#define WINCON3_BPPMODE_16BPP_I1555 (0x7 << 2)
461#define WINCON3_BPPMODE_18BPP_666 (0x8 << 2)
462#define WINCON3_BPPMODE_18BPP_A1665 (0x9 << 2)
463#define WINCON3_BPPMODE_19BPP_A1666 (0xa << 2)
464#define WINCON3_BPPMODE_24BPP_888 (0xb << 2)
465#define WINCON3_BPPMODE_24BPP_A1887 (0xc << 2)
466#define WINCON3_BPPMODE_25BPP_A1888 (0xd << 2)
467#define WINCON3_BPPMODE_28BPP_A4888 (0xd << 2)
468
469#define VIDINTCON0_FIFIOSEL_WINDOW2 (0x10 << 5)
470#define VIDINTCON0_FIFIOSEL_WINDOW3 (0x20 << 5)
471#define VIDINTCON0_FIFIOSEL_WINDOW4 (0x40 << 5)
472
473#define DITHMODE (0x170)
474#define WINxMAP(_win) (0x180 + ((_win) * 4))
475
476
477#define DITHMODE_R_POS_MASK (0x3 << 5)
478#define DITHMODE_R_POS_SHIFT (5)
479#define DITHMODE_R_POS_8BIT (0x0 << 5)
480#define DITHMODE_R_POS_6BIT (0x1 << 5)
481#define DITHMODE_R_POS_5BIT (0x2 << 5)
482
483#define DITHMODE_G_POS_MASK (0x3 << 3)
484#define DITHMODE_G_POS_SHIFT (3)
485#define DITHMODE_G_POS_8BIT (0x0 << 3)
486#define DITHMODE_G_POS_6BIT (0x1 << 3)
487#define DITHMODE_G_POS_5BIT (0x2 << 3)
488
489#define DITHMODE_B_POS_MASK (0x3 << 1)
490#define DITHMODE_B_POS_SHIFT (1)
491#define DITHMODE_B_POS_8BIT (0x0 << 1)
492#define DITHMODE_B_POS_6BIT (0x1 << 1)
493#define DITHMODE_B_POS_5BIT (0x2 << 1)
494
495#define DITHMODE_DITH_EN (1 << 0)
496
497#define WPALCON (0x1A0)
498
499/* Palette control */
500/* Note for S5PC100: you can still use those macros on WPALCON (aka WPALCON_L),
501 * but make sure that WPALCON_H W2PAL-W4PAL entries are zeroed out */
502#define WPALCON_W4PAL_16BPP_A555 (1 << 8)
503#define WPALCON_W3PAL_16BPP_A555 (1 << 7)
504#define WPALCON_W2PAL_16BPP_A555 (1 << 6)
505
506
507/* Notes on per-window bpp settings
508 *
509 * Value Win0 Win1 Win2 Win3 Win 4
510 * 0000 1(P) 1(P) 1(P) 1(P) 1(P)
511 * 0001 2(P) 2(P) 2(P) 2(P) 2(P)
512 * 0010 4(P) 4(P) 4(P) 4(P) -none-
513 * 0011 8(P) 8(P) -none- -none- -none-
514 * 0100 -none- 8(A232) 8(A232) -none- -none-
515 * 0101 16(565) 16(565) 16(565) 16(565) 16(565)
516 * 0110 -none- 16(A555) 16(A555) 16(A555) 16(A555)
517 * 0111 16(I555) 16(I565) 16(I555) 16(I555) 16(I555)
518 * 1000 18(666) 18(666) 18(666) 18(666) 18(666)
519 * 1001 -none- 18(A665) 18(A665) 18(A665) 16(A665)
520 * 1010 -none- 19(A666) 19(A666) 19(A666) 19(A666)
521 * 1011 24(888) 24(888) 24(888) 24(888) 24(888)
522 * 1100 -none- 24(A887) 24(A887) 24(A887) 24(A887)
523 * 1101 -none- 25(A888) 25(A888) 25(A888) 25(A888)
524 * 1110 -none- -none- -none- -none- -none-
525 * 1111 -none- -none- -none- -none- -none-
526*/
527
528/* FIMD Version 8 register offset definitions */
529#define FIMD_V8_VIDTCON0 (0x20010)
530#define FIMD_V8_VIDTCON1 (0x20014)
531#define FIMD_V8_VIDTCON2 (0x20018)
532#define FIMD_V8_VIDTCON3 (0x2001C)
533#define FIMD_V8_VIDCON1 (0x20004)
diff --git a/include/xen/Kbuild b/include/xen/Kbuild
deleted file mode 100644
index 84ad8f02fee5..000000000000
--- a/include/xen/Kbuild
+++ /dev/null
@@ -1,2 +0,0 @@
1header-y += evtchn.h
2header-y += privcmd.h
diff --git a/include/xen/events.h b/include/xen/events.h
index 04399b28e821..c6bfe01acf6b 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -109,4 +109,6 @@ int xen_irq_from_gsi(unsigned gsi);
109/* Determine whether to ignore this IRQ if it is passed to a guest. */ 109/* Determine whether to ignore this IRQ if it is passed to a guest. */
110int xen_test_irq_shared(int irq); 110int xen_test_irq_shared(int irq);
111 111
112/* initialize Xen IRQ subsystem */
113void xen_init_IRQ(void);
112#endif /* _XEN_EVENTS_H */ 114#endif /* _XEN_EVENTS_H */
diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
index aecee9d112cb..694dcaf266e6 100644
--- a/include/xen/grant_table.h
+++ b/include/xen/grant_table.h
@@ -170,7 +170,7 @@ gnttab_set_unmap_op(struct gnttab_unmap_grant_ref *unmap, phys_addr_t addr,
170 unmap->dev_bus_addr = 0; 170 unmap->dev_bus_addr = 0;
171} 171}
172 172
173int arch_gnttab_map_shared(unsigned long *frames, unsigned long nr_gframes, 173int arch_gnttab_map_shared(xen_pfn_t *frames, unsigned long nr_gframes,
174 unsigned long max_nr_gframes, 174 unsigned long max_nr_gframes,
175 void **__shared); 175 void **__shared);
176int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes, 176int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes,
diff --git a/include/xen/interface/features.h b/include/xen/interface/features.h
index b6ca39a069d8..131a6ccdba25 100644
--- a/include/xen/interface/features.h
+++ b/include/xen/interface/features.h
@@ -50,6 +50,9 @@
50/* x86: pirq can be used by HVM guests */ 50/* x86: pirq can be used by HVM guests */
51#define XENFEAT_hvm_pirqs 10 51#define XENFEAT_hvm_pirqs 10
52 52
53/* operation as Dom0 is supported */
54#define XENFEAT_dom0 11
55
53#define XENFEAT_NR_SUBMAPS 1 56#define XENFEAT_NR_SUBMAPS 1
54 57
55#endif /* __XEN_PUBLIC_FEATURES_H__ */ 58#endif /* __XEN_PUBLIC_FEATURES_H__ */
diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h
index f9f8b975ae74..e40fae9bf11a 100644
--- a/include/xen/interface/grant_table.h
+++ b/include/xen/interface/grant_table.h
@@ -310,7 +310,7 @@ struct gnttab_setup_table {
310 uint32_t nr_frames; 310 uint32_t nr_frames;
311 /* OUT parameters. */ 311 /* OUT parameters. */
312 int16_t status; /* GNTST_* */ 312 int16_t status; /* GNTST_* */
313 GUEST_HANDLE(ulong) frame_list; 313 GUEST_HANDLE(xen_pfn_t) frame_list;
314}; 314};
315DEFINE_GUEST_HANDLE_STRUCT(gnttab_setup_table); 315DEFINE_GUEST_HANDLE_STRUCT(gnttab_setup_table);
316 316
diff --git a/include/xen/interface/hvm/hvm_op.h b/include/xen/interface/hvm/hvm_op.h
index a4827f46ee97..956a04682865 100644
--- a/include/xen/interface/hvm/hvm_op.h
+++ b/include/xen/interface/hvm/hvm_op.h
@@ -43,4 +43,23 @@ struct xen_hvm_pagetable_dying {
43typedef struct xen_hvm_pagetable_dying xen_hvm_pagetable_dying_t; 43typedef struct xen_hvm_pagetable_dying xen_hvm_pagetable_dying_t;
44DEFINE_GUEST_HANDLE_STRUCT(xen_hvm_pagetable_dying_t); 44DEFINE_GUEST_HANDLE_STRUCT(xen_hvm_pagetable_dying_t);
45 45
46enum hvmmem_type_t {
47 HVMMEM_ram_rw, /* Normal read/write guest RAM */
48 HVMMEM_ram_ro, /* Read-only; writes are discarded */
49 HVMMEM_mmio_dm, /* Reads and write go to the device model */
50};
51
52#define HVMOP_get_mem_type 15
53/* Return hvmmem_type_t for the specified pfn. */
54struct xen_hvm_get_mem_type {
55 /* Domain to be queried. */
56 domid_t domid;
57 /* OUT variable. */
58 uint16_t mem_type;
59 uint16_t pad[2]; /* align next field on 8-byte boundary */
60 /* IN variable. */
61 uint64_t pfn;
62};
63DEFINE_GUEST_HANDLE_STRUCT(xen_hvm_get_mem_type);
64
46#endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */ 65#endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */
diff --git a/include/xen/interface/io/protocols.h b/include/xen/interface/io/protocols.h
index 01fc8ae5f0b0..0eafaf254fff 100644
--- a/include/xen/interface/io/protocols.h
+++ b/include/xen/interface/io/protocols.h
@@ -5,6 +5,7 @@
5#define XEN_IO_PROTO_ABI_X86_64 "x86_64-abi" 5#define XEN_IO_PROTO_ABI_X86_64 "x86_64-abi"
6#define XEN_IO_PROTO_ABI_IA64 "ia64-abi" 6#define XEN_IO_PROTO_ABI_IA64 "ia64-abi"
7#define XEN_IO_PROTO_ABI_POWERPC64 "powerpc64-abi" 7#define XEN_IO_PROTO_ABI_POWERPC64 "powerpc64-abi"
8#define XEN_IO_PROTO_ABI_ARM "arm-abi"
8 9
9#if defined(__i386__) 10#if defined(__i386__)
10# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32 11# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32
@@ -14,6 +15,8 @@
14# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_IA64 15# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_IA64
15#elif defined(__powerpc64__) 16#elif defined(__powerpc64__)
16# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_POWERPC64 17# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_POWERPC64
18#elif defined(__arm__)
19# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_ARM
17#else 20#else
18# error arch fixup needed here 21# error arch fixup needed here
19#endif 22#endif
diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h
index d8e33a93ea4d..90712e2072d5 100644
--- a/include/xen/interface/memory.h
+++ b/include/xen/interface/memory.h
@@ -34,7 +34,7 @@ struct xen_memory_reservation {
34 GUEST_HANDLE(xen_pfn_t) extent_start; 34 GUEST_HANDLE(xen_pfn_t) extent_start;
35 35
36 /* Number of extents, and size/alignment of each (2^extent_order pages). */ 36 /* Number of extents, and size/alignment of each (2^extent_order pages). */
37 unsigned long nr_extents; 37 xen_ulong_t nr_extents;
38 unsigned int extent_order; 38 unsigned int extent_order;
39 39
40 /* 40 /*
@@ -92,7 +92,7 @@ struct xen_memory_exchange {
92 * command will be non-zero. 92 * command will be non-zero.
93 * 5. THIS FIELD MUST BE INITIALISED TO ZERO BY THE CALLER! 93 * 5. THIS FIELD MUST BE INITIALISED TO ZERO BY THE CALLER!
94 */ 94 */
95 unsigned long nr_exchanged; 95 xen_ulong_t nr_exchanged;
96}; 96};
97 97
98DEFINE_GUEST_HANDLE_STRUCT(xen_memory_exchange); 98DEFINE_GUEST_HANDLE_STRUCT(xen_memory_exchange);
@@ -148,8 +148,8 @@ DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mfn_list);
148 */ 148 */
149#define XENMEM_machphys_mapping 12 149#define XENMEM_machphys_mapping 12
150struct xen_machphys_mapping { 150struct xen_machphys_mapping {
151 unsigned long v_start, v_end; /* Start and end virtual addresses. */ 151 xen_ulong_t v_start, v_end; /* Start and end virtual addresses. */
152 unsigned long max_mfn; /* Maximum MFN that can be looked up. */ 152 xen_ulong_t max_mfn; /* Maximum MFN that can be looked up. */
153}; 153};
154DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mapping_t); 154DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mapping_t);
155 155
@@ -172,35 +172,15 @@ struct xen_add_to_physmap {
172 unsigned int space; 172 unsigned int space;
173 173
174 /* Index into source mapping space. */ 174 /* Index into source mapping space. */
175 unsigned long idx; 175 xen_ulong_t idx;
176 176
177 /* GPFN where the source mapping page should appear. */ 177 /* GPFN where the source mapping page should appear. */
178 xen_pfn_t gpfn; 178 xen_pfn_t gpfn;
179}; 179};
180DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap); 180DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap);
181 181
182/* 182/*** REMOVED ***/
183 * Translates a list of domain-specific GPFNs into MFNs. Returns a -ve error 183/*#define XENMEM_translate_gpfn_list 8*/
184 * code on failure. This call only works for auto-translated guests.
185 */
186#define XENMEM_translate_gpfn_list 8
187struct xen_translate_gpfn_list {
188 /* Which domain to translate for? */
189 domid_t domid;
190
191 /* Length of list. */
192 unsigned long nr_gpfns;
193
194 /* List of GPFNs to translate. */
195 GUEST_HANDLE(ulong) gpfn_list;
196
197 /*
198 * Output list to contain MFN translations. May be the same as the input
199 * list (in which case each input GPFN is overwritten with the output MFN).
200 */
201 GUEST_HANDLE(ulong) mfn_list;
202};
203DEFINE_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list);
204 184
205/* 185/*
206 * Returns the pseudo-physical memory map as it was when the domain 186 * Returns the pseudo-physical memory map as it was when the domain
diff --git a/include/xen/interface/physdev.h b/include/xen/interface/physdev.h
index bfa1d50fe15b..1844d31f4552 100644
--- a/include/xen/interface/physdev.h
+++ b/include/xen/interface/physdev.h
@@ -56,7 +56,7 @@ struct physdev_eoi {
56#define PHYSDEVOP_pirq_eoi_gmfn_v2 28 56#define PHYSDEVOP_pirq_eoi_gmfn_v2 28
57struct physdev_pirq_eoi_gmfn { 57struct physdev_pirq_eoi_gmfn {
58 /* IN */ 58 /* IN */
59 unsigned long gmfn; 59 xen_ulong_t gmfn;
60}; 60};
61 61
62/* 62/*
diff --git a/include/xen/interface/version.h b/include/xen/interface/version.h
index 5f5e551cf546..7ff6498679a3 100644
--- a/include/xen/interface/version.h
+++ b/include/xen/interface/version.h
@@ -45,7 +45,7 @@ struct xen_changeset_info {
45 45
46#define XENVER_platform_parameters 5 46#define XENVER_platform_parameters 5
47struct xen_platform_parameters { 47struct xen_platform_parameters {
48 unsigned long virt_start; 48 xen_ulong_t virt_start;
49}; 49};
50 50
51#define XENVER_get_features 6 51#define XENVER_get_features 6
diff --git a/include/xen/xen.h b/include/xen/xen.h
index a16402418d31..a74d4362c4f8 100644
--- a/include/xen/xen.h
+++ b/include/xen/xen.h
@@ -23,8 +23,8 @@ extern enum xen_domain_type xen_domain_type;
23#include <xen/interface/xen.h> 23#include <xen/interface/xen.h>
24#include <asm/xen/hypervisor.h> 24#include <asm/xen/hypervisor.h>
25 25
26#define xen_initial_domain() (xen_pv_domain() && \ 26#define xen_initial_domain() (xen_domain() && \
27 xen_start_info->flags & SIF_INITDOMAIN) 27 xen_start_info && xen_start_info->flags & SIF_INITDOMAIN)
28#else /* !CONFIG_XEN_DOM0 */ 28#else /* !CONFIG_XEN_DOM0 */
29#define xen_initial_domain() (0) 29#define xen_initial_domain() (0)
30#endif /* CONFIG_XEN_DOM0 */ 30#endif /* CONFIG_XEN_DOM0 */