aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/8250_pci.h2
-rw-r--r--include/linux/Kbuild7
-rw-r--r--include/linux/acpi.h17
-rw-r--r--include/linux/aio.h5
-rw-r--r--include/linux/async.h25
-rw-r--r--include/linux/async_tx.h17
-rw-r--r--include/linux/atm.h17
-rw-r--r--include/linux/atmdev.h15
-rw-r--r--include/linux/atmel-mci.h39
-rw-r--r--include/linux/audit.h108
-rw-r--r--include/linux/auto_dev-ioctl.h75
-rw-r--r--include/linux/auto_fs4.h62
-rw-r--r--include/linux/auxvec.h6
-rw-r--r--include/linux/backlight.h16
-rw-r--r--include/linux/binfmts.h19
-rw-r--r--include/linux/bio.h26
-rw-r--r--include/linux/bitmap.h35
-rw-r--r--include/linux/bitops.h13
-rw-r--r--include/linux/blkdev.h54
-rw-r--r--include/linux/blockgroup_lock.h7
-rw-r--r--include/linux/bottom_half.h1
-rw-r--r--include/linux/buffer_head.h12
-rw-r--r--include/linux/byteorder.h372
-rw-r--r--include/linux/byteorder/Kbuild2
-rw-r--r--include/linux/byteorder/big_endian.h3
-rw-r--r--include/linux/byteorder/little_endian.h3
-rw-r--r--include/linux/byteorder/swab.h222
-rw-r--r--include/linux/byteorder/swabb.h135
-rw-r--r--include/linux/can/core.h2
-rw-r--r--include/linux/capability.h40
-rw-r--r--include/linux/cgroup.h75
-rw-r--r--include/linux/cgroup_subsys.h6
-rw-r--r--include/linux/compiler-gcc.h19
-rw-r--r--include/linux/compiler-gcc3.h5
-rw-r--r--include/linux/compiler-gcc4.h8
-rw-r--r--include/linux/compiler.h8
-rw-r--r--include/linux/console.h4
-rw-r--r--include/linux/cpufreq.h5
-rw-r--r--include/linux/cpumask.h221
-rw-r--r--include/linux/cpuset.h16
-rw-r--r--include/linux/crc32c.h6
-rw-r--r--include/linux/cred.h342
-rw-r--r--include/linux/crypto.h10
-rw-r--r--include/linux/dcache.h21
-rw-r--r--include/linux/dcbnl.h340
-rw-r--r--include/linux/dccp.h42
-rw-r--r--include/linux/debugfs.h2
-rw-r--r--include/linux/device-mapper.h28
-rw-r--r--include/linux/device.h32
-rw-r--r--include/linux/dma_remapping.h144
-rw-r--r--include/linux/dmaengine.h181
-rw-r--r--include/linux/dmar.h1
-rw-r--r--include/linux/dmi.h5
-rw-r--r--include/linux/dqblk_qtree.h56
-rw-r--r--include/linux/dqblk_v1.h7
-rw-r--r--include/linux/dqblk_v2.h22
-rw-r--r--include/linux/dvb/frontend.h27
-rw-r--r--include/linux/dw_dmac.h31
-rw-r--r--include/linux/elevator.h8
-rw-r--r--include/linux/etherdevice.h46
-rw-r--r--include/linux/ethtool.h2
-rw-r--r--include/linux/ext2_fs.h24
-rw-r--r--include/linux/ext2_fs_sb.h8
-rw-r--r--include/linux/ext3_fs.h52
-rw-r--r--include/linux/ext3_fs_sb.h9
-rw-r--r--include/linux/fault-inject.h9
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/fddidevice.h1
-rw-r--r--include/linux/fdtable.h2
-rw-r--r--include/linux/filter.h3
-rw-r--r--include/linux/fs.h71
-rw-r--r--include/linux/fs_struct.h6
-rw-r--r--include/linux/fsl_devices.h18
-rw-r--r--include/linux/ftrace.h21
-rw-r--r--include/linux/fuse.h79
-rw-r--r--include/linux/futex.h3
-rw-r--r--include/linux/generic_serial.h1
-rw-r--r--include/linux/genhd.h1
-rw-r--r--include/linux/gfp.h6
-rw-r--r--include/linux/gpio_keys.h1
-rw-r--r--include/linux/hardirq.h13
-rw-r--r--include/linux/hdlc.h4
-rw-r--r--include/linux/hid.h16
-rw-r--r--include/linux/hidraw.h2
-rw-r--r--include/linux/hippidevice.h4
-rw-r--r--include/linux/hrtimer.h34
-rw-r--r--include/linux/hugetlb.h6
-rw-r--r--include/linux/i2c.h4
-rw-r--r--include/linux/i2c/dm355evm_msp.h79
-rw-r--r--include/linux/i2c/tsc2007.h17
-rw-r--r--include/linux/i2c/twl4030.h90
-rw-r--r--include/linux/ide.h273
-rw-r--r--include/linux/ieee80211.h212
-rw-r--r--include/linux/if.h1
-rw-r--r--include/linux/if_arp.h3
-rw-r--r--include/linux/if_vlan.h19
-rw-r--r--include/linux/in.h4
-rw-r--r--include/linux/init_task.h15
-rw-r--r--include/linux/input.h2
-rw-r--r--include/linux/intel-iommu.h25
-rw-r--r--include/linux/interrupt.h13
-rw-r--r--include/linux/iommu.h112
-rw-r--r--include/linux/ioport.h11
-rw-r--r--include/linux/ioprio.h2
-rw-r--r--include/linux/ipv6.h1
-rw-r--r--include/linux/irq.h34
-rw-r--r--include/linux/irqnr.h30
-rw-r--r--include/linux/istallion.h2
-rw-r--r--include/linux/jbd.h15
-rw-r--r--include/linux/jbd2.h70
-rw-r--r--include/linux/jiffies.h10
-rw-r--r--include/linux/journal-head.h8
-rw-r--r--include/linux/kernel.h32
-rw-r--r--include/linux/kernel_stat.h13
-rw-r--r--include/linux/key-ui.h66
-rw-r--r--include/linux/key.h32
-rw-r--r--include/linux/keyctl.h4
-rw-r--r--include/linux/klist.h2
-rw-r--r--include/linux/kprobes.h15
-rw-r--r--include/linux/kvm.h18
-rw-r--r--include/linux/kvm_host.h42
-rw-r--r--include/linux/leds-pca9532.h2
-rw-r--r--include/linux/leds.h5
-rw-r--r--include/linux/lguest_launcher.h6
-rw-r--r--include/linux/libata.h75
-rw-r--r--include/linux/libps2.h2
-rw-r--r--include/linux/linkage.h8
-rw-r--r--include/linux/list_nulls.h94
-rw-r--r--include/linux/lockd/bind.h1
-rw-r--r--include/linux/lockd/lockd.h72
-rw-r--r--include/linux/lockd/sm_inter.h48
-rw-r--r--include/linux/lockd/xdr.h15
-rw-r--r--include/linux/lockdep.h14
-rw-r--r--include/linux/mISDNhw.h26
-rw-r--r--include/linux/mISDNif.h89
-rw-r--r--include/linux/magic.h1
-rw-r--r--include/linux/map_to_7segment.h2
-rw-r--r--include/linux/mdio-gpio.h25
-rw-r--r--include/linux/memcontrol.h154
-rw-r--r--include/linux/memory.h6
-rw-r--r--include/linux/memory_hotplug.h2
-rw-r--r--include/linux/memstick.h4
-rw-r--r--include/linux/mfd/da903x.h44
-rw-r--r--include/linux/mfd/wm8350/audio.h38
-rw-r--r--include/linux/mfd/wm8350/comparator.h8
-rw-r--r--include/linux/mfd/wm8350/core.h52
-rw-r--r--include/linux/mfd/wm8350/pmic.h40
-rw-r--r--include/linux/mfd/wm8350/supply.h25
-rw-r--r--include/linux/migrate.h4
-rw-r--r--include/linux/mii.h33
-rw-r--r--include/linux/miscdevice.h42
-rw-r--r--include/linux/mlx4/device.h4
-rw-r--r--include/linux/mm.h44
-rw-r--r--include/linux/mm_inline.h22
-rw-r--r--include/linux/mm_types.h24
-rw-r--r--include/linux/mmc/core.h2
-rw-r--r--include/linux/mmc/host.h2
-rw-r--r--include/linux/mmzone.h24
-rw-r--r--include/linux/module.h15
-rw-r--r--include/linux/moduleloader.h3
-rw-r--r--include/linux/mroute6.h26
-rw-r--r--include/linux/mtd/cfi.h1
-rw-r--r--include/linux/mtd/concat.h2
-rw-r--r--include/linux/mtd/ftl.h38
-rw-r--r--include/linux/mtd/map.h1
-rw-r--r--include/linux/mtd/mtd.h77
-rw-r--r--include/linux/mtd/nand.h7
-rw-r--r--include/linux/mtd/partitions.h6
-rw-r--r--include/linux/mtd/pfow.h159
-rw-r--r--include/linux/mtd/physmap.h1
-rw-r--r--include/linux/mtd/qinfo.h91
-rw-r--r--include/linux/mtd/sharpsl.h20
-rw-r--r--include/linux/namei.h5
-rw-r--r--include/linux/ncp_fs.h2
-rw-r--r--include/linux/netdevice.h423
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h1
-rw-r--r--include/linux/netfilter_bridge/ebtables.h3
-rw-r--r--include/linux/netfilter_ipv4/ipt_policy.h2
-rw-r--r--include/linux/netfilter_ipv6/ip6t_policy.h2
-rw-r--r--include/linux/netlink.h3
-rw-r--r--include/linux/netpoll.h5
-rw-r--r--include/linux/nfs4.h2
-rw-r--r--include/linux/nfs_fs.h17
-rw-r--r--include/linux/nfs_fs_sb.h6
-rw-r--r--include/linux/nfs_mount.h3
-rw-r--r--include/linux/nfs_xdr.h7
-rw-r--r--include/linux/nfsd/nfsd.h1
-rw-r--r--include/linux/nfsd/nfsfh.h4
-rw-r--r--include/linux/nfsd/state.h2
-rw-r--r--include/linux/nl80211.h223
-rw-r--r--include/linux/node.h13
-rw-r--r--include/linux/nsproxy.h1
-rw-r--r--include/linux/nwpserial.h18
-rw-r--r--include/linux/of.h6
-rw-r--r--include/linux/of_gpio.h44
-rw-r--r--include/linux/of_platform.h3
-rw-r--r--include/linux/oprofile.h21
-rw-r--r--include/linux/oxu210hp.h7
-rw-r--r--include/linux/page-flags.h26
-rw-r--r--include/linux/page_cgroup.h52
-rw-r--r--include/linux/pagemap.h3
-rw-r--r--include/linux/pagevec.h7
-rw-r--r--include/linux/pci-acpi.h23
-rw-r--r--include/linux/pci.h97
-rw-r--r--include/linux/pci_hotplug.h3
-rw-r--r--include/linux/pci_ids.h8
-rw-r--r--include/linux/pci_regs.h76
-rw-r--r--include/linux/percpu_counter.h22
-rw-r--r--include/linux/phy.h2
-rw-r--r--include/linux/pid.h18
-rw-r--r--include/linux/pid_namespace.h6
-rw-r--r--include/linux/pkt_cls.h14
-rw-r--r--include/linux/pkt_sched.h16
-rw-r--r--include/linux/platform_device.h1
-rw-r--r--include/linux/pm.h88
-rw-r--r--include/linux/poll.h15
-rw-r--r--include/linux/posix-timers.h6
-rw-r--r--include/linux/power_supply.h1
-rw-r--r--include/linux/ptrace.h22
-rw-r--r--include/linux/qnx4_fs.h4
-rw-r--r--include/linux/qnxtypes.h5
-rw-r--r--include/linux/quota.h108
-rw-r--r--include/linux/quotaio_v1.h33
-rw-r--r--include/linux/quotaio_v2.h79
-rw-r--r--include/linux/quotaops.h96
-rw-r--r--include/linux/radix-tree.h2
-rw-r--r--include/linux/raid/md_k.h20
-rw-r--r--include/linux/raid/md_p.h2
-rw-r--r--include/linux/raid/raid0.h10
-rw-r--r--include/linux/random.h50
-rw-r--r--include/linux/rbtree.h8
-rw-r--r--include/linux/rcuclassic.h4
-rw-r--r--include/linux/rculist_nulls.h110
-rw-r--r--include/linux/rcupdate.h22
-rw-r--r--include/linux/rcutree.h329
-rw-r--r--include/linux/regulator/consumer.h8
-rw-r--r--include/linux/regulator/driver.h37
-rw-r--r--include/linux/regulator/machine.h41
-rw-r--r--include/linux/res_counter.h8
-rw-r--r--include/linux/rfkill.h8
-rw-r--r--include/linux/ring_buffer.h2
-rw-r--r--include/linux/rio_drv.h5
-rw-r--r--include/linux/rmap.h5
-rw-r--r--include/linux/rtc.h8
-rw-r--r--include/linux/rtnetlink.h5
-rw-r--r--include/linux/sched.h80
-rw-r--r--include/linux/securebits.h2
-rw-r--r--include/linux/security.h508
-rw-r--r--include/linux/seq_file.h7
-rw-r--r--include/linux/serial.h3
-rw-r--r--include/linux/serial_8250.h3
-rw-r--r--include/linux/serial_core.h74
-rw-r--r--include/linux/serio.h1
-rw-r--r--include/linux/skbuff.h54
-rw-r--r--include/linux/slab.h10
-rw-r--r--include/linux/smp.h18
-rw-r--r--include/linux/smsc911x.h47
-rw-r--r--include/linux/snmp.h3
-rw-r--r--include/linux/spi/mmc_spi.h15
-rw-r--r--include/linux/spi/spi.h6
-rw-r--r--include/linux/spi/spi_gpio.h60
-rw-r--r--include/linux/spi/tdo24m.h13
-rw-r--r--include/linux/stop_machine.h28
-rw-r--r--include/linux/sunrpc/clnt.h2
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h1
-rw-r--r--include/linux/sunrpc/svc.h5
-rw-r--r--include/linux/sunrpc/svc_xprt.h8
-rw-r--r--include/linux/sunrpc/svcauth_gss.h1
-rw-r--r--include/linux/sunrpc/xdr.h15
-rw-r--r--include/linux/sunrpc/xprt.h3
-rw-r--r--include/linux/suspend.h13
-rw-r--r--include/linux/swab.h52
-rw-r--r--include/linux/swap.h79
-rw-r--r--include/linux/swiotlb.h23
-rw-r--r--include/linux/syscalls.h2
-rw-r--r--include/linux/threads.h16
-rw-r--r--include/linux/tick.h4
-rw-r--r--include/linux/time.h1
-rw-r--r--include/linux/timex.h73
-rw-r--r--include/linux/tty.h31
-rw-r--r--include/linux/tty_driver.h6
-rw-r--r--include/linux/types.h24
-rw-r--r--include/linux/uio_driver.h30
-rw-r--r--include/linux/unwind.h68
-rw-r--r--include/linux/usb.h30
-rw-r--r--include/linux/usb/association.h22
-rw-r--r--include/linux/usb/gpio_vbus.h30
-rw-r--r--include/linux/usb/musb.h5
-rw-r--r--include/linux/usb/otg.h1
-rw-r--r--include/linux/usb/wusb-wa.h1
-rw-r--r--include/linux/usb_usual.h7
-rw-r--r--include/linux/user_namespace.h13
-rw-r--r--include/linux/uwb.h123
-rw-r--r--include/linux/uwb/debug-cmd.h13
-rw-r--r--include/linux/uwb/debug.h82
-rw-r--r--include/linux/uwb/spec.h53
-rw-r--r--include/linux/uwb/umc.h2
-rw-r--r--include/linux/videodev2.h65
-rw-r--r--include/linux/virtio_balloon.h3
-rw-r--r--include/linux/virtio_console.h11
-rw-r--r--include/linux/virtio_net.h9
-rw-r--r--include/linux/virtio_pci.h8
-rw-r--r--include/linux/virtio_ring.h13
-rw-r--r--include/linux/vmalloc.h4
-rw-r--r--include/linux/wimax.h234
-rw-r--r--include/linux/wimax/Kbuild1
-rw-r--r--include/linux/wimax/debug.h453
-rw-r--r--include/linux/wimax/i2400m.h512
-rw-r--r--include/linux/wlp.h3
-rw-r--r--include/linux/writeback.h16
-rw-r--r--include/linux/xfrm.h14
311 files changed, 8111 insertions, 3600 deletions
diff --git a/include/linux/8250_pci.h b/include/linux/8250_pci.h
index 3209dd46ea7d..b24ff086a662 100644
--- a/include/linux/8250_pci.h
+++ b/include/linux/8250_pci.h
@@ -31,7 +31,7 @@ struct pciserial_board {
31struct serial_private; 31struct serial_private;
32 32
33struct serial_private * 33struct serial_private *
34pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board); 34pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board);
35void pciserial_remove_ports(struct serial_private *priv); 35void pciserial_remove_ports(struct serial_private *priv);
36void pciserial_suspend_ports(struct serial_private *priv); 36void pciserial_suspend_ports(struct serial_private *priv);
37void pciserial_resume_ports(struct serial_private *priv); 37void pciserial_resume_ports(struct serial_private *priv);
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 95ac82340c3b..12e9a2957caf 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -56,8 +56,6 @@ header-y += dlm_device.h
56header-y += dlm_netlink.h 56header-y += dlm_netlink.h
57header-y += dm-ioctl.h 57header-y += dm-ioctl.h
58header-y += dn.h 58header-y += dn.h
59header-y += dqblk_v1.h
60header-y += dqblk_v2.h
61header-y += dqblk_xfs.h 59header-y += dqblk_xfs.h
62header-y += efs_fs_sb.h 60header-y += efs_fs_sb.h
63header-y += elf-fdpic.h 61header-y += elf-fdpic.h
@@ -134,8 +132,6 @@ header-y += posix_types.h
134header-y += ppdev.h 132header-y += ppdev.h
135header-y += prctl.h 133header-y += prctl.h
136header-y += qnxtypes.h 134header-y += qnxtypes.h
137header-y += quotaio_v1.h
138header-y += quotaio_v2.h
139header-y += radeonfb.h 135header-y += radeonfb.h
140header-y += raw.h 136header-y += raw.h
141header-y += resource.h 137header-y += resource.h
@@ -183,7 +179,6 @@ unifdef-y += auto_fs.h
183unifdef-y += auxvec.h 179unifdef-y += auxvec.h
184unifdef-y += binfmts.h 180unifdef-y += binfmts.h
185unifdef-y += blktrace_api.h 181unifdef-y += blktrace_api.h
186unifdef-y += byteorder.h
187unifdef-y += capability.h 182unifdef-y += capability.h
188unifdef-y += capi.h 183unifdef-y += capi.h
189unifdef-y += cciss_ioctl.h 184unifdef-y += cciss_ioctl.h
@@ -376,3 +371,5 @@ unifdef-y += xattr.h
376unifdef-y += xfrm.h 371unifdef-y += xfrm.h
377 372
378objhdr-y += version.h 373objhdr-y += version.h
374header-y += wimax.h
375header-y += wimax/
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index fba8051fb297..6fce2fc2d124 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -131,22 +131,6 @@ extern int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity);
131 */ 131 */
132void acpi_unregister_gsi (u32 gsi); 132void acpi_unregister_gsi (u32 gsi);
133 133
134struct acpi_prt_entry {
135 struct list_head node;
136 struct acpi_pci_id id;
137 u8 pin;
138 struct {
139 acpi_handle handle;
140 u32 index;
141 } link;
142 u32 irq;
143};
144
145struct acpi_prt_list {
146 int count;
147 struct list_head entries;
148};
149
150struct pci_dev; 134struct pci_dev;
151 135
152int acpi_pci_irq_enable (struct pci_dev *dev); 136int acpi_pci_irq_enable (struct pci_dev *dev);
@@ -270,6 +254,7 @@ int acpi_check_mem_region(resource_size_t start, resource_size_t n,
270#ifdef CONFIG_PM_SLEEP 254#ifdef CONFIG_PM_SLEEP
271void __init acpi_no_s4_hw_signature(void); 255void __init acpi_no_s4_hw_signature(void);
272void __init acpi_old_suspend_ordering(void); 256void __init acpi_old_suspend_ordering(void);
257void __init acpi_s4_no_nvs(void);
273#endif /* CONFIG_PM_SLEEP */ 258#endif /* CONFIG_PM_SLEEP */
274#else /* CONFIG_ACPI */ 259#else /* CONFIG_ACPI */
275 260
diff --git a/include/linux/aio.h b/include/linux/aio.h
index f6b8cf99b596..b16a957030f8 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -5,6 +5,7 @@
5#include <linux/workqueue.h> 5#include <linux/workqueue.h>
6#include <linux/aio_abi.h> 6#include <linux/aio_abi.h>
7#include <linux/uio.h> 7#include <linux/uio.h>
8#include <linux/rcupdate.h>
8 9
9#include <asm/atomic.h> 10#include <asm/atomic.h>
10 11
@@ -183,7 +184,7 @@ struct kioctx {
183 184
184 /* This needs improving */ 185 /* This needs improving */
185 unsigned long user_id; 186 unsigned long user_id;
186 struct kioctx *next; 187 struct hlist_node list;
187 188
188 wait_queue_head_t wait; 189 wait_queue_head_t wait;
189 190
@@ -199,6 +200,8 @@ struct kioctx {
199 struct aio_ring_info ring_info; 200 struct aio_ring_info ring_info;
200 201
201 struct delayed_work wq; 202 struct delayed_work wq;
203
204 struct rcu_head rcu_head;
202}; 205};
203 206
204/* prototypes */ 207/* prototypes */
diff --git a/include/linux/async.h b/include/linux/async.h
new file mode 100644
index 000000000000..c4ecacd0b327
--- /dev/null
+++ b/include/linux/async.h
@@ -0,0 +1,25 @@
1/*
2 * async.h: Asynchronous function calls for boot performance
3 *
4 * (C) Copyright 2009 Intel Corporation
5 * Author: Arjan van de Ven <arjan@linux.intel.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; version 2
10 * of the License.
11 */
12
13#include <linux/types.h>
14#include <linux/list.h>
15
16typedef u64 async_cookie_t;
17typedef void (async_func_ptr) (void *data, async_cookie_t cookie);
18
19extern async_cookie_t async_schedule(async_func_ptr *ptr, void *data);
20extern async_cookie_t async_schedule_special(async_func_ptr *ptr, void *data, struct list_head *list);
21extern void async_synchronize_full(void);
22extern void async_synchronize_full_special(struct list_head *list);
23extern void async_synchronize_cookie(async_cookie_t cookie);
24extern void async_synchronize_cookie_special(async_cookie_t cookie, struct list_head *list);
25
diff --git a/include/linux/async_tx.h b/include/linux/async_tx.h
index 0f50d4cc4360..45f6297821bd 100644
--- a/include/linux/async_tx.h
+++ b/include/linux/async_tx.h
@@ -59,9 +59,7 @@ enum async_tx_flags {
59}; 59};
60 60
61#ifdef CONFIG_DMA_ENGINE 61#ifdef CONFIG_DMA_ENGINE
62void async_tx_issue_pending_all(void); 62#define async_tx_issue_pending_all dma_issue_pending_all
63enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
64void async_tx_run_dependencies(struct dma_async_tx_descriptor *tx);
65#ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL 63#ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL
66#include <asm/async_tx.h> 64#include <asm/async_tx.h>
67#else 65#else
@@ -77,19 +75,6 @@ static inline void async_tx_issue_pending_all(void)
77 do { } while (0); 75 do { } while (0);
78} 76}
79 77
80static inline enum dma_status
81dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
82{
83 return DMA_SUCCESS;
84}
85
86static inline void
87async_tx_run_dependencies(struct dma_async_tx_descriptor *tx,
88 struct dma_chan *host_chan)
89{
90 do { } while (0);
91}
92
93static inline struct dma_chan * 78static inline struct dma_chan *
94async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx, 79async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx,
95 enum dma_transaction_type tx_type, struct page **dst, int dst_count, 80 enum dma_transaction_type tx_type, struct page **dst, int dst_count,
diff --git a/include/linux/atm.h b/include/linux/atm.h
index c791ddd96939..d3b292174aeb 100644
--- a/include/linux/atm.h
+++ b/include/linux/atm.h
@@ -231,10 +231,21 @@ static __inline__ int atmpvc_addr_in_use(struct sockaddr_atmpvc addr)
231 */ 231 */
232 232
233struct atmif_sioc { 233struct atmif_sioc {
234 int number; 234 int number;
235 int length; 235 int length;
236 void __user *arg; 236 void __user *arg;
237}; 237};
238 238
239#ifdef __KERNEL__
240#ifdef CONFIG_COMPAT
241#include <linux/compat.h>
242struct compat_atmif_sioc {
243 int number;
244 int length;
245 compat_uptr_t arg;
246};
247#endif
248#endif
249
239typedef unsigned short atm_backend_t; 250typedef unsigned short atm_backend_t;
240#endif 251#endif
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index a3d07c29d16c..086e5c362d3a 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -100,6 +100,10 @@ struct atm_dev_stats {
100 /* use backend to make new if */ 100 /* use backend to make new if */
101#define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf) 101#define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf)
102 /* add party to p2mp call */ 102 /* add party to p2mp call */
103#ifdef CONFIG_COMPAT
104/* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */
105#define COMPAT_ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct compat_atm_iobuf)
106#endif
103#define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int) 107#define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int)
104 /* drop party from p2mp call */ 108 /* drop party from p2mp call */
105 109
@@ -224,6 +228,13 @@ struct atm_cirange {
224extern struct proc_dir_entry *atm_proc_root; 228extern struct proc_dir_entry *atm_proc_root;
225#endif 229#endif
226 230
231#ifdef CONFIG_COMPAT
232#include <linux/compat.h>
233struct compat_atm_iobuf {
234 int length;
235 compat_uptr_t buffer;
236};
237#endif
227 238
228struct k_atm_aal_stats { 239struct k_atm_aal_stats {
229#define __HANDLE_ITEM(i) atomic_t i 240#define __HANDLE_ITEM(i) atomic_t i
@@ -379,6 +390,10 @@ struct atmdev_ops { /* only send is required */
379 int (*open)(struct atm_vcc *vcc); 390 int (*open)(struct atm_vcc *vcc);
380 void (*close)(struct atm_vcc *vcc); 391 void (*close)(struct atm_vcc *vcc);
381 int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg); 392 int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg);
393#ifdef CONFIG_COMPAT
394 int (*compat_ioctl)(struct atm_dev *dev,unsigned int cmd,
395 void __user *arg);
396#endif
382 int (*getsockopt)(struct atm_vcc *vcc,int level,int optname, 397 int (*getsockopt)(struct atm_vcc *vcc,int level,int optname,
383 void __user *optval,int optlen); 398 void __user *optval,int optlen);
384 int (*setsockopt)(struct atm_vcc *vcc,int level,int optname, 399 int (*setsockopt)(struct atm_vcc *vcc,int level,int optname,
diff --git a/include/linux/atmel-mci.h b/include/linux/atmel-mci.h
new file mode 100644
index 000000000000..2f1f95737acb
--- /dev/null
+++ b/include/linux/atmel-mci.h
@@ -0,0 +1,39 @@
1#ifndef __LINUX_ATMEL_MCI_H
2#define __LINUX_ATMEL_MCI_H
3
4#define ATMEL_MCI_MAX_NR_SLOTS 2
5
6#include <linux/dw_dmac.h>
7
8/**
9 * struct mci_slot_pdata - board-specific per-slot configuration
10 * @bus_width: Number of data lines wired up the slot
11 * @detect_pin: GPIO pin wired to the card detect switch
12 * @wp_pin: GPIO pin wired to the write protect sensor
13 *
14 * If a given slot is not present on the board, @bus_width should be
15 * set to 0. The other fields are ignored in this case.
16 *
17 * Any pins that aren't available should be set to a negative value.
18 *
19 * Note that support for multiple slots is experimental -- some cards
20 * might get upset if we don't get the clock management exactly right.
21 * But in most cases, it should work just fine.
22 */
23struct mci_slot_pdata {
24 unsigned int bus_width;
25 int detect_pin;
26 int wp_pin;
27};
28
29/**
30 * struct mci_platform_data - board-specific MMC/SDcard configuration
31 * @dma_slave: DMA slave interface to use in data transfers.
32 * @slot: Per-slot configuration data.
33 */
34struct mci_platform_data {
35 struct dw_dma_slave dma_slave;
36 struct mci_slot_pdata slot[ATMEL_MCI_MAX_NR_SLOTS];
37};
38
39#endif /* __LINUX_ATMEL_MCI_H */
diff --git a/include/linux/audit.h b/include/linux/audit.h
index 8f0672d13eb1..67e5dbfc2961 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -99,6 +99,8 @@
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#define AUDIT_EOE 1320 /* End of multi-record event */
102#define AUDIT_BPRM_FCAPS 1321 /* Information about fcaps increasing perms */
103#define AUDIT_CAPSET 1322 /* Record showing argument to sys_capset */
102 104
103#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ 105#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
104#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ 106#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
@@ -245,6 +247,18 @@
245#define AUDIT_GREATER_THAN_OR_EQUAL (AUDIT_GREATER_THAN|AUDIT_EQUAL) 247#define AUDIT_GREATER_THAN_OR_EQUAL (AUDIT_GREATER_THAN|AUDIT_EQUAL)
246#define AUDIT_OPERATORS (AUDIT_EQUAL|AUDIT_NOT_EQUAL|AUDIT_BIT_MASK) 248#define AUDIT_OPERATORS (AUDIT_EQUAL|AUDIT_NOT_EQUAL|AUDIT_BIT_MASK)
247 249
250enum {
251 Audit_equal,
252 Audit_not_equal,
253 Audit_bitmask,
254 Audit_bittest,
255 Audit_lt,
256 Audit_gt,
257 Audit_le,
258 Audit_ge,
259 Audit_bad
260};
261
248/* Status symbols */ 262/* Status symbols */
249 /* Mask values */ 263 /* Mask values */
250#define AUDIT_STATUS_ENABLED 0x0001 264#define AUDIT_STATUS_ENABLED 0x0001
@@ -371,6 +385,8 @@ struct audit_krule {
371 struct audit_watch *watch; /* associated watch */ 385 struct audit_watch *watch; /* associated watch */
372 struct audit_tree *tree; /* associated watched tree */ 386 struct audit_tree *tree; /* associated watched tree */
373 struct list_head rlist; /* entry in audit_{watch,tree}.rules list */ 387 struct list_head rlist; /* entry in audit_{watch,tree}.rules list */
388 struct list_head list; /* for AUDIT_LIST* purposes only */
389 u64 prio;
374}; 390};
375 391
376struct audit_field { 392struct audit_field {
@@ -441,67 +457,74 @@ extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
441#define audit_get_loginuid(t) ((t)->loginuid) 457#define audit_get_loginuid(t) ((t)->loginuid)
442#define audit_get_sessionid(t) ((t)->sessionid) 458#define audit_get_sessionid(t) ((t)->sessionid)
443extern void audit_log_task_context(struct audit_buffer *ab); 459extern void audit_log_task_context(struct audit_buffer *ab);
444extern int __audit_ipc_obj(struct kern_ipc_perm *ipcp); 460extern void __audit_ipc_obj(struct kern_ipc_perm *ipcp);
445extern int __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode); 461extern void __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode);
446extern int audit_bprm(struct linux_binprm *bprm); 462extern int audit_bprm(struct linux_binprm *bprm);
447extern int audit_socketcall(int nargs, unsigned long *args); 463extern void audit_socketcall(int nargs, unsigned long *args);
448extern int audit_sockaddr(int len, void *addr); 464extern int audit_sockaddr(int len, void *addr);
449extern int __audit_fd_pair(int fd1, int fd2); 465extern void __audit_fd_pair(int fd1, int fd2);
450extern int audit_set_macxattr(const char *name); 466extern int audit_set_macxattr(const char *name);
451extern int __audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr); 467extern void __audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr);
452extern int __audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout); 468extern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout);
453extern int __audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout); 469extern void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification);
454extern int __audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification); 470extern void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
455extern int __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat); 471extern int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
456 472 const struct cred *new,
457static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp) 473 const struct cred *old);
474extern void __audit_log_capset(pid_t pid, const struct cred *new, const struct cred *old);
475
476static inline void audit_ipc_obj(struct kern_ipc_perm *ipcp)
458{ 477{
459 if (unlikely(!audit_dummy_context())) 478 if (unlikely(!audit_dummy_context()))
460 return __audit_ipc_obj(ipcp); 479 __audit_ipc_obj(ipcp);
461 return 0;
462} 480}
463static inline int audit_fd_pair(int fd1, int fd2) 481static inline void audit_fd_pair(int fd1, int fd2)
464{ 482{
465 if (unlikely(!audit_dummy_context())) 483 if (unlikely(!audit_dummy_context()))
466 return __audit_fd_pair(fd1, fd2); 484 __audit_fd_pair(fd1, fd2);
467 return 0;
468} 485}
469static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode) 486static inline void audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode)
470{ 487{
471 if (unlikely(!audit_dummy_context())) 488 if (unlikely(!audit_dummy_context()))
472 return __audit_ipc_set_perm(qbytes, uid, gid, mode); 489 __audit_ipc_set_perm(qbytes, uid, gid, mode);
473 return 0;
474} 490}
475static inline int audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr) 491static inline void audit_mq_open(int oflag, mode_t mode, struct mq_attr *attr)
476{ 492{
477 if (unlikely(!audit_dummy_context())) 493 if (unlikely(!audit_dummy_context()))
478 return __audit_mq_open(oflag, mode, u_attr); 494 __audit_mq_open(oflag, mode, attr);
479 return 0;
480} 495}
481static inline int audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout) 496static inline void audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout)
482{ 497{
483 if (unlikely(!audit_dummy_context())) 498 if (unlikely(!audit_dummy_context()))
484 return __audit_mq_timedsend(mqdes, msg_len, msg_prio, u_abs_timeout); 499 __audit_mq_sendrecv(mqdes, msg_len, msg_prio, abs_timeout);
485 return 0;
486} 500}
487static inline int audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout) 501static inline void audit_mq_notify(mqd_t mqdes, const struct sigevent *notification)
488{ 502{
489 if (unlikely(!audit_dummy_context())) 503 if (unlikely(!audit_dummy_context()))
490 return __audit_mq_timedreceive(mqdes, msg_len, u_msg_prio, u_abs_timeout); 504 __audit_mq_notify(mqdes, notification);
491 return 0;
492} 505}
493static inline int audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification) 506static inline void audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
494{ 507{
495 if (unlikely(!audit_dummy_context())) 508 if (unlikely(!audit_dummy_context()))
496 return __audit_mq_notify(mqdes, u_notification); 509 __audit_mq_getsetattr(mqdes, mqstat);
497 return 0;
498} 510}
499static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat) 511
512static inline int audit_log_bprm_fcaps(struct linux_binprm *bprm,
513 const struct cred *new,
514 const struct cred *old)
500{ 515{
501 if (unlikely(!audit_dummy_context())) 516 if (unlikely(!audit_dummy_context()))
502 return __audit_mq_getsetattr(mqdes, mqstat); 517 return __audit_log_bprm_fcaps(bprm, new, old);
503 return 0; 518 return 0;
504} 519}
520
521static inline void audit_log_capset(pid_t pid, const struct cred *new,
522 const struct cred *old)
523{
524 if (unlikely(!audit_dummy_context()))
525 __audit_log_capset(pid, new, old);
526}
527
505extern int audit_n_rules; 528extern int audit_n_rules;
506extern int audit_signals; 529extern int audit_signals;
507#else 530#else
@@ -522,18 +545,19 @@ extern int audit_signals;
522#define audit_get_loginuid(t) (-1) 545#define audit_get_loginuid(t) (-1)
523#define audit_get_sessionid(t) (-1) 546#define audit_get_sessionid(t) (-1)
524#define audit_log_task_context(b) do { ; } while (0) 547#define audit_log_task_context(b) do { ; } while (0)
525#define audit_ipc_obj(i) ({ 0; }) 548#define audit_ipc_obj(i) ((void)0)
526#define audit_ipc_set_perm(q,u,g,m) ({ 0; }) 549#define audit_ipc_set_perm(q,u,g,m) ((void)0)
527#define audit_bprm(p) ({ 0; }) 550#define audit_bprm(p) ({ 0; })
528#define audit_socketcall(n,a) ({ 0; }) 551#define audit_socketcall(n,a) ((void)0)
529#define audit_fd_pair(n,a) ({ 0; }) 552#define audit_fd_pair(n,a) ((void)0)
530#define audit_sockaddr(len, addr) ({ 0; }) 553#define audit_sockaddr(len, addr) ({ 0; })
531#define audit_set_macxattr(n) do { ; } while (0) 554#define audit_set_macxattr(n) do { ; } while (0)
532#define audit_mq_open(o,m,a) ({ 0; }) 555#define audit_mq_open(o,m,a) ((void)0)
533#define audit_mq_timedsend(d,l,p,t) ({ 0; }) 556#define audit_mq_sendrecv(d,l,p,t) ((void)0)
534#define audit_mq_timedreceive(d,l,p,t) ({ 0; }) 557#define audit_mq_notify(d,n) ((void)0)
535#define audit_mq_notify(d,n) ({ 0; }) 558#define audit_mq_getsetattr(d,s) ((void)0)
536#define audit_mq_getsetattr(d,s) ({ 0; }) 559#define audit_log_bprm_fcaps(b, ncr, ocr) ({ 0; })
560#define audit_log_capset(pid, ncr, ocr) ((void)0)
537#define audit_ptrace(t) ((void)0) 561#define audit_ptrace(t) ((void)0)
538#define audit_n_rules 0 562#define audit_n_rules 0
539#define audit_signals 0 563#define audit_signals 0
diff --git a/include/linux/auto_dev-ioctl.h b/include/linux/auto_dev-ioctl.h
index f4d05ccd731f..91a773993a5c 100644
--- a/include/linux/auto_dev-ioctl.h
+++ b/include/linux/auto_dev-ioctl.h
@@ -10,6 +10,7 @@
10#ifndef _LINUX_AUTO_DEV_IOCTL_H 10#ifndef _LINUX_AUTO_DEV_IOCTL_H
11#define _LINUX_AUTO_DEV_IOCTL_H 11#define _LINUX_AUTO_DEV_IOCTL_H
12 12
13#include <linux/string.h>
13#include <linux/types.h> 14#include <linux/types.h>
14 15
15#define AUTOFS_DEVICE_NAME "autofs" 16#define AUTOFS_DEVICE_NAME "autofs"
@@ -25,6 +26,60 @@
25 * An ioctl interface for autofs mount point control. 26 * An ioctl interface for autofs mount point control.
26 */ 27 */
27 28
29struct args_protover {
30 __u32 version;
31};
32
33struct args_protosubver {
34 __u32 sub_version;
35};
36
37struct args_openmount {
38 __u32 devid;
39};
40
41struct args_ready {
42 __u32 token;
43};
44
45struct args_fail {
46 __u32 token;
47 __s32 status;
48};
49
50struct args_setpipefd {
51 __s32 pipefd;
52};
53
54struct args_timeout {
55 __u64 timeout;
56};
57
58struct args_requester {
59 __u32 uid;
60 __u32 gid;
61};
62
63struct args_expire {
64 __u32 how;
65};
66
67struct args_askumount {
68 __u32 may_umount;
69};
70
71struct args_ismountpoint {
72 union {
73 struct args_in {
74 __u32 type;
75 } in;
76 struct args_out {
77 __u32 devid;
78 __u32 magic;
79 } out;
80 };
81};
82
28/* 83/*
29 * All the ioctls use this structure. 84 * All the ioctls use this structure.
30 * When sending a path size must account for the total length 85 * When sending a path size must account for the total length
@@ -39,20 +94,32 @@ struct autofs_dev_ioctl {
39 * including this struct */ 94 * including this struct */
40 __s32 ioctlfd; /* automount command fd */ 95 __s32 ioctlfd; /* automount command fd */
41 96
42 __u32 arg1; /* Command parameters */ 97 /* Command parameters */
43 __u32 arg2; 98
99 union {
100 struct args_protover protover;
101 struct args_protosubver protosubver;
102 struct args_openmount openmount;
103 struct args_ready ready;
104 struct args_fail fail;
105 struct args_setpipefd setpipefd;
106 struct args_timeout timeout;
107 struct args_requester requester;
108 struct args_expire expire;
109 struct args_askumount askumount;
110 struct args_ismountpoint ismountpoint;
111 };
44 112
45 char path[0]; 113 char path[0];
46}; 114};
47 115
48static inline void init_autofs_dev_ioctl(struct autofs_dev_ioctl *in) 116static inline void init_autofs_dev_ioctl(struct autofs_dev_ioctl *in)
49{ 117{
118 memset(in, 0, sizeof(struct autofs_dev_ioctl));
50 in->ver_major = AUTOFS_DEV_IOCTL_VERSION_MAJOR; 119 in->ver_major = AUTOFS_DEV_IOCTL_VERSION_MAJOR;
51 in->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR; 120 in->ver_minor = AUTOFS_DEV_IOCTL_VERSION_MINOR;
52 in->size = sizeof(struct autofs_dev_ioctl); 121 in->size = sizeof(struct autofs_dev_ioctl);
53 in->ioctlfd = -1; 122 in->ioctlfd = -1;
54 in->arg1 = 0;
55 in->arg2 = 0;
56 return; 123 return;
57} 124}
58 125
diff --git a/include/linux/auto_fs4.h b/include/linux/auto_fs4.h
index 2253716d4b92..55fa478bd639 100644
--- a/include/linux/auto_fs4.h
+++ b/include/linux/auto_fs4.h
@@ -29,10 +29,64 @@
29#define AUTOFS_EXP_IMMEDIATE 1 29#define AUTOFS_EXP_IMMEDIATE 1
30#define AUTOFS_EXP_LEAVES 2 30#define AUTOFS_EXP_LEAVES 2
31 31
32#define AUTOFS_TYPE_ANY 0x0000 32#define AUTOFS_TYPE_ANY 0U
33#define AUTOFS_TYPE_INDIRECT 0x0001 33#define AUTOFS_TYPE_INDIRECT 1U
34#define AUTOFS_TYPE_DIRECT 0x0002 34#define AUTOFS_TYPE_DIRECT 2U
35#define AUTOFS_TYPE_OFFSET 0x0004 35#define AUTOFS_TYPE_OFFSET 4U
36
37static inline void set_autofs_type_indirect(unsigned int *type)
38{
39 *type = AUTOFS_TYPE_INDIRECT;
40 return;
41}
42
43static inline unsigned int autofs_type_indirect(unsigned int type)
44{
45 return (type == AUTOFS_TYPE_INDIRECT);
46}
47
48static inline void set_autofs_type_direct(unsigned int *type)
49{
50 *type = AUTOFS_TYPE_DIRECT;
51 return;
52}
53
54static inline unsigned int autofs_type_direct(unsigned int type)
55{
56 return (type == AUTOFS_TYPE_DIRECT);
57}
58
59static inline void set_autofs_type_offset(unsigned int *type)
60{
61 *type = AUTOFS_TYPE_OFFSET;
62 return;
63}
64
65static inline unsigned int autofs_type_offset(unsigned int type)
66{
67 return (type == AUTOFS_TYPE_OFFSET);
68}
69
70static inline unsigned int autofs_type_trigger(unsigned int type)
71{
72 return (type == AUTOFS_TYPE_DIRECT || type == AUTOFS_TYPE_OFFSET);
73}
74
75/*
76 * This isn't really a type as we use it to say "no type set" to
77 * indicate we want to search for "any" mount in the
78 * autofs_dev_ioctl_ismountpoint() device ioctl function.
79 */
80static inline void set_autofs_type_any(unsigned int *type)
81{
82 *type = AUTOFS_TYPE_ANY;
83 return;
84}
85
86static inline unsigned int autofs_type_any(unsigned int type)
87{
88 return (type == AUTOFS_TYPE_ANY);
89}
36 90
37/* Daemon notification packet types */ 91/* Daemon notification packet types */
38enum autofs_notify { 92enum autofs_notify {
diff --git a/include/linux/auxvec.h b/include/linux/auxvec.h
index d7afa9dd6635..f3b5d4e3a2ac 100644
--- a/include/linux/auxvec.h
+++ b/include/linux/auxvec.h
@@ -23,16 +23,16 @@
23#define AT_PLATFORM 15 /* string identifying CPU for optimizations */ 23#define AT_PLATFORM 15 /* string identifying CPU for optimizations */
24#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */ 24#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */
25#define AT_CLKTCK 17 /* frequency at which times() increments */ 25#define AT_CLKTCK 17 /* frequency at which times() increments */
26 26/* AT_* values 18 through 22 are reserved */
27#define AT_SECURE 23 /* secure mode boolean */ 27#define AT_SECURE 23 /* secure mode boolean */
28
29#define AT_BASE_PLATFORM 24 /* string identifying real platform, may 28#define AT_BASE_PLATFORM 24 /* string identifying real platform, may
30 * differ from AT_PLATFORM. */ 29 * differ from AT_PLATFORM. */
30#define AT_RANDOM 25 /* address of 16 random bytes */
31 31
32#define AT_EXECFN 31 /* filename of program */ 32#define AT_EXECFN 31 /* filename of program */
33 33
34#ifdef __KERNEL__ 34#ifdef __KERNEL__
35#define AT_VECTOR_SIZE_BASE 18 /* NEW_AUX_ENT entries in auxiliary table */ 35#define AT_VECTOR_SIZE_BASE 19 /* NEW_AUX_ENT entries in auxiliary table */
36 /* number of "#define AT_.*" above, minus {AT_NULL, AT_IGNORE, AT_NOTELF} */ 36 /* number of "#define AT_.*" above, minus {AT_NULL, AT_IGNORE, AT_NOTELF} */
37#endif 37#endif
38 38
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 1ee9488ca2e4..79ca2da81c87 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -31,6 +31,10 @@ struct backlight_device;
31struct fb_info; 31struct fb_info;
32 32
33struct backlight_ops { 33struct backlight_ops {
34 unsigned int options;
35
36#define BL_CORE_SUSPENDRESUME (1 << 0)
37
34 /* Notify the backlight driver some property has changed */ 38 /* Notify the backlight driver some property has changed */
35 int (*update_status)(struct backlight_device *); 39 int (*update_status)(struct backlight_device *);
36 /* Return the current backlight brightness (accounting for power, 40 /* Return the current backlight brightness (accounting for power,
@@ -51,7 +55,19 @@ struct backlight_properties {
51 modes; 4: full off), see FB_BLANK_XXX */ 55 modes; 4: full off), see FB_BLANK_XXX */
52 int power; 56 int power;
53 /* FB Blanking active? (values as for power) */ 57 /* FB Blanking active? (values as for power) */
58 /* Due to be removed, please use (state & BL_CORE_FBBLANK) */
54 int fb_blank; 59 int fb_blank;
60 /* Flags used to signal drivers of state changes */
61 /* Upper 4 bits are reserved for driver internal use */
62 unsigned int state;
63
64#define BL_CORE_SUSPENDED (1 << 0) /* backlight is suspended */
65#define BL_CORE_FBBLANK (1 << 1) /* backlight is under an fb blank event */
66#define BL_CORE_DRIVER4 (1 << 28) /* reserved for driver specific use */
67#define BL_CORE_DRIVER3 (1 << 29) /* reserved for driver specific use */
68#define BL_CORE_DRIVER2 (1 << 30) /* reserved for driver specific use */
69#define BL_CORE_DRIVER1 (1 << 31) /* reserved for driver specific use */
70
55}; 71};
56 72
57struct backlight_device { 73struct backlight_device {
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
index 7394b5b349ff..77b4a9e46004 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
@@ -18,6 +18,7 @@ struct pt_regs;
18#define BINPRM_BUF_SIZE 128 18#define BINPRM_BUF_SIZE 128
19 19
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21#include <linux/list.h>
21 22
22#define CORENAME_MAX_SIZE 128 23#define CORENAME_MAX_SIZE 128
23 24
@@ -35,16 +36,20 @@ struct linux_binprm{
35 struct mm_struct *mm; 36 struct mm_struct *mm;
36 unsigned long p; /* current top of mem */ 37 unsigned long p; /* current top of mem */
37 unsigned int sh_bang:1, 38 unsigned int sh_bang:1,
38 misc_bang:1; 39 misc_bang:1,
40 cred_prepared:1,/* true if creds already prepared (multiple
41 * preps happen for interpreters) */
42 cap_effective:1;/* true if has elevated effective capabilities,
43 * false if not; except for init which inherits
44 * its parent's caps anyway */
39#ifdef __alpha__ 45#ifdef __alpha__
40 unsigned int taso:1; 46 unsigned int taso:1;
41#endif 47#endif
42 unsigned int recursion_depth; 48 unsigned int recursion_depth;
43 struct file * file; 49 struct file * file;
44 int e_uid, e_gid; 50 struct cred *cred; /* new credentials */
45 kernel_cap_t cap_post_exec_permitted; 51 int unsafe; /* how unsafe this exec is (mask of LSM_UNSAFE_*) */
46 bool cap_effective; 52 unsigned int per_clear; /* bits to clear in current->personality */
47 void *security;
48 int argc, envc; 53 int argc, envc;
49 char * filename; /* Name of binary as seen by procps */ 54 char * filename; /* Name of binary as seen by procps */
50 char * interp; /* Name of the binary really executed. Most 55 char * interp; /* Name of the binary really executed. Most
@@ -101,8 +106,8 @@ extern int setup_arg_pages(struct linux_binprm * bprm,
101 int executable_stack); 106 int executable_stack);
102extern int bprm_mm_init(struct linux_binprm *bprm); 107extern int bprm_mm_init(struct linux_binprm *bprm);
103extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm); 108extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm);
104extern void compute_creds(struct linux_binprm *binprm); 109extern void install_exec_creds(struct linux_binprm *bprm);
105extern int do_coredump(long signr, int exit_code, struct pt_regs * regs); 110extern void do_coredump(long signr, int exit_code, struct pt_regs *regs);
106extern int set_binfmt(struct linux_binfmt *new); 111extern int set_binfmt(struct linux_binfmt *new);
107extern void free_bprm(struct linux_binprm *); 112extern void free_bprm(struct linux_binprm *);
108 113
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 6a642098e5c3..18462c5b8fff 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -90,10 +90,11 @@ struct bio {
90 90
91 unsigned int bi_comp_cpu; /* completion CPU */ 91 unsigned int bi_comp_cpu; /* completion CPU */
92 92
93 atomic_t bi_cnt; /* pin count */
94
93 struct bio_vec *bi_io_vec; /* the actual vec list */ 95 struct bio_vec *bi_io_vec; /* the actual vec list */
94 96
95 bio_end_io_t *bi_end_io; 97 bio_end_io_t *bi_end_io;
96 atomic_t bi_cnt; /* pin count */
97 98
98 void *bi_private; 99 void *bi_private;
99#if defined(CONFIG_BLK_DEV_INTEGRITY) 100#if defined(CONFIG_BLK_DEV_INTEGRITY)
@@ -101,6 +102,13 @@ struct bio {
101#endif 102#endif
102 103
103 bio_destructor_t *bi_destructor; /* destructor */ 104 bio_destructor_t *bi_destructor; /* destructor */
105
106 /*
107 * We can inline a number of vecs at the end of the bio, to avoid
108 * double allocations for a small number of bio_vecs. This member
109 * MUST obviously be kept at the very end of the bio.
110 */
111 struct bio_vec bi_inline_vecs[0];
104}; 112};
105 113
106/* 114/*
@@ -117,6 +125,7 @@ struct bio {
117#define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */ 125#define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */
118#define BIO_NULL_MAPPED 9 /* contains invalid user pages */ 126#define BIO_NULL_MAPPED 9 /* contains invalid user pages */
119#define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */ 127#define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */
128#define BIO_QUIET 11 /* Make BIO Quiet */
120#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) 129#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
121 130
122/* 131/*
@@ -211,6 +220,11 @@ static inline void *bio_data(struct bio *bio)
211 return NULL; 220 return NULL;
212} 221}
213 222
223static inline int bio_has_allocated_vec(struct bio *bio)
224{
225 return bio->bi_io_vec && bio->bi_io_vec != bio->bi_inline_vecs;
226}
227
214/* 228/*
215 * will die 229 * will die
216 */ 230 */
@@ -332,7 +346,7 @@ struct bio_pair {
332extern struct bio_pair *bio_split(struct bio *bi, int first_sectors); 346extern struct bio_pair *bio_split(struct bio *bi, int first_sectors);
333extern void bio_pair_release(struct bio_pair *dbio); 347extern void bio_pair_release(struct bio_pair *dbio);
334 348
335extern struct bio_set *bioset_create(int, int); 349extern struct bio_set *bioset_create(unsigned int, unsigned int);
336extern void bioset_free(struct bio_set *); 350extern void bioset_free(struct bio_set *);
337 351
338extern struct bio *bio_alloc(gfp_t, int); 352extern struct bio *bio_alloc(gfp_t, int);
@@ -377,6 +391,7 @@ extern struct bio *bio_copy_user_iov(struct request_queue *,
377extern int bio_uncopy_user(struct bio *); 391extern int bio_uncopy_user(struct bio *);
378void zero_fill_bio(struct bio *bio); 392void zero_fill_bio(struct bio *bio);
379extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *); 393extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *);
394extern void bvec_free_bs(struct bio_set *, struct bio_vec *, unsigned int);
380extern unsigned int bvec_nr_vecs(unsigned short idx); 395extern unsigned int bvec_nr_vecs(unsigned short idx);
381 396
382/* 397/*
@@ -395,13 +410,17 @@ static inline void bio_set_completion_cpu(struct bio *bio, unsigned int cpu)
395 */ 410 */
396#define BIO_POOL_SIZE 2 411#define BIO_POOL_SIZE 2
397#define BIOVEC_NR_POOLS 6 412#define BIOVEC_NR_POOLS 6
413#define BIOVEC_MAX_IDX (BIOVEC_NR_POOLS - 1)
398 414
399struct bio_set { 415struct bio_set {
416 struct kmem_cache *bio_slab;
417 unsigned int front_pad;
418
400 mempool_t *bio_pool; 419 mempool_t *bio_pool;
401#if defined(CONFIG_BLK_DEV_INTEGRITY) 420#if defined(CONFIG_BLK_DEV_INTEGRITY)
402 mempool_t *bio_integrity_pool; 421 mempool_t *bio_integrity_pool;
403#endif 422#endif
404 mempool_t *bvec_pools[BIOVEC_NR_POOLS]; 423 mempool_t *bvec_pool;
405}; 424};
406 425
407struct biovec_slab { 426struct biovec_slab {
@@ -411,6 +430,7 @@ struct biovec_slab {
411}; 430};
412 431
413extern struct bio_set *fs_bio_set; 432extern struct bio_set *fs_bio_set;
433extern struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] __read_mostly;
414 434
415/* 435/*
416 * a small number of entries is fine, not going to be performance critical. 436 * a small number of entries is fine, not going to be performance critical.
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index a08c33a26ca9..2878811c6134 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -137,9 +137,12 @@ extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits);
137 (1UL<<((nbits) % BITS_PER_LONG))-1 : ~0UL \ 137 (1UL<<((nbits) % BITS_PER_LONG))-1 : ~0UL \
138) 138)
139 139
140#define small_const_nbits(nbits) \
141 (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG)
142
140static inline void bitmap_zero(unsigned long *dst, int nbits) 143static inline void bitmap_zero(unsigned long *dst, int nbits)
141{ 144{
142 if (nbits <= BITS_PER_LONG) 145 if (small_const_nbits(nbits))
143 *dst = 0UL; 146 *dst = 0UL;
144 else { 147 else {
145 int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); 148 int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
@@ -150,7 +153,7 @@ static inline void bitmap_zero(unsigned long *dst, int nbits)
150static inline void bitmap_fill(unsigned long *dst, int nbits) 153static inline void bitmap_fill(unsigned long *dst, int nbits)
151{ 154{
152 size_t nlongs = BITS_TO_LONGS(nbits); 155 size_t nlongs = BITS_TO_LONGS(nbits);
153 if (nlongs > 1) { 156 if (!small_const_nbits(nbits)) {
154 int len = (nlongs - 1) * sizeof(unsigned long); 157 int len = (nlongs - 1) * sizeof(unsigned long);
155 memset(dst, 0xff, len); 158 memset(dst, 0xff, len);
156 } 159 }
@@ -160,7 +163,7 @@ static inline void bitmap_fill(unsigned long *dst, int nbits)
160static inline void bitmap_copy(unsigned long *dst, const unsigned long *src, 163static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
161 int nbits) 164 int nbits)
162{ 165{
163 if (nbits <= BITS_PER_LONG) 166 if (small_const_nbits(nbits))
164 *dst = *src; 167 *dst = *src;
165 else { 168 else {
166 int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); 169 int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
@@ -171,7 +174,7 @@ static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
171static inline void bitmap_and(unsigned long *dst, const unsigned long *src1, 174static inline void bitmap_and(unsigned long *dst, const unsigned long *src1,
172 const unsigned long *src2, int nbits) 175 const unsigned long *src2, int nbits)
173{ 176{
174 if (nbits <= BITS_PER_LONG) 177 if (small_const_nbits(nbits))
175 *dst = *src1 & *src2; 178 *dst = *src1 & *src2;
176 else 179 else
177 __bitmap_and(dst, src1, src2, nbits); 180 __bitmap_and(dst, src1, src2, nbits);
@@ -180,7 +183,7 @@ static inline void bitmap_and(unsigned long *dst, const unsigned long *src1,
180static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, 183static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
181 const unsigned long *src2, int nbits) 184 const unsigned long *src2, int nbits)
182{ 185{
183 if (nbits <= BITS_PER_LONG) 186 if (small_const_nbits(nbits))
184 *dst = *src1 | *src2; 187 *dst = *src1 | *src2;
185 else 188 else
186 __bitmap_or(dst, src1, src2, nbits); 189 __bitmap_or(dst, src1, src2, nbits);
@@ -189,7 +192,7 @@ static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
189static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, 192static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
190 const unsigned long *src2, int nbits) 193 const unsigned long *src2, int nbits)
191{ 194{
192 if (nbits <= BITS_PER_LONG) 195 if (small_const_nbits(nbits))
193 *dst = *src1 ^ *src2; 196 *dst = *src1 ^ *src2;
194 else 197 else
195 __bitmap_xor(dst, src1, src2, nbits); 198 __bitmap_xor(dst, src1, src2, nbits);
@@ -198,7 +201,7 @@ static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
198static inline void bitmap_andnot(unsigned long *dst, const unsigned long *src1, 201static inline void bitmap_andnot(unsigned long *dst, const unsigned long *src1,
199 const unsigned long *src2, int nbits) 202 const unsigned long *src2, int nbits)
200{ 203{
201 if (nbits <= BITS_PER_LONG) 204 if (small_const_nbits(nbits))
202 *dst = *src1 & ~(*src2); 205 *dst = *src1 & ~(*src2);
203 else 206 else
204 __bitmap_andnot(dst, src1, src2, nbits); 207 __bitmap_andnot(dst, src1, src2, nbits);
@@ -207,7 +210,7 @@ static inline void bitmap_andnot(unsigned long *dst, const unsigned long *src1,
207static inline void bitmap_complement(unsigned long *dst, const unsigned long *src, 210static inline void bitmap_complement(unsigned long *dst, const unsigned long *src,
208 int nbits) 211 int nbits)
209{ 212{
210 if (nbits <= BITS_PER_LONG) 213 if (small_const_nbits(nbits))
211 *dst = ~(*src) & BITMAP_LAST_WORD_MASK(nbits); 214 *dst = ~(*src) & BITMAP_LAST_WORD_MASK(nbits);
212 else 215 else
213 __bitmap_complement(dst, src, nbits); 216 __bitmap_complement(dst, src, nbits);
@@ -216,7 +219,7 @@ static inline void bitmap_complement(unsigned long *dst, const unsigned long *sr
216static inline int bitmap_equal(const unsigned long *src1, 219static inline int bitmap_equal(const unsigned long *src1,
217 const unsigned long *src2, int nbits) 220 const unsigned long *src2, int nbits)
218{ 221{
219 if (nbits <= BITS_PER_LONG) 222 if (small_const_nbits(nbits))
220 return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits)); 223 return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits));
221 else 224 else
222 return __bitmap_equal(src1, src2, nbits); 225 return __bitmap_equal(src1, src2, nbits);
@@ -225,7 +228,7 @@ static inline int bitmap_equal(const unsigned long *src1,
225static inline int bitmap_intersects(const unsigned long *src1, 228static inline int bitmap_intersects(const unsigned long *src1,
226 const unsigned long *src2, int nbits) 229 const unsigned long *src2, int nbits)
227{ 230{
228 if (nbits <= BITS_PER_LONG) 231 if (small_const_nbits(nbits))
229 return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0; 232 return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0;
230 else 233 else
231 return __bitmap_intersects(src1, src2, nbits); 234 return __bitmap_intersects(src1, src2, nbits);
@@ -234,7 +237,7 @@ static inline int bitmap_intersects(const unsigned long *src1,
234static inline int bitmap_subset(const unsigned long *src1, 237static inline int bitmap_subset(const unsigned long *src1,
235 const unsigned long *src2, int nbits) 238 const unsigned long *src2, int nbits)
236{ 239{
237 if (nbits <= BITS_PER_LONG) 240 if (small_const_nbits(nbits))
238 return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits)); 241 return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits));
239 else 242 else
240 return __bitmap_subset(src1, src2, nbits); 243 return __bitmap_subset(src1, src2, nbits);
@@ -242,7 +245,7 @@ static inline int bitmap_subset(const unsigned long *src1,
242 245
243static inline int bitmap_empty(const unsigned long *src, int nbits) 246static inline int bitmap_empty(const unsigned long *src, int nbits)
244{ 247{
245 if (nbits <= BITS_PER_LONG) 248 if (small_const_nbits(nbits))
246 return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); 249 return ! (*src & BITMAP_LAST_WORD_MASK(nbits));
247 else 250 else
248 return __bitmap_empty(src, nbits); 251 return __bitmap_empty(src, nbits);
@@ -250,7 +253,7 @@ static inline int bitmap_empty(const unsigned long *src, int nbits)
250 253
251static inline int bitmap_full(const unsigned long *src, int nbits) 254static inline int bitmap_full(const unsigned long *src, int nbits)
252{ 255{
253 if (nbits <= BITS_PER_LONG) 256 if (small_const_nbits(nbits))
254 return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); 257 return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits));
255 else 258 else
256 return __bitmap_full(src, nbits); 259 return __bitmap_full(src, nbits);
@@ -258,7 +261,7 @@ static inline int bitmap_full(const unsigned long *src, int nbits)
258 261
259static inline int bitmap_weight(const unsigned long *src, int nbits) 262static inline int bitmap_weight(const unsigned long *src, int nbits)
260{ 263{
261 if (nbits <= BITS_PER_LONG) 264 if (small_const_nbits(nbits))
262 return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits)); 265 return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits));
263 return __bitmap_weight(src, nbits); 266 return __bitmap_weight(src, nbits);
264} 267}
@@ -266,7 +269,7 @@ static inline int bitmap_weight(const unsigned long *src, int nbits)
266static inline void bitmap_shift_right(unsigned long *dst, 269static inline void bitmap_shift_right(unsigned long *dst,
267 const unsigned long *src, int n, int nbits) 270 const unsigned long *src, int n, int nbits)
268{ 271{
269 if (nbits <= BITS_PER_LONG) 272 if (small_const_nbits(nbits))
270 *dst = *src >> n; 273 *dst = *src >> n;
271 else 274 else
272 __bitmap_shift_right(dst, src, n, nbits); 275 __bitmap_shift_right(dst, src, n, nbits);
@@ -275,7 +278,7 @@ static inline void bitmap_shift_right(unsigned long *dst,
275static inline void bitmap_shift_left(unsigned long *dst, 278static inline void bitmap_shift_left(unsigned long *dst,
276 const unsigned long *src, int n, int nbits) 279 const unsigned long *src, int n, int nbits)
277{ 280{
278 if (nbits <= BITS_PER_LONG) 281 if (small_const_nbits(nbits))
279 *dst = (*src << n) & BITMAP_LAST_WORD_MASK(nbits); 282 *dst = (*src << n) & BITMAP_LAST_WORD_MASK(nbits);
280 else 283 else
281 __bitmap_shift_left(dst, src, n, nbits); 284 __bitmap_shift_left(dst, src, n, nbits);
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index 024f2b027244..61829139795a 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -134,9 +134,20 @@ extern unsigned long find_first_bit(const unsigned long *addr,
134 */ 134 */
135extern unsigned long find_first_zero_bit(const unsigned long *addr, 135extern unsigned long find_first_zero_bit(const unsigned long *addr,
136 unsigned long size); 136 unsigned long size);
137
138#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ 137#endif /* CONFIG_GENERIC_FIND_FIRST_BIT */
139 138
139#ifdef CONFIG_GENERIC_FIND_LAST_BIT
140/**
141 * find_last_bit - find the last set bit in a memory region
142 * @addr: The address to start the search at
143 * @size: The maximum size to search
144 *
145 * Returns the bit number of the first set bit, or size.
146 */
147extern unsigned long find_last_bit(const unsigned long *addr,
148 unsigned long size);
149#endif /* CONFIG_GENERIC_FIND_LAST_BIT */
150
140#ifdef CONFIG_GENERIC_FIND_NEXT_BIT 151#ifdef CONFIG_GENERIC_FIND_NEXT_BIT
141 152
142/** 153/**
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 031a315c0509..044467ef7b11 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -26,7 +26,6 @@ struct scsi_ioctl_command;
26 26
27struct request_queue; 27struct request_queue;
28struct elevator_queue; 28struct elevator_queue;
29typedef struct elevator_queue elevator_t;
30struct request_pm_state; 29struct request_pm_state;
31struct blk_trace; 30struct blk_trace;
32struct request; 31struct request;
@@ -313,7 +312,7 @@ struct request_queue
313 */ 312 */
314 struct list_head queue_head; 313 struct list_head queue_head;
315 struct request *last_merge; 314 struct request *last_merge;
316 elevator_t *elevator; 315 struct elevator_queue *elevator;
317 316
318 /* 317 /*
319 * the queue request freelist, one for reads and one for writes 318 * the queue request freelist, one for reads and one for writes
@@ -449,6 +448,7 @@ struct request_queue
449#define QUEUE_FLAG_FAIL_IO 12 /* fake timeout */ 448#define QUEUE_FLAG_FAIL_IO 12 /* fake timeout */
450#define QUEUE_FLAG_STACKABLE 13 /* supports request stacking */ 449#define QUEUE_FLAG_STACKABLE 13 /* supports request stacking */
451#define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */ 450#define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */
451#define QUEUE_FLAG_VIRT QUEUE_FLAG_NONROT /* paravirt device */
452 452
453static inline int queue_is_locked(struct request_queue *q) 453static inline int queue_is_locked(struct request_queue *q)
454{ 454{
@@ -522,22 +522,32 @@ enum {
522 * TAG_FLUSH : ordering by tag w/ pre and post flushes 522 * TAG_FLUSH : ordering by tag w/ pre and post flushes
523 * TAG_FUA : ordering by tag w/ pre flush and FUA write 523 * TAG_FUA : ordering by tag w/ pre flush and FUA write
524 */ 524 */
525 QUEUE_ORDERED_NONE = 0x00, 525 QUEUE_ORDERED_BY_DRAIN = 0x01,
526 QUEUE_ORDERED_DRAIN = 0x01, 526 QUEUE_ORDERED_BY_TAG = 0x02,
527 QUEUE_ORDERED_TAG = 0x02, 527 QUEUE_ORDERED_DO_PREFLUSH = 0x10,
528 528 QUEUE_ORDERED_DO_BAR = 0x20,
529 QUEUE_ORDERED_PREFLUSH = 0x10, 529 QUEUE_ORDERED_DO_POSTFLUSH = 0x40,
530 QUEUE_ORDERED_POSTFLUSH = 0x20, 530 QUEUE_ORDERED_DO_FUA = 0x80,
531 QUEUE_ORDERED_FUA = 0x40, 531
532 532 QUEUE_ORDERED_NONE = 0x00,
533 QUEUE_ORDERED_DRAIN_FLUSH = QUEUE_ORDERED_DRAIN | 533
534 QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_POSTFLUSH, 534 QUEUE_ORDERED_DRAIN = QUEUE_ORDERED_BY_DRAIN |
535 QUEUE_ORDERED_DRAIN_FUA = QUEUE_ORDERED_DRAIN | 535 QUEUE_ORDERED_DO_BAR,
536 QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_FUA, 536 QUEUE_ORDERED_DRAIN_FLUSH = QUEUE_ORDERED_DRAIN |
537 QUEUE_ORDERED_TAG_FLUSH = QUEUE_ORDERED_TAG | 537 QUEUE_ORDERED_DO_PREFLUSH |
538 QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_POSTFLUSH, 538 QUEUE_ORDERED_DO_POSTFLUSH,
539 QUEUE_ORDERED_TAG_FUA = QUEUE_ORDERED_TAG | 539 QUEUE_ORDERED_DRAIN_FUA = QUEUE_ORDERED_DRAIN |
540 QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_FUA, 540 QUEUE_ORDERED_DO_PREFLUSH |
541 QUEUE_ORDERED_DO_FUA,
542
543 QUEUE_ORDERED_TAG = QUEUE_ORDERED_BY_TAG |
544 QUEUE_ORDERED_DO_BAR,
545 QUEUE_ORDERED_TAG_FLUSH = QUEUE_ORDERED_TAG |
546 QUEUE_ORDERED_DO_PREFLUSH |
547 QUEUE_ORDERED_DO_POSTFLUSH,
548 QUEUE_ORDERED_TAG_FUA = QUEUE_ORDERED_TAG |
549 QUEUE_ORDERED_DO_PREFLUSH |
550 QUEUE_ORDERED_DO_FUA,
541 551
542 /* 552 /*
543 * Ordered operation sequence 553 * Ordered operation sequence
@@ -585,7 +595,6 @@ enum {
585#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA) 595#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA)
586#define blk_discard_rq(rq) ((rq)->cmd_flags & REQ_DISCARD) 596#define blk_discard_rq(rq) ((rq)->cmd_flags & REQ_DISCARD)
587#define blk_bidi_rq(rq) ((rq)->next_rq != NULL) 597#define blk_bidi_rq(rq) ((rq)->next_rq != NULL)
588#define blk_empty_barrier(rq) (blk_barrier_rq(rq) && blk_fs_request(rq) && !(rq)->hard_nr_sectors)
589/* rq->queuelist of dequeued request must be list_empty() */ 598/* rq->queuelist of dequeued request must be list_empty() */
590#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist)) 599#define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist))
591 600
@@ -681,6 +690,8 @@ struct rq_map_data {
681 struct page **pages; 690 struct page **pages;
682 int page_order; 691 int page_order;
683 int nr_entries; 692 int nr_entries;
693 unsigned long offset;
694 int null_mapped;
684}; 695};
685 696
686struct req_iterator { 697struct req_iterator {
@@ -855,10 +866,10 @@ extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *);
855extern void blk_queue_rq_timeout(struct request_queue *, unsigned int); 866extern void blk_queue_rq_timeout(struct request_queue *, unsigned int);
856extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); 867extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
857extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *); 868extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *);
858extern int blk_do_ordered(struct request_queue *, struct request **); 869extern bool blk_do_ordered(struct request_queue *, struct request **);
859extern unsigned blk_ordered_cur_seq(struct request_queue *); 870extern unsigned blk_ordered_cur_seq(struct request_queue *);
860extern unsigned blk_ordered_req_seq(struct request *); 871extern unsigned blk_ordered_req_seq(struct request *);
861extern void blk_ordered_complete_seq(struct request_queue *, unsigned, int); 872extern bool blk_ordered_complete_seq(struct request_queue *, unsigned, int);
862 873
863extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *); 874extern int blk_rq_map_sg(struct request_queue *, struct request *, struct scatterlist *);
864extern void blk_dump_rq_flags(struct request *, char *); 875extern void blk_dump_rq_flags(struct request *, char *);
@@ -977,7 +988,6 @@ static inline void put_dev_sector(Sector p)
977 988
978struct work_struct; 989struct work_struct;
979int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); 990int kblockd_schedule_work(struct request_queue *q, struct work_struct *work);
980void kblockd_flush_work(struct work_struct *work);
981 991
982#define MODULE_ALIAS_BLOCKDEV(major,minor) \ 992#define MODULE_ALIAS_BLOCKDEV(major,minor) \
983 MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor)) 993 MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor))
diff --git a/include/linux/blockgroup_lock.h b/include/linux/blockgroup_lock.h
index 8607312983bd..e44b88ba552b 100644
--- a/include/linux/blockgroup_lock.h
+++ b/include/linux/blockgroup_lock.h
@@ -53,7 +53,10 @@ static inline void bgl_lock_init(struct blockgroup_lock *bgl)
53 * The accessor is a macro so we can embed a blockgroup_lock into different 53 * The accessor is a macro so we can embed a blockgroup_lock into different
54 * superblock types 54 * superblock types
55 */ 55 */
56#define sb_bgl_lock(sb, block_group) \ 56static inline spinlock_t *
57 (&(sb)->s_blockgroup_lock.locks[(block_group) & (NR_BG_LOCKS-1)].lock) 57bgl_lock_ptr(struct blockgroup_lock *bgl, unsigned int block_group)
58{
59 return &bgl->locks[(block_group) & (NR_BG_LOCKS-1)].lock;
60}
58 61
59#endif 62#endif
diff --git a/include/linux/bottom_half.h b/include/linux/bottom_half.h
index 777dbf695d44..27b1bcffe408 100644
--- a/include/linux/bottom_half.h
+++ b/include/linux/bottom_half.h
@@ -2,7 +2,6 @@
2#define _LINUX_BH_H 2#define _LINUX_BH_H
3 3
4extern void local_bh_disable(void); 4extern void local_bh_disable(void);
5extern void __local_bh_enable(void);
6extern void _local_bh_enable(void); 5extern void _local_bh_enable(void);
7extern void local_bh_enable(void); 6extern void local_bh_enable(void);
8extern void local_bh_enable_ip(unsigned long ip); 7extern void local_bh_enable_ip(unsigned long ip);
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 3ce64b90118c..bd7ac793be19 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -35,6 +35,7 @@ enum bh_state_bits {
35 BH_Ordered, /* ordered write */ 35 BH_Ordered, /* ordered write */
36 BH_Eopnotsupp, /* operation not supported (barrier) */ 36 BH_Eopnotsupp, /* operation not supported (barrier) */
37 BH_Unwritten, /* Buffer is allocated on disk but not written */ 37 BH_Unwritten, /* Buffer is allocated on disk but not written */
38 BH_Quiet, /* Buffer Error Prinks to be quiet */
38 39
39 BH_PrivateStart,/* not a state bit, but the first bit available 40 BH_PrivateStart,/* not a state bit, but the first bit available
40 * for private allocation by other entities 41 * for private allocation by other entities
@@ -170,7 +171,7 @@ void __wait_on_buffer(struct buffer_head *);
170wait_queue_head_t *bh_waitq_head(struct buffer_head *bh); 171wait_queue_head_t *bh_waitq_head(struct buffer_head *bh);
171int fsync_bdev(struct block_device *); 172int fsync_bdev(struct block_device *);
172struct super_block *freeze_bdev(struct block_device *); 173struct super_block *freeze_bdev(struct block_device *);
173void thaw_bdev(struct block_device *, struct super_block *); 174int thaw_bdev(struct block_device *, struct super_block *);
174int fsync_super(struct super_block *); 175int fsync_super(struct super_block *);
175int fsync_no_super(struct block_device *); 176int fsync_no_super(struct block_device *);
176struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block, 177struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block,
@@ -345,6 +346,15 @@ static inline int remove_inode_buffers(struct inode *inode) { return 1; }
345static inline int sync_mapping_buffers(struct address_space *mapping) { return 0; } 346static inline int sync_mapping_buffers(struct address_space *mapping) { return 0; }
346static inline void invalidate_bdev(struct block_device *bdev) {} 347static inline void invalidate_bdev(struct block_device *bdev) {}
347 348
349static inline struct super_block *freeze_bdev(struct block_device *sb)
350{
351 return NULL;
352}
353
354static inline int thaw_bdev(struct block_device *bdev, struct super_block *sb)
355{
356 return 0;
357}
348 358
349#endif /* CONFIG_BLOCK */ 359#endif /* CONFIG_BLOCK */
350#endif /* _LINUX_BUFFER_HEAD_H */ 360#endif /* _LINUX_BUFFER_HEAD_H */
diff --git a/include/linux/byteorder.h b/include/linux/byteorder.h
deleted file mode 100644
index 29f002d73d98..000000000000
--- a/include/linux/byteorder.h
+++ /dev/null
@@ -1,372 +0,0 @@
1#ifndef _LINUX_BYTEORDER_H
2#define _LINUX_BYTEORDER_H
3
4#include <linux/types.h>
5#include <linux/swab.h>
6
7#if defined(__LITTLE_ENDIAN) && defined(__BIG_ENDIAN)
8# error Fix asm/byteorder.h to define one endianness
9#endif
10
11#if !defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN)
12# error Fix asm/byteorder.h to define arch endianness
13#endif
14
15#ifdef __LITTLE_ENDIAN
16# undef __LITTLE_ENDIAN
17# define __LITTLE_ENDIAN 1234
18#endif
19
20#ifdef __BIG_ENDIAN
21# undef __BIG_ENDIAN
22# define __BIG_ENDIAN 4321
23#endif
24
25#if defined(__LITTLE_ENDIAN) && !defined(__LITTLE_ENDIAN_BITFIELD)
26# define __LITTLE_ENDIAN_BITFIELD
27#endif
28
29#if defined(__BIG_ENDIAN) && !defined(__BIG_ENDIAN_BITFIELD)
30# define __BIG_ENDIAN_BITFIELD
31#endif
32
33#ifdef __LITTLE_ENDIAN
34# define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
35# define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
36# define __le64_to_cpu(x) ((__force __u64)(__le64)(x))
37# define __cpu_to_le16(x) ((__force __le16)(__u16)(x))
38# define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
39# define __cpu_to_le64(x) ((__force __le64)(__u64)(x))
40
41# define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x))
42# define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
43# define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x))
44# define __cpu_to_be16(x) ((__force __be16)__swab16(x))
45# define __cpu_to_be32(x) ((__force __be32)__swab32(x))
46# define __cpu_to_be64(x) ((__force __be64)__swab64(x))
47#endif
48
49#ifdef __BIG_ENDIAN
50# define __be16_to_cpu(x) ((__force __u16)(__be16)(x))
51# define __be32_to_cpu(x) ((__force __u32)(__be32)(x))
52# define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
53# define __cpu_to_be16(x) ((__force __be16)(__u16)(x))
54# define __cpu_to_be32(x) ((__force __be32)(__u32)(x))
55# define __cpu_to_be64(x) ((__force __be64)(__u64)(x))
56
57# define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
58# define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
59# define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x))
60# define __cpu_to_le16(x) ((__force __le16)__swab16(x))
61# define __cpu_to_le32(x) ((__force __le32)__swab32(x))
62# define __cpu_to_le64(x) ((__force __le64)__swab64(x))
63#endif
64
65/*
66 * These helpers could be phased out over time as the base version
67 * handles constant folding.
68 */
69#define __constant_htonl(x) __cpu_to_be32(x)
70#define __constant_ntohl(x) __be32_to_cpu(x)
71#define __constant_htons(x) __cpu_to_be16(x)
72#define __constant_ntohs(x) __be16_to_cpu(x)
73
74#define __constant_le16_to_cpu(x) __le16_to_cpu(x)
75#define __constant_le32_to_cpu(x) __le32_to_cpu(x)
76#define __constant_le64_to_cpu(x) __le64_to_cpu(x)
77#define __constant_be16_to_cpu(x) __be16_to_cpu(x)
78#define __constant_be32_to_cpu(x) __be32_to_cpu(x)
79#define __constant_be64_to_cpu(x) __be64_to_cpu(x)
80
81#define __constant_cpu_to_le16(x) __cpu_to_le16(x)
82#define __constant_cpu_to_le32(x) __cpu_to_le32(x)
83#define __constant_cpu_to_le64(x) __cpu_to_le64(x)
84#define __constant_cpu_to_be16(x) __cpu_to_be16(x)
85#define __constant_cpu_to_be32(x) __cpu_to_be32(x)
86#define __constant_cpu_to_be64(x) __cpu_to_be64(x)
87
88static inline void __le16_to_cpus(__u16 *p)
89{
90#ifdef __BIG_ENDIAN
91 __swab16s(p);
92#endif
93}
94
95static inline void __cpu_to_le16s(__u16 *p)
96{
97#ifdef __BIG_ENDIAN
98 __swab16s(p);
99#endif
100}
101
102static inline void __le32_to_cpus(__u32 *p)
103{
104#ifdef __BIG_ENDIAN
105 __swab32s(p);
106#endif
107}
108
109static inline void __cpu_to_le32s(__u32 *p)
110{
111#ifdef __BIG_ENDIAN
112 __swab32s(p);
113#endif
114}
115
116static inline void __le64_to_cpus(__u64 *p)
117{
118#ifdef __BIG_ENDIAN
119 __swab64s(p);
120#endif
121}
122
123static inline void __cpu_to_le64s(__u64 *p)
124{
125#ifdef __BIG_ENDIAN
126 __swab64s(p);
127#endif
128}
129
130static inline void __be16_to_cpus(__u16 *p)
131{
132#ifdef __LITTLE_ENDIAN
133 __swab16s(p);
134#endif
135}
136
137static inline void __cpu_to_be16s(__u16 *p)
138{
139#ifdef __LITTLE_ENDIAN
140 __swab16s(p);
141#endif
142}
143
144static inline void __be32_to_cpus(__u32 *p)
145{
146#ifdef __LITTLE_ENDIAN
147 __swab32s(p);
148#endif
149}
150
151static inline void __cpu_to_be32s(__u32 *p)
152{
153#ifdef __LITTLE_ENDIAN
154 __swab32s(p);
155#endif
156}
157
158static inline void __be64_to_cpus(__u64 *p)
159{
160#ifdef __LITTLE_ENDIAN
161 __swab64s(p);
162#endif
163}
164
165static inline void __cpu_to_be64s(__u64 *p)
166{
167#ifdef __LITTLE_ENDIAN
168 __swab64s(p);
169#endif
170}
171
172static inline __u16 __le16_to_cpup(const __le16 *p)
173{
174#ifdef __LITTLE_ENDIAN
175 return (__force __u16)*p;
176#else
177 return __swab16p((__force __u16 *)p);
178#endif
179}
180
181static inline __u32 __le32_to_cpup(const __le32 *p)
182{
183#ifdef __LITTLE_ENDIAN
184 return (__force __u32)*p;
185#else
186 return __swab32p((__force __u32 *)p);
187#endif
188}
189
190static inline __u64 __le64_to_cpup(const __le64 *p)
191{
192#ifdef __LITTLE_ENDIAN
193 return (__force __u64)*p;
194#else
195 return __swab64p((__force __u64 *)p);
196#endif
197}
198
199static inline __le16 __cpu_to_le16p(const __u16 *p)
200{
201#ifdef __LITTLE_ENDIAN
202 return (__force __le16)*p;
203#else
204 return (__force __le16)__swab16p(p);
205#endif
206}
207
208static inline __le32 __cpu_to_le32p(const __u32 *p)
209{
210#ifdef __LITTLE_ENDIAN
211 return (__force __le32)*p;
212#else
213 return (__force __le32)__swab32p(p);
214#endif
215}
216
217static inline __le64 __cpu_to_le64p(const __u64 *p)
218{
219#ifdef __LITTLE_ENDIAN
220 return (__force __le64)*p;
221#else
222 return (__force __le64)__swab64p(p);
223#endif
224}
225
226static inline __u16 __be16_to_cpup(const __be16 *p)
227{
228#ifdef __BIG_ENDIAN
229 return (__force __u16)*p;
230#else
231 return __swab16p((__force __u16 *)p);
232#endif
233}
234
235static inline __u32 __be32_to_cpup(const __be32 *p)
236{
237#ifdef __BIG_ENDIAN
238 return (__force __u32)*p;
239#else
240 return __swab32p((__force __u32 *)p);
241#endif
242}
243
244static inline __u64 __be64_to_cpup(const __be64 *p)
245{
246#ifdef __BIG_ENDIAN
247 return (__force __u64)*p;
248#else
249 return __swab64p((__force __u64 *)p);
250#endif
251}
252
253static inline __be16 __cpu_to_be16p(const __u16 *p)
254{
255#ifdef __BIG_ENDIAN
256 return (__force __be16)*p;
257#else
258 return (__force __be16)__swab16p(p);
259#endif
260}
261
262static inline __be32 __cpu_to_be32p(const __u32 *p)
263{
264#ifdef __BIG_ENDIAN
265 return (__force __be32)*p;
266#else
267 return (__force __be32)__swab32p(p);
268#endif
269}
270
271static inline __be64 __cpu_to_be64p(const __u64 *p)
272{
273#ifdef __BIG_ENDIAN
274 return (__force __be64)*p;
275#else
276 return (__force __be64)__swab64p(p);
277#endif
278}
279
280#ifdef __KERNEL__
281
282# define le16_to_cpu __le16_to_cpu
283# define le32_to_cpu __le32_to_cpu
284# define le64_to_cpu __le64_to_cpu
285# define be16_to_cpu __be16_to_cpu
286# define be32_to_cpu __be32_to_cpu
287# define be64_to_cpu __be64_to_cpu
288# define cpu_to_le16 __cpu_to_le16
289# define cpu_to_le32 __cpu_to_le32
290# define cpu_to_le64 __cpu_to_le64
291# define cpu_to_be16 __cpu_to_be16
292# define cpu_to_be32 __cpu_to_be32
293# define cpu_to_be64 __cpu_to_be64
294
295# define le16_to_cpup __le16_to_cpup
296# define le32_to_cpup __le32_to_cpup
297# define le64_to_cpup __le64_to_cpup
298# define be16_to_cpup __be16_to_cpup
299# define be32_to_cpup __be32_to_cpup
300# define be64_to_cpup __be64_to_cpup
301# define cpu_to_le16p __cpu_to_le16p
302# define cpu_to_le32p __cpu_to_le32p
303# define cpu_to_le64p __cpu_to_le64p
304# define cpu_to_be16p __cpu_to_be16p
305# define cpu_to_be32p __cpu_to_be32p
306# define cpu_to_be64p __cpu_to_be64p
307
308# define le16_to_cpus __le16_to_cpus
309# define le32_to_cpus __le32_to_cpus
310# define le64_to_cpus __le64_to_cpus
311# define be16_to_cpus __be16_to_cpus
312# define be32_to_cpus __be32_to_cpus
313# define be64_to_cpus __be64_to_cpus
314# define cpu_to_le16s __cpu_to_le16s
315# define cpu_to_le32s __cpu_to_le32s
316# define cpu_to_le64s __cpu_to_le64s
317# define cpu_to_be16s __cpu_to_be16s
318# define cpu_to_be32s __cpu_to_be32s
319# define cpu_to_be64s __cpu_to_be64s
320
321/*
322 * They have to be macros in order to do the constant folding
323 * correctly - if the argument passed into a inline function
324 * it is no longer constant according to gcc..
325 */
326# undef ntohl
327# undef ntohs
328# undef htonl
329# undef htons
330
331# define ___htonl(x) __cpu_to_be32(x)
332# define ___htons(x) __cpu_to_be16(x)
333# define ___ntohl(x) __be32_to_cpu(x)
334# define ___ntohs(x) __be16_to_cpu(x)
335
336# define htonl(x) ___htonl(x)
337# define ntohl(x) ___ntohl(x)
338# define htons(x) ___htons(x)
339# define ntohs(x) ___ntohs(x)
340
341static inline void le16_add_cpu(__le16 *var, u16 val)
342{
343 *var = cpu_to_le16(le16_to_cpup(var) + val);
344}
345
346static inline void le32_add_cpu(__le32 *var, u32 val)
347{
348 *var = cpu_to_le32(le32_to_cpup(var) + val);
349}
350
351static inline void le64_add_cpu(__le64 *var, u64 val)
352{
353 *var = cpu_to_le64(le64_to_cpup(var) + val);
354}
355
356static inline void be16_add_cpu(__be16 *var, u16 val)
357{
358 *var = cpu_to_be16(be16_to_cpup(var) + val);
359}
360
361static inline void be32_add_cpu(__be32 *var, u32 val)
362{
363 *var = cpu_to_be32(be32_to_cpup(var) + val);
364}
365
366static inline void be64_add_cpu(__be64 *var, u64 val)
367{
368 *var = cpu_to_be64(be64_to_cpup(var) + val);
369}
370
371#endif /* __KERNEL__ */
372#endif /* _LINUX_BYTEORDER_H */
diff --git a/include/linux/byteorder/Kbuild b/include/linux/byteorder/Kbuild
index fbaa7f9cee32..38437225b092 100644
--- a/include/linux/byteorder/Kbuild
+++ b/include/linux/byteorder/Kbuild
@@ -1,4 +1,2 @@
1unifdef-y += big_endian.h 1unifdef-y += big_endian.h
2unifdef-y += little_endian.h 2unifdef-y += little_endian.h
3unifdef-y += swab.h
4unifdef-y += swabb.h
diff --git a/include/linux/byteorder/big_endian.h b/include/linux/byteorder/big_endian.h
index 1cba3f3efe5f..3c80fd7e8b56 100644
--- a/include/linux/byteorder/big_endian.h
+++ b/include/linux/byteorder/big_endian.h
@@ -9,8 +9,7 @@
9#endif 9#endif
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/byteorder/swab.h> 12#include <linux/swab.h>
13#include <linux/byteorder/swabb.h>
14 13
15#define __constant_htonl(x) ((__force __be32)(__u32)(x)) 14#define __constant_htonl(x) ((__force __be32)(__u32)(x))
16#define __constant_ntohl(x) ((__force __u32)(__be32)(x)) 15#define __constant_ntohl(x) ((__force __u32)(__be32)(x))
diff --git a/include/linux/byteorder/little_endian.h b/include/linux/byteorder/little_endian.h
index cedc1b5a289c..83195fb82962 100644
--- a/include/linux/byteorder/little_endian.h
+++ b/include/linux/byteorder/little_endian.h
@@ -9,8 +9,7 @@
9#endif 9#endif
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/byteorder/swab.h> 12#include <linux/swab.h>
13#include <linux/byteorder/swabb.h>
14 13
15#define __constant_htonl(x) ((__force __be32)___constant_swab32((x))) 14#define __constant_htonl(x) ((__force __be32)___constant_swab32((x)))
16#define __constant_ntohl(x) ___constant_swab32((__force __be32)(x)) 15#define __constant_ntohl(x) ___constant_swab32((__force __be32)(x))
diff --git a/include/linux/byteorder/swab.h b/include/linux/byteorder/swab.h
deleted file mode 100644
index 142134ff1645..000000000000
--- a/include/linux/byteorder/swab.h
+++ /dev/null
@@ -1,222 +0,0 @@
1#ifndef _LINUX_BYTEORDER_SWAB_H
2#define _LINUX_BYTEORDER_SWAB_H
3
4/*
5 * linux/byteorder/swab.h
6 * Byte-swapping, independently from CPU endianness
7 * swabXX[ps]?(foo)
8 *
9 * Francois-Rene Rideau <fare@tunes.org> 19971205
10 * separated swab functions from cpu_to_XX,
11 * to clean up support for bizarre-endian architectures.
12 *
13 * Trent Piepho <xyzzy@speakeasy.org> 2007114
14 * make constant-folding work, provide C versions that
15 * gcc can optimize better, explain different versions
16 *
17 * See asm-i386/byteorder.h and suches for examples of how to provide
18 * architecture-dependent optimized versions
19 *
20 */
21
22#include <linux/compiler.h>
23
24/* Functions/macros defined, there are a lot:
25 *
26 * ___swabXX
27 * Generic C versions of the swab functions.
28 *
29 * ___constant_swabXX
30 * C versions that gcc can fold into a compile-time constant when
31 * the argument is a compile-time constant.
32 *
33 * __arch__swabXX[sp]?
34 * Architecture optimized versions of all the swab functions
35 * (including the s and p versions). These can be defined in
36 * asm-arch/byteorder.h. Any which are not, are defined here.
37 * __arch__swabXXs() is defined in terms of __arch__swabXXp(), which
38 * is defined in terms of __arch__swabXX(), which is in turn defined
39 * in terms of ___swabXX(x).
40 * These must be macros. They may be unsafe for arguments with
41 * side-effects.
42 *
43 * __fswabXX
44 * Inline function versions of the __arch__ macros. These _are_ safe
45 * if the arguments have side-effects. Note there are no s and p
46 * versions of these.
47 *
48 * __swabXX[sb]
49 * There are the ones you should actually use. The __swabXX versions
50 * will be a constant given a constant argument and use the arch
51 * specific code (if any) for non-constant arguments. The s and p
52 * versions always use the arch specific code (constant folding
53 * doesn't apply). They are safe to use with arguments with
54 * side-effects.
55 *
56 * swabXX[sb]
57 * Nicknames for __swabXX[sb] to use in the kernel.
58 */
59
60/* casts are necessary for constants, because we never know how for sure
61 * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
62 */
63
64static __inline__ __attribute_const__ __u16 ___swab16(__u16 x)
65{
66 return x<<8 | x>>8;
67}
68static __inline__ __attribute_const__ __u32 ___swab32(__u32 x)
69{
70 return x<<24 | x>>24 |
71 (x & (__u32)0x0000ff00UL)<<8 |
72 (x & (__u32)0x00ff0000UL)>>8;
73}
74static __inline__ __attribute_const__ __u64 ___swab64(__u64 x)
75{
76 return x<<56 | x>>56 |
77 (x & (__u64)0x000000000000ff00ULL)<<40 |
78 (x & (__u64)0x0000000000ff0000ULL)<<24 |
79 (x & (__u64)0x00000000ff000000ULL)<< 8 |
80 (x & (__u64)0x000000ff00000000ULL)>> 8 |
81 (x & (__u64)0x0000ff0000000000ULL)>>24 |
82 (x & (__u64)0x00ff000000000000ULL)>>40;
83}
84
85#define ___constant_swab16(x) \
86 ((__u16)( \
87 (((__u16)(x) & (__u16)0x00ffU) << 8) | \
88 (((__u16)(x) & (__u16)0xff00U) >> 8) ))
89#define ___constant_swab32(x) \
90 ((__u32)( \
91 (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
92 (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
93 (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
94 (((__u32)(x) & (__u32)0xff000000UL) >> 24) ))
95#define ___constant_swab64(x) \
96 ((__u64)( \
97 (__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
98 (__u64)(((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \
99 (__u64)(((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \
100 (__u64)(((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \
101 (__u64)(((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \
102 (__u64)(((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
103 (__u64)(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
104 (__u64)(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56) ))
105
106/*
107 * provide defaults when no architecture-specific optimization is detected
108 */
109#ifndef __arch__swab16
110# define __arch__swab16(x) ___swab16(x)
111#endif
112#ifndef __arch__swab32
113# define __arch__swab32(x) ___swab32(x)
114#endif
115#ifndef __arch__swab64
116# define __arch__swab64(x) ___swab64(x)
117#endif
118
119#ifndef __arch__swab16p
120# define __arch__swab16p(x) __arch__swab16(*(x))
121#endif
122#ifndef __arch__swab32p
123# define __arch__swab32p(x) __arch__swab32(*(x))
124#endif
125#ifndef __arch__swab64p
126# define __arch__swab64p(x) __arch__swab64(*(x))
127#endif
128
129#ifndef __arch__swab16s
130# define __arch__swab16s(x) ((void)(*(x) = __arch__swab16p(x)))
131#endif
132#ifndef __arch__swab32s
133# define __arch__swab32s(x) ((void)(*(x) = __arch__swab32p(x)))
134#endif
135#ifndef __arch__swab64s
136# define __arch__swab64s(x) ((void)(*(x) = __arch__swab64p(x)))
137#endif
138
139
140/*
141 * Allow constant folding
142 */
143#if defined(__GNUC__) && defined(__OPTIMIZE__)
144# define __swab16(x) \
145(__builtin_constant_p((__u16)(x)) ? \
146 ___constant_swab16((x)) : \
147 __fswab16((x)))
148# define __swab32(x) \
149(__builtin_constant_p((__u32)(x)) ? \
150 ___constant_swab32((x)) : \
151 __fswab32((x)))
152# define __swab64(x) \
153(__builtin_constant_p((__u64)(x)) ? \
154 ___constant_swab64((x)) : \
155 __fswab64((x)))
156#else
157# define __swab16(x) __fswab16(x)
158# define __swab32(x) __fswab32(x)
159# define __swab64(x) __fswab64(x)
160#endif /* OPTIMIZE */
161
162
163static __inline__ __attribute_const__ __u16 __fswab16(__u16 x)
164{
165 return __arch__swab16(x);
166}
167static __inline__ __u16 __swab16p(const __u16 *x)
168{
169 return __arch__swab16p(x);
170}
171static __inline__ void __swab16s(__u16 *addr)
172{
173 __arch__swab16s(addr);
174}
175
176static __inline__ __attribute_const__ __u32 __fswab32(__u32 x)
177{
178 return __arch__swab32(x);
179}
180static __inline__ __u32 __swab32p(const __u32 *x)
181{
182 return __arch__swab32p(x);
183}
184static __inline__ void __swab32s(__u32 *addr)
185{
186 __arch__swab32s(addr);
187}
188
189#ifdef __BYTEORDER_HAS_U64__
190static __inline__ __attribute_const__ __u64 __fswab64(__u64 x)
191{
192# ifdef __SWAB_64_THRU_32__
193 __u32 h = x >> 32;
194 __u32 l = x & ((1ULL<<32)-1);
195 return (((__u64)__swab32(l)) << 32) | ((__u64)(__swab32(h)));
196# else
197 return __arch__swab64(x);
198# endif
199}
200static __inline__ __u64 __swab64p(const __u64 *x)
201{
202 return __arch__swab64p(x);
203}
204static __inline__ void __swab64s(__u64 *addr)
205{
206 __arch__swab64s(addr);
207}
208#endif /* __BYTEORDER_HAS_U64__ */
209
210#if defined(__KERNEL__)
211#define swab16 __swab16
212#define swab32 __swab32
213#define swab64 __swab64
214#define swab16p __swab16p
215#define swab32p __swab32p
216#define swab64p __swab64p
217#define swab16s __swab16s
218#define swab32s __swab32s
219#define swab64s __swab64s
220#endif
221
222#endif /* _LINUX_BYTEORDER_SWAB_H */
diff --git a/include/linux/byteorder/swabb.h b/include/linux/byteorder/swabb.h
deleted file mode 100644
index 8c780c7d779e..000000000000
--- a/include/linux/byteorder/swabb.h
+++ /dev/null
@@ -1,135 +0,0 @@
1#ifndef _LINUX_BYTEORDER_SWABB_H
2#define _LINUX_BYTEORDER_SWABB_H
3
4/*
5 * linux/byteorder/swabb.h
6 * SWAp Bytes Bizarrely
7 * swaHHXX[ps]?(foo)
8 *
9 * Support for obNUXIous pdp-endian and other bizarre architectures.
10 * Will Linux ever run on such ancient beasts? if not, this file
11 * will be but a programming pearl. Still, it's a reminder that we
12 * shouldn't be making too many assumptions when trying to be portable.
13 *
14 */
15
16/*
17 * Meaning of the names I chose (vaxlinux people feel free to correct them):
18 * swahw32 swap 16-bit half-words in a 32-bit word
19 * swahb32 swap 8-bit halves of each 16-bit half-word in a 32-bit word
20 *
21 * No 64-bit support yet. I don't know NUXI conventions for long longs.
22 * I guarantee it will be a mess when it's there, though :->
23 * It will be even worse if there are conflicting 64-bit conventions.
24 * Hopefully, no one ever used 64-bit objects on NUXI machines.
25 *
26 */
27
28#include <linux/types.h>
29
30#define ___swahw32(x) \
31({ \
32 __u32 __x = (x); \
33 ((__u32)( \
34 (((__u32)(__x) & (__u32)0x0000ffffUL) << 16) | \
35 (((__u32)(__x) & (__u32)0xffff0000UL) >> 16) )); \
36})
37#define ___swahb32(x) \
38({ \
39 __u32 __x = (x); \
40 ((__u32)( \
41 (((__u32)(__x) & (__u32)0x00ff00ffUL) << 8) | \
42 (((__u32)(__x) & (__u32)0xff00ff00UL) >> 8) )); \
43})
44
45#define ___constant_swahw32(x) \
46 ((__u32)( \
47 (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \
48 (((__u32)(x) & (__u32)0xffff0000UL) >> 16) ))
49#define ___constant_swahb32(x) \
50 ((__u32)( \
51 (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \
52 (((__u32)(x) & (__u32)0xff00ff00UL) >> 8) ))
53
54/*
55 * provide defaults when no architecture-specific optimization is detected
56 */
57#ifndef __arch__swahw32
58# define __arch__swahw32(x) ___swahw32(x)
59#endif
60#ifndef __arch__swahb32
61# define __arch__swahb32(x) ___swahb32(x)
62#endif
63
64#ifndef __arch__swahw32p
65# define __arch__swahw32p(x) __swahw32(*(x))
66#endif
67#ifndef __arch__swahb32p
68# define __arch__swahb32p(x) __swahb32(*(x))
69#endif
70
71#ifndef __arch__swahw32s
72# define __arch__swahw32s(x) do { *(x) = __swahw32p((x)); } while (0)
73#endif
74#ifndef __arch__swahb32s
75# define __arch__swahb32s(x) do { *(x) = __swahb32p((x)); } while (0)
76#endif
77
78
79/*
80 * Allow constant folding
81 */
82#define __swahw32(x) \
83(__builtin_constant_p((__u32)(x)) ? \
84 ___swahw32((x)) : \
85 __fswahw32((x)))
86#define __swahb32(x) \
87(__builtin_constant_p((__u32)(x)) ? \
88 ___swahb32((x)) : \
89 __fswahb32((x)))
90
91
92static inline __u32 __fswahw32(__u32 x)
93{
94 return __arch__swahw32(x);
95}
96
97static inline __u32 __swahw32p(__u32 *x)
98{
99 return __arch__swahw32p(x);
100}
101
102static inline void __swahw32s(__u32 *addr)
103{
104 __arch__swahw32s(addr);
105}
106
107static inline __u32 __fswahb32(__u32 x)
108{
109 return __arch__swahb32(x);
110}
111
112static inline __u32 __swahb32p(__u32 *x)
113{
114 return __arch__swahb32p(x);
115}
116
117static inline void __swahb32s(__u32 *addr)
118{
119 __arch__swahb32s(addr);
120}
121
122#ifdef __BYTEORDER_HAS_U64__
123/*
124 * Not supported yet
125 */
126#endif /* __BYTEORDER_HAS_U64__ */
127
128#define swahw32 __swahw32
129#define swahb32 __swahb32
130#define swahw32p __swahw32p
131#define swahb32p __swahb32p
132#define swahw32s __swahw32s
133#define swahb32s __swahb32s
134
135#endif /* _LINUX_BYTEORDER_SWABB_H */
diff --git a/include/linux/can/core.h b/include/linux/can/core.h
index f50785ad4781..25085cbadcfc 100644
--- a/include/linux/can/core.h
+++ b/include/linux/can/core.h
@@ -19,7 +19,7 @@
19#include <linux/skbuff.h> 19#include <linux/skbuff.h>
20#include <linux/netdevice.h> 20#include <linux/netdevice.h>
21 21
22#define CAN_VERSION "20081130" 22#define CAN_VERSION "20090105"
23 23
24/* increment this number each time you change some user-space interface */ 24/* increment this number each time you change some user-space interface */
25#define CAN_ABI_VERSION "8" 25#define CAN_ABI_VERSION "8"
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 9d1fe30b6f6c..02bdb768d43b 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -53,6 +53,7 @@ typedef struct __user_cap_data_struct {
53#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX 53#define XATTR_NAME_CAPS XATTR_SECURITY_PREFIX XATTR_CAPS_SUFFIX
54 54
55#define VFS_CAP_REVISION_MASK 0xFF000000 55#define VFS_CAP_REVISION_MASK 0xFF000000
56#define VFS_CAP_REVISION_SHIFT 24
56#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK 57#define VFS_CAP_FLAGS_MASK ~VFS_CAP_REVISION_MASK
57#define VFS_CAP_FLAGS_EFFECTIVE 0x000001 58#define VFS_CAP_FLAGS_EFFECTIVE 0x000001
58 59
@@ -68,6 +69,9 @@ typedef struct __user_cap_data_struct {
68#define VFS_CAP_U32 VFS_CAP_U32_2 69#define VFS_CAP_U32 VFS_CAP_U32_2
69#define VFS_CAP_REVISION VFS_CAP_REVISION_2 70#define VFS_CAP_REVISION VFS_CAP_REVISION_2
70 71
72#ifdef CONFIG_SECURITY_FILE_CAPABILITIES
73extern int file_caps_enabled;
74#endif
71 75
72struct vfs_cap_data { 76struct vfs_cap_data {
73 __le32 magic_etc; /* Little endian */ 77 __le32 magic_etc; /* Little endian */
@@ -96,6 +100,13 @@ typedef struct kernel_cap_struct {
96 __u32 cap[_KERNEL_CAPABILITY_U32S]; 100 __u32 cap[_KERNEL_CAPABILITY_U32S];
97} kernel_cap_t; 101} kernel_cap_t;
98 102
103/* exact same as vfs_cap_data but in cpu endian and always filled completely */
104struct cpu_vfs_cap_data {
105 __u32 magic_etc;
106 kernel_cap_t permitted;
107 kernel_cap_t inheritable;
108};
109
99#define _USER_CAP_HEADER_SIZE (sizeof(struct __user_cap_header_struct)) 110#define _USER_CAP_HEADER_SIZE (sizeof(struct __user_cap_header_struct))
100#define _KERNEL_CAP_T_SIZE (sizeof(kernel_cap_t)) 111#define _KERNEL_CAP_T_SIZE (sizeof(kernel_cap_t))
101 112
@@ -454,6 +465,13 @@ static inline int cap_isclear(const kernel_cap_t a)
454 return 1; 465 return 1;
455} 466}
456 467
468/*
469 * Check if "a" is a subset of "set".
470 * return 1 if ALL of the capabilities in "a" are also in "set"
471 * cap_issubset(0101, 1111) will return 1
472 * return 0 if ANY of the capabilities in "a" are not in "set"
473 * cap_issubset(1111, 0101) will return 0
474 */
457static inline int cap_issubset(const kernel_cap_t a, const kernel_cap_t set) 475static inline int cap_issubset(const kernel_cap_t a, const kernel_cap_t set)
458{ 476{
459 kernel_cap_t dest; 477 kernel_cap_t dest;
@@ -501,8 +519,6 @@ extern const kernel_cap_t __cap_empty_set;
501extern const kernel_cap_t __cap_full_set; 519extern const kernel_cap_t __cap_full_set;
502extern const kernel_cap_t __cap_init_eff_set; 520extern const kernel_cap_t __cap_init_eff_set;
503 521
504kernel_cap_t cap_set_effective(const kernel_cap_t pE_new);
505
506/** 522/**
507 * has_capability - Determine if a task has a superior capability available 523 * has_capability - Determine if a task has a superior capability available
508 * @t: The task in question 524 * @t: The task in question
@@ -513,10 +529,28 @@ kernel_cap_t cap_set_effective(const kernel_cap_t pE_new);
513 * 529 *
514 * Note that this does not set PF_SUPERPRIV on the task. 530 * Note that this does not set PF_SUPERPRIV on the task.
515 */ 531 */
516#define has_capability(t, cap) (security_capable((t), (cap)) == 0) 532#define has_capability(t, cap) (security_real_capable((t), (cap)) == 0)
533
534/**
535 * has_capability_noaudit - Determine if a task has a superior capability available (unaudited)
536 * @t: The task in question
537 * @cap: The capability to be tested for
538 *
539 * Return true if the specified task has the given superior capability
540 * currently in effect, false if not, but don't write an audit message for the
541 * check.
542 *
543 * Note that this does not set PF_SUPERPRIV on the task.
544 */
545#define has_capability_noaudit(t, cap) \
546 (security_real_capable_noaudit((t), (cap)) == 0)
517 547
518extern int capable(int cap); 548extern int capable(int cap);
519 549
550/* audit system wants to get cap info from files as well */
551struct dentry;
552extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps);
553
520#endif /* __KERNEL__ */ 554#endif /* __KERNEL__ */
521 555
522#endif /* !_LINUX_CAPABILITY_H */ 556#endif /* !_LINUX_CAPABILITY_H */
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 1164963c3a85..e267e62827bb 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -52,9 +52,9 @@ struct cgroup_subsys_state {
52 * hierarchy structure */ 52 * hierarchy structure */
53 struct cgroup *cgroup; 53 struct cgroup *cgroup;
54 54
55 /* State maintained by the cgroup system to allow 55 /* State maintained by the cgroup system to allow subsystems
56 * subsystems to be "busy". Should be accessed via css_get() 56 * to be "busy". Should be accessed via css_get(),
57 * and css_put() */ 57 * css_tryget() and and css_put(). */
58 58
59 atomic_t refcnt; 59 atomic_t refcnt;
60 60
@@ -64,11 +64,14 @@ struct cgroup_subsys_state {
64/* bits in struct cgroup_subsys_state flags field */ 64/* bits in struct cgroup_subsys_state flags field */
65enum { 65enum {
66 CSS_ROOT, /* This CSS is the root of the subsystem */ 66 CSS_ROOT, /* This CSS is the root of the subsystem */
67 CSS_REMOVED, /* This CSS is dead */
67}; 68};
68 69
69/* 70/*
70 * Call css_get() to hold a reference on the cgroup; 71 * Call css_get() to hold a reference on the css; it can be used
71 * 72 * for a reference obtained via:
73 * - an existing ref-counted reference to the css
74 * - task->cgroups for a locked task
72 */ 75 */
73 76
74static inline void css_get(struct cgroup_subsys_state *css) 77static inline void css_get(struct cgroup_subsys_state *css)
@@ -77,9 +80,32 @@ static inline void css_get(struct cgroup_subsys_state *css)
77 if (!test_bit(CSS_ROOT, &css->flags)) 80 if (!test_bit(CSS_ROOT, &css->flags))
78 atomic_inc(&css->refcnt); 81 atomic_inc(&css->refcnt);
79} 82}
83
84static inline bool css_is_removed(struct cgroup_subsys_state *css)
85{
86 return test_bit(CSS_REMOVED, &css->flags);
87}
88
89/*
90 * Call css_tryget() to take a reference on a css if your existing
91 * (known-valid) reference isn't already ref-counted. Returns false if
92 * the css has been destroyed.
93 */
94
95static inline bool css_tryget(struct cgroup_subsys_state *css)
96{
97 if (test_bit(CSS_ROOT, &css->flags))
98 return true;
99 while (!atomic_inc_not_zero(&css->refcnt)) {
100 if (test_bit(CSS_REMOVED, &css->flags))
101 return false;
102 }
103 return true;
104}
105
80/* 106/*
81 * css_put() should be called to release a reference taken by 107 * css_put() should be called to release a reference taken by
82 * css_get() 108 * css_get() or css_tryget()
83 */ 109 */
84 110
85extern void __css_put(struct cgroup_subsys_state *css); 111extern void __css_put(struct cgroup_subsys_state *css);
@@ -116,7 +142,7 @@ struct cgroup {
116 struct list_head children; /* my children */ 142 struct list_head children; /* my children */
117 143
118 struct cgroup *parent; /* my parent */ 144 struct cgroup *parent; /* my parent */
119 struct dentry *dentry; /* cgroup fs entry */ 145 struct dentry *dentry; /* cgroup fs entry, RCU protected */
120 146
121 /* Private pointers for each registered subsystem */ 147 /* Private pointers for each registered subsystem */
122 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT]; 148 struct cgroup_subsys_state *subsys[CGROUP_SUBSYS_COUNT];
@@ -145,6 +171,9 @@ struct cgroup {
145 int pids_use_count; 171 int pids_use_count;
146 /* Length of the current tasks_pids array */ 172 /* Length of the current tasks_pids array */
147 int pids_length; 173 int pids_length;
174
175 /* For RCU-protected deletion */
176 struct rcu_head rcu_head;
148}; 177};
149 178
150/* A css_set is a structure holding pointers to a set of 179/* A css_set is a structure holding pointers to a set of
@@ -329,13 +358,7 @@ struct cgroup_subsys {
329 struct cgroup *cgrp); 358 struct cgroup *cgrp);
330 void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp); 359 void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp);
331 void (*bind)(struct cgroup_subsys *ss, struct cgroup *root); 360 void (*bind)(struct cgroup_subsys *ss, struct cgroup *root);
332 /* 361
333 * This routine is called with the task_lock of mm->owner held
334 */
335 void (*mm_owner_changed)(struct cgroup_subsys *ss,
336 struct cgroup *old,
337 struct cgroup *new,
338 struct task_struct *p);
339 int subsys_id; 362 int subsys_id;
340 int active; 363 int active;
341 int disabled; 364 int disabled;
@@ -343,9 +366,23 @@ struct cgroup_subsys {
343#define MAX_CGROUP_TYPE_NAMELEN 32 366#define MAX_CGROUP_TYPE_NAMELEN 32
344 const char *name; 367 const char *name;
345 368
346 /* Protected by RCU */ 369 /*
347 struct cgroupfs_root *root; 370 * Protects sibling/children links of cgroups in this
371 * hierarchy, plus protects which hierarchy (or none) the
372 * subsystem is a part of (i.e. root/sibling). To avoid
373 * potential deadlocks, the following operations should not be
374 * undertaken while holding any hierarchy_mutex:
375 *
376 * - allocating memory
377 * - initiating hotplug events
378 */
379 struct mutex hierarchy_mutex;
348 380
381 /*
382 * Link to parent, and list entry in parent's children.
383 * Protected by this->hierarchy_mutex and cgroup_lock()
384 */
385 struct cgroupfs_root *root;
349 struct list_head sibling; 386 struct list_head sibling;
350}; 387};
351 388
@@ -400,9 +437,6 @@ void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it);
400int cgroup_scan_tasks(struct cgroup_scanner *scan); 437int cgroup_scan_tasks(struct cgroup_scanner *scan);
401int cgroup_attach_task(struct cgroup *, struct task_struct *); 438int cgroup_attach_task(struct cgroup *, struct task_struct *);
402 439
403void cgroup_mm_owner_callbacks(struct task_struct *old,
404 struct task_struct *new);
405
406#else /* !CONFIG_CGROUPS */ 440#else /* !CONFIG_CGROUPS */
407 441
408static inline int cgroup_init_early(void) { return 0; } 442static inline int cgroup_init_early(void) { return 0; }
@@ -420,9 +454,6 @@ static inline int cgroupstats_build(struct cgroupstats *stats,
420 return -EINVAL; 454 return -EINVAL;
421} 455}
422 456
423static inline void cgroup_mm_owner_callbacks(struct task_struct *old,
424 struct task_struct *new) {}
425
426#endif /* !CONFIG_CGROUPS */ 457#endif /* !CONFIG_CGROUPS */
427 458
428#endif /* _LINUX_CGROUP_H */ 459#endif /* _LINUX_CGROUP_H */
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index 9c22396e8b50..9c8d31bacf46 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -54,3 +54,9 @@ SUBSYS(freezer)
54#endif 54#endif
55 55
56/* */ 56/* */
57
58#ifdef CONFIG_NET_CLS_CGROUP
59SUBSYS(net_cls)
60#endif
61
62/* */
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 5c8351b859f0..1514d534deeb 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -11,9 +11,19 @@
11/* The "volatile" is due to gcc bugs */ 11/* The "volatile" is due to gcc bugs */
12#define barrier() __asm__ __volatile__("": : :"memory") 12#define barrier() __asm__ __volatile__("": : :"memory")
13 13
14/* This macro obfuscates arithmetic on a variable address so that gcc
15 shouldn't recognize the original var, and make assumptions about it */
16/* 14/*
15 * This macro obfuscates arithmetic on a variable address so that gcc
16 * shouldn't recognize the original var, and make assumptions about it.
17 *
18 * This is needed because the C standard makes it undefined to do
19 * pointer arithmetic on "objects" outside their boundaries and the
20 * gcc optimizers assume this is the case. In particular they
21 * assume such arithmetic does not wrap.
22 *
23 * A miscompilation has been observed because of this on PPC.
24 * To work around it we hide the relationship of the pointer and the object
25 * using this macro.
26 *
17 * Versions of the ppc64 compiler before 4.1 had a bug where use of 27 * Versions of the ppc64 compiler before 4.1 had a bug where use of
18 * RELOC_HIDE could trash r30. The bug can be worked around by changing 28 * RELOC_HIDE could trash r30. The bug can be worked around by changing
19 * the inline assembly constraint from =g to =r, in this particular 29 * the inline assembly constraint from =g to =r, in this particular
@@ -61,3 +71,8 @@
61#define noinline __attribute__((noinline)) 71#define noinline __attribute__((noinline))
62#define __attribute_const__ __attribute__((__const__)) 72#define __attribute_const__ __attribute__((__const__))
63#define __maybe_unused __attribute__((unused)) 73#define __maybe_unused __attribute__((unused))
74
75#define __gcc_header(x) #x
76#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h)
77#define gcc_header(x) _gcc_header(x)
78#include gcc_header(__GNUC__)
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
index e5eb795f78a1..8005effc04f1 100644
--- a/include/linux/compiler-gcc3.h
+++ b/include/linux/compiler-gcc3.h
@@ -2,8 +2,9 @@
2#error "Please don't include <linux/compiler-gcc3.h> directly, include <linux/compiler.h> instead." 2#error "Please don't include <linux/compiler-gcc3.h> directly, include <linux/compiler.h> instead."
3#endif 3#endif
4 4
5/* These definitions are for GCC v3.x. */ 5#if __GNUC_MINOR__ < 2
6#include <linux/compiler-gcc.h> 6# error Sorry, your compiler is too old - please upgrade it.
7#endif
7 8
8#if __GNUC_MINOR__ >= 3 9#if __GNUC_MINOR__ >= 3
9# define __used __attribute__((__used__)) 10# define __used __attribute__((__used__))
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 974f5b7bb205..09992718f9e8 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -2,8 +2,10 @@
2#error "Please don't include <linux/compiler-gcc4.h> directly, include <linux/compiler.h> instead." 2#error "Please don't include <linux/compiler-gcc4.h> directly, include <linux/compiler.h> instead."
3#endif 3#endif
4 4
5/* These definitions are for GCC v4.x. */ 5/* GCC 4.1.[01] miscompiles __weak */
6#include <linux/compiler-gcc.h> 6#if __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ <= 1
7# error Your version of gcc miscompiles the __weak directive
8#endif
7 9
8#define __used __attribute__((__used__)) 10#define __used __attribute__((__used__))
9#define __must_check __attribute__((warn_unused_result)) 11#define __must_check __attribute__((warn_unused_result))
@@ -16,7 +18,7 @@
16 */ 18 */
17#define uninitialized_var(x) x = x 19#define uninitialized_var(x) x = x
18 20
19#if !(__GNUC__ == 4 && __GNUC_MINOR__ < 3) 21#if __GNUC_MINOR__ >= 3
20/* Mark functions as cold. gcc will assume any path leading to a call 22/* Mark functions as cold. gcc will assume any path leading to a call
21 to them will be unlikely. This means a lot of manual unlikely()s 23 to them will be unlikely. This means a lot of manual unlikely()s
22 are unnecessary now for any paths leading to the usual suspects 24 are unnecessary now for any paths leading to the usual suspects
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index ea7c6be354b7..d95da1020f1c 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -36,12 +36,8 @@ extern void __chk_io_ptr(const volatile void __iomem *);
36 36
37#ifdef __KERNEL__ 37#ifdef __KERNEL__
38 38
39#if __GNUC__ >= 4 39#ifdef __GNUC__
40# include <linux/compiler-gcc4.h> 40#include <linux/compiler-gcc.h>
41#elif __GNUC__ == 3 && __GNUC_MINOR__ >= 2
42# include <linux/compiler-gcc3.h>
43#else
44# error Sorry, your compiler is too old/not recognized.
45#endif 41#endif
46 42
47#define notrace __attribute__((no_instrument_function)) 43#define notrace __attribute__((no_instrument_function))
diff --git a/include/linux/console.h b/include/linux/console.h
index 248e6e3b9b73..a67a90cf8268 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -153,4 +153,8 @@ void vcs_remove_sysfs(struct tty_struct *tty);
153#define VESA_HSYNC_SUSPEND 2 153#define VESA_HSYNC_SUSPEND 2
154#define VESA_POWERDOWN 3 154#define VESA_POWERDOWN 3
155 155
156#ifdef CONFIG_VGA_CONSOLE
157extern bool vgacon_text_force(void);
158#endif
159
156#endif /* _LINUX_CONSOLE_H */ 160#endif /* _LINUX_CONSOLE_H */
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 1ee608fd7b77..384b38d3e8e2 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -80,8 +80,8 @@ struct cpufreq_real_policy {
80}; 80};
81 81
82struct cpufreq_policy { 82struct cpufreq_policy {
83 cpumask_t cpus; /* CPUs requiring sw coordination */ 83 cpumask_var_t cpus; /* CPUs requiring sw coordination */
84 cpumask_t related_cpus; /* CPUs with any coordination */ 84 cpumask_var_t related_cpus; /* CPUs with any coordination */
85 unsigned int shared_type; /* ANY or ALL affected CPUs 85 unsigned int shared_type; /* ANY or ALL affected CPUs
86 should set cpufreq */ 86 should set cpufreq */
87 unsigned int cpu; /* cpu nr of registered CPU */ 87 unsigned int cpu; /* cpu nr of registered CPU */
@@ -234,6 +234,7 @@ struct cpufreq_driver {
234 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); 234 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg);
235 int (*resume) (struct cpufreq_policy *policy); 235 int (*resume) (struct cpufreq_policy *policy);
236 struct freq_attr **attr; 236 struct freq_attr **attr;
237 bool hide_interface;
237}; 238};
238 239
239/* flags */ 240/* flags */
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index d4bf52603e6b..9f315382610b 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -144,6 +144,7 @@
144typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; 144typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
145extern cpumask_t _unused_cpumask_arg_; 145extern cpumask_t _unused_cpumask_arg_;
146 146
147#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
147#define cpu_set(cpu, dst) __cpu_set((cpu), &(dst)) 148#define cpu_set(cpu, dst) __cpu_set((cpu), &(dst))
148static inline void __cpu_set(int cpu, volatile cpumask_t *dstp) 149static inline void __cpu_set(int cpu, volatile cpumask_t *dstp)
149{ 150{
@@ -267,6 +268,26 @@ static inline void __cpus_shift_left(cpumask_t *dstp,
267{ 268{
268 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits); 269 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
269} 270}
271#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
272
273/**
274 * to_cpumask - convert an NR_CPUS bitmap to a struct cpumask *
275 * @bitmap: the bitmap
276 *
277 * There are a few places where cpumask_var_t isn't appropriate and
278 * static cpumasks must be used (eg. very early boot), yet we don't
279 * expose the definition of 'struct cpumask'.
280 *
281 * This does the conversion, and can be used as a constant initializer.
282 */
283#define to_cpumask(bitmap) \
284 ((struct cpumask *)(1 ? (bitmap) \
285 : (void *)sizeof(__check_is_bitmap(bitmap))))
286
287static inline int __check_is_bitmap(const unsigned long *bitmap)
288{
289 return 1;
290}
270 291
271/* 292/*
272 * Special-case data structure for "single bit set only" constant CPU masks. 293 * Special-case data structure for "single bit set only" constant CPU masks.
@@ -278,13 +299,14 @@ static inline void __cpus_shift_left(cpumask_t *dstp,
278extern const unsigned long 299extern const unsigned long
279 cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)]; 300 cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)];
280 301
281static inline const cpumask_t *get_cpu_mask(unsigned int cpu) 302static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
282{ 303{
283 const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG]; 304 const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG];
284 p -= cpu / BITS_PER_LONG; 305 p -= cpu / BITS_PER_LONG;
285 return (const cpumask_t *)p; 306 return to_cpumask(p);
286} 307}
287 308
309#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
288/* 310/*
289 * In cases where we take the address of the cpumask immediately, 311 * In cases where we take the address of the cpumask immediately,
290 * gcc optimizes it out (it's a constant) and there's no huge stack 312 * gcc optimizes it out (it's a constant) and there's no huge stack
@@ -370,19 +392,22 @@ static inline void __cpus_fold(cpumask_t *dstp, const cpumask_t *origp,
370{ 392{
371 bitmap_fold(dstp->bits, origp->bits, sz, nbits); 393 bitmap_fold(dstp->bits, origp->bits, sz, nbits);
372} 394}
395#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
373 396
374#if NR_CPUS == 1 397#if NR_CPUS == 1
375 398
376#define nr_cpu_ids 1 399#define nr_cpu_ids 1
400#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
377#define first_cpu(src) ({ (void)(src); 0; }) 401#define first_cpu(src) ({ (void)(src); 0; })
378#define next_cpu(n, src) ({ (void)(src); 1; }) 402#define next_cpu(n, src) ({ (void)(src); 1; })
379#define any_online_cpu(mask) 0 403#define any_online_cpu(mask) 0
380#define for_each_cpu_mask(cpu, mask) \ 404#define for_each_cpu_mask(cpu, mask) \
381 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) 405 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
382 406#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
383#else /* NR_CPUS > 1 */ 407#else /* NR_CPUS > 1 */
384 408
385extern int nr_cpu_ids; 409extern int nr_cpu_ids;
410#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
386int __first_cpu(const cpumask_t *srcp); 411int __first_cpu(const cpumask_t *srcp);
387int __next_cpu(int n, const cpumask_t *srcp); 412int __next_cpu(int n, const cpumask_t *srcp);
388int __any_online_cpu(const cpumask_t *mask); 413int __any_online_cpu(const cpumask_t *mask);
@@ -394,8 +419,10 @@ int __any_online_cpu(const cpumask_t *mask);
394 for ((cpu) = -1; \ 419 for ((cpu) = -1; \
395 (cpu) = next_cpu((cpu), (mask)), \ 420 (cpu) = next_cpu((cpu), (mask)), \
396 (cpu) < NR_CPUS; ) 421 (cpu) < NR_CPUS; )
422#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
397#endif 423#endif
398 424
425#ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
399#if NR_CPUS <= 64 426#if NR_CPUS <= 64
400 427
401#define next_cpu_nr(n, src) next_cpu(n, src) 428#define next_cpu_nr(n, src) next_cpu(n, src)
@@ -413,77 +440,67 @@ int __next_cpu_nr(int n, const cpumask_t *srcp);
413 (cpu) < nr_cpu_ids; ) 440 (cpu) < nr_cpu_ids; )
414 441
415#endif /* NR_CPUS > 64 */ 442#endif /* NR_CPUS > 64 */
443#endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */
416 444
417/* 445/*
418 * The following particular system cpumasks and operations manage 446 * The following particular system cpumasks and operations manage
419 * possible, present, active and online cpus. Each of them is a fixed size 447 * possible, present, active and online cpus.
420 * bitmap of size NR_CPUS.
421 * 448 *
422 * #ifdef CONFIG_HOTPLUG_CPU 449 * cpu_possible_mask- has bit 'cpu' set iff cpu is populatable
423 * cpu_possible_map - has bit 'cpu' set iff cpu is populatable 450 * cpu_present_mask - has bit 'cpu' set iff cpu is populated
424 * cpu_present_map - has bit 'cpu' set iff cpu is populated 451 * cpu_online_mask - has bit 'cpu' set iff cpu available to scheduler
425 * cpu_online_map - has bit 'cpu' set iff cpu available to scheduler 452 * cpu_active_mask - has bit 'cpu' set iff cpu available to migration
426 * cpu_active_map - has bit 'cpu' set iff cpu available to migration
427 * #else
428 * cpu_possible_map - has bit 'cpu' set iff cpu is populated
429 * cpu_present_map - copy of cpu_possible_map
430 * cpu_online_map - has bit 'cpu' set iff cpu available to scheduler
431 * #endif
432 * 453 *
433 * In either case, NR_CPUS is fixed at compile time, as the static 454 * If !CONFIG_HOTPLUG_CPU, present == possible, and active == online.
434 * size of these bitmaps. The cpu_possible_map is fixed at boot
435 * time, as the set of CPU id's that it is possible might ever
436 * be plugged in at anytime during the life of that system boot.
437 * The cpu_present_map is dynamic(*), representing which CPUs
438 * are currently plugged in. And cpu_online_map is the dynamic
439 * subset of cpu_present_map, indicating those CPUs available
440 * for scheduling.
441 * 455 *
442 * If HOTPLUG is enabled, then cpu_possible_map is forced to have 456 * The cpu_possible_mask is fixed at boot time, as the set of CPU id's
457 * that it is possible might ever be plugged in at anytime during the
458 * life of that system boot. The cpu_present_mask is dynamic(*),
459 * representing which CPUs are currently plugged in. And
460 * cpu_online_mask is the dynamic subset of cpu_present_mask,
461 * indicating those CPUs available for scheduling.
462 *
463 * If HOTPLUG is enabled, then cpu_possible_mask is forced to have
443 * all NR_CPUS bits set, otherwise it is just the set of CPUs that 464 * all NR_CPUS bits set, otherwise it is just the set of CPUs that
444 * ACPI reports present at boot. 465 * ACPI reports present at boot.
445 * 466 *
446 * If HOTPLUG is enabled, then cpu_present_map varies dynamically, 467 * If HOTPLUG is enabled, then cpu_present_mask varies dynamically,
447 * depending on what ACPI reports as currently plugged in, otherwise 468 * depending on what ACPI reports as currently plugged in, otherwise
448 * cpu_present_map is just a copy of cpu_possible_map. 469 * cpu_present_mask is just a copy of cpu_possible_mask.
449 * 470 *
450 * (*) Well, cpu_present_map is dynamic in the hotplug case. If not 471 * (*) Well, cpu_present_mask is dynamic in the hotplug case. If not
451 * hotplug, it's a copy of cpu_possible_map, hence fixed at boot. 472 * hotplug, it's a copy of cpu_possible_mask, hence fixed at boot.
452 * 473 *
453 * Subtleties: 474 * Subtleties:
454 * 1) UP arch's (NR_CPUS == 1, CONFIG_SMP not defined) hardcode 475 * 1) UP arch's (NR_CPUS == 1, CONFIG_SMP not defined) hardcode
455 * assumption that their single CPU is online. The UP 476 * assumption that their single CPU is online. The UP
456 * cpu_{online,possible,present}_maps are placebos. Changing them 477 * cpu_{online,possible,present}_masks are placebos. Changing them
457 * will have no useful affect on the following num_*_cpus() 478 * will have no useful affect on the following num_*_cpus()
458 * and cpu_*() macros in the UP case. This ugliness is a UP 479 * and cpu_*() macros in the UP case. This ugliness is a UP
459 * optimization - don't waste any instructions or memory references 480 * optimization - don't waste any instructions or memory references
460 * asking if you're online or how many CPUs there are if there is 481 * asking if you're online or how many CPUs there are if there is
461 * only one CPU. 482 * only one CPU.
462 * 2) Most SMP arch's #define some of these maps to be some
463 * other map specific to that arch. Therefore, the following
464 * must be #define macros, not inlines. To see why, examine
465 * the assembly code produced by the following. Note that
466 * set1() writes phys_x_map, but set2() writes x_map:
467 * int x_map, phys_x_map;
468 * #define set1(a) x_map = a
469 * inline void set2(int a) { x_map = a; }
470 * #define x_map phys_x_map
471 * main(){ set1(3); set2(5); }
472 */ 483 */
473 484
474extern cpumask_t cpu_possible_map; 485extern const struct cpumask *const cpu_possible_mask;
475extern cpumask_t cpu_online_map; 486extern const struct cpumask *const cpu_online_mask;
476extern cpumask_t cpu_present_map; 487extern const struct cpumask *const cpu_present_mask;
477extern cpumask_t cpu_active_map; 488extern const struct cpumask *const cpu_active_mask;
489
490/* These strip const, as traditionally they weren't const. */
491#define cpu_possible_map (*(cpumask_t *)cpu_possible_mask)
492#define cpu_online_map (*(cpumask_t *)cpu_online_mask)
493#define cpu_present_map (*(cpumask_t *)cpu_present_mask)
494#define cpu_active_map (*(cpumask_t *)cpu_active_mask)
478 495
479#if NR_CPUS > 1 496#if NR_CPUS > 1
480#define num_online_cpus() cpus_weight_nr(cpu_online_map) 497#define num_online_cpus() cpumask_weight(cpu_online_mask)
481#define num_possible_cpus() cpus_weight_nr(cpu_possible_map) 498#define num_possible_cpus() cpumask_weight(cpu_possible_mask)
482#define num_present_cpus() cpus_weight_nr(cpu_present_map) 499#define num_present_cpus() cpumask_weight(cpu_present_mask)
483#define cpu_online(cpu) cpu_isset((cpu), cpu_online_map) 500#define cpu_online(cpu) cpumask_test_cpu((cpu), cpu_online_mask)
484#define cpu_possible(cpu) cpu_isset((cpu), cpu_possible_map) 501#define cpu_possible(cpu) cpumask_test_cpu((cpu), cpu_possible_mask)
485#define cpu_present(cpu) cpu_isset((cpu), cpu_present_map) 502#define cpu_present(cpu) cpumask_test_cpu((cpu), cpu_present_mask)
486#define cpu_active(cpu) cpu_isset((cpu), cpu_active_map) 503#define cpu_active(cpu) cpumask_test_cpu((cpu), cpu_active_mask)
487#else 504#else
488#define num_online_cpus() 1 505#define num_online_cpus() 1
489#define num_possible_cpus() 1 506#define num_possible_cpus() 1
@@ -496,10 +513,6 @@ extern cpumask_t cpu_active_map;
496 513
497#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) 514#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
498 515
499#define for_each_possible_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_possible_map)
500#define for_each_online_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_online_map)
501#define for_each_present_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_present_map)
502
503/* These are the new versions of the cpumask operators: passed by pointer. 516/* These are the new versions of the cpumask operators: passed by pointer.
504 * The older versions will be implemented in terms of these, then deleted. */ 517 * The older versions will be implemented in terms of these, then deleted. */
505#define cpumask_bits(maskp) ((maskp)->bits) 518#define cpumask_bits(maskp) ((maskp)->bits)
@@ -687,7 +700,7 @@ static inline void cpumask_clear_cpu(int cpu, struct cpumask *dstp)
687 * No static inline type checking - see Subtlety (1) above. 700 * No static inline type checking - see Subtlety (1) above.
688 */ 701 */
689#define cpumask_test_cpu(cpu, cpumask) \ 702#define cpumask_test_cpu(cpu, cpumask) \
690 test_bit(cpumask_check(cpu), (cpumask)->bits) 703 test_bit(cpumask_check(cpu), cpumask_bits((cpumask)))
691 704
692/** 705/**
693 * cpumask_test_and_set_cpu - atomically test and set a cpu in a cpumask 706 * cpumask_test_and_set_cpu - atomically test and set a cpu in a cpumask
@@ -930,7 +943,7 @@ static inline void cpumask_copy(struct cpumask *dstp,
930static inline int cpumask_scnprintf(char *buf, int len, 943static inline int cpumask_scnprintf(char *buf, int len,
931 const struct cpumask *srcp) 944 const struct cpumask *srcp)
932{ 945{
933 return bitmap_scnprintf(buf, len, srcp->bits, nr_cpumask_bits); 946 return bitmap_scnprintf(buf, len, cpumask_bits(srcp), nr_cpumask_bits);
934} 947}
935 948
936/** 949/**
@@ -944,7 +957,7 @@ static inline int cpumask_scnprintf(char *buf, int len,
944static inline int cpumask_parse_user(const char __user *buf, int len, 957static inline int cpumask_parse_user(const char __user *buf, int len,
945 struct cpumask *dstp) 958 struct cpumask *dstp)
946{ 959{
947 return bitmap_parse_user(buf, len, dstp->bits, nr_cpumask_bits); 960 return bitmap_parse_user(buf, len, cpumask_bits(dstp), nr_cpumask_bits);
948} 961}
949 962
950/** 963/**
@@ -959,7 +972,8 @@ static inline int cpumask_parse_user(const char __user *buf, int len,
959static inline int cpulist_scnprintf(char *buf, int len, 972static inline int cpulist_scnprintf(char *buf, int len,
960 const struct cpumask *srcp) 973 const struct cpumask *srcp)
961{ 974{
962 return bitmap_scnlistprintf(buf, len, srcp->bits, nr_cpumask_bits); 975 return bitmap_scnlistprintf(buf, len, cpumask_bits(srcp),
976 nr_cpumask_bits);
963} 977}
964 978
965/** 979/**
@@ -972,26 +986,7 @@ static inline int cpulist_scnprintf(char *buf, int len,
972 */ 986 */
973static inline int cpulist_parse(const char *buf, struct cpumask *dstp) 987static inline int cpulist_parse(const char *buf, struct cpumask *dstp)
974{ 988{
975 return bitmap_parselist(buf, dstp->bits, nr_cpumask_bits); 989 return bitmap_parselist(buf, cpumask_bits(dstp), nr_cpumask_bits);
976}
977
978/**
979 * to_cpumask - convert an NR_CPUS bitmap to a struct cpumask *
980 * @bitmap: the bitmap
981 *
982 * There are a few places where cpumask_var_t isn't appropriate and
983 * static cpumasks must be used (eg. very early boot), yet we don't
984 * expose the definition of 'struct cpumask'.
985 *
986 * This does the conversion, and can be used as a constant initializer.
987 */
988#define to_cpumask(bitmap) \
989 ((struct cpumask *)(1 ? (bitmap) \
990 : (void *)sizeof(__check_is_bitmap(bitmap))))
991
992static inline int __check_is_bitmap(const unsigned long *bitmap)
993{
994 return 1;
995} 990}
996 991
997/** 992/**
@@ -1025,6 +1020,7 @@ static inline size_t cpumask_size(void)
1025#ifdef CONFIG_CPUMASK_OFFSTACK 1020#ifdef CONFIG_CPUMASK_OFFSTACK
1026typedef struct cpumask *cpumask_var_t; 1021typedef struct cpumask *cpumask_var_t;
1027 1022
1023bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node);
1028bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags); 1024bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags);
1029void alloc_bootmem_cpumask_var(cpumask_var_t *mask); 1025void alloc_bootmem_cpumask_var(cpumask_var_t *mask);
1030void free_cpumask_var(cpumask_var_t mask); 1026void free_cpumask_var(cpumask_var_t mask);
@@ -1038,6 +1034,12 @@ static inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
1038 return true; 1034 return true;
1039} 1035}
1040 1036
1037static inline bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags,
1038 int node)
1039{
1040 return true;
1041}
1042
1041static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask) 1043static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask)
1042{ 1044{
1043} 1045}
@@ -1051,12 +1053,6 @@ static inline void free_bootmem_cpumask_var(cpumask_var_t mask)
1051} 1053}
1052#endif /* CONFIG_CPUMASK_OFFSTACK */ 1054#endif /* CONFIG_CPUMASK_OFFSTACK */
1053 1055
1054/* The pointer versions of the maps, these will become the primary versions. */
1055#define cpu_possible_mask ((const struct cpumask *)&cpu_possible_map)
1056#define cpu_online_mask ((const struct cpumask *)&cpu_online_map)
1057#define cpu_present_mask ((const struct cpumask *)&cpu_present_map)
1058#define cpu_active_mask ((const struct cpumask *)&cpu_active_map)
1059
1060/* It's common to want to use cpu_all_mask in struct member initializers, 1056/* It's common to want to use cpu_all_mask in struct member initializers,
1061 * so it has to refer to an address rather than a pointer. */ 1057 * so it has to refer to an address rather than a pointer. */
1062extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS); 1058extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS);
@@ -1065,51 +1061,16 @@ extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS);
1065/* First bits of cpu_bit_bitmap are in fact unset. */ 1061/* First bits of cpu_bit_bitmap are in fact unset. */
1066#define cpu_none_mask to_cpumask(cpu_bit_bitmap[0]) 1062#define cpu_none_mask to_cpumask(cpu_bit_bitmap[0])
1067 1063
1068/* Wrappers for arch boot code to manipulate normally-constant masks */ 1064#define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask)
1069static inline void set_cpu_possible(unsigned int cpu, bool possible) 1065#define for_each_online_cpu(cpu) for_each_cpu((cpu), cpu_online_mask)
1070{ 1066#define for_each_present_cpu(cpu) for_each_cpu((cpu), cpu_present_mask)
1071 if (possible)
1072 cpumask_set_cpu(cpu, &cpu_possible_map);
1073 else
1074 cpumask_clear_cpu(cpu, &cpu_possible_map);
1075}
1076
1077static inline void set_cpu_present(unsigned int cpu, bool present)
1078{
1079 if (present)
1080 cpumask_set_cpu(cpu, &cpu_present_map);
1081 else
1082 cpumask_clear_cpu(cpu, &cpu_present_map);
1083}
1084
1085static inline void set_cpu_online(unsigned int cpu, bool online)
1086{
1087 if (online)
1088 cpumask_set_cpu(cpu, &cpu_online_map);
1089 else
1090 cpumask_clear_cpu(cpu, &cpu_online_map);
1091}
1092 1067
1093static inline void set_cpu_active(unsigned int cpu, bool active) 1068/* Wrappers for arch boot code to manipulate normally-constant masks */
1094{ 1069void set_cpu_possible(unsigned int cpu, bool possible);
1095 if (active) 1070void set_cpu_present(unsigned int cpu, bool present);
1096 cpumask_set_cpu(cpu, &cpu_active_map); 1071void set_cpu_online(unsigned int cpu, bool online);
1097 else 1072void set_cpu_active(unsigned int cpu, bool active);
1098 cpumask_clear_cpu(cpu, &cpu_active_map); 1073void init_cpu_present(const struct cpumask *src);
1099} 1074void init_cpu_possible(const struct cpumask *src);
1100 1075void init_cpu_online(const struct cpumask *src);
1101static inline void init_cpu_present(const struct cpumask *src)
1102{
1103 cpumask_copy(&cpu_present_map, src);
1104}
1105
1106static inline void init_cpu_possible(const struct cpumask *src)
1107{
1108 cpumask_copy(&cpu_possible_map, src);
1109}
1110
1111static inline void init_cpu_online(const struct cpumask *src)
1112{
1113 cpumask_copy(&cpu_online_map, src);
1114}
1115#endif /* __LINUX_CPUMASK_H */ 1076#endif /* __LINUX_CPUMASK_H */
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 8e540d32c9fe..90c6074a36ca 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -20,8 +20,9 @@ extern int number_of_cpusets; /* How many cpusets are defined in system? */
20extern int cpuset_init_early(void); 20extern int cpuset_init_early(void);
21extern int cpuset_init(void); 21extern int cpuset_init(void);
22extern void cpuset_init_smp(void); 22extern void cpuset_init_smp(void);
23extern void cpuset_cpus_allowed(struct task_struct *p, cpumask_t *mask); 23extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
24extern void cpuset_cpus_allowed_locked(struct task_struct *p, cpumask_t *mask); 24extern void cpuset_cpus_allowed_locked(struct task_struct *p,
25 struct cpumask *mask);
25extern nodemask_t cpuset_mems_allowed(struct task_struct *p); 26extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
26#define cpuset_current_mems_allowed (current->mems_allowed) 27#define cpuset_current_mems_allowed (current->mems_allowed)
27void cpuset_init_current_mems_allowed(void); 28void cpuset_init_current_mems_allowed(void);
@@ -78,18 +79,21 @@ extern int current_cpuset_is_being_rebound(void);
78 79
79extern void rebuild_sched_domains(void); 80extern void rebuild_sched_domains(void);
80 81
82extern void cpuset_print_task_mems_allowed(struct task_struct *p);
83
81#else /* !CONFIG_CPUSETS */ 84#else /* !CONFIG_CPUSETS */
82 85
83static inline int cpuset_init_early(void) { return 0; } 86static inline int cpuset_init_early(void) { return 0; }
84static inline int cpuset_init(void) { return 0; } 87static inline int cpuset_init(void) { return 0; }
85static inline void cpuset_init_smp(void) {} 88static inline void cpuset_init_smp(void) {}
86 89
87static inline void cpuset_cpus_allowed(struct task_struct *p, cpumask_t *mask) 90static inline void cpuset_cpus_allowed(struct task_struct *p,
91 struct cpumask *mask)
88{ 92{
89 *mask = cpu_possible_map; 93 *mask = cpu_possible_map;
90} 94}
91static inline void cpuset_cpus_allowed_locked(struct task_struct *p, 95static inline void cpuset_cpus_allowed_locked(struct task_struct *p,
92 cpumask_t *mask) 96 struct cpumask *mask)
93{ 97{
94 *mask = cpu_possible_map; 98 *mask = cpu_possible_map;
95} 99}
@@ -159,6 +163,10 @@ static inline void rebuild_sched_domains(void)
159 partition_sched_domains(1, NULL, NULL); 163 partition_sched_domains(1, NULL, NULL);
160} 164}
161 165
166static inline void cpuset_print_task_mems_allowed(struct task_struct *p)
167{
168}
169
162#endif /* !CONFIG_CPUSETS */ 170#endif /* !CONFIG_CPUSETS */
163 171
164#endif /* _LINUX_CPUSET_H */ 172#endif /* _LINUX_CPUSET_H */
diff --git a/include/linux/crc32c.h b/include/linux/crc32c.h
index 508f512e5a2f..bd8b44d96bdc 100644
--- a/include/linux/crc32c.h
+++ b/include/linux/crc32c.h
@@ -3,9 +3,9 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6extern u32 crc32c_le(u32 crc, unsigned char const *address, size_t length); 6extern u32 crc32c(u32 crc, const void *address, unsigned int length);
7extern u32 crc32c_be(u32 crc, unsigned char const *address, size_t length);
8 7
9#define crc32c(seed, data, length) crc32c_le(seed, (unsigned char const *)data, length) 8/* This macro exists for backwards-compatibility. */
9#define crc32c_le crc32c
10 10
11#endif /* _LINUX_CRC32C_H */ 11#endif /* _LINUX_CRC32C_H */
diff --git a/include/linux/cred.h b/include/linux/cred.h
index b69222cc1fd2..3282ee4318e7 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -1,4 +1,4 @@
1/* Credentials management 1/* Credentials management - see Documentation/credentials.txt
2 * 2 *
3 * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
@@ -12,39 +12,335 @@
12#ifndef _LINUX_CRED_H 12#ifndef _LINUX_CRED_H
13#define _LINUX_CRED_H 13#define _LINUX_CRED_H
14 14
15#define get_current_user() (get_uid(current->user)) 15#include <linux/capability.h>
16#include <linux/key.h>
17#include <asm/atomic.h>
16 18
17#define task_uid(task) ((task)->uid) 19struct user_struct;
18#define task_gid(task) ((task)->gid) 20struct cred;
19#define task_euid(task) ((task)->euid) 21struct inode;
20#define task_egid(task) ((task)->egid)
21 22
22#define current_uid() (current->uid) 23/*
23#define current_gid() (current->gid) 24 * COW Supplementary groups list
24#define current_euid() (current->euid) 25 */
25#define current_egid() (current->egid) 26#define NGROUPS_SMALL 32
26#define current_suid() (current->suid) 27#define NGROUPS_PER_BLOCK ((unsigned int)(PAGE_SIZE / sizeof(gid_t)))
27#define current_sgid() (current->sgid) 28
28#define current_fsuid() (current->fsuid) 29struct group_info {
29#define current_fsgid() (current->fsgid) 30 atomic_t usage;
30#define current_cap() (current->cap_effective) 31 int ngroups;
32 int nblocks;
33 gid_t small_block[NGROUPS_SMALL];
34 gid_t *blocks[0];
35};
36
37/**
38 * get_group_info - Get a reference to a group info structure
39 * @group_info: The group info to reference
40 *
41 * This gets a reference to a set of supplementary groups.
42 *
43 * If the caller is accessing a task's credentials, they must hold the RCU read
44 * lock when reading.
45 */
46static inline struct group_info *get_group_info(struct group_info *gi)
47{
48 atomic_inc(&gi->usage);
49 return gi;
50}
51
52/**
53 * put_group_info - Release a reference to a group info structure
54 * @group_info: The group info to release
55 */
56#define put_group_info(group_info) \
57do { \
58 if (atomic_dec_and_test(&(group_info)->usage)) \
59 groups_free(group_info); \
60} while (0)
61
62extern struct group_info *groups_alloc(int);
63extern struct group_info init_groups;
64extern void groups_free(struct group_info *);
65extern int set_current_groups(struct group_info *);
66extern int set_groups(struct cred *, struct group_info *);
67extern int groups_search(const struct group_info *, gid_t);
68
69/* access the groups "array" with this macro */
70#define GROUP_AT(gi, i) \
71 ((gi)->blocks[(i) / NGROUPS_PER_BLOCK][(i) % NGROUPS_PER_BLOCK])
72
73extern int in_group_p(gid_t);
74extern int in_egroup_p(gid_t);
75
76/*
77 * The common credentials for a thread group
78 * - shared by CLONE_THREAD
79 */
80#ifdef CONFIG_KEYS
81struct thread_group_cred {
82 atomic_t usage;
83 pid_t tgid; /* thread group process ID */
84 spinlock_t lock;
85 struct key *session_keyring; /* keyring inherited over fork */
86 struct key *process_keyring; /* keyring private to this process */
87 struct rcu_head rcu; /* RCU deletion hook */
88};
89#endif
90
91/*
92 * The security context of a task
93 *
94 * The parts of the context break down into two categories:
95 *
96 * (1) The objective context of a task. These parts are used when some other
97 * task is attempting to affect this one.
98 *
99 * (2) The subjective context. These details are used when the task is acting
100 * upon another object, be that a file, a task, a key or whatever.
101 *
102 * Note that some members of this structure belong to both categories - the
103 * LSM security pointer for instance.
104 *
105 * A task has two security pointers. task->real_cred points to the objective
106 * context that defines that task's actual details. The objective part of this
107 * context is used whenever that task is acted upon.
108 *
109 * task->cred points to the subjective context that defines the details of how
110 * that task is going to act upon another object. This may be overridden
111 * temporarily to point to another security context, but normally points to the
112 * same context as task->real_cred.
113 */
114struct cred {
115 atomic_t usage;
116 uid_t uid; /* real UID of the task */
117 gid_t gid; /* real GID of the task */
118 uid_t suid; /* saved UID of the task */
119 gid_t sgid; /* saved GID of the task */
120 uid_t euid; /* effective UID of the task */
121 gid_t egid; /* effective GID of the task */
122 uid_t fsuid; /* UID for VFS ops */
123 gid_t fsgid; /* GID for VFS ops */
124 unsigned securebits; /* SUID-less security management */
125 kernel_cap_t cap_inheritable; /* caps our children can inherit */
126 kernel_cap_t cap_permitted; /* caps we're permitted */
127 kernel_cap_t cap_effective; /* caps we can actually use */
128 kernel_cap_t cap_bset; /* capability bounding set */
129#ifdef CONFIG_KEYS
130 unsigned char jit_keyring; /* default keyring to attach requested
131 * keys to */
132 struct key *thread_keyring; /* keyring private to this thread */
133 struct key *request_key_auth; /* assumed request_key authority */
134 struct thread_group_cred *tgcred; /* thread-group shared credentials */
135#endif
136#ifdef CONFIG_SECURITY
137 void *security; /* subjective LSM security */
138#endif
139 struct user_struct *user; /* real user ID subscription */
140 struct group_info *group_info; /* supplementary groups for euid/fsgid */
141 struct rcu_head rcu; /* RCU deletion hook */
142};
143
144extern void __put_cred(struct cred *);
145extern int copy_creds(struct task_struct *, unsigned long);
146extern struct cred *prepare_creds(void);
147extern struct cred *prepare_exec_creds(void);
148extern struct cred *prepare_usermodehelper_creds(void);
149extern int commit_creds(struct cred *);
150extern void abort_creds(struct cred *);
151extern const struct cred *override_creds(const struct cred *);
152extern void revert_creds(const struct cred *);
153extern struct cred *prepare_kernel_cred(struct task_struct *);
154extern int change_create_files_as(struct cred *, struct inode *);
155extern int set_security_override(struct cred *, u32);
156extern int set_security_override_from_ctx(struct cred *, const char *);
157extern int set_create_files_as(struct cred *, struct inode *);
158extern void __init cred_init(void);
159
160/**
161 * get_new_cred - Get a reference on a new set of credentials
162 * @cred: The new credentials to reference
163 *
164 * Get a reference on the specified set of new credentials. The caller must
165 * release the reference.
166 */
167static inline struct cred *get_new_cred(struct cred *cred)
168{
169 atomic_inc(&cred->usage);
170 return cred;
171}
172
173/**
174 * get_cred - Get a reference on a set of credentials
175 * @cred: The credentials to reference
176 *
177 * Get a reference on the specified set of credentials. The caller must
178 * release the reference.
179 *
180 * This is used to deal with a committed set of credentials. Although the
181 * pointer is const, this will temporarily discard the const and increment the
182 * usage count. The purpose of this is to attempt to catch at compile time the
183 * accidental alteration of a set of credentials that should be considered
184 * immutable.
185 */
186static inline const struct cred *get_cred(const struct cred *cred)
187{
188 return get_new_cred((struct cred *) cred);
189}
190
191/**
192 * put_cred - Release a reference to a set of credentials
193 * @cred: The credentials to release
194 *
195 * Release a reference to a set of credentials, deleting them when the last ref
196 * is released.
197 *
198 * This takes a const pointer to a set of credentials because the credentials
199 * on task_struct are attached by const pointers to prevent accidental
200 * alteration of otherwise immutable credential sets.
201 */
202static inline void put_cred(const struct cred *_cred)
203{
204 struct cred *cred = (struct cred *) _cred;
205
206 BUG_ON(atomic_read(&(cred)->usage) <= 0);
207 if (atomic_dec_and_test(&(cred)->usage))
208 __put_cred(cred);
209}
210
211/**
212 * current_cred - Access the current task's subjective credentials
213 *
214 * Access the subjective credentials of the current task.
215 */
216#define current_cred() \
217 (current->cred)
218
219/**
220 * __task_cred - Access a task's objective credentials
221 * @task: The task to query
222 *
223 * Access the objective credentials of a task. The caller must hold the RCU
224 * readlock.
225 *
226 * The caller must make sure task doesn't go away, either by holding a ref on
227 * task or by holding tasklist_lock to prevent it from being unlinked.
228 */
229#define __task_cred(task) \
230 ((const struct cred *)(rcu_dereference((task)->real_cred)))
231
232/**
233 * get_task_cred - Get another task's objective credentials
234 * @task: The task to query
235 *
236 * Get the objective credentials of a task, pinning them so that they can't go
237 * away. Accessing a task's credentials directly is not permitted.
238 *
239 * The caller must make sure task doesn't go away, either by holding a ref on
240 * task or by holding tasklist_lock to prevent it from being unlinked.
241 */
242#define get_task_cred(task) \
243({ \
244 struct cred *__cred; \
245 rcu_read_lock(); \
246 __cred = (struct cred *) __task_cred((task)); \
247 get_cred(__cred); \
248 rcu_read_unlock(); \
249 __cred; \
250})
251
252/**
253 * get_current_cred - Get the current task's subjective credentials
254 *
255 * Get the subjective credentials of the current task, pinning them so that
256 * they can't go away. Accessing the current task's credentials directly is
257 * not permitted.
258 */
259#define get_current_cred() \
260 (get_cred(current_cred()))
261
262/**
263 * get_current_user - Get the current task's user_struct
264 *
265 * Get the user record of the current task, pinning it so that it can't go
266 * away.
267 */
268#define get_current_user() \
269({ \
270 struct user_struct *__u; \
271 struct cred *__cred; \
272 __cred = (struct cred *) current_cred(); \
273 __u = get_uid(__cred->user); \
274 __u; \
275})
276
277/**
278 * get_current_groups - Get the current task's supplementary group list
279 *
280 * Get the supplementary group list of the current task, pinning it so that it
281 * can't go away.
282 */
283#define get_current_groups() \
284({ \
285 struct group_info *__groups; \
286 struct cred *__cred; \
287 __cred = (struct cred *) current_cred(); \
288 __groups = get_group_info(__cred->group_info); \
289 __groups; \
290})
291
292#define task_cred_xxx(task, xxx) \
293({ \
294 __typeof__(((struct cred *)NULL)->xxx) ___val; \
295 rcu_read_lock(); \
296 ___val = __task_cred((task))->xxx; \
297 rcu_read_unlock(); \
298 ___val; \
299})
300
301#define task_uid(task) (task_cred_xxx((task), uid))
302#define task_euid(task) (task_cred_xxx((task), euid))
303
304#define current_cred_xxx(xxx) \
305({ \
306 current->cred->xxx; \
307})
308
309#define current_uid() (current_cred_xxx(uid))
310#define current_gid() (current_cred_xxx(gid))
311#define current_euid() (current_cred_xxx(euid))
312#define current_egid() (current_cred_xxx(egid))
313#define current_suid() (current_cred_xxx(suid))
314#define current_sgid() (current_cred_xxx(sgid))
315#define current_fsuid() (current_cred_xxx(fsuid))
316#define current_fsgid() (current_cred_xxx(fsgid))
317#define current_cap() (current_cred_xxx(cap_effective))
318#define current_user() (current_cred_xxx(user))
319#define current_user_ns() (current_cred_xxx(user)->user_ns)
320#define current_security() (current_cred_xxx(security))
31 321
32#define current_uid_gid(_uid, _gid) \ 322#define current_uid_gid(_uid, _gid) \
33do { \ 323do { \
34 *(_uid) = current->uid; \ 324 const struct cred *__cred; \
35 *(_gid) = current->gid; \ 325 __cred = current_cred(); \
326 *(_uid) = __cred->uid; \
327 *(_gid) = __cred->gid; \
36} while(0) 328} while(0)
37 329
38#define current_euid_egid(_uid, _gid) \ 330#define current_euid_egid(_euid, _egid) \
39do { \ 331do { \
40 *(_uid) = current->euid; \ 332 const struct cred *__cred; \
41 *(_gid) = current->egid; \ 333 __cred = current_cred(); \
334 *(_euid) = __cred->euid; \
335 *(_egid) = __cred->egid; \
42} while(0) 336} while(0)
43 337
44#define current_fsuid_fsgid(_uid, _gid) \ 338#define current_fsuid_fsgid(_fsuid, _fsgid) \
45do { \ 339do { \
46 *(_uid) = current->fsuid; \ 340 const struct cred *__cred; \
47 *(_gid) = current->fsgid; \ 341 __cred = current_cred(); \
342 *(_fsuid) = __cred->fsuid; \
343 *(_fsgid) = __cred->fsgid; \
48} while(0) 344} while(0)
49 345
50#endif /* _LINUX_CRED_H */ 346#endif /* _LINUX_CRED_H */
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 3d2317e4af2e..3bacd71509fb 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -36,7 +36,8 @@
36#define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005 36#define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005
37#define CRYPTO_ALG_TYPE_GIVCIPHER 0x00000006 37#define CRYPTO_ALG_TYPE_GIVCIPHER 0x00000006
38#define CRYPTO_ALG_TYPE_DIGEST 0x00000008 38#define CRYPTO_ALG_TYPE_DIGEST 0x00000008
39#define CRYPTO_ALG_TYPE_HASH 0x00000009 39#define CRYPTO_ALG_TYPE_HASH 0x00000008
40#define CRYPTO_ALG_TYPE_SHASH 0x00000009
40#define CRYPTO_ALG_TYPE_AHASH 0x0000000a 41#define CRYPTO_ALG_TYPE_AHASH 0x0000000a
41#define CRYPTO_ALG_TYPE_RNG 0x0000000c 42#define CRYPTO_ALG_TYPE_RNG 0x0000000c
42 43
@@ -220,6 +221,7 @@ struct ablkcipher_alg {
220 221
221struct ahash_alg { 222struct ahash_alg {
222 int (*init)(struct ahash_request *req); 223 int (*init)(struct ahash_request *req);
224 int (*reinit)(struct ahash_request *req);
223 int (*update)(struct ahash_request *req); 225 int (*update)(struct ahash_request *req);
224 int (*final)(struct ahash_request *req); 226 int (*final)(struct ahash_request *req);
225 int (*digest)(struct ahash_request *req); 227 int (*digest)(struct ahash_request *req);
@@ -480,6 +482,8 @@ struct crypto_tfm {
480 struct compress_tfm compress; 482 struct compress_tfm compress;
481 struct rng_tfm rng; 483 struct rng_tfm rng;
482 } crt_u; 484 } crt_u;
485
486 void (*exit)(struct crypto_tfm *tfm);
483 487
484 struct crypto_alg *__crt_alg; 488 struct crypto_alg *__crt_alg;
485 489
@@ -544,7 +548,9 @@ struct crypto_attr_u32 {
544 * Transform user interface. 548 * Transform user interface.
545 */ 549 */
546 550
547struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, u32 tfm_flags); 551struct crypto_tfm *crypto_alloc_tfm(const char *alg_name,
552 const struct crypto_type *frontend,
553 u32 type, u32 mask);
548struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask); 554struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask);
549void crypto_free_tfm(struct crypto_tfm *tfm); 555void crypto_free_tfm(struct crypto_tfm *tfm);
550 556
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index a37359d0bad1..c66d22487bf8 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -75,14 +75,22 @@ full_name_hash(const unsigned char *name, unsigned int len)
75 return end_name_hash(hash); 75 return end_name_hash(hash);
76} 76}
77 77
78struct dcookie_struct; 78/*
79 79 * Try to keep struct dentry aligned on 64 byte cachelines (this will
80#define DNAME_INLINE_LEN_MIN 36 80 * give reasonable cacheline footprint with larger lines without the
81 * large memory footprint increase).
82 */
83#ifdef CONFIG_64BIT
84#define DNAME_INLINE_LEN_MIN 32 /* 192 bytes */
85#else
86#define DNAME_INLINE_LEN_MIN 40 /* 128 bytes */
87#endif
81 88
82struct dentry { 89struct dentry {
83 atomic_t d_count; 90 atomic_t d_count;
84 unsigned int d_flags; /* protected by d_lock */ 91 unsigned int d_flags; /* protected by d_lock */
85 spinlock_t d_lock; /* per dentry lock */ 92 spinlock_t d_lock; /* per dentry lock */
93 int d_mounted;
86 struct inode *d_inode; /* Where the name belongs to - NULL is 94 struct inode *d_inode; /* Where the name belongs to - NULL is
87 * negative */ 95 * negative */
88 /* 96 /*
@@ -107,10 +115,7 @@ struct dentry {
107 struct dentry_operations *d_op; 115 struct dentry_operations *d_op;
108 struct super_block *d_sb; /* The root of the dentry tree */ 116 struct super_block *d_sb; /* The root of the dentry tree */
109 void *d_fsdata; /* fs-specific data */ 117 void *d_fsdata; /* fs-specific data */
110#ifdef CONFIG_PROFILING 118
111 struct dcookie_struct *d_cookie; /* cookie, if any */
112#endif
113 int d_mounted;
114 unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */ 119 unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */
115}; 120};
116 121
@@ -177,6 +182,8 @@ d_iput: no no no yes
177 182
178#define DCACHE_INOTIFY_PARENT_WATCHED 0x0020 /* Parent inode is watched */ 183#define DCACHE_INOTIFY_PARENT_WATCHED 0x0020 /* Parent inode is watched */
179 184
185#define DCACHE_COOKIE 0x0040 /* For use by dcookie subsystem */
186
180extern spinlock_t dcache_lock; 187extern spinlock_t dcache_lock;
181extern seqlock_t rename_lock; 188extern seqlock_t rename_lock;
182 189
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h
new file mode 100644
index 000000000000..b0ef274e0031
--- /dev/null
+++ b/include/linux/dcbnl.h
@@ -0,0 +1,340 @@
1/*
2 * Copyright (c) 2008, Intel Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 *
17 * Author: Lucy Liu <lucy.liu@intel.com>
18 */
19
20#ifndef __LINUX_DCBNL_H__
21#define __LINUX_DCBNL_H__
22
23#define DCB_PROTO_VERSION 1
24
25struct dcbmsg {
26 unsigned char dcb_family;
27 __u8 cmd;
28 __u16 dcb_pad;
29};
30
31/**
32 * enum dcbnl_commands - supported DCB commands
33 *
34 * @DCB_CMD_UNDEFINED: unspecified command to catch errors
35 * @DCB_CMD_GSTATE: request the state of DCB in the device
36 * @DCB_CMD_SSTATE: set the state of DCB in the device
37 * @DCB_CMD_PGTX_GCFG: request the priority group configuration for Tx
38 * @DCB_CMD_PGTX_SCFG: set the priority group configuration for Tx
39 * @DCB_CMD_PGRX_GCFG: request the priority group configuration for Rx
40 * @DCB_CMD_PGRX_SCFG: set the priority group configuration for Rx
41 * @DCB_CMD_PFC_GCFG: request the priority flow control configuration
42 * @DCB_CMD_PFC_SCFG: set the priority flow control configuration
43 * @DCB_CMD_SET_ALL: apply all changes to the underlying device
44 * @DCB_CMD_GPERM_HWADDR: get the permanent MAC address of the underlying
45 * device. Only useful when using bonding.
46 * @DCB_CMD_GCAP: request the DCB capabilities of the device
47 * @DCB_CMD_GNUMTCS: get the number of traffic classes currently supported
48 * @DCB_CMD_SNUMTCS: set the number of traffic classes
49 * @DCB_CMD_GBCN: set backward congestion notification configuration
50 * @DCB_CMD_SBCN: get backward congestion notification configration.
51 */
52enum dcbnl_commands {
53 DCB_CMD_UNDEFINED,
54
55 DCB_CMD_GSTATE,
56 DCB_CMD_SSTATE,
57
58 DCB_CMD_PGTX_GCFG,
59 DCB_CMD_PGTX_SCFG,
60 DCB_CMD_PGRX_GCFG,
61 DCB_CMD_PGRX_SCFG,
62
63 DCB_CMD_PFC_GCFG,
64 DCB_CMD_PFC_SCFG,
65
66 DCB_CMD_SET_ALL,
67
68 DCB_CMD_GPERM_HWADDR,
69
70 DCB_CMD_GCAP,
71
72 DCB_CMD_GNUMTCS,
73 DCB_CMD_SNUMTCS,
74
75 DCB_CMD_PFC_GSTATE,
76 DCB_CMD_PFC_SSTATE,
77
78 DCB_CMD_BCN_GCFG,
79 DCB_CMD_BCN_SCFG,
80
81 __DCB_CMD_ENUM_MAX,
82 DCB_CMD_MAX = __DCB_CMD_ENUM_MAX - 1,
83};
84
85/**
86 * enum dcbnl_attrs - DCB top-level netlink attributes
87 *
88 * @DCB_ATTR_UNDEFINED: unspecified attribute to catch errors
89 * @DCB_ATTR_IFNAME: interface name of the underlying device (NLA_STRING)
90 * @DCB_ATTR_STATE: enable state of DCB in the device (NLA_U8)
91 * @DCB_ATTR_PFC_STATE: enable state of PFC in the device (NLA_U8)
92 * @DCB_ATTR_PFC_CFG: priority flow control configuration (NLA_NESTED)
93 * @DCB_ATTR_NUM_TC: number of traffic classes supported in the device (NLA_U8)
94 * @DCB_ATTR_PG_CFG: priority group configuration (NLA_NESTED)
95 * @DCB_ATTR_SET_ALL: bool to commit changes to hardware or not (NLA_U8)
96 * @DCB_ATTR_PERM_HWADDR: MAC address of the physical device (NLA_NESTED)
97 * @DCB_ATTR_CAP: DCB capabilities of the device (NLA_NESTED)
98 * @DCB_ATTR_NUMTCS: number of traffic classes supported (NLA_NESTED)
99 * @DCB_ATTR_BCN: backward congestion notification configuration (NLA_NESTED)
100 */
101enum dcbnl_attrs {
102 DCB_ATTR_UNDEFINED,
103
104 DCB_ATTR_IFNAME,
105 DCB_ATTR_STATE,
106 DCB_ATTR_PFC_STATE,
107 DCB_ATTR_PFC_CFG,
108 DCB_ATTR_NUM_TC,
109 DCB_ATTR_PG_CFG,
110 DCB_ATTR_SET_ALL,
111 DCB_ATTR_PERM_HWADDR,
112 DCB_ATTR_CAP,
113 DCB_ATTR_NUMTCS,
114 DCB_ATTR_BCN,
115
116 __DCB_ATTR_ENUM_MAX,
117 DCB_ATTR_MAX = __DCB_ATTR_ENUM_MAX - 1,
118};
119
120/**
121 * enum dcbnl_pfc_attrs - DCB Priority Flow Control user priority nested attrs
122 *
123 * @DCB_PFC_UP_ATTR_UNDEFINED: unspecified attribute to catch errors
124 * @DCB_PFC_UP_ATTR_0: Priority Flow Control value for User Priority 0 (NLA_U8)
125 * @DCB_PFC_UP_ATTR_1: Priority Flow Control value for User Priority 1 (NLA_U8)
126 * @DCB_PFC_UP_ATTR_2: Priority Flow Control value for User Priority 2 (NLA_U8)
127 * @DCB_PFC_UP_ATTR_3: Priority Flow Control value for User Priority 3 (NLA_U8)
128 * @DCB_PFC_UP_ATTR_4: Priority Flow Control value for User Priority 4 (NLA_U8)
129 * @DCB_PFC_UP_ATTR_5: Priority Flow Control value for User Priority 5 (NLA_U8)
130 * @DCB_PFC_UP_ATTR_6: Priority Flow Control value for User Priority 6 (NLA_U8)
131 * @DCB_PFC_UP_ATTR_7: Priority Flow Control value for User Priority 7 (NLA_U8)
132 * @DCB_PFC_UP_ATTR_MAX: highest attribute number currently defined
133 * @DCB_PFC_UP_ATTR_ALL: apply to all priority flow control attrs (NLA_FLAG)
134 *
135 */
136enum dcbnl_pfc_up_attrs {
137 DCB_PFC_UP_ATTR_UNDEFINED,
138
139 DCB_PFC_UP_ATTR_0,
140 DCB_PFC_UP_ATTR_1,
141 DCB_PFC_UP_ATTR_2,
142 DCB_PFC_UP_ATTR_3,
143 DCB_PFC_UP_ATTR_4,
144 DCB_PFC_UP_ATTR_5,
145 DCB_PFC_UP_ATTR_6,
146 DCB_PFC_UP_ATTR_7,
147 DCB_PFC_UP_ATTR_ALL,
148
149 __DCB_PFC_UP_ATTR_ENUM_MAX,
150 DCB_PFC_UP_ATTR_MAX = __DCB_PFC_UP_ATTR_ENUM_MAX - 1,
151};
152
153/**
154 * enum dcbnl_pg_attrs - DCB Priority Group attributes
155 *
156 * @DCB_PG_ATTR_UNDEFINED: unspecified attribute to catch errors
157 * @DCB_PG_ATTR_TC_0: Priority Group Traffic Class 0 configuration (NLA_NESTED)
158 * @DCB_PG_ATTR_TC_1: Priority Group Traffic Class 1 configuration (NLA_NESTED)
159 * @DCB_PG_ATTR_TC_2: Priority Group Traffic Class 2 configuration (NLA_NESTED)
160 * @DCB_PG_ATTR_TC_3: Priority Group Traffic Class 3 configuration (NLA_NESTED)
161 * @DCB_PG_ATTR_TC_4: Priority Group Traffic Class 4 configuration (NLA_NESTED)
162 * @DCB_PG_ATTR_TC_5: Priority Group Traffic Class 5 configuration (NLA_NESTED)
163 * @DCB_PG_ATTR_TC_6: Priority Group Traffic Class 6 configuration (NLA_NESTED)
164 * @DCB_PG_ATTR_TC_7: Priority Group Traffic Class 7 configuration (NLA_NESTED)
165 * @DCB_PG_ATTR_TC_MAX: highest attribute number currently defined
166 * @DCB_PG_ATTR_TC_ALL: apply to all traffic classes (NLA_NESTED)
167 * @DCB_PG_ATTR_BW_ID_0: Percent of link bandwidth for Priority Group 0 (NLA_U8)
168 * @DCB_PG_ATTR_BW_ID_1: Percent of link bandwidth for Priority Group 1 (NLA_U8)
169 * @DCB_PG_ATTR_BW_ID_2: Percent of link bandwidth for Priority Group 2 (NLA_U8)
170 * @DCB_PG_ATTR_BW_ID_3: Percent of link bandwidth for Priority Group 3 (NLA_U8)
171 * @DCB_PG_ATTR_BW_ID_4: Percent of link bandwidth for Priority Group 4 (NLA_U8)
172 * @DCB_PG_ATTR_BW_ID_5: Percent of link bandwidth for Priority Group 5 (NLA_U8)
173 * @DCB_PG_ATTR_BW_ID_6: Percent of link bandwidth for Priority Group 6 (NLA_U8)
174 * @DCB_PG_ATTR_BW_ID_7: Percent of link bandwidth for Priority Group 7 (NLA_U8)
175 * @DCB_PG_ATTR_BW_ID_MAX: highest attribute number currently defined
176 * @DCB_PG_ATTR_BW_ID_ALL: apply to all priority groups (NLA_FLAG)
177 *
178 */
179enum dcbnl_pg_attrs {
180 DCB_PG_ATTR_UNDEFINED,
181
182 DCB_PG_ATTR_TC_0,
183 DCB_PG_ATTR_TC_1,
184 DCB_PG_ATTR_TC_2,
185 DCB_PG_ATTR_TC_3,
186 DCB_PG_ATTR_TC_4,
187 DCB_PG_ATTR_TC_5,
188 DCB_PG_ATTR_TC_6,
189 DCB_PG_ATTR_TC_7,
190 DCB_PG_ATTR_TC_MAX,
191 DCB_PG_ATTR_TC_ALL,
192
193 DCB_PG_ATTR_BW_ID_0,
194 DCB_PG_ATTR_BW_ID_1,
195 DCB_PG_ATTR_BW_ID_2,
196 DCB_PG_ATTR_BW_ID_3,
197 DCB_PG_ATTR_BW_ID_4,
198 DCB_PG_ATTR_BW_ID_5,
199 DCB_PG_ATTR_BW_ID_6,
200 DCB_PG_ATTR_BW_ID_7,
201 DCB_PG_ATTR_BW_ID_MAX,
202 DCB_PG_ATTR_BW_ID_ALL,
203
204 __DCB_PG_ATTR_ENUM_MAX,
205 DCB_PG_ATTR_MAX = __DCB_PG_ATTR_ENUM_MAX - 1,
206};
207
208/**
209 * enum dcbnl_tc_attrs - DCB Traffic Class attributes
210 *
211 * @DCB_TC_ATTR_PARAM_UNDEFINED: unspecified attribute to catch errors
212 * @DCB_TC_ATTR_PARAM_PGID: (NLA_U8) Priority group the traffic class belongs to
213 * Valid values are: 0-7
214 * @DCB_TC_ATTR_PARAM_UP_MAPPING: (NLA_U8) Traffic class to user priority map
215 * Some devices may not support changing the
216 * user priority map of a TC.
217 * @DCB_TC_ATTR_PARAM_STRICT_PRIO: (NLA_U8) Strict priority setting
218 * 0 - none
219 * 1 - group strict
220 * 2 - link strict
221 * @DCB_TC_ATTR_PARAM_BW_PCT: optional - (NLA_U8) If supported by the device and
222 * not configured to use link strict priority,
223 * this is the percentage of bandwidth of the
224 * priority group this traffic class belongs to
225 * @DCB_TC_ATTR_PARAM_ALL: (NLA_FLAG) all traffic class parameters
226 *
227 */
228enum dcbnl_tc_attrs {
229 DCB_TC_ATTR_PARAM_UNDEFINED,
230
231 DCB_TC_ATTR_PARAM_PGID,
232 DCB_TC_ATTR_PARAM_UP_MAPPING,
233 DCB_TC_ATTR_PARAM_STRICT_PRIO,
234 DCB_TC_ATTR_PARAM_BW_PCT,
235 DCB_TC_ATTR_PARAM_ALL,
236
237 __DCB_TC_ATTR_PARAM_ENUM_MAX,
238 DCB_TC_ATTR_PARAM_MAX = __DCB_TC_ATTR_PARAM_ENUM_MAX - 1,
239};
240
241/**
242 * enum dcbnl_cap_attrs - DCB Capability attributes
243 *
244 * @DCB_CAP_ATTR_UNDEFINED: unspecified attribute to catch errors
245 * @DCB_CAP_ATTR_ALL: (NLA_FLAG) all capability parameters
246 * @DCB_CAP_ATTR_PG: (NLA_U8) device supports Priority Groups
247 * @DCB_CAP_ATTR_PFC: (NLA_U8) device supports Priority Flow Control
248 * @DCB_CAP_ATTR_UP2TC: (NLA_U8) device supports user priority to
249 * traffic class mapping
250 * @DCB_CAP_ATTR_PG_TCS: (NLA_U8) bitmap where each bit represents a
251 * number of traffic classes the device
252 * can be configured to use for Priority Groups
253 * @DCB_CAP_ATTR_PFC_TCS: (NLA_U8) bitmap where each bit represents a
254 * number of traffic classes the device can be
255 * configured to use for Priority Flow Control
256 * @DCB_CAP_ATTR_GSP: (NLA_U8) device supports group strict priority
257 * @DCB_CAP_ATTR_BCN: (NLA_U8) device supports Backwards Congestion
258 * Notification
259 */
260enum dcbnl_cap_attrs {
261 DCB_CAP_ATTR_UNDEFINED,
262 DCB_CAP_ATTR_ALL,
263 DCB_CAP_ATTR_PG,
264 DCB_CAP_ATTR_PFC,
265 DCB_CAP_ATTR_UP2TC,
266 DCB_CAP_ATTR_PG_TCS,
267 DCB_CAP_ATTR_PFC_TCS,
268 DCB_CAP_ATTR_GSP,
269 DCB_CAP_ATTR_BCN,
270
271 __DCB_CAP_ATTR_ENUM_MAX,
272 DCB_CAP_ATTR_MAX = __DCB_CAP_ATTR_ENUM_MAX - 1,
273};
274
275/**
276 * enum dcbnl_numtcs_attrs - number of traffic classes
277 *
278 * @DCB_NUMTCS_ATTR_UNDEFINED: unspecified attribute to catch errors
279 * @DCB_NUMTCS_ATTR_ALL: (NLA_FLAG) all traffic class attributes
280 * @DCB_NUMTCS_ATTR_PG: (NLA_U8) number of traffic classes used for
281 * priority groups
282 * @DCB_NUMTCS_ATTR_PFC: (NLA_U8) number of traffic classes which can
283 * support priority flow control
284 */
285enum dcbnl_numtcs_attrs {
286 DCB_NUMTCS_ATTR_UNDEFINED,
287 DCB_NUMTCS_ATTR_ALL,
288 DCB_NUMTCS_ATTR_PG,
289 DCB_NUMTCS_ATTR_PFC,
290
291 __DCB_NUMTCS_ATTR_ENUM_MAX,
292 DCB_NUMTCS_ATTR_MAX = __DCB_NUMTCS_ATTR_ENUM_MAX - 1,
293};
294
295enum dcbnl_bcn_attrs{
296 DCB_BCN_ATTR_UNDEFINED = 0,
297
298 DCB_BCN_ATTR_RP_0,
299 DCB_BCN_ATTR_RP_1,
300 DCB_BCN_ATTR_RP_2,
301 DCB_BCN_ATTR_RP_3,
302 DCB_BCN_ATTR_RP_4,
303 DCB_BCN_ATTR_RP_5,
304 DCB_BCN_ATTR_RP_6,
305 DCB_BCN_ATTR_RP_7,
306 DCB_BCN_ATTR_RP_ALL,
307
308 DCB_BCN_ATTR_BCNA_0,
309 DCB_BCN_ATTR_BCNA_1,
310 DCB_BCN_ATTR_ALPHA,
311 DCB_BCN_ATTR_BETA,
312 DCB_BCN_ATTR_GD,
313 DCB_BCN_ATTR_GI,
314 DCB_BCN_ATTR_TMAX,
315 DCB_BCN_ATTR_TD,
316 DCB_BCN_ATTR_RMIN,
317 DCB_BCN_ATTR_W,
318 DCB_BCN_ATTR_RD,
319 DCB_BCN_ATTR_RU,
320 DCB_BCN_ATTR_WRTT,
321 DCB_BCN_ATTR_RI,
322 DCB_BCN_ATTR_C,
323 DCB_BCN_ATTR_ALL,
324
325 __DCB_BCN_ATTR_ENUM_MAX,
326 DCB_BCN_ATTR_MAX = __DCB_BCN_ATTR_ENUM_MAX - 1,
327};
328
329/**
330 * enum dcb_general_attr_values - general DCB attribute values
331 *
332 * @DCB_ATTR_UNDEFINED: value used to indicate an attribute is not supported
333 *
334 */
335enum dcb_general_attr_values {
336 DCB_ATTR_VALUE_UNDEFINED = 0xff
337};
338
339
340#endif /* __LINUX_DCBNL_H__ */
diff --git a/include/linux/dccp.h b/include/linux/dccp.h
index 6080449fbec9..61734e27abb7 100644
--- a/include/linux/dccp.h
+++ b/include/linux/dccp.h
@@ -168,6 +168,8 @@ enum {
168 DCCPO_MIN_CCID_SPECIFIC = 128, 168 DCCPO_MIN_CCID_SPECIFIC = 128,
169 DCCPO_MAX_CCID_SPECIFIC = 255, 169 DCCPO_MAX_CCID_SPECIFIC = 255,
170}; 170};
171/* maximum size of a single TLV-encoded DCCP option (sans type/len bytes) */
172#define DCCP_SINGLE_OPT_MAXLEN 253
171 173
172/* DCCP CCIDS */ 174/* DCCP CCIDS */
173enum { 175enum {
@@ -176,29 +178,23 @@ enum {
176}; 178};
177 179
178/* DCCP features (RFC 4340 section 6.4) */ 180/* DCCP features (RFC 4340 section 6.4) */
179enum { 181enum dccp_feature_numbers {
180 DCCPF_RESERVED = 0, 182 DCCPF_RESERVED = 0,
181 DCCPF_CCID = 1, 183 DCCPF_CCID = 1,
182 DCCPF_SHORT_SEQNOS = 2, /* XXX: not yet implemented */ 184 DCCPF_SHORT_SEQNOS = 2,
183 DCCPF_SEQUENCE_WINDOW = 3, 185 DCCPF_SEQUENCE_WINDOW = 3,
184 DCCPF_ECN_INCAPABLE = 4, /* XXX: not yet implemented */ 186 DCCPF_ECN_INCAPABLE = 4,
185 DCCPF_ACK_RATIO = 5, 187 DCCPF_ACK_RATIO = 5,
186 DCCPF_SEND_ACK_VECTOR = 6, 188 DCCPF_SEND_ACK_VECTOR = 6,
187 DCCPF_SEND_NDP_COUNT = 7, 189 DCCPF_SEND_NDP_COUNT = 7,
188 DCCPF_MIN_CSUM_COVER = 8, 190 DCCPF_MIN_CSUM_COVER = 8,
189 DCCPF_DATA_CHECKSUM = 9, /* XXX: not yet implemented */ 191 DCCPF_DATA_CHECKSUM = 9,
190 /* 10-127 reserved */ 192 /* 10-127 reserved */
191 DCCPF_MIN_CCID_SPECIFIC = 128, 193 DCCPF_MIN_CCID_SPECIFIC = 128,
194 DCCPF_SEND_LEV_RATE = 192, /* RFC 4342, sec. 8.4 */
192 DCCPF_MAX_CCID_SPECIFIC = 255, 195 DCCPF_MAX_CCID_SPECIFIC = 255,
193}; 196};
194 197
195/* this structure is argument to DCCP_SOCKOPT_CHANGE_X */
196struct dccp_so_feat {
197 __u8 dccpsf_feat;
198 __u8 __user *dccpsf_val;
199 __u8 dccpsf_len;
200};
201
202/* DCCP socket options */ 198/* DCCP socket options */
203#define DCCP_SOCKOPT_PACKET_SIZE 1 /* XXX deprecated, without effect */ 199#define DCCP_SOCKOPT_PACKET_SIZE 1 /* XXX deprecated, without effect */
204#define DCCP_SOCKOPT_SERVICE 2 200#define DCCP_SOCKOPT_SERVICE 2
@@ -208,6 +204,10 @@ struct dccp_so_feat {
208#define DCCP_SOCKOPT_SERVER_TIMEWAIT 6 204#define DCCP_SOCKOPT_SERVER_TIMEWAIT 6
209#define DCCP_SOCKOPT_SEND_CSCOV 10 205#define DCCP_SOCKOPT_SEND_CSCOV 10
210#define DCCP_SOCKOPT_RECV_CSCOV 11 206#define DCCP_SOCKOPT_RECV_CSCOV 11
207#define DCCP_SOCKOPT_AVAILABLE_CCIDS 12
208#define DCCP_SOCKOPT_CCID 13
209#define DCCP_SOCKOPT_TX_CCID 14
210#define DCCP_SOCKOPT_RX_CCID 15
211#define DCCP_SOCKOPT_CCID_RX_INFO 128 211#define DCCP_SOCKOPT_CCID_RX_INFO 128
212#define DCCP_SOCKOPT_CCID_TX_INFO 192 212#define DCCP_SOCKOPT_CCID_TX_INFO 192
213 213
@@ -360,7 +360,6 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
360#define DCCPF_INITIAL_SEQUENCE_WINDOW 100 360#define DCCPF_INITIAL_SEQUENCE_WINDOW 100
361#define DCCPF_INITIAL_ACK_RATIO 2 361#define DCCPF_INITIAL_ACK_RATIO 2
362#define DCCPF_INITIAL_CCID DCCPC_CCID2 362#define DCCPF_INITIAL_CCID DCCPC_CCID2
363#define DCCPF_INITIAL_SEND_ACK_VECTOR 1
364/* FIXME: for now we're default to 1 but it should really be 0 */ 363/* FIXME: for now we're default to 1 but it should really be 0 */
365#define DCCPF_INITIAL_SEND_NDP_COUNT 1 364#define DCCPF_INITIAL_SEND_NDP_COUNT 1
366 365
@@ -370,20 +369,11 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
370 * Will be used to pass the state from dccp_request_sock to dccp_sock. 369 * Will be used to pass the state from dccp_request_sock to dccp_sock.
371 * 370 *
372 * @dccpms_sequence_window - Sequence Window Feature (section 7.5.2) 371 * @dccpms_sequence_window - Sequence Window Feature (section 7.5.2)
373 * @dccpms_ccid - Congestion Control Id (CCID) (section 10)
374 * @dccpms_send_ack_vector - Send Ack Vector Feature (section 11.5)
375 * @dccpms_send_ndp_count - Send NDP Count Feature (7.7.2)
376 * @dccpms_ack_ratio - Ack Ratio Feature (section 11.3)
377 * @dccpms_pending - List of features being negotiated 372 * @dccpms_pending - List of features being negotiated
378 * @dccpms_conf - 373 * @dccpms_conf -
379 */ 374 */
380struct dccp_minisock { 375struct dccp_minisock {
381 __u64 dccpms_sequence_window; 376 __u64 dccpms_sequence_window;
382 __u8 dccpms_rx_ccid;
383 __u8 dccpms_tx_ccid;
384 __u8 dccpms_send_ack_vector;
385 __u8 dccpms_send_ndp_count;
386 __u8 dccpms_ack_ratio;
387 struct list_head dccpms_pending; 377 struct list_head dccpms_pending;
388 struct list_head dccpms_conf; 378 struct list_head dccpms_conf;
389}; 379};
@@ -411,6 +401,7 @@ extern void dccp_minisock_init(struct dccp_minisock *dmsk);
411 * @dreq_iss: initial sequence number sent on the Response (RFC 4340, 7.1) 401 * @dreq_iss: initial sequence number sent on the Response (RFC 4340, 7.1)
412 * @dreq_isr: initial sequence number received on the Request 402 * @dreq_isr: initial sequence number received on the Request
413 * @dreq_service: service code present on the Request (there is just one) 403 * @dreq_service: service code present on the Request (there is just one)
404 * @dreq_featneg: feature negotiation options for this connection
414 * The following two fields are analogous to the ones in dccp_sock: 405 * The following two fields are analogous to the ones in dccp_sock:
415 * @dreq_timestamp_echo: last received timestamp to echo (13.1) 406 * @dreq_timestamp_echo: last received timestamp to echo (13.1)
416 * @dreq_timestamp_echo: the time of receiving the last @dreq_timestamp_echo 407 * @dreq_timestamp_echo: the time of receiving the last @dreq_timestamp_echo
@@ -420,6 +411,7 @@ struct dccp_request_sock {
420 __u64 dreq_iss; 411 __u64 dreq_iss;
421 __u64 dreq_isr; 412 __u64 dreq_isr;
422 __be32 dreq_service; 413 __be32 dreq_service;
414 struct list_head dreq_featneg;
423 __u32 dreq_timestamp_echo; 415 __u32 dreq_timestamp_echo;
424 __u32 dreq_timestamp_time; 416 __u32 dreq_timestamp_time;
425}; 417};
@@ -493,10 +485,12 @@ struct dccp_ackvec;
493 * @dccps_r_ack_ratio - feature-remote Ack Ratio 485 * @dccps_r_ack_ratio - feature-remote Ack Ratio
494 * @dccps_pcslen - sender partial checksum coverage (via sockopt) 486 * @dccps_pcslen - sender partial checksum coverage (via sockopt)
495 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt) 487 * @dccps_pcrlen - receiver partial checksum coverage (via sockopt)
488 * @dccps_send_ndp_count - local Send NDP Count feature (7.7.2)
496 * @dccps_ndp_count - number of Non Data Packets since last data packet 489 * @dccps_ndp_count - number of Non Data Packets since last data packet
497 * @dccps_mss_cache - current value of MSS (path MTU minus header sizes) 490 * @dccps_mss_cache - current value of MSS (path MTU minus header sizes)
498 * @dccps_rate_last - timestamp for rate-limiting DCCP-Sync (RFC 4340, 7.5.4) 491 * @dccps_rate_last - timestamp for rate-limiting DCCP-Sync (RFC 4340, 7.5.4)
499 * @dccps_minisock - associated minisock (accessed via dccp_msk) 492 * @dccps_minisock - associated minisock (accessed via dccp_msk)
493 * @dccps_featneg - tracks feature-negotiation state (mostly during handshake)
500 * @dccps_hc_rx_ackvec - rx half connection ack vector 494 * @dccps_hc_rx_ackvec - rx half connection ack vector
501 * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection) 495 * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection)
502 * @dccps_hc_tx_ccid - CCID used for the sender (or sending half-connection) 496 * @dccps_hc_tx_ccid - CCID used for the sender (or sending half-connection)
@@ -529,11 +523,13 @@ struct dccp_sock {
529 __u32 dccps_timestamp_time; 523 __u32 dccps_timestamp_time;
530 __u16 dccps_l_ack_ratio; 524 __u16 dccps_l_ack_ratio;
531 __u16 dccps_r_ack_ratio; 525 __u16 dccps_r_ack_ratio;
532 __u16 dccps_pcslen; 526 __u8 dccps_pcslen:4;
533 __u16 dccps_pcrlen; 527 __u8 dccps_pcrlen:4;
528 __u8 dccps_send_ndp_count:1;
534 __u64 dccps_ndp_count:48; 529 __u64 dccps_ndp_count:48;
535 unsigned long dccps_rate_last; 530 unsigned long dccps_rate_last;
536 struct dccp_minisock dccps_minisock; 531 struct dccp_minisock dccps_minisock;
532 struct list_head dccps_featneg;
537 struct dccp_ackvec *dccps_hc_rx_ackvec; 533 struct dccp_ackvec *dccps_hc_rx_ackvec;
538 struct ccid *dccps_hc_rx_ccid; 534 struct ccid *dccps_hc_rx_ccid;
539 struct ccid *dccps_hc_tx_ccid; 535 struct ccid *dccps_hc_tx_ccid;
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index e1a6c046cea3..23936b16426b 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -63,6 +63,8 @@ struct dentry *debugfs_create_x16(const char *name, mode_t mode,
63 struct dentry *parent, u16 *value); 63 struct dentry *parent, u16 *value);
64struct dentry *debugfs_create_x32(const char *name, mode_t mode, 64struct dentry *debugfs_create_x32(const char *name, mode_t mode,
65 struct dentry *parent, u32 *value); 65 struct dentry *parent, u32 *value);
66struct dentry *debugfs_create_size_t(const char *name, mode_t mode,
67 struct dentry *parent, size_t *value);
66struct dentry *debugfs_create_bool(const char *name, mode_t mode, 68struct dentry *debugfs_create_bool(const char *name, mode_t mode,
67 struct dentry *parent, u32 *value); 69 struct dentry *parent, u32 *value);
68 70
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index c17fd334e574..8209e08969f9 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -45,6 +45,8 @@ typedef void (*dm_dtr_fn) (struct dm_target *ti);
45 */ 45 */
46typedef int (*dm_map_fn) (struct dm_target *ti, struct bio *bio, 46typedef int (*dm_map_fn) (struct dm_target *ti, struct bio *bio,
47 union map_info *map_context); 47 union map_info *map_context);
48typedef int (*dm_map_request_fn) (struct dm_target *ti, struct request *clone,
49 union map_info *map_context);
48 50
49/* 51/*
50 * Returns: 52 * Returns:
@@ -57,6 +59,9 @@ typedef int (*dm_map_fn) (struct dm_target *ti, struct bio *bio,
57typedef int (*dm_endio_fn) (struct dm_target *ti, 59typedef int (*dm_endio_fn) (struct dm_target *ti,
58 struct bio *bio, int error, 60 struct bio *bio, int error,
59 union map_info *map_context); 61 union map_info *map_context);
62typedef int (*dm_request_endio_fn) (struct dm_target *ti,
63 struct request *clone, int error,
64 union map_info *map_context);
60 65
61typedef void (*dm_flush_fn) (struct dm_target *ti); 66typedef void (*dm_flush_fn) (struct dm_target *ti);
62typedef void (*dm_presuspend_fn) (struct dm_target *ti); 67typedef void (*dm_presuspend_fn) (struct dm_target *ti);
@@ -75,6 +80,13 @@ typedef int (*dm_ioctl_fn) (struct dm_target *ti, unsigned int cmd,
75typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm, 80typedef int (*dm_merge_fn) (struct dm_target *ti, struct bvec_merge_data *bvm,
76 struct bio_vec *biovec, int max_size); 81 struct bio_vec *biovec, int max_size);
77 82
83/*
84 * Returns:
85 * 0: The target can handle the next I/O immediately.
86 * 1: The target can't handle the next I/O immediately.
87 */
88typedef int (*dm_busy_fn) (struct dm_target *ti);
89
78void dm_error(const char *message); 90void dm_error(const char *message);
79 91
80/* 92/*
@@ -100,14 +112,23 @@ void dm_put_device(struct dm_target *ti, struct dm_dev *d);
100/* 112/*
101 * Information about a target type 113 * Information about a target type
102 */ 114 */
115
116/*
117 * Target features
118 */
119#define DM_TARGET_SUPPORTS_BARRIERS 0x00000001
120
103struct target_type { 121struct target_type {
122 uint64_t features;
104 const char *name; 123 const char *name;
105 struct module *module; 124 struct module *module;
106 unsigned version[3]; 125 unsigned version[3];
107 dm_ctr_fn ctr; 126 dm_ctr_fn ctr;
108 dm_dtr_fn dtr; 127 dm_dtr_fn dtr;
109 dm_map_fn map; 128 dm_map_fn map;
129 dm_map_request_fn map_rq;
110 dm_endio_fn end_io; 130 dm_endio_fn end_io;
131 dm_request_endio_fn rq_end_io;
111 dm_flush_fn flush; 132 dm_flush_fn flush;
112 dm_presuspend_fn presuspend; 133 dm_presuspend_fn presuspend;
113 dm_postsuspend_fn postsuspend; 134 dm_postsuspend_fn postsuspend;
@@ -117,6 +138,7 @@ struct target_type {
117 dm_message_fn message; 138 dm_message_fn message;
118 dm_ioctl_fn ioctl; 139 dm_ioctl_fn ioctl;
119 dm_merge_fn merge; 140 dm_merge_fn merge;
141 dm_busy_fn busy;
120}; 142};
121 143
122struct io_restrictions { 144struct io_restrictions {
@@ -157,8 +179,7 @@ struct dm_target {
157}; 179};
158 180
159int dm_register_target(struct target_type *t); 181int dm_register_target(struct target_type *t);
160int dm_unregister_target(struct target_type *t); 182void dm_unregister_target(struct target_type *t);
161
162 183
163/*----------------------------------------------------------------- 184/*-----------------------------------------------------------------
164 * Functions for creating and manipulating mapped devices. 185 * Functions for creating and manipulating mapped devices.
@@ -276,6 +297,9 @@ void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size);
276 *---------------------------------------------------------------*/ 297 *---------------------------------------------------------------*/
277#define DM_NAME "device-mapper" 298#define DM_NAME "device-mapper"
278 299
300#define DMCRIT(f, arg...) \
301 printk(KERN_CRIT DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
302
279#define DMERR(f, arg...) \ 303#define DMERR(f, arg...) \
280 printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg) 304 printk(KERN_ERR DM_NAME ": " DM_MSG_PREFIX ": " f "\n", ## arg)
281#define DMERR_LIMIT(f, arg...) \ 305#define DMERR_LIMIT(f, arg...) \
diff --git a/include/linux/device.h b/include/linux/device.h
index 1a3686d15f98..45e5b1921fbb 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -65,7 +65,7 @@ struct bus_type {
65 int (*resume_early)(struct device *dev); 65 int (*resume_early)(struct device *dev);
66 int (*resume)(struct device *dev); 66 int (*resume)(struct device *dev);
67 67
68 struct pm_ext_ops *pm; 68 struct dev_pm_ops *pm;
69 69
70 struct bus_type_private *p; 70 struct bus_type_private *p;
71}; 71};
@@ -133,7 +133,7 @@ struct device_driver {
133 int (*resume) (struct device *dev); 133 int (*resume) (struct device *dev);
134 struct attribute_group **groups; 134 struct attribute_group **groups;
135 135
136 struct pm_ops *pm; 136 struct dev_pm_ops *pm;
137 137
138 struct driver_private *p; 138 struct driver_private *p;
139}; 139};
@@ -198,7 +198,7 @@ struct class {
198 int (*suspend)(struct device *dev, pm_message_t state); 198 int (*suspend)(struct device *dev, pm_message_t state);
199 int (*resume)(struct device *dev); 199 int (*resume)(struct device *dev);
200 200
201 struct pm_ops *pm; 201 struct dev_pm_ops *pm;
202 struct class_private *p; 202 struct class_private *p;
203}; 203};
204 204
@@ -291,7 +291,7 @@ struct device_type {
291 int (*suspend)(struct device *dev, pm_message_t state); 291 int (*suspend)(struct device *dev, pm_message_t state);
292 int (*resume)(struct device *dev); 292 int (*resume)(struct device *dev);
293 293
294 struct pm_ops *pm; 294 struct dev_pm_ops *pm;
295}; 295};
296 296
297/* interface for exporting device attributes */ 297/* interface for exporting device attributes */
@@ -373,9 +373,9 @@ struct device {
373 373
374 struct kobject kobj; 374 struct kobject kobj;
375 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 375 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
376 unsigned uevent_suppress:1;
376 const char *init_name; /* initial name of the device */ 377 const char *init_name; /* initial name of the device */
377 struct device_type *type; 378 struct device_type *type;
378 unsigned uevent_suppress:1;
379 379
380 struct semaphore sem; /* semaphore to synchronize calls to 380 struct semaphore sem; /* semaphore to synchronize calls to
381 * its driver. 381 * its driver.
@@ -408,12 +408,13 @@ struct device {
408 /* arch specific additions */ 408 /* arch specific additions */
409 struct dev_archdata archdata; 409 struct dev_archdata archdata;
410 410
411 dev_t devt; /* dev_t, creates the sysfs "dev" */
412
411 spinlock_t devres_lock; 413 spinlock_t devres_lock;
412 struct list_head devres_head; 414 struct list_head devres_head;
413 415
414 struct klist_node knode_class; 416 struct klist_node knode_class;
415 struct class *class; 417 struct class *class;
416 dev_t devt; /* dev_t, creates the sysfs "dev" */
417 struct attribute_group **groups; /* optional groups */ 418 struct attribute_group **groups; /* optional groups */
418 419
419 void (*release)(struct device *dev); 420 void (*release)(struct device *dev);
@@ -483,6 +484,17 @@ extern int device_rename(struct device *dev, char *new_name);
483extern int device_move(struct device *dev, struct device *new_parent); 484extern int device_move(struct device *dev, struct device *new_parent);
484 485
485/* 486/*
487 * Root device objects for grouping under /sys/devices
488 */
489extern struct device *__root_device_register(const char *name,
490 struct module *owner);
491static inline struct device *root_device_register(const char *name)
492{
493 return __root_device_register(name, THIS_MODULE);
494}
495extern void root_device_unregister(struct device *root);
496
497/*
486 * Manual binding of a device to driver. See drivers/base/bus.c 498 * Manual binding of a device to driver. See drivers/base/bus.c
487 * for information on use. 499 * for information on use.
488 */ 500 */
@@ -553,13 +565,13 @@ extern const char *dev_driver_string(const struct device *dev);
553#define dev_info(dev, format, arg...) \ 565#define dev_info(dev, format, arg...) \
554 dev_printk(KERN_INFO , dev , format , ## arg) 566 dev_printk(KERN_INFO , dev , format , ## arg)
555 567
556#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG) 568#if defined(DEBUG)
569#define dev_dbg(dev, format, arg...) \
570 dev_printk(KERN_DEBUG , dev , format , ## arg)
571#elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
557#define dev_dbg(dev, format, ...) do { \ 572#define dev_dbg(dev, format, ...) do { \
558 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \ 573 dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
559 } while (0) 574 } while (0)
560#elif defined(DEBUG)
561#define dev_dbg(dev, format, arg...) \
562 dev_printk(KERN_DEBUG , dev , format , ## arg)
563#else 575#else
564#define dev_dbg(dev, format, arg...) \ 576#define dev_dbg(dev, format, arg...) \
565 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; }) 577 ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h
index 952df39c989d..af1dab41674b 100644
--- a/include/linux/dma_remapping.h
+++ b/include/linux/dma_remapping.h
@@ -9,148 +9,24 @@
9#define VTD_PAGE_MASK (((u64)-1) << VTD_PAGE_SHIFT) 9#define VTD_PAGE_MASK (((u64)-1) << VTD_PAGE_SHIFT)
10#define VTD_PAGE_ALIGN(addr) (((addr) + VTD_PAGE_SIZE - 1) & VTD_PAGE_MASK) 10#define VTD_PAGE_ALIGN(addr) (((addr) + VTD_PAGE_SIZE - 1) & VTD_PAGE_MASK)
11 11
12#define IOVA_PFN(addr) ((addr) >> PAGE_SHIFT)
13#define DMA_32BIT_PFN IOVA_PFN(DMA_32BIT_MASK)
14#define DMA_64BIT_PFN IOVA_PFN(DMA_64BIT_MASK)
15
16
17/*
18 * 0: Present
19 * 1-11: Reserved
20 * 12-63: Context Ptr (12 - (haw-1))
21 * 64-127: Reserved
22 */
23struct root_entry {
24 u64 val;
25 u64 rsvd1;
26};
27#define ROOT_ENTRY_NR (VTD_PAGE_SIZE/sizeof(struct root_entry))
28static inline bool root_present(struct root_entry *root)
29{
30 return (root->val & 1);
31}
32static inline void set_root_present(struct root_entry *root)
33{
34 root->val |= 1;
35}
36static inline void set_root_value(struct root_entry *root, unsigned long value)
37{
38 root->val |= value & VTD_PAGE_MASK;
39}
40
41struct context_entry;
42static inline struct context_entry *
43get_context_addr_from_root(struct root_entry *root)
44{
45 return (struct context_entry *)
46 (root_present(root)?phys_to_virt(
47 root->val & VTD_PAGE_MASK) :
48 NULL);
49}
50
51/*
52 * low 64 bits:
53 * 0: present
54 * 1: fault processing disable
55 * 2-3: translation type
56 * 12-63: address space root
57 * high 64 bits:
58 * 0-2: address width
59 * 3-6: aval
60 * 8-23: domain id
61 */
62struct context_entry {
63 u64 lo;
64 u64 hi;
65};
66#define context_present(c) ((c).lo & 1)
67#define context_fault_disable(c) (((c).lo >> 1) & 1)
68#define context_translation_type(c) (((c).lo >> 2) & 3)
69#define context_address_root(c) ((c).lo & VTD_PAGE_MASK)
70#define context_address_width(c) ((c).hi & 7)
71#define context_domain_id(c) (((c).hi >> 8) & ((1 << 16) - 1))
72
73#define context_set_present(c) do {(c).lo |= 1;} while (0)
74#define context_set_fault_enable(c) \
75 do {(c).lo &= (((u64)-1) << 2) | 1;} while (0)
76#define context_set_translation_type(c, val) \
77 do { \
78 (c).lo &= (((u64)-1) << 4) | 3; \
79 (c).lo |= ((val) & 3) << 2; \
80 } while (0)
81#define CONTEXT_TT_MULTI_LEVEL 0
82#define context_set_address_root(c, val) \
83 do {(c).lo |= (val) & VTD_PAGE_MASK; } while (0)
84#define context_set_address_width(c, val) do {(c).hi |= (val) & 7;} while (0)
85#define context_set_domain_id(c, val) \
86 do {(c).hi |= ((val) & ((1 << 16) - 1)) << 8;} while (0)
87#define context_clear_entry(c) do {(c).lo = 0; (c).hi = 0;} while (0)
88
89/*
90 * 0: readable
91 * 1: writable
92 * 2-6: reserved
93 * 7: super page
94 * 8-11: available
95 * 12-63: Host physcial address
96 */
97struct dma_pte {
98 u64 val;
99};
100#define dma_clear_pte(p) do {(p).val = 0;} while (0)
101
102#define DMA_PTE_READ (1) 12#define DMA_PTE_READ (1)
103#define DMA_PTE_WRITE (2) 13#define DMA_PTE_WRITE (2)
104 14
105#define dma_set_pte_readable(p) do {(p).val |= DMA_PTE_READ;} while (0)
106#define dma_set_pte_writable(p) do {(p).val |= DMA_PTE_WRITE;} while (0)
107#define dma_set_pte_prot(p, prot) \
108 do {(p).val = ((p).val & ~3) | ((prot) & 3); } while (0)
109#define dma_pte_addr(p) ((p).val & VTD_PAGE_MASK)
110#define dma_set_pte_addr(p, addr) do {\
111 (p).val |= ((addr) & VTD_PAGE_MASK); } while (0)
112#define dma_pte_present(p) (((p).val & 3) != 0)
113
114struct intel_iommu; 15struct intel_iommu;
16struct dmar_domain;
17struct root_entry;
115 18
116struct dmar_domain {
117 int id; /* domain id */
118 struct intel_iommu *iommu; /* back pointer to owning iommu */
119
120 struct list_head devices; /* all devices' list */
121 struct iova_domain iovad; /* iova's that belong to this domain */
122
123 struct dma_pte *pgd; /* virtual address */
124 spinlock_t mapping_lock; /* page table lock */
125 int gaw; /* max guest address width */
126
127 /* adjusted guest address width, 0 is level 2 30-bit */
128 int agaw;
129
130#define DOMAIN_FLAG_MULTIPLE_DEVICES 1
131 int flags;
132};
133
134/* PCI domain-device relationship */
135struct device_domain_info {
136 struct list_head link; /* link to domain siblings */
137 struct list_head global; /* link to global list */
138 u8 bus; /* PCI bus numer */
139 u8 devfn; /* PCI devfn number */
140 struct pci_dev *dev; /* it's NULL for PCIE-to-PCI bridge */
141 struct dmar_domain *domain; /* pointer to domain */
142};
143
144extern int init_dmars(void);
145extern void free_dmar_iommu(struct intel_iommu *iommu); 19extern void free_dmar_iommu(struct intel_iommu *iommu);
146 20
147extern int dmar_disabled; 21#ifdef CONFIG_DMAR
148 22extern int iommu_calculate_agaw(struct intel_iommu *iommu);
149#ifndef CONFIG_DMAR_GFX_WA 23#else
150static inline void iommu_prepare_gfx_mapping(void) 24static inline int iommu_calculate_agaw(struct intel_iommu *iommu)
151{ 25{
152 return; 26 return 0;
153} 27}
154#endif /* !CONFIG_DMAR_GFX_WA */ 28#endif
29
30extern int dmar_disabled;
155 31
156#endif 32#endif
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index adb0b084eb5a..64dea2ab326c 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -29,32 +29,6 @@
29#include <linux/dma-mapping.h> 29#include <linux/dma-mapping.h>
30 30
31/** 31/**
32 * enum dma_state - resource PNP/power management state
33 * @DMA_RESOURCE_SUSPEND: DMA device going into low power state
34 * @DMA_RESOURCE_RESUME: DMA device returning to full power
35 * @DMA_RESOURCE_AVAILABLE: DMA device available to the system
36 * @DMA_RESOURCE_REMOVED: DMA device removed from the system
37 */
38enum dma_state {
39 DMA_RESOURCE_SUSPEND,
40 DMA_RESOURCE_RESUME,
41 DMA_RESOURCE_AVAILABLE,
42 DMA_RESOURCE_REMOVED,
43};
44
45/**
46 * enum dma_state_client - state of the channel in the client
47 * @DMA_ACK: client would like to use, or was using this channel
48 * @DMA_DUP: client has already seen this channel, or is not using this channel
49 * @DMA_NAK: client does not want to see any more channels
50 */
51enum dma_state_client {
52 DMA_ACK,
53 DMA_DUP,
54 DMA_NAK,
55};
56
57/**
58 * typedef dma_cookie_t - an opaque DMA cookie 32 * typedef dma_cookie_t - an opaque DMA cookie
59 * 33 *
60 * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code 34 * if dma_cookie_t is >0 it's a DMA request cookie, <0 it's an error code
@@ -89,23 +63,13 @@ enum dma_transaction_type {
89 DMA_MEMSET, 63 DMA_MEMSET,
90 DMA_MEMCPY_CRC32C, 64 DMA_MEMCPY_CRC32C,
91 DMA_INTERRUPT, 65 DMA_INTERRUPT,
66 DMA_PRIVATE,
92 DMA_SLAVE, 67 DMA_SLAVE,
93}; 68};
94 69
95/* last transaction type for creation of the capabilities mask */ 70/* last transaction type for creation of the capabilities mask */
96#define DMA_TX_TYPE_END (DMA_SLAVE + 1) 71#define DMA_TX_TYPE_END (DMA_SLAVE + 1)
97 72
98/**
99 * enum dma_slave_width - DMA slave register access width.
100 * @DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses
101 * @DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses
102 * @DMA_SLAVE_WIDTH_32BIT: Do 32-bit slave register accesses
103 */
104enum dma_slave_width {
105 DMA_SLAVE_WIDTH_8BIT,
106 DMA_SLAVE_WIDTH_16BIT,
107 DMA_SLAVE_WIDTH_32BIT,
108};
109 73
110/** 74/**
111 * enum dma_ctrl_flags - DMA flags to augment operation preparation, 75 * enum dma_ctrl_flags - DMA flags to augment operation preparation,
@@ -132,32 +96,6 @@ enum dma_ctrl_flags {
132typedef struct { DECLARE_BITMAP(bits, DMA_TX_TYPE_END); } dma_cap_mask_t; 96typedef struct { DECLARE_BITMAP(bits, DMA_TX_TYPE_END); } dma_cap_mask_t;
133 97
134/** 98/**
135 * struct dma_slave - Information about a DMA slave
136 * @dev: device acting as DMA slave
137 * @dma_dev: required DMA master device. If non-NULL, the client can not be
138 * bound to other masters than this.
139 * @tx_reg: physical address of data register used for
140 * memory-to-peripheral transfers
141 * @rx_reg: physical address of data register used for
142 * peripheral-to-memory transfers
143 * @reg_width: peripheral register width
144 *
145 * If dma_dev is non-NULL, the client can not be bound to other DMA
146 * masters than the one corresponding to this device. The DMA master
147 * driver may use this to determine if there is controller-specific
148 * data wrapped around this struct. Drivers of platform code that sets
149 * the dma_dev field must therefore make sure to use an appropriate
150 * controller-specific dma slave structure wrapping this struct.
151 */
152struct dma_slave {
153 struct device *dev;
154 struct device *dma_dev;
155 dma_addr_t tx_reg;
156 dma_addr_t rx_reg;
157 enum dma_slave_width reg_width;
158};
159
160/**
161 * struct dma_chan_percpu - the per-CPU part of struct dma_chan 99 * struct dma_chan_percpu - the per-CPU part of struct dma_chan
162 * @refcount: local_t used for open-coded "bigref" counting 100 * @refcount: local_t used for open-coded "bigref" counting
163 * @memcpy_count: transaction counter 101 * @memcpy_count: transaction counter
@@ -165,7 +103,6 @@ struct dma_slave {
165 */ 103 */
166 104
167struct dma_chan_percpu { 105struct dma_chan_percpu {
168 local_t refcount;
169 /* stats */ 106 /* stats */
170 unsigned long memcpy_count; 107 unsigned long memcpy_count;
171 unsigned long bytes_transferred; 108 unsigned long bytes_transferred;
@@ -176,13 +113,14 @@ struct dma_chan_percpu {
176 * @device: ptr to the dma device who supplies this channel, always !%NULL 113 * @device: ptr to the dma device who supplies this channel, always !%NULL
177 * @cookie: last cookie value returned to client 114 * @cookie: last cookie value returned to client
178 * @chan_id: channel ID for sysfs 115 * @chan_id: channel ID for sysfs
179 * @class_dev: class device for sysfs 116 * @dev: class device for sysfs
180 * @refcount: kref, used in "bigref" slow-mode 117 * @refcount: kref, used in "bigref" slow-mode
181 * @slow_ref: indicates that the DMA channel is free 118 * @slow_ref: indicates that the DMA channel is free
182 * @rcu: the DMA channel's RCU head 119 * @rcu: the DMA channel's RCU head
183 * @device_node: used to add this to the device chan list 120 * @device_node: used to add this to the device chan list
184 * @local: per-cpu pointer to a struct dma_chan_percpu 121 * @local: per-cpu pointer to a struct dma_chan_percpu
185 * @client-count: how many clients are using this channel 122 * @client-count: how many clients are using this channel
123 * @table_count: number of appearances in the mem-to-mem allocation table
186 */ 124 */
187struct dma_chan { 125struct dma_chan {
188 struct dma_device *device; 126 struct dma_device *device;
@@ -190,73 +128,47 @@ struct dma_chan {
190 128
191 /* sysfs */ 129 /* sysfs */
192 int chan_id; 130 int chan_id;
193 struct device dev; 131 struct dma_chan_dev *dev;
194
195 struct kref refcount;
196 int slow_ref;
197 struct rcu_head rcu;
198 132
199 struct list_head device_node; 133 struct list_head device_node;
200 struct dma_chan_percpu *local; 134 struct dma_chan_percpu *local;
201 int client_count; 135 int client_count;
136 int table_count;
202}; 137};
203 138
204#define to_dma_chan(p) container_of(p, struct dma_chan, dev) 139/**
205 140 * struct dma_chan_dev - relate sysfs device node to backing channel device
206void dma_chan_cleanup(struct kref *kref); 141 * @chan - driver channel device
207 142 * @device - sysfs device
208static inline void dma_chan_get(struct dma_chan *chan) 143 * @dev_id - parent dma_device dev_id
209{ 144 * @idr_ref - reference count to gate release of dma_device dev_id
210 if (unlikely(chan->slow_ref)) 145 */
211 kref_get(&chan->refcount); 146struct dma_chan_dev {
212 else { 147 struct dma_chan *chan;
213 local_inc(&(per_cpu_ptr(chan->local, get_cpu())->refcount)); 148 struct device device;
214 put_cpu(); 149 int dev_id;
215 } 150 atomic_t *idr_ref;
216} 151};
217 152
218static inline void dma_chan_put(struct dma_chan *chan) 153static inline const char *dma_chan_name(struct dma_chan *chan)
219{ 154{
220 if (unlikely(chan->slow_ref)) 155 return dev_name(&chan->dev->device);
221 kref_put(&chan->refcount, dma_chan_cleanup);
222 else {
223 local_dec(&(per_cpu_ptr(chan->local, get_cpu())->refcount));
224 put_cpu();
225 }
226} 156}
227 157
228/* 158void dma_chan_cleanup(struct kref *kref);
229 * typedef dma_event_callback - function pointer to a DMA event callback
230 * For each channel added to the system this routine is called for each client.
231 * If the client would like to use the channel it returns '1' to signal (ack)
232 * the dmaengine core to take out a reference on the channel and its
233 * corresponding device. A client must not 'ack' an available channel more
234 * than once. When a channel is removed all clients are notified. If a client
235 * is using the channel it must 'ack' the removal. A client must not 'ack' a
236 * removed channel more than once.
237 * @client - 'this' pointer for the client context
238 * @chan - channel to be acted upon
239 * @state - available or removed
240 */
241struct dma_client;
242typedef enum dma_state_client (*dma_event_callback) (struct dma_client *client,
243 struct dma_chan *chan, enum dma_state state);
244 159
245/** 160/**
246 * struct dma_client - info on the entity making use of DMA services 161 * typedef dma_filter_fn - callback filter for dma_request_channel
247 * @event_callback: func ptr to call when something happens 162 * @chan: channel to be reviewed
248 * @cap_mask: only return channels that satisfy the requested capabilities 163 * @filter_param: opaque parameter passed through dma_request_channel
249 * a value of zero corresponds to any capability 164 *
250 * @slave: data for preparing slave transfer. Must be non-NULL iff the 165 * When this optional parameter is specified in a call to dma_request_channel a
251 * DMA_SLAVE capability is requested. 166 * suitable channel is passed to this routine for further dispositioning before
252 * @global_node: list_head for global dma_client_list 167 * being returned. Where 'suitable' indicates a non-busy channel that
168 * satisfies the given capability mask. It returns 'true' to indicate that the
169 * channel is suitable.
253 */ 170 */
254struct dma_client { 171typedef bool (*dma_filter_fn)(struct dma_chan *chan, void *filter_param);
255 dma_event_callback event_callback;
256 dma_cap_mask_t cap_mask;
257 struct dma_slave *slave;
258 struct list_head global_node;
259};
260 172
261typedef void (*dma_async_tx_callback)(void *dma_async_param); 173typedef void (*dma_async_tx_callback)(void *dma_async_param);
262/** 174/**
@@ -323,14 +235,10 @@ struct dma_device {
323 dma_cap_mask_t cap_mask; 235 dma_cap_mask_t cap_mask;
324 int max_xor; 236 int max_xor;
325 237
326 struct kref refcount;
327 struct completion done;
328
329 int dev_id; 238 int dev_id;
330 struct device *dev; 239 struct device *dev;
331 240
332 int (*device_alloc_chan_resources)(struct dma_chan *chan, 241 int (*device_alloc_chan_resources)(struct dma_chan *chan);
333 struct dma_client *client);
334 void (*device_free_chan_resources)(struct dma_chan *chan); 242 void (*device_free_chan_resources)(struct dma_chan *chan);
335 243
336 struct dma_async_tx_descriptor *(*device_prep_dma_memcpy)( 244 struct dma_async_tx_descriptor *(*device_prep_dma_memcpy)(
@@ -362,9 +270,8 @@ struct dma_device {
362 270
363/* --- public DMA engine API --- */ 271/* --- public DMA engine API --- */
364 272
365void dma_async_client_register(struct dma_client *client); 273void dmaengine_get(void);
366void dma_async_client_unregister(struct dma_client *client); 274void dmaengine_put(void);
367void dma_async_client_chan_request(struct dma_client *client);
368dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan, 275dma_cookie_t dma_async_memcpy_buf_to_buf(struct dma_chan *chan,
369 void *dest, void *src, size_t len); 276 void *dest, void *src, size_t len);
370dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan, 277dma_cookie_t dma_async_memcpy_buf_to_pg(struct dma_chan *chan,
@@ -406,6 +313,12 @@ __dma_cap_set(enum dma_transaction_type tx_type, dma_cap_mask_t *dstp)
406 set_bit(tx_type, dstp->bits); 313 set_bit(tx_type, dstp->bits);
407} 314}
408 315
316#define dma_cap_zero(mask) __dma_cap_zero(&(mask))
317static inline void __dma_cap_zero(dma_cap_mask_t *dstp)
318{
319 bitmap_zero(dstp->bits, DMA_TX_TYPE_END);
320}
321
409#define dma_has_cap(tx, mask) __dma_has_cap((tx), &(mask)) 322#define dma_has_cap(tx, mask) __dma_has_cap((tx), &(mask))
410static inline int 323static inline int
411__dma_has_cap(enum dma_transaction_type tx_type, dma_cap_mask_t *srcp) 324__dma_has_cap(enum dma_transaction_type tx_type, dma_cap_mask_t *srcp)
@@ -475,11 +388,25 @@ static inline enum dma_status dma_async_is_complete(dma_cookie_t cookie,
475} 388}
476 389
477enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie); 390enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie);
391#ifdef CONFIG_DMA_ENGINE
392enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
393#else
394static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
395{
396 return DMA_SUCCESS;
397}
398#endif
478 399
479/* --- DMA device --- */ 400/* --- DMA device --- */
480 401
481int dma_async_device_register(struct dma_device *device); 402int dma_async_device_register(struct dma_device *device);
482void dma_async_device_unregister(struct dma_device *device); 403void dma_async_device_unregister(struct dma_device *device);
404void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
405struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type);
406void dma_issue_pending_all(void);
407#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
408struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, void *fn_param);
409void dma_release_channel(struct dma_chan *chan);
483 410
484/* --- Helper iov-locking functions --- */ 411/* --- Helper iov-locking functions --- */
485 412
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index f1984fc3e06d..f28440784cf0 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -144,7 +144,6 @@ struct dmar_rmrr_unit {
144 list_for_each_entry(rmrr, &dmar_rmrr_units, list) 144 list_for_each_entry(rmrr, &dmar_rmrr_units, list)
145/* Intel DMAR initialization functions */ 145/* Intel DMAR initialization functions */
146extern int intel_iommu_init(void); 146extern int intel_iommu_init(void);
147extern int dmar_disabled;
148#else 147#else
149static inline int intel_iommu_init(void) 148static inline int intel_iommu_init(void)
150{ 149{
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index e5084eb5943a..34161907b2f8 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -44,8 +44,10 @@ extern const struct dmi_device * dmi_find_device(int type, const char *name,
44extern void dmi_scan_machine(void); 44extern void dmi_scan_machine(void);
45extern int dmi_get_year(int field); 45extern int dmi_get_year(int field);
46extern int dmi_name_in_vendors(const char *str); 46extern int dmi_name_in_vendors(const char *str);
47extern int dmi_name_in_serial(const char *str);
47extern int dmi_available; 48extern int dmi_available;
48extern int dmi_walk(void (*decode)(const struct dmi_header *)); 49extern int dmi_walk(void (*decode)(const struct dmi_header *));
50extern bool dmi_match(enum dmi_field f, const char *str);
49 51
50#else 52#else
51 53
@@ -56,9 +58,12 @@ static inline const struct dmi_device * dmi_find_device(int type, const char *na
56static inline void dmi_scan_machine(void) { return; } 58static inline void dmi_scan_machine(void) { return; }
57static inline int dmi_get_year(int year) { return 0; } 59static inline int dmi_get_year(int year) { return 0; }
58static inline int dmi_name_in_vendors(const char *s) { return 0; } 60static inline int dmi_name_in_vendors(const char *s) { return 0; }
61static inline int dmi_name_in_serial(const char *s) { return 0; }
59#define dmi_available 0 62#define dmi_available 0
60static inline int dmi_walk(void (*decode)(const struct dmi_header *)) 63static inline int dmi_walk(void (*decode)(const struct dmi_header *))
61 { return -1; } 64 { return -1; }
65static inline bool dmi_match(enum dmi_field f, const char *str)
66 { return false; }
62 67
63#endif 68#endif
64 69
diff --git a/include/linux/dqblk_qtree.h b/include/linux/dqblk_qtree.h
new file mode 100644
index 000000000000..82a16527b367
--- /dev/null
+++ b/include/linux/dqblk_qtree.h
@@ -0,0 +1,56 @@
1/*
2 * Definitions of structures and functions for quota formats using trie
3 */
4
5#ifndef _LINUX_DQBLK_QTREE_H
6#define _LINUX_DQBLK_QTREE_H
7
8#include <linux/types.h>
9
10/* Numbers of blocks needed for updates - we count with the smallest
11 * possible block size (1024) */
12#define QTREE_INIT_ALLOC 4
13#define QTREE_INIT_REWRITE 2
14#define QTREE_DEL_ALLOC 0
15#define QTREE_DEL_REWRITE 6
16
17struct dquot;
18
19/* Operations */
20struct qtree_fmt_operations {
21 void (*mem2disk_dqblk)(void *disk, struct dquot *dquot); /* Convert given entry from in memory format to disk one */
22 void (*disk2mem_dqblk)(struct dquot *dquot, void *disk); /* Convert given entry from disk format to in memory one */
23 int (*is_id)(void *disk, struct dquot *dquot); /* Is this structure for given id? */
24};
25
26/* Inmemory copy of version specific information */
27struct qtree_mem_dqinfo {
28 struct super_block *dqi_sb; /* Sb quota is on */
29 int dqi_type; /* Quota type */
30 unsigned int dqi_blocks; /* # of blocks in quota file */
31 unsigned int dqi_free_blk; /* First block in list of free blocks */
32 unsigned int dqi_free_entry; /* First block with free entry */
33 unsigned int dqi_blocksize_bits; /* Block size of quota file */
34 unsigned int dqi_entry_size; /* Size of quota entry in quota file */
35 unsigned int dqi_usable_bs; /* Space usable in block for quota data */
36 unsigned int dqi_qtree_depth; /* Precomputed depth of quota tree */
37 struct qtree_fmt_operations *dqi_ops; /* Operations for entry manipulation */
38};
39
40int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot);
41int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot);
42int qtree_delete_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot);
43int qtree_release_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot);
44int qtree_entry_unused(struct qtree_mem_dqinfo *info, char *disk);
45static inline int qtree_depth(struct qtree_mem_dqinfo *info)
46{
47 unsigned int epb = info->dqi_usable_bs >> 2;
48 unsigned long long entries = epb;
49 int i;
50
51 for (i = 1; entries < (1ULL << 32); i++)
52 entries *= epb;
53 return i;
54}
55
56#endif /* _LINUX_DQBLK_QTREE_H */
diff --git a/include/linux/dqblk_v1.h b/include/linux/dqblk_v1.h
index 57f1250d5a52..3713a7232dd8 100644
--- a/include/linux/dqblk_v1.h
+++ b/include/linux/dqblk_v1.h
@@ -5,9 +5,6 @@
5#ifndef _LINUX_DQBLK_V1_H 5#ifndef _LINUX_DQBLK_V1_H
6#define _LINUX_DQBLK_V1_H 6#define _LINUX_DQBLK_V1_H
7 7
8/* Id of quota format */
9#define QFMT_VFS_OLD 1
10
11/* Root squash turned on */ 8/* Root squash turned on */
12#define V1_DQF_RSQUASH 1 9#define V1_DQF_RSQUASH 1
13 10
@@ -17,8 +14,4 @@
17#define V1_DEL_ALLOC 0 14#define V1_DEL_ALLOC 0
18#define V1_DEL_REWRITE 2 15#define V1_DEL_REWRITE 2
19 16
20/* Special information about quotafile */
21struct v1_mem_dqinfo {
22};
23
24#endif /* _LINUX_DQBLK_V1_H */ 17#endif /* _LINUX_DQBLK_V1_H */
diff --git a/include/linux/dqblk_v2.h b/include/linux/dqblk_v2.h
index 4f853322cb7f..18000a542677 100644
--- a/include/linux/dqblk_v2.h
+++ b/include/linux/dqblk_v2.h
@@ -1,26 +1,16 @@
1/* 1/*
2 * Definitions of structures for vfsv0 quota format 2 * Definitions for vfsv0 quota format
3 */ 3 */
4 4
5#ifndef _LINUX_DQBLK_V2_H 5#ifndef _LINUX_DQBLK_V2_H
6#define _LINUX_DQBLK_V2_H 6#define _LINUX_DQBLK_V2_H
7 7
8#include <linux/types.h> 8#include <linux/dqblk_qtree.h>
9
10/* id numbers of quota format */
11#define QFMT_VFS_V0 2
12 9
13/* Numbers of blocks needed for updates */ 10/* Numbers of blocks needed for updates */
14#define V2_INIT_ALLOC 4 11#define V2_INIT_ALLOC QTREE_INIT_ALLOC
15#define V2_INIT_REWRITE 2 12#define V2_INIT_REWRITE QTREE_INIT_REWRITE
16#define V2_DEL_ALLOC 0 13#define V2_DEL_ALLOC QTREE_DEL_ALLOC
17#define V2_DEL_REWRITE 6 14#define V2_DEL_REWRITE QTREE_DEL_REWRITE
18
19/* Inmemory copy of version specific information */
20struct v2_mem_dqinfo {
21 unsigned int dqi_blocks;
22 unsigned int dqi_free_blk;
23 unsigned int dqi_free_entry;
24};
25 15
26#endif /* _LINUX_DQBLK_V2_H */ 16#endif /* _LINUX_DQBLK_V2_H */
diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
index 79a8ed8e6a7d..55026b1a40bd 100644
--- a/include/linux/dvb/frontend.h
+++ b/include/linux/dvb/frontend.h
@@ -62,10 +62,11 @@ typedef enum fe_caps {
62 FE_CAN_HIERARCHY_AUTO = 0x100000, 62 FE_CAN_HIERARCHY_AUTO = 0x100000,
63 FE_CAN_8VSB = 0x200000, 63 FE_CAN_8VSB = 0x200000,
64 FE_CAN_16VSB = 0x400000, 64 FE_CAN_16VSB = 0x400000,
65 FE_HAS_EXTENDED_CAPS = 0x800000, // We need more bitspace for newer APIs, indicate this. 65 FE_HAS_EXTENDED_CAPS = 0x800000, /* We need more bitspace for newer APIs, indicate this. */
66 FE_NEEDS_BENDING = 0x20000000, // not supported anymore, don't use (frontend requires frequency bending) 66 FE_CAN_2G_MODULATION = 0x10000000, /* frontend supports "2nd generation modulation" (DVB-S2) */
67 FE_CAN_RECOVER = 0x40000000, // frontend can recover from a cable unplug automatically 67 FE_NEEDS_BENDING = 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */
68 FE_CAN_MUTE_TS = 0x80000000 // frontend can stop spurious TS data output 68 FE_CAN_RECOVER = 0x40000000, /* frontend can recover from a cable unplug automatically */
69 FE_CAN_MUTE_TS = 0x80000000 /* frontend can stop spurious TS data output */
69} fe_caps_t; 70} fe_caps_t;
70 71
71 72
@@ -121,15 +122,15 @@ typedef enum fe_sec_mini_cmd {
121 122
122 123
123typedef enum fe_status { 124typedef enum fe_status {
124 FE_HAS_SIGNAL = 0x01, /* found something above the noise level */ 125 FE_HAS_SIGNAL = 0x01, /* found something above the noise level */
125 FE_HAS_CARRIER = 0x02, /* found a DVB signal */ 126 FE_HAS_CARRIER = 0x02, /* found a DVB signal */
126 FE_HAS_VITERBI = 0x04, /* FEC is stable */ 127 FE_HAS_VITERBI = 0x04, /* FEC is stable */
127 FE_HAS_SYNC = 0x08, /* found sync bytes */ 128 FE_HAS_SYNC = 0x08, /* found sync bytes */
128 FE_HAS_LOCK = 0x10, /* everything's working... */ 129 FE_HAS_LOCK = 0x10, /* everything's working... */
129 FE_TIMEDOUT = 0x20, /* no lock within the last ~2 seconds */ 130 FE_TIMEDOUT = 0x20, /* no lock within the last ~2 seconds */
130 FE_REINIT = 0x40 /* frontend was reinitialized, */ 131 FE_REINIT = 0x40 /* frontend was reinitialized, */
131} fe_status_t; /* application is recommended to reset */ 132} fe_status_t; /* application is recommended to reset */
132 /* DiSEqC, tone and parameters */ 133 /* DiSEqC, tone and parameters */
133 134
134typedef enum fe_spectral_inversion { 135typedef enum fe_spectral_inversion {
135 INVERSION_OFF, 136 INVERSION_OFF,
diff --git a/include/linux/dw_dmac.h b/include/linux/dw_dmac.h
index 04d217b442bf..d797dde247f7 100644
--- a/include/linux/dw_dmac.h
+++ b/include/linux/dw_dmac.h
@@ -22,14 +22,34 @@ struct dw_dma_platform_data {
22}; 22};
23 23
24/** 24/**
25 * enum dw_dma_slave_width - DMA slave register access width.
26 * @DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses
27 * @DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses
28 * @DMA_SLAVE_WIDTH_32BIT: Do 32-bit slave register accesses
29 */
30enum dw_dma_slave_width {
31 DW_DMA_SLAVE_WIDTH_8BIT,
32 DW_DMA_SLAVE_WIDTH_16BIT,
33 DW_DMA_SLAVE_WIDTH_32BIT,
34};
35
36/**
25 * struct dw_dma_slave - Controller-specific information about a slave 37 * struct dw_dma_slave - Controller-specific information about a slave
26 * @slave: Generic information about the slave 38 *
27 * @ctl_lo: Platform-specific initializer for the CTL_LO register 39 * @dma_dev: required DMA master device
40 * @tx_reg: physical address of data register used for
41 * memory-to-peripheral transfers
42 * @rx_reg: physical address of data register used for
43 * peripheral-to-memory transfers
44 * @reg_width: peripheral register width
28 * @cfg_hi: Platform-specific initializer for the CFG_HI register 45 * @cfg_hi: Platform-specific initializer for the CFG_HI register
29 * @cfg_lo: Platform-specific initializer for the CFG_LO register 46 * @cfg_lo: Platform-specific initializer for the CFG_LO register
30 */ 47 */
31struct dw_dma_slave { 48struct dw_dma_slave {
32 struct dma_slave slave; 49 struct device *dma_dev;
50 dma_addr_t tx_reg;
51 dma_addr_t rx_reg;
52 enum dw_dma_slave_width reg_width;
33 u32 cfg_hi; 53 u32 cfg_hi;
34 u32 cfg_lo; 54 u32 cfg_lo;
35}; 55};
@@ -54,9 +74,4 @@ struct dw_dma_slave {
54#define DWC_CFGL_HS_DST_POL (1 << 18) /* dst handshake active low */ 74#define DWC_CFGL_HS_DST_POL (1 << 18) /* dst handshake active low */
55#define DWC_CFGL_HS_SRC_POL (1 << 19) /* src handshake active low */ 75#define DWC_CFGL_HS_SRC_POL (1 << 19) /* src handshake active low */
56 76
57static inline struct dw_dma_slave *to_dw_dma_slave(struct dma_slave *slave)
58{
59 return container_of(slave, struct dw_dma_slave, slave);
60}
61
62#endif /* DW_DMAC_H */ 77#endif /* DW_DMAC_H */
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 92f6f634e3e6..7a204256b155 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -28,7 +28,7 @@ typedef void (elevator_activate_req_fn) (struct request_queue *, struct request
28typedef void (elevator_deactivate_req_fn) (struct request_queue *, struct request *); 28typedef void (elevator_deactivate_req_fn) (struct request_queue *, struct request *);
29 29
30typedef void *(elevator_init_fn) (struct request_queue *); 30typedef void *(elevator_init_fn) (struct request_queue *);
31typedef void (elevator_exit_fn) (elevator_t *); 31typedef void (elevator_exit_fn) (struct elevator_queue *);
32 32
33struct elevator_ops 33struct elevator_ops
34{ 34{
@@ -62,8 +62,8 @@ struct elevator_ops
62 62
63struct elv_fs_entry { 63struct elv_fs_entry {
64 struct attribute attr; 64 struct attribute attr;
65 ssize_t (*show)(elevator_t *, char *); 65 ssize_t (*show)(struct elevator_queue *, char *);
66 ssize_t (*store)(elevator_t *, const char *, size_t); 66 ssize_t (*store)(struct elevator_queue *, const char *, size_t);
67}; 67};
68 68
69/* 69/*
@@ -130,7 +130,7 @@ extern ssize_t elv_iosched_show(struct request_queue *, char *);
130extern ssize_t elv_iosched_store(struct request_queue *, const char *, size_t); 130extern ssize_t elv_iosched_store(struct request_queue *, const char *, size_t);
131 131
132extern int elevator_init(struct request_queue *, char *); 132extern int elevator_init(struct request_queue *, char *);
133extern void elevator_exit(elevator_t *); 133extern void elevator_exit(struct elevator_queue *);
134extern int elv_rq_merge_ok(struct request *, struct bio *); 134extern int elv_rq_merge_ok(struct request *, struct bio *);
135 135
136/* 136/*
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 25d62e6e3290..1cb0f0b90926 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -27,6 +27,7 @@
27#include <linux/if_ether.h> 27#include <linux/if_ether.h>
28#include <linux/netdevice.h> 28#include <linux/netdevice.h>
29#include <linux/random.h> 29#include <linux/random.h>
30#include <asm/unaligned.h>
30 31
31#ifdef __KERNEL__ 32#ifdef __KERNEL__
32extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); 33extern __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev);
@@ -41,6 +42,10 @@ extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh);
41extern void eth_header_cache_update(struct hh_cache *hh, 42extern void eth_header_cache_update(struct hh_cache *hh,
42 const struct net_device *dev, 43 const struct net_device *dev,
43 const unsigned char *haddr); 44 const unsigned char *haddr);
45extern int eth_mac_addr(struct net_device *dev, void *p);
46extern int eth_change_mtu(struct net_device *dev, int new_mtu);
47extern int eth_validate_addr(struct net_device *dev);
48
44 49
45 50
46extern struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count); 51extern struct net_device *alloc_etherdev_mq(int sizeof_priv, unsigned int queue_count);
@@ -136,6 +141,47 @@ static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
136 BUILD_BUG_ON(ETH_ALEN != 6); 141 BUILD_BUG_ON(ETH_ALEN != 6);
137 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0; 142 return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0;
138} 143}
144
145static inline unsigned long zap_last_2bytes(unsigned long value)
146{
147#ifdef __BIG_ENDIAN
148 return value >> 16;
149#else
150 return value << 16;
151#endif
152}
153
154/**
155 * compare_ether_addr_64bits - Compare two Ethernet addresses
156 * @addr1: Pointer to an array of 8 bytes
157 * @addr2: Pointer to an other array of 8 bytes
158 *
159 * Compare two ethernet addresses, returns 0 if equal.
160 * Same result than "memcmp(addr1, addr2, ETH_ALEN)" but without conditional
161 * branches, and possibly long word memory accesses on CPU allowing cheap
162 * unaligned memory reads.
163 * arrays = { byte1, byte2, byte3, byte4, byte6, byte7, pad1, pad2}
164 *
165 * Please note that alignment of addr1 & addr2 is only guaranted to be 16 bits.
166 */
167
168static inline unsigned compare_ether_addr_64bits(const u8 addr1[6+2],
169 const u8 addr2[6+2])
170{
171#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
172 unsigned long fold = ((*(unsigned long *)addr1) ^
173 (*(unsigned long *)addr2));
174
175 if (sizeof(fold) == 8)
176 return zap_last_2bytes(fold) != 0;
177
178 fold |= zap_last_2bytes((*(unsigned long *)(addr1 + 4)) ^
179 (*(unsigned long *)(addr2 + 4)));
180 return fold != 0;
181#else
182 return compare_ether_addr(addr1, addr2);
183#endif
184}
139#endif /* __KERNEL__ */ 185#endif /* __KERNEL__ */
140 186
141#endif /* _LINUX_ETHERDEVICE_H */ 187#endif /* _LINUX_ETHERDEVICE_H */
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index b4b038b89ee6..27c67a542235 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -467,6 +467,8 @@ struct ethtool_ops {
467 467
468#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */ 468#define ETHTOOL_GRXFH 0x00000029 /* Get RX flow hash configuration */
469#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */ 469#define ETHTOOL_SRXFH 0x0000002a /* Set RX flow hash configuration */
470#define ETHTOOL_GGRO 0x0000002b /* Get GRO enable (ethtool_value) */
471#define ETHTOOL_SGRO 0x0000002c /* Set GRO enable (ethtool_value) */
470 472
471/* compatibility with older code */ 473/* compatibility with older code */
472#define SPARC_ETH_GSET ETHTOOL_GSET 474#define SPARC_ETH_GSET ETHTOOL_GSET
diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h
index 78c775a83f7c..121720d74e15 100644
--- a/include/linux/ext2_fs.h
+++ b/include/linux/ext2_fs.h
@@ -194,6 +194,30 @@ struct ext2_group_desc
194#define EXT2_FL_USER_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */ 194#define EXT2_FL_USER_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */
195#define EXT2_FL_USER_MODIFIABLE FS_FL_USER_MODIFIABLE /* User modifiable flags */ 195#define EXT2_FL_USER_MODIFIABLE FS_FL_USER_MODIFIABLE /* User modifiable flags */
196 196
197/* Flags that should be inherited by new inodes from their parent. */
198#define EXT2_FL_INHERITED (EXT2_SECRM_FL | EXT2_UNRM_FL | EXT2_COMPR_FL |\
199 EXT2_SYNC_FL | EXT2_IMMUTABLE_FL | EXT2_APPEND_FL |\
200 EXT2_NODUMP_FL | EXT2_NOATIME_FL | EXT2_COMPRBLK_FL|\
201 EXT2_NOCOMP_FL | EXT2_JOURNAL_DATA_FL |\
202 EXT2_NOTAIL_FL | EXT2_DIRSYNC_FL)
203
204/* Flags that are appropriate for regular files (all but dir-specific ones). */
205#define EXT2_REG_FLMASK (~(EXT2_DIRSYNC_FL | EXT2_TOPDIR_FL))
206
207/* Flags that are appropriate for non-directories/regular files. */
208#define EXT2_OTHER_FLMASK (EXT2_NODUMP_FL | EXT2_NOATIME_FL)
209
210/* Mask out flags that are inappropriate for the given type of inode. */
211static inline __u32 ext2_mask_flags(umode_t mode, __u32 flags)
212{
213 if (S_ISDIR(mode))
214 return flags;
215 else if (S_ISREG(mode))
216 return flags & EXT2_REG_FLMASK;
217 else
218 return flags & EXT2_OTHER_FLMASK;
219}
220
197/* 221/*
198 * ioctl commands 222 * ioctl commands
199 */ 223 */
diff --git a/include/linux/ext2_fs_sb.h b/include/linux/ext2_fs_sb.h
index f273415ab6f1..1cdb66367c98 100644
--- a/include/linux/ext2_fs_sb.h
+++ b/include/linux/ext2_fs_sb.h
@@ -101,11 +101,17 @@ struct ext2_sb_info {
101 struct percpu_counter s_freeblocks_counter; 101 struct percpu_counter s_freeblocks_counter;
102 struct percpu_counter s_freeinodes_counter; 102 struct percpu_counter s_freeinodes_counter;
103 struct percpu_counter s_dirs_counter; 103 struct percpu_counter s_dirs_counter;
104 struct blockgroup_lock s_blockgroup_lock; 104 struct blockgroup_lock *s_blockgroup_lock;
105 /* root of the per fs reservation window tree */ 105 /* root of the per fs reservation window tree */
106 spinlock_t s_rsv_window_lock; 106 spinlock_t s_rsv_window_lock;
107 struct rb_root s_rsv_window_root; 107 struct rb_root s_rsv_window_root;
108 struct ext2_reserve_window_node s_rsv_window_head; 108 struct ext2_reserve_window_node s_rsv_window_head;
109}; 109};
110 110
111static inline spinlock_t *
112sb_bgl_lock(struct ext2_sb_info *sbi, unsigned int block_group)
113{
114 return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group);
115}
116
111#endif /* _LINUX_EXT2_FS_SB */ 117#endif /* _LINUX_EXT2_FS_SB */
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index d14f02918483..dd495b8c3091 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -178,6 +178,30 @@ struct ext3_group_desc
178#define EXT3_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */ 178#define EXT3_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
179#define EXT3_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */ 179#define EXT3_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
180 180
181/* Flags that should be inherited by new inodes from their parent. */
182#define EXT3_FL_INHERITED (EXT3_SECRM_FL | EXT3_UNRM_FL | EXT3_COMPR_FL |\
183 EXT3_SYNC_FL | EXT3_IMMUTABLE_FL | EXT3_APPEND_FL |\
184 EXT3_NODUMP_FL | EXT3_NOATIME_FL | EXT3_COMPRBLK_FL|\
185 EXT3_NOCOMPR_FL | EXT3_JOURNAL_DATA_FL |\
186 EXT3_NOTAIL_FL | EXT3_DIRSYNC_FL)
187
188/* Flags that are appropriate for regular files (all but dir-specific ones). */
189#define EXT3_REG_FLMASK (~(EXT3_DIRSYNC_FL | EXT3_TOPDIR_FL))
190
191/* Flags that are appropriate for non-directories/regular files. */
192#define EXT3_OTHER_FLMASK (EXT3_NODUMP_FL | EXT3_NOATIME_FL)
193
194/* Mask out flags that are inappropriate for the given type of inode. */
195static inline __u32 ext3_mask_flags(umode_t mode, __u32 flags)
196{
197 if (S_ISDIR(mode))
198 return flags;
199 else if (S_ISREG(mode))
200 return flags & EXT3_REG_FLMASK;
201 else
202 return flags & EXT3_OTHER_FLMASK;
203}
204
181/* 205/*
182 * Inode dynamic state flags 206 * Inode dynamic state flags
183 */ 207 */
@@ -354,6 +378,13 @@ struct ext3_inode {
354#define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */ 378#define EXT3_ORPHAN_FS 0x0004 /* Orphans being recovered */
355 379
356/* 380/*
381 * Misc. filesystem flags
382 */
383#define EXT2_FLAGS_SIGNED_HASH 0x0001 /* Signed dirhash in use */
384#define EXT2_FLAGS_UNSIGNED_HASH 0x0002 /* Unsigned dirhash in use */
385#define EXT2_FLAGS_TEST_FILESYS 0x0004 /* to test development code */
386
387/*
357 * Mount flags 388 * Mount flags
358 */ 389 */
359#define EXT3_MOUNT_CHECK 0x00001 /* Do mount-time checks */ 390#define EXT3_MOUNT_CHECK 0x00001 /* Do mount-time checks */
@@ -489,7 +520,23 @@ struct ext3_super_block {
489 __u16 s_reserved_word_pad; 520 __u16 s_reserved_word_pad;
490 __le32 s_default_mount_opts; 521 __le32 s_default_mount_opts;
491 __le32 s_first_meta_bg; /* First metablock block group */ 522 __le32 s_first_meta_bg; /* First metablock block group */
492 __u32 s_reserved[190]; /* Padding to the end of the block */ 523 __le32 s_mkfs_time; /* When the filesystem was created */
524 __le32 s_jnl_blocks[17]; /* Backup of the journal inode */
525 /* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
526/*150*/ __le32 s_blocks_count_hi; /* Blocks count */
527 __le32 s_r_blocks_count_hi; /* Reserved blocks count */
528 __le32 s_free_blocks_count_hi; /* Free blocks count */
529 __le16 s_min_extra_isize; /* All inodes have at least # bytes */
530 __le16 s_want_extra_isize; /* New inodes should reserve # bytes */
531 __le32 s_flags; /* Miscellaneous flags */
532 __le16 s_raid_stride; /* RAID stride */
533 __le16 s_mmp_interval; /* # seconds to wait in MMP checking */
534 __le64 s_mmp_block; /* Block for multi-mount protection */
535 __le32 s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
536 __u8 s_log_groups_per_flex; /* FLEX_BG group size */
537 __u8 s_reserved_char_pad2;
538 __le16 s_reserved_pad;
539 __u32 s_reserved[162]; /* Padding to the end of the block */
493}; 540};
494 541
495#ifdef __KERNEL__ 542#ifdef __KERNEL__
@@ -694,6 +741,9 @@ static inline __le16 ext3_rec_len_to_disk(unsigned len)
694#define DX_HASH_LEGACY 0 741#define DX_HASH_LEGACY 0
695#define DX_HASH_HALF_MD4 1 742#define DX_HASH_HALF_MD4 1
696#define DX_HASH_TEA 2 743#define DX_HASH_TEA 2
744#define DX_HASH_LEGACY_UNSIGNED 3
745#define DX_HASH_HALF_MD4_UNSIGNED 4
746#define DX_HASH_TEA_UNSIGNED 5
697 747
698#ifdef __KERNEL__ 748#ifdef __KERNEL__
699 749
diff --git a/include/linux/ext3_fs_sb.h b/include/linux/ext3_fs_sb.h
index b65f0288b842..f07f34de2f0e 100644
--- a/include/linux/ext3_fs_sb.h
+++ b/include/linux/ext3_fs_sb.h
@@ -57,10 +57,11 @@ struct ext3_sb_info {
57 u32 s_next_generation; 57 u32 s_next_generation;
58 u32 s_hash_seed[4]; 58 u32 s_hash_seed[4];
59 int s_def_hash_version; 59 int s_def_hash_version;
60 int s_hash_unsigned; /* 3 if hash should be signed, 0 if not */
60 struct percpu_counter s_freeblocks_counter; 61 struct percpu_counter s_freeblocks_counter;
61 struct percpu_counter s_freeinodes_counter; 62 struct percpu_counter s_freeinodes_counter;
62 struct percpu_counter s_dirs_counter; 63 struct percpu_counter s_dirs_counter;
63 struct blockgroup_lock s_blockgroup_lock; 64 struct blockgroup_lock *s_blockgroup_lock;
64 65
65 /* root of the per fs reservation window tree */ 66 /* root of the per fs reservation window tree */
66 spinlock_t s_rsv_window_lock; 67 spinlock_t s_rsv_window_lock;
@@ -83,4 +84,10 @@ struct ext3_sb_info {
83#endif 84#endif
84}; 85};
85 86
87static inline spinlock_t *
88sb_bgl_lock(struct ext3_sb_info *sbi, unsigned int block_group)
89{
90 return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group);
91}
92
86#endif /* _LINUX_EXT3_FS_SB */ 93#endif /* _LINUX_EXT3_FS_SB */
diff --git a/include/linux/fault-inject.h b/include/linux/fault-inject.h
index 32368c4f0326..06ca9b21dad2 100644
--- a/include/linux/fault-inject.h
+++ b/include/linux/fault-inject.h
@@ -81,4 +81,13 @@ static inline void cleanup_fault_attr_dentries(struct fault_attr *attr)
81 81
82#endif /* CONFIG_FAULT_INJECTION */ 82#endif /* CONFIG_FAULT_INJECTION */
83 83
84#ifdef CONFIG_FAILSLAB
85extern bool should_failslab(size_t size, gfp_t gfpflags);
86#else
87static inline bool should_failslab(size_t size, gfp_t gfpflags)
88{
89 return false;
90}
91#endif /* CONFIG_FAILSLAB */
92
84#endif /* _LINUX_FAULT_INJECT_H */ 93#endif /* _LINUX_FAULT_INJECT_H */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 75a81eaf3430..1ee63df5be92 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -888,7 +888,7 @@ struct fb_info {
888#define fb_writeq sbus_writeq 888#define fb_writeq sbus_writeq
889#define fb_memset sbus_memset_io 889#define fb_memset sbus_memset_io
890 890
891#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || (defined(__sh__) && !defined(__SH5__)) || defined(__powerpc__) || defined(__avr32__) 891#elif defined(__i386__) || defined(__alpha__) || defined(__x86_64__) || defined(__hppa__) || defined(__sh__) || defined(__powerpc__) || defined(__avr32__)
892 892
893#define fb_readb __raw_readb 893#define fb_readb __raw_readb
894#define fb_readw __raw_readw 894#define fb_readw __raw_readw
diff --git a/include/linux/fddidevice.h b/include/linux/fddidevice.h
index e61e42dfd317..155bafd9e886 100644
--- a/include/linux/fddidevice.h
+++ b/include/linux/fddidevice.h
@@ -27,6 +27,7 @@
27#ifdef __KERNEL__ 27#ifdef __KERNEL__
28extern __be16 fddi_type_trans(struct sk_buff *skb, 28extern __be16 fddi_type_trans(struct sk_buff *skb,
29 struct net_device *dev); 29 struct net_device *dev);
30extern int fddi_change_mtu(struct net_device *dev, int new_mtu);
30extern struct net_device *alloc_fddidev(int sizeof_priv); 31extern struct net_device *alloc_fddidev(int sizeof_priv);
31#endif 32#endif
32 33
diff --git a/include/linux/fdtable.h b/include/linux/fdtable.h
index 4aab6f12cfab..09d6c5bbdddd 100644
--- a/include/linux/fdtable.h
+++ b/include/linux/fdtable.h
@@ -57,8 +57,6 @@ struct files_struct {
57 57
58#define files_fdtable(files) (rcu_dereference((files)->fdt)) 58#define files_fdtable(files) (rcu_dereference((files)->fdt))
59 59
60extern struct kmem_cache *filp_cachep;
61
62struct file_operations; 60struct file_operations;
63struct vfsmount; 61struct vfsmount;
64struct dentry; 62struct dentry;
diff --git a/include/linux/filter.h b/include/linux/filter.h
index b6ea9aa9e853..1354aaf6abbe 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -122,7 +122,8 @@ struct sock_fprog /* Required for SO_ATTACH_FILTER. */
122#define SKF_AD_PKTTYPE 4 122#define SKF_AD_PKTTYPE 4
123#define SKF_AD_IFINDEX 8 123#define SKF_AD_IFINDEX 8
124#define SKF_AD_NLATTR 12 124#define SKF_AD_NLATTR 12
125#define SKF_AD_MAX 16 125#define SKF_AD_NLATTR_NEST 16
126#define SKF_AD_MAX 20
126#define SKF_NET_OFF (-0x100000) 127#define SKF_NET_OFF (-0x100000)
127#define SKF_LL_OFF (-0x200000) 128#define SKF_LL_OFF (-0x200000)
128 129
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4a853ef6fd35..6022f44043f2 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -21,7 +21,6 @@
21 21
22/* Fixed constants first: */ 22/* Fixed constants first: */
23#undef NR_OPEN 23#undef NR_OPEN
24extern int sysctl_nr_open;
25#define INR_OPEN 1024 /* Initial setting for nfile rlimits */ 24#define INR_OPEN 1024 /* Initial setting for nfile rlimits */
26 25
27#define BLOCK_SIZE_BITS 10 26#define BLOCK_SIZE_BITS 10
@@ -38,21 +37,13 @@ struct files_stat_struct {
38 int nr_free_files; /* read only */ 37 int nr_free_files; /* read only */
39 int max_files; /* tunable */ 38 int max_files; /* tunable */
40}; 39};
41extern struct files_stat_struct files_stat;
42extern int get_max_files(void);
43 40
44struct inodes_stat_t { 41struct inodes_stat_t {
45 int nr_inodes; 42 int nr_inodes;
46 int nr_unused; 43 int nr_unused;
47 int dummy[5]; /* padding for sysctl ABI compatibility */ 44 int dummy[5]; /* padding for sysctl ABI compatibility */
48}; 45};
49extern struct inodes_stat_t inodes_stat;
50 46
51extern int leases_enable, lease_break_time;
52
53#ifdef CONFIG_DNOTIFY
54extern int dir_notify_enable;
55#endif
56 47
57#define NR_FILE 8192 /* this can well be larger on a larger system */ 48#define NR_FILE 8192 /* this can well be larger on a larger system */
58 49
@@ -82,6 +73,14 @@ extern int dir_notify_enable;
82 (specialy hack for floppy.c) */ 73 (specialy hack for floppy.c) */
83#define FMODE_WRITE_IOCTL ((__force fmode_t)128) 74#define FMODE_WRITE_IOCTL ((__force fmode_t)128)
84 75
76/*
77 * Don't update ctime and mtime.
78 *
79 * Currently a special hack for the XFS open_by_handle ioctl, but we'll
80 * hopefully graduate it to a proper O_CMTIME flag supported by open(2) soon.
81 */
82#define FMODE_NOCMTIME ((__force fmode_t)2048)
83
85#define RW_MASK 1 84#define RW_MASK 1
86#define RWA_MASK 2 85#define RWA_MASK 2
87#define READ 0 86#define READ 0
@@ -235,6 +234,8 @@ extern int dir_notify_enable;
235#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ 234#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
236#define FIBMAP _IO(0x00,1) /* bmap access */ 235#define FIBMAP _IO(0x00,1) /* bmap access */
237#define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */ 236#define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */
237#define FIFREEZE _IOWR('X', 119, int) /* Freeze */
238#define FITHAW _IOWR('X', 120, int) /* Thaw */
238 239
239#define FS_IOC_GETFLAGS _IOR('f', 1, long) 240#define FS_IOC_GETFLAGS _IOR('f', 1, long)
240#define FS_IOC_SETFLAGS _IOW('f', 2, long) 241#define FS_IOC_SETFLAGS _IOW('f', 2, long)
@@ -316,11 +317,21 @@ struct poll_table_struct;
316struct kstatfs; 317struct kstatfs;
317struct vm_area_struct; 318struct vm_area_struct;
318struct vfsmount; 319struct vfsmount;
320struct cred;
319 321
320extern void __init inode_init(void); 322extern void __init inode_init(void);
321extern void __init inode_init_early(void); 323extern void __init inode_init_early(void);
322extern void __init files_init(unsigned long); 324extern void __init files_init(unsigned long);
323 325
326extern struct files_stat_struct files_stat;
327extern int get_max_files(void);
328extern int sysctl_nr_open;
329extern struct inodes_stat_t inodes_stat;
330extern int leases_enable, lease_break_time;
331#ifdef CONFIG_DNOTIFY
332extern int dir_notify_enable;
333#endif
334
324struct buffer_head; 335struct buffer_head;
325typedef int (get_block_t)(struct inode *inode, sector_t iblock, 336typedef int (get_block_t)(struct inode *inode, sector_t iblock,
326 struct buffer_head *bh_result, int create); 337 struct buffer_head *bh_result, int create);
@@ -414,6 +425,9 @@ enum positive_aop_returns {
414 425
415#define AOP_FLAG_UNINTERRUPTIBLE 0x0001 /* will not do a short write */ 426#define AOP_FLAG_UNINTERRUPTIBLE 0x0001 /* will not do a short write */
416#define AOP_FLAG_CONT_EXPAND 0x0002 /* called from cont_expand */ 427#define AOP_FLAG_CONT_EXPAND 0x0002 /* called from cont_expand */
428#define AOP_FLAG_NOFS 0x0004 /* used by filesystem to direct
429 * helper code (eg buffer layer)
430 * to clear GFP_FS from alloc */
417 431
418/* 432/*
419 * oh the beauties of C type declarations. 433 * oh the beauties of C type declarations.
@@ -553,6 +567,7 @@ struct address_space {
553struct block_device { 567struct block_device {
554 dev_t bd_dev; /* not a kdev_t - it's a search key */ 568 dev_t bd_dev; /* not a kdev_t - it's a search key */
555 struct inode * bd_inode; /* will die */ 569 struct inode * bd_inode; /* will die */
570 struct super_block * bd_super;
556 int bd_openers; 571 int bd_openers;
557 struct mutex bd_mutex; /* open/close mutex */ 572 struct mutex bd_mutex; /* open/close mutex */
558 struct semaphore bd_mount_sem; 573 struct semaphore bd_mount_sem;
@@ -578,6 +593,11 @@ struct block_device {
578 * care to not mess up bd_private for that case. 593 * care to not mess up bd_private for that case.
579 */ 594 */
580 unsigned long bd_private; 595 unsigned long bd_private;
596
597 /* The counter of freeze processes */
598 int bd_fsfreeze_count;
599 /* Mutex for freeze */
600 struct mutex bd_fsfreeze_mutex;
581}; 601};
582 602
583/* 603/*
@@ -827,7 +847,7 @@ struct file {
827 fmode_t f_mode; 847 fmode_t f_mode;
828 loff_t f_pos; 848 loff_t f_pos;
829 struct fown_struct f_owner; 849 struct fown_struct f_owner;
830 unsigned int f_uid, f_gid; 850 const struct cred *f_cred;
831 struct file_ra_state f_ra; 851 struct file_ra_state f_ra;
832 852
833 u64 f_version; 853 u64 f_version;
@@ -1121,7 +1141,6 @@ struct super_block {
1121 struct rw_semaphore s_umount; 1141 struct rw_semaphore s_umount;
1122 struct mutex s_lock; 1142 struct mutex s_lock;
1123 int s_count; 1143 int s_count;
1124 int s_syncing;
1125 int s_need_sync_fs; 1144 int s_need_sync_fs;
1126 atomic_t s_active; 1145 atomic_t s_active;
1127#ifdef CONFIG_SECURITY 1146#ifdef CONFIG_SECURITY
@@ -1173,6 +1192,11 @@ struct super_block {
1173 * generic_show_options() 1192 * generic_show_options()
1174 */ 1193 */
1175 char *s_options; 1194 char *s_options;
1195
1196 /*
1197 * storage for asynchronous operations
1198 */
1199 struct list_head s_async_list;
1176}; 1200};
1177 1201
1178extern struct timespec current_fs_time(struct super_block *sb); 1202extern struct timespec current_fs_time(struct super_block *sb);
@@ -1194,7 +1218,7 @@ enum {
1194#define has_fs_excl() atomic_read(&current->fs_excl) 1218#define has_fs_excl() atomic_read(&current->fs_excl)
1195 1219
1196#define is_owner_or_cap(inode) \ 1220#define is_owner_or_cap(inode) \
1197 ((current->fsuid == (inode)->i_uid) || capable(CAP_FOWNER)) 1221 ((current_fsuid() == (inode)->i_uid) || capable(CAP_FOWNER))
1198 1222
1199/* not quite ready to be deprecated, but... */ 1223/* not quite ready to be deprecated, but... */
1200extern void lock_super(struct super_block *); 1224extern void lock_super(struct super_block *);
@@ -1203,7 +1227,6 @@ extern void unlock_super(struct super_block *);
1203/* 1227/*
1204 * VFS helper functions.. 1228 * VFS helper functions..
1205 */ 1229 */
1206extern int vfs_permission(struct nameidata *, int);
1207extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); 1230extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *);
1208extern int vfs_mkdir(struct inode *, struct dentry *, int); 1231extern int vfs_mkdir(struct inode *, struct dentry *, int);
1209extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); 1232extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t);
@@ -1301,7 +1324,6 @@ struct file_operations {
1301 ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int); 1324 ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
1302 unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); 1325 unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
1303 int (*check_flags)(int); 1326 int (*check_flags)(int);
1304 int (*dir_notify)(struct file *filp, unsigned long arg);
1305 int (*flock) (struct file *, int, struct file_lock *); 1327 int (*flock) (struct file *, int, struct file_lock *);
1306 ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); 1328 ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
1307 ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); 1329 ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
@@ -1362,8 +1384,8 @@ struct super_operations {
1362 void (*put_super) (struct super_block *); 1384 void (*put_super) (struct super_block *);
1363 void (*write_super) (struct super_block *); 1385 void (*write_super) (struct super_block *);
1364 int (*sync_fs)(struct super_block *sb, int wait); 1386 int (*sync_fs)(struct super_block *sb, int wait);
1365 void (*write_super_lockfs) (struct super_block *); 1387 int (*freeze_fs) (struct super_block *);
1366 void (*unlockfs) (struct super_block *); 1388 int (*unfreeze_fs) (struct super_block *);
1367 int (*statfs) (struct dentry *, struct kstatfs *); 1389 int (*statfs) (struct dentry *, struct kstatfs *);
1368 int (*remount_fs) (struct super_block *, int *, char *); 1390 int (*remount_fs) (struct super_block *, int *, char *);
1369 void (*clear_inode) (struct inode *); 1391 void (*clear_inode) (struct inode *);
@@ -1375,6 +1397,7 @@ struct super_operations {
1375 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); 1397 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
1376 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 1398 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
1377#endif 1399#endif
1400 int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t);
1378}; 1401};
1379 1402
1380/* 1403/*
@@ -1674,7 +1697,8 @@ extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
1674extern long do_sys_open(int dfd, const char __user *filename, int flags, 1697extern long do_sys_open(int dfd, const char __user *filename, int flags,
1675 int mode); 1698 int mode);
1676extern struct file *filp_open(const char *, int, int); 1699extern struct file *filp_open(const char *, int, int);
1677extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); 1700extern struct file * dentry_open(struct dentry *, struct vfsmount *, int,
1701 const struct cred *);
1678extern int filp_close(struct file *, fl_owner_t id); 1702extern int filp_close(struct file *, fl_owner_t id);
1679extern char * getname(const char __user *); 1703extern char * getname(const char __user *);
1680 1704
@@ -1819,7 +1843,7 @@ extern int __filemap_fdatawrite_range(struct address_space *mapping,
1819extern int filemap_fdatawrite_range(struct address_space *mapping, 1843extern int filemap_fdatawrite_range(struct address_space *mapping,
1820 loff_t start, loff_t end); 1844 loff_t start, loff_t end);
1821 1845
1822extern long do_fsync(struct file *file, int datasync); 1846extern int vfs_fsync(struct file *file, struct dentry *dentry, int datasync);
1823extern void sync_supers(void); 1847extern void sync_supers(void);
1824extern void sync_filesystems(int wait); 1848extern void sync_filesystems(int wait);
1825extern void __fsync_super(struct super_block *sb); 1849extern void __fsync_super(struct super_block *sb);
@@ -1859,7 +1883,7 @@ extern void free_write_pipe(struct file *);
1859 1883
1860extern struct file *do_filp_open(int dfd, const char *pathname, 1884extern struct file *do_filp_open(int dfd, const char *pathname,
1861 int open_flag, int mode); 1885 int open_flag, int mode);
1862extern int may_open(struct nameidata *, int, int); 1886extern int may_open(struct path *, int, int);
1863 1887
1864extern int kernel_read(struct file *, unsigned long, char *, unsigned long); 1888extern int kernel_read(struct file *, unsigned long, char *, unsigned long);
1865extern struct file * open_exec(const char *); 1889extern struct file * open_exec(const char *);
@@ -1875,7 +1899,9 @@ extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
1875 1899
1876extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin); 1900extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin);
1877 1901
1902extern struct inode * inode_init_always(struct super_block *, struct inode *);
1878extern void inode_init_once(struct inode *); 1903extern void inode_init_once(struct inode *);
1904extern void inode_add_to_lists(struct super_block *, struct inode *);
1879extern void iput(struct inode *); 1905extern void iput(struct inode *);
1880extern struct inode * igrab(struct inode *); 1906extern struct inode * igrab(struct inode *);
1881extern ino_t iunique(struct super_block *, ino_t); 1907extern ino_t iunique(struct super_block *, ino_t);
@@ -1892,6 +1918,8 @@ extern struct inode *ilookup(struct super_block *sb, unsigned long ino);
1892 1918
1893extern struct inode * iget5_locked(struct super_block *, unsigned long, int (*test)(struct inode *, void *), int (*set)(struct inode *, void *), void *); 1919extern struct inode * iget5_locked(struct super_block *, unsigned long, int (*test)(struct inode *, void *), int (*set)(struct inode *, void *), void *);
1894extern struct inode * iget_locked(struct super_block *, unsigned long); 1920extern struct inode * iget_locked(struct super_block *, unsigned long);
1921extern int insert_inode_locked4(struct inode *, unsigned long, int (*test)(struct inode *, void *), void *);
1922extern int insert_inode_locked(struct inode *);
1895extern void unlock_new_inode(struct inode *); 1923extern void unlock_new_inode(struct inode *);
1896 1924
1897extern void __iget(struct inode * inode); 1925extern void __iget(struct inode * inode);
@@ -2023,7 +2051,7 @@ extern int page_readlink(struct dentry *, char __user *, int);
2023extern void *page_follow_link_light(struct dentry *, struct nameidata *); 2051extern void *page_follow_link_light(struct dentry *, struct nameidata *);
2024extern void page_put_link(struct dentry *, struct nameidata *, void *); 2052extern void page_put_link(struct dentry *, struct nameidata *, void *);
2025extern int __page_symlink(struct inode *inode, const char *symname, int len, 2053extern int __page_symlink(struct inode *inode, const char *symname, int len,
2026 gfp_t gfp_mask); 2054 int nofs);
2027extern int page_symlink(struct inode *inode, const char *symname, int len); 2055extern int page_symlink(struct inode *inode, const char *symname, int len);
2028extern const struct inode_operations page_symlink_inode_operations; 2056extern const struct inode_operations page_symlink_inode_operations;
2029extern int generic_readlink(struct dentry *, char __user *, int); 2057extern int generic_readlink(struct dentry *, char __user *, int);
@@ -2044,6 +2072,9 @@ extern int vfs_fstat(unsigned int, struct kstat *);
2044 2072
2045extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, 2073extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
2046 unsigned long arg); 2074 unsigned long arg);
2075extern int __generic_block_fiemap(struct inode *inode,
2076 struct fiemap_extent_info *fieinfo, u64 start,
2077 u64 len, get_block_t *get_block);
2047extern int generic_block_fiemap(struct inode *inode, 2078extern int generic_block_fiemap(struct inode *inode,
2048 struct fiemap_extent_info *fieinfo, u64 start, 2079 struct fiemap_extent_info *fieinfo, u64 start,
2049 u64 len, get_block_t *get_block); 2080 u64 len, get_block_t *get_block);
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index 9e5a06e78d02..a97c053d3a9a 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -10,12 +10,6 @@ struct fs_struct {
10 struct path root, pwd; 10 struct path root, pwd;
11}; 11};
12 12
13#define INIT_FS { \
14 .count = ATOMIC_INIT(1), \
15 .lock = RW_LOCK_UNLOCKED, \
16 .umask = 0022, \
17}
18
19extern struct kmem_cache *fs_cachep; 13extern struct kmem_cache *fs_cachep;
20 14
21extern void exit_fs(struct task_struct *); 15extern void exit_fs(struct task_struct *);
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 708bab58d8d0..d9051d717d27 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -47,12 +47,7 @@
47struct gianfar_platform_data { 47struct gianfar_platform_data {
48 /* device specific information */ 48 /* device specific information */
49 u32 device_flags; 49 u32 device_flags;
50 /* board specific information */ 50 char bus_id[BUS_ID_SIZE];
51 u32 board_flags;
52 int mdio_bus; /* Bus controlled by us */
53 char bus_id[MII_BUS_ID_SIZE]; /* Bus PHY is on */
54 u32 phy_id;
55 u8 mac_addr[6];
56 phy_interface_t interface; 51 phy_interface_t interface;
57}; 52};
58 53
@@ -61,17 +56,6 @@ struct gianfar_mdio_data {
61 int irq[32]; 56 int irq[32];
62}; 57};
63 58
64/* Flags related to gianfar device features */
65#define FSL_GIANFAR_DEV_HAS_GIGABIT 0x00000001
66#define FSL_GIANFAR_DEV_HAS_COALESCE 0x00000002
67#define FSL_GIANFAR_DEV_HAS_RMON 0x00000004
68#define FSL_GIANFAR_DEV_HAS_MULTI_INTR 0x00000008
69#define FSL_GIANFAR_DEV_HAS_CSUM 0x00000010
70#define FSL_GIANFAR_DEV_HAS_VLAN 0x00000020
71#define FSL_GIANFAR_DEV_HAS_EXTENDED_HASH 0x00000040
72#define FSL_GIANFAR_DEV_HAS_PADDING 0x00000080
73#define FSL_GIANFAR_DEV_HAS_MAGIC_PACKET 0x00000100
74
75/* Flags in gianfar_platform_data */ 59/* Flags in gianfar_platform_data */
76#define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* set or use a timer */ 60#define FSL_GIANFAR_BRD_HAS_PHY_INTR 0x00000001 /* set or use a timer */
77#define FSL_GIANFAR_BRD_IS_REDUCED 0x00000002 /* Set if RGMII, RMII */ 61#define FSL_GIANFAR_BRD_IS_REDUCED 0x00000002 /* Set if RGMII, RMII */
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 985b28dc2ba9..677432b9cb7e 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -87,6 +87,14 @@ static inline void ftrace_stop(void) { }
87static inline void ftrace_start(void) { } 87static inline void ftrace_start(void) { }
88#endif /* CONFIG_FUNCTION_TRACER */ 88#endif /* CONFIG_FUNCTION_TRACER */
89 89
90#ifdef CONFIG_STACK_TRACER
91extern int stack_tracer_enabled;
92int
93stack_trace_sysctl(struct ctl_table *table, int write,
94 struct file *file, void __user *buffer, size_t *lenp,
95 loff_t *ppos);
96#endif
97
90#ifdef CONFIG_DYNAMIC_FTRACE 98#ifdef CONFIG_DYNAMIC_FTRACE
91/* asm/ftrace.h must be defined for archs supporting dynamic ftrace */ 99/* asm/ftrace.h must be defined for archs supporting dynamic ftrace */
92#include <asm/ftrace.h> 100#include <asm/ftrace.h>
@@ -295,7 +303,7 @@ extern void ftrace_dump(void);
295static inline void 303static inline void
296ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { } 304ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
297static inline int 305static inline int
298ftrace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 0))); 306ftrace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
299 307
300static inline void tracing_start(void) { } 308static inline void tracing_start(void) { }
301static inline void tracing_stop(void) { } 309static inline void tracing_stop(void) { }
@@ -378,6 +386,16 @@ struct ftrace_graph_ret {
378 */ 386 */
379#define __notrace_funcgraph notrace 387#define __notrace_funcgraph notrace
380 388
389/*
390 * We want to which function is an entrypoint of a hardirq.
391 * That will help us to put a signal on output.
392 */
393#define __irq_entry __attribute__((__section__(".irqentry.text")))
394
395/* Limits of hardirq entrypoints */
396extern char __irqentry_text_start[];
397extern char __irqentry_text_end[];
398
381#define FTRACE_RETFUNC_DEPTH 50 399#define FTRACE_RETFUNC_DEPTH 50
382#define FTRACE_RETSTACK_ALLOC_SIZE 32 400#define FTRACE_RETSTACK_ALLOC_SIZE 32
383/* Type of the callback handlers for tracing function graph*/ 401/* Type of the callback handlers for tracing function graph*/
@@ -415,6 +433,7 @@ static inline void unpause_graph_tracing(void)
415#else 433#else
416 434
417#define __notrace_funcgraph 435#define __notrace_funcgraph
436#define __irq_entry
418 437
419static inline void ftrace_graph_init_task(struct task_struct *t) { } 438static inline void ftrace_graph_init_task(struct task_struct *t) { }
420static inline void ftrace_graph_exit_task(struct task_struct *t) { } 439static inline void ftrace_graph_exit_task(struct task_struct *t) { }
diff --git a/include/linux/fuse.h b/include/linux/fuse.h
index 350fe9767bbc..162e5defe683 100644
--- a/include/linux/fuse.h
+++ b/include/linux/fuse.h
@@ -1,6 +1,6 @@
1/* 1/*
2 FUSE: Filesystem in Userspace 2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu> 3 Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu>
4 4
5 This program can be distributed under the terms of the GNU GPL. 5 This program can be distributed under the terms of the GNU GPL.
6 See the file COPYING. 6 See the file COPYING.
@@ -20,29 +20,27 @@
20 * 20 *
21 * 7.10 21 * 7.10
22 * - add nonseekable open flag 22 * - add nonseekable open flag
23 *
24 * 7.11
25 * - add IOCTL message
26 * - add unsolicited notification support
27 * - add POLL message and NOTIFY_POLL notification
23 */ 28 */
24 29
25#ifndef _LINUX_FUSE_H 30#ifndef _LINUX_FUSE_H
26#define _LINUX_FUSE_H 31#define _LINUX_FUSE_H
27 32
28#include <asm/types.h> 33#include <linux/types.h>
29#include <linux/major.h>
30 34
31/** Version number of this interface */ 35/** Version number of this interface */
32#define FUSE_KERNEL_VERSION 7 36#define FUSE_KERNEL_VERSION 7
33 37
34/** Minor version number of this interface */ 38/** Minor version number of this interface */
35#define FUSE_KERNEL_MINOR_VERSION 10 39#define FUSE_KERNEL_MINOR_VERSION 11
36 40
37/** The node ID of the root inode */ 41/** The node ID of the root inode */
38#define FUSE_ROOT_ID 1 42#define FUSE_ROOT_ID 1
39 43
40/** The major number of the fuse character device */
41#define FUSE_MAJOR MISC_MAJOR
42
43/** The minor number of the fuse character device */
44#define FUSE_MINOR 229
45
46/* Make sure all structures are padded to 64bit boundary, so 32bit 44/* Make sure all structures are padded to 64bit boundary, so 32bit
47 userspace works under 64bit kernels */ 45 userspace works under 64bit kernels */
48 46
@@ -151,6 +149,28 @@ struct fuse_file_lock {
151 */ 149 */
152#define FUSE_READ_LOCKOWNER (1 << 1) 150#define FUSE_READ_LOCKOWNER (1 << 1)
153 151
152/**
153 * Ioctl flags
154 *
155 * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
156 * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
157 * FUSE_IOCTL_RETRY: retry with new iovecs
158 *
159 * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
160 */
161#define FUSE_IOCTL_COMPAT (1 << 0)
162#define FUSE_IOCTL_UNRESTRICTED (1 << 1)
163#define FUSE_IOCTL_RETRY (1 << 2)
164
165#define FUSE_IOCTL_MAX_IOV 256
166
167/**
168 * Poll flags
169 *
170 * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify
171 */
172#define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
173
154enum fuse_opcode { 174enum fuse_opcode {
155 FUSE_LOOKUP = 1, 175 FUSE_LOOKUP = 1,
156 FUSE_FORGET = 2, /* no reply */ 176 FUSE_FORGET = 2, /* no reply */
@@ -188,6 +208,13 @@ enum fuse_opcode {
188 FUSE_INTERRUPT = 36, 208 FUSE_INTERRUPT = 36,
189 FUSE_BMAP = 37, 209 FUSE_BMAP = 37,
190 FUSE_DESTROY = 38, 210 FUSE_DESTROY = 38,
211 FUSE_IOCTL = 39,
212 FUSE_POLL = 40,
213};
214
215enum fuse_notify_code {
216 FUSE_NOTIFY_POLL = 1,
217 FUSE_NOTIFY_CODE_MAX,
191}; 218};
192 219
193/* The read buffer is required to be at least 8k, but may be much larger */ 220/* The read buffer is required to be at least 8k, but may be much larger */
@@ -388,6 +415,38 @@ struct fuse_bmap_out {
388 __u64 block; 415 __u64 block;
389}; 416};
390 417
418struct fuse_ioctl_in {
419 __u64 fh;
420 __u32 flags;
421 __u32 cmd;
422 __u64 arg;
423 __u32 in_size;
424 __u32 out_size;
425};
426
427struct fuse_ioctl_out {
428 __s32 result;
429 __u32 flags;
430 __u32 in_iovs;
431 __u32 out_iovs;
432};
433
434struct fuse_poll_in {
435 __u64 fh;
436 __u64 kh;
437 __u32 flags;
438 __u32 padding;
439};
440
441struct fuse_poll_out {
442 __u32 revents;
443 __u32 padding;
444};
445
446struct fuse_notify_poll_wakeup_out {
447 __u64 kh;
448};
449
391struct fuse_in_header { 450struct fuse_in_header {
392 __u32 len; 451 __u32 len;
393 __u32 opcode; 452 __u32 opcode;
diff --git a/include/linux/futex.h b/include/linux/futex.h
index 8f627b9ae2b1..3bf5bb5a34f9 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -25,7 +25,8 @@ union ktime;
25#define FUTEX_WAKE_BITSET 10 25#define FUTEX_WAKE_BITSET 10
26 26
27#define FUTEX_PRIVATE_FLAG 128 27#define FUTEX_PRIVATE_FLAG 128
28#define FUTEX_CMD_MASK ~FUTEX_PRIVATE_FLAG 28#define FUTEX_CLOCK_REALTIME 256
29#define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
29 30
30#define FUTEX_WAIT_PRIVATE (FUTEX_WAIT | FUTEX_PRIVATE_FLAG) 31#define FUTEX_WAIT_PRIVATE (FUTEX_WAIT | FUTEX_PRIVATE_FLAG)
31#define FUTEX_WAKE_PRIVATE (FUTEX_WAKE | FUTEX_PRIVATE_FLAG) 32#define FUTEX_WAKE_PRIVATE (FUTEX_WAKE | FUTEX_PRIVATE_FLAG)
diff --git a/include/linux/generic_serial.h b/include/linux/generic_serial.h
index 4cc913939817..fadff28505bb 100644
--- a/include/linux/generic_serial.h
+++ b/include/linux/generic_serial.h
@@ -21,7 +21,6 @@ struct real_driver {
21 void (*enable_tx_interrupts) (void *); 21 void (*enable_tx_interrupts) (void *);
22 void (*disable_rx_interrupts) (void *); 22 void (*disable_rx_interrupts) (void *);
23 void (*enable_rx_interrupts) (void *); 23 void (*enable_rx_interrupts) (void *);
24 int (*get_CD) (void *);
25 void (*shutdown_port) (void*); 24 void (*shutdown_port) (void*);
26 int (*set_real_termios) (void*); 25 int (*set_real_termios) (void*);
27 int (*chars_in_buffer) (void*); 26 int (*chars_in_buffer) (void*);
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 3df7742ce246..16948eaecae3 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -126,6 +126,7 @@ struct blk_scsi_cmd_filter {
126struct disk_part_tbl { 126struct disk_part_tbl {
127 struct rcu_head rcu_head; 127 struct rcu_head rcu_head;
128 int len; 128 int len;
129 struct hd_struct *last_lookup;
129 struct hd_struct *part[]; 130 struct hd_struct *part[];
130}; 131};
131 132
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index e8003afeffba..dd20cd78faa8 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -69,12 +69,6 @@ struct vm_area_struct;
69#define GFP_HIGHUSER_MOVABLE (__GFP_WAIT | __GFP_IO | __GFP_FS | \ 69#define GFP_HIGHUSER_MOVABLE (__GFP_WAIT | __GFP_IO | __GFP_FS | \
70 __GFP_HARDWALL | __GFP_HIGHMEM | \ 70 __GFP_HARDWALL | __GFP_HIGHMEM | \
71 __GFP_MOVABLE) 71 __GFP_MOVABLE)
72#define GFP_NOFS_PAGECACHE (__GFP_WAIT | __GFP_IO | __GFP_MOVABLE)
73#define GFP_USER_PAGECACHE (__GFP_WAIT | __GFP_IO | __GFP_FS | \
74 __GFP_HARDWALL | __GFP_MOVABLE)
75#define GFP_HIGHUSER_PAGECACHE (__GFP_WAIT | __GFP_IO | __GFP_FS | \
76 __GFP_HARDWALL | __GFP_HIGHMEM | \
77 __GFP_MOVABLE)
78 72
79#ifdef CONFIG_NUMA 73#ifdef CONFIG_NUMA
80#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) 74#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index ec6ecd74781d..1289fa7623ca 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -15,6 +15,7 @@ struct gpio_keys_button {
15struct gpio_keys_platform_data { 15struct gpio_keys_platform_data {
16 struct gpio_keys_button *buttons; 16 struct gpio_keys_button *buttons;
17 int nbuttons; 17 int nbuttons;
18 unsigned int rep:1; /* enable input subsystem auto repeat */
18}; 19};
19 20
20#endif 21#endif
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 89a56d79e4c6..f83288347dda 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -119,13 +119,17 @@ static inline void account_system_vtime(struct task_struct *tsk)
119} 119}
120#endif 120#endif
121 121
122#if defined(CONFIG_PREEMPT_RCU) && defined(CONFIG_NO_HZ) 122#if defined(CONFIG_NO_HZ) && !defined(CONFIG_CLASSIC_RCU)
123extern void rcu_irq_enter(void); 123extern void rcu_irq_enter(void);
124extern void rcu_irq_exit(void); 124extern void rcu_irq_exit(void);
125extern void rcu_nmi_enter(void);
126extern void rcu_nmi_exit(void);
125#else 127#else
126# define rcu_irq_enter() do { } while (0) 128# define rcu_irq_enter() do { } while (0)
127# define rcu_irq_exit() do { } while (0) 129# define rcu_irq_exit() do { } while (0)
128#endif /* CONFIG_PREEMPT_RCU */ 130# define rcu_nmi_enter() do { } while (0)
131# define rcu_nmi_exit() do { } while (0)
132#endif /* #if defined(CONFIG_NO_HZ) && !defined(CONFIG_CLASSIC_RCU) */
129 133
130/* 134/*
131 * It is safe to do non-atomic ops on ->hardirq_context, 135 * It is safe to do non-atomic ops on ->hardirq_context,
@@ -135,7 +139,6 @@ extern void rcu_irq_exit(void);
135 */ 139 */
136#define __irq_enter() \ 140#define __irq_enter() \
137 do { \ 141 do { \
138 rcu_irq_enter(); \
139 account_system_vtime(current); \ 142 account_system_vtime(current); \
140 add_preempt_count(HARDIRQ_OFFSET); \ 143 add_preempt_count(HARDIRQ_OFFSET); \
141 trace_hardirq_enter(); \ 144 trace_hardirq_enter(); \
@@ -154,7 +157,6 @@ extern void irq_enter(void);
154 trace_hardirq_exit(); \ 157 trace_hardirq_exit(); \
155 account_system_vtime(current); \ 158 account_system_vtime(current); \
156 sub_preempt_count(HARDIRQ_OFFSET); \ 159 sub_preempt_count(HARDIRQ_OFFSET); \
157 rcu_irq_exit(); \
158 } while (0) 160 } while (0)
159 161
160/* 162/*
@@ -166,11 +168,14 @@ extern void irq_exit(void);
166 do { \ 168 do { \
167 ftrace_nmi_enter(); \ 169 ftrace_nmi_enter(); \
168 lockdep_off(); \ 170 lockdep_off(); \
171 rcu_nmi_enter(); \
169 __irq_enter(); \ 172 __irq_enter(); \
170 } while (0) 173 } while (0)
174
171#define nmi_exit() \ 175#define nmi_exit() \
172 do { \ 176 do { \
173 __irq_exit(); \ 177 __irq_exit(); \
178 rcu_nmi_exit(); \
174 lockdep_on(); \ 179 lockdep_on(); \
175 ftrace_nmi_exit(); \ 180 ftrace_nmi_exit(); \
176 } while (0) 181 } while (0)
diff --git a/include/linux/hdlc.h b/include/linux/hdlc.h
index c59769693bee..fd47a151665e 100644
--- a/include/linux/hdlc.h
+++ b/include/linux/hdlc.h
@@ -43,7 +43,7 @@ struct hdlc_proto {
43}; 43};
44 44
45 45
46/* Pointed to by dev->priv */ 46/* Pointed to by netdev_priv(dev) */
47typedef struct hdlc_device { 47typedef struct hdlc_device {
48 /* used by HDLC layer to take control over HDLC device from hw driver*/ 48 /* used by HDLC layer to take control over HDLC device from hw driver*/
49 int (*attach)(struct net_device *dev, 49 int (*attach)(struct net_device *dev,
@@ -80,7 +80,7 @@ struct net_device *alloc_hdlcdev(void *priv);
80 80
81static inline struct hdlc_device* dev_to_hdlc(struct net_device *dev) 81static inline struct hdlc_device* dev_to_hdlc(struct net_device *dev)
82{ 82{
83 return dev->priv; 83 return netdev_priv(dev);
84} 84}
85 85
86static __inline__ void debug_frame(const struct sk_buff *skb) 86static __inline__ void debug_frame(const struct sk_buff *skb)
diff --git a/include/linux/hid.h b/include/linux/hid.h
index e5780f8c934a..81aa84d60c6b 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -403,15 +403,6 @@ struct hid_output_fifo {
403#define HID_STAT_ADDED 1 403#define HID_STAT_ADDED 1
404#define HID_STAT_PARSED 2 404#define HID_STAT_PARSED 2
405 405
406#define HID_CTRL_RUNNING 1
407#define HID_OUT_RUNNING 2
408#define HID_IN_RUNNING 3
409#define HID_RESET_PENDING 4
410#define HID_SUSPENDED 5
411#define HID_CLEAR_HALT 6
412#define HID_DISCONNECTED 7
413#define HID_STARTED 8
414
415struct hid_input { 406struct hid_input {
416 struct list_head list; 407 struct list_head list;
417 struct hid_report *report; 408 struct hid_report *report;
@@ -540,6 +531,8 @@ struct hid_usage_id {
540 * @name: driver name (e.g. "Footech_bar-wheel") 531 * @name: driver name (e.g. "Footech_bar-wheel")
541 * @id_table: which devices is this driver for (must be non-NULL for probe 532 * @id_table: which devices is this driver for (must be non-NULL for probe
542 * to be called) 533 * to be called)
534 * @dyn_list: list of dynamically added device ids
535 * @dyn_lock: lock protecting @dyn_list
543 * @probe: new device inserted 536 * @probe: new device inserted
544 * @remove: device removed (NULL if not a hot-plug capable driver) 537 * @remove: device removed (NULL if not a hot-plug capable driver)
545 * @report_table: on which reports to call raw_event (NULL means all) 538 * @report_table: on which reports to call raw_event (NULL means all)
@@ -567,6 +560,9 @@ struct hid_driver {
567 char *name; 560 char *name;
568 const struct hid_device_id *id_table; 561 const struct hid_device_id *id_table;
569 562
563 struct list_head dyn_list;
564 spinlock_t dyn_lock;
565
570 int (*probe)(struct hid_device *dev, const struct hid_device_id *id); 566 int (*probe)(struct hid_device *dev, const struct hid_device_id *id);
571 void (*remove)(struct hid_device *dev); 567 void (*remove)(struct hid_device *dev);
572 568
@@ -797,6 +793,8 @@ dbg_hid(const char *fmt, ...)
797 793
798#ifdef CONFIG_HID_COMPAT 794#ifdef CONFIG_HID_COMPAT
799#define HID_COMPAT_LOAD_DRIVER(name) \ 795#define HID_COMPAT_LOAD_DRIVER(name) \
796/* prototype to avoid sparse warning */ \
797extern void hid_compat_##name(void); \
800void hid_compat_##name(void) { } \ 798void hid_compat_##name(void) { } \
801EXPORT_SYMBOL(hid_compat_##name) 799EXPORT_SYMBOL(hid_compat_##name)
802#else 800#else
diff --git a/include/linux/hidraw.h b/include/linux/hidraw.h
index dbb5c8c374f0..dd8d69269176 100644
--- a/include/linux/hidraw.h
+++ b/include/linux/hidraw.h
@@ -33,6 +33,8 @@ struct hidraw_devinfo {
33#define HIDIOCGRDESCSIZE _IOR('H', 0x01, int) 33#define HIDIOCGRDESCSIZE _IOR('H', 0x01, int)
34#define HIDIOCGRDESC _IOR('H', 0x02, struct hidraw_report_descriptor) 34#define HIDIOCGRDESC _IOR('H', 0x02, struct hidraw_report_descriptor)
35#define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo) 35#define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo)
36#define HIDIOCGRAWNAME(len) _IOC(_IOC_READ, 'H', 0x04, len)
37#define HIDIOCGRAWPHYS(len) _IOC(_IOC_READ, 'H', 0x05, len)
36 38
37#define HIDRAW_FIRST_MINOR 0 39#define HIDRAW_FIRST_MINOR 0
38#define HIDRAW_MAX_DEVICES 64 40#define HIDRAW_MAX_DEVICES 64
diff --git a/include/linux/hippidevice.h b/include/linux/hippidevice.h
index bab303dafd6e..f148e4908410 100644
--- a/include/linux/hippidevice.h
+++ b/include/linux/hippidevice.h
@@ -32,7 +32,9 @@ struct hippi_cb {
32}; 32};
33 33
34extern __be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev); 34extern __be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev);
35 35extern int hippi_change_mtu(struct net_device *dev, int new_mtu);
36extern int hippi_mac_addr(struct net_device *dev, void *p);
37extern int hippi_neigh_setup_dev(struct net_device *dev, struct neigh_parms *p);
36extern struct net_device *alloc_hippi_dev(int sizeof_priv); 38extern struct net_device *alloc_hippi_dev(int sizeof_priv);
37#endif 39#endif
38 40
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 3eba43878dcb..bd37078c2d7d 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -43,26 +43,6 @@ enum hrtimer_restart {
43}; 43};
44 44
45/* 45/*
46 * hrtimer callback modes:
47 *
48 * HRTIMER_CB_SOFTIRQ: Callback must run in softirq context
49 * HRTIMER_CB_IRQSAFE_PERCPU: Callback must run in hardirq context
50 * Special mode for tick emulation and
51 * scheduler timer. Such timers are per
52 * cpu and not allowed to be migrated on
53 * cpu unplug.
54 * HRTIMER_CB_IRQSAFE_UNLOCKED: Callback should run in hardirq context
55 * with timer->base lock unlocked
56 * used for timers which call wakeup to
57 * avoid lock order problems with rq->lock
58 */
59enum hrtimer_cb_mode {
60 HRTIMER_CB_SOFTIRQ,
61 HRTIMER_CB_IRQSAFE_PERCPU,
62 HRTIMER_CB_IRQSAFE_UNLOCKED,
63};
64
65/*
66 * Values to track state of the timer 46 * Values to track state of the timer
67 * 47 *
68 * Possible states: 48 * Possible states:
@@ -70,7 +50,6 @@ enum hrtimer_cb_mode {
70 * 0x00 inactive 50 * 0x00 inactive
71 * 0x01 enqueued into rbtree 51 * 0x01 enqueued into rbtree
72 * 0x02 callback function running 52 * 0x02 callback function running
73 * 0x04 callback pending (high resolution mode)
74 * 53 *
75 * Special cases: 54 * Special cases:
76 * 0x03 callback function running and enqueued 55 * 0x03 callback function running and enqueued
@@ -92,8 +71,7 @@ enum hrtimer_cb_mode {
92#define HRTIMER_STATE_INACTIVE 0x00 71#define HRTIMER_STATE_INACTIVE 0x00
93#define HRTIMER_STATE_ENQUEUED 0x01 72#define HRTIMER_STATE_ENQUEUED 0x01
94#define HRTIMER_STATE_CALLBACK 0x02 73#define HRTIMER_STATE_CALLBACK 0x02
95#define HRTIMER_STATE_PENDING 0x04 74#define HRTIMER_STATE_MIGRATE 0x04
96#define HRTIMER_STATE_MIGRATE 0x08
97 75
98/** 76/**
99 * struct hrtimer - the basic hrtimer structure 77 * struct hrtimer - the basic hrtimer structure
@@ -109,8 +87,6 @@ enum hrtimer_cb_mode {
109 * @function: timer expiry callback function 87 * @function: timer expiry callback function
110 * @base: pointer to the timer base (per cpu and per clock) 88 * @base: pointer to the timer base (per cpu and per clock)
111 * @state: state information (See bit values above) 89 * @state: state information (See bit values above)
112 * @cb_mode: high resolution timer feature to select the callback execution
113 * mode
114 * @cb_entry: list head to enqueue an expired timer into the callback list 90 * @cb_entry: list head to enqueue an expired timer into the callback list
115 * @start_site: timer statistics field to store the site where the timer 91 * @start_site: timer statistics field to store the site where the timer
116 * was started 92 * was started
@@ -129,7 +105,6 @@ struct hrtimer {
129 struct hrtimer_clock_base *base; 105 struct hrtimer_clock_base *base;
130 unsigned long state; 106 unsigned long state;
131 struct list_head cb_entry; 107 struct list_head cb_entry;
132 enum hrtimer_cb_mode cb_mode;
133#ifdef CONFIG_TIMER_STATS 108#ifdef CONFIG_TIMER_STATS
134 int start_pid; 109 int start_pid;
135 void *start_site; 110 void *start_site;
@@ -188,15 +163,11 @@ struct hrtimer_clock_base {
188 * @check_clocks: Indictator, when set evaluate time source and clock 163 * @check_clocks: Indictator, when set evaluate time source and clock
189 * event devices whether high resolution mode can be 164 * event devices whether high resolution mode can be
190 * activated. 165 * activated.
191 * @cb_pending: Expired timers are moved from the rbtree to this
192 * list in the timer interrupt. The list is processed
193 * in the softirq.
194 * @nr_events: Total number of timer interrupt events 166 * @nr_events: Total number of timer interrupt events
195 */ 167 */
196struct hrtimer_cpu_base { 168struct hrtimer_cpu_base {
197 spinlock_t lock; 169 spinlock_t lock;
198 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; 170 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES];
199 struct list_head cb_pending;
200#ifdef CONFIG_HIGH_RES_TIMERS 171#ifdef CONFIG_HIGH_RES_TIMERS
201 ktime_t expires_next; 172 ktime_t expires_next;
202 int hres_active; 173 int hres_active;
@@ -404,8 +375,7 @@ static inline int hrtimer_active(const struct hrtimer *timer)
404 */ 375 */
405static inline int hrtimer_is_queued(struct hrtimer *timer) 376static inline int hrtimer_is_queued(struct hrtimer *timer)
406{ 377{
407 return timer->state & 378 return timer->state & HRTIMER_STATE_ENQUEUED;
408 (HRTIMER_STATE_ENQUEUED | HRTIMER_STATE_PENDING);
409} 379}
410 380
411/* 381/*
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index e1c8afc002c0..f1d2fba19ea0 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -233,6 +233,10 @@ static inline unsigned long huge_page_size(struct hstate *h)
233 return (unsigned long)PAGE_SIZE << h->order; 233 return (unsigned long)PAGE_SIZE << h->order;
234} 234}
235 235
236extern unsigned long vma_kernel_pagesize(struct vm_area_struct *vma);
237
238extern unsigned long vma_mmu_pagesize(struct vm_area_struct *vma);
239
236static inline unsigned long huge_page_mask(struct hstate *h) 240static inline unsigned long huge_page_mask(struct hstate *h)
237{ 241{
238 return h->mask; 242 return h->mask;
@@ -273,6 +277,8 @@ struct hstate {};
273#define hstate_inode(i) NULL 277#define hstate_inode(i) NULL
274#define huge_page_size(h) PAGE_SIZE 278#define huge_page_size(h) PAGE_SIZE
275#define huge_page_mask(h) PAGE_MASK 279#define huge_page_mask(h) PAGE_MASK
280#define vma_kernel_pagesize(v) PAGE_SIZE
281#define vma_mmu_pagesize(v) PAGE_SIZE
276#define huge_page_order(h) 0 282#define huge_page_order(h) 0
277#define huge_page_shift(h) PAGE_SHIFT 283#define huge_page_shift(h) PAGE_SHIFT
278static inline unsigned int pages_per_huge_page(struct hstate *h) 284static inline unsigned int pages_per_huge_page(struct hstate *h)
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 33a5992d4936..20873d402467 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -393,11 +393,7 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data)
393#define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */ 393#define I2C_CLASS_TV_ANALOG (1<<1) /* bttv + friends */
394#define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */ 394#define I2C_CLASS_TV_DIGITAL (1<<2) /* dvb cards */
395#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */ 395#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */
396#define I2C_CLASS_CAM_ANALOG (1<<4) /* camera with analog CCD */
397#define I2C_CLASS_CAM_DIGITAL (1<<5) /* most webcams */
398#define I2C_CLASS_SOUND (1<<6) /* sound devices */
399#define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */ 396#define I2C_CLASS_SPD (1<<7) /* SPD EEPROMs and similar */
400#define I2C_CLASS_ALL (UINT_MAX) /* all of the above */
401 397
402/* i2c_client_address_data is the struct for holding default client 398/* i2c_client_address_data is the struct for holding default client
403 * addresses for a driver and for the parameters supplied on the 399 * addresses for a driver and for the parameters supplied on the
diff --git a/include/linux/i2c/dm355evm_msp.h b/include/linux/i2c/dm355evm_msp.h
new file mode 100644
index 000000000000..372470350fab
--- /dev/null
+++ b/include/linux/i2c/dm355evm_msp.h
@@ -0,0 +1,79 @@
1/*
2 * dm355evm_msp.h - support MSP430 microcontroller on DM355EVM board
3 */
4#ifndef __LINUX_I2C_DM355EVM_MSP
5#define __LINUX_I2C_DM355EVM_MSP
6
7/*
8 * Written against Spectrum's writeup for the A4 firmware revision,
9 * and tweaked to match source and rev D2 schematics by removing CPLD
10 * and NOR flash hooks (which were last appropriate in rev B boards).
11 *
12 * Note that the firmware supports a flavor of write posting ... to be
13 * sure a write completes, issue another read or write.
14 */
15
16/* utilities to access "registers" emulated by msp430 firmware */
17extern int dm355evm_msp_write(u8 value, u8 reg);
18extern int dm355evm_msp_read(u8 reg);
19
20
21/* command/control registers */
22#define DM355EVM_MSP_COMMAND 0x00
23# define MSP_COMMAND_NULL 0
24# define MSP_COMMAND_RESET_COLD 1
25# define MSP_COMMAND_RESET_WARM 2
26# define MSP_COMMAND_RESET_WARM_I 3
27# define MSP_COMMAND_POWEROFF 4
28# define MSP_COMMAND_IR_REINIT 5
29#define DM355EVM_MSP_STATUS 0x01
30# define MSP_STATUS_BAD_OFFSET BIT(0)
31# define MSP_STATUS_BAD_COMMAND BIT(1)
32# define MSP_STATUS_POWER_ERROR BIT(2)
33# define MSP_STATUS_RXBUF_OVERRUN BIT(3)
34#define DM355EVM_MSP_RESET 0x02 /* 0 bits == in reset */
35# define MSP_RESET_DC5 BIT(0)
36# define MSP_RESET_TVP5154 BIT(2)
37# define MSP_RESET_IMAGER BIT(3)
38# define MSP_RESET_ETHERNET BIT(4)
39# define MSP_RESET_SYS BIT(5)
40# define MSP_RESET_AIC33 BIT(7)
41
42/* GPIO registers ... bit patterns mostly match the source MSP ports */
43#define DM355EVM_MSP_LED 0x03 /* active low (MSP P4) */
44#define DM355EVM_MSP_SWITCH1 0x04 /* (MSP P5, masked) */
45# define MSP_SWITCH1_SW6_1 BIT(0)
46# define MSP_SWITCH1_SW6_2 BIT(1)
47# define MSP_SWITCH1_SW6_3 BIT(2)
48# define MSP_SWITCH1_SW6_4 BIT(3)
49# define MSP_SWITCH1_J1 BIT(4) /* NTSC/PAL */
50# define MSP_SWITCH1_MSP_INT BIT(5) /* active low */
51#define DM355EVM_MSP_SWITCH2 0x05 /* (MSP P6, masked) */
52# define MSP_SWITCH2_SW10 BIT(3)
53# define MSP_SWITCH2_SW11 BIT(4)
54# define MSP_SWITCH2_SW12 BIT(5)
55# define MSP_SWITCH2_SW13 BIT(6)
56# define MSP_SWITCH2_SW14 BIT(7)
57#define DM355EVM_MSP_SDMMC 0x06 /* (MSP P2, masked) */
58# define MSP_SDMMC_0_WP BIT(1)
59# define MSP_SDMMC_0_CD BIT(2) /* active low */
60# define MSP_SDMMC_1_WP BIT(3)
61# define MSP_SDMMC_1_CD BIT(4) /* active low */
62#define DM355EVM_MSP_FIRMREV 0x07 /* not a GPIO (out of order) */
63#define DM355EVM_MSP_VIDEO_IN 0x08 /* (MSP P3, masked) */
64# define MSP_VIDEO_IMAGER BIT(7) /* low == tvp5146 */
65
66/* power supply registers are currently omitted */
67
68/* RTC registers */
69#define DM355EVM_MSP_RTC_0 0x12 /* LSB */
70#define DM355EVM_MSP_RTC_1 0x13
71#define DM355EVM_MSP_RTC_2 0x14
72#define DM355EVM_MSP_RTC_3 0x15 /* MSB */
73
74/* input event queue registers; code == ((HIGH << 8) | LOW) */
75#define DM355EVM_MSP_INPUT_COUNT 0x16 /* decrement by reading LOW */
76#define DM355EVM_MSP_INPUT_HIGH 0x17
77#define DM355EVM_MSP_INPUT_LOW 0x18
78
79#endif /* __LINUX_I2C_DM355EVM_MSP */
diff --git a/include/linux/i2c/tsc2007.h b/include/linux/i2c/tsc2007.h
new file mode 100644
index 000000000000..c6361fbb7bf9
--- /dev/null
+++ b/include/linux/i2c/tsc2007.h
@@ -0,0 +1,17 @@
1#ifndef __LINUX_I2C_TSC2007_H
2#define __LINUX_I2C_TSC2007_H
3
4/* linux/i2c/tsc2007.h */
5
6struct tsc2007_platform_data {
7 u16 model; /* 2007. */
8 u16 x_plate_ohms;
9
10 int (*get_pendown_state)(void);
11 void (*clear_penirq)(void); /* If needed, clear 2nd level
12 interrupt source */
13 int (*init_platform_hw)(void);
14 void (*exit_platform_hw)(void);
15};
16
17#endif
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h
index fb604dcd38f1..8137f660a5cc 100644
--- a/include/linux/i2c/twl4030.h
+++ b/include/linux/i2c/twl4030.h
@@ -78,8 +78,8 @@ int twl4030_i2c_read_u8(u8 mod_no, u8 *val, u8 reg);
78 * IMPORTANT: For twl4030_i2c_write(), allocate num_bytes + 1 78 * IMPORTANT: For twl4030_i2c_write(), allocate num_bytes + 1
79 * for the value, and populate your data starting at offset 1. 79 * for the value, and populate your data starting at offset 1.
80 */ 80 */
81int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, u8 num_bytes); 81int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
82int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, u8 num_bytes); 82int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
83 83
84/*----------------------------------------------------------------------*/ 84/*----------------------------------------------------------------------*/
85 85
@@ -234,6 +234,9 @@ struct twl4030_gpio_platform_data {
234 /* gpio-n should control VMMC(n+1) if BIT(n) in mmc_cd is set */ 234 /* gpio-n should control VMMC(n+1) if BIT(n) in mmc_cd is set */
235 u8 mmc_cd; 235 u8 mmc_cd;
236 236
237 /* if BIT(N) is set, or VMMC(n+1) is linked, debounce GPIO-N */
238 u32 debounce;
239
237 /* For gpio-N, bit (1 << N) in "pullups" is set if that pullup 240 /* For gpio-N, bit (1 << N) in "pullups" is set if that pullup
238 * should be enabled. Else, if that bit is set in "pulldowns", 241 * should be enabled. Else, if that bit is set in "pulldowns",
239 * that pulldown is enabled. Don't waste power by letting any 242 * that pulldown is enabled. Don't waste power by letting any
@@ -278,6 +281,18 @@ struct twl4030_platform_data {
278 struct twl4030_keypad_data *keypad; 281 struct twl4030_keypad_data *keypad;
279 struct twl4030_usb_data *usb; 282 struct twl4030_usb_data *usb;
280 283
284 /* LDO regulators */
285 struct regulator_init_data *vdac;
286 struct regulator_init_data *vpll1;
287 struct regulator_init_data *vpll2;
288 struct regulator_init_data *vmmc1;
289 struct regulator_init_data *vmmc2;
290 struct regulator_init_data *vsim;
291 struct regulator_init_data *vaux1;
292 struct regulator_init_data *vaux2;
293 struct regulator_init_data *vaux3;
294 struct regulator_init_data *vaux4;
295
281 /* REVISIT more to come ... _nothing_ should be hard-wired */ 296 /* REVISIT more to come ... _nothing_ should be hard-wired */
282}; 297};
283 298
@@ -285,33 +300,6 @@ struct twl4030_platform_data {
285 300
286int twl4030_sih_setup(int module); 301int twl4030_sih_setup(int module);
287 302
288/*
289 * FIXME completely stop using TWL4030_IRQ_BASE ... instead, pass the
290 * IRQ data to subsidiary devices using platform device resources.
291 */
292
293/* IRQ information-need base */
294#include <mach/irqs.h>
295/* TWL4030 interrupts */
296
297/* #define TWL4030_MODIRQ_GPIO (TWL4030_IRQ_BASE + 0) */
298#define TWL4030_MODIRQ_KEYPAD (TWL4030_IRQ_BASE + 1)
299#define TWL4030_MODIRQ_BCI (TWL4030_IRQ_BASE + 2)
300#define TWL4030_MODIRQ_MADC (TWL4030_IRQ_BASE + 3)
301/* #define TWL4030_MODIRQ_USB (TWL4030_IRQ_BASE + 4) */
302/* #define TWL4030_MODIRQ_PWR (TWL4030_IRQ_BASE + 5) */
303
304#define TWL4030_PWRIRQ_PWRBTN (TWL4030_PWR_IRQ_BASE + 0)
305/* #define TWL4030_PWRIRQ_CHG_PRES (TWL4030_PWR_IRQ_BASE + 1) */
306/* #define TWL4030_PWRIRQ_USB_PRES (TWL4030_PWR_IRQ_BASE + 2) */
307/* #define TWL4030_PWRIRQ_RTC (TWL4030_PWR_IRQ_BASE + 3) */
308/* #define TWL4030_PWRIRQ_HOT_DIE (TWL4030_PWR_IRQ_BASE + 4) */
309/* #define TWL4030_PWRIRQ_PWROK_TIMEOUT (TWL4030_PWR_IRQ_BASE + 5) */
310/* #define TWL4030_PWRIRQ_MBCHG (TWL4030_PWR_IRQ_BASE + 6) */
311/* #define TWL4030_PWRIRQ_SC_DETECT (TWL4030_PWR_IRQ_BASE + 7) */
312
313/* Rest are unsued currently*/
314
315/* Offsets to Power Registers */ 303/* Offsets to Power Registers */
316#define TWL4030_VDAC_DEV_GRP 0x3B 304#define TWL4030_VDAC_DEV_GRP 0x3B
317#define TWL4030_VDAC_DEDICATED 0x3E 305#define TWL4030_VDAC_DEDICATED 0x3E
@@ -322,16 +310,6 @@ int twl4030_sih_setup(int module);
322#define TWL4030_VAUX3_DEV_GRP 0x1F 310#define TWL4030_VAUX3_DEV_GRP 0x1F
323#define TWL4030_VAUX3_DEDICATED 0x22 311#define TWL4030_VAUX3_DEDICATED 0x22
324 312
325/* TWL4030 GPIO interrupt definitions */
326
327#define TWL4030_GPIO_IRQ_NO(n) (TWL4030_GPIO_IRQ_BASE + (n))
328
329/*
330 * Exported TWL4030 GPIO APIs
331 *
332 * WARNING -- use standard GPIO and IRQ calls instead; these will vanish.
333 */
334int twl4030_set_gpio_debounce(int gpio, int enable);
335 313
336#if defined(CONFIG_TWL4030_BCI_BATTERY) || \ 314#if defined(CONFIG_TWL4030_BCI_BATTERY) || \
337 defined(CONFIG_TWL4030_BCI_BATTERY_MODULE) 315 defined(CONFIG_TWL4030_BCI_BATTERY_MODULE)
@@ -340,4 +318,38 @@ int twl4030_set_gpio_debounce(int gpio, int enable);
340 static inline int twl4030charger_usb_en(int enable) { return 0; } 318 static inline int twl4030charger_usb_en(int enable) { return 0; }
341#endif 319#endif
342 320
321/*----------------------------------------------------------------------*/
322
323/* Linux-specific regulator identifiers ... for now, we only support
324 * the LDOs, and leave the three buck converters alone. VDD1 and VDD2
325 * need to tie into hardware based voltage scaling (cpufreq etc), while
326 * VIO is generally fixed.
327 */
328
329/* EXTERNAL dc-to-dc buck converters */
330#define TWL4030_REG_VDD1 0
331#define TWL4030_REG_VDD2 1
332#define TWL4030_REG_VIO 2
333
334/* EXTERNAL LDOs */
335#define TWL4030_REG_VDAC 3
336#define TWL4030_REG_VPLL1 4
337#define TWL4030_REG_VPLL2 5 /* not on all chips */
338#define TWL4030_REG_VMMC1 6
339#define TWL4030_REG_VMMC2 7 /* not on all chips */
340#define TWL4030_REG_VSIM 8 /* not on all chips */
341#define TWL4030_REG_VAUX1 9 /* not on all chips */
342#define TWL4030_REG_VAUX2_4030 10 /* (twl4030-specific) */
343#define TWL4030_REG_VAUX2 11 /* (twl5030 and newer) */
344#define TWL4030_REG_VAUX3 12 /* not on all chips */
345#define TWL4030_REG_VAUX4 13 /* not on all chips */
346
347/* INTERNAL LDOs */
348#define TWL4030_REG_VINTANA1 14
349#define TWL4030_REG_VINTANA2 15
350#define TWL4030_REG_VINTDIG 16
351#define TWL4030_REG_VUSB1V5 17
352#define TWL4030_REG_VUSB1V8 18
353#define TWL4030_REG_VUSB3V1 19
354
343#endif /* End of __TWL4030_H */ 355#endif /* End of __TWL4030_H */
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 010fb26a1579..3644f6323384 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -33,24 +33,13 @@
33#endif 33#endif
34 34
35/* 35/*
36 * Used to indicate "no IRQ", should be a value that cannot be an IRQ
37 * number.
38 */
39
40#define IDE_NO_IRQ (-1)
41
42typedef unsigned char byte; /* used everywhere */
43
44/*
45 * Probably not wise to fiddle with these 36 * Probably not wise to fiddle with these
46 */ 37 */
38#define IDE_DEFAULT_MAX_FAILURES 1
47#define ERROR_MAX 8 /* Max read/write errors per sector */ 39#define ERROR_MAX 8 /* Max read/write errors per sector */
48#define ERROR_RESET 3 /* Reset controller every 4th retry */ 40#define ERROR_RESET 3 /* Reset controller every 4th retry */
49#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */ 41#define ERROR_RECAL 1 /* Recalibrate every 2nd retry */
50 42
51#define HWIF(drive) ((ide_hwif_t *)((drive)->hwif))
52#define HWGROUP(drive) ((ide_hwgroup_t *)(HWIF(drive)->hwgroup))
53
54/* 43/*
55 * Definitions for accessing IDE controller registers 44 * Definitions for accessing IDE controller registers
56 */ 45 */
@@ -122,8 +111,6 @@ struct ide_io_ports {
122#define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */ 111#define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */
123#define SECTOR_SIZE 512 112#define SECTOR_SIZE 512
124 113
125#define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t)))
126
127/* 114/*
128 * Timeouts for various operations: 115 * Timeouts for various operations:
129 */ 116 */
@@ -172,9 +159,7 @@ typedef int (ide_ack_intr_t)(struct hwif_s *);
172enum { ide_unknown, ide_generic, ide_pci, 159enum { ide_unknown, ide_generic, ide_pci,
173 ide_cmd640, ide_dtc2278, ide_ali14xx, 160 ide_cmd640, ide_dtc2278, ide_ali14xx,
174 ide_qd65xx, ide_umc8672, ide_ht6560b, 161 ide_qd65xx, ide_umc8672, ide_ht6560b,
175 ide_rz1000, ide_trm290, 162 ide_4drives, ide_pmac, ide_acorn,
176 ide_cmd646, ide_cy82c693, ide_4drives,
177 ide_pmac, ide_acorn,
178 ide_au1xxx, ide_palm3710 163 ide_au1xxx, ide_palm3710
179}; 164};
180 165
@@ -196,9 +181,6 @@ typedef struct hw_regs_s {
196 unsigned long config; 181 unsigned long config;
197} hw_regs_t; 182} hw_regs_t;
198 183
199void ide_init_port_data(struct hwif_s *, unsigned int);
200void ide_init_port_hw(struct hwif_s *, hw_regs_t *);
201
202static inline void ide_std_init_ports(hw_regs_t *hw, 184static inline void ide_std_init_ports(hw_regs_t *hw,
203 unsigned long io_addr, 185 unsigned long io_addr,
204 unsigned long ctl_addr) 186 unsigned long ctl_addr)
@@ -407,6 +389,7 @@ enum {
407 * This is used for several packet commands (not for READ/WRITE commands). 389 * This is used for several packet commands (not for READ/WRITE commands).
408 */ 390 */
409#define IDE_PC_BUFFER_SIZE 256 391#define IDE_PC_BUFFER_SIZE 256
392#define ATAPI_WAIT_PC (60 * HZ)
410 393
411struct ide_atapi_pc { 394struct ide_atapi_pc {
412 /* actual packet bytes */ 395 /* actual packet bytes */
@@ -443,18 +426,14 @@ struct ide_atapi_pc {
443 struct idetape_bh *bh; 426 struct idetape_bh *bh;
444 char *b_data; 427 char *b_data;
445 428
446 /* idescsi only for now */
447 struct scatterlist *sg; 429 struct scatterlist *sg;
448 unsigned int sg_cnt; 430 unsigned int sg_cnt;
449 431
450 struct scsi_cmnd *scsi_cmd;
451 void (*done) (struct scsi_cmnd *);
452
453 unsigned long timeout; 432 unsigned long timeout;
454}; 433};
455 434
456struct ide_devset; 435struct ide_devset;
457struct ide_driver_s; 436struct ide_driver;
458 437
459#ifdef CONFIG_BLK_DEV_IDEACPI 438#ifdef CONFIG_BLK_DEV_IDEACPI
460struct ide_acpi_drive_link; 439struct ide_acpi_drive_link;
@@ -484,55 +463,53 @@ enum {
484 463
485 /* ide-cd */ 464 /* ide-cd */
486 /* Drive cannot eject the disc. */ 465 /* Drive cannot eject the disc. */
487 IDE_AFLAG_NO_EJECT = (1 << 3), 466 IDE_AFLAG_NO_EJECT = (1 << 1),
488 /* Drive is a pre ATAPI 1.2 drive. */ 467 /* Drive is a pre ATAPI 1.2 drive. */
489 IDE_AFLAG_PRE_ATAPI12 = (1 << 4), 468 IDE_AFLAG_PRE_ATAPI12 = (1 << 2),
490 /* TOC addresses are in BCD. */ 469 /* TOC addresses are in BCD. */
491 IDE_AFLAG_TOCADDR_AS_BCD = (1 << 5), 470 IDE_AFLAG_TOCADDR_AS_BCD = (1 << 3),
492 /* TOC track numbers are in BCD. */ 471 /* TOC track numbers are in BCD. */
493 IDE_AFLAG_TOCTRACKS_AS_BCD = (1 << 6), 472 IDE_AFLAG_TOCTRACKS_AS_BCD = (1 << 4),
494 /* 473 /*
495 * Drive does not provide data in multiples of SECTOR_SIZE 474 * Drive does not provide data in multiples of SECTOR_SIZE
496 * when more than one interrupt is needed. 475 * when more than one interrupt is needed.
497 */ 476 */
498 IDE_AFLAG_LIMIT_NFRAMES = (1 << 7), 477 IDE_AFLAG_LIMIT_NFRAMES = (1 << 5),
499 /* Seeking in progress. */
500 IDE_AFLAG_SEEKING = (1 << 8),
501 /* Saved TOC information is current. */ 478 /* Saved TOC information is current. */
502 IDE_AFLAG_TOC_VALID = (1 << 9), 479 IDE_AFLAG_TOC_VALID = (1 << 6),
503 /* We think that the drive door is locked. */ 480 /* We think that the drive door is locked. */
504 IDE_AFLAG_DOOR_LOCKED = (1 << 10), 481 IDE_AFLAG_DOOR_LOCKED = (1 << 7),
505 /* SET_CD_SPEED command is unsupported. */ 482 /* SET_CD_SPEED command is unsupported. */
506 IDE_AFLAG_NO_SPEED_SELECT = (1 << 11), 483 IDE_AFLAG_NO_SPEED_SELECT = (1 << 8),
507 IDE_AFLAG_VERTOS_300_SSD = (1 << 12), 484 IDE_AFLAG_VERTOS_300_SSD = (1 << 9),
508 IDE_AFLAG_VERTOS_600_ESD = (1 << 13), 485 IDE_AFLAG_VERTOS_600_ESD = (1 << 10),
509 IDE_AFLAG_SANYO_3CD = (1 << 14), 486 IDE_AFLAG_SANYO_3CD = (1 << 11),
510 IDE_AFLAG_FULL_CAPS_PAGE = (1 << 15), 487 IDE_AFLAG_FULL_CAPS_PAGE = (1 << 12),
511 IDE_AFLAG_PLAY_AUDIO_OK = (1 << 16), 488 IDE_AFLAG_PLAY_AUDIO_OK = (1 << 13),
512 IDE_AFLAG_LE_SPEED_FIELDS = (1 << 17), 489 IDE_AFLAG_LE_SPEED_FIELDS = (1 << 14),
513 490
514 /* ide-floppy */ 491 /* ide-floppy */
515 /* Avoid commands not supported in Clik drive */ 492 /* Avoid commands not supported in Clik drive */
516 IDE_AFLAG_CLIK_DRIVE = (1 << 19), 493 IDE_AFLAG_CLIK_DRIVE = (1 << 15),
517 /* Requires BH algorithm for packets */ 494 /* Requires BH algorithm for packets */
518 IDE_AFLAG_ZIP_DRIVE = (1 << 20), 495 IDE_AFLAG_ZIP_DRIVE = (1 << 16),
519 /* Supports format progress report */ 496 /* Supports format progress report */
520 IDE_AFLAG_SRFP = (1 << 22), 497 IDE_AFLAG_SRFP = (1 << 17),
521 498
522 /* ide-tape */ 499 /* ide-tape */
523 IDE_AFLAG_IGNORE_DSC = (1 << 23), 500 IDE_AFLAG_IGNORE_DSC = (1 << 18),
524 /* 0 When the tape position is unknown */ 501 /* 0 When the tape position is unknown */
525 IDE_AFLAG_ADDRESS_VALID = (1 << 24), 502 IDE_AFLAG_ADDRESS_VALID = (1 << 19),
526 /* Device already opened */ 503 /* Device already opened */
527 IDE_AFLAG_BUSY = (1 << 25), 504 IDE_AFLAG_BUSY = (1 << 20),
528 /* Attempt to auto-detect the current user block size */ 505 /* Attempt to auto-detect the current user block size */
529 IDE_AFLAG_DETECT_BS = (1 << 26), 506 IDE_AFLAG_DETECT_BS = (1 << 21),
530 /* Currently on a filemark */ 507 /* Currently on a filemark */
531 IDE_AFLAG_FILEMARK = (1 << 27), 508 IDE_AFLAG_FILEMARK = (1 << 22),
532 /* 0 = no tape is loaded, so we don't rewind after ejecting */ 509 /* 0 = no tape is loaded, so we don't rewind after ejecting */
533 IDE_AFLAG_MEDIUM_PRESENT = (1 << 28), 510 IDE_AFLAG_MEDIUM_PRESENT = (1 << 23),
534 511
535 IDE_AFLAG_NO_AUTOCLOSE = (1 << 29), 512 IDE_AFLAG_NO_AUTOCLOSE = (1 << 24),
536}; 513};
537 514
538/* device flags */ 515/* device flags */
@@ -571,28 +548,26 @@ enum {
571 IDE_DFLAG_NODMA = (1 << 16), 548 IDE_DFLAG_NODMA = (1 << 16),
572 /* powermanagment told us not to do anything, so sleep nicely */ 549 /* powermanagment told us not to do anything, so sleep nicely */
573 IDE_DFLAG_BLOCKED = (1 << 17), 550 IDE_DFLAG_BLOCKED = (1 << 17),
574 /* ide-scsi emulation */
575 IDE_DFLAG_SCSI = (1 << 18),
576 /* sleeping & sleep field valid */ 551 /* sleeping & sleep field valid */
577 IDE_DFLAG_SLEEPING = (1 << 19), 552 IDE_DFLAG_SLEEPING = (1 << 18),
578 IDE_DFLAG_POST_RESET = (1 << 20), 553 IDE_DFLAG_POST_RESET = (1 << 19),
579 IDE_DFLAG_UDMA33_WARNED = (1 << 21), 554 IDE_DFLAG_UDMA33_WARNED = (1 << 20),
580 IDE_DFLAG_LBA48 = (1 << 22), 555 IDE_DFLAG_LBA48 = (1 << 21),
581 /* status of write cache */ 556 /* status of write cache */
582 IDE_DFLAG_WCACHE = (1 << 23), 557 IDE_DFLAG_WCACHE = (1 << 22),
583 /* used for ignoring ATA_DF */ 558 /* used for ignoring ATA_DF */
584 IDE_DFLAG_NOWERR = (1 << 24), 559 IDE_DFLAG_NOWERR = (1 << 23),
585 /* retrying in PIO */ 560 /* retrying in PIO */
586 IDE_DFLAG_DMA_PIO_RETRY = (1 << 25), 561 IDE_DFLAG_DMA_PIO_RETRY = (1 << 24),
587 IDE_DFLAG_LBA = (1 << 26), 562 IDE_DFLAG_LBA = (1 << 25),
588 /* don't unload heads */ 563 /* don't unload heads */
589 IDE_DFLAG_NO_UNLOAD = (1 << 27), 564 IDE_DFLAG_NO_UNLOAD = (1 << 26),
590 /* heads unloaded, please don't reset port */ 565 /* heads unloaded, please don't reset port */
591 IDE_DFLAG_PARKED = (1 << 28), 566 IDE_DFLAG_PARKED = (1 << 27),
592 IDE_DFLAG_MEDIA_CHANGED = (1 << 29), 567 IDE_DFLAG_MEDIA_CHANGED = (1 << 28),
593 /* write protect */ 568 /* write protect */
594 IDE_DFLAG_WP = (1 << 30), 569 IDE_DFLAG_WP = (1 << 29),
595 IDE_DFLAG_FORMAT_IN_PROGRESS = (1 << 31), 570 IDE_DFLAG_FORMAT_IN_PROGRESS = (1 << 30),
596}; 571};
597 572
598struct ide_drive_s { 573struct ide_drive_s {
@@ -602,7 +577,6 @@ struct ide_drive_s {
602 struct request_queue *queue; /* request queue */ 577 struct request_queue *queue; /* request queue */
603 578
604 struct request *rq; /* current request */ 579 struct request *rq; /* current request */
605 struct ide_drive_s *next; /* circular list of hwgroup drives */
606 void *driver_data; /* extra driver data */ 580 void *driver_data; /* extra driver data */
607 u16 *id; /* identification info */ 581 u16 *id; /* identification info */
608#ifdef CONFIG_IDE_PROC_FS 582#ifdef CONFIG_IDE_PROC_FS
@@ -616,8 +590,6 @@ struct ide_drive_s {
616 unsigned long dev_flags; 590 unsigned long dev_flags;
617 591
618 unsigned long sleep; /* sleep until this time */ 592 unsigned long sleep; /* sleep until this time */
619 unsigned long service_start; /* time we started last request */
620 unsigned long service_time; /* service time of last request */
621 unsigned long timeout; /* max time to wait for irq */ 593 unsigned long timeout; /* max time to wait for irq */
622 594
623 special_t special; /* special action flags */ 595 special_t special; /* special action flags */
@@ -678,6 +650,8 @@ struct ide_drive_s {
678 int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *, 650 int (*pc_io_buffers)(struct ide_drive_s *, struct ide_atapi_pc *,
679 unsigned int, int); 651 unsigned int, int);
680 652
653 ide_startstop_t (*irq_handler)(struct ide_drive_s *);
654
681 unsigned long atapi_flags; 655 unsigned long atapi_flags;
682 656
683 struct ide_atapi_pc request_sense_pc; 657 struct ide_atapi_pc request_sense_pc;
@@ -700,7 +674,6 @@ struct ide_tp_ops {
700 void (*exec_command)(struct hwif_s *, u8); 674 void (*exec_command)(struct hwif_s *, u8);
701 u8 (*read_status)(struct hwif_s *); 675 u8 (*read_status)(struct hwif_s *);
702 u8 (*read_altstatus)(struct hwif_s *); 676 u8 (*read_altstatus)(struct hwif_s *);
703 u8 (*read_sff_dma_status)(struct hwif_s *);
704 677
705 void (*set_irq)(struct hwif_s *, int); 678 void (*set_irq)(struct hwif_s *, int);
706 679
@@ -761,14 +734,17 @@ struct ide_dma_ops {
761 int (*dma_test_irq)(struct ide_drive_s *); 734 int (*dma_test_irq)(struct ide_drive_s *);
762 void (*dma_lost_irq)(struct ide_drive_s *); 735 void (*dma_lost_irq)(struct ide_drive_s *);
763 void (*dma_timeout)(struct ide_drive_s *); 736 void (*dma_timeout)(struct ide_drive_s *);
737 /*
738 * The following method is optional and only required to be
739 * implemented for the SFF-8038i compatible controllers.
740 */
741 u8 (*dma_sff_read_status)(struct hwif_s *);
764}; 742};
765 743
766struct ide_host; 744struct ide_host;
767 745
768typedef struct hwif_s { 746typedef struct hwif_s {
769 struct hwif_s *next; /* for linked-list in ide_hwgroup_t */
770 struct hwif_s *mate; /* other hwif from same PCI chip */ 747 struct hwif_s *mate; /* other hwif from same PCI chip */
771 struct hwgroup_s *hwgroup; /* actually (ide_hwgroup_t *) */
772 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ 748 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */
773 749
774 struct ide_host *host; 750 struct ide_host *host;
@@ -779,7 +755,7 @@ typedef struct hwif_s {
779 755
780 unsigned long sata_scr[SATA_NR_PORTS]; 756 unsigned long sata_scr[SATA_NR_PORTS];
781 757
782 ide_drive_t drives[MAX_DRIVES]; /* drive info */ 758 ide_drive_t *devices[MAX_DRIVES + 1];
783 759
784 u8 major; /* our major number */ 760 u8 major; /* our major number */
785 u8 index; /* 0 for ide0; 1 for ide1; ... */ 761 u8 index; /* 0 for ide0; 1 for ide1; ... */
@@ -845,9 +821,7 @@ typedef struct hwif_s {
845 unsigned extra_ports; /* number of extra dma ports */ 821 unsigned extra_ports; /* number of extra dma ports */
846 822
847 unsigned present : 1; /* this interface exists */ 823 unsigned present : 1; /* this interface exists */
848 unsigned serialized : 1; /* serialized all channel operation */ 824 unsigned busy : 1; /* serializes devices on a port */
849 unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */
850 unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */
851 825
852 struct device gendev; 826 struct device gendev;
853 struct device *portdev; 827 struct device *portdev;
@@ -859,19 +833,49 @@ typedef struct hwif_s {
859#ifdef CONFIG_BLK_DEV_IDEACPI 833#ifdef CONFIG_BLK_DEV_IDEACPI
860 struct ide_acpi_hwif_link *acpidata; 834 struct ide_acpi_hwif_link *acpidata;
861#endif 835#endif
836
837 /* IRQ handler, if active */
838 ide_startstop_t (*handler)(ide_drive_t *);
839
840 /* BOOL: polling active & poll_timeout field valid */
841 unsigned int polling : 1;
842
843 /* current drive */
844 ide_drive_t *cur_dev;
845
846 /* current request */
847 struct request *rq;
848
849 /* failsafe timer */
850 struct timer_list timer;
851 /* timeout value during long polls */
852 unsigned long poll_timeout;
853 /* queried upon timeouts */
854 int (*expiry)(ide_drive_t *);
855
856 int req_gen;
857 int req_gen_timer;
858
859 spinlock_t lock;
862} ____cacheline_internodealigned_in_smp ide_hwif_t; 860} ____cacheline_internodealigned_in_smp ide_hwif_t;
863 861
864#define MAX_HOST_PORTS 4 862#define MAX_HOST_PORTS 4
865 863
866struct ide_host { 864struct ide_host {
867 ide_hwif_t *ports[MAX_HOST_PORTS]; 865 ide_hwif_t *ports[MAX_HOST_PORTS + 1];
868 unsigned int n_ports; 866 unsigned int n_ports;
869 struct device *dev[2]; 867 struct device *dev[2];
870 unsigned int (*init_chipset)(struct pci_dev *); 868 unsigned int (*init_chipset)(struct pci_dev *);
871 unsigned long host_flags; 869 unsigned long host_flags;
872 void *host_priv; 870 void *host_priv;
871 ide_hwif_t *cur_port; /* for hosts requiring serialization */
872
873 /* used for hosts requiring serialization */
874 volatile long host_busy;
873}; 875};
874 876
877#define IDE_HOST_BUSY 0
878
875/* 879/*
876 * internal ide interrupt handler type 880 * internal ide interrupt handler type
877 */ 881 */
@@ -881,38 +885,6 @@ typedef int (ide_expiry_t)(ide_drive_t *);
881/* used by ide-cd, ide-floppy, etc. */ 885/* used by ide-cd, ide-floppy, etc. */
882typedef void (xfer_func_t)(ide_drive_t *, struct request *rq, void *, unsigned); 886typedef void (xfer_func_t)(ide_drive_t *, struct request *rq, void *, unsigned);
883 887
884typedef struct hwgroup_s {
885 /* irq handler, if active */
886 ide_startstop_t (*handler)(ide_drive_t *);
887
888 /* BOOL: protects all fields below */
889 volatile int busy;
890 /* BOOL: wake us up on timer expiry */
891 unsigned int sleeping : 1;
892 /* BOOL: polling active & poll_timeout field valid */
893 unsigned int polling : 1;
894
895 /* current drive */
896 ide_drive_t *drive;
897 /* ptr to current hwif in linked-list */
898 ide_hwif_t *hwif;
899
900 /* current request */
901 struct request *rq;
902
903 /* failsafe timer */
904 struct timer_list timer;
905 /* timeout value during long polls */
906 unsigned long poll_timeout;
907 /* queried upon timeouts */
908 int (*expiry)(ide_drive_t *);
909
910 int req_gen;
911 int req_gen_timer;
912} ide_hwgroup_t;
913
914typedef struct ide_driver_s ide_driver_t;
915
916extern struct mutex ide_setting_mtx; 888extern struct mutex ide_setting_mtx;
917 889
918/* 890/*
@@ -1038,8 +1010,8 @@ void ide_proc_register_port(ide_hwif_t *);
1038void ide_proc_port_register_devices(ide_hwif_t *); 1010void ide_proc_port_register_devices(ide_hwif_t *);
1039void ide_proc_unregister_device(ide_drive_t *); 1011void ide_proc_unregister_device(ide_drive_t *);
1040void ide_proc_unregister_port(ide_hwif_t *); 1012void ide_proc_unregister_port(ide_hwif_t *);
1041void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); 1013void ide_proc_register_driver(ide_drive_t *, struct ide_driver *);
1042void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); 1014void ide_proc_unregister_driver(ide_drive_t *, struct ide_driver *);
1043 1015
1044read_proc_t proc_ide_read_capacity; 1016read_proc_t proc_ide_read_capacity;
1045read_proc_t proc_ide_read_geometry; 1017read_proc_t proc_ide_read_geometry;
@@ -1066,8 +1038,10 @@ static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; }
1066static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; } 1038static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; }
1067static inline void ide_proc_unregister_device(ide_drive_t *drive) { ; } 1039static inline void ide_proc_unregister_device(ide_drive_t *drive) { ; }
1068static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } 1040static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; }
1069static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 1041static inline void ide_proc_register_driver(ide_drive_t *drive,
1070static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 1042 struct ide_driver *driver) { ; }
1043static inline void ide_proc_unregister_driver(ide_drive_t *drive,
1044 struct ide_driver *driver) { ; }
1071#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0; 1045#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0;
1072#endif 1046#endif
1073 1047
@@ -1122,17 +1096,24 @@ enum {
1122 IDE_PM_COMPLETED, 1096 IDE_PM_COMPLETED,
1123}; 1097};
1124 1098
1099int generic_ide_suspend(struct device *, pm_message_t);
1100int generic_ide_resume(struct device *);
1101
1102void ide_complete_power_step(ide_drive_t *, struct request *);
1103ide_startstop_t ide_start_power_step(ide_drive_t *, struct request *);
1104void ide_complete_pm_request(ide_drive_t *, struct request *);
1105void ide_check_pm_state(ide_drive_t *, struct request *);
1106
1125/* 1107/*
1126 * Subdrivers support. 1108 * Subdrivers support.
1127 * 1109 *
1128 * The gendriver.owner field should be set to the module owner of this driver. 1110 * The gendriver.owner field should be set to the module owner of this driver.
1129 * The gendriver.name field should be set to the name of this driver 1111 * The gendriver.name field should be set to the name of this driver
1130 */ 1112 */
1131struct ide_driver_s { 1113struct ide_driver {
1132 const char *version; 1114 const char *version;
1133 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); 1115 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t);
1134 int (*end_request)(ide_drive_t *, int, int); 1116 int (*end_request)(ide_drive_t *, int, int);
1135 ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8);
1136 struct device_driver gen_driver; 1117 struct device_driver gen_driver;
1137 int (*probe)(ide_drive_t *); 1118 int (*probe)(ide_drive_t *);
1138 void (*remove)(ide_drive_t *); 1119 void (*remove)(ide_drive_t *);
@@ -1144,7 +1125,7 @@ struct ide_driver_s {
1144#endif 1125#endif
1145}; 1126};
1146 1127
1147#define to_ide_driver(drv) container_of(drv, ide_driver_t, gen_driver) 1128#define to_ide_driver(drv) container_of(drv, struct ide_driver, gen_driver)
1148 1129
1149int ide_device_get(ide_drive_t *); 1130int ide_device_get(ide_drive_t *);
1150void ide_device_put(ide_drive_t *); 1131void ide_device_put(ide_drive_t *);
@@ -1176,9 +1157,7 @@ void ide_execute_pkt_cmd(ide_drive_t *);
1176 1157
1177void ide_pad_transfer(ide_drive_t *, int, int); 1158void ide_pad_transfer(ide_drive_t *, int, int);
1178 1159
1179ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); 1160ide_startstop_t ide_error(ide_drive_t *, const char *, u8);
1180
1181ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat);
1182 1161
1183void ide_fix_driveid(u16 *); 1162void ide_fix_driveid(u16 *);
1184 1163
@@ -1202,7 +1181,6 @@ void ide_tf_dump(const char *, struct ide_taskfile *);
1202void ide_exec_command(ide_hwif_t *, u8); 1181void ide_exec_command(ide_hwif_t *, u8);
1203u8 ide_read_status(ide_hwif_t *); 1182u8 ide_read_status(ide_hwif_t *);
1204u8 ide_read_altstatus(ide_hwif_t *); 1183u8 ide_read_altstatus(ide_hwif_t *);
1205u8 ide_read_sff_dma_status(ide_hwif_t *);
1206 1184
1207void ide_set_irq(ide_hwif_t *, int); 1185void ide_set_irq(ide_hwif_t *, int);
1208 1186
@@ -1256,14 +1234,11 @@ int ide_set_media_lock(ide_drive_t *, struct gendisk *, int);
1256void ide_create_request_sense_cmd(ide_drive_t *, struct ide_atapi_pc *); 1234void ide_create_request_sense_cmd(ide_drive_t *, struct ide_atapi_pc *);
1257void ide_retry_pc(ide_drive_t *, struct gendisk *); 1235void ide_retry_pc(ide_drive_t *, struct gendisk *);
1258 1236
1259static inline unsigned long ide_scsi_get_timeout(struct ide_atapi_pc *pc) 1237int ide_cd_expiry(ide_drive_t *);
1260{
1261 return max_t(unsigned long, WAIT_CMD, pc->timeout - jiffies);
1262}
1263 1238
1264int ide_scsi_expiry(ide_drive_t *); 1239int ide_cd_get_xferlen(struct request *);
1265 1240
1266ide_startstop_t ide_issue_pc(ide_drive_t *, unsigned int, ide_expiry_t *); 1241ide_startstop_t ide_issue_pc(ide_drive_t *);
1267 1242
1268ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *); 1243ide_startstop_t do_rw_taskfile(ide_drive_t *, ide_task_t *);
1269 1244
@@ -1320,11 +1295,11 @@ static inline int ide_hwif_setup_dma(ide_hwif_t *hwif,
1320} 1295}
1321#endif 1296#endif
1322 1297
1323typedef struct ide_pci_enablebit_s { 1298struct ide_pci_enablebit {
1324 u8 reg; /* byte pci reg holding the enable-bit */ 1299 u8 reg; /* byte pci reg holding the enable-bit */
1325 u8 mask; /* mask to isolate the enable-bit */ 1300 u8 mask; /* mask to isolate the enable-bit */
1326 u8 val; /* value of masked reg when "enabled" */ 1301 u8 val; /* value of masked reg when "enabled" */
1327} ide_pci_enablebit_t; 1302};
1328 1303
1329enum { 1304enum {
1330 /* Uses ISA control ports not PCI ones. */ 1305 /* Uses ISA control ports not PCI ones. */
@@ -1376,8 +1351,8 @@ enum {
1376 IDE_HFLAG_LEGACY_IRQS = (1 << 21), 1351 IDE_HFLAG_LEGACY_IRQS = (1 << 21),
1377 /* force use of legacy IRQs */ 1352 /* force use of legacy IRQs */
1378 IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22), 1353 IDE_HFLAG_FORCE_LEGACY_IRQS = (1 << 22),
1379 /* limit LBA48 requests to 256 sectors */ 1354 /* host is TRM290 */
1380 IDE_HFLAG_RQSIZE_256 = (1 << 23), 1355 IDE_HFLAG_TRM290 = (1 << 23),
1381 /* use 32-bit I/O ops */ 1356 /* use 32-bit I/O ops */
1382 IDE_HFLAG_IO_32BIT = (1 << 24), 1357 IDE_HFLAG_IO_32BIT = (1 << 24),
1383 /* unmask IRQs */ 1358 /* unmask IRQs */
@@ -1413,8 +1388,12 @@ struct ide_port_info {
1413 const struct ide_port_ops *port_ops; 1388 const struct ide_port_ops *port_ops;
1414 const struct ide_dma_ops *dma_ops; 1389 const struct ide_dma_ops *dma_ops;
1415 1390
1416 ide_pci_enablebit_t enablebits[2]; 1391 struct ide_pci_enablebit enablebits[2];
1392
1417 hwif_chipset_t chipset; 1393 hwif_chipset_t chipset;
1394
1395 u16 max_sectors; /* if < than the default one */
1396
1418 u32 host_flags; 1397 u32 host_flags;
1419 u8 pio_mask; 1398 u8 pio_mask;
1420 u8 swdma_mask; 1399 u8 swdma_mask;
@@ -1482,6 +1461,7 @@ void ide_dma_exec_cmd(ide_drive_t *, u8);
1482extern void ide_dma_start(ide_drive_t *); 1461extern void ide_dma_start(ide_drive_t *);
1483int ide_dma_end(ide_drive_t *); 1462int ide_dma_end(ide_drive_t *);
1484int ide_dma_test_irq(ide_drive_t *); 1463int ide_dma_test_irq(ide_drive_t *);
1464u8 ide_dma_sff_read_status(ide_hwif_t *);
1485extern const struct ide_dma_ops sff_dma_ops; 1465extern const struct ide_dma_ops sff_dma_ops;
1486#else 1466#else
1487static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; } 1467static inline int config_drive_for_dma(ide_drive_t *drive) { return 0; }
@@ -1519,15 +1499,13 @@ static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; }
1519static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {} 1499static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
1520#endif 1500#endif
1521 1501
1522void ide_remove_port_from_hwgroup(ide_hwif_t *);
1523void ide_unregister(ide_hwif_t *);
1524
1525void ide_register_region(struct gendisk *); 1502void ide_register_region(struct gendisk *);
1526void ide_unregister_region(struct gendisk *); 1503void ide_unregister_region(struct gendisk *);
1527 1504
1528void ide_undecoded_slave(ide_drive_t *); 1505void ide_undecoded_slave(ide_drive_t *);
1529 1506
1530void ide_port_apply_params(ide_hwif_t *); 1507void ide_port_apply_params(ide_hwif_t *);
1508int ide_sysfs_register_port(ide_hwif_t *);
1531 1509
1532struct ide_host *ide_host_alloc(const struct ide_port_info *, hw_regs_t **); 1510struct ide_host *ide_host_alloc(const struct ide_port_info *, hw_regs_t **);
1533void ide_host_free(struct ide_host *); 1511void ide_host_free(struct ide_host *);
@@ -1605,23 +1583,9 @@ static inline void ide_set_max_pio(ide_drive_t *drive)
1605 ide_set_pio(drive, 255); 1583 ide_set_pio(drive, 255);
1606} 1584}
1607 1585
1608extern spinlock_t ide_lock; 1586char *ide_media_string(ide_drive_t *);
1609extern struct mutex ide_cfg_mtx;
1610/*
1611 * Structure locking:
1612 *
1613 * ide_cfg_mtx and ide_lock together protect changes to
1614 * ide_hwif_t->{next,hwgroup}
1615 * ide_drive_t->next
1616 *
1617 * ide_hwgroup_t->busy: ide_lock
1618 * ide_hwgroup_t->hwif: ide_lock
1619 * ide_hwif_t->mate: constant, no locking
1620 * ide_drive_t->hwif: constant, no locking
1621 */
1622
1623#define local_irq_set(flags) do { local_save_flags((flags)); local_irq_enable_in_hardirq(); } while (0)
1624 1587
1588extern struct device_attribute ide_dev_attrs[];
1625extern struct bus_type ide_bus_type; 1589extern struct bus_type ide_bus_type;
1626extern struct class *ide_port_class; 1590extern struct class *ide_port_class;
1627 1591
@@ -1637,8 +1601,15 @@ static inline int hwif_to_node(ide_hwif_t *hwif)
1637 1601
1638static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive) 1602static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive)
1639{ 1603{
1640 ide_drive_t *peer = &drive->hwif->drives[(drive->dn ^ 1) & 1]; 1604 ide_drive_t *peer = drive->hwif->devices[(drive->dn ^ 1) & 1];
1641 1605
1642 return (peer->dev_flags & IDE_DFLAG_PRESENT) ? peer : NULL; 1606 return (peer->dev_flags & IDE_DFLAG_PRESENT) ? peer : NULL;
1643} 1607}
1608
1609#define ide_port_for_each_dev(i, dev, port) \
1610 for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++)
1611
1612#define ide_host_for_each_port(i, port, host) \
1613 for ((i) = 0; ((port) = (host)->ports[i]) || (i) < MAX_HOST_PORTS; (i)++)
1614
1644#endif /* _IDE_H */ 1615#endif /* _IDE_H */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 14126bc36641..c4e6ca1a6306 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -12,8 +12,8 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14
15#ifndef IEEE80211_H 15#ifndef LINUX_IEEE80211_H
16#define IEEE80211_H 16#define LINUX_IEEE80211_H
17 17
18#include <linux/types.h> 18#include <linux/types.h>
19#include <asm/byteorder.h> 19#include <asm/byteorder.h>
@@ -97,7 +97,10 @@
97#define IEEE80211_MAX_FRAME_LEN 2352 97#define IEEE80211_MAX_FRAME_LEN 2352
98 98
99#define IEEE80211_MAX_SSID_LEN 32 99#define IEEE80211_MAX_SSID_LEN 32
100
100#define IEEE80211_MAX_MESH_ID_LEN 32 101#define IEEE80211_MAX_MESH_ID_LEN 32
102#define IEEE80211_MESH_CONFIG_LEN 19
103
101#define IEEE80211_QOS_CTL_LEN 2 104#define IEEE80211_QOS_CTL_LEN 2
102#define IEEE80211_QOS_CTL_TID_MASK 0x000F 105#define IEEE80211_QOS_CTL_TID_MASK 0x000F
103#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007 106#define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007
@@ -666,6 +669,13 @@ struct ieee80211_cts {
666 u8 ra[6]; 669 u8 ra[6];
667} __attribute__ ((packed)); 670} __attribute__ ((packed));
668 671
672struct ieee80211_pspoll {
673 __le16 frame_control;
674 __le16 aid;
675 u8 bssid[6];
676 u8 ta[6];
677} __attribute__ ((packed));
678
669/** 679/**
670 * struct ieee80211_bar - HT Block Ack Request 680 * struct ieee80211_bar - HT Block Ack Request
671 * 681 *
@@ -685,28 +695,88 @@ struct ieee80211_bar {
685#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000 695#define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
686#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004 696#define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004
687 697
698
699#define IEEE80211_HT_MCS_MASK_LEN 10
700
701/**
702 * struct ieee80211_mcs_info - MCS information
703 * @rx_mask: RX mask
704 * @rx_highest: highest supported RX rate
705 * @tx_params: TX parameters
706 */
707struct ieee80211_mcs_info {
708 u8 rx_mask[IEEE80211_HT_MCS_MASK_LEN];
709 __le16 rx_highest;
710 u8 tx_params;
711 u8 reserved[3];
712} __attribute__((packed));
713
714/* 802.11n HT capability MSC set */
715#define IEEE80211_HT_MCS_RX_HIGHEST_MASK 0x3ff
716#define IEEE80211_HT_MCS_TX_DEFINED 0x01
717#define IEEE80211_HT_MCS_TX_RX_DIFF 0x02
718/* value 0 == 1 stream etc */
719#define IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK 0x0C
720#define IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT 2
721#define IEEE80211_HT_MCS_TX_MAX_STREAMS 4
722#define IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION 0x10
723
724/*
725 * 802.11n D5.0 20.3.5 / 20.6 says:
726 * - indices 0 to 7 and 32 are single spatial stream
727 * - 8 to 31 are multiple spatial streams using equal modulation
728 * [8..15 for two streams, 16..23 for three and 24..31 for four]
729 * - remainder are multiple spatial streams using unequal modulation
730 */
731#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START 33
732#define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START_BYTE \
733 (IEEE80211_HT_MCS_UNEQUAL_MODULATION_START / 8)
734
688/** 735/**
689 * struct ieee80211_ht_cap - HT capabilities 736 * struct ieee80211_ht_cap - HT capabilities
690 * 737 *
691 * This structure refers to "HT capabilities element" as 738 * This structure is the "HT capabilities element" as
692 * described in 802.11n draft section 7.3.2.52 739 * described in 802.11n D5.0 7.3.2.57
693 */ 740 */
694struct ieee80211_ht_cap { 741struct ieee80211_ht_cap {
695 __le16 cap_info; 742 __le16 cap_info;
696 u8 ampdu_params_info; 743 u8 ampdu_params_info;
697 u8 supp_mcs_set[16]; 744
745 /* 16 bytes MCS information */
746 struct ieee80211_mcs_info mcs;
747
698 __le16 extended_ht_cap_info; 748 __le16 extended_ht_cap_info;
699 __le32 tx_BF_cap_info; 749 __le32 tx_BF_cap_info;
700 u8 antenna_selection_info; 750 u8 antenna_selection_info;
701} __attribute__ ((packed)); 751} __attribute__ ((packed));
702 752
753/* 802.11n HT capabilities masks (for cap_info) */
754#define IEEE80211_HT_CAP_LDPC_CODING 0x0001
755#define IEEE80211_HT_CAP_SUP_WIDTH_20_40 0x0002
756#define IEEE80211_HT_CAP_SM_PS 0x000C
757#define IEEE80211_HT_CAP_GRN_FLD 0x0010
758#define IEEE80211_HT_CAP_SGI_20 0x0020
759#define IEEE80211_HT_CAP_SGI_40 0x0040
760#define IEEE80211_HT_CAP_TX_STBC 0x0080
761#define IEEE80211_HT_CAP_RX_STBC 0x0300
762#define IEEE80211_HT_CAP_DELAY_BA 0x0400
763#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
764#define IEEE80211_HT_CAP_DSSSCCK40 0x1000
765#define IEEE80211_HT_CAP_PSMP_SUPPORT 0x2000
766#define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000
767#define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000
768
769/* 802.11n HT capability AMPDU settings (for ampdu_params_info) */
770#define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03
771#define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C
772
703/** 773/**
704 * struct ieee80211_ht_cap - HT additional information 774 * struct ieee80211_ht_info - HT information
705 * 775 *
706 * This structure refers to "HT information element" as 776 * This structure is the "HT information element" as
707 * described in 802.11n draft section 7.3.2.53 777 * described in 802.11n D5.0 7.3.2.58
708 */ 778 */
709struct ieee80211_ht_addt_info { 779struct ieee80211_ht_info {
710 u8 control_chan; 780 u8 control_chan;
711 u8 ht_param; 781 u8 ht_param;
712 __le16 operation_mode; 782 __le16 operation_mode;
@@ -714,36 +784,33 @@ struct ieee80211_ht_addt_info {
714 u8 basic_set[16]; 784 u8 basic_set[16];
715} __attribute__ ((packed)); 785} __attribute__ ((packed));
716 786
717/* 802.11n HT capabilities masks */ 787/* for ht_param */
718#define IEEE80211_HT_CAP_SUP_WIDTH 0x0002 788#define IEEE80211_HT_PARAM_CHA_SEC_OFFSET 0x03
719#define IEEE80211_HT_CAP_SM_PS 0x000C 789#define IEEE80211_HT_PARAM_CHA_SEC_NONE 0x00
720#define IEEE80211_HT_CAP_GRN_FLD 0x0010 790#define IEEE80211_HT_PARAM_CHA_SEC_ABOVE 0x01
721#define IEEE80211_HT_CAP_SGI_20 0x0020 791#define IEEE80211_HT_PARAM_CHA_SEC_BELOW 0x03
722#define IEEE80211_HT_CAP_SGI_40 0x0040 792#define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY 0x04
723#define IEEE80211_HT_CAP_DELAY_BA 0x0400 793#define IEEE80211_HT_PARAM_RIFS_MODE 0x08
724#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 794#define IEEE80211_HT_PARAM_SPSMP_SUPPORT 0x10
725#define IEEE80211_HT_CAP_DSSSCCK40 0x1000 795#define IEEE80211_HT_PARAM_SERV_INTERVAL_GRAN 0xE0
726/* 802.11n HT capability AMPDU settings */ 796
727#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03 797/* for operation_mode */
728#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C 798#define IEEE80211_HT_OP_MODE_PROTECTION 0x0003
729/* 802.11n HT capability MSC set */ 799#define IEEE80211_HT_OP_MODE_PROTECTION_NONE 0
730#define IEEE80211_SUPP_MCS_SET_UEQM 4 800#define IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER 1
731#define IEEE80211_HT_CAP_MAX_STREAMS 4 801#define IEEE80211_HT_OP_MODE_PROTECTION_20MHZ 2
732#define IEEE80211_SUPP_MCS_SET_LEN 10 802#define IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED 3
733/* maximum streams the spec allows */ 803#define IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT 0x0004
734#define IEEE80211_HT_CAP_MCS_TX_DEFINED 0x01 804#define IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT 0x0010
735#define IEEE80211_HT_CAP_MCS_TX_RX_DIFF 0x02 805
736#define IEEE80211_HT_CAP_MCS_TX_STREAMS 0x0C 806/* for stbc_param */
737#define IEEE80211_HT_CAP_MCS_TX_UEQM 0x10 807#define IEEE80211_HT_STBC_PARAM_DUAL_BEACON 0x0040
738/* 802.11n HT IE masks */ 808#define IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT 0x0080
739#define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03 809#define IEEE80211_HT_STBC_PARAM_STBC_BEACON 0x0100
740#define IEEE80211_HT_IE_CHA_SEC_NONE 0x00 810#define IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT 0x0200
741#define IEEE80211_HT_IE_CHA_SEC_ABOVE 0x01 811#define IEEE80211_HT_STBC_PARAM_PCO_ACTIVE 0x0400
742#define IEEE80211_HT_IE_CHA_SEC_BELOW 0x03 812#define IEEE80211_HT_STBC_PARAM_PCO_PHASE 0x0800
743#define IEEE80211_HT_IE_CHA_WIDTH 0x04 813
744#define IEEE80211_HT_IE_HT_PROTECTION 0x0003
745#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
746#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
747 814
748/* block-ack parameters */ 815/* block-ack parameters */
749#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 816#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
@@ -769,7 +836,6 @@ struct ieee80211_ht_addt_info {
769/* Authentication algorithms */ 836/* Authentication algorithms */
770#define WLAN_AUTH_OPEN 0 837#define WLAN_AUTH_OPEN 0
771#define WLAN_AUTH_SHARED_KEY 1 838#define WLAN_AUTH_SHARED_KEY 1
772#define WLAN_AUTH_FAST_BSS_TRANSITION 2
773#define WLAN_AUTH_LEAP 128 839#define WLAN_AUTH_LEAP 128
774 840
775#define WLAN_AUTH_CHALLENGE_LEN 128 841#define WLAN_AUTH_CHALLENGE_LEN 128
@@ -949,7 +1015,7 @@ enum ieee80211_eid {
949 WLAN_EID_EXT_SUPP_RATES = 50, 1015 WLAN_EID_EXT_SUPP_RATES = 50,
950 /* 802.11n */ 1016 /* 802.11n */
951 WLAN_EID_HT_CAPABILITY = 45, 1017 WLAN_EID_HT_CAPABILITY = 45,
952 WLAN_EID_HT_EXTRA_INFO = 61, 1018 WLAN_EID_HT_INFORMATION = 61,
953 /* 802.11i */ 1019 /* 802.11i */
954 WLAN_EID_RSN = 48, 1020 WLAN_EID_RSN = 48,
955 WLAN_EID_WPA = 221, 1021 WLAN_EID_WPA = 221,
@@ -976,6 +1042,68 @@ enum ieee80211_spectrum_mgmt_actioncode {
976 WLAN_ACTION_SPCT_CHL_SWITCH = 4, 1042 WLAN_ACTION_SPCT_CHL_SWITCH = 4,
977}; 1043};
978 1044
1045/*
1046 * IEEE 802.11-2007 7.3.2.9 Country information element
1047 *
1048 * Minimum length is 8 octets, ie len must be evenly
1049 * divisible by 2
1050 */
1051
1052/* Although the spec says 8 I'm seeing 6 in practice */
1053#define IEEE80211_COUNTRY_IE_MIN_LEN 6
1054
1055/*
1056 * For regulatory extension stuff see IEEE 802.11-2007
1057 * Annex I (page 1141) and Annex J (page 1147). Also
1058 * review 7.3.2.9.
1059 *
1060 * When dot11RegulatoryClassesRequired is true and the
1061 * first_channel/reg_extension_id is >= 201 then the IE
1062 * compromises of the 'ext' struct represented below:
1063 *
1064 * - Regulatory extension ID - when generating IE this just needs
1065 * to be monotonically increasing for each triplet passed in
1066 * the IE
1067 * - Regulatory class - index into set of rules
1068 * - Coverage class - index into air propagation time (Table 7-27),
1069 * in microseconds, you can compute the air propagation time from
1070 * the index by multiplying by 3, so index 10 yields a propagation
1071 * of 10 us. Valid values are 0-31, values 32-255 are not defined
1072 * yet. A value of 0 inicates air propagation of <= 1 us.
1073 *
1074 * See also Table I.2 for Emission limit sets and table
1075 * I.3 for Behavior limit sets. Table J.1 indicates how to map
1076 * a reg_class to an emission limit set and behavior limit set.
1077 */
1078#define IEEE80211_COUNTRY_EXTENSION_ID 201
1079
1080/*
1081 * Channels numbers in the IE must be monotonically increasing
1082 * if dot11RegulatoryClassesRequired is not true.
1083 *
1084 * If dot11RegulatoryClassesRequired is true consecutive
1085 * subband triplets following a regulatory triplet shall
1086 * have monotonically increasing first_channel number fields.
1087 *
1088 * Channel numbers shall not overlap.
1089 *
1090 * Note that max_power is signed.
1091 */
1092struct ieee80211_country_ie_triplet {
1093 union {
1094 struct {
1095 u8 first_channel;
1096 u8 num_channels;
1097 s8 max_power;
1098 } __attribute__ ((packed)) chans;
1099 struct {
1100 u8 reg_extension_id;
1101 u8 reg_class;
1102 u8 coverage_class;
1103 } __attribute__ ((packed)) ext;
1104 };
1105} __attribute__ ((packed));
1106
979/* BACK action code */ 1107/* BACK action code */
980enum ieee80211_back_actioncode { 1108enum ieee80211_back_actioncode {
981 WLAN_ACTION_ADDBA_REQ = 0, 1109 WLAN_ACTION_ADDBA_REQ = 0,
@@ -1057,4 +1185,4 @@ static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
1057 return hdr->addr1; 1185 return hdr->addr1;
1058} 1186}
1059 1187
1060#endif /* IEEE80211_H */ 1188#endif /* LINUX_IEEE80211_H */
diff --git a/include/linux/if.h b/include/linux/if.h
index 65246846c844..2a6e29620a96 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -65,6 +65,7 @@
65#define IFF_BONDING 0x20 /* bonding master or slave */ 65#define IFF_BONDING 0x20 /* bonding master or slave */
66#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */ 66#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
67#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */ 67#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */
68#define IFF_MASTER_ARPMON 0x100 /* bonding master, ARP mon in use */
68 69
69#define IF_GET_IFACE 0x0001 /* for querying only */ 70#define IF_GET_IFACE 0x0001 /* for querying only */
70#define IF_GET_PROTO 0x0002 71#define IF_GET_PROTO 0x0002
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 4d3401812e6c..5ff89809a581 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -87,6 +87,9 @@
87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */ 87#define ARPHRD_IEEE80211_PRISM 802 /* IEEE 802.11 + Prism2 header */
88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ 88#define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */
89 89
90#define ARPHRD_PHONET 820 /* PhoNet media type */
91#define ARPHRD_PHONET_PIPE 821 /* PhoNet pipe header */
92
90#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */ 93#define ARPHRD_VOID 0xFFFF /* Void type, nothing is known */
91#define ARPHRD_NONE 0xFFFE /* zero header length */ 94#define ARPHRD_NONE 0xFFFE /* zero header length */
92 95
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index a5cb0c3f6dcf..f8ff918c208f 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -115,6 +115,11 @@ extern u16 vlan_dev_vlan_id(const struct net_device *dev);
115extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, 115extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp,
116 u16 vlan_tci, int polling); 116 u16 vlan_tci, int polling);
117extern int vlan_hwaccel_do_receive(struct sk_buff *skb); 117extern int vlan_hwaccel_do_receive(struct sk_buff *skb);
118extern int vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp,
119 unsigned int vlan_tci, struct sk_buff *skb);
120extern int vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
121 unsigned int vlan_tci,
122 struct napi_gro_fraginfo *info);
118 123
119#else 124#else
120static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev) 125static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev)
@@ -140,6 +145,20 @@ static inline int vlan_hwaccel_do_receive(struct sk_buff *skb)
140{ 145{
141 return 0; 146 return 0;
142} 147}
148
149static inline int vlan_gro_receive(struct napi_struct *napi,
150 struct vlan_group *grp,
151 unsigned int vlan_tci, struct sk_buff *skb)
152{
153 return NET_RX_DROP;
154}
155
156static inline int vlan_gro_frags(struct napi_struct *napi,
157 struct vlan_group *grp, unsigned int vlan_tci,
158 struct napi_gro_fraginfo *info)
159{
160 return NET_RX_DROP;
161}
143#endif 162#endif
144 163
145/** 164/**
diff --git a/include/linux/in.h b/include/linux/in.h
index db458beef19d..d60122a3a088 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -80,6 +80,10 @@ struct in_addr {
80/* BSD compatibility */ 80/* BSD compatibility */
81#define IP_RECVRETOPTS IP_RETOPTS 81#define IP_RECVRETOPTS IP_RETOPTS
82 82
83/* TProxy original addresses */
84#define IP_ORIGDSTADDR 20
85#define IP_RECVORIGDSTADDR IP_ORIGDSTADDR
86
83/* IP_MTU_DISCOVER values */ 87/* IP_MTU_DISCOVER values */
84#define IP_PMTUDISC_DONT 0 /* Never send DF frames */ 88#define IP_PMTUDISC_DONT 0 /* Never send DF frames */
85#define IP_PMTUDISC_WANT 1 /* Use per route hints */ 89#define IP_PMTUDISC_WANT 1 /* Use per route hints */
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 6851225f44a7..9d85d9f03d18 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -12,6 +12,7 @@
12#include <net/net_namespace.h> 12#include <net/net_namespace.h>
13 13
14extern struct files_struct init_files; 14extern struct files_struct init_files;
15extern struct fs_struct init_fs;
15 16
16#define INIT_KIOCTX(name, which_mm) \ 17#define INIT_KIOCTX(name, which_mm) \
17{ \ 18{ \
@@ -57,7 +58,6 @@ extern struct nsproxy init_nsproxy;
57 .mnt_ns = NULL, \ 58 .mnt_ns = NULL, \
58 INIT_NET_NS(net_ns) \ 59 INIT_NET_NS(net_ns) \
59 INIT_IPC_NS(ipc_ns) \ 60 INIT_IPC_NS(ipc_ns) \
60 .user_ns = &init_user_ns, \
61} 61}
62 62
63#define INIT_SIGHAND(sighand) { \ 63#define INIT_SIGHAND(sighand) { \
@@ -113,6 +113,8 @@ extern struct group_info init_groups;
113# define CAP_INIT_BSET CAP_INIT_EFF_SET 113# define CAP_INIT_BSET CAP_INIT_EFF_SET
114#endif 114#endif
115 115
116extern struct cred init_cred;
117
116/* 118/*
117 * INIT_TASK is used to set up the first task table, touch at 119 * INIT_TASK is used to set up the first task table, touch at
118 * your own risk!. Base=0, limit=0x1fffff (=2MB) 120 * your own risk!. Base=0, limit=0x1fffff (=2MB)
@@ -148,13 +150,10 @@ extern struct group_info init_groups;
148 .children = LIST_HEAD_INIT(tsk.children), \ 150 .children = LIST_HEAD_INIT(tsk.children), \
149 .sibling = LIST_HEAD_INIT(tsk.sibling), \ 151 .sibling = LIST_HEAD_INIT(tsk.sibling), \
150 .group_leader = &tsk, \ 152 .group_leader = &tsk, \
151 .group_info = &init_groups, \ 153 .real_cred = &init_cred, \
152 .cap_effective = CAP_INIT_EFF_SET, \ 154 .cred = &init_cred, \
153 .cap_inheritable = CAP_INIT_INH_SET, \ 155 .cred_exec_mutex = \
154 .cap_permitted = CAP_FULL_SET, \ 156 __MUTEX_INITIALIZER(tsk.cred_exec_mutex), \
155 .cap_bset = CAP_INIT_BSET, \
156 .securebits = SECUREBITS_DEFAULT, \
157 .user = INIT_USER, \
158 .comm = "swapper", \ 157 .comm = "swapper", \
159 .thread = INIT_THREAD, \ 158 .thread = INIT_THREAD, \
160 .fs = &init_fs, \ 159 .fs = &init_fs, \
diff --git a/include/linux/input.h b/include/linux/input.h
index 5341e8251f8c..9a6355f74db2 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -659,6 +659,8 @@ struct input_absinfo {
659#define SW_RADIO SW_RFKILL_ALL /* deprecated */ 659#define SW_RADIO SW_RFKILL_ALL /* deprecated */
660#define SW_MICROPHONE_INSERT 0x04 /* set = inserted */ 660#define SW_MICROPHONE_INSERT 0x04 /* set = inserted */
661#define SW_DOCK 0x05 /* set = plugged into dock */ 661#define SW_DOCK 0x05 /* set = plugged into dock */
662#define SW_LINEOUT_INSERT 0x06 /* set = inserted */
663#define SW_JACK_PHYSICAL_INSERT 0x07 /* set = mechanical switch set */
662#define SW_MAX 0x0f 664#define SW_MAX 0x0f
663#define SW_CNT (SW_MAX+1) 665#define SW_CNT (SW_MAX+1)
664 666
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h
index 3d017cfd245b..c4f6c101dbcd 100644
--- a/include/linux/intel-iommu.h
+++ b/include/linux/intel-iommu.h
@@ -23,8 +23,6 @@
23#define _INTEL_IOMMU_H_ 23#define _INTEL_IOMMU_H_
24 24
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/msi.h>
27#include <linux/sysdev.h>
28#include <linux/iova.h> 26#include <linux/iova.h>
29#include <linux/io.h> 27#include <linux/io.h>
30#include <linux/dma_remapping.h> 28#include <linux/dma_remapping.h>
@@ -289,10 +287,10 @@ struct intel_iommu {
289 void __iomem *reg; /* Pointer to hardware regs, virtual addr */ 287 void __iomem *reg; /* Pointer to hardware regs, virtual addr */
290 u64 cap; 288 u64 cap;
291 u64 ecap; 289 u64 ecap;
292 int seg;
293 u32 gcmd; /* Holds TE, EAFL. Don't need SRTP, SFL, WBF */ 290 u32 gcmd; /* Holds TE, EAFL. Don't need SRTP, SFL, WBF */
294 spinlock_t register_lock; /* protect register handling */ 291 spinlock_t register_lock; /* protect register handling */
295 int seq_id; /* sequence id of the iommu */ 292 int seq_id; /* sequence id of the iommu */
293 int agaw; /* agaw of this iommu */
296 294
297#ifdef CONFIG_DMAR 295#ifdef CONFIG_DMAR
298 unsigned long *domain_ids; /* bitmap of domains */ 296 unsigned long *domain_ids; /* bitmap of domains */
@@ -302,8 +300,6 @@ struct intel_iommu {
302 300
303 unsigned int irq; 301 unsigned int irq;
304 unsigned char name[7]; /* Device Name */ 302 unsigned char name[7]; /* Device Name */
305 struct msi_msg saved_msg;
306 struct sys_device sysdev;
307 struct iommu_flush flush; 303 struct iommu_flush flush;
308#endif 304#endif
309 struct q_inval *qi; /* Queued invalidation info */ 305 struct q_inval *qi; /* Queued invalidation info */
@@ -334,25 +330,6 @@ extern int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr,
334 330
335extern void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); 331extern void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
336 332
337void intel_iommu_domain_exit(struct dmar_domain *domain);
338struct dmar_domain *intel_iommu_domain_alloc(struct pci_dev *pdev);
339int intel_iommu_context_mapping(struct dmar_domain *domain,
340 struct pci_dev *pdev);
341int intel_iommu_page_mapping(struct dmar_domain *domain, dma_addr_t iova,
342 u64 hpa, size_t size, int prot);
343void intel_iommu_detach_dev(struct dmar_domain *domain, u8 bus, u8 devfn);
344struct dmar_domain *intel_iommu_find_domain(struct pci_dev *pdev);
345u64 intel_iommu_iova_to_pfn(struct dmar_domain *domain, u64 iova);
346
347#ifdef CONFIG_DMAR
348int intel_iommu_found(void);
349#else /* CONFIG_DMAR */
350static inline int intel_iommu_found(void)
351{
352 return 0;
353}
354#endif /* CONFIG_DMAR */
355
356extern void *intel_alloc_coherent(struct device *, size_t, dma_addr_t *, gfp_t); 333extern void *intel_alloc_coherent(struct device *, size_t, dma_addr_t *, gfp_t);
357extern void intel_free_coherent(struct device *, size_t, void *, dma_addr_t); 334extern void intel_free_coherent(struct device *, size_t, void *, dma_addr_t);
358extern dma_addr_t intel_map_single(struct device *, phys_addr_t, size_t, int); 335extern dma_addr_t intel_map_single(struct device *, phys_addr_t, size_t, int);
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 7e85a6e89e41..9127f6b51a39 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -14,7 +14,6 @@
14#include <linux/irqflags.h> 14#include <linux/irqflags.h>
15#include <linux/smp.h> 15#include <linux/smp.h>
16#include <linux/percpu.h> 16#include <linux/percpu.h>
17#include <linux/irqnr.h>
18 17
19#include <asm/atomic.h> 18#include <asm/atomic.h>
20#include <asm/ptrace.h> 19#include <asm/ptrace.h>
@@ -109,7 +108,7 @@ extern void enable_irq(unsigned int irq);
109 108
110#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS) 109#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS)
111 110
112extern cpumask_t irq_default_affinity; 111extern cpumask_var_t irq_default_affinity;
113 112
114extern int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask); 113extern int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask);
115extern int irq_can_set_affinity(unsigned int irq); 114extern int irq_can_set_affinity(unsigned int irq);
@@ -253,10 +252,8 @@ enum
253 BLOCK_SOFTIRQ, 252 BLOCK_SOFTIRQ,
254 TASKLET_SOFTIRQ, 253 TASKLET_SOFTIRQ,
255 SCHED_SOFTIRQ, 254 SCHED_SOFTIRQ,
256#ifdef CONFIG_HIGH_RES_TIMERS
257 HRTIMER_SOFTIRQ, 255 HRTIMER_SOFTIRQ,
258#endif 256 RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */
259 RCU_SOFTIRQ, /* Preferable RCU should always be the last softirq */
260 257
261 NR_SOFTIRQS 258 NR_SOFTIRQS
262}; 259};
@@ -467,4 +464,10 @@ static inline void init_irq_proc(void)
467 464
468int show_interrupts(struct seq_file *p, void *v); 465int show_interrupts(struct seq_file *p, void *v);
469 466
467struct irq_desc;
468
469extern int early_irq_init(void);
470extern int arch_early_irq_init(void);
471extern int arch_init_chip_data(struct irq_desc *desc, int cpu);
472
470#endif 473#endif
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
new file mode 100644
index 000000000000..8a7bfb1b6ca0
--- /dev/null
+++ b/include/linux/iommu.h
@@ -0,0 +1,112 @@
1/*
2 * Copyright (C) 2007-2008 Advanced Micro Devices, Inc.
3 * Author: Joerg Roedel <joerg.roedel@amd.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published
7 * by the Free Software Foundation.
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
19#ifndef __LINUX_IOMMU_H
20#define __LINUX_IOMMU_H
21
22#define IOMMU_READ (1)
23#define IOMMU_WRITE (2)
24
25struct device;
26
27struct iommu_domain {
28 void *priv;
29};
30
31struct iommu_ops {
32 int (*domain_init)(struct iommu_domain *domain);
33 void (*domain_destroy)(struct iommu_domain *domain);
34 int (*attach_dev)(struct iommu_domain *domain, struct device *dev);
35 void (*detach_dev)(struct iommu_domain *domain, struct device *dev);
36 int (*map)(struct iommu_domain *domain, unsigned long iova,
37 phys_addr_t paddr, size_t size, int prot);
38 void (*unmap)(struct iommu_domain *domain, unsigned long iova,
39 size_t size);
40 phys_addr_t (*iova_to_phys)(struct iommu_domain *domain,
41 unsigned long iova);
42};
43
44#ifdef CONFIG_IOMMU_API
45
46extern void register_iommu(struct iommu_ops *ops);
47extern bool iommu_found(void);
48extern struct iommu_domain *iommu_domain_alloc(void);
49extern void iommu_domain_free(struct iommu_domain *domain);
50extern int iommu_attach_device(struct iommu_domain *domain,
51 struct device *dev);
52extern void iommu_detach_device(struct iommu_domain *domain,
53 struct device *dev);
54extern int iommu_map_range(struct iommu_domain *domain, unsigned long iova,
55 phys_addr_t paddr, size_t size, int prot);
56extern void iommu_unmap_range(struct iommu_domain *domain, unsigned long iova,
57 size_t size);
58extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
59 unsigned long iova);
60
61#else /* CONFIG_IOMMU_API */
62
63static inline void register_iommu(struct iommu_ops *ops)
64{
65}
66
67static inline bool iommu_found(void)
68{
69 return false;
70}
71
72static inline struct iommu_domain *iommu_domain_alloc(void)
73{
74 return NULL;
75}
76
77static inline void iommu_domain_free(struct iommu_domain *domain)
78{
79}
80
81static inline int iommu_attach_device(struct iommu_domain *domain,
82 struct device *dev)
83{
84 return -ENODEV;
85}
86
87static inline void iommu_detach_device(struct iommu_domain *domain,
88 struct device *dev)
89{
90}
91
92static inline int iommu_map_range(struct iommu_domain *domain,
93 unsigned long iova, phys_addr_t paddr,
94 size_t size, int prot)
95{
96 return -ENODEV;
97}
98
99static inline void iommu_unmap_range(struct iommu_domain *domain,
100 unsigned long iova, size_t size)
101{
102}
103
104static inline phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
105 unsigned long iova)
106{
107 return 0;
108}
109
110#endif /* CONFIG_IOMMU_API */
111
112#endif /* __LINUX_IOMMU_H */
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 041e95aac2bf..f6bb2ca8e3ba 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -49,6 +49,7 @@ struct resource_list {
49#define IORESOURCE_SIZEALIGN 0x00020000 /* size indicates alignment */ 49#define IORESOURCE_SIZEALIGN 0x00020000 /* size indicates alignment */
50#define IORESOURCE_STARTALIGN 0x00040000 /* start field is alignment */ 50#define IORESOURCE_STARTALIGN 0x00040000 /* start field is alignment */
51 51
52#define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */
52#define IORESOURCE_DISABLED 0x10000000 53#define IORESOURCE_DISABLED 0x10000000
53#define IORESOURCE_UNSET 0x20000000 54#define IORESOURCE_UNSET 0x20000000
54#define IORESOURCE_AUTO 0x40000000 55#define IORESOURCE_AUTO 0x40000000
@@ -133,13 +134,16 @@ static inline unsigned long resource_type(struct resource *res)
133} 134}
134 135
135/* Convenience shorthand with allocation */ 136/* Convenience shorthand with allocation */
136#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) 137#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0)
137#define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name)) 138#define __request_mem_region(start,n,name, excl) __request_region(&iomem_resource, (start), (n), (name), excl)
139#define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name), 0)
140#define request_mem_region_exclusive(start,n,name) \
141 __request_region(&iomem_resource, (start), (n), (name), IORESOURCE_EXCLUSIVE)
138#define rename_region(region, newname) do { (region)->name = (newname); } while (0) 142#define rename_region(region, newname) do { (region)->name = (newname); } while (0)
139 143
140extern struct resource * __request_region(struct resource *, 144extern struct resource * __request_region(struct resource *,
141 resource_size_t start, 145 resource_size_t start,
142 resource_size_t n, const char *name); 146 resource_size_t n, const char *name, int relaxed);
143 147
144/* Compatibility cruft */ 148/* Compatibility cruft */
145#define release_region(start,n) __release_region(&ioport_resource, (start), (n)) 149#define release_region(start,n) __release_region(&ioport_resource, (start), (n))
@@ -175,6 +179,7 @@ extern struct resource * __devm_request_region(struct device *dev,
175extern void __devm_release_region(struct device *dev, struct resource *parent, 179extern void __devm_release_region(struct device *dev, struct resource *parent,
176 resource_size_t start, resource_size_t n); 180 resource_size_t start, resource_size_t n);
177extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size); 181extern int iomem_map_sanity_check(resource_size_t addr, unsigned long size);
182extern int iomem_is_exclusive(u64 addr);
178 183
179#endif /* __ASSEMBLY__ */ 184#endif /* __ASSEMBLY__ */
180#endif /* _LINUX_IOPORT_H */ 185#endif /* _LINUX_IOPORT_H */
diff --git a/include/linux/ioprio.h b/include/linux/ioprio.h
index f98a656b17e5..76dad4808847 100644
--- a/include/linux/ioprio.h
+++ b/include/linux/ioprio.h
@@ -86,4 +86,6 @@ static inline int task_nice_ioclass(struct task_struct *task)
86 */ 86 */
87extern int ioprio_best(unsigned short aprio, unsigned short bprio); 87extern int ioprio_best(unsigned short aprio, unsigned short bprio);
88 88
89extern int set_task_ioprio(struct task_struct *task, int ioprio);
90
89#endif 91#endif
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 641e026eee8f..0b816cae533e 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -278,6 +278,7 @@ struct ipv6_pinfo {
278 struct in6_addr saddr; 278 struct in6_addr saddr;
279 struct in6_addr rcv_saddr; 279 struct in6_addr rcv_saddr;
280 struct in6_addr daddr; 280 struct in6_addr daddr;
281 struct in6_pktinfo sticky_pktinfo;
281 struct in6_addr *daddr_cache; 282 struct in6_addr *daddr_cache;
282#ifdef CONFIG_IPV6_SUBTREES 283#ifdef CONFIG_IPV6_SUBTREES
283 struct in6_addr *saddr_cache; 284 struct in6_addr *saddr_cache;
diff --git a/include/linux/irq.h b/include/linux/irq.h
index fde5e6132018..f899b502f186 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -135,6 +135,9 @@ struct irq_2_iommu;
135/** 135/**
136 * struct irq_desc - interrupt descriptor 136 * struct irq_desc - interrupt descriptor
137 * @irq: interrupt number for this descriptor 137 * @irq: interrupt number for this descriptor
138 * @timer_rand_state: pointer to timer rand state struct
139 * @kstat_irqs: irq stats per cpu
140 * @irq_2_iommu: iommu with this irq
138 * @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()] 141 * @handle_irq: highlevel irq-events handler [if NULL, __do_IRQ()]
139 * @chip: low level interrupt hardware access 142 * @chip: low level interrupt hardware access
140 * @msi_desc: MSI descriptor 143 * @msi_desc: MSI descriptor
@@ -146,8 +149,8 @@ struct irq_2_iommu;
146 * @depth: disable-depth, for nested irq_disable() calls 149 * @depth: disable-depth, for nested irq_disable() calls
147 * @wake_depth: enable depth, for multiple set_irq_wake() callers 150 * @wake_depth: enable depth, for multiple set_irq_wake() callers
148 * @irq_count: stats field to detect stalled irqs 151 * @irq_count: stats field to detect stalled irqs
149 * @irqs_unhandled: stats field for spurious unhandled interrupts
150 * @last_unhandled: aging timer for unhandled count 152 * @last_unhandled: aging timer for unhandled count
153 * @irqs_unhandled: stats field for spurious unhandled interrupts
151 * @lock: locking for SMP 154 * @lock: locking for SMP
152 * @affinity: IRQ affinity on SMP 155 * @affinity: IRQ affinity on SMP
153 * @cpu: cpu index useful for balancing 156 * @cpu: cpu index useful for balancing
@@ -175,8 +178,8 @@ struct irq_desc {
175 unsigned int depth; /* nested irq disables */ 178 unsigned int depth; /* nested irq disables */
176 unsigned int wake_depth; /* nested wake enables */ 179 unsigned int wake_depth; /* nested wake enables */
177 unsigned int irq_count; /* For detecting broken IRQs */ 180 unsigned int irq_count; /* For detecting broken IRQs */
178 unsigned int irqs_unhandled;
179 unsigned long last_unhandled; /* Aging timer for unhandled count */ 181 unsigned long last_unhandled; /* Aging timer for unhandled count */
182 unsigned int irqs_unhandled;
180 spinlock_t lock; 183 spinlock_t lock;
181#ifdef CONFIG_SMP 184#ifdef CONFIG_SMP
182 cpumask_t affinity; 185 cpumask_t affinity;
@@ -191,42 +194,23 @@ struct irq_desc {
191 const char *name; 194 const char *name;
192} ____cacheline_internodealigned_in_smp; 195} ____cacheline_internodealigned_in_smp;
193 196
194extern void early_irq_init(void);
195extern void arch_early_irq_init(void);
196extern void arch_init_chip_data(struct irq_desc *desc, int cpu);
197extern void arch_init_copy_chip_data(struct irq_desc *old_desc, 197extern void arch_init_copy_chip_data(struct irq_desc *old_desc,
198 struct irq_desc *desc, int cpu); 198 struct irq_desc *desc, int cpu);
199extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc); 199extern void arch_free_chip_data(struct irq_desc *old_desc, struct irq_desc *desc);
200 200
201#ifndef CONFIG_SPARSE_IRQ 201#ifndef CONFIG_SPARSE_IRQ
202extern struct irq_desc irq_desc[NR_IRQS]; 202extern struct irq_desc irq_desc[NR_IRQS];
203 203#else /* CONFIG_SPARSE_IRQ */
204static inline struct irq_desc *irq_to_desc(unsigned int irq)
205{
206 return (irq < NR_IRQS) ? irq_desc + irq : NULL;
207}
208static inline struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu)
209{
210 return irq_to_desc(irq);
211}
212
213#else
214
215extern struct irq_desc *irq_to_desc(unsigned int irq);
216extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu);
217extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu); 204extern struct irq_desc *move_irq_desc(struct irq_desc *old_desc, int cpu);
218 205
219# define for_each_irq_desc(irq, desc) \
220 for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; irq++, desc = irq_to_desc(irq))
221# define for_each_irq_desc_reverse(irq, desc) \
222 for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; irq--, desc = irq_to_desc(irq))
223
224#define kstat_irqs_this_cpu(DESC) \ 206#define kstat_irqs_this_cpu(DESC) \
225 ((DESC)->kstat_irqs[smp_processor_id()]) 207 ((DESC)->kstat_irqs[smp_processor_id()])
226#define kstat_incr_irqs_this_cpu(irqno, DESC) \ 208#define kstat_incr_irqs_this_cpu(irqno, DESC) \
227 ((DESC)->kstat_irqs[smp_processor_id()]++) 209 ((DESC)->kstat_irqs[smp_processor_id()]++)
228 210
229#endif 211#endif /* CONFIG_SPARSE_IRQ */
212
213extern struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu);
230 214
231static inline struct irq_desc * 215static inline struct irq_desc *
232irq_remap_to_desc(unsigned int irq, struct irq_desc *desc) 216irq_remap_to_desc(unsigned int irq, struct irq_desc *desc)
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h
index 95d2b74641f5..86af92e9e84c 100644
--- a/include/linux/irqnr.h
+++ b/include/linux/irqnr.h
@@ -8,27 +8,35 @@
8 8
9#ifndef CONFIG_GENERIC_HARDIRQS 9#ifndef CONFIG_GENERIC_HARDIRQS
10#include <asm/irq.h> 10#include <asm/irq.h>
11# define nr_irqs NR_IRQS 11
12/*
13 * Wrappers for non-genirq architectures:
14 */
15#define nr_irqs NR_IRQS
16#define irq_to_desc(irq) (&irq_desc[irq])
12 17
13# define for_each_irq_desc(irq, desc) \ 18# define for_each_irq_desc(irq, desc) \
14 for (irq = 0; irq < nr_irqs; irq++) 19 for (irq = 0; irq < nr_irqs; irq++)
15 20
16# define for_each_irq_desc_reverse(irq, desc) \ 21# define for_each_irq_desc_reverse(irq, desc) \
17 for (irq = nr_irqs - 1; irq >= 0; irq--) 22 for (irq = nr_irqs - 1; irq >= 0; irq--)
18#else 23#else /* CONFIG_GENERIC_HARDIRQS */
19 24
20extern int nr_irqs; 25extern int nr_irqs;
26extern struct irq_desc *irq_to_desc(unsigned int irq);
21 27
22#ifndef CONFIG_SPARSE_IRQ 28# define for_each_irq_desc(irq, desc) \
29 for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \
30 irq++, desc = irq_to_desc(irq)) \
31 if (desc)
23 32
24struct irq_desc; 33
25# define for_each_irq_desc(irq, desc) \ 34# define for_each_irq_desc_reverse(irq, desc) \
26 for (irq = 0, desc = irq_desc; irq < nr_irqs; irq++, desc++) 35 for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \
27# define for_each_irq_desc_reverse(irq, desc) \ 36 irq--, desc = irq_to_desc(irq)) \
28 for (irq = nr_irqs - 1, desc = irq_desc + (nr_irqs - 1); \ 37 if (desc)
29 irq >= 0; irq--, desc--) 38
30#endif 39#endif /* CONFIG_GENERIC_HARDIRQS */
31#endif
32 40
33#define for_each_irq_nr(irq) \ 41#define for_each_irq_nr(irq) \
34 for (irq = 0; irq < nr_irqs; irq++) 42 for (irq = 0; irq < nr_irqs; irq++)
diff --git a/include/linux/istallion.h b/include/linux/istallion.h
index 0d1840723249..7faca98c7d14 100644
--- a/include/linux/istallion.h
+++ b/include/linux/istallion.h
@@ -59,9 +59,7 @@ struct stliport {
59 unsigned int devnr; 59 unsigned int devnr;
60 int baud_base; 60 int baud_base;
61 int custom_divisor; 61 int custom_divisor;
62 int close_delay;
63 int closing_wait; 62 int closing_wait;
64 int openwaitcnt;
65 int rc; 63 int rc;
66 int argsize; 64 int argsize;
67 void *argp; 65 void *argp;
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 346e2b80be7d..6384b19efe64 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -543,6 +543,11 @@ struct transaction_s
543 unsigned long t_expires; 543 unsigned long t_expires;
544 544
545 /* 545 /*
546 * When this transaction started, in nanoseconds [no locking]
547 */
548 ktime_t t_start_time;
549
550 /*
546 * How many handles used this transaction? [t_handle_lock] 551 * How many handles used this transaction? [t_handle_lock]
547 */ 552 */
548 int t_handle_count; 553 int t_handle_count;
@@ -798,9 +803,19 @@ struct journal_s
798 struct buffer_head **j_wbuf; 803 struct buffer_head **j_wbuf;
799 int j_wbufsize; 804 int j_wbufsize;
800 805
806 /*
807 * this is the pid of the last person to run a synchronous operation
808 * through the journal.
809 */
801 pid_t j_last_sync_writer; 810 pid_t j_last_sync_writer;
802 811
803 /* 812 /*
813 * the average amount of time in nanoseconds it takes to commit a
814 * transaction to the disk. [j_state_lock]
815 */
816 u64 j_average_commit_time;
817
818 /*
804 * An opaque pointer to fs-private information. ext3 puts its 819 * An opaque pointer to fs-private information. ext3 puts its
805 * superblock pointer here 820 * superblock pointer here
806 */ 821 */
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index c7d106ef22e2..b45109c61fba 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -329,6 +329,7 @@ enum jbd_state_bits {
329 BH_State, /* Pins most journal_head state */ 329 BH_State, /* Pins most journal_head state */
330 BH_JournalHead, /* Pins bh->b_private and jh->b_bh */ 330 BH_JournalHead, /* Pins bh->b_private and jh->b_bh */
331 BH_Unshadow, /* Dummy bit, for BJ_Shadow wakeup filtering */ 331 BH_Unshadow, /* Dummy bit, for BJ_Shadow wakeup filtering */
332 BH_JBDPrivateStart, /* First bit available for private use by FS */
332}; 333};
333 334
334BUFFER_FNS(JBD, jbd) 335BUFFER_FNS(JBD, jbd)
@@ -637,6 +638,11 @@ struct transaction_s
637 unsigned long t_expires; 638 unsigned long t_expires;
638 639
639 /* 640 /*
641 * When this transaction started, in nanoseconds [no locking]
642 */
643 ktime_t t_start_time;
644
645 /*
640 * How many handles used this transaction? [t_handle_lock] 646 * How many handles used this transaction? [t_handle_lock]
641 */ 647 */
642 int t_handle_count; 648 int t_handle_count;
@@ -681,6 +687,8 @@ jbd2_time_diff(unsigned long start, unsigned long end)
681 return end + (MAX_JIFFY_OFFSET - start); 687 return end + (MAX_JIFFY_OFFSET - start);
682} 688}
683 689
690#define JBD2_NR_BATCH 64
691
684/** 692/**
685 * struct journal_s - The journal_s type is the concrete type associated with 693 * struct journal_s - The journal_s type is the concrete type associated with
686 * journal_t. 694 * journal_t.
@@ -825,6 +833,14 @@ struct journal_s
825 struct mutex j_checkpoint_mutex; 833 struct mutex j_checkpoint_mutex;
826 834
827 /* 835 /*
836 * List of buffer heads used by the checkpoint routine. This
837 * was moved from jbd2_log_do_checkpoint() to reduce stack
838 * usage. Access to this array is controlled by the
839 * j_checkpoint_mutex. [j_checkpoint_mutex]
840 */
841 struct buffer_head *j_chkpt_bhs[JBD2_NR_BATCH];
842
843 /*
828 * Journal head: identifies the first unused block in the journal. 844 * Journal head: identifies the first unused block in the journal.
829 * [j_state_lock] 845 * [j_state_lock]
830 */ 846 */
@@ -938,8 +954,26 @@ struct journal_s
938 struct buffer_head **j_wbuf; 954 struct buffer_head **j_wbuf;
939 int j_wbufsize; 955 int j_wbufsize;
940 956
957 /*
958 * this is the pid of hte last person to run a synchronous operation
959 * through the journal
960 */
941 pid_t j_last_sync_writer; 961 pid_t j_last_sync_writer;
942 962
963 /*
964 * the average amount of time in nanoseconds it takes to commit a
965 * transaction to disk. [j_state_lock]
966 */
967 u64 j_average_commit_time;
968
969 /*
970 * minimum and maximum times that we should wait for
971 * additional filesystem operations to get batched into a
972 * synchronous handle in microseconds
973 */
974 u32 j_min_batch_time;
975 u32 j_max_batch_time;
976
943 /* This function is called when a transaction is closed */ 977 /* This function is called when a transaction is closed */
944 void (*j_commit_callback)(journal_t *, 978 void (*j_commit_callback)(journal_t *,
945 transaction_t *); 979 transaction_t *);
@@ -1007,6 +1041,35 @@ int __jbd2_journal_clean_checkpoint_list(journal_t *journal);
1007int __jbd2_journal_remove_checkpoint(struct journal_head *); 1041int __jbd2_journal_remove_checkpoint(struct journal_head *);
1008void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *); 1042void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *);
1009 1043
1044
1045/*
1046 * Triggers
1047 */
1048
1049struct jbd2_buffer_trigger_type {
1050 /*
1051 * Fired just before a buffer is written to the journal.
1052 * mapped_data is a mapped buffer that is the frozen data for
1053 * commit.
1054 */
1055 void (*t_commit)(struct jbd2_buffer_trigger_type *type,
1056 struct buffer_head *bh, void *mapped_data,
1057 size_t size);
1058
1059 /*
1060 * Fired during journal abort for dirty buffers that will not be
1061 * committed.
1062 */
1063 void (*t_abort)(struct jbd2_buffer_trigger_type *type,
1064 struct buffer_head *bh);
1065};
1066
1067extern void jbd2_buffer_commit_trigger(struct journal_head *jh,
1068 void *mapped_data,
1069 struct jbd2_buffer_trigger_type *triggers);
1070extern void jbd2_buffer_abort_trigger(struct journal_head *jh,
1071 struct jbd2_buffer_trigger_type *triggers);
1072
1010/* Buffer IO */ 1073/* Buffer IO */
1011extern int 1074extern int
1012jbd2_journal_write_metadata_buffer(transaction_t *transaction, 1075jbd2_journal_write_metadata_buffer(transaction_t *transaction,
@@ -1045,6 +1108,8 @@ extern int jbd2_journal_extend (handle_t *, int nblocks);
1045extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); 1108extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *);
1046extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); 1109extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *);
1047extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *); 1110extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *);
1111void jbd2_journal_set_triggers(struct buffer_head *,
1112 struct jbd2_buffer_trigger_type *type);
1048extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); 1113extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);
1049extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *); 1114extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *);
1050extern int jbd2_journal_forget (handle_t *, struct buffer_head *); 1115extern int jbd2_journal_forget (handle_t *, struct buffer_head *);
@@ -1070,7 +1135,6 @@ extern int jbd2_journal_set_features
1070 (journal_t *, unsigned long, unsigned long, unsigned long); 1135 (journal_t *, unsigned long, unsigned long, unsigned long);
1071extern void jbd2_journal_clear_features 1136extern void jbd2_journal_clear_features
1072 (journal_t *, unsigned long, unsigned long, unsigned long); 1137 (journal_t *, unsigned long, unsigned long, unsigned long);
1073extern int jbd2_journal_create (journal_t *);
1074extern int jbd2_journal_load (journal_t *journal); 1138extern int jbd2_journal_load (journal_t *journal);
1075extern int jbd2_journal_destroy (journal_t *); 1139extern int jbd2_journal_destroy (journal_t *);
1076extern int jbd2_journal_recover (journal_t *journal); 1140extern int jbd2_journal_recover (journal_t *journal);
@@ -1145,8 +1209,8 @@ int jbd2_log_wait_commit(journal_t *journal, tid_t tid);
1145int jbd2_log_do_checkpoint(journal_t *journal); 1209int jbd2_log_do_checkpoint(journal_t *journal);
1146 1210
1147void __jbd2_log_wait_for_space(journal_t *journal); 1211void __jbd2_log_wait_for_space(journal_t *journal);
1148extern void __jbd2_journal_drop_transaction(journal_t *, transaction_t *); 1212extern void __jbd2_journal_drop_transaction(journal_t *, transaction_t *);
1149extern int jbd2_cleanup_journal_tail(journal_t *); 1213extern int jbd2_cleanup_journal_tail(journal_t *);
1150 1214
1151/* Debugging code only: */ 1215/* Debugging code only: */
1152 1216
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index abb6ac639e8e..1a9cf78bfce5 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -115,10 +115,20 @@ static inline u64 get_jiffies_64(void)
115 ((long)(a) - (long)(b) >= 0)) 115 ((long)(a) - (long)(b) >= 0))
116#define time_before_eq(a,b) time_after_eq(b,a) 116#define time_before_eq(a,b) time_after_eq(b,a)
117 117
118/*
119 * Calculate whether a is in the range of [b, c].
120 */
118#define time_in_range(a,b,c) \ 121#define time_in_range(a,b,c) \
119 (time_after_eq(a,b) && \ 122 (time_after_eq(a,b) && \
120 time_before_eq(a,c)) 123 time_before_eq(a,c))
121 124
125/*
126 * Calculate whether a is in the range of [b, c).
127 */
128#define time_in_range_open(a,b,c) \
129 (time_after_eq(a,b) && \
130 time_before(a,c))
131
122/* Same as above, but does so with platform independent 64bit types. 132/* Same as above, but does so with platform independent 64bit types.
123 * These must be used when utilizing jiffies_64 (i.e. return value of 133 * These must be used when utilizing jiffies_64 (i.e. return value of
124 * get_jiffies_64() */ 134 * get_jiffies_64() */
diff --git a/include/linux/journal-head.h b/include/linux/journal-head.h
index bb70ebb6a2d5..525aac3c97df 100644
--- a/include/linux/journal-head.h
+++ b/include/linux/journal-head.h
@@ -12,6 +12,8 @@
12 12
13typedef unsigned int tid_t; /* Unique transaction ID */ 13typedef unsigned int tid_t; /* Unique transaction ID */
14typedef struct transaction_s transaction_t; /* Compound transaction type */ 14typedef struct transaction_s transaction_t; /* Compound transaction type */
15
16
15struct buffer_head; 17struct buffer_head;
16 18
17struct journal_head { 19struct journal_head {
@@ -87,6 +89,12 @@ struct journal_head {
87 * [j_list_lock] 89 * [j_list_lock]
88 */ 90 */
89 struct journal_head *b_cpnext, *b_cpprev; 91 struct journal_head *b_cpnext, *b_cpprev;
92
93 /* Trigger type */
94 struct jbd2_buffer_trigger_type *b_triggers;
95
96 /* Trigger type for the committing transaction's frozen data */
97 struct jbd2_buffer_trigger_type *b_frozen_triggers;
90}; 98};
91 99
92#endif /* JOURNAL_HEAD_H_INCLUDED */ 100#endif /* JOURNAL_HEAD_H_INCLUDED */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 269df5a17b30..343df9ef2412 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -48,6 +48,12 @@ extern const char linux_proc_banner[];
48#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) 48#define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
49#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) 49#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
50#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) 50#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
51#define DIV_ROUND_CLOSEST(x, divisor)( \
52{ \
53 typeof(divisor) __divisor = divisor; \
54 (((x) + ((__divisor) / 2)) / (__divisor)); \
55} \
56)
51 57
52#define _RET_IP_ (unsigned long)__builtin_return_address(0) 58#define _RET_IP_ (unsigned long)__builtin_return_address(0)
53#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) 59#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
@@ -349,13 +355,13 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
349 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) 355 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
350 356
351/* If you are writing a driver, please use dev_dbg instead */ 357/* If you are writing a driver, please use dev_dbg instead */
352#if defined(CONFIG_DYNAMIC_PRINTK_DEBUG) 358#if defined(DEBUG)
359#define pr_debug(fmt, ...) \
360 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
361#elif defined(CONFIG_DYNAMIC_PRINTK_DEBUG)
353#define pr_debug(fmt, ...) do { \ 362#define pr_debug(fmt, ...) do { \
354 dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \ 363 dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \
355 } while (0) 364 } while (0)
356#elif defined(DEBUG)
357#define pr_debug(fmt, ...) \
358 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
359#else 365#else
360#define pr_debug(fmt, ...) \ 366#define pr_debug(fmt, ...) \
361 ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; }) 367 ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
@@ -372,18 +378,6 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
372 ((unsigned char *)&addr)[3] 378 ((unsigned char *)&addr)[3]
373#define NIPQUAD_FMT "%u.%u.%u.%u" 379#define NIPQUAD_FMT "%u.%u.%u.%u"
374 380
375#define NIP6(addr) \
376 ntohs((addr).s6_addr16[0]), \
377 ntohs((addr).s6_addr16[1]), \
378 ntohs((addr).s6_addr16[2]), \
379 ntohs((addr).s6_addr16[3]), \
380 ntohs((addr).s6_addr16[4]), \
381 ntohs((addr).s6_addr16[5]), \
382 ntohs((addr).s6_addr16[6]), \
383 ntohs((addr).s6_addr16[7])
384#define NIP6_FMT "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x"
385#define NIP6_SEQFMT "%04x%04x%04x%04x%04x%04x%04x%04x"
386
387#if defined(__LITTLE_ENDIAN) 381#if defined(__LITTLE_ENDIAN)
388#define HIPQUAD(addr) \ 382#define HIPQUAD(addr) \
389 ((unsigned char *)&addr)[3], \ 383 ((unsigned char *)&addr)[3], \
@@ -482,6 +476,12 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
482 __val = __val < __min ? __min: __val; \ 476 __val = __val < __min ? __min: __val; \
483 __val > __max ? __max: __val; }) 477 __val > __max ? __max: __val; })
484 478
479
480/*
481 * swap - swap value of @a and @b
482 */
483#define swap(a, b) ({ typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; })
484
485/** 485/**
486 * container_of - cast a member of a structure out to the containing structure 486 * container_of - cast a member of a structure out to the containing structure
487 * @ptr: the pointer to the member. 487 * @ptr: the pointer to the member.
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 4ee4b3d2316f..570d20413119 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -79,10 +79,13 @@ static inline unsigned int kstat_irqs(unsigned int irq)
79} 79}
80 80
81extern unsigned long long task_delta_exec(struct task_struct *); 81extern unsigned long long task_delta_exec(struct task_struct *);
82extern void account_user_time(struct task_struct *, cputime_t); 82extern void account_user_time(struct task_struct *, cputime_t, cputime_t);
83extern void account_user_time_scaled(struct task_struct *, cputime_t); 83extern void account_system_time(struct task_struct *, int, cputime_t, cputime_t);
84extern void account_system_time(struct task_struct *, int, cputime_t); 84extern void account_steal_time(cputime_t);
85extern void account_system_time_scaled(struct task_struct *, cputime_t); 85extern void account_idle_time(cputime_t);
86extern void account_steal_time(struct task_struct *, cputime_t); 86
87extern void account_process_tick(struct task_struct *, int user);
88extern void account_steal_ticks(unsigned long ticks);
89extern void account_idle_ticks(unsigned long ticks);
87 90
88#endif /* _LINUX_KERNEL_STAT_H */ 91#endif /* _LINUX_KERNEL_STAT_H */
diff --git a/include/linux/key-ui.h b/include/linux/key-ui.h
deleted file mode 100644
index e8b8a7a5c496..000000000000
--- a/include/linux/key-ui.h
+++ /dev/null
@@ -1,66 +0,0 @@
1/* key-ui.h: key userspace interface stuff
2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_KEY_UI_H
13#define _LINUX_KEY_UI_H
14
15#include <linux/key.h>
16
17/* the key tree */
18extern struct rb_root key_serial_tree;
19extern spinlock_t key_serial_lock;
20
21/* required permissions */
22#define KEY_VIEW 0x01 /* require permission to view attributes */
23#define KEY_READ 0x02 /* require permission to read content */
24#define KEY_WRITE 0x04 /* require permission to update / modify */
25#define KEY_SEARCH 0x08 /* require permission to search (keyring) or find (key) */
26#define KEY_LINK 0x10 /* require permission to link */
27#define KEY_SETATTR 0x20 /* require permission to change attributes */
28#define KEY_ALL 0x3f /* all the above permissions */
29
30/*
31 * the keyring payload contains a list of the keys to which the keyring is
32 * subscribed
33 */
34struct keyring_list {
35 struct rcu_head rcu; /* RCU deletion hook */
36 unsigned short maxkeys; /* max keys this list can hold */
37 unsigned short nkeys; /* number of keys currently held */
38 unsigned short delkey; /* key to be unlinked by RCU */
39 struct key *keys[0];
40};
41
42/*
43 * check to see whether permission is granted to use a key in the desired way
44 */
45extern int key_task_permission(const key_ref_t key_ref,
46 struct task_struct *context,
47 key_perm_t perm);
48
49static inline int key_permission(const key_ref_t key_ref, key_perm_t perm)
50{
51 return key_task_permission(key_ref, current, perm);
52}
53
54extern key_ref_t lookup_user_key(struct task_struct *context,
55 key_serial_t id, int create, int partial,
56 key_perm_t perm);
57
58extern long join_session_keyring(const char *name);
59
60extern struct key_type *key_type_lookup(const char *type);
61extern void key_type_put(struct key_type *ktype);
62
63#define key_negative_timeout 60 /* default timeout on a negative key's existence */
64
65
66#endif /* _LINUX_KEY_UI_H */
diff --git a/include/linux/key.h b/include/linux/key.h
index 1b70e35a71e3..21d32a142c00 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -73,6 +73,7 @@ struct key;
73struct seq_file; 73struct seq_file;
74struct user_struct; 74struct user_struct;
75struct signal_struct; 75struct signal_struct;
76struct cred;
76 77
77struct key_type; 78struct key_type;
78struct key_owner; 79struct key_owner;
@@ -181,7 +182,7 @@ struct key {
181extern struct key *key_alloc(struct key_type *type, 182extern struct key *key_alloc(struct key_type *type,
182 const char *desc, 183 const char *desc,
183 uid_t uid, gid_t gid, 184 uid_t uid, gid_t gid,
184 struct task_struct *ctx, 185 const struct cred *cred,
185 key_perm_t perm, 186 key_perm_t perm,
186 unsigned long flags); 187 unsigned long flags);
187 188
@@ -249,7 +250,7 @@ extern int key_unlink(struct key *keyring,
249 struct key *key); 250 struct key *key);
250 251
251extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid, 252extern struct key *keyring_alloc(const char *description, uid_t uid, gid_t gid,
252 struct task_struct *ctx, 253 const struct cred *cred,
253 unsigned long flags, 254 unsigned long flags,
254 struct key *dest); 255 struct key *dest);
255 256
@@ -276,24 +277,11 @@ extern ctl_table key_sysctls[];
276/* 277/*
277 * the userspace interface 278 * the userspace interface
278 */ 279 */
279extern void switch_uid_keyring(struct user_struct *new_user); 280extern int install_thread_keyring_to_cred(struct cred *cred);
280extern int copy_keys(unsigned long clone_flags, struct task_struct *tsk);
281extern int copy_thread_group_keys(struct task_struct *tsk);
282extern void exit_keys(struct task_struct *tsk);
283extern void exit_thread_group_keys(struct signal_struct *tg);
284extern int suid_keys(struct task_struct *tsk);
285extern int exec_keys(struct task_struct *tsk);
286extern void key_fsuid_changed(struct task_struct *tsk); 281extern void key_fsuid_changed(struct task_struct *tsk);
287extern void key_fsgid_changed(struct task_struct *tsk); 282extern void key_fsgid_changed(struct task_struct *tsk);
288extern void key_init(void); 283extern void key_init(void);
289 284
290#define __install_session_keyring(tsk, keyring) \
291({ \
292 struct key *old_session = tsk->signal->session_keyring; \
293 tsk->signal->session_keyring = keyring; \
294 old_session; \
295})
296
297#else /* CONFIG_KEYS */ 285#else /* CONFIG_KEYS */
298 286
299#define key_validate(k) 0 287#define key_validate(k) 0
@@ -302,17 +290,9 @@ extern void key_init(void);
302#define key_revoke(k) do { } while(0) 290#define key_revoke(k) do { } while(0)
303#define key_put(k) do { } while(0) 291#define key_put(k) do { } while(0)
304#define key_ref_put(k) do { } while(0) 292#define key_ref_put(k) do { } while(0)
305#define make_key_ref(k, p) ({ NULL; }) 293#define make_key_ref(k, p) NULL
306#define key_ref_to_ptr(k) ({ NULL; }) 294#define key_ref_to_ptr(k) NULL
307#define is_key_possessed(k) 0 295#define is_key_possessed(k) 0
308#define switch_uid_keyring(u) do { } while(0)
309#define __install_session_keyring(t, k) ({ NULL; })
310#define copy_keys(f,t) 0
311#define copy_thread_group_keys(t) 0
312#define exit_keys(t) do { } while(0)
313#define exit_thread_group_keys(tg) do { } while(0)
314#define suid_keys(t) do { } while(0)
315#define exec_keys(t) do { } while(0)
316#define key_fsuid_changed(t) do { } while(0) 296#define key_fsuid_changed(t) do { } while(0)
317#define key_fsgid_changed(t) do { } while(0) 297#define key_fsgid_changed(t) do { } while(0)
318#define key_init() do { } while(0) 298#define key_init() do { } while(0)
diff --git a/include/linux/keyctl.h b/include/linux/keyctl.h
index 656ee6b77a4a..c0688eb72093 100644
--- a/include/linux/keyctl.h
+++ b/include/linux/keyctl.h
@@ -1,6 +1,6 @@
1/* keyctl.h: keyctl command IDs 1/* keyctl.h: keyctl command IDs
2 * 2 *
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. 3 * Copyright (C) 2004, 2008 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 4 * Written by David Howells (dhowells@redhat.com)
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -20,6 +20,7 @@
20#define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */ 20#define KEY_SPEC_USER_SESSION_KEYRING -5 /* - key ID for UID-session keyring */
21#define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */ 21#define KEY_SPEC_GROUP_KEYRING -6 /* - key ID for GID-specific keyring */
22#define KEY_SPEC_REQKEY_AUTH_KEY -7 /* - key ID for assumed request_key auth key */ 22#define KEY_SPEC_REQKEY_AUTH_KEY -7 /* - key ID for assumed request_key auth key */
23#define KEY_SPEC_REQUESTOR_KEYRING -8 /* - key ID for request_key() dest keyring */
23 24
24/* request-key default keyrings */ 25/* request-key default keyrings */
25#define KEY_REQKEY_DEFL_NO_CHANGE -1 26#define KEY_REQKEY_DEFL_NO_CHANGE -1
@@ -30,6 +31,7 @@
30#define KEY_REQKEY_DEFL_USER_KEYRING 4 31#define KEY_REQKEY_DEFL_USER_KEYRING 4
31#define KEY_REQKEY_DEFL_USER_SESSION_KEYRING 5 32#define KEY_REQKEY_DEFL_USER_SESSION_KEYRING 5
32#define KEY_REQKEY_DEFL_GROUP_KEYRING 6 33#define KEY_REQKEY_DEFL_GROUP_KEYRING 6
34#define KEY_REQKEY_DEFL_REQUESTOR_KEYRING 7
33 35
34/* keyctl commands */ 36/* keyctl commands */
35#define KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */ 37#define KEYCTL_GET_KEYRING_ID 0 /* ask for a keyring's ID */
diff --git a/include/linux/klist.h b/include/linux/klist.h
index 8ea98db223e5..d5a27af9dba5 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -13,7 +13,6 @@
13#define _LINUX_KLIST_H 13#define _LINUX_KLIST_H
14 14
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16#include <linux/completion.h>
17#include <linux/kref.h> 16#include <linux/kref.h>
18#include <linux/list.h> 17#include <linux/list.h>
19 18
@@ -41,7 +40,6 @@ struct klist_node {
41 void *n_klist; /* never access directly */ 40 void *n_klist; /* never access directly */
42 struct list_head n_node; 41 struct list_head n_node;
43 struct kref n_ref; 42 struct kref n_ref;
44 struct completion n_removed;
45}; 43};
46 44
47extern void klist_add_tail(struct klist_node *n, struct klist *k); 45extern void klist_add_tail(struct klist_node *n, struct klist *k);
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 497b1d1f7a05..d6ea19e314bb 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -69,9 +69,6 @@ struct kprobe {
69 /* list of kprobes for multi-handler support */ 69 /* list of kprobes for multi-handler support */
70 struct list_head list; 70 struct list_head list;
71 71
72 /* Indicates that the corresponding module has been ref counted */
73 unsigned int mod_refcounted;
74
75 /*count the number of times this probe was temporarily disarmed */ 72 /*count the number of times this probe was temporarily disarmed */
76 unsigned long nmissed; 73 unsigned long nmissed;
77 74
@@ -103,8 +100,19 @@ struct kprobe {
103 100
104 /* copy of the original instruction */ 101 /* copy of the original instruction */
105 struct arch_specific_insn ainsn; 102 struct arch_specific_insn ainsn;
103
104 /* Indicates various status flags. Protected by kprobe_mutex. */
105 u32 flags;
106}; 106};
107 107
108/* Kprobe status flags */
109#define KPROBE_FLAG_GONE 1 /* breakpoint has already gone */
110
111static inline int kprobe_gone(struct kprobe *p)
112{
113 return p->flags & KPROBE_FLAG_GONE;
114}
115
108/* 116/*
109 * Special probe type that uses setjmp-longjmp type tricks to resume 117 * Special probe type that uses setjmp-longjmp type tricks to resume
110 * execution at a specified entry with a matching prototype corresponding 118 * execution at a specified entry with a matching prototype corresponding
@@ -201,7 +209,6 @@ static inline int init_test_probes(void)
201} 209}
202#endif /* CONFIG_KPROBES_SANITY_TEST */ 210#endif /* CONFIG_KPROBES_SANITY_TEST */
203 211
204extern struct mutex kprobe_mutex;
205extern int arch_prepare_kprobe(struct kprobe *p); 212extern int arch_prepare_kprobe(struct kprobe *p);
206extern void arch_arm_kprobe(struct kprobe *p); 213extern void arch_arm_kprobe(struct kprobe *p);
207extern void arch_disarm_kprobe(struct kprobe *p); 214extern void arch_disarm_kprobe(struct kprobe *p);
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index f18b86fa8655..35525ac63337 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -83,6 +83,7 @@ struct kvm_irqchip {
83#define KVM_EXIT_S390_SIEIC 13 83#define KVM_EXIT_S390_SIEIC 13
84#define KVM_EXIT_S390_RESET 14 84#define KVM_EXIT_S390_RESET 14
85#define KVM_EXIT_DCR 15 85#define KVM_EXIT_DCR 15
86#define KVM_EXIT_NMI 16
86 87
87/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ 88/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */
88struct kvm_run { 89struct kvm_run {
@@ -387,6 +388,14 @@ struct kvm_trace_rec {
387#define KVM_CAP_DEVICE_ASSIGNMENT 17 388#define KVM_CAP_DEVICE_ASSIGNMENT 17
388#endif 389#endif
389#define KVM_CAP_IOMMU 18 390#define KVM_CAP_IOMMU 18
391#if defined(CONFIG_X86)
392#define KVM_CAP_DEVICE_MSI 20
393#endif
394/* Bug in KVM_SET_USER_MEMORY_REGION fixed: */
395#define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21
396#if defined(CONFIG_X86)
397#define KVM_CAP_USER_NMI 22
398#endif
390 399
391/* 400/*
392 * ioctls for VM fds 401 * ioctls for VM fds
@@ -458,6 +467,8 @@ struct kvm_trace_rec {
458#define KVM_S390_INITIAL_RESET _IO(KVMIO, 0x97) 467#define KVM_S390_INITIAL_RESET _IO(KVMIO, 0x97)
459#define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state) 468#define KVM_GET_MP_STATE _IOR(KVMIO, 0x98, struct kvm_mp_state)
460#define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state) 469#define KVM_SET_MP_STATE _IOW(KVMIO, 0x99, struct kvm_mp_state)
470/* Available with KVM_CAP_NMI */
471#define KVM_NMI _IO(KVMIO, 0x9a)
461 472
462#define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02) 473#define KVM_TRC_INJ_VIRQ (KVM_TRC_HANDLER + 0x02)
463#define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03) 474#define KVM_TRC_REDELIVER_EVT (KVM_TRC_HANDLER + 0x03)
@@ -500,10 +511,17 @@ struct kvm_assigned_irq {
500 __u32 guest_irq; 511 __u32 guest_irq;
501 __u32 flags; 512 __u32 flags;
502 union { 513 union {
514 struct {
515 __u32 addr_lo;
516 __u32 addr_hi;
517 __u32 data;
518 } guest_msi;
503 __u32 reserved[12]; 519 __u32 reserved[12];
504 }; 520 };
505}; 521};
506 522
507#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0) 523#define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
508 524
525#define KVM_DEV_IRQ_ASSIGN_ENABLE_MSI (1 << 0)
526
509#endif 527#endif
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index bb92be2153bc..ec49d0be7f52 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -16,6 +16,7 @@
16#include <linux/mm.h> 16#include <linux/mm.h>
17#include <linux/preempt.h> 17#include <linux/preempt.h>
18#include <linux/marker.h> 18#include <linux/marker.h>
19#include <linux/msi.h>
19#include <asm/signal.h> 20#include <asm/signal.h>
20 21
21#include <linux/kvm.h> 22#include <linux/kvm.h>
@@ -306,9 +307,16 @@ struct kvm_assigned_dev_kernel {
306 int host_busnr; 307 int host_busnr;
307 int host_devfn; 308 int host_devfn;
308 int host_irq; 309 int host_irq;
310 bool host_irq_disabled;
309 int guest_irq; 311 int guest_irq;
310 int irq_requested; 312 struct msi_msg guest_msi;
313#define KVM_ASSIGNED_DEV_GUEST_INTX (1 << 0)
314#define KVM_ASSIGNED_DEV_GUEST_MSI (1 << 1)
315#define KVM_ASSIGNED_DEV_HOST_INTX (1 << 8)
316#define KVM_ASSIGNED_DEV_HOST_MSI (1 << 9)
317 unsigned long irq_requested_type;
311 int irq_source_id; 318 int irq_source_id;
319 int flags;
312 struct pci_dev *dev; 320 struct pci_dev *dev;
313 struct kvm *kvm; 321 struct kvm *kvm;
314}; 322};
@@ -316,18 +324,20 @@ void kvm_set_irq(struct kvm *kvm, int irq_source_id, int irq, int level);
316void kvm_notify_acked_irq(struct kvm *kvm, unsigned gsi); 324void kvm_notify_acked_irq(struct kvm *kvm, unsigned gsi);
317void kvm_register_irq_ack_notifier(struct kvm *kvm, 325void kvm_register_irq_ack_notifier(struct kvm *kvm,
318 struct kvm_irq_ack_notifier *kian); 326 struct kvm_irq_ack_notifier *kian);
319void kvm_unregister_irq_ack_notifier(struct kvm *kvm, 327void kvm_unregister_irq_ack_notifier(struct kvm_irq_ack_notifier *kian);
320 struct kvm_irq_ack_notifier *kian);
321int kvm_request_irq_source_id(struct kvm *kvm); 328int kvm_request_irq_source_id(struct kvm *kvm);
322void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id); 329void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id);
323 330
324#ifdef CONFIG_DMAR 331#ifdef CONFIG_IOMMU_API
325int kvm_iommu_map_pages(struct kvm *kvm, gfn_t base_gfn, 332int kvm_iommu_map_pages(struct kvm *kvm, gfn_t base_gfn,
326 unsigned long npages); 333 unsigned long npages);
327int kvm_iommu_map_guest(struct kvm *kvm, 334int kvm_iommu_map_guest(struct kvm *kvm);
328 struct kvm_assigned_dev_kernel *assigned_dev);
329int kvm_iommu_unmap_guest(struct kvm *kvm); 335int kvm_iommu_unmap_guest(struct kvm *kvm);
330#else /* CONFIG_DMAR */ 336int kvm_assign_device(struct kvm *kvm,
337 struct kvm_assigned_dev_kernel *assigned_dev);
338int kvm_deassign_device(struct kvm *kvm,
339 struct kvm_assigned_dev_kernel *assigned_dev);
340#else /* CONFIG_IOMMU_API */
331static inline int kvm_iommu_map_pages(struct kvm *kvm, 341static inline int kvm_iommu_map_pages(struct kvm *kvm,
332 gfn_t base_gfn, 342 gfn_t base_gfn,
333 unsigned long npages) 343 unsigned long npages)
@@ -335,9 +345,7 @@ static inline int kvm_iommu_map_pages(struct kvm *kvm,
335 return 0; 345 return 0;
336} 346}
337 347
338static inline int kvm_iommu_map_guest(struct kvm *kvm, 348static inline int kvm_iommu_map_guest(struct kvm *kvm)
339 struct kvm_assigned_dev_kernel
340 *assigned_dev)
341{ 349{
342 return -ENODEV; 350 return -ENODEV;
343} 351}
@@ -346,7 +354,19 @@ static inline int kvm_iommu_unmap_guest(struct kvm *kvm)
346{ 354{
347 return 0; 355 return 0;
348} 356}
349#endif /* CONFIG_DMAR */ 357
358static inline int kvm_assign_device(struct kvm *kvm,
359 struct kvm_assigned_dev_kernel *assigned_dev)
360{
361 return 0;
362}
363
364static inline int kvm_deassign_device(struct kvm *kvm,
365 struct kvm_assigned_dev_kernel *assigned_dev)
366{
367 return 0;
368}
369#endif /* CONFIG_IOMMU_API */
350 370
351static inline void kvm_guest_enter(void) 371static inline void kvm_guest_enter(void)
352{ 372{
diff --git a/include/linux/leds-pca9532.h b/include/linux/leds-pca9532.h
index 81b4207deb95..96eea90f01a8 100644
--- a/include/linux/leds-pca9532.h
+++ b/include/linux/leds-pca9532.h
@@ -15,6 +15,7 @@
15#define __LINUX_PCA9532_H 15#define __LINUX_PCA9532_H
16 16
17#include <linux/leds.h> 17#include <linux/leds.h>
18#include <linux/workqueue.h>
18 19
19enum pca9532_state { 20enum pca9532_state {
20 PCA9532_OFF = 0x0, 21 PCA9532_OFF = 0x0,
@@ -31,6 +32,7 @@ struct pca9532_led {
31 struct i2c_client *client; 32 struct i2c_client *client;
32 char *name; 33 char *name;
33 struct led_classdev ldev; 34 struct led_classdev ldev;
35 struct work_struct work;
34 enum pca9532_type type; 36 enum pca9532_type type;
35 enum pca9532_state state; 37 enum pca9532_state state;
36}; 38};
diff --git a/include/linux/leds.h b/include/linux/leds.h
index d3a73f5a48c3..24489da701e3 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -32,7 +32,10 @@ struct led_classdev {
32 int brightness; 32 int brightness;
33 int flags; 33 int flags;
34 34
35 /* Lower 16 bits reflect status */
35#define LED_SUSPENDED (1 << 0) 36#define LED_SUSPENDED (1 << 0)
37 /* Upper 16 bits reflect control information */
38#define LED_CORE_SUSPENDRESUME (1 << 16)
36 39
37 /* Set LED brightness level */ 40 /* Set LED brightness level */
38 /* Must not sleep, use a workqueue if needed */ 41 /* Must not sleep, use a workqueue if needed */
@@ -62,7 +65,7 @@ struct led_classdev {
62 65
63extern int led_classdev_register(struct device *parent, 66extern int led_classdev_register(struct device *parent,
64 struct led_classdev *led_cdev); 67 struct led_classdev *led_cdev);
65extern void led_classdev_unregister(struct led_classdev *lcd); 68extern void led_classdev_unregister(struct led_classdev *led_cdev);
66extern void led_classdev_suspend(struct led_classdev *led_cdev); 69extern void led_classdev_suspend(struct led_classdev *led_cdev);
67extern void led_classdev_resume(struct led_classdev *led_cdev); 70extern void led_classdev_resume(struct led_classdev *led_cdev);
68 71
diff --git a/include/linux/lguest_launcher.h b/include/linux/lguest_launcher.h
index e7217dc58f39..a53407a4165c 100644
--- a/include/linux/lguest_launcher.h
+++ b/include/linux/lguest_launcher.h
@@ -54,9 +54,13 @@ struct lguest_vqconfig {
54/* Write command first word is a request. */ 54/* Write command first word is a request. */
55enum lguest_req 55enum lguest_req
56{ 56{
57 LHREQ_INITIALIZE, /* + base, pfnlimit, pgdir, start */ 57 LHREQ_INITIALIZE, /* + base, pfnlimit, start */
58 LHREQ_GETDMA, /* No longer used */ 58 LHREQ_GETDMA, /* No longer used */
59 LHREQ_IRQ, /* + irq */ 59 LHREQ_IRQ, /* + irq */
60 LHREQ_BREAK, /* + on/off flag (on blocks until someone does off) */ 60 LHREQ_BREAK, /* + on/off flag (on blocks until someone does off) */
61}; 61};
62
63/* The alignment to use between consumer and producer parts of vring.
64 * x86 pagesize for historical reasons. */
65#define LGUEST_VRING_ALIGN 4096
62#endif /* _LINUX_LGUEST_LAUNCHER */ 66#endif /* _LINUX_LGUEST_LAUNCHER */
diff --git a/include/linux/libata.h b/include/linux/libata.h
index ed3f26eb5df1..b6b8a7f3ec66 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -213,10 +213,11 @@ enum {
213 ATA_PFLAG_FROZEN = (1 << 2), /* port is frozen */ 213 ATA_PFLAG_FROZEN = (1 << 2), /* port is frozen */
214 ATA_PFLAG_RECOVERED = (1 << 3), /* recovery action performed */ 214 ATA_PFLAG_RECOVERED = (1 << 3), /* recovery action performed */
215 ATA_PFLAG_LOADING = (1 << 4), /* boot/loading probe */ 215 ATA_PFLAG_LOADING = (1 << 4), /* boot/loading probe */
216 ATA_PFLAG_UNLOADING = (1 << 5), /* module is unloading */
217 ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */ 216 ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */
218 ATA_PFLAG_INITIALIZING = (1 << 7), /* being initialized, don't touch */ 217 ATA_PFLAG_INITIALIZING = (1 << 7), /* being initialized, don't touch */
219 ATA_PFLAG_RESETTING = (1 << 8), /* reset in progress */ 218 ATA_PFLAG_RESETTING = (1 << 8), /* reset in progress */
219 ATA_PFLAG_UNLOADING = (1 << 9), /* driver is being unloaded */
220 ATA_PFLAG_UNLOADED = (1 << 10), /* driver is unloaded */
220 221
221 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */ 222 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */
222 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */ 223 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */
@@ -238,6 +239,7 @@ enum {
238 /* host set flags */ 239 /* host set flags */
239 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */ 240 ATA_HOST_SIMPLEX = (1 << 0), /* Host is simplex, one DMA channel per host only */
240 ATA_HOST_STARTED = (1 << 1), /* Host started */ 241 ATA_HOST_STARTED = (1 << 1), /* Host started */
242 ATA_HOST_PARALLEL_SCAN = (1 << 2), /* Ports on this host can be scanned in parallel */
241 243
242 /* bits 24:31 of host->flags are reserved for LLD specific flags */ 244 /* bits 24:31 of host->flags are reserved for LLD specific flags */
243 245
@@ -1285,26 +1287,62 @@ static inline int ata_link_active(struct ata_link *link)
1285 return ata_tag_valid(link->active_tag) || link->sactive; 1287 return ata_tag_valid(link->active_tag) || link->sactive;
1286} 1288}
1287 1289
1288extern struct ata_link *__ata_port_next_link(struct ata_port *ap, 1290/*
1289 struct ata_link *link, 1291 * Iterators
1290 bool dev_only); 1292 *
1293 * ATA_LITER_* constants are used to select link iteration mode and
1294 * ATA_DITER_* device iteration mode.
1295 *
1296 * For a custom iteration directly using ata_{link|dev}_next(), if
1297 * @link or @dev, respectively, is NULL, the first element is
1298 * returned. @dev and @link can be any valid device or link and the
1299 * next element according to the iteration mode will be returned.
1300 * After the last element, NULL is returned.
1301 */
1302enum ata_link_iter_mode {
1303 ATA_LITER_EDGE, /* if present, PMP links only; otherwise,
1304 * host link. no slave link */
1305 ATA_LITER_HOST_FIRST, /* host link followed by PMP or slave links */
1306 ATA_LITER_PMP_FIRST, /* PMP links followed by host link,
1307 * slave link still comes after host link */
1308};
1309
1310enum ata_dev_iter_mode {
1311 ATA_DITER_ENABLED,
1312 ATA_DITER_ENABLED_REVERSE,
1313 ATA_DITER_ALL,
1314 ATA_DITER_ALL_REVERSE,
1315};
1291 1316
1292#define __ata_port_for_each_link(link, ap) \ 1317extern struct ata_link *ata_link_next(struct ata_link *link,
1293 for ((link) = __ata_port_next_link((ap), NULL, false); (link); \ 1318 struct ata_port *ap,
1294 (link) = __ata_port_next_link((ap), (link), false)) 1319 enum ata_link_iter_mode mode);
1295 1320
1296#define ata_port_for_each_link(link, ap) \ 1321extern struct ata_device *ata_dev_next(struct ata_device *dev,
1297 for ((link) = __ata_port_next_link((ap), NULL, true); (link); \ 1322 struct ata_link *link,
1298 (link) = __ata_port_next_link((ap), (link), true)) 1323 enum ata_dev_iter_mode mode);
1299 1324
1300#define ata_link_for_each_dev(dev, link) \ 1325/*
1301 for ((dev) = (link)->device; \ 1326 * Shortcut notation for iterations
1302 (dev) < (link)->device + ata_link_max_devices(link) || ((dev) = NULL); \ 1327 *
1303 (dev)++) 1328 * ata_for_each_link() iterates over each link of @ap according to
1329 * @mode. @link points to the current link in the loop. @link is
1330 * NULL after loop termination. ata_for_each_dev() works the same way
1331 * except that it iterates over each device of @link.
1332 *
1333 * Note that the mode prefixes ATA_{L|D}ITER_ shouldn't need to be
1334 * specified when using the following shorthand notations. Only the
1335 * mode itself (EDGE, HOST_FIRST, ENABLED, etc...) should be
1336 * specified. This not only increases brevity but also makes it
1337 * impossible to use ATA_LITER_* for device iteration or vice-versa.
1338 */
1339#define ata_for_each_link(link, ap, mode) \
1340 for ((link) = ata_link_next(NULL, (ap), ATA_LITER_##mode); (link); \
1341 (link) = ata_link_next((link), (ap), ATA_LITER_##mode))
1304 1342
1305#define ata_link_for_each_dev_reverse(dev, link) \ 1343#define ata_for_each_dev(dev, link, mode) \
1306 for ((dev) = (link)->device + ata_link_max_devices(link) - 1; \ 1344 for ((dev) = ata_dev_next(NULL, (link), ATA_DITER_##mode); (dev); \
1307 (dev) >= (link)->device || ((dev) = NULL); (dev)--) 1345 (dev) = ata_dev_next((dev), (link), ATA_DITER_##mode))
1308 1346
1309/** 1347/**
1310 * ata_ncq_enabled - Test whether NCQ is enabled 1348 * ata_ncq_enabled - Test whether NCQ is enabled
@@ -1481,6 +1519,7 @@ extern void sata_pmp_error_handler(struct ata_port *ap);
1481 1519
1482extern const struct ata_port_operations ata_sff_port_ops; 1520extern const struct ata_port_operations ata_sff_port_ops;
1483extern const struct ata_port_operations ata_bmdma_port_ops; 1521extern const struct ata_port_operations ata_bmdma_port_ops;
1522extern const struct ata_port_operations ata_bmdma32_port_ops;
1484 1523
1485/* PIO only, sg_tablesize and dma_boundary limits can be removed */ 1524/* PIO only, sg_tablesize and dma_boundary limits can be removed */
1486#define ATA_PIO_SHT(drv_name) \ 1525#define ATA_PIO_SHT(drv_name) \
@@ -1508,6 +1547,8 @@ extern void ata_sff_exec_command(struct ata_port *ap,
1508 const struct ata_taskfile *tf); 1547 const struct ata_taskfile *tf);
1509extern unsigned int ata_sff_data_xfer(struct ata_device *dev, 1548extern unsigned int ata_sff_data_xfer(struct ata_device *dev,
1510 unsigned char *buf, unsigned int buflen, int rw); 1549 unsigned char *buf, unsigned int buflen, int rw);
1550extern unsigned int ata_sff_data_xfer32(struct ata_device *dev,
1551 unsigned char *buf, unsigned int buflen, int rw);
1511extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev, 1552extern unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev,
1512 unsigned char *buf, unsigned int buflen, int rw); 1553 unsigned char *buf, unsigned int buflen, int rw);
1513extern u8 ata_sff_irq_on(struct ata_port *ap); 1554extern u8 ata_sff_irq_on(struct ata_port *ap);
diff --git a/include/linux/libps2.h b/include/linux/libps2.h
index afc413369101..b94534b7e266 100644
--- a/include/linux/libps2.h
+++ b/include/linux/libps2.h
@@ -18,11 +18,13 @@
18#define PS2_RET_ID 0x00 18#define PS2_RET_ID 0x00
19#define PS2_RET_ACK 0xfa 19#define PS2_RET_ACK 0xfa
20#define PS2_RET_NAK 0xfe 20#define PS2_RET_NAK 0xfe
21#define PS2_RET_ERR 0xfc
21 22
22#define PS2_FLAG_ACK 1 /* Waiting for ACK/NAK */ 23#define PS2_FLAG_ACK 1 /* Waiting for ACK/NAK */
23#define PS2_FLAG_CMD 2 /* Waiting for command to finish */ 24#define PS2_FLAG_CMD 2 /* Waiting for command to finish */
24#define PS2_FLAG_CMD1 4 /* Waiting for the first byte of command response */ 25#define PS2_FLAG_CMD1 4 /* Waiting for the first byte of command response */
25#define PS2_FLAG_WAITID 8 /* Command execiting is GET ID */ 26#define PS2_FLAG_WAITID 8 /* Command execiting is GET ID */
27#define PS2_FLAG_NAK 16 /* Last transmission was NAKed */
26 28
27struct ps2dev { 29struct ps2dev {
28 struct serio *serio; 30 struct serio *serio;
diff --git a/include/linux/linkage.h b/include/linux/linkage.h
index 9fd1f859021b..fee9e59649c1 100644
--- a/include/linux/linkage.h
+++ b/include/linux/linkage.h
@@ -64,14 +64,6 @@
64 name: 64 name:
65#endif 65#endif
66 66
67#define KPROBE_ENTRY(name) \
68 .pushsection .kprobes.text, "ax"; \
69 ENTRY(name)
70
71#define KPROBE_END(name) \
72 END(name); \
73 .popsection
74
75#ifndef END 67#ifndef END
76#define END(name) \ 68#define END(name) \
77 .size name, .-name 69 .size name, .-name
diff --git a/include/linux/list_nulls.h b/include/linux/list_nulls.h
new file mode 100644
index 000000000000..93150ecf3ea4
--- /dev/null
+++ b/include/linux/list_nulls.h
@@ -0,0 +1,94 @@
1#ifndef _LINUX_LIST_NULLS_H
2#define _LINUX_LIST_NULLS_H
3
4/*
5 * Special version of lists, where end of list is not a NULL pointer,
6 * but a 'nulls' marker, which can have many different values.
7 * (up to 2^31 different values guaranteed on all platforms)
8 *
9 * In the standard hlist, termination of a list is the NULL pointer.
10 * In this special 'nulls' variant, we use the fact that objects stored in
11 * a list are aligned on a word (4 or 8 bytes alignment).
12 * We therefore use the last significant bit of 'ptr' :
13 * Set to 1 : This is a 'nulls' end-of-list marker (ptr >> 1)
14 * Set to 0 : This is a pointer to some object (ptr)
15 */
16
17struct hlist_nulls_head {
18 struct hlist_nulls_node *first;
19};
20
21struct hlist_nulls_node {
22 struct hlist_nulls_node *next, **pprev;
23};
24#define INIT_HLIST_NULLS_HEAD(ptr, nulls) \
25 ((ptr)->first = (struct hlist_nulls_node *) (1UL | (((long)nulls) << 1)))
26
27#define hlist_nulls_entry(ptr, type, member) container_of(ptr,type,member)
28/**
29 * ptr_is_a_nulls - Test if a ptr is a nulls
30 * @ptr: ptr to be tested
31 *
32 */
33static inline int is_a_nulls(const struct hlist_nulls_node *ptr)
34{
35 return ((unsigned long)ptr & 1);
36}
37
38/**
39 * get_nulls_value - Get the 'nulls' value of the end of chain
40 * @ptr: end of chain
41 *
42 * Should be called only if is_a_nulls(ptr);
43 */
44static inline unsigned long get_nulls_value(const struct hlist_nulls_node *ptr)
45{
46 return ((unsigned long)ptr) >> 1;
47}
48
49static inline int hlist_nulls_unhashed(const struct hlist_nulls_node *h)
50{
51 return !h->pprev;
52}
53
54static inline int hlist_nulls_empty(const struct hlist_nulls_head *h)
55{
56 return is_a_nulls(h->first);
57}
58
59static inline void __hlist_nulls_del(struct hlist_nulls_node *n)
60{
61 struct hlist_nulls_node *next = n->next;
62 struct hlist_nulls_node **pprev = n->pprev;
63 *pprev = next;
64 if (!is_a_nulls(next))
65 next->pprev = pprev;
66}
67
68/**
69 * hlist_nulls_for_each_entry - iterate over list of given type
70 * @tpos: the type * to use as a loop cursor.
71 * @pos: the &struct hlist_node to use as a loop cursor.
72 * @head: the head for your list.
73 * @member: the name of the hlist_node within the struct.
74 *
75 */
76#define hlist_nulls_for_each_entry(tpos, pos, head, member) \
77 for (pos = (head)->first; \
78 (!is_a_nulls(pos)) && \
79 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1;}); \
80 pos = pos->next)
81
82/**
83 * hlist_nulls_for_each_entry_from - iterate over a hlist continuing from current point
84 * @tpos: the type * to use as a loop cursor.
85 * @pos: the &struct hlist_node to use as a loop cursor.
86 * @member: the name of the hlist_node within the struct.
87 *
88 */
89#define hlist_nulls_for_each_entry_from(tpos, pos, member) \
90 for (; (!is_a_nulls(pos)) && \
91 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1;}); \
92 pos = pos->next)
93
94#endif
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h
index e5872dc994c0..fbc48f898521 100644
--- a/include/linux/lockd/bind.h
+++ b/include/linux/lockd/bind.h
@@ -41,6 +41,7 @@ struct nlmclnt_initdata {
41 size_t addrlen; 41 size_t addrlen;
42 unsigned short protocol; 42 unsigned short protocol;
43 u32 nfs_version; 43 u32 nfs_version;
44 int noresvport;
44}; 45};
45 46
46/* 47/*
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index b56d5aa9b194..aa6fe7026de7 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -43,12 +43,13 @@ struct nlm_host {
43 struct sockaddr_storage h_addr; /* peer address */ 43 struct sockaddr_storage h_addr; /* peer address */
44 size_t h_addrlen; 44 size_t h_addrlen;
45 struct sockaddr_storage h_srcaddr; /* our address (optional) */ 45 struct sockaddr_storage h_srcaddr; /* our address (optional) */
46 struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */ 46 struct rpc_clnt *h_rpcclnt; /* RPC client to talk to peer */
47 char * h_name; /* remote hostname */ 47 char *h_name; /* remote hostname */
48 u32 h_version; /* interface version */ 48 u32 h_version; /* interface version */
49 unsigned short h_proto; /* transport proto */ 49 unsigned short h_proto; /* transport proto */
50 unsigned short h_reclaiming : 1, 50 unsigned short h_reclaiming : 1,
51 h_server : 1, /* server side, not client side */ 51 h_server : 1, /* server side, not client side */
52 h_noresvport : 1,
52 h_inuse : 1; 53 h_inuse : 1;
53 wait_queue_head_t h_gracewait; /* wait while reclaiming */ 54 wait_queue_head_t h_gracewait; /* wait while reclaiming */
54 struct rw_semaphore h_rwsem; /* Reboot recovery lock */ 55 struct rw_semaphore h_rwsem; /* Reboot recovery lock */
@@ -63,21 +64,29 @@ struct nlm_host {
63 spinlock_t h_lock; 64 spinlock_t h_lock;
64 struct list_head h_granted; /* Locks in GRANTED state */ 65 struct list_head h_granted; /* Locks in GRANTED state */
65 struct list_head h_reclaim; /* Locks in RECLAIM state */ 66 struct list_head h_reclaim; /* Locks in RECLAIM state */
66 struct nsm_handle * h_nsmhandle; /* NSM status handle */ 67 struct nsm_handle *h_nsmhandle; /* NSM status handle */
67 68 char *h_addrbuf; /* address eyecatcher */
68 char h_addrbuf[48], /* address eyecatchers */
69 h_srcaddrbuf[48];
70}; 69};
71 70
71/*
72 * The largest string sm_addrbuf should hold is a full-size IPv6 address
73 * (no "::" anywhere) with a scope ID. The buffer size is computed to
74 * hold eight groups of colon-separated four-hex-digit numbers, a
75 * percent sign, a scope id (at most 32 bits, in decimal), and NUL.
76 */
77#define NSM_ADDRBUF ((8 * 4 + 7) + (1 + 10) + 1)
78
72struct nsm_handle { 79struct nsm_handle {
73 struct list_head sm_link; 80 struct list_head sm_link;
74 atomic_t sm_count; 81 atomic_t sm_count;
75 char * sm_name; 82 char *sm_mon_name;
83 char *sm_name;
76 struct sockaddr_storage sm_addr; 84 struct sockaddr_storage sm_addr;
77 size_t sm_addrlen; 85 size_t sm_addrlen;
78 unsigned int sm_monitored : 1, 86 unsigned int sm_monitored : 1,
79 sm_sticky : 1; /* don't unmonitor */ 87 sm_sticky : 1; /* don't unmonitor */
80 char sm_addrbuf[48]; /* address eyecatcher */ 88 struct nsm_private sm_priv;
89 char sm_addrbuf[NSM_ADDRBUF];
81}; 90};
82 91
83/* 92/*
@@ -103,16 +112,6 @@ static inline struct sockaddr *nlm_srcaddr(const struct nlm_host *host)
103 return (struct sockaddr *)&host->h_srcaddr; 112 return (struct sockaddr *)&host->h_srcaddr;
104} 113}
105 114
106static inline struct sockaddr_in *nsm_addr_in(const struct nsm_handle *handle)
107{
108 return (struct sockaddr_in *)&handle->sm_addr;
109}
110
111static inline struct sockaddr *nsm_addr(const struct nsm_handle *handle)
112{
113 return (struct sockaddr *)&handle->sm_addr;
114}
115
116/* 115/*
117 * Map an fl_owner_t into a unique 32-bit "pid" 116 * Map an fl_owner_t into a unique 32-bit "pid"
118 */ 117 */
@@ -196,6 +195,7 @@ extern struct svc_procedure nlmsvc_procedures4[];
196extern int nlmsvc_grace_period; 195extern int nlmsvc_grace_period;
197extern unsigned long nlmsvc_timeout; 196extern unsigned long nlmsvc_timeout;
198extern int nsm_use_hostnames; 197extern int nsm_use_hostnames;
198extern int nsm_local_state;
199 199
200/* 200/*
201 * Lockd client functions 201 * Lockd client functions
@@ -220,7 +220,8 @@ struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap,
220 const size_t salen, 220 const size_t salen,
221 const unsigned short protocol, 221 const unsigned short protocol,
222 const u32 version, 222 const u32 version,
223 const char *hostname); 223 const char *hostname,
224 int noresvport);
224struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, 225struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
225 const char *hostname, 226 const char *hostname,
226 const size_t hostname_len); 227 const size_t hostname_len);
@@ -229,10 +230,20 @@ void nlm_rebind_host(struct nlm_host *);
229struct nlm_host * nlm_get_host(struct nlm_host *); 230struct nlm_host * nlm_get_host(struct nlm_host *);
230void nlm_release_host(struct nlm_host *); 231void nlm_release_host(struct nlm_host *);
231void nlm_shutdown_hosts(void); 232void nlm_shutdown_hosts(void);
232extern void nlm_host_rebooted(const struct sockaddr_in *, const char *, 233void nlm_host_rebooted(const struct nlm_reboot *);
233 unsigned int, u32); 234
234void nsm_release(struct nsm_handle *); 235/*
236 * Host monitoring
237 */
238int nsm_monitor(const struct nlm_host *host);
239void nsm_unmonitor(const struct nlm_host *host);
235 240
241struct nsm_handle *nsm_get_handle(const struct sockaddr *sap,
242 const size_t salen,
243 const char *hostname,
244 const size_t hostname_len);
245struct nsm_handle *nsm_reboot_lookup(const struct nlm_reboot *info);
246void nsm_release(struct nsm_handle *nsm);
236 247
237/* 248/*
238 * This is used in garbage collection and resource reclaim 249 * This is used in garbage collection and resource reclaim
@@ -280,16 +291,25 @@ static inline struct inode *nlmsvc_file_inode(struct nlm_file *file)
280static inline int __nlm_privileged_request4(const struct sockaddr *sap) 291static inline int __nlm_privileged_request4(const struct sockaddr *sap)
281{ 292{
282 const struct sockaddr_in *sin = (struct sockaddr_in *)sap; 293 const struct sockaddr_in *sin = (struct sockaddr_in *)sap;
283 return (sin->sin_addr.s_addr == htonl(INADDR_LOOPBACK)) && 294
284 (ntohs(sin->sin_port) < 1024); 295 if (ntohs(sin->sin_port) > 1023)
296 return 0;
297
298 return ipv4_is_loopback(sin->sin_addr.s_addr);
285} 299}
286 300
287#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 301#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
288static inline int __nlm_privileged_request6(const struct sockaddr *sap) 302static inline int __nlm_privileged_request6(const struct sockaddr *sap)
289{ 303{
290 const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap; 304 const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap;
291 return (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK) && 305
292 (ntohs(sin6->sin6_port) < 1024); 306 if (ntohs(sin6->sin6_port) > 1023)
307 return 0;
308
309 if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_MAPPED)
310 return ipv4_is_loopback(sin6->sin6_addr.s6_addr32[3]);
311
312 return ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LOOPBACK;
293} 313}
294#else /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 314#else /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
295static inline int __nlm_privileged_request6(const struct sockaddr *sap) 315static inline int __nlm_privileged_request6(const struct sockaddr *sap)
diff --git a/include/linux/lockd/sm_inter.h b/include/linux/lockd/sm_inter.h
deleted file mode 100644
index 5a5448bdb17d..000000000000
--- a/include/linux/lockd/sm_inter.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * linux/include/linux/lockd/sm_inter.h
3 *
4 * Declarations for the kernel statd client.
5 *
6 * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
7 */
8
9#ifndef LINUX_LOCKD_SM_INTER_H
10#define LINUX_LOCKD_SM_INTER_H
11
12#define SM_PROGRAM 100024
13#define SM_VERSION 1
14#define SM_STAT 1
15#define SM_MON 2
16#define SM_UNMON 3
17#define SM_UNMON_ALL 4
18#define SM_SIMU_CRASH 5
19#define SM_NOTIFY 6
20
21#define SM_MAXSTRLEN 1024
22#define SM_PRIV_SIZE 16
23
24/*
25 * Arguments for all calls to statd
26 */
27struct nsm_args {
28 __be32 addr; /* remote address */
29 u32 prog; /* RPC callback info */
30 u32 vers;
31 u32 proc;
32
33 char * mon_name;
34};
35
36/*
37 * Result returned by statd
38 */
39struct nsm_res {
40 u32 status;
41 u32 state;
42};
43
44int nsm_monitor(struct nlm_host *);
45int nsm_unmonitor(struct nlm_host *);
46extern int nsm_local_state;
47
48#endif /* LINUX_LOCKD_SM_INTER_H */
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index d6b3a802c046..7dc5b6cb44cd 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -13,6 +13,13 @@
13#include <linux/nfs.h> 13#include <linux/nfs.h>
14#include <linux/sunrpc/xdr.h> 14#include <linux/sunrpc/xdr.h>
15 15
16#define SM_MAXSTRLEN 1024
17#define SM_PRIV_SIZE 16
18
19struct nsm_private {
20 unsigned char data[SM_PRIV_SIZE];
21};
22
16struct svc_rqst; 23struct svc_rqst;
17 24
18#define NLM_MAXCOOKIELEN 32 25#define NLM_MAXCOOKIELEN 32
@@ -77,10 +84,10 @@ struct nlm_res {
77 * statd callback when client has rebooted 84 * statd callback when client has rebooted
78 */ 85 */
79struct nlm_reboot { 86struct nlm_reboot {
80 char * mon; 87 char *mon;
81 unsigned int len; 88 unsigned int len;
82 u32 state; 89 u32 state;
83 __be32 addr; 90 struct nsm_private priv;
84}; 91};
85 92
86/* 93/*
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 8956daf64abd..23bf02fb124f 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -314,8 +314,15 @@ extern void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
314extern void lock_release(struct lockdep_map *lock, int nested, 314extern void lock_release(struct lockdep_map *lock, int nested,
315 unsigned long ip); 315 unsigned long ip);
316 316
317extern void lock_set_subclass(struct lockdep_map *lock, unsigned int subclass, 317extern void lock_set_class(struct lockdep_map *lock, const char *name,
318 unsigned long ip); 318 struct lock_class_key *key, unsigned int subclass,
319 unsigned long ip);
320
321static inline void lock_set_subclass(struct lockdep_map *lock,
322 unsigned int subclass, unsigned long ip)
323{
324 lock_set_class(lock, lock->name, lock->key, subclass, ip);
325}
319 326
320# define INIT_LOCKDEP .lockdep_recursion = 0, 327# define INIT_LOCKDEP .lockdep_recursion = 0,
321 328
@@ -333,6 +340,7 @@ static inline void lockdep_on(void)
333 340
334# define lock_acquire(l, s, t, r, c, n, i) do { } while (0) 341# define lock_acquire(l, s, t, r, c, n, i) do { } while (0)
335# define lock_release(l, n, i) do { } while (0) 342# define lock_release(l, n, i) do { } while (0)
343# define lock_set_class(l, n, k, s, i) do { } while (0)
336# define lock_set_subclass(l, s, i) do { } while (0) 344# define lock_set_subclass(l, s, i) do { } while (0)
337# define lockdep_init() do { } while (0) 345# define lockdep_init() do { } while (0)
338# define lockdep_info() do { } while (0) 346# define lockdep_info() do { } while (0)
@@ -382,7 +390,7 @@ do { \
382 390
383#endif /* CONFIG_LOCK_STAT */ 391#endif /* CONFIG_LOCK_STAT */
384 392
385#if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_GENERIC_HARDIRQS) 393#ifdef CONFIG_GENERIC_HARDIRQS
386extern void early_init_irq_lock_class(void); 394extern void early_init_irq_lock_class(void);
387#else 395#else
388static inline void early_init_irq_lock_class(void) 396static inline void early_init_irq_lock_class(void)
diff --git a/include/linux/mISDNhw.h b/include/linux/mISDNhw.h
index e794dfb87504..97ffdc1d3442 100644
--- a/include/linux/mISDNhw.h
+++ b/include/linux/mISDNhw.h
@@ -57,20 +57,21 @@
57#define FLG_L2DATA 14 /* channel use L2 DATA primitivs */ 57#define FLG_L2DATA 14 /* channel use L2 DATA primitivs */
58#define FLG_ORIGIN 15 /* channel is on origin site */ 58#define FLG_ORIGIN 15 /* channel is on origin site */
59/* channel specific stuff */ 59/* channel specific stuff */
60#define FLG_FILLEMPTY 16 /* fill fifo on first frame (empty) */
60/* arcofi specific */ 61/* arcofi specific */
61#define FLG_ARCOFI_TIMER 16 62#define FLG_ARCOFI_TIMER 17
62#define FLG_ARCOFI_ERROR 17 63#define FLG_ARCOFI_ERROR 18
63/* isar specific */ 64/* isar specific */
64#define FLG_INITIALIZED 16 65#define FLG_INITIALIZED 17
65#define FLG_DLEETX 17 66#define FLG_DLEETX 18
66#define FLG_LASTDLE 18 67#define FLG_LASTDLE 19
67#define FLG_FIRST 19 68#define FLG_FIRST 20
68#define FLG_LASTDATA 20 69#define FLG_LASTDATA 21
69#define FLG_NMD_DATA 21 70#define FLG_NMD_DATA 22
70#define FLG_FTI_RUN 22 71#define FLG_FTI_RUN 23
71#define FLG_LL_OK 23 72#define FLG_LL_OK 24
72#define FLG_LL_CONN 24 73#define FLG_LL_CONN 25
73#define FLG_DTMFSEND 25 74#define FLG_DTMFSEND 26
74 75
75/* workq events */ 76/* workq events */
76#define FLG_RECVQUEUE 30 77#define FLG_RECVQUEUE 30
@@ -183,6 +184,7 @@ extern void queue_ch_frame(struct mISDNchannel *, u_int,
183extern int dchannel_senddata(struct dchannel *, struct sk_buff *); 184extern int dchannel_senddata(struct dchannel *, struct sk_buff *);
184extern int bchannel_senddata(struct bchannel *, struct sk_buff *); 185extern int bchannel_senddata(struct bchannel *, struct sk_buff *);
185extern void recv_Dchannel(struct dchannel *); 186extern void recv_Dchannel(struct dchannel *);
187extern void recv_Echannel(struct dchannel *, struct dchannel *);
186extern void recv_Bchannel(struct bchannel *); 188extern void recv_Bchannel(struct bchannel *);
187extern void recv_Dchannel_skb(struct dchannel *, struct sk_buff *); 189extern void recv_Dchannel_skb(struct dchannel *, struct sk_buff *);
188extern void recv_Bchannel_skb(struct bchannel *, struct sk_buff *); 190extern void recv_Bchannel_skb(struct bchannel *, struct sk_buff *);
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h
index 8f2d60da04e7..557477ac3d5b 100644
--- a/include/linux/mISDNif.h
+++ b/include/linux/mISDNif.h
@@ -36,8 +36,8 @@
36 * - should be incremented on every checkin 36 * - should be incremented on every checkin
37 */ 37 */
38#define MISDN_MAJOR_VERSION 1 38#define MISDN_MAJOR_VERSION 1
39#define MISDN_MINOR_VERSION 0 39#define MISDN_MINOR_VERSION 1
40#define MISDN_RELEASE 19 40#define MISDN_RELEASE 20
41 41
42/* primitives for information exchange 42/* primitives for information exchange
43 * generell format 43 * generell format
@@ -80,6 +80,7 @@
80#define PH_DEACTIVATE_IND 0x0202 80#define PH_DEACTIVATE_IND 0x0202
81#define PH_DEACTIVATE_CNF 0x4202 81#define PH_DEACTIVATE_CNF 0x4202
82#define PH_DATA_IND 0x2002 82#define PH_DATA_IND 0x2002
83#define PH_DATA_E_IND 0x3002
83#define MPH_ACTIVATE_IND 0x0502 84#define MPH_ACTIVATE_IND 0x0502
84#define MPH_DEACTIVATE_IND 0x0602 85#define MPH_DEACTIVATE_IND 0x0602
85#define MPH_INFORMATION_IND 0x0702 86#define MPH_INFORMATION_IND 0x0702
@@ -199,6 +200,18 @@
199#define ISDN_P_NT_S0 0x02 200#define ISDN_P_NT_S0 0x02
200#define ISDN_P_TE_E1 0x03 201#define ISDN_P_TE_E1 0x03
201#define ISDN_P_NT_E1 0x04 202#define ISDN_P_NT_E1 0x04
203#define ISDN_P_TE_UP0 0x05
204#define ISDN_P_NT_UP0 0x06
205
206#define IS_ISDN_P_TE(p) ((p == ISDN_P_TE_S0) || (p == ISDN_P_TE_E1) || \
207 (p == ISDN_P_TE_UP0) || (p == ISDN_P_LAPD_TE))
208#define IS_ISDN_P_NT(p) ((p == ISDN_P_NT_S0) || (p == ISDN_P_NT_E1) || \
209 (p == ISDN_P_NT_UP0) || (p == ISDN_P_LAPD_NT))
210#define IS_ISDN_P_S0(p) ((p == ISDN_P_TE_S0) || (p == ISDN_P_NT_S0))
211#define IS_ISDN_P_E1(p) ((p == ISDN_P_TE_E1) || (p == ISDN_P_NT_E1))
212#define IS_ISDN_P_UP0(p) ((p == ISDN_P_TE_UP0) || (p == ISDN_P_NT_UP0))
213
214
202#define ISDN_P_LAPD_TE 0x10 215#define ISDN_P_LAPD_TE 0x10
203#define ISDN_P_LAPD_NT 0x11 216#define ISDN_P_LAPD_NT 0x11
204 217
@@ -255,16 +268,6 @@ struct sockaddr_mISDN {
255 unsigned char tei; 268 unsigned char tei;
256}; 269};
257 270
258/* timer device ioctl */
259#define IMADDTIMER _IOR('I', 64, int)
260#define IMDELTIMER _IOR('I', 65, int)
261/* socket ioctls */
262#define IMGETVERSION _IOR('I', 66, int)
263#define IMGETCOUNT _IOR('I', 67, int)
264#define IMGETDEVINFO _IOR('I', 68, int)
265#define IMCTRLREQ _IOR('I', 69, int)
266#define IMCLEAR_L2 _IOR('I', 70, int)
267
268struct mISDNversion { 271struct mISDNversion {
269 unsigned char major; 272 unsigned char major;
270 unsigned char minor; 273 unsigned char minor;
@@ -281,6 +284,40 @@ struct mISDN_devinfo {
281 char name[MISDN_MAX_IDLEN]; 284 char name[MISDN_MAX_IDLEN];
282}; 285};
283 286
287struct mISDN_devrename {
288 u_int id;
289 char name[MISDN_MAX_IDLEN]; /* new name */
290};
291
292/* MPH_INFORMATION_REQ payload */
293struct ph_info_ch {
294 __u32 protocol;
295 __u64 Flags;
296};
297
298struct ph_info_dch {
299 struct ph_info_ch ch;
300 __u16 state;
301 __u16 num_bch;
302};
303
304struct ph_info {
305 struct ph_info_dch dch;
306 struct ph_info_ch bch[];
307};
308
309/* timer device ioctl */
310#define IMADDTIMER _IOR('I', 64, int)
311#define IMDELTIMER _IOR('I', 65, int)
312
313/* socket ioctls */
314#define IMGETVERSION _IOR('I', 66, int)
315#define IMGETCOUNT _IOR('I', 67, int)
316#define IMGETDEVINFO _IOR('I', 68, int)
317#define IMCTRLREQ _IOR('I', 69, int)
318#define IMCLEAR_L2 _IOR('I', 70, int)
319#define IMSETDEVNAME _IOR('I', 71, struct mISDN_devrename)
320
284static inline int 321static inline int
285test_channelmap(u_int nr, u_char *map) 322test_channelmap(u_int nr, u_char *map)
286{ 323{
@@ -312,6 +349,8 @@ clear_channelmap(u_int nr, u_char *map)
312#define MISDN_CTRL_SETPEER 0x0040 349#define MISDN_CTRL_SETPEER 0x0040
313#define MISDN_CTRL_UNSETPEER 0x0080 350#define MISDN_CTRL_UNSETPEER 0x0080
314#define MISDN_CTRL_RX_OFF 0x0100 351#define MISDN_CTRL_RX_OFF 0x0100
352#define MISDN_CTRL_FILL_EMPTY 0x0200
353#define MISDN_CTRL_GETPEER 0x0400
315#define MISDN_CTRL_HW_FEATURES_OP 0x2000 354#define MISDN_CTRL_HW_FEATURES_OP 0x2000
316#define MISDN_CTRL_HW_FEATURES 0x2001 355#define MISDN_CTRL_HW_FEATURES 0x2001
317#define MISDN_CTRL_HFC_OP 0x4000 356#define MISDN_CTRL_HFC_OP 0x4000
@@ -362,6 +401,7 @@ struct mISDN_ctrl_req {
362#define DEBUG_L2_TEI 0x00100000 401#define DEBUG_L2_TEI 0x00100000
363#define DEBUG_L2_TEIFSM 0x00200000 402#define DEBUG_L2_TEIFSM 0x00200000
364#define DEBUG_TIMER 0x01000000 403#define DEBUG_TIMER 0x01000000
404#define DEBUG_CLOCK 0x02000000
365 405
366#define mISDN_HEAD_P(s) ((struct mISDNhead *)&s->cb[0]) 406#define mISDN_HEAD_P(s) ((struct mISDNhead *)&s->cb[0])
367#define mISDN_HEAD_PRIM(s) (((struct mISDNhead *)&s->cb[0])->prim) 407#define mISDN_HEAD_PRIM(s) (((struct mISDNhead *)&s->cb[0])->prim)
@@ -375,6 +415,7 @@ struct mISDN_ctrl_req {
375struct mISDNchannel; 415struct mISDNchannel;
376struct mISDNdevice; 416struct mISDNdevice;
377struct mISDNstack; 417struct mISDNstack;
418struct mISDNclock;
378 419
379struct channel_req { 420struct channel_req {
380 u_int protocol; 421 u_int protocol;
@@ -423,7 +464,6 @@ struct mISDN_sock {
423struct mISDNdevice { 464struct mISDNdevice {
424 struct mISDNchannel D; 465 struct mISDNchannel D;
425 u_int id; 466 u_int id;
426 char name[MISDN_MAX_IDLEN];
427 u_int Dprotocols; 467 u_int Dprotocols;
428 u_int Bprotocols; 468 u_int Bprotocols;
429 u_int nrbchan; 469 u_int nrbchan;
@@ -452,6 +492,16 @@ struct mISDNstack {
452#endif 492#endif
453}; 493};
454 494
495typedef int (clockctl_func_t)(void *, int);
496
497struct mISDNclock {
498 struct list_head list;
499 char name[64];
500 int pri;
501 clockctl_func_t *ctl;
502 void *priv;
503};
504
455/* global alloc/queue functions */ 505/* global alloc/queue functions */
456 506
457static inline struct sk_buff * 507static inline struct sk_buff *
@@ -498,12 +548,23 @@ _queue_data(struct mISDNchannel *ch, u_int prim,
498 548
499/* global register/unregister functions */ 549/* global register/unregister functions */
500 550
501extern int mISDN_register_device(struct mISDNdevice *, char *name); 551extern int mISDN_register_device(struct mISDNdevice *,
552 struct device *parent, char *name);
502extern void mISDN_unregister_device(struct mISDNdevice *); 553extern void mISDN_unregister_device(struct mISDNdevice *);
503extern int mISDN_register_Bprotocol(struct Bprotocol *); 554extern int mISDN_register_Bprotocol(struct Bprotocol *);
504extern void mISDN_unregister_Bprotocol(struct Bprotocol *); 555extern void mISDN_unregister_Bprotocol(struct Bprotocol *);
556extern struct mISDNclock *mISDN_register_clock(char *, int, clockctl_func_t *,
557 void *);
558extern void mISDN_unregister_clock(struct mISDNclock *);
559
560static inline struct mISDNdevice *dev_to_mISDN(struct device *dev)
561{
562 return dev_get_drvdata(dev);
563}
505 564
506extern void set_channel_address(struct mISDNchannel *, u_int, u_int); 565extern void set_channel_address(struct mISDNchannel *, u_int, u_int);
566extern void mISDN_clock_update(struct mISDNclock *, int, struct timeval *);
567extern unsigned short mISDN_clock_get(void);
507 568
508#endif /* __KERNEL__ */ 569#endif /* __KERNEL__ */
509#endif /* mISDNIF_H */ 570#endif /* mISDNIF_H */
diff --git a/include/linux/magic.h b/include/linux/magic.h
index f7f3fdddbef0..439f6f3cb0c4 100644
--- a/include/linux/magic.h
+++ b/include/linux/magic.h
@@ -13,6 +13,7 @@
13#define EFS_SUPER_MAGIC 0x414A53 13#define EFS_SUPER_MAGIC 0x414A53
14#define EXT2_SUPER_MAGIC 0xEF53 14#define EXT2_SUPER_MAGIC 0xEF53
15#define EXT3_SUPER_MAGIC 0xEF53 15#define EXT3_SUPER_MAGIC 0xEF53
16#define XENFS_SUPER_MAGIC 0xabba1974
16#define EXT4_SUPER_MAGIC 0xEF53 17#define EXT4_SUPER_MAGIC 0xEF53
17#define HPFS_SUPER_MAGIC 0xf995e849 18#define HPFS_SUPER_MAGIC 0xf995e849
18#define ISOFS_SUPER_MAGIC 0x9660 19#define ISOFS_SUPER_MAGIC 0x9660
diff --git a/include/linux/map_to_7segment.h b/include/linux/map_to_7segment.h
index 7df8432c4402..12d62a54d470 100644
--- a/include/linux/map_to_7segment.h
+++ b/include/linux/map_to_7segment.h
@@ -75,7 +75,7 @@ struct seg7_conversion_map {
75 unsigned char table[128]; 75 unsigned char table[128];
76}; 76};
77 77
78static inline int map_to_seg7(struct seg7_conversion_map *map, int c) 78static __inline__ int map_to_seg7(struct seg7_conversion_map *map, int c)
79{ 79{
80 return c >= 0 && c < sizeof(map->table) ? map->table[c] : -EINVAL; 80 return c >= 0 && c < sizeof(map->table) ? map->table[c] : -EINVAL;
81} 81}
diff --git a/include/linux/mdio-gpio.h b/include/linux/mdio-gpio.h
new file mode 100644
index 000000000000..e9d3fdfe41d7
--- /dev/null
+++ b/include/linux/mdio-gpio.h
@@ -0,0 +1,25 @@
1/*
2 * MDIO-GPIO bus platform data structures
3 *
4 * Copyright (C) 2008, Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11#ifndef __LINUX_MDIO_GPIO_H
12#define __LINUX_MDIO_GPIO_H
13
14#include <linux/mdio-bitbang.h>
15
16struct mdio_gpio_platform_data {
17 /* GPIO numbers for bus pins */
18 unsigned int mdc;
19 unsigned int mdio;
20
21 unsigned int phy_mask;
22 int irqs[PHY_MAX_ADDR];
23};
24
25#endif /* __LINUX_MDIO_GPIO_H */
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 1fbe14d39521..326f45c86530 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -19,22 +19,45 @@
19 19
20#ifndef _LINUX_MEMCONTROL_H 20#ifndef _LINUX_MEMCONTROL_H
21#define _LINUX_MEMCONTROL_H 21#define _LINUX_MEMCONTROL_H
22 22#include <linux/cgroup.h>
23struct mem_cgroup; 23struct mem_cgroup;
24struct page_cgroup; 24struct page_cgroup;
25struct page; 25struct page;
26struct mm_struct; 26struct mm_struct;
27 27
28#ifdef CONFIG_CGROUP_MEM_RES_CTLR 28#ifdef CONFIG_CGROUP_MEM_RES_CTLR
29/*
30 * All "charge" functions with gfp_mask should use GFP_KERNEL or
31 * (gfp_mask & GFP_RECLAIM_MASK). In current implementatin, memcg doesn't
32 * alloc memory but reclaims memory from all available zones. So, "where I want
33 * memory from" bits of gfp_mask has no meaning. So any bits of that field is
34 * available but adding a rule is better. charge functions' gfp_mask should
35 * be set to GFP_KERNEL or gfp_mask & GFP_RECLAIM_MASK for avoiding ambiguous
36 * codes.
37 * (Of course, if memcg does memory allocation in future, GFP_KERNEL is sane.)
38 */
29 39
30extern int mem_cgroup_charge(struct page *page, struct mm_struct *mm, 40extern int mem_cgroup_newpage_charge(struct page *page, struct mm_struct *mm,
31 gfp_t gfp_mask); 41 gfp_t gfp_mask);
42/* for swap handling */
43extern int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
44 struct page *page, gfp_t mask, struct mem_cgroup **ptr);
45extern void mem_cgroup_commit_charge_swapin(struct page *page,
46 struct mem_cgroup *ptr);
47extern void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *ptr);
48
32extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, 49extern int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
33 gfp_t gfp_mask); 50 gfp_t gfp_mask);
34extern void mem_cgroup_move_lists(struct page *page, enum lru_list lru); 51extern void mem_cgroup_add_lru_list(struct page *page, enum lru_list lru);
52extern void mem_cgroup_del_lru_list(struct page *page, enum lru_list lru);
53extern void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru);
54extern void mem_cgroup_del_lru(struct page *page);
55extern void mem_cgroup_move_lists(struct page *page,
56 enum lru_list from, enum lru_list to);
35extern void mem_cgroup_uncharge_page(struct page *page); 57extern void mem_cgroup_uncharge_page(struct page *page);
36extern void mem_cgroup_uncharge_cache_page(struct page *page); 58extern void mem_cgroup_uncharge_cache_page(struct page *page);
37extern int mem_cgroup_shrink_usage(struct mm_struct *mm, gfp_t gfp_mask); 59extern int mem_cgroup_shrink_usage(struct page *page,
60 struct mm_struct *mm, gfp_t gfp_mask);
38 61
39extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, 62extern unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan,
40 struct list_head *dst, 63 struct list_head *dst,
@@ -47,12 +70,20 @@ int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem);
47 70
48extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); 71extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
49 72
50#define mm_match_cgroup(mm, cgroup) \ 73static inline
51 ((cgroup) == mem_cgroup_from_task((mm)->owner)) 74int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup)
75{
76 struct mem_cgroup *mem;
77 rcu_read_lock();
78 mem = mem_cgroup_from_task((mm)->owner);
79 rcu_read_unlock();
80 return cgroup == mem;
81}
52 82
53extern int 83extern int
54mem_cgroup_prepare_migration(struct page *page, struct page *newpage); 84mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr);
55extern void mem_cgroup_end_migration(struct page *page); 85extern void mem_cgroup_end_migration(struct mem_cgroup *mem,
86 struct page *oldpage, struct page *newpage);
56 87
57/* 88/*
58 * For memory reclaim. 89 * For memory reclaim.
@@ -65,13 +96,32 @@ extern void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem,
65 int priority); 96 int priority);
66extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem, 97extern void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
67 int priority); 98 int priority);
99int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg);
100unsigned long mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg,
101 struct zone *zone,
102 enum lru_list lru);
103struct zone_reclaim_stat *mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg,
104 struct zone *zone);
105struct zone_reclaim_stat*
106mem_cgroup_get_reclaim_stat_from_page(struct page *page);
68 107
69extern long mem_cgroup_calc_reclaim(struct mem_cgroup *mem, struct zone *zone, 108#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
70 int priority, enum lru_list lru); 109extern int do_swap_account;
110#endif
71 111
112static inline bool mem_cgroup_disabled(void)
113{
114 if (mem_cgroup_subsys.disabled)
115 return true;
116 return false;
117}
118
119extern bool mem_cgroup_oom_called(struct task_struct *task);
72 120
73#else /* CONFIG_CGROUP_MEM_RES_CTLR */ 121#else /* CONFIG_CGROUP_MEM_RES_CTLR */
74static inline int mem_cgroup_charge(struct page *page, 122struct mem_cgroup;
123
124static inline int mem_cgroup_newpage_charge(struct page *page,
75 struct mm_struct *mm, gfp_t gfp_mask) 125 struct mm_struct *mm, gfp_t gfp_mask)
76{ 126{
77 return 0; 127 return 0;
@@ -83,6 +133,21 @@ static inline int mem_cgroup_cache_charge(struct page *page,
83 return 0; 133 return 0;
84} 134}
85 135
136static inline int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
137 struct page *page, gfp_t gfp_mask, struct mem_cgroup **ptr)
138{
139 return 0;
140}
141
142static inline void mem_cgroup_commit_charge_swapin(struct page *page,
143 struct mem_cgroup *ptr)
144{
145}
146
147static inline void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *ptr)
148{
149}
150
86static inline void mem_cgroup_uncharge_page(struct page *page) 151static inline void mem_cgroup_uncharge_page(struct page *page)
87{ 152{
88} 153}
@@ -91,12 +156,33 @@ static inline void mem_cgroup_uncharge_cache_page(struct page *page)
91{ 156{
92} 157}
93 158
94static inline int mem_cgroup_shrink_usage(struct mm_struct *mm, gfp_t gfp_mask) 159static inline int mem_cgroup_shrink_usage(struct page *page,
160 struct mm_struct *mm, gfp_t gfp_mask)
95{ 161{
96 return 0; 162 return 0;
97} 163}
98 164
99static inline void mem_cgroup_move_lists(struct page *page, bool active) 165static inline void mem_cgroup_add_lru_list(struct page *page, int lru)
166{
167}
168
169static inline void mem_cgroup_del_lru_list(struct page *page, int lru)
170{
171 return ;
172}
173
174static inline void mem_cgroup_rotate_lru_list(struct page *page, int lru)
175{
176 return ;
177}
178
179static inline void mem_cgroup_del_lru(struct page *page)
180{
181 return ;
182}
183
184static inline void
185mem_cgroup_move_lists(struct page *page, enum lru_list from, enum lru_list to)
100{ 186{
101} 187}
102 188
@@ -112,12 +198,14 @@ static inline int task_in_mem_cgroup(struct task_struct *task,
112} 198}
113 199
114static inline int 200static inline int
115mem_cgroup_prepare_migration(struct page *page, struct page *newpage) 201mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr)
116{ 202{
117 return 0; 203 return 0;
118} 204}
119 205
120static inline void mem_cgroup_end_migration(struct page *page) 206static inline void mem_cgroup_end_migration(struct mem_cgroup *mem,
207 struct page *oldpage,
208 struct page *newpage)
121{ 209{
122} 210}
123 211
@@ -146,12 +234,42 @@ static inline void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem,
146{ 234{
147} 235}
148 236
149static inline long mem_cgroup_calc_reclaim(struct mem_cgroup *mem, 237static inline bool mem_cgroup_disabled(void)
150 struct zone *zone, int priority, 238{
151 enum lru_list lru) 239 return true;
240}
241
242static inline bool mem_cgroup_oom_called(struct task_struct *task)
243{
244 return false;
245}
246
247static inline int
248mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg)
249{
250 return 1;
251}
252
253static inline unsigned long
254mem_cgroup_zone_nr_pages(struct mem_cgroup *memcg, struct zone *zone,
255 enum lru_list lru)
152{ 256{
153 return 0; 257 return 0;
154} 258}
259
260
261static inline struct zone_reclaim_stat*
262mem_cgroup_get_reclaim_stat(struct mem_cgroup *memcg, struct zone *zone)
263{
264 return NULL;
265}
266
267static inline struct zone_reclaim_stat*
268mem_cgroup_get_reclaim_stat_from_page(struct page *page)
269{
270 return NULL;
271}
272
155#endif /* CONFIG_CGROUP_MEM_CONT */ 273#endif /* CONFIG_CGROUP_MEM_CONT */
156 274
157#endif /* _LINUX_MEMCONTROL_H */ 275#endif /* _LINUX_MEMCONTROL_H */
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 36c82c9e6ea7..3fdc10806d31 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -79,14 +79,14 @@ static inline int memory_notify(unsigned long val, void *v)
79#else 79#else
80extern int register_memory_notifier(struct notifier_block *nb); 80extern int register_memory_notifier(struct notifier_block *nb);
81extern void unregister_memory_notifier(struct notifier_block *nb); 81extern void unregister_memory_notifier(struct notifier_block *nb);
82extern int register_new_memory(struct mem_section *); 82extern int register_new_memory(int, struct mem_section *);
83extern int unregister_memory_section(struct mem_section *); 83extern int unregister_memory_section(struct mem_section *);
84extern int memory_dev_init(void); 84extern int memory_dev_init(void);
85extern int remove_memory_block(unsigned long, struct mem_section *, int); 85extern int remove_memory_block(unsigned long, struct mem_section *, int);
86extern int memory_notify(unsigned long val, void *v); 86extern int memory_notify(unsigned long val, void *v);
87extern struct memory_block *find_memory_block(struct mem_section *);
87#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) 88#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT)
88 89enum mem_add_context { BOOT, HOTPLUG };
89
90#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ 90#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */
91 91
92#ifdef CONFIG_MEMORY_HOTPLUG 92#ifdef CONFIG_MEMORY_HOTPLUG
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 763ba81fc0f0..d95f72e79b82 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -72,7 +72,7 @@ extern void __offline_isolated_pages(unsigned long, unsigned long);
72extern int offline_pages(unsigned long, unsigned long, unsigned long); 72extern int offline_pages(unsigned long, unsigned long, unsigned long);
73 73
74/* reasonably generic interface to expand the physical pages in a zone */ 74/* reasonably generic interface to expand the physical pages in a zone */
75extern int __add_pages(struct zone *zone, unsigned long start_pfn, 75extern int __add_pages(int nid, struct zone *zone, unsigned long start_pfn,
76 unsigned long nr_pages); 76 unsigned long nr_pages);
77extern int __remove_pages(struct zone *zone, unsigned long start_pfn, 77extern int __remove_pages(struct zone *zone, unsigned long start_pfn,
78 unsigned long nr_pages); 78 unsigned long nr_pages);
diff --git a/include/linux/memstick.h b/include/linux/memstick.h
index d0c37e682234..690c35a9d4cc 100644
--- a/include/linux/memstick.h
+++ b/include/linux/memstick.h
@@ -100,8 +100,8 @@ struct mspro_param_register {
100#define MEMSTICK_SYS_PAR8 0x40 100#define MEMSTICK_SYS_PAR8 0x40
101#define MEMSTICK_SYS_SERIAL 0x80 101#define MEMSTICK_SYS_SERIAL 0x80
102 102
103 unsigned short data_count; 103 __be16 data_count;
104 unsigned int data_address; 104 __be32 data_address;
105 unsigned char tpc_param; 105 unsigned char tpc_param;
106} __attribute__((packed)); 106} __attribute__((packed));
107 107
diff --git a/include/linux/mfd/da903x.h b/include/linux/mfd/da903x.h
index cad314c12439..115dbe965082 100644
--- a/include/linux/mfd/da903x.h
+++ b/include/linux/mfd/da903x.h
@@ -32,6 +32,7 @@ enum {
32 DA9030_ID_LDO18, 32 DA9030_ID_LDO18,
33 DA9030_ID_LDO19, 33 DA9030_ID_LDO19,
34 DA9030_ID_LDO_INT, /* LDO Internal */ 34 DA9030_ID_LDO_INT, /* LDO Internal */
35 DA9030_ID_BAT, /* battery charger */
35 36
36 DA9034_ID_LED_1, 37 DA9034_ID_LED_1,
37 DA9034_ID_LED_2, 38 DA9034_ID_LED_2,
@@ -93,6 +94,43 @@ struct da9034_touch_pdata {
93 int y_inverted; 94 int y_inverted;
94}; 95};
95 96
97/* DA9030 battery charger data */
98struct power_supply_info;
99
100struct da9030_battery_info {
101 /* battery parameters */
102 struct power_supply_info *battery_info;
103
104 /* current and voltage to use for battery charging */
105 unsigned int charge_milliamp;
106 unsigned int charge_millivolt;
107
108 /* voltage thresholds (in millivolts) */
109 int vbat_low;
110 int vbat_crit;
111 int vbat_charge_start;
112 int vbat_charge_stop;
113 int vbat_charge_restart;
114
115 /* battery nominal minimal and maximal voltages in millivolts */
116 int vcharge_min;
117 int vcharge_max;
118
119 /* Temperature thresholds. These are DA9030 register values
120 "as is" and should be measured for each battery type */
121 int tbat_low;
122 int tbat_high;
123 int tbat_restart;
124
125
126 /* battery monitor interval (seconds) */
127 unsigned int batmon_interval;
128
129 /* platform callbacks for battery low and critical events */
130 void (*battery_low)(void);
131 void (*battery_critical)(void);
132};
133
96struct da903x_subdev_info { 134struct da903x_subdev_info {
97 int id; 135 int id;
98 const char *name; 136 const char *name;
@@ -190,11 +228,13 @@ extern int da903x_unregister_notifier(struct device *dev,
190extern int da903x_query_status(struct device *dev, unsigned int status); 228extern int da903x_query_status(struct device *dev, unsigned int status);
191 229
192 230
193/* NOTE: the two functions below are not intended for use outside 231/* NOTE: the functions below are not intended for use outside
194 * of the DA9034 sub-device drivers 232 * of the DA903x sub-device drivers
195 */ 233 */
196extern int da903x_write(struct device *dev, int reg, uint8_t val); 234extern int da903x_write(struct device *dev, int reg, uint8_t val);
235extern int da903x_writes(struct device *dev, int reg, int len, uint8_t *val);
197extern int da903x_read(struct device *dev, int reg, uint8_t *val); 236extern int da903x_read(struct device *dev, int reg, uint8_t *val);
237extern int da903x_reads(struct device *dev, int reg, int len, uint8_t *val);
198extern int da903x_update(struct device *dev, int reg, uint8_t val, uint8_t mask); 238extern int da903x_update(struct device *dev, int reg, uint8_t val, uint8_t mask);
199extern int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask); 239extern int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask);
200extern int da903x_clr_bits(struct device *dev, int reg, uint8_t bit_mask); 240extern int da903x_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
diff --git a/include/linux/mfd/wm8350/audio.h b/include/linux/mfd/wm8350/audio.h
index 217bb22ebb8e..af95a1d2f3a1 100644
--- a/include/linux/mfd/wm8350/audio.h
+++ b/include/linux/mfd/wm8350/audio.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * audio.h -- Audio Driver for Wolfson WM8350 PMIC 2 * audio.h -- Audio Driver for Wolfson WM8350 PMIC
3 * 3 *
4 * Copyright 2007 Wolfson Microelectronics PLC 4 * Copyright 2007, 2008 Wolfson Microelectronics PLC
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the 7 * under the terms of the GNU General Public License as published by the
@@ -70,9 +70,9 @@
70#define WM8350_CODEC_ISEL_0_5 3 /* x0.5 */ 70#define WM8350_CODEC_ISEL_0_5 3 /* x0.5 */
71 71
72#define WM8350_VMID_OFF 0 72#define WM8350_VMID_OFF 0
73#define WM8350_VMID_500K 1 73#define WM8350_VMID_300K 1
74#define WM8350_VMID_100K 2 74#define WM8350_VMID_50K 2
75#define WM8350_VMID_10K 3 75#define WM8350_VMID_5K 3
76 76
77/* 77/*
78 * R40 (0x28) - Clock Control 1 78 * R40 (0x28) - Clock Control 1
@@ -591,8 +591,38 @@
591#define WM8350_IRQ_CODEC_MICSCD 41 591#define WM8350_IRQ_CODEC_MICSCD 41
592#define WM8350_IRQ_CODEC_MICD 42 592#define WM8350_IRQ_CODEC_MICD 42
593 593
594/*
595 * WM8350 Platform data.
596 *
597 * This must be initialised per platform for best audio performance.
598 * Please see WM8350 datasheet for information.
599 */
600struct wm8350_audio_platform_data {
601 int vmid_discharge_msecs; /* VMID --> OFF discharge time */
602 int drain_msecs; /* OFF drain time */
603 int cap_discharge_msecs; /* Cap ON (from OFF) discharge time */
604 int vmid_charge_msecs; /* vmid power up time */
605 u32 vmid_s_curve:2; /* vmid enable s curve speed */
606 u32 dis_out4:2; /* out4 discharge speed */
607 u32 dis_out3:2; /* out3 discharge speed */
608 u32 dis_out2:2; /* out2 discharge speed */
609 u32 dis_out1:2; /* out1 discharge speed */
610 u32 vroi_out4:1; /* out4 tie off */
611 u32 vroi_out3:1; /* out3 tie off */
612 u32 vroi_out2:1; /* out2 tie off */
613 u32 vroi_out1:1; /* out1 tie off */
614 u32 vroi_enable:1; /* enable tie off */
615 u32 codec_current_on:2; /* current level ON */
616 u32 codec_current_standby:2; /* current level STANDBY */
617 u32 codec_current_charge:2; /* codec current @ vmid charge */
618};
619
620struct snd_soc_codec;
621
594struct wm8350_codec { 622struct wm8350_codec {
595 struct platform_device *pdev; 623 struct platform_device *pdev;
624 struct snd_soc_codec *codec;
625 struct wm8350_audio_platform_data *platform_data;
596}; 626};
597 627
598#endif 628#endif
diff --git a/include/linux/mfd/wm8350/comparator.h b/include/linux/mfd/wm8350/comparator.h
index 053788649452..54bc5d0fd502 100644
--- a/include/linux/mfd/wm8350/comparator.h
+++ b/include/linux/mfd/wm8350/comparator.h
@@ -164,4 +164,12 @@
164#define WM8350_AUXADC_BATT 6 164#define WM8350_AUXADC_BATT 6
165#define WM8350_AUXADC_TEMP 7 165#define WM8350_AUXADC_TEMP 7
166 166
167struct wm8350;
168
169/*
170 * AUX ADC Readback
171 */
172int wm8350_read_auxadc(struct wm8350 *wm8350, int channel, int scale,
173 int vref);
174
167#endif 175#endif
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index 6ebf97f2a475..980669d50dca 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -29,6 +29,7 @@
29 */ 29 */
30#define WM8350_RESET_ID 0x00 30#define WM8350_RESET_ID 0x00
31#define WM8350_ID 0x01 31#define WM8350_ID 0x01
32#define WM8350_REVISION 0x02
32#define WM8350_SYSTEM_CONTROL_1 0x03 33#define WM8350_SYSTEM_CONTROL_1 0x03
33#define WM8350_SYSTEM_CONTROL_2 0x04 34#define WM8350_SYSTEM_CONTROL_2 0x04
34#define WM8350_SYSTEM_HIBERNATE 0x05 35#define WM8350_SYSTEM_HIBERNATE 0x05
@@ -57,6 +58,10 @@
57#define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25 58#define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25
58#define WM8350_GPIO_INT_STATUS_MASK 0x26 59#define WM8350_GPIO_INT_STATUS_MASK 0x26
59#define WM8350_COMPARATOR_INT_STATUS_MASK 0x27 60#define WM8350_COMPARATOR_INT_STATUS_MASK 0x27
61#define WM8350_CHARGER_OVERRIDES 0xE2
62#define WM8350_MISC_OVERRIDES 0xE3
63#define WM8350_COMPARATOR_OVERRIDES 0xE7
64#define WM8350_STATE_MACHINE_STATUS 0xE9
60 65
61#define WM8350_MAX_REGISTER 0xFF 66#define WM8350_MAX_REGISTER 0xFF
62 67
@@ -77,6 +82,11 @@
77#define WM8350_CUST_ID_MASK 0x00FF 82#define WM8350_CUST_ID_MASK 0x00FF
78 83
79/* 84/*
85 * R2 (0x02) - Revision
86 */
87#define WM8350_MASK_REV_MASK 0x00FF
88
89/*
80 * R3 (0x03) - System Control 1 90 * R3 (0x03) - System Control 1
81 */ 91 */
82#define WM8350_CHIP_ON 0x8000 92#define WM8350_CHIP_ON 0x8000
@@ -523,6 +533,35 @@
523#define WM8350_DC2_STS 0x0002 533#define WM8350_DC2_STS 0x0002
524#define WM8350_DC1_STS 0x0001 534#define WM8350_DC1_STS 0x0001
525 535
536/*
537 * R226 (0xE2) - Charger status
538 */
539#define WM8350_CHG_BATT_HOT_OVRDE 0x8000
540#define WM8350_CHG_BATT_COLD_OVRDE 0x4000
541
542/*
543 * R227 (0xE3) - Misc Overrides
544 */
545#define WM8350_USB_LIMIT_OVRDE 0x0400
546
547/*
548 * R227 (0xE7) - Comparator Overrides
549 */
550#define WM8350_USB_FB_OVRDE 0x8000
551#define WM8350_WALL_FB_OVRDE 0x4000
552#define WM8350_BATT_FB_OVRDE 0x2000
553
554
555/*
556 * R233 (0xE9) - State Machinine Status
557 */
558#define WM8350_USB_SM_MASK 0x0700
559#define WM8350_USB_SM_SHIFT 8
560
561#define WM8350_USB_SM_100_SLV 1
562#define WM8350_USB_SM_500_SLV 5
563#define WM8350_USB_SM_STDBY_SLV 7
564
526/* WM8350 wake up conditions */ 565/* WM8350 wake up conditions */
527#define WM8350_IRQ_WKUP_OFF_STATE 43 566#define WM8350_IRQ_WKUP_OFF_STATE 43
528#define WM8350_IRQ_WKUP_HIB_STATE 44 567#define WM8350_IRQ_WKUP_HIB_STATE 44
@@ -536,6 +575,7 @@
536#define WM8350_REV_E 0x4 575#define WM8350_REV_E 0x4
537#define WM8350_REV_F 0x5 576#define WM8350_REV_F 0x5
538#define WM8350_REV_G 0x6 577#define WM8350_REV_G 0x6
578#define WM8350_REV_H 0x7
539 579
540#define WM8350_NUM_IRQ 63 580#define WM8350_NUM_IRQ 63
541 581
@@ -549,6 +589,14 @@ extern const u16 wm8350_mode0_defaults[];
549extern const u16 wm8350_mode1_defaults[]; 589extern const u16 wm8350_mode1_defaults[];
550extern const u16 wm8350_mode2_defaults[]; 590extern const u16 wm8350_mode2_defaults[];
551extern const u16 wm8350_mode3_defaults[]; 591extern const u16 wm8350_mode3_defaults[];
592extern const u16 wm8351_mode0_defaults[];
593extern const u16 wm8351_mode1_defaults[];
594extern const u16 wm8351_mode2_defaults[];
595extern const u16 wm8351_mode3_defaults[];
596extern const u16 wm8352_mode0_defaults[];
597extern const u16 wm8352_mode1_defaults[];
598extern const u16 wm8352_mode2_defaults[];
599extern const u16 wm8352_mode3_defaults[];
552 600
553struct wm8350; 601struct wm8350;
554 602
@@ -558,8 +606,6 @@ struct wm8350_irq {
558}; 606};
559 607
560struct wm8350 { 608struct wm8350 {
561 int rev; /* chip revision */
562
563 struct device *dev; 609 struct device *dev;
564 610
565 /* device IO */ 611 /* device IO */
@@ -572,6 +618,8 @@ struct wm8350 {
572 void *src); 618 void *src);
573 u16 *reg_cache; 619 u16 *reg_cache;
574 620
621 struct mutex auxadc_mutex;
622
575 /* Interrupt handling */ 623 /* Interrupt handling */
576 struct work_struct irq_work; 624 struct work_struct irq_work;
577 struct mutex irq_mutex; /* IRQ table mutex */ 625 struct mutex irq_mutex; /* IRQ table mutex */
diff --git a/include/linux/mfd/wm8350/pmic.h b/include/linux/mfd/wm8350/pmic.h
index 69b69e07f62f..be3264e286e0 100644
--- a/include/linux/mfd/wm8350/pmic.h
+++ b/include/linux/mfd/wm8350/pmic.h
@@ -13,6 +13,10 @@
13#ifndef __LINUX_MFD_WM8350_PMIC_H 13#ifndef __LINUX_MFD_WM8350_PMIC_H
14#define __LINUX_MFD_WM8350_PMIC_H 14#define __LINUX_MFD_WM8350_PMIC_H
15 15
16#include <linux/platform_device.h>
17#include <linux/leds.h>
18#include <linux/regulator/machine.h>
19
16/* 20/*
17 * Register values. 21 * Register values.
18 */ 22 */
@@ -700,7 +704,38 @@ struct wm8350;
700struct platform_device; 704struct platform_device;
701struct regulator_init_data; 705struct regulator_init_data;
702 706
707/*
708 * WM8350 LED platform data
709 */
710struct wm8350_led_platform_data {
711 const char *name;
712 const char *default_trigger;
713 int max_uA;
714};
715
716struct wm8350_led {
717 struct platform_device *pdev;
718 struct mutex mutex;
719 struct work_struct work;
720 spinlock_t value_lock;
721 enum led_brightness value;
722 struct led_classdev cdev;
723 int max_uA_index;
724 int enabled;
725
726 struct regulator *isink;
727 struct regulator_consumer_supply isink_consumer;
728 struct regulator_init_data isink_init;
729 struct regulator *dcdc;
730 struct regulator_consumer_supply dcdc_consumer;
731 struct regulator_init_data dcdc_init;
732};
733
703struct wm8350_pmic { 734struct wm8350_pmic {
735 /* Number of regulators of each type on this device */
736 int max_dcdc;
737 int max_isink;
738
704 /* ISINK to DCDC mapping */ 739 /* ISINK to DCDC mapping */
705 int isink_A_dcdc; 740 int isink_A_dcdc;
706 int isink_B_dcdc; 741 int isink_B_dcdc;
@@ -713,10 +748,15 @@ struct wm8350_pmic {
713 748
714 /* regulator devices */ 749 /* regulator devices */
715 struct platform_device *pdev[NUM_WM8350_REGULATORS]; 750 struct platform_device *pdev[NUM_WM8350_REGULATORS];
751
752 /* LED devices */
753 struct wm8350_led led[2];
716}; 754};
717 755
718int wm8350_register_regulator(struct wm8350 *wm8350, int reg, 756int wm8350_register_regulator(struct wm8350 *wm8350, int reg,
719 struct regulator_init_data *initdata); 757 struct regulator_init_data *initdata);
758int wm8350_register_led(struct wm8350 *wm8350, int lednum, int dcdc, int isink,
759 struct wm8350_led_platform_data *pdata);
720 760
721/* 761/*
722 * Additional DCDC control not supported via regulator API 762 * Additional DCDC control not supported via regulator API
diff --git a/include/linux/mfd/wm8350/supply.h b/include/linux/mfd/wm8350/supply.h
index 1c8f3cde79b0..2b9479310bbd 100644
--- a/include/linux/mfd/wm8350/supply.h
+++ b/include/linux/mfd/wm8350/supply.h
@@ -13,7 +13,8 @@
13#ifndef __LINUX_MFD_WM8350_SUPPLY_H_ 13#ifndef __LINUX_MFD_WM8350_SUPPLY_H_
14#define __LINUX_MFD_WM8350_SUPPLY_H_ 14#define __LINUX_MFD_WM8350_SUPPLY_H_
15 15
16#include <linux/platform_device.h> 16#include <linux/mutex.h>
17#include <linux/power_supply.h>
17 18
18/* 19/*
19 * Charger registers 20 * Charger registers
@@ -104,8 +105,30 @@
104#define WM8350_IRQ_EXT_WALL_FB 37 105#define WM8350_IRQ_EXT_WALL_FB 37
105#define WM8350_IRQ_EXT_BAT_FB 38 106#define WM8350_IRQ_EXT_BAT_FB 38
106 107
108/*
109 * Policy to control charger state machine.
110 */
111struct wm8350_charger_policy {
112
113 /* charger state machine policy - set in machine driver */
114 int eoc_mA; /* end of charge current (mA) */
115 int charge_mV; /* charge voltage */
116 int fast_limit_mA; /* fast charge current limit */
117 int fast_limit_USB_mA; /* USB fast charge current limit */
118 int charge_timeout; /* charge timeout (mins) */
119 int trickle_start_mV; /* trickle charge starts at mV */
120 int trickle_charge_mA; /* trickle charge current */
121 int trickle_charge_USB_mA; /* USB trickle charge current */
122};
123
107struct wm8350_power { 124struct wm8350_power {
108 struct platform_device *pdev; 125 struct platform_device *pdev;
126 struct power_supply battery;
127 struct power_supply usb;
128 struct power_supply ac;
129 struct wm8350_charger_policy *policy;
130
131 int rev_g_coeff;
109}; 132};
110 133
111#endif 134#endif
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 3f34005068d4..527602cdea1c 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -7,6 +7,8 @@
7typedef struct page *new_page_t(struct page *, unsigned long private, int **); 7typedef struct page *new_page_t(struct page *, unsigned long private, int **);
8 8
9#ifdef CONFIG_MIGRATION 9#ifdef CONFIG_MIGRATION
10#define PAGE_MIGRATION 1
11
10extern int putback_lru_pages(struct list_head *l); 12extern int putback_lru_pages(struct list_head *l);
11extern int migrate_page(struct address_space *, 13extern int migrate_page(struct address_space *,
12 struct page *, struct page *); 14 struct page *, struct page *);
@@ -20,6 +22,8 @@ extern int migrate_vmas(struct mm_struct *mm,
20 const nodemask_t *from, const nodemask_t *to, 22 const nodemask_t *from, const nodemask_t *to,
21 unsigned long flags); 23 unsigned long flags);
22#else 24#else
25#define PAGE_MIGRATION 0
26
23static inline int putback_lru_pages(struct list_head *l) { return 0; } 27static inline int putback_lru_pages(struct list_head *l) { return 0; }
24static inline int migrate_pages(struct list_head *l, new_page_t x, 28static inline int migrate_pages(struct list_head *l, new_page_t x,
25 unsigned long private) { return -ENOSYS; } 29 unsigned long private) { return -ENOSYS; }
diff --git a/include/linux/mii.h b/include/linux/mii.h
index 151b7e0182c7..ad748588faf1 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -135,6 +135,10 @@
135#define LPA_1000FULL 0x0800 /* Link partner 1000BASE-T full duplex */ 135#define LPA_1000FULL 0x0800 /* Link partner 1000BASE-T full duplex */
136#define LPA_1000HALF 0x0400 /* Link partner 1000BASE-T half duplex */ 136#define LPA_1000HALF 0x0400 /* Link partner 1000BASE-T half duplex */
137 137
138/* Flow control flags */
139#define FLOW_CTRL_TX 0x01
140#define FLOW_CTRL_RX 0x02
141
138/* This structure is used in all SIOCxMIIxxx ioctl calls */ 142/* This structure is used in all SIOCxMIIxxx ioctl calls */
139struct mii_ioctl_data { 143struct mii_ioctl_data {
140 __u16 phy_id; 144 __u16 phy_id;
@@ -235,5 +239,34 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock,
235 return 0; 239 return 0;
236} 240}
237 241
242/**
243 * mii_resolve_flowctrl_fdx
244 * @lcladv: value of MII ADVERTISE register
245 * @rmtadv: value of MII LPA register
246 *
247 * Resolve full duplex flow control as per IEEE 802.3-2005 table 28B-3
248 */
249static inline u8 mii_resolve_flowctrl_fdx(u16 lcladv, u16 rmtadv)
250{
251 u8 cap = 0;
252
253 if (lcladv & ADVERTISE_PAUSE_CAP) {
254 if (lcladv & ADVERTISE_PAUSE_ASYM) {
255 if (rmtadv & LPA_PAUSE_CAP)
256 cap = FLOW_CTRL_TX | FLOW_CTRL_RX;
257 else if (rmtadv & LPA_PAUSE_ASYM)
258 cap = FLOW_CTRL_RX;
259 } else {
260 if (rmtadv & LPA_PAUSE_CAP)
261 cap = FLOW_CTRL_TX | FLOW_CTRL_RX;
262 }
263 } else if (lcladv & ADVERTISE_PAUSE_ASYM) {
264 if ((rmtadv & LPA_PAUSE_CAP) && (rmtadv & LPA_PAUSE_ASYM))
265 cap = FLOW_CTRL_TX;
266 }
267
268 return cap;
269}
270
238#endif /* __KERNEL__ */ 271#endif /* __KERNEL__ */
239#endif /* __LINUX_MII_H__ */ 272#endif /* __LINUX_MII_H__ */
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 26433ec520b3..a820f816a49e 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -3,33 +3,33 @@
3#include <linux/module.h> 3#include <linux/module.h>
4#include <linux/major.h> 4#include <linux/major.h>
5 5
6#define PSMOUSE_MINOR 1 6#define PSMOUSE_MINOR 1
7#define MS_BUSMOUSE_MINOR 2 7#define MS_BUSMOUSE_MINOR 2
8#define ATIXL_BUSMOUSE_MINOR 3 8#define ATIXL_BUSMOUSE_MINOR 3
9/*#define AMIGAMOUSE_MINOR 4 FIXME OBSOLETE */ 9/*#define AMIGAMOUSE_MINOR 4 FIXME OBSOLETE */
10#define ATARIMOUSE_MINOR 5 10#define ATARIMOUSE_MINOR 5
11#define SUN_MOUSE_MINOR 6 11#define SUN_MOUSE_MINOR 6
12#define APOLLO_MOUSE_MINOR 7 12#define APOLLO_MOUSE_MINOR 7
13#define PC110PAD_MINOR 9 13#define PC110PAD_MINOR 9
14/*#define ADB_MOUSE_MINOR 10 FIXME OBSOLETE */ 14/*#define ADB_MOUSE_MINOR 10 FIXME OBSOLETE */
15#define WATCHDOG_MINOR 130 /* Watchdog timer */ 15#define WATCHDOG_MINOR 130 /* Watchdog timer */
16#define TEMP_MINOR 131 /* Temperature Sensor */ 16#define TEMP_MINOR 131 /* Temperature Sensor */
17#define RTC_MINOR 135 17#define RTC_MINOR 135
18#define EFI_RTC_MINOR 136 /* EFI Time services */ 18#define EFI_RTC_MINOR 136 /* EFI Time services */
19#define SUN_OPENPROM_MINOR 139 19#define SUN_OPENPROM_MINOR 139
20#define DMAPI_MINOR 140 /* DMAPI */ 20#define DMAPI_MINOR 140 /* DMAPI */
21#define NVRAM_MINOR 144 21#define NVRAM_MINOR 144
22#define SGI_MMTIMER 153 22#define SGI_MMTIMER 153
23#define STORE_QUEUE_MINOR 155 23#define STORE_QUEUE_MINOR 155
24#define I2O_MINOR 166 24#define I2O_MINOR 166
25#define MICROCODE_MINOR 184 25#define MICROCODE_MINOR 184
26#define MWAVE_MINOR 219 /* ACP/Mwave Modem */ 26#define TUN_MINOR 200
27#define MPT_MINOR 220 27#define MWAVE_MINOR 219 /* ACP/Mwave Modem */
28#define MISC_DYNAMIC_MINOR 255 28#define MPT_MINOR 220
29 29#define HPET_MINOR 228
30#define TUN_MINOR 200 30#define FUSE_MINOR 229
31#define HPET_MINOR 228 31#define KVM_MINOR 232
32#define KVM_MINOR 232 32#define MISC_DYNAMIC_MINOR 255
33 33
34struct device; 34struct device;
35 35
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 371086fd946f..8f659cc29960 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -206,6 +206,7 @@ struct mlx4_caps {
206 int reserved_cqs; 206 int reserved_cqs;
207 int num_eqs; 207 int num_eqs;
208 int reserved_eqs; 208 int reserved_eqs;
209 int num_comp_vectors;
209 int num_mpts; 210 int num_mpts;
210 int num_mtt_segs; 211 int num_mtt_segs;
211 int fmr_reserved_mtts; 212 int fmr_reserved_mtts;
@@ -328,6 +329,7 @@ struct mlx4_cq {
328 int arm_sn; 329 int arm_sn;
329 330
330 int cqn; 331 int cqn;
332 unsigned vector;
331 333
332 atomic_t refcount; 334 atomic_t refcount;
333 struct completion free; 335 struct completion free;
@@ -437,7 +439,7 @@ void mlx4_free_hwq_res(struct mlx4_dev *mdev, struct mlx4_hwq_resources *wqres,
437 439
438int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt, 440int mlx4_cq_alloc(struct mlx4_dev *dev, int nent, struct mlx4_mtt *mtt,
439 struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq, 441 struct mlx4_uar *uar, u64 db_rec, struct mlx4_cq *cq,
440 int collapsed); 442 unsigned vector, int collapsed);
441void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq); 443void mlx4_cq_free(struct mlx4_dev *dev, struct mlx4_cq *cq);
442 444
443int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base); 445int mlx4_qp_reserve_range(struct mlx4_dev *dev, int cnt, int align, int *base);
diff --git a/include/linux/mm.h b/include/linux/mm.h
index ffee2f743418..b91a73fd1bcc 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -56,19 +56,9 @@ extern unsigned long mmap_min_addr;
56 56
57extern struct kmem_cache *vm_area_cachep; 57extern struct kmem_cache *vm_area_cachep;
58 58
59/*
60 * This struct defines the per-mm list of VMAs for uClinux. If CONFIG_MMU is
61 * disabled, then there's a single shared list of VMAs maintained by the
62 * system, and mm's subscribe to these individually
63 */
64struct vm_list_struct {
65 struct vm_list_struct *next;
66 struct vm_area_struct *vma;
67};
68
69#ifndef CONFIG_MMU 59#ifndef CONFIG_MMU
70extern struct rb_root nommu_vma_tree; 60extern struct rb_root nommu_region_tree;
71extern struct rw_semaphore nommu_vma_sem; 61extern struct rw_semaphore nommu_region_sem;
72 62
73extern unsigned int kobjsize(const void *objp); 63extern unsigned int kobjsize(const void *objp);
74#endif 64#endif
@@ -145,6 +135,23 @@ extern pgprot_t protection_map[16];
145#define FAULT_FLAG_WRITE 0x01 /* Fault was a write access */ 135#define FAULT_FLAG_WRITE 0x01 /* Fault was a write access */
146#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */ 136#define FAULT_FLAG_NONLINEAR 0x02 /* Fault was via a nonlinear mapping */
147 137
138/*
139 * This interface is used by x86 PAT code to identify a pfn mapping that is
140 * linear over entire vma. This is to optimize PAT code that deals with
141 * marking the physical region with a particular prot. This is not for generic
142 * mm use. Note also that this check will not work if the pfn mapping is
143 * linear for a vma starting at physical address 0. In which case PAT code
144 * falls back to slow path of reserving physical range page by page.
145 */
146static inline int is_linear_pfn_mapping(struct vm_area_struct *vma)
147{
148 return ((vma->vm_flags & VM_PFNMAP) && vma->vm_pgoff);
149}
150
151static inline int is_pfn_mapping(struct vm_area_struct *vma)
152{
153 return (vma->vm_flags & VM_PFNMAP);
154}
148 155
149/* 156/*
150 * vm_fault is filled by the the pagefault handler and passed to the vma's 157 * vm_fault is filled by the the pagefault handler and passed to the vma's
@@ -700,6 +707,11 @@ static inline int page_mapped(struct page *page)
700 707
701#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS) 708#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS)
702 709
710/*
711 * Can be called by the pagefault handler when it gets a VM_FAULT_OOM.
712 */
713extern void pagefault_out_of_memory(void);
714
703#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) 715#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
704 716
705extern void show_free_areas(void); 717extern void show_free_areas(void);
@@ -781,6 +793,8 @@ int copy_page_range(struct mm_struct *dst, struct mm_struct *src,
781 struct vm_area_struct *vma); 793 struct vm_area_struct *vma);
782void unmap_mapping_range(struct address_space *mapping, 794void unmap_mapping_range(struct address_space *mapping,
783 loff_t const holebegin, loff_t const holelen, int even_cows); 795 loff_t const holebegin, loff_t const holelen, int even_cows);
796int follow_phys(struct vm_area_struct *vma, unsigned long address,
797 unsigned int flags, unsigned long *prot, resource_size_t *phys);
784int generic_access_phys(struct vm_area_struct *vma, unsigned long addr, 798int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
785 void *buf, int len, int write); 799 void *buf, int len, int write);
786 800
@@ -1037,6 +1051,7 @@ extern void memmap_init_zone(unsigned long, int, unsigned long,
1037 unsigned long, enum memmap_context); 1051 unsigned long, enum memmap_context);
1038extern void setup_per_zone_pages_min(void); 1052extern void setup_per_zone_pages_min(void);
1039extern void mem_init(void); 1053extern void mem_init(void);
1054extern void __init mmap_init(void);
1040extern void show_mem(void); 1055extern void show_mem(void);
1041extern void si_meminfo(struct sysinfo * val); 1056extern void si_meminfo(struct sysinfo * val);
1042extern void si_meminfo_node(struct sysinfo *val, int nid); 1057extern void si_meminfo_node(struct sysinfo *val, int nid);
@@ -1048,6 +1063,9 @@ extern void setup_per_cpu_pageset(void);
1048static inline void setup_per_cpu_pageset(void) {} 1063static inline void setup_per_cpu_pageset(void) {}
1049#endif 1064#endif
1050 1065
1066/* nommu.c */
1067extern atomic_t mmap_pages_allocated;
1068
1051/* prio_tree.c */ 1069/* prio_tree.c */
1052void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old); 1070void vma_prio_tree_add(struct vm_area_struct *, struct vm_area_struct *old);
1053void vma_prio_tree_insert(struct vm_area_struct *, struct prio_tree_root *); 1071void vma_prio_tree_insert(struct vm_area_struct *, struct prio_tree_root *);
@@ -1286,5 +1304,7 @@ int vmemmap_populate_basepages(struct page *start_page,
1286int vmemmap_populate(struct page *start_page, unsigned long pages, int node); 1304int vmemmap_populate(struct page *start_page, unsigned long pages, int node);
1287void vmemmap_populate_print_last(void); 1305void vmemmap_populate_print_last(void);
1288 1306
1307extern void *alloc_locked_buffer(size_t size);
1308extern void free_locked_buffer(void *buffer, size_t size);
1289#endif /* __KERNEL__ */ 1309#endif /* __KERNEL__ */
1290#endif /* _LINUX_MM_H */ 1310#endif /* _LINUX_MM_H */
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h
index c948350c378e..7fbb97267556 100644
--- a/include/linux/mm_inline.h
+++ b/include/linux/mm_inline.h
@@ -28,6 +28,7 @@ add_page_to_lru_list(struct zone *zone, struct page *page, enum lru_list l)
28{ 28{
29 list_add(&page->lru, &zone->lru[l].list); 29 list_add(&page->lru, &zone->lru[l].list);
30 __inc_zone_state(zone, NR_LRU_BASE + l); 30 __inc_zone_state(zone, NR_LRU_BASE + l);
31 mem_cgroup_add_lru_list(page, l);
31} 32}
32 33
33static inline void 34static inline void
@@ -35,6 +36,7 @@ del_page_from_lru_list(struct zone *zone, struct page *page, enum lru_list l)
35{ 36{
36 list_del(&page->lru); 37 list_del(&page->lru);
37 __dec_zone_state(zone, NR_LRU_BASE + l); 38 __dec_zone_state(zone, NR_LRU_BASE + l);
39 mem_cgroup_del_lru_list(page, l);
38} 40}
39 41
40static inline void 42static inline void
@@ -54,6 +56,7 @@ del_page_from_lru(struct zone *zone, struct page *page)
54 l += page_is_file_cache(page); 56 l += page_is_file_cache(page);
55 } 57 }
56 __dec_zone_state(zone, NR_LRU_BASE + l); 58 __dec_zone_state(zone, NR_LRU_BASE + l);
59 mem_cgroup_del_lru_list(page, l);
57} 60}
58 61
59/** 62/**
@@ -78,23 +81,4 @@ static inline enum lru_list page_lru(struct page *page)
78 return lru; 81 return lru;
79} 82}
80 83
81/**
82 * inactive_anon_is_low - check if anonymous pages need to be deactivated
83 * @zone: zone to check
84 *
85 * Returns true if the zone does not have enough inactive anon pages,
86 * meaning some active anon pages need to be deactivated.
87 */
88static inline int inactive_anon_is_low(struct zone *zone)
89{
90 unsigned long active, inactive;
91
92 active = zone_page_state(zone, NR_ACTIVE_ANON);
93 inactive = zone_page_state(zone, NR_INACTIVE_ANON);
94
95 if (inactive * zone->inactive_ratio < active)
96 return 1;
97
98 return 0;
99}
100#endif 84#endif
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index fe825471d5aa..92915e81443f 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -97,6 +97,23 @@ struct page {
97}; 97};
98 98
99/* 99/*
100 * A region containing a mapping of a non-memory backed file under NOMMU
101 * conditions. These are held in a global tree and are pinned by the VMAs that
102 * map parts of them.
103 */
104struct vm_region {
105 struct rb_node vm_rb; /* link in global region tree */
106 unsigned long vm_flags; /* VMA vm_flags */
107 unsigned long vm_start; /* start address of region */
108 unsigned long vm_end; /* region initialised to here */
109 unsigned long vm_top; /* region allocated to here */
110 unsigned long vm_pgoff; /* the offset in vm_file corresponding to vm_start */
111 struct file *vm_file; /* the backing file or NULL */
112
113 atomic_t vm_usage; /* region usage count */
114};
115
116/*
100 * This struct defines a memory VMM memory area. There is one of these 117 * This struct defines a memory VMM memory area. There is one of these
101 * per VM-area/task. A VM area is any part of the process virtual memory 118 * per VM-area/task. A VM area is any part of the process virtual memory
102 * space that has a special rule for the page-fault handlers (ie a shared 119 * space that has a special rule for the page-fault handlers (ie a shared
@@ -152,7 +169,7 @@ struct vm_area_struct {
152 unsigned long vm_truncate_count;/* truncate_count or restart_addr */ 169 unsigned long vm_truncate_count;/* truncate_count or restart_addr */
153 170
154#ifndef CONFIG_MMU 171#ifndef CONFIG_MMU
155 atomic_t vm_usage; /* refcount (VMAs shared if !MMU) */ 172 struct vm_region *vm_region; /* NOMMU mapping region */
156#endif 173#endif
157#ifdef CONFIG_NUMA 174#ifdef CONFIG_NUMA
158 struct mempolicy *vm_policy; /* NUMA policy for the VMA */ 175 struct mempolicy *vm_policy; /* NUMA policy for the VMA */
@@ -232,8 +249,9 @@ struct mm_struct {
232 struct core_state *core_state; /* coredumping support */ 249 struct core_state *core_state; /* coredumping support */
233 250
234 /* aio bits */ 251 /* aio bits */
235 rwlock_t ioctx_list_lock; /* aio lock */ 252 spinlock_t ioctx_lock;
236 struct kioctx *ioctx_list; 253 struct hlist_head ioctx_list;
254
237#ifdef CONFIG_MM_OWNER 255#ifdef CONFIG_MM_OWNER
238 /* 256 /*
239 * "owner" points to a task that is regarded as the canonical 257 * "owner" points to a task that is regarded as the canonical
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index 143cebf0586f..7ac8b500d55c 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -151,4 +151,6 @@ static inline void mmc_claim_host(struct mmc_host *host)
151 __mmc_claim_host(host, NULL); 151 __mmc_claim_host(host, NULL);
152} 152}
153 153
154extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max);
155
154#endif 156#endif
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index f842f234e44f..4e457256bd33 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -41,6 +41,7 @@ struct mmc_ios {
41 41
42#define MMC_BUS_WIDTH_1 0 42#define MMC_BUS_WIDTH_1 0
43#define MMC_BUS_WIDTH_4 2 43#define MMC_BUS_WIDTH_4 2
44#define MMC_BUS_WIDTH_8 3
44 45
45 unsigned char timing; /* timing specification used */ 46 unsigned char timing; /* timing specification used */
46 47
@@ -116,6 +117,7 @@ struct mmc_host {
116#define MMC_CAP_SDIO_IRQ (1 << 3) /* Can signal pending SDIO IRQs */ 117#define MMC_CAP_SDIO_IRQ (1 << 3) /* Can signal pending SDIO IRQs */
117#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ 118#define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */
118#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ 119#define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */
120#define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */
119 121
120 /* host specific block data */ 122 /* host specific block data */
121 unsigned int max_seg_size; /* see blk_queue_max_segment_size */ 123 unsigned int max_seg_size; /* see blk_queue_max_segment_size */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 35a7b5e19465..09c14e213b63 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -263,6 +263,19 @@ enum zone_type {
263#error ZONES_SHIFT -- too many zones configured adjust calculation 263#error ZONES_SHIFT -- too many zones configured adjust calculation
264#endif 264#endif
265 265
266struct zone_reclaim_stat {
267 /*
268 * The pageout code in vmscan.c keeps track of how many of the
269 * mem/swap backed and file backed pages are refeferenced.
270 * The higher the rotated/scanned ratio, the more valuable
271 * that cache is.
272 *
273 * The anon LRU stats live in [0], file LRU stats in [1]
274 */
275 unsigned long recent_rotated[2];
276 unsigned long recent_scanned[2];
277};
278
266struct zone { 279struct zone {
267 /* Fields commonly accessed by the page allocator */ 280 /* Fields commonly accessed by the page allocator */
268 unsigned long pages_min, pages_low, pages_high; 281 unsigned long pages_min, pages_low, pages_high;
@@ -315,16 +328,7 @@ struct zone {
315 unsigned long nr_scan; 328 unsigned long nr_scan;
316 } lru[NR_LRU_LISTS]; 329 } lru[NR_LRU_LISTS];
317 330
318 /* 331 struct zone_reclaim_stat reclaim_stat;
319 * The pageout code in vmscan.c keeps track of how many of the
320 * mem/swap backed and file backed pages are refeferenced.
321 * The higher the rotated/scanned ratio, the more valuable
322 * that cache is.
323 *
324 * The anon LRU stats live in [0], file LRU stats in [1]
325 */
326 unsigned long recent_rotated[2];
327 unsigned long recent_scanned[2];
328 332
329 unsigned long pages_scanned; /* since last reclaim */ 333 unsigned long pages_scanned; /* since last reclaim */
330 unsigned long flags; /* zone flags, see below */ 334 unsigned long flags; /* zone flags, see below */
diff --git a/include/linux/module.h b/include/linux/module.h
index 3bfed013350b..4f7ea12463d3 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -294,9 +294,6 @@ struct module
294 /* The size of the executable code in each section. */ 294 /* The size of the executable code in each section. */
295 unsigned int init_text_size, core_text_size; 295 unsigned int init_text_size, core_text_size;
296 296
297 /* The handle returned from unwind_add_table. */
298 void *unwind_info;
299
300 /* Arch-specific module values */ 297 /* Arch-specific module values */
301 struct mod_arch_specific arch; 298 struct mod_arch_specific arch;
302 299
@@ -368,6 +365,18 @@ struct module *module_text_address(unsigned long addr);
368struct module *__module_text_address(unsigned long addr); 365struct module *__module_text_address(unsigned long addr);
369int is_module_address(unsigned long addr); 366int is_module_address(unsigned long addr);
370 367
368static inline int within_module_core(unsigned long addr, struct module *mod)
369{
370 return (unsigned long)mod->module_core <= addr &&
371 addr < (unsigned long)mod->module_core + mod->core_size;
372}
373
374static inline int within_module_init(unsigned long addr, struct module *mod)
375{
376 return (unsigned long)mod->module_init <= addr &&
377 addr < (unsigned long)mod->module_init + mod->init_size;
378}
379
371/* Returns 0 and fills in value, defined and namebuf, or -ERANGE if 380/* Returns 0 and fills in value, defined and namebuf, or -ERANGE if
372 symnum out of range. */ 381 symnum out of range. */
373int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type, 382int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h
index eb1033957486..c1f40c2f7ffb 100644
--- a/include/linux/moduleloader.h
+++ b/include/linux/moduleloader.h
@@ -13,6 +13,9 @@ int module_frob_arch_sections(Elf_Ehdr *hdr,
13 char *secstrings, 13 char *secstrings,
14 struct module *mod); 14 struct module *mod);
15 15
16/* Additional bytes needed by arch in front of individual sections */
17unsigned int arch_mod_section_prepend(struct module *mod, unsigned int section);
18
16/* Allocator used for allocating struct module, core sections and init 19/* Allocator used for allocating struct module, core sections and init
17 sections. Returns NULL on failure. */ 20 sections. Returns NULL on failure. */
18void *module_alloc(unsigned long size); 21void *module_alloc(unsigned long size);
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index 6f4c180179e2..5375faca1f72 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -117,6 +117,7 @@ struct sioc_mif_req6
117 117
118#include <linux/pim.h> 118#include <linux/pim.h>
119#include <linux/skbuff.h> /* for struct sk_buff_head */ 119#include <linux/skbuff.h> /* for struct sk_buff_head */
120#include <net/net_namespace.h>
120 121
121#ifdef CONFIG_IPV6_MROUTE 122#ifdef CONFIG_IPV6_MROUTE
122static inline int ip6_mroute_opt(int opt) 123static inline int ip6_mroute_opt(int opt)
@@ -187,6 +188,9 @@ struct mif_device
187struct mfc6_cache 188struct mfc6_cache
188{ 189{
189 struct mfc6_cache *next; /* Next entry on cache line */ 190 struct mfc6_cache *next; /* Next entry on cache line */
191#ifdef CONFIG_NET_NS
192 struct net *mfc6_net;
193#endif
190 struct in6_addr mf6c_mcastgrp; /* Group the entry belongs to */ 194 struct in6_addr mf6c_mcastgrp; /* Group the entry belongs to */
191 struct in6_addr mf6c_origin; /* Source of packet */ 195 struct in6_addr mf6c_origin; /* Source of packet */
192 mifi_t mf6c_parent; /* Source interface */ 196 mifi_t mf6c_parent; /* Source interface */
@@ -209,6 +213,18 @@ struct mfc6_cache
209 } mfc_un; 213 } mfc_un;
210}; 214};
211 215
216static inline
217struct net *mfc6_net(const struct mfc6_cache *mfc)
218{
219 return read_pnet(&mfc->mfc6_net);
220}
221
222static inline
223void mfc6_net_set(struct mfc6_cache *mfc, struct net *net)
224{
225 write_pnet(&mfc->mfc6_net, hold_net(net));
226}
227
212#define MFC_STATIC 1 228#define MFC_STATIC 1
213#define MFC_NOTIFY 2 229#define MFC_NOTIFY 2
214 230
@@ -229,13 +245,17 @@ struct mfc6_cache
229 245
230#ifdef __KERNEL__ 246#ifdef __KERNEL__
231struct rtmsg; 247struct rtmsg;
232extern int ip6mr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait); 248extern int ip6mr_get_route(struct net *net, struct sk_buff *skb,
249 struct rtmsg *rtm, int nowait);
233 250
234#ifdef CONFIG_IPV6_MROUTE 251#ifdef CONFIG_IPV6_MROUTE
235extern struct sock *mroute6_socket; 252static inline struct sock *mroute6_socket(struct net *net)
253{
254 return net->ipv6.mroute6_sk;
255}
236extern int ip6mr_sk_done(struct sock *sk); 256extern int ip6mr_sk_done(struct sock *sk);
237#else 257#else
238#define mroute6_socket NULL 258static inline struct sock *mroute6_socket(struct net *net) { return NULL; }
239static inline int ip6mr_sk_done(struct sock *sk) { return 0; } 259static inline int ip6mr_sk_done(struct sock *sk) { return 0; }
240#endif 260#endif
241#endif 261#endif
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index 00e2b575021f..88d3d8fbf9f2 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -520,6 +520,7 @@ struct cfi_fixup {
520 520
521#define CFI_MFR_AMD 0x0001 521#define CFI_MFR_AMD 0x0001
522#define CFI_MFR_ATMEL 0x001F 522#define CFI_MFR_ATMEL 0x001F
523#define CFI_MFR_SAMSUNG 0x00EC
523#define CFI_MFR_ST 0x0020 /* STMicroelectronics */ 524#define CFI_MFR_ST 0x0020 /* STMicroelectronics */
524 525
525void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups); 526void cfi_fixup(struct mtd_info *mtd, struct cfi_fixup* fixups);
diff --git a/include/linux/mtd/concat.h b/include/linux/mtd/concat.h
index c02f3d264ecf..e80c674daeb3 100644
--- a/include/linux/mtd/concat.h
+++ b/include/linux/mtd/concat.h
@@ -13,7 +13,7 @@
13struct mtd_info *mtd_concat_create( 13struct mtd_info *mtd_concat_create(
14 struct mtd_info *subdev[], /* subdevices to concatenate */ 14 struct mtd_info *subdev[], /* subdevices to concatenate */
15 int num_devs, /* number of subdevices */ 15 int num_devs, /* number of subdevices */
16 char *name); /* name for the new device */ 16 const char *name); /* name for the new device */
17 17
18void mtd_concat_destroy(struct mtd_info *mtd); 18void mtd_concat_destroy(struct mtd_info *mtd);
19 19
diff --git a/include/linux/mtd/ftl.h b/include/linux/mtd/ftl.h
index 0be442f881dd..0555f7a0b9ed 100644
--- a/include/linux/mtd/ftl.h
+++ b/include/linux/mtd/ftl.h
@@ -32,25 +32,25 @@
32#define _LINUX_FTL_H 32#define _LINUX_FTL_H
33 33
34typedef struct erase_unit_header_t { 34typedef struct erase_unit_header_t {
35 u_int8_t LinkTargetTuple[5]; 35 uint8_t LinkTargetTuple[5];
36 u_int8_t DataOrgTuple[10]; 36 uint8_t DataOrgTuple[10];
37 u_int8_t NumTransferUnits; 37 uint8_t NumTransferUnits;
38 u_int32_t EraseCount; 38 uint32_t EraseCount;
39 u_int16_t LogicalEUN; 39 uint16_t LogicalEUN;
40 u_int8_t BlockSize; 40 uint8_t BlockSize;
41 u_int8_t EraseUnitSize; 41 uint8_t EraseUnitSize;
42 u_int16_t FirstPhysicalEUN; 42 uint16_t FirstPhysicalEUN;
43 u_int16_t NumEraseUnits; 43 uint16_t NumEraseUnits;
44 u_int32_t FormattedSize; 44 uint32_t FormattedSize;
45 u_int32_t FirstVMAddress; 45 uint32_t FirstVMAddress;
46 u_int16_t NumVMPages; 46 uint16_t NumVMPages;
47 u_int8_t Flags; 47 uint8_t Flags;
48 u_int8_t Code; 48 uint8_t Code;
49 u_int32_t SerialNumber; 49 uint32_t SerialNumber;
50 u_int32_t AltEUHOffset; 50 uint32_t AltEUHOffset;
51 u_int32_t BAMOffset; 51 uint32_t BAMOffset;
52 u_int8_t Reserved[12]; 52 uint8_t Reserved[12];
53 u_int8_t EndTuple[2]; 53 uint8_t EndTuple[2];
54} erase_unit_header_t; 54} erase_unit_header_t;
55 55
56/* Flags in erase_unit_header_t */ 56/* Flags in erase_unit_header_t */
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index aa30244492c6..b981b8772217 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -223,6 +223,7 @@ struct map_info {
223 must leave it enabled. */ 223 must leave it enabled. */
224 void (*set_vpp)(struct map_info *, int); 224 void (*set_vpp)(struct map_info *, int);
225 225
226 unsigned long pfow_base;
226 unsigned long map_priv_1; 227 unsigned long map_priv_1;
227 unsigned long map_priv_2; 228 unsigned long map_priv_2;
228 void *fldrv_priv; 229 void *fldrv_priv;
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index eae26bb6430a..3aa5d77c2cdb 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -15,6 +15,8 @@
15#include <linux/mtd/compatmac.h> 15#include <linux/mtd/compatmac.h>
16#include <mtd/mtd-abi.h> 16#include <mtd/mtd-abi.h>
17 17
18#include <asm/div64.h>
19
18#define MTD_CHAR_MAJOR 90 20#define MTD_CHAR_MAJOR 90
19#define MTD_BLOCK_MAJOR 31 21#define MTD_BLOCK_MAJOR 31
20#define MAX_MTD_DEVICES 32 22#define MAX_MTD_DEVICES 32
@@ -25,20 +27,20 @@
25#define MTD_ERASE_DONE 0x08 27#define MTD_ERASE_DONE 0x08
26#define MTD_ERASE_FAILED 0x10 28#define MTD_ERASE_FAILED 0x10
27 29
28#define MTD_FAIL_ADDR_UNKNOWN 0xffffffff 30#define MTD_FAIL_ADDR_UNKNOWN -1LL
29 31
30/* If the erase fails, fail_addr might indicate exactly which block failed. If 32/* If the erase fails, fail_addr might indicate exactly which block failed. If
31 fail_addr = MTD_FAIL_ADDR_UNKNOWN, the failure was not at the device level or was not 33 fail_addr = MTD_FAIL_ADDR_UNKNOWN, the failure was not at the device level or was not
32 specific to any particular block. */ 34 specific to any particular block. */
33struct erase_info { 35struct erase_info {
34 struct mtd_info *mtd; 36 struct mtd_info *mtd;
35 u_int32_t addr; 37 uint64_t addr;
36 u_int32_t len; 38 uint64_t len;
37 u_int32_t fail_addr; 39 uint64_t fail_addr;
38 u_long time; 40 u_long time;
39 u_long retries; 41 u_long retries;
40 u_int dev; 42 unsigned dev;
41 u_int cell; 43 unsigned cell;
42 void (*callback) (struct erase_info *self); 44 void (*callback) (struct erase_info *self);
43 u_long priv; 45 u_long priv;
44 u_char state; 46 u_char state;
@@ -46,9 +48,9 @@ struct erase_info {
46}; 48};
47 49
48struct mtd_erase_region_info { 50struct mtd_erase_region_info {
49 u_int32_t offset; /* At which this region starts, from the beginning of the MTD */ 51 uint64_t offset; /* At which this region starts, from the beginning of the MTD */
50 u_int32_t erasesize; /* For this region */ 52 uint32_t erasesize; /* For this region */
51 u_int32_t numblocks; /* Number of blocks of erasesize in this region */ 53 uint32_t numblocks; /* Number of blocks of erasesize in this region */
52 unsigned long *lockmap; /* If keeping bitmap of locks */ 54 unsigned long *lockmap; /* If keeping bitmap of locks */
53}; 55};
54 56
@@ -83,7 +85,7 @@ typedef enum {
83 * @datbuf: data buffer - if NULL only oob data are read/written 85 * @datbuf: data buffer - if NULL only oob data are read/written
84 * @oobbuf: oob data buffer 86 * @oobbuf: oob data buffer
85 * 87 *
86 * Note, it is allowed to read more then one OOB area at one go, but not write. 88 * Note, it is allowed to read more than one OOB area at one go, but not write.
87 * The interface assumes that the OOB write requests program only one page's 89 * The interface assumes that the OOB write requests program only one page's
88 * OOB area. 90 * OOB area.
89 */ 91 */
@@ -100,14 +102,14 @@ struct mtd_oob_ops {
100 102
101struct mtd_info { 103struct mtd_info {
102 u_char type; 104 u_char type;
103 u_int32_t flags; 105 uint32_t flags;
104 u_int32_t size; // Total size of the MTD 106 uint64_t size; // Total size of the MTD
105 107
106 /* "Major" erase size for the device. Naïve users may take this 108 /* "Major" erase size for the device. Naïve users may take this
107 * to be the only erase size available, or may use the more detailed 109 * to be the only erase size available, or may use the more detailed
108 * information below if they desire 110 * information below if they desire
109 */ 111 */
110 u_int32_t erasesize; 112 uint32_t erasesize;
111 /* Minimal writable flash unit size. In case of NOR flash it is 1 (even 113 /* Minimal writable flash unit size. In case of NOR flash it is 1 (even
112 * though individual bits can be cleared), in case of NAND flash it is 114 * though individual bits can be cleared), in case of NAND flash it is
113 * one NAND page (or half, or one-fourths of it), in case of ECC-ed NOR 115 * one NAND page (or half, or one-fourths of it), in case of ECC-ed NOR
@@ -115,10 +117,20 @@ struct mtd_info {
115 * Any driver registering a struct mtd_info must ensure a writesize of 117 * Any driver registering a struct mtd_info must ensure a writesize of
116 * 1 or larger. 118 * 1 or larger.
117 */ 119 */
118 u_int32_t writesize; 120 uint32_t writesize;
121
122 uint32_t oobsize; // Amount of OOB data per block (e.g. 16)
123 uint32_t oobavail; // Available OOB bytes per block
119 124
120 u_int32_t oobsize; // Amount of OOB data per block (e.g. 16) 125 /*
121 u_int32_t oobavail; // Available OOB bytes per block 126 * If erasesize is a power of 2 then the shift is stored in
127 * erasesize_shift otherwise erasesize_shift is zero. Ditto writesize.
128 */
129 unsigned int erasesize_shift;
130 unsigned int writesize_shift;
131 /* Masks based on erasesize_shift and writesize_shift */
132 unsigned int erasesize_mask;
133 unsigned int writesize_mask;
122 134
123 // Kernel-only stuff starts here. 135 // Kernel-only stuff starts here.
124 const char *name; 136 const char *name;
@@ -190,8 +202,8 @@ struct mtd_info {
190 void (*sync) (struct mtd_info *mtd); 202 void (*sync) (struct mtd_info *mtd);
191 203
192 /* Chip-supported device locking */ 204 /* Chip-supported device locking */
193 int (*lock) (struct mtd_info *mtd, loff_t ofs, size_t len); 205 int (*lock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
194 int (*unlock) (struct mtd_info *mtd, loff_t ofs, size_t len); 206 int (*unlock) (struct mtd_info *mtd, loff_t ofs, uint64_t len);
195 207
196 /* Power Management functions */ 208 /* Power Management functions */
197 int (*suspend) (struct mtd_info *mtd); 209 int (*suspend) (struct mtd_info *mtd);
@@ -221,6 +233,35 @@ struct mtd_info {
221 void (*put_device) (struct mtd_info *mtd); 233 void (*put_device) (struct mtd_info *mtd);
222}; 234};
223 235
236static inline uint32_t mtd_div_by_eb(uint64_t sz, struct mtd_info *mtd)
237{
238 if (mtd->erasesize_shift)
239 return sz >> mtd->erasesize_shift;
240 do_div(sz, mtd->erasesize);
241 return sz;
242}
243
244static inline uint32_t mtd_mod_by_eb(uint64_t sz, struct mtd_info *mtd)
245{
246 if (mtd->erasesize_shift)
247 return sz & mtd->erasesize_mask;
248 return do_div(sz, mtd->erasesize);
249}
250
251static inline uint32_t mtd_div_by_ws(uint64_t sz, struct mtd_info *mtd)
252{
253 if (mtd->writesize_shift)
254 return sz >> mtd->writesize_shift;
255 do_div(sz, mtd->writesize);
256 return sz;
257}
258
259static inline uint32_t mtd_mod_by_ws(uint64_t sz, struct mtd_info *mtd)
260{
261 if (mtd->writesize_shift)
262 return sz & mtd->writesize_mask;
263 return do_div(sz, mtd->writesize);
264}
224 265
225 /* Kernel-side ioctl definitions */ 266 /* Kernel-side ioctl definitions */
226 267
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 733d3f3b4eb8..db5b63da2a7e 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -335,17 +335,12 @@ struct nand_buffers {
335 * @erase_cmd: [INTERN] erase command write function, selectable due to AND support 335 * @erase_cmd: [INTERN] erase command write function, selectable due to AND support
336 * @scan_bbt: [REPLACEABLE] function to scan bad block table 336 * @scan_bbt: [REPLACEABLE] function to scan bad block table
337 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR) 337 * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR)
338 * @wq: [INTERN] wait queue to sleep on if a NAND operation is in progress
339 * @state: [INTERN] the current state of the NAND device 338 * @state: [INTERN] the current state of the NAND device
340 * @oob_poi: poison value buffer 339 * @oob_poi: poison value buffer
341 * @page_shift: [INTERN] number of address bits in a page (column address bits) 340 * @page_shift: [INTERN] number of address bits in a page (column address bits)
342 * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock 341 * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock
343 * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry 342 * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry
344 * @chip_shift: [INTERN] number of address bits in one chip 343 * @chip_shift: [INTERN] number of address bits in one chip
345 * @datbuf: [INTERN] internal buffer for one page + oob
346 * @oobbuf: [INTERN] oob buffer for one eraseblock
347 * @oobdirty: [INTERN] indicates that oob_buf must be reinitialized
348 * @data_poi: [INTERN] pointer to a data buffer
349 * @options: [BOARDSPECIFIC] various chip options. They can partly be set to inform nand_scan about 344 * @options: [BOARDSPECIFIC] various chip options. They can partly be set to inform nand_scan about
350 * special functionality. See the defines for further explanation 345 * special functionality. See the defines for further explanation
351 * @badblockpos: [INTERN] position of the bad block marker in the oob area 346 * @badblockpos: [INTERN] position of the bad block marker in the oob area
@@ -399,7 +394,7 @@ struct nand_chip {
399 int bbt_erase_shift; 394 int bbt_erase_shift;
400 int chip_shift; 395 int chip_shift;
401 int numchips; 396 int numchips;
402 unsigned long chipsize; 397 uint64_t chipsize;
403 int pagemask; 398 int pagemask;
404 int pagebuf; 399 int pagebuf;
405 int subpagesize; 400 int subpagesize;
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index c92b4d439609..a45dd831b3f8 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -36,9 +36,9 @@
36 36
37struct mtd_partition { 37struct mtd_partition {
38 char *name; /* identifier string */ 38 char *name; /* identifier string */
39 u_int32_t size; /* partition size */ 39 uint64_t size; /* partition size */
40 u_int32_t offset; /* offset within the master MTD space */ 40 uint64_t offset; /* offset within the master MTD space */
41 u_int32_t mask_flags; /* master MTD flags to mask out for this partition */ 41 uint32_t mask_flags; /* master MTD flags to mask out for this partition */
42 struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only)*/ 42 struct nand_ecclayout *ecclayout; /* out of band layout for this partition (NAND only)*/
43 struct mtd_info **mtdp; /* pointer to store the MTD object */ 43 struct mtd_info **mtdp; /* pointer to store the MTD object */
44}; 44};
diff --git a/include/linux/mtd/pfow.h b/include/linux/mtd/pfow.h
new file mode 100644
index 000000000000..b730d4f84655
--- /dev/null
+++ b/include/linux/mtd/pfow.h
@@ -0,0 +1,159 @@
1/* Primary function overlay window definitions
2 * and service functions used by LPDDR chips
3 */
4#ifndef __LINUX_MTD_PFOW_H
5#define __LINUX_MTD_PFOW_H
6
7#include <linux/mtd/qinfo.h>
8
9/* PFOW registers addressing */
10/* Address of symbol "P" */
11#define PFOW_QUERY_STRING_P 0x0000
12/* Address of symbol "F" */
13#define PFOW_QUERY_STRING_F 0x0002
14/* Address of symbol "O" */
15#define PFOW_QUERY_STRING_O 0x0004
16/* Address of symbol "W" */
17#define PFOW_QUERY_STRING_W 0x0006
18/* Identification info for LPDDR chip */
19#define PFOW_MANUFACTURER_ID 0x0020
20#define PFOW_DEVICE_ID 0x0022
21/* Address in PFOW where prog buffer can can be found */
22#define PFOW_PROGRAM_BUFFER_OFFSET 0x0040
23/* Size of program buffer in words */
24#define PFOW_PROGRAM_BUFFER_SIZE 0x0042
25/* Address command code register */
26#define PFOW_COMMAND_CODE 0x0080
27/* command data register */
28#define PFOW_COMMAND_DATA 0x0084
29/* command address register lower address bits */
30#define PFOW_COMMAND_ADDRESS_L 0x0088
31/* command address register upper address bits */
32#define PFOW_COMMAND_ADDRESS_H 0x008a
33/* number of bytes to be proggrammed lower address bits */
34#define PFOW_DATA_COUNT_L 0x0090
35/* number of bytes to be proggrammed higher address bits */
36#define PFOW_DATA_COUNT_H 0x0092
37/* command execution register, the only possible value is 0x01 */
38#define PFOW_COMMAND_EXECUTE 0x00c0
39/* 0x01 should be written at this address to clear buffer */
40#define PFOW_CLEAR_PROGRAM_BUFFER 0x00c4
41/* device program/erase suspend register */
42#define PFOW_PROGRAM_ERASE_SUSPEND 0x00c8
43/* device status register */
44#define PFOW_DSR 0x00cc
45
46/* LPDDR memory device command codes */
47/* They are possible values of PFOW command code register */
48#define LPDDR_WORD_PROGRAM 0x0041
49#define LPDDR_BUFF_PROGRAM 0x00E9
50#define LPDDR_BLOCK_ERASE 0x0020
51#define LPDDR_LOCK_BLOCK 0x0061
52#define LPDDR_UNLOCK_BLOCK 0x0062
53#define LPDDR_READ_BLOCK_LOCK_STATUS 0x0065
54#define LPDDR_INFO_QUERY 0x0098
55#define LPDDR_READ_OTP 0x0097
56#define LPDDR_PROG_OTP 0x00C0
57#define LPDDR_RESUME 0x00D0
58
59/* Defines possible value of PFOW command execution register */
60#define LPDDR_START_EXECUTION 0x0001
61
62/* Defines possible value of PFOW program/erase suspend register */
63#define LPDDR_SUSPEND 0x0001
64
65/* Possible values of PFOW device status register */
66/* access R - read; RC read & clearable */
67#define DSR_DPS (1<<1) /* RC; device protect status
68 * 0 - not protected 1 - locked */
69#define DSR_PSS (1<<2) /* R; program suspend status;
70 * 0-prog in progress/completed,
71 * 1- prog suspended */
72#define DSR_VPPS (1<<3) /* RC; 0-Vpp OK, * 1-Vpp low */
73#define DSR_PROGRAM_STATUS (1<<4) /* RC; 0-successful, 1-error */
74#define DSR_ERASE_STATUS (1<<5) /* RC; erase or blank check status;
75 * 0-success erase/blank check,
76 * 1 blank check error */
77#define DSR_ESS (1<<6) /* R; erase suspend status;
78 * 0-erase in progress/complete,
79 * 1 erase suspended */
80#define DSR_READY_STATUS (1<<7) /* R; Device status
81 * 0-busy,
82 * 1-ready */
83#define DSR_RPS (0x3<<8) /* RC; region program status
84 * 00 - Success,
85 * 01-re-program attempt in region with
86 * object mode data,
87 * 10-object mode program w attempt in
88 * region with control mode data
89 * 11-attempt to program invalid half
90 * with 0x41 command */
91#define DSR_AOS (1<<12) /* RC; 1- AO related failure */
92#define DSR_AVAILABLE (1<<15) /* R; Device availbility
93 * 1 - Device available
94 * 0 - not available */
95
96/* The superset of all possible error bits in DSR */
97#define DSR_ERR 0x133A
98
99static inline void send_pfow_command(struct map_info *map,
100 unsigned long cmd_code, unsigned long adr,
101 unsigned long len, map_word *datum)
102{
103 int bits_per_chip = map_bankwidth(map) * 8;
104 int chipnum;
105 struct lpddr_private *lpddr = map->fldrv_priv;
106 chipnum = adr >> lpddr->chipshift;
107
108 map_write(map, CMD(cmd_code), map->pfow_base + PFOW_COMMAND_CODE);
109 map_write(map, CMD(adr & ((1<<bits_per_chip) - 1)),
110 map->pfow_base + PFOW_COMMAND_ADDRESS_L);
111 map_write(map, CMD(adr>>bits_per_chip),
112 map->pfow_base + PFOW_COMMAND_ADDRESS_H);
113 if (len) {
114 map_write(map, CMD(len & ((1<<bits_per_chip) - 1)),
115 map->pfow_base + PFOW_DATA_COUNT_L);
116 map_write(map, CMD(len>>bits_per_chip),
117 map->pfow_base + PFOW_DATA_COUNT_H);
118 }
119 if (datum)
120 map_write(map, *datum, map->pfow_base + PFOW_COMMAND_DATA);
121
122 /* Command execution start */
123 map_write(map, CMD(LPDDR_START_EXECUTION),
124 map->pfow_base + PFOW_COMMAND_EXECUTE);
125}
126
127static inline void print_drs_error(unsigned dsr)
128{
129 int prog_status = (dsr & DSR_RPS) >> 8;
130
131 if (!(dsr & DSR_AVAILABLE))
132 printk(KERN_NOTICE"DSR.15: (0) Device not Available\n");
133 if (prog_status & 0x03)
134 printk(KERN_NOTICE"DSR.9,8: (11) Attempt to program invalid "
135 "half with 41h command\n");
136 else if (prog_status & 0x02)
137 printk(KERN_NOTICE"DSR.9,8: (10) Object Mode Program attempt "
138 "in region with Control Mode data\n");
139 else if (prog_status & 0x01)
140 printk(KERN_NOTICE"DSR.9,8: (01) Program attempt in region "
141 "with Object Mode data\n");
142 if (!(dsr & DSR_READY_STATUS))
143 printk(KERN_NOTICE"DSR.7: (0) Device is Busy\n");
144 if (dsr & DSR_ESS)
145 printk(KERN_NOTICE"DSR.6: (1) Erase Suspended\n");
146 if (dsr & DSR_ERASE_STATUS)
147 printk(KERN_NOTICE"DSR.5: (1) Erase/Blank check error\n");
148 if (dsr & DSR_PROGRAM_STATUS)
149 printk(KERN_NOTICE"DSR.4: (1) Program Error\n");
150 if (dsr & DSR_VPPS)
151 printk(KERN_NOTICE"DSR.3: (1) Vpp low detect, operation "
152 "aborted\n");
153 if (dsr & DSR_PSS)
154 printk(KERN_NOTICE"DSR.2: (1) Program suspended\n");
155 if (dsr & DSR_DPS)
156 printk(KERN_NOTICE"DSR.1: (1) Aborted Erase/Program attempt "
157 "on locked block\n");
158}
159#endif /* __LINUX_MTD_PFOW_H */
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h
index c8e63a5ee72e..76f7cabf07d3 100644
--- a/include/linux/mtd/physmap.h
+++ b/include/linux/mtd/physmap.h
@@ -24,6 +24,7 @@ struct physmap_flash_data {
24 unsigned int width; 24 unsigned int width;
25 void (*set_vpp)(struct map_info *, int); 25 void (*set_vpp)(struct map_info *, int);
26 unsigned int nr_parts; 26 unsigned int nr_parts;
27 unsigned int pfow_base;
27 struct mtd_partition *parts; 28 struct mtd_partition *parts;
28}; 29};
29 30
diff --git a/include/linux/mtd/qinfo.h b/include/linux/mtd/qinfo.h
new file mode 100644
index 000000000000..7b3d487d8b3f
--- /dev/null
+++ b/include/linux/mtd/qinfo.h
@@ -0,0 +1,91 @@
1#ifndef __LINUX_MTD_QINFO_H
2#define __LINUX_MTD_QINFO_H
3
4#include <linux/mtd/map.h>
5#include <linux/wait.h>
6#include <linux/spinlock.h>
7#include <linux/delay.h>
8#include <linux/mtd/mtd.h>
9#include <linux/mtd/flashchip.h>
10#include <linux/mtd/partitions.h>
11
12/* lpddr_private describes lpddr flash chip in memory map
13 * @ManufactId - Chip Manufacture ID
14 * @DevId - Chip Device ID
15 * @qinfo - pointer to qinfo records describing the chip
16 * @numchips - number of chips including virual RWW partitions
17 * @chipshift - Chip/partiton size 2^chipshift
18 * @chips - per-chip data structure
19 */
20struct lpddr_private {
21 uint16_t ManufactId;
22 uint16_t DevId;
23 struct qinfo_chip *qinfo;
24 int numchips;
25 unsigned long chipshift;
26 struct flchip chips[0];
27};
28
29/* qinfo_query_info structure contains request information for
30 * each qinfo record
31 * @major - major number of qinfo record
32 * @major - minor number of qinfo record
33 * @id_str - descriptive string to access the record
34 * @desc - detailed description for the qinfo record
35 */
36struct qinfo_query_info {
37 uint8_t major;
38 uint8_t minor;
39 char *id_str;
40 char *desc;
41};
42
43/*
44 * qinfo_chip structure contains necessary qinfo records data
45 * @DevSizeShift - Device size 2^n bytes
46 * @BufSizeShift - Program buffer size 2^n bytes
47 * @TotalBlocksNum - Total number of blocks
48 * @UniformBlockSizeShift - Uniform block size 2^UniformBlockSizeShift bytes
49 * @HWPartsNum - Number of hardware partitions
50 * @SuspEraseSupp - Suspend erase supported
51 * @SingleWordProgTime - Single word program 2^SingleWordProgTime u-sec
52 * @ProgBufferTime - Program buffer write 2^ProgBufferTime u-sec
53 * @BlockEraseTime - Block erase 2^BlockEraseTime m-sec
54 */
55struct qinfo_chip {
56 /* General device info */
57 uint16_t DevSizeShift;
58 uint16_t BufSizeShift;
59 /* Erase block information */
60 uint16_t TotalBlocksNum;
61 uint16_t UniformBlockSizeShift;
62 /* Partition information */
63 uint16_t HWPartsNum;
64 /* Optional features */
65 uint16_t SuspEraseSupp;
66 /* Operation typical time */
67 uint16_t SingleWordProgTime;
68 uint16_t ProgBufferTime;
69 uint16_t BlockEraseTime;
70};
71
72/* defines for fixup usage */
73#define LPDDR_MFR_ANY 0xffff
74#define LPDDR_ID_ANY 0xffff
75#define NUMONYX_MFGR_ID 0x0089
76#define R18_DEVICE_ID_1G 0x893c
77
78static inline map_word lpddr_build_cmd(u_long cmd, struct map_info *map)
79{
80 map_word val = { {0} };
81 val.x[0] = cmd;
82 return val;
83}
84
85#define CMD(x) lpddr_build_cmd(x, map)
86#define CMDVAL(cmd) cmd.x[0]
87
88struct mtd_info *lpddr_cmdset(struct map_info *);
89
90#endif
91
diff --git a/include/linux/mtd/sharpsl.h b/include/linux/mtd/sharpsl.h
new file mode 100644
index 000000000000..25f4d2a845c1
--- /dev/null
+++ b/include/linux/mtd/sharpsl.h
@@ -0,0 +1,20 @@
1/*
2 * SharpSL NAND support
3 *
4 * Copyright (C) 2008 Dmitry Baryshkov
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/mtd/nand.h>
12#include <linux/mtd/nand_ecc.h>
13#include <linux/mtd/partitions.h>
14
15struct sharpsl_nand_platform_data {
16 struct nand_bbt_descr *badblock_pattern;
17 struct nand_ecclayout *ecc_layout;
18 struct mtd_partition *partitions;
19 unsigned int nr_partitions;
20};
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 99eb80306dc5..fc2e03579877 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -94,4 +94,9 @@ static inline char *nd_get_link(struct nameidata *nd)
94 return nd->saved_names[nd->depth]; 94 return nd->saved_names[nd->depth];
95} 95}
96 96
97static inline void nd_terminate_link(void *name, size_t len, size_t maxlen)
98{
99 ((char *) name)[min(len, maxlen)] = '\0';
100}
101
97#endif /* _LINUX_NAMEI_H */ 102#endif /* _LINUX_NAMEI_H */
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index 9f2d76347f19..f69e66d151cc 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -87,7 +87,7 @@ struct ncp_objectname_ioctl
87#define NCP_AUTH_NDS 0x32 87#define NCP_AUTH_NDS 0x32
88 int auth_type; 88 int auth_type;
89 size_t object_name_len; 89 size_t object_name_len;
90 void __user * object_name; /* an userspace data, in most cases user name */ 90 void __user * object_name; /* a userspace data, in most cases user name */
91}; 91};
92 92
93struct ncp_privatedata_ioctl 93struct ncp_privatedata_ioctl
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index e26f54952892..f24556813375 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -43,6 +43,9 @@
43 43
44#include <net/net_namespace.h> 44#include <net/net_namespace.h>
45#include <net/dsa.h> 45#include <net/dsa.h>
46#ifdef CONFIG_DCB
47#include <net/dcbnl.h>
48#endif
46 49
47struct vlan_group; 50struct vlan_group;
48struct ethtool_ops; 51struct ethtool_ops;
@@ -310,9 +313,11 @@ struct napi_struct {
310#ifdef CONFIG_NETPOLL 313#ifdef CONFIG_NETPOLL
311 spinlock_t poll_lock; 314 spinlock_t poll_lock;
312 int poll_owner; 315 int poll_owner;
316#endif
313 struct net_device *dev; 317 struct net_device *dev;
314 struct list_head dev_list; 318 struct list_head dev_list;
315#endif 319 struct sk_buff *gro_list;
320 struct sk_buff *skb;
316}; 321};
317 322
318enum 323enum
@@ -373,22 +378,8 @@ static inline int napi_reschedule(struct napi_struct *napi)
373 * 378 *
374 * Mark NAPI processing as complete. 379 * Mark NAPI processing as complete.
375 */ 380 */
376static inline void __napi_complete(struct napi_struct *n) 381extern void __napi_complete(struct napi_struct *n);
377{ 382extern void napi_complete(struct napi_struct *n);
378 BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
379 list_del(&n->poll_list);
380 smp_mb__before_clear_bit();
381 clear_bit(NAPI_STATE_SCHED, &n->state);
382}
383
384static inline void napi_complete(struct napi_struct *n)
385{
386 unsigned long flags;
387
388 local_irq_save(flags);
389 __napi_complete(n);
390 local_irq_restore(flags);
391}
392 383
393/** 384/**
394 * napi_disable - prevent NAPI from scheduling 385 * napi_disable - prevent NAPI from scheduling
@@ -452,6 +443,147 @@ struct netdev_queue {
452 struct Qdisc *qdisc_sleeping; 443 struct Qdisc *qdisc_sleeping;
453} ____cacheline_aligned_in_smp; 444} ____cacheline_aligned_in_smp;
454 445
446
447/*
448 * This structure defines the management hooks for network devices.
449 * The following hooks can be defined; unless noted otherwise, they are
450 * optional and can be filled with a null pointer.
451 *
452 * int (*ndo_init)(struct net_device *dev);
453 * This function is called once when network device is registered.
454 * The network device can use this to any late stage initializaton
455 * or semantic validattion. It can fail with an error code which will
456 * be propogated back to register_netdev
457 *
458 * void (*ndo_uninit)(struct net_device *dev);
459 * This function is called when device is unregistered or when registration
460 * fails. It is not called if init fails.
461 *
462 * int (*ndo_open)(struct net_device *dev);
463 * This function is called when network device transistions to the up
464 * state.
465 *
466 * int (*ndo_stop)(struct net_device *dev);
467 * This function is called when network device transistions to the down
468 * state.
469 *
470 * int (*ndo_hard_start_xmit)(struct sk_buff *skb, struct net_device *dev);
471 * Called when a packet needs to be transmitted.
472 * Must return NETDEV_TX_OK , NETDEV_TX_BUSY, or NETDEV_TX_LOCKED,
473 * Required can not be NULL.
474 *
475 * u16 (*ndo_select_queue)(struct net_device *dev, struct sk_buff *skb);
476 * Called to decide which queue to when device supports multiple
477 * transmit queues.
478 *
479 * void (*ndo_change_rx_flags)(struct net_device *dev, int flags);
480 * This function is called to allow device receiver to make
481 * changes to configuration when multicast or promiscious is enabled.
482 *
483 * void (*ndo_set_rx_mode)(struct net_device *dev);
484 * This function is called device changes address list filtering.
485 *
486 * void (*ndo_set_multicast_list)(struct net_device *dev);
487 * This function is called when the multicast address list changes.
488 *
489 * int (*ndo_set_mac_address)(struct net_device *dev, void *addr);
490 * This function is called when the Media Access Control address
491 * needs to be changed. If not this interface is not defined, the
492 * mac address can not be changed.
493 *
494 * int (*ndo_validate_addr)(struct net_device *dev);
495 * Test if Media Access Control address is valid for the device.
496 *
497 * int (*ndo_do_ioctl)(struct net_device *dev, struct ifreq *ifr, int cmd);
498 * Called when a user request an ioctl which can't be handled by
499 * the generic interface code. If not defined ioctl's return
500 * not supported error code.
501 *
502 * int (*ndo_set_config)(struct net_device *dev, struct ifmap *map);
503 * Used to set network devices bus interface parameters. This interface
504 * is retained for legacy reason, new devices should use the bus
505 * interface (PCI) for low level management.
506 *
507 * int (*ndo_change_mtu)(struct net_device *dev, int new_mtu);
508 * Called when a user wants to change the Maximum Transfer Unit
509 * of a device. If not defined, any request to change MTU will
510 * will return an error.
511 *
512 * void (*ndo_tx_timeout)(struct net_device *dev);
513 * Callback uses when the transmitter has not made any progress
514 * for dev->watchdog ticks.
515 *
516 * struct net_device_stats* (*get_stats)(struct net_device *dev);
517 * Called when a user wants to get the network device usage
518 * statistics. If not defined, the counters in dev->stats will
519 * be used.
520 *
521 * void (*ndo_vlan_rx_register)(struct net_device *dev, struct vlan_group *grp);
522 * If device support VLAN receive accleration
523 * (ie. dev->features & NETIF_F_HW_VLAN_RX), then this function is called
524 * when vlan groups for the device changes. Note: grp is NULL
525 * if no vlan's groups are being used.
526 *
527 * void (*ndo_vlan_rx_add_vid)(struct net_device *dev, unsigned short vid);
528 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
529 * this function is called when a VLAN id is registered.
530 *
531 * void (*ndo_vlan_rx_kill_vid)(struct net_device *dev, unsigned short vid);
532 * If device support VLAN filtering (dev->features & NETIF_F_HW_VLAN_FILTER)
533 * this function is called when a VLAN id is unregistered.
534 *
535 * void (*ndo_poll_controller)(struct net_device *dev);
536 */
537#define HAVE_NET_DEVICE_OPS
538struct net_device_ops {
539 int (*ndo_init)(struct net_device *dev);
540 void (*ndo_uninit)(struct net_device *dev);
541 int (*ndo_open)(struct net_device *dev);
542 int (*ndo_stop)(struct net_device *dev);
543 int (*ndo_start_xmit) (struct sk_buff *skb,
544 struct net_device *dev);
545 u16 (*ndo_select_queue)(struct net_device *dev,
546 struct sk_buff *skb);
547#define HAVE_CHANGE_RX_FLAGS
548 void (*ndo_change_rx_flags)(struct net_device *dev,
549 int flags);
550#define HAVE_SET_RX_MODE
551 void (*ndo_set_rx_mode)(struct net_device *dev);
552#define HAVE_MULTICAST
553 void (*ndo_set_multicast_list)(struct net_device *dev);
554#define HAVE_SET_MAC_ADDR
555 int (*ndo_set_mac_address)(struct net_device *dev,
556 void *addr);
557#define HAVE_VALIDATE_ADDR
558 int (*ndo_validate_addr)(struct net_device *dev);
559#define HAVE_PRIVATE_IOCTL
560 int (*ndo_do_ioctl)(struct net_device *dev,
561 struct ifreq *ifr, int cmd);
562#define HAVE_SET_CONFIG
563 int (*ndo_set_config)(struct net_device *dev,
564 struct ifmap *map);
565#define HAVE_CHANGE_MTU
566 int (*ndo_change_mtu)(struct net_device *dev,
567 int new_mtu);
568 int (*ndo_neigh_setup)(struct net_device *dev,
569 struct neigh_parms *);
570#define HAVE_TX_TIMEOUT
571 void (*ndo_tx_timeout) (struct net_device *dev);
572
573 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
574
575 void (*ndo_vlan_rx_register)(struct net_device *dev,
576 struct vlan_group *grp);
577 void (*ndo_vlan_rx_add_vid)(struct net_device *dev,
578 unsigned short vid);
579 void (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
580 unsigned short vid);
581#ifdef CONFIG_NET_POLL_CONTROLLER
582#define HAVE_NETDEV_POLL
583 void (*ndo_poll_controller)(struct net_device *dev);
584#endif
585};
586
455/* 587/*
456 * The DEVICE structure. 588 * The DEVICE structure.
457 * Actually, this whole structure is a big mistake. It mixes I/O 589 * Actually, this whole structure is a big mistake. It mixes I/O
@@ -496,14 +628,7 @@ struct net_device
496 unsigned long state; 628 unsigned long state;
497 629
498 struct list_head dev_list; 630 struct list_head dev_list;
499#ifdef CONFIG_NETPOLL
500 struct list_head napi_list; 631 struct list_head napi_list;
501#endif
502
503 /* The device initialization function. Called only once. */
504 int (*init)(struct net_device *dev);
505
506 /* ------- Fields preinitialized in Space.c finish here ------- */
507 632
508 /* Net device features */ 633 /* Net device features */
509 unsigned long features; 634 unsigned long features;
@@ -522,6 +647,7 @@ struct net_device
522#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */ 647#define NETIF_F_LLTX 4096 /* LockLess TX - deprecated. Please */
523 /* do not use LLTX in new drivers */ 648 /* do not use LLTX in new drivers */
524#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */ 649#define NETIF_F_NETNS_LOCAL 8192 /* Does not change network namespaces */
650#define NETIF_F_GRO 16384 /* Generic receive offload */
525#define NETIF_F_LRO 32768 /* large receive offload */ 651#define NETIF_F_LRO 32768 /* large receive offload */
526 652
527 /* Segmentation offload features */ 653 /* Segmentation offload features */
@@ -547,15 +673,13 @@ struct net_device
547 * for all in netdev_increment_features. 673 * for all in netdev_increment_features.
548 */ 674 */
549#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \ 675#define NETIF_F_ONE_FOR_ALL (NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ROBUST | \
550 NETIF_F_SG | NETIF_F_HIGHDMA | \ 676 NETIF_F_SG | NETIF_F_HIGHDMA | \
551 NETIF_F_FRAGLIST) 677 NETIF_F_FRAGLIST)
552 678
553 /* Interface index. Unique device identifier */ 679 /* Interface index. Unique device identifier */
554 int ifindex; 680 int ifindex;
555 int iflink; 681 int iflink;
556 682
557
558 struct net_device_stats* (*get_stats)(struct net_device *dev);
559 struct net_device_stats stats; 683 struct net_device_stats stats;
560 684
561#ifdef CONFIG_WIRELESS_EXT 685#ifdef CONFIG_WIRELESS_EXT
@@ -565,18 +689,13 @@ struct net_device
565 /* Instance data managed by the core of Wireless Extensions. */ 689 /* Instance data managed by the core of Wireless Extensions. */
566 struct iw_public_data * wireless_data; 690 struct iw_public_data * wireless_data;
567#endif 691#endif
692 /* Management operations */
693 const struct net_device_ops *netdev_ops;
568 const struct ethtool_ops *ethtool_ops; 694 const struct ethtool_ops *ethtool_ops;
569 695
570 /* Hardware header description */ 696 /* Hardware header description */
571 const struct header_ops *header_ops; 697 const struct header_ops *header_ops;
572 698
573 /*
574 * This marks the end of the "visible" part of the structure. All
575 * fields hereafter are internal to the system, and may change at
576 * will (read: may be cleaned up at will).
577 */
578
579
580 unsigned int flags; /* interface flags (a la BSD) */ 699 unsigned int flags; /* interface flags (a la BSD) */
581 unsigned short gflags; 700 unsigned short gflags;
582 unsigned short priv_flags; /* Like 'flags' but invisible to userspace. */ 701 unsigned short priv_flags; /* Like 'flags' but invisible to userspace. */
@@ -635,7 +754,7 @@ struct net_device
635 unsigned long last_rx; /* Time of last Rx */ 754 unsigned long last_rx; /* Time of last Rx */
636 /* Interface address info used in eth_type_trans() */ 755 /* Interface address info used in eth_type_trans() */
637 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast 756 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast
638 because most packets are unicast) */ 757 because most packets are unicast) */
639 758
640 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */ 759 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
641 760
@@ -654,18 +773,12 @@ struct net_device
654/* 773/*
655 * One part is mostly used on xmit path (device) 774 * One part is mostly used on xmit path (device)
656 */ 775 */
657 void *priv; /* pointer to private data */
658 int (*hard_start_xmit) (struct sk_buff *skb,
659 struct net_device *dev);
660 /* These may be needed for future network-power-down code. */ 776 /* These may be needed for future network-power-down code. */
661 unsigned long trans_start; /* Time (in jiffies) of last Tx */ 777 unsigned long trans_start; /* Time (in jiffies) of last Tx */
662 778
663 int watchdog_timeo; /* used by dev_watchdog() */ 779 int watchdog_timeo; /* used by dev_watchdog() */
664 struct timer_list watchdog_timer; 780 struct timer_list watchdog_timer;
665 781
666/*
667 * refcnt is a very hot point, so align it on SMP
668 */
669 /* Number of references to this device */ 782 /* Number of references to this device */
670 atomic_t refcnt ____cacheline_aligned_in_smp; 783 atomic_t refcnt ____cacheline_aligned_in_smp;
671 784
@@ -684,56 +797,12 @@ struct net_device
684 NETREG_RELEASED, /* called free_netdev */ 797 NETREG_RELEASED, /* called free_netdev */
685 } reg_state; 798 } reg_state;
686 799
687 /* Called after device is detached from network. */ 800 /* Called from unregister, can be used to call free_netdev */
688 void (*uninit)(struct net_device *dev); 801 void (*destructor)(struct net_device *dev);
689 /* Called after last user reference disappears. */
690 void (*destructor)(struct net_device *dev);
691 802
692 /* Pointers to interface service routines. */
693 int (*open)(struct net_device *dev);
694 int (*stop)(struct net_device *dev);
695#define HAVE_NETDEV_POLL
696#define HAVE_CHANGE_RX_FLAGS
697 void (*change_rx_flags)(struct net_device *dev,
698 int flags);
699#define HAVE_SET_RX_MODE
700 void (*set_rx_mode)(struct net_device *dev);
701#define HAVE_MULTICAST
702 void (*set_multicast_list)(struct net_device *dev);
703#define HAVE_SET_MAC_ADDR
704 int (*set_mac_address)(struct net_device *dev,
705 void *addr);
706#define HAVE_VALIDATE_ADDR
707 int (*validate_addr)(struct net_device *dev);
708#define HAVE_PRIVATE_IOCTL
709 int (*do_ioctl)(struct net_device *dev,
710 struct ifreq *ifr, int cmd);
711#define HAVE_SET_CONFIG
712 int (*set_config)(struct net_device *dev,
713 struct ifmap *map);
714#define HAVE_CHANGE_MTU
715 int (*change_mtu)(struct net_device *dev, int new_mtu);
716
717#define HAVE_TX_TIMEOUT
718 void (*tx_timeout) (struct net_device *dev);
719
720 void (*vlan_rx_register)(struct net_device *dev,
721 struct vlan_group *grp);
722 void (*vlan_rx_add_vid)(struct net_device *dev,
723 unsigned short vid);
724 void (*vlan_rx_kill_vid)(struct net_device *dev,
725 unsigned short vid);
726
727 int (*neigh_setup)(struct net_device *dev, struct neigh_parms *);
728#ifdef CONFIG_NETPOLL 803#ifdef CONFIG_NETPOLL
729 struct netpoll_info *npinfo; 804 struct netpoll_info *npinfo;
730#endif 805#endif
731#ifdef CONFIG_NET_POLL_CONTROLLER
732 void (*poll_controller)(struct net_device *dev);
733#endif
734
735 u16 (*select_queue)(struct net_device *dev,
736 struct sk_buff *skb);
737 806
738#ifdef CONFIG_NET_NS 807#ifdef CONFIG_NET_NS
739 /* Network namespace this network device is inside */ 808 /* Network namespace this network device is inside */
@@ -764,6 +833,49 @@ struct net_device
764 /* for setting kernel sock attribute on TCP connection setup */ 833 /* for setting kernel sock attribute on TCP connection setup */
765#define GSO_MAX_SIZE 65536 834#define GSO_MAX_SIZE 65536
766 unsigned int gso_max_size; 835 unsigned int gso_max_size;
836
837#ifdef CONFIG_DCB
838 /* Data Center Bridging netlink ops */
839 struct dcbnl_rtnl_ops *dcbnl_ops;
840#endif
841
842#ifdef CONFIG_COMPAT_NET_DEV_OPS
843 struct {
844 int (*init)(struct net_device *dev);
845 void (*uninit)(struct net_device *dev);
846 int (*open)(struct net_device *dev);
847 int (*stop)(struct net_device *dev);
848 int (*hard_start_xmit) (struct sk_buff *skb,
849 struct net_device *dev);
850 u16 (*select_queue)(struct net_device *dev,
851 struct sk_buff *skb);
852 void (*change_rx_flags)(struct net_device *dev,
853 int flags);
854 void (*set_rx_mode)(struct net_device *dev);
855 void (*set_multicast_list)(struct net_device *dev);
856 int (*set_mac_address)(struct net_device *dev,
857 void *addr);
858 int (*validate_addr)(struct net_device *dev);
859 int (*do_ioctl)(struct net_device *dev,
860 struct ifreq *ifr, int cmd);
861 int (*set_config)(struct net_device *dev,
862 struct ifmap *map);
863 int (*change_mtu)(struct net_device *dev, int new_mtu);
864 int (*neigh_setup)(struct net_device *dev,
865 struct neigh_parms *);
866 void (*tx_timeout) (struct net_device *dev);
867 struct net_device_stats* (*get_stats)(struct net_device *dev);
868 void (*vlan_rx_register)(struct net_device *dev,
869 struct vlan_group *grp);
870 void (*vlan_rx_add_vid)(struct net_device *dev,
871 unsigned short vid);
872 void (*vlan_rx_kill_vid)(struct net_device *dev,
873 unsigned short vid);
874#ifdef CONFIG_NET_POLL_CONTROLLER
875 void (*poll_controller)(struct net_device *dev);
876#endif
877 };
878#endif
767}; 879};
768#define to_net_dev(d) container_of(d, struct net_device, dev) 880#define to_net_dev(d) container_of(d, struct net_device, dev)
769 881
@@ -859,22 +971,8 @@ static inline void *netdev_priv(const struct net_device *dev)
859 * netif_napi_add() must be used to initialize a napi context prior to calling 971 * netif_napi_add() must be used to initialize a napi context prior to calling
860 * *any* of the other napi related functions. 972 * *any* of the other napi related functions.
861 */ 973 */
862static inline void netif_napi_add(struct net_device *dev, 974void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
863 struct napi_struct *napi, 975 int (*poll)(struct napi_struct *, int), int weight);
864 int (*poll)(struct napi_struct *, int),
865 int weight)
866{
867 INIT_LIST_HEAD(&napi->poll_list);
868 napi->poll = poll;
869 napi->weight = weight;
870#ifdef CONFIG_NETPOLL
871 napi->dev = dev;
872 list_add(&napi->dev_list, &dev->napi_list);
873 spin_lock_init(&napi->poll_lock);
874 napi->poll_owner = -1;
875#endif
876 set_bit(NAPI_STATE_SCHED, &napi->state);
877}
878 976
879/** 977/**
880 * netif_napi_del - remove a napi context 978 * netif_napi_del - remove a napi context
@@ -882,12 +980,23 @@ static inline void netif_napi_add(struct net_device *dev,
882 * 980 *
883 * netif_napi_del() removes a napi context from the network device napi list 981 * netif_napi_del() removes a napi context from the network device napi list
884 */ 982 */
885static inline void netif_napi_del(struct napi_struct *napi) 983void netif_napi_del(struct napi_struct *napi);
886{ 984
887#ifdef CONFIG_NETPOLL 985struct napi_gro_cb {
888 list_del(&napi->dev_list); 986 /* This is non-zero if the packet may be of the same flow. */
889#endif 987 int same_flow;
890} 988
989 /* This is non-zero if the packet cannot be merged with the new skb. */
990 int flush;
991
992 /* Number of segments aggregated. */
993 int count;
994
995 /* Free the skb? */
996 int free;
997};
998
999#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
891 1000
892struct packet_type { 1001struct packet_type {
893 __be16 type; /* This is really htons(ether_type). */ 1002 __be16 type; /* This is really htons(ether_type). */
@@ -899,10 +1008,21 @@ struct packet_type {
899 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 1008 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
900 int features); 1009 int features);
901 int (*gso_send_check)(struct sk_buff *skb); 1010 int (*gso_send_check)(struct sk_buff *skb);
1011 struct sk_buff **(*gro_receive)(struct sk_buff **head,
1012 struct sk_buff *skb);
1013 int (*gro_complete)(struct sk_buff *skb);
902 void *af_packet_priv; 1014 void *af_packet_priv;
903 struct list_head list; 1015 struct list_head list;
904}; 1016};
905 1017
1018struct napi_gro_fraginfo {
1019 skb_frag_t frags[MAX_SKB_FRAGS];
1020 unsigned int nr_frags;
1021 unsigned int ip_summed;
1022 unsigned int len;
1023 __wsum csum;
1024};
1025
906#include <linux/interrupt.h> 1026#include <linux/interrupt.h>
907#include <linux/notifier.h> 1027#include <linux/notifier.h>
908 1028
@@ -1005,9 +1125,6 @@ struct softnet_data
1005 struct sk_buff *completion_queue; 1125 struct sk_buff *completion_queue;
1006 1126
1007 struct napi_struct backlog; 1127 struct napi_struct backlog;
1008#ifdef CONFIG_NET_DMA
1009 struct dma_chan *net_dma;
1010#endif
1011}; 1128};
1012 1129
1013DECLARE_PER_CPU(struct softnet_data,softnet_data); 1130DECLARE_PER_CPU(struct softnet_data,softnet_data);
@@ -1252,6 +1369,17 @@ extern int netif_rx(struct sk_buff *skb);
1252extern int netif_rx_ni(struct sk_buff *skb); 1369extern int netif_rx_ni(struct sk_buff *skb);
1253#define HAVE_NETIF_RECEIVE_SKB 1 1370#define HAVE_NETIF_RECEIVE_SKB 1
1254extern int netif_receive_skb(struct sk_buff *skb); 1371extern int netif_receive_skb(struct sk_buff *skb);
1372extern void napi_gro_flush(struct napi_struct *napi);
1373extern int dev_gro_receive(struct napi_struct *napi,
1374 struct sk_buff *skb);
1375extern int napi_gro_receive(struct napi_struct *napi,
1376 struct sk_buff *skb);
1377extern void napi_reuse_skb(struct napi_struct *napi,
1378 struct sk_buff *skb);
1379extern struct sk_buff * napi_fraginfo_skb(struct napi_struct *napi,
1380 struct napi_gro_fraginfo *info);
1381extern int napi_gro_frags(struct napi_struct *napi,
1382 struct napi_gro_fraginfo *info);
1255extern void netif_nit_deliver(struct sk_buff *skb); 1383extern void netif_nit_deliver(struct sk_buff *skb);
1256extern int dev_valid_name(const char *name); 1384extern int dev_valid_name(const char *name);
1257extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 1385extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
@@ -1444,8 +1572,7 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
1444} 1572}
1445 1573
1446/* Test if receive needs to be scheduled but only if up */ 1574/* Test if receive needs to be scheduled but only if up */
1447static inline int netif_rx_schedule_prep(struct net_device *dev, 1575static inline int netif_rx_schedule_prep(struct napi_struct *napi)
1448 struct napi_struct *napi)
1449{ 1576{
1450 return napi_schedule_prep(napi); 1577 return napi_schedule_prep(napi);
1451} 1578}
@@ -1453,27 +1580,24 @@ static inline int netif_rx_schedule_prep(struct net_device *dev,
1453/* Add interface to tail of rx poll list. This assumes that _prep has 1580/* Add interface to tail of rx poll list. This assumes that _prep has
1454 * already been called and returned 1. 1581 * already been called and returned 1.
1455 */ 1582 */
1456static inline void __netif_rx_schedule(struct net_device *dev, 1583static inline void __netif_rx_schedule(struct napi_struct *napi)
1457 struct napi_struct *napi)
1458{ 1584{
1459 __napi_schedule(napi); 1585 __napi_schedule(napi);
1460} 1586}
1461 1587
1462/* Try to reschedule poll. Called by irq handler. */ 1588/* Try to reschedule poll. Called by irq handler. */
1463 1589
1464static inline void netif_rx_schedule(struct net_device *dev, 1590static inline void netif_rx_schedule(struct napi_struct *napi)
1465 struct napi_struct *napi)
1466{ 1591{
1467 if (netif_rx_schedule_prep(dev, napi)) 1592 if (netif_rx_schedule_prep(napi))
1468 __netif_rx_schedule(dev, napi); 1593 __netif_rx_schedule(napi);
1469} 1594}
1470 1595
1471/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */ 1596/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete(). */
1472static inline int netif_rx_reschedule(struct net_device *dev, 1597static inline int netif_rx_reschedule(struct napi_struct *napi)
1473 struct napi_struct *napi)
1474{ 1598{
1475 if (napi_schedule_prep(napi)) { 1599 if (napi_schedule_prep(napi)) {
1476 __netif_rx_schedule(dev, napi); 1600 __netif_rx_schedule(napi);
1477 return 1; 1601 return 1;
1478 } 1602 }
1479 return 0; 1603 return 0;
@@ -1482,8 +1606,7 @@ static inline int netif_rx_reschedule(struct net_device *dev,
1482/* same as netif_rx_complete, except that local_irq_save(flags) 1606/* same as netif_rx_complete, except that local_irq_save(flags)
1483 * has already been issued 1607 * has already been issued
1484 */ 1608 */
1485static inline void __netif_rx_complete(struct net_device *dev, 1609static inline void __netif_rx_complete(struct napi_struct *napi)
1486 struct napi_struct *napi)
1487{ 1610{
1488 __napi_complete(napi); 1611 __napi_complete(napi);
1489} 1612}
@@ -1493,20 +1616,9 @@ static inline void __netif_rx_complete(struct net_device *dev,
1493 * it completes the work. The device cannot be out of poll list at this 1616 * it completes the work. The device cannot be out of poll list at this
1494 * moment, it is BUG(). 1617 * moment, it is BUG().
1495 */ 1618 */
1496static inline void netif_rx_complete(struct net_device *dev, 1619static inline void netif_rx_complete(struct napi_struct *napi)
1497 struct napi_struct *napi)
1498{ 1620{
1499 unsigned long flags; 1621 napi_complete(napi);
1500
1501 /*
1502 * don't let napi dequeue from the cpu poll list
1503 * just in case its running on a different cpu
1504 */
1505 if (unlikely(test_bit(NAPI_STATE_NPSVC, &napi->state)))
1506 return;
1507 local_irq_save(flags);
1508 __netif_rx_complete(dev, napi);
1509 local_irq_restore(flags);
1510} 1622}
1511 1623
1512static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu) 1624static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
@@ -1683,6 +1795,8 @@ extern void netdev_features_change(struct net_device *dev);
1683/* Load a device via the kmod */ 1795/* Load a device via the kmod */
1684extern void dev_load(struct net *net, const char *name); 1796extern void dev_load(struct net *net, const char *name);
1685extern void dev_mcast_init(void); 1797extern void dev_mcast_init(void);
1798extern const struct net_device_stats *dev_get_stats(struct net_device *dev);
1799
1686extern int netdev_max_backlog; 1800extern int netdev_max_backlog;
1687extern int weight_p; 1801extern int weight_p;
1688extern int netdev_set_master(struct net_device *dev, struct net_device *master); 1802extern int netdev_set_master(struct net_device *dev, struct net_device *master);
@@ -1731,6 +1845,8 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
1731{ 1845{
1732 return skb_is_gso(skb) && 1846 return skb_is_gso(skb) &&
1733 (!skb_gso_ok(skb, dev->features) || 1847 (!skb_gso_ok(skb, dev->features) ||
1848 (skb_shinfo(skb)->frag_list &&
1849 !(dev->features & NETIF_F_FRAGLIST)) ||
1734 unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); 1850 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
1735} 1851}
1736 1852
@@ -1749,26 +1865,31 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
1749 struct net_device *dev = skb->dev; 1865 struct net_device *dev = skb->dev;
1750 struct net_device *master = dev->master; 1866 struct net_device *master = dev->master;
1751 1867
1752 if (master && 1868 if (master) {
1753 (dev->priv_flags & IFF_SLAVE_INACTIVE)) { 1869 if (master->priv_flags & IFF_MASTER_ARPMON)
1754 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && 1870 dev->last_rx = jiffies;
1755 skb->protocol == __constant_htons(ETH_P_ARP))
1756 return 0;
1757 1871
1758 if (master->priv_flags & IFF_MASTER_ALB) { 1872 if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
1759 if (skb->pkt_type != PACKET_BROADCAST && 1873 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
1760 skb->pkt_type != PACKET_MULTICAST) 1874 skb->protocol == __constant_htons(ETH_P_ARP))
1761 return 0; 1875 return 0;
1762 }
1763 if (master->priv_flags & IFF_MASTER_8023AD &&
1764 skb->protocol == __constant_htons(ETH_P_SLOW))
1765 return 0;
1766 1876
1767 return 1; 1877 if (master->priv_flags & IFF_MASTER_ALB) {
1878 if (skb->pkt_type != PACKET_BROADCAST &&
1879 skb->pkt_type != PACKET_MULTICAST)
1880 return 0;
1881 }
1882 if (master->priv_flags & IFF_MASTER_8023AD &&
1883 skb->protocol == __constant_htons(ETH_P_SLOW))
1884 return 0;
1885
1886 return 1;
1887 }
1768 } 1888 }
1769 return 0; 1889 return 0;
1770} 1890}
1771 1891
1892extern struct pernet_operations __net_initdata loopback_net_ops;
1772#endif /* __KERNEL__ */ 1893#endif /* __KERNEL__ */
1773 1894
1774#endif /* _LINUX_DEV_H */ 1895#endif /* _LINUX_DEV_H */
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index c19595c89304..29fe9ea1d346 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -141,6 +141,7 @@ enum ctattr_protonat {
141#define CTA_PROTONAT_MAX (__CTA_PROTONAT_MAX - 1) 141#define CTA_PROTONAT_MAX (__CTA_PROTONAT_MAX - 1)
142 142
143enum ctattr_natseq { 143enum ctattr_natseq {
144 CTA_NAT_SEQ_UNSPEC,
144 CTA_NAT_SEQ_CORRECTION_POS, 145 CTA_NAT_SEQ_CORRECTION_POS,
145 CTA_NAT_SEQ_OFFSET_BEFORE, 146 CTA_NAT_SEQ_OFFSET_BEFORE,
146 CTA_NAT_SEQ_OFFSET_AFTER, 147 CTA_NAT_SEQ_OFFSET_AFTER,
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index d45e29cd1cfb..e40ddb94b1af 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -300,7 +300,8 @@ struct ebt_table
300 300
301#define EBT_ALIGN(s) (((s) + (__alignof__(struct ebt_replace)-1)) & \ 301#define EBT_ALIGN(s) (((s) + (__alignof__(struct ebt_replace)-1)) & \
302 ~(__alignof__(struct ebt_replace)-1)) 302 ~(__alignof__(struct ebt_replace)-1))
303extern int ebt_register_table(struct ebt_table *table); 303extern struct ebt_table *ebt_register_table(struct net *net,
304 struct ebt_table *table);
304extern void ebt_unregister_table(struct ebt_table *table); 305extern void ebt_unregister_table(struct ebt_table *table);
305extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, 306extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb,
306 const struct net_device *in, const struct net_device *out, 307 const struct net_device *in, const struct net_device *out,
diff --git a/include/linux/netfilter_ipv4/ipt_policy.h b/include/linux/netfilter_ipv4/ipt_policy.h
index b9478a255301..1037fb2cd206 100644
--- a/include/linux/netfilter_ipv4/ipt_policy.h
+++ b/include/linux/netfilter_ipv4/ipt_policy.h
@@ -1,6 +1,8 @@
1#ifndef _IPT_POLICY_H 1#ifndef _IPT_POLICY_H
2#define _IPT_POLICY_H 2#define _IPT_POLICY_H
3 3
4#include <linux/netfilter/xt_policy.h>
5
4#define IPT_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM 6#define IPT_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM
5 7
6/* ipt_policy_flags */ 8/* ipt_policy_flags */
diff --git a/include/linux/netfilter_ipv6/ip6t_policy.h b/include/linux/netfilter_ipv6/ip6t_policy.h
index 6bab3163d2fb..b1c449d7ec89 100644
--- a/include/linux/netfilter_ipv6/ip6t_policy.h
+++ b/include/linux/netfilter_ipv6/ip6t_policy.h
@@ -1,6 +1,8 @@
1#ifndef _IP6T_POLICY_H 1#ifndef _IP6T_POLICY_H
2#define _IP6T_POLICY_H 2#define _IP6T_POLICY_H
3 3
4#include <linux/netfilter/xt_policy.h>
5
4#define IP6T_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM 6#define IP6T_POLICY_MAX_ELEM XT_POLICY_MAX_ELEM
5 7
6/* ip6t_policy_flags */ 8/* ip6t_policy_flags */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 9ff1b54908f3..51b09a1f46c3 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -242,7 +242,8 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
242 nlh->nlmsg_flags = flags; 242 nlh->nlmsg_flags = flags;
243 nlh->nlmsg_pid = pid; 243 nlh->nlmsg_pid = pid;
244 nlh->nlmsg_seq = seq; 244 nlh->nlmsg_seq = seq;
245 memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size); 245 if (!__builtin_constant_p(size) || NLMSG_ALIGN(size) - size != 0)
246 memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size);
246 return nlh; 247 return nlh;
247} 248}
248 249
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index e3d79593fb3a..e38d3c9dccda 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -94,11 +94,6 @@ static inline void netpoll_poll_unlock(void *have)
94 rcu_read_unlock(); 94 rcu_read_unlock();
95} 95}
96 96
97static inline void netpoll_netdev_init(struct net_device *dev)
98{
99 INIT_LIST_HEAD(&dev->napi_list);
100}
101
102#else 97#else
103static inline int netpoll_rx(struct sk_buff *skb) 98static inline int netpoll_rx(struct sk_buff *skb)
104{ 99{
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index ea0366769484..b912311a56b1 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -88,6 +88,8 @@
88#define NFS4_ACE_GENERIC_EXECUTE 0x001200A0 88#define NFS4_ACE_GENERIC_EXECUTE 0x001200A0
89#define NFS4_ACE_MASK_ALL 0x001F01FF 89#define NFS4_ACE_MASK_ALL 0x001F01FF
90 90
91#define NFS4_MAX_UINT64 (~(u64)0)
92
91enum nfs4_acl_whotype { 93enum nfs4_acl_whotype {
92 NFS4_ACL_WHO_NAMED = 0, 94 NFS4_ACL_WHO_NAMED = 0,
93 NFS4_ACL_WHO_OWNER, 95 NFS4_ACL_WHO_OWNER,
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 4eaa8347a0d9..db867b04ac3c 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -83,7 +83,7 @@ struct nfs_open_context {
83 struct rpc_cred *cred; 83 struct rpc_cred *cred;
84 struct nfs4_state *state; 84 struct nfs4_state *state;
85 fl_owner_t lockowner; 85 fl_owner_t lockowner;
86 int mode; 86 fmode_t mode;
87 87
88 unsigned long flags; 88 unsigned long flags;
89#define NFS_CONTEXT_ERROR_WRITE (0) 89#define NFS_CONTEXT_ERROR_WRITE (0)
@@ -130,7 +130,10 @@ struct nfs_inode {
130 * 130 *
131 * We need to revalidate the cached attrs for this inode if 131 * We need to revalidate the cached attrs for this inode if
132 * 132 *
133 * jiffies - read_cache_jiffies > attrtimeo 133 * jiffies - read_cache_jiffies >= attrtimeo
134 *
135 * Please note the comparison is greater than or equal
136 * so that zero timeout values can be specified.
134 */ 137 */
135 unsigned long read_cache_jiffies; 138 unsigned long read_cache_jiffies;
136 unsigned long attrtimeo; 139 unsigned long attrtimeo;
@@ -180,7 +183,7 @@ struct nfs_inode {
180 /* NFSv4 state */ 183 /* NFSv4 state */
181 struct list_head open_states; 184 struct list_head open_states;
182 struct nfs_delegation *delegation; 185 struct nfs_delegation *delegation;
183 int delegation_state; 186 fmode_t delegation_state;
184 struct rw_semaphore rwsem; 187 struct rw_semaphore rwsem;
185#endif /* CONFIG_NFS_V4*/ 188#endif /* CONFIG_NFS_V4*/
186 struct inode vfs_inode; 189 struct inode vfs_inode;
@@ -342,7 +345,7 @@ extern int nfs_setattr(struct dentry *, struct iattr *);
342extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); 345extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
343extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 346extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
344extern void put_nfs_open_context(struct nfs_open_context *ctx); 347extern void put_nfs_open_context(struct nfs_open_context *ctx);
345extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); 348extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode);
346extern u64 nfs_compat_user_ino64(u64 fileid); 349extern u64 nfs_compat_user_ino64(u64 fileid);
347extern void nfs_fattr_init(struct nfs_fattr *fattr); 350extern void nfs_fattr_init(struct nfs_fattr *fattr);
348 351
@@ -533,12 +536,6 @@ static inline void nfs3_forget_cached_acls(struct inode *inode)
533#endif /* CONFIG_NFS_V3_ACL */ 536#endif /* CONFIG_NFS_V3_ACL */
534 537
535/* 538/*
536 * linux/fs/mount_clnt.c
537 */
538extern int nfs_mount(struct sockaddr *, size_t, char *, char *,
539 int, int, struct nfs_fh *);
540
541/*
542 * inline functions 539 * inline functions
543 */ 540 */
544 541
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 4e477ae58699..9bb81aec91cf 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -42,12 +42,6 @@ struct nfs_client {
42 struct rb_root cl_openowner_id; 42 struct rb_root cl_openowner_id;
43 struct rb_root cl_lockowner_id; 43 struct rb_root cl_lockowner_id;
44 44
45 /*
46 * The following rwsem ensures exclusive access to the server
47 * while we recover the state following a lease expiration.
48 */
49 struct rw_semaphore cl_sem;
50
51 struct list_head cl_delegations; 45 struct list_head cl_delegations;
52 struct rb_root cl_state_owners; 46 struct rb_root cl_state_owners;
53 spinlock_t cl_lock; 47 spinlock_t cl_lock;
diff --git a/include/linux/nfs_mount.h b/include/linux/nfs_mount.h
index 6549a06ac16e..4499016e6d0d 100644
--- a/include/linux/nfs_mount.h
+++ b/include/linux/nfs_mount.h
@@ -45,7 +45,7 @@ struct nfs_mount_data {
45 char context[NFS_MAX_CONTEXT_LEN + 1]; /* 6 */ 45 char context[NFS_MAX_CONTEXT_LEN + 1]; /* 6 */
46}; 46};
47 47
48/* bits in the flags field */ 48/* bits in the flags field visible to user space */
49 49
50#define NFS_MOUNT_SOFT 0x0001 /* 1 */ 50#define NFS_MOUNT_SOFT 0x0001 /* 1 */
51#define NFS_MOUNT_INTR 0x0002 /* 1 */ /* now unused, but ABI */ 51#define NFS_MOUNT_INTR 0x0002 /* 1 */ /* now unused, but ABI */
@@ -68,5 +68,6 @@ struct nfs_mount_data {
68/* The following are for internal use only */ 68/* The following are for internal use only */
69#define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000 69#define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000
70#define NFS_MOUNT_LOOKUP_CACHE_NONE 0x20000 70#define NFS_MOUNT_LOOKUP_CACHE_NONE 0x20000
71#define NFS_MOUNT_NORESVPORT 0x40000
71 72
72#endif 73#endif
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index c1c31acb8a2b..a550b528319f 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -120,13 +120,14 @@ struct nfs_openargs {
120 const struct nfs_fh * fh; 120 const struct nfs_fh * fh;
121 struct nfs_seqid * seqid; 121 struct nfs_seqid * seqid;
122 int open_flags; 122 int open_flags;
123 fmode_t fmode;
123 __u64 clientid; 124 __u64 clientid;
124 __u64 id; 125 __u64 id;
125 union { 126 union {
126 struct iattr * attrs; /* UNCHECKED, GUARDED */ 127 struct iattr * attrs; /* UNCHECKED, GUARDED */
127 nfs4_verifier verifier; /* EXCLUSIVE */ 128 nfs4_verifier verifier; /* EXCLUSIVE */
128 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */ 129 nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
129 int delegation_type; /* CLAIM_PREVIOUS */ 130 fmode_t delegation_type; /* CLAIM_PREVIOUS */
130 } u; 131 } u;
131 const struct qstr * name; 132 const struct qstr * name;
132 const struct nfs_server *server; /* Needed for ID mapping */ 133 const struct nfs_server *server; /* Needed for ID mapping */
@@ -143,7 +144,7 @@ struct nfs_openres {
143 struct nfs_fattr * dir_attr; 144 struct nfs_fattr * dir_attr;
144 struct nfs_seqid * seqid; 145 struct nfs_seqid * seqid;
145 const struct nfs_server *server; 146 const struct nfs_server *server;
146 int delegation_type; 147 fmode_t delegation_type;
147 nfs4_stateid delegation; 148 nfs4_stateid delegation;
148 __u32 do_recall; 149 __u32 do_recall;
149 __u64 maxsize; 150 __u64 maxsize;
@@ -171,7 +172,7 @@ struct nfs_closeargs {
171 struct nfs_fh * fh; 172 struct nfs_fh * fh;
172 nfs4_stateid * stateid; 173 nfs4_stateid * stateid;
173 struct nfs_seqid * seqid; 174 struct nfs_seqid * seqid;
174 int open_flags; 175 fmode_t fmode;
175 const u32 * bitmask; 176 const u32 * bitmask;
176}; 177};
177 178
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index 21269405ffe2..e19f45991b2e 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -23,7 +23,6 @@
23/* 23/*
24 * nfsd version 24 * nfsd version
25 */ 25 */
26#define NFSD_VERSION "0.5"
27#define NFSD_SUPPORTED_MINOR_VERSION 0 26#define NFSD_SUPPORTED_MINOR_VERSION 0
28 27
29/* 28/*
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index d1941cb965e9..b2e093870bc6 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -68,6 +68,10 @@ struct nfs_fhbase_old {
68 * 1 - 4 byte user specified identifier 68 * 1 - 4 byte user specified identifier
69 * 2 - 4 byte major, 4 byte minor, 4 byte inode number - DEPRECATED 69 * 2 - 4 byte major, 4 byte minor, 4 byte inode number - DEPRECATED
70 * 3 - 4 byte device id, encoded for user-space, 4 byte inode number 70 * 3 - 4 byte device id, encoded for user-space, 4 byte inode number
71 * 4 - 4 byte inode number and 4 byte uuid
72 * 5 - 8 byte uuid
73 * 6 - 16 byte uuid
74 * 7 - 8 byte inode number and 16 byte uuid
71 * 75 *
72 * The fileid_type identified how the file within the filesystem is encoded. 76 * The fileid_type identified how the file within the filesystem is encoded.
73 * This is (will be) passed to, and set by, the underlying filesystem if it supports 77 * This is (will be) passed to, and set by, the underlying filesystem if it supports
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index d0fe2e378452..128298c0362d 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -124,6 +124,8 @@ struct nfs4_client {
124 nfs4_verifier cl_verifier; /* generated by client */ 124 nfs4_verifier cl_verifier; /* generated by client */
125 time_t cl_time; /* time of last lease renewal */ 125 time_t cl_time; /* time of last lease renewal */
126 __be32 cl_addr; /* client ipaddress */ 126 __be32 cl_addr; /* client ipaddress */
127 u32 cl_flavor; /* setclientid pseudoflavor */
128 char *cl_principal; /* setclientid principal name */
127 struct svc_cred cl_cred; /* setclientid principal */ 129 struct svc_cred cl_cred; /* setclientid principal */
128 clientid_t cl_clientid; /* generated by server */ 130 clientid_t cl_clientid; /* generated by server */
129 nfs4_verifier cl_confirm; /* generated by server */ 131 nfs4_verifier cl_confirm; /* generated by server */
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 9bad65400fba..e86ed59f9ad5 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -3,7 +3,26 @@
3/* 3/*
4 * 802.11 netlink interface public header 4 * 802.11 netlink interface public header
5 * 5 *
6 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> 6 * Copyright 2006, 2007, 2008 Johannes Berg <johannes@sipsolutions.net>
7 * Copyright 2008 Michael Wu <flamingice@sourmilk.net>
8 * Copyright 2008 Luis Carlos Cobo <luisca@cozybit.com>
9 * Copyright 2008 Michael Buesch <mb@bu3sch.de>
10 * Copyright 2008 Luis R. Rodriguez <lrodriguez@atheros.com>
11 * Copyright 2008 Jouni Malinen <jouni.malinen@atheros.com>
12 * Copyright 2008 Colin McCabe <colin@cozybit.com>
13 *
14 * Permission to use, copy, modify, and/or distribute this software for any
15 * purpose with or without fee is hereby granted, provided that the above
16 * copyright notice and this permission notice appear in all copies.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
19 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
21 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
22 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
23 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
24 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
25 *
7 */ 26 */
8 27
9/** 28/**
@@ -25,8 +44,10 @@
25 * 44 *
26 * @NL80211_CMD_GET_WIPHY: request information about a wiphy or dump request 45 * @NL80211_CMD_GET_WIPHY: request information about a wiphy or dump request
27 * to get a list of all present wiphys. 46 * to get a list of all present wiphys.
28 * @NL80211_CMD_SET_WIPHY: set wiphy name, needs %NL80211_ATTR_WIPHY and 47 * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or
29 * %NL80211_ATTR_WIPHY_NAME. 48 * %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME,
49 * %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, and/or
50 * %NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET.
30 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request 51 * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
31 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and 52 * or rename notification. Has attributes %NL80211_ATTR_WIPHY and
32 * %NL80211_ATTR_WIPHY_NAME. 53 * %NL80211_ATTR_WIPHY_NAME.
@@ -106,6 +127,12 @@
106 * to the the specified ISO/IEC 3166-1 alpha2 country code. The core will 127 * to the the specified ISO/IEC 3166-1 alpha2 country code. The core will
107 * store this as a valid request and then query userspace for it. 128 * store this as a valid request and then query userspace for it.
108 * 129 *
130 * @NL80211_CMD_GET_MESH_PARAMS: Get mesh networking properties for the
131 * interface identified by %NL80211_ATTR_IFINDEX
132 *
133 * @NL80211_CMD_SET_MESH_PARAMS: Set mesh networking properties for the
134 * interface identified by %NL80211_ATTR_IFINDEX
135 *
109 * @NL80211_CMD_MAX: highest used command number 136 * @NL80211_CMD_MAX: highest used command number
110 * @__NL80211_CMD_AFTER_LAST: internal use 137 * @__NL80211_CMD_AFTER_LAST: internal use
111 */ 138 */
@@ -148,6 +175,9 @@ enum nl80211_commands {
148 NL80211_CMD_SET_REG, 175 NL80211_CMD_SET_REG,
149 NL80211_CMD_REQ_SET_REG, 176 NL80211_CMD_REQ_SET_REG,
150 177
178 NL80211_CMD_GET_MESH_PARAMS,
179 NL80211_CMD_SET_MESH_PARAMS,
180
151 /* add new commands above here */ 181 /* add new commands above here */
152 182
153 /* used to define NL80211_CMD_MAX below */ 183 /* used to define NL80211_CMD_MAX below */
@@ -169,6 +199,15 @@ enum nl80211_commands {
169 * @NL80211_ATTR_WIPHY: index of wiphy to operate on, cf. 199 * @NL80211_ATTR_WIPHY: index of wiphy to operate on, cf.
170 * /sys/class/ieee80211/<phyname>/index 200 * /sys/class/ieee80211/<phyname>/index
171 * @NL80211_ATTR_WIPHY_NAME: wiphy name (used for renaming) 201 * @NL80211_ATTR_WIPHY_NAME: wiphy name (used for renaming)
202 * @NL80211_ATTR_WIPHY_TXQ_PARAMS: a nested array of TX queue parameters
203 * @NL80211_ATTR_WIPHY_FREQ: frequency of the selected channel in MHz
204 * @NL80211_ATTR_WIPHY_CHANNEL_TYPE: included with NL80211_ATTR_WIPHY_FREQ
205 * if HT20 or HT40 are allowed (i.e., 802.11n disabled if not included):
206 * NL80211_CHAN_NO_HT = HT not allowed (i.e., same as not including
207 * this attribute)
208 * NL80211_CHAN_HT20 = HT20 only
209 * NL80211_CHAN_HT40MINUS = secondary channel is below the primary channel
210 * NL80211_CHAN_HT40PLUS = secondary channel is above the primary channel
172 * 211 *
173 * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on 212 * @NL80211_ATTR_IFINDEX: network interface index of the device to operate on
174 * @NL80211_ATTR_IFNAME: network interface name 213 * @NL80211_ATTR_IFNAME: network interface name
@@ -234,6 +273,9 @@ enum nl80211_commands {
234 * (u8, 0 or 1) 273 * (u8, 0 or 1)
235 * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled 274 * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled
236 * (u8, 0 or 1) 275 * (u8, 0 or 1)
276 * @NL80211_ATTR_BSS_BASIC_RATES: basic rates, array of basic
277 * rates in format defined by IEEE 802.11 7.3.2.2 but without the length
278 * restriction (at most %NL80211_MAX_SUPP_RATES).
237 * 279 *
238 * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from 280 * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from
239 * association request when used with NL80211_CMD_NEW_STATION) 281 * association request when used with NL80211_CMD_NEW_STATION)
@@ -296,6 +338,14 @@ enum nl80211_attrs {
296 NL80211_ATTR_REG_ALPHA2, 338 NL80211_ATTR_REG_ALPHA2,
297 NL80211_ATTR_REG_RULES, 339 NL80211_ATTR_REG_RULES,
298 340
341 NL80211_ATTR_MESH_PARAMS,
342
343 NL80211_ATTR_BSS_BASIC_RATES,
344
345 NL80211_ATTR_WIPHY_TXQ_PARAMS,
346 NL80211_ATTR_WIPHY_FREQ,
347 NL80211_ATTR_WIPHY_CHANNEL_TYPE,
348
299 /* add attributes here, update the policy in nl80211.c */ 349 /* add attributes here, update the policy in nl80211.c */
300 350
301 __NL80211_ATTR_AFTER_LAST, 351 __NL80211_ATTR_AFTER_LAST,
@@ -307,6 +357,10 @@ enum nl80211_attrs {
307 * here 357 * here
308 */ 358 */
309#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY 359#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY
360#define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES
361#define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS
362#define NL80211_ATTR_WIPHY_FREQ NL80211_ATTR_WIPHY_FREQ
363#define NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET
310 364
311#define NL80211_MAX_SUPP_RATES 32 365#define NL80211_MAX_SUPP_RATES 32
312#define NL80211_MAX_SUPP_REG_RULES 32 366#define NL80211_MAX_SUPP_REG_RULES 32
@@ -371,6 +425,32 @@ enum nl80211_sta_flags {
371}; 425};
372 426
373/** 427/**
428 * enum nl80211_rate_info - bitrate information
429 *
430 * These attribute types are used with %NL80211_STA_INFO_TXRATE
431 * when getting information about the bitrate of a station.
432 *
433 * @__NL80211_RATE_INFO_INVALID: attribute number 0 is reserved
434 * @NL80211_RATE_INFO_BITRATE: total bitrate (u16, 100kbit/s)
435 * @NL80211_RATE_INFO_MCS: mcs index for 802.11n (u8)
436 * @NL80211_RATE_INFO_40_MHZ_WIDTH: 40 Mhz dualchannel bitrate
437 * @NL80211_RATE_INFO_SHORT_GI: 400ns guard interval
438 * @NL80211_RATE_INFO_MAX: highest rate_info number currently defined
439 * @__NL80211_RATE_INFO_AFTER_LAST: internal use
440 */
441enum nl80211_rate_info {
442 __NL80211_RATE_INFO_INVALID,
443 NL80211_RATE_INFO_BITRATE,
444 NL80211_RATE_INFO_MCS,
445 NL80211_RATE_INFO_40_MHZ_WIDTH,
446 NL80211_RATE_INFO_SHORT_GI,
447
448 /* keep last */
449 __NL80211_RATE_INFO_AFTER_LAST,
450 NL80211_RATE_INFO_MAX = __NL80211_RATE_INFO_AFTER_LAST - 1
451};
452
453/**
374 * enum nl80211_sta_info - station information 454 * enum nl80211_sta_info - station information
375 * 455 *
376 * These attribute types are used with %NL80211_ATTR_STA_INFO 456 * These attribute types are used with %NL80211_ATTR_STA_INFO
@@ -382,6 +462,9 @@ enum nl80211_sta_flags {
382 * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station) 462 * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station)
383 * @__NL80211_STA_INFO_AFTER_LAST: internal 463 * @__NL80211_STA_INFO_AFTER_LAST: internal
384 * @NL80211_STA_INFO_MAX: highest possible station info attribute 464 * @NL80211_STA_INFO_MAX: highest possible station info attribute
465 * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm)
466 * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute
467 * containing info as possible, see &enum nl80211_sta_info_txrate.
385 */ 468 */
386enum nl80211_sta_info { 469enum nl80211_sta_info {
387 __NL80211_STA_INFO_INVALID, 470 __NL80211_STA_INFO_INVALID,
@@ -391,6 +474,8 @@ enum nl80211_sta_info {
391 NL80211_STA_INFO_LLID, 474 NL80211_STA_INFO_LLID,
392 NL80211_STA_INFO_PLID, 475 NL80211_STA_INFO_PLID,
393 NL80211_STA_INFO_PLINK_STATE, 476 NL80211_STA_INFO_PLINK_STATE,
477 NL80211_STA_INFO_SIGNAL,
478 NL80211_STA_INFO_TX_BITRATE,
394 479
395 /* keep last */ 480 /* keep last */
396 __NL80211_STA_INFO_AFTER_LAST, 481 __NL80211_STA_INFO_AFTER_LAST,
@@ -452,17 +537,29 @@ enum nl80211_mpath_info {
452 * an array of nested frequency attributes 537 * an array of nested frequency attributes
453 * @NL80211_BAND_ATTR_RATES: supported bitrates in this band, 538 * @NL80211_BAND_ATTR_RATES: supported bitrates in this band,
454 * an array of nested bitrate attributes 539 * an array of nested bitrate attributes
540 * @NL80211_BAND_ATTR_HT_MCS_SET: 16-byte attribute containing the MCS set as
541 * defined in 802.11n
542 * @NL80211_BAND_ATTR_HT_CAPA: HT capabilities, as in the HT information IE
543 * @NL80211_BAND_ATTR_HT_AMPDU_FACTOR: A-MPDU factor, as in 11n
544 * @NL80211_BAND_ATTR_HT_AMPDU_DENSITY: A-MPDU density, as in 11n
455 */ 545 */
456enum nl80211_band_attr { 546enum nl80211_band_attr {
457 __NL80211_BAND_ATTR_INVALID, 547 __NL80211_BAND_ATTR_INVALID,
458 NL80211_BAND_ATTR_FREQS, 548 NL80211_BAND_ATTR_FREQS,
459 NL80211_BAND_ATTR_RATES, 549 NL80211_BAND_ATTR_RATES,
460 550
551 NL80211_BAND_ATTR_HT_MCS_SET,
552 NL80211_BAND_ATTR_HT_CAPA,
553 NL80211_BAND_ATTR_HT_AMPDU_FACTOR,
554 NL80211_BAND_ATTR_HT_AMPDU_DENSITY,
555
461 /* keep last */ 556 /* keep last */
462 __NL80211_BAND_ATTR_AFTER_LAST, 557 __NL80211_BAND_ATTR_AFTER_LAST,
463 NL80211_BAND_ATTR_MAX = __NL80211_BAND_ATTR_AFTER_LAST - 1 558 NL80211_BAND_ATTR_MAX = __NL80211_BAND_ATTR_AFTER_LAST - 1
464}; 559};
465 560
561#define NL80211_BAND_ATTR_HT_CAPA NL80211_BAND_ATTR_HT_CAPA
562
466/** 563/**
467 * enum nl80211_frequency_attr - frequency attributes 564 * enum nl80211_frequency_attr - frequency attributes
468 * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz 565 * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz
@@ -474,6 +571,8 @@ enum nl80211_band_attr {
474 * on this channel in current regulatory domain. 571 * on this channel in current regulatory domain.
475 * @NL80211_FREQUENCY_ATTR_RADAR: Radar detection is mandatory 572 * @NL80211_FREQUENCY_ATTR_RADAR: Radar detection is mandatory
476 * on this channel in current regulatory domain. 573 * on this channel in current regulatory domain.
574 * @NL80211_FREQUENCY_ATTR_MAX_TX_POWER: Maximum transmission power in mBm
575 * (100 * dBm).
477 */ 576 */
478enum nl80211_frequency_attr { 577enum nl80211_frequency_attr {
479 __NL80211_FREQUENCY_ATTR_INVALID, 578 __NL80211_FREQUENCY_ATTR_INVALID,
@@ -482,12 +581,15 @@ enum nl80211_frequency_attr {
482 NL80211_FREQUENCY_ATTR_PASSIVE_SCAN, 581 NL80211_FREQUENCY_ATTR_PASSIVE_SCAN,
483 NL80211_FREQUENCY_ATTR_NO_IBSS, 582 NL80211_FREQUENCY_ATTR_NO_IBSS,
484 NL80211_FREQUENCY_ATTR_RADAR, 583 NL80211_FREQUENCY_ATTR_RADAR,
584 NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
485 585
486 /* keep last */ 586 /* keep last */
487 __NL80211_FREQUENCY_ATTR_AFTER_LAST, 587 __NL80211_FREQUENCY_ATTR_AFTER_LAST,
488 NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1 588 NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1
489}; 589};
490 590
591#define NL80211_FREQUENCY_ATTR_MAX_TX_POWER NL80211_FREQUENCY_ATTR_MAX_TX_POWER
592
491/** 593/**
492 * enum nl80211_bitrate_attr - bitrate attributes 594 * enum nl80211_bitrate_attr - bitrate attributes
493 * @NL80211_BITRATE_ATTR_RATE: Bitrate in units of 100 kbps 595 * @NL80211_BITRATE_ATTR_RATE: Bitrate in units of 100 kbps
@@ -594,4 +696,119 @@ enum nl80211_mntr_flags {
594 NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1 696 NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1
595}; 697};
596 698
699/**
700 * enum nl80211_meshconf_params - mesh configuration parameters
701 *
702 * Mesh configuration parameters
703 *
704 * @__NL80211_MESHCONF_INVALID: internal use
705 *
706 * @NL80211_MESHCONF_RETRY_TIMEOUT: specifies the initial retry timeout in
707 * millisecond units, used by the Peer Link Open message
708 *
709 * @NL80211_MESHCONF_CONFIRM_TIMEOUT: specifies the inital confirm timeout, in
710 * millisecond units, used by the peer link management to close a peer link
711 *
712 * @NL80211_MESHCONF_HOLDING_TIMEOUT: specifies the holding timeout, in
713 * millisecond units
714 *
715 * @NL80211_MESHCONF_MAX_PEER_LINKS: maximum number of peer links allowed
716 * on this mesh interface
717 *
718 * @NL80211_MESHCONF_MAX_RETRIES: specifies the maximum number of peer link
719 * open retries that can be sent to establish a new peer link instance in a
720 * mesh
721 *
722 * @NL80211_MESHCONF_TTL: specifies the value of TTL field set at a source mesh
723 * point.
724 *
725 * @NL80211_MESHCONF_AUTO_OPEN_PLINKS: whether we should automatically
726 * open peer links when we detect compatible mesh peers.
727 *
728 * @NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES: the number of action frames
729 * containing a PREQ that an MP can send to a particular destination (path
730 * target)
731 *
732 * @NL80211_MESHCONF_PATH_REFRESH_TIME: how frequently to refresh mesh paths
733 * (in milliseconds)
734 *
735 * @NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT: minimum length of time to wait
736 * until giving up on a path discovery (in milliseconds)
737 *
738 * @NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT: The time (in TUs) for which mesh
739 * points receiving a PREQ shall consider the forwarding information from the
740 * root to be valid. (TU = time unit)
741 *
742 * @NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL: The minimum interval of time (in
743 * TUs) during which an MP can send only one action frame containing a PREQ
744 * reference element
745 *
746 * @NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME: The interval of time (in TUs)
747 * that it takes for an HWMP information element to propagate across the mesh
748 *
749 * @NL80211_MESHCONF_ATTR_MAX: highest possible mesh configuration attribute
750 *
751 * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
752 */
753enum nl80211_meshconf_params {
754 __NL80211_MESHCONF_INVALID,
755 NL80211_MESHCONF_RETRY_TIMEOUT,
756 NL80211_MESHCONF_CONFIRM_TIMEOUT,
757 NL80211_MESHCONF_HOLDING_TIMEOUT,
758 NL80211_MESHCONF_MAX_PEER_LINKS,
759 NL80211_MESHCONF_MAX_RETRIES,
760 NL80211_MESHCONF_TTL,
761 NL80211_MESHCONF_AUTO_OPEN_PLINKS,
762 NL80211_MESHCONF_HWMP_MAX_PREQ_RETRIES,
763 NL80211_MESHCONF_PATH_REFRESH_TIME,
764 NL80211_MESHCONF_MIN_DISCOVERY_TIMEOUT,
765 NL80211_MESHCONF_HWMP_ACTIVE_PATH_TIMEOUT,
766 NL80211_MESHCONF_HWMP_PREQ_MIN_INTERVAL,
767 NL80211_MESHCONF_HWMP_NET_DIAM_TRVS_TIME,
768
769 /* keep last */
770 __NL80211_MESHCONF_ATTR_AFTER_LAST,
771 NL80211_MESHCONF_ATTR_MAX = __NL80211_MESHCONF_ATTR_AFTER_LAST - 1
772};
773
774/**
775 * enum nl80211_txq_attr - TX queue parameter attributes
776 * @__NL80211_TXQ_ATTR_INVALID: Attribute number 0 is reserved
777 * @NL80211_TXQ_ATTR_QUEUE: TX queue identifier (NL80211_TXQ_Q_*)
778 * @NL80211_TXQ_ATTR_TXOP: Maximum burst time in units of 32 usecs, 0 meaning
779 * disabled
780 * @NL80211_TXQ_ATTR_CWMIN: Minimum contention window [a value of the form
781 * 2^n-1 in the range 1..32767]
782 * @NL80211_TXQ_ATTR_CWMAX: Maximum contention window [a value of the form
783 * 2^n-1 in the range 1..32767]
784 * @NL80211_TXQ_ATTR_AIFS: Arbitration interframe space [0..255]
785 * @__NL80211_TXQ_ATTR_AFTER_LAST: Internal
786 * @NL80211_TXQ_ATTR_MAX: Maximum TXQ attribute number
787 */
788enum nl80211_txq_attr {
789 __NL80211_TXQ_ATTR_INVALID,
790 NL80211_TXQ_ATTR_QUEUE,
791 NL80211_TXQ_ATTR_TXOP,
792 NL80211_TXQ_ATTR_CWMIN,
793 NL80211_TXQ_ATTR_CWMAX,
794 NL80211_TXQ_ATTR_AIFS,
795
796 /* keep last */
797 __NL80211_TXQ_ATTR_AFTER_LAST,
798 NL80211_TXQ_ATTR_MAX = __NL80211_TXQ_ATTR_AFTER_LAST - 1
799};
800
801enum nl80211_txq_q {
802 NL80211_TXQ_Q_VO,
803 NL80211_TXQ_Q_VI,
804 NL80211_TXQ_Q_BE,
805 NL80211_TXQ_Q_BK
806};
807
808enum nl80211_channel_type {
809 NL80211_CHAN_NO_HT,
810 NL80211_CHAN_HT20,
811 NL80211_CHAN_HT40MINUS,
812 NL80211_CHAN_HT40PLUS
813};
597#endif /* __LINUX_NL80211_H */ 814#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/node.h b/include/linux/node.h
index bc001bc225c3..681a697b9a86 100644
--- a/include/linux/node.h
+++ b/include/linux/node.h
@@ -26,6 +26,7 @@ struct node {
26 struct sys_device sysdev; 26 struct sys_device sysdev;
27}; 27};
28 28
29struct memory_block;
29extern struct node node_devices[]; 30extern struct node node_devices[];
30 31
31extern int register_node(struct node *, int, struct node *); 32extern int register_node(struct node *, int, struct node *);
@@ -35,6 +36,9 @@ extern int register_one_node(int nid);
35extern void unregister_one_node(int nid); 36extern void unregister_one_node(int nid);
36extern int register_cpu_under_node(unsigned int cpu, unsigned int nid); 37extern int register_cpu_under_node(unsigned int cpu, unsigned int nid);
37extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid); 38extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid);
39extern int register_mem_sect_under_node(struct memory_block *mem_blk,
40 int nid);
41extern int unregister_mem_sect_under_nodes(struct memory_block *mem_blk);
38#else 42#else
39static inline int register_one_node(int nid) 43static inline int register_one_node(int nid)
40{ 44{
@@ -52,6 +56,15 @@ static inline int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
52{ 56{
53 return 0; 57 return 0;
54} 58}
59static inline int register_mem_sect_under_node(struct memory_block *mem_blk,
60 int nid)
61{
62 return 0;
63}
64static inline int unregister_mem_sect_under_nodes(struct memory_block *mem_blk)
65{
66 return 0;
67}
55#endif 68#endif
56 69
57#define to_node(sys_device) container_of(sys_device, struct node, sysdev) 70#define to_node(sys_device) container_of(sys_device, struct node, sysdev)
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h
index c8a768e59640..afad7dec1b36 100644
--- a/include/linux/nsproxy.h
+++ b/include/linux/nsproxy.h
@@ -27,7 +27,6 @@ struct nsproxy {
27 struct ipc_namespace *ipc_ns; 27 struct ipc_namespace *ipc_ns;
28 struct mnt_namespace *mnt_ns; 28 struct mnt_namespace *mnt_ns;
29 struct pid_namespace *pid_ns; 29 struct pid_namespace *pid_ns;
30 struct user_namespace *user_ns;
31 struct net *net_ns; 30 struct net *net_ns;
32}; 31};
33extern struct nsproxy init_nsproxy; 32extern struct nsproxy init_nsproxy;
diff --git a/include/linux/nwpserial.h b/include/linux/nwpserial.h
new file mode 100644
index 000000000000..9acb21572eaf
--- /dev/null
+++ b/include/linux/nwpserial.h
@@ -0,0 +1,18 @@
1/*
2 * Serial Port driver for a NWP uart device
3 *
4 * Copyright (C) 2008 IBM Corp., Benjamin Krill <ben@codiert.org>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 */
12#ifndef _NWPSERIAL_H
13#define _NWPSERIAL_H
14
15int nwpserial_register_port(struct uart_port *port);
16void nwpserial_unregister_port(int line);
17
18#endif /* _NWPSERIAL_H */
diff --git a/include/linux/of.h b/include/linux/of.h
index e2488f5e7cb2..6a7efa242f5e 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -57,6 +57,12 @@ extern struct device_node *of_get_next_child(const struct device_node *node,
57 for (child = of_get_next_child(parent, NULL); child != NULL; \ 57 for (child = of_get_next_child(parent, NULL); child != NULL; \
58 child = of_get_next_child(parent, child)) 58 child = of_get_next_child(parent, child))
59 59
60extern struct device_node *of_find_node_with_property(
61 struct device_node *from, const char *prop_name);
62#define for_each_node_with_property(dn, prop_name) \
63 for (dn = of_find_node_with_property(NULL, prop_name); dn; \
64 dn = of_find_node_with_property(dn, prop_name))
65
60extern struct property *of_find_property(const struct device_node *np, 66extern struct property *of_find_property(const struct device_node *np,
61 const char *name, 67 const char *name,
62 int *lenp); 68 int *lenp);
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h
index 67db101d0eb8..fc2472c3c254 100644
--- a/include/linux/of_gpio.h
+++ b/include/linux/of_gpio.h
@@ -14,9 +14,22 @@
14#ifndef __LINUX_OF_GPIO_H 14#ifndef __LINUX_OF_GPIO_H
15#define __LINUX_OF_GPIO_H 15#define __LINUX_OF_GPIO_H
16 16
17#include <linux/compiler.h>
18#include <linux/kernel.h>
17#include <linux/errno.h> 19#include <linux/errno.h>
18#include <linux/gpio.h> 20#include <linux/gpio.h>
19 21
22struct device_node;
23
24/*
25 * This is Linux-specific flags. By default controllers' and Linux' mapping
26 * match, but GPIO controllers are free to translate their own flags to
27 * Linux-specific in their .xlate callback. Though, 1:1 mapping is recommended.
28 */
29enum of_gpio_flags {
30 OF_GPIO_ACTIVE_LOW = 0x1,
31};
32
20#ifdef CONFIG_OF_GPIO 33#ifdef CONFIG_OF_GPIO
21 34
22/* 35/*
@@ -26,7 +39,7 @@ struct of_gpio_chip {
26 struct gpio_chip gc; 39 struct gpio_chip gc;
27 int gpio_cells; 40 int gpio_cells;
28 int (*xlate)(struct of_gpio_chip *of_gc, struct device_node *np, 41 int (*xlate)(struct of_gpio_chip *of_gc, struct device_node *np,
29 const void *gpio_spec); 42 const void *gpio_spec, enum of_gpio_flags *flags);
30}; 43};
31 44
32static inline struct of_gpio_chip *to_of_gpio_chip(struct gpio_chip *gc) 45static inline struct of_gpio_chip *to_of_gpio_chip(struct gpio_chip *gc)
@@ -50,20 +63,43 @@ static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc)
50 return container_of(of_gc, struct of_mm_gpio_chip, of_gc); 63 return container_of(of_gc, struct of_mm_gpio_chip, of_gc);
51} 64}
52 65
53extern int of_get_gpio(struct device_node *np, int index); 66extern int of_get_gpio_flags(struct device_node *np, int index,
67 enum of_gpio_flags *flags);
68extern unsigned int of_gpio_count(struct device_node *np);
69
54extern int of_mm_gpiochip_add(struct device_node *np, 70extern int of_mm_gpiochip_add(struct device_node *np,
55 struct of_mm_gpio_chip *mm_gc); 71 struct of_mm_gpio_chip *mm_gc);
56extern int of_gpio_simple_xlate(struct of_gpio_chip *of_gc, 72extern int of_gpio_simple_xlate(struct of_gpio_chip *of_gc,
57 struct device_node *np, 73 struct device_node *np,
58 const void *gpio_spec); 74 const void *gpio_spec,
75 enum of_gpio_flags *flags);
59#else 76#else
60 77
61/* Drivers may not strictly depend on the GPIO support, so let them link. */ 78/* Drivers may not strictly depend on the GPIO support, so let them link. */
62static inline int of_get_gpio(struct device_node *np, int index) 79static inline int of_get_gpio_flags(struct device_node *np, int index,
80 enum of_gpio_flags *flags)
63{ 81{
64 return -ENOSYS; 82 return -ENOSYS;
65} 83}
66 84
85static inline unsigned int of_gpio_count(struct device_node *np)
86{
87 return 0;
88}
89
67#endif /* CONFIG_OF_GPIO */ 90#endif /* CONFIG_OF_GPIO */
68 91
92/**
93 * of_get_gpio - Get a GPIO number to use with GPIO API
94 * @np: device node to get GPIO from
95 * @index: index of the GPIO
96 *
97 * Returns GPIO number to use with Linux generic GPIO API, or one of the errno
98 * value on the error condition.
99 */
100static inline int of_get_gpio(struct device_node *np, int index)
101{
102 return of_get_gpio_flags(np, index, NULL);
103}
104
69#endif /* __LINUX_OF_GPIO_H */ 105#endif /* __LINUX_OF_GPIO_H */
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index a8efcfeea732..3d327b67d7e2 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -26,8 +26,7 @@ extern struct bus_type of_platform_bus_type;
26 26
27/* 27/*
28 * An of_platform_driver driver is attached to a basic of_device on 28 * An of_platform_driver driver is attached to a basic of_device on
29 * the "platform bus" (of_platform_bus_type) (or ISA, EBUS and SBUS 29 * the "platform bus" (of_platform_bus_type).
30 * busses on sparc).
31 */ 30 */
32struct of_platform_driver 31struct of_platform_driver
33{ 32{
diff --git a/include/linux/oprofile.h b/include/linux/oprofile.h
index 5231861f357d..1d9518bc4c58 100644
--- a/include/linux/oprofile.h
+++ b/include/linux/oprofile.h
@@ -86,8 +86,7 @@ int oprofile_arch_init(struct oprofile_operations * ops);
86void oprofile_arch_exit(void); 86void oprofile_arch_exit(void);
87 87
88/** 88/**
89 * Add a sample. This may be called from any context. Pass 89 * Add a sample. This may be called from any context.
90 * smp_processor_id() as cpu.
91 */ 90 */
92void oprofile_add_sample(struct pt_regs * const regs, unsigned long event); 91void oprofile_add_sample(struct pt_regs * const regs, unsigned long event);
93 92
@@ -165,4 +164,22 @@ void oprofile_put_buff(unsigned long *buf, unsigned int start,
165unsigned long oprofile_get_cpu_buffer_size(void); 164unsigned long oprofile_get_cpu_buffer_size(void);
166void oprofile_cpu_buffer_inc_smpl_lost(void); 165void oprofile_cpu_buffer_inc_smpl_lost(void);
167 166
167/* cpu buffer functions */
168
169struct op_sample;
170
171struct op_entry {
172 struct ring_buffer_event *event;
173 struct op_sample *sample;
174 unsigned long irq_flags;
175 unsigned long size;
176 unsigned long *data;
177};
178
179void oprofile_write_reserve(struct op_entry *entry,
180 struct pt_regs * const regs,
181 unsigned long pc, int code, int size);
182int oprofile_add_data(struct op_entry *entry, unsigned long val);
183int oprofile_write_commit(struct op_entry *entry);
184
168#endif /* OPROFILE_H */ 185#endif /* OPROFILE_H */
diff --git a/include/linux/oxu210hp.h b/include/linux/oxu210hp.h
new file mode 100644
index 000000000000..0bf96eae5389
--- /dev/null
+++ b/include/linux/oxu210hp.h
@@ -0,0 +1,7 @@
1/* platform data for the OXU210HP HCD */
2
3struct oxu210hp_platform_data {
4 unsigned int bus16:1;
5 unsigned int use_hcd_otg:1;
6 unsigned int use_hcd_sph:1;
7};
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index b12f93a3c345..219a523ecdb0 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -228,6 +228,7 @@ PAGEFLAG_FALSE(HighMem)
228PAGEFLAG(SwapCache, swapcache) 228PAGEFLAG(SwapCache, swapcache)
229#else 229#else
230PAGEFLAG_FALSE(SwapCache) 230PAGEFLAG_FALSE(SwapCache)
231 SETPAGEFLAG_NOOP(SwapCache) CLEARPAGEFLAG_NOOP(SwapCache)
231#endif 232#endif
232 233
233#ifdef CONFIG_UNEVICTABLE_LRU 234#ifdef CONFIG_UNEVICTABLE_LRU
@@ -372,31 +373,22 @@ static inline void __ClearPageTail(struct page *page)
372#define __PG_MLOCKED 0 373#define __PG_MLOCKED 0
373#endif 374#endif
374 375
375#define PAGE_FLAGS (1 << PG_lru | 1 << PG_private | 1 << PG_locked | \
376 1 << PG_buddy | 1 << PG_writeback | \
377 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \
378 __PG_UNEVICTABLE | __PG_MLOCKED)
379
380/*
381 * Flags checked in bad_page(). Pages on the free list should not have
382 * these flags set. It they are, there is a problem.
383 */
384#define PAGE_FLAGS_CLEAR_WHEN_BAD (PAGE_FLAGS | \
385 1 << PG_reclaim | 1 << PG_dirty | 1 << PG_swapbacked)
386
387/* 376/*
388 * Flags checked when a page is freed. Pages being freed should not have 377 * Flags checked when a page is freed. Pages being freed should not have
389 * these flags set. It they are, there is a problem. 378 * these flags set. It they are, there is a problem.
390 */ 379 */
391#define PAGE_FLAGS_CHECK_AT_FREE (PAGE_FLAGS | 1 << PG_reserved) 380#define PAGE_FLAGS_CHECK_AT_FREE \
381 (1 << PG_lru | 1 << PG_private | 1 << PG_locked | \
382 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \
383 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \
384 __PG_UNEVICTABLE | __PG_MLOCKED)
392 385
393/* 386/*
394 * Flags checked when a page is prepped for return by the page allocator. 387 * Flags checked when a page is prepped for return by the page allocator.
395 * Pages being prepped should not have these flags set. It they are, there 388 * Pages being prepped should not have any flags set. It they are set,
396 * is a problem. 389 * there has been a kernel bug or struct page corruption.
397 */ 390 */
398#define PAGE_FLAGS_CHECK_AT_PREP (PAGE_FLAGS | \ 391#define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1)
399 1 << PG_reserved | 1 << PG_dirty | 1 << PG_swapbacked)
400 392
401#endif /* !__GENERATING_BOUNDS_H */ 393#endif /* !__GENERATING_BOUNDS_H */
402#endif /* PAGE_FLAGS_H */ 394#endif /* PAGE_FLAGS_H */
diff --git a/include/linux/page_cgroup.h b/include/linux/page_cgroup.h
index 1e6d34bfa094..602cc1fdee90 100644
--- a/include/linux/page_cgroup.h
+++ b/include/linux/page_cgroup.h
@@ -26,10 +26,6 @@ enum {
26 PCG_LOCK, /* page cgroup is locked */ 26 PCG_LOCK, /* page cgroup is locked */
27 PCG_CACHE, /* charged as cache */ 27 PCG_CACHE, /* charged as cache */
28 PCG_USED, /* this object is in use. */ 28 PCG_USED, /* this object is in use. */
29 /* flags for LRU placement */
30 PCG_ACTIVE, /* page is active in this cgroup */
31 PCG_FILE, /* page is file system backed */
32 PCG_UNEVICTABLE, /* page is unevictableable */
33}; 29};
34 30
35#define TESTPCGFLAG(uname, lname) \ 31#define TESTPCGFLAG(uname, lname) \
@@ -50,19 +46,6 @@ TESTPCGFLAG(Cache, CACHE)
50TESTPCGFLAG(Used, USED) 46TESTPCGFLAG(Used, USED)
51CLEARPCGFLAG(Used, USED) 47CLEARPCGFLAG(Used, USED)
52 48
53/* LRU management flags (from global-lru definition) */
54TESTPCGFLAG(File, FILE)
55SETPCGFLAG(File, FILE)
56CLEARPCGFLAG(File, FILE)
57
58TESTPCGFLAG(Active, ACTIVE)
59SETPCGFLAG(Active, ACTIVE)
60CLEARPCGFLAG(Active, ACTIVE)
61
62TESTPCGFLAG(Unevictable, UNEVICTABLE)
63SETPCGFLAG(Unevictable, UNEVICTABLE)
64CLEARPCGFLAG(Unevictable, UNEVICTABLE)
65
66static inline int page_cgroup_nid(struct page_cgroup *pc) 49static inline int page_cgroup_nid(struct page_cgroup *pc)
67{ 50{
68 return page_to_nid(pc->page); 51 return page_to_nid(pc->page);
@@ -105,4 +88,39 @@ static inline void page_cgroup_init(void)
105} 88}
106 89
107#endif 90#endif
91
92#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
93#include <linux/swap.h>
94extern struct mem_cgroup *
95swap_cgroup_record(swp_entry_t ent, struct mem_cgroup *mem);
96extern struct mem_cgroup *lookup_swap_cgroup(swp_entry_t ent);
97extern int swap_cgroup_swapon(int type, unsigned long max_pages);
98extern void swap_cgroup_swapoff(int type);
99#else
100#include <linux/swap.h>
101
102static inline
103struct mem_cgroup *swap_cgroup_record(swp_entry_t ent, struct mem_cgroup *mem)
104{
105 return NULL;
106}
107
108static inline
109struct mem_cgroup *lookup_swap_cgroup(swp_entry_t ent)
110{
111 return NULL;
112}
113
114static inline int
115swap_cgroup_swapon(int type, unsigned long max_pages)
116{
117 return 0;
118}
119
120static inline void swap_cgroup_swapoff(int type)
121{
122 return;
123}
124
125#endif
108#endif 126#endif
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 709742be02f0..01ca0856caff 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -241,7 +241,8 @@ unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t start,
241unsigned find_get_pages_tag(struct address_space *mapping, pgoff_t *index, 241unsigned find_get_pages_tag(struct address_space *mapping, pgoff_t *index,
242 int tag, unsigned int nr_pages, struct page **pages); 242 int tag, unsigned int nr_pages, struct page **pages);
243 243
244struct page *__grab_cache_page(struct address_space *mapping, pgoff_t index); 244struct page *grab_cache_page_write_begin(struct address_space *mapping,
245 pgoff_t index, unsigned flags);
245 246
246/* 247/*
247 * Returns locked page at given index in given cache, creating it if needed. 248 * Returns locked page at given index in given cache, creating it if needed.
diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h
index e90a2cb02915..7b2886fa7fdc 100644
--- a/include/linux/pagevec.h
+++ b/include/linux/pagevec.h
@@ -21,7 +21,6 @@ struct pagevec {
21}; 21};
22 22
23void __pagevec_release(struct pagevec *pvec); 23void __pagevec_release(struct pagevec *pvec);
24void __pagevec_release_nonlru(struct pagevec *pvec);
25void __pagevec_free(struct pagevec *pvec); 24void __pagevec_free(struct pagevec *pvec);
26void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru); 25void ____pagevec_lru_add(struct pagevec *pvec, enum lru_list lru);
27void pagevec_strip(struct pagevec *pvec); 26void pagevec_strip(struct pagevec *pvec);
@@ -69,12 +68,6 @@ static inline void pagevec_release(struct pagevec *pvec)
69 __pagevec_release(pvec); 68 __pagevec_release(pvec);
70} 69}
71 70
72static inline void pagevec_release_nonlru(struct pagevec *pvec)
73{
74 if (pagevec_count(pvec))
75 __pagevec_release_nonlru(pvec);
76}
77
78static inline void pagevec_free(struct pagevec *pvec) 71static inline void pagevec_free(struct pagevec *pvec)
79{ 72{
80 if (pagevec_count(pvec)) 73 if (pagevec_count(pvec))
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 8837928fbf33..042c166f65d5 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -8,6 +8,8 @@
8#ifndef _PCI_ACPI_H_ 8#ifndef _PCI_ACPI_H_
9#define _PCI_ACPI_H_ 9#define _PCI_ACPI_H_
10 10
11#include <linux/acpi.h>
12
11#define OSC_QUERY_TYPE 0 13#define OSC_QUERY_TYPE 0
12#define OSC_SUPPORT_TYPE 1 14#define OSC_SUPPORT_TYPE 1
13#define OSC_CONTROL_TYPE 2 15#define OSC_CONTROL_TYPE 2
@@ -48,15 +50,7 @@
48 50
49#ifdef CONFIG_ACPI 51#ifdef CONFIG_ACPI
50extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags); 52extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags);
51extern acpi_status __pci_osc_support_set(u32 flags, const char *hid); 53int pci_acpi_osc_support(acpi_handle handle, u32 flags);
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}
60static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) 54static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
61{ 55{
62 /* Find root host bridge */ 56 /* Find root host bridge */
@@ -66,6 +60,15 @@ static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
66 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pdev->bus), 60 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pdev->bus),
67 pdev->bus->number); 61 pdev->bus->number);
68} 62}
63
64static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus)
65{
66 int seg = pci_domain_nr(pbus), busnr = pbus->number;
67 struct pci_dev *bridge = pbus->self;
68 if (bridge)
69 return DEVICE_ACPI_HANDLE(&(bridge->dev));
70 return acpi_get_pci_rootbridge_handle(seg, busnr);
71}
69#else 72#else
70#if !defined(AE_ERROR) 73#if !defined(AE_ERROR)
71typedef u32 acpi_status; 74typedef u32 acpi_status;
@@ -73,8 +76,6 @@ typedef u32 acpi_status;
73#endif 76#endif
74static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags) 77static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
75{return AE_ERROR;} 78{return AE_ERROR;}
76static inline acpi_status pci_osc_support_set(u32 flags) {return AE_ERROR;}
77static inline acpi_status pcie_osc_support_set(u32 flags) {return AE_ERROR;}
78static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev) 79static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
79{ return NULL; } 80{ return NULL; }
80#endif 81#endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index feb4657bb043..80f8b8b65fde 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -82,7 +82,30 @@ enum pci_mmap_state {
82#define PCI_DMA_FROMDEVICE 2 82#define PCI_DMA_FROMDEVICE 2
83#define PCI_DMA_NONE 3 83#define PCI_DMA_NONE 3
84 84
85#define DEVICE_COUNT_RESOURCE 12 85/*
86 * For PCI devices, the region numbers are assigned this way:
87 */
88enum {
89 /* #0-5: standard PCI resources */
90 PCI_STD_RESOURCES,
91 PCI_STD_RESOURCE_END = 5,
92
93 /* #6: expansion ROM resource */
94 PCI_ROM_RESOURCE,
95
96 /* resources assigned to buses behind the bridge */
97#define PCI_BRIDGE_RESOURCE_NUM 4
98
99 PCI_BRIDGE_RESOURCES,
100 PCI_BRIDGE_RESOURCE_END = PCI_BRIDGE_RESOURCES +
101 PCI_BRIDGE_RESOURCE_NUM - 1,
102
103 /* total resources associated with a PCI device */
104 PCI_NUM_RESOURCES,
105
106 /* preserve this for compatibility */
107 DEVICE_COUNT_RESOURCE
108};
86 109
87typedef int __bitwise pci_power_t; 110typedef int __bitwise pci_power_t;
88 111
@@ -134,6 +157,11 @@ enum pci_dev_flags {
134 PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2, 157 PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2,
135}; 158};
136 159
160enum pci_irq_reroute_variant {
161 INTEL_IRQ_REROUTE_VARIANT = 1,
162 MAX_IRQ_REROUTE_VARIANTS = 3
163};
164
137typedef unsigned short __bitwise pci_bus_flags_t; 165typedef unsigned short __bitwise pci_bus_flags_t;
138enum pci_bus_flags { 166enum pci_bus_flags {
139 PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1, 167 PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1,
@@ -218,6 +246,7 @@ struct pci_dev {
218 unsigned int no_msi:1; /* device may not use msi */ 246 unsigned int no_msi:1; /* device may not use msi */
219 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */ 247 unsigned int block_ucfg_access:1; /* userspace config space access is blocked */
220 unsigned int broken_parity_status:1; /* Device generates false positive parity */ 248 unsigned int broken_parity_status:1; /* Device generates false positive parity */
249 unsigned int irq_reroute_variant:2; /* device needs IRQ rerouting variant */
221 unsigned int msi_enabled:1; 250 unsigned int msi_enabled:1;
222 unsigned int msix_enabled:1; 251 unsigned int msix_enabled:1;
223 unsigned int ari_enabled:1; /* ARI forwarding */ 252 unsigned int ari_enabled:1; /* ARI forwarding */
@@ -268,18 +297,6 @@ static inline void pci_add_saved_cap(struct pci_dev *pci_dev,
268 hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space); 297 hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space);
269} 298}
270 299
271/*
272 * For PCI devices, the region numbers are assigned this way:
273 *
274 * 0-5 standard PCI regions
275 * 6 expansion ROM
276 * 7-10 bridges: address space assigned to buses behind the bridge
277 */
278
279#define PCI_ROM_RESOURCE 6
280#define PCI_BRIDGE_RESOURCES 7
281#define PCI_NUM_RESOURCES 11
282
283#ifndef PCI_BUS_NUM_RESOURCES 300#ifndef PCI_BUS_NUM_RESOURCES
284#define PCI_BUS_NUM_RESOURCES 16 301#define PCI_BUS_NUM_RESOURCES 16
285#endif 302#endif
@@ -319,6 +336,15 @@ struct pci_bus {
319#define pci_bus_b(n) list_entry(n, struct pci_bus, node) 336#define pci_bus_b(n) list_entry(n, struct pci_bus, node)
320#define to_pci_bus(n) container_of(n, struct pci_bus, dev) 337#define to_pci_bus(n) container_of(n, struct pci_bus, dev)
321 338
339#ifdef CONFIG_PCI_MSI
340static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev)
341{
342 return pci_dev->msi_enabled || pci_dev->msix_enabled;
343}
344#else
345static inline bool pci_dev_msi_enabled(struct pci_dev *pci_dev) { return false; }
346#endif
347
322/* 348/*
323 * Error values that may be returned by PCI functions. 349 * Error values that may be returned by PCI functions.
324 */ 350 */
@@ -415,7 +441,6 @@ struct pci_driver {
415 int (*resume_early) (struct pci_dev *dev); 441 int (*resume_early) (struct pci_dev *dev);
416 int (*resume) (struct pci_dev *dev); /* Device woken up */ 442 int (*resume) (struct pci_dev *dev); /* Device woken up */
417 void (*shutdown) (struct pci_dev *dev); 443 void (*shutdown) (struct pci_dev *dev);
418 struct pm_ext_ops *pm;
419 struct pci_error_handlers *err_handler; 444 struct pci_error_handlers *err_handler;
420 struct device_driver driver; 445 struct device_driver driver;
421 struct pci_dynids dynids; 446 struct pci_dynids dynids;
@@ -527,7 +552,9 @@ int __must_check pci_bus_add_device(struct pci_dev *dev);
527void pci_read_bridge_bases(struct pci_bus *child); 552void pci_read_bridge_bases(struct pci_bus *child);
528struct resource *pci_find_parent_resource(const struct pci_dev *dev, 553struct resource *pci_find_parent_resource(const struct pci_dev *dev,
529 struct resource *res); 554 struct resource *res);
555u8 pci_swizzle_interrupt_pin(struct pci_dev *dev, u8 pin);
530int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge); 556int pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge);
557u8 pci_common_swizzle(struct pci_dev *dev, u8 *pinp);
531extern struct pci_dev *pci_dev_get(struct pci_dev *dev); 558extern struct pci_dev *pci_dev_get(struct pci_dev *dev);
532extern void pci_dev_put(struct pci_dev *dev); 559extern void pci_dev_put(struct pci_dev *dev);
533extern void pci_remove_bus(struct pci_bus *b); 560extern void pci_remove_bus(struct pci_bus *b);
@@ -624,6 +651,7 @@ static inline int pci_is_managed(struct pci_dev *pdev)
624 651
625void pci_disable_device(struct pci_dev *dev); 652void pci_disable_device(struct pci_dev *dev);
626void pci_set_master(struct pci_dev *dev); 653void pci_set_master(struct pci_dev *dev);
654void pci_clear_master(struct pci_dev *dev);
627int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state); 655int pci_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state state);
628#define HAVE_PCI_SET_MWI 656#define HAVE_PCI_SET_MWI
629int __must_check pci_set_mwi(struct pci_dev *dev); 657int __must_check pci_set_mwi(struct pci_dev *dev);
@@ -642,7 +670,7 @@ int pcie_get_readrq(struct pci_dev *dev);
642int pcie_set_readrq(struct pci_dev *dev, int rq); 670int pcie_set_readrq(struct pci_dev *dev, int rq);
643int pci_reset_function(struct pci_dev *dev); 671int pci_reset_function(struct pci_dev *dev);
644int pci_execute_reset_function(struct pci_dev *dev); 672int pci_execute_reset_function(struct pci_dev *dev);
645void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); 673void pci_update_resource(struct pci_dev *dev, int resno);
646int __must_check pci_assign_resource(struct pci_dev *dev, int i); 674int __must_check pci_assign_resource(struct pci_dev *dev, int i);
647int pci_select_bars(struct pci_dev *dev, unsigned long flags); 675int pci_select_bars(struct pci_dev *dev, unsigned long flags);
648 676
@@ -669,6 +697,11 @@ int pci_back_from_sleep(struct pci_dev *dev);
669/* Functions for PCI Hotplug drivers to use */ 697/* Functions for PCI Hotplug drivers to use */
670int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap); 698int pci_bus_find_capability(struct pci_bus *bus, unsigned int devfn, int cap);
671 699
700/* Vital product data routines */
701ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf);
702ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void *buf);
703int pci_vpd_truncate(struct pci_dev *dev, size_t size);
704
672/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ 705/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
673void pci_bus_assign_resources(struct pci_bus *bus); 706void pci_bus_assign_resources(struct pci_bus *bus);
674void pci_bus_size_bridges(struct pci_bus *bus); 707void pci_bus_size_bridges(struct pci_bus *bus);
@@ -681,10 +714,13 @@ void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *),
681 int (*)(struct pci_dev *, u8, u8)); 714 int (*)(struct pci_dev *, u8, u8));
682#define HAVE_PCI_REQ_REGIONS 2 715#define HAVE_PCI_REQ_REGIONS 2
683int __must_check pci_request_regions(struct pci_dev *, const char *); 716int __must_check pci_request_regions(struct pci_dev *, const char *);
717int __must_check pci_request_regions_exclusive(struct pci_dev *, const char *);
684void pci_release_regions(struct pci_dev *); 718void pci_release_regions(struct pci_dev *);
685int __must_check pci_request_region(struct pci_dev *, int, const char *); 719int __must_check pci_request_region(struct pci_dev *, int, const char *);
720int __must_check pci_request_region_exclusive(struct pci_dev *, int, const char *);
686void pci_release_region(struct pci_dev *, int); 721void pci_release_region(struct pci_dev *, int);
687int pci_request_selected_regions(struct pci_dev *, int, const char *); 722int pci_request_selected_regions(struct pci_dev *, int, const char *);
723int pci_request_selected_regions_exclusive(struct pci_dev *, int, const char *);
688void pci_release_selected_regions(struct pci_dev *, int); 724void pci_release_selected_regions(struct pci_dev *, int);
689 725
690/* drivers/pci/bus.c */ 726/* drivers/pci/bus.c */
@@ -774,6 +810,10 @@ static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev)
774 810
775static inline void pci_restore_msi_state(struct pci_dev *dev) 811static inline void pci_restore_msi_state(struct pci_dev *dev)
776{ } 812{ }
813static inline int pci_msi_enabled(void)
814{
815 return 0;
816}
777#else 817#else
778extern int pci_enable_msi(struct pci_dev *dev); 818extern int pci_enable_msi(struct pci_dev *dev);
779extern void pci_msi_shutdown(struct pci_dev *dev); 819extern void pci_msi_shutdown(struct pci_dev *dev);
@@ -784,6 +824,16 @@ extern void pci_msix_shutdown(struct pci_dev *dev);
784extern void pci_disable_msix(struct pci_dev *dev); 824extern void pci_disable_msix(struct pci_dev *dev);
785extern void msi_remove_pci_irq_vectors(struct pci_dev *dev); 825extern void msi_remove_pci_irq_vectors(struct pci_dev *dev);
786extern void pci_restore_msi_state(struct pci_dev *dev); 826extern void pci_restore_msi_state(struct pci_dev *dev);
827extern int pci_msi_enabled(void);
828#endif
829
830#ifndef CONFIG_PCIEASPM
831static inline int pcie_aspm_enabled(void)
832{
833 return 0;
834}
835#else
836extern int pcie_aspm_enabled(void);
787#endif 837#endif
788 838
789#ifdef CONFIG_HT_IRQ 839#ifdef CONFIG_HT_IRQ
@@ -1135,20 +1185,9 @@ static inline void pci_mmcfg_early_init(void) { }
1135static inline void pci_mmcfg_late_init(void) { } 1185static inline void pci_mmcfg_late_init(void) { }
1136#endif 1186#endif
1137 1187
1138#ifdef CONFIG_HAS_IOMEM 1188int pci_ext_cfg_avail(struct pci_dev *dev);
1139static inline void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar) 1189
1140{ 1190void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
1141 /*
1142 * Make sure the BAR is actually a memory resource, not an IO resource
1143 */
1144 if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) {
1145 WARN_ON(1);
1146 return NULL;
1147 }
1148 return ioremap_nocache(pci_resource_start(pdev, bar),
1149 pci_resource_len(pdev, bar));
1150}
1151#endif
1152 1191
1153#endif /* __KERNEL__ */ 1192#endif /* __KERNEL__ */
1154#endif /* LINUX_PCI_H */ 1193#endif /* LINUX_PCI_H */
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index a00bd1a0f156..20998746518e 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -223,11 +223,12 @@ struct hotplug_params {
223#ifdef CONFIG_ACPI 223#ifdef CONFIG_ACPI
224#include <acpi/acpi.h> 224#include <acpi/acpi.h>
225#include <acpi/acpi_bus.h> 225#include <acpi/acpi_bus.h>
226#include <acpi/actypes.h>
227extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus, 226extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus,
228 struct hotplug_params *hpp); 227 struct hotplug_params *hpp);
229int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags); 228int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags);
230int acpi_root_bridge(acpi_handle handle); 229int acpi_root_bridge(acpi_handle handle);
230int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle);
231int acpi_pci_detect_ejectable(struct pci_bus *pbus);
231#endif 232#endif
232#endif 233#endif
233 234
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 1800f1d6e40d..d543365518ab 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1658,6 +1658,7 @@
1658#define PCI_VENDOR_ID_ROCKWELL 0x127A 1658#define PCI_VENDOR_ID_ROCKWELL 0x127A
1659 1659
1660#define PCI_VENDOR_ID_ITE 0x1283 1660#define PCI_VENDOR_ID_ITE 0x1283
1661#define PCI_DEVICE_ID_ITE_8172 0x8172
1661#define PCI_DEVICE_ID_ITE_8211 0x8211 1662#define PCI_DEVICE_ID_ITE_8211 0x8211
1662#define PCI_DEVICE_ID_ITE_8212 0x8212 1663#define PCI_DEVICE_ID_ITE_8212 0x8212
1663#define PCI_DEVICE_ID_ITE_8213 0x8213 1664#define PCI_DEVICE_ID_ITE_8213 0x8213
@@ -1766,6 +1767,7 @@
1766#define PCI_DEVICE_ID_SIIG_8S_20x_650 0x2081 1767#define PCI_DEVICE_ID_SIIG_8S_20x_650 0x2081
1767#define PCI_DEVICE_ID_SIIG_8S_20x_850 0x2082 1768#define PCI_DEVICE_ID_SIIG_8S_20x_850 0x2082
1768#define PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL 0x2050 1769#define PCI_SUBDEVICE_ID_SIIG_QUARTET_SERIAL 0x2050
1770#define PCI_SUBDEVICE_ID_SIIG_DUAL_SERIAL 0x2530
1769 1771
1770#define PCI_VENDOR_ID_RADISYS 0x1331 1772#define PCI_VENDOR_ID_RADISYS 0x1331
1771 1773
@@ -1795,6 +1797,7 @@
1795#define PCI_DEVICE_ID_SEALEVEL_UCOMM232 0x7202 1797#define PCI_DEVICE_ID_SEALEVEL_UCOMM232 0x7202
1796#define PCI_DEVICE_ID_SEALEVEL_COMM4 0x7401 1798#define PCI_DEVICE_ID_SEALEVEL_COMM4 0x7401
1797#define PCI_DEVICE_ID_SEALEVEL_COMM8 0x7801 1799#define PCI_DEVICE_ID_SEALEVEL_COMM8 0x7801
1800#define PCI_DEVICE_ID_SEALEVEL_7803 0x7803
1798#define PCI_DEVICE_ID_SEALEVEL_UCOMM8 0x7804 1801#define PCI_DEVICE_ID_SEALEVEL_UCOMM8 0x7804
1799 1802
1800#define PCI_VENDOR_ID_HYPERCOPE 0x1365 1803#define PCI_VENDOR_ID_HYPERCOPE 0x1365
@@ -2304,6 +2307,10 @@
2304#define PCI_DEVICE_ID_INTEL_PXH_0 0x0329 2307#define PCI_DEVICE_ID_INTEL_PXH_0 0x0329
2305#define PCI_DEVICE_ID_INTEL_PXH_1 0x032A 2308#define PCI_DEVICE_ID_INTEL_PXH_1 0x032A
2306#define PCI_DEVICE_ID_INTEL_PXHV 0x032C 2309#define PCI_DEVICE_ID_INTEL_PXHV 0x032C
2310#define PCI_DEVICE_ID_INTEL_80332_0 0x0330
2311#define PCI_DEVICE_ID_INTEL_80332_1 0x0332
2312#define PCI_DEVICE_ID_INTEL_80333_0 0x0370
2313#define PCI_DEVICE_ID_INTEL_80333_1 0x0372
2307#define PCI_DEVICE_ID_INTEL_82375 0x0482 2314#define PCI_DEVICE_ID_INTEL_82375 0x0482
2308#define PCI_DEVICE_ID_INTEL_82424 0x0483 2315#define PCI_DEVICE_ID_INTEL_82424 0x0483
2309#define PCI_DEVICE_ID_INTEL_82378 0x0484 2316#define PCI_DEVICE_ID_INTEL_82378 0x0484
@@ -2376,6 +2383,7 @@
2376#define PCI_DEVICE_ID_INTEL_ESB_4 0x25a4 2383#define PCI_DEVICE_ID_INTEL_ESB_4 0x25a4
2377#define PCI_DEVICE_ID_INTEL_ESB_5 0x25a6 2384#define PCI_DEVICE_ID_INTEL_ESB_5 0x25a6
2378#define PCI_DEVICE_ID_INTEL_ESB_9 0x25ab 2385#define PCI_DEVICE_ID_INTEL_ESB_9 0x25ab
2386#define PCI_DEVICE_ID_INTEL_ESB_10 0x25ac
2379#define PCI_DEVICE_ID_INTEL_82820_HB 0x2500 2387#define PCI_DEVICE_ID_INTEL_82820_HB 0x2500
2380#define PCI_DEVICE_ID_INTEL_82820_UP_HB 0x2501 2388#define PCI_DEVICE_ID_INTEL_82820_UP_HB 0x2501
2381#define PCI_DEVICE_ID_INTEL_82850_HB 0x2530 2389#define PCI_DEVICE_ID_INTEL_82850_HB 0x2530
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index e5effd47ed74..027815b4635e 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -210,6 +210,7 @@
210#define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */ 210#define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */
211#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ 211#define PCI_CAP_ID_EXP 0x10 /* PCI Express */
212#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ 212#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */
213#define PCI_CAP_ID_AF 0x13 /* PCI Advanced Features */
213#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ 214#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */
214#define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */ 215#define PCI_CAP_FLAGS 2 /* Capability defined flags (16 bits) */
215#define PCI_CAP_SIZEOF 4 216#define PCI_CAP_SIZEOF 4
@@ -316,6 +317,17 @@
316#define PCI_CHSWP_EXT 0x40 /* ENUM# status - extraction */ 317#define PCI_CHSWP_EXT 0x40 /* ENUM# status - extraction */
317#define PCI_CHSWP_INS 0x80 /* ENUM# status - insertion */ 318#define PCI_CHSWP_INS 0x80 /* ENUM# status - insertion */
318 319
320/* PCI Advanced Feature registers */
321
322#define PCI_AF_LENGTH 2
323#define PCI_AF_CAP 3
324#define PCI_AF_CAP_TP 0x01
325#define PCI_AF_CAP_FLR 0x02
326#define PCI_AF_CTRL 4
327#define PCI_AF_CTRL_FLR 0x01
328#define PCI_AF_STATUS 5
329#define PCI_AF_STATUS_TP 0x01
330
319/* PCI-X registers */ 331/* PCI-X registers */
320 332
321#define PCI_X_CMD 2 /* Modes & Features */ 333#define PCI_X_CMD 2 /* Modes & Features */
@@ -399,20 +411,70 @@
399#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */ 411#define PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */
400#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */ 412#define PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */
401#define PCI_EXP_LNKCAP 12 /* Link Capabilities */ 413#define PCI_EXP_LNKCAP 12 /* Link Capabilities */
402#define PCI_EXP_LNKCAP_ASPMS 0xc00 /* ASPM Support */ 414#define PCI_EXP_LNKCAP_SLS 0x0000000f /* Supported Link Speeds */
403#define PCI_EXP_LNKCAP_L0SEL 0x7000 /* L0s Exit Latency */ 415#define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */
404#define PCI_EXP_LNKCAP_L1EL 0x38000 /* L1 Exit Latency */ 416#define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */
405#define PCI_EXP_LNKCAP_CLKPM 0x40000 /* L1 Clock Power Management */ 417#define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */
418#define PCI_EXP_LNKCAP_L1EL 0x00038000 /* L1 Exit Latency */
419#define PCI_EXP_LNKCAP_CLKPM 0x00040000 /* L1 Clock Power Management */
420#define PCI_EXP_LNKCAP_SDERC 0x00080000 /* Suprise Down Error Reporting Capable */
421#define PCI_EXP_LNKCAP_DLLLARC 0x00100000 /* Data Link Layer Link Active Reporting Capable */
422#define PCI_EXP_LNKCAP_LBNC 0x00200000 /* Link Bandwidth Notification Capability */
423#define PCI_EXP_LNKCAP_PN 0xff000000 /* Port Number */
406#define PCI_EXP_LNKCTL 16 /* Link Control */ 424#define PCI_EXP_LNKCTL 16 /* Link Control */
407#define PCI_EXP_LNKCTL_RL 0x20 /* Retrain Link */ 425#define PCI_EXP_LNKCTL_ASPMC 0x0003 /* ASPM Control */
408#define PCI_EXP_LNKCTL_CCC 0x40 /* Common Clock COnfiguration */ 426#define PCI_EXP_LNKCTL_RCB 0x0008 /* Read Completion Boundary */
427#define PCI_EXP_LNKCTL_LD 0x0010 /* Link Disable */
428#define PCI_EXP_LNKCTL_RL 0x0020 /* Retrain Link */
429#define PCI_EXP_LNKCTL_CCC 0x0040 /* Common Clock Configuration */
430#define PCI_EXP_LNKCTL_ES 0x0080 /* Extended Synch */
409#define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */ 431#define PCI_EXP_LNKCTL_CLKREQ_EN 0x100 /* Enable clkreq */
432#define PCI_EXP_LNKCTL_HAWD 0x0200 /* Hardware Autonomous Width Disable */
433#define PCI_EXP_LNKCTL_LBMIE 0x0400 /* Link Bandwidth Management Interrupt Enable */
434#define PCI_EXP_LNKCTL_LABIE 0x0800 /* Lnk Autonomous Bandwidth Interrupt Enable */
410#define PCI_EXP_LNKSTA 18 /* Link Status */ 435#define PCI_EXP_LNKSTA 18 /* Link Status */
411#define PCI_EXP_LNKSTA_LT 0x800 /* Link Training */ 436#define PCI_EXP_LNKSTA_CLS 0x000f /* Current Link Speed */
437#define PCI_EXP_LNKSTA_NLW 0x03f0 /* Nogotiated Link Width */
438#define PCI_EXP_LNKSTA_LT 0x0800 /* Link Training */
412#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */ 439#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */
440#define PCI_EXP_LNKSTA_DLLLA 0x2000 /* Data Link Layer Link Active */
441#define PCI_EXP_LNKSTA_LBMS 0x4000 /* Link Bandwidth Management Status */
442#define PCI_EXP_LNKSTA_LABS 0x8000 /* Link Autonomous Bandwidth Status */
413#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */ 443#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */
444#define PCI_EXP_SLTCAP_ABP 0x00000001 /* Attention Button Present */
445#define PCI_EXP_SLTCAP_PCP 0x00000002 /* Power Controller Present */
446#define PCI_EXP_SLTCAP_MRLSP 0x00000004 /* MRL Sensor Present */
447#define PCI_EXP_SLTCAP_AIP 0x00000008 /* Attention Indicator Present */
448#define PCI_EXP_SLTCAP_PIP 0x00000010 /* Power Indicator Present */
449#define PCI_EXP_SLTCAP_HPS 0x00000020 /* Hot-Plug Surprise */
450#define PCI_EXP_SLTCAP_HPC 0x00000040 /* Hot-Plug Capable */
451#define PCI_EXP_SLTCAP_SPLV 0x00007f80 /* Slot Power Limit Value */
452#define PCI_EXP_SLTCAP_SPLS 0x00018000 /* Slot Power Limit Scale */
453#define PCI_EXP_SLTCAP_EIP 0x00020000 /* Electromechanical Interlock Present */
454#define PCI_EXP_SLTCAP_NCCS 0x00040000 /* No Command Completed Support */
455#define PCI_EXP_SLTCAP_PSN 0xfff80000 /* Physical Slot Number */
414#define PCI_EXP_SLTCTL 24 /* Slot Control */ 456#define PCI_EXP_SLTCTL 24 /* Slot Control */
457#define PCI_EXP_SLTCTL_ABPE 0x0001 /* Attention Button Pressed Enable */
458#define PCI_EXP_SLTCTL_PFDE 0x0002 /* Power Fault Detected Enable */
459#define PCI_EXP_SLTCTL_MRLSCE 0x0004 /* MRL Sensor Changed Enable */
460#define PCI_EXP_SLTCTL_PDCE 0x0008 /* Presence Detect Changed Enable */
461#define PCI_EXP_SLTCTL_CCIE 0x0010 /* Command Completed Interrupt Enable */
462#define PCI_EXP_SLTCTL_HPIE 0x0020 /* Hot-Plug Interrupt Enable */
463#define PCI_EXP_SLTCTL_AIC 0x00c0 /* Attention Indicator Control */
464#define PCI_EXP_SLTCTL_PIC 0x0300 /* Power Indicator Control */
465#define PCI_EXP_SLTCTL_PCC 0x0400 /* Power Controller Control */
466#define PCI_EXP_SLTCTL_EIC 0x0800 /* Electromechanical Interlock Control */
467#define PCI_EXP_SLTCTL_DLLSCE 0x1000 /* Data Link Layer State Changed Enable */
415#define PCI_EXP_SLTSTA 26 /* Slot Status */ 468#define PCI_EXP_SLTSTA 26 /* Slot Status */
469#define PCI_EXP_SLTSTA_ABP 0x0001 /* Attention Button Pressed */
470#define PCI_EXP_SLTSTA_PFD 0x0002 /* Power Fault Detected */
471#define PCI_EXP_SLTSTA_MRLSC 0x0004 /* MRL Sensor Changed */
472#define PCI_EXP_SLTSTA_PDC 0x0008 /* Presence Detect Changed */
473#define PCI_EXP_SLTSTA_CC 0x0010 /* Command Completed */
474#define PCI_EXP_SLTSTA_MRLSS 0x0020 /* MRL Sensor State */
475#define PCI_EXP_SLTSTA_PDS 0x0040 /* Presence Detect State */
476#define PCI_EXP_SLTSTA_EIS 0x0080 /* Electromechanical Interlock Status */
477#define PCI_EXP_SLTSTA_DLLSC 0x0100 /* Data Link Layer State Changed */
416#define PCI_EXP_RTCTL 28 /* Root Control */ 478#define PCI_EXP_RTCTL 28 /* Root Control */
417#define PCI_EXP_RTCTL_SECEE 0x01 /* System Error on Correctable Error */ 479#define PCI_EXP_RTCTL_SECEE 0x01 /* System Error on Correctable Error */
418#define PCI_EXP_RTCTL_SENFEE 0x02 /* System Error on Non-Fatal Error */ 480#define PCI_EXP_RTCTL_SENFEE 0x02 /* System Error on Non-Fatal Error */
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index 9007ccdfc112..a7684a513994 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -24,14 +24,18 @@ struct percpu_counter {
24 s32 *counters; 24 s32 *counters;
25}; 25};
26 26
27#if NR_CPUS >= 16 27extern int percpu_counter_batch;
28#define FBC_BATCH (NR_CPUS*2) 28
29#else 29int __percpu_counter_init(struct percpu_counter *fbc, s64 amount,
30#define FBC_BATCH (NR_CPUS*4) 30 struct lock_class_key *key);
31#endif 31
32#define percpu_counter_init(fbc, value) \
33 ({ \
34 static struct lock_class_key __key; \
35 \
36 __percpu_counter_init(fbc, value, &__key); \
37 })
32 38
33int percpu_counter_init(struct percpu_counter *fbc, s64 amount);
34int percpu_counter_init_irq(struct percpu_counter *fbc, s64 amount);
35void percpu_counter_destroy(struct percpu_counter *fbc); 39void percpu_counter_destroy(struct percpu_counter *fbc);
36void percpu_counter_set(struct percpu_counter *fbc, s64 amount); 40void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
37void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); 41void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch);
@@ -39,7 +43,7 @@ s64 __percpu_counter_sum(struct percpu_counter *fbc);
39 43
40static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount) 44static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount)
41{ 45{
42 __percpu_counter_add(fbc, amount, FBC_BATCH); 46 __percpu_counter_add(fbc, amount, percpu_counter_batch);
43} 47}
44 48
45static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc) 49static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc)
@@ -85,8 +89,6 @@ static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount)
85 return 0; 89 return 0;
86} 90}
87 91
88#define percpu_counter_init_irq percpu_counter_init
89
90static inline void percpu_counter_destroy(struct percpu_counter *fbc) 92static inline void percpu_counter_destroy(struct percpu_counter *fbc)
91{ 93{
92} 94}
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 77c4ed60b982..d7e54d98869f 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -467,6 +467,8 @@ int genphy_restart_aneg(struct phy_device *phydev);
467int genphy_config_aneg(struct phy_device *phydev); 467int genphy_config_aneg(struct phy_device *phydev);
468int genphy_update_link(struct phy_device *phydev); 468int genphy_update_link(struct phy_device *phydev);
469int genphy_read_status(struct phy_device *phydev); 469int genphy_read_status(struct phy_device *phydev);
470int genphy_suspend(struct phy_device *phydev);
471int genphy_resume(struct phy_device *phydev);
470void phy_driver_unregister(struct phy_driver *drv); 472void phy_driver_unregister(struct phy_driver *drv);
471int phy_driver_register(struct phy_driver *new_driver); 473int phy_driver_register(struct phy_driver *new_driver);
472void phy_prepare_link(struct phy_device *phydev, 474void phy_prepare_link(struct phy_device *phydev,
diff --git a/include/linux/pid.h b/include/linux/pid.h
index bb206c56d1f0..49f1c2f66e95 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -123,6 +123,24 @@ extern struct pid *alloc_pid(struct pid_namespace *ns);
123extern void free_pid(struct pid *pid); 123extern void free_pid(struct pid *pid);
124 124
125/* 125/*
126 * ns_of_pid() returns the pid namespace in which the specified pid was
127 * allocated.
128 *
129 * NOTE:
130 * ns_of_pid() is expected to be called for a process (task) that has
131 * an attached 'struct pid' (see attach_pid(), detach_pid()) i.e @pid
132 * is expected to be non-NULL. If @pid is NULL, caller should handle
133 * the resulting NULL pid-ns.
134 */
135static inline struct pid_namespace *ns_of_pid(struct pid *pid)
136{
137 struct pid_namespace *ns = NULL;
138 if (pid)
139 ns = pid->numbers[pid->level].ns;
140 return ns;
141}
142
143/*
126 * the helpers to get the pid's id seen from different namespaces 144 * the helpers to get the pid's id seen from different namespaces
127 * 145 *
128 * pid_nr() : global id, i.e. the id seen from the init namespace; 146 * pid_nr() : global id, i.e. the id seen from the init namespace;
diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h
index d82fe825d62f..38d10326246a 100644
--- a/include/linux/pid_namespace.h
+++ b/include/linux/pid_namespace.h
@@ -79,11 +79,7 @@ static inline void zap_pid_ns_processes(struct pid_namespace *ns)
79} 79}
80#endif /* CONFIG_PID_NS */ 80#endif /* CONFIG_PID_NS */
81 81
82static inline struct pid_namespace *task_active_pid_ns(struct task_struct *tsk) 82extern struct pid_namespace *task_active_pid_ns(struct task_struct *tsk);
83{
84 return tsk->nsproxy->pid_ns;
85}
86
87void pidhash_init(void); 83void pidhash_init(void);
88void pidmap_init(void); 84void pidmap_init(void);
89 85
diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h
index 7cf7824df778..e6aa8482ad7a 100644
--- a/include/linux/pkt_cls.h
+++ b/include/linux/pkt_cls.h
@@ -394,6 +394,20 @@ enum
394 394
395#define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1) 395#define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1)
396 396
397
398/* Cgroup classifier */
399
400enum
401{
402 TCA_CGROUP_UNSPEC,
403 TCA_CGROUP_ACT,
404 TCA_CGROUP_POLICE,
405 TCA_CGROUP_EMATCHES,
406 __TCA_CGROUP_MAX,
407};
408
409#define TCA_CGROUP_MAX (__TCA_CGROUP_MAX - 1)
410
397/* Extended Matches */ 411/* Extended Matches */
398 412
399struct tcf_ematch_tree_hdr 413struct tcf_ematch_tree_hdr
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 5d921fa91a5b..e3f133adba78 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -500,4 +500,20 @@ struct tc_netem_corrupt
500 500
501#define NETEM_DIST_SCALE 8192 501#define NETEM_DIST_SCALE 8192
502 502
503/* DRR */
504
505enum
506{
507 TCA_DRR_UNSPEC,
508 TCA_DRR_QUANTUM,
509 __TCA_DRR_MAX
510};
511
512#define TCA_DRR_MAX (__TCA_DRR_MAX - 1)
513
514struct tc_drr_stats
515{
516 u32 deficit;
517};
518
503#endif 519#endif
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 4b8cc6a32479..9a342699c607 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -55,7 +55,6 @@ struct platform_driver {
55 int (*suspend_late)(struct platform_device *, pm_message_t state); 55 int (*suspend_late)(struct platform_device *, pm_message_t state);
56 int (*resume_early)(struct platform_device *); 56 int (*resume_early)(struct platform_device *);
57 int (*resume)(struct platform_device *); 57 int (*resume)(struct platform_device *);
58 struct pm_ext_ops *pm;
59 struct device_driver driver; 58 struct device_driver driver;
60}; 59};
61 60
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 42de4003c4ee..de2e0a8f6728 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -41,7 +41,7 @@ typedef struct pm_message {
41} pm_message_t; 41} pm_message_t;
42 42
43/** 43/**
44 * struct pm_ops - device PM callbacks 44 * struct dev_pm_ops - device PM callbacks
45 * 45 *
46 * Several driver power state transitions are externally visible, affecting 46 * Several driver power state transitions are externally visible, affecting
47 * the state of pending I/O queues and (for drivers that touch hardware) 47 * the state of pending I/O queues and (for drivers that touch hardware)
@@ -126,46 +126,6 @@ typedef struct pm_message {
126 * On most platforms, there are no restrictions on availability of 126 * On most platforms, there are no restrictions on availability of
127 * resources like clocks during @restore(). 127 * resources like clocks during @restore().
128 * 128 *
129 * All of the above callbacks, except for @complete(), return error codes.
130 * However, the error codes returned by the resume operations, @resume(),
131 * @thaw(), and @restore(), do not cause the PM core to abort the resume
132 * transition during which they are returned. The error codes returned in
133 * that cases are only printed by the PM core to the system logs for debugging
134 * purposes. Still, it is recommended that drivers only return error codes
135 * from their resume methods in case of an unrecoverable failure (i.e. when the
136 * device being handled refuses to resume and becomes unusable) to allow us to
137 * modify the PM core in the future, so that it can avoid attempting to handle
138 * devices that failed to resume and their children.
139 *
140 * It is allowed to unregister devices while the above callbacks are being
141 * executed. However, it is not allowed to unregister a device from within any
142 * of its own callbacks.
143 */
144
145struct pm_ops {
146 int (*prepare)(struct device *dev);
147 void (*complete)(struct device *dev);
148 int (*suspend)(struct device *dev);
149 int (*resume)(struct device *dev);
150 int (*freeze)(struct device *dev);
151 int (*thaw)(struct device *dev);
152 int (*poweroff)(struct device *dev);
153 int (*restore)(struct device *dev);
154};
155
156/**
157 * struct pm_ext_ops - extended device PM callbacks
158 *
159 * Some devices require certain operations related to suspend and hibernation
160 * to be carried out with interrupts disabled. Thus, 'struct pm_ext_ops' below
161 * is defined, adding callbacks to be executed with interrupts disabled to
162 * 'struct pm_ops'.
163 *
164 * The following callbacks included in 'struct pm_ext_ops' are executed with
165 * the nonboot CPUs switched off and with interrupts disabled on the only
166 * functional CPU. They also are executed with the PM core list of devices
167 * locked, so they must NOT unregister any devices.
168 *
169 * @suspend_noirq: Complete the operations of ->suspend() by carrying out any 129 * @suspend_noirq: Complete the operations of ->suspend() by carrying out any
170 * actions required for suspending the device that need interrupts to be 130 * actions required for suspending the device that need interrupts to be
171 * disabled 131 * disabled
@@ -190,18 +150,32 @@ struct pm_ops {
190 * actions required for restoring the operations of the device that need 150 * actions required for restoring the operations of the device that need
191 * interrupts to be disabled 151 * interrupts to be disabled
192 * 152 *
193 * All of the above callbacks return error codes, but the error codes returned 153 * All of the above callbacks, except for @complete(), return error codes.
194 * by the resume operations, @resume_noirq(), @thaw_noirq(), and 154 * However, the error codes returned by the resume operations, @resume(),
195 * @restore_noirq(), do not cause the PM core to abort the resume transition 155 * @thaw(), @restore(), @resume_noirq(), @thaw_noirq(), and @restore_noirq() do
196 * during which they are returned. The error codes returned in that cases are 156 * not cause the PM core to abort the resume transition during which they are
197 * only printed by the PM core to the system logs for debugging purposes. 157 * returned. The error codes returned in that cases are only printed by the PM
198 * Still, as stated above, it is recommended that drivers only return error 158 * core to the system logs for debugging purposes. Still, it is recommended
199 * codes from their resume methods if the device being handled fails to resume 159 * that drivers only return error codes from their resume methods in case of an
200 * and is not usable any more. 160 * unrecoverable failure (i.e. when the device being handled refuses to resume
161 * and becomes unusable) to allow us to modify the PM core in the future, so
162 * that it can avoid attempting to handle devices that failed to resume and
163 * their children.
164 *
165 * It is allowed to unregister devices while the above callbacks are being
166 * executed. However, it is not allowed to unregister a device from within any
167 * of its own callbacks.
201 */ 168 */
202 169
203struct pm_ext_ops { 170struct dev_pm_ops {
204 struct pm_ops base; 171 int (*prepare)(struct device *dev);
172 void (*complete)(struct device *dev);
173 int (*suspend)(struct device *dev);
174 int (*resume)(struct device *dev);
175 int (*freeze)(struct device *dev);
176 int (*thaw)(struct device *dev);
177 int (*poweroff)(struct device *dev);
178 int (*restore)(struct device *dev);
205 int (*suspend_noirq)(struct device *dev); 179 int (*suspend_noirq)(struct device *dev);
206 int (*resume_noirq)(struct device *dev); 180 int (*resume_noirq)(struct device *dev);
207 int (*freeze_noirq)(struct device *dev); 181 int (*freeze_noirq)(struct device *dev);
@@ -278,7 +252,7 @@ struct pm_ext_ops {
278#define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE) 252#define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE)
279#define PM_EVENT_USER_SUSPEND (PM_EVENT_USER | PM_EVENT_SUSPEND) 253#define PM_EVENT_USER_SUSPEND (PM_EVENT_USER | PM_EVENT_SUSPEND)
280#define PM_EVENT_USER_RESUME (PM_EVENT_USER | PM_EVENT_RESUME) 254#define PM_EVENT_USER_RESUME (PM_EVENT_USER | PM_EVENT_RESUME)
281#define PM_EVENT_REMOTE_WAKEUP (PM_EVENT_REMOTE | PM_EVENT_RESUME) 255#define PM_EVENT_REMOTE_RESUME (PM_EVENT_REMOTE | PM_EVENT_RESUME)
282#define PM_EVENT_AUTO_SUSPEND (PM_EVENT_AUTO | PM_EVENT_SUSPEND) 256#define PM_EVENT_AUTO_SUSPEND (PM_EVENT_AUTO | PM_EVENT_SUSPEND)
283#define PM_EVENT_AUTO_RESUME (PM_EVENT_AUTO | PM_EVENT_RESUME) 257#define PM_EVENT_AUTO_RESUME (PM_EVENT_AUTO | PM_EVENT_RESUME)
284 258
@@ -291,15 +265,15 @@ struct pm_ext_ops {
291#define PMSG_THAW ((struct pm_message){ .event = PM_EVENT_THAW, }) 265#define PMSG_THAW ((struct pm_message){ .event = PM_EVENT_THAW, })
292#define PMSG_RESTORE ((struct pm_message){ .event = PM_EVENT_RESTORE, }) 266#define PMSG_RESTORE ((struct pm_message){ .event = PM_EVENT_RESTORE, })
293#define PMSG_RECOVER ((struct pm_message){ .event = PM_EVENT_RECOVER, }) 267#define PMSG_RECOVER ((struct pm_message){ .event = PM_EVENT_RECOVER, })
294#define PMSG_USER_SUSPEND ((struct pm_messge) \ 268#define PMSG_USER_SUSPEND ((struct pm_message) \
295 { .event = PM_EVENT_USER_SUSPEND, }) 269 { .event = PM_EVENT_USER_SUSPEND, })
296#define PMSG_USER_RESUME ((struct pm_messge) \ 270#define PMSG_USER_RESUME ((struct pm_message) \
297 { .event = PM_EVENT_USER_RESUME, }) 271 { .event = PM_EVENT_USER_RESUME, })
298#define PMSG_REMOTE_RESUME ((struct pm_messge) \ 272#define PMSG_REMOTE_RESUME ((struct pm_message) \
299 { .event = PM_EVENT_REMOTE_RESUME, }) 273 { .event = PM_EVENT_REMOTE_RESUME, })
300#define PMSG_AUTO_SUSPEND ((struct pm_messge) \ 274#define PMSG_AUTO_SUSPEND ((struct pm_message) \
301 { .event = PM_EVENT_AUTO_SUSPEND, }) 275 { .event = PM_EVENT_AUTO_SUSPEND, })
302#define PMSG_AUTO_RESUME ((struct pm_messge) \ 276#define PMSG_AUTO_RESUME ((struct pm_message) \
303 { .event = PM_EVENT_AUTO_RESUME, }) 277 { .event = PM_EVENT_AUTO_RESUME, })
304 278
305/** 279/**
diff --git a/include/linux/poll.h b/include/linux/poll.h
index badd98ab06f6..8c24ef8d9976 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -46,9 +46,9 @@ static inline void init_poll_funcptr(poll_table *pt, poll_queue_proc qproc)
46} 46}
47 47
48struct poll_table_entry { 48struct poll_table_entry {
49 struct file * filp; 49 struct file *filp;
50 wait_queue_t wait; 50 wait_queue_t wait;
51 wait_queue_head_t * wait_address; 51 wait_queue_head_t *wait_address;
52}; 52};
53 53
54/* 54/*
@@ -56,7 +56,9 @@ struct poll_table_entry {
56 */ 56 */
57struct poll_wqueues { 57struct poll_wqueues {
58 poll_table pt; 58 poll_table pt;
59 struct poll_table_page * table; 59 struct poll_table_page *table;
60 struct task_struct *polling_task;
61 int triggered;
60 int error; 62 int error;
61 int inline_index; 63 int inline_index;
62 struct poll_table_entry inline_entries[N_INLINE_POLL_ENTRIES]; 64 struct poll_table_entry inline_entries[N_INLINE_POLL_ENTRIES];
@@ -64,6 +66,13 @@ struct poll_wqueues {
64 66
65extern void poll_initwait(struct poll_wqueues *pwq); 67extern void poll_initwait(struct poll_wqueues *pwq);
66extern void poll_freewait(struct poll_wqueues *pwq); 68extern void poll_freewait(struct poll_wqueues *pwq);
69extern int poll_schedule_timeout(struct poll_wqueues *pwq, int state,
70 ktime_t *expires, unsigned long slack);
71
72static inline int poll_schedule(struct poll_wqueues *pwq, int state)
73{
74 return poll_schedule_timeout(pwq, state, NULL, 0);
75}
67 76
68/* 77/*
69 * Scaleable version of the fd_set. 78 * Scaleable version of the fd_set.
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index a7c721355549..4f71bf4e628c 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -45,7 +45,11 @@ struct k_itimer {
45 int it_requeue_pending; /* waiting to requeue this timer */ 45 int it_requeue_pending; /* waiting to requeue this timer */
46#define REQUEUE_PENDING 1 46#define REQUEUE_PENDING 1
47 int it_sigev_notify; /* notify word of sigevent struct */ 47 int it_sigev_notify; /* notify word of sigevent struct */
48 struct task_struct *it_process; /* process to send signal to */ 48 struct signal_struct *it_signal;
49 union {
50 struct pid *it_pid; /* pid of process to send signal to */
51 struct task_struct *it_process; /* for clock_nanosleep */
52 };
49 struct sigqueue *sigq; /* signal queue entry. */ 53 struct sigqueue *sigq; /* signal queue entry. */
50 union { 54 union {
51 struct { 55 struct {
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index f9348cba6dc1..8ff25e0e7f7a 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -45,6 +45,7 @@ enum {
45 POWER_SUPPLY_HEALTH_DEAD, 45 POWER_SUPPLY_HEALTH_DEAD,
46 POWER_SUPPLY_HEALTH_OVERVOLTAGE, 46 POWER_SUPPLY_HEALTH_OVERVOLTAGE,
47 POWER_SUPPLY_HEALTH_UNSPEC_FAILURE, 47 POWER_SUPPLY_HEALTH_UNSPEC_FAILURE,
48 POWER_SUPPLY_HEALTH_COLD,
48}; 49};
49 50
50enum { 51enum {
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index 22641d5d45df..98b93ca4db06 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -94,6 +94,7 @@ extern void ptrace_notify(int exit_code);
94extern void __ptrace_link(struct task_struct *child, 94extern void __ptrace_link(struct task_struct *child,
95 struct task_struct *new_parent); 95 struct task_struct *new_parent);
96extern void __ptrace_unlink(struct task_struct *child); 96extern void __ptrace_unlink(struct task_struct *child);
97extern void ptrace_fork(struct task_struct *task, unsigned long clone_flags);
97#define PTRACE_MODE_READ 1 98#define PTRACE_MODE_READ 1
98#define PTRACE_MODE_ATTACH 2 99#define PTRACE_MODE_ATTACH 2
99/* Returns 0 on success, -errno on denial. */ 100/* Returns 0 on success, -errno on denial. */
@@ -313,6 +314,27 @@ static inline void user_enable_block_step(struct task_struct *task)
313#define arch_ptrace_stop(code, info) do { } while (0) 314#define arch_ptrace_stop(code, info) do { } while (0)
314#endif 315#endif
315 316
317#ifndef arch_ptrace_untrace
318/*
319 * Do machine-specific work before untracing child.
320 *
321 * This is called for a normal detach as well as from ptrace_exit()
322 * when the tracing task dies.
323 *
324 * Called with write_lock(&tasklist_lock) held.
325 */
326#define arch_ptrace_untrace(task) do { } while (0)
327#endif
328
329#ifndef arch_ptrace_fork
330/*
331 * Do machine-specific work to initialize a new task.
332 *
333 * This is called from copy_process().
334 */
335#define arch_ptrace_fork(child, clone_flags) do { } while (0)
336#endif
337
316extern int task_current_syscall(struct task_struct *target, long *callno, 338extern int task_current_syscall(struct task_struct *target, long *callno,
317 unsigned long args[6], unsigned int maxargs, 339 unsigned long args[6], unsigned int maxargs,
318 unsigned long *sp, unsigned long *pc); 340 unsigned long *sp, unsigned long *pc);
diff --git a/include/linux/qnx4_fs.h b/include/linux/qnx4_fs.h
index 34a196ee7941..787d19ea9f46 100644
--- a/include/linux/qnx4_fs.h
+++ b/include/linux/qnx4_fs.h
@@ -2,14 +2,12 @@
2 * Name : qnx4_fs.h 2 * Name : qnx4_fs.h
3 * Author : Richard Frowijn 3 * Author : Richard Frowijn
4 * Function : qnx4 global filesystem definitions 4 * Function : qnx4 global filesystem definitions
5 * Version : 1.0.2
6 * Last modified : 2000-01-31
7 *
8 * History : 23-03-1998 created 5 * History : 23-03-1998 created
9 */ 6 */
10#ifndef _LINUX_QNX4_FS_H 7#ifndef _LINUX_QNX4_FS_H
11#define _LINUX_QNX4_FS_H 8#define _LINUX_QNX4_FS_H
12 9
10#include <linux/types.h>
13#include <linux/qnxtypes.h> 11#include <linux/qnxtypes.h>
14#include <linux/magic.h> 12#include <linux/magic.h>
15 13
diff --git a/include/linux/qnxtypes.h b/include/linux/qnxtypes.h
index a3eb1137857b..bebbe5cc4fb8 100644
--- a/include/linux/qnxtypes.h
+++ b/include/linux/qnxtypes.h
@@ -2,9 +2,6 @@
2 * Name : qnxtypes.h 2 * Name : qnxtypes.h
3 * Author : Richard Frowijn 3 * Author : Richard Frowijn
4 * Function : standard qnx types 4 * Function : standard qnx types
5 * Version : 1.0.2
6 * Last modified : 2000-01-06
7 *
8 * History : 22-03-1998 created 5 * History : 22-03-1998 created
9 * 6 *
10 */ 7 */
@@ -12,6 +9,8 @@
12#ifndef _QNX4TYPES_H 9#ifndef _QNX4TYPES_H
13#define _QNX4TYPES_H 10#define _QNX4TYPES_H
14 11
12#include <linux/types.h>
13
15typedef __le16 qnx4_nxtnt_t; 14typedef __le16 qnx4_nxtnt_t;
16typedef __u8 qnx4_ftype_t; 15typedef __u8 qnx4_ftype_t;
17 16
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 40401b554484..d72d5d84fde5 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -36,17 +36,7 @@
36#include <linux/errno.h> 36#include <linux/errno.h>
37#include <linux/types.h> 37#include <linux/types.h>
38 38
39#define __DQUOT_VERSION__ "dquot_6.5.1" 39#define __DQUOT_VERSION__ "dquot_6.5.2"
40#define __DQUOT_NUM_VERSION__ 6*10000+5*100+1
41
42/* Size of blocks in which are counted size limits */
43#define QUOTABLOCK_BITS 10
44#define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS)
45
46/* Conversion routines from and to quota blocks */
47#define qb2kb(x) ((x) << (QUOTABLOCK_BITS-10))
48#define kb2qb(x) ((x) >> (QUOTABLOCK_BITS-10))
49#define toqb(x) (((x) + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS)
50 40
51#define MAXQUOTAS 2 41#define MAXQUOTAS 2
52#define USRQUOTA 0 /* element used for user quotas */ 42#define USRQUOTA 0 /* element used for user quotas */
@@ -80,16 +70,34 @@
80#define Q_GETQUOTA 0x800007 /* get user quota structure */ 70#define Q_GETQUOTA 0x800007 /* get user quota structure */
81#define Q_SETQUOTA 0x800008 /* set user quota structure */ 71#define Q_SETQUOTA 0x800008 /* set user quota structure */
82 72
73/* Quota format type IDs */
74#define QFMT_VFS_OLD 1
75#define QFMT_VFS_V0 2
76
77/* Size of block in which space limits are passed through the quota
78 * interface */
79#define QIF_DQBLKSIZE_BITS 10
80#define QIF_DQBLKSIZE (1 << QIF_DQBLKSIZE_BITS)
81
83/* 82/*
84 * Quota structure used for communication with userspace via quotactl 83 * Quota structure used for communication with userspace via quotactl
85 * Following flags are used to specify which fields are valid 84 * Following flags are used to specify which fields are valid
86 */ 85 */
87#define QIF_BLIMITS 1 86enum {
88#define QIF_SPACE 2 87 QIF_BLIMITS_B = 0,
89#define QIF_ILIMITS 4 88 QIF_SPACE_B,
90#define QIF_INODES 8 89 QIF_ILIMITS_B,
91#define QIF_BTIME 16 90 QIF_INODES_B,
92#define QIF_ITIME 32 91 QIF_BTIME_B,
92 QIF_ITIME_B,
93};
94
95#define QIF_BLIMITS (1 << QIF_BLIMITS_B)
96#define QIF_SPACE (1 << QIF_SPACE_B)
97#define QIF_ILIMITS (1 << QIF_ILIMITS_B)
98#define QIF_INODES (1 << QIF_INODES_B)
99#define QIF_BTIME (1 << QIF_BTIME_B)
100#define QIF_ITIME (1 << QIF_ITIME_B)
93#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS) 101#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)
94#define QIF_USAGE (QIF_SPACE | QIF_INODES) 102#define QIF_USAGE (QIF_SPACE | QIF_INODES)
95#define QIF_TIMES (QIF_BTIME | QIF_ITIME) 103#define QIF_TIMES (QIF_BTIME | QIF_ITIME)
@@ -172,7 +180,7 @@ enum {
172#include <asm/atomic.h> 180#include <asm/atomic.h>
173 181
174typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */ 182typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
175typedef __u64 qsize_t; /* Type in which we store sizes */ 183typedef long long qsize_t; /* Type in which we store sizes */
176 184
177extern spinlock_t dq_data_lock; 185extern spinlock_t dq_data_lock;
178 186
@@ -187,12 +195,12 @@ extern spinlock_t dq_data_lock;
187 * Data for one user/group kept in memory 195 * Data for one user/group kept in memory
188 */ 196 */
189struct mem_dqblk { 197struct mem_dqblk {
190 __u32 dqb_bhardlimit; /* absolute limit on disk blks alloc */ 198 qsize_t dqb_bhardlimit; /* absolute limit on disk blks alloc */
191 __u32 dqb_bsoftlimit; /* preferred limit on disk blks */ 199 qsize_t dqb_bsoftlimit; /* preferred limit on disk blks */
192 qsize_t dqb_curspace; /* current used space */ 200 qsize_t dqb_curspace; /* current used space */
193 __u32 dqb_ihardlimit; /* absolute limit on allocated inodes */ 201 qsize_t dqb_ihardlimit; /* absolute limit on allocated inodes */
194 __u32 dqb_isoftlimit; /* preferred inode limit */ 202 qsize_t dqb_isoftlimit; /* preferred inode limit */
195 __u32 dqb_curinodes; /* current # allocated inodes */ 203 qsize_t dqb_curinodes; /* current # allocated inodes */
196 time_t dqb_btime; /* time limit for excessive disk use */ 204 time_t dqb_btime; /* time limit for excessive disk use */
197 time_t dqb_itime; /* time limit for excessive inode use */ 205 time_t dqb_itime; /* time limit for excessive inode use */
198}; 206};
@@ -212,10 +220,7 @@ struct mem_dqinfo {
212 unsigned int dqi_igrace; 220 unsigned int dqi_igrace;
213 qsize_t dqi_maxblimit; 221 qsize_t dqi_maxblimit;
214 qsize_t dqi_maxilimit; 222 qsize_t dqi_maxilimit;
215 union { 223 void *dqi_priv;
216 struct v1_mem_dqinfo v1_i;
217 struct v2_mem_dqinfo v2_i;
218 } u;
219}; 224};
220 225
221struct super_block; 226struct super_block;
@@ -249,6 +254,11 @@ extern struct dqstats dqstats;
249#define DQ_FAKE_B 3 /* no limits only usage */ 254#define DQ_FAKE_B 3 /* no limits only usage */
250#define DQ_READ_B 4 /* dquot was read into memory */ 255#define DQ_READ_B 4 /* dquot was read into memory */
251#define DQ_ACTIVE_B 5 /* dquot is active (dquot_release not called) */ 256#define DQ_ACTIVE_B 5 /* dquot is active (dquot_release not called) */
257#define DQ_LASTSET_B 6 /* Following 6 bits (see QIF_) are reserved\
258 * for the mask of entries set via SETQUOTA\
259 * quotactl. They are set under dq_data_lock\
260 * and the quota format handling dquot can\
261 * clear them when it sees fit. */
252 262
253struct dquot { 263struct dquot {
254 struct hlist_node dq_hash; /* Hash list in memory */ 264 struct hlist_node dq_hash; /* Hash list in memory */
@@ -287,11 +297,13 @@ struct dquot_operations {
287 int (*initialize) (struct inode *, int); 297 int (*initialize) (struct inode *, int);
288 int (*drop) (struct inode *); 298 int (*drop) (struct inode *);
289 int (*alloc_space) (struct inode *, qsize_t, int); 299 int (*alloc_space) (struct inode *, qsize_t, int);
290 int (*alloc_inode) (const struct inode *, unsigned long); 300 int (*alloc_inode) (const struct inode *, qsize_t);
291 int (*free_space) (struct inode *, qsize_t); 301 int (*free_space) (struct inode *, qsize_t);
292 int (*free_inode) (const struct inode *, unsigned long); 302 int (*free_inode) (const struct inode *, qsize_t);
293 int (*transfer) (struct inode *, struct iattr *); 303 int (*transfer) (struct inode *, struct iattr *);
294 int (*write_dquot) (struct dquot *); /* Ordinary dquot write */ 304 int (*write_dquot) (struct dquot *); /* Ordinary dquot write */
305 struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */
306 void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */
295 int (*acquire_dquot) (struct dquot *); /* Quota is going to be created on disk */ 307 int (*acquire_dquot) (struct dquot *); /* Quota is going to be created on disk */
296 int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */ 308 int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */
297 int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */ 309 int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */
@@ -320,12 +332,42 @@ struct quota_format_type {
320 struct quota_format_type *qf_next; 332 struct quota_format_type *qf_next;
321}; 333};
322 334
323#define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */ 335/* Quota state flags - they actually come in two flavors - for users and groups */
324#define DQUOT_GRP_ENABLED 0x02 /* Group diskquotas enabled */ 336enum {
325#define DQUOT_USR_SUSPENDED 0x04 /* User diskquotas are off, but 337 _DQUOT_USAGE_ENABLED = 0, /* Track disk usage for users */
338 _DQUOT_LIMITS_ENABLED, /* Enforce quota limits for users */
339 _DQUOT_SUSPENDED, /* User diskquotas are off, but
326 * we have necessary info in 340 * we have necessary info in
327 * memory to turn them on */ 341 * memory to turn them on */
328#define DQUOT_GRP_SUSPENDED 0x08 /* The same for group quotas */ 342 _DQUOT_STATE_FLAGS
343};
344#define DQUOT_USAGE_ENABLED (1 << _DQUOT_USAGE_ENABLED)
345#define DQUOT_LIMITS_ENABLED (1 << _DQUOT_LIMITS_ENABLED)
346#define DQUOT_SUSPENDED (1 << _DQUOT_SUSPENDED)
347#define DQUOT_STATE_FLAGS (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \
348 DQUOT_SUSPENDED)
349/* Other quota flags */
350#define DQUOT_QUOTA_SYS_FILE (1 << 6) /* Quota file is a special
351 * system file and user cannot
352 * touch it. Filesystem is
353 * responsible for setting
354 * S_NOQUOTA, S_NOATIME flags
355 */
356#define DQUOT_NEGATIVE_USAGE (1 << 7) /* Allow negative quota usage */
357
358static inline unsigned int dquot_state_flag(unsigned int flags, int type)
359{
360 if (type == USRQUOTA)
361 return flags;
362 return flags << _DQUOT_STATE_FLAGS;
363}
364
365static inline unsigned int dquot_generic_flag(unsigned int flags, int type)
366{
367 if (type == USRQUOTA)
368 return flags;
369 return flags >> _DQUOT_STATE_FLAGS;
370}
329 371
330struct quota_info { 372struct quota_info {
331 unsigned int flags; /* Flags for diskquotas on this device */ 373 unsigned int flags; /* Flags for diskquotas on this device */
diff --git a/include/linux/quotaio_v1.h b/include/linux/quotaio_v1.h
deleted file mode 100644
index 746654b5de70..000000000000
--- a/include/linux/quotaio_v1.h
+++ /dev/null
@@ -1,33 +0,0 @@
1#ifndef _LINUX_QUOTAIO_V1_H
2#define _LINUX_QUOTAIO_V1_H
3
4#include <linux/types.h>
5
6/*
7 * The following constants define the amount of time given a user
8 * before the soft limits are treated as hard limits (usually resulting
9 * in an allocation failure). The timer is started when the user crosses
10 * their soft limit, it is reset when they go below their soft limit.
11 */
12#define MAX_IQ_TIME 604800 /* (7*24*60*60) 1 week */
13#define MAX_DQ_TIME 604800 /* (7*24*60*60) 1 week */
14
15/*
16 * The following structure defines the format of the disk quota file
17 * (as it appears on disk) - the file is an array of these structures
18 * indexed by user or group number.
19 */
20struct v1_disk_dqblk {
21 __u32 dqb_bhardlimit; /* absolute limit on disk blks alloc */
22 __u32 dqb_bsoftlimit; /* preferred limit on disk blks */
23 __u32 dqb_curblocks; /* current block count */
24 __u32 dqb_ihardlimit; /* absolute limit on allocated inodes */
25 __u32 dqb_isoftlimit; /* preferred inode limit */
26 __u32 dqb_curinodes; /* current # allocated inodes */
27 time_t dqb_btime; /* time limit for excessive disk use */
28 time_t dqb_itime; /* time limit for excessive inode use */
29};
30
31#define v1_dqoff(UID) ((loff_t)((UID) * sizeof (struct v1_disk_dqblk)))
32
33#endif /* _LINUX_QUOTAIO_V1_H */
diff --git a/include/linux/quotaio_v2.h b/include/linux/quotaio_v2.h
deleted file mode 100644
index 303d7cbe30d4..000000000000
--- a/include/linux/quotaio_v2.h
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * Definitions of structures for vfsv0 quota format
3 */
4
5#ifndef _LINUX_QUOTAIO_V2_H
6#define _LINUX_QUOTAIO_V2_H
7
8#include <linux/types.h>
9#include <linux/quota.h>
10
11/*
12 * Definitions of magics and versions of current quota files
13 */
14#define V2_INITQMAGICS {\
15 0xd9c01f11, /* USRQUOTA */\
16 0xd9c01927 /* GRPQUOTA */\
17}
18
19#define V2_INITQVERSIONS {\
20 0, /* USRQUOTA */\
21 0 /* GRPQUOTA */\
22}
23
24/*
25 * The following structure defines the format of the disk quota file
26 * (as it appears on disk) - the file is a radix tree whose leaves point
27 * to blocks of these structures.
28 */
29struct v2_disk_dqblk {
30 __le32 dqb_id; /* id this quota applies to */
31 __le32 dqb_ihardlimit; /* absolute limit on allocated inodes */
32 __le32 dqb_isoftlimit; /* preferred inode limit */
33 __le32 dqb_curinodes; /* current # allocated inodes */
34 __le32 dqb_bhardlimit; /* absolute limit on disk space (in QUOTABLOCK_SIZE) */
35 __le32 dqb_bsoftlimit; /* preferred limit on disk space (in QUOTABLOCK_SIZE) */
36 __le64 dqb_curspace; /* current space occupied (in bytes) */
37 __le64 dqb_btime; /* time limit for excessive disk use */
38 __le64 dqb_itime; /* time limit for excessive inode use */
39};
40
41/*
42 * Here are header structures as written on disk and their in-memory copies
43 */
44/* First generic header */
45struct v2_disk_dqheader {
46 __le32 dqh_magic; /* Magic number identifying file */
47 __le32 dqh_version; /* File version */
48};
49
50/* Header with type and version specific information */
51struct v2_disk_dqinfo {
52 __le32 dqi_bgrace; /* Time before block soft limit becomes hard limit */
53 __le32 dqi_igrace; /* Time before inode soft limit becomes hard limit */
54 __le32 dqi_flags; /* Flags for quotafile (DQF_*) */
55 __le32 dqi_blocks; /* Number of blocks in file */
56 __le32 dqi_free_blk; /* Number of first free block in the list */
57 __le32 dqi_free_entry; /* Number of block with at least one free entry */
58};
59
60/*
61 * Structure of header of block with quota structures. It is padded to 16 bytes so
62 * there will be space for exactly 21 quota-entries in a block
63 */
64struct v2_disk_dqdbheader {
65 __le32 dqdh_next_free; /* Number of next block with free entry */
66 __le32 dqdh_prev_free; /* Number of previous block with free entry */
67 __le16 dqdh_entries; /* Number of valid entries in block */
68 __le16 dqdh_pad1;
69 __le32 dqdh_pad2;
70};
71
72#define V2_DQINFOOFF sizeof(struct v2_disk_dqheader) /* Offset of info header in file */
73#define V2_DQBLKSIZE_BITS 10
74#define V2_DQBLKSIZE (1 << V2_DQBLKSIZE_BITS) /* Size of block with quota structures */
75#define V2_DQTREEOFF 1 /* Offset of tree in file in blocks */
76#define V2_DQTREEDEPTH 4 /* Depth of quota tree */
77#define V2_DQSTRINBLK ((V2_DQBLKSIZE - sizeof(struct v2_disk_dqdbheader)) / sizeof(struct v2_disk_dqblk)) /* Number of entries in one blocks */
78
79#endif /* _LINUX_QUOTAIO_V2_H */
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index a558a4c1d35a..21b781a3350f 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -24,12 +24,21 @@ void sync_dquots(struct super_block *sb, int type);
24 24
25int dquot_initialize(struct inode *inode, int type); 25int dquot_initialize(struct inode *inode, int type);
26int dquot_drop(struct inode *inode); 26int dquot_drop(struct inode *inode);
27int dquot_drop_locked(struct inode *inode);
28struct dquot *dqget(struct super_block *sb, unsigned int id, int type);
29void dqput(struct dquot *dquot);
30int dquot_is_cached(struct super_block *sb, unsigned int id, int type);
31int dquot_scan_active(struct super_block *sb,
32 int (*fn)(struct dquot *dquot, unsigned long priv),
33 unsigned long priv);
34struct dquot *dquot_alloc(struct super_block *sb, int type);
35void dquot_destroy(struct dquot *dquot);
27 36
28int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); 37int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc);
29int dquot_alloc_inode(const struct inode *inode, unsigned long number); 38int dquot_alloc_inode(const struct inode *inode, qsize_t number);
30 39
31int dquot_free_space(struct inode *inode, qsize_t number); 40int dquot_free_space(struct inode *inode, qsize_t number);
32int dquot_free_inode(const struct inode *inode, unsigned long number); 41int dquot_free_inode(const struct inode *inode, qsize_t number);
33 42
34int dquot_transfer(struct inode *inode, struct iattr *iattr); 43int dquot_transfer(struct inode *inode, struct iattr *iattr);
35int dquot_commit(struct dquot *dquot); 44int dquot_commit(struct dquot *dquot);
@@ -40,11 +49,14 @@ int dquot_mark_dquot_dirty(struct dquot *dquot);
40 49
41int vfs_quota_on(struct super_block *sb, int type, int format_id, 50int vfs_quota_on(struct super_block *sb, int type, int format_id,
42 char *path, int remount); 51 char *path, int remount);
52int vfs_quota_enable(struct inode *inode, int type, int format_id,
53 unsigned int flags);
43int vfs_quota_on_path(struct super_block *sb, int type, int format_id, 54int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
44 struct path *path); 55 struct path *path);
45int vfs_quota_on_mount(struct super_block *sb, char *qf_name, 56int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
46 int format_id, int type); 57 int format_id, int type);
47int vfs_quota_off(struct super_block *sb, int type, int remount); 58int vfs_quota_off(struct super_block *sb, int type, int remount);
59int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags);
48int vfs_quota_sync(struct super_block *sb, int type); 60int vfs_quota_sync(struct super_block *sb, int type);
49int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 61int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
50int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 62int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
@@ -64,24 +76,22 @@ static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type)
64 * Functions for checking status of quota 76 * Functions for checking status of quota
65 */ 77 */
66 78
67static inline int sb_has_quota_enabled(struct super_block *sb, int type) 79static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type)
68{ 80{
69 if (type == USRQUOTA) 81 return sb_dqopt(sb)->flags &
70 return sb_dqopt(sb)->flags & DQUOT_USR_ENABLED; 82 dquot_state_flag(DQUOT_USAGE_ENABLED, type);
71 return sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED;
72} 83}
73 84
74static inline int sb_any_quota_enabled(struct super_block *sb) 85static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type)
75{ 86{
76 return sb_has_quota_enabled(sb, USRQUOTA) || 87 return sb_dqopt(sb)->flags &
77 sb_has_quota_enabled(sb, GRPQUOTA); 88 dquot_state_flag(DQUOT_LIMITS_ENABLED, type);
78} 89}
79 90
80static inline int sb_has_quota_suspended(struct super_block *sb, int type) 91static inline int sb_has_quota_suspended(struct super_block *sb, int type)
81{ 92{
82 if (type == USRQUOTA) 93 return sb_dqopt(sb)->flags &
83 return sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED; 94 dquot_state_flag(DQUOT_SUSPENDED, type);
84 return sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED;
85} 95}
86 96
87static inline int sb_any_quota_suspended(struct super_block *sb) 97static inline int sb_any_quota_suspended(struct super_block *sb)
@@ -90,6 +100,31 @@ static inline int sb_any_quota_suspended(struct super_block *sb)
90 sb_has_quota_suspended(sb, GRPQUOTA); 100 sb_has_quota_suspended(sb, GRPQUOTA);
91} 101}
92 102
103/* Does kernel know about any quota information for given sb + type? */
104static inline int sb_has_quota_loaded(struct super_block *sb, int type)
105{
106 /* Currently if anything is on, then quota usage is on as well */
107 return sb_has_quota_usage_enabled(sb, type);
108}
109
110static inline int sb_any_quota_loaded(struct super_block *sb)
111{
112 return sb_has_quota_loaded(sb, USRQUOTA) ||
113 sb_has_quota_loaded(sb, GRPQUOTA);
114}
115
116static inline int sb_has_quota_active(struct super_block *sb, int type)
117{
118 return sb_has_quota_loaded(sb, type) &&
119 !sb_has_quota_suspended(sb, type);
120}
121
122static inline int sb_any_quota_active(struct super_block *sb)
123{
124 return sb_has_quota_active(sb, USRQUOTA) ||
125 sb_has_quota_active(sb, GRPQUOTA);
126}
127
93/* 128/*
94 * Operations supported for diskquotas. 129 * Operations supported for diskquotas.
95 */ 130 */
@@ -104,7 +139,7 @@ extern struct quotactl_ops vfs_quotactl_ops;
104static inline void vfs_dq_init(struct inode *inode) 139static inline void vfs_dq_init(struct inode *inode)
105{ 140{
106 BUG_ON(!inode->i_sb); 141 BUG_ON(!inode->i_sb);
107 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) 142 if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode))
108 inode->i_sb->dq_op->initialize(inode, -1); 143 inode->i_sb->dq_op->initialize(inode, -1);
109} 144}
110 145
@@ -112,7 +147,7 @@ static inline void vfs_dq_init(struct inode *inode)
112 * a transaction (deadlocks possible otherwise) */ 147 * a transaction (deadlocks possible otherwise) */
113static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr) 148static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
114{ 149{
115 if (sb_any_quota_enabled(inode->i_sb)) { 150 if (sb_any_quota_active(inode->i_sb)) {
116 /* Used space is updated in alloc_space() */ 151 /* Used space is updated in alloc_space() */
117 if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA) 152 if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA)
118 return 1; 153 return 1;
@@ -132,7 +167,7 @@ static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr)
132 167
133static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr) 168static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
134{ 169{
135 if (sb_any_quota_enabled(inode->i_sb)) { 170 if (sb_any_quota_active(inode->i_sb)) {
136 /* Used space is updated in alloc_space() */ 171 /* Used space is updated in alloc_space() */
137 if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA) 172 if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA)
138 return 1; 173 return 1;
@@ -152,7 +187,7 @@ static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
152 187
153static inline int vfs_dq_alloc_inode(struct inode *inode) 188static inline int vfs_dq_alloc_inode(struct inode *inode)
154{ 189{
155 if (sb_any_quota_enabled(inode->i_sb)) { 190 if (sb_any_quota_active(inode->i_sb)) {
156 vfs_dq_init(inode); 191 vfs_dq_init(inode);
157 if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) 192 if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA)
158 return 1; 193 return 1;
@@ -162,7 +197,7 @@ static inline int vfs_dq_alloc_inode(struct inode *inode)
162 197
163static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) 198static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
164{ 199{
165 if (sb_any_quota_enabled(inode->i_sb)) 200 if (sb_any_quota_active(inode->i_sb))
166 inode->i_sb->dq_op->free_space(inode, nr); 201 inode->i_sb->dq_op->free_space(inode, nr);
167 else 202 else
168 inode_sub_bytes(inode, nr); 203 inode_sub_bytes(inode, nr);
@@ -176,7 +211,7 @@ static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
176 211
177static inline void vfs_dq_free_inode(struct inode *inode) 212static inline void vfs_dq_free_inode(struct inode *inode)
178{ 213{
179 if (sb_any_quota_enabled(inode->i_sb)) 214 if (sb_any_quota_active(inode->i_sb))
180 inode->i_sb->dq_op->free_inode(inode, 1); 215 inode->i_sb->dq_op->free_inode(inode, 1);
181} 216}
182 217
@@ -197,12 +232,12 @@ static inline int vfs_dq_off(struct super_block *sb, int remount)
197 232
198#else 233#else
199 234
200static inline int sb_has_quota_enabled(struct super_block *sb, int type) 235static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type)
201{ 236{
202 return 0; 237 return 0;
203} 238}
204 239
205static inline int sb_any_quota_enabled(struct super_block *sb) 240static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type)
206{ 241{
207 return 0; 242 return 0;
208} 243}
@@ -217,6 +252,27 @@ static inline int sb_any_quota_suspended(struct super_block *sb)
217 return 0; 252 return 0;
218} 253}
219 254
255/* Does kernel know about any quota information for given sb + type? */
256static inline int sb_has_quota_loaded(struct super_block *sb, int type)
257{
258 return 0;
259}
260
261static inline int sb_any_quota_loaded(struct super_block *sb)
262{
263 return 0;
264}
265
266static inline int sb_has_quota_active(struct super_block *sb, int type)
267{
268 return 0;
269}
270
271static inline int sb_any_quota_active(struct super_block *sb)
272{
273 return 0;
274}
275
220/* 276/*
221 * NO-OP when quota not configured. 277 * NO-OP when quota not configured.
222 */ 278 */
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index a916c6660dfa..355f6e80db0d 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -136,7 +136,7 @@ do { \
136 */ 136 */
137static inline void *radix_tree_deref_slot(void **pslot) 137static inline void *radix_tree_deref_slot(void **pslot)
138{ 138{
139 void *ret = *pslot; 139 void *ret = rcu_dereference(*pslot);
140 if (unlikely(radix_tree_is_indirect_ptr(ret))) 140 if (unlikely(radix_tree_is_indirect_ptr(ret)))
141 ret = RADIX_TREE_RETRY; 141 ret = RADIX_TREE_RETRY;
142 return ret; 142 return ret;
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 8fc909ef6787..9743e4dbc918 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -137,6 +137,9 @@ struct mddev_s
137 struct gendisk *gendisk; 137 struct gendisk *gendisk;
138 138
139 struct kobject kobj; 139 struct kobject kobj;
140 int hold_active;
141#define UNTIL_IOCTL 1
142#define UNTIL_STOP 2
140 143
141 /* Superblock information */ 144 /* Superblock information */
142 int major_version, 145 int major_version,
@@ -215,6 +218,9 @@ struct mddev_s
215#define MD_RECOVERY_FROZEN 9 218#define MD_RECOVERY_FROZEN 9
216 219
217 unsigned long recovery; 220 unsigned long recovery;
221 int recovery_disabled; /* if we detect that recovery
222 * will always fail, set this
223 * so we don't loop trying */
218 224
219 int in_sync; /* know to not need resync */ 225 int in_sync; /* know to not need resync */
220 struct mutex reconfig_mutex; 226 struct mutex reconfig_mutex;
@@ -244,6 +250,9 @@ struct mddev_s
244 struct sysfs_dirent *sysfs_state; /* handle for 'array_state' 250 struct sysfs_dirent *sysfs_state; /* handle for 'array_state'
245 * file in sysfs. 251 * file in sysfs.
246 */ 252 */
253 struct sysfs_dirent *sysfs_action; /* handle for 'sync_action' */
254
255 struct work_struct del_work; /* used for delayed sysfs removal */
247 256
248 spinlock_t write_lock; 257 spinlock_t write_lock;
249 wait_queue_head_t sb_wait; /* for waiting on superblock updates */ 258 wait_queue_head_t sb_wait; /* for waiting on superblock updates */
@@ -334,17 +343,14 @@ static inline char * mdname (mddev_t * mddev)
334 * iterates through some rdev ringlist. It's safe to remove the 343 * iterates through some rdev ringlist. It's safe to remove the
335 * current 'rdev'. Dont touch 'tmp' though. 344 * current 'rdev'. Dont touch 'tmp' though.
336 */ 345 */
337#define rdev_for_each_list(rdev, tmp, list) \ 346#define rdev_for_each_list(rdev, tmp, head) \
338 \ 347 list_for_each_entry_safe(rdev, tmp, head, same_set)
339 for ((tmp) = (list).next; \ 348
340 (rdev) = (list_entry((tmp), mdk_rdev_t, same_set)), \
341 (tmp) = (tmp)->next, (tmp)->prev != &(list) \
342 ; )
343/* 349/*
344 * iterates through the 'same array disks' ringlist 350 * iterates through the 'same array disks' ringlist
345 */ 351 */
346#define rdev_for_each(rdev, tmp, mddev) \ 352#define rdev_for_each(rdev, tmp, mddev) \
347 rdev_for_each_list(rdev, tmp, (mddev)->disks) 353 list_for_each_entry_safe(rdev, tmp, &((mddev)->disks), same_set)
348 354
349#define rdev_for_each_rcu(rdev, mddev) \ 355#define rdev_for_each_rcu(rdev, mddev) \
350 list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set) 356 list_for_each_entry_rcu(rdev, &((mddev)->disks), same_set)
diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h
index 8b4de4a41ff1..9491026afe66 100644
--- a/include/linux/raid/md_p.h
+++ b/include/linux/raid/md_p.h
@@ -194,6 +194,8 @@ static inline __u64 md_event(mdp_super_t *sb) {
194 return (ev<<32)| sb->events_lo; 194 return (ev<<32)| sb->events_lo;
195} 195}
196 196
197#define MD_SUPERBLOCK_1_TIME_SEC_MASK ((1ULL<<40) - 1)
198
197/* 199/*
198 * The version-1 superblock : 200 * The version-1 superblock :
199 * All numeric fields are little-endian. 201 * All numeric fields are little-endian.
diff --git a/include/linux/raid/raid0.h b/include/linux/raid/raid0.h
index 1b2dda035f8e..fd42aa87c391 100644
--- a/include/linux/raid/raid0.h
+++ b/include/linux/raid/raid0.h
@@ -5,9 +5,9 @@
5 5
6struct strip_zone 6struct strip_zone
7{ 7{
8 sector_t zone_offset; /* Zone offset in md_dev */ 8 sector_t zone_start; /* Zone offset in md_dev (in sectors) */
9 sector_t dev_offset; /* Zone offset in real dev */ 9 sector_t dev_start; /* Zone offset in real dev (in sectors) */
10 sector_t size; /* Zone size */ 10 sector_t sectors; /* Zone size in sectors */
11 int nb_dev; /* # of devices attached to the zone */ 11 int nb_dev; /* # of devices attached to the zone */
12 mdk_rdev_t **dev; /* Devices attached to the zone */ 12 mdk_rdev_t **dev; /* Devices attached to the zone */
13}; 13};
@@ -19,8 +19,8 @@ struct raid0_private_data
19 mdk_rdev_t **devlist; /* lists of rdevs, pointed to by strip_zone->dev */ 19 mdk_rdev_t **devlist; /* lists of rdevs, pointed to by strip_zone->dev */
20 int nr_strip_zones; 20 int nr_strip_zones;
21 21
22 sector_t hash_spacing; 22 sector_t spacing;
23 int preshift; /* shift this before divide by hash_spacing */ 23 int sector_shift; /* shift this before divide by spacing */
24}; 24};
25 25
26typedef struct raid0_private_data raid0_conf_t; 26typedef struct raid0_private_data raid0_conf_t;
diff --git a/include/linux/random.h b/include/linux/random.h
index adbf3bd3c6b3..407ea3646f8f 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -45,56 +45,6 @@ struct rand_pool_info {
45 45
46extern void rand_initialize_irq(int irq); 46extern void rand_initialize_irq(int irq);
47 47
48struct timer_rand_state;
49#ifndef CONFIG_SPARSE_IRQ
50
51extern struct timer_rand_state *irq_timer_state[];
52
53static inline struct timer_rand_state *get_timer_rand_state(unsigned int irq)
54{
55 if (irq >= nr_irqs)
56 return NULL;
57
58 return irq_timer_state[irq];
59}
60
61static inline void set_timer_rand_state(unsigned int irq, struct timer_rand_state *state)
62{
63 if (irq >= nr_irqs)
64 return;
65
66 irq_timer_state[irq] = state;
67}
68
69#else
70
71#include <linux/irq.h>
72static inline struct timer_rand_state *get_timer_rand_state(unsigned int irq)
73{
74 struct irq_desc *desc;
75
76 desc = irq_to_desc(irq);
77
78 if (!desc)
79 return NULL;
80
81 return desc->timer_rand_state;
82}
83
84static inline void set_timer_rand_state(unsigned int irq, struct timer_rand_state *state)
85{
86 struct irq_desc *desc;
87
88 desc = irq_to_desc(irq);
89
90 if (!desc)
91 return;
92
93 desc->timer_rand_state = state;
94}
95#endif
96
97
98extern void add_input_randomness(unsigned int type, unsigned int code, 48extern void add_input_randomness(unsigned int type, unsigned int code,
99 unsigned int value); 49 unsigned int value);
100extern void add_interrupt_randomness(int irq); 50extern void add_interrupt_randomness(int irq);
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index 344bc3495ddb..9c295411d01f 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -140,10 +140,10 @@ extern void rb_insert_color(struct rb_node *, struct rb_root *);
140extern void rb_erase(struct rb_node *, struct rb_root *); 140extern void rb_erase(struct rb_node *, struct rb_root *);
141 141
142/* Find logical next and previous nodes in a tree */ 142/* Find logical next and previous nodes in a tree */
143extern struct rb_node *rb_next(struct rb_node *); 143extern struct rb_node *rb_next(const struct rb_node *);
144extern struct rb_node *rb_prev(struct rb_node *); 144extern struct rb_node *rb_prev(const struct rb_node *);
145extern struct rb_node *rb_first(struct rb_root *); 145extern struct rb_node *rb_first(const struct rb_root *);
146extern struct rb_node *rb_last(struct rb_root *); 146extern struct rb_node *rb_last(const struct rb_root *);
147 147
148/* Fast replacement of a single node without remove/rebalance/add/rebalance */ 148/* Fast replacement of a single node without remove/rebalance/add/rebalance */
149extern void rb_replace_node(struct rb_node *victim, struct rb_node *new, 149extern void rb_replace_node(struct rb_node *victim, struct rb_node *new,
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h
index 301dda829e37..f3f697df1d71 100644
--- a/include/linux/rcuclassic.h
+++ b/include/linux/rcuclassic.h
@@ -59,8 +59,8 @@ struct rcu_ctrlblk {
59 int signaled; 59 int signaled;
60 60
61 spinlock_t lock ____cacheline_internodealigned_in_smp; 61 spinlock_t lock ____cacheline_internodealigned_in_smp;
62 cpumask_t cpumask; /* CPUs that need to switch in order */ 62 DECLARE_BITMAP(cpumask, NR_CPUS); /* CPUs that need to switch for */
63 /* for current batch to proceed. */ 63 /* current batch to proceed. */
64} ____cacheline_internodealigned_in_smp; 64} ____cacheline_internodealigned_in_smp;
65 65
66/* Is batch a before batch b ? */ 66/* Is batch a before batch b ? */
diff --git a/include/linux/rculist_nulls.h b/include/linux/rculist_nulls.h
new file mode 100644
index 000000000000..f9ddd03961a8
--- /dev/null
+++ b/include/linux/rculist_nulls.h
@@ -0,0 +1,110 @@
1#ifndef _LINUX_RCULIST_NULLS_H
2#define _LINUX_RCULIST_NULLS_H
3
4#ifdef __KERNEL__
5
6/*
7 * RCU-protected list version
8 */
9#include <linux/list_nulls.h>
10#include <linux/rcupdate.h>
11
12/**
13 * hlist_nulls_del_init_rcu - deletes entry from hash list with re-initialization
14 * @n: the element to delete from the hash list.
15 *
16 * Note: hlist_nulls_unhashed() on the node return true after this. It is
17 * useful for RCU based read lockfree traversal if the writer side
18 * must know if the list entry is still hashed or already unhashed.
19 *
20 * In particular, it means that we can not poison the forward pointers
21 * that may still be used for walking the hash list and we can only
22 * zero the pprev pointer so list_unhashed() will return true after
23 * this.
24 *
25 * The caller must take whatever precautions are necessary (such as
26 * holding appropriate locks) to avoid racing with another
27 * list-mutation primitive, such as hlist_nulls_add_head_rcu() or
28 * hlist_nulls_del_rcu(), running on this same list. However, it is
29 * perfectly legal to run concurrently with the _rcu list-traversal
30 * primitives, such as hlist_nulls_for_each_entry_rcu().
31 */
32static inline void hlist_nulls_del_init_rcu(struct hlist_nulls_node *n)
33{
34 if (!hlist_nulls_unhashed(n)) {
35 __hlist_nulls_del(n);
36 n->pprev = NULL;
37 }
38}
39
40/**
41 * hlist_nulls_del_rcu - deletes entry from hash list without re-initialization
42 * @n: the element to delete from the hash list.
43 *
44 * Note: hlist_nulls_unhashed() on entry does not return true after this,
45 * the entry is in an undefined state. It is useful for RCU based
46 * lockfree traversal.
47 *
48 * In particular, it means that we can not poison the forward
49 * pointers that may still be used for walking the hash list.
50 *
51 * The caller must take whatever precautions are necessary
52 * (such as holding appropriate locks) to avoid racing
53 * with another list-mutation primitive, such as hlist_nulls_add_head_rcu()
54 * or hlist_nulls_del_rcu(), running on this same list.
55 * However, it is perfectly legal to run concurrently with
56 * the _rcu list-traversal primitives, such as
57 * hlist_nulls_for_each_entry().
58 */
59static inline void hlist_nulls_del_rcu(struct hlist_nulls_node *n)
60{
61 __hlist_nulls_del(n);
62 n->pprev = LIST_POISON2;
63}
64
65/**
66 * hlist_nulls_add_head_rcu
67 * @n: the element to add to the hash list.
68 * @h: the list to add to.
69 *
70 * Description:
71 * Adds the specified element to the specified hlist_nulls,
72 * while permitting racing traversals.
73 *
74 * The caller must take whatever precautions are necessary
75 * (such as holding appropriate locks) to avoid racing
76 * with another list-mutation primitive, such as hlist_nulls_add_head_rcu()
77 * or hlist_nulls_del_rcu(), running on this same list.
78 * However, it is perfectly legal to run concurrently with
79 * the _rcu list-traversal primitives, such as
80 * hlist_nulls_for_each_entry_rcu(), used to prevent memory-consistency
81 * problems on Alpha CPUs. Regardless of the type of CPU, the
82 * list-traversal primitive must be guarded by rcu_read_lock().
83 */
84static inline void hlist_nulls_add_head_rcu(struct hlist_nulls_node *n,
85 struct hlist_nulls_head *h)
86{
87 struct hlist_nulls_node *first = h->first;
88
89 n->next = first;
90 n->pprev = &h->first;
91 rcu_assign_pointer(h->first, n);
92 if (!is_a_nulls(first))
93 first->pprev = &n->next;
94}
95/**
96 * hlist_nulls_for_each_entry_rcu - iterate over rcu list of given type
97 * @tpos: the type * to use as a loop cursor.
98 * @pos: the &struct hlist_nulls_node to use as a loop cursor.
99 * @head: the head for your list.
100 * @member: the name of the hlist_nulls_node within the struct.
101 *
102 */
103#define hlist_nulls_for_each_entry_rcu(tpos, pos, head, member) \
104 for (pos = rcu_dereference((head)->first); \
105 (!is_a_nulls(pos)) && \
106 ({ tpos = hlist_nulls_entry(pos, typeof(*tpos), member); 1; }); \
107 pos = rcu_dereference(pos->next))
108
109#endif
110#endif
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 895dc9c1088c..921340a7b71c 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -52,11 +52,15 @@ struct rcu_head {
52 void (*func)(struct rcu_head *head); 52 void (*func)(struct rcu_head *head);
53}; 53};
54 54
55#ifdef CONFIG_CLASSIC_RCU 55#if defined(CONFIG_CLASSIC_RCU)
56#include <linux/rcuclassic.h> 56#include <linux/rcuclassic.h>
57#else /* #ifdef CONFIG_CLASSIC_RCU */ 57#elif defined(CONFIG_TREE_RCU)
58#include <linux/rcutree.h>
59#elif defined(CONFIG_PREEMPT_RCU)
58#include <linux/rcupreempt.h> 60#include <linux/rcupreempt.h>
59#endif /* #else #ifdef CONFIG_CLASSIC_RCU */ 61#else
62#error "Unknown RCU implementation specified to kernel configuration"
63#endif /* #else #if defined(CONFIG_CLASSIC_RCU) */
60 64
61#define RCU_HEAD_INIT { .next = NULL, .func = NULL } 65#define RCU_HEAD_INIT { .next = NULL, .func = NULL }
62#define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT 66#define RCU_HEAD(head) struct rcu_head head = RCU_HEAD_INIT
@@ -200,18 +204,6 @@ struct rcu_synchronize {
200 204
201extern void wakeme_after_rcu(struct rcu_head *head); 205extern void wakeme_after_rcu(struct rcu_head *head);
202 206
203#define synchronize_rcu_xxx(name, func) \
204void name(void) \
205{ \
206 struct rcu_synchronize rcu; \
207 \
208 init_completion(&rcu.completion); \
209 /* Will wake me after RCU finished. */ \
210 func(&rcu.head, wakeme_after_rcu); \
211 /* Wait for it. */ \
212 wait_for_completion(&rcu.completion); \
213}
214
215/** 207/**
216 * synchronize_sched - block until all CPUs have exited any non-preemptive 208 * synchronize_sched - block until all CPUs have exited any non-preemptive
217 * kernel code sequences. 209 * kernel code sequences.
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
new file mode 100644
index 000000000000..d4368b7975c3
--- /dev/null
+++ b/include/linux/rcutree.h
@@ -0,0 +1,329 @@
1/*
2 * Read-Copy Update mechanism for mutual exclusion (tree-based 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, 2008
19 *
20 * Author: Dipankar Sarma <dipankar@in.ibm.com>
21 * Paul E. McKenney <paulmck@linux.vnet.ibm.com> Hierarchical algorithm
22 *
23 * Based on the original work by Paul McKenney <paulmck@us.ibm.com>
24 * and inputs from Rusty Russell, Andrea Arcangeli and Andi Kleen.
25 *
26 * For detailed explanation of Read-Copy Update mechanism see -
27 * Documentation/RCU
28 */
29
30#ifndef __LINUX_RCUTREE_H
31#define __LINUX_RCUTREE_H
32
33#include <linux/cache.h>
34#include <linux/spinlock.h>
35#include <linux/threads.h>
36#include <linux/percpu.h>
37#include <linux/cpumask.h>
38#include <linux/seqlock.h>
39
40/*
41 * Define shape of hierarchy based on NR_CPUS and CONFIG_RCU_FANOUT.
42 * In theory, it should be possible to add more levels straightforwardly.
43 * In practice, this has not been tested, so there is probably some
44 * bug somewhere.
45 */
46#define MAX_RCU_LVLS 3
47#define RCU_FANOUT (CONFIG_RCU_FANOUT)
48#define RCU_FANOUT_SQ (RCU_FANOUT * RCU_FANOUT)
49#define RCU_FANOUT_CUBE (RCU_FANOUT_SQ * RCU_FANOUT)
50
51#if NR_CPUS <= RCU_FANOUT
52# define NUM_RCU_LVLS 1
53# define NUM_RCU_LVL_0 1
54# define NUM_RCU_LVL_1 (NR_CPUS)
55# define NUM_RCU_LVL_2 0
56# define NUM_RCU_LVL_3 0
57#elif NR_CPUS <= RCU_FANOUT_SQ
58# define NUM_RCU_LVLS 2
59# define NUM_RCU_LVL_0 1
60# define NUM_RCU_LVL_1 (((NR_CPUS) + RCU_FANOUT - 1) / RCU_FANOUT)
61# define NUM_RCU_LVL_2 (NR_CPUS)
62# define NUM_RCU_LVL_3 0
63#elif NR_CPUS <= RCU_FANOUT_CUBE
64# define NUM_RCU_LVLS 3
65# define NUM_RCU_LVL_0 1
66# define NUM_RCU_LVL_1 (((NR_CPUS) + RCU_FANOUT_SQ - 1) / RCU_FANOUT_SQ)
67# define NUM_RCU_LVL_2 (((NR_CPUS) + (RCU_FANOUT) - 1) / (RCU_FANOUT))
68# define NUM_RCU_LVL_3 NR_CPUS
69#else
70# error "CONFIG_RCU_FANOUT insufficient for NR_CPUS"
71#endif /* #if (NR_CPUS) <= RCU_FANOUT */
72
73#define RCU_SUM (NUM_RCU_LVL_0 + NUM_RCU_LVL_1 + NUM_RCU_LVL_2 + NUM_RCU_LVL_3)
74#define NUM_RCU_NODES (RCU_SUM - NR_CPUS)
75
76/*
77 * Dynticks per-CPU state.
78 */
79struct rcu_dynticks {
80 int dynticks_nesting; /* Track nesting level, sort of. */
81 int dynticks; /* Even value for dynticks-idle, else odd. */
82 int dynticks_nmi; /* Even value for either dynticks-idle or */
83 /* not in nmi handler, else odd. So this */
84 /* remains even for nmi from irq handler. */
85};
86
87/*
88 * Definition for node within the RCU grace-period-detection hierarchy.
89 */
90struct rcu_node {
91 spinlock_t lock;
92 unsigned long qsmask; /* CPUs or groups that need to switch in */
93 /* order for current grace period to proceed.*/
94 unsigned long qsmaskinit;
95 /* Per-GP initialization for qsmask. */
96 unsigned long grpmask; /* Mask to apply to parent qsmask. */
97 int grplo; /* lowest-numbered CPU or group here. */
98 int grphi; /* highest-numbered CPU or group here. */
99 u8 grpnum; /* CPU/group number for next level up. */
100 u8 level; /* root is at level 0. */
101 struct rcu_node *parent;
102} ____cacheline_internodealigned_in_smp;
103
104/* Index values for nxttail array in struct rcu_data. */
105#define RCU_DONE_TAIL 0 /* Also RCU_WAIT head. */
106#define RCU_WAIT_TAIL 1 /* Also RCU_NEXT_READY head. */
107#define RCU_NEXT_READY_TAIL 2 /* Also RCU_NEXT head. */
108#define RCU_NEXT_TAIL 3
109#define RCU_NEXT_SIZE 4
110
111/* Per-CPU data for read-copy update. */
112struct rcu_data {
113 /* 1) quiescent-state and grace-period handling : */
114 long completed; /* Track rsp->completed gp number */
115 /* in order to detect GP end. */
116 long gpnum; /* Highest gp number that this CPU */
117 /* is aware of having started. */
118 long passed_quiesc_completed;
119 /* Value of completed at time of qs. */
120 bool passed_quiesc; /* User-mode/idle loop etc. */
121 bool qs_pending; /* Core waits for quiesc state. */
122 bool beenonline; /* CPU online at least once. */
123 struct rcu_node *mynode; /* This CPU's leaf of hierarchy */
124 unsigned long grpmask; /* Mask to apply to leaf qsmask. */
125
126 /* 2) batch handling */
127 /*
128 * If nxtlist is not NULL, it is partitioned as follows.
129 * Any of the partitions might be empty, in which case the
130 * pointer to that partition will be equal to the pointer for
131 * the following partition. When the list is empty, all of
132 * the nxttail elements point to nxtlist, which is NULL.
133 *
134 * [*nxttail[RCU_NEXT_READY_TAIL], NULL = *nxttail[RCU_NEXT_TAIL]):
135 * Entries that might have arrived after current GP ended
136 * [*nxttail[RCU_WAIT_TAIL], *nxttail[RCU_NEXT_READY_TAIL]):
137 * Entries known to have arrived before current GP ended
138 * [*nxttail[RCU_DONE_TAIL], *nxttail[RCU_WAIT_TAIL]):
139 * Entries that batch # <= ->completed - 1: waiting for current GP
140 * [nxtlist, *nxttail[RCU_DONE_TAIL]):
141 * Entries that batch # <= ->completed
142 * The grace period for these entries has completed, and
143 * the other grace-period-completed entries may be moved
144 * here temporarily in rcu_process_callbacks().
145 */
146 struct rcu_head *nxtlist;
147 struct rcu_head **nxttail[RCU_NEXT_SIZE];
148 long qlen; /* # of queued callbacks */
149 long blimit; /* Upper limit on a processed batch */
150
151#ifdef CONFIG_NO_HZ
152 /* 3) dynticks interface. */
153 struct rcu_dynticks *dynticks; /* Shared per-CPU dynticks state. */
154 int dynticks_snap; /* Per-GP tracking for dynticks. */
155 int dynticks_nmi_snap; /* Per-GP tracking for dynticks_nmi. */
156#endif /* #ifdef CONFIG_NO_HZ */
157
158 /* 4) reasons this CPU needed to be kicked by force_quiescent_state */
159#ifdef CONFIG_NO_HZ
160 unsigned long dynticks_fqs; /* Kicked due to dynticks idle. */
161#endif /* #ifdef CONFIG_NO_HZ */
162 unsigned long offline_fqs; /* Kicked due to being offline. */
163 unsigned long resched_ipi; /* Sent a resched IPI. */
164
165 /* 5) state to allow this CPU to force_quiescent_state on others */
166 long n_rcu_pending; /* rcu_pending() calls since boot. */
167 long n_rcu_pending_force_qs; /* when to force quiescent states. */
168
169 int cpu;
170};
171
172/* Values for signaled field in struct rcu_state. */
173#define RCU_GP_INIT 0 /* Grace period being initialized. */
174#define RCU_SAVE_DYNTICK 1 /* Need to scan dyntick state. */
175#define RCU_FORCE_QS 2 /* Need to force quiescent state. */
176#ifdef CONFIG_NO_HZ
177#define RCU_SIGNAL_INIT RCU_SAVE_DYNTICK
178#else /* #ifdef CONFIG_NO_HZ */
179#define RCU_SIGNAL_INIT RCU_FORCE_QS
180#endif /* #else #ifdef CONFIG_NO_HZ */
181
182#define RCU_JIFFIES_TILL_FORCE_QS 3 /* for rsp->jiffies_force_qs */
183#ifdef CONFIG_RCU_CPU_STALL_DETECTOR
184#define RCU_SECONDS_TILL_STALL_CHECK (10 * HZ) /* for rsp->jiffies_stall */
185#define RCU_SECONDS_TILL_STALL_RECHECK (30 * HZ) /* for rsp->jiffies_stall */
186#define RCU_STALL_RAT_DELAY 2 /* Allow other CPUs time */
187 /* to take at least one */
188 /* scheduling clock irq */
189 /* before ratting on them. */
190
191#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
192
193/*
194 * RCU global state, including node hierarchy. This hierarchy is
195 * represented in "heap" form in a dense array. The root (first level)
196 * of the hierarchy is in ->node[0] (referenced by ->level[0]), the second
197 * level in ->node[1] through ->node[m] (->node[1] referenced by ->level[1]),
198 * and the third level in ->node[m+1] and following (->node[m+1] referenced
199 * by ->level[2]). The number of levels is determined by the number of
200 * CPUs and by CONFIG_RCU_FANOUT. Small systems will have a "hierarchy"
201 * consisting of a single rcu_node.
202 */
203struct rcu_state {
204 struct rcu_node node[NUM_RCU_NODES]; /* Hierarchy. */
205 struct rcu_node *level[NUM_RCU_LVLS]; /* Hierarchy levels. */
206 u32 levelcnt[MAX_RCU_LVLS + 1]; /* # nodes in each level. */
207 u8 levelspread[NUM_RCU_LVLS]; /* kids/node in each level. */
208 struct rcu_data *rda[NR_CPUS]; /* array of rdp pointers. */
209
210 /* The following fields are guarded by the root rcu_node's lock. */
211
212 u8 signaled ____cacheline_internodealigned_in_smp;
213 /* Force QS state. */
214 long gpnum; /* Current gp number. */
215 long completed; /* # of last completed gp. */
216 spinlock_t onofflock; /* exclude on/offline and */
217 /* starting new GP. */
218 spinlock_t fqslock; /* Only one task forcing */
219 /* quiescent states. */
220 unsigned long jiffies_force_qs; /* Time at which to invoke */
221 /* force_quiescent_state(). */
222 unsigned long n_force_qs; /* Number of calls to */
223 /* force_quiescent_state(). */
224 unsigned long n_force_qs_lh; /* ~Number of calls leaving */
225 /* due to lock unavailable. */
226 unsigned long n_force_qs_ngp; /* Number of calls leaving */
227 /* due to no GP active. */
228#ifdef CONFIG_RCU_CPU_STALL_DETECTOR
229 unsigned long gp_start; /* Time at which GP started, */
230 /* but in jiffies. */
231 unsigned long jiffies_stall; /* Time at which to check */
232 /* for CPU stalls. */
233#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
234#ifdef CONFIG_NO_HZ
235 long dynticks_completed; /* Value of completed @ snap. */
236#endif /* #ifdef CONFIG_NO_HZ */
237};
238
239extern struct rcu_state rcu_state;
240DECLARE_PER_CPU(struct rcu_data, rcu_data);
241
242extern struct rcu_state rcu_bh_state;
243DECLARE_PER_CPU(struct rcu_data, rcu_bh_data);
244
245/*
246 * Increment the quiescent state counter.
247 * The counter is a bit degenerated: We do not need to know
248 * how many quiescent states passed, just if there was at least
249 * one since the start of the grace period. Thus just a flag.
250 */
251static inline void rcu_qsctr_inc(int cpu)
252{
253 struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
254 rdp->passed_quiesc = 1;
255 rdp->passed_quiesc_completed = rdp->completed;
256}
257static inline void rcu_bh_qsctr_inc(int cpu)
258{
259 struct rcu_data *rdp = &per_cpu(rcu_bh_data, cpu);
260 rdp->passed_quiesc = 1;
261 rdp->passed_quiesc_completed = rdp->completed;
262}
263
264extern int rcu_pending(int cpu);
265extern int rcu_needs_cpu(int cpu);
266
267#ifdef CONFIG_DEBUG_LOCK_ALLOC
268extern struct lockdep_map rcu_lock_map;
269# define rcu_read_acquire() \
270 lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_)
271# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_)
272#else
273# define rcu_read_acquire() do { } while (0)
274# define rcu_read_release() do { } while (0)
275#endif
276
277static inline void __rcu_read_lock(void)
278{
279 preempt_disable();
280 __acquire(RCU);
281 rcu_read_acquire();
282}
283static inline void __rcu_read_unlock(void)
284{
285 rcu_read_release();
286 __release(RCU);
287 preempt_enable();
288}
289static inline void __rcu_read_lock_bh(void)
290{
291 local_bh_disable();
292 __acquire(RCU_BH);
293 rcu_read_acquire();
294}
295static inline void __rcu_read_unlock_bh(void)
296{
297 rcu_read_release();
298 __release(RCU_BH);
299 local_bh_enable();
300}
301
302#define __synchronize_sched() synchronize_rcu()
303
304#define call_rcu_sched(head, func) call_rcu(head, func)
305
306static inline void rcu_init_sched(void)
307{
308}
309
310extern void __rcu_init(void);
311extern void rcu_check_callbacks(int cpu, int user);
312extern void rcu_restart_cpu(int cpu);
313
314extern long rcu_batches_completed(void);
315extern long rcu_batches_completed_bh(void);
316
317#ifdef CONFIG_NO_HZ
318void rcu_enter_nohz(void);
319void rcu_exit_nohz(void);
320#else /* CONFIG_NO_HZ */
321static inline void rcu_enter_nohz(void)
322{
323}
324static inline void rcu_exit_nohz(void)
325{
326}
327#endif /* CONFIG_NO_HZ */
328
329#endif /* __LINUX_RCUTREE_H */
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index afdc4558bb94..801bf77ff4e2 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -104,10 +104,10 @@ struct regulator;
104/** 104/**
105 * struct regulator_bulk_data - Data used for bulk regulator operations. 105 * struct regulator_bulk_data - Data used for bulk regulator operations.
106 * 106 *
107 * @supply The name of the supply. Initialised by the user before 107 * @supply: The name of the supply. Initialised by the user before
108 * using the bulk regulator APIs. 108 * using the bulk regulator APIs.
109 * @consumer The regulator consumer for the supply. This will be managed 109 * @consumer: The regulator consumer for the supply. This will be managed
110 * by the bulk API. 110 * by the bulk API.
111 * 111 *
112 * The regulator APIs provide a series of regulator_bulk_() API calls as 112 * The regulator APIs provide a series of regulator_bulk_() API calls as
113 * a convenience to consumers which require multiple supplies. This 113 * a convenience to consumers which require multiple supplies. This
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index e37d80561985..2dae05705f13 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -24,7 +24,33 @@ struct regulator_init_data;
24/** 24/**
25 * struct regulator_ops - regulator operations. 25 * struct regulator_ops - regulator operations.
26 * 26 *
27 * This struct describes regulator operations. 27 * This struct describes regulator operations which can be implemented by
28 * regulator chip drivers.
29 *
30 * @enable: Enable the regulator.
31 * @disable: Disable the regulator.
32 * @is_enabled: Return 1 if the regulator is enabled, 0 otherwise.
33 *
34 * @set_voltage: Set the voltage for the regulator within the range specified.
35 * The driver should select the voltage closest to min_uV.
36 * @get_voltage: Return the currently configured voltage for the regulator.
37 *
38 * @set_current_limit: Configure a limit for a current-limited regulator.
39 * @get_current_limit: Get the limit for a current-limited regulator.
40 *
41 * @set_mode: Set the operating mode for the regulator.
42 * @get_mode: Get the current operating mode for the regulator.
43 * @get_optimum_mode: Get the most efficient operating mode for the regulator
44 * when running with the specified parameters.
45 *
46 * @set_suspend_voltage: Set the voltage for the regulator when the system
47 * is suspended.
48 * @set_suspend_enable: Mark the regulator as enabled when the system is
49 * suspended.
50 * @set_suspend_disable: Mark the regulator as disabled when the system is
51 * suspended.
52 * @set_suspend_mode: Set the operating mode for the regulator when the
53 * system is suspended.
28 */ 54 */
29struct regulator_ops { 55struct regulator_ops {
30 56
@@ -75,6 +101,15 @@ enum regulator_type {
75/** 101/**
76 * struct regulator_desc - Regulator descriptor 102 * struct regulator_desc - Regulator descriptor
77 * 103 *
104 * Each regulator registered with the core is described with a structure of
105 * this type.
106 *
107 * @name: Identifying name for the regulator.
108 * @id: Numerical identifier for the regulator.
109 * @ops: Regulator operations table.
110 * @irq: Interrupt number for the regulator.
111 * @type: Indicates if the regulator is a voltage or current regulator.
112 * @owner: Module providing the regulator, used for refcounting.
78 */ 113 */
79struct regulator_desc { 114struct regulator_desc {
80 const char *name; 115 const char *name;
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index c6d69331a81e..3794773b23d2 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -44,6 +44,10 @@ struct regulator;
44 * struct regulator_state - regulator state during low power syatem states 44 * struct regulator_state - regulator state during low power syatem states
45 * 45 *
46 * This describes a regulators state during a system wide low power state. 46 * This describes a regulators state during a system wide low power state.
47 *
48 * @uV: Operating voltage during suspend.
49 * @mode: Operating mode during suspend.
50 * @enabled: Enabled during suspend.
47 */ 51 */
48struct regulator_state { 52struct regulator_state {
49 int uV; /* suspend voltage */ 53 int uV; /* suspend voltage */
@@ -55,6 +59,30 @@ struct regulator_state {
55 * struct regulation_constraints - regulator operating constraints. 59 * struct regulation_constraints - regulator operating constraints.
56 * 60 *
57 * This struct describes regulator and board/machine specific constraints. 61 * This struct describes regulator and board/machine specific constraints.
62 *
63 * @name: Descriptive name for the constraints, used for display purposes.
64 *
65 * @min_uV: Smallest voltage consumers may set.
66 * @max_uV: Largest voltage consumers may set.
67 *
68 * @min_uA: Smallest consumers consumers may set.
69 * @max_uA: Largest current consumers may set.
70 *
71 * @valid_modes_mask: Mask of modes which may be configured by consumers.
72 * @valid_ops_mask: Operations which may be performed by consumers.
73 *
74 * @always_on: Set if the regulator should never be disabled.
75 * @boot_on: Set if the regulator is enabled when the system is initially
76 * started.
77 * @apply_uV: Apply the voltage constraint when initialising.
78 *
79 * @input_uV: Input voltage for regulator when supplied by another regulator.
80 *
81 * @state_disk: State for regulator when system is suspended in disk mode.
82 * @state_mem: State for regulator when system is suspended in mem mode.
83 * @state_standby: State for regulator when system is suspended in standby
84 * mode.
85 * @initial_state: Suspend state to set by default.
58 */ 86 */
59struct regulation_constraints { 87struct regulation_constraints {
60 88
@@ -93,6 +121,9 @@ struct regulation_constraints {
93 * struct regulator_consumer_supply - supply -> device mapping 121 * struct regulator_consumer_supply - supply -> device mapping
94 * 122 *
95 * This maps a supply name to a device. 123 * This maps a supply name to a device.
124 *
125 * @dev: Device structure for the consumer.
126 * @supply: Name for the supply.
96 */ 127 */
97struct regulator_consumer_supply { 128struct regulator_consumer_supply {
98 struct device *dev; /* consumer */ 129 struct device *dev; /* consumer */
@@ -103,6 +134,16 @@ struct regulator_consumer_supply {
103 * struct regulator_init_data - regulator platform initialisation data. 134 * struct regulator_init_data - regulator platform initialisation data.
104 * 135 *
105 * Initialisation constraints, our supply and consumers supplies. 136 * Initialisation constraints, our supply and consumers supplies.
137 *
138 * @supply_regulator_dev: Parent regulator (if any).
139 *
140 * @constraints: Constraints. These must be specified for the regulator to
141 * be usable.
142 * @num_consumer_supplies: Number of consumer device supplies.
143 * @consumer_supplies: Consumer device supply configuration.
144 *
145 * @regulator_init: Callback invoked when the regulator has been registered.
146 * @driver_data: Data passed to regulator_init.
106 */ 147 */
107struct regulator_init_data { 148struct regulator_init_data {
108 struct device *supply_regulator_dev; /* or NULL for LINE */ 149 struct device *supply_regulator_dev; /* or NULL for LINE */
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 271c1c2c9f6f..dede0a2cfc45 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -43,6 +43,10 @@ struct res_counter {
43 * the routines below consider this to be IRQ-safe 43 * the routines below consider this to be IRQ-safe
44 */ 44 */
45 spinlock_t lock; 45 spinlock_t lock;
46 /*
47 * Parent counter, used for hierarchial resource accounting
48 */
49 struct res_counter *parent;
46}; 50};
47 51
48/** 52/**
@@ -87,7 +91,7 @@ enum {
87 * helpers for accounting 91 * helpers for accounting
88 */ 92 */
89 93
90void res_counter_init(struct res_counter *counter); 94void res_counter_init(struct res_counter *counter, struct res_counter *parent);
91 95
92/* 96/*
93 * charge - try to consume more resource. 97 * charge - try to consume more resource.
@@ -103,7 +107,7 @@ void res_counter_init(struct res_counter *counter);
103int __must_check res_counter_charge_locked(struct res_counter *counter, 107int __must_check res_counter_charge_locked(struct res_counter *counter,
104 unsigned long val); 108 unsigned long val);
105int __must_check res_counter_charge(struct res_counter *counter, 109int __must_check res_counter_charge(struct res_counter *counter,
106 unsigned long val); 110 unsigned long val, struct res_counter **limit_fail_at);
107 111
108/* 112/*
109 * uncharge - tell that some portion of the resource is released 113 * uncharge - tell that some portion of the resource is released
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 4cd64b0d9825..164332cbb77c 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -108,6 +108,7 @@ struct rfkill {
108 108
109 struct device dev; 109 struct device dev;
110 struct list_head node; 110 struct list_head node;
111 enum rfkill_state state_for_resume;
111}; 112};
112#define to_rfkill(d) container_of(d, struct rfkill, dev) 113#define to_rfkill(d) container_of(d, struct rfkill, dev)
113 114
@@ -148,11 +149,4 @@ static inline char *rfkill_get_led_name(struct rfkill *rfkill)
148#endif 149#endif
149} 150}
150 151
151/* rfkill notification chain */
152#define RFKILL_STATE_CHANGED 0x0001 /* state of a normal rfkill
153 switch has changed */
154
155int register_rfkill_notifier(struct notifier_block *nb);
156int unregister_rfkill_notifier(struct notifier_block *nb);
157
158#endif /* RFKILL_H */ 152#endif /* RFKILL_H */
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index d363467c8f13..b3b359660082 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -118,6 +118,8 @@ void ring_buffer_record_enable_cpu(struct ring_buffer *buffer, int cpu);
118 118
119unsigned long ring_buffer_entries(struct ring_buffer *buffer); 119unsigned long ring_buffer_entries(struct ring_buffer *buffer);
120unsigned long ring_buffer_overruns(struct ring_buffer *buffer); 120unsigned long ring_buffer_overruns(struct ring_buffer *buffer);
121unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu);
122unsigned long ring_buffer_overrun_cpu(struct ring_buffer *buffer, int cpu);
121 123
122u64 ring_buffer_time_stamp(int cpu); 124u64 ring_buffer_time_stamp(int cpu);
123void ring_buffer_normalize_time_stamp(int cpu, u64 *ts); 125void ring_buffer_normalize_time_stamp(int cpu, u64 *ts);
diff --git a/include/linux/rio_drv.h b/include/linux/rio_drv.h
index 90987b7bcc1b..c93a58a40033 100644
--- a/include/linux/rio_drv.h
+++ b/include/linux/rio_drv.h
@@ -391,7 +391,6 @@ static inline int rio_add_inb_buffer(struct rio_mport *mport, int mbox,
391 * rio_get_inb_message - Get A RIO message from an inbound mailbox queue 391 * rio_get_inb_message - Get A RIO message from an inbound mailbox queue
392 * @mport: Master port containing the inbound mailbox 392 * @mport: Master port containing the inbound mailbox
393 * @mbox: The inbound mailbox number 393 * @mbox: The inbound mailbox number
394 * @buffer: Pointer to the message buffer
395 * 394 *
396 * Get a RIO message from an inbound mailbox queue. Returns 0 on success. 395 * Get a RIO message from an inbound mailbox queue. Returns 0 on success.
397 */ 396 */
@@ -427,9 +426,9 @@ void rio_dev_put(struct rio_dev *);
427 * Get the unique RIO device identifier. Returns the device 426 * Get the unique RIO device identifier. Returns the device
428 * identifier string. 427 * identifier string.
429 */ 428 */
430static inline char *rio_name(struct rio_dev *rdev) 429static inline const char *rio_name(struct rio_dev *rdev)
431{ 430{
432 return rdev->dev.bus_id; 431 return dev_name(&rdev->dev);
433} 432}
434 433
435/** 434/**
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 89f0564b10c8..b35bc0e19cd9 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -63,16 +63,13 @@ void anon_vma_unlink(struct vm_area_struct *);
63void anon_vma_link(struct vm_area_struct *); 63void anon_vma_link(struct vm_area_struct *);
64void __anon_vma_link(struct vm_area_struct *); 64void __anon_vma_link(struct vm_area_struct *);
65 65
66extern struct anon_vma *page_lock_anon_vma(struct page *page);
67extern void page_unlock_anon_vma(struct anon_vma *anon_vma);
68
69/* 66/*
70 * rmap interfaces called when adding or removing pte of page 67 * rmap interfaces called when adding or removing pte of page
71 */ 68 */
72void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 69void page_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
73void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned long); 70void page_add_new_anon_rmap(struct page *, struct vm_area_struct *, unsigned long);
74void page_add_file_rmap(struct page *); 71void page_add_file_rmap(struct page *);
75void page_remove_rmap(struct page *, struct vm_area_struct *); 72void page_remove_rmap(struct page *);
76 73
77#ifdef CONFIG_DEBUG_VM 74#ifdef CONFIG_DEBUG_VM
78void page_dup_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address); 75void page_dup_rmap(struct page *page, struct vm_area_struct *vma, unsigned long address);
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 91f597ad6acc..4046b75563c1 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -145,6 +145,8 @@ struct rtc_class_ops {
145 int (*irq_set_state)(struct device *, int enabled); 145 int (*irq_set_state)(struct device *, int enabled);
146 int (*irq_set_freq)(struct device *, int freq); 146 int (*irq_set_freq)(struct device *, int freq);
147 int (*read_callback)(struct device *, int data); 147 int (*read_callback)(struct device *, int data);
148 int (*alarm_irq_enable)(struct device *, unsigned int enabled);
149 int (*update_irq_enable)(struct device *, unsigned int enabled);
148}; 150};
149 151
150#define RTC_DEVICE_NAME_SIZE 20 152#define RTC_DEVICE_NAME_SIZE 20
@@ -181,7 +183,7 @@ struct rtc_device
181 struct timer_list uie_timer; 183 struct timer_list uie_timer;
182 /* Those fields are protected by rtc->irq_lock */ 184 /* Those fields are protected by rtc->irq_lock */
183 unsigned int oldsecs; 185 unsigned int oldsecs;
184 unsigned int irq_active:1; 186 unsigned int uie_irq_active:1;
185 unsigned int stop_uie_polling:1; 187 unsigned int stop_uie_polling:1;
186 unsigned int uie_task_active:1; 188 unsigned int uie_task_active:1;
187 unsigned int uie_timer_active:1; 189 unsigned int uie_timer_active:1;
@@ -216,6 +218,10 @@ extern int rtc_irq_set_state(struct rtc_device *rtc,
216 struct rtc_task *task, int enabled); 218 struct rtc_task *task, int enabled);
217extern int rtc_irq_set_freq(struct rtc_device *rtc, 219extern int rtc_irq_set_freq(struct rtc_device *rtc,
218 struct rtc_task *task, int freq); 220 struct rtc_task *task, int freq);
221extern int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled);
222extern int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled);
223extern int rtc_dev_update_irq_enable_emul(struct rtc_device *rtc,
224 unsigned int enabled);
219 225
220typedef struct rtc_task { 226typedef struct rtc_task {
221 void (*func)(void *private_data); 227 void (*func)(void *private_data);
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 2b3d51c6ec9c..e88f7058b3a1 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -107,6 +107,11 @@ enum {
107 RTM_GETADDRLABEL, 107 RTM_GETADDRLABEL,
108#define RTM_GETADDRLABEL RTM_GETADDRLABEL 108#define RTM_GETADDRLABEL RTM_GETADDRLABEL
109 109
110 RTM_GETDCB = 78,
111#define RTM_GETDCB RTM_GETDCB
112 RTM_SETDCB,
113#define RTM_SETDCB RTM_SETDCB
114
110 __RTM_MAX, 115 __RTM_MAX,
111#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) 116#define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1)
112}; 117};
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 440cabb2d432..c37c5141037b 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -284,7 +284,6 @@ long io_schedule_timeout(long timeout);
284 284
285extern void cpu_init (void); 285extern void cpu_init (void);
286extern void trap_init(void); 286extern void trap_init(void);
287extern void account_process_tick(struct task_struct *task, int user);
288extern void update_process_times(int user); 287extern void update_process_times(int user);
289extern void scheduler_tick(void); 288extern void scheduler_tick(void);
290 289
@@ -387,6 +386,9 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
387 (mm)->hiwater_vm = (mm)->total_vm; \ 386 (mm)->hiwater_vm = (mm)->total_vm; \
388} while (0) 387} while (0)
389 388
389#define get_mm_hiwater_rss(mm) max((mm)->hiwater_rss, get_mm_rss(mm))
390#define get_mm_hiwater_vm(mm) max((mm)->hiwater_vm, (mm)->total_vm)
391
390extern void set_dumpable(struct mm_struct *mm, int value); 392extern void set_dumpable(struct mm_struct *mm, int value);
391extern int get_dumpable(struct mm_struct *mm); 393extern int get_dumpable(struct mm_struct *mm);
392 394
@@ -571,12 +573,6 @@ struct signal_struct {
571 */ 573 */
572 struct rlimit rlim[RLIM_NLIMITS]; 574 struct rlimit rlim[RLIM_NLIMITS];
573 575
574 /* keep the process-shared keyrings here so that they do the right
575 * thing in threads created with CLONE_THREAD */
576#ifdef CONFIG_KEYS
577 struct key *session_keyring; /* keyring inherited over fork */
578 struct key *process_keyring; /* keyring private to this process */
579#endif
580#ifdef CONFIG_BSD_PROCESS_ACCT 576#ifdef CONFIG_BSD_PROCESS_ACCT
581 struct pacct_struct pacct; /* per-process accounting information */ 577 struct pacct_struct pacct; /* per-process accounting information */
582#endif 578#endif
@@ -647,6 +643,7 @@ struct user_struct {
647 /* Hash table maintenance information */ 643 /* Hash table maintenance information */
648 struct hlist_node uidhash_node; 644 struct hlist_node uidhash_node;
649 uid_t uid; 645 uid_t uid;
646 struct user_namespace *user_ns;
650 647
651#ifdef CONFIG_USER_SCHED 648#ifdef CONFIG_USER_SCHED
652 struct task_group *tg; 649 struct task_group *tg;
@@ -664,6 +661,7 @@ extern struct user_struct *find_user(uid_t);
664extern struct user_struct root_user; 661extern struct user_struct root_user;
665#define INIT_USER (&root_user) 662#define INIT_USER (&root_user)
666 663
664
667struct backing_dev_info; 665struct backing_dev_info;
668struct reclaim_state; 666struct reclaim_state;
669 667
@@ -671,8 +669,7 @@ struct reclaim_state;
671struct sched_info { 669struct sched_info {
672 /* cumulative counters */ 670 /* cumulative counters */
673 unsigned long pcount; /* # of times run on this cpu */ 671 unsigned long pcount; /* # of times run on this cpu */
674 unsigned long long cpu_time, /* time spent on the cpu */ 672 unsigned long long run_delay; /* time spent waiting on a runqueue */
675 run_delay; /* time spent waiting on a runqueue */
676 673
677 /* timestamps */ 674 /* timestamps */
678 unsigned long long last_arrival,/* when we last ran on a cpu */ 675 unsigned long long last_arrival,/* when we last ran on a cpu */
@@ -918,7 +915,6 @@ static inline struct cpumask *sched_domain_span(struct sched_domain *sd)
918 915
919extern void partition_sched_domains(int ndoms_new, struct cpumask *doms_new, 916extern void partition_sched_domains(int ndoms_new, struct cpumask *doms_new,
920 struct sched_domain_attr *dattr_new); 917 struct sched_domain_attr *dattr_new);
921extern int arch_reinit_sched_domains(void);
922 918
923/* Test a flag in parent sched domain */ 919/* Test a flag in parent sched domain */
924static inline int test_sd_parent(struct sched_domain *sd, int flag) 920static inline int test_sd_parent(struct sched_domain *sd, int flag)
@@ -941,38 +937,7 @@ partition_sched_domains(int ndoms_new, struct cpumask *doms_new,
941#endif /* !CONFIG_SMP */ 937#endif /* !CONFIG_SMP */
942 938
943struct io_context; /* See blkdev.h */ 939struct io_context; /* See blkdev.h */
944#define NGROUPS_SMALL 32
945#define NGROUPS_PER_BLOCK ((unsigned int)(PAGE_SIZE / sizeof(gid_t)))
946struct group_info {
947 int ngroups;
948 atomic_t usage;
949 gid_t small_block[NGROUPS_SMALL];
950 int nblocks;
951 gid_t *blocks[0];
952};
953
954/*
955 * get_group_info() must be called with the owning task locked (via task_lock())
956 * when task != current. The reason being that the vast majority of callers are
957 * looking at current->group_info, which can not be changed except by the
958 * current task. Changing current->group_info requires the task lock, too.
959 */
960#define get_group_info(group_info) do { \
961 atomic_inc(&(group_info)->usage); \
962} while (0)
963
964#define put_group_info(group_info) do { \
965 if (atomic_dec_and_test(&(group_info)->usage)) \
966 groups_free(group_info); \
967} while (0)
968 940
969extern struct group_info *groups_alloc(int gidsetsize);
970extern void groups_free(struct group_info *group_info);
971extern int set_current_groups(struct group_info *group_info);
972extern int groups_search(struct group_info *group_info, gid_t grp);
973/* access the groups "array" with this macro */
974#define GROUP_AT(gi, i) \
975 ((gi)->blocks[(i)/NGROUPS_PER_BLOCK][(i)%NGROUPS_PER_BLOCK])
976 941
977#ifdef ARCH_HAS_PREFETCH_SWITCH_STACK 942#ifdef ARCH_HAS_PREFETCH_SWITCH_STACK
978extern void prefetch_stack(struct task_struct *t); 943extern void prefetch_stack(struct task_struct *t);
@@ -1230,6 +1195,7 @@ struct task_struct {
1230 * The buffer to hold the BTS data. 1195 * The buffer to hold the BTS data.
1231 */ 1196 */
1232 void *bts_buffer; 1197 void *bts_buffer;
1198 size_t bts_size;
1233#endif /* CONFIG_X86_PTRACE_BTS */ 1199#endif /* CONFIG_X86_PTRACE_BTS */
1234 1200
1235 /* PID/PID hash table linkage. */ 1201 /* PID/PID hash table linkage. */
@@ -1253,17 +1219,12 @@ struct task_struct {
1253 struct list_head cpu_timers[3]; 1219 struct list_head cpu_timers[3];
1254 1220
1255/* process credentials */ 1221/* process credentials */
1256 uid_t uid,euid,suid,fsuid; 1222 const struct cred *real_cred; /* objective and real subjective task
1257 gid_t gid,egid,sgid,fsgid; 1223 * credentials (COW) */
1258 struct group_info *group_info; 1224 const struct cred *cred; /* effective (overridable) subjective task
1259 kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset; 1225 * credentials (COW) */
1260 struct user_struct *user; 1226 struct mutex cred_exec_mutex; /* execve vs ptrace cred calculation mutex */
1261 unsigned securebits; 1227
1262#ifdef CONFIG_KEYS
1263 unsigned char jit_keyring; /* default keyring to attach requested keys to */
1264 struct key *request_key_auth; /* assumed request_key authority */
1265 struct key *thread_keyring; /* keyring private to this thread */
1266#endif
1267 char comm[TASK_COMM_LEN]; /* executable name excluding path 1228 char comm[TASK_COMM_LEN]; /* executable name excluding path
1268 - access with [gs]et_task_comm (which lock 1229 - access with [gs]et_task_comm (which lock
1269 it with task_lock()) 1230 it with task_lock())
@@ -1300,9 +1261,6 @@ struct task_struct {
1300 int (*notifier)(void *priv); 1261 int (*notifier)(void *priv);
1301 void *notifier_data; 1262 void *notifier_data;
1302 sigset_t *notifier_mask; 1263 sigset_t *notifier_mask;
1303#ifdef CONFIG_SECURITY
1304 void *security;
1305#endif
1306 struct audit_context *audit_context; 1264 struct audit_context *audit_context;
1307#ifdef CONFIG_AUDITSYSCALL 1265#ifdef CONFIG_AUDITSYSCALL
1308 uid_t loginuid; 1266 uid_t loginuid;
@@ -1750,16 +1708,16 @@ extern void wake_up_idle_cpu(int cpu);
1750static inline void wake_up_idle_cpu(int cpu) { } 1708static inline void wake_up_idle_cpu(int cpu) { }
1751#endif 1709#endif
1752 1710
1753#ifdef CONFIG_SCHED_DEBUG
1754extern unsigned int sysctl_sched_latency; 1711extern unsigned int sysctl_sched_latency;
1755extern unsigned int sysctl_sched_min_granularity; 1712extern unsigned int sysctl_sched_min_granularity;
1756extern unsigned int sysctl_sched_wakeup_granularity; 1713extern unsigned int sysctl_sched_wakeup_granularity;
1714extern unsigned int sysctl_sched_shares_ratelimit;
1715extern unsigned int sysctl_sched_shares_thresh;
1716#ifdef CONFIG_SCHED_DEBUG
1757extern unsigned int sysctl_sched_child_runs_first; 1717extern unsigned int sysctl_sched_child_runs_first;
1758extern unsigned int sysctl_sched_features; 1718extern unsigned int sysctl_sched_features;
1759extern unsigned int sysctl_sched_migration_cost; 1719extern unsigned int sysctl_sched_migration_cost;
1760extern unsigned int sysctl_sched_nr_migrate; 1720extern unsigned int sysctl_sched_nr_migrate;
1761extern unsigned int sysctl_sched_shares_ratelimit;
1762extern unsigned int sysctl_sched_shares_thresh;
1763 1721
1764int sched_nr_latency_handler(struct ctl_table *table, int write, 1722int sched_nr_latency_handler(struct ctl_table *table, int write,
1765 struct file *file, void __user *buffer, size_t *length, 1723 struct file *file, void __user *buffer, size_t *length,
@@ -1859,7 +1817,6 @@ static inline struct user_struct *get_uid(struct user_struct *u)
1859 return u; 1817 return u;
1860} 1818}
1861extern void free_uid(struct user_struct *); 1819extern void free_uid(struct user_struct *);
1862extern void switch_uid(struct user_struct *);
1863extern void release_uids(struct user_namespace *ns); 1820extern void release_uids(struct user_namespace *ns);
1864 1821
1865#include <asm/current.h> 1822#include <asm/current.h>
@@ -1878,9 +1835,6 @@ extern void wake_up_new_task(struct task_struct *tsk,
1878extern void sched_fork(struct task_struct *p, int clone_flags); 1835extern void sched_fork(struct task_struct *p, int clone_flags);
1879extern void sched_dead(struct task_struct *p); 1836extern void sched_dead(struct task_struct *p);
1880 1837
1881extern int in_group_p(gid_t);
1882extern int in_egroup_p(gid_t);
1883
1884extern void proc_caches_init(void); 1838extern void proc_caches_init(void);
1885extern void flush_signals(struct task_struct *); 1839extern void flush_signals(struct task_struct *);
1886extern void ignore_signals(struct task_struct *); 1840extern void ignore_signals(struct task_struct *);
@@ -2012,6 +1966,8 @@ static inline unsigned long wait_task_inactive(struct task_struct *p,
2012#define for_each_process(p) \ 1966#define for_each_process(p) \
2013 for (p = &init_task ; (p = next_task(p)) != &init_task ; ) 1967 for (p = &init_task ; (p = next_task(p)) != &init_task ; )
2014 1968
1969extern bool is_single_threaded(struct task_struct *);
1970
2015/* 1971/*
2016 * Careful: do_each_thread/while_each_thread is a double loop so 1972 * Careful: do_each_thread/while_each_thread is a double loop so
2017 * 'break' will not work as expected - use goto instead. 1973 * 'break' will not work as expected - use goto instead.
diff --git a/include/linux/securebits.h b/include/linux/securebits.h
index 92f09bdf1175..d2c5ed845bcc 100644
--- a/include/linux/securebits.h
+++ b/include/linux/securebits.h
@@ -32,7 +32,7 @@
32 setting is locked or not. A setting which is locked cannot be 32 setting is locked or not. A setting which is locked cannot be
33 changed from user-level. */ 33 changed from user-level. */
34#define issecure_mask(X) (1 << (X)) 34#define issecure_mask(X) (1 << (X))
35#define issecure(X) (issecure_mask(X) & current->securebits) 35#define issecure(X) (issecure_mask(X) & current_cred_xxx(securebits))
36 36
37#define SECURE_ALL_BITS (issecure_mask(SECURE_NOROOT) | \ 37#define SECURE_ALL_BITS (issecure_mask(SECURE_NOROOT) | \
38 issecure_mask(SECURE_NO_SETUID_FIXUP) | \ 38 issecure_mask(SECURE_NO_SETUID_FIXUP) | \
diff --git a/include/linux/security.h b/include/linux/security.h
index e3d4ecda2673..1f2ab6353c00 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -37,6 +37,10 @@
37/* Maximum number of letters for an LSM name string */ 37/* Maximum number of letters for an LSM name string */
38#define SECURITY_NAME_MAX 10 38#define SECURITY_NAME_MAX 10
39 39
40/* If capable should audit the security request */
41#define SECURITY_CAP_NOAUDIT 0
42#define SECURITY_CAP_AUDIT 1
43
40struct ctl_table; 44struct ctl_table;
41struct audit_krule; 45struct audit_krule;
42 46
@@ -44,25 +48,26 @@ struct audit_krule;
44 * These functions are in security/capability.c and are used 48 * These functions are in security/capability.c and are used
45 * as the default capabilities functions 49 * as the default capabilities functions
46 */ 50 */
47extern int cap_capable(struct task_struct *tsk, int cap); 51extern int cap_capable(struct task_struct *tsk, const struct cred *cred,
52 int cap, int audit);
48extern int cap_settime(struct timespec *ts, struct timezone *tz); 53extern int cap_settime(struct timespec *ts, struct timezone *tz);
49extern int cap_ptrace_may_access(struct task_struct *child, unsigned int mode); 54extern int cap_ptrace_may_access(struct task_struct *child, unsigned int mode);
50extern int cap_ptrace_traceme(struct task_struct *parent); 55extern int cap_ptrace_traceme(struct task_struct *parent);
51extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 56extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
52extern int cap_capset_check(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 57extern int cap_capset(struct cred *new, const struct cred *old,
53extern void cap_capset_set(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 58 const kernel_cap_t *effective,
54extern int cap_bprm_set_security(struct linux_binprm *bprm); 59 const kernel_cap_t *inheritable,
55extern void cap_bprm_apply_creds(struct linux_binprm *bprm, int unsafe); 60 const kernel_cap_t *permitted);
61extern int cap_bprm_set_creds(struct linux_binprm *bprm);
56extern int cap_bprm_secureexec(struct linux_binprm *bprm); 62extern int cap_bprm_secureexec(struct linux_binprm *bprm);
57extern int cap_inode_setxattr(struct dentry *dentry, const char *name, 63extern int cap_inode_setxattr(struct dentry *dentry, const char *name,
58 const void *value, size_t size, int flags); 64 const void *value, size_t size, int flags);
59extern int cap_inode_removexattr(struct dentry *dentry, const char *name); 65extern int cap_inode_removexattr(struct dentry *dentry, const char *name);
60extern int cap_inode_need_killpriv(struct dentry *dentry); 66extern int cap_inode_need_killpriv(struct dentry *dentry);
61extern int cap_inode_killpriv(struct dentry *dentry); 67extern int cap_inode_killpriv(struct dentry *dentry);
62extern int cap_task_post_setuid(uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags); 68extern int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags);
63extern void cap_task_reparent_to_init(struct task_struct *p);
64extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3, 69extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
65 unsigned long arg4, unsigned long arg5, long *rc_p); 70 unsigned long arg4, unsigned long arg5);
66extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp); 71extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp);
67extern int cap_task_setioprio(struct task_struct *p, int ioprio); 72extern int cap_task_setioprio(struct task_struct *p, int ioprio);
68extern int cap_task_setnice(struct task_struct *p, int nice); 73extern int cap_task_setnice(struct task_struct *p, int nice);
@@ -105,7 +110,7 @@ extern unsigned long mmap_min_addr;
105struct sched_param; 110struct sched_param;
106struct request_sock; 111struct request_sock;
107 112
108/* bprm_apply_creds unsafe reasons */ 113/* bprm->unsafe reasons */
109#define LSM_UNSAFE_SHARE 1 114#define LSM_UNSAFE_SHARE 1
110#define LSM_UNSAFE_PTRACE 2 115#define LSM_UNSAFE_PTRACE 2
111#define LSM_UNSAFE_PTRACE_CAP 4 116#define LSM_UNSAFE_PTRACE_CAP 4
@@ -149,36 +154,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
149 * 154 *
150 * Security hooks for program execution operations. 155 * Security hooks for program execution operations.
151 * 156 *
152 * @bprm_alloc_security: 157 * @bprm_set_creds:
153 * Allocate and attach a security structure to the @bprm->security field.
154 * The security field is initialized to NULL when the bprm structure is
155 * allocated.
156 * @bprm contains the linux_binprm structure to be modified.
157 * Return 0 if operation was successful.
158 * @bprm_free_security:
159 * @bprm contains the linux_binprm structure to be modified.
160 * Deallocate and clear the @bprm->security field.
161 * @bprm_apply_creds:
162 * Compute and set the security attributes of a process being transformed
163 * by an execve operation based on the old attributes (current->security)
164 * and the information saved in @bprm->security by the set_security hook.
165 * Since this hook function (and its caller) are void, this hook can not
166 * return an error. However, it can leave the security attributes of the
167 * process unchanged if an access failure occurs at this point.
168 * bprm_apply_creds is called under task_lock. @unsafe indicates various
169 * reasons why it may be unsafe to change security state.
170 * @bprm contains the linux_binprm structure.
171 * @bprm_post_apply_creds:
172 * Runs after bprm_apply_creds with the task_lock dropped, so that
173 * functions which cannot be called safely under the task_lock can
174 * be used. This hook is a good place to perform state changes on
175 * the process such as closing open file descriptors to which access
176 * is no longer granted if the attributes were changed.
177 * Note that a security module might need to save state between
178 * bprm_apply_creds and bprm_post_apply_creds to store the decision
179 * on whether the process may proceed.
180 * @bprm contains the linux_binprm structure.
181 * @bprm_set_security:
182 * Save security information in the bprm->security field, typically based 158 * Save security information in the bprm->security field, typically based
183 * on information about the bprm->file, for later use by the apply_creds 159 * on information about the bprm->file, for later use by the apply_creds
184 * hook. This hook may also optionally check permissions (e.g. for 160 * hook. This hook may also optionally check permissions (e.g. for
@@ -191,15 +167,30 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
191 * @bprm contains the linux_binprm structure. 167 * @bprm contains the linux_binprm structure.
192 * Return 0 if the hook is successful and permission is granted. 168 * Return 0 if the hook is successful and permission is granted.
193 * @bprm_check_security: 169 * @bprm_check_security:
194 * This hook mediates the point when a search for a binary handler will 170 * This hook mediates the point when a search for a binary handler will
195 * begin. It allows a check the @bprm->security value which is set in 171 * begin. It allows a check the @bprm->security value which is set in the
196 * the preceding set_security call. The primary difference from 172 * preceding set_creds call. The primary difference from set_creds is
197 * set_security is that the argv list and envp list are reliably 173 * that the argv list and envp list are reliably available in @bprm. This
198 * available in @bprm. This hook may be called multiple times 174 * hook may be called multiple times during a single execve; and in each
199 * during a single execve; and in each pass set_security is called 175 * pass set_creds is called first.
200 * first.
201 * @bprm contains the linux_binprm structure. 176 * @bprm contains the linux_binprm structure.
202 * Return 0 if the hook is successful and permission is granted. 177 * Return 0 if the hook is successful and permission is granted.
178 * @bprm_committing_creds:
179 * Prepare to install the new security attributes of a process being
180 * transformed by an execve operation, based on the old credentials
181 * pointed to by @current->cred and the information set in @bprm->cred by
182 * the bprm_set_creds hook. @bprm points to the linux_binprm structure.
183 * This hook is a good place to perform state changes on the process such
184 * as closing open file descriptors to which access will no longer be
185 * granted when the attributes are changed. This is called immediately
186 * before commit_creds().
187 * @bprm_committed_creds:
188 * Tidy up after the installation of the new security attributes of a
189 * process being transformed by an execve operation. The new credentials
190 * have, by this point, been set to @current->cred. @bprm points to the
191 * linux_binprm structure. This hook is a good place to perform state
192 * changes on the process such as clearing out non-inheritable signal
193 * state. This is called immediately after commit_creds().
203 * @bprm_secureexec: 194 * @bprm_secureexec:
204 * Return a boolean value (0 or 1) indicating whether a "secure exec" 195 * Return a boolean value (0 or 1) indicating whether a "secure exec"
205 * is required. The flag is passed in the auxiliary table 196 * is required. The flag is passed in the auxiliary table
@@ -345,17 +336,37 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
345 * @dir contains the inode structure of the parent directory of the new link. 336 * @dir contains the inode structure of the parent directory of the new link.
346 * @new_dentry contains the dentry structure for the new link. 337 * @new_dentry contains the dentry structure for the new link.
347 * Return 0 if permission is granted. 338 * Return 0 if permission is granted.
339 * @path_link:
340 * Check permission before creating a new hard link to a file.
341 * @old_dentry contains the dentry structure for an existing link
342 * to the file.
343 * @new_dir contains the path structure of the parent directory of
344 * the new link.
345 * @new_dentry contains the dentry structure for the new link.
346 * Return 0 if permission is granted.
348 * @inode_unlink: 347 * @inode_unlink:
349 * Check the permission to remove a hard link to a file. 348 * Check the permission to remove a hard link to a file.
350 * @dir contains the inode structure of parent directory of the file. 349 * @dir contains the inode structure of parent directory of the file.
351 * @dentry contains the dentry structure for file to be unlinked. 350 * @dentry contains the dentry structure for file to be unlinked.
352 * Return 0 if permission is granted. 351 * Return 0 if permission is granted.
352 * @path_unlink:
353 * Check the permission to remove a hard link to a file.
354 * @dir contains the path structure of parent directory of the file.
355 * @dentry contains the dentry structure for file to be unlinked.
356 * Return 0 if permission is granted.
353 * @inode_symlink: 357 * @inode_symlink:
354 * Check the permission to create a symbolic link to a file. 358 * Check the permission to create a symbolic link to a file.
355 * @dir contains the inode structure of parent directory of the symbolic link. 359 * @dir contains the inode structure of parent directory of the symbolic link.
356 * @dentry contains the dentry structure of the symbolic link. 360 * @dentry contains the dentry structure of the symbolic link.
357 * @old_name contains the pathname of file. 361 * @old_name contains the pathname of file.
358 * Return 0 if permission is granted. 362 * Return 0 if permission is granted.
363 * @path_symlink:
364 * Check the permission to create a symbolic link to a file.
365 * @dir contains the path structure of parent directory of
366 * the symbolic link.
367 * @dentry contains the dentry structure of the symbolic link.
368 * @old_name contains the pathname of file.
369 * Return 0 if permission is granted.
359 * @inode_mkdir: 370 * @inode_mkdir:
360 * Check permissions to create a new directory in the existing directory 371 * Check permissions to create a new directory in the existing directory
361 * associated with inode strcture @dir. 372 * associated with inode strcture @dir.
@@ -363,11 +374,25 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
363 * @dentry contains the dentry structure of new directory. 374 * @dentry contains the dentry structure of new directory.
364 * @mode contains the mode of new directory. 375 * @mode contains the mode of new directory.
365 * Return 0 if permission is granted. 376 * Return 0 if permission is granted.
377 * @path_mkdir:
378 * Check permissions to create a new directory in the existing directory
379 * associated with path strcture @path.
380 * @dir containst the path structure of parent of the directory
381 * to be created.
382 * @dentry contains the dentry structure of new directory.
383 * @mode contains the mode of new directory.
384 * Return 0 if permission is granted.
366 * @inode_rmdir: 385 * @inode_rmdir:
367 * Check the permission to remove a directory. 386 * Check the permission to remove a directory.
368 * @dir contains the inode structure of parent of the directory to be removed. 387 * @dir contains the inode structure of parent of the directory to be removed.
369 * @dentry contains the dentry structure of directory to be removed. 388 * @dentry contains the dentry structure of directory to be removed.
370 * Return 0 if permission is granted. 389 * Return 0 if permission is granted.
390 * @path_rmdir:
391 * Check the permission to remove a directory.
392 * @dir contains the path structure of parent of the directory to be
393 * removed.
394 * @dentry contains the dentry structure of directory to be removed.
395 * Return 0 if permission is granted.
371 * @inode_mknod: 396 * @inode_mknod:
372 * Check permissions when creating a special file (or a socket or a fifo 397 * Check permissions when creating a special file (or a socket or a fifo
373 * file created via the mknod system call). Note that if mknod operation 398 * file created via the mknod system call). Note that if mknod operation
@@ -378,6 +403,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
378 * @mode contains the mode of the new file. 403 * @mode contains the mode of the new file.
379 * @dev contains the device number. 404 * @dev contains the device number.
380 * Return 0 if permission is granted. 405 * Return 0 if permission is granted.
406 * @path_mknod:
407 * Check permissions when creating a file. Note that this hook is called
408 * even if mknod operation is being done for a regular file.
409 * @dir contains the path structure of parent of the new file.
410 * @dentry contains the dentry structure of the new file.
411 * @mode contains the mode of the new file.
412 * @dev contains the undecoded device number. Use new_decode_dev() to get
413 * the decoded device number.
414 * Return 0 if permission is granted.
381 * @inode_rename: 415 * @inode_rename:
382 * Check for permission to rename a file or directory. 416 * Check for permission to rename a file or directory.
383 * @old_dir contains the inode structure for parent of the old link. 417 * @old_dir contains the inode structure for parent of the old link.
@@ -385,6 +419,13 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
385 * @new_dir contains the inode structure for parent of the new link. 419 * @new_dir contains the inode structure for parent of the new link.
386 * @new_dentry contains the dentry structure of the new link. 420 * @new_dentry contains the dentry structure of the new link.
387 * Return 0 if permission is granted. 421 * Return 0 if permission is granted.
422 * @path_rename:
423 * Check for permission to rename a file or directory.
424 * @old_dir contains the path structure for parent of the old link.
425 * @old_dentry contains the dentry structure of the old link.
426 * @new_dir contains the path structure for parent of the new link.
427 * @new_dentry contains the dentry structure of the new link.
428 * Return 0 if permission is granted.
388 * @inode_readlink: 429 * @inode_readlink:
389 * Check the permission to read the symbolic link. 430 * Check the permission to read the symbolic link.
390 * @dentry contains the dentry structure for the file link. 431 * @dentry contains the dentry structure for the file link.
@@ -413,6 +454,12 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
413 * @dentry contains the dentry structure for the file. 454 * @dentry contains the dentry structure for the file.
414 * @attr is the iattr structure containing the new file attributes. 455 * @attr is the iattr structure containing the new file attributes.
415 * Return 0 if permission is granted. 456 * Return 0 if permission is granted.
457 * @path_truncate:
458 * Check permission before truncating a file.
459 * @path contains the path structure for the file.
460 * @length is the new length of the file.
461 * @time_attrs is the flags passed to do_truncate().
462 * Return 0 if permission is granted.
416 * @inode_getattr: 463 * @inode_getattr:
417 * Check permission before obtaining file attributes. 464 * Check permission before obtaining file attributes.
418 * @mnt is the vfsmount where the dentry was looked up 465 * @mnt is the vfsmount where the dentry was looked up
@@ -585,15 +632,31 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
585 * manual page for definitions of the @clone_flags. 632 * manual page for definitions of the @clone_flags.
586 * @clone_flags contains the flags indicating what should be shared. 633 * @clone_flags contains the flags indicating what should be shared.
587 * Return 0 if permission is granted. 634 * Return 0 if permission is granted.
588 * @task_alloc_security: 635 * @cred_free:
589 * @p contains the task_struct for child process. 636 * @cred points to the credentials.
590 * Allocate and attach a security structure to the p->security field. The 637 * Deallocate and clear the cred->security field in a set of credentials.
591 * security field is initialized to NULL when the task structure is 638 * @cred_prepare:
592 * allocated. 639 * @new points to the new credentials.
593 * Return 0 if operation was successful. 640 * @old points to the original credentials.
594 * @task_free_security: 641 * @gfp indicates the atomicity of any memory allocations.
595 * @p contains the task_struct for process. 642 * Prepare a new set of credentials by copying the data from the old set.
596 * Deallocate and clear the p->security field. 643 * @cred_commit:
644 * @new points to the new credentials.
645 * @old points to the original credentials.
646 * Install a new set of credentials.
647 * @kernel_act_as:
648 * Set the credentials for a kernel service to act as (subjective context).
649 * @new points to the credentials to be modified.
650 * @secid specifies the security ID to be set
651 * The current task must be the one that nominated @secid.
652 * Return 0 if successful.
653 * @kernel_create_files_as:
654 * Set the file creation context in a set of credentials to be the same as
655 * the objective context of the specified inode.
656 * @new points to the credentials to be modified.
657 * @inode points to the inode to use as a reference.
658 * The current task must be the one that nominated @inode.
659 * Return 0 if successful.
597 * @task_setuid: 660 * @task_setuid:
598 * Check permission before setting one or more of the user identity 661 * Check permission before setting one or more of the user identity
599 * attributes of the current process. The @flags parameter indicates 662 * attributes of the current process. The @flags parameter indicates
@@ -606,15 +669,13 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
606 * @id2 contains a uid. 669 * @id2 contains a uid.
607 * @flags contains one of the LSM_SETID_* values. 670 * @flags contains one of the LSM_SETID_* values.
608 * Return 0 if permission is granted. 671 * Return 0 if permission is granted.
609 * @task_post_setuid: 672 * @task_fix_setuid:
610 * Update the module's state after setting one or more of the user 673 * Update the module's state after setting one or more of the user
611 * identity attributes of the current process. The @flags parameter 674 * identity attributes of the current process. The @flags parameter
612 * indicates which of the set*uid system calls invoked this hook. If 675 * indicates which of the set*uid system calls invoked this hook. If
613 * @flags is LSM_SETID_FS, then @old_ruid is the old fs uid and the other 676 * @new is the set of credentials that will be installed. Modifications
614 * parameters are not used. 677 * should be made to this rather than to @current->cred.
615 * @old_ruid contains the old real uid (or fs uid if LSM_SETID_FS). 678 * @old is the set of credentials that are being replaces
616 * @old_euid contains the old effective uid (or -1 if LSM_SETID_FS).
617 * @old_suid contains the old saved uid (or -1 if LSM_SETID_FS).
618 * @flags contains one of the LSM_SETID_* values. 679 * @flags contains one of the LSM_SETID_* values.
619 * Return 0 on success. 680 * Return 0 on success.
620 * @task_setgid: 681 * @task_setgid:
@@ -717,13 +778,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
717 * @arg3 contains a argument. 778 * @arg3 contains a argument.
718 * @arg4 contains a argument. 779 * @arg4 contains a argument.
719 * @arg5 contains a argument. 780 * @arg5 contains a argument.
720 * @rc_p contains a pointer to communicate back the forced return code 781 * Return -ENOSYS if no-one wanted to handle this op, any other value to
721 * Return 0 if permission is granted, and non-zero if the security module 782 * cause prctl() to return immediately with that value.
722 * has taken responsibility (setting *rc_p) for the prctl call.
723 * @task_reparent_to_init:
724 * Set the security attributes in @p->security for a kernel thread that
725 * is being reparented to the init task.
726 * @p contains the task_struct for the kernel thread.
727 * @task_to_inode: 783 * @task_to_inode:
728 * Set the security attributes for an inode based on an associated task's 784 * Set the security attributes for an inode based on an associated task's
729 * security attributes, e.g. for /proc/pid inodes. 785 * security attributes, e.g. for /proc/pid inodes.
@@ -1000,7 +1056,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1000 * See whether a specific operational right is granted to a process on a 1056 * See whether a specific operational right is granted to a process on a
1001 * key. 1057 * key.
1002 * @key_ref refers to the key (key pointer + possession attribute bit). 1058 * @key_ref refers to the key (key pointer + possession attribute bit).
1003 * @context points to the process to provide the context against which to 1059 * @cred points to the credentials to provide the context against which to
1004 * evaluate the security data on the key. 1060 * evaluate the security data on the key.
1005 * @perm describes the combination of permissions required of this key. 1061 * @perm describes the combination of permissions required of this key.
1006 * Return 1 if permission granted, 0 if permission denied and -ve it the 1062 * Return 1 if permission granted, 0 if permission denied and -ve it the
@@ -1162,6 +1218,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1162 * @child process. 1218 * @child process.
1163 * Security modules may also want to perform a process tracing check 1219 * Security modules may also want to perform a process tracing check
1164 * during an execve in the set_security or apply_creds hooks of 1220 * during an execve in the set_security or apply_creds hooks of
1221 * tracing check during an execve in the bprm_set_creds hook of
1165 * binprm_security_ops if the process is being traced and its security 1222 * binprm_security_ops if the process is being traced and its security
1166 * attributes would be changed by the execve. 1223 * attributes would be changed by the execve.
1167 * @child contains the task_struct structure for the target process. 1224 * @child contains the task_struct structure for the target process.
@@ -1185,33 +1242,22 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1185 * @inheritable contains the inheritable capability set. 1242 * @inheritable contains the inheritable capability set.
1186 * @permitted contains the permitted capability set. 1243 * @permitted contains the permitted capability set.
1187 * Return 0 if the capability sets were successfully obtained. 1244 * Return 0 if the capability sets were successfully obtained.
1188 * @capset_check: 1245 * @capset:
1189 * Check permission before setting the @effective, @inheritable, and
1190 * @permitted capability sets for the @target process.
1191 * Caveat: @target is also set to current if a set of processes is
1192 * specified (i.e. all processes other than current and init or a
1193 * particular process group). Hence, the capset_set hook may need to
1194 * revalidate permission to the actual target process.
1195 * @target contains the task_struct structure for target process.
1196 * @effective contains the effective capability set.
1197 * @inheritable contains the inheritable capability set.
1198 * @permitted contains the permitted capability set.
1199 * Return 0 if permission is granted.
1200 * @capset_set:
1201 * Set the @effective, @inheritable, and @permitted capability sets for 1246 * Set the @effective, @inheritable, and @permitted capability sets for
1202 * the @target process. Since capset_check cannot always check permission 1247 * the current process.
1203 * to the real @target process, this hook may also perform permission 1248 * @new contains the new credentials structure for target process.
1204 * checking to determine if the current process is allowed to set the 1249 * @old contains the current credentials structure for target process.
1205 * capability sets of the @target process. However, this hook has no way
1206 * of returning an error due to the structure of the sys_capset code.
1207 * @target contains the task_struct structure for target process.
1208 * @effective contains the effective capability set. 1250 * @effective contains the effective capability set.
1209 * @inheritable contains the inheritable capability set. 1251 * @inheritable contains the inheritable capability set.
1210 * @permitted contains the permitted capability set. 1252 * @permitted contains the permitted capability set.
1253 * Return 0 and update @new if permission is granted.
1211 * @capable: 1254 * @capable:
1212 * Check whether the @tsk process has the @cap capability. 1255 * Check whether the @tsk process has the @cap capability in the indicated
1256 * credentials.
1213 * @tsk contains the task_struct for the process. 1257 * @tsk contains the task_struct for the process.
1258 * @cred contains the credentials to use.
1214 * @cap contains the capability <include/linux/capability.h>. 1259 * @cap contains the capability <include/linux/capability.h>.
1260 * @audit: Whether to write an audit message or not
1215 * Return 0 if the capability is granted for @tsk. 1261 * Return 0 if the capability is granted for @tsk.
1216 * @acct: 1262 * @acct:
1217 * Check permission before enabling or disabling process accounting. If 1263 * Check permission before enabling or disabling process accounting. If
@@ -1299,15 +1345,13 @@ struct security_operations {
1299 int (*capget) (struct task_struct *target, 1345 int (*capget) (struct task_struct *target,
1300 kernel_cap_t *effective, 1346 kernel_cap_t *effective,
1301 kernel_cap_t *inheritable, kernel_cap_t *permitted); 1347 kernel_cap_t *inheritable, kernel_cap_t *permitted);
1302 int (*capset_check) (struct task_struct *target, 1348 int (*capset) (struct cred *new,
1303 kernel_cap_t *effective, 1349 const struct cred *old,
1304 kernel_cap_t *inheritable, 1350 const kernel_cap_t *effective,
1305 kernel_cap_t *permitted); 1351 const kernel_cap_t *inheritable,
1306 void (*capset_set) (struct task_struct *target, 1352 const kernel_cap_t *permitted);
1307 kernel_cap_t *effective, 1353 int (*capable) (struct task_struct *tsk, const struct cred *cred,
1308 kernel_cap_t *inheritable, 1354 int cap, int audit);
1309 kernel_cap_t *permitted);
1310 int (*capable) (struct task_struct *tsk, int cap);
1311 int (*acct) (struct file *file); 1355 int (*acct) (struct file *file);
1312 int (*sysctl) (struct ctl_table *table, int op); 1356 int (*sysctl) (struct ctl_table *table, int op);
1313 int (*quotactl) (int cmds, int type, int id, struct super_block *sb); 1357 int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
@@ -1316,18 +1360,16 @@ struct security_operations {
1316 int (*settime) (struct timespec *ts, struct timezone *tz); 1360 int (*settime) (struct timespec *ts, struct timezone *tz);
1317 int (*vm_enough_memory) (struct mm_struct *mm, long pages); 1361 int (*vm_enough_memory) (struct mm_struct *mm, long pages);
1318 1362
1319 int (*bprm_alloc_security) (struct linux_binprm *bprm); 1363 int (*bprm_set_creds) (struct linux_binprm *bprm);
1320 void (*bprm_free_security) (struct linux_binprm *bprm);
1321 void (*bprm_apply_creds) (struct linux_binprm *bprm, int unsafe);
1322 void (*bprm_post_apply_creds) (struct linux_binprm *bprm);
1323 int (*bprm_set_security) (struct linux_binprm *bprm);
1324 int (*bprm_check_security) (struct linux_binprm *bprm); 1364 int (*bprm_check_security) (struct linux_binprm *bprm);
1325 int (*bprm_secureexec) (struct linux_binprm *bprm); 1365 int (*bprm_secureexec) (struct linux_binprm *bprm);
1366 void (*bprm_committing_creds) (struct linux_binprm *bprm);
1367 void (*bprm_committed_creds) (struct linux_binprm *bprm);
1326 1368
1327 int (*sb_alloc_security) (struct super_block *sb); 1369 int (*sb_alloc_security) (struct super_block *sb);
1328 void (*sb_free_security) (struct super_block *sb); 1370 void (*sb_free_security) (struct super_block *sb);
1329 int (*sb_copy_data) (char *orig, char *copy); 1371 int (*sb_copy_data) (char *orig, char *copy);
1330 int (*sb_kern_mount) (struct super_block *sb, void *data); 1372 int (*sb_kern_mount) (struct super_block *sb, int flags, void *data);
1331 int (*sb_show_options) (struct seq_file *m, struct super_block *sb); 1373 int (*sb_show_options) (struct seq_file *m, struct super_block *sb);
1332 int (*sb_statfs) (struct dentry *dentry); 1374 int (*sb_statfs) (struct dentry *dentry);
1333 int (*sb_mount) (char *dev_name, struct path *path, 1375 int (*sb_mount) (char *dev_name, struct path *path,
@@ -1350,6 +1392,22 @@ struct security_operations {
1350 struct super_block *newsb); 1392 struct super_block *newsb);
1351 int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); 1393 int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts);
1352 1394
1395#ifdef CONFIG_SECURITY_PATH
1396 int (*path_unlink) (struct path *dir, struct dentry *dentry);
1397 int (*path_mkdir) (struct path *dir, struct dentry *dentry, int mode);
1398 int (*path_rmdir) (struct path *dir, struct dentry *dentry);
1399 int (*path_mknod) (struct path *dir, struct dentry *dentry, int mode,
1400 unsigned int dev);
1401 int (*path_truncate) (struct path *path, loff_t length,
1402 unsigned int time_attrs);
1403 int (*path_symlink) (struct path *dir, struct dentry *dentry,
1404 const char *old_name);
1405 int (*path_link) (struct dentry *old_dentry, struct path *new_dir,
1406 struct dentry *new_dentry);
1407 int (*path_rename) (struct path *old_dir, struct dentry *old_dentry,
1408 struct path *new_dir, struct dentry *new_dentry);
1409#endif
1410
1353 int (*inode_alloc_security) (struct inode *inode); 1411 int (*inode_alloc_security) (struct inode *inode);
1354 void (*inode_free_security) (struct inode *inode); 1412 void (*inode_free_security) (struct inode *inode);
1355 int (*inode_init_security) (struct inode *inode, struct inode *dir, 1413 int (*inode_init_security) (struct inode *inode, struct inode *dir,
@@ -1406,14 +1464,18 @@ struct security_operations {
1406 int (*file_send_sigiotask) (struct task_struct *tsk, 1464 int (*file_send_sigiotask) (struct task_struct *tsk,
1407 struct fown_struct *fown, int sig); 1465 struct fown_struct *fown, int sig);
1408 int (*file_receive) (struct file *file); 1466 int (*file_receive) (struct file *file);
1409 int (*dentry_open) (struct file *file); 1467 int (*dentry_open) (struct file *file, const struct cred *cred);
1410 1468
1411 int (*task_create) (unsigned long clone_flags); 1469 int (*task_create) (unsigned long clone_flags);
1412 int (*task_alloc_security) (struct task_struct *p); 1470 void (*cred_free) (struct cred *cred);
1413 void (*task_free_security) (struct task_struct *p); 1471 int (*cred_prepare)(struct cred *new, const struct cred *old,
1472 gfp_t gfp);
1473 void (*cred_commit)(struct cred *new, const struct cred *old);
1474 int (*kernel_act_as)(struct cred *new, u32 secid);
1475 int (*kernel_create_files_as)(struct cred *new, struct inode *inode);
1414 int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags); 1476 int (*task_setuid) (uid_t id0, uid_t id1, uid_t id2, int flags);
1415 int (*task_post_setuid) (uid_t old_ruid /* or fsuid */ , 1477 int (*task_fix_setuid) (struct cred *new, const struct cred *old,
1416 uid_t old_euid, uid_t old_suid, int flags); 1478 int flags);
1417 int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags); 1479 int (*task_setgid) (gid_t id0, gid_t id1, gid_t id2, int flags);
1418 int (*task_setpgid) (struct task_struct *p, pid_t pgid); 1480 int (*task_setpgid) (struct task_struct *p, pid_t pgid);
1419 int (*task_getpgid) (struct task_struct *p); 1481 int (*task_getpgid) (struct task_struct *p);
@@ -1433,8 +1495,7 @@ struct security_operations {
1433 int (*task_wait) (struct task_struct *p); 1495 int (*task_wait) (struct task_struct *p);
1434 int (*task_prctl) (int option, unsigned long arg2, 1496 int (*task_prctl) (int option, unsigned long arg2,
1435 unsigned long arg3, unsigned long arg4, 1497 unsigned long arg3, unsigned long arg4,
1436 unsigned long arg5, long *rc_p); 1498 unsigned long arg5);
1437 void (*task_reparent_to_init) (struct task_struct *p);
1438 void (*task_to_inode) (struct task_struct *p, struct inode *inode); 1499 void (*task_to_inode) (struct task_struct *p, struct inode *inode);
1439 1500
1440 int (*ipc_permission) (struct kern_ipc_perm *ipcp, short flag); 1501 int (*ipc_permission) (struct kern_ipc_perm *ipcp, short flag);
@@ -1539,10 +1600,10 @@ struct security_operations {
1539 1600
1540 /* key management security hooks */ 1601 /* key management security hooks */
1541#ifdef CONFIG_KEYS 1602#ifdef CONFIG_KEYS
1542 int (*key_alloc) (struct key *key, struct task_struct *tsk, unsigned long flags); 1603 int (*key_alloc) (struct key *key, const struct cred *cred, unsigned long flags);
1543 void (*key_free) (struct key *key); 1604 void (*key_free) (struct key *key);
1544 int (*key_permission) (key_ref_t key_ref, 1605 int (*key_permission) (key_ref_t key_ref,
1545 struct task_struct *context, 1606 const struct cred *cred,
1546 key_perm_t perm); 1607 key_perm_t perm);
1547 int (*key_getsecurity)(struct key *key, char **_buffer); 1608 int (*key_getsecurity)(struct key *key, char **_buffer);
1548#endif /* CONFIG_KEYS */ 1609#endif /* CONFIG_KEYS */
@@ -1568,15 +1629,13 @@ int security_capget(struct task_struct *target,
1568 kernel_cap_t *effective, 1629 kernel_cap_t *effective,
1569 kernel_cap_t *inheritable, 1630 kernel_cap_t *inheritable,
1570 kernel_cap_t *permitted); 1631 kernel_cap_t *permitted);
1571int security_capset_check(struct task_struct *target, 1632int security_capset(struct cred *new, const struct cred *old,
1572 kernel_cap_t *effective, 1633 const kernel_cap_t *effective,
1573 kernel_cap_t *inheritable, 1634 const kernel_cap_t *inheritable,
1574 kernel_cap_t *permitted); 1635 const kernel_cap_t *permitted);
1575void security_capset_set(struct task_struct *target, 1636int security_capable(int cap);
1576 kernel_cap_t *effective, 1637int security_real_capable(struct task_struct *tsk, int cap);
1577 kernel_cap_t *inheritable, 1638int security_real_capable_noaudit(struct task_struct *tsk, int cap);
1578 kernel_cap_t *permitted);
1579int security_capable(struct task_struct *tsk, int cap);
1580int security_acct(struct file *file); 1639int security_acct(struct file *file);
1581int security_sysctl(struct ctl_table *table, int op); 1640int security_sysctl(struct ctl_table *table, int op);
1582int security_quotactl(int cmds, int type, int id, struct super_block *sb); 1641int security_quotactl(int cmds, int type, int id, struct super_block *sb);
@@ -1586,17 +1645,15 @@ int security_settime(struct timespec *ts, struct timezone *tz);
1586int security_vm_enough_memory(long pages); 1645int security_vm_enough_memory(long pages);
1587int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); 1646int security_vm_enough_memory_mm(struct mm_struct *mm, long pages);
1588int security_vm_enough_memory_kern(long pages); 1647int security_vm_enough_memory_kern(long pages);
1589int security_bprm_alloc(struct linux_binprm *bprm); 1648int security_bprm_set_creds(struct linux_binprm *bprm);
1590void security_bprm_free(struct linux_binprm *bprm);
1591void security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe);
1592void security_bprm_post_apply_creds(struct linux_binprm *bprm);
1593int security_bprm_set(struct linux_binprm *bprm);
1594int security_bprm_check(struct linux_binprm *bprm); 1649int security_bprm_check(struct linux_binprm *bprm);
1650void security_bprm_committing_creds(struct linux_binprm *bprm);
1651void security_bprm_committed_creds(struct linux_binprm *bprm);
1595int security_bprm_secureexec(struct linux_binprm *bprm); 1652int security_bprm_secureexec(struct linux_binprm *bprm);
1596int security_sb_alloc(struct super_block *sb); 1653int security_sb_alloc(struct super_block *sb);
1597void security_sb_free(struct super_block *sb); 1654void security_sb_free(struct super_block *sb);
1598int security_sb_copy_data(char *orig, char *copy); 1655int security_sb_copy_data(char *orig, char *copy);
1599int security_sb_kern_mount(struct super_block *sb, void *data); 1656int security_sb_kern_mount(struct super_block *sb, int flags, void *data);
1600int security_sb_show_options(struct seq_file *m, struct super_block *sb); 1657int security_sb_show_options(struct seq_file *m, struct super_block *sb);
1601int security_sb_statfs(struct dentry *dentry); 1658int security_sb_statfs(struct dentry *dentry);
1602int security_sb_mount(char *dev_name, struct path *path, 1659int security_sb_mount(char *dev_name, struct path *path,
@@ -1663,13 +1720,16 @@ int security_file_set_fowner(struct file *file);
1663int security_file_send_sigiotask(struct task_struct *tsk, 1720int security_file_send_sigiotask(struct task_struct *tsk,
1664 struct fown_struct *fown, int sig); 1721 struct fown_struct *fown, int sig);
1665int security_file_receive(struct file *file); 1722int security_file_receive(struct file *file);
1666int security_dentry_open(struct file *file); 1723int security_dentry_open(struct file *file, const struct cred *cred);
1667int security_task_create(unsigned long clone_flags); 1724int security_task_create(unsigned long clone_flags);
1668int security_task_alloc(struct task_struct *p); 1725void security_cred_free(struct cred *cred);
1669void security_task_free(struct task_struct *p); 1726int security_prepare_creds(struct cred *new, const struct cred *old, gfp_t gfp);
1727void security_commit_creds(struct cred *new, const struct cred *old);
1728int security_kernel_act_as(struct cred *new, u32 secid);
1729int security_kernel_create_files_as(struct cred *new, struct inode *inode);
1670int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags); 1730int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags);
1671int security_task_post_setuid(uid_t old_ruid, uid_t old_euid, 1731int security_task_fix_setuid(struct cred *new, const struct cred *old,
1672 uid_t old_suid, int flags); 1732 int flags);
1673int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags); 1733int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags);
1674int security_task_setpgid(struct task_struct *p, pid_t pgid); 1734int security_task_setpgid(struct task_struct *p, pid_t pgid);
1675int security_task_getpgid(struct task_struct *p); 1735int security_task_getpgid(struct task_struct *p);
@@ -1688,8 +1748,7 @@ int security_task_kill(struct task_struct *p, struct siginfo *info,
1688 int sig, u32 secid); 1748 int sig, u32 secid);
1689int security_task_wait(struct task_struct *p); 1749int security_task_wait(struct task_struct *p);
1690int security_task_prctl(int option, unsigned long arg2, unsigned long arg3, 1750int security_task_prctl(int option, unsigned long arg2, unsigned long arg3,
1691 unsigned long arg4, unsigned long arg5, long *rc_p); 1751 unsigned long arg4, unsigned long arg5);
1692void security_task_reparent_to_init(struct task_struct *p);
1693void security_task_to_inode(struct task_struct *p, struct inode *inode); 1752void security_task_to_inode(struct task_struct *p, struct inode *inode);
1694int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag); 1753int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag);
1695void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid); 1754void security_ipc_getsecid(struct kern_ipc_perm *ipcp, u32 *secid);
@@ -1764,25 +1823,40 @@ static inline int security_capget(struct task_struct *target,
1764 return cap_capget(target, effective, inheritable, permitted); 1823 return cap_capget(target, effective, inheritable, permitted);
1765} 1824}
1766 1825
1767static inline int security_capset_check(struct task_struct *target, 1826static inline int security_capset(struct cred *new,
1768 kernel_cap_t *effective, 1827 const struct cred *old,
1769 kernel_cap_t *inheritable, 1828 const kernel_cap_t *effective,
1770 kernel_cap_t *permitted) 1829 const kernel_cap_t *inheritable,
1830 const kernel_cap_t *permitted)
1771{ 1831{
1772 return cap_capset_check(target, effective, inheritable, permitted); 1832 return cap_capset(new, old, effective, inheritable, permitted);
1773} 1833}
1774 1834
1775static inline void security_capset_set(struct task_struct *target, 1835static inline int security_capable(int cap)
1776 kernel_cap_t *effective,
1777 kernel_cap_t *inheritable,
1778 kernel_cap_t *permitted)
1779{ 1836{
1780 cap_capset_set(target, effective, inheritable, permitted); 1837 return cap_capable(current, current_cred(), cap, SECURITY_CAP_AUDIT);
1781} 1838}
1782 1839
1783static inline int security_capable(struct task_struct *tsk, int cap) 1840static inline int security_real_capable(struct task_struct *tsk, int cap)
1784{ 1841{
1785 return cap_capable(tsk, cap); 1842 int ret;
1843
1844 rcu_read_lock();
1845 ret = cap_capable(tsk, __task_cred(tsk), cap, SECURITY_CAP_AUDIT);
1846 rcu_read_unlock();
1847 return ret;
1848}
1849
1850static inline
1851int security_real_capable_noaudit(struct task_struct *tsk, int cap)
1852{
1853 int ret;
1854
1855 rcu_read_lock();
1856 ret = cap_capable(tsk, __task_cred(tsk), cap,
1857 SECURITY_CAP_NOAUDIT);
1858 rcu_read_unlock();
1859 return ret;
1786} 1860}
1787 1861
1788static inline int security_acct(struct file *file) 1862static inline int security_acct(struct file *file)
@@ -1835,32 +1909,22 @@ static inline int security_vm_enough_memory_kern(long pages)
1835 return cap_vm_enough_memory(current->mm, pages); 1909 return cap_vm_enough_memory(current->mm, pages);
1836} 1910}
1837 1911
1838static inline int security_bprm_alloc(struct linux_binprm *bprm) 1912static inline int security_bprm_set_creds(struct linux_binprm *bprm)
1839{ 1913{
1840 return 0; 1914 return cap_bprm_set_creds(bprm);
1841} 1915}
1842 1916
1843static inline void security_bprm_free(struct linux_binprm *bprm) 1917static inline int security_bprm_check(struct linux_binprm *bprm)
1844{ }
1845
1846static inline void security_bprm_apply_creds(struct linux_binprm *bprm, int unsafe)
1847{
1848 cap_bprm_apply_creds(bprm, unsafe);
1849}
1850
1851static inline void security_bprm_post_apply_creds(struct linux_binprm *bprm)
1852{ 1918{
1853 return; 1919 return 0;
1854} 1920}
1855 1921
1856static inline int security_bprm_set(struct linux_binprm *bprm) 1922static inline void security_bprm_committing_creds(struct linux_binprm *bprm)
1857{ 1923{
1858 return cap_bprm_set_security(bprm);
1859} 1924}
1860 1925
1861static inline int security_bprm_check(struct linux_binprm *bprm) 1926static inline void security_bprm_committed_creds(struct linux_binprm *bprm)
1862{ 1927{
1863 return 0;
1864} 1928}
1865 1929
1866static inline int security_bprm_secureexec(struct linux_binprm *bprm) 1930static inline int security_bprm_secureexec(struct linux_binprm *bprm)
@@ -1881,7 +1945,7 @@ static inline int security_sb_copy_data(char *orig, char *copy)
1881 return 0; 1945 return 0;
1882} 1946}
1883 1947
1884static inline int security_sb_kern_mount(struct super_block *sb, void *data) 1948static inline int security_sb_kern_mount(struct super_block *sb, int flags, void *data)
1885{ 1949{
1886 return 0; 1950 return 0;
1887} 1951}
@@ -2177,7 +2241,8 @@ static inline int security_file_receive(struct file *file)
2177 return 0; 2241 return 0;
2178} 2242}
2179 2243
2180static inline int security_dentry_open(struct file *file) 2244static inline int security_dentry_open(struct file *file,
2245 const struct cred *cred)
2181{ 2246{
2182 return 0; 2247 return 0;
2183} 2248}
@@ -2187,13 +2252,31 @@ static inline int security_task_create(unsigned long clone_flags)
2187 return 0; 2252 return 0;
2188} 2253}
2189 2254
2190static inline int security_task_alloc(struct task_struct *p) 2255static inline void security_cred_free(struct cred *cred)
2256{ }
2257
2258static inline int security_prepare_creds(struct cred *new,
2259 const struct cred *old,
2260 gfp_t gfp)
2191{ 2261{
2192 return 0; 2262 return 0;
2193} 2263}
2194 2264
2195static inline void security_task_free(struct task_struct *p) 2265static inline void security_commit_creds(struct cred *new,
2196{ } 2266 const struct cred *old)
2267{
2268}
2269
2270static inline int security_kernel_act_as(struct cred *cred, u32 secid)
2271{
2272 return 0;
2273}
2274
2275static inline int security_kernel_create_files_as(struct cred *cred,
2276 struct inode *inode)
2277{
2278 return 0;
2279}
2197 2280
2198static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2, 2281static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2,
2199 int flags) 2282 int flags)
@@ -2201,10 +2284,11 @@ static inline int security_task_setuid(uid_t id0, uid_t id1, uid_t id2,
2201 return 0; 2284 return 0;
2202} 2285}
2203 2286
2204static inline int security_task_post_setuid(uid_t old_ruid, uid_t old_euid, 2287static inline int security_task_fix_setuid(struct cred *new,
2205 uid_t old_suid, int flags) 2288 const struct cred *old,
2289 int flags)
2206{ 2290{
2207 return cap_task_post_setuid(old_ruid, old_euid, old_suid, flags); 2291 return cap_task_fix_setuid(new, old, flags);
2208} 2292}
2209 2293
2210static inline int security_task_setgid(gid_t id0, gid_t id1, gid_t id2, 2294static inline int security_task_setgid(gid_t id0, gid_t id1, gid_t id2,
@@ -2291,14 +2375,9 @@ static inline int security_task_wait(struct task_struct *p)
2291static inline int security_task_prctl(int option, unsigned long arg2, 2375static inline int security_task_prctl(int option, unsigned long arg2,
2292 unsigned long arg3, 2376 unsigned long arg3,
2293 unsigned long arg4, 2377 unsigned long arg4,
2294 unsigned long arg5, long *rc_p) 2378 unsigned long arg5)
2295{ 2379{
2296 return cap_task_prctl(option, arg2, arg3, arg3, arg5, rc_p); 2380 return cap_task_prctl(option, arg2, arg3, arg3, arg5);
2297}
2298
2299static inline void security_task_reparent_to_init(struct task_struct *p)
2300{
2301 cap_task_reparent_to_init(p);
2302} 2381}
2303 2382
2304static inline void security_task_to_inode(struct task_struct *p, struct inode *inode) 2383static inline void security_task_to_inode(struct task_struct *p, struct inode *inode)
@@ -2721,19 +2800,84 @@ static inline void security_skb_classify_flow(struct sk_buff *skb, struct flowi
2721 2800
2722#endif /* CONFIG_SECURITY_NETWORK_XFRM */ 2801#endif /* CONFIG_SECURITY_NETWORK_XFRM */
2723 2802
2803#ifdef CONFIG_SECURITY_PATH
2804int security_path_unlink(struct path *dir, struct dentry *dentry);
2805int security_path_mkdir(struct path *dir, struct dentry *dentry, int mode);
2806int security_path_rmdir(struct path *dir, struct dentry *dentry);
2807int security_path_mknod(struct path *dir, struct dentry *dentry, int mode,
2808 unsigned int dev);
2809int security_path_truncate(struct path *path, loff_t length,
2810 unsigned int time_attrs);
2811int security_path_symlink(struct path *dir, struct dentry *dentry,
2812 const char *old_name);
2813int security_path_link(struct dentry *old_dentry, struct path *new_dir,
2814 struct dentry *new_dentry);
2815int security_path_rename(struct path *old_dir, struct dentry *old_dentry,
2816 struct path *new_dir, struct dentry *new_dentry);
2817#else /* CONFIG_SECURITY_PATH */
2818static inline int security_path_unlink(struct path *dir, struct dentry *dentry)
2819{
2820 return 0;
2821}
2822
2823static inline int security_path_mkdir(struct path *dir, struct dentry *dentry,
2824 int mode)
2825{
2826 return 0;
2827}
2828
2829static inline int security_path_rmdir(struct path *dir, struct dentry *dentry)
2830{
2831 return 0;
2832}
2833
2834static inline int security_path_mknod(struct path *dir, struct dentry *dentry,
2835 int mode, unsigned int dev)
2836{
2837 return 0;
2838}
2839
2840static inline int security_path_truncate(struct path *path, loff_t length,
2841 unsigned int time_attrs)
2842{
2843 return 0;
2844}
2845
2846static inline int security_path_symlink(struct path *dir, struct dentry *dentry,
2847 const char *old_name)
2848{
2849 return 0;
2850}
2851
2852static inline int security_path_link(struct dentry *old_dentry,
2853 struct path *new_dir,
2854 struct dentry *new_dentry)
2855{
2856 return 0;
2857}
2858
2859static inline int security_path_rename(struct path *old_dir,
2860 struct dentry *old_dentry,
2861 struct path *new_dir,
2862 struct dentry *new_dentry)
2863{
2864 return 0;
2865}
2866#endif /* CONFIG_SECURITY_PATH */
2867
2724#ifdef CONFIG_KEYS 2868#ifdef CONFIG_KEYS
2725#ifdef CONFIG_SECURITY 2869#ifdef CONFIG_SECURITY
2726 2870
2727int security_key_alloc(struct key *key, struct task_struct *tsk, unsigned long flags); 2871int security_key_alloc(struct key *key, const struct cred *cred, unsigned long flags);
2728void security_key_free(struct key *key); 2872void security_key_free(struct key *key);
2729int security_key_permission(key_ref_t key_ref, 2873int security_key_permission(key_ref_t key_ref,
2730 struct task_struct *context, key_perm_t perm); 2874 const struct cred *cred, key_perm_t perm);
2731int security_key_getsecurity(struct key *key, char **_buffer); 2875int security_key_getsecurity(struct key *key, char **_buffer);
2732 2876
2733#else 2877#else
2734 2878
2735static inline int security_key_alloc(struct key *key, 2879static inline int security_key_alloc(struct key *key,
2736 struct task_struct *tsk, 2880 const struct cred *cred,
2737 unsigned long flags) 2881 unsigned long flags)
2738{ 2882{
2739 return 0; 2883 return 0;
@@ -2744,7 +2888,7 @@ static inline void security_key_free(struct key *key)
2744} 2888}
2745 2889
2746static inline int security_key_permission(key_ref_t key_ref, 2890static inline int security_key_permission(key_ref_t key_ref,
2747 struct task_struct *context, 2891 const struct cred *cred,
2748 key_perm_t perm) 2892 key_perm_t perm)
2749{ 2893{
2750 return 0; 2894 return 0;
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index b3dfa72f13b9..40ea5058c2ec 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -50,10 +50,11 @@ int seq_path(struct seq_file *, struct path *, char *);
50int seq_dentry(struct seq_file *, struct dentry *, char *); 50int seq_dentry(struct seq_file *, struct dentry *, char *);
51int seq_path_root(struct seq_file *m, struct path *path, struct path *root, 51int seq_path_root(struct seq_file *m, struct path *path, struct path *root,
52 char *esc); 52 char *esc);
53int seq_bitmap(struct seq_file *m, unsigned long *bits, unsigned int nr_bits); 53int seq_bitmap(struct seq_file *m, const unsigned long *bits,
54static inline int seq_cpumask(struct seq_file *m, cpumask_t *mask) 54 unsigned int nr_bits);
55static inline int seq_cpumask(struct seq_file *m, const struct cpumask *mask)
55{ 56{
56 return seq_bitmap(m, mask->bits, NR_CPUS); 57 return seq_bitmap(m, mask->bits, nr_cpu_ids);
57} 58}
58 59
59static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask) 60static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask)
diff --git a/include/linux/serial.h b/include/linux/serial.h
index 1ea8d9265bf6..9136cc5608c3 100644
--- a/include/linux/serial.h
+++ b/include/linux/serial.h
@@ -10,8 +10,9 @@
10#ifndef _LINUX_SERIAL_H 10#ifndef _LINUX_SERIAL_H
11#define _LINUX_SERIAL_H 11#define _LINUX_SERIAL_H
12 12
13#ifdef __KERNEL__
14#include <linux/types.h> 13#include <linux/types.h>
14
15#ifdef __KERNEL__
15#include <asm/page.h> 16#include <asm/page.h>
16 17
17/* 18/*
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 3d37c94abbc8..d4d2a78ad43e 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -28,6 +28,9 @@ struct plat_serial8250_port {
28 unsigned char iotype; /* UPIO_* */ 28 unsigned char iotype; /* UPIO_* */
29 unsigned char hub6; 29 unsigned char hub6;
30 upf_t flags; /* UPF_* flags */ 30 upf_t flags; /* UPF_* flags */
31 unsigned int type; /* If UPF_FIXED_TYPE */
32 unsigned int (*serial_in)(struct uart_port *, int);
33 void (*serial_out)(struct uart_port *, int, int);
31}; 34};
32 35
33/* 36/*
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 4e4f1277f3bf..90bbbf0b1161 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -40,7 +40,8 @@
40#define PORT_NS16550A 14 40#define PORT_NS16550A 14
41#define PORT_XSCALE 15 41#define PORT_XSCALE 15
42#define PORT_RM9000 16 /* PMC-Sierra RM9xxx internal UART */ 42#define PORT_RM9000 16 /* PMC-Sierra RM9xxx internal UART */
43#define PORT_MAX_8250 16 /* max port ID */ 43#define PORT_OCTEON 17 /* Cavium OCTEON internal UART */
44#define PORT_MAX_8250 17 /* max port ID */
44 45
45/* 46/*
46 * ARM specific type numbers. These are not currently guaranteed 47 * ARM specific type numbers. These are not currently guaranteed
@@ -158,6 +159,11 @@
158/* SH-SCI */ 159/* SH-SCI */
159#define PORT_SCIFA 83 160#define PORT_SCIFA 83
160 161
162#define PORT_S3C6400 84
163
164/* NWPSERIAL */
165#define PORT_NWPSERIAL 85
166
161#ifdef __KERNEL__ 167#ifdef __KERNEL__
162 168
163#include <linux/compiler.h> 169#include <linux/compiler.h>
@@ -246,6 +252,8 @@ struct uart_port {
246 spinlock_t lock; /* port lock */ 252 spinlock_t lock; /* port lock */
247 unsigned long iobase; /* in/out[bwl] */ 253 unsigned long iobase; /* in/out[bwl] */
248 unsigned char __iomem *membase; /* read/write[bwl] */ 254 unsigned char __iomem *membase; /* read/write[bwl] */
255 unsigned int (*serial_in)(struct uart_port *, int);
256 void (*serial_out)(struct uart_port *, int, int);
249 unsigned int irq; /* irq number */ 257 unsigned int irq; /* irq number */
250 unsigned int uartclk; /* base uart clock */ 258 unsigned int uartclk; /* base uart clock */
251 unsigned int fifosize; /* tx fifo size */ 259 unsigned int fifosize; /* tx fifo size */
@@ -291,6 +299,8 @@ struct uart_port {
291#define UPF_MAGIC_MULTIPLIER ((__force upf_t) (1 << 16)) 299#define UPF_MAGIC_MULTIPLIER ((__force upf_t) (1 << 16))
292#define UPF_CONS_FLOW ((__force upf_t) (1 << 23)) 300#define UPF_CONS_FLOW ((__force upf_t) (1 << 23))
293#define UPF_SHARE_IRQ ((__force upf_t) (1 << 24)) 301#define UPF_SHARE_IRQ ((__force upf_t) (1 << 24))
302/* The exact UART type is known and should not be probed. */
303#define UPF_FIXED_TYPE ((__force upf_t) (1 << 27))
294#define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28)) 304#define UPF_BOOT_AUTOCONF ((__force upf_t) (1 << 28))
295#define UPF_FIXED_PORT ((__force upf_t) (1 << 29)) 305#define UPF_FIXED_PORT ((__force upf_t) (1 << 29))
296#define UPF_DEAD ((__force upf_t) (1 << 30)) 306#define UPF_DEAD ((__force upf_t) (1 << 30))
@@ -314,35 +324,13 @@ struct uart_port {
314}; 324};
315 325
316/* 326/*
317 * This is the state information which is persistent across opens.
318 * The low level driver must not to touch any elements contained
319 * within.
320 */
321struct uart_state {
322 unsigned int close_delay; /* msec */
323 unsigned int closing_wait; /* msec */
324
325#define USF_CLOSING_WAIT_INF (0)
326#define USF_CLOSING_WAIT_NONE (~0U)
327
328 int count;
329 int pm_state;
330 struct uart_info *info;
331 struct uart_port *port;
332
333 struct mutex mutex;
334};
335
336#define UART_XMIT_SIZE PAGE_SIZE
337
338typedef unsigned int __bitwise__ uif_t;
339
340/*
341 * This is the state information which is only valid when the port 327 * This is the state information which is only valid when the port
342 * is open; it may be freed by the core driver once the device has 328 * is open; it may be cleared the core driver once the device has
343 * been closed. Either the low level driver or the core can modify 329 * been closed. Either the low level driver or the core can modify
344 * stuff here. 330 * stuff here.
345 */ 331 */
332typedef unsigned int __bitwise__ uif_t;
333
346struct uart_info { 334struct uart_info {
347 struct tty_port port; 335 struct tty_port port;
348 struct circ_buf xmit; 336 struct circ_buf xmit;
@@ -364,6 +352,29 @@ struct uart_info {
364 wait_queue_head_t delta_msr_wait; 352 wait_queue_head_t delta_msr_wait;
365}; 353};
366 354
355/*
356 * This is the state information which is persistent across opens.
357 * The low level driver must not to touch any elements contained
358 * within.
359 */
360struct uart_state {
361 unsigned int close_delay; /* msec */
362 unsigned int closing_wait; /* msec */
363
364#define USF_CLOSING_WAIT_INF (0)
365#define USF_CLOSING_WAIT_NONE (~0U)
366
367 int count;
368 int pm_state;
369 struct uart_info info;
370 struct uart_port *port;
371
372 struct mutex mutex;
373};
374
375#define UART_XMIT_SIZE PAGE_SIZE
376
377
367/* number of characters left in xmit buffer before we ask for more */ 378/* number of characters left in xmit buffer before we ask for more */
368#define WAKEUP_CHARS 256 379#define WAKEUP_CHARS 256
369 380
@@ -437,8 +448,13 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port);
437#define uart_circ_chars_free(circ) \ 448#define uart_circ_chars_free(circ) \
438 (CIRC_SPACE((circ)->head, (circ)->tail, UART_XMIT_SIZE)) 449 (CIRC_SPACE((circ)->head, (circ)->tail, UART_XMIT_SIZE))
439 450
440#define uart_tx_stopped(portp) \ 451static inline int uart_tx_stopped(struct uart_port *port)
441 ((portp)->info->port.tty->stopped || (portp)->info->port.tty->hw_stopped) 452{
453 struct tty_struct *tty = port->info->port.tty;
454 if(tty->stopped || tty->hw_stopped)
455 return 1;
456 return 0;
457}
442 458
443/* 459/*
444 * The following are helper functions for the low level drivers. 460 * The following are helper functions for the low level drivers.
@@ -449,7 +465,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
449#ifdef SUPPORT_SYSRQ 465#ifdef SUPPORT_SYSRQ
450 if (port->sysrq) { 466 if (port->sysrq) {
451 if (ch && time_before(jiffies, port->sysrq)) { 467 if (ch && time_before(jiffies, port->sysrq)) {
452 handle_sysrq(ch, port->info ? port->info->port.tty : NULL); 468 handle_sysrq(ch, port->info->port.tty);
453 port->sysrq = 0; 469 port->sysrq = 0;
454 return 1; 470 return 1;
455 } 471 }
diff --git a/include/linux/serio.h b/include/linux/serio.h
index 25641d9e0ea8..1bcb357a01a1 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -213,5 +213,6 @@ static inline void serio_unpin_driver(struct serio *serio)
213#define SERIO_ZHENHUA 0x36 213#define SERIO_ZHENHUA 0x36
214#define SERIO_INEXIO 0x37 214#define SERIO_INEXIO 0x37
215#define SERIO_TOUCHIT213 0x37 215#define SERIO_TOUCHIT213 0x37
216#define SERIO_W8001 0x39
216 217
217#endif 218#endif
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 2725f4e5a9bf..cf2cb50f77d1 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -250,6 +250,9 @@ typedef unsigned char *sk_buff_data_t;
250 * @tc_verd: traffic control verdict 250 * @tc_verd: traffic control verdict
251 * @ndisc_nodetype: router type (from link layer) 251 * @ndisc_nodetype: router type (from link layer)
252 * @do_not_encrypt: set to prevent encryption of this frame 252 * @do_not_encrypt: set to prevent encryption of this frame
253 * @requeue: set to indicate that the wireless core should attempt
254 * a software retry on this frame if we failed to
255 * receive an ACK for it
253 * @dma_cookie: a cookie to one of several possible DMA operations 256 * @dma_cookie: a cookie to one of several possible DMA operations
254 * done by skb DMA functions 257 * done by skb DMA functions
255 * @secmark: security marking 258 * @secmark: security marking
@@ -269,8 +272,9 @@ struct sk_buff {
269 struct dst_entry *dst; 272 struct dst_entry *dst;
270 struct rtable *rtable; 273 struct rtable *rtable;
271 }; 274 };
275#ifdef CONFIG_XFRM
272 struct sec_path *sp; 276 struct sec_path *sp;
273 277#endif
274 /* 278 /*
275 * This is the control buffer. It is free to use for every 279 * This is the control buffer. It is free to use for every
276 * layer. Please put your private variables there. If you 280 * layer. Please put your private variables there. If you
@@ -325,6 +329,7 @@ struct sk_buff {
325#endif 329#endif
326#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE) 330#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
327 __u8 do_not_encrypt:1; 331 __u8 do_not_encrypt:1;
332 __u8 requeue:1;
328#endif 333#endif
329 /* 0/13/14 bit hole */ 334 /* 0/13/14 bit hole */
330 335
@@ -488,6 +493,19 @@ static inline bool skb_queue_is_last(const struct sk_buff_head *list,
488} 493}
489 494
490/** 495/**
496 * skb_queue_is_first - check if skb is the first entry in the queue
497 * @list: queue head
498 * @skb: buffer
499 *
500 * Returns true if @skb is the first buffer on the list.
501 */
502static inline bool skb_queue_is_first(const struct sk_buff_head *list,
503 const struct sk_buff *skb)
504{
505 return (skb->prev == (struct sk_buff *) list);
506}
507
508/**
491 * skb_queue_next - return the next packet in the queue 509 * skb_queue_next - return the next packet in the queue
492 * @list: queue head 510 * @list: queue head
493 * @skb: current buffer 511 * @skb: current buffer
@@ -506,6 +524,24 @@ static inline struct sk_buff *skb_queue_next(const struct sk_buff_head *list,
506} 524}
507 525
508/** 526/**
527 * skb_queue_prev - return the prev packet in the queue
528 * @list: queue head
529 * @skb: current buffer
530 *
531 * Return the prev packet in @list before @skb. It is only valid to
532 * call this if skb_queue_is_first() evaluates to false.
533 */
534static inline struct sk_buff *skb_queue_prev(const struct sk_buff_head *list,
535 const struct sk_buff *skb)
536{
537 /* This BUG_ON may seem severe, but if we just return then we
538 * are going to dereference garbage.
539 */
540 BUG_ON(skb_queue_is_first(list, skb));
541 return skb->prev;
542}
543
544/**
509 * skb_get - reference buffer 545 * skb_get - reference buffer
510 * @skb: buffer to reference 546 * @skb: buffer to reference
511 * 547 *
@@ -1647,8 +1683,12 @@ extern int skb_splice_bits(struct sk_buff *skb,
1647extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to); 1683extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to);
1648extern void skb_split(struct sk_buff *skb, 1684extern void skb_split(struct sk_buff *skb,
1649 struct sk_buff *skb1, const u32 len); 1685 struct sk_buff *skb1, const u32 len);
1686extern int skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
1687 int shiftlen);
1650 1688
1651extern struct sk_buff *skb_segment(struct sk_buff *skb, int features); 1689extern struct sk_buff *skb_segment(struct sk_buff *skb, int features);
1690extern int skb_gro_receive(struct sk_buff **head,
1691 struct sk_buff *skb);
1652 1692
1653static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, 1693static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
1654 int len, void *buffer) 1694 int len, void *buffer)
@@ -1864,6 +1904,18 @@ static inline void skb_copy_queue_mapping(struct sk_buff *to, const struct sk_bu
1864 to->queue_mapping = from->queue_mapping; 1904 to->queue_mapping = from->queue_mapping;
1865} 1905}
1866 1906
1907#ifdef CONFIG_XFRM
1908static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
1909{
1910 return skb->sp;
1911}
1912#else
1913static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
1914{
1915 return NULL;
1916}
1917#endif
1918
1867static inline int skb_is_gso(const struct sk_buff *skb) 1919static inline int skb_is_gso(const struct sk_buff *skb)
1868{ 1920{
1869 return skb_shinfo(skb)->gso_size; 1921 return skb_shinfo(skb)->gso_size;
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 000da12b5cf0..f96d13c281e8 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -253,9 +253,9 @@ static inline void *kmem_cache_alloc_node(struct kmem_cache *cachep,
253 * request comes from. 253 * request comes from.
254 */ 254 */
255#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) 255#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB)
256extern void *__kmalloc_track_caller(size_t, gfp_t, void*); 256extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long);
257#define kmalloc_track_caller(size, flags) \ 257#define kmalloc_track_caller(size, flags) \
258 __kmalloc_track_caller(size, flags, __builtin_return_address(0)) 258 __kmalloc_track_caller(size, flags, _RET_IP_)
259#else 259#else
260#define kmalloc_track_caller(size, flags) \ 260#define kmalloc_track_caller(size, flags) \
261 __kmalloc(size, flags) 261 __kmalloc(size, flags)
@@ -271,10 +271,10 @@ extern void *__kmalloc_track_caller(size_t, gfp_t, void*);
271 * allocation request comes from. 271 * allocation request comes from.
272 */ 272 */
273#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) 273#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB)
274extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, void *); 274extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long);
275#define kmalloc_node_track_caller(size, flags, node) \ 275#define kmalloc_node_track_caller(size, flags, node) \
276 __kmalloc_node_track_caller(size, flags, node, \ 276 __kmalloc_node_track_caller(size, flags, node, \
277 __builtin_return_address(0)) 277 _RET_IP_)
278#else 278#else
279#define kmalloc_node_track_caller(size, flags, node) \ 279#define kmalloc_node_track_caller(size, flags, node) \
280 __kmalloc_node(size, flags, node) 280 __kmalloc_node(size, flags, node)
@@ -285,7 +285,7 @@ extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, void *);
285#define kmalloc_node_track_caller(size, flags, node) \ 285#define kmalloc_node_track_caller(size, flags, node) \
286 kmalloc_track_caller(size, flags) 286 kmalloc_track_caller(size, flags)
287 287
288#endif /* DEBUG_SLAB */ 288#endif /* CONFIG_NUMA */
289 289
290/* 290/*
291 * Shortcuts 291 * Shortcuts
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 6e7ba16ff454..b82466968101 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -21,6 +21,9 @@ struct call_single_data {
21 u16 priv; 21 u16 priv;
22}; 22};
23 23
24/* total number of cpus in this system (may exceed NR_CPUS) */
25extern unsigned int total_cpus;
26
24#ifdef CONFIG_SMP 27#ifdef CONFIG_SMP
25 28
26#include <linux/preempt.h> 29#include <linux/preempt.h>
@@ -64,15 +67,16 @@ extern void smp_cpus_done(unsigned int max_cpus);
64 * Call a function on all other processors 67 * Call a function on all other processors
65 */ 68 */
66int smp_call_function(void(*func)(void *info), void *info, int wait); 69int smp_call_function(void(*func)(void *info), void *info, int wait);
67/* Deprecated: use smp_call_function_many() which uses a cpumask ptr. */ 70void smp_call_function_many(const struct cpumask *mask,
68int smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info, 71 void (*func)(void *info), void *info, bool wait);
69 int wait);
70 72
71static inline void smp_call_function_many(const struct cpumask *mask, 73/* Deprecated: Use smp_call_function_many which takes a pointer to the mask. */
72 void (*func)(void *info), void *info, 74static inline int
73 int wait) 75smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info,
76 int wait)
74{ 77{
75 smp_call_function_mask(*mask, func, info, wait); 78 smp_call_function_many(&mask, func, info, wait);
79 return 0;
76} 80}
77 81
78int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, 82int smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
diff --git a/include/linux/smsc911x.h b/include/linux/smsc911x.h
new file mode 100644
index 000000000000..1cbf0313adde
--- /dev/null
+++ b/include/linux/smsc911x.h
@@ -0,0 +1,47 @@
1/***************************************************************************
2 *
3 * Copyright (C) 2004-2008 SMSC
4 * Copyright (C) 2005-2008 ARM
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 *
20 ***************************************************************************/
21#ifndef __LINUX_SMSC911X_H__
22#define __LINUX_SMSC911X_H__
23
24#include <linux/phy.h>
25
26/* platform_device configuration data, should be assigned to
27 * the platform_device's dev.platform_data */
28struct smsc911x_platform_config {
29 unsigned int irq_polarity;
30 unsigned int irq_type;
31 unsigned int flags;
32 phy_interface_t phy_interface;
33};
34
35/* Constants for platform_device irq polarity configuration */
36#define SMSC911X_IRQ_POLARITY_ACTIVE_LOW 0
37#define SMSC911X_IRQ_POLARITY_ACTIVE_HIGH 1
38
39/* Constants for platform_device irq type configuration */
40#define SMSC911X_IRQ_TYPE_OPEN_DRAIN 0
41#define SMSC911X_IRQ_TYPE_PUSH_PULL 1
42
43/* Constants for flags */
44#define SMSC911X_USE_16BIT (BIT(0))
45#define SMSC911X_USE_32BIT (BIT(1))
46
47#endif /* __LINUX_SMSC911X_H__ */
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 7a6e6bba4a71..aee3f1e1d1ce 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -216,6 +216,9 @@ enum
216 LINUX_MIB_TCPSPURIOUSRTOS, /* TCPSpuriousRTOs */ 216 LINUX_MIB_TCPSPURIOUSRTOS, /* TCPSpuriousRTOs */
217 LINUX_MIB_TCPMD5NOTFOUND, /* TCPMD5NotFound */ 217 LINUX_MIB_TCPMD5NOTFOUND, /* TCPMD5NotFound */
218 LINUX_MIB_TCPMD5UNEXPECTED, /* TCPMD5Unexpected */ 218 LINUX_MIB_TCPMD5UNEXPECTED, /* TCPMD5Unexpected */
219 LINUX_MIB_SACKSHIFTED,
220 LINUX_MIB_SACKMERGED,
221 LINUX_MIB_SACKSHIFTFALLBACK,
219 __LINUX_MIB_MAX 222 __LINUX_MIB_MAX
220}; 223};
221 224
diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h
index a3626aedaec9..0f4eb165f254 100644
--- a/include/linux/spi/mmc_spi.h
+++ b/include/linux/spi/mmc_spi.h
@@ -1,9 +1,10 @@
1#ifndef __LINUX_SPI_MMC_SPI_H 1#ifndef __LINUX_SPI_MMC_SPI_H
2#define __LINUX_SPI_MMC_SPI_H 2#define __LINUX_SPI_MMC_SPI_H
3 3
4#include <linux/device.h>
5#include <linux/spi/spi.h>
4#include <linux/interrupt.h> 6#include <linux/interrupt.h>
5 7
6struct device;
7struct mmc_host; 8struct mmc_host;
8 9
9/* Put this in platform_data of a device being used to manage an MMC/SD 10/* Put this in platform_data of a device being used to manage an MMC/SD
@@ -41,4 +42,16 @@ struct mmc_spi_platform_data {
41 void (*setpower)(struct device *, unsigned int maskval); 42 void (*setpower)(struct device *, unsigned int maskval);
42}; 43};
43 44
45#ifdef CONFIG_OF
46extern struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi);
47extern void mmc_spi_put_pdata(struct spi_device *spi);
48#else
49static inline struct mmc_spi_platform_data *
50mmc_spi_get_pdata(struct spi_device *spi)
51{
52 return spi->dev.platform_data;
53}
54static inline void mmc_spi_put_pdata(struct spi_device *spi) {}
55#endif /* CONFIG_OF */
56
44#endif /* __LINUX_SPI_MMC_SPI_H */ 57#endif /* __LINUX_SPI_MMC_SPI_H */
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 4be01bb44377..68bb1c501d0d 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -19,6 +19,8 @@
19#ifndef __LINUX_SPI_H 19#ifndef __LINUX_SPI_H
20#define __LINUX_SPI_H 20#define __LINUX_SPI_H
21 21
22#include <linux/device.h>
23
22/* 24/*
23 * INTERFACES between SPI master-side drivers and SPI infrastructure. 25 * INTERFACES between SPI master-side drivers and SPI infrastructure.
24 * (There's no SPI slave support for Linux yet...) 26 * (There's no SPI slave support for Linux yet...)
@@ -325,9 +327,9 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
325 * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped 327 * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped
326 * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped 328 * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped
327 * @len: size of rx and tx buffers (in bytes) 329 * @len: size of rx and tx buffers (in bytes)
328 * @speed_hz: Select a speed other then the device default for this 330 * @speed_hz: Select a speed other than the device default for this
329 * transfer. If 0 the default (from @spi_device) is used. 331 * transfer. If 0 the default (from @spi_device) is used.
330 * @bits_per_word: select a bits_per_word other then the device default 332 * @bits_per_word: select a bits_per_word other than the device default
331 * for this transfer. If 0 the default (from @spi_device) is used. 333 * for this transfer. If 0 the default (from @spi_device) is used.
332 * @cs_change: affects chipselect after this transfer completes 334 * @cs_change: affects chipselect after this transfer completes
333 * @delay_usecs: microseconds to delay after this transfer before 335 * @delay_usecs: microseconds to delay after this transfer before
diff --git a/include/linux/spi/spi_gpio.h b/include/linux/spi/spi_gpio.h
new file mode 100644
index 000000000000..0f01a0f1f40c
--- /dev/null
+++ b/include/linux/spi/spi_gpio.h
@@ -0,0 +1,60 @@
1#ifndef __LINUX_SPI_GPIO_H
2#define __LINUX_SPI_GPIO_H
3
4/*
5 * For each bitbanged SPI bus, set up a platform_device node with:
6 * - name "spi_gpio"
7 * - id the same as the SPI bus number it implements
8 * - dev.platform data pointing to a struct spi_gpio_platform_data
9 *
10 * Or, see the driver code for information about speedups that are
11 * possible on platforms that support inlined access for GPIOs (no
12 * spi_gpio_platform_data is used).
13 *
14 * Use spi_board_info with these busses in the usual way, being sure
15 * that the controller_data being the GPIO used for each device's
16 * chipselect:
17 *
18 * static struct spi_board_info ... [] = {
19 * ...
20 * // this slave uses GPIO 42 for its chipselect
21 * .controller_data = (void *) 42,
22 * ...
23 * // this one uses GPIO 86 for its chipselect
24 * .controller_data = (void *) 86,
25 * ...
26 * };
27 *
28 * If the bitbanged bus is later switched to a "native" controller,
29 * that platform_device and controller_data should be removed.
30 */
31
32/**
33 * struct spi_gpio_platform_data - parameter for bitbanged SPI master
34 * @sck: number of the GPIO used for clock output
35 * @mosi: number of the GPIO used for Master Output, Slave In (MOSI) data
36 * @miso: number of the GPIO used for Master Input, Slave Output (MISO) data
37 * @num_chipselect: how many slaves to allow
38 *
39 * All GPIO signals used with the SPI bus managed through this driver
40 * (chipselects, MOSI, MISO, SCK) must be configured as GPIOs, instead
41 * of some alternate function.
42 *
43 * It can be convenient to use this driver with pins that have alternate
44 * functions associated with a "native" SPI controller if a driver for that
45 * controller is not available, or is missing important functionality.
46 *
47 * On platforms which can do so, configure MISO with a weak pullup unless
48 * there's an external pullup on that signal. That saves power by avoiding
49 * floating signals. (A weak pulldown would save power too, but many
50 * drivers expect to see all-ones data as the no slave "response".)
51 */
52struct spi_gpio_platform_data {
53 unsigned sck;
54 unsigned mosi;
55 unsigned miso;
56
57 u16 num_chipselect;
58};
59
60#endif /* __LINUX_SPI_GPIO_H */
diff --git a/include/linux/spi/tdo24m.h b/include/linux/spi/tdo24m.h
new file mode 100644
index 000000000000..7572d4e1fe76
--- /dev/null
+++ b/include/linux/spi/tdo24m.h
@@ -0,0 +1,13 @@
1#ifndef __TDO24M_H__
2#define __TDO24M_H__
3
4enum tdo24m_model {
5 TDO24M,
6 TDO35S,
7};
8
9struct tdo24m_platform_data {
10 enum tdo24m_model model;
11};
12
13#endif /* __TDO24M_H__ */
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index faf1519b5adc..baba3a23a814 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -23,7 +23,7 @@
23 * 23 *
24 * This can be thought of as a very heavy write lock, equivalent to 24 * This can be thought of as a very heavy write lock, equivalent to
25 * grabbing every spinlock in the kernel. */ 25 * grabbing every spinlock in the kernel. */
26int stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus); 26int stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus);
27 27
28/** 28/**
29 * __stop_machine: freeze the machine on all CPUs and run this function 29 * __stop_machine: freeze the machine on all CPUs and run this function
@@ -34,11 +34,29 @@ int stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus);
34 * Description: This is a special version of the above, which assumes cpus 34 * Description: This is a special version of the above, which assumes cpus
35 * won't come or go while it's being called. Used by hotplug cpu. 35 * won't come or go while it's being called. Used by hotplug cpu.
36 */ 36 */
37int __stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus); 37int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus);
38
39/**
40 * stop_machine_create: create all stop_machine threads
41 *
42 * Description: This causes all stop_machine threads to be created before
43 * stop_machine actually gets called. This can be used by subsystems that
44 * need a non failing stop_machine infrastructure.
45 */
46int stop_machine_create(void);
47
48/**
49 * stop_machine_destroy: destroy all stop_machine threads
50 *
51 * Description: This causes all stop_machine threads which were created with
52 * stop_machine_create to be destroyed again.
53 */
54void stop_machine_destroy(void);
55
38#else 56#else
39 57
40static inline int stop_machine(int (*fn)(void *), void *data, 58static inline int stop_machine(int (*fn)(void *), void *data,
41 const cpumask_t *cpus) 59 const struct cpumask *cpus)
42{ 60{
43 int ret; 61 int ret;
44 local_irq_disable(); 62 local_irq_disable();
@@ -46,5 +64,9 @@ static inline int stop_machine(int (*fn)(void *), void *data,
46 local_irq_enable(); 64 local_irq_enable();
47 return ret; 65 return ret;
48} 66}
67
68static inline int stop_machine_create(void) { return 0; }
69static inline void stop_machine_destroy(void) { }
70
49#endif /* CONFIG_SMP */ 71#endif /* CONFIG_SMP */
50#endif /* _LINUX_STOP_MACHINE */ 72#endif /* _LINUX_STOP_MACHINE */
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 6f0ee1b84a4f..c39a21040dcb 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -58,6 +58,7 @@ struct rpc_clnt {
58 struct rpc_timeout cl_timeout_default; 58 struct rpc_timeout cl_timeout_default;
59 struct rpc_program * cl_program; 59 struct rpc_program * cl_program;
60 char cl_inline_name[32]; 60 char cl_inline_name[32];
61 char *cl_principal; /* target to authenticate to */
61}; 62};
62 63
63/* 64/*
@@ -108,6 +109,7 @@ struct rpc_create_args {
108 u32 version; 109 u32 version;
109 rpc_authflavor_t authflavor; 110 rpc_authflavor_t authflavor;
110 unsigned long flags; 111 unsigned long flags;
112 char *client_name;
111}; 113};
112 114
113/* Values for "flags" field */ 115/* Values for "flags" field */
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index 51b977a4ca20..cea764c2359f 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -15,6 +15,7 @@ struct rpc_pipe_ops {
15 ssize_t (*upcall)(struct file *, struct rpc_pipe_msg *, char __user *, size_t); 15 ssize_t (*upcall)(struct file *, struct rpc_pipe_msg *, char __user *, size_t);
16 ssize_t (*downcall)(struct file *, const char __user *, size_t); 16 ssize_t (*downcall)(struct file *, const char __user *, size_t);
17 void (*release_pipe)(struct inode *); 17 void (*release_pipe)(struct inode *);
18 int (*open_pipe)(struct inode *);
18 void (*destroy_msg)(struct rpc_pipe_msg *); 19 void (*destroy_msg)(struct rpc_pipe_msg *);
19}; 20};
20 21
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 3afe7fb403b2..3435d24bfe55 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -58,10 +58,13 @@ struct svc_serv {
58 struct svc_stat * sv_stats; /* RPC statistics */ 58 struct svc_stat * sv_stats; /* RPC statistics */
59 spinlock_t sv_lock; 59 spinlock_t sv_lock;
60 unsigned int sv_nrthreads; /* # of server threads */ 60 unsigned int sv_nrthreads; /* # of server threads */
61 unsigned int sv_maxconn; /* max connections allowed or
62 * '0' causing max to be based
63 * on number of threads. */
64
61 unsigned int sv_max_payload; /* datagram payload size */ 65 unsigned int sv_max_payload; /* datagram payload size */
62 unsigned int sv_max_mesg; /* max_payload + 1 page for overheads */ 66 unsigned int sv_max_mesg; /* max_payload + 1 page for overheads */
63 unsigned int sv_xdrsize; /* XDR buffer size */ 67 unsigned int sv_xdrsize; /* XDR buffer size */
64
65 struct list_head sv_permsocks; /* all permanent sockets */ 68 struct list_head sv_permsocks; /* all permanent sockets */
66 struct list_head sv_tempsocks; /* all temporary sockets */ 69 struct list_head sv_tempsocks; /* all temporary sockets */
67 int sv_tmpcnt; /* count of temporary sockets */ 70 int sv_tmpcnt; /* count of temporary sockets */
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 6fd7b016517f..0127daca4354 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -139,14 +139,14 @@ static inline char *__svc_print_addr(struct sockaddr *addr,
139{ 139{
140 switch (addr->sa_family) { 140 switch (addr->sa_family) {
141 case AF_INET: 141 case AF_INET:
142 snprintf(buf, len, "%u.%u.%u.%u, port=%u", 142 snprintf(buf, len, "%pI4, port=%u",
143 NIPQUAD(((struct sockaddr_in *) addr)->sin_addr), 143 &((struct sockaddr_in *)addr)->sin_addr,
144 ntohs(((struct sockaddr_in *) addr)->sin_port)); 144 ntohs(((struct sockaddr_in *) addr)->sin_port));
145 break; 145 break;
146 146
147 case AF_INET6: 147 case AF_INET6:
148 snprintf(buf, len, "%x:%x:%x:%x:%x:%x:%x:%x, port=%u", 148 snprintf(buf, len, "%pI6, port=%u",
149 NIP6(((struct sockaddr_in6 *) addr)->sin6_addr), 149 &((struct sockaddr_in6 *)addr)->sin6_addr,
150 ntohs(((struct sockaddr_in6 *) addr)->sin6_port)); 150 ntohs(((struct sockaddr_in6 *) addr)->sin6_port));
151 break; 151 break;
152 152
diff --git a/include/linux/sunrpc/svcauth_gss.h b/include/linux/sunrpc/svcauth_gss.h
index c9165d9771a8..ca7d725861fc 100644
--- a/include/linux/sunrpc/svcauth_gss.h
+++ b/include/linux/sunrpc/svcauth_gss.h
@@ -20,6 +20,7 @@ int gss_svc_init(void);
20void gss_svc_shutdown(void); 20void gss_svc_shutdown(void);
21int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name); 21int svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name);
22u32 svcauth_gss_flavor(struct auth_domain *dom); 22u32 svcauth_gss_flavor(struct auth_domain *dom);
23char *svc_gss_principal(struct svc_rqst *);
23 24
24#endif /* __KERNEL__ */ 25#endif /* __KERNEL__ */
25#endif /* _LINUX_SUNRPC_SVCAUTH_GSS_H */ 26#endif /* _LINUX_SUNRPC_SVCAUTH_GSS_H */
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index e4057d729f03..49e1eb454465 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -37,21 +37,6 @@ struct xdr_netobj {
37typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj); 37typedef int (*kxdrproc_t)(void *rqstp, __be32 *data, void *obj);
38 38
39/* 39/*
40 * We're still requiring the BKL in the xdr code until it's been
41 * more carefully audited, at which point this wrapper will become
42 * unnecessary.
43 */
44static inline int rpc_call_xdrproc(kxdrproc_t xdrproc, void *rqstp, __be32 *data, void *obj)
45{
46 int ret;
47
48 lock_kernel();
49 ret = xdrproc(rqstp, data, obj);
50 unlock_kernel();
51 return ret;
52}
53
54/*
55 * Basic structure for transmission/reception of a client XDR message. 40 * Basic structure for transmission/reception of a client XDR message.
56 * Features a header (for a linear buffer containing RPC headers 41 * Features a header (for a linear buffer containing RPC headers
57 * and the data payload for short messages), and then an array of 42 * and the data payload for short messages), and then an array of
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 4d80a118d538..11fc71d50c1e 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -76,8 +76,7 @@ struct rpc_rqst {
76 struct list_head rq_list; 76 struct list_head rq_list;
77 77
78 __u32 * rq_buffer; /* XDR encode buffer */ 78 __u32 * rq_buffer; /* XDR encode buffer */
79 size_t rq_bufsize, 79 size_t rq_callsize,
80 rq_callsize,
81 rq_rcvsize; 80 rq_rcvsize;
82 81
83 struct xdr_buf rq_private_buf; /* The receive buffer 82 struct xdr_buf rq_private_buf; /* The receive buffer
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 2ce8207686e2..2b409c44db83 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -232,6 +232,11 @@ extern unsigned long get_safe_page(gfp_t gfp_mask);
232 232
233extern void hibernation_set_ops(struct platform_hibernation_ops *ops); 233extern void hibernation_set_ops(struct platform_hibernation_ops *ops);
234extern int hibernate(void); 234extern int hibernate(void);
235extern int hibernate_nvs_register(unsigned long start, unsigned long size);
236extern int hibernate_nvs_alloc(void);
237extern void hibernate_nvs_free(void);
238extern void hibernate_nvs_save(void);
239extern void hibernate_nvs_restore(void);
235#else /* CONFIG_HIBERNATION */ 240#else /* CONFIG_HIBERNATION */
236static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } 241static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
237static inline void swsusp_set_page_free(struct page *p) {} 242static inline void swsusp_set_page_free(struct page *p) {}
@@ -239,6 +244,14 @@ static inline void swsusp_unset_page_free(struct page *p) {}
239 244
240static inline void hibernation_set_ops(struct platform_hibernation_ops *ops) {} 245static inline void hibernation_set_ops(struct platform_hibernation_ops *ops) {}
241static inline int hibernate(void) { return -ENOSYS; } 246static inline int hibernate(void) { return -ENOSYS; }
247static inline int hibernate_nvs_register(unsigned long a, unsigned long b)
248{
249 return 0;
250}
251static inline int hibernate_nvs_alloc(void) { return 0; }
252static inline void hibernate_nvs_free(void) {}
253static inline void hibernate_nvs_save(void) {}
254static inline void hibernate_nvs_restore(void) {}
242#endif /* CONFIG_HIBERNATION */ 255#endif /* CONFIG_HIBERNATION */
243 256
244#ifdef CONFIG_PM_SLEEP 257#ifdef CONFIG_PM_SLEEP
diff --git a/include/linux/swab.h b/include/linux/swab.h
index bbed279f3b32..be5284d4a053 100644
--- a/include/linux/swab.h
+++ b/include/linux/swab.h
@@ -9,17 +9,17 @@
9 * casts are necessary for constants, because we never know how for sure 9 * casts are necessary for constants, because we never know how for sure
10 * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way. 10 * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
11 */ 11 */
12#define __const_swab16(x) ((__u16)( \ 12#define ___constant_swab16(x) ((__u16)( \
13 (((__u16)(x) & (__u16)0x00ffU) << 8) | \ 13 (((__u16)(x) & (__u16)0x00ffU) << 8) | \
14 (((__u16)(x) & (__u16)0xff00U) >> 8))) 14 (((__u16)(x) & (__u16)0xff00U) >> 8)))
15 15
16#define __const_swab32(x) ((__u32)( \ 16#define ___constant_swab32(x) ((__u32)( \
17 (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \ 17 (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
18 (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \ 18 (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
19 (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \ 19 (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
20 (((__u32)(x) & (__u32)0xff000000UL) >> 24))) 20 (((__u32)(x) & (__u32)0xff000000UL) >> 24)))
21 21
22#define __const_swab64(x) ((__u64)( \ 22#define ___constant_swab64(x) ((__u64)( \
23 (((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \ 23 (((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
24 (((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \ 24 (((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \
25 (((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \ 25 (((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \
@@ -29,11 +29,11 @@
29 (((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \ 29 (((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
30 (((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56))) 30 (((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56)))
31 31
32#define __const_swahw32(x) ((__u32)( \ 32#define ___constant_swahw32(x) ((__u32)( \
33 (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \ 33 (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \
34 (((__u32)(x) & (__u32)0xffff0000UL) >> 16))) 34 (((__u32)(x) & (__u32)0xffff0000UL) >> 16)))
35 35
36#define __const_swahb32(x) ((__u32)( \ 36#define ___constant_swahb32(x) ((__u32)( \
37 (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \ 37 (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \
38 (((__u32)(x) & (__u32)0xff00ff00UL) >> 8))) 38 (((__u32)(x) & (__u32)0xff00ff00UL) >> 8)))
39 39
@@ -43,52 +43,52 @@
43 * ___swab16, ___swab32, ___swab64, ___swahw32, ___swahb32 43 * ___swab16, ___swab32, ___swab64, ___swahw32, ___swahb32
44 */ 44 */
45 45
46static inline __attribute_const__ __u16 ___swab16(__u16 val) 46static inline __attribute_const__ __u16 __fswab16(__u16 val)
47{ 47{
48#ifdef __arch_swab16 48#ifdef __arch_swab16
49 return __arch_swab16(val); 49 return __arch_swab16(val);
50#else 50#else
51 return __const_swab16(val); 51 return ___constant_swab16(val);
52#endif 52#endif
53} 53}
54 54
55static inline __attribute_const__ __u32 ___swab32(__u32 val) 55static inline __attribute_const__ __u32 __fswab32(__u32 val)
56{ 56{
57#ifdef __arch_swab32 57#ifdef __arch_swab32
58 return __arch_swab32(val); 58 return __arch_swab32(val);
59#else 59#else
60 return __const_swab32(val); 60 return ___constant_swab32(val);
61#endif 61#endif
62} 62}
63 63
64static inline __attribute_const__ __u64 ___swab64(__u64 val) 64static inline __attribute_const__ __u64 __fswab64(__u64 val)
65{ 65{
66#ifdef __arch_swab64 66#ifdef __arch_swab64
67 return __arch_swab64(val); 67 return __arch_swab64(val);
68#elif defined(__SWAB_64_THRU_32__) 68#elif defined(__SWAB_64_THRU_32__)
69 __u32 h = val >> 32; 69 __u32 h = val >> 32;
70 __u32 l = val & ((1ULL << 32) - 1); 70 __u32 l = val & ((1ULL << 32) - 1);
71 return (((__u64)___swab32(l)) << 32) | ((__u64)(___swab32(h))); 71 return (((__u64)__fswab32(l)) << 32) | ((__u64)(__fswab32(h)));
72#else 72#else
73 return __const_swab64(val); 73 return ___constant_swab64(val);
74#endif 74#endif
75} 75}
76 76
77static inline __attribute_const__ __u32 ___swahw32(__u32 val) 77static inline __attribute_const__ __u32 __fswahw32(__u32 val)
78{ 78{
79#ifdef __arch_swahw32 79#ifdef __arch_swahw32
80 return __arch_swahw32(val); 80 return __arch_swahw32(val);
81#else 81#else
82 return __const_swahw32(val); 82 return ___constant_swahw32(val);
83#endif 83#endif
84} 84}
85 85
86static inline __attribute_const__ __u32 ___swahb32(__u32 val) 86static inline __attribute_const__ __u32 __fswahb32(__u32 val)
87{ 87{
88#ifdef __arch_swahb32 88#ifdef __arch_swahb32
89 return __arch_swahb32(val); 89 return __arch_swahb32(val);
90#else 90#else
91 return __const_swahb32(val); 91 return ___constant_swahb32(val);
92#endif 92#endif
93} 93}
94 94
@@ -98,8 +98,8 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
98 */ 98 */
99#define __swab16(x) \ 99#define __swab16(x) \
100 (__builtin_constant_p((__u16)(x)) ? \ 100 (__builtin_constant_p((__u16)(x)) ? \
101 __const_swab16((x)) : \ 101 ___constant_swab16(x) : \
102 ___swab16((x))) 102 __fswab16(x))
103 103
104/** 104/**
105 * __swab32 - return a byteswapped 32-bit value 105 * __swab32 - return a byteswapped 32-bit value
@@ -107,8 +107,8 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
107 */ 107 */
108#define __swab32(x) \ 108#define __swab32(x) \
109 (__builtin_constant_p((__u32)(x)) ? \ 109 (__builtin_constant_p((__u32)(x)) ? \
110 __const_swab32((x)) : \ 110 ___constant_swab32(x) : \
111 ___swab32((x))) 111 __fswab32(x))
112 112
113/** 113/**
114 * __swab64 - return a byteswapped 64-bit value 114 * __swab64 - return a byteswapped 64-bit value
@@ -116,8 +116,8 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
116 */ 116 */
117#define __swab64(x) \ 117#define __swab64(x) \
118 (__builtin_constant_p((__u64)(x)) ? \ 118 (__builtin_constant_p((__u64)(x)) ? \
119 __const_swab64((x)) : \ 119 ___constant_swab64(x) : \
120 ___swab64((x))) 120 __fswab64(x))
121 121
122/** 122/**
123 * __swahw32 - return a word-swapped 32-bit value 123 * __swahw32 - return a word-swapped 32-bit value
@@ -127,8 +127,8 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
127 */ 127 */
128#define __swahw32(x) \ 128#define __swahw32(x) \
129 (__builtin_constant_p((__u32)(x)) ? \ 129 (__builtin_constant_p((__u32)(x)) ? \
130 __const_swahw32((x)) : \ 130 ___constant_swahw32(x) : \
131 ___swahw32((x))) 131 __fswahw32(x))
132 132
133/** 133/**
134 * __swahb32 - return a high and low byte-swapped 32-bit value 134 * __swahb32 - return a high and low byte-swapped 32-bit value
@@ -138,8 +138,8 @@ static inline __attribute_const__ __u32 ___swahb32(__u32 val)
138 */ 138 */
139#define __swahb32(x) \ 139#define __swahb32(x) \
140 (__builtin_constant_p((__u32)(x)) ? \ 140 (__builtin_constant_p((__u32)(x)) ? \
141 __const_swahb32((x)) : \ 141 ___constant_swahb32(x) : \
142 ___swahb32((x))) 142 __fswahb32(x))
143 143
144/** 144/**
145 * __swab16p - return a byteswapped 16-bit value from a pointer 145 * __swab16p - return a byteswapped 16-bit value from a pointer
diff --git a/include/linux/swap.h b/include/linux/swap.h
index a3af95b2cb6d..d30215578877 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -120,7 +120,9 @@ struct swap_extent {
120enum { 120enum {
121 SWP_USED = (1 << 0), /* is slot in swap_info[] used? */ 121 SWP_USED = (1 << 0), /* is slot in swap_info[] used? */
122 SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */ 122 SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */
123 SWP_ACTIVE = (SWP_USED | SWP_WRITEOK), 123 SWP_DISCARDABLE = (1 << 2), /* blkdev supports discard */
124 SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */
125 SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */
124 /* add others here before... */ 126 /* add others here before... */
125 SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */ 127 SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */
126}; 128};
@@ -134,22 +136,24 @@ enum {
134 * The in-memory structure used to track swap areas. 136 * The in-memory structure used to track swap areas.
135 */ 137 */
136struct swap_info_struct { 138struct swap_info_struct {
137 unsigned int flags; 139 unsigned long flags;
138 int prio; /* swap priority */ 140 int prio; /* swap priority */
141 int next; /* next entry on swap list */
139 struct file *swap_file; 142 struct file *swap_file;
140 struct block_device *bdev; 143 struct block_device *bdev;
141 struct list_head extent_list; 144 struct list_head extent_list;
142 struct swap_extent *curr_swap_extent; 145 struct swap_extent *curr_swap_extent;
143 unsigned old_block_size; 146 unsigned short *swap_map;
144 unsigned short * swap_map;
145 unsigned int lowest_bit; 147 unsigned int lowest_bit;
146 unsigned int highest_bit; 148 unsigned int highest_bit;
149 unsigned int lowest_alloc; /* while preparing discard cluster */
150 unsigned int highest_alloc; /* while preparing discard cluster */
147 unsigned int cluster_next; 151 unsigned int cluster_next;
148 unsigned int cluster_nr; 152 unsigned int cluster_nr;
149 unsigned int pages; 153 unsigned int pages;
150 unsigned int max; 154 unsigned int max;
151 unsigned int inuse_pages; 155 unsigned int inuse_pages;
152 int next; /* next entry on swap list */ 156 unsigned int old_block_size;
153}; 157};
154 158
155struct swap_list_t { 159struct swap_list_t {
@@ -163,7 +167,6 @@ struct swap_list_t {
163/* linux/mm/page_alloc.c */ 167/* linux/mm/page_alloc.c */
164extern unsigned long totalram_pages; 168extern unsigned long totalram_pages;
165extern unsigned long totalreserve_pages; 169extern unsigned long totalreserve_pages;
166extern long nr_swap_pages;
167extern unsigned int nr_free_buffer_pages(void); 170extern unsigned int nr_free_buffer_pages(void);
168extern unsigned int nr_free_pagecache_pages(void); 171extern unsigned int nr_free_pagecache_pages(void);
169 172
@@ -174,8 +177,6 @@ extern unsigned int nr_free_pagecache_pages(void);
174/* linux/mm/swap.c */ 177/* linux/mm/swap.c */
175extern void __lru_cache_add(struct page *, enum lru_list lru); 178extern void __lru_cache_add(struct page *, enum lru_list lru);
176extern void lru_cache_add_lru(struct page *, enum lru_list lru); 179extern void lru_cache_add_lru(struct page *, enum lru_list lru);
177extern void lru_cache_add_active_or_unevictable(struct page *,
178 struct vm_area_struct *);
179extern void activate_page(struct page *); 180extern void activate_page(struct page *);
180extern void mark_page_accessed(struct page *); 181extern void mark_page_accessed(struct page *);
181extern void lru_add_drain(void); 182extern void lru_add_drain(void);
@@ -213,7 +214,8 @@ static inline void lru_cache_add_active_file(struct page *page)
213extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order, 214extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
214 gfp_t gfp_mask); 215 gfp_t gfp_mask);
215extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, 216extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
216 gfp_t gfp_mask); 217 gfp_t gfp_mask, bool noswap,
218 unsigned int swappiness);
217extern int __isolate_lru_page(struct page *page, int mode, int file); 219extern int __isolate_lru_page(struct page *page, int mode, int file);
218extern unsigned long shrink_all_memory(unsigned long nr_pages); 220extern unsigned long shrink_all_memory(unsigned long nr_pages);
219extern int vm_swappiness; 221extern int vm_swappiness;
@@ -280,7 +282,7 @@ extern void end_swap_bio_read(struct bio *bio, int err);
280extern struct address_space swapper_space; 282extern struct address_space swapper_space;
281#define total_swapcache_pages swapper_space.nrpages 283#define total_swapcache_pages swapper_space.nrpages
282extern void show_swap_cache_info(void); 284extern void show_swap_cache_info(void);
283extern int add_to_swap(struct page *, gfp_t); 285extern int add_to_swap(struct page *);
284extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t); 286extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t);
285extern void __delete_from_swap_cache(struct page *); 287extern void __delete_from_swap_cache(struct page *);
286extern void delete_from_swap_cache(struct page *); 288extern void delete_from_swap_cache(struct page *);
@@ -293,6 +295,7 @@ extern struct page *swapin_readahead(swp_entry_t, gfp_t,
293 struct vm_area_struct *vma, unsigned long addr); 295 struct vm_area_struct *vma, unsigned long addr);
294 296
295/* linux/mm/swapfile.c */ 297/* linux/mm/swapfile.c */
298extern long nr_swap_pages;
296extern long total_swap_pages; 299extern long total_swap_pages;
297extern void si_swapinfo(struct sysinfo *); 300extern void si_swapinfo(struct sysinfo *);
298extern swp_entry_t get_swap_page(void); 301extern swp_entry_t get_swap_page(void);
@@ -300,15 +303,14 @@ extern swp_entry_t get_swap_page_of_type(int);
300extern int swap_duplicate(swp_entry_t); 303extern int swap_duplicate(swp_entry_t);
301extern int valid_swaphandles(swp_entry_t, unsigned long *); 304extern int valid_swaphandles(swp_entry_t, unsigned long *);
302extern void swap_free(swp_entry_t); 305extern void swap_free(swp_entry_t);
303extern void free_swap_and_cache(swp_entry_t); 306extern int free_swap_and_cache(swp_entry_t);
304extern int swap_type_of(dev_t, sector_t, struct block_device **); 307extern int swap_type_of(dev_t, sector_t, struct block_device **);
305extern unsigned int count_swap_pages(int, int); 308extern unsigned int count_swap_pages(int, int);
306extern sector_t map_swap_page(struct swap_info_struct *, pgoff_t); 309extern sector_t map_swap_page(struct swap_info_struct *, pgoff_t);
307extern sector_t swapdev_block(int, pgoff_t); 310extern sector_t swapdev_block(int, pgoff_t);
308extern struct swap_info_struct *get_swap_info_struct(unsigned); 311extern struct swap_info_struct *get_swap_info_struct(unsigned);
309extern int can_share_swap_page(struct page *); 312extern int reuse_swap_page(struct page *);
310extern int remove_exclusive_swap_page(struct page *); 313extern int try_to_free_swap(struct page *);
311extern int remove_exclusive_swap_page_ref(struct page *);
312struct backing_dev_info; 314struct backing_dev_info;
313 315
314/* linux/mm/thrash.c */ 316/* linux/mm/thrash.c */
@@ -332,9 +334,26 @@ static inline void disable_swap_token(void)
332 put_swap_token(swap_token_mm); 334 put_swap_token(swap_token_mm);
333} 335}
334 336
337#ifdef CONFIG_CGROUP_MEM_RES_CTLR
338extern void mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent);
339#else
340static inline void
341mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent)
342{
343}
344#endif
345#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
346extern void mem_cgroup_uncharge_swap(swp_entry_t ent);
347#else
348static inline void mem_cgroup_uncharge_swap(swp_entry_t ent)
349{
350}
351#endif
352
335#else /* CONFIG_SWAP */ 353#else /* CONFIG_SWAP */
336 354
337#define total_swap_pages 0 355#define nr_swap_pages 0L
356#define total_swap_pages 0L
338#define total_swapcache_pages 0UL 357#define total_swapcache_pages 0UL
339 358
340#define si_swapinfo(val) \ 359#define si_swapinfo(val) \
@@ -350,14 +369,8 @@ static inline void show_swap_cache_info(void)
350{ 369{
351} 370}
352 371
353static inline void free_swap_and_cache(swp_entry_t swp) 372#define free_swap_and_cache(swp) is_migration_entry(swp)
354{ 373#define swap_duplicate(swp) is_migration_entry(swp)
355}
356
357static inline int swap_duplicate(swp_entry_t swp)
358{
359 return 0;
360}
361 374
362static inline void swap_free(swp_entry_t swp) 375static inline void swap_free(swp_entry_t swp)
363{ 376{
@@ -374,7 +387,10 @@ static inline struct page *lookup_swap_cache(swp_entry_t swp)
374 return NULL; 387 return NULL;
375} 388}
376 389
377#define can_share_swap_page(p) (page_mapcount(p) == 1) 390static inline int add_to_swap(struct page *page)
391{
392 return 0;
393}
378 394
379static inline int add_to_swap_cache(struct page *page, swp_entry_t entry, 395static inline int add_to_swap_cache(struct page *page, swp_entry_t entry,
380 gfp_t gfp_mask) 396 gfp_t gfp_mask)
@@ -390,14 +406,9 @@ static inline void delete_from_swap_cache(struct page *page)
390{ 406{
391} 407}
392 408
393#define swap_token_default_timeout 0 409#define reuse_swap_page(page) (page_mapcount(page) == 1)
394 410
395static inline int remove_exclusive_swap_page(struct page *p) 411static inline int try_to_free_swap(struct page *page)
396{
397 return 0;
398}
399
400static inline int remove_exclusive_swap_page_ref(struct page *page)
401{ 412{
402 return 0; 413 return 0;
403} 414}
@@ -415,6 +426,12 @@ static inline swp_entry_t get_swap_page(void)
415#define has_swap_token(x) 0 426#define has_swap_token(x) 0
416#define disable_swap_token() do { } while(0) 427#define disable_swap_token() do { } while(0)
417 428
429static inline int mem_cgroup_cache_charge_swapin(struct page *page,
430 struct mm_struct *mm, gfp_t mask, bool locked)
431{
432 return 0;
433}
434
418#endif /* CONFIG_SWAP */ 435#endif /* CONFIG_SWAP */
419#endif /* __KERNEL__*/ 436#endif /* __KERNEL__*/
420#endif /* _LINUX_SWAP_H */ 437#endif /* _LINUX_SWAP_H */
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index b18ec5533e8c..dedd3c0cfe30 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -7,9 +7,32 @@ struct device;
7struct dma_attrs; 7struct dma_attrs;
8struct scatterlist; 8struct scatterlist;
9 9
10/*
11 * Maximum allowable number of contiguous slabs to map,
12 * must be a power of 2. What is the appropriate value ?
13 * The complexity of {map,unmap}_single is linearly dependent on this value.
14 */
15#define IO_TLB_SEGSIZE 128
16
17
18/*
19 * log of the size of each IO TLB slab. The number of slabs is command line
20 * controllable.
21 */
22#define IO_TLB_SHIFT 11
23
10extern void 24extern void
11swiotlb_init(void); 25swiotlb_init(void);
12 26
27extern void *swiotlb_alloc_boot(size_t bytes, unsigned long nslabs);
28extern void *swiotlb_alloc(unsigned order, unsigned long nslabs);
29
30extern dma_addr_t swiotlb_phys_to_bus(struct device *hwdev,
31 phys_addr_t address);
32extern phys_addr_t swiotlb_bus_to_phys(dma_addr_t address);
33
34extern int swiotlb_arch_range_needs_mapping(void *ptr, size_t size);
35
13extern void 36extern void
14*swiotlb_alloc_coherent(struct device *hwdev, size_t size, 37*swiotlb_alloc_coherent(struct device *hwdev, size_t size,
15 dma_addr_t *dma_handle, gfp_t flags); 38 dma_addr_t *dma_handle, gfp_t flags);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 04fb47bfb920..18d0a243a7b3 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -549,7 +549,7 @@ asmlinkage long sys_inotify_init(void);
549asmlinkage long sys_inotify_init1(int flags); 549asmlinkage long sys_inotify_init1(int flags);
550asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, 550asmlinkage long sys_inotify_add_watch(int fd, const char __user *path,
551 u32 mask); 551 u32 mask);
552asmlinkage long sys_inotify_rm_watch(int fd, u32 wd); 552asmlinkage long sys_inotify_rm_watch(int fd, __s32 wd);
553 553
554asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, 554asmlinkage long sys_spu_run(int fd, __u32 __user *unpc,
555 __u32 __user *ustatus); 555 __u32 __user *ustatus);
diff --git a/include/linux/threads.h b/include/linux/threads.h
index 38d1a5d6568e..052b12bec8bd 100644
--- a/include/linux/threads.h
+++ b/include/linux/threads.h
@@ -8,17 +8,17 @@
8 */ 8 */
9 9
10/* 10/*
11 * Maximum supported processors that can run under SMP. This value is 11 * Maximum supported processors. Setting this smaller saves quite a
12 * set via configure setting. The maximum is equal to the size of the 12 * bit of memory. Use nr_cpu_ids instead of this except for static bitmaps.
13 * bitmasks used on that platform, i.e. 32 or 64. Setting this smaller
14 * saves quite a bit of memory.
15 */ 13 */
16#ifdef CONFIG_SMP 14#ifndef CONFIG_NR_CPUS
17#define NR_CPUS CONFIG_NR_CPUS 15/* FIXME: This should be fixed in the arch's Kconfig */
18#else 16#define CONFIG_NR_CPUS 1
19#define NR_CPUS 1
20#endif 17#endif
21 18
19/* Places which use this should consider cpumask_var_t. */
20#define NR_CPUS CONFIG_NR_CPUS
21
22#define MIN_THREADS_LEFT_FOR_ROOT 4 22#define MIN_THREADS_LEFT_FOR_ROOT 4
23 23
24/* 24/*
diff --git a/include/linux/tick.h b/include/linux/tick.h
index b6ec8189ac0c..469b82d88b3b 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -84,10 +84,10 @@ static inline void tick_cancel_sched_timer(int cpu) { }
84 84
85# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST 85# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
86extern struct tick_device *tick_get_broadcast_device(void); 86extern struct tick_device *tick_get_broadcast_device(void);
87extern cpumask_t *tick_get_broadcast_mask(void); 87extern struct cpumask *tick_get_broadcast_mask(void);
88 88
89# ifdef CONFIG_TICK_ONESHOT 89# ifdef CONFIG_TICK_ONESHOT
90extern cpumask_t *tick_get_broadcast_oneshot_mask(void); 90extern struct cpumask *tick_get_broadcast_oneshot_mask(void);
91# endif 91# endif
92 92
93# endif /* BROADCAST */ 93# endif /* BROADCAST */
diff --git a/include/linux/time.h b/include/linux/time.h
index ce321ac5c8f8..fbbd2a1c92ba 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -105,6 +105,7 @@ extern unsigned long read_persistent_clock(void);
105extern int update_persistent_clock(struct timespec now); 105extern int update_persistent_clock(struct timespec now);
106extern int no_sync_cmos_clock __read_mostly; 106extern int no_sync_cmos_clock __read_mostly;
107void timekeeping_init(void); 107void timekeeping_init(void);
108extern int timekeeping_suspended;
108 109
109unsigned long get_seconds(void); 110unsigned long get_seconds(void);
110struct timespec current_kernel_time(void); 111struct timespec current_kernel_time(void);
diff --git a/include/linux/timex.h b/include/linux/timex.h
index 9007313b5b71..998a55d80acf 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -53,47 +53,11 @@
53#ifndef _LINUX_TIMEX_H 53#ifndef _LINUX_TIMEX_H
54#define _LINUX_TIMEX_H 54#define _LINUX_TIMEX_H
55 55
56#include <linux/compiler.h>
57#include <linux/time.h> 56#include <linux/time.h>
58 57
59#include <asm/param.h>
60
61#define NTP_API 4 /* NTP API version */ 58#define NTP_API 4 /* NTP API version */
62 59
63/* 60/*
64 * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen
65 * for a slightly underdamped convergence characteristic. SHIFT_KH
66 * establishes the damping of the FLL and is chosen by wisdom and black
67 * art.
68 *
69 * MAXTC establishes the maximum time constant of the PLL. With the
70 * SHIFT_KG and SHIFT_KF values given and a time constant range from
71 * zero to MAXTC, the PLL will converge in 15 minutes to 16 hours,
72 * respectively.
73 */
74#define SHIFT_PLL 4 /* PLL frequency factor (shift) */
75#define SHIFT_FLL 2 /* FLL frequency factor (shift) */
76#define MAXTC 10 /* maximum time constant (shift) */
77
78/*
79 * SHIFT_USEC defines the scaling (shift) of the time_freq and
80 * time_tolerance variables, which represent the current frequency
81 * offset and maximum frequency tolerance.
82 */
83#define SHIFT_USEC 16 /* frequency offset scale (shift) */
84#define PPM_SCALE (NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC))
85#define PPM_SCALE_INV_SHIFT 19
86#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \
87 PPM_SCALE + 1)
88
89#define MAXPHASE 500000000l /* max phase error (ns) */
90#define MAXFREQ 500000 /* max frequency error (ns/s) */
91#define MAXFREQ_SCALED ((s64)MAXFREQ << NTP_SCALE_SHIFT)
92#define MINSEC 256 /* min interval between updates (s) */
93#define MAXSEC 2048 /* max interval between updates (s) */
94#define NTP_PHASE_LIMIT ((MAXPHASE / NSEC_PER_USEC) << 5) /* beyond max. dispersion */
95
96/*
97 * syscall interface - used (mainly by NTP daemon) 61 * syscall interface - used (mainly by NTP daemon)
98 * to discipline kernel clock oscillator 62 * to discipline kernel clock oscillator
99 */ 63 */
@@ -199,9 +163,46 @@ struct timex {
199#define TIME_BAD TIME_ERROR /* bw compat */ 163#define TIME_BAD TIME_ERROR /* bw compat */
200 164
201#ifdef __KERNEL__ 165#ifdef __KERNEL__
166#include <linux/compiler.h>
167#include <linux/types.h>
168#include <linux/param.h>
169
202#include <asm/timex.h> 170#include <asm/timex.h>
203 171
204/* 172/*
173 * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen
174 * for a slightly underdamped convergence characteristic. SHIFT_KH
175 * establishes the damping of the FLL and is chosen by wisdom and black
176 * art.
177 *
178 * MAXTC establishes the maximum time constant of the PLL. With the
179 * SHIFT_KG and SHIFT_KF values given and a time constant range from
180 * zero to MAXTC, the PLL will converge in 15 minutes to 16 hours,
181 * respectively.
182 */
183#define SHIFT_PLL 4 /* PLL frequency factor (shift) */
184#define SHIFT_FLL 2 /* FLL frequency factor (shift) */
185#define MAXTC 10 /* maximum time constant (shift) */
186
187/*
188 * SHIFT_USEC defines the scaling (shift) of the time_freq and
189 * time_tolerance variables, which represent the current frequency
190 * offset and maximum frequency tolerance.
191 */
192#define SHIFT_USEC 16 /* frequency offset scale (shift) */
193#define PPM_SCALE (NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC))
194#define PPM_SCALE_INV_SHIFT 19
195#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \
196 PPM_SCALE + 1)
197
198#define MAXPHASE 500000000l /* max phase error (ns) */
199#define MAXFREQ 500000 /* max frequency error (ns/s) */
200#define MAXFREQ_SCALED ((s64)MAXFREQ << NTP_SCALE_SHIFT)
201#define MINSEC 256 /* min interval between updates (s) */
202#define MAXSEC 2048 /* max interval between updates (s) */
203#define NTP_PHASE_LIMIT ((MAXPHASE / NSEC_PER_USEC) << 5) /* beyond max. dispersion */
204
205/*
205 * kernel variables 206 * kernel variables
206 * Note: maximum error = NTP synch distance = dispersion + delay / 2; 207 * Note: maximum error = NTP synch distance = dispersion + delay / 2;
207 * estimated error = NTP dispersion. 208 * estimated error = NTP dispersion.
diff --git a/include/linux/tty.h b/include/linux/tty.h
index eaec37c9d83d..fc39db95499f 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -180,8 +180,17 @@ struct signal_struct;
180 * until a hangup so don't use the wrong path. 180 * until a hangup so don't use the wrong path.
181 */ 181 */
182 182
183struct tty_port;
184
185struct tty_port_operations {
186 /* Return 1 if the carrier is raised */
187 int (*carrier_raised)(struct tty_port *port);
188 void (*raise_dtr_rts)(struct tty_port *port);
189};
190
183struct tty_port { 191struct tty_port {
184 struct tty_struct *tty; /* Back pointer */ 192 struct tty_struct *tty; /* Back pointer */
193 const struct tty_port_operations *ops; /* Port operations */
185 spinlock_t lock; /* Lock protecting tty field */ 194 spinlock_t lock; /* Lock protecting tty field */
186 int blocked_open; /* Waiting to open */ 195 int blocked_open; /* Waiting to open */
187 int count; /* Usage count */ 196 int count; /* Usage count */
@@ -253,6 +262,7 @@ struct tty_struct {
253 unsigned int column; 262 unsigned int column;
254 unsigned char lnext:1, erasing:1, raw:1, real_raw:1, icanon:1; 263 unsigned char lnext:1, erasing:1, raw:1, real_raw:1, icanon:1;
255 unsigned char closing:1; 264 unsigned char closing:1;
265 unsigned char echo_overrun:1;
256 unsigned short minimum_to_wake; 266 unsigned short minimum_to_wake;
257 unsigned long overrun_time; 267 unsigned long overrun_time;
258 int num_overrun; 268 int num_overrun;
@@ -262,11 +272,16 @@ struct tty_struct {
262 int read_tail; 272 int read_tail;
263 int read_cnt; 273 int read_cnt;
264 unsigned long read_flags[N_TTY_BUF_SIZE/(8*sizeof(unsigned long))]; 274 unsigned long read_flags[N_TTY_BUF_SIZE/(8*sizeof(unsigned long))];
275 unsigned char *echo_buf;
276 unsigned int echo_pos;
277 unsigned int echo_cnt;
265 int canon_data; 278 int canon_data;
266 unsigned long canon_head; 279 unsigned long canon_head;
267 unsigned int canon_column; 280 unsigned int canon_column;
268 struct mutex atomic_read_lock; 281 struct mutex atomic_read_lock;
269 struct mutex atomic_write_lock; 282 struct mutex atomic_write_lock;
283 struct mutex output_lock;
284 struct mutex echo_lock;
270 unsigned char *write_buf; 285 unsigned char *write_buf;
271 int write_cnt; 286 int write_cnt;
272 spinlock_t read_lock; 287 spinlock_t read_lock;
@@ -295,6 +310,7 @@ struct tty_struct {
295#define TTY_PUSH 6 /* n_tty private */ 310#define TTY_PUSH 6 /* n_tty private */
296#define TTY_CLOSING 7 /* ->close() in progress */ 311#define TTY_CLOSING 7 /* ->close() in progress */
297#define TTY_LDISC 9 /* Line discipline attached */ 312#define TTY_LDISC 9 /* Line discipline attached */
313#define TTY_LDISC_CHANGING 10 /* Line discipline changing */
298#define TTY_HW_COOK_OUT 14 /* Hardware can do output cooking */ 314#define TTY_HW_COOK_OUT 14 /* Hardware can do output cooking */
299#define TTY_HW_COOK_IN 15 /* Hardware can do input cooking */ 315#define TTY_HW_COOK_IN 15 /* Hardware can do input cooking */
300#define TTY_PTY_LOCK 16 /* pty private */ 316#define TTY_PTY_LOCK 16 /* pty private */
@@ -354,8 +370,7 @@ extern int tty_write_room(struct tty_struct *tty);
354extern void tty_driver_flush_buffer(struct tty_struct *tty); 370extern void tty_driver_flush_buffer(struct tty_struct *tty);
355extern void tty_throttle(struct tty_struct *tty); 371extern void tty_throttle(struct tty_struct *tty);
356extern void tty_unthrottle(struct tty_struct *tty); 372extern void tty_unthrottle(struct tty_struct *tty);
357extern int tty_do_resize(struct tty_struct *tty, struct tty_struct *real_tty, 373extern int tty_do_resize(struct tty_struct *tty, struct winsize *ws);
358 struct winsize *ws);
359extern void tty_shutdown(struct tty_struct *tty); 374extern void tty_shutdown(struct tty_struct *tty);
360extern void tty_free_termios(struct tty_struct *tty); 375extern void tty_free_termios(struct tty_struct *tty);
361extern int is_current_pgrp_orphaned(void); 376extern int is_current_pgrp_orphaned(void);
@@ -421,6 +436,14 @@ extern int tty_port_alloc_xmit_buf(struct tty_port *port);
421extern void tty_port_free_xmit_buf(struct tty_port *port); 436extern void tty_port_free_xmit_buf(struct tty_port *port);
422extern struct tty_struct *tty_port_tty_get(struct tty_port *port); 437extern struct tty_struct *tty_port_tty_get(struct tty_port *port);
423extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty); 438extern void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty);
439extern int tty_port_carrier_raised(struct tty_port *port);
440extern void tty_port_raise_dtr_rts(struct tty_port *port);
441extern void tty_port_hangup(struct tty_port *port);
442extern int tty_port_block_til_ready(struct tty_port *port,
443 struct tty_struct *tty, struct file *filp);
444extern int tty_port_close_start(struct tty_port *port,
445 struct tty_struct *tty, struct file *filp);
446extern void tty_port_close_end(struct tty_port *port, struct tty_struct *tty);
424 447
425extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc); 448extern int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc);
426extern int tty_unregister_ldisc(int disc); 449extern int tty_unregister_ldisc(int disc);
@@ -442,6 +465,7 @@ extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
442 size_t size); 465 size_t size);
443extern void tty_audit_exit(void); 466extern void tty_audit_exit(void);
444extern void tty_audit_fork(struct signal_struct *sig); 467extern void tty_audit_fork(struct signal_struct *sig);
468extern void tty_audit_tiocsti(struct tty_struct *tty, char ch);
445extern void tty_audit_push(struct tty_struct *tty); 469extern void tty_audit_push(struct tty_struct *tty);
446extern void tty_audit_push_task(struct task_struct *tsk, 470extern void tty_audit_push_task(struct task_struct *tsk,
447 uid_t loginuid, u32 sessionid); 471 uid_t loginuid, u32 sessionid);
@@ -450,6 +474,9 @@ static inline void tty_audit_add_data(struct tty_struct *tty,
450 unsigned char *data, size_t size) 474 unsigned char *data, size_t size)
451{ 475{
452} 476}
477static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch)
478{
479}
453static inline void tty_audit_exit(void) 480static inline void tty_audit_exit(void)
454{ 481{
455} 482}
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 78416b901589..08e088334dba 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -196,8 +196,7 @@
196 * Optional: If not provided then the write method is called under 196 * Optional: If not provided then the write method is called under
197 * the atomic write lock to keep it serialized with the ldisc. 197 * the atomic write lock to keep it serialized with the ldisc.
198 * 198 *
199 * int (*resize)(struct tty_struct *tty, struct tty_struct *real_tty, 199 * int (*resize)(struct tty_struct *tty, struct winsize *ws)
200 * unsigned int rows, unsigned int cols);
201 * 200 *
202 * Called when a termios request is issued which changes the 201 * Called when a termios request is issued which changes the
203 * requested terminal geometry. 202 * requested terminal geometry.
@@ -258,8 +257,7 @@ struct tty_operations {
258 int (*tiocmget)(struct tty_struct *tty, struct file *file); 257 int (*tiocmget)(struct tty_struct *tty, struct file *file);
259 int (*tiocmset)(struct tty_struct *tty, struct file *file, 258 int (*tiocmset)(struct tty_struct *tty, struct file *file,
260 unsigned int set, unsigned int clear); 259 unsigned int set, unsigned int clear);
261 int (*resize)(struct tty_struct *tty, struct tty_struct *real_tty, 260 int (*resize)(struct tty_struct *tty, struct winsize *ws);
262 struct winsize *ws);
263 int (*set_termiox)(struct tty_struct *tty, struct termiox *tnew); 261 int (*set_termiox)(struct tty_struct *tty, struct termiox *tnew);
264#ifdef CONFIG_CONSOLE_POLL 262#ifdef CONFIG_CONSOLE_POLL
265 int (*poll_init)(struct tty_driver *driver, int line, char *options); 263 int (*poll_init)(struct tty_driver *driver, int line, char *options);
diff --git a/include/linux/types.h b/include/linux/types.h
index 1d98330b1f2c..712ca53bc348 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -135,19 +135,14 @@ typedef __s64 int64_t;
135 * 135 *
136 * Linux always considers sectors to be 512 bytes long independently 136 * Linux always considers sectors to be 512 bytes long independently
137 * of the devices real block size. 137 * of the devices real block size.
138 *
139 * blkcnt_t is the type of the inode's block count.
138 */ 140 */
139#ifdef CONFIG_LBD 141#ifdef CONFIG_LBD
140typedef u64 sector_t; 142typedef u64 sector_t;
141#else
142typedef unsigned long sector_t;
143#endif
144
145/*
146 * The type of the inode's block count.
147 */
148#ifdef CONFIG_LSF
149typedef u64 blkcnt_t; 143typedef u64 blkcnt_t;
150#else 144#else
145typedef unsigned long sector_t;
151typedef unsigned long blkcnt_t; 146typedef unsigned long blkcnt_t;
152#endif 147#endif
153 148
@@ -181,10 +176,9 @@ typedef __u16 __bitwise __le16;
181typedef __u16 __bitwise __be16; 176typedef __u16 __bitwise __be16;
182typedef __u32 __bitwise __le32; 177typedef __u32 __bitwise __le32;
183typedef __u32 __bitwise __be32; 178typedef __u32 __bitwise __be32;
184#if defined(__GNUC__)
185typedef __u64 __bitwise __le64; 179typedef __u64 __bitwise __le64;
186typedef __u64 __bitwise __be64; 180typedef __u64 __bitwise __be64;
187#endif 181
188typedef __u16 __bitwise __sum16; 182typedef __u16 __bitwise __sum16;
189typedef __u32 __bitwise __wsum; 183typedef __u32 __bitwise __wsum;
190 184
@@ -200,6 +194,16 @@ typedef u32 phys_addr_t;
200 194
201typedef phys_addr_t resource_size_t; 195typedef phys_addr_t resource_size_t;
202 196
197typedef struct {
198 volatile int counter;
199} atomic_t;
200
201#ifdef CONFIG_64BIT
202typedef struct {
203 volatile long counter;
204} atomic64_t;
205#endif
206
203struct ustat { 207struct ustat {
204 __kernel_daddr_t f_tfree; 208 __kernel_daddr_t f_tfree;
205 __kernel_ino_t f_tinode; 209 __kernel_ino_t f_tinode;
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index cdf338d94b7f..a0bb6bd2e5c1 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -38,6 +38,24 @@ struct uio_mem {
38 38
39#define MAX_UIO_MAPS 5 39#define MAX_UIO_MAPS 5
40 40
41struct uio_portio;
42
43/**
44 * struct uio_port - description of a UIO port region
45 * @start: start of port region
46 * @size: size of port region
47 * @porttype: type of port (see UIO_PORT_* below)
48 * @portio: for use by the UIO core only.
49 */
50struct uio_port {
51 unsigned long start;
52 unsigned long size;
53 int porttype;
54 struct uio_portio *portio;
55};
56
57#define MAX_UIO_PORT_REGIONS 5
58
41struct uio_device; 59struct uio_device;
42 60
43/** 61/**
@@ -46,6 +64,7 @@ struct uio_device;
46 * @name: device name 64 * @name: device name
47 * @version: device driver version 65 * @version: device driver version
48 * @mem: list of mappable memory regions, size==0 for end of list 66 * @mem: list of mappable memory regions, size==0 for end of list
67 * @port: list of port regions, size==0 for end of list
49 * @irq: interrupt number or UIO_IRQ_CUSTOM 68 * @irq: interrupt number or UIO_IRQ_CUSTOM
50 * @irq_flags: flags for request_irq() 69 * @irq_flags: flags for request_irq()
51 * @priv: optional private data 70 * @priv: optional private data
@@ -57,9 +76,10 @@ struct uio_device;
57 */ 76 */
58struct uio_info { 77struct uio_info {
59 struct uio_device *uio_dev; 78 struct uio_device *uio_dev;
60 char *name; 79 const char *name;
61 char *version; 80 const char *version;
62 struct uio_mem mem[MAX_UIO_MAPS]; 81 struct uio_mem mem[MAX_UIO_MAPS];
82 struct uio_port port[MAX_UIO_PORT_REGIONS];
63 long irq; 83 long irq;
64 unsigned long irq_flags; 84 unsigned long irq_flags;
65 void *priv; 85 void *priv;
@@ -92,4 +112,10 @@ extern void uio_event_notify(struct uio_info *info);
92#define UIO_MEM_LOGICAL 2 112#define UIO_MEM_LOGICAL 2
93#define UIO_MEM_VIRTUAL 3 113#define UIO_MEM_VIRTUAL 3
94 114
115/* defines for uio_port->porttype */
116#define UIO_PORT_NONE 0
117#define UIO_PORT_X86 1
118#define UIO_PORT_GPIO 2
119#define UIO_PORT_OTHER 3
120
95#endif /* _LINUX_UIO_DRIVER_H_ */ 121#endif /* _LINUX_UIO_DRIVER_H_ */
diff --git a/include/linux/unwind.h b/include/linux/unwind.h
deleted file mode 100644
index 7760860fa170..000000000000
--- a/include/linux/unwind.h
+++ /dev/null
@@ -1,68 +0,0 @@
1#ifndef _LINUX_UNWIND_H
2#define _LINUX_UNWIND_H
3
4/*
5 * Copyright (C) 2002-2006 Novell, Inc.
6 * Jan Beulich <jbeulich@novell.com>
7 * This code is released under version 2 of the GNU GPL.
8 *
9 * A simple API for unwinding kernel stacks. This is used for
10 * debugging and error reporting purposes. The kernel doesn't need
11 * full-blown stack unwinding with all the bells and whistles, so there
12 * is not much point in implementing the full Dwarf2 unwind API.
13 */
14
15struct module;
16
17struct unwind_frame_info {};
18
19static inline void unwind_init(void) {}
20static inline void unwind_setup(void) {}
21
22#ifdef CONFIG_MODULES
23
24static inline void *unwind_add_table(struct module *mod,
25 const void *table_start,
26 unsigned long table_size)
27{
28 return NULL;
29}
30
31static inline void unwind_remove_table(void *handle, int init_only)
32{
33}
34
35#endif
36
37static inline int unwind_init_frame_info(struct unwind_frame_info *info,
38 struct task_struct *tsk,
39 const struct pt_regs *regs)
40{
41 return -ENOSYS;
42}
43
44static inline int unwind_init_blocked(struct unwind_frame_info *info,
45 struct task_struct *tsk)
46{
47 return -ENOSYS;
48}
49
50static inline int unwind_init_running(struct unwind_frame_info *info,
51 asmlinkage int (*cb)(struct unwind_frame_info *,
52 void *arg),
53 void *arg)
54{
55 return -ENOSYS;
56}
57
58static inline int unwind(struct unwind_frame_info *info)
59{
60 return -ENOSYS;
61}
62
63static inline int unwind_to_user(struct unwind_frame_info *info)
64{
65 return -ENOSYS;
66}
67
68#endif /* _LINUX_UNWIND_H */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index f72aa51f7bcd..85ee9be9361e 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -108,6 +108,7 @@ enum usb_interface_condition {
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 * @sysfs_files_created: sysfs attributes exist
111 * @ep_devs_created: endpoint child pseudo-devices exist
111 * @unregistering: flag set when the interface is being unregistered 112 * @unregistering: flag set when the interface is being unregistered
112 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup 113 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
113 * capability during autosuspend. 114 * capability during autosuspend.
@@ -120,6 +121,11 @@ enum usb_interface_condition {
120 * to the sysfs representation for that device. 121 * to the sysfs representation for that device.
121 * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not 122 * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not
122 * allowed unless the counter is 0. 123 * allowed unless the counter is 0.
124 * @reset_ws: Used for scheduling resets from atomic context.
125 * @reset_running: set to 1 if the interface is currently running a
126 * queued reset so that usb_cancel_queued_reset() doesn't try to
127 * remove from the workqueue when running inside the worker
128 * thread. See __usb_queue_reset_device().
123 * 129 *
124 * USB device drivers attach to interfaces on a physical device. Each 130 * USB device drivers attach to interfaces on a physical device. Each
125 * interface encapsulates a single high level function, such as feeding 131 * interface encapsulates a single high level function, such as feeding
@@ -164,14 +170,17 @@ struct usb_interface {
164 enum usb_interface_condition condition; /* state of binding */ 170 enum usb_interface_condition condition; /* state of binding */
165 unsigned is_active:1; /* the interface is not suspended */ 171 unsigned is_active:1; /* the interface is not suspended */
166 unsigned sysfs_files_created:1; /* the sysfs attributes exist */ 172 unsigned sysfs_files_created:1; /* the sysfs attributes exist */
173 unsigned ep_devs_created:1; /* endpoint "devices" exist */
167 unsigned unregistering:1; /* unregistration is in progress */ 174 unsigned unregistering:1; /* unregistration is in progress */
168 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ 175 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
169 unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */ 176 unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */
170 unsigned needs_binding:1; /* needs delayed unbind/rebind */ 177 unsigned needs_binding:1; /* needs delayed unbind/rebind */
178 unsigned reset_running:1;
171 179
172 struct device dev; /* interface specific device info */ 180 struct device dev; /* interface specific device info */
173 struct device *usb_dev; 181 struct device *usb_dev;
174 int pm_usage_cnt; /* usage counter for autosuspend */ 182 int pm_usage_cnt; /* usage counter for autosuspend */
183 struct work_struct reset_ws; /* for resets in atomic context */
175}; 184};
176#define to_usb_interface(d) container_of(d, struct usb_interface, dev) 185#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
177#define interface_to_usbdev(intf) \ 186#define interface_to_usbdev(intf) \
@@ -329,7 +338,7 @@ struct usb_bus {
329#endif 338#endif
330 struct device *dev; /* device for this bus */ 339 struct device *dev; /* device for this bus */
331 340
332#if defined(CONFIG_USB_MON) 341#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)
333 struct mon_bus *mon_bus; /* non-null when associated */ 342 struct mon_bus *mon_bus; /* non-null when associated */
334 int monitored; /* non-zero when monitored */ 343 int monitored; /* non-zero when monitored */
335#endif 344#endif
@@ -398,6 +407,7 @@ struct usb_tt;
398 * @urbnum: number of URBs submitted for the whole device 407 * @urbnum: number of URBs submitted for the whole device
399 * @active_duration: total time device is not suspended 408 * @active_duration: total time device is not suspended
400 * @autosuspend: for delayed autosuspends 409 * @autosuspend: for delayed autosuspends
410 * @autoresume: for autoresumes requested while in_interrupt
401 * @pm_mutex: protects PM operations 411 * @pm_mutex: protects PM operations
402 * @last_busy: time of last use 412 * @last_busy: time of last use
403 * @autosuspend_delay: in jiffies 413 * @autosuspend_delay: in jiffies
@@ -476,6 +486,7 @@ struct usb_device {
476 486
477#ifdef CONFIG_PM 487#ifdef CONFIG_PM
478 struct delayed_work autosuspend; 488 struct delayed_work autosuspend;
489 struct work_struct autoresume;
479 struct mutex pm_mutex; 490 struct mutex pm_mutex;
480 491
481 unsigned long last_busy; 492 unsigned long last_busy;
@@ -505,6 +516,7 @@ extern int usb_lock_device_for_reset(struct usb_device *udev,
505 516
506/* USB port reset for device reinitialization */ 517/* USB port reset for device reinitialization */
507extern int usb_reset_device(struct usb_device *dev); 518extern int usb_reset_device(struct usb_device *dev);
519extern void usb_queue_reset_device(struct usb_interface *dev);
508 520
509extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); 521extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
510 522
@@ -513,6 +525,8 @@ extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id);
513extern int usb_autopm_set_interface(struct usb_interface *intf); 525extern int usb_autopm_set_interface(struct usb_interface *intf);
514extern int usb_autopm_get_interface(struct usb_interface *intf); 526extern int usb_autopm_get_interface(struct usb_interface *intf);
515extern void usb_autopm_put_interface(struct usb_interface *intf); 527extern void usb_autopm_put_interface(struct usb_interface *intf);
528extern int usb_autopm_get_interface_async(struct usb_interface *intf);
529extern void usb_autopm_put_interface_async(struct usb_interface *intf);
516 530
517static inline void usb_autopm_enable(struct usb_interface *intf) 531static inline void usb_autopm_enable(struct usb_interface *intf)
518{ 532{
@@ -539,8 +553,13 @@ static inline int usb_autopm_set_interface(struct usb_interface *intf)
539static inline int usb_autopm_get_interface(struct usb_interface *intf) 553static inline int usb_autopm_get_interface(struct usb_interface *intf)
540{ return 0; } 554{ return 0; }
541 555
556static inline int usb_autopm_get_interface_async(struct usb_interface *intf)
557{ return 0; }
558
542static inline void usb_autopm_put_interface(struct usb_interface *intf) 559static inline void usb_autopm_put_interface(struct usb_interface *intf)
543{ } 560{ }
561static inline void usb_autopm_put_interface_async(struct usb_interface *intf)
562{ }
544static inline void usb_autopm_enable(struct usb_interface *intf) 563static inline void usb_autopm_enable(struct usb_interface *intf)
545{ } 564{ }
546static inline void usb_autopm_disable(struct usb_interface *intf) 565static inline void usb_autopm_disable(struct usb_interface *intf)
@@ -1050,7 +1069,7 @@ struct usb_device_driver {
1050 void (*disconnect) (struct usb_device *udev); 1069 void (*disconnect) (struct usb_device *udev);
1051 1070
1052 int (*suspend) (struct usb_device *udev, pm_message_t message); 1071 int (*suspend) (struct usb_device *udev, pm_message_t message);
1053 int (*resume) (struct usb_device *udev); 1072 int (*resume) (struct usb_device *udev, pm_message_t message);
1054 struct usbdrv_wrap drvwrap; 1073 struct usbdrv_wrap drvwrap;
1055 unsigned int supports_autosuspend:1; 1074 unsigned int supports_autosuspend:1;
1056}; 1075};
@@ -1321,7 +1340,7 @@ struct urb {
1321 struct kref kref; /* reference count of the URB */ 1340 struct kref kref; /* reference count of the URB */
1322 void *hcpriv; /* private data for host controller */ 1341 void *hcpriv; /* private data for host controller */
1323 atomic_t use_count; /* concurrent submissions counter */ 1342 atomic_t use_count; /* concurrent submissions counter */
1324 u8 reject; /* submissions will fail */ 1343 atomic_t reject; /* submissions will fail */
1325 int unlinked; /* unlink error code */ 1344 int unlinked; /* unlink error code */
1326 1345
1327 /* public: documented fields in the urb that can be used by drivers */ 1346 /* public: documented fields in the urb that can be used by drivers */
@@ -1466,6 +1485,7 @@ extern void usb_poison_urb(struct urb *urb);
1466extern void usb_unpoison_urb(struct urb *urb); 1485extern void usb_unpoison_urb(struct urb *urb);
1467extern void usb_kill_anchored_urbs(struct usb_anchor *anchor); 1486extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
1468extern void usb_poison_anchored_urbs(struct usb_anchor *anchor); 1487extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
1488extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
1469extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor); 1489extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor);
1470extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor); 1490extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor);
1471extern void usb_unanchor_urb(struct urb *urb); 1491extern void usb_unanchor_urb(struct urb *urb);
@@ -1722,10 +1742,6 @@ extern void usb_unregister_notify(struct notifier_block *nb);
1722 1742
1723#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \ 1743#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \
1724 format "\n" , ## arg) 1744 format "\n" , ## arg)
1725#define info(format, arg...) printk(KERN_INFO KBUILD_MODNAME ": " \
1726 format "\n" , ## arg)
1727#define warn(format, arg...) printk(KERN_WARNING KBUILD_MODNAME ": " \
1728 format "\n" , ## arg)
1729 1745
1730#endif /* __KERNEL__ */ 1746#endif /* __KERNEL__ */
1731 1747
diff --git a/include/linux/usb/association.h b/include/linux/usb/association.h
index 07c5e3cf5898..0a4a18b3c1bb 100644
--- a/include/linux/usb/association.h
+++ b/include/linux/usb/association.h
@@ -28,17 +28,17 @@ struct wusb_am_attr {
28}; 28};
29 29
30/* Different fields defined by the spec */ 30/* Different fields defined by the spec */
31#define WUSB_AR_AssociationTypeId { .id = 0x0000, .len = 2 } 31#define WUSB_AR_AssociationTypeId { .id = cpu_to_le16(0x0000), .len = cpu_to_le16(2) }
32#define WUSB_AR_AssociationSubTypeId { .id = 0x0001, .len = 2 } 32#define WUSB_AR_AssociationSubTypeId { .id = cpu_to_le16(0x0001), .len = cpu_to_le16(2) }
33#define WUSB_AR_Length { .id = 0x0002, .len = 4 } 33#define WUSB_AR_Length { .id = cpu_to_le16(0x0002), .len = cpu_to_le16(4) }
34#define WUSB_AR_AssociationStatus { .id = 0x0004, .len = 4 } 34#define WUSB_AR_AssociationStatus { .id = cpu_to_le16(0x0004), .len = cpu_to_le16(4) }
35#define WUSB_AR_LangID { .id = 0x0008, .len = 2 } 35#define WUSB_AR_LangID { .id = cpu_to_le16(0x0008), .len = cpu_to_le16(2) }
36#define WUSB_AR_DeviceFriendlyName { .id = 0x000b, .len = 64 } /* max */ 36#define WUSB_AR_DeviceFriendlyName { .id = cpu_to_le16(0x000b), .len = cpu_to_le16(64) } /* max */
37#define WUSB_AR_HostFriendlyName { .id = 0x000c, .len = 64 } /* max */ 37#define WUSB_AR_HostFriendlyName { .id = cpu_to_le16(0x000c), .len = cpu_to_le16(64) } /* max */
38#define WUSB_AR_CHID { .id = 0x1000, .len = 16 } 38#define WUSB_AR_CHID { .id = cpu_to_le16(0x1000), .len = cpu_to_le16(16) }
39#define WUSB_AR_CDID { .id = 0x1001, .len = 16 } 39#define WUSB_AR_CDID { .id = cpu_to_le16(0x1001), .len = cpu_to_le16(16) }
40#define WUSB_AR_ConnectionContext { .id = 0x1002, .len = 48 } 40#define WUSB_AR_ConnectionContext { .id = cpu_to_le16(0x1002), .len = cpu_to_le16(48) }
41#define WUSB_AR_BandGroups { .id = 0x1004, .len = 2 } 41#define WUSB_AR_BandGroups { .id = cpu_to_le16(0x1004), .len = cpu_to_le16(2) }
42 42
43/* CBAF Control Requests (AMS1.0[T4-1] */ 43/* CBAF Control Requests (AMS1.0[T4-1] */
44enum { 44enum {
diff --git a/include/linux/usb/gpio_vbus.h b/include/linux/usb/gpio_vbus.h
new file mode 100644
index 000000000000..d9f03ccc2d60
--- /dev/null
+++ b/include/linux/usb/gpio_vbus.h
@@ -0,0 +1,30 @@
1/*
2 * A simple GPIO VBUS sensing driver for B peripheral only devices
3 * with internal transceivers.
4 * Optionally D+ pullup can be controlled by a second GPIO.
5 *
6 * Copyright (c) 2008 Philipp Zabel <philipp.zabel@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13
14/**
15 * struct gpio_vbus_mach_info - configuration for gpio_vbus
16 * @gpio_vbus: VBUS sensing GPIO
17 * @gpio_pullup: optional D+ or D- pullup GPIO (else negative/invalid)
18 * @gpio_vbus_inverted: true if gpio_vbus is active low
19 * @gpio_pullup_inverted: true if gpio_pullup is active low
20 *
21 * The VBUS sensing GPIO should have a pulldown, which will normally be
22 * part of a resistor ladder turning a 4.0V-5.25V level on VBUS into a
23 * value the GPIO detects as active. Some systems will use comparators.
24 */
25struct gpio_vbus_mach_info {
26 int gpio_vbus;
27 int gpio_pullup;
28 bool gpio_vbus_inverted;
29 bool gpio_pullup_inverted;
30};
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index 630962c04ca4..d6aad0ea6033 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -47,6 +47,11 @@ struct musb_hdrc_config {
47 u8 ram_bits; /* ram address size */ 47 u8 ram_bits; /* ram address size */
48 48
49 struct musb_hdrc_eps_bits *eps_bits; 49 struct musb_hdrc_eps_bits *eps_bits;
50#ifdef CONFIG_BLACKFIN
51 /* A GPIO controlling VRSEL in Blackfin */
52 unsigned int gpio_vrsel;
53#endif
54
50}; 55};
51 56
52struct musb_hdrc_platform_data { 57struct musb_hdrc_platform_data {
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 1db25d152ad8..94df4fe6c6c0 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -84,6 +84,7 @@ extern int otg_set_transceiver(struct otg_transceiver *);
84 84
85/* for usb host and peripheral controller drivers */ 85/* for usb host and peripheral controller drivers */
86extern struct otg_transceiver *otg_get_transceiver(void); 86extern struct otg_transceiver *otg_get_transceiver(void);
87extern void otg_put_transceiver(struct otg_transceiver *);
87 88
88static inline int 89static inline int
89otg_start_hnp(struct otg_transceiver *otg) 90otg_start_hnp(struct otg_transceiver *otg)
diff --git a/include/linux/usb/wusb-wa.h b/include/linux/usb/wusb-wa.h
index a102561e7026..fb7c359bdfba 100644
--- a/include/linux/usb/wusb-wa.h
+++ b/include/linux/usb/wusb-wa.h
@@ -51,6 +51,7 @@ enum {
51 WUSB_REQ_GET_TIME = 25, 51 WUSB_REQ_GET_TIME = 25,
52 WUSB_REQ_SET_STREAM_IDX = 26, 52 WUSB_REQ_SET_STREAM_IDX = 26,
53 WUSB_REQ_SET_WUSB_MAS = 27, 53 WUSB_REQ_SET_WUSB_MAS = 27,
54 WUSB_REQ_CHAN_STOP = 28,
54}; 55};
55 56
56 57
diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
index d9a3bbe38e6b..1eea1ab68dc4 100644
--- a/include/linux/usb_usual.h
+++ b/include/linux/usb_usual.h
@@ -52,8 +52,11 @@
52 US_FLAG(MAX_SECTORS_MIN,0x00002000) \ 52 US_FLAG(MAX_SECTORS_MIN,0x00002000) \
53 /* Sets max_sectors to arch min */ \ 53 /* Sets max_sectors to arch min */ \
54 US_FLAG(BULK_IGNORE_TAG,0x00004000) \ 54 US_FLAG(BULK_IGNORE_TAG,0x00004000) \
55 /* Ignore tag mismatch in bulk operations */ 55 /* Ignore tag mismatch in bulk operations */ \
56 56 US_FLAG(SANE_SENSE, 0x00008000) \
57 /* Sane Sense (> 18 bytes) */ \
58 US_FLAG(CAPACITY_OK, 0x00010000) \
59 /* READ CAPACITY response is correct */
57 60
58#define US_FLAG(name, value) US_FL_##name = value , 61#define US_FLAG(name, value) US_FL_##name = value ,
59enum { US_DO_ALL_FLAGS }; 62enum { US_DO_ALL_FLAGS };
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
index b5f41d4c2eec..315bcd375224 100644
--- a/include/linux/user_namespace.h
+++ b/include/linux/user_namespace.h
@@ -12,7 +12,7 @@
12struct user_namespace { 12struct user_namespace {
13 struct kref kref; 13 struct kref kref;
14 struct hlist_head uidhash_table[UIDHASH_SZ]; 14 struct hlist_head uidhash_table[UIDHASH_SZ];
15 struct user_struct *root_user; 15 struct user_struct *creator;
16}; 16};
17 17
18extern struct user_namespace init_user_ns; 18extern struct user_namespace init_user_ns;
@@ -26,8 +26,7 @@ static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
26 return ns; 26 return ns;
27} 27}
28 28
29extern struct user_namespace *copy_user_ns(int flags, 29extern int create_user_ns(struct cred *new);
30 struct user_namespace *old_ns);
31extern void free_user_ns(struct kref *kref); 30extern void free_user_ns(struct kref *kref);
32 31
33static inline void put_user_ns(struct user_namespace *ns) 32static inline void put_user_ns(struct user_namespace *ns)
@@ -43,13 +42,9 @@ static inline struct user_namespace *get_user_ns(struct user_namespace *ns)
43 return &init_user_ns; 42 return &init_user_ns;
44} 43}
45 44
46static inline struct user_namespace *copy_user_ns(int flags, 45static inline int create_user_ns(struct cred *new)
47 struct user_namespace *old_ns)
48{ 46{
49 if (flags & CLONE_NEWUSER) 47 return -EINVAL;
50 return ERR_PTR(-EINVAL);
51
52 return old_ns;
53} 48}
54 49
55static inline void put_user_ns(struct user_namespace *ns) 50static inline void put_user_ns(struct user_namespace *ns)
diff --git a/include/linux/uwb.h b/include/linux/uwb.h
index f9ccbd9a2ced..c02128991ff7 100644
--- a/include/linux/uwb.h
+++ b/include/linux/uwb.h
@@ -30,6 +30,7 @@
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/mutex.h> 31#include <linux/mutex.h>
32#include <linux/timer.h> 32#include <linux/timer.h>
33#include <linux/wait.h>
33#include <linux/workqueue.h> 34#include <linux/workqueue.h>
34#include <linux/uwb/spec.h> 35#include <linux/uwb/spec.h>
35 36
@@ -66,6 +67,7 @@ struct uwb_dev {
66 struct uwb_dev_addr dev_addr; 67 struct uwb_dev_addr dev_addr;
67 int beacon_slot; 68 int beacon_slot;
68 DECLARE_BITMAP(streams, UWB_NUM_STREAMS); 69 DECLARE_BITMAP(streams, UWB_NUM_STREAMS);
70 DECLARE_BITMAP(last_availability_bm, UWB_NUM_MAS);
69}; 71};
70#define to_uwb_dev(d) container_of(d, struct uwb_dev, dev) 72#define to_uwb_dev(d) container_of(d, struct uwb_dev, dev)
71 73
@@ -86,12 +88,31 @@ struct uwb_notifs_chain {
86 struct mutex mutex; 88 struct mutex mutex;
87}; 89};
88 90
91/* Beacon cache list */
92struct uwb_beca {
93 struct list_head list;
94 size_t entries;
95 struct mutex mutex;
96};
97
98/* Event handling thread. */
99struct uwbd {
100 int pid;
101 struct task_struct *task;
102 wait_queue_head_t wq;
103 struct list_head event_list;
104 spinlock_t event_list_lock;
105};
106
89/** 107/**
90 * struct uwb_mas_bm - a bitmap of all MAS in a superframe 108 * struct uwb_mas_bm - a bitmap of all MAS in a superframe
91 * @bm: a bitmap of length #UWB_NUM_MAS 109 * @bm: a bitmap of length #UWB_NUM_MAS
92 */ 110 */
93struct uwb_mas_bm { 111struct uwb_mas_bm {
94 DECLARE_BITMAP(bm, UWB_NUM_MAS); 112 DECLARE_BITMAP(bm, UWB_NUM_MAS);
113 DECLARE_BITMAP(unsafe_bm, UWB_NUM_MAS);
114 int safe;
115 int unsafe;
95}; 116};
96 117
97/** 118/**
@@ -117,14 +138,24 @@ struct uwb_mas_bm {
117 * FIXME: further target states TBD. 138 * FIXME: further target states TBD.
118 */ 139 */
119enum uwb_rsv_state { 140enum uwb_rsv_state {
120 UWB_RSV_STATE_NONE, 141 UWB_RSV_STATE_NONE = 0,
121 UWB_RSV_STATE_O_INITIATED, 142 UWB_RSV_STATE_O_INITIATED,
122 UWB_RSV_STATE_O_PENDING, 143 UWB_RSV_STATE_O_PENDING,
123 UWB_RSV_STATE_O_MODIFIED, 144 UWB_RSV_STATE_O_MODIFIED,
124 UWB_RSV_STATE_O_ESTABLISHED, 145 UWB_RSV_STATE_O_ESTABLISHED,
146 UWB_RSV_STATE_O_TO_BE_MOVED,
147 UWB_RSV_STATE_O_MOVE_EXPANDING,
148 UWB_RSV_STATE_O_MOVE_COMBINING,
149 UWB_RSV_STATE_O_MOVE_REDUCING,
125 UWB_RSV_STATE_T_ACCEPTED, 150 UWB_RSV_STATE_T_ACCEPTED,
126 UWB_RSV_STATE_T_DENIED, 151 UWB_RSV_STATE_T_DENIED,
152 UWB_RSV_STATE_T_CONFLICT,
127 UWB_RSV_STATE_T_PENDING, 153 UWB_RSV_STATE_T_PENDING,
154 UWB_RSV_STATE_T_EXPANDING_ACCEPTED,
155 UWB_RSV_STATE_T_EXPANDING_CONFLICT,
156 UWB_RSV_STATE_T_EXPANDING_PENDING,
157 UWB_RSV_STATE_T_EXPANDING_DENIED,
158 UWB_RSV_STATE_T_RESIZED,
128 159
129 UWB_RSV_STATE_LAST, 160 UWB_RSV_STATE_LAST,
130}; 161};
@@ -149,6 +180,12 @@ struct uwb_rsv_target {
149 }; 180 };
150}; 181};
151 182
183struct uwb_rsv_move {
184 struct uwb_mas_bm final_mas;
185 struct uwb_ie_drp *companion_drp_ie;
186 struct uwb_mas_bm companion_mas;
187};
188
152/* 189/*
153 * Number of streams reserved for reservations targeted at DevAddrs. 190 * Number of streams reserved for reservations targeted at DevAddrs.
154 */ 191 */
@@ -186,6 +223,7 @@ typedef void (*uwb_rsv_cb_f)(struct uwb_rsv *rsv);
186 * 223 *
187 * @status: negotiation status 224 * @status: negotiation status
188 * @stream: stream index allocated for this reservation 225 * @stream: stream index allocated for this reservation
226 * @tiebreaker: conflict tiebreaker for this reservation
189 * @mas: reserved MAS 227 * @mas: reserved MAS
190 * @drp_ie: the DRP IE 228 * @drp_ie: the DRP IE
191 * @ie_valid: true iff the DRP IE matches the reservation parameters 229 * @ie_valid: true iff the DRP IE matches the reservation parameters
@@ -201,25 +239,29 @@ struct uwb_rsv {
201 struct uwb_rc *rc; 239 struct uwb_rc *rc;
202 struct list_head rc_node; 240 struct list_head rc_node;
203 struct list_head pal_node; 241 struct list_head pal_node;
242 struct kref kref;
204 243
205 struct uwb_dev *owner; 244 struct uwb_dev *owner;
206 struct uwb_rsv_target target; 245 struct uwb_rsv_target target;
207 enum uwb_drp_type type; 246 enum uwb_drp_type type;
208 int max_mas; 247 int max_mas;
209 int min_mas; 248 int min_mas;
210 int sparsity; 249 int max_interval;
211 bool is_multicast; 250 bool is_multicast;
212 251
213 uwb_rsv_cb_f callback; 252 uwb_rsv_cb_f callback;
214 void *pal_priv; 253 void *pal_priv;
215 254
216 enum uwb_rsv_state state; 255 enum uwb_rsv_state state;
256 bool needs_release_companion_mas;
217 u8 stream; 257 u8 stream;
258 u8 tiebreaker;
218 struct uwb_mas_bm mas; 259 struct uwb_mas_bm mas;
219 struct uwb_ie_drp *drp_ie; 260 struct uwb_ie_drp *drp_ie;
261 struct uwb_rsv_move mv;
220 bool ie_valid; 262 bool ie_valid;
221 struct timer_list timer; 263 struct timer_list timer;
222 bool expired; 264 struct work_struct handle_timeout_work;
223}; 265};
224 266
225static const 267static const
@@ -261,6 +303,13 @@ struct uwb_drp_avail {
261 bool ie_valid; 303 bool ie_valid;
262}; 304};
263 305
306struct uwb_drp_backoff_win {
307 u8 window;
308 u8 n;
309 int total_expired;
310 struct timer_list timer;
311 bool can_reserve_extra_mases;
312};
264 313
265const char *uwb_rsv_state_str(enum uwb_rsv_state state); 314const char *uwb_rsv_state_str(enum uwb_rsv_state state);
266const char *uwb_rsv_type_str(enum uwb_drp_type type); 315const char *uwb_rsv_type_str(enum uwb_drp_type type);
@@ -276,6 +325,8 @@ void uwb_rsv_terminate(struct uwb_rsv *rsv);
276 325
277void uwb_rsv_accept(struct uwb_rsv *rsv, uwb_rsv_cb_f cb, void *pal_priv); 326void uwb_rsv_accept(struct uwb_rsv *rsv, uwb_rsv_cb_f cb, void *pal_priv);
278 327
328void uwb_rsv_get_usable_mas(struct uwb_rsv *orig_rsv, struct uwb_mas_bm *mas);
329
279/** 330/**
280 * Radio Control Interface instance 331 * Radio Control Interface instance
281 * 332 *
@@ -337,23 +388,33 @@ struct uwb_rc {
337 u8 ctx_roll; 388 u8 ctx_roll;
338 389
339 int beaconing; /* Beaconing state [channel number] */ 390 int beaconing; /* Beaconing state [channel number] */
391 int beaconing_forced;
340 int scanning; 392 int scanning;
341 enum uwb_scan_type scan_type:3; 393 enum uwb_scan_type scan_type:3;
342 unsigned ready:1; 394 unsigned ready:1;
343 struct uwb_notifs_chain notifs_chain; 395 struct uwb_notifs_chain notifs_chain;
396 struct uwb_beca uwb_beca;
397
398 struct uwbd uwbd;
344 399
400 struct uwb_drp_backoff_win bow;
345 struct uwb_drp_avail drp_avail; 401 struct uwb_drp_avail drp_avail;
346 struct list_head reservations; 402 struct list_head reservations;
403 struct list_head cnflt_alien_list;
404 struct uwb_mas_bm cnflt_alien_bitmap;
347 struct mutex rsvs_mutex; 405 struct mutex rsvs_mutex;
406 spinlock_t rsvs_lock;
348 struct workqueue_struct *rsv_workq; 407 struct workqueue_struct *rsv_workq;
349 struct work_struct rsv_update_work;
350 408
409 struct delayed_work rsv_update_work;
410 struct delayed_work rsv_alien_bp_work;
411 int set_drp_ie_pending;
351 struct mutex ies_mutex; 412 struct mutex ies_mutex;
352 struct uwb_rc_cmd_set_ie *ies; 413 struct uwb_rc_cmd_set_ie *ies;
353 size_t ies_capacity; 414 size_t ies_capacity;
354 415
355 spinlock_t pal_lock;
356 struct list_head pals; 416 struct list_head pals;
417 int active_pals;
357 418
358 struct uwb_dbg *dbg; 419 struct uwb_dbg *dbg;
359}; 420};
@@ -361,11 +422,19 @@ struct uwb_rc {
361 422
362/** 423/**
363 * struct uwb_pal - a UWB PAL 424 * struct uwb_pal - a UWB PAL
364 * @name: descriptive name for this PAL (wushc, wlp, etc.). 425 * @name: descriptive name for this PAL (wusbhc, wlp, etc.).
365 * @device: a device for the PAL. Used to link the PAL and the radio 426 * @device: a device for the PAL. Used to link the PAL and the radio
366 * controller in sysfs. 427 * controller in sysfs.
428 * @rc: the radio controller the PAL uses.
429 * @channel_changed: called when the channel used by the radio changes.
430 * A channel of -1 means the channel has been stopped.
367 * @new_rsv: called when a peer requests a reservation (may be NULL if 431 * @new_rsv: called when a peer requests a reservation (may be NULL if
368 * the PAL cannot accept reservation requests). 432 * the PAL cannot accept reservation requests).
433 * @channel: channel being used by the PAL; 0 if the PAL isn't using
434 * the radio; -1 if the PAL wishes to use the radio but
435 * cannot.
436 * @debugfs_dir: a debugfs directory which the PAL can use for its own
437 * debugfs files.
369 * 438 *
370 * A Protocol Adaptation Layer (PAL) is a user of the WiMedia UWB 439 * A Protocol Adaptation Layer (PAL) is a user of the WiMedia UWB
371 * radio platform (e.g., WUSB, WLP or Bluetooth UWB AMP). 440 * radio platform (e.g., WUSB, WLP or Bluetooth UWB AMP).
@@ -384,12 +453,21 @@ struct uwb_pal {
384 struct list_head node; 453 struct list_head node;
385 const char *name; 454 const char *name;
386 struct device *device; 455 struct device *device;
387 void (*new_rsv)(struct uwb_rsv *rsv); 456 struct uwb_rc *rc;
457
458 void (*channel_changed)(struct uwb_pal *pal, int channel);
459 void (*new_rsv)(struct uwb_pal *pal, struct uwb_rsv *rsv);
460
461 int channel;
462 struct dentry *debugfs_dir;
388}; 463};
389 464
390void uwb_pal_init(struct uwb_pal *pal); 465void uwb_pal_init(struct uwb_pal *pal);
391int uwb_pal_register(struct uwb_rc *rc, struct uwb_pal *pal); 466int uwb_pal_register(struct uwb_pal *pal);
392void uwb_pal_unregister(struct uwb_rc *rc, struct uwb_pal *pal); 467void uwb_pal_unregister(struct uwb_pal *pal);
468
469int uwb_radio_start(struct uwb_pal *pal);
470void uwb_radio_stop(struct uwb_pal *pal);
393 471
394/* 472/*
395 * General public API 473 * General public API
@@ -443,8 +521,6 @@ ssize_t uwb_rc_vcmd(struct uwb_rc *rc, const char *cmd_name,
443 struct uwb_rccb *cmd, size_t cmd_size, 521 struct uwb_rccb *cmd, size_t cmd_size,
444 u8 expected_type, u16 expected_event, 522 u8 expected_type, u16 expected_event,
445 struct uwb_rceb **preply); 523 struct uwb_rceb **preply);
446ssize_t uwb_rc_get_ie(struct uwb_rc *, struct uwb_rc_evt_get_ie **);
447int uwb_bg_joined(struct uwb_rc *rc);
448 524
449size_t __uwb_addr_print(char *, size_t, const unsigned char *, int); 525size_t __uwb_addr_print(char *, size_t, const unsigned char *, int);
450 526
@@ -520,6 +596,8 @@ void uwb_rc_rm(struct uwb_rc *);
520void uwb_rc_neh_grok(struct uwb_rc *, void *, size_t); 596void uwb_rc_neh_grok(struct uwb_rc *, void *, size_t);
521void uwb_rc_neh_error(struct uwb_rc *, int); 597void uwb_rc_neh_error(struct uwb_rc *, int);
522void uwb_rc_reset_all(struct uwb_rc *rc); 598void uwb_rc_reset_all(struct uwb_rc *rc);
599void uwb_rc_pre_reset(struct uwb_rc *rc);
600void uwb_rc_post_reset(struct uwb_rc *rc);
523 601
524/** 602/**
525 * uwb_rsv_is_owner - is the owner of this reservation the RC? 603 * uwb_rsv_is_owner - is the owner of this reservation the RC?
@@ -531,7 +609,9 @@ static inline bool uwb_rsv_is_owner(struct uwb_rsv *rsv)
531} 609}
532 610
533/** 611/**
534 * Events generated by UWB that can be passed to any listeners 612 * enum uwb_notifs - UWB events that can be passed to any listeners
613 * @UWB_NOTIF_ONAIR: a new neighbour has joined the beacon group.
614 * @UWB_NOTIF_OFFAIR: a neighbour has left the beacon group.
535 * 615 *
536 * Higher layers can register callback functions with the radio 616 * Higher layers can register callback functions with the radio
537 * controller using uwb_notifs_register(). The radio controller 617 * controller using uwb_notifs_register(). The radio controller
@@ -539,8 +619,6 @@ static inline bool uwb_rsv_is_owner(struct uwb_rsv *rsv)
539 * nodes when an event occurs. 619 * nodes when an event occurs.
540 */ 620 */
541enum uwb_notifs { 621enum uwb_notifs {
542 UWB_NOTIF_BG_JOIN = 0, /* radio controller joined a beacon group */
543 UWB_NOTIF_BG_LEAVE = 1, /* radio controller left a beacon group */
544 UWB_NOTIF_ONAIR, 622 UWB_NOTIF_ONAIR,
545 UWB_NOTIF_OFFAIR, 623 UWB_NOTIF_OFFAIR,
546}; 624};
@@ -652,22 +730,9 @@ static inline int edc_inc(struct edc *err_hist, u16 max_err, u16 timeframe)
652 730
653/* Information Element handling */ 731/* Information Element handling */
654 732
655/* For representing the state of writing to a buffer when iterating */
656struct uwb_buf_ctx {
657 char *buf;
658 size_t bytes, size;
659};
660
661typedef int (*uwb_ie_f)(struct uwb_dev *, const struct uwb_ie_hdr *,
662 size_t, void *);
663struct uwb_ie_hdr *uwb_ie_next(void **ptr, size_t *len); 733struct uwb_ie_hdr *uwb_ie_next(void **ptr, size_t *len);
664ssize_t uwb_ie_for_each(struct uwb_dev *uwb_dev, uwb_ie_f fn, void *data, 734int uwb_rc_ie_add(struct uwb_rc *uwb_rc, const struct uwb_ie_hdr *ies, size_t size);
665 const void *buf, size_t size); 735int uwb_rc_ie_rm(struct uwb_rc *uwb_rc, enum uwb_ie element_id);
666int uwb_ie_dump_hex(struct uwb_dev *, const struct uwb_ie_hdr *,
667 size_t, void *);
668int uwb_rc_set_ie(struct uwb_rc *, struct uwb_rc_cmd_set_ie *);
669struct uwb_ie_hdr *uwb_ie_next(void **ptr, size_t *len);
670
671 736
672/* 737/*
673 * Transmission statistics 738 * Transmission statistics
diff --git a/include/linux/uwb/debug-cmd.h b/include/linux/uwb/debug-cmd.h
index 1141f41bab5c..8da004e25628 100644
--- a/include/linux/uwb/debug-cmd.h
+++ b/include/linux/uwb/debug-cmd.h
@@ -32,6 +32,10 @@
32enum uwb_dbg_cmd_type { 32enum uwb_dbg_cmd_type {
33 UWB_DBG_CMD_RSV_ESTABLISH = 1, 33 UWB_DBG_CMD_RSV_ESTABLISH = 1,
34 UWB_DBG_CMD_RSV_TERMINATE = 2, 34 UWB_DBG_CMD_RSV_TERMINATE = 2,
35 UWB_DBG_CMD_IE_ADD = 3,
36 UWB_DBG_CMD_IE_RM = 4,
37 UWB_DBG_CMD_RADIO_START = 5,
38 UWB_DBG_CMD_RADIO_STOP = 6,
35}; 39};
36 40
37struct uwb_dbg_cmd_rsv_establish { 41struct uwb_dbg_cmd_rsv_establish {
@@ -39,18 +43,25 @@ struct uwb_dbg_cmd_rsv_establish {
39 __u8 type; 43 __u8 type;
40 __u16 max_mas; 44 __u16 max_mas;
41 __u16 min_mas; 45 __u16 min_mas;
42 __u8 sparsity; 46 __u8 max_interval;
43}; 47};
44 48
45struct uwb_dbg_cmd_rsv_terminate { 49struct uwb_dbg_cmd_rsv_terminate {
46 int index; 50 int index;
47}; 51};
48 52
53struct uwb_dbg_cmd_ie {
54 __u8 data[128];
55 int len;
56};
57
49struct uwb_dbg_cmd { 58struct uwb_dbg_cmd {
50 __u32 type; 59 __u32 type;
51 union { 60 union {
52 struct uwb_dbg_cmd_rsv_establish rsv_establish; 61 struct uwb_dbg_cmd_rsv_establish rsv_establish;
53 struct uwb_dbg_cmd_rsv_terminate rsv_terminate; 62 struct uwb_dbg_cmd_rsv_terminate rsv_terminate;
63 struct uwb_dbg_cmd_ie ie_add;
64 struct uwb_dbg_cmd_ie ie_rm;
54 }; 65 };
55}; 66};
56 67
diff --git a/include/linux/uwb/debug.h b/include/linux/uwb/debug.h
deleted file mode 100644
index a86a73fe303f..000000000000
--- a/include/linux/uwb/debug.h
+++ /dev/null
@@ -1,82 +0,0 @@
1/*
2 * Ultra Wide Band
3 * Debug Support
4 *
5 * Copyright (C) 2005-2006 Intel Corporation
6 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version
10 * 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301, USA.
21 *
22 *
23 * FIXME: doc
24 * Invoke like:
25 *
26 * #define D_LOCAL 4
27 * #include <linux/uwb/debug.h>
28 *
29 * At the end of your include files.
30 */
31#include <linux/types.h>
32
33struct device;
34extern void dump_bytes(struct device *dev, const void *_buf, size_t rsize);
35
36/* Master debug switch; !0 enables, 0 disables */
37#define D_MASTER (!0)
38
39/* Local (per-file) debug switch; #define before #including */
40#ifndef D_LOCAL
41#define D_LOCAL 0
42#endif
43
44#undef __d_printf
45#undef d_fnstart
46#undef d_fnend
47#undef d_printf
48#undef d_dump
49
50#define __d_printf(l, _tag, _dev, f, a...) \
51do { \
52 struct device *__dev = (_dev); \
53 if (D_MASTER && D_LOCAL >= (l)) { \
54 char __head[64] = ""; \
55 if (_dev != NULL) { \
56 if ((unsigned long)__dev < 4096) \
57 printk(KERN_ERR "E: Corrupt dev %p\n", \
58 __dev); \
59 else \
60 snprintf(__head, sizeof(__head), \
61 "%s %s: ", \
62 dev_driver_string(__dev), \
63 __dev->bus_id); \
64 } \
65 printk(KERN_ERR "%s%s" _tag ": " f, __head, \
66 __func__, ## a); \
67 } \
68} while (0 && _dev)
69
70#define d_fnstart(l, _dev, f, a...) \
71 __d_printf(l, " FNSTART", _dev, f, ## a)
72#define d_fnend(l, _dev, f, a...) \
73 __d_printf(l, " FNEND", _dev, f, ## a)
74#define d_printf(l, _dev, f, a...) \
75 __d_printf(l, "", _dev, f, ## a)
76#define d_dump(l, _dev, ptr, size) \
77do { \
78 struct device *__dev = _dev; \
79 if (D_MASTER && D_LOCAL >= (l)) \
80 dump_bytes(__dev, ptr, size); \
81} while (0 && _dev)
82#define d_test(l) (D_MASTER && D_LOCAL >= (l))
diff --git a/include/linux/uwb/spec.h b/include/linux/uwb/spec.h
index 198c15f8e251..b52e44f1bd33 100644
--- a/include/linux/uwb/spec.h
+++ b/include/linux/uwb/spec.h
@@ -59,6 +59,11 @@ enum { UWB_NUM_ZONES = 16 };
59#define UWB_MAS_PER_ZONE (UWB_NUM_MAS / UWB_NUM_ZONES) 59#define UWB_MAS_PER_ZONE (UWB_NUM_MAS / UWB_NUM_ZONES)
60 60
61/* 61/*
62 * Number of MAS required before a row can be considered available.
63 */
64#define UWB_USABLE_MAS_PER_ROW (UWB_NUM_ZONES - 1)
65
66/*
62 * Number of streams per DRP reservation between a pair of devices. 67 * Number of streams per DRP reservation between a pair of devices.
63 * 68 *
64 * [ECMA-368] section 16.8.6. 69 * [ECMA-368] section 16.8.6.
@@ -94,6 +99,26 @@ enum { UWB_BEACON_SLOT_LENGTH_US = 85 };
94enum { UWB_MAX_LOST_BEACONS = 3 }; 99enum { UWB_MAX_LOST_BEACONS = 3 };
95 100
96/* 101/*
102 * mDRPBackOffWinMin
103 *
104 * The minimum number of superframes to wait before trying to reserve
105 * extra MAS.
106 *
107 * [ECMA-368] section 17.16
108 */
109enum { UWB_DRP_BACKOFF_WIN_MIN = 2 };
110
111/*
112 * mDRPBackOffWinMax
113 *
114 * The maximum number of superframes to wait before trying to reserve
115 * extra MAS.
116 *
117 * [ECMA-368] section 17.16
118 */
119enum { UWB_DRP_BACKOFF_WIN_MAX = 16 };
120
121/*
97 * Length of a superframe in microseconds. 122 * Length of a superframe in microseconds.
98 */ 123 */
99#define UWB_SUPERFRAME_LENGTH_US (UWB_MAS_LENGTH_US * UWB_NUM_MAS) 124#define UWB_SUPERFRAME_LENGTH_US (UWB_MAS_LENGTH_US * UWB_NUM_MAS)
@@ -200,6 +225,12 @@ enum uwb_drp_reason {
200 UWB_DRP_REASON_MODIFIED, 225 UWB_DRP_REASON_MODIFIED,
201}; 226};
202 227
228/** Relinquish Request Reason Codes ([ECMA-368] table 113) */
229enum uwb_relinquish_req_reason {
230 UWB_RELINQUISH_REQ_REASON_NON_SPECIFIC = 0,
231 UWB_RELINQUISH_REQ_REASON_OVER_ALLOCATION,
232};
233
203/** 234/**
204 * DRP Notification Reason Codes (WHCI 0.95 [3.1.4.9]) 235 * DRP Notification Reason Codes (WHCI 0.95 [3.1.4.9])
205 */ 236 */
@@ -252,6 +283,7 @@ enum uwb_ie {
252 UWB_APP_SPEC_PROBE_IE = 15, 283 UWB_APP_SPEC_PROBE_IE = 15,
253 UWB_IDENTIFICATION_IE = 19, 284 UWB_IDENTIFICATION_IE = 19,
254 UWB_MASTER_KEY_ID_IE = 20, 285 UWB_MASTER_KEY_ID_IE = 20,
286 UWB_RELINQUISH_REQUEST_IE = 21,
255 UWB_IE_WLP = 250, /* WiMedia Logical Link Control Protocol WLP 0.99 */ 287 UWB_IE_WLP = 250, /* WiMedia Logical Link Control Protocol WLP 0.99 */
256 UWB_APP_SPEC_IE = 255, 288 UWB_APP_SPEC_IE = 255,
257}; 289};
@@ -365,6 +397,27 @@ struct uwb_ie_drp_avail {
365 DECLARE_BITMAP(bmp, UWB_NUM_MAS); 397 DECLARE_BITMAP(bmp, UWB_NUM_MAS);
366} __attribute__((packed)); 398} __attribute__((packed));
367 399
400/* Relinqish Request IE ([ECMA-368] section 16.8.19). */
401struct uwb_relinquish_request_ie {
402 struct uwb_ie_hdr hdr;
403 __le16 relinquish_req_control;
404 struct uwb_dev_addr dev_addr;
405 struct uwb_drp_alloc allocs[];
406} __attribute__((packed));
407
408static inline int uwb_ie_relinquish_req_reason_code(struct uwb_relinquish_request_ie *ie)
409{
410 return (le16_to_cpu(ie->relinquish_req_control) >> 0) & 0xf;
411}
412
413static inline void uwb_ie_relinquish_req_set_reason_code(struct uwb_relinquish_request_ie *ie,
414 int reason_code)
415{
416 u16 ctrl = le16_to_cpu(ie->relinquish_req_control);
417 ctrl = (ctrl & ~(0xf << 0)) | (reason_code << 0);
418 ie->relinquish_req_control = cpu_to_le16(ctrl);
419}
420
368/** 421/**
369 * The Vendor ID is set to an OUI that indicates the vendor of the device. 422 * The Vendor ID is set to an OUI that indicates the vendor of the device.
370 * ECMA-368 [16.8.10] 423 * ECMA-368 [16.8.10]
diff --git a/include/linux/uwb/umc.h b/include/linux/uwb/umc.h
index 36a39e34f8d7..4b4fc0f43855 100644
--- a/include/linux/uwb/umc.h
+++ b/include/linux/uwb/umc.h
@@ -89,6 +89,8 @@ struct umc_driver {
89 void (*remove)(struct umc_dev *); 89 void (*remove)(struct umc_dev *);
90 int (*suspend)(struct umc_dev *, pm_message_t state); 90 int (*suspend)(struct umc_dev *, pm_message_t state);
91 int (*resume)(struct umc_dev *); 91 int (*resume)(struct umc_dev *);
92 int (*pre_reset)(struct umc_dev *);
93 int (*post_reset)(struct umc_dev *);
92 94
93 struct device_driver driver; 95 struct device_driver driver;
94}; 96};
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 4669d7e72e75..5571dbe1c0ad 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -293,6 +293,7 @@ struct v4l2_pix_format {
293#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */ 293#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */
294#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */ 294#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */
295#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */ 295#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */
296#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */
296#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */ 297#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */
297#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 16 YVU411 planar */ 298#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 16 YVU411 planar */
298#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */ 299#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */
@@ -304,6 +305,8 @@ struct v4l2_pix_format {
304/* two planes -- one Y, one Cr + Cb interleaved */ 305/* two planes -- one Y, one Cr + Cb interleaved */
305#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ 306#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */
306#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */ 307#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */
308#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */
309#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
307 310
308/* The following formats are not defined in the V4L2 specification */ 311/* The following formats are not defined in the V4L2 specification */
309#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */ 312#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */
@@ -1050,7 +1053,7 @@ enum v4l2_mpeg_video_bitrate_mode {
1050#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210) 1053#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210)
1051#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211) 1054#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211)
1052 1055
1053/* MPEG-class control IDs specific to the CX2584x driver as defined by V4L2 */ 1056/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
1054#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) 1057#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)
1055#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0) 1058#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0)
1056enum v4l2_mpeg_cx2341x_video_spatial_filter_mode { 1059enum v4l2_mpeg_cx2341x_video_spatial_filter_mode {
@@ -1117,6 +1120,12 @@ enum v4l2_exposure_auto_type {
1117#define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11) 1120#define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11)
1118#define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12) 1121#define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12)
1119 1122
1123#define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13)
1124#define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14)
1125#define V4L2_CID_ZOOM_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE+15)
1126
1127#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16)
1128
1120/* 1129/*
1121 * T U N I N G 1130 * T U N I N G
1122 */ 1131 */
@@ -1361,24 +1370,41 @@ struct v4l2_streamparm {
1361/* 1370/*
1362 * A D V A N C E D D E B U G G I N G 1371 * A D V A N C E D D E B U G G I N G
1363 * 1372 *
1364 * NOTE: EXPERIMENTAL API 1373 * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS!
1374 * FOR DEBUGGING, TESTING AND INTERNAL USE ONLY!
1365 */ 1375 */
1366 1376
1367/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */ 1377/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */
1368 1378
1369#define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */ 1379#define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */
1370#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver ID */ 1380#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */
1371#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */ 1381#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */
1382#define V4L2_CHIP_MATCH_AC97 3 /* Match against anciliary AC97 chip */
1383
1384struct v4l2_dbg_match {
1385 __u32 type; /* Match type */
1386 union { /* Match this chip, meaning determined by type */
1387 __u32 addr;
1388 char name[32];
1389 };
1390} __attribute__ ((packed));
1372 1391
1373struct v4l2_register { 1392struct v4l2_dbg_register {
1374 __u32 match_type; /* Match type */ 1393 struct v4l2_dbg_match match;
1375 __u32 match_chip; /* Match this chip, meaning determined by match_type */ 1394 __u32 size; /* register size in bytes */
1376 __u64 reg; 1395 __u64 reg;
1377 __u64 val; 1396 __u64 val;
1378}; 1397} __attribute__ ((packed));
1379 1398
1380/* VIDIOC_G_CHIP_IDENT */ 1399/* VIDIOC_DBG_G_CHIP_IDENT */
1381struct v4l2_chip_ident { 1400struct v4l2_dbg_chip_ident {
1401 struct v4l2_dbg_match match;
1402 __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */
1403 __u32 revision; /* chip revision, chip specific */
1404} __attribute__ ((packed));
1405
1406/* VIDIOC_G_CHIP_IDENT_OLD: Deprecated, do not use */
1407struct v4l2_chip_ident_old {
1382 __u32 match_type; /* Match type */ 1408 __u32 match_type; /* Match type */
1383 __u32 match_chip; /* Match this chip, meaning determined by match_type */ 1409 __u32 match_chip; /* Match this chip, meaning determined by match_type */
1384 __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */ 1410 __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */
@@ -1450,14 +1476,25 @@ struct v4l2_chip_ident {
1450#define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx) 1476#define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx)
1451#define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd) 1477#define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd)
1452#define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd) 1478#define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd)
1479#endif
1453 1480
1454/* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ 1481#if 1
1455#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_register) 1482/* Experimental, meant for debugging, testing and internal use.
1456#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_register) 1483 Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined.
1457 1484 You must be root to use these ioctls. Never use these in applications! */
1458#define VIDIOC_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_chip_ident) 1485#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register)
1486#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register)
1487
1488/* Experimental, meant for debugging, testing and internal use.
1489 Never use this ioctl in applications! */
1490#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident)
1491/* This is deprecated and will go away in 2.6.30 */
1492#define VIDIOC_G_CHIP_IDENT_OLD _IOWR('V', 81, struct v4l2_chip_ident_old)
1459#endif 1493#endif
1494
1460#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) 1495#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
1496/* Reminder: when adding new ioctls please add support for them to
1497 drivers/media/video/v4l2-compat-ioctl32.c as well! */
1461 1498
1462#ifdef __OLD_VIDIOC_ 1499#ifdef __OLD_VIDIOC_
1463/* for compatibility, will go away some day */ 1500/* for compatibility, will go away some day */
diff --git a/include/linux/virtio_balloon.h b/include/linux/virtio_balloon.h
index c30c7bfbf39b..8726ff77763e 100644
--- a/include/linux/virtio_balloon.h
+++ b/include/linux/virtio_balloon.h
@@ -10,6 +10,9 @@
10/* The feature bitmap for virtio balloon */ 10/* The feature bitmap for virtio balloon */
11#define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */ 11#define VIRTIO_BALLOON_F_MUST_TELL_HOST 0 /* Tell before reclaiming pages */
12 12
13/* Size of a PFN in the balloon interface. */
14#define VIRTIO_BALLOON_PFN_SHIFT 12
15
13struct virtio_balloon_config 16struct virtio_balloon_config
14{ 17{
15 /* Number of pages host wants Guest to give up. */ 18 /* Number of pages host wants Guest to give up. */
diff --git a/include/linux/virtio_console.h b/include/linux/virtio_console.h
index 19a0da0dba41..7615ffcdd555 100644
--- a/include/linux/virtio_console.h
+++ b/include/linux/virtio_console.h
@@ -7,6 +7,17 @@
7/* The ID for virtio console */ 7/* The ID for virtio console */
8#define VIRTIO_ID_CONSOLE 3 8#define VIRTIO_ID_CONSOLE 3
9 9
10/* Feature bits */
11#define VIRTIO_CONSOLE_F_SIZE 0 /* Does host provide console size? */
12
13struct virtio_console_config {
14 /* colums of the screens */
15 __u16 cols;
16 /* rows of the screens */
17 __u16 rows;
18} __attribute__((packed));
19
20
10#ifdef __KERNEL__ 21#ifdef __KERNEL__
11int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int)); 22int __init virtio_cons_early_init(int (*put_chars)(u32, const char *, int));
12#endif /* __KERNEL__ */ 23#endif /* __KERNEL__ */
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index 5e33761b9b8a..5cdd0aa8bde9 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -20,6 +20,7 @@
20#define VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */ 20#define VIRTIO_NET_F_HOST_TSO6 12 /* Host can handle TSOv6 in. */
21#define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */ 21#define VIRTIO_NET_F_HOST_ECN 13 /* Host can handle TSO[6] w/ ECN in. */
22#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */ 22#define VIRTIO_NET_F_HOST_UFO 14 /* Host can handle UFO in. */
23#define VIRTIO_NET_F_MRG_RXBUF 15 /* Host can merge receive buffers. */
23 24
24struct virtio_net_config 25struct virtio_net_config
25{ 26{
@@ -44,4 +45,12 @@ struct virtio_net_hdr
44 __u16 csum_start; /* Position to start checksumming from */ 45 __u16 csum_start; /* Position to start checksumming from */
45 __u16 csum_offset; /* Offset after that to place checksum */ 46 __u16 csum_offset; /* Offset after that to place checksum */
46}; 47};
48
49/* This is the version of the header to use when the MRG_RXBUF
50 * feature has been negotiated. */
51struct virtio_net_hdr_mrg_rxbuf {
52 struct virtio_net_hdr hdr;
53 __u16 num_buffers; /* Number of merged rx buffers */
54};
55
47#endif /* _LINUX_VIRTIO_NET_H */ 56#endif /* _LINUX_VIRTIO_NET_H */
diff --git a/include/linux/virtio_pci.h b/include/linux/virtio_pci.h
index cdef35742932..cd0fd5d181a6 100644
--- a/include/linux/virtio_pci.h
+++ b/include/linux/virtio_pci.h
@@ -53,4 +53,12 @@
53 53
54/* Virtio ABI version, this must match exactly */ 54/* Virtio ABI version, this must match exactly */
55#define VIRTIO_PCI_ABI_VERSION 0 55#define VIRTIO_PCI_ABI_VERSION 0
56
57/* How many bits to shift physical queue address written to QUEUE_PFN.
58 * 12 is historical, and due to x86 page size. */
59#define VIRTIO_PCI_QUEUE_ADDR_SHIFT 12
60
61/* The alignment to use between consumer and producer parts of vring.
62 * x86 pagesize again. */
63#define VIRTIO_PCI_VRING_ALIGN 4096
56#endif 64#endif
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index c4a598fb3826..71e03722fb59 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -83,7 +83,7 @@ struct vring {
83 * __u16 avail_idx; 83 * __u16 avail_idx;
84 * __u16 available[num]; 84 * __u16 available[num];
85 * 85 *
86 * // Padding to the next page boundary. 86 * // Padding to the next align boundary.
87 * char pad[]; 87 * char pad[];
88 * 88 *
89 * // A ring of used descriptor heads with free-running index. 89 * // A ring of used descriptor heads with free-running index.
@@ -93,19 +93,19 @@ struct vring {
93 * }; 93 * };
94 */ 94 */
95static inline void vring_init(struct vring *vr, unsigned int num, void *p, 95static inline void vring_init(struct vring *vr, unsigned int num, void *p,
96 unsigned long pagesize) 96 unsigned long align)
97{ 97{
98 vr->num = num; 98 vr->num = num;
99 vr->desc = p; 99 vr->desc = p;
100 vr->avail = p + num*sizeof(struct vring_desc); 100 vr->avail = p + num*sizeof(struct vring_desc);
101 vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + pagesize-1) 101 vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + align-1)
102 & ~(pagesize - 1)); 102 & ~(align - 1));
103} 103}
104 104
105static inline unsigned vring_size(unsigned int num, unsigned long pagesize) 105static inline unsigned vring_size(unsigned int num, unsigned long align)
106{ 106{
107 return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num) 107 return ((sizeof(struct vring_desc) * num + sizeof(__u16) * (2 + num)
108 + pagesize - 1) & ~(pagesize - 1)) 108 + align - 1) & ~(align - 1))
109 + sizeof(__u16) * 2 + sizeof(struct vring_used_elem) * num; 109 + sizeof(__u16) * 2 + sizeof(struct vring_used_elem) * num;
110} 110}
111 111
@@ -115,6 +115,7 @@ struct virtio_device;
115struct virtqueue; 115struct virtqueue;
116 116
117struct virtqueue *vring_new_virtqueue(unsigned int num, 117struct virtqueue *vring_new_virtqueue(unsigned int num,
118 unsigned int vring_align,
118 struct virtio_device *vdev, 119 struct virtio_device *vdev,
119 void *pages, 120 void *pages,
120 void (*notify)(struct virtqueue *vq), 121 void (*notify)(struct virtqueue *vq),
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 307b88577eaa..506e7620a986 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -97,6 +97,10 @@ extern void unmap_kernel_range(unsigned long addr, unsigned long size);
97extern struct vm_struct *alloc_vm_area(size_t size); 97extern struct vm_struct *alloc_vm_area(size_t size);
98extern void free_vm_area(struct vm_struct *area); 98extern void free_vm_area(struct vm_struct *area);
99 99
100/* for /dev/kmem */
101extern long vread(char *buf, char *addr, unsigned long count);
102extern long vwrite(char *buf, char *addr, unsigned long count);
103
100/* 104/*
101 * Internals. Dont't use.. 105 * Internals. Dont't use..
102 */ 106 */
diff --git a/include/linux/wimax.h b/include/linux/wimax.h
new file mode 100644
index 000000000000..c89de7f4e5b9
--- /dev/null
+++ b/include/linux/wimax.h
@@ -0,0 +1,234 @@
1/*
2 * Linux WiMax
3 * API for user space
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * Intel Corporation <linux-wimax@intel.com>
36 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
37 * - Initial implementation
38 *
39 *
40 * This file declares the user/kernel protocol that is spoken over
41 * Generic Netlink, as well as any type declaration that is to be used
42 * by kernel and user space.
43 *
44 * It is intended for user space to clone it verbatim to use it as a
45 * primary reference for definitions.
46 *
47 * Stuff intended for kernel usage as well as full protocol and stack
48 * documentation is rooted in include/net/wimax.h.
49 */
50
51#ifndef __LINUX__WIMAX_H__
52#define __LINUX__WIMAX_H__
53
54#include <linux/types.h>
55
56enum {
57 /**
58 * Version of the interface (unsigned decimal, MMm, max 25.5)
59 * M - Major: change if removing or modifying an existing call.
60 * m - minor: change when adding a new call
61 */
62 WIMAX_GNL_VERSION = 00,
63 /* Generic NetLink attributes */
64 WIMAX_GNL_ATTR_INVALID = 0x00,
65 WIMAX_GNL_ATTR_MAX = 10,
66};
67
68
69/*
70 * Generic NetLink operations
71 *
72 * Most of these map to an API call; _OP_ stands for operation, _RP_
73 * for reply and _RE_ for report (aka: signal).
74 */
75enum {
76 WIMAX_GNL_OP_MSG_FROM_USER, /* User to kernel message */
77 WIMAX_GNL_OP_MSG_TO_USER, /* Kernel to user message */
78 WIMAX_GNL_OP_RFKILL, /* Run wimax_rfkill() */
79 WIMAX_GNL_OP_RESET, /* Run wimax_rfkill() */
80 WIMAX_GNL_RE_STATE_CHANGE, /* Report: status change */
81};
82
83
84/* Message from user / to user */
85enum {
86 WIMAX_GNL_MSG_IFIDX = 1,
87 WIMAX_GNL_MSG_PIPE_NAME,
88 WIMAX_GNL_MSG_DATA,
89};
90
91
92/*
93 * wimax_rfkill()
94 *
95 * The state of the radio (ON/OFF) is mapped to the rfkill subsystem's
96 * switch state (DISABLED/ENABLED).
97 */
98enum wimax_rf_state {
99 WIMAX_RF_OFF = 0, /* Radio is off, rfkill on/enabled */
100 WIMAX_RF_ON = 1, /* Radio is on, rfkill off/disabled */
101 WIMAX_RF_QUERY = 2,
102};
103
104/* Attributes */
105enum {
106 WIMAX_GNL_RFKILL_IFIDX = 1,
107 WIMAX_GNL_RFKILL_STATE,
108};
109
110
111/* Attributes for wimax_reset() */
112enum {
113 WIMAX_GNL_RESET_IFIDX = 1,
114};
115
116
117/*
118 * Attributes for the Report State Change
119 *
120 * For now we just have the old and new states; new attributes might
121 * be added later on.
122 */
123enum {
124 WIMAX_GNL_STCH_IFIDX = 1,
125 WIMAX_GNL_STCH_STATE_OLD,
126 WIMAX_GNL_STCH_STATE_NEW,
127};
128
129
130/**
131 * enum wimax_st - The different states of a WiMAX device
132 * @__WIMAX_ST_NULL: The device structure has been allocated and zeroed,
133 * but still wimax_dev_add() hasn't been called. There is no state.
134 *
135 * @WIMAX_ST_DOWN: The device has been registered with the WiMAX and
136 * networking stacks, but it is not initialized (normally that is
137 * done with 'ifconfig DEV up' [or equivalent], which can upload
138 * firmware and enable communications with the device).
139 * In this state, the device is powered down and using as less
140 * power as possible.
141 * This state is the default after a call to wimax_dev_add(). It
142 * is ok to have drivers move directly to %WIMAX_ST_UNINITIALIZED
143 * or %WIMAX_ST_RADIO_OFF in _probe() after the call to
144 * wimax_dev_add().
145 * It is recommended that the driver leaves this state when
146 * calling 'ifconfig DEV up' and enters it back on 'ifconfig DEV
147 * down'.
148 *
149 * @__WIMAX_ST_QUIESCING: The device is being torn down, so no API
150 * operations are allowed to proceed except the ones needed to
151 * complete the device clean up process.
152 *
153 * @WIMAX_ST_UNINITIALIZED: [optional] Communication with the device
154 * is setup, but the device still requires some configuration
155 * before being operational.
156 * Some WiMAX API calls might work.
157 *
158 * @WIMAX_ST_RADIO_OFF: The device is fully up; radio is off (wether
159 * by hardware or software switches).
160 * It is recommended to always leave the device in this state
161 * after initialization.
162 *
163 * @WIMAX_ST_READY: The device is fully up and radio is on.
164 *
165 * @WIMAX_ST_SCANNING: [optional] The device has been instructed to
166 * scan. In this state, the device cannot be actively connected to
167 * a network.
168 *
169 * @WIMAX_ST_CONNECTING: The device is connecting to a network. This
170 * state exists because in some devices, the connect process can
171 * include a number of negotiations between user space, kernel
172 * space and the device. User space needs to know what the device
173 * is doing. If the connect sequence in a device is atomic and
174 * fast, the device can transition directly to CONNECTED
175 *
176 * @WIMAX_ST_CONNECTED: The device is connected to a network.
177 *
178 * @__WIMAX_ST_INVALID: This is an invalid state used to mark the
179 * maximum numeric value of states.
180 *
181 * Description:
182 *
183 * Transitions from one state to another one are atomic and can only
184 * be caused in kernel space with wimax_state_change(). To read the
185 * state, use wimax_state_get().
186 *
187 * States starting with __ are internal and shall not be used or
188 * referred to by drivers or userspace. They look ugly, but that's the
189 * point -- if any use is made non-internal to the stack, it is easier
190 * to catch on review.
191 *
192 * All API operations [with well defined exceptions] will take the
193 * device mutex before starting and then check the state. If the state
194 * is %__WIMAX_ST_NULL, %WIMAX_ST_DOWN, %WIMAX_ST_UNINITIALIZED or
195 * %__WIMAX_ST_QUIESCING, it will drop the lock and quit with
196 * -%EINVAL, -%ENOMEDIUM, -%ENOTCONN or -%ESHUTDOWN.
197 *
198 * The order of the definitions is important, so we can do numerical
199 * comparisons (eg: < %WIMAX_ST_RADIO_OFF means the device is not ready
200 * to operate).
201 */
202/*
203 * The allowed state transitions are described in the table below
204 * (states in rows can go to states in columns where there is an X):
205 *
206 * UNINI RADIO READY SCAN CONNEC CONNEC
207 * NULL DOWN QUIESCING TIALIZED OFF NING TING TED
208 * NULL - x
209 * DOWN - x x x
210 * QUIESCING x -
211 * UNINITIALIZED x - x
212 * RADIO_OFF x - x
213 * READY x x - x x x
214 * SCANNING x x x - x x
215 * CONNECTING x x x x - x
216 * CONNECTED x x x -
217 *
218 * This table not available in kernel-doc because the formatting messes it up.
219 */
220 enum wimax_st {
221 __WIMAX_ST_NULL = 0,
222 WIMAX_ST_DOWN,
223 __WIMAX_ST_QUIESCING,
224 WIMAX_ST_UNINITIALIZED,
225 WIMAX_ST_RADIO_OFF,
226 WIMAX_ST_READY,
227 WIMAX_ST_SCANNING,
228 WIMAX_ST_CONNECTING,
229 WIMAX_ST_CONNECTED,
230 __WIMAX_ST_INVALID /* Always keep last */
231};
232
233
234#endif /* #ifndef __LINUX__WIMAX_H__ */
diff --git a/include/linux/wimax/Kbuild b/include/linux/wimax/Kbuild
new file mode 100644
index 000000000000..3cb4f269bb09
--- /dev/null
+++ b/include/linux/wimax/Kbuild
@@ -0,0 +1 @@
header-y += i2400m.h
diff --git a/include/linux/wimax/debug.h b/include/linux/wimax/debug.h
new file mode 100644
index 000000000000..ba0c49399a83
--- /dev/null
+++ b/include/linux/wimax/debug.h
@@ -0,0 +1,453 @@
1/*
2 * Linux WiMAX
3 * Collection of tools to manage debug operations.
4 *
5 *
6 * Copyright (C) 2005-2007 Intel Corporation
7 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version
11 * 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 *
23 *
24 * Don't #include this file directly, read on!
25 *
26 *
27 * EXECUTING DEBUGGING ACTIONS OR NOT
28 *
29 * The main thing this framework provides is decission power to take a
30 * debug action (like printing a message) if the current debug level
31 * allows it.
32 *
33 * The decission power is at two levels: at compile-time (what does
34 * not make it is compiled out) and at run-time. The run-time
35 * selection is done per-submodule (as they are declared by the user
36 * of the framework).
37 *
38 * A call to d_test(L) (L being the target debug level) returns true
39 * if the action should be taken because the current debug levels
40 * allow it (both compile and run time).
41 *
42 * It follows that a call to d_test() that can be determined to be
43 * always false at compile time will get the code depending on it
44 * compiled out by optimization.
45 *
46 *
47 * DEBUG LEVELS
48 *
49 * It is up to the caller to define how much a debugging level is.
50 *
51 * Convention sets 0 as "no debug" (so an action marked as debug level 0
52 * will always be taken). The increasing debug levels are used for
53 * increased verbosity.
54 *
55 *
56 * USAGE
57 *
58 * Group the code in modules and submodules inside each module [which
59 * in most cases maps to Linux modules and .c files that compose
60 * those].
61 *
62 *
63 * For each module, there is:
64 *
65 * - a MODULENAME (single word, legal C identifier)
66 *
67 * - a debug-levels.h header file that declares the list of
68 * submodules and that is included by all .c files that use
69 * the debugging tools. The file name can be anything.
70 *
71 * - some (optional) .c code to manipulate the runtime debug levels
72 * through debugfs.
73 *
74 * The debug-levels.h file would look like:
75 *
76 * #ifndef __debug_levels__h__
77 * #define __debug_levels__h__
78 *
79 * #define D_MODULENAME modulename
80 * #define D_MASTER 10
81 *
82 * #include <linux/wimax/debug.h>
83 *
84 * enum d_module {
85 * D_SUBMODULE_DECLARE(submodule_1),
86 * D_SUBMODULE_DECLARE(submodule_2),
87 * ...
88 * D_SUBMODULE_DECLARE(submodule_N)
89 * };
90 *
91 * #endif
92 *
93 * D_MASTER is the maximum compile-time debug level; any debug actions
94 * above this will be out. D_MODULENAME is the module name (legal C
95 * identifier), which has to be unique for each module (to avoid
96 * namespace collisions during linkage). Note those #defines need to
97 * be done before #including debug.h
98 *
99 * We declare N different submodules whose debug level can be
100 * independently controlled during runtime.
101 *
102 * In a .c file of the module (and only in one of them), define the
103 * following code:
104 *
105 * struct d_level D_LEVEL[] = {
106 * D_SUBMODULE_DEFINE(submodule_1),
107 * D_SUBMODULE_DEFINE(submodule_2),
108 * ...
109 * D_SUBMODULE_DEFINE(submodule_N),
110 * };
111 * size_t D_LEVEL_SIZE = ARRAY_SIZE(D_LEVEL);
112 *
113 * Externs for d_level_MODULENAME and d_level_size_MODULENAME are used
114 * and declared in this file using the D_LEVEL and D_LEVEL_SIZE macros
115 * #defined also in this file.
116 *
117 * To manipulate from user space the levels, create a debugfs dentry
118 * and then register each submodule with:
119 *
120 * result = d_level_register_debugfs("PREFIX_", submodule_X, parent);
121 * if (result < 0)
122 * goto error;
123 *
124 * Where PREFIX_ is a name of your chosing. This will create debugfs
125 * file with a single numeric value that can be use to tweak it. To
126 * remove the entires, just use debugfs_remove_recursive() on 'parent'.
127 *
128 * NOTE: remember that even if this will show attached to some
129 * particular instance of a device, the settings are *global*.
130 *
131 *
132 * On each submodule (for example, .c files), the debug infrastructure
133 * should be included like this:
134 *
135 * #define D_SUBMODULE submodule_x // matches one in debug-levels.h
136 * #include "debug-levels.h"
137 *
138 * after #including all your include files.
139 *
140 *
141 * Now you can use the d_*() macros below [d_test(), d_fnstart(),
142 * d_fnend(), d_printf(), d_dump()].
143 *
144 * If their debug level is greater than D_MASTER, they will be
145 * compiled out.
146 *
147 * If their debug level is lower or equal than D_MASTER but greater
148 * than the current debug level of their submodule, they'll be
149 * ignored.
150 *
151 * Otherwise, the action will be performed.
152 */
153#ifndef __debug__h__
154#define __debug__h__
155
156#include <linux/types.h>
157#include <linux/device.h>
158
159
160/* Backend stuff */
161
162/*
163 * Debug backend: generate a message header from a 'struct device'
164 *
165 * @head: buffer where to place the header
166 * @head_size: length of @head
167 * @dev: pointer to device used to generate a header from. If NULL,
168 * an empty ("") header is generated.
169 */
170static inline
171void __d_head(char *head, size_t head_size,
172 struct device *dev)
173{
174 if (dev == NULL)
175 head[0] = 0;
176 else if ((unsigned long)dev < 4096) {
177 printk(KERN_ERR "E: Corrupt dev %p\n", dev);
178 WARN_ON(1);
179 } else
180 snprintf(head, head_size, "%s %s: ",
181 dev_driver_string(dev), dev->bus_id);
182}
183
184
185/*
186 * Debug backend: log some message if debugging is enabled
187 *
188 * @l: intended debug level
189 * @tag: tag to prefix the message with
190 * @dev: 'struct device' associated to this message
191 * @f: printf-like format and arguments
192 *
193 * Note this is optimized out if it doesn't pass the compile-time
194 * check; however, it is *always* compiled. This is useful to make
195 * sure the printf-like formats and variables are always checked and
196 * they don't get bit rot if you have all the debugging disabled.
197 */
198#define _d_printf(l, tag, dev, f, a...) \
199do { \
200 char head[64]; \
201 if (!d_test(l)) \
202 break; \
203 __d_head(head, sizeof(head), dev); \
204 printk(KERN_ERR "%s%s%s: " f, head, __func__, tag, ##a); \
205} while (0)
206
207
208/*
209 * CPP sintatic sugar to generate A_B like symbol names when one of
210 * the arguments is a a preprocessor #define.
211 */
212#define __D_PASTE__(varname, modulename) varname##_##modulename
213#define __D_PASTE(varname, modulename) (__D_PASTE__(varname, modulename))
214#define _D_SUBMODULE_INDEX(_name) (D_SUBMODULE_DECLARE(_name))
215
216
217/*
218 * Store a submodule's runtime debug level and name
219 */
220struct d_level {
221 u8 level;
222 const char *name;
223};
224
225
226/*
227 * List of available submodules and their debug levels
228 *
229 * We call them d_level_MODULENAME and d_level_size_MODULENAME; the
230 * macros D_LEVEL and D_LEVEL_SIZE contain the name already for
231 * convenience.
232 *
233 * This array and the size are defined on some .c file that is part of
234 * the current module.
235 */
236#define D_LEVEL __D_PASTE(d_level, D_MODULENAME)
237#define D_LEVEL_SIZE __D_PASTE(d_level_size, D_MODULENAME)
238
239extern struct d_level D_LEVEL[];
240extern size_t D_LEVEL_SIZE;
241
242
243/*
244 * Frontend stuff
245 *
246 *
247 * Stuff you need to declare prior to using the actual "debug" actions
248 * (defined below).
249 */
250
251#ifndef D_MODULENAME
252#error D_MODULENAME is not defined in your debug-levels.h file
253/**
254 * D_MODULE - Name of the current module
255 *
256 * #define in your module's debug-levels.h, making sure it is
257 * unique. This has to be a legal C identifier.
258 */
259#define D_MODULENAME undefined_modulename
260#endif
261
262
263#ifndef D_MASTER
264#warning D_MASTER not defined, but debug.h included! [see docs]
265/**
266 * D_MASTER - Compile time maximum debug level
267 *
268 * #define in your debug-levels.h file to the maximum debug level the
269 * runtime code will be allowed to have. This allows you to provide a
270 * main knob.
271 *
272 * Anything above that level will be optimized out of the compile.
273 *
274 * Defaults to zero (no debug code compiled in).
275 *
276 * Maximum one definition per module (at the debug-levels.h file).
277 */
278#define D_MASTER 0
279#endif
280
281#ifndef D_SUBMODULE
282#error D_SUBMODULE not defined, but debug.h included! [see docs]
283/**
284 * D_SUBMODULE - Name of the current submodule
285 *
286 * #define in your submodule .c file before #including debug-levels.h
287 * to the name of the current submodule as previously declared and
288 * defined with D_SUBMODULE_DECLARE() (in your module's
289 * debug-levels.h) and D_SUBMODULE_DEFINE().
290 *
291 * This is used to provide runtime-control over the debug levels.
292 *
293 * Maximum one per .c file! Can be shared among different .c files
294 * (meaning they belong to the same submodule categorization).
295 */
296#define D_SUBMODULE undefined_module
297#endif
298
299
300/**
301 * D_SUBMODULE_DECLARE - Declare a submodule for runtime debug level control
302 *
303 * @_name: name of the submodule, restricted to the chars that make up a
304 * valid C identifier ([a-zA-Z0-9_]).
305 *
306 * Declare in the module's debug-levels.h header file as:
307 *
308 * enum d_module {
309 * D_SUBMODULE_DECLARE(submodule_1),
310 * D_SUBMODULE_DECLARE(submodule_2),
311 * D_SUBMODULE_DECLARE(submodule_3),
312 * };
313 *
314 * Some corresponding .c file needs to have a matching
315 * D_SUBMODULE_DEFINE().
316 */
317#define D_SUBMODULE_DECLARE(_name) __D_SUBMODULE_##_name
318
319
320/**
321 * D_SUBMODULE_DEFINE - Define a submodule for runtime debug level control
322 *
323 * @_name: name of the submodule, restricted to the chars that make up a
324 * valid C identifier ([a-zA-Z0-9_]).
325 *
326 * Use once per module (in some .c file) as:
327 *
328 * static
329 * struct d_level d_level_SUBMODULENAME[] = {
330 * D_SUBMODULE_DEFINE(submodule_1),
331 * D_SUBMODULE_DEFINE(submodule_2),
332 * D_SUBMODULE_DEFINE(submodule_3),
333 * };
334 * size_t d_level_size_SUBDMODULENAME = ARRAY_SIZE(d_level_SUBDMODULENAME);
335 *
336 * Matching D_SUBMODULE_DECLARE()s have to be present in a
337 * debug-levels.h header file.
338 */
339#define D_SUBMODULE_DEFINE(_name) \
340[__D_SUBMODULE_##_name] = { \
341 .level = 0, \
342 .name = #_name \
343}
344
345
346
347/* The actual "debug" operations */
348
349
350/**
351 * d_test - Returns true if debugging should be enabled
352 *
353 * @l: intended debug level (unsigned)
354 *
355 * If the master debug switch is enabled and the current settings are
356 * higher or equal to the requested level, then debugging
357 * output/actions should be enabled.
358 *
359 * NOTE:
360 *
361 * This needs to be coded so that it can be evaluated in compile
362 * time; this is why the ugly BUG_ON() is placed in there, so the
363 * D_MASTER evaluation compiles all out if it is compile-time false.
364 */
365#define d_test(l) \
366({ \
367 unsigned __l = l; /* type enforcer */ \
368 (D_MASTER) >= __l \
369 && ({ \
370 BUG_ON(_D_SUBMODULE_INDEX(D_SUBMODULE) >= D_LEVEL_SIZE);\
371 D_LEVEL[_D_SUBMODULE_INDEX(D_SUBMODULE)].level >= __l; \
372 }); \
373})
374
375
376/**
377 * d_fnstart - log message at function start if debugging enabled
378 *
379 * @l: intended debug level
380 * @_dev: 'struct device' pointer, NULL if none (for context)
381 * @f: printf-like format and arguments
382 */
383#define d_fnstart(l, _dev, f, a...) _d_printf(l, " FNSTART", _dev, f, ## a)
384
385
386/**
387 * d_fnend - log message at function end if debugging enabled
388 *
389 * @l: intended debug level
390 * @_dev: 'struct device' pointer, NULL if none (for context)
391 * @f: printf-like format and arguments
392 */
393#define d_fnend(l, _dev, f, a...) _d_printf(l, " FNEND", _dev, f, ## a)
394
395
396/**
397 * d_printf - log message if debugging enabled
398 *
399 * @l: intended debug level
400 * @_dev: 'struct device' pointer, NULL if none (for context)
401 * @f: printf-like format and arguments
402 */
403#define d_printf(l, _dev, f, a...) _d_printf(l, "", _dev, f, ## a)
404
405
406/**
407 * d_dump - log buffer hex dump if debugging enabled
408 *
409 * @l: intended debug level
410 * @_dev: 'struct device' pointer, NULL if none (for context)
411 * @f: printf-like format and arguments
412 */
413#define d_dump(l, dev, ptr, size) \
414do { \
415 char head[64]; \
416 if (!d_test(l)) \
417 break; \
418 __d_head(head, sizeof(head), dev); \
419 print_hex_dump(KERN_ERR, head, 0, 16, 1, \
420 ((void *) ptr), (size), 0); \
421} while (0)
422
423
424/**
425 * Export a submodule's debug level over debugfs as PREFIXSUBMODULE
426 *
427 * @prefix: string to prefix the name with
428 * @submodule: name of submodule (not a string, just the name)
429 * @dentry: debugfs parent dentry
430 *
431 * Returns: 0 if ok, < 0 errno on error.
432 *
433 * For removing, just use debugfs_remove_recursive() on the parent.
434 */
435#define d_level_register_debugfs(prefix, name, parent) \
436({ \
437 int rc; \
438 struct dentry *fd; \
439 struct dentry *verify_parent_type = parent; \
440 fd = debugfs_create_u8( \
441 prefix #name, 0600, verify_parent_type, \
442 &(D_LEVEL[__D_SUBMODULE_ ## name].level)); \
443 rc = PTR_ERR(fd); \
444 if (IS_ERR(fd) && rc != -ENODEV) \
445 printk(KERN_ERR "%s: Can't create debugfs entry %s: " \
446 "%d\n", __func__, prefix #name, rc); \
447 else \
448 rc = 0; \
449 rc; \
450})
451
452
453#endif /* #ifndef __debug__h__ */
diff --git a/include/linux/wimax/i2400m.h b/include/linux/wimax/i2400m.h
new file mode 100644
index 000000000000..74198f5bb4dc
--- /dev/null
+++ b/include/linux/wimax/i2400m.h
@@ -0,0 +1,512 @@
1/*
2 * Intel Wireless WiMax Connection 2400m
3 * Host-Device protocol interface definitions
4 *
5 *
6 * Copyright (C) 2007-2008 Intel Corporation. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 *
35 * Intel Corporation <linux-wimax@intel.com>
36 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
37 * - Initial implementation
38 *
39 *
40 * This header defines the data structures and constants used to
41 * communicate with the device.
42 *
43 * BOOTMODE/BOOTROM/FIRMWARE UPLOAD PROTOCOL
44 *
45 * The firmware upload protocol is quite simple and only requires a
46 * handful of commands. See drivers/net/wimax/i2400m/fw.c for more
47 * details.
48 *
49 * The BCF data structure is for the firmware file header.
50 *
51 *
52 * THE DATA / CONTROL PROTOCOL
53 *
54 * This is the normal protocol spoken with the device once the
55 * firmware is uploaded. It transports data payloads and control
56 * messages back and forth.
57 *
58 * It consists 'messages' that pack one or more payloads each. The
59 * format is described in detail in drivers/net/wimax/i2400m/rx.c and
60 * tx.c.
61 *
62 *
63 * THE L3L4 PROTOCOL
64 *
65 * The term L3L4 refers to Layer 3 (the device), Layer 4 (the
66 * driver/host software).
67 *
68 * This is the control protocol used by the host to control the i2400m
69 * device (scan, connect, disconnect...). This is sent to / received
70 * as control frames. These frames consist of a header and zero or
71 * more TLVs with information. We call each control frame a "message".
72 *
73 * Each message is composed of:
74 *
75 * HEADER
76 * [TLV0 + PAYLOAD0]
77 * [TLV1 + PAYLOAD1]
78 * [...]
79 * [TLVN + PAYLOADN]
80 *
81 * The HEADER is defined by 'struct i2400m_l3l4_hdr'. The payloads are
82 * defined by a TLV structure (Type Length Value) which is a 'header'
83 * (struct i2400m_tlv_hdr) and then the payload.
84 *
85 * All integers are represented as Little Endian.
86 *
87 * - REQUESTS AND EVENTS
88 *
89 * The requests can be clasified as follows:
90 *
91 * COMMAND: implies a request from the host to the device requesting
92 * an action being performed. The device will reply with a
93 * message (with the same type as the command), status and
94 * no (TLV) payload. Execution of a command might cause
95 * events (of different type) to be sent later on as
96 * device's state changes.
97 *
98 * GET/SET: similar to COMMAND, but will not cause other
99 * EVENTs. The reply, in the case of GET, will contain
100 * TLVs with the requested information.
101 *
102 * EVENT: asynchronous messages sent from the device, maybe as a
103 * consequence of previous COMMANDs but disassociated from
104 * them.
105 *
106 * Only one request might be pending at the same time (ie: don't
107 * parallelize nor post another GET request before the previous
108 * COMMAND has been acknowledged with it's corresponding reply by the
109 * device).
110 *
111 * The different requests and their formats are described below:
112 *
113 * I2400M_MT_* Message types
114 * I2400M_MS_* Message status (for replies, events)
115 * i2400m_tlv_* TLVs
116 *
117 * data types are named 'struct i2400m_msg_OPNAME', OPNAME matching the
118 * operation.
119 */
120
121#ifndef __LINUX__WIMAX__I2400M_H__
122#define __LINUX__WIMAX__I2400M_H__
123
124#include <linux/types.h>
125
126
127/*
128 * Host Device Interface (HDI) common to all busses
129 */
130
131/* Boot-mode (firmware upload mode) commands */
132
133/* Header for the firmware file */
134struct i2400m_bcf_hdr {
135 __le32 module_type;
136 __le32 header_len;
137 __le32 header_version;
138 __le32 module_id;
139 __le32 module_vendor;
140 __le32 date; /* BCD YYYMMDD */
141 __le32 size;
142 __le32 key_size; /* in dwords */
143 __le32 modulus_size; /* in dwords */
144 __le32 exponent_size; /* in dwords */
145 __u8 reserved[88];
146} __attribute__ ((packed));
147
148/* Boot mode opcodes */
149enum i2400m_brh_opcode {
150 I2400M_BRH_READ = 1,
151 I2400M_BRH_WRITE = 2,
152 I2400M_BRH_JUMP = 3,
153 I2400M_BRH_SIGNED_JUMP = 8,
154 I2400M_BRH_HASH_PAYLOAD_ONLY = 9,
155};
156
157/* Boot mode command masks and stuff */
158enum i2400m_brh {
159 I2400M_BRH_SIGNATURE = 0xcbbc0000,
160 I2400M_BRH_SIGNATURE_MASK = 0xffff0000,
161 I2400M_BRH_SIGNATURE_SHIFT = 16,
162 I2400M_BRH_OPCODE_MASK = 0x0000000f,
163 I2400M_BRH_RESPONSE_MASK = 0x000000f0,
164 I2400M_BRH_RESPONSE_SHIFT = 4,
165 I2400M_BRH_DIRECT_ACCESS = 0x00000400,
166 I2400M_BRH_RESPONSE_REQUIRED = 0x00000200,
167 I2400M_BRH_USE_CHECKSUM = 0x00000100,
168};
169
170
171/* Constants for bcf->module_id */
172enum i2400m_bcf_mod_id {
173 /* Firmware file carries its own pokes -- pokes are a set of
174 * magical values that have to be written in certain memory
175 * addresses to get the device up and ready for firmware
176 * download when it is in non-signed boot mode. */
177 I2400M_BCF_MOD_ID_POKES = 0x000000001,
178};
179
180
181/**
182 * i2400m_bootrom_header - Header for a boot-mode command
183 *
184 * @cmd: the above command descriptor
185 * @target_addr: where on the device memory should the action be performed.
186 * @data_size: for read/write, amount of data to be read/written
187 * @block_checksum: checksum value (if applicable)
188 * @payload: the beginning of data attached to this header
189 */
190struct i2400m_bootrom_header {
191 __le32 command; /* Compose with enum i2400_brh */
192 __le32 target_addr;
193 __le32 data_size;
194 __le32 block_checksum;
195 char payload[0];
196} __attribute__ ((packed));
197
198
199/*
200 * Data / control protocol
201 */
202
203/* Packet types for the host-device interface */
204enum i2400m_pt {
205 I2400M_PT_DATA = 0,
206 I2400M_PT_CTRL,
207 I2400M_PT_TRACE, /* For device debug */
208 I2400M_PT_RESET_WARM, /* device reset */
209 I2400M_PT_RESET_COLD, /* USB[transport] reset, like reconnect */
210 I2400M_PT_ILLEGAL
211};
212
213
214/*
215 * Payload for a data packet
216 *
217 * This is prefixed to each and every outgoing DATA type.
218 */
219struct i2400m_pl_data_hdr {
220 __le32 reserved;
221} __attribute__((packed));
222
223
224/* Misc constants */
225enum {
226 I2400M_PL_PAD = 16, /* Payload data size alignment */
227 I2400M_PL_SIZE_MAX = 0x3EFF,
228 I2400M_MAX_PLS_IN_MSG = 60,
229 /* protocol barkers: sync sequences; for notifications they
230 * are sent in groups of four. */
231 I2400M_H2D_PREVIEW_BARKER = 0xcafe900d,
232 I2400M_COLD_RESET_BARKER = 0xc01dc01d,
233 I2400M_WARM_RESET_BARKER = 0x50f750f7,
234 I2400M_NBOOT_BARKER = 0xdeadbeef,
235 I2400M_SBOOT_BARKER = 0x0ff1c1a1,
236 I2400M_ACK_BARKER = 0xfeedbabe,
237 I2400M_D2H_MSG_BARKER = 0xbeefbabe,
238};
239
240
241/*
242 * Hardware payload descriptor
243 *
244 * Bitfields encoded in a struct to enforce typing semantics.
245 *
246 * Look in rx.c and tx.c for a full description of the format.
247 */
248struct i2400m_pld {
249 __le32 val;
250} __attribute__ ((packed));
251
252#define I2400M_PLD_SIZE_MASK 0x00003fff
253#define I2400M_PLD_TYPE_SHIFT 16
254#define I2400M_PLD_TYPE_MASK 0x000f0000
255
256/*
257 * Header for a TX message or RX message
258 *
259 * @barker: preamble
260 * @size: used for management of the FIFO queue buffer; before
261 * sending, this is converted to be a real preamble. This
262 * indicates the real size of the TX message that starts at this
263 * point. If the highest bit is set, then this message is to be
264 * skipped.
265 * @sequence: sequence number of this message
266 * @offset: offset where the message itself starts -- see the comments
267 * in the file header about message header and payload descriptor
268 * alignment.
269 * @num_pls: number of payloads in this message
270 * @padding: amount of padding bytes at the end of the message to make
271 * it be of block-size aligned
272 *
273 * Look in rx.c and tx.c for a full description of the format.
274 */
275struct i2400m_msg_hdr {
276 union {
277 __le32 barker;
278 __u32 size; /* same size type as barker!! */
279 };
280 union {
281 __le32 sequence;
282 __u32 offset; /* same size type as barker!! */
283 };
284 __le16 num_pls;
285 __le16 rsv1;
286 __le16 padding;
287 __le16 rsv2;
288 struct i2400m_pld pld[0];
289} __attribute__ ((packed));
290
291
292
293/*
294 * L3/L4 control protocol
295 */
296
297enum {
298 /* Interface version */
299 I2400M_L3L4_VERSION = 0x0100,
300};
301
302/* Message types */
303enum i2400m_mt {
304 I2400M_MT_RESERVED = 0x0000,
305 I2400M_MT_INVALID = 0xffff,
306 I2400M_MT_REPORT_MASK = 0x8000,
307
308 I2400M_MT_GET_SCAN_RESULT = 0x4202,
309 I2400M_MT_SET_SCAN_PARAM = 0x4402,
310 I2400M_MT_CMD_RF_CONTROL = 0x4602,
311 I2400M_MT_CMD_SCAN = 0x4603,
312 I2400M_MT_CMD_CONNECT = 0x4604,
313 I2400M_MT_CMD_DISCONNECT = 0x4605,
314 I2400M_MT_CMD_EXIT_IDLE = 0x4606,
315 I2400M_MT_GET_LM_VERSION = 0x5201,
316 I2400M_MT_GET_DEVICE_INFO = 0x5202,
317 I2400M_MT_GET_LINK_STATUS = 0x5203,
318 I2400M_MT_GET_STATISTICS = 0x5204,
319 I2400M_MT_GET_STATE = 0x5205,
320 I2400M_MT_GET_MEDIA_STATUS = 0x5206,
321 I2400M_MT_SET_INIT_CONFIG = 0x5404,
322 I2400M_MT_CMD_INIT = 0x5601,
323 I2400M_MT_CMD_TERMINATE = 0x5602,
324 I2400M_MT_CMD_MODE_OF_OP = 0x5603,
325 I2400M_MT_CMD_RESET_DEVICE = 0x5604,
326 I2400M_MT_CMD_MONITOR_CONTROL = 0x5605,
327 I2400M_MT_CMD_ENTER_POWERSAVE = 0x5606,
328 I2400M_MT_GET_TLS_OPERATION_RESULT = 0x6201,
329 I2400M_MT_SET_EAP_SUCCESS = 0x6402,
330 I2400M_MT_SET_EAP_FAIL = 0x6403,
331 I2400M_MT_SET_EAP_KEY = 0x6404,
332 I2400M_MT_CMD_SEND_EAP_RESPONSE = 0x6602,
333 I2400M_MT_REPORT_SCAN_RESULT = 0xc002,
334 I2400M_MT_REPORT_STATE = 0xd002,
335 I2400M_MT_REPORT_POWERSAVE_READY = 0xd005,
336 I2400M_MT_REPORT_EAP_REQUEST = 0xe002,
337 I2400M_MT_REPORT_EAP_RESTART = 0xe003,
338 I2400M_MT_REPORT_ALT_ACCEPT = 0xe004,
339 I2400M_MT_REPORT_KEY_REQUEST = 0xe005,
340};
341
342
343/*
344 * Message Ack Status codes
345 *
346 * When a message is replied-to, this status is reported.
347 */
348enum i2400m_ms {
349 I2400M_MS_DONE_OK = 0,
350 I2400M_MS_DONE_IN_PROGRESS = 1,
351 I2400M_MS_INVALID_OP = 2,
352 I2400M_MS_BAD_STATE = 3,
353 I2400M_MS_ILLEGAL_VALUE = 4,
354 I2400M_MS_MISSING_PARAMS = 5,
355 I2400M_MS_VERSION_ERROR = 6,
356 I2400M_MS_ACCESSIBILITY_ERROR = 7,
357 I2400M_MS_BUSY = 8,
358 I2400M_MS_CORRUPTED_TLV = 9,
359 I2400M_MS_UNINITIALIZED = 10,
360 I2400M_MS_UNKNOWN_ERROR = 11,
361 I2400M_MS_PRODUCTION_ERROR = 12,
362 I2400M_MS_NO_RF = 13,
363 I2400M_MS_NOT_READY_FOR_POWERSAVE = 14,
364 I2400M_MS_THERMAL_CRITICAL = 15,
365 I2400M_MS_MAX
366};
367
368
369/**
370 * i2400m_tlv - enumeration of the different types of TLVs
371 *
372 * TLVs stand for type-length-value and are the header for a payload
373 * composed of almost anything. Each payload has a type assigned
374 * and a length.
375 */
376enum i2400m_tlv {
377 I2400M_TLV_L4_MESSAGE_VERSIONS = 129,
378 I2400M_TLV_SYSTEM_STATE = 141,
379 I2400M_TLV_MEDIA_STATUS = 161,
380 I2400M_TLV_RF_OPERATION = 162,
381 I2400M_TLV_RF_STATUS = 163,
382 I2400M_TLV_DEVICE_RESET_TYPE = 132,
383 I2400M_TLV_CONFIG_IDLE_PARAMETERS = 601,
384};
385
386
387struct i2400m_tlv_hdr {
388 __le16 type;
389 __le16 length; /* payload's */
390 __u8 pl[0];
391} __attribute__((packed));
392
393
394struct i2400m_l3l4_hdr {
395 __le16 type;
396 __le16 length; /* payload's */
397 __le16 version;
398 __le16 resv1;
399 __le16 status;
400 __le16 resv2;
401 struct i2400m_tlv_hdr pl[0];
402} __attribute__((packed));
403
404
405/**
406 * i2400m_system_state - different states of the device
407 */
408enum i2400m_system_state {
409 I2400M_SS_UNINITIALIZED = 1,
410 I2400M_SS_INIT,
411 I2400M_SS_READY,
412 I2400M_SS_SCAN,
413 I2400M_SS_STANDBY,
414 I2400M_SS_CONNECTING,
415 I2400M_SS_WIMAX_CONNECTED,
416 I2400M_SS_DATA_PATH_CONNECTED,
417 I2400M_SS_IDLE,
418 I2400M_SS_DISCONNECTING,
419 I2400M_SS_OUT_OF_ZONE,
420 I2400M_SS_SLEEPACTIVE,
421 I2400M_SS_PRODUCTION,
422 I2400M_SS_CONFIG,
423 I2400M_SS_RF_OFF,
424 I2400M_SS_RF_SHUTDOWN,
425 I2400M_SS_DEVICE_DISCONNECT,
426 I2400M_SS_MAX,
427};
428
429
430/**
431 * i2400m_tlv_system_state - report on the state of the system
432 *
433 * @state: see enum i2400m_system_state
434 */
435struct i2400m_tlv_system_state {
436 struct i2400m_tlv_hdr hdr;
437 __le32 state;
438} __attribute__((packed));
439
440
441struct i2400m_tlv_l4_message_versions {
442 struct i2400m_tlv_hdr hdr;
443 __le16 major;
444 __le16 minor;
445 __le16 branch;
446 __le16 reserved;
447} __attribute__((packed));
448
449
450struct i2400m_tlv_detailed_device_info {
451 struct i2400m_tlv_hdr hdr;
452 __u8 reserved1[400];
453 __u8 mac_address[6];
454 __u8 reserved2[2];
455} __attribute__((packed));
456
457
458enum i2400m_rf_switch_status {
459 I2400M_RF_SWITCH_ON = 1,
460 I2400M_RF_SWITCH_OFF = 2,
461};
462
463struct i2400m_tlv_rf_switches_status {
464 struct i2400m_tlv_hdr hdr;
465 __u8 sw_rf_switch; /* 1 ON, 2 OFF */
466 __u8 hw_rf_switch; /* 1 ON, 2 OFF */
467 __u8 reserved[2];
468} __attribute__((packed));
469
470
471enum {
472 i2400m_rf_operation_on = 1,
473 i2400m_rf_operation_off = 2
474};
475
476struct i2400m_tlv_rf_operation {
477 struct i2400m_tlv_hdr hdr;
478 __le32 status; /* 1 ON, 2 OFF */
479} __attribute__((packed));
480
481
482enum i2400m_tlv_reset_type {
483 I2400M_RESET_TYPE_COLD = 1,
484 I2400M_RESET_TYPE_WARM
485};
486
487struct i2400m_tlv_device_reset_type {
488 struct i2400m_tlv_hdr hdr;
489 __le32 reset_type;
490} __attribute__((packed));
491
492
493struct i2400m_tlv_config_idle_parameters {
494 struct i2400m_tlv_hdr hdr;
495 __le32 idle_timeout; /* 100 to 300000 ms [5min], 100 increments
496 * 0 disabled */
497 __le32 idle_paging_interval; /* frames */
498} __attribute__((packed));
499
500
501enum i2400m_media_status {
502 I2400M_MEDIA_STATUS_LINK_UP = 1,
503 I2400M_MEDIA_STATUS_LINK_DOWN,
504 I2400M_MEDIA_STATUS_LINK_RENEW,
505};
506
507struct i2400m_tlv_media_status {
508 struct i2400m_tlv_hdr hdr;
509 __le32 media_status;
510} __attribute__((packed));
511
512#endif /* #ifndef __LINUX__WIMAX__I2400M_H__ */
diff --git a/include/linux/wlp.h b/include/linux/wlp.h
index 033545e145c7..ac95ce6606ac 100644
--- a/include/linux/wlp.h
+++ b/include/linux/wlp.h
@@ -646,6 +646,7 @@ struct wlp_wss {
646struct wlp { 646struct wlp {
647 struct mutex mutex; 647 struct mutex mutex;
648 struct uwb_rc *rc; /* UWB radio controller */ 648 struct uwb_rc *rc; /* UWB radio controller */
649 struct net_device *ndev;
649 struct uwb_pal pal; 650 struct uwb_pal pal;
650 struct wlp_eda eda; 651 struct wlp_eda eda;
651 struct wlp_uuid uuid; 652 struct wlp_uuid uuid;
@@ -675,7 +676,7 @@ struct wlp_wss_attribute {
675static struct wlp_wss_attribute wss_attr_##_name = __ATTR(_name, _mode, \ 676static struct wlp_wss_attribute wss_attr_##_name = __ATTR(_name, _mode, \
676 _show, _store) 677 _show, _store)
677 678
678extern int wlp_setup(struct wlp *, struct uwb_rc *); 679extern int wlp_setup(struct wlp *, struct uwb_rc *, struct net_device *ndev);
679extern void wlp_remove(struct wlp *); 680extern void wlp_remove(struct wlp *);
680extern ssize_t wlp_neighborhood_show(struct wlp *, char *); 681extern ssize_t wlp_neighborhood_show(struct wlp *, char *);
681extern int wlp_wss_setup(struct net_device *, struct wlp_wss *); 682extern int wlp_wss_setup(struct net_device *, struct wlp_wss *);
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index e585657e9831..7300ecdc480c 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -30,7 +30,6 @@ static inline int task_is_pdflush(struct task_struct *task)
30enum writeback_sync_modes { 30enum writeback_sync_modes {
31 WB_SYNC_NONE, /* Don't wait on anything */ 31 WB_SYNC_NONE, /* Don't wait on anything */
32 WB_SYNC_ALL, /* Wait on every mapping */ 32 WB_SYNC_ALL, /* Wait on every mapping */
33 WB_SYNC_HOLD, /* Hold the inode on sb_dirty for sys_sync() */
34}; 33};
35 34
36/* 35/*
@@ -107,7 +106,9 @@ void throttle_vm_writeout(gfp_t gfp_mask);
107 106
108/* These are exported to sysctl. */ 107/* These are exported to sysctl. */
109extern int dirty_background_ratio; 108extern int dirty_background_ratio;
109extern unsigned long dirty_background_bytes;
110extern int vm_dirty_ratio; 110extern int vm_dirty_ratio;
111extern unsigned long vm_dirty_bytes;
111extern int dirty_writeback_interval; 112extern int dirty_writeback_interval;
112extern int dirty_expire_interval; 113extern int dirty_expire_interval;
113extern int vm_highmem_is_dirtyable; 114extern int vm_highmem_is_dirtyable;
@@ -116,17 +117,26 @@ extern int laptop_mode;
116 117
117extern unsigned long determine_dirtyable_memory(void); 118extern unsigned long determine_dirtyable_memory(void);
118 119
120extern int dirty_background_ratio_handler(struct ctl_table *table, int write,
121 struct file *filp, void __user *buffer, size_t *lenp,
122 loff_t *ppos);
123extern int dirty_background_bytes_handler(struct ctl_table *table, int write,
124 struct file *filp, void __user *buffer, size_t *lenp,
125 loff_t *ppos);
119extern int dirty_ratio_handler(struct ctl_table *table, int write, 126extern int dirty_ratio_handler(struct ctl_table *table, int write,
120 struct file *filp, void __user *buffer, size_t *lenp, 127 struct file *filp, void __user *buffer, size_t *lenp,
121 loff_t *ppos); 128 loff_t *ppos);
129extern int dirty_bytes_handler(struct ctl_table *table, int write,
130 struct file *filp, void __user *buffer, size_t *lenp,
131 loff_t *ppos);
122 132
123struct ctl_table; 133struct ctl_table;
124struct file; 134struct file;
125int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *, 135int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *,
126 void __user *, size_t *, loff_t *); 136 void __user *, size_t *, loff_t *);
127 137
128void get_dirty_limits(long *pbackground, long *pdirty, long *pbdi_dirty, 138void get_dirty_limits(unsigned long *pbackground, unsigned long *pdirty,
129 struct backing_dev_info *bdi); 139 unsigned long *pbdi_dirty, struct backing_dev_info *bdi);
130 140
131void page_writeback_init(void); 141void page_writeback_init(void);
132void balance_dirty_pages_ratelimited_nr(struct address_space *mapping, 142void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 4bc1e6b86cb2..52f3abd453a1 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -199,6 +199,9 @@ enum {
199#define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO 199#define XFRM_MSG_NEWSPDINFO XFRM_MSG_NEWSPDINFO
200 XFRM_MSG_GETSPDINFO, 200 XFRM_MSG_GETSPDINFO,
201#define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO 201#define XFRM_MSG_GETSPDINFO XFRM_MSG_GETSPDINFO
202
203 XFRM_MSG_MAPPING,
204#define XFRM_MSG_MAPPING XFRM_MSG_MAPPING
202 __XFRM_MSG_MAX 205 __XFRM_MSG_MAX
203}; 206};
204#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1) 207#define XFRM_MSG_MAX (__XFRM_MSG_MAX - 1)
@@ -438,6 +441,15 @@ struct xfrm_user_migrate {
438 __u16 new_family; 441 __u16 new_family;
439}; 442};
440 443
444struct xfrm_user_mapping {
445 struct xfrm_usersa_id id;
446 __u32 reqid;
447 xfrm_address_t old_saddr;
448 xfrm_address_t new_saddr;
449 __be16 old_sport;
450 __be16 new_sport;
451};
452
441#ifndef __KERNEL__ 453#ifndef __KERNEL__
442/* backwards compatibility for userspace */ 454/* backwards compatibility for userspace */
443#define XFRMGRP_ACQUIRE 1 455#define XFRMGRP_ACQUIRE 1
@@ -464,6 +476,8 @@ enum xfrm_nlgroups {
464#define XFRMNLGRP_REPORT XFRMNLGRP_REPORT 476#define XFRMNLGRP_REPORT XFRMNLGRP_REPORT
465 XFRMNLGRP_MIGRATE, 477 XFRMNLGRP_MIGRATE,
466#define XFRMNLGRP_MIGRATE XFRMNLGRP_MIGRATE 478#define XFRMNLGRP_MIGRATE XFRMNLGRP_MIGRATE
479 XFRMNLGRP_MAPPING,
480#define XFRMNLGRP_MAPPING XFRMNLGRP_MAPPING
467 __XFRMNLGRP_MAX 481 __XFRMNLGRP_MAX
468}; 482};
469#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1) 483#define XFRMNLGRP_MAX (__XFRMNLGRP_MAX - 1)