aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2008-02-03 02:29:41 -0500
committerDavid Woodhouse <dwmw2@infradead.org>2008-02-03 02:30:32 -0500
commitc1f3ee120bb61045b1c0a3ead620d1d65af47130 (patch)
tree908430bf2b47fe8e96ac623ae7ab6dd5698d0938 /include/linux
parente619a75ff6201b567a539e787aa9af9bc63a3187 (diff)
parent9135f1901ee6449dfe338adf6e40e9c2025b8150 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild19
-rw-r--r--include/linux/acpi.h12
-rw-r--r--include/linux/acpi_pmtmr.h2
-rw-r--r--include/linux/apm_bios.h6
-rw-r--r--include/linux/aspm.h44
-rw-r--r--include/linux/ata.h156
-rw-r--r--include/linux/atmbr2684.h51
-rw-r--r--include/linux/atmdev.h4
-rw-r--r--include/linux/attribute_container.h1
-rw-r--r--include/linux/audit.h15
-rw-r--r--include/linux/blkdev.h136
-rw-r--r--include/linux/blktrace_api.h12
-rw-r--r--include/linux/bootmem.h1
-rw-r--r--include/linux/buffer_head.h2
-rw-r--r--include/linux/can.h111
-rw-r--r--include/linux/can/Kbuild3
-rw-r--r--include/linux/can/bcm.h65
-rw-r--r--include/linux/can/core.h64
-rw-r--r--include/linux/can/error.h93
-rw-r--r--include/linux/can/raw.h31
-rw-r--r--include/linux/cdrom.h17
-rw-r--r--include/linux/cgroup_subsys.h13
-rw-r--r--include/linux/clocksource.h3
-rw-r--r--include/linux/compat.h15
-rw-r--r--include/linux/compiler-gcc3.h2
-rw-r--r--include/linux/compiler-gcc4.h1
-rw-r--r--include/linux/compiler.h9
-rw-r--r--include/linux/completion.h1
-rw-r--r--include/linux/connector.h5
-rw-r--r--include/linux/const.h5
-rw-r--r--include/linux/cpu.h21
-rw-r--r--include/linux/cpu_acct.h14
-rw-r--r--include/linux/cpuidle.h1
-rw-r--r--include/linux/cpumask.h6
-rw-r--r--include/linux/crypto.h103
-rw-r--r--include/linux/dccp.h91
-rw-r--r--include/linux/debug_locks.h5
-rw-r--r--include/linux/device-mapper.h2
-rw-r--r--include/linux/device.h363
-rw-r--r--include/linux/dlm.h140
-rw-r--r--include/linux/dlmconstants.h159
-rw-r--r--include/linux/dmaengine.h3
-rw-r--r--include/linux/dmi.h4
-rw-r--r--include/linux/elevator.h2
-rw-r--r--include/linux/elf.h1
-rw-r--r--include/linux/elfnote.h2
-rw-r--r--include/linux/eventpoll.h7
-rw-r--r--include/linux/ext2_fs.h7
-rw-r--r--include/linux/ext3_fs.h20
-rw-r--r--include/linux/ext4_fs.h198
-rw-r--r--include/linux/ext4_fs_extents.h25
-rw-r--r--include/linux/ext4_fs_i.h25
-rw-r--r--include/linux/ext4_fs_sb.h55
-rw-r--r--include/linux/f75375s.h21
-rw-r--r--include/linux/fs.h21
-rw-r--r--include/linux/fuse.h5
-rw-r--r--include/linux/futex.h20
-rw-r--r--include/linux/genhd.h37
-rw-r--r--include/linux/hardirq.h6
-rw-r--r--include/linux/hdreg.h68
-rw-r--r--include/linux/hdsmart.h2
-rw-r--r--include/linux/hid.h18
-rw-r--r--include/linux/hpet.h5
-rw-r--r--include/linux/hrtimer.h14
-rw-r--r--include/linux/hugetlb.h12
-rw-r--r--include/linux/hw_random.h2
-rw-r--r--include/linux/i2c-id.h69
-rw-r--r--include/linux/i2c.h131
-rw-r--r--include/linux/i2c/tps65010.h156
-rw-r--r--include/linux/ide.h475
-rw-r--r--include/linux/ieee80211.h155
-rw-r--r--include/linux/if.h5
-rw-r--r--include/linux/if_addrlabel.h32
-rw-r--r--include/linux/if_arp.h1
-rw-r--r--include/linux/if_bonding.h3
-rw-r--r--include/linux/if_ether.h8
-rw-r--r--include/linux/if_frad.h2
-rw-r--r--include/linux/if_shaper.h51
-rw-r--r--include/linux/if_tr.h3
-rw-r--r--include/linux/if_tun.h4
-rw-r--r--include/linux/if_tunnel.h3
-rw-r--r--include/linux/if_vlan.h67
-rw-r--r--include/linux/in.h68
-rw-r--r--include/linux/inet_lro.h3
-rw-r--r--include/linux/inetdevice.h25
-rw-r--r--include/linux/init.h130
-rw-r--r--include/linux/init_ohci1394_dma.h4
-rw-r--r--include/linux/init_task.h16
-rw-r--r--include/linux/input.h10
-rw-r--r--include/linux/interrupt.h1
-rw-r--r--include/linux/iocontext.h95
-rw-r--r--include/linux/ioport.h2
-rw-r--r--include/linux/ioprio.h13
-rw-r--r--include/linux/ipmi_smi.h2
-rw-r--r--include/linux/ipv6.h12
-rw-r--r--include/linux/irq.h7
-rw-r--r--include/linux/jbd.h2
-rw-r--r--include/linux/jbd2.h135
-rw-r--r--include/linux/jiffies.h6
-rw-r--r--include/linux/kallsyms.h1
-rw-r--r--include/linux/kd.h2
-rw-r--r--include/linux/kernel.h7
-rw-r--r--include/linux/key.h2
-rw-r--r--include/linux/kobject.h184
-rw-r--r--include/linux/kprobes.h10
-rw-r--r--include/linux/kref.h1
-rw-r--r--include/linux/kvm.h203
-rw-r--r--include/linux/kvm_host.h299
-rw-r--r--include/linux/kvm_para.h82
-rw-r--r--include/linux/kvm_types.h54
-rw-r--r--include/linux/latencytop.h44
-rw-r--r--include/linux/leds.h3
-rw-r--r--include/linux/libata.h250
-rw-r--r--include/linux/linkage.h8
-rw-r--r--include/linux/lockd/bind.h19
-rw-r--r--include/linux/lockd/lockd.h9
-rw-r--r--include/linux/lockd/xdr.h4
-rw-r--r--include/linux/m41t00.h50
-rw-r--r--include/linux/mc146818rtc.h3
-rw-r--r--include/linux/mm.h32
-rw-r--r--include/linux/mmc/host.h4
-rw-r--r--include/linux/module.h45
-rw-r--r--include/linux/moduleparam.h4
-rw-r--r--include/linux/mroute.h12
-rw-r--r--include/linux/mutex.h5
-rw-r--r--include/linux/mv643xx.h10
-rw-r--r--include/linux/mv643xx_eth.h6
-rw-r--r--include/linux/mv643xx_i2c.h22
-rw-r--r--include/linux/net.h19
-rw-r--r--include/linux/netdevice.h32
-rw-r--r--include/linux/netfilter.h165
-rw-r--r--include/linux/netfilter/Kbuild22
-rw-r--r--include/linux/netfilter/nf_conntrack_common.h8
-rw-r--r--include/linux/netfilter/nf_conntrack_h323.h6
-rw-r--r--include/linux/netfilter/nf_conntrack_pptp.h2
-rw-r--r--include/linux/netfilter/nf_conntrack_sctp.h1
-rw-r--r--include/linux/netfilter/nf_conntrack_sip.h6
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h11
-rw-r--r--include/linux/netfilter/nfnetlink_log.h1
-rw-r--r--include/linux/netfilter/x_tables.h86
-rw-r--r--include/linux/netfilter/xt_CONNMARK.h5
-rw-r--r--include/linux/netfilter/xt_DSCP.h5
-rw-r--r--include/linux/netfilter/xt_MARK.h4
-rw-r--r--include/linux/netfilter/xt_RATEEST.h13
-rw-r--r--include/linux/netfilter/xt_TCPOPTSTRIP.h13
-rw-r--r--include/linux/netfilter/xt_connlimit.h11
-rw-r--r--include/linux/netfilter/xt_connmark.h5
-rw-r--r--include/linux/netfilter/xt_conntrack.h38
-rw-r--r--include/linux/netfilter/xt_dscp.h6
-rw-r--r--include/linux/netfilter/xt_hashlimit.h39
-rw-r--r--include/linux/netfilter/xt_iprange.h17
-rw-r--r--include/linux/netfilter/xt_mark.h5
-rw-r--r--include/linux/netfilter/xt_owner.h16
-rw-r--r--include/linux/netfilter/xt_policy.h23
-rw-r--r--include/linux/netfilter/xt_quota.h2
-rw-r--r--include/linux/netfilter/xt_rateest.h35
-rw-r--r--include/linux/netfilter/xt_statistic.h1
-rw-r--r--include/linux/netfilter/xt_string.h2
-rw-r--r--include/linux/netfilter_arp/arp_tables.h55
-rw-r--r--include/linux/netfilter_bridge.h3
-rw-r--r--include/linux/netfilter_ipv4.h2
-rw-r--r--include/linux/netfilter_ipv4/Kbuild28
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h89
-rw-r--r--include/linux/netfilter_ipv4/ipt_CLUSTERIP.h1
-rw-r--r--include/linux/netfilter_ipv4/ipt_addrtype.h14
-rw-r--r--include/linux/netfilter_ipv4/ipt_iprange.h6
-rw-r--r--include/linux/netfilter_ipv6.h3
-rw-r--r--include/linux/netfilter_ipv6/Kbuild2
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h86
-rw-r--r--include/linux/netlink.h7
-rw-r--r--include/linux/netpoll.h9
-rw-r--r--include/linux/nfs_fs.h84
-rw-r--r--include/linux/nfs_fs_sb.h17
-rw-r--r--include/linux/nfs_mount.h2
-rw-r--r--include/linux/nfs_page.h13
-rw-r--r--include/linux/nfs_xdr.h21
-rw-r--r--include/linux/nfsd/Kbuild1
-rw-r--r--include/linux/nfsd/auth.h27
-rw-r--r--include/linux/nfsd/cache.h4
-rw-r--r--include/linux/nfsd/export.h2
-rw-r--r--include/linux/nfsd/nfsd.h5
-rw-r--r--include/linux/nfsd/syscall.h1
-rw-r--r--include/linux/nfsd/xdr.h14
-rw-r--r--include/linux/nfsd/xdr3.h16
-rw-r--r--include/linux/nfsd/xdr4.h2
-rw-r--r--include/linux/nfsd_idmap.h11
-rw-r--r--include/linux/nl80211.h154
-rw-r--r--include/linux/notifier.h6
-rw-r--r--include/linux/of.h12
-rw-r--r--include/linux/of_device.h2
-rw-r--r--include/linux/pagemap.h14
-rw-r--r--include/linux/pata_platform.h9
-rw-r--r--include/linux/pci-acpi.h11
-rw-r--r--include/linux/pci.h383
-rw-r--r--include/linux/pci_hotplug.h2
-rw-r--r--include/linux/pci_ids.h32
-rw-r--r--include/linux/pci_regs.h8
-rw-r--r--include/linux/pcounter.h74
-rw-r--r--include/linux/pda_power.h1
-rw-r--r--include/linux/percpu.h20
-rw-r--r--include/linux/pfkeyv2.h6
-rw-r--r--include/linux/phy.h3
-rw-r--r--include/linux/phy_fixed.h51
-rw-r--r--include/linux/pid_namespace.h23
-rw-r--r--include/linux/pkt_cls.h50
-rw-r--r--include/linux/pkt_sched.h7
-rw-r--r--include/linux/pktcdvd.h2
-rw-r--r--include/linux/platform_device.h2
-rw-r--r--include/linux/pm.h9
-rw-r--r--include/linux/pm_legacy.h6
-rw-r--r--include/linux/pmu.h36
-rw-r--r--include/linux/pnp.h4
-rw-r--r--include/linux/power_supply.h13
-rw-r--r--include/linux/proc_fs.h9
-rw-r--r--include/linux/ptrace.h76
-rw-r--r--include/linux/quicklist.h8
-rw-r--r--include/linux/rcuclassic.h164
-rw-r--r--include/linux/rcupdate.h173
-rw-r--r--include/linux/rcupreempt.h86
-rw-r--r--include/linux/rcupreempt_trace.h99
-rw-r--r--include/linux/regset.h368
-rw-r--r--include/linux/rfkill.h2
-rw-r--r--include/linux/rtc.h5
-rw-r--r--include/linux/rtnetlink.h17
-rw-r--r--include/linux/scatterlist.h191
-rw-r--r--include/linux/sched.h190
-rw-r--r--include/linux/screen_info.h2
-rw-r--r--include/linux/security.h59
-rw-r--r--include/linux/selinux.h47
-rw-r--r--include/linux/seq_file.h13
-rw-r--r--include/linux/serial_core.h2
-rw-r--r--include/linux/skbuff.h19
-rw-r--r--include/linux/slab.h5
-rw-r--r--include/linux/slab_def.h3
-rw-r--r--include/linux/smp.h9
-rw-r--r--include/linux/smp_lock.h14
-rw-r--r--include/linux/snmp.h32
-rw-r--r--include/linux/socket.h3
-rw-r--r--include/linux/spinlock.h6
-rw-r--r--include/linux/spinlock_types.h4
-rw-r--r--include/linux/spinlock_up.h2
-rw-r--r--include/linux/splice.h1
-rw-r--r--include/linux/ssb/ssb.h97
-rw-r--r--include/linux/ssb/ssb_regs.h83
-rw-r--r--include/linux/stacktrace.h3
-rw-r--r--include/linux/string.h12
-rw-r--r--include/linux/sunrpc/cache.h4
-rw-r--r--include/linux/sunrpc/clnt.h15
-rw-r--r--include/linux/sunrpc/debug.h7
-rw-r--r--include/linux/sunrpc/msg_prot.h39
-rw-r--r--include/linux/sunrpc/rpc_rdma.h32
-rw-r--r--include/linux/sunrpc/sched.h59
-rw-r--r--include/linux/sunrpc/svc.h10
-rw-r--r--include/linux/sunrpc/svc_rdma.h262
-rw-r--r--include/linux/sunrpc/svc_xprt.h159
-rw-r--r--include/linux/sunrpc/svcsock.h43
-rw-r--r--include/linux/sunrpc/xdr.h3
-rw-r--r--include/linux/sunrpc/xprt.h14
-rw-r--r--include/linux/sunrpc/xprtsock.h6
-rw-r--r--include/linux/suspend.h59
-rw-r--r--include/linux/suspend_ioctls.h32
-rw-r--r--include/linux/sysctl.h36
-rw-r--r--include/linux/sysdev.h1
-rw-r--r--include/linux/sysfs.h2
-rw-r--r--include/linux/tc_act/Kbuild1
-rw-r--r--include/linux/tcp.h11
-rw-r--r--include/linux/thread_info.h28
-rw-r--r--include/linux/ticable.h44
-rw-r--r--include/linux/tick.h10
-rw-r--r--include/linux/tifm.h2
-rw-r--r--include/linux/time.h1
-rw-r--r--include/linux/timer.h6
-rw-r--r--include/linux/timex.h1
-rw-r--r--include/linux/topology.h5
-rw-r--r--include/linux/tty.h8
-rw-r--r--include/linux/types.h4
-rw-r--r--include/linux/uio_driver.h6
-rw-r--r--include/linux/usb.h211
-rw-r--r--include/linux/usb/Kbuild11
-rw-r--r--include/linux/usb/audio.h14
-rw-r--r--include/linux/usb/cdc.h16
-rw-r--r--include/linux/usb/g_printer.h31
-rw-r--r--include/linux/usb/gadget.h123
-rw-r--r--include/linux/usb/gadgetfs.h27
-rw-r--r--include/linux/usb/iowarrior.h25
-rw-r--r--include/linux/usb/isp116x.h2
-rw-r--r--include/linux/usb/midi.h26
-rw-r--r--include/linux/usb/net2280.h32
-rw-r--r--include/linux/usb/otg.h2
-rw-r--r--include/linux/usb/rndis_host.h274
-rw-r--r--include/linux/usb/serial.h160
-rw-r--r--include/linux/usb/sl811.h6
-rw-r--r--include/linux/usb/usbnet.h214
-rw-r--r--include/linux/usb_usual.h10
-rw-r--r--include/linux/usbdevice_fs.h5
-rw-r--r--include/linux/veth.h12
-rw-r--r--include/linux/virtio_ring.h21
-rw-r--r--include/linux/wait.h52
-rw-r--r--include/linux/wireless.h13
-rw-r--r--include/linux/workqueue.h14
-rw-r--r--include/linux/writeback.h1
-rw-r--r--include/linux/xfrm.h14
302 files changed, 8032 insertions, 3517 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 6a65231bc785..c0f9bb78727d 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -1,4 +1,5 @@
1header-y += byteorder/ 1header-y += byteorder/
2header-y += can/
2header-y += dvb/ 3header-y += dvb/
3header-y += hdlc/ 4header-y += hdlc/
4header-y += isdn/ 5header-y += isdn/
@@ -34,13 +35,13 @@ header-y += atmsap.h
34header-y += atmsvc.h 35header-y += atmsvc.h
35header-y += atm_zatm.h 36header-y += atm_zatm.h
36header-y += auto_fs4.h 37header-y += auto_fs4.h
37header-y += auxvec.h
38header-y += ax25.h 38header-y += ax25.h
39header-y += b1lli.h 39header-y += b1lli.h
40header-y += baycom.h 40header-y += baycom.h
41header-y += bfs_fs.h 41header-y += bfs_fs.h
42header-y += blkpg.h 42header-y += blkpg.h
43header-y += bpqether.h 43header-y += bpqether.h
44header-y += can.h
44header-y += cdk.h 45header-y += cdk.h
45header-y += chio.h 46header-y += chio.h
46header-y += coda_psdev.h 47header-y += coda_psdev.h
@@ -49,6 +50,7 @@ header-y += comstats.h
49header-y += const.h 50header-y += const.h
50header-y += cgroupstats.h 51header-y += cgroupstats.h
51header-y += cycx_cfm.h 52header-y += cycx_cfm.h
53header-y += dlmconstants.h
52header-y += dlm_device.h 54header-y += dlm_device.h
53header-y += dlm_netlink.h 55header-y += dlm_netlink.h
54header-y += dm-ioctl.h 56header-y += dm-ioctl.h
@@ -72,7 +74,7 @@ header-y += gen_stats.h
72header-y += gigaset_dev.h 74header-y += gigaset_dev.h
73header-y += hdsmart.h 75header-y += hdsmart.h
74header-y += hysdn_if.h 76header-y += hysdn_if.h
75header-y += i2c-dev.h 77header-y += i2o-dev.h
76header-y += i8k.h 78header-y += i8k.h
77header-y += if_arcnet.h 79header-y += if_arcnet.h
78header-y += if_bonding.h 80header-y += if_bonding.h
@@ -98,7 +100,6 @@ header-y += iso_fs.h
98header-y += ixjuser.h 100header-y += ixjuser.h
99header-y += jffs2.h 101header-y += jffs2.h
100header-y += keyctl.h 102header-y += keyctl.h
101header-y += kvm.h
102header-y += limits.h 103header-y += limits.h
103header-y += lock_dlm_plock.h 104header-y += lock_dlm_plock.h
104header-y += magic.h 105header-y += magic.h
@@ -142,21 +143,22 @@ header-y += snmp.h
142header-y += sockios.h 143header-y += sockios.h
143header-y += som.h 144header-y += som.h
144header-y += sound.h 145header-y += sound.h
146header-y += suspend_ioctls.h
145header-y += taskstats.h 147header-y += taskstats.h
146header-y += telephony.h 148header-y += telephony.h
147header-y += termios.h 149header-y += termios.h
148header-y += ticable.h
149header-y += times.h 150header-y += times.h
150header-y += tiocl.h 151header-y += tiocl.h
151header-y += tipc.h 152header-y += tipc.h
153header-y += tipc_config.h
152header-y += toshiba.h 154header-y += toshiba.h
153header-y += ultrasound.h 155header-y += ultrasound.h
154header-y += un.h 156header-y += un.h
155header-y += utime.h 157header-y += utime.h
158header-y += veth.h
156header-y += video_decoder.h 159header-y += video_decoder.h
157header-y += video_encoder.h 160header-y += video_encoder.h
158header-y += videotext.h 161header-y += videotext.h
159header-y += vt.h
160header-y += x25.h 162header-y += x25.h
161 163
162unifdef-y += acct.h 164unifdef-y += acct.h
@@ -171,6 +173,7 @@ unifdef-y += atm.h
171unifdef-y += atm_tcp.h 173unifdef-y += atm_tcp.h
172unifdef-y += audit.h 174unifdef-y += audit.h
173unifdef-y += auto_fs.h 175unifdef-y += auto_fs.h
176unifdef-y += auxvec.h
174unifdef-y += binfmts.h 177unifdef-y += binfmts.h
175unifdef-y += capability.h 178unifdef-y += capability.h
176unifdef-y += capi.h 179unifdef-y += capi.h
@@ -212,7 +215,7 @@ unifdef-y += hdreg.h
212unifdef-y += hiddev.h 215unifdef-y += hiddev.h
213unifdef-y += hpet.h 216unifdef-y += hpet.h
214unifdef-y += i2c.h 217unifdef-y += i2c.h
215unifdef-y += i2o-dev.h 218unifdef-y += i2c-dev.h
216unifdef-y += icmp.h 219unifdef-y += icmp.h
217unifdef-y += icmpv6.h 220unifdef-y += icmpv6.h
218unifdef-y += if_addr.h 221unifdef-y += if_addr.h
@@ -227,7 +230,6 @@ unifdef-y += if_ltalk.h
227unifdef-y += if_link.h 230unifdef-y += if_link.h
228unifdef-y += if_pppol2tp.h 231unifdef-y += if_pppol2tp.h
229unifdef-y += if_pppox.h 232unifdef-y += if_pppox.h
230unifdef-y += if_shaper.h
231unifdef-y += if_tr.h 233unifdef-y += if_tr.h
232unifdef-y += if_tun.h 234unifdef-y += if_tun.h
233unifdef-y += if_vlan.h 235unifdef-y += if_vlan.h
@@ -254,6 +256,7 @@ unifdef-y += kd.h
254unifdef-y += kernelcapi.h 256unifdef-y += kernelcapi.h
255unifdef-y += kernel.h 257unifdef-y += kernel.h
256unifdef-y += keyboard.h 258unifdef-y += keyboard.h
259unifdef-$(CONFIG_HAVE_KVM) += kvm.h
257unifdef-y += llc.h 260unifdef-y += llc.h
258unifdef-y += loop.h 261unifdef-y += loop.h
259unifdef-y += lp.h 262unifdef-y += lp.h
@@ -325,6 +328,7 @@ unifdef-y += sonypi.h
325unifdef-y += soundcard.h 328unifdef-y += soundcard.h
326unifdef-y += stat.h 329unifdef-y += stat.h
327unifdef-y += stddef.h 330unifdef-y += stddef.h
331unifdef-y += string.h
328unifdef-y += synclink.h 332unifdef-y += synclink.h
329unifdef-y += sysctl.h 333unifdef-y += sysctl.h
330unifdef-y += tcp.h 334unifdef-y += tcp.h
@@ -346,6 +350,7 @@ unifdef-y += videodev.h
346unifdef-y += virtio_config.h 350unifdef-y += virtio_config.h
347unifdef-y += virtio_blk.h 351unifdef-y += virtio_blk.h
348unifdef-y += virtio_net.h 352unifdef-y += virtio_net.h
353unifdef-y += vt.h
349unifdef-y += wait.h 354unifdef-y += wait.h
350unifdef-y += wanrouter.h 355unifdef-y += wanrouter.h
351unifdef-y += watchdog.h 356unifdef-y += watchdog.h
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 8ccedf7a0a5a..63f2e6ed698f 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -40,6 +40,7 @@
40#include <acpi/acpi_drivers.h> 40#include <acpi/acpi_drivers.h>
41#include <acpi/acpi_numa.h> 41#include <acpi/acpi_numa.h>
42#include <asm/acpi.h> 42#include <asm/acpi.h>
43#include <linux/dmi.h>
43 44
44 45
45#ifdef CONFIG_ACPI 46#ifdef CONFIG_ACPI
@@ -132,6 +133,11 @@ extern unsigned long acpi_realmode_flags;
132int acpi_register_gsi (u32 gsi, int triggering, int polarity); 133int acpi_register_gsi (u32 gsi, int triggering, int polarity);
133int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); 134int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
134 135
136#ifdef CONFIG_X86_IO_APIC
137extern int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity);
138#else
139#define acpi_get_override_irq(bus, trigger, polarity) (-1)
140#endif
135/* 141/*
136 * This function undoes the effect of one call to acpi_register_gsi(). 142 * This function undoes the effect of one call to acpi_register_gsi().
137 * If this matches the last registration, any IRQ resources for gsi 143 * If this matches the last registration, any IRQ resources for gsi
@@ -187,7 +193,9 @@ extern int ec_transaction(u8 command,
187#endif /*CONFIG_ACPI_EC*/ 193#endif /*CONFIG_ACPI_EC*/
188 194
189extern int acpi_blacklisted(void); 195extern int acpi_blacklisted(void);
190extern void acpi_bios_year(char *s); 196#ifdef CONFIG_DMI
197extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d);
198#endif
191 199
192#ifdef CONFIG_ACPI_NUMA 200#ifdef CONFIG_ACPI_NUMA
193int acpi_get_pxm(acpi_handle handle); 201int acpi_get_pxm(acpi_handle handle);
@@ -221,5 +229,5 @@ static inline int acpi_boot_table_init(void)
221 return 0; 229 return 0;
222} 230}
223 231
224#endif /* CONFIG_ACPI */ 232#endif /* !CONFIG_ACPI */
225#endif /*_LINUX_ACPI_H*/ 233#endif /*_LINUX_ACPI_H*/
diff --git a/include/linux/acpi_pmtmr.h b/include/linux/acpi_pmtmr.h
index 1d0ef1ae8036..7e3d2859be50 100644
--- a/include/linux/acpi_pmtmr.h
+++ b/include/linux/acpi_pmtmr.h
@@ -25,6 +25,8 @@ static inline u32 acpi_pm_read_early(void)
25 return acpi_pm_read_verified() & ACPI_PM_MASK; 25 return acpi_pm_read_verified() & ACPI_PM_MASK;
26} 26}
27 27
28extern void pmtimer_wait(unsigned);
29
28#else 30#else
29 31
30static inline u32 acpi_pm_read_early(void) 32static inline u32 acpi_pm_read_early(void)
diff --git a/include/linux/apm_bios.h b/include/linux/apm_bios.h
index 9754baa14921..01a6244c9bc9 100644
--- a/include/linux/apm_bios.h
+++ b/include/linux/apm_bios.h
@@ -18,6 +18,9 @@
18 18
19#include <linux/types.h> 19#include <linux/types.h>
20 20
21typedef unsigned short apm_event_t;
22typedef unsigned short apm_eventinfo_t;
23
21struct apm_bios_info { 24struct apm_bios_info {
22 __u16 version; 25 __u16 version;
23 __u16 cseg; 26 __u16 cseg;
@@ -32,9 +35,6 @@ struct apm_bios_info {
32 35
33#ifdef __KERNEL__ 36#ifdef __KERNEL__
34 37
35typedef unsigned short apm_event_t;
36typedef unsigned short apm_eventinfo_t;
37
38#define APM_CS (GDT_ENTRY_APMBIOS_BASE * 8) 38#define APM_CS (GDT_ENTRY_APMBIOS_BASE * 8)
39#define APM_CS_16 (APM_CS + 8) 39#define APM_CS_16 (APM_CS + 8)
40#define APM_DS (APM_CS_16 + 8) 40#define APM_DS (APM_CS_16 + 8)
diff --git a/include/linux/aspm.h b/include/linux/aspm.h
new file mode 100644
index 000000000000..f41a69895485
--- /dev/null
+++ b/include/linux/aspm.h
@@ -0,0 +1,44 @@
1/*
2 * aspm.h
3 *
4 * PCI Express ASPM defines and function prototypes
5 *
6 * Copyright (C) 2007 Intel Corp.
7 * Zhang Yanmin (yanmin.zhang@intel.com)
8 * Shaohua Li (shaohua.li@intel.com)
9 *
10 * For more information, please consult the following manuals (look at
11 * http://www.pcisig.com/ for how to get them):
12 *
13 * PCI Express Specification
14 */
15
16#ifndef LINUX_ASPM_H
17#define LINUX_ASPM_H
18
19#include <linux/pci.h>
20
21#define PCIE_LINK_STATE_L0S 1
22#define PCIE_LINK_STATE_L1 2
23#define PCIE_LINK_STATE_CLKPM 4
24
25#ifdef CONFIG_PCIEASPM
26extern void pcie_aspm_init_link_state(struct pci_dev *pdev);
27extern void pcie_aspm_exit_link_state(struct pci_dev *pdev);
28extern void pcie_aspm_pm_state_change(struct pci_dev *pdev);
29extern void pci_disable_link_state(struct pci_dev *pdev, int state);
30#else
31#define pcie_aspm_init_link_state(pdev) do {} while (0)
32#define pcie_aspm_exit_link_state(pdev) do {} while (0)
33#define pcie_aspm_pm_state_change(pdev) do {} while (0)
34#define pci_disable_link_state(pdev, state) do {} while (0)
35#endif
36
37#ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */
38extern void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev);
39extern void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev);
40#else
41#define pcie_aspm_create_sysfs_dev_files(pdev) do {} while (0)
42#define pcie_aspm_remove_sysfs_dev_files(pdev) do {} while (0)
43#endif
44#endif /* LINUX_ASPM_H */
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 8263a7b74d34..78bbacaed8c4 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -43,6 +43,7 @@ enum {
43 ATA_MAX_SECTORS_128 = 128, 43 ATA_MAX_SECTORS_128 = 128,
44 ATA_MAX_SECTORS = 256, 44 ATA_MAX_SECTORS = 256,
45 ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */ 45 ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */
46 ATA_MAX_SECTORS_TAPE = 65535,
46 47
47 ATA_ID_WORDS = 256, 48 ATA_ID_WORDS = 256,
48 ATA_ID_SERNO = 10, 49 ATA_ID_SERNO = 10,
@@ -180,6 +181,7 @@ enum {
180 ATA_CMD_VERIFY_EXT = 0x42, 181 ATA_CMD_VERIFY_EXT = 0x42,
181 ATA_CMD_STANDBYNOW1 = 0xE0, 182 ATA_CMD_STANDBYNOW1 = 0xE0,
182 ATA_CMD_IDLEIMMEDIATE = 0xE1, 183 ATA_CMD_IDLEIMMEDIATE = 0xE1,
184 ATA_CMD_SLEEP = 0xE6,
183 ATA_CMD_INIT_DEV_PARAMS = 0x91, 185 ATA_CMD_INIT_DEV_PARAMS = 0x91,
184 ATA_CMD_READ_NATIVE_MAX = 0xF8, 186 ATA_CMD_READ_NATIVE_MAX = 0xF8,
185 ATA_CMD_READ_NATIVE_MAX_EXT = 0x27, 187 ATA_CMD_READ_NATIVE_MAX_EXT = 0x27,
@@ -188,6 +190,8 @@ enum {
188 ATA_CMD_READ_LOG_EXT = 0x2f, 190 ATA_CMD_READ_LOG_EXT = 0x2f,
189 ATA_CMD_PMP_READ = 0xE4, 191 ATA_CMD_PMP_READ = 0xE4,
190 ATA_CMD_PMP_WRITE = 0xE8, 192 ATA_CMD_PMP_WRITE = 0xE8,
193 ATA_CMD_CONF_OVERLAY = 0xB1,
194 ATA_CMD_SEC_FREEZE_LOCK = 0xF5,
191 195
192 /* READ_LOG_EXT pages */ 196 /* READ_LOG_EXT pages */
193 ATA_LOG_SATA_NCQ = 0x10, 197 ATA_LOG_SATA_NCQ = 0x10,
@@ -235,6 +239,20 @@ enum {
235 239
236 /* SETFEATURE Sector counts for SATA features */ 240 /* SETFEATURE Sector counts for SATA features */
237 SATA_AN = 0x05, /* Asynchronous Notification */ 241 SATA_AN = 0x05, /* Asynchronous Notification */
242 SATA_DIPM = 0x03, /* Device Initiated Power Management */
243
244 /* feature values for SET_MAX */
245 ATA_SET_MAX_ADDR = 0x00,
246 ATA_SET_MAX_PASSWD = 0x01,
247 ATA_SET_MAX_LOCK = 0x02,
248 ATA_SET_MAX_UNLOCK = 0x03,
249 ATA_SET_MAX_FREEZE_LOCK = 0x04,
250
251 /* feature values for DEVICE CONFIGURATION OVERLAY */
252 ATA_DCO_RESTORE = 0xC0,
253 ATA_DCO_FREEZE_LOCK = 0xC1,
254 ATA_DCO_IDENTIFY = 0xC2,
255 ATA_DCO_SET = 0xC3,
238 256
239 /* ATAPI stuff */ 257 /* ATAPI stuff */
240 ATAPI_PKT_DMA = (1 << 0), 258 ATAPI_PKT_DMA = (1 << 0),
@@ -268,9 +286,10 @@ enum {
268 ATA_CBL_NONE = 0, 286 ATA_CBL_NONE = 0,
269 ATA_CBL_PATA40 = 1, 287 ATA_CBL_PATA40 = 1,
270 ATA_CBL_PATA80 = 2, 288 ATA_CBL_PATA80 = 2,
271 ATA_CBL_PATA40_SHORT = 3, /* 40 wire cable to high UDMA spec */ 289 ATA_CBL_PATA40_SHORT = 3, /* 40 wire cable to high UDMA spec */
272 ATA_CBL_PATA_UNK = 4, 290 ATA_CBL_PATA_UNK = 4, /* don't know, maybe 80c? */
273 ATA_CBL_SATA = 5, 291 ATA_CBL_PATA_IGN = 5, /* don't know, ignore cable handling */
292 ATA_CBL_SATA = 6,
274 293
275 /* SATA Status and Control Registers */ 294 /* SATA Status and Control Registers */
276 SCR_STATUS = 0, 295 SCR_STATUS = 0,
@@ -306,6 +325,13 @@ enum {
306 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */ 325 ATA_TFLAG_LBA = (1 << 4), /* enable LBA */
307 ATA_TFLAG_FUA = (1 << 5), /* enable FUA */ 326 ATA_TFLAG_FUA = (1 << 5), /* enable FUA */
308 ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */ 327 ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */
328
329 /* protocol flags */
330 ATA_PROT_FLAG_PIO = (1 << 0), /* is PIO */
331 ATA_PROT_FLAG_DMA = (1 << 1), /* is DMA */
332 ATA_PROT_FLAG_DATA = ATA_PROT_FLAG_PIO | ATA_PROT_FLAG_DMA,
333 ATA_PROT_FLAG_NCQ = (1 << 2), /* is NCQ */
334 ATA_PROT_FLAG_ATAPI = (1 << 3), /* is ATAPI */
309}; 335};
310 336
311enum ata_tf_protocols { 337enum ata_tf_protocols {
@@ -315,9 +341,9 @@ enum ata_tf_protocols {
315 ATA_PROT_PIO, /* PIO data xfer */ 341 ATA_PROT_PIO, /* PIO data xfer */
316 ATA_PROT_DMA, /* DMA */ 342 ATA_PROT_DMA, /* DMA */
317 ATA_PROT_NCQ, /* NCQ */ 343 ATA_PROT_NCQ, /* NCQ */
318 ATA_PROT_ATAPI, /* packet command, PIO data xfer*/ 344 ATAPI_PROT_NODATA, /* packet command, no data */
319 ATA_PROT_ATAPI_NODATA, /* packet command, no data */ 345 ATAPI_PROT_PIO, /* packet command, PIO data xfer*/
320 ATA_PROT_ATAPI_DMA, /* packet command with special DMA sauce */ 346 ATAPI_PROT_DMA, /* packet command with special DMA sauce */
321}; 347};
322 348
323enum ata_ioctls { 349enum ata_ioctls {
@@ -328,8 +354,8 @@ enum ata_ioctls {
328/* core structures */ 354/* core structures */
329 355
330struct ata_prd { 356struct ata_prd {
331 u32 addr; 357 __le32 addr;
332 u32 flags_len; 358 __le32 flags_len;
333}; 359};
334 360
335struct ata_taskfile { 361struct ata_taskfile {
@@ -355,13 +381,69 @@ struct ata_taskfile {
355 u8 command; /* IO operation */ 381 u8 command; /* IO operation */
356}; 382};
357 383
384/*
385 * protocol tests
386 */
387static inline unsigned int ata_prot_flags(u8 prot)
388{
389 switch (prot) {
390 case ATA_PROT_NODATA:
391 return 0;
392 case ATA_PROT_PIO:
393 return ATA_PROT_FLAG_PIO;
394 case ATA_PROT_DMA:
395 return ATA_PROT_FLAG_DMA;
396 case ATA_PROT_NCQ:
397 return ATA_PROT_FLAG_DMA | ATA_PROT_FLAG_NCQ;
398 case ATAPI_PROT_NODATA:
399 return ATA_PROT_FLAG_ATAPI;
400 case ATAPI_PROT_PIO:
401 return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_PIO;
402 case ATAPI_PROT_DMA:
403 return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_DMA;
404 }
405 return 0;
406}
407
408static inline int ata_is_atapi(u8 prot)
409{
410 return ata_prot_flags(prot) & ATA_PROT_FLAG_ATAPI;
411}
412
413static inline int ata_is_nodata(u8 prot)
414{
415 return !(ata_prot_flags(prot) & ATA_PROT_FLAG_DATA);
416}
417
418static inline int ata_is_pio(u8 prot)
419{
420 return ata_prot_flags(prot) & ATA_PROT_FLAG_PIO;
421}
422
423static inline int ata_is_dma(u8 prot)
424{
425 return ata_prot_flags(prot) & ATA_PROT_FLAG_DMA;
426}
427
428static inline int ata_is_ncq(u8 prot)
429{
430 return ata_prot_flags(prot) & ATA_PROT_FLAG_NCQ;
431}
432
433static inline int ata_is_data(u8 prot)
434{
435 return ata_prot_flags(prot) & ATA_PROT_FLAG_DATA;
436}
437
438/*
439 * id tests
440 */
358#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) 441#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0)
359#define ata_id_has_lba(id) ((id)[49] & (1 << 9)) 442#define ata_id_has_lba(id) ((id)[49] & (1 << 9))
360#define ata_id_has_dma(id) ((id)[49] & (1 << 8)) 443#define ata_id_has_dma(id) ((id)[49] & (1 << 8))
361#define ata_id_has_ncq(id) ((id)[76] & (1 << 8)) 444#define ata_id_has_ncq(id) ((id)[76] & (1 << 8))
362#define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1) 445#define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1)
363#define ata_id_removeable(id) ((id)[0] & (1 << 7)) 446#define ata_id_removeable(id) ((id)[0] & (1 << 7))
364#define ata_id_has_dword_io(id) ((id)[48] & (1 << 0))
365#define ata_id_has_atapi_AN(id) \ 447#define ata_id_has_atapi_AN(id) \
366 ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \ 448 ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \
367 ((id)[78] & (1 << 5)) ) 449 ((id)[78] & (1 << 5)) )
@@ -377,6 +459,27 @@ struct ata_taskfile {
377 459
378#define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20) 460#define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20)
379 461
462static inline bool ata_id_has_hipm(const u16 *id)
463{
464 u16 val = id[76];
465
466 if (val == 0 || val == 0xffff)
467 return false;
468
469 return val & (1 << 9);
470}
471
472static inline bool ata_id_has_dipm(const u16 *id)
473{
474 u16 val = id[78];
475
476 if (val == 0 || val == 0xffff)
477 return false;
478
479 return val & (1 << 3);
480}
481
482
380static inline int ata_id_has_fua(const u16 *id) 483static inline int ata_id_has_fua(const u16 *id)
381{ 484{
382 if ((id[84] & 0xC000) != 0x4000) 485 if ((id[84] & 0xC000) != 0x4000)
@@ -402,6 +505,8 @@ static inline int ata_id_has_lba48(const u16 *id)
402{ 505{
403 if ((id[83] & 0xC000) != 0x4000) 506 if ((id[83] & 0xC000) != 0x4000)
404 return 0; 507 return 0;
508 if (!ata_id_u64(id, 100))
509 return 0;
405 return id[83] & (1 << 10); 510 return id[83] & (1 << 10);
406} 511}
407 512
@@ -479,6 +584,26 @@ static inline int ata_id_is_sata(const u16 *id)
479 return ata_id_major_version(id) >= 5 && id[93] == 0; 584 return ata_id_major_version(id) >= 5 && id[93] == 0;
480} 585}
481 586
587static inline int ata_id_has_tpm(const u16 *id)
588{
589 /* The TPM bits are only valid on ATA8 */
590 if (ata_id_major_version(id) < 8)
591 return 0;
592 if ((id[48] & 0xC000) != 0x4000)
593 return 0;
594 return id[48] & (1 << 0);
595}
596
597static inline int ata_id_has_dword_io(const u16 *id)
598{
599 /* ATA 8 reuses this flag for "trusted" computing */
600 if (ata_id_major_version(id) > 7)
601 return 0;
602 if (id[48] & (1 << 0))
603 return 1;
604 return 0;
605}
606
482static inline int ata_id_current_chs_valid(const u16 *id) 607static inline int ata_id_current_chs_valid(const u16 *id)
483{ 608{
484 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command 609 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
@@ -512,6 +637,13 @@ static inline int ata_drive_40wire(const u16 *dev_id)
512 return 1; 637 return 1;
513} 638}
514 639
640static inline int ata_drive_40wire_relaxed(const u16 *dev_id)
641{
642 if ((dev_id[93] & 0x2000) == 0x2000)
643 return 0; /* 80 wire */
644 return 1;
645}
646
515static inline int atapi_cdb_len(const u16 *dev_id) 647static inline int atapi_cdb_len(const u16 *dev_id)
516{ 648{
517 u16 tmp = dev_id[0] & 0x3; 649 u16 tmp = dev_id[0] & 0x3;
@@ -522,11 +654,9 @@ static inline int atapi_cdb_len(const u16 *dev_id)
522 } 654 }
523} 655}
524 656
525static inline int is_atapi_taskfile(const struct ata_taskfile *tf) 657static inline int atapi_command_packet_set(const u16 *dev_id)
526{ 658{
527 return (tf->protocol == ATA_PROT_ATAPI) || 659 return (dev_id[0] >> 8) & 0x1f;
528 (tf->protocol == ATA_PROT_ATAPI_NODATA) ||
529 (tf->protocol == ATA_PROT_ATAPI_DMA);
530} 660}
531 661
532static inline int is_multi_taskfile(struct ata_taskfile *tf) 662static inline int is_multi_taskfile(struct ata_taskfile *tf)
diff --git a/include/linux/atmbr2684.h b/include/linux/atmbr2684.h
index 969fb6c9e1cc..52bf72affbba 100644
--- a/include/linux/atmbr2684.h
+++ b/include/linux/atmbr2684.h
@@ -14,6 +14,9 @@
14#define BR2684_MEDIA_FDDI (3) 14#define BR2684_MEDIA_FDDI (3)
15#define BR2684_MEDIA_802_6 (4) /* 802.6 */ 15#define BR2684_MEDIA_802_6 (4) /* 802.6 */
16 16
17 /* used only at device creation: */
18#define BR2684_FLAG_ROUTED (1<<16) /* payload is routed, not bridged */
19
17/* 20/*
18 * Is there FCS inbound on this VC? This currently isn't supported. 21 * Is there FCS inbound on this VC? This currently isn't supported.
19 */ 22 */
@@ -36,15 +39,22 @@
36#define BR2684_ENCAPS_AUTODETECT (2) /* Unsuported */ 39#define BR2684_ENCAPS_AUTODETECT (2) /* Unsuported */
37 40
38/* 41/*
42 * Is this VC bridged or routed?
43 */
44
45#define BR2684_PAYLOAD_ROUTED (0)
46#define BR2684_PAYLOAD_BRIDGED (1)
47
48/*
39 * This is for the ATM_NEWBACKENDIF call - these are like socket families: 49 * This is for the ATM_NEWBACKENDIF call - these are like socket families:
40 * the first element of the structure is the backend number and the rest 50 * the first element of the structure is the backend number and the rest
41 * is per-backend specific 51 * is per-backend specific
42 */ 52 */
43struct atm_newif_br2684 { 53struct atm_newif_br2684 {
44 atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ 54 atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */
45 int media; /* BR2684_MEDIA_* */ 55 int media; /* BR2684_MEDIA_*, flags in upper bits */
46 char ifname[IFNAMSIZ]; 56 char ifname[IFNAMSIZ];
47 int mtu; 57 int mtu;
48}; 58};
49 59
50/* 60/*
@@ -55,10 +65,10 @@ struct atm_newif_br2684 {
55#define BR2684_FIND_BYNUM (1) 65#define BR2684_FIND_BYNUM (1)
56#define BR2684_FIND_BYIFNAME (2) 66#define BR2684_FIND_BYIFNAME (2)
57struct br2684_if_spec { 67struct br2684_if_spec {
58 int method; /* BR2684_FIND_* */ 68 int method; /* BR2684_FIND_* */
59 union { 69 union {
60 char ifname[IFNAMSIZ]; 70 char ifname[IFNAMSIZ];
61 int devnum; 71 int devnum;
62 } spec; 72 } spec;
63}; 73};
64 74
@@ -68,16 +78,16 @@ struct br2684_if_spec {
68 * is per-backend specific 78 * is per-backend specific
69 */ 79 */
70struct atm_backend_br2684 { 80struct atm_backend_br2684 {
71 atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ 81 atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */
72 struct br2684_if_spec ifspec; 82 struct br2684_if_spec ifspec;
73 int fcs_in; /* BR2684_FCSIN_* */ 83 int fcs_in; /* BR2684_FCSIN_* */
74 int fcs_out; /* BR2684_FCSOUT_* */ 84 int fcs_out; /* BR2684_FCSOUT_* */
75 int fcs_auto; /* 1: fcs_{in,out} disabled if no FCS rx'ed */ 85 int fcs_auto; /* 1: fcs_{in,out} disabled if no FCS rx'ed */
76 int encaps; /* BR2684_ENCAPS_* */ 86 int encaps; /* BR2684_ENCAPS_* */
77 int has_vpiid; /* 1: use vpn_id - Unsupported */ 87 int has_vpiid; /* 1: use vpn_id - Unsupported */
78 __u8 vpn_id[7]; 88 __u8 vpn_id[7];
79 int send_padding; /* unsupported */ 89 int send_padding; /* unsupported */
80 int min_size; /* we will pad smaller packets than this */ 90 int min_size; /* we will pad smaller packets than this */
81}; 91};
82 92
83/* 93/*
@@ -86,8 +96,8 @@ struct atm_backend_br2684 {
86 * efficient per-if in/out filters, this support will be removed 96 * efficient per-if in/out filters, this support will be removed
87 */ 97 */
88struct br2684_filter { 98struct br2684_filter {
89 __be32 prefix; /* network byte order */ 99 __be32 prefix; /* network byte order */
90 __be32 netmask; /* 0 = disable filter */ 100 __be32 netmask; /* 0 = disable filter */
91}; 101};
92 102
93struct br2684_filter_set { 103struct br2684_filter_set {
@@ -95,6 +105,11 @@ struct br2684_filter_set {
95 struct br2684_filter filter; 105 struct br2684_filter filter;
96}; 106};
97 107
108enum br2684_payload {
109 p_routed = BR2684_PAYLOAD_ROUTED,
110 p_bridged = BR2684_PAYLOAD_BRIDGED,
111};
112
98#define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \ 113#define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \
99 struct br2684_filter_set) 114 struct br2684_filter_set)
100 115
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 2096e5c72827..a3d07c29d16c 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -359,7 +359,7 @@ struct atm_dev {
359 struct proc_dir_entry *proc_entry; /* proc entry */ 359 struct proc_dir_entry *proc_entry; /* proc entry */
360 char *proc_name; /* proc entry name */ 360 char *proc_name; /* proc entry name */
361#endif 361#endif
362 struct class_device class_dev; /* sysfs class device */ 362 struct device class_dev; /* sysfs device */
363 struct list_head dev_list; /* linkage */ 363 struct list_head dev_list; /* linkage */
364}; 364};
365 365
@@ -461,7 +461,7 @@ static inline void atm_dev_put(struct atm_dev *dev)
461 BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags)); 461 BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags));
462 if (dev->ops->dev_close) 462 if (dev->ops->dev_close)
463 dev->ops->dev_close(dev); 463 dev->ops->dev_close(dev);
464 class_device_put(&dev->class_dev); 464 put_device(&dev->class_dev);
465 } 465 }
466} 466}
467 467
diff --git a/include/linux/attribute_container.h b/include/linux/attribute_container.h
index 8ff274933948..f5582332af04 100644
--- a/include/linux/attribute_container.h
+++ b/include/linux/attribute_container.h
@@ -17,6 +17,7 @@ struct attribute_container {
17 struct list_head node; 17 struct list_head node;
18 struct klist containers; 18 struct klist containers;
19 struct class *class; 19 struct class *class;
20 struct attribute_group *grp;
20 struct class_device_attribute **attrs; 21 struct class_device_attribute **attrs;
21 int (*match)(struct attribute_container *, struct device *); 22 int (*match)(struct attribute_container *, struct device *);
22#define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01 23#define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01
diff --git a/include/linux/audit.h b/include/linux/audit.h
index c68781692838..97153027207a 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -98,6 +98,7 @@
98#define AUDIT_FD_PAIR 1317 /* audit record for pipe/socketpair */ 98#define AUDIT_FD_PAIR 1317 /* audit record for pipe/socketpair */
99#define AUDIT_OBJ_PID 1318 /* ptrace target */ 99#define AUDIT_OBJ_PID 1318 /* ptrace target */
100#define AUDIT_TTY 1319 /* Input on an administrative TTY */ 100#define AUDIT_TTY 1319 /* Input on an administrative TTY */
101#define AUDIT_EOE 1320 /* End of multi-record event */
101 102
102#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ 103#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
103#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ 104#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
@@ -115,6 +116,8 @@
115#define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Not used */ 116#define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Not used */
116#define AUDIT_MAC_IPSEC_DELSPD 1414 /* Not used */ 117#define AUDIT_MAC_IPSEC_DELSPD 1414 /* Not used */
117#define AUDIT_MAC_IPSEC_EVENT 1415 /* Audit an IPSec event */ 118#define AUDIT_MAC_IPSEC_EVENT 1415 /* Audit an IPSec event */
119#define AUDIT_MAC_UNLBL_STCADD 1416 /* NetLabel: add a static label */
120#define AUDIT_MAC_UNLBL_STCDEL 1417 /* NetLabel: del a static label */
118 121
119#define AUDIT_FIRST_KERN_ANOM_MSG 1700 122#define AUDIT_FIRST_KERN_ANOM_MSG 1700
120#define AUDIT_LAST_KERN_ANOM_MSG 1799 123#define AUDIT_LAST_KERN_ANOM_MSG 1799
@@ -407,7 +410,8 @@ extern unsigned int audit_serial(void);
407extern void auditsc_get_stamp(struct audit_context *ctx, 410extern void auditsc_get_stamp(struct audit_context *ctx,
408 struct timespec *t, unsigned int *serial); 411 struct timespec *t, unsigned int *serial);
409extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid); 412extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
410extern uid_t audit_get_loginuid(struct audit_context *ctx); 413#define audit_get_loginuid(t) ((t)->loginuid)
414#define audit_get_sessionid(t) ((t)->sessionid)
411extern void audit_log_task_context(struct audit_buffer *ab); 415extern void audit_log_task_context(struct audit_buffer *ab);
412extern int __audit_ipc_obj(struct kern_ipc_perm *ipcp); 416extern int __audit_ipc_obj(struct kern_ipc_perm *ipcp);
413extern int __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode); 417extern int __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode);
@@ -486,7 +490,8 @@ extern int audit_signals;
486#define audit_inode_child(d,i,p) do { ; } while (0) 490#define audit_inode_child(d,i,p) do { ; } while (0)
487#define audit_core_dumps(i) do { ; } while (0) 491#define audit_core_dumps(i) do { ; } while (0)
488#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0) 492#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0)
489#define audit_get_loginuid(c) ({ -1; }) 493#define audit_get_loginuid(t) (-1)
494#define audit_get_sessionid(t) (-1)
490#define audit_log_task_context(b) do { ; } while (0) 495#define audit_log_task_context(b) do { ; } while (0)
491#define audit_ipc_obj(i) ({ 0; }) 496#define audit_ipc_obj(i) ({ 0; })
492#define audit_ipc_set_perm(q,u,g,m) ({ 0; }) 497#define audit_ipc_set_perm(q,u,g,m) ({ 0; })
@@ -520,9 +525,11 @@ extern void audit_log_end(struct audit_buffer *ab);
520extern void audit_log_hex(struct audit_buffer *ab, 525extern void audit_log_hex(struct audit_buffer *ab,
521 const unsigned char *buf, 526 const unsigned char *buf,
522 size_t len); 527 size_t len);
523extern const char * audit_log_untrustedstring(struct audit_buffer *ab, 528extern int audit_string_contains_control(const char *string,
529 size_t len);
530extern void audit_log_untrustedstring(struct audit_buffer *ab,
524 const char *string); 531 const char *string);
525extern const char * audit_log_n_untrustedstring(struct audit_buffer *ab, 532extern void audit_log_n_untrustedstring(struct audit_buffer *ab,
526 size_t n, 533 size_t n,
527 const char *string); 534 const char *string);
528extern void audit_log_d_path(struct audit_buffer *ab, 535extern void audit_log_d_path(struct audit_buffer *ab,
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index bbf906a0b419..90392a9d7a9c 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -34,85 +34,11 @@ struct sg_io_hdr;
34#define BLKDEV_MIN_RQ 4 34#define BLKDEV_MIN_RQ 4
35#define BLKDEV_MAX_RQ 128 /* Default maximum */ 35#define BLKDEV_MAX_RQ 128 /* Default maximum */
36 36
37/* 37int put_io_context(struct io_context *ioc);
38 * This is the per-process anticipatory I/O scheduler state.
39 */
40struct as_io_context {
41 spinlock_t lock;
42
43 void (*dtor)(struct as_io_context *aic); /* destructor */
44 void (*exit)(struct as_io_context *aic); /* called on task exit */
45
46 unsigned long state;
47 atomic_t nr_queued; /* queued reads & sync writes */
48 atomic_t nr_dispatched; /* number of requests gone to the drivers */
49
50 /* IO History tracking */
51 /* Thinktime */
52 unsigned long last_end_request;
53 unsigned long ttime_total;
54 unsigned long ttime_samples;
55 unsigned long ttime_mean;
56 /* Layout pattern */
57 unsigned int seek_samples;
58 sector_t last_request_pos;
59 u64 seek_total;
60 sector_t seek_mean;
61};
62
63struct cfq_queue;
64struct cfq_io_context {
65 struct rb_node rb_node;
66 void *key;
67
68 struct cfq_queue *cfqq[2];
69
70 struct io_context *ioc;
71
72 unsigned long last_end_request;
73 sector_t last_request_pos;
74
75 unsigned long ttime_total;
76 unsigned long ttime_samples;
77 unsigned long ttime_mean;
78
79 unsigned int seek_samples;
80 u64 seek_total;
81 sector_t seek_mean;
82
83 struct list_head queue_list;
84
85 void (*dtor)(struct io_context *); /* destructor */
86 void (*exit)(struct io_context *); /* called on task exit */
87};
88
89/*
90 * This is the per-process I/O subsystem state. It is refcounted and
91 * kmalloc'ed. Currently all fields are modified in process io context
92 * (apart from the atomic refcount), so require no locking.
93 */
94struct io_context {
95 atomic_t refcount;
96 struct task_struct *task;
97
98 unsigned int ioprio_changed;
99
100 /*
101 * For request batching
102 */
103 unsigned long last_waited; /* Time last woken after wait for request */
104 int nr_batch_requests; /* Number of requests left in the batch */
105
106 struct as_io_context *aic;
107 struct rb_root cic_root;
108 void *ioc_data;
109};
110
111void put_io_context(struct io_context *ioc);
112void exit_io_context(void); 38void exit_io_context(void);
113struct io_context *get_io_context(gfp_t gfp_flags, int node); 39struct io_context *get_io_context(gfp_t gfp_flags, int node);
40struct io_context *alloc_io_context(gfp_t gfp_flags, int node);
114void copy_io_context(struct io_context **pdst, struct io_context **psrc); 41void copy_io_context(struct io_context **pdst, struct io_context **psrc);
115void swap_io_context(struct io_context **ioc1, struct io_context **ioc2);
116 42
117struct request; 43struct request;
118typedef void (rq_end_io_fn)(struct request *, int); 44typedef void (rq_end_io_fn)(struct request *, int);
@@ -143,8 +69,6 @@ enum rq_cmd_type_bits {
143 * use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver 69 * use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver
144 * private REQ_LB opcodes to differentiate what type of request this is 70 * private REQ_LB opcodes to differentiate what type of request this is
145 */ 71 */
146 REQ_TYPE_ATA_CMD,
147 REQ_TYPE_ATA_TASK,
148 REQ_TYPE_ATA_TASKFILE, 72 REQ_TYPE_ATA_TASKFILE,
149 REQ_TYPE_ATA_PC, 73 REQ_TYPE_ATA_PC,
150}; 74};
@@ -341,7 +265,6 @@ enum blk_queue_state {
341struct blk_queue_tag { 265struct blk_queue_tag {
342 struct request **tag_index; /* map of busy tags */ 266 struct request **tag_index; /* map of busy tags */
343 unsigned long *tag_map; /* bit map of free/busy tags */ 267 unsigned long *tag_map; /* bit map of free/busy tags */
344 struct list_head busy_list; /* fifo list of busy tags */
345 int busy; /* current depth */ 268 int busy; /* current depth */
346 int max_depth; /* what we will send to device */ 269 int max_depth; /* what we will send to device */
347 int real_max_depth; /* what the array can hold */ 270 int real_max_depth; /* what the array can hold */
@@ -432,9 +355,12 @@ struct request_queue
432 unsigned int max_segment_size; 355 unsigned int max_segment_size;
433 356
434 unsigned long seg_boundary_mask; 357 unsigned long seg_boundary_mask;
358 void *dma_drain_buffer;
359 unsigned int dma_drain_size;
435 unsigned int dma_alignment; 360 unsigned int dma_alignment;
436 361
437 struct blk_queue_tag *queue_tags; 362 struct blk_queue_tag *queue_tags;
363 struct list_head tag_busy_list;
438 364
439 unsigned int nr_sorted; 365 unsigned int nr_sorted;
440 unsigned int in_flight; 366 unsigned int in_flight;
@@ -539,6 +465,8 @@ enum {
539#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA) 465#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA)
540#define blk_bidi_rq(rq) ((rq)->next_rq != NULL) 466#define blk_bidi_rq(rq) ((rq)->next_rq != NULL)
541#define blk_empty_barrier(rq) (blk_barrier_rq(rq) && blk_fs_request(rq) && !(rq)->hard_nr_sectors) 467#define blk_empty_barrier(rq) (blk_barrier_rq(rq) && blk_fs_request(rq) && !(rq)->hard_nr_sectors)
468/* rq->queuelist of dequeued request must be list_empty() */
469#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist))
542 470
543#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist) 471#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist)
544 472
@@ -697,6 +625,7 @@ extern int blk_execute_rq(struct request_queue *, struct gendisk *,
697extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, 625extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
698 struct request *, int, rq_end_io_fn *); 626 struct request *, int, rq_end_io_fn *);
699extern int blk_verify_command(unsigned char *, int); 627extern int blk_verify_command(unsigned char *, int);
628extern void blk_unplug(struct request_queue *q);
700 629
701static inline struct request_queue *bdev_get_queue(struct block_device *bdev) 630static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
702{ 631{
@@ -717,29 +646,35 @@ static inline void blk_run_address_space(struct address_space *mapping)
717} 646}
718 647
719/* 648/*
720 * end_request() and friends. Must be called with the request queue spinlock 649 * blk_end_request() and friends.
721 * acquired. All functions called within end_request() _must_be_ atomic. 650 * __blk_end_request() and end_request() must be called with
651 * the request queue spinlock acquired.
722 * 652 *
723 * Several drivers define their own end_request and call 653 * Several drivers define their own end_request and call
724 * end_that_request_first() and end_that_request_last() 654 * blk_end_request() for parts of the original function.
725 * for parts of the original function. This prevents 655 * This prevents code duplication in drivers.
726 * code duplication in drivers.
727 */ 656 */
728extern int end_that_request_first(struct request *, int, int); 657extern int blk_end_request(struct request *rq, int error,
729extern int end_that_request_chunk(struct request *, int, int); 658 unsigned int nr_bytes);
730extern void end_that_request_last(struct request *, int); 659extern int __blk_end_request(struct request *rq, int error,
660 unsigned int nr_bytes);
661extern int blk_end_bidi_request(struct request *rq, int error,
662 unsigned int nr_bytes, unsigned int bidi_bytes);
731extern void end_request(struct request *, int); 663extern void end_request(struct request *, int);
732extern void end_queued_request(struct request *, int); 664extern void end_queued_request(struct request *, int);
733extern void end_dequeued_request(struct request *, int); 665extern void end_dequeued_request(struct request *, int);
666extern int blk_end_request_callback(struct request *rq, int error,
667 unsigned int nr_bytes,
668 int (drv_callback)(struct request *));
734extern void blk_complete_request(struct request *); 669extern void blk_complete_request(struct request *);
735 670
736/* 671/*
737 * end_that_request_first/chunk() takes an uptodate argument. we account 672 * blk_end_request() takes bytes instead of sectors as a complete size.
738 * any value <= as an io error. 0 means -EIO for compatability reasons, 673 * blk_rq_bytes() returns bytes left to complete in the entire request.
739 * any other < 0 value is the direct error type. An uptodate value of 674 * blk_rq_cur_bytes() returns bytes left to complete in the current segment.
740 * 1 indicates successful io completion
741 */ 675 */
742#define end_io_error(uptodate) (unlikely((uptodate) <= 0)) 676extern unsigned int blk_rq_bytes(struct request *rq);
677extern unsigned int blk_rq_cur_bytes(struct request *rq);
743 678
744static inline void blkdev_dequeue_request(struct request *req) 679static inline void blkdev_dequeue_request(struct request *req)
745{ 680{
@@ -761,10 +696,13 @@ extern void blk_queue_max_hw_segments(struct request_queue *, unsigned short);
761extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); 696extern void blk_queue_max_segment_size(struct request_queue *, unsigned int);
762extern void blk_queue_hardsect_size(struct request_queue *, unsigned short); 697extern void blk_queue_hardsect_size(struct request_queue *, unsigned short);
763extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); 698extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b);
699extern int blk_queue_dma_drain(struct request_queue *q, void *buf,
700 unsigned int size);
764extern void blk_queue_segment_boundary(struct request_queue *, unsigned long); 701extern void blk_queue_segment_boundary(struct request_queue *, unsigned long);
765extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn); 702extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn);
766extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *); 703extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *);
767extern void blk_queue_dma_alignment(struct request_queue *, int); 704extern void blk_queue_dma_alignment(struct request_queue *, int);
705extern void blk_queue_update_dma_alignment(struct request_queue *, int);
768extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *); 706extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *);
769extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); 707extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
770extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *); 708extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *);
@@ -836,12 +774,7 @@ static inline int bdev_hardsect_size(struct block_device *bdev)
836 774
837static inline int queue_dma_alignment(struct request_queue *q) 775static inline int queue_dma_alignment(struct request_queue *q)
838{ 776{
839 int retval = 511; 777 return q ? q->dma_alignment : 511;
840
841 if (q && q->dma_alignment)
842 retval = q->dma_alignment;
843
844 return retval;
845} 778}
846 779
847/* assumes size > 256 */ 780/* assumes size > 256 */
@@ -894,6 +827,13 @@ static inline void exit_io_context(void)
894{ 827{
895} 828}
896 829
830struct io_context;
831static inline int put_io_context(struct io_context *ioc)
832{
833 return 1;
834}
835
836
897#endif /* CONFIG_BLOCK */ 837#endif /* CONFIG_BLOCK */
898 838
899#endif 839#endif
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 7e11d23ac36a..cfc3147e5cf9 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -148,7 +148,7 @@ extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *);
148extern void blk_trace_shutdown(struct request_queue *); 148extern void blk_trace_shutdown(struct request_queue *);
149extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *); 149extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *);
150extern int do_blk_trace_setup(struct request_queue *q, 150extern int do_blk_trace_setup(struct request_queue *q,
151 struct block_device *bdev, struct blk_user_trace_setup *buts); 151 char *name, dev_t dev, struct blk_user_trace_setup *buts);
152 152
153 153
154/** 154/**
@@ -282,6 +282,11 @@ static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
282 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r); 282 __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r);
283} 283}
284 284
285extern int blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
286 char __user *arg);
287extern int blk_trace_startstop(struct request_queue *q, int start);
288extern int blk_trace_remove(struct request_queue *q);
289
285#else /* !CONFIG_BLK_DEV_IO_TRACE */ 290#else /* !CONFIG_BLK_DEV_IO_TRACE */
286#define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY) 291#define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY)
287#define blk_trace_shutdown(q) do { } while (0) 292#define blk_trace_shutdown(q) do { } while (0)
@@ -290,7 +295,10 @@ static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
290#define blk_add_trace_generic(q, rq, rw, what) do { } while (0) 295#define blk_add_trace_generic(q, rq, rw, what) do { } while (0)
291#define blk_add_trace_pdu_int(q, what, bio, pdu) do { } while (0) 296#define blk_add_trace_pdu_int(q, what, bio, pdu) do { } while (0)
292#define blk_add_trace_remap(q, bio, dev, f, t) do {} while (0) 297#define blk_add_trace_remap(q, bio, dev, f, t) do {} while (0)
293#define do_blk_trace_setup(q, bdev, buts) (-ENOTTY) 298#define do_blk_trace_setup(q, name, dev, buts) (-ENOTTY)
299#define blk_trace_setup(q, name, dev, arg) (-ENOTTY)
300#define blk_trace_startstop(q, start) (-ENOTTY)
301#define blk_trace_remove(q) (-ENOTTY)
294#endif /* CONFIG_BLK_DEV_IO_TRACE */ 302#endif /* CONFIG_BLK_DEV_IO_TRACE */
295#endif /* __KERNEL__ */ 303#endif /* __KERNEL__ */
296#endif 304#endif
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index c83534ee1e79..0365ec9fc0c9 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -59,7 +59,6 @@ extern void *__alloc_bootmem_core(struct bootmem_data *bdata,
59 unsigned long align, 59 unsigned long align,
60 unsigned long goal, 60 unsigned long goal,
61 unsigned long limit); 61 unsigned long limit);
62extern void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size);
63 62
64#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 63#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
65extern void reserve_bootmem(unsigned long addr, unsigned long size); 64extern void reserve_bootmem(unsigned long addr, unsigned long size);
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index da0d83fbadc0..e98801f06dcc 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -192,6 +192,8 @@ int sync_dirty_buffer(struct buffer_head *bh);
192int submit_bh(int, struct buffer_head *); 192int submit_bh(int, struct buffer_head *);
193void write_boundary_block(struct block_device *bdev, 193void write_boundary_block(struct block_device *bdev,
194 sector_t bblock, unsigned blocksize); 194 sector_t bblock, unsigned blocksize);
195int bh_uptodate_or_lock(struct buffer_head *bh);
196int bh_submit_read(struct buffer_head *bh);
195 197
196extern int buffer_heads_over_limit; 198extern int buffer_heads_over_limit;
197 199
diff --git a/include/linux/can.h b/include/linux/can.h
new file mode 100644
index 000000000000..d18333302cbd
--- /dev/null
+++ b/include/linux/can.h
@@ -0,0 +1,111 @@
1/*
2 * linux/can.h
3 *
4 * Definitions for CAN network layer (socket addr / CAN frame / CAN filter)
5 *
6 * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
7 * Urs Thuermann <urs.thuermann@volkswagen.de>
8 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
9 * All rights reserved.
10 *
11 * Send feedback to <socketcan-users@lists.berlios.de>
12 *
13 */
14
15#ifndef CAN_H
16#define CAN_H
17
18#include <linux/types.h>
19#include <linux/socket.h>
20
21/* controller area network (CAN) kernel definitions */
22
23/* special address description flags for the CAN_ID */
24#define CAN_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */
25#define CAN_RTR_FLAG 0x40000000U /* remote transmission request */
26#define CAN_ERR_FLAG 0x20000000U /* error frame */
27
28/* valid bits in CAN ID for frame formats */
29#define CAN_SFF_MASK 0x000007FFU /* standard frame format (SFF) */
30#define CAN_EFF_MASK 0x1FFFFFFFU /* extended frame format (EFF) */
31#define CAN_ERR_MASK 0x1FFFFFFFU /* omit EFF, RTR, ERR flags */
32
33/*
34 * Controller Area Network Identifier structure
35 *
36 * bit 0-28 : CAN identifier (11/29 bit)
37 * bit 29 : error frame flag (0 = data frame, 1 = error frame)
38 * bit 30 : remote transmission request flag (1 = rtr frame)
39 * bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit)
40 */
41typedef __u32 canid_t;
42
43/*
44 * Controller Area Network Error Frame Mask structure
45 *
46 * bit 0-28 : error class mask (see include/linux/can/error.h)
47 * bit 29-31 : set to zero
48 */
49typedef __u32 can_err_mask_t;
50
51/**
52 * struct can_frame - basic CAN frame structure
53 * @can_id: the CAN ID of the frame and CAN_*_FLAG flags, see above.
54 * @can_dlc: the data length field of the CAN frame
55 * @data: the CAN frame payload.
56 */
57struct can_frame {
58 canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */
59 __u8 can_dlc; /* data length code: 0 .. 8 */
60 __u8 data[8] __attribute__((aligned(8)));
61};
62
63/* particular protocols of the protocol family PF_CAN */
64#define CAN_RAW 1 /* RAW sockets */
65#define CAN_BCM 2 /* Broadcast Manager */
66#define CAN_TP16 3 /* VAG Transport Protocol v1.6 */
67#define CAN_TP20 4 /* VAG Transport Protocol v2.0 */
68#define CAN_MCNET 5 /* Bosch MCNet */
69#define CAN_ISOTP 6 /* ISO 15765-2 Transport Protocol */
70#define CAN_NPROTO 7
71
72#define SOL_CAN_BASE 100
73
74/**
75 * struct sockaddr_can - the sockaddr structure for CAN sockets
76 * @can_family: address family number AF_CAN.
77 * @can_ifindex: CAN network interface index.
78 * @can_addr: protocol specific address information
79 */
80struct sockaddr_can {
81 sa_family_t can_family;
82 int can_ifindex;
83 union {
84 /* transport protocol class address information (e.g. ISOTP) */
85 struct { canid_t rx_id, tx_id; } tp;
86
87 /* reserved for future CAN protocols address information */
88 } can_addr;
89};
90
91/**
92 * struct can_filter - CAN ID based filter in can_register().
93 * @can_id: relevant bits of CAN ID which are not masked out.
94 * @can_mask: CAN mask (see description)
95 *
96 * Description:
97 * A filter matches, when
98 *
99 * <received_can_id> & mask == can_id & mask
100 *
101 * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can
102 * filter for error frames (CAN_ERR_FLAG bit set in mask).
103 */
104struct can_filter {
105 canid_t can_id;
106 canid_t can_mask;
107};
108
109#define CAN_INV_FILTER 0x20000000U /* to be set in can_filter.can_id */
110
111#endif /* CAN_H */
diff --git a/include/linux/can/Kbuild b/include/linux/can/Kbuild
new file mode 100644
index 000000000000..eff898aac02b
--- /dev/null
+++ b/include/linux/can/Kbuild
@@ -0,0 +1,3 @@
1header-y += raw.h
2header-y += bcm.h
3header-y += error.h
diff --git a/include/linux/can/bcm.h b/include/linux/can/bcm.h
new file mode 100644
index 000000000000..7f293273c444
--- /dev/null
+++ b/include/linux/can/bcm.h
@@ -0,0 +1,65 @@
1/*
2 * linux/can/bcm.h
3 *
4 * Definitions for CAN Broadcast Manager (BCM)
5 *
6 * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
7 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
8 * All rights reserved.
9 *
10 * Send feedback to <socketcan-users@lists.berlios.de>
11 *
12 */
13
14#ifndef CAN_BCM_H
15#define CAN_BCM_H
16
17/**
18 * struct bcm_msg_head - head of messages to/from the broadcast manager
19 * @opcode: opcode, see enum below.
20 * @flags: special flags, see below.
21 * @count: number of frames to send before changing interval.
22 * @ival1: interval for the first @count frames.
23 * @ival2: interval for the following frames.
24 * @can_id: CAN ID of frames to be sent or received.
25 * @nframes: number of frames appended to the message head.
26 * @frames: array of CAN frames.
27 */
28struct bcm_msg_head {
29 __u32 opcode;
30 __u32 flags;
31 __u32 count;
32 struct timeval ival1, ival2;
33 canid_t can_id;
34 __u32 nframes;
35 struct can_frame frames[0];
36};
37
38enum {
39 TX_SETUP = 1, /* create (cyclic) transmission task */
40 TX_DELETE, /* remove (cyclic) transmission task */
41 TX_READ, /* read properties of (cyclic) transmission task */
42 TX_SEND, /* send one CAN frame */
43 RX_SETUP, /* create RX content filter subscription */
44 RX_DELETE, /* remove RX content filter subscription */
45 RX_READ, /* read properties of RX content filter subscription */
46 TX_STATUS, /* reply to TX_READ request */
47 TX_EXPIRED, /* notification on performed transmissions (count=0) */
48 RX_STATUS, /* reply to RX_READ request */
49 RX_TIMEOUT, /* cyclic message is absent */
50 RX_CHANGED /* updated CAN frame (detected content change) */
51};
52
53#define SETTIMER 0x0001
54#define STARTTIMER 0x0002
55#define TX_COUNTEVT 0x0004
56#define TX_ANNOUNCE 0x0008
57#define TX_CP_CAN_ID 0x0010
58#define RX_FILTER_ID 0x0020
59#define RX_CHECK_DLC 0x0040
60#define RX_NO_AUTOTIMER 0x0080
61#define RX_ANNOUNCE_RESUME 0x0100
62#define TX_RESET_MULTI_IDX 0x0200
63#define RX_RTR_FRAME 0x0400
64
65#endif /* CAN_BCM_H */
diff --git a/include/linux/can/core.h b/include/linux/can/core.h
new file mode 100644
index 000000000000..e9ca210ffa5b
--- /dev/null
+++ b/include/linux/can/core.h
@@ -0,0 +1,64 @@
1/*
2 * linux/can/core.h
3 *
4 * Protoypes and definitions for CAN protocol modules using the PF_CAN core
5 *
6 * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
7 * Urs Thuermann <urs.thuermann@volkswagen.de>
8 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
9 * All rights reserved.
10 *
11 * Send feedback to <socketcan-users@lists.berlios.de>
12 *
13 */
14
15#ifndef CAN_CORE_H
16#define CAN_CORE_H
17
18#include <linux/can.h>
19#include <linux/skbuff.h>
20#include <linux/netdevice.h>
21
22#define CAN_VERSION "20071116"
23
24/* increment this number each time you change some user-space interface */
25#define CAN_ABI_VERSION "8"
26
27#define CAN_VERSION_STRING "rev " CAN_VERSION " abi " CAN_ABI_VERSION
28
29#define DNAME(dev) ((dev) ? (dev)->name : "any")
30
31/**
32 * struct can_proto - CAN protocol structure
33 * @type: type argument in socket() syscall, e.g. SOCK_DGRAM.
34 * @protocol: protocol number in socket() syscall.
35 * @capability: capability needed to open the socket, or -1 for no restriction.
36 * @ops: pointer to struct proto_ops for sock->ops.
37 * @prot: pointer to struct proto structure.
38 */
39struct can_proto {
40 int type;
41 int protocol;
42 int capability;
43 struct proto_ops *ops;
44 struct proto *prot;
45};
46
47/* function prototypes for the CAN networklayer core (af_can.c) */
48
49extern int can_proto_register(struct can_proto *cp);
50extern void can_proto_unregister(struct can_proto *cp);
51
52extern int can_rx_register(struct net_device *dev, canid_t can_id,
53 canid_t mask,
54 void (*func)(struct sk_buff *, void *),
55 void *data, char *ident);
56
57extern void can_rx_unregister(struct net_device *dev, canid_t can_id,
58 canid_t mask,
59 void (*func)(struct sk_buff *, void *),
60 void *data);
61
62extern int can_send(struct sk_buff *skb, int loop);
63
64#endif /* CAN_CORE_H */
diff --git a/include/linux/can/error.h b/include/linux/can/error.h
new file mode 100644
index 000000000000..d4127fd9e681
--- /dev/null
+++ b/include/linux/can/error.h
@@ -0,0 +1,93 @@
1/*
2 * linux/can/error.h
3 *
4 * Definitions of the CAN error frame to be filtered and passed to the user.
5 *
6 * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
7 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
8 * All rights reserved.
9 *
10 * Send feedback to <socketcan-users@lists.berlios.de>
11 *
12 */
13
14#ifndef CAN_ERROR_H
15#define CAN_ERROR_H
16
17#define CAN_ERR_DLC 8 /* dlc for error frames */
18
19/* error class (mask) in can_id */
20#define CAN_ERR_TX_TIMEOUT 0x00000001U /* TX timeout (by netdevice driver) */
21#define CAN_ERR_LOSTARB 0x00000002U /* lost arbitration / data[0] */
22#define CAN_ERR_CRTL 0x00000004U /* controller problems / data[1] */
23#define CAN_ERR_PROT 0x00000008U /* protocol violations / data[2..3] */
24#define CAN_ERR_TRX 0x00000010U /* transceiver status / data[4] */
25#define CAN_ERR_ACK 0x00000020U /* received no ACK on transmission */
26#define CAN_ERR_BUSOFF 0x00000040U /* bus off */
27#define CAN_ERR_BUSERROR 0x00000080U /* bus error (may flood!) */
28#define CAN_ERR_RESTARTED 0x00000100U /* controller restarted */
29
30/* arbitration lost in bit ... / data[0] */
31#define CAN_ERR_LOSTARB_UNSPEC 0x00 /* unspecified */
32 /* else bit number in bitstream */
33
34/* error status of CAN-controller / data[1] */
35#define CAN_ERR_CRTL_UNSPEC 0x00 /* unspecified */
36#define CAN_ERR_CRTL_RX_OVERFLOW 0x01 /* RX buffer overflow */
37#define CAN_ERR_CRTL_TX_OVERFLOW 0x02 /* TX buffer overflow */
38#define CAN_ERR_CRTL_RX_WARNING 0x04 /* reached warning level for RX errors */
39#define CAN_ERR_CRTL_TX_WARNING 0x08 /* reached warning level for TX errors */
40#define CAN_ERR_CRTL_RX_PASSIVE 0x10 /* reached error passive status RX */
41#define CAN_ERR_CRTL_TX_PASSIVE 0x20 /* reached error passive status TX */
42 /* (at least one error counter exceeds */
43 /* the protocol-defined level of 127) */
44
45/* error in CAN protocol (type) / data[2] */
46#define CAN_ERR_PROT_UNSPEC 0x00 /* unspecified */
47#define CAN_ERR_PROT_BIT 0x01 /* single bit error */
48#define CAN_ERR_PROT_FORM 0x02 /* frame format error */
49#define CAN_ERR_PROT_STUFF 0x04 /* bit stuffing error */
50#define CAN_ERR_PROT_BIT0 0x08 /* unable to send dominant bit */
51#define CAN_ERR_PROT_BIT1 0x10 /* unable to send recessive bit */
52#define CAN_ERR_PROT_OVERLOAD 0x20 /* bus overload */
53#define CAN_ERR_PROT_ACTIVE 0x40 /* active error announcement */
54#define CAN_ERR_PROT_TX 0x80 /* error occured on transmission */
55
56/* error in CAN protocol (location) / data[3] */
57#define CAN_ERR_PROT_LOC_UNSPEC 0x00 /* unspecified */
58#define CAN_ERR_PROT_LOC_SOF 0x03 /* start of frame */
59#define CAN_ERR_PROT_LOC_ID28_21 0x02 /* ID bits 28 - 21 (SFF: 10 - 3) */
60#define CAN_ERR_PROT_LOC_ID20_18 0x06 /* ID bits 20 - 18 (SFF: 2 - 0 )*/
61#define CAN_ERR_PROT_LOC_SRTR 0x04 /* substitute RTR (SFF: RTR) */
62#define CAN_ERR_PROT_LOC_IDE 0x05 /* identifier extension */
63#define CAN_ERR_PROT_LOC_ID17_13 0x07 /* ID bits 17-13 */
64#define CAN_ERR_PROT_LOC_ID12_05 0x0F /* ID bits 12-5 */
65#define CAN_ERR_PROT_LOC_ID04_00 0x0E /* ID bits 4-0 */
66#define CAN_ERR_PROT_LOC_RTR 0x0C /* RTR */
67#define CAN_ERR_PROT_LOC_RES1 0x0D /* reserved bit 1 */
68#define CAN_ERR_PROT_LOC_RES0 0x09 /* reserved bit 0 */
69#define CAN_ERR_PROT_LOC_DLC 0x0B /* data length code */
70#define CAN_ERR_PROT_LOC_DATA 0x0A /* data section */
71#define CAN_ERR_PROT_LOC_CRC_SEQ 0x08 /* CRC sequence */
72#define CAN_ERR_PROT_LOC_CRC_DEL 0x18 /* CRC delimiter */
73#define CAN_ERR_PROT_LOC_ACK 0x19 /* ACK slot */
74#define CAN_ERR_PROT_LOC_ACK_DEL 0x1B /* ACK delimiter */
75#define CAN_ERR_PROT_LOC_EOF 0x1A /* end of frame */
76#define CAN_ERR_PROT_LOC_INTERM 0x12 /* intermission */
77
78/* error status of CAN-transceiver / data[4] */
79/* CANH CANL */
80#define CAN_ERR_TRX_UNSPEC 0x00 /* 0000 0000 */
81#define CAN_ERR_TRX_CANH_NO_WIRE 0x04 /* 0000 0100 */
82#define CAN_ERR_TRX_CANH_SHORT_TO_BAT 0x05 /* 0000 0101 */
83#define CAN_ERR_TRX_CANH_SHORT_TO_VCC 0x06 /* 0000 0110 */
84#define CAN_ERR_TRX_CANH_SHORT_TO_GND 0x07 /* 0000 0111 */
85#define CAN_ERR_TRX_CANL_NO_WIRE 0x40 /* 0100 0000 */
86#define CAN_ERR_TRX_CANL_SHORT_TO_BAT 0x50 /* 0101 0000 */
87#define CAN_ERR_TRX_CANL_SHORT_TO_VCC 0x60 /* 0110 0000 */
88#define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70 /* 0111 0000 */
89#define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80 /* 1000 0000 */
90
91/* controller specific additional information / data[5..7] */
92
93#endif /* CAN_ERROR_H */
diff --git a/include/linux/can/raw.h b/include/linux/can/raw.h
new file mode 100644
index 000000000000..b2a0f87492c5
--- /dev/null
+++ b/include/linux/can/raw.h
@@ -0,0 +1,31 @@
1/*
2 * linux/can/raw.h
3 *
4 * Definitions for raw CAN sockets
5 *
6 * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
7 * Urs Thuermann <urs.thuermann@volkswagen.de>
8 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
9 * All rights reserved.
10 *
11 * Send feedback to <socketcan-users@lists.berlios.de>
12 *
13 */
14
15#ifndef CAN_RAW_H
16#define CAN_RAW_H
17
18#include <linux/can.h>
19
20#define SOL_CAN_RAW (SOL_CAN_BASE + CAN_RAW)
21
22/* for socket options affecting the socket (not the global system) */
23
24enum {
25 CAN_RAW_FILTER = 1, /* set 0 .. n can_filter(s) */
26 CAN_RAW_ERR_FILTER, /* set filter for error frames */
27 CAN_RAW_LOOPBACK, /* local loopback (default:on) */
28 CAN_RAW_RECV_OWN_MSGS /* receive my own msgs (default:off) */
29};
30
31#endif
diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
index c6d3e22c0624..a5cd2047624e 100644
--- a/include/linux/cdrom.h
+++ b/include/linux/cdrom.h
@@ -451,6 +451,7 @@ struct cdrom_generic_command
451#define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e 451#define GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e
452#define GPCMD_READ_10 0x28 452#define GPCMD_READ_10 0x28
453#define GPCMD_READ_12 0xa8 453#define GPCMD_READ_12 0xa8
454#define GPCMD_READ_BUFFER 0x3c
454#define GPCMD_READ_BUFFER_CAPACITY 0x5c 455#define GPCMD_READ_BUFFER_CAPACITY 0x5c
455#define GPCMD_READ_CDVD_CAPACITY 0x25 456#define GPCMD_READ_CDVD_CAPACITY 0x25
456#define GPCMD_READ_CD 0xbe 457#define GPCMD_READ_CD 0xbe
@@ -480,7 +481,9 @@ struct cdrom_generic_command
480#define GPCMD_TEST_UNIT_READY 0x00 481#define GPCMD_TEST_UNIT_READY 0x00
481#define GPCMD_VERIFY_10 0x2f 482#define GPCMD_VERIFY_10 0x2f
482#define GPCMD_WRITE_10 0x2a 483#define GPCMD_WRITE_10 0x2a
484#define GPCMD_WRITE_12 0xaa
483#define GPCMD_WRITE_AND_VERIFY_10 0x2e 485#define GPCMD_WRITE_AND_VERIFY_10 0x2e
486#define GPCMD_WRITE_BUFFER 0x3b
484/* This is listed as optional in ATAPI 2.6, but is (curiously) 487/* This is listed as optional in ATAPI 2.6, but is (curiously)
485 * missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji 488 * missing from Mt. Fuji, Table 57. It _is_ mentioned in Mt. Fuji
486 * Table 377 as an MMC command for SCSi devices though... Most ATAPI 489 * Table 377 as an MMC command for SCSi devices though... Most ATAPI
@@ -1184,6 +1187,20 @@ struct media_event_desc {
1184 1187
1185extern int cdrom_get_media_event(struct cdrom_device_info *cdi, struct media_event_desc *med); 1188extern int cdrom_get_media_event(struct cdrom_device_info *cdi, struct media_event_desc *med);
1186 1189
1190static inline void lba_to_msf(int lba, u8 *m, u8 *s, u8 *f)
1191{
1192 lba += CD_MSF_OFFSET;
1193 lba &= 0xffffff; /* negative lbas use only 24 bits */
1194 *m = lba / (CD_SECS * CD_FRAMES);
1195 lba %= (CD_SECS * CD_FRAMES);
1196 *s = lba / CD_FRAMES;
1197 *f = lba % CD_FRAMES;
1198}
1199
1200static inline int msf_to_lba(u8 m, u8 s, u8 f)
1201{
1202 return (((m * CD_SECS) + s) * CD_FRAMES + f) - CD_MSF_OFFSET;
1203}
1187#endif /* End of kernel only stuff */ 1204#endif /* End of kernel only stuff */
1188 1205
1189#endif /* _LINUX_CDROM_H */ 1206#endif /* _LINUX_CDROM_H */
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index 0b9bfbde8168..9ec43186ba80 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -13,12 +13,6 @@ SUBSYS(cpuset)
13 13
14/* */ 14/* */
15 15
16#ifdef CONFIG_CGROUP_CPUACCT
17SUBSYS(cpuacct)
18#endif
19
20/* */
21
22#ifdef CONFIG_CGROUP_DEBUG 16#ifdef CONFIG_CGROUP_DEBUG
23SUBSYS(debug) 17SUBSYS(debug)
24#endif 18#endif
@@ -36,3 +30,10 @@ SUBSYS(cpu_cgroup)
36#endif 30#endif
37 31
38/* */ 32/* */
33
34#ifdef CONFIG_CGROUP_CPUACCT
35SUBSYS(cpuacct)
36#endif
37
38/* */
39
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 107787aacb64..85778a4b1209 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -103,7 +103,7 @@ struct clocksource {
103#define CLOCK_SOURCE_VALID_FOR_HRES 0x20 103#define CLOCK_SOURCE_VALID_FOR_HRES 0x20
104 104
105/* simplify initialization of mask field */ 105/* simplify initialization of mask field */
106#define CLOCKSOURCE_MASK(bits) (cycle_t)(bits<64 ? ((1ULL<<bits)-1) : -1) 106#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
107 107
108/** 108/**
109 * clocksource_khz2mult - calculates mult from khz and shift 109 * clocksource_khz2mult - calculates mult from khz and shift
@@ -215,6 +215,7 @@ static inline void clocksource_calculate_interval(struct clocksource *c,
215 215
216/* used to install a new clocksource */ 216/* used to install a new clocksource */
217extern int clocksource_register(struct clocksource*); 217extern int clocksource_register(struct clocksource*);
218extern void clocksource_unregister(struct clocksource*);
218extern struct clocksource* clocksource_get_next(void); 219extern struct clocksource* clocksource_get_next(void);
219extern void clocksource_change_rating(struct clocksource *cs, int rating); 220extern void clocksource_change_rating(struct clocksource *cs, int rating);
220extern void clocksource_resume(void); 221extern void clocksource_resume(void);
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 0e69d2cf14aa..d38655f2be70 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -191,6 +191,10 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
191 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 191 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
192 struct compat_timeval __user *tvp); 192 struct compat_timeval __user *tvp);
193 193
194asmlinkage long compat_sys_wait4(compat_pid_t pid,
195 compat_uint_t *stat_addr, int options,
196 struct compat_rusage *ru);
197
194#define BITS_PER_COMPAT_LONG (8*sizeof(compat_long_t)) 198#define BITS_PER_COMPAT_LONG (8*sizeof(compat_long_t))
195 199
196#define BITS_TO_COMPAT_LONGS(bits) \ 200#define BITS_TO_COMPAT_LONGS(bits) \
@@ -239,6 +243,17 @@ asmlinkage long compat_sys_migrate_pages(compat_pid_t pid,
239 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes, 243 compat_ulong_t maxnode, const compat_ulong_t __user *old_nodes,
240 const compat_ulong_t __user *new_nodes); 244 const compat_ulong_t __user *new_nodes);
241 245
246extern int compat_ptrace_request(struct task_struct *child,
247 compat_long_t request,
248 compat_ulong_t addr, compat_ulong_t data);
249
250#ifdef __ARCH_WANT_COMPAT_SYS_PTRACE
251extern long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
252 compat_ulong_t addr, compat_ulong_t data);
253asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
254 compat_long_t addr, compat_long_t data);
255#endif /* __ARCH_WANT_COMPAT_SYS_PTRACE */
256
242/* 257/*
243 * epoll (fs/eventpoll.c) compat bits follow ... 258 * epoll (fs/eventpoll.c) compat bits follow ...
244 */ 259 */
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
index 2d8c0f48f55e..e5eb795f78a1 100644
--- a/include/linux/compiler-gcc3.h
+++ b/include/linux/compiler-gcc3.h
@@ -7,10 +7,8 @@
7 7
8#if __GNUC_MINOR__ >= 3 8#if __GNUC_MINOR__ >= 3
9# define __used __attribute__((__used__)) 9# define __used __attribute__((__used__))
10# define __attribute_used__ __used /* deprecated */
11#else 10#else
12# define __used __attribute__((__unused__)) 11# define __used __attribute__((__unused__))
13# define __attribute_used__ __used /* deprecated */
14#endif 12#endif
15 13
16#if __GNUC_MINOR__ >= 4 14#if __GNUC_MINOR__ >= 4
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index ee7ca5de970c..0ab3a3232330 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -15,7 +15,6 @@
15#endif 15#endif
16 16
17#define __used __attribute__((__used__)) 17#define __used __attribute__((__used__))
18#define __attribute_used__ __used /* deprecated */
19#define __must_check __attribute__((warn_unused_result)) 18#define __must_check __attribute__((warn_unused_result))
20#define __compiler_offsetof(a,b) __builtin_offsetof(a,b) 19#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
21#define __always_inline inline __attribute__((always_inline)) 20#define __always_inline inline __attribute__((always_inline))
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index c68b67b86ef1..d0e17e1657dc 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -126,10 +126,6 @@ extern void __chk_io_ptr(const volatile void __iomem *);
126 * Mark functions that are referenced only in inline assembly as __used so 126 * Mark functions that are referenced only in inline assembly as __used so
127 * the code is emitted even though it appears to be unreferenced. 127 * the code is emitted even though it appears to be unreferenced.
128 */ 128 */
129#ifndef __attribute_used__
130# define __attribute_used__ /* deprecated */
131#endif
132
133#ifndef __used 129#ifndef __used
134# define __used /* unimplemented */ 130# define __used /* unimplemented */
135#endif 131#endif
@@ -175,4 +171,9 @@ extern void __chk_io_ptr(const volatile void __iomem *);
175#define __cold 171#define __cold
176#endif 172#endif
177 173
174/* Simple shorthand for a section definition */
175#ifndef __section
176# define __section(S) __attribute__ ((__section__(#S)))
177#endif
178
178#endif /* __LINUX_COMPILER_H */ 179#endif /* __LINUX_COMPILER_H */
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 33d6aaf94447..d2961b66d53d 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -44,6 +44,7 @@ static inline void init_completion(struct completion *x)
44 44
45extern void wait_for_completion(struct completion *); 45extern void wait_for_completion(struct completion *);
46extern int wait_for_completion_interruptible(struct completion *x); 46extern int wait_for_completion_interruptible(struct completion *x);
47extern int wait_for_completion_killable(struct completion *x);
47extern unsigned long wait_for_completion_timeout(struct completion *x, 48extern unsigned long wait_for_completion_timeout(struct completion *x,
48 unsigned long timeout); 49 unsigned long timeout);
49extern unsigned long wait_for_completion_interruptible_timeout( 50extern unsigned long wait_for_completion_interruptible_timeout(
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 13fc4541bf23..da6dd957f908 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -112,7 +112,6 @@ struct cn_queue_dev {
112 struct list_head queue_list; 112 struct list_head queue_list;
113 spinlock_t queue_lock; 113 spinlock_t queue_lock;
114 114
115 int netlink_groups;
116 struct sock *nls; 115 struct sock *nls;
117}; 116};
118 117
@@ -133,15 +132,13 @@ struct cn_callback_data {
133 132
134struct cn_callback_entry { 133struct cn_callback_entry {
135 struct list_head callback_entry; 134 struct list_head callback_entry;
136 struct cn_callback *cb;
137 struct work_struct work; 135 struct work_struct work;
138 struct cn_queue_dev *pdev; 136 struct cn_queue_dev *pdev;
139 137
140 struct cn_callback_id id; 138 struct cn_callback_id id;
141 struct cn_callback_data data; 139 struct cn_callback_data data;
142 140
143 int seq, group; 141 u32 seq, group;
144 struct sock *nls;
145}; 142};
146 143
147struct cn_ctl_entry { 144struct cn_ctl_entry {
diff --git a/include/linux/const.h b/include/linux/const.h
index 07b300bfe34b..c22c707c455d 100644
--- a/include/linux/const.h
+++ b/include/linux/const.h
@@ -7,13 +7,18 @@
7 * C code. Therefore we cannot annotate them always with 7 * C code. Therefore we cannot annotate them always with
8 * 'UL' and other type specifiers unilaterally. We 8 * 'UL' and other type specifiers unilaterally. We
9 * use the following macros to deal with this. 9 * use the following macros to deal with this.
10 *
11 * Similarly, _AT() will cast an expression with a type in C, but
12 * leave it unchanged in asm.
10 */ 13 */
11 14
12#ifdef __ASSEMBLY__ 15#ifdef __ASSEMBLY__
13#define _AC(X,Y) X 16#define _AC(X,Y) X
17#define _AT(T,X) X
14#else 18#else
15#define __AC(X,Y) (X##Y) 19#define __AC(X,Y) (X##Y)
16#define _AC(X,Y) __AC(X,Y) 20#define _AC(X,Y) __AC(X,Y)
21#define _AT(T,X) ((T)(X))
17#endif 22#endif
18 23
19#endif /* !(_LINUX_CONST_H) */ 24#endif /* !(_LINUX_CONST_H) */
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index b79c57569367..0be8d65bc3c8 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -71,18 +71,27 @@ static inline void unregister_cpu_notifier(struct notifier_block *nb)
71 71
72int cpu_up(unsigned int cpu); 72int cpu_up(unsigned int cpu);
73 73
74extern void cpu_hotplug_init(void);
75
74#else 76#else
75 77
76static inline int register_cpu_notifier(struct notifier_block *nb) 78static inline int register_cpu_notifier(struct notifier_block *nb)
77{ 79{
78 return 0; 80 return 0;
79} 81}
82
80static inline void unregister_cpu_notifier(struct notifier_block *nb) 83static inline void unregister_cpu_notifier(struct notifier_block *nb)
81{ 84{
82} 85}
83 86
87static inline void cpu_hotplug_init(void)
88{
89}
90
84#endif /* CONFIG_SMP */ 91#endif /* CONFIG_SMP */
85extern struct sysdev_class cpu_sysdev_class; 92extern struct sysdev_class cpu_sysdev_class;
93extern void cpu_maps_update_begin(void);
94extern void cpu_maps_update_done(void);
86 95
87#ifdef CONFIG_HOTPLUG_CPU 96#ifdef CONFIG_HOTPLUG_CPU
88/* Stop CPUs going up and down. */ 97/* Stop CPUs going up and down. */
@@ -97,8 +106,8 @@ static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
97 mutex_unlock(cpu_hp_mutex); 106 mutex_unlock(cpu_hp_mutex);
98} 107}
99 108
100extern void lock_cpu_hotplug(void); 109extern void get_online_cpus(void);
101extern void unlock_cpu_hotplug(void); 110extern void put_online_cpus(void);
102#define hotcpu_notifier(fn, pri) { \ 111#define hotcpu_notifier(fn, pri) { \
103 static struct notifier_block fn##_nb = \ 112 static struct notifier_block fn##_nb = \
104 { .notifier_call = fn, .priority = pri }; \ 113 { .notifier_call = fn, .priority = pri }; \
@@ -107,7 +116,6 @@ extern void unlock_cpu_hotplug(void);
107#define register_hotcpu_notifier(nb) register_cpu_notifier(nb) 116#define register_hotcpu_notifier(nb) register_cpu_notifier(nb)
108#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb) 117#define unregister_hotcpu_notifier(nb) unregister_cpu_notifier(nb)
109int cpu_down(unsigned int cpu); 118int cpu_down(unsigned int cpu);
110#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
111 119
112#else /* CONFIG_HOTPLUG_CPU */ 120#else /* CONFIG_HOTPLUG_CPU */
113 121
@@ -116,15 +124,12 @@ static inline void cpuhotplug_mutex_lock(struct mutex *cpu_hp_mutex)
116static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex) 124static inline void cpuhotplug_mutex_unlock(struct mutex *cpu_hp_mutex)
117{ } 125{ }
118 126
119#define lock_cpu_hotplug() do { } while (0) 127#define get_online_cpus() do { } while (0)
120#define unlock_cpu_hotplug() do { } while (0) 128#define put_online_cpus() do { } while (0)
121#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0) 129#define hotcpu_notifier(fn, pri) do { (void)(fn); } while (0)
122/* These aren't inline functions due to a GCC bug. */ 130/* These aren't inline functions due to a GCC bug. */
123#define register_hotcpu_notifier(nb) ({ (void)(nb); 0; }) 131#define register_hotcpu_notifier(nb) ({ (void)(nb); 0; })
124#define unregister_hotcpu_notifier(nb) ({ (void)(nb); }) 132#define unregister_hotcpu_notifier(nb) ({ (void)(nb); })
125
126/* CPUs don't go offline once they're online w/o CONFIG_HOTPLUG_CPU */
127static inline int cpu_is_offline(int cpu) { return 0; }
128#endif /* CONFIG_HOTPLUG_CPU */ 133#endif /* CONFIG_HOTPLUG_CPU */
129 134
130#ifdef CONFIG_PM_SLEEP_SMP 135#ifdef CONFIG_PM_SLEEP_SMP
diff --git a/include/linux/cpu_acct.h b/include/linux/cpu_acct.h
deleted file mode 100644
index 6b5fd8a66c8d..000000000000
--- a/include/linux/cpu_acct.h
+++ /dev/null
@@ -1,14 +0,0 @@
1
2#ifndef _LINUX_CPU_ACCT_H
3#define _LINUX_CPU_ACCT_H
4
5#include <linux/cgroup.h>
6#include <asm/cputime.h>
7
8#ifdef CONFIG_CGROUP_CPUACCT
9extern void cpuacct_charge(struct task_struct *, cputime_t cputime);
10#else
11static void inline cpuacct_charge(struct task_struct *p, cputime_t cputime) {}
12#endif
13
14#endif
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 16a51546db44..c4e00161a247 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -92,6 +92,7 @@ struct cpuidle_device {
92 struct kobject kobj; 92 struct kobject kobj;
93 struct completion kobj_unregister; 93 struct completion kobj_unregister;
94 void *governor_data; 94 void *governor_data;
95 struct cpuidle_state *safe_state;
95}; 96};
96 97
97DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices); 98DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices);
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 23f55140ccd5..7047f58306a7 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -218,8 +218,8 @@ int __first_cpu(const cpumask_t *srcp);
218int __next_cpu(int n, const cpumask_t *srcp); 218int __next_cpu(int n, const cpumask_t *srcp);
219#define next_cpu(n, src) __next_cpu((n), &(src)) 219#define next_cpu(n, src) __next_cpu((n), &(src))
220#else 220#else
221#define first_cpu(src) 0 221#define first_cpu(src) ({ (void)(src); 0; })
222#define next_cpu(n, src) 1 222#define next_cpu(n, src) ({ (void)(src); 1; })
223#endif 223#endif
224 224
225#define cpumask_of_cpu(cpu) \ 225#define cpumask_of_cpu(cpu) \
@@ -397,6 +397,8 @@ extern cpumask_t cpu_present_map;
397#define cpu_present(cpu) ((cpu) == 0) 397#define cpu_present(cpu) ((cpu) == 0)
398#endif 398#endif
399 399
400#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
401
400#ifdef CONFIG_SMP 402#ifdef CONFIG_SMP
401extern int nr_cpu_ids; 403extern int nr_cpu_ids;
402#define any_online_cpu(mask) __any_online_cpu(&(mask)) 404#define any_online_cpu(mask) __any_online_cpu(&(mask))
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index f3110ebe894a..5e02d1b46370 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -33,10 +33,13 @@
33#define CRYPTO_ALG_TYPE_DIGEST 0x00000002 33#define CRYPTO_ALG_TYPE_DIGEST 0x00000002
34#define CRYPTO_ALG_TYPE_HASH 0x00000003 34#define CRYPTO_ALG_TYPE_HASH 0x00000003
35#define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004 35#define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004
36#define CRYPTO_ALG_TYPE_COMPRESS 0x00000005 36#define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005
37#define CRYPTO_ALG_TYPE_AEAD 0x00000006 37#define CRYPTO_ALG_TYPE_GIVCIPHER 0x00000006
38#define CRYPTO_ALG_TYPE_COMPRESS 0x00000008
39#define CRYPTO_ALG_TYPE_AEAD 0x00000009
38 40
39#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e 41#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e
42#define CRYPTO_ALG_TYPE_BLKCIPHER_MASK 0x0000000c
40 43
41#define CRYPTO_ALG_LARVAL 0x00000010 44#define CRYPTO_ALG_LARVAL 0x00000010
42#define CRYPTO_ALG_DEAD 0x00000020 45#define CRYPTO_ALG_DEAD 0x00000020
@@ -50,6 +53,12 @@
50#define CRYPTO_ALG_NEED_FALLBACK 0x00000100 53#define CRYPTO_ALG_NEED_FALLBACK 0x00000100
51 54
52/* 55/*
56 * This bit is set for symmetric key ciphers that have already been wrapped
57 * with a generic IV generator to prevent them from being wrapped again.
58 */
59#define CRYPTO_ALG_GENIV 0x00000200
60
61/*
53 * Transform masks and values (for crt_flags). 62 * Transform masks and values (for crt_flags).
54 */ 63 */
55#define CRYPTO_TFM_REQ_MASK 0x000fff00 64#define CRYPTO_TFM_REQ_MASK 0x000fff00
@@ -81,13 +90,11 @@
81#define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN 90#define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN
82#elif defined(ARCH_SLAB_MINALIGN) 91#elif defined(ARCH_SLAB_MINALIGN)
83#define CRYPTO_MINALIGN ARCH_SLAB_MINALIGN 92#define CRYPTO_MINALIGN ARCH_SLAB_MINALIGN
93#else
94#define CRYPTO_MINALIGN __alignof__(unsigned long long)
84#endif 95#endif
85 96
86#ifdef CRYPTO_MINALIGN
87#define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN))) 97#define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN)))
88#else
89#define CRYPTO_MINALIGN_ATTR
90#endif
91 98
92struct scatterlist; 99struct scatterlist;
93struct crypto_ablkcipher; 100struct crypto_ablkcipher;
@@ -97,6 +104,8 @@ struct crypto_blkcipher;
97struct crypto_hash; 104struct crypto_hash;
98struct crypto_tfm; 105struct crypto_tfm;
99struct crypto_type; 106struct crypto_type;
107struct aead_givcrypt_request;
108struct skcipher_givcrypt_request;
100 109
101typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err); 110typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err);
102 111
@@ -176,6 +185,10 @@ struct ablkcipher_alg {
176 unsigned int keylen); 185 unsigned int keylen);
177 int (*encrypt)(struct ablkcipher_request *req); 186 int (*encrypt)(struct ablkcipher_request *req);
178 int (*decrypt)(struct ablkcipher_request *req); 187 int (*decrypt)(struct ablkcipher_request *req);
188 int (*givencrypt)(struct skcipher_givcrypt_request *req);
189 int (*givdecrypt)(struct skcipher_givcrypt_request *req);
190
191 const char *geniv;
179 192
180 unsigned int min_keysize; 193 unsigned int min_keysize;
181 unsigned int max_keysize; 194 unsigned int max_keysize;
@@ -185,11 +198,16 @@ struct ablkcipher_alg {
185struct aead_alg { 198struct aead_alg {
186 int (*setkey)(struct crypto_aead *tfm, const u8 *key, 199 int (*setkey)(struct crypto_aead *tfm, const u8 *key,
187 unsigned int keylen); 200 unsigned int keylen);
201 int (*setauthsize)(struct crypto_aead *tfm, unsigned int authsize);
188 int (*encrypt)(struct aead_request *req); 202 int (*encrypt)(struct aead_request *req);
189 int (*decrypt)(struct aead_request *req); 203 int (*decrypt)(struct aead_request *req);
204 int (*givencrypt)(struct aead_givcrypt_request *req);
205 int (*givdecrypt)(struct aead_givcrypt_request *req);
206
207 const char *geniv;
190 208
191 unsigned int ivsize; 209 unsigned int ivsize;
192 unsigned int authsize; 210 unsigned int maxauthsize;
193}; 211};
194 212
195struct blkcipher_alg { 213struct blkcipher_alg {
@@ -202,6 +220,8 @@ struct blkcipher_alg {
202 struct scatterlist *dst, struct scatterlist *src, 220 struct scatterlist *dst, struct scatterlist *src,
203 unsigned int nbytes); 221 unsigned int nbytes);
204 222
223 const char *geniv;
224
205 unsigned int min_keysize; 225 unsigned int min_keysize;
206 unsigned int max_keysize; 226 unsigned int max_keysize;
207 unsigned int ivsize; 227 unsigned int ivsize;
@@ -317,6 +337,11 @@ struct ablkcipher_tfm {
317 unsigned int keylen); 337 unsigned int keylen);
318 int (*encrypt)(struct ablkcipher_request *req); 338 int (*encrypt)(struct ablkcipher_request *req);
319 int (*decrypt)(struct ablkcipher_request *req); 339 int (*decrypt)(struct ablkcipher_request *req);
340 int (*givencrypt)(struct skcipher_givcrypt_request *req);
341 int (*givdecrypt)(struct skcipher_givcrypt_request *req);
342
343 struct crypto_ablkcipher *base;
344
320 unsigned int ivsize; 345 unsigned int ivsize;
321 unsigned int reqsize; 346 unsigned int reqsize;
322}; 347};
@@ -326,6 +351,11 @@ struct aead_tfm {
326 unsigned int keylen); 351 unsigned int keylen);
327 int (*encrypt)(struct aead_request *req); 352 int (*encrypt)(struct aead_request *req);
328 int (*decrypt)(struct aead_request *req); 353 int (*decrypt)(struct aead_request *req);
354 int (*givencrypt)(struct aead_givcrypt_request *req);
355 int (*givdecrypt)(struct aead_givcrypt_request *req);
356
357 struct crypto_aead *base;
358
329 unsigned int ivsize; 359 unsigned int ivsize;
330 unsigned int authsize; 360 unsigned int authsize;
331 unsigned int reqsize; 361 unsigned int reqsize;
@@ -525,17 +555,23 @@ static inline struct crypto_ablkcipher *__crypto_ablkcipher_cast(
525 return (struct crypto_ablkcipher *)tfm; 555 return (struct crypto_ablkcipher *)tfm;
526} 556}
527 557
528static inline struct crypto_ablkcipher *crypto_alloc_ablkcipher( 558static inline u32 crypto_skcipher_type(u32 type)
529 const char *alg_name, u32 type, u32 mask)
530{ 559{
531 type &= ~CRYPTO_ALG_TYPE_MASK; 560 type &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_GENIV);
532 type |= CRYPTO_ALG_TYPE_BLKCIPHER; 561 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
533 mask |= CRYPTO_ALG_TYPE_MASK; 562 return type;
563}
534 564
535 return __crypto_ablkcipher_cast( 565static inline u32 crypto_skcipher_mask(u32 mask)
536 crypto_alloc_base(alg_name, type, mask)); 566{
567 mask &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_GENIV);
568 mask |= CRYPTO_ALG_TYPE_BLKCIPHER_MASK;
569 return mask;
537} 570}
538 571
572struct crypto_ablkcipher *crypto_alloc_ablkcipher(const char *alg_name,
573 u32 type, u32 mask);
574
539static inline struct crypto_tfm *crypto_ablkcipher_tfm( 575static inline struct crypto_tfm *crypto_ablkcipher_tfm(
540 struct crypto_ablkcipher *tfm) 576 struct crypto_ablkcipher *tfm)
541{ 577{
@@ -550,11 +586,8 @@ static inline void crypto_free_ablkcipher(struct crypto_ablkcipher *tfm)
550static inline int crypto_has_ablkcipher(const char *alg_name, u32 type, 586static inline int crypto_has_ablkcipher(const char *alg_name, u32 type,
551 u32 mask) 587 u32 mask)
552{ 588{
553 type &= ~CRYPTO_ALG_TYPE_MASK; 589 return crypto_has_alg(alg_name, crypto_skcipher_type(type),
554 type |= CRYPTO_ALG_TYPE_BLKCIPHER; 590 crypto_skcipher_mask(mask));
555 mask |= CRYPTO_ALG_TYPE_MASK;
556
557 return crypto_has_alg(alg_name, type, mask);
558} 591}
559 592
560static inline struct ablkcipher_tfm *crypto_ablkcipher_crt( 593static inline struct ablkcipher_tfm *crypto_ablkcipher_crt(
@@ -601,7 +634,9 @@ static inline void crypto_ablkcipher_clear_flags(struct crypto_ablkcipher *tfm,
601static inline int crypto_ablkcipher_setkey(struct crypto_ablkcipher *tfm, 634static inline int crypto_ablkcipher_setkey(struct crypto_ablkcipher *tfm,
602 const u8 *key, unsigned int keylen) 635 const u8 *key, unsigned int keylen)
603{ 636{
604 return crypto_ablkcipher_crt(tfm)->setkey(tfm, key, keylen); 637 struct ablkcipher_tfm *crt = crypto_ablkcipher_crt(tfm);
638
639 return crt->setkey(crt->base, key, keylen);
605} 640}
606 641
607static inline struct crypto_ablkcipher *crypto_ablkcipher_reqtfm( 642static inline struct crypto_ablkcipher *crypto_ablkcipher_reqtfm(
@@ -633,7 +668,7 @@ static inline unsigned int crypto_ablkcipher_reqsize(
633static inline void ablkcipher_request_set_tfm( 668static inline void ablkcipher_request_set_tfm(
634 struct ablkcipher_request *req, struct crypto_ablkcipher *tfm) 669 struct ablkcipher_request *req, struct crypto_ablkcipher *tfm)
635{ 670{
636 req->base.tfm = crypto_ablkcipher_tfm(tfm); 671 req->base.tfm = crypto_ablkcipher_tfm(crypto_ablkcipher_crt(tfm)->base);
637} 672}
638 673
639static inline struct ablkcipher_request *ablkcipher_request_cast( 674static inline struct ablkcipher_request *ablkcipher_request_cast(
@@ -686,15 +721,7 @@ static inline struct crypto_aead *__crypto_aead_cast(struct crypto_tfm *tfm)
686 return (struct crypto_aead *)tfm; 721 return (struct crypto_aead *)tfm;
687} 722}
688 723
689static inline struct crypto_aead *crypto_alloc_aead(const char *alg_name, 724struct crypto_aead *crypto_alloc_aead(const char *alg_name, u32 type, u32 mask);
690 u32 type, u32 mask)
691{
692 type &= ~CRYPTO_ALG_TYPE_MASK;
693 type |= CRYPTO_ALG_TYPE_AEAD;
694 mask |= CRYPTO_ALG_TYPE_MASK;
695
696 return __crypto_aead_cast(crypto_alloc_base(alg_name, type, mask));
697}
698 725
699static inline struct crypto_tfm *crypto_aead_tfm(struct crypto_aead *tfm) 726static inline struct crypto_tfm *crypto_aead_tfm(struct crypto_aead *tfm)
700{ 727{
@@ -749,9 +776,13 @@ static inline void crypto_aead_clear_flags(struct crypto_aead *tfm, u32 flags)
749static inline int crypto_aead_setkey(struct crypto_aead *tfm, const u8 *key, 776static inline int crypto_aead_setkey(struct crypto_aead *tfm, const u8 *key,
750 unsigned int keylen) 777 unsigned int keylen)
751{ 778{
752 return crypto_aead_crt(tfm)->setkey(tfm, key, keylen); 779 struct aead_tfm *crt = crypto_aead_crt(tfm);
780
781 return crt->setkey(crt->base, key, keylen);
753} 782}
754 783
784int crypto_aead_setauthsize(struct crypto_aead *tfm, unsigned int authsize);
785
755static inline struct crypto_aead *crypto_aead_reqtfm(struct aead_request *req) 786static inline struct crypto_aead *crypto_aead_reqtfm(struct aead_request *req)
756{ 787{
757 return __crypto_aead_cast(req->base.tfm); 788 return __crypto_aead_cast(req->base.tfm);
@@ -775,7 +806,7 @@ static inline unsigned int crypto_aead_reqsize(struct crypto_aead *tfm)
775static inline void aead_request_set_tfm(struct aead_request *req, 806static inline void aead_request_set_tfm(struct aead_request *req,
776 struct crypto_aead *tfm) 807 struct crypto_aead *tfm)
777{ 808{
778 req->base.tfm = crypto_aead_tfm(tfm); 809 req->base.tfm = crypto_aead_tfm(crypto_aead_crt(tfm)->base);
779} 810}
780 811
781static inline struct aead_request *aead_request_alloc(struct crypto_aead *tfm, 812static inline struct aead_request *aead_request_alloc(struct crypto_aead *tfm,
@@ -841,9 +872,9 @@ static inline struct crypto_blkcipher *crypto_blkcipher_cast(
841static inline struct crypto_blkcipher *crypto_alloc_blkcipher( 872static inline struct crypto_blkcipher *crypto_alloc_blkcipher(
842 const char *alg_name, u32 type, u32 mask) 873 const char *alg_name, u32 type, u32 mask)
843{ 874{
844 type &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC); 875 type &= ~CRYPTO_ALG_TYPE_MASK;
845 type |= CRYPTO_ALG_TYPE_BLKCIPHER; 876 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
846 mask |= CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC; 877 mask |= CRYPTO_ALG_TYPE_MASK;
847 878
848 return __crypto_blkcipher_cast(crypto_alloc_base(alg_name, type, mask)); 879 return __crypto_blkcipher_cast(crypto_alloc_base(alg_name, type, mask));
849} 880}
@@ -861,9 +892,9 @@ static inline void crypto_free_blkcipher(struct crypto_blkcipher *tfm)
861 892
862static inline int crypto_has_blkcipher(const char *alg_name, u32 type, u32 mask) 893static inline int crypto_has_blkcipher(const char *alg_name, u32 type, u32 mask)
863{ 894{
864 type &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC); 895 type &= ~CRYPTO_ALG_TYPE_MASK;
865 type |= CRYPTO_ALG_TYPE_BLKCIPHER; 896 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
866 mask |= CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC; 897 mask |= CRYPTO_ALG_TYPE_MASK;
867 898
868 return crypto_has_alg(alg_name, type, mask); 899 return crypto_has_alg(alg_name, type, mask);
869} 900}
@@ -1081,6 +1112,7 @@ static inline struct crypto_hash *crypto_alloc_hash(const char *alg_name,
1081 u32 type, u32 mask) 1112 u32 type, u32 mask)
1082{ 1113{
1083 type &= ~CRYPTO_ALG_TYPE_MASK; 1114 type &= ~CRYPTO_ALG_TYPE_MASK;
1115 mask &= ~CRYPTO_ALG_TYPE_MASK;
1084 type |= CRYPTO_ALG_TYPE_HASH; 1116 type |= CRYPTO_ALG_TYPE_HASH;
1085 mask |= CRYPTO_ALG_TYPE_HASH_MASK; 1117 mask |= CRYPTO_ALG_TYPE_HASH_MASK;
1086 1118
@@ -1100,6 +1132,7 @@ static inline void crypto_free_hash(struct crypto_hash *tfm)
1100static inline int crypto_has_hash(const char *alg_name, u32 type, u32 mask) 1132static inline int crypto_has_hash(const char *alg_name, u32 type, u32 mask)
1101{ 1133{
1102 type &= ~CRYPTO_ALG_TYPE_MASK; 1134 type &= ~CRYPTO_ALG_TYPE_MASK;
1135 mask &= ~CRYPTO_ALG_TYPE_MASK;
1103 type |= CRYPTO_ALG_TYPE_HASH; 1136 type |= CRYPTO_ALG_TYPE_HASH;
1104 mask |= CRYPTO_ALG_TYPE_HASH_MASK; 1137 mask |= CRYPTO_ALG_TYPE_HASH_MASK;
1105 1138
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 333c3ea82a5d..484e45c7c89a 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -205,6 +205,7 @@ struct dccp_so_feat {
205#define DCCP_SOCKOPT_CHANGE_L 3 205#define DCCP_SOCKOPT_CHANGE_L 3
206#define DCCP_SOCKOPT_CHANGE_R 4 206#define DCCP_SOCKOPT_CHANGE_R 4
207#define DCCP_SOCKOPT_GET_CUR_MPS 5 207#define DCCP_SOCKOPT_GET_CUR_MPS 5
208#define DCCP_SOCKOPT_SERVER_TIMEWAIT 6
208#define DCCP_SOCKOPT_SEND_CSCOV 10 209#define DCCP_SOCKOPT_SEND_CSCOV 10
209#define DCCP_SOCKOPT_RECV_CSCOV 11 210#define DCCP_SOCKOPT_RECV_CSCOV 11
210#define DCCP_SOCKOPT_CCID_RX_INFO 128 211#define DCCP_SOCKOPT_CCID_RX_INFO 128
@@ -227,37 +228,50 @@ struct dccp_so_feat {
227#include <net/tcp_states.h> 228#include <net/tcp_states.h>
228 229
229enum dccp_state { 230enum dccp_state {
230 DCCP_OPEN = TCP_ESTABLISHED, 231 DCCP_OPEN = TCP_ESTABLISHED,
231 DCCP_REQUESTING = TCP_SYN_SENT, 232 DCCP_REQUESTING = TCP_SYN_SENT,
232 DCCP_PARTOPEN = TCP_FIN_WAIT1, /* FIXME: 233 DCCP_LISTEN = TCP_LISTEN,
233 This mapping is horrible, but TCP has 234 DCCP_RESPOND = TCP_SYN_RECV,
234 no matching state for DCCP_PARTOPEN, 235 /*
235 as TCP_SYN_RECV is already used by 236 * States involved in closing a DCCP connection:
236 DCCP_RESPOND, why don't stop using TCP 237 * 1) ACTIVE_CLOSEREQ is entered by a server sending a CloseReq.
237 mapping of states? OK, now we don't use 238 *
238 sk_stream_sendmsg anymore, so doesn't 239 * 2) CLOSING can have three different meanings (RFC 4340, 8.3):
239 seem to exist any reason for us to 240 * a. Client has performed active-close, has sent a Close to the server
240 do the TCP mapping here */ 241 * from state OPEN or PARTOPEN, and is waiting for the final Reset
241 DCCP_LISTEN = TCP_LISTEN, 242 * (in this case, SOCK_DONE == 1).
242 DCCP_RESPOND = TCP_SYN_RECV, 243 * b. Client is asked to perform passive-close, by receiving a CloseReq
243 DCCP_CLOSING = TCP_CLOSING, 244 * in (PART)OPEN state. It sends a Close and waits for final Reset
244 DCCP_TIME_WAIT = TCP_TIME_WAIT, 245 * (in this case, SOCK_DONE == 0).
245 DCCP_CLOSED = TCP_CLOSE, 246 * c. Server performs an active-close as in (a), keeps TIMEWAIT state.
246 DCCP_MAX_STATES = TCP_MAX_STATES, 247 *
248 * 3) The following intermediate states are employed to give passively
249 * closing nodes a chance to process their unread data:
250 * - PASSIVE_CLOSE (from OPEN => CLOSED) and
251 * - PASSIVE_CLOSEREQ (from (PART)OPEN to CLOSING; case (b) above).
252 */
253 DCCP_ACTIVE_CLOSEREQ = TCP_FIN_WAIT1,
254 DCCP_PASSIVE_CLOSE = TCP_CLOSE_WAIT, /* any node receiving a Close */
255 DCCP_CLOSING = TCP_CLOSING,
256 DCCP_TIME_WAIT = TCP_TIME_WAIT,
257 DCCP_CLOSED = TCP_CLOSE,
258 DCCP_PARTOPEN = TCP_MAX_STATES,
259 DCCP_PASSIVE_CLOSEREQ, /* clients receiving CloseReq */
260 DCCP_MAX_STATES
247}; 261};
248 262
249#define DCCP_STATE_MASK 0xf 263#define DCCP_STATE_MASK 0x1f
250#define DCCP_ACTION_FIN (1<<7)
251 264
252enum { 265enum {
253 DCCPF_OPEN = TCPF_ESTABLISHED, 266 DCCPF_OPEN = TCPF_ESTABLISHED,
254 DCCPF_REQUESTING = TCPF_SYN_SENT, 267 DCCPF_REQUESTING = TCPF_SYN_SENT,
255 DCCPF_PARTOPEN = TCPF_FIN_WAIT1, 268 DCCPF_LISTEN = TCPF_LISTEN,
256 DCCPF_LISTEN = TCPF_LISTEN, 269 DCCPF_RESPOND = TCPF_SYN_RECV,
257 DCCPF_RESPOND = TCPF_SYN_RECV, 270 DCCPF_ACTIVE_CLOSEREQ = TCPF_FIN_WAIT1,
258 DCCPF_CLOSING = TCPF_CLOSING, 271 DCCPF_CLOSING = TCPF_CLOSING,
259 DCCPF_TIME_WAIT = TCPF_TIME_WAIT, 272 DCCPF_TIME_WAIT = TCPF_TIME_WAIT,
260 DCCPF_CLOSED = TCPF_CLOSE, 273 DCCPF_CLOSED = TCPF_CLOSE,
274 DCCPF_PARTOPEN = (1 << DCCP_PARTOPEN),
261}; 275};
262 276
263static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb) 277static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb)
@@ -393,13 +407,23 @@ struct dccp_opt_pend {
393 407
394extern void dccp_minisock_init(struct dccp_minisock *dmsk); 408extern void dccp_minisock_init(struct dccp_minisock *dmsk);
395 409
396extern int dccp_parse_options(struct sock *sk, struct sk_buff *skb); 410/**
397 411 * struct dccp_request_sock - represent DCCP-specific connection request
412 * @dreq_inet_rsk: structure inherited from
413 * @dreq_iss: initial sequence number sent on the Response (RFC 4340, 7.1)
414 * @dreq_isr: initial sequence number received on the Request
415 * @dreq_service: service code present on the Request (there is just one)
416 * The following two fields are analogous to the ones in dccp_sock:
417 * @dreq_timestamp_echo: last received timestamp to echo (13.1)
418 * @dreq_timestamp_echo: the time of receiving the last @dreq_timestamp_echo
419 */
398struct dccp_request_sock { 420struct dccp_request_sock {
399 struct inet_request_sock dreq_inet_rsk; 421 struct inet_request_sock dreq_inet_rsk;
400 __u64 dreq_iss; 422 __u64 dreq_iss;
401 __u64 dreq_isr; 423 __u64 dreq_isr;
402 __be32 dreq_service; 424 __be32 dreq_service;
425 __u32 dreq_timestamp_echo;
426 __u32 dreq_timestamp_time;
403}; 427};
404 428
405static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req) 429static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req)
@@ -409,6 +433,9 @@ static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req)
409 433
410extern struct inet_timewait_death_row dccp_death_row; 434extern struct inet_timewait_death_row dccp_death_row;
411 435
436extern int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq,
437 struct sk_buff *skb);
438
412struct dccp_options_received { 439struct dccp_options_received {
413 u32 dccpor_ndp; /* only 24 bits */ 440 u32 dccpor_ndp; /* only 24 bits */
414 u32 dccpor_timestamp; 441 u32 dccpor_timestamp;
@@ -462,8 +489,8 @@ struct dccp_ackvec;
462 * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss 489 * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss
463 * @dccps_service - first (passive sock) or unique (active sock) service code 490 * @dccps_service - first (passive sock) or unique (active sock) service code
464 * @dccps_service_list - second .. last service code on passive socket 491 * @dccps_service_list - second .. last service code on passive socket
465 * @dccps_timestamp_time - time of latest TIMESTAMP option
466 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option 492 * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option
493 * @dccps_timestamp_time - time of receiving latest @dccps_timestamp_echo
467 * @dccps_l_ack_ratio - feature-local Ack Ratio 494 * @dccps_l_ack_ratio - feature-local Ack Ratio
468 * @dccps_r_ack_ratio - feature-remote Ack Ratio 495 * @dccps_r_ack_ratio - feature-remote Ack Ratio
469 * @dccps_pcslen - sender partial checksum coverage (via sockopt) 496 * @dccps_pcslen - sender partial checksum coverage (via sockopt)
@@ -479,6 +506,7 @@ struct dccp_ackvec;
479 * @dccps_role - role of this sock, one of %dccp_role 506 * @dccps_role - role of this sock, one of %dccp_role
480 * @dccps_hc_rx_insert_options - receiver wants to add options when acking 507 * @dccps_hc_rx_insert_options - receiver wants to add options when acking
481 * @dccps_hc_tx_insert_options - sender wants to add options when sending 508 * @dccps_hc_tx_insert_options - sender wants to add options when sending
509 * @dccps_server_timewait - server holds timewait state on close (RFC 4340, 8.3)
482 * @dccps_xmit_timer - timer for when CCID is not ready to send 510 * @dccps_xmit_timer - timer for when CCID is not ready to send
483 * @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs) 511 * @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs)
484 */ 512 */
@@ -498,8 +526,8 @@ struct dccp_sock {
498 __u64 dccps_gar; 526 __u64 dccps_gar;
499 __be32 dccps_service; 527 __be32 dccps_service;
500 struct dccp_service_list *dccps_service_list; 528 struct dccp_service_list *dccps_service_list;
501 ktime_t dccps_timestamp_time;
502 __u32 dccps_timestamp_echo; 529 __u32 dccps_timestamp_echo;
530 __u32 dccps_timestamp_time;
503 __u16 dccps_l_ack_ratio; 531 __u16 dccps_l_ack_ratio;
504 __u16 dccps_r_ack_ratio; 532 __u16 dccps_r_ack_ratio;
505 __u16 dccps_pcslen; 533 __u16 dccps_pcslen;
@@ -515,6 +543,7 @@ struct dccp_sock {
515 enum dccp_role dccps_role:2; 543 enum dccp_role dccps_role:2;
516 __u8 dccps_hc_rx_insert_options:1; 544 __u8 dccps_hc_rx_insert_options:1;
517 __u8 dccps_hc_tx_insert_options:1; 545 __u8 dccps_hc_tx_insert_options:1;
546 __u8 dccps_server_timewait:1;
518 struct timer_list dccps_xmit_timer; 547 struct timer_list dccps_xmit_timer;
519}; 548};
520 549
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h
index 1678a5de7013..f4a5871767f5 100644
--- a/include/linux/debug_locks.h
+++ b/include/linux/debug_locks.h
@@ -47,6 +47,7 @@ struct task_struct;
47 47
48#ifdef CONFIG_LOCKDEP 48#ifdef CONFIG_LOCKDEP
49extern void debug_show_all_locks(void); 49extern void debug_show_all_locks(void);
50extern void __debug_show_held_locks(struct task_struct *task);
50extern void debug_show_held_locks(struct task_struct *task); 51extern void debug_show_held_locks(struct task_struct *task);
51extern void debug_check_no_locks_freed(const void *from, unsigned long len); 52extern void debug_check_no_locks_freed(const void *from, unsigned long len);
52extern void debug_check_no_locks_held(struct task_struct *task); 53extern void debug_check_no_locks_held(struct task_struct *task);
@@ -55,6 +56,10 @@ static inline void debug_show_all_locks(void)
55{ 56{
56} 57}
57 58
59static inline void __debug_show_held_locks(struct task_struct *task)
60{
61}
62
58static inline void debug_show_held_locks(struct task_struct *task) 63static inline void debug_show_held_locks(struct task_struct *task)
59{ 64{
60} 65}
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 37c66d1254b5..e765e191663d 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -115,7 +115,9 @@ struct io_restrictions {
115 unsigned short max_hw_segments; 115 unsigned short max_hw_segments;
116 unsigned short hardsect_size; 116 unsigned short hardsect_size;
117 unsigned int max_segment_size; 117 unsigned int max_segment_size;
118 unsigned int max_hw_sectors;
118 unsigned long seg_boundary_mask; 119 unsigned long seg_boundary_mask;
120 unsigned long bounce_pfn;
119 unsigned char no_cluster; /* inverted so that 0 is default */ 121 unsigned char no_cluster; /* inverted so that 0 is default */
120}; 122};
121 123
diff --git a/include/linux/device.h b/include/linux/device.h
index 2e15822fe409..db375be333c7 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -25,75 +25,72 @@
25#include <asm/device.h> 25#include <asm/device.h>
26 26
27#define DEVICE_NAME_SIZE 50 27#define DEVICE_NAME_SIZE 50
28#define DEVICE_NAME_HALF __stringify(20) /* Less than half to accommodate slop */ 28/* DEVICE_NAME_HALF is really less than half to accommodate slop */
29#define DEVICE_NAME_HALF __stringify(20)
29#define DEVICE_ID_SIZE 32 30#define DEVICE_ID_SIZE 32
30#define BUS_ID_SIZE KOBJ_NAME_LEN 31#define BUS_ID_SIZE KOBJ_NAME_LEN
31 32
32 33
33struct device; 34struct device;
34struct device_driver; 35struct device_driver;
36struct driver_private;
35struct class; 37struct class;
36struct class_device; 38struct class_device;
37struct bus_type; 39struct bus_type;
40struct bus_type_private;
38 41
39struct bus_attribute { 42struct bus_attribute {
40 struct attribute attr; 43 struct attribute attr;
41 ssize_t (*show)(struct bus_type *, char * buf); 44 ssize_t (*show)(struct bus_type *bus, char *buf);
42 ssize_t (*store)(struct bus_type *, const char * buf, size_t count); 45 ssize_t (*store)(struct bus_type *bus, const char *buf, size_t count);
43}; 46};
44 47
45#define BUS_ATTR(_name,_mode,_show,_store) \ 48#define BUS_ATTR(_name, _mode, _show, _store) \
46struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store) 49struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store)
47 50
48extern int __must_check bus_create_file(struct bus_type *, 51extern int __must_check bus_create_file(struct bus_type *,
49 struct bus_attribute *); 52 struct bus_attribute *);
50extern void bus_remove_file(struct bus_type *, struct bus_attribute *); 53extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
51 54
52struct bus_type { 55struct bus_type {
53 const char * name; 56 const char *name;
54 struct module * owner; 57 struct bus_attribute *bus_attrs;
58 struct device_attribute *dev_attrs;
59 struct driver_attribute *drv_attrs;
55 60
56 struct kset subsys; 61 int (*match)(struct device *dev, struct device_driver *drv);
57 struct kset drivers; 62 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
58 struct kset devices; 63 int (*probe)(struct device *dev);
59 struct klist klist_devices; 64 int (*remove)(struct device *dev);
60 struct klist klist_drivers; 65 void (*shutdown)(struct device *dev);
61
62 struct blocking_notifier_head bus_notifier;
63
64 struct bus_attribute * bus_attrs;
65 struct device_attribute * dev_attrs;
66 struct driver_attribute * drv_attrs;
67
68 int (*match)(struct device * dev, struct device_driver * drv);
69 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
70 int (*probe)(struct device * dev);
71 int (*remove)(struct device * dev);
72 void (*shutdown)(struct device * dev);
73 66
74 int (*suspend)(struct device * dev, pm_message_t state); 67 int (*suspend)(struct device *dev, pm_message_t state);
75 int (*suspend_late)(struct device * dev, pm_message_t state); 68 int (*suspend_late)(struct device *dev, pm_message_t state);
76 int (*resume_early)(struct device * dev); 69 int (*resume_early)(struct device *dev);
77 int (*resume)(struct device * dev); 70 int (*resume)(struct device *dev);
78 71
79 unsigned int drivers_autoprobe:1; 72 struct bus_type_private *p;
80}; 73};
81 74
82extern int __must_check bus_register(struct bus_type * bus); 75extern int __must_check bus_register(struct bus_type *bus);
83extern void bus_unregister(struct bus_type * bus); 76extern void bus_unregister(struct bus_type *bus);
84 77
85extern int __must_check bus_rescan_devices(struct bus_type * bus); 78extern int __must_check bus_rescan_devices(struct bus_type *bus);
86 79
87/* iterator helpers for buses */ 80/* iterator helpers for buses */
88 81
89int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data, 82int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
90 int (*fn)(struct device *, void *)); 83 int (*fn)(struct device *dev, void *data));
91struct device * bus_find_device(struct bus_type *bus, struct device *start, 84struct device *bus_find_device(struct bus_type *bus, struct device *start,
92 void *data, int (*match)(struct device *, void *)); 85 void *data,
86 int (*match)(struct device *dev, void *data));
87struct device *bus_find_device_by_name(struct bus_type *bus,
88 struct device *start,
89 const char *name);
93 90
94int __must_check bus_for_each_drv(struct bus_type *bus, 91int __must_check bus_for_each_drv(struct bus_type *bus,
95 struct device_driver *start, void *data, 92 struct device_driver *start, void *data,
96 int (*fn)(struct device_driver *, void *)); 93 int (*fn)(struct device_driver *, void *));
97 94
98/* 95/*
99 * Bus notifiers: Get notified of addition/removal of devices 96 * Bus notifiers: Get notified of addition/removal of devices
@@ -118,111 +115,128 @@ extern int bus_unregister_notifier(struct bus_type *bus,
118#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be 115#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be
119 unbound */ 116 unbound */
120 117
118extern struct kset *bus_get_kset(struct bus_type *bus);
119extern struct klist *bus_get_device_klist(struct bus_type *bus);
120
121struct device_driver { 121struct device_driver {
122 const char * name; 122 const char *name;
123 struct bus_type * bus; 123 struct bus_type *bus;
124 124
125 struct kobject kobj; 125 struct module *owner;
126 struct klist klist_devices; 126 const char *mod_name; /* used for built-in modules */
127 struct klist_node knode_bus;
128 127
129 struct module * owner; 128 int (*probe) (struct device *dev);
130 const char * mod_name; /* used for built-in modules */ 129 int (*remove) (struct device *dev);
131 struct module_kobject * mkobj; 130 void (*shutdown) (struct device *dev);
131 int (*suspend) (struct device *dev, pm_message_t state);
132 int (*resume) (struct device *dev);
133 struct attribute_group **groups;
132 134
133 int (*probe) (struct device * dev); 135 struct driver_private *p;
134 int (*remove) (struct device * dev);
135 void (*shutdown) (struct device * dev);
136 int (*suspend) (struct device * dev, pm_message_t state);
137 int (*resume) (struct device * dev);
138}; 136};
139 137
140 138
141extern int __must_check driver_register(struct device_driver * drv); 139extern int __must_check driver_register(struct device_driver *drv);
142extern void driver_unregister(struct device_driver * drv); 140extern void driver_unregister(struct device_driver *drv);
143 141
144extern struct device_driver * get_driver(struct device_driver * drv); 142extern struct device_driver *get_driver(struct device_driver *drv);
145extern void put_driver(struct device_driver * drv); 143extern void put_driver(struct device_driver *drv);
146extern struct device_driver *driver_find(const char *name, struct bus_type *bus); 144extern struct device_driver *driver_find(const char *name,
145 struct bus_type *bus);
147extern int driver_probe_done(void); 146extern int driver_probe_done(void);
148 147
149/* sysfs interface for exporting driver attributes */ 148/* sysfs interface for exporting driver attributes */
150 149
151struct driver_attribute { 150struct driver_attribute {
152 struct attribute attr; 151 struct attribute attr;
153 ssize_t (*show)(struct device_driver *, char * buf); 152 ssize_t (*show)(struct device_driver *driver, char *buf);
154 ssize_t (*store)(struct device_driver *, const char * buf, size_t count); 153 ssize_t (*store)(struct device_driver *driver, const char *buf,
154 size_t count);
155}; 155};
156 156
157#define DRIVER_ATTR(_name,_mode,_show,_store) \ 157#define DRIVER_ATTR(_name, _mode, _show, _store) \
158struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store) 158struct driver_attribute driver_attr_##_name = \
159 __ATTR(_name, _mode, _show, _store)
159 160
160extern int __must_check driver_create_file(struct device_driver *, 161extern int __must_check driver_create_file(struct device_driver *driver,
161 struct driver_attribute *); 162 struct driver_attribute *attr);
162extern void driver_remove_file(struct device_driver *, struct driver_attribute *); 163extern void driver_remove_file(struct device_driver *driver,
164 struct driver_attribute *attr);
163 165
164extern int __must_check driver_for_each_device(struct device_driver * drv, 166extern int __must_check driver_add_kobj(struct device_driver *drv,
165 struct device *start, void *data, 167 struct kobject *kobj,
166 int (*fn)(struct device *, void *)); 168 const char *fmt, ...);
167struct device * driver_find_device(struct device_driver *drv, 169
168 struct device *start, void *data, 170extern int __must_check driver_for_each_device(struct device_driver *drv,
169 int (*match)(struct device *, void *)); 171 struct device *start,
172 void *data,
173 int (*fn)(struct device *dev,
174 void *));
175struct device *driver_find_device(struct device_driver *drv,
176 struct device *start, void *data,
177 int (*match)(struct device *dev, void *data));
170 178
171/* 179/*
172 * device classes 180 * device classes
173 */ 181 */
174struct class { 182struct class {
175 const char * name; 183 const char *name;
176 struct module * owner; 184 struct module *owner;
177 185
178 struct kset subsys; 186 struct kset subsys;
179 struct list_head children; 187 struct list_head children;
180 struct list_head devices; 188 struct list_head devices;
181 struct list_head interfaces; 189 struct list_head interfaces;
182 struct kset class_dirs; 190 struct kset class_dirs;
183 struct semaphore sem; /* locks both the children and interfaces lists */ 191 struct semaphore sem; /* locks children, devices, interfaces */
184 192 struct class_attribute *class_attrs;
185 struct class_attribute * class_attrs; 193 struct class_device_attribute *class_dev_attrs;
186 struct class_device_attribute * class_dev_attrs; 194 struct device_attribute *dev_attrs;
187 struct device_attribute * dev_attrs;
188 195
189 int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env); 196 int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env);
190 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 197 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
191 198
192 void (*release)(struct class_device *dev); 199 void (*release)(struct class_device *dev);
193 void (*class_release)(struct class *class); 200 void (*class_release)(struct class *class);
194 void (*dev_release)(struct device *dev); 201 void (*dev_release)(struct device *dev);
195 202
196 int (*suspend)(struct device *, pm_message_t state); 203 int (*suspend)(struct device *dev, pm_message_t state);
197 int (*resume)(struct device *); 204 int (*resume)(struct device *dev);
198}; 205};
199 206
200extern int __must_check class_register(struct class *); 207extern int __must_check class_register(struct class *class);
201extern void class_unregister(struct class *); 208extern void class_unregister(struct class *class);
209extern int class_for_each_device(struct class *class, void *data,
210 int (*fn)(struct device *dev, void *data));
211extern struct device *class_find_device(struct class *class, void *data,
212 int (*match)(struct device *, void *));
213extern struct class_device *class_find_child(struct class *class, void *data,
214 int (*match)(struct class_device *, void *));
202 215
203 216
204struct class_attribute { 217struct class_attribute {
205 struct attribute attr; 218 struct attribute attr;
206 ssize_t (*show)(struct class *, char * buf); 219 ssize_t (*show)(struct class *class, char *buf);
207 ssize_t (*store)(struct class *, const char * buf, size_t count); 220 ssize_t (*store)(struct class *class, const char *buf, size_t count);
208}; 221};
209 222
210#define CLASS_ATTR(_name,_mode,_show,_store) \ 223#define CLASS_ATTR(_name, _mode, _show, _store) \
211struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store) 224struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store)
212 225
213extern int __must_check class_create_file(struct class *, 226extern int __must_check class_create_file(struct class *class,
214 const struct class_attribute *); 227 const struct class_attribute *attr);
215extern void class_remove_file(struct class *, const struct class_attribute *); 228extern void class_remove_file(struct class *class,
229 const struct class_attribute *attr);
216 230
217struct class_device_attribute { 231struct class_device_attribute {
218 struct attribute attr; 232 struct attribute attr;
219 ssize_t (*show)(struct class_device *, char * buf); 233 ssize_t (*show)(struct class_device *, char *buf);
220 ssize_t (*store)(struct class_device *, const char * buf, size_t count); 234 ssize_t (*store)(struct class_device *, const char *buf, size_t count);
221}; 235};
222 236
223#define CLASS_DEVICE_ATTR(_name,_mode,_show,_store) \ 237#define CLASS_DEVICE_ATTR(_name, _mode, _show, _store) \
224struct class_device_attribute class_device_attr_##_name = \ 238struct class_device_attribute class_device_attr_##_name = \
225 __ATTR(_name,_mode,_show,_store) 239 __ATTR(_name, _mode, _show, _store)
226 240
227extern int __must_check class_device_create_file(struct class_device *, 241extern int __must_check class_device_create_file(struct class_device *,
228 const struct class_device_attribute *); 242 const struct class_device_attribute *);
@@ -255,26 +269,24 @@ struct class_device {
255 struct list_head node; 269 struct list_head node;
256 270
257 struct kobject kobj; 271 struct kobject kobj;
258 struct class * class; /* required */ 272 struct class *class;
259 dev_t devt; /* dev_t, creates the sysfs "dev" */ 273 dev_t devt;
260 struct device * dev; /* not necessary, but nice to have */ 274 struct device *dev;
261 void * class_data; /* class-specific data */ 275 void *class_data;
262 struct class_device *parent; /* parent of this child device, if there is one */ 276 struct class_device *parent;
263 struct attribute_group ** groups; /* optional groups */ 277 struct attribute_group **groups;
264 278
265 void (*release)(struct class_device *dev); 279 void (*release)(struct class_device *dev);
266 int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env); 280 int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env);
267 char class_id[BUS_ID_SIZE]; /* unique to this class */ 281 char class_id[BUS_ID_SIZE];
268}; 282};
269 283
270static inline void * 284static inline void *class_get_devdata(struct class_device *dev)
271class_get_devdata (struct class_device *dev)
272{ 285{
273 return dev->class_data; 286 return dev->class_data;
274} 287}
275 288
276static inline void 289static inline void class_set_devdata(struct class_device *dev, void *data)
277class_set_devdata (struct class_device *dev, void *data)
278{ 290{
279 dev->class_data = data; 291 dev->class_data = data;
280} 292}
@@ -286,10 +298,10 @@ extern void class_device_initialize(struct class_device *);
286extern int __must_check class_device_add(struct class_device *); 298extern int __must_check class_device_add(struct class_device *);
287extern void class_device_del(struct class_device *); 299extern void class_device_del(struct class_device *);
288 300
289extern struct class_device * class_device_get(struct class_device *); 301extern struct class_device *class_device_get(struct class_device *);
290extern void class_device_put(struct class_device *); 302extern void class_device_put(struct class_device *);
291 303
292extern void class_device_remove_file(struct class_device *, 304extern void class_device_remove_file(struct class_device *,
293 const struct class_device_attribute *); 305 const struct class_device_attribute *);
294extern int __must_check class_device_create_bin_file(struct class_device *, 306extern int __must_check class_device_create_bin_file(struct class_device *,
295 struct bin_attribute *); 307 struct bin_attribute *);
@@ -316,7 +328,7 @@ extern struct class_device *class_device_create(struct class *cls,
316 dev_t devt, 328 dev_t devt,
317 struct device *device, 329 struct device *device,
318 const char *fmt, ...) 330 const char *fmt, ...)
319 __attribute__((format(printf,5,6))); 331 __attribute__((format(printf, 5, 6)));
320extern void class_device_destroy(struct class *cls, dev_t devt); 332extern void class_device_destroy(struct class *cls, dev_t devt);
321 333
322/* 334/*
@@ -333,8 +345,8 @@ struct device_type {
333 struct attribute_group **groups; 345 struct attribute_group **groups;
334 int (*uevent)(struct device *dev, struct kobj_uevent_env *env); 346 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
335 void (*release)(struct device *dev); 347 void (*release)(struct device *dev);
336 int (*suspend)(struct device * dev, pm_message_t state); 348 int (*suspend)(struct device *dev, pm_message_t state);
337 int (*resume)(struct device * dev); 349 int (*resume)(struct device *dev);
338}; 350};
339 351
340/* interface for exporting device attributes */ 352/* interface for exporting device attributes */
@@ -346,18 +358,19 @@ struct device_attribute {
346 const char *buf, size_t count); 358 const char *buf, size_t count);
347}; 359};
348 360
349#define DEVICE_ATTR(_name,_mode,_show,_store) \ 361#define DEVICE_ATTR(_name, _mode, _show, _store) \
350struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store) 362struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
351 363
352extern int __must_check device_create_file(struct device *device, 364extern int __must_check device_create_file(struct device *device,
353 struct device_attribute * entry); 365 struct device_attribute *entry);
354extern void device_remove_file(struct device * dev, struct device_attribute * attr); 366extern void device_remove_file(struct device *dev,
367 struct device_attribute *attr);
355extern int __must_check device_create_bin_file(struct device *dev, 368extern int __must_check device_create_bin_file(struct device *dev,
356 struct bin_attribute *attr); 369 struct bin_attribute *attr);
357extern void device_remove_bin_file(struct device *dev, 370extern void device_remove_bin_file(struct device *dev,
358 struct bin_attribute *attr); 371 struct bin_attribute *attr);
359extern int device_schedule_callback_owner(struct device *dev, 372extern int device_schedule_callback_owner(struct device *dev,
360 void (*func)(struct device *), struct module *owner); 373 void (*func)(struct device *dev), struct module *owner);
361 374
362/* This is a macro to avoid include problems with THIS_MODULE */ 375/* This is a macro to avoid include problems with THIS_MODULE */
363#define device_schedule_callback(dev, func) \ 376#define device_schedule_callback(dev, func) \
@@ -368,21 +381,21 @@ typedef void (*dr_release_t)(struct device *dev, void *res);
368typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data); 381typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data);
369 382
370#ifdef CONFIG_DEBUG_DEVRES 383#ifdef CONFIG_DEBUG_DEVRES
371extern void * __devres_alloc(dr_release_t release, size_t size, gfp_t gfp, 384extern void *__devres_alloc(dr_release_t release, size_t size, gfp_t gfp,
372 const char *name); 385 const char *name);
373#define devres_alloc(release, size, gfp) \ 386#define devres_alloc(release, size, gfp) \
374 __devres_alloc(release, size, gfp, #release) 387 __devres_alloc(release, size, gfp, #release)
375#else 388#else
376extern void * devres_alloc(dr_release_t release, size_t size, gfp_t gfp); 389extern void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp);
377#endif 390#endif
378extern void devres_free(void *res); 391extern void devres_free(void *res);
379extern void devres_add(struct device *dev, void *res); 392extern void devres_add(struct device *dev, void *res);
380extern void * devres_find(struct device *dev, dr_release_t release, 393extern void *devres_find(struct device *dev, dr_release_t release,
381 dr_match_t match, void *match_data);
382extern void * devres_get(struct device *dev, void *new_res,
383 dr_match_t match, void *match_data); 394 dr_match_t match, void *match_data);
384extern void * devres_remove(struct device *dev, dr_release_t release, 395extern void *devres_get(struct device *dev, void *new_res,
385 dr_match_t match, void *match_data); 396 dr_match_t match, void *match_data);
397extern void *devres_remove(struct device *dev, dr_release_t release,
398 dr_match_t match, void *match_data);
386extern int devres_destroy(struct device *dev, dr_release_t release, 399extern int devres_destroy(struct device *dev, dr_release_t release,
387 dr_match_t match, void *match_data); 400 dr_match_t match, void *match_data);
388 401
@@ -399,7 +412,7 @@ extern void devm_kfree(struct device *dev, void *p);
399 412
400struct device { 413struct device {
401 struct klist klist_children; 414 struct klist klist_children;
402 struct klist_node knode_parent; /* node in sibling list */ 415 struct klist_node knode_parent; /* node in sibling list */
403 struct klist_node knode_driver; 416 struct klist_node knode_driver;
404 struct klist_node knode_bus; 417 struct klist_node knode_bus;
405 struct device *parent; 418 struct device *parent;
@@ -414,7 +427,7 @@ struct device {
414 * its driver. 427 * its driver.
415 */ 428 */
416 429
417 struct bus_type * bus; /* type of bus device is on */ 430 struct bus_type *bus; /* type of bus device is on */
418 struct device_driver *driver; /* which driver has allocated this 431 struct device_driver *driver; /* which driver has allocated this
419 device */ 432 device */
420 void *driver_data; /* data private to the driver */ 433 void *driver_data; /* data private to the driver */
@@ -445,10 +458,10 @@ struct device {
445 /* class_device migration path */ 458 /* class_device migration path */
446 struct list_head node; 459 struct list_head node;
447 struct class *class; 460 struct class *class;
448 dev_t devt; /* dev_t, creates the sysfs "dev" */ 461 dev_t devt; /* dev_t, creates the sysfs "dev" */
449 struct attribute_group **groups; /* optional groups */ 462 struct attribute_group **groups; /* optional groups */
450 463
451 void (*release)(struct device * dev); 464 void (*release)(struct device *dev);
452}; 465};
453 466
454#ifdef CONFIG_NUMA 467#ifdef CONFIG_NUMA
@@ -470,14 +483,12 @@ static inline void set_dev_node(struct device *dev, int node)
470} 483}
471#endif 484#endif
472 485
473static inline void * 486static inline void *dev_get_drvdata(struct device *dev)
474dev_get_drvdata (struct device *dev)
475{ 487{
476 return dev->driver_data; 488 return dev->driver_data;
477} 489}
478 490
479static inline void 491static inline void dev_set_drvdata(struct device *dev, void *data)
480dev_set_drvdata (struct device *dev, void *data)
481{ 492{
482 dev->driver_data = data; 493 dev->driver_data = data;
483} 494}
@@ -492,15 +503,15 @@ void driver_init(void);
492/* 503/*
493 * High level routines for use by the bus drivers 504 * High level routines for use by the bus drivers
494 */ 505 */
495extern int __must_check device_register(struct device * dev); 506extern int __must_check device_register(struct device *dev);
496extern void device_unregister(struct device * dev); 507extern void device_unregister(struct device *dev);
497extern void device_initialize(struct device * dev); 508extern void device_initialize(struct device *dev);
498extern int __must_check device_add(struct device * dev); 509extern int __must_check device_add(struct device *dev);
499extern void device_del(struct device * dev); 510extern void device_del(struct device *dev);
500extern int device_for_each_child(struct device *, void *, 511extern int device_for_each_child(struct device *dev, void *data,
501 int (*fn)(struct device *, void *)); 512 int (*fn)(struct device *dev, void *data));
502extern struct device *device_find_child(struct device *, void *data, 513extern struct device *device_find_child(struct device *dev, void *data,
503 int (*match)(struct device *, void *)); 514 int (*match)(struct device *dev, void *data));
504extern int device_rename(struct device *dev, char *new_name); 515extern int device_rename(struct device *dev, char *new_name);
505extern int device_move(struct device *dev, struct device *new_parent); 516extern int device_move(struct device *dev, struct device *new_parent);
506 517
@@ -509,8 +520,8 @@ extern int device_move(struct device *dev, struct device *new_parent);
509 * for information on use. 520 * for information on use.
510 */ 521 */
511extern int __must_check device_bind_driver(struct device *dev); 522extern int __must_check device_bind_driver(struct device *dev);
512extern void device_release_driver(struct device * dev); 523extern void device_release_driver(struct device *dev);
513extern int __must_check device_attach(struct device * dev); 524extern int __must_check device_attach(struct device *dev);
514extern int __must_check driver_attach(struct device_driver *drv); 525extern int __must_check driver_attach(struct device_driver *drv);
515extern int __must_check device_reprobe(struct device *dev); 526extern int __must_check device_reprobe(struct device *dev);
516 527
@@ -519,8 +530,16 @@ extern int __must_check device_reprobe(struct device *dev);
519 */ 530 */
520extern struct device *device_create(struct class *cls, struct device *parent, 531extern struct device *device_create(struct class *cls, struct device *parent,
521 dev_t devt, const char *fmt, ...) 532 dev_t devt, const char *fmt, ...)
522 __attribute__((format(printf,4,5))); 533 __attribute__((format(printf, 4, 5)));
523extern void device_destroy(struct class *cls, dev_t devt); 534extern void device_destroy(struct class *cls, dev_t devt);
535#ifdef CONFIG_PM_SLEEP
536extern void destroy_suspended_device(struct class *cls, dev_t devt);
537#else /* !CONFIG_PM_SLEEP */
538static inline void destroy_suspended_device(struct class *cls, dev_t devt)
539{
540 device_destroy(cls, devt);
541}
542#endif /* !CONFIG_PM_SLEEP */
524 543
525/* 544/*
526 * Platform "fixup" functions - allow the platform to have their say 545 * Platform "fixup" functions - allow the platform to have their say
@@ -528,17 +547,17 @@ extern void device_destroy(struct class *cls, dev_t devt);
528 * know about. 547 * know about.
529 */ 548 */
530/* Notify platform of device discovery */ 549/* Notify platform of device discovery */
531extern int (*platform_notify)(struct device * dev); 550extern int (*platform_notify)(struct device *dev);
532 551
533extern int (*platform_notify_remove)(struct device * dev); 552extern int (*platform_notify_remove)(struct device *dev);
534 553
535 554
536/** 555/**
537 * get_device - atomically increment the reference count for the device. 556 * get_device - atomically increment the reference count for the device.
538 * 557 *
539 */ 558 */
540extern struct device * get_device(struct device * dev); 559extern struct device *get_device(struct device *dev);
541extern void put_device(struct device * dev); 560extern void put_device(struct device *dev);
542 561
543 562
544/* drivers/base/power/shutdown.c */ 563/* drivers/base/power/shutdown.c */
@@ -547,22 +566,33 @@ extern void device_shutdown(void);
547/* drivers/base/sys.c */ 566/* drivers/base/sys.c */
548extern void sysdev_shutdown(void); 567extern void sysdev_shutdown(void);
549 568
550
551/* drivers/base/firmware.c */
552extern int __must_check firmware_register(struct kset *);
553extern void firmware_unregister(struct kset *);
554
555/* debugging and troubleshooting/diagnostic helpers. */ 569/* debugging and troubleshooting/diagnostic helpers. */
556extern const char *dev_driver_string(struct device *dev); 570extern const char *dev_driver_string(struct device *dev);
557#define dev_printk(level, dev, format, arg...) \ 571#define dev_printk(level, dev, format, arg...) \
558 printk(level "%s %s: " format , dev_driver_string(dev) , (dev)->bus_id , ## arg) 572 printk(level "%s %s: " format , dev_driver_string(dev) , \
573 (dev)->bus_id , ## arg)
574
575#define dev_emerg(dev, format, arg...) \
576 dev_printk(KERN_EMERG , dev , format , ## arg)
577#define dev_alert(dev, format, arg...) \
578 dev_printk(KERN_ALERT , dev , format , ## arg)
579#define dev_crit(dev, format, arg...) \
580 dev_printk(KERN_CRIT , dev , format , ## arg)
581#define dev_err(dev, format, arg...) \
582 dev_printk(KERN_ERR , dev , format , ## arg)
583#define dev_warn(dev, format, arg...) \
584 dev_printk(KERN_WARNING , dev , format , ## arg)
585#define dev_notice(dev, format, arg...) \
586 dev_printk(KERN_NOTICE , dev , format , ## arg)
587#define dev_info(dev, format, arg...) \
588 dev_printk(KERN_INFO , dev , format , ## arg)
559 589
560#ifdef DEBUG 590#ifdef DEBUG
561#define dev_dbg(dev, format, arg...) \ 591#define dev_dbg(dev, format, arg...) \
562 dev_printk(KERN_DEBUG , dev , format , ## arg) 592 dev_printk(KERN_DEBUG , dev , format , ## arg)
563#else 593#else
564static inline int __attribute__ ((format (printf, 2, 3))) 594static inline int __attribute__ ((format (printf, 2, 3)))
565dev_dbg(struct device * dev, const char * fmt, ...) 595dev_dbg(struct device *dev, const char *fmt, ...)
566{ 596{
567 return 0; 597 return 0;
568} 598}
@@ -572,21 +602,12 @@ dev_dbg(struct device * dev, const char * fmt, ...)
572#define dev_vdbg dev_dbg 602#define dev_vdbg dev_dbg
573#else 603#else
574static inline int __attribute__ ((format (printf, 2, 3))) 604static inline int __attribute__ ((format (printf, 2, 3)))
575dev_vdbg(struct device * dev, const char * fmt, ...) 605dev_vdbg(struct device *dev, const char *fmt, ...)
576{ 606{
577 return 0; 607 return 0;
578} 608}
579#endif 609#endif
580 610
581#define dev_err(dev, format, arg...) \
582 dev_printk(KERN_ERR , dev , format , ## arg)
583#define dev_info(dev, format, arg...) \
584 dev_printk(KERN_INFO , dev , format , ## arg)
585#define dev_warn(dev, format, arg...) \
586 dev_printk(KERN_WARNING , dev , format , ## arg)
587#define dev_notice(dev, format, arg...) \
588 dev_printk(KERN_NOTICE , dev , format , ## arg)
589
590/* Create alias, so I can be autoloaded. */ 611/* Create alias, so I can be autoloaded. */
591#define MODULE_ALIAS_CHARDEV(major,minor) \ 612#define MODULE_ALIAS_CHARDEV(major,minor) \
592 MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) 613 MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
diff --git a/include/linux/dlm.h b/include/linux/dlm.h
index be9d278761e0..c743fbc769db 100644
--- a/include/linux/dlm.h
+++ b/include/linux/dlm.h
@@ -19,148 +19,12 @@
19 * routines and structures to use DLM lockspaces 19 * routines and structures to use DLM lockspaces
20 */ 20 */
21 21
22/* 22/* Lock levels and flags are here */
23 * Lock Modes 23#include <linux/dlmconstants.h>
24 */
25 24
26#define DLM_LOCK_IV -1 /* invalid */
27#define DLM_LOCK_NL 0 /* null */
28#define DLM_LOCK_CR 1 /* concurrent read */
29#define DLM_LOCK_CW 2 /* concurrent write */
30#define DLM_LOCK_PR 3 /* protected read */
31#define DLM_LOCK_PW 4 /* protected write */
32#define DLM_LOCK_EX 5 /* exclusive */
33
34/*
35 * Maximum size in bytes of a dlm_lock name
36 */
37 25
38#define DLM_RESNAME_MAXLEN 64 26#define DLM_RESNAME_MAXLEN 64
39 27
40/*
41 * Flags to dlm_lock
42 *
43 * DLM_LKF_NOQUEUE
44 *
45 * Do not queue the lock request on the wait queue if it cannot be granted
46 * immediately. If the lock cannot be granted because of this flag, DLM will
47 * either return -EAGAIN from the dlm_lock call or will return 0 from
48 * dlm_lock and -EAGAIN in the lock status block when the AST is executed.
49 *
50 * DLM_LKF_CANCEL
51 *
52 * Used to cancel a pending lock request or conversion. A converting lock is
53 * returned to its previously granted mode.
54 *
55 * DLM_LKF_CONVERT
56 *
57 * Indicates a lock conversion request. For conversions the name and namelen
58 * are ignored and the lock ID in the LKSB is used to identify the lock.
59 *
60 * DLM_LKF_VALBLK
61 *
62 * Requests DLM to return the current contents of the lock value block in the
63 * lock status block. When this flag is set in a lock conversion from PW or EX
64 * modes, DLM assigns the value specified in the lock status block to the lock
65 * value block of the lock resource. The LVB is a DLM_LVB_LEN size array
66 * containing application-specific information.
67 *
68 * DLM_LKF_QUECVT
69 *
70 * Force a conversion request to be queued, even if it is compatible with
71 * the granted modes of other locks on the same resource.
72 *
73 * DLM_LKF_IVVALBLK
74 *
75 * Invalidate the lock value block.
76 *
77 * DLM_LKF_CONVDEADLK
78 *
79 * Allows the dlm to resolve conversion deadlocks internally by demoting the
80 * granted mode of a converting lock to NL. The DLM_SBF_DEMOTED flag is
81 * returned for a conversion that's been effected by this.
82 *
83 * DLM_LKF_PERSISTENT
84 *
85 * Only relevant to locks originating in userspace. A persistent lock will not
86 * be removed if the process holding the lock exits.
87 *
88 * DLM_LKF_NODLCKWT
89 *
90 * Do not cancel the lock if it gets into conversion deadlock.
91 * Exclude this lock from being monitored due to DLM_LSFL_TIMEWARN.
92 *
93 * DLM_LKF_NODLCKBLK
94 *
95 * net yet implemented
96 *
97 * DLM_LKF_EXPEDITE
98 *
99 * Used only with new requests for NL mode locks. Tells the lock manager
100 * to grant the lock, ignoring other locks in convert and wait queues.
101 *
102 * DLM_LKF_NOQUEUEBAST
103 *
104 * Send blocking AST's before returning -EAGAIN to the caller. It is only
105 * used along with the NOQUEUE flag. Blocking AST's are not sent for failed
106 * NOQUEUE requests otherwise.
107 *
108 * DLM_LKF_HEADQUE
109 *
110 * Add a lock to the head of the convert or wait queue rather than the tail.
111 *
112 * DLM_LKF_NOORDER
113 *
114 * Disregard the standard grant order rules and grant a lock as soon as it
115 * is compatible with other granted locks.
116 *
117 * DLM_LKF_ORPHAN
118 *
119 * not yet implemented
120 *
121 * DLM_LKF_ALTPR
122 *
123 * If the requested mode cannot be granted immediately, try to grant the lock
124 * in PR mode instead. If this alternate mode is granted instead of the
125 * requested mode, DLM_SBF_ALTMODE is returned in the lksb.
126 *
127 * DLM_LKF_ALTCW
128 *
129 * The same as ALTPR, but the alternate mode is CW.
130 *
131 * DLM_LKF_FORCEUNLOCK
132 *
133 * Unlock the lock even if it is converting or waiting or has sublocks.
134 * Only really for use by the userland device.c code.
135 *
136 */
137
138#define DLM_LKF_NOQUEUE 0x00000001
139#define DLM_LKF_CANCEL 0x00000002
140#define DLM_LKF_CONVERT 0x00000004
141#define DLM_LKF_VALBLK 0x00000008
142#define DLM_LKF_QUECVT 0x00000010
143#define DLM_LKF_IVVALBLK 0x00000020
144#define DLM_LKF_CONVDEADLK 0x00000040
145#define DLM_LKF_PERSISTENT 0x00000080
146#define DLM_LKF_NODLCKWT 0x00000100
147#define DLM_LKF_NODLCKBLK 0x00000200
148#define DLM_LKF_EXPEDITE 0x00000400
149#define DLM_LKF_NOQUEUEBAST 0x00000800
150#define DLM_LKF_HEADQUE 0x00001000
151#define DLM_LKF_NOORDER 0x00002000
152#define DLM_LKF_ORPHAN 0x00004000
153#define DLM_LKF_ALTPR 0x00008000
154#define DLM_LKF_ALTCW 0x00010000
155#define DLM_LKF_FORCEUNLOCK 0x00020000
156#define DLM_LKF_TIMEOUT 0x00040000
157
158/*
159 * Some return codes that are not in errno.h
160 */
161
162#define DLM_ECANCEL 0x10001
163#define DLM_EUNLOCK 0x10002
164 28
165typedef void dlm_lockspace_t; 29typedef void dlm_lockspace_t;
166 30
diff --git a/include/linux/dlmconstants.h b/include/linux/dlmconstants.h
new file mode 100644
index 000000000000..fddb3d3ff321
--- /dev/null
+++ b/include/linux/dlmconstants.h
@@ -0,0 +1,159 @@
1/******************************************************************************
2*******************************************************************************
3**
4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
5** Copyright (C) 2004-2007 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 __DLMCONSTANTS_DOT_H__
15#define __DLMCONSTANTS_DOT_H__
16
17/*
18 * Constants used by DLM interface.
19 */
20
21/*
22 * Lock Modes
23 */
24
25#define DLM_LOCK_IV (-1) /* invalid */
26#define DLM_LOCK_NL 0 /* null */
27#define DLM_LOCK_CR 1 /* concurrent read */
28#define DLM_LOCK_CW 2 /* concurrent write */
29#define DLM_LOCK_PR 3 /* protected read */
30#define DLM_LOCK_PW 4 /* protected write */
31#define DLM_LOCK_EX 5 /* exclusive */
32
33
34/*
35 * Flags to dlm_lock
36 *
37 * DLM_LKF_NOQUEUE
38 *
39 * Do not queue the lock request on the wait queue if it cannot be granted
40 * immediately. If the lock cannot be granted because of this flag, DLM will
41 * either return -EAGAIN from the dlm_lock call or will return 0 from
42 * dlm_lock and -EAGAIN in the lock status block when the AST is executed.
43 *
44 * DLM_LKF_CANCEL
45 *
46 * Used to cancel a pending lock request or conversion. A converting lock is
47 * returned to its previously granted mode.
48 *
49 * DLM_LKF_CONVERT
50 *
51 * Indicates a lock conversion request. For conversions the name and namelen
52 * are ignored and the lock ID in the LKSB is used to identify the lock.
53 *
54 * DLM_LKF_VALBLK
55 *
56 * Requests DLM to return the current contents of the lock value block in the
57 * lock status block. When this flag is set in a lock conversion from PW or EX
58 * modes, DLM assigns the value specified in the lock status block to the lock
59 * value block of the lock resource. The LVB is a DLM_LVB_LEN size array
60 * containing application-specific information.
61 *
62 * DLM_LKF_QUECVT
63 *
64 * Force a conversion request to be queued, even if it is compatible with
65 * the granted modes of other locks on the same resource.
66 *
67 * DLM_LKF_IVVALBLK
68 *
69 * Invalidate the lock value block.
70 *
71 * DLM_LKF_CONVDEADLK
72 *
73 * Allows the dlm to resolve conversion deadlocks internally by demoting the
74 * granted mode of a converting lock to NL. The DLM_SBF_DEMOTED flag is
75 * returned for a conversion that's been effected by this.
76 *
77 * DLM_LKF_PERSISTENT
78 *
79 * Only relevant to locks originating in userspace. A persistent lock will not
80 * be removed if the process holding the lock exits.
81 *
82 * DLM_LKF_NODLCKWT
83 *
84 * Do not cancel the lock if it gets into conversion deadlock.
85 * Exclude this lock from being monitored due to DLM_LSFL_TIMEWARN.
86 *
87 * DLM_LKF_NODLCKBLK
88 *
89 * net yet implemented
90 *
91 * DLM_LKF_EXPEDITE
92 *
93 * Used only with new requests for NL mode locks. Tells the lock manager
94 * to grant the lock, ignoring other locks in convert and wait queues.
95 *
96 * DLM_LKF_NOQUEUEBAST
97 *
98 * Send blocking AST's before returning -EAGAIN to the caller. It is only
99 * used along with the NOQUEUE flag. Blocking AST's are not sent for failed
100 * NOQUEUE requests otherwise.
101 *
102 * DLM_LKF_HEADQUE
103 *
104 * Add a lock to the head of the convert or wait queue rather than the tail.
105 *
106 * DLM_LKF_NOORDER
107 *
108 * Disregard the standard grant order rules and grant a lock as soon as it
109 * is compatible with other granted locks.
110 *
111 * DLM_LKF_ORPHAN
112 *
113 * not yet implemented
114 *
115 * DLM_LKF_ALTPR
116 *
117 * If the requested mode cannot be granted immediately, try to grant the lock
118 * in PR mode instead. If this alternate mode is granted instead of the
119 * requested mode, DLM_SBF_ALTMODE is returned in the lksb.
120 *
121 * DLM_LKF_ALTCW
122 *
123 * The same as ALTPR, but the alternate mode is CW.
124 *
125 * DLM_LKF_FORCEUNLOCK
126 *
127 * Unlock the lock even if it is converting or waiting or has sublocks.
128 * Only really for use by the userland device.c code.
129 *
130 */
131
132#define DLM_LKF_NOQUEUE 0x00000001
133#define DLM_LKF_CANCEL 0x00000002
134#define DLM_LKF_CONVERT 0x00000004
135#define DLM_LKF_VALBLK 0x00000008
136#define DLM_LKF_QUECVT 0x00000010
137#define DLM_LKF_IVVALBLK 0x00000020
138#define DLM_LKF_CONVDEADLK 0x00000040
139#define DLM_LKF_PERSISTENT 0x00000080
140#define DLM_LKF_NODLCKWT 0x00000100
141#define DLM_LKF_NODLCKBLK 0x00000200
142#define DLM_LKF_EXPEDITE 0x00000400
143#define DLM_LKF_NOQUEUEBAST 0x00000800
144#define DLM_LKF_HEADQUE 0x00001000
145#define DLM_LKF_NOORDER 0x00002000
146#define DLM_LKF_ORPHAN 0x00004000
147#define DLM_LKF_ALTPR 0x00008000
148#define DLM_LKF_ALTCW 0x00010000
149#define DLM_LKF_FORCEUNLOCK 0x00020000
150#define DLM_LKF_TIMEOUT 0x00040000
151
152/*
153 * Some return codes that are not in errno.h
154 */
155
156#define DLM_ECANCEL 0x10001
157#define DLM_EUNLOCK 0x10002
158
159#endif /* __DLMCONSTANTS_DOT_H__ */
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index a3b6035b6c86..55c9a6952f44 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -132,7 +132,7 @@ struct dma_chan {
132 132
133 /* sysfs */ 133 /* sysfs */
134 int chan_id; 134 int chan_id;
135 struct class_device class_dev; 135 struct device dev;
136 136
137 struct kref refcount; 137 struct kref refcount;
138 int slow_ref; 138 int slow_ref;
@@ -142,6 +142,7 @@ struct dma_chan {
142 struct dma_chan_percpu *local; 142 struct dma_chan_percpu *local;
143}; 143};
144 144
145#define to_dma_chan(p) container_of(p, struct dma_chan, dev)
145 146
146void dma_chan_cleanup(struct kref *kref); 147void dma_chan_cleanup(struct kref *kref);
147 148
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 00fc7a9c35ec..5b42a659a308 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -78,6 +78,8 @@ extern const struct dmi_device * dmi_find_device(int type, const char *name,
78extern void dmi_scan_machine(void); 78extern void dmi_scan_machine(void);
79extern int dmi_get_year(int field); 79extern int dmi_get_year(int field);
80extern int dmi_name_in_vendors(const char *str); 80extern int dmi_name_in_vendors(const char *str);
81extern int dmi_available;
82extern char *dmi_get_slot(int slot);
81 83
82#else 84#else
83 85
@@ -87,6 +89,8 @@ static inline const struct dmi_device * dmi_find_device(int type, const char *na
87 const struct dmi_device *from) { return NULL; } 89 const struct dmi_device *from) { return NULL; }
88static inline int dmi_get_year(int year) { return 0; } 90static inline int dmi_get_year(int year) { return 0; }
89static inline int dmi_name_in_vendors(const char *s) { return 0; } 91static inline int dmi_name_in_vendors(const char *s) { return 0; }
92#define dmi_available 0
93static inline char *dmi_get_slot(int slot) { return NULL; }
90 94
91#endif 95#endif
92 96
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index e8f42133a616..639624b55fbe 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -119,7 +119,7 @@ extern void elv_put_request(struct request_queue *, struct request *);
119/* 119/*
120 * io scheduler registration 120 * io scheduler registration
121 */ 121 */
122extern int elv_register(struct elevator_type *); 122extern void elv_register(struct elevator_type *);
123extern void elv_unregister(struct elevator_type *); 123extern void elv_unregister(struct elevator_type *);
124 124
125/* 125/*
diff --git a/include/linux/elf.h b/include/linux/elf.h
index 576e83bd6d88..7ceb24d87c1a 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -355,6 +355,7 @@ typedef struct elf64_shdr {
355#define NT_AUXV 6 355#define NT_AUXV 6
356#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ 356#define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */
357#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ 357#define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */
358#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
358 359
359 360
360/* Note header in a PT_NOTE section */ 361/* Note header in a PT_NOTE section */
diff --git a/include/linux/elfnote.h b/include/linux/elfnote.h
index e831759b2fb5..278e3ef05336 100644
--- a/include/linux/elfnote.h
+++ b/include/linux/elfnote.h
@@ -76,7 +76,7 @@
76 typeof(desc) _desc \ 76 typeof(desc) _desc \
77 __attribute__((aligned(sizeof(Elf##size##_Word)))); \ 77 __attribute__((aligned(sizeof(Elf##size##_Word)))); \
78 } _ELFNOTE_PASTE(_note_, unique) \ 78 } _ELFNOTE_PASTE(_note_, unique) \
79 __attribute_used__ \ 79 __used \
80 __attribute__((section(".note." name), \ 80 __attribute__((section(".note." name), \
81 aligned(sizeof(Elf##size##_Word)), \ 81 aligned(sizeof(Elf##size##_Word)), \
82 unused)) = { \ 82 unused)) = { \
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index d2a96cbf4f0e..cf79853967ff 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -32,18 +32,13 @@
32 * On x86-64 make the 64bit structure have the same alignment as the 32 * On x86-64 make the 64bit structure have the same alignment as the
33 * 32bit structure. This makes 32bit emulation easier. 33 * 32bit structure. This makes 32bit emulation easier.
34 * 34 *
35 * UML/x86_64 needs the same packing as x86_64 - UML + UML_X86 + 35 * UML/x86_64 needs the same packing as x86_64
36 * 64_BIT adds up to UML/x86_64.
37 */ 36 */
38#ifdef __x86_64__ 37#ifdef __x86_64__
39#define EPOLL_PACKED __attribute__((packed)) 38#define EPOLL_PACKED __attribute__((packed))
40#else 39#else
41#if defined(CONFIG_UML) && defined(CONFIG_UML_X86) && defined(CONFIG_64BIT)
42#define EPOLL_PACKED __attribute__((packed))
43#else
44#define EPOLL_PACKED 40#define EPOLL_PACKED
45#endif 41#endif
46#endif
47 42
48struct epoll_event { 43struct epoll_event {
49 __u32 events; 44 __u32 events;
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index 0f6c86c634fd..84cec2aa9f1e 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -563,11 +563,4 @@ enum {
563 ~EXT2_DIR_ROUND) 563 ~EXT2_DIR_ROUND)
564#define EXT2_MAX_REC_LEN ((1<<16)-1) 564#define EXT2_MAX_REC_LEN ((1<<16)-1)
565 565
566static inline ext2_fsblk_t
567ext2_group_first_block_no(struct super_block *sb, unsigned long group_no)
568{
569 return group_no * (ext2_fsblk_t)EXT2_BLOCKS_PER_GROUP(sb) +
570 le32_to_cpu(EXT2_SB(sb)->s_es->s_first_data_block);
571}
572
573#endif /* _LINUX_EXT2_FS_H */ 566#endif /* _LINUX_EXT2_FS_H */
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 64134456ed8c..241c01cb92b2 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -656,6 +656,26 @@ struct ext3_dir_entry_2 {
656#define EXT3_DIR_ROUND (EXT3_DIR_PAD - 1) 656#define EXT3_DIR_ROUND (EXT3_DIR_PAD - 1)
657#define EXT3_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT3_DIR_ROUND) & \ 657#define EXT3_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT3_DIR_ROUND) & \
658 ~EXT3_DIR_ROUND) 658 ~EXT3_DIR_ROUND)
659#define EXT3_MAX_REC_LEN ((1<<16)-1)
660
661static inline unsigned ext3_rec_len_from_disk(__le16 dlen)
662{
663 unsigned len = le16_to_cpu(dlen);
664
665 if (len == EXT3_MAX_REC_LEN)
666 return 1 << 16;
667 return len;
668}
669
670static inline __le16 ext3_rec_len_to_disk(unsigned len)
671{
672 if (len == (1 << 16))
673 return cpu_to_le16(EXT3_MAX_REC_LEN);
674 else if (len > (1 << 16))
675 BUG();
676 return cpu_to_le16(len);
677}
678
659/* 679/*
660 * Hash Tree Directory indexing 680 * Hash Tree Directory indexing
661 * (c) Daniel Phillips, 2001 681 * (c) Daniel Phillips, 2001
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h
index 97dd409d5f4a..1852313fc7c7 100644
--- a/include/linux/ext4_fs.h
+++ b/include/linux/ext4_fs.h
@@ -20,6 +20,8 @@
20#include <linux/blkdev.h> 20#include <linux/blkdev.h>
21#include <linux/magic.h> 21#include <linux/magic.h>
22 22
23#include <linux/ext4_fs_i.h>
24
23/* 25/*
24 * The second extended filesystem constants/structures 26 * The second extended filesystem constants/structures
25 */ 27 */
@@ -51,6 +53,50 @@
51#define ext4_debug(f, a...) do {} while (0) 53#define ext4_debug(f, a...) do {} while (0)
52#endif 54#endif
53 55
56#define EXT4_MULTIBLOCK_ALLOCATOR 1
57
58/* prefer goal again. length */
59#define EXT4_MB_HINT_MERGE 1
60/* blocks already reserved */
61#define EXT4_MB_HINT_RESERVED 2
62/* metadata is being allocated */
63#define EXT4_MB_HINT_METADATA 4
64/* first blocks in the file */
65#define EXT4_MB_HINT_FIRST 8
66/* search for the best chunk */
67#define EXT4_MB_HINT_BEST 16
68/* data is being allocated */
69#define EXT4_MB_HINT_DATA 32
70/* don't preallocate (for tails) */
71#define EXT4_MB_HINT_NOPREALLOC 64
72/* allocate for locality group */
73#define EXT4_MB_HINT_GROUP_ALLOC 128
74/* allocate goal blocks or none */
75#define EXT4_MB_HINT_GOAL_ONLY 256
76/* goal is meaningful */
77#define EXT4_MB_HINT_TRY_GOAL 512
78
79struct ext4_allocation_request {
80 /* target inode for block we're allocating */
81 struct inode *inode;
82 /* logical block in target inode */
83 ext4_lblk_t logical;
84 /* phys. target (a hint) */
85 ext4_fsblk_t goal;
86 /* the closest logical allocated block to the left */
87 ext4_lblk_t lleft;
88 /* phys. block for ^^^ */
89 ext4_fsblk_t pleft;
90 /* the closest logical allocated block to the right */
91 ext4_lblk_t lright;
92 /* phys. block for ^^^ */
93 ext4_fsblk_t pright;
94 /* how many blocks we want to allocate */
95 unsigned long len;
96 /* flags. see above EXT4_MB_HINT_* */
97 unsigned long flags;
98};
99
54/* 100/*
55 * Special inodes numbers 101 * Special inodes numbers
56 */ 102 */
@@ -73,8 +119,8 @@
73 * Macro-instructions used to manage several block sizes 119 * Macro-instructions used to manage several block sizes
74 */ 120 */
75#define EXT4_MIN_BLOCK_SIZE 1024 121#define EXT4_MIN_BLOCK_SIZE 1024
76#define EXT4_MAX_BLOCK_SIZE 4096 122#define EXT4_MAX_BLOCK_SIZE 65536
77#define EXT4_MIN_BLOCK_LOG_SIZE 10 123#define EXT4_MIN_BLOCK_LOG_SIZE 10
78#ifdef __KERNEL__ 124#ifdef __KERNEL__
79# define EXT4_BLOCK_SIZE(s) ((s)->s_blocksize) 125# define EXT4_BLOCK_SIZE(s) ((s)->s_blocksize)
80#else 126#else
@@ -118,6 +164,11 @@ struct ext4_group_desc
118 __le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */ 164 __le32 bg_block_bitmap_hi; /* Blocks bitmap block MSB */
119 __le32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */ 165 __le32 bg_inode_bitmap_hi; /* Inodes bitmap block MSB */
120 __le32 bg_inode_table_hi; /* Inodes table block MSB */ 166 __le32 bg_inode_table_hi; /* Inodes table block MSB */
167 __le16 bg_free_blocks_count_hi;/* Free blocks count MSB */
168 __le16 bg_free_inodes_count_hi;/* Free inodes count MSB */
169 __le16 bg_used_dirs_count_hi; /* Directories count MSB */
170 __le16 bg_itable_unused_hi; /* Unused inodes count MSB */
171 __u32 bg_reserved2[3];
121}; 172};
122 173
123#define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */ 174#define EXT4_BG_INODE_UNINIT 0x0001 /* Inode table/bitmap not in use */
@@ -178,8 +229,9 @@ struct ext4_group_desc
178#define EXT4_NOTAIL_FL 0x00008000 /* file tail should not be merged */ 229#define EXT4_NOTAIL_FL 0x00008000 /* file tail should not be merged */
179#define EXT4_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */ 230#define EXT4_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
180#define EXT4_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/ 231#define EXT4_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
181#define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */ 232#define EXT4_HUGE_FILE_FL 0x00040000 /* Set to each huge file */
182#define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */ 233#define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */
234#define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */
183 235
184#define EXT4_FL_USER_VISIBLE 0x000BDFFF /* User visible flags */ 236#define EXT4_FL_USER_VISIBLE 0x000BDFFF /* User visible flags */
185#define EXT4_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ 237#define EXT4_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
@@ -237,6 +289,7 @@ struct ext4_new_group_data {
237#endif 289#endif
238#define EXT4_IOC_GETRSVSZ _IOR('f', 5, long) 290#define EXT4_IOC_GETRSVSZ _IOR('f', 5, long)
239#define EXT4_IOC_SETRSVSZ _IOW('f', 6, long) 291#define EXT4_IOC_SETRSVSZ _IOW('f', 6, long)
292#define EXT4_IOC_MIGRATE _IO('f', 7)
240 293
241/* 294/*
242 * ioctl commands in 32 bit emulation 295 * ioctl commands in 32 bit emulation
@@ -275,18 +328,18 @@ struct ext4_mount_options {
275struct ext4_inode { 328struct ext4_inode {
276 __le16 i_mode; /* File mode */ 329 __le16 i_mode; /* File mode */
277 __le16 i_uid; /* Low 16 bits of Owner Uid */ 330 __le16 i_uid; /* Low 16 bits of Owner Uid */
278 __le32 i_size; /* Size in bytes */ 331 __le32 i_size_lo; /* Size in bytes */
279 __le32 i_atime; /* Access time */ 332 __le32 i_atime; /* Access time */
280 __le32 i_ctime; /* Inode Change time */ 333 __le32 i_ctime; /* Inode Change time */
281 __le32 i_mtime; /* Modification time */ 334 __le32 i_mtime; /* Modification time */
282 __le32 i_dtime; /* Deletion Time */ 335 __le32 i_dtime; /* Deletion Time */
283 __le16 i_gid; /* Low 16 bits of Group Id */ 336 __le16 i_gid; /* Low 16 bits of Group Id */
284 __le16 i_links_count; /* Links count */ 337 __le16 i_links_count; /* Links count */
285 __le32 i_blocks; /* Blocks count */ 338 __le32 i_blocks_lo; /* Blocks count */
286 __le32 i_flags; /* File flags */ 339 __le32 i_flags; /* File flags */
287 union { 340 union {
288 struct { 341 struct {
289 __u32 l_i_reserved1; 342 __le32 l_i_version;
290 } linux1; 343 } linux1;
291 struct { 344 struct {
292 __u32 h_i_translator; 345 __u32 h_i_translator;
@@ -297,12 +350,12 @@ struct ext4_inode {
297 } osd1; /* OS dependent 1 */ 350 } osd1; /* OS dependent 1 */
298 __le32 i_block[EXT4_N_BLOCKS];/* Pointers to blocks */ 351 __le32 i_block[EXT4_N_BLOCKS];/* Pointers to blocks */
299 __le32 i_generation; /* File version (for NFS) */ 352 __le32 i_generation; /* File version (for NFS) */
300 __le32 i_file_acl; /* File ACL */ 353 __le32 i_file_acl_lo; /* File ACL */
301 __le32 i_dir_acl; /* Directory ACL */ 354 __le32 i_size_high;
302 __le32 i_obso_faddr; /* Obsoleted fragment address */ 355 __le32 i_obso_faddr; /* Obsoleted fragment address */
303 union { 356 union {
304 struct { 357 struct {
305 __le16 l_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */ 358 __le16 l_i_blocks_high; /* were l_i_reserved1 */
306 __le16 l_i_file_acl_high; 359 __le16 l_i_file_acl_high;
307 __le16 l_i_uid_high; /* these 2 fields */ 360 __le16 l_i_uid_high; /* these 2 fields */
308 __le16 l_i_gid_high; /* were reserved2[0] */ 361 __le16 l_i_gid_high; /* were reserved2[0] */
@@ -328,9 +381,9 @@ struct ext4_inode {
328 __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */ 381 __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */
329 __le32 i_crtime; /* File Creation time */ 382 __le32 i_crtime; /* File Creation time */
330 __le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */ 383 __le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */
384 __le32 i_version_hi; /* high 32 bits for 64-bit version */
331}; 385};
332 386
333#define i_size_high i_dir_acl
334 387
335#define EXT4_EPOCH_BITS 2 388#define EXT4_EPOCH_BITS 2
336#define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1) 389#define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1)
@@ -402,9 +455,12 @@ do { \
402 raw_inode->xtime ## _extra); \ 455 raw_inode->xtime ## _extra); \
403} while (0) 456} while (0)
404 457
458#define i_disk_version osd1.linux1.l_i_version
459
405#if defined(__KERNEL__) || defined(__linux__) 460#if defined(__KERNEL__) || defined(__linux__)
406#define i_reserved1 osd1.linux1.l_i_reserved1 461#define i_reserved1 osd1.linux1.l_i_reserved1
407#define i_file_acl_high osd2.linux2.l_i_file_acl_high 462#define i_file_acl_high osd2.linux2.l_i_file_acl_high
463#define i_blocks_high osd2.linux2.l_i_blocks_high
408#define i_uid_low i_uid 464#define i_uid_low i_uid
409#define i_gid_low i_gid 465#define i_gid_low i_gid
410#define i_uid_high osd2.linux2.l_i_uid_high 466#define i_uid_high osd2.linux2.l_i_uid_high
@@ -461,7 +517,10 @@ do { \
461#define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */ 517#define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
462#define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */ 518#define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
463#define EXT4_MOUNT_EXTENTS 0x400000 /* Extents support */ 519#define EXT4_MOUNT_EXTENTS 0x400000 /* Extents support */
464 520#define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */
521#define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */
522#define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */
523#define EXT4_MOUNT_MBALLOC 0x4000000 /* Buddy allocation support */
465/* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */ 524/* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */
466#ifndef _LINUX_EXT2_FS_H 525#ifndef _LINUX_EXT2_FS_H
467#define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt 526#define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt
@@ -481,6 +540,7 @@ do { \
481#define ext4_test_bit ext2_test_bit 540#define ext4_test_bit ext2_test_bit
482#define ext4_find_first_zero_bit ext2_find_first_zero_bit 541#define ext4_find_first_zero_bit ext2_find_first_zero_bit
483#define ext4_find_next_zero_bit ext2_find_next_zero_bit 542#define ext4_find_next_zero_bit ext2_find_next_zero_bit
543#define ext4_find_next_bit ext2_find_next_bit
484 544
485/* 545/*
486 * Maximal mount counts between two filesystem checks 546 * Maximal mount counts between two filesystem checks
@@ -671,6 +731,7 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
671#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 731#define EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001
672#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 732#define EXT4_FEATURE_RO_COMPAT_LARGE_FILE 0x0002
673#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 733#define EXT4_FEATURE_RO_COMPAT_BTREE_DIR 0x0004
734#define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008
674#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010 735#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010
675#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020 736#define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020
676#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040 737#define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE 0x0040
@@ -682,6 +743,7 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
682#define EXT4_FEATURE_INCOMPAT_META_BG 0x0010 743#define EXT4_FEATURE_INCOMPAT_META_BG 0x0010
683#define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */ 744#define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 /* extents support */
684#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 745#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
746#define EXT4_FEATURE_INCOMPAT_MMP 0x0100
685#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 747#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200
686 748
687#define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR 749#define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR
@@ -696,7 +758,8 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
696 EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \ 758 EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \
697 EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \ 759 EXT4_FEATURE_RO_COMPAT_DIR_NLINK | \
698 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \ 760 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE | \
699 EXT4_FEATURE_RO_COMPAT_BTREE_DIR) 761 EXT4_FEATURE_RO_COMPAT_BTREE_DIR |\
762 EXT4_FEATURE_RO_COMPAT_HUGE_FILE)
700 763
701/* 764/*
702 * Default values for user and/or group using reserved blocks 765 * Default values for user and/or group using reserved blocks
@@ -767,6 +830,26 @@ struct ext4_dir_entry_2 {
767#define EXT4_DIR_ROUND (EXT4_DIR_PAD - 1) 830#define EXT4_DIR_ROUND (EXT4_DIR_PAD - 1)
768#define EXT4_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT4_DIR_ROUND) & \ 831#define EXT4_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT4_DIR_ROUND) & \
769 ~EXT4_DIR_ROUND) 832 ~EXT4_DIR_ROUND)
833#define EXT4_MAX_REC_LEN ((1<<16)-1)
834
835static inline unsigned ext4_rec_len_from_disk(__le16 dlen)
836{
837 unsigned len = le16_to_cpu(dlen);
838
839 if (len == EXT4_MAX_REC_LEN)
840 return 1 << 16;
841 return len;
842}
843
844static inline __le16 ext4_rec_len_to_disk(unsigned len)
845{
846 if (len == (1 << 16))
847 return cpu_to_le16(EXT4_MAX_REC_LEN);
848 else if (len > (1 << 16))
849 BUG();
850 return cpu_to_le16(len);
851}
852
770/* 853/*
771 * Hash Tree Directory indexing 854 * Hash Tree Directory indexing
772 * (c) Daniel Phillips, 2001 855 * (c) Daniel Phillips, 2001
@@ -810,7 +893,7 @@ struct ext4_iloc
810{ 893{
811 struct buffer_head *bh; 894 struct buffer_head *bh;
812 unsigned long offset; 895 unsigned long offset;
813 unsigned long block_group; 896 ext4_group_t block_group;
814}; 897};
815 898
816static inline struct ext4_inode *ext4_raw_inode(struct ext4_iloc *iloc) 899static inline struct ext4_inode *ext4_raw_inode(struct ext4_iloc *iloc)
@@ -835,7 +918,7 @@ struct dir_private_info {
835 918
836/* calculate the first block number of the group */ 919/* calculate the first block number of the group */
837static inline ext4_fsblk_t 920static inline ext4_fsblk_t
838ext4_group_first_block_no(struct super_block *sb, unsigned long group_no) 921ext4_group_first_block_no(struct super_block *sb, ext4_group_t group_no)
839{ 922{
840 return group_no * (ext4_fsblk_t)EXT4_BLOCKS_PER_GROUP(sb) + 923 return group_no * (ext4_fsblk_t)EXT4_BLOCKS_PER_GROUP(sb) +
841 le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block); 924 le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block);
@@ -866,21 +949,24 @@ extern unsigned int ext4_block_group(struct super_block *sb,
866 ext4_fsblk_t blocknr); 949 ext4_fsblk_t blocknr);
867extern ext4_grpblk_t ext4_block_group_offset(struct super_block *sb, 950extern ext4_grpblk_t ext4_block_group_offset(struct super_block *sb,
868 ext4_fsblk_t blocknr); 951 ext4_fsblk_t blocknr);
869extern int ext4_bg_has_super(struct super_block *sb, int group); 952extern int ext4_bg_has_super(struct super_block *sb, ext4_group_t group);
870extern unsigned long ext4_bg_num_gdb(struct super_block *sb, int group); 953extern unsigned long ext4_bg_num_gdb(struct super_block *sb,
954 ext4_group_t group);
871extern ext4_fsblk_t ext4_new_block (handle_t *handle, struct inode *inode, 955extern ext4_fsblk_t ext4_new_block (handle_t *handle, struct inode *inode,
872 ext4_fsblk_t goal, int *errp); 956 ext4_fsblk_t goal, int *errp);
873extern ext4_fsblk_t ext4_new_blocks (handle_t *handle, struct inode *inode, 957extern ext4_fsblk_t ext4_new_blocks (handle_t *handle, struct inode *inode,
874 ext4_fsblk_t goal, unsigned long *count, int *errp); 958 ext4_fsblk_t goal, unsigned long *count, int *errp);
959extern ext4_fsblk_t ext4_new_blocks_old(handle_t *handle, struct inode *inode,
960 ext4_fsblk_t goal, unsigned long *count, int *errp);
875extern void ext4_free_blocks (handle_t *handle, struct inode *inode, 961extern void ext4_free_blocks (handle_t *handle, struct inode *inode,
876 ext4_fsblk_t block, unsigned long count); 962 ext4_fsblk_t block, unsigned long count, int metadata);
877extern void ext4_free_blocks_sb (handle_t *handle, struct super_block *sb, 963extern void ext4_free_blocks_sb (handle_t *handle, struct super_block *sb,
878 ext4_fsblk_t block, unsigned long count, 964 ext4_fsblk_t block, unsigned long count,
879 unsigned long *pdquot_freed_blocks); 965 unsigned long *pdquot_freed_blocks);
880extern ext4_fsblk_t ext4_count_free_blocks (struct super_block *); 966extern ext4_fsblk_t ext4_count_free_blocks (struct super_block *);
881extern void ext4_check_blocks_bitmap (struct super_block *); 967extern void ext4_check_blocks_bitmap (struct super_block *);
882extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb, 968extern struct ext4_group_desc * ext4_get_group_desc(struct super_block * sb,
883 unsigned int block_group, 969 ext4_group_t block_group,
884 struct buffer_head ** bh); 970 struct buffer_head ** bh);
885extern int ext4_should_retry_alloc(struct super_block *sb, int *retries); 971extern int ext4_should_retry_alloc(struct super_block *sb, int *retries);
886extern void ext4_init_block_alloc_info(struct inode *); 972extern void ext4_init_block_alloc_info(struct inode *);
@@ -911,15 +997,32 @@ extern unsigned long ext4_count_dirs (struct super_block *);
911extern void ext4_check_inodes_bitmap (struct super_block *); 997extern void ext4_check_inodes_bitmap (struct super_block *);
912extern unsigned long ext4_count_free (struct buffer_head *, unsigned); 998extern unsigned long ext4_count_free (struct buffer_head *, unsigned);
913 999
1000/* mballoc.c */
1001extern long ext4_mb_stats;
1002extern long ext4_mb_max_to_scan;
1003extern int ext4_mb_init(struct super_block *, int);
1004extern int ext4_mb_release(struct super_block *);
1005extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *,
1006 struct ext4_allocation_request *, int *);
1007extern int ext4_mb_reserve_blocks(struct super_block *, int);
1008extern void ext4_mb_discard_inode_preallocations(struct inode *);
1009extern int __init init_ext4_mballoc(void);
1010extern void exit_ext4_mballoc(void);
1011extern void ext4_mb_free_blocks(handle_t *, struct inode *,
1012 unsigned long, unsigned long, int, unsigned long *);
1013
914 1014
915/* inode.c */ 1015/* inode.c */
916int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode, 1016int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
917 struct buffer_head *bh, ext4_fsblk_t blocknr); 1017 struct buffer_head *bh, ext4_fsblk_t blocknr);
918struct buffer_head * ext4_getblk (handle_t *, struct inode *, long, int, int *); 1018struct buffer_head *ext4_getblk(handle_t *, struct inode *,
919struct buffer_head * ext4_bread (handle_t *, struct inode *, int, int, int *); 1019 ext4_lblk_t, int, int *);
1020struct buffer_head *ext4_bread(handle_t *, struct inode *,
1021 ext4_lblk_t, int, int *);
920int ext4_get_blocks_handle(handle_t *handle, struct inode *inode, 1022int ext4_get_blocks_handle(handle_t *handle, struct inode *inode,
921 sector_t iblock, unsigned long maxblocks, struct buffer_head *bh_result, 1023 ext4_lblk_t iblock, unsigned long maxblocks,
922 int create, int extend_disksize); 1024 struct buffer_head *bh_result,
1025 int create, int extend_disksize);
923 1026
924extern void ext4_read_inode (struct inode *); 1027extern void ext4_read_inode (struct inode *);
925extern int ext4_write_inode (struct inode *, int); 1028extern int ext4_write_inode (struct inode *, int);
@@ -943,6 +1046,9 @@ extern int ext4_ioctl (struct inode *, struct file *, unsigned int,
943 unsigned long); 1046 unsigned long);
944extern long ext4_compat_ioctl (struct file *, unsigned int, unsigned long); 1047extern long ext4_compat_ioctl (struct file *, unsigned int, unsigned long);
945 1048
1049/* migrate.c */
1050extern int ext4_ext_migrate(struct inode *, struct file *, unsigned int,
1051 unsigned long);
946/* namei.c */ 1052/* namei.c */
947extern int ext4_orphan_add(handle_t *, struct inode *); 1053extern int ext4_orphan_add(handle_t *, struct inode *);
948extern int ext4_orphan_del(handle_t *, struct inode *); 1054extern int ext4_orphan_del(handle_t *, struct inode *);
@@ -965,6 +1071,12 @@ extern void ext4_abort (struct super_block *, const char *, const char *, ...)
965extern void ext4_warning (struct super_block *, const char *, const char *, ...) 1071extern void ext4_warning (struct super_block *, const char *, const char *, ...)
966 __attribute__ ((format (printf, 3, 4))); 1072 __attribute__ ((format (printf, 3, 4)));
967extern void ext4_update_dynamic_rev (struct super_block *sb); 1073extern void ext4_update_dynamic_rev (struct super_block *sb);
1074extern int ext4_update_compat_feature(handle_t *handle, struct super_block *sb,
1075 __u32 compat);
1076extern int ext4_update_rocompat_feature(handle_t *handle,
1077 struct super_block *sb, __u32 rocompat);
1078extern int ext4_update_incompat_feature(handle_t *handle,
1079 struct super_block *sb, __u32 incompat);
968extern ext4_fsblk_t ext4_block_bitmap(struct super_block *sb, 1080extern ext4_fsblk_t ext4_block_bitmap(struct super_block *sb,
969 struct ext4_group_desc *bg); 1081 struct ext4_group_desc *bg);
970extern ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb, 1082extern ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb,
@@ -1017,6 +1129,29 @@ static inline void ext4_r_blocks_count_set(struct ext4_super_block *es,
1017 es->s_r_blocks_count_hi = cpu_to_le32(blk >> 32); 1129 es->s_r_blocks_count_hi = cpu_to_le32(blk >> 32);
1018} 1130}
1019 1131
1132static inline loff_t ext4_isize(struct ext4_inode *raw_inode)
1133{
1134 return ((loff_t)le32_to_cpu(raw_inode->i_size_high) << 32) |
1135 le32_to_cpu(raw_inode->i_size_lo);
1136}
1137
1138static inline void ext4_isize_set(struct ext4_inode *raw_inode, loff_t i_size)
1139{
1140 raw_inode->i_size_lo = cpu_to_le32(i_size);
1141 raw_inode->i_size_high = cpu_to_le32(i_size >> 32);
1142}
1143
1144static inline
1145struct ext4_group_info *ext4_get_group_info(struct super_block *sb,
1146 ext4_group_t group)
1147{
1148 struct ext4_group_info ***grp_info;
1149 long indexv, indexh;
1150 grp_info = EXT4_SB(sb)->s_group_info;
1151 indexv = group >> (EXT4_DESC_PER_BLOCK_BITS(sb));
1152 indexh = group & ((EXT4_DESC_PER_BLOCK(sb)) - 1);
1153 return grp_info[indexv][indexh];
1154}
1020 1155
1021 1156
1022#define ext4_std_error(sb, errno) \ 1157#define ext4_std_error(sb, errno) \
@@ -1048,7 +1183,7 @@ extern const struct inode_operations ext4_fast_symlink_inode_operations;
1048extern int ext4_ext_tree_init(handle_t *handle, struct inode *); 1183extern int ext4_ext_tree_init(handle_t *handle, struct inode *);
1049extern int ext4_ext_writepage_trans_blocks(struct inode *, int); 1184extern int ext4_ext_writepage_trans_blocks(struct inode *, int);
1050extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, 1185extern int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
1051 ext4_fsblk_t iblock, 1186 ext4_lblk_t iblock,
1052 unsigned long max_blocks, struct buffer_head *bh_result, 1187 unsigned long max_blocks, struct buffer_head *bh_result,
1053 int create, int extend_disksize); 1188 int create, int extend_disksize);
1054extern void ext4_ext_truncate(struct inode *, struct page *); 1189extern void ext4_ext_truncate(struct inode *, struct page *);
@@ -1056,19 +1191,10 @@ extern void ext4_ext_init(struct super_block *);
1056extern void ext4_ext_release(struct super_block *); 1191extern void ext4_ext_release(struct super_block *);
1057extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset, 1192extern long ext4_fallocate(struct inode *inode, int mode, loff_t offset,
1058 loff_t len); 1193 loff_t len);
1059static inline int 1194extern int ext4_get_blocks_wrap(handle_t *handle, struct inode *inode,
1060ext4_get_blocks_wrap(handle_t *handle, struct inode *inode, sector_t block, 1195 sector_t block, unsigned long max_blocks,
1061 unsigned long max_blocks, struct buffer_head *bh, 1196 struct buffer_head *bh, int create,
1062 int create, int extend_disksize) 1197 int extend_disksize);
1063{
1064 if (EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)
1065 return ext4_ext_get_blocks(handle, inode, block, max_blocks,
1066 bh, create, extend_disksize);
1067 return ext4_get_blocks_handle(handle, inode, block, max_blocks, bh,
1068 create, extend_disksize);
1069}
1070
1071
1072#endif /* __KERNEL__ */ 1198#endif /* __KERNEL__ */
1073 1199
1074#endif /* _LINUX_EXT4_FS_H */ 1200#endif /* _LINUX_EXT4_FS_H */
diff --git a/include/linux/ext4_fs_extents.h b/include/linux/ext4_fs_extents.h
index d2045a26195d..697da4bce6c5 100644
--- a/include/linux/ext4_fs_extents.h
+++ b/include/linux/ext4_fs_extents.h
@@ -124,20 +124,6 @@ struct ext4_ext_path {
124#define EXT4_EXT_CACHE_GAP 1 124#define EXT4_EXT_CACHE_GAP 1
125#define EXT4_EXT_CACHE_EXTENT 2 125#define EXT4_EXT_CACHE_EXTENT 2
126 126
127/*
128 * to be called by ext4_ext_walk_space()
129 * negative retcode - error
130 * positive retcode - signal for ext4_ext_walk_space(), see below
131 * callback must return valid extent (passed or newly created)
132 */
133typedef int (*ext_prepare_callback)(struct inode *, struct ext4_ext_path *,
134 struct ext4_ext_cache *,
135 void *);
136
137#define EXT_CONTINUE 0
138#define EXT_BREAK 1
139#define EXT_REPEAT 2
140
141 127
142#define EXT_MAX_BLOCK 0xffffffff 128#define EXT_MAX_BLOCK 0xffffffff
143 129
@@ -226,6 +212,8 @@ static inline int ext4_ext_get_actual_len(struct ext4_extent *ext)
226 (le16_to_cpu(ext->ee_len) - EXT_INIT_MAX_LEN)); 212 (le16_to_cpu(ext->ee_len) - EXT_INIT_MAX_LEN));
227} 213}
228 214
215extern ext4_fsblk_t idx_pblock(struct ext4_extent_idx *);
216extern void ext4_ext_store_pblock(struct ext4_extent *, ext4_fsblk_t);
229extern int ext4_extent_tree_init(handle_t *, struct inode *); 217extern int ext4_extent_tree_init(handle_t *, struct inode *);
230extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *); 218extern int ext4_ext_calc_credits_for_insert(struct inode *, struct ext4_ext_path *);
231extern int ext4_ext_try_to_merge(struct inode *inode, 219extern int ext4_ext_try_to_merge(struct inode *inode,
@@ -233,8 +221,11 @@ extern int ext4_ext_try_to_merge(struct inode *inode,
233 struct ext4_extent *); 221 struct ext4_extent *);
234extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *); 222extern unsigned int ext4_ext_check_overlap(struct inode *, struct ext4_extent *, struct ext4_ext_path *);
235extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *); 223extern int ext4_ext_insert_extent(handle_t *, struct inode *, struct ext4_ext_path *, struct ext4_extent *);
236extern int ext4_ext_walk_space(struct inode *, unsigned long, unsigned long, ext_prepare_callback, void *); 224extern struct ext4_ext_path *ext4_ext_find_extent(struct inode *, ext4_lblk_t,
237extern struct ext4_ext_path * ext4_ext_find_extent(struct inode *, int, struct ext4_ext_path *); 225 struct ext4_ext_path *);
238 226extern int ext4_ext_search_left(struct inode *, struct ext4_ext_path *,
227 ext4_lblk_t *, ext4_fsblk_t *);
228extern int ext4_ext_search_right(struct inode *, struct ext4_ext_path *,
229 ext4_lblk_t *, ext4_fsblk_t *);
239#endif /* _LINUX_EXT4_EXTENTS */ 230#endif /* _LINUX_EXT4_EXTENTS */
240 231
diff --git a/include/linux/ext4_fs_i.h b/include/linux/ext4_fs_i.h
index 86ddfe2089f3..d5508d3cf290 100644
--- a/include/linux/ext4_fs_i.h
+++ b/include/linux/ext4_fs_i.h
@@ -27,6 +27,12 @@ typedef int ext4_grpblk_t;
27/* data type for filesystem-wide blocks number */ 27/* data type for filesystem-wide blocks number */
28typedef unsigned long long ext4_fsblk_t; 28typedef unsigned long long ext4_fsblk_t;
29 29
30/* data type for file logical block number */
31typedef __u32 ext4_lblk_t;
32
33/* data type for block group number */
34typedef unsigned long ext4_group_t;
35
30struct ext4_reserve_window { 36struct ext4_reserve_window {
31 ext4_fsblk_t _rsv_start; /* First byte reserved */ 37 ext4_fsblk_t _rsv_start; /* First byte reserved */
32 ext4_fsblk_t _rsv_end; /* Last byte reserved or 0 */ 38 ext4_fsblk_t _rsv_end; /* Last byte reserved or 0 */
@@ -48,7 +54,7 @@ struct ext4_block_alloc_info {
48 * most-recently-allocated block in this file. 54 * most-recently-allocated block in this file.
49 * We use this for detecting linearly ascending allocation requests. 55 * We use this for detecting linearly ascending allocation requests.
50 */ 56 */
51 __u32 last_alloc_logical_block; 57 ext4_lblk_t last_alloc_logical_block;
52 /* 58 /*
53 * Was i_next_alloc_goal in ext4_inode_info 59 * Was i_next_alloc_goal in ext4_inode_info
54 * is the *physical* companion to i_next_alloc_block. 60 * is the *physical* companion to i_next_alloc_block.
@@ -67,7 +73,7 @@ struct ext4_block_alloc_info {
67 */ 73 */
68struct ext4_ext_cache { 74struct ext4_ext_cache {
69 ext4_fsblk_t ec_start; 75 ext4_fsblk_t ec_start;
70 __u32 ec_block; 76 ext4_lblk_t ec_block;
71 __u32 ec_len; /* must be 32bit to return holes */ 77 __u32 ec_len; /* must be 32bit to return holes */
72 __u32 ec_type; 78 __u32 ec_type;
73}; 79};
@@ -79,7 +85,6 @@ struct ext4_inode_info {
79 __le32 i_data[15]; /* unconverted */ 85 __le32 i_data[15]; /* unconverted */
80 __u32 i_flags; 86 __u32 i_flags;
81 ext4_fsblk_t i_file_acl; 87 ext4_fsblk_t i_file_acl;
82 __u32 i_dir_acl;
83 __u32 i_dtime; 88 __u32 i_dtime;
84 89
85 /* 90 /*
@@ -89,13 +94,13 @@ struct ext4_inode_info {
89 * place a file's data blocks near its inode block, and new inodes 94 * place a file's data blocks near its inode block, and new inodes
90 * near to their parent directory's inode. 95 * near to their parent directory's inode.
91 */ 96 */
92 __u32 i_block_group; 97 ext4_group_t i_block_group;
93 __u32 i_state; /* Dynamic state flags for ext4 */ 98 __u32 i_state; /* Dynamic state flags for ext4 */
94 99
95 /* block reservation info */ 100 /* block reservation info */
96 struct ext4_block_alloc_info *i_block_alloc_info; 101 struct ext4_block_alloc_info *i_block_alloc_info;
97 102
98 __u32 i_dir_start_lookup; 103 ext4_lblk_t i_dir_start_lookup;
99#ifdef CONFIG_EXT4DEV_FS_XATTR 104#ifdef CONFIG_EXT4DEV_FS_XATTR
100 /* 105 /*
101 * Extended attributes can be read independently of the main file 106 * Extended attributes can be read independently of the main file
@@ -134,16 +139,16 @@ struct ext4_inode_info {
134 __u16 i_extra_isize; 139 __u16 i_extra_isize;
135 140
136 /* 141 /*
137 * truncate_mutex is for serialising ext4_truncate() against 142 * i_data_sem is for serialising ext4_truncate() against
138 * ext4_getblock(). In the 2.4 ext2 design, great chunks of inode's 143 * ext4_getblock(). In the 2.4 ext2 design, great chunks of inode's
139 * data tree are chopped off during truncate. We can't do that in 144 * data tree are chopped off during truncate. We can't do that in
140 * ext4 because whenever we perform intermediate commits during 145 * ext4 because whenever we perform intermediate commits during
141 * truncate, the inode and all the metadata blocks *must* be in a 146 * truncate, the inode and all the metadata blocks *must* be in a
142 * consistent state which allows truncation of the orphans to restart 147 * consistent state which allows truncation of the orphans to restart
143 * during recovery. Hence we must fix the get_block-vs-truncate race 148 * during recovery. Hence we must fix the get_block-vs-truncate race
144 * by other means, so we have truncate_mutex. 149 * by other means, so we have i_data_sem.
145 */ 150 */
146 struct mutex truncate_mutex; 151 struct rw_semaphore i_data_sem;
147 struct inode vfs_inode; 152 struct inode vfs_inode;
148 153
149 unsigned long i_ext_generation; 154 unsigned long i_ext_generation;
@@ -153,6 +158,10 @@ struct ext4_inode_info {
153 * struct timespec i_{a,c,m}time in the generic inode. 158 * struct timespec i_{a,c,m}time in the generic inode.
154 */ 159 */
155 struct timespec i_crtime; 160 struct timespec i_crtime;
161
162 /* mballoc */
163 struct list_head i_prealloc_list;
164 spinlock_t i_prealloc_lock;
156}; 165};
157 166
158#endif /* _LINUX_EXT4_FS_I */ 167#endif /* _LINUX_EXT4_FS_I */
diff --git a/include/linux/ext4_fs_sb.h b/include/linux/ext4_fs_sb.h
index b40e827cd495..abaae2c8cccf 100644
--- a/include/linux/ext4_fs_sb.h
+++ b/include/linux/ext4_fs_sb.h
@@ -35,9 +35,10 @@ struct ext4_sb_info {
35 unsigned long s_itb_per_group; /* Number of inode table blocks per group */ 35 unsigned long s_itb_per_group; /* Number of inode table blocks per group */
36 unsigned long s_gdb_count; /* Number of group descriptor blocks */ 36 unsigned long s_gdb_count; /* Number of group descriptor blocks */
37 unsigned long s_desc_per_block; /* Number of group descriptors per block */ 37 unsigned long s_desc_per_block; /* Number of group descriptors per block */
38 unsigned long s_groups_count; /* Number of groups in the fs */ 38 ext4_group_t s_groups_count; /* Number of groups in the fs */
39 unsigned long s_overhead_last; /* Last calculated overhead */ 39 unsigned long s_overhead_last; /* Last calculated overhead */
40 unsigned long s_blocks_last; /* Last seen block count */ 40 unsigned long s_blocks_last; /* Last seen block count */
41 loff_t s_bitmap_maxbytes; /* max bytes for bitmap files */
41 struct buffer_head * s_sbh; /* Buffer containing the super block */ 42 struct buffer_head * s_sbh; /* Buffer containing the super block */
42 struct ext4_super_block * s_es; /* Pointer to the super block in the buffer */ 43 struct ext4_super_block * s_es; /* Pointer to the super block in the buffer */
43 struct buffer_head ** s_group_desc; 44 struct buffer_head ** s_group_desc;
@@ -90,6 +91,58 @@ struct ext4_sb_info {
90 unsigned long s_ext_blocks; 91 unsigned long s_ext_blocks;
91 unsigned long s_ext_extents; 92 unsigned long s_ext_extents;
92#endif 93#endif
94
95 /* for buddy allocator */
96 struct ext4_group_info ***s_group_info;
97 struct inode *s_buddy_cache;
98 long s_blocks_reserved;
99 spinlock_t s_reserve_lock;
100 struct list_head s_active_transaction;
101 struct list_head s_closed_transaction;
102 struct list_head s_committed_transaction;
103 spinlock_t s_md_lock;
104 tid_t s_last_transaction;
105 unsigned short *s_mb_offsets, *s_mb_maxs;
106
107 /* tunables */
108 unsigned long s_stripe;
109 unsigned long s_mb_stream_request;
110 unsigned long s_mb_max_to_scan;
111 unsigned long s_mb_min_to_scan;
112 unsigned long s_mb_stats;
113 unsigned long s_mb_order2_reqs;
114 unsigned long s_mb_group_prealloc;
115 /* where last allocation was done - for stream allocation */
116 unsigned long s_mb_last_group;
117 unsigned long s_mb_last_start;
118
119 /* history to debug policy */
120 struct ext4_mb_history *s_mb_history;
121 int s_mb_history_cur;
122 int s_mb_history_max;
123 int s_mb_history_num;
124 struct proc_dir_entry *s_mb_proc;
125 spinlock_t s_mb_history_lock;
126 int s_mb_history_filter;
127
128 /* stats for buddy allocator */
129 spinlock_t s_mb_pa_lock;
130 atomic_t s_bal_reqs; /* number of reqs with len > 1 */
131 atomic_t s_bal_success; /* we found long enough chunks */
132 atomic_t s_bal_allocated; /* in blocks */
133 atomic_t s_bal_ex_scanned; /* total extents scanned */
134 atomic_t s_bal_goals; /* goal hits */
135 atomic_t s_bal_breaks; /* too long searches */
136 atomic_t s_bal_2orders; /* 2^order hits */
137 spinlock_t s_bal_lock;
138 unsigned long s_mb_buddies_generated;
139 unsigned long long s_mb_generation_time;
140 atomic_t s_mb_lost_chunks;
141 atomic_t s_mb_preallocated;
142 atomic_t s_mb_discarded;
143
144 /* locality groups */
145 struct ext4_locality_group *s_locality_groups;
93}; 146};
94 147
95#endif /* _LINUX_EXT4_FS_SB */ 148#endif /* _LINUX_EXT4_FS_SB */
diff --git a/include/linux/f75375s.h b/include/linux/f75375s.h
new file mode 100644
index 000000000000..e99e22500668
--- /dev/null
+++ b/include/linux/f75375s.h
@@ -0,0 +1,21 @@
1/*
2 * f75375s.h - platform data structure for f75375s sensor
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) 2007, Riku Voipio <riku.voipio@iki.fi>
9 */
10
11#ifndef __LINUX_F75375S_H
12#define __LINUX_F75375S_H
13
14/* We want to set fans spinning on systems where there is no
15 * BIOS to do that for us */
16struct f75375s_platform_data {
17 u8 pwm[2];
18 u8 pwm_enable[2];
19};
20
21#endif /* __LINUX_F75375S_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b3ec4a496d64..a516b6716870 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -124,6 +124,7 @@ extern int dir_notify_enable;
124#define MS_SHARED (1<<20) /* change to shared */ 124#define MS_SHARED (1<<20) /* change to shared */
125#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */ 125#define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
126#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ 126#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
127#define MS_I_VERSION (1<<23) /* Update inode I_version field */
127#define MS_ACTIVE (1<<30) 128#define MS_ACTIVE (1<<30)
128#define MS_NOUSER (1<<31) 129#define MS_NOUSER (1<<31)
129 130
@@ -173,6 +174,7 @@ extern int dir_notify_enable;
173 ((inode)->i_flags & (S_SYNC|S_DIRSYNC))) 174 ((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
174#define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK) 175#define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK)
175#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME) 176#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
177#define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION)
176 178
177#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA) 179#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
178#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) 180#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
@@ -599,7 +601,7 @@ struct inode {
599 uid_t i_uid; 601 uid_t i_uid;
600 gid_t i_gid; 602 gid_t i_gid;
601 dev_t i_rdev; 603 dev_t i_rdev;
602 unsigned long i_version; 604 u64 i_version;
603 loff_t i_size; 605 loff_t i_size;
604#ifdef __NEED_I_SIZE_ORDERED 606#ifdef __NEED_I_SIZE_ORDERED
605 seqcount_t i_size_seqcount; 607 seqcount_t i_size_seqcount;
@@ -1394,6 +1396,21 @@ static inline void inode_dec_link_count(struct inode *inode)
1394 mark_inode_dirty(inode); 1396 mark_inode_dirty(inode);
1395} 1397}
1396 1398
1399/**
1400 * inode_inc_iversion - increments i_version
1401 * @inode: inode that need to be updated
1402 *
1403 * Every time the inode is modified, the i_version field will be incremented.
1404 * The filesystem has to be mounted with i_version flag
1405 */
1406
1407static inline void inode_inc_iversion(struct inode *inode)
1408{
1409 spin_lock(&inode->i_lock);
1410 inode->i_version++;
1411 spin_unlock(&inode->i_lock);
1412}
1413
1397extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry); 1414extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry);
1398static inline void file_accessed(struct file *file) 1415static inline void file_accessed(struct file *file)
1399{ 1416{
@@ -1476,7 +1493,7 @@ extern void drop_collected_mounts(struct vfsmount *);
1476extern int vfs_statfs(struct dentry *, struct kstatfs *); 1493extern int vfs_statfs(struct dentry *, struct kstatfs *);
1477 1494
1478/* /sys/fs */ 1495/* /sys/fs */
1479extern struct kset fs_subsys; 1496extern struct kobject *fs_kobj;
1480 1497
1481#define FLOCK_VERIFY_READ 1 1498#define FLOCK_VERIFY_READ 1
1482#define FLOCK_VERIFY_WRITE 2 1499#define FLOCK_VERIFY_WRITE 2
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index d0c437028c80..5c86f1196c3a 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -16,6 +16,7 @@
16 * - add lk_flags in fuse_lk_in 16 * - add lk_flags in fuse_lk_in
17 * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in 17 * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
18 * - add blksize field to fuse_attr 18 * - add blksize field to fuse_attr
19 * - add file flags field to fuse_read_in and fuse_write_in
19 */ 20 */
20 21
21#include <asm/types.h> 22#include <asm/types.h>
@@ -280,6 +281,8 @@ struct fuse_read_in {
280 __u32 size; 281 __u32 size;
281 __u32 read_flags; 282 __u32 read_flags;
282 __u64 lock_owner; 283 __u64 lock_owner;
284 __u32 flags;
285 __u32 padding;
283}; 286};
284 287
285#define FUSE_COMPAT_WRITE_IN_SIZE 24 288#define FUSE_COMPAT_WRITE_IN_SIZE 24
@@ -290,6 +293,8 @@ struct fuse_write_in {
290 __u32 size; 293 __u32 size;
291 __u32 write_flags; 294 __u32 write_flags;
292 __u64 lock_owner; 295 __u64 lock_owner;
296 __u32 flags;
297 __u32 padding;
293}; 298};
294 299
295struct fuse_write_out { 300struct fuse_write_out {
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 99650353adfa..90048fb28a38 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -1,8 +1,12 @@
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/sched.h> 4#include <linux/compiler.h>
5#include <linux/types.h>
5 6
7struct inode;
8struct mm_struct;
9struct task_struct;
6union ktime; 10union ktime;
7 11
8/* Second argument to futex syscall */ 12/* Second argument to futex syscall */
@@ -17,6 +21,8 @@ union ktime;
17#define FUTEX_LOCK_PI 6 21#define FUTEX_LOCK_PI 6
18#define FUTEX_UNLOCK_PI 7 22#define FUTEX_UNLOCK_PI 7
19#define FUTEX_TRYLOCK_PI 8 23#define FUTEX_TRYLOCK_PI 8
24#define FUTEX_WAIT_BITSET 9
25#define FUTEX_WAKE_BITSET 10
20 26
21#define FUTEX_PRIVATE_FLAG 128 27#define FUTEX_PRIVATE_FLAG 128
22#define FUTEX_CMD_MASK ~FUTEX_PRIVATE_FLAG 28#define FUTEX_CMD_MASK ~FUTEX_PRIVATE_FLAG
@@ -29,6 +35,8 @@ union ktime;
29#define FUTEX_LOCK_PI_PRIVATE (FUTEX_LOCK_PI | FUTEX_PRIVATE_FLAG) 35#define FUTEX_LOCK_PI_PRIVATE (FUTEX_LOCK_PI | FUTEX_PRIVATE_FLAG)
30#define FUTEX_UNLOCK_PI_PRIVATE (FUTEX_UNLOCK_PI | FUTEX_PRIVATE_FLAG) 36#define FUTEX_UNLOCK_PI_PRIVATE (FUTEX_UNLOCK_PI | FUTEX_PRIVATE_FLAG)
31#define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG) 37#define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG)
38#define FUTEX_WAIT_BITSET_PRIVATE (FUTEX_WAIT_BITS | FUTEX_PRIVATE_FLAG)
39#define FUTEX_WAKE_BITSET_PRIVATE (FUTEX_WAKE_BITS | FUTEX_PRIVATE_FLAG)
32 40
33/* 41/*
34 * Support for robust futexes: the kernel cleans up held futexes at 42 * Support for robust futexes: the kernel cleans up held futexes at
@@ -107,6 +115,12 @@ struct robust_list_head {
107 */ 115 */
108#define ROBUST_LIST_LIMIT 2048 116#define ROBUST_LIST_LIMIT 2048
109 117
118/*
119 * bitset with all bits set for the FUTEX_xxx_BITSET OPs to request a
120 * match of any bit.
121 */
122#define FUTEX_BITSET_MATCH_ANY 0xffffffff
123
110#ifdef __KERNEL__ 124#ifdef __KERNEL__
111long do_futex(u32 __user *uaddr, int op, u32 val, union ktime *timeout, 125long do_futex(u32 __user *uaddr, int op, u32 val, union ktime *timeout,
112 u32 __user *uaddr2, u32 val2, u32 val3); 126 u32 __user *uaddr2, u32 val2, u32 val3);
@@ -149,10 +163,6 @@ union futex_key {
149 int offset; 163 int offset;
150 } both; 164 } both;
151}; 165};
152int get_futex_key(u32 __user *uaddr, struct rw_semaphore *shared,
153 union futex_key *key);
154void get_futex_key_refs(union futex_key *key);
155void drop_futex_key_refs(union futex_key *key);
156 166
157#ifdef CONFIG_FUTEX 167#ifdef CONFIG_FUTEX
158extern void exit_robust_list(struct task_struct *curr); 168extern void exit_robust_list(struct task_struct *curr);
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index a47b8025d399..1dbea0ac5693 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -10,9 +10,19 @@
10 */ 10 */
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/kdev_t.h>
13 14
14#ifdef CONFIG_BLOCK 15#ifdef CONFIG_BLOCK
15 16
17#define kobj_to_dev(k) container_of(k, struct device, kobj)
18#define dev_to_disk(device) container_of(device, struct gendisk, dev)
19#define dev_to_part(device) container_of(device, struct hd_struct, dev)
20
21extern struct device_type disk_type;
22extern struct device_type part_type;
23extern struct kobject *block_depr;
24extern struct class block_class;
25
16enum { 26enum {
17/* These three have identical behaviour; use the second one if DOS FDISK gets 27/* These three have identical behaviour; use the second one if DOS FDISK gets
18 confused about extended/logical partitions starting past cylinder 1023. */ 28 confused about extended/logical partitions starting past cylinder 1023. */
@@ -84,7 +94,7 @@ struct partition {
84struct hd_struct { 94struct hd_struct {
85 sector_t start_sect; 95 sector_t start_sect;
86 sector_t nr_sects; 96 sector_t nr_sects;
87 struct kobject kobj; 97 struct device dev;
88 struct kobject *holder_dir; 98 struct kobject *holder_dir;
89 unsigned ios[2], sectors[2]; /* READs and WRITEs */ 99 unsigned ios[2], sectors[2]; /* READs and WRITEs */
90 int policy, partno; 100 int policy, partno;
@@ -117,15 +127,14 @@ struct gendisk {
117 * disks that can't be partitioned. */ 127 * disks that can't be partitioned. */
118 char disk_name[32]; /* name of major driver */ 128 char disk_name[32]; /* name of major driver */
119 struct hd_struct **part; /* [indexed by minor] */ 129 struct hd_struct **part; /* [indexed by minor] */
120 int part_uevent_suppress;
121 struct block_device_operations *fops; 130 struct block_device_operations *fops;
122 struct request_queue *queue; 131 struct request_queue *queue;
123 void *private_data; 132 void *private_data;
124 sector_t capacity; 133 sector_t capacity;
125 134
126 int flags; 135 int flags;
127 struct device *driverfs_dev; 136 struct device *driverfs_dev; // FIXME: remove
128 struct kobject kobj; 137 struct device dev;
129 struct kobject *holder_dir; 138 struct kobject *holder_dir;
130 struct kobject *slave_dir; 139 struct kobject *slave_dir;
131 140
@@ -143,13 +152,6 @@ struct gendisk {
143 struct work_struct async_notify; 152 struct work_struct async_notify;
144}; 153};
145 154
146/* Structure for sysfs attributes on block devices */
147struct disk_attribute {
148 struct attribute attr;
149 ssize_t (*show)(struct gendisk *, char *);
150 ssize_t (*store)(struct gendisk *, const char *, size_t);
151};
152
153/* 155/*
154 * Macros to operate on percpu disk statistics: 156 * Macros to operate on percpu disk statistics:
155 * 157 *
@@ -411,7 +413,8 @@ struct unixware_disklabel {
411#define ADDPART_FLAG_RAID 1 413#define ADDPART_FLAG_RAID 1
412#define ADDPART_FLAG_WHOLEDISK 2 414#define ADDPART_FLAG_WHOLEDISK 2
413 415
414char *disk_name (struct gendisk *hd, int part, char *buf); 416extern dev_t blk_lookup_devt(const char *name);
417extern char *disk_name (struct gendisk *hd, int part, char *buf);
415 418
416extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); 419extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
417extern void add_partition(struct gendisk *, int, sector_t, sector_t, int); 420extern void add_partition(struct gendisk *, int, sector_t, sector_t, int);
@@ -423,12 +426,12 @@ extern struct gendisk *alloc_disk(int minors);
423extern struct kobject *get_disk(struct gendisk *disk); 426extern struct kobject *get_disk(struct gendisk *disk);
424extern void put_disk(struct gendisk *disk); 427extern void put_disk(struct gendisk *disk);
425extern void genhd_media_change_notify(struct gendisk *disk); 428extern void genhd_media_change_notify(struct gendisk *disk);
426extern void blk_register_region(dev_t dev, unsigned long range, 429extern void blk_register_region(dev_t devt, unsigned long range,
427 struct module *module, 430 struct module *module,
428 struct kobject *(*probe)(dev_t, int *, void *), 431 struct kobject *(*probe)(dev_t, int *, void *),
429 int (*lock)(dev_t, void *), 432 int (*lock)(dev_t, void *),
430 void *data); 433 void *data);
431extern void blk_unregister_region(dev_t dev, unsigned long range); 434extern void blk_unregister_region(dev_t devt, unsigned long range);
432 435
433static inline struct block_device *bdget_disk(struct gendisk *disk, int index) 436static inline struct block_device *bdget_disk(struct gendisk *disk, int index)
434{ 437{
@@ -441,6 +444,12 @@ static inline struct block_device *bdget_disk(struct gendisk *disk, int index)
441 444
442static inline void printk_all_partitions(void) { } 445static inline void printk_all_partitions(void) { }
443 446
447static inline dev_t blk_lookup_devt(const char *name)
448{
449 dev_t devt = MKDEV(0, 0);
450 return devt;
451}
452
444#endif /* CONFIG_BLOCK */ 453#endif /* CONFIG_BLOCK */
445 454
446#endif 455#endif
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 8d302298a161..2961ec788046 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -72,11 +72,7 @@
72#define in_softirq() (softirq_count()) 72#define in_softirq() (softirq_count())
73#define in_interrupt() (irq_count()) 73#define in_interrupt() (irq_count())
74 74
75#if defined(CONFIG_PREEMPT) && !defined(CONFIG_PREEMPT_BKL) 75#define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0)
76# define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())
77#else
78# define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0)
79#endif
80 76
81#ifdef CONFIG_PREEMPT 77#ifdef CONFIG_PREEMPT
82# define PREEMPT_CHECK_OFFSET 1 78# define PREEMPT_CHECK_OFFSET 1
diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h
index 818c6afc1091..3882013d29ea 100644
--- a/include/linux/hdreg.h
+++ b/include/linux/hdreg.h
@@ -44,7 +44,9 @@
44 44
45/* Bits for HD_ERROR */ 45/* Bits for HD_ERROR */
46#define MARK_ERR 0x01 /* Bad address mark */ 46#define MARK_ERR 0x01 /* Bad address mark */
47#define ILI_ERR 0x01 /* Illegal Length Indication (ATAPI) */
47#define TRK0_ERR 0x02 /* couldn't find track 0 */ 48#define TRK0_ERR 0x02 /* couldn't find track 0 */
49#define EOM_ERR 0x02 /* End Of Media (ATAPI) */
48#define ABRT_ERR 0x04 /* Command aborted */ 50#define ABRT_ERR 0x04 /* Command aborted */
49#define MCR_ERR 0x08 /* media change request */ 51#define MCR_ERR 0x08 /* media change request */
50#define ID_ERR 0x10 /* ID field not found */ 52#define ID_ERR 0x10 /* ID field not found */
@@ -52,6 +54,7 @@
52#define ECC_ERR 0x40 /* Uncorrectable ECC error */ 54#define ECC_ERR 0x40 /* Uncorrectable ECC error */
53#define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */ 55#define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */
54#define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */ 56#define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */
57#define LFS_ERR 0xf0 /* Last Failed Sense (ATAPI) */
55 58
56/* Bits of HD_NSECTOR */ 59/* Bits of HD_NSECTOR */
57#define CD 0x01 60#define CD 0x01
@@ -70,13 +73,13 @@
70#define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(__u8)) 73#define HDIO_DRIVE_HOB_HDR_SIZE (8 * sizeof(__u8))
71#define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(__u8)) 74#define HDIO_DRIVE_TASK_HDR_SIZE (8 * sizeof(__u8))
72 75
73#define IDE_DRIVE_TASK_INVALID -1
74#define IDE_DRIVE_TASK_NO_DATA 0 76#define IDE_DRIVE_TASK_NO_DATA 0
77#ifndef __KERNEL__
78#define IDE_DRIVE_TASK_INVALID -1
75#define IDE_DRIVE_TASK_SET_XFER 1 79#define IDE_DRIVE_TASK_SET_XFER 1
76
77#define IDE_DRIVE_TASK_IN 2 80#define IDE_DRIVE_TASK_IN 2
78
79#define IDE_DRIVE_TASK_OUT 3 81#define IDE_DRIVE_TASK_OUT 3
82#endif
80#define IDE_DRIVE_TASK_RAW_WRITE 4 83#define IDE_DRIVE_TASK_RAW_WRITE 4
81 84
82/* 85/*
@@ -87,10 +90,10 @@
87#ifndef __KERNEL__ 90#ifndef __KERNEL__
88#define IDE_TASKFILE_STD_OUT_FLAGS 0xFE 91#define IDE_TASKFILE_STD_OUT_FLAGS 0xFE
89#define IDE_HOB_STD_OUT_FLAGS 0x3C 92#define IDE_HOB_STD_OUT_FLAGS 0x3C
90#endif
91 93
92typedef unsigned char task_ioreg_t; 94typedef unsigned char task_ioreg_t;
93typedef unsigned long sata_ioreg_t; 95typedef unsigned long sata_ioreg_t;
96#endif
94 97
95typedef union ide_reg_valid_s { 98typedef union ide_reg_valid_s {
96 unsigned all : 16; 99 unsigned all : 16;
@@ -116,8 +119,8 @@ typedef union ide_reg_valid_s {
116} ide_reg_valid_t; 119} ide_reg_valid_t;
117 120
118typedef struct ide_task_request_s { 121typedef struct ide_task_request_s {
119 task_ioreg_t io_ports[8]; 122 __u8 io_ports[8];
120 task_ioreg_t hob_ports[8]; 123 __u8 hob_ports[8]; /* bytes 6 and 7 are unused */
121 ide_reg_valid_t out_flags; 124 ide_reg_valid_t out_flags;
122 ide_reg_valid_t in_flags; 125 ide_reg_valid_t in_flags;
123 int data_phase; 126 int data_phase;
@@ -133,36 +136,35 @@ typedef struct ide_ioctl_request_s {
133} ide_ioctl_request_t; 136} ide_ioctl_request_t;
134 137
135struct hd_drive_cmd_hdr { 138struct hd_drive_cmd_hdr {
136 task_ioreg_t command; 139 __u8 command;
137 task_ioreg_t sector_number; 140 __u8 sector_number;
138 task_ioreg_t feature; 141 __u8 feature;
139 task_ioreg_t sector_count; 142 __u8 sector_count;
140}; 143};
141 144
145#ifndef __KERNEL__
142typedef struct hd_drive_task_hdr { 146typedef struct hd_drive_task_hdr {
143 task_ioreg_t data; 147 __u8 data;
144 task_ioreg_t feature; 148 __u8 feature;
145 task_ioreg_t sector_count; 149 __u8 sector_count;
146 task_ioreg_t sector_number; 150 __u8 sector_number;
147 task_ioreg_t low_cylinder; 151 __u8 low_cylinder;
148 task_ioreg_t high_cylinder; 152 __u8 high_cylinder;
149 task_ioreg_t device_head; 153 __u8 device_head;
150 task_ioreg_t command; 154 __u8 command;
151} task_struct_t; 155} task_struct_t;
152 156
153typedef struct hd_drive_hob_hdr { 157typedef struct hd_drive_hob_hdr {
154 task_ioreg_t data; 158 __u8 data;
155 task_ioreg_t feature; 159 __u8 feature;
156 task_ioreg_t sector_count; 160 __u8 sector_count;
157 task_ioreg_t sector_number; 161 __u8 sector_number;
158 task_ioreg_t low_cylinder; 162 __u8 low_cylinder;
159 task_ioreg_t high_cylinder; 163 __u8 high_cylinder;
160 task_ioreg_t device_head; 164 __u8 device_head;
161 task_ioreg_t control; 165 __u8 control;
162} hob_struct_t; 166} hob_struct_t;
163 167#endif
164#define TASKFILE_INVALID 0x7fff
165#define TASKFILE_48 0x8000
166 168
167#define TASKFILE_NO_DATA 0x0000 169#define TASKFILE_NO_DATA 0x0000
168 170
@@ -178,12 +180,16 @@ typedef struct hd_drive_hob_hdr {
178#define TASKFILE_IN_DMAQ 0x0080 180#define TASKFILE_IN_DMAQ 0x0080
179#define TASKFILE_OUT_DMAQ 0x0100 181#define TASKFILE_OUT_DMAQ 0x0100
180 182
183#ifndef __KERNEL__
181#define TASKFILE_P_IN 0x0200 184#define TASKFILE_P_IN 0x0200
182#define TASKFILE_P_OUT 0x0400 185#define TASKFILE_P_OUT 0x0400
183#define TASKFILE_P_IN_DMA 0x0800 186#define TASKFILE_P_IN_DMA 0x0800
184#define TASKFILE_P_OUT_DMA 0x1000 187#define TASKFILE_P_OUT_DMA 0x1000
185#define TASKFILE_P_IN_DMAQ 0x2000 188#define TASKFILE_P_IN_DMAQ 0x2000
186#define TASKFILE_P_OUT_DMAQ 0x4000 189#define TASKFILE_P_OUT_DMAQ 0x4000
190#define TASKFILE_48 0x8000
191#define TASKFILE_INVALID 0x7fff
192#endif
187 193
188/* ATA/ATAPI Commands pre T13 Spec */ 194/* ATA/ATAPI Commands pre T13 Spec */
189#define WIN_NOP 0x00 195#define WIN_NOP 0x00
@@ -700,8 +706,10 @@ struct hd_driveid {
700 */ 706 */
701#define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */ 707#define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */
702#define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */ 708#define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */
703#define IDE_NICE_0 (2) /* when sure that it won't affect us */
704#define IDE_NICE_1 (3) /* when probably won't affect us much */ 709#define IDE_NICE_1 (3) /* when probably won't affect us much */
710#ifndef __KERNEL__
711#define IDE_NICE_0 (2) /* when sure that it won't affect us */
705#define IDE_NICE_2 (4) /* when we know it's on our expense */ 712#define IDE_NICE_2 (4) /* when we know it's on our expense */
713#endif
706 714
707#endif /* _LINUX_HDREG_H */ 715#endif /* _LINUX_HDREG_H */
diff --git a/include/linux/hdsmart.h b/include/linux/hdsmart.h
index 7974a47fe582..e69192159d40 100644
--- a/include/linux/hdsmart.h
+++ b/include/linux/hdsmart.h
@@ -17,6 +17,7 @@
17#ifndef _LINUX_HDSMART_H 17#ifndef _LINUX_HDSMART_H
18#define _LINUX_HDSMART_H 18#define _LINUX_HDSMART_H
19 19
20#ifndef __KERNEL
20#define OFFLINE_FULL_SCAN 0 21#define OFFLINE_FULL_SCAN 0
21#define SHORT_SELF_TEST 1 22#define SHORT_SELF_TEST 1
22#define EXTEND_SELF_TEST 2 23#define EXTEND_SELF_TEST 2
@@ -120,5 +121,6 @@ typedef struct ata_smart_selftestlog_s {
120 unsigned char resevered[2]; 121 unsigned char resevered[2];
121 unsigned char chksum; 122 unsigned char chksum;
122} __attribute__ ((packed)) ata_smart_selftestlog_t; 123} __attribute__ ((packed)) ata_smart_selftestlog_t;
124#endif /* __KERNEL__ *
123 125
124#endif /* _LINUX_HDSMART_H */ 126#endif /* _LINUX_HDSMART_H */
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 6e35b92b1d2c..3902690647b0 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -267,10 +267,10 @@ struct hid_item {
267#define HID_QUIRK_2WHEEL_MOUSE_HACK_5 0x00000100 267#define HID_QUIRK_2WHEEL_MOUSE_HACK_5 0x00000100
268#define HID_QUIRK_2WHEEL_MOUSE_HACK_ON 0x00000200 268#define HID_QUIRK_2WHEEL_MOUSE_HACK_ON 0x00000200
269#define HID_QUIRK_MIGHTYMOUSE 0x00000400 269#define HID_QUIRK_MIGHTYMOUSE 0x00000400
270#define HID_QUIRK_POWERBOOK_HAS_FN 0x00000800 270#define HID_QUIRK_APPLE_HAS_FN 0x00000800
271#define HID_QUIRK_POWERBOOK_FN_ON 0x00001000 271#define HID_QUIRK_APPLE_FN_ON 0x00001000
272#define HID_QUIRK_INVERT_HWHEEL 0x00002000 272#define HID_QUIRK_INVERT_HWHEEL 0x00002000
273#define HID_QUIRK_POWERBOOK_ISO_KEYBOARD 0x00004000 273#define HID_QUIRK_APPLE_ISO_KEYBOARD 0x00004000
274#define HID_QUIRK_BAD_RELATIVE_KEYS 0x00008000 274#define HID_QUIRK_BAD_RELATIVE_KEYS 0x00008000
275#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 275#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
276#define HID_QUIRK_IGNORE_MOUSE 0x00020000 276#define HID_QUIRK_IGNORE_MOUSE 0x00020000
@@ -281,6 +281,9 @@ struct hid_item {
281#define HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL 0x00400000 281#define HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL 0x00400000
282#define HID_QUIRK_LOGITECH_EXPANDED_KEYMAP 0x00800000 282#define HID_QUIRK_LOGITECH_EXPANDED_KEYMAP 0x00800000
283#define HID_QUIRK_IGNORE_HIDINPUT 0x01000000 283#define HID_QUIRK_IGNORE_HIDINPUT 0x01000000
284#define HID_QUIRK_2WHEEL_MOUSE_HACK_B8 0x02000000
285#define HID_QUIRK_HWHEEL_WHEEL_INVERT 0x04000000
286#define HID_QUIRK_MICROSOFT_KEYS 0x08000000
284 287
285/* 288/*
286 * Separate quirks for runtime report descriptor fixup 289 * Separate quirks for runtime report descriptor fixup
@@ -291,6 +294,8 @@ struct hid_item {
291#define HID_QUIRK_RDESC_SWAPPED_MIN_MAX 0x00000004 294#define HID_QUIRK_RDESC_SWAPPED_MIN_MAX 0x00000004
292#define HID_QUIRK_RDESC_PETALYNX 0x00000008 295#define HID_QUIRK_RDESC_PETALYNX 0x00000008
293#define HID_QUIRK_RDESC_MACBOOK_JIS 0x00000010 296#define HID_QUIRK_RDESC_MACBOOK_JIS 0x00000010
297#define HID_QUIRK_RDESC_BUTTON_CONSUMER 0x00000020
298#define HID_QUIRK_RDESC_SAMSUNG_REMOTE 0x00000040
294 299
295/* 300/*
296 * This is the global environment of the parser. This information is 301 * This is the global environment of the parser. This information is
@@ -456,6 +461,8 @@ struct hid_device { /* device report descriptor */
456 461
457 void *driver_data; 462 void *driver_data;
458 463
464 __s32 delayed_value; /* For A4 Tech mice hwheel quirk */
465
459 /* device-specific function pointers */ 466 /* device-specific function pointers */
460 int (*hidinput_input_event) (struct input_dev *, unsigned int, unsigned int, int); 467 int (*hidinput_input_event) (struct input_dev *, unsigned int, unsigned int, int);
461 int (*hid_open) (struct hid_device *); 468 int (*hid_open) (struct hid_device *);
@@ -469,7 +476,7 @@ struct hid_device { /* device report descriptor */
469 /* handler for raw output data, used by hidraw */ 476 /* handler for raw output data, used by hidraw */
470 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t); 477 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t);
471#ifdef CONFIG_USB_HIDINPUT_POWERBOOK 478#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
472 unsigned long pb_pressed_fn[BITS_TO_LONGS(KEY_CNT)]; 479 unsigned long apple_pressed_fn[BITS_TO_LONGS(KEY_CNT)];
473 unsigned long pb_pressed_numlock[BITS_TO_LONGS(KEY_CNT)]; 480 unsigned long pb_pressed_numlock[BITS_TO_LONGS(KEY_CNT)];
474#endif 481#endif
475}; 482};
@@ -520,6 +527,9 @@ extern void hidinput_disconnect(struct hid_device *);
520int hid_set_field(struct hid_field *, unsigned, __s32); 527int hid_set_field(struct hid_field *, unsigned, __s32);
521int hid_input_report(struct hid_device *, int type, u8 *, int, int); 528int hid_input_report(struct hid_device *, int type, u8 *, int, int);
522int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field); 529int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
530int hidinput_mapping_quirks(struct hid_usage *, struct input_dev *, unsigned long **, int *);
531void hidinput_event_quirks(struct hid_device *, struct hid_field *, struct hid_usage *, __s32);
532int hidinput_apple_event(struct hid_device *, struct input_dev *, struct hid_usage *, __s32);
523void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt); 533void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt);
524void hid_output_report(struct hid_report *report, __u8 *data); 534void hid_output_report(struct hid_report *report, __u8 *data);
525void hid_free_device(struct hid_device *device); 535void hid_free_device(struct hid_device *device);
diff --git a/include/linux/hpet.h b/include/linux/hpet.h
index 707f7cb9e795..9cd94bfd07e5 100644
--- a/include/linux/hpet.h
+++ b/include/linux/hpet.h
@@ -64,7 +64,7 @@ struct hpet {
64 */ 64 */
65 65
66#define Tn_INT_ROUTE_CAP_MASK (0xffffffff00000000ULL) 66#define Tn_INT_ROUTE_CAP_MASK (0xffffffff00000000ULL)
67#define Tn_INI_ROUTE_CAP_SHIFT (32UL) 67#define Tn_INT_ROUTE_CAP_SHIFT (32UL)
68#define Tn_FSB_INT_DELCAP_MASK (0x8000UL) 68#define Tn_FSB_INT_DELCAP_MASK (0x8000UL)
69#define Tn_FSB_INT_DELCAP_SHIFT (15) 69#define Tn_FSB_INT_DELCAP_SHIFT (15)
70#define Tn_FSB_EN_CNF_MASK (0x4000UL) 70#define Tn_FSB_EN_CNF_MASK (0x4000UL)
@@ -115,9 +115,6 @@ static inline void hpet_reserve_timer(struct hpet_data *hd, int timer)
115} 115}
116 116
117int hpet_alloc(struct hpet_data *); 117int hpet_alloc(struct hpet_data *);
118int hpet_register(struct hpet_task *, int);
119int hpet_unregister(struct hpet_task *);
120int hpet_control(struct hpet_task *, unsigned int, unsigned long);
121 118
122#endif /* __KERNEL__ */ 119#endif /* __KERNEL__ */
123 120
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 7a9398e19704..49067f14fac1 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -115,10 +115,8 @@ struct hrtimer {
115 enum hrtimer_restart (*function)(struct hrtimer *); 115 enum hrtimer_restart (*function)(struct hrtimer *);
116 struct hrtimer_clock_base *base; 116 struct hrtimer_clock_base *base;
117 unsigned long state; 117 unsigned long state;
118#ifdef CONFIG_HIGH_RES_TIMERS
119 enum hrtimer_cb_mode cb_mode; 118 enum hrtimer_cb_mode cb_mode;
120 struct list_head cb_entry; 119 struct list_head cb_entry;
121#endif
122#ifdef CONFIG_TIMER_STATS 120#ifdef CONFIG_TIMER_STATS
123 void *start_site; 121 void *start_site;
124 char start_comm[16]; 122 char start_comm[16];
@@ -194,10 +192,10 @@ struct hrtimer_cpu_base {
194 spinlock_t lock; 192 spinlock_t lock;
195 struct lock_class_key lock_key; 193 struct lock_class_key lock_key;
196 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; 194 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES];
195 struct list_head cb_pending;
197#ifdef CONFIG_HIGH_RES_TIMERS 196#ifdef CONFIG_HIGH_RES_TIMERS
198 ktime_t expires_next; 197 ktime_t expires_next;
199 int hres_active; 198 int hres_active;
200 struct list_head cb_pending;
201 unsigned long nr_events; 199 unsigned long nr_events;
202#endif 200#endif
203}; 201};
@@ -217,6 +215,11 @@ static inline ktime_t hrtimer_cb_get_time(struct hrtimer *timer)
217 return timer->base->get_time(); 215 return timer->base->get_time();
218} 216}
219 217
218static inline int hrtimer_is_hres_active(struct hrtimer *timer)
219{
220 return timer->base->cpu_base->hres_active;
221}
222
220/* 223/*
221 * The resolution of the clocks. The resolution value is returned in 224 * The resolution of the clocks. The resolution value is returned in
222 * the clock_getres() system call to give application programmers an 225 * the clock_getres() system call to give application programmers an
@@ -248,6 +251,10 @@ static inline ktime_t hrtimer_cb_get_time(struct hrtimer *timer)
248 return timer->base->softirq_time; 251 return timer->base->softirq_time;
249} 252}
250 253
254static inline int hrtimer_is_hres_active(struct hrtimer *timer)
255{
256 return 0;
257}
251#endif 258#endif
252 259
253extern ktime_t ktime_get(void); 260extern ktime_t ktime_get(void);
@@ -310,6 +317,7 @@ extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl,
310 317
311/* Soft interrupt function to run the hrtimer queues: */ 318/* Soft interrupt function to run the hrtimer queues: */
312extern void hrtimer_run_queues(void); 319extern void hrtimer_run_queues(void);
320extern void hrtimer_run_pending(void);
313 321
314/* Bootup initialization: */ 322/* Bootup initialization: */
315extern void __init hrtimers_init(void); 323extern void __init hrtimers_init(void);
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index ea0f50bfbe03..30d606afcafe 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -19,7 +19,7 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
19int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 19int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *);
20int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 20int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *);
21int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); 21int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
22int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int); 22int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int, int);
23void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); 23void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long);
24void __unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); 24void __unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long);
25int hugetlb_prefault(struct address_space *, struct vm_area_struct *); 25int hugetlb_prefault(struct address_space *, struct vm_area_struct *);
@@ -33,7 +33,7 @@ void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed);
33 33
34extern unsigned long max_huge_pages; 34extern unsigned long max_huge_pages;
35extern unsigned long hugepages_treat_as_movable; 35extern unsigned long hugepages_treat_as_movable;
36extern int hugetlb_dynamic_pool; 36extern unsigned long nr_overcommit_huge_pages;
37extern const unsigned long hugetlb_zero, hugetlb_infinity; 37extern const unsigned long hugetlb_zero, hugetlb_infinity;
38extern int sysctl_hugetlb_shm_group; 38extern int sysctl_hugetlb_shm_group;
39 39
@@ -106,7 +106,7 @@ static inline unsigned long hugetlb_total_pages(void)
106 return 0; 106 return 0;
107} 107}
108 108
109#define follow_hugetlb_page(m,v,p,vs,a,b,i) ({ BUG(); 0; }) 109#define follow_hugetlb_page(m,v,p,vs,a,b,i,w) ({ BUG(); 0; })
110#define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL) 110#define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL)
111#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) 111#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; })
112#define hugetlb_prefault(mapping, vma) ({ BUG(); 0; }) 112#define hugetlb_prefault(mapping, vma) ({ BUG(); 0; })
@@ -165,8 +165,10 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
165extern const struct file_operations hugetlbfs_file_operations; 165extern const struct file_operations hugetlbfs_file_operations;
166extern struct vm_operations_struct hugetlb_vm_ops; 166extern struct vm_operations_struct hugetlb_vm_ops;
167struct file *hugetlb_file_setup(const char *name, size_t); 167struct file *hugetlb_file_setup(const char *name, size_t);
168int hugetlb_get_quota(struct address_space *mapping); 168int hugetlb_get_quota(struct address_space *mapping, long delta);
169void hugetlb_put_quota(struct address_space *mapping); 169void hugetlb_put_quota(struct address_space *mapping, long delta);
170
171#define BLOCKS_PER_HUGEPAGE (HPAGE_SIZE / 512)
170 172
171static inline int is_file_hugepages(struct file *file) 173static inline int is_file_hugepages(struct file *file)
172{ 174{
diff --git a/include/linux/hw_random.h b/include/linux/hw_random.h
index 21ea7610e177..85d11916e9ea 100644
--- a/include/linux/hw_random.h
+++ b/include/linux/hw_random.h
@@ -33,7 +33,7 @@ struct hwrng {
33 const char *name; 33 const char *name;
34 int (*init)(struct hwrng *rng); 34 int (*init)(struct hwrng *rng);
35 void (*cleanup)(struct hwrng *rng); 35 void (*cleanup)(struct hwrng *rng);
36 int (*data_present)(struct hwrng *rng); 36 int (*data_present)(struct hwrng *rng, int wait);
37 int (*data_read)(struct hwrng *rng, u32 *data); 37 int (*data_read)(struct hwrng *rng, u32 *data);
38 unsigned long priv; 38 unsigned long priv;
39 39
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index 88c81403eb3f..f922b060158b 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -23,29 +23,23 @@
23#ifndef LINUX_I2C_ID_H 23#ifndef LINUX_I2C_ID_H
24#define LINUX_I2C_ID_H 24#define LINUX_I2C_ID_H
25 25
26/* Please note that I2C driver IDs are optional. They are only needed if a
27 legacy chip driver needs to identify a bus or a bus driver needs to
28 identify a legacy client. If you don't need them, just don't set them. */
29
26/* 30/*
27 * ---- Driver types ----------------------------------------------------- 31 * ---- Driver types -----------------------------------------------------
28 */ 32 */
29 33
30#define I2C_DRIVERID_MSP3400 1 34#define I2C_DRIVERID_MSP3400 1
31#define I2C_DRIVERID_TUNER 2 35#define I2C_DRIVERID_TUNER 2
32#define I2C_DRIVERID_VIDEOTEX 3 /* please rename */
33#define I2C_DRIVERID_TDA8425 4 /* stereo sound processor */ 36#define I2C_DRIVERID_TDA8425 4 /* stereo sound processor */
34#define I2C_DRIVERID_TEA6420 5 /* audio matrix switch */ 37#define I2C_DRIVERID_TEA6420 5 /* audio matrix switch */
35#define I2C_DRIVERID_TEA6415C 6 /* video matrix switch */ 38#define I2C_DRIVERID_TEA6415C 6 /* video matrix switch */
36#define I2C_DRIVERID_TDA9840 7 /* stereo sound processor */ 39#define I2C_DRIVERID_TDA9840 7 /* stereo sound processor */
37#define I2C_DRIVERID_SAA7111A 8 /* video input processor */ 40#define I2C_DRIVERID_SAA7111A 8 /* video input processor */
38#define I2C_DRIVERID_SAA5281 9 /* videotext decoder */
39#define I2C_DRIVERID_SAA7112 10 /* video decoder, image scaler */
40#define I2C_DRIVERID_SAA7120 11 /* video encoder */
41#define I2C_DRIVERID_SAA7121 12 /* video encoder */
42#define I2C_DRIVERID_SAA7185B 13 /* video encoder */ 41#define I2C_DRIVERID_SAA7185B 13 /* video encoder */
43#define I2C_DRIVERID_CH7003 14 /* digital pc to tv encoder */
44#define I2C_DRIVERID_PCF8574A 15 /* i2c expander - 8 bit in/out */
45#define I2C_DRIVERID_PCF8582C 16 /* eeprom */
46#define I2C_DRIVERID_AT24Cxx 17 /* eeprom 1/2/4/8/16 K */
47#define I2C_DRIVERID_TEA6300 18 /* audio mixer */ 42#define I2C_DRIVERID_TEA6300 18 /* audio mixer */
48#define I2C_DRIVERID_BT829 19 /* pc to tv encoder */
49#define I2C_DRIVERID_TDA9850 20 /* audio mixer */ 43#define I2C_DRIVERID_TDA9850 20 /* audio mixer */
50#define I2C_DRIVERID_TDA9855 21 /* audio mixer */ 44#define I2C_DRIVERID_TDA9855 21 /* audio mixer */
51#define I2C_DRIVERID_SAA7110 22 /* video decoder */ 45#define I2C_DRIVERID_SAA7110 22 /* video decoder */
@@ -56,42 +50,19 @@
56#define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */ 50#define I2C_DRIVERID_TDA7432 27 /* Stereo sound processor */
57#define I2C_DRIVERID_TVMIXER 28 /* Mixer driver for tv cards */ 51#define I2C_DRIVERID_TVMIXER 28 /* Mixer driver for tv cards */
58#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */ 52#define I2C_DRIVERID_TVAUDIO 29 /* Generic TV sound driver */
59#define I2C_DRIVERID_DPL3518 30 /* Dolby decoder chip */
60#define I2C_DRIVERID_TDA9873 31 /* TV sound decoder chip */ 53#define I2C_DRIVERID_TDA9873 31 /* TV sound decoder chip */
61#define I2C_DRIVERID_TDA9875 32 /* TV sound decoder chip */ 54#define I2C_DRIVERID_TDA9875 32 /* TV sound decoder chip */
62#define I2C_DRIVERID_PIC16C54_PV9 33 /* Audio mux/ir receiver */ 55#define I2C_DRIVERID_PIC16C54_PV9 33 /* Audio mux/ir receiver */
63
64#define I2C_DRIVERID_SBATT 34 /* Smart Battery Device */
65#define I2C_DRIVERID_SBS 35 /* SB System Manager */
66#define I2C_DRIVERID_VES1893 36 /* VLSI DVB-S decoder */
67#define I2C_DRIVERID_VES1820 37 /* VLSI DVB-C decoder */
68#define I2C_DRIVERID_SAA7113 38 /* video decoder */
69#define I2C_DRIVERID_TDA8444 39 /* octuple 6-bit DAC */
70#define I2C_DRIVERID_BT819 40 /* video decoder */ 56#define I2C_DRIVERID_BT819 40 /* video decoder */
71#define I2C_DRIVERID_BT856 41 /* video encoder */ 57#define I2C_DRIVERID_BT856 41 /* video encoder */
72#define I2C_DRIVERID_VPX3220 42 /* video decoder+vbi/vtxt */ 58#define I2C_DRIVERID_VPX3220 42 /* video decoder+vbi/vtxt */
73#define I2C_DRIVERID_DRP3510 43 /* ADR decoder (Astra Radio) */
74#define I2C_DRIVERID_SP5055 44 /* Satellite tuner */
75#define I2C_DRIVERID_STV0030 45 /* Multipurpose switch */
76#define I2C_DRIVERID_SAA7108 46 /* video decoder, image scaler */
77#define I2C_DRIVERID_DS1307 47 /* DS1307 real time clock */
78#define I2C_DRIVERID_ADV7175 48 /* ADV 7175/7176 video encoder */ 59#define I2C_DRIVERID_ADV7175 48 /* ADV 7175/7176 video encoder */
79#define I2C_DRIVERID_SAA7114 49 /* video decoder */ 60#define I2C_DRIVERID_SAA7114 49 /* video decoder */
80#define I2C_DRIVERID_ZR36120 50 /* Zoran 36120 video encoder */
81#define I2C_DRIVERID_24LC32A 51 /* Microchip 24LC32A 32k EEPROM */
82#define I2C_DRIVERID_STM41T00 52 /* real time clock */
83#define I2C_DRIVERID_UDA1342 53 /* UDA1342 audio codec */
84#define I2C_DRIVERID_ADV7170 54 /* video encoder */ 61#define I2C_DRIVERID_ADV7170 54 /* video encoder */
85#define I2C_DRIVERID_MAX1617 56 /* temp sensor */
86#define I2C_DRIVERID_SAA7191 57 /* video decoder */ 62#define I2C_DRIVERID_SAA7191 57 /* video decoder */
87#define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */ 63#define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */
88#define I2C_DRIVERID_BT832 59 /* CMOS camera video processor */
89#define I2C_DRIVERID_TDA9887 60 /* TDA988x IF-PLL demodulator */
90#define I2C_DRIVERID_OVCAMCHIP 61 /* OmniVision CMOS image sens. */ 64#define I2C_DRIVERID_OVCAMCHIP 61 /* OmniVision CMOS image sens. */
91#define I2C_DRIVERID_TDA7313 62 /* TDA7313 audio processor */
92#define I2C_DRIVERID_MAX6900 63 /* MAX6900 real-time clock */ 65#define I2C_DRIVERID_MAX6900 63 /* MAX6900 real-time clock */
93#define I2C_DRIVERID_SAA7114H 64 /* video decoder */
94#define I2C_DRIVERID_DS1374 65 /* DS1374 real time clock */
95#define I2C_DRIVERID_TDA9874 66 /* TV sound decoder */ 66#define I2C_DRIVERID_TDA9874 66 /* TV sound decoder */
96#define I2C_DRIVERID_SAA6752HS 67 /* MPEG2 encoder */ 67#define I2C_DRIVERID_SAA6752HS 67 /* MPEG2 encoder */
97#define I2C_DRIVERID_TVEEPROM 68 /* TV EEPROM */ 68#define I2C_DRIVERID_TVEEPROM 68 /* TV EEPROM */
@@ -110,7 +81,6 @@
110#define I2C_DRIVERID_DS1672 81 /* Dallas/Maxim DS1672 RTC */ 81#define I2C_DRIVERID_DS1672 81 /* Dallas/Maxim DS1672 RTC */
111#define I2C_DRIVERID_X1205 82 /* Xicor/Intersil X1205 RTC */ 82#define I2C_DRIVERID_X1205 82 /* Xicor/Intersil X1205 RTC */
112#define I2C_DRIVERID_PCF8563 83 /* Philips PCF8563 RTC */ 83#define I2C_DRIVERID_PCF8563 83 /* Philips PCF8563 RTC */
113#define I2C_DRIVERID_RS5C372 84 /* Ricoh RS5C372 RTC */
114#define I2C_DRIVERID_BT866 85 /* Conexant bt866 video encoder */ 84#define I2C_DRIVERID_BT866 85 /* Conexant bt866 video encoder */
115#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */ 85#define I2C_DRIVERID_KS0127 86 /* Samsung ks0127 video decoder */
116#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */ 86#define I2C_DRIVERID_TLV320AIC23B 87 /* TI TLV320AIC23B audio codec */
@@ -121,10 +91,10 @@
121#define I2C_DRIVERID_LM4857 92 /* LM4857 Audio Amplifier */ 91#define I2C_DRIVERID_LM4857 92 /* LM4857 Audio Amplifier */
122#define I2C_DRIVERID_VP27SMPX 93 /* Panasonic VP27s tuner internal MPX */ 92#define I2C_DRIVERID_VP27SMPX 93 /* Panasonic VP27s tuner internal MPX */
123#define I2C_DRIVERID_CS4270 94 /* Cirrus Logic 4270 audio codec */ 93#define I2C_DRIVERID_CS4270 94 /* Cirrus Logic 4270 audio codec */
94#define I2C_DRIVERID_M52790 95 /* Mitsubishi M52790SP/FP AV switch */
95#define I2C_DRIVERID_CS5345 96 /* cs5345 audio processor */
124 96
125#define I2C_DRIVERID_I2CDEV 900 97#define I2C_DRIVERID_I2CDEV 900
126#define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */
127#define I2C_DRIVERID_ALERT 903 /* SMBus Alert Responder Client */
128 98
129/* IDs -- Use DRIVERIDs 1000-1999 for sensors. 99/* IDs -- Use DRIVERIDs 1000-1999 for sensors.
130 These were originally in sensors.h in the lm_sensors package */ 100 These were originally in sensors.h in the lm_sensors package */
@@ -170,24 +140,16 @@
170 140
171/* --- Bit algorithm adapters */ 141/* --- Bit algorithm adapters */
172#define I2C_HW_B_LP 0x010000 /* Parallel port Philips style */ 142#define I2C_HW_B_LP 0x010000 /* Parallel port Philips style */
173#define I2C_HW_B_SER 0x010002 /* Serial line interface */
174#define I2C_HW_B_BT848 0x010005 /* BT848 video boards */ 143#define I2C_HW_B_BT848 0x010005 /* BT848 video boards */
175#define I2C_HW_B_WNV 0x010006 /* Winnov Videums */
176#define I2C_HW_B_VIA 0x010007 /* Via vt82c586b */ 144#define I2C_HW_B_VIA 0x010007 /* Via vt82c586b */
177#define I2C_HW_B_HYDRA 0x010008 /* Apple Hydra Mac I/O */ 145#define I2C_HW_B_HYDRA 0x010008 /* Apple Hydra Mac I/O */
178#define I2C_HW_B_G400 0x010009 /* Matrox G400 */ 146#define I2C_HW_B_G400 0x010009 /* Matrox G400 */
179#define I2C_HW_B_I810 0x01000a /* Intel I810 */ 147#define I2C_HW_B_I810 0x01000a /* Intel I810 */
180#define I2C_HW_B_VOO 0x01000b /* 3dfx Voodoo 3 / Banshee */ 148#define I2C_HW_B_VOO 0x01000b /* 3dfx Voodoo 3 / Banshee */
181#define I2C_HW_B_PPORT 0x01000c /* Primitive parallel port adapter */
182#define I2C_HW_B_SAVG 0x01000d /* Savage 4 */
183#define I2C_HW_B_SCX200 0x01000e /* Nat'l Semi SCx200 I2C */ 149#define I2C_HW_B_SCX200 0x01000e /* Nat'l Semi SCx200 I2C */
184#define I2C_HW_B_RIVA 0x010010 /* Riva based graphics cards */ 150#define I2C_HW_B_RIVA 0x010010 /* Riva based graphics cards */
185#define I2C_HW_B_IOC 0x010011 /* IOC bit-wiggling */ 151#define I2C_HW_B_IOC 0x010011 /* IOC bit-wiggling */
186#define I2C_HW_B_TSUNA 0x010012 /* DEC Tsunami chipset */
187#define I2C_HW_B_OMAHA 0x010014 /* Omaha I2C interface (ARM) */
188#define I2C_HW_B_GUIDE 0x010015 /* Guide bit-basher */
189#define I2C_HW_B_IXP2000 0x010016 /* GPIO on IXP2000 systems */ 152#define I2C_HW_B_IXP2000 0x010016 /* GPIO on IXP2000 systems */
190#define I2C_HW_B_IXP4XX 0x010017 /* GPIO on IXP4XX systems */
191#define I2C_HW_B_S3VIA 0x010018 /* S3Via ProSavage adapter */ 153#define I2C_HW_B_S3VIA 0x010018 /* S3Via ProSavage adapter */
192#define I2C_HW_B_ZR36067 0x010019 /* Zoran-36057/36067 based boards */ 154#define I2C_HW_B_ZR36067 0x010019 /* Zoran-36057/36067 based boards */
193#define I2C_HW_B_PCILYNX 0x01001a /* TI PCILynx I2C adapter */ 155#define I2C_HW_B_PCILYNX 0x01001a /* TI PCILynx I2C adapter */
@@ -201,22 +163,11 @@
201#define I2C_HW_B_CX23885 0x010022 /* conexant 23885 based tv cards (bus1) */ 163#define I2C_HW_B_CX23885 0x010022 /* conexant 23885 based tv cards (bus1) */
202 164
203/* --- PCF 8584 based algorithms */ 165/* --- PCF 8584 based algorithms */
204#define I2C_HW_P_LP 0x020000 /* Parallel port interface */
205#define I2C_HW_P_ISA 0x020001 /* generic ISA Bus inteface card */
206#define I2C_HW_P_ELEK 0x020002 /* Elektor ISA Bus inteface card */ 166#define I2C_HW_P_ELEK 0x020002 /* Elektor ISA Bus inteface card */
207 167
208/* --- PCA 9564 based algorithms */ 168/* --- PCA 9564 based algorithms */
209#define I2C_HW_A_ISA 0x1a0000 /* generic ISA Bus interface card */ 169#define I2C_HW_A_ISA 0x1a0000 /* generic ISA Bus interface card */
210 170
211/* --- ACPI Embedded controller algorithms */
212#define I2C_HW_ACPI_EC 0x1f0000
213
214/* --- MPC824x PowerPC adapters */
215#define I2C_HW_MPC824X 0x100001 /* Motorola 8240 / 8245 */
216
217/* --- MPC8xx PowerPC adapters */
218#define I2C_HW_MPC8XX_EPON 0x110000 /* Eponymous MPC8xx I2C adapter */
219
220/* --- PowerPC on-chip adapters */ 171/* --- PowerPC on-chip adapters */
221#define I2C_HW_OCP 0x120000 /* IBM on-chip I2C adapter */ 172#define I2C_HW_OCP 0x120000 /* IBM on-chip I2C adapter */
222 173
@@ -225,7 +176,6 @@
225 176
226/* --- SGI adapters */ 177/* --- SGI adapters */
227#define I2C_HW_SGI_VINO 0x160000 178#define I2C_HW_SGI_VINO 0x160000
228#define I2C_HW_SGI_MACE 0x160001
229 179
230/* --- XSCALE on-chip adapters */ 180/* --- XSCALE on-chip adapters */
231#define I2C_HW_IOP3XX 0x140000 181#define I2C_HW_IOP3XX 0x140000
@@ -249,17 +199,10 @@
249#define I2C_HW_SMBUS_W9968CF 0x04000d 199#define I2C_HW_SMBUS_W9968CF 0x04000d
250#define I2C_HW_SMBUS_OV511 0x04000e /* OV511(+) USB 1.1 webcam ICs */ 200#define I2C_HW_SMBUS_OV511 0x04000e /* OV511(+) USB 1.1 webcam ICs */
251#define I2C_HW_SMBUS_OV518 0x04000f /* OV518(+) USB 1.1 webcam ICs */ 201#define I2C_HW_SMBUS_OV518 0x04000f /* OV518(+) USB 1.1 webcam ICs */
252#define I2C_HW_SMBUS_OV519 0x040010 /* OV519 USB 1.1 webcam IC */
253#define I2C_HW_SMBUS_OVFX2 0x040011 /* Cypress/OmniVision FX2 webcam */ 202#define I2C_HW_SMBUS_OVFX2 0x040011 /* Cypress/OmniVision FX2 webcam */
254#define I2C_HW_SMBUS_CAFE 0x040012 /* Marvell 88ALP01 "CAFE" cam */ 203#define I2C_HW_SMBUS_CAFE 0x040012 /* Marvell 88ALP01 "CAFE" cam */
255#define I2C_HW_SMBUS_ALI1563 0x040013 204#define I2C_HW_SMBUS_ALI1563 0x040013
256 205
257/* --- ISA pseudo-adapter */
258#define I2C_HW_ISA 0x050000
259
260/* --- IPMB adapter */
261#define I2C_HW_IPMB 0x0c0000
262
263/* --- MCP107 adapter */ 206/* --- MCP107 adapter */
264#define I2C_HW_MPC107 0x0d0000 207#define I2C_HW_MPC107 0x0d0000
265 208
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 8033e6b33271..76014f8f3c60 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -140,7 +140,6 @@ struct i2c_driver {
140 int (*command)(struct i2c_client *client,unsigned int cmd, void *arg); 140 int (*command)(struct i2c_client *client,unsigned int cmd, void *arg);
141 141
142 struct device_driver driver; 142 struct device_driver driver;
143 struct list_head list;
144}; 143};
145#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver) 144#define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
146 145
@@ -155,12 +154,11 @@ struct i2c_driver {
155 * generic enough to hide second-sourcing and compatible revisions. 154 * generic enough to hide second-sourcing and compatible revisions.
156 * @adapter: manages the bus segment hosting this I2C device 155 * @adapter: manages the bus segment hosting this I2C device
157 * @driver: device's driver, hence pointer to access routines 156 * @driver: device's driver, hence pointer to access routines
158 * @usage_count: counts current number of users of this client
159 * @dev: Driver model device node for the slave. 157 * @dev: Driver model device node for the slave.
160 * @irq: indicates the IRQ generated by this device (if any) 158 * @irq: indicates the IRQ generated by this device (if any)
161 * @driver_name: Identifies new-style driver used with this device; also 159 * @driver_name: Identifies new-style driver used with this device; also
162 * used as the module name for hotplug/coldplug modprobe support. 160 * used as the module name for hotplug/coldplug modprobe support.
163 * @list: list of active/busy clients 161 * @list: list of active/busy clients (DEPRECATED)
164 * @released: used to synchronize client releases & detaches and references 162 * @released: used to synchronize client releases & detaches and references
165 * 163 *
166 * An i2c_client identifies a single device (i.e. chip) connected to an 164 * An i2c_client identifies a single device (i.e. chip) connected to an
@@ -175,16 +173,16 @@ struct i2c_client {
175 char name[I2C_NAME_SIZE]; 173 char name[I2C_NAME_SIZE];
176 struct i2c_adapter *adapter; /* the adapter we sit on */ 174 struct i2c_adapter *adapter; /* the adapter we sit on */
177 struct i2c_driver *driver; /* and our access routines */ 175 struct i2c_driver *driver; /* and our access routines */
178 int usage_count; /* How many accesses currently */
179 /* to the client */
180 struct device dev; /* the device structure */ 176 struct device dev; /* the device structure */
181 int irq; /* irq issued by device (or -1) */ 177 int irq; /* irq issued by device (or -1) */
182 char driver_name[KOBJ_NAME_LEN]; 178 char driver_name[KOBJ_NAME_LEN];
183 struct list_head list; 179 struct list_head list; /* DEPRECATED */
184 struct completion released; 180 struct completion released;
185}; 181};
186#define to_i2c_client(d) container_of(d, struct i2c_client, dev) 182#define to_i2c_client(d) container_of(d, struct i2c_client, dev)
187 183
184extern struct i2c_client *i2c_verify_client(struct device *dev);
185
188static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj) 186static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj)
189{ 187{
190 struct device * const dev = container_of(kobj, struct device, kobj); 188 struct device * const dev = container_of(kobj, struct device, kobj);
@@ -261,6 +259,12 @@ i2c_new_probed_device(struct i2c_adapter *adap,
261 struct i2c_board_info *info, 259 struct i2c_board_info *info,
262 unsigned short const *addr_list); 260 unsigned short const *addr_list);
263 261
262/* For devices that use several addresses, use i2c_new_dummy() to make
263 * client handles for the extra addresses.
264 */
265extern struct i2c_client *
266i2c_new_dummy(struct i2c_adapter *adap, u16 address, const char *type);
267
264extern void i2c_unregister_device(struct i2c_client *); 268extern void i2c_unregister_device(struct i2c_client *);
265 269
266/* Mainboard arch_initcall() code should register all its I2C devices. 270/* Mainboard arch_initcall() code should register all its I2C devices.
@@ -319,8 +323,7 @@ struct i2c_adapter {
319 struct device dev; /* the adapter device */ 323 struct device dev; /* the adapter device */
320 324
321 int nr; 325 int nr;
322 struct list_head clients; 326 struct list_head clients; /* DEPRECATED */
323 struct list_head list;
324 char name[48]; 327 char name[48];
325 struct completion dev_released; 328 struct completion dev_released;
326}; 329};
@@ -357,10 +360,10 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
357 * command line 360 * command line
358 */ 361 */
359struct i2c_client_address_data { 362struct i2c_client_address_data {
360 unsigned short *normal_i2c; 363 const unsigned short *normal_i2c;
361 unsigned short *probe; 364 const unsigned short *probe;
362 unsigned short *ignore; 365 const unsigned short *ignore;
363 unsigned short **forces; 366 const unsigned short * const *forces;
364}; 367};
365 368
366/* Internal numbers to terminate lists */ 369/* Internal numbers to terminate lists */
@@ -389,28 +392,20 @@ static inline int i2c_add_driver(struct i2c_driver *driver)
389extern int i2c_attach_client(struct i2c_client *); 392extern int i2c_attach_client(struct i2c_client *);
390extern int i2c_detach_client(struct i2c_client *); 393extern int i2c_detach_client(struct i2c_client *);
391 394
392/* Should be used to make sure that client-struct is valid and that it 395extern struct i2c_client *i2c_use_client(struct i2c_client *client);
393 is okay to access the i2c-client. 396extern void i2c_release_client(struct i2c_client *client);
394 returns -ENODEV if client has gone in the meantime */
395extern int i2c_use_client(struct i2c_client *);
396extern int i2c_release_client(struct i2c_client *);
397 397
398/* call the i2c_client->command() of all attached clients with 398/* call the i2c_client->command() of all attached clients with
399 * the given arguments */ 399 * the given arguments */
400extern void i2c_clients_command(struct i2c_adapter *adap, 400extern void i2c_clients_command(struct i2c_adapter *adap,
401 unsigned int cmd, void *arg); 401 unsigned int cmd, void *arg);
402 402
403/* returns -EBUSY if address has been taken, 0 if not. Note that the only
404 other place at which this is called is within i2c_attach_client; so
405 you can cheat by simply not registering. Not recommended, of course! */
406extern int i2c_check_addr (struct i2c_adapter *adapter, int addr);
407
408/* Detect function. It iterates over all possible addresses itself. 403/* Detect function. It iterates over all possible addresses itself.
409 * It will only call found_proc if some client is connected at the 404 * It will only call found_proc if some client is connected at the
410 * specific address (unless a 'force' matched); 405 * specific address (unless a 'force' matched);
411 */ 406 */
412extern int i2c_probe(struct i2c_adapter *adapter, 407extern int i2c_probe(struct i2c_adapter *adapter,
413 struct i2c_client_address_data *address_data, 408 const struct i2c_client_address_data *address_data,
414 int (*found_proc) (struct i2c_adapter *, int, int)); 409 int (*found_proc) (struct i2c_adapter *, int, int));
415 410
416extern struct i2c_adapter* i2c_get_adapter(int id); 411extern struct i2c_adapter* i2c_get_adapter(int id);
@@ -603,104 +598,93 @@ I2C_CLIENT_MODULE_PARM(probe, "List of adapter,address pairs to scan " \
603 "additionally"); \ 598 "additionally"); \
604I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \ 599I2C_CLIENT_MODULE_PARM(ignore, "List of adapter,address pairs not to " \
605 "scan"); \ 600 "scan"); \
606static struct i2c_client_address_data addr_data = { \ 601const static struct i2c_client_address_data addr_data = { \
607 .normal_i2c = normal_i2c, \ 602 .normal_i2c = normal_i2c, \
608 .probe = probe, \ 603 .probe = probe, \
609 .ignore = ignore, \ 604 .ignore = ignore, \
610 .forces = forces, \ 605 .forces = forces, \
611} 606}
612 607
608#define I2C_CLIENT_FORCE_TEXT \
609 "List of adapter,address pairs to boldly assume to be present"
610
613/* These are the ones you want to use in your own drivers. Pick the one 611/* These are the ones you want to use in your own drivers. Pick the one
614 which matches the number of devices the driver differenciates between. */ 612 which matches the number of devices the driver differenciates between. */
615#define I2C_CLIENT_INSMOD \ 613#define I2C_CLIENT_INSMOD \
616 I2C_CLIENT_MODULE_PARM(force, \ 614I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
617 "List of adapter,address pairs to boldly assume " \ 615static const unsigned short * const forces[] = { force, NULL }; \
618 "to be present"); \
619 static unsigned short *forces[] = { \
620 force, \
621 NULL \
622 }; \
623I2C_CLIENT_INSMOD_COMMON 616I2C_CLIENT_INSMOD_COMMON
624 617
625#define I2C_CLIENT_INSMOD_1(chip1) \ 618#define I2C_CLIENT_INSMOD_1(chip1) \
626enum chips { any_chip, chip1 }; \ 619enum chips { any_chip, chip1 }; \
627I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 620I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
628 "boldly assume to be present"); \
629I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 621I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
630static unsigned short *forces[] = { force, force_##chip1, NULL }; \ 622static const unsigned short * const forces[] = { force, \
623 force_##chip1, NULL }; \
631I2C_CLIENT_INSMOD_COMMON 624I2C_CLIENT_INSMOD_COMMON
632 625
633#define I2C_CLIENT_INSMOD_2(chip1, chip2) \ 626#define I2C_CLIENT_INSMOD_2(chip1, chip2) \
634enum chips { any_chip, chip1, chip2 }; \ 627enum chips { any_chip, chip1, chip2 }; \
635I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 628I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
636 "boldly assume to be present"); \
637I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 629I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
638I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 630I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
639static unsigned short *forces[] = { force, force_##chip1, \ 631static const unsigned short * const forces[] = { force, \
640 force_##chip2, NULL }; \ 632 force_##chip1, force_##chip2, NULL }; \
641I2C_CLIENT_INSMOD_COMMON 633I2C_CLIENT_INSMOD_COMMON
642 634
643#define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \ 635#define I2C_CLIENT_INSMOD_3(chip1, chip2, chip3) \
644enum chips { any_chip, chip1, chip2, chip3 }; \ 636enum chips { any_chip, chip1, chip2, chip3 }; \
645I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 637I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
646 "boldly assume to be present"); \
647I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 638I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
648I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 639I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
649I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ 640I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
650static unsigned short *forces[] = { force, force_##chip1, \ 641static const unsigned short * const forces[] = { force, \
651 force_##chip2, force_##chip3, \ 642 force_##chip1, force_##chip2, force_##chip3, NULL }; \
652 NULL }; \
653I2C_CLIENT_INSMOD_COMMON 643I2C_CLIENT_INSMOD_COMMON
654 644
655#define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \ 645#define I2C_CLIENT_INSMOD_4(chip1, chip2, chip3, chip4) \
656enum chips { any_chip, chip1, chip2, chip3, chip4 }; \ 646enum chips { any_chip, chip1, chip2, chip3, chip4 }; \
657I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 647I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
658 "boldly assume to be present"); \
659I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 648I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
660I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 649I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
661I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ 650I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
662I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ 651I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
663static unsigned short *forces[] = { force, force_##chip1, \ 652static const unsigned short * const forces[] = { force, \
664 force_##chip2, force_##chip3, \ 653 force_##chip1, force_##chip2, force_##chip3, \
665 force_##chip4, NULL}; \ 654 force_##chip4, NULL}; \
666I2C_CLIENT_INSMOD_COMMON 655I2C_CLIENT_INSMOD_COMMON
667 656
668#define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \ 657#define I2C_CLIENT_INSMOD_5(chip1, chip2, chip3, chip4, chip5) \
669enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \ 658enum chips { any_chip, chip1, chip2, chip3, chip4, chip5 }; \
670I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 659I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
671 "boldly assume to be present"); \
672I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 660I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
673I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 661I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
674I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ 662I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
675I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ 663I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
676I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ 664I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
677static unsigned short *forces[] = { force, force_##chip1, \ 665static const unsigned short * const forces[] = { force, \
678 force_##chip2, force_##chip3, \ 666 force_##chip1, force_##chip2, force_##chip3, \
679 force_##chip4, force_##chip5, \ 667 force_##chip4, force_##chip5, NULL }; \
680 NULL }; \
681I2C_CLIENT_INSMOD_COMMON 668I2C_CLIENT_INSMOD_COMMON
682 669
683#define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \ 670#define I2C_CLIENT_INSMOD_6(chip1, chip2, chip3, chip4, chip5, chip6) \
684enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \ 671enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6 }; \
685I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 672I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
686 "boldly assume to be present"); \
687I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 673I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
688I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 674I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
689I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ 675I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
690I2C_CLIENT_MODULE_PARM_FORCE(chip4); \ 676I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
691I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ 677I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
692I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ 678I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
693static unsigned short *forces[] = { force, force_##chip1, \ 679static const unsigned short * const forces[] = { force, \
694 force_##chip2, force_##chip3, \ 680 force_##chip1, force_##chip2, force_##chip3, \
695 force_##chip4, force_##chip5, \ 681 force_##chip4, force_##chip5, force_##chip6, NULL }; \
696 force_##chip6, NULL }; \
697I2C_CLIENT_INSMOD_COMMON 682I2C_CLIENT_INSMOD_COMMON
698 683
699#define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \ 684#define I2C_CLIENT_INSMOD_7(chip1, chip2, chip3, chip4, chip5, chip6, chip7) \
700enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ 685enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
701 chip7 }; \ 686 chip7 }; \
702I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 687I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
703 "boldly assume to be present"); \
704I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 688I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
705I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 689I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
706I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ 690I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
@@ -708,18 +692,16 @@ I2C_CLIENT_MODULE_PARM_FORCE(chip4); \
708I2C_CLIENT_MODULE_PARM_FORCE(chip5); \ 692I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
709I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ 693I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
710I2C_CLIENT_MODULE_PARM_FORCE(chip7); \ 694I2C_CLIENT_MODULE_PARM_FORCE(chip7); \
711static unsigned short *forces[] = { force, force_##chip1, \ 695static const unsigned short * const forces[] = { force, \
712 force_##chip2, force_##chip3, \ 696 force_##chip1, force_##chip2, force_##chip3, \
713 force_##chip4, force_##chip5, \ 697 force_##chip4, force_##chip5, force_##chip6, \
714 force_##chip6, force_##chip7, \ 698 force_##chip7, NULL }; \
715 NULL }; \
716I2C_CLIENT_INSMOD_COMMON 699I2C_CLIENT_INSMOD_COMMON
717 700
718#define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \ 701#define I2C_CLIENT_INSMOD_8(chip1, chip2, chip3, chip4, chip5, chip6, chip7, chip8) \
719enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \ 702enum chips { any_chip, chip1, chip2, chip3, chip4, chip5, chip6, \
720 chip7, chip8 }; \ 703 chip7, chip8 }; \
721I2C_CLIENT_MODULE_PARM(force, "List of adapter,address pairs to " \ 704I2C_CLIENT_MODULE_PARM(force, I2C_CLIENT_FORCE_TEXT); \
722 "boldly assume to be present"); \
723I2C_CLIENT_MODULE_PARM_FORCE(chip1); \ 705I2C_CLIENT_MODULE_PARM_FORCE(chip1); \
724I2C_CLIENT_MODULE_PARM_FORCE(chip2); \ 706I2C_CLIENT_MODULE_PARM_FORCE(chip2); \
725I2C_CLIENT_MODULE_PARM_FORCE(chip3); \ 707I2C_CLIENT_MODULE_PARM_FORCE(chip3); \
@@ -728,11 +710,10 @@ I2C_CLIENT_MODULE_PARM_FORCE(chip5); \
728I2C_CLIENT_MODULE_PARM_FORCE(chip6); \ 710I2C_CLIENT_MODULE_PARM_FORCE(chip6); \
729I2C_CLIENT_MODULE_PARM_FORCE(chip7); \ 711I2C_CLIENT_MODULE_PARM_FORCE(chip7); \
730I2C_CLIENT_MODULE_PARM_FORCE(chip8); \ 712I2C_CLIENT_MODULE_PARM_FORCE(chip8); \
731static unsigned short *forces[] = { force, force_##chip1, \ 713static const unsigned short * const forces[] = { force, \
732 force_##chip2, force_##chip3, \ 714 force_##chip1, force_##chip2, force_##chip3, \
733 force_##chip4, force_##chip5, \ 715 force_##chip4, force_##chip5, force_##chip6, \
734 force_##chip6, force_##chip7, \ 716 force_##chip7, force_##chip8, NULL }; \
735 force_##chip8, NULL }; \
736I2C_CLIENT_INSMOD_COMMON 717I2C_CLIENT_INSMOD_COMMON
737#endif /* __KERNEL__ */ 718#endif /* __KERNEL__ */
738#endif /* _LINUX_I2C_H */ 719#endif /* _LINUX_I2C_H */
diff --git a/include/linux/i2c/tps65010.h b/include/linux/i2c/tps65010.h
new file mode 100644
index 000000000000..7021635ed6a0
--- /dev/null
+++ b/include/linux/i2c/tps65010.h
@@ -0,0 +1,156 @@
1/* linux/i2c/tps65010.h
2 *
3 * Functions to access TPS65010 power management device.
4 *
5 * Copyright (C) 2004 Dirk Behme <dirk.behme@de.bosch.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
15 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27
28#ifndef __LINUX_I2C_TPS65010_H
29#define __LINUX_I2C_TPS65010_H
30
31/*
32 * ----------------------------------------------------------------------------
33 * Registers, all 8 bits
34 * ----------------------------------------------------------------------------
35 */
36
37#define TPS_CHGSTATUS 0x01
38# define TPS_CHG_USB (1 << 7)
39# define TPS_CHG_AC (1 << 6)
40# define TPS_CHG_THERM (1 << 5)
41# define TPS_CHG_TERM (1 << 4)
42# define TPS_CHG_TAPER_TMO (1 << 3)
43# define TPS_CHG_CHG_TMO (1 << 2)
44# define TPS_CHG_PRECHG_TMO (1 << 1)
45# define TPS_CHG_TEMP_ERR (1 << 0)
46#define TPS_REGSTATUS 0x02
47# define TPS_REG_ONOFF (1 << 7)
48# define TPS_REG_COVER (1 << 6)
49# define TPS_REG_UVLO (1 << 5)
50# define TPS_REG_NO_CHG (1 << 4) /* tps65013 */
51# define TPS_REG_PG_LD02 (1 << 3)
52# define TPS_REG_PG_LD01 (1 << 2)
53# define TPS_REG_PG_MAIN (1 << 1)
54# define TPS_REG_PG_CORE (1 << 0)
55#define TPS_MASK1 0x03
56#define TPS_MASK2 0x04
57#define TPS_ACKINT1 0x05
58#define TPS_ACKINT2 0x06
59#define TPS_CHGCONFIG 0x07
60# define TPS_CHARGE_POR (1 << 7) /* 65010/65012 */
61# define TPS65013_AUA (1 << 7) /* 65011/65013 */
62# define TPS_CHARGE_RESET (1 << 6)
63# define TPS_CHARGE_FAST (1 << 5)
64# define TPS_CHARGE_CURRENT (3 << 3)
65# define TPS_VBUS_500MA (1 << 2)
66# define TPS_VBUS_CHARGING (1 << 1)
67# define TPS_CHARGE_ENABLE (1 << 0)
68#define TPS_LED1_ON 0x08
69#define TPS_LED1_PER 0x09
70#define TPS_LED2_ON 0x0a
71#define TPS_LED2_PER 0x0b
72#define TPS_VDCDC1 0x0c
73# define TPS_ENABLE_LP (1 << 3)
74#define TPS_VDCDC2 0x0d
75#define TPS_VREGS1 0x0e
76# define TPS_LDO2_ENABLE (1 << 7)
77# define TPS_LDO2_OFF (1 << 6)
78# define TPS_VLDO2_3_0V (3 << 4)
79# define TPS_VLDO2_2_75V (2 << 4)
80# define TPS_VLDO2_2_5V (1 << 4)
81# define TPS_VLDO2_1_8V (0 << 4)
82# define TPS_LDO1_ENABLE (1 << 3)
83# define TPS_LDO1_OFF (1 << 2)
84# define TPS_VLDO1_3_0V (3 << 0)
85# define TPS_VLDO1_2_75V (2 << 0)
86# define TPS_VLDO1_2_5V (1 << 0)
87# define TPS_VLDO1_ADJ (0 << 0)
88#define TPS_MASK3 0x0f
89#define TPS_DEFGPIO 0x10
90
91/*
92 * ----------------------------------------------------------------------------
93 * Macros used by exported functions
94 * ----------------------------------------------------------------------------
95 */
96
97#define LED1 1
98#define LED2 2
99#define OFF 0
100#define ON 1
101#define BLINK 2
102#define GPIO1 1
103#define GPIO2 2
104#define GPIO3 3
105#define GPIO4 4
106#define LOW 0
107#define HIGH 1
108
109/*
110 * ----------------------------------------------------------------------------
111 * Exported functions
112 * ----------------------------------------------------------------------------
113 */
114
115/* Draw from VBUS:
116 * 0 mA -- DON'T DRAW (might supply power instead)
117 * 100 mA -- usb unit load (slowest charge rate)
118 * 500 mA -- usb high power (fast battery charge)
119 */
120extern int tps65010_set_vbus_draw(unsigned mA);
121
122/* tps65010_set_gpio_out_value parameter:
123 * gpio: GPIO1, GPIO2, GPIO3 or GPIO4
124 * value: LOW or HIGH
125 */
126extern int tps65010_set_gpio_out_value(unsigned gpio, unsigned value);
127
128/* tps65010_set_led parameter:
129 * led: LED1 or LED2
130 * mode: ON, OFF or BLINK
131 */
132extern int tps65010_set_led(unsigned led, unsigned mode);
133
134/* tps65010_set_vib parameter:
135 * value: ON or OFF
136 */
137extern int tps65010_set_vib(unsigned value);
138
139/* tps65010_set_low_pwr parameter:
140 * mode: ON or OFF
141 */
142extern int tps65010_set_low_pwr(unsigned mode);
143
144/* tps65010_config_vregs1 parameter:
145 * value to be written to VREGS1 register
146 * Note: The complete register is written, set all bits you need
147 */
148extern int tps65010_config_vregs1(unsigned value);
149
150/* tps65013_set_low_pwr parameter:
151 * mode: ON or OFF
152 */
153extern int tps65013_set_low_pwr(unsigned mode);
154
155#endif /* __LINUX_I2C_TPS65010_H */
156
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 4ed4777bba67..367c17084a28 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -9,7 +9,6 @@
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/ioport.h> 10#include <linux/ioport.h>
11#include <linux/hdreg.h> 11#include <linux/hdreg.h>
12#include <linux/hdsmart.h>
13#include <linux/blkdev.h> 12#include <linux/blkdev.h>
14#include <linux/proc_fs.h> 13#include <linux/proc_fs.h>
15#include <linux/interrupt.h> 14#include <linux/interrupt.h>
@@ -27,25 +26,10 @@
27#include <asm/semaphore.h> 26#include <asm/semaphore.h>
28#include <asm/mutex.h> 27#include <asm/mutex.h>
29 28
30/****************************************************************************** 29#if defined(CRIS) || defined(FRV)
31 * IDE driver configuration options (play with these as desired): 30# define SUPPORT_VLB_SYNC 0
32 * 31#else
33 * REALLY_SLOW_IO can be defined in ide.c and ide-cd.c, if necessary 32# define SUPPORT_VLB_SYNC 1
34 */
35#define INITIAL_MULT_COUNT 0 /* off=0; on=2,4,8,16,32, etc.. */
36
37#ifndef SUPPORT_SLOW_DATA_PORTS /* 1 to support slow data ports */
38#define SUPPORT_SLOW_DATA_PORTS 1 /* 0 to reduce kernel size */
39#endif
40#ifndef SUPPORT_VLB_SYNC /* 1 to support weird 32-bit chips */
41#define SUPPORT_VLB_SYNC 1 /* 0 to reduce kernel size */
42#endif
43#ifndef OK_TO_RESET_CONTROLLER /* 1 needed for good error recovery */
44#define OK_TO_RESET_CONTROLLER 1 /* 0 for use with AH2372A/B interface */
45#endif
46
47#ifndef DISABLE_IRQ_NOSYNC
48#define DISABLE_IRQ_NOSYNC 0
49#endif 33#endif
50 34
51/* 35/*
@@ -55,10 +39,6 @@
55 39
56#define IDE_NO_IRQ (-1) 40#define IDE_NO_IRQ (-1)
57 41
58/*
59 * "No user-serviceable parts" beyond this point :)
60 *****************************************************************************/
61
62typedef unsigned char byte; /* used everywhere */ 42typedef unsigned char byte; /* used everywhere */
63 43
64/* 44/*
@@ -103,8 +83,6 @@ typedef unsigned char byte; /* used everywhere */
103#define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET 83#define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET
104#define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET 84#define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET
105 85
106#define IDE_CONTROL_OFFSET_HOB (7)
107
108#define IDE_DATA_REG (HWIF(drive)->io_ports[IDE_DATA_OFFSET]) 86#define IDE_DATA_REG (HWIF(drive)->io_ports[IDE_DATA_OFFSET])
109#define IDE_ERROR_REG (HWIF(drive)->io_ports[IDE_ERROR_OFFSET]) 87#define IDE_ERROR_REG (HWIF(drive)->io_ports[IDE_ERROR_OFFSET])
110#define IDE_NSECTOR_REG (HWIF(drive)->io_ports[IDE_NSECTOR_OFFSET]) 88#define IDE_NSECTOR_REG (HWIF(drive)->io_ports[IDE_NSECTOR_OFFSET])
@@ -128,25 +106,18 @@ typedef unsigned char byte; /* used everywhere */
128#define BAD_W_STAT (BAD_R_STAT | WRERR_STAT) 106#define BAD_W_STAT (BAD_R_STAT | WRERR_STAT)
129#define BAD_STAT (BAD_R_STAT | DRQ_STAT) 107#define BAD_STAT (BAD_R_STAT | DRQ_STAT)
130#define DRIVE_READY (READY_STAT | SEEK_STAT) 108#define DRIVE_READY (READY_STAT | SEEK_STAT)
131#define DATA_READY (DRQ_STAT)
132 109
133#define BAD_CRC (ABRT_ERR | ICRC_ERR) 110#define BAD_CRC (ABRT_ERR | ICRC_ERR)
134 111
135#define SATA_NR_PORTS (3) /* 16 possible ?? */ 112#define SATA_NR_PORTS (3) /* 16 possible ?? */
136 113
137#define SATA_STATUS_OFFSET (0) 114#define SATA_STATUS_OFFSET (0)
138#define SATA_STATUS_REG (HWIF(drive)->sata_scr[SATA_STATUS_OFFSET])
139#define SATA_ERROR_OFFSET (1) 115#define SATA_ERROR_OFFSET (1)
140#define SATA_ERROR_REG (HWIF(drive)->sata_scr[SATA_ERROR_OFFSET])
141#define SATA_CONTROL_OFFSET (2) 116#define SATA_CONTROL_OFFSET (2)
142#define SATA_CONTROL_REG (HWIF(drive)->sata_scr[SATA_CONTROL_OFFSET])
143 117
144#define SATA_MISC_OFFSET (0) 118#define SATA_MISC_OFFSET (0)
145#define SATA_MISC_REG (HWIF(drive)->sata_misc[SATA_MISC_OFFSET])
146#define SATA_PHY_OFFSET (1) 119#define SATA_PHY_OFFSET (1)
147#define SATA_PHY_REG (HWIF(drive)->sata_misc[SATA_PHY_OFFSET])
148#define SATA_IEN_OFFSET (2) 120#define SATA_IEN_OFFSET (2)
149#define SATA_IEN_REG (HWIF(drive)->sata_misc[SATA_IEN_OFFSET])
150 121
151/* 122/*
152 * Our Physical Region Descriptor (PRD) table should be large enough 123 * Our Physical Region Descriptor (PRD) table should be large enough
@@ -219,8 +190,12 @@ typedef struct hw_regs_s {
219} hw_regs_t; 190} hw_regs_t;
220 191
221struct hwif_s * ide_find_port(unsigned long); 192struct hwif_s * ide_find_port(unsigned long);
193struct hwif_s *ide_deprecated_find_port(unsigned long);
194void ide_init_port_data(struct hwif_s *, unsigned int);
195void ide_init_port_hw(struct hwif_s *, hw_regs_t *);
222 196
223int ide_register_hw(hw_regs_t *, void (*)(struct hwif_s *), int, 197struct ide_drive_s;
198int ide_register_hw(hw_regs_t *, void (*)(struct ide_drive_s *),
224 struct hwif_s **); 199 struct hwif_s **);
225 200
226void ide_setup_ports( hw_regs_t *hw, 201void ide_setup_ports( hw_regs_t *hw,
@@ -327,47 +302,16 @@ static inline void ide_init_hwif_ports(hw_regs_t *hw,
327typedef union { 302typedef union {
328 unsigned all : 8; 303 unsigned all : 8;
329 struct { 304 struct {
330#if defined(__LITTLE_ENDIAN_BITFIELD)
331 unsigned set_geometry : 1; 305 unsigned set_geometry : 1;
332 unsigned recalibrate : 1; 306 unsigned recalibrate : 1;
333 unsigned set_multmode : 1; 307 unsigned set_multmode : 1;
334 unsigned set_tune : 1; 308 unsigned set_tune : 1;
335 unsigned serviced : 1; 309 unsigned serviced : 1;
336 unsigned reserved : 3; 310 unsigned reserved : 3;
337#elif defined(__BIG_ENDIAN_BITFIELD)
338 unsigned reserved : 3;
339 unsigned serviced : 1;
340 unsigned set_tune : 1;
341 unsigned set_multmode : 1;
342 unsigned recalibrate : 1;
343 unsigned set_geometry : 1;
344#else
345#error "Please fix <asm/byteorder.h>"
346#endif
347 } b; 311 } b;
348} special_t; 312} special_t;
349 313
350/* 314/*
351 * ATA DATA Register Special.
352 * ATA NSECTOR Count Register().
353 * ATAPI Byte Count Register.
354 */
355typedef union {
356 unsigned all :16;
357 struct {
358#if defined(__LITTLE_ENDIAN_BITFIELD)
359 unsigned low :8; /* LSB */
360 unsigned high :8; /* MSB */
361#elif defined(__BIG_ENDIAN_BITFIELD)
362 unsigned high :8; /* MSB */
363 unsigned low :8; /* LSB */
364#else
365#error "Please fix <asm/byteorder.h>"
366#endif
367 } b;
368} ata_nsector_t, ata_data_t, atapi_bcount_t;
369
370/*
371 * ATA-IDE Select Register, aka Device-Head 315 * ATA-IDE Select Register, aka Device-Head
372 * 316 *
373 * head : always zeros here 317 * head : always zeros here
@@ -398,131 +342,6 @@ typedef union {
398} select_t, ata_select_t; 342} select_t, ata_select_t;
399 343
400/* 344/*
401 * The ATA-IDE Status Register.
402 * The ATAPI Status Register.
403 *
404 * check : Error occurred
405 * idx : Index Error
406 * corr : Correctable error occurred
407 * drq : Data is request by the device
408 * dsc : Disk Seek Complete : ata
409 * : Media access command finished : atapi
410 * df : Device Fault : ata
411 * : Reserved : atapi
412 * drdy : Ready, Command Mode Capable : ata
413 * : Ignored for ATAPI commands : atapi
414 * bsy : Disk is Busy
415 * : The device has access to the command block
416 */
417typedef union {
418 unsigned all :8;
419 struct {
420#if defined(__LITTLE_ENDIAN_BITFIELD)
421 unsigned check :1;
422 unsigned idx :1;
423 unsigned corr :1;
424 unsigned drq :1;
425 unsigned dsc :1;
426 unsigned df :1;
427 unsigned drdy :1;
428 unsigned bsy :1;
429#elif defined(__BIG_ENDIAN_BITFIELD)
430 unsigned bsy :1;
431 unsigned drdy :1;
432 unsigned df :1;
433 unsigned dsc :1;
434 unsigned drq :1;
435 unsigned corr :1;
436 unsigned idx :1;
437 unsigned check :1;
438#else
439#error "Please fix <asm/byteorder.h>"
440#endif
441 } b;
442} ata_status_t, atapi_status_t;
443
444/*
445 * ATAPI Feature Register
446 *
447 * dma : Using DMA or PIO
448 * reserved321 : Reserved
449 * reserved654 : Reserved (Tag Type)
450 * reserved7 : Reserved
451 */
452typedef union {
453 unsigned all :8;
454 struct {
455#if defined(__LITTLE_ENDIAN_BITFIELD)
456 unsigned dma :1;
457 unsigned reserved321 :3;
458 unsigned reserved654 :3;
459 unsigned reserved7 :1;
460#elif defined(__BIG_ENDIAN_BITFIELD)
461 unsigned reserved7 :1;
462 unsigned reserved654 :3;
463 unsigned reserved321 :3;
464 unsigned dma :1;
465#else
466#error "Please fix <asm/byteorder.h>"
467#endif
468 } b;
469} atapi_feature_t;
470
471/*
472 * ATAPI Interrupt Reason Register.
473 *
474 * cod : Information transferred is command (1) or data (0)
475 * io : The device requests us to read (1) or write (0)
476 * reserved : Reserved
477 */
478typedef union {
479 unsigned all :8;
480 struct {
481#if defined(__LITTLE_ENDIAN_BITFIELD)
482 unsigned cod :1;
483 unsigned io :1;
484 unsigned reserved :6;
485#elif defined(__BIG_ENDIAN_BITFIELD)
486 unsigned reserved :6;
487 unsigned io :1;
488 unsigned cod :1;
489#else
490#error "Please fix <asm/byteorder.h>"
491#endif
492 } b;
493} atapi_ireason_t;
494
495/*
496 * The ATAPI error register.
497 *
498 * ili : Illegal Length Indication
499 * eom : End Of Media Detected
500 * abrt : Aborted command - As defined by ATA
501 * mcr : Media Change Requested - As defined by ATA
502 * sense_key : Sense key of the last failed packet command
503 */
504typedef union {
505 unsigned all :8;
506 struct {
507#if defined(__LITTLE_ENDIAN_BITFIELD)
508 unsigned ili :1;
509 unsigned eom :1;
510 unsigned abrt :1;
511 unsigned mcr :1;
512 unsigned sense_key :4;
513#elif defined(__BIG_ENDIAN_BITFIELD)
514 unsigned sense_key :4;
515 unsigned mcr :1;
516 unsigned abrt :1;
517 unsigned eom :1;
518 unsigned ili :1;
519#else
520#error "Please fix <asm/byteorder.h>"
521#endif
522 } b;
523} atapi_error_t;
524
525/*
526 * Status returned from various ide_ functions 345 * Status returned from various ide_ functions
527 */ 346 */
528typedef enum { 347typedef enum {
@@ -568,7 +387,6 @@ typedef struct ide_drive_s {
568 u8 state; /* retry state */ 387 u8 state; /* retry state */
569 u8 waiting_for_dma; /* dma currently in progress */ 388 u8 waiting_for_dma; /* dma currently in progress */
570 u8 unmask; /* okay to unmask other irqs */ 389 u8 unmask; /* okay to unmask other irqs */
571 u8 bswap; /* byte swap data */
572 u8 noflush; /* don't attempt flushes */ 390 u8 noflush; /* don't attempt flushes */
573 u8 dsc_overlap; /* DSC overlap */ 391 u8 dsc_overlap; /* DSC overlap */
574 u8 nice1; /* give potential excess bandwidth */ 392 u8 nice1; /* give potential excess bandwidth */
@@ -583,8 +401,6 @@ typedef struct ide_drive_s {
583 unsigned no_unmask : 1; /* disallow setting unmask bit */ 401 unsigned no_unmask : 1; /* disallow setting unmask bit */
584 unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */ 402 unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */
585 unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */ 403 unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */
586 unsigned nice0 : 1; /* give obvious excess bandwidth */
587 unsigned nice2 : 1; /* give a share in our own bandwidth */
588 unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ 404 unsigned doorlocking : 1; /* for removable only: door lock/unlock works */
589 unsigned nodma : 1; /* disallow DMA */ 405 unsigned nodma : 1; /* disallow DMA */
590 unsigned autotune : 2; /* 0=default, 1=autotune, 2=noautotune */ 406 unsigned autotune : 2; /* 0=default, 1=autotune, 2=noautotune */
@@ -664,7 +480,6 @@ typedef struct hwif_s {
664 u8 major; /* our major number */ 480 u8 major; /* our major number */
665 u8 index; /* 0 for ide0; 1 for ide1; ... */ 481 u8 index; /* 0 for ide0; 1 for ide1; ... */
666 u8 channel; /* for dual-port chips: 0=primary, 1=secondary */ 482 u8 channel; /* for dual-port chips: 0=primary, 1=secondary */
667 u8 straight8; /* Alan's straight 8 check */
668 u8 bus_state; /* power state of the IDE bus */ 483 u8 bus_state; /* power state of the IDE bus */
669 484
670 u32 host_flags; 485 u32 host_flags;
@@ -679,7 +494,8 @@ typedef struct hwif_s {
679 494
680 hwif_chipset_t chipset; /* sub-module for tuning.. */ 495 hwif_chipset_t chipset; /* sub-module for tuning.. */
681 496
682 struct pci_dev *pci_dev; /* for pci chipsets */ 497 struct device *dev;
498
683 const struct ide_port_info *cds; /* chipset device struct */ 499 const struct ide_port_info *cds; /* chipset device struct */
684 500
685 ide_ack_intr_t *ack_intr; 501 ide_ack_intr_t *ack_intr;
@@ -689,6 +505,8 @@ typedef struct hwif_s {
689#if 0 505#if 0
690 ide_hwif_ops_t *hwifops; 506 ide_hwif_ops_t *hwifops;
691#else 507#else
508 /* host specific initialization of devices on a port */
509 void (*port_init_devs)(struct hwif_s *);
692 /* routine to program host for PIO mode */ 510 /* routine to program host for PIO mode */
693 void (*set_pio_mode)(ide_drive_t *, const u8); 511 void (*set_pio_mode)(ide_drive_t *, const u8);
694 /* routine to program host for DMA mode */ 512 /* routine to program host for DMA mode */
@@ -701,19 +519,17 @@ typedef struct hwif_s {
701 void (*pre_reset)(ide_drive_t *); 519 void (*pre_reset)(ide_drive_t *);
702 /* routine to reset controller after a disk reset */ 520 /* routine to reset controller after a disk reset */
703 void (*resetproc)(ide_drive_t *); 521 void (*resetproc)(ide_drive_t *);
704 /* special interrupt handling for shared pci interrupts */
705 void (*intrproc)(ide_drive_t *);
706 /* special host masking for drive selection */ 522 /* special host masking for drive selection */
707 void (*maskproc)(ide_drive_t *, int); 523 void (*maskproc)(ide_drive_t *, int);
708 /* check host's drive quirk list */ 524 /* check host's drive quirk list */
709 int (*quirkproc)(ide_drive_t *); 525 void (*quirkproc)(ide_drive_t *);
710 /* driver soft-power interface */ 526 /* driver soft-power interface */
711 int (*busproc)(ide_drive_t *, int); 527 int (*busproc)(ide_drive_t *, int);
712#endif 528#endif
713 u8 (*mdma_filter)(ide_drive_t *); 529 u8 (*mdma_filter)(ide_drive_t *);
714 u8 (*udma_filter)(ide_drive_t *); 530 u8 (*udma_filter)(ide_drive_t *);
715 531
716 void (*fixup)(struct hwif_s *); 532 u8 (*cable_detect)(struct hwif_s *);
717 533
718 void (*ata_input_data)(ide_drive_t *, void *, u32); 534 void (*ata_input_data)(ide_drive_t *, void *, u32);
719 void (*ata_output_data)(ide_drive_t *, void *, u32); 535 void (*ata_output_data)(ide_drive_t *, void *, u32);
@@ -721,16 +537,13 @@ typedef struct hwif_s {
721 void (*atapi_input_bytes)(ide_drive_t *, void *, u32); 537 void (*atapi_input_bytes)(ide_drive_t *, void *, u32);
722 void (*atapi_output_bytes)(ide_drive_t *, void *, u32); 538 void (*atapi_output_bytes)(ide_drive_t *, void *, u32);
723 539
540 void (*dma_host_set)(ide_drive_t *, int);
724 int (*dma_setup)(ide_drive_t *); 541 int (*dma_setup)(ide_drive_t *);
725 void (*dma_exec_cmd)(ide_drive_t *, u8); 542 void (*dma_exec_cmd)(ide_drive_t *, u8);
726 void (*dma_start)(ide_drive_t *); 543 void (*dma_start)(ide_drive_t *);
727 int (*ide_dma_end)(ide_drive_t *drive); 544 int (*ide_dma_end)(ide_drive_t *drive);
728 int (*ide_dma_on)(ide_drive_t *drive);
729 void (*dma_off_quietly)(ide_drive_t *drive);
730 int (*ide_dma_test_irq)(ide_drive_t *drive); 545 int (*ide_dma_test_irq)(ide_drive_t *drive);
731 void (*ide_dma_clear_irq)(ide_drive_t *drive); 546 void (*ide_dma_clear_irq)(ide_drive_t *drive);
732 void (*dma_host_on)(ide_drive_t *drive);
733 void (*dma_host_off)(ide_drive_t *drive);
734 void (*dma_lost_irq)(ide_drive_t *drive); 547 void (*dma_lost_irq)(ide_drive_t *drive);
735 void (*dma_timeout)(ide_drive_t *drive); 548 void (*dma_timeout)(ide_drive_t *drive);
736 549
@@ -766,7 +579,6 @@ typedef struct hwif_s {
766 int rqsize; /* max sectors per request */ 579 int rqsize; /* max sectors per request */
767 int irq; /* our irq number */ 580 int irq; /* our irq number */
768 581
769 unsigned long dma_master; /* reference base addr dmabase */
770 unsigned long dma_base; /* base addr for dma ports */ 582 unsigned long dma_base; /* base addr for dma ports */
771 unsigned long dma_command; /* dma command register */ 583 unsigned long dma_command; /* dma command register */
772 unsigned long dma_vendor1; /* dma vendor 1 register */ 584 unsigned long dma_vendor1; /* dma vendor 1 register */
@@ -786,10 +598,9 @@ typedef struct hwif_s {
786 unsigned serialized : 1; /* serialized all channel operation */ 598 unsigned serialized : 1; /* serialized all channel operation */
787 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ 599 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */
788 unsigned reset : 1; /* reset after probe */ 600 unsigned reset : 1; /* reset after probe */
789 unsigned auto_poll : 1; /* supports nop auto-poll */
790 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ 601 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
791 unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */
792 unsigned mmio : 1; /* host uses MMIO */ 602 unsigned mmio : 1; /* host uses MMIO */
603 unsigned straight8 : 1; /* Alan's straight 8 check */
793 604
794 struct device gendev; 605 struct device gendev;
795 struct completion gendev_rel_comp; /* To deal with device release() */ 606 struct completion gendev_rel_comp; /* To deal with device release() */
@@ -806,15 +617,16 @@ typedef struct hwif_s {
806/* 617/*
807 * internal ide interrupt handler type 618 * internal ide interrupt handler type
808 */ 619 */
809typedef ide_startstop_t (ide_pre_handler_t)(ide_drive_t *, struct request *);
810typedef ide_startstop_t (ide_handler_t)(ide_drive_t *); 620typedef ide_startstop_t (ide_handler_t)(ide_drive_t *);
811typedef int (ide_expiry_t)(ide_drive_t *); 621typedef int (ide_expiry_t)(ide_drive_t *);
812 622
623/* used by ide-cd, ide-floppy, etc. */
624typedef void (xfer_func_t)(ide_drive_t *, void *, u32);
625
813typedef struct hwgroup_s { 626typedef struct hwgroup_s {
814 /* irq handler, if active */ 627 /* irq handler, if active */
815 ide_startstop_t (*handler)(ide_drive_t *); 628 ide_startstop_t (*handler)(ide_drive_t *);
816 /* irq handler, suspended if active */ 629
817 ide_startstop_t (*handler_save)(ide_drive_t *);
818 /* BOOL: protects all fields below */ 630 /* BOOL: protects all fields below */
819 volatile int busy; 631 volatile int busy;
820 /* BOOL: wake us up on timer expiry */ 632 /* BOOL: wake us up on timer expiry */
@@ -829,25 +641,18 @@ typedef struct hwgroup_s {
829 /* ptr to current hwif in linked-list */ 641 /* ptr to current hwif in linked-list */
830 ide_hwif_t *hwif; 642 ide_hwif_t *hwif;
831 643
832 /* for pci chipsets */
833 struct pci_dev *pci_dev;
834
835 /* current request */ 644 /* current request */
836 struct request *rq; 645 struct request *rq;
646
837 /* failsafe timer */ 647 /* failsafe timer */
838 struct timer_list timer; 648 struct timer_list timer;
839 /* local copy of current write rq */
840 struct request wrq;
841 /* timeout value during long polls */ 649 /* timeout value during long polls */
842 unsigned long poll_timeout; 650 unsigned long poll_timeout;
843 /* queried upon timeouts */ 651 /* queried upon timeouts */
844 int (*expiry)(ide_drive_t *); 652 int (*expiry)(ide_drive_t *);
845 /* ide_system_bus_speed */ 653
846 int pio_clock;
847 int req_gen; 654 int req_gen;
848 int req_gen_timer; 655 int req_gen_timer;
849
850 unsigned char cmd_buf[4];
851} ide_hwgroup_t; 656} ide_hwgroup_t;
852 657
853typedef struct ide_driver_s ide_driver_t; 658typedef struct ide_driver_s ide_driver_t;
@@ -901,6 +706,7 @@ typedef struct {
901void proc_ide_create(void); 706void proc_ide_create(void);
902void proc_ide_destroy(void); 707void proc_ide_destroy(void);
903void ide_proc_register_port(ide_hwif_t *); 708void ide_proc_register_port(ide_hwif_t *);
709void ide_proc_port_register_devices(ide_hwif_t *);
904void ide_proc_unregister_port(ide_hwif_t *); 710void ide_proc_unregister_port(ide_hwif_t *);
905void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); 711void ide_proc_register_driver(ide_drive_t *, ide_driver_t *);
906void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); 712void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *);
@@ -933,6 +739,7 @@ void ide_pci_create_host_proc(const char *, get_info_t *);
933static inline void proc_ide_create(void) { ; } 739static inline void proc_ide_create(void) { ; }
934static inline void proc_ide_destroy(void) { ; } 740static inline void proc_ide_destroy(void) { ; }
935static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; } 741static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; }
742static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; }
936static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } 743static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; }
937static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 744static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
938static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 745static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
@@ -1020,7 +827,8 @@ int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
1020 827
1021extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry); 828extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry);
1022 829
1023extern void ide_execute_command(ide_drive_t *, task_ioreg_t cmd, ide_handler_t *, unsigned int, ide_expiry_t *); 830void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int,
831 ide_expiry_t *);
1024 832
1025ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); 833ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8);
1026 834
@@ -1031,14 +839,7 @@ ide_startstop_t __ide_abort(ide_drive_t *, struct request *);
1031extern ide_startstop_t ide_abort(ide_drive_t *, const char *); 839extern ide_startstop_t ide_abort(ide_drive_t *, const char *);
1032 840
1033extern void ide_fix_driveid(struct hd_driveid *); 841extern void ide_fix_driveid(struct hd_driveid *);
1034/* 842
1035 * ide_fixstring() cleans up and (optionally) byte-swaps a text string,
1036 * removing leading/trailing blanks and compressing internal blanks.
1037 * It is primarily used to tidy up the model name/number fields as
1038 * returned by the WIN_[P]IDENTIFY commands.
1039 *
1040 * (s, bytecount, byteswap)
1041 */
1042extern void ide_fixstring(u8 *, const int, const int); 843extern void ide_fixstring(u8 *, const int, const int);
1043 844
1044int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); 845int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
@@ -1061,60 +862,124 @@ extern int ide_do_drive_cmd(ide_drive_t *, struct request *, ide_action_t);
1061 862
1062extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); 863extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
1063 864
1064/* 865enum {
1065 * Issue ATA command and wait for completion. 866 IDE_TFLAG_LBA48 = (1 << 0),
1066 * Use for implementing commands in kernel 867 IDE_TFLAG_NO_SELECT_MASK = (1 << 1),
1067 * 868 IDE_TFLAG_FLAGGED = (1 << 2),
1068 * (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf) 869 IDE_TFLAG_OUT_DATA = (1 << 3),
1069 */ 870 IDE_TFLAG_OUT_HOB_FEATURE = (1 << 4),
1070extern int ide_wait_cmd(ide_drive_t *, u8, u8, u8, u8, u8 *); 871 IDE_TFLAG_OUT_HOB_NSECT = (1 << 5),
872 IDE_TFLAG_OUT_HOB_LBAL = (1 << 6),
873 IDE_TFLAG_OUT_HOB_LBAM = (1 << 7),
874 IDE_TFLAG_OUT_HOB_LBAH = (1 << 8),
875 IDE_TFLAG_OUT_HOB = IDE_TFLAG_OUT_HOB_FEATURE |
876 IDE_TFLAG_OUT_HOB_NSECT |
877 IDE_TFLAG_OUT_HOB_LBAL |
878 IDE_TFLAG_OUT_HOB_LBAM |
879 IDE_TFLAG_OUT_HOB_LBAH,
880 IDE_TFLAG_OUT_FEATURE = (1 << 9),
881 IDE_TFLAG_OUT_NSECT = (1 << 10),
882 IDE_TFLAG_OUT_LBAL = (1 << 11),
883 IDE_TFLAG_OUT_LBAM = (1 << 12),
884 IDE_TFLAG_OUT_LBAH = (1 << 13),
885 IDE_TFLAG_OUT_TF = IDE_TFLAG_OUT_FEATURE |
886 IDE_TFLAG_OUT_NSECT |
887 IDE_TFLAG_OUT_LBAL |
888 IDE_TFLAG_OUT_LBAM |
889 IDE_TFLAG_OUT_LBAH,
890 IDE_TFLAG_OUT_DEVICE = (1 << 14),
891 IDE_TFLAG_WRITE = (1 << 15),
892 IDE_TFLAG_FLAGGED_SET_IN_FLAGS = (1 << 16),
893 IDE_TFLAG_IN_DATA = (1 << 17),
894 IDE_TFLAG_CUSTOM_HANDLER = (1 << 18),
895 IDE_TFLAG_DMA_PIO_FALLBACK = (1 << 19),
896 IDE_TFLAG_IN_HOB_FEATURE = (1 << 20),
897 IDE_TFLAG_IN_HOB_NSECT = (1 << 21),
898 IDE_TFLAG_IN_HOB_LBAL = (1 << 22),
899 IDE_TFLAG_IN_HOB_LBAM = (1 << 23),
900 IDE_TFLAG_IN_HOB_LBAH = (1 << 24),
901 IDE_TFLAG_IN_HOB_LBA = IDE_TFLAG_IN_HOB_LBAL |
902 IDE_TFLAG_IN_HOB_LBAM |
903 IDE_TFLAG_IN_HOB_LBAH,
904 IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE |
905 IDE_TFLAG_IN_HOB_NSECT |
906 IDE_TFLAG_IN_HOB_LBA,
907 IDE_TFLAG_IN_NSECT = (1 << 25),
908 IDE_TFLAG_IN_LBAL = (1 << 26),
909 IDE_TFLAG_IN_LBAM = (1 << 27),
910 IDE_TFLAG_IN_LBAH = (1 << 28),
911 IDE_TFLAG_IN_LBA = IDE_TFLAG_IN_LBAL |
912 IDE_TFLAG_IN_LBAM |
913 IDE_TFLAG_IN_LBAH,
914 IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT |
915 IDE_TFLAG_IN_LBA,
916 IDE_TFLAG_IN_DEVICE = (1 << 29),
917 IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB |
918 IDE_TFLAG_IN_HOB,
919 IDE_TFLAG_TF = IDE_TFLAG_OUT_TF |
920 IDE_TFLAG_IN_TF,
921 IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE |
922 IDE_TFLAG_IN_DEVICE,
923 /* force 16-bit I/O operations */
924 IDE_TFLAG_IO_16BIT = (1 << 30),
925};
926
927struct ide_taskfile {
928 u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */
929
930 u8 hob_feature; /* 1-5: additional data to support LBA48 */
931 u8 hob_nsect;
932 u8 hob_lbal;
933 u8 hob_lbam;
934 u8 hob_lbah;
935
936 u8 data; /* 6: low data byte (for TASKFILE IOCTL) */
937
938 union { /*  7: */
939 u8 error; /* read: error */
940 u8 feature; /* write: feature */
941 };
942
943 u8 nsect; /* 8: number of sectors */
944 u8 lbal; /* 9: LBA low */
945 u8 lbam; /* 10: LBA mid */
946 u8 lbah; /* 11: LBA high */
947
948 u8 device; /* 12: device select */
949
950 union { /* 13: */
951 u8 status; /*  read: status  */
952 u8 command; /* write: command */
953 };
954};
1071 955
1072typedef struct ide_task_s { 956typedef struct ide_task_s {
1073/* 957 union {
1074 * struct hd_drive_task_hdr tf; 958 struct ide_taskfile tf;
1075 * task_struct_t tf; 959 u8 tf_array[14];
1076 * struct hd_drive_hob_hdr hobf; 960 };
1077 * hob_struct_t hobf; 961 u32 tf_flags;
1078 */
1079 task_ioreg_t tfRegister[8];
1080 task_ioreg_t hobRegister[8];
1081 ide_reg_valid_t tf_out_flags;
1082 ide_reg_valid_t tf_in_flags;
1083 int data_phase; 962 int data_phase;
1084 int command_type;
1085 ide_pre_handler_t *prehandler;
1086 ide_handler_t *handler;
1087 struct request *rq; /* copy of request */ 963 struct request *rq; /* copy of request */
1088 void *special; /* valid_t generally */ 964 void *special; /* valid_t generally */
1089} ide_task_t; 965} ide_task_t;
1090 966
1091extern u32 ide_read_24(ide_drive_t *); 967void ide_tf_load(ide_drive_t *, ide_task_t *);
968void ide_tf_read(ide_drive_t *, ide_task_t *);
1092 969
1093extern void SELECT_DRIVE(ide_drive_t *); 970extern void SELECT_DRIVE(ide_drive_t *);
1094extern void SELECT_INTERRUPT(ide_drive_t *);
1095extern void SELECT_MASK(ide_drive_t *, int); 971extern void SELECT_MASK(ide_drive_t *, int);
1096extern void QUIRK_LIST(ide_drive_t *);
1097 972
1098extern int drive_is_ready(ide_drive_t *); 973extern int drive_is_ready(ide_drive_t *);
1099 974
1100/* 975void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8);
1101 * taskfile io for disks for now...and builds request from ide_ioctl
1102 */
1103extern ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *);
1104 976
1105/* 977ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *);
1106 * Special Flagged Register Validation Caller
1107 */
1108extern ide_startstop_t flagged_taskfile(ide_drive_t *, ide_task_t *);
1109 978
1110extern ide_startstop_t set_multmode_intr(ide_drive_t *); 979void task_end_request(ide_drive_t *, struct request *, u8);
1111extern ide_startstop_t set_geometry_intr(ide_drive_t *);
1112extern ide_startstop_t recal_intr(ide_drive_t *);
1113extern ide_startstop_t task_no_data_intr(ide_drive_t *);
1114extern ide_startstop_t task_in_intr(ide_drive_t *);
1115extern ide_startstop_t pre_task_out_intr(ide_drive_t *, struct request *);
1116 980
1117extern int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *); 981int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16);
982int ide_no_data_taskfile(ide_drive_t *, ide_task_t *);
1118 983
1119int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); 984int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long);
1120int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long); 985int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long);
@@ -1123,10 +988,8 @@ int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long);
1123extern int system_bus_clock(void); 988extern int system_bus_clock(void);
1124 989
1125extern int ide_driveid_update(ide_drive_t *); 990extern int ide_driveid_update(ide_drive_t *);
1126extern int ide_ata66_check(ide_drive_t *, ide_task_t *);
1127extern int ide_config_drive_speed(ide_drive_t *, u8); 991extern int ide_config_drive_speed(ide_drive_t *, u8);
1128extern u8 eighty_ninty_three (ide_drive_t *); 992extern u8 eighty_ninty_three (ide_drive_t *);
1129extern int set_transfer(ide_drive_t *, ide_task_t *);
1130extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *); 993extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *);
1131 994
1132extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout); 995extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout);
@@ -1140,10 +1003,8 @@ extern void do_ide_request(struct request_queue *);
1140 1003
1141void ide_init_disk(struct gendisk *, ide_drive_t *); 1004void ide_init_disk(struct gendisk *, ide_drive_t *);
1142 1005
1143extern int ideprobe_init(void);
1144
1145#ifdef CONFIG_IDEPCI_PCIBUS_ORDER 1006#ifdef CONFIG_IDEPCI_PCIBUS_ORDER
1146extern void ide_scan_pcibus(int scan_direction) __init; 1007extern int ide_scan_direction;
1147extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name); 1008extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *owner, const char *mod_name);
1148#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME) 1009#define ide_pci_register_driver(d) __ide_pci_register_driver(d, THIS_MODULE, KBUILD_MODNAME)
1149#else 1010#else
@@ -1153,6 +1014,13 @@ extern int __ide_pci_register_driver(struct pci_driver *driver, struct module *o
1153void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 *); 1014void ide_pci_setup_ports(struct pci_dev *, const struct ide_port_info *, int, u8 *);
1154void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *); 1015void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *);
1155 1016
1017#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
1018void ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *);
1019#else
1020static inline void ide_hwif_setup_dma(ide_hwif_t *hwif,
1021 const struct ide_port_info *d) { }
1022#endif
1023
1156extern void default_hwif_iops(ide_hwif_t *); 1024extern void default_hwif_iops(ide_hwif_t *);
1157extern void default_hwif_mmiops(ide_hwif_t *); 1025extern void default_hwif_mmiops(ide_hwif_t *);
1158extern void default_hwif_transport(ide_hwif_t *); 1026extern void default_hwif_transport(ide_hwif_t *);
@@ -1189,7 +1057,7 @@ enum {
1189 IDE_HFLAG_NO_SET_MODE = (1 << 9), 1057 IDE_HFLAG_NO_SET_MODE = (1 << 9),
1190 /* trust BIOS for programming chipset/device for DMA */ 1058 /* trust BIOS for programming chipset/device for DMA */
1191 IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10), 1059 IDE_HFLAG_TRUST_BIOS_FOR_DMA = (1 << 10),
1192 /* host uses VDMA */ 1060 /* host uses VDMA (tied with IDE_HFLAG_CS5520 for now) */
1193 IDE_HFLAG_VDMA = (1 << 11), 1061 IDE_HFLAG_VDMA = (1 << 11),
1194 /* ATAPI DMA is unsupported */ 1062 /* ATAPI DMA is unsupported */
1195 IDE_HFLAG_NO_ATAPI_DMA = (1 << 12), 1063 IDE_HFLAG_NO_ATAPI_DMA = (1 << 12),
@@ -1199,8 +1067,10 @@ enum {
1199 IDE_HFLAG_NO_DMA = (1 << 14), 1067 IDE_HFLAG_NO_DMA = (1 << 14),
1200 /* check if host is PCI IDE device before allowing DMA */ 1068 /* check if host is PCI IDE device before allowing DMA */
1201 IDE_HFLAG_NO_AUTODMA = (1 << 15), 1069 IDE_HFLAG_NO_AUTODMA = (1 << 15),
1070 /* don't autotune PIO */
1071 IDE_HFLAG_NO_AUTOTUNE = (1 << 16),
1202 /* host is CS5510/CS5520 */ 1072 /* host is CS5510/CS5520 */
1203 IDE_HFLAG_CS5520 = (1 << 16), 1073 IDE_HFLAG_CS5520 = IDE_HFLAG_VDMA,
1204 /* no LBA48 */ 1074 /* no LBA48 */
1205 IDE_HFLAG_NO_LBA48 = (1 << 17), 1075 IDE_HFLAG_NO_LBA48 = (1 << 17),
1206 /* no LBA48 DMA */ 1076 /* no LBA48 DMA */
@@ -1219,6 +1089,17 @@ enum {
1219 IDE_HFLAG_IO_32BIT = (1 << 24), 1089 IDE_HFLAG_IO_32BIT = (1 << 24),
1220 /* unmask IRQs */ 1090 /* unmask IRQs */
1221 IDE_HFLAG_UNMASK_IRQS = (1 << 25), 1091 IDE_HFLAG_UNMASK_IRQS = (1 << 25),
1092 IDE_HFLAG_ABUSE_SET_DMA_MODE = (1 << 26),
1093 /* host is CY82C693 */
1094 IDE_HFLAG_CY82C693 = (1 << 27),
1095 /* force host out of "simplex" mode */
1096 IDE_HFLAG_CLEAR_SIMPLEX = (1 << 28),
1097 /* DSC overlap is unsupported */
1098 IDE_HFLAG_NO_DSC = (1 << 29),
1099 /* never use 32-bit I/O ops */
1100 IDE_HFLAG_NO_IO_32BIT = (1 << 30),
1101 /* never unmask IRQs */
1102 IDE_HFLAG_NO_UNMASK_IRQS = (1 << 31),
1222}; 1103};
1223 1104
1224#ifdef CONFIG_BLK_DEV_OFFBOARD 1105#ifdef CONFIG_BLK_DEV_OFFBOARD
@@ -1233,10 +1114,9 @@ struct ide_port_info {
1233 void (*init_iops)(ide_hwif_t *); 1114 void (*init_iops)(ide_hwif_t *);
1234 void (*init_hwif)(ide_hwif_t *); 1115 void (*init_hwif)(ide_hwif_t *);
1235 void (*init_dma)(ide_hwif_t *, unsigned long); 1116 void (*init_dma)(ide_hwif_t *, unsigned long);
1236 void (*fixup)(ide_hwif_t *);
1237 ide_pci_enablebit_t enablebits[2]; 1117 ide_pci_enablebit_t enablebits[2];
1238 hwif_chipset_t chipset; 1118 hwif_chipset_t chipset;
1239 unsigned int extra; 1119 u8 extra;
1240 u32 host_flags; 1120 u32 host_flags;
1241 u8 pio_mask; 1121 u8 pio_mask;
1242 u8 swdma_mask; 1122 u8 swdma_mask;
@@ -1262,6 +1142,7 @@ int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *);
1262 1142
1263#ifdef CONFIG_BLK_DEV_IDEDMA 1143#ifdef CONFIG_BLK_DEV_IDEDMA
1264int __ide_dma_bad_drive(ide_drive_t *); 1144int __ide_dma_bad_drive(ide_drive_t *);
1145int ide_id_dma_bug(ide_drive_t *);
1265 1146
1266u8 ide_find_dma_mode(ide_drive_t *, u8); 1147u8 ide_find_dma_mode(ide_drive_t *, u8);
1267 1148
@@ -1270,22 +1151,22 @@ static inline u8 ide_max_dma_mode(ide_drive_t *drive)
1270 return ide_find_dma_mode(drive, XFER_UDMA_6); 1151 return ide_find_dma_mode(drive, XFER_UDMA_6);
1271} 1152}
1272 1153
1154void ide_dma_off_quietly(ide_drive_t *);
1273void ide_dma_off(ide_drive_t *); 1155void ide_dma_off(ide_drive_t *);
1274void ide_dma_verbose(ide_drive_t *); 1156void ide_dma_on(ide_drive_t *);
1275int ide_set_dma(ide_drive_t *); 1157int ide_set_dma(ide_drive_t *);
1158void ide_check_dma_crc(ide_drive_t *);
1276ide_startstop_t ide_dma_intr(ide_drive_t *); 1159ide_startstop_t ide_dma_intr(ide_drive_t *);
1277 1160
1161int ide_build_sglist(ide_drive_t *, struct request *);
1162void ide_destroy_dmatable(ide_drive_t *);
1163
1278#ifdef CONFIG_BLK_DEV_IDEDMA_PCI 1164#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
1279extern int ide_build_sglist(ide_drive_t *, struct request *);
1280extern int ide_build_dmatable(ide_drive_t *, struct request *); 1165extern int ide_build_dmatable(ide_drive_t *, struct request *);
1281extern void ide_destroy_dmatable(ide_drive_t *);
1282extern int ide_release_dma(ide_hwif_t *); 1166extern int ide_release_dma(ide_hwif_t *);
1283extern void ide_setup_dma(ide_hwif_t *, unsigned long, unsigned int); 1167extern void ide_setup_dma(ide_hwif_t *, unsigned long);
1284 1168
1285void ide_dma_host_off(ide_drive_t *); 1169void ide_dma_host_set(ide_drive_t *, int);
1286void ide_dma_off_quietly(ide_drive_t *);
1287void ide_dma_host_on(ide_drive_t *);
1288extern int __ide_dma_on(ide_drive_t *);
1289extern int ide_dma_setup(ide_drive_t *); 1170extern int ide_dma_setup(ide_drive_t *);
1290extern void ide_dma_start(ide_drive_t *); 1171extern void ide_dma_start(ide_drive_t *);
1291extern int __ide_dma_end(ide_drive_t *); 1172extern int __ide_dma_end(ide_drive_t *);
@@ -1294,11 +1175,15 @@ extern void ide_dma_timeout(ide_drive_t *);
1294#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */ 1175#endif /* CONFIG_BLK_DEV_IDEDMA_PCI */
1295 1176
1296#else 1177#else
1178static inline int ide_id_dma_bug(ide_drive_t *drive) { return 0; }
1297static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; } 1179static inline u8 ide_find_dma_mode(ide_drive_t *drive, u8 speed) { return 0; }
1298static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; } 1180static inline u8 ide_max_dma_mode(ide_drive_t *drive) { return 0; }
1181static inline void ide_dma_off_quietly(ide_drive_t *drive) { ; }
1299static inline void ide_dma_off(ide_drive_t *drive) { ; } 1182static inline void ide_dma_off(ide_drive_t *drive) { ; }
1183static inline void ide_dma_on(ide_drive_t *drive) { ; }
1300static inline void ide_dma_verbose(ide_drive_t *drive) { ; } 1184static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
1301static inline int ide_set_dma(ide_drive_t *drive) { return 1; } 1185static inline int ide_set_dma(ide_drive_t *drive) { return 1; }
1186static inline void ide_check_dma_crc(ide_drive_t *drive) { ; }
1302#endif /* CONFIG_BLK_DEV_IDEDMA */ 1187#endif /* CONFIG_BLK_DEV_IDEDMA */
1303 1188
1304#ifndef CONFIG_BLK_DEV_IDEDMA_PCI 1189#ifndef CONFIG_BLK_DEV_IDEDMA_PCI
@@ -1310,25 +1195,29 @@ extern int ide_acpi_exec_tfs(ide_drive_t *drive);
1310extern void ide_acpi_get_timing(ide_hwif_t *hwif); 1195extern void ide_acpi_get_timing(ide_hwif_t *hwif);
1311extern void ide_acpi_push_timing(ide_hwif_t *hwif); 1196extern void ide_acpi_push_timing(ide_hwif_t *hwif);
1312extern void ide_acpi_init(ide_hwif_t *hwif); 1197extern void ide_acpi_init(ide_hwif_t *hwif);
1198void ide_acpi_port_init_devices(ide_hwif_t *);
1313extern void ide_acpi_set_state(ide_hwif_t *hwif, int on); 1199extern void ide_acpi_set_state(ide_hwif_t *hwif, int on);
1314#else 1200#else
1315static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; } 1201static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; }
1316static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; } 1202static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; }
1317static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; } 1203static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; }
1318static inline void ide_acpi_init(ide_hwif_t *hwif) { ; } 1204static inline void ide_acpi_init(ide_hwif_t *hwif) { ; }
1205static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; }
1319static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} 1206static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
1320#endif 1207#endif
1321 1208
1209void ide_remove_port_from_hwgroup(ide_hwif_t *);
1322extern int ide_hwif_request_regions(ide_hwif_t *hwif); 1210extern int ide_hwif_request_regions(ide_hwif_t *hwif);
1323extern void ide_hwif_release_regions(ide_hwif_t* hwif); 1211extern void ide_hwif_release_regions(ide_hwif_t* hwif);
1324extern void ide_unregister (unsigned int index); 1212void ide_unregister(unsigned int, int, int);
1325 1213
1326void ide_register_region(struct gendisk *); 1214void ide_register_region(struct gendisk *);
1327void ide_unregister_region(struct gendisk *); 1215void ide_unregister_region(struct gendisk *);
1328 1216
1329void ide_undecoded_slave(ide_hwif_t *); 1217void ide_undecoded_slave(ide_drive_t *);
1330 1218
1331int ide_device_add(u8 idx[4]); 1219int ide_device_add_all(u8 *idx, const struct ide_port_info *);
1220int ide_device_add(u8 idx[4], const struct ide_port_info *);
1332 1221
1333static inline void *ide_get_hwifdata (ide_hwif_t * hwif) 1222static inline void *ide_get_hwifdata (ide_hwif_t * hwif)
1334{ 1223{
@@ -1340,8 +1229,7 @@ static inline void ide_set_hwifdata (ide_hwif_t * hwif, void *data)
1340 hwif->hwif_data = data; 1229 hwif->hwif_data = data;
1341} 1230}
1342 1231
1343/* ide-lib.c */ 1232const char *ide_xfer_verbose(u8 mode);
1344extern char *ide_xfer_verbose(u8 xfer_rate);
1345extern void ide_toggle_bounce(ide_drive_t *drive, int on); 1233extern void ide_toggle_bounce(ide_drive_t *drive, int on);
1346extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); 1234extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
1347 1235
@@ -1363,6 +1251,7 @@ static inline int ide_dev_is_sata(struct hd_driveid *id)
1363 return 0; 1251 return 0;
1364} 1252}
1365 1253
1254u64 ide_get_lba_addr(struct ide_taskfile *, int);
1366u8 ide_dump_status(ide_drive_t *, const char *, u8); 1255u8 ide_dump_status(ide_drive_t *, const char *, u8);
1367 1256
1368typedef struct ide_pio_timings_s { 1257typedef struct ide_pio_timings_s {
@@ -1412,9 +1301,14 @@ extern struct bus_type ide_bus_type;
1412#define ide_id_has_flush_cache_ext(id) \ 1301#define ide_id_has_flush_cache_ext(id) \
1413 (((id)->cfs_enable_2 & 0x2400) == 0x2400) 1302 (((id)->cfs_enable_2 & 0x2400) == 0x2400)
1414 1303
1304static inline void ide_dump_identify(u8 *id)
1305{
1306 print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 2, id, 512, 0);
1307}
1308
1415static inline int hwif_to_node(ide_hwif_t *hwif) 1309static inline int hwif_to_node(ide_hwif_t *hwif)
1416{ 1310{
1417 struct pci_dev *dev = hwif->pci_dev; 1311 struct pci_dev *dev = to_pci_dev(hwif->dev);
1418 return dev ? pcibus_to_node(dev->bus) : -1; 1312 return dev ? pcibus_to_node(dev->bus) : -1;
1419} 1313}
1420 1314
@@ -1425,4 +1319,9 @@ static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive)
1425 return &hwif->drives[(drive->dn ^ 1) & 1]; 1319 return &hwif->drives[(drive->dn ^ 1) & 1];
1426} 1320}
1427 1321
1322static inline void ide_set_irq(ide_drive_t *drive, int on)
1323{
1324 drive->hwif->OUTB(drive->ctl | (on ? 0 : 2), IDE_CONTROL_REG);
1325}
1326
1428#endif /* _IDE_H */ 1327#endif /* _IDE_H */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 30621c27159f..5de6d911cdf7 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -54,6 +54,8 @@
54#define IEEE80211_STYPE_ACTION 0x00D0 54#define IEEE80211_STYPE_ACTION 0x00D0
55 55
56/* control */ 56/* control */
57#define IEEE80211_STYPE_BACK_REQ 0x0080
58#define IEEE80211_STYPE_BACK 0x0090
57#define IEEE80211_STYPE_PSPOLL 0x00A0 59#define IEEE80211_STYPE_PSPOLL 0x00A0
58#define IEEE80211_STYPE_RTS 0x00B0 60#define IEEE80211_STYPE_RTS 0x00B0
59#define IEEE80211_STYPE_CTS 0x00C0 61#define IEEE80211_STYPE_CTS 0x00C0
@@ -81,18 +83,18 @@
81 83
82 84
83/* miscellaneous IEEE 802.11 constants */ 85/* miscellaneous IEEE 802.11 constants */
84#define IEEE80211_MAX_FRAG_THRESHOLD 2346 86#define IEEE80211_MAX_FRAG_THRESHOLD 2352
85#define IEEE80211_MAX_RTS_THRESHOLD 2347 87#define IEEE80211_MAX_RTS_THRESHOLD 2353
86#define IEEE80211_MAX_AID 2007 88#define IEEE80211_MAX_AID 2007
87#define IEEE80211_MAX_TIM_LEN 251 89#define IEEE80211_MAX_TIM_LEN 251
88#define IEEE80211_MAX_DATA_LEN 2304
89/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section 90/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
90 6.2.1.1.2. 91 6.2.1.1.2.
91 92
92 The figure in section 7.1.2 suggests a body size of up to 2312 93 802.11e clarifies the figure in section 7.1.2. The frame body is
93 bytes is allowed, which is a bit confusing, I suspect this 94 up to 2304 octets long (maximum MSDU size) plus any crypt overhead. */
94 represents the 2304 bytes of real data, plus a possible 8 bytes of 95#define IEEE80211_MAX_DATA_LEN 2304
95 WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ 96/* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */
97#define IEEE80211_MAX_FRAME_LEN 2352
96 98
97#define IEEE80211_MAX_SSID_LEN 32 99#define IEEE80211_MAX_SSID_LEN 32
98 100
@@ -185,6 +187,25 @@ struct ieee80211_mgmt {
185 u8 new_chan; 187 u8 new_chan;
186 u8 switch_count; 188 u8 switch_count;
187 } __attribute__((packed)) chan_switch; 189 } __attribute__((packed)) chan_switch;
190 struct{
191 u8 action_code;
192 u8 dialog_token;
193 __le16 capab;
194 __le16 timeout;
195 __le16 start_seq_num;
196 } __attribute__((packed)) addba_req;
197 struct{
198 u8 action_code;
199 u8 dialog_token;
200 __le16 status;
201 __le16 capab;
202 __le16 timeout;
203 } __attribute__((packed)) addba_resp;
204 struct{
205 u8 action_code;
206 __le16 params;
207 __le16 reason_code;
208 } __attribute__((packed)) delba;
188 } u; 209 } u;
189 } __attribute__ ((packed)) action; 210 } __attribute__ ((packed)) action;
190 } u; 211 } u;
@@ -205,6 +226,66 @@ struct ieee80211_cts {
205 u8 ra[6]; 226 u8 ra[6];
206} __attribute__ ((packed)); 227} __attribute__ ((packed));
207 228
229/**
230 * struct ieee80211_bar - HT Block Ack Request
231 *
232 * This structure refers to "HT BlockAckReq" as
233 * described in 802.11n draft section 7.2.1.7.1
234 */
235struct ieee80211_bar {
236 __le16 frame_control;
237 __le16 duration;
238 __u8 ra[6];
239 __u8 ta[6];
240 __le16 control;
241 __le16 start_seq_num;
242} __attribute__((packed));
243
244/**
245 * struct ieee80211_ht_cap - HT capabilities
246 *
247 * This structure refers to "HT capabilities element" as
248 * described in 802.11n draft section 7.3.2.52
249 */
250struct ieee80211_ht_cap {
251 __le16 cap_info;
252 u8 ampdu_params_info;
253 u8 supp_mcs_set[16];
254 __le16 extended_ht_cap_info;
255 __le32 tx_BF_cap_info;
256 u8 antenna_selection_info;
257} __attribute__ ((packed));
258
259/**
260 * struct ieee80211_ht_cap - HT additional information
261 *
262 * This structure refers to "HT information element" as
263 * described in 802.11n draft section 7.3.2.53
264 */
265struct ieee80211_ht_addt_info {
266 u8 control_chan;
267 u8 ht_param;
268 __le16 operation_mode;
269 __le16 stbc_param;
270 u8 basic_set[16];
271} __attribute__ ((packed));
272
273/* 802.11n HT capabilities masks */
274#define IEEE80211_HT_CAP_SUP_WIDTH 0x0002
275#define IEEE80211_HT_CAP_MIMO_PS 0x000C
276#define IEEE80211_HT_CAP_GRN_FLD 0x0010
277#define IEEE80211_HT_CAP_SGI_20 0x0020
278#define IEEE80211_HT_CAP_SGI_40 0x0040
279#define IEEE80211_HT_CAP_DELAY_BA 0x0400
280#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
281#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03
282#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C
283/* 802.11n HT IE masks */
284#define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03
285#define IEEE80211_HT_IE_CHA_WIDTH 0x04
286#define IEEE80211_HT_IE_HT_PROTECTION 0x0003
287#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
288#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
208 289
209/* Authentication algorithms */ 290/* Authentication algorithms */
210#define WLAN_AUTH_OPEN 0 291#define WLAN_AUTH_OPEN 0
@@ -271,6 +352,18 @@ enum ieee80211_statuscode {
271 WLAN_STATUS_UNSUPP_RSN_VERSION = 44, 352 WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
272 WLAN_STATUS_INVALID_RSN_IE_CAP = 45, 353 WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
273 WLAN_STATUS_CIPHER_SUITE_REJECTED = 46, 354 WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
355 /* 802.11e */
356 WLAN_STATUS_UNSPECIFIED_QOS = 32,
357 WLAN_STATUS_ASSOC_DENIED_NOBANDWIDTH = 33,
358 WLAN_STATUS_ASSOC_DENIED_LOWACK = 34,
359 WLAN_STATUS_ASSOC_DENIED_UNSUPP_QOS = 35,
360 WLAN_STATUS_REQUEST_DECLINED = 37,
361 WLAN_STATUS_INVALID_QOS_PARAM = 38,
362 WLAN_STATUS_CHANGE_TSPEC = 39,
363 WLAN_STATUS_WAIT_TS_DELAY = 47,
364 WLAN_STATUS_NO_DIRECT_LINK = 48,
365 WLAN_STATUS_STA_NOT_PRESENT = 49,
366 WLAN_STATUS_STA_NOT_QSTA = 50,
274}; 367};
275 368
276 369
@@ -301,6 +394,16 @@ enum ieee80211_reasoncode {
301 WLAN_REASON_INVALID_RSN_IE_CAP = 22, 394 WLAN_REASON_INVALID_RSN_IE_CAP = 22,
302 WLAN_REASON_IEEE8021X_FAILED = 23, 395 WLAN_REASON_IEEE8021X_FAILED = 23,
303 WLAN_REASON_CIPHER_SUITE_REJECTED = 24, 396 WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
397 /* 802.11e */
398 WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32,
399 WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33,
400 WLAN_REASON_DISASSOC_LOW_ACK = 34,
401 WLAN_REASON_DISASSOC_QAP_EXCEED_TXOP = 35,
402 WLAN_REASON_QSTA_LEAVE_QBSS = 36,
403 WLAN_REASON_QSTA_NOT_USE = 37,
404 WLAN_REASON_QSTA_REQUIRE_SETUP = 38,
405 WLAN_REASON_QSTA_TIMEOUT = 39,
406 WLAN_REASON_QSTA_CIPHER_NOT_SUPP = 45,
304}; 407};
305 408
306 409
@@ -319,6 +422,15 @@ enum ieee80211_eid {
319 WLAN_EID_HP_PARAMS = 8, 422 WLAN_EID_HP_PARAMS = 8,
320 WLAN_EID_HP_TABLE = 9, 423 WLAN_EID_HP_TABLE = 9,
321 WLAN_EID_REQUEST = 10, 424 WLAN_EID_REQUEST = 10,
425 /* 802.11e */
426 WLAN_EID_QBSS_LOAD = 11,
427 WLAN_EID_EDCA_PARAM_SET = 12,
428 WLAN_EID_TSPEC = 13,
429 WLAN_EID_TCLAS = 14,
430 WLAN_EID_SCHEDULE = 15,
431 WLAN_EID_TS_DELAY = 43,
432 WLAN_EID_TCLAS_PROCESSING = 44,
433 WLAN_EID_QOS_CAPA = 46,
322 /* 802.11h */ 434 /* 802.11h */
323 WLAN_EID_PWR_CONSTRAINT = 32, 435 WLAN_EID_PWR_CONSTRAINT = 32,
324 WLAN_EID_PWR_CAPABILITY = 33, 436 WLAN_EID_PWR_CAPABILITY = 33,
@@ -333,6 +445,9 @@ enum ieee80211_eid {
333 /* 802.11g */ 445 /* 802.11g */
334 WLAN_EID_ERP_INFO = 42, 446 WLAN_EID_ERP_INFO = 42,
335 WLAN_EID_EXT_SUPP_RATES = 50, 447 WLAN_EID_EXT_SUPP_RATES = 50,
448 /* 802.11n */
449 WLAN_EID_HT_CAPABILITY = 45,
450 WLAN_EID_HT_EXTRA_INFO = 61,
336 /* 802.11i */ 451 /* 802.11i */
337 WLAN_EID_RSN = 48, 452 WLAN_EID_RSN = 48,
338 WLAN_EID_WPA = 221, 453 WLAN_EID_WPA = 221,
@@ -341,6 +456,32 @@ enum ieee80211_eid {
341 WLAN_EID_QOS_PARAMETER = 222 456 WLAN_EID_QOS_PARAMETER = 222
342}; 457};
343 458
459/* Action category code */
460enum ieee80211_category {
461 WLAN_CATEGORY_SPECTRUM_MGMT = 0,
462 WLAN_CATEGORY_QOS = 1,
463 WLAN_CATEGORY_DLS = 2,
464 WLAN_CATEGORY_BACK = 3,
465 WLAN_CATEGORY_WMM = 17,
466};
467
468/* BACK action code */
469enum ieee80211_back_actioncode {
470 WLAN_ACTION_ADDBA_REQ = 0,
471 WLAN_ACTION_ADDBA_RESP = 1,
472 WLAN_ACTION_DELBA = 2,
473};
474
475/* BACK (block-ack) parties */
476enum ieee80211_back_parties {
477 WLAN_BACK_RECIPIENT = 0,
478 WLAN_BACK_INITIATOR = 1,
479 WLAN_BACK_TIMER = 2,
480};
481
482/* A-MSDU 802.11n */
483#define IEEE80211_QOS_CONTROL_A_MSDU_PRESENT 0x0080
484
344/* cipher suite selectors */ 485/* cipher suite selectors */
345#define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00 486#define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00
346#define WLAN_CIPHER_SUITE_WEP40 0x000FAC01 487#define WLAN_CIPHER_SUITE_WEP40 0x000FAC01
diff --git a/include/linux/if.h b/include/linux/if.h
index 32bf419351f1..5c9d1fa93fef 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -50,7 +50,9 @@
50#define IFF_LOWER_UP 0x10000 /* driver signals L1 up */ 50#define IFF_LOWER_UP 0x10000 /* driver signals L1 up */
51#define IFF_DORMANT 0x20000 /* driver signals dormant */ 51#define IFF_DORMANT 0x20000 /* driver signals dormant */
52 52
53#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|\ 53#define IFF_ECHO 0x40000 /* echo sent packets */
54
55#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\
54 IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) 56 IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
55 57
56/* Private (from user) interface flags (netdevice->priv_flags). */ 58/* Private (from user) interface flags (netdevice->priv_flags). */
@@ -61,6 +63,7 @@
61#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */ 63#define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */
62#define IFF_BONDING 0x20 /* bonding master or slave */ 64#define IFF_BONDING 0x20 /* bonding master or slave */
63#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */ 65#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
66#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */
64 67
65#define IF_GET_IFACE 0x0001 /* for querying only */ 68#define IF_GET_IFACE 0x0001 /* for querying only */
66#define IF_GET_PROTO 0x0002 69#define IF_GET_PROTO 0x0002
diff --git a/include/linux/if_addrlabel.h b/include/linux/if_addrlabel.h
new file mode 100644
index 000000000000..9fe79c95dd28
--- /dev/null
+++ b/include/linux/if_addrlabel.h
@@ -0,0 +1,32 @@
1/*
2 * if_addrlabel.h - netlink interface for address labels
3 *
4 * Copyright (C)2007 USAGI/WIDE Project, All Rights Reserved.
5 *
6 * Authors:
7 * YOSHIFUJI Hideaki @ USAGI/WIDE <yoshfuji@linux-ipv6.org>
8 */
9
10#ifndef __LINUX_IF_ADDRLABEL_H
11#define __LINUX_IF_ADDRLABEL_H
12
13struct ifaddrlblmsg
14{
15 __u8 ifal_family; /* Address family */
16 __u8 __ifal_reserved; /* Reserved */
17 __u8 ifal_prefixlen; /* Prefix length */
18 __u8 ifal_flags; /* Flags */
19 __u32 ifal_index; /* Link index */
20 __u32 ifal_seq; /* sequence number */
21};
22
23enum
24{
25 IFAL_ADDRESS = 1,
26 IFAL_LABEL = 2,
27 __IFAL_MAX
28};
29
30#define IFAL_MAX (__IFAL_MAX - 1)
31
32#endif
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index ed7b93c3083a..296e8e86e91d 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -52,6 +52,7 @@
52#define ARPHRD_ROSE 270 52#define ARPHRD_ROSE 270
53#define ARPHRD_X25 271 /* CCITT X.25 */ 53#define ARPHRD_X25 271 /* CCITT X.25 */
54#define ARPHRD_HWX25 272 /* Boards with X.25 in firmware */ 54#define ARPHRD_HWX25 272 /* Boards with X.25 in firmware */
55#define ARPHRD_CAN 280 /* Controller Area Network */
55#define ARPHRD_PPP 512 56#define ARPHRD_PPP 512
56#define ARPHRD_CISCO 513 /* Cisco HDLC */ 57#define ARPHRD_CISCO 513 /* Cisco HDLC */
57#define ARPHRD_HDLC ARPHRD_CISCO 58#define ARPHRD_HDLC ARPHRD_CISCO
diff --git a/include/linux/if_bonding.h b/include/linux/if_bonding.h
index 84598fa2e9de..65c2d247068b 100644
--- a/include/linux/if_bonding.h
+++ b/include/linux/if_bonding.h
@@ -85,7 +85,8 @@
85 85
86/* hashing types */ 86/* hashing types */
87#define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */ 87#define BOND_XMIT_POLICY_LAYER2 0 /* layer 2 (MAC only), default */
88#define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ MAC) */ 88#define BOND_XMIT_POLICY_LAYER34 1 /* layer 3+4 (IP ^ (TCP || UDP)) */
89#define BOND_XMIT_POLICY_LAYER23 2 /* layer 2+3 (IP ^ MAC) */
89 90
90typedef struct ifbond { 91typedef struct ifbond {
91 __s32 bond_mode; 92 __s32 bond_mode;
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 5f9297793661..e157c1399b61 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -90,6 +90,7 @@
90#define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/ 90#define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/
91#define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */ 91#define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */
92#define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */ 92#define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */
93#define ETH_P_CAN 0x000C /* Controller Area Network */
93#define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/ 94#define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/
94#define ETH_P_TR_802_2 0x0011 /* 802.2 frames */ 95#define ETH_P_TR_802_2 0x0011 /* 802.2 frames */
95#define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */ 96#define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */
@@ -123,12 +124,15 @@ int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
123extern struct ctl_table ether_table[]; 124extern struct ctl_table ether_table[];
124#endif 125#endif
125 126
127extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len);
128
126/* 129/*
127 * Display a 6 byte device address (MAC) in a readable format. 130 * Display a 6 byte device address (MAC) in a readable format.
128 */ 131 */
132extern char *print_mac(char *buf, const unsigned char *addr);
129#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" 133#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
130extern char *print_mac(char *buf, const u8 *addr); 134#define MAC_BUF_SIZE 18
131#define DECLARE_MAC_BUF(var) char var[18] __maybe_unused 135#define DECLARE_MAC_BUF(var) char var[MAC_BUF_SIZE] __maybe_unused
132 136
133#endif 137#endif
134 138
diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h
index f272a80caa3e..5c34240de746 100644
--- a/include/linux/if_frad.h
+++ b/include/linux/if_frad.h
@@ -137,7 +137,7 @@ struct frhdr
137 137
138 unsigned char NLPID; 138 unsigned char NLPID;
139 unsigned char OUI[3]; 139 unsigned char OUI[3];
140 unsigned short PID; 140 __be16 PID;
141 141
142#define IP_NLPID pad 142#define IP_NLPID pad
143} __attribute__((packed)); 143} __attribute__((packed));
diff --git a/include/linux/if_shaper.h b/include/linux/if_shaper.h
deleted file mode 100644
index 3b1b7ba19825..000000000000
--- a/include/linux/if_shaper.h
+++ /dev/null
@@ -1,51 +0,0 @@
1#ifndef __LINUX_SHAPER_H
2#define __LINUX_SHAPER_H
3
4#ifdef __KERNEL__
5
6#define SHAPER_QLEN 10
7/*
8 * This is a bit speed dependent (read it shouldn't be a constant!)
9 *
10 * 5 is about right for 28.8 upwards. Below that double for every
11 * halving of speed or so. - ie about 20 for 9600 baud.
12 */
13#define SHAPER_LATENCY (5*HZ)
14#define SHAPER_MAXSLIP 2
15#define SHAPER_BURST (HZ/50) /* Good for >128K then */
16
17struct shaper
18{
19 struct sk_buff_head sendq;
20 __u32 bytespertick;
21 __u32 bitspersec;
22 __u32 shapelatency;
23 __u32 shapeclock;
24 unsigned long recovery; /* Time we can next clock a packet out on
25 an empty queue */
26 spinlock_t lock;
27 struct net_device *dev;
28 struct net_device_stats* (*get_stats)(struct net_device *dev);
29 struct timer_list timer;
30};
31
32#endif
33
34#define SHAPER_SET_DEV 0x0001
35#define SHAPER_SET_SPEED 0x0002
36#define SHAPER_GET_DEV 0x0003
37#define SHAPER_GET_SPEED 0x0004
38
39struct shaperconf
40{
41 __u16 ss_cmd;
42 union
43 {
44 char ssu_name[14];
45 __u32 ssu_speed;
46 } ss_u;
47#define ss_speed ss_u.ssu_speed
48#define ss_name ss_u.ssu_name
49};
50
51#endif
diff --git a/include/linux/if_tr.h b/include/linux/if_tr.h
index 046e9d95ba9a..5bcec8b2c5e2 100644
--- a/include/linux/if_tr.h
+++ b/include/linux/if_tr.h
@@ -49,9 +49,6 @@ static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb)
49{ 49{
50 return (struct trh_hdr *)skb_mac_header(skb); 50 return (struct trh_hdr *)skb_mac_header(skb);
51} 51}
52#ifdef CONFIG_SYSCTL
53extern struct ctl_table tr_table[];
54#endif
55#endif 52#endif
56 53
57/* This is an Token-Ring LLC structure */ 54/* This is an Token-Ring LLC structure */
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 33e489d5bb33..72f1c5f47be3 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -21,6 +21,8 @@
21/* Uncomment to enable debugging */ 21/* Uncomment to enable debugging */
22/* #define TUN_DEBUG 1 */ 22/* #define TUN_DEBUG 1 */
23 23
24#include <linux/types.h>
25
24#ifdef __KERNEL__ 26#ifdef __KERNEL__
25 27
26#ifdef TUN_DEBUG 28#ifdef TUN_DEBUG
@@ -88,7 +90,7 @@ struct tun_struct {
88 90
89struct tun_pi { 91struct tun_pi {
90 unsigned short flags; 92 unsigned short flags;
91 unsigned short proto; 93 __be16 proto;
92}; 94};
93#define TUN_PKT_STRIP 0x0001 95#define TUN_PKT_STRIP 0x0001
94 96
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 660b5010c2d9..228eb4eb3129 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -17,6 +17,9 @@
17#define GRE_FLAGS __constant_htons(0x00F8) 17#define GRE_FLAGS __constant_htons(0x00F8)
18#define GRE_VERSION __constant_htons(0x0007) 18#define GRE_VERSION __constant_htons(0x0007)
19 19
20/* i_flags values for SIT mode */
21#define SIT_ISATAP 0x0001
22
20struct ip_tunnel_parm 23struct ip_tunnel_parm
21{ 24{
22 char name[IFNAMSIZ]; 25 char name[IFNAMSIZ];
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 976d4b1067d1..34f40efc7607 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -16,11 +16,6 @@
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17 17
18/* externally defined structs */ 18/* externally defined structs */
19struct vlan_group;
20struct net_device;
21struct packet_type;
22struct vlan_collection;
23struct vlan_dev_info;
24struct hlist_node; 19struct hlist_node;
25 20
26#include <linux/netdevice.h> 21#include <linux/netdevice.h>
@@ -39,12 +34,30 @@ struct hlist_node;
39#define VLAN_ETH_DATA_LEN 1500 /* Max. octets in payload */ 34#define VLAN_ETH_DATA_LEN 1500 /* Max. octets in payload */
40#define VLAN_ETH_FRAME_LEN 1518 /* Max. octets in frame sans FCS */ 35#define VLAN_ETH_FRAME_LEN 1518 /* Max. octets in frame sans FCS */
41 36
37/*
38 * struct vlan_hdr - vlan header
39 * @h_vlan_TCI: priority and VLAN ID
40 * @h_vlan_encapsulated_proto: packet type ID or len
41 */
42struct vlan_hdr {
43 __be16 h_vlan_TCI;
44 __be16 h_vlan_encapsulated_proto;
45};
46
47/**
48 * struct vlan_ethhdr - vlan ethernet header (ethhdr + vlan_hdr)
49 * @h_dest: destination ethernet address
50 * @h_source: source ethernet address
51 * @h_vlan_proto: ethernet protocol (always 0x8100)
52 * @h_vlan_TCI: priority and VLAN ID
53 * @h_vlan_encapsulated_proto: packet type ID or len
54 */
42struct vlan_ethhdr { 55struct vlan_ethhdr {
43 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ 56 unsigned char h_dest[ETH_ALEN];
44 unsigned char h_source[ETH_ALEN]; /* source ether addr */ 57 unsigned char h_source[ETH_ALEN];
45 __be16 h_vlan_proto; /* Should always be 0x8100 */ 58 __be16 h_vlan_proto;
46 __be16 h_vlan_TCI; /* Encapsulates priority and VLAN ID */ 59 __be16 h_vlan_TCI;
47 __be16 h_vlan_encapsulated_proto; /* packet type ID field (or len) */ 60 __be16 h_vlan_encapsulated_proto;
48}; 61};
49 62
50#include <linux/skbuff.h> 63#include <linux/skbuff.h>
@@ -54,18 +67,11 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
54 return (struct vlan_ethhdr *)skb_mac_header(skb); 67 return (struct vlan_ethhdr *)skb_mac_header(skb);
55} 68}
56 69
57struct vlan_hdr {
58 __be16 h_vlan_TCI; /* Encapsulates priority and VLAN ID */
59 __be16 h_vlan_encapsulated_proto; /* packet type ID field (or len) */
60};
61
62#define VLAN_VID_MASK 0xfff 70#define VLAN_VID_MASK 0xfff
63 71
64/* found in socket.c */ 72/* found in socket.c */
65extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); 73extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
66 74
67#define VLAN_NAME "vlan"
68
69/* if this changes, algorithm will have to be reworked because this 75/* if this changes, algorithm will have to be reworked because this
70 * depends on completely exhausting the VLAN identifier space. Thus 76 * depends on completely exhausting the VLAN identifier space. Thus
71 * it gives constant time look-up, but in many cases it wastes memory. 77 * it gives constant time look-up, but in many cases it wastes memory.
@@ -76,19 +82,22 @@ extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
76 82
77struct vlan_group { 83struct vlan_group {
78 int real_dev_ifindex; /* The ifindex of the ethernet(like) device the vlan is attached to. */ 84 int real_dev_ifindex; /* The ifindex of the ethernet(like) device the vlan is attached to. */
85 unsigned int nr_vlans;
79 struct hlist_node hlist; /* linked list */ 86 struct hlist_node hlist; /* linked list */
80 struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS]; 87 struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS];
81 struct rcu_head rcu; 88 struct rcu_head rcu;
82}; 89};
83 90
84static inline struct net_device *vlan_group_get_device(struct vlan_group *vg, int vlan_id) 91static inline struct net_device *vlan_group_get_device(struct vlan_group *vg,
92 unsigned int vlan_id)
85{ 93{
86 struct net_device **array; 94 struct net_device **array;
87 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN]; 95 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN];
88 return array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN]; 96 return array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN];
89} 97}
90 98
91static inline void vlan_group_set_device(struct vlan_group *vg, int vlan_id, 99static inline void vlan_group_set_device(struct vlan_group *vg,
100 unsigned int vlan_id,
92 struct net_device *dev) 101 struct net_device *dev)
93{ 102{
94 struct net_device **array; 103 struct net_device **array;
@@ -132,22 +141,18 @@ struct vlan_dev_info {
132 struct proc_dir_entry *dent; /* Holds the proc data */ 141 struct proc_dir_entry *dent; /* Holds the proc data */
133 unsigned long cnt_inc_headroom_on_tx; /* How many times did we have to grow the skb on TX. */ 142 unsigned long cnt_inc_headroom_on_tx; /* How many times did we have to grow the skb on TX. */
134 unsigned long cnt_encap_on_xmit; /* How many times did we have to encapsulate the skb on TX. */ 143 unsigned long cnt_encap_on_xmit; /* How many times did we have to encapsulate the skb on TX. */
135 struct net_device_stats dev_stats; /* Device stats (rx-bytes, tx-pkts, etc...) */
136}; 144};
137 145
138#define VLAN_DEV_INFO(x) ((struct vlan_dev_info *)(x->priv)) 146static inline struct vlan_dev_info *vlan_dev_info(const struct net_device *dev)
139
140/* inline functions */
141
142static inline struct net_device_stats *vlan_dev_get_stats(struct net_device *dev)
143{ 147{
144 return &(VLAN_DEV_INFO(dev)->dev_stats); 148 return netdev_priv(dev);
145} 149}
146 150
151/* inline functions */
147static inline __u32 vlan_get_ingress_priority(struct net_device *dev, 152static inline __u32 vlan_get_ingress_priority(struct net_device *dev,
148 unsigned short vlan_tag) 153 unsigned short vlan_tag)
149{ 154{
150 struct vlan_dev_info *vip = VLAN_DEV_INFO(dev); 155 struct vlan_dev_info *vip = vlan_dev_info(dev);
151 156
152 return vip->ingress_priority_map[(vlan_tag >> 13) & 0x7]; 157 return vip->ingress_priority_map[(vlan_tag >> 13) & 0x7];
153} 158}
@@ -188,7 +193,7 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb,
188 193
189 skb->dev->last_rx = jiffies; 194 skb->dev->last_rx = jiffies;
190 195
191 stats = vlan_dev_get_stats(skb->dev); 196 stats = &skb->dev->stats;
192 stats->rx_packets++; 197 stats->rx_packets++;
193 stats->rx_bytes += skb->len; 198 stats->rx_bytes += skb->len;
194 199
@@ -266,12 +271,12 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short
266 memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN); 271 memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN);
267 272
268 /* first, the ethernet type */ 273 /* first, the ethernet type */
269 veth->h_vlan_proto = __constant_htons(ETH_P_8021Q); 274 veth->h_vlan_proto = htons(ETH_P_8021Q);
270 275
271 /* now, the tag */ 276 /* now, the tag */
272 veth->h_vlan_TCI = htons(tag); 277 veth->h_vlan_TCI = htons(tag);
273 278
274 skb->protocol = __constant_htons(ETH_P_8021Q); 279 skb->protocol = htons(ETH_P_8021Q);
275 skb->mac_header -= VLAN_HLEN; 280 skb->mac_header -= VLAN_HLEN;
276 skb->network_header -= VLAN_HLEN; 281 skb->network_header -= VLAN_HLEN;
277 282
@@ -326,7 +331,7 @@ static inline int __vlan_get_tag(struct sk_buff *skb, unsigned short *tag)
326{ 331{
327 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data; 332 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data;
328 333
329 if (veth->h_vlan_proto != __constant_htons(ETH_P_8021Q)) { 334 if (veth->h_vlan_proto != htons(ETH_P_8021Q)) {
330 return -EINVAL; 335 return -EINVAL;
331 } 336 }
332 337
diff --git a/include/linux/in.h b/include/linux/in.h
index 3975cbf52f20..70c6df882694 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -246,13 +246,69 @@ struct sockaddr_in {
246#include <asm/byteorder.h> 246#include <asm/byteorder.h>
247 247
248#ifdef __KERNEL__ 248#ifdef __KERNEL__
249/* Some random defines to make it easier in the kernel.. */
250#define LOOPBACK(x) (((x) & htonl(0xff000000)) == htonl(0x7f000000))
251#define MULTICAST(x) (((x) & htonl(0xf0000000)) == htonl(0xe0000000))
252#define BADCLASS(x) (((x) & htonl(0xf0000000)) == htonl(0xf0000000))
253#define ZERONET(x) (((x) & htonl(0xff000000)) == htonl(0x00000000))
254#define LOCAL_MCAST(x) (((x) & htonl(0xFFFFFF00)) == htonl(0xE0000000))
255 249
250static inline bool ipv4_is_loopback(__be32 addr)
251{
252 return (addr & htonl(0xff000000)) == htonl(0x7f000000);
253}
254
255static inline bool ipv4_is_multicast(__be32 addr)
256{
257 return (addr & htonl(0xf0000000)) == htonl(0xe0000000);
258}
259
260static inline bool ipv4_is_local_multicast(__be32 addr)
261{
262 return (addr & htonl(0xffffff00)) == htonl(0xe0000000);
263}
264
265static inline bool ipv4_is_lbcast(__be32 addr)
266{
267 /* limited broadcast */
268 return addr == INADDR_BROADCAST;
269}
270
271static inline bool ipv4_is_zeronet(__be32 addr)
272{
273 return (addr & htonl(0xff000000)) == htonl(0x00000000);
274}
275
276/* Special-Use IPv4 Addresses (RFC3330) */
277
278static inline bool ipv4_is_private_10(__be32 addr)
279{
280 return (addr & htonl(0xff000000)) == htonl(0x0a000000);
281}
282
283static inline bool ipv4_is_private_172(__be32 addr)
284{
285 return (addr & htonl(0xfff00000)) == htonl(0xac100000);
286}
287
288static inline bool ipv4_is_private_192(__be32 addr)
289{
290 return (addr & htonl(0xffff0000)) == htonl(0xc0a80000);
291}
292
293static inline bool ipv4_is_linklocal_169(__be32 addr)
294{
295 return (addr & htonl(0xffff0000)) == htonl(0xa9fe0000);
296}
297
298static inline bool ipv4_is_anycast_6to4(__be32 addr)
299{
300 return (addr & htonl(0xffffff00)) == htonl(0xc0586300);
301}
302
303static inline bool ipv4_is_test_192(__be32 addr)
304{
305 return (addr & htonl(0xffffff00)) == htonl(0xc0000200);
306}
307
308static inline bool ipv4_is_test_198(__be32 addr)
309{
310 return (addr & htonl(0xfffe0000)) == htonl(0xc6120000);
311}
256#endif 312#endif
257 313
258#endif /* _LINUX_IN_H */ 314#endif /* _LINUX_IN_H */
diff --git a/include/linux/inet_lro.h b/include/linux/inet_lro.h
index 1246d46abbc0..80335b7d77c5 100644
--- a/include/linux/inet_lro.h
+++ b/include/linux/inet_lro.h
@@ -91,6 +91,9 @@ struct net_lro_mgr {
91 int max_desc; /* Max number of LRO descriptors */ 91 int max_desc; /* Max number of LRO descriptors */
92 int max_aggr; /* Max number of LRO packets to be aggregated */ 92 int max_aggr; /* Max number of LRO packets to be aggregated */
93 93
94 int frag_align_pad; /* Padding required to properly align layer 3
95 * headers in generated skb when using frags */
96
94 struct net_lro_desc *lro_arr; /* Array of LRO descriptors */ 97 struct net_lro_desc *lro_arr; /* Array of LRO descriptors */
95 98
96 /* 99 /*
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index d83fee2dc643..fc4e3db649e8 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -17,8 +17,6 @@ struct ipv4_devconf
17 DECLARE_BITMAP(state, __NET_IPV4_CONF_MAX - 1); 17 DECLARE_BITMAP(state, __NET_IPV4_CONF_MAX - 1);
18}; 18};
19 19
20extern struct ipv4_devconf ipv4_devconf;
21
22struct in_device 20struct in_device
23{ 21{
24 struct net_device *dev; 22 struct net_device *dev;
@@ -44,7 +42,8 @@ struct in_device
44}; 42};
45 43
46#define IPV4_DEVCONF(cnf, attr) ((cnf).data[NET_IPV4_CONF_ ## attr - 1]) 44#define IPV4_DEVCONF(cnf, attr) ((cnf).data[NET_IPV4_CONF_ ## attr - 1])
47#define IPV4_DEVCONF_ALL(attr) IPV4_DEVCONF(ipv4_devconf, attr) 45#define IPV4_DEVCONF_ALL(net, attr) \
46 IPV4_DEVCONF((*(net)->ipv4.devconf_all), attr)
48 47
49static inline int ipv4_devconf_get(struct in_device *in_dev, int index) 48static inline int ipv4_devconf_get(struct in_device *in_dev, int index)
50{ 49{
@@ -71,16 +70,17 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
71 ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val)) 70 ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val))
72 71
73#define IN_DEV_ANDCONF(in_dev, attr) \ 72#define IN_DEV_ANDCONF(in_dev, attr) \
74 (IPV4_DEVCONF_ALL(attr) && IN_DEV_CONF_GET((in_dev), attr)) 73 (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) && \
74 IN_DEV_CONF_GET((in_dev), attr))
75#define IN_DEV_ORCONF(in_dev, attr) \ 75#define IN_DEV_ORCONF(in_dev, attr) \
76 (IPV4_DEVCONF_ALL(attr) || IN_DEV_CONF_GET((in_dev), attr)) 76 (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) || \
77 IN_DEV_CONF_GET((in_dev), attr))
77#define IN_DEV_MAXCONF(in_dev, attr) \ 78#define IN_DEV_MAXCONF(in_dev, attr) \
78 (max(IPV4_DEVCONF_ALL(attr), IN_DEV_CONF_GET((in_dev), attr))) 79 (max(IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr), \
80 IN_DEV_CONF_GET((in_dev), attr)))
79 81
80#define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) 82#define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING)
81#define IN_DEV_MFORWARD(in_dev) (IPV4_DEVCONF_ALL(MC_FORWARDING) && \ 83#define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING)
82 IPV4_DEVCONF((in_dev)->cnf, \
83 MC_FORWARDING))
84#define IN_DEV_RPFILTER(in_dev) IN_DEV_ANDCONF((in_dev), RP_FILTER) 84#define IN_DEV_RPFILTER(in_dev) IN_DEV_ANDCONF((in_dev), RP_FILTER)
85#define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \ 85#define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \
86 ACCEPT_SOURCE_ROUTE) 86 ACCEPT_SOURCE_ROUTE)
@@ -127,15 +127,14 @@ struct in_ifaddr
127extern int register_inetaddr_notifier(struct notifier_block *nb); 127extern int register_inetaddr_notifier(struct notifier_block *nb);
128extern int unregister_inetaddr_notifier(struct notifier_block *nb); 128extern int unregister_inetaddr_notifier(struct notifier_block *nb);
129 129
130extern struct net_device *ip_dev_find(__be32 addr); 130extern struct net_device *ip_dev_find(struct net *net, __be32 addr);
131extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); 131extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
132extern int devinet_ioctl(unsigned int cmd, void __user *); 132extern int devinet_ioctl(unsigned int cmd, void __user *);
133extern void devinet_init(void); 133extern void devinet_init(void);
134extern struct in_device *inetdev_by_index(int); 134extern struct in_device *inetdev_by_index(struct net *, int);
135extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope); 135extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
136extern __be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope); 136extern __be32 inet_confirm_addr(struct in_device *in_dev, __be32 dst, __be32 local, int scope);
137extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask); 137extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask);
138extern void inet_forward_change(void);
139 138
140static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa) 139static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa)
141{ 140{
diff --git a/include/linux/init.h b/include/linux/init.h
index 5141381a7527..2efbda016741 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -40,10 +40,10 @@
40 40
41/* These are for everybody (although not all archs will actually 41/* These are for everybody (although not all archs will actually
42 discard it in modules) */ 42 discard it in modules) */
43#define __init __attribute__ ((__section__ (".init.text"))) __cold 43#define __init __section(.init.text) __cold
44#define __initdata __attribute__ ((__section__ (".init.data"))) 44#define __initdata __section(.init.data)
45#define __exitdata __attribute__ ((__section__(".exit.data"))) 45#define __exitdata __section(.exit.data)
46#define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit"))) 46#define __exit_call __used __section(.exitcall.exit)
47 47
48/* modpost check for section mismatches during the kernel build. 48/* modpost check for section mismatches during the kernel build.
49 * A section mismatch happens when there are references from a 49 * A section mismatch happens when there are references from a
@@ -52,25 +52,81 @@
52 * when early init has completed so all such references are potential bugs. 52 * when early init has completed so all such references are potential bugs.
53 * For exit sections the same issue exists. 53 * For exit sections the same issue exists.
54 * The following markers are used for the cases where the reference to 54 * The following markers are used for the cases where the reference to
55 * the init/exit section (code or data) is valid and will teach modpost 55 * the *init / *exit section (code or data) is valid and will teach
56 * not to issue a warning. 56 * modpost not to issue a warning.
57 * The markers follow same syntax rules as __init / __initdata. */ 57 * The markers follow same syntax rules as __init / __initdata. */
58#define __init_refok noinline __attribute__ ((__section__ (".text.init.refok"))) 58#define __ref __section(.ref.text) noinline
59#define __initdata_refok __attribute__ ((__section__ (".data.init.refok"))) 59#define __refdata __section(.ref.data)
60#define __exit_refok noinline __attribute__ ((__section__ (".exit.text.refok"))) 60#define __refconst __section(.ref.rodata)
61
62/* backward compatibility note
63 * A few places hardcode the old section names:
64 * .text.init.refok
65 * .data.init.refok
66 * .exit.text.refok
67 * They should be converted to use the defines from this file
68 */
69
70/* compatibility defines */
71#define __init_refok __ref
72#define __initdata_refok __refdata
73#define __exit_refok __ref
74
61 75
62#ifdef MODULE 76#ifdef MODULE
63#define __exit __attribute__ ((__section__(".exit.text"))) __cold 77#define __exitused
64#else 78#else
65#define __exit __attribute_used__ __attribute__ ((__section__(".exit.text"))) __cold 79#define __exitused __used
66#endif 80#endif
67 81
82#define __exit __section(.exit.text) __exitused __cold
83
84/* Used for HOTPLUG */
85#define __devinit __section(.devinit.text) __cold
86#define __devinitdata __section(.devinit.data)
87#define __devinitconst __section(.devinit.rodata)
88#define __devexit __section(.devexit.text) __exitused __cold
89#define __devexitdata __section(.devexit.data)
90#define __devexitconst __section(.devexit.rodata)
91
92/* Used for HOTPLUG_CPU */
93#define __cpuinit __section(.cpuinit.text) __cold
94#define __cpuinitdata __section(.cpuinit.data)
95#define __cpuinitconst __section(.cpuinit.rodata)
96#define __cpuexit __section(.cpuexit.text) __exitused __cold
97#define __cpuexitdata __section(.cpuexit.data)
98#define __cpuexitconst __section(.cpuexit.rodata)
99
100/* Used for MEMORY_HOTPLUG */
101#define __meminit __section(.meminit.text) __cold
102#define __meminitdata __section(.meminit.data)
103#define __meminitconst __section(.meminit.rodata)
104#define __memexit __section(.memexit.text) __exitused __cold
105#define __memexitdata __section(.memexit.data)
106#define __memexitconst __section(.memexit.rodata)
107
68/* For assembly routines */ 108/* For assembly routines */
69#define __INIT .section ".init.text","ax" 109#define __INIT .section ".init.text","ax"
70#define __INIT_REFOK .section ".text.init.refok","ax"
71#define __FINIT .previous 110#define __FINIT .previous
111
72#define __INITDATA .section ".init.data","aw" 112#define __INITDATA .section ".init.data","aw"
73#define __INITDATA_REFOK .section ".data.init.refok","aw" 113
114#define __DEVINIT .section ".devinit.text", "ax"
115#define __DEVINITDATA .section ".devinit.data", "aw"
116
117#define __CPUINIT .section ".cpuinit.text", "ax"
118#define __CPUINITDATA .section ".cpuinit.data", "aw"
119
120#define __MEMINIT .section ".meminit.text", "ax"
121#define __MEMINITDATA .section ".meminit.data", "aw"
122
123/* silence warnings when references are OK */
124#define __REF .section ".ref.text", "ax"
125#define __REFDATA .section ".ref.data", "aw"
126#define __REFCONST .section ".ref.rodata", "aw"
127/* backward compatibility */
128#define __INIT_REFOK .section __REF
129#define __INITDATA_REFOK .section __REFDATA
74 130
75#ifndef __ASSEMBLY__ 131#ifndef __ASSEMBLY__
76/* 132/*
@@ -108,7 +164,7 @@ void prepare_namespace(void);
108 */ 164 */
109 165
110#define __define_initcall(level,fn,id) \ 166#define __define_initcall(level,fn,id) \
111 static initcall_t __initcall_##fn##id __attribute_used__ \ 167 static initcall_t __initcall_##fn##id __used \
112 __attribute__((__section__(".initcall" level ".init"))) = fn 168 __attribute__((__section__(".initcall" level ".init"))) = fn
113 169
114/* 170/*
@@ -142,11 +198,11 @@ void prepare_namespace(void);
142 198
143#define console_initcall(fn) \ 199#define console_initcall(fn) \
144 static initcall_t __initcall_##fn \ 200 static initcall_t __initcall_##fn \
145 __attribute_used__ __attribute__((__section__(".con_initcall.init")))=fn 201 __used __section(.con_initcall.init) = fn
146 202
147#define security_initcall(fn) \ 203#define security_initcall(fn) \
148 static initcall_t __initcall_##fn \ 204 static initcall_t __initcall_##fn \
149 __attribute_used__ __attribute__((__section__(".security_initcall.init"))) = fn 205 __used __section(.security_initcall.init) = fn
150 206
151struct obs_kernel_param { 207struct obs_kernel_param {
152 const char *str; 208 const char *str;
@@ -163,8 +219,7 @@ struct obs_kernel_param {
163#define __setup_param(str, unique_id, fn, early) \ 219#define __setup_param(str, unique_id, fn, early) \
164 static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \ 220 static char __setup_str_##unique_id[] __initdata __aligned(1) = str; \
165 static struct obs_kernel_param __setup_##unique_id \ 221 static struct obs_kernel_param __setup_##unique_id \
166 __attribute_used__ \ 222 __used __section(.init.setup) \
167 __attribute__((__section__(".init.setup"))) \
168 __attribute__((aligned((sizeof(long))))) \ 223 __attribute__((aligned((sizeof(long))))) \
169 = { __setup_str_##unique_id, fn, early } 224 = { __setup_str_##unique_id, fn, early }
170 225
@@ -242,7 +297,7 @@ void __init parse_early_param(void);
242#endif 297#endif
243 298
244/* Data marked not to be saved by software suspend */ 299/* Data marked not to be saved by software suspend */
245#define __nosavedata __attribute__ ((__section__ (".data.nosave"))) 300#define __nosavedata __section(.data.nosave)
246 301
247/* This means "can be init if no module support, otherwise module load 302/* This means "can be init if no module support, otherwise module load
248 may call it." */ 303 may call it." */
@@ -254,43 +309,6 @@ void __init parse_early_param(void);
254#define __initdata_or_module __initdata 309#define __initdata_or_module __initdata
255#endif /*CONFIG_MODULES*/ 310#endif /*CONFIG_MODULES*/
256 311
257#ifdef CONFIG_HOTPLUG
258#define __devinit
259#define __devinitdata
260#define __devexit
261#define __devexitdata
262#else
263#define __devinit __init
264#define __devinitdata __initdata
265#define __devexit __exit
266#define __devexitdata __exitdata
267#endif
268
269#ifdef CONFIG_HOTPLUG_CPU
270#define __cpuinit
271#define __cpuinitdata
272#define __cpuexit
273#define __cpuexitdata
274#else
275#define __cpuinit __init
276#define __cpuinitdata __initdata
277#define __cpuexit __exit
278#define __cpuexitdata __exitdata
279#endif
280
281#if defined(CONFIG_MEMORY_HOTPLUG) || defined(CONFIG_ACPI_HOTPLUG_MEMORY) \
282 || defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)
283#define __meminit
284#define __meminitdata
285#define __memexit
286#define __memexitdata
287#else
288#define __meminit __init
289#define __meminitdata __initdata
290#define __memexit __exit
291#define __memexitdata __exitdata
292#endif
293
294/* Functions marked as __devexit may be discarded at kernel link time, depending 312/* Functions marked as __devexit may be discarded at kernel link time, depending
295 on config options. Newer versions of binutils detect references from 313 on config options. Newer versions of binutils detect references from
296 retained sections to discarded sections and flag an error. Pointers to 314 retained sections to discarded sections and flag an error. Pointers to
diff --git a/include/linux/init_ohci1394_dma.h b/include/linux/init_ohci1394_dma.h
new file mode 100644
index 000000000000..3c03a4bba5e4
--- /dev/null
+++ b/include/linux/init_ohci1394_dma.h
@@ -0,0 +1,4 @@
1#ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
2extern int __initdata init_ohci1394_dma_early;
3extern void __init init_ohci1394_dma_on_all_controllers(void);
4#endif
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index cae35b6b9aec..f42663eaf655 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -114,6 +114,13 @@ extern struct group_info init_groups;
114 .pid = &init_struct_pid, \ 114 .pid = &init_struct_pid, \
115} 115}
116 116
117#ifdef CONFIG_AUDITSYSCALL
118#define INIT_IDS \
119 .loginuid = -1, \
120 .sessionid = -1,
121#else
122#define INIT_IDS
123#endif
117/* 124/*
118 * INIT_TASK is used to set up the first task table, touch at 125 * INIT_TASK is used to set up the first task table, touch at
119 * your own risk!. Base=0, limit=0x1fffff (=2MB) 126 * your own risk!. Base=0, limit=0x1fffff (=2MB)
@@ -132,9 +139,11 @@ extern struct group_info init_groups;
132 .cpus_allowed = CPU_MASK_ALL, \ 139 .cpus_allowed = CPU_MASK_ALL, \
133 .mm = NULL, \ 140 .mm = NULL, \
134 .active_mm = &init_mm, \ 141 .active_mm = &init_mm, \
135 .run_list = LIST_HEAD_INIT(tsk.run_list), \ 142 .rt = { \
136 .ioprio = 0, \ 143 .run_list = LIST_HEAD_INIT(tsk.rt.run_list), \
137 .time_slice = HZ, \ 144 .time_slice = HZ, \
145 .nr_cpus_allowed = NR_CPUS, \
146 }, \
138 .tasks = LIST_HEAD_INIT(tsk.tasks), \ 147 .tasks = LIST_HEAD_INIT(tsk.tasks), \
139 .ptrace_children= LIST_HEAD_INIT(tsk.ptrace_children), \ 148 .ptrace_children= LIST_HEAD_INIT(tsk.ptrace_children), \
140 .ptrace_list = LIST_HEAD_INIT(tsk.ptrace_list), \ 149 .ptrace_list = LIST_HEAD_INIT(tsk.ptrace_list), \
@@ -171,6 +180,7 @@ extern struct group_info init_groups;
171 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \ 180 [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \
172 }, \ 181 }, \
173 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \ 182 .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \
183 INIT_IDS \
174 INIT_TRACE_IRQFLAGS \ 184 INIT_TRACE_IRQFLAGS \
175 INIT_LOCKDEP \ 185 INIT_LOCKDEP \
176} 186}
diff --git a/include/linux/input.h b/include/linux/input.h
index 62268929856c..056a17a4f34f 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -371,6 +371,8 @@ struct input_absinfo {
371#define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */ 371#define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */
372#define KEY_DISPLAY_OFF 245 /* display device to off state */ 372#define KEY_DISPLAY_OFF 245 /* display device to off state */
373 373
374#define KEY_WIMAX 246
375
374#define BTN_MISC 0x100 376#define BTN_MISC 0x100
375#define BTN_0 0x100 377#define BTN_0 0x100
376#define BTN_1 0x101 378#define BTN_1 0x101
@@ -527,6 +529,14 @@ struct input_absinfo {
527#define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */ 529#define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */
528#define KEY_LOGOFF 0x1b1 /* AL Logoff */ 530#define KEY_LOGOFF 0x1b1 /* AL Logoff */
529 531
532#define KEY_DOLLAR 0x1b2
533#define KEY_EURO 0x1b3
534
535#define KEY_FRAMEBACK 0x1b4 /* Consumer - transport controls */
536#define KEY_FRAMEFORWARD 0x1b5
537
538#define KEY_CONTEXT_MENU 0x1b6 /* GenDesc - system context menu */
539
530#define KEY_DEL_EOL 0x1c0 540#define KEY_DEL_EOL 0x1c0
531#define KEY_DEL_EOS 0x1c1 541#define KEY_DEL_EOS 0x1c1
532#define KEY_INS_LINE 0x1c2 542#define KEY_INS_LINE 0x1c2
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 2306920fa388..c3db4a00f1fa 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -256,6 +256,7 @@ enum
256#ifdef CONFIG_HIGH_RES_TIMERS 256#ifdef CONFIG_HIGH_RES_TIMERS
257 HRTIMER_SOFTIRQ, 257 HRTIMER_SOFTIRQ,
258#endif 258#endif
259 RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */
259}; 260};
260 261
261/* softirq mask and active fields moved to irq_cpustat_t in 262/* softirq mask and active fields moved to irq_cpustat_t in
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
new file mode 100644
index 000000000000..593b222d9dcc
--- /dev/null
+++ b/include/linux/iocontext.h
@@ -0,0 +1,95 @@
1#ifndef IOCONTEXT_H
2#define IOCONTEXT_H
3
4#include <linux/radix-tree.h>
5
6/*
7 * This is the per-process anticipatory I/O scheduler state.
8 */
9struct as_io_context {
10 spinlock_t lock;
11
12 void (*dtor)(struct as_io_context *aic); /* destructor */
13 void (*exit)(struct as_io_context *aic); /* called on task exit */
14
15 unsigned long state;
16 atomic_t nr_queued; /* queued reads & sync writes */
17 atomic_t nr_dispatched; /* number of requests gone to the drivers */
18
19 /* IO History tracking */
20 /* Thinktime */
21 unsigned long last_end_request;
22 unsigned long ttime_total;
23 unsigned long ttime_samples;
24 unsigned long ttime_mean;
25 /* Layout pattern */
26 unsigned int seek_samples;
27 sector_t last_request_pos;
28 u64 seek_total;
29 sector_t seek_mean;
30};
31
32struct cfq_queue;
33struct cfq_io_context {
34 void *key;
35 unsigned long dead_key;
36
37 struct cfq_queue *cfqq[2];
38
39 struct io_context *ioc;
40
41 unsigned long last_end_request;
42 sector_t last_request_pos;
43
44 unsigned long ttime_total;
45 unsigned long ttime_samples;
46 unsigned long ttime_mean;
47
48 unsigned int seek_samples;
49 u64 seek_total;
50 sector_t seek_mean;
51
52 struct list_head queue_list;
53
54 void (*dtor)(struct io_context *); /* destructor */
55 void (*exit)(struct io_context *); /* called on task exit */
56};
57
58/*
59 * I/O subsystem state of the associated processes. It is refcounted
60 * and kmalloc'ed. These could be shared between processes.
61 */
62struct io_context {
63 atomic_t refcount;
64 atomic_t nr_tasks;
65
66 /* all the fields below are protected by this lock */
67 spinlock_t lock;
68
69 unsigned short ioprio;
70 unsigned short ioprio_changed;
71
72 /*
73 * For request batching
74 */
75 unsigned long last_waited; /* Time last woken after wait for request */
76 int nr_batch_requests; /* Number of requests left in the batch */
77
78 struct as_io_context *aic;
79 struct radix_tree_root radix_root;
80 void *ioc_data;
81};
82
83static inline struct io_context *ioc_task_link(struct io_context *ioc)
84{
85 /*
86 * if ref count is zero, don't allow sharing (ioc is going away, it's
87 * a race).
88 */
89 if (ioc && atomic_inc_not_zero(&ioc->refcount))
90 return ioc;
91
92 return NULL;
93}
94
95#endif
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 6187a8567bc7..605d237364d2 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -8,6 +8,7 @@
8#ifndef _LINUX_IOPORT_H 8#ifndef _LINUX_IOPORT_H
9#define _LINUX_IOPORT_H 9#define _LINUX_IOPORT_H
10 10
11#ifndef __ASSEMBLY__
11#include <linux/compiler.h> 12#include <linux/compiler.h>
12#include <linux/types.h> 13#include <linux/types.h>
13/* 14/*
@@ -153,4 +154,5 @@ extern struct resource * __devm_request_region(struct device *dev,
153extern void __devm_release_region(struct device *dev, struct resource *parent, 154extern void __devm_release_region(struct device *dev, struct resource *parent,
154 resource_size_t start, resource_size_t n); 155 resource_size_t start, resource_size_t n);
155 156
157#endif /* __ASSEMBLY__ */
156#endif /* _LINUX_IOPORT_H */ 158#endif /* _LINUX_IOPORT_H */
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h
index baf29387cab4..2a3bb1bb7433 100644
--- a/include/linux/ioprio.h
+++ b/include/linux/ioprio.h
@@ -2,6 +2,7 @@
2#define IOPRIO_H 2#define IOPRIO_H
3 3
4#include <linux/sched.h> 4#include <linux/sched.h>
5#include <linux/iocontext.h>
5 6
6/* 7/*
7 * Gives us 8 prio classes with 13-bits of data for each class 8 * Gives us 8 prio classes with 13-bits of data for each class
@@ -45,18 +46,18 @@ enum {
45 * the cpu scheduler nice value to an io priority 46 * the cpu scheduler nice value to an io priority
46 */ 47 */
47#define IOPRIO_NORM (4) 48#define IOPRIO_NORM (4)
48static inline int task_ioprio(struct task_struct *task) 49static inline int task_ioprio(struct io_context *ioc)
49{ 50{
50 if (ioprio_valid(task->ioprio)) 51 if (ioprio_valid(ioc->ioprio))
51 return IOPRIO_PRIO_DATA(task->ioprio); 52 return IOPRIO_PRIO_DATA(ioc->ioprio);
52 53
53 return IOPRIO_NORM; 54 return IOPRIO_NORM;
54} 55}
55 56
56static inline int task_ioprio_class(struct task_struct *task) 57static inline int task_ioprio_class(struct io_context *ioc)
57{ 58{
58 if (ioprio_valid(task->ioprio)) 59 if (ioprio_valid(ioc->ioprio))
59 return IOPRIO_PRIO_CLASS(task->ioprio); 60 return IOPRIO_PRIO_CLASS(ioc->ioprio);
60 61
61 return IOPRIO_CLASS_BE; 62 return IOPRIO_CLASS_BE;
62} 63}
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
index 56ae438ae510..6e8cec503380 100644
--- a/include/linux/ipmi_smi.h
+++ b/include/linux/ipmi_smi.h
@@ -173,7 +173,7 @@ static inline int ipmi_demangle_device_id(const unsigned char *data,
173 id->firmware_revision_2 = data[3]; 173 id->firmware_revision_2 = data[3];
174 id->ipmi_version = data[4]; 174 id->ipmi_version = data[4];
175 id->additional_device_support = data[5]; 175 id->additional_device_support = data[5];
176 if (data_len >= 6) { 176 if (data_len >= 11) {
177 id->manufacturer_id = (data[6] | (data[7] << 8) | 177 id->manufacturer_id = (data[6] | (data[7] << 8) |
178 (data[8] << 16)); 178 (data[8] << 16));
179 id->product_id = data[9] | (data[10] << 8); 179 id->product_id = data[9] | (data[10] << 8);
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 5d35a4cc3bff..4aaefc349a4b 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -457,14 +457,22 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
457#define inet_v6_ipv6only(__sk) 0 457#define inet_v6_ipv6only(__sk) 0
458#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 458#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
459 459
460#define INET6_MATCH(__sk, __hash, __saddr, __daddr, __ports, __dif)\ 460#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\
461 (((__sk)->sk_hash == (__hash)) && \ 461 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
462 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 462 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
463 ((__sk)->sk_family == AF_INET6) && \ 463 ((__sk)->sk_family == AF_INET6) && \
464 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ 464 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \
465 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \ 465 ipv6_addr_equal(&inet6_sk(__sk)->rcv_saddr, (__daddr)) && \
466 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 466 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
467 467
468#define INET6_TW_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif) \
469 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
470 (*((__portpair *)&(inet_twsk(__sk)->tw_dport)) == (__ports)) && \
471 ((__sk)->sk_family == PF_INET6) && \
472 (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr))) && \
473 (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_rcv_saddr, (__daddr))) && \
474 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
475
468#endif /* __KERNEL__ */ 476#endif /* __KERNEL__ */
469 477
470#endif /* _IPV6_H */ 478#endif /* _IPV6_H */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index efc88538b2ba..4669be080617 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -339,6 +339,13 @@ extern void
339__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, 339__set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
340 const char *name); 340 const char *name);
341 341
342/* caller has locked the irq_desc and both params are valid */
343static inline void __set_irq_handler_unlocked(int irq,
344 irq_flow_handler_t handler)
345{
346 irq_desc[irq].handle_irq = handler;
347}
348
342/* 349/*
343 * Set a highlevel flow handler for a given IRQ: 350 * Set a highlevel flow handler for a given IRQ:
344 */ 351 */
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 16e7ed855a18..d9ecd13393b0 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -439,6 +439,8 @@ struct transaction_s
439 /* 439 /*
440 * Transaction's current state 440 * Transaction's current state
441 * [no locking - only kjournald alters this] 441 * [no locking - only kjournald alters this]
442 * [j_list_lock] guards transition of a transaction into T_FINISHED
443 * state and subsequent call of __journal_drop_transaction()
442 * FIXME: needs barriers 444 * FIXME: needs barriers
443 * KLUDGE: [use j_state_lock] 445 * KLUDGE: [use j_state_lock]
444 */ 446 */
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 06ef11457051..2cbf6fdb1799 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -149,6 +149,28 @@ typedef struct journal_header_s
149 __be32 h_sequence; 149 __be32 h_sequence;
150} journal_header_t; 150} journal_header_t;
151 151
152/*
153 * Checksum types.
154 */
155#define JBD2_CRC32_CHKSUM 1
156#define JBD2_MD5_CHKSUM 2
157#define JBD2_SHA1_CHKSUM 3
158
159#define JBD2_CRC32_CHKSUM_SIZE 4
160
161#define JBD2_CHECKSUM_BYTES (32 / sizeof(u32))
162/*
163 * Commit block header for storing transactional checksums:
164 */
165struct commit_header {
166 __be32 h_magic;
167 __be32 h_blocktype;
168 __be32 h_sequence;
169 unsigned char h_chksum_type;
170 unsigned char h_chksum_size;
171 unsigned char h_padding[2];
172 __be32 h_chksum[JBD2_CHECKSUM_BYTES];
173};
152 174
153/* 175/*
154 * The block tag: used to describe a single buffer in the journal. 176 * The block tag: used to describe a single buffer in the journal.
@@ -242,31 +264,25 @@ typedef struct journal_superblock_s
242 ((j)->j_format_version >= 2 && \ 264 ((j)->j_format_version >= 2 && \
243 ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask)))) 265 ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask))))
244 266
245#define JBD2_FEATURE_INCOMPAT_REVOKE 0x00000001 267#define JBD2_FEATURE_COMPAT_CHECKSUM 0x00000001
246#define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002 268
269#define JBD2_FEATURE_INCOMPAT_REVOKE 0x00000001
270#define JBD2_FEATURE_INCOMPAT_64BIT 0x00000002
271#define JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT 0x00000004
247 272
248/* Features known to this kernel version: */ 273/* Features known to this kernel version: */
249#define JBD2_KNOWN_COMPAT_FEATURES 0 274#define JBD2_KNOWN_COMPAT_FEATURES JBD2_FEATURE_COMPAT_CHECKSUM
250#define JBD2_KNOWN_ROCOMPAT_FEATURES 0 275#define JBD2_KNOWN_ROCOMPAT_FEATURES 0
251#define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \ 276#define JBD2_KNOWN_INCOMPAT_FEATURES (JBD2_FEATURE_INCOMPAT_REVOKE | \
252 JBD2_FEATURE_INCOMPAT_64BIT) 277 JBD2_FEATURE_INCOMPAT_64BIT | \
278 JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)
253 279
254#ifdef __KERNEL__ 280#ifdef __KERNEL__
255 281
256#include <linux/fs.h> 282#include <linux/fs.h>
257#include <linux/sched.h> 283#include <linux/sched.h>
258 284
259#define JBD2_ASSERTIONS 285#define J_ASSERT(assert) BUG_ON(!(assert))
260#ifdef JBD2_ASSERTIONS
261#define J_ASSERT(assert) \
262do { \
263 if (!(assert)) { \
264 printk (KERN_EMERG \
265 "Assertion failure in %s() at %s:%d: \"%s\"\n", \
266 __FUNCTION__, __FILE__, __LINE__, # assert); \
267 BUG(); \
268 } \
269} while (0)
270 286
271#if defined(CONFIG_BUFFER_DEBUG) 287#if defined(CONFIG_BUFFER_DEBUG)
272void buffer_assertion_failure(struct buffer_head *bh); 288void buffer_assertion_failure(struct buffer_head *bh);
@@ -282,10 +298,6 @@ void buffer_assertion_failure(struct buffer_head *bh);
282#define J_ASSERT_JH(jh, expr) J_ASSERT(expr) 298#define J_ASSERT_JH(jh, expr) J_ASSERT(expr)
283#endif 299#endif
284 300
285#else
286#define J_ASSERT(assert) do { } while (0)
287#endif /* JBD2_ASSERTIONS */
288
289#if defined(JBD2_PARANOID_IOFAIL) 301#if defined(JBD2_PARANOID_IOFAIL)
290#define J_EXPECT(expr, why...) J_ASSERT(expr) 302#define J_EXPECT(expr, why...) J_ASSERT(expr)
291#define J_EXPECT_BH(bh, expr, why...) J_ASSERT_BH(bh, expr) 303#define J_EXPECT_BH(bh, expr, why...) J_ASSERT_BH(bh, expr)
@@ -406,9 +418,23 @@ struct handle_s
406 unsigned int h_sync: 1; /* sync-on-close */ 418 unsigned int h_sync: 1; /* sync-on-close */
407 unsigned int h_jdata: 1; /* force data journaling */ 419 unsigned int h_jdata: 1; /* force data journaling */
408 unsigned int h_aborted: 1; /* fatal error on handle */ 420 unsigned int h_aborted: 1; /* fatal error on handle */
421
422#ifdef CONFIG_DEBUG_LOCK_ALLOC
423 struct lockdep_map h_lockdep_map;
424#endif
409}; 425};
410 426
411 427
428/*
429 * Some stats for checkpoint phase
430 */
431struct transaction_chp_stats_s {
432 unsigned long cs_chp_time;
433 unsigned long cs_forced_to_close;
434 unsigned long cs_written;
435 unsigned long cs_dropped;
436};
437
412/* The transaction_t type is the guts of the journaling mechanism. It 438/* The transaction_t type is the guts of the journaling mechanism. It
413 * tracks a compound transaction through its various states: 439 * tracks a compound transaction through its various states:
414 * 440 *
@@ -456,6 +482,8 @@ struct transaction_s
456 /* 482 /*
457 * Transaction's current state 483 * Transaction's current state
458 * [no locking - only kjournald2 alters this] 484 * [no locking - only kjournald2 alters this]
485 * [j_list_lock] guards transition of a transaction into T_FINISHED
486 * state and subsequent call of __jbd2_journal_drop_transaction()
459 * FIXME: needs barriers 487 * FIXME: needs barriers
460 * KLUDGE: [use j_state_lock] 488 * KLUDGE: [use j_state_lock]
461 */ 489 */
@@ -544,6 +572,21 @@ struct transaction_s
544 spinlock_t t_handle_lock; 572 spinlock_t t_handle_lock;
545 573
546 /* 574 /*
575 * Longest time some handle had to wait for running transaction
576 */
577 unsigned long t_max_wait;
578
579 /*
580 * When transaction started
581 */
582 unsigned long t_start;
583
584 /*
585 * Checkpointing stats [j_checkpoint_sem]
586 */
587 struct transaction_chp_stats_s t_chp_stats;
588
589 /*
547 * Number of outstanding updates running on this transaction 590 * Number of outstanding updates running on this transaction
548 * [t_handle_lock] 591 * [t_handle_lock]
549 */ 592 */
@@ -574,6 +617,39 @@ struct transaction_s
574 617
575}; 618};
576 619
620struct transaction_run_stats_s {
621 unsigned long rs_wait;
622 unsigned long rs_running;
623 unsigned long rs_locked;
624 unsigned long rs_flushing;
625 unsigned long rs_logging;
626
627 unsigned long rs_handle_count;
628 unsigned long rs_blocks;
629 unsigned long rs_blocks_logged;
630};
631
632struct transaction_stats_s {
633 int ts_type;
634 unsigned long ts_tid;
635 union {
636 struct transaction_run_stats_s run;
637 struct transaction_chp_stats_s chp;
638 } u;
639};
640
641#define JBD2_STATS_RUN 1
642#define JBD2_STATS_CHECKPOINT 2
643
644static inline unsigned long
645jbd2_time_diff(unsigned long start, unsigned long end)
646{
647 if (end >= start)
648 return end - start;
649
650 return end + (MAX_JIFFY_OFFSET - start);
651}
652
577/** 653/**
578 * struct journal_s - The journal_s type is the concrete type associated with 654 * struct journal_s - The journal_s type is the concrete type associated with
579 * journal_t. 655 * journal_t.
@@ -635,6 +711,12 @@ struct transaction_s
635 * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the 711 * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the
636 * number that will fit in j_blocksize 712 * number that will fit in j_blocksize
637 * @j_last_sync_writer: most recent pid which did a synchronous write 713 * @j_last_sync_writer: most recent pid which did a synchronous write
714 * @j_history: Buffer storing the transactions statistics history
715 * @j_history_max: Maximum number of transactions in the statistics history
716 * @j_history_cur: Current number of transactions in the statistics history
717 * @j_history_lock: Protect the transactions statistics history
718 * @j_proc_entry: procfs entry for the jbd statistics directory
719 * @j_stats: Overall statistics
638 * @j_private: An opaque pointer to fs-private information. 720 * @j_private: An opaque pointer to fs-private information.
639 */ 721 */
640 722
@@ -827,6 +909,19 @@ struct journal_s
827 pid_t j_last_sync_writer; 909 pid_t j_last_sync_writer;
828 910
829 /* 911 /*
912 * Journal statistics
913 */
914 struct transaction_stats_s *j_history;
915 int j_history_max;
916 int j_history_cur;
917 /*
918 * Protect the transactions statistics history
919 */
920 spinlock_t j_history_lock;
921 struct proc_dir_entry *j_proc_entry;
922 struct transaction_stats_s j_stats;
923
924 /*
830 * An opaque pointer to fs-private information. ext3 puts its 925 * An opaque pointer to fs-private information. ext3 puts its
831 * superblock pointer here 926 * superblock pointer here
832 */ 927 */
@@ -932,6 +1027,8 @@ extern int jbd2_journal_check_available_features
932 (journal_t *, unsigned long, unsigned long, unsigned long); 1027 (journal_t *, unsigned long, unsigned long, unsigned long);
933extern int jbd2_journal_set_features 1028extern int jbd2_journal_set_features
934 (journal_t *, unsigned long, unsigned long, unsigned long); 1029 (journal_t *, unsigned long, unsigned long, unsigned long);
1030extern void jbd2_journal_clear_features
1031 (journal_t *, unsigned long, unsigned long, unsigned long);
935extern int jbd2_journal_create (journal_t *); 1032extern int jbd2_journal_create (journal_t *);
936extern int jbd2_journal_load (journal_t *journal); 1033extern int jbd2_journal_load (journal_t *journal);
937extern void jbd2_journal_destroy (journal_t *); 1034extern void jbd2_journal_destroy (journal_t *);
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 8b080024bbc1..7ba9e47bf061 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -29,6 +29,12 @@
29# define SHIFT_HZ 9 29# define SHIFT_HZ 9
30#elif HZ >= 768 && HZ < 1536 30#elif HZ >= 768 && HZ < 1536
31# define SHIFT_HZ 10 31# define SHIFT_HZ 10
32#elif HZ >= 1536 && HZ < 3072
33# define SHIFT_HZ 11
34#elif HZ >= 3072 && HZ < 6144
35# define SHIFT_HZ 12
36#elif HZ >= 6144 && HZ < 12288
37# define SHIFT_HZ 13
32#else 38#else
33# error You lose. 39# error You lose.
34#endif 40#endif
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index f73de6fb5c68..82de2fb62cb7 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -6,6 +6,7 @@
6#define _LINUX_KALLSYMS_H 6#define _LINUX_KALLSYMS_H
7 7
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <linux/stddef.h>
9 10
10#define KSYM_NAME_LEN 128 11#define KSYM_NAME_LEN 128
11#define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \ 12#define KSYM_SYMBOL_LEN (sizeof("%s+%#lx/%#lx [%s]") + (KSYM_NAME_LEN - 1) + \
diff --git a/include/linux/kd.h b/include/linux/kd.h
index c91fc0c9c495..15f2853ea58f 100644
--- a/include/linux/kd.h
+++ b/include/linux/kd.h
@@ -126,7 +126,7 @@ struct kbdiacrs {
126#define KDSKBDIACR 0x4B4B /* write kernel accent table */ 126#define KDSKBDIACR 0x4B4B /* write kernel accent table */
127 127
128struct kbdiacruc { 128struct kbdiacruc {
129 __u32 diacr, base, result; 129 unsigned int diacr, base, result;
130}; 130};
131struct kbdiacrsuc { 131struct kbdiacrsuc {
132 unsigned int kb_cnt; /* number of entries in following array */ 132 unsigned int kb_cnt; /* number of entries in following array */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 94bc99656963..ff356b2ee478 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -105,8 +105,8 @@ struct user;
105 * supposed to. 105 * supposed to.
106 */ 106 */
107#ifdef CONFIG_PREEMPT_VOLUNTARY 107#ifdef CONFIG_PREEMPT_VOLUNTARY
108extern int cond_resched(void); 108extern int _cond_resched(void);
109# define might_resched() cond_resched() 109# define might_resched() _cond_resched()
110#else 110#else
111# define might_resched() do { } while (0) 111# define might_resched() do { } while (0)
112#endif 112#endif
@@ -194,6 +194,9 @@ static inline int log_buf_read(int idx) { return 0; }
194static inline int log_buf_copy(char *dest, int idx, int len) { return 0; } 194static inline int log_buf_copy(char *dest, int idx, int len) { return 0; }
195#endif 195#endif
196 196
197extern void __attribute__((format(printf, 1, 2)))
198 early_printk(const char *fmt, ...);
199
197unsigned long int_sqrt(unsigned long); 200unsigned long int_sqrt(unsigned long);
198 201
199extern int printk_ratelimit(void); 202extern int printk_ratelimit(void);
diff --git a/include/linux/key.h b/include/linux/key.h
index fcdbd5ed227b..a70b8a8f2005 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -290,7 +290,7 @@ extern void key_init(void);
290#define key_get(k) ({ NULL; }) 290#define key_get(k) ({ NULL; })
291#define key_put(k) do { } while(0) 291#define key_put(k) do { } while(0)
292#define key_ref_put(k) do { } while(0) 292#define key_ref_put(k) do { } while(0)
293#define make_key_ref(k) ({ NULL; }) 293#define make_key_ref(k, p) ({ NULL; })
294#define key_ref_to_ptr(k) ({ NULL; }) 294#define key_ref_to_ptr(k) ({ NULL; })
295#define is_key_possessed(k) 0 295#define is_key_possessed(k) 0
296#define alloc_uid_keyring(u,c) 0 296#define alloc_uid_keyring(u,c) 0
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 4a0d27f475d7..caa3f411f15d 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -3,15 +3,14 @@
3 * 3 *
4 * Copyright (c) 2002-2003 Patrick Mochel 4 * Copyright (c) 2002-2003 Patrick Mochel
5 * Copyright (c) 2002-2003 Open Source Development Labs 5 * Copyright (c) 2002-2003 Open Source Development Labs
6 * Copyright (c) 2006-2007 Greg Kroah-Hartman <greg@kroah.com> 6 * Copyright (c) 2006-2008 Greg Kroah-Hartman <greg@kroah.com>
7 * Copyright (c) 2006-2007 Novell Inc. 7 * Copyright (c) 2006-2008 Novell Inc.
8 * 8 *
9 * This file is released under the GPLv2. 9 * This file is released under the GPLv2.
10 * 10 *
11 *
12 * Please read Documentation/kobject.txt before using the kobject 11 * Please read Documentation/kobject.txt before using the kobject
13 * interface, ESPECIALLY the parts about reference counts and object 12 * interface, ESPECIALLY the parts about reference counts and object
14 * destructors. 13 * destructors.
15 */ 14 */
16 15
17#ifndef _KOBJECT_H_ 16#ifndef _KOBJECT_H_
@@ -61,48 +60,54 @@ enum kobject_action {
61}; 60};
62 61
63struct kobject { 62struct kobject {
64 const char * k_name; 63 const char *name;
65 struct kref kref; 64 struct kref kref;
66 struct list_head entry; 65 struct list_head entry;
67 struct kobject * parent; 66 struct kobject *parent;
68 struct kset * kset; 67 struct kset *kset;
69 struct kobj_type * ktype; 68 struct kobj_type *ktype;
70 struct sysfs_dirent * sd; 69 struct sysfs_dirent *sd;
70 unsigned int state_initialized:1;
71 unsigned int state_in_sysfs:1;
72 unsigned int state_add_uevent_sent:1;
73 unsigned int state_remove_uevent_sent:1;
71}; 74};
72 75
73extern int kobject_set_name(struct kobject *, const char *, ...) 76extern int kobject_set_name(struct kobject *kobj, const char *name, ...)
74 __attribute__((format(printf,2,3))); 77 __attribute__((format(printf, 2, 3)));
75 78
76static inline const char * kobject_name(const struct kobject * kobj) 79static inline const char *kobject_name(const struct kobject *kobj)
77{ 80{
78 return kobj->k_name; 81 return kobj->name;
79} 82}
80 83
81extern void kobject_init(struct kobject *); 84extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype);
82extern void kobject_cleanup(struct kobject *); 85extern int __must_check kobject_add(struct kobject *kobj,
86 struct kobject *parent,
87 const char *fmt, ...);
88extern int __must_check kobject_init_and_add(struct kobject *kobj,
89 struct kobj_type *ktype,
90 struct kobject *parent,
91 const char *fmt, ...);
92
93extern void kobject_del(struct kobject *kobj);
83 94
84extern int __must_check kobject_add(struct kobject *); 95extern struct kobject * __must_check kobject_create(void);
85extern void kobject_del(struct kobject *); 96extern struct kobject * __must_check kobject_create_and_add(const char *name,
97 struct kobject *parent);
86 98
87extern int __must_check kobject_rename(struct kobject *, const char *new_name); 99extern int __must_check kobject_rename(struct kobject *, const char *new_name);
88extern int __must_check kobject_move(struct kobject *, struct kobject *); 100extern int __must_check kobject_move(struct kobject *, struct kobject *);
89 101
90extern int __must_check kobject_register(struct kobject *); 102extern struct kobject *kobject_get(struct kobject *kobj);
91extern void kobject_unregister(struct kobject *); 103extern void kobject_put(struct kobject *kobj);
92
93extern struct kobject * kobject_get(struct kobject *);
94extern void kobject_put(struct kobject *);
95
96extern struct kobject *kobject_kset_add_dir(struct kset *kset,
97 struct kobject *, const char *);
98extern struct kobject *kobject_add_dir(struct kobject *, const char *);
99 104
100extern char * kobject_get_path(struct kobject *, gfp_t); 105extern char *kobject_get_path(struct kobject *kobj, gfp_t flag);
101 106
102struct kobj_type { 107struct kobj_type {
103 void (*release)(struct kobject *); 108 void (*release)(struct kobject *kobj);
104 struct sysfs_ops * sysfs_ops; 109 struct sysfs_ops *sysfs_ops;
105 struct attribute ** default_attrs; 110 struct attribute **default_attrs;
106}; 111};
107 112
108struct kobj_uevent_env { 113struct kobj_uevent_env {
@@ -119,6 +124,16 @@ struct kset_uevent_ops {
119 struct kobj_uevent_env *env); 124 struct kobj_uevent_env *env);
120}; 125};
121 126
127struct kobj_attribute {
128 struct attribute attr;
129 ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr,
130 char *buf);
131 ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr,
132 const char *buf, size_t count);
133};
134
135extern struct sysfs_ops kobj_sysfs_ops;
136
122/** 137/**
123 * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem. 138 * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem.
124 * 139 *
@@ -128,7 +143,6 @@ struct kset_uevent_ops {
128 * define the attribute callbacks and other common events that happen to 143 * define the attribute callbacks and other common events that happen to
129 * a kobject. 144 * a kobject.
130 * 145 *
131 * @ktype: the struct kobj_type for this specific kset
132 * @list: the list of all kobjects for this kset 146 * @list: the list of all kobjects for this kset
133 * @list_lock: a lock for iterating over the kobjects 147 * @list_lock: a lock for iterating over the kobjects
134 * @kobj: the embedded kobject for this kset (recursion, isn't it fun...) 148 * @kobj: the embedded kobject for this kset (recursion, isn't it fun...)
@@ -138,99 +152,49 @@ struct kset_uevent_ops {
138 * desired. 152 * desired.
139 */ 153 */
140struct kset { 154struct kset {
141 struct kobj_type *ktype; 155 struct list_head list;
142 struct list_head list; 156 spinlock_t list_lock;
143 spinlock_t list_lock; 157 struct kobject kobj;
144 struct kobject kobj; 158 struct kset_uevent_ops *uevent_ops;
145 struct kset_uevent_ops *uevent_ops;
146}; 159};
147 160
161extern void kset_init(struct kset *kset);
162extern int __must_check kset_register(struct kset *kset);
163extern void kset_unregister(struct kset *kset);
164extern struct kset * __must_check kset_create_and_add(const char *name,
165 struct kset_uevent_ops *u,
166 struct kobject *parent_kobj);
148 167
149extern void kset_init(struct kset * k); 168static inline struct kset *to_kset(struct kobject *kobj)
150extern int __must_check kset_add(struct kset * k);
151extern int __must_check kset_register(struct kset * k);
152extern void kset_unregister(struct kset * k);
153
154static inline struct kset * to_kset(struct kobject * kobj)
155{ 169{
156 return kobj ? container_of(kobj,struct kset,kobj) : NULL; 170 return kobj ? container_of(kobj, struct kset, kobj) : NULL;
157} 171}
158 172
159static inline struct kset * kset_get(struct kset * k) 173static inline struct kset *kset_get(struct kset *k)
160{ 174{
161 return k ? to_kset(kobject_get(&k->kobj)) : NULL; 175 return k ? to_kset(kobject_get(&k->kobj)) : NULL;
162} 176}
163 177
164static inline void kset_put(struct kset * k) 178static inline void kset_put(struct kset *k)
165{ 179{
166 kobject_put(&k->kobj); 180 kobject_put(&k->kobj);
167} 181}
168 182
169static inline struct kobj_type * get_ktype(struct kobject * k) 183static inline struct kobj_type *get_ktype(struct kobject *kobj)
170{ 184{
171 if (k->kset && k->kset->ktype) 185 return kobj->ktype;
172 return k->kset->ktype;
173 else
174 return k->ktype;
175} 186}
176 187
177extern struct kobject * kset_find_obj(struct kset *, const char *); 188extern struct kobject *kset_find_obj(struct kset *, const char *);
178
179
180/*
181 * Use this when initializing an embedded kset with no other
182 * fields to initialize.
183 */
184#define set_kset_name(str) .kset = { .kobj = { .k_name = str } }
185
186
187#define decl_subsys(_name,_type,_uevent_ops) \
188struct kset _name##_subsys = { \
189 .kobj = { .k_name = __stringify(_name) }, \
190 .ktype = _type, \
191 .uevent_ops =_uevent_ops, \
192}
193#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \
194struct kset _varname##_subsys = { \
195 .kobj = { .k_name = __stringify(_name) }, \
196 .ktype = _type, \
197 .uevent_ops =_uevent_ops, \
198}
199
200/* The global /sys/kernel/ subsystem for people to chain off of */
201extern struct kset kernel_subsys;
202/* The global /sys/hypervisor/ subsystem */
203extern struct kset hypervisor_subsys;
204
205/*
206 * Helpers for setting the kset of registered objects.
207 * Often, a registered object belongs to a kset embedded in a
208 * subsystem. These do no magic, just make the resulting code
209 * easier to follow.
210 */
211
212/**
213 * kobj_set_kset_s(obj,subsys) - set kset for embedded kobject.
214 * @obj: ptr to some object type.
215 * @subsys: a subsystem object (not a ptr).
216 *
217 * Can be used for any object type with an embedded ->kobj.
218 */
219
220#define kobj_set_kset_s(obj,subsys) \
221 (obj)->kobj.kset = &(subsys)
222
223extern int __must_check subsystem_register(struct kset *);
224extern void subsystem_unregister(struct kset *);
225
226struct subsys_attribute {
227 struct attribute attr;
228 ssize_t (*show)(struct kset *, char *);
229 ssize_t (*store)(struct kset *, const char *, size_t);
230};
231 189
232extern int __must_check subsys_create_file(struct kset *, 190/* The global /sys/kernel/ kobject for people to chain off of */
233 struct subsys_attribute *); 191extern struct kobject *kernel_kobj;
192/* The global /sys/hypervisor/ kobject for people to chain off of */
193extern struct kobject *hypervisor_kobj;
194/* The global /sys/power/ kobject for people to chain off of */
195extern struct kobject *power_kobj;
196/* The global /sys/firmware/ kobject for people to chain off of */
197extern struct kobject *firmware_kobj;
234 198
235#if defined(CONFIG_HOTPLUG) 199#if defined(CONFIG_HOTPLUG)
236int kobject_uevent(struct kobject *kobj, enum kobject_action action); 200int kobject_uevent(struct kobject *kobj, enum kobject_action action);
@@ -243,18 +207,20 @@ int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
243int kobject_action_type(const char *buf, size_t count, 207int kobject_action_type(const char *buf, size_t count,
244 enum kobject_action *type); 208 enum kobject_action *type);
245#else 209#else
246static inline int kobject_uevent(struct kobject *kobj, enum kobject_action action) 210static inline int kobject_uevent(struct kobject *kobj,
211 enum kobject_action action)
247{ return 0; } 212{ return 0; }
248static inline int kobject_uevent_env(struct kobject *kobj, 213static inline int kobject_uevent_env(struct kobject *kobj,
249 enum kobject_action action, 214 enum kobject_action action,
250 char *envp[]) 215 char *envp[])
251{ return 0; } 216{ return 0; }
252 217
253static inline int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...) 218static inline int add_uevent_var(struct kobj_uevent_env *env,
219 const char *format, ...)
254{ return 0; } 220{ return 0; }
255 221
256static inline int kobject_action_type(const char *buf, size_t count, 222static inline int kobject_action_type(const char *buf, size_t count,
257 enum kobject_action *type) 223 enum kobject_action *type)
258{ return -EINVAL; } 224{ return -EINVAL; }
259#endif 225#endif
260 226
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 81891581e89b..6168c0a44172 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -182,6 +182,15 @@ static inline void kretprobe_assert(struct kretprobe_instance *ri,
182 } 182 }
183} 183}
184 184
185#ifdef CONFIG_KPROBES_SANITY_TEST
186extern int init_test_probes(void);
187#else
188static inline int init_test_probes(void)
189{
190 return 0;
191}
192#endif /* CONFIG_KPROBES_SANITY_TEST */
193
185extern spinlock_t kretprobe_lock; 194extern spinlock_t kretprobe_lock;
186extern struct mutex kprobe_mutex; 195extern struct mutex kprobe_mutex;
187extern int arch_prepare_kprobe(struct kprobe *p); 196extern int arch_prepare_kprobe(struct kprobe *p);
@@ -227,6 +236,7 @@ void unregister_kretprobe(struct kretprobe *rp);
227 236
228void kprobe_flush_task(struct task_struct *tk); 237void kprobe_flush_task(struct task_struct *tk);
229void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); 238void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head);
239
230#else /* CONFIG_KPROBES */ 240#else /* CONFIG_KPROBES */
231 241
232#define __kprobes /**/ 242#define __kprobes /**/
diff --git a/include/linux/kref.h b/include/linux/kref.h
index 6fee3539893f..5d185635786e 100644
--- a/include/linux/kref.h
+++ b/include/linux/kref.h
@@ -24,6 +24,7 @@ struct kref {
24 atomic_t refcount; 24 atomic_t refcount;
25}; 25};
26 26
27void kref_set(struct kref *kref, int num);
27void kref_init(struct kref *kref); 28void kref_init(struct kref *kref);
28void kref_get(struct kref *kref); 29void kref_get(struct kref *kref);
29int kref_put(struct kref *kref, void (*release) (struct kref *kref)); 30int kref_put(struct kref *kref, void (*release) (struct kref *kref));
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 057a7f34ee36..4de4fd2d8607 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -9,12 +9,10 @@
9 9
10#include <asm/types.h> 10#include <asm/types.h>
11#include <linux/ioctl.h> 11#include <linux/ioctl.h>
12#include <asm/kvm.h>
12 13
13#define KVM_API_VERSION 12 14#define KVM_API_VERSION 12
14 15
15/* Architectural interrupt line count. */
16#define KVM_NR_INTERRUPTS 256
17
18/* for KVM_CREATE_MEMORY_REGION */ 16/* for KVM_CREATE_MEMORY_REGION */
19struct kvm_memory_region { 17struct kvm_memory_region {
20 __u32 slot; 18 __u32 slot;
@@ -23,17 +21,19 @@ struct kvm_memory_region {
23 __u64 memory_size; /* bytes */ 21 __u64 memory_size; /* bytes */
24}; 22};
25 23
26/* for kvm_memory_region::flags */ 24/* for KVM_SET_USER_MEMORY_REGION */
27#define KVM_MEM_LOG_DIRTY_PAGES 1UL 25struct kvm_userspace_memory_region {
28 26 __u32 slot;
29struct kvm_memory_alias {
30 __u32 slot; /* this has a different namespace than memory slots */
31 __u32 flags; 27 __u32 flags;
32 __u64 guest_phys_addr; 28 __u64 guest_phys_addr;
33 __u64 memory_size; 29 __u64 memory_size; /* bytes */
34 __u64 target_phys_addr; 30 __u64 userspace_addr; /* start of the userspace allocated memory */
35}; 31};
36 32
33/* for kvm_memory_region::flags */
34#define KVM_MEM_LOG_DIRTY_PAGES 1UL
35
36
37/* for KVM_IRQ_LINE */ 37/* for KVM_IRQ_LINE */
38struct kvm_irq_level { 38struct kvm_irq_level {
39 /* 39 /*
@@ -45,62 +45,18 @@ struct kvm_irq_level {
45 __u32 level; 45 __u32 level;
46}; 46};
47 47
48/* for KVM_GET_IRQCHIP and KVM_SET_IRQCHIP */
49struct kvm_pic_state {
50 __u8 last_irr; /* edge detection */
51 __u8 irr; /* interrupt request register */
52 __u8 imr; /* interrupt mask register */
53 __u8 isr; /* interrupt service register */
54 __u8 priority_add; /* highest irq priority */
55 __u8 irq_base;
56 __u8 read_reg_select;
57 __u8 poll;
58 __u8 special_mask;
59 __u8 init_state;
60 __u8 auto_eoi;
61 __u8 rotate_on_auto_eoi;
62 __u8 special_fully_nested_mode;
63 __u8 init4; /* true if 4 byte init */
64 __u8 elcr; /* PIIX edge/trigger selection */
65 __u8 elcr_mask;
66};
67
68#define KVM_IOAPIC_NUM_PINS 24
69struct kvm_ioapic_state {
70 __u64 base_address;
71 __u32 ioregsel;
72 __u32 id;
73 __u32 irr;
74 __u32 pad;
75 union {
76 __u64 bits;
77 struct {
78 __u8 vector;
79 __u8 delivery_mode:3;
80 __u8 dest_mode:1;
81 __u8 delivery_status:1;
82 __u8 polarity:1;
83 __u8 remote_irr:1;
84 __u8 trig_mode:1;
85 __u8 mask:1;
86 __u8 reserve:7;
87 __u8 reserved[4];
88 __u8 dest_id;
89 } fields;
90 } redirtbl[KVM_IOAPIC_NUM_PINS];
91};
92
93#define KVM_IRQCHIP_PIC_MASTER 0
94#define KVM_IRQCHIP_PIC_SLAVE 1
95#define KVM_IRQCHIP_IOAPIC 2
96 48
97struct kvm_irqchip { 49struct kvm_irqchip {
98 __u32 chip_id; 50 __u32 chip_id;
99 __u32 pad; 51 __u32 pad;
100 union { 52 union {
101 char dummy[512]; /* reserving space */ 53 char dummy[512]; /* reserving space */
54#ifdef CONFIG_X86
102 struct kvm_pic_state pic; 55 struct kvm_pic_state pic;
56#endif
57#if defined(CONFIG_X86) || defined(CONFIG_IA64)
103 struct kvm_ioapic_state ioapic; 58 struct kvm_ioapic_state ioapic;
59#endif
104 } chip; 60 } chip;
105}; 61};
106 62
@@ -116,6 +72,7 @@ struct kvm_irqchip {
116#define KVM_EXIT_FAIL_ENTRY 9 72#define KVM_EXIT_FAIL_ENTRY 9
117#define KVM_EXIT_INTR 10 73#define KVM_EXIT_INTR 10
118#define KVM_EXIT_SET_TPR 11 74#define KVM_EXIT_SET_TPR 11
75#define KVM_EXIT_TPR_ACCESS 12
119 76
120/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ 77/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */
121struct kvm_run { 78struct kvm_run {
@@ -174,90 +131,17 @@ struct kvm_run {
174 __u32 longmode; 131 __u32 longmode;
175 __u32 pad; 132 __u32 pad;
176 } hypercall; 133 } hypercall;
134 /* KVM_EXIT_TPR_ACCESS */
135 struct {
136 __u64 rip;
137 __u32 is_write;
138 __u32 pad;
139 } tpr_access;
177 /* Fix the size of the union. */ 140 /* Fix the size of the union. */
178 char padding[256]; 141 char padding[256];
179 }; 142 };
180}; 143};
181 144
182/* for KVM_GET_REGS and KVM_SET_REGS */
183struct kvm_regs {
184 /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */
185 __u64 rax, rbx, rcx, rdx;
186 __u64 rsi, rdi, rsp, rbp;
187 __u64 r8, r9, r10, r11;
188 __u64 r12, r13, r14, r15;
189 __u64 rip, rflags;
190};
191
192/* for KVM_GET_FPU and KVM_SET_FPU */
193struct kvm_fpu {
194 __u8 fpr[8][16];
195 __u16 fcw;
196 __u16 fsw;
197 __u8 ftwx; /* in fxsave format */
198 __u8 pad1;
199 __u16 last_opcode;
200 __u64 last_ip;
201 __u64 last_dp;
202 __u8 xmm[16][16];
203 __u32 mxcsr;
204 __u32 pad2;
205};
206
207/* for KVM_GET_LAPIC and KVM_SET_LAPIC */
208#define KVM_APIC_REG_SIZE 0x400
209struct kvm_lapic_state {
210 char regs[KVM_APIC_REG_SIZE];
211};
212
213struct kvm_segment {
214 __u64 base;
215 __u32 limit;
216 __u16 selector;
217 __u8 type;
218 __u8 present, dpl, db, s, l, g, avl;
219 __u8 unusable;
220 __u8 padding;
221};
222
223struct kvm_dtable {
224 __u64 base;
225 __u16 limit;
226 __u16 padding[3];
227};
228
229/* for KVM_GET_SREGS and KVM_SET_SREGS */
230struct kvm_sregs {
231 /* out (KVM_GET_SREGS) / in (KVM_SET_SREGS) */
232 struct kvm_segment cs, ds, es, fs, gs, ss;
233 struct kvm_segment tr, ldt;
234 struct kvm_dtable gdt, idt;
235 __u64 cr0, cr2, cr3, cr4, cr8;
236 __u64 efer;
237 __u64 apic_base;
238 __u64 interrupt_bitmap[(KVM_NR_INTERRUPTS + 63) / 64];
239};
240
241struct kvm_msr_entry {
242 __u32 index;
243 __u32 reserved;
244 __u64 data;
245};
246
247/* for KVM_GET_MSRS and KVM_SET_MSRS */
248struct kvm_msrs {
249 __u32 nmsrs; /* number of msrs in entries */
250 __u32 pad;
251
252 struct kvm_msr_entry entries[0];
253};
254
255/* for KVM_GET_MSR_INDEX_LIST */
256struct kvm_msr_list {
257 __u32 nmsrs; /* number of msrs in entries */
258 __u32 indices[0];
259};
260
261/* for KVM_TRANSLATE */ 145/* for KVM_TRANSLATE */
262struct kvm_translation { 146struct kvm_translation {
263 /* in */ 147 /* in */
@@ -302,28 +186,24 @@ struct kvm_dirty_log {
302 }; 186 };
303}; 187};
304 188
305struct kvm_cpuid_entry {
306 __u32 function;
307 __u32 eax;
308 __u32 ebx;
309 __u32 ecx;
310 __u32 edx;
311 __u32 padding;
312};
313
314/* for KVM_SET_CPUID */
315struct kvm_cpuid {
316 __u32 nent;
317 __u32 padding;
318 struct kvm_cpuid_entry entries[0];
319};
320
321/* for KVM_SET_SIGNAL_MASK */ 189/* for KVM_SET_SIGNAL_MASK */
322struct kvm_signal_mask { 190struct kvm_signal_mask {
323 __u32 len; 191 __u32 len;
324 __u8 sigset[0]; 192 __u8 sigset[0];
325}; 193};
326 194
195/* for KVM_TPR_ACCESS_REPORTING */
196struct kvm_tpr_access_ctl {
197 __u32 enabled;
198 __u32 flags;
199 __u32 reserved[8];
200};
201
202/* for KVM_SET_VAPIC_ADDR */
203struct kvm_vapic_addr {
204 __u64 vapic_addr;
205};
206
327#define KVMIO 0xAE 207#define KVMIO 0xAE
328 208
329/* 209/*
@@ -347,11 +227,21 @@ struct kvm_signal_mask {
347 */ 227 */
348#define KVM_CAP_IRQCHIP 0 228#define KVM_CAP_IRQCHIP 0
349#define KVM_CAP_HLT 1 229#define KVM_CAP_HLT 1
230#define KVM_CAP_MMU_SHADOW_CACHE_CONTROL 2
231#define KVM_CAP_USER_MEMORY 3
232#define KVM_CAP_SET_TSS_ADDR 4
233#define KVM_CAP_EXT_CPUID 5
234#define KVM_CAP_VAPIC 6
350 235
351/* 236/*
352 * ioctls for VM fds 237 * ioctls for VM fds
353 */ 238 */
354#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region) 239#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region)
240#define KVM_SET_NR_MMU_PAGES _IO(KVMIO, 0x44)
241#define KVM_GET_NR_MMU_PAGES _IO(KVMIO, 0x45)
242#define KVM_SET_USER_MEMORY_REGION _IOW(KVMIO, 0x46,\
243 struct kvm_userspace_memory_region)
244#define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
355/* 245/*
356 * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns 246 * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns
357 * a vcpu fd. 247 * a vcpu fd.
@@ -359,6 +249,7 @@ struct kvm_signal_mask {
359#define KVM_CREATE_VCPU _IO(KVMIO, 0x41) 249#define KVM_CREATE_VCPU _IO(KVMIO, 0x41)
360#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log) 250#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log)
361#define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias) 251#define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias)
252#define KVM_GET_SUPPORTED_CPUID _IOWR(KVMIO, 0x48, struct kvm_cpuid2)
362/* Device model IOC */ 253/* Device model IOC */
363#define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60) 254#define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60)
364#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level) 255#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level)
@@ -384,5 +275,11 @@ struct kvm_signal_mask {
384#define KVM_SET_FPU _IOW(KVMIO, 0x8d, struct kvm_fpu) 275#define KVM_SET_FPU _IOW(KVMIO, 0x8d, struct kvm_fpu)
385#define KVM_GET_LAPIC _IOR(KVMIO, 0x8e, struct kvm_lapic_state) 276#define KVM_GET_LAPIC _IOR(KVMIO, 0x8e, struct kvm_lapic_state)
386#define KVM_SET_LAPIC _IOW(KVMIO, 0x8f, struct kvm_lapic_state) 277#define KVM_SET_LAPIC _IOW(KVMIO, 0x8f, struct kvm_lapic_state)
278#define KVM_SET_CPUID2 _IOW(KVMIO, 0x90, struct kvm_cpuid2)
279#define KVM_GET_CPUID2 _IOWR(KVMIO, 0x91, struct kvm_cpuid2)
280/* Available with KVM_CAP_VAPIC */
281#define KVM_TPR_ACCESS_REPORTING _IOWR(KVMIO, 0x92, struct kvm_tpr_access_ctl)
282/* Available with KVM_CAP_VAPIC */
283#define KVM_SET_VAPIC_ADDR _IOW(KVMIO, 0x93, struct kvm_vapic_addr)
387 284
388#endif 285#endif
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
new file mode 100644
index 000000000000..ea4764b0a2f4
--- /dev/null
+++ b/include/linux/kvm_host.h
@@ -0,0 +1,299 @@
1#ifndef __KVM_HOST_H
2#define __KVM_HOST_H
3
4/*
5 * This work is licensed under the terms of the GNU GPL, version 2. See
6 * the COPYING file in the top-level directory.
7 */
8
9#include <linux/types.h>
10#include <linux/hardirq.h>
11#include <linux/list.h>
12#include <linux/mutex.h>
13#include <linux/spinlock.h>
14#include <linux/signal.h>
15#include <linux/sched.h>
16#include <linux/mm.h>
17#include <linux/preempt.h>
18#include <asm/signal.h>
19
20#include <linux/kvm.h>
21#include <linux/kvm_para.h>
22
23#include <linux/kvm_types.h>
24
25#include <asm/kvm_host.h>
26
27#define KVM_MAX_VCPUS 4
28#define KVM_MEMORY_SLOTS 8
29/* memory slots that does not exposed to userspace */
30#define KVM_PRIVATE_MEM_SLOTS 4
31
32#define KVM_PIO_PAGE_OFFSET 1
33
34/*
35 * vcpu->requests bit members
36 */
37#define KVM_REQ_TLB_FLUSH 0
38#define KVM_REQ_MIGRATE_TIMER 1
39#define KVM_REQ_REPORT_TPR_ACCESS 2
40
41struct kvm_vcpu;
42extern struct kmem_cache *kvm_vcpu_cache;
43
44struct kvm_guest_debug {
45 int enabled;
46 unsigned long bp[4];
47 int singlestep;
48};
49
50/*
51 * It would be nice to use something smarter than a linear search, TBD...
52 * Thankfully we dont expect many devices to register (famous last words :),
53 * so until then it will suffice. At least its abstracted so we can change
54 * in one place.
55 */
56struct kvm_io_bus {
57 int dev_count;
58#define NR_IOBUS_DEVS 6
59 struct kvm_io_device *devs[NR_IOBUS_DEVS];
60};
61
62void kvm_io_bus_init(struct kvm_io_bus *bus);
63void kvm_io_bus_destroy(struct kvm_io_bus *bus);
64struct kvm_io_device *kvm_io_bus_find_dev(struct kvm_io_bus *bus, gpa_t addr);
65void kvm_io_bus_register_dev(struct kvm_io_bus *bus,
66 struct kvm_io_device *dev);
67
68struct kvm_vcpu {
69 struct kvm *kvm;
70 struct preempt_notifier preempt_notifier;
71 int vcpu_id;
72 struct mutex mutex;
73 int cpu;
74 struct kvm_run *run;
75 int guest_mode;
76 unsigned long requests;
77 struct kvm_guest_debug guest_debug;
78 int fpu_active;
79 int guest_fpu_loaded;
80 wait_queue_head_t wq;
81 int sigset_active;
82 sigset_t sigset;
83 struct kvm_vcpu_stat stat;
84
85#ifdef CONFIG_HAS_IOMEM
86 int mmio_needed;
87 int mmio_read_completed;
88 int mmio_is_write;
89 int mmio_size;
90 unsigned char mmio_data[8];
91 gpa_t mmio_phys_addr;
92#endif
93
94 struct kvm_vcpu_arch arch;
95};
96
97struct kvm_memory_slot {
98 gfn_t base_gfn;
99 unsigned long npages;
100 unsigned long flags;
101 unsigned long *rmap;
102 unsigned long *dirty_bitmap;
103 unsigned long userspace_addr;
104 int user_alloc;
105};
106
107struct kvm {
108 struct mutex lock; /* protects the vcpus array and APIC accesses */
109 spinlock_t mmu_lock;
110 struct mm_struct *mm; /* userspace tied to this vm */
111 int nmemslots;
112 struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS +
113 KVM_PRIVATE_MEM_SLOTS];
114 struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
115 struct list_head vm_list;
116 struct file *filp;
117 struct kvm_io_bus mmio_bus;
118 struct kvm_io_bus pio_bus;
119 struct kvm_vm_stat stat;
120 struct kvm_arch arch;
121};
122
123/* The guest did something we don't support. */
124#define pr_unimpl(vcpu, fmt, ...) \
125 do { \
126 if (printk_ratelimit()) \
127 printk(KERN_ERR "kvm: %i: cpu%i " fmt, \
128 current->tgid, (vcpu)->vcpu_id , ## __VA_ARGS__); \
129 } while (0)
130
131#define kvm_printf(kvm, fmt ...) printk(KERN_DEBUG fmt)
132#define vcpu_printf(vcpu, fmt...) kvm_printf(vcpu->kvm, fmt)
133
134int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id);
135void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
136
137void vcpu_load(struct kvm_vcpu *vcpu);
138void vcpu_put(struct kvm_vcpu *vcpu);
139
140void decache_vcpus_on_cpu(int cpu);
141
142
143int kvm_init(void *opaque, unsigned int vcpu_size,
144 struct module *module);
145void kvm_exit(void);
146
147#define HPA_MSB ((sizeof(hpa_t) * 8) - 1)
148#define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB)
149static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; }
150struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva);
151
152extern struct page *bad_page;
153
154int is_error_page(struct page *page);
155int kvm_is_error_hva(unsigned long addr);
156int kvm_set_memory_region(struct kvm *kvm,
157 struct kvm_userspace_memory_region *mem,
158 int user_alloc);
159int __kvm_set_memory_region(struct kvm *kvm,
160 struct kvm_userspace_memory_region *mem,
161 int user_alloc);
162int kvm_arch_set_memory_region(struct kvm *kvm,
163 struct kvm_userspace_memory_region *mem,
164 struct kvm_memory_slot old,
165 int user_alloc);
166gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn);
167struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
168void kvm_release_page_clean(struct page *page);
169void kvm_release_page_dirty(struct page *page);
170int kvm_read_guest_page(struct kvm *kvm, gfn_t gfn, void *data, int offset,
171 int len);
172int kvm_read_guest_atomic(struct kvm *kvm, gpa_t gpa, void *data,
173 unsigned long len);
174int kvm_read_guest(struct kvm *kvm, gpa_t gpa, void *data, unsigned long len);
175int kvm_write_guest_page(struct kvm *kvm, gfn_t gfn, const void *data,
176 int offset, int len);
177int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data,
178 unsigned long len);
179int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len);
180int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len);
181struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn);
182int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn);
183void mark_page_dirty(struct kvm *kvm, gfn_t gfn);
184
185void kvm_vcpu_block(struct kvm_vcpu *vcpu);
186void kvm_resched(struct kvm_vcpu *vcpu);
187void kvm_load_guest_fpu(struct kvm_vcpu *vcpu);
188void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
189void kvm_flush_remote_tlbs(struct kvm *kvm);
190
191long kvm_arch_dev_ioctl(struct file *filp,
192 unsigned int ioctl, unsigned long arg);
193long kvm_arch_vcpu_ioctl(struct file *filp,
194 unsigned int ioctl, unsigned long arg);
195void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
196void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu);
197
198int kvm_dev_ioctl_check_extension(long ext);
199
200int kvm_get_dirty_log(struct kvm *kvm,
201 struct kvm_dirty_log *log, int *is_dirty);
202int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
203 struct kvm_dirty_log *log);
204
205int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
206 struct
207 kvm_userspace_memory_region *mem,
208 int user_alloc);
209long kvm_arch_vm_ioctl(struct file *filp,
210 unsigned int ioctl, unsigned long arg);
211void kvm_arch_destroy_vm(struct kvm *kvm);
212
213int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu);
214int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu);
215
216int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
217 struct kvm_translation *tr);
218
219int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs);
220int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs);
221int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
222 struct kvm_sregs *sregs);
223int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
224 struct kvm_sregs *sregs);
225int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu,
226 struct kvm_debug_guest *dbg);
227int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run);
228
229int kvm_arch_init(void *opaque);
230void kvm_arch_exit(void);
231
232int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu);
233void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu);
234
235void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu);
236void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
237void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu);
238struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id);
239int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu);
240void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu);
241
242int kvm_arch_vcpu_reset(struct kvm_vcpu *vcpu);
243void kvm_arch_hardware_enable(void *garbage);
244void kvm_arch_hardware_disable(void *garbage);
245int kvm_arch_hardware_setup(void);
246void kvm_arch_hardware_unsetup(void);
247void kvm_arch_check_processor_compat(void *rtn);
248int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
249
250void kvm_free_physmem(struct kvm *kvm);
251
252struct kvm *kvm_arch_create_vm(void);
253void kvm_arch_destroy_vm(struct kvm *kvm);
254
255int kvm_cpu_get_interrupt(struct kvm_vcpu *v);
256int kvm_cpu_has_interrupt(struct kvm_vcpu *v);
257void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
258
259static inline void kvm_guest_enter(void)
260{
261 account_system_vtime(current);
262 current->flags |= PF_VCPU;
263}
264
265static inline void kvm_guest_exit(void)
266{
267 account_system_vtime(current);
268 current->flags &= ~PF_VCPU;
269}
270
271static inline int memslot_id(struct kvm *kvm, struct kvm_memory_slot *slot)
272{
273 return slot - kvm->memslots;
274}
275
276static inline gpa_t gfn_to_gpa(gfn_t gfn)
277{
278 return (gpa_t)gfn << PAGE_SHIFT;
279}
280
281static inline void kvm_migrate_apic_timer(struct kvm_vcpu *vcpu)
282{
283 set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests);
284}
285
286enum kvm_stat_kind {
287 KVM_STAT_VM,
288 KVM_STAT_VCPU,
289};
290
291struct kvm_stats_debugfs_item {
292 const char *name;
293 int offset;
294 enum kvm_stat_kind kind;
295 struct dentry *dentry;
296};
297extern struct kvm_stats_debugfs_item debugfs_entries[];
298
299#endif
diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h
index 3b292565a693..5497aac0d2f8 100644
--- a/include/linux/kvm_para.h
+++ b/include/linux/kvm_para.h
@@ -2,72 +2,30 @@
2#define __LINUX_KVM_PARA_H 2#define __LINUX_KVM_PARA_H
3 3
4/* 4/*
5 * Guest OS interface for KVM paravirtualization 5 * This header file provides a method for making a hypercall to the host
6 * 6 * Architectures should define:
7 * Note: this interface is totally experimental, and is certain to change 7 * - kvm_hypercall0, kvm_hypercall1...
8 * as we make progress. 8 * - kvm_arch_para_features
9 * - kvm_para_available
9 */ 10 */
10 11
11/* 12/* Return values for hypercalls */
12 * Per-VCPU descriptor area shared between guest and host. Writable to 13#define KVM_ENOSYS 1000
13 * both guest and host. Registered with the host by the guest when
14 * a guest acknowledges paravirtual mode.
15 *
16 * NOTE: all addresses are guest-physical addresses (gpa), to make it
17 * easier for the hypervisor to map between the various addresses.
18 */
19struct kvm_vcpu_para_state {
20 /*
21 * API version information for compatibility. If there's any support
22 * mismatch (too old host trying to execute too new guest) then
23 * the host will deny entry into paravirtual mode. Any other
24 * combination (new host + old guest and new host + new guest)
25 * is supposed to work - new host versions will support all old
26 * guest API versions.
27 */
28 u32 guest_version;
29 u32 host_version;
30 u32 size;
31 u32 ret;
32
33 /*
34 * The address of the vm exit instruction (VMCALL or VMMCALL),
35 * which the host will patch according to the CPU model the
36 * VM runs on:
37 */
38 u64 hypercall_gpa;
39
40} __attribute__ ((aligned(PAGE_SIZE)));
41
42#define KVM_PARA_API_VERSION 1
43
44/*
45 * This is used for an RDMSR's ECX parameter to probe for a KVM host.
46 * Hopefully no CPU vendor will use up this number. This is placed well
47 * out of way of the typical space occupied by CPU vendors' MSR indices,
48 * and we think (or at least hope) it wont be occupied in the future
49 * either.
50 */
51#define MSR_KVM_API_MAGIC 0x87655678
52 14
53#define KVM_EINVAL 1 15#define KVM_HC_VAPIC_POLL_IRQ 1
54 16
55/* 17/*
56 * Hypercall calling convention: 18 * hypercalls use architecture specific
57 *
58 * Each hypercall may have 0-6 parameters.
59 *
60 * 64-bit hypercall index is in RAX, goes from 0 to __NR_hypercalls-1
61 *
62 * 64-bit parameters 1-6 are in the standard gcc x86_64 calling convention
63 * order: RDI, RSI, RDX, RCX, R8, R9.
64 *
65 * 32-bit index is EBX, parameters are: EAX, ECX, EDX, ESI, EDI, EBP.
66 * (the first 3 are according to the gcc regparm calling convention)
67 *
68 * No registers are clobbered by the hypercall, except that the
69 * return value is in RAX.
70 */ 19 */
71#define __NR_hypercalls 0 20#include <asm/kvm_para.h>
21
22#ifdef __KERNEL__
23static inline int kvm_para_has_feature(unsigned int feature)
24{
25 if (kvm_arch_para_features() & (1UL << feature))
26 return 1;
27 return 0;
28}
29#endif /* __KERNEL__ */
30#endif /* __LINUX_KVM_PARA_H */
72 31
73#endif
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h
new file mode 100644
index 000000000000..1c4e46decb22
--- /dev/null
+++ b/include/linux/kvm_types.h
@@ -0,0 +1,54 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 */
16
17#ifndef __KVM_TYPES_H__
18#define __KVM_TYPES_H__
19
20#include <asm/types.h>
21
22/*
23 * Address types:
24 *
25 * gva - guest virtual address
26 * gpa - guest physical address
27 * gfn - guest frame number
28 * hva - host virtual address
29 * hpa - host physical address
30 * hfn - host frame number
31 */
32
33typedef unsigned long gva_t;
34typedef u64 gpa_t;
35typedef unsigned long gfn_t;
36
37typedef unsigned long hva_t;
38typedef u64 hpa_t;
39typedef unsigned long hfn_t;
40
41struct kvm_pio_request {
42 unsigned long count;
43 int cur_count;
44 struct page *guest_pages[2];
45 unsigned guest_page_offset;
46 int in;
47 int port;
48 int size;
49 int string;
50 int down;
51 int rep;
52};
53
54#endif /* __KVM_TYPES_H__ */
diff --git a/include/linux/latencytop.h b/include/linux/latencytop.h
new file mode 100644
index 000000000000..901c2d6377a8
--- /dev/null
+++ b/include/linux/latencytop.h
@@ -0,0 +1,44 @@
1/*
2 * latencytop.h: Infrastructure for displaying latency
3 *
4 * (C) Copyright 2008 Intel Corporation
5 * Author: Arjan van de Ven <arjan@linux.intel.com>
6 *
7 */
8
9#ifndef _INCLUDE_GUARD_LATENCYTOP_H_
10#define _INCLUDE_GUARD_LATENCYTOP_H_
11
12#ifdef CONFIG_LATENCYTOP
13
14#define LT_SAVECOUNT 32
15#define LT_BACKTRACEDEPTH 12
16
17struct latency_record {
18 unsigned long backtrace[LT_BACKTRACEDEPTH];
19 unsigned int count;
20 unsigned long time;
21 unsigned long max;
22};
23
24
25struct task_struct;
26
27void account_scheduler_latency(struct task_struct *task, int usecs, int inter);
28
29void clear_all_latency_tracing(struct task_struct *p);
30
31#else
32
33static inline void
34account_scheduler_latency(struct task_struct *task, int usecs, int inter)
35{
36}
37
38static inline void clear_all_latency_tracing(struct task_struct *p)
39{
40}
41
42#endif
43
44#endif
diff --git a/include/linux/leds.h b/include/linux/leds.h
index dc1178f6184b..b4130ff58d0c 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -14,6 +14,7 @@
14 14
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/spinlock.h> 16#include <linux/spinlock.h>
17#include <linux/rwsem.h>
17 18
18struct device; 19struct device;
19/* 20/*
@@ -43,7 +44,7 @@ struct led_classdev {
43 44
44#ifdef CONFIG_LEDS_TRIGGERS 45#ifdef CONFIG_LEDS_TRIGGERS
45 /* Protects the trigger data below */ 46 /* Protects the trigger data below */
46 rwlock_t trigger_lock; 47 struct rw_semaphore trigger_lock;
47 48
48 struct led_trigger *trigger; 49 struct led_trigger *trigger;
49 struct list_head trig_list; 50 struct list_head trig_list;
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 6fd24e03622e..4374c4277780 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -35,6 +35,7 @@
35#include <linux/workqueue.h> 35#include <linux/workqueue.h>
36#include <scsi/scsi_host.h> 36#include <scsi/scsi_host.h>
37#include <linux/acpi.h> 37#include <linux/acpi.h>
38#include <linux/cdrom.h>
38 39
39/* 40/*
40 * Define if arch has non-standard setup. This is a _PCI_ standard 41 * Define if arch has non-standard setup. This is a _PCI_ standard
@@ -119,6 +120,8 @@ enum {
119 ATA_DEF_BUSY_WAIT = 10000, 120 ATA_DEF_BUSY_WAIT = 10000,
120 ATA_SHORT_PAUSE = (HZ >> 6) + 1, 121 ATA_SHORT_PAUSE = (HZ >> 6) + 1,
121 122
123 ATAPI_MAX_DRAIN = 16 << 10,
124
122 ATA_SHT_EMULATED = 1, 125 ATA_SHT_EMULATED = 1,
123 ATA_SHT_CMD_PER_LUN = 1, 126 ATA_SHT_CMD_PER_LUN = 1,
124 ATA_SHT_THIS_ID = -1, 127 ATA_SHT_THIS_ID = -1,
@@ -133,15 +136,19 @@ enum {
133 ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */ 136 ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */
134 ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */ 137 ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */
135 ATA_DFLAG_AN = (1 << 7), /* AN configured */ 138 ATA_DFLAG_AN = (1 << 7), /* AN configured */
139 ATA_DFLAG_HIPM = (1 << 8), /* device supports HIPM */
140 ATA_DFLAG_DIPM = (1 << 9), /* device supports DIPM */
136 ATA_DFLAG_CFG_MASK = (1 << 12) - 1, 141 ATA_DFLAG_CFG_MASK = (1 << 12) - 1,
137 142
138 ATA_DFLAG_PIO = (1 << 12), /* device limited to PIO mode */ 143 ATA_DFLAG_PIO = (1 << 12), /* device limited to PIO mode */
139 ATA_DFLAG_NCQ_OFF = (1 << 13), /* device limited to non-NCQ mode */ 144 ATA_DFLAG_NCQ_OFF = (1 << 13), /* device limited to non-NCQ mode */
140 ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */ 145 ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */
141 ATA_DFLAG_INIT_MASK = (1 << 16) - 1, 146 ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */
147 ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */
148 ATA_DFLAG_INIT_MASK = (1 << 24) - 1,
142 149
143 ATA_DFLAG_DETACH = (1 << 16), 150 ATA_DFLAG_DETACH = (1 << 24),
144 ATA_DFLAG_DETACHED = (1 << 17), 151 ATA_DFLAG_DETACHED = (1 << 25),
145 152
146 ATA_DEV_UNKNOWN = 0, /* unknown device */ 153 ATA_DEV_UNKNOWN = 0, /* unknown device */
147 ATA_DEV_ATA = 1, /* ATA device */ 154 ATA_DEV_ATA = 1, /* ATA device */
@@ -185,6 +192,7 @@ enum {
185 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */ 192 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */
186 ATA_FLAG_AN = (1 << 18), /* controller supports AN */ 193 ATA_FLAG_AN = (1 << 18), /* controller supports AN */
187 ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ 194 ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */
195 ATA_FLAG_IPM = (1 << 20), /* driver can handle IPM */
188 196
189 /* The following flag belongs to ap->pflags but is kept in 197 /* The following flag belongs to ap->pflags but is kept in
190 * ap->flags because it's referenced in many LLDs and will be 198 * ap->flags because it's referenced in many LLDs and will be
@@ -207,16 +215,15 @@ enum {
207 215
208 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */ 216 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */
209 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */ 217 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */
210 ATA_PFLAG_GTM_VALID = (1 << 19), /* acpi_gtm data valid */ 218 ATA_PFLAG_INIT_GTM_VALID = (1 << 19), /* initial gtm data valid */
211 219
212 /* struct ata_queued_cmd flags */ 220 /* struct ata_queued_cmd flags */
213 ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */ 221 ATA_QCFLAG_ACTIVE = (1 << 0), /* cmd not yet ack'd to scsi lyer */
214 ATA_QCFLAG_SG = (1 << 1), /* have s/g table? */ 222 ATA_QCFLAG_DMAMAP = (1 << 1), /* SG table is DMA mapped */
215 ATA_QCFLAG_SINGLE = (1 << 2), /* no s/g, just a single buffer */
216 ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE,
217 ATA_QCFLAG_IO = (1 << 3), /* standard IO command */ 223 ATA_QCFLAG_IO = (1 << 3), /* standard IO command */
218 ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */ 224 ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */
219 ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */ 225 ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */
226 ATA_QCFLAG_QUIET = (1 << 6), /* don't report device error */
220 227
221 ATA_QCFLAG_FAILED = (1 << 16), /* cmd failed and is owned by EH */ 228 ATA_QCFLAG_FAILED = (1 << 16), /* cmd failed and is owned by EH */
222 ATA_QCFLAG_SENSE_VALID = (1 << 17), /* sense data valid */ 229 ATA_QCFLAG_SENSE_VALID = (1 << 17), /* sense data valid */
@@ -234,6 +241,13 @@ enum {
234 ATA_TMOUT_INTERNAL = 30 * HZ, 241 ATA_TMOUT_INTERNAL = 30 * HZ,
235 ATA_TMOUT_INTERNAL_QUICK = 5 * HZ, 242 ATA_TMOUT_INTERNAL_QUICK = 5 * HZ,
236 243
244 /* FIXME: GoVault needs 2s but we can't afford that without
245 * parallel probing. 800ms is enough for iVDR disk
246 * HHD424020F7SV00. Increase to 2secs when parallel probing
247 * is in place.
248 */
249 ATA_TMOUT_FF_WAIT = 4 * HZ / 5,
250
237 /* ATA bus states */ 251 /* ATA bus states */
238 BUS_UNKNOWN = 0, 252 BUS_UNKNOWN = 0,
239 BUS_DMA = 1, 253 BUS_DMA = 1,
@@ -252,19 +266,15 @@ enum {
252 PORT_DISABLED = 2, 266 PORT_DISABLED = 2,
253 267
254 /* encoding various smaller bitmaps into a single 268 /* encoding various smaller bitmaps into a single
255 * unsigned int bitmap 269 * unsigned long bitmap
256 */ 270 */
257 ATA_BITS_PIO = 7, 271 ATA_NR_PIO_MODES = 7,
258 ATA_BITS_MWDMA = 5, 272 ATA_NR_MWDMA_MODES = 5,
259 ATA_BITS_UDMA = 8, 273 ATA_NR_UDMA_MODES = 8,
260 274
261 ATA_SHIFT_PIO = 0, 275 ATA_SHIFT_PIO = 0,
262 ATA_SHIFT_MWDMA = ATA_SHIFT_PIO + ATA_BITS_PIO, 276 ATA_SHIFT_MWDMA = ATA_SHIFT_PIO + ATA_NR_PIO_MODES,
263 ATA_SHIFT_UDMA = ATA_SHIFT_MWDMA + ATA_BITS_MWDMA, 277 ATA_SHIFT_UDMA = ATA_SHIFT_MWDMA + ATA_NR_MWDMA_MODES,
264
265 ATA_MASK_PIO = ((1 << ATA_BITS_PIO) - 1) << ATA_SHIFT_PIO,
266 ATA_MASK_MWDMA = ((1 << ATA_BITS_MWDMA) - 1) << ATA_SHIFT_MWDMA,
267 ATA_MASK_UDMA = ((1 << ATA_BITS_UDMA) - 1) << ATA_SHIFT_UDMA,
268 278
269 /* size of buffer to pad xfers ending on unaligned boundaries */ 279 /* size of buffer to pad xfers ending on unaligned boundaries */
270 ATA_DMA_PAD_SZ = 4, 280 ATA_DMA_PAD_SZ = 4,
@@ -294,6 +304,7 @@ enum {
294 ATA_EHI_RESUME_LINK = (1 << 1), /* resume link (reset modifier) */ 304 ATA_EHI_RESUME_LINK = (1 << 1), /* resume link (reset modifier) */
295 ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */ 305 ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */
296 ATA_EHI_QUIET = (1 << 3), /* be quiet */ 306 ATA_EHI_QUIET = (1 << 3), /* be quiet */
307 ATA_EHI_LPM = (1 << 4), /* link power management action */
297 308
298 ATA_EHI_DID_SOFTRESET = (1 << 16), /* already soft-reset this port */ 309 ATA_EHI_DID_SOFTRESET = (1 << 16), /* already soft-reset this port */
299 ATA_EHI_DID_HARDRESET = (1 << 17), /* already soft-reset this port */ 310 ATA_EHI_DID_HARDRESET = (1 << 17), /* already soft-reset this port */
@@ -325,12 +336,30 @@ enum {
325 ATA_HORKAGE_BROKEN_HPA = (1 << 4), /* Broken HPA */ 336 ATA_HORKAGE_BROKEN_HPA = (1 << 4), /* Broken HPA */
326 ATA_HORKAGE_SKIP_PM = (1 << 5), /* Skip PM operations */ 337 ATA_HORKAGE_SKIP_PM = (1 << 5), /* Skip PM operations */
327 ATA_HORKAGE_HPA_SIZE = (1 << 6), /* native size off by one */ 338 ATA_HORKAGE_HPA_SIZE = (1 << 6), /* native size off by one */
339 ATA_HORKAGE_IPM = (1 << 7), /* Link PM problems */
340 ATA_HORKAGE_IVB = (1 << 8), /* cbl det validity bit bugs */
341 ATA_HORKAGE_STUCK_ERR = (1 << 9), /* stuck ERR on next PACKET */
328 342
329 /* DMA mask for user DMA control: User visible values; DO NOT 343 /* DMA mask for user DMA control: User visible values; DO NOT
330 renumber */ 344 renumber */
331 ATA_DMA_MASK_ATA = (1 << 0), /* DMA on ATA Disk */ 345 ATA_DMA_MASK_ATA = (1 << 0), /* DMA on ATA Disk */
332 ATA_DMA_MASK_ATAPI = (1 << 1), /* DMA on ATAPI */ 346 ATA_DMA_MASK_ATAPI = (1 << 1), /* DMA on ATAPI */
333 ATA_DMA_MASK_CFA = (1 << 2), /* DMA on CF Card */ 347 ATA_DMA_MASK_CFA = (1 << 2), /* DMA on CF Card */
348
349 /* ATAPI command types */
350 ATAPI_READ = 0, /* READs */
351 ATAPI_WRITE = 1, /* WRITEs */
352 ATAPI_READ_CD = 2, /* READ CD [MSF] */
353 ATAPI_MISC = 3, /* the rest */
354};
355
356enum ata_xfer_mask {
357 ATA_MASK_PIO = ((1LU << ATA_NR_PIO_MODES) - 1)
358 << ATA_SHIFT_PIO,
359 ATA_MASK_MWDMA = ((1LU << ATA_NR_MWDMA_MODES) - 1)
360 << ATA_SHIFT_MWDMA,
361 ATA_MASK_UDMA = ((1LU << ATA_NR_UDMA_MODES) - 1)
362 << ATA_SHIFT_UDMA,
334}; 363};
335 364
336enum hsm_task_states { 365enum hsm_task_states {
@@ -370,6 +399,18 @@ typedef int (*ata_reset_fn_t)(struct ata_link *link, unsigned int *classes,
370 unsigned long deadline); 399 unsigned long deadline);
371typedef void (*ata_postreset_fn_t)(struct ata_link *link, unsigned int *classes); 400typedef void (*ata_postreset_fn_t)(struct ata_link *link, unsigned int *classes);
372 401
402/*
403 * host pm policy: If you alter this, you also need to alter libata-scsi.c
404 * (for the ascii descriptions)
405 */
406enum link_pm {
407 NOT_AVAILABLE,
408 MIN_POWER,
409 MAX_PERFORMANCE,
410 MEDIUM_POWER,
411};
412extern struct class_device_attribute class_device_attr_link_power_management_policy;
413
373struct ata_ioports { 414struct ata_ioports {
374 void __iomem *cmd_addr; 415 void __iomem *cmd_addr;
375 void __iomem *data_addr; 416 void __iomem *data_addr;
@@ -417,7 +458,7 @@ struct ata_queued_cmd {
417 unsigned int tag; 458 unsigned int tag;
418 unsigned int n_elem; 459 unsigned int n_elem;
419 unsigned int n_iter; 460 unsigned int n_iter;
420 unsigned int orig_n_elem; 461 unsigned int mapped_n_elem;
421 462
422 int dma_dir; 463 int dma_dir;
423 464
@@ -425,17 +466,18 @@ struct ata_queued_cmd {
425 unsigned int sect_size; 466 unsigned int sect_size;
426 467
427 unsigned int nbytes; 468 unsigned int nbytes;
469 unsigned int raw_nbytes;
428 unsigned int curbytes; 470 unsigned int curbytes;
429 471
430 struct scatterlist *cursg; 472 struct scatterlist *cursg;
431 unsigned int cursg_ofs; 473 unsigned int cursg_ofs;
432 474
475 struct scatterlist *last_sg;
476 struct scatterlist saved_last_sg;
433 struct scatterlist sgent; 477 struct scatterlist sgent;
434 struct scatterlist pad_sgent; 478 struct scatterlist extra_sg[2];
435 void *buf_virt;
436 479
437 /* DO NOT iterate over __sg manually, use ata_for_each_sg() */ 480 struct scatterlist *sg;
438 struct scatterlist *__sg;
439 481
440 unsigned int err_mask; 482 unsigned int err_mask;
441 struct ata_taskfile result_tf; 483 struct ata_taskfile result_tf;
@@ -452,7 +494,7 @@ struct ata_port_stats {
452}; 494};
453 495
454struct ata_ering_entry { 496struct ata_ering_entry {
455 int is_io; 497 unsigned int eflags;
456 unsigned int err_mask; 498 unsigned int err_mask;
457 u64 timestamp; 499 u64 timestamp;
458}; 500};
@@ -470,6 +512,7 @@ struct ata_device {
470 struct scsi_device *sdev; /* attached SCSI device */ 512 struct scsi_device *sdev; /* attached SCSI device */
471#ifdef CONFIG_ATA_ACPI 513#ifdef CONFIG_ATA_ACPI
472 acpi_handle acpi_handle; 514 acpi_handle acpi_handle;
515 union acpi_object *gtf_cache;
473#endif 516#endif
474 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */ 517 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */
475 u64 n_sectors; /* size of device, if ATA */ 518 u64 n_sectors; /* size of device, if ATA */
@@ -491,9 +534,9 @@ struct ata_device {
491 unsigned int cdb_len; 534 unsigned int cdb_len;
492 535
493 /* per-dev xfer mask */ 536 /* per-dev xfer mask */
494 unsigned int pio_mask; 537 unsigned long pio_mask;
495 unsigned int mwdma_mask; 538 unsigned long mwdma_mask;
496 unsigned int udma_mask; 539 unsigned long udma_mask;
497 540
498 /* for CHS addressing */ 541 /* for CHS addressing */
499 u16 cylinders; /* Number of cylinders */ 542 u16 cylinders; /* Number of cylinders */
@@ -529,6 +572,8 @@ struct ata_eh_context {
529 int tries[ATA_MAX_DEVICES]; 572 int tries[ATA_MAX_DEVICES];
530 unsigned int classes[ATA_MAX_DEVICES]; 573 unsigned int classes[ATA_MAX_DEVICES];
531 unsigned int did_probe_mask; 574 unsigned int did_probe_mask;
575 unsigned int saved_ncq_enabled;
576 u8 saved_xfer_mode[ATA_MAX_DEVICES];
532}; 577};
533 578
534struct ata_acpi_drive 579struct ata_acpi_drive
@@ -616,6 +661,7 @@ struct ata_port {
616 661
617 pm_message_t pm_mesg; 662 pm_message_t pm_mesg;
618 int *pm_result; 663 int *pm_result;
664 enum link_pm pm_policy;
619 665
620 struct timer_list fastdrain_timer; 666 struct timer_list fastdrain_timer;
621 unsigned long fastdrain_cnt; 667 unsigned long fastdrain_cnt;
@@ -624,7 +670,7 @@ struct ata_port {
624 670
625#ifdef CONFIG_ATA_ACPI 671#ifdef CONFIG_ATA_ACPI
626 acpi_handle acpi_handle; 672 acpi_handle acpi_handle;
627 struct ata_acpi_gtm acpi_gtm; 673 struct ata_acpi_gtm __acpi_init_gtm; /* use ata_acpi_init_gtm() */
628#endif 674#endif
629 u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */ 675 u8 sector_buf[ATA_SECT_SIZE]; /* owned by EH */
630}; 676};
@@ -654,7 +700,8 @@ struct ata_port_operations {
654 void (*bmdma_setup) (struct ata_queued_cmd *qc); 700 void (*bmdma_setup) (struct ata_queued_cmd *qc);
655 void (*bmdma_start) (struct ata_queued_cmd *qc); 701 void (*bmdma_start) (struct ata_queued_cmd *qc);
656 702
657 void (*data_xfer) (struct ata_device *, unsigned char *, unsigned int, int); 703 unsigned int (*data_xfer) (struct ata_device *dev, unsigned char *buf,
704 unsigned int buflen, int rw);
658 705
659 int (*qc_defer) (struct ata_queued_cmd *qc); 706 int (*qc_defer) (struct ata_queued_cmd *qc);
660 void (*qc_prep) (struct ata_queued_cmd *qc); 707 void (*qc_prep) (struct ata_queued_cmd *qc);
@@ -683,7 +730,8 @@ struct ata_port_operations {
683 730
684 int (*port_suspend) (struct ata_port *ap, pm_message_t mesg); 731 int (*port_suspend) (struct ata_port *ap, pm_message_t mesg);
685 int (*port_resume) (struct ata_port *ap); 732 int (*port_resume) (struct ata_port *ap);
686 733 int (*enable_pm) (struct ata_port *ap, enum link_pm policy);
734 void (*disable_pm) (struct ata_port *ap);
687 int (*port_start) (struct ata_port *ap); 735 int (*port_start) (struct ata_port *ap);
688 void (*port_stop) (struct ata_port *ap); 736 void (*port_stop) (struct ata_port *ap);
689 737
@@ -742,8 +790,6 @@ static inline int ata_port_is_dummy(struct ata_port *ap)
742 790
743extern void sata_print_link_status(struct ata_link *link); 791extern void sata_print_link_status(struct ata_link *link);
744extern void ata_port_probe(struct ata_port *); 792extern void ata_port_probe(struct ata_port *);
745extern void __sata_phy_reset(struct ata_port *ap);
746extern void sata_phy_reset(struct ata_port *ap);
747extern void ata_bus_reset(struct ata_port *ap); 793extern void ata_bus_reset(struct ata_port *ap);
748extern int sata_set_spd(struct ata_link *link); 794extern int sata_set_spd(struct ata_link *link);
749extern int sata_link_debounce(struct ata_link *link, 795extern int sata_link_debounce(struct ata_link *link,
@@ -799,9 +845,8 @@ extern void ata_host_resume(struct ata_host *host);
799extern int ata_ratelimit(void); 845extern int ata_ratelimit(void);
800extern int ata_busy_sleep(struct ata_port *ap, 846extern int ata_busy_sleep(struct ata_port *ap,
801 unsigned long timeout_pat, unsigned long timeout); 847 unsigned long timeout_pat, unsigned long timeout);
848extern void ata_wait_after_reset(struct ata_port *ap, unsigned long deadline);
802extern int ata_wait_ready(struct ata_port *ap, unsigned long deadline); 849extern int ata_wait_ready(struct ata_port *ap, unsigned long deadline);
803extern void ata_port_queue_task(struct ata_port *ap, work_func_t fn,
804 void *data, unsigned long delay);
805extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, 850extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
806 unsigned long interval_msec, 851 unsigned long interval_msec,
807 unsigned long timeout_msec); 852 unsigned long timeout_msec);
@@ -816,6 +861,16 @@ extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
816extern void ata_tf_to_fis(const struct ata_taskfile *tf, 861extern void ata_tf_to_fis(const struct ata_taskfile *tf,
817 u8 pmp, int is_cmd, u8 *fis); 862 u8 pmp, int is_cmd, u8 *fis);
818extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf); 863extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf);
864extern unsigned long ata_pack_xfermask(unsigned long pio_mask,
865 unsigned long mwdma_mask, unsigned long udma_mask);
866extern void ata_unpack_xfermask(unsigned long xfer_mask,
867 unsigned long *pio_mask, unsigned long *mwdma_mask,
868 unsigned long *udma_mask);
869extern u8 ata_xfer_mask2mode(unsigned long xfer_mask);
870extern unsigned long ata_xfer_mode2mask(u8 xfer_mode);
871extern int ata_xfer_mode2shift(unsigned long xfer_mode);
872extern const char *ata_mode_string(unsigned long xfer_mask);
873extern unsigned long ata_id_xfermask(const u16 *id);
819extern void ata_noop_dev_select(struct ata_port *ap, unsigned int device); 874extern void ata_noop_dev_select(struct ata_port *ap, unsigned int device);
820extern void ata_std_dev_select(struct ata_port *ap, unsigned int device); 875extern void ata_std_dev_select(struct ata_port *ap, unsigned int device);
821extern u8 ata_check_status(struct ata_port *ap); 876extern u8 ata_check_status(struct ata_port *ap);
@@ -824,17 +879,15 @@ extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf)
824extern int ata_port_start(struct ata_port *ap); 879extern int ata_port_start(struct ata_port *ap);
825extern int ata_sff_port_start(struct ata_port *ap); 880extern int ata_sff_port_start(struct ata_port *ap);
826extern irqreturn_t ata_interrupt(int irq, void *dev_instance); 881extern irqreturn_t ata_interrupt(int irq, void *dev_instance);
827extern void ata_data_xfer(struct ata_device *adev, unsigned char *buf, 882extern unsigned int ata_data_xfer(struct ata_device *dev,
828 unsigned int buflen, int write_data); 883 unsigned char *buf, unsigned int buflen, int rw);
829extern void ata_data_xfer_noirq(struct ata_device *adev, unsigned char *buf, 884extern unsigned int ata_data_xfer_noirq(struct ata_device *dev,
830 unsigned int buflen, int write_data); 885 unsigned char *buf, unsigned int buflen, int rw);
831extern int ata_std_qc_defer(struct ata_queued_cmd *qc); 886extern int ata_std_qc_defer(struct ata_queued_cmd *qc);
832extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc); 887extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc);
833extern void ata_qc_prep(struct ata_queued_cmd *qc); 888extern void ata_qc_prep(struct ata_queued_cmd *qc);
834extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); 889extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
835extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc); 890extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc);
836extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf,
837 unsigned int buflen);
838extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg, 891extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
839 unsigned int n_elem); 892 unsigned int n_elem);
840extern unsigned int ata_dev_classify(const struct ata_taskfile *tf); 893extern unsigned int ata_dev_classify(const struct ata_taskfile *tf);
@@ -843,7 +896,6 @@ extern void ata_id_string(const u16 *id, unsigned char *s,
843 unsigned int ofs, unsigned int len); 896 unsigned int ofs, unsigned int len);
844extern void ata_id_c_string(const u16 *id, unsigned char *s, 897extern void ata_id_c_string(const u16 *id, unsigned char *s,
845 unsigned int ofs, unsigned int len); 898 unsigned int ofs, unsigned int len);
846extern void ata_id_to_dma_mode(struct ata_device *dev, u8 unknown);
847extern void ata_bmdma_setup(struct ata_queued_cmd *qc); 899extern void ata_bmdma_setup(struct ata_queued_cmd *qc);
848extern void ata_bmdma_start(struct ata_queued_cmd *qc); 900extern void ata_bmdma_start(struct ata_queued_cmd *qc);
849extern void ata_bmdma_stop(struct ata_queued_cmd *qc); 901extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
@@ -878,6 +930,7 @@ extern u8 ata_irq_on(struct ata_port *ap);
878extern int ata_cable_40wire(struct ata_port *ap); 930extern int ata_cable_40wire(struct ata_port *ap);
879extern int ata_cable_80wire(struct ata_port *ap); 931extern int ata_cable_80wire(struct ata_port *ap);
880extern int ata_cable_sata(struct ata_port *ap); 932extern int ata_cable_sata(struct ata_port *ap);
933extern int ata_cable_ignore(struct ata_port *ap);
881extern int ata_cable_unknown(struct ata_port *ap); 934extern int ata_cable_unknown(struct ata_port *ap);
882 935
883/* 936/*
@@ -885,11 +938,13 @@ extern int ata_cable_unknown(struct ata_port *ap);
885 */ 938 */
886 939
887extern unsigned int ata_pio_need_iordy(const struct ata_device *); 940extern unsigned int ata_pio_need_iordy(const struct ata_device *);
941extern const struct ata_timing *ata_timing_find_mode(u8 xfer_mode);
888extern int ata_timing_compute(struct ata_device *, unsigned short, 942extern int ata_timing_compute(struct ata_device *, unsigned short,
889 struct ata_timing *, int, int); 943 struct ata_timing *, int, int);
890extern void ata_timing_merge(const struct ata_timing *, 944extern void ata_timing_merge(const struct ata_timing *,
891 const struct ata_timing *, struct ata_timing *, 945 const struct ata_timing *, struct ata_timing *,
892 unsigned int); 946 unsigned int);
947extern u8 ata_timing_cycle2mode(unsigned int xfer_shift, int cycle);
893 948
894enum { 949enum {
895 ATA_TIMING_SETUP = (1 << 0), 950 ATA_TIMING_SETUP = (1 << 0),
@@ -910,11 +965,46 @@ enum {
910 965
911/* libata-acpi.c */ 966/* libata-acpi.c */
912#ifdef CONFIG_ATA_ACPI 967#ifdef CONFIG_ATA_ACPI
913extern int ata_acpi_cbl_80wire(struct ata_port *ap); 968static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
914int ata_acpi_stm(const struct ata_port *ap, struct ata_acpi_gtm *stm); 969{
915int ata_acpi_gtm(const struct ata_port *ap, struct ata_acpi_gtm *stm); 970 if (ap->pflags & ATA_PFLAG_INIT_GTM_VALID)
971 return &ap->__acpi_init_gtm;
972 return NULL;
973}
974int ata_acpi_stm(struct ata_port *ap, const struct ata_acpi_gtm *stm);
975int ata_acpi_gtm(struct ata_port *ap, struct ata_acpi_gtm *stm);
976unsigned long ata_acpi_gtm_xfermask(struct ata_device *dev,
977 const struct ata_acpi_gtm *gtm);
978int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm);
916#else 979#else
917static inline int ata_acpi_cbl_80wire(struct ata_port *ap) { return 0; } 980static inline const struct ata_acpi_gtm *ata_acpi_init_gtm(struct ata_port *ap)
981{
982 return NULL;
983}
984
985static inline int ata_acpi_stm(const struct ata_port *ap,
986 struct ata_acpi_gtm *stm)
987{
988 return -ENOSYS;
989}
990
991static inline int ata_acpi_gtm(const struct ata_port *ap,
992 struct ata_acpi_gtm *stm)
993{
994 return -ENOSYS;
995}
996
997static inline unsigned int ata_acpi_gtm_xfermask(struct ata_device *dev,
998 const struct ata_acpi_gtm *gtm)
999{
1000 return 0;
1001}
1002
1003static inline int ata_acpi_cbl_80wire(struct ata_port *ap,
1004 const struct ata_acpi_gtm *gtm)
1005{
1006 return 0;
1007}
918#endif 1008#endif
919 1009
920#ifdef CONFIG_PCI 1010#ifdef CONFIG_PCI
@@ -943,8 +1033,12 @@ extern int ata_pci_init_bmdma(struct ata_host *host);
943extern int ata_pci_prepare_sff_host(struct pci_dev *pdev, 1033extern int ata_pci_prepare_sff_host(struct pci_dev *pdev,
944 const struct ata_port_info * const * ppi, 1034 const struct ata_port_info * const * ppi,
945 struct ata_host **r_host); 1035 struct ata_host **r_host);
1036extern int ata_pci_activate_sff_host(struct ata_host *host,
1037 irq_handler_t irq_handler,
1038 struct scsi_host_template *sht);
946extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits); 1039extern int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits);
947extern unsigned long ata_pci_default_filter(struct ata_device *, unsigned long); 1040extern unsigned long ata_pci_default_filter(struct ata_device *dev,
1041 unsigned long xfer_mask);
948#endif /* CONFIG_PCI */ 1042#endif /* CONFIG_PCI */
949 1043
950/* 1044/*
@@ -964,8 +1058,6 @@ extern void sata_pmp_do_eh(struct ata_port *ap,
964/* 1058/*
965 * EH 1059 * EH
966 */ 1060 */
967extern void ata_eng_timeout(struct ata_port *ap);
968
969extern void ata_port_schedule_eh(struct ata_port *ap); 1061extern void ata_port_schedule_eh(struct ata_port *ap);
970extern int ata_link_abort(struct ata_link *link); 1062extern int ata_link_abort(struct ata_link *link);
971extern int ata_port_abort(struct ata_port *ap); 1063extern int ata_port_abort(struct ata_port *ap);
@@ -986,18 +1078,18 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
986 * printk helpers 1078 * printk helpers
987 */ 1079 */
988#define ata_port_printk(ap, lv, fmt, args...) \ 1080#define ata_port_printk(ap, lv, fmt, args...) \
989 printk(lv"ata%u: "fmt, (ap)->print_id , ##args) 1081 printk("%sata%u: "fmt, lv, (ap)->print_id , ##args)
990 1082
991#define ata_link_printk(link, lv, fmt, args...) do { \ 1083#define ata_link_printk(link, lv, fmt, args...) do { \
992 if ((link)->ap->nr_pmp_links) \ 1084 if ((link)->ap->nr_pmp_links) \
993 printk(lv"ata%u.%02u: "fmt, (link)->ap->print_id, \ 1085 printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \
994 (link)->pmp , ##args); \ 1086 (link)->pmp , ##args); \
995 else \ 1087 else \
996 printk(lv"ata%u: "fmt, (link)->ap->print_id , ##args); \ 1088 printk("%sata%u: "fmt, lv, (link)->ap->print_id , ##args); \
997 } while(0) 1089 } while(0)
998 1090
999#define ata_dev_printk(dev, lv, fmt, args...) \ 1091#define ata_dev_printk(dev, lv, fmt, args...) \
1000 printk(lv"ata%u.%02u: "fmt, (dev)->link->ap->print_id, \ 1092 printk("%sata%u.%02u: "fmt, lv, (dev)->link->ap->print_id, \
1001 (dev)->link->pmp + (dev)->devno , ##args) 1093 (dev)->link->pmp + (dev)->devno , ##args)
1002 1094
1003/* 1095/*
@@ -1034,35 +1126,6 @@ extern void ata_port_pbar_desc(struct ata_port *ap, int bar, ssize_t offset,
1034 const char *name); 1126 const char *name);
1035#endif 1127#endif
1036 1128
1037/*
1038 * qc helpers
1039 */
1040static inline struct scatterlist *
1041ata_qc_first_sg(struct ata_queued_cmd *qc)
1042{
1043 qc->n_iter = 0;
1044 if (qc->n_elem)
1045 return qc->__sg;
1046 if (qc->pad_len)
1047 return &qc->pad_sgent;
1048 return NULL;
1049}
1050
1051static inline struct scatterlist *
1052ata_qc_next_sg(struct scatterlist *sg, struct ata_queued_cmd *qc)
1053{
1054 if (sg == &qc->pad_sgent)
1055 return NULL;
1056 if (++qc->n_iter < qc->n_elem)
1057 return sg_next(sg);
1058 if (qc->pad_len)
1059 return &qc->pad_sgent;
1060 return NULL;
1061}
1062
1063#define ata_for_each_sg(sg, qc) \
1064 for (sg = ata_qc_first_sg(qc); sg; sg = ata_qc_next_sg(sg, qc))
1065
1066static inline unsigned int ata_tag_valid(unsigned int tag) 1129static inline unsigned int ata_tag_valid(unsigned int tag)
1067{ 1130{
1068 return (tag < ATA_MAX_QUEUE) ? 1 : 0; 1131 return (tag < ATA_MAX_QUEUE) ? 1 : 0;
@@ -1297,15 +1360,17 @@ static inline void ata_tf_init(struct ata_device *dev, struct ata_taskfile *tf)
1297static inline void ata_qc_reinit(struct ata_queued_cmd *qc) 1360static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
1298{ 1361{
1299 qc->dma_dir = DMA_NONE; 1362 qc->dma_dir = DMA_NONE;
1300 qc->__sg = NULL; 1363 qc->sg = NULL;
1301 qc->flags = 0; 1364 qc->flags = 0;
1302 qc->cursg = NULL; 1365 qc->cursg = NULL;
1303 qc->cursg_ofs = 0; 1366 qc->cursg_ofs = 0;
1304 qc->nbytes = qc->curbytes = 0; 1367 qc->nbytes = qc->raw_nbytes = qc->curbytes = 0;
1305 qc->n_elem = 0; 1368 qc->n_elem = 0;
1369 qc->mapped_n_elem = 0;
1306 qc->n_iter = 0; 1370 qc->n_iter = 0;
1307 qc->err_mask = 0; 1371 qc->err_mask = 0;
1308 qc->pad_len = 0; 1372 qc->pad_len = 0;
1373 qc->last_sg = NULL;
1309 qc->sect_size = ATA_SECT_SIZE; 1374 qc->sect_size = ATA_SECT_SIZE;
1310 1375
1311 ata_tf_init(qc->dev, &qc->tf); 1376 ata_tf_init(qc->dev, &qc->tf);
@@ -1322,6 +1387,27 @@ static inline int ata_try_flush_cache(const struct ata_device *dev)
1322 ata_id_has_flush_ext(dev->id); 1387 ata_id_has_flush_ext(dev->id);
1323} 1388}
1324 1389
1390static inline int atapi_cmd_type(u8 opcode)
1391{
1392 switch (opcode) {
1393 case GPCMD_READ_10:
1394 case GPCMD_READ_12:
1395 return ATAPI_READ;
1396
1397 case GPCMD_WRITE_10:
1398 case GPCMD_WRITE_12:
1399 case GPCMD_WRITE_AND_VERIFY_10:
1400 return ATAPI_WRITE;
1401
1402 case GPCMD_READ_CD:
1403 case GPCMD_READ_CD_MSF:
1404 return ATAPI_READ_CD;
1405
1406 default:
1407 return ATAPI_MISC;
1408 }
1409}
1410
1325static inline unsigned int ac_err_mask(u8 status) 1411static inline unsigned int ac_err_mask(u8 status)
1326{ 1412{
1327 if (status & (ATA_BUSY | ATA_DRQ)) 1413 if (status & (ATA_BUSY | ATA_DRQ))
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index ff203dd02919..3faf599ea58e 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -13,6 +13,10 @@
13#define asmlinkage CPP_ASMLINKAGE 13#define asmlinkage CPP_ASMLINKAGE
14#endif 14#endif
15 15
16#ifndef asmregparm
17# define asmregparm
18#endif
19
16#ifndef prevent_tail_call 20#ifndef prevent_tail_call
17# define prevent_tail_call(ret) do { } while (0) 21# define prevent_tail_call(ret) do { } while (0)
18#endif 22#endif
@@ -53,6 +57,10 @@
53 .size name, .-name 57 .size name, .-name
54#endif 58#endif
55 59
60/* If symbol 'name' is treated as a subroutine (gets called, and returns)
61 * then please use ENDPROC to mark 'name' as STT_FUNC for the benefit of
62 * static analysis tools such as stack depth analyzer.
63 */
56#ifndef ENDPROC 64#ifndef ENDPROC
57#define ENDPROC(name) \ 65#define ENDPROC(name) \
58 .type name, @function; \ 66 .type name, @function; \
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h
index 6f1637c61e10..3d25bcd139d1 100644
--- a/include/linux/lockd/bind.h
+++ b/include/linux/lockd/bind.h
@@ -33,9 +33,26 @@ struct nlmsvc_binding {
33extern struct nlmsvc_binding * nlmsvc_ops; 33extern struct nlmsvc_binding * nlmsvc_ops;
34 34
35/* 35/*
36 * Similar to nfs_client_initdata, but without the NFS-specific
37 * rpc_ops field.
38 */
39struct nlmclnt_initdata {
40 const char *hostname;
41 const struct sockaddr *address;
42 size_t addrlen;
43 unsigned short protocol;
44 u32 nfs_version;
45};
46
47/*
36 * Functions exported by the lockd module 48 * Functions exported by the lockd module
37 */ 49 */
38extern int nlmclnt_proc(struct inode *, int, struct file_lock *); 50
51extern struct nlm_host *nlmclnt_init(const struct nlmclnt_initdata *nlm_init);
52extern void nlmclnt_done(struct nlm_host *host);
53
54extern int nlmclnt_proc(struct nlm_host *host, int cmd,
55 struct file_lock *fl);
39extern int lockd_up(int proto); 56extern int lockd_up(int proto);
40extern void lockd_down(void); 57extern void lockd_down(void);
41 58
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index e2d1ce36b367..4babb2a129ac 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -173,14 +173,17 @@ void nlmclnt_next_cookie(struct nlm_cookie *);
173/* 173/*
174 * Host cache 174 * Host cache
175 */ 175 */
176struct nlm_host * nlmclnt_lookup_host(const struct sockaddr_in *, int, int, const char *, int); 176struct nlm_host *nlmclnt_lookup_host(const struct sockaddr_in *, int, int,
177struct nlm_host * nlmsvc_lookup_host(struct svc_rqst *, const char *, int); 177 const char *, unsigned int);
178struct nlm_host *nlmsvc_lookup_host(struct svc_rqst *, const char *,
179 unsigned int);
178struct rpc_clnt * nlm_bind_host(struct nlm_host *); 180struct rpc_clnt * nlm_bind_host(struct nlm_host *);
179void nlm_rebind_host(struct nlm_host *); 181void nlm_rebind_host(struct nlm_host *);
180struct nlm_host * nlm_get_host(struct nlm_host *); 182struct nlm_host * nlm_get_host(struct nlm_host *);
181void nlm_release_host(struct nlm_host *); 183void nlm_release_host(struct nlm_host *);
182void nlm_shutdown_hosts(void); 184void nlm_shutdown_hosts(void);
183extern void nlm_host_rebooted(const struct sockaddr_in *, const char *, int, u32); 185extern void nlm_host_rebooted(const struct sockaddr_in *, const char *,
186 unsigned int, u32);
184void nsm_release(struct nsm_handle *); 187void nsm_release(struct nsm_handle *);
185 188
186 189
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index 83a1f9f6237b..df18fa053bcd 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -29,7 +29,7 @@ struct svc_rqst;
29/* Lock info passed via NLM */ 29/* Lock info passed via NLM */
30struct nlm_lock { 30struct nlm_lock {
31 char * caller; 31 char * caller;
32 int len; /* length of "caller" */ 32 unsigned int len; /* length of "caller" */
33 struct nfs_fh fh; 33 struct nfs_fh fh;
34 struct xdr_netobj oh; 34 struct xdr_netobj oh;
35 u32 svid; 35 u32 svid;
@@ -78,7 +78,7 @@ struct nlm_res {
78 */ 78 */
79struct nlm_reboot { 79struct nlm_reboot {
80 char * mon; 80 char * mon;
81 int len; 81 unsigned int len;
82 u32 state; 82 u32 state;
83 __be32 addr; 83 __be32 addr;
84 __be32 vers; 84 __be32 vers;
diff --git a/include/linux/m41t00.h b/include/linux/m41t00.h
deleted file mode 100644
index b423360ca38e..000000000000
--- a/include/linux/m41t00.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * Definitions for the ST M41T00 family of i2c rtc chips.
3 *
4 * Author: Mark A. Greer <mgreer@mvista.com>
5 *
6 * 2005, 2006 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#ifndef _M41T00_H
13#define _M41T00_H
14
15#define M41T00_DRV_NAME "m41t00"
16#define M41T00_I2C_ADDR 0x68
17
18#define M41T00_TYPE_M41T00 0
19#define M41T00_TYPE_M41T81 81
20#define M41T00_TYPE_M41T85 85
21
22struct m41t00_platform_data {
23 u8 type;
24 u8 i2c_addr;
25 u8 sqw_freq;
26};
27
28/* SQW output disabled, this is default value by power on */
29#define M41T00_SQW_DISABLE (0)
30
31#define M41T00_SQW_32KHZ (1<<4) /* 32.768 KHz */
32#define M41T00_SQW_8KHZ (2<<4) /* 8.192 KHz */
33#define M41T00_SQW_4KHZ (3<<4) /* 4.096 KHz */
34#define M41T00_SQW_2KHZ (4<<4) /* 2.048 KHz */
35#define M41T00_SQW_1KHZ (5<<4) /* 1.024 KHz */
36#define M41T00_SQW_512HZ (6<<4) /* 512 Hz */
37#define M41T00_SQW_256HZ (7<<4) /* 256 Hz */
38#define M41T00_SQW_128HZ (8<<4) /* 128 Hz */
39#define M41T00_SQW_64HZ (9<<4) /* 64 Hz */
40#define M41T00_SQW_32HZ (10<<4) /* 32 Hz */
41#define M41T00_SQW_16HZ (11<<4) /* 16 Hz */
42#define M41T00_SQW_8HZ (12<<4) /* 8 Hz */
43#define M41T00_SQW_4HZ (13<<4) /* 4 Hz */
44#define M41T00_SQW_2HZ (14<<4) /* 2 Hz */
45#define M41T00_SQW_1HZ (15<<4) /* 1 Hz */
46
47extern ulong m41t00_get_rtc_time(void);
48extern int m41t00_set_rtc_time(ulong nowtime);
49
50#endif /* _M41T00_H */
diff --git a/include/linux/mc146818rtc.h b/include/linux/mc146818rtc.h
index 580b3f4956ee..2f4e957af656 100644
--- a/include/linux/mc146818rtc.h
+++ b/include/linux/mc146818rtc.h
@@ -109,8 +109,11 @@ struct cmos_rtc_board_info {
109#ifndef ARCH_RTC_LOCATION /* Override by <asm/mc146818rtc.h>? */ 109#ifndef ARCH_RTC_LOCATION /* Override by <asm/mc146818rtc.h>? */
110 110
111#define RTC_IO_EXTENT 0x8 111#define RTC_IO_EXTENT 0x8
112#define RTC_IO_EXTENT_USED 0x2
112#define RTC_IOMAPPED 1 /* Default to I/O mapping. */ 113#define RTC_IOMAPPED 1 /* Default to I/O mapping. */
113 114
115#else
116#define RTC_IO_EXTENT_USED RTC_IO_EXTENT
114#endif /* ARCH_RTC_LOCATION */ 117#endif /* ARCH_RTC_LOCATION */
115 118
116#endif /* _MC146818RTC_H */ 119#endif /* _MC146818RTC_H */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 520238cbae5d..1bba6789a50a 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -33,6 +33,8 @@ extern int sysctl_legacy_va_layout;
33#define sysctl_legacy_va_layout 0 33#define sysctl_legacy_va_layout 0
34#endif 34#endif
35 35
36extern unsigned long mmap_min_addr;
37
36#include <asm/page.h> 38#include <asm/page.h>
37#include <asm/pgtable.h> 39#include <asm/pgtable.h>
38#include <asm/processor.h> 40#include <asm/processor.h>
@@ -513,6 +515,21 @@ static inline void set_page_links(struct page *page, enum zone_type zone,
513} 515}
514 516
515/* 517/*
518 * If a hint addr is less than mmap_min_addr change hint to be as
519 * low as possible but still greater than mmap_min_addr
520 */
521static inline unsigned long round_hint_to_min(unsigned long hint)
522{
523#ifdef CONFIG_SECURITY
524 hint &= PAGE_MASK;
525 if (((void *)hint != NULL) &&
526 (hint < mmap_min_addr))
527 return PAGE_ALIGN(mmap_min_addr);
528#endif
529 return hint;
530}
531
532/*
516 * Some inline functions in vmstat.h depend on page_zone() 533 * Some inline functions in vmstat.h depend on page_zone()
517 */ 534 */
518#include <linux/vmstat.h> 535#include <linux/vmstat.h>
@@ -1101,9 +1118,21 @@ static inline void vm_stat_account(struct mm_struct *mm,
1101} 1118}
1102#endif /* CONFIG_PROC_FS */ 1119#endif /* CONFIG_PROC_FS */
1103 1120
1104#ifndef CONFIG_DEBUG_PAGEALLOC 1121#ifdef CONFIG_DEBUG_PAGEALLOC
1122extern int debug_pagealloc_enabled;
1123
1124extern void kernel_map_pages(struct page *page, int numpages, int enable);
1125
1126static inline void enable_debug_pagealloc(void)
1127{
1128 debug_pagealloc_enabled = 1;
1129}
1130#else
1105static inline void 1131static inline void
1106kernel_map_pages(struct page *page, int numpages, int enable) {} 1132kernel_map_pages(struct page *page, int numpages, int enable) {}
1133static inline void enable_debug_pagealloc(void)
1134{
1135}
1107#endif 1136#endif
1108 1137
1109extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk); 1138extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk);
@@ -1129,6 +1158,7 @@ extern int randomize_va_space;
1129#endif 1158#endif
1130 1159
1131const char * arch_vma_name(struct vm_area_struct *vma); 1160const char * arch_vma_name(struct vm_area_struct *vma);
1161void print_vma_addr(char *prefix, unsigned long rip);
1132 1162
1133struct page *sparse_mem_map_populate(unsigned long pnum, int nid); 1163struct page *sparse_mem_map_populate(unsigned long pnum, int nid);
1134pgd_t *vmemmap_pgd_populate(unsigned long addr, int node); 1164pgd_t *vmemmap_pgd_populate(unsigned long addr, int node);
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 125eee1407ff..7ab962fa1d73 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -118,10 +118,6 @@ struct mmc_host {
118 unsigned int removed:1; /* host is being removed */ 118 unsigned int removed:1; /* host is being removed */
119#endif 119#endif
120 120
121 unsigned int mode; /* current card mode of host */
122#define MMC_MODE_MMC 0
123#define MMC_MODE_SD 1
124
125 struct mmc_card *card; /* device attached to this host */ 121 struct mmc_card *card; /* device attached to this host */
126 122
127 wait_queue_head_t wq; 123 wait_queue_head_t wq;
diff --git a/include/linux/module.h b/include/linux/module.h
index 2cbc0b87e329..ac481e2094fd 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -178,7 +178,7 @@ void *__symbol_get_gpl(const char *symbol);
178#define __CRC_SYMBOL(sym, sec) \ 178#define __CRC_SYMBOL(sym, sec) \
179 extern void *__crc_##sym __attribute__((weak)); \ 179 extern void *__crc_##sym __attribute__((weak)); \
180 static const unsigned long __kcrctab_##sym \ 180 static const unsigned long __kcrctab_##sym \
181 __attribute_used__ \ 181 __used \
182 __attribute__((section("__kcrctab" sec), unused)) \ 182 __attribute__((section("__kcrctab" sec), unused)) \
183 = (unsigned long) &__crc_##sym; 183 = (unsigned long) &__crc_##sym;
184#else 184#else
@@ -193,7 +193,7 @@ void *__symbol_get_gpl(const char *symbol);
193 __attribute__((section("__ksymtab_strings"))) \ 193 __attribute__((section("__ksymtab_strings"))) \
194 = MODULE_SYMBOL_PREFIX #sym; \ 194 = MODULE_SYMBOL_PREFIX #sym; \
195 static const struct kernel_symbol __ksymtab_##sym \ 195 static const struct kernel_symbol __ksymtab_##sym \
196 __attribute_used__ \ 196 __used \
197 __attribute__((section("__ksymtab" sec), unused)) \ 197 __attribute__((section("__ksymtab" sec), unused)) \
198 = { (unsigned long)&sym, __kstrtab_##sym } 198 = { (unsigned long)&sym, __kstrtab_##sym }
199 199
@@ -446,11 +446,14 @@ static inline void __module_get(struct module *module)
446 __mod ? __mod->name : "kernel"; \ 446 __mod ? __mod->name : "kernel"; \
447}) 447})
448 448
449/* For kallsyms to ask for address resolution. NULL means not found. */ 449/* For kallsyms to ask for address resolution. namebuf should be at
450const char *module_address_lookup(unsigned long addr, 450 * least KSYM_NAME_LEN long: a pointer to namebuf is returned if
451 unsigned long *symbolsize, 451 * found, otherwise NULL. */
452 unsigned long *offset, 452char *module_address_lookup(unsigned long addr,
453 char **modname); 453 unsigned long *symbolsize,
454 unsigned long *offset,
455 char **modname,
456 char *namebuf);
454int lookup_module_symbol_name(unsigned long addr, char *symname); 457int lookup_module_symbol_name(unsigned long addr, char *symname);
455int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name); 458int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name);
456 459
@@ -516,10 +519,11 @@ static inline void module_put(struct module *module)
516#define module_name(mod) "kernel" 519#define module_name(mod) "kernel"
517 520
518/* For kallsyms to ask for address resolution. NULL means not found. */ 521/* For kallsyms to ask for address resolution. NULL means not found. */
519static inline const char *module_address_lookup(unsigned long addr, 522static inline char *module_address_lookup(unsigned long addr,
520 unsigned long *symbolsize, 523 unsigned long *symbolsize,
521 unsigned long *offset, 524 unsigned long *offset,
522 char **modname) 525 char **modname,
526 char *namebuf)
523{ 527{
524 return NULL; 528 return NULL;
525} 529}
@@ -574,7 +578,9 @@ struct device_driver;
574#ifdef CONFIG_SYSFS 578#ifdef CONFIG_SYSFS
575struct module; 579struct module;
576 580
577extern struct kset module_subsys; 581extern struct kset *module_kset;
582extern struct kobj_type module_ktype;
583extern int module_sysfs_initialized;
578 584
579int mod_sysfs_init(struct module *mod); 585int mod_sysfs_init(struct module *mod);
580int mod_sysfs_setup(struct module *mod, 586int mod_sysfs_setup(struct module *mod,
@@ -607,21 +613,6 @@ static inline void module_remove_modinfo_attrs(struct module *mod)
607 613
608#endif /* CONFIG_SYSFS */ 614#endif /* CONFIG_SYSFS */
609 615
610#if defined(CONFIG_SYSFS) && defined(CONFIG_MODULES)
611
612void module_add_driver(struct module *mod, struct device_driver *drv);
613void module_remove_driver(struct device_driver *drv);
614
615#else /* not both CONFIG_SYSFS && CONFIG_MODULES */
616
617static inline void module_add_driver(struct module *mod, struct device_driver *drv)
618{ }
619
620static inline void module_remove_driver(struct device_driver *drv)
621{ }
622
623#endif
624
625#define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x) 616#define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x)
626 617
627/* BELOW HERE ALL THESE ARE OBSOLETE AND WILL VANISH */ 618/* BELOW HERE ALL THESE ARE OBSOLETE AND WILL VANISH */
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 13410b20600f..8126e55c5bdc 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -18,7 +18,7 @@
18#define __module_cat(a,b) ___module_cat(a,b) 18#define __module_cat(a,b) ___module_cat(a,b)
19#define __MODULE_INFO(tag, name, info) \ 19#define __MODULE_INFO(tag, name, info) \
20static const char __module_cat(name,__LINE__)[] \ 20static const char __module_cat(name,__LINE__)[] \
21 __attribute_used__ \ 21 __used \
22 __attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info 22 __attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info
23#else /* !MODULE */ 23#else /* !MODULE */
24#define __MODULE_INFO(tag, name, info) 24#define __MODULE_INFO(tag, name, info)
@@ -72,7 +72,7 @@ struct kparam_array
72 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \ 72 BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)); \
73 static const char __param_str_##name[] = prefix #name; \ 73 static const char __param_str_##name[] = prefix #name; \
74 static struct kernel_param const __param_##name \ 74 static struct kernel_param const __param_##name \
75 __attribute_used__ \ 75 __used \
76 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ 76 __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
77 = { __param_str_##name, perm, set, get, { arg } } 77 = { __param_str_##name, perm, set, get, { arg } }
78 78
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index 7da2cee8e132..35a8277ec1bd 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -128,6 +128,18 @@ struct igmpmsg
128#ifdef __KERNEL__ 128#ifdef __KERNEL__
129#include <net/sock.h> 129#include <net/sock.h>
130 130
131#ifdef CONFIG_IP_MROUTE
132static inline int ip_mroute_opt(int opt)
133{
134 return (opt >= MRT_BASE) && (opt <= MRT_BASE + 10);
135}
136#else
137static inline int ip_mroute_opt(int opt)
138{
139 return 0;
140}
141#endif
142
131extern int ip_mroute_setsockopt(struct sock *, int, char __user *, int); 143extern int ip_mroute_setsockopt(struct sock *, int, char __user *, int);
132extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *); 144extern int ip_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
133extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg); 145extern int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg);
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 601479772b98..05c590352dd7 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -125,15 +125,20 @@ static inline int fastcall mutex_is_locked(struct mutex *lock)
125extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass); 125extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass);
126extern int __must_check mutex_lock_interruptible_nested(struct mutex *lock, 126extern int __must_check mutex_lock_interruptible_nested(struct mutex *lock,
127 unsigned int subclass); 127 unsigned int subclass);
128extern int __must_check mutex_lock_killable_nested(struct mutex *lock,
129 unsigned int subclass);
128 130
129#define mutex_lock(lock) mutex_lock_nested(lock, 0) 131#define mutex_lock(lock) mutex_lock_nested(lock, 0)
130#define mutex_lock_interruptible(lock) mutex_lock_interruptible_nested(lock, 0) 132#define mutex_lock_interruptible(lock) mutex_lock_interruptible_nested(lock, 0)
133#define mutex_lock_killable(lock) mutex_lock_killable_nested(lock, 0)
131#else 134#else
132extern void fastcall mutex_lock(struct mutex *lock); 135extern void fastcall mutex_lock(struct mutex *lock);
133extern int __must_check fastcall mutex_lock_interruptible(struct mutex *lock); 136extern int __must_check fastcall mutex_lock_interruptible(struct mutex *lock);
137extern int __must_check fastcall mutex_lock_killable(struct mutex *lock);
134 138
135# define mutex_lock_nested(lock, subclass) mutex_lock(lock) 139# define mutex_lock_nested(lock, subclass) mutex_lock(lock)
136# define mutex_lock_interruptible_nested(lock, subclass) mutex_lock_interruptible(lock) 140# define mutex_lock_interruptible_nested(lock, subclass) mutex_lock_interruptible(lock)
141# define mutex_lock_killable_nested(lock, subclass) mutex_lock_killable(lock)
137#endif 142#endif
138 143
139/* 144/*
diff --git a/include/linux/mv643xx.h b/include/linux/mv643xx.h
index d2ae6185f03b..69327b7b4ce4 100644
--- a/include/linux/mv643xx.h
+++ b/include/linux/mv643xx.h
@@ -15,6 +15,7 @@
15 15
16#include <asm/types.h> 16#include <asm/types.h>
17#include <linux/mv643xx_eth.h> 17#include <linux/mv643xx_eth.h>
18#include <linux/mv643xx_i2c.h>
18 19
19/****************************************/ 20/****************************************/
20/* Processor Address Space */ 21/* Processor Address Space */
@@ -863,7 +864,6 @@
863/* I2C Registers */ 864/* I2C Registers */
864/****************************************/ 865/****************************************/
865 866
866#define MV64XXX_I2C_CTLR_NAME "mv64xxx_i2c"
867#define MV64XXX_I2C_OFFSET 0xc000 867#define MV64XXX_I2C_OFFSET 0xc000
868#define MV64XXX_I2C_REG_BLOCK_SIZE 0x0020 868#define MV64XXX_I2C_REG_BLOCK_SIZE 0x0020
869 869
@@ -968,14 +968,6 @@ struct mpsc_pdata {
968 u32 brg_clk_freq; 968 u32 brg_clk_freq;
969}; 969};
970 970
971/* i2c Platform Device, Driver Data */
972struct mv64xxx_i2c_pdata {
973 u32 freq_m;
974 u32 freq_n;
975 u32 timeout; /* In milliseconds */
976 u32 retries;
977};
978
979/* Watchdog Platform Device, Driver Data */ 971/* Watchdog Platform Device, Driver Data */
980#define MV64x60_WDT_NAME "mv64x60_wdt" 972#define MV64x60_WDT_NAME "mv64x60_wdt"
981 973
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index 8df230a279a0..30e11aa3c1c9 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -8,9 +8,9 @@
8#define MV643XX_ETH_NAME "mv643xx_eth" 8#define MV643XX_ETH_NAME "mv643xx_eth"
9#define MV643XX_ETH_SHARED_REGS 0x2000 9#define MV643XX_ETH_SHARED_REGS 0x2000
10#define MV643XX_ETH_SHARED_REGS_SIZE 0x2000 10#define MV643XX_ETH_SHARED_REGS_SIZE 0x2000
11#define MV643XX_ETH_BAR_4 0x220 11#define MV643XX_ETH_BAR_4 0x2220
12#define MV643XX_ETH_SIZE_REG_4 0x224 12#define MV643XX_ETH_SIZE_REG_4 0x2224
13#define MV643XX_ETH_BASE_ADDR_ENABLE_REG 0x0290 13#define MV643XX_ETH_BASE_ADDR_ENABLE_REG 0x2290
14 14
15struct mv643xx_eth_platform_data { 15struct mv643xx_eth_platform_data {
16 int port_number; 16 int port_number;
diff --git a/include/linux/mv643xx_i2c.h b/include/linux/mv643xx_i2c.h
new file mode 100644
index 000000000000..5db5152e9de5
--- /dev/null
+++ b/include/linux/mv643xx_i2c.h
@@ -0,0 +1,22 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version.
6 */
7
8#ifndef _MV64XXX_I2C_H_
9#define _MV64XXX_I2C_H_
10
11#include <linux/types.h>
12
13#define MV64XXX_I2C_CTLR_NAME "mv64xxx_i2c"
14
15/* i2c Platform Device, Driver Data */
16struct mv64xxx_i2c_pdata {
17 u32 freq_m;
18 u32 freq_n;
19 u32 timeout; /* In milliseconds */
20};
21
22#endif /*_MV64XXX_I2C_H_*/
diff --git a/include/linux/net.h b/include/linux/net.h
index dd79cdb8c4cf..c414d90e647b 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -22,6 +22,7 @@
22#include <asm/socket.h> 22#include <asm/socket.h>
23 23
24struct poll_table_struct; 24struct poll_table_struct;
25struct pipe_inode_info;
25struct inode; 26struct inode;
26struct net; 27struct net;
27 28
@@ -95,6 +96,12 @@ enum sock_type {
95 96
96#endif /* ARCH_HAS_SOCKET_TYPES */ 97#endif /* ARCH_HAS_SOCKET_TYPES */
97 98
99enum sock_shutdown_cmd {
100 SHUT_RD = 0,
101 SHUT_WR = 1,
102 SHUT_RDWR = 2,
103};
104
98/** 105/**
99 * struct socket - general BSD socket 106 * struct socket - general BSD socket
100 * @state: socket state (%SS_CONNECTED, etc) 107 * @state: socket state (%SS_CONNECTED, etc)
@@ -166,6 +173,8 @@ struct proto_ops {
166 struct vm_area_struct * vma); 173 struct vm_area_struct * vma);
167 ssize_t (*sendpage) (struct socket *sock, struct page *page, 174 ssize_t (*sendpage) (struct socket *sock, struct page *page,
168 int offset, size_t size, int flags); 175 int offset, size_t size, int flags);
176 ssize_t (*splice_read)(struct socket *sock, loff_t *ppos,
177 struct pipe_inode_info *pipe, size_t len, unsigned int flags);
169}; 178};
170 179
171struct net_proto_family { 180struct net_proto_family {
@@ -177,6 +186,13 @@ struct net_proto_family {
177struct iovec; 186struct iovec;
178struct kvec; 187struct kvec;
179 188
189enum {
190 SOCK_WAKE_IO,
191 SOCK_WAKE_WAITD,
192 SOCK_WAKE_SPACE,
193 SOCK_WAKE_URG,
194};
195
180extern int sock_wake_async(struct socket *sk, int how, int band); 196extern int sock_wake_async(struct socket *sk, int how, int band);
181extern int sock_register(const struct net_proto_family *fam); 197extern int sock_register(const struct net_proto_family *fam);
182extern void sock_unregister(int family); 198extern void sock_unregister(int family);
@@ -223,6 +239,8 @@ extern int kernel_setsockopt(struct socket *sock, int level, int optname,
223extern int kernel_sendpage(struct socket *sock, struct page *page, int offset, 239extern int kernel_sendpage(struct socket *sock, struct page *page, int offset,
224 size_t size, int flags); 240 size_t size, int flags);
225extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg); 241extern int kernel_sock_ioctl(struct socket *sock, int cmd, unsigned long arg);
242extern int kernel_sock_shutdown(struct socket *sock,
243 enum sock_shutdown_cmd how);
226 244
227#ifndef CONFIG_SMP 245#ifndef CONFIG_SMP
228#define SOCKOPS_WRAPPED(name) name 246#define SOCKOPS_WRAPPED(name) name
@@ -319,7 +337,6 @@ static const struct proto_ops name##_ops = { \
319 337
320#ifdef CONFIG_SYSCTL 338#ifdef CONFIG_SYSCTL
321#include <linux/sysctl.h> 339#include <linux/sysctl.h>
322extern ctl_table net_table[];
323extern int net_msg_cost; 340extern int net_msg_cost;
324extern int net_msg_burst; 341extern int net_msg_burst;
325#endif 342#endif
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9b0c8f12373e..047d432bde55 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -319,21 +319,29 @@ struct napi_struct {
319enum 319enum
320{ 320{
321 NAPI_STATE_SCHED, /* Poll is scheduled */ 321 NAPI_STATE_SCHED, /* Poll is scheduled */
322 NAPI_STATE_DISABLE, /* Disable pending */
322}; 323};
323 324
324extern void FASTCALL(__napi_schedule(struct napi_struct *n)); 325extern void FASTCALL(__napi_schedule(struct napi_struct *n));
325 326
327static inline int napi_disable_pending(struct napi_struct *n)
328{
329 return test_bit(NAPI_STATE_DISABLE, &n->state);
330}
331
326/** 332/**
327 * napi_schedule_prep - check if napi can be scheduled 333 * napi_schedule_prep - check if napi can be scheduled
328 * @n: napi context 334 * @n: napi context
329 * 335 *
330 * Test if NAPI routine is already running, and if not mark 336 * Test if NAPI routine is already running, and if not mark
331 * it as running. This is used as a condition variable 337 * it as running. This is used as a condition variable
332 * insure only one NAPI poll instance runs 338 * insure only one NAPI poll instance runs. We also make
339 * sure there is no pending NAPI disable.
333 */ 340 */
334static inline int napi_schedule_prep(struct napi_struct *n) 341static inline int napi_schedule_prep(struct napi_struct *n)
335{ 342{
336 return !test_and_set_bit(NAPI_STATE_SCHED, &n->state); 343 return !napi_disable_pending(n) &&
344 !test_and_set_bit(NAPI_STATE_SCHED, &n->state);
337} 345}
338 346
339/** 347/**
@@ -389,8 +397,10 @@ static inline void napi_complete(struct napi_struct *n)
389 */ 397 */
390static inline void napi_disable(struct napi_struct *n) 398static inline void napi_disable(struct napi_struct *n)
391{ 399{
400 set_bit(NAPI_STATE_DISABLE, &n->state);
392 while (test_and_set_bit(NAPI_STATE_SCHED, &n->state)) 401 while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
393 msleep(1); 402 msleep(1);
403 clear_bit(NAPI_STATE_DISABLE, &n->state);
394} 404}
395 405
396/** 406/**
@@ -739,6 +749,16 @@ static inline void *netdev_priv(const struct net_device *dev)
739 */ 749 */
740#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev)) 750#define SET_NETDEV_DEV(net, pdev) ((net)->dev.parent = (pdev))
741 751
752/**
753 * netif_napi_add - initialize a napi context
754 * @dev: network device
755 * @napi: napi context
756 * @poll: polling function
757 * @weight: default weight
758 *
759 * netif_napi_add() must be used to initialize a napi context prior to calling
760 * *any* of the other napi related functions.
761 */
742static inline void netif_napi_add(struct net_device *dev, 762static inline void netif_napi_add(struct net_device *dev,
743 struct napi_struct *napi, 763 struct napi_struct *napi,
744 int (*poll)(struct napi_struct *, int), 764 int (*poll)(struct napi_struct *, int),
@@ -1258,7 +1278,7 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
1258static inline int netif_rx_schedule_prep(struct net_device *dev, 1278static inline int netif_rx_schedule_prep(struct net_device *dev,
1259 struct napi_struct *napi) 1279 struct napi_struct *napi)
1260{ 1280{
1261 return netif_running(dev) && napi_schedule_prep(napi); 1281 return napi_schedule_prep(napi);
1262} 1282}
1263 1283
1264/* Add interface to tail of rx poll list. This assumes that _prep has 1284/* Add interface to tail of rx poll list. This assumes that _prep has
@@ -1267,7 +1287,6 @@ static inline int netif_rx_schedule_prep(struct net_device *dev,
1267static inline void __netif_rx_schedule(struct net_device *dev, 1287static inline void __netif_rx_schedule(struct net_device *dev,
1268 struct napi_struct *napi) 1288 struct napi_struct *napi)
1269{ 1289{
1270 dev_hold(dev);
1271 __napi_schedule(napi); 1290 __napi_schedule(napi);
1272} 1291}
1273 1292
@@ -1298,7 +1317,6 @@ static inline void __netif_rx_complete(struct net_device *dev,
1298 struct napi_struct *napi) 1317 struct napi_struct *napi)
1299{ 1318{
1300 __napi_complete(napi); 1319 __napi_complete(napi);
1301 dev_put(dev);
1302} 1320}
1303 1321
1304/* Remove interface from poll list: it must be in the poll list 1322/* Remove interface from poll list: it must be in the poll list
@@ -1396,12 +1414,16 @@ extern void dev_set_rx_mode(struct net_device *dev);
1396extern void __dev_set_rx_mode(struct net_device *dev); 1414extern void __dev_set_rx_mode(struct net_device *dev);
1397extern int dev_unicast_delete(struct net_device *dev, void *addr, int alen); 1415extern int dev_unicast_delete(struct net_device *dev, void *addr, int alen);
1398extern int dev_unicast_add(struct net_device *dev, void *addr, int alen); 1416extern int dev_unicast_add(struct net_device *dev, void *addr, int alen);
1417extern int dev_unicast_sync(struct net_device *to, struct net_device *from);
1418extern void dev_unicast_unsync(struct net_device *to, struct net_device *from);
1399extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all); 1419extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all);
1400extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly); 1420extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly);
1401extern int dev_mc_sync(struct net_device *to, struct net_device *from); 1421extern int dev_mc_sync(struct net_device *to, struct net_device *from);
1402extern void dev_mc_unsync(struct net_device *to, struct net_device *from); 1422extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
1403extern int __dev_addr_delete(struct dev_addr_list **list, int *count, void *addr, int alen, int all); 1423extern int __dev_addr_delete(struct dev_addr_list **list, int *count, void *addr, int alen, int all);
1404extern int __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly); 1424extern int __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly);
1425extern int __dev_addr_sync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
1426extern void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
1405extern void dev_set_promiscuity(struct net_device *dev, int inc); 1427extern void dev_set_promiscuity(struct net_device *dev, int inc);
1406extern void dev_set_allmulti(struct net_device *dev, int inc); 1428extern void dev_set_allmulti(struct net_device *dev, int inc);
1407extern void netdev_state_change(struct net_device *dev); 1429extern void netdev_state_change(struct net_device *dev);
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 16adac688af5..d74e79bacd2d 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -7,6 +7,8 @@
7#include <linux/skbuff.h> 7#include <linux/skbuff.h>
8#include <linux/net.h> 8#include <linux/net.h>
9#include <linux/if.h> 9#include <linux/if.h>
10#include <linux/in.h>
11#include <linux/in6.h>
10#include <linux/wait.h> 12#include <linux/wait.h>
11#include <linux/list.h> 13#include <linux/list.h>
12#endif 14#endif
@@ -39,6 +41,23 @@
39#define NFC_ALTERED 0x8000 41#define NFC_ALTERED 0x8000
40#endif 42#endif
41 43
44enum nf_inet_hooks {
45 NF_INET_PRE_ROUTING,
46 NF_INET_LOCAL_IN,
47 NF_INET_FORWARD,
48 NF_INET_LOCAL_OUT,
49 NF_INET_POST_ROUTING,
50 NF_INET_NUMHOOKS
51};
52
53union nf_inet_addr {
54 u_int32_t all[4];
55 __be32 ip;
56 __be32 ip6[4];
57 struct in_addr in;
58 struct in6_addr in6;
59};
60
42#ifdef __KERNEL__ 61#ifdef __KERNEL__
43#ifdef CONFIG_NETFILTER 62#ifdef CONFIG_NETFILTER
44 63
@@ -92,19 +111,6 @@ struct nf_sockopt_ops
92 struct module *owner; 111 struct module *owner;
93}; 112};
94 113
95/* Each queued (to userspace) skbuff has one of these. */
96struct nf_info
97{
98 /* The ops struct which sent us to userspace. */
99 struct nf_hook_ops *elem;
100
101 /* If we're sent to userspace, this keeps housekeeping info */
102 int pf;
103 unsigned int hook;
104 struct net_device *indev, *outdev;
105 int (*okfn)(struct sk_buff *);
106};
107
108/* Function to register/unregister hook points. */ 114/* Function to register/unregister hook points. */
109int nf_register_hook(struct nf_hook_ops *reg); 115int nf_register_hook(struct nf_hook_ops *reg);
110void nf_unregister_hook(struct nf_hook_ops *reg); 116void nf_unregister_hook(struct nf_hook_ops *reg);
@@ -118,71 +124,12 @@ void nf_unregister_sockopt(struct nf_sockopt_ops *reg);
118 124
119#ifdef CONFIG_SYSCTL 125#ifdef CONFIG_SYSCTL
120/* Sysctl registration */ 126/* Sysctl registration */
121struct ctl_table_header *nf_register_sysctl_table(struct ctl_table *path, 127extern struct ctl_path nf_net_netfilter_sysctl_path[];
122 struct ctl_table *table); 128extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[];
123void nf_unregister_sysctl_table(struct ctl_table_header *header,
124 struct ctl_table *table);
125extern struct ctl_table nf_net_netfilter_sysctl_path[];
126extern struct ctl_table nf_net_ipv4_netfilter_sysctl_path[];
127#endif /* CONFIG_SYSCTL */ 129#endif /* CONFIG_SYSCTL */
128 130
129extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS]; 131extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS];
130 132
131/* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will
132 * disappear once iptables is replaced with pkttables. Please DO NOT use them
133 * for any new code! */
134#define NF_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */
135#define NF_LOG_TCPOPT 0x02 /* Log TCP options */
136#define NF_LOG_IPOPT 0x04 /* Log IP options */
137#define NF_LOG_UID 0x08 /* Log UID owning local socket */
138#define NF_LOG_MASK 0x0f
139
140#define NF_LOG_TYPE_LOG 0x01
141#define NF_LOG_TYPE_ULOG 0x02
142
143struct nf_loginfo {
144 u_int8_t type;
145 union {
146 struct {
147 u_int32_t copy_len;
148 u_int16_t group;
149 u_int16_t qthreshold;
150 } ulog;
151 struct {
152 u_int8_t level;
153 u_int8_t logflags;
154 } log;
155 } u;
156};
157
158typedef void nf_logfn(unsigned int pf,
159 unsigned int hooknum,
160 const struct sk_buff *skb,
161 const struct net_device *in,
162 const struct net_device *out,
163 const struct nf_loginfo *li,
164 const char *prefix);
165
166struct nf_logger {
167 struct module *me;
168 nf_logfn *logfn;
169 char *name;
170};
171
172/* Function to register/unregister log function. */
173int nf_log_register(int pf, struct nf_logger *logger);
174void nf_log_unregister(struct nf_logger *logger);
175void nf_log_unregister_pf(int pf);
176
177/* Calls the registered backend logging function */
178void nf_log_packet(int pf,
179 unsigned int hooknum,
180 const struct sk_buff *skb,
181 const struct net_device *in,
182 const struct net_device *out,
183 struct nf_loginfo *li,
184 const char *fmt, ...);
185
186int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb, 133int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb,
187 struct net_device *indev, struct net_device *outdev, 134 struct net_device *indev, struct net_device *outdev,
188 int (*okfn)(struct sk_buff *), int thresh); 135 int (*okfn)(struct sk_buff *), int thresh);
@@ -265,65 +212,28 @@ int compat_nf_setsockopt(struct sock *sk, int pf, int optval,
265int compat_nf_getsockopt(struct sock *sk, int pf, int optval, 212int compat_nf_getsockopt(struct sock *sk, int pf, int optval,
266 char __user *opt, int *len); 213 char __user *opt, int *len);
267 214
268/* Packet queuing */
269struct nf_queue_handler {
270 int (*outfn)(struct sk_buff *skb, struct nf_info *info,
271 unsigned int queuenum, void *data);
272 void *data;
273 char *name;
274};
275extern int nf_register_queue_handler(int pf,
276 struct nf_queue_handler *qh);
277extern int nf_unregister_queue_handler(int pf,
278 struct nf_queue_handler *qh);
279extern void nf_unregister_queue_handlers(struct nf_queue_handler *qh);
280extern void nf_reinject(struct sk_buff *skb,
281 struct nf_info *info,
282 unsigned int verdict);
283
284/* FIXME: Before cache is ever used, this must be implemented for real. */
285extern void nf_invalidate_cache(int pf);
286
287/* Call this before modifying an existing packet: ensures it is 215/* Call this before modifying an existing packet: ensures it is
288 modifiable and linear to the point you care about (writable_len). 216 modifiable and linear to the point you care about (writable_len).
289 Returns true or false. */ 217 Returns true or false. */
290extern int skb_make_writable(struct sk_buff *skb, unsigned int writable_len); 218extern int skb_make_writable(struct sk_buff *skb, unsigned int writable_len);
291 219
292static inline void nf_csum_replace4(__sum16 *sum, __be32 from, __be32 to) 220struct flowi;
293{ 221struct nf_queue_entry;
294 __be32 diff[] = { ~from, to };
295
296 *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum)));
297}
298
299static inline void nf_csum_replace2(__sum16 *sum, __be16 from, __be16 to)
300{
301 nf_csum_replace4(sum, (__force __be32)from, (__force __be32)to);
302}
303
304extern void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
305 __be32 from, __be32 to, int pseudohdr);
306
307static inline void nf_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
308 __be16 from, __be16 to, int pseudohdr)
309{
310 nf_proto_csum_replace4(sum, skb, (__force __be32)from,
311 (__force __be32)to, pseudohdr);
312}
313 222
314struct nf_afinfo { 223struct nf_afinfo {
315 unsigned short family; 224 unsigned short family;
316 __sum16 (*checksum)(struct sk_buff *skb, unsigned int hook, 225 __sum16 (*checksum)(struct sk_buff *skb, unsigned int hook,
317 unsigned int dataoff, u_int8_t protocol); 226 unsigned int dataoff, u_int8_t protocol);
227 int (*route)(struct dst_entry **dst, struct flowi *fl);
318 void (*saveroute)(const struct sk_buff *skb, 228 void (*saveroute)(const struct sk_buff *skb,
319 struct nf_info *info); 229 struct nf_queue_entry *entry);
320 int (*reroute)(struct sk_buff *skb, 230 int (*reroute)(struct sk_buff *skb,
321 const struct nf_info *info); 231 const struct nf_queue_entry *entry);
322 int route_key_size; 232 int route_key_size;
323}; 233};
324 234
325extern struct nf_afinfo *nf_afinfo[]; 235extern const struct nf_afinfo *nf_afinfo[NPROTO];
326static inline struct nf_afinfo *nf_get_afinfo(unsigned short family) 236static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family)
327{ 237{
328 return rcu_dereference(nf_afinfo[family]); 238 return rcu_dereference(nf_afinfo[family]);
329} 239}
@@ -332,7 +242,7 @@ static inline __sum16
332nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff, 242nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff,
333 u_int8_t protocol, unsigned short family) 243 u_int8_t protocol, unsigned short family)
334{ 244{
335 struct nf_afinfo *afinfo; 245 const struct nf_afinfo *afinfo;
336 __sum16 csum = 0; 246 __sum16 csum = 0;
337 247
338 rcu_read_lock(); 248 rcu_read_lock();
@@ -343,10 +253,8 @@ nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff,
343 return csum; 253 return csum;
344} 254}
345 255
346extern int nf_register_afinfo(struct nf_afinfo *afinfo); 256extern int nf_register_afinfo(const struct nf_afinfo *afinfo);
347extern void nf_unregister_afinfo(struct nf_afinfo *afinfo); 257extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo);
348
349#define nf_info_reroute(x) ((void *)x + sizeof(struct nf_info))
350 258
351#include <net/flow.h> 259#include <net/flow.h>
352extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); 260extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
@@ -354,11 +262,16 @@ extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
354static inline void 262static inline void
355nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) 263nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family)
356{ 264{
357#if defined(CONFIG_IP_NF_NAT_NEEDED) || defined(CONFIG_NF_NAT_NEEDED) 265#ifdef CONFIG_NF_NAT_NEEDED
358 void (*decodefn)(struct sk_buff *, struct flowi *); 266 void (*decodefn)(struct sk_buff *, struct flowi *);
359 267
360 if (family == AF_INET && (decodefn = ip_nat_decode_session) != NULL) 268 if (family == AF_INET) {
361 decodefn(skb, fl); 269 rcu_read_lock();
270 decodefn = rcu_dereference(ip_nat_decode_session);
271 if (decodefn)
272 decodefn(skb, fl);
273 rcu_read_unlock();
274 }
362#endif 275#endif
363} 276}
364 277
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index f2eaea2234ec..91fef0cae42f 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -4,27 +4,34 @@ header-y += nfnetlink_conntrack.h
4header-y += nfnetlink_log.h 4header-y += nfnetlink_log.h
5header-y += nfnetlink_queue.h 5header-y += nfnetlink_queue.h
6header-y += xt_CLASSIFY.h 6header-y += xt_CLASSIFY.h
7header-y += xt_CONNMARK.h
8header-y += xt_CONNSECMARK.h
9header-y += xt_DSCP.h
10header-y += xt_MARK.h
11header-y += xt_NFLOG.h
12header-y += xt_NFQUEUE.h
13header-y += xt_RATEEST.h
14header-y += xt_SECMARK.h
15header-y += xt_TCPMSS.h
7header-y += xt_comment.h 16header-y += xt_comment.h
8header-y += xt_connbytes.h 17header-y += xt_connbytes.h
9header-y += xt_connmark.h 18header-y += xt_connmark.h
10header-y += xt_CONNMARK.h
11header-y += xt_conntrack.h 19header-y += xt_conntrack.h
12header-y += xt_dccp.h 20header-y += xt_dccp.h
13header-y += xt_dscp.h 21header-y += xt_dscp.h
14header-y += xt_DSCP.h
15header-y += xt_esp.h 22header-y += xt_esp.h
16header-y += xt_helper.h
17header-y += xt_hashlimit.h 23header-y += xt_hashlimit.h
24header-y += xt_iprange.h
25header-y += xt_helper.h
18header-y += xt_length.h 26header-y += xt_length.h
19header-y += xt_limit.h 27header-y += xt_limit.h
20header-y += xt_mac.h 28header-y += xt_mac.h
21header-y += xt_mark.h 29header-y += xt_mark.h
22header-y += xt_MARK.h
23header-y += xt_multiport.h 30header-y += xt_multiport.h
24header-y += xt_NFQUEUE.h 31header-y += xt_owner.h
25header-y += xt_NFLOG.h
26header-y += xt_pkttype.h 32header-y += xt_pkttype.h
27header-y += xt_policy.h 33header-y += xt_policy.h
34header-y += xt_rateest.h
28header-y += xt_realm.h 35header-y += xt_realm.h
29header-y += xt_sctp.h 36header-y += xt_sctp.h
30header-y += xt_state.h 37header-y += xt_state.h
@@ -32,9 +39,6 @@ header-y += xt_statistic.h
32header-y += xt_string.h 39header-y += xt_string.h
33header-y += xt_tcpmss.h 40header-y += xt_tcpmss.h
34header-y += xt_tcpudp.h 41header-y += xt_tcpudp.h
35header-y += xt_SECMARK.h
36header-y += xt_CONNSECMARK.h
37header-y += xt_TCPMSS.h
38 42
39unifdef-y += nf_conntrack_common.h 43unifdef-y += nf_conntrack_common.h
40unifdef-y += nf_conntrack_ftp.h 44unifdef-y += nf_conntrack_ftp.h
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h
index 9e0dae07861e..bad1eb760f61 100644
--- a/include/linux/netfilter/nf_conntrack_common.h
+++ b/include/linux/netfilter/nf_conntrack_common.h
@@ -129,6 +129,14 @@ enum ip_conntrack_events
129 /* Mark is set */ 129 /* Mark is set */
130 IPCT_MARK_BIT = 12, 130 IPCT_MARK_BIT = 12,
131 IPCT_MARK = (1 << IPCT_MARK_BIT), 131 IPCT_MARK = (1 << IPCT_MARK_BIT),
132
133 /* NAT sequence adjustment */
134 IPCT_NATSEQADJ_BIT = 13,
135 IPCT_NATSEQADJ = (1 << IPCT_NATSEQADJ_BIT),
136
137 /* Secmark is set */
138 IPCT_SECMARK_BIT = 14,
139 IPCT_SECMARK = (1 << IPCT_SECMARK_BIT),
132}; 140};
133 141
134enum ip_conntrack_expect_events { 142enum ip_conntrack_expect_events {
diff --git a/include/linux/netfilter/nf_conntrack_h323.h b/include/linux/netfilter/nf_conntrack_h323.h
index aabd24ac7631..26f9226ea72b 100644
--- a/include/linux/netfilter/nf_conntrack_h323.h
+++ b/include/linux/netfilter/nf_conntrack_h323.h
@@ -31,7 +31,7 @@ struct nf_conn;
31 31
32extern int get_h225_addr(struct nf_conn *ct, unsigned char *data, 32extern int get_h225_addr(struct nf_conn *ct, unsigned char *data,
33 TransportAddress *taddr, 33 TransportAddress *taddr,
34 union nf_conntrack_address *addr, __be16 *port); 34 union nf_inet_addr *addr, __be16 *port);
35extern void nf_conntrack_h245_expect(struct nf_conn *new, 35extern void nf_conntrack_h245_expect(struct nf_conn *new,
36 struct nf_conntrack_expect *this); 36 struct nf_conntrack_expect *this);
37extern void nf_conntrack_q931_expect(struct nf_conn *new, 37extern void nf_conntrack_q931_expect(struct nf_conn *new,
@@ -39,12 +39,12 @@ extern void nf_conntrack_q931_expect(struct nf_conn *new,
39extern int (*set_h245_addr_hook) (struct sk_buff *skb, 39extern int (*set_h245_addr_hook) (struct sk_buff *skb,
40 unsigned char **data, int dataoff, 40 unsigned char **data, int dataoff,
41 H245_TransportAddress *taddr, 41 H245_TransportAddress *taddr,
42 union nf_conntrack_address *addr, 42 union nf_inet_addr *addr,
43 __be16 port); 43 __be16 port);
44extern int (*set_h225_addr_hook) (struct sk_buff *skb, 44extern int (*set_h225_addr_hook) (struct sk_buff *skb,
45 unsigned char **data, int dataoff, 45 unsigned char **data, int dataoff,
46 TransportAddress *taddr, 46 TransportAddress *taddr,
47 union nf_conntrack_address *addr, 47 union nf_inet_addr *addr,
48 __be16 port); 48 __be16 port);
49extern int (*set_sig_addr_hook) (struct sk_buff *skb, 49extern int (*set_sig_addr_hook) (struct sk_buff *skb,
50 struct nf_conn *ct, 50 struct nf_conn *ct,
diff --git a/include/linux/netfilter/nf_conntrack_pptp.h b/include/linux/netfilter/nf_conntrack_pptp.h
index 23435496d24a..3bbde0c3a8a6 100644
--- a/include/linux/netfilter/nf_conntrack_pptp.h
+++ b/include/linux/netfilter/nf_conntrack_pptp.h
@@ -4,7 +4,7 @@
4 4
5#include <linux/netfilter/nf_conntrack_common.h> 5#include <linux/netfilter/nf_conntrack_common.h>
6 6
7extern const char *pptp_msg_name[]; 7extern const char *const pptp_msg_name[];
8 8
9/* state of the control session */ 9/* state of the control session */
10enum pptp_ctrlsess_state { 10enum pptp_ctrlsess_state {
diff --git a/include/linux/netfilter/nf_conntrack_sctp.h b/include/linux/netfilter/nf_conntrack_sctp.h
index 5cf2c115cce4..768f78c4ac53 100644
--- a/include/linux/netfilter/nf_conntrack_sctp.h
+++ b/include/linux/netfilter/nf_conntrack_sctp.h
@@ -21,7 +21,6 @@ struct ip_ct_sctp
21 enum sctp_conntrack state; 21 enum sctp_conntrack state;
22 22
23 __be32 vtag[IP_CT_DIR_MAX]; 23 __be32 vtag[IP_CT_DIR_MAX];
24 u_int32_t ttag[IP_CT_DIR_MAX];
25}; 24};
26 25
27#endif /* _NF_CONNTRACK_SCTP_H */ 26#endif /* _NF_CONNTRACK_SCTP_H */
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h
index 9fff19779bd5..8e5ce1ca7bfc 100644
--- a/include/linux/netfilter/nf_conntrack_sip.h
+++ b/include/linux/netfilter/nf_conntrack_sip.h
@@ -30,9 +30,9 @@ extern unsigned int (*nf_nat_sdp_hook)(struct sk_buff *skb,
30 struct nf_conntrack_expect *exp, 30 struct nf_conntrack_expect *exp,
31 const char *dptr); 31 const char *dptr);
32 32
33extern int ct_sip_get_info(struct nf_conn *ct, const char *dptr, size_t dlen, 33extern int ct_sip_get_info(const struct nf_conn *ct, const char *dptr,
34 unsigned int *matchoff, unsigned int *matchlen, 34 size_t dlen, unsigned int *matchoff,
35 enum sip_header_pos pos); 35 unsigned int *matchlen, enum sip_header_pos pos);
36extern int ct_sip_lnlen(const char *line, const char *limit); 36extern int ct_sip_lnlen(const char *line, const char *limit);
37extern const char *ct_sip_search(const char *needle, const char *haystack, 37extern const char *ct_sip_search(const char *needle, const char *haystack,
38 size_t needle_len, size_t haystack_len, 38 size_t needle_len, size_t haystack_len,
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index 4affa3fe78e0..e3e1533aba2d 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -37,6 +37,9 @@ enum ctattr_type {
37 CTA_ID, 37 CTA_ID,
38 CTA_NAT_DST, 38 CTA_NAT_DST,
39 CTA_TUPLE_MASTER, 39 CTA_TUPLE_MASTER,
40 CTA_NAT_SEQ_ADJ_ORIG,
41 CTA_NAT_SEQ_ADJ_REPLY,
42 CTA_SECMARK,
40 __CTA_MAX 43 __CTA_MAX
41}; 44};
42#define CTA_MAX (__CTA_MAX - 1) 45#define CTA_MAX (__CTA_MAX - 1)
@@ -119,6 +122,14 @@ enum ctattr_protonat {
119}; 122};
120#define CTA_PROTONAT_MAX (__CTA_PROTONAT_MAX - 1) 123#define CTA_PROTONAT_MAX (__CTA_PROTONAT_MAX - 1)
121 124
125enum ctattr_natseq {
126 CTA_NAT_SEQ_CORRECTION_POS,
127 CTA_NAT_SEQ_OFFSET_BEFORE,
128 CTA_NAT_SEQ_OFFSET_AFTER,
129 __CTA_NAT_SEQ_MAX
130};
131#define CTA_NAT_SEQ_MAX (__CTA_NAT_SEQ_MAX - 1)
132
122enum ctattr_expect { 133enum ctattr_expect {
123 CTA_EXPECT_UNSPEC, 134 CTA_EXPECT_UNSPEC,
124 CTA_EXPECT_MASTER, 135 CTA_EXPECT_MASTER,
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h
index 5966afa026e9..a85721332924 100644
--- a/include/linux/netfilter/nfnetlink_log.h
+++ b/include/linux/netfilter/nfnetlink_log.h
@@ -47,6 +47,7 @@ enum nfulnl_attr_type {
47 NFULA_UID, /* user id of socket */ 47 NFULA_UID, /* user id of socket */
48 NFULA_SEQ, /* instance-local sequence number */ 48 NFULA_SEQ, /* instance-local sequence number */
49 NFULA_SEQ_GLOBAL, /* global sequence number */ 49 NFULA_SEQ_GLOBAL, /* global sequence number */
50 NFULA_GID, /* group id of socket */
50 51
51 __NFULA_MAX 52 __NFULA_MAX
52}; 53};
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 03e6ce979eaa..b2c62cc618f5 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -126,6 +126,49 @@ struct xt_counters_info
126 126
127#define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */ 127#define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */
128 128
129/* fn returns 0 to continue iteration */
130#define XT_MATCH_ITERATE(type, e, fn, args...) \
131({ \
132 unsigned int __i; \
133 int __ret = 0; \
134 struct xt_entry_match *__m; \
135 \
136 for (__i = sizeof(type); \
137 __i < (e)->target_offset; \
138 __i += __m->u.match_size) { \
139 __m = (void *)e + __i; \
140 \
141 __ret = fn(__m , ## args); \
142 if (__ret != 0) \
143 break; \
144 } \
145 __ret; \
146})
147
148/* fn returns 0 to continue iteration */
149#define XT_ENTRY_ITERATE_CONTINUE(type, entries, size, n, fn, args...) \
150({ \
151 unsigned int __i, __n; \
152 int __ret = 0; \
153 type *__entry; \
154 \
155 for (__i = 0, __n = 0; __i < (size); \
156 __i += __entry->next_offset, __n++) { \
157 __entry = (void *)(entries) + __i; \
158 if (__n < n) \
159 continue; \
160 \
161 __ret = fn(__entry , ## args); \
162 if (__ret != 0) \
163 break; \
164 } \
165 __ret; \
166})
167
168/* fn returns 0 to continue iteration */
169#define XT_ENTRY_ITERATE(type, entries, size, fn, args...) \
170 XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args)
171
129#ifdef __KERNEL__ 172#ifdef __KERNEL__
130 173
131#include <linux/netdevice.h> 174#include <linux/netdevice.h>
@@ -171,7 +214,7 @@ struct xt_match
171 /* Free to use by each match */ 214 /* Free to use by each match */
172 unsigned long data; 215 unsigned long data;
173 216
174 char *table; 217 const char *table;
175 unsigned int matchsize; 218 unsigned int matchsize;
176 unsigned int compatsize; 219 unsigned int compatsize;
177 unsigned int hooks; 220 unsigned int hooks;
@@ -218,7 +261,7 @@ struct xt_target
218 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 261 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
219 struct module *me; 262 struct module *me;
220 263
221 char *table; 264 const char *table;
222 unsigned int targetsize; 265 unsigned int targetsize;
223 unsigned int compatsize; 266 unsigned int compatsize;
224 unsigned int hooks; 267 unsigned int hooks;
@@ -234,7 +277,7 @@ struct xt_table
234 struct list_head list; 277 struct list_head list;
235 278
236 /* A unique name... */ 279 /* A unique name... */
237 char name[XT_TABLE_MAXNAMELEN]; 280 const char name[XT_TABLE_MAXNAMELEN];
238 281
239 /* What hooks you will enter on */ 282 /* What hooks you will enter on */
240 unsigned int valid_hooks; 283 unsigned int valid_hooks;
@@ -265,13 +308,16 @@ struct xt_table_info
265 unsigned int initial_entries; 308 unsigned int initial_entries;
266 309
267 /* Entry points and underflows */ 310 /* Entry points and underflows */
268 unsigned int hook_entry[NF_IP_NUMHOOKS]; 311 unsigned int hook_entry[NF_INET_NUMHOOKS];
269 unsigned int underflow[NF_IP_NUMHOOKS]; 312 unsigned int underflow[NF_INET_NUMHOOKS];
270 313
271 /* ipt_entry tables: one per CPU */ 314 /* ipt_entry tables: one per CPU */
272 char *entries[NR_CPUS]; 315 /* Note : this field MUST be the last one, see XT_TABLE_INFO_SZ */
316 char *entries[1];
273}; 317};
274 318
319#define XT_TABLE_INFO_SZ (offsetof(struct xt_table_info, entries) \
320 + nr_cpu_ids * sizeof(char *))
275extern int xt_register_target(struct xt_target *target); 321extern int xt_register_target(struct xt_target *target);
276extern void xt_unregister_target(struct xt_target *target); 322extern void xt_unregister_target(struct xt_target *target);
277extern int xt_register_targets(struct xt_target *target, unsigned int n); 323extern int xt_register_targets(struct xt_target *target, unsigned int n);
@@ -289,9 +335,10 @@ extern int xt_check_target(const struct xt_target *target, unsigned short family
289 unsigned int size, const char *table, unsigned int hook, 335 unsigned int size, const char *table, unsigned int hook,
290 unsigned short proto, int inv_proto); 336 unsigned short proto, int inv_proto);
291 337
292extern int xt_register_table(struct xt_table *table, 338extern struct xt_table *xt_register_table(struct net *net,
293 struct xt_table_info *bootstrap, 339 struct xt_table *table,
294 struct xt_table_info *newinfo); 340 struct xt_table_info *bootstrap,
341 struct xt_table_info *newinfo);
295extern void *xt_unregister_table(struct xt_table *table); 342extern void *xt_unregister_table(struct xt_table *table);
296 343
297extern struct xt_table_info *xt_replace_table(struct xt_table *table, 344extern struct xt_table_info *xt_replace_table(struct xt_table *table,
@@ -306,11 +353,12 @@ extern struct xt_target *xt_request_find_target(int af, const char *name,
306extern int xt_find_revision(int af, const char *name, u8 revision, int target, 353extern int xt_find_revision(int af, const char *name, u8 revision, int target,
307 int *err); 354 int *err);
308 355
309extern struct xt_table *xt_find_table_lock(int af, const char *name); 356extern struct xt_table *xt_find_table_lock(struct net *net, int af,
357 const char *name);
310extern void xt_table_unlock(struct xt_table *t); 358extern void xt_table_unlock(struct xt_table *t);
311 359
312extern int xt_proto_init(int af); 360extern int xt_proto_init(struct net *net, int af);
313extern void xt_proto_fini(int af); 361extern void xt_proto_fini(struct net *net, int af);
314 362
315extern struct xt_table_info *xt_alloc_table_info(unsigned int size); 363extern struct xt_table_info *xt_alloc_table_info(unsigned int size);
316extern void xt_free_table_info(struct xt_table_info *info); 364extern void xt_free_table_info(struct xt_table_info *info);
@@ -378,17 +426,21 @@ struct compat_xt_counters_info
378extern void xt_compat_lock(int af); 426extern void xt_compat_lock(int af);
379extern void xt_compat_unlock(int af); 427extern void xt_compat_unlock(int af);
380 428
429extern int xt_compat_add_offset(int af, unsigned int offset, short delta);
430extern void xt_compat_flush_offsets(int af);
431extern short xt_compat_calc_jump(int af, unsigned int offset);
432
381extern int xt_compat_match_offset(struct xt_match *match); 433extern int xt_compat_match_offset(struct xt_match *match);
382extern void xt_compat_match_from_user(struct xt_entry_match *m, 434extern int xt_compat_match_from_user(struct xt_entry_match *m,
383 void **dstptr, int *size); 435 void **dstptr, unsigned int *size);
384extern int xt_compat_match_to_user(struct xt_entry_match *m, 436extern int xt_compat_match_to_user(struct xt_entry_match *m,
385 void __user **dstptr, int *size); 437 void __user **dstptr, unsigned int *size);
386 438
387extern int xt_compat_target_offset(struct xt_target *target); 439extern int xt_compat_target_offset(struct xt_target *target);
388extern void xt_compat_target_from_user(struct xt_entry_target *t, 440extern void xt_compat_target_from_user(struct xt_entry_target *t,
389 void **dstptr, int *size); 441 void **dstptr, unsigned int *size);
390extern int xt_compat_target_to_user(struct xt_entry_target *t, 442extern int xt_compat_target_to_user(struct xt_entry_target *t,
391 void __user **dstptr, int *size); 443 void __user **dstptr, unsigned int *size);
392 444
393#endif /* CONFIG_COMPAT */ 445#endif /* CONFIG_COMPAT */
394#endif /* __KERNEL__ */ 446#endif /* __KERNEL__ */
diff --git a/include/linux/netfilter/xt_CONNMARK.h b/include/linux/netfilter/xt_CONNMARK.h
index 9f744689fffc..4e58ba43c289 100644
--- a/include/linux/netfilter/xt_CONNMARK.h
+++ b/include/linux/netfilter/xt_CONNMARK.h
@@ -22,4 +22,9 @@ struct xt_connmark_target_info {
22 u_int8_t mode; 22 u_int8_t mode;
23}; 23};
24 24
25struct xt_connmark_tginfo1 {
26 u_int32_t ctmark, ctmask, nfmask;
27 u_int8_t mode;
28};
29
25#endif /*_XT_CONNMARK_H_target*/ 30#endif /*_XT_CONNMARK_H_target*/
diff --git a/include/linux/netfilter/xt_DSCP.h b/include/linux/netfilter/xt_DSCP.h
index 3c7c963997bd..14da1968e2c6 100644
--- a/include/linux/netfilter/xt_DSCP.h
+++ b/include/linux/netfilter/xt_DSCP.h
@@ -17,4 +17,9 @@ struct xt_DSCP_info {
17 u_int8_t dscp; 17 u_int8_t dscp;
18}; 18};
19 19
20struct xt_tos_target_info {
21 u_int8_t tos_value;
22 u_int8_t tos_mask;
23};
24
20#endif /* _XT_DSCP_TARGET_H */ 25#endif /* _XT_DSCP_TARGET_H */
diff --git a/include/linux/netfilter/xt_MARK.h b/include/linux/netfilter/xt_MARK.h
index b021e93ee5d6..778b278fd9f2 100644
--- a/include/linux/netfilter/xt_MARK.h
+++ b/include/linux/netfilter/xt_MARK.h
@@ -18,4 +18,8 @@ struct xt_mark_target_info_v1 {
18 u_int8_t mode; 18 u_int8_t mode;
19}; 19};
20 20
21struct xt_mark_tginfo2 {
22 u_int32_t mark, mask;
23};
24
21#endif /*_XT_MARK_H_target */ 25#endif /*_XT_MARK_H_target */
diff --git a/include/linux/netfilter/xt_RATEEST.h b/include/linux/netfilter/xt_RATEEST.h
new file mode 100644
index 000000000000..f79e3133cbea
--- /dev/null
+++ b/include/linux/netfilter/xt_RATEEST.h
@@ -0,0 +1,13 @@
1#ifndef _XT_RATEEST_TARGET_H
2#define _XT_RATEEST_TARGET_H
3
4struct xt_rateest_target_info {
5 char name[IFNAMSIZ];
6 int8_t interval;
7 u_int8_t ewma_log;
8
9 /* Used internally by the kernel */
10 struct xt_rateest *est __attribute__((aligned(8)));
11};
12
13#endif /* _XT_RATEEST_TARGET_H */
diff --git a/include/linux/netfilter/xt_TCPOPTSTRIP.h b/include/linux/netfilter/xt_TCPOPTSTRIP.h
new file mode 100644
index 000000000000..2db543214ff5
--- /dev/null
+++ b/include/linux/netfilter/xt_TCPOPTSTRIP.h
@@ -0,0 +1,13 @@
1#ifndef _XT_TCPOPTSTRIP_H
2#define _XT_TCPOPTSTRIP_H
3
4#define tcpoptstrip_set_bit(bmap, idx) \
5 (bmap[(idx) >> 5] |= 1U << (idx & 31))
6#define tcpoptstrip_test_bit(bmap, idx) \
7 (((1U << (idx & 31)) & bmap[(idx) >> 5]) != 0)
8
9struct xt_tcpoptstrip_target_info {
10 u_int32_t strip_bmap[8];
11};
12
13#endif /* _XT_TCPOPTSTRIP_H */
diff --git a/include/linux/netfilter/xt_connlimit.h b/include/linux/netfilter/xt_connlimit.h
index 37e933c9987d..7e3284bcbd2b 100644
--- a/include/linux/netfilter/xt_connlimit.h
+++ b/include/linux/netfilter/xt_connlimit.h
@@ -5,12 +5,17 @@ struct xt_connlimit_data;
5 5
6struct xt_connlimit_info { 6struct xt_connlimit_info {
7 union { 7 union {
8 __be32 v4_mask; 8 union nf_inet_addr mask;
9 __be32 v6_mask[4]; 9#ifndef __KERNEL__
10 union {
11 __be32 v4_mask;
12 __be32 v6_mask[4];
13 };
14#endif
10 }; 15 };
11 unsigned int limit, inverse; 16 unsigned int limit, inverse;
12 17
13 /* this needs to be at the end */ 18 /* Used internally by the kernel */
14 struct xt_connlimit_data *data __attribute__((aligned(8))); 19 struct xt_connlimit_data *data __attribute__((aligned(8)));
15}; 20};
16 21
diff --git a/include/linux/netfilter/xt_connmark.h b/include/linux/netfilter/xt_connmark.h
index c592f6ae0883..359ef86918dc 100644
--- a/include/linux/netfilter/xt_connmark.h
+++ b/include/linux/netfilter/xt_connmark.h
@@ -15,4 +15,9 @@ struct xt_connmark_info {
15 u_int8_t invert; 15 u_int8_t invert;
16}; 16};
17 17
18struct xt_connmark_mtinfo1 {
19 u_int32_t mark, mask;
20 u_int8_t invert;
21};
22
18#endif /*_XT_CONNMARK_H*/ 23#endif /*_XT_CONNMARK_H*/
diff --git a/include/linux/netfilter/xt_conntrack.h b/include/linux/netfilter/xt_conntrack.h
index 70b6f718cf4c..f3fd83e46bab 100644
--- a/include/linux/netfilter/xt_conntrack.h
+++ b/include/linux/netfilter/xt_conntrack.h
@@ -6,7 +6,6 @@
6#define _XT_CONNTRACK_H 6#define _XT_CONNTRACK_H
7 7
8#include <linux/netfilter/nf_conntrack_tuple_common.h> 8#include <linux/netfilter/nf_conntrack_tuple_common.h>
9#include <linux/in.h>
10 9
11#define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) 10#define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1))
12#define XT_CONNTRACK_STATE_INVALID (1 << 0) 11#define XT_CONNTRACK_STATE_INVALID (1 << 0)
@@ -16,14 +15,21 @@
16#define XT_CONNTRACK_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 3)) 15#define XT_CONNTRACK_STATE_UNTRACKED (1 << (IP_CT_NUMBER + 3))
17 16
18/* flags, invflags: */ 17/* flags, invflags: */
19#define XT_CONNTRACK_STATE 0x01 18enum {
20#define XT_CONNTRACK_PROTO 0x02 19 XT_CONNTRACK_STATE = 1 << 0,
21#define XT_CONNTRACK_ORIGSRC 0x04 20 XT_CONNTRACK_PROTO = 1 << 1,
22#define XT_CONNTRACK_ORIGDST 0x08 21 XT_CONNTRACK_ORIGSRC = 1 << 2,
23#define XT_CONNTRACK_REPLSRC 0x10 22 XT_CONNTRACK_ORIGDST = 1 << 3,
24#define XT_CONNTRACK_REPLDST 0x20 23 XT_CONNTRACK_REPLSRC = 1 << 4,
25#define XT_CONNTRACK_STATUS 0x40 24 XT_CONNTRACK_REPLDST = 1 << 5,
26#define XT_CONNTRACK_EXPIRES 0x80 25 XT_CONNTRACK_STATUS = 1 << 6,
26 XT_CONNTRACK_EXPIRES = 1 << 7,
27 XT_CONNTRACK_ORIGSRC_PORT = 1 << 8,
28 XT_CONNTRACK_ORIGDST_PORT = 1 << 9,
29 XT_CONNTRACK_REPLSRC_PORT = 1 << 10,
30 XT_CONNTRACK_REPLDST_PORT = 1 << 11,
31 XT_CONNTRACK_DIRECTION = 1 << 12,
32};
27 33
28/* This is exposed to userspace, so remains frozen in time. */ 34/* This is exposed to userspace, so remains frozen in time. */
29struct ip_conntrack_old_tuple 35struct ip_conntrack_old_tuple
@@ -60,4 +66,18 @@ struct xt_conntrack_info
60 /* Inverse flags */ 66 /* Inverse flags */
61 u_int8_t invflags; 67 u_int8_t invflags;
62}; 68};
69
70struct xt_conntrack_mtinfo1 {
71 union nf_inet_addr origsrc_addr, origsrc_mask;
72 union nf_inet_addr origdst_addr, origdst_mask;
73 union nf_inet_addr replsrc_addr, replsrc_mask;
74 union nf_inet_addr repldst_addr, repldst_mask;
75 u_int32_t expires_min, expires_max;
76 u_int16_t l4proto;
77 __be16 origsrc_port, origdst_port;
78 __be16 replsrc_port, repldst_port;
79 u_int16_t match_flags, invert_flags;
80 u_int8_t state_mask, status_mask;
81};
82
63#endif /*_XT_CONNTRACK_H*/ 83#endif /*_XT_CONNTRACK_H*/
diff --git a/include/linux/netfilter/xt_dscp.h b/include/linux/netfilter/xt_dscp.h
index 1da61e6acaf7..f49bc1a648dc 100644
--- a/include/linux/netfilter/xt_dscp.h
+++ b/include/linux/netfilter/xt_dscp.h
@@ -20,4 +20,10 @@ struct xt_dscp_info {
20 u_int8_t invert; 20 u_int8_t invert;
21}; 21};
22 22
23struct xt_tos_match_info {
24 u_int8_t tos_mask;
25 u_int8_t tos_value;
26 u_int8_t invert;
27};
28
23#endif /* _XT_DSCP_H */ 29#endif /* _XT_DSCP_H */
diff --git a/include/linux/netfilter/xt_hashlimit.h b/include/linux/netfilter/xt_hashlimit.h
index b4556b8edbfd..58b818ee41ca 100644
--- a/include/linux/netfilter/xt_hashlimit.h
+++ b/include/linux/netfilter/xt_hashlimit.h
@@ -9,13 +9,16 @@
9/* details of this structure hidden by the implementation */ 9/* details of this structure hidden by the implementation */
10struct xt_hashlimit_htable; 10struct xt_hashlimit_htable;
11 11
12#define XT_HASHLIMIT_HASH_DIP 0x0001 12enum {
13#define XT_HASHLIMIT_HASH_DPT 0x0002 13 XT_HASHLIMIT_HASH_DIP = 1 << 0,
14#define XT_HASHLIMIT_HASH_SIP 0x0004 14 XT_HASHLIMIT_HASH_DPT = 1 << 1,
15#define XT_HASHLIMIT_HASH_SPT 0x0008 15 XT_HASHLIMIT_HASH_SIP = 1 << 2,
16 XT_HASHLIMIT_HASH_SPT = 1 << 3,
17 XT_HASHLIMIT_INVERT = 1 << 4,
18};
16 19
17struct hashlimit_cfg { 20struct hashlimit_cfg {
18 u_int32_t mode; /* bitmask of IPT_HASHLIMIT_HASH_* */ 21 u_int32_t mode; /* bitmask of XT_HASHLIMIT_HASH_* */
19 u_int32_t avg; /* Average secs between packets * scale */ 22 u_int32_t avg; /* Average secs between packets * scale */
20 u_int32_t burst; /* Period multiplier for upper limit. */ 23 u_int32_t burst; /* Period multiplier for upper limit. */
21 24
@@ -29,12 +32,36 @@ struct hashlimit_cfg {
29struct xt_hashlimit_info { 32struct xt_hashlimit_info {
30 char name [IFNAMSIZ]; /* name */ 33 char name [IFNAMSIZ]; /* name */
31 struct hashlimit_cfg cfg; 34 struct hashlimit_cfg cfg;
32 struct xt_hashlimit_htable *hinfo;
33 35
34 /* Used internally by the kernel */ 36 /* Used internally by the kernel */
37 struct xt_hashlimit_htable *hinfo;
35 union { 38 union {
36 void *ptr; 39 void *ptr;
37 struct xt_hashlimit_info *master; 40 struct xt_hashlimit_info *master;
38 } u; 41 } u;
39}; 42};
43
44struct hashlimit_cfg1 {
45 u_int32_t mode; /* bitmask of XT_HASHLIMIT_HASH_* */
46 u_int32_t avg; /* Average secs between packets * scale */
47 u_int32_t burst; /* Period multiplier for upper limit. */
48
49 /* user specified */
50 u_int32_t size; /* how many buckets */
51 u_int32_t max; /* max number of entries */
52 u_int32_t gc_interval; /* gc interval */
53 u_int32_t expire; /* when do entries expire? */
54
55 u_int8_t srcmask, dstmask;
56};
57
58struct xt_hashlimit_mtinfo1 {
59 char name[IFNAMSIZ];
60 struct hashlimit_cfg1 cfg;
61
62 /* Used internally by the kernel */
63 struct xt_hashlimit_htable *hinfo __attribute__((aligned(8)));
64 struct xt_hashlimit_mtinfo1 *master __attribute__((aligned(8)));
65};
66
40#endif /*_XT_HASHLIMIT_H*/ 67#endif /*_XT_HASHLIMIT_H*/
diff --git a/include/linux/netfilter/xt_iprange.h b/include/linux/netfilter/xt_iprange.h
new file mode 100644
index 000000000000..a4299c7d3680
--- /dev/null
+++ b/include/linux/netfilter/xt_iprange.h
@@ -0,0 +1,17 @@
1#ifndef _LINUX_NETFILTER_XT_IPRANGE_H
2#define _LINUX_NETFILTER_XT_IPRANGE_H 1
3
4enum {
5 IPRANGE_SRC = 1 << 0, /* match source IP address */
6 IPRANGE_DST = 1 << 1, /* match destination IP address */
7 IPRANGE_SRC_INV = 1 << 4, /* negate the condition */
8 IPRANGE_DST_INV = 1 << 5, /* -"- */
9};
10
11struct xt_iprange_mtinfo {
12 union nf_inet_addr src_min, src_max;
13 union nf_inet_addr dst_min, dst_max;
14 u_int8_t flags;
15};
16
17#endif /* _LINUX_NETFILTER_XT_IPRANGE_H */
diff --git a/include/linux/netfilter/xt_mark.h b/include/linux/netfilter/xt_mark.h
index 802dd4842caf..fae74bc3f34e 100644
--- a/include/linux/netfilter/xt_mark.h
+++ b/include/linux/netfilter/xt_mark.h
@@ -6,4 +6,9 @@ struct xt_mark_info {
6 u_int8_t invert; 6 u_int8_t invert;
7}; 7};
8 8
9struct xt_mark_mtinfo1 {
10 u_int32_t mark, mask;
11 u_int8_t invert;
12};
13
9#endif /*_XT_MARK_H*/ 14#endif /*_XT_MARK_H*/
diff --git a/include/linux/netfilter/xt_owner.h b/include/linux/netfilter/xt_owner.h
new file mode 100644
index 000000000000..c84e52cfe415
--- /dev/null
+++ b/include/linux/netfilter/xt_owner.h
@@ -0,0 +1,16 @@
1#ifndef _XT_OWNER_MATCH_H
2#define _XT_OWNER_MATCH_H
3
4enum {
5 XT_OWNER_UID = 1 << 0,
6 XT_OWNER_GID = 1 << 1,
7 XT_OWNER_SOCKET = 1 << 2,
8};
9
10struct xt_owner_match_info {
11 u_int32_t uid_min, uid_max;
12 u_int32_t gid_min, gid_max;
13 u_int8_t match, invert;
14};
15
16#endif /* _XT_OWNER_MATCH_H */
diff --git a/include/linux/netfilter/xt_policy.h b/include/linux/netfilter/xt_policy.h
index 45654d359a68..053d8cc65464 100644
--- a/include/linux/netfilter/xt_policy.h
+++ b/include/linux/netfilter/xt_policy.h
@@ -27,18 +27,33 @@ struct xt_policy_spec
27 reqid:1; 27 reqid:1;
28}; 28};
29 29
30#ifndef __KERNEL__
30union xt_policy_addr 31union xt_policy_addr
31{ 32{
32 struct in_addr a4; 33 struct in_addr a4;
33 struct in6_addr a6; 34 struct in6_addr a6;
34}; 35};
36#endif
35 37
36struct xt_policy_elem 38struct xt_policy_elem
37{ 39{
38 union xt_policy_addr saddr; 40 union {
39 union xt_policy_addr smask; 41#ifdef __KERNEL__
40 union xt_policy_addr daddr; 42 struct {
41 union xt_policy_addr dmask; 43 union nf_inet_addr saddr;
44 union nf_inet_addr smask;
45 union nf_inet_addr daddr;
46 union nf_inet_addr dmask;
47 };
48#else
49 struct {
50 union xt_policy_addr saddr;
51 union xt_policy_addr smask;
52 union xt_policy_addr daddr;
53 union xt_policy_addr dmask;
54 };
55#endif
56 };
42 __be32 spi; 57 __be32 spi;
43 u_int32_t reqid; 58 u_int32_t reqid;
44 u_int8_t proto; 59 u_int8_t proto;
diff --git a/include/linux/netfilter/xt_quota.h b/include/linux/netfilter/xt_quota.h
index acd7fd77bbee..4c8368d781e5 100644
--- a/include/linux/netfilter/xt_quota.h
+++ b/include/linux/netfilter/xt_quota.h
@@ -9,6 +9,8 @@ enum xt_quota_flags {
9struct xt_quota_info { 9struct xt_quota_info {
10 u_int32_t flags; 10 u_int32_t flags;
11 u_int32_t pad; 11 u_int32_t pad;
12
13 /* Used internally by the kernel */
12 aligned_u64 quota; 14 aligned_u64 quota;
13 struct xt_quota_info *master; 15 struct xt_quota_info *master;
14}; 16};
diff --git a/include/linux/netfilter/xt_rateest.h b/include/linux/netfilter/xt_rateest.h
new file mode 100644
index 000000000000..2010cb74250f
--- /dev/null
+++ b/include/linux/netfilter/xt_rateest.h
@@ -0,0 +1,35 @@
1#ifndef _XT_RATEEST_MATCH_H
2#define _XT_RATEEST_MATCH_H
3
4enum xt_rateest_match_flags {
5 XT_RATEEST_MATCH_INVERT = 1<<0,
6 XT_RATEEST_MATCH_ABS = 1<<1,
7 XT_RATEEST_MATCH_REL = 1<<2,
8 XT_RATEEST_MATCH_DELTA = 1<<3,
9 XT_RATEEST_MATCH_BPS = 1<<4,
10 XT_RATEEST_MATCH_PPS = 1<<5,
11};
12
13enum xt_rateest_match_mode {
14 XT_RATEEST_MATCH_NONE,
15 XT_RATEEST_MATCH_EQ,
16 XT_RATEEST_MATCH_LT,
17 XT_RATEEST_MATCH_GT,
18};
19
20struct xt_rateest_match_info {
21 char name1[IFNAMSIZ];
22 char name2[IFNAMSIZ];
23 u_int16_t flags;
24 u_int16_t mode;
25 u_int32_t bps1;
26 u_int32_t pps1;
27 u_int32_t bps2;
28 u_int32_t pps2;
29
30 /* Used internally by the kernel */
31 struct xt_rateest *est1 __attribute__((aligned(8)));
32 struct xt_rateest *est2 __attribute__((aligned(8)));
33};
34
35#endif /* _XT_RATEEST_MATCH_H */
diff --git a/include/linux/netfilter/xt_statistic.h b/include/linux/netfilter/xt_statistic.h
index c344e9916e23..3d38bc975048 100644
--- a/include/linux/netfilter/xt_statistic.h
+++ b/include/linux/netfilter/xt_statistic.h
@@ -23,6 +23,7 @@ struct xt_statistic_info {
23 struct { 23 struct {
24 u_int32_t every; 24 u_int32_t every;
25 u_int32_t packet; 25 u_int32_t packet;
26 /* Used internally by the kernel */
26 u_int32_t count; 27 u_int32_t count;
27 } nth; 28 } nth;
28 } u; 29 } u;
diff --git a/include/linux/netfilter/xt_string.h b/include/linux/netfilter/xt_string.h
index 3b3419f2637d..bb21dd1aee2d 100644
--- a/include/linux/netfilter/xt_string.h
+++ b/include/linux/netfilter/xt_string.h
@@ -12,6 +12,8 @@ struct xt_string_info
12 char pattern[XT_STRING_MAX_PATTERN_SIZE]; 12 char pattern[XT_STRING_MAX_PATTERN_SIZE];
13 u_int8_t patlen; 13 u_int8_t patlen;
14 u_int8_t invert; 14 u_int8_t invert;
15
16 /* Used internally by the kernel */
15 struct ts_config __attribute__((aligned(8))) *config; 17 struct ts_config __attribute__((aligned(8))) *config;
16}; 18};
17 19
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index 2fc73fa8e37f..db223ca92c8b 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -217,21 +217,8 @@ static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e
217} 217}
218 218
219/* fn returns 0 to continue iteration */ 219/* fn returns 0 to continue iteration */
220#define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \ 220#define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \
221({ \ 221 XT_ENTRY_ITERATE(struct arpt_entry, entries, size, fn, ## args)
222 unsigned int __i; \
223 int __ret = 0; \
224 struct arpt_entry *__entry; \
225 \
226 for (__i = 0; __i < (size); __i += __entry->next_offset) { \
227 __entry = (void *)(entries) + __i; \
228 \
229 __ret = fn(__entry , ## args); \
230 if (__ret != 0) \
231 break; \
232 } \
233 __ret; \
234})
235 222
236/* 223/*
237 * Main firewall chains definitions and global var's definitions. 224 * Main firewall chains definitions and global var's definitions.
@@ -284,8 +271,9 @@ struct arpt_error
284 xt_register_target(tgt); }) 271 xt_register_target(tgt); })
285#define arpt_unregister_target(tgt) xt_unregister_target(tgt) 272#define arpt_unregister_target(tgt) xt_unregister_target(tgt)
286 273
287extern int arpt_register_table(struct arpt_table *table, 274extern struct arpt_table *arpt_register_table(struct net *net,
288 const struct arpt_replace *repl); 275 struct arpt_table *table,
276 const struct arpt_replace *repl);
289extern void arpt_unregister_table(struct arpt_table *table); 277extern void arpt_unregister_table(struct arpt_table *table);
290extern unsigned int arpt_do_table(struct sk_buff *skb, 278extern unsigned int arpt_do_table(struct sk_buff *skb,
291 unsigned int hook, 279 unsigned int hook,
@@ -293,6 +281,37 @@ extern unsigned int arpt_do_table(struct sk_buff *skb,
293 const struct net_device *out, 281 const struct net_device *out,
294 struct arpt_table *table); 282 struct arpt_table *table);
295 283
296#define ARPT_ALIGN(s) (((s) + (__alignof__(struct arpt_entry)-1)) & ~(__alignof__(struct arpt_entry)-1)) 284#define ARPT_ALIGN(s) XT_ALIGN(s)
285
286#ifdef CONFIG_COMPAT
287#include <net/compat.h>
288
289struct compat_arpt_entry
290{
291 struct arpt_arp arp;
292 u_int16_t target_offset;
293 u_int16_t next_offset;
294 compat_uint_t comefrom;
295 struct compat_xt_counters counters;
296 unsigned char elems[0];
297};
298
299static inline struct arpt_entry_target *
300compat_arpt_get_target(struct compat_arpt_entry *e)
301{
302 return (void *)e + e->target_offset;
303}
304
305#define COMPAT_ARPT_ALIGN(s) COMPAT_XT_ALIGN(s)
306
307/* fn returns 0 to continue iteration */
308#define COMPAT_ARPT_ENTRY_ITERATE(entries, size, fn, args...) \
309 XT_ENTRY_ITERATE(struct compat_arpt_entry, entries, size, fn, ## args)
310
311#define COMPAT_ARPT_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \
312 XT_ENTRY_ITERATE_CONTINUE(struct compat_arpt_entry, entries, size, n, \
313 fn, ## args)
314
315#endif /* CONFIG_COMPAT */
297#endif /*__KERNEL__*/ 316#endif /*__KERNEL__*/
298#endif /* _ARPTABLES_H */ 317#endif /* _ARPTABLES_H */
diff --git a/include/linux/netfilter_bridge.h b/include/linux/netfilter_bridge.h
index 533ee351a273..499aa9375901 100644
--- a/include/linux/netfilter_bridge.h
+++ b/include/linux/netfilter_bridge.h
@@ -50,7 +50,8 @@ enum nf_br_hook_priorities {
50extern int nf_bridge_copy_header(struct sk_buff *skb); 50extern int nf_bridge_copy_header(struct sk_buff *skb);
51static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb) 51static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
52{ 52{
53 if (skb->nf_bridge) 53 if (skb->nf_bridge &&
54 skb->nf_bridge->mask & (BRNF_BRIDGED | BRNF_BRIDGED_DNAT))
54 return nf_bridge_copy_header(skb); 55 return nf_bridge_copy_header(skb);
55 return 0; 56 return 0;
56} 57}
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index 1a63adf5c4c1..9a10092e358c 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -36,7 +36,6 @@
36#define NFC_IP_DST_PT 0x0400 36#define NFC_IP_DST_PT 0x0400
37/* Something else about the proto */ 37/* Something else about the proto */
38#define NFC_IP_PROTO_UNKNOWN 0x2000 38#define NFC_IP_PROTO_UNKNOWN 0x2000
39#endif /* ! __KERNEL__ */
40 39
41/* IP Hooks */ 40/* IP Hooks */
42/* After promisc drops, checksum checks. */ 41/* After promisc drops, checksum checks. */
@@ -50,6 +49,7 @@
50/* Packets about to hit the wire. */ 49/* Packets about to hit the wire. */
51#define NF_IP_POST_ROUTING 4 50#define NF_IP_POST_ROUTING 4
52#define NF_IP_NUMHOOKS 5 51#define NF_IP_NUMHOOKS 5
52#endif /* ! __KERNEL__ */
53 53
54enum nf_ip_hook_priorities { 54enum nf_ip_hook_priorities {
55 NF_IP_PRI_FIRST = INT_MIN, 55 NF_IP_PRI_FIRST = INT_MIN,
diff --git a/include/linux/netfilter_ipv4/Kbuild b/include/linux/netfilter_ipv4/Kbuild
index 7185792b900f..3a7105bb8f33 100644
--- a/include/linux/netfilter_ipv4/Kbuild
+++ b/include/linux/netfilter_ipv4/Kbuild
@@ -1,47 +1,47 @@
1header-y += ipt_addrtype.h
2header-y += ipt_ah.h
3header-y += ipt_CLASSIFY.h 1header-y += ipt_CLASSIFY.h
4header-y += ipt_CLUSTERIP.h 2header-y += ipt_CLUSTERIP.h
3header-y += ipt_CONNMARK.h
4header-y += ipt_DSCP.h
5header-y += ipt_ECN.h
6header-y += ipt_LOG.h
7header-y += ipt_MARK.h
8header-y += ipt_NFQUEUE.h
9header-y += ipt_REJECT.h
10header-y += ipt_SAME.h
11header-y += ipt_TCPMSS.h
12header-y += ipt_TOS.h
13header-y += ipt_TTL.h
14header-y += ipt_ULOG.h
15header-y += ipt_addrtype.h
16header-y += ipt_ah.h
5header-y += ipt_comment.h 17header-y += ipt_comment.h
6header-y += ipt_connbytes.h 18header-y += ipt_connbytes.h
7header-y += ipt_connmark.h 19header-y += ipt_connmark.h
8header-y += ipt_CONNMARK.h
9header-y += ipt_conntrack.h 20header-y += ipt_conntrack.h
10header-y += ipt_dccp.h 21header-y += ipt_dccp.h
11header-y += ipt_dscp.h 22header-y += ipt_dscp.h
12header-y += ipt_DSCP.h
13header-y += ipt_ecn.h 23header-y += ipt_ecn.h
14header-y += ipt_ECN.h
15header-y += ipt_esp.h 24header-y += ipt_esp.h
16header-y += ipt_hashlimit.h 25header-y += ipt_hashlimit.h
17header-y += ipt_helper.h 26header-y += ipt_helper.h
18header-y += ipt_iprange.h 27header-y += ipt_iprange.h
19header-y += ipt_length.h 28header-y += ipt_length.h
20header-y += ipt_limit.h 29header-y += ipt_limit.h
21header-y += ipt_LOG.h
22header-y += ipt_mac.h 30header-y += ipt_mac.h
23header-y += ipt_mark.h 31header-y += ipt_mark.h
24header-y += ipt_MARK.h
25header-y += ipt_multiport.h 32header-y += ipt_multiport.h
26header-y += ipt_NFQUEUE.h
27header-y += ipt_owner.h 33header-y += ipt_owner.h
28header-y += ipt_physdev.h 34header-y += ipt_physdev.h
29header-y += ipt_pkttype.h 35header-y += ipt_pkttype.h
30header-y += ipt_policy.h 36header-y += ipt_policy.h
31header-y += ipt_realm.h 37header-y += ipt_realm.h
32header-y += ipt_recent.h 38header-y += ipt_recent.h
33header-y += ipt_REJECT.h
34header-y += ipt_SAME.h
35header-y += ipt_sctp.h 39header-y += ipt_sctp.h
36header-y += ipt_state.h 40header-y += ipt_state.h
37header-y += ipt_string.h 41header-y += ipt_string.h
38header-y += ipt_tcpmss.h 42header-y += ipt_tcpmss.h
39header-y += ipt_TCPMSS.h
40header-y += ipt_tos.h 43header-y += ipt_tos.h
41header-y += ipt_TOS.h
42header-y += ipt_ttl.h 44header-y += ipt_ttl.h
43header-y += ipt_TTL.h
44header-y += ipt_ULOG.h
45 45
46unifdef-y += ip_queue.h 46unifdef-y += ip_queue.h
47unifdef-y += ip_tables.h 47unifdef-y += ip_tables.h
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index d79ed69cbc1f..bfc889f90276 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -156,10 +156,10 @@ struct ipt_getinfo
156 unsigned int valid_hooks; 156 unsigned int valid_hooks;
157 157
158 /* Hook entry points: one per netfilter hook. */ 158 /* Hook entry points: one per netfilter hook. */
159 unsigned int hook_entry[NF_IP_NUMHOOKS]; 159 unsigned int hook_entry[NF_INET_NUMHOOKS];
160 160
161 /* Underflow points. */ 161 /* Underflow points. */
162 unsigned int underflow[NF_IP_NUMHOOKS]; 162 unsigned int underflow[NF_INET_NUMHOOKS];
163 163
164 /* Number of entries */ 164 /* Number of entries */
165 unsigned int num_entries; 165 unsigned int num_entries;
@@ -185,10 +185,10 @@ struct ipt_replace
185 unsigned int size; 185 unsigned int size;
186 186
187 /* Hook entry points. */ 187 /* Hook entry points. */
188 unsigned int hook_entry[NF_IP_NUMHOOKS]; 188 unsigned int hook_entry[NF_INET_NUMHOOKS];
189 189
190 /* Underflow points. */ 190 /* Underflow points. */
191 unsigned int underflow[NF_IP_NUMHOOKS]; 191 unsigned int underflow[NF_INET_NUMHOOKS];
192 192
193 /* Information about old entries: */ 193 /* Information about old entries: */
194 /* Number of counters (must be equal to current number of entries). */ 194 /* Number of counters (must be equal to current number of entries). */
@@ -229,60 +229,12 @@ ipt_get_target(struct ipt_entry *e)
229} 229}
230 230
231/* fn returns 0 to continue iteration */ 231/* fn returns 0 to continue iteration */
232#define IPT_MATCH_ITERATE(e, fn, args...) \ 232#define IPT_MATCH_ITERATE(e, fn, args...) \
233({ \ 233 XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args)
234 unsigned int __i; \
235 int __ret = 0; \
236 struct ipt_entry_match *__match; \
237 \
238 for (__i = sizeof(struct ipt_entry); \
239 __i < (e)->target_offset; \
240 __i += __match->u.match_size) { \
241 __match = (void *)(e) + __i; \
242 \
243 __ret = fn(__match , ## args); \
244 if (__ret != 0) \
245 break; \
246 } \
247 __ret; \
248})
249 234
250/* fn returns 0 to continue iteration */ 235/* fn returns 0 to continue iteration */
251#define IPT_ENTRY_ITERATE(entries, size, fn, args...) \ 236#define IPT_ENTRY_ITERATE(entries, size, fn, args...) \
252({ \ 237 XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args)
253 unsigned int __i; \
254 int __ret = 0; \
255 struct ipt_entry *__entry; \
256 \
257 for (__i = 0; __i < (size); __i += __entry->next_offset) { \
258 __entry = (void *)(entries) + __i; \
259 \
260 __ret = fn(__entry , ## args); \
261 if (__ret != 0) \
262 break; \
263 } \
264 __ret; \
265})
266
267/* fn returns 0 to continue iteration */
268#define IPT_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \
269({ \
270 unsigned int __i, __n; \
271 int __ret = 0; \
272 struct ipt_entry *__entry; \
273 \
274 for (__i = 0, __n = 0; __i < (size); \
275 __i += __entry->next_offset, __n++) { \
276 __entry = (void *)(entries) + __i; \
277 if (__n < n) \
278 continue; \
279 \
280 __ret = fn(__entry , ## args); \
281 if (__ret != 0) \
282 break; \
283 } \
284 __ret; \
285})
286 238
287/* 239/*
288 * Main firewall chains definitions and global var's definitions. 240 * Main firewall chains definitions and global var's definitions.
@@ -292,8 +244,9 @@ ipt_get_target(struct ipt_entry *e)
292#include <linux/init.h> 244#include <linux/init.h>
293extern void ipt_init(void) __init; 245extern void ipt_init(void) __init;
294 246
295extern int ipt_register_table(struct xt_table *table, 247extern struct xt_table *ipt_register_table(struct net *net,
296 const struct ipt_replace *repl); 248 struct xt_table *table,
249 const struct ipt_replace *repl);
297extern void ipt_unregister_table(struct xt_table *table); 250extern void ipt_unregister_table(struct xt_table *table);
298 251
299/* Standard entry. */ 252/* Standard entry. */
@@ -359,8 +312,28 @@ struct compat_ipt_entry
359 unsigned char elems[0]; 312 unsigned char elems[0];
360}; 313};
361 314
315/* Helper functions */
316static inline struct ipt_entry_target *
317compat_ipt_get_target(struct compat_ipt_entry *e)
318{
319 return (void *)e + e->target_offset;
320}
321
362#define COMPAT_IPT_ALIGN(s) COMPAT_XT_ALIGN(s) 322#define COMPAT_IPT_ALIGN(s) COMPAT_XT_ALIGN(s)
363 323
324/* fn returns 0 to continue iteration */
325#define COMPAT_IPT_MATCH_ITERATE(e, fn, args...) \
326 XT_MATCH_ITERATE(struct compat_ipt_entry, e, fn, ## args)
327
328/* fn returns 0 to continue iteration */
329#define COMPAT_IPT_ENTRY_ITERATE(entries, size, fn, args...) \
330 XT_ENTRY_ITERATE(struct compat_ipt_entry, entries, size, fn, ## args)
331
332/* fn returns 0 to continue iteration */
333#define COMPAT_IPT_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \
334 XT_ENTRY_ITERATE_CONTINUE(struct compat_ipt_entry, entries, size, n, \
335 fn, ## args)
336
364#endif /* CONFIG_COMPAT */ 337#endif /* CONFIG_COMPAT */
365#endif /*__KERNEL__*/ 338#endif /*__KERNEL__*/
366#endif /* _IPTABLES_H */ 339#endif /* _IPTABLES_H */
diff --git a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h b/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
index daf50be22c9d..e5a3687c8a72 100644
--- a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
+++ b/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h
@@ -27,6 +27,7 @@ struct ipt_clusterip_tgt_info {
27 u_int32_t hash_mode; 27 u_int32_t hash_mode;
28 u_int32_t hash_initval; 28 u_int32_t hash_initval;
29 29
30 /* Used internally by the kernel */
30 struct clusterip_config *config; 31 struct clusterip_config *config;
31}; 32};
32 33
diff --git a/include/linux/netfilter_ipv4/ipt_addrtype.h b/include/linux/netfilter_ipv4/ipt_addrtype.h
index 166ed01a8122..446de6aef983 100644
--- a/include/linux/netfilter_ipv4/ipt_addrtype.h
+++ b/include/linux/netfilter_ipv4/ipt_addrtype.h
@@ -1,6 +1,20 @@
1#ifndef _IPT_ADDRTYPE_H 1#ifndef _IPT_ADDRTYPE_H
2#define _IPT_ADDRTYPE_H 2#define _IPT_ADDRTYPE_H
3 3
4enum {
5 IPT_ADDRTYPE_INVERT_SOURCE = 0x0001,
6 IPT_ADDRTYPE_INVERT_DEST = 0x0002,
7 IPT_ADDRTYPE_LIMIT_IFACE_IN = 0x0004,
8 IPT_ADDRTYPE_LIMIT_IFACE_OUT = 0x0008,
9};
10
11struct ipt_addrtype_info_v1 {
12 u_int16_t source; /* source-type mask */
13 u_int16_t dest; /* dest-type mask */
14 u_int32_t flags;
15};
16
17/* revision 0 */
4struct ipt_addrtype_info { 18struct ipt_addrtype_info {
5 u_int16_t source; /* source-type mask */ 19 u_int16_t source; /* source-type mask */
6 u_int16_t dest; /* dest-type mask */ 20 u_int16_t dest; /* dest-type mask */
diff --git a/include/linux/netfilter_ipv4/ipt_iprange.h b/include/linux/netfilter_ipv4/ipt_iprange.h
index a92fefc3c7ec..5f1aebde4d2f 100644
--- a/include/linux/netfilter_ipv4/ipt_iprange.h
+++ b/include/linux/netfilter_ipv4/ipt_iprange.h
@@ -2,11 +2,7 @@
2#define _IPT_IPRANGE_H 2#define _IPT_IPRANGE_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5#include <linux/netfilter/xt_iprange.h>
6#define IPRANGE_SRC 0x01 /* Match source IP address */
7#define IPRANGE_DST 0x02 /* Match destination IP address */
8#define IPRANGE_SRC_INV 0x10 /* Negate the condition */
9#define IPRANGE_DST_INV 0x20 /* Negate the condition */
10 6
11struct ipt_iprange { 7struct ipt_iprange {
12 /* Inclusive: network order. */ 8 /* Inclusive: network order. */
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h
index 66ca8e3100dc..3475a65dae9b 100644
--- a/include/linux/netfilter_ipv6.h
+++ b/include/linux/netfilter_ipv6.h
@@ -40,8 +40,6 @@
40#define NFC_IP6_DST_PT 0x0400 40#define NFC_IP6_DST_PT 0x0400
41/* Something else about the proto */ 41/* Something else about the proto */
42#define NFC_IP6_PROTO_UNKNOWN 0x2000 42#define NFC_IP6_PROTO_UNKNOWN 0x2000
43#endif /* ! __KERNEL__ */
44
45 43
46/* IP6 Hooks */ 44/* IP6 Hooks */
47/* After promisc drops, checksum checks. */ 45/* After promisc drops, checksum checks. */
@@ -55,6 +53,7 @@
55/* Packets about to hit the wire. */ 53/* Packets about to hit the wire. */
56#define NF_IP6_POST_ROUTING 4 54#define NF_IP6_POST_ROUTING 4
57#define NF_IP6_NUMHOOKS 5 55#define NF_IP6_NUMHOOKS 5
56#endif /* ! __KERNEL__ */
58 57
59 58
60enum nf_ip6_hook_priorities { 59enum nf_ip6_hook_priorities {
diff --git a/include/linux/netfilter_ipv6/Kbuild b/include/linux/netfilter_ipv6/Kbuild
index 9dd978d149ff..8887a5fcd1d0 100644
--- a/include/linux/netfilter_ipv6/Kbuild
+++ b/include/linux/netfilter_ipv6/Kbuild
@@ -14,8 +14,8 @@ header-y += ip6t_mark.h
14header-y += ip6t_multiport.h 14header-y += ip6t_multiport.h
15header-y += ip6t_opts.h 15header-y += ip6t_opts.h
16header-y += ip6t_owner.h 16header-y += ip6t_owner.h
17header-y += ip6t_policy.h
18header-y += ip6t_physdev.h 17header-y += ip6t_physdev.h
18header-y += ip6t_policy.h
19header-y += ip6t_rt.h 19header-y += ip6t_rt.h
20 20
21unifdef-y += ip6_tables.h 21unifdef-y += ip6_tables.h
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 7dc481ce7cba..f2507dcc5750 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -216,10 +216,10 @@ struct ip6t_getinfo
216 unsigned int valid_hooks; 216 unsigned int valid_hooks;
217 217
218 /* Hook entry points: one per netfilter hook. */ 218 /* Hook entry points: one per netfilter hook. */
219 unsigned int hook_entry[NF_IP6_NUMHOOKS]; 219 unsigned int hook_entry[NF_INET_NUMHOOKS];
220 220
221 /* Underflow points. */ 221 /* Underflow points. */
222 unsigned int underflow[NF_IP6_NUMHOOKS]; 222 unsigned int underflow[NF_INET_NUMHOOKS];
223 223
224 /* Number of entries */ 224 /* Number of entries */
225 unsigned int num_entries; 225 unsigned int num_entries;
@@ -245,10 +245,10 @@ struct ip6t_replace
245 unsigned int size; 245 unsigned int size;
246 246
247 /* Hook entry points. */ 247 /* Hook entry points. */
248 unsigned int hook_entry[NF_IP6_NUMHOOKS]; 248 unsigned int hook_entry[NF_INET_NUMHOOKS];
249 249
250 /* Underflow points. */ 250 /* Underflow points. */
251 unsigned int underflow[NF_IP6_NUMHOOKS]; 251 unsigned int underflow[NF_INET_NUMHOOKS];
252 252
253 /* Information about old entries: */ 253 /* Information about old entries: */
254 /* Number of counters (must be equal to current number of entries). */ 254 /* Number of counters (must be equal to current number of entries). */
@@ -289,40 +289,12 @@ ip6t_get_target(struct ip6t_entry *e)
289} 289}
290 290
291/* fn returns 0 to continue iteration */ 291/* fn returns 0 to continue iteration */
292#define IP6T_MATCH_ITERATE(e, fn, args...) \ 292#define IP6T_MATCH_ITERATE(e, fn, args...) \
293({ \ 293 XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args)
294 unsigned int __i; \
295 int __ret = 0; \
296 struct ip6t_entry_match *__m; \
297 \
298 for (__i = sizeof(struct ip6t_entry); \
299 __i < (e)->target_offset; \
300 __i += __m->u.match_size) { \
301 __m = (void *)(e) + __i; \
302 \
303 __ret = fn(__m , ## args); \
304 if (__ret != 0) \
305 break; \
306 } \
307 __ret; \
308})
309 294
310/* fn returns 0 to continue iteration */ 295/* fn returns 0 to continue iteration */
311#define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \ 296#define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \
312({ \ 297 XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args)
313 unsigned int __i; \
314 int __ret = 0; \
315 struct ip6t_entry *__e; \
316 \
317 for (__i = 0; __i < (size); __i += __e->next_offset) { \
318 __e = (void *)(entries) + __i; \
319 \
320 __ret = fn(__e , ## args); \
321 if (__ret != 0) \
322 break; \
323 } \
324 __ret; \
325})
326 298
327/* 299/*
328 * Main firewall chains definitions and global var's definitions. 300 * Main firewall chains definitions and global var's definitions.
@@ -333,8 +305,9 @@ ip6t_get_target(struct ip6t_entry *e)
333#include <linux/init.h> 305#include <linux/init.h>
334extern void ip6t_init(void) __init; 306extern void ip6t_init(void) __init;
335 307
336extern int ip6t_register_table(struct xt_table *table, 308extern struct xt_table *ip6t_register_table(struct net *net,
337 const struct ip6t_replace *repl); 309 struct xt_table *table,
310 const struct ip6t_replace *repl);
338extern void ip6t_unregister_table(struct xt_table *table); 311extern void ip6t_unregister_table(struct xt_table *table);
339extern unsigned int ip6t_do_table(struct sk_buff *skb, 312extern unsigned int ip6t_do_table(struct sk_buff *skb,
340 unsigned int hook, 313 unsigned int hook,
@@ -352,7 +325,42 @@ extern int ip6_masked_addrcmp(const struct in6_addr *addr1,
352 const struct in6_addr *mask, 325 const struct in6_addr *mask,
353 const struct in6_addr *addr2); 326 const struct in6_addr *addr2);
354 327
355#define IP6T_ALIGN(s) (((s) + (__alignof__(struct ip6t_entry)-1)) & ~(__alignof__(struct ip6t_entry)-1)) 328#define IP6T_ALIGN(s) XT_ALIGN(s)
356 329
330#ifdef CONFIG_COMPAT
331#include <net/compat.h>
332
333struct compat_ip6t_entry
334{
335 struct ip6t_ip6 ipv6;
336 compat_uint_t nfcache;
337 u_int16_t target_offset;
338 u_int16_t next_offset;
339 compat_uint_t comefrom;
340 struct compat_xt_counters counters;
341 unsigned char elems[0];
342};
343
344static inline struct ip6t_entry_target *
345compat_ip6t_get_target(struct compat_ip6t_entry *e)
346{
347 return (void *)e + e->target_offset;
348}
349
350#define COMPAT_IP6T_ALIGN(s) COMPAT_XT_ALIGN(s)
351
352/* fn returns 0 to continue iteration */
353#define COMPAT_IP6T_MATCH_ITERATE(e, fn, args...) \
354 XT_MATCH_ITERATE(struct compat_ip6t_entry, e, fn, ## args)
355
356/* fn returns 0 to continue iteration */
357#define COMPAT_IP6T_ENTRY_ITERATE(entries, size, fn, args...) \
358 XT_ENTRY_ITERATE(struct compat_ip6t_entry, entries, size, fn, ## args)
359
360#define COMPAT_IP6T_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \
361 XT_ENTRY_ITERATE_CONTINUE(struct compat_ip6t_entry, entries, size, n, \
362 fn, ## args)
363
364#endif /* CONFIG_COMPAT */
357#endif /*__KERNEL__*/ 365#endif /*__KERNEL__*/
358#endif /* _IP6_TABLES_H */ 366#endif /* _IP6_TABLES_H */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 7c1f3b1d2ee5..fb0713b6ffaf 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -178,6 +178,7 @@ extern struct sock *netlink_kernel_create(struct net *net,
178 void (*input)(struct sk_buff *skb), 178 void (*input)(struct sk_buff *skb),
179 struct mutex *cb_mutex, 179 struct mutex *cb_mutex,
180 struct module *module); 180 struct module *module);
181extern void netlink_kernel_release(struct sock *sk);
181extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); 182extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);
182extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group); 183extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group);
183extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 184extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
@@ -192,7 +193,7 @@ extern int netlink_unregister_notifier(struct notifier_block *nb);
192/* finegrained unicast helpers: */ 193/* finegrained unicast helpers: */
193struct sock *netlink_getsockbyfilp(struct file *filp); 194struct sock *netlink_getsockbyfilp(struct file *filp);
194int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, 195int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock,
195 long timeo, struct sock *ssk); 196 long *timeo, struct sock *ssk);
196void netlink_detachskb(struct sock *sk, struct sk_buff *skb); 197void netlink_detachskb(struct sock *sk, struct sk_buff *skb);
197int netlink_sendskb(struct sock *sk, struct sk_buff *skb); 198int netlink_sendskb(struct sock *sk, struct sk_buff *skb);
198 199
@@ -218,7 +219,7 @@ struct netlink_callback
218 int (*dump)(struct sk_buff * skb, struct netlink_callback *cb); 219 int (*dump)(struct sk_buff * skb, struct netlink_callback *cb);
219 int (*done)(struct netlink_callback *cb); 220 int (*done)(struct netlink_callback *cb);
220 int family; 221 int family;
221 long args[5]; 222 long args[6];
222}; 223};
223 224
224struct netlink_notify 225struct netlink_notify
@@ -245,7 +246,7 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
245} 246}
246 247
247#define NLMSG_NEW(skb, pid, seq, type, len, flags) \ 248#define NLMSG_NEW(skb, pid, seq, type, len, flags) \
248({ if (skb_tailroom(skb) < (int)NLMSG_SPACE(len)) \ 249({ if (unlikely(skb_tailroom(skb) < (int)NLMSG_SPACE(len))) \
249 goto nlmsg_failure; \ 250 goto nlmsg_failure; \
250 __nlmsg_put(skb, pid, seq, type, len, flags); }) 251 __nlmsg_put(skb, pid, seq, type, len, flags); })
251 252
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index 20250d963d72..a0525a1f4715 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -20,12 +20,11 @@ struct netpoll {
20 20
21 u32 local_ip, remote_ip; 21 u32 local_ip, remote_ip;
22 u16 local_port, remote_port; 22 u16 local_port, remote_port;
23 u8 local_mac[ETH_ALEN], remote_mac[ETH_ALEN]; 23 u8 remote_mac[ETH_ALEN];
24}; 24};
25 25
26struct netpoll_info { 26struct netpoll_info {
27 atomic_t refcnt; 27 atomic_t refcnt;
28 int rx_flags;
29 spinlock_t rx_lock; 28 spinlock_t rx_lock;
30 struct netpoll *rx_np; /* netpoll that registered an rx_hook */ 29 struct netpoll *rx_np; /* netpoll that registered an rx_hook */
31 struct sk_buff_head arp_tx; /* list of arp requests to reply to */ 30 struct sk_buff_head arp_tx; /* list of arp requests to reply to */
@@ -51,12 +50,12 @@ static inline int netpoll_rx(struct sk_buff *skb)
51 unsigned long flags; 50 unsigned long flags;
52 int ret = 0; 51 int ret = 0;
53 52
54 if (!npinfo || (!npinfo->rx_np && !npinfo->rx_flags)) 53 if (!npinfo || !npinfo->rx_np)
55 return 0; 54 return 0;
56 55
57 spin_lock_irqsave(&npinfo->rx_lock, flags); 56 spin_lock_irqsave(&npinfo->rx_lock, flags);
58 /* check rx_flags again with the lock held */ 57 /* check rx_np again with the lock held */
59 if (npinfo->rx_flags && __netpoll_rx(skb)) 58 if (npinfo->rx_np && __netpoll_rx(skb))
60 ret = 1; 59 ret = 1;
61 spin_unlock_irqrestore(&npinfo->rx_lock, flags); 60 spin_unlock_irqrestore(&npinfo->rx_lock, flags);
62 61
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index e82a6ebc725d..a69ba80f2dfe 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -196,28 +196,67 @@ struct nfs_inode {
196#define NFS_INO_STALE (2) /* possible stale inode */ 196#define NFS_INO_STALE (2) /* possible stale inode */
197#define NFS_INO_ACL_LRU_SET (3) /* Inode is on the LRU list */ 197#define NFS_INO_ACL_LRU_SET (3) /* Inode is on the LRU list */
198 198
199static inline struct nfs_inode *NFS_I(struct inode *inode) 199static inline struct nfs_inode *NFS_I(const struct inode *inode)
200{ 200{
201 return container_of(inode, struct nfs_inode, vfs_inode); 201 return container_of(inode, struct nfs_inode, vfs_inode);
202} 202}
203#define NFS_SB(s) ((struct nfs_server *)(s->s_fs_info))
204 203
205#define NFS_FH(inode) (&NFS_I(inode)->fh) 204static inline struct nfs_server *NFS_SB(const struct super_block *s)
206#define NFS_SERVER(inode) (NFS_SB(inode->i_sb)) 205{
207#define NFS_CLIENT(inode) (NFS_SERVER(inode)->client) 206 return (struct nfs_server *)(s->s_fs_info);
208#define NFS_PROTO(inode) (NFS_SERVER(inode)->nfs_client->rpc_ops) 207}
209#define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf) 208
210#define NFS_MINATTRTIMEO(inode) \ 209static inline struct nfs_fh *NFS_FH(const struct inode *inode)
211 (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmin \ 210{
212 : NFS_SERVER(inode)->acregmin) 211 return &NFS_I(inode)->fh;
213#define NFS_MAXATTRTIMEO(inode) \ 212}
214 (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmax \ 213
215 : NFS_SERVER(inode)->acregmax) 214static inline struct nfs_server *NFS_SERVER(const struct inode *inode)
215{
216 return NFS_SB(inode->i_sb);
217}
218
219static inline struct rpc_clnt *NFS_CLIENT(const struct inode *inode)
220{
221 return NFS_SERVER(inode)->client;
222}
223
224static inline const struct nfs_rpc_ops *NFS_PROTO(const struct inode *inode)
225{
226 return NFS_SERVER(inode)->nfs_client->rpc_ops;
227}
228
229static inline __be32 *NFS_COOKIEVERF(const struct inode *inode)
230{
231 return NFS_I(inode)->cookieverf;
232}
233
234static inline unsigned NFS_MINATTRTIMEO(const struct inode *inode)
235{
236 struct nfs_server *nfss = NFS_SERVER(inode);
237 return S_ISDIR(inode->i_mode) ? nfss->acdirmin : nfss->acregmin;
238}
216 239
217#define NFS_FLAGS(inode) (NFS_I(inode)->flags) 240static inline unsigned NFS_MAXATTRTIMEO(const struct inode *inode)
218#define NFS_STALE(inode) (test_bit(NFS_INO_STALE, &NFS_FLAGS(inode))) 241{
242 struct nfs_server *nfss = NFS_SERVER(inode);
243 return S_ISDIR(inode->i_mode) ? nfss->acdirmax : nfss->acregmax;
244}
219 245
220#define NFS_FILEID(inode) (NFS_I(inode)->fileid) 246static inline int NFS_STALE(const struct inode *inode)
247{
248 return test_bit(NFS_INO_STALE, &NFS_I(inode)->flags);
249}
250
251static inline __u64 NFS_FILEID(const struct inode *inode)
252{
253 return NFS_I(inode)->fileid;
254}
255
256static inline void set_nfs_fileid(struct inode *inode, __u64 fileid)
257{
258 NFS_I(inode)->fileid = fileid;
259}
221 260
222static inline void nfs_mark_for_revalidate(struct inode *inode) 261static inline void nfs_mark_for_revalidate(struct inode *inode)
223{ 262{
@@ -237,7 +276,7 @@ static inline int nfs_server_capable(struct inode *inode, int cap)
237 276
238static inline int NFS_USE_READDIRPLUS(struct inode *inode) 277static inline int NFS_USE_READDIRPLUS(struct inode *inode)
239{ 278{
240 return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_FLAGS(inode)); 279 return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_I(inode)->flags);
241} 280}
242 281
243static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf) 282static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf)
@@ -366,6 +405,7 @@ extern const struct inode_operations nfs3_dir_inode_operations;
366extern const struct file_operations nfs_dir_operations; 405extern const struct file_operations nfs_dir_operations;
367extern struct dentry_operations nfs_dentry_operations; 406extern struct dentry_operations nfs_dentry_operations;
368 407
408extern void nfs_force_lookup_revalidate(struct inode *dir);
369extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); 409extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr);
370extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags); 410extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags);
371extern void nfs_access_zap_cache(struct inode *inode); 411extern void nfs_access_zap_cache(struct inode *inode);
@@ -422,7 +462,6 @@ extern long nfs_sync_mapping_wait(struct address_space *, struct writeback_contr
422extern int nfs_wb_all(struct inode *inode); 462extern int nfs_wb_all(struct inode *inode);
423extern int nfs_wb_nocommit(struct inode *inode); 463extern int nfs_wb_nocommit(struct inode *inode);
424extern int nfs_wb_page(struct inode *inode, struct page* page); 464extern int nfs_wb_page(struct inode *inode, struct page* page);
425extern int nfs_wb_page_priority(struct inode *inode, struct page* page, int how);
426extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); 465extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
427#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 466#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
428extern int nfs_commit_inode(struct inode *, int); 467extern int nfs_commit_inode(struct inode *, int);
@@ -517,14 +556,7 @@ extern void * nfs_root_data(void);
517 556
518#define nfs_wait_event(clnt, wq, condition) \ 557#define nfs_wait_event(clnt, wq, condition) \
519({ \ 558({ \
520 int __retval = 0; \ 559 int __retval = wait_event_killable(wq, condition); \
521 if (clnt->cl_intr) { \
522 sigset_t oldmask; \
523 rpc_clnt_sigmask(clnt, &oldmask); \
524 __retval = wait_event_interruptible(wq, condition); \
525 rpc_clnt_sigunmask(clnt, &oldmask); \
526 } else \
527 wait_event(wq, condition); \
528 __retval; \ 560 __retval; \
529}) 561})
530 562
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 0cac49bc0955..3423c6761bf7 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -3,8 +3,12 @@
3 3
4#include <linux/list.h> 4#include <linux/list.h>
5#include <linux/backing-dev.h> 5#include <linux/backing-dev.h>
6#include <linux/wait.h>
7
8#include <asm/atomic.h>
6 9
7struct nfs_iostats; 10struct nfs_iostats;
11struct nlm_host;
8 12
9/* 13/*
10 * The nfs_client identifies our client state to the server. 14 * The nfs_client identifies our client state to the server.
@@ -14,20 +18,19 @@ struct nfs_client {
14 int cl_cons_state; /* current construction state (-ve: init error) */ 18 int cl_cons_state; /* current construction state (-ve: init error) */
15#define NFS_CS_READY 0 /* ready to be used */ 19#define NFS_CS_READY 0 /* ready to be used */
16#define NFS_CS_INITING 1 /* busy initialising */ 20#define NFS_CS_INITING 1 /* busy initialising */
17 int cl_nfsversion; /* NFS protocol version */
18 unsigned long cl_res_state; /* NFS resources state */ 21 unsigned long cl_res_state; /* NFS resources state */
19#define NFS_CS_CALLBACK 1 /* - callback started */ 22#define NFS_CS_CALLBACK 1 /* - callback started */
20#define NFS_CS_IDMAP 2 /* - idmap started */ 23#define NFS_CS_IDMAP 2 /* - idmap started */
21#define NFS_CS_RENEWD 3 /* - renewd started */ 24#define NFS_CS_RENEWD 3 /* - renewd started */
22 struct sockaddr_in cl_addr; /* server identifier */ 25 struct sockaddr_storage cl_addr; /* server identifier */
26 size_t cl_addrlen;
23 char * cl_hostname; /* hostname of server */ 27 char * cl_hostname; /* hostname of server */
24 struct list_head cl_share_link; /* link in global client list */ 28 struct list_head cl_share_link; /* link in global client list */
25 struct list_head cl_superblocks; /* List of nfs_server structs */ 29 struct list_head cl_superblocks; /* List of nfs_server structs */
26 30
27 struct rpc_clnt * cl_rpcclient; 31 struct rpc_clnt * cl_rpcclient;
28 const struct nfs_rpc_ops *rpc_ops; /* NFS protocol vector */ 32 const struct nfs_rpc_ops *rpc_ops; /* NFS protocol vector */
29 unsigned long retrans_timeo; /* retransmit timeout */ 33 int cl_proto; /* Network transport protocol */
30 unsigned int retrans_count; /* number of retransmit tries */
31 34
32#ifdef CONFIG_NFS_V4 35#ifdef CONFIG_NFS_V4
33 u64 cl_clientid; /* constant */ 36 u64 cl_clientid; /* constant */
@@ -62,7 +65,7 @@ struct nfs_client {
62 /* Our own IP address, as a null-terminated string. 65 /* Our own IP address, as a null-terminated string.
63 * This is used to generate the clientid, and the callback address. 66 * This is used to generate the clientid, and the callback address.
64 */ 67 */
65 char cl_ipaddr[16]; 68 char cl_ipaddr[48];
66 unsigned char cl_id_uniquifier; 69 unsigned char cl_id_uniquifier;
67#endif 70#endif
68}; 71};
@@ -78,6 +81,7 @@ struct nfs_server {
78 struct list_head master_link; /* link in master servers list */ 81 struct list_head master_link; /* link in master servers list */
79 struct rpc_clnt * client; /* RPC client handle */ 82 struct rpc_clnt * client; /* RPC client handle */
80 struct rpc_clnt * client_acl; /* ACL RPC client handle */ 83 struct rpc_clnt * client_acl; /* ACL RPC client handle */
84 struct nlm_host *nlm_host; /* NLM client handle */
81 struct nfs_iostats * io_stats; /* I/O statistics */ 85 struct nfs_iostats * io_stats; /* I/O statistics */
82 struct backing_dev_info backing_dev_info; 86 struct backing_dev_info backing_dev_info;
83 atomic_long_t writeback; /* number of writeback pages */ 87 atomic_long_t writeback; /* number of writeback pages */
@@ -110,6 +114,9 @@ struct nfs_server {
110 filesystem */ 114 filesystem */
111#endif 115#endif
112 void (*destroy)(struct nfs_server *); 116 void (*destroy)(struct nfs_server *);
117
118 atomic_t active; /* Keep trace of any activity to this server */
119 wait_queue_head_t active_wq; /* Wait for any activity to stop */
113}; 120};
114 121
115/* Server capabilities */ 122/* Server capabilities */
diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h
index a3ade89a64d2..df7c6b7a7ebb 100644
--- a/include/linux/nfs_mount.h
+++ b/include/linux/nfs_mount.h
@@ -48,7 +48,7 @@ struct nfs_mount_data {
48/* bits in the flags field */ 48/* bits in the flags field */
49 49
50#define NFS_MOUNT_SOFT 0x0001 /* 1 */ 50#define NFS_MOUNT_SOFT 0x0001 /* 1 */
51#define NFS_MOUNT_INTR 0x0002 /* 1 */ 51#define NFS_MOUNT_INTR 0x0002 /* 1 */ /* now unused, but ABI */
52#define NFS_MOUNT_SECURE 0x0004 /* 1 */ 52#define NFS_MOUNT_SECURE 0x0004 /* 1 */
53#define NFS_MOUNT_POSIX 0x0008 /* 1 */ 53#define NFS_MOUNT_POSIX 0x0008 /* 1 */
54#define NFS_MOUNT_NOCTO 0x0010 /* 1 */ 54#define NFS_MOUNT_NOCTO 0x0010 /* 1 */
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 30dbcc185e69..a1676e19e491 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -83,6 +83,7 @@ extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc);
83extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t); 83extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t);
84extern int nfs_wait_on_request(struct nfs_page *); 84extern int nfs_wait_on_request(struct nfs_page *);
85extern void nfs_unlock_request(struct nfs_page *req); 85extern void nfs_unlock_request(struct nfs_page *req);
86extern int nfs_set_page_tag_locked(struct nfs_page *req);
86extern void nfs_clear_page_tag_locked(struct nfs_page *req); 87extern void nfs_clear_page_tag_locked(struct nfs_page *req);
87 88
88 89
@@ -95,18 +96,6 @@ nfs_lock_request_dontget(struct nfs_page *req)
95 return !test_and_set_bit(PG_BUSY, &req->wb_flags); 96 return !test_and_set_bit(PG_BUSY, &req->wb_flags);
96} 97}
97 98
98/*
99 * Lock the page of an asynchronous request and take a reference
100 */
101static inline int
102nfs_lock_request(struct nfs_page *req)
103{
104 if (test_and_set_bit(PG_BUSY, &req->wb_flags))
105 return 0;
106 kref_get(&req->wb_kref);
107 return 1;
108}
109
110/** 99/**
111 * nfs_list_add_request - Insert a request into a list 100 * nfs_list_add_request - Insert a request into a list
112 * @req: request 101 * @req: request
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index daab252f2e5c..f301d0b8babc 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -666,16 +666,17 @@ struct nfs4_rename_res {
666 struct nfs_fattr * new_fattr; 666 struct nfs_fattr * new_fattr;
667}; 667};
668 668
669#define NFS4_SETCLIENTID_NAMELEN (56)
669struct nfs4_setclientid { 670struct nfs4_setclientid {
670 const nfs4_verifier * sc_verifier; /* request */ 671 const nfs4_verifier * sc_verifier;
671 unsigned int sc_name_len; 672 unsigned int sc_name_len;
672 char sc_name[48]; /* request */ 673 char sc_name[NFS4_SETCLIENTID_NAMELEN];
673 u32 sc_prog; /* request */ 674 u32 sc_prog;
674 unsigned int sc_netid_len; 675 unsigned int sc_netid_len;
675 char sc_netid[4]; /* request */ 676 char sc_netid[RPCBIND_MAXNETIDLEN];
676 unsigned int sc_uaddr_len; 677 unsigned int sc_uaddr_len;
677 char sc_uaddr[24]; /* request */ 678 char sc_uaddr[RPCBIND_MAXUADDRLEN];
678 u32 sc_cb_ident; /* request */ 679 u32 sc_cb_ident;
679}; 680};
680 681
681struct nfs4_statfs_arg { 682struct nfs4_statfs_arg {
@@ -773,7 +774,7 @@ struct nfs_access_entry;
773 * RPC procedure vector for NFSv2/NFSv3 demuxing 774 * RPC procedure vector for NFSv2/NFSv3 demuxing
774 */ 775 */
775struct nfs_rpc_ops { 776struct nfs_rpc_ops {
776 int version; /* Protocol version */ 777 u32 version; /* Protocol version */
777 struct dentry_operations *dentry_ops; 778 struct dentry_operations *dentry_ops;
778 const struct inode_operations *dir_inode_ops; 779 const struct inode_operations *dir_inode_ops;
779 const struct inode_operations *file_inode_ops; 780 const struct inode_operations *file_inode_ops;
@@ -816,11 +817,11 @@ struct nfs_rpc_ops {
816 struct nfs_pathconf *); 817 struct nfs_pathconf *);
817 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); 818 int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
818 __be32 *(*decode_dirent)(__be32 *, struct nfs_entry *, int plus); 819 __be32 *(*decode_dirent)(__be32 *, struct nfs_entry *, int plus);
819 void (*read_setup) (struct nfs_read_data *); 820 void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
820 int (*read_done) (struct rpc_task *, struct nfs_read_data *); 821 int (*read_done) (struct rpc_task *, struct nfs_read_data *);
821 void (*write_setup) (struct nfs_write_data *, int how); 822 void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
822 int (*write_done) (struct rpc_task *, struct nfs_write_data *); 823 int (*write_done) (struct rpc_task *, struct nfs_write_data *);
823 void (*commit_setup) (struct nfs_write_data *, int how); 824 void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
824 int (*commit_done) (struct rpc_task *, struct nfs_write_data *); 825 int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
825 int (*file_open) (struct inode *, struct file *); 826 int (*file_open) (struct inode *, struct file *);
826 int (*file_release) (struct inode *, struct file *); 827 int (*file_release) (struct inode *, struct file *);
diff --git a/include/linux/nfsd/Kbuild b/include/linux/nfsd/Kbuild
index d9c5455808e5..e726fc3a4375 100644
--- a/include/linux/nfsd/Kbuild
+++ b/include/linux/nfsd/Kbuild
@@ -4,4 +4,3 @@ unifdef-y += stats.h
4unifdef-y += syscall.h 4unifdef-y += syscall.h
5unifdef-y += nfsfh.h 5unifdef-y += nfsfh.h
6unifdef-y += debug.h 6unifdef-y += debug.h
7unifdef-y += auth.h
diff --git a/include/linux/nfsd/auth.h b/include/linux/nfsd/auth.h
deleted file mode 100644
index 0fb9f7212195..000000000000
--- a/include/linux/nfsd/auth.h
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * include/linux/nfsd/auth.h
3 *
4 * nfsd-specific authentication stuff.
5 * uid/gid mapping not yet implemented.
6 *
7 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
8 */
9
10#ifndef LINUX_NFSD_AUTH_H
11#define LINUX_NFSD_AUTH_H
12
13#ifdef __KERNEL__
14
15#define nfsd_luid(rq, uid) ((u32)(uid))
16#define nfsd_lgid(rq, gid) ((u32)(gid))
17#define nfsd_ruid(rq, uid) ((u32)(uid))
18#define nfsd_rgid(rq, gid) ((u32)(gid))
19
20/*
21 * Set the current process's fsuid/fsgid etc to those of the NFS
22 * client user
23 */
24int nfsd_setuser(struct svc_rqst *, struct svc_export *);
25
26#endif /* __KERNEL__ */
27#endif /* LINUX_NFSD_AUTH_H */
diff --git a/include/linux/nfsd/cache.h b/include/linux/nfsd/cache.h
index 007480cd6a60..7b5d784cc858 100644
--- a/include/linux/nfsd/cache.h
+++ b/include/linux/nfsd/cache.h
@@ -72,8 +72,8 @@ enum {
72 */ 72 */
73#define RC_DELAY (HZ/5) 73#define RC_DELAY (HZ/5)
74 74
75void nfsd_cache_init(void); 75int nfsd_reply_cache_init(void);
76void nfsd_cache_shutdown(void); 76void nfsd_reply_cache_shutdown(void);
77int nfsd_cache_lookup(struct svc_rqst *, int); 77int nfsd_cache_lookup(struct svc_rqst *, int);
78void nfsd_cache_update(struct svc_rqst *, int, __be32 *); 78void nfsd_cache_update(struct svc_rqst *, int, __be32 *);
79 79
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index bcb7abafbca9..3a1687251367 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -122,7 +122,7 @@ __be32 check_nfsd_access(struct svc_export *exp, struct svc_rqst *rqstp);
122/* 122/*
123 * Function declarations 123 * Function declarations
124 */ 124 */
125void nfsd_export_init(void); 125int nfsd_export_init(void);
126void nfsd_export_shutdown(void); 126void nfsd_export_shutdown(void);
127void nfsd_export_flush(void); 127void nfsd_export_flush(void);
128void exp_readlock(void); 128void exp_readlock(void);
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 604a0d786bc6..8caf4c4f64e6 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -20,7 +20,6 @@
20#include <linux/nfsd/debug.h> 20#include <linux/nfsd/debug.h>
21#include <linux/nfsd/nfsfh.h> 21#include <linux/nfsd/nfsfh.h>
22#include <linux/nfsd/export.h> 22#include <linux/nfsd/export.h>
23#include <linux/nfsd/auth.h>
24#include <linux/nfsd/stats.h> 23#include <linux/nfsd/stats.h>
25/* 24/*
26 * nfsd version 25 * nfsd version
@@ -70,9 +69,9 @@ void nfsd_racache_shutdown(void);
70int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp, 69int nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
71 struct svc_export **expp); 70 struct svc_export **expp);
72__be32 nfsd_lookup(struct svc_rqst *, struct svc_fh *, 71__be32 nfsd_lookup(struct svc_rqst *, struct svc_fh *,
73 const char *, int, struct svc_fh *); 72 const char *, unsigned int, struct svc_fh *);
74__be32 nfsd_lookup_dentry(struct svc_rqst *, struct svc_fh *, 73__be32 nfsd_lookup_dentry(struct svc_rqst *, struct svc_fh *,
75 const char *, int, 74 const char *, unsigned int,
76 struct svc_export **, struct dentry **); 75 struct svc_export **, struct dentry **);
77__be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *, 76__be32 nfsd_setattr(struct svc_rqst *, struct svc_fh *,
78 struct iattr *, int, time_t); 77 struct iattr *, int, time_t);
diff --git a/include/linux/nfsd/syscall.h b/include/linux/nfsd/syscall.h
index 8bcddccb6c42..4e439765b705 100644
--- a/include/linux/nfsd/syscall.h
+++ b/include/linux/nfsd/syscall.h
@@ -18,7 +18,6 @@
18#include <linux/nfsd/const.h> 18#include <linux/nfsd/const.h>
19#include <linux/nfsd/export.h> 19#include <linux/nfsd/export.h>
20#include <linux/nfsd/nfsfh.h> 20#include <linux/nfsd/nfsfh.h>
21#include <linux/nfsd/auth.h>
22 21
23/* 22/*
24 * Version of the syscall interface 23 * Version of the syscall interface
diff --git a/include/linux/nfsd/xdr.h b/include/linux/nfsd/xdr.h
index 67885d5e6e50..a0132ef58f21 100644
--- a/include/linux/nfsd/xdr.h
+++ b/include/linux/nfsd/xdr.h
@@ -23,7 +23,7 @@ struct nfsd_sattrargs {
23struct nfsd_diropargs { 23struct nfsd_diropargs {
24 struct svc_fh fh; 24 struct svc_fh fh;
25 char * name; 25 char * name;
26 int len; 26 unsigned int len;
27}; 27};
28 28
29struct nfsd_readargs { 29struct nfsd_readargs {
@@ -43,17 +43,17 @@ struct nfsd_writeargs {
43struct nfsd_createargs { 43struct nfsd_createargs {
44 struct svc_fh fh; 44 struct svc_fh fh;
45 char * name; 45 char * name;
46 int len; 46 unsigned int len;
47 struct iattr attrs; 47 struct iattr attrs;
48}; 48};
49 49
50struct nfsd_renameargs { 50struct nfsd_renameargs {
51 struct svc_fh ffh; 51 struct svc_fh ffh;
52 char * fname; 52 char * fname;
53 int flen; 53 unsigned int flen;
54 struct svc_fh tfh; 54 struct svc_fh tfh;
55 char * tname; 55 char * tname;
56 int tlen; 56 unsigned int tlen;
57}; 57};
58 58
59struct nfsd_readlinkargs { 59struct nfsd_readlinkargs {
@@ -65,15 +65,15 @@ struct nfsd_linkargs {
65 struct svc_fh ffh; 65 struct svc_fh ffh;
66 struct svc_fh tfh; 66 struct svc_fh tfh;
67 char * tname; 67 char * tname;
68 int tlen; 68 unsigned int tlen;
69}; 69};
70 70
71struct nfsd_symlinkargs { 71struct nfsd_symlinkargs {
72 struct svc_fh ffh; 72 struct svc_fh ffh;
73 char * fname; 73 char * fname;
74 int flen; 74 unsigned int flen;
75 char * tname; 75 char * tname;
76 int tlen; 76 unsigned int tlen;
77 struct iattr attrs; 77 struct iattr attrs;
78}; 78};
79 79
diff --git a/include/linux/nfsd/xdr3.h b/include/linux/nfsd/xdr3.h
index 89d9d6061a62..421eddd65a25 100644
--- a/include/linux/nfsd/xdr3.h
+++ b/include/linux/nfsd/xdr3.h
@@ -21,7 +21,7 @@ struct nfsd3_sattrargs {
21struct nfsd3_diropargs { 21struct nfsd3_diropargs {
22 struct svc_fh fh; 22 struct svc_fh fh;
23 char * name; 23 char * name;
24 int len; 24 unsigned int len;
25}; 25};
26 26
27struct nfsd3_accessargs { 27struct nfsd3_accessargs {
@@ -48,7 +48,7 @@ struct nfsd3_writeargs {
48struct nfsd3_createargs { 48struct nfsd3_createargs {
49 struct svc_fh fh; 49 struct svc_fh fh;
50 char * name; 50 char * name;
51 int len; 51 unsigned int len;
52 int createmode; 52 int createmode;
53 struct iattr attrs; 53 struct iattr attrs;
54 __be32 * verf; 54 __be32 * verf;
@@ -57,7 +57,7 @@ struct nfsd3_createargs {
57struct nfsd3_mknodargs { 57struct nfsd3_mknodargs {
58 struct svc_fh fh; 58 struct svc_fh fh;
59 char * name; 59 char * name;
60 int len; 60 unsigned int len;
61 __u32 ftype; 61 __u32 ftype;
62 __u32 major, minor; 62 __u32 major, minor;
63 struct iattr attrs; 63 struct iattr attrs;
@@ -66,10 +66,10 @@ struct nfsd3_mknodargs {
66struct nfsd3_renameargs { 66struct nfsd3_renameargs {
67 struct svc_fh ffh; 67 struct svc_fh ffh;
68 char * fname; 68 char * fname;
69 int flen; 69 unsigned int flen;
70 struct svc_fh tfh; 70 struct svc_fh tfh;
71 char * tname; 71 char * tname;
72 int tlen; 72 unsigned int tlen;
73}; 73};
74 74
75struct nfsd3_readlinkargs { 75struct nfsd3_readlinkargs {
@@ -81,15 +81,15 @@ struct nfsd3_linkargs {
81 struct svc_fh ffh; 81 struct svc_fh ffh;
82 struct svc_fh tfh; 82 struct svc_fh tfh;
83 char * tname; 83 char * tname;
84 int tlen; 84 unsigned int tlen;
85}; 85};
86 86
87struct nfsd3_symlinkargs { 87struct nfsd3_symlinkargs {
88 struct svc_fh ffh; 88 struct svc_fh ffh;
89 char * fname; 89 char * fname;
90 int flen; 90 unsigned int flen;
91 char * tname; 91 char * tname;
92 int tlen; 92 unsigned int tlen;
93 struct iattr attrs; 93 struct iattr attrs;
94}; 94};
95 95
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
index b0ddfb41c790..27bd3e38ec5a 100644
--- a/include/linux/nfsd/xdr4.h
+++ b/include/linux/nfsd/xdr4.h
@@ -441,7 +441,7 @@ void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *);
441void nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op); 441void nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op);
442__be32 nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, 442__be32 nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
443 struct dentry *dentry, __be32 *buffer, int *countp, 443 struct dentry *dentry, __be32 *buffer, int *countp,
444 u32 *bmval, struct svc_rqst *); 444 u32 *bmval, struct svc_rqst *, int ignore_crossmnt);
445extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp, 445extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp,
446 struct nfsd4_compound_state *, 446 struct nfsd4_compound_state *,
447 struct nfsd4_setclientid *setclid); 447 struct nfsd4_setclientid *setclid);
diff --git a/include/linux/nfsd_idmap.h b/include/linux/nfsd_idmap.h
index e82746fcad14..d4a2ac18bd4c 100644
--- a/include/linux/nfsd_idmap.h
+++ b/include/linux/nfsd_idmap.h
@@ -44,11 +44,16 @@
44#define IDMAP_NAMESZ 128 44#define IDMAP_NAMESZ 128
45 45
46#ifdef CONFIG_NFSD_V4 46#ifdef CONFIG_NFSD_V4
47void nfsd_idmap_init(void); 47int nfsd_idmap_init(void);
48void nfsd_idmap_shutdown(void); 48void nfsd_idmap_shutdown(void);
49#else 49#else
50static inline void nfsd_idmap_init(void) {}; 50static inline int nfsd_idmap_init(void)
51static inline void nfsd_idmap_shutdown(void) {}; 51{
52 return 0;
53}
54static inline void nfsd_idmap_shutdown(void)
55{
56}
52#endif 57#endif
53 58
54int nfsd_map_name_to_uid(struct svc_rqst *, const char *, size_t, __u32 *); 59int nfsd_map_name_to_uid(struct svc_rqst *, const char *, size_t, __u32 *);
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 538ee1dd3d0a..9fecf902419c 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -7,6 +7,18 @@
7 */ 7 */
8 8
9/** 9/**
10 * DOC: Station handling
11 *
12 * Stations are added per interface, but a special case exists with VLAN
13 * interfaces. When a station is bound to an AP interface, it may be moved
14 * into a VLAN identified by a VLAN interface index (%NL80211_ATTR_STA_VLAN).
15 * The station is still assumed to belong to the AP interface it was added
16 * to.
17 *
18 * TODO: need more info?
19 */
20
21/**
10 * enum nl80211_commands - supported nl80211 commands 22 * enum nl80211_commands - supported nl80211 commands
11 * 23 *
12 * @NL80211_CMD_UNSPEC: unspecified command to catch errors 24 * @NL80211_CMD_UNSPEC: unspecified command to catch errors
@@ -37,6 +49,35 @@
37 * userspace to request deletion of a virtual interface, then requires 49 * userspace to request deletion of a virtual interface, then requires
38 * attribute %NL80211_ATTR_IFINDEX. 50 * attribute %NL80211_ATTR_IFINDEX.
39 * 51 *
52 * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified
53 * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC.
54 * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT or
55 * %NL80211_ATTR_KEY_THRESHOLD.
56 * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA,
57 * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC and %NL80211_ATTR_KEY_CIPHER
58 * attributes.
59 * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX
60 * or %NL80211_ATTR_MAC.
61 *
62 * @NL80211_CMD_GET_BEACON: retrieve beacon information (returned in a
63 * %NL80222_CMD_NEW_BEACON message)
64 * @NL80211_CMD_SET_BEACON: set the beacon on an access point interface
65 * using the %NL80211_ATTR_BEACON_INTERVAL, %NL80211_ATTR_DTIM_PERIOD,
66 * %NL80211_BEACON_HEAD and %NL80211_BEACON_TAIL attributes.
67 * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface,
68 * parameters are like for %NL80211_CMD_SET_BEACON.
69 * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it
70 *
71 * @NL80211_CMD_GET_STATION: Get station attributes for station identified by
72 * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX.
73 * @NL80211_CMD_SET_STATION: Set station attributes for station identified by
74 * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX.
75 * @NL80211_CMD_NEW_STATION: Add a station with given attributes to the
76 * the interface identified by %NL80211_ATTR_IFINDEX.
77 * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC
78 * or, if no MAC address given, all stations, on the interface identified
79 * by %NL80211_ATTR_IFINDEX.
80 *
40 * @NL80211_CMD_MAX: highest used command number 81 * @NL80211_CMD_MAX: highest used command number
41 * @__NL80211_CMD_AFTER_LAST: internal use 82 * @__NL80211_CMD_AFTER_LAST: internal use
42 */ 83 */
@@ -54,6 +95,21 @@ enum nl80211_commands {
54 NL80211_CMD_NEW_INTERFACE, 95 NL80211_CMD_NEW_INTERFACE,
55 NL80211_CMD_DEL_INTERFACE, 96 NL80211_CMD_DEL_INTERFACE,
56 97
98 NL80211_CMD_GET_KEY,
99 NL80211_CMD_SET_KEY,
100 NL80211_CMD_NEW_KEY,
101 NL80211_CMD_DEL_KEY,
102
103 NL80211_CMD_GET_BEACON,
104 NL80211_CMD_SET_BEACON,
105 NL80211_CMD_NEW_BEACON,
106 NL80211_CMD_DEL_BEACON,
107
108 NL80211_CMD_GET_STATION,
109 NL80211_CMD_SET_STATION,
110 NL80211_CMD_NEW_STATION,
111 NL80211_CMD_DEL_STATION,
112
57 /* add commands here */ 113 /* add commands here */
58 114
59 /* used to define NL80211_CMD_MAX below */ 115 /* used to define NL80211_CMD_MAX below */
@@ -75,6 +131,36 @@ enum nl80211_commands {
75 * @NL80211_ATTR_IFNAME: network interface name 131 * @NL80211_ATTR_IFNAME: network interface name
76 * @NL80211_ATTR_IFTYPE: type of virtual interface, see &enum nl80211_iftype 132 * @NL80211_ATTR_IFTYPE: type of virtual interface, see &enum nl80211_iftype
77 * 133 *
134 * @NL80211_ATTR_MAC: MAC address (various uses)
135 *
136 * @NL80211_ATTR_KEY_DATA: (temporal) key data; for TKIP this consists of
137 * 16 bytes encryption key followed by 8 bytes each for TX and RX MIC
138 * keys
139 * @NL80211_ATTR_KEY_IDX: key ID (u8, 0-3)
140 * @NL80211_ATTR_KEY_CIPHER: key cipher suite (u32, as defined by IEEE 802.11
141 * section 7.3.2.25.1, e.g. 0x000FAC04)
142 * @NL80211_ATTR_KEY_SEQ: transmit key sequence number (IV/PN) for TKIP and
143 * CCMP keys, each six bytes in little endian
144 *
145 * @NL80211_ATTR_BEACON_INTERVAL: beacon interval in TU
146 * @NL80211_ATTR_DTIM_PERIOD: DTIM period for beaconing
147 * @NL80211_ATTR_BEACON_HEAD: portion of the beacon before the TIM IE
148 * @NL80211_ATTR_BEACON_TAIL: portion of the beacon after the TIM IE
149 *
150 * @NL80211_ATTR_STA_AID: Association ID for the station (u16)
151 * @NL80211_ATTR_STA_FLAGS: flags, nested element with NLA_FLAG attributes of
152 * &enum nl80211_sta_flags.
153 * @NL80211_ATTR_STA_LISTEN_INTERVAL: listen interval as defined by
154 * IEEE 802.11 7.3.1.6 (u16).
155 * @NL80211_ATTR_STA_SUPPORTED_RATES: supported rates, array of supported
156 * rates as defined by IEEE 802.11 7.3.2.2 but without the length
157 * restriction (at most %NL80211_MAX_SUPP_RATES).
158 * @NL80211_ATTR_STA_VLAN: interface index of VLAN interface to move station
159 * to, or the AP interface the station was originally added to to.
160 * @NL80211_ATTR_STA_STATS: statistics for a station, part of station info
161 * given for %NL80211_CMD_GET_STATION, nested attribute containing
162 * info as possible, see &enum nl80211_sta_stats.
163 *
78 * @NL80211_ATTR_MAX: highest attribute number currently defined 164 * @NL80211_ATTR_MAX: highest attribute number currently defined
79 * @__NL80211_ATTR_AFTER_LAST: internal use 165 * @__NL80211_ATTR_AFTER_LAST: internal use
80 */ 166 */
@@ -89,12 +175,34 @@ enum nl80211_attrs {
89 NL80211_ATTR_IFNAME, 175 NL80211_ATTR_IFNAME,
90 NL80211_ATTR_IFTYPE, 176 NL80211_ATTR_IFTYPE,
91 177
178 NL80211_ATTR_MAC,
179
180 NL80211_ATTR_KEY_DATA,
181 NL80211_ATTR_KEY_IDX,
182 NL80211_ATTR_KEY_CIPHER,
183 NL80211_ATTR_KEY_SEQ,
184 NL80211_ATTR_KEY_DEFAULT,
185
186 NL80211_ATTR_BEACON_INTERVAL,
187 NL80211_ATTR_DTIM_PERIOD,
188 NL80211_ATTR_BEACON_HEAD,
189 NL80211_ATTR_BEACON_TAIL,
190
191 NL80211_ATTR_STA_AID,
192 NL80211_ATTR_STA_FLAGS,
193 NL80211_ATTR_STA_LISTEN_INTERVAL,
194 NL80211_ATTR_STA_SUPPORTED_RATES,
195 NL80211_ATTR_STA_VLAN,
196 NL80211_ATTR_STA_STATS,
197
92 /* add attributes here, update the policy in nl80211.c */ 198 /* add attributes here, update the policy in nl80211.c */
93 199
94 __NL80211_ATTR_AFTER_LAST, 200 __NL80211_ATTR_AFTER_LAST,
95 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 201 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
96}; 202};
97 203
204#define NL80211_MAX_SUPP_RATES 32
205
98/** 206/**
99 * enum nl80211_iftype - (virtual) interface types 207 * enum nl80211_iftype - (virtual) interface types
100 * 208 *
@@ -126,4 +234,50 @@ enum nl80211_iftype {
126 NL80211_IFTYPE_MAX = __NL80211_IFTYPE_AFTER_LAST - 1 234 NL80211_IFTYPE_MAX = __NL80211_IFTYPE_AFTER_LAST - 1
127}; 235};
128 236
237/**
238 * enum nl80211_sta_flags - station flags
239 *
240 * Station flags. When a station is added to an AP interface, it is
241 * assumed to be already associated (and hence authenticated.)
242 *
243 * @NL80211_STA_FLAG_AUTHORIZED: station is authorized (802.1X)
244 * @NL80211_STA_FLAG_SHORT_PREAMBLE: station is capable of receiving frames
245 * with short barker preamble
246 * @NL80211_STA_FLAG_WME: station is WME/QoS capable
247 */
248enum nl80211_sta_flags {
249 __NL80211_STA_FLAG_INVALID,
250 NL80211_STA_FLAG_AUTHORIZED,
251 NL80211_STA_FLAG_SHORT_PREAMBLE,
252 NL80211_STA_FLAG_WME,
253
254 /* keep last */
255 __NL80211_STA_FLAG_AFTER_LAST,
256 NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1
257};
258
259/**
260 * enum nl80211_sta_stats - station statistics
261 *
262 * These attribute types are used with %NL80211_ATTR_STA_STATS
263 * when getting information about a station.
264 *
265 * @__NL80211_STA_STAT_INVALID: attribute number 0 is reserved
266 * @NL80211_STA_STAT_INACTIVE_TIME: time since last activity (u32, msecs)
267 * @NL80211_STA_STAT_RX_BYTES: total received bytes (u32, from this station)
268 * @NL80211_STA_STAT_TX_BYTES: total transmitted bytes (u32, to this station)
269 * @__NL80211_STA_STAT_AFTER_LAST: internal
270 * @NL80211_STA_STAT_MAX: highest possible station stats attribute
271 */
272enum nl80211_sta_stats {
273 __NL80211_STA_STAT_INVALID,
274 NL80211_STA_STAT_INACTIVE_TIME,
275 NL80211_STA_STAT_RX_BYTES,
276 NL80211_STA_STAT_TX_BYTES,
277
278 /* keep last */
279 __NL80211_STA_STAT_AFTER_LAST,
280 NL80211_STA_STAT_MAX = __NL80211_STA_STAT_AFTER_LAST - 1
281};
282
129#endif /* __LINUX_NL80211_H */ 283#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 0c40cc0b4a36..f4df40038f0c 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -207,9 +207,7 @@ static inline int notifier_to_errno(int ret)
207#define CPU_DOWN_PREPARE 0x0005 /* CPU (unsigned)v going down */ 207#define CPU_DOWN_PREPARE 0x0005 /* CPU (unsigned)v going down */
208#define CPU_DOWN_FAILED 0x0006 /* CPU (unsigned)v NOT going down */ 208#define CPU_DOWN_FAILED 0x0006 /* CPU (unsigned)v NOT going down */
209#define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */ 209#define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */
210#define CPU_LOCK_ACQUIRE 0x0008 /* Acquire all hotcpu locks */ 210#define CPU_DYING 0x0008 /* CPU (unsigned)v not running any task,
211#define CPU_LOCK_RELEASE 0x0009 /* Release all hotcpu locks */
212#define CPU_DYING 0x000A /* CPU (unsigned)v not running any task,
213 * not handling interrupts, soon dead */ 211 * not handling interrupts, soon dead */
214 212
215/* Used for CPU hotplug events occuring while tasks are frozen due to a suspend 213/* Used for CPU hotplug events occuring while tasks are frozen due to a suspend
@@ -230,6 +228,8 @@ static inline int notifier_to_errno(int ret)
230#define PM_POST_HIBERNATION 0x0002 /* Hibernation finished */ 228#define PM_POST_HIBERNATION 0x0002 /* Hibernation finished */
231#define PM_SUSPEND_PREPARE 0x0003 /* Going to suspend the system */ 229#define PM_SUSPEND_PREPARE 0x0003 /* Going to suspend the system */
232#define PM_POST_SUSPEND 0x0004 /* Suspend finished */ 230#define PM_POST_SUSPEND 0x0004 /* Suspend finished */
231#define PM_RESTORE_PREPARE 0x0005 /* Going to restore a saved image */
232#define PM_POST_RESTORE 0x0006 /* Restore failed */
233 233
234/* Console keyboard events. 234/* Console keyboard events.
235 * Note: KBD_KEYCODE is always sent before KBD_UNBOUND_KEYCODE, KBD_UNICODE and 235 * Note: KBD_KEYCODE is always sent before KBD_UNBOUND_KEYCODE, KBD_UNICODE and
diff --git a/include/linux/of.h b/include/linux/of.h
index 5c39b9270ff7..b5f33efcb8e2 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -17,6 +17,7 @@
17 */ 17 */
18#include <linux/types.h> 18#include <linux/types.h>
19#include <linux/bitops.h> 19#include <linux/bitops.h>
20#include <linux/mod_devicetable.h>
20 21
21#include <asm/prom.h> 22#include <asm/prom.h>
22 23
@@ -41,11 +42,20 @@ extern struct device_node *of_find_compatible_node(struct device_node *from,
41#define for_each_compatible_node(dn, type, compatible) \ 42#define for_each_compatible_node(dn, type, compatible) \
42 for (dn = of_find_compatible_node(NULL, type, compatible); dn; \ 43 for (dn = of_find_compatible_node(NULL, type, compatible); dn; \
43 dn = of_find_compatible_node(dn, type, compatible)) 44 dn = of_find_compatible_node(dn, type, compatible))
45extern struct device_node *of_find_matching_node(struct device_node *from,
46 const struct of_device_id *matches);
47#define for_each_matching_node(dn, matches) \
48 for (dn = of_find_matching_node(NULL, matches); dn; \
49 dn = of_find_matching_node(dn, matches))
44extern struct device_node *of_find_node_by_path(const char *path); 50extern struct device_node *of_find_node_by_path(const char *path);
45extern struct device_node *of_find_node_by_phandle(phandle handle); 51extern struct device_node *of_find_node_by_phandle(phandle handle);
46extern struct device_node *of_get_parent(const struct device_node *node); 52extern struct device_node *of_get_parent(const struct device_node *node);
47extern struct device_node *of_get_next_child(const struct device_node *node, 53extern struct device_node *of_get_next_child(const struct device_node *node,
48 struct device_node *prev); 54 struct device_node *prev);
55#define for_each_child_of_node(parent, child) \
56 for (child = of_get_next_child(parent, NULL); child != NULL; \
57 child = of_get_next_child(parent, child))
58
49extern struct property *of_find_property(const struct device_node *np, 59extern struct property *of_find_property(const struct device_node *np,
50 const char *name, 60 const char *name,
51 int *lenp); 61 int *lenp);
@@ -56,5 +66,7 @@ extern const void *of_get_property(const struct device_node *node,
56 int *lenp); 66 int *lenp);
57extern int of_n_addr_cells(struct device_node *np); 67extern int of_n_addr_cells(struct device_node *np);
58extern int of_n_size_cells(struct device_node *np); 68extern int of_n_size_cells(struct device_node *np);
69extern const struct of_device_id *of_match_node(
70 const struct of_device_id *matches, const struct device_node *node);
59 71
60#endif /* _LINUX_OF_H */ 72#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_device.h b/include/linux/of_device.h
index 212bffb2b174..6dc11959770c 100644
--- a/include/linux/of_device.h
+++ b/include/linux/of_device.h
@@ -10,8 +10,6 @@
10 10
11#define to_of_device(d) container_of(d, struct of_device, dev) 11#define to_of_device(d) container_of(d, struct of_device, dev)
12 12
13extern const struct of_device_id *of_match_node(
14 const struct of_device_id *matches, const struct device_node *node);
15extern const struct of_device_id *of_match_device( 13extern const struct of_device_id *of_match_device(
16 const struct of_device_id *matches, const struct of_device *dev); 14 const struct of_device_id *matches, const struct of_device *dev);
17 15
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index db8a410ae9e1..4b62a105622b 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -157,6 +157,7 @@ static inline pgoff_t linear_page_index(struct vm_area_struct *vma,
157} 157}
158 158
159extern void FASTCALL(__lock_page(struct page *page)); 159extern void FASTCALL(__lock_page(struct page *page));
160extern int FASTCALL(__lock_page_killable(struct page *page));
160extern void FASTCALL(__lock_page_nosync(struct page *page)); 161extern void FASTCALL(__lock_page_nosync(struct page *page));
161extern void FASTCALL(unlock_page(struct page *page)); 162extern void FASTCALL(unlock_page(struct page *page));
162 163
@@ -171,6 +172,19 @@ static inline void lock_page(struct page *page)
171} 172}
172 173
173/* 174/*
175 * lock_page_killable is like lock_page but can be interrupted by fatal
176 * signals. It returns 0 if it locked the page and -EINTR if it was
177 * killed while waiting.
178 */
179static inline int lock_page_killable(struct page *page)
180{
181 might_sleep();
182 if (TestSetPageLocked(page))
183 return __lock_page_killable(page);
184 return 0;
185}
186
187/*
174 * lock_page_nosync should only be used if we can't pin the page's inode. 188 * lock_page_nosync should only be used if we can't pin the page's inode.
175 * Doesn't play quite so well with block device plugging. 189 * Doesn't play quite so well with block device plugging.
176 */ 190 */
diff --git a/include/linux/pata_platform.h b/include/linux/pata_platform.h
index 5799e8d50623..6a7a92db294c 100644
--- a/include/linux/pata_platform.h
+++ b/include/linux/pata_platform.h
@@ -15,4 +15,13 @@ struct pata_platform_info {
15 unsigned int irq_flags; 15 unsigned int irq_flags;
16}; 16};
17 17
18extern int __devinit __pata_platform_probe(struct device *dev,
19 struct resource *io_res,
20 struct resource *ctl_res,
21 struct resource *irq_res,
22 unsigned int ioport_shift,
23 int __pio_mask);
24
25extern int __devexit __pata_platform_remove(struct device *dev);
26
18#endif /* __LINUX_PATA_PLATFORM_H */ 27#endif /* __LINUX_PATA_PLATFORM_H */
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 936ef82ed76a..3ba25065fa96 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -48,7 +48,15 @@
48 48
49#ifdef CONFIG_ACPI 49#ifdef CONFIG_ACPI
50extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags); 50extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags);
51extern acpi_status pci_osc_support_set(u32 flags); 51extern acpi_status __pci_osc_support_set(u32 flags, const char *hid);
52static inline acpi_status pci_osc_support_set(u32 flags)
53{
54 return __pci_osc_support_set(flags, PCI_ROOT_HID_STRING);
55}
56static inline acpi_status pcie_osc_support_set(u32 flags)
57{
58 return __pci_osc_support_set(flags, PCI_EXPRESS_ROOT_HID_STRING);
59}
52#else 60#else
53#if !defined(AE_ERROR) 61#if !defined(AE_ERROR)
54typedef u32 acpi_status; 62typedef u32 acpi_status;
@@ -57,6 +65,7 @@ typedef u32 acpi_status;
57static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags) 65static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
58{return AE_ERROR;} 66{return AE_ERROR;}
59static inline acpi_status pci_osc_support_set(u32 flags) {return AE_ERROR;} 67static inline acpi_status pci_osc_support_set(u32 flags) {return AE_ERROR;}
68static inline acpi_status pcie_osc_support_set(u32 flags) {return AE_ERROR;}
60#endif 69#endif
61 70
62#endif /* _PCI_ACPI_H_ */ 71#endif /* _PCI_ACPI_H_ */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 5d2281f661f7..4f96f1d94ac4 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -28,7 +28,7 @@
28 * 7:3 = slot 28 * 7:3 = slot
29 * 2:0 = function 29 * 2:0 = function
30 */ 30 */
31#define PCI_DEVFN(slot,func) ((((slot) & 0x1f) << 3) | ((func) & 0x07)) 31#define PCI_DEVFN(slot, func) ((((slot) & 0x1f) << 3) | ((func) & 0x07))
32#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) 32#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
33#define PCI_FUNC(devfn) ((devfn) & 0x07) 33#define PCI_FUNC(devfn) ((devfn) & 0x07)
34 34
@@ -66,7 +66,6 @@ enum pci_mmap_state {
66#define PCI_DMA_FROMDEVICE 2 66#define PCI_DMA_FROMDEVICE 2
67#define PCI_DMA_NONE 3 67#define PCI_DMA_NONE 3
68 68
69#define DEVICE_COUNT_COMPATIBLE 4
70#define DEVICE_COUNT_RESOURCE 12 69#define DEVICE_COUNT_RESOURCE 12
71 70
72typedef int __bitwise pci_power_t; 71typedef int __bitwise pci_power_t;
@@ -109,6 +108,14 @@ enum pcie_reset_state {
109 pcie_hot_reset = (__force pcie_reset_state_t) 3 108 pcie_hot_reset = (__force pcie_reset_state_t) 3
110}; 109};
111 110
111typedef unsigned short __bitwise pci_dev_flags_t;
112enum pci_dev_flags {
113 /* INTX_DISABLE in PCI_COMMAND register disables MSI
114 * generation too.
115 */
116 PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1,
117};
118
112typedef unsigned short __bitwise pci_bus_flags_t; 119typedef unsigned short __bitwise pci_bus_flags_t;
113enum pci_bus_flags { 120enum pci_bus_flags {
114 PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1, 121 PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1,
@@ -121,6 +128,7 @@ struct pci_cap_saved_state {
121 u32 data[0]; 128 u32 data[0];
122}; 129};
123 130
131struct pcie_link_state;
124/* 132/*
125 * The pci_dev structure is used to describe PCI devices. 133 * The pci_dev structure is used to describe PCI devices.
126 */ 134 */
@@ -156,13 +164,13 @@ struct pci_dev {
156 this is D0-D3, D0 being fully functional, 164 this is D0-D3, D0 being fully functional,
157 and D3 being off. */ 165 and D3 being off. */
158 166
167#ifdef CONFIG_PCIEASPM
168 struct pcie_link_state *link_state; /* ASPM link state. */
169#endif
170
159 pci_channel_state_t error_state; /* current connectivity state */ 171 pci_channel_state_t error_state; /* current connectivity state */
160 struct device dev; /* Generic device interface */ 172 struct device dev; /* Generic device interface */
161 173
162 /* device is compatible with these IDs */
163 unsigned short vendor_compatible[DEVICE_COUNT_COMPATIBLE];
164 unsigned short device_compatible[DEVICE_COUNT_COMPATIBLE];
165
166 int cfg_size; /* Size of configuration space */ 174 int cfg_size; /* Size of configuration space */
167 175
168 /* 176 /*
@@ -185,6 +193,7 @@ struct pci_dev {
185 unsigned int msix_enabled:1; 193 unsigned int msix_enabled:1;
186 unsigned int is_managed:1; 194 unsigned int is_managed:1;
187 unsigned int is_pcie:1; 195 unsigned int is_pcie:1;
196 pci_dev_flags_t dev_flags;
188 atomic_t enable_cnt; /* pci_enable_device has been called */ 197 atomic_t enable_cnt; /* pci_enable_device has been called */
189 198
190 u32 saved_config_space[16]; /* config space saved at suspend time */ 199 u32 saved_config_space[16]; /* config space saved at suspend time */
@@ -210,7 +219,7 @@ static inline int pci_channel_offline(struct pci_dev *pdev)
210} 219}
211 220
212static inline struct pci_cap_saved_state *pci_find_saved_cap( 221static inline struct pci_cap_saved_state *pci_find_saved_cap(
213 struct pci_dev *pci_dev,char cap) 222 struct pci_dev *pci_dev, char cap)
214{ 223{
215 struct pci_cap_saved_state *tmp; 224 struct pci_cap_saved_state *tmp;
216 struct hlist_node *pos; 225 struct hlist_node *pos;
@@ -269,13 +278,13 @@ struct pci_bus {
269 unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */ 278 unsigned short bridge_ctl; /* manage NO_ISA/FBB/et al behaviors */
270 pci_bus_flags_t bus_flags; /* Inherited by child busses */ 279 pci_bus_flags_t bus_flags; /* Inherited by child busses */
271 struct device *bridge; 280 struct device *bridge;
272 struct class_device class_dev; 281 struct device dev;
273 struct bin_attribute *legacy_io; /* legacy I/O for this bus */ 282 struct bin_attribute *legacy_io; /* legacy I/O for this bus */
274 struct bin_attribute *legacy_mem; /* legacy mem */ 283 struct bin_attribute *legacy_mem; /* legacy mem */
275}; 284};
276 285
277#define pci_bus_b(n) list_entry(n, struct pci_bus, node) 286#define pci_bus_b(n) list_entry(n, struct pci_bus, node)
278#define to_pci_bus(n) container_of(n, struct pci_bus, class_dev) 287#define to_pci_bus(n) container_of(n, struct pci_bus, dev)
279 288
280/* 289/*
281 * Error values that may be returned by PCI functions. 290 * Error values that may be returned by PCI functions.
@@ -305,8 +314,8 @@ struct pci_raw_ops {
305extern struct pci_raw_ops *raw_pci_ops; 314extern struct pci_raw_ops *raw_pci_ops;
306 315
307struct pci_bus_region { 316struct pci_bus_region {
308 unsigned long start; 317 resource_size_t start;
309 unsigned long end; 318 resource_size_t end;
310}; 319};
311 320
312struct pci_dynids { 321struct pci_dynids {
@@ -342,11 +351,10 @@ enum pci_ers_result {
342}; 351};
343 352
344/* PCI bus error event callbacks */ 353/* PCI bus error event callbacks */
345struct pci_error_handlers 354struct pci_error_handlers {
346{
347 /* PCI bus error detected on this device */ 355 /* PCI bus error detected on this device */
348 pci_ers_result_t (*error_detected)(struct pci_dev *dev, 356 pci_ers_result_t (*error_detected)(struct pci_dev *dev,
349 enum pci_channel_state error); 357 enum pci_channel_state error);
350 358
351 /* MMIO has been re-enabled, but not DMA */ 359 /* MMIO has been re-enabled, but not DMA */
352 pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev); 360 pci_ers_result_t (*mmio_enabled)(struct pci_dev *dev);
@@ -381,7 +389,7 @@ struct pci_driver {
381 struct pci_dynids dynids; 389 struct pci_dynids dynids;
382}; 390};
383 391
384#define to_pci_driver(drv) container_of(drv,struct pci_driver, driver) 392#define to_pci_driver(drv) container_of(drv, struct pci_driver, driver)
385 393
386/** 394/**
387 * PCI_DEVICE - macro used to describe a specific pci device 395 * PCI_DEVICE - macro used to describe a specific pci device
@@ -439,7 +447,7 @@ extern int no_pci_devices(void);
439 447
440void pcibios_fixup_bus(struct pci_bus *); 448void pcibios_fixup_bus(struct pci_bus *);
441int __must_check pcibios_enable_device(struct pci_dev *, int mask); 449int __must_check pcibios_enable_device(struct pci_dev *, int mask);
442char *pcibios_setup (char *str); 450char *pcibios_setup(char *str);
443 451
444/* Used only when drivers/pci/setup.c is used */ 452/* Used only when drivers/pci/setup.c is used */
445void pcibios_align_resource(void *, struct resource *, resource_size_t, 453void pcibios_align_resource(void *, struct resource *, resource_size_t,
@@ -450,8 +458,10 @@ void pcibios_update_irq(struct pci_dev *, int irq);
450 458
451extern struct pci_bus *pci_find_bus(int domain, int busnr); 459extern struct pci_bus *pci_find_bus(int domain, int busnr);
452void pci_bus_add_devices(struct pci_bus *bus); 460void pci_bus_add_devices(struct pci_bus *bus);
453struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata); 461struct pci_bus *pci_scan_bus_parented(struct device *parent, int bus,
454static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *sysdata) 462 struct pci_ops *ops, void *sysdata);
463static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
464 void *sysdata)
455{ 465{
456 struct pci_bus *root_bus; 466 struct pci_bus *root_bus;
457 root_bus = pci_scan_bus_parented(NULL, bus, ops, sysdata); 467 root_bus = pci_scan_bus_parented(NULL, bus, ops, sysdata);
@@ -459,15 +469,18 @@ static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *s
459 pci_bus_add_devices(root_bus); 469 pci_bus_add_devices(root_bus);
460 return root_bus; 470 return root_bus;
461} 471}
462struct pci_bus *pci_create_bus(struct device *parent, int bus, struct pci_ops *ops, void *sysdata); 472struct pci_bus *pci_create_bus(struct device *parent, int bus,
463struct pci_bus * pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr); 473 struct pci_ops *ops, void *sysdata);
474struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
475 int busnr);
464int pci_scan_slot(struct pci_bus *bus, int devfn); 476int pci_scan_slot(struct pci_bus *bus, int devfn);
465struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); 477struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);
466void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); 478void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
467unsigned int pci_scan_child_bus(struct pci_bus *bus); 479unsigned int pci_scan_child_bus(struct pci_bus *bus);
468int __must_check pci_bus_add_device(struct pci_dev *dev); 480int __must_check pci_bus_add_device(struct pci_dev *dev);
469void pci_read_bridge_bases(struct pci_bus *child); 481void pci_read_bridge_bases(struct pci_bus *child);
470struct resource *pci_find_parent_resource(const struct pci_dev *dev, struct resource *res); 482struct resource *pci_find_parent_resource(const struct pci_dev *dev,
483 struct resource *res);
471int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); 484int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge);
472extern struct pci_dev *pci_dev_get(struct pci_dev *dev); 485extern struct pci_dev *pci_dev_get(struct pci_dev *dev);
473extern void pci_dev_put(struct pci_dev *dev); 486extern void pci_dev_put(struct pci_dev *dev);
@@ -479,13 +492,20 @@ extern void pci_sort_breadthfirst(void);
479 492
480/* Generic PCI functions exported to card drivers */ 493/* Generic PCI functions exported to card drivers */
481 494
482struct pci_dev __deprecated *pci_find_device (unsigned int vendor, unsigned int device, const struct pci_dev *from); 495#ifdef CONFIG_PCI_LEGACY
483struct pci_dev __deprecated *pci_find_slot (unsigned int bus, unsigned int devfn); 496struct pci_dev __deprecated *pci_find_device(unsigned int vendor,
484int pci_find_capability (struct pci_dev *dev, int cap); 497 unsigned int device,
485int pci_find_next_capability (struct pci_dev *dev, u8 pos, int cap); 498 const struct pci_dev *from);
486int pci_find_ext_capability (struct pci_dev *dev, int cap); 499struct pci_dev __deprecated *pci_find_slot(unsigned int bus,
487int pci_find_ht_capability (struct pci_dev *dev, int ht_cap); 500 unsigned int devfn);
488int pci_find_next_ht_capability (struct pci_dev *dev, int pos, int ht_cap); 501#endif /* CONFIG_PCI_LEGACY */
502
503int pci_find_capability(struct pci_dev *dev, int cap);
504int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap);
505int pci_find_ext_capability(struct pci_dev *dev, int cap);
506int pci_find_ht_capability(struct pci_dev *dev, int ht_cap);
507int pci_find_next_ht_capability(struct pci_dev *dev, int pos, int ht_cap);
508void pcie_wait_pending_transaction(struct pci_dev *dev);
489struct pci_bus *pci_find_next_bus(const struct pci_bus *from); 509struct pci_bus *pci_find_next_bus(const struct pci_bus *from);
490 510
491struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, 511struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
@@ -493,49 +513,58 @@ struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
493struct pci_dev *pci_get_device_reverse(unsigned int vendor, unsigned int device, 513struct pci_dev *pci_get_device_reverse(unsigned int vendor, unsigned int device,
494 struct pci_dev *from); 514 struct pci_dev *from);
495 515
496struct pci_dev *pci_get_subsys (unsigned int vendor, unsigned int device, 516struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
497 unsigned int ss_vendor, unsigned int ss_device, 517 unsigned int ss_vendor, unsigned int ss_device,
498 struct pci_dev *from); 518 struct pci_dev *from);
499struct pci_dev *pci_get_slot (struct pci_bus *bus, unsigned int devfn); 519struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn);
500struct pci_dev *pci_get_bus_and_slot (unsigned int bus, unsigned int devfn); 520struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn);
501struct pci_dev *pci_get_class (unsigned int class, struct pci_dev *from); 521struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from);
502int pci_dev_present(const struct pci_device_id *ids); 522int pci_dev_present(const struct pci_device_id *ids);
503const struct pci_device_id *pci_find_present(const struct pci_device_id *ids); 523const struct pci_device_id *pci_find_present(const struct pci_device_id *ids);
504 524
505int pci_bus_read_config_byte (struct pci_bus *bus, unsigned int devfn, int where, u8 *val); 525int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn,
506int pci_bus_read_config_word (struct pci_bus *bus, unsigned int devfn, int where, u16 *val); 526 int where, u8 *val);
507int pci_bus_read_config_dword (struct pci_bus *bus, unsigned int devfn, int where, u32 *val); 527int pci_bus_read_config_word(struct pci_bus *bus, unsigned int devfn,
508int pci_bus_write_config_byte (struct pci_bus *bus, unsigned int devfn, int where, u8 val); 528 int where, u16 *val);
509int pci_bus_write_config_word (struct pci_bus *bus, unsigned int devfn, int where, u16 val); 529int pci_bus_read_config_dword(struct pci_bus *bus, unsigned int devfn,
510int pci_bus_write_config_dword (struct pci_bus *bus, unsigned int devfn, int where, u32 val); 530 int where, u32 *val);
531int pci_bus_write_config_byte(struct pci_bus *bus, unsigned int devfn,
532 int where, u8 val);
533int pci_bus_write_config_word(struct pci_bus *bus, unsigned int devfn,
534 int where, u16 val);
535int pci_bus_write_config_dword(struct pci_bus *bus, unsigned int devfn,
536 int where, u32 val);
511 537
512static inline int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val) 538static inline int pci_read_config_byte(struct pci_dev *dev, int where, u8 *val)
513{ 539{
514 return pci_bus_read_config_byte (dev->bus, dev->devfn, where, val); 540 return pci_bus_read_config_byte(dev->bus, dev->devfn, where, val);
515} 541}
516static inline int pci_read_config_word(struct pci_dev *dev, int where, u16 *val) 542static inline int pci_read_config_word(struct pci_dev *dev, int where, u16 *val)
517{ 543{
518 return pci_bus_read_config_word (dev->bus, dev->devfn, where, val); 544 return pci_bus_read_config_word(dev->bus, dev->devfn, where, val);
519} 545}
520static inline int pci_read_config_dword(struct pci_dev *dev, int where, u32 *val) 546static inline int pci_read_config_dword(struct pci_dev *dev, int where,
547 u32 *val)
521{ 548{
522 return pci_bus_read_config_dword (dev->bus, dev->devfn, where, val); 549 return pci_bus_read_config_dword(dev->bus, dev->devfn, where, val);
523} 550}
524static inline int pci_write_config_byte(struct pci_dev *dev, int where, u8 val) 551static inline int pci_write_config_byte(struct pci_dev *dev, int where, u8 val)
525{ 552{
526 return pci_bus_write_config_byte (dev->bus, dev->devfn, where, val); 553 return pci_bus_write_config_byte(dev->bus, dev->devfn, where, val);
527} 554}
528static inline int pci_write_config_word(struct pci_dev *dev, int where, u16 val) 555static inline int pci_write_config_word(struct pci_dev *dev, int where, u16 val)
529{ 556{
530 return pci_bus_write_config_word (dev->bus, dev->devfn, where, val); 557 return pci_bus_write_config_word(dev->bus, dev->devfn, where, val);
531} 558}
532static inline int pci_write_config_dword(struct pci_dev *dev, int where, u32 val) 559static inline int pci_write_config_dword(struct pci_dev *dev, int where,
560 u32 val)
533{ 561{
534 return pci_bus_write_config_dword (dev->bus, dev->devfn, where, val); 562 return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val);
535} 563}
536 564
537int __must_check pci_enable_device(struct pci_dev *dev); 565int __must_check pci_enable_device(struct pci_dev *dev);
538int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask); 566int __must_check pci_enable_device_io(struct pci_dev *dev);
567int __must_check pci_enable_device_mem(struct pci_dev *dev);
539int __must_check pci_reenable_device(struct pci_dev *); 568int __must_check pci_reenable_device(struct pci_dev *);
540int __must_check pcim_enable_device(struct pci_dev *pdev); 569int __must_check pcim_enable_device(struct pci_dev *pdev);
541void pcim_pin_device(struct pci_dev *pdev); 570void pcim_pin_device(struct pci_dev *pdev);
@@ -564,14 +593,11 @@ int pcie_set_readrq(struct pci_dev *dev, int rq);
564void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); 593void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno);
565int __must_check pci_assign_resource(struct pci_dev *dev, int i); 594int __must_check pci_assign_resource(struct pci_dev *dev, int i);
566int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i); 595int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i);
567void pci_restore_bars(struct pci_dev *dev);
568int pci_select_bars(struct pci_dev *dev, unsigned long flags); 596int pci_select_bars(struct pci_dev *dev, unsigned long flags);
569 597
570/* ROM control related routines */ 598/* ROM control related routines */
571void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size); 599void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
572void __iomem __must_check *pci_map_rom_copy(struct pci_dev *pdev, size_t *size);
573void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom); 600void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);
574void pci_remove_rom(struct pci_dev *pdev);
575size_t pci_get_rom_size(void __iomem *rom, size_t size); 601size_t pci_get_rom_size(void __iomem *rom, size_t size);
576 602
577/* Power management related routines */ 603/* Power management related routines */
@@ -582,7 +608,7 @@ pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
582int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); 608int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
583 609
584/* Functions for PCI Hotplug drivers to use */ 610/* Functions for PCI Hotplug drivers to use */
585int pci_bus_find_capability (struct pci_bus *bus, unsigned int devfn, int cap); 611int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap);
586 612
587/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ 613/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
588void pci_bus_assign_resources(struct pci_bus *bus); 614void pci_bus_assign_resources(struct pci_bus *bus);
@@ -619,17 +645,18 @@ static inline int __must_check pci_register_driver(struct pci_driver *driver)
619 return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); 645 return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME);
620} 646}
621 647
622void pci_unregister_driver(struct pci_driver *); 648void pci_unregister_driver(struct pci_driver *dev);
623void pci_remove_behind_bridge(struct pci_dev *); 649void pci_remove_behind_bridge(struct pci_dev *dev);
624struct pci_driver *pci_dev_driver(const struct pci_dev *); 650struct pci_driver *pci_dev_driver(const struct pci_dev *dev);
625const struct pci_device_id *pci_match_device(struct pci_driver *drv, struct pci_dev *dev); 651const struct pci_device_id *pci_match_id(const struct pci_device_id *ids,
626const struct pci_device_id *pci_match_id(const struct pci_device_id *ids, struct pci_dev *dev); 652 struct pci_dev *dev);
627int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass); 653int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
654 int pass);
628 655
629void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *), 656void pci_walk_bus(struct pci_bus *top, void (*cb)(struct pci_dev *, void *),
630 void *userdata); 657 void *userdata);
631int pci_cfg_space_size(struct pci_dev *dev); 658int pci_cfg_space_size(struct pci_dev *dev);
632unsigned char pci_bus_max_busnr(struct pci_bus* bus); 659unsigned char pci_bus_max_busnr(struct pci_bus *bus);
633 660
634/* kmem_cache style wrapper around pci_alloc_consistent() */ 661/* kmem_cache style wrapper around pci_alloc_consistent() */
635 662
@@ -658,19 +685,36 @@ struct msix_entry {
658 685
659 686
660#ifndef CONFIG_PCI_MSI 687#ifndef CONFIG_PCI_MSI
661static inline int pci_enable_msi(struct pci_dev *dev) {return -1;} 688static inline int pci_enable_msi(struct pci_dev *dev)
662static inline void pci_disable_msi(struct pci_dev *dev) {} 689{
663static inline int pci_enable_msix(struct pci_dev* dev, 690 return -1;
664 struct msix_entry *entries, int nvec) {return -1;} 691}
665static inline void pci_disable_msix(struct pci_dev *dev) {} 692
666static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) {} 693static inline void pci_disable_msi(struct pci_dev *dev)
694{ }
695
696static inline int pci_enable_msix(struct pci_dev *dev,
697 struct msix_entry *entries, int nvec)
698{
699 return -1;
700}
701
702static inline void pci_disable_msix(struct pci_dev *dev)
703{ }
704
705static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev)
706{ }
707
708static inline void pci_restore_msi_state(struct pci_dev *dev)
709{ }
667#else 710#else
668extern int pci_enable_msi(struct pci_dev *dev); 711extern int pci_enable_msi(struct pci_dev *dev);
669extern void pci_disable_msi(struct pci_dev *dev); 712extern void pci_disable_msi(struct pci_dev *dev);
670extern int pci_enable_msix(struct pci_dev* dev, 713extern int pci_enable_msix(struct pci_dev *dev,
671 struct msix_entry *entries, int nvec); 714 struct msix_entry *entries, int nvec);
672extern void pci_disable_msix(struct pci_dev *dev); 715extern void pci_disable_msix(struct pci_dev *dev);
673extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); 716extern void msi_remove_pci_irq_vectors(struct pci_dev *dev);
717extern void pci_restore_msi_state(struct pci_dev *dev);
674#endif 718#endif
675 719
676#ifdef CONFIG_HT_IRQ 720#ifdef CONFIG_HT_IRQ
@@ -691,7 +735,11 @@ extern void pci_unblock_user_cfg_access(struct pci_dev *dev);
691extern int pci_domains_supported; 735extern int pci_domains_supported;
692#else 736#else
693enum { pci_domains_supported = 0 }; 737enum { pci_domains_supported = 0 };
694static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } 738static inline int pci_domain_nr(struct pci_bus *bus)
739{
740 return 0;
741}
742
695static inline int pci_proc_domain(struct pci_bus *bus) 743static inline int pci_proc_domain(struct pci_bus *bus)
696{ 744{
697 return 0; 745 return 0;
@@ -705,68 +753,161 @@ static inline int pci_proc_domain(struct pci_bus *bus)
705 * these as simple inline functions to avoid hair in drivers. 753 * these as simple inline functions to avoid hair in drivers.
706 */ 754 */
707 755
708#define _PCI_NOP(o,s,t) \ 756#define _PCI_NOP(o, s, t) \
709 static inline int pci_##o##_config_##s (struct pci_dev *dev, int where, t val) \ 757 static inline int pci_##o##_config_##s(struct pci_dev *dev, \
758 int where, t val) \
710 { return PCIBIOS_FUNC_NOT_SUPPORTED; } 759 { return PCIBIOS_FUNC_NOT_SUPPORTED; }
711#define _PCI_NOP_ALL(o,x) _PCI_NOP(o,byte,u8 x) \ 760
712 _PCI_NOP(o,word,u16 x) \ 761#define _PCI_NOP_ALL(o, x) _PCI_NOP(o, byte, u8 x) \
713 _PCI_NOP(o,dword,u32 x) 762 _PCI_NOP(o, word, u16 x) \
763 _PCI_NOP(o, dword, u32 x)
714_PCI_NOP_ALL(read, *) 764_PCI_NOP_ALL(read, *)
715_PCI_NOP_ALL(write,) 765_PCI_NOP_ALL(write,)
716 766
717static inline struct pci_dev *pci_find_device(unsigned int vendor, unsigned int device, const struct pci_dev *from) 767static inline struct pci_dev *pci_find_device(unsigned int vendor,
718{ return NULL; } 768 unsigned int device,
769 const struct pci_dev *from)
770{
771 return NULL;
772}
719 773
720static inline struct pci_dev *pci_find_slot(unsigned int bus, unsigned int devfn) 774static inline struct pci_dev *pci_find_slot(unsigned int bus,
721{ return NULL; } 775 unsigned int devfn)
776{
777 return NULL;
778}
722 779
723static inline struct pci_dev *pci_get_device(unsigned int vendor, 780static inline struct pci_dev *pci_get_device(unsigned int vendor,
724 unsigned int device, struct pci_dev *from) 781 unsigned int device,
725{ return NULL; } 782 struct pci_dev *from)
783{
784 return NULL;
785}
726 786
727static inline struct pci_dev *pci_get_device_reverse(unsigned int vendor, 787static inline struct pci_dev *pci_get_device_reverse(unsigned int vendor,
728 unsigned int device, struct pci_dev *from) 788 unsigned int device,
729{ return NULL; } 789 struct pci_dev *from)
790{
791 return NULL;
792}
730 793
731static inline struct pci_dev *pci_get_subsys (unsigned int vendor, unsigned int device, 794static inline struct pci_dev *pci_get_subsys(unsigned int vendor,
732unsigned int ss_vendor, unsigned int ss_device, struct pci_dev *from) 795 unsigned int device,
733{ return NULL; } 796 unsigned int ss_vendor,
797 unsigned int ss_device,
798 struct pci_dev *from)
799{
800 return NULL;
801}
734 802
735static inline struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from) 803static inline struct pci_dev *pci_get_class(unsigned int class,
736{ return NULL; } 804 struct pci_dev *from)
805{
806 return NULL;
807}
737 808
738#define pci_dev_present(ids) (0) 809#define pci_dev_present(ids) (0)
739#define no_pci_devices() (1) 810#define no_pci_devices() (1)
740#define pci_find_present(ids) (NULL) 811#define pci_find_present(ids) (NULL)
741#define pci_dev_put(dev) do { } while (0) 812#define pci_dev_put(dev) do { } while (0)
742 813
743static inline void pci_set_master(struct pci_dev *dev) { } 814static inline void pci_set_master(struct pci_dev *dev)
744static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; } 815{ }
745static inline void pci_disable_device(struct pci_dev *dev) { } 816
746static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask) { return -EIO; } 817static inline int pci_enable_device(struct pci_dev *dev)
747static inline int pci_assign_resource(struct pci_dev *dev, int i) { return -EBUSY;} 818{
748static inline int __pci_register_driver(struct pci_driver *drv, struct module *owner) { return 0;} 819 return -EIO;
749static inline int pci_register_driver(struct pci_driver *drv) { return 0;} 820}
750static inline void pci_unregister_driver(struct pci_driver *drv) { } 821
751static inline int pci_find_capability (struct pci_dev *dev, int cap) {return 0; } 822static inline void pci_disable_device(struct pci_dev *dev)
752static inline int pci_find_next_capability (struct pci_dev *dev, u8 post, int cap) { return 0; } 823{ }
753static inline int pci_find_ext_capability (struct pci_dev *dev, int cap) {return 0; } 824
754static inline const struct pci_device_id *pci_match_device(const struct pci_device_id *ids, const struct pci_dev *dev) { return NULL; } 825static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
826{
827 return -EIO;
828}
829
830static inline int pci_assign_resource(struct pci_dev *dev, int i)
831{
832 return -EBUSY;
833}
834
835static inline int __pci_register_driver(struct pci_driver *drv,
836 struct module *owner)
837{
838 return 0;
839}
840
841static inline int pci_register_driver(struct pci_driver *drv)
842{
843 return 0;
844}
845
846static inline void pci_unregister_driver(struct pci_driver *drv)
847{ }
848
849static inline int pci_find_capability(struct pci_dev *dev, int cap)
850{
851 return 0;
852}
853
854static inline int pci_find_next_capability(struct pci_dev *dev, u8 post,
855 int cap)
856{
857 return 0;
858}
859
860static inline int pci_find_ext_capability(struct pci_dev *dev, int cap)
861{
862 return 0;
863}
864
865static inline void pcie_wait_pending_transaction(struct pci_dev *dev)
866{ }
755 867
756/* Power management related routines */ 868/* Power management related routines */
757static inline int pci_save_state(struct pci_dev *dev) { return 0; } 869static inline int pci_save_state(struct pci_dev *dev)
758static inline int pci_restore_state(struct pci_dev *dev) { return 0; } 870{
759static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state) { return 0; } 871 return 0;
760static inline pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) { return PCI_D0; } 872}
761static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable) { return 0; } 873
874static inline int pci_restore_state(struct pci_dev *dev)
875{
876 return 0;
877}
878
879static inline int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
880{
881 return 0;
882}
883
884static inline pci_power_t pci_choose_state(struct pci_dev *dev,
885 pm_message_t state)
886{
887 return PCI_D0;
888}
889
890static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state,
891 int enable)
892{
893 return 0;
894}
895
896static inline int pci_request_regions(struct pci_dev *dev, const char *res_name)
897{
898 return -EIO;
899}
762 900
763static inline int pci_request_regions(struct pci_dev *dev, const char *res_name) { return -EIO; } 901static inline void pci_release_regions(struct pci_dev *dev)
764static inline void pci_release_regions(struct pci_dev *dev) { } 902{ }
765 903
766#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0) 904#define pci_dma_burst_advice(pdev, strat, strategy_parameter) do { } while (0)
767 905
768static inline void pci_block_user_cfg_access(struct pci_dev *dev) { } 906static inline void pci_block_user_cfg_access(struct pci_dev *dev)
769static inline void pci_unblock_user_cfg_access(struct pci_dev *dev) { } 907{ }
908
909static inline void pci_unblock_user_cfg_access(struct pci_dev *dev)
910{ }
770 911
771static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from) 912static inline struct pci_bus *pci_find_next_bus(const struct pci_bus *from)
772{ return NULL; } 913{ return NULL; }
@@ -787,27 +928,27 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus,
787 928
788/* these helpers provide future and backwards compatibility 929/* these helpers provide future and backwards compatibility
789 * for accessing popular PCI BAR info */ 930 * for accessing popular PCI BAR info */
790#define pci_resource_start(dev,bar) ((dev)->resource[(bar)].start) 931#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start)
791#define pci_resource_end(dev,bar) ((dev)->resource[(bar)].end) 932#define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end)
792#define pci_resource_flags(dev,bar) ((dev)->resource[(bar)].flags) 933#define pci_resource_flags(dev, bar) ((dev)->resource[(bar)].flags)
793#define pci_resource_len(dev,bar) \ 934#define pci_resource_len(dev,bar) \
794 ((pci_resource_start((dev),(bar)) == 0 && \ 935 ((pci_resource_start((dev), (bar)) == 0 && \
795 pci_resource_end((dev),(bar)) == \ 936 pci_resource_end((dev), (bar)) == \
796 pci_resource_start((dev),(bar))) ? 0 : \ 937 pci_resource_start((dev), (bar))) ? 0 : \
797 \ 938 \
798 (pci_resource_end((dev),(bar)) - \ 939 (pci_resource_end((dev), (bar)) - \
799 pci_resource_start((dev),(bar)) + 1)) 940 pci_resource_start((dev), (bar)) + 1))
800 941
801/* Similar to the helpers above, these manipulate per-pci_dev 942/* Similar to the helpers above, these manipulate per-pci_dev
802 * driver-specific data. They are really just a wrapper around 943 * driver-specific data. They are really just a wrapper around
803 * the generic device structure functions of these calls. 944 * the generic device structure functions of these calls.
804 */ 945 */
805static inline void *pci_get_drvdata (struct pci_dev *pdev) 946static inline void *pci_get_drvdata(struct pci_dev *pdev)
806{ 947{
807 return dev_get_drvdata(&pdev->dev); 948 return dev_get_drvdata(&pdev->dev);
808} 949}
809 950
810static inline void pci_set_drvdata (struct pci_dev *pdev, void *data) 951static inline void pci_set_drvdata(struct pci_dev *pdev, void *data)
811{ 952{
812 dev_set_drvdata(&pdev->dev, data); 953 dev_set_drvdata(&pdev->dev, data);
813} 954}
@@ -826,7 +967,7 @@ static inline char *pci_name(struct pci_dev *pdev)
826 */ 967 */
827#ifndef HAVE_ARCH_PCI_RESOURCE_TO_USER 968#ifndef HAVE_ARCH_PCI_RESOURCE_TO_USER
828static inline void pci_resource_to_user(const struct pci_dev *dev, int bar, 969static inline void pci_resource_to_user(const struct pci_dev *dev, int bar,
829 const struct resource *rsrc, resource_size_t *start, 970 const struct resource *rsrc, resource_size_t *start,
830 resource_size_t *end) 971 resource_size_t *end)
831{ 972{
832 *start = rsrc->start; 973 *start = rsrc->start;
@@ -857,7 +998,7 @@ enum pci_fixup_pass {
857 998
858/* Anonymous variables would be nice... */ 999/* Anonymous variables would be nice... */
859#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \ 1000#define DECLARE_PCI_FIXUP_SECTION(section, name, vendor, device, hook) \
860 static const struct pci_fixup __pci_fixup_##name __attribute_used__ \ 1001 static const struct pci_fixup __pci_fixup_##name __used \
861 __attribute__((__section__(#section))) = { vendor, device, hook }; 1002 __attribute__((__section__(#section))) = { vendor, device, hook };
862#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \ 1003#define DECLARE_PCI_FIXUP_EARLY(vendor, device, hook) \
863 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \ 1004 DECLARE_PCI_FIXUP_SECTION(.pci_fixup_early, \
@@ -878,9 +1019,9 @@ enum pci_fixup_pass {
878 1019
879void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1020void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
880 1021
881void __iomem * pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); 1022void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);
882void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); 1023void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr);
883void __iomem * const * pcim_iomap_table(struct pci_dev *pdev); 1024void __iomem * const *pcim_iomap_table(struct pci_dev *pdev);
884int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name); 1025int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name);
885void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask); 1026void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask);
886 1027
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index ab4cb6ecd47c..8f67e8f2a3cc 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -174,7 +174,7 @@ extern int pci_hp_register (struct hotplug_slot *slot);
174extern int pci_hp_deregister (struct hotplug_slot *slot); 174extern int pci_hp_deregister (struct hotplug_slot *slot);
175extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, 175extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot,
176 struct hotplug_slot_info *info); 176 struct hotplug_slot_info *info);
177extern struct kset pci_hotplug_slots_subsys; 177extern struct kset *pci_hotplug_slots_kset;
178 178
179/* PCI Setting Record (Type 0) */ 179/* PCI Setting Record (Type 0) */
180struct hpp_type0 { 180struct hpp_type0 {
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index e44aac8cf5ff..41f6f28690f6 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -360,9 +360,6 @@
360#define PCI_DEVICE_ID_ATI_RS400_166 0x5a32 360#define PCI_DEVICE_ID_ATI_RS400_166 0x5a32
361#define PCI_DEVICE_ID_ATI_RS400_200 0x5a33 361#define PCI_DEVICE_ID_ATI_RS400_200 0x5a33
362#define PCI_DEVICE_ID_ATI_RS480 0x5950 362#define PCI_DEVICE_ID_ATI_RS480 0x5950
363#define PCI_DEVICE_ID_ATI_RD580 0x5952
364#define PCI_DEVICE_ID_ATI_RX790 0x5957
365#define PCI_DEVICE_ID_ATI_RS690 0x7910
366/* ATI IXP Chipset */ 363/* ATI IXP Chipset */
367#define PCI_DEVICE_ID_ATI_IXP200_IDE 0x4349 364#define PCI_DEVICE_ID_ATI_IXP200_IDE 0x4349
368#define PCI_DEVICE_ID_ATI_IXP200_SMBUS 0x4353 365#define PCI_DEVICE_ID_ATI_IXP200_SMBUS 0x4353
@@ -1240,6 +1237,10 @@
1240#define PCI_DEVICE_ID_NVIDIA_NVENET_33 0x0761 1237#define PCI_DEVICE_ID_NVIDIA_NVENET_33 0x0761
1241#define PCI_DEVICE_ID_NVIDIA_NVENET_34 0x0762 1238#define PCI_DEVICE_ID_NVIDIA_NVENET_34 0x0762
1242#define PCI_DEVICE_ID_NVIDIA_NVENET_35 0x0763 1239#define PCI_DEVICE_ID_NVIDIA_NVENET_35 0x0763
1240#define PCI_DEVICE_ID_NVIDIA_NVENET_36 0x0AB0
1241#define PCI_DEVICE_ID_NVIDIA_NVENET_37 0x0AB1
1242#define PCI_DEVICE_ID_NVIDIA_NVENET_38 0x0AB2
1243#define PCI_DEVICE_ID_NVIDIA_NVENET_39 0x0AB3
1243 1244
1244#define PCI_VENDOR_ID_IMS 0x10e0 1245#define PCI_VENDOR_ID_IMS 0x10e0
1245#define PCI_DEVICE_ID_IMS_TT128 0x9128 1246#define PCI_DEVICE_ID_IMS_TT128 0x9128
@@ -1436,8 +1437,8 @@
1436#define PCI_DEVICE_ID_SERVERWORKS_HE 0x0008 1437#define PCI_DEVICE_ID_SERVERWORKS_HE 0x0008
1437#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009 1438#define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009
1438#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017 1439#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017
1440#define PCI_DEVICE_ID_SERVERWORKS_HT1000_PXB 0x0036
1439#define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103 1441#define PCI_DEVICE_ID_SERVERWORKS_EPB 0x0103
1440#define PCI_DEVICE_ID_SERVERWORKS_HT1000_PCIX 0x0104
1441#define PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE 0x0132 1442#define PCI_DEVICE_ID_SERVERWORKS_HT2000_PCIE 0x0132
1442#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 1443#define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200
1443#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201 1444#define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201
@@ -1942,6 +1943,7 @@
1942#define PCI_DEVICE_ID_NX2_5706 0x164a 1943#define PCI_DEVICE_ID_NX2_5706 0x164a
1943#define PCI_DEVICE_ID_NX2_5708 0x164c 1944#define PCI_DEVICE_ID_NX2_5708 0x164c
1944#define PCI_DEVICE_ID_TIGON3_5702FE 0x164d 1945#define PCI_DEVICE_ID_TIGON3_5702FE 0x164d
1946#define PCI_DEVICE_ID_NX2_57710 0x164e
1945#define PCI_DEVICE_ID_TIGON3_5705 0x1653 1947#define PCI_DEVICE_ID_TIGON3_5705 0x1653
1946#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 1948#define PCI_DEVICE_ID_TIGON3_5705_2 0x1654
1947#define PCI_DEVICE_ID_TIGON3_5720 0x1658 1949#define PCI_DEVICE_ID_TIGON3_5720 0x1658
@@ -2065,6 +2067,9 @@
2065#define PCI_VENDOR_ID_NETCELL 0x169c 2067#define PCI_VENDOR_ID_NETCELL 0x169c
2066#define PCI_DEVICE_ID_REVOLUTION 0x0044 2068#define PCI_DEVICE_ID_REVOLUTION 0x0044
2067 2069
2070#define PCI_VENDOR_ID_CENATEK 0x16CA
2071#define PCI_DEVICE_ID_CENATEK_IDE 0x0001
2072
2068#define PCI_VENDOR_ID_VITESSE 0x1725 2073#define PCI_VENDOR_ID_VITESSE 0x1725
2069#define PCI_DEVICE_ID_VITESSE_VSC7174 0x7174 2074#define PCI_DEVICE_ID_VITESSE_VSC7174 0x7174
2070 2075
@@ -2077,6 +2082,16 @@
2077#define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea 2082#define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea
2078#define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb 2083#define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb
2079 2084
2085#define PCI_VENDOR_ID_BELKIN 0x1799
2086#define PCI_DEVICE_ID_BELKIN_F5D7010V7 0x701f
2087
2088#define PCI_VENDOR_ID_RDC 0x17f3
2089#define PCI_DEVICE_ID_RDC_R6020 0x6020
2090#define PCI_DEVICE_ID_RDC_R6030 0x6030
2091#define PCI_DEVICE_ID_RDC_R6040 0x6040
2092#define PCI_DEVICE_ID_RDC_R6060 0x6060
2093#define PCI_DEVICE_ID_RDC_R6061 0x6061
2094
2080#define PCI_VENDOR_ID_LENOVO 0x17aa 2095#define PCI_VENDOR_ID_LENOVO 0x17aa
2081 2096
2082#define PCI_VENDOR_ID_ARECA 0x17d3 2097#define PCI_VENDOR_ID_ARECA 0x17d3
@@ -2105,6 +2120,8 @@
2105#define PCI_DEVICE_ID_HERC_WIN 0x5732 2120#define PCI_DEVICE_ID_HERC_WIN 0x5732
2106#define PCI_DEVICE_ID_HERC_UNI 0x5832 2121#define PCI_DEVICE_ID_HERC_UNI 0x5832
2107 2122
2123#define PCI_VENDOR_ID_RDC 0x17f3
2124
2108#define PCI_VENDOR_ID_SITECOM 0x182d 2125#define PCI_VENDOR_ID_SITECOM 0x182d
2109#define PCI_DEVICE_ID_SITECOM_DC105V2 0x3069 2126#define PCI_DEVICE_ID_SITECOM_DC105V2 0x3069
2110 2127
@@ -2147,6 +2164,7 @@
2147#define PCI_DEVICE_ID_JMICRON_JMB365 0x2365 2164#define PCI_DEVICE_ID_JMICRON_JMB365 0x2365
2148#define PCI_DEVICE_ID_JMICRON_JMB366 0x2366 2165#define PCI_DEVICE_ID_JMICRON_JMB366 0x2366
2149#define PCI_DEVICE_ID_JMICRON_JMB368 0x2368 2166#define PCI_DEVICE_ID_JMICRON_JMB368 0x2368
2167#define PCI_DEVICE_ID_JMICRON_JMB38X_SD 0x2381
2150 2168
2151#define PCI_VENDOR_ID_KORENIX 0x1982 2169#define PCI_VENDOR_ID_KORENIX 0x1982
2152#define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600 2170#define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600
@@ -2279,6 +2297,9 @@
2279#define PCI_DEVICE_ID_INTEL_82915G_IG 0x2582 2297#define PCI_DEVICE_ID_INTEL_82915G_IG 0x2582
2280#define PCI_DEVICE_ID_INTEL_82915GM_HB 0x2590 2298#define PCI_DEVICE_ID_INTEL_82915GM_HB 0x2590
2281#define PCI_DEVICE_ID_INTEL_82915GM_IG 0x2592 2299#define PCI_DEVICE_ID_INTEL_82915GM_IG 0x2592
2300#define PCI_DEVICE_ID_INTEL_5000_ERR 0x25F0
2301#define PCI_DEVICE_ID_INTEL_5000_FBD0 0x25F5
2302#define PCI_DEVICE_ID_INTEL_5000_FBD1 0x25F6
2282#define PCI_DEVICE_ID_INTEL_82945G_HB 0x2770 2303#define PCI_DEVICE_ID_INTEL_82945G_HB 0x2770
2283#define PCI_DEVICE_ID_INTEL_82945G_IG 0x2772 2304#define PCI_DEVICE_ID_INTEL_82945G_IG 0x2772
2284#define PCI_DEVICE_ID_INTEL_3000_HB 0x2778 2305#define PCI_DEVICE_ID_INTEL_3000_HB 0x2778
@@ -2317,6 +2338,8 @@
2317#define PCI_DEVICE_ID_INTEL_ICH9_4 0x2914 2338#define PCI_DEVICE_ID_INTEL_ICH9_4 0x2914
2318#define PCI_DEVICE_ID_INTEL_ICH9_5 0x2919 2339#define PCI_DEVICE_ID_INTEL_ICH9_5 0x2919
2319#define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930 2340#define PCI_DEVICE_ID_INTEL_ICH9_6 0x2930
2341#define PCI_DEVICE_ID_INTEL_ICH9_7 0x2916
2342#define PCI_DEVICE_ID_INTEL_ICH9_8 0x2918
2320#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340 2343#define PCI_DEVICE_ID_INTEL_82855PM_HB 0x3340
2321#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575 2344#define PCI_DEVICE_ID_INTEL_82830_HB 0x3575
2322#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577 2345#define PCI_DEVICE_ID_INTEL_82830_CGC 0x3577
@@ -2332,6 +2355,7 @@
2332#define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a 2355#define PCI_DEVICE_ID_INTEL_MCH_PC1 0x359a
2333#define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e 2356#define PCI_DEVICE_ID_INTEL_E7525_MCH 0x359e
2334#define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b 2357#define PCI_DEVICE_ID_INTEL_IOAT_CNB 0x360b
2358#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f
2335#define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff 2359#define PCI_DEVICE_ID_INTEL_IOAT_SCNB 0x65ff
2336#define PCI_DEVICE_ID_INTEL_TOLAPAI_0 0x5031 2360#define PCI_DEVICE_ID_INTEL_TOLAPAI_0 0x5031
2337#define PCI_DEVICE_ID_INTEL_TOLAPAI_1 0x5032 2361#define PCI_DEVICE_ID_INTEL_TOLAPAI_1 0x5032
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index c1914a8b94a9..c0c1223c9194 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -395,9 +395,17 @@
395#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ 395#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */
396#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ 396#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */
397#define PCI_EXP_LNKCAP 12 /* Link Capabilities */ 397#define PCI_EXP_LNKCAP 12 /* Link Capabilities */
398#define PCI_EXP_LNKCAP_ASPMS 0xc00 /* ASPM Support */
399#define PCI_EXP_LNKCAP_L0SEL 0x7000 /* L0s Exit Latency */
400#define PCI_EXP_LNKCAP_L1EL 0x38000 /* L1 Exit Latency */
401#define PCI_EXP_LNKCAP_CLKPM 0x40000 /* L1 Clock Power Management */
398#define PCI_EXP_LNKCTL 16 /* Link Control */ 402#define PCI_EXP_LNKCTL 16 /* Link Control */
403#define PCI_EXP_LNKCTL_RL 0x20 /* Retrain Link */
404#define PCI_EXP_LNKCTL_CCC 0x40 /* Common Clock COnfiguration */
399#define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */ 405#define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */
400#define PCI_EXP_LNKSTA 18 /* Link Status */ 406#define PCI_EXP_LNKSTA 18 /* Link Status */
407#define PCI_EXP_LNKSTA_LT 0x800 /* Link Training */
408#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */
401#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ 409#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */
402#define PCI_EXP_SLTCTL 24 /* Slot Control */ 410#define PCI_EXP_SLTCTL 24 /* Slot Control */
403#define PCI_EXP_SLTSTA 26 /* Slot Status */ 411#define PCI_EXP_SLTSTA 26 /* Slot Status */
diff --git a/include/linux/pcounter.h b/include/linux/pcounter.h
new file mode 100644
index 000000000000..a82d9f2628ca
--- /dev/null
+++ b/include/linux/pcounter.h
@@ -0,0 +1,74 @@
1#ifndef __LINUX_PCOUNTER_H
2#define __LINUX_PCOUNTER_H
3/*
4 * Using a dynamic percpu 'int' variable has a cost :
5 * 1) Extra dereference
6 * Current per_cpu_ptr() implementation uses an array per 'percpu variable'.
7 * 2) memory cost of NR_CPUS*(32+sizeof(void *)) instead of num_possible_cpus()*4
8 *
9 * This pcounter implementation is an abstraction to be able to use
10 * either a static or a dynamic per cpu variable.
11 * One dynamic per cpu variable gets a fast & cheap implementation, we can
12 * change pcounter implementation too.
13 */
14struct pcounter {
15#ifdef CONFIG_SMP
16 void (*add)(struct pcounter *self, int inc);
17 int (*getval)(const struct pcounter *self, int cpu);
18 int *per_cpu_values;
19#else
20 int val;
21#endif
22};
23
24#ifdef CONFIG_SMP
25#include <linux/percpu.h>
26
27#define DEFINE_PCOUNTER(NAME) \
28static DEFINE_PER_CPU(int, NAME##_pcounter_values); \
29static void NAME##_pcounter_add(struct pcounter *self, int val) \
30{ \
31 __get_cpu_var(NAME##_pcounter_values) += val; \
32} \
33static int NAME##_pcounter_getval(const struct pcounter *self, int cpu) \
34{ \
35 return per_cpu(NAME##_pcounter_values, cpu); \
36} \
37
38#define PCOUNTER_MEMBER_INITIALIZER(NAME, MEMBER) \
39 MEMBER = { \
40 .add = NAME##_pcounter_add, \
41 .getval = NAME##_pcounter_getval, \
42 }
43
44
45static inline void pcounter_add(struct pcounter *self, int inc)
46{
47 self->add(self, inc);
48}
49
50extern int pcounter_getval(const struct pcounter *self);
51extern int pcounter_alloc(struct pcounter *self);
52extern void pcounter_free(struct pcounter *self);
53
54
55#else /* CONFIG_SMP */
56
57static inline void pcounter_add(struct pcounter *self, int inc)
58{
59 self->val += inc;
60}
61
62static inline int pcounter_getval(const struct pcounter *self)
63{
64 return self->val;
65}
66
67#define DEFINE_PCOUNTER(NAME)
68#define PCOUNTER_MEMBER_INITIALIZER(NAME, MEMBER)
69#define pcounter_alloc(self) 0
70#define pcounter_free(self)
71
72#endif /* CONFIG_SMP */
73
74#endif /* __LINUX_PCOUNTER_H */
diff --git a/include/linux/pda_power.h b/include/linux/pda_power.h
index 1375f15797e7..225beb136807 100644
--- a/include/linux/pda_power.h
+++ b/include/linux/pda_power.h
@@ -26,6 +26,7 @@ struct pda_power_pdata {
26 26
27 unsigned int wait_for_status; /* msecs, default is 500 */ 27 unsigned int wait_for_status; /* msecs, default is 500 */
28 unsigned int wait_for_charger; /* msecs, default is 500 */ 28 unsigned int wait_for_charger; /* msecs, default is 500 */
29 unsigned int polling_interval; /* msecs, default is 2000 */
29}; 30};
30 31
31#endif /* __PDA_POWER_H__ */ 32#endif /* __PDA_POWER_H__ */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 926adaae0f96..50faa0ea28e4 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -9,6 +9,26 @@
9 9
10#include <asm/percpu.h> 10#include <asm/percpu.h>
11 11
12#ifdef CONFIG_SMP
13#define DEFINE_PER_CPU(type, name) \
14 __attribute__((__section__(".data.percpu"))) \
15 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
16
17#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
18 __attribute__((__section__(".data.percpu.shared_aligned"))) \
19 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name \
20 ____cacheline_aligned_in_smp
21#else
22#define DEFINE_PER_CPU(type, name) \
23 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
24
25#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
26 DEFINE_PER_CPU(type, name)
27#endif
28
29#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
30#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
31
12/* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */ 32/* Enough to cover all DEFINE_PER_CPUs in kernel, including modules. */
13#ifndef PERCPU_ENOUGH_ROOM 33#ifndef PERCPU_ENOUGH_ROOM
14#ifdef CONFIG_MODULES 34#ifdef CONFIG_MODULES
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index d9db5f62ee48..6db69ff5d83e 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -298,6 +298,12 @@ struct sadb_x_sec_ctx {
298#define SADB_X_EALG_BLOWFISHCBC 7 298#define SADB_X_EALG_BLOWFISHCBC 7
299#define SADB_EALG_NULL 11 299#define SADB_EALG_NULL 11
300#define SADB_X_EALG_AESCBC 12 300#define SADB_X_EALG_AESCBC 12
301#define SADB_X_EALG_AES_CCM_ICV8 14
302#define SADB_X_EALG_AES_CCM_ICV12 15
303#define SADB_X_EALG_AES_CCM_ICV16 16
304#define SADB_X_EALG_AES_GCM_ICV8 18
305#define SADB_X_EALG_AES_GCM_ICV12 19
306#define SADB_X_EALG_AES_GCM_ICV16 20
301#define SADB_X_EALG_CAMELLIACBC 22 307#define SADB_X_EALG_CAMELLIACBC 22
302#define SADB_EALG_MAX 253 /* last EALG */ 308#define SADB_EALG_MAX 253 /* last EALG */
303/* private allocations should use 249-255 (RFC2407) */ 309/* private allocations should use 249-255 (RFC2407) */
diff --git a/include/linux/phy.h b/include/linux/phy.h
index f0742b6aaa64..554836edd915 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -58,6 +58,8 @@ typedef enum {
58 PHY_INTERFACE_MODE_RMII, 58 PHY_INTERFACE_MODE_RMII,
59 PHY_INTERFACE_MODE_RGMII, 59 PHY_INTERFACE_MODE_RGMII,
60 PHY_INTERFACE_MODE_RGMII_ID, 60 PHY_INTERFACE_MODE_RGMII_ID,
61 PHY_INTERFACE_MODE_RGMII_RXID,
62 PHY_INTERFACE_MODE_RGMII_TXID,
61 PHY_INTERFACE_MODE_RTBI 63 PHY_INTERFACE_MODE_RTBI
62} phy_interface_t; 64} phy_interface_t;
63 65
@@ -401,6 +403,7 @@ int phy_mii_ioctl(struct phy_device *phydev,
401int phy_start_interrupts(struct phy_device *phydev); 403int phy_start_interrupts(struct phy_device *phydev);
402void phy_print_status(struct phy_device *phydev); 404void phy_print_status(struct phy_device *phydev);
403struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id); 405struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id);
406void phy_device_free(struct phy_device *phydev);
404 407
405extern struct bus_type mdio_bus_type; 408extern struct bus_type mdio_bus_type;
406#endif /* __PHY_H */ 409#endif /* __PHY_H */
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h
index 04ba70d49fb8..509d8f5f984e 100644
--- a/include/linux/phy_fixed.h
+++ b/include/linux/phy_fixed.h
@@ -1,38 +1,31 @@
1#ifndef __PHY_FIXED_H 1#ifndef __PHY_FIXED_H
2#define __PHY_FIXED_H 2#define __PHY_FIXED_H
3 3
4#define MII_REGS_NUM 29
5
6/* max number of virtual phy stuff */
7#define MAX_PHY_AMNT 10
8/*
9 The idea is to emulate normal phy behavior by responding with
10 pre-defined values to mii BMCR read, so that read_status hook could
11 take all the needed info.
12*/
13
14struct fixed_phy_status { 4struct fixed_phy_status {
15 u8 link; 5 int link;
16 u16 speed; 6 int speed;
17 u8 duplex; 7 int duplex;
8 int pause;
9 int asym_pause;
18}; 10};
19 11
20/*----------------------------------------------------------------------------- 12#ifdef CONFIG_FIXED_PHY
21 * Private information hoder for mii_bus 13extern int fixed_phy_add(unsigned int irq, int phy_id,
22 *-----------------------------------------------------------------------------*/ 14 struct fixed_phy_status *status);
23struct fixed_info { 15#else
24 u16 *regs; 16static inline int fixed_phy_add(unsigned int irq, int phy_id,
25 u8 regs_num; 17 struct fixed_phy_status *status)
26 struct fixed_phy_status phy_status; 18{
27 struct phy_device *phydev; /* pointer to the container */ 19 return -ENODEV;
28 /* link & speed cb */ 20}
29 int (*link_update) (struct net_device *, struct fixed_phy_status *); 21#endif /* CONFIG_FIXED_PHY */
30 22
31}; 23/*
32 24 * This function issued only by fixed_phy-aware drivers, no need
33 25 * protect it with #ifdef
34int fixed_mdio_set_link_update(struct phy_device *, 26 */
35 int (*link_update) (struct net_device *, struct fixed_phy_status *)); 27extern int fixed_phy_set_link_update(struct phy_device *phydev,
36struct fixed_info *fixed_mdio_get_phydev (int phydev_ind); 28 int (*link_update)(struct net_device *,
29 struct fixed_phy_status *));
37 30
38#endif /* __PHY_FIXED_H */ 31#endif /* __PHY_FIXED_H */
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index 0135c76c76c6..1689e28483e4 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -29,6 +29,7 @@ struct pid_namespace {
29 29
30extern struct pid_namespace init_pid_ns; 30extern struct pid_namespace init_pid_ns;
31 31
32#ifdef CONFIG_PID_NS
32static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns) 33static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
33{ 34{
34 if (ns != &init_pid_ns) 35 if (ns != &init_pid_ns)
@@ -45,6 +46,28 @@ static inline void put_pid_ns(struct pid_namespace *ns)
45 kref_put(&ns->kref, free_pid_ns); 46 kref_put(&ns->kref, free_pid_ns);
46} 47}
47 48
49#else /* !CONFIG_PID_NS */
50#include <linux/err.h>
51
52static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
53{
54 return ns;
55}
56
57static inline struct pid_namespace *
58copy_pid_ns(unsigned long flags, struct pid_namespace *ns)
59{
60 if (flags & CLONE_NEWPID)
61 ns = ERR_PTR(-EINVAL);
62 return ns;
63}
64
65static inline void put_pid_ns(struct pid_namespace *ns)
66{
67}
68
69#endif /* CONFIG_PID_NS */
70
48static inline struct pid_namespace *task_active_pid_ns(struct task_struct *tsk) 71static inline struct pid_namespace *task_active_pid_ns(struct task_struct *tsk)
49{ 72{
50 return tsk->nsproxy->pid_ns; 73 return tsk->nsproxy->pid_ns;
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h
index 30b8571e6b34..1c1dba9ea5fb 100644
--- a/include/linux/pkt_cls.h
+++ b/include/linux/pkt_cls.h
@@ -328,6 +328,56 @@ enum
328 328
329#define TCA_TCINDEX_MAX (__TCA_TCINDEX_MAX - 1) 329#define TCA_TCINDEX_MAX (__TCA_TCINDEX_MAX - 1)
330 330
331/* Flow filter */
332
333enum
334{
335 FLOW_KEY_SRC,
336 FLOW_KEY_DST,
337 FLOW_KEY_PROTO,
338 FLOW_KEY_PROTO_SRC,
339 FLOW_KEY_PROTO_DST,
340 FLOW_KEY_IIF,
341 FLOW_KEY_PRIORITY,
342 FLOW_KEY_MARK,
343 FLOW_KEY_NFCT,
344 FLOW_KEY_NFCT_SRC,
345 FLOW_KEY_NFCT_DST,
346 FLOW_KEY_NFCT_PROTO_SRC,
347 FLOW_KEY_NFCT_PROTO_DST,
348 FLOW_KEY_RTCLASSID,
349 FLOW_KEY_SKUID,
350 FLOW_KEY_SKGID,
351 __FLOW_KEY_MAX,
352};
353
354#define FLOW_KEY_MAX (__FLOW_KEY_MAX - 1)
355
356enum
357{
358 FLOW_MODE_MAP,
359 FLOW_MODE_HASH,
360};
361
362enum
363{
364 TCA_FLOW_UNSPEC,
365 TCA_FLOW_KEYS,
366 TCA_FLOW_MODE,
367 TCA_FLOW_BASECLASS,
368 TCA_FLOW_RSHIFT,
369 TCA_FLOW_ADDEND,
370 TCA_FLOW_MASK,
371 TCA_FLOW_XOR,
372 TCA_FLOW_DIVISOR,
373 TCA_FLOW_ACT,
374 TCA_FLOW_POLICE,
375 TCA_FLOW_EMATCHES,
376 __TCA_FLOW_MAX
377};
378
379#define TCA_FLOW_MAX (__TCA_FLOW_MAX - 1)
380
331/* Basic filter */ 381/* Basic filter */
332 382
333enum 383enum
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 919af93b7059..dbb7ac37960d 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -83,6 +83,8 @@ struct tc_ratespec
83 __u32 rate; 83 __u32 rate;
84}; 84};
85 85
86#define TC_RTAB_SIZE 1024
87
86/* FIFO section */ 88/* FIFO section */
87 89
88struct tc_fifo_qopt 90struct tc_fifo_qopt
@@ -148,6 +150,11 @@ struct tc_sfq_qopt
148 unsigned flows; /* Maximal number of flows */ 150 unsigned flows; /* Maximal number of flows */
149}; 151};
150 152
153struct tc_sfq_xstats
154{
155 __s32 allot;
156};
157
151/* 158/*
152 * NOTE: limit, divisor and flows are hardwired to code at the moment. 159 * NOTE: limit, divisor and flows are hardwired to code at the moment.
153 * 160 *
diff --git a/include/linux/pktcdvd.h b/include/linux/pktcdvd.h
index 5ea4f05683f6..04b4d7330e6d 100644
--- a/include/linux/pktcdvd.h
+++ b/include/linux/pktcdvd.h
@@ -290,7 +290,7 @@ struct pktcdvd_device
290 int write_congestion_off; 290 int write_congestion_off;
291 int write_congestion_on; 291 int write_congestion_on;
292 292
293 struct class_device *clsdev; /* sysfs pktcdvd[0-7] class dev */ 293 struct device *dev; /* sysfs pktcdvd[0-7] dev */
294 struct pktcdvd_kobj *kobj_stat; /* sysfs pktcdvd[0-7]/stat/ */ 294 struct pktcdvd_kobj *kobj_stat; /* sysfs pktcdvd[0-7]/stat/ */
295 struct pktcdvd_kobj *kobj_wqueue; /* sysfs pktcdvd[0-7]/write_queue/ */ 295 struct pktcdvd_kobj *kobj_wqueue; /* sysfs pktcdvd[0-7]/write_queue/ */
296 296
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index e80804316cdb..3261681c82a4 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -35,7 +35,7 @@ extern struct resource *platform_get_resource_byname(struct platform_device *, u
35extern int platform_get_irq_byname(struct platform_device *, char *); 35extern int platform_get_irq_byname(struct platform_device *, char *);
36extern int platform_add_devices(struct platform_device **, int); 36extern int platform_add_devices(struct platform_device **, int);
37 37
38extern struct platform_device *platform_device_register_simple(char *, int id, 38extern struct platform_device *platform_device_register_simple(const char *, int id,
39 struct resource *, unsigned int); 39 struct resource *, unsigned int);
40 40
41extern struct platform_device *platform_device_alloc(const char *name, int id); 41extern struct platform_device *platform_device_alloc(const char *name, int id);
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 09a309b7b5d2..b78e0295adf4 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -246,6 +246,15 @@ static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
246 device_set_wakeup_enable(dev,val); \ 246 device_set_wakeup_enable(dev,val); \
247 } while(0) 247 } while(0)
248 248
249/*
250 * Global Power Management flags
251 * Used to keep APM and ACPI from both being active
252 */
253extern unsigned int pm_flags;
254
255#define PM_APM 1
256#define PM_ACPI 2
257
249#endif /* __KERNEL__ */ 258#endif /* __KERNEL__ */
250 259
251#endif /* _LINUX_PM_H */ 260#endif /* _LINUX_PM_H */
diff --git a/include/linux/pm_legacy.h b/include/linux/pm_legacy.h
index 514729a44688..446f4f42b952 100644
--- a/include/linux/pm_legacy.h
+++ b/include/linux/pm_legacy.h
@@ -4,10 +4,6 @@
4 4
5#ifdef CONFIG_PM_LEGACY 5#ifdef CONFIG_PM_LEGACY
6 6
7extern int pm_active;
8
9#define PM_IS_ACTIVE() (pm_active != 0)
10
11/* 7/*
12 * Register a device with power management 8 * Register a device with power management
13 */ 9 */
@@ -21,8 +17,6 @@ int __deprecated pm_send_all(pm_request_t rqst, void *data);
21 17
22#else /* CONFIG_PM_LEGACY */ 18#else /* CONFIG_PM_LEGACY */
23 19
24#define PM_IS_ACTIVE() 0
25
26static inline struct pm_dev *pm_register(pm_dev_t type, 20static inline struct pm_dev *pm_register(pm_dev_t type,
27 unsigned long id, 21 unsigned long id,
28 pm_callback callback) 22 pm_callback callback)
diff --git a/include/linux/pmu.h b/include/linux/pmu.h
index b7824c215354..4c5f65392d36 100644
--- a/include/linux/pmu.h
+++ b/include/linux/pmu.h
@@ -159,41 +159,7 @@ extern void pmu_unlock(void);
159extern int pmu_present(void); 159extern int pmu_present(void);
160extern int pmu_get_model(void); 160extern int pmu_get_model(void);
161 161
162#ifdef CONFIG_PM 162extern void pmu_backlight_set_sleep(int sleep);
163/*
164 * Stuff for putting the powerbook to sleep and waking it again.
165 *
166 */
167#include <linux/list.h>
168
169struct pmu_sleep_notifier
170{
171 void (*notifier_call)(struct pmu_sleep_notifier *self, int when);
172 int priority;
173 struct list_head list;
174};
175
176/* Code values for calling sleep/wakeup handlers
177 */
178#define PBOOK_SLEEP_REQUEST 1
179#define PBOOK_SLEEP_NOW 2
180#define PBOOK_WAKE 3
181
182/* priority levels in notifiers */
183#define SLEEP_LEVEL_VIDEO 100 /* Video driver (first wake) */
184#define SLEEP_LEVEL_MEDIABAY 90 /* Media bay driver */
185#define SLEEP_LEVEL_BLOCK 80 /* IDE, SCSI */
186#define SLEEP_LEVEL_NET 70 /* bmac, gmac */
187#define SLEEP_LEVEL_MISC 60 /* Anything else */
188#define SLEEP_LEVEL_USERLAND 55 /* Reserved for apm_emu */
189#define SLEEP_LEVEL_ADB 50 /* ADB (async) */
190#define SLEEP_LEVEL_SOUND 40 /* Sound driver (blocking) */
191
192/* special register notifier functions */
193int pmu_register_sleep_notifier(struct pmu_sleep_notifier* notifier);
194int pmu_unregister_sleep_notifier(struct pmu_sleep_notifier* notifier);
195
196#endif /* CONFIG_PM */
197 163
198#define PMU_MAX_BATTERIES 2 164#define PMU_MAX_BATTERIES 2
199 165
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 664d68cb1fbd..2a6d62c7d2d1 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -13,8 +13,8 @@
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/mod_devicetable.h> 14#include <linux/mod_devicetable.h>
15 15
16#define PNP_MAX_PORT 8 16#define PNP_MAX_PORT 40
17#define PNP_MAX_MEM 4 17#define PNP_MAX_MEM 12
18#define PNP_MAX_IRQ 2 18#define PNP_MAX_IRQ 2
19#define PNP_MAX_DMA 2 19#define PNP_MAX_DMA 2
20#define PNP_NAME_LEN 50 20#define PNP_NAME_LEN 50
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 606c0957997f..5cbf3e371012 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -54,15 +54,7 @@ enum {
54 POWER_SUPPLY_TECHNOLOGY_LIPO, 54 POWER_SUPPLY_TECHNOLOGY_LIPO,
55 POWER_SUPPLY_TECHNOLOGY_LiFe, 55 POWER_SUPPLY_TECHNOLOGY_LiFe,
56 POWER_SUPPLY_TECHNOLOGY_NiCd, 56 POWER_SUPPLY_TECHNOLOGY_NiCd,
57}; 57 POWER_SUPPLY_TECHNOLOGY_LiMn,
58
59enum {
60 POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN = 0,
61 POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL,
62 POWER_SUPPLY_CAPACITY_LEVEL_LOW,
63 POWER_SUPPLY_CAPACITY_LEVEL_NORMAL,
64 POWER_SUPPLY_CAPACITY_LEVEL_HIGH,
65 POWER_SUPPLY_CAPACITY_LEVEL_FULL,
66}; 58};
67 59
68enum power_supply_property { 60enum power_supply_property {
@@ -72,6 +64,8 @@ enum power_supply_property {
72 POWER_SUPPLY_PROP_PRESENT, 64 POWER_SUPPLY_PROP_PRESENT,
73 POWER_SUPPLY_PROP_ONLINE, 65 POWER_SUPPLY_PROP_ONLINE,
74 POWER_SUPPLY_PROP_TECHNOLOGY, 66 POWER_SUPPLY_PROP_TECHNOLOGY,
67 POWER_SUPPLY_PROP_VOLTAGE_MAX,
68 POWER_SUPPLY_PROP_VOLTAGE_MIN,
75 POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, 69 POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
76 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, 70 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
77 POWER_SUPPLY_PROP_VOLTAGE_NOW, 71 POWER_SUPPLY_PROP_VOLTAGE_NOW,
@@ -91,7 +85,6 @@ enum power_supply_property {
91 POWER_SUPPLY_PROP_ENERGY_NOW, 85 POWER_SUPPLY_PROP_ENERGY_NOW,
92 POWER_SUPPLY_PROP_ENERGY_AVG, 86 POWER_SUPPLY_PROP_ENERGY_AVG,
93 POWER_SUPPLY_PROP_CAPACITY, /* in percents! */ 87 POWER_SUPPLY_PROP_CAPACITY, /* in percents! */
94 POWER_SUPPLY_PROP_CAPACITY_LEVEL,
95 POWER_SUPPLY_PROP_TEMP, 88 POWER_SUPPLY_PROP_TEMP,
96 POWER_SUPPLY_PROP_TEMP_AMBIENT, 89 POWER_SUPPLY_PROP_TEMP_AMBIENT,
97 POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW, 90 POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW,
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 1ff461672060..8f92546b403d 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -48,6 +48,8 @@ typedef int (read_proc_t)(char *page, char **start, off_t off,
48typedef int (write_proc_t)(struct file *file, const char __user *buffer, 48typedef int (write_proc_t)(struct file *file, const char __user *buffer,
49 unsigned long count, void *data); 49 unsigned long count, void *data);
50typedef int (get_info_t)(char *, char **, off_t, int); 50typedef int (get_info_t)(char *, char **, off_t, int);
51typedef struct proc_dir_entry *(shadow_proc_t)(struct task_struct *task,
52 struct proc_dir_entry *pde);
51 53
52struct proc_dir_entry { 54struct proc_dir_entry {
53 unsigned int low_ino; 55 unsigned int low_ino;
@@ -75,10 +77,10 @@ struct proc_dir_entry {
75 read_proc_t *read_proc; 77 read_proc_t *read_proc;
76 write_proc_t *write_proc; 78 write_proc_t *write_proc;
77 atomic_t count; /* use count */ 79 atomic_t count; /* use count */
78 int deleted; /* delete flag */
79 int pde_users; /* number of callers into module in progress */ 80 int pde_users; /* number of callers into module in progress */
80 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */ 81 spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */
81 struct completion *pde_unload_completion; 82 struct completion *pde_unload_completion;
83 shadow_proc_t *shadow_proc;
82}; 84};
83 85
84struct kcore_list { 86struct kcore_list {
@@ -196,11 +198,11 @@ static inline struct proc_dir_entry *create_proc_info_entry(const char *name,
196 return res; 198 return res;
197} 199}
198 200
199extern struct proc_dir_entry *proc_net_create(struct net *net,
200 const char *name, mode_t mode, get_info_t *get_info);
201extern struct proc_dir_entry *proc_net_fops_create(struct net *net, 201extern struct proc_dir_entry *proc_net_fops_create(struct net *net,
202 const char *name, mode_t mode, const struct file_operations *fops); 202 const char *name, mode_t mode, const struct file_operations *fops);
203extern void proc_net_remove(struct net *net, const char *name); 203extern void proc_net_remove(struct net *net, const char *name);
204extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
205 struct proc_dir_entry *parent);
204 206
205#else 207#else
206 208
@@ -208,7 +210,6 @@ extern void proc_net_remove(struct net *net, const char *name);
208#define proc_bus NULL 210#define proc_bus NULL
209 211
210#define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; }) 212#define proc_net_fops_create(net, name, mode, fops) ({ (void)(mode), NULL; })
211#define proc_net_create(net, name, mode, info) ({ (void)(mode), NULL; })
212static inline void proc_net_remove(struct net *net, const char *name) {} 213static inline void proc_net_remove(struct net *net, const char *name) {}
213 214
214static inline void proc_flush_task(struct task_struct *task) 215static inline void proc_flush_task(struct task_struct *task)
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index ae8146abd746..515bff053de8 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -97,6 +97,7 @@ extern void __ptrace_link(struct task_struct *child,
97extern void __ptrace_unlink(struct task_struct *child); 97extern void __ptrace_unlink(struct task_struct *child);
98extern void ptrace_untrace(struct task_struct *child); 98extern void ptrace_untrace(struct task_struct *child);
99extern int ptrace_may_attach(struct task_struct *task); 99extern int ptrace_may_attach(struct task_struct *task);
100extern int __ptrace_may_attach(struct task_struct *task);
100 101
101static inline void ptrace_link(struct task_struct *child, 102static inline void ptrace_link(struct task_struct *child,
102 struct task_struct *new_parent) 103 struct task_struct *new_parent)
@@ -128,6 +129,81 @@ int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data);
128#define force_successful_syscall_return() do { } while (0) 129#define force_successful_syscall_return() do { } while (0)
129#endif 130#endif
130 131
132/*
133 * <asm/ptrace.h> should define the following things inside #ifdef __KERNEL__.
134 *
135 * These do-nothing inlines are used when the arch does not
136 * implement single-step. The kerneldoc comments are here
137 * to document the interface for all arch definitions.
138 */
139
140#ifndef arch_has_single_step
141/**
142 * arch_has_single_step - does this CPU support user-mode single-step?
143 *
144 * If this is defined, then there must be function declarations or
145 * inlines for user_enable_single_step() and user_disable_single_step().
146 * arch_has_single_step() should evaluate to nonzero iff the machine
147 * supports instruction single-step for user mode.
148 * It can be a constant or it can test a CPU feature bit.
149 */
150#define arch_has_single_step() (0)
151
152/**
153 * user_enable_single_step - single-step in user-mode task
154 * @task: either current or a task stopped in %TASK_TRACED
155 *
156 * This can only be called when arch_has_single_step() has returned nonzero.
157 * Set @task so that when it returns to user mode, it will trap after the
158 * next single instruction executes. If arch_has_block_step() is defined,
159 * this must clear the effects of user_enable_block_step() too.
160 */
161static inline void user_enable_single_step(struct task_struct *task)
162{
163 BUG(); /* This can never be called. */
164}
165
166/**
167 * user_disable_single_step - cancel user-mode single-step
168 * @task: either current or a task stopped in %TASK_TRACED
169 *
170 * Clear @task of the effects of user_enable_single_step() and
171 * user_enable_block_step(). This can be called whether or not either
172 * of those was ever called on @task, and even if arch_has_single_step()
173 * returned zero.
174 */
175static inline void user_disable_single_step(struct task_struct *task)
176{
177}
178#endif /* arch_has_single_step */
179
180#ifndef arch_has_block_step
181/**
182 * arch_has_block_step - does this CPU support user-mode block-step?
183 *
184 * If this is defined, then there must be a function declaration or inline
185 * for user_enable_block_step(), and arch_has_single_step() must be defined
186 * too. arch_has_block_step() should evaluate to nonzero iff the machine
187 * supports step-until-branch for user mode. It can be a constant or it
188 * can test a CPU feature bit.
189 */
190#define arch_has_block_step() (0)
191
192/**
193 * user_enable_block_step - step until branch in user-mode task
194 * @task: either current or a task stopped in %TASK_TRACED
195 *
196 * This can only be called when arch_has_block_step() has returned nonzero,
197 * and will never be called when single-instruction stepping is being used.
198 * Set @task so that when it returns to user mode, it will trap after the
199 * next branch or trap taken.
200 */
201static inline void user_enable_block_step(struct task_struct *task)
202{
203 BUG(); /* This can never be called. */
204}
205#endif /* arch_has_block_step */
206
131#endif 207#endif
132 208
133#endif 209#endif
diff --git a/include/linux/quicklist.h b/include/linux/quicklist.h
index 9371c6116df3..39b66713a0bb 100644
--- a/include/linux/quicklist.h
+++ b/include/linux/quicklist.h
@@ -56,14 +56,6 @@ static inline void __quicklist_free(int nr, void (*dtor)(void *), void *p,
56 struct page *page) 56 struct page *page)
57{ 57{
58 struct quicklist *q; 58 struct quicklist *q;
59 int nid = page_to_nid(page);
60
61 if (unlikely(nid != numa_node_id())) {
62 if (dtor)
63 dtor(p);
64 __free_page(page);
65 return;
66 }
67 59
68 q = &get_cpu_var(quicklist)[nr]; 60 q = &get_cpu_var(quicklist)[nr];
69 *(void **)p = q->page; 61 *(void **)p = q->page;
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h
new file mode 100644
index 000000000000..4d6624260b4c
--- /dev/null
+++ b/include/linux/rcuclassic.h
@@ -0,0 +1,164 @@
1/*
2 * Read-Copy Update mechanism for mutual exclusion (classic version)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright IBM Corporation, 2001
19 *
20 * Author: Dipankar Sarma <dipankar@in.ibm.com>
21 *
22 * Based on the original work by Paul McKenney <paulmck@us.ibm.com>
23 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
24 * Papers:
25 * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf
26 * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001)
27 *
28 * For detailed explanation of Read-Copy Update mechanism see -
29 * Documentation/RCU
30 *
31 */
32
33#ifndef __LINUX_RCUCLASSIC_H
34#define __LINUX_RCUCLASSIC_H
35
36#ifdef __KERNEL__
37
38#include <linux/cache.h>
39#include <linux/spinlock.h>
40#include <linux/threads.h>
41#include <linux/percpu.h>
42#include <linux/cpumask.h>
43#include <linux/seqlock.h>
44
45
46/* Global control variables for rcupdate callback mechanism. */
47struct rcu_ctrlblk {
48 long cur; /* Current batch number. */
49 long completed; /* Number of the last completed batch */
50 int next_pending; /* Is the next batch already waiting? */
51
52 int signaled;
53
54 spinlock_t lock ____cacheline_internodealigned_in_smp;
55 cpumask_t cpumask; /* CPUs that need to switch in order */
56 /* for current batch to proceed. */
57} ____cacheline_internodealigned_in_smp;
58
59/* Is batch a before batch b ? */
60static inline int rcu_batch_before(long a, long b)
61{
62 return (a - b) < 0;
63}
64
65/* Is batch a after batch b ? */
66static inline int rcu_batch_after(long a, long b)
67{
68 return (a - b) > 0;
69}
70
71/*
72 * Per-CPU data for Read-Copy UPdate.
73 * nxtlist - new callbacks are added here
74 * curlist - current batch for which quiescent cycle started if any
75 */
76struct rcu_data {
77 /* 1) quiescent state handling : */
78 long quiescbatch; /* Batch # for grace period */
79 int passed_quiesc; /* User-mode/idle loop etc. */
80 int qs_pending; /* core waits for quiesc state */
81
82 /* 2) batch handling */
83 long batch; /* Batch # for current RCU batch */
84 struct rcu_head *nxtlist;
85 struct rcu_head **nxttail;
86 long qlen; /* # of queued callbacks */
87 struct rcu_head *curlist;
88 struct rcu_head **curtail;
89 struct rcu_head *donelist;
90 struct rcu_head **donetail;
91 long blimit; /* Upper limit on a processed batch */
92 int cpu;
93 struct rcu_head barrier;
94};
95
96DECLARE_PER_CPU(struct rcu_data, rcu_data);
97DECLARE_PER_CPU(struct rcu_data, rcu_bh_data);
98
99/*
100 * Increment the quiescent state counter.
101 * The counter is a bit degenerated: We do not need to know
102 * how many quiescent states passed, just if there was at least
103 * one since the start of the grace period. Thus just a flag.
104 */
105static inline void rcu_qsctr_inc(int cpu)
106{
107 struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
108 rdp->passed_quiesc = 1;
109}
110static inline void rcu_bh_qsctr_inc(int cpu)
111{
112 struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu);
113 rdp->passed_quiesc = 1;
114}
115
116extern int rcu_pending(int cpu);
117extern int rcu_needs_cpu(int cpu);
118
119#ifdef CONFIG_DEBUG_LOCK_ALLOC
120extern struct lockdep_map rcu_lock_map;
121# define rcu_read_acquire() \
122 lock_acquire(&rcu_lock_map, 0, 0, 2, 1, _THIS_IP_)
123# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_)
124#else
125# define rcu_read_acquire() do { } while (0)
126# define rcu_read_release() do { } while (0)
127#endif
128
129#define __rcu_read_lock() \
130 do { \
131 preempt_disable(); \
132 __acquire(RCU); \
133 rcu_read_acquire(); \
134 } while (0)
135#define __rcu_read_unlock() \
136 do { \
137 rcu_read_release(); \
138 __release(RCU); \
139 preempt_enable(); \
140 } while (0)
141#define __rcu_read_lock_bh() \
142 do { \
143 local_bh_disable(); \
144 __acquire(RCU_BH); \
145 rcu_read_acquire(); \
146 } while (0)
147#define __rcu_read_unlock_bh() \
148 do { \
149 rcu_read_release(); \
150 __release(RCU_BH); \
151 local_bh_enable(); \
152 } while (0)
153
154#define __synchronize_sched() synchronize_rcu()
155
156extern void __rcu_init(void);
157extern void rcu_check_callbacks(int cpu, int user);
158extern void rcu_restart_cpu(int cpu);
159
160extern long rcu_batches_completed(void);
161extern long rcu_batches_completed_bh(void);
162
163#endif /* __KERNEL__ */
164#endif /* __LINUX_RCUCLASSIC_H */
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index cc24a01df940..d32c14de270e 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -15,7 +15,7 @@
15 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 * 17 *
18 * Copyright (C) IBM Corporation, 2001 18 * Copyright IBM Corporation, 2001
19 * 19 *
20 * Author: Dipankar Sarma <dipankar@in.ibm.com> 20 * Author: Dipankar Sarma <dipankar@in.ibm.com>
21 * 21 *
@@ -53,96 +53,18 @@ struct rcu_head {
53 void (*func)(struct rcu_head *head); 53 void (*func)(struct rcu_head *head);
54}; 54};
55 55
56#ifdef CONFIG_CLASSIC_RCU
57#include <linux/rcuclassic.h>
58#else /* #ifdef CONFIG_CLASSIC_RCU */
59#include <linux/rcupreempt.h>
60#endif /* #else #ifdef CONFIG_CLASSIC_RCU */
61
56#define RCU_HEAD_INIT { .next = NULL, .func = NULL } 62#define RCU_HEAD_INIT { .next = NULL, .func = NULL }
57#define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT 63#define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT
58#define INIT_RCU_HEAD(ptr) do { \ 64#define INIT_RCU_HEAD(ptr) do { \
59 (ptr)->next = NULL; (ptr)->func = NULL; \ 65 (ptr)->next = NULL; (ptr)->func = NULL; \
60} while (0) 66} while (0)
61 67
62
63
64/* Global control variables for rcupdate callback mechanism. */
65struct rcu_ctrlblk {
66 long cur; /* Current batch number. */
67 long completed; /* Number of the last completed batch */
68 int next_pending; /* Is the next batch already waiting? */
69
70 int signaled;
71
72 spinlock_t lock ____cacheline_internodealigned_in_smp;
73 cpumask_t cpumask; /* CPUs that need to switch in order */
74 /* for current batch to proceed. */
75} ____cacheline_internodealigned_in_smp;
76
77/* Is batch a before batch b ? */
78static inline int rcu_batch_before(long a, long b)
79{
80 return (a - b) < 0;
81}
82
83/* Is batch a after batch b ? */
84static inline int rcu_batch_after(long a, long b)
85{
86 return (a - b) > 0;
87}
88
89/*
90 * Per-CPU data for Read-Copy UPdate.
91 * nxtlist - new callbacks are added here
92 * curlist - current batch for which quiescent cycle started if any
93 */
94struct rcu_data {
95 /* 1) quiescent state handling : */
96 long quiescbatch; /* Batch # for grace period */
97 int passed_quiesc; /* User-mode/idle loop etc. */
98 int qs_pending; /* core waits for quiesc state */
99
100 /* 2) batch handling */
101 long batch; /* Batch # for current RCU batch */
102 struct rcu_head *nxtlist;
103 struct rcu_head **nxttail;
104 long qlen; /* # of queued callbacks */
105 struct rcu_head *curlist;
106 struct rcu_head **curtail;
107 struct rcu_head *donelist;
108 struct rcu_head **donetail;
109 long blimit; /* Upper limit on a processed batch */
110 int cpu;
111 struct rcu_head barrier;
112};
113
114DECLARE_PER_CPU(struct rcu_data, rcu_data);
115DECLARE_PER_CPU(struct rcu_data, rcu_bh_data);
116
117/*
118 * Increment the quiescent state counter.
119 * The counter is a bit degenerated: We do not need to know
120 * how many quiescent states passed, just if there was at least
121 * one since the start of the grace period. Thus just a flag.
122 */
123static inline void rcu_qsctr_inc(int cpu)
124{
125 struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
126 rdp->passed_quiesc = 1;
127}
128static inline void rcu_bh_qsctr_inc(int cpu)
129{
130 struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu);
131 rdp->passed_quiesc = 1;
132}
133
134extern int rcu_pending(int cpu);
135extern int rcu_needs_cpu(int cpu);
136
137#ifdef CONFIG_DEBUG_LOCK_ALLOC
138extern struct lockdep_map rcu_lock_map;
139# define rcu_read_acquire() lock_acquire(&rcu_lock_map, 0, 0, 2, 1, _THIS_IP_)
140# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_)
141#else
142# define rcu_read_acquire() do { } while (0)
143# define rcu_read_release() do { } while (0)
144#endif
145
146/** 68/**
147 * rcu_read_lock - mark the beginning of an RCU read-side critical section. 69 * rcu_read_lock - mark the beginning of an RCU read-side critical section.
148 * 70 *
@@ -172,24 +94,13 @@ extern struct lockdep_map rcu_lock_map;
172 * 94 *
173 * It is illegal to block while in an RCU read-side critical section. 95 * It is illegal to block while in an RCU read-side critical section.
174 */ 96 */
175#define rcu_read_lock() \ 97#define rcu_read_lock() __rcu_read_lock()
176 do { \
177 preempt_disable(); \
178 __acquire(RCU); \
179 rcu_read_acquire(); \
180 } while(0)
181 98
182/** 99/**
183 * rcu_read_unlock - marks the end of an RCU read-side critical section. 100 * rcu_read_unlock - marks the end of an RCU read-side critical section.
184 * 101 *
185 * See rcu_read_lock() for more information. 102 * See rcu_read_lock() for more information.
186 */ 103 */
187#define rcu_read_unlock() \
188 do { \
189 rcu_read_release(); \
190 __release(RCU); \
191 preempt_enable(); \
192 } while(0)
193 104
194/* 105/*
195 * So where is rcu_write_lock()? It does not exist, as there is no 106 * So where is rcu_write_lock()? It does not exist, as there is no
@@ -200,6 +111,7 @@ extern struct lockdep_map rcu_lock_map;
200 * used as well. RCU does not care how the writers keep out of each 111 * used as well. RCU does not care how the writers keep out of each
201 * others' way, as long as they do so. 112 * others' way, as long as they do so.
202 */ 113 */
114#define rcu_read_unlock() __rcu_read_unlock()
203 115
204/** 116/**
205 * rcu_read_lock_bh - mark the beginning of a softirq-only RCU critical section 117 * rcu_read_lock_bh - mark the beginning of a softirq-only RCU critical section
@@ -212,24 +124,14 @@ extern struct lockdep_map rcu_lock_map;
212 * can use just rcu_read_lock(). 124 * can use just rcu_read_lock().
213 * 125 *
214 */ 126 */
215#define rcu_read_lock_bh() \ 127#define rcu_read_lock_bh() __rcu_read_lock_bh()
216 do { \
217 local_bh_disable(); \
218 __acquire(RCU_BH); \
219 rcu_read_acquire(); \
220 } while(0)
221 128
222/* 129/*
223 * rcu_read_unlock_bh - marks the end of a softirq-only RCU critical section 130 * rcu_read_unlock_bh - marks the end of a softirq-only RCU critical section
224 * 131 *
225 * See rcu_read_lock_bh() for more information. 132 * See rcu_read_lock_bh() for more information.
226 */ 133 */
227#define rcu_read_unlock_bh() \ 134#define rcu_read_unlock_bh() __rcu_read_unlock_bh()
228 do { \
229 rcu_read_release(); \
230 __release(RCU_BH); \
231 local_bh_enable(); \
232 } while(0)
233 135
234/* 136/*
235 * Prevent the compiler from merging or refetching accesses. The compiler 137 * Prevent the compiler from merging or refetching accesses. The compiler
@@ -293,21 +195,52 @@ extern struct lockdep_map rcu_lock_map;
293 * In "classic RCU", these two guarantees happen to be one and 195 * In "classic RCU", these two guarantees happen to be one and
294 * the same, but can differ in realtime RCU implementations. 196 * the same, but can differ in realtime RCU implementations.
295 */ 197 */
296#define synchronize_sched() synchronize_rcu() 198#define synchronize_sched() __synchronize_sched()
297 199
298extern void rcu_init(void); 200/**
299extern void rcu_check_callbacks(int cpu, int user); 201 * call_rcu - Queue an RCU callback for invocation after a grace period.
300extern void rcu_restart_cpu(int cpu); 202 * @head: structure to be used for queueing the RCU updates.
301extern long rcu_batches_completed(void); 203 * @func: actual update function to be invoked after the grace period
302extern long rcu_batches_completed_bh(void); 204 *
205 * The update function will be invoked some time after a full grace
206 * period elapses, in other words after all currently executing RCU
207 * read-side critical sections have completed. RCU read-side critical
208 * sections are delimited by rcu_read_lock() and rcu_read_unlock(),
209 * and may be nested.
210 */
211extern void call_rcu(struct rcu_head *head,
212 void (*func)(struct rcu_head *head));
303 213
304/* Exported interfaces */ 214/**
305extern void FASTCALL(call_rcu(struct rcu_head *head, 215 * call_rcu_bh - Queue an RCU for invocation after a quicker grace period.
306 void (*func)(struct rcu_head *head))); 216 * @head: structure to be used for queueing the RCU updates.
307extern void FASTCALL(call_rcu_bh(struct rcu_head *head, 217 * @func: actual update function to be invoked after the grace period
308 void (*func)(struct rcu_head *head))); 218 *
219 * The update function will be invoked some time after a full grace
220 * period elapses, in other words after all currently executing RCU
221 * read-side critical sections have completed. call_rcu_bh() assumes
222 * that the read-side critical sections end on completion of a softirq
223 * handler. This means that read-side critical sections in process
224 * context must not be interrupted by softirqs. This interface is to be
225 * used when most of the read-side critical sections are in softirq context.
226 * RCU read-side critical sections are delimited by :
227 * - rcu_read_lock() and rcu_read_unlock(), if in interrupt context.
228 * OR
229 * - rcu_read_lock_bh() and rcu_read_unlock_bh(), if in process context.
230 * These may be nested.
231 */
232extern void call_rcu_bh(struct rcu_head *head,
233 void (*func)(struct rcu_head *head));
234
235/* Exported common interfaces */
309extern void synchronize_rcu(void); 236extern void synchronize_rcu(void);
310extern void rcu_barrier(void); 237extern void rcu_barrier(void);
238extern long rcu_batches_completed(void);
239extern long rcu_batches_completed_bh(void);
240
241/* Internal to kernel */
242extern void rcu_init(void);
243extern int rcu_needs_cpu(int cpu);
311 244
312#endif /* __KERNEL__ */ 245#endif /* __KERNEL__ */
313#endif /* __LINUX_RCUPDATE_H */ 246#endif /* __LINUX_RCUPDATE_H */
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h
new file mode 100644
index 000000000000..ece8eb3e4151
--- /dev/null
+++ b/include/linux/rcupreempt.h
@@ -0,0 +1,86 @@
1/*
2 * Read-Copy Update mechanism for mutual exclusion (RT implementation)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright (C) IBM Corporation, 2006
19 *
20 * Author: Paul McKenney <paulmck@us.ibm.com>
21 *
22 * Based on the original work by Paul McKenney <paul.mckenney@us.ibm.com>
23 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
24 * Papers:
25 * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf
26 * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001)
27 *
28 * For detailed explanation of Read-Copy Update mechanism see -
29 * Documentation/RCU
30 *
31 */
32
33#ifndef __LINUX_RCUPREEMPT_H
34#define __LINUX_RCUPREEMPT_H
35
36#ifdef __KERNEL__
37
38#include <linux/cache.h>
39#include <linux/spinlock.h>
40#include <linux/threads.h>
41#include <linux/percpu.h>
42#include <linux/cpumask.h>
43#include <linux/seqlock.h>
44
45#define rcu_qsctr_inc(cpu)
46#define rcu_bh_qsctr_inc(cpu)
47#define call_rcu_bh(head, rcu) call_rcu(head, rcu)
48
49extern void __rcu_read_lock(void);
50extern void __rcu_read_unlock(void);
51extern int rcu_pending(int cpu);
52extern int rcu_needs_cpu(int cpu);
53
54#define __rcu_read_lock_bh() { rcu_read_lock(); local_bh_disable(); }
55#define __rcu_read_unlock_bh() { local_bh_enable(); rcu_read_unlock(); }
56
57extern void __synchronize_sched(void);
58
59extern void __rcu_init(void);
60extern void rcu_check_callbacks(int cpu, int user);
61extern void rcu_restart_cpu(int cpu);
62extern long rcu_batches_completed(void);
63
64/*
65 * Return the number of RCU batches processed thus far. Useful for debug
66 * and statistic. The _bh variant is identifcal to straight RCU
67 */
68static inline long rcu_batches_completed_bh(void)
69{
70 return rcu_batches_completed();
71}
72
73#ifdef CONFIG_RCU_TRACE
74struct rcupreempt_trace;
75extern long *rcupreempt_flipctr(int cpu);
76extern long rcupreempt_data_completed(void);
77extern int rcupreempt_flip_flag(int cpu);
78extern int rcupreempt_mb_flag(int cpu);
79extern char *rcupreempt_try_flip_state_name(void);
80extern struct rcupreempt_trace *rcupreempt_trace_cpu(int cpu);
81#endif
82
83struct softirq_action;
84
85#endif /* __KERNEL__ */
86#endif /* __LINUX_RCUPREEMPT_H */
diff --git a/include/linux/rcupreempt_trace.h b/include/linux/rcupreempt_trace.h
new file mode 100644
index 000000000000..21cd6b2a5c42
--- /dev/null
+++ b/include/linux/rcupreempt_trace.h
@@ -0,0 +1,99 @@
1/*
2 * Read-Copy Update mechanism for mutual exclusion (RT implementation)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright (C) IBM Corporation, 2006
19 *
20 * Author: Paul McKenney <paulmck@us.ibm.com>
21 *
22 * Based on the original work by Paul McKenney <paul.mckenney@us.ibm.com>
23 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
24 * Papers:
25 * http://www.rdrop.com/users/paulmck/paper/rclockpdcsproof.pdf
26 * http://lse.sourceforge.net/locking/rclock_OLS.2001.05.01c.sc.pdf (OLS2001)
27 *
28 * For detailed explanation of the Preemptible Read-Copy Update mechanism see -
29 * http://lwn.net/Articles/253651/
30 */
31
32#ifndef __LINUX_RCUPREEMPT_TRACE_H
33#define __LINUX_RCUPREEMPT_TRACE_H
34
35#ifdef __KERNEL__
36#include <linux/types.h>
37#include <linux/kernel.h>
38
39#include <asm/atomic.h>
40
41/*
42 * PREEMPT_RCU data structures.
43 */
44
45struct rcupreempt_trace {
46 long next_length;
47 long next_add;
48 long wait_length;
49 long wait_add;
50 long done_length;
51 long done_add;
52 long done_remove;
53 atomic_t done_invoked;
54 long rcu_check_callbacks;
55 atomic_t rcu_try_flip_1;
56 atomic_t rcu_try_flip_e1;
57 long rcu_try_flip_i1;
58 long rcu_try_flip_ie1;
59 long rcu_try_flip_g1;
60 long rcu_try_flip_a1;
61 long rcu_try_flip_ae1;
62 long rcu_try_flip_a2;
63 long rcu_try_flip_z1;
64 long rcu_try_flip_ze1;
65 long rcu_try_flip_z2;
66 long rcu_try_flip_m1;
67 long rcu_try_flip_me1;
68 long rcu_try_flip_m2;
69};
70
71#ifdef CONFIG_RCU_TRACE
72#define RCU_TRACE(fn, arg) fn(arg);
73#else
74#define RCU_TRACE(fn, arg)
75#endif
76
77extern void rcupreempt_trace_move2done(struct rcupreempt_trace *trace);
78extern void rcupreempt_trace_move2wait(struct rcupreempt_trace *trace);
79extern void rcupreempt_trace_try_flip_1(struct rcupreempt_trace *trace);
80extern void rcupreempt_trace_try_flip_e1(struct rcupreempt_trace *trace);
81extern void rcupreempt_trace_try_flip_i1(struct rcupreempt_trace *trace);
82extern void rcupreempt_trace_try_flip_ie1(struct rcupreempt_trace *trace);
83extern void rcupreempt_trace_try_flip_g1(struct rcupreempt_trace *trace);
84extern void rcupreempt_trace_try_flip_a1(struct rcupreempt_trace *trace);
85extern void rcupreempt_trace_try_flip_ae1(struct rcupreempt_trace *trace);
86extern void rcupreempt_trace_try_flip_a2(struct rcupreempt_trace *trace);
87extern void rcupreempt_trace_try_flip_z1(struct rcupreempt_trace *trace);
88extern void rcupreempt_trace_try_flip_ze1(struct rcupreempt_trace *trace);
89extern void rcupreempt_trace_try_flip_z2(struct rcupreempt_trace *trace);
90extern void rcupreempt_trace_try_flip_m1(struct rcupreempt_trace *trace);
91extern void rcupreempt_trace_try_flip_me1(struct rcupreempt_trace *trace);
92extern void rcupreempt_trace_try_flip_m2(struct rcupreempt_trace *trace);
93extern void rcupreempt_trace_check_callbacks(struct rcupreempt_trace *trace);
94extern void rcupreempt_trace_done_remove(struct rcupreempt_trace *trace);
95extern void rcupreempt_trace_invoke(struct rcupreempt_trace *trace);
96extern void rcupreempt_trace_next_add(struct rcupreempt_trace *trace);
97
98#endif /* __KERNEL__ */
99#endif /* __LINUX_RCUPREEMPT_TRACE_H */
diff --git a/include/linux/regset.h b/include/linux/regset.h
new file mode 100644
index 000000000000..8abee6556223
--- /dev/null
+++ b/include/linux/regset.h
@@ -0,0 +1,368 @@
1/*
2 * User-mode machine state access
3 *
4 * Copyright (C) 2007 Red Hat, Inc. All rights reserved.
5 *
6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions
8 * of the GNU General Public License v.2.
9 *
10 * Red Hat Author: Roland McGrath.
11 */
12
13#ifndef _LINUX_REGSET_H
14#define _LINUX_REGSET_H 1
15
16#include <linux/compiler.h>
17#include <linux/types.h>
18#include <linux/uaccess.h>
19struct task_struct;
20struct user_regset;
21
22
23/**
24 * user_regset_active_fn - type of @active function in &struct user_regset
25 * @target: thread being examined
26 * @regset: regset being examined
27 *
28 * Return -%ENODEV if not available on the hardware found.
29 * Return %0 if no interesting state in this thread.
30 * Return >%0 number of @size units of interesting state.
31 * Any get call fetching state beyond that number will
32 * see the default initialization state for this data,
33 * so a caller that knows what the default state is need
34 * not copy it all out.
35 * This call is optional; the pointer is %NULL if there
36 * is no inexpensive check to yield a value < @n.
37 */
38typedef int user_regset_active_fn(struct task_struct *target,
39 const struct user_regset *regset);
40
41/**
42 * user_regset_get_fn - type of @get function in &struct user_regset
43 * @target: thread being examined
44 * @regset: regset being examined
45 * @pos: offset into the regset data to access, in bytes
46 * @count: amount of data to copy, in bytes
47 * @kbuf: if not %NULL, a kernel-space pointer to copy into
48 * @ubuf: if @kbuf is %NULL, a user-space pointer to copy into
49 *
50 * Fetch register values. Return %0 on success; -%EIO or -%ENODEV
51 * are usual failure returns. The @pos and @count values are in
52 * bytes, but must be properly aligned. If @kbuf is non-null, that
53 * buffer is used and @ubuf is ignored. If @kbuf is %NULL, then
54 * ubuf gives a userland pointer to access directly, and an -%EFAULT
55 * return value is possible.
56 */
57typedef int user_regset_get_fn(struct task_struct *target,
58 const struct user_regset *regset,
59 unsigned int pos, unsigned int count,
60 void *kbuf, void __user *ubuf);
61
62/**
63 * user_regset_set_fn - type of @set function in &struct user_regset
64 * @target: thread being examined
65 * @regset: regset being examined
66 * @pos: offset into the regset data to access, in bytes
67 * @count: amount of data to copy, in bytes
68 * @kbuf: if not %NULL, a kernel-space pointer to copy from
69 * @ubuf: if @kbuf is %NULL, a user-space pointer to copy from
70 *
71 * Store register values. Return %0 on success; -%EIO or -%ENODEV
72 * are usual failure returns. The @pos and @count values are in
73 * bytes, but must be properly aligned. If @kbuf is non-null, that
74 * buffer is used and @ubuf is ignored. If @kbuf is %NULL, then
75 * ubuf gives a userland pointer to access directly, and an -%EFAULT
76 * return value is possible.
77 */
78typedef int user_regset_set_fn(struct task_struct *target,
79 const struct user_regset *regset,
80 unsigned int pos, unsigned int count,
81 const void *kbuf, const void __user *ubuf);
82
83/**
84 * user_regset_writeback_fn - type of @writeback function in &struct user_regset
85 * @target: thread being examined
86 * @regset: regset being examined
87 * @immediate: zero if writeback at completion of next context switch is OK
88 *
89 * This call is optional; usually the pointer is %NULL. When
90 * provided, there is some user memory associated with this regset's
91 * hardware, such as memory backing cached register data on register
92 * window machines; the regset's data controls what user memory is
93 * used (e.g. via the stack pointer value).
94 *
95 * Write register data back to user memory. If the @immediate flag
96 * is nonzero, it must be written to the user memory so uaccess or
97 * access_process_vm() can see it when this call returns; if zero,
98 * then it must be written back by the time the task completes a
99 * context switch (as synchronized with wait_task_inactive()).
100 * Return %0 on success or if there was nothing to do, -%EFAULT for
101 * a memory problem (bad stack pointer or whatever), or -%EIO for a
102 * hardware problem.
103 */
104typedef int user_regset_writeback_fn(struct task_struct *target,
105 const struct user_regset *regset,
106 int immediate);
107
108/**
109 * struct user_regset - accessible thread CPU state
110 * @n: Number of slots (registers).
111 * @size: Size in bytes of a slot (register).
112 * @align: Required alignment, in bytes.
113 * @bias: Bias from natural indexing.
114 * @core_note_type: ELF note @n_type value used in core dumps.
115 * @get: Function to fetch values.
116 * @set: Function to store values.
117 * @active: Function to report if regset is active, or %NULL.
118 * @writeback: Function to write data back to user memory, or %NULL.
119 *
120 * This data structure describes a machine resource we call a register set.
121 * This is part of the state of an individual thread, not necessarily
122 * actual CPU registers per se. A register set consists of a number of
123 * similar slots, given by @n. Each slot is @size bytes, and aligned to
124 * @align bytes (which is at least @size).
125 *
126 * These functions must be called only on the current thread or on a
127 * thread that is in %TASK_STOPPED or %TASK_TRACED state, that we are
128 * guaranteed will not be woken up and return to user mode, and that we
129 * have called wait_task_inactive() on. (The target thread always might
130 * wake up for SIGKILL while these functions are working, in which case
131 * that thread's user_regset state might be scrambled.)
132 *
133 * The @pos argument must be aligned according to @align; the @count
134 * argument must be a multiple of @size. These functions are not
135 * responsible for checking for invalid arguments.
136 *
137 * When there is a natural value to use as an index, @bias gives the
138 * difference between the natural index and the slot index for the
139 * register set. For example, x86 GDT segment descriptors form a regset;
140 * the segment selector produces a natural index, but only a subset of
141 * that index space is available as a regset (the TLS slots); subtracting
142 * @bias from a segment selector index value computes the regset slot.
143 *
144 * If nonzero, @core_note_type gives the n_type field (NT_* value)
145 * of the core file note in which this regset's data appears.
146 * NT_PRSTATUS is a special case in that the regset data starts at
147 * offsetof(struct elf_prstatus, pr_reg) into the note data; that is
148 * part of the per-machine ELF formats userland knows about. In
149 * other cases, the core file note contains exactly the whole regset
150 * (@n * @size) and nothing else. The core file note is normally
151 * omitted when there is an @active function and it returns zero.
152 */
153struct user_regset {
154 user_regset_get_fn *get;
155 user_regset_set_fn *set;
156 user_regset_active_fn *active;
157 user_regset_writeback_fn *writeback;
158 unsigned int n;
159 unsigned int size;
160 unsigned int align;
161 unsigned int bias;
162 unsigned int core_note_type;
163};
164
165/**
166 * struct user_regset_view - available regsets
167 * @name: Identifier, e.g. UTS_MACHINE string.
168 * @regsets: Array of @n regsets available in this view.
169 * @n: Number of elements in @regsets.
170 * @e_machine: ELF header @e_machine %EM_* value written in core dumps.
171 * @e_flags: ELF header @e_flags value written in core dumps.
172 * @ei_osabi: ELF header @e_ident[%EI_OSABI] value written in core dumps.
173 *
174 * A regset view is a collection of regsets (&struct user_regset,
175 * above). This describes all the state of a thread that can be seen
176 * from a given architecture/ABI environment. More than one view might
177 * refer to the same &struct user_regset, or more than one regset
178 * might refer to the same machine-specific state in the thread. For
179 * example, a 32-bit thread's state could be examined from the 32-bit
180 * view or from the 64-bit view. Either method reaches the same thread
181 * register state, doing appropriate widening or truncation.
182 */
183struct user_regset_view {
184 const char *name;
185 const struct user_regset *regsets;
186 unsigned int n;
187 u32 e_flags;
188 u16 e_machine;
189 u8 ei_osabi;
190};
191
192/*
193 * This is documented here rather than at the definition sites because its
194 * implementation is machine-dependent but its interface is universal.
195 */
196/**
197 * task_user_regset_view - Return the process's native regset view.
198 * @tsk: a thread of the process in question
199 *
200 * Return the &struct user_regset_view that is native for the given process.
201 * For example, what it would access when it called ptrace().
202 * Throughout the life of the process, this only changes at exec.
203 */
204const struct user_regset_view *task_user_regset_view(struct task_struct *tsk);
205
206
207/*
208 * These are helpers for writing regset get/set functions in arch code.
209 * Because @start_pos and @end_pos are always compile-time constants,
210 * these are inlined into very little code though they look large.
211 *
212 * Use one or more calls sequentially for each chunk of regset data stored
213 * contiguously in memory. Call with constants for @start_pos and @end_pos,
214 * giving the range of byte positions in the regset that data corresponds
215 * to; @end_pos can be -1 if this chunk is at the end of the regset layout.
216 * Each call updates the arguments to point past its chunk.
217 */
218
219static inline int user_regset_copyout(unsigned int *pos, unsigned int *count,
220 void **kbuf,
221 void __user **ubuf, const void *data,
222 const int start_pos, const int end_pos)
223{
224 if (*count == 0)
225 return 0;
226 BUG_ON(*pos < start_pos);
227 if (end_pos < 0 || *pos < end_pos) {
228 unsigned int copy = (end_pos < 0 ? *count
229 : min(*count, end_pos - *pos));
230 data += *pos - start_pos;
231 if (*kbuf) {
232 memcpy(*kbuf, data, copy);
233 *kbuf += copy;
234 } else if (__copy_to_user(*ubuf, data, copy))
235 return -EFAULT;
236 else
237 *ubuf += copy;
238 *pos += copy;
239 *count -= copy;
240 }
241 return 0;
242}
243
244static inline int user_regset_copyin(unsigned int *pos, unsigned int *count,
245 const void **kbuf,
246 const void __user **ubuf, void *data,
247 const int start_pos, const int end_pos)
248{
249 if (*count == 0)
250 return 0;
251 BUG_ON(*pos < start_pos);
252 if (end_pos < 0 || *pos < end_pos) {
253 unsigned int copy = (end_pos < 0 ? *count
254 : min(*count, end_pos - *pos));
255 data += *pos - start_pos;
256 if (*kbuf) {
257 memcpy(data, *kbuf, copy);
258 *kbuf += copy;
259 } else if (__copy_from_user(data, *ubuf, copy))
260 return -EFAULT;
261 else
262 *ubuf += copy;
263 *pos += copy;
264 *count -= copy;
265 }
266 return 0;
267}
268
269/*
270 * These two parallel the two above, but for portions of a regset layout
271 * that always read as all-zero or for which writes are ignored.
272 */
273static inline int user_regset_copyout_zero(unsigned int *pos,
274 unsigned int *count,
275 void **kbuf, void __user **ubuf,
276 const int start_pos,
277 const int end_pos)
278{
279 if (*count == 0)
280 return 0;
281 BUG_ON(*pos < start_pos);
282 if (end_pos < 0 || *pos < end_pos) {
283 unsigned int copy = (end_pos < 0 ? *count
284 : min(*count, end_pos - *pos));
285 if (*kbuf) {
286 memset(*kbuf, 0, copy);
287 *kbuf += copy;
288 } else if (__clear_user(*ubuf, copy))
289 return -EFAULT;
290 else
291 *ubuf += copy;
292 *pos += copy;
293 *count -= copy;
294 }
295 return 0;
296}
297
298static inline int user_regset_copyin_ignore(unsigned int *pos,
299 unsigned int *count,
300 const void **kbuf,
301 const void __user **ubuf,
302 const int start_pos,
303 const int end_pos)
304{
305 if (*count == 0)
306 return 0;
307 BUG_ON(*pos < start_pos);
308 if (end_pos < 0 || *pos < end_pos) {
309 unsigned int copy = (end_pos < 0 ? *count
310 : min(*count, end_pos - *pos));
311 if (*kbuf)
312 *kbuf += copy;
313 else
314 *ubuf += copy;
315 *pos += copy;
316 *count -= copy;
317 }
318 return 0;
319}
320
321/**
322 * copy_regset_to_user - fetch a thread's user_regset data into user memory
323 * @target: thread to be examined
324 * @view: &struct user_regset_view describing user thread machine state
325 * @setno: index in @view->regsets
326 * @offset: offset into the regset data, in bytes
327 * @size: amount of data to copy, in bytes
328 * @data: user-mode pointer to copy into
329 */
330static inline int copy_regset_to_user(struct task_struct *target,
331 const struct user_regset_view *view,
332 unsigned int setno,
333 unsigned int offset, unsigned int size,
334 void __user *data)
335{
336 const struct user_regset *regset = &view->regsets[setno];
337
338 if (!access_ok(VERIFY_WRITE, data, size))
339 return -EIO;
340
341 return regset->get(target, regset, offset, size, NULL, data);
342}
343
344/**
345 * copy_regset_from_user - store into thread's user_regset data from user memory
346 * @target: thread to be examined
347 * @view: &struct user_regset_view describing user thread machine state
348 * @setno: index in @view->regsets
349 * @offset: offset into the regset data, in bytes
350 * @size: amount of data to copy, in bytes
351 * @data: user-mode pointer to copy from
352 */
353static inline int copy_regset_from_user(struct task_struct *target,
354 const struct user_regset_view *view,
355 unsigned int setno,
356 unsigned int offset, unsigned int size,
357 const void __user *data)
358{
359 const struct user_regset *regset = &view->regsets[setno];
360
361 if (!access_ok(VERIFY_READ, data, size))
362 return -EIO;
363
364 return regset->set(target, regset, offset, size, NULL, data);
365}
366
367
368#endif /* <linux/regset.h> */
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 0ce5e0b52dbd..e3ab21d7fc7f 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -33,11 +33,13 @@
33 * RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device. 33 * RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device.
34 * RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. 34 * RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device.
35 * RFKILL_TYPE_UWB: switch is on a ultra wideband device. 35 * RFKILL_TYPE_UWB: switch is on a ultra wideband device.
36 * RFKILL_TYPE_WIMAX: switch is on a WiMAX device.
36 */ 37 */
37enum rfkill_type { 38enum rfkill_type {
38 RFKILL_TYPE_WLAN , 39 RFKILL_TYPE_WLAN ,
39 RFKILL_TYPE_BLUETOOTH, 40 RFKILL_TYPE_BLUETOOTH,
40 RFKILL_TYPE_UWB, 41 RFKILL_TYPE_UWB,
42 RFKILL_TYPE_WIMAX,
41 RFKILL_TYPE_MAX, 43 RFKILL_TYPE_MAX,
42}; 44};
43 45
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 6d5e4a46781e..f2d0d1527721 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -133,6 +133,9 @@ struct rtc_class_ops {
133#define RTC_DEVICE_NAME_SIZE 20 133#define RTC_DEVICE_NAME_SIZE 20
134struct rtc_task; 134struct rtc_task;
135 135
136/* flags */
137#define RTC_DEV_BUSY 0
138
136struct rtc_device 139struct rtc_device
137{ 140{
138 struct device dev; 141 struct device dev;
@@ -145,7 +148,7 @@ struct rtc_device
145 struct mutex ops_lock; 148 struct mutex ops_lock;
146 149
147 struct cdev char_dev; 150 struct cdev char_dev;
148 struct mutex char_lock; 151 unsigned long flags;
149 152
150 unsigned long irq_data; 153 unsigned long irq_data;
151 spinlock_t irq_lock; 154 spinlock_t irq_lock;
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 5bf618241ab9..b014f6b7fe29 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -100,6 +100,13 @@ enum {
100 RTM_NEWNDUSEROPT = 68, 100 RTM_NEWNDUSEROPT = 68,
101#define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT 101#define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT
102 102
103 RTM_NEWADDRLABEL = 72,
104#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL
105 RTM_DELADDRLABEL,
106#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL
107 RTM_GETADDRLABEL,
108#define RTM_GETADDRLABEL RTM_GETADDRLABEL
109
103 __RTM_MAX, 110 __RTM_MAX,
104#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) 111#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
105}; 112};
@@ -491,9 +498,11 @@ struct nduseroptmsg
491 unsigned char nduseropt_family; 498 unsigned char nduseropt_family;
492 unsigned char nduseropt_pad1; 499 unsigned char nduseropt_pad1;
493 unsigned short nduseropt_opts_len; /* Total length of options */ 500 unsigned short nduseropt_opts_len; /* Total length of options */
501 int nduseropt_ifindex;
494 __u8 nduseropt_icmp_type; 502 __u8 nduseropt_icmp_type;
495 __u8 nduseropt_icmp_code; 503 __u8 nduseropt_icmp_code;
496 unsigned short nduseropt_pad2; 504 unsigned short nduseropt_pad2;
505 unsigned int nduseropt_pad3;
497 /* Followed by one or more ND options */ 506 /* Followed by one or more ND options */
498}; 507};
499 508
@@ -611,11 +620,11 @@ extern int __rtattr_parse_nested_compat(struct rtattr *tb[], int maxattr,
611({ data = RTA_PAYLOAD(rta) >= len ? RTA_DATA(rta) : NULL; \ 620({ data = RTA_PAYLOAD(rta) >= len ? RTA_DATA(rta) : NULL; \
612 __rtattr_parse_nested_compat(tb, max, rta, len); }) 621 __rtattr_parse_nested_compat(tb, max, rta, len); })
613 622
614extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo); 623extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo);
615extern int rtnl_unicast(struct sk_buff *skb, u32 pid); 624extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid);
616extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group, 625extern int rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid, u32 group,
617 struct nlmsghdr *nlh, gfp_t flags); 626 struct nlmsghdr *nlh, gfp_t flags);
618extern void rtnl_set_sk_err(u32 group, int error); 627extern void rtnl_set_sk_err(struct net *net, u32 group, int error);
619extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics); 628extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics);
620extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst, 629extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst,
621 u32 id, u32 ts, u32 tsage, long expires, 630 u32 id, u32 ts, u32 tsage, long expires,
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 457123171389..a3d567a974e8 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -7,6 +7,12 @@
7#include <linux/string.h> 7#include <linux/string.h>
8#include <asm/io.h> 8#include <asm/io.h>
9 9
10struct sg_table {
11 struct scatterlist *sgl; /* the list */
12 unsigned int nents; /* number of mapped entries */
13 unsigned int orig_nents; /* original size of list */
14};
15
10/* 16/*
11 * Notes on SG table design. 17 * Notes on SG table design.
12 * 18 *
@@ -26,6 +32,16 @@
26 32
27#define SG_MAGIC 0x87654321 33#define SG_MAGIC 0x87654321
28 34
35/*
36 * We overload the LSB of the page pointer to indicate whether it's
37 * a valid sg entry, or whether it points to the start of a new scatterlist.
38 * Those low bits are there for everyone! (thanks mason :-)
39 */
40#define sg_is_chain(sg) ((sg)->page_link & 0x01)
41#define sg_is_last(sg) ((sg)->page_link & 0x02)
42#define sg_chain_ptr(sg) \
43 ((struct scatterlist *) ((sg)->page_link & ~0x03))
44
29/** 45/**
30 * sg_assign_page - Assign a given page to an SG entry 46 * sg_assign_page - Assign a given page to an SG entry
31 * @sg: SG entry 47 * @sg: SG entry
@@ -47,6 +63,7 @@ static inline void sg_assign_page(struct scatterlist *sg, struct page *page)
47 BUG_ON((unsigned long) page & 0x03); 63 BUG_ON((unsigned long) page & 0x03);
48#ifdef CONFIG_DEBUG_SG 64#ifdef CONFIG_DEBUG_SG
49 BUG_ON(sg->sg_magic != SG_MAGIC); 65 BUG_ON(sg->sg_magic != SG_MAGIC);
66 BUG_ON(sg_is_chain(sg));
50#endif 67#endif
51 sg->page_link = page_link | (unsigned long) page; 68 sg->page_link = page_link | (unsigned long) page;
52} 69}
@@ -73,7 +90,14 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page,
73 sg->length = len; 90 sg->length = len;
74} 91}
75 92
76#define sg_page(sg) ((struct page *) ((sg)->page_link & ~0x3)) 93static inline struct page *sg_page(struct scatterlist *sg)
94{
95#ifdef CONFIG_DEBUG_SG
96 BUG_ON(sg->sg_magic != SG_MAGIC);
97 BUG_ON(sg_is_chain(sg));
98#endif
99 return (struct page *)((sg)->page_link & ~0x3);
100}
77 101
78/** 102/**
79 * sg_set_buf - Set sg entry to point at given data 103 * sg_set_buf - Set sg entry to point at given data
@@ -89,81 +113,12 @@ static inline void sg_set_buf(struct scatterlist *sg, const void *buf,
89} 113}
90 114
91/* 115/*
92 * We overload the LSB of the page pointer to indicate whether it's
93 * a valid sg entry, or whether it points to the start of a new scatterlist.
94 * Those low bits are there for everyone! (thanks mason :-)
95 */
96#define sg_is_chain(sg) ((sg)->page_link & 0x01)
97#define sg_is_last(sg) ((sg)->page_link & 0x02)
98#define sg_chain_ptr(sg) \
99 ((struct scatterlist *) ((sg)->page_link & ~0x03))
100
101/**
102 * sg_next - return the next scatterlist entry in a list
103 * @sg: The current sg entry
104 *
105 * Description:
106 * Usually the next entry will be @sg@ + 1, but if this sg element is part
107 * of a chained scatterlist, it could jump to the start of a new
108 * scatterlist array.
109 *
110 **/
111static inline struct scatterlist *sg_next(struct scatterlist *sg)
112{
113#ifdef CONFIG_DEBUG_SG
114 BUG_ON(sg->sg_magic != SG_MAGIC);
115#endif
116 if (sg_is_last(sg))
117 return NULL;
118
119 sg++;
120 if (unlikely(sg_is_chain(sg)))
121 sg = sg_chain_ptr(sg);
122
123 return sg;
124}
125
126/*
127 * Loop over each sg element, following the pointer to a new list if necessary 116 * Loop over each sg element, following the pointer to a new list if necessary
128 */ 117 */
129#define for_each_sg(sglist, sg, nr, __i) \ 118#define for_each_sg(sglist, sg, nr, __i) \
130 for (__i = 0, sg = (sglist); __i < (nr); __i++, sg = sg_next(sg)) 119 for (__i = 0, sg = (sglist); __i < (nr); __i++, sg = sg_next(sg))
131 120
132/** 121/**
133 * sg_last - return the last scatterlist entry in a list
134 * @sgl: First entry in the scatterlist
135 * @nents: Number of entries in the scatterlist
136 *
137 * Description:
138 * Should only be used casually, it (currently) scan the entire list
139 * to get the last entry.
140 *
141 * Note that the @sgl@ pointer passed in need not be the first one,
142 * the important bit is that @nents@ denotes the number of entries that
143 * exist from @sgl@.
144 *
145 **/
146static inline struct scatterlist *sg_last(struct scatterlist *sgl,
147 unsigned int nents)
148{
149#ifndef ARCH_HAS_SG_CHAIN
150 struct scatterlist *ret = &sgl[nents - 1];
151#else
152 struct scatterlist *sg, *ret = NULL;
153 int i;
154
155 for_each_sg(sgl, sg, nents, i)
156 ret = sg;
157
158#endif
159#ifdef CONFIG_DEBUG_SG
160 BUG_ON(sgl[0].sg_magic != SG_MAGIC);
161 BUG_ON(!sg_is_last(ret));
162#endif
163 return ret;
164}
165
166/**
167 * sg_chain - Chain two sglists together 122 * sg_chain - Chain two sglists together
168 * @prv: First scatterlist 123 * @prv: First scatterlist
169 * @prv_nents: Number of entries in prv 124 * @prv_nents: Number of entries in prv
@@ -179,71 +134,39 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
179#ifndef ARCH_HAS_SG_CHAIN 134#ifndef ARCH_HAS_SG_CHAIN
180 BUG(); 135 BUG();
181#endif 136#endif
182 prv[prv_nents - 1].page_link = (unsigned long) sgl | 0x01;
183}
184 137
185/** 138 /*
186 * sg_mark_end - Mark the end of the scatterlist 139 * offset and length are unused for chain entry. Clear them.
187 * @sgl: Scatterlist 140 */
188 * @nents: Number of entries in sgl 141 prv[prv_nents - 1].offset = 0;
189 * 142 prv[prv_nents - 1].length = 0;
190 * Description:
191 * Marks the last entry as the termination point for sg_next()
192 *
193 **/
194static inline void sg_mark_end(struct scatterlist *sgl, unsigned int nents)
195{
196 sgl[nents - 1].page_link = 0x02;
197}
198
199static inline void __sg_mark_end(struct scatterlist *sg)
200{
201 sg->page_link |= 0x02;
202}
203 143
204/** 144 /*
205 * sg_init_one - Initialize a single entry sg list 145 * Set lowest bit to indicate a link pointer, and make sure to clear
206 * @sg: SG entry 146 * the termination bit if it happens to be set.
207 * @buf: Virtual address for IO 147 */
208 * @buflen: IO length 148 prv[prv_nents - 1].page_link = ((unsigned long) sgl | 0x01) & ~0x02;
209 *
210 * Notes:
211 * This should not be used on a single entry that is part of a larger
212 * table. Use sg_init_table() for that.
213 *
214 **/
215static inline void sg_init_one(struct scatterlist *sg, const void *buf,
216 unsigned int buflen)
217{
218 memset(sg, 0, sizeof(*sg));
219#ifdef CONFIG_DEBUG_SG
220 sg->sg_magic = SG_MAGIC;
221#endif
222 sg_mark_end(sg, 1);
223 sg_set_buf(sg, buf, buflen);
224} 149}
225 150
226/** 151/**
227 * sg_init_table - Initialize SG table 152 * sg_mark_end - Mark the end of the scatterlist
228 * @sgl: The SG table 153 * @sg: SG entryScatterlist
229 * @nents: Number of entries in table
230 * 154 *
231 * Notes: 155 * Description:
232 * If this is part of a chained sg table, sg_mark_end() should be 156 * Marks the passed in sg entry as the termination point for the sg
233 * used only on the last table part. 157 * table. A call to sg_next() on this entry will return NULL.
234 * 158 *
235 **/ 159 **/
236static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents) 160static inline void sg_mark_end(struct scatterlist *sg)
237{ 161{
238 memset(sgl, 0, sizeof(*sgl) * nents);
239 sg_mark_end(sgl, nents);
240#ifdef CONFIG_DEBUG_SG 162#ifdef CONFIG_DEBUG_SG
241 { 163 BUG_ON(sg->sg_magic != SG_MAGIC);
242 int i;
243 for (i = 0; i < nents; i++)
244 sgl[i].sg_magic = SG_MAGIC;
245 }
246#endif 164#endif
165 /*
166 * Set termination bit, clear potential chain bit
167 */
168 sg->page_link |= 0x02;
169 sg->page_link &= ~0x01;
247} 170}
248 171
249/** 172/**
@@ -276,4 +199,24 @@ static inline void *sg_virt(struct scatterlist *sg)
276 return page_address(sg_page(sg)) + sg->offset; 199 return page_address(sg_page(sg)) + sg->offset;
277} 200}
278 201
202struct scatterlist *sg_next(struct scatterlist *);
203struct scatterlist *sg_last(struct scatterlist *s, unsigned int);
204void sg_init_table(struct scatterlist *, unsigned int);
205void sg_init_one(struct scatterlist *, const void *, unsigned int);
206
207typedef struct scatterlist *(sg_alloc_fn)(unsigned int, gfp_t);
208typedef void (sg_free_fn)(struct scatterlist *, unsigned int);
209
210void __sg_free_table(struct sg_table *, unsigned int, sg_free_fn *);
211void sg_free_table(struct sg_table *);
212int __sg_alloc_table(struct sg_table *, unsigned int, unsigned int, gfp_t,
213 sg_alloc_fn *);
214int sg_alloc_table(struct sg_table *, unsigned int, gfp_t);
215
216/*
217 * Maximum number of entries that will be allocated in one piece, if
218 * a list larger than this is required then chaining will be utilized.
219 */
220#define SG_MAX_SINGLE_ALLOC (PAGE_SIZE / sizeof(struct scatterlist))
221
279#endif /* _LINUX_SCATTERLIST_H */ 222#endif /* _LINUX_SCATTERLIST_H */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 3c07d595979f..af6947e69b40 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -27,6 +27,7 @@
27#define CLONE_NEWUSER 0x10000000 /* New user namespace */ 27#define CLONE_NEWUSER 0x10000000 /* New user namespace */
28#define CLONE_NEWPID 0x20000000 /* New pid namespace */ 28#define CLONE_NEWPID 0x20000000 /* New pid namespace */
29#define CLONE_NEWNET 0x40000000 /* New network namespace */ 29#define CLONE_NEWNET 0x40000000 /* New network namespace */
30#define CLONE_IO 0x80000000 /* Clone io context */
30 31
31/* 32/*
32 * Scheduling policies 33 * Scheduling policies
@@ -78,7 +79,6 @@ struct sched_param {
78#include <linux/proportions.h> 79#include <linux/proportions.h>
79#include <linux/seccomp.h> 80#include <linux/seccomp.h>
80#include <linux/rcupdate.h> 81#include <linux/rcupdate.h>
81#include <linux/futex.h>
82#include <linux/rtmutex.h> 82#include <linux/rtmutex.h>
83 83
84#include <linux/time.h> 84#include <linux/time.h>
@@ -88,11 +88,13 @@ struct sched_param {
88#include <linux/hrtimer.h> 88#include <linux/hrtimer.h>
89#include <linux/task_io_accounting.h> 89#include <linux/task_io_accounting.h>
90#include <linux/kobject.h> 90#include <linux/kobject.h>
91#include <linux/latencytop.h>
91 92
92#include <asm/processor.h> 93#include <asm/processor.h>
93 94
94struct exec_domain; 95struct exec_domain;
95struct futex_pi_state; 96struct futex_pi_state;
97struct robust_list_head;
96struct bio; 98struct bio;
97 99
98/* 100/*
@@ -170,13 +172,35 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
170#define TASK_RUNNING 0 172#define TASK_RUNNING 0
171#define TASK_INTERRUPTIBLE 1 173#define TASK_INTERRUPTIBLE 1
172#define TASK_UNINTERRUPTIBLE 2 174#define TASK_UNINTERRUPTIBLE 2
173#define TASK_STOPPED 4 175#define __TASK_STOPPED 4
174#define TASK_TRACED 8 176#define __TASK_TRACED 8
175/* in tsk->exit_state */ 177/* in tsk->exit_state */
176#define EXIT_ZOMBIE 16 178#define EXIT_ZOMBIE 16
177#define EXIT_DEAD 32 179#define EXIT_DEAD 32
178/* in tsk->state again */ 180/* in tsk->state again */
179#define TASK_DEAD 64 181#define TASK_DEAD 64
182#define TASK_WAKEKILL 128
183
184/* Convenience macros for the sake of set_task_state */
185#define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE)
186#define TASK_STOPPED (TASK_WAKEKILL | __TASK_STOPPED)
187#define TASK_TRACED (TASK_WAKEKILL | __TASK_TRACED)
188
189/* Convenience macros for the sake of wake_up */
190#define TASK_NORMAL (TASK_INTERRUPTIBLE | TASK_UNINTERRUPTIBLE)
191#define TASK_ALL (TASK_NORMAL | __TASK_STOPPED | __TASK_TRACED)
192
193/* get_task_state() */
194#define TASK_REPORT (TASK_RUNNING | TASK_INTERRUPTIBLE | \
195 TASK_UNINTERRUPTIBLE | __TASK_STOPPED | \
196 __TASK_TRACED)
197
198#define task_is_traced(task) ((task->state & __TASK_TRACED) != 0)
199#define task_is_stopped(task) ((task->state & __TASK_STOPPED) != 0)
200#define task_is_stopped_or_traced(task) \
201 ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0)
202#define task_contributes_to_load(task) \
203 ((task->state & TASK_UNINTERRUPTIBLE) != 0)
180 204
181#define __set_task_state(tsk, state_value) \ 205#define __set_task_state(tsk, state_value) \
182 do { (tsk)->state = (state_value); } while (0) 206 do { (tsk)->state = (state_value); } while (0)
@@ -230,6 +254,8 @@ static inline int select_nohz_load_balancer(int cpu)
230} 254}
231#endif 255#endif
232 256
257extern unsigned long rt_needs_cpu(int cpu);
258
233/* 259/*
234 * Only dump TASK_* tasks. (0 for all tasks) 260 * Only dump TASK_* tasks. (0 for all tasks)
235 */ 261 */
@@ -254,15 +280,22 @@ long io_schedule_timeout(long timeout);
254 280
255extern void cpu_init (void); 281extern void cpu_init (void);
256extern void trap_init(void); 282extern void trap_init(void);
283extern void account_process_tick(struct task_struct *task, int user);
257extern void update_process_times(int user); 284extern void update_process_times(int user);
258extern void scheduler_tick(void); 285extern void scheduler_tick(void);
286extern void hrtick_resched(void);
287
288extern void sched_show_task(struct task_struct *p);
259 289
260#ifdef CONFIG_DETECT_SOFTLOCKUP 290#ifdef CONFIG_DETECT_SOFTLOCKUP
261extern void softlockup_tick(void); 291extern void softlockup_tick(void);
262extern void spawn_softlockup_task(void); 292extern void spawn_softlockup_task(void);
263extern void touch_softlockup_watchdog(void); 293extern void touch_softlockup_watchdog(void);
264extern void touch_all_softlockup_watchdogs(void); 294extern void touch_all_softlockup_watchdogs(void);
265extern int softlockup_thresh; 295extern unsigned long softlockup_thresh;
296extern unsigned long sysctl_hung_task_check_count;
297extern unsigned long sysctl_hung_task_timeout_secs;
298extern unsigned long sysctl_hung_task_warnings;
266#else 299#else
267static inline void softlockup_tick(void) 300static inline void softlockup_tick(void)
268{ 301{
@@ -281,12 +314,17 @@ static inline void touch_all_softlockup_watchdogs(void)
281 314
282/* Attach to any functions which should be ignored in wchan output. */ 315/* Attach to any functions which should be ignored in wchan output. */
283#define __sched __attribute__((__section__(".sched.text"))) 316#define __sched __attribute__((__section__(".sched.text")))
317
318/* Linker adds these: start and end of __sched functions */
319extern char __sched_text_start[], __sched_text_end[];
320
284/* Is this address in the __sched functions? */ 321/* Is this address in the __sched functions? */
285extern int in_sched_functions(unsigned long addr); 322extern int in_sched_functions(unsigned long addr);
286 323
287#define MAX_SCHEDULE_TIMEOUT LONG_MAX 324#define MAX_SCHEDULE_TIMEOUT LONG_MAX
288extern signed long FASTCALL(schedule_timeout(signed long timeout)); 325extern signed long FASTCALL(schedule_timeout(signed long timeout));
289extern signed long schedule_timeout_interruptible(signed long timeout); 326extern signed long schedule_timeout_interruptible(signed long timeout);
327extern signed long schedule_timeout_killable(signed long timeout);
290extern signed long schedule_timeout_uninterruptible(signed long timeout); 328extern signed long schedule_timeout_uninterruptible(signed long timeout);
291asmlinkage void schedule(void); 329asmlinkage void schedule(void);
292 330
@@ -547,18 +585,13 @@ struct user_struct {
547#ifdef CONFIG_FAIR_USER_SCHED 585#ifdef CONFIG_FAIR_USER_SCHED
548 struct task_group *tg; 586 struct task_group *tg;
549#ifdef CONFIG_SYSFS 587#ifdef CONFIG_SYSFS
550 struct kset kset; 588 struct kobject kobj;
551 struct subsys_attribute user_attr;
552 struct work_struct work; 589 struct work_struct work;
553#endif 590#endif
554#endif 591#endif
555}; 592};
556 593
557#ifdef CONFIG_FAIR_USER_SCHED 594extern int uids_sysfs_init(void);
558extern int uids_kobject_init(void);
559#else
560static inline int uids_kobject_init(void) { return 0; }
561#endif
562 595
563extern struct user_struct *find_user(uid_t); 596extern struct user_struct *find_user(uid_t);
564 597
@@ -822,6 +855,7 @@ struct sched_class {
822 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup); 855 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup);
823 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep); 856 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep);
824 void (*yield_task) (struct rq *rq); 857 void (*yield_task) (struct rq *rq);
858 int (*select_task_rq)(struct task_struct *p, int sync);
825 859
826 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p); 860 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p);
827 861
@@ -837,11 +871,25 @@ struct sched_class {
837 int (*move_one_task) (struct rq *this_rq, int this_cpu, 871 int (*move_one_task) (struct rq *this_rq, int this_cpu,
838 struct rq *busiest, struct sched_domain *sd, 872 struct rq *busiest, struct sched_domain *sd,
839 enum cpu_idle_type idle); 873 enum cpu_idle_type idle);
874 void (*pre_schedule) (struct rq *this_rq, struct task_struct *task);
875 void (*post_schedule) (struct rq *this_rq);
876 void (*task_wake_up) (struct rq *this_rq, struct task_struct *task);
840#endif 877#endif
841 878
842 void (*set_curr_task) (struct rq *rq); 879 void (*set_curr_task) (struct rq *rq);
843 void (*task_tick) (struct rq *rq, struct task_struct *p); 880 void (*task_tick) (struct rq *rq, struct task_struct *p, int queued);
844 void (*task_new) (struct rq *rq, struct task_struct *p); 881 void (*task_new) (struct rq *rq, struct task_struct *p);
882 void (*set_cpus_allowed)(struct task_struct *p, cpumask_t *newmask);
883
884 void (*join_domain)(struct rq *rq);
885 void (*leave_domain)(struct rq *rq);
886
887 void (*switched_from) (struct rq *this_rq, struct task_struct *task,
888 int running);
889 void (*switched_to) (struct rq *this_rq, struct task_struct *task,
890 int running);
891 void (*prio_changed) (struct rq *this_rq, struct task_struct *task,
892 int oldprio, int running);
845}; 893};
846 894
847struct load_weight { 895struct load_weight {
@@ -862,7 +910,6 @@ struct sched_entity {
862 struct load_weight load; /* for load-balancing */ 910 struct load_weight load; /* for load-balancing */
863 struct rb_node run_node; 911 struct rb_node run_node;
864 unsigned int on_rq; 912 unsigned int on_rq;
865 int peer_preempt;
866 913
867 u64 exec_start; 914 u64 exec_start;
868 u64 sum_exec_runtime; 915 u64 sum_exec_runtime;
@@ -872,6 +919,8 @@ struct sched_entity {
872#ifdef CONFIG_SCHEDSTATS 919#ifdef CONFIG_SCHEDSTATS
873 u64 wait_start; 920 u64 wait_start;
874 u64 wait_max; 921 u64 wait_max;
922 u64 wait_count;
923 u64 wait_sum;
875 924
876 u64 sleep_start; 925 u64 sleep_start;
877 u64 sleep_max; 926 u64 sleep_max;
@@ -910,6 +959,21 @@ struct sched_entity {
910#endif 959#endif
911}; 960};
912 961
962struct sched_rt_entity {
963 struct list_head run_list;
964 unsigned int time_slice;
965 unsigned long timeout;
966 int nr_cpus_allowed;
967
968#ifdef CONFIG_FAIR_GROUP_SCHED
969 struct sched_rt_entity *parent;
970 /* rq on which this entity is (to be) queued: */
971 struct rt_rq *rt_rq;
972 /* rq "owned" by this entity/group: */
973 struct rt_rq *my_q;
974#endif
975};
976
913struct task_struct { 977struct task_struct {
914 volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ 978 volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */
915 void *stack; 979 void *stack;
@@ -926,16 +990,15 @@ struct task_struct {
926#endif 990#endif
927 991
928 int prio, static_prio, normal_prio; 992 int prio, static_prio, normal_prio;
929 struct list_head run_list;
930 const struct sched_class *sched_class; 993 const struct sched_class *sched_class;
931 struct sched_entity se; 994 struct sched_entity se;
995 struct sched_rt_entity rt;
932 996
933#ifdef CONFIG_PREEMPT_NOTIFIERS 997#ifdef CONFIG_PREEMPT_NOTIFIERS
934 /* list of struct preempt_notifier: */ 998 /* list of struct preempt_notifier: */
935 struct hlist_head preempt_notifiers; 999 struct hlist_head preempt_notifiers;
936#endif 1000#endif
937 1001
938 unsigned short ioprio;
939 /* 1002 /*
940 * fpu_counter contains the number of consecutive context switches 1003 * fpu_counter contains the number of consecutive context switches
941 * that the FPU is used. If this is over a threshold, the lazy fpu 1004 * that the FPU is used. If this is over a threshold, the lazy fpu
@@ -952,7 +1015,11 @@ struct task_struct {
952 1015
953 unsigned int policy; 1016 unsigned int policy;
954 cpumask_t cpus_allowed; 1017 cpumask_t cpus_allowed;
955 unsigned int time_slice; 1018
1019#ifdef CONFIG_PREEMPT_RCU
1020 int rcu_read_lock_nesting;
1021 int rcu_flipctr_idx;
1022#endif /* #ifdef CONFIG_PREEMPT_RCU */
956 1023
957#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) 1024#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
958 struct sched_info sched_info; 1025 struct sched_info sched_info;
@@ -1009,6 +1076,7 @@ struct task_struct {
1009 unsigned int rt_priority; 1076 unsigned int rt_priority;
1010 cputime_t utime, stime, utimescaled, stimescaled; 1077 cputime_t utime, stime, utimescaled, stimescaled;
1011 cputime_t gtime; 1078 cputime_t gtime;
1079 cputime_t prev_utime, prev_stime;
1012 unsigned long nvcsw, nivcsw; /* context switch counts */ 1080 unsigned long nvcsw, nivcsw; /* context switch counts */
1013 struct timespec start_time; /* monotonic time */ 1081 struct timespec start_time; /* monotonic time */
1014 struct timespec real_start_time; /* boot based time */ 1082 struct timespec real_start_time; /* boot based time */
@@ -1041,6 +1109,11 @@ struct task_struct {
1041/* ipc stuff */ 1109/* ipc stuff */
1042 struct sysv_sem sysvsem; 1110 struct sysv_sem sysvsem;
1043#endif 1111#endif
1112#ifdef CONFIG_DETECT_SOFTLOCKUP
1113/* hung task detection */
1114 unsigned long last_switch_timestamp;
1115 unsigned long last_switch_count;
1116#endif
1044/* CPU-specific state of this task */ 1117/* CPU-specific state of this task */
1045 struct thread_struct thread; 1118 struct thread_struct thread;
1046/* filesystem information */ 1119/* filesystem information */
@@ -1066,6 +1139,10 @@ struct task_struct {
1066 void *security; 1139 void *security;
1067#endif 1140#endif
1068 struct audit_context *audit_context; 1141 struct audit_context *audit_context;
1142#ifdef CONFIG_AUDITSYSCALL
1143 uid_t loginuid;
1144 unsigned int sessionid;
1145#endif
1069 seccomp_t seccomp; 1146 seccomp_t seccomp;
1070 1147
1071/* Thread group tracking */ 1148/* Thread group tracking */
@@ -1173,6 +1250,10 @@ struct task_struct {
1173 int make_it_fail; 1250 int make_it_fail;
1174#endif 1251#endif
1175 struct prop_local_single dirties; 1252 struct prop_local_single dirties;
1253#ifdef CONFIG_LATENCYTOP
1254 int latency_record_count;
1255 struct latency_record latency_record[LT_SAVECOUNT];
1256#endif
1176}; 1257};
1177 1258
1178/* 1259/*
@@ -1250,13 +1331,6 @@ struct pid_namespace;
1250 * 1331 *
1251 * set_task_vxid() : assigns a virtual id to a task; 1332 * set_task_vxid() : assigns a virtual id to a task;
1252 * 1333 *
1253 * task_ppid_nr_ns() : the parent's id as seen from the namespace specified.
1254 * the result depends on the namespace and whether the
1255 * task in question is the namespace's init. e.g. for the
1256 * namespace's init this will return 0 when called from
1257 * the namespace of this init, or appropriate id otherwise.
1258 *
1259 *
1260 * see also pid_nr() etc in include/linux/pid.h 1334 * see also pid_nr() etc in include/linux/pid.h
1261 */ 1335 */
1262 1336
@@ -1312,12 +1386,6 @@ static inline pid_t task_session_vnr(struct task_struct *tsk)
1312} 1386}
1313 1387
1314 1388
1315static inline pid_t task_ppid_nr_ns(struct task_struct *tsk,
1316 struct pid_namespace *ns)
1317{
1318 return pid_nr_ns(task_pid(rcu_dereference(tsk->real_parent)), ns);
1319}
1320
1321/** 1389/**
1322 * pid_alive - check that a task structure is not stale 1390 * pid_alive - check that a task structure is not stale
1323 * @p: Task structure to be checked. 1391 * @p: Task structure to be checked.
@@ -1459,12 +1527,23 @@ extern void sched_idle_next(void);
1459 1527
1460#ifdef CONFIG_SCHED_DEBUG 1528#ifdef CONFIG_SCHED_DEBUG
1461extern unsigned int sysctl_sched_latency; 1529extern unsigned int sysctl_sched_latency;
1462extern unsigned int sysctl_sched_nr_latency; 1530extern unsigned int sysctl_sched_min_granularity;
1463extern unsigned int sysctl_sched_wakeup_granularity; 1531extern unsigned int sysctl_sched_wakeup_granularity;
1464extern unsigned int sysctl_sched_batch_wakeup_granularity; 1532extern unsigned int sysctl_sched_batch_wakeup_granularity;
1465extern unsigned int sysctl_sched_child_runs_first; 1533extern unsigned int sysctl_sched_child_runs_first;
1466extern unsigned int sysctl_sched_features; 1534extern unsigned int sysctl_sched_features;
1467extern unsigned int sysctl_sched_migration_cost; 1535extern unsigned int sysctl_sched_migration_cost;
1536extern unsigned int sysctl_sched_nr_migrate;
1537extern unsigned int sysctl_sched_rt_period;
1538extern unsigned int sysctl_sched_rt_ratio;
1539#if defined(CONFIG_FAIR_GROUP_SCHED) && defined(CONFIG_SMP)
1540extern unsigned int sysctl_sched_min_bal_int_shares;
1541extern unsigned int sysctl_sched_max_bal_int_shares;
1542#endif
1543
1544int sched_nr_latency_handler(struct ctl_table *table, int write,
1545 struct file *file, void __user *buffer, size_t *length,
1546 loff_t *ppos);
1468#endif 1547#endif
1469 1548
1470extern unsigned int sysctl_sched_compat_yield; 1549extern unsigned int sysctl_sched_compat_yield;
@@ -1840,7 +1919,14 @@ static inline int signal_pending(struct task_struct *p)
1840{ 1919{
1841 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING)); 1920 return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));
1842} 1921}
1843 1922
1923extern int FASTCALL(__fatal_signal_pending(struct task_struct *p));
1924
1925static inline int fatal_signal_pending(struct task_struct *p)
1926{
1927 return signal_pending(p) && __fatal_signal_pending(p);
1928}
1929
1844static inline int need_resched(void) 1930static inline int need_resched(void)
1845{ 1931{
1846 return unlikely(test_thread_flag(TIF_NEED_RESCHED)); 1932 return unlikely(test_thread_flag(TIF_NEED_RESCHED));
@@ -1853,29 +1939,33 @@ static inline int need_resched(void)
1853 * cond_resched_lock() will drop the spinlock before scheduling, 1939 * cond_resched_lock() will drop the spinlock before scheduling,
1854 * cond_resched_softirq() will enable bhs before scheduling. 1940 * cond_resched_softirq() will enable bhs before scheduling.
1855 */ 1941 */
1856extern int cond_resched(void); 1942#ifdef CONFIG_PREEMPT
1857extern int cond_resched_lock(spinlock_t * lock); 1943static inline int cond_resched(void)
1858extern int cond_resched_softirq(void); 1944{
1859 1945 return 0;
1860/* 1946}
1861 * Does a critical section need to be broken due to another
1862 * task waiting?:
1863 */
1864#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP)
1865# define need_lockbreak(lock) ((lock)->break_lock)
1866#else 1947#else
1867# define need_lockbreak(lock) 0 1948extern int _cond_resched(void);
1949static inline int cond_resched(void)
1950{
1951 return _cond_resched();
1952}
1868#endif 1953#endif
1954extern int cond_resched_lock(spinlock_t * lock);
1955extern int cond_resched_softirq(void);
1869 1956
1870/* 1957/*
1871 * Does a critical section need to be broken due to another 1958 * Does a critical section need to be broken due to another
1872 * task waiting or preemption being signalled: 1959 * task waiting?: (technically does not depend on CONFIG_PREEMPT,
1960 * but a general need for low latency)
1873 */ 1961 */
1874static inline int lock_need_resched(spinlock_t *lock) 1962static inline int spin_needbreak(spinlock_t *lock)
1875{ 1963{
1876 if (need_lockbreak(lock) || need_resched()) 1964#ifdef CONFIG_PREEMPT
1877 return 1; 1965 return spin_is_contended(lock);
1966#else
1878 return 0; 1967 return 0;
1968#endif
1879} 1969}
1880 1970
1881/* 1971/*
@@ -1982,6 +2072,14 @@ static inline void inc_syscw(struct task_struct *tsk)
1982} 2072}
1983#endif 2073#endif
1984 2074
2075#ifdef CONFIG_SMP
2076void migration_init(void);
2077#else
2078static inline void migration_init(void)
2079{
2080}
2081#endif
2082
1985#endif /* __KERNEL__ */ 2083#endif /* __KERNEL__ */
1986 2084
1987#endif 2085#endif
diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h
index 827b85bbf388..1ee2c05142f6 100644
--- a/include/linux/screen_info.h
+++ b/include/linux/screen_info.h
@@ -63,6 +63,8 @@ struct screen_info {
63 63
64#define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */ 64#define VIDEO_TYPE_PMAC 0x60 /* PowerMacintosh frame buffer. */
65 65
66#define VIDEO_TYPE_EFI 0x70 /* EFI graphic mode */
67
66#ifdef __KERNEL__ 68#ifdef __KERNEL__
67extern struct screen_info screen_info; 69extern struct screen_info screen_info;
68 70
diff --git a/include/linux/security.h b/include/linux/security.h
index ac050830a873..d24974262dc6 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -34,6 +34,12 @@
34#include <linux/xfrm.h> 34#include <linux/xfrm.h>
35#include <net/flow.h> 35#include <net/flow.h>
36 36
37/* only a char in selinux superblock security struct flags */
38#define FSCONTEXT_MNT 0x01
39#define CONTEXT_MNT 0x02
40#define ROOTCONTEXT_MNT 0x04
41#define DEFCONTEXT_MNT 0x08
42
37/* 43/*
38 * Bounding set 44 * Bounding set
39 */ 45 */
@@ -243,9 +249,6 @@ struct request_sock;
243 * @mnt contains the mounted file system. 249 * @mnt contains the mounted file system.
244 * @flags contains the new filesystem flags. 250 * @flags contains the new filesystem flags.
245 * @data contains the filesystem-specific data. 251 * @data contains the filesystem-specific data.
246 * @sb_post_mountroot:
247 * Update the security module's state when the root filesystem is mounted.
248 * This hook is only called if the mount was successful.
249 * @sb_post_addmount: 252 * @sb_post_addmount:
250 * Update the security module's state when a filesystem is mounted. 253 * Update the security module's state when a filesystem is mounted.
251 * This hook is called any time a mount is successfully grafetd to 254 * This hook is called any time a mount is successfully grafetd to
@@ -261,6 +264,22 @@ struct request_sock;
261 * Update module state after a successful pivot. 264 * Update module state after a successful pivot.
262 * @old_nd contains the nameidata structure for the old root. 265 * @old_nd contains the nameidata structure for the old root.
263 * @new_nd contains the nameidata structure for the new root. 266 * @new_nd contains the nameidata structure for the new root.
267 * @sb_get_mnt_opts:
268 * Get the security relevant mount options used for a superblock
269 * @sb the superblock to get security mount options from
270 * @mount_options array for pointers to mount options
271 * @mount_flags array of ints specifying what each mount options is
272 * @num_opts number of options in the arrays
273 * @sb_set_mnt_opts:
274 * Set the security relevant mount options used for a superblock
275 * @sb the superblock to set security mount options for
276 * @mount_options array for pointers to mount options
277 * @mount_flags array of ints specifying what each mount options is
278 * @num_opts number of options in the arrays
279 * @sb_clone_mnt_opts:
280 * Copy all security options from a given superblock to another
281 * @oldsb old superblock which contain information to clone
282 * @newsb new superblock which needs filled in
264 * 283 *
265 * Security hooks for inode operations. 284 * Security hooks for inode operations.
266 * 285 *
@@ -1183,6 +1202,10 @@ struct request_sock;
1183 * Convert secid to security context. 1202 * Convert secid to security context.
1184 * @secid contains the security ID. 1203 * @secid contains the security ID.
1185 * @secdata contains the pointer that stores the converted security context. 1204 * @secdata contains the pointer that stores the converted security context.
1205 * @secctx_to_secid:
1206 * Convert security context to secid.
1207 * @secid contains the pointer to the generated security ID.
1208 * @secdata contains the security context.
1186 * 1209 *
1187 * @release_secctx: 1210 * @release_secctx:
1188 * Release the security context. 1211 * Release the security context.
@@ -1235,13 +1258,19 @@ struct security_operations {
1235 void (*sb_umount_busy) (struct vfsmount * mnt); 1258 void (*sb_umount_busy) (struct vfsmount * mnt);
1236 void (*sb_post_remount) (struct vfsmount * mnt, 1259 void (*sb_post_remount) (struct vfsmount * mnt,
1237 unsigned long flags, void *data); 1260 unsigned long flags, void *data);
1238 void (*sb_post_mountroot) (void);
1239 void (*sb_post_addmount) (struct vfsmount * mnt, 1261 void (*sb_post_addmount) (struct vfsmount * mnt,
1240 struct nameidata * mountpoint_nd); 1262 struct nameidata * mountpoint_nd);
1241 int (*sb_pivotroot) (struct nameidata * old_nd, 1263 int (*sb_pivotroot) (struct nameidata * old_nd,
1242 struct nameidata * new_nd); 1264 struct nameidata * new_nd);
1243 void (*sb_post_pivotroot) (struct nameidata * old_nd, 1265 void (*sb_post_pivotroot) (struct nameidata * old_nd,
1244 struct nameidata * new_nd); 1266 struct nameidata * new_nd);
1267 int (*sb_get_mnt_opts) (const struct super_block *sb,
1268 char ***mount_options, int **flags,
1269 int *num_opts);
1270 int (*sb_set_mnt_opts) (struct super_block *sb, char **mount_options,
1271 int *flags, int num_opts);
1272 void (*sb_clone_mnt_opts) (const struct super_block *oldsb,
1273 struct super_block *newsb);
1245 1274
1246 int (*inode_alloc_security) (struct inode *inode); 1275 int (*inode_alloc_security) (struct inode *inode);
1247 void (*inode_free_security) (struct inode *inode); 1276 void (*inode_free_security) (struct inode *inode);
@@ -1371,6 +1400,7 @@ struct security_operations {
1371 int (*getprocattr)(struct task_struct *p, char *name, char **value); 1400 int (*getprocattr)(struct task_struct *p, char *name, char **value);
1372 int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size); 1401 int (*setprocattr)(struct task_struct *p, char *name, void *value, size_t size);
1373 int (*secid_to_secctx)(u32 secid, char **secdata, u32 *seclen); 1402 int (*secid_to_secctx)(u32 secid, char **secdata, u32 *seclen);
1403 int (*secctx_to_secid)(char *secdata, u32 seclen, u32 *secid);
1374 void (*release_secctx)(char *secdata, u32 seclen); 1404 void (*release_secctx)(char *secdata, u32 seclen);
1375 1405
1376#ifdef CONFIG_SECURITY_NETWORK 1406#ifdef CONFIG_SECURITY_NETWORK
@@ -1495,10 +1525,16 @@ int security_sb_umount(struct vfsmount *mnt, int flags);
1495void security_sb_umount_close(struct vfsmount *mnt); 1525void security_sb_umount_close(struct vfsmount *mnt);
1496void security_sb_umount_busy(struct vfsmount *mnt); 1526void security_sb_umount_busy(struct vfsmount *mnt);
1497void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data); 1527void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data);
1498void security_sb_post_mountroot(void);
1499void security_sb_post_addmount(struct vfsmount *mnt, struct nameidata *mountpoint_nd); 1528void security_sb_post_addmount(struct vfsmount *mnt, struct nameidata *mountpoint_nd);
1500int security_sb_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd); 1529int security_sb_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd);
1501void security_sb_post_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd); 1530void security_sb_post_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd);
1531int security_sb_get_mnt_opts(const struct super_block *sb, char ***mount_options,
1532 int **flags, int *num_opts);
1533int security_sb_set_mnt_opts(struct super_block *sb, char **mount_options,
1534 int *flags, int num_opts);
1535void security_sb_clone_mnt_opts(const struct super_block *oldsb,
1536 struct super_block *newsb);
1537
1502int security_inode_alloc(struct inode *inode); 1538int security_inode_alloc(struct inode *inode);
1503void security_inode_free(struct inode *inode); 1539void security_inode_free(struct inode *inode);
1504int security_inode_init_security(struct inode *inode, struct inode *dir, 1540int security_inode_init_security(struct inode *inode, struct inode *dir,
@@ -1603,6 +1639,7 @@ int security_setprocattr(struct task_struct *p, char *name, void *value, size_t
1603int security_netlink_send(struct sock *sk, struct sk_buff *skb); 1639int security_netlink_send(struct sock *sk, struct sk_buff *skb);
1604int security_netlink_recv(struct sk_buff *skb, int cap); 1640int security_netlink_recv(struct sk_buff *skb, int cap);
1605int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); 1641int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
1642int security_secctx_to_secid(char *secdata, u32 seclen, u32 *secid);
1606void security_release_secctx(char *secdata, u32 seclen); 1643void security_release_secctx(char *secdata, u32 seclen);
1607 1644
1608#else /* CONFIG_SECURITY */ 1645#else /* CONFIG_SECURITY */
@@ -1777,9 +1814,6 @@ static inline void security_sb_post_remount (struct vfsmount *mnt,
1777 unsigned long flags, void *data) 1814 unsigned long flags, void *data)
1778{ } 1815{ }
1779 1816
1780static inline void security_sb_post_mountroot (void)
1781{ }
1782
1783static inline void security_sb_post_addmount (struct vfsmount *mnt, 1817static inline void security_sb_post_addmount (struct vfsmount *mnt,
1784 struct nameidata *mountpoint_nd) 1818 struct nameidata *mountpoint_nd)
1785{ } 1819{ }
@@ -2266,7 +2300,7 @@ static inline struct dentry *securityfs_create_file(const char *name,
2266 mode_t mode, 2300 mode_t mode,
2267 struct dentry *parent, 2301 struct dentry *parent,
2268 void *data, 2302 void *data,
2269 struct file_operations *fops) 2303 const struct file_operations *fops)
2270{ 2304{
2271 return ERR_PTR(-ENODEV); 2305 return ERR_PTR(-ENODEV);
2272} 2306}
@@ -2280,6 +2314,13 @@ static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *secle
2280 return -EOPNOTSUPP; 2314 return -EOPNOTSUPP;
2281} 2315}
2282 2316
2317static inline int security_secctx_to_secid(char *secdata,
2318 u32 seclen,
2319 u32 *secid)
2320{
2321 return -EOPNOTSUPP;
2322}
2323
2283static inline void security_release_secctx(char *secdata, u32 seclen) 2324static inline void security_release_secctx(char *secdata, u32 seclen)
2284{ 2325{
2285} 2326}
diff --git a/include/linux/selinux.h b/include/linux/selinux.h
index d1b7ca6c1c57..8c2cc4c02526 100644
--- a/include/linux/selinux.h
+++ b/include/linux/selinux.h
@@ -120,23 +120,42 @@ void selinux_get_task_sid(struct task_struct *tsk, u32 *sid);
120int selinux_string_to_sid(char *str, u32 *sid); 120int selinux_string_to_sid(char *str, u32 *sid);
121 121
122/** 122/**
123 * selinux_relabel_packet_permission - check permission to relabel a packet 123 * selinux_secmark_relabel_packet_permission - secmark permission check
124 * @sid: ID value to be applied to network packet (via SECMARK, most likely) 124 * @sid: SECMARK ID value to be applied to network packet
125 * 125 *
126 * Returns 0 if the current task is allowed to label packets with the 126 * Returns 0 if the current task is allowed to set the SECMARK label of
127 * supplied security ID. Note that it is implicit that the packet is always 127 * packets with the supplied security ID. Note that it is implicit that
128 * being relabeled from the default unlabled value, and that the access 128 * the packet is always being relabeled from the default unlabeled value,
129 * control decision is made in the AVC. 129 * and that the access control decision is made in the AVC.
130 */ 130 */
131int selinux_relabel_packet_permission(u32 sid); 131int selinux_secmark_relabel_packet_permission(u32 sid);
132 132
133/**
134 * selinux_secmark_refcount_inc - increments the secmark use counter
135 *
136 * SELinux keeps track of the current SECMARK targets in use so it knows
137 * when to apply SECMARK label access checks to network packets. This
138 * function incements this reference count to indicate that a new SECMARK
139 * target has been configured.
140 */
141void selinux_secmark_refcount_inc(void);
142
143/**
144 * selinux_secmark_refcount_dec - decrements the secmark use counter
145 *
146 * SELinux keeps track of the current SECMARK targets in use so it knows
147 * when to apply SECMARK label access checks to network packets. This
148 * function decements this reference count to indicate that one of the
149 * existing SECMARK targets has been removed/flushed.
150 */
151void selinux_secmark_refcount_dec(void);
133#else 152#else
134 153
135static inline int selinux_audit_rule_init(u32 field, u32 op, 154static inline int selinux_audit_rule_init(u32 field, u32 op,
136 char *rulestr, 155 char *rulestr,
137 struct selinux_audit_rule **rule) 156 struct selinux_audit_rule **rule)
138{ 157{
139 return -ENOTSUPP; 158 return -EOPNOTSUPP;
140} 159}
141 160
142static inline void selinux_audit_rule_free(struct selinux_audit_rule *rule) 161static inline void selinux_audit_rule_free(struct selinux_audit_rule *rule)
@@ -184,11 +203,21 @@ static inline int selinux_string_to_sid(const char *str, u32 *sid)
184 return 0; 203 return 0;
185} 204}
186 205
187static inline int selinux_relabel_packet_permission(u32 sid) 206static inline int selinux_secmark_relabel_packet_permission(u32 sid)
188{ 207{
189 return 0; 208 return 0;
190} 209}
191 210
211static inline void selinux_secmark_refcount_inc(void)
212{
213 return;
214}
215
216static inline void selinux_secmark_refcount_dec(void)
217{
218 return;
219}
220
192#endif /* CONFIG_SECURITY_SELINUX */ 221#endif /* CONFIG_SECURITY_SELINUX */
193 222
194#endif /* _LINUX_SELINUX_H */ 223#endif /* _LINUX_SELINUX_H */
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index ebbc02b325fc..648dfeb444db 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -63,5 +63,18 @@ extern struct list_head *seq_list_start_head(struct list_head *head,
63extern struct list_head *seq_list_next(void *v, struct list_head *head, 63extern struct list_head *seq_list_next(void *v, struct list_head *head,
64 loff_t *ppos); 64 loff_t *ppos);
65 65
66struct net;
67struct seq_net_private {
68 struct net *net;
69};
70
71int seq_open_net(struct inode *, struct file *,
72 const struct seq_operations *, int);
73int seq_release_net(struct inode *, struct file *);
74static inline struct net *seq_file_net(struct seq_file *seq)
75{
76 return ((struct seq_net_private *)seq->private)->net;
77}
78
66#endif 79#endif
67#endif 80#endif
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 6a5203fb9cf1..9963f81fea9a 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -437,7 +437,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
437#ifdef SUPPORT_SYSRQ 437#ifdef SUPPORT_SYSRQ
438 if (port->sysrq) { 438 if (port->sysrq) {
439 if (ch && time_before(jiffies, port->sysrq)) { 439 if (ch && time_before(jiffies, port->sysrq)) {
440 handle_sysrq(ch, port->info->tty); 440 handle_sysrq(ch, port->info ? port->info->tty : NULL);
441 port->sysrq = 0; 441 port->sysrq = 0;
442 return 1; 442 return 1;
443 } 443 }
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 94e49915a8c0..dfe975a9967e 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -95,6 +95,7 @@
95 95
96struct net_device; 96struct net_device;
97struct scatterlist; 97struct scatterlist;
98struct pipe_inode_info;
98 99
99#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 100#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
100struct nf_conntrack { 101struct nf_conntrack {
@@ -107,9 +108,6 @@ struct nf_bridge_info {
107 atomic_t use; 108 atomic_t use;
108 struct net_device *physindev; 109 struct net_device *physindev;
109 struct net_device *physoutdev; 110 struct net_device *physoutdev;
110#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
111 struct net_device *netoutdev;
112#endif
113 unsigned int mask; 111 unsigned int mask;
114 unsigned long data[32 / sizeof(unsigned long)]; 112 unsigned long data[32 / sizeof(unsigned long)];
115}; 113};
@@ -287,6 +285,7 @@ struct sk_buff {
287 __u8 pkt_type:3, 285 __u8 pkt_type:3,
288 fclone:2, 286 fclone:2,
289 ipvs_property:1, 287 ipvs_property:1,
288 peeked:1,
290 nf_trace:1; 289 nf_trace:1;
291 __be16 protocol; 290 __be16 protocol;
292 291
@@ -356,7 +355,6 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
356 return __alloc_skb(size, priority, 1, -1); 355 return __alloc_skb(size, priority, 1, -1);
357} 356}
358 357
359extern void kfree_skbmem(struct sk_buff *skb);
360extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); 358extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
361extern struct sk_buff *skb_clone(struct sk_buff *skb, 359extern struct sk_buff *skb_clone(struct sk_buff *skb,
362 gfp_t priority); 360 gfp_t priority);
@@ -387,7 +385,9 @@ extern void skb_truesize_bug(struct sk_buff *skb);
387 385
388static inline void skb_truesize_check(struct sk_buff *skb) 386static inline void skb_truesize_check(struct sk_buff *skb)
389{ 387{
390 if (unlikely((int)skb->truesize < sizeof(struct sk_buff) + skb->len)) 388 int len = sizeof(struct sk_buff) + skb->len;
389
390 if (unlikely((int)skb->truesize < len))
391 skb_truesize_bug(skb); 391 skb_truesize_bug(skb);
392} 392}
393 393
@@ -1536,6 +1536,8 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
1536 skb = skb->prev) 1536 skb = skb->prev)
1537 1537
1538 1538
1539extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags,
1540 int *peeked, int *err);
1539extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, 1541extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags,
1540 int noblock, int *err); 1542 int noblock, int *err);
1541extern unsigned int datagram_poll(struct file *file, struct socket *sock, 1543extern unsigned int datagram_poll(struct file *file, struct socket *sock,
@@ -1547,7 +1549,7 @@ extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
1547 int hlen, 1549 int hlen,
1548 struct iovec *iov); 1550 struct iovec *iov);
1549extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 1551extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
1550extern void skb_kill_datagram(struct sock *sk, struct sk_buff *skb, 1552extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
1551 unsigned int flags); 1553 unsigned int flags);
1552extern __wsum skb_checksum(const struct sk_buff *skb, int offset, 1554extern __wsum skb_checksum(const struct sk_buff *skb, int offset,
1553 int len, __wsum csum); 1555 int len, __wsum csum);
@@ -1558,6 +1560,11 @@ extern int skb_store_bits(struct sk_buff *skb, int offset,
1558extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, 1560extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb,
1559 int offset, u8 *to, int len, 1561 int offset, u8 *to, int len,
1560 __wsum csum); 1562 __wsum csum);
1563extern int skb_splice_bits(struct sk_buff *skb,
1564 unsigned int offset,
1565 struct pipe_inode_info *pipe,
1566 unsigned int len,
1567 unsigned int flags);
1561extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to); 1568extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
1562extern void skb_split(struct sk_buff *skb, 1569extern void skb_split(struct sk_buff *skb,
1563 struct sk_buff *skb1, const u32 len); 1570 struct sk_buff *skb1, const u32 len);
diff --git a/include/linux/slab.h b/include/linux/slab.h
index f3a8eecd99f3..f62caaad94e0 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -271,5 +271,10 @@ static inline void *kzalloc(size_t size, gfp_t flags)
271 return kmalloc(size, flags | __GFP_ZERO); 271 return kmalloc(size, flags | __GFP_ZERO);
272} 272}
273 273
274#ifdef CONFIG_SLABINFO
275extern const struct seq_operations slabinfo_op;
276ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *);
277#endif
278
274#endif /* __KERNEL__ */ 279#endif /* __KERNEL__ */
275#endif /* _LINUX_SLAB_H */ 280#endif /* _LINUX_SLAB_H */
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
index 32bdc2ffd715..fcc48096ee64 100644
--- a/include/linux/slab_def.h
+++ b/include/linux/slab_def.h
@@ -95,7 +95,4 @@ found:
95 95
96#endif /* CONFIG_NUMA */ 96#endif /* CONFIG_NUMA */
97 97
98extern const struct seq_operations slabinfo_op;
99ssize_t slabinfo_write(struct file *, const char __user *, size_t, loff_t *);
100
101#endif /* _LINUX_SLAB_DEF_H */ 98#endif /* _LINUX_SLAB_DEF_H */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 259a13c3bd98..55232ccf9cfd 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -78,17 +78,20 @@ int on_each_cpu(void (*func) (void *info), void *info, int retry, int wait);
78 */ 78 */
79void smp_prepare_boot_cpu(void); 79void smp_prepare_boot_cpu(void);
80 80
81extern unsigned int setup_max_cpus;
82
81#else /* !SMP */ 83#else /* !SMP */
82 84
83/* 85/*
84 * These macros fold the SMP functionality into a single CPU system 86 * These macros fold the SMP functionality into a single CPU system
85 */ 87 */
86#define raw_smp_processor_id() 0 88#define raw_smp_processor_id() 0
87static inline int up_smp_call_function(void) 89static inline int up_smp_call_function(void (*func)(void *), void *info)
88{ 90{
89 return 0; 91 return 0;
90} 92}
91#define smp_call_function(func,info,retry,wait) (up_smp_call_function()) 93#define smp_call_function(func, info, retry, wait) \
94 (up_smp_call_function(func, info))
92#define on_each_cpu(func,info,retry,wait) \ 95#define on_each_cpu(func,info,retry,wait) \
93 ({ \ 96 ({ \
94 local_irq_disable(); \ 97 local_irq_disable(); \
@@ -107,6 +110,8 @@ static inline void smp_send_reschedule(int cpu) { }
107 local_irq_enable(); \ 110 local_irq_enable(); \
108 0; \ 111 0; \
109}) 112})
113#define smp_call_function_mask(mask, func, info, wait) \
114 (up_smp_call_function(func, info))
110 115
111#endif /* !SMP */ 116#endif /* !SMP */
112 117
diff --git a/include/linux/smp_lock.h b/include/linux/smp_lock.h
index 58962c51dee1..aab3a4cff4e1 100644
--- a/include/linux/smp_lock.h
+++ b/include/linux/smp_lock.h
@@ -17,22 +17,10 @@ extern void __lockfunc __release_kernel_lock(void);
17 __release_kernel_lock(); \ 17 __release_kernel_lock(); \
18} while (0) 18} while (0)
19 19
20/*
21 * Non-SMP kernels will never block on the kernel lock,
22 * so we are better off returning a constant zero from
23 * reacquire_kernel_lock() so that the compiler can see
24 * it at compile-time.
25 */
26#if defined(CONFIG_SMP) && !defined(CONFIG_PREEMPT_BKL)
27# define return_value_on_smp return
28#else
29# define return_value_on_smp
30#endif
31
32static inline int reacquire_kernel_lock(struct task_struct *task) 20static inline int reacquire_kernel_lock(struct task_struct *task)
33{ 21{
34 if (unlikely(task->lock_depth >= 0)) 22 if (unlikely(task->lock_depth >= 0))
35 return_value_on_smp __reacquire_kernel_lock(); 23 return __reacquire_kernel_lock();
36 return 0; 24 return 0;
37} 25}
38 26
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 89f0c2b5f405..5df62ef1280c 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -217,4 +217,36 @@ enum
217 __LINUX_MIB_MAX 217 __LINUX_MIB_MAX
218}; 218};
219 219
220/* linux Xfrm mib definitions */
221enum
222{
223 LINUX_MIB_XFRMNUM = 0,
224 LINUX_MIB_XFRMINERROR, /* XfrmInError */
225 LINUX_MIB_XFRMINBUFFERERROR, /* XfrmInBufferError */
226 LINUX_MIB_XFRMINHDRERROR, /* XfrmInHdrError */
227 LINUX_MIB_XFRMINNOSTATES, /* XfrmInNoStates */
228 LINUX_MIB_XFRMINSTATEPROTOERROR, /* XfrmInStateProtoError */
229 LINUX_MIB_XFRMINSTATEMODEERROR, /* XfrmInStateModeError */
230 LINUX_MIB_XFRMINSTATESEQERROR, /* XfrmInStateSeqError */
231 LINUX_MIB_XFRMINSTATEEXPIRED, /* XfrmInStateExpired */
232 LINUX_MIB_XFRMINSTATEMISMATCH, /* XfrmInStateMismatch */
233 LINUX_MIB_XFRMINSTATEINVALID, /* XfrmInStateInvalid */
234 LINUX_MIB_XFRMINTMPLMISMATCH, /* XfrmInTmplMismatch */
235 LINUX_MIB_XFRMINNOPOLS, /* XfrmInNoPols */
236 LINUX_MIB_XFRMINPOLBLOCK, /* XfrmInPolBlock */
237 LINUX_MIB_XFRMINPOLERROR, /* XfrmInPolError */
238 LINUX_MIB_XFRMOUTERROR, /* XfrmOutError */
239 LINUX_MIB_XFRMOUTBUNDLEGENERROR, /* XfrmOutBundleGenError */
240 LINUX_MIB_XFRMOUTBUNDLECHECKERROR, /* XfrmOutBundleCheckError */
241 LINUX_MIB_XFRMOUTNOSTATES, /* XfrmOutNoStates */
242 LINUX_MIB_XFRMOUTSTATEPROTOERROR, /* XfrmOutStateProtoError */
243 LINUX_MIB_XFRMOUTSTATEMODEERROR, /* XfrmOutStateModeError */
244 LINUX_MIB_XFRMOUTSTATESEQERROR, /* XfrmOutStateSeqError */
245 LINUX_MIB_XFRMOUTSTATEEXPIRED, /* XfrmOutStateExpired */
246 LINUX_MIB_XFRMOUTPOLBLOCK, /* XfrmOutPolBlock */
247 LINUX_MIB_XFRMOUTPOLDEAD, /* XfrmOutPolDead */
248 LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */
249 __LINUX_MIB_XFRMMAX
250};
251
220#endif /* _LINUX_SNMP_H */ 252#endif /* _LINUX_SNMP_H */
diff --git a/include/linux/socket.h b/include/linux/socket.h
index c22ef1c1afb8..bd2b30a74e76 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -24,7 +24,6 @@ struct __kernel_sockaddr_storage {
24#include <linux/types.h> /* pid_t */ 24#include <linux/types.h> /* pid_t */
25#include <linux/compiler.h> /* __user */ 25#include <linux/compiler.h> /* __user */
26 26
27extern int sysctl_somaxconn;
28#ifdef CONFIG_PROC_FS 27#ifdef CONFIG_PROC_FS
29struct seq_file; 28struct seq_file;
30extern void socket_seq_show(struct seq_file *seq); 29extern void socket_seq_show(struct seq_file *seq);
@@ -185,6 +184,7 @@ struct ucred {
185#define AF_PPPOX 24 /* PPPoX sockets */ 184#define AF_PPPOX 24 /* PPPoX sockets */
186#define AF_WANPIPE 25 /* Wanpipe API Sockets */ 185#define AF_WANPIPE 25 /* Wanpipe API Sockets */
187#define AF_LLC 26 /* Linux LLC */ 186#define AF_LLC 26 /* Linux LLC */
187#define AF_CAN 29 /* Controller Area Network */
188#define AF_TIPC 30 /* TIPC sockets */ 188#define AF_TIPC 30 /* TIPC sockets */
189#define AF_BLUETOOTH 31 /* Bluetooth sockets */ 189#define AF_BLUETOOTH 31 /* Bluetooth sockets */
190#define AF_IUCV 32 /* IUCV sockets */ 190#define AF_IUCV 32 /* IUCV sockets */
@@ -220,6 +220,7 @@ struct ucred {
220#define PF_PPPOX AF_PPPOX 220#define PF_PPPOX AF_PPPOX
221#define PF_WANPIPE AF_WANPIPE 221#define PF_WANPIPE AF_WANPIPE
222#define PF_LLC AF_LLC 222#define PF_LLC AF_LLC
223#define PF_CAN AF_CAN
223#define PF_TIPC AF_TIPC 224#define PF_TIPC AF_TIPC
224#define PF_BLUETOOTH AF_BLUETOOTH 225#define PF_BLUETOOTH AF_BLUETOOTH
225#define PF_IUCV AF_IUCV 226#define PF_IUCV AF_IUCV
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index c376f3b36c89..124449733c55 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -120,6 +120,12 @@ do { \
120 120
121#define spin_is_locked(lock) __raw_spin_is_locked(&(lock)->raw_lock) 121#define spin_is_locked(lock) __raw_spin_is_locked(&(lock)->raw_lock)
122 122
123#ifdef CONFIG_GENERIC_LOCKBREAK
124#define spin_is_contended(lock) ((lock)->break_lock)
125#else
126#define spin_is_contended(lock) __raw_spin_is_contended(&(lock)->raw_lock)
127#endif
128
123/** 129/**
124 * spin_unlock_wait - wait until the spinlock gets unlocked 130 * spin_unlock_wait - wait until the spinlock gets unlocked
125 * @lock: the spinlock in question. 131 * @lock: the spinlock in question.
diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h
index f6a3a951b79e..68d88f71f1a2 100644
--- a/include/linux/spinlock_types.h
+++ b/include/linux/spinlock_types.h
@@ -19,7 +19,7 @@
19 19
20typedef struct { 20typedef struct {
21 raw_spinlock_t raw_lock; 21 raw_spinlock_t raw_lock;
22#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP) 22#ifdef CONFIG_GENERIC_LOCKBREAK
23 unsigned int break_lock; 23 unsigned int break_lock;
24#endif 24#endif
25#ifdef CONFIG_DEBUG_SPINLOCK 25#ifdef CONFIG_DEBUG_SPINLOCK
@@ -35,7 +35,7 @@ typedef struct {
35 35
36typedef struct { 36typedef struct {
37 raw_rwlock_t raw_lock; 37 raw_rwlock_t raw_lock;
38#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP) 38#ifdef CONFIG_GENERIC_LOCKBREAK
39 unsigned int break_lock; 39 unsigned int break_lock;
40#endif 40#endif
41#ifdef CONFIG_DEBUG_SPINLOCK 41#ifdef CONFIG_DEBUG_SPINLOCK
diff --git a/include/linux/spinlock_up.h b/include/linux/spinlock_up.h
index ea54c4c9a4ec..938234c4a996 100644
--- a/include/linux/spinlock_up.h
+++ b/include/linux/spinlock_up.h
@@ -64,6 +64,8 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock)
64# define __raw_spin_trylock(lock) ({ (void)(lock); 1; }) 64# define __raw_spin_trylock(lock) ({ (void)(lock); 1; })
65#endif /* DEBUG_SPINLOCK */ 65#endif /* DEBUG_SPINLOCK */
66 66
67#define __raw_spin_is_contended(lock) (((void)(lock), 0))
68
67#define __raw_read_can_lock(lock) (((void)(lock), 1)) 69#define __raw_read_can_lock(lock) (((void)(lock), 1))
68#define __raw_write_can_lock(lock) (((void)(lock), 1)) 70#define __raw_write_can_lock(lock) (((void)(lock), 1))
69 71
diff --git a/include/linux/splice.h b/include/linux/splice.h
index 33e447f98a54..528dcb93c2f2 100644
--- a/include/linux/splice.h
+++ b/include/linux/splice.h
@@ -53,6 +53,7 @@ struct splice_pipe_desc {
53 int nr_pages; /* number of pages in map */ 53 int nr_pages; /* number of pages in map */
54 unsigned int flags; /* splice flags */ 54 unsigned int flags; /* splice flags */
55 const struct pipe_buf_operations *ops;/* ops associated with output pipe */ 55 const struct pipe_buf_operations *ops;/* ops associated with output pipe */
56 void (*spd_release)(struct splice_pipe_desc *, unsigned int);
56}; 57};
57 58
58typedef int (splice_actor)(struct pipe_inode_info *, struct pipe_buffer *, 59typedef int (splice_actor)(struct pipe_inode_info *, struct pipe_buffer *,
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 2b5c312c4960..e18f5c23b930 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -15,22 +15,19 @@ struct pcmcia_device;
15struct ssb_bus; 15struct ssb_bus;
16struct ssb_driver; 16struct ssb_driver;
17 17
18 18struct ssb_sprom {
19struct ssb_sprom_r1 { 19 u8 revision;
20 u16 pci_spid; /* Subsystem Product ID for PCI */
21 u16 pci_svid; /* Subsystem Vendor ID for PCI */
22 u16 pci_pid; /* Product ID for PCI */
23 u8 il0mac[6]; /* MAC address for 802.11b/g */ 20 u8 il0mac[6]; /* MAC address for 802.11b/g */
24 u8 et0mac[6]; /* MAC address for Ethernet */ 21 u8 et0mac[6]; /* MAC address for Ethernet */
25 u8 et1mac[6]; /* MAC address for 802.11a */ 22 u8 et1mac[6]; /* MAC address for 802.11a */
26 u8 et0phyaddr:5; /* MII address for enet0 */ 23 u8 et0phyaddr; /* MII address for enet0 */
27 u8 et1phyaddr:5; /* MII address for enet1 */ 24 u8 et1phyaddr; /* MII address for enet1 */
28 u8 et0mdcport:1; /* MDIO for enet0 */ 25 u8 et0mdcport; /* MDIO for enet0 */
29 u8 et1mdcport:1; /* MDIO for enet1 */ 26 u8 et1mdcport; /* MDIO for enet1 */
30 u8 board_rev; /* Board revision */ 27 u8 board_rev; /* Board revision number from SPROM. */
31 u8 country_code:4; /* Country Code */ 28 u8 country_code; /* Country Code */
32 u8 antenna_a:2; /* Antenna 0/1 available for A-PHY */ 29 u8 ant_available_a; /* A-PHY antenna available bits (up to 4) */
33 u8 antenna_bg:2; /* Antenna 0/1 available for B-PHY and G-PHY */ 30 u8 ant_available_bg; /* B/G-PHY antenna available bits (up to 4) */
34 u16 pa0b0; 31 u16 pa0b0;
35 u16 pa0b1; 32 u16 pa0b1;
36 u16 pa0b2; 33 u16 pa0b2;
@@ -41,61 +38,26 @@ struct ssb_sprom_r1 {
41 u8 gpio1; /* GPIO pin 1 */ 38 u8 gpio1; /* GPIO pin 1 */
42 u8 gpio2; /* GPIO pin 2 */ 39 u8 gpio2; /* GPIO pin 2 */
43 u8 gpio3; /* GPIO pin 3 */ 40 u8 gpio3; /* GPIO pin 3 */
44 u16 maxpwr_a; /* A-PHY Power Amplifier Max Power (in dBm Q5.2) */ 41 u16 maxpwr_a; /* A-PHY Amplifier Max Power (in dBm Q5.2) */
45 u16 maxpwr_bg; /* B/G-PHY Power Amplifier Max Power (in dBm Q5.2) */ 42 u16 maxpwr_bg; /* B/G-PHY Amplifier Max Power (in dBm Q5.2) */
46 u8 itssi_a; /* Idle TSSI Target for A-PHY */ 43 u8 itssi_a; /* Idle TSSI Target for A-PHY */
47 u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */ 44 u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */
48 u16 boardflags_lo; /* Boardflags (low 16 bits) */ 45 u16 boardflags_lo; /* Boardflags (low 16 bits) */
49 u8 antenna_gain_a; /* A-PHY Antenna gain (in dBm Q5.2) */
50 u8 antenna_gain_bg; /* B/G-PHY Antenna gain (in dBm Q5.2) */
51 u8 oem[8]; /* OEM string (rev 1 only) */
52};
53
54struct ssb_sprom_r2 {
55 u16 boardflags_hi; /* Boardflags (high 16 bits) */ 46 u16 boardflags_hi; /* Boardflags (high 16 bits) */
56 u8 maxpwr_a_lo; /* A-PHY Max Power Low */
57 u8 maxpwr_a_hi; /* A-PHY Max Power High */
58 u16 pa1lob0; /* A-PHY PA Low Settings */
59 u16 pa1lob1; /* A-PHY PA Low Settings */
60 u16 pa1lob2; /* A-PHY PA Low Settings */
61 u16 pa1hib0; /* A-PHY PA High Settings */
62 u16 pa1hib1; /* A-PHY PA High Settings */
63 u16 pa1hib2; /* A-PHY PA High Settings */
64 u8 ofdm_pwr_off; /* OFDM Power Offset from CCK Level */
65 u8 country_str[2]; /* Two char Country Code */
66};
67
68struct ssb_sprom_r3 {
69 u32 ofdmapo; /* A-PHY OFDM Mid Power Offset */
70 u32 ofdmalpo; /* A-PHY OFDM Low Power Offset */
71 u32 ofdmahpo; /* A-PHY OFDM High Power Offset */
72 u8 gpioldc_on_cnt; /* GPIO LED Powersave Duty Cycle ON count */
73 u8 gpioldc_off_cnt; /* GPIO LED Powersave Duty Cycle OFF count */
74 u8 cckpo_1M:4; /* CCK Power Offset for Rate 1M */
75 u8 cckpo_2M:4; /* CCK Power Offset for Rate 2M */
76 u8 cckpo_55M:4; /* CCK Power Offset for Rate 5.5M */
77 u8 cckpo_11M:4; /* CCK Power Offset for Rate 11M */
78 u32 ofdmgpo; /* G-PHY OFDM Power Offset */
79};
80
81struct ssb_sprom_r4 {
82 /* TODO */
83};
84 47
85struct ssb_sprom { 48 /* Antenna gain values for up to 4 antennas
86 u8 revision; 49 * on each band. Values in dBm/4 (Q5.2). Negative gain means the
87 u8 crc; 50 * loss in the connectors is bigger than the gain. */
88 /* The valid r# fields are selected by the "revision". 51 struct {
89 * Revision 3 and lower inherit from lower revisions.
90 */
91 union {
92 struct { 52 struct {
93 struct ssb_sprom_r1 r1; 53 s8 a0, a1, a2, a3;
94 struct ssb_sprom_r2 r2; 54 } ghz24; /* 2.4GHz band */
95 struct ssb_sprom_r3 r3; 55 struct {
96 }; 56 s8 a0, a1, a2, a3;
97 struct ssb_sprom_r4 r4; 57 } ghz5; /* 5GHz band */
98 }; 58 } antenna_gain;
59
60 /* TODO - add any parameters needed from rev 2, 3, or 4 SPROMs */
99}; 61};
100 62
101/* Information about the PCB the circuitry is soldered on. */ 63/* Information about the PCB the circuitry is soldered on. */
@@ -270,7 +232,8 @@ struct ssb_bus {
270 struct ssb_device *mapped_device; 232 struct ssb_device *mapped_device;
271 /* Currently mapped PCMCIA segment. (bustype == SSB_BUSTYPE_PCMCIA only) */ 233 /* Currently mapped PCMCIA segment. (bustype == SSB_BUSTYPE_PCMCIA only) */
272 u8 mapped_pcmcia_seg; 234 u8 mapped_pcmcia_seg;
273 /* Lock for core and segment switching. */ 235 /* Lock for core and segment switching.
236 * On PCMCIA-host busses this is used to protect the whole MMIO access. */
274 spinlock_t bar_lock; 237 spinlock_t bar_lock;
275 238
276 /* The bus this backplane is running on. */ 239 /* The bus this backplane is running on. */
@@ -288,6 +251,7 @@ struct ssb_bus {
288 /* ID information about the Chip. */ 251 /* ID information about the Chip. */
289 u16 chip_id; 252 u16 chip_id;
290 u16 chip_rev; 253 u16 chip_rev;
254 u16 sprom_size; /* number of words in sprom */
291 u8 chip_package; 255 u8 chip_package;
292 256
293 /* List of devices (cores) on the backplane. */ 257 /* List of devices (cores) on the backplane. */
@@ -402,6 +366,13 @@ static inline void ssb_pcihost_unregister(struct pci_driver *driver)
402{ 366{
403 pci_unregister_driver(driver); 367 pci_unregister_driver(driver);
404} 368}
369
370static inline
371void ssb_pcihost_set_power_state(struct ssb_device *sdev, pci_power_t state)
372{
373 if (sdev->bus->bustype == SSB_BUSTYPE_PCI)
374 pci_set_power_state(sdev->bus->host_pci, state);
375}
405#endif /* CONFIG_SSB_PCIHOST */ 376#endif /* CONFIG_SSB_PCIHOST */
406 377
407 378
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 47c7c71a5acf..ebad0bac9801 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -147,6 +147,10 @@
147#define SSB_IDLOW_SSBREV 0xF0000000 /* Sonics Backplane Revision code */ 147#define SSB_IDLOW_SSBREV 0xF0000000 /* Sonics Backplane Revision code */
148#define SSB_IDLOW_SSBREV_22 0x00000000 /* <= 2.2 */ 148#define SSB_IDLOW_SSBREV_22 0x00000000 /* <= 2.2 */
149#define SSB_IDLOW_SSBREV_23 0x10000000 /* 2.3 */ 149#define SSB_IDLOW_SSBREV_23 0x10000000 /* 2.3 */
150#define SSB_IDLOW_SSBREV_24 0x40000000 /* ?? Found in BCM4328 */
151#define SSB_IDLOW_SSBREV_25 0x50000000 /* ?? Not Found yet */
152#define SSB_IDLOW_SSBREV_26 0x60000000 /* ?? Found in some BCM4311/2 */
153#define SSB_IDLOW_SSBREV_27 0x70000000 /* ?? Found in some BCM4311/2 */
150#define SSB_IDHIGH 0x0FFC /* SB Identification High */ 154#define SSB_IDHIGH 0x0FFC /* SB Identification High */
151#define SSB_IDHIGH_RCLO 0x0000000F /* Revision Code (low part) */ 155#define SSB_IDHIGH_RCLO 0x0000000F /* Revision Code (low part) */
152#define SSB_IDHIGH_CC 0x00008FF0 /* Core Code */ 156#define SSB_IDHIGH_CC 0x00008FF0 /* Core Code */
@@ -162,11 +166,16 @@
162 */ 166 */
163#define SSB_SPROMSIZE_WORDS 64 167#define SSB_SPROMSIZE_WORDS 64
164#define SSB_SPROMSIZE_BYTES (SSB_SPROMSIZE_WORDS * sizeof(u16)) 168#define SSB_SPROMSIZE_BYTES (SSB_SPROMSIZE_WORDS * sizeof(u16))
169#define SSB_SPROMSIZE_WORDS_R123 64
170#define SSB_SPROMSIZE_WORDS_R4 220
171#define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16))
172#define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16))
165#define SSB_SPROM_BASE 0x1000 173#define SSB_SPROM_BASE 0x1000
166#define SSB_SPROM_REVISION 0x107E 174#define SSB_SPROM_REVISION 0x107E
167#define SSB_SPROM_REVISION_REV 0x00FF /* SPROM Revision number */ 175#define SSB_SPROM_REVISION_REV 0x00FF /* SPROM Revision number */
168#define SSB_SPROM_REVISION_CRC 0xFF00 /* SPROM CRC8 value */ 176#define SSB_SPROM_REVISION_CRC 0xFF00 /* SPROM CRC8 value */
169#define SSB_SPROM_REVISION_CRC_SHIFT 8 177#define SSB_SPROM_REVISION_CRC_SHIFT 8
178
170/* SPROM Revision 1 */ 179/* SPROM Revision 1 */
171#define SSB_SPROM1_SPID 0x1004 /* Subsystem Product ID for PCI */ 180#define SSB_SPROM1_SPID 0x1004 /* Subsystem Product ID for PCI */
172#define SSB_SPROM1_SVID 0x1006 /* Subsystem Vendor ID for PCI */ 181#define SSB_SPROM1_SVID 0x1006 /* Subsystem Vendor ID for PCI */
@@ -184,10 +193,10 @@
184#define SSB_SPROM1_BINF_BREV 0x00FF /* Board Revision */ 193#define SSB_SPROM1_BINF_BREV 0x00FF /* Board Revision */
185#define SSB_SPROM1_BINF_CCODE 0x0F00 /* Country Code */ 194#define SSB_SPROM1_BINF_CCODE 0x0F00 /* Country Code */
186#define SSB_SPROM1_BINF_CCODE_SHIFT 8 195#define SSB_SPROM1_BINF_CCODE_SHIFT 8
187#define SSB_SPROM1_BINF_ANTA 0x3000 /* Available A-PHY antennas */ 196#define SSB_SPROM1_BINF_ANTBG 0x3000 /* Available B-PHY and G-PHY antennas */
188#define SSB_SPROM1_BINF_ANTA_SHIFT 12 197#define SSB_SPROM1_BINF_ANTBG_SHIFT 12
189#define SSB_SPROM1_BINF_ANTBG 0xC000 /* Available B-PHY antennas */ 198#define SSB_SPROM1_BINF_ANTA 0xC000 /* Available A-PHY antennas */
190#define SSB_SPROM1_BINF_ANTBG_SHIFT 14 199#define SSB_SPROM1_BINF_ANTA_SHIFT 14
191#define SSB_SPROM1_PA0B0 0x105E 200#define SSB_SPROM1_PA0B0 0x105E
192#define SSB_SPROM1_PA0B1 0x1060 201#define SSB_SPROM1_PA0B1 0x1060
193#define SSB_SPROM1_PA0B2 0x1062 202#define SSB_SPROM1_PA0B2 0x1062
@@ -212,10 +221,11 @@
212#define SSB_SPROM1_ITSSI_A_SHIFT 8 221#define SSB_SPROM1_ITSSI_A_SHIFT 8
213#define SSB_SPROM1_BFLLO 0x1072 /* Boardflags (low 16 bits) */ 222#define SSB_SPROM1_BFLLO 0x1072 /* Boardflags (low 16 bits) */
214#define SSB_SPROM1_AGAIN 0x1074 /* Antenna Gain (in dBm Q5.2) */ 223#define SSB_SPROM1_AGAIN 0x1074 /* Antenna Gain (in dBm Q5.2) */
215#define SSB_SPROM1_AGAIN_A 0x00FF /* A-PHY */ 224#define SSB_SPROM1_AGAIN_BG 0x00FF /* B-PHY and G-PHY */
216#define SSB_SPROM1_AGAIN_BG 0xFF00 /* B-PHY and G-PHY */ 225#define SSB_SPROM1_AGAIN_BG_SHIFT 0
217#define SSB_SPROM1_AGAIN_BG_SHIFT 8 226#define SSB_SPROM1_AGAIN_A 0xFF00 /* A-PHY */
218#define SSB_SPROM1_OEM 0x1076 /* 8 bytes OEM string (rev 1 only) */ 227#define SSB_SPROM1_AGAIN_A_SHIFT 8
228
219/* SPROM Revision 2 (inherits from rev 1) */ 229/* SPROM Revision 2 (inherits from rev 1) */
220#define SSB_SPROM2_BFLHI 0x1038 /* Boardflags (high 16 bits) */ 230#define SSB_SPROM2_BFLHI 0x1038 /* Boardflags (high 16 bits) */
221#define SSB_SPROM2_MAXP_A 0x103A /* A-PHY Max Power */ 231#define SSB_SPROM2_MAXP_A 0x103A /* A-PHY Max Power */
@@ -232,7 +242,11 @@
232#define SSB_SPROM2_OPO_VALUE 0x00FF 242#define SSB_SPROM2_OPO_VALUE 0x00FF
233#define SSB_SPROM2_OPO_UNUSED 0xFF00 243#define SSB_SPROM2_OPO_UNUSED 0xFF00
234#define SSB_SPROM2_CCODE 0x107C /* Two char Country Code */ 244#define SSB_SPROM2_CCODE 0x107C /* Two char Country Code */
235/* SPROM Revision 3 (inherits from rev 2) */ 245
246/* SPROM Revision 3 (inherits most data from rev 2) */
247#define SSB_SPROM3_IL0MAC 0x104A /* 6 bytes MAC address for 802.11b/g */
248#define SSB_SPROM3_ET0MAC 0x1050 /* 6 bytes MAC address for Ethernet ?? */
249#define SSB_SPROM3_ET1MAC 0x1050 /* 6 bytes MAC address for 802.11a ?? */
236#define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */ 250#define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */
237#define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */ 251#define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */
238#define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */ 252#define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */
@@ -251,6 +265,57 @@
251#define SSB_SPROM3_CCKPO_11M_SHIFT 12 265#define SSB_SPROM3_CCKPO_11M_SHIFT 12
252#define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */ 266#define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */
253 267
268/* SPROM Revision 4 */
269#define SSB_SPROM4_IL0MAC 0x104C /* 6 byte MAC address for a/b/g/n */
270#define SSB_SPROM4_ET0MAC 0x1018 /* 6 bytes MAC address for Ethernet ?? */
271#define SSB_SPROM4_ET1MAC 0x1018 /* 6 bytes MAC address for 802.11a ?? */
272#define SSB_SPROM4_ETHPHY 0x105A /* Ethernet PHY settings ?? */
273#define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */
274#define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */
275#define SSB_SPROM4_ETHPHY_ET1A_SHIFT 5
276#define SSB_SPROM4_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */
277#define SSB_SPROM4_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */
278#define SSB_SPROM4_CCODE 0x1052 /* Country Code (2 bytes) */
279#define SSB_SPROM4_ANTAVAIL 0x105D /* Antenna available bitfields */
280#define SSB_SPROM4_ANTAVAIL_A 0x00FF /* A-PHY bitfield */
281#define SSB_SPROM4_ANTAVAIL_A_SHIFT 0
282#define SSB_SPROM4_ANTAVAIL_BG 0xFF00 /* B-PHY and G-PHY bitfield */
283#define SSB_SPROM4_ANTAVAIL_BG_SHIFT 8
284#define SSB_SPROM4_BFLLO 0x1044 /* Boardflags (low 16 bits) */
285#define SSB_SPROM4_AGAIN01 0x105E /* Antenna Gain (in dBm Q5.2) */
286#define SSB_SPROM4_AGAIN0 0x00FF /* Antenna 0 */
287#define SSB_SPROM4_AGAIN0_SHIFT 0
288#define SSB_SPROM4_AGAIN1 0xFF00 /* Antenna 1 */
289#define SSB_SPROM4_AGAIN1_SHIFT 8
290#define SSB_SPROM4_AGAIN23 0x1060
291#define SSB_SPROM4_AGAIN2 0x00FF /* Antenna 2 */
292#define SSB_SPROM4_AGAIN2_SHIFT 0
293#define SSB_SPROM4_AGAIN3 0xFF00 /* Antenna 3 */
294#define SSB_SPROM4_AGAIN3_SHIFT 8
295#define SSB_SPROM4_BFLHI 0x1046 /* Board Flags Hi */
296#define SSB_SPROM4_MAXP_BG 0x1080 /* Max Power BG in path 1 */
297#define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */
298#define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
299#define SSB_SPROM4_ITSSI_BG_SHIFT 8
300#define SSB_SPROM4_MAXP_A 0x108A /* Max Power A in path 1 */
301#define SSB_SPROM4_MAXP_A_MASK 0x00FF /* Mask for Max Power A */
302#define SSB_SPROM4_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */
303#define SSB_SPROM4_ITSSI_A_SHIFT 8
304#define SSB_SPROM4_GPIOA 0x1056 /* Gen. Purpose IO # 0 and 1 */
305#define SSB_SPROM4_GPIOA_P0 0x00FF /* Pin 0 */
306#define SSB_SPROM4_GPIOA_P1 0xFF00 /* Pin 1 */
307#define SSB_SPROM4_GPIOA_P1_SHIFT 8
308#define SSB_SPROM4_GPIOB 0x1058 /* Gen. Purpose IO # 2 and 3 */
309#define SSB_SPROM4_GPIOB_P2 0x00FF /* Pin 2 */
310#define SSB_SPROM4_GPIOB_P3 0xFF00 /* Pin 3 */
311#define SSB_SPROM4_GPIOB_P3_SHIFT 8
312#define SSB_SPROM4_PA0B0 0x1082 /* The paXbY locations are */
313#define SSB_SPROM4_PA0B1 0x1084 /* only guesses */
314#define SSB_SPROM4_PA0B2 0x1086
315#define SSB_SPROM4_PA1B0 0x108E
316#define SSB_SPROM4_PA1B1 0x1090
317#define SSB_SPROM4_PA1B2 0x1092
318
254/* Values for SSB_SPROM1_BINF_CCODE */ 319/* Values for SSB_SPROM1_BINF_CCODE */
255enum { 320enum {
256 SSB_SPROM1CCODE_WORLD = 0, 321 SSB_SPROM1CCODE_WORLD = 0,
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
index e7fa657d0c49..5da9794b2d78 100644
--- a/include/linux/stacktrace.h
+++ b/include/linux/stacktrace.h
@@ -9,10 +9,13 @@ struct stack_trace {
9}; 9};
10 10
11extern void save_stack_trace(struct stack_trace *trace); 11extern void save_stack_trace(struct stack_trace *trace);
12extern void save_stack_trace_tsk(struct task_struct *tsk,
13 struct stack_trace *trace);
12 14
13extern void print_stack_trace(struct stack_trace *trace, int spaces); 15extern void print_stack_trace(struct stack_trace *trace, int spaces);
14#else 16#else
15# define save_stack_trace(trace) do { } while (0) 17# define save_stack_trace(trace) do { } while (0)
18# define save_stack_trace_tsk(tsk, trace) do { } while (0)
16# define print_stack_trace(trace, spaces) do { } while (0) 19# define print_stack_trace(trace, spaces) do { } while (0)
17#endif 20#endif
18 21
diff --git a/include/linux/string.h b/include/linux/string.h
index 836062b7582a..c5d3fcad7b57 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -3,16 +3,14 @@
3 3
4/* We don't want strings.h stuff being user by user stuff by accident */ 4/* We don't want strings.h stuff being user by user stuff by accident */
5 5
6#ifdef __KERNEL__ 6#ifndef __KERNEL__
7#include <string.h>
8#else
7 9
8#include <linux/compiler.h> /* for inline */ 10#include <linux/compiler.h> /* for inline */
9#include <linux/types.h> /* for size_t */ 11#include <linux/types.h> /* for size_t */
10#include <linux/stddef.h> /* for NULL */ 12#include <linux/stddef.h> /* for NULL */
11 13
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16extern char *strndup_user(const char __user *, long); 14extern char *strndup_user(const char __user *, long);
17 15
18/* 16/*
@@ -111,9 +109,5 @@ extern void *kmemdup(const void *src, size_t len, gfp_t gfp);
111extern char **argv_split(gfp_t gfp, const char *str, int *argcp); 109extern char **argv_split(gfp_t gfp, const char *str, int *argcp);
112extern void argv_free(char **argv); 110extern void argv_free(char **argv);
113 111
114#ifdef __cplusplus
115}
116#endif
117
118#endif 112#endif
119#endif /* _LINUX_STRING_H_ */ 113#endif /* _LINUX_STRING_H_ */
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index bd7a6b0a87af..03547d6abee5 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -169,8 +169,8 @@ extern int cache_check(struct cache_detail *detail,
169extern void cache_flush(void); 169extern void cache_flush(void);
170extern void cache_purge(struct cache_detail *detail); 170extern void cache_purge(struct cache_detail *detail);
171#define NEVER (0x7FFFFFFF) 171#define NEVER (0x7FFFFFFF)
172extern void cache_register(struct cache_detail *cd); 172extern int cache_register(struct cache_detail *cd);
173extern int cache_unregister(struct cache_detail *cd); 173extern void cache_unregister(struct cache_detail *cd);
174 174
175extern void qword_add(char **bpp, int *lp, char *str); 175extern void qword_add(char **bpp, int *lp, char *str);
176extern void qword_addhex(char **bpp, int *lp, char *buf, int blen); 176extern void qword_addhex(char **bpp, int *lp, char *buf, int blen);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index d9d5c5ad826c..129a86e25d29 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -41,11 +41,11 @@ struct rpc_clnt {
41 struct rpc_iostats * cl_metrics; /* per-client statistics */ 41 struct rpc_iostats * cl_metrics; /* per-client statistics */
42 42
43 unsigned int cl_softrtry : 1,/* soft timeouts */ 43 unsigned int cl_softrtry : 1,/* soft timeouts */
44 cl_intr : 1,/* interruptible */
45 cl_discrtry : 1,/* disconnect before retry */ 44 cl_discrtry : 1,/* disconnect before retry */
46 cl_autobind : 1;/* use getport() */ 45 cl_autobind : 1;/* use getport() */
47 46
48 struct rpc_rtt * cl_rtt; /* RTO estimator data */ 47 struct rpc_rtt * cl_rtt; /* RTO estimator data */
48 const struct rpc_timeout *cl_timeout; /* Timeout strategy */
49 49
50 int cl_nodelen; /* nodename length */ 50 int cl_nodelen; /* nodename length */
51 char cl_nodename[UNX_MAXNODENAME]; 51 char cl_nodename[UNX_MAXNODENAME];
@@ -54,6 +54,7 @@ struct rpc_clnt {
54 struct dentry * cl_dentry; /* inode */ 54 struct dentry * cl_dentry; /* inode */
55 struct rpc_clnt * cl_parent; /* Points to parent of clones */ 55 struct rpc_clnt * cl_parent; /* Points to parent of clones */
56 struct rpc_rtt cl_rtt_default; 56 struct rpc_rtt cl_rtt_default;
57 struct rpc_timeout cl_timeout_default;
57 struct rpc_program * cl_program; 58 struct rpc_program * cl_program;
58 char cl_inline_name[32]; 59 char cl_inline_name[32];
59}; 60};
@@ -99,7 +100,7 @@ struct rpc_create_args {
99 struct sockaddr *address; 100 struct sockaddr *address;
100 size_t addrsize; 101 size_t addrsize;
101 struct sockaddr *saddress; 102 struct sockaddr *saddress;
102 struct rpc_timeout *timeout; 103 const struct rpc_timeout *timeout;
103 char *servername; 104 char *servername;
104 struct rpc_program *program; 105 struct rpc_program *program;
105 u32 version; 106 u32 version;
@@ -109,7 +110,6 @@ struct rpc_create_args {
109 110
110/* Values for "flags" field */ 111/* Values for "flags" field */
111#define RPC_CLNT_CREATE_HARDRTRY (1UL << 0) 112#define RPC_CLNT_CREATE_HARDRTRY (1UL << 0)
112#define RPC_CLNT_CREATE_INTR (1UL << 1)
113#define RPC_CLNT_CREATE_AUTOBIND (1UL << 2) 113#define RPC_CLNT_CREATE_AUTOBIND (1UL << 2)
114#define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 3) 114#define RPC_CLNT_CREATE_NONPRIVPORT (1UL << 3)
115#define RPC_CLNT_CREATE_NOPING (1UL << 4) 115#define RPC_CLNT_CREATE_NOPING (1UL << 4)
@@ -123,11 +123,10 @@ void rpc_shutdown_client(struct rpc_clnt *);
123void rpc_release_client(struct rpc_clnt *); 123void rpc_release_client(struct rpc_clnt *);
124 124
125int rpcb_register(u32, u32, int, unsigned short, int *); 125int rpcb_register(u32, u32, int, unsigned short, int *);
126int rpcb_getport_sync(struct sockaddr_in *, __u32, __u32, int); 126int rpcb_getport_sync(struct sockaddr_in *, u32, u32, int);
127void rpcb_getport_async(struct rpc_task *); 127void rpcb_getport_async(struct rpc_task *);
128 128
129void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); 129void rpc_call_start(struct rpc_task *);
130
131int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, 130int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg,
132 int flags, const struct rpc_call_ops *tk_ops, 131 int flags, const struct rpc_call_ops *tk_ops,
133 void *calldata); 132 void *calldata);
@@ -136,13 +135,11 @@ int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg,
136struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, 135struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred,
137 int flags); 136 int flags);
138void rpc_restart_call(struct rpc_task *); 137void rpc_restart_call(struct rpc_task *);
139void rpc_clnt_sigmask(struct rpc_clnt *clnt, sigset_t *oldset);
140void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset);
141void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); 138void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int);
142size_t rpc_max_payload(struct rpc_clnt *); 139size_t rpc_max_payload(struct rpc_clnt *);
143void rpc_force_rebind(struct rpc_clnt *); 140void rpc_force_rebind(struct rpc_clnt *);
144size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t); 141size_t rpc_peeraddr(struct rpc_clnt *, struct sockaddr *, size_t);
145char * rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t); 142const char *rpc_peeraddr2str(struct rpc_clnt *, enum rpc_display_format_t);
146 143
147#endif /* __KERNEL__ */ 144#endif /* __KERNEL__ */
148#endif /* _LINUX_SUNRPC_CLNT_H */ 145#endif /* _LINUX_SUNRPC_CLNT_H */
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index 3347c72b848a..10709cbe96fd 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -20,7 +20,7 @@
20#define RPCDBG_BIND 0x0020 20#define RPCDBG_BIND 0x0020
21#define RPCDBG_SCHED 0x0040 21#define RPCDBG_SCHED 0x0040
22#define RPCDBG_TRANS 0x0080 22#define RPCDBG_TRANS 0x0080
23#define RPCDBG_SVCSOCK 0x0100 23#define RPCDBG_SVCXPRT 0x0100
24#define RPCDBG_SVCDSP 0x0200 24#define RPCDBG_SVCDSP 0x0200
25#define RPCDBG_MISC 0x0400 25#define RPCDBG_MISC 0x0400
26#define RPCDBG_CACHE 0x0800 26#define RPCDBG_CACHE 0x0800
@@ -88,11 +88,6 @@ enum {
88 CTL_SLOTTABLE_TCP, 88 CTL_SLOTTABLE_TCP,
89 CTL_MIN_RESVPORT, 89 CTL_MIN_RESVPORT,
90 CTL_MAX_RESVPORT, 90 CTL_MAX_RESVPORT,
91 CTL_SLOTTABLE_RDMA,
92 CTL_RDMA_MAXINLINEREAD,
93 CTL_RDMA_MAXINLINEWRITE,
94 CTL_RDMA_WRITEPADDING,
95 CTL_RDMA_MEMREG,
96}; 91};
97 92
98#endif /* _LINUX_SUNRPC_DEBUG_H_ */ 93#endif /* _LINUX_SUNRPC_DEBUG_H_ */
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
index c4beb5775111..70df4f1d8847 100644
--- a/include/linux/sunrpc/msg_prot.h
+++ b/include/linux/sunrpc/msg_prot.h
@@ -152,5 +152,44 @@ typedef __be32 rpc_fraghdr;
152 */ 152 */
153#define RPCBIND_MAXNETIDLEN (4u) 153#define RPCBIND_MAXNETIDLEN (4u)
154 154
155/*
156 * Universal addresses are introduced in RFC 1833 and further spelled
157 * out in RFC 3530. RPCBIND_MAXUADDRLEN defines a maximum byte length
158 * of a universal address for use in allocating buffers and character
159 * arrays.
160 *
161 * Quoting RFC 3530, section 2.2:
162 *
163 * For TCP over IPv4 and for UDP over IPv4, the format of r_addr is the
164 * US-ASCII string:
165 *
166 * h1.h2.h3.h4.p1.p2
167 *
168 * The prefix, "h1.h2.h3.h4", is the standard textual form for
169 * representing an IPv4 address, which is always four octets long.
170 * Assuming big-endian ordering, h1, h2, h3, and h4, are respectively,
171 * the first through fourth octets each converted to ASCII-decimal.
172 * Assuming big-endian ordering, p1 and p2 are, respectively, the first
173 * and second octets each converted to ASCII-decimal. For example, if a
174 * host, in big-endian order, has an address of 0x0A010307 and there is
175 * a service listening on, in big endian order, port 0x020F (decimal
176 * 527), then the complete universal address is "10.1.3.7.2.15".
177 *
178 * ...
179 *
180 * For TCP over IPv6 and for UDP over IPv6, the format of r_addr is the
181 * US-ASCII string:
182 *
183 * x1:x2:x3:x4:x5:x6:x7:x8.p1.p2
184 *
185 * The suffix "p1.p2" is the service port, and is computed the same way
186 * as with universal addresses for TCP and UDP over IPv4. The prefix,
187 * "x1:x2:x3:x4:x5:x6:x7:x8", is the standard textual form for
188 * representing an IPv6 address as defined in Section 2.2 of [RFC2373].
189 * Additionally, the two alternative forms specified in Section 2.2 of
190 * [RFC2373] are also acceptable.
191 */
192#define RPCBIND_MAXUADDRLEN (56u)
193
155#endif /* __KERNEL__ */ 194#endif /* __KERNEL__ */
156#endif /* _LINUX_SUNRPC_MSGPROT_H_ */ 195#endif /* _LINUX_SUNRPC_MSGPROT_H_ */
diff --git a/include/linux/sunrpc/rpc_rdma.h b/include/linux/sunrpc/rpc_rdma.h
index 0013a0d8dc6b..87b895d5c786 100644
--- a/include/linux/sunrpc/rpc_rdma.h
+++ b/include/linux/sunrpc/rpc_rdma.h
@@ -41,17 +41,17 @@
41#define _LINUX_SUNRPC_RPC_RDMA_H 41#define _LINUX_SUNRPC_RPC_RDMA_H
42 42
43struct rpcrdma_segment { 43struct rpcrdma_segment {
44 uint32_t rs_handle; /* Registered memory handle */ 44 __be32 rs_handle; /* Registered memory handle */
45 uint32_t rs_length; /* Length of the chunk in bytes */ 45 __be32 rs_length; /* Length of the chunk in bytes */
46 uint64_t rs_offset; /* Chunk virtual address or offset */ 46 __be64 rs_offset; /* Chunk virtual address or offset */
47}; 47};
48 48
49/* 49/*
50 * read chunk(s), encoded as a linked list. 50 * read chunk(s), encoded as a linked list.
51 */ 51 */
52struct rpcrdma_read_chunk { 52struct rpcrdma_read_chunk {
53 uint32_t rc_discrim; /* 1 indicates presence */ 53 __be32 rc_discrim; /* 1 indicates presence */
54 uint32_t rc_position; /* Position in XDR stream */ 54 __be32 rc_position; /* Position in XDR stream */
55 struct rpcrdma_segment rc_target; 55 struct rpcrdma_segment rc_target;
56}; 56};
57 57
@@ -66,29 +66,29 @@ struct rpcrdma_write_chunk {
66 * write chunk(s), encoded as a counted array. 66 * write chunk(s), encoded as a counted array.
67 */ 67 */
68struct rpcrdma_write_array { 68struct rpcrdma_write_array {
69 uint32_t wc_discrim; /* 1 indicates presence */ 69 __be32 wc_discrim; /* 1 indicates presence */
70 uint32_t wc_nchunks; /* Array count */ 70 __be32 wc_nchunks; /* Array count */
71 struct rpcrdma_write_chunk wc_array[0]; 71 struct rpcrdma_write_chunk wc_array[0];
72}; 72};
73 73
74struct rpcrdma_msg { 74struct rpcrdma_msg {
75 uint32_t rm_xid; /* Mirrors the RPC header xid */ 75 __be32 rm_xid; /* Mirrors the RPC header xid */
76 uint32_t rm_vers; /* Version of this protocol */ 76 __be32 rm_vers; /* Version of this protocol */
77 uint32_t rm_credit; /* Buffers requested/granted */ 77 __be32 rm_credit; /* Buffers requested/granted */
78 uint32_t rm_type; /* Type of message (enum rpcrdma_proc) */ 78 __be32 rm_type; /* Type of message (enum rpcrdma_proc) */
79 union { 79 union {
80 80
81 struct { /* no chunks */ 81 struct { /* no chunks */
82 uint32_t rm_empty[3]; /* 3 empty chunk lists */ 82 __be32 rm_empty[3]; /* 3 empty chunk lists */
83 } rm_nochunks; 83 } rm_nochunks;
84 84
85 struct { /* no chunks and padded */ 85 struct { /* no chunks and padded */
86 uint32_t rm_align; /* Padding alignment */ 86 __be32 rm_align; /* Padding alignment */
87 uint32_t rm_thresh; /* Padding threshold */ 87 __be32 rm_thresh; /* Padding threshold */
88 uint32_t rm_pempty[3]; /* 3 empty chunk lists */ 88 __be32 rm_pempty[3]; /* 3 empty chunk lists */
89 } rm_padded; 89 } rm_padded;
90 90
91 uint32_t rm_chunks[0]; /* read, write and reply chunks */ 91 __be32 rm_chunks[0]; /* read, write and reply chunks */
92 92
93 } rm_body; 93 } rm_body;
94}; 94};
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 8ea077db0099..f689f02e6793 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -56,8 +56,6 @@ struct rpc_task {
56 __u8 tk_garb_retry; 56 __u8 tk_garb_retry;
57 __u8 tk_cred_retry; 57 __u8 tk_cred_retry;
58 58
59 unsigned long tk_cookie; /* Cookie for batching tasks */
60
61 /* 59 /*
62 * timeout_fn to be executed by timer bottom half 60 * timeout_fn to be executed by timer bottom half
63 * callback to be executed after waking up 61 * callback to be executed after waking up
@@ -78,7 +76,6 @@ struct rpc_task {
78 struct timer_list tk_timer; /* kernel timer */ 76 struct timer_list tk_timer; /* kernel timer */
79 unsigned long tk_timeout; /* timeout for rpc_sleep() */ 77 unsigned long tk_timeout; /* timeout for rpc_sleep() */
80 unsigned short tk_flags; /* misc flags */ 78 unsigned short tk_flags; /* misc flags */
81 unsigned char tk_priority : 2;/* Task priority */
82 unsigned long tk_runstate; /* Task run status */ 79 unsigned long tk_runstate; /* Task run status */
83 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could 80 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could
84 * be any workqueue 81 * be any workqueue
@@ -94,6 +91,9 @@ struct rpc_task {
94 unsigned long tk_start; /* RPC task init timestamp */ 91 unsigned long tk_start; /* RPC task init timestamp */
95 long tk_rtt; /* round-trip time (jiffies) */ 92 long tk_rtt; /* round-trip time (jiffies) */
96 93
94 pid_t tk_owner; /* Process id for batching tasks */
95 unsigned char tk_priority : 2;/* Task priority */
96
97#ifdef RPC_DEBUG 97#ifdef RPC_DEBUG
98 unsigned short tk_pid; /* debugging aid */ 98 unsigned short tk_pid; /* debugging aid */
99#endif 99#endif
@@ -117,6 +117,15 @@ struct rpc_call_ops {
117 void (*rpc_release)(void *); 117 void (*rpc_release)(void *);
118}; 118};
119 119
120struct rpc_task_setup {
121 struct rpc_task *task;
122 struct rpc_clnt *rpc_client;
123 const struct rpc_message *rpc_message;
124 const struct rpc_call_ops *callback_ops;
125 void *callback_data;
126 unsigned short flags;
127 signed char priority;
128};
120 129
121/* 130/*
122 * RPC task flags 131 * RPC task flags
@@ -128,7 +137,6 @@ struct rpc_call_ops {
128#define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */ 137#define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */
129#define RPC_TASK_KILLED 0x0100 /* task was killed */ 138#define RPC_TASK_KILLED 0x0100 /* task was killed */
130#define RPC_TASK_SOFT 0x0200 /* Use soft timeouts */ 139#define RPC_TASK_SOFT 0x0200 /* Use soft timeouts */
131#define RPC_TASK_NOINTR 0x0400 /* uninterruptible task */
132 140
133#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) 141#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC)
134#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) 142#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
@@ -136,7 +144,6 @@ struct rpc_call_ops {
136#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED) 144#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED)
137#define RPC_DO_CALLBACK(t) ((t)->tk_callback != NULL) 145#define RPC_DO_CALLBACK(t) ((t)->tk_callback != NULL)
138#define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT) 146#define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT)
139#define RPC_TASK_UNINTERRUPTIBLE(t) ((t)->tk_flags & RPC_TASK_NOINTR)
140 147
141#define RPC_TASK_RUNNING 0 148#define RPC_TASK_RUNNING 0
142#define RPC_TASK_QUEUED 1 149#define RPC_TASK_QUEUED 1
@@ -180,10 +187,10 @@ struct rpc_call_ops {
180 * Note: if you change these, you must also change 187 * Note: if you change these, you must also change
181 * the task initialization definitions below. 188 * the task initialization definitions below.
182 */ 189 */
183#define RPC_PRIORITY_LOW 0 190#define RPC_PRIORITY_LOW (-1)
184#define RPC_PRIORITY_NORMAL 1 191#define RPC_PRIORITY_NORMAL (0)
185#define RPC_PRIORITY_HIGH 2 192#define RPC_PRIORITY_HIGH (1)
186#define RPC_NR_PRIORITY (RPC_PRIORITY_HIGH+1) 193#define RPC_NR_PRIORITY (1 + RPC_PRIORITY_HIGH - RPC_PRIORITY_LOW)
187 194
188/* 195/*
189 * RPC synchronization objects 196 * RPC synchronization objects
@@ -191,7 +198,7 @@ struct rpc_call_ops {
191struct rpc_wait_queue { 198struct rpc_wait_queue {
192 spinlock_t lock; 199 spinlock_t lock;
193 struct list_head tasks[RPC_NR_PRIORITY]; /* task queue for each priority level */ 200 struct list_head tasks[RPC_NR_PRIORITY]; /* task queue for each priority level */
194 unsigned long cookie; /* cookie of last task serviced */ 201 pid_t owner; /* process id of last task serviced */
195 unsigned char maxpriority; /* maximum priority (0 if queue is not a priority queue) */ 202 unsigned char maxpriority; /* maximum priority (0 if queue is not a priority queue) */
196 unsigned char priority; /* current priority */ 203 unsigned char priority; /* current priority */
197 unsigned char count; /* # task groups remaining serviced so far */ 204 unsigned char count; /* # task groups remaining serviced so far */
@@ -208,41 +215,13 @@ struct rpc_wait_queue {
208 * performance of NFS operations such as read/write. 215 * performance of NFS operations such as read/write.
209 */ 216 */
210#define RPC_BATCH_COUNT 16 217#define RPC_BATCH_COUNT 16
211
212#ifndef RPC_DEBUG
213# define RPC_WAITQ_INIT(var,qname) { \
214 .lock = __SPIN_LOCK_UNLOCKED(var.lock), \
215 .tasks = { \
216 [0] = LIST_HEAD_INIT(var.tasks[0]), \
217 [1] = LIST_HEAD_INIT(var.tasks[1]), \
218 [2] = LIST_HEAD_INIT(var.tasks[2]), \
219 }, \
220 }
221#else
222# define RPC_WAITQ_INIT(var,qname) { \
223 .lock = __SPIN_LOCK_UNLOCKED(var.lock), \
224 .tasks = { \
225 [0] = LIST_HEAD_INIT(var.tasks[0]), \
226 [1] = LIST_HEAD_INIT(var.tasks[1]), \
227 [2] = LIST_HEAD_INIT(var.tasks[2]), \
228 }, \
229 .name = qname, \
230 }
231#endif
232# define RPC_WAITQ(var,qname) struct rpc_wait_queue var = RPC_WAITQ_INIT(var,qname)
233
234#define RPC_IS_PRIORITY(q) ((q)->maxpriority > 0) 218#define RPC_IS_PRIORITY(q) ((q)->maxpriority > 0)
235 219
236/* 220/*
237 * Function prototypes 221 * Function prototypes
238 */ 222 */
239struct rpc_task *rpc_new_task(struct rpc_clnt *, int flags, 223struct rpc_task *rpc_new_task(const struct rpc_task_setup *);
240 const struct rpc_call_ops *ops, void *data); 224struct rpc_task *rpc_run_task(const struct rpc_task_setup *);
241struct rpc_task *rpc_run_task(struct rpc_clnt *clnt, int flags,
242 const struct rpc_call_ops *ops, void *data);
243void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt,
244 int flags, const struct rpc_call_ops *ops,
245 void *data);
246void rpc_put_task(struct rpc_task *); 225void rpc_put_task(struct rpc_task *);
247void rpc_exit_task(struct rpc_task *); 226void rpc_exit_task(struct rpc_task *);
248void rpc_release_calldata(const struct rpc_call_ops *, void *); 227void rpc_release_calldata(const struct rpc_call_ops *, void *);
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 8531a70da73d..64c771056187 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -204,7 +204,7 @@ union svc_addr_u {
204struct svc_rqst { 204struct svc_rqst {
205 struct list_head rq_list; /* idle list */ 205 struct list_head rq_list; /* idle list */
206 struct list_head rq_all; /* all threads list */ 206 struct list_head rq_all; /* all threads list */
207 struct svc_sock * rq_sock; /* socket */ 207 struct svc_xprt * rq_xprt; /* transport ptr */
208 struct sockaddr_storage rq_addr; /* peer address */ 208 struct sockaddr_storage rq_addr; /* peer address */
209 size_t rq_addrlen; 209 size_t rq_addrlen;
210 210
@@ -214,9 +214,10 @@ struct svc_rqst {
214 struct auth_ops * rq_authop; /* authentication flavour */ 214 struct auth_ops * rq_authop; /* authentication flavour */
215 u32 rq_flavor; /* pseudoflavor */ 215 u32 rq_flavor; /* pseudoflavor */
216 struct svc_cred rq_cred; /* auth info */ 216 struct svc_cred rq_cred; /* auth info */
217 struct sk_buff * rq_skbuff; /* fast recv inet buffer */ 217 void * rq_xprt_ctxt; /* transport specific context ptr */
218 struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */ 218 struct svc_deferred_req*rq_deferred; /* deferred request we are replaying */
219 219
220 size_t rq_xprt_hlen; /* xprt header len */
220 struct xdr_buf rq_arg; 221 struct xdr_buf rq_arg;
221 struct xdr_buf rq_res; 222 struct xdr_buf rq_res;
222 struct page * rq_pages[RPCSVC_MAXPAGES]; 223 struct page * rq_pages[RPCSVC_MAXPAGES];
@@ -317,11 +318,12 @@ static inline void svc_free_res_pages(struct svc_rqst *rqstp)
317 318
318struct svc_deferred_req { 319struct svc_deferred_req {
319 u32 prot; /* protocol (UDP or TCP) */ 320 u32 prot; /* protocol (UDP or TCP) */
320 struct svc_sock *svsk; 321 struct svc_xprt *xprt;
321 struct sockaddr_storage addr; /* where reply must go */ 322 struct sockaddr_storage addr; /* where reply must go */
322 size_t addrlen; 323 size_t addrlen;
323 union svc_addr_u daddr; /* where reply must come from */ 324 union svc_addr_u daddr; /* where reply must come from */
324 struct cache_deferred_req handle; 325 struct cache_deferred_req handle;
326 size_t xprt_hlen;
325 int argslen; 327 int argslen;
326 __be32 args[0]; 328 __be32 args[0];
327}; 329};
@@ -382,6 +384,8 @@ struct svc_procedure {
382 */ 384 */
383struct svc_serv * svc_create(struct svc_program *, unsigned int, 385struct svc_serv * svc_create(struct svc_program *, unsigned int,
384 void (*shutdown)(struct svc_serv*)); 386 void (*shutdown)(struct svc_serv*));
387struct svc_rqst *svc_prepare_thread(struct svc_serv *serv,
388 struct svc_pool *pool);
385int svc_create_thread(svc_thread_fn, struct svc_serv *); 389int svc_create_thread(svc_thread_fn, struct svc_serv *);
386void svc_exit_thread(struct svc_rqst *); 390void svc_exit_thread(struct svc_rqst *);
387struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int, 391struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
new file mode 100644
index 000000000000..c11bbcc081f9
--- /dev/null
+++ b/include/linux/sunrpc/svc_rdma.h
@@ -0,0 +1,262 @@
1/*
2 * Copyright (c) 2005-2006 Network Appliance, Inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the BSD-type
8 * license below:
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 *
14 * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 *
17 * Redistributions in binary form must reproduce the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer in the documentation and/or other materials provided
20 * with the distribution.
21 *
22 * Neither the name of the Network Appliance, Inc. nor the names of
23 * its contributors may be used to endorse or promote products
24 * derived from this software without specific prior written
25 * permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 *
39 * Author: Tom Tucker <tom@opengridcomputing.com>
40 */
41
42#ifndef SVC_RDMA_H
43#define SVC_RDMA_H
44#include <linux/sunrpc/xdr.h>
45#include <linux/sunrpc/svcsock.h>
46#include <linux/sunrpc/rpc_rdma.h>
47#include <rdma/ib_verbs.h>
48#include <rdma/rdma_cm.h>
49#define SVCRDMA_DEBUG
50
51/* RPC/RDMA parameters and stats */
52extern unsigned int svcrdma_ord;
53extern unsigned int svcrdma_max_requests;
54extern unsigned int svcrdma_max_req_size;
55
56extern atomic_t rdma_stat_recv;
57extern atomic_t rdma_stat_read;
58extern atomic_t rdma_stat_write;
59extern atomic_t rdma_stat_sq_starve;
60extern atomic_t rdma_stat_rq_starve;
61extern atomic_t rdma_stat_rq_poll;
62extern atomic_t rdma_stat_rq_prod;
63extern atomic_t rdma_stat_sq_poll;
64extern atomic_t rdma_stat_sq_prod;
65
66#define RPCRDMA_VERSION 1
67
68/*
69 * Contexts are built when an RDMA request is created and are a
70 * record of the resources that can be recovered when the request
71 * completes.
72 */
73struct svc_rdma_op_ctxt {
74 struct svc_rdma_op_ctxt *next;
75 struct xdr_buf arg;
76 struct list_head dto_q;
77 enum ib_wr_opcode wr_op;
78 enum ib_wc_status wc_status;
79 u32 byte_len;
80 struct svcxprt_rdma *xprt;
81 unsigned long flags;
82 enum dma_data_direction direction;
83 int count;
84 struct ib_sge sge[RPCSVC_MAXPAGES];
85 struct page *pages[RPCSVC_MAXPAGES];
86};
87
88#define RDMACTXT_F_READ_DONE 1
89#define RDMACTXT_F_LAST_CTXT 2
90
91struct svcxprt_rdma {
92 struct svc_xprt sc_xprt; /* SVC transport structure */
93 struct rdma_cm_id *sc_cm_id; /* RDMA connection id */
94 struct list_head sc_accept_q; /* Conn. waiting accept */
95 int sc_ord; /* RDMA read limit */
96 wait_queue_head_t sc_read_wait;
97 int sc_max_sge;
98
99 int sc_sq_depth; /* Depth of SQ */
100 atomic_t sc_sq_count; /* Number of SQ WR on queue */
101
102 int sc_max_requests; /* Depth of RQ */
103 int sc_max_req_size; /* Size of each RQ WR buf */
104
105 struct ib_pd *sc_pd;
106
107 struct svc_rdma_op_ctxt *sc_ctxt_head;
108 int sc_ctxt_cnt;
109 int sc_ctxt_bump;
110 int sc_ctxt_max;
111 spinlock_t sc_ctxt_lock;
112 struct list_head sc_rq_dto_q;
113 spinlock_t sc_rq_dto_lock;
114 struct ib_qp *sc_qp;
115 struct ib_cq *sc_rq_cq;
116 struct ib_cq *sc_sq_cq;
117 struct ib_mr *sc_phys_mr; /* MR for server memory */
118
119 spinlock_t sc_lock; /* transport lock */
120
121 wait_queue_head_t sc_send_wait; /* SQ exhaustion waitlist */
122 unsigned long sc_flags;
123 struct list_head sc_dto_q; /* DTO tasklet I/O pending Q */
124 struct list_head sc_read_complete_q;
125 spinlock_t sc_read_complete_lock;
126};
127/* sc_flags */
128#define RDMAXPRT_RQ_PENDING 1
129#define RDMAXPRT_SQ_PENDING 2
130#define RDMAXPRT_CONN_PENDING 3
131
132#define RPCRDMA_LISTEN_BACKLOG 10
133/* The default ORD value is based on two outstanding full-size writes with a
134 * page size of 4k, or 32k * 2 ops / 4k = 16 outstanding RDMA_READ. */
135#define RPCRDMA_ORD (64/4)
136#define RPCRDMA_SQ_DEPTH_MULT 8
137#define RPCRDMA_MAX_THREADS 16
138#define RPCRDMA_MAX_REQUESTS 16
139#define RPCRDMA_MAX_REQ_SIZE 4096
140
141/* svc_rdma_marshal.c */
142extern void svc_rdma_rcl_chunk_counts(struct rpcrdma_read_chunk *,
143 int *, int *);
144extern int svc_rdma_xdr_decode_req(struct rpcrdma_msg **, struct svc_rqst *);
145extern int svc_rdma_xdr_decode_deferred_req(struct svc_rqst *);
146extern int svc_rdma_xdr_encode_error(struct svcxprt_rdma *,
147 struct rpcrdma_msg *,
148 enum rpcrdma_errcode, u32 *);
149extern void svc_rdma_xdr_encode_write_list(struct rpcrdma_msg *, int);
150extern void svc_rdma_xdr_encode_reply_array(struct rpcrdma_write_array *, int);
151extern void svc_rdma_xdr_encode_array_chunk(struct rpcrdma_write_array *, int,
152 u32, u64, u32);
153extern void svc_rdma_xdr_encode_reply_header(struct svcxprt_rdma *,
154 struct rpcrdma_msg *,
155 struct rpcrdma_msg *,
156 enum rpcrdma_proc);
157extern int svc_rdma_xdr_get_reply_hdr_len(struct rpcrdma_msg *);
158
159/* svc_rdma_recvfrom.c */
160extern int svc_rdma_recvfrom(struct svc_rqst *);
161
162/* svc_rdma_sendto.c */
163extern int svc_rdma_sendto(struct svc_rqst *);
164
165/* svc_rdma_transport.c */
166extern int svc_rdma_send(struct svcxprt_rdma *, struct ib_send_wr *);
167extern int svc_rdma_send_error(struct svcxprt_rdma *, struct rpcrdma_msg *,
168 enum rpcrdma_errcode);
169struct page *svc_rdma_get_page(void);
170extern int svc_rdma_post_recv(struct svcxprt_rdma *);
171extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *);
172extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *);
173extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int);
174extern void svc_sq_reap(struct svcxprt_rdma *);
175extern void svc_rq_reap(struct svcxprt_rdma *);
176extern struct svc_xprt_class svc_rdma_class;
177extern void svc_rdma_prep_reply_hdr(struct svc_rqst *);
178
179/* svc_rdma.c */
180extern int svc_rdma_init(void);
181extern void svc_rdma_cleanup(void);
182
183/*
184 * Returns the address of the first read chunk or <nul> if no read chunk is
185 * present
186 */
187static inline struct rpcrdma_read_chunk *
188svc_rdma_get_read_chunk(struct rpcrdma_msg *rmsgp)
189{
190 struct rpcrdma_read_chunk *ch =
191 (struct rpcrdma_read_chunk *)&rmsgp->rm_body.rm_chunks[0];
192
193 if (ch->rc_discrim == 0)
194 return NULL;
195
196 return ch;
197}
198
199/*
200 * Returns the address of the first read write array element or <nul> if no
201 * write array list is present
202 */
203static inline struct rpcrdma_write_array *
204svc_rdma_get_write_array(struct rpcrdma_msg *rmsgp)
205{
206 if (rmsgp->rm_body.rm_chunks[0] != 0
207 || rmsgp->rm_body.rm_chunks[1] == 0)
208 return NULL;
209
210 return (struct rpcrdma_write_array *)&rmsgp->rm_body.rm_chunks[1];
211}
212
213/*
214 * Returns the address of the first reply array element or <nul> if no
215 * reply array is present
216 */
217static inline struct rpcrdma_write_array *
218svc_rdma_get_reply_array(struct rpcrdma_msg *rmsgp)
219{
220 struct rpcrdma_read_chunk *rch;
221 struct rpcrdma_write_array *wr_ary;
222 struct rpcrdma_write_array *rp_ary;
223
224 /* XXX: Need to fix when reply list may occur with read-list and/or
225 * write list */
226 if (rmsgp->rm_body.rm_chunks[0] != 0 ||
227 rmsgp->rm_body.rm_chunks[1] != 0)
228 return NULL;
229
230 rch = svc_rdma_get_read_chunk(rmsgp);
231 if (rch) {
232 while (rch->rc_discrim)
233 rch++;
234
235 /* The reply list follows an empty write array located
236 * at 'rc_position' here. The reply array is at rc_target.
237 */
238 rp_ary = (struct rpcrdma_write_array *)&rch->rc_target;
239
240 goto found_it;
241 }
242
243 wr_ary = svc_rdma_get_write_array(rmsgp);
244 if (wr_ary) {
245 rp_ary = (struct rpcrdma_write_array *)
246 &wr_ary->
247 wc_array[wr_ary->wc_nchunks].wc_target.rs_length;
248
249 goto found_it;
250 }
251
252 /* No read list, no write list */
253 rp_ary = (struct rpcrdma_write_array *)
254 &rmsgp->rm_body.rm_chunks[2];
255
256 found_it:
257 if (rp_ary->wc_discrim == 0)
258 return NULL;
259
260 return rp_ary;
261}
262#endif
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
new file mode 100644
index 000000000000..6fd7b016517f
--- /dev/null
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -0,0 +1,159 @@
1/*
2 * linux/include/linux/sunrpc/svc_xprt.h
3 *
4 * RPC server transport I/O
5 */
6
7#ifndef SUNRPC_SVC_XPRT_H
8#define SUNRPC_SVC_XPRT_H
9
10#include <linux/sunrpc/svc.h>
11#include <linux/module.h>
12
13struct svc_xprt_ops {
14 struct svc_xprt *(*xpo_create)(struct svc_serv *,
15 struct sockaddr *, int,
16 int);
17 struct svc_xprt *(*xpo_accept)(struct svc_xprt *);
18 int (*xpo_has_wspace)(struct svc_xprt *);
19 int (*xpo_recvfrom)(struct svc_rqst *);
20 void (*xpo_prep_reply_hdr)(struct svc_rqst *);
21 int (*xpo_sendto)(struct svc_rqst *);
22 void (*xpo_release_rqst)(struct svc_rqst *);
23 void (*xpo_detach)(struct svc_xprt *);
24 void (*xpo_free)(struct svc_xprt *);
25};
26
27struct svc_xprt_class {
28 const char *xcl_name;
29 struct module *xcl_owner;
30 struct svc_xprt_ops *xcl_ops;
31 struct list_head xcl_list;
32 u32 xcl_max_payload;
33};
34
35struct svc_xprt {
36 struct svc_xprt_class *xpt_class;
37 struct svc_xprt_ops *xpt_ops;
38 struct kref xpt_ref;
39 struct list_head xpt_list;
40 struct list_head xpt_ready;
41 unsigned long xpt_flags;
42#define XPT_BUSY 0 /* enqueued/receiving */
43#define XPT_CONN 1 /* conn pending */
44#define XPT_CLOSE 2 /* dead or dying */
45#define XPT_DATA 3 /* data pending */
46#define XPT_TEMP 4 /* connected transport */
47#define XPT_DEAD 6 /* transport closed */
48#define XPT_CHNGBUF 7 /* need to change snd/rcv buf sizes */
49#define XPT_DEFERRED 8 /* deferred request pending */
50#define XPT_OLD 9 /* used for xprt aging mark+sweep */
51#define XPT_DETACHED 10 /* detached from tempsocks list */
52#define XPT_LISTENER 11 /* listening endpoint */
53#define XPT_CACHE_AUTH 12 /* cache auth info */
54
55 struct svc_pool *xpt_pool; /* current pool iff queued */
56 struct svc_serv *xpt_server; /* service for transport */
57 atomic_t xpt_reserved; /* space on outq that is rsvd */
58 struct mutex xpt_mutex; /* to serialize sending data */
59 spinlock_t xpt_lock; /* protects sk_deferred
60 * and xpt_auth_cache */
61 void *xpt_auth_cache;/* auth cache */
62 struct list_head xpt_deferred; /* deferred requests that need
63 * to be revisted */
64 struct sockaddr_storage xpt_local; /* local address */
65 size_t xpt_locallen; /* length of address */
66 struct sockaddr_storage xpt_remote; /* remote peer's address */
67 size_t xpt_remotelen; /* length of address */
68};
69
70int svc_reg_xprt_class(struct svc_xprt_class *);
71void svc_unreg_xprt_class(struct svc_xprt_class *);
72void svc_xprt_init(struct svc_xprt_class *, struct svc_xprt *,
73 struct svc_serv *);
74int svc_create_xprt(struct svc_serv *, char *, unsigned short, int);
75void svc_xprt_enqueue(struct svc_xprt *xprt);
76void svc_xprt_received(struct svc_xprt *);
77void svc_xprt_put(struct svc_xprt *xprt);
78void svc_xprt_copy_addrs(struct svc_rqst *rqstp, struct svc_xprt *xprt);
79void svc_close_xprt(struct svc_xprt *xprt);
80void svc_delete_xprt(struct svc_xprt *xprt);
81int svc_port_is_privileged(struct sockaddr *sin);
82int svc_print_xprts(char *buf, int maxlen);
83struct svc_xprt *svc_find_xprt(struct svc_serv *, char *, int, int);
84int svc_xprt_names(struct svc_serv *serv, char *buf, int buflen);
85
86static inline void svc_xprt_get(struct svc_xprt *xprt)
87{
88 kref_get(&xprt->xpt_ref);
89}
90static inline void svc_xprt_set_local(struct svc_xprt *xprt,
91 struct sockaddr *sa, int salen)
92{
93 memcpy(&xprt->xpt_local, sa, salen);
94 xprt->xpt_locallen = salen;
95}
96static inline void svc_xprt_set_remote(struct svc_xprt *xprt,
97 struct sockaddr *sa, int salen)
98{
99 memcpy(&xprt->xpt_remote, sa, salen);
100 xprt->xpt_remotelen = salen;
101}
102static inline unsigned short svc_addr_port(struct sockaddr *sa)
103{
104 unsigned short ret = 0;
105 switch (sa->sa_family) {
106 case AF_INET:
107 ret = ntohs(((struct sockaddr_in *)sa)->sin_port);
108 break;
109 case AF_INET6:
110 ret = ntohs(((struct sockaddr_in6 *)sa)->sin6_port);
111 break;
112 }
113 return ret;
114}
115
116static inline size_t svc_addr_len(struct sockaddr *sa)
117{
118 switch (sa->sa_family) {
119 case AF_INET:
120 return sizeof(struct sockaddr_in);
121 case AF_INET6:
122 return sizeof(struct sockaddr_in6);
123 }
124 return -EAFNOSUPPORT;
125}
126
127static inline unsigned short svc_xprt_local_port(struct svc_xprt *xprt)
128{
129 return svc_addr_port((struct sockaddr *)&xprt->xpt_local);
130}
131
132static inline unsigned short svc_xprt_remote_port(struct svc_xprt *xprt)
133{
134 return svc_addr_port((struct sockaddr *)&xprt->xpt_remote);
135}
136
137static inline char *__svc_print_addr(struct sockaddr *addr,
138 char *buf, size_t len)
139{
140 switch (addr->sa_family) {
141 case AF_INET:
142 snprintf(buf, len, "%u.%u.%u.%u, port=%u",
143 NIPQUAD(((struct sockaddr_in *) addr)->sin_addr),
144 ntohs(((struct sockaddr_in *) addr)->sin_port));
145 break;
146
147 case AF_INET6:
148 snprintf(buf, len, "%x:%x:%x:%x:%x:%x:%x:%x, port=%u",
149 NIP6(((struct sockaddr_in6 *) addr)->sin6_addr),
150 ntohs(((struct sockaddr_in6 *) addr)->sin6_port));
151 break;
152
153 default:
154 snprintf(buf, len, "unknown address type: %d", addr->sa_family);
155 break;
156 }
157 return buf;
158}
159#endif /* SUNRPC_SVC_XPRT_H */
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index a53e0fa855d2..206f092ad4c7 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -10,42 +10,16 @@
10#define SUNRPC_SVCSOCK_H 10#define SUNRPC_SVCSOCK_H
11 11
12#include <linux/sunrpc/svc.h> 12#include <linux/sunrpc/svc.h>
13#include <linux/sunrpc/svc_xprt.h>
13 14
14/* 15/*
15 * RPC server socket. 16 * RPC server socket.
16 */ 17 */
17struct svc_sock { 18struct svc_sock {
18 struct list_head sk_ready; /* list of ready sockets */ 19 struct svc_xprt sk_xprt;
19 struct list_head sk_list; /* list of all sockets */
20 struct socket * sk_sock; /* berkeley socket layer */ 20 struct socket * sk_sock; /* berkeley socket layer */
21 struct sock * sk_sk; /* INET layer */ 21 struct sock * sk_sk; /* INET layer */
22 22
23 struct svc_pool * sk_pool; /* current pool iff queued */
24 struct svc_serv * sk_server; /* service for this socket */
25 atomic_t sk_inuse; /* use count */
26 unsigned long sk_flags;
27#define SK_BUSY 0 /* enqueued/receiving */
28#define SK_CONN 1 /* conn pending */
29#define SK_CLOSE 2 /* dead or dying */
30#define SK_DATA 3 /* data pending */
31#define SK_TEMP 4 /* temp (TCP) socket */
32#define SK_DEAD 6 /* socket closed */
33#define SK_CHNGBUF 7 /* need to change snd/rcv buffer sizes */
34#define SK_DEFERRED 8 /* request on sk_deferred */
35#define SK_OLD 9 /* used for temp socket aging mark+sweep */
36#define SK_DETACHED 10 /* detached from tempsocks list */
37
38 atomic_t sk_reserved; /* space on outq that is reserved */
39
40 spinlock_t sk_lock; /* protects sk_deferred and
41 * sk_info_authunix */
42 struct list_head sk_deferred; /* deferred requests that need to
43 * be revisted */
44 struct mutex sk_mutex; /* to serialize sending data */
45
46 int (*sk_recvfrom)(struct svc_rqst *rqstp);
47 int (*sk_sendto)(struct svc_rqst *rqstp);
48
49 /* We keep the old state_change and data_ready CB's here */ 23 /* We keep the old state_change and data_ready CB's here */
50 void (*sk_ostate)(struct sock *); 24 void (*sk_ostate)(struct sock *);
51 void (*sk_odata)(struct sock *, int bytes); 25 void (*sk_odata)(struct sock *, int bytes);
@@ -54,21 +28,12 @@ struct svc_sock {
54 /* private TCP part */ 28 /* private TCP part */
55 int sk_reclen; /* length of record */ 29 int sk_reclen; /* length of record */
56 int sk_tcplen; /* current read length */ 30 int sk_tcplen; /* current read length */
57 time_t sk_lastrecv; /* time of last received request */
58
59 /* cache of various info for TCP sockets */
60 void *sk_info_authunix;
61
62 struct sockaddr_storage sk_local; /* local address */
63 struct sockaddr_storage sk_remote; /* remote peer's address */
64 int sk_remotelen; /* length of address */
65}; 31};
66 32
67/* 33/*
68 * Function prototypes. 34 * Function prototypes.
69 */ 35 */
70int svc_makesock(struct svc_serv *, int, unsigned short, int flags); 36void svc_close_all(struct list_head *);
71void svc_force_close_socket(struct svc_sock *);
72int svc_recv(struct svc_rqst *, long); 37int svc_recv(struct svc_rqst *, long);
73int svc_send(struct svc_rqst *); 38int svc_send(struct svc_rqst *);
74void svc_drop(struct svc_rqst *); 39void svc_drop(struct svc_rqst *);
@@ -78,6 +43,8 @@ int svc_addsock(struct svc_serv *serv,
78 int fd, 43 int fd,
79 char *name_return, 44 char *name_return,
80 int *proto); 45 int *proto);
46void svc_init_xprt_sock(void);
47void svc_cleanup_xprt_sock(void);
81 48
82/* 49/*
83 * svc_makesock socket characteristics 50 * svc_makesock socket characteristics
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index 0751c9464d0f..e4057d729f03 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -112,7 +112,8 @@ struct xdr_buf {
112__be32 *xdr_encode_opaque_fixed(__be32 *p, const void *ptr, unsigned int len); 112__be32 *xdr_encode_opaque_fixed(__be32 *p, const void *ptr, unsigned int len);
113__be32 *xdr_encode_opaque(__be32 *p, const void *ptr, unsigned int len); 113__be32 *xdr_encode_opaque(__be32 *p, const void *ptr, unsigned int len);
114__be32 *xdr_encode_string(__be32 *p, const char *s); 114__be32 *xdr_encode_string(__be32 *p, const char *s);
115__be32 *xdr_decode_string_inplace(__be32 *p, char **sp, int *lenp, int maxlen); 115__be32 *xdr_decode_string_inplace(__be32 *p, char **sp, unsigned int *lenp,
116 unsigned int maxlen);
116__be32 *xdr_encode_netobj(__be32 *p, const struct xdr_netobj *); 117__be32 *xdr_encode_netobj(__be32 *p, const struct xdr_netobj *);
117__be32 *xdr_decode_netobj(__be32 *p, struct xdr_netobj *); 118__be32 *xdr_decode_netobj(__be32 *p, struct xdr_netobj *);
118 119
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 30b17b3bc1a9..b3ff9a815e6f 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -120,7 +120,7 @@ struct rpc_xprt {
120 struct kref kref; /* Reference count */ 120 struct kref kref; /* Reference count */
121 struct rpc_xprt_ops * ops; /* transport methods */ 121 struct rpc_xprt_ops * ops; /* transport methods */
122 122
123 struct rpc_timeout timeout; /* timeout parms */ 123 const struct rpc_timeout *timeout; /* timeout parms */
124 struct sockaddr_storage addr; /* server address */ 124 struct sockaddr_storage addr; /* server address */
125 size_t addrlen; /* size of server address */ 125 size_t addrlen; /* size of server address */
126 int prot; /* IP protocol */ 126 int prot; /* IP protocol */
@@ -183,7 +183,7 @@ struct rpc_xprt {
183 bklog_u; /* backlog queue utilization */ 183 bklog_u; /* backlog queue utilization */
184 } stat; 184 } stat;
185 185
186 char * address_strings[RPC_DISPLAY_MAX]; 186 const char *address_strings[RPC_DISPLAY_MAX];
187}; 187};
188 188
189struct xprt_create { 189struct xprt_create {
@@ -191,7 +191,6 @@ struct xprt_create {
191 struct sockaddr * srcaddr; /* optional local address */ 191 struct sockaddr * srcaddr; /* optional local address */
192 struct sockaddr * dstaddr; /* remote peer address */ 192 struct sockaddr * dstaddr; /* remote peer address */
193 size_t addrlen; 193 size_t addrlen;
194 struct rpc_timeout * timeout; /* optional timeout parameters */
195}; 194};
196 195
197struct xprt_class { 196struct xprt_class {
@@ -203,11 +202,6 @@ struct xprt_class {
203}; 202};
204 203
205/* 204/*
206 * Transport operations used by ULPs
207 */
208void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr);
209
210/*
211 * Generic internal transport functions 205 * Generic internal transport functions
212 */ 206 */
213struct rpc_xprt *xprt_create_transport(struct xprt_create *args); 207struct rpc_xprt *xprt_create_transport(struct xprt_create *args);
@@ -245,7 +239,8 @@ void xprt_adjust_cwnd(struct rpc_task *task, int result);
245struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid); 239struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid);
246void xprt_complete_rqst(struct rpc_task *task, int copied); 240void xprt_complete_rqst(struct rpc_task *task, int copied);
247void xprt_release_rqst_cong(struct rpc_task *task); 241void xprt_release_rqst_cong(struct rpc_task *task);
248void xprt_disconnect(struct rpc_xprt *xprt); 242void xprt_disconnect_done(struct rpc_xprt *xprt);
243void xprt_force_disconnect(struct rpc_xprt *xprt);
249 244
250/* 245/*
251 * Reserved bit positions in xprt->state 246 * Reserved bit positions in xprt->state
@@ -256,6 +251,7 @@ void xprt_disconnect(struct rpc_xprt *xprt);
256#define XPRT_CLOSE_WAIT (3) 251#define XPRT_CLOSE_WAIT (3)
257#define XPRT_BOUND (4) 252#define XPRT_BOUND (4)
258#define XPRT_BINDING (5) 253#define XPRT_BINDING (5)
254#define XPRT_CLOSING (6)
259 255
260static inline void xprt_set_connected(struct rpc_xprt *xprt) 256static inline void xprt_set_connected(struct rpc_xprt *xprt)
261{ 257{
diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h
index 2c6c2c2783d8..c2a46c45c8f7 100644
--- a/include/linux/sunrpc/xprtsock.h
+++ b/include/linux/sunrpc/xprtsock.h
@@ -9,12 +9,6 @@
9 9
10#ifdef __KERNEL__ 10#ifdef __KERNEL__
11 11
12/*
13 * Socket transport setup operations
14 */
15struct rpc_xprt *xs_setup_udp(struct xprt_create *args);
16struct rpc_xprt *xs_setup_tcp(struct xprt_create *args);
17
18int init_socket_xprt(void); 12int init_socket_xprt(void);
19void cleanup_socket_xprt(void); 13void cleanup_socket_xprt(void);
20 14
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 4360e0816956..646ce2d068d4 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -38,18 +38,16 @@ typedef int __bitwise suspend_state_t;
38 * There is the %suspend_valid_only_mem function available that can be 38 * There is the %suspend_valid_only_mem function available that can be
39 * assigned to this if the platform only supports mem sleep. 39 * assigned to this if the platform only supports mem sleep.
40 * 40 *
41 * @set_target: Tell the platform which system sleep state is going to be 41 * @begin: Initialise a transition to given system sleep state.
42 * entered. 42 * @begin() is executed right prior to suspending devices. The information
43 * @set_target() is executed right prior to suspending devices. The 43 * conveyed to the platform code by @begin() should be disregarded by it as
44 * information conveyed to the platform code by @set_target() should be 44 * soon as @end() is executed. If @begin() fails (ie. returns nonzero),
45 * disregarded by the platform as soon as @finish() is executed and if
46 * @prepare() fails. If @set_target() fails (ie. returns nonzero),
47 * @prepare(), @enter() and @finish() will not be called by the PM core. 45 * @prepare(), @enter() and @finish() will not be called by the PM core.
48 * This callback is optional. However, if it is implemented, the argument 46 * This callback is optional. However, if it is implemented, the argument
49 * passed to @enter() is meaningless and should be ignored. 47 * passed to @enter() is redundant and should be ignored.
50 * 48 *
51 * @prepare: Prepare the platform for entering the system sleep state indicated 49 * @prepare: Prepare the platform for entering the system sleep state indicated
52 * by @set_target(). 50 * by @begin().
53 * @prepare() is called right after devices have been suspended (ie. the 51 * @prepare() is called right after devices have been suspended (ie. the
54 * appropriate .suspend() method has been executed for each device) and 52 * appropriate .suspend() method has been executed for each device) and
55 * before the nonboot CPUs are disabled (it is executed with IRQs enabled). 53 * before the nonboot CPUs are disabled (it is executed with IRQs enabled).
@@ -57,8 +55,8 @@ typedef int __bitwise suspend_state_t;
57 * error code otherwise, in which case the system cannot enter the desired 55 * error code otherwise, in which case the system cannot enter the desired
58 * sleep state (@enter() and @finish() will not be called in that case). 56 * sleep state (@enter() and @finish() will not be called in that case).
59 * 57 *
60 * @enter: Enter the system sleep state indicated by @set_target() or 58 * @enter: Enter the system sleep state indicated by @begin() or represented by
61 * represented by the argument if @set_target() is not implemented. 59 * the argument if @begin() is not implemented.
62 * This callback is mandatory. It returns 0 on success or a negative 60 * This callback is mandatory. It returns 0 on success or a negative
63 * error code otherwise, in which case the system cannot enter the desired 61 * error code otherwise, in which case the system cannot enter the desired
64 * sleep state. 62 * sleep state.
@@ -69,13 +67,22 @@ typedef int __bitwise suspend_state_t;
69 * This callback is optional, but should be implemented by the platforms 67 * This callback is optional, but should be implemented by the platforms
70 * that implement @prepare(). If implemented, it is always called after 68 * that implement @prepare(). If implemented, it is always called after
71 * @enter() (even if @enter() fails). 69 * @enter() (even if @enter() fails).
70 *
71 * @end: Called by the PM core right after resuming devices, to indicate to
72 * the platform that the system has returned to the working state or
73 * the transition to the sleep state has been aborted.
74 * This callback is optional, but should be implemented by the platforms
75 * that implement @begin(), but platforms implementing @begin() should
76 * also provide a @end() which cleans up transitions aborted before
77 * @enter().
72 */ 78 */
73struct platform_suspend_ops { 79struct platform_suspend_ops {
74 int (*valid)(suspend_state_t state); 80 int (*valid)(suspend_state_t state);
75 int (*set_target)(suspend_state_t state); 81 int (*begin)(suspend_state_t state);
76 int (*prepare)(void); 82 int (*prepare)(void);
77 int (*enter)(suspend_state_t state); 83 int (*enter)(suspend_state_t state);
78 void (*finish)(void); 84 void (*finish)(void);
85 void (*end)(void);
79}; 86};
80 87
81#ifdef CONFIG_SUSPEND 88#ifdef CONFIG_SUSPEND
@@ -129,14 +136,17 @@ extern void mark_free_pages(struct zone *zone);
129/** 136/**
130 * struct platform_hibernation_ops - hibernation platform support 137 * struct platform_hibernation_ops - hibernation platform support
131 * 138 *
132 * The methods in this structure allow a platform to override the default 139 * The methods in this structure allow a platform to carry out special
133 * mechanism of shutting down the machine during a hibernation transition. 140 * operations required by it during a hibernation transition.
134 * 141 *
135 * All three methods must be assigned. 142 * All the methods below must be implemented.
136 * 143 *
137 * @start: Tell the platform driver that we're starting hibernation. 144 * @begin: Tell the platform driver that we're starting hibernation.
138 * Called right after shrinking memory and before freezing devices. 145 * Called right after shrinking memory and before freezing devices.
139 * 146 *
147 * @end: Called by the PM core right after resuming devices, to indicate to
148 * the platform that the system has returned to the working state.
149 *
140 * @pre_snapshot: Prepare the platform for creating the hibernation image. 150 * @pre_snapshot: Prepare the platform for creating the hibernation image.
141 * Called right after devices have been frozen and before the nonboot 151 * Called right after devices have been frozen and before the nonboot
142 * CPUs are disabled (runs with IRQs on). 152 * CPUs are disabled (runs with IRQs on).
@@ -171,7 +181,8 @@ extern void mark_free_pages(struct zone *zone);
171 * thawing devices (runs with IRQs on). 181 * thawing devices (runs with IRQs on).
172 */ 182 */
173struct platform_hibernation_ops { 183struct platform_hibernation_ops {
174 int (*start)(void); 184 int (*begin)(void);
185 void (*end)(void);
175 int (*pre_snapshot)(void); 186 int (*pre_snapshot)(void);
176 void (*finish)(void); 187 void (*finish)(void);
177 int (*prepare)(void); 188 int (*prepare)(void);
@@ -211,22 +222,10 @@ static inline int hibernate(void) { return -ENOSYS; }
211#ifdef CONFIG_PM_SLEEP 222#ifdef CONFIG_PM_SLEEP
212void save_processor_state(void); 223void save_processor_state(void);
213void restore_processor_state(void); 224void restore_processor_state(void);
214struct saved_context;
215void __save_processor_state(struct saved_context *ctxt);
216void __restore_processor_state(struct saved_context *ctxt);
217 225
218/* kernel/power/main.c */ 226/* kernel/power/main.c */
219extern struct blocking_notifier_head pm_chain_head; 227extern int register_pm_notifier(struct notifier_block *nb);
220 228extern int unregister_pm_notifier(struct notifier_block *nb);
221static inline int register_pm_notifier(struct notifier_block *nb)
222{
223 return blocking_notifier_chain_register(&pm_chain_head, nb);
224}
225
226static inline int unregister_pm_notifier(struct notifier_block *nb)
227{
228 return blocking_notifier_chain_unregister(&pm_chain_head, nb);
229}
230 229
231#define pm_notifier(fn, pri) { \ 230#define pm_notifier(fn, pri) { \
232 static struct notifier_block fn##_nb = \ 231 static struct notifier_block fn##_nb = \
diff --git a/include/linux/suspend_ioctls.h b/include/linux/suspend_ioctls.h
new file mode 100644
index 000000000000..2c6faec96bde
--- /dev/null
+++ b/include/linux/suspend_ioctls.h
@@ -0,0 +1,32 @@
1#ifndef _LINUX_SUSPEND_IOCTLS_H
2#define _LINUX_SUSPEND_IOCTLS_H
3
4/*
5 * This structure is used to pass the values needed for the identification
6 * of the resume swap area from a user space to the kernel via the
7 * SNAPSHOT_SET_SWAP_AREA ioctl
8 */
9struct resume_swap_area {
10 loff_t offset;
11 u_int32_t dev;
12} __attribute__((packed));
13
14#define SNAPSHOT_IOC_MAGIC '3'
15#define SNAPSHOT_FREEZE _IO(SNAPSHOT_IOC_MAGIC, 1)
16#define SNAPSHOT_UNFREEZE _IO(SNAPSHOT_IOC_MAGIC, 2)
17#define SNAPSHOT_ATOMIC_RESTORE _IO(SNAPSHOT_IOC_MAGIC, 4)
18#define SNAPSHOT_FREE _IO(SNAPSHOT_IOC_MAGIC, 5)
19#define SNAPSHOT_FREE_SWAP_PAGES _IO(SNAPSHOT_IOC_MAGIC, 9)
20#define SNAPSHOT_S2RAM _IO(SNAPSHOT_IOC_MAGIC, 11)
21#define SNAPSHOT_SET_SWAP_AREA _IOW(SNAPSHOT_IOC_MAGIC, 13, \
22 struct resume_swap_area)
23#define SNAPSHOT_GET_IMAGE_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 14, loff_t)
24#define SNAPSHOT_PLATFORM_SUPPORT _IO(SNAPSHOT_IOC_MAGIC, 15)
25#define SNAPSHOT_POWER_OFF _IO(SNAPSHOT_IOC_MAGIC, 16)
26#define SNAPSHOT_CREATE_IMAGE _IOW(SNAPSHOT_IOC_MAGIC, 17, int)
27#define SNAPSHOT_PREF_IMAGE_SIZE _IO(SNAPSHOT_IOC_MAGIC, 18)
28#define SNAPSHOT_AVAIL_SWAP_SIZE _IOR(SNAPSHOT_IOC_MAGIC, 19, loff_t)
29#define SNAPSHOT_ALLOC_SWAP_PAGE _IOR(SNAPSHOT_IOC_MAGIC, 20, loff_t)
30#define SNAPSHOT_IOC_MAXNR 20
31
32#endif /* _LINUX_SUSPEND_IOCTLS_H */
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index e99171f01b4c..bf4ae4e138f7 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -70,7 +70,6 @@ enum
70 CTL_ABI=9, /* Binary emulation */ 70 CTL_ABI=9, /* Binary emulation */
71 CTL_CPU=10, /* CPU stuff (speed scaling, etc) */ 71 CTL_CPU=10, /* CPU stuff (speed scaling, etc) */
72 CTL_ARLAN=254, /* arlan wireless driver */ 72 CTL_ARLAN=254, /* arlan wireless driver */
73 CTL_APPLDATA=2120, /* s390 appldata */
74 CTL_S390DBF=5677, /* s390 debug */ 73 CTL_S390DBF=5677, /* s390 debug */
75 CTL_SUNRPC=7249, /* sunrpc debug */ 74 CTL_SUNRPC=7249, /* sunrpc debug */
76 CTL_PM=9899, /* frv power management */ 75 CTL_PM=9899, /* frv power management */
@@ -207,11 +206,6 @@ enum
207 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */ 206 VM_PANIC_ON_OOM=33, /* panic at out-of-memory */
208 VM_VDSO_ENABLED=34, /* map VDSO into new processes? */ 207 VM_VDSO_ENABLED=34, /* map VDSO into new processes? */
209 VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */ 208 VM_MIN_SLAB=35, /* Percent pages ignored by zone reclaim */
210
211 /* s390 vm cmm sysctls */
212 VM_CMM_PAGES=1111,
213 VM_CMM_TIMED_PAGES=1112,
214 VM_CMM_TIMEOUT=1113,
215}; 209};
216 210
217 211
@@ -446,8 +440,8 @@ enum
446 440
447enum { 441enum {
448 NET_IPV4_ROUTE_FLUSH=1, 442 NET_IPV4_ROUTE_FLUSH=1,
449 NET_IPV4_ROUTE_MIN_DELAY=2, 443 NET_IPV4_ROUTE_MIN_DELAY=2, /* obsolete since 2.6.25 */
450 NET_IPV4_ROUTE_MAX_DELAY=3, 444 NET_IPV4_ROUTE_MAX_DELAY=3, /* obsolete since 2.6.25 */
451 NET_IPV4_ROUTE_GC_THRESH=4, 445 NET_IPV4_ROUTE_GC_THRESH=4,
452 NET_IPV4_ROUTE_MAX_SIZE=5, 446 NET_IPV4_ROUTE_MAX_SIZE=5,
453 NET_IPV4_ROUTE_GC_MIN_INTERVAL=6, 447 NET_IPV4_ROUTE_GC_MIN_INTERVAL=6,
@@ -951,7 +945,10 @@ enum
951 945
952/* For the /proc/sys support */ 946/* For the /proc/sys support */
953struct ctl_table; 947struct ctl_table;
948struct nsproxy;
954extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev); 949extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev);
950extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
951 struct ctl_table_header *prev);
955extern void sysctl_head_finish(struct ctl_table_header *prev); 952extern void sysctl_head_finish(struct ctl_table_header *prev);
956extern int sysctl_perm(struct ctl_table *table, int op); 953extern int sysctl_perm(struct ctl_table *table, int op);
957 954
@@ -1055,6 +1052,13 @@ struct ctl_table
1055 void *extra2; 1052 void *extra2;
1056}; 1053};
1057 1054
1055struct ctl_table_root {
1056 struct list_head root_list;
1057 struct list_head header_list;
1058 struct list_head *(*lookup)(struct ctl_table_root *root,
1059 struct nsproxy *namespaces);
1060};
1061
1058/* struct ctl_table_header is used to maintain dynamic lists of 1062/* struct ctl_table_header is used to maintain dynamic lists of
1059 struct ctl_table trees. */ 1063 struct ctl_table trees. */
1060struct ctl_table_header 1064struct ctl_table_header
@@ -1063,12 +1067,26 @@ struct ctl_table_header
1063 struct list_head ctl_entry; 1067 struct list_head ctl_entry;
1064 int used; 1068 int used;
1065 struct completion *unregistering; 1069 struct completion *unregistering;
1070 struct ctl_table *ctl_table_arg;
1071 struct ctl_table_root *root;
1072};
1073
1074/* struct ctl_path describes where in the hierarchy a table is added */
1075struct ctl_path {
1076 const char *procname;
1077 int ctl_name;
1066}; 1078};
1067 1079
1080void register_sysctl_root(struct ctl_table_root *root);
1081struct ctl_table_header *__register_sysctl_paths(
1082 struct ctl_table_root *root, struct nsproxy *namespaces,
1083 const struct ctl_path *path, struct ctl_table *table);
1068struct ctl_table_header *register_sysctl_table(struct ctl_table * table); 1084struct ctl_table_header *register_sysctl_table(struct ctl_table * table);
1085struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
1086 struct ctl_table *table);
1069 1087
1070void unregister_sysctl_table(struct ctl_table_header * table); 1088void unregister_sysctl_table(struct ctl_table_header * table);
1071int sysctl_check_table(struct ctl_table *table); 1089int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table);
1072 1090
1073#else /* __KERNEL__ */ 1091#else /* __KERNEL__ */
1074 1092
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
index e285746588d6..f752e73bf977 100644
--- a/include/linux/sysdev.h
+++ b/include/linux/sysdev.h
@@ -29,6 +29,7 @@
29struct sys_device; 29struct sys_device;
30 30
31struct sysdev_class { 31struct sysdev_class {
32 const char *name;
32 struct list_head drivers; 33 struct list_head drivers;
33 34
34 /* Default operations for these types of devices */ 35 /* Default operations for these types of devices */
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 149ab62329e2..802710438a9e 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -32,6 +32,8 @@ struct attribute {
32 32
33struct attribute_group { 33struct attribute_group {
34 const char *name; 34 const char *name;
35 int (*is_visible)(struct kobject *,
36 struct attribute *, int);
35 struct attribute **attrs; 37 struct attribute **attrs;
36}; 38};
37 39
diff --git a/include/linux/tc_act/Kbuild b/include/linux/tc_act/Kbuild
index 78dfbac36375..6dac0d7365cc 100644
--- a/include/linux/tc_act/Kbuild
+++ b/include/linux/tc_act/Kbuild
@@ -2,3 +2,4 @@ header-y += tc_gact.h
2header-y += tc_ipt.h 2header-y += tc_ipt.h
3header-y += tc_mirred.h 3header-y += tc_mirred.h
4header-y += tc_pedit.h 4header-y += tc_pedit.h
5header-y += tc_nat.h
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index bac17c59b24e..08027f1d7f31 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -330,10 +330,12 @@ struct tcp_sock {
330 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ 330 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */
331 struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/ 331 struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/
332 332
333 struct tcp_sack_block_wire recv_sack_cache[4]; 333 struct tcp_sack_block recv_sack_cache[4];
334 334
335 u32 highest_sack; /* Start seq of globally highest revd SACK 335 struct sk_buff *highest_sack; /* highest skb with SACK received
336 * (validity guaranteed only if sacked_out > 0) */ 336 * (validity guaranteed only if
337 * sacked_out > 0)
338 */
337 339
338 /* from STCP, retrans queue hinting */ 340 /* from STCP, retrans queue hinting */
339 struct sk_buff* lost_skb_hint; 341 struct sk_buff* lost_skb_hint;
@@ -341,10 +343,7 @@ struct tcp_sock {
341 struct sk_buff *scoreboard_skb_hint; 343 struct sk_buff *scoreboard_skb_hint;
342 struct sk_buff *retransmit_skb_hint; 344 struct sk_buff *retransmit_skb_hint;
343 struct sk_buff *forward_skb_hint; 345 struct sk_buff *forward_skb_hint;
344 struct sk_buff *fastpath_skb_hint;
345 346
346 int fastpath_cnt_hint; /* Lags behind by current skb's pcount
347 * compared to respective fackets_out */
348 int lost_cnt_hint; 347 int lost_cnt_hint;
349 int retransmit_cnt_hint; 348 int retransmit_cnt_hint;
350 349
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index 1c4eb41dbd89..421323e5a2d6 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -7,12 +7,26 @@
7#ifndef _LINUX_THREAD_INFO_H 7#ifndef _LINUX_THREAD_INFO_H
8#define _LINUX_THREAD_INFO_H 8#define _LINUX_THREAD_INFO_H
9 9
10#include <linux/types.h>
11
10/* 12/*
11 * System call restart block. 13 * System call restart block.
12 */ 14 */
13struct restart_block { 15struct restart_block {
14 long (*fn)(struct restart_block *); 16 long (*fn)(struct restart_block *);
15 unsigned long arg0, arg1, arg2, arg3; 17 union {
18 struct {
19 unsigned long arg0, arg1, arg2, arg3;
20 };
21 /* For futex_wait */
22 struct {
23 u32 *uaddr;
24 u32 val;
25 u32 flags;
26 u32 bitset;
27 u64 time;
28 } futex;
29 };
16}; 30};
17 31
18extern long do_no_restart_syscall(struct restart_block *parm); 32extern long do_no_restart_syscall(struct restart_block *parm);
@@ -29,27 +43,27 @@ extern long do_no_restart_syscall(struct restart_block *parm);
29 43
30static inline void set_ti_thread_flag(struct thread_info *ti, int flag) 44static inline void set_ti_thread_flag(struct thread_info *ti, int flag)
31{ 45{
32 set_bit(flag,&ti->flags); 46 set_bit(flag, (unsigned long *)&ti->flags);
33} 47}
34 48
35static inline void clear_ti_thread_flag(struct thread_info *ti, int flag) 49static inline void clear_ti_thread_flag(struct thread_info *ti, int flag)
36{ 50{
37 clear_bit(flag,&ti->flags); 51 clear_bit(flag, (unsigned long *)&ti->flags);
38} 52}
39 53
40static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int flag) 54static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int flag)
41{ 55{
42 return test_and_set_bit(flag,&ti->flags); 56 return test_and_set_bit(flag, (unsigned long *)&ti->flags);
43} 57}
44 58
45static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int flag) 59static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int flag)
46{ 60{
47 return test_and_clear_bit(flag,&ti->flags); 61 return test_and_clear_bit(flag, (unsigned long *)&ti->flags);
48} 62}
49 63
50static inline int test_ti_thread_flag(struct thread_info *ti, int flag) 64static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
51{ 65{
52 return test_bit(flag,&ti->flags); 66 return test_bit(flag, (unsigned long *)&ti->flags);
53} 67}
54 68
55#define set_thread_flag(flag) \ 69#define set_thread_flag(flag) \
diff --git a/include/linux/ticable.h b/include/linux/ticable.h
deleted file mode 100644
index 8c2212086dcd..000000000000
--- a/include/linux/ticable.h
+++ /dev/null
@@ -1,44 +0,0 @@
1/* Hey EMACS -*- linux-c -*-
2 *
3 * tipar/tiser/tiusb - low level driver for handling link cables
4 * designed for Texas Instruments graphing calculators.
5 *
6 * Copyright (C) 2000-2002, Romain Lievin <roms@lpg.ticalc.org>
7 *
8 * Redistribution of this file is permitted under the terms of the GNU
9 * Public License (GPL)
10 */
11
12#ifndef _TICABLE_H
13#define _TICABLE_H 1
14
15/* Internal default constants for the kernel module */
16#define TIMAXTIME 15 /* 1.5 seconds */
17#define IO_DELAY 10 /* 10 micro-seconds */
18
19/* Major & minor number for character devices */
20#define TIPAR_MAJOR 115 /* 0 to 7 */
21#define TIPAR_MINOR 0
22
23#define TISER_MAJOR 115 /* 8 to 15 */
24#define TISER_MINOR 8
25
26#define TIUSB_MAJOR 115 /* 16 to 31 */
27#define TIUSB_MINOR 16
28
29/*
30 * Request values for the 'ioctl' function.
31 */
32#define IOCTL_TIPAR_DELAY _IOW('p', 0xa8, int) /* set delay */
33#define IOCTL_TIPAR_TIMEOUT _IOW('p', 0xa9, int) /* set timeout */
34
35#define IOCTL_TISER_DELAY _IOW('p', 0xa0, int) /* set delay */
36#define IOCTL_TISER_TIMEOUT _IOW('p', 0xa1, int) /* set timeout */
37
38#define IOCTL_TIUSB_TIMEOUT _IOW('N', 0x20, int) /* set timeout */
39#define IOCTL_TIUSB_RESET_DEVICE _IOW('N', 0x21, int) /* reset device */
40#define IOCTL_TIUSB_RESET_PIPES _IOW('N', 0x22, int) /* reset both pipes*/
41#define IOCTL_TIUSB_GET_MAXPS _IOR('N', 0x23, int) /* max packet size */
42#define IOCTL_TIUSB_GET_DEVID _IOR('N', 0x24, int) /* get device type */
43
44#endif /* TICABLE_H */
diff --git a/include/linux/tick.h b/include/linux/tick.h
index f4a1395e05ff..a881c652f7e9 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -39,6 +39,8 @@ enum tick_nohz_mode {
39 * @idle_calls: Total number of idle calls 39 * @idle_calls: Total number of idle calls
40 * @idle_sleeps: Number of idle calls, where the sched tick was stopped 40 * @idle_sleeps: Number of idle calls, where the sched tick was stopped
41 * @idle_entrytime: Time when the idle call was entered 41 * @idle_entrytime: Time when the idle call was entered
42 * @idle_waketime: Time when the idle was interrupted
43 * @idle_exittime: Time when the idle state was left
42 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped 44 * @idle_sleeptime: Sum of the time slept in idle with sched tick stopped
43 * @sleep_length: Duration of the current idle sleep 45 * @sleep_length: Duration of the current idle sleep
44 */ 46 */
@@ -51,8 +53,12 @@ struct tick_sched {
51 unsigned long idle_jiffies; 53 unsigned long idle_jiffies;
52 unsigned long idle_calls; 54 unsigned long idle_calls;
53 unsigned long idle_sleeps; 55 unsigned long idle_sleeps;
56 int idle_active;
54 ktime_t idle_entrytime; 57 ktime_t idle_entrytime;
58 ktime_t idle_waketime;
59 ktime_t idle_exittime;
55 ktime_t idle_sleeptime; 60 ktime_t idle_sleeptime;
61 ktime_t idle_lastupdate;
56 ktime_t sleep_length; 62 ktime_t sleep_length;
57 unsigned long last_jiffies; 63 unsigned long last_jiffies;
58 unsigned long next_jiffies; 64 unsigned long next_jiffies;
@@ -103,6 +109,8 @@ extern void tick_nohz_stop_sched_tick(void);
103extern void tick_nohz_restart_sched_tick(void); 109extern void tick_nohz_restart_sched_tick(void);
104extern void tick_nohz_update_jiffies(void); 110extern void tick_nohz_update_jiffies(void);
105extern ktime_t tick_nohz_get_sleep_length(void); 111extern ktime_t tick_nohz_get_sleep_length(void);
112extern void tick_nohz_stop_idle(int cpu);
113extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);
106# else 114# else
107static inline void tick_nohz_stop_sched_tick(void) { } 115static inline void tick_nohz_stop_sched_tick(void) { }
108static inline void tick_nohz_restart_sched_tick(void) { } 116static inline void tick_nohz_restart_sched_tick(void) { }
@@ -113,6 +121,8 @@ static inline ktime_t tick_nohz_get_sleep_length(void)
113 121
114 return len; 122 return len;
115} 123}
124static inline void tick_nohz_stop_idle(int cpu) { }
125static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return 0; }
116# endif /* !NO_HZ */ 126# endif /* !NO_HZ */
117 127
118#endif 128#endif
diff --git a/include/linux/tifm.h b/include/linux/tifm.h
index 6b3a31805c72..2096b76d0cee 100644
--- a/include/linux/tifm.h
+++ b/include/linux/tifm.h
@@ -120,7 +120,7 @@ struct tifm_adapter {
120 struct completion *finish_me; 120 struct completion *finish_me;
121 121
122 struct work_struct media_switcher; 122 struct work_struct media_switcher;
123 struct class_device cdev; 123 struct device dev;
124 124
125 void (*eject)(struct tifm_adapter *fm, 125 void (*eject)(struct tifm_adapter *fm,
126 struct tifm_dev *sock); 126 struct tifm_dev *sock);
diff --git a/include/linux/time.h b/include/linux/time.h
index b04136d60a2f..ceaab9fff155 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -122,6 +122,7 @@ extern void monotonic_to_bootbased(struct timespec *ts);
122extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 122extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
123extern int timekeeping_is_continuous(void); 123extern int timekeeping_is_continuous(void);
124extern void update_wall_time(void); 124extern void update_wall_time(void);
125extern void update_xtime_cache(u64 nsec);
125 126
126/** 127/**
127 * timespec_to_ns - Convert timespec to nanoseconds 128 * timespec_to_ns - Convert timespec to nanoseconds
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 78cf899b4409..de0e71359ede 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -5,7 +5,7 @@
5#include <linux/ktime.h> 5#include <linux/ktime.h>
6#include <linux/stddef.h> 6#include <linux/stddef.h>
7 7
8struct tvec_t_base_s; 8struct tvec_base;
9 9
10struct timer_list { 10struct timer_list {
11 struct list_head entry; 11 struct list_head entry;
@@ -14,7 +14,7 @@ struct timer_list {
14 void (*function)(unsigned long); 14 void (*function)(unsigned long);
15 unsigned long data; 15 unsigned long data;
16 16
17 struct tvec_t_base_s *base; 17 struct tvec_base *base;
18#ifdef CONFIG_TIMER_STATS 18#ifdef CONFIG_TIMER_STATS
19 void *start_site; 19 void *start_site;
20 char start_comm[16]; 20 char start_comm[16];
@@ -22,7 +22,7 @@ struct timer_list {
22#endif 22#endif
23}; 23};
24 24
25extern struct tvec_t_base_s boot_tvec_bases; 25extern struct tvec_base boot_tvec_bases;
26 26
27#define TIMER_INITIALIZER(_function, _expires, _data) { \ 27#define TIMER_INITIALIZER(_function, _expires, _data) { \
28 .function = (_function), \ 28 .function = (_function), \
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 37ac3ff90faf..24c6a2b59511 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -137,6 +137,7 @@ struct timex {
137#define ADJ_TIMECONST 0x0020 /* pll time constant */ 137#define ADJ_TIMECONST 0x0020 /* pll time constant */
138#define ADJ_TICK 0x4000 /* tick value */ 138#define ADJ_TICK 0x4000 /* tick value */
139#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ 139#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */
140#define ADJ_OFFSET_SS_READ 0xa001 /* read-only adjtime */
140 141
141/* xntp 3.4 compatibility names */ 142/* xntp 3.4 compatibility names */
142#define MOD_OFFSET ADJ_OFFSET 143#define MOD_OFFSET ADJ_OFFSET
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 47729f18bfdf..2352f46160d3 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2002, IBM Corp. 6 * Copyright (C) 2002, IBM Corp.
7 * 7 *
8 * All rights reserved. 8 * All rights reserved.
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
@@ -103,6 +103,7 @@
103 .forkexec_idx = 0, \ 103 .forkexec_idx = 0, \
104 .flags = SD_LOAD_BALANCE \ 104 .flags = SD_LOAD_BALANCE \
105 | SD_BALANCE_NEWIDLE \ 105 | SD_BALANCE_NEWIDLE \
106 | SD_BALANCE_FORK \
106 | SD_BALANCE_EXEC \ 107 | SD_BALANCE_EXEC \
107 | SD_WAKE_AFFINE \ 108 | SD_WAKE_AFFINE \
108 | SD_WAKE_IDLE \ 109 | SD_WAKE_IDLE \
@@ -134,6 +135,7 @@
134 .forkexec_idx = 1, \ 135 .forkexec_idx = 1, \
135 .flags = SD_LOAD_BALANCE \ 136 .flags = SD_LOAD_BALANCE \
136 | SD_BALANCE_NEWIDLE \ 137 | SD_BALANCE_NEWIDLE \
138 | SD_BALANCE_FORK \
137 | SD_BALANCE_EXEC \ 139 | SD_BALANCE_EXEC \
138 | SD_WAKE_AFFINE \ 140 | SD_WAKE_AFFINE \
139 | SD_WAKE_IDLE \ 141 | SD_WAKE_IDLE \
@@ -165,6 +167,7 @@
165 .forkexec_idx = 1, \ 167 .forkexec_idx = 1, \
166 .flags = SD_LOAD_BALANCE \ 168 .flags = SD_LOAD_BALANCE \
167 | SD_BALANCE_NEWIDLE \ 169 | SD_BALANCE_NEWIDLE \
170 | SD_BALANCE_FORK \
168 | SD_BALANCE_EXEC \ 171 | SD_BALANCE_EXEC \
169 | SD_WAKE_AFFINE \ 172 | SD_WAKE_AFFINE \
170 | BALANCE_FOR_PKG_POWER,\ 173 | BALANCE_FOR_PKG_POWER,\
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 56164d7ba0ad..402de892b3ed 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -23,7 +23,7 @@
23 */ 23 */
24#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ 24#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */
25#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ 25#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */
26#define NR_LDISCS 17 26#define NR_LDISCS 18
27 27
28/* line disciplines */ 28/* line disciplines */
29#define N_TTY 0 29#define N_TTY 0
@@ -44,6 +44,7 @@
44#define N_SYNC_PPP 14 /* synchronous PPP */ 44#define N_SYNC_PPP 14 /* synchronous PPP */
45#define N_HCI 15 /* Bluetooth HCI UART */ 45#define N_HCI 15 /* Bluetooth HCI UART */
46#define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */ 46#define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */
47#define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */
47 48
48/* 49/*
49 * This character is the same as _POSIX_VDISABLE: it cannot be used as 50 * This character is the same as _POSIX_VDISABLE: it cannot be used as
@@ -319,6 +320,7 @@ extern speed_t tty_termios_input_baud_rate(struct ktermios *termios);
319extern void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud); 320extern void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud);
320extern void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud); 321extern void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud);
321extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old); 322extern void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old);
323extern int tty_termios_hw_change(struct ktermios *a, struct ktermios *b);
322 324
323extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *); 325extern struct tty_ldisc *tty_ldisc_ref(struct tty_struct *);
324extern void tty_ldisc_deref(struct tty_ldisc *); 326extern void tty_ldisc_deref(struct tty_ldisc *);
@@ -332,7 +334,9 @@ extern void tty_ldisc_flush(struct tty_struct *tty);
332 334
333extern int tty_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 335extern int tty_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
334 unsigned long arg); 336 unsigned long arg);
335 337extern int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
338 unsigned int cmd, unsigned long arg);
339extern int tty_perform_flush(struct tty_struct *tty, unsigned long arg);
336extern dev_t tty_devnum(struct tty_struct *tty); 340extern dev_t tty_devnum(struct tty_struct *tty);
337extern void proc_clear_tty(struct task_struct *p); 341extern void proc_clear_tty(struct task_struct *p);
338extern struct tty_struct *get_current_tty(void); 342extern struct tty_struct *get_current_tty(void);
diff --git a/include/linux/types.h b/include/linux/types.h
index 4f0dad21c917..b94c0e4efe24 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -37,6 +37,8 @@ typedef __kernel_gid32_t gid_t;
37typedef __kernel_uid16_t uid16_t; 37typedef __kernel_uid16_t uid16_t;
38typedef __kernel_gid16_t gid16_t; 38typedef __kernel_gid16_t gid16_t;
39 39
40typedef unsigned long uintptr_t;
41
40#ifdef CONFIG_UID16 42#ifdef CONFIG_UID16
41/* This is defined by include/asm-{arch}/posix_types.h */ 43/* This is defined by include/asm-{arch}/posix_types.h */
42typedef __kernel_old_uid_t old_uid_t; 44typedef __kernel_old_uid_t old_uid_t;
@@ -124,7 +126,7 @@ typedef __s64 int64_t;
124#endif 126#endif
125 127
126/* this is a special 64bit data type that is 8-byte aligned */ 128/* this is a special 64bit data type that is 8-byte aligned */
127#define aligned_u64 unsigned long long __attribute__((aligned(8))) 129#define aligned_u64 __u64 __attribute__((aligned(8)))
128#define aligned_be64 __be64 __attribute__((aligned(8))) 130#define aligned_be64 __be64 __attribute__((aligned(8)))
129#define aligned_le64 __le64 __attribute__((aligned(8))) 131#define aligned_le64 __le64 __attribute__((aligned(8)))
130 132
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index 44c28e94df50..973386d439da 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -18,20 +18,22 @@
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20 20
21struct uio_map;
22
21/** 23/**
22 * struct uio_mem - description of a UIO memory region 24 * struct uio_mem - description of a UIO memory region
23 * @kobj: kobject for this mapping
24 * @addr: address of the device's memory 25 * @addr: address of the device's memory
25 * @size: size of IO 26 * @size: size of IO
26 * @memtype: type of memory addr points to 27 * @memtype: type of memory addr points to
27 * @internal_addr: ioremap-ped version of addr, for driver internal use 28 * @internal_addr: ioremap-ped version of addr, for driver internal use
29 * @map: for use by the UIO core only.
28 */ 30 */
29struct uio_mem { 31struct uio_mem {
30 struct kobject kobj;
31 unsigned long addr; 32 unsigned long addr;
32 unsigned long size; 33 unsigned long size;
33 int memtype; 34 int memtype;
34 void __iomem *internal_addr; 35 void __iomem *internal_addr;
36 struct uio_map *map;
35}; 37};
36 38
37#define MAX_UIO_MAPS 5 39#define MAX_UIO_MAPS 5
diff --git a/include/linux/usb.h b/include/linux/usb.h
index c5c8f169d3cf..2372e2e6b527 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -107,6 +107,7 @@ enum usb_interface_condition {
107 * @condition: binding state of the interface: not bound, binding 107 * @condition: binding state of the interface: not bound, binding
108 * (in probe()), bound to a driver, or unbinding (in disconnect()) 108 * (in probe()), bound to a driver, or unbinding (in disconnect())
109 * @is_active: flag set when the interface is bound and not suspended. 109 * @is_active: flag set when the interface is bound and not suspended.
110 * @sysfs_files_created: sysfs attributes exist
110 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup 111 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
111 * capability during autosuspend. 112 * capability during autosuspend.
112 * @dev: driver model's view of this device 113 * @dev: driver model's view of this device
@@ -157,22 +158,23 @@ struct usb_interface {
157 * bound to */ 158 * bound to */
158 enum usb_interface_condition condition; /* state of binding */ 159 enum usb_interface_condition condition; /* state of binding */
159 unsigned is_active:1; /* the interface is not suspended */ 160 unsigned is_active:1; /* the interface is not suspended */
161 unsigned sysfs_files_created:1; /* the sysfs attributes exist */
160 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ 162 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
161 163
162 struct device dev; /* interface specific device info */ 164 struct device dev; /* interface specific device info */
163 struct device *usb_dev; /* pointer to the usb class's device, if any */ 165 struct device *usb_dev;
164 int pm_usage_cnt; /* usage counter for autosuspend */ 166 int pm_usage_cnt; /* usage counter for autosuspend */
165}; 167};
166#define to_usb_interface(d) container_of(d, struct usb_interface, dev) 168#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
167#define interface_to_usbdev(intf) \ 169#define interface_to_usbdev(intf) \
168 container_of(intf->dev.parent, struct usb_device, dev) 170 container_of(intf->dev.parent, struct usb_device, dev)
169 171
170static inline void *usb_get_intfdata (struct usb_interface *intf) 172static inline void *usb_get_intfdata(struct usb_interface *intf)
171{ 173{
172 return dev_get_drvdata (&intf->dev); 174 return dev_get_drvdata(&intf->dev);
173} 175}
174 176
175static inline void usb_set_intfdata (struct usb_interface *intf, void *data) 177static inline void usb_set_intfdata(struct usb_interface *intf, void *data)
176{ 178{
177 dev_set_drvdata(&intf->dev, data); 179 dev_set_drvdata(&intf->dev, data);
178} 180}
@@ -273,9 +275,10 @@ struct usb_host_config {
273 275
274int __usb_get_extra_descriptor(char *buffer, unsigned size, 276int __usb_get_extra_descriptor(char *buffer, unsigned size,
275 unsigned char type, void **ptr); 277 unsigned char type, void **ptr);
276#define usb_get_extra_descriptor(ifpoint,type,ptr)\ 278#define usb_get_extra_descriptor(ifpoint, type, ptr) \
277 __usb_get_extra_descriptor((ifpoint)->extra,(ifpoint)->extralen,\ 279 __usb_get_extra_descriptor((ifpoint)->extra, \
278 type,(void**)ptr) 280 (ifpoint)->extralen, \
281 type, (void **)ptr)
279 282
280/* ----------------------------------------------------------------------- */ 283/* ----------------------------------------------------------------------- */
281 284
@@ -316,7 +319,7 @@ struct usb_bus {
316#ifdef CONFIG_USB_DEVICEFS 319#ifdef CONFIG_USB_DEVICEFS
317 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ 320 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
318#endif 321#endif
319 struct class_device *class_dev; /* class device for this bus */ 322 struct device *dev; /* device for this bus */
320 323
321#if defined(CONFIG_USB_MON) 324#if defined(CONFIG_USB_MON)
322 struct mon_bus *mon_bus; /* non-null when associated */ 325 struct mon_bus *mon_bus; /* non-null when associated */
@@ -386,7 +389,7 @@ struct usb_device {
386 unsigned can_submit:1; /* URBs may be submitted */ 389 unsigned can_submit:1; /* URBs may be submitted */
387 unsigned discon_suspended:1; /* Disconnected while suspended */ 390 unsigned discon_suspended:1; /* Disconnected while suspended */
388 unsigned have_langid:1; /* whether string_langid is valid */ 391 unsigned have_langid:1; /* whether string_langid is valid */
389 unsigned authorized:1; /* Policy has determined we can use it */ 392 unsigned authorized:1; /* Policy has said we can use it */
390 unsigned wusb:1; /* Device is Wireless USB */ 393 unsigned wusb:1; /* Device is Wireless USB */
391 int string_langid; /* language ID for strings */ 394 int string_langid; /* language ID for strings */
392 395
@@ -415,7 +418,10 @@ struct usb_device {
415 418
416 int pm_usage_cnt; /* usage counter for autosuspend */ 419 int pm_usage_cnt; /* usage counter for autosuspend */
417 u32 quirks; /* quirks of the whole device */ 420 u32 quirks; /* quirks of the whole device */
418 atomic_t urbnum; /* number of URBs submitted for the whole device */ 421 atomic_t urbnum; /* number of URBs submitted for
422 the whole device */
423
424 unsigned long active_duration; /* total time device is not suspended */
419 425
420#ifdef CONFIG_PM 426#ifdef CONFIG_PM
421 struct delayed_work autosuspend; /* for delayed autosuspends */ 427 struct delayed_work autosuspend; /* for delayed autosuspends */
@@ -423,6 +429,7 @@ struct usb_device {
423 429
424 unsigned long last_busy; /* time of last use */ 430 unsigned long last_busy; /* time of last use */
425 int autosuspend_delay; /* in jiffies */ 431 int autosuspend_delay; /* in jiffies */
432 unsigned long connect_time; /* time device was first connected */
426 433
427 unsigned auto_pm:1; /* autosuspend/resume in progress */ 434 unsigned auto_pm:1; /* autosuspend/resume in progress */
428 unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */ 435 unsigned do_remote_wakeup:1; /* remote wakeup should be enabled */
@@ -496,11 +503,11 @@ static inline void usb_mark_last_busy(struct usb_device *udev)
496/*-------------------------------------------------------------------------*/ 503/*-------------------------------------------------------------------------*/
497 504
498/* for drivers using iso endpoints */ 505/* for drivers using iso endpoints */
499extern int usb_get_current_frame_number (struct usb_device *usb_dev); 506extern int usb_get_current_frame_number(struct usb_device *usb_dev);
500 507
501/* used these for multi-interface device registration */ 508/* used these for multi-interface device registration */
502extern int usb_driver_claim_interface(struct usb_driver *driver, 509extern int usb_driver_claim_interface(struct usb_driver *driver,
503 struct usb_interface *iface, void* priv); 510 struct usb_interface *iface, void *priv);
504 511
505/** 512/**
506 * usb_interface_claimed - returns true iff an interface is claimed 513 * usb_interface_claimed - returns true iff an interface is claimed
@@ -512,7 +519,8 @@ extern int usb_driver_claim_interface(struct usb_driver *driver,
512 * may need to explicitly claim that lock. 519 * may need to explicitly claim that lock.
513 * 520 *
514 */ 521 */
515static inline int usb_interface_claimed(struct usb_interface *iface) { 522static inline int usb_interface_claimed(struct usb_interface *iface)
523{
516 return (iface->dev.driver != NULL); 524 return (iface->dev.driver != NULL);
517} 525}
518 526
@@ -555,12 +563,11 @@ extern struct usb_host_interface *usb_altnum_to_altsetting(
555 * USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are 563 * USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are
556 * high speed, and a different one if they are full or low speed. 564 * high speed, and a different one if they are full or low speed.
557 */ 565 */
558static inline int usb_make_path (struct usb_device *dev, char *buf, 566static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size)
559 size_t size)
560{ 567{
561 int actual; 568 int actual;
562 actual = snprintf (buf, size, "usb-%s-%s", dev->bus->bus_name, 569 actual = snprintf(buf, size, "usb-%s-%s", dev->bus->bus_name,
563 dev->devpath); 570 dev->devpath);
564 return (actual >= (int)size) ? -1 : actual; 571 return (actual >= (int)size) ? -1 : actual;
565} 572}
566 573
@@ -606,7 +613,8 @@ static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
606 * 613 *
607 * Returns true if the endpoint is of type OUT, otherwise it returns false. 614 * Returns true if the endpoint is of type OUT, otherwise it returns false.
608 */ 615 */
609static inline int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd) 616static inline int usb_endpoint_dir_out(
617 const struct usb_endpoint_descriptor *epd)
610{ 618{
611 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT); 619 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
612} 620}
@@ -617,7 +625,8 @@ static inline int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd
617 * 625 *
618 * Returns true if the endpoint is of type bulk, otherwise it returns false. 626 * Returns true if the endpoint is of type bulk, otherwise it returns false.
619 */ 627 */
620static inline int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd) 628static inline int usb_endpoint_xfer_bulk(
629 const struct usb_endpoint_descriptor *epd)
621{ 630{
622 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 631 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
623 USB_ENDPOINT_XFER_BULK); 632 USB_ENDPOINT_XFER_BULK);
@@ -629,7 +638,8 @@ static inline int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *e
629 * 638 *
630 * Returns true if the endpoint is of type control, otherwise it returns false. 639 * Returns true if the endpoint is of type control, otherwise it returns false.
631 */ 640 */
632static inline int usb_endpoint_xfer_control(const struct usb_endpoint_descriptor *epd) 641static inline int usb_endpoint_xfer_control(
642 const struct usb_endpoint_descriptor *epd)
633{ 643{
634 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 644 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
635 USB_ENDPOINT_XFER_CONTROL); 645 USB_ENDPOINT_XFER_CONTROL);
@@ -642,7 +652,8 @@ static inline int usb_endpoint_xfer_control(const struct usb_endpoint_descriptor
642 * Returns true if the endpoint is of type interrupt, otherwise it returns 652 * Returns true if the endpoint is of type interrupt, otherwise it returns
643 * false. 653 * false.
644 */ 654 */
645static inline int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd) 655static inline int usb_endpoint_xfer_int(
656 const struct usb_endpoint_descriptor *epd)
646{ 657{
647 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 658 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
648 USB_ENDPOINT_XFER_INT); 659 USB_ENDPOINT_XFER_INT);
@@ -655,7 +666,8 @@ static inline int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *ep
655 * Returns true if the endpoint is of type isochronous, otherwise it returns 666 * Returns true if the endpoint is of type isochronous, otherwise it returns
656 * false. 667 * false.
657 */ 668 */
658static inline int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd) 669static inline int usb_endpoint_xfer_isoc(
670 const struct usb_endpoint_descriptor *epd)
659{ 671{
660 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 672 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
661 USB_ENDPOINT_XFER_ISOC); 673 USB_ENDPOINT_XFER_ISOC);
@@ -668,7 +680,8 @@ static inline int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *e
668 * Returns true if the endpoint has bulk transfer type and IN direction, 680 * Returns true if the endpoint has bulk transfer type and IN direction,
669 * otherwise it returns false. 681 * otherwise it returns false.
670 */ 682 */
671static inline int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd) 683static inline int usb_endpoint_is_bulk_in(
684 const struct usb_endpoint_descriptor *epd)
672{ 685{
673 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd)); 686 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd));
674} 687}
@@ -680,7 +693,8 @@ static inline int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *
680 * Returns true if the endpoint has bulk transfer type and OUT direction, 693 * Returns true if the endpoint has bulk transfer type and OUT direction,
681 * otherwise it returns false. 694 * otherwise it returns false.
682 */ 695 */
683static inline int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd) 696static inline int usb_endpoint_is_bulk_out(
697 const struct usb_endpoint_descriptor *epd)
684{ 698{
685 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd)); 699 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd));
686} 700}
@@ -692,7 +706,8 @@ static inline int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor
692 * Returns true if the endpoint has interrupt transfer type and IN direction, 706 * Returns true if the endpoint has interrupt transfer type and IN direction,
693 * otherwise it returns false. 707 * otherwise it returns false.
694 */ 708 */
695static inline int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd) 709static inline int usb_endpoint_is_int_in(
710 const struct usb_endpoint_descriptor *epd)
696{ 711{
697 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd)); 712 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd));
698} 713}
@@ -704,7 +719,8 @@ static inline int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *e
704 * Returns true if the endpoint has interrupt transfer type and OUT direction, 719 * Returns true if the endpoint has interrupt transfer type and OUT direction,
705 * otherwise it returns false. 720 * otherwise it returns false.
706 */ 721 */
707static inline int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd) 722static inline int usb_endpoint_is_int_out(
723 const struct usb_endpoint_descriptor *epd)
708{ 724{
709 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd)); 725 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd));
710} 726}
@@ -716,7 +732,8 @@ static inline int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *
716 * Returns true if the endpoint has isochronous transfer type and IN direction, 732 * Returns true if the endpoint has isochronous transfer type and IN direction,
717 * otherwise it returns false. 733 * otherwise it returns false.
718 */ 734 */
719static inline int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd) 735static inline int usb_endpoint_is_isoc_in(
736 const struct usb_endpoint_descriptor *epd)
720{ 737{
721 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd)); 738 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd));
722} 739}
@@ -728,7 +745,8 @@ static inline int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *
728 * Returns true if the endpoint has isochronous transfer type and OUT direction, 745 * Returns true if the endpoint has isochronous transfer type and OUT direction,
729 * otherwise it returns false. 746 * otherwise it returns false.
730 */ 747 */
731static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd) 748static inline int usb_endpoint_is_isoc_out(
749 const struct usb_endpoint_descriptor *epd)
732{ 750{
733 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd)); 751 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd));
734} 752}
@@ -759,8 +777,9 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
759 * specific device. 777 * specific device.
760 */ 778 */
761#define USB_DEVICE(vend,prod) \ 779#define USB_DEVICE(vend,prod) \
762 .match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = (vend), \ 780 .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \
763 .idProduct = (prod) 781 .idVendor = (vend), \
782 .idProduct = (prod)
764/** 783/**
765 * USB_DEVICE_VER - macro used to describe a specific usb device with a 784 * USB_DEVICE_VER - macro used to describe a specific usb device with a
766 * version range 785 * version range
@@ -772,10 +791,12 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
772 * This macro is used to create a struct usb_device_id that matches a 791 * This macro is used to create a struct usb_device_id that matches a
773 * specific device, with a version range. 792 * specific device, with a version range.
774 */ 793 */
775#define USB_DEVICE_VER(vend,prod,lo,hi) \ 794#define USB_DEVICE_VER(vend, prod, lo, hi) \
776 .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, \ 795 .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, \
777 .idVendor = (vend), .idProduct = (prod), \ 796 .idVendor = (vend), \
778 .bcdDevice_lo = (lo), .bcdDevice_hi = (hi) 797 .idProduct = (prod), \
798 .bcdDevice_lo = (lo), \
799 .bcdDevice_hi = (hi)
779 800
780/** 801/**
781 * USB_DEVICE_INTERFACE_PROTOCOL - macro used to describe a usb 802 * USB_DEVICE_INTERFACE_PROTOCOL - macro used to describe a usb
@@ -787,8 +808,9 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
787 * This macro is used to create a struct usb_device_id that matches a 808 * This macro is used to create a struct usb_device_id that matches a
788 * specific interface protocol of devices. 809 * specific interface protocol of devices.
789 */ 810 */
790#define USB_DEVICE_INTERFACE_PROTOCOL(vend,prod,pr) \ 811#define USB_DEVICE_INTERFACE_PROTOCOL(vend, prod, pr) \
791 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_PROTOCOL, \ 812 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
813 USB_DEVICE_ID_MATCH_INT_PROTOCOL, \
792 .idVendor = (vend), \ 814 .idVendor = (vend), \
793 .idProduct = (prod), \ 815 .idProduct = (prod), \
794 .bInterfaceProtocol = (pr) 816 .bInterfaceProtocol = (pr)
@@ -802,12 +824,14 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
802 * This macro is used to create a struct usb_device_id that matches a 824 * This macro is used to create a struct usb_device_id that matches a
803 * specific class of devices. 825 * specific class of devices.
804 */ 826 */
805#define USB_DEVICE_INFO(cl,sc,pr) \ 827#define USB_DEVICE_INFO(cl, sc, pr) \
806 .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, .bDeviceClass = (cl), \ 828 .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, \
807 .bDeviceSubClass = (sc), .bDeviceProtocol = (pr) 829 .bDeviceClass = (cl), \
830 .bDeviceSubClass = (sc), \
831 .bDeviceProtocol = (pr)
808 832
809/** 833/**
810 * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces 834 * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces
811 * @cl: bInterfaceClass value 835 * @cl: bInterfaceClass value
812 * @sc: bInterfaceSubClass value 836 * @sc: bInterfaceSubClass value
813 * @pr: bInterfaceProtocol value 837 * @pr: bInterfaceProtocol value
@@ -815,9 +839,11 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
815 * This macro is used to create a struct usb_device_id that matches a 839 * This macro is used to create a struct usb_device_id that matches a
816 * specific class of interfaces. 840 * specific class of interfaces.
817 */ 841 */
818#define USB_INTERFACE_INFO(cl,sc,pr) \ 842#define USB_INTERFACE_INFO(cl, sc, pr) \
819 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, .bInterfaceClass = (cl), \ 843 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, \
820 .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr) 844 .bInterfaceClass = (cl), \
845 .bInterfaceSubClass = (sc), \
846 .bInterfaceProtocol = (pr)
821 847
822/** 848/**
823 * USB_DEVICE_AND_INTERFACE_INFO - macro used to describe a specific usb device 849 * USB_DEVICE_AND_INTERFACE_INFO - macro used to describe a specific usb device
@@ -834,12 +860,14 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
834 * This is especially useful when explicitly matching devices that have 860 * This is especially useful when explicitly matching devices that have
835 * vendor specific bDeviceClass values, but standards-compliant interfaces. 861 * vendor specific bDeviceClass values, but standards-compliant interfaces.
836 */ 862 */
837#define USB_DEVICE_AND_INTERFACE_INFO(vend,prod,cl,sc,pr) \ 863#define USB_DEVICE_AND_INTERFACE_INFO(vend, prod, cl, sc, pr) \
838 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \ 864 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
839 | USB_DEVICE_ID_MATCH_DEVICE, \ 865 | USB_DEVICE_ID_MATCH_DEVICE, \
840 .idVendor = (vend), .idProduct = (prod), \ 866 .idVendor = (vend), \
867 .idProduct = (prod), \
841 .bInterfaceClass = (cl), \ 868 .bInterfaceClass = (cl), \
842 .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr) 869 .bInterfaceSubClass = (sc), \
870 .bInterfaceProtocol = (pr)
843 871
844/* ----------------------------------------------------------------------- */ 872/* ----------------------------------------------------------------------- */
845 873
@@ -1117,7 +1145,7 @@ typedef void (*usb_complete_t)(struct urb *);
1117 * transferred. It will normally be the same as requested, unless 1145 * transferred. It will normally be the same as requested, unless
1118 * either an error was reported or a short read was performed. 1146 * either an error was reported or a short read was performed.
1119 * The URB_SHORT_NOT_OK transfer flag may be used to make such 1147 * The URB_SHORT_NOT_OK transfer flag may be used to make such
1120 * short reads be reported as errors. 1148 * short reads be reported as errors.
1121 * @setup_packet: Only used for control transfers, this points to eight bytes 1149 * @setup_packet: Only used for control transfers, this points to eight bytes
1122 * of setup data. Control transfers always start by sending this data 1150 * of setup data. Control transfers always start by sending this data
1123 * to the device. Then transfer_buffer is read or written, if needed. 1151 * to the device. Then transfer_buffer is read or written, if needed.
@@ -1136,7 +1164,7 @@ typedef void (*usb_complete_t)(struct urb *);
1136 * @complete: Completion handler. This URB is passed as the parameter to the 1164 * @complete: Completion handler. This URB is passed as the parameter to the
1137 * completion function. The completion function may then do what 1165 * completion function. The completion function may then do what
1138 * it likes with the URB, including resubmitting or freeing it. 1166 * it likes with the URB, including resubmitting or freeing it.
1139 * @iso_frame_desc: Used to provide arrays of ISO transfer buffers and to 1167 * @iso_frame_desc: Used to provide arrays of ISO transfer buffers and to
1140 * collect the transfer status for each buffer. 1168 * collect the transfer status for each buffer.
1141 * 1169 *
1142 * This structure identifies USB transfer requests. URBs must be allocated by 1170 * This structure identifies USB transfer requests. URBs must be allocated by
@@ -1240,8 +1268,7 @@ typedef void (*usb_complete_t)(struct urb *);
1240 * when the urb is owned by the hcd, that is, since the call to 1268 * when the urb is owned by the hcd, that is, since the call to
1241 * usb_submit_urb() till the entry into the completion routine. 1269 * usb_submit_urb() till the entry into the completion routine.
1242 */ 1270 */
1243struct urb 1271struct urb {
1244{
1245 /* private: usb core and host controller only fields in the urb */ 1272 /* private: usb core and host controller only fields in the urb */
1246 struct kref kref; /* reference count of the URB */ 1273 struct kref kref; /* reference count of the URB */
1247 void *hcpriv; /* private data for host controller */ 1274 void *hcpriv; /* private data for host controller */
@@ -1252,10 +1279,10 @@ struct urb
1252 /* public: documented fields in the urb that can be used by drivers */ 1279 /* public: documented fields in the urb that can be used by drivers */
1253 struct list_head urb_list; /* list head for use by the urb's 1280 struct list_head urb_list; /* list head for use by the urb's
1254 * current owner */ 1281 * current owner */
1255 struct list_head anchor_list; /* the URB may be anchored by the driver */ 1282 struct list_head anchor_list; /* the URB may be anchored */
1256 struct usb_anchor *anchor; 1283 struct usb_anchor *anchor;
1257 struct usb_device *dev; /* (in) pointer to associated device */ 1284 struct usb_device *dev; /* (in) pointer to associated device */
1258 struct usb_host_endpoint *ep; /* (internal) pointer to endpoint struct */ 1285 struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */
1259 unsigned int pipe; /* (in) pipe information */ 1286 unsigned int pipe; /* (in) pipe information */
1260 int status; /* (return) non-ISO status */ 1287 int status; /* (return) non-ISO status */
1261 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ 1288 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/
@@ -1292,14 +1319,14 @@ struct urb
1292 * Initializes a control urb with the proper information needed to submit 1319 * Initializes a control urb with the proper information needed to submit
1293 * it to a device. 1320 * it to a device.
1294 */ 1321 */
1295static inline void usb_fill_control_urb (struct urb *urb, 1322static inline void usb_fill_control_urb(struct urb *urb,
1296 struct usb_device *dev, 1323 struct usb_device *dev,
1297 unsigned int pipe, 1324 unsigned int pipe,
1298 unsigned char *setup_packet, 1325 unsigned char *setup_packet,
1299 void *transfer_buffer, 1326 void *transfer_buffer,
1300 int buffer_length, 1327 int buffer_length,
1301 usb_complete_t complete_fn, 1328 usb_complete_t complete_fn,
1302 void *context) 1329 void *context)
1303{ 1330{
1304 urb->dev = dev; 1331 urb->dev = dev;
1305 urb->pipe = pipe; 1332 urb->pipe = pipe;
@@ -1323,13 +1350,13 @@ static inline void usb_fill_control_urb (struct urb *urb,
1323 * Initializes a bulk urb with the proper information needed to submit it 1350 * Initializes a bulk urb with the proper information needed to submit it
1324 * to a device. 1351 * to a device.
1325 */ 1352 */
1326static inline void usb_fill_bulk_urb (struct urb *urb, 1353static inline void usb_fill_bulk_urb(struct urb *urb,
1327 struct usb_device *dev, 1354 struct usb_device *dev,
1328 unsigned int pipe, 1355 unsigned int pipe,
1329 void *transfer_buffer, 1356 void *transfer_buffer,
1330 int buffer_length, 1357 int buffer_length,
1331 usb_complete_t complete_fn, 1358 usb_complete_t complete_fn,
1332 void *context) 1359 void *context)
1333{ 1360{
1334 urb->dev = dev; 1361 urb->dev = dev;
1335 urb->pipe = pipe; 1362 urb->pipe = pipe;
@@ -1357,14 +1384,14 @@ static inline void usb_fill_bulk_urb (struct urb *urb,
1357 * the endpoint interval, and express polling intervals in microframes 1384 * the endpoint interval, and express polling intervals in microframes
1358 * (eight per millisecond) rather than in frames (one per millisecond). 1385 * (eight per millisecond) rather than in frames (one per millisecond).
1359 */ 1386 */
1360static inline void usb_fill_int_urb (struct urb *urb, 1387static inline void usb_fill_int_urb(struct urb *urb,
1361 struct usb_device *dev, 1388 struct usb_device *dev,
1362 unsigned int pipe, 1389 unsigned int pipe,
1363 void *transfer_buffer, 1390 void *transfer_buffer,
1364 int buffer_length, 1391 int buffer_length,
1365 usb_complete_t complete_fn, 1392 usb_complete_t complete_fn,
1366 void *context, 1393 void *context,
1367 int interval) 1394 int interval)
1368{ 1395{
1369 urb->dev = dev; 1396 urb->dev = dev;
1370 urb->pipe = pipe; 1397 urb->pipe = pipe;
@@ -1417,15 +1444,15 @@ static inline int usb_urb_dir_out(struct urb *urb)
1417 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT; 1444 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT;
1418} 1445}
1419 1446
1420void *usb_buffer_alloc (struct usb_device *dev, size_t size, 1447void *usb_buffer_alloc(struct usb_device *dev, size_t size,
1421 gfp_t mem_flags, dma_addr_t *dma); 1448 gfp_t mem_flags, dma_addr_t *dma);
1422void usb_buffer_free (struct usb_device *dev, size_t size, 1449void usb_buffer_free(struct usb_device *dev, size_t size,
1423 void *addr, dma_addr_t dma); 1450 void *addr, dma_addr_t dma);
1424 1451
1425#if 0 1452#if 0
1426struct urb *usb_buffer_map (struct urb *urb); 1453struct urb *usb_buffer_map(struct urb *urb);
1427void usb_buffer_dmasync (struct urb *urb); 1454void usb_buffer_dmasync(struct urb *urb);
1428void usb_buffer_unmap (struct urb *urb); 1455void usb_buffer_unmap(struct urb *urb);
1429#endif 1456#endif
1430 1457
1431struct scatterlist; 1458struct scatterlist;
@@ -1497,7 +1524,7 @@ struct usb_sg_request {
1497 int status; 1524 int status;
1498 size_t bytes; 1525 size_t bytes;
1499 1526
1500 /* 1527 /*
1501 * members below are private: to usbcore, 1528 * members below are private: to usbcore,
1502 * and are not provided for driver access! 1529 * and are not provided for driver access!
1503 */ 1530 */
@@ -1515,18 +1542,18 @@ struct usb_sg_request {
1515 struct completion complete; 1542 struct completion complete;
1516}; 1543};
1517 1544
1518int usb_sg_init ( 1545int usb_sg_init(
1519 struct usb_sg_request *io, 1546 struct usb_sg_request *io,
1520 struct usb_device *dev, 1547 struct usb_device *dev,
1521 unsigned pipe, 1548 unsigned pipe,
1522 unsigned period, 1549 unsigned period,
1523 struct scatterlist *sg, 1550 struct scatterlist *sg,
1524 int nents, 1551 int nents,
1525 size_t length, 1552 size_t length,
1526 gfp_t mem_flags 1553 gfp_t mem_flags
1527); 1554);
1528void usb_sg_cancel (struct usb_sg_request *io); 1555void usb_sg_cancel(struct usb_sg_request *io);
1529void usb_sg_wait (struct usb_sg_request *io); 1556void usb_sg_wait(struct usb_sg_request *io);
1530 1557
1531 1558
1532/* ----------------------------------------------------------------------- */ 1559/* ----------------------------------------------------------------------- */
@@ -1583,21 +1610,21 @@ static inline unsigned int __create_pipe(struct usb_device *dev,
1583 1610
1584/* Create various pipes... */ 1611/* Create various pipes... */
1585#define usb_sndctrlpipe(dev,endpoint) \ 1612#define usb_sndctrlpipe(dev,endpoint) \
1586 ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint)) 1613 ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint))
1587#define usb_rcvctrlpipe(dev,endpoint) \ 1614#define usb_rcvctrlpipe(dev,endpoint) \
1588 ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) 1615 ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
1589#define usb_sndisocpipe(dev,endpoint) \ 1616#define usb_sndisocpipe(dev,endpoint) \
1590 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint)) 1617 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint))
1591#define usb_rcvisocpipe(dev,endpoint) \ 1618#define usb_rcvisocpipe(dev,endpoint) \
1592 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) 1619 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
1593#define usb_sndbulkpipe(dev,endpoint) \ 1620#define usb_sndbulkpipe(dev,endpoint) \
1594 ((PIPE_BULK << 30) | __create_pipe(dev,endpoint)) 1621 ((PIPE_BULK << 30) | __create_pipe(dev, endpoint))
1595#define usb_rcvbulkpipe(dev,endpoint) \ 1622#define usb_rcvbulkpipe(dev,endpoint) \
1596 ((PIPE_BULK << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) 1623 ((PIPE_BULK << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
1597#define usb_sndintpipe(dev,endpoint) \ 1624#define usb_sndintpipe(dev,endpoint) \
1598 ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint)) 1625 ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint))
1599#define usb_rcvintpipe(dev,endpoint) \ 1626#define usb_rcvintpipe(dev,endpoint) \
1600 ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) 1627 ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
1601 1628
1602/*-------------------------------------------------------------------------*/ 1629/*-------------------------------------------------------------------------*/
1603 1630
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild
index 6ce42bf9f743..b8cba1dcb2c6 100644
--- a/include/linux/usb/Kbuild
+++ b/include/linux/usb/Kbuild
@@ -1,6 +1,7 @@
1unifdef-y += audio.h 1header-y += audio.h
2unifdef-y += cdc.h 2header-y += cdc.h
3unifdef-y += ch9.h 3header-y += ch9.h
4unifdef-y += gadgetfs.h 4header-y += gadgetfs.h
5unifdef-y += midi.h 5header-y += midi.h
6unifdef-y += g_printer.h
6 7
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
index 6bd235994dc2..2dfeef16b221 100644
--- a/include/linux/usb/audio.h
+++ b/include/linux/usb/audio.h
@@ -27,13 +27,13 @@
27 27
28/* 4.3.2 Class-Specific AC Interface Descriptor */ 28/* 4.3.2 Class-Specific AC Interface Descriptor */
29struct usb_ac_header_descriptor { 29struct usb_ac_header_descriptor {
30 __u8 bLength; // 8+n 30 __u8 bLength; /* 8+n */
31 __u8 bDescriptorType; // USB_DT_CS_INTERFACE 31 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
32 __u8 bDescriptorSubtype; // USB_MS_HEADER 32 __u8 bDescriptorSubtype; /* USB_MS_HEADER */
33 __le16 bcdADC; // 0x0100 33 __le16 bcdADC; /* 0x0100 */
34 __le16 wTotalLength; // includes Unit and Terminal desc. 34 __le16 wTotalLength; /* includes Unit and Terminal desc. */
35 __u8 bInCollection; // n 35 __u8 bInCollection; /* n */
36 __u8 baInterfaceNr[]; // [n] 36 __u8 baInterfaceNr[]; /* [n] */
37} __attribute__ ((packed)); 37} __attribute__ ((packed));
38 38
39#define USB_DT_AC_HEADER_SIZE(n) (8+(n)) 39#define USB_DT_AC_HEADER_SIZE(n) (8+(n))
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h
index 2204ae22c381..94ee4ecf0564 100644
--- a/include/linux/usb/cdc.h
+++ b/include/linux/usb/cdc.h
@@ -29,16 +29,16 @@
29 * Class-Specific descriptors ... there are a couple dozen of them 29 * Class-Specific descriptors ... there are a couple dozen of them
30 */ 30 */
31 31
32#define USB_CDC_HEADER_TYPE 0x00 /* header_desc */ 32#define USB_CDC_HEADER_TYPE 0x00 /* header_desc */
33#define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */ 33#define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */
34#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */ 34#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */
35#define USB_CDC_UNION_TYPE 0x06 /* union_desc */ 35#define USB_CDC_UNION_TYPE 0x06 /* union_desc */
36#define USB_CDC_COUNTRY_TYPE 0x07 36#define USB_CDC_COUNTRY_TYPE 0x07
37#define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */ 37#define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */
38#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */ 38#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */
39#define USB_CDC_WHCM_TYPE 0x11 39#define USB_CDC_WHCM_TYPE 0x11
40#define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */ 40#define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */
41#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */ 41#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */
42#define USB_CDC_DMM_TYPE 0x14 42#define USB_CDC_DMM_TYPE 0x14
43#define USB_CDC_OBEX_TYPE 0x15 43#define USB_CDC_OBEX_TYPE 0x15
44 44
diff --git a/include/linux/usb/g_printer.h b/include/linux/usb/g_printer.h
new file mode 100644
index 000000000000..0c5ea1e3eb98
--- /dev/null
+++ b/include/linux/usb/g_printer.h
@@ -0,0 +1,31 @@
1/*
2 * g_printer.h -- Header file for USB Printer gadget driver
3 *
4 * Copyright (C) 2007 Craig W. Nadler
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21
22#define PRINTER_NOT_ERROR 0x08
23#define PRINTER_SELECTED 0x10
24#define PRINTER_PAPER_EMPTY 0x20
25
26/* The 'g' code is also used by gadgetfs ioctl requests.
27 * Don't add any colliding codes to either driver, and keep
28 * them in unique ranges (size 0x20 for now).
29 */
30#define GADGET_GET_PRINTER_STATUS _IOR('g', 0x21, unsigned char)
31#define GADGET_SET_PRINTER_STATUS _IOWR('g', 0x22, unsigned char)
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index c1527c2ef3cb..aa3047ff00d1 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -70,9 +70,10 @@ struct usb_ep;
70 * 70 *
71 * Bulk endpoints can use any size buffers, and can also be used for interrupt 71 * Bulk endpoints can use any size buffers, and can also be used for interrupt
72 * transfers. interrupt-only endpoints can be much less functional. 72 * transfers. interrupt-only endpoints can be much less functional.
73 *
74 * NOTE: this is analagous to 'struct urb' on the host side, except that
75 * it's thinner and promotes more pre-allocation.
73 */ 76 */
74 // NOTE this is analagous to 'struct urb' on the host side,
75 // except that it's thinner and promotes more pre-allocation.
76 77
77struct usb_request { 78struct usb_request {
78 void *buf; 79 void *buf;
@@ -168,10 +169,10 @@ struct usb_ep {
168 * 169 *
169 * returns zero, or a negative error code. 170 * returns zero, or a negative error code.
170 */ 171 */
171static inline int 172static inline int usb_ep_enable(struct usb_ep *ep,
172usb_ep_enable (struct usb_ep *ep, const struct usb_endpoint_descriptor *desc) 173 const struct usb_endpoint_descriptor *desc)
173{ 174{
174 return ep->ops->enable (ep, desc); 175 return ep->ops->enable(ep, desc);
175} 176}
176 177
177/** 178/**
@@ -186,10 +187,9 @@ usb_ep_enable (struct usb_ep *ep, const struct usb_endpoint_descriptor *desc)
186 * 187 *
187 * returns zero, or a negative error code. 188 * returns zero, or a negative error code.
188 */ 189 */
189static inline int 190static inline int usb_ep_disable(struct usb_ep *ep)
190usb_ep_disable (struct usb_ep *ep)
191{ 191{
192 return ep->ops->disable (ep); 192 return ep->ops->disable(ep);
193} 193}
194 194
195/** 195/**
@@ -206,10 +206,10 @@ usb_ep_disable (struct usb_ep *ep)
206 * 206 *
207 * Returns the request, or null if one could not be allocated. 207 * Returns the request, or null if one could not be allocated.
208 */ 208 */
209static inline struct usb_request * 209static inline struct usb_request *usb_ep_alloc_request(struct usb_ep *ep,
210usb_ep_alloc_request (struct usb_ep *ep, gfp_t gfp_flags) 210 gfp_t gfp_flags)
211{ 211{
212 return ep->ops->alloc_request (ep, gfp_flags); 212 return ep->ops->alloc_request(ep, gfp_flags);
213} 213}
214 214
215/** 215/**
@@ -221,10 +221,10 @@ usb_ep_alloc_request (struct usb_ep *ep, gfp_t gfp_flags)
221 * Caller guarantees the request is not queued, and that it will 221 * Caller guarantees the request is not queued, and that it will
222 * no longer be requeued (or otherwise used). 222 * no longer be requeued (or otherwise used).
223 */ 223 */
224static inline void 224static inline void usb_ep_free_request(struct usb_ep *ep,
225usb_ep_free_request (struct usb_ep *ep, struct usb_request *req) 225 struct usb_request *req)
226{ 226{
227 ep->ops->free_request (ep, req); 227 ep->ops->free_request(ep, req);
228} 228}
229 229
230/** 230/**
@@ -281,10 +281,10 @@ usb_ep_free_request (struct usb_ep *ep, struct usb_request *req)
281 * report errors; errors will also be 281 * report errors; errors will also be
282 * reported when the usb peripheral is disconnected. 282 * reported when the usb peripheral is disconnected.
283 */ 283 */
284static inline int 284static inline int usb_ep_queue(struct usb_ep *ep,
285usb_ep_queue (struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags) 285 struct usb_request *req, gfp_t gfp_flags)
286{ 286{
287 return ep->ops->queue (ep, req, gfp_flags); 287 return ep->ops->queue(ep, req, gfp_flags);
288} 288}
289 289
290/** 290/**
@@ -301,9 +301,9 @@ usb_ep_queue (struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags)
301 * restrictions prevent drivers from supporting configuration changes, 301 * restrictions prevent drivers from supporting configuration changes,
302 * even to configuration zero (a "chapter 9" requirement). 302 * even to configuration zero (a "chapter 9" requirement).
303 */ 303 */
304static inline int usb_ep_dequeue (struct usb_ep *ep, struct usb_request *req) 304static inline int usb_ep_dequeue(struct usb_ep *ep, struct usb_request *req)
305{ 305{
306 return ep->ops->dequeue (ep, req); 306 return ep->ops->dequeue(ep, req);
307} 307}
308 308
309/** 309/**
@@ -327,10 +327,9 @@ static inline int usb_ep_dequeue (struct usb_ep *ep, struct usb_request *req)
327 * transfer requests are still queued, or if the controller hardware 327 * transfer requests are still queued, or if the controller hardware
328 * (usually a FIFO) still holds bytes that the host hasn't collected. 328 * (usually a FIFO) still holds bytes that the host hasn't collected.
329 */ 329 */
330static inline int 330static inline int usb_ep_set_halt(struct usb_ep *ep)
331usb_ep_set_halt (struct usb_ep *ep)
332{ 331{
333 return ep->ops->set_halt (ep, 1); 332 return ep->ops->set_halt(ep, 1);
334} 333}
335 334
336/** 335/**
@@ -346,10 +345,9 @@ usb_ep_set_halt (struct usb_ep *ep)
346 * Note that some hardware can't support this request (like pxa2xx_udc), 345 * Note that some hardware can't support this request (like pxa2xx_udc),
347 * and accordingly can't correctly implement interface altsettings. 346 * and accordingly can't correctly implement interface altsettings.
348 */ 347 */
349static inline int 348static inline int usb_ep_clear_halt(struct usb_ep *ep)
350usb_ep_clear_halt (struct usb_ep *ep)
351{ 349{
352 return ep->ops->set_halt (ep, 0); 350 return ep->ops->set_halt(ep, 0);
353} 351}
354 352
355/** 353/**
@@ -367,11 +365,10 @@ usb_ep_clear_halt (struct usb_ep *ep)
367 * errno if the endpoint doesn't use a FIFO or doesn't support such 365 * errno if the endpoint doesn't use a FIFO or doesn't support such
368 * precise handling. 366 * precise handling.
369 */ 367 */
370static inline int 368static inline int usb_ep_fifo_status(struct usb_ep *ep)
371usb_ep_fifo_status (struct usb_ep *ep)
372{ 369{
373 if (ep->ops->fifo_status) 370 if (ep->ops->fifo_status)
374 return ep->ops->fifo_status (ep); 371 return ep->ops->fifo_status(ep);
375 else 372 else
376 return -EOPNOTSUPP; 373 return -EOPNOTSUPP;
377} 374}
@@ -385,11 +382,10 @@ usb_ep_fifo_status (struct usb_ep *ep)
385 * must never be used except when endpoint is not being used for any 382 * must never be used except when endpoint is not being used for any
386 * protocol translation. 383 * protocol translation.
387 */ 384 */
388static inline void 385static inline void usb_ep_fifo_flush(struct usb_ep *ep)
389usb_ep_fifo_flush (struct usb_ep *ep)
390{ 386{
391 if (ep->ops->fifo_flush) 387 if (ep->ops->fifo_flush)
392 ep->ops->fifo_flush (ep); 388 ep->ops->fifo_flush(ep);
393} 389}
394 390
395 391
@@ -469,10 +465,10 @@ struct usb_gadget {
469 struct device dev; 465 struct device dev;
470}; 466};
471 467
472static inline void set_gadget_data (struct usb_gadget *gadget, void *data) 468static inline void set_gadget_data(struct usb_gadget *gadget, void *data)
473 { dev_set_drvdata (&gadget->dev, data); } 469 { dev_set_drvdata(&gadget->dev, data); }
474static inline void *get_gadget_data (struct usb_gadget *gadget) 470static inline void *get_gadget_data(struct usb_gadget *gadget)
475 { return dev_get_drvdata (&gadget->dev); } 471 { return dev_get_drvdata(&gadget->dev); }
476 472
477/* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */ 473/* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */
478#define gadget_for_each_ep(tmp,gadget) \ 474#define gadget_for_each_ep(tmp,gadget) \
@@ -511,7 +507,6 @@ static inline int gadget_is_otg(struct usb_gadget *g)
511#endif 507#endif
512} 508}
513 509
514
515/** 510/**
516 * usb_gadget_frame_number - returns the current frame number 511 * usb_gadget_frame_number - returns the current frame number
517 * @gadget: controller that reports the frame number 512 * @gadget: controller that reports the frame number
@@ -519,9 +514,9 @@ static inline int gadget_is_otg(struct usb_gadget *g)
519 * Returns the usb frame number, normally eleven bits from a SOF packet, 514 * Returns the usb frame number, normally eleven bits from a SOF packet,
520 * or negative errno if this device doesn't support this capability. 515 * or negative errno if this device doesn't support this capability.
521 */ 516 */
522static inline int usb_gadget_frame_number (struct usb_gadget *gadget) 517static inline int usb_gadget_frame_number(struct usb_gadget *gadget)
523{ 518{
524 return gadget->ops->get_frame (gadget); 519 return gadget->ops->get_frame(gadget);
525} 520}
526 521
527/** 522/**
@@ -537,11 +532,11 @@ static inline int usb_gadget_frame_number (struct usb_gadget *gadget)
537 * even if OTG isn't otherwise in use. OTG devices may also start 532 * even if OTG isn't otherwise in use. OTG devices may also start
538 * remote wakeup even when hosts don't explicitly enable it. 533 * remote wakeup even when hosts don't explicitly enable it.
539 */ 534 */
540static inline int usb_gadget_wakeup (struct usb_gadget *gadget) 535static inline int usb_gadget_wakeup(struct usb_gadget *gadget)
541{ 536{
542 if (!gadget->ops->wakeup) 537 if (!gadget->ops->wakeup)
543 return -EOPNOTSUPP; 538 return -EOPNOTSUPP;
544 return gadget->ops->wakeup (gadget); 539 return gadget->ops->wakeup(gadget);
545} 540}
546 541
547/** 542/**
@@ -553,12 +548,11 @@ static inline int usb_gadget_wakeup (struct usb_gadget *gadget)
553 * 548 *
554 * returns zero on success, else negative errno. 549 * returns zero on success, else negative errno.
555 */ 550 */
556static inline int 551static inline int usb_gadget_set_selfpowered(struct usb_gadget *gadget)
557usb_gadget_set_selfpowered (struct usb_gadget *gadget)
558{ 552{
559 if (!gadget->ops->set_selfpowered) 553 if (!gadget->ops->set_selfpowered)
560 return -EOPNOTSUPP; 554 return -EOPNOTSUPP;
561 return gadget->ops->set_selfpowered (gadget, 1); 555 return gadget->ops->set_selfpowered(gadget, 1);
562} 556}
563 557
564/** 558/**
@@ -571,12 +565,11 @@ usb_gadget_set_selfpowered (struct usb_gadget *gadget)
571 * 565 *
572 * returns zero on success, else negative errno. 566 * returns zero on success, else negative errno.
573 */ 567 */
574static inline int 568static inline int usb_gadget_clear_selfpowered(struct usb_gadget *gadget)
575usb_gadget_clear_selfpowered (struct usb_gadget *gadget)
576{ 569{
577 if (!gadget->ops->set_selfpowered) 570 if (!gadget->ops->set_selfpowered)
578 return -EOPNOTSUPP; 571 return -EOPNOTSUPP;
579 return gadget->ops->set_selfpowered (gadget, 0); 572 return gadget->ops->set_selfpowered(gadget, 0);
580} 573}
581 574
582/** 575/**
@@ -591,12 +584,11 @@ usb_gadget_clear_selfpowered (struct usb_gadget *gadget)
591 * 584 *
592 * Returns zero on success, else negative errno. 585 * Returns zero on success, else negative errno.
593 */ 586 */
594static inline int 587static inline int usb_gadget_vbus_connect(struct usb_gadget *gadget)
595usb_gadget_vbus_connect(struct usb_gadget *gadget)
596{ 588{
597 if (!gadget->ops->vbus_session) 589 if (!gadget->ops->vbus_session)
598 return -EOPNOTSUPP; 590 return -EOPNOTSUPP;
599 return gadget->ops->vbus_session (gadget, 1); 591 return gadget->ops->vbus_session(gadget, 1);
600} 592}
601 593
602/** 594/**
@@ -611,12 +603,11 @@ usb_gadget_vbus_connect(struct usb_gadget *gadget)
611 * 603 *
612 * Returns zero on success, else negative errno. 604 * Returns zero on success, else negative errno.
613 */ 605 */
614static inline int 606static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
615usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
616{ 607{
617 if (!gadget->ops->vbus_draw) 608 if (!gadget->ops->vbus_draw)
618 return -EOPNOTSUPP; 609 return -EOPNOTSUPP;
619 return gadget->ops->vbus_draw (gadget, mA); 610 return gadget->ops->vbus_draw(gadget, mA);
620} 611}
621 612
622/** 613/**
@@ -629,12 +620,11 @@ usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
629 * 620 *
630 * Returns zero on success, else negative errno. 621 * Returns zero on success, else negative errno.
631 */ 622 */
632static inline int 623static inline int usb_gadget_vbus_disconnect(struct usb_gadget *gadget)
633usb_gadget_vbus_disconnect(struct usb_gadget *gadget)
634{ 624{
635 if (!gadget->ops->vbus_session) 625 if (!gadget->ops->vbus_session)
636 return -EOPNOTSUPP; 626 return -EOPNOTSUPP;
637 return gadget->ops->vbus_session (gadget, 0); 627 return gadget->ops->vbus_session(gadget, 0);
638} 628}
639 629
640/** 630/**
@@ -648,12 +638,11 @@ usb_gadget_vbus_disconnect(struct usb_gadget *gadget)
648 * 638 *
649 * Returns zero on success, else negative errno. 639 * Returns zero on success, else negative errno.
650 */ 640 */
651static inline int 641static inline int usb_gadget_connect(struct usb_gadget *gadget)
652usb_gadget_connect (struct usb_gadget *gadget)
653{ 642{
654 if (!gadget->ops->pullup) 643 if (!gadget->ops->pullup)
655 return -EOPNOTSUPP; 644 return -EOPNOTSUPP;
656 return gadget->ops->pullup (gadget, 1); 645 return gadget->ops->pullup(gadget, 1);
657} 646}
658 647
659/** 648/**
@@ -671,16 +660,14 @@ usb_gadget_connect (struct usb_gadget *gadget)
671 * 660 *
672 * Returns zero on success, else negative errno. 661 * Returns zero on success, else negative errno.
673 */ 662 */
674static inline int 663static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
675usb_gadget_disconnect (struct usb_gadget *gadget)
676{ 664{
677 if (!gadget->ops->pullup) 665 if (!gadget->ops->pullup)
678 return -EOPNOTSUPP; 666 return -EOPNOTSUPP;
679 return gadget->ops->pullup (gadget, 0); 667 return gadget->ops->pullup(gadget, 0);
680} 668}
681 669
682 670
683
684/*-------------------------------------------------------------------------*/ 671/*-------------------------------------------------------------------------*/
685 672
686/** 673/**
@@ -764,7 +751,7 @@ struct usb_gadget_driver {
764 void (*suspend)(struct usb_gadget *); 751 void (*suspend)(struct usb_gadget *);
765 void (*resume)(struct usb_gadget *); 752 void (*resume)(struct usb_gadget *);
766 753
767 // FIXME support safe rmmod 754 /* FIXME support safe rmmod */
768 struct device_driver driver; 755 struct device_driver driver;
769}; 756};
770 757
@@ -790,7 +777,7 @@ struct usb_gadget_driver {
790 * the bind() functions will be in init sections. 777 * the bind() functions will be in init sections.
791 * This function must be called in a context that can sleep. 778 * This function must be called in a context that can sleep.
792 */ 779 */
793int usb_gadget_register_driver (struct usb_gadget_driver *driver); 780int usb_gadget_register_driver(struct usb_gadget_driver *driver);
794 781
795/** 782/**
796 * usb_gadget_unregister_driver - unregister a gadget driver 783 * usb_gadget_unregister_driver - unregister a gadget driver
@@ -805,7 +792,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver);
805 * will in in exit sections, so may not be linked in some kernels. 792 * will in in exit sections, so may not be linked in some kernels.
806 * This function must be called in a context that can sleep. 793 * This function must be called in a context that can sleep.
807 */ 794 */
808int usb_gadget_unregister_driver (struct usb_gadget_driver *driver); 795int usb_gadget_unregister_driver(struct usb_gadget_driver *driver);
809 796
810/*-------------------------------------------------------------------------*/ 797/*-------------------------------------------------------------------------*/
811 798
@@ -838,7 +825,7 @@ struct usb_gadget_strings {
838}; 825};
839 826
840/* put descriptor for string with that id into buf (buflen >= 256) */ 827/* put descriptor for string with that id into buf (buflen >= 256) */
841int usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf); 828int usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf);
842 829
843/*-------------------------------------------------------------------------*/ 830/*-------------------------------------------------------------------------*/
844 831
@@ -856,10 +843,10 @@ int usb_gadget_config_buf(const struct usb_config_descriptor *config,
856 843
857/* utility wrapping a simple endpoint selection policy */ 844/* utility wrapping a simple endpoint selection policy */
858 845
859extern struct usb_ep *usb_ep_autoconfig (struct usb_gadget *, 846extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,
860 struct usb_endpoint_descriptor *) __devinit; 847 struct usb_endpoint_descriptor *) __devinit;
861 848
862extern void usb_ep_autoconfig_reset (struct usb_gadget *) __devinit; 849extern void usb_ep_autoconfig_reset(struct usb_gadget *) __devinit;
863 850
864#endif /* __KERNEL__ */ 851#endif /* __KERNEL__ */
865 852
diff --git a/include/linux/usb/gadgetfs.h b/include/linux/usb/gadgetfs.h
index e8654c338729..c291ab1af747 100644
--- a/include/linux/usb/gadgetfs.h
+++ b/include/linux/usb/gadgetfs.h
@@ -36,7 +36,7 @@ enum usb_gadgetfs_event_type {
36 GADGETFS_DISCONNECT, 36 GADGETFS_DISCONNECT,
37 GADGETFS_SETUP, 37 GADGETFS_SETUP,
38 GADGETFS_SUSPEND, 38 GADGETFS_SUSPEND,
39 // and likely more ! 39 /* and likely more ! */
40}; 40};
41 41
42/* NOTE: this structure must stay the same size and layout on 42/* NOTE: this structure must stay the same size and layout on
@@ -44,21 +44,28 @@ enum usb_gadgetfs_event_type {
44 */ 44 */
45struct usb_gadgetfs_event { 45struct usb_gadgetfs_event {
46 union { 46 union {
47 // NOP, DISCONNECT, SUSPEND: nothing 47 /* NOP, DISCONNECT, SUSPEND: nothing
48 // ... some hardware can't report disconnection 48 * ... some hardware can't report disconnection
49 */
49 50
50 // CONNECT: just the speed 51 /* CONNECT: just the speed */
51 enum usb_device_speed speed; 52 enum usb_device_speed speed;
52 53
53 // SETUP: packet; DATA phase i/o precedes next event 54 /* SETUP: packet; DATA phase i/o precedes next event
54 // (setup.bmRequestType & USB_DIR_IN) flags direction 55 *(setup.bmRequestType & USB_DIR_IN) flags direction
55 // ... includes SET_CONFIGURATION, SET_INTERFACE 56 * ... includes SET_CONFIGURATION, SET_INTERFACE
57 */
56 struct usb_ctrlrequest setup; 58 struct usb_ctrlrequest setup;
57 } u; 59 } u;
58 enum usb_gadgetfs_event_type type; 60 enum usb_gadgetfs_event_type type;
59}; 61};
60 62
61 63
64/* The 'g' code is also used by printer gadget ioctl requests.
65 * Don't add any colliding codes to either driver, and keep
66 * them in unique ranges (size 0x20 for now).
67 */
68
62/* endpoint ioctls */ 69/* endpoint ioctls */
63 70
64/* IN transfers may be reported to the gadget driver as complete 71/* IN transfers may be reported to the gadget driver as complete
@@ -68,14 +75,14 @@ struct usb_gadgetfs_event {
68 * THIS returns how many bytes are "unclaimed" in the endpoint fifo 75 * THIS returns how many bytes are "unclaimed" in the endpoint fifo
69 * (needed for precise fault handling, when the hardware allows it) 76 * (needed for precise fault handling, when the hardware allows it)
70 */ 77 */
71#define GADGETFS_FIFO_STATUS _IO('g',1) 78#define GADGETFS_FIFO_STATUS _IO('g', 1)
72 79
73/* discards any unclaimed data in the fifo. */ 80/* discards any unclaimed data in the fifo. */
74#define GADGETFS_FIFO_FLUSH _IO('g',2) 81#define GADGETFS_FIFO_FLUSH _IO('g', 2)
75 82
76/* resets endpoint halt+toggle; used to implement set_interface. 83/* resets endpoint halt+toggle; used to implement set_interface.
77 * some hardware (like pxa2xx) can't support this. 84 * some hardware (like pxa2xx) can't support this.
78 */ 85 */
79#define GADGETFS_CLEAR_HALT _IO('g',3) 86#define GADGETFS_CLEAR_HALT _IO('g', 3)
80 87
81#endif /* __LINUX_USB_GADGETFS_H */ 88#endif /* __LINUX_USB_GADGETFS_H */
diff --git a/include/linux/usb/iowarrior.h b/include/linux/usb/iowarrior.h
index cbbe020a4f5c..de6f380e17a2 100644
--- a/include/linux/usb/iowarrior.h
+++ b/include/linux/usb/iowarrior.h
@@ -14,14 +14,23 @@
14 this information. 14 this information.
15*/ 15*/
16struct iowarrior_info { 16struct iowarrior_info {
17 __u32 vendor; /* vendor id : supposed to be USB_VENDOR_ID_CODEMERCS in all cases */ 17 /* vendor id : supposed to be USB_VENDOR_ID_CODEMERCS in all cases */
18 __u32 product; /* product id : depends on type of chip (USB_DEVICE_ID_CODEMERCS_XXXXX) */ 18 __u32 vendor;
19 __u8 serial[9]; /* the serial number of our chip (if a serial-number is not available this is empty string) */ 19 /* product id : depends on type of chip (USB_DEVICE_ID_CODEMERCS_X) */
20 __u32 revision; /* revision number of the chip */ 20 __u32 product;
21 __u32 speed; /* USB-speed of the device (0=UNKNOWN, 1=LOW, 2=FULL 3=HIGH) */ 21 /* the serial number of our chip (if a serial-number is not available
22 __u32 power; /* power consumption of the device in mA */ 22 * this is empty string) */
23 __u32 if_num; /* the number of the endpoint */ 23 __u8 serial[9];
24 __u32 report_size; /* size of the data-packets on this interface */ 24 /* revision number of the chip */
25 __u32 revision;
26 /* USB-speed of the device (0=UNKNOWN, 1=LOW, 2=FULL 3=HIGH) */
27 __u32 speed;
28 /* power consumption of the device in mA */
29 __u32 power;
30 /* the number of the endpoint */
31 __u32 if_num;
32 /* size of the data-packets on this interface */
33 __u32 report_size;
25}; 34};
26 35
27/* 36/*
diff --git a/include/linux/usb/isp116x.h b/include/linux/usb/isp116x.h
index 436dd8a2b64a..67d2826f34fe 100644
--- a/include/linux/usb/isp116x.h
+++ b/include/linux/usb/isp116x.h
@@ -25,5 +25,5 @@ struct isp116x_platform_data {
25 300ns delay between access to ADDR_REG and DATA_REG 25 300ns delay between access to ADDR_REG and DATA_REG
26 OE, WE MUST NOT be changed during these intervals 26 OE, WE MUST NOT be changed during these intervals
27 */ 27 */
28 void (*delay) (struct device * dev, int delay); 28 void (*delay) (struct device *dev, int delay);
29}; 29};
diff --git a/include/linux/usb/midi.h b/include/linux/usb/midi.h
index 11a97d5ffd34..80624c562921 100644
--- a/include/linux/usb/midi.h
+++ b/include/linux/usb/midi.h
@@ -47,9 +47,9 @@ struct usb_ms_header_descriptor {
47/* 6.1.2.2 MIDI IN Jack Descriptor */ 47/* 6.1.2.2 MIDI IN Jack Descriptor */
48struct usb_midi_in_jack_descriptor { 48struct usb_midi_in_jack_descriptor {
49 __u8 bLength; 49 __u8 bLength;
50 __u8 bDescriptorType; // USB_DT_CS_INTERFACE 50 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
51 __u8 bDescriptorSubtype; // USB_MS_MIDI_IN_JACK 51 __u8 bDescriptorSubtype; /* USB_MS_MIDI_IN_JACK */
52 __u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL 52 __u8 bJackType; /* USB_MS_EMBEDDED/EXTERNAL */
53 __u8 bJackID; 53 __u8 bJackID;
54 __u8 iJack; 54 __u8 iJack;
55} __attribute__ ((packed)); 55} __attribute__ ((packed));
@@ -64,12 +64,12 @@ struct usb_midi_source_pin {
64/* 6.1.2.3 MIDI OUT Jack Descriptor */ 64/* 6.1.2.3 MIDI OUT Jack Descriptor */
65struct usb_midi_out_jack_descriptor { 65struct usb_midi_out_jack_descriptor {
66 __u8 bLength; 66 __u8 bLength;
67 __u8 bDescriptorType; // USB_DT_CS_INTERFACE 67 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */
68 __u8 bDescriptorSubtype; // USB_MS_MIDI_OUT_JACK 68 __u8 bDescriptorSubtype; /* USB_MS_MIDI_OUT_JACK */
69 __u8 bJackType; // USB_MS_EMBEDDED/EXTERNAL 69 __u8 bJackType; /* USB_MS_EMBEDDED/EXTERNAL */
70 __u8 bJackID; 70 __u8 bJackID;
71 __u8 bNrInputPins; // p 71 __u8 bNrInputPins; /* p */
72 struct usb_midi_source_pin pins[]; // [p] 72 struct usb_midi_source_pin pins[]; /* [p] */
73 /*__u8 iJack; -- ommitted due to variable-sized pins[] */ 73 /*__u8 iJack; -- ommitted due to variable-sized pins[] */
74} __attribute__ ((packed)); 74} __attribute__ ((packed));
75 75
@@ -90,11 +90,11 @@ struct usb_midi_out_jack_descriptor_##p { \
90 90
91/* 6.2.2 Class-Specific MS Bulk Data Endpoint Descriptor */ 91/* 6.2.2 Class-Specific MS Bulk Data Endpoint Descriptor */
92struct usb_ms_endpoint_descriptor { 92struct usb_ms_endpoint_descriptor {
93 __u8 bLength; // 4+n 93 __u8 bLength; /* 4+n */
94 __u8 bDescriptorType; // USB_DT_CS_ENDPOINT 94 __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */
95 __u8 bDescriptorSubtype; // USB_MS_GENERAL 95 __u8 bDescriptorSubtype; /* USB_MS_GENERAL */
96 __u8 bNumEmbMIDIJack; // n 96 __u8 bNumEmbMIDIJack; /* n */
97 __u8 baAssocJackID[]; // [n] 97 __u8 baAssocJackID[]; /* [n] */
98} __attribute__ ((packed)); 98} __attribute__ ((packed));
99 99
100#define USB_DT_MS_ENDPOINT_SIZE(n) (4 + (n)) 100#define USB_DT_MS_ENDPOINT_SIZE(n) (4 + (n))
diff --git a/include/linux/usb/net2280.h b/include/linux/usb/net2280.h
index c602f884f182..ec897cb844ab 100644
--- a/include/linux/usb/net2280.h
+++ b/include/linux/usb/net2280.h
@@ -37,7 +37,7 @@
37 37
38/* main registers, BAR0 + 0x0000 */ 38/* main registers, BAR0 + 0x0000 */
39struct net2280_regs { 39struct net2280_regs {
40 // offset 0x0000 40 /* offset 0x0000 */
41 u32 devinit; 41 u32 devinit;
42#define LOCAL_CLOCK_FREQUENCY 8 42#define LOCAL_CLOCK_FREQUENCY 8
43#define FORCE_PCI_RESET 7 43#define FORCE_PCI_RESET 7
@@ -61,7 +61,7 @@ struct net2280_regs {
61#define EEPROM_WRITE_DATA 0 61#define EEPROM_WRITE_DATA 0
62 u32 eeclkfreq; 62 u32 eeclkfreq;
63 u32 _unused0; 63 u32 _unused0;
64 // offset 0x0010 64 /* offset 0x0010 */
65 65
66 u32 pciirqenb0; /* interrupt PCI master ... */ 66 u32 pciirqenb0; /* interrupt PCI master ... */
67#define SETUP_PACKET_INTERRUPT_ENABLE 7 67#define SETUP_PACKET_INTERRUPT_ENABLE 7
@@ -131,7 +131,7 @@ struct net2280_regs {
131#define RESUME_INTERRUPT_ENABLE 1 131#define RESUME_INTERRUPT_ENABLE 1
132#define SOF_INTERRUPT_ENABLE 0 132#define SOF_INTERRUPT_ENABLE 0
133 133
134 // offset 0x0020 134 /* offset 0x0020 */
135 u32 _unused1; 135 u32 _unused1;
136 u32 usbirqenb1; 136 u32 usbirqenb1;
137#define USB_INTERRUPT_ENABLE 31 137#define USB_INTERRUPT_ENABLE 31
@@ -195,7 +195,7 @@ struct net2280_regs {
195#define SUSPEND_REQUEST_CHANGE_INTERRUPT 2 195#define SUSPEND_REQUEST_CHANGE_INTERRUPT 2
196#define RESUME_INTERRUPT 1 196#define RESUME_INTERRUPT 1
197#define SOF_INTERRUPT 0 197#define SOF_INTERRUPT 0
198 // offset 0x0030 198 /* offset 0x0030 */
199 u32 idxaddr; 199 u32 idxaddr;
200 u32 idxdata; 200 u32 idxdata;
201 u32 fifoctl; 201 u32 fifoctl;
@@ -204,7 +204,7 @@ struct net2280_regs {
204#define PCI_BASE2_SELECT 2 204#define PCI_BASE2_SELECT 2
205#define FIFO_CONFIGURATION_SELECT 0 205#define FIFO_CONFIGURATION_SELECT 0
206 u32 _unused2; 206 u32 _unused2;
207 // offset 0x0040 207 /* offset 0x0040 */
208 u32 memaddr; 208 u32 memaddr;
209#define START 28 209#define START 28
210#define DIRECTION 27 210#define DIRECTION 27
@@ -213,7 +213,7 @@ struct net2280_regs {
213 u32 memdata0; 213 u32 memdata0;
214 u32 memdata1; 214 u32 memdata1;
215 u32 _unused3; 215 u32 _unused3;
216 // offset 0x0050 216 /* offset 0x0050 */
217 u32 gpioctl; 217 u32 gpioctl;
218#define GPIO3_LED_SELECT 12 218#define GPIO3_LED_SELECT 12
219#define GPIO3_INTERRUPT_ENABLE 11 219#define GPIO3_INTERRUPT_ENABLE 11
@@ -237,7 +237,7 @@ struct net2280_regs {
237 237
238/* usb control, BAR0 + 0x0080 */ 238/* usb control, BAR0 + 0x0080 */
239struct net2280_usb_regs { 239struct net2280_usb_regs {
240 // offset 0x0080 240 /* offset 0x0080 */
241 u32 stdrsp; 241 u32 stdrsp;
242#define STALL_UNSUPPORTED_REQUESTS 31 242#define STALL_UNSUPPORTED_REQUESTS 31
243#define SET_TEST_MODE 16 243#define SET_TEST_MODE 16
@@ -275,7 +275,7 @@ struct net2280_usb_regs {
275#define PME_WAKEUP_ENABLE 2 275#define PME_WAKEUP_ENABLE 2
276#define DEVICE_REMOTE_WAKEUP_ENABLE 1 276#define DEVICE_REMOTE_WAKEUP_ENABLE 1
277#define SELF_POWERED_STATUS 0 277#define SELF_POWERED_STATUS 0
278 // offset 0x0090 278 /* offset 0x0090 */
279 u32 usbstat; 279 u32 usbstat;
280#define HIGH_SPEED 7 280#define HIGH_SPEED 7
281#define FULL_SPEED 6 281#define FULL_SPEED 6
@@ -291,7 +291,7 @@ struct net2280_usb_regs {
291#define TERMINATION_SELECT 0 291#define TERMINATION_SELECT 0
292 u32 setup0123; 292 u32 setup0123;
293 u32 setup4567; 293 u32 setup4567;
294 // offset 0x0090 294 /* offset 0x0090 */
295 u32 _unused0; 295 u32 _unused0;
296 u32 ouraddr; 296 u32 ouraddr;
297#define FORCE_IMMEDIATE 7 297#define FORCE_IMMEDIATE 7
@@ -301,7 +301,7 @@ struct net2280_usb_regs {
301 301
302/* pci control, BAR0 + 0x0100 */ 302/* pci control, BAR0 + 0x0100 */
303struct net2280_pci_regs { 303struct net2280_pci_regs {
304 // offset 0x0100 304 /* offset 0x0100 */
305 u32 pcimstctl; 305 u32 pcimstctl;
306#define PCI_ARBITER_PARK_SELECT 13 306#define PCI_ARBITER_PARK_SELECT 13
307#define PCI_MULTI LEVEL_ARBITER 12 307#define PCI_MULTI LEVEL_ARBITER 12
@@ -331,7 +331,7 @@ struct net2280_pci_regs {
331 * that can be loaded into some of these registers. 331 * that can be loaded into some of these registers.
332 */ 332 */
333struct net2280_dma_regs { /* [11.7] */ 333struct net2280_dma_regs { /* [11.7] */
334 // offset 0x0180, 0x01a0, 0x01c0, 0x01e0, 334 /* offset 0x0180, 0x01a0, 0x01c0, 0x01e0, */
335 u32 dmactl; 335 u32 dmactl;
336#define DMA_SCATTER_GATHER_DONE_INTERRUPT_ENABLE 25 336#define DMA_SCATTER_GATHER_DONE_INTERRUPT_ENABLE 25
337#define DMA_CLEAR_COUNT_ENABLE 21 337#define DMA_CLEAR_COUNT_ENABLE 21
@@ -355,7 +355,7 @@ struct net2280_dma_regs { /* [11.7] */
355#define DMA_ABORT 1 355#define DMA_ABORT 1
356#define DMA_START 0 356#define DMA_START 0
357 u32 _unused0 [2]; 357 u32 _unused0 [2];
358 // offset 0x0190, 0x01b0, 0x01d0, 0x01f0, 358 /* offset 0x0190, 0x01b0, 0x01d0, 0x01f0, */
359 u32 dmacount; 359 u32 dmacount;
360#define VALID_BIT 31 360#define VALID_BIT 31
361#define DMA_DIRECTION 30 361#define DMA_DIRECTION 30
@@ -371,9 +371,9 @@ struct net2280_dma_regs { /* [11.7] */
371/* dedicated endpoint registers, BAR0 + 0x0200 */ 371/* dedicated endpoint registers, BAR0 + 0x0200 */
372 372
373struct net2280_dep_regs { /* [11.8] */ 373struct net2280_dep_regs { /* [11.8] */
374 // offset 0x0200, 0x0210, 0x220, 0x230, 0x240 374 /* offset 0x0200, 0x0210, 0x220, 0x230, 0x240 */
375 u32 dep_cfg; 375 u32 dep_cfg;
376 // offset 0x0204, 0x0214, 0x224, 0x234, 0x244 376 /* offset 0x0204, 0x0214, 0x224, 0x234, 0x244 */
377 u32 dep_rsp; 377 u32 dep_rsp;
378 u32 _unused [2]; 378 u32 _unused [2];
379} __attribute__ ((packed)); 379} __attribute__ ((packed));
@@ -383,7 +383,7 @@ struct net2280_dep_regs { /* [11.8] */
383 * ep0 reserved for control; E and F have only 64 bytes of fifo 383 * ep0 reserved for control; E and F have only 64 bytes of fifo
384 */ 384 */
385struct net2280_ep_regs { /* [11.9] */ 385struct net2280_ep_regs { /* [11.9] */
386 // offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0 386 /* offset 0x0300, 0x0320, 0x0340, 0x0360, 0x0380, 0x03a0, 0x03c0 */
387 u32 ep_cfg; 387 u32 ep_cfg;
388#define ENDPOINT_BYTE_COUNT 16 388#define ENDPOINT_BYTE_COUNT 16
389#define ENDPOINT_ENABLE 10 389#define ENDPOINT_ENABLE 10
@@ -435,7 +435,7 @@ struct net2280_ep_regs { /* [11.9] */
435#define DATA_PACKET_TRANSMITTED_INTERRUPT 2 435#define DATA_PACKET_TRANSMITTED_INTERRUPT 2
436#define DATA_OUT_PING_TOKEN_INTERRUPT 1 436#define DATA_OUT_PING_TOKEN_INTERRUPT 1
437#define DATA_IN_TOKEN_INTERRUPT 0 437#define DATA_IN_TOKEN_INTERRUPT 0
438 // offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 438 /* offset 0x0310, 0x0330, 0x0350, 0x0370, 0x0390, 0x03b0, 0x03d0 */
439 u32 ep_avail; 439 u32 ep_avail;
440 u32 ep_data; 440 u32 ep_data;
441 u32 _unused0 [2]; 441 u32 _unused0 [2];
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 9897f7a818c5..e007074ebe41 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -1,4 +1,4 @@
1// include/linux/usb/otg.h 1/* USB OTG (On The Go) defines */
2 2
3/* 3/*
4 * These APIs may be used between USB controllers. USB device drivers 4 * These APIs may be used between USB controllers. USB device drivers
diff --git a/include/linux/usb/rndis_host.h b/include/linux/usb/rndis_host.h
new file mode 100644
index 000000000000..edc1d4a0e272
--- /dev/null
+++ b/include/linux/usb/rndis_host.h
@@ -0,0 +1,274 @@
1/*
2 * Host Side support for RNDIS Networking Links
3 * Copyright (C) 2005 by David Brownell
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20
21#ifndef __RNDIS_HOST_H
22#define __RNDIS_HOST_H
23
24
25/*
26 * CONTROL uses CDC "encapsulated commands" with funky notifications.
27 * - control-out: SEND_ENCAPSULATED
28 * - interrupt-in: RESPONSE_AVAILABLE
29 * - control-in: GET_ENCAPSULATED
30 *
31 * We'll try to ignore the RESPONSE_AVAILABLE notifications.
32 *
33 * REVISIT some RNDIS implementations seem to have curious issues still
34 * to be resolved.
35 */
36struct rndis_msg_hdr {
37 __le32 msg_type; /* RNDIS_MSG_* */
38 __le32 msg_len;
39 // followed by data that varies between messages
40 __le32 request_id;
41 __le32 status;
42 // ... and more
43} __attribute__ ((packed));
44
45/* MS-Windows uses this strange size, but RNDIS spec says 1024 minimum */
46#define CONTROL_BUFFER_SIZE 1025
47
48/* RNDIS defines an (absurdly huge) 10 second control timeout,
49 * but ActiveSync seems to use a more usual 5 second timeout
50 * (which matches the USB 2.0 spec).
51 */
52#define RNDIS_CONTROL_TIMEOUT_MS (5 * 1000)
53
54
55#define ccpu2 __constant_cpu_to_le32
56
57#define RNDIS_MSG_COMPLETION ccpu2(0x80000000)
58
59/* codes for "msg_type" field of rndis messages;
60 * only the data channel uses packet messages (maybe batched);
61 * everything else goes on the control channel.
62 */
63#define RNDIS_MSG_PACKET ccpu2(0x00000001) /* 1-N packets */
64#define RNDIS_MSG_INIT ccpu2(0x00000002)
65#define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION)
66#define RNDIS_MSG_HALT ccpu2(0x00000003)
67#define RNDIS_MSG_QUERY ccpu2(0x00000004)
68#define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION)
69#define RNDIS_MSG_SET ccpu2(0x00000005)
70#define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION)
71#define RNDIS_MSG_RESET ccpu2(0x00000006)
72#define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION)
73#define RNDIS_MSG_INDICATE ccpu2(0x00000007)
74#define RNDIS_MSG_KEEPALIVE ccpu2(0x00000008)
75#define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION)
76
77/* codes for "status" field of completion messages */
78#define RNDIS_STATUS_SUCCESS ccpu2(0x00000000)
79#define RNDIS_STATUS_FAILURE ccpu2(0xc0000001)
80#define RNDIS_STATUS_INVALID_DATA ccpu2(0xc0010015)
81#define RNDIS_STATUS_NOT_SUPPORTED ccpu2(0xc00000bb)
82#define RNDIS_STATUS_MEDIA_CONNECT ccpu2(0x4001000b)
83#define RNDIS_STATUS_MEDIA_DISCONNECT ccpu2(0x4001000c)
84
85/* codes for OID_GEN_PHYSICAL_MEDIUM */
86#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED ccpu2(0x00000000)
87#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN ccpu2(0x00000001)
88#define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM ccpu2(0x00000002)
89#define RNDIS_PHYSICAL_MEDIUM_PHONE_LINE ccpu2(0x00000003)
90#define RNDIS_PHYSICAL_MEDIUM_POWER_LINE ccpu2(0x00000004)
91#define RNDIS_PHYSICAL_MEDIUM_DSL ccpu2(0x00000005)
92#define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL ccpu2(0x00000006)
93#define RNDIS_PHYSICAL_MEDIUM_1394 ccpu2(0x00000007)
94#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN ccpu2(0x00000008)
95#define RNDIS_PHYSICAL_MEDIUM_MAX ccpu2(0x00000009)
96
97struct rndis_data_hdr {
98 __le32 msg_type; /* RNDIS_MSG_PACKET */
99 __le32 msg_len; // rndis_data_hdr + data_len + pad
100 __le32 data_offset; // 36 -- right after header
101 __le32 data_len; // ... real packet size
102
103 __le32 oob_data_offset; // zero
104 __le32 oob_data_len; // zero
105 __le32 num_oob; // zero
106 __le32 packet_data_offset; // zero
107
108 __le32 packet_data_len; // zero
109 __le32 vc_handle; // zero
110 __le32 reserved; // zero
111} __attribute__ ((packed));
112
113struct rndis_init { /* OUT */
114 // header and:
115 __le32 msg_type; /* RNDIS_MSG_INIT */
116 __le32 msg_len; // 24
117 __le32 request_id;
118 __le32 major_version; // of rndis (1.0)
119 __le32 minor_version;
120 __le32 max_transfer_size;
121} __attribute__ ((packed));
122
123struct rndis_init_c { /* IN */
124 // header and:
125 __le32 msg_type; /* RNDIS_MSG_INIT_C */
126 __le32 msg_len;
127 __le32 request_id;
128 __le32 status;
129 __le32 major_version; // of rndis (1.0)
130 __le32 minor_version;
131 __le32 device_flags;
132 __le32 medium; // zero == 802.3
133 __le32 max_packets_per_message;
134 __le32 max_transfer_size;
135 __le32 packet_alignment; // max 7; (1<<n) bytes
136 __le32 af_list_offset; // zero
137 __le32 af_list_size; // zero
138} __attribute__ ((packed));
139
140struct rndis_halt { /* OUT (no reply) */
141 // header and:
142 __le32 msg_type; /* RNDIS_MSG_HALT */
143 __le32 msg_len;
144 __le32 request_id;
145} __attribute__ ((packed));
146
147struct rndis_query { /* OUT */
148 // header and:
149 __le32 msg_type; /* RNDIS_MSG_QUERY */
150 __le32 msg_len;
151 __le32 request_id;
152 __le32 oid;
153 __le32 len;
154 __le32 offset;
155/*?*/ __le32 handle; // zero
156} __attribute__ ((packed));
157
158struct rndis_query_c { /* IN */
159 // header and:
160 __le32 msg_type; /* RNDIS_MSG_QUERY_C */
161 __le32 msg_len;
162 __le32 request_id;
163 __le32 status;
164 __le32 len;
165 __le32 offset;
166} __attribute__ ((packed));
167
168struct rndis_set { /* OUT */
169 // header and:
170 __le32 msg_type; /* RNDIS_MSG_SET */
171 __le32 msg_len;
172 __le32 request_id;
173 __le32 oid;
174 __le32 len;
175 __le32 offset;
176/*?*/ __le32 handle; // zero
177} __attribute__ ((packed));
178
179struct rndis_set_c { /* IN */
180 // header and:
181 __le32 msg_type; /* RNDIS_MSG_SET_C */
182 __le32 msg_len;
183 __le32 request_id;
184 __le32 status;
185} __attribute__ ((packed));
186
187struct rndis_reset { /* IN */
188 // header and:
189 __le32 msg_type; /* RNDIS_MSG_RESET */
190 __le32 msg_len;
191 __le32 reserved;
192} __attribute__ ((packed));
193
194struct rndis_reset_c { /* OUT */
195 // header and:
196 __le32 msg_type; /* RNDIS_MSG_RESET_C */
197 __le32 msg_len;
198 __le32 status;
199 __le32 addressing_lost;
200} __attribute__ ((packed));
201
202struct rndis_indicate { /* IN (unrequested) */
203 // header and:
204 __le32 msg_type; /* RNDIS_MSG_INDICATE */
205 __le32 msg_len;
206 __le32 status;
207 __le32 length;
208 __le32 offset;
209/**/ __le32 diag_status;
210 __le32 error_offset;
211/**/ __le32 message;
212} __attribute__ ((packed));
213
214struct rndis_keepalive { /* OUT (optionally IN) */
215 // header and:
216 __le32 msg_type; /* RNDIS_MSG_KEEPALIVE */
217 __le32 msg_len;
218 __le32 request_id;
219} __attribute__ ((packed));
220
221struct rndis_keepalive_c { /* IN (optionally OUT) */
222 // header and:
223 __le32 msg_type; /* RNDIS_MSG_KEEPALIVE_C */
224 __le32 msg_len;
225 __le32 request_id;
226 __le32 status;
227} __attribute__ ((packed));
228
229/* NOTE: about 30 OIDs are "mandatory" for peripherals to support ... and
230 * there are gobs more that may optionally be supported. We'll avoid as much
231 * of that mess as possible.
232 */
233#define OID_802_3_PERMANENT_ADDRESS ccpu2(0x01010101)
234#define OID_GEN_MAXIMUM_FRAME_SIZE ccpu2(0x00010106)
235#define OID_GEN_CURRENT_PACKET_FILTER ccpu2(0x0001010e)
236#define OID_GEN_PHYSICAL_MEDIUM ccpu2(0x00010202)
237
238/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */
239#define RNDIS_PACKET_TYPE_DIRECTED ccpu2(0x00000001)
240#define RNDIS_PACKET_TYPE_MULTICAST ccpu2(0x00000002)
241#define RNDIS_PACKET_TYPE_ALL_MULTICAST ccpu2(0x00000004)
242#define RNDIS_PACKET_TYPE_BROADCAST ccpu2(0x00000008)
243#define RNDIS_PACKET_TYPE_SOURCE_ROUTING ccpu2(0x00000010)
244#define RNDIS_PACKET_TYPE_PROMISCUOUS ccpu2(0x00000020)
245#define RNDIS_PACKET_TYPE_SMT ccpu2(0x00000040)
246#define RNDIS_PACKET_TYPE_ALL_LOCAL ccpu2(0x00000080)
247#define RNDIS_PACKET_TYPE_GROUP ccpu2(0x00001000)
248#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL ccpu2(0x00002000)
249#define RNDIS_PACKET_TYPE_FUNCTIONAL ccpu2(0x00004000)
250#define RNDIS_PACKET_TYPE_MAC_FRAME ccpu2(0x00008000)
251
252/* default filter used with RNDIS devices */
253#define RNDIS_DEFAULT_FILTER ( \
254 RNDIS_PACKET_TYPE_DIRECTED | \
255 RNDIS_PACKET_TYPE_BROADCAST | \
256 RNDIS_PACKET_TYPE_ALL_MULTICAST | \
257 RNDIS_PACKET_TYPE_PROMISCUOUS)
258
259/* Flags to require specific physical medium type for generic_rndis_bind() */
260#define FLAG_RNDIS_PHYM_NOT_WIRELESS 0x0001
261#define FLAG_RNDIS_PHYM_WIRELESS 0x0002
262
263
264extern void rndis_status(struct usbnet *dev, struct urb *urb);
265extern int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf);
266extern int
267generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags);
268extern void rndis_unbind(struct usbnet *dev, struct usb_interface *intf);
269extern int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb);
270extern struct sk_buff *
271rndis_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags);
272
273#endif /* __RNDIS_HOST_H */
274
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 488ce128885c..21b4a1c6f585 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -20,7 +20,8 @@
20#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ 20#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
21#define SERIAL_TTY_MINORS 255 /* loads of devices :) */ 21#define SERIAL_TTY_MINORS 255 /* loads of devices :) */
22 22
23#define MAX_NUM_PORTS 8 /* The maximum number of ports one device can grab at once */ 23/* The maximum number of ports one device can grab at once */
24#define MAX_NUM_PORTS 8
24 25
25/* parity check flag */ 26/* parity check flag */
26#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) 27#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
@@ -61,29 +62,29 @@
61 * ports of a device. 62 * ports of a device.
62 */ 63 */
63struct usb_serial_port { 64struct usb_serial_port {
64 struct usb_serial * serial; 65 struct usb_serial *serial;
65 struct tty_struct * tty; 66 struct tty_struct *tty;
66 spinlock_t lock; 67 spinlock_t lock;
67 struct mutex mutex; 68 struct mutex mutex;
68 unsigned char number; 69 unsigned char number;
69 70
70 unsigned char * interrupt_in_buffer; 71 unsigned char *interrupt_in_buffer;
71 struct urb * interrupt_in_urb; 72 struct urb *interrupt_in_urb;
72 __u8 interrupt_in_endpointAddress; 73 __u8 interrupt_in_endpointAddress;
73 74
74 unsigned char * interrupt_out_buffer; 75 unsigned char *interrupt_out_buffer;
75 int interrupt_out_size; 76 int interrupt_out_size;
76 struct urb * interrupt_out_urb; 77 struct urb *interrupt_out_urb;
77 __u8 interrupt_out_endpointAddress; 78 __u8 interrupt_out_endpointAddress;
78 79
79 unsigned char * bulk_in_buffer; 80 unsigned char *bulk_in_buffer;
80 int bulk_in_size; 81 int bulk_in_size;
81 struct urb * read_urb; 82 struct urb *read_urb;
82 __u8 bulk_in_endpointAddress; 83 __u8 bulk_in_endpointAddress;
83 84
84 unsigned char * bulk_out_buffer; 85 unsigned char *bulk_out_buffer;
85 int bulk_out_size; 86 int bulk_out_size;
86 struct urb * write_urb; 87 struct urb *write_urb;
87 int write_urb_busy; 88 int write_urb_busy;
88 __u8 bulk_out_endpointAddress; 89 __u8 bulk_out_endpointAddress;
89 90
@@ -92,17 +93,19 @@ struct usb_serial_port {
92 int open_count; 93 int open_count;
93 char throttled; 94 char throttled;
94 char throttle_req; 95 char throttle_req;
96 char console;
95 struct device dev; 97 struct device dev;
96}; 98};
97#define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) 99#define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev)
98 100
99/* get and set the port private data pointer helper functions */ 101/* get and set the port private data pointer helper functions */
100static inline void *usb_get_serial_port_data (struct usb_serial_port *port) 102static inline void *usb_get_serial_port_data(struct usb_serial_port *port)
101{ 103{
102 return dev_get_drvdata(&port->dev); 104 return dev_get_drvdata(&port->dev);
103} 105}
104 106
105static inline void usb_set_serial_port_data (struct usb_serial_port *port, void *data) 107static inline void usb_set_serial_port_data(struct usb_serial_port *port,
108 void *data)
106{ 109{
107 dev_set_drvdata(&port->dev, data); 110 dev_set_drvdata(&port->dev, data);
108} 111}
@@ -125,9 +128,10 @@ static inline void usb_set_serial_port_data (struct usb_serial_port *port, void
125 * usb_set_serial_data() to access this. 128 * usb_set_serial_data() to access this.
126 */ 129 */
127struct usb_serial { 130struct usb_serial {
128 struct usb_device * dev; 131 struct usb_device *dev;
129 struct usb_serial_driver * type; 132 struct usb_serial_driver *type;
130 struct usb_interface * interface; 133 struct usb_interface *interface;
134 unsigned char disconnected;
131 unsigned char minor; 135 unsigned char minor;
132 unsigned char num_ports; 136 unsigned char num_ports;
133 unsigned char num_port_pointers; 137 unsigned char num_port_pointers;
@@ -135,29 +139,30 @@ struct usb_serial {
135 char num_interrupt_out; 139 char num_interrupt_out;
136 char num_bulk_in; 140 char num_bulk_in;
137 char num_bulk_out; 141 char num_bulk_out;
138 struct usb_serial_port * port[MAX_NUM_PORTS]; 142 struct usb_serial_port *port[MAX_NUM_PORTS];
139 struct kref kref; 143 struct kref kref;
140 void * private; 144 struct mutex disc_mutex;
145 void *private;
141}; 146};
142#define to_usb_serial(d) container_of(d, struct usb_serial, kref) 147#define to_usb_serial(d) container_of(d, struct usb_serial, kref)
143 148
144#define NUM_DONT_CARE 99 149#define NUM_DONT_CARE 99
145 150
146/* get and set the serial private data pointer helper functions */ 151/* get and set the serial private data pointer helper functions */
147static inline void *usb_get_serial_data (struct usb_serial *serial) 152static inline void *usb_get_serial_data(struct usb_serial *serial)
148{ 153{
149 return serial->private; 154 return serial->private;
150} 155}
151 156
152static inline void usb_set_serial_data (struct usb_serial *serial, void *data) 157static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
153{ 158{
154 serial->private = data; 159 serial->private = data;
155} 160}
156 161
157/** 162/**
158 * usb_serial_driver - describes a usb serial driver 163 * usb_serial_driver - describes a usb serial driver
159 * @description: pointer to a string that describes this driver. This string used 164 * @description: pointer to a string that describes this driver. This string
160 * in the syslog messages when a device is inserted or removed. 165 * used in the syslog messages when a device is inserted or removed.
161 * @id_table: pointer to a list of usb_device_id structures that define all 166 * @id_table: pointer to a list of usb_device_id structures that define all
162 * of the devices this structure can support. 167 * of the devices this structure can support.
163 * @num_interrupt_in: If a device doesn't have this many interrupt-in 168 * @num_interrupt_in: If a device doesn't have this many interrupt-in
@@ -218,82 +223,91 @@ struct usb_serial_driver {
218 struct usb_driver *usb_driver; 223 struct usb_driver *usb_driver;
219 struct usb_dynids dynids; 224 struct usb_dynids dynids;
220 225
221 int (*probe) (struct usb_serial *serial, const struct usb_device_id *id); 226 int (*probe)(struct usb_serial *serial, const struct usb_device_id *id);
222 int (*attach) (struct usb_serial *serial); 227 int (*attach)(struct usb_serial *serial);
223 int (*calc_num_ports) (struct usb_serial *serial); 228 int (*calc_num_ports) (struct usb_serial *serial);
224 229
225 void (*shutdown) (struct usb_serial *serial); 230 void (*shutdown)(struct usb_serial *serial);
226 231
227 int (*port_probe) (struct usb_serial_port *port); 232 int (*port_probe)(struct usb_serial_port *port);
228 int (*port_remove) (struct usb_serial_port *port); 233 int (*port_remove)(struct usb_serial_port *port);
229 234
230 int (*suspend) (struct usb_serial *serial, pm_message_t message); 235 int (*suspend)(struct usb_serial *serial, pm_message_t message);
231 int (*resume) (struct usb_serial *serial); 236 int (*resume)(struct usb_serial *serial);
232 237
233 /* serial function calls */ 238 /* serial function calls */
234 int (*open) (struct usb_serial_port *port, struct file * filp); 239 int (*open)(struct usb_serial_port *port, struct file *filp);
235 void (*close) (struct usb_serial_port *port, struct file * filp); 240 void (*close)(struct usb_serial_port *port, struct file *filp);
236 int (*write) (struct usb_serial_port *port, const unsigned char *buf, int count); 241 int (*write)(struct usb_serial_port *port, const unsigned char *buf,
237 int (*write_room) (struct usb_serial_port *port); 242 int count);
238 int (*ioctl) (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg); 243 int (*write_room)(struct usb_serial_port *port);
239 void (*set_termios) (struct usb_serial_port *port, struct ktermios * old); 244 int (*ioctl)(struct usb_serial_port *port, struct file *file,
240 void (*break_ctl) (struct usb_serial_port *port, int break_state); 245 unsigned int cmd, unsigned long arg);
241 int (*chars_in_buffer) (struct usb_serial_port *port); 246 void (*set_termios)(struct usb_serial_port *port, struct ktermios *old);
242 void (*throttle) (struct usb_serial_port *port); 247 void (*break_ctl)(struct usb_serial_port *port, int break_state);
243 void (*unthrottle) (struct usb_serial_port *port); 248 int (*chars_in_buffer)(struct usb_serial_port *port);
244 int (*tiocmget) (struct usb_serial_port *port, struct file *file); 249 void (*throttle)(struct usb_serial_port *port);
245 int (*tiocmset) (struct usb_serial_port *port, struct file *file, unsigned int set, unsigned int clear); 250 void (*unthrottle)(struct usb_serial_port *port);
251 int (*tiocmget)(struct usb_serial_port *port, struct file *file);
252 int (*tiocmset)(struct usb_serial_port *port, struct file *file,
253 unsigned int set, unsigned int clear);
246 254
247 void (*read_int_callback)(struct urb *urb); 255 void (*read_int_callback)(struct urb *urb);
248 void (*write_int_callback)(struct urb *urb); 256 void (*write_int_callback)(struct urb *urb);
249 void (*read_bulk_callback)(struct urb *urb); 257 void (*read_bulk_callback)(struct urb *urb);
250 void (*write_bulk_callback)(struct urb *urb); 258 void (*write_bulk_callback)(struct urb *urb);
251}; 259};
252#define to_usb_serial_driver(d) container_of(d, struct usb_serial_driver, driver) 260#define to_usb_serial_driver(d) \
261 container_of(d, struct usb_serial_driver, driver)
253 262
254extern int usb_serial_register(struct usb_serial_driver *driver); 263extern int usb_serial_register(struct usb_serial_driver *driver);
255extern void usb_serial_deregister(struct usb_serial_driver *driver); 264extern void usb_serial_deregister(struct usb_serial_driver *driver);
256extern void usb_serial_port_softint(struct usb_serial_port *port); 265extern void usb_serial_port_softint(struct usb_serial_port *port);
257 266
258extern int usb_serial_probe(struct usb_interface *iface, const struct usb_device_id *id); 267extern int usb_serial_probe(struct usb_interface *iface,
268 const struct usb_device_id *id);
259extern void usb_serial_disconnect(struct usb_interface *iface); 269extern void usb_serial_disconnect(struct usb_interface *iface);
260 270
261extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message); 271extern int usb_serial_suspend(struct usb_interface *intf, pm_message_t message);
262extern int usb_serial_resume(struct usb_interface *intf); 272extern int usb_serial_resume(struct usb_interface *intf);
263 273
264extern int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *data, int length, __u8 bRequest); 274extern int ezusb_writememory(struct usb_serial *serial, int address,
265extern int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit); 275 unsigned char *data, int length, __u8 bRequest);
276extern int ezusb_set_reset(struct usb_serial *serial, unsigned char reset_bit);
266 277
267/* USB Serial console functions */ 278/* USB Serial console functions */
268#ifdef CONFIG_USB_SERIAL_CONSOLE 279#ifdef CONFIG_USB_SERIAL_CONSOLE
269extern void usb_serial_console_init (int debug, int minor); 280extern void usb_serial_console_init(int debug, int minor);
270extern void usb_serial_console_exit (void); 281extern void usb_serial_console_exit(void);
271extern void usb_serial_console_disconnect(struct usb_serial *serial); 282extern void usb_serial_console_disconnect(struct usb_serial *serial);
272#else 283#else
273static inline void usb_serial_console_init (int debug, int minor) { } 284static inline void usb_serial_console_init(int debug, int minor) { }
274static inline void usb_serial_console_exit (void) { } 285static inline void usb_serial_console_exit(void) { }
275static inline void usb_serial_console_disconnect(struct usb_serial *serial) {} 286static inline void usb_serial_console_disconnect(struct usb_serial *serial) {}
276#endif 287#endif
277 288
278/* Functions needed by other parts of the usbserial core */ 289/* Functions needed by other parts of the usbserial core */
279extern struct usb_serial *usb_serial_get_by_index (unsigned int minor); 290extern struct usb_serial *usb_serial_get_by_index(unsigned int minor);
280extern void usb_serial_put(struct usb_serial *serial); 291extern void usb_serial_put(struct usb_serial *serial);
281extern int usb_serial_generic_open (struct usb_serial_port *port, struct file *filp); 292extern int usb_serial_generic_open(struct usb_serial_port *port,
282extern int usb_serial_generic_write (struct usb_serial_port *port, const unsigned char *buf, int count); 293 struct file *filp);
283extern void usb_serial_generic_close (struct usb_serial_port *port, struct file *filp); 294extern int usb_serial_generic_write(struct usb_serial_port *port,
284extern int usb_serial_generic_resume (struct usb_serial *serial); 295 const unsigned char *buf, int count);
285extern int usb_serial_generic_write_room (struct usb_serial_port *port); 296extern void usb_serial_generic_close(struct usb_serial_port *port,
286extern int usb_serial_generic_chars_in_buffer (struct usb_serial_port *port); 297 struct file *filp);
287extern void usb_serial_generic_read_bulk_callback (struct urb *urb); 298extern int usb_serial_generic_resume(struct usb_serial *serial);
288extern void usb_serial_generic_write_bulk_callback (struct urb *urb); 299extern int usb_serial_generic_write_room(struct usb_serial_port *port);
289extern void usb_serial_generic_throttle (struct usb_serial_port *port); 300extern int usb_serial_generic_chars_in_buffer(struct usb_serial_port *port);
290extern void usb_serial_generic_unthrottle (struct usb_serial_port *port); 301extern void usb_serial_generic_read_bulk_callback(struct urb *urb);
291extern void usb_serial_generic_shutdown (struct usb_serial *serial); 302extern void usb_serial_generic_write_bulk_callback(struct urb *urb);
292extern int usb_serial_generic_register (int debug); 303extern void usb_serial_generic_throttle(struct usb_serial_port *port);
293extern void usb_serial_generic_deregister (void); 304extern void usb_serial_generic_unthrottle(struct usb_serial_port *port);
294 305extern void usb_serial_generic_shutdown(struct usb_serial *serial);
295extern int usb_serial_bus_register (struct usb_serial_driver *device); 306extern int usb_serial_generic_register(int debug);
296extern void usb_serial_bus_deregister (struct usb_serial_driver *device); 307extern void usb_serial_generic_deregister(void);
308
309extern int usb_serial_bus_register(struct usb_serial_driver *device);
310extern void usb_serial_bus_deregister(struct usb_serial_driver *device);
297 311
298extern struct usb_serial_driver usb_serial_generic_device; 312extern struct usb_serial_driver usb_serial_generic_device;
299extern struct bus_type usb_serial_bus_type; 313extern struct bus_type usb_serial_bus_type;
@@ -307,16 +321,22 @@ static inline void usb_serial_debug_data(int debug,
307 int i; 321 int i;
308 322
309 if (debug) { 323 if (debug) {
310 dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ", function, size); 324 dev_printk(KERN_DEBUG, dev, "%s - length = %d, data = ",
325 function, size);
311 for (i = 0; i < size; ++i) 326 for (i = 0; i < size; ++i)
312 printk ("%.2x ", data[i]); 327 printk("%.2x ", data[i]);
313 printk ("\n"); 328 printk("\n");
314 } 329 }
315} 330}
316 331
317/* Use our own dbg macro */ 332/* Use our own dbg macro */
318#undef dbg 333#undef dbg
319#define dbg(format, arg...) do { if (debug) printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , ## arg); } while (0) 334#define dbg(format, arg...) \
335 do { \
336 if (debug) \
337 printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , \
338 ## arg); \
339 } while (0)
320 340
321 341
322 342
diff --git a/include/linux/usb/sl811.h b/include/linux/usb/sl811.h
index 397ee3b3d7f3..877373da410d 100644
--- a/include/linux/usb/sl811.h
+++ b/include/linux/usb/sl811.h
@@ -19,8 +19,8 @@ struct sl811_platform_data {
19 /* pulse sl811 nRST (probably with a GPIO) */ 19 /* pulse sl811 nRST (probably with a GPIO) */
20 void (*reset)(struct device *dev); 20 void (*reset)(struct device *dev);
21 21
22 // some boards need something like these: 22 /* some boards need something like these: */
23 // int (*check_overcurrent)(struct device *dev); 23 /* int (*check_overcurrent)(struct device *dev); */
24 // void (*clock_enable)(struct device *dev, int is_on); 24 /* void (*clock_enable)(struct device *dev, int is_on); */
25}; 25};
26 26
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
new file mode 100644
index 000000000000..e0501da3dd11
--- /dev/null
+++ b/include/linux/usb/usbnet.h
@@ -0,0 +1,214 @@
1/*
2 * USB Networking Link Interface
3 *
4 * Copyright (C) 2000-2005 by David Brownell <dbrownell@users.sourceforge.net>
5 * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22
23#ifndef __USBNET_H
24#define __USBNET_H
25
26
27/* interface from usbnet core to each USB networking link we handle */
28struct usbnet {
29 /* housekeeping */
30 struct usb_device *udev;
31 struct usb_interface *intf;
32 struct driver_info *driver_info;
33 const char *driver_name;
34 void *driver_priv;
35 wait_queue_head_t *wait;
36 struct mutex phy_mutex;
37 unsigned char suspend_count;
38
39 /* i/o info: pipes etc */
40 unsigned in, out;
41 struct usb_host_endpoint *status;
42 unsigned maxpacket;
43 struct timer_list delay;
44
45 /* protocol/interface state */
46 struct net_device *net;
47 struct net_device_stats stats;
48 int msg_enable;
49 unsigned long data [5];
50 u32 xid;
51 u32 hard_mtu; /* count any extra framing */
52 size_t rx_urb_size; /* size for rx urbs */
53 struct mii_if_info mii;
54
55 /* various kinds of pending driver work */
56 struct sk_buff_head rxq;
57 struct sk_buff_head txq;
58 struct sk_buff_head done;
59 struct urb *interrupt;
60 struct tasklet_struct bh;
61
62 struct work_struct kevent;
63 unsigned long flags;
64# define EVENT_TX_HALT 0
65# define EVENT_RX_HALT 1
66# define EVENT_RX_MEMORY 2
67# define EVENT_STS_SPLIT 3
68# define EVENT_LINK_RESET 4
69};
70
71static inline struct usb_driver *driver_of(struct usb_interface *intf)
72{
73 return to_usb_driver(intf->dev.driver);
74}
75
76/* interface from the device/framing level "minidriver" to core */
77struct driver_info {
78 char *description;
79
80 int flags;
81/* framing is CDC Ethernet, not writing ZLPs (hw issues), or optionally: */
82#define FLAG_FRAMING_NC 0x0001 /* guard against device dropouts */
83#define FLAG_FRAMING_GL 0x0002 /* genelink batches packets */
84#define FLAG_FRAMING_Z 0x0004 /* zaurus adds a trailer */
85#define FLAG_FRAMING_RN 0x0008 /* RNDIS batches, plus huge header */
86
87#define FLAG_NO_SETINT 0x0010 /* device can't set_interface() */
88#define FLAG_ETHER 0x0020 /* maybe use "eth%d" names */
89
90#define FLAG_FRAMING_AX 0x0040 /* AX88772/178 packets */
91#define FLAG_WLAN 0x0080 /* use "wlan%d" names */
92
93
94 /* init device ... can sleep, or cause probe() failure */
95 int (*bind)(struct usbnet *, struct usb_interface *);
96
97 /* cleanup device ... can sleep, but can't fail */
98 void (*unbind)(struct usbnet *, struct usb_interface *);
99
100 /* reset device ... can sleep */
101 int (*reset)(struct usbnet *);
102
103 /* see if peer is connected ... can sleep */
104 int (*check_connect)(struct usbnet *);
105
106 /* for status polling */
107 void (*status)(struct usbnet *, struct urb *);
108
109 /* link reset handling, called from defer_kevent */
110 int (*link_reset)(struct usbnet *);
111
112 /* fixup rx packet (strip framing) */
113 int (*rx_fixup)(struct usbnet *dev, struct sk_buff *skb);
114
115 /* fixup tx packet (add framing) */
116 struct sk_buff *(*tx_fixup)(struct usbnet *dev,
117 struct sk_buff *skb, gfp_t flags);
118
119 /* early initialization code, can sleep. This is for minidrivers
120 * having 'subminidrivers' that need to do extra initialization
121 * right after minidriver have initialized hardware. */
122 int (*early_init)(struct usbnet *dev);
123
124 /* called by minidriver when link state changes, state: 0=disconnect,
125 * 1=connect */
126 void (*link_change)(struct usbnet *dev, int state);
127
128 /* for new devices, use the descriptor-reading code instead */
129 int in; /* rx endpoint */
130 int out; /* tx endpoint */
131
132 unsigned long data; /* Misc driver specific data */
133};
134
135/* Minidrivers are just drivers using the "usbnet" core as a powerful
136 * network-specific subroutine library ... that happens to do pretty
137 * much everything except custom framing and chip-specific stuff.
138 */
139extern int usbnet_probe(struct usb_interface *, const struct usb_device_id *);
140extern int usbnet_suspend (struct usb_interface *, pm_message_t );
141extern int usbnet_resume (struct usb_interface *);
142extern void usbnet_disconnect(struct usb_interface *);
143
144
145/* Drivers that reuse some of the standard USB CDC infrastructure
146 * (notably, using multiple interfaces according to the CDC
147 * union descriptor) get some helper code.
148 */
149struct cdc_state {
150 struct usb_cdc_header_desc *header;
151 struct usb_cdc_union_desc *u;
152 struct usb_cdc_ether_desc *ether;
153 struct usb_interface *control;
154 struct usb_interface *data;
155};
156
157extern int usbnet_generic_cdc_bind (struct usbnet *, struct usb_interface *);
158extern void usbnet_cdc_unbind (struct usbnet *, struct usb_interface *);
159
160/* CDC and RNDIS support the same host-chosen packet filters for IN transfers */
161#define DEFAULT_FILTER (USB_CDC_PACKET_TYPE_BROADCAST \
162 |USB_CDC_PACKET_TYPE_ALL_MULTICAST \
163 |USB_CDC_PACKET_TYPE_PROMISCUOUS \
164 |USB_CDC_PACKET_TYPE_DIRECTED)
165
166
167/* we record the state for each of our queued skbs */
168enum skb_state {
169 illegal = 0,
170 tx_start, tx_done,
171 rx_start, rx_done, rx_cleanup
172};
173
174struct skb_data { /* skb->cb is one of these */
175 struct urb *urb;
176 struct usbnet *dev;
177 enum skb_state state;
178 size_t length;
179};
180
181
182extern int usbnet_get_endpoints(struct usbnet *, struct usb_interface *);
183extern void usbnet_defer_kevent (struct usbnet *, int);
184extern void usbnet_skb_return (struct usbnet *, struct sk_buff *);
185extern void usbnet_unlink_rx_urbs(struct usbnet *);
186
187extern int usbnet_get_settings (struct net_device *net, struct ethtool_cmd *cmd);
188extern int usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd);
189extern u32 usbnet_get_link (struct net_device *net);
190extern u32 usbnet_get_msglevel (struct net_device *);
191extern void usbnet_set_msglevel (struct net_device *, u32);
192extern void usbnet_get_drvinfo (struct net_device *, struct ethtool_drvinfo *);
193extern int usbnet_nway_reset(struct net_device *net);
194
195/* messaging support includes the interface name, so it must not be
196 * used before it has one ... notably, in minidriver bind() calls.
197 */
198#ifdef DEBUG
199#define devdbg(usbnet, fmt, arg...) \
200 printk(KERN_DEBUG "%s: " fmt "\n" , (usbnet)->net->name , ## arg)
201#else
202#define devdbg(usbnet, fmt, arg...) do {} while(0)
203#endif
204
205#define deverr(usbnet, fmt, arg...) \
206 printk(KERN_ERR "%s: " fmt "\n" , (usbnet)->net->name , ## arg)
207#define devwarn(usbnet, fmt, arg...) \
208 printk(KERN_WARNING "%s: " fmt "\n" , (usbnet)->net->name , ## arg)
209
210#define devinfo(usbnet, fmt, arg...) \
211 printk(KERN_INFO "%s: " fmt "\n" , (usbnet)->net->name , ## arg); \
212
213
214#endif /* __USBNET_H */
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index 1b792b9286ba..cee0623b3c7b 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -48,7 +48,10 @@
48 US_FLAG(IGNORE_DEVICE, 0x00000800) \ 48 US_FLAG(IGNORE_DEVICE, 0x00000800) \
49 /* Don't claim device */ \ 49 /* Don't claim device */ \
50 US_FLAG(CAPACITY_HEURISTICS, 0x00001000) \ 50 US_FLAG(CAPACITY_HEURISTICS, 0x00001000) \
51 /* sometimes sizes is too big */ 51 /* sometimes sizes is too big */ \
52 US_FLAG(MAX_SECTORS_MIN,0x00002000) \
53 /* Sets max_sectors to arch min */
54
52 55
53#define US_FLAG(name, value) US_FL_##name = value , 56#define US_FLAG(name, value) US_FL_##name = value ,
54enum { US_DO_ALL_FLAGS }; 57enum { US_DO_ALL_FLAGS };
@@ -77,10 +80,9 @@ enum { US_DO_ALL_FLAGS };
77#define US_SC_UFI 0x04 /* Floppy */ 80#define US_SC_UFI 0x04 /* Floppy */
78#define US_SC_8070 0x05 /* Removable media */ 81#define US_SC_8070 0x05 /* Removable media */
79#define US_SC_SCSI 0x06 /* Transparent */ 82#define US_SC_SCSI 0x06 /* Transparent */
80#define US_SC_ISD200 0x07 /* ISD200 ATA */ 83#define US_SC_LOCKABLE 0x07 /* Password-protected */
81#define US_SC_MIN US_SC_RBC
82#define US_SC_MAX US_SC_ISD200
83 84
85#define US_SC_ISD200 0xf0 /* ISD200 ATA */
84#define US_SC_DEVICE 0xff /* Use device's value */ 86#define US_SC_DEVICE 0xff /* Use device's value */
85 87
86/* Protocols */ 88/* Protocols */
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index 342dd5a7e8bb..17cb108b7db0 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -102,8 +102,9 @@ struct usbdevfs_urb {
102 int start_frame; 102 int start_frame;
103 int number_of_packets; 103 int number_of_packets;
104 int error_count; 104 int error_count;
105 unsigned int signr; /* signal to be sent on error, -1 if none should be sent */ 105 unsigned int signr; /* signal to be sent on completion,
106 void *usercontext; 106 or 0 if none should be sent. */
107 void __user *usercontext;
107 struct usbdevfs_iso_packet_desc iso_frame_desc[0]; 108 struct usbdevfs_iso_packet_desc iso_frame_desc[0];
108}; 109};
109 110
diff --git a/include/linux/veth.h b/include/linux/veth.h
new file mode 100644
index 000000000000..3354c1eb424e
--- /dev/null
+++ b/include/linux/veth.h
@@ -0,0 +1,12 @@
1#ifndef __NET_VETH_H_
2#define __NET_VETH_H_
3
4enum {
5 VETH_INFO_UNSPEC,
6 VETH_INFO_PEER,
7
8 __VETH_INFO_MAX
9#define VETH_INFO_MAX (__VETH_INFO_MAX - 1)
10};
11
12#endif
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index ac69e7bb5a14..1a4ed49f6478 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -67,7 +67,7 @@ struct vring {
67}; 67};
68 68
69/* The standard layout for the ring is a continuous chunk of memory which looks 69/* The standard layout for the ring is a continuous chunk of memory which looks
70 * like this. The used fields will be aligned to a "num+1" boundary. 70 * like this. We assume num is a power of 2.
71 * 71 *
72 * struct vring 72 * struct vring
73 * { 73 * {
@@ -79,8 +79,8 @@ struct vring {
79 * __u16 avail_idx; 79 * __u16 avail_idx;
80 * __u16 available[num]; 80 * __u16 available[num];
81 * 81 *
82 * // Padding so a correctly-chosen num value will cache-align used_idx. 82 * // Padding to the next page boundary.
83 * char pad[sizeof(struct vring_desc) - sizeof(avail_flags)]; 83 * char pad[];
84 * 84 *
85 * // A ring of used descriptor heads with free-running index. 85 * // A ring of used descriptor heads with free-running index.
86 * __u16 used_flags; 86 * __u16 used_flags;
@@ -88,18 +88,21 @@ struct vring {
88 * struct vring_used_elem used[num]; 88 * struct vring_used_elem used[num];
89 * }; 89 * };
90 */ 90 */
91static inline void vring_init(struct vring *vr, unsigned int num, void *p) 91static inline void vring_init(struct vring *vr, unsigned int num, void *p,
92 unsigned int pagesize)
92{ 93{
93 vr->num = num; 94 vr->num = num;
94 vr->desc = p; 95 vr->desc = p;
95 vr->avail = p + num*sizeof(struct vring); 96 vr->avail = p + num*sizeof(struct vring_desc);
96 vr->used = p + (num+1)*(sizeof(struct vring) + sizeof(__u16)); 97 vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + pagesize-1)
98 & ~(pagesize - 1));
97} 99}
98 100
99static inline unsigned vring_size(unsigned int num) 101static inline unsigned vring_size(unsigned int num, unsigned int pagesize)
100{ 102{
101 return (num + 1) * (sizeof(struct vring_desc) + sizeof(__u16)) 103 return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num)
102 + sizeof(__u32) + num * sizeof(struct vring_used_elem); 104 + pagesize - 1) & ~(pagesize - 1))
105 + sizeof(__u16) * 2 + sizeof(struct vring_used_elem) * num;
103} 106}
104 107
105#ifdef __KERNEL__ 108#ifdef __KERNEL__
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 0e686280450b..1f4fb0a81ecd 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -152,14 +152,15 @@ int FASTCALL(out_of_line_wait_on_bit(void *, int, int (*)(void *), unsigned));
152int FASTCALL(out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned)); 152int FASTCALL(out_of_line_wait_on_bit_lock(void *, int, int (*)(void *), unsigned));
153wait_queue_head_t *FASTCALL(bit_waitqueue(void *, int)); 153wait_queue_head_t *FASTCALL(bit_waitqueue(void *, int));
154 154
155#define wake_up(x) __wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 1, NULL) 155#define wake_up(x) __wake_up(x, TASK_NORMAL, 1, NULL)
156#define wake_up_nr(x, nr) __wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, nr, NULL) 156#define wake_up_nr(x, nr) __wake_up(x, TASK_NORMAL, nr, NULL)
157#define wake_up_all(x) __wake_up(x, TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 0, NULL) 157#define wake_up_all(x) __wake_up(x, TASK_NORMAL, 0, NULL)
158#define wake_up_locked(x) __wake_up_locked((x), TASK_NORMAL)
159
158#define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL) 160#define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL)
159#define wake_up_interruptible_nr(x, nr) __wake_up(x, TASK_INTERRUPTIBLE, nr, NULL) 161#define wake_up_interruptible_nr(x, nr) __wake_up(x, TASK_INTERRUPTIBLE, nr, NULL)
160#define wake_up_interruptible_all(x) __wake_up(x, TASK_INTERRUPTIBLE, 0, NULL) 162#define wake_up_interruptible_all(x) __wake_up(x, TASK_INTERRUPTIBLE, 0, NULL)
161#define wake_up_locked(x) __wake_up_locked((x), TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE) 163#define wake_up_interruptible_sync(x) __wake_up_sync((x), TASK_INTERRUPTIBLE, 1)
162#define wake_up_interruptible_sync(x) __wake_up_sync((x),TASK_INTERRUPTIBLE, 1)
163 164
164#define __wait_event(wq, condition) \ 165#define __wait_event(wq, condition) \
165do { \ 166do { \
@@ -345,6 +346,47 @@ do { \
345 __ret; \ 346 __ret; \
346}) 347})
347 348
349#define __wait_event_killable(wq, condition, ret) \
350do { \
351 DEFINE_WAIT(__wait); \
352 \
353 for (;;) { \
354 prepare_to_wait(&wq, &__wait, TASK_KILLABLE); \
355 if (condition) \
356 break; \
357 if (!fatal_signal_pending(current)) { \
358 schedule(); \
359 continue; \
360 } \
361 ret = -ERESTARTSYS; \
362 break; \
363 } \
364 finish_wait(&wq, &__wait); \
365} while (0)
366
367/**
368 * wait_event_killable - sleep until a condition gets true
369 * @wq: the waitqueue to wait on
370 * @condition: a C expression for the event to wait for
371 *
372 * The process is put to sleep (TASK_KILLABLE) until the
373 * @condition evaluates to true or a signal is received.
374 * The @condition is checked each time the waitqueue @wq is woken up.
375 *
376 * wake_up() has to be called after changing any variable that could
377 * change the result of the wait condition.
378 *
379 * The function will return -ERESTARTSYS if it was interrupted by a
380 * signal and 0 if @condition evaluated to true.
381 */
382#define wait_event_killable(wq, condition) \
383({ \
384 int __ret = 0; \
385 if (!(condition)) \
386 __wait_event_killable(wq, condition, __ret); \
387 __ret; \
388})
389
348/* 390/*
349 * Must be called with the spinlock in the wait_queue_head_t held. 391 * Must be called with the spinlock in the wait_queue_head_t held.
350 */ 392 */
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 0987aa7a6cf5..74e84caa1e20 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -541,6 +541,16 @@
541/* Maximum size of returned data */ 541/* Maximum size of returned data */
542#define IW_SCAN_MAX_DATA 4096 /* In bytes */ 542#define IW_SCAN_MAX_DATA 4096 /* In bytes */
543 543
544/* Scan capability flags - in (struct iw_range *)->scan_capa */
545#define IW_SCAN_CAPA_NONE 0x00
546#define IW_SCAN_CAPA_ESSID 0x01
547#define IW_SCAN_CAPA_BSSID 0x02
548#define IW_SCAN_CAPA_CHANNEL 0x04
549#define IW_SCAN_CAPA_MODE 0x08
550#define IW_SCAN_CAPA_RATE 0x10
551#define IW_SCAN_CAPA_TYPE 0x20
552#define IW_SCAN_CAPA_TIME 0x40
553
544/* Max number of char in custom event - use multiple of them if needed */ 554/* Max number of char in custom event - use multiple of them if needed */
545#define IW_CUSTOM_MAX 256 /* In bytes */ 555#define IW_CUSTOM_MAX 256 /* In bytes */
546 556
@@ -963,6 +973,9 @@ struct iw_range
963 __u16 old_num_channels; 973 __u16 old_num_channels;
964 __u8 old_num_frequency; 974 __u8 old_num_frequency;
965 975
976 /* Scan capabilities */
977 __u8 scan_capa; /* IW_SCAN_CAPA_* bit field */
978
966 /* Wireless event capability bitmasks */ 979 /* Wireless event capability bitmasks */
967 __u32 event_capa[6]; 980 __u32 event_capa[6];
968 981
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 7daafdc2514b..7f28c32d9aca 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -149,19 +149,27 @@ struct execute_work {
149 149
150extern struct workqueue_struct * 150extern struct workqueue_struct *
151__create_workqueue_key(const char *name, int singlethread, 151__create_workqueue_key(const char *name, int singlethread,
152 int freezeable, struct lock_class_key *key); 152 int freezeable, struct lock_class_key *key,
153 const char *lock_name);
153 154
154#ifdef CONFIG_LOCKDEP 155#ifdef CONFIG_LOCKDEP
155#define __create_workqueue(name, singlethread, freezeable) \ 156#define __create_workqueue(name, singlethread, freezeable) \
156({ \ 157({ \
157 static struct lock_class_key __key; \ 158 static struct lock_class_key __key; \
159 const char *__lock_name; \
160 \
161 if (__builtin_constant_p(name)) \
162 __lock_name = (name); \
163 else \
164 __lock_name = #name; \
158 \ 165 \
159 __create_workqueue_key((name), (singlethread), \ 166 __create_workqueue_key((name), (singlethread), \
160 (freezeable), &__key); \ 167 (freezeable), &__key, \
168 __lock_name); \
161}) 169})
162#else 170#else
163#define __create_workqueue(name, singlethread, freezeable) \ 171#define __create_workqueue(name, singlethread, freezeable) \
164 __create_workqueue_key((name), (singlethread), (freezeable), NULL) 172 __create_workqueue_key((name), (singlethread), (freezeable), NULL, NULL)
165#endif 173#endif
166 174
167#define create_workqueue(name) __create_workqueue((name), 0, 0) 175#define create_workqueue(name) __create_workqueue((name), 0, 0)
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index bef7d66601cb..c6148bbf1250 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -62,7 +62,6 @@ struct writeback_control {
62 unsigned for_reclaim:1; /* Invoked from the page allocator */ 62 unsigned for_reclaim:1; /* Invoked from the page allocator */
63 unsigned for_writepages:1; /* This is a writepages() call */ 63 unsigned for_writepages:1; /* This is a writepages() call */
64 unsigned range_cyclic:1; /* range_start is cyclic */ 64 unsigned range_cyclic:1; /* range_start is cyclic */
65 unsigned more_io:1; /* more io to be dispatched */
66}; 65};
67 66
68/* 67/*
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index b58adc52448d..e31b8c84f2c9 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -91,8 +91,15 @@ struct xfrm_replay_state
91}; 91};
92 92
93struct xfrm_algo { 93struct xfrm_algo {
94 char alg_name[64];
95 unsigned int alg_key_len; /* in bits */
96 char alg_key[0];
97};
98
99struct xfrm_algo_aead {
94 char alg_name[64]; 100 char alg_name[64];
95 int alg_key_len; /* in bits */ 101 int alg_key_len; /* in bits */
102 int alg_icv_len; /* in bits */
96 char alg_key[0]; 103 char alg_key[0];
97}; 104};
98 105
@@ -114,6 +121,7 @@ enum
114 XFRM_POLICY_IN = 0, 121 XFRM_POLICY_IN = 0,
115 XFRM_POLICY_OUT = 1, 122 XFRM_POLICY_OUT = 1,
116 XFRM_POLICY_FWD = 2, 123 XFRM_POLICY_FWD = 2,
124 XFRM_POLICY_MASK = 3,
117 XFRM_POLICY_MAX = 3 125 XFRM_POLICY_MAX = 3
118}; 126};
119 127
@@ -269,6 +277,7 @@ enum xfrm_attr_type_t {
269 XFRMA_LASTUSED, 277 XFRMA_LASTUSED,
270 XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ 278 XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */
271 XFRMA_MIGRATE, 279 XFRMA_MIGRATE,
280 XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */
272 __XFRMA_MAX 281 __XFRMA_MAX
273 282
274#define XFRMA_MAX (__XFRMA_MAX - 1) 283#define XFRMA_MAX (__XFRMA_MAX - 1)
@@ -328,6 +337,7 @@ struct xfrm_usersa_info {
328#define XFRM_STATE_DECAP_DSCP 2 337#define XFRM_STATE_DECAP_DSCP 2
329#define XFRM_STATE_NOPMTUDISC 4 338#define XFRM_STATE_NOPMTUDISC 4
330#define XFRM_STATE_WILDRECV 8 339#define XFRM_STATE_WILDRECV 8
340#define XFRM_STATE_ICMP 16
331}; 341};
332 342
333struct xfrm_usersa_id { 343struct xfrm_usersa_id {
@@ -362,6 +372,8 @@ struct xfrm_userpolicy_info {
362#define XFRM_POLICY_BLOCK 1 372#define XFRM_POLICY_BLOCK 1
363 __u8 flags; 373 __u8 flags;
364#define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */ 374#define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */
375 /* Automatically expand selector to include matching ICMP payloads. */
376#define XFRM_POLICY_ICMP 2
365 __u8 share; 377 __u8 share;
366}; 378};
367 379