aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-10-13 05:05:51 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-13 05:05:51 -0400
commitaccba5f3965d6a9d1bf7c1e1a7995d17e9d521b6 (patch)
tree8fb40782e79472ed882ff2098d4dd295557278ee /include/linux
parent6852fd9b86d05063c6ef49d2e12e061cc7f6a105 (diff)
parent4480f15b3306f43bbb0310d461142b4e897ca45b (diff)
Merge branch 'linus' into oprofile-v2
Conflicts: arch/x86/kernel/apic_32.c arch/x86/oprofile/nmi_int.c include/linux/pci_ids.h
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/Kbuild14
-rw-r--r--include/linux/agp_backend.h5
-rw-r--r--include/linux/aio.h1
-rw-r--r--include/linux/ata.h282
-rw-r--r--include/linux/bio.h108
-rw-r--r--include/linux/bitmap.h1
-rw-r--r--include/linux/blkdev.h172
-rw-r--r--include/linux/blktrace_api.h62
-rw-r--r--include/linux/bootmem.h4
-rw-r--r--include/linux/buffer_head.h10
-rw-r--r--include/linux/byteorder.h372
-rw-r--r--include/linux/capability.h15
-rw-r--r--include/linux/clockchips.h2
-rw-r--r--include/linux/cnt32_to_63.h80
-rw-r--r--include/linux/coda_linux.h2
-rw-r--r--include/linux/compiler.h4
-rw-r--r--include/linux/completion.h44
-rw-r--r--include/linux/configfs.h68
-rw-r--r--include/linux/connector.h3
-rw-r--r--include/linux/cpu.h1
-rw-r--r--include/linux/cpufreq.h8
-rw-r--r--include/linux/cpumask.h63
-rw-r--r--include/linux/cpuset.h2
-rw-r--r--include/linux/crash_dump.h6
-rw-r--r--include/linux/cred.h50
-rw-r--r--include/linux/crypto.h35
-rw-r--r--include/linux/dcache.h1
-rw-r--r--include/linux/device-mapper.h18
-rw-r--r--include/linux/device.h19
-rw-r--r--include/linux/dlm.h5
-rw-r--r--include/linux/dlm_device.h2
-rw-r--r--include/linux/dm9000.h1
-rw-r--r--include/linux/dma-mapping.h12
-rw-r--r--include/linux/dmar.h127
-rw-r--r--include/linux/elevator.h9
-rw-r--r--include/linux/elf.h1
-rw-r--r--include/linux/ethtool.h17
-rw-r--r--include/linux/exportfs.h21
-rw-r--r--include/linux/ext3_fs.h2
-rw-r--r--include/linux/fb.h3
-rw-r--r--include/linux/fd.h8
-rw-r--r--include/linux/fiemap.h64
-rw-r--r--include/linux/file.h3
-rw-r--r--include/linux/firmware-map.h26
-rw-r--r--include/linux/fs.h133
-rw-r--r--include/linux/fs_struct.h3
-rw-r--r--include/linux/fs_uart_pd.h1
-rw-r--r--include/linux/ftrace.h21
-rw-r--r--include/linux/genhd.h355
-rw-r--r--include/linux/gfs2_ondisk.h6
-rw-r--r--include/linux/harrier_defs.h212
-rw-r--r--include/linux/hrtimer.h18
-rw-r--r--include/linux/hugetlb.h5
-rw-r--r--include/linux/i2c-id.h2
-rw-r--r--include/linux/i2c-pnx.h4
-rw-r--r--include/linux/i2c.h12
-rw-r--r--include/linux/i2o.h2
-rw-r--r--include/linux/ide.h361
-rw-r--r--include/linux/ieee80211.h49
-rw-r--r--include/linux/if.h1
-rw-r--r--include/linux/if_ether.h6
-rw-r--r--include/linux/if_link.h1
-rw-r--r--include/linux/if_phonet.h19
-rw-r--r--include/linux/if_tun.h1
-rw-r--r--include/linux/if_tunnel.h19
-rw-r--r--include/linux/ihex.h2
-rw-r--r--include/linux/in.h1
-rw-r--r--include/linux/inetdevice.h1
-rw-r--r--include/linux/init.h8
-rw-r--r--include/linux/interrupt.h29
-rw-r--r--include/linux/iommu-helper.h16
-rw-r--r--include/linux/ioport.h12
-rw-r--r--include/linux/ip_vs.h405
-rw-r--r--include/linux/irq.h1
-rw-r--r--include/linux/isdn_ppp.h2
-rw-r--r--include/linux/ivtv.h6
-rw-r--r--include/linux/ivtvfb.h6
-rw-r--r--include/linux/jbd2.h8
-rw-r--r--include/linux/jffs2.h3
-rw-r--r--include/linux/kallsyms.h3
-rw-r--r--include/linux/kernel.h22
-rw-r--r--include/linux/kexec.h25
-rw-r--r--include/linux/key.h1
-rw-r--r--include/linux/klist.h3
-rw-r--r--include/linux/kvm.h5
-rw-r--r--include/linux/kvm_host.h24
-rw-r--r--include/linux/lcd.h3
-rw-r--r--include/linux/libata.h99
-rw-r--r--include/linux/list.h100
-rw-r--r--include/linux/lockdep.h70
-rw-r--r--include/linux/mISDNdsp.h37
-rw-r--r--include/linux/mISDNhw.h193
-rw-r--r--include/linux/mISDNif.h509
-rw-r--r--include/linux/major.h2
-rw-r--r--include/linux/maple.h16
-rw-r--r--include/linux/memstick.h103
-rw-r--r--include/linux/mfd/core.h30
-rw-r--r--include/linux/mfd/t7l66xb.h36
-rw-r--r--include/linux/mfd/tc6387xb.h23
-rw-r--r--include/linux/mfd/tc6393xb.h9
-rw-r--r--include/linux/mfd/tmio.h19
-rw-r--r--include/linux/mlx4/cq.h36
-rw-r--r--include/linux/mlx4/device.h4
-rw-r--r--include/linux/mlx4/qp.h4
-rw-r--r--include/linux/mm.h35
-rw-r--r--include/linux/mm_types.h16
-rw-r--r--include/linux/mmc/card.h2
-rw-r--r--include/linux/mmc/host.h4
-rw-r--r--include/linux/mmdebug.h18
-rw-r--r--include/linux/mmu_notifier.h279
-rw-r--r--include/linux/mmzone.h12
-rw-r--r--include/linux/mount.h5
-rw-r--r--include/linux/mroute.h2
-rw-r--r--include/linux/mroute6.h1
-rw-r--r--include/linux/mtd/blktrans.h4
-rw-r--r--include/linux/mtd/cfi.h1
-rw-r--r--include/linux/mtd/cfi_endian.h5
-rw-r--r--include/linux/mtd/concat.h2
-rw-r--r--include/linux/mtd/doc2000.h2
-rw-r--r--include/linux/mtd/flashchip.h3
-rw-r--r--include/linux/mtd/ftl.h2
-rw-r--r--include/linux/mtd/gen_probe.h1
-rw-r--r--include/linux/mtd/inftl.h4
-rw-r--r--include/linux/mtd/map.h1
-rw-r--r--include/linux/mtd/mtd.h8
-rw-r--r--include/linux/mtd/nand.h9
-rw-r--r--include/linux/mtd/nand_ecc.h2
-rw-r--r--include/linux/mtd/nftl.h2
-rw-r--r--include/linux/mtd/partitions.h2
-rw-r--r--include/linux/mtd/physmap.h2
-rw-r--r--include/linux/mtd/plat-ram.h2
-rw-r--r--include/linux/mtd/pmc551.h4
-rw-r--r--include/linux/mtd/xip.h2
-rw-r--r--include/linux/mv643xx_eth.h13
-rw-r--r--include/linux/namei.h19
-rw-r--r--include/linux/net.h14
-rw-r--r--include/linux/netdevice.h121
-rw-r--r--include/linux/netfilter.h97
-rw-r--r--include/linux/netfilter/Kbuild1
-rw-r--r--include/linux/netfilter/nf_conntrack_proto_gre.h2
-rw-r--r--include/linux/netfilter/nf_conntrack_tcp.h3
-rw-r--r--include/linux/netfilter/x_tables.h161
-rw-r--r--include/linux/netfilter/xt_TPROXY.h14
-rw-r--r--include/linux/netfilter/xt_recent.h26
-rw-r--r--include/linux/netfilter_bridge/ebtables.h76
-rw-r--r--include/linux/netfilter_ipv4/ipt_recent.h28
-rw-r--r--include/linux/nfs_fs.h3
-rw-r--r--include/linux/nl80211.h133
-rw-r--r--include/linux/notifier.h10
-rw-r--r--include/linux/of.h1
-rw-r--r--include/linux/of_spi.h18
-rw-r--r--include/linux/page-flags.h5
-rw-r--r--include/linux/pagemap.h168
-rw-r--r--include/linux/parport.h3
-rw-r--r--include/linux/parser.h2
-rw-r--r--include/linux/pci-acpi.h11
-rw-r--r--include/linux/pci-aspm.h5
-rw-r--r--include/linux/pci.h21
-rw-r--r--include/linux/pci_ids.h57
-rw-r--r--include/linux/pci_regs.h1
-rw-r--r--include/linux/percpu.h36
-rw-r--r--include/linux/percpu_counter.h12
-rw-r--r--include/linux/pfkeyv2.h13
-rw-r--r--include/linux/phonet.h170
-rw-r--r--include/linux/phy.h52
-rw-r--r--include/linux/pid.h9
-rw-r--r--include/linux/pim.h18
-rw-r--r--include/linux/pkt_sched.h7
-rw-r--r--include/linux/pm_qos_params.h2
-rw-r--r--include/linux/pnp.h7
-rw-r--r--include/linux/power_supply.h1
-rw-r--r--include/linux/proc_fs.h5
-rw-r--r--include/linux/proportions.h2
-rw-r--r--include/linux/ptrace.h72
-rw-r--r--include/linux/quicklist.h7
-rw-r--r--include/linux/quotaops.h2
-rw-r--r--include/linux/radix-tree.h12
-rw-r--r--include/linux/raid/md_k.h1
-rw-r--r--include/linux/ramfs.h1
-rw-r--r--include/linux/rcuclassic.h39
-rw-r--r--include/linux/rculist.h42
-rw-r--r--include/linux/rcupdate.h20
-rw-r--r--include/linux/rcupreempt.h11
-rw-r--r--include/linux/reboot.h1
-rw-r--r--include/linux/regulator/bq24022.h21
-rw-r--r--include/linux/regulator/consumer.h284
-rw-r--r--include/linux/regulator/driver.h99
-rw-r--r--include/linux/regulator/fixed.h22
-rw-r--r--include/linux/regulator/machine.h104
-rw-r--r--include/linux/reiserfs_xattr.h2
-rw-r--r--include/linux/relay.h5
-rw-r--r--include/linux/res_counter.h2
-rw-r--r--include/linux/rfkill.h15
-rw-r--r--include/linux/rmap.h10
-rw-r--r--include/linux/rtc.h2
-rw-r--r--include/linux/rtc/m48t59.h47
-rw-r--r--include/linux/rtnetlink.h11
-rw-r--r--include/linux/sched.h94
-rw-r--r--include/linux/security.h100
-rw-r--r--include/linux/seq_file.h12
-rw-r--r--include/linux/serio.h3
-rw-r--r--include/linux/shmem_fs.h2
-rw-r--r--include/linux/skbuff.h191
-rw-r--r--include/linux/slab.h3
-rw-r--r--include/linux/slub_def.h3
-rw-r--r--include/linux/smb.h2
-rw-r--r--include/linux/smc91x.h11
-rw-r--r--include/linux/smp.h5
-rw-r--r--include/linux/snmp.h2
-rw-r--r--include/linux/socket.h7
-rw-r--r--include/linux/spi/ads7846.h3
-rw-r--r--include/linux/spi/corgi_lcd.h20
-rw-r--r--include/linux/spi/orion_spi.h17
-rw-r--r--include/linux/spi/spi.h12
-rw-r--r--include/linux/spinlock.h6
-rw-r--r--include/linux/spinlock_api_smp.h2
-rw-r--r--include/linux/ssb/ssb.h4
-rw-r--r--include/linux/ssb/ssb_regs.h19
-rw-r--r--include/linux/stacktrace.h2
-rw-r--r--include/linux/stop_machine.h35
-rw-r--r--include/linux/string_helpers.h16
-rw-r--r--include/linux/sunrpc/svc_rdma.h1
-rw-r--r--include/linux/suspend.h6
-rw-r--r--include/linux/swab.h309
-rw-r--r--include/linux/swap.h3
-rw-r--r--include/linux/sysctl.h25
-rw-r--r--include/linux/task_io_accounting.h18
-rw-r--r--include/linux/task_io_accounting_ops.h46
-rw-r--r--include/linux/tc_act/Kbuild1
-rw-r--r--include/linux/tc_act/tc_skbedit.h44
-rw-r--r--include/linux/tcp.h12
-rw-r--r--include/linux/tick.h7
-rw-r--r--include/linux/tracehook.h582
-rw-r--r--include/linux/tty.h2
-rw-r--r--include/linux/tty_driver.h14
-rw-r--r--include/linux/ucb1400.h161
-rw-r--r--include/linux/usb.h5
-rw-r--r--include/linux/usb/ehci_def.h160
-rw-r--r--include/linux/usb/musb.h98
-rw-r--r--include/linux/usb/serial.h3
-rw-r--r--include/linux/videodev.h15
-rw-r--r--include/linux/videodev2.h392
-rw-r--r--include/linux/videotext.h16
-rw-r--r--include/linux/vmalloc.h4
-rw-r--r--include/linux/vt_kern.h4
-rw-r--r--include/linux/wm97xx_batt.h26
-rw-r--r--include/linux/xfrm.h10
247 files changed, 8009 insertions, 1997 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 4c4142c5aa6e..282a504bd1db 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -97,6 +97,7 @@ header-y += ioctl.h
97header-y += ip6_tunnel.h 97header-y += ip6_tunnel.h
98header-y += ipmi_msgdefs.h 98header-y += ipmi_msgdefs.h
99header-y += ipsec.h 99header-y += ipsec.h
100header-y += ip_vs.h
100header-y += ipx.h 101header-y += ipx.h
101header-y += irda.h 102header-y += irda.h
102header-y += iso_fs.h 103header-y += iso_fs.h
@@ -125,6 +126,7 @@ header-y += pci_regs.h
125header-y += pfkeyv2.h 126header-y += pfkeyv2.h
126header-y += pg.h 127header-y += pg.h
127header-y += phantom.h 128header-y += phantom.h
129header-y += phonet.h
128header-y += pkt_cls.h 130header-y += pkt_cls.h
129header-y += pkt_sched.h 131header-y += pkt_sched.h
130header-y += posix_types.h 132header-y += posix_types.h
@@ -166,7 +168,8 @@ unifdef-y += acct.h
166unifdef-y += adb.h 168unifdef-y += adb.h
167unifdef-y += adfs_fs.h 169unifdef-y += adfs_fs.h
168unifdef-y += agpgart.h 170unifdef-y += agpgart.h
169ifneq ($(wildcard $(srctree)/include/asm-$(SRCARCH)/a.out.h),) 171ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/a.out.h \
172 $(srctree)/include/asm-$(SRCARCH)/a.out.h),)
170unifdef-y += a.out.h 173unifdef-y += a.out.h
171endif 174endif
172unifdef-y += apm_bios.h 175unifdef-y += apm_bios.h
@@ -178,6 +181,7 @@ unifdef-y += audit.h
178unifdef-y += auto_fs.h 181unifdef-y += auto_fs.h
179unifdef-y += auxvec.h 182unifdef-y += auxvec.h
180unifdef-y += binfmts.h 183unifdef-y += binfmts.h
184unifdef-y += blktrace_api.h
181unifdef-y += capability.h 185unifdef-y += capability.h
182unifdef-y += capi.h 186unifdef-y += capi.h
183unifdef-y += cciss_ioctl.h 187unifdef-y += cciss_ioctl.h
@@ -230,6 +234,7 @@ unifdef-y += if_fddi.h
230unifdef-y += if_frad.h 234unifdef-y += if_frad.h
231unifdef-y += if_ltalk.h 235unifdef-y += if_ltalk.h
232unifdef-y += if_link.h 236unifdef-y += if_link.h
237unifdef-y += if_phonet.h
233unifdef-y += if_pppol2tp.h 238unifdef-y += if_pppol2tp.h
234unifdef-y += if_pppox.h 239unifdef-y += if_pppox.h
235unifdef-y += if_tr.h 240unifdef-y += if_tr.h
@@ -249,13 +254,16 @@ unifdef-y += isdn.h
249unifdef-y += isdnif.h 254unifdef-y += isdnif.h
250unifdef-y += isdn_divertif.h 255unifdef-y += isdn_divertif.h
251unifdef-y += isdn_ppp.h 256unifdef-y += isdn_ppp.h
257unifdef-y += ivtv.h
258unifdef-y += ivtvfb.h
252unifdef-y += joystick.h 259unifdef-y += joystick.h
253unifdef-y += kdev_t.h 260unifdef-y += kdev_t.h
254unifdef-y += kd.h 261unifdef-y += kd.h
255unifdef-y += kernelcapi.h 262unifdef-y += kernelcapi.h
256unifdef-y += kernel.h 263unifdef-y += kernel.h
257unifdef-y += keyboard.h 264unifdef-y += keyboard.h
258ifneq ($(wildcard $(srctree)/include/asm-$(SRCARCH)/kvm.h),) 265ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm.h \
266 $(srctree)/include/asm-$(SRCARCH)/kvm.h),)
259unifdef-y += kvm.h 267unifdef-y += kvm.h
260endif 268endif
261unifdef-y += llc.h 269unifdef-y += llc.h
@@ -294,7 +302,6 @@ unifdef-y += parport.h
294unifdef-y += patchkey.h 302unifdef-y += patchkey.h
295unifdef-y += pci.h 303unifdef-y += pci.h
296unifdef-y += personality.h 304unifdef-y += personality.h
297unifdef-y += pim.h
298unifdef-y += pktcdvd.h 305unifdef-y += pktcdvd.h
299unifdef-y += pmu.h 306unifdef-y += pmu.h
300unifdef-y += poll.h 307unifdef-y += poll.h
@@ -355,6 +362,7 @@ unifdef-y += virtio_balloon.h
355unifdef-y += virtio_console.h 362unifdef-y += virtio_console.h
356unifdef-y += virtio_pci.h 363unifdef-y += virtio_pci.h
357unifdef-y += virtio_ring.h 364unifdef-y += virtio_ring.h
365unifdef-y += virtio_rng.h
358unifdef-y += vt.h 366unifdef-y += vt.h
359unifdef-y += wait.h 367unifdef-y += wait.h
360unifdef-y += wanrouter.h 368unifdef-y += wanrouter.h
diff --git a/include/linux/agp_backend.h b/include/linux/agp_backend.h
index 972b12bcfb36..2b8df8b420fd 100644
--- a/include/linux/agp_backend.h
+++ b/include/linux/agp_backend.h
@@ -30,6 +30,8 @@
30#ifndef _AGP_BACKEND_H 30#ifndef _AGP_BACKEND_H
31#define _AGP_BACKEND_H 1 31#define _AGP_BACKEND_H 1
32 32
33#include <linux/list.h>
34
33enum chipset_type { 35enum chipset_type {
34 NOT_SUPPORTED, 36 NOT_SUPPORTED,
35 SUPPORTED, 37 SUPPORTED,
@@ -78,6 +80,8 @@ struct agp_memory {
78 bool is_bound; 80 bool is_bound;
79 bool is_flushed; 81 bool is_flushed;
80 bool vmalloc_flag; 82 bool vmalloc_flag;
83 /* list of agp_memory mapped to the aperture */
84 struct list_head mapped_list;
81}; 85};
82 86
83#define AGP_NORMAL_MEMORY 0 87#define AGP_NORMAL_MEMORY 0
@@ -96,6 +100,7 @@ extern struct agp_memory *agp_allocate_memory(struct agp_bridge_data *, size_t,
96extern int agp_copy_info(struct agp_bridge_data *, struct agp_kern_info *); 100extern int agp_copy_info(struct agp_bridge_data *, struct agp_kern_info *);
97extern int agp_bind_memory(struct agp_memory *, off_t); 101extern int agp_bind_memory(struct agp_memory *, off_t);
98extern int agp_unbind_memory(struct agp_memory *); 102extern int agp_unbind_memory(struct agp_memory *);
103extern int agp_rebind_memory(void);
99extern void agp_enable(struct agp_bridge_data *, u32); 104extern void agp_enable(struct agp_bridge_data *, u32);
100extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *); 105extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *);
101extern void agp_backend_release(struct agp_bridge_data *); 106extern void agp_backend_release(struct agp_bridge_data *);
diff --git a/include/linux/aio.h b/include/linux/aio.h
index b51ddd28444e..09b276c35227 100644
--- a/include/linux/aio.h
+++ b/include/linux/aio.h
@@ -7,7 +7,6 @@
7#include <linux/uio.h> 7#include <linux/uio.h>
8 8
9#include <asm/atomic.h> 9#include <asm/atomic.h>
10#include <linux/uio.h>
11 10
12#define AIO_MAXSEGS 4 11#define AIO_MAXSEGS 4
13#define AIO_KIOGRP_NR_ATOMIC 8 12#define AIO_KIOGRP_NR_ATOMIC 8
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 1c622e2b0504..a53318b8cbd0 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -30,6 +30,7 @@
30#define __LINUX_ATA_H__ 30#define __LINUX_ATA_H__
31 31
32#include <linux/types.h> 32#include <linux/types.h>
33#include <asm/byteorder.h>
33 34
34/* defines only for the constants which don't work well as enums */ 35/* defines only for the constants which don't work well as enums */
35#define ATA_DMA_BOUNDARY 0xffffUL 36#define ATA_DMA_BOUNDARY 0xffffUL
@@ -46,18 +47,49 @@ enum {
46 ATA_MAX_SECTORS_TAPE = 65535, 47 ATA_MAX_SECTORS_TAPE = 65535,
47 48
48 ATA_ID_WORDS = 256, 49 ATA_ID_WORDS = 256,
50 ATA_ID_CONFIG = 0,
51 ATA_ID_CYLS = 1,
52 ATA_ID_HEADS = 3,
53 ATA_ID_SECTORS = 6,
49 ATA_ID_SERNO = 10, 54 ATA_ID_SERNO = 10,
55 ATA_ID_BUF_SIZE = 21,
50 ATA_ID_FW_REV = 23, 56 ATA_ID_FW_REV = 23,
51 ATA_ID_PROD = 27, 57 ATA_ID_PROD = 27,
58 ATA_ID_MAX_MULTSECT = 47,
59 ATA_ID_DWORD_IO = 48,
60 ATA_ID_CAPABILITY = 49,
52 ATA_ID_OLD_PIO_MODES = 51, 61 ATA_ID_OLD_PIO_MODES = 51,
62 ATA_ID_OLD_DMA_MODES = 52,
53 ATA_ID_FIELD_VALID = 53, 63 ATA_ID_FIELD_VALID = 53,
64 ATA_ID_CUR_CYLS = 54,
65 ATA_ID_CUR_HEADS = 55,
66 ATA_ID_CUR_SECTORS = 56,
67 ATA_ID_MULTSECT = 59,
68 ATA_ID_LBA_CAPACITY = 60,
69 ATA_ID_SWDMA_MODES = 62,
54 ATA_ID_MWDMA_MODES = 63, 70 ATA_ID_MWDMA_MODES = 63,
55 ATA_ID_PIO_MODES = 64, 71 ATA_ID_PIO_MODES = 64,
56 ATA_ID_EIDE_DMA_MIN = 65, 72 ATA_ID_EIDE_DMA_MIN = 65,
73 ATA_ID_EIDE_DMA_TIME = 66,
57 ATA_ID_EIDE_PIO = 67, 74 ATA_ID_EIDE_PIO = 67,
58 ATA_ID_EIDE_PIO_IORDY = 68, 75 ATA_ID_EIDE_PIO_IORDY = 68,
59 ATA_ID_UDMA_MODES = 88, 76 ATA_ID_QUEUE_DEPTH = 75,
60 ATA_ID_MAJOR_VER = 80, 77 ATA_ID_MAJOR_VER = 80,
78 ATA_ID_COMMAND_SET_1 = 82,
79 ATA_ID_COMMAND_SET_2 = 83,
80 ATA_ID_CFSSE = 84,
81 ATA_ID_CFS_ENABLE_1 = 85,
82 ATA_ID_CFS_ENABLE_2 = 86,
83 ATA_ID_CSF_DEFAULT = 87,
84 ATA_ID_UDMA_MODES = 88,
85 ATA_ID_HW_CONFIG = 93,
86 ATA_ID_SPG = 98,
87 ATA_ID_LBA_CAPACITY_2 = 100,
88 ATA_ID_LAST_LUN = 126,
89 ATA_ID_DLF = 128,
90 ATA_ID_CSFO = 129,
91 ATA_ID_CFA_POWER = 160,
92 ATA_ID_ROT_SPEED = 217,
61 ATA_ID_PIO4 = (1 << 1), 93 ATA_ID_PIO4 = (1 << 1),
62 94
63 ATA_ID_SERNO_LEN = 20, 95 ATA_ID_SERNO_LEN = 20,
@@ -123,13 +155,26 @@ enum {
123 ATA_BUSY = (1 << 7), /* BSY status bit */ 155 ATA_BUSY = (1 << 7), /* BSY status bit */
124 ATA_DRDY = (1 << 6), /* device ready */ 156 ATA_DRDY = (1 << 6), /* device ready */
125 ATA_DF = (1 << 5), /* device fault */ 157 ATA_DF = (1 << 5), /* device fault */
158 ATA_DSC = (1 << 4), /* drive seek complete */
126 ATA_DRQ = (1 << 3), /* data request i/o */ 159 ATA_DRQ = (1 << 3), /* data request i/o */
160 ATA_CORR = (1 << 2), /* corrected data error */
161 ATA_IDX = (1 << 1), /* index */
127 ATA_ERR = (1 << 0), /* have an error */ 162 ATA_ERR = (1 << 0), /* have an error */
128 ATA_SRST = (1 << 2), /* software reset */ 163 ATA_SRST = (1 << 2), /* software reset */
129 ATA_ICRC = (1 << 7), /* interface CRC error */ 164 ATA_ICRC = (1 << 7), /* interface CRC error */
165 ATA_BBK = ATA_ICRC, /* pre-EIDE: block marked bad */
130 ATA_UNC = (1 << 6), /* uncorrectable media error */ 166 ATA_UNC = (1 << 6), /* uncorrectable media error */
167 ATA_MC = (1 << 5), /* media changed */
131 ATA_IDNF = (1 << 4), /* ID not found */ 168 ATA_IDNF = (1 << 4), /* ID not found */
169 ATA_MCR = (1 << 3), /* media change requested */
132 ATA_ABORTED = (1 << 2), /* command aborted */ 170 ATA_ABORTED = (1 << 2), /* command aborted */
171 ATA_TRK0NF = (1 << 1), /* track 0 not found */
172 ATA_AMNF = (1 << 0), /* address mark not found */
173 ATAPI_LFS = 0xF0, /* last failed sense */
174 ATAPI_EOM = ATA_TRK0NF, /* end of media */
175 ATAPI_ILI = ATA_AMNF, /* illegal length indication */
176 ATAPI_IO = (1 << 1),
177 ATAPI_COD = (1 << 0),
133 178
134 /* ATA command block registers */ 179 /* ATA command block registers */
135 ATA_REG_DATA = 0x00, 180 ATA_REG_DATA = 0x00,
@@ -192,6 +237,13 @@ enum {
192 ATA_CMD_PMP_WRITE = 0xE8, 237 ATA_CMD_PMP_WRITE = 0xE8,
193 ATA_CMD_CONF_OVERLAY = 0xB1, 238 ATA_CMD_CONF_OVERLAY = 0xB1,
194 ATA_CMD_SEC_FREEZE_LOCK = 0xF5, 239 ATA_CMD_SEC_FREEZE_LOCK = 0xF5,
240 ATA_CMD_SMART = 0xB0,
241 ATA_CMD_MEDIA_LOCK = 0xDE,
242 ATA_CMD_MEDIA_UNLOCK = 0xDF,
243 /* marked obsolete in the ATA/ATAPI-7 spec */
244 ATA_CMD_RESTORE = 0x10,
245 /* EXABYTE specific */
246 ATA_EXABYTE_ENABLE_NEST = 0xF0,
195 247
196 /* READ_LOG_EXT pages */ 248 /* READ_LOG_EXT pages */
197 ATA_LOG_SATA_NCQ = 0x10, 249 ATA_LOG_SATA_NCQ = 0x10,
@@ -232,6 +284,10 @@ enum {
232 SETFEATURES_WC_ON = 0x02, /* Enable write cache */ 284 SETFEATURES_WC_ON = 0x02, /* Enable write cache */
233 SETFEATURES_WC_OFF = 0x82, /* Disable write cache */ 285 SETFEATURES_WC_OFF = 0x82, /* Disable write cache */
234 286
287 /* Enable/Disable Automatic Acoustic Management */
288 SETFEATURES_AAM_ON = 0x42,
289 SETFEATURES_AAM_OFF = 0xC2,
290
235 SETFEATURES_SPINUP = 0x07, /* Spin-up drive */ 291 SETFEATURES_SPINUP = 0x07, /* Spin-up drive */
236 292
237 SETFEATURES_SATA_ENABLE = 0x10, /* Enable use of SATA feature */ 293 SETFEATURES_SATA_ENABLE = 0x10, /* Enable use of SATA feature */
@@ -254,6 +310,15 @@ enum {
254 ATA_DCO_IDENTIFY = 0xC2, 310 ATA_DCO_IDENTIFY = 0xC2,
255 ATA_DCO_SET = 0xC3, 311 ATA_DCO_SET = 0xC3,
256 312
313 /* feature values for SMART */
314 ATA_SMART_ENABLE = 0xD8,
315 ATA_SMART_READ_VALUES = 0xD0,
316 ATA_SMART_READ_THRESHOLDS = 0xD1,
317
318 /* password used in LBA Mid / LBA High for executing SMART commands */
319 ATA_SMART_LBAM_PASS = 0x4F,
320 ATA_SMART_LBAH_PASS = 0xC2,
321
257 /* ATAPI stuff */ 322 /* ATAPI stuff */
258 ATAPI_PKT_DMA = (1 << 0), 323 ATAPI_PKT_DMA = (1 << 0),
259 ATAPI_DMADIR = (1 << 2), /* ATAPI data dir: 324 ATAPI_DMADIR = (1 << 2), /* ATAPI data dir:
@@ -438,17 +503,17 @@ static inline int ata_is_data(u8 prot)
438/* 503/*
439 * id tests 504 * id tests
440 */ 505 */
441#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) 506#define ata_id_is_ata(id) (((id)[ATA_ID_CONFIG] & (1 << 15)) == 0)
442#define ata_id_has_lba(id) ((id)[49] & (1 << 9)) 507#define ata_id_has_lba(id) ((id)[ATA_ID_CAPABILITY] & (1 << 9))
443#define ata_id_has_dma(id) ((id)[49] & (1 << 8)) 508#define ata_id_has_dma(id) ((id)[ATA_ID_CAPABILITY] & (1 << 8))
444#define ata_id_has_ncq(id) ((id)[76] & (1 << 8)) 509#define ata_id_has_ncq(id) ((id)[76] & (1 << 8))
445#define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1) 510#define ata_id_queue_depth(id) (((id)[ATA_ID_QUEUE_DEPTH] & 0x1f) + 1)
446#define ata_id_removeable(id) ((id)[0] & (1 << 7)) 511#define ata_id_removeable(id) ((id)[ATA_ID_CONFIG] & (1 << 7))
447#define ata_id_has_atapi_AN(id) \ 512#define ata_id_has_atapi_AN(id) \
448 ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \ 513 ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \
449 ((id)[78] & (1 << 5)) ) 514 ((id)[78] & (1 << 5)) )
450#define ata_id_iordy_disable(id) ((id)[49] & (1 << 10)) 515#define ata_id_iordy_disable(id) ((id)[ATA_ID_CAPABILITY] & (1 << 10))
451#define ata_id_has_iordy(id) ((id)[49] & (1 << 11)) 516#define ata_id_has_iordy(id) ((id)[ATA_ID_CAPABILITY] & (1 << 11))
452#define ata_id_u32(id,n) \ 517#define ata_id_u32(id,n) \
453 (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)])) 518 (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)]))
454#define ata_id_u64(id,n) \ 519#define ata_id_u64(id,n) \
@@ -457,7 +522,7 @@ static inline int ata_is_data(u8 prot)
457 ((u64) (id)[(n) + 1] << 16) | \ 522 ((u64) (id)[(n) + 1] << 16) | \
458 ((u64) (id)[(n) + 0]) ) 523 ((u64) (id)[(n) + 0]) )
459 524
460#define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20) 525#define ata_id_cdb_intr(id) (((id)[ATA_ID_CONFIG] & 0x60) == 0x20)
461 526
462static inline bool ata_id_has_hipm(const u16 *id) 527static inline bool ata_id_has_hipm(const u16 *id)
463{ 528{
@@ -482,75 +547,106 @@ static inline bool ata_id_has_dipm(const u16 *id)
482 547
483static inline int ata_id_has_fua(const u16 *id) 548static inline int ata_id_has_fua(const u16 *id)
484{ 549{
485 if ((id[84] & 0xC000) != 0x4000) 550 if ((id[ATA_ID_CFSSE] & 0xC000) != 0x4000)
486 return 0; 551 return 0;
487 return id[84] & (1 << 6); 552 return id[ATA_ID_CFSSE] & (1 << 6);
488} 553}
489 554
490static inline int ata_id_has_flush(const u16 *id) 555static inline int ata_id_has_flush(const u16 *id)
491{ 556{
492 if ((id[83] & 0xC000) != 0x4000) 557 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
558 return 0;
559 return id[ATA_ID_COMMAND_SET_2] & (1 << 12);
560}
561
562static inline int ata_id_flush_enabled(const u16 *id)
563{
564 if (ata_id_has_flush(id) == 0)
493 return 0; 565 return 0;
494 return id[83] & (1 << 12); 566 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
567 return 0;
568 return id[ATA_ID_CFS_ENABLE_2] & (1 << 12);
495} 569}
496 570
497static inline int ata_id_has_flush_ext(const u16 *id) 571static inline int ata_id_has_flush_ext(const u16 *id)
498{ 572{
499 if ((id[83] & 0xC000) != 0x4000) 573 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
500 return 0; 574 return 0;
501 return id[83] & (1 << 13); 575 return id[ATA_ID_COMMAND_SET_2] & (1 << 13);
576}
577
578static inline int ata_id_flush_ext_enabled(const u16 *id)
579{
580 if (ata_id_has_flush_ext(id) == 0)
581 return 0;
582 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
583 return 0;
584 /*
585 * some Maxtor disks have bit 13 defined incorrectly
586 * so check bit 10 too
587 */
588 return (id[ATA_ID_CFS_ENABLE_2] & 0x2400) == 0x2400;
502} 589}
503 590
504static inline int ata_id_has_lba48(const u16 *id) 591static inline int ata_id_has_lba48(const u16 *id)
505{ 592{
506 if ((id[83] & 0xC000) != 0x4000) 593 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
507 return 0; 594 return 0;
508 if (!ata_id_u64(id, 100)) 595 if (!ata_id_u64(id, ATA_ID_LBA_CAPACITY_2))
509 return 0; 596 return 0;
510 return id[83] & (1 << 10); 597 return id[ATA_ID_COMMAND_SET_2] & (1 << 10);
598}
599
600static inline int ata_id_lba48_enabled(const u16 *id)
601{
602 if (ata_id_has_lba48(id) == 0)
603 return 0;
604 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
605 return 0;
606 return id[ATA_ID_CFS_ENABLE_2] & (1 << 10);
511} 607}
512 608
513static inline int ata_id_hpa_enabled(const u16 *id) 609static inline int ata_id_hpa_enabled(const u16 *id)
514{ 610{
515 /* Yes children, word 83 valid bits cover word 82 data */ 611 /* Yes children, word 83 valid bits cover word 82 data */
516 if ((id[83] & 0xC000) != 0x4000) 612 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
517 return 0; 613 return 0;
518 /* And 87 covers 85-87 */ 614 /* And 87 covers 85-87 */
519 if ((id[87] & 0xC000) != 0x4000) 615 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
520 return 0; 616 return 0;
521 /* Check command sets enabled as well as supported */ 617 /* Check command sets enabled as well as supported */
522 if ((id[85] & ( 1 << 10)) == 0) 618 if ((id[ATA_ID_CFS_ENABLE_1] & (1 << 10)) == 0)
523 return 0; 619 return 0;
524 return id[82] & (1 << 10); 620 return id[ATA_ID_COMMAND_SET_1] & (1 << 10);
525} 621}
526 622
527static inline int ata_id_has_wcache(const u16 *id) 623static inline int ata_id_has_wcache(const u16 *id)
528{ 624{
529 /* Yes children, word 83 valid bits cover word 82 data */ 625 /* Yes children, word 83 valid bits cover word 82 data */
530 if ((id[83] & 0xC000) != 0x4000) 626 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
531 return 0; 627 return 0;
532 return id[82] & (1 << 5); 628 return id[ATA_ID_COMMAND_SET_1] & (1 << 5);
533} 629}
534 630
535static inline int ata_id_has_pm(const u16 *id) 631static inline int ata_id_has_pm(const u16 *id)
536{ 632{
537 if ((id[83] & 0xC000) != 0x4000) 633 if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
538 return 0; 634 return 0;
539 return id[82] & (1 << 3); 635 return id[ATA_ID_COMMAND_SET_1] & (1 << 3);
540} 636}
541 637
542static inline int ata_id_rahead_enabled(const u16 *id) 638static inline int ata_id_rahead_enabled(const u16 *id)
543{ 639{
544 if ((id[87] & 0xC000) != 0x4000) 640 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
545 return 0; 641 return 0;
546 return id[85] & (1 << 6); 642 return id[ATA_ID_CFS_ENABLE_1] & (1 << 6);
547} 643}
548 644
549static inline int ata_id_wcache_enabled(const u16 *id) 645static inline int ata_id_wcache_enabled(const u16 *id)
550{ 646{
551 if ((id[87] & 0xC000) != 0x4000) 647 if ((id[ATA_ID_CSF_DEFAULT] & 0xC000) != 0x4000)
552 return 0; 648 return 0;
553 return id[85] & (1 << 5); 649 return id[ATA_ID_CFS_ENABLE_1] & (1 << 5);
554} 650}
555 651
556/** 652/**
@@ -581,7 +677,15 @@ static inline unsigned int ata_id_major_version(const u16 *id)
581 677
582static inline int ata_id_is_sata(const u16 *id) 678static inline int ata_id_is_sata(const u16 *id)
583{ 679{
584 return ata_id_major_version(id) >= 5 && id[93] == 0; 680 /*
681 * See if word 93 is 0 AND drive is at least ATA-5 compatible
682 * verifying that word 80 by casting it to a signed type --
683 * this trick allows us to filter out the reserved values of
684 * 0x0000 and 0xffff along with the earlier ATA revisions...
685 */
686 if (id[ATA_ID_HW_CONFIG] == 0 && (short)id[ATA_ID_MAJOR_VER] >= 0x0020)
687 return 1;
688 return 0;
585} 689}
586 690
587static inline int ata_id_has_tpm(const u16 *id) 691static inline int ata_id_has_tpm(const u16 *id)
@@ -599,7 +703,16 @@ static inline int ata_id_has_dword_io(const u16 *id)
599 /* ATA 8 reuses this flag for "trusted" computing */ 703 /* ATA 8 reuses this flag for "trusted" computing */
600 if (ata_id_major_version(id) > 7) 704 if (ata_id_major_version(id) > 7)
601 return 0; 705 return 0;
602 if (id[48] & (1 << 0)) 706 if (id[ATA_ID_DWORD_IO] & (1 << 0))
707 return 1;
708 return 0;
709}
710
711static inline int ata_id_has_unload(const u16 *id)
712{
713 if (ata_id_major_version(id) >= 7 &&
714 (id[ATA_ID_CFSSE] & 0xC000) == 0x4000 &&
715 id[ATA_ID_CFSSE] & (1 << 13))
603 return 1; 716 return 1;
604 return 0; 717 return 0;
605} 718}
@@ -608,45 +721,50 @@ static inline int ata_id_current_chs_valid(const u16 *id)
608{ 721{
609 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command 722 /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
610 has not been issued to the device then the values of 723 has not been issued to the device then the values of
611 id[54] to id[56] are vendor specific. */ 724 id[ATA_ID_CUR_CYLS] to id[ATA_ID_CUR_SECTORS] are vendor specific. */
612 return (id[53] & 0x01) && /* Current translation valid */ 725 return (id[ATA_ID_FIELD_VALID] & 1) && /* Current translation valid */
613 id[54] && /* cylinders in current translation */ 726 id[ATA_ID_CUR_CYLS] && /* cylinders in current translation */
614 id[55] && /* heads in current translation */ 727 id[ATA_ID_CUR_HEADS] && /* heads in current translation */
615 id[55] <= 16 && 728 id[ATA_ID_CUR_HEADS] <= 16 &&
616 id[56]; /* sectors in current translation */ 729 id[ATA_ID_CUR_SECTORS]; /* sectors in current translation */
617} 730}
618 731
619static inline int ata_id_is_cfa(const u16 *id) 732static inline int ata_id_is_cfa(const u16 *id)
620{ 733{
621 u16 v = id[0]; 734 if (id[ATA_ID_CONFIG] == 0x848A) /* Standard CF */
622 if (v == 0x848A) /* Standard CF */
623 return 1; 735 return 1;
624 /* Could be CF hiding as standard ATA */ 736 /* Could be CF hiding as standard ATA */
625 if (ata_id_major_version(id) >= 3 && id[82] != 0xFFFF && 737 if (ata_id_major_version(id) >= 3 &&
626 (id[82] & ( 1 << 2))) 738 id[ATA_ID_COMMAND_SET_1] != 0xFFFF &&
739 (id[ATA_ID_COMMAND_SET_1] & (1 << 2)))
627 return 1; 740 return 1;
628 return 0; 741 return 0;
629} 742}
630 743
744static inline int ata_id_is_ssd(const u16 *id)
745{
746 return id[ATA_ID_ROT_SPEED] == 0x01;
747}
748
631static inline int ata_drive_40wire(const u16 *dev_id) 749static inline int ata_drive_40wire(const u16 *dev_id)
632{ 750{
633 if (ata_id_is_sata(dev_id)) 751 if (ata_id_is_sata(dev_id))
634 return 0; /* SATA */ 752 return 0; /* SATA */
635 if ((dev_id[93] & 0xE000) == 0x6000) 753 if ((dev_id[ATA_ID_HW_CONFIG] & 0xE000) == 0x6000)
636 return 0; /* 80 wire */ 754 return 0; /* 80 wire */
637 return 1; 755 return 1;
638} 756}
639 757
640static inline int ata_drive_40wire_relaxed(const u16 *dev_id) 758static inline int ata_drive_40wire_relaxed(const u16 *dev_id)
641{ 759{
642 if ((dev_id[93] & 0x2000) == 0x2000) 760 if ((dev_id[ATA_ID_HW_CONFIG] & 0x2000) == 0x2000)
643 return 0; /* 80 wire */ 761 return 0; /* 80 wire */
644 return 1; 762 return 1;
645} 763}
646 764
647static inline int atapi_cdb_len(const u16 *dev_id) 765static inline int atapi_cdb_len(const u16 *dev_id)
648{ 766{
649 u16 tmp = dev_id[0] & 0x3; 767 u16 tmp = dev_id[ATA_ID_CONFIG] & 0x3;
650 switch (tmp) { 768 switch (tmp) {
651 case 0: return 12; 769 case 0: return 12;
652 case 1: return 16; 770 case 1: return 16;
@@ -656,7 +774,7 @@ static inline int atapi_cdb_len(const u16 *dev_id)
656 774
657static inline int atapi_command_packet_set(const u16 *dev_id) 775static inline int atapi_command_packet_set(const u16 *dev_id)
658{ 776{
659 return (dev_id[0] >> 8) & 0x1f; 777 return (dev_id[ATA_ID_CONFIG] >> 8) & 0x1f;
660} 778}
661 779
662static inline int atapi_id_dmadir(const u16 *dev_id) 780static inline int atapi_id_dmadir(const u16 *dev_id)
@@ -664,6 +782,76 @@ static inline int atapi_id_dmadir(const u16 *dev_id)
664 return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000); 782 return ata_id_major_version(dev_id) >= 7 && (dev_id[62] & 0x8000);
665} 783}
666 784
785/*
786 * ata_id_is_lba_capacity_ok() performs a sanity check on
787 * the claimed LBA capacity value for the device.
788 *
789 * Returns 1 if LBA capacity looks sensible, 0 otherwise.
790 *
791 * It is called only once for each device.
792 */
793static inline int ata_id_is_lba_capacity_ok(u16 *id)
794{
795 unsigned long lba_sects, chs_sects, head, tail;
796
797 /* No non-LBA info .. so valid! */
798 if (id[ATA_ID_CYLS] == 0)
799 return 1;
800
801 lba_sects = ata_id_u32(id, ATA_ID_LBA_CAPACITY);
802
803 /*
804 * The ATA spec tells large drives to return
805 * C/H/S = 16383/16/63 independent of their size.
806 * Some drives can be jumpered to use 15 heads instead of 16.
807 * Some drives can be jumpered to use 4092 cyls instead of 16383.
808 */
809 if ((id[ATA_ID_CYLS] == 16383 ||
810 (id[ATA_ID_CYLS] == 4092 && id[ATA_ID_CUR_CYLS] == 16383)) &&
811 id[ATA_ID_SECTORS] == 63 &&
812 (id[ATA_ID_HEADS] == 15 || id[ATA_ID_HEADS] == 16) &&
813 (lba_sects >= 16383 * 63 * id[ATA_ID_HEADS]))
814 return 1;
815
816 chs_sects = id[ATA_ID_CYLS] * id[ATA_ID_HEADS] * id[ATA_ID_SECTORS];
817
818 /* perform a rough sanity check on lba_sects: within 10% is OK */
819 if (lba_sects - chs_sects < chs_sects/10)
820 return 1;
821
822 /* some drives have the word order reversed */
823 head = (lba_sects >> 16) & 0xffff;
824 tail = lba_sects & 0xffff;
825 lba_sects = head | (tail << 16);
826
827 if (lba_sects - chs_sects < chs_sects/10) {
828 *(__le32 *)&id[ATA_ID_LBA_CAPACITY] = __cpu_to_le32(lba_sects);
829 return 1; /* LBA capacity is (now) good */
830 }
831
832 return 0; /* LBA capacity value may be bad */
833}
834
835static inline void ata_id_to_hd_driveid(u16 *id)
836{
837#ifdef __BIG_ENDIAN
838 /* accessed in struct hd_driveid as 8-bit values */
839 id[ATA_ID_MAX_MULTSECT] = __cpu_to_le16(id[ATA_ID_MAX_MULTSECT]);
840 id[ATA_ID_CAPABILITY] = __cpu_to_le16(id[ATA_ID_CAPABILITY]);
841 id[ATA_ID_OLD_PIO_MODES] = __cpu_to_le16(id[ATA_ID_OLD_PIO_MODES]);
842 id[ATA_ID_OLD_DMA_MODES] = __cpu_to_le16(id[ATA_ID_OLD_DMA_MODES]);
843 id[ATA_ID_MULTSECT] = __cpu_to_le16(id[ATA_ID_MULTSECT]);
844
845 /* as 32-bit values */
846 *(u32 *)&id[ATA_ID_LBA_CAPACITY] = ata_id_u32(id, ATA_ID_LBA_CAPACITY);
847 *(u32 *)&id[ATA_ID_SPG] = ata_id_u32(id, ATA_ID_SPG);
848
849 /* as 64-bit value */
850 *(u64 *)&id[ATA_ID_LBA_CAPACITY_2] =
851 ata_id_u64(id, ATA_ID_LBA_CAPACITY_2);
852#endif
853}
854
667static inline int is_multi_taskfile(struct ata_taskfile *tf) 855static inline int is_multi_taskfile(struct ata_taskfile *tf)
668{ 856{
669 return (tf->command == ATA_CMD_READ_MULTI) || 857 return (tf->command == ATA_CMD_READ_MULTI) ||
@@ -682,7 +870,7 @@ static inline int ata_ok(u8 status)
682static inline int lba_28_ok(u64 block, u32 n_block) 870static inline int lba_28_ok(u64 block, u32 n_block)
683{ 871{
684 /* check the ending block number */ 872 /* check the ending block number */
685 return ((block + n_block - 1) < ((u64)1 << 28)) && (n_block <= 256); 873 return ((block + n_block) < ((u64)1 << 28)) && (n_block <= 256);
686} 874}
687 875
688static inline int lba_48_ok(u64 block, u32 n_block) 876static inline int lba_48_ok(u64 block, u32 n_block)
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 0933a14e6414..ff5b4cf9e2da 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -26,21 +26,8 @@
26 26
27#ifdef CONFIG_BLOCK 27#ifdef CONFIG_BLOCK
28 28
29/* Platforms may set this to teach the BIO layer about IOMMU hardware. */
30#include <asm/io.h> 29#include <asm/io.h>
31 30
32#if defined(BIO_VMERGE_MAX_SIZE) && defined(BIO_VMERGE_BOUNDARY)
33#define BIOVEC_VIRT_START_SIZE(x) (bvec_to_phys(x) & (BIO_VMERGE_BOUNDARY - 1))
34#define BIOVEC_VIRT_OVERSIZE(x) ((x) > BIO_VMERGE_MAX_SIZE)
35#else
36#define BIOVEC_VIRT_START_SIZE(x) 0
37#define BIOVEC_VIRT_OVERSIZE(x) 0
38#endif
39
40#ifndef BIO_VMERGE_BOUNDARY
41#define BIO_VMERGE_BOUNDARY 0
42#endif
43
44#define BIO_DEBUG 31#define BIO_DEBUG
45 32
46#ifdef BIO_DEBUG 33#ifdef BIO_DEBUG
@@ -88,25 +75,14 @@ struct bio {
88 /* Number of segments in this BIO after 75 /* Number of segments in this BIO after
89 * physical address coalescing is performed. 76 * physical address coalescing is performed.
90 */ 77 */
91 unsigned short bi_phys_segments; 78 unsigned int bi_phys_segments;
92
93 /* Number of segments after physical and DMA remapping
94 * hardware coalescing is performed.
95 */
96 unsigned short bi_hw_segments;
97 79
98 unsigned int bi_size; /* residual I/O count */ 80 unsigned int bi_size; /* residual I/O count */
99 81
100 /*
101 * To keep track of the max hw size, we account for the
102 * sizes of the first and last virtually mergeable segments
103 * in this bio
104 */
105 unsigned int bi_hw_front_size;
106 unsigned int bi_hw_back_size;
107
108 unsigned int bi_max_vecs; /* max bvl_vecs we can hold */ 82 unsigned int bi_max_vecs; /* max bvl_vecs we can hold */
109 83
84 unsigned int bi_comp_cpu; /* completion CPU */
85
110 struct bio_vec *bi_io_vec; /* the actual vec list */ 86 struct bio_vec *bi_io_vec; /* the actual vec list */
111 87
112 bio_end_io_t *bi_end_io; 88 bio_end_io_t *bi_end_io;
@@ -126,11 +102,14 @@ struct bio {
126#define BIO_UPTODATE 0 /* ok after I/O completion */ 102#define BIO_UPTODATE 0 /* ok after I/O completion */
127#define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */ 103#define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */
128#define BIO_EOF 2 /* out-out-bounds error */ 104#define BIO_EOF 2 /* out-out-bounds error */
129#define BIO_SEG_VALID 3 /* nr_hw_seg valid */ 105#define BIO_SEG_VALID 3 /* bi_phys_segments valid */
130#define BIO_CLONED 4 /* doesn't own data */ 106#define BIO_CLONED 4 /* doesn't own data */
131#define BIO_BOUNCED 5 /* bio is a bounce bio */ 107#define BIO_BOUNCED 5 /* bio is a bounce bio */
132#define BIO_USER_MAPPED 6 /* contains user pages */ 108#define BIO_USER_MAPPED 6 /* contains user pages */
133#define BIO_EOPNOTSUPP 7 /* not supported */ 109#define BIO_EOPNOTSUPP 7 /* not supported */
110#define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */
111#define BIO_NULL_MAPPED 9 /* contains invalid user pages */
112#define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */
134#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) 113#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
135 114
136/* 115/*
@@ -144,18 +123,31 @@ struct bio {
144/* 123/*
145 * bio bi_rw flags 124 * bio bi_rw flags
146 * 125 *
147 * bit 0 -- read (not set) or write (set) 126 * bit 0 -- data direction
127 * If not set, bio is a read from device. If set, it's a write to device.
148 * bit 1 -- rw-ahead when set 128 * bit 1 -- rw-ahead when set
149 * bit 2 -- barrier 129 * bit 2 -- barrier
130 * Insert a serialization point in the IO queue, forcing previously
131 * submitted IO to be completed before this oen is issued.
150 * bit 3 -- fail fast, don't want low level driver retries 132 * bit 3 -- fail fast, don't want low level driver retries
151 * bit 4 -- synchronous I/O hint: the block layer will unplug immediately 133 * bit 4 -- synchronous I/O hint: the block layer will unplug immediately
134 * Note that this does NOT indicate that the IO itself is sync, just
135 * that the block layer will not postpone issue of this IO by plugging.
136 * bit 5 -- metadata request
137 * Used for tracing to differentiate metadata and data IO. May also
138 * get some preferential treatment in the IO scheduler
139 * bit 6 -- discard sectors
140 * Informs the lower level device that this range of sectors is no longer
141 * used by the file system and may thus be freed by the device. Used
142 * for flash based storage.
152 */ 143 */
153#define BIO_RW 0 144#define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */
154#define BIO_RW_AHEAD 1 145#define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */
155#define BIO_RW_BARRIER 2 146#define BIO_RW_BARRIER 2
156#define BIO_RW_FAILFAST 3 147#define BIO_RW_FAILFAST 3
157#define BIO_RW_SYNC 4 148#define BIO_RW_SYNC 4
158#define BIO_RW_META 5 149#define BIO_RW_META 5
150#define BIO_RW_DISCARD 6
159 151
160/* 152/*
161 * upper 16 bits of bi_rw define the io priority of this bio 153 * upper 16 bits of bi_rw define the io priority of this bio
@@ -185,14 +177,15 @@ struct bio {
185#define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST)) 177#define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST))
186#define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD)) 178#define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD))
187#define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META)) 179#define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META))
188#define bio_empty_barrier(bio) (bio_barrier(bio) && !(bio)->bi_size) 180#define bio_discard(bio) ((bio)->bi_rw & (1 << BIO_RW_DISCARD))
181#define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio) && !bio_discard(bio))
189 182
190static inline unsigned int bio_cur_sectors(struct bio *bio) 183static inline unsigned int bio_cur_sectors(struct bio *bio)
191{ 184{
192 if (bio->bi_vcnt) 185 if (bio->bi_vcnt)
193 return bio_iovec(bio)->bv_len >> 9; 186 return bio_iovec(bio)->bv_len >> 9;
194 187 else /* dataless requests such as discard */
195 return 0; 188 return bio->bi_size >> 9;
196} 189}
197 190
198static inline void *bio_data(struct bio *bio) 191static inline void *bio_data(struct bio *bio)
@@ -236,8 +229,6 @@ static inline void *bio_data(struct bio *bio)
236 ((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2))) 229 ((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2)))
237#endif 230#endif
238 231
239#define BIOVEC_VIRT_MERGEABLE(vec1, vec2) \
240 ((((bvec_to_phys((vec1)) + (vec1)->bv_len) | bvec_to_phys((vec2))) & (BIO_VMERGE_BOUNDARY - 1)) == 0)
241#define __BIO_SEG_BOUNDARY(addr1, addr2, mask) \ 232#define __BIO_SEG_BOUNDARY(addr1, addr2, mask) \
242 (((addr1) | (mask)) == (((addr2) - 1) | (mask))) 233 (((addr1) | (mask)) == (((addr2) - 1) | (mask)))
243#define BIOVEC_SEG_BOUNDARY(q, b1, b2) \ 234#define BIOVEC_SEG_BOUNDARY(q, b1, b2) \
@@ -319,15 +310,14 @@ struct bio_pair {
319 atomic_t cnt; 310 atomic_t cnt;
320 int error; 311 int error;
321}; 312};
322extern struct bio_pair *bio_split(struct bio *bi, mempool_t *pool, 313extern struct bio_pair *bio_split(struct bio *bi, int first_sectors);
323 int first_sectors);
324extern mempool_t *bio_split_pool;
325extern void bio_pair_release(struct bio_pair *dbio); 314extern void bio_pair_release(struct bio_pair *dbio);
326 315
327extern struct bio_set *bioset_create(int, int); 316extern struct bio_set *bioset_create(int, int);
328extern void bioset_free(struct bio_set *); 317extern void bioset_free(struct bio_set *);
329 318
330extern struct bio *bio_alloc(gfp_t, int); 319extern struct bio *bio_alloc(gfp_t, int);
320extern struct bio *bio_kmalloc(gfp_t, int);
331extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *); 321extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *);
332extern void bio_put(struct bio *); 322extern void bio_put(struct bio *);
333extern void bio_free(struct bio *, struct bio_set *); 323extern void bio_free(struct bio *, struct bio_set *);
@@ -335,7 +325,6 @@ extern void bio_free(struct bio *, struct bio_set *);
335extern void bio_endio(struct bio *, int); 325extern void bio_endio(struct bio *, int);
336struct request_queue; 326struct request_queue;
337extern int bio_phys_segments(struct request_queue *, struct bio *); 327extern int bio_phys_segments(struct request_queue *, struct bio *);
338extern int bio_hw_segments(struct request_queue *, struct bio *);
339 328
340extern void __bio_clone(struct bio *, struct bio *); 329extern void __bio_clone(struct bio *, struct bio *);
341extern struct bio *bio_clone(struct bio *, gfp_t); 330extern struct bio *bio_clone(struct bio *, gfp_t);
@@ -346,12 +335,14 @@ extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int);
346extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, 335extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *,
347 unsigned int, unsigned int); 336 unsigned int, unsigned int);
348extern int bio_get_nr_vecs(struct block_device *); 337extern int bio_get_nr_vecs(struct block_device *);
338extern sector_t bio_sector_offset(struct bio *, unsigned short, unsigned int);
349extern struct bio *bio_map_user(struct request_queue *, struct block_device *, 339extern struct bio *bio_map_user(struct request_queue *, struct block_device *,
350 unsigned long, unsigned int, int); 340 unsigned long, unsigned int, int, gfp_t);
351struct sg_iovec; 341struct sg_iovec;
342struct rq_map_data;
352extern struct bio *bio_map_user_iov(struct request_queue *, 343extern struct bio *bio_map_user_iov(struct request_queue *,
353 struct block_device *, 344 struct block_device *,
354 struct sg_iovec *, int, int); 345 struct sg_iovec *, int, int, gfp_t);
355extern void bio_unmap_user(struct bio *); 346extern void bio_unmap_user(struct bio *);
356extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int, 347extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int,
357 gfp_t); 348 gfp_t);
@@ -359,15 +350,25 @@ extern struct bio *bio_copy_kern(struct request_queue *, void *, unsigned int,
359 gfp_t, int); 350 gfp_t, int);
360extern void bio_set_pages_dirty(struct bio *bio); 351extern void bio_set_pages_dirty(struct bio *bio);
361extern void bio_check_pages_dirty(struct bio *bio); 352extern void bio_check_pages_dirty(struct bio *bio);
362extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int); 353extern struct bio *bio_copy_user(struct request_queue *, struct rq_map_data *,
363extern struct bio *bio_copy_user_iov(struct request_queue *, struct sg_iovec *, 354 unsigned long, unsigned int, int, gfp_t);
364 int, int); 355extern struct bio *bio_copy_user_iov(struct request_queue *,
356 struct rq_map_data *, struct sg_iovec *,
357 int, int, gfp_t);
365extern int bio_uncopy_user(struct bio *); 358extern int bio_uncopy_user(struct bio *);
366void zero_fill_bio(struct bio *bio); 359void zero_fill_bio(struct bio *bio);
367extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *); 360extern struct bio_vec *bvec_alloc_bs(gfp_t, int, unsigned long *, struct bio_set *);
368extern unsigned int bvec_nr_vecs(unsigned short idx); 361extern unsigned int bvec_nr_vecs(unsigned short idx);
369 362
370/* 363/*
364 * Allow queuer to specify a completion CPU for this bio
365 */
366static inline void bio_set_completion_cpu(struct bio *bio, unsigned int cpu)
367{
368 bio->bi_comp_cpu = cpu;
369}
370
371/*
371 * bio_set is used to allow other portions of the IO system to 372 * bio_set is used to allow other portions of the IO system to
372 * allocate their own private memory pools for bio and iovec structures. 373 * allocate their own private memory pools for bio and iovec structures.
373 * These memory pools in turn all allocate from the bio_slab 374 * These memory pools in turn all allocate from the bio_slab
@@ -445,6 +446,14 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
445 __bio_kmap_irq((bio), (bio)->bi_idx, (flags)) 446 __bio_kmap_irq((bio), (bio)->bi_idx, (flags))
446#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags) 447#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags)
447 448
449/*
450 * Check whether this bio carries any data or not. A NULL bio is allowed.
451 */
452static inline int bio_has_data(struct bio *bio)
453{
454 return bio && bio->bi_io_vec != NULL;
455}
456
448#if defined(CONFIG_BLK_DEV_INTEGRITY) 457#if defined(CONFIG_BLK_DEV_INTEGRITY)
449 458
450#define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)])) 459#define bip_vec_idx(bip, idx) (&(bip->bip_vec[(idx)]))
@@ -458,14 +467,7 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
458#define bip_for_each_vec(bvl, bip, i) \ 467#define bip_for_each_vec(bvl, bip, i) \
459 __bip_for_each_vec(bvl, bip, i, (bip)->bip_idx) 468 __bip_for_each_vec(bvl, bip, i, (bip)->bip_idx)
460 469
461static inline int bio_integrity(struct bio *bio) 470#define bio_integrity(bio) (bio->bi_integrity != NULL)
462{
463#if defined(CONFIG_BLK_DEV_INTEGRITY)
464 return bio->bi_integrity != NULL;
465#else
466 return 0;
467#endif
468}
469 471
470extern struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *, gfp_t, unsigned int, struct bio_set *); 472extern struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *, gfp_t, unsigned int, struct bio_set *);
471extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int); 473extern struct bio_integrity_payload *bio_integrity_alloc(struct bio *, gfp_t, unsigned int);
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 1abfe664c444..89781fd48859 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -110,6 +110,7 @@ extern int __bitmap_weight(const unsigned long *bitmap, int bits);
110 110
111extern int bitmap_scnprintf(char *buf, unsigned int len, 111extern int bitmap_scnprintf(char *buf, unsigned int len,
112 const unsigned long *src, int nbits); 112 const unsigned long *src, int nbits);
113extern int bitmap_scnprintf_len(unsigned int nr_bits);
113extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user, 114extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user,
114 unsigned long *dst, int nbits); 115 unsigned long *dst, int nbits);
115extern int bitmap_parse_user(const char __user *ubuf, unsigned int ulen, 116extern int bitmap_parse_user(const char __user *ubuf, unsigned int ulen,
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 88d68081a0f1..a92d9e4ea96e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -16,7 +16,9 @@
16#include <linux/bio.h> 16#include <linux/bio.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/stringify.h> 18#include <linux/stringify.h>
19#include <linux/gfp.h>
19#include <linux/bsg.h> 20#include <linux/bsg.h>
21#include <linux/smp.h>
20 22
21#include <asm/scatterlist.h> 23#include <asm/scatterlist.h>
22 24
@@ -54,7 +56,6 @@ enum rq_cmd_type_bits {
54 REQ_TYPE_PM_SUSPEND, /* suspend request */ 56 REQ_TYPE_PM_SUSPEND, /* suspend request */
55 REQ_TYPE_PM_RESUME, /* resume request */ 57 REQ_TYPE_PM_RESUME, /* resume request */
56 REQ_TYPE_PM_SHUTDOWN, /* shutdown request */ 58 REQ_TYPE_PM_SHUTDOWN, /* shutdown request */
57 REQ_TYPE_FLUSH, /* flush request */
58 REQ_TYPE_SPECIAL, /* driver defined type */ 59 REQ_TYPE_SPECIAL, /* driver defined type */
59 REQ_TYPE_LINUX_BLOCK, /* generic block layer message */ 60 REQ_TYPE_LINUX_BLOCK, /* generic block layer message */
60 /* 61 /*
@@ -76,19 +77,18 @@ enum rq_cmd_type_bits {
76 * 77 *
77 */ 78 */
78enum { 79enum {
79 /*
80 * just examples for now
81 */
82 REQ_LB_OP_EJECT = 0x40, /* eject request */ 80 REQ_LB_OP_EJECT = 0x40, /* eject request */
83 REQ_LB_OP_FLUSH = 0x41, /* flush device */ 81 REQ_LB_OP_FLUSH = 0x41, /* flush request */
82 REQ_LB_OP_DISCARD = 0x42, /* discard sectors */
84}; 83};
85 84
86/* 85/*
87 * request type modified bits. first three bits match BIO_RW* bits, important 86 * request type modified bits. first two bits match BIO_RW* bits, important
88 */ 87 */
89enum rq_flag_bits { 88enum rq_flag_bits {
90 __REQ_RW, /* not set, read. set, write */ 89 __REQ_RW, /* not set, read. set, write */
91 __REQ_FAILFAST, /* no low level driver retries */ 90 __REQ_FAILFAST, /* no low level driver retries */
91 __REQ_DISCARD, /* request to discard sectors */
92 __REQ_SORTED, /* elevator knows about this request */ 92 __REQ_SORTED, /* elevator knows about this request */
93 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ 93 __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
94 __REQ_HARDBARRIER, /* may not be passed by drive either */ 94 __REQ_HARDBARRIER, /* may not be passed by drive either */
@@ -111,6 +111,7 @@ enum rq_flag_bits {
111}; 111};
112 112
113#define REQ_RW (1 << __REQ_RW) 113#define REQ_RW (1 << __REQ_RW)
114#define REQ_DISCARD (1 << __REQ_DISCARD)
114#define REQ_FAILFAST (1 << __REQ_FAILFAST) 115#define REQ_FAILFAST (1 << __REQ_FAILFAST)
115#define REQ_SORTED (1 << __REQ_SORTED) 116#define REQ_SORTED (1 << __REQ_SORTED)
116#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER) 117#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
@@ -140,12 +141,14 @@ enum rq_flag_bits {
140 */ 141 */
141struct request { 142struct request {
142 struct list_head queuelist; 143 struct list_head queuelist;
143 struct list_head donelist; 144 struct call_single_data csd;
145 int cpu;
144 146
145 struct request_queue *q; 147 struct request_queue *q;
146 148
147 unsigned int cmd_flags; 149 unsigned int cmd_flags;
148 enum rq_cmd_type_bits cmd_type; 150 enum rq_cmd_type_bits cmd_type;
151 unsigned long atomic_flags;
149 152
150 /* Maintain bio traversal state for part by part I/O submission. 153 /* Maintain bio traversal state for part by part I/O submission.
151 * hard_* are block layer internals, no driver should touch them! 154 * hard_* are block layer internals, no driver should touch them!
@@ -190,13 +193,6 @@ struct request {
190 */ 193 */
191 unsigned short nr_phys_segments; 194 unsigned short nr_phys_segments;
192 195
193 /* Number of scatter-gather addr+len pairs after
194 * physical and DMA remapping hardware coalescing is performed.
195 * This is the number of scatter-gather entries the driver
196 * will actually have to deal with after DMA mapping is done.
197 */
198 unsigned short nr_hw_segments;
199
200 unsigned short ioprio; 196 unsigned short ioprio;
201 197
202 void *special; 198 void *special;
@@ -220,6 +216,8 @@ struct request {
220 void *data; 216 void *data;
221 void *sense; 217 void *sense;
222 218
219 unsigned long deadline;
220 struct list_head timeout_list;
223 unsigned int timeout; 221 unsigned int timeout;
224 int retries; 222 int retries;
225 223
@@ -233,6 +231,11 @@ struct request {
233 struct request *next_rq; 231 struct request *next_rq;
234}; 232};
235 233
234static inline unsigned short req_get_ioprio(struct request *req)
235{
236 return req->ioprio;
237}
238
236/* 239/*
237 * State information carried for REQ_TYPE_PM_SUSPEND and REQ_TYPE_PM_RESUME 240 * State information carried for REQ_TYPE_PM_SUSPEND and REQ_TYPE_PM_RESUME
238 * requests. Some step values could eventually be made generic. 241 * requests. Some step values could eventually be made generic.
@@ -252,6 +255,7 @@ typedef void (request_fn_proc) (struct request_queue *q);
252typedef int (make_request_fn) (struct request_queue *q, struct bio *bio); 255typedef int (make_request_fn) (struct request_queue *q, struct bio *bio);
253typedef int (prep_rq_fn) (struct request_queue *, struct request *); 256typedef int (prep_rq_fn) (struct request_queue *, struct request *);
254typedef void (unplug_fn) (struct request_queue *); 257typedef void (unplug_fn) (struct request_queue *);
258typedef int (prepare_discard_fn) (struct request_queue *, struct request *);
255 259
256struct bio_vec; 260struct bio_vec;
257struct bvec_merge_data { 261struct bvec_merge_data {
@@ -265,6 +269,15 @@ typedef int (merge_bvec_fn) (struct request_queue *, struct bvec_merge_data *,
265typedef void (prepare_flush_fn) (struct request_queue *, struct request *); 269typedef void (prepare_flush_fn) (struct request_queue *, struct request *);
266typedef void (softirq_done_fn)(struct request *); 270typedef void (softirq_done_fn)(struct request *);
267typedef int (dma_drain_needed_fn)(struct request *); 271typedef int (dma_drain_needed_fn)(struct request *);
272typedef int (lld_busy_fn) (struct request_queue *q);
273
274enum blk_eh_timer_return {
275 BLK_EH_NOT_HANDLED,
276 BLK_EH_HANDLED,
277 BLK_EH_RESET_TIMER,
278};
279
280typedef enum blk_eh_timer_return (rq_timed_out_fn)(struct request *);
268 281
269enum blk_queue_state { 282enum blk_queue_state {
270 Queue_down, 283 Queue_down,
@@ -280,6 +293,15 @@ struct blk_queue_tag {
280 atomic_t refcnt; /* map can be shared */ 293 atomic_t refcnt; /* map can be shared */
281}; 294};
282 295
296#define BLK_SCSI_MAX_CMDS (256)
297#define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8))
298
299struct blk_cmd_filter {
300 unsigned long read_ok[BLK_SCSI_CMD_PER_LONG];
301 unsigned long write_ok[BLK_SCSI_CMD_PER_LONG];
302 struct kobject kobj;
303};
304
283struct request_queue 305struct request_queue
284{ 306{
285 /* 307 /*
@@ -298,10 +320,13 @@ struct request_queue
298 make_request_fn *make_request_fn; 320 make_request_fn *make_request_fn;
299 prep_rq_fn *prep_rq_fn; 321 prep_rq_fn *prep_rq_fn;
300 unplug_fn *unplug_fn; 322 unplug_fn *unplug_fn;
323 prepare_discard_fn *prepare_discard_fn;
301 merge_bvec_fn *merge_bvec_fn; 324 merge_bvec_fn *merge_bvec_fn;
302 prepare_flush_fn *prepare_flush_fn; 325 prepare_flush_fn *prepare_flush_fn;
303 softirq_done_fn *softirq_done_fn; 326 softirq_done_fn *softirq_done_fn;
327 rq_timed_out_fn *rq_timed_out_fn;
304 dma_drain_needed_fn *dma_drain_needed; 328 dma_drain_needed_fn *dma_drain_needed;
329 lld_busy_fn *lld_busy_fn;
305 330
306 /* 331 /*
307 * Dispatch queue sorting 332 * Dispatch queue sorting
@@ -376,6 +401,10 @@ struct request_queue
376 unsigned int nr_sorted; 401 unsigned int nr_sorted;
377 unsigned int in_flight; 402 unsigned int in_flight;
378 403
404 unsigned int rq_timeout;
405 struct timer_list timeout;
406 struct list_head timeout_list;
407
379 /* 408 /*
380 * sg stuff 409 * sg stuff
381 */ 410 */
@@ -398,6 +427,7 @@ struct request_queue
398#if defined(CONFIG_BLK_DEV_BSG) 427#if defined(CONFIG_BLK_DEV_BSG)
399 struct bsg_class_device bsg_dev; 428 struct bsg_class_device bsg_dev;
400#endif 429#endif
430 struct blk_cmd_filter cmd_filter;
401}; 431};
402 432
403#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */ 433#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */
@@ -411,6 +441,10 @@ struct request_queue
411#define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */ 441#define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */
412#define QUEUE_FLAG_BIDI 9 /* queue supports bidi requests */ 442#define QUEUE_FLAG_BIDI 9 /* queue supports bidi requests */
413#define QUEUE_FLAG_NOMERGES 10 /* disable merge attempts */ 443#define QUEUE_FLAG_NOMERGES 10 /* disable merge attempts */
444#define QUEUE_FLAG_SAME_COMP 11 /* force complete on same CPU */
445#define QUEUE_FLAG_FAIL_IO 12 /* fake timeout */
446#define QUEUE_FLAG_STACKABLE 13 /* supports request stacking */
447#define QUEUE_FLAG_NONROT 14 /* non-rotational device (SSD) */
414 448
415static inline int queue_is_locked(struct request_queue *q) 449static inline int queue_is_locked(struct request_queue *q)
416{ 450{
@@ -516,7 +550,10 @@ enum {
516#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags) 550#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
517#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags) 551#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
518#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags) 552#define blk_queue_nomerges(q) test_bit(QUEUE_FLAG_NOMERGES, &(q)->queue_flags)
553#define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags)
519#define blk_queue_flushing(q) ((q)->ordseq) 554#define blk_queue_flushing(q) ((q)->ordseq)
555#define blk_queue_stackable(q) \
556 test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags)
520 557
521#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) 558#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS)
522#define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC) 559#define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC)
@@ -526,16 +563,18 @@ enum {
526#define blk_noretry_request(rq) ((rq)->cmd_flags & REQ_FAILFAST) 563#define blk_noretry_request(rq) ((rq)->cmd_flags & REQ_FAILFAST)
527#define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED) 564#define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED)
528 565
529#define blk_account_rq(rq) (blk_rq_started(rq) && blk_fs_request(rq)) 566#define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq)))
530 567
531#define blk_pm_suspend_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND) 568#define blk_pm_suspend_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND)
532#define blk_pm_resume_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_RESUME) 569#define blk_pm_resume_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_RESUME)
533#define blk_pm_request(rq) \ 570#define blk_pm_request(rq) \
534 (blk_pm_suspend_request(rq) || blk_pm_resume_request(rq)) 571 (blk_pm_suspend_request(rq) || blk_pm_resume_request(rq))
535 572
573#define blk_rq_cpu_valid(rq) ((rq)->cpu != -1)
536#define blk_sorted_rq(rq) ((rq)->cmd_flags & REQ_SORTED) 574#define blk_sorted_rq(rq) ((rq)->cmd_flags & REQ_SORTED)
537#define blk_barrier_rq(rq) ((rq)->cmd_flags & REQ_HARDBARRIER) 575#define blk_barrier_rq(rq) ((rq)->cmd_flags & REQ_HARDBARRIER)
538#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA) 576#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA)
577#define blk_discard_rq(rq) ((rq)->cmd_flags & REQ_DISCARD)
539#define blk_bidi_rq(rq) ((rq)->next_rq != NULL) 578#define blk_bidi_rq(rq) ((rq)->next_rq != NULL)
540#define blk_empty_barrier(rq) (blk_barrier_rq(rq) && blk_fs_request(rq) && !(rq)->hard_nr_sectors) 579#define blk_empty_barrier(rq) (blk_barrier_rq(rq) && blk_fs_request(rq) && !(rq)->hard_nr_sectors)
541/* rq->queuelist of dequeued request must be list_empty() */ 580/* rq->queuelist of dequeued request must be list_empty() */
@@ -582,7 +621,8 @@ static inline void blk_clear_queue_full(struct request_queue *q, int rw)
582#define RQ_NOMERGE_FLAGS \ 621#define RQ_NOMERGE_FLAGS \
583 (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER) 622 (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER)
584#define rq_mergeable(rq) \ 623#define rq_mergeable(rq) \
585 (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && blk_fs_request((rq))) 624 (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \
625 (blk_discard_rq(rq) || blk_fs_request((rq))))
586 626
587/* 627/*
588 * q->prep_rq_fn return values 628 * q->prep_rq_fn return values
@@ -627,6 +667,12 @@ static inline void blk_queue_bounce(struct request_queue *q, struct bio **bio)
627} 667}
628#endif /* CONFIG_MMU */ 668#endif /* CONFIG_MMU */
629 669
670struct rq_map_data {
671 struct page **pages;
672 int page_order;
673 int nr_entries;
674};
675
630struct req_iterator { 676struct req_iterator {
631 int i; 677 int i;
632 struct bio *bio; 678 struct bio *bio;
@@ -654,7 +700,12 @@ extern void __blk_put_request(struct request_queue *, struct request *);
654extern struct request *blk_get_request(struct request_queue *, int, gfp_t); 700extern struct request *blk_get_request(struct request_queue *, int, gfp_t);
655extern void blk_insert_request(struct request_queue *, struct request *, int, void *); 701extern void blk_insert_request(struct request_queue *, struct request *, int, void *);
656extern void blk_requeue_request(struct request_queue *, struct request *); 702extern void blk_requeue_request(struct request_queue *, struct request *);
703extern int blk_rq_check_limits(struct request_queue *q, struct request *rq);
704extern int blk_lld_busy(struct request_queue *q);
705extern int blk_insert_cloned_request(struct request_queue *q,
706 struct request *rq);
657extern void blk_plug_device(struct request_queue *); 707extern void blk_plug_device(struct request_queue *);
708extern void blk_plug_device_unlocked(struct request_queue *);
658extern int blk_remove_plug(struct request_queue *); 709extern int blk_remove_plug(struct request_queue *);
659extern void blk_recount_segments(struct request_queue *, struct bio *); 710extern void blk_recount_segments(struct request_queue *, struct bio *);
660extern int scsi_cmd_ioctl(struct file *, struct request_queue *, 711extern int scsi_cmd_ioctl(struct file *, struct request_queue *,
@@ -694,11 +745,14 @@ extern void __blk_stop_queue(struct request_queue *q);
694extern void __blk_run_queue(struct request_queue *); 745extern void __blk_run_queue(struct request_queue *);
695extern void blk_run_queue(struct request_queue *); 746extern void blk_run_queue(struct request_queue *);
696extern void blk_start_queueing(struct request_queue *); 747extern void blk_start_queueing(struct request_queue *);
697extern int blk_rq_map_user(struct request_queue *, struct request *, void __user *, unsigned long); 748extern int blk_rq_map_user(struct request_queue *, struct request *,
749 struct rq_map_data *, void __user *, unsigned long,
750 gfp_t);
698extern int blk_rq_unmap_user(struct bio *); 751extern int blk_rq_unmap_user(struct bio *);
699extern int blk_rq_map_kern(struct request_queue *, struct request *, void *, unsigned int, gfp_t); 752extern int blk_rq_map_kern(struct request_queue *, struct request *, void *, unsigned int, gfp_t);
700extern int blk_rq_map_user_iov(struct request_queue *, struct request *, 753extern int blk_rq_map_user_iov(struct request_queue *, struct request *,
701 struct sg_iovec *, int, unsigned int); 754 struct rq_map_data *, struct sg_iovec *, int,
755 unsigned int, gfp_t);
702extern int blk_execute_rq(struct request_queue *, struct gendisk *, 756extern int blk_execute_rq(struct request_queue *, struct gendisk *,
703 struct request *, int); 757 struct request *, int);
704extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *, 758extern void blk_execute_rq_nowait(struct request_queue *, struct gendisk *,
@@ -739,12 +793,15 @@ extern int __blk_end_request(struct request *rq, int error,
739extern int blk_end_bidi_request(struct request *rq, int error, 793extern int blk_end_bidi_request(struct request *rq, int error,
740 unsigned int nr_bytes, unsigned int bidi_bytes); 794 unsigned int nr_bytes, unsigned int bidi_bytes);
741extern void end_request(struct request *, int); 795extern void end_request(struct request *, int);
742extern void end_queued_request(struct request *, int);
743extern void end_dequeued_request(struct request *, int);
744extern int blk_end_request_callback(struct request *rq, int error, 796extern int blk_end_request_callback(struct request *rq, int error,
745 unsigned int nr_bytes, 797 unsigned int nr_bytes,
746 int (drv_callback)(struct request *)); 798 int (drv_callback)(struct request *));
747extern void blk_complete_request(struct request *); 799extern void blk_complete_request(struct request *);
800extern void __blk_complete_request(struct request *);
801extern void blk_abort_request(struct request *);
802extern void blk_abort_queue(struct request_queue *);
803extern void blk_update_request(struct request *rq, int error,
804 unsigned int nr_bytes);
748 805
749/* 806/*
750 * blk_end_request() takes bytes instead of sectors as a complete size. 807 * blk_end_request() takes bytes instead of sectors as a complete size.
@@ -779,12 +836,16 @@ extern void blk_queue_update_dma_pad(struct request_queue *, unsigned int);
779extern int blk_queue_dma_drain(struct request_queue *q, 836extern int blk_queue_dma_drain(struct request_queue *q,
780 dma_drain_needed_fn *dma_drain_needed, 837 dma_drain_needed_fn *dma_drain_needed,
781 void *buf, unsigned int size); 838 void *buf, unsigned int size);
839extern void blk_queue_lld_busy(struct request_queue *q, lld_busy_fn *fn);
782extern void blk_queue_segment_boundary(struct request_queue *, unsigned long); 840extern void blk_queue_segment_boundary(struct request_queue *, unsigned long);
783extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn); 841extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn);
784extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *); 842extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *);
785extern void blk_queue_dma_alignment(struct request_queue *, int); 843extern void blk_queue_dma_alignment(struct request_queue *, int);
786extern void blk_queue_update_dma_alignment(struct request_queue *, int); 844extern void blk_queue_update_dma_alignment(struct request_queue *, int);
787extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *); 845extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *);
846extern void blk_queue_set_discard(struct request_queue *, prepare_discard_fn *);
847extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *);
848extern void blk_queue_rq_timeout(struct request_queue *, unsigned int);
788extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); 849extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
789extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *); 850extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *);
790extern int blk_do_ordered(struct request_queue *, struct request **); 851extern int blk_do_ordered(struct request_queue *, struct request **);
@@ -806,8 +867,6 @@ extern void blk_put_queue(struct request_queue *);
806/* 867/*
807 * tag stuff 868 * tag stuff
808 */ 869 */
809#define blk_queue_tag_depth(q) ((q)->queue_tags->busy)
810#define blk_queue_tag_queue(q) ((q)->queue_tags->busy < (q)->queue_tags->max_depth)
811#define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED) 870#define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED)
812extern int blk_queue_start_tag(struct request_queue *, struct request *); 871extern int blk_queue_start_tag(struct request_queue *, struct request *);
813extern struct request *blk_queue_find_tag(struct request_queue *, int); 872extern struct request *blk_queue_find_tag(struct request_queue *, int);
@@ -828,15 +887,23 @@ static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
828} 887}
829 888
830extern int blkdev_issue_flush(struct block_device *, sector_t *); 889extern int blkdev_issue_flush(struct block_device *, sector_t *);
890extern int blkdev_issue_discard(struct block_device *,
891 sector_t sector, sector_t nr_sects, gfp_t);
892
893static inline int sb_issue_discard(struct super_block *sb,
894 sector_t block, sector_t nr_blocks)
895{
896 block <<= (sb->s_blocksize_bits - 9);
897 nr_blocks <<= (sb->s_blocksize_bits - 9);
898 return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_KERNEL);
899}
831 900
832/* 901/*
833* command filter functions 902* command filter functions
834*/ 903*/
835extern int blk_verify_command(struct file *file, unsigned char *cmd); 904extern int blk_verify_command(struct blk_cmd_filter *filter,
836extern int blk_cmd_filter_verify_command(struct blk_scsi_cmd_filter *filter, 905 unsigned char *cmd, int has_write_perm);
837 unsigned char *cmd, mode_t *f_mode); 906extern void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter);
838extern int blk_register_filter(struct gendisk *disk);
839extern void blk_unregister_filter(struct gendisk *disk);
840 907
841#define MAX_PHYS_SEGMENTS 128 908#define MAX_PHYS_SEGMENTS 128
842#define MAX_HW_SEGMENTS 128 909#define MAX_HW_SEGMENTS 128
@@ -867,6 +934,13 @@ static inline int queue_dma_alignment(struct request_queue *q)
867 return q ? q->dma_alignment : 511; 934 return q ? q->dma_alignment : 511;
868} 935}
869 936
937static inline int blk_rq_aligned(struct request_queue *q, void *addr,
938 unsigned int len)
939{
940 unsigned int alignment = queue_dma_alignment(q) | q->dma_pad_mask;
941 return !((unsigned long)addr & alignment) && !(len & alignment);
942}
943
870/* assumes size > 256 */ 944/* assumes size > 256 */
871static inline unsigned int blksize_bits(unsigned int size) 945static inline unsigned int blksize_bits(unsigned int size)
872{ 946{
@@ -893,7 +967,7 @@ static inline void put_dev_sector(Sector p)
893} 967}
894 968
895struct work_struct; 969struct work_struct;
896int kblockd_schedule_work(struct work_struct *work); 970int kblockd_schedule_work(struct request_queue *q, struct work_struct *work);
897void kblockd_flush_work(struct work_struct *work); 971void kblockd_flush_work(struct work_struct *work);
898 972
899#define MODULE_ALIAS_BLOCKDEV(major,minor) \ 973#define MODULE_ALIAS_BLOCKDEV(major,minor) \
@@ -938,49 +1012,19 @@ struct blk_integrity {
938 1012
939extern int blk_integrity_register(struct gendisk *, struct blk_integrity *); 1013extern int blk_integrity_register(struct gendisk *, struct blk_integrity *);
940extern void blk_integrity_unregister(struct gendisk *); 1014extern void blk_integrity_unregister(struct gendisk *);
941extern int blk_integrity_compare(struct block_device *, struct block_device *); 1015extern int blk_integrity_compare(struct gendisk *, struct gendisk *);
942extern int blk_rq_map_integrity_sg(struct request *, struct scatterlist *); 1016extern int blk_rq_map_integrity_sg(struct request *, struct scatterlist *);
943extern int blk_rq_count_integrity_sg(struct request *); 1017extern int blk_rq_count_integrity_sg(struct request *);
944 1018
945static inline unsigned short blk_integrity_tuple_size(struct blk_integrity *bi) 1019static inline
946{ 1020struct blk_integrity *bdev_get_integrity(struct block_device *bdev)
947 if (bi)
948 return bi->tuple_size;
949
950 return 0;
951}
952
953static inline struct blk_integrity *bdev_get_integrity(struct block_device *bdev)
954{ 1021{
955 return bdev->bd_disk->integrity; 1022 return bdev->bd_disk->integrity;
956} 1023}
957 1024
958static inline unsigned int bdev_get_tag_size(struct block_device *bdev) 1025static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk)
959{ 1026{
960 struct blk_integrity *bi = bdev_get_integrity(bdev); 1027 return disk->integrity;
961
962 if (bi)
963 return bi->tag_size;
964
965 return 0;
966}
967
968static inline int bdev_integrity_enabled(struct block_device *bdev, int rw)
969{
970 struct blk_integrity *bi = bdev_get_integrity(bdev);
971
972 if (bi == NULL)
973 return 0;
974
975 if (rw == READ && bi->verify_fn != NULL &&
976 (bi->flags & INTEGRITY_FLAG_READ))
977 return 1;
978
979 if (rw == WRITE && bi->generate_fn != NULL &&
980 (bi->flags & INTEGRITY_FLAG_WRITE))
981 return 1;
982
983 return 0;
984} 1028}
985 1029
986static inline int blk_integrity_rq(struct request *rq) 1030static inline int blk_integrity_rq(struct request *rq)
@@ -997,7 +1041,7 @@ static inline int blk_integrity_rq(struct request *rq)
997#define blk_rq_count_integrity_sg(a) (0) 1041#define blk_rq_count_integrity_sg(a) (0)
998#define blk_rq_map_integrity_sg(a, b) (0) 1042#define blk_rq_map_integrity_sg(a, b) (0)
999#define bdev_get_integrity(a) (0) 1043#define bdev_get_integrity(a) (0)
1000#define bdev_get_tag_size(a) (0) 1044#define blk_get_integrity(a) (0)
1001#define blk_integrity_compare(a, b) (0) 1045#define blk_integrity_compare(a, b) (0)
1002#define blk_integrity_register(a, b) (0) 1046#define blk_integrity_register(a, b) (0)
1003#define blk_integrity_unregister(a) do { } while (0); 1047#define blk_integrity_unregister(a) do { } while (0);
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index d084b8d227a5..3a31eb506164 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -1,8 +1,10 @@
1#ifndef BLKTRACE_H 1#ifndef BLKTRACE_H
2#define BLKTRACE_H 2#define BLKTRACE_H
3 3
4#ifdef __KERNEL__
4#include <linux/blkdev.h> 5#include <linux/blkdev.h>
5#include <linux/relay.h> 6#include <linux/relay.h>
7#endif
6 8
7/* 9/*
8 * Trace categories 10 * Trace categories
@@ -21,6 +23,7 @@ enum blktrace_cat {
21 BLK_TC_NOTIFY = 1 << 10, /* special message */ 23 BLK_TC_NOTIFY = 1 << 10, /* special message */
22 BLK_TC_AHEAD = 1 << 11, /* readahead */ 24 BLK_TC_AHEAD = 1 << 11, /* readahead */
23 BLK_TC_META = 1 << 12, /* metadata */ 25 BLK_TC_META = 1 << 12, /* metadata */
26 BLK_TC_DISCARD = 1 << 13, /* discard requests */
24 27
25 BLK_TC_END = 1 << 15, /* only 16-bits, reminder */ 28 BLK_TC_END = 1 << 15, /* only 16-bits, reminder */
26}; 29};
@@ -47,6 +50,7 @@ enum blktrace_act {
47 __BLK_TA_SPLIT, /* bio was split */ 50 __BLK_TA_SPLIT, /* bio was split */
48 __BLK_TA_BOUNCE, /* bio was bounced */ 51 __BLK_TA_BOUNCE, /* bio was bounced */
49 __BLK_TA_REMAP, /* bio was remapped */ 52 __BLK_TA_REMAP, /* bio was remapped */
53 __BLK_TA_ABORT, /* request aborted */
50}; 54};
51 55
52/* 56/*
@@ -77,6 +81,7 @@ enum blktrace_notify {
77#define BLK_TA_SPLIT (__BLK_TA_SPLIT) 81#define BLK_TA_SPLIT (__BLK_TA_SPLIT)
78#define BLK_TA_BOUNCE (__BLK_TA_BOUNCE) 82#define BLK_TA_BOUNCE (__BLK_TA_BOUNCE)
79#define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE)) 83#define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE))
84#define BLK_TA_ABORT (__BLK_TA_ABORT | BLK_TC_ACT(BLK_TC_QUEUE))
80 85
81#define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY)) 86#define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY))
82#define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY)) 87#define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY))
@@ -89,17 +94,17 @@ enum blktrace_notify {
89 * The trace itself 94 * The trace itself
90 */ 95 */
91struct blk_io_trace { 96struct blk_io_trace {
92 u32 magic; /* MAGIC << 8 | version */ 97 __u32 magic; /* MAGIC << 8 | version */
93 u32 sequence; /* event number */ 98 __u32 sequence; /* event number */
94 u64 time; /* in microseconds */ 99 __u64 time; /* in microseconds */
95 u64 sector; /* disk offset */ 100 __u64 sector; /* disk offset */
96 u32 bytes; /* transfer length */ 101 __u32 bytes; /* transfer length */
97 u32 action; /* what happened */ 102 __u32 action; /* what happened */
98 u32 pid; /* who did it */ 103 __u32 pid; /* who did it */
99 u32 device; /* device number */ 104 __u32 device; /* device number */
100 u32 cpu; /* on what cpu did it happen */ 105 __u32 cpu; /* on what cpu did it happen */
101 u16 error; /* completion error */ 106 __u16 error; /* completion error */
102 u16 pdu_len; /* length of data after this trace */ 107 __u16 pdu_len; /* length of data after this trace */
103}; 108};
104 109
105/* 110/*
@@ -117,6 +122,23 @@ enum {
117 Blktrace_stopped, 122 Blktrace_stopped,
118}; 123};
119 124
125#define BLKTRACE_BDEV_SIZE 32
126
127/*
128 * User setup structure passed with BLKTRACESTART
129 */
130struct blk_user_trace_setup {
131 char name[BLKTRACE_BDEV_SIZE]; /* output */
132 __u16 act_mask; /* input */
133 __u32 buf_size; /* input */
134 __u32 buf_nr; /* input */
135 __u64 start_lba;
136 __u64 end_lba;
137 __u32 pid;
138};
139
140#ifdef __KERNEL__
141#if defined(CONFIG_BLK_DEV_IO_TRACE)
120struct blk_trace { 142struct blk_trace {
121 int trace_state; 143 int trace_state;
122 struct rchan *rchan; 144 struct rchan *rchan;
@@ -133,21 +155,6 @@ struct blk_trace {
133 atomic_t dropped; 155 atomic_t dropped;
134}; 156};
135 157
136/*
137 * User setup structure passed with BLKTRACESTART
138 */
139struct blk_user_trace_setup {
140 char name[BDEVNAME_SIZE]; /* output */
141 u16 act_mask; /* input */
142 u32 buf_size; /* input */
143 u32 buf_nr; /* input */
144 u64 start_lba;
145 u64 end_lba;
146 u32 pid;
147};
148
149#ifdef __KERNEL__
150#if defined(CONFIG_BLK_DEV_IO_TRACE)
151extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *); 158extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *);
152extern void blk_trace_shutdown(struct request_queue *); 159extern void blk_trace_shutdown(struct request_queue *);
153extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *); 160extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *);
@@ -195,6 +202,9 @@ static inline void blk_add_trace_rq(struct request_queue *q, struct request *rq,
195 if (likely(!bt)) 202 if (likely(!bt))
196 return; 203 return;
197 204
205 if (blk_discard_rq(rq))
206 rw |= (1 << BIO_RW_DISCARD);
207
198 if (blk_pc_request(rq)) { 208 if (blk_pc_request(rq)) {
199 what |= BLK_TC_ACT(BLK_TC_PC); 209 what |= BLK_TC_ACT(BLK_TC_PC);
200 __blk_add_trace(bt, 0, rq->data_len, rw, what, rq->errors, sizeof(rq->cmd), rq->cmd); 210 __blk_add_trace(bt, 0, rq->data_len, rw, what, rq->errors, sizeof(rq->cmd), rq->cmd);
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 652470b687c9..95837bfb5256 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -97,10 +97,14 @@ extern void *__alloc_bootmem_low_node(pg_data_t *pgdat,
97#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 97#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
98#define alloc_bootmem(x) \ 98#define alloc_bootmem(x) \
99 __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) 99 __alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
100#define alloc_bootmem_nopanic(x) \
101 __alloc_bootmem_nopanic(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
100#define alloc_bootmem_low(x) \ 102#define alloc_bootmem_low(x) \
101 __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0) 103 __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0)
102#define alloc_bootmem_pages(x) \ 104#define alloc_bootmem_pages(x) \
103 __alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) 105 __alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
106#define alloc_bootmem_pages_nopanic(x) \
107 __alloc_bootmem_nopanic(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
104#define alloc_bootmem_low_pages(x) \ 108#define alloc_bootmem_low_pages(x) \
105 __alloc_bootmem_low(x, PAGE_SIZE, 0) 109 __alloc_bootmem_low(x, PAGE_SIZE, 0)
106#define alloc_bootmem_node(pgdat, x) \ 110#define alloc_bootmem_node(pgdat, x) \
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 82aa36c53ea7..eadaab44015f 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -115,7 +115,6 @@ BUFFER_FNS(Uptodate, uptodate)
115BUFFER_FNS(Dirty, dirty) 115BUFFER_FNS(Dirty, dirty)
116TAS_BUFFER_FNS(Dirty, dirty) 116TAS_BUFFER_FNS(Dirty, dirty)
117BUFFER_FNS(Lock, locked) 117BUFFER_FNS(Lock, locked)
118TAS_BUFFER_FNS(Lock, locked)
119BUFFER_FNS(Req, req) 118BUFFER_FNS(Req, req)
120TAS_BUFFER_FNS(Req, req) 119TAS_BUFFER_FNS(Req, req)
121BUFFER_FNS(Mapped, mapped) 120BUFFER_FNS(Mapped, mapped)
@@ -205,6 +204,8 @@ void block_invalidatepage(struct page *page, unsigned long offset);
205int block_write_full_page(struct page *page, get_block_t *get_block, 204int block_write_full_page(struct page *page, get_block_t *get_block,
206 struct writeback_control *wbc); 205 struct writeback_control *wbc);
207int block_read_full_page(struct page*, get_block_t*); 206int block_read_full_page(struct page*, get_block_t*);
207int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc,
208 unsigned long from);
208int block_write_begin(struct file *, struct address_space *, 209int block_write_begin(struct file *, struct address_space *,
209 loff_t, unsigned, unsigned, 210 loff_t, unsigned, unsigned,
210 struct page **, void **, get_block_t*); 211 struct page **, void **, get_block_t*);
@@ -319,10 +320,15 @@ static inline void wait_on_buffer(struct buffer_head *bh)
319 __wait_on_buffer(bh); 320 __wait_on_buffer(bh);
320} 321}
321 322
323static inline int trylock_buffer(struct buffer_head *bh)
324{
325 return likely(!test_and_set_bit(BH_Lock, &bh->b_state));
326}
327
322static inline void lock_buffer(struct buffer_head *bh) 328static inline void lock_buffer(struct buffer_head *bh)
323{ 329{
324 might_sleep(); 330 might_sleep();
325 if (test_set_buffer_locked(bh)) 331 if (!trylock_buffer(bh))
326 __lock_buffer(bh); 332 __lock_buffer(bh);
327} 333}
328 334
diff --git a/include/linux/byteorder.h b/include/linux/byteorder.h
new file mode 100644
index 000000000000..29f002d73d98
--- /dev/null
+++ b/include/linux/byteorder.h
@@ -0,0 +1,372 @@
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/capability.h b/include/linux/capability.h
index 02673846d205..9d1fe30b6f6c 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -503,8 +503,19 @@ extern const kernel_cap_t __cap_init_eff_set;
503 503
504kernel_cap_t cap_set_effective(const kernel_cap_t pE_new); 504kernel_cap_t cap_set_effective(const kernel_cap_t pE_new);
505 505
506int capable(int cap); 506/**
507int __capable(struct task_struct *t, int cap); 507 * has_capability - Determine if a task has a superior capability available
508 * @t: The task in question
509 * @cap: The capability to be tested for
510 *
511 * Return true if the specified task has the given superior capability
512 * currently in effect, false if not.
513 *
514 * Note that this does not set PF_SUPERPRIV on the task.
515 */
516#define has_capability(t, cap) (security_capable((t), (cap)) == 0)
517
518extern int capable(int cap);
508 519
509#endif /* __KERNEL__ */ 520#endif /* __KERNEL__ */
510 521
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index c33b0dc28e4d..ed3a5d473e52 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -127,6 +127,8 @@ extern int clockevents_register_notifier(struct notifier_block *nb);
127extern int clockevents_program_event(struct clock_event_device *dev, 127extern int clockevents_program_event(struct clock_event_device *dev,
128 ktime_t expires, ktime_t now); 128 ktime_t expires, ktime_t now);
129 129
130extern void clockevents_handle_noop(struct clock_event_device *dev);
131
130#ifdef CONFIG_GENERIC_CLOCKEVENTS 132#ifdef CONFIG_GENERIC_CLOCKEVENTS
131extern void clockevents_notify(unsigned long reason, void *arg); 133extern void clockevents_notify(unsigned long reason, void *arg);
132#else 134#else
diff --git a/include/linux/cnt32_to_63.h b/include/linux/cnt32_to_63.h
new file mode 100644
index 000000000000..8c0f9505b48c
--- /dev/null
+++ b/include/linux/cnt32_to_63.h
@@ -0,0 +1,80 @@
1/*
2 * Extend a 32-bit counter to 63 bits
3 *
4 * Author: Nicolas Pitre
5 * Created: December 3, 2006
6 * Copyright: MontaVista Software, Inc.
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
10 * as published by the Free Software Foundation.
11 */
12
13#ifndef __LINUX_CNT32_TO_63_H__
14#define __LINUX_CNT32_TO_63_H__
15
16#include <linux/compiler.h>
17#include <linux/types.h>
18#include <asm/byteorder.h>
19
20/* this is used only to give gcc a clue about good code generation */
21union cnt32_to_63 {
22 struct {
23#if defined(__LITTLE_ENDIAN)
24 u32 lo, hi;
25#elif defined(__BIG_ENDIAN)
26 u32 hi, lo;
27#endif
28 };
29 u64 val;
30};
31
32
33/**
34 * cnt32_to_63 - Expand a 32-bit counter to a 63-bit counter
35 * @cnt_lo: The low part of the counter
36 *
37 * Many hardware clock counters are only 32 bits wide and therefore have
38 * a relatively short period making wrap-arounds rather frequent. This
39 * is a problem when implementing sched_clock() for example, where a 64-bit
40 * non-wrapping monotonic value is expected to be returned.
41 *
42 * To overcome that limitation, let's extend a 32-bit counter to 63 bits
43 * in a completely lock free fashion. Bits 0 to 31 of the clock are provided
44 * by the hardware while bits 32 to 62 are stored in memory. The top bit in
45 * memory is used to synchronize with the hardware clock half-period. When
46 * the top bit of both counters (hardware and in memory) differ then the
47 * memory is updated with a new value, incrementing it when the hardware
48 * counter wraps around.
49 *
50 * Because a word store in memory is atomic then the incremented value will
51 * always be in synch with the top bit indicating to any potential concurrent
52 * reader if the value in memory is up to date or not with regards to the
53 * needed increment. And any race in updating the value in memory is harmless
54 * as the same value would simply be stored more than once.
55 *
56 * The only restriction for the algorithm to work properly is that this
57 * code must be executed at least once per each half period of the 32-bit
58 * counter to properly update the state bit in memory. This is usually not a
59 * problem in practice, but if it is then a kernel timer could be scheduled
60 * to manage for this code to be executed often enough.
61 *
62 * Note that the top bit (bit 63) in the returned value should be considered
63 * as garbage. It is not cleared here because callers are likely to use a
64 * multiplier on the returned value which can get rid of the top bit
65 * implicitly by making the multiplier even, therefore saving on a runtime
66 * clear-bit instruction. Otherwise caller must remember to clear the top
67 * bit explicitly.
68 */
69#define cnt32_to_63(cnt_lo) \
70({ \
71 static volatile u32 __m_cnt_hi; \
72 union cnt32_to_63 __x; \
73 __x.hi = __m_cnt_hi; \
74 __x.lo = (cnt_lo); \
75 if (unlikely((s32)(__x.hi ^ __x.lo) < 0)) \
76 __m_cnt_hi = __x.hi = (__x.hi ^ 0x80000000) + (__x.hi >> 31); \
77 __x.val; \
78})
79
80#endif
diff --git a/include/linux/coda_linux.h b/include/linux/coda_linux.h
index 31b75311e2ca..dcc228aa335a 100644
--- a/include/linux/coda_linux.h
+++ b/include/linux/coda_linux.h
@@ -37,7 +37,7 @@ extern const struct file_operations coda_ioctl_operations;
37/* operations shared over more than one file */ 37/* operations shared over more than one file */
38int coda_open(struct inode *i, struct file *f); 38int coda_open(struct inode *i, struct file *f);
39int coda_release(struct inode *i, struct file *f); 39int coda_release(struct inode *i, struct file *f);
40int coda_permission(struct inode *inode, int mask, struct nameidata *nd); 40int coda_permission(struct inode *inode, int mask);
41int coda_revalidate_inode(struct dentry *); 41int coda_revalidate_inode(struct dentry *);
42int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *); 42int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *);
43int coda_setattr(struct dentry *, struct iattr *); 43int coda_setattr(struct dentry *, struct iattr *);
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index c8bd2daf95ec..8322141ee480 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -190,7 +190,9 @@ extern void __chk_io_ptr(const volatile void __iomem *);
190 * ACCESS_ONCE() in different C statements. 190 * ACCESS_ONCE() in different C statements.
191 * 191 *
192 * This macro does absolutely -nothing- to prevent the CPU from reordering, 192 * This macro does absolutely -nothing- to prevent the CPU from reordering,
193 * merging, or refetching absolutely anything at any time. 193 * merging, or refetching absolutely anything at any time. Its main intended
194 * use is to mediate communication between process-level code and irq/NMI
195 * handlers, all running on the same CPU.
194 */ 196 */
195#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) 197#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
196 198
diff --git a/include/linux/completion.h b/include/linux/completion.h
index d2961b66d53d..4a6b604ef7e4 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -10,6 +10,18 @@
10 10
11#include <linux/wait.h> 11#include <linux/wait.h>
12 12
13/**
14 * struct completion - structure used to maintain state for a "completion"
15 *
16 * This is the opaque structure used to maintain the state for a "completion".
17 * Completions currently use a FIFO to queue threads that have to wait for
18 * the "completion" event.
19 *
20 * See also: complete(), wait_for_completion() (and friends _timeout,
21 * _interruptible, _interruptible_timeout, and _killable), init_completion(),
22 * and macros DECLARE_COMPLETION(), DECLARE_COMPLETION_ONSTACK(), and
23 * INIT_COMPLETION().
24 */
13struct completion { 25struct completion {
14 unsigned int done; 26 unsigned int done;
15 wait_queue_head_t wait; 27 wait_queue_head_t wait;
@@ -21,6 +33,14 @@ struct completion {
21#define COMPLETION_INITIALIZER_ONSTACK(work) \ 33#define COMPLETION_INITIALIZER_ONSTACK(work) \
22 ({ init_completion(&work); work; }) 34 ({ init_completion(&work); work; })
23 35
36/**
37 * DECLARE_COMPLETION: - declare and initialize a completion structure
38 * @work: identifier for the completion structure
39 *
40 * This macro declares and initializes a completion structure. Generally used
41 * for static declarations. You should use the _ONSTACK variant for automatic
42 * variables.
43 */
24#define DECLARE_COMPLETION(work) \ 44#define DECLARE_COMPLETION(work) \
25 struct completion work = COMPLETION_INITIALIZER(work) 45 struct completion work = COMPLETION_INITIALIZER(work)
26 46
@@ -29,6 +49,13 @@ struct completion {
29 * completions - so we use the _ONSTACK() variant for those that 49 * completions - so we use the _ONSTACK() variant for those that
30 * are on the kernel stack: 50 * are on the kernel stack:
31 */ 51 */
52/**
53 * DECLARE_COMPLETION_ONSTACK: - declare and initialize a completion structure
54 * @work: identifier for the completion structure
55 *
56 * This macro declares and initializes a completion structure on the kernel
57 * stack.
58 */
32#ifdef CONFIG_LOCKDEP 59#ifdef CONFIG_LOCKDEP
33# define DECLARE_COMPLETION_ONSTACK(work) \ 60# define DECLARE_COMPLETION_ONSTACK(work) \
34 struct completion work = COMPLETION_INITIALIZER_ONSTACK(work) 61 struct completion work = COMPLETION_INITIALIZER_ONSTACK(work)
@@ -36,6 +63,13 @@ struct completion {
36# define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work) 63# define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work)
37#endif 64#endif
38 65
66/**
67 * init_completion: - Initialize a dynamically allocated completion
68 * @x: completion structure that is to be initialized
69 *
70 * This inline function will initialize a dynamically created completion
71 * structure.
72 */
39static inline void init_completion(struct completion *x) 73static inline void init_completion(struct completion *x)
40{ 74{
41 x->done = 0; 75 x->done = 0;
@@ -49,10 +83,20 @@ extern unsigned long wait_for_completion_timeout(struct completion *x,
49 unsigned long timeout); 83 unsigned long timeout);
50extern unsigned long wait_for_completion_interruptible_timeout( 84extern unsigned long wait_for_completion_interruptible_timeout(
51 struct completion *x, unsigned long timeout); 85 struct completion *x, unsigned long timeout);
86extern bool try_wait_for_completion(struct completion *x);
87extern bool completion_done(struct completion *x);
52 88
53extern void complete(struct completion *); 89extern void complete(struct completion *);
54extern void complete_all(struct completion *); 90extern void complete_all(struct completion *);
55 91
92/**
93 * INIT_COMPLETION: - reinitialize a completion structure
94 * @x: completion structure to be reinitialized
95 *
96 * This macro should be used to reinitialize a completion structure so it can
97 * be reused. This is especially important after complete_all() is used.
98 */
56#define INIT_COMPLETION(x) ((x).done = 0) 99#define INIT_COMPLETION(x) ((x).done = 0)
57 100
101
58#endif 102#endif
diff --git a/include/linux/configfs.h b/include/linux/configfs.h
index d62c19ff041c..7f627775c947 100644
--- a/include/linux/configfs.h
+++ b/include/linux/configfs.h
@@ -40,6 +40,7 @@
40#include <linux/list.h> 40#include <linux/list.h>
41#include <linux/kref.h> 41#include <linux/kref.h>
42#include <linux/mutex.h> 42#include <linux/mutex.h>
43#include <linux/err.h>
43 44
44#include <asm/atomic.h> 45#include <asm/atomic.h>
45 46
@@ -129,8 +130,25 @@ struct configfs_attribute {
129/* 130/*
130 * Users often need to create attribute structures for their configurable 131 * Users often need to create attribute structures for their configurable
131 * attributes, containing a configfs_attribute member and function pointers 132 * attributes, containing a configfs_attribute member and function pointers
132 * for the show() and store() operations on that attribute. They can use 133 * for the show() and store() operations on that attribute. If they don't
133 * this macro (similar to sysfs' __ATTR) to make defining attributes easier. 134 * need anything else on the extended attribute structure, they can use
135 * this macro to define it The argument _item is the name of the
136 * config_item structure.
137 */
138#define CONFIGFS_ATTR_STRUCT(_item) \
139struct _item##_attribute { \
140 struct configfs_attribute attr; \
141 ssize_t (*show)(struct _item *, char *); \
142 ssize_t (*store)(struct _item *, const char *, size_t); \
143}
144
145/*
146 * With the extended attribute structure, users can use this macro
147 * (similar to sysfs' __ATTR) to make defining attributes easier.
148 * An example:
149 * #define MYITEM_ATTR(_name, _mode, _show, _store) \
150 * struct myitem_attribute childless_attr_##_name = \
151 * __CONFIGFS_ATTR(_name, _mode, _show, _store)
134 */ 152 */
135#define __CONFIGFS_ATTR(_name, _mode, _show, _store) \ 153#define __CONFIGFS_ATTR(_name, _mode, _show, _store) \
136{ \ 154{ \
@@ -142,6 +160,52 @@ struct configfs_attribute {
142 .show = _show, \ 160 .show = _show, \
143 .store = _store, \ 161 .store = _store, \
144} 162}
163/* Here is a readonly version, only requiring a show() operation */
164#define __CONFIGFS_ATTR_RO(_name, _show) \
165{ \
166 .attr = { \
167 .ca_name = __stringify(_name), \
168 .ca_mode = 0444, \
169 .ca_owner = THIS_MODULE, \
170 }, \
171 .show = _show, \
172}
173
174/*
175 * With these extended attributes, the simple show_attribute() and
176 * store_attribute() operations need to call the show() and store() of the
177 * attributes. This is a common pattern, so we provide a macro to define
178 * them. The argument _item is the name of the config_item structure.
179 * This macro expects the attributes to be named "struct <name>_attribute"
180 * and the function to_<name>() to exist;
181 */
182#define CONFIGFS_ATTR_OPS(_item) \
183static ssize_t _item##_attr_show(struct config_item *item, \
184 struct configfs_attribute *attr, \
185 char *page) \
186{ \
187 struct _item *_item = to_##_item(item); \
188 struct _item##_attribute *_item##_attr = \
189 container_of(attr, struct _item##_attribute, attr); \
190 ssize_t ret = 0; \
191 \
192 if (_item##_attr->show) \
193 ret = _item##_attr->show(_item, page); \
194 return ret; \
195} \
196static ssize_t _item##_attr_store(struct config_item *item, \
197 struct configfs_attribute *attr, \
198 const char *page, size_t count) \
199{ \
200 struct _item *_item = to_##_item(item); \
201 struct _item##_attribute *_item##_attr = \
202 container_of(attr, struct _item##_attribute, attr); \
203 ssize_t ret = -EINVAL; \
204 \
205 if (_item##_attr->store) \
206 ret = _item##_attr->store(_item, page, count); \
207 return ret; \
208}
145 209
146/* 210/*
147 * If allow_link() exists, the item can symlink(2) out to other 211 * If allow_link() exists, the item can symlink(2) out to other
diff --git a/include/linux/connector.h b/include/linux/connector.h
index 96a89d3d6727..5c7f9468f753 100644
--- a/include/linux/connector.h
+++ b/include/linux/connector.h
@@ -38,8 +38,9 @@
38#define CN_W1_VAL 0x1 38#define CN_W1_VAL 0x1
39#define CN_IDX_V86D 0x4 39#define CN_IDX_V86D 0x4
40#define CN_VAL_V86D_UVESAFB 0x1 40#define CN_VAL_V86D_UVESAFB 0x1
41#define CN_IDX_BB 0x5 /* BlackBoard, from the TSP GPL sampling framework */
41 42
42#define CN_NETLINK_USERS 5 43#define CN_NETLINK_USERS 6
43 44
44/* 45/*
45 * Maximum connector's message size. 46 * Maximum connector's message size.
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index d7faf8808497..c2747ac2ae43 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -69,6 +69,7 @@ static inline void unregister_cpu_notifier(struct notifier_block *nb)
69#endif 69#endif
70 70
71int cpu_up(unsigned int cpu); 71int cpu_up(unsigned int cpu);
72void notify_cpu_starting(unsigned int cpu);
72extern void cpu_hotplug_init(void); 73extern void cpu_hotplug_init(void);
73extern void cpu_maps_update_begin(void); 74extern void cpu_maps_update_begin(void);
74extern void cpu_maps_update_done(void); 75extern void cpu_maps_update_done(void);
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 2270ca5ec631..1ee608fd7b77 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -106,6 +106,7 @@ struct cpufreq_policy {
106#define CPUFREQ_ADJUST (0) 106#define CPUFREQ_ADJUST (0)
107#define CPUFREQ_INCOMPATIBLE (1) 107#define CPUFREQ_INCOMPATIBLE (1)
108#define CPUFREQ_NOTIFY (2) 108#define CPUFREQ_NOTIFY (2)
109#define CPUFREQ_START (3)
109 110
110#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */ 111#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */
111#define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */ 112#define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */
@@ -186,7 +187,8 @@ extern int __cpufreq_driver_target(struct cpufreq_policy *policy,
186 unsigned int relation); 187 unsigned int relation);
187 188
188 189
189extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy); 190extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy,
191 unsigned int cpu);
190 192
191int cpufreq_register_governor(struct cpufreq_governor *governor); 193int cpufreq_register_governor(struct cpufreq_governor *governor);
192void cpufreq_unregister_governor(struct cpufreq_governor *governor); 194void cpufreq_unregister_governor(struct cpufreq_governor *governor);
@@ -225,7 +227,9 @@ struct cpufreq_driver {
225 unsigned int (*get) (unsigned int cpu); 227 unsigned int (*get) (unsigned int cpu);
226 228
227 /* optional */ 229 /* optional */
228 unsigned int (*getavg) (unsigned int cpu); 230 unsigned int (*getavg) (struct cpufreq_policy *policy,
231 unsigned int cpu);
232
229 int (*exit) (struct cpufreq_policy *policy); 233 int (*exit) (struct cpufreq_policy *policy);
230 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); 234 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg);
231 int (*resume) (struct cpufreq_policy *policy); 235 int (*resume) (struct cpufreq_policy *policy);
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 1b5c98e7fef7..d3219d73f8e6 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -62,15 +62,7 @@
62 * int next_cpu_nr(cpu, mask) Next cpu past 'cpu', or nr_cpu_ids 62 * int next_cpu_nr(cpu, mask) Next cpu past 'cpu', or nr_cpu_ids
63 * 63 *
64 * cpumask_t cpumask_of_cpu(cpu) Return cpumask with bit 'cpu' set 64 * cpumask_t cpumask_of_cpu(cpu) Return cpumask with bit 'cpu' set
65 *ifdef CONFIG_HAS_CPUMASK_OF_CPU 65 * (can be used as an lvalue)
66 * cpumask_of_cpu_ptr_declare(v) Declares cpumask_t *v
67 * cpumask_of_cpu_ptr_next(v, cpu) Sets v = &cpumask_of_cpu_map[cpu]
68 * cpumask_of_cpu_ptr(v, cpu) Combines above two operations
69 *else
70 * cpumask_of_cpu_ptr_declare(v) Declares cpumask_t _v and *v = &_v
71 * cpumask_of_cpu_ptr_next(v, cpu) Sets _v = cpumask_of_cpu(cpu)
72 * cpumask_of_cpu_ptr(v, cpu) Combines above two operations
73 *endif
74 * CPU_MASK_ALL Initializer - all bits set 66 * CPU_MASK_ALL Initializer - all bits set
75 * CPU_MASK_NONE Initializer - no bits set 67 * CPU_MASK_NONE Initializer - no bits set
76 * unsigned long *cpus_addr(mask) Array of unsigned long's in mask 68 * unsigned long *cpus_addr(mask) Array of unsigned long's in mask
@@ -273,37 +265,30 @@ static inline void __cpus_shift_left(cpumask_t *dstp,
273 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits); 265 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
274} 266}
275 267
268/*
269 * Special-case data structure for "single bit set only" constant CPU masks.
270 *
271 * We pre-generate all the 64 (or 32) possible bit positions, with enough
272 * padding to the left and the right, and return the constant pointer
273 * appropriately offset.
274 */
275extern const unsigned long
276 cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)];
277
278static inline const cpumask_t *get_cpu_mask(unsigned int cpu)
279{
280 const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG];
281 p -= cpu / BITS_PER_LONG;
282 return (const cpumask_t *)p;
283}
284
285/*
286 * In cases where we take the address of the cpumask immediately,
287 * gcc optimizes it out (it's a constant) and there's no huge stack
288 * variable created:
289 */
290#define cpumask_of_cpu(cpu) (*get_cpu_mask(cpu))
276 291
277#ifdef CONFIG_HAVE_CPUMASK_OF_CPU_MAP
278extern cpumask_t *cpumask_of_cpu_map;
279#define cpumask_of_cpu(cpu) (cpumask_of_cpu_map[cpu])
280#define cpumask_of_cpu_ptr(v, cpu) \
281 const cpumask_t *v = &cpumask_of_cpu(cpu)
282#define cpumask_of_cpu_ptr_declare(v) \
283 const cpumask_t *v
284#define cpumask_of_cpu_ptr_next(v, cpu) \
285 v = &cpumask_of_cpu(cpu)
286#else
287#define cpumask_of_cpu(cpu) \
288({ \
289 typeof(_unused_cpumask_arg_) m; \
290 if (sizeof(m) == sizeof(unsigned long)) { \
291 m.bits[0] = 1UL<<(cpu); \
292 } else { \
293 cpus_clear(m); \
294 cpu_set((cpu), m); \
295 } \
296 m; \
297})
298#define cpumask_of_cpu_ptr(v, cpu) \
299 cpumask_t _##v = cpumask_of_cpu(cpu); \
300 const cpumask_t *v = &_##v
301#define cpumask_of_cpu_ptr_declare(v) \
302 cpumask_t _##v; \
303 const cpumask_t *v = &_##v
304#define cpumask_of_cpu_ptr_next(v, cpu) \
305 _##v = cpumask_of_cpu(cpu)
306#endif
307 292
308#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS) 293#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
309 294
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index e8f450c499b0..2691926fb506 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -160,7 +160,7 @@ static inline int current_cpuset_is_being_rebound(void)
160 160
161static inline void rebuild_sched_domains(void) 161static inline void rebuild_sched_domains(void)
162{ 162{
163 partition_sched_domains(0, NULL, NULL); 163 partition_sched_domains(1, NULL, NULL);
164} 164}
165 165
166#endif /* !CONFIG_CPUSETS */ 166#endif /* !CONFIG_CPUSETS */
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index 6cd39a927e1f..025e4f575103 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -8,7 +8,13 @@
8#include <linux/proc_fs.h> 8#include <linux/proc_fs.h>
9 9
10#define ELFCORE_ADDR_MAX (-1ULL) 10#define ELFCORE_ADDR_MAX (-1ULL)
11
12#ifdef CONFIG_PROC_VMCORE
11extern unsigned long long elfcorehdr_addr; 13extern unsigned long long elfcorehdr_addr;
14#else
15static const unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
16#endif
17
12extern ssize_t copy_oldmem_page(unsigned long, char *, size_t, 18extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
13 unsigned long, int); 19 unsigned long, int);
14extern const struct file_operations proc_vmcore_operations; 20extern const struct file_operations proc_vmcore_operations;
diff --git a/include/linux/cred.h b/include/linux/cred.h
new file mode 100644
index 000000000000..b69222cc1fd2
--- /dev/null
+++ b/include/linux/cred.h
@@ -0,0 +1,50 @@
1/* Credentials management
2 *
3 * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11
12#ifndef _LINUX_CRED_H
13#define _LINUX_CRED_H
14
15#define get_current_user() (get_uid(current->user))
16
17#define task_uid(task) ((task)->uid)
18#define task_gid(task) ((task)->gid)
19#define task_euid(task) ((task)->euid)
20#define task_egid(task) ((task)->egid)
21
22#define current_uid() (current->uid)
23#define current_gid() (current->gid)
24#define current_euid() (current->euid)
25#define current_egid() (current->egid)
26#define current_suid() (current->suid)
27#define current_sgid() (current->sgid)
28#define current_fsuid() (current->fsuid)
29#define current_fsgid() (current->fsgid)
30#define current_cap() (current->cap_effective)
31
32#define current_uid_gid(_uid, _gid) \
33do { \
34 *(_uid) = current->uid; \
35 *(_gid) = current->gid; \
36} while(0)
37
38#define current_euid_egid(_uid, _gid) \
39do { \
40 *(_uid) = current->euid; \
41 *(_gid) = current->egid; \
42} while(0)
43
44#define current_fsuid_fsgid(_uid, _gid) \
45do { \
46 *(_uid) = current->fsuid; \
47 *(_gid) = current->fsgid; \
48} while(0)
49
50#endif /* _LINUX_CRED_H */
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index c43dc47fdf75..3d2317e4af2e 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -38,6 +38,7 @@
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 0x00000009
40#define CRYPTO_ALG_TYPE_AHASH 0x0000000a 40#define CRYPTO_ALG_TYPE_AHASH 0x0000000a
41#define CRYPTO_ALG_TYPE_RNG 0x0000000c
41 42
42#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e 43#define CRYPTO_ALG_TYPE_HASH_MASK 0x0000000e
43#define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000c 44#define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000c
@@ -61,6 +62,14 @@
61#define CRYPTO_ALG_GENIV 0x00000200 62#define CRYPTO_ALG_GENIV 0x00000200
62 63
63/* 64/*
65 * Set if the algorithm has passed automated run-time testing. Note that
66 * if there is no run-time testing for a given algorithm it is considered
67 * to have passed.
68 */
69
70#define CRYPTO_ALG_TESTED 0x00000400
71
72/*
64 * Transform masks and values (for crt_flags). 73 * Transform masks and values (for crt_flags).
65 */ 74 */
66#define CRYPTO_TFM_REQ_MASK 0x000fff00 75#define CRYPTO_TFM_REQ_MASK 0x000fff00
@@ -105,6 +114,7 @@ struct crypto_aead;
105struct crypto_blkcipher; 114struct crypto_blkcipher;
106struct crypto_hash; 115struct crypto_hash;
107struct crypto_ahash; 116struct crypto_ahash;
117struct crypto_rng;
108struct crypto_tfm; 118struct crypto_tfm;
109struct crypto_type; 119struct crypto_type;
110struct aead_givcrypt_request; 120struct aead_givcrypt_request;
@@ -290,6 +300,15 @@ struct compress_alg {
290 unsigned int slen, u8 *dst, unsigned int *dlen); 300 unsigned int slen, u8 *dst, unsigned int *dlen);
291}; 301};
292 302
303struct rng_alg {
304 int (*rng_make_random)(struct crypto_rng *tfm, u8 *rdata,
305 unsigned int dlen);
306 int (*rng_reset)(struct crypto_rng *tfm, u8 *seed, unsigned int slen);
307
308 unsigned int seedsize;
309};
310
311
293#define cra_ablkcipher cra_u.ablkcipher 312#define cra_ablkcipher cra_u.ablkcipher
294#define cra_aead cra_u.aead 313#define cra_aead cra_u.aead
295#define cra_blkcipher cra_u.blkcipher 314#define cra_blkcipher cra_u.blkcipher
@@ -298,6 +317,7 @@ struct compress_alg {
298#define cra_hash cra_u.hash 317#define cra_hash cra_u.hash
299#define cra_ahash cra_u.ahash 318#define cra_ahash cra_u.ahash
300#define cra_compress cra_u.compress 319#define cra_compress cra_u.compress
320#define cra_rng cra_u.rng
301 321
302struct crypto_alg { 322struct crypto_alg {
303 struct list_head cra_list; 323 struct list_head cra_list;
@@ -325,6 +345,7 @@ struct crypto_alg {
325 struct hash_alg hash; 345 struct hash_alg hash;
326 struct ahash_alg ahash; 346 struct ahash_alg ahash;
327 struct compress_alg compress; 347 struct compress_alg compress;
348 struct rng_alg rng;
328 } cra_u; 349 } cra_u;
329 350
330 int (*cra_init)(struct crypto_tfm *tfm); 351 int (*cra_init)(struct crypto_tfm *tfm);
@@ -430,6 +451,12 @@ struct compress_tfm {
430 u8 *dst, unsigned int *dlen); 451 u8 *dst, unsigned int *dlen);
431}; 452};
432 453
454struct rng_tfm {
455 int (*rng_gen_random)(struct crypto_rng *tfm, u8 *rdata,
456 unsigned int dlen);
457 int (*rng_reset)(struct crypto_rng *tfm, u8 *seed, unsigned int slen);
458};
459
433#define crt_ablkcipher crt_u.ablkcipher 460#define crt_ablkcipher crt_u.ablkcipher
434#define crt_aead crt_u.aead 461#define crt_aead crt_u.aead
435#define crt_blkcipher crt_u.blkcipher 462#define crt_blkcipher crt_u.blkcipher
@@ -437,6 +464,7 @@ struct compress_tfm {
437#define crt_hash crt_u.hash 464#define crt_hash crt_u.hash
438#define crt_ahash crt_u.ahash 465#define crt_ahash crt_u.ahash
439#define crt_compress crt_u.compress 466#define crt_compress crt_u.compress
467#define crt_rng crt_u.rng
440 468
441struct crypto_tfm { 469struct crypto_tfm {
442 470
@@ -450,6 +478,7 @@ struct crypto_tfm {
450 struct hash_tfm hash; 478 struct hash_tfm hash;
451 struct ahash_tfm ahash; 479 struct ahash_tfm ahash;
452 struct compress_tfm compress; 480 struct compress_tfm compress;
481 struct rng_tfm rng;
453 } crt_u; 482 } crt_u;
454 483
455 struct crypto_alg *__crt_alg; 484 struct crypto_alg *__crt_alg;
@@ -481,6 +510,10 @@ struct crypto_hash {
481 struct crypto_tfm base; 510 struct crypto_tfm base;
482}; 511};
483 512
513struct crypto_rng {
514 struct crypto_tfm base;
515};
516
484enum { 517enum {
485 CRYPTOA_UNSPEC, 518 CRYPTOA_UNSPEC,
486 CRYPTOA_ALG, 519 CRYPTOA_ALG,
@@ -515,6 +548,8 @@ struct crypto_tfm *crypto_alloc_tfm(const char *alg_name, u32 tfm_flags);
515struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask); 548struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask);
516void crypto_free_tfm(struct crypto_tfm *tfm); 549void crypto_free_tfm(struct crypto_tfm *tfm);
517 550
551int alg_test(const char *driver, const char *alg, u32 type, u32 mask);
552
518/* 553/*
519 * Transform helpers which query the underlying algorithm. 554 * Transform helpers which query the underlying algorithm.
520 */ 555 */
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 98202c672fde..efba1de629ac 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -230,6 +230,7 @@ extern void d_delete(struct dentry *);
230extern struct dentry * d_alloc(struct dentry *, const struct qstr *); 230extern struct dentry * d_alloc(struct dentry *, const struct qstr *);
231extern struct dentry * d_alloc_anon(struct inode *); 231extern struct dentry * d_alloc_anon(struct inode *);
232extern struct dentry * d_splice_alias(struct inode *, struct dentry *); 232extern struct dentry * d_splice_alias(struct inode *, struct dentry *);
233extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *);
233extern void shrink_dcache_sb(struct super_block *); 234extern void shrink_dcache_sb(struct super_block *);
234extern void shrink_dcache_parent(struct dentry *); 235extern void shrink_dcache_parent(struct dentry *);
235extern void shrink_dcache_for_umount(struct super_block *); 236extern void shrink_dcache_for_umount(struct super_block *);
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index a90222e3297d..08d783592b73 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -13,7 +13,6 @@
13 13
14struct dm_target; 14struct dm_target;
15struct dm_table; 15struct dm_table;
16struct dm_dev;
17struct mapped_device; 16struct mapped_device;
18struct bio_vec; 17struct bio_vec;
19 18
@@ -84,6 +83,12 @@ void dm_error(const char *message);
84 */ 83 */
85void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev); 84void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev);
86 85
86struct dm_dev {
87 struct block_device *bdev;
88 int mode;
89 char name[16];
90};
91
87/* 92/*
88 * Constructors should call these functions to ensure destination devices 93 * Constructors should call these functions to ensure destination devices
89 * are opened/closed correctly. 94 * are opened/closed correctly.
@@ -202,6 +207,7 @@ int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid);
202struct gendisk *dm_disk(struct mapped_device *md); 207struct gendisk *dm_disk(struct mapped_device *md);
203int dm_suspended(struct mapped_device *md); 208int dm_suspended(struct mapped_device *md);
204int dm_noflush_suspending(struct dm_target *ti); 209int dm_noflush_suspending(struct dm_target *ti);
210union map_info *dm_get_mapinfo(struct bio *bio);
205 211
206/* 212/*
207 * Geometry functions. 213 * Geometry functions.
@@ -232,6 +238,11 @@ int dm_table_add_target(struct dm_table *t, const char *type,
232int dm_table_complete(struct dm_table *t); 238int dm_table_complete(struct dm_table *t);
233 239
234/* 240/*
241 * Unplug all devices in a table.
242 */
243void dm_table_unplug_all(struct dm_table *t);
244
245/*
235 * Table reference counting. 246 * Table reference counting.
236 */ 247 */
237struct dm_table *dm_get_table(struct mapped_device *md); 248struct dm_table *dm_get_table(struct mapped_device *md);
@@ -256,6 +267,11 @@ void dm_table_event(struct dm_table *t);
256 */ 267 */
257int dm_swap_table(struct mapped_device *md, struct dm_table *t); 268int dm_swap_table(struct mapped_device *md, struct dm_table *t);
258 269
270/*
271 * A wrapper around vmalloc.
272 */
273void *dm_vcalloc(unsigned long nmemb, unsigned long elem_size);
274
259/*----------------------------------------------------------------- 275/*-----------------------------------------------------------------
260 * Macros. 276 * Macros.
261 *---------------------------------------------------------------*/ 277 *---------------------------------------------------------------*/
diff --git a/include/linux/device.h b/include/linux/device.h
index d24a47f80f9c..246937c9cbc7 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -199,6 +199,11 @@ struct class {
199 struct class_private *p; 199 struct class_private *p;
200}; 200};
201 201
202struct class_dev_iter {
203 struct klist_iter ki;
204 const struct device_type *type;
205};
206
202extern struct kobject *sysfs_dev_block_kobj; 207extern struct kobject *sysfs_dev_block_kobj;
203extern struct kobject *sysfs_dev_char_kobj; 208extern struct kobject *sysfs_dev_char_kobj;
204extern int __must_check __class_register(struct class *class, 209extern int __must_check __class_register(struct class *class,
@@ -213,6 +218,13 @@ extern void class_unregister(struct class *class);
213 __class_register(class, &__key); \ 218 __class_register(class, &__key); \
214}) 219})
215 220
221extern void class_dev_iter_init(struct class_dev_iter *iter,
222 struct class *class,
223 struct device *start,
224 const struct device_type *type);
225extern struct device *class_dev_iter_next(struct class_dev_iter *iter);
226extern void class_dev_iter_exit(struct class_dev_iter *iter);
227
216extern int class_for_each_device(struct class *class, struct device *start, 228extern int class_for_each_device(struct class *class, struct device *start,
217 void *data, 229 void *data,
218 int (*fn)(struct device *dev, void *data)); 230 int (*fn)(struct device *dev, void *data));
@@ -358,6 +370,7 @@ struct device {
358 370
359 struct kobject kobj; 371 struct kobject kobj;
360 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 372 char bus_id[BUS_ID_SIZE]; /* position on parent bus */
373 const char *init_name; /* initial name of the device */
361 struct device_type *type; 374 struct device_type *type;
362 unsigned uevent_suppress:1; 375 unsigned uevent_suppress:1;
363 376
@@ -395,7 +408,7 @@ struct device {
395 spinlock_t devres_lock; 408 spinlock_t devres_lock;
396 struct list_head devres_head; 409 struct list_head devres_head;
397 410
398 struct list_head node; 411 struct klist_node knode_class;
399 struct class *class; 412 struct class *class;
400 dev_t devt; /* dev_t, creates the sysfs "dev" */ 413 dev_t devt; /* dev_t, creates the sysfs "dev" */
401 struct attribute_group **groups; /* optional groups */ 414 struct attribute_group **groups; /* optional groups */
@@ -406,7 +419,7 @@ struct device {
406/* Get the wakeup routines, which depend on struct device */ 419/* Get the wakeup routines, which depend on struct device */
407#include <linux/pm_wakeup.h> 420#include <linux/pm_wakeup.h>
408 421
409static inline const char *dev_name(struct device *dev) 422static inline const char *dev_name(const struct device *dev)
410{ 423{
411 /* will be changed into kobject_name(&dev->kobj) in the near future */ 424 /* will be changed into kobject_name(&dev->kobj) in the near future */
412 return dev->bus_id; 425 return dev->bus_id;
@@ -518,7 +531,7 @@ extern void device_shutdown(void);
518extern void sysdev_shutdown(void); 531extern void sysdev_shutdown(void);
519 532
520/* debugging and troubleshooting/diagnostic helpers. */ 533/* debugging and troubleshooting/diagnostic helpers. */
521extern const char *dev_driver_string(struct device *dev); 534extern const char *dev_driver_string(const struct device *dev);
522#define dev_printk(level, dev, format, arg...) \ 535#define dev_printk(level, dev, format, arg...) \
523 printk(level "%s %s: " format , dev_driver_string(dev) , \ 536 printk(level "%s %s: " format , dev_driver_string(dev) , \
524 dev_name(dev) , ## arg) 537 dev_name(dev) , ## arg)
diff --git a/include/linux/dlm.h b/include/linux/dlm.h
index 203a025e30e5..b9cd38603fd8 100644
--- a/include/linux/dlm.h
+++ b/include/linux/dlm.h
@@ -2,7 +2,7 @@
2******************************************************************************* 2*******************************************************************************
3** 3**
4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
5** Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. 5** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
6** 6**
7** This copyrighted material is made available to anyone wishing to use, 7** This copyrighted material is made available to anyone wishing to use,
8** modify, copy, or redistribute it subject to the terms and conditions 8** modify, copy, or redistribute it subject to the terms and conditions
@@ -65,9 +65,12 @@ struct dlm_lksb {
65 char * sb_lvbptr; 65 char * sb_lvbptr;
66}; 66};
67 67
68/* dlm_new_lockspace() flags */
69
68#define DLM_LSFL_NODIR 0x00000001 70#define DLM_LSFL_NODIR 0x00000001
69#define DLM_LSFL_TIMEWARN 0x00000002 71#define DLM_LSFL_TIMEWARN 0x00000002
70#define DLM_LSFL_FS 0x00000004 72#define DLM_LSFL_FS 0x00000004
73#define DLM_LSFL_NEWEXCL 0x00000008
71 74
72#ifdef __KERNEL__ 75#ifdef __KERNEL__
73 76
diff --git a/include/linux/dlm_device.h b/include/linux/dlm_device.h
index c6034508fed9..3060783c4191 100644
--- a/include/linux/dlm_device.h
+++ b/include/linux/dlm_device.h
@@ -26,7 +26,7 @@
26/* Version of the device interface */ 26/* Version of the device interface */
27#define DLM_DEVICE_VERSION_MAJOR 6 27#define DLM_DEVICE_VERSION_MAJOR 6
28#define DLM_DEVICE_VERSION_MINOR 0 28#define DLM_DEVICE_VERSION_MINOR 0
29#define DLM_DEVICE_VERSION_PATCH 0 29#define DLM_DEVICE_VERSION_PATCH 1
30 30
31/* struct passed to the lock write */ 31/* struct passed to the lock write */
32struct dlm_lock_params { 32struct dlm_lock_params {
diff --git a/include/linux/dm9000.h b/include/linux/dm9000.h
index fc82446b6425..c30879cf93bc 100644
--- a/include/linux/dm9000.h
+++ b/include/linux/dm9000.h
@@ -27,6 +27,7 @@
27 27
28struct dm9000_plat_data { 28struct dm9000_plat_data {
29 unsigned int flags; 29 unsigned int flags;
30 unsigned char dev_addr[6];
30 31
31 /* allow replacement IO routines */ 32 /* allow replacement IO routines */
32 33
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 952e0f857ac9..ba9114ec5d3a 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -48,6 +48,11 @@ static inline int is_device_dma_capable(struct device *dev)
48 return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE; 48 return dev->dma_mask != NULL && *dev->dma_mask != DMA_MASK_NONE;
49} 49}
50 50
51static inline int is_buffer_dma_capable(u64 mask, dma_addr_t addr, size_t size)
52{
53 return addr + size <= mask;
54}
55
51#ifdef CONFIG_HAS_DMA 56#ifdef CONFIG_HAS_DMA
52#include <asm/dma-mapping.h> 57#include <asm/dma-mapping.h>
53#else 58#else
@@ -58,6 +63,13 @@ static inline int is_device_dma_capable(struct device *dev)
58#define dma_sync_single dma_sync_single_for_cpu 63#define dma_sync_single dma_sync_single_for_cpu
59#define dma_sync_sg dma_sync_sg_for_cpu 64#define dma_sync_sg dma_sync_sg_for_cpu
60 65
66static inline u64 dma_get_mask(struct device *dev)
67{
68 if (dev && dev->dma_mask && *dev->dma_mask)
69 return *dev->dma_mask;
70 return DMA_32BIT_MASK;
71}
72
61extern u64 dma_get_required_mask(struct device *dev); 73extern u64 dma_get_required_mask(struct device *dev);
62 74
63static inline unsigned int dma_get_max_seg_size(struct device *dev) 75static inline unsigned int dma_get_max_seg_size(struct device *dev)
diff --git a/include/linux/dmar.h b/include/linux/dmar.h
index 56c73b847551..c360c558e59e 100644
--- a/include/linux/dmar.h
+++ b/include/linux/dmar.h
@@ -25,9 +25,99 @@
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/msi.h> 26#include <linux/msi.h>
27 27
28#ifdef CONFIG_DMAR 28#if defined(CONFIG_DMAR) || defined(CONFIG_INTR_REMAP)
29struct intel_iommu; 29struct intel_iommu;
30 30
31struct dmar_drhd_unit {
32 struct list_head list; /* list of drhd units */
33 struct acpi_dmar_header *hdr; /* ACPI header */
34 u64 reg_base_addr; /* register base address*/
35 struct pci_dev **devices; /* target device array */
36 int devices_cnt; /* target device count */
37 u8 ignored:1; /* ignore drhd */
38 u8 include_all:1;
39 struct intel_iommu *iommu;
40};
41
42extern struct list_head dmar_drhd_units;
43
44#define for_each_drhd_unit(drhd) \
45 list_for_each_entry(drhd, &dmar_drhd_units, list)
46
47extern int dmar_table_init(void);
48extern int early_dmar_detect(void);
49extern int dmar_dev_scope_init(void);
50
51/* Intel IOMMU detection */
52extern void detect_intel_iommu(void);
53
54
55extern int parse_ioapics_under_ir(void);
56extern int alloc_iommu(struct dmar_drhd_unit *);
57#else
58static inline void detect_intel_iommu(void)
59{
60 return;
61}
62
63static inline int dmar_table_init(void)
64{
65 return -ENODEV;
66}
67#endif /* !CONFIG_DMAR && !CONFIG_INTR_REMAP */
68
69#ifdef CONFIG_INTR_REMAP
70extern int intr_remapping_enabled;
71extern int enable_intr_remapping(int);
72
73struct irte {
74 union {
75 struct {
76 __u64 present : 1,
77 fpd : 1,
78 dst_mode : 1,
79 redir_hint : 1,
80 trigger_mode : 1,
81 dlvry_mode : 3,
82 avail : 4,
83 __reserved_1 : 4,
84 vector : 8,
85 __reserved_2 : 8,
86 dest_id : 32;
87 };
88 __u64 low;
89 };
90
91 union {
92 struct {
93 __u64 sid : 16,
94 sq : 2,
95 svt : 2,
96 __reserved_3 : 44;
97 };
98 __u64 high;
99 };
100};
101extern int get_irte(int irq, struct irte *entry);
102extern int modify_irte(int irq, struct irte *irte_modified);
103extern int alloc_irte(struct intel_iommu *iommu, int irq, u16 count);
104extern int set_irte_irq(int irq, struct intel_iommu *iommu, u16 index,
105 u16 sub_handle);
106extern int map_irq_to_irte_handle(int irq, u16 *sub_handle);
107extern int clear_irte_irq(int irq, struct intel_iommu *iommu, u16 index);
108extern int flush_irte(int irq);
109extern int free_irte(int irq);
110
111extern int irq_remapped(int irq);
112extern struct intel_iommu *map_dev_to_ir(struct pci_dev *dev);
113extern struct intel_iommu *map_ioapic_to_ir(int apic);
114#else
115#define irq_remapped(irq) (0)
116#define enable_intr_remapping(mode) (-1)
117#define intr_remapping_enabled (0)
118#endif
119
120#ifdef CONFIG_DMAR
31extern const char *dmar_get_fault_reason(u8 fault_reason); 121extern const char *dmar_get_fault_reason(u8 fault_reason);
32 122
33/* Can't use the common MSI interrupt functions 123/* Can't use the common MSI interrupt functions
@@ -40,47 +130,30 @@ extern void dmar_msi_write(int irq, struct msi_msg *msg);
40extern int dmar_set_interrupt(struct intel_iommu *iommu); 130extern int dmar_set_interrupt(struct intel_iommu *iommu);
41extern int arch_setup_dmar_msi(unsigned int irq); 131extern int arch_setup_dmar_msi(unsigned int irq);
42 132
43/* Intel IOMMU detection and initialization functions */ 133extern int iommu_detected, no_iommu;
44extern void detect_intel_iommu(void);
45extern int intel_iommu_init(void);
46
47extern int dmar_table_init(void);
48extern int early_dmar_detect(void);
49
50extern struct list_head dmar_drhd_units;
51extern struct list_head dmar_rmrr_units; 134extern struct list_head dmar_rmrr_units;
52
53struct dmar_drhd_unit {
54 struct list_head list; /* list of drhd units */
55 u64 reg_base_addr; /* register base address*/
56 struct pci_dev **devices; /* target device array */
57 int devices_cnt; /* target device count */
58 u8 ignored:1; /* ignore drhd */
59 u8 include_all:1;
60 struct intel_iommu *iommu;
61};
62
63struct dmar_rmrr_unit { 135struct dmar_rmrr_unit {
64 struct list_head list; /* list of rmrr units */ 136 struct list_head list; /* list of rmrr units */
137 struct acpi_dmar_header *hdr; /* ACPI header */
65 u64 base_address; /* reserved base address*/ 138 u64 base_address; /* reserved base address*/
66 u64 end_address; /* reserved end address */ 139 u64 end_address; /* reserved end address */
67 struct pci_dev **devices; /* target devices */ 140 struct pci_dev **devices; /* target devices */
68 int devices_cnt; /* target device count */ 141 int devices_cnt; /* target device count */
69}; 142};
70 143
71#define for_each_drhd_unit(drhd) \
72 list_for_each_entry(drhd, &dmar_drhd_units, list)
73#define for_each_rmrr_units(rmrr) \ 144#define for_each_rmrr_units(rmrr) \
74 list_for_each_entry(rmrr, &dmar_rmrr_units, list) 145 list_for_each_entry(rmrr, &dmar_rmrr_units, list)
146/* Intel DMAR initialization functions */
147extern int intel_iommu_init(void);
148extern int dmar_disabled;
75#else 149#else
76static inline void detect_intel_iommu(void)
77{
78 return;
79}
80static inline int intel_iommu_init(void) 150static inline int intel_iommu_init(void)
81{ 151{
152#ifdef CONFIG_INTR_REMAP
153 return dmar_dev_scope_init();
154#else
82 return -ENODEV; 155 return -ENODEV;
156#endif
83} 157}
84
85#endif /* !CONFIG_DMAR */ 158#endif /* !CONFIG_DMAR */
86#endif /* __DMAR_H__ */ 159#endif /* __DMAR_H__ */
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 639624b55fbe..92f6f634e3e6 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -112,6 +112,7 @@ extern struct request *elv_latter_request(struct request_queue *, struct request
112extern int elv_register_queue(struct request_queue *q); 112extern int elv_register_queue(struct request_queue *q);
113extern void elv_unregister_queue(struct request_queue *q); 113extern void elv_unregister_queue(struct request_queue *q);
114extern int elv_may_queue(struct request_queue *, int); 114extern int elv_may_queue(struct request_queue *, int);
115extern void elv_abort_queue(struct request_queue *);
115extern void elv_completed_request(struct request_queue *, struct request *); 116extern void elv_completed_request(struct request_queue *, struct request *);
116extern int elv_set_request(struct request_queue *, struct request *, gfp_t); 117extern int elv_set_request(struct request_queue *, struct request *, gfp_t);
117extern void elv_put_request(struct request_queue *, struct request *); 118extern void elv_put_request(struct request_queue *, struct request *);
@@ -173,15 +174,15 @@ enum {
173#define rb_entry_rq(node) rb_entry((node), struct request, rb_node) 174#define rb_entry_rq(node) rb_entry((node), struct request, rb_node)
174 175
175/* 176/*
176 * Hack to reuse the donelist list_head as the fifo time holder while 177 * Hack to reuse the csd.list list_head as the fifo time holder while
177 * the request is in the io scheduler. Saves an unsigned long in rq. 178 * the request is in the io scheduler. Saves an unsigned long in rq.
178 */ 179 */
179#define rq_fifo_time(rq) ((unsigned long) (rq)->donelist.next) 180#define rq_fifo_time(rq) ((unsigned long) (rq)->csd.list.next)
180#define rq_set_fifo_time(rq,exp) ((rq)->donelist.next = (void *) (exp)) 181#define rq_set_fifo_time(rq,exp) ((rq)->csd.list.next = (void *) (exp))
181#define rq_entry_fifo(ptr) list_entry((ptr), struct request, queuelist) 182#define rq_entry_fifo(ptr) list_entry((ptr), struct request, queuelist)
182#define rq_fifo_clear(rq) do { \ 183#define rq_fifo_clear(rq) do { \
183 list_del_init(&(rq)->queuelist); \ 184 list_del_init(&(rq)->queuelist); \
184 INIT_LIST_HEAD(&(rq)->donelist); \ 185 INIT_LIST_HEAD(&(rq)->csd.list); \
185 } while (0) 186 } while (0)
186 187
187/* 188/*
diff --git a/include/linux/elf.h b/include/linux/elf.h
index edc3dac3f02f..0b61ca41a044 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -360,6 +360,7 @@ typedef struct elf64_shdr {
360#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ 360#define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */
361#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ 361#define NT_PPC_VSX 0x102 /* PowerPC VSX registers */
362#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ 362#define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */
363#define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */
363 364
364 365
365/* Note header in a PT_NOTE section */ 366/* Note header in a PT_NOTE section */
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 8bb5e87df365..b4b038b89ee6 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -27,9 +27,24 @@ struct ethtool_cmd {
27 __u8 autoneg; /* Enable or disable autonegotiation */ 27 __u8 autoneg; /* Enable or disable autonegotiation */
28 __u32 maxtxpkt; /* Tx pkts before generating tx int */ 28 __u32 maxtxpkt; /* Tx pkts before generating tx int */
29 __u32 maxrxpkt; /* Rx pkts before generating rx int */ 29 __u32 maxrxpkt; /* Rx pkts before generating rx int */
30 __u32 reserved[4]; 30 __u16 speed_hi;
31 __u16 reserved2;
32 __u32 reserved[3];
31}; 33};
32 34
35static inline void ethtool_cmd_speed_set(struct ethtool_cmd *ep,
36 __u32 speed)
37{
38
39 ep->speed = (__u16)speed;
40 ep->speed_hi = (__u16)(speed >> 16);
41}
42
43static inline __u32 ethtool_cmd_speed(struct ethtool_cmd *ep)
44{
45 return (ep->speed_hi << 16) | ep->speed;
46}
47
33#define ETHTOOL_BUSINFO_LEN 32 48#define ETHTOOL_BUSINFO_LEN 32
34/* these strings are set to whatever the driver author decides... */ 49/* these strings are set to whatever the driver author decides... */
35struct ethtool_drvinfo { 50struct ethtool_drvinfo {
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h
index f5abd1306638..27e772cefb6a 100644
--- a/include/linux/exportfs.h
+++ b/include/linux/exportfs.h
@@ -35,6 +35,27 @@ enum fid_type {
35 FILEID_INO32_GEN_PARENT = 2, 35 FILEID_INO32_GEN_PARENT = 2,
36 36
37 /* 37 /*
38 * 64 bit object ID, 64 bit root object ID,
39 * 32 bit generation number.
40 */
41 FILEID_BTRFS_WITHOUT_PARENT = 0x4d,
42
43 /*
44 * 64 bit object ID, 64 bit root object ID,
45 * 32 bit generation number,
46 * 64 bit parent object ID, 32 bit parent generation.
47 */
48 FILEID_BTRFS_WITH_PARENT = 0x4e,
49
50 /*
51 * 64 bit object ID, 64 bit root object ID,
52 * 32 bit generation number,
53 * 64 bit parent object ID, 32 bit parent generation,
54 * 64 bit parent root object ID.
55 */
56 FILEID_BTRFS_WITH_PARENT_ROOT = 0x4f,
57
58 /*
38 * 32 bit block number, 16 bit partition reference, 59 * 32 bit block number, 16 bit partition reference,
39 * 16 bit unused, 32 bit generation number. 60 * 16 bit unused, 32 bit generation number.
40 */ 61 */
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 80171ee89a22..8120fa1bc235 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -837,6 +837,8 @@ extern void ext3_truncate (struct inode *);
837extern void ext3_set_inode_flags(struct inode *); 837extern void ext3_set_inode_flags(struct inode *);
838extern void ext3_get_inode_flags(struct ext3_inode_info *); 838extern void ext3_get_inode_flags(struct ext3_inode_info *);
839extern void ext3_set_aops(struct inode *inode); 839extern void ext3_set_aops(struct inode *inode);
840extern int ext3_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
841 u64 start, u64 len);
840 842
841/* ioctl.c */ 843/* ioctl.c */
842extern int ext3_ioctl (struct inode *, struct file *, unsigned int, 844extern int ext3_ioctl (struct inode *, struct file *, unsigned int,
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 3b8870e32afd..531ccd5f5960 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -976,6 +976,9 @@ static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
976 976
977/* drivers/video/fb_defio.c */ 977/* drivers/video/fb_defio.c */
978extern void fb_deferred_io_init(struct fb_info *info); 978extern void fb_deferred_io_init(struct fb_info *info);
979extern void fb_deferred_io_open(struct fb_info *info,
980 struct inode *inode,
981 struct file *file);
979extern void fb_deferred_io_cleanup(struct fb_info *info); 982extern void fb_deferred_io_cleanup(struct fb_info *info);
980extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry, 983extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry,
981 int datasync); 984 int datasync);
diff --git a/include/linux/fd.h b/include/linux/fd.h
index b6bd41d2b460..f5d194af07a8 100644
--- a/include/linux/fd.h
+++ b/include/linux/fd.h
@@ -15,10 +15,16 @@ struct floppy_struct {
15 sect, /* sectors per track */ 15 sect, /* sectors per track */
16 head, /* nr of heads */ 16 head, /* nr of heads */
17 track, /* nr of tracks */ 17 track, /* nr of tracks */
18 stretch; /* !=0 means double track steps */ 18 stretch; /* bit 0 !=0 means double track steps */
19 /* bit 1 != 0 means swap sides */
20 /* bits 2..9 give the first sector */
21 /* number (the LSB is flipped) */
19#define FD_STRETCH 1 22#define FD_STRETCH 1
20#define FD_SWAPSIDES 2 23#define FD_SWAPSIDES 2
21#define FD_ZEROBASED 4 24#define FD_ZEROBASED 4
25#define FD_SECTBASEMASK 0x3FC
26#define FD_MKSECTBASE(s) (((s) ^ 1) << 2)
27#define FD_SECTBASE(floppy) ((((floppy)->stretch & FD_SECTBASEMASK) >> 2) ^ 1)
22 28
23 unsigned char gap, /* gap1 size */ 29 unsigned char gap, /* gap1 size */
24 30
diff --git a/include/linux/fiemap.h b/include/linux/fiemap.h
new file mode 100644
index 000000000000..671decbd2aeb
--- /dev/null
+++ b/include/linux/fiemap.h
@@ -0,0 +1,64 @@
1/*
2 * FS_IOC_FIEMAP ioctl infrastructure.
3 *
4 * Some portions copyright (C) 2007 Cluster File Systems, Inc
5 *
6 * Authors: Mark Fasheh <mfasheh@suse.com>
7 * Kalpak Shah <kalpak.shah@sun.com>
8 * Andreas Dilger <adilger@sun.com>
9 */
10
11#ifndef _LINUX_FIEMAP_H
12#define _LINUX_FIEMAP_H
13
14struct fiemap_extent {
15 __u64 fe_logical; /* logical offset in bytes for the start of
16 * the extent from the beginning of the file */
17 __u64 fe_physical; /* physical offset in bytes for the start
18 * of the extent from the beginning of the disk */
19 __u64 fe_length; /* length in bytes for this extent */
20 __u64 fe_reserved64[2];
21 __u32 fe_flags; /* FIEMAP_EXTENT_* flags for this extent */
22 __u32 fe_reserved[3];
23};
24
25struct fiemap {
26 __u64 fm_start; /* logical offset (inclusive) at
27 * which to start mapping (in) */
28 __u64 fm_length; /* logical length of mapping which
29 * userspace wants (in) */
30 __u32 fm_flags; /* FIEMAP_FLAG_* flags for request (in/out) */
31 __u32 fm_mapped_extents;/* number of extents that were mapped (out) */
32 __u32 fm_extent_count; /* size of fm_extents array (in) */
33 __u32 fm_reserved;
34 struct fiemap_extent fm_extents[0]; /* array of mapped extents (out) */
35};
36
37#define FIEMAP_MAX_OFFSET (~0ULL)
38
39#define FIEMAP_FLAG_SYNC 0x00000001 /* sync file data before map */
40#define FIEMAP_FLAG_XATTR 0x00000002 /* map extended attribute tree */
41
42#define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR)
43
44#define FIEMAP_EXTENT_LAST 0x00000001 /* Last extent in file. */
45#define FIEMAP_EXTENT_UNKNOWN 0x00000002 /* Data location unknown. */
46#define FIEMAP_EXTENT_DELALLOC 0x00000004 /* Location still pending.
47 * Sets EXTENT_UNKNOWN. */
48#define FIEMAP_EXTENT_ENCODED 0x00000008 /* Data can not be read
49 * while fs is unmounted */
50#define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs.
51 * Sets EXTENT_NO_BYPASS. */
52#define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be
53 * block aligned. */
54#define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata.
55 * Sets EXTENT_NOT_ALIGNED.*/
56#define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block.
57 * Sets EXTENT_NOT_ALIGNED.*/
58#define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but
59 * no data (i.e. zero). */
60#define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively
61 * support extents. Result
62 * merged for efficiency. */
63
64#endif /* _LINUX_FIEMAP_H */
diff --git a/include/linux/file.h b/include/linux/file.h
index 27c64bdc68c9..a20259e248a5 100644
--- a/include/linux/file.h
+++ b/include/linux/file.h
@@ -34,8 +34,9 @@ extern struct file *fget(unsigned int fd);
34extern struct file *fget_light(unsigned int fd, int *fput_needed); 34extern struct file *fget_light(unsigned int fd, int *fput_needed);
35extern void set_close_on_exec(unsigned int fd, int flag); 35extern void set_close_on_exec(unsigned int fd, int flag);
36extern void put_filp(struct file *); 36extern void put_filp(struct file *);
37extern int alloc_fd(unsigned start, unsigned flags);
37extern int get_unused_fd(void); 38extern int get_unused_fd(void);
38extern int get_unused_fd_flags(int flags); 39#define get_unused_fd_flags(flags) alloc_fd(0, (flags))
39extern void put_unused_fd(unsigned int fd); 40extern void put_unused_fd(unsigned int fd);
40 41
41extern void fd_install(unsigned int fd, struct file *file); 42extern void fd_install(unsigned int fd, struct file *file);
diff --git a/include/linux/firmware-map.h b/include/linux/firmware-map.h
index acbdbcc16051..6e199c8dfacc 100644
--- a/include/linux/firmware-map.h
+++ b/include/linux/firmware-map.h
@@ -24,34 +24,8 @@
24 */ 24 */
25#ifdef CONFIG_FIRMWARE_MEMMAP 25#ifdef CONFIG_FIRMWARE_MEMMAP
26 26
27/**
28 * Adds a firmware mapping entry. This function uses kmalloc() for memory
29 * allocation. Use firmware_map_add_early() if you want to use the bootmem
30 * allocator.
31 *
32 * That function must be called before late_initcall.
33 *
34 * @start: Start of the memory range.
35 * @end: End of the memory range (inclusive).
36 * @type: Type of the memory range.
37 *
38 * Returns 0 on success, or -ENOMEM if no memory could be allocated.
39 */
40int firmware_map_add(resource_size_t start, resource_size_t end, 27int firmware_map_add(resource_size_t start, resource_size_t end,
41 const char *type); 28 const char *type);
42
43/**
44 * Adds a firmware mapping entry. This function uses the bootmem allocator
45 * for memory allocation. Use firmware_map_add() if you want to use kmalloc().
46 *
47 * That function must be called before late_initcall.
48 *
49 * @start: Start of the memory range.
50 * @end: End of the memory range (inclusive).
51 * @type: Type of the memory range.
52 *
53 * Returns 0 on success, or -ENOMEM if no memory could be allocated.
54 */
55int firmware_map_add_early(resource_size_t start, resource_size_t end, 29int firmware_map_add_early(resource_size_t start, resource_size_t end,
56 const char *type); 30 const char *type);
57 31
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 49d8eb7a71be..44e3cb2f1966 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -60,6 +60,8 @@ extern int dir_notify_enable;
60#define MAY_WRITE 2 60#define MAY_WRITE 2
61#define MAY_READ 4 61#define MAY_READ 4
62#define MAY_APPEND 8 62#define MAY_APPEND 8
63#define MAY_ACCESS 16
64#define MAY_OPEN 32
63 65
64#define FMODE_READ 1 66#define FMODE_READ 1
65#define FMODE_WRITE 2 67#define FMODE_WRITE 2
@@ -84,7 +86,9 @@ extern int dir_notify_enable;
84#define READ_META (READ | (1 << BIO_RW_META)) 86#define READ_META (READ | (1 << BIO_RW_META))
85#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC)) 87#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC))
86#define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC)) 88#define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC))
87#define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER)) 89#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER))
90#define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD)
91#define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER))
88 92
89#define SEL_IN 1 93#define SEL_IN 1
90#define SEL_OUT 2 94#define SEL_OUT 2
@@ -220,6 +224,7 @@ extern int dir_notify_enable;
220#define BLKTRACESTART _IO(0x12,116) 224#define BLKTRACESTART _IO(0x12,116)
221#define BLKTRACESTOP _IO(0x12,117) 225#define BLKTRACESTOP _IO(0x12,117)
222#define BLKTRACETEARDOWN _IO(0x12,118) 226#define BLKTRACETEARDOWN _IO(0x12,118)
227#define BLKDISCARD _IO(0x12,119)
223 228
224#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ 229#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
225#define FIBMAP _IO(0x00,1) /* bmap access */ 230#define FIBMAP _IO(0x00,1) /* bmap access */
@@ -229,6 +234,7 @@ extern int dir_notify_enable;
229#define FS_IOC_SETFLAGS _IOW('f', 2, long) 234#define FS_IOC_SETFLAGS _IOW('f', 2, long)
230#define FS_IOC_GETVERSION _IOR('v', 1, long) 235#define FS_IOC_GETVERSION _IOR('v', 1, long)
231#define FS_IOC_SETVERSION _IOW('v', 2, long) 236#define FS_IOC_SETVERSION _IOW('v', 2, long)
237#define FS_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
232#define FS_IOC32_GETFLAGS _IOR('f', 1, int) 238#define FS_IOC32_GETFLAGS _IOR('f', 1, int)
233#define FS_IOC32_SETFLAGS _IOW('f', 2, int) 239#define FS_IOC32_SETFLAGS _IOW('f', 2, int)
234#define FS_IOC32_GETVERSION _IOR('v', 1, int) 240#define FS_IOC32_GETVERSION _IOR('v', 1, int)
@@ -277,7 +283,7 @@ extern int dir_notify_enable;
277#include <linux/types.h> 283#include <linux/types.h>
278#include <linux/kdev_t.h> 284#include <linux/kdev_t.h>
279#include <linux/dcache.h> 285#include <linux/dcache.h>
280#include <linux/namei.h> 286#include <linux/path.h>
281#include <linux/stat.h> 287#include <linux/stat.h>
282#include <linux/cache.h> 288#include <linux/cache.h>
283#include <linux/kobject.h> 289#include <linux/kobject.h>
@@ -289,6 +295,7 @@ extern int dir_notify_enable;
289#include <linux/mutex.h> 295#include <linux/mutex.h>
290#include <linux/capability.h> 296#include <linux/capability.h>
291#include <linux/semaphore.h> 297#include <linux/semaphore.h>
298#include <linux/fiemap.h>
292 299
293#include <asm/atomic.h> 300#include <asm/atomic.h>
294#include <asm/byteorder.h> 301#include <asm/byteorder.h>
@@ -318,22 +325,23 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
318 * Attribute flags. These should be or-ed together to figure out what 325 * Attribute flags. These should be or-ed together to figure out what
319 * has been changed! 326 * has been changed!
320 */ 327 */
321#define ATTR_MODE 1 328#define ATTR_MODE (1 << 0)
322#define ATTR_UID 2 329#define ATTR_UID (1 << 1)
323#define ATTR_GID 4 330#define ATTR_GID (1 << 2)
324#define ATTR_SIZE 8 331#define ATTR_SIZE (1 << 3)
325#define ATTR_ATIME 16 332#define ATTR_ATIME (1 << 4)
326#define ATTR_MTIME 32 333#define ATTR_MTIME (1 << 5)
327#define ATTR_CTIME 64 334#define ATTR_CTIME (1 << 6)
328#define ATTR_ATIME_SET 128 335#define ATTR_ATIME_SET (1 << 7)
329#define ATTR_MTIME_SET 256 336#define ATTR_MTIME_SET (1 << 8)
330#define ATTR_FORCE 512 /* Not a change, but a change it */ 337#define ATTR_FORCE (1 << 9) /* Not a change, but a change it */
331#define ATTR_ATTR_FLAG 1024 338#define ATTR_ATTR_FLAG (1 << 10)
332#define ATTR_KILL_SUID 2048 339#define ATTR_KILL_SUID (1 << 11)
333#define ATTR_KILL_SGID 4096 340#define ATTR_KILL_SGID (1 << 12)
334#define ATTR_FILE 8192 341#define ATTR_FILE (1 << 13)
335#define ATTR_KILL_PRIV 16384 342#define ATTR_KILL_PRIV (1 << 14)
336#define ATTR_OPEN 32768 /* Truncating from open(O_TRUNC) */ 343#define ATTR_OPEN (1 << 15) /* Truncating from open(O_TRUNC) */
344#define ATTR_TIMES_SET (1 << 16)
337 345
338/* 346/*
339 * This is the Inode Attributes structure, used for notify_change(). It 347 * This is the Inode Attributes structure, used for notify_change(). It
@@ -440,6 +448,27 @@ static inline size_t iov_iter_count(struct iov_iter *i)
440 return i->count; 448 return i->count;
441} 449}
442 450
451/*
452 * "descriptor" for what we're up to with a read.
453 * This allows us to use the same read code yet
454 * have multiple different users of the data that
455 * we read from a file.
456 *
457 * The simplest case just copies the data to user
458 * mode.
459 */
460typedef struct {
461 size_t written;
462 size_t count;
463 union {
464 char __user *buf;
465 void *data;
466 } arg;
467 int error;
468} read_descriptor_t;
469
470typedef int (*read_actor_t)(read_descriptor_t *, struct page *,
471 unsigned long, unsigned long);
443 472
444struct address_space_operations { 473struct address_space_operations {
445 int (*writepage)(struct page *page, struct writeback_control *wbc); 474 int (*writepage)(struct page *page, struct writeback_control *wbc);
@@ -481,6 +510,8 @@ struct address_space_operations {
481 int (*migratepage) (struct address_space *, 510 int (*migratepage) (struct address_space *,
482 struct page *, struct page *); 511 struct page *, struct page *);
483 int (*launder_page) (struct page *); 512 int (*launder_page) (struct page *);
513 int (*is_partially_uptodate) (struct page *, read_descriptor_t *,
514 unsigned long);
484}; 515};
485 516
486/* 517/*
@@ -499,7 +530,7 @@ struct backing_dev_info;
499struct address_space { 530struct address_space {
500 struct inode *host; /* owner: inode, block_device */ 531 struct inode *host; /* owner: inode, block_device */
501 struct radix_tree_root page_tree; /* radix tree of all pages */ 532 struct radix_tree_root page_tree; /* radix tree of all pages */
502 rwlock_t tree_lock; /* and rwlock protecting it */ 533 spinlock_t tree_lock; /* and lock protecting it */
503 unsigned int i_mmap_writable;/* count VM_SHARED mappings */ 534 unsigned int i_mmap_writable;/* count VM_SHARED mappings */
504 struct prio_tree_root i_mmap; /* tree of private and shared mappings */ 535 struct prio_tree_root i_mmap; /* tree of private and shared mappings */
505 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ 536 struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
@@ -792,7 +823,7 @@ struct file {
792#define f_dentry f_path.dentry 823#define f_dentry f_path.dentry
793#define f_vfsmnt f_path.mnt 824#define f_vfsmnt f_path.mnt
794 const struct file_operations *f_op; 825 const struct file_operations *f_op;
795 atomic_t f_count; 826 atomic_long_t f_count;
796 unsigned int f_flags; 827 unsigned int f_flags;
797 mode_t f_mode; 828 mode_t f_mode;
798 loff_t f_pos; 829 loff_t f_pos;
@@ -821,8 +852,8 @@ extern spinlock_t files_lock;
821#define file_list_lock() spin_lock(&files_lock); 852#define file_list_lock() spin_lock(&files_lock);
822#define file_list_unlock() spin_unlock(&files_lock); 853#define file_list_unlock() spin_unlock(&files_lock);
823 854
824#define get_file(x) atomic_inc(&(x)->f_count) 855#define get_file(x) atomic_long_inc(&(x)->f_count)
825#define file_count(x) atomic_read(&(x)->f_count) 856#define file_count(x) atomic_long_read(&(x)->f_count)
826 857
827#ifdef CONFIG_DEBUG_WRITECOUNT 858#ifdef CONFIG_DEBUG_WRITECOUNT
828static inline void file_take_write(struct file *f) 859static inline void file_take_write(struct file *f)
@@ -1136,7 +1167,7 @@ extern int vfs_permission(struct nameidata *, int);
1136extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *); 1167extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *);
1137extern int vfs_mkdir(struct inode *, struct dentry *, int); 1168extern int vfs_mkdir(struct inode *, struct dentry *, int);
1138extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t); 1169extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t);
1139extern int vfs_symlink(struct inode *, struct dentry *, const char *, int); 1170extern int vfs_symlink(struct inode *, struct dentry *, const char *);
1140extern int vfs_link(struct dentry *, struct inode *, struct dentry *); 1171extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
1141extern int vfs_rmdir(struct inode *, struct dentry *); 1172extern int vfs_rmdir(struct inode *, struct dentry *);
1142extern int vfs_unlink(struct inode *, struct dentry *); 1173extern int vfs_unlink(struct inode *, struct dentry *);
@@ -1153,6 +1184,20 @@ extern void dentry_unhash(struct dentry *dentry);
1153extern int file_permission(struct file *, int); 1184extern int file_permission(struct file *, int);
1154 1185
1155/* 1186/*
1187 * VFS FS_IOC_FIEMAP helper definitions.
1188 */
1189struct fiemap_extent_info {
1190 unsigned int fi_flags; /* Flags as passed from user */
1191 unsigned int fi_extents_mapped; /* Number of mapped extents */
1192 unsigned int fi_extents_max; /* Size of fiemap_extent array */
1193 struct fiemap_extent *fi_extents_start; /* Start of fiemap_extent
1194 * array */
1195};
1196int fiemap_fill_next_extent(struct fiemap_extent_info *info, u64 logical,
1197 u64 phys, u64 len, u32 flags);
1198int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags);
1199
1200/*
1156 * File types 1201 * File types
1157 * 1202 *
1158 * NOTE! These match bits 12..15 of stat.st_mode 1203 * NOTE! These match bits 12..15 of stat.st_mode
@@ -1195,27 +1240,6 @@ struct block_device_operations {
1195 struct module *owner; 1240 struct module *owner;
1196}; 1241};
1197 1242
1198/*
1199 * "descriptor" for what we're up to with a read.
1200 * This allows us to use the same read code yet
1201 * have multiple different users of the data that
1202 * we read from a file.
1203 *
1204 * The simplest case just copies the data to user
1205 * mode.
1206 */
1207typedef struct {
1208 size_t written;
1209 size_t count;
1210 union {
1211 char __user * buf;
1212 void *data;
1213 } arg;
1214 int error;
1215} read_descriptor_t;
1216
1217typedef int (*read_actor_t)(read_descriptor_t *, struct page *, unsigned long, unsigned long);
1218
1219/* These macros are for out of kernel modules to test that 1243/* These macros are for out of kernel modules to test that
1220 * the kernel supports the unlocked_ioctl and compat_ioctl 1244 * the kernel supports the unlocked_ioctl and compat_ioctl
1221 * fields in struct file_operations. */ 1245 * fields in struct file_operations. */
@@ -1272,7 +1296,7 @@ struct inode_operations {
1272 void * (*follow_link) (struct dentry *, struct nameidata *); 1296 void * (*follow_link) (struct dentry *, struct nameidata *);
1273 void (*put_link) (struct dentry *, struct nameidata *, void *); 1297 void (*put_link) (struct dentry *, struct nameidata *, void *);
1274 void (*truncate) (struct inode *); 1298 void (*truncate) (struct inode *);
1275 int (*permission) (struct inode *, int, struct nameidata *); 1299 int (*permission) (struct inode *, int);
1276 int (*setattr) (struct dentry *, struct iattr *); 1300 int (*setattr) (struct dentry *, struct iattr *);
1277 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); 1301 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
1278 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); 1302 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
@@ -1282,6 +1306,8 @@ struct inode_operations {
1282 void (*truncate_range)(struct inode *, loff_t, loff_t); 1306 void (*truncate_range)(struct inode *, loff_t, loff_t);
1283 long (*fallocate)(struct inode *inode, int mode, loff_t offset, 1307 long (*fallocate)(struct inode *inode, int mode, loff_t offset,
1284 loff_t len); 1308 loff_t len);
1309 int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start,
1310 u64 len);
1285}; 1311};
1286 1312
1287struct seq_file; 1313struct seq_file;
@@ -1677,6 +1703,7 @@ extern void chrdev_show(struct seq_file *,off_t);
1677 1703
1678/* fs/block_dev.c */ 1704/* fs/block_dev.c */
1679#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */ 1705#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */
1706#define BDEVT_SIZE 10 /* Largest string for MAJ:MIN for blkdev */
1680 1707
1681#ifdef CONFIG_BLOCK 1708#ifdef CONFIG_BLOCK
1682#define BLKDEV_MAJOR_HASH_SIZE 255 1709#define BLKDEV_MAJOR_HASH_SIZE 255
@@ -1696,9 +1723,9 @@ extern void init_special_inode(struct inode *, umode_t, dev_t);
1696extern void make_bad_inode(struct inode *); 1723extern void make_bad_inode(struct inode *);
1697extern int is_bad_inode(struct inode *); 1724extern int is_bad_inode(struct inode *);
1698 1725
1699extern const struct file_operations read_fifo_fops; 1726extern const struct file_operations read_pipefifo_fops;
1700extern const struct file_operations write_fifo_fops; 1727extern const struct file_operations write_pipefifo_fops;
1701extern const struct file_operations rdwr_fifo_fops; 1728extern const struct file_operations rdwr_pipefifo_fops;
1702 1729
1703extern int fs_may_remount_ro(struct super_block *); 1730extern int fs_may_remount_ro(struct super_block *);
1704 1731
@@ -1713,6 +1740,9 @@ extern int fs_may_remount_ro(struct super_block *);
1713 */ 1740 */
1714#define bio_data_dir(bio) ((bio)->bi_rw & 1) 1741#define bio_data_dir(bio) ((bio)->bi_rw & 1)
1715 1742
1743extern void check_disk_size_change(struct gendisk *disk,
1744 struct block_device *bdev);
1745extern int revalidate_disk(struct gendisk *);
1716extern int check_disk_change(struct block_device *); 1746extern int check_disk_change(struct block_device *);
1717extern int __invalidate_device(struct block_device *); 1747extern int __invalidate_device(struct block_device *);
1718extern int invalidate_partition(struct gendisk *, int); 1748extern int invalidate_partition(struct gendisk *, int);
@@ -1767,7 +1797,7 @@ extern int do_remount_sb(struct super_block *sb, int flags,
1767extern sector_t bmap(struct inode *, sector_t); 1797extern sector_t bmap(struct inode *, sector_t);
1768#endif 1798#endif
1769extern int notify_change(struct dentry *, struct iattr *); 1799extern int notify_change(struct dentry *, struct iattr *);
1770extern int permission(struct inode *, int, struct nameidata *); 1800extern int inode_permission(struct inode *, int);
1771extern int generic_permission(struct inode *, int, 1801extern int generic_permission(struct inode *, int,
1772 int (*check_acl)(struct inode *, int)); 1802 int (*check_acl)(struct inode *, int));
1773 1803
@@ -1831,7 +1861,7 @@ extern void clear_inode(struct inode *);
1831extern void destroy_inode(struct inode *); 1861extern void destroy_inode(struct inode *);
1832extern struct inode *new_inode(struct super_block *); 1862extern struct inode *new_inode(struct super_block *);
1833extern int should_remove_suid(struct dentry *); 1863extern int should_remove_suid(struct dentry *);
1834extern int remove_suid(struct dentry *); 1864extern int file_remove_suid(struct file *);
1835 1865
1836extern void __insert_inode_hash(struct inode *, unsigned long hashval); 1866extern void __insert_inode_hash(struct inode *, unsigned long hashval);
1837extern void remove_inode_hash(struct inode *); 1867extern void remove_inode_hash(struct inode *);
@@ -1975,6 +2005,9 @@ extern int vfs_fstat(unsigned int, struct kstat *);
1975 2005
1976extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, 2006extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
1977 unsigned long arg); 2007 unsigned long arg);
2008extern int generic_block_fiemap(struct inode *inode,
2009 struct fiemap_extent_info *fieinfo, u64 start,
2010 u64 len, get_block_t *get_block);
1978 2011
1979extern void get_filesystem(struct file_system_type *fs); 2012extern void get_filesystem(struct file_system_type *fs);
1980extern void put_filesystem(struct file_system_type *fs); 2013extern void put_filesystem(struct file_system_type *fs);
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h
index 282f54219129..9e5a06e78d02 100644
--- a/include/linux/fs_struct.h
+++ b/include/linux/fs_struct.h
@@ -7,7 +7,7 @@ struct fs_struct {
7 atomic_t count; 7 atomic_t count;
8 rwlock_t lock; 8 rwlock_t lock;
9 int umask; 9 int umask;
10 struct path root, pwd, altroot; 10 struct path root, pwd;
11}; 11};
12 12
13#define INIT_FS { \ 13#define INIT_FS { \
@@ -19,7 +19,6 @@ struct fs_struct {
19extern struct kmem_cache *fs_cachep; 19extern struct kmem_cache *fs_cachep;
20 20
21extern void exit_fs(struct task_struct *); 21extern void exit_fs(struct task_struct *);
22extern void set_fs_altroot(void);
23extern void set_fs_root(struct fs_struct *, struct path *); 22extern void set_fs_root(struct fs_struct *, struct path *);
24extern void set_fs_pwd(struct fs_struct *, struct path *); 23extern void set_fs_pwd(struct fs_struct *, struct path *);
25extern struct fs_struct *copy_fs_struct(struct fs_struct *); 24extern struct fs_struct *copy_fs_struct(struct fs_struct *);
diff --git a/include/linux/fs_uart_pd.h b/include/linux/fs_uart_pd.h
index 809bb9ffc788..36b61ff39277 100644
--- a/include/linux/fs_uart_pd.h
+++ b/include/linux/fs_uart_pd.h
@@ -12,7 +12,6 @@
12#ifndef FS_UART_PD_H 12#ifndef FS_UART_PD_H
13#define FS_UART_PD_H 13#define FS_UART_PD_H
14 14
15#include <linux/version.h>
16#include <asm/types.h> 15#include <asm/types.h>
17 16
18enum fs_uart_id { 17enum fs_uart_id {
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index f368d041e02d..bb384068272e 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -98,6 +98,27 @@ static inline void tracer_disable(void)
98#endif 98#endif
99} 99}
100 100
101/* Ftrace disable/restore without lock. Some synchronization mechanism
102 * must be used to prevent ftrace_enabled to be changed between
103 * disable/restore. */
104static inline int __ftrace_enabled_save(void)
105{
106#ifdef CONFIG_FTRACE
107 int saved_ftrace_enabled = ftrace_enabled;
108 ftrace_enabled = 0;
109 return saved_ftrace_enabled;
110#else
111 return 0;
112#endif
113}
114
115static inline void __ftrace_enabled_restore(int enabled)
116{
117#ifdef CONFIG_FTRACE
118 ftrace_enabled = enabled;
119#endif
120}
121
101#ifdef CONFIG_FRAME_POINTER 122#ifdef CONFIG_FRAME_POINTER
102/* TODO: need to fix this for ARM */ 123/* TODO: need to fix this for ARM */
103# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) 124# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 118216f1bd3c..206cdf96c3a7 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -11,12 +11,15 @@
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/kdev_t.h> 13#include <linux/kdev_t.h>
14#include <linux/rcupdate.h>
14 15
15#ifdef CONFIG_BLOCK 16#ifdef CONFIG_BLOCK
16 17
17#define kobj_to_dev(k) container_of(k, struct device, kobj) 18#define kobj_to_dev(k) container_of((k), struct device, kobj)
18#define dev_to_disk(device) container_of(device, struct gendisk, dev) 19#define dev_to_disk(device) container_of((device), struct gendisk, part0.__dev)
19#define dev_to_part(device) container_of(device, struct hd_struct, dev) 20#define dev_to_part(device) container_of((device), struct hd_struct, __dev)
21#define disk_to_dev(disk) (&(disk)->part0.__dev)
22#define part_to_dev(part) (&((part)->__dev))
20 23
21extern struct device_type part_type; 24extern struct device_type part_type;
22extern struct kobject *block_depr; 25extern struct kobject *block_depr;
@@ -55,6 +58,9 @@ enum {
55 UNIXWARE_PARTITION = 0x63, /* Same as GNU_HURD and SCO Unix */ 58 UNIXWARE_PARTITION = 0x63, /* Same as GNU_HURD and SCO Unix */
56}; 59};
57 60
61#define DISK_MAX_PARTS 256
62#define DISK_NAME_LEN 32
63
58#include <linux/major.h> 64#include <linux/major.h>
59#include <linux/device.h> 65#include <linux/device.h>
60#include <linux/smp.h> 66#include <linux/smp.h>
@@ -87,7 +93,7 @@ struct disk_stats {
87struct hd_struct { 93struct hd_struct {
88 sector_t start_sect; 94 sector_t start_sect;
89 sector_t nr_sects; 95 sector_t nr_sects;
90 struct device dev; 96 struct device __dev;
91 struct kobject *holder_dir; 97 struct kobject *holder_dir;
92 int policy, partno; 98 int policy, partno;
93#ifdef CONFIG_FAIL_MAKE_REQUEST 99#ifdef CONFIG_FAIL_MAKE_REQUEST
@@ -100,6 +106,7 @@ struct hd_struct {
100#else 106#else
101 struct disk_stats dkstats; 107 struct disk_stats dkstats;
102#endif 108#endif
109 struct rcu_head rcu_head;
103}; 110};
104 111
105#define GENHD_FL_REMOVABLE 1 112#define GENHD_FL_REMOVABLE 1
@@ -108,7 +115,7 @@ struct hd_struct {
108#define GENHD_FL_CD 8 115#define GENHD_FL_CD 8
109#define GENHD_FL_UP 16 116#define GENHD_FL_UP 16
110#define GENHD_FL_SUPPRESS_PARTITION_INFO 32 117#define GENHD_FL_SUPPRESS_PARTITION_INFO 32
111#define GENHD_FL_FAIL 64 118#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */
112 119
113#define BLK_SCSI_MAX_CMDS (256) 120#define BLK_SCSI_MAX_CMDS (256)
114#define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8)) 121#define BLK_SCSI_CMD_PER_LONG (BLK_SCSI_MAX_CMDS / (sizeof(long) * 8))
@@ -119,99 +126,137 @@ struct blk_scsi_cmd_filter {
119 struct kobject kobj; 126 struct kobject kobj;
120}; 127};
121 128
129struct disk_part_tbl {
130 struct rcu_head rcu_head;
131 int len;
132 struct hd_struct *part[];
133};
134
122struct gendisk { 135struct gendisk {
136 /* major, first_minor and minors are input parameters only,
137 * don't use directly. Use disk_devt() and disk_max_parts().
138 */
123 int major; /* major number of driver */ 139 int major; /* major number of driver */
124 int first_minor; 140 int first_minor;
125 int minors; /* maximum number of minors, =1 for 141 int minors; /* maximum number of minors, =1 for
126 * disks that can't be partitioned. */ 142 * disks that can't be partitioned. */
127 char disk_name[32]; /* name of major driver */ 143
128 struct hd_struct **part; /* [indexed by minor] */ 144 char disk_name[DISK_NAME_LEN]; /* name of major driver */
145
146 /* Array of pointers to partitions indexed by partno.
147 * Protected with matching bdev lock but stat and other
148 * non-critical accesses use RCU. Always access through
149 * helpers.
150 */
151 struct disk_part_tbl *part_tbl;
152 struct hd_struct part0;
153
129 struct block_device_operations *fops; 154 struct block_device_operations *fops;
130 struct request_queue *queue; 155 struct request_queue *queue;
131 struct blk_scsi_cmd_filter cmd_filter;
132 void *private_data; 156 void *private_data;
133 sector_t capacity;
134 157
135 int flags; 158 int flags;
136 struct device *driverfs_dev; // FIXME: remove 159 struct device *driverfs_dev; // FIXME: remove
137 struct device dev;
138 struct kobject *holder_dir;
139 struct kobject *slave_dir; 160 struct kobject *slave_dir;
140 161
141 struct timer_rand_state *random; 162 struct timer_rand_state *random;
142 int policy;
143 163
144 atomic_t sync_io; /* RAID */ 164 atomic_t sync_io; /* RAID */
145 unsigned long stamp;
146 int in_flight;
147#ifdef CONFIG_SMP
148 struct disk_stats *dkstats;
149#else
150 struct disk_stats dkstats;
151#endif
152 struct work_struct async_notify; 165 struct work_struct async_notify;
153#ifdef CONFIG_BLK_DEV_INTEGRITY 166#ifdef CONFIG_BLK_DEV_INTEGRITY
154 struct blk_integrity *integrity; 167 struct blk_integrity *integrity;
155#endif 168#endif
169 int node_id;
156}; 170};
157 171
158/* 172static inline struct gendisk *part_to_disk(struct hd_struct *part)
159 * Macros to operate on percpu disk statistics:
160 *
161 * The __ variants should only be called in critical sections. The full
162 * variants disable/enable preemption.
163 */
164static inline struct hd_struct *get_part(struct gendisk *gendiskp,
165 sector_t sector)
166{ 173{
167 struct hd_struct *part; 174 if (likely(part)) {
168 int i; 175 if (part->partno)
169 for (i = 0; i < gendiskp->minors - 1; i++) { 176 return dev_to_disk(part_to_dev(part)->parent);
170 part = gendiskp->part[i]; 177 else
171 if (part && part->start_sect <= sector 178 return dev_to_disk(part_to_dev(part));
172 && sector < part->start_sect + part->nr_sects)
173 return part;
174 } 179 }
175 return NULL; 180 return NULL;
176} 181}
177 182
178#ifdef CONFIG_SMP 183static inline int disk_max_parts(struct gendisk *disk)
179#define __disk_stat_add(gendiskp, field, addnd) \ 184{
180 (per_cpu_ptr(gendiskp->dkstats, smp_processor_id())->field += addnd) 185 if (disk->flags & GENHD_FL_EXT_DEVT)
186 return DISK_MAX_PARTS;
187 return disk->minors;
188}
181 189
182#define disk_stat_read(gendiskp, field) \ 190static inline bool disk_partitionable(struct gendisk *disk)
183({ \ 191{
184 typeof(gendiskp->dkstats->field) res = 0; \ 192 return disk_max_parts(disk) > 1;
185 int i; \ 193}
186 for_each_possible_cpu(i) \
187 res += per_cpu_ptr(gendiskp->dkstats, i)->field; \
188 res; \
189})
190 194
191static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) { 195static inline dev_t disk_devt(struct gendisk *disk)
192 int i; 196{
197 return disk_to_dev(disk)->devt;
198}
193 199
194 for_each_possible_cpu(i) 200static inline dev_t part_devt(struct hd_struct *part)
195 memset(per_cpu_ptr(gendiskp->dkstats, i), value, 201{
196 sizeof(struct disk_stats)); 202 return part_to_dev(part)->devt;
197} 203}
198 204
199#define __part_stat_add(part, field, addnd) \ 205extern struct hd_struct *disk_get_part(struct gendisk *disk, int partno);
200 (per_cpu_ptr(part->dkstats, smp_processor_id())->field += addnd)
201 206
202#define __all_stat_add(gendiskp, part, field, addnd, sector) \ 207static inline void disk_put_part(struct hd_struct *part)
203({ \ 208{
204 if (part) \ 209 if (likely(part))
205 __part_stat_add(part, field, addnd); \ 210 put_device(part_to_dev(part));
206 __disk_stat_add(gendiskp, field, addnd); \ 211}
207}) 212
213/*
214 * Smarter partition iterator without context limits.
215 */
216#define DISK_PITER_REVERSE (1 << 0) /* iterate in the reverse direction */
217#define DISK_PITER_INCL_EMPTY (1 << 1) /* include 0-sized parts */
218#define DISK_PITER_INCL_PART0 (1 << 2) /* include partition 0 */
219
220struct disk_part_iter {
221 struct gendisk *disk;
222 struct hd_struct *part;
223 int idx;
224 unsigned int flags;
225};
226
227extern void disk_part_iter_init(struct disk_part_iter *piter,
228 struct gendisk *disk, unsigned int flags);
229extern struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter);
230extern void disk_part_iter_exit(struct disk_part_iter *piter);
231
232extern struct hd_struct *disk_map_sector_rcu(struct gendisk *disk,
233 sector_t sector);
234
235/*
236 * Macros to operate on percpu disk statistics:
237 *
238 * {disk|part|all}_stat_{add|sub|inc|dec}() modify the stat counters
239 * and should be called between disk_stat_lock() and
240 * disk_stat_unlock().
241 *
242 * part_stat_read() can be called at any time.
243 *
244 * part_stat_{add|set_all}() and {init|free}_part_stats are for
245 * internal use only.
246 */
247#ifdef CONFIG_SMP
248#define part_stat_lock() ({ rcu_read_lock(); get_cpu(); })
249#define part_stat_unlock() do { put_cpu(); rcu_read_unlock(); } while (0)
250
251#define __part_stat_add(cpu, part, field, addnd) \
252 (per_cpu_ptr((part)->dkstats, (cpu))->field += (addnd))
208 253
209#define part_stat_read(part, field) \ 254#define part_stat_read(part, field) \
210({ \ 255({ \
211 typeof(part->dkstats->field) res = 0; \ 256 typeof((part)->dkstats->field) res = 0; \
212 int i; \ 257 int i; \
213 for_each_possible_cpu(i) \ 258 for_each_possible_cpu(i) \
214 res += per_cpu_ptr(part->dkstats, i)->field; \ 259 res += per_cpu_ptr((part)->dkstats, i)->field; \
215 res; \ 260 res; \
216}) 261})
217 262
@@ -223,171 +268,107 @@ static inline void part_stat_set_all(struct hd_struct *part, int value)
223 memset(per_cpu_ptr(part->dkstats, i), value, 268 memset(per_cpu_ptr(part->dkstats, i), value,
224 sizeof(struct disk_stats)); 269 sizeof(struct disk_stats));
225} 270}
226
227#else /* !CONFIG_SMP */
228#define __disk_stat_add(gendiskp, field, addnd) \
229 (gendiskp->dkstats.field += addnd)
230#define disk_stat_read(gendiskp, field) (gendiskp->dkstats.field)
231 271
232static inline void disk_stat_set_all(struct gendisk *gendiskp, int value) 272static inline int init_part_stats(struct hd_struct *part)
233{ 273{
234 memset(&gendiskp->dkstats, value, sizeof (struct disk_stats)); 274 part->dkstats = alloc_percpu(struct disk_stats);
275 if (!part->dkstats)
276 return 0;
277 return 1;
235} 278}
236 279
237#define __part_stat_add(part, field, addnd) \ 280static inline void free_part_stats(struct hd_struct *part)
238 (part->dkstats.field += addnd)
239
240#define __all_stat_add(gendiskp, part, field, addnd, sector) \
241({ \
242 if (part) \
243 part->dkstats.field += addnd; \
244 __disk_stat_add(gendiskp, field, addnd); \
245})
246
247#define part_stat_read(part, field) (part->dkstats.field)
248
249static inline void part_stat_set_all(struct hd_struct *part, int value)
250{ 281{
251 memset(&part->dkstats, value, sizeof(struct disk_stats)); 282 free_percpu(part->dkstats);
252} 283}
253 284
254#endif /* CONFIG_SMP */ 285#else /* !CONFIG_SMP */
286#define part_stat_lock() ({ rcu_read_lock(); 0; })
287#define part_stat_unlock() rcu_read_unlock()
255 288
256#define disk_stat_add(gendiskp, field, addnd) \ 289#define __part_stat_add(cpu, part, field, addnd) \
257 do { \ 290 ((part)->dkstats.field += addnd)
258 preempt_disable(); \ 291
259 __disk_stat_add(gendiskp, field, addnd); \ 292#define part_stat_read(part, field) ((part)->dkstats.field)
260 preempt_enable(); \
261 } while (0)
262
263#define __disk_stat_dec(gendiskp, field) __disk_stat_add(gendiskp, field, -1)
264#define disk_stat_dec(gendiskp, field) disk_stat_add(gendiskp, field, -1)
265
266#define __disk_stat_inc(gendiskp, field) __disk_stat_add(gendiskp, field, 1)
267#define disk_stat_inc(gendiskp, field) disk_stat_add(gendiskp, field, 1)
268
269#define __disk_stat_sub(gendiskp, field, subnd) \
270 __disk_stat_add(gendiskp, field, -subnd)
271#define disk_stat_sub(gendiskp, field, subnd) \
272 disk_stat_add(gendiskp, field, -subnd)
273
274#define part_stat_add(gendiskp, field, addnd) \
275 do { \
276 preempt_disable(); \
277 __part_stat_add(gendiskp, field, addnd);\
278 preempt_enable(); \
279 } while (0)
280
281#define __part_stat_dec(gendiskp, field) __part_stat_add(gendiskp, field, -1)
282#define part_stat_dec(gendiskp, field) part_stat_add(gendiskp, field, -1)
283
284#define __part_stat_inc(gendiskp, field) __part_stat_add(gendiskp, field, 1)
285#define part_stat_inc(gendiskp, field) part_stat_add(gendiskp, field, 1)
286
287#define __part_stat_sub(gendiskp, field, subnd) \
288 __part_stat_add(gendiskp, field, -subnd)
289#define part_stat_sub(gendiskp, field, subnd) \
290 part_stat_add(gendiskp, field, -subnd)
291
292#define all_stat_add(gendiskp, part, field, addnd, sector) \
293 do { \
294 preempt_disable(); \
295 __all_stat_add(gendiskp, part, field, addnd, sector); \
296 preempt_enable(); \
297 } while (0)
298
299#define __all_stat_dec(gendiskp, field, sector) \
300 __all_stat_add(gendiskp, field, -1, sector)
301#define all_stat_dec(gendiskp, field, sector) \
302 all_stat_add(gendiskp, field, -1, sector)
303
304#define __all_stat_inc(gendiskp, part, field, sector) \
305 __all_stat_add(gendiskp, part, field, 1, sector)
306#define all_stat_inc(gendiskp, part, field, sector) \
307 all_stat_add(gendiskp, part, field, 1, sector)
308
309#define __all_stat_sub(gendiskp, part, field, subnd, sector) \
310 __all_stat_add(gendiskp, part, field, -subnd, sector)
311#define all_stat_sub(gendiskp, part, field, subnd, sector) \
312 all_stat_add(gendiskp, part, field, -subnd, sector)
313
314/* Inlines to alloc and free disk stats in struct gendisk */
315#ifdef CONFIG_SMP
316static inline int init_disk_stats(struct gendisk *disk)
317{
318 disk->dkstats = alloc_percpu(struct disk_stats);
319 if (!disk->dkstats)
320 return 0;
321 return 1;
322}
323 293
324static inline void free_disk_stats(struct gendisk *disk) 294static inline void part_stat_set_all(struct hd_struct *part, int value)
325{ 295{
326 free_percpu(disk->dkstats); 296 memset(&part->dkstats, value, sizeof(struct disk_stats));
327} 297}
328 298
329static inline int init_part_stats(struct hd_struct *part) 299static inline int init_part_stats(struct hd_struct *part)
330{ 300{
331 part->dkstats = alloc_percpu(struct disk_stats);
332 if (!part->dkstats)
333 return 0;
334 return 1; 301 return 1;
335} 302}
336 303
337static inline void free_part_stats(struct hd_struct *part) 304static inline void free_part_stats(struct hd_struct *part)
338{ 305{
339 free_percpu(part->dkstats);
340}
341
342#else /* CONFIG_SMP */
343static inline int init_disk_stats(struct gendisk *disk)
344{
345 return 1;
346} 306}
347 307
348static inline void free_disk_stats(struct gendisk *disk) 308#endif /* CONFIG_SMP */
349{
350}
351 309
352static inline int init_part_stats(struct hd_struct *part) 310#define part_stat_add(cpu, part, field, addnd) do { \
311 __part_stat_add((cpu), (part), field, addnd); \
312 if ((part)->partno) \
313 __part_stat_add((cpu), &part_to_disk((part))->part0, \
314 field, addnd); \
315} while (0)
316
317#define part_stat_dec(cpu, gendiskp, field) \
318 part_stat_add(cpu, gendiskp, field, -1)
319#define part_stat_inc(cpu, gendiskp, field) \
320 part_stat_add(cpu, gendiskp, field, 1)
321#define part_stat_sub(cpu, gendiskp, field, subnd) \
322 part_stat_add(cpu, gendiskp, field, -subnd)
323
324static inline void part_inc_in_flight(struct hd_struct *part)
353{ 325{
354 return 1; 326 part->in_flight++;
327 if (part->partno)
328 part_to_disk(part)->part0.in_flight++;
355} 329}
356 330
357static inline void free_part_stats(struct hd_struct *part) 331static inline void part_dec_in_flight(struct hd_struct *part)
358{ 332{
333 part->in_flight--;
334 if (part->partno)
335 part_to_disk(part)->part0.in_flight--;
359} 336}
360#endif /* CONFIG_SMP */
361 337
362/* drivers/block/ll_rw_blk.c */ 338/* drivers/block/ll_rw_blk.c */
363extern void disk_round_stats(struct gendisk *disk); 339extern void part_round_stats(int cpu, struct hd_struct *part);
364extern void part_round_stats(struct hd_struct *part);
365 340
366/* drivers/block/genhd.c */ 341/* drivers/block/genhd.c */
367extern int get_blkdev_list(char *, int); 342extern int get_blkdev_list(char *, int);
368extern void add_disk(struct gendisk *disk); 343extern void add_disk(struct gendisk *disk);
369extern void del_gendisk(struct gendisk *gp); 344extern void del_gendisk(struct gendisk *gp);
370extern void unlink_gendisk(struct gendisk *gp); 345extern void unlink_gendisk(struct gendisk *gp);
371extern struct gendisk *get_gendisk(dev_t dev, int *part); 346extern struct gendisk *get_gendisk(dev_t dev, int *partno);
347extern struct block_device *bdget_disk(struct gendisk *disk, int partno);
372 348
373extern void set_device_ro(struct block_device *bdev, int flag); 349extern void set_device_ro(struct block_device *bdev, int flag);
374extern void set_disk_ro(struct gendisk *disk, int flag); 350extern void set_disk_ro(struct gendisk *disk, int flag);
375 351
352static inline int get_disk_ro(struct gendisk *disk)
353{
354 return disk->part0.policy;
355}
356
376/* drivers/char/random.c */ 357/* drivers/char/random.c */
377extern void add_disk_randomness(struct gendisk *disk); 358extern void add_disk_randomness(struct gendisk *disk);
378extern void rand_initialize_disk(struct gendisk *disk); 359extern void rand_initialize_disk(struct gendisk *disk);
379 360
380static inline sector_t get_start_sect(struct block_device *bdev) 361static inline sector_t get_start_sect(struct block_device *bdev)
381{ 362{
382 return bdev->bd_contains == bdev ? 0 : bdev->bd_part->start_sect; 363 return bdev->bd_part->start_sect;
383} 364}
384static inline sector_t get_capacity(struct gendisk *disk) 365static inline sector_t get_capacity(struct gendisk *disk)
385{ 366{
386 return disk->capacity; 367 return disk->part0.nr_sects;
387} 368}
388static inline void set_capacity(struct gendisk *disk, sector_t size) 369static inline void set_capacity(struct gendisk *disk, sector_t size)
389{ 370{
390 disk->capacity = size; 371 disk->part0.nr_sects = size;
391} 372}
392 373
393#ifdef CONFIG_SOLARIS_X86_PARTITION 374#ifdef CONFIG_SOLARIS_X86_PARTITION
@@ -537,9 +518,12 @@ struct unixware_disklabel {
537#define ADDPART_FLAG_RAID 1 518#define ADDPART_FLAG_RAID 1
538#define ADDPART_FLAG_WHOLEDISK 2 519#define ADDPART_FLAG_WHOLEDISK 2
539 520
540extern dev_t blk_lookup_devt(const char *name, int part); 521extern int blk_alloc_devt(struct hd_struct *part, dev_t *devt);
541extern char *disk_name (struct gendisk *hd, int part, char *buf); 522extern void blk_free_devt(dev_t devt);
523extern dev_t blk_lookup_devt(const char *name, int partno);
524extern char *disk_name (struct gendisk *hd, int partno, char *buf);
542 525
526extern int disk_expand_part_tbl(struct gendisk *disk, int target);
543extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); 527extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev);
544extern int __must_check add_partition(struct gendisk *, int, sector_t, sector_t, int); 528extern int __must_check add_partition(struct gendisk *, int, sector_t, sector_t, int);
545extern void delete_partition(struct gendisk *, int); 529extern void delete_partition(struct gendisk *, int);
@@ -556,16 +540,23 @@ extern void blk_register_region(dev_t devt, unsigned long range,
556 void *data); 540 void *data);
557extern void blk_unregister_region(dev_t devt, unsigned long range); 541extern void blk_unregister_region(dev_t devt, unsigned long range);
558 542
559static inline struct block_device *bdget_disk(struct gendisk *disk, int index) 543extern ssize_t part_size_show(struct device *dev,
560{ 544 struct device_attribute *attr, char *buf);
561 return bdget(MKDEV(disk->major, disk->first_minor) + index); 545extern ssize_t part_stat_show(struct device *dev,
562} 546 struct device_attribute *attr, char *buf);
547#ifdef CONFIG_FAIL_MAKE_REQUEST
548extern ssize_t part_fail_show(struct device *dev,
549 struct device_attribute *attr, char *buf);
550extern ssize_t part_fail_store(struct device *dev,
551 struct device_attribute *attr,
552 const char *buf, size_t count);
553#endif /* CONFIG_FAIL_MAKE_REQUEST */
563 554
564#else /* CONFIG_BLOCK */ 555#else /* CONFIG_BLOCK */
565 556
566static inline void printk_all_partitions(void) { } 557static inline void printk_all_partitions(void) { }
567 558
568static inline dev_t blk_lookup_devt(const char *name, int part) 559static inline dev_t blk_lookup_devt(const char *name, int partno)
569{ 560{
570 dev_t devt = MKDEV(0, 0); 561 dev_t devt = MKDEV(0, 0);
571 return devt; 562 return devt;
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h
index c3c19f926e6f..14d0df0b5749 100644
--- a/include/linux/gfs2_ondisk.h
+++ b/include/linux/gfs2_ondisk.h
@@ -118,7 +118,11 @@ struct gfs2_sb {
118 118
119 char sb_lockproto[GFS2_LOCKNAME_LEN]; 119 char sb_lockproto[GFS2_LOCKNAME_LEN];
120 char sb_locktable[GFS2_LOCKNAME_LEN]; 120 char sb_locktable[GFS2_LOCKNAME_LEN];
121 /* In gfs1, quota and license dinodes followed */ 121
122 struct gfs2_inum __pad3; /* Was quota inode in gfs1 */
123 struct gfs2_inum __pad4; /* Was licence inode in gfs1 */
124#define GFS2_HAS_UUID 1
125 __u8 sb_uuid[16]; /* The UUID, maybe 0 for backwards compat */
122}; 126};
123 127
124/* 128/*
diff --git a/include/linux/harrier_defs.h b/include/linux/harrier_defs.h
deleted file mode 100644
index efef11db790f..000000000000
--- a/include/linux/harrier_defs.h
+++ /dev/null
@@ -1,212 +0,0 @@
1/*
2 * include/linux/harrier_defs.h
3 *
4 * Definitions for Motorola MCG Harrier North Bridge & Memory controller
5 *
6 * Author: Dale Farnsworth
7 * dale.farnsworth@mvista.com
8 *
9 * Extracted from asm-ppc/harrier.h by:
10 * Randy Vinson
11 * rvinson@mvista.com
12 *
13 * Copyright 2001-2002 MontaVista Software Inc.
14 *
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
19 */
20
21#ifndef __ASMPPC_HARRIER_DEFS_H
22#define __ASMPPC_HARRIER_DEFS_H
23
24#define HARRIER_DEFAULT_XCSR_BASE 0xfeff0000
25
26#define HARRIER_VEND_DEV_ID 0x1057480b
27
28#define HARRIER_VENI_OFF 0x00
29
30#define HARRIER_REVI_OFF 0x05
31#define HARRIER_UCTL_OFF 0xd0
32#define HARRIER_XTAL64_MASK 0x02
33
34#define HARRIER_MISC_CSR_OFF 0x1c
35#define HARRIER_RSTOUT 0x01000000
36#define HARRIER_SYSCON 0x08000000
37#define HARRIER_EREADY 0x10000000
38#define HARRIER_ERDYS 0x20000000
39
40/* Function exception registers */
41#define HARRIER_FEEN_OFF 0x40 /* enable */
42#define HARRIER_FEST_OFF 0x44 /* status */
43#define HARRIER_FEMA_OFF 0x48 /* mask */
44#define HARRIER_FECL_OFF 0x4c /* clear */
45
46#define HARRIER_FE_DMA 0x80
47#define HARRIER_FE_MIDB 0x40
48#define HARRIER_FE_MIM0 0x20
49#define HARRIER_FE_MIM1 0x10
50#define HARRIER_FE_MIP 0x08
51#define HARRIER_FE_UA0 0x04
52#define HARRIER_FE_UA1 0x02
53#define HARRIER_FE_ABT 0x01
54
55#define HARRIER_SERIAL_0_OFF 0xc0
56
57#define HARRIER_MBAR_OFF 0xe0
58#define HARRIER_MBAR_MSK 0xfffc0000
59#define HARRIER_MPIC_CSR_OFF 0xe4
60#define HARRIER_MPIC_OPI_ENABLE 0x40
61#define HARRIER_MPIC_IFEVP_OFF 0x10200
62#define HARRIER_MPIC_IFEVP_VECT_MSK 0xff
63#define HARRIER_MPIC_IFEDE_OFF 0x10210
64
65/*
66 * Define the Memory Controller register offsets.
67 */
68#define HARRIER_SDBA_OFF 0x110
69#define HARRIER_SDBB_OFF 0x114
70#define HARRIER_SDBC_OFF 0x118
71#define HARRIER_SDBD_OFF 0x11c
72#define HARRIER_SDBE_OFF 0x120
73#define HARRIER_SDBF_OFF 0x124
74#define HARRIER_SDBG_OFF 0x128
75#define HARRIER_SDBH_OFF 0x12c
76
77#define HARRIER_SDB_ENABLE 0x00000100
78#define HARRIER_SDB_SIZE_MASK 0xf
79#define HARRIER_SDB_SIZE_SHIFT 16
80#define HARRIER_SDB_BASE_MASK 0xff
81#define HARRIER_SDB_BASE_SHIFT 24
82
83/*
84 * Define outbound register offsets.
85 */
86#define HARRIER_OTAD0_OFF 0x220
87#define HARRIER_OTOF0_OFF 0x224
88#define HARRIER_OTAD1_OFF 0x228
89#define HARRIER_OTOF1_OFF 0x22c
90#define HARRIER_OTAD2_OFF 0x230
91#define HARRIER_OTOF2_OFF 0x234
92#define HARRIER_OTAD3_OFF 0x238
93#define HARRIER_OTOF3_OFF 0x23c
94
95#define HARRIER_OTADX_START_MSK 0xffff0000UL
96#define HARRIER_OTADX_END_MSK 0x0000ffffUL
97
98#define HARRIER_OTOFX_OFF_MSK 0xffff0000UL
99#define HARRIER_OTOFX_ENA 0x80UL
100#define HARRIER_OTOFX_WPE 0x10UL
101#define HARRIER_OTOFX_SGE 0x08UL
102#define HARRIER_OTOFX_RAE 0x04UL
103#define HARRIER_OTOFX_MEM 0x02UL
104#define HARRIER_OTOFX_IOM 0x01UL
105
106/*
107 * Define generic message passing register offsets
108 */
109/* Mirrored registers (visible from both PowerPC and PCI space) */
110#define HARRIER_XCSR_MP_BASE_OFF 0x290 /* base offset in XCSR space */
111#define HARRIER_PMEP_MP_BASE_OFF 0x100 /* base offset in PMEM space */
112#define HARRIER_MGOM0_OFF 0x00 /* outbound msg 0 */
113#define HARRIER_MGOM1_OFF 0x04 /* outbound msg 1 */
114#define HARRIER_MGOD_OFF 0x08 /* outbound doorbells */
115
116#define HARRIER_MGIM0_OFF 0x10 /* inbound msg 0 */
117#define HARRIER_MGIM1_OFF 0x14 /* inbound msg 1 */
118#define HARRIER_MGID_OFF 0x18 /* inbound doorbells */
119
120/* PowerPC-only registers */
121#define HARRIER_MGIDM_OFF 0x20 /* inbound doorbell mask */
122
123/* PCI-only registers */
124#define HARRIER_PMEP_MGST_OFF 0x20 /* (outbound) interrupt status */
125#define HARRIER_PMEP_MGMS_OFF 0x24 /* (outbound) interrupt mask */
126#define HARRIER_MG_OMI0 (1<<4)
127#define HARRIER_MG_OMI1 (1<<5)
128
129#define HARRIER_PMEP_MGODM_OFF 0x28 /* outbound doorbell mask */
130
131/*
132 * Define PCI configuration space register offsets
133 */
134#define HARRIER_XCSR_TO_PCFS_OFF 0x300
135
136/*
137 * Define message passing attribute register offset
138 */
139#define HARRIER_MPAT_OFF 0x44
140
141/*
142 * Define inbound attribute register offsets.
143 */
144#define HARRIER_ITSZ0_OFF 0x48
145#define HARRIER_ITAT0_OFF 0x4c
146
147#define HARRIER_ITSZ1_OFF 0x50
148#define HARRIER_ITAT1_OFF 0x54
149
150#define HARRIER_ITSZ2_OFF 0x58
151#define HARRIER_ITAT2_OFF 0x5c
152
153#define HARRIER_ITSZ3_OFF 0x60
154#define HARRIER_ITAT3_OFF 0x64
155
156/* inbound translation size constants */
157#define HARRIER_ITSZ_MSK 0xff
158#define HARRIER_ITSZ_4KB 0x00
159#define HARRIER_ITSZ_8KB 0x01
160#define HARRIER_ITSZ_16KB 0x02
161#define HARRIER_ITSZ_32KB 0x03
162#define HARRIER_ITSZ_64KB 0x04
163#define HARRIER_ITSZ_128KB 0x05
164#define HARRIER_ITSZ_256KB 0x06
165#define HARRIER_ITSZ_512KB 0x07
166#define HARRIER_ITSZ_1MB 0x08
167#define HARRIER_ITSZ_2MB 0x09
168#define HARRIER_ITSZ_4MB 0x0A
169#define HARRIER_ITSZ_8MB 0x0B
170#define HARRIER_ITSZ_16MB 0x0C
171#define HARRIER_ITSZ_32MB 0x0D
172#define HARRIER_ITSZ_64MB 0x0E
173#define HARRIER_ITSZ_128MB 0x0F
174#define HARRIER_ITSZ_256MB 0x10
175#define HARRIER_ITSZ_512MB 0x11
176#define HARRIER_ITSZ_1GB 0x12
177#define HARRIER_ITSZ_2GB 0x13
178
179/* inbound translation offset */
180#define HARRIER_ITOF_SHIFT 0x10
181#define HARRIER_ITOF_MSK 0xffff
182
183/* inbound translation atttributes */
184#define HARRIER_ITAT_PRE (1<<3)
185#define HARRIER_ITAT_RAE (1<<4)
186#define HARRIER_ITAT_WPE (1<<5)
187#define HARRIER_ITAT_MEM (1<<6)
188#define HARRIER_ITAT_ENA (1<<7)
189#define HARRIER_ITAT_GBL (1<<16)
190
191#define HARRIER_LBA_OFF 0x80
192#define HARRIER_LBA_MSK (1<<31)
193
194#define HARRIER_XCSR_SIZE 1024
195
196/* macros to calculate message passing register offsets */
197#define HARRIER_MP_XCSR(x) ((u32)HARRIER_XCSR_MP_BASE_OFF + (u32)x)
198
199#define HARRIER_MP_PMEP(x) ((u32)HARRIER_PMEP_MP_BASE_OFF + (u32)x)
200
201/*
202 * Define PCI configuration space register offsets
203 */
204#define HARRIER_MPBAR_OFF PCI_BASE_ADDRESS_0
205#define HARRIER_ITBAR0_OFF PCI_BASE_ADDRESS_1
206#define HARRIER_ITBAR1_OFF PCI_BASE_ADDRESS_2
207#define HARRIER_ITBAR2_OFF PCI_BASE_ADDRESS_3
208#define HARRIER_ITBAR3_OFF PCI_BASE_ADDRESS_4
209
210#define HARRIER_XCSR_CONFIG(x) ((u32)HARRIER_XCSR_TO_PCFS_OFF + (u32)x)
211
212#endif /* __ASMPPC_HARRIER_DEFS_H */
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 6d93dce61cbb..2f245fe63bda 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -47,14 +47,22 @@ enum hrtimer_restart {
47 * HRTIMER_CB_IRQSAFE: Callback may run in hardirq context 47 * HRTIMER_CB_IRQSAFE: Callback may run in hardirq context
48 * HRTIMER_CB_IRQSAFE_NO_RESTART: Callback may run in hardirq context and 48 * HRTIMER_CB_IRQSAFE_NO_RESTART: Callback may run in hardirq context and
49 * does not restart the timer 49 * does not restart the timer
50 * HRTIMER_CB_IRQSAFE_NO_SOFTIRQ: Callback must run in hardirq context 50 * HRTIMER_CB_IRQSAFE_PERCPU: Callback must run in hardirq context
51 * Special mode for tick emultation 51 * Special mode for tick emulation and
52 * scheduler timer. Such timers are per
53 * cpu and not allowed to be migrated on
54 * cpu unplug.
55 * HRTIMER_CB_IRQSAFE_UNLOCKED: Callback should run in hardirq context
56 * with timer->base lock unlocked
57 * used for timers which call wakeup to
58 * avoid lock order problems with rq->lock
52 */ 59 */
53enum hrtimer_cb_mode { 60enum hrtimer_cb_mode {
54 HRTIMER_CB_SOFTIRQ, 61 HRTIMER_CB_SOFTIRQ,
55 HRTIMER_CB_IRQSAFE, 62 HRTIMER_CB_IRQSAFE,
56 HRTIMER_CB_IRQSAFE_NO_RESTART, 63 HRTIMER_CB_IRQSAFE_NO_RESTART,
57 HRTIMER_CB_IRQSAFE_NO_SOFTIRQ, 64 HRTIMER_CB_IRQSAFE_PERCPU,
65 HRTIMER_CB_IRQSAFE_UNLOCKED,
58}; 66};
59 67
60/* 68/*
@@ -67,9 +75,10 @@ enum hrtimer_cb_mode {
67 * 0x02 callback function running 75 * 0x02 callback function running
68 * 0x04 callback pending (high resolution mode) 76 * 0x04 callback pending (high resolution mode)
69 * 77 *
70 * Special case: 78 * Special cases:
71 * 0x03 callback function running and enqueued 79 * 0x03 callback function running and enqueued
72 * (was requeued on another CPU) 80 * (was requeued on another CPU)
81 * 0x09 timer was migrated on CPU hotunplug
73 * The "callback function running and enqueued" status is only possible on 82 * The "callback function running and enqueued" status is only possible on
74 * SMP. It happens for example when a posix timer expired and the callback 83 * SMP. It happens for example when a posix timer expired and the callback
75 * queued a signal. Between dropping the lock which protects the posix timer 84 * queued a signal. Between dropping the lock which protects the posix timer
@@ -87,6 +96,7 @@ enum hrtimer_cb_mode {
87#define HRTIMER_STATE_ENQUEUED 0x01 96#define HRTIMER_STATE_ENQUEUED 0x01
88#define HRTIMER_STATE_CALLBACK 0x02 97#define HRTIMER_STATE_CALLBACK 0x02
89#define HRTIMER_STATE_PENDING 0x04 98#define HRTIMER_STATE_PENDING 0x04
99#define HRTIMER_STATE_MIGRATE 0x08
90 100
91/** 101/**
92 * struct hrtimer - the basic hrtimer structure 102 * struct hrtimer - the basic hrtimer structure
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 9a71d4cc88c8..32e0ef0f6e1f 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -273,7 +273,10 @@ struct hstate {};
273#define huge_page_mask(h) PAGE_MASK 273#define huge_page_mask(h) PAGE_MASK
274#define huge_page_order(h) 0 274#define huge_page_order(h) 0
275#define huge_page_shift(h) PAGE_SHIFT 275#define huge_page_shift(h) PAGE_SHIFT
276#define pages_per_huge_page(h) 1 276static inline unsigned int pages_per_huge_page(struct hstate *h)
277{
278 return 1;
279}
277#endif 280#endif
278 281
279#endif /* _LINUX_HUGETLB_H */ 282#endif /* _LINUX_HUGETLB_H */
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h
index 4862398e05bf..bf34c5f4c051 100644
--- a/include/linux/i2c-id.h
+++ b/include/linux/i2c-id.h
@@ -39,7 +39,6 @@
39#define I2C_DRIVERID_SAA7111A 8 /* video input processor */ 39#define I2C_DRIVERID_SAA7111A 8 /* video input processor */
40#define I2C_DRIVERID_SAA7185B 13 /* video encoder */ 40#define I2C_DRIVERID_SAA7185B 13 /* video encoder */
41#define I2C_DRIVERID_SAA7110 22 /* video decoder */ 41#define I2C_DRIVERID_SAA7110 22 /* video decoder */
42#define I2C_DRIVERID_MGATVO 23 /* Matrox TVOut */
43#define I2C_DRIVERID_SAA5249 24 /* SAA5249 and compatibles */ 42#define I2C_DRIVERID_SAA5249 24 /* SAA5249 and compatibles */
44#define I2C_DRIVERID_PCF8583 25 /* real time clock */ 43#define I2C_DRIVERID_PCF8583 25 /* real time clock */
45#define I2C_DRIVERID_SAB3036 26 /* SAB3036 tuner */ 44#define I2C_DRIVERID_SAB3036 26 /* SAB3036 tuner */
@@ -95,7 +94,6 @@
95#define I2C_HW_B_BT848 0x010005 /* BT848 video boards */ 94#define I2C_HW_B_BT848 0x010005 /* BT848 video boards */
96#define I2C_HW_B_VIA 0x010007 /* Via vt82c586b */ 95#define I2C_HW_B_VIA 0x010007 /* Via vt82c586b */
97#define I2C_HW_B_HYDRA 0x010008 /* Apple Hydra Mac I/O */ 96#define I2C_HW_B_HYDRA 0x010008 /* Apple Hydra Mac I/O */
98#define I2C_HW_B_G400 0x010009 /* Matrox G400 */
99#define I2C_HW_B_I810 0x01000a /* Intel I810 */ 97#define I2C_HW_B_I810 0x01000a /* Intel I810 */
100#define I2C_HW_B_VOO 0x01000b /* 3dfx Voodoo 3 / Banshee */ 98#define I2C_HW_B_VOO 0x01000b /* 3dfx Voodoo 3 / Banshee */
101#define I2C_HW_B_SCX200 0x01000e /* Nat'l Semi SCx200 I2C */ 99#define I2C_HW_B_SCX200 0x01000e /* Nat'l Semi SCx200 I2C */
diff --git a/include/linux/i2c-pnx.h b/include/linux/i2c-pnx.h
index e6e9c814da61..f13255e06406 100644
--- a/include/linux/i2c-pnx.h
+++ b/include/linux/i2c-pnx.h
@@ -12,7 +12,9 @@
12#ifndef __I2C_PNX_H__ 12#ifndef __I2C_PNX_H__
13#define __I2C_PNX_H__ 13#define __I2C_PNX_H__
14 14
15#include <asm/arch/i2c.h> 15#include <linux/pm.h>
16
17struct platform_device;
16 18
17struct i2c_pnx_mif { 19struct i2c_pnx_mif {
18 int ret; /* Return value */ 20 int ret; /* Return value */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 08be0d21864c..06115128047f 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -97,7 +97,19 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client * client,
97 97
98/** 98/**
99 * struct i2c_driver - represent an I2C device driver 99 * struct i2c_driver - represent an I2C device driver
100 * @id: Unique driver ID (optional)
100 * @class: What kind of i2c device we instantiate (for detect) 101 * @class: What kind of i2c device we instantiate (for detect)
102 * @attach_adapter: Callback for bus addition (for legacy drivers)
103 * @detach_adapter: Callback for bus removal (for legacy drivers)
104 * @detach_client: Callback for device removal (for legacy drivers)
105 * @probe: Callback for device binding (new-style drivers)
106 * @remove: Callback for device unbinding (new-style drivers)
107 * @shutdown: Callback for device shutdown
108 * @suspend: Callback for device suspend
109 * @resume: Callback for device resume
110 * @command: Callback for bus-wide signaling (optional)
111 * @driver: Device driver model driver
112 * @id_table: List of I2C devices supported by this driver
101 * @detect: Callback for device detection 113 * @detect: Callback for device detection
102 * @address_data: The I2C addresses to probe, ignore or force (for detect) 114 * @address_data: The I2C addresses to probe, ignore or force (for detect)
103 * @clients: List of detected clients we created (for i2c-core use only) 115 * @clients: List of detected clients we created (for i2c-core use only)
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index 7d51cbca49ab..75ae6d8aba4f 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -758,7 +758,7 @@ static inline dma_addr_t i2o_dma_map_single(struct i2o_controller *c, void *ptr,
758 } 758 }
759 759
760 dma_addr = dma_map_single(&c->pdev->dev, ptr, size, direction); 760 dma_addr = dma_map_single(&c->pdev->dev, ptr, size, direction);
761 if (!dma_mapping_error(dma_addr)) { 761 if (!dma_mapping_error(&c->pdev->dev, dma_addr)) {
762#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64 762#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
763 if ((sizeof(dma_addr_t) > 4) && c->pae_support) { 763 if ((sizeof(dma_addr_t) > 4) && c->pae_support) {
764 *mptr++ = cpu_to_le32(0x7C020002); 764 *mptr++ = cpu_to_le32(0x7C020002);
diff --git a/include/linux/ide.h b/include/linux/ide.h
index b846bc44a27e..a9d82d6e6bdd 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -8,7 +8,7 @@
8 8
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/ioport.h> 10#include <linux/ioport.h>
11#include <linux/hdreg.h> 11#include <linux/ata.h>
12#include <linux/blkdev.h> 12#include <linux/blkdev.h>
13#include <linux/proc_fs.h> 13#include <linux/proc_fs.h>
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
@@ -17,6 +17,7 @@
17#include <linux/device.h> 17#include <linux/device.h>
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/completion.h> 19#include <linux/completion.h>
20#include <linux/pm.h>
20#ifdef CONFIG_BLK_DEV_IDEACPI 21#ifdef CONFIG_BLK_DEV_IDEACPI
21#include <acpi/acpi.h> 22#include <acpi/acpi.h>
22#endif 23#endif
@@ -87,12 +88,13 @@ struct ide_io_ports {
87}; 88};
88 89
89#define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good)) 90#define OK_STAT(stat,good,bad) (((stat)&((good)|(bad)))==(good))
90#define BAD_R_STAT (BUSY_STAT | ERR_STAT)
91#define BAD_W_STAT (BAD_R_STAT | WRERR_STAT)
92#define BAD_STAT (BAD_R_STAT | DRQ_STAT)
93#define DRIVE_READY (READY_STAT | SEEK_STAT)
94 91
95#define BAD_CRC (ABRT_ERR | ICRC_ERR) 92#define BAD_R_STAT (ATA_BUSY | ATA_ERR)
93#define BAD_W_STAT (BAD_R_STAT | ATA_DF)
94#define BAD_STAT (BAD_R_STAT | ATA_DRQ)
95#define DRIVE_READY (ATA_DRDY | ATA_DSC)
96
97#define BAD_CRC (ATA_ABORTED | ATA_ICRC)
96 98
97#define SATA_NR_PORTS (3) /* 16 possible ?? */ 99#define SATA_NR_PORTS (3) /* 16 possible ?? */
98 100
@@ -125,24 +127,41 @@ struct ide_io_ports {
125#define PARTN_BITS 6 /* number of minor dev bits for partitions */ 127#define PARTN_BITS 6 /* number of minor dev bits for partitions */
126#define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */ 128#define MAX_DRIVES 2 /* per interface; 2 assumed by lots of code */
127#define SECTOR_SIZE 512 129#define SECTOR_SIZE 512
128#define SECTOR_WORDS (SECTOR_SIZE / 4) /* number of 32bit words per sector */ 130
129#define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t))) 131#define IDE_LARGE_SEEK(b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t)))
130 132
131/* 133/*
132 * Timeouts for various operations: 134 * Timeouts for various operations:
133 */ 135 */
134#define WAIT_DRQ (HZ/10) /* 100msec - spec allows up to 20ms */ 136enum {
135#define WAIT_READY (5*HZ) /* 5sec - some laptops are very slow */ 137 /* spec allows up to 20ms */
136#define WAIT_PIDENTIFY (10*HZ) /* 10sec - should be less than 3ms (?), if all ATAPI CD is closed at boot */ 138 WAIT_DRQ = HZ / 10, /* 100ms */
137#define WAIT_WORSTCASE (30*HZ) /* 30sec - worst case when spinning up */ 139 /* some laptops are very slow */
138#define WAIT_CMD (10*HZ) /* 10sec - maximum wait for an IRQ to happen */ 140 WAIT_READY = 5 * HZ, /* 5s */
139#define WAIT_MIN_SLEEP (2*HZ/100) /* 20msec - minimum sleep time */ 141 /* should be less than 3ms (?), if all ATAPI CD is closed at boot */
142 WAIT_PIDENTIFY = 10 * HZ, /* 10s */
143 /* worst case when spinning up */
144 WAIT_WORSTCASE = 30 * HZ, /* 30s */
145 /* maximum wait for an IRQ to happen */
146 WAIT_CMD = 10 * HZ, /* 10s */
147 /* Some drives require a longer IRQ timeout. */
148 WAIT_FLOPPY_CMD = 50 * HZ, /* 50s */
149 /*
150 * Some drives (for example, Seagate STT3401A Travan) require a very
151 * long timeout, because they don't return an interrupt or clear their
152 * BSY bit until after the command completes (even retension commands).
153 */
154 WAIT_TAPE_CMD = 900 * HZ, /* 900s */
155 /* minimum sleep time */
156 WAIT_MIN_SLEEP = HZ / 50, /* 20ms */
157};
140 158
141/* 159/*
142 * Op codes for special requests to be handled by ide_special_rq(). 160 * Op codes for special requests to be handled by ide_special_rq().
143 * Values should be in the range of 0x20 to 0x3f. 161 * Values should be in the range of 0x20 to 0x3f.
144 */ 162 */
145#define REQ_DRIVE_RESET 0x20 163#define REQ_DRIVE_RESET 0x20
164#define REQ_DEVSET_EXEC 0x21
146 165
147/* 166/*
148 * Check for an interrupt and acknowledge the interrupt status 167 * Check for an interrupt and acknowledge the interrupt status
@@ -219,18 +238,7 @@ static inline int __ide_default_irq(unsigned long base)
219#include <asm-generic/ide_iops.h> 238#include <asm-generic/ide_iops.h>
220#endif 239#endif
221 240
222#ifndef MAX_HWIFS 241#define MAX_HWIFS 10
223#if defined(CONFIG_BLACKFIN) || defined(CONFIG_H8300) || defined(CONFIG_XTENSA)
224# define MAX_HWIFS 1
225#else
226# define MAX_HWIFS 10
227#endif
228#endif
229
230#if !defined(MAX_HWIFS) || defined(CONFIG_EMBEDDED)
231#undef MAX_HWIFS
232#define MAX_HWIFS CONFIG_IDE_MAX_HWIFS
233#endif
234 242
235/* Currently only m68k, apus and m8xx need it */ 243/* Currently only m68k, apus and m8xx need it */
236#ifndef IDE_ARCH_ACK_INTR 244#ifndef IDE_ARCH_ACK_INTR
@@ -314,8 +322,8 @@ typedef enum {
314 ide_started, /* a drive operation was started, handler was set */ 322 ide_started, /* a drive operation was started, handler was set */
315} ide_startstop_t; 323} ide_startstop_t;
316 324
325struct ide_devset;
317struct ide_driver_s; 326struct ide_driver_s;
318struct ide_settings_s;
319 327
320#ifdef CONFIG_BLK_DEV_IDEACPI 328#ifdef CONFIG_BLK_DEV_IDEACPI
321struct ide_acpi_drive_link; 329struct ide_acpi_drive_link;
@@ -326,10 +334,10 @@ struct ide_acpi_hwif_link;
326enum { 334enum {
327 IDE_AFLAG_DRQ_INTERRUPT = (1 << 0), 335 IDE_AFLAG_DRQ_INTERRUPT = (1 << 0),
328 IDE_AFLAG_MEDIA_CHANGED = (1 << 1), 336 IDE_AFLAG_MEDIA_CHANGED = (1 << 1),
329
330 /* ide-cd */
331 /* Drive cannot lock the door. */ 337 /* Drive cannot lock the door. */
332 IDE_AFLAG_NO_DOORLOCK = (1 << 2), 338 IDE_AFLAG_NO_DOORLOCK = (1 << 2),
339
340 /* ide-cd */
333 /* Drive cannot eject the disc. */ 341 /* Drive cannot eject the disc. */
334 IDE_AFLAG_NO_EJECT = (1 << 3), 342 IDE_AFLAG_NO_EJECT = (1 << 3),
335 /* Drive is a pre ATAPI 1.2 drive. */ 343 /* Drive is a pre ATAPI 1.2 drive. */
@@ -365,19 +373,25 @@ enum {
365 IDE_AFLAG_CLIK_DRIVE = (1 << 19), 373 IDE_AFLAG_CLIK_DRIVE = (1 << 19),
366 /* Requires BH algorithm for packets */ 374 /* Requires BH algorithm for packets */
367 IDE_AFLAG_ZIP_DRIVE = (1 << 20), 375 IDE_AFLAG_ZIP_DRIVE = (1 << 20),
376 /* Write protect */
377 IDE_AFLAG_WP = (1 << 21),
378 /* Supports format progress report */
379 IDE_AFLAG_SRFP = (1 << 22),
368 380
369 /* ide-tape */ 381 /* ide-tape */
370 IDE_AFLAG_IGNORE_DSC = (1 << 21), 382 IDE_AFLAG_IGNORE_DSC = (1 << 23),
371 /* 0 When the tape position is unknown */ 383 /* 0 When the tape position is unknown */
372 IDE_AFLAG_ADDRESS_VALID = (1 << 22), 384 IDE_AFLAG_ADDRESS_VALID = (1 << 24),
373 /* Device already opened */ 385 /* Device already opened */
374 IDE_AFLAG_BUSY = (1 << 23), 386 IDE_AFLAG_BUSY = (1 << 25),
375 /* Attempt to auto-detect the current user block size */ 387 /* Attempt to auto-detect the current user block size */
376 IDE_AFLAG_DETECT_BS = (1 << 24), 388 IDE_AFLAG_DETECT_BS = (1 << 26),
377 /* Currently on a filemark */ 389 /* Currently on a filemark */
378 IDE_AFLAG_FILEMARK = (1 << 25), 390 IDE_AFLAG_FILEMARK = (1 << 27),
379 /* 0 = no tape is loaded, so we don't rewind after ejecting */ 391 /* 0 = no tape is loaded, so we don't rewind after ejecting */
380 IDE_AFLAG_MEDIUM_PRESENT = (1 << 26) 392 IDE_AFLAG_MEDIUM_PRESENT = (1 << 28),
393
394 IDE_AFLAG_NO_AUTOCLOSE = (1 << 29),
381}; 395};
382 396
383struct ide_drive_s { 397struct ide_drive_s {
@@ -389,10 +403,10 @@ struct ide_drive_s {
389 struct request *rq; /* current request */ 403 struct request *rq; /* current request */
390 struct ide_drive_s *next; /* circular list of hwgroup drives */ 404 struct ide_drive_s *next; /* circular list of hwgroup drives */
391 void *driver_data; /* extra driver data */ 405 void *driver_data; /* extra driver data */
392 struct hd_driveid *id; /* drive model identification info */ 406 u16 *id; /* identification info */
393#ifdef CONFIG_IDE_PROC_FS 407#ifdef CONFIG_IDE_PROC_FS
394 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */ 408 struct proc_dir_entry *proc; /* /proc/ide/ directory entry */
395 struct ide_settings_s *settings;/* /proc/ide/ drive settings */ 409 const struct ide_proc_devset *settings; /* /proc/ide/ drive settings */
396#endif 410#endif
397 struct hwif_s *hwif; /* actually (ide_hwif_t *) */ 411 struct hwif_s *hwif; /* actually (ide_hwif_t *) */
398 412
@@ -404,16 +418,16 @@ struct ide_drive_s {
404 special_t special; /* special action flags */ 418 special_t special; /* special action flags */
405 select_t select; /* basic drive/head select reg value */ 419 select_t select; /* basic drive/head select reg value */
406 420
407 u8 keep_settings; /* restore settings after drive reset */
408 u8 using_dma; /* disk is using dma for read/write */
409 u8 retry_pio; /* retrying dma capable host in pio */ 421 u8 retry_pio; /* retrying dma capable host in pio */
410 u8 state; /* retry state */ 422 u8 state; /* retry state */
411 u8 waiting_for_dma; /* dma currently in progress */ 423 u8 waiting_for_dma; /* dma currently in progress */
412 u8 unmask; /* okay to unmask other irqs */
413 u8 noflush; /* don't attempt flushes */
414 u8 dsc_overlap; /* DSC overlap */
415 u8 nice1; /* give potential excess bandwidth */
416 424
425 unsigned keep_settings : 1; /* restore settings after drive reset */
426 unsigned using_dma : 1; /* disk is using dma for read/write */
427 unsigned unmask : 1; /* okay to unmask other irqs */
428 unsigned noflush : 1; /* don't attempt flushes */
429 unsigned dsc_overlap : 1; /* DSC overlap */
430 unsigned nice1 : 1; /* give potential excess bandwidth */
417 unsigned present : 1; /* drive is physically present */ 431 unsigned present : 1; /* drive is physically present */
418 unsigned dead : 1; /* device ejected hint */ 432 unsigned dead : 1; /* device ejected hint */
419 unsigned id_read : 1; /* 1=id read from disk 0 = synthetic */ 433 unsigned id_read : 1; /* 1=id read from disk 0 = synthetic */
@@ -423,23 +437,22 @@ struct ide_drive_s {
423 unsigned forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */ 437 unsigned forced_geom : 1; /* 1 if hdx=c,h,s was given at boot */
424 unsigned no_unmask : 1; /* disallow setting unmask bit */ 438 unsigned no_unmask : 1; /* disallow setting unmask bit */
425 unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */ 439 unsigned no_io_32bit : 1; /* disallow enabling 32bit I/O */
426 unsigned atapi_overlap : 1; /* ATAPI overlap (not supported) */
427 unsigned doorlocking : 1; /* for removable only: door lock/unlock works */ 440 unsigned doorlocking : 1; /* for removable only: door lock/unlock works */
428 unsigned nodma : 1; /* disallow DMA */ 441 unsigned nodma : 1; /* disallow DMA */
429 unsigned remap_0_to_1 : 1; /* 0=noremap, 1=remap 0->1 (for EZDrive) */
430 unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */ 442 unsigned blocked : 1; /* 1=powermanagment told us not to do anything, so sleep nicely */
431 unsigned scsi : 1; /* 0=default, 1=ide-scsi emulation */ 443 unsigned scsi : 1; /* 0=default, 1=ide-scsi emulation */
432 unsigned sleeping : 1; /* 1=sleeping & sleep field valid */ 444 unsigned sleeping : 1; /* 1=sleeping & sleep field valid */
433 unsigned post_reset : 1; 445 unsigned post_reset : 1;
434 unsigned udma33_warned : 1; 446 unsigned udma33_warned : 1;
447 unsigned addressing : 2; /* 0=28-bit, 1=48-bit, 2=48-bit doing 28-bit */
448 unsigned wcache : 1; /* status of write cache */
449 unsigned nowerr : 1; /* used for ignoring ATA_DF */
435 450
436 u8 addressing; /* 0=28-bit, 1=48-bit, 2=48-bit doing 28-bit */
437 u8 quirk_list; /* considered quirky, set for a specific host */ 451 u8 quirk_list; /* considered quirky, set for a specific host */
438 u8 init_speed; /* transfer rate set at boot */ 452 u8 init_speed; /* transfer rate set at boot */
439 u8 current_speed; /* current transfer rate set */ 453 u8 current_speed; /* current transfer rate set */
440 u8 desired_speed; /* desired transfer rate set */ 454 u8 desired_speed; /* desired transfer rate set */
441 u8 dn; /* now wide spread use */ 455 u8 dn; /* now wide spread use */
442 u8 wcache; /* status of write cache */
443 u8 acoustic; /* acoustic management */ 456 u8 acoustic; /* acoustic management */
444 u8 media; /* disk, cdrom, tape, floppy, ... */ 457 u8 media; /* disk, cdrom, tape, floppy, ... */
445 u8 ready_stat; /* min status value for drive ready */ 458 u8 ready_stat; /* min status value for drive ready */
@@ -447,9 +460,7 @@ struct ide_drive_s {
447 u8 mult_req; /* requested multiple sector setting */ 460 u8 mult_req; /* requested multiple sector setting */
448 u8 tune_req; /* requested drive tuning setting */ 461 u8 tune_req; /* requested drive tuning setting */
449 u8 io_32bit; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */ 462 u8 io_32bit; /* 0=16-bit, 1=32-bit, 2/3=32bit+sync */
450 u8 bad_wstat; /* used for ignoring WRERR_STAT */ 463 u8 bad_wstat; /* used for ignoring ATA_DF */
451 u8 nowerr; /* used for ignoring WRERR_STAT */
452 u8 sect0; /* offset of first sector for DM6:DDO */
453 u8 head; /* "real" number of heads */ 464 u8 head; /* "real" number of heads */
454 u8 sect; /* "real" sectors per track */ 465 u8 sect; /* "real" sectors per track */
455 u8 bios_head; /* BIOS/fdisk/LILO number of heads */ 466 u8 bios_head; /* BIOS/fdisk/LILO number of heads */
@@ -483,10 +494,6 @@ typedef struct ide_drive_s ide_drive_t;
483 494
484#define to_ide_device(dev)container_of(dev, ide_drive_t, gendev) 495#define to_ide_device(dev)container_of(dev, ide_drive_t, gendev)
485 496
486#define IDE_CHIPSET_PCI_MASK \
487 ((1<<ide_pci)|(1<<ide_cmd646)|(1<<ide_ali14xx))
488#define IDE_CHIPSET_IS_PCI(c) ((IDE_CHIPSET_PCI_MASK >> (c)) & 1)
489
490struct ide_task_s; 497struct ide_task_s;
491struct ide_port_info; 498struct ide_port_info;
492 499
@@ -509,24 +516,33 @@ struct ide_tp_ops {
509 516
510extern const struct ide_tp_ops default_tp_ops; 517extern const struct ide_tp_ops default_tp_ops;
511 518
519/**
520 * struct ide_port_ops - IDE port operations
521 *
522 * @init_dev: host specific initialization of a device
523 * @set_pio_mode: routine to program host for PIO mode
524 * @set_dma_mode: routine to program host for DMA mode
525 * @selectproc: tweaks hardware to select drive
526 * @reset_poll: chipset polling based on hba specifics
527 * @pre_reset: chipset specific changes to default for device-hba resets
528 * @resetproc: routine to reset controller after a disk reset
529 * @maskproc: special host masking for drive selection
530 * @quirkproc: check host's drive quirk list
531 *
532 * @mdma_filter: filter MDMA modes
533 * @udma_filter: filter UDMA modes
534 *
535 * @cable_detect: detect cable type
536 */
512struct ide_port_ops { 537struct ide_port_ops {
513 /* host specific initialization of a device */
514 void (*init_dev)(ide_drive_t *); 538 void (*init_dev)(ide_drive_t *);
515 /* routine to program host for PIO mode */
516 void (*set_pio_mode)(ide_drive_t *, const u8); 539 void (*set_pio_mode)(ide_drive_t *, const u8);
517 /* routine to program host for DMA mode */
518 void (*set_dma_mode)(ide_drive_t *, const u8); 540 void (*set_dma_mode)(ide_drive_t *, const u8);
519 /* tweaks hardware to select drive */
520 void (*selectproc)(ide_drive_t *); 541 void (*selectproc)(ide_drive_t *);
521 /* chipset polling based on hba specifics */
522 int (*reset_poll)(ide_drive_t *); 542 int (*reset_poll)(ide_drive_t *);
523 /* chipset specific changes to default for device-hba resets */
524 void (*pre_reset)(ide_drive_t *); 543 void (*pre_reset)(ide_drive_t *);
525 /* routine to reset controller after a disk reset */
526 void (*resetproc)(ide_drive_t *); 544 void (*resetproc)(ide_drive_t *);
527 /* special host masking for drive selection */
528 void (*maskproc)(ide_drive_t *, int); 545 void (*maskproc)(ide_drive_t *, int);
529 /* check host's drive quirk list */
530 void (*quirkproc)(ide_drive_t *); 546 void (*quirkproc)(ide_drive_t *);
531 547
532 u8 (*mdma_filter)(ide_drive_t *); 548 u8 (*mdma_filter)(ide_drive_t *);
@@ -567,7 +583,6 @@ typedef struct hwif_s {
567 u8 major; /* our major number */ 583 u8 major; /* our major number */
568 u8 index; /* 0 for ide0; 1 for ide1; ... */ 584 u8 index; /* 0 for ide0; 1 for ide1; ... */
569 u8 channel; /* for dual-port chips: 0=primary, 1=secondary */ 585 u8 channel; /* for dual-port chips: 0=primary, 1=secondary */
570 u8 bus_state; /* power state of the IDE bus */
571 586
572 u32 host_flags; 587 u32 host_flags;
573 588
@@ -645,6 +660,7 @@ struct ide_host {
645 ide_hwif_t *ports[MAX_HWIFS]; 660 ide_hwif_t *ports[MAX_HWIFS];
646 unsigned int n_ports; 661 unsigned int n_ports;
647 struct device *dev[2]; 662 struct device *dev[2];
663 unsigned int (*init_chipset)(struct pci_dev *);
648 unsigned long host_flags; 664 unsigned long host_flags;
649 void *host_priv; 665 void *host_priv;
650}; 666};
@@ -692,9 +708,61 @@ typedef struct ide_driver_s ide_driver_t;
692 708
693extern struct mutex ide_setting_mtx; 709extern struct mutex ide_setting_mtx;
694 710
695int set_io_32bit(ide_drive_t *, int); 711/*
696int set_pio_mode(ide_drive_t *, int); 712 * configurable drive settings
697int set_using_dma(ide_drive_t *, int); 713 */
714
715#define DS_SYNC (1 << 0)
716
717struct ide_devset {
718 int (*get)(ide_drive_t *);
719 int (*set)(ide_drive_t *, int);
720 unsigned int flags;
721};
722
723#define __DEVSET(_flags, _get, _set) { \
724 .flags = _flags, \
725 .get = _get, \
726 .set = _set, \
727}
728
729#define ide_devset_get(name, field) \
730static int get_##name(ide_drive_t *drive) \
731{ \
732 return drive->field; \
733}
734
735#define ide_devset_set(name, field) \
736static int set_##name(ide_drive_t *drive, int arg) \
737{ \
738 drive->field = arg; \
739 return 0; \
740}
741
742#define __IDE_DEVSET(_name, _flags, _get, _set) \
743const struct ide_devset ide_devset_##_name = \
744 __DEVSET(_flags, _get, _set)
745
746#define IDE_DEVSET(_name, _flags, _get, _set) \
747static __IDE_DEVSET(_name, _flags, _get, _set)
748
749#define ide_devset_rw(_name, _func) \
750IDE_DEVSET(_name, 0, get_##_func, set_##_func)
751
752#define ide_devset_w(_name, _func) \
753IDE_DEVSET(_name, 0, NULL, set_##_func)
754
755#define ide_devset_rw_sync(_name, _func) \
756IDE_DEVSET(_name, DS_SYNC, get_##_func, set_##_func)
757
758#define ide_decl_devset(_name) \
759extern const struct ide_devset ide_devset_##_name
760
761ide_decl_devset(io_32bit);
762ide_decl_devset(keepsettings);
763ide_decl_devset(pio_mode);
764ide_decl_devset(unmaskirq);
765ide_decl_devset(using_dma);
698 766
699/* ATAPI packet command flags */ 767/* ATAPI packet command flags */
700enum { 768enum {
@@ -710,6 +778,12 @@ enum {
710 PC_FLAG_TIMEDOUT = (1 << 7), 778 PC_FLAG_TIMEDOUT = (1 << 7),
711}; 779};
712 780
781/*
782 * With each packet command, we allocate a buffer of IDE_PC_BUFFER_SIZE bytes.
783 * This is used for several packet commands (not for READ/WRITE commands).
784 */
785#define IDE_PC_BUFFER_SIZE 256
786
713struct ide_atapi_pc { 787struct ide_atapi_pc {
714 /* actual packet bytes */ 788 /* actual packet bytes */
715 u8 c[12]; 789 u8 c[12];
@@ -739,7 +813,7 @@ struct ide_atapi_pc {
739 * those are more or less driver-specific and some of them are subject 813 * those are more or less driver-specific and some of them are subject
740 * to change/removal later. 814 * to change/removal later.
741 */ 815 */
742 u8 pc_buf[256]; 816 u8 pc_buf[IDE_PC_BUFFER_SIZE];
743 817
744 /* idetape only */ 818 /* idetape only */
745 struct idetape_bh *bh; 819 struct idetape_bh *bh;
@@ -757,37 +831,34 @@ struct ide_atapi_pc {
757 831
758#ifdef CONFIG_IDE_PROC_FS 832#ifdef CONFIG_IDE_PROC_FS
759/* 833/*
760 * configurable drive settings 834 * /proc/ide interface
761 */ 835 */
762 836
763#define TYPE_INT 0 837#define ide_devset_rw_field(_name, _field) \
764#define TYPE_BYTE 1 838ide_devset_get(_name, _field); \
765#define TYPE_SHORT 2 839ide_devset_set(_name, _field); \
840IDE_DEVSET(_name, DS_SYNC, get_##_name, set_##_name)
841
842struct ide_proc_devset {
843 const char *name;
844 const struct ide_devset *setting;
845 int min, max;
846 int (*mulf)(ide_drive_t *);
847 int (*divf)(ide_drive_t *);
848};
766 849
767#define SETTING_READ (1 << 0) 850#define __IDE_PROC_DEVSET(_name, _min, _max, _mulf, _divf) { \
768#define SETTING_WRITE (1 << 1) 851 .name = __stringify(_name), \
769#define SETTING_RW (SETTING_READ | SETTING_WRITE) 852 .setting = &ide_devset_##_name, \
853 .min = _min, \
854 .max = _max, \
855 .mulf = _mulf, \
856 .divf = _divf, \
857}
770 858
771typedef int (ide_procset_t)(ide_drive_t *, int); 859#define IDE_PROC_DEVSET(_name, _min, _max) \
772typedef struct ide_settings_s { 860__IDE_PROC_DEVSET(_name, _min, _max, NULL, NULL)
773 char *name;
774 int rw;
775 int data_type;
776 int min;
777 int max;
778 int mul_factor;
779 int div_factor;
780 void *data;
781 ide_procset_t *set;
782 int auto_remove;
783 struct ide_settings_s *next;
784} ide_settings_t;
785
786int ide_add_setting(ide_drive_t *, const char *, int, int, int, int, int, int, void *, ide_procset_t *set);
787 861
788/*
789 * /proc/ide interface
790 */
791typedef struct { 862typedef struct {
792 const char *name; 863 const char *name;
793 mode_t mode; 864 mode_t mode;
@@ -804,8 +875,6 @@ void ide_proc_unregister_port(ide_hwif_t *);
804void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); 875void ide_proc_register_driver(ide_drive_t *, ide_driver_t *);
805void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); 876void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *);
806 877
807void ide_add_generic_settings(ide_drive_t *);
808
809read_proc_t proc_ide_read_capacity; 878read_proc_t proc_ide_read_capacity;
810read_proc_t proc_ide_read_geometry; 879read_proc_t proc_ide_read_geometry;
811 880
@@ -833,7 +902,6 @@ static inline void ide_proc_unregister_device(ide_drive_t *drive) { ; }
833static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } 902static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; }
834static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 903static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
835static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 904static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
836static inline void ide_add_generic_settings(ide_drive_t *drive) { ; }
837#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0; 905#define PROC_IDE_READ_RETURN(page,start,off,count,eof,len) return 0;
838#endif 906#endif
839 907
@@ -879,7 +947,6 @@ enum {
879struct ide_driver_s { 947struct ide_driver_s {
880 const char *version; 948 const char *version;
881 u8 media; 949 u8 media;
882 unsigned supports_dsc_overlap : 1;
883 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t); 950 ide_startstop_t (*do_request)(ide_drive_t *, struct request *, sector_t);
884 int (*end_request)(ide_drive_t *, int, int); 951 int (*end_request)(ide_drive_t *, int, int);
885 ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8); 952 ide_startstop_t (*error)(ide_drive_t *, struct request *rq, u8, u8);
@@ -889,7 +956,8 @@ struct ide_driver_s {
889 void (*resume)(ide_drive_t *); 956 void (*resume)(ide_drive_t *);
890 void (*shutdown)(ide_drive_t *); 957 void (*shutdown)(ide_drive_t *);
891#ifdef CONFIG_IDE_PROC_FS 958#ifdef CONFIG_IDE_PROC_FS
892 ide_proc_entry_t *proc; 959 ide_proc_entry_t *proc;
960 const struct ide_proc_devset *settings;
893#endif 961#endif
894}; 962};
895 963
@@ -898,7 +966,17 @@ struct ide_driver_s {
898int ide_device_get(ide_drive_t *); 966int ide_device_get(ide_drive_t *);
899void ide_device_put(ide_drive_t *); 967void ide_device_put(ide_drive_t *);
900 968
901int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *, unsigned, unsigned long); 969struct ide_ioctl_devset {
970 unsigned int get_ioctl;
971 unsigned int set_ioctl;
972 const struct ide_devset *setting;
973};
974
975int ide_setting_ioctl(ide_drive_t *, struct block_device *, unsigned int,
976 unsigned long, const struct ide_ioctl_devset *);
977
978int generic_ide_ioctl(ide_drive_t *, struct file *, struct block_device *,
979 unsigned, unsigned long);
902 980
903extern int ide_vlb_clk; 981extern int ide_vlb_clk;
904extern int ide_pci_clk; 982extern int ide_pci_clk;
@@ -920,14 +998,19 @@ ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8);
920 998
921ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); 999ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat);
922 1000
923extern void ide_fix_driveid(struct hd_driveid *); 1001void ide_fix_driveid(u16 *);
924 1002
925extern void ide_fixstring(u8 *, const int, const int); 1003extern void ide_fixstring(u8 *, const int, const int);
926 1004
1005int ide_busy_sleep(ide_hwif_t *, unsigned long, int);
1006
927int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); 1007int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
928 1008
929extern ide_startstop_t ide_do_reset (ide_drive_t *); 1009extern ide_startstop_t ide_do_reset (ide_drive_t *);
930 1010
1011extern int ide_devset_execute(ide_drive_t *drive,
1012 const struct ide_devset *setting, int arg);
1013
931extern void ide_do_drive_cmd(ide_drive_t *, struct request *); 1014extern void ide_do_drive_cmd(ide_drive_t *, struct request *);
932 1015
933extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); 1016extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
@@ -1051,6 +1134,8 @@ void ide_tf_read(ide_drive_t *, ide_task_t *);
1051void ide_input_data(ide_drive_t *, struct request *, void *, unsigned int); 1134void ide_input_data(ide_drive_t *, struct request *, void *, unsigned int);
1052void ide_output_data(ide_drive_t *, struct request *, void *, unsigned int); 1135void ide_output_data(ide_drive_t *, struct request *, void *, unsigned int);
1053 1136
1137int ide_io_buffers(ide_drive_t *, struct ide_atapi_pc *, unsigned int, int);
1138
1054extern void SELECT_DRIVE(ide_drive_t *); 1139extern void SELECT_DRIVE(ide_drive_t *);
1055void SELECT_MASK(ide_drive_t *, int); 1140void SELECT_MASK(ide_drive_t *, int);
1056 1141
@@ -1061,11 +1146,36 @@ extern int drive_is_ready(ide_drive_t *);
1061 1146
1062void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8); 1147void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8);
1063 1148
1149int ide_check_atapi_device(ide_drive_t *, const char *);
1150
1151void ide_init_pc(struct ide_atapi_pc *);
1152
1153/*
1154 * Special requests for ide-tape block device strategy routine.
1155 *
1156 * In order to service a character device command, we add special requests to
1157 * the tail of our block device request queue and wait for their completion.
1158 */
1159enum {
1160 REQ_IDETAPE_PC1 = (1 << 0), /* packet command (first stage) */
1161 REQ_IDETAPE_PC2 = (1 << 1), /* packet command (second stage) */
1162 REQ_IDETAPE_READ = (1 << 2),
1163 REQ_IDETAPE_WRITE = (1 << 3),
1164};
1165
1166void ide_queue_pc_head(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *,
1167 struct request *);
1168int ide_queue_pc_tail(ide_drive_t *, struct gendisk *, struct ide_atapi_pc *);
1169
1170int ide_do_test_unit_ready(ide_drive_t *, struct gendisk *);
1171int ide_do_start_stop(ide_drive_t *, struct gendisk *, int);
1172int ide_set_media_lock(ide_drive_t *, struct gendisk *, int);
1173
1064ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc, 1174ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
1065 ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry, 1175 ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry,
1066 void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *), 1176 void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *),
1067 void (*retry_pc)(ide_drive_t *), void (*dsc_handle)(ide_drive_t *), 1177 void (*retry_pc)(ide_drive_t *), void (*dsc_handle)(ide_drive_t *),
1068 void (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned int, 1178 int (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned int,
1069 int)); 1179 int));
1070ide_startstop_t ide_transfer_pc(ide_drive_t *, struct ide_atapi_pc *, 1180ide_startstop_t ide_transfer_pc(ide_drive_t *, struct ide_atapi_pc *,
1071 ide_handler_t *, unsigned int, ide_expiry_t *); 1181 ide_handler_t *, unsigned int, ide_expiry_t *);
@@ -1080,8 +1190,6 @@ int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *, u16);
1080int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); 1190int ide_no_data_taskfile(ide_drive_t *, ide_task_t *);
1081 1191
1082int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); 1192int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long);
1083int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long);
1084int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long);
1085 1193
1086extern int ide_driveid_update(ide_drive_t *); 1194extern int ide_driveid_update(ide_drive_t *);
1087extern int ide_config_drive_speed(ide_drive_t *, u8); 1195extern int ide_config_drive_speed(ide_drive_t *, u8);
@@ -1092,7 +1200,6 @@ extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout);
1092 1200
1093extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout); 1201extern void ide_stall_queue(ide_drive_t *drive, unsigned long timeout);
1094 1202
1095extern int ide_spin_wait_hwgroup(ide_drive_t *);
1096extern void ide_timer_expiry(unsigned long); 1203extern void ide_timer_expiry(unsigned long);
1097extern irqreturn_t ide_intr(int irq, void *dev_id); 1204extern irqreturn_t ide_intr(int irq, void *dev_id);
1098extern void do_ide_request(struct request_queue *); 1205extern void do_ide_request(struct request_queue *);
@@ -1113,7 +1220,6 @@ void ide_setup_pci_noise(struct pci_dev *, const struct ide_port_info *);
1113#ifdef CONFIG_BLK_DEV_IDEDMA_PCI 1220#ifdef CONFIG_BLK_DEV_IDEDMA_PCI
1114int ide_pci_set_master(struct pci_dev *, const char *); 1221int ide_pci_set_master(struct pci_dev *, const char *);
1115unsigned long ide_pci_dma_base(ide_hwif_t *, const struct ide_port_info *); 1222unsigned long ide_pci_dma_base(ide_hwif_t *, const struct ide_port_info *);
1116extern const struct ide_dma_ops sff_dma_ops;
1117int ide_pci_check_simplex(ide_hwif_t *, const struct ide_port_info *); 1223int ide_pci_check_simplex(ide_hwif_t *, const struct ide_port_info *);
1118int ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *); 1224int ide_hwif_setup_dma(ide_hwif_t *, const struct ide_port_info *);
1119#else 1225#else
@@ -1230,6 +1336,14 @@ int ide_pci_init_two(struct pci_dev *, struct pci_dev *,
1230 const struct ide_port_info *, void *); 1336 const struct ide_port_info *, void *);
1231void ide_pci_remove(struct pci_dev *); 1337void ide_pci_remove(struct pci_dev *);
1232 1338
1339#ifdef CONFIG_PM
1340int ide_pci_suspend(struct pci_dev *, pm_message_t);
1341int ide_pci_resume(struct pci_dev *);
1342#else
1343#define ide_pci_suspend NULL
1344#define ide_pci_resume NULL
1345#endif
1346
1233void ide_map_sg(ide_drive_t *, struct request *); 1347void ide_map_sg(ide_drive_t *, struct request *);
1234void ide_init_sg_cmd(ide_drive_t *, struct request *); 1348void ide_init_sg_cmd(ide_drive_t *, struct request *);
1235 1349
@@ -1241,7 +1355,7 @@ struct drive_list_entry {
1241 const char *id_firmware; 1355 const char *id_firmware;
1242}; 1356};
1243 1357
1244int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *); 1358int ide_in_drive_list(u16 *, const struct drive_list_entry *);
1245 1359
1246#ifdef CONFIG_BLK_DEV_IDEDMA 1360#ifdef CONFIG_BLK_DEV_IDEDMA
1247int __ide_dma_bad_drive(ide_drive_t *); 1361int __ide_dma_bad_drive(ide_drive_t *);
@@ -1277,6 +1391,7 @@ extern int __ide_dma_end(ide_drive_t *);
1277int ide_dma_test_irq(ide_drive_t *); 1391int ide_dma_test_irq(ide_drive_t *);
1278extern void ide_dma_lost_irq(ide_drive_t *); 1392extern void ide_dma_lost_irq(ide_drive_t *);
1279extern void ide_dma_timeout(ide_drive_t *); 1393extern void ide_dma_timeout(ide_drive_t *);
1394extern const struct ide_dma_ops sff_dma_ops;
1280#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */ 1395#endif /* CONFIG_BLK_DEV_IDEDMA_SFF */
1281 1396
1282#else 1397#else
@@ -1347,24 +1462,6 @@ const char *ide_xfer_verbose(u8 mode);
1347extern void ide_toggle_bounce(ide_drive_t *drive, int on); 1462extern void ide_toggle_bounce(ide_drive_t *drive, int on);
1348extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); 1463extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate);
1349 1464
1350static inline int ide_dev_has_iordy(struct hd_driveid *id)
1351{
1352 return ((id->field_valid & 2) && (id->capability & 8)) ? 1 : 0;
1353}
1354
1355static inline int ide_dev_is_sata(struct hd_driveid *id)
1356{
1357 /*
1358 * See if word 93 is 0 AND drive is at least ATA-5 compatible
1359 * verifying that word 80 by casting it to a signed type --
1360 * this trick allows us to filter out the reserved values of
1361 * 0x0000 and 0xffff along with the earlier ATA revisions...
1362 */
1363 if (id->hw_config == 0 && (short)id->major_rev_num >= 0x0020)
1364 return 1;
1365 return 0;
1366}
1367
1368u64 ide_get_lba_addr(struct ide_taskfile *, int); 1465u64 ide_get_lba_addr(struct ide_taskfile *, int);
1369u8 ide_dump_status(ide_drive_t *, const char *, u8); 1466u8 ide_dump_status(ide_drive_t *, const char *, u8);
1370 1467
@@ -1436,13 +1533,6 @@ extern struct mutex ide_cfg_mtx;
1436extern struct bus_type ide_bus_type; 1533extern struct bus_type ide_bus_type;
1437extern struct class *ide_port_class; 1534extern struct class *ide_port_class;
1438 1535
1439/* check if CACHE FLUSH (EXT) command is supported (bits defined in ATA-6) */
1440#define ide_id_has_flush_cache(id) ((id)->cfs_enable_2 & 0x3000)
1441
1442/* some Maxtor disks have bit 13 defined incorrectly so check bit 10 too */
1443#define ide_id_has_flush_cache_ext(id) \
1444 (((id)->cfs_enable_2 & 0x2400) == 0x2400)
1445
1446static inline void ide_dump_identify(u8 *id) 1536static inline void ide_dump_identify(u8 *id)
1447{ 1537{
1448 print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 2, id, 512, 0); 1538 print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 2, id, 512, 0);
@@ -1450,14 +1540,13 @@ static inline void ide_dump_identify(u8 *id)
1450 1540
1451static inline int hwif_to_node(ide_hwif_t *hwif) 1541static inline int hwif_to_node(ide_hwif_t *hwif)
1452{ 1542{
1453 struct pci_dev *dev = to_pci_dev(hwif->dev); 1543 return hwif->dev ? dev_to_node(hwif->dev) : -1;
1454 return hwif->dev ? pcibus_to_node(dev->bus) : -1;
1455} 1544}
1456 1545
1457static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive) 1546static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive)
1458{ 1547{
1459 ide_hwif_t *hwif = HWIF(drive); 1548 ide_drive_t *peer = &drive->hwif->drives[(drive->dn ^ 1) & 1];
1460 1549
1461 return &hwif->drives[(drive->dn ^ 1) & 1]; 1550 return peer->present ? peer : NULL;
1462} 1551}
1463#endif /* _IDE_H */ 1552#endif /* _IDE_H */
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index a1630ba0b87c..14126bc36641 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -471,6 +471,11 @@ struct ieee80211s_hdr {
471 u8 eaddr3[6]; 471 u8 eaddr3[6];
472} __attribute__ ((packed)); 472} __attribute__ ((packed));
473 473
474/* Mesh flags */
475#define MESH_FLAGS_AE_A4 0x1
476#define MESH_FLAGS_AE_A5_A6 0x2
477#define MESH_FLAGS_PS_DEEP 0x4
478
474/** 479/**
475 * struct ieee80211_quiet_ie 480 * struct ieee80211_quiet_ie
476 * 481 *
@@ -506,6 +511,19 @@ struct ieee80211_channel_sw_ie {
506 u8 count; 511 u8 count;
507} __attribute__ ((packed)); 512} __attribute__ ((packed));
508 513
514/**
515 * struct ieee80211_tim
516 *
517 * This structure refers to "Traffic Indication Map information element"
518 */
519struct ieee80211_tim_ie {
520 u8 dtim_count;
521 u8 dtim_period;
522 u8 bitmap_ctrl;
523 /* variable size: 1 - 251 bytes */
524 u8 virtual_map[0];
525} __attribute__ ((packed));
526
509struct ieee80211_mgmt { 527struct ieee80211_mgmt {
510 __le16 frame_control; 528 __le16 frame_control;
511 __le16 duration; 529 __le16 duration;
@@ -630,6 +648,9 @@ struct ieee80211_mgmt {
630 } u; 648 } u;
631} __attribute__ ((packed)); 649} __attribute__ ((packed));
632 650
651/* mgmt header + 1 byte category code */
652#define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
653
633 654
634/* Control frames */ 655/* Control frames */
635struct ieee80211_rts { 656struct ieee80211_rts {
@@ -695,12 +716,13 @@ struct ieee80211_ht_addt_info {
695 716
696/* 802.11n HT capabilities masks */ 717/* 802.11n HT capabilities masks */
697#define IEEE80211_HT_CAP_SUP_WIDTH 0x0002 718#define IEEE80211_HT_CAP_SUP_WIDTH 0x0002
698#define IEEE80211_HT_CAP_MIMO_PS 0x000C 719#define IEEE80211_HT_CAP_SM_PS 0x000C
699#define IEEE80211_HT_CAP_GRN_FLD 0x0010 720#define IEEE80211_HT_CAP_GRN_FLD 0x0010
700#define IEEE80211_HT_CAP_SGI_20 0x0020 721#define IEEE80211_HT_CAP_SGI_20 0x0020
701#define IEEE80211_HT_CAP_SGI_40 0x0040 722#define IEEE80211_HT_CAP_SGI_40 0x0040
702#define IEEE80211_HT_CAP_DELAY_BA 0x0400 723#define IEEE80211_HT_CAP_DELAY_BA 0x0400
703#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 724#define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
725#define IEEE80211_HT_CAP_DSSSCCK40 0x1000
704/* 802.11n HT capability AMPDU settings */ 726/* 802.11n HT capability AMPDU settings */
705#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03 727#define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03
706#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C 728#define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C
@@ -723,11 +745,26 @@ struct ieee80211_ht_addt_info {
723#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004 745#define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004
724#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010 746#define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010
725 747
726/* MIMO Power Save Modes */ 748/* block-ack parameters */
727#define WLAN_HT_CAP_MIMO_PS_STATIC 0 749#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
728#define WLAN_HT_CAP_MIMO_PS_DYNAMIC 1 750#define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
729#define WLAN_HT_CAP_MIMO_PS_INVALID 2 751#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0
730#define WLAN_HT_CAP_MIMO_PS_DISABLED 3 752#define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
753#define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
754
755/*
756 * A-PMDU buffer sizes
757 * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2)
758 */
759#define IEEE80211_MIN_AMPDU_BUF 0x8
760#define IEEE80211_MAX_AMPDU_BUF 0x40
761
762
763/* Spatial Multiplexing Power Save Modes */
764#define WLAN_HT_CAP_SM_PS_STATIC 0
765#define WLAN_HT_CAP_SM_PS_DYNAMIC 1
766#define WLAN_HT_CAP_SM_PS_INVALID 2
767#define WLAN_HT_CAP_SM_PS_DISABLED 3
731 768
732/* Authentication algorithms */ 769/* Authentication algorithms */
733#define WLAN_AUTH_OPEN 0 770#define WLAN_AUTH_OPEN 0
diff --git a/include/linux/if.h b/include/linux/if.h
index 5c9d1fa93fef..65246846c844 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -24,6 +24,7 @@
24#include <linux/compiler.h> /* for "__user" et al */ 24#include <linux/compiler.h> /* for "__user" et al */
25 25
26#define IFNAMSIZ 16 26#define IFNAMSIZ 16
27#define IFALIASZ 256
27#include <linux/hdlc/ioctl.h> 28#include <linux/hdlc/ioctl.h>
28 29
29/* Standard interface flags (netdevice->flags). */ 30/* Standard interface flags (netdevice->flags). */
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index e157c1399b61..bf1a53b2682e 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -56,6 +56,7 @@
56#define ETH_P_DIAG 0x6005 /* DEC Diagnostics */ 56#define ETH_P_DIAG 0x6005 /* DEC Diagnostics */
57#define ETH_P_CUST 0x6006 /* DEC Customer use */ 57#define ETH_P_CUST 0x6006 /* DEC Customer use */
58#define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */ 58#define ETH_P_SCA 0x6007 /* DEC Systems Comms Arch */
59#define ETH_P_TEB 0x6558 /* Trans Ether Bridging */
59#define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */ 60#define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */
60#define ETH_P_ATALK 0x809B /* Appletalk DDP */ 61#define ETH_P_ATALK 0x809B /* Appletalk DDP */
61#define ETH_P_AARP 0x80F3 /* Appletalk AARP */ 62#define ETH_P_AARP 0x80F3 /* Appletalk AARP */
@@ -74,8 +75,10 @@
74#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport 75#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport
75 * over Ethernet 76 * over Ethernet
76 */ 77 */
78#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
77#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ 79#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */
78#define ETH_P_TIPC 0x88CA /* TIPC */ 80#define ETH_P_TIPC 0x88CA /* TIPC */
81#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */
79 82
80/* 83/*
81 * Non DIX types. Won't clash for 1500 types. 84 * Non DIX types. Won't clash for 1500 types.
@@ -99,6 +102,9 @@
99#define ETH_P_ECONET 0x0018 /* Acorn Econet */ 102#define ETH_P_ECONET 0x0018 /* Acorn Econet */
100#define ETH_P_HDLC 0x0019 /* HDLC frames */ 103#define ETH_P_HDLC 0x0019 /* HDLC frames */
101#define ETH_P_ARCNET 0x001A /* 1A for ArcNet :-) */ 104#define ETH_P_ARCNET 0x001A /* 1A for ArcNet :-) */
105#define ETH_P_DSA 0x001B /* Distributed Switch Arch. */
106#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */
107#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */
102 108
103/* 109/*
104 * This is an Ethernet frame header. 110 * This is an Ethernet frame header.
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 84c3492ae5cb..f9032c88716a 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -79,6 +79,7 @@ enum
79 IFLA_LINKINFO, 79 IFLA_LINKINFO,
80#define IFLA_LINKINFO IFLA_LINKINFO 80#define IFLA_LINKINFO IFLA_LINKINFO
81 IFLA_NET_NS_PID, 81 IFLA_NET_NS_PID,
82 IFLA_IFALIAS,
82 __IFLA_MAX 83 __IFLA_MAX
83}; 84};
84 85
diff --git a/include/linux/if_phonet.h b/include/linux/if_phonet.h
new file mode 100644
index 000000000000..d70034bcec05
--- /dev/null
+++ b/include/linux/if_phonet.h
@@ -0,0 +1,19 @@
1/*
2 * File: if_phonet.h
3 *
4 * Phonet interface kernel definitions
5 *
6 * Copyright (C) 2008 Nokia Corporation. All rights reserved.
7 */
8#ifndef LINUX_IF_PHONET_H
9#define LINUX_IF_PHONET_H
10
11#define PHONET_MIN_MTU 6 /* pn_length = 0 */
12#define PHONET_MAX_MTU 65541 /* pn_length = 0xffff */
13#define PHONET_DEV_MTU PHONET_MAX_MTU
14
15#ifdef __KERNEL__
16extern struct header_ops phonet_header_ops;
17#endif
18
19#endif
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 4c6307ad9fdb..8529f57ba263 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -45,6 +45,7 @@
45#define TUNGETFEATURES _IOR('T', 207, unsigned int) 45#define TUNGETFEATURES _IOR('T', 207, unsigned int)
46#define TUNSETOFFLOAD _IOW('T', 208, unsigned int) 46#define TUNSETOFFLOAD _IOW('T', 208, unsigned int)
47#define TUNSETTXFILTER _IOW('T', 209, unsigned int) 47#define TUNSETTXFILTER _IOW('T', 209, unsigned int)
48#define TUNGETIFF _IOR('T', 210, unsigned int)
48 49
49/* TUNSETIFF ifr flags */ 50/* TUNSETIFF ifr flags */
50#define IFF_TUN 0x0001 51#define IFF_TUN 0x0001
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index d4efe4014705..aeab2cb32a9c 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -2,6 +2,7 @@
2#define _IF_TUNNEL_H_ 2#define _IF_TUNNEL_H_
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/ip.h>
5 6
6#define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) 7#define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0)
7#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) 8#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1)
@@ -47,4 +48,22 @@ struct ip_tunnel_prl {
47/* PRL flags */ 48/* PRL flags */
48#define PRL_DEFAULT 0x0001 49#define PRL_DEFAULT 0x0001
49 50
51enum
52{
53 IFLA_GRE_UNSPEC,
54 IFLA_GRE_LINK,
55 IFLA_GRE_IFLAGS,
56 IFLA_GRE_OFLAGS,
57 IFLA_GRE_IKEY,
58 IFLA_GRE_OKEY,
59 IFLA_GRE_LOCAL,
60 IFLA_GRE_REMOTE,
61 IFLA_GRE_TTL,
62 IFLA_GRE_TOS,
63 IFLA_GRE_PMTUDISC,
64 __IFLA_GRE_MAX,
65};
66
67#define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1)
68
50#endif /* _IF_TUNNEL_H_ */ 69#endif /* _IF_TUNNEL_H_ */
diff --git a/include/linux/ihex.h b/include/linux/ihex.h
index 2baace2788a7..31d8629e75a1 100644
--- a/include/linux/ihex.h
+++ b/include/linux/ihex.h
@@ -18,7 +18,7 @@ struct ihex_binrec {
18 __be32 addr; 18 __be32 addr;
19 __be16 len; 19 __be16 len;
20 uint8_t data[0]; 20 uint8_t data[0];
21} __attribute__((aligned(4))); 21} __attribute__((packed));
22 22
23/* Find the next record, taking into account the 4-byte alignment */ 23/* Find the next record, taking into account the 4-byte alignment */
24static inline const struct ihex_binrec * 24static inline const struct ihex_binrec *
diff --git a/include/linux/in.h b/include/linux/in.h
index 4065313cd7ee..db458beef19d 100644
--- a/include/linux/in.h
+++ b/include/linux/in.h
@@ -75,6 +75,7 @@ struct in_addr {
75#define IP_IPSEC_POLICY 16 75#define IP_IPSEC_POLICY 16
76#define IP_XFRM_POLICY 17 76#define IP_XFRM_POLICY 17
77#define IP_PASSSEC 18 77#define IP_PASSSEC 18
78#define IP_TRANSPARENT 19
78 79
79/* BSD compatibility */ 80/* BSD compatibility */
80#define IP_RECVRETOPTS IP_RETOPTS 81#define IP_RECVRETOPTS IP_RETOPTS
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index c6f51ad52d5b..06fcdb45106b 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -25,6 +25,7 @@ struct in_device
25 struct in_ifaddr *ifa_list; /* IP ifaddr chain */ 25 struct in_ifaddr *ifa_list; /* IP ifaddr chain */
26 rwlock_t mc_list_lock; 26 rwlock_t mc_list_lock;
27 struct ip_mc_list *mc_list; /* IP multicast filter chain */ 27 struct ip_mc_list *mc_list; /* IP multicast filter chain */
28 int mc_count; /* Number of installed mcasts */
28 spinlock_t mc_tomb_lock; 29 spinlock_t mc_tomb_lock;
29 struct ip_mc_list *mc_tomb; 30 struct ip_mc_list *mc_tomb;
30 unsigned long mr_v1_seen; 31 unsigned long mr_v1_seen;
diff --git a/include/linux/init.h b/include/linux/init.h
index 42ae95411a93..93538b696e3d 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -139,6 +139,7 @@ extern initcall_t __con_initcall_start[], __con_initcall_end[];
139extern initcall_t __security_initcall_start[], __security_initcall_end[]; 139extern initcall_t __security_initcall_start[], __security_initcall_end[];
140 140
141/* Defined in init/main.c */ 141/* Defined in init/main.c */
142extern int do_one_initcall(initcall_t fn);
142extern char __initdata boot_command_line[]; 143extern char __initdata boot_command_line[];
143extern char *saved_command_line; 144extern char *saved_command_line;
144extern unsigned int reset_devices; 145extern unsigned int reset_devices;
@@ -170,6 +171,13 @@ extern void (*late_time_init)(void);
170 __attribute__((__section__(".initcall" level ".init"))) = fn 171 __attribute__((__section__(".initcall" level ".init"))) = fn
171 172
172/* 173/*
174 * Early initcalls run before initializing SMP.
175 *
176 * Only for built-in code, not modules.
177 */
178#define early_initcall(fn) __define_initcall("early",fn,early)
179
180/*
173 * A "pure" initcall has no dependencies on anything else, and purely 181 * A "pure" initcall has no dependencies on anything else, and purely
174 * initializes variables that couldn't be statically initialized. 182 * initializes variables that couldn't be statically initialized.
175 * 183 *
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 62aa4f895abe..58ff4e74b2f3 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -223,35 +223,6 @@ static inline int disable_irq_wake(unsigned int irq)
223#define or_softirq_pending(x) (local_softirq_pending() |= (x)) 223#define or_softirq_pending(x) (local_softirq_pending() |= (x))
224#endif 224#endif
225 225
226/*
227 * Temporary defines for UP kernels, until all code gets fixed.
228 */
229#ifndef CONFIG_SMP
230static inline void __deprecated cli(void)
231{
232 local_irq_disable();
233}
234static inline void __deprecated sti(void)
235{
236 local_irq_enable();
237}
238static inline void __deprecated save_flags(unsigned long *x)
239{
240 local_save_flags(*x);
241}
242#define save_flags(x) save_flags(&x)
243static inline void __deprecated restore_flags(unsigned long x)
244{
245 local_irq_restore(x);
246}
247
248static inline void __deprecated save_and_cli(unsigned long *x)
249{
250 local_irq_save(*x);
251}
252#define save_and_cli(x) save_and_cli(&x)
253#endif /* CONFIG_SMP */
254
255/* Some architectures might implement lazy enabling/disabling of 226/* Some architectures might implement lazy enabling/disabling of
256 * interrupts. In some cases, such as stop_machine, we might want 227 * interrupts. In some cases, such as stop_machine, we might want
257 * to ensure that after a local_irq_disable(), interrupts have 228 * to ensure that after a local_irq_disable(), interrupts have
diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h
index c975caf75385..a6d0586e2bf7 100644
--- a/include/linux/iommu-helper.h
+++ b/include/linux/iommu-helper.h
@@ -1,6 +1,20 @@
1#ifndef _LINUX_IOMMU_HELPER_H
2#define _LINUX_IOMMU_HELPER_H
3
4static inline unsigned long iommu_device_max_index(unsigned long size,
5 unsigned long offset,
6 u64 dma_mask)
7{
8 if (size + offset > dma_mask)
9 return dma_mask - offset + 1;
10 else
11 return size;
12}
13
1extern int iommu_is_span_boundary(unsigned int index, unsigned int nr, 14extern int iommu_is_span_boundary(unsigned int index, unsigned int nr,
2 unsigned long shift, 15 unsigned long shift,
3 unsigned long boundary_size); 16 unsigned long boundary_size);
17extern void iommu_area_reserve(unsigned long *map, unsigned long i, int len);
4extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size, 18extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
5 unsigned long start, unsigned int nr, 19 unsigned long start, unsigned int nr,
6 unsigned long shift, 20 unsigned long shift,
@@ -8,3 +22,5 @@ extern unsigned long iommu_area_alloc(unsigned long *map, unsigned long size,
8 unsigned long align_mask); 22 unsigned long align_mask);
9extern void iommu_area_free(unsigned long *map, unsigned long start, 23extern void iommu_area_free(unsigned long *map, unsigned long start,
10 unsigned int nr); 24 unsigned int nr);
25
26#endif
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 2cd07cc29687..ee9bcc6f32b6 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -108,7 +108,11 @@ extern struct resource iomem_resource;
108 108
109extern int request_resource(struct resource *root, struct resource *new); 109extern int request_resource(struct resource *root, struct resource *new);
110extern int release_resource(struct resource *new); 110extern int release_resource(struct resource *new);
111extern void reserve_region_with_split(struct resource *root,
112 resource_size_t start, resource_size_t end,
113 const char *name);
111extern int insert_resource(struct resource *parent, struct resource *new); 114extern int insert_resource(struct resource *parent, struct resource *new);
115extern void insert_resource_expand_to_fit(struct resource *root, struct resource *new);
112extern int allocate_resource(struct resource *root, struct resource *new, 116extern int allocate_resource(struct resource *root, struct resource *new,
113 resource_size_t size, resource_size_t min, 117 resource_size_t size, resource_size_t min,
114 resource_size_t max, resource_size_t align, 118 resource_size_t max, resource_size_t align,
@@ -118,6 +122,10 @@ extern int allocate_resource(struct resource *root, struct resource *new,
118int adjust_resource(struct resource *res, resource_size_t start, 122int adjust_resource(struct resource *res, resource_size_t start,
119 resource_size_t size); 123 resource_size_t size);
120resource_size_t resource_alignment(struct resource *res); 124resource_size_t resource_alignment(struct resource *res);
125static inline resource_size_t resource_size(struct resource *res)
126{
127 return res->end - res->start + 1;
128}
121 129
122/* Convenience shorthand with allocation */ 130/* Convenience shorthand with allocation */
123#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name)) 131#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name))
@@ -154,9 +162,9 @@ extern struct resource * __devm_request_region(struct device *dev,
154 struct resource *parent, resource_size_t start, 162 struct resource *parent, resource_size_t start,
155 resource_size_t n, const char *name); 163 resource_size_t n, const char *name);
156 164
157#define devm_release_region(start,n) \ 165#define devm_release_region(dev, start, n) \
158 __devm_release_region(dev, &ioport_resource, (start), (n)) 166 __devm_release_region(dev, &ioport_resource, (start), (n))
159#define devm_release_mem_region(start,n) \ 167#define devm_release_mem_region(dev, start, n) \
160 __devm_release_region(dev, &iomem_resource, (start), (n)) 168 __devm_release_region(dev, &iomem_resource, (start), (n))
161 169
162extern void __devm_release_region(struct device *dev, struct resource *parent, 170extern void __devm_release_region(struct device *dev, struct resource *parent,
diff --git a/include/linux/ip_vs.h b/include/linux/ip_vs.h
new file mode 100644
index 000000000000..0f434a28fb58
--- /dev/null
+++ b/include/linux/ip_vs.h
@@ -0,0 +1,405 @@
1/*
2 * IP Virtual Server
3 * data structure and functionality definitions
4 */
5
6#ifndef _IP_VS_H
7#define _IP_VS_H
8
9#include <linux/types.h> /* For __beXX types in userland */
10
11#define IP_VS_VERSION_CODE 0x010201
12#define NVERSION(version) \
13 (version >> 16) & 0xFF, \
14 (version >> 8) & 0xFF, \
15 version & 0xFF
16
17/*
18 * Virtual Service Flags
19 */
20#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */
21#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */
22
23/*
24 * Destination Server Flags
25 */
26#define IP_VS_DEST_F_AVAILABLE 0x0001 /* server is available */
27#define IP_VS_DEST_F_OVERLOAD 0x0002 /* server is overloaded */
28
29/*
30 * IPVS sync daemon states
31 */
32#define IP_VS_STATE_NONE 0x0000 /* daemon is stopped */
33#define IP_VS_STATE_MASTER 0x0001 /* started as master */
34#define IP_VS_STATE_BACKUP 0x0002 /* started as backup */
35
36/*
37 * IPVS socket options
38 */
39#define IP_VS_BASE_CTL (64+1024+64) /* base */
40
41#define IP_VS_SO_SET_NONE IP_VS_BASE_CTL /* just peek */
42#define IP_VS_SO_SET_INSERT (IP_VS_BASE_CTL+1)
43#define IP_VS_SO_SET_ADD (IP_VS_BASE_CTL+2)
44#define IP_VS_SO_SET_EDIT (IP_VS_BASE_CTL+3)
45#define IP_VS_SO_SET_DEL (IP_VS_BASE_CTL+4)
46#define IP_VS_SO_SET_FLUSH (IP_VS_BASE_CTL+5)
47#define IP_VS_SO_SET_LIST (IP_VS_BASE_CTL+6)
48#define IP_VS_SO_SET_ADDDEST (IP_VS_BASE_CTL+7)
49#define IP_VS_SO_SET_DELDEST (IP_VS_BASE_CTL+8)
50#define IP_VS_SO_SET_EDITDEST (IP_VS_BASE_CTL+9)
51#define IP_VS_SO_SET_TIMEOUT (IP_VS_BASE_CTL+10)
52#define IP_VS_SO_SET_STARTDAEMON (IP_VS_BASE_CTL+11)
53#define IP_VS_SO_SET_STOPDAEMON (IP_VS_BASE_CTL+12)
54#define IP_VS_SO_SET_RESTORE (IP_VS_BASE_CTL+13)
55#define IP_VS_SO_SET_SAVE (IP_VS_BASE_CTL+14)
56#define IP_VS_SO_SET_ZERO (IP_VS_BASE_CTL+15)
57#define IP_VS_SO_SET_MAX IP_VS_SO_SET_ZERO
58
59#define IP_VS_SO_GET_VERSION IP_VS_BASE_CTL
60#define IP_VS_SO_GET_INFO (IP_VS_BASE_CTL+1)
61#define IP_VS_SO_GET_SERVICES (IP_VS_BASE_CTL+2)
62#define IP_VS_SO_GET_SERVICE (IP_VS_BASE_CTL+3)
63#define IP_VS_SO_GET_DESTS (IP_VS_BASE_CTL+4)
64#define IP_VS_SO_GET_DEST (IP_VS_BASE_CTL+5) /* not used now */
65#define IP_VS_SO_GET_TIMEOUT (IP_VS_BASE_CTL+6)
66#define IP_VS_SO_GET_DAEMON (IP_VS_BASE_CTL+7)
67#define IP_VS_SO_GET_MAX IP_VS_SO_GET_DAEMON
68
69
70/*
71 * IPVS Connection Flags
72 */
73#define IP_VS_CONN_F_FWD_MASK 0x0007 /* mask for the fwd methods */
74#define IP_VS_CONN_F_MASQ 0x0000 /* masquerading/NAT */
75#define IP_VS_CONN_F_LOCALNODE 0x0001 /* local node */
76#define IP_VS_CONN_F_TUNNEL 0x0002 /* tunneling */
77#define IP_VS_CONN_F_DROUTE 0x0003 /* direct routing */
78#define IP_VS_CONN_F_BYPASS 0x0004 /* cache bypass */
79#define IP_VS_CONN_F_SYNC 0x0020 /* entry created by sync */
80#define IP_VS_CONN_F_HASHED 0x0040 /* hashed entry */
81#define IP_VS_CONN_F_NOOUTPUT 0x0080 /* no output packets */
82#define IP_VS_CONN_F_INACTIVE 0x0100 /* not established */
83#define IP_VS_CONN_F_OUT_SEQ 0x0200 /* must do output seq adjust */
84#define IP_VS_CONN_F_IN_SEQ 0x0400 /* must do input seq adjust */
85#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */
86#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */
87#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */
88
89#define IP_VS_SCHEDNAME_MAXLEN 16
90#define IP_VS_IFNAME_MAXLEN 16
91
92
93/*
94 * The struct ip_vs_service_user and struct ip_vs_dest_user are
95 * used to set IPVS rules through setsockopt.
96 */
97struct ip_vs_service_user {
98 /* virtual service addresses */
99 u_int16_t protocol;
100 __be32 addr; /* virtual ip address */
101 __be16 port;
102 u_int32_t fwmark; /* firwall mark of service */
103
104 /* virtual service options */
105 char sched_name[IP_VS_SCHEDNAME_MAXLEN];
106 unsigned flags; /* virtual service flags */
107 unsigned timeout; /* persistent timeout in sec */
108 __be32 netmask; /* persistent netmask */
109};
110
111
112struct ip_vs_dest_user {
113 /* destination server address */
114 __be32 addr;
115 __be16 port;
116
117 /* real server options */
118 unsigned conn_flags; /* connection flags */
119 int weight; /* destination weight */
120
121 /* thresholds for active connections */
122 u_int32_t u_threshold; /* upper threshold */
123 u_int32_t l_threshold; /* lower threshold */
124};
125
126
127/*
128 * IPVS statistics object (for user space)
129 */
130struct ip_vs_stats_user
131{
132 __u32 conns; /* connections scheduled */
133 __u32 inpkts; /* incoming packets */
134 __u32 outpkts; /* outgoing packets */
135 __u64 inbytes; /* incoming bytes */
136 __u64 outbytes; /* outgoing bytes */
137
138 __u32 cps; /* current connection rate */
139 __u32 inpps; /* current in packet rate */
140 __u32 outpps; /* current out packet rate */
141 __u32 inbps; /* current in byte rate */
142 __u32 outbps; /* current out byte rate */
143};
144
145
146/* The argument to IP_VS_SO_GET_INFO */
147struct ip_vs_getinfo {
148 /* version number */
149 unsigned int version;
150
151 /* size of connection hash table */
152 unsigned int size;
153
154 /* number of virtual services */
155 unsigned int num_services;
156};
157
158
159/* The argument to IP_VS_SO_GET_SERVICE */
160struct ip_vs_service_entry {
161 /* which service: user fills in these */
162 u_int16_t protocol;
163 __be32 addr; /* virtual address */
164 __be16 port;
165 u_int32_t fwmark; /* firwall mark of service */
166
167 /* service options */
168 char sched_name[IP_VS_SCHEDNAME_MAXLEN];
169 unsigned flags; /* virtual service flags */
170 unsigned timeout; /* persistent timeout */
171 __be32 netmask; /* persistent netmask */
172
173 /* number of real servers */
174 unsigned int num_dests;
175
176 /* statistics */
177 struct ip_vs_stats_user stats;
178};
179
180
181struct ip_vs_dest_entry {
182 __be32 addr; /* destination address */
183 __be16 port;
184 unsigned conn_flags; /* connection flags */
185 int weight; /* destination weight */
186
187 u_int32_t u_threshold; /* upper threshold */
188 u_int32_t l_threshold; /* lower threshold */
189
190 u_int32_t activeconns; /* active connections */
191 u_int32_t inactconns; /* inactive connections */
192 u_int32_t persistconns; /* persistent connections */
193
194 /* statistics */
195 struct ip_vs_stats_user stats;
196};
197
198
199/* The argument to IP_VS_SO_GET_DESTS */
200struct ip_vs_get_dests {
201 /* which service: user fills in these */
202 u_int16_t protocol;
203 __be32 addr; /* virtual address */
204 __be16 port;
205 u_int32_t fwmark; /* firwall mark of service */
206
207 /* number of real servers */
208 unsigned int num_dests;
209
210 /* the real servers */
211 struct ip_vs_dest_entry entrytable[0];
212};
213
214
215/* The argument to IP_VS_SO_GET_SERVICES */
216struct ip_vs_get_services {
217 /* number of virtual services */
218 unsigned int num_services;
219
220 /* service table */
221 struct ip_vs_service_entry entrytable[0];
222};
223
224
225/* The argument to IP_VS_SO_GET_TIMEOUT */
226struct ip_vs_timeout_user {
227 int tcp_timeout;
228 int tcp_fin_timeout;
229 int udp_timeout;
230};
231
232
233/* The argument to IP_VS_SO_GET_DAEMON */
234struct ip_vs_daemon_user {
235 /* sync daemon state (master/backup) */
236 int state;
237
238 /* multicast interface name */
239 char mcast_ifn[IP_VS_IFNAME_MAXLEN];
240
241 /* SyncID we belong to */
242 int syncid;
243};
244
245/*
246 *
247 * IPVS Generic Netlink interface definitions
248 *
249 */
250
251/* Generic Netlink family info */
252
253#define IPVS_GENL_NAME "IPVS"
254#define IPVS_GENL_VERSION 0x1
255
256struct ip_vs_flags {
257 __be32 flags;
258 __be32 mask;
259};
260
261/* Generic Netlink command attributes */
262enum {
263 IPVS_CMD_UNSPEC = 0,
264
265 IPVS_CMD_NEW_SERVICE, /* add service */
266 IPVS_CMD_SET_SERVICE, /* modify service */
267 IPVS_CMD_DEL_SERVICE, /* delete service */
268 IPVS_CMD_GET_SERVICE, /* get service info */
269
270 IPVS_CMD_NEW_DEST, /* add destination */
271 IPVS_CMD_SET_DEST, /* modify destination */
272 IPVS_CMD_DEL_DEST, /* delete destination */
273 IPVS_CMD_GET_DEST, /* get destination info */
274
275 IPVS_CMD_NEW_DAEMON, /* start sync daemon */
276 IPVS_CMD_DEL_DAEMON, /* stop sync daemon */
277 IPVS_CMD_GET_DAEMON, /* get sync daemon status */
278
279 IPVS_CMD_SET_CONFIG, /* set config settings */
280 IPVS_CMD_GET_CONFIG, /* get config settings */
281
282 IPVS_CMD_SET_INFO, /* only used in GET_INFO reply */
283 IPVS_CMD_GET_INFO, /* get general IPVS info */
284
285 IPVS_CMD_ZERO, /* zero all counters and stats */
286 IPVS_CMD_FLUSH, /* flush services and dests */
287
288 __IPVS_CMD_MAX,
289};
290
291#define IPVS_CMD_MAX (__IPVS_CMD_MAX - 1)
292
293/* Attributes used in the first level of commands */
294enum {
295 IPVS_CMD_ATTR_UNSPEC = 0,
296 IPVS_CMD_ATTR_SERVICE, /* nested service attribute */
297 IPVS_CMD_ATTR_DEST, /* nested destination attribute */
298 IPVS_CMD_ATTR_DAEMON, /* nested sync daemon attribute */
299 IPVS_CMD_ATTR_TIMEOUT_TCP, /* TCP connection timeout */
300 IPVS_CMD_ATTR_TIMEOUT_TCP_FIN, /* TCP FIN wait timeout */
301 IPVS_CMD_ATTR_TIMEOUT_UDP, /* UDP timeout */
302 __IPVS_CMD_ATTR_MAX,
303};
304
305#define IPVS_CMD_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1)
306
307/*
308 * Attributes used to describe a service
309 *
310 * Used inside nested attribute IPVS_CMD_ATTR_SERVICE
311 */
312enum {
313 IPVS_SVC_ATTR_UNSPEC = 0,
314 IPVS_SVC_ATTR_AF, /* address family */
315 IPVS_SVC_ATTR_PROTOCOL, /* virtual service protocol */
316 IPVS_SVC_ATTR_ADDR, /* virtual service address */
317 IPVS_SVC_ATTR_PORT, /* virtual service port */
318 IPVS_SVC_ATTR_FWMARK, /* firewall mark of service */
319
320 IPVS_SVC_ATTR_SCHED_NAME, /* name of scheduler */
321 IPVS_SVC_ATTR_FLAGS, /* virtual service flags */
322 IPVS_SVC_ATTR_TIMEOUT, /* persistent timeout */
323 IPVS_SVC_ATTR_NETMASK, /* persistent netmask */
324
325 IPVS_SVC_ATTR_STATS, /* nested attribute for service stats */
326 __IPVS_SVC_ATTR_MAX,
327};
328
329#define IPVS_SVC_ATTR_MAX (__IPVS_SVC_ATTR_MAX - 1)
330
331/*
332 * Attributes used to describe a destination (real server)
333 *
334 * Used inside nested attribute IPVS_CMD_ATTR_DEST
335 */
336enum {
337 IPVS_DEST_ATTR_UNSPEC = 0,
338 IPVS_DEST_ATTR_ADDR, /* real server address */
339 IPVS_DEST_ATTR_PORT, /* real server port */
340
341 IPVS_DEST_ATTR_FWD_METHOD, /* forwarding method */
342 IPVS_DEST_ATTR_WEIGHT, /* destination weight */
343
344 IPVS_DEST_ATTR_U_THRESH, /* upper threshold */
345 IPVS_DEST_ATTR_L_THRESH, /* lower threshold */
346
347 IPVS_DEST_ATTR_ACTIVE_CONNS, /* active connections */
348 IPVS_DEST_ATTR_INACT_CONNS, /* inactive connections */
349 IPVS_DEST_ATTR_PERSIST_CONNS, /* persistent connections */
350
351 IPVS_DEST_ATTR_STATS, /* nested attribute for dest stats */
352 __IPVS_DEST_ATTR_MAX,
353};
354
355#define IPVS_DEST_ATTR_MAX (__IPVS_DEST_ATTR_MAX - 1)
356
357/*
358 * Attributes describing a sync daemon
359 *
360 * Used inside nested attribute IPVS_CMD_ATTR_DAEMON
361 */
362enum {
363 IPVS_DAEMON_ATTR_UNSPEC = 0,
364 IPVS_DAEMON_ATTR_STATE, /* sync daemon state (master/backup) */
365 IPVS_DAEMON_ATTR_MCAST_IFN, /* multicast interface name */
366 IPVS_DAEMON_ATTR_SYNC_ID, /* SyncID we belong to */
367 __IPVS_DAEMON_ATTR_MAX,
368};
369
370#define IPVS_DAEMON_ATTR_MAX (__IPVS_DAEMON_ATTR_MAX - 1)
371
372/*
373 * Attributes used to describe service or destination entry statistics
374 *
375 * Used inside nested attributes IPVS_SVC_ATTR_STATS and IPVS_DEST_ATTR_STATS
376 */
377enum {
378 IPVS_STATS_ATTR_UNSPEC = 0,
379 IPVS_STATS_ATTR_CONNS, /* connections scheduled */
380 IPVS_STATS_ATTR_INPKTS, /* incoming packets */
381 IPVS_STATS_ATTR_OUTPKTS, /* outgoing packets */
382 IPVS_STATS_ATTR_INBYTES, /* incoming bytes */
383 IPVS_STATS_ATTR_OUTBYTES, /* outgoing bytes */
384
385 IPVS_STATS_ATTR_CPS, /* current connection rate */
386 IPVS_STATS_ATTR_INPPS, /* current in packet rate */
387 IPVS_STATS_ATTR_OUTPPS, /* current out packet rate */
388 IPVS_STATS_ATTR_INBPS, /* current in byte rate */
389 IPVS_STATS_ATTR_OUTBPS, /* current out byte rate */
390 __IPVS_STATS_ATTR_MAX,
391};
392
393#define IPVS_STATS_ATTR_MAX (__IPVS_STATS_ATTR_MAX - 1)
394
395/* Attributes used in response to IPVS_CMD_GET_INFO command */
396enum {
397 IPVS_INFO_ATTR_UNSPEC = 0,
398 IPVS_INFO_ATTR_VERSION, /* IPVS version number */
399 IPVS_INFO_ATTR_CONN_TAB_SIZE, /* size of connection hash table */
400 __IPVS_INFO_ATTR_MAX,
401};
402
403#define IPVS_INFO_ATTR_MAX (__IPVS_INFO_ATTR_MAX - 1)
404
405#endif /* _IP_VS_H */
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 8ccb462ea42c..8d9411bc60f6 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -62,6 +62,7 @@ typedef void (*irq_flow_handler_t)(unsigned int irq,
62#define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */ 62#define IRQ_MOVE_PENDING 0x00200000 /* need to re-target IRQ destination */
63#define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */ 63#define IRQ_NO_BALANCING 0x00400000 /* IRQ is excluded from balancing */
64#define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */ 64#define IRQ_SPURIOUS_DISABLED 0x00800000 /* IRQ was disabled by the spurious trap */
65#define IRQ_MOVE_PCNTXT 0x01000000 /* IRQ migration from process context */
65 66
66#ifdef CONFIG_IRQ_PER_CPU 67#ifdef CONFIG_IRQ_PER_CPU
67# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU) 68# define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
diff --git a/include/linux/isdn_ppp.h b/include/linux/isdn_ppp.h
index 8687a7dc0632..4c218ee7587a 100644
--- a/include/linux/isdn_ppp.h
+++ b/include/linux/isdn_ppp.h
@@ -157,7 +157,7 @@ typedef struct {
157 157
158typedef struct { 158typedef struct {
159 int mp_mrru; /* unused */ 159 int mp_mrru; /* unused */
160 struct sk_buff * frags; /* fragments sl list -- use skb->next */ 160 struct sk_buff_head frags; /* fragments sl list */
161 long frames; /* number of frames in the frame list */ 161 long frames; /* number of frames in the frame list */
162 unsigned int seq; /* last processed packet seq #: any packets 162 unsigned int seq; /* last processed packet seq #: any packets
163 * with smaller seq # will be dropped 163 * with smaller seq # will be dropped
diff --git a/include/linux/ivtv.h b/include/linux/ivtv.h
index 794b8daa9378..17ca64b5a66c 100644
--- a/include/linux/ivtv.h
+++ b/include/linux/ivtv.h
@@ -21,11 +21,7 @@
21#ifndef __LINUX_IVTV_H__ 21#ifndef __LINUX_IVTV_H__
22#define __LINUX_IVTV_H__ 22#define __LINUX_IVTV_H__
23 23
24#ifdef __KERNEL__ 24#include <linux/compiler.h>
25#include <linux/compiler.h> /* need __user */
26#else
27#define __user
28#endif
29#include <linux/types.h> 25#include <linux/types.h>
30 26
31/* ivtv knows several distinct output modes: MPEG streaming, 27/* ivtv knows several distinct output modes: MPEG streaming,
diff --git a/include/linux/ivtvfb.h b/include/linux/ivtvfb.h
index e980ba62ddcc..e20af47b59ad 100644
--- a/include/linux/ivtvfb.h
+++ b/include/linux/ivtvfb.h
@@ -21,11 +21,7 @@
21#ifndef __LINUX_IVTVFB_H__ 21#ifndef __LINUX_IVTVFB_H__
22#define __LINUX_IVTVFB_H__ 22#define __LINUX_IVTVFB_H__
23 23
24#ifdef __KERNEL__ 24#include <linux/compiler.h>
25#include <linux/compiler.h> /* need __user */
26#else
27#define __user
28#endif
29#include <linux/types.h> 25#include <linux/types.h>
30 26
31/* Framebuffer external API */ 27/* Framebuffer external API */
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 3dd209007098..d2e91ea998fd 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -850,7 +850,8 @@ struct journal_s
850 */ 850 */
851 struct block_device *j_dev; 851 struct block_device *j_dev;
852 int j_blocksize; 852 int j_blocksize;
853 unsigned long long j_blk_offset; 853 unsigned long long j_blk_offset;
854 char j_devname[BDEVNAME_SIZE+24];
854 855
855 /* 856 /*
856 * Device which holds the client fs. For internal journal this will be 857 * Device which holds the client fs. For internal journal this will be
@@ -966,6 +967,9 @@ struct journal_s
966#define JBD2_FLUSHED 0x008 /* The journal superblock has been flushed */ 967#define JBD2_FLUSHED 0x008 /* The journal superblock has been flushed */
967#define JBD2_LOADED 0x010 /* The journal superblock has been loaded */ 968#define JBD2_LOADED 0x010 /* The journal superblock has been loaded */
968#define JBD2_BARRIER 0x020 /* Use IDE barriers */ 969#define JBD2_BARRIER 0x020 /* Use IDE barriers */
970#define JBD2_ABORT_ON_SYNCDATA_ERR 0x040 /* Abort the journal on file
971 * data write error in ordered
972 * mode */
969 973
970/* 974/*
971 * Function declarations for the journaling transaction and buffer 975 * Function declarations for the journaling transaction and buffer
@@ -1059,7 +1063,7 @@ extern void jbd2_journal_clear_features
1059 (journal_t *, unsigned long, unsigned long, unsigned long); 1063 (journal_t *, unsigned long, unsigned long, unsigned long);
1060extern int jbd2_journal_create (journal_t *); 1064extern int jbd2_journal_create (journal_t *);
1061extern int jbd2_journal_load (journal_t *journal); 1065extern int jbd2_journal_load (journal_t *journal);
1062extern void jbd2_journal_destroy (journal_t *); 1066extern int jbd2_journal_destroy (journal_t *);
1063extern int jbd2_journal_recover (journal_t *journal); 1067extern int jbd2_journal_recover (journal_t *journal);
1064extern int jbd2_journal_wipe (journal_t *, int); 1068extern int jbd2_journal_wipe (journal_t *, int);
1065extern int jbd2_journal_skip_recovery (journal_t *); 1069extern int jbd2_journal_skip_recovery (journal_t *);
diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h
index 6b563cae23df..da720bc3eb15 100644
--- a/include/linux/jffs2.h
+++ b/include/linux/jffs2.h
@@ -7,9 +7,6 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in the 8 * For licensing information, see the file 'LICENCE' in the
9 * jffs2 directory. 9 * jffs2 directory.
10 *
11 * $Id: jffs2.h,v 1.38 2005/09/26 11:37:23 havasi Exp $
12 *
13 */ 10 */
14 11
15#ifndef __LINUX_JFFS2_H__ 12#ifndef __LINUX_JFFS2_H__
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 57aefa160a92..b96144887444 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -108,8 +108,7 @@ static inline void print_fn_descriptor_symbol(const char *fmt, void *addr)
108 108
109static inline void print_ip_sym(unsigned long ip) 109static inline void print_ip_sym(unsigned long ip)
110{ 110{
111 printk("[<%p>]", (void *) ip); 111 printk("[<%p>] %pS\n", (void *) ip, (void *) ip);
112 print_symbol(" %s\n", ip);
113} 112}
114 113
115#endif /*_LINUX_KALLSYMS_H*/ 114#endif /*_LINUX_KALLSYMS_H*/
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index fdbbf72ca2eb..75d81f157d2e 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -75,6 +75,12 @@ extern const char linux_proc_banner[];
75 */ 75 */
76#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16)) 76#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
77 77
78/**
79 * lower_32_bits - return bits 0-31 of a number
80 * @n: the number we're accessing
81 */
82#define lower_32_bits(n) ((u32)(n))
83
78#define KERN_EMERG "<0>" /* system is unusable */ 84#define KERN_EMERG "<0>" /* system is unusable */
79#define KERN_ALERT "<1>" /* action must be taken immediately */ 85#define KERN_ALERT "<1>" /* action must be taken immediately */
80#define KERN_CRIT "<2>" /* critical conditions */ 86#define KERN_CRIT "<2>" /* critical conditions */
@@ -102,6 +108,13 @@ struct completion;
102struct pt_regs; 108struct pt_regs;
103struct user; 109struct user;
104 110
111#ifdef CONFIG_PREEMPT_VOLUNTARY
112extern int _cond_resched(void);
113# define might_resched() _cond_resched()
114#else
115# define might_resched() do { } while (0)
116#endif
117
105/** 118/**
106 * might_sleep - annotation for functions that can sleep 119 * might_sleep - annotation for functions that can sleep
107 * 120 *
@@ -112,13 +125,6 @@ struct user;
112 * be bitten later when the calling function happens to sleep when it is not 125 * be bitten later when the calling function happens to sleep when it is not
113 * supposed to. 126 * supposed to.
114 */ 127 */
115#ifdef CONFIG_PREEMPT_VOLUNTARY
116extern int _cond_resched(void);
117# define might_resched() _cond_resched()
118#else
119# define might_resched() do { } while (0)
120#endif
121
122#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP 128#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
123 void __might_sleep(char *file, int line); 129 void __might_sleep(char *file, int line);
124# define might_sleep() \ 130# define might_sleep() \
@@ -176,7 +182,7 @@ extern int vsscanf(const char *, const char *, va_list)
176 182
177extern int get_option(char **str, int *pint); 183extern int get_option(char **str, int *pint);
178extern char *get_options(const char *str, int nints, int *ints); 184extern char *get_options(const char *str, int nints, int *ints);
179extern unsigned long long memparse(char *ptr, char **retptr); 185extern unsigned long long memparse(const char *ptr, char **retptr);
180 186
181extern int core_kernel_text(unsigned long addr); 187extern int core_kernel_text(unsigned long addr);
182extern int __kernel_text_address(unsigned long addr); 188extern int __kernel_text_address(unsigned long addr);
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 3265968cd2cd..17f76fc05173 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -25,8 +25,8 @@
25#error KEXEC_CONTROL_MEMORY_LIMIT not defined 25#error KEXEC_CONTROL_MEMORY_LIMIT not defined
26#endif 26#endif
27 27
28#ifndef KEXEC_CONTROL_CODE_SIZE 28#ifndef KEXEC_CONTROL_PAGE_SIZE
29#error KEXEC_CONTROL_CODE_SIZE not defined 29#error KEXEC_CONTROL_PAGE_SIZE not defined
30#endif 30#endif
31 31
32#ifndef KEXEC_ARCH 32#ifndef KEXEC_ARCH
@@ -83,6 +83,7 @@ struct kimage {
83 83
84 unsigned long start; 84 unsigned long start;
85 struct page *control_code_page; 85 struct page *control_code_page;
86 struct page *swap_page;
86 87
87 unsigned long nr_segments; 88 unsigned long nr_segments;
88 struct kexec_segment segment[KEXEC_SEGMENT_MAX]; 89 struct kexec_segment segment[KEXEC_SEGMENT_MAX];
@@ -98,18 +99,20 @@ struct kimage {
98 unsigned int type : 1; 99 unsigned int type : 1;
99#define KEXEC_TYPE_DEFAULT 0 100#define KEXEC_TYPE_DEFAULT 0
100#define KEXEC_TYPE_CRASH 1 101#define KEXEC_TYPE_CRASH 1
102 unsigned int preserve_context : 1;
101}; 103};
102 104
103 105
104 106
105/* kexec interface functions */ 107/* kexec interface functions */
106extern NORET_TYPE void machine_kexec(struct kimage *image) ATTRIB_NORET; 108extern void machine_kexec(struct kimage *image);
107extern int machine_kexec_prepare(struct kimage *image); 109extern int machine_kexec_prepare(struct kimage *image);
108extern void machine_kexec_cleanup(struct kimage *image); 110extern void machine_kexec_cleanup(struct kimage *image);
109extern asmlinkage long sys_kexec_load(unsigned long entry, 111extern asmlinkage long sys_kexec_load(unsigned long entry,
110 unsigned long nr_segments, 112 unsigned long nr_segments,
111 struct kexec_segment __user *segments, 113 struct kexec_segment __user *segments,
112 unsigned long flags); 114 unsigned long flags);
115extern int kernel_kexec(void);
113#ifdef CONFIG_COMPAT 116#ifdef CONFIG_COMPAT
114extern asmlinkage long compat_sys_kexec_load(unsigned long entry, 117extern asmlinkage long compat_sys_kexec_load(unsigned long entry,
115 unsigned long nr_segments, 118 unsigned long nr_segments,
@@ -127,8 +130,8 @@ void vmcoreinfo_append_str(const char *fmt, ...)
127 __attribute__ ((format (printf, 1, 2))); 130 __attribute__ ((format (printf, 1, 2)));
128unsigned long paddr_vmcoreinfo_note(void); 131unsigned long paddr_vmcoreinfo_note(void);
129 132
130#define VMCOREINFO_OSRELEASE(name) \ 133#define VMCOREINFO_OSRELEASE(value) \
131 vmcoreinfo_append_str("OSRELEASE=%s\n", #name) 134 vmcoreinfo_append_str("OSRELEASE=%s\n", value)
132#define VMCOREINFO_PAGESIZE(value) \ 135#define VMCOREINFO_PAGESIZE(value) \
133 vmcoreinfo_append_str("PAGESIZE=%ld\n", value) 136 vmcoreinfo_append_str("PAGESIZE=%ld\n", value)
134#define VMCOREINFO_SYMBOL(name) \ 137#define VMCOREINFO_SYMBOL(name) \
@@ -156,8 +159,9 @@ extern struct kimage *kexec_crash_image;
156#define kexec_flush_icache_page(page) 159#define kexec_flush_icache_page(page)
157#endif 160#endif
158 161
159#define KEXEC_ON_CRASH 0x00000001 162#define KEXEC_ON_CRASH 0x00000001
160#define KEXEC_ARCH_MASK 0xffff0000 163#define KEXEC_PRESERVE_CONTEXT 0x00000002
164#define KEXEC_ARCH_MASK 0xffff0000
161 165
162/* These values match the ELF architecture values. 166/* These values match the ELF architecture values.
163 * Unless there is a good reason that should continue to be the case. 167 * Unless there is a good reason that should continue to be the case.
@@ -174,7 +178,12 @@ extern struct kimage *kexec_crash_image;
174#define KEXEC_ARCH_MIPS_LE (10 << 16) 178#define KEXEC_ARCH_MIPS_LE (10 << 16)
175#define KEXEC_ARCH_MIPS ( 8 << 16) 179#define KEXEC_ARCH_MIPS ( 8 << 16)
176 180
177#define KEXEC_FLAGS (KEXEC_ON_CRASH) /* List of defined/legal kexec flags */ 181/* List of defined/legal kexec flags */
182#ifndef CONFIG_KEXEC_JUMP
183#define KEXEC_FLAGS KEXEC_ON_CRASH
184#else
185#define KEXEC_FLAGS (KEXEC_ON_CRASH | KEXEC_PRESERVE_CONTEXT)
186#endif
178 187
179#define VMCOREINFO_BYTES (4096) 188#define VMCOREINFO_BYTES (4096)
180#define VMCOREINFO_NOTE_NAME "VMCOREINFO" 189#define VMCOREINFO_NOTE_NAME "VMCOREINFO"
diff --git a/include/linux/key.h b/include/linux/key.h
index c45c962d1cc5..1b70e35a71e3 100644
--- a/include/linux/key.h
+++ b/include/linux/key.h
@@ -299,6 +299,7 @@ extern void key_init(void);
299#define key_validate(k) 0 299#define key_validate(k) 0
300#define key_serial(k) 0 300#define key_serial(k) 0
301#define key_get(k) ({ NULL; }) 301#define key_get(k) ({ NULL; })
302#define key_revoke(k) do { } while(0)
302#define key_put(k) do { } while(0) 303#define key_put(k) do { } while(0)
303#define key_ref_put(k) do { } while(0) 304#define key_ref_put(k) do { } while(0)
304#define make_key_ref(k, p) ({ NULL; }) 305#define make_key_ref(k, p) ({ NULL; })
diff --git a/include/linux/klist.h b/include/linux/klist.h
index 06c338ef7f1b..8ea98db223e5 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -38,7 +38,7 @@ extern void klist_init(struct klist *k, void (*get)(struct klist_node *),
38 void (*put)(struct klist_node *)); 38 void (*put)(struct klist_node *));
39 39
40struct klist_node { 40struct klist_node {
41 struct klist *n_klist; 41 void *n_klist; /* never access directly */
42 struct list_head n_node; 42 struct list_head n_node;
43 struct kref n_ref; 43 struct kref n_ref;
44 struct completion n_removed; 44 struct completion n_removed;
@@ -57,7 +57,6 @@ extern int klist_node_attached(struct klist_node *n);
57 57
58struct klist_iter { 58struct klist_iter {
59 struct klist *i_klist; 59 struct klist *i_klist;
60 struct list_head *i_head;
61 struct klist_node *i_cur; 60 struct klist_node *i_cur;
62}; 61};
63 62
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index 0ea064cbfbc8..70a30651cd12 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -320,12 +320,12 @@ struct kvm_trace_rec {
320 struct { 320 struct {
321 __u64 cycle_u64; 321 __u64 cycle_u64;
322 __u32 extra_u32[KVM_TRC_EXTRA_MAX]; 322 __u32 extra_u32[KVM_TRC_EXTRA_MAX];
323 } cycle; 323 } __attribute__((packed)) cycle;
324 struct { 324 struct {
325 __u32 extra_u32[KVM_TRC_EXTRA_MAX]; 325 __u32 extra_u32[KVM_TRC_EXTRA_MAX];
326 } nocycle; 326 } nocycle;
327 } u; 327 } u;
328} __attribute__((packed)); 328};
329 329
330#define KVMIO 0xAE 330#define KVMIO 0xAE
331 331
@@ -371,6 +371,7 @@ struct kvm_trace_rec {
371#define KVM_CAP_PV_MMU 13 371#define KVM_CAP_PV_MMU 13
372#define KVM_CAP_MP_STATE 14 372#define KVM_CAP_MP_STATE 14
373#define KVM_CAP_COALESCED_MMIO 15 373#define KVM_CAP_COALESCED_MMIO 15
374#define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */
374 375
375/* 376/*
376 * ioctls for VM fds 377 * ioctls for VM fds
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 07d68a8ae8e9..8525afc53107 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -121,6 +121,12 @@ struct kvm {
121 struct kvm_coalesced_mmio_dev *coalesced_mmio_dev; 121 struct kvm_coalesced_mmio_dev *coalesced_mmio_dev;
122 struct kvm_coalesced_mmio_ring *coalesced_mmio_ring; 122 struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
123#endif 123#endif
124
125#ifdef KVM_ARCH_WANT_MMU_NOTIFIER
126 struct mmu_notifier mmu_notifier;
127 unsigned long mmu_notifier_seq;
128 long mmu_notifier_count;
129#endif
124}; 130};
125 131
126/* The guest did something we don't support. */ 132/* The guest did something we don't support. */
@@ -332,4 +338,22 @@ int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg)
332#define kvm_trace_cleanup() ((void)0) 338#define kvm_trace_cleanup() ((void)0)
333#endif 339#endif
334 340
341#ifdef KVM_ARCH_WANT_MMU_NOTIFIER
342static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_seq)
343{
344 if (unlikely(vcpu->kvm->mmu_notifier_count))
345 return 1;
346 /*
347 * Both reads happen under the mmu_lock and both values are
348 * modified under mmu_lock, so there's no need of smb_rmb()
349 * here in between, otherwise mmu_notifier_count should be
350 * read before mmu_notifier_seq, see
351 * mmu_notifier_invalidate_range_end write side.
352 */
353 if (vcpu->kvm->mmu_notifier_seq != mmu_seq)
354 return 1;
355 return 0;
356}
357#endif
358
335#endif 359#endif
diff --git a/include/linux/lcd.h b/include/linux/lcd.h
index 173febac6656..c67fecafff90 100644
--- a/include/linux/lcd.h
+++ b/include/linux/lcd.h
@@ -11,6 +11,7 @@
11#include <linux/device.h> 11#include <linux/device.h>
12#include <linux/mutex.h> 12#include <linux/mutex.h>
13#include <linux/notifier.h> 13#include <linux/notifier.h>
14#include <linux/fb.h>
14 15
15/* Notes on locking: 16/* Notes on locking:
16 * 17 *
@@ -45,6 +46,8 @@ struct lcd_ops {
45 int (*get_contrast)(struct lcd_device *); 46 int (*get_contrast)(struct lcd_device *);
46 /* Set LCD panel contrast */ 47 /* Set LCD panel contrast */
47 int (*set_contrast)(struct lcd_device *, int contrast); 48 int (*set_contrast)(struct lcd_device *, int contrast);
49 /* Set LCD panel mode (resolutions ...) */
50 int (*set_mode)(struct lcd_device *, struct fb_videomode *);
48 /* Check if given framebuffer device is the one LCD is bound to; 51 /* Check if given framebuffer device is the one LCD is bound to;
49 return 0 if not, !=0 if it is. If NULL, lcd always matches the fb. */ 52 return 0 if not, !=0 if it is. If NULL, lcd always matches the fb. */
50 int (*check_fb)(struct lcd_device *, struct fb_info *); 53 int (*check_fb)(struct lcd_device *, struct fb_info *);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 5b247b8a6b3b..947cf84e555d 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -60,9 +60,9 @@
60 60
61/* note: prints function name for you */ 61/* note: prints function name for you */
62#ifdef ATA_DEBUG 62#ifdef ATA_DEBUG
63#define DPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args) 63#define DPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
64#ifdef ATA_VERBOSE_DEBUG 64#ifdef ATA_VERBOSE_DEBUG
65#define VPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args) 65#define VPRINTK(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)
66#else 66#else
67#define VPRINTK(fmt, args...) 67#define VPRINTK(fmt, args...)
68#endif /* ATA_VERBOSE_DEBUG */ 68#endif /* ATA_VERBOSE_DEBUG */
@@ -71,7 +71,7 @@
71#define VPRINTK(fmt, args...) 71#define VPRINTK(fmt, args...)
72#endif /* ATA_DEBUG */ 72#endif /* ATA_DEBUG */
73 73
74#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args) 74#define BPRINTK(fmt, args...) if (ap->flags & ATA_FLAG_DEBUGMSG) printk(KERN_ERR "%s: " fmt, __func__, ## args)
75 75
76/* NEW: debug levels */ 76/* NEW: debug levels */
77#define HAVE_LIBATA_MSG 1 77#define HAVE_LIBATA_MSG 1
@@ -146,6 +146,7 @@ enum {
146 ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */ 146 ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */
147 ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */ 147 ATA_DFLAG_SLEEPING = (1 << 15), /* device is sleeping */
148 ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */ 148 ATA_DFLAG_DUBIOUS_XFER = (1 << 16), /* data transfer not verified */
149 ATA_DFLAG_NO_UNLOAD = (1 << 17), /* device doesn't support unload */
149 ATA_DFLAG_INIT_MASK = (1 << 24) - 1, 150 ATA_DFLAG_INIT_MASK = (1 << 24) - 1,
150 151
151 ATA_DFLAG_DETACH = (1 << 24), 152 ATA_DFLAG_DETACH = (1 << 24),
@@ -163,6 +164,7 @@ enum {
163 ATA_DEV_NONE = 9, /* no device */ 164 ATA_DEV_NONE = 9, /* no device */
164 165
165 /* struct ata_link flags */ 166 /* struct ata_link flags */
167 ATA_LFLAG_NO_HRST = (1 << 1), /* avoid hardreset */
166 ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */ 168 ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */
167 ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */ 169 ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */
168 ATA_LFLAG_ASSUME_SEMB = (1 << 4), /* assume SEMB class */ 170 ATA_LFLAG_ASSUME_SEMB = (1 << 4), /* assume SEMB class */
@@ -243,6 +245,7 @@ enum {
243 ATA_TMOUT_BOOT = 30000, /* heuristic */ 245 ATA_TMOUT_BOOT = 30000, /* heuristic */
244 ATA_TMOUT_BOOT_QUICK = 7000, /* heuristic */ 246 ATA_TMOUT_BOOT_QUICK = 7000, /* heuristic */
245 ATA_TMOUT_INTERNAL_QUICK = 5000, 247 ATA_TMOUT_INTERNAL_QUICK = 5000,
248 ATA_TMOUT_MAX_PARK = 30000,
246 249
247 /* FIXME: GoVault needs 2s but we can't afford that without 250 /* FIXME: GoVault needs 2s but we can't afford that without
248 * parallel probing. 800ms is enough for iVDR disk 251 * parallel probing. 800ms is enough for iVDR disk
@@ -318,8 +321,11 @@ enum {
318 ATA_EH_RESET = ATA_EH_SOFTRESET | ATA_EH_HARDRESET, 321 ATA_EH_RESET = ATA_EH_SOFTRESET | ATA_EH_HARDRESET,
319 ATA_EH_ENABLE_LINK = (1 << 3), 322 ATA_EH_ENABLE_LINK = (1 << 3),
320 ATA_EH_LPM = (1 << 4), /* link power management action */ 323 ATA_EH_LPM = (1 << 4), /* link power management action */
324 ATA_EH_PARK = (1 << 5), /* unload heads and stop I/O */
321 325
322 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE, 326 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE | ATA_EH_PARK,
327 ATA_EH_ALL_ACTIONS = ATA_EH_REVALIDATE | ATA_EH_RESET |
328 ATA_EH_ENABLE_LINK | ATA_EH_LPM,
323 329
324 /* ata_eh_info->flags */ 330 /* ata_eh_info->flags */
325 ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */ 331 ATA_EHI_HOTPLUGGED = (1 << 0), /* could have been hotplugged */
@@ -451,6 +457,7 @@ enum link_pm {
451 MEDIUM_POWER, 457 MEDIUM_POWER,
452}; 458};
453extern struct device_attribute dev_attr_link_power_management_policy; 459extern struct device_attribute dev_attr_link_power_management_policy;
460extern struct device_attribute dev_attr_unload_heads;
454extern struct device_attribute dev_attr_em_message_type; 461extern struct device_attribute dev_attr_em_message_type;
455extern struct device_attribute dev_attr_em_message; 462extern struct device_attribute dev_attr_em_message;
456extern struct device_attribute dev_attr_sw_activity; 463extern struct device_attribute dev_attr_sw_activity;
@@ -553,8 +560,8 @@ struct ata_ering {
553struct ata_device { 560struct ata_device {
554 struct ata_link *link; 561 struct ata_link *link;
555 unsigned int devno; /* 0 or 1 */ 562 unsigned int devno; /* 0 or 1 */
556 unsigned long flags; /* ATA_DFLAG_xxx */
557 unsigned int horkage; /* List of broken features */ 563 unsigned int horkage; /* List of broken features */
564 unsigned long flags; /* ATA_DFLAG_xxx */
558 struct scsi_device *sdev; /* attached SCSI device */ 565 struct scsi_device *sdev; /* attached SCSI device */
559#ifdef CONFIG_ATA_ACPI 566#ifdef CONFIG_ATA_ACPI
560 acpi_handle acpi_handle; 567 acpi_handle acpi_handle;
@@ -563,6 +570,7 @@ struct ata_device {
563 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */ 570 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */
564 u64 n_sectors; /* size of device, if ATA */ 571 u64 n_sectors; /* size of device, if ATA */
565 unsigned int class; /* ATA_DEV_xxx */ 572 unsigned int class; /* ATA_DEV_xxx */
573 unsigned long unpark_deadline;
566 574
567 u8 pio_mode; 575 u8 pio_mode;
568 u8 dma_mode; 576 u8 dma_mode;
@@ -620,6 +628,7 @@ struct ata_eh_context {
620 [ATA_EH_CMD_TIMEOUT_TABLE_SIZE]; 628 [ATA_EH_CMD_TIMEOUT_TABLE_SIZE];
621 unsigned int classes[ATA_MAX_DEVICES]; 629 unsigned int classes[ATA_MAX_DEVICES];
622 unsigned int did_probe_mask; 630 unsigned int did_probe_mask;
631 unsigned int unloaded_mask;
623 unsigned int saved_ncq_enabled; 632 unsigned int saved_ncq_enabled;
624 u8 saved_xfer_mode[ATA_MAX_DEVICES]; 633 u8 saved_xfer_mode[ATA_MAX_DEVICES];
625 /* timestamp for the last reset attempt or success */ 634 /* timestamp for the last reset attempt or success */
@@ -646,6 +655,7 @@ struct ata_link {
646 655
647 unsigned int flags; /* ATA_LFLAG_xxx */ 656 unsigned int flags; /* ATA_LFLAG_xxx */
648 657
658 u32 saved_scontrol; /* SControl on probe */
649 unsigned int hw_sata_spd_limit; 659 unsigned int hw_sata_spd_limit;
650 unsigned int sata_spd_limit; 660 unsigned int sata_spd_limit;
651 unsigned int sata_spd; /* current SATA PHY speed */ 661 unsigned int sata_spd; /* current SATA PHY speed */
@@ -686,7 +696,8 @@ struct ata_port {
686 unsigned int qc_active; 696 unsigned int qc_active;
687 int nr_active_links; /* #links with active qcs */ 697 int nr_active_links; /* #links with active qcs */
688 698
689 struct ata_link link; /* host default link */ 699 struct ata_link link; /* host default link */
700 struct ata_link *slave_link; /* see ata_slave_link_init() */
690 701
691 int nr_pmp_links; /* nr of available PMP links */ 702 int nr_pmp_links; /* nr of available PMP links */
692 struct ata_link *pmp_link; /* array of PMP links */ 703 struct ata_link *pmp_link; /* array of PMP links */
@@ -707,6 +718,7 @@ struct ata_port {
707 struct list_head eh_done_q; 718 struct list_head eh_done_q;
708 wait_queue_head_t eh_wait_q; 719 wait_queue_head_t eh_wait_q;
709 int eh_tries; 720 int eh_tries;
721 struct completion park_req_pending;
710 722
711 pm_message_t pm_mesg; 723 pm_message_t pm_mesg;
712 int *pm_result; 724 int *pm_result;
@@ -750,6 +762,7 @@ struct ata_port_operations {
750 void (*set_piomode)(struct ata_port *ap, struct ata_device *dev); 762 void (*set_piomode)(struct ata_port *ap, struct ata_device *dev);
751 void (*set_dmamode)(struct ata_port *ap, struct ata_device *dev); 763 void (*set_dmamode)(struct ata_port *ap, struct ata_device *dev);
752 int (*set_mode)(struct ata_link *link, struct ata_device **r_failed_dev); 764 int (*set_mode)(struct ata_link *link, struct ata_device **r_failed_dev);
765 unsigned int (*read_id)(struct ata_device *dev, struct ata_taskfile *tf, u16 *id);
753 766
754 void (*dev_config)(struct ata_device *dev); 767 void (*dev_config)(struct ata_device *dev);
755 768
@@ -769,8 +782,8 @@ struct ata_port_operations {
769 /* 782 /*
770 * Optional features 783 * Optional features
771 */ 784 */
772 int (*scr_read)(struct ata_port *ap, unsigned int sc_reg, u32 *val); 785 int (*scr_read)(struct ata_link *link, unsigned int sc_reg, u32 *val);
773 int (*scr_write)(struct ata_port *ap, unsigned int sc_reg, u32 val); 786 int (*scr_write)(struct ata_link *link, unsigned int sc_reg, u32 val);
774 void (*pmp_attach)(struct ata_port *ap); 787 void (*pmp_attach)(struct ata_port *ap);
775 void (*pmp_detach)(struct ata_port *ap); 788 void (*pmp_detach)(struct ata_port *ap);
776 int (*enable_pm)(struct ata_port *ap, enum link_pm policy); 789 int (*enable_pm)(struct ata_port *ap, enum link_pm policy);
@@ -892,6 +905,7 @@ extern void ata_port_disable(struct ata_port *);
892extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); 905extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);
893extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, 906extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,
894 const struct ata_port_info * const * ppi, int n_ports); 907 const struct ata_port_info * const * ppi, int n_ports);
908extern int ata_slave_link_init(struct ata_port *ap);
895extern int ata_host_start(struct ata_host *host); 909extern int ata_host_start(struct ata_host *host);
896extern int ata_host_register(struct ata_host *host, 910extern int ata_host_register(struct ata_host *host,
897 struct scsi_host_template *sht); 911 struct scsi_host_template *sht);
@@ -917,8 +931,8 @@ extern int sata_scr_valid(struct ata_link *link);
917extern int sata_scr_read(struct ata_link *link, int reg, u32 *val); 931extern int sata_scr_read(struct ata_link *link, int reg, u32 *val);
918extern int sata_scr_write(struct ata_link *link, int reg, u32 val); 932extern int sata_scr_write(struct ata_link *link, int reg, u32 val);
919extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val); 933extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val);
920extern int ata_link_online(struct ata_link *link); 934extern bool ata_link_online(struct ata_link *link);
921extern int ata_link_offline(struct ata_link *link); 935extern bool ata_link_offline(struct ata_link *link);
922#ifdef CONFIG_PM 936#ifdef CONFIG_PM
923extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); 937extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
924extern void ata_host_resume(struct ata_host *host); 938extern void ata_host_resume(struct ata_host *host);
@@ -951,6 +965,8 @@ extern void ata_id_string(const u16 *id, unsigned char *s,
951 unsigned int ofs, unsigned int len); 965 unsigned int ofs, unsigned int len);
952extern void ata_id_c_string(const u16 *id, unsigned char *s, 966extern void ata_id_c_string(const u16 *id, unsigned char *s,
953 unsigned int ofs, unsigned int len); 967 unsigned int ofs, unsigned int len);
968extern unsigned int ata_do_dev_read_id(struct ata_device *dev,
969 struct ata_taskfile *tf, u16 *id);
954extern void ata_qc_complete(struct ata_queued_cmd *qc); 970extern void ata_qc_complete(struct ata_queued_cmd *qc);
955extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active); 971extern int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active);
956extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd, 972extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,
@@ -1093,6 +1109,7 @@ extern void ata_std_error_handler(struct ata_port *ap);
1093 */ 1109 */
1094extern const struct ata_port_operations ata_base_port_ops; 1110extern const struct ata_port_operations ata_base_port_ops;
1095extern const struct ata_port_operations sata_port_ops; 1111extern const struct ata_port_operations sata_port_ops;
1112extern struct device_attribute *ata_common_sdev_attrs[];
1096 1113
1097#define ATA_BASE_SHT(drv_name) \ 1114#define ATA_BASE_SHT(drv_name) \
1098 .module = THIS_MODULE, \ 1115 .module = THIS_MODULE, \
@@ -1107,7 +1124,8 @@ extern const struct ata_port_operations sata_port_ops;
1107 .proc_name = drv_name, \ 1124 .proc_name = drv_name, \
1108 .slave_configure = ata_scsi_slave_config, \ 1125 .slave_configure = ata_scsi_slave_config, \
1109 .slave_destroy = ata_scsi_slave_destroy, \ 1126 .slave_destroy = ata_scsi_slave_destroy, \
1110 .bios_param = ata_std_bios_param 1127 .bios_param = ata_std_bios_param, \
1128 .sdev_attrs = ata_common_sdev_attrs
1111 1129
1112#define ATA_NCQ_SHT(drv_name) \ 1130#define ATA_NCQ_SHT(drv_name) \
1113 ATA_BASE_SHT(drv_name), \ 1131 ATA_BASE_SHT(drv_name), \
@@ -1129,7 +1147,7 @@ static inline bool sata_pmp_attached(struct ata_port *ap)
1129 1147
1130static inline int ata_is_host_link(const struct ata_link *link) 1148static inline int ata_is_host_link(const struct ata_link *link)
1131{ 1149{
1132 return link == &link->ap->link; 1150 return link == &link->ap->link || link == link->ap->slave_link;
1133} 1151}
1134#else /* CONFIG_SATA_PMP */ 1152#else /* CONFIG_SATA_PMP */
1135static inline bool sata_pmp_supported(struct ata_port *ap) 1153static inline bool sata_pmp_supported(struct ata_port *ap)
@@ -1162,7 +1180,7 @@ static inline int sata_srst_pmp(struct ata_link *link)
1162 printk("%sata%u: "fmt, lv, (ap)->print_id , ##args) 1180 printk("%sata%u: "fmt, lv, (ap)->print_id , ##args)
1163 1181
1164#define ata_link_printk(link, lv, fmt, args...) do { \ 1182#define ata_link_printk(link, lv, fmt, args...) do { \
1165 if (sata_pmp_attached((link)->ap)) \ 1183 if (sata_pmp_attached((link)->ap) || (link)->ap->slave_link) \
1166 printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \ 1184 printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id, \
1167 (link)->pmp , ##args); \ 1185 (link)->pmp , ##args); \
1168 else \ 1186 else \
@@ -1260,34 +1278,17 @@ static inline int ata_link_active(struct ata_link *link)
1260 return ata_tag_valid(link->active_tag) || link->sactive; 1278 return ata_tag_valid(link->active_tag) || link->sactive;
1261} 1279}
1262 1280
1263static inline struct ata_link *ata_port_first_link(struct ata_port *ap) 1281extern struct ata_link *__ata_port_next_link(struct ata_port *ap,
1264{ 1282 struct ata_link *link,
1265 if (sata_pmp_attached(ap)) 1283 bool dev_only);
1266 return ap->pmp_link;
1267 return &ap->link;
1268}
1269
1270static inline struct ata_link *ata_port_next_link(struct ata_link *link)
1271{
1272 struct ata_port *ap = link->ap;
1273
1274 if (ata_is_host_link(link)) {
1275 if (!sata_pmp_attached(ap))
1276 return NULL;
1277 return ap->pmp_link;
1278 }
1279
1280 if (++link < ap->nr_pmp_links + ap->pmp_link)
1281 return link;
1282 return NULL;
1283}
1284 1284
1285#define __ata_port_for_each_link(lk, ap) \ 1285#define __ata_port_for_each_link(link, ap) \
1286 for ((lk) = &(ap)->link; (lk); (lk) = ata_port_next_link(lk)) 1286 for ((link) = __ata_port_next_link((ap), NULL, false); (link); \
1287 (link) = __ata_port_next_link((ap), (link), false))
1287 1288
1288#define ata_port_for_each_link(link, ap) \ 1289#define ata_port_for_each_link(link, ap) \
1289 for ((link) = ata_port_first_link(ap); (link); \ 1290 for ((link) = __ata_port_next_link((ap), NULL, true); (link); \
1290 (link) = ata_port_next_link(link)) 1291 (link) = __ata_port_next_link((ap), (link), true))
1291 1292
1292#define ata_link_for_each_dev(dev, link) \ 1293#define ata_link_for_each_dev(dev, link) \
1293 for ((dev) = (link)->device; \ 1294 for ((dev) = (link)->device; \
@@ -1424,6 +1425,28 @@ static inline unsigned long ata_deadline(unsigned long from_jiffies,
1424 return from_jiffies + msecs_to_jiffies(timeout_msecs); 1425 return from_jiffies + msecs_to_jiffies(timeout_msecs);
1425} 1426}
1426 1427
1428/* Don't open code these in drivers as there are traps. Firstly the range may
1429 change in future hardware and specs, secondly 0xFF means 'no DMA' but is
1430 > UDMA_0. Dyma ddreigiau */
1431
1432static inline int ata_using_mwdma(struct ata_device *adev)
1433{
1434 if (adev->dma_mode >= XFER_MW_DMA_0 && adev->dma_mode <= XFER_MW_DMA_4)
1435 return 1;
1436 return 0;
1437}
1438
1439static inline int ata_using_udma(struct ata_device *adev)
1440{
1441 if (adev->dma_mode >= XFER_UDMA_0 && adev->dma_mode <= XFER_UDMA_7)
1442 return 1;
1443 return 0;
1444}
1445
1446static inline int ata_dma_enabled(struct ata_device *adev)
1447{
1448 return (adev->dma_mode == 0xFF ? 0 : 1);
1449}
1427 1450
1428/************************************************************************** 1451/**************************************************************************
1429 * PMP - drivers/ata/libata-pmp.c 1452 * PMP - drivers/ata/libata-pmp.c
diff --git a/include/linux/list.h b/include/linux/list.h
index 453916bc0412..969f6e92d089 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -214,22 +214,62 @@ static inline int list_is_singular(const struct list_head *head)
214 return !list_empty(head) && (head->next == head->prev); 214 return !list_empty(head) && (head->next == head->prev);
215} 215}
216 216
217static inline void __list_cut_position(struct list_head *list,
218 struct list_head *head, struct list_head *entry)
219{
220 struct list_head *new_first = entry->next;
221 list->next = head->next;
222 list->next->prev = list;
223 list->prev = entry;
224 entry->next = list;
225 head->next = new_first;
226 new_first->prev = head;
227}
228
229/**
230 * list_cut_position - cut a list into two
231 * @list: a new list to add all removed entries
232 * @head: a list with entries
233 * @entry: an entry within head, could be the head itself
234 * and if so we won't cut the list
235 *
236 * This helper moves the initial part of @head, up to and
237 * including @entry, from @head to @list. You should
238 * pass on @entry an element you know is on @head. @list
239 * should be an empty list or a list you do not care about
240 * losing its data.
241 *
242 */
243static inline void list_cut_position(struct list_head *list,
244 struct list_head *head, struct list_head *entry)
245{
246 if (list_empty(head))
247 return;
248 if (list_is_singular(head) &&
249 (head->next != entry && head != entry))
250 return;
251 if (entry == head)
252 INIT_LIST_HEAD(list);
253 else
254 __list_cut_position(list, head, entry);
255}
256
217static inline void __list_splice(const struct list_head *list, 257static inline void __list_splice(const struct list_head *list,
218 struct list_head *head) 258 struct list_head *prev,
259 struct list_head *next)
219{ 260{
220 struct list_head *first = list->next; 261 struct list_head *first = list->next;
221 struct list_head *last = list->prev; 262 struct list_head *last = list->prev;
222 struct list_head *at = head->next;
223 263
224 first->prev = head; 264 first->prev = prev;
225 head->next = first; 265 prev->next = first;
226 266
227 last->next = at; 267 last->next = next;
228 at->prev = last; 268 next->prev = last;
229} 269}
230 270
231/** 271/**
232 * list_splice - join two lists 272 * list_splice - join two lists, this is designed for stacks
233 * @list: the new list to add. 273 * @list: the new list to add.
234 * @head: the place to add it in the first list. 274 * @head: the place to add it in the first list.
235 */ 275 */
@@ -237,7 +277,19 @@ static inline void list_splice(const struct list_head *list,
237 struct list_head *head) 277 struct list_head *head)
238{ 278{
239 if (!list_empty(list)) 279 if (!list_empty(list))
240 __list_splice(list, head); 280 __list_splice(list, head, head->next);
281}
282
283/**
284 * list_splice_tail - join two lists, each list being a queue
285 * @list: the new list to add.
286 * @head: the place to add it in the first list.
287 */
288static inline void list_splice_tail(struct list_head *list,
289 struct list_head *head)
290{
291 if (!list_empty(list))
292 __list_splice(list, head->prev, head);
241} 293}
242 294
243/** 295/**
@@ -251,7 +303,24 @@ static inline void list_splice_init(struct list_head *list,
251 struct list_head *head) 303 struct list_head *head)
252{ 304{
253 if (!list_empty(list)) { 305 if (!list_empty(list)) {
254 __list_splice(list, head); 306 __list_splice(list, head, head->next);
307 INIT_LIST_HEAD(list);
308 }
309}
310
311/**
312 * list_splice_tail_init - join two lists and reinitialise the emptied list
313 * @list: the new list to add.
314 * @head: the place to add it in the first list.
315 *
316 * Each of the lists is a queue.
317 * The list at @list is reinitialised
318 */
319static inline void list_splice_tail_init(struct list_head *list,
320 struct list_head *head)
321{
322 if (!list_empty(list)) {
323 __list_splice(list, head->prev, head);
255 INIT_LIST_HEAD(list); 324 INIT_LIST_HEAD(list);
256 } 325 }
257} 326}
@@ -550,6 +619,19 @@ static inline void hlist_add_after(struct hlist_node *n,
550 next->next->pprev = &next->next; 619 next->next->pprev = &next->next;
551} 620}
552 621
622/*
623 * Move a list from one list head to another. Fixup the pprev
624 * reference of the first entry if it exists.
625 */
626static inline void hlist_move_list(struct hlist_head *old,
627 struct hlist_head *new)
628{
629 new->first = old->first;
630 if (new->first)
631 new->first->pprev = &new->first;
632 old->first = NULL;
633}
634
553#define hlist_entry(ptr, type, member) container_of(ptr,type,member) 635#define hlist_entry(ptr, type, member) container_of(ptr,type,member)
554 636
555#define hlist_for_each(pos, head) \ 637#define hlist_for_each(pos, head) \
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 2486eb4edbf1..331e5f1c2d8e 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -89,6 +89,7 @@ struct lock_class {
89 89
90 struct lockdep_subclass_key *key; 90 struct lockdep_subclass_key *key;
91 unsigned int subclass; 91 unsigned int subclass;
92 unsigned int dep_gen_id;
92 93
93 /* 94 /*
94 * IRQ/softirq usage tracking bits: 95 * IRQ/softirq usage tracking bits:
@@ -189,6 +190,14 @@ struct lock_chain {
189 u64 chain_key; 190 u64 chain_key;
190}; 191};
191 192
193#define MAX_LOCKDEP_KEYS_BITS 13
194/*
195 * Subtract one because we offset hlock->class_idx by 1 in order
196 * to make 0 mean no class. This avoids overflowing the class_idx
197 * bitfield and hitting the BUG in hlock_class().
198 */
199#define MAX_LOCKDEP_KEYS ((1UL << MAX_LOCKDEP_KEYS_BITS) - 1)
200
192struct held_lock { 201struct held_lock {
193 /* 202 /*
194 * One-way hash of the dependency chain up to this point. We 203 * One-way hash of the dependency chain up to this point. We
@@ -205,14 +214,14 @@ struct held_lock {
205 * with zero), here we store the previous hash value: 214 * with zero), here we store the previous hash value:
206 */ 215 */
207 u64 prev_chain_key; 216 u64 prev_chain_key;
208 struct lock_class *class;
209 unsigned long acquire_ip; 217 unsigned long acquire_ip;
210 struct lockdep_map *instance; 218 struct lockdep_map *instance;
211 219 struct lockdep_map *nest_lock;
212#ifdef CONFIG_LOCK_STAT 220#ifdef CONFIG_LOCK_STAT
213 u64 waittime_stamp; 221 u64 waittime_stamp;
214 u64 holdtime_stamp; 222 u64 holdtime_stamp;
215#endif 223#endif
224 unsigned int class_idx:MAX_LOCKDEP_KEYS_BITS;
216 /* 225 /*
217 * The lock-stack is unified in that the lock chains of interrupt 226 * The lock-stack is unified in that the lock chains of interrupt
218 * contexts nest ontop of process context chains, but we 'separate' 227 * contexts nest ontop of process context chains, but we 'separate'
@@ -226,11 +235,11 @@ struct held_lock {
226 * The following field is used to detect when we cross into an 235 * The following field is used to detect when we cross into an
227 * interrupt context: 236 * interrupt context:
228 */ 237 */
229 int irq_context; 238 unsigned int irq_context:2; /* bit 0 - soft, bit 1 - hard */
230 int trylock; 239 unsigned int trylock:1;
231 int read; 240 unsigned int read:2; /* see lock_acquire() comment */
232 int check; 241 unsigned int check:2; /* see lock_acquire() comment */
233 int hardirqs_off; 242 unsigned int hardirqs_off:1;
234}; 243};
235 244
236/* 245/*
@@ -294,11 +303,15 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name,
294 * 2: full validation 303 * 2: full validation
295 */ 304 */
296extern void lock_acquire(struct lockdep_map *lock, unsigned int subclass, 305extern void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
297 int trylock, int read, int check, unsigned long ip); 306 int trylock, int read, int check,
307 struct lockdep_map *nest_lock, unsigned long ip);
298 308
299extern void lock_release(struct lockdep_map *lock, int nested, 309extern void lock_release(struct lockdep_map *lock, int nested,
300 unsigned long ip); 310 unsigned long ip);
301 311
312extern void lock_set_subclass(struct lockdep_map *lock, unsigned int subclass,
313 unsigned long ip);
314
302# define INIT_LOCKDEP .lockdep_recursion = 0, 315# define INIT_LOCKDEP .lockdep_recursion = 0,
303 316
304#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0) 317#define lockdep_depth(tsk) (debug_locks ? (tsk)->lockdep_depth : 0)
@@ -313,8 +326,9 @@ static inline void lockdep_on(void)
313{ 326{
314} 327}
315 328
316# define lock_acquire(l, s, t, r, c, i) do { } while (0) 329# define lock_acquire(l, s, t, r, c, n, i) do { } while (0)
317# define lock_release(l, n, i) do { } while (0) 330# define lock_release(l, n, i) do { } while (0)
331# define lock_set_subclass(l, s, i) do { } while (0)
318# define lockdep_init() do { } while (0) 332# define lockdep_init() do { } while (0)
319# define lockdep_info() do { } while (0) 333# define lockdep_info() do { } while (0)
320# define lockdep_init_map(lock, name, key, sub) do { (void)(key); } while (0) 334# define lockdep_init_map(lock, name, key, sub) do { (void)(key); } while (0)
@@ -400,9 +414,11 @@ static inline void print_irqtrace_events(struct task_struct *curr)
400 414
401#ifdef CONFIG_DEBUG_LOCK_ALLOC 415#ifdef CONFIG_DEBUG_LOCK_ALLOC
402# ifdef CONFIG_PROVE_LOCKING 416# ifdef CONFIG_PROVE_LOCKING
403# define spin_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i) 417# define spin_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i)
418# define spin_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 2, n, i)
404# else 419# else
405# define spin_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i) 420# define spin_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i)
421# define spin_acquire_nest(l, s, t, n, i) lock_acquire(l, s, t, 0, 1, NULL, i)
406# endif 422# endif
407# define spin_release(l, n, i) lock_release(l, n, i) 423# define spin_release(l, n, i) lock_release(l, n, i)
408#else 424#else
@@ -412,11 +428,11 @@ static inline void print_irqtrace_events(struct task_struct *curr)
412 428
413#ifdef CONFIG_DEBUG_LOCK_ALLOC 429#ifdef CONFIG_DEBUG_LOCK_ALLOC
414# ifdef CONFIG_PROVE_LOCKING 430# ifdef CONFIG_PROVE_LOCKING
415# define rwlock_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i) 431# define rwlock_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i)
416# define rwlock_acquire_read(l, s, t, i) lock_acquire(l, s, t, 2, 2, i) 432# define rwlock_acquire_read(l, s, t, i) lock_acquire(l, s, t, 2, 2, NULL, i)
417# else 433# else
418# define rwlock_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i) 434# define rwlock_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i)
419# define rwlock_acquire_read(l, s, t, i) lock_acquire(l, s, t, 2, 1, i) 435# define rwlock_acquire_read(l, s, t, i) lock_acquire(l, s, t, 2, 1, NULL, i)
420# endif 436# endif
421# define rwlock_release(l, n, i) lock_release(l, n, i) 437# define rwlock_release(l, n, i) lock_release(l, n, i)
422#else 438#else
@@ -427,9 +443,9 @@ static inline void print_irqtrace_events(struct task_struct *curr)
427 443
428#ifdef CONFIG_DEBUG_LOCK_ALLOC 444#ifdef CONFIG_DEBUG_LOCK_ALLOC
429# ifdef CONFIG_PROVE_LOCKING 445# ifdef CONFIG_PROVE_LOCKING
430# define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i) 446# define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i)
431# else 447# else
432# define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i) 448# define mutex_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i)
433# endif 449# endif
434# define mutex_release(l, n, i) lock_release(l, n, i) 450# define mutex_release(l, n, i) lock_release(l, n, i)
435#else 451#else
@@ -439,11 +455,11 @@ static inline void print_irqtrace_events(struct task_struct *curr)
439 455
440#ifdef CONFIG_DEBUG_LOCK_ALLOC 456#ifdef CONFIG_DEBUG_LOCK_ALLOC
441# ifdef CONFIG_PROVE_LOCKING 457# ifdef CONFIG_PROVE_LOCKING
442# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, i) 458# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 2, NULL, i)
443# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 2, i) 459# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 2, NULL, i)
444# else 460# else
445# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, i) 461# define rwsem_acquire(l, s, t, i) lock_acquire(l, s, t, 0, 1, NULL, i)
446# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 1, i) 462# define rwsem_acquire_read(l, s, t, i) lock_acquire(l, s, t, 1, 1, NULL, i)
447# endif 463# endif
448# define rwsem_release(l, n, i) lock_release(l, n, i) 464# define rwsem_release(l, n, i) lock_release(l, n, i)
449#else 465#else
@@ -452,4 +468,16 @@ static inline void print_irqtrace_events(struct task_struct *curr)
452# define rwsem_release(l, n, i) do { } while (0) 468# define rwsem_release(l, n, i) do { } while (0)
453#endif 469#endif
454 470
471#ifdef CONFIG_DEBUG_LOCK_ALLOC
472# ifdef CONFIG_PROVE_LOCKING
473# define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 2, NULL, _THIS_IP_)
474# else
475# define lock_map_acquire(l) lock_acquire(l, 0, 0, 0, 1, NULL, _THIS_IP_)
476# endif
477# define lock_map_release(l) lock_release(l, 1, _THIS_IP_)
478#else
479# define lock_map_acquire(l) do { } while (0)
480# define lock_map_release(l) do { } while (0)
481#endif
482
455#endif /* __LINUX_LOCKDEP_H */ 483#endif /* __LINUX_LOCKDEP_H */
diff --git a/include/linux/mISDNdsp.h b/include/linux/mISDNdsp.h
new file mode 100644
index 000000000000..6b71d2dce508
--- /dev/null
+++ b/include/linux/mISDNdsp.h
@@ -0,0 +1,37 @@
1#ifndef __mISDNdsp_H__
2#define __mISDNdsp_H__
3
4struct mISDN_dsp_element_arg {
5 char *name;
6 char *def;
7 char *desc;
8};
9
10struct mISDN_dsp_element {
11 char *name;
12 void *(*new)(const char *arg);
13 void (*free)(void *p);
14 void (*process_tx)(void *p, unsigned char *data, int len);
15 void (*process_rx)(void *p, unsigned char *data, int len);
16 int num_args;
17 struct mISDN_dsp_element_arg
18 *args;
19};
20
21extern int mISDN_dsp_element_register(struct mISDN_dsp_element *elem);
22extern void mISDN_dsp_element_unregister(struct mISDN_dsp_element *elem);
23
24struct dsp_features {
25 int hfc_id; /* unique id to identify the chip (or -1) */
26 int hfc_dtmf; /* set if HFCmulti card supports dtmf */
27 int hfc_loops; /* set if card supports tone loops */
28 int hfc_echocanhw; /* set if card supports echocancelation*/
29 int pcm_id; /* unique id to identify the pcm bus (or -1) */
30 int pcm_slots; /* number of slots on the pcm bus */
31 int pcm_banks; /* number of IO banks of pcm bus */
32 int unclocked; /* data is not clocked (has jitter/loss) */
33 int unordered; /* data is unordered (packets have index) */
34};
35
36#endif
37
diff --git a/include/linux/mISDNhw.h b/include/linux/mISDNhw.h
new file mode 100644
index 000000000000..e794dfb87504
--- /dev/null
+++ b/include/linux/mISDNhw.h
@@ -0,0 +1,193 @@
1/*
2 *
3 * Author Karsten Keil <kkeil@novell.com>
4 *
5 * Basic declarations for the mISDN HW channels
6 *
7 * Copyright 2008 by Karsten Keil <kkeil@novell.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * 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 */
19
20#ifndef MISDNHW_H
21#define MISDNHW_H
22#include <linux/mISDNif.h>
23#include <linux/timer.h>
24
25/*
26 * HW DEBUG 0xHHHHGGGG
27 * H - hardware driver specific bits
28 * G - for all drivers
29 */
30
31#define DEBUG_HW 0x00000001
32#define DEBUG_HW_OPEN 0x00000002
33#define DEBUG_HW_DCHANNEL 0x00000100
34#define DEBUG_HW_DFIFO 0x00000200
35#define DEBUG_HW_BCHANNEL 0x00001000
36#define DEBUG_HW_BFIFO 0x00002000
37
38#define MAX_DFRAME_LEN_L1 300
39#define MAX_MON_FRAME 32
40#define MAX_LOG_SPACE 2048
41#define MISDN_COPY_SIZE 32
42
43/* channel->Flags bit field */
44#define FLG_TX_BUSY 0 /* tx_buf in use */
45#define FLG_TX_NEXT 1 /* next_skb in use */
46#define FLG_L1_BUSY 2 /* L1 is permanent busy */
47#define FLG_L2_ACTIVATED 3 /* activated from L2 */
48#define FLG_OPEN 5 /* channel is in use */
49#define FLG_ACTIVE 6 /* channel is activated */
50#define FLG_BUSY_TIMER 7
51/* channel type */
52#define FLG_DCHANNEL 8 /* channel is D-channel */
53#define FLG_BCHANNEL 9 /* channel is B-channel */
54#define FLG_ECHANNEL 10 /* channel is E-channel */
55#define FLG_TRANSPARENT 12 /* channel use transparent data */
56#define FLG_HDLC 13 /* channel use hdlc data */
57#define FLG_L2DATA 14 /* channel use L2 DATA primitivs */
58#define FLG_ORIGIN 15 /* channel is on origin site */
59/* channel specific stuff */
60/* arcofi specific */
61#define FLG_ARCOFI_TIMER 16
62#define FLG_ARCOFI_ERROR 17
63/* isar specific */
64#define FLG_INITIALIZED 16
65#define FLG_DLEETX 17
66#define FLG_LASTDLE 18
67#define FLG_FIRST 19
68#define FLG_LASTDATA 20
69#define FLG_NMD_DATA 21
70#define FLG_FTI_RUN 22
71#define FLG_LL_OK 23
72#define FLG_LL_CONN 24
73#define FLG_DTMFSEND 25
74
75/* workq events */
76#define FLG_RECVQUEUE 30
77#define FLG_PHCHANGE 31
78
79#define schedule_event(s, ev) do { \
80 test_and_set_bit(ev, &((s)->Flags)); \
81 schedule_work(&((s)->workq)); \
82 } while (0)
83
84struct dchannel {
85 struct mISDNdevice dev;
86 u_long Flags;
87 struct work_struct workq;
88 void (*phfunc) (struct dchannel *);
89 u_int state;
90 void *l1;
91 /* HW access */
92 u_char (*read_reg) (void *, u_char);
93 void (*write_reg) (void *, u_char, u_char);
94 void (*read_fifo) (void *, u_char *, int);
95 void (*write_fifo) (void *, u_char *, int);
96 void *hw;
97 int slot; /* multiport card channel slot */
98 struct timer_list timer;
99 /* receive data */
100 struct sk_buff *rx_skb;
101 int maxlen;
102 /* send data */
103 struct sk_buff_head squeue;
104 struct sk_buff_head rqueue;
105 struct sk_buff *tx_skb;
106 int tx_idx;
107 int debug;
108 /* statistics */
109 int err_crc;
110 int err_tx;
111 int err_rx;
112};
113
114typedef int (dchannel_l1callback)(struct dchannel *, u_int);
115extern int create_l1(struct dchannel *, dchannel_l1callback *);
116
117/* private L1 commands */
118#define INFO0 0x8002
119#define INFO1 0x8102
120#define INFO2 0x8202
121#define INFO3_P8 0x8302
122#define INFO3_P10 0x8402
123#define INFO4_P8 0x8502
124#define INFO4_P10 0x8602
125#define LOSTFRAMING 0x8702
126#define ANYSIGNAL 0x8802
127#define HW_POWERDOWN 0x8902
128#define HW_RESET_REQ 0x8a02
129#define HW_POWERUP_REQ 0x8b02
130#define HW_DEACT_REQ 0x8c02
131#define HW_ACTIVATE_REQ 0x8e02
132#define HW_D_NOBLOCKED 0x8f02
133#define HW_RESET_IND 0x9002
134#define HW_POWERUP_IND 0x9102
135#define HW_DEACT_IND 0x9202
136#define HW_ACTIVATE_IND 0x9302
137#define HW_DEACT_CNF 0x9402
138#define HW_TESTLOOP 0x9502
139#define HW_TESTRX_RAW 0x9602
140#define HW_TESTRX_HDLC 0x9702
141#define HW_TESTRX_OFF 0x9802
142
143struct layer1;
144extern int l1_event(struct layer1 *, u_int);
145
146
147struct bchannel {
148 struct mISDNchannel ch;
149 int nr;
150 u_long Flags;
151 struct work_struct workq;
152 u_int state;
153 /* HW access */
154 u_char (*read_reg) (void *, u_char);
155 void (*write_reg) (void *, u_char, u_char);
156 void (*read_fifo) (void *, u_char *, int);
157 void (*write_fifo) (void *, u_char *, int);
158 void *hw;
159 int slot; /* multiport card channel slot */
160 struct timer_list timer;
161 /* receive data */
162 struct sk_buff *rx_skb;
163 int maxlen;
164 /* send data */
165 struct sk_buff *next_skb;
166 struct sk_buff *tx_skb;
167 struct sk_buff_head rqueue;
168 int rcount;
169 int tx_idx;
170 int debug;
171 /* statistics */
172 int err_crc;
173 int err_tx;
174 int err_rx;
175};
176
177extern int mISDN_initdchannel(struct dchannel *, int, void *);
178extern int mISDN_initbchannel(struct bchannel *, int);
179extern int mISDN_freedchannel(struct dchannel *);
180extern int mISDN_freebchannel(struct bchannel *);
181extern void queue_ch_frame(struct mISDNchannel *, u_int,
182 int, struct sk_buff *);
183extern int dchannel_senddata(struct dchannel *, struct sk_buff *);
184extern int bchannel_senddata(struct bchannel *, struct sk_buff *);
185extern void recv_Dchannel(struct dchannel *);
186extern void recv_Bchannel(struct bchannel *);
187extern void recv_Dchannel_skb(struct dchannel *, struct sk_buff *);
188extern void recv_Bchannel_skb(struct bchannel *, struct sk_buff *);
189extern void confirm_Bsend(struct bchannel *bch);
190extern int get_next_bframe(struct bchannel *);
191extern int get_next_dframe(struct dchannel *);
192
193#endif
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h
new file mode 100644
index 000000000000..8f2d60da04e7
--- /dev/null
+++ b/include/linux/mISDNif.h
@@ -0,0 +1,509 @@
1/*
2 *
3 * Author Karsten Keil <kkeil@novell.com>
4 *
5 * Copyright 2008 by Karsten Keil <kkeil@novell.com>
6 *
7 * This code is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
9 * version 2.1 as published by the Free Software Foundation.
10 *
11 * This code 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 LESSER GENERAL PUBLIC LICENSE for more details.
15 *
16 */
17
18#ifndef mISDNIF_H
19#define mISDNIF_H
20
21#include <stdarg.h>
22#include <linux/types.h>
23#include <linux/errno.h>
24#include <linux/socket.h>
25
26/*
27 * ABI Version 32 bit
28 *
29 * <8 bit> Major version
30 * - changed if any interface become backwards incompatible
31 *
32 * <8 bit> Minor version
33 * - changed if any interface is extended but backwards compatible
34 *
35 * <16 bit> Release number
36 * - should be incremented on every checkin
37 */
38#define MISDN_MAJOR_VERSION 1
39#define MISDN_MINOR_VERSION 0
40#define MISDN_RELEASE 19
41
42/* primitives for information exchange
43 * generell format
44 * <16 bit 0 >
45 * <8 bit command>
46 * BIT 8 = 1 LAYER private
47 * BIT 7 = 1 answer
48 * BIT 6 = 1 DATA
49 * <8 bit target layer mask>
50 *
51 * Layer = 00 is reserved for general commands
52 Layer = 01 L2 -> HW
53 Layer = 02 HW -> L2
54 Layer = 04 L3 -> L2
55 Layer = 08 L2 -> L3
56 * Layer = FF is reserved for broadcast commands
57 */
58
59#define MISDN_CMDMASK 0xff00
60#define MISDN_LAYERMASK 0x00ff
61
62/* generell commands */
63#define OPEN_CHANNEL 0x0100
64#define CLOSE_CHANNEL 0x0200
65#define CONTROL_CHANNEL 0x0300
66#define CHECK_DATA 0x0400
67
68/* layer 2 -> layer 1 */
69#define PH_ACTIVATE_REQ 0x0101
70#define PH_DEACTIVATE_REQ 0x0201
71#define PH_DATA_REQ 0x2001
72#define MPH_ACTIVATE_REQ 0x0501
73#define MPH_DEACTIVATE_REQ 0x0601
74#define MPH_INFORMATION_REQ 0x0701
75#define PH_CONTROL_REQ 0x0801
76
77/* layer 1 -> layer 2 */
78#define PH_ACTIVATE_IND 0x0102
79#define PH_ACTIVATE_CNF 0x4102
80#define PH_DEACTIVATE_IND 0x0202
81#define PH_DEACTIVATE_CNF 0x4202
82#define PH_DATA_IND 0x2002
83#define MPH_ACTIVATE_IND 0x0502
84#define MPH_DEACTIVATE_IND 0x0602
85#define MPH_INFORMATION_IND 0x0702
86#define PH_DATA_CNF 0x6002
87#define PH_CONTROL_IND 0x0802
88#define PH_CONTROL_CNF 0x4802
89
90/* layer 3 -> layer 2 */
91#define DL_ESTABLISH_REQ 0x1004
92#define DL_RELEASE_REQ 0x1104
93#define DL_DATA_REQ 0x3004
94#define DL_UNITDATA_REQ 0x3104
95#define DL_INFORMATION_REQ 0x0004
96
97/* layer 2 -> layer 3 */
98#define DL_ESTABLISH_IND 0x1008
99#define DL_ESTABLISH_CNF 0x5008
100#define DL_RELEASE_IND 0x1108
101#define DL_RELEASE_CNF 0x5108
102#define DL_DATA_IND 0x3008
103#define DL_UNITDATA_IND 0x3108
104#define DL_INFORMATION_IND 0x0008
105
106/* intern layer 2 managment */
107#define MDL_ASSIGN_REQ 0x1804
108#define MDL_ASSIGN_IND 0x1904
109#define MDL_REMOVE_REQ 0x1A04
110#define MDL_REMOVE_IND 0x1B04
111#define MDL_STATUS_UP_IND 0x1C04
112#define MDL_STATUS_DOWN_IND 0x1D04
113#define MDL_STATUS_UI_IND 0x1E04
114#define MDL_ERROR_IND 0x1F04
115#define MDL_ERROR_RSP 0x5F04
116
117/* DL_INFORMATION_IND types */
118#define DL_INFO_L2_CONNECT 0x0001
119#define DL_INFO_L2_REMOVED 0x0002
120
121/* PH_CONTROL types */
122/* TOUCH TONE IS 0x20XX XX "0"..."9", "A","B","C","D","*","#" */
123#define DTMF_TONE_VAL 0x2000
124#define DTMF_TONE_MASK 0x007F
125#define DTMF_TONE_START 0x2100
126#define DTMF_TONE_STOP 0x2200
127#define DTMF_HFC_COEF 0x4000
128#define DSP_CONF_JOIN 0x2403
129#define DSP_CONF_SPLIT 0x2404
130#define DSP_RECEIVE_OFF 0x2405
131#define DSP_RECEIVE_ON 0x2406
132#define DSP_ECHO_ON 0x2407
133#define DSP_ECHO_OFF 0x2408
134#define DSP_MIX_ON 0x2409
135#define DSP_MIX_OFF 0x240a
136#define DSP_DELAY 0x240b
137#define DSP_JITTER 0x240c
138#define DSP_TXDATA_ON 0x240d
139#define DSP_TXDATA_OFF 0x240e
140#define DSP_TX_DEJITTER 0x240f
141#define DSP_TX_DEJ_OFF 0x2410
142#define DSP_TONE_PATT_ON 0x2411
143#define DSP_TONE_PATT_OFF 0x2412
144#define DSP_VOL_CHANGE_TX 0x2413
145#define DSP_VOL_CHANGE_RX 0x2414
146#define DSP_BF_ENABLE_KEY 0x2415
147#define DSP_BF_DISABLE 0x2416
148#define DSP_BF_ACCEPT 0x2416
149#define DSP_BF_REJECT 0x2417
150#define DSP_PIPELINE_CFG 0x2418
151#define HFC_VOL_CHANGE_TX 0x2601
152#define HFC_VOL_CHANGE_RX 0x2602
153#define HFC_SPL_LOOP_ON 0x2603
154#define HFC_SPL_LOOP_OFF 0x2604
155
156/* DSP_TONE_PATT_ON parameter */
157#define TONE_OFF 0x0000
158#define TONE_GERMAN_DIALTONE 0x0001
159#define TONE_GERMAN_OLDDIALTONE 0x0002
160#define TONE_AMERICAN_DIALTONE 0x0003
161#define TONE_GERMAN_DIALPBX 0x0004
162#define TONE_GERMAN_OLDDIALPBX 0x0005
163#define TONE_AMERICAN_DIALPBX 0x0006
164#define TONE_GERMAN_RINGING 0x0007
165#define TONE_GERMAN_OLDRINGING 0x0008
166#define TONE_AMERICAN_RINGPBX 0x000b
167#define TONE_GERMAN_RINGPBX 0x000c
168#define TONE_GERMAN_OLDRINGPBX 0x000d
169#define TONE_AMERICAN_RINGING 0x000e
170#define TONE_GERMAN_BUSY 0x000f
171#define TONE_GERMAN_OLDBUSY 0x0010
172#define TONE_AMERICAN_BUSY 0x0011
173#define TONE_GERMAN_HANGUP 0x0012
174#define TONE_GERMAN_OLDHANGUP 0x0013
175#define TONE_AMERICAN_HANGUP 0x0014
176#define TONE_SPECIAL_INFO 0x0015
177#define TONE_GERMAN_GASSENBESETZT 0x0016
178#define TONE_GERMAN_AUFSCHALTTON 0x0016
179
180/* MPH_INFORMATION_IND */
181#define L1_SIGNAL_LOS_OFF 0x0010
182#define L1_SIGNAL_LOS_ON 0x0011
183#define L1_SIGNAL_AIS_OFF 0x0012
184#define L1_SIGNAL_AIS_ON 0x0013
185#define L1_SIGNAL_RDI_OFF 0x0014
186#define L1_SIGNAL_RDI_ON 0x0015
187#define L1_SIGNAL_SLIP_RX 0x0020
188#define L1_SIGNAL_SLIP_TX 0x0021
189
190/*
191 * protocol ids
192 * D channel 1-31
193 * B channel 33 - 63
194 */
195
196#define ISDN_P_NONE 0
197#define ISDN_P_BASE 0
198#define ISDN_P_TE_S0 0x01
199#define ISDN_P_NT_S0 0x02
200#define ISDN_P_TE_E1 0x03
201#define ISDN_P_NT_E1 0x04
202#define ISDN_P_LAPD_TE 0x10
203#define ISDN_P_LAPD_NT 0x11
204
205#define ISDN_P_B_MASK 0x1f
206#define ISDN_P_B_START 0x20
207
208#define ISDN_P_B_RAW 0x21
209#define ISDN_P_B_HDLC 0x22
210#define ISDN_P_B_X75SLP 0x23
211#define ISDN_P_B_L2DTMF 0x24
212#define ISDN_P_B_L2DSP 0x25
213#define ISDN_P_B_L2DSPHDLC 0x26
214
215#define OPTION_L2_PMX 1
216#define OPTION_L2_PTP 2
217#define OPTION_L2_FIXEDTEI 3
218#define OPTION_L2_CLEANUP 4
219
220/* should be in sync with linux/kobject.h:KOBJ_NAME_LEN */
221#define MISDN_MAX_IDLEN 20
222
223struct mISDNhead {
224 unsigned int prim;
225 unsigned int id;
226} __attribute__((packed));
227
228#define MISDN_HEADER_LEN sizeof(struct mISDNhead)
229#define MAX_DATA_SIZE 2048
230#define MAX_DATA_MEM (MAX_DATA_SIZE + MISDN_HEADER_LEN)
231#define MAX_DFRAME_LEN 260
232
233#define MISDN_ID_ADDR_MASK 0xFFFF
234#define MISDN_ID_TEI_MASK 0xFF00
235#define MISDN_ID_SAPI_MASK 0x00FF
236#define MISDN_ID_TEI_ANY 0x7F00
237
238#define MISDN_ID_ANY 0xFFFF
239#define MISDN_ID_NONE 0xFFFE
240
241#define GROUP_TEI 127
242#define TEI_SAPI 63
243#define CTRL_SAPI 0
244
245#define MISDN_MAX_CHANNEL 127
246#define MISDN_CHMAP_SIZE ((MISDN_MAX_CHANNEL + 1) >> 3)
247
248#define SOL_MISDN 0
249
250struct sockaddr_mISDN {
251 sa_family_t family;
252 unsigned char dev;
253 unsigned char channel;
254 unsigned char sapi;
255 unsigned char tei;
256};
257
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 {
269 unsigned char major;
270 unsigned char minor;
271 unsigned short release;
272};
273
274struct mISDN_devinfo {
275 u_int id;
276 u_int Dprotocols;
277 u_int Bprotocols;
278 u_int protocol;
279 u_char channelmap[MISDN_CHMAP_SIZE];
280 u_int nrbchan;
281 char name[MISDN_MAX_IDLEN];
282};
283
284static inline int
285test_channelmap(u_int nr, u_char *map)
286{
287 if (nr <= MISDN_MAX_CHANNEL)
288 return map[nr >> 3] & (1 << (nr & 7));
289 else
290 return 0;
291}
292
293static inline void
294set_channelmap(u_int nr, u_char *map)
295{
296 map[nr >> 3] |= (1 << (nr & 7));
297}
298
299static inline void
300clear_channelmap(u_int nr, u_char *map)
301{
302 map[nr >> 3] &= ~(1 << (nr & 7));
303}
304
305/* CONTROL_CHANNEL parameters */
306#define MISDN_CTRL_GETOP 0x0000
307#define MISDN_CTRL_LOOP 0x0001
308#define MISDN_CTRL_CONNECT 0x0002
309#define MISDN_CTRL_DISCONNECT 0x0004
310#define MISDN_CTRL_PCMCONNECT 0x0010
311#define MISDN_CTRL_PCMDISCONNECT 0x0020
312#define MISDN_CTRL_SETPEER 0x0040
313#define MISDN_CTRL_UNSETPEER 0x0080
314#define MISDN_CTRL_RX_OFF 0x0100
315#define MISDN_CTRL_HW_FEATURES_OP 0x2000
316#define MISDN_CTRL_HW_FEATURES 0x2001
317#define MISDN_CTRL_HFC_OP 0x4000
318#define MISDN_CTRL_HFC_PCM_CONN 0x4001
319#define MISDN_CTRL_HFC_PCM_DISC 0x4002
320#define MISDN_CTRL_HFC_CONF_JOIN 0x4003
321#define MISDN_CTRL_HFC_CONF_SPLIT 0x4004
322#define MISDN_CTRL_HFC_RECEIVE_OFF 0x4005
323#define MISDN_CTRL_HFC_RECEIVE_ON 0x4006
324#define MISDN_CTRL_HFC_ECHOCAN_ON 0x4007
325#define MISDN_CTRL_HFC_ECHOCAN_OFF 0x4008
326
327
328/* socket options */
329#define MISDN_TIME_STAMP 0x0001
330
331struct mISDN_ctrl_req {
332 int op;
333 int channel;
334 int p1;
335 int p2;
336};
337
338/* muxer options */
339#define MISDN_OPT_ALL 1
340#define MISDN_OPT_TEIMGR 2
341
342#ifdef __KERNEL__
343#include <linux/list.h>
344#include <linux/skbuff.h>
345#include <linux/net.h>
346#include <net/sock.h>
347#include <linux/completion.h>
348
349#define DEBUG_CORE 0x000000ff
350#define DEBUG_CORE_FUNC 0x00000002
351#define DEBUG_SOCKET 0x00000004
352#define DEBUG_MANAGER 0x00000008
353#define DEBUG_SEND_ERR 0x00000010
354#define DEBUG_MSG_THREAD 0x00000020
355#define DEBUG_QUEUE_FUNC 0x00000040
356#define DEBUG_L1 0x0000ff00
357#define DEBUG_L1_FSM 0x00000200
358#define DEBUG_L2 0x00ff0000
359#define DEBUG_L2_FSM 0x00020000
360#define DEBUG_L2_CTRL 0x00040000
361#define DEBUG_L2_RECV 0x00080000
362#define DEBUG_L2_TEI 0x00100000
363#define DEBUG_L2_TEIFSM 0x00200000
364#define DEBUG_TIMER 0x01000000
365
366#define mISDN_HEAD_P(s) ((struct mISDNhead *)&s->cb[0])
367#define mISDN_HEAD_PRIM(s) (((struct mISDNhead *)&s->cb[0])->prim)
368#define mISDN_HEAD_ID(s) (((struct mISDNhead *)&s->cb[0])->id)
369
370/* socket states */
371#define MISDN_OPEN 1
372#define MISDN_BOUND 2
373#define MISDN_CLOSED 3
374
375struct mISDNchannel;
376struct mISDNdevice;
377struct mISDNstack;
378
379struct channel_req {
380 u_int protocol;
381 struct sockaddr_mISDN adr;
382 struct mISDNchannel *ch;
383};
384
385typedef int (ctrl_func_t)(struct mISDNchannel *, u_int, void *);
386typedef int (send_func_t)(struct mISDNchannel *, struct sk_buff *);
387typedef int (create_func_t)(struct channel_req *);
388
389struct Bprotocol {
390 struct list_head list;
391 char *name;
392 u_int Bprotocols;
393 create_func_t *create;
394};
395
396struct mISDNchannel {
397 struct list_head list;
398 u_int protocol;
399 u_int nr;
400 u_long opt;
401 u_int addr;
402 struct mISDNstack *st;
403 struct mISDNchannel *peer;
404 send_func_t *send;
405 send_func_t *recv;
406 ctrl_func_t *ctrl;
407};
408
409struct mISDN_sock_list {
410 struct hlist_head head;
411 rwlock_t lock;
412};
413
414struct mISDN_sock {
415 struct sock sk;
416 struct mISDNchannel ch;
417 u_int cmask;
418 struct mISDNdevice *dev;
419};
420
421
422
423struct mISDNdevice {
424 struct mISDNchannel D;
425 u_int id;
426 char name[MISDN_MAX_IDLEN];
427 u_int Dprotocols;
428 u_int Bprotocols;
429 u_int nrbchan;
430 u_char channelmap[MISDN_CHMAP_SIZE];
431 struct list_head bchannels;
432 struct mISDNchannel *teimgr;
433 struct device dev;
434};
435
436struct mISDNstack {
437 u_long status;
438 struct mISDNdevice *dev;
439 struct task_struct *thread;
440 struct completion *notify;
441 wait_queue_head_t workq;
442 struct sk_buff_head msgq;
443 struct list_head layer2;
444 struct mISDNchannel *layer1;
445 struct mISDNchannel own;
446 struct mutex lmutex; /* protect lists */
447 struct mISDN_sock_list l1sock;
448#ifdef MISDN_MSG_STATS
449 u_int msg_cnt;
450 u_int sleep_cnt;
451 u_int stopped_cnt;
452#endif
453};
454
455/* global alloc/queue functions */
456
457static inline struct sk_buff *
458mI_alloc_skb(unsigned int len, gfp_t gfp_mask)
459{
460 struct sk_buff *skb;
461
462 skb = alloc_skb(len + MISDN_HEADER_LEN, gfp_mask);
463 if (likely(skb))
464 skb_reserve(skb, MISDN_HEADER_LEN);
465 return skb;
466}
467
468static inline struct sk_buff *
469_alloc_mISDN_skb(u_int prim, u_int id, u_int len, void *dp, gfp_t gfp_mask)
470{
471 struct sk_buff *skb = mI_alloc_skb(len, gfp_mask);
472 struct mISDNhead *hh;
473
474 if (!skb)
475 return NULL;
476 if (len)
477 memcpy(skb_put(skb, len), dp, len);
478 hh = mISDN_HEAD_P(skb);
479 hh->prim = prim;
480 hh->id = id;
481 return skb;
482}
483
484static inline void
485_queue_data(struct mISDNchannel *ch, u_int prim,
486 u_int id, u_int len, void *dp, gfp_t gfp_mask)
487{
488 struct sk_buff *skb;
489
490 if (!ch->peer)
491 return;
492 skb = _alloc_mISDN_skb(prim, id, len, dp, gfp_mask);
493 if (!skb)
494 return;
495 if (ch->recv(ch->peer, skb))
496 dev_kfree_skb(skb);
497}
498
499/* global register/unregister functions */
500
501extern int mISDN_register_device(struct mISDNdevice *, char *name);
502extern void mISDN_unregister_device(struct mISDNdevice *);
503extern int mISDN_register_Bprotocol(struct Bprotocol *);
504extern void mISDN_unregister_Bprotocol(struct Bprotocol *);
505
506extern void set_channel_address(struct mISDNchannel *, u_int, u_int);
507
508#endif /* __KERNEL__ */
509#endif /* mISDNIF_H */
diff --git a/include/linux/major.h b/include/linux/major.h
index 53d5fafd85c3..88249452b935 100644
--- a/include/linux/major.h
+++ b/include/linux/major.h
@@ -170,4 +170,6 @@
170 170
171#define VIOTAPE_MAJOR 230 171#define VIOTAPE_MAJOR 230
172 172
173#define BLOCK_EXT_MAJOR 259
174
173#endif 175#endif
diff --git a/include/linux/maple.h b/include/linux/maple.h
index d31e36ebb436..c23d3f51ba40 100644
--- a/include/linux/maple.h
+++ b/include/linux/maple.h
@@ -2,6 +2,7 @@
2#define __LINUX_MAPLE_H 2#define __LINUX_MAPLE_H
3 3
4#include <linux/device.h> 4#include <linux/device.h>
5#include <mach/maple.h>
5 6
6extern struct bus_type maple_bus_type; 7extern struct bus_type maple_bus_type;
7 8
@@ -33,6 +34,7 @@ struct mapleq {
33 void *sendbuf, *recvbuf, *recvbufdcsp; 34 void *sendbuf, *recvbuf, *recvbufdcsp;
34 unsigned char length; 35 unsigned char length;
35 enum maple_code command; 36 enum maple_code command;
37 struct mutex mutex;
36}; 38};
37 39
38struct maple_devinfo { 40struct maple_devinfo {
@@ -49,7 +51,6 @@ struct maple_devinfo {
49struct maple_device { 51struct maple_device {
50 struct maple_driver *driver; 52 struct maple_driver *driver;
51 struct mapleq *mq; 53 struct mapleq *mq;
52 void *private_data;
53 void (*callback) (struct mapleq * mq); 54 void (*callback) (struct mapleq * mq);
54 unsigned long when, interval, function; 55 unsigned long when, interval, function;
55 struct maple_devinfo devinfo; 56 struct maple_devinfo devinfo;
@@ -61,8 +62,6 @@ struct maple_device {
61 62
62struct maple_driver { 63struct maple_driver {
63 unsigned long function; 64 unsigned long function;
64 int (*connect) (struct maple_device * dev);
65 void (*disconnect) (struct maple_device * dev);
66 struct device_driver drv; 65 struct device_driver drv;
67}; 66};
68 67
@@ -70,10 +69,17 @@ void maple_getcond_callback(struct maple_device *dev,
70 void (*callback) (struct mapleq * mq), 69 void (*callback) (struct mapleq * mq),
71 unsigned long interval, 70 unsigned long interval,
72 unsigned long function); 71 unsigned long function);
73int maple_driver_register(struct device_driver *drv); 72int maple_driver_register(struct maple_driver *);
74void maple_add_packet(struct mapleq *mq); 73void maple_driver_unregister(struct maple_driver *);
74
75int maple_add_packet_sleeps(struct maple_device *mdev, u32 function,
76 u32 command, u32 length, void *data);
77void maple_clear_dev(struct maple_device *mdev);
75 78
76#define to_maple_dev(n) container_of(n, struct maple_device, dev) 79#define to_maple_dev(n) container_of(n, struct maple_device, dev)
77#define to_maple_driver(n) container_of(n, struct maple_driver, drv) 80#define to_maple_driver(n) container_of(n, struct maple_driver, drv)
78 81
82#define maple_get_drvdata(d) dev_get_drvdata(&(d)->dev)
83#define maple_set_drvdata(d,p) dev_set_drvdata(&(d)->dev, (p))
84
79#endif /* __LINUX_MAPLE_H */ 85#endif /* __LINUX_MAPLE_H */
diff --git a/include/linux/memstick.h b/include/linux/memstick.h
index 37a5cdb03918..d0c37e682234 100644
--- a/include/linux/memstick.h
+++ b/include/linux/memstick.h
@@ -21,30 +21,30 @@
21struct ms_status_register { 21struct ms_status_register {
22 unsigned char reserved; 22 unsigned char reserved;
23 unsigned char interrupt; 23 unsigned char interrupt;
24#define MEMSTICK_INT_CMDNAK 0x0001 24#define MEMSTICK_INT_CMDNAK 0x01
25#define MEMSTICK_INT_IOREQ 0x0008 25#define MEMSTICK_INT_IOREQ 0x08
26#define MEMSTICK_INT_IOBREQ 0x0010 26#define MEMSTICK_INT_IOBREQ 0x10
27#define MEMSTICK_INT_BREQ 0x0020 27#define MEMSTICK_INT_BREQ 0x20
28#define MEMSTICK_INT_ERR 0x0040 28#define MEMSTICK_INT_ERR 0x40
29#define MEMSTICK_INT_CED 0x0080 29#define MEMSTICK_INT_CED 0x80
30 30
31 unsigned char status0; 31 unsigned char status0;
32#define MEMSTICK_STATUS0_WP 0x0001 32#define MEMSTICK_STATUS0_WP 0x01
33#define MEMSTICK_STATUS0_SL 0x0002 33#define MEMSTICK_STATUS0_SL 0x02
34#define MEMSTICK_STATUS0_BF 0x0010 34#define MEMSTICK_STATUS0_BF 0x10
35#define MEMSTICK_STATUS0_BE 0x0020 35#define MEMSTICK_STATUS0_BE 0x20
36#define MEMSTICK_STATUS0_FB0 0x0040 36#define MEMSTICK_STATUS0_FB0 0x40
37#define MEMSTICK_STATUS0_MB 0x0080 37#define MEMSTICK_STATUS0_MB 0x80
38 38
39 unsigned char status1; 39 unsigned char status1;
40#define MEMSTICK_STATUS1_UCFG 0x0001 40#define MEMSTICK_STATUS1_UCFG 0x01
41#define MEMSTICK_STATUS1_FGER 0x0002 41#define MEMSTICK_STATUS1_FGER 0x02
42#define MEMSTICK_STATUS1_UCEX 0x0004 42#define MEMSTICK_STATUS1_UCEX 0x04
43#define MEMSTICK_STATUS1_EXER 0x0008 43#define MEMSTICK_STATUS1_EXER 0x08
44#define MEMSTICK_STATUS1_UCDT 0x0010 44#define MEMSTICK_STATUS1_UCDT 0x10
45#define MEMSTICK_STATUS1_DTER 0x0020 45#define MEMSTICK_STATUS1_DTER 0x20
46#define MEMSTICK_STATUS1_FBI 0x0040 46#define MEMSTICK_STATUS1_FB1 0x40
47#define MEMSTICK_STATUS1_MB 0x0080 47#define MEMSTICK_STATUS1_MB 0x80
48} __attribute__((packed)); 48} __attribute__((packed));
49 49
50struct ms_id_register { 50struct ms_id_register {
@@ -56,32 +56,32 @@ struct ms_id_register {
56 56
57struct ms_param_register { 57struct ms_param_register {
58 unsigned char system; 58 unsigned char system;
59#define MEMSTICK_SYS_ATEN 0xc0
60#define MEMSTICK_SYS_BAMD 0x80
61#define MEMSTICK_SYS_PAM 0x08 59#define MEMSTICK_SYS_PAM 0x08
60#define MEMSTICK_SYS_BAMD 0x80
62 61
63 unsigned char block_address_msb; 62 unsigned char block_address_msb;
64 unsigned short block_address; 63 unsigned short block_address;
65 unsigned char cp; 64 unsigned char cp;
66#define MEMSTICK_CP_BLOCK 0x0000 65#define MEMSTICK_CP_BLOCK 0x00
67#define MEMSTICK_CP_PAGE 0x0020 66#define MEMSTICK_CP_PAGE 0x20
68#define MEMSTICK_CP_EXTRA 0x0040 67#define MEMSTICK_CP_EXTRA 0x40
69#define MEMSTICK_CP_OVERWRITE 0x0080 68#define MEMSTICK_CP_OVERWRITE 0x80
70 69
71 unsigned char page_address; 70 unsigned char page_address;
72} __attribute__((packed)); 71} __attribute__((packed));
73 72
74struct ms_extra_data_register { 73struct ms_extra_data_register {
75 unsigned char overwrite_flag; 74 unsigned char overwrite_flag;
76#define MEMSTICK_OVERWRITE_UPDATA 0x0010 75#define MEMSTICK_OVERWRITE_UDST 0x10
77#define MEMSTICK_OVERWRITE_PAGE 0x0060 76#define MEMSTICK_OVERWRITE_PGST1 0x20
78#define MEMSTICK_OVERWRITE_BLOCK 0x0080 77#define MEMSTICK_OVERWRITE_PGST0 0x40
78#define MEMSTICK_OVERWRITE_BKST 0x80
79 79
80 unsigned char management_flag; 80 unsigned char management_flag;
81#define MEMSTICK_MANAGEMENT_SYSTEM 0x0004 81#define MEMSTICK_MANAGEMENT_SYSFLG 0x04
82#define MEMSTICK_MANAGEMENT_TRANS_TABLE 0x0008 82#define MEMSTICK_MANAGEMENT_ATFLG 0x08
83#define MEMSTICK_MANAGEMENT_COPY 0x0010 83#define MEMSTICK_MANAGEMENT_SCMS1 0x10
84#define MEMSTICK_MANAGEMENT_ACCESS 0x0020 84#define MEMSTICK_MANAGEMENT_SCMS0 0x20
85 85
86 unsigned short logical_address; 86 unsigned short logical_address;
87} __attribute__((packed)); 87} __attribute__((packed));
@@ -96,9 +96,9 @@ struct ms_register {
96 96
97struct mspro_param_register { 97struct mspro_param_register {
98 unsigned char system; 98 unsigned char system;
99#define MEMSTICK_SYS_SERIAL 0x80
100#define MEMSTICK_SYS_PAR4 0x00 99#define MEMSTICK_SYS_PAR4 0x00
101#define MEMSTICK_SYS_PAR8 0x40 100#define MEMSTICK_SYS_PAR8 0x40
101#define MEMSTICK_SYS_SERIAL 0x80
102 102
103 unsigned short data_count; 103 unsigned short data_count;
104 unsigned int data_address; 104 unsigned int data_address;
@@ -147,7 +147,7 @@ struct ms_register_addr {
147 unsigned char w_length; 147 unsigned char w_length;
148} __attribute__((packed)); 148} __attribute__((packed));
149 149
150enum { 150enum memstick_tpc {
151 MS_TPC_READ_MG_STATUS = 0x01, 151 MS_TPC_READ_MG_STATUS = 0x01,
152 MS_TPC_READ_LONG_DATA = 0x02, 152 MS_TPC_READ_LONG_DATA = 0x02,
153 MS_TPC_READ_SHORT_DATA = 0x03, 153 MS_TPC_READ_SHORT_DATA = 0x03,
@@ -167,7 +167,7 @@ enum {
167 MS_TPC_SET_CMD = 0x0e 167 MS_TPC_SET_CMD = 0x0e
168}; 168};
169 169
170enum { 170enum memstick_command {
171 MS_CMD_BLOCK_END = 0x33, 171 MS_CMD_BLOCK_END = 0x33,
172 MS_CMD_RESET = 0x3c, 172 MS_CMD_RESET = 0x3c,
173 MS_CMD_BLOCK_WRITE = 0x55, 173 MS_CMD_BLOCK_WRITE = 0x55,
@@ -201,8 +201,6 @@ enum {
201 201
202/*** Driver structures and functions ***/ 202/*** Driver structures and functions ***/
203 203
204#define MEMSTICK_PART_SHIFT 3
205
206enum memstick_param { MEMSTICK_POWER = 1, MEMSTICK_INTERFACE }; 204enum memstick_param { MEMSTICK_POWER = 1, MEMSTICK_INTERFACE };
207 205
208#define MEMSTICK_POWER_OFF 0 206#define MEMSTICK_POWER_OFF 0
@@ -215,24 +213,27 @@ enum memstick_param { MEMSTICK_POWER = 1, MEMSTICK_INTERFACE };
215struct memstick_host; 213struct memstick_host;
216struct memstick_driver; 214struct memstick_driver;
217 215
216struct memstick_device_id {
217 unsigned char match_flags;
218#define MEMSTICK_MATCH_ALL 0x01 218#define MEMSTICK_MATCH_ALL 0x01
219 219
220 unsigned char type;
220#define MEMSTICK_TYPE_LEGACY 0xff 221#define MEMSTICK_TYPE_LEGACY 0xff
221#define MEMSTICK_TYPE_DUO 0x00 222#define MEMSTICK_TYPE_DUO 0x00
222#define MEMSTICK_TYPE_PRO 0x01 223#define MEMSTICK_TYPE_PRO 0x01
223 224
225 unsigned char category;
224#define MEMSTICK_CATEGORY_STORAGE 0xff 226#define MEMSTICK_CATEGORY_STORAGE 0xff
225#define MEMSTICK_CATEGORY_STORAGE_DUO 0x00 227#define MEMSTICK_CATEGORY_STORAGE_DUO 0x00
228#define MEMSTICK_CATEGORY_IO 0x01
229#define MEMSTICK_CATEGORY_IO_PRO 0x10
226 230
227#define MEMSTICK_CLASS_GENERIC 0xff
228#define MEMSTICK_CLASS_GENERIC_DUO 0x00
229
230
231struct memstick_device_id {
232 unsigned char match_flags;
233 unsigned char type;
234 unsigned char category;
235 unsigned char class; 231 unsigned char class;
232#define MEMSTICK_CLASS_FLASH 0xff
233#define MEMSTICK_CLASS_DUO 0x00
234#define MEMSTICK_CLASS_ROM 0x01
235#define MEMSTICK_CLASS_RO 0x02
236#define MEMSTICK_CLASS_WP 0x03
236}; 237};
237 238
238struct memstick_request { 239struct memstick_request {
@@ -263,6 +264,10 @@ struct memstick_dev {
263 /* Get next request from the media driver. */ 264 /* Get next request from the media driver. */
264 int (*next_request)(struct memstick_dev *card, 265 int (*next_request)(struct memstick_dev *card,
265 struct memstick_request **mrq); 266 struct memstick_request **mrq);
267 /* Tell the media driver to stop doing things */
268 void (*stop)(struct memstick_dev *card);
269 /* Allow the media driver to continue */
270 void (*start)(struct memstick_dev *card);
266 271
267 struct device dev; 272 struct device dev;
268}; 273};
@@ -284,7 +289,7 @@ struct memstick_host {
284 /* Notify the host that some requests are pending. */ 289 /* Notify the host that some requests are pending. */
285 void (*request)(struct memstick_host *host); 290 void (*request)(struct memstick_host *host);
286 /* Set host IO parameters (power, clock, etc). */ 291 /* Set host IO parameters (power, clock, etc). */
287 void (*set_param)(struct memstick_host *host, 292 int (*set_param)(struct memstick_host *host,
288 enum memstick_param param, 293 enum memstick_param param,
289 int value); 294 int value);
290 unsigned long private[0] ____cacheline_aligned; 295 unsigned long private[0] ____cacheline_aligned;
@@ -315,9 +320,9 @@ void memstick_suspend_host(struct memstick_host *host);
315void memstick_resume_host(struct memstick_host *host); 320void memstick_resume_host(struct memstick_host *host);
316 321
317void memstick_init_req_sg(struct memstick_request *mrq, unsigned char tpc, 322void memstick_init_req_sg(struct memstick_request *mrq, unsigned char tpc,
318 struct scatterlist *sg); 323 const struct scatterlist *sg);
319void memstick_init_req(struct memstick_request *mrq, unsigned char tpc, 324void memstick_init_req(struct memstick_request *mrq, unsigned char tpc,
320 void *buf, size_t length); 325 const void *buf, size_t length);
321int memstick_next_req(struct memstick_host *host, 326int memstick_next_req(struct memstick_host *host,
322 struct memstick_request **mrq); 327 struct memstick_request **mrq);
323void memstick_new_req(struct memstick_host *host); 328void memstick_new_req(struct memstick_host *host);
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index bb3dd0545928..49ef857cdb2d 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -1,5 +1,3 @@
1#ifndef MFD_CORE_H
2#define MFD_CORE_H
3/* 1/*
4 * drivers/mfd/mfd-core.h 2 * drivers/mfd/mfd-core.h
5 * 3 *
@@ -13,6 +11,9 @@
13 * 11 *
14 */ 12 */
15 13
14#ifndef MFD_CORE_H
15#define MFD_CORE_H
16
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17 18
18/* 19/*
@@ -28,7 +29,13 @@ struct mfd_cell {
28 int (*suspend)(struct platform_device *dev); 29 int (*suspend)(struct platform_device *dev);
29 int (*resume)(struct platform_device *dev); 30 int (*resume)(struct platform_device *dev);
30 31
31 void *driver_data; /* driver-specific data */ 32 /* driver-specific data for MFD-aware "cell" drivers */
33 void *driver_data;
34
35 /* platform_data can be used to either pass data to "generic"
36 driver or as a hook to mfd_cell for the "cell" drivers */
37 void *platform_data;
38 size_t data_size;
32 39
33 /* 40 /*
34 * This resources can be specified relatievly to the parent device. 41 * This resources can be specified relatievly to the parent device.
@@ -38,18 +45,11 @@ struct mfd_cell {
38 const struct resource *resources; 45 const struct resource *resources;
39}; 46};
40 47
41static inline struct mfd_cell * 48extern int mfd_add_devices(struct device *parent, int id,
42mfd_get_cell(struct platform_device *pdev) 49 const struct mfd_cell *cells, int n_devs,
43{ 50 struct resource *mem_base,
44 return (struct mfd_cell *)pdev->dev.platform_data; 51 int irq_base);
45}
46
47extern int mfd_add_devices(
48 struct platform_device *parent,
49 const struct mfd_cell *cells, int n_devs,
50 struct resource *mem_base,
51 int irq_base);
52 52
53extern void mfd_remove_devices(struct platform_device *parent); 53extern void mfd_remove_devices(struct device *parent);
54 54
55#endif 55#endif
diff --git a/include/linux/mfd/t7l66xb.h b/include/linux/mfd/t7l66xb.h
new file mode 100644
index 000000000000..e83c7f2036f9
--- /dev/null
+++ b/include/linux/mfd/t7l66xb.h
@@ -0,0 +1,36 @@
1/*
2 * This file contains the definitions for the T7L66XB
3 *
4 * (C) Copyright 2005 Ian Molton <spyro@f2s.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11#ifndef MFD_T7L66XB_H
12#define MFD_T7L66XB_H
13
14#include <linux/mfd/core.h>
15#include <linux/mfd/tmio.h>
16
17struct t7l66xb_platform_data {
18 int (*enable_clk32k)(struct platform_device *dev);
19 void (*disable_clk32k)(struct platform_device *dev);
20 int (*enable)(struct platform_device *dev);
21 int (*disable)(struct platform_device *dev);
22 int (*suspend)(struct platform_device *dev);
23 int (*resume)(struct platform_device *dev);
24
25 int irq_base; /* The base for subdevice irqs */
26
27 struct tmio_nand_data *nand_data;
28};
29
30
31#define IRQ_T7L66XB_MMC (1)
32#define IRQ_T7L66XB_NAND (3)
33
34#define T7L66XB_NR_IRQS 8
35
36#endif
diff --git a/include/linux/mfd/tc6387xb.h b/include/linux/mfd/tc6387xb.h
new file mode 100644
index 000000000000..fa06e0610b8e
--- /dev/null
+++ b/include/linux/mfd/tc6387xb.h
@@ -0,0 +1,23 @@
1/*
2 * This file contains the definitions for the TC6387XB
3 *
4 * (C) Copyright 2005 Ian Molton <spyro@f2s.com>
5 *
6 * May be copied or modified under the terms of the GNU General Public
7 * License. See linux/COPYING for more information.
8 *
9 */
10#ifndef MFD_TC6387XB_H
11#define MFD_TC6387XB_H
12
13struct tc6387xb_platform_data {
14 int (*enable_clk32k)(struct platform_device *dev);
15 void (*disable_clk32k)(struct platform_device *dev);
16
17 int (*enable)(struct platform_device *dev);
18 int (*disable)(struct platform_device *dev);
19 int (*suspend)(struct platform_device *dev);
20 int (*resume)(struct platform_device *dev);
21};
22
23#endif
diff --git a/include/linux/mfd/tc6393xb.h b/include/linux/mfd/tc6393xb.h
index 7cc824a58f7c..fec7b3f7a81f 100644
--- a/include/linux/mfd/tc6393xb.h
+++ b/include/linux/mfd/tc6393xb.h
@@ -14,8 +14,8 @@
14 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
15 */ 15 */
16 16
17#ifndef TC6393XB_H 17#ifndef MFD_TC6393XB_H
18#define TC6393XB_H 18#define MFD_TC6393XB_H
19 19
20/* Also one should provide the CK3P6MI clock */ 20/* Also one should provide the CK3P6MI clock */
21struct tc6393xb_platform_data { 21struct tc6393xb_platform_data {
@@ -29,7 +29,7 @@ struct tc6393xb_platform_data {
29 int (*suspend)(struct platform_device *dev); 29 int (*suspend)(struct platform_device *dev);
30 int (*resume)(struct platform_device *dev); 30 int (*resume)(struct platform_device *dev);
31 31
32 int irq_base; /* a base for cascaded irq */ 32 int irq_base; /* base for subdevice irqs */
33 int gpio_base; 33 int gpio_base;
34 34
35 struct tmio_nand_data *nand_data; 35 struct tmio_nand_data *nand_data;
@@ -40,9 +40,6 @@ struct tc6393xb_platform_data {
40 */ 40 */
41#define IRQ_TC6393_NAND 0 41#define IRQ_TC6393_NAND 0
42#define IRQ_TC6393_MMC 1 42#define IRQ_TC6393_MMC 1
43#define IRQ_TC6393_OHCI 2
44#define IRQ_TC6393_SERIAL 3
45#define IRQ_TC6393_FB 4
46 43
47#define TC6393XB_NR_IRQS 8 44#define TC6393XB_NR_IRQS 8
48 45
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
index 9438d8c9ac1c..ec612e66391c 100644
--- a/include/linux/mfd/tmio.h
+++ b/include/linux/mfd/tmio.h
@@ -1,6 +1,21 @@
1#ifndef MFD_TMIO_H 1#ifndef MFD_TMIO_H
2#define MFD_TMIO_H 2#define MFD_TMIO_H
3 3
4#define tmio_ioread8(addr) readb(addr)
5#define tmio_ioread16(addr) readw(addr)
6#define tmio_ioread16_rep(r, b, l) readsw(r, b, l)
7#define tmio_ioread32(addr) \
8 (((u32) readw((addr))) | (((u32) readw((addr) + 2)) << 16))
9
10#define tmio_iowrite8(val, addr) writeb((val), (addr))
11#define tmio_iowrite16(val, addr) writew((val), (addr))
12#define tmio_iowrite16_rep(r, b, l) writesw(r, b, l)
13#define tmio_iowrite32(val, addr) \
14 do { \
15 writew((val), (addr)); \
16 writew((val) >> 16, (addr) + 2); \
17 } while (0)
18
4/* 19/*
5 * data for the NAND controller 20 * data for the NAND controller
6 */ 21 */
@@ -10,8 +25,4 @@ struct tmio_nand_data {
10 unsigned int num_partitions; 25 unsigned int num_partitions;
11}; 26};
12 27
13#define TMIO_NAND_CONFIG "tmio-nand-config"
14#define TMIO_NAND_CONTROL "tmio-nand-control"
15#define TMIO_NAND_IRQ "tmio-nand"
16
17#endif 28#endif
diff --git a/include/linux/mlx4/cq.h b/include/linux/mlx4/cq.h
index 071cf96cf01f..6f65b2c8bb89 100644
--- a/include/linux/mlx4/cq.h
+++ b/include/linux/mlx4/cq.h
@@ -39,17 +39,18 @@
39#include <linux/mlx4/doorbell.h> 39#include <linux/mlx4/doorbell.h>
40 40
41struct mlx4_cqe { 41struct mlx4_cqe {
42 __be32 my_qpn; 42 __be32 vlan_my_qpn;
43 __be32 immed_rss_invalid; 43 __be32 immed_rss_invalid;
44 __be32 g_mlpath_rqpn; 44 __be32 g_mlpath_rqpn;
45 u8 sl; 45 __be16 sl_vid;
46 u8 reserved1;
47 __be16 rlid; 46 __be16 rlid;
48 __be32 ipoib_status; 47 __be16 status;
48 u8 ipv6_ext_mask;
49 u8 badfcs_enc;
49 __be32 byte_cnt; 50 __be32 byte_cnt;
50 __be16 wqe_index; 51 __be16 wqe_index;
51 __be16 checksum; 52 __be16 checksum;
52 u8 reserved2[3]; 53 u8 reserved[3];
53 u8 owner_sr_opcode; 54 u8 owner_sr_opcode;
54}; 55};
55 56
@@ -64,6 +65,11 @@ struct mlx4_err_cqe {
64}; 65};
65 66
66enum { 67enum {
68 MLX4_CQE_VLAN_PRESENT_MASK = 1 << 29,
69 MLX4_CQE_QPN_MASK = 0xffffff,
70};
71
72enum {
67 MLX4_CQE_OWNER_MASK = 0x80, 73 MLX4_CQE_OWNER_MASK = 0x80,
68 MLX4_CQE_IS_SEND_MASK = 0x40, 74 MLX4_CQE_IS_SEND_MASK = 0x40,
69 MLX4_CQE_OPCODE_MASK = 0x1f 75 MLX4_CQE_OPCODE_MASK = 0x1f
@@ -86,13 +92,19 @@ enum {
86}; 92};
87 93
88enum { 94enum {
89 MLX4_CQE_IPOIB_STATUS_IPV4 = 1 << 22, 95 MLX4_CQE_STATUS_IPV4 = 1 << 6,
90 MLX4_CQE_IPOIB_STATUS_IPV4F = 1 << 23, 96 MLX4_CQE_STATUS_IPV4F = 1 << 7,
91 MLX4_CQE_IPOIB_STATUS_IPV6 = 1 << 24, 97 MLX4_CQE_STATUS_IPV6 = 1 << 8,
92 MLX4_CQE_IPOIB_STATUS_IPV4OPT = 1 << 25, 98 MLX4_CQE_STATUS_IPV4OPT = 1 << 9,
93 MLX4_CQE_IPOIB_STATUS_TCP = 1 << 26, 99 MLX4_CQE_STATUS_TCP = 1 << 10,
94 MLX4_CQE_IPOIB_STATUS_UDP = 1 << 27, 100 MLX4_CQE_STATUS_UDP = 1 << 11,
95 MLX4_CQE_IPOIB_STATUS_IPOK = 1 << 28, 101 MLX4_CQE_STATUS_IPOK = 1 << 12,
102};
103
104enum {
105 MLX4_CQE_LLC = 1,
106 MLX4_CQE_SNAP = 1 << 1,
107 MLX4_CQE_BAD_FCS = 1 << 4,
96}; 108};
97 109
98static inline void mlx4_cq_arm(struct mlx4_cq *cq, u32 cmd, 110static inline void mlx4_cq_arm(struct mlx4_cq *cq, u32 cmd,
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 655ea0d1ee14..b2f944468313 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -141,6 +141,10 @@ enum {
141 MLX4_STAT_RATE_OFFSET = 5 141 MLX4_STAT_RATE_OFFSET = 5
142}; 142};
143 143
144enum {
145 MLX4_MTT_FLAG_PRESENT = 1
146};
147
144static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor) 148static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
145{ 149{
146 return (major << 32) | (minor << 16) | subminor; 150 return (major << 32) | (minor << 16) | subminor;
diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
index e27082cd650e..bf8f11982dae 100644
--- a/include/linux/mlx4/qp.h
+++ b/include/linux/mlx4/qp.h
@@ -164,11 +164,13 @@ enum {
164 MLX4_WQE_CTRL_SOLICITED = 1 << 1, 164 MLX4_WQE_CTRL_SOLICITED = 1 << 1,
165 MLX4_WQE_CTRL_IP_CSUM = 1 << 4, 165 MLX4_WQE_CTRL_IP_CSUM = 1 << 4,
166 MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5, 166 MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5,
167 MLX4_WQE_CTRL_INS_VLAN = 1 << 6,
167}; 168};
168 169
169struct mlx4_wqe_ctrl_seg { 170struct mlx4_wqe_ctrl_seg {
170 __be32 owner_opcode; 171 __be32 owner_opcode;
171 u8 reserved2[3]; 172 __be16 vlan_tag;
173 u8 ins_vlan;
172 u8 fence_size; 174 u8 fence_size;
173 /* 175 /*
174 * High 24 bits are SRC remote buffer; low 8 bits are flags: 176 * High 24 bits are SRC remote buffer; low 8 bits are flags:
diff --git a/include/linux/mm.h b/include/linux/mm.h
index d87a5a5fe87d..c61ba10768ea 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -7,6 +7,7 @@
7 7
8#include <linux/gfp.h> 8#include <linux/gfp.h>
9#include <linux/list.h> 9#include <linux/list.h>
10#include <linux/mmdebug.h>
10#include <linux/mmzone.h> 11#include <linux/mmzone.h>
11#include <linux/rbtree.h> 12#include <linux/rbtree.h>
12#include <linux/prio_tree.h> 13#include <linux/prio_tree.h>
@@ -73,7 +74,7 @@ extern unsigned int kobjsize(const void *objp);
73#endif 74#endif
74 75
75/* 76/*
76 * vm_flags.. 77 * vm_flags in vm_area_struct, see mm_types.h.
77 */ 78 */
78#define VM_READ 0x00000001 /* currently active flags */ 79#define VM_READ 0x00000001 /* currently active flags */
79#define VM_WRITE 0x00000002 80#define VM_WRITE 0x00000002
@@ -219,12 +220,6 @@ struct inode;
219 */ 220 */
220#include <linux/page-flags.h> 221#include <linux/page-flags.h>
221 222
222#ifdef CONFIG_DEBUG_VM
223#define VM_BUG_ON(cond) BUG_ON(cond)
224#else
225#define VM_BUG_ON(condition) do { } while(0)
226#endif
227
228/* 223/*
229 * Methods to modify the page usage count. 224 * Methods to modify the page usage count.
230 * 225 *
@@ -744,6 +739,8 @@ struct zap_details {
744struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, 739struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
745 pte_t pte); 740 pte_t pte);
746 741
742int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
743 unsigned long size);
747unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address, 744unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address,
748 unsigned long size, struct zap_details *); 745 unsigned long size, struct zap_details *);
749unsigned long unmap_vmas(struct mmu_gather **tlb, 746unsigned long unmap_vmas(struct mmu_gather **tlb,
@@ -810,7 +807,6 @@ extern int access_process_vm(struct task_struct *tsk, unsigned long addr, void *
810 807
811int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, 808int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start,
812 int len, int write, int force, struct page **pages, struct vm_area_struct **vmas); 809 int len, int write, int force, struct page **pages, struct vm_area_struct **vmas);
813void print_bad_pte(struct vm_area_struct *, pte_t, unsigned long);
814 810
815extern int try_to_release_page(struct page * page, gfp_t gfp_mask); 811extern int try_to_release_page(struct page * page, gfp_t gfp_mask);
816extern void do_invalidatepage(struct page *page, unsigned long offset); 812extern void do_invalidatepage(struct page *page, unsigned long offset);
@@ -834,6 +830,19 @@ extern int mprotect_fixup(struct vm_area_struct *vma,
834 unsigned long end, unsigned long newflags); 830 unsigned long end, unsigned long newflags);
835 831
836/* 832/*
833 * get_user_pages_fast provides equivalent functionality to get_user_pages,
834 * operating on current and current->mm (force=0 and doesn't return any vmas).
835 *
836 * get_user_pages_fast may take mmap_sem and page tables, so no assumptions
837 * can be made about locking. get_user_pages_fast is to be implemented in a
838 * way that is advantageous (vs get_user_pages()) when the user memory area is
839 * already faulted in and present in ptes. However if the pages have to be
840 * faulted in, it may turn out to be slightly slower).
841 */
842int get_user_pages_fast(unsigned long start, int nr_pages, int write,
843 struct page **pages);
844
845/*
837 * A callback you can register to apply pressure to ageable caches. 846 * A callback you can register to apply pressure to ageable caches.
838 * 847 *
839 * 'shrink' is passed a count 'nr_to_scan' and a 'gfpmask'. It should 848 * 'shrink' is passed a count 'nr_to_scan' and a 'gfpmask'. It should
@@ -905,7 +914,7 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a
905} 914}
906#endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */ 915#endif /* CONFIG_MMU && !__ARCH_HAS_4LEVEL_HACK */
907 916
908#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS 917#if USE_SPLIT_PTLOCKS
909/* 918/*
910 * We tuck a spinlock to guard each pagetable page into its struct page, 919 * We tuck a spinlock to guard each pagetable page into its struct page,
911 * at page->private, with BUILD_BUG_ON to make sure that this will not 920 * at page->private, with BUILD_BUG_ON to make sure that this will not
@@ -918,14 +927,14 @@ static inline pmd_t *pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long a
918} while (0) 927} while (0)
919#define pte_lock_deinit(page) ((page)->mapping = NULL) 928#define pte_lock_deinit(page) ((page)->mapping = NULL)
920#define pte_lockptr(mm, pmd) ({(void)(mm); __pte_lockptr(pmd_page(*(pmd)));}) 929#define pte_lockptr(mm, pmd) ({(void)(mm); __pte_lockptr(pmd_page(*(pmd)));})
921#else 930#else /* !USE_SPLIT_PTLOCKS */
922/* 931/*
923 * We use mm->page_table_lock to guard all pagetable pages of the mm. 932 * We use mm->page_table_lock to guard all pagetable pages of the mm.
924 */ 933 */
925#define pte_lock_init(page) do {} while (0) 934#define pte_lock_init(page) do {} while (0)
926#define pte_lock_deinit(page) do {} while (0) 935#define pte_lock_deinit(page) do {} while (0)
927#define pte_lockptr(mm, pmd) ({(void)(pmd); &(mm)->page_table_lock;}) 936#define pte_lockptr(mm, pmd) ({(void)(pmd); &(mm)->page_table_lock;})
928#endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ 937#endif /* USE_SPLIT_PTLOCKS */
929 938
930static inline void pgtable_page_ctor(struct page *page) 939static inline void pgtable_page_ctor(struct page *page)
931{ 940{
@@ -1009,7 +1018,6 @@ extern unsigned long absent_pages_in_range(unsigned long start_pfn,
1009extern void get_pfn_range_for_nid(unsigned int nid, 1018extern void get_pfn_range_for_nid(unsigned int nid,
1010 unsigned long *start_pfn, unsigned long *end_pfn); 1019 unsigned long *start_pfn, unsigned long *end_pfn);
1011extern unsigned long find_min_pfn_with_active_regions(void); 1020extern unsigned long find_min_pfn_with_active_regions(void);
1012extern unsigned long find_max_pfn_with_active_regions(void);
1013extern void free_bootmem_with_active_regions(int nid, 1021extern void free_bootmem_with_active_regions(int nid,
1014 unsigned long max_low_pfn); 1022 unsigned long max_low_pfn);
1015typedef int (*work_fn_t)(unsigned long, unsigned long, void *); 1023typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
@@ -1072,6 +1080,9 @@ extern struct vm_area_struct *copy_vma(struct vm_area_struct **,
1072 unsigned long addr, unsigned long len, pgoff_t pgoff); 1080 unsigned long addr, unsigned long len, pgoff_t pgoff);
1073extern void exit_mmap(struct mm_struct *); 1081extern void exit_mmap(struct mm_struct *);
1074 1082
1083extern int mm_take_all_locks(struct mm_struct *mm);
1084extern void mm_drop_all_locks(struct mm_struct *mm);
1085
1075#ifdef CONFIG_PROC_FS 1086#ifdef CONFIG_PROC_FS
1076/* From fs/proc/base.c. callers must _not_ hold the mm's exe_file_lock */ 1087/* From fs/proc/base.c. callers must _not_ hold the mm's exe_file_lock */
1077extern void added_exe_file_vma(struct mm_struct *mm); 1088extern void added_exe_file_vma(struct mm_struct *mm);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 746f975b58ef..9d49fa36bbef 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -10,6 +10,7 @@
10#include <linux/rbtree.h> 10#include <linux/rbtree.h>
11#include <linux/rwsem.h> 11#include <linux/rwsem.h>
12#include <linux/completion.h> 12#include <linux/completion.h>
13#include <linux/cpumask.h>
13#include <asm/page.h> 14#include <asm/page.h>
14#include <asm/mmu.h> 15#include <asm/mmu.h>
15 16
@@ -20,11 +21,13 @@
20 21
21struct address_space; 22struct address_space;
22 23
23#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS 24#define USE_SPLIT_PTLOCKS (NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS)
25
26#if USE_SPLIT_PTLOCKS
24typedef atomic_long_t mm_counter_t; 27typedef atomic_long_t mm_counter_t;
25#else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ 28#else /* !USE_SPLIT_PTLOCKS */
26typedef unsigned long mm_counter_t; 29typedef unsigned long mm_counter_t;
27#endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ 30#endif /* !USE_SPLIT_PTLOCKS */
28 31
29/* 32/*
30 * Each physical page in the system has a struct page associated with 33 * Each physical page in the system has a struct page associated with
@@ -64,7 +67,7 @@ struct page {
64 * see PAGE_MAPPING_ANON below. 67 * see PAGE_MAPPING_ANON below.
65 */ 68 */
66 }; 69 };
67#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS 70#if USE_SPLIT_PTLOCKS
68 spinlock_t ptl; 71 spinlock_t ptl;
69#endif 72#endif
70 struct kmem_cache *slab; /* SLUB: Pointer to slab */ 73 struct kmem_cache *slab; /* SLUB: Pointer to slab */
@@ -112,7 +115,7 @@ struct vm_area_struct {
112 struct vm_area_struct *vm_next; 115 struct vm_area_struct *vm_next;
113 116
114 pgprot_t vm_page_prot; /* Access permissions of this VMA. */ 117 pgprot_t vm_page_prot; /* Access permissions of this VMA. */
115 unsigned long vm_flags; /* Flags, listed below. */ 118 unsigned long vm_flags; /* Flags, see mm.h. */
116 119
117 struct rb_node vm_rb; 120 struct rb_node vm_rb;
118 121
@@ -253,6 +256,9 @@ struct mm_struct {
253 struct file *exe_file; 256 struct file *exe_file;
254 unsigned long num_exe_file_vmas; 257 unsigned long num_exe_file_vmas;
255#endif 258#endif
259#ifdef CONFIG_MMU_NOTIFIER
260 struct mmu_notifier_mm *mmu_notifier_mm;
261#endif
256}; 262};
257 263
258#endif /* _LINUX_MM_TYPES_H */ 264#endif /* _LINUX_MM_TYPES_H */
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 0d508ac17d64..ee6e822d5994 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -111,6 +111,8 @@ struct mmc_card {
111 unsigned num_info; /* number of info strings */ 111 unsigned num_info; /* number of info strings */
112 const char **info; /* info strings */ 112 const char **info; /* info strings */
113 struct sdio_func_tuple *tuples; /* unknown common tuples */ 113 struct sdio_func_tuple *tuples; /* unknown common tuples */
114
115 struct dentry *debugfs_root;
114}; 116};
115 117
116#define mmc_card_mmc(c) ((c)->type == MMC_TYPE_MMC) 118#define mmc_card_mmc(c) ((c)->type == MMC_TYPE_MMC)
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 10a2080086ca..bde891f64591 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -65,7 +65,7 @@ struct mmc_host_ops {
65 * -ENOSYS when not supported (equal to NULL callback) 65 * -ENOSYS when not supported (equal to NULL callback)
66 * or a negative errno value when something bad happened 66 * or a negative errno value when something bad happened
67 * 67 *
68 * Return values for the get_ro callback should be: 68 * Return values for the get_cd callback should be:
69 * 0 for a absent card 69 * 0 for a absent card
70 * 1 for a present card 70 * 1 for a present card
71 * -ENOSYS when not supported (equal to NULL callback) 71 * -ENOSYS when not supported (equal to NULL callback)
@@ -157,6 +157,8 @@ struct mmc_host {
157 struct led_trigger *led; /* activity led */ 157 struct led_trigger *led; /* activity led */
158#endif 158#endif
159 159
160 struct dentry *debugfs_root;
161
160 unsigned long private[0] ____cacheline_aligned; 162 unsigned long private[0] ____cacheline_aligned;
161}; 163};
162 164
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h
new file mode 100644
index 000000000000..8a5509877192
--- /dev/null
+++ b/include/linux/mmdebug.h
@@ -0,0 +1,18 @@
1#ifndef LINUX_MM_DEBUG_H
2#define LINUX_MM_DEBUG_H 1
3
4#include <linux/autoconf.h>
5
6#ifdef CONFIG_DEBUG_VM
7#define VM_BUG_ON(cond) BUG_ON(cond)
8#else
9#define VM_BUG_ON(cond) do { } while (0)
10#endif
11
12#ifdef CONFIG_DEBUG_VIRTUAL
13#define VIRTUAL_BUG_ON(cond) BUG_ON(cond)
14#else
15#define VIRTUAL_BUG_ON(cond) do { } while (0)
16#endif
17
18#endif
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
new file mode 100644
index 000000000000..b77486d152cd
--- /dev/null
+++ b/include/linux/mmu_notifier.h
@@ -0,0 +1,279 @@
1#ifndef _LINUX_MMU_NOTIFIER_H
2#define _LINUX_MMU_NOTIFIER_H
3
4#include <linux/list.h>
5#include <linux/spinlock.h>
6#include <linux/mm_types.h>
7
8struct mmu_notifier;
9struct mmu_notifier_ops;
10
11#ifdef CONFIG_MMU_NOTIFIER
12
13/*
14 * The mmu notifier_mm structure is allocated and installed in
15 * mm->mmu_notifier_mm inside the mm_take_all_locks() protected
16 * critical section and it's released only when mm_count reaches zero
17 * in mmdrop().
18 */
19struct mmu_notifier_mm {
20 /* all mmu notifiers registerd in this mm are queued in this list */
21 struct hlist_head list;
22 /* to serialize the list modifications and hlist_unhashed */
23 spinlock_t lock;
24};
25
26struct mmu_notifier_ops {
27 /*
28 * Called either by mmu_notifier_unregister or when the mm is
29 * being destroyed by exit_mmap, always before all pages are
30 * freed. This can run concurrently with other mmu notifier
31 * methods (the ones invoked outside the mm context) and it
32 * should tear down all secondary mmu mappings and freeze the
33 * secondary mmu. If this method isn't implemented you've to
34 * be sure that nothing could possibly write to the pages
35 * through the secondary mmu by the time the last thread with
36 * tsk->mm == mm exits.
37 *
38 * As side note: the pages freed after ->release returns could
39 * be immediately reallocated by the gart at an alias physical
40 * address with a different cache model, so if ->release isn't
41 * implemented because all _software_ driven memory accesses
42 * through the secondary mmu are terminated by the time the
43 * last thread of this mm quits, you've also to be sure that
44 * speculative _hardware_ operations can't allocate dirty
45 * cachelines in the cpu that could not be snooped and made
46 * coherent with the other read and write operations happening
47 * through the gart alias address, so leading to memory
48 * corruption.
49 */
50 void (*release)(struct mmu_notifier *mn,
51 struct mm_struct *mm);
52
53 /*
54 * clear_flush_young is called after the VM is
55 * test-and-clearing the young/accessed bitflag in the
56 * pte. This way the VM will provide proper aging to the
57 * accesses to the page through the secondary MMUs and not
58 * only to the ones through the Linux pte.
59 */
60 int (*clear_flush_young)(struct mmu_notifier *mn,
61 struct mm_struct *mm,
62 unsigned long address);
63
64 /*
65 * Before this is invoked any secondary MMU is still ok to
66 * read/write to the page previously pointed to by the Linux
67 * pte because the page hasn't been freed yet and it won't be
68 * freed until this returns. If required set_page_dirty has to
69 * be called internally to this method.
70 */
71 void (*invalidate_page)(struct mmu_notifier *mn,
72 struct mm_struct *mm,
73 unsigned long address);
74
75 /*
76 * invalidate_range_start() and invalidate_range_end() must be
77 * paired and are called only when the mmap_sem and/or the
78 * locks protecting the reverse maps are held. The subsystem
79 * must guarantee that no additional references are taken to
80 * the pages in the range established between the call to
81 * invalidate_range_start() and the matching call to
82 * invalidate_range_end().
83 *
84 * Invalidation of multiple concurrent ranges may be
85 * optionally permitted by the driver. Either way the
86 * establishment of sptes is forbidden in the range passed to
87 * invalidate_range_begin/end for the whole duration of the
88 * invalidate_range_begin/end critical section.
89 *
90 * invalidate_range_start() is called when all pages in the
91 * range are still mapped and have at least a refcount of one.
92 *
93 * invalidate_range_end() is called when all pages in the
94 * range have been unmapped and the pages have been freed by
95 * the VM.
96 *
97 * The VM will remove the page table entries and potentially
98 * the page between invalidate_range_start() and
99 * invalidate_range_end(). If the page must not be freed
100 * because of pending I/O or other circumstances then the
101 * invalidate_range_start() callback (or the initial mapping
102 * by the driver) must make sure that the refcount is kept
103 * elevated.
104 *
105 * If the driver increases the refcount when the pages are
106 * initially mapped into an address space then either
107 * invalidate_range_start() or invalidate_range_end() may
108 * decrease the refcount. If the refcount is decreased on
109 * invalidate_range_start() then the VM can free pages as page
110 * table entries are removed. If the refcount is only
111 * droppped on invalidate_range_end() then the driver itself
112 * will drop the last refcount but it must take care to flush
113 * any secondary tlb before doing the final free on the
114 * page. Pages will no longer be referenced by the linux
115 * address space but may still be referenced by sptes until
116 * the last refcount is dropped.
117 */
118 void (*invalidate_range_start)(struct mmu_notifier *mn,
119 struct mm_struct *mm,
120 unsigned long start, unsigned long end);
121 void (*invalidate_range_end)(struct mmu_notifier *mn,
122 struct mm_struct *mm,
123 unsigned long start, unsigned long end);
124};
125
126/*
127 * The notifier chains are protected by mmap_sem and/or the reverse map
128 * semaphores. Notifier chains are only changed when all reverse maps and
129 * the mmap_sem locks are taken.
130 *
131 * Therefore notifier chains can only be traversed when either
132 *
133 * 1. mmap_sem is held.
134 * 2. One of the reverse map locks is held (i_mmap_lock or anon_vma->lock).
135 * 3. No other concurrent thread can access the list (release)
136 */
137struct mmu_notifier {
138 struct hlist_node hlist;
139 const struct mmu_notifier_ops *ops;
140};
141
142static inline int mm_has_notifiers(struct mm_struct *mm)
143{
144 return unlikely(mm->mmu_notifier_mm);
145}
146
147extern int mmu_notifier_register(struct mmu_notifier *mn,
148 struct mm_struct *mm);
149extern int __mmu_notifier_register(struct mmu_notifier *mn,
150 struct mm_struct *mm);
151extern void mmu_notifier_unregister(struct mmu_notifier *mn,
152 struct mm_struct *mm);
153extern void __mmu_notifier_mm_destroy(struct mm_struct *mm);
154extern void __mmu_notifier_release(struct mm_struct *mm);
155extern int __mmu_notifier_clear_flush_young(struct mm_struct *mm,
156 unsigned long address);
157extern void __mmu_notifier_invalidate_page(struct mm_struct *mm,
158 unsigned long address);
159extern void __mmu_notifier_invalidate_range_start(struct mm_struct *mm,
160 unsigned long start, unsigned long end);
161extern void __mmu_notifier_invalidate_range_end(struct mm_struct *mm,
162 unsigned long start, unsigned long end);
163
164static inline void mmu_notifier_release(struct mm_struct *mm)
165{
166 if (mm_has_notifiers(mm))
167 __mmu_notifier_release(mm);
168}
169
170static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm,
171 unsigned long address)
172{
173 if (mm_has_notifiers(mm))
174 return __mmu_notifier_clear_flush_young(mm, address);
175 return 0;
176}
177
178static inline void mmu_notifier_invalidate_page(struct mm_struct *mm,
179 unsigned long address)
180{
181 if (mm_has_notifiers(mm))
182 __mmu_notifier_invalidate_page(mm, address);
183}
184
185static inline void mmu_notifier_invalidate_range_start(struct mm_struct *mm,
186 unsigned long start, unsigned long end)
187{
188 if (mm_has_notifiers(mm))
189 __mmu_notifier_invalidate_range_start(mm, start, end);
190}
191
192static inline void mmu_notifier_invalidate_range_end(struct mm_struct *mm,
193 unsigned long start, unsigned long end)
194{
195 if (mm_has_notifiers(mm))
196 __mmu_notifier_invalidate_range_end(mm, start, end);
197}
198
199static inline void mmu_notifier_mm_init(struct mm_struct *mm)
200{
201 mm->mmu_notifier_mm = NULL;
202}
203
204static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
205{
206 if (mm_has_notifiers(mm))
207 __mmu_notifier_mm_destroy(mm);
208}
209
210/*
211 * These two macros will sometime replace ptep_clear_flush.
212 * ptep_clear_flush is impleemnted as macro itself, so this also is
213 * implemented as a macro until ptep_clear_flush will converted to an
214 * inline function, to diminish the risk of compilation failure. The
215 * invalidate_page method over time can be moved outside the PT lock
216 * and these two macros can be later removed.
217 */
218#define ptep_clear_flush_notify(__vma, __address, __ptep) \
219({ \
220 pte_t __pte; \
221 struct vm_area_struct *___vma = __vma; \
222 unsigned long ___address = __address; \
223 __pte = ptep_clear_flush(___vma, ___address, __ptep); \
224 mmu_notifier_invalidate_page(___vma->vm_mm, ___address); \
225 __pte; \
226})
227
228#define ptep_clear_flush_young_notify(__vma, __address, __ptep) \
229({ \
230 int __young; \
231 struct vm_area_struct *___vma = __vma; \
232 unsigned long ___address = __address; \
233 __young = ptep_clear_flush_young(___vma, ___address, __ptep); \
234 __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \
235 ___address); \
236 __young; \
237})
238
239#else /* CONFIG_MMU_NOTIFIER */
240
241static inline void mmu_notifier_release(struct mm_struct *mm)
242{
243}
244
245static inline int mmu_notifier_clear_flush_young(struct mm_struct *mm,
246 unsigned long address)
247{
248 return 0;
249}
250
251static inline void mmu_notifier_invalidate_page(struct mm_struct *mm,
252 unsigned long address)
253{
254}
255
256static inline void mmu_notifier_invalidate_range_start(struct mm_struct *mm,
257 unsigned long start, unsigned long end)
258{
259}
260
261static inline void mmu_notifier_invalidate_range_end(struct mm_struct *mm,
262 unsigned long start, unsigned long end)
263{
264}
265
266static inline void mmu_notifier_mm_init(struct mm_struct *mm)
267{
268}
269
270static inline void mmu_notifier_mm_destroy(struct mm_struct *mm)
271{
272}
273
274#define ptep_clear_flush_young_notify ptep_clear_flush_young
275#define ptep_clear_flush_notify ptep_clear_flush
276
277#endif /* CONFIG_MMU_NOTIFIER */
278
279#endif /* _LINUX_MMU_NOTIFIER_H */
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 443bc7cd8c62..428328a05fa1 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -751,8 +751,9 @@ static inline int zonelist_node_idx(struct zoneref *zoneref)
751 * 751 *
752 * This function returns the next zone at or below a given zone index that is 752 * This function returns the next zone at or below a given zone index that is
753 * within the allowed nodemask using a cursor as the starting point for the 753 * within the allowed nodemask using a cursor as the starting point for the
754 * search. The zoneref returned is a cursor that is used as the next starting 754 * search. The zoneref returned is a cursor that represents the current zone
755 * point for future calls to next_zones_zonelist(). 755 * being examined. It should be advanced by one before calling
756 * next_zones_zonelist again.
756 */ 757 */
757struct zoneref *next_zones_zonelist(struct zoneref *z, 758struct zoneref *next_zones_zonelist(struct zoneref *z,
758 enum zone_type highest_zoneidx, 759 enum zone_type highest_zoneidx,
@@ -768,9 +769,8 @@ struct zoneref *next_zones_zonelist(struct zoneref *z,
768 * 769 *
769 * This function returns the first zone at or below a given zone index that is 770 * This function returns the first zone at or below a given zone index that is
770 * within the allowed nodemask. The zoneref returned is a cursor that can be 771 * within the allowed nodemask. The zoneref returned is a cursor that can be
771 * used to iterate the zonelist with next_zones_zonelist. The cursor should 772 * used to iterate the zonelist with next_zones_zonelist by advancing it by
772 * not be used by the caller as it does not match the value of the zone 773 * one before calling.
773 * returned.
774 */ 774 */
775static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist, 775static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
776 enum zone_type highest_zoneidx, 776 enum zone_type highest_zoneidx,
@@ -795,7 +795,7 @@ static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
795#define for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, nodemask) \ 795#define for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, nodemask) \
796 for (z = first_zones_zonelist(zlist, highidx, nodemask, &zone); \ 796 for (z = first_zones_zonelist(zlist, highidx, nodemask, &zone); \
797 zone; \ 797 zone; \
798 z = next_zones_zonelist(z, highidx, nodemask, &zone)) \ 798 z = next_zones_zonelist(++z, highidx, nodemask, &zone)) \
799 799
800/** 800/**
801 * for_each_zone_zonelist - helper macro to iterate over valid zones in a zonelist at or below a given zone index 801 * for_each_zone_zonelist - helper macro to iterate over valid zones in a zonelist at or below a given zone index
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 4374d1adeb4b..30a1d63b6fb5 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -47,7 +47,7 @@ struct vfsmount {
47 struct list_head mnt_child; /* and going through their mnt_child */ 47 struct list_head mnt_child; /* and going through their mnt_child */
48 int mnt_flags; 48 int mnt_flags;
49 /* 4 bytes hole on 64bits arches */ 49 /* 4 bytes hole on 64bits arches */
50 char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ 50 const char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
51 struct list_head mnt_list; 51 struct list_head mnt_list;
52 struct list_head mnt_expire; /* link in fs-specific expiry list */ 52 struct list_head mnt_expire; /* link in fs-specific expiry list */
53 struct list_head mnt_share; /* circular list of shared mounts */ 53 struct list_head mnt_share; /* circular list of shared mounts */
@@ -105,7 +105,8 @@ extern struct vfsmount *vfs_kern_mount(struct file_system_type *type,
105 105
106struct nameidata; 106struct nameidata;
107 107
108extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd, 108struct path;
109extern int do_add_mount(struct vfsmount *newmnt, struct path *path,
109 int mnt_flags, struct list_head *fslist); 110 int mnt_flags, struct list_head *fslist);
110 111
111extern void mark_mounts_for_expiry(struct list_head *mounts); 112extern void mark_mounts_for_expiry(struct list_head *mounts);
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index 07112ee9293a..8a455694d682 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -6,7 +6,6 @@
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7#include <linux/in.h> 7#include <linux/in.h>
8#endif 8#endif
9#include <linux/pim.h>
10 9
11/* 10/*
12 * Based on the MROUTING 3.5 defines primarily to keep 11 * Based on the MROUTING 3.5 defines primarily to keep
@@ -130,6 +129,7 @@ struct igmpmsg
130 */ 129 */
131 130
132#ifdef __KERNEL__ 131#ifdef __KERNEL__
132#include <linux/pim.h>
133#include <net/sock.h> 133#include <net/sock.h>
134 134
135#ifdef CONFIG_IP_MROUTE 135#ifdef CONFIG_IP_MROUTE
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
index 5cf50473a10f..6f4c180179e2 100644
--- a/include/linux/mroute6.h
+++ b/include/linux/mroute6.h
@@ -115,6 +115,7 @@ struct sioc_mif_req6
115 115
116#ifdef __KERNEL__ 116#ifdef __KERNEL__
117 117
118#include <linux/pim.h>
118#include <linux/skbuff.h> /* for struct sk_buff_head */ 119#include <linux/skbuff.h> /* for struct sk_buff_head */
119 120
120#ifdef CONFIG_IPV6_MROUTE 121#ifdef CONFIG_IPV6_MROUTE
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index 9a6e2f953cba..8b4aa0523db7 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: blktrans.h,v 1.6 2005/11/07 11:14:54 gleixner Exp $
3 *
4 * (C) 2003 David Woodhouse <dwmw2@infradead.org> 2 * (C) 2003 David Woodhouse <dwmw2@infradead.org>
5 * 3 *
6 * Interface to Linux block layer for MTD 'translation layers'. 4 * Interface to Linux block layer for MTD 'translation layers'.
@@ -43,6 +41,8 @@ struct mtd_blktrans_ops {
43 unsigned long block, char *buffer); 41 unsigned long block, char *buffer);
44 int (*writesect)(struct mtd_blktrans_dev *dev, 42 int (*writesect)(struct mtd_blktrans_dev *dev,
45 unsigned long block, char *buffer); 43 unsigned long block, char *buffer);
44 int (*discard)(struct mtd_blktrans_dev *dev,
45 unsigned long block, unsigned nr_blocks);
46 46
47 /* Block layer ioctls */ 47 /* Block layer ioctls */
48 int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo); 48 int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo);
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index b0ddf4b25862..d6fb115f5a07 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -1,7 +1,6 @@
1 1
2/* Common Flash Interface structures 2/* Common Flash Interface structures
3 * See http://support.intel.com/design/flash/technote/index.htm 3 * See http://support.intel.com/design/flash/technote/index.htm
4 * $Id: cfi.h,v 1.57 2005/11/15 23:28:17 tpoynor Exp $
5 */ 4 */
6 5
7#ifndef __MTD_CFI_H__ 6#ifndef __MTD_CFI_H__
diff --git a/include/linux/mtd/cfi_endian.h b/include/linux/mtd/cfi_endian.h
index 25724f7d3867..d802f7736be3 100644
--- a/include/linux/mtd/cfi_endian.h
+++ b/include/linux/mtd/cfi_endian.h
@@ -1,8 +1,3 @@
1/*
2 * $Id: cfi_endian.h,v 1.11 2002/01/30 23:20:48 awozniak Exp $
3 *
4 */
5
6#include <asm/byteorder.h> 1#include <asm/byteorder.h>
7 2
8#ifndef CONFIG_MTD_CFI_ADV_OPTIONS 3#ifndef CONFIG_MTD_CFI_ADV_OPTIONS
diff --git a/include/linux/mtd/concat.h b/include/linux/mtd/concat.h
index ed8dc6755219..c02f3d264ecf 100644
--- a/include/linux/mtd/concat.h
+++ b/include/linux/mtd/concat.h
@@ -4,8 +4,6 @@
4 * (C) 2002 Robert Kaiser <rkaiser@sysgo.de> 4 * (C) 2002 Robert Kaiser <rkaiser@sysgo.de>
5 * 5 *
6 * This code is GPL 6 * This code is GPL
7 *
8 * $Id: concat.h,v 1.1 2002/03/08 16:34:36 rkaiser Exp $
9 */ 7 */
10 8
11#ifndef MTD_CONCAT_H 9#ifndef MTD_CONCAT_H
diff --git a/include/linux/mtd/doc2000.h b/include/linux/mtd/doc2000.h
index 9addd073bf15..0a6d516ab71d 100644
--- a/include/linux/mtd/doc2000.h
+++ b/include/linux/mtd/doc2000.h
@@ -6,8 +6,6 @@
6 * Copyright (C) 2002-2003 Greg Ungerer <gerg@snapgear.com> 6 * Copyright (C) 2002-2003 Greg Ungerer <gerg@snapgear.com>
7 * Copyright (C) 2002-2003 SnapGear Inc 7 * Copyright (C) 2002-2003 SnapGear Inc
8 * 8 *
9 * $Id: doc2000.h,v 1.25 2005/11/07 11:14:54 gleixner Exp $
10 *
11 * Released under GPL 9 * Released under GPL
12 */ 10 */
13 11
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h
index 39e7d2a1be9a..08dd131301c1 100644
--- a/include/linux/mtd/flashchip.h
+++ b/include/linux/mtd/flashchip.h
@@ -5,9 +5,6 @@
5 * Contains information about the location and state of a given flash device 5 * Contains information about the location and state of a given flash device
6 * 6 *
7 * (C) 2000 Red Hat. GPLd. 7 * (C) 2000 Red Hat. GPLd.
8 *
9 * $Id: flashchip.h,v 1.18 2005/11/07 11:14:54 gleixner Exp $
10 *
11 */ 8 */
12 9
13#ifndef __MTD_FLASHCHIP_H__ 10#ifndef __MTD_FLASHCHIP_H__
diff --git a/include/linux/mtd/ftl.h b/include/linux/mtd/ftl.h
index d99609113307..0be442f881dd 100644
--- a/include/linux/mtd/ftl.h
+++ b/include/linux/mtd/ftl.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: ftl.h,v 1.7 2005/11/07 11:14:54 gleixner Exp $
3 *
4 * Derived from (and probably identical to): 2 * Derived from (and probably identical to):
5 * ftl.h 1.7 1999/10/25 20:23:17 3 * ftl.h 1.7 1999/10/25 20:23:17
6 * 4 *
diff --git a/include/linux/mtd/gen_probe.h b/include/linux/mtd/gen_probe.h
index 256e7342ed1e..df362ddf2949 100644
--- a/include/linux/mtd/gen_probe.h
+++ b/include/linux/mtd/gen_probe.h
@@ -1,7 +1,6 @@
1/* 1/*
2 * (C) 2001, 2001 Red Hat, Inc. 2 * (C) 2001, 2001 Red Hat, Inc.
3 * GPL'd 3 * GPL'd
4 * $Id: gen_probe.h,v 1.4 2005/11/07 11:14:54 gleixner Exp $
5 */ 4 */
6 5
7#ifndef __LINUX_MTD_GEN_PROBE_H__ 6#ifndef __LINUX_MTD_GEN_PROBE_H__
diff --git a/include/linux/mtd/inftl.h b/include/linux/mtd/inftl.h
index 85fd041d44ad..64ee53ce95a9 100644
--- a/include/linux/mtd/inftl.h
+++ b/include/linux/mtd/inftl.h
@@ -2,8 +2,6 @@
2 * inftl.h -- defines to support the Inverse NAND Flash Translation Layer 2 * inftl.h -- defines to support the Inverse NAND Flash Translation Layer
3 * 3 *
4 * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com) 4 * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com)
5 *
6 * $Id: inftl.h,v 1.7 2005/06/13 13:08:45 sean Exp $
7 */ 5 */
8 6
9#ifndef __MTD_INFTL_H__ 7#ifndef __MTD_INFTL_H__
@@ -52,8 +50,6 @@ struct INFTLrecord {
52int INFTL_mount(struct INFTLrecord *s); 50int INFTL_mount(struct INFTLrecord *s);
53int INFTL_formatblock(struct INFTLrecord *s, int block); 51int INFTL_formatblock(struct INFTLrecord *s, int block);
54 52
55extern char inftlmountrev[];
56
57void INFTL_dumptables(struct INFTLrecord *s); 53void INFTL_dumptables(struct INFTLrecord *s);
58void INFTL_dumpVUchains(struct INFTLrecord *s); 54void INFTL_dumpVUchains(struct INFTLrecord *s);
59 55
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index 9c1d95491f8b..aa30244492c6 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -1,6 +1,5 @@
1 1
2/* Overhauled routines for dealing with different mmap regions of flash */ 2/* Overhauled routines for dealing with different mmap regions of flash */
3/* $Id: map.h,v 1.54 2005/11/07 11:14:54 gleixner Exp $ */
4 3
5#ifndef __LINUX_MTD_MAP_H__ 4#ifndef __LINUX_MTD_MAP_H__
6#define __LINUX_MTD_MAP_H__ 5#define __LINUX_MTD_MAP_H__
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 8b5d49133ec6..922636548558 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: mtd.h,v 1.61 2005/11/07 11:14:54 gleixner Exp $
3 *
4 * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al. 2 * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al.
5 * 3 *
6 * Released under GPL 4 * Released under GPL
@@ -274,7 +272,11 @@ static inline void mtd_erase_callback(struct erase_info *instr)
274 printk(KERN_INFO args); \ 272 printk(KERN_INFO args); \
275 } while(0) 273 } while(0)
276#else /* CONFIG_MTD_DEBUG */ 274#else /* CONFIG_MTD_DEBUG */
277#define DEBUG(n, args...) do { } while(0) 275#define DEBUG(n, args...) \
276 do { \
277 if (0) \
278 printk(KERN_INFO args); \
279 } while(0)
278 280
279#endif /* CONFIG_MTD_DEBUG */ 281#endif /* CONFIG_MTD_DEBUG */
280 282
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 53ea3dc8b0e8..81774e5facf4 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -5,8 +5,6 @@
5 * Steven J. Hill <sjhill@realitydiluted.com> 5 * Steven J. Hill <sjhill@realitydiluted.com>
6 * Thomas Gleixner <tglx@linutronix.de> 6 * Thomas Gleixner <tglx@linutronix.de>
7 * 7 *
8 * $Id: nand.h,v 1.74 2005/09/15 13:58:50 vwool Exp $
9 *
10 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
@@ -179,6 +177,9 @@ typedef enum {
179#define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING)) 177#define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING))
180#define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG)) 178#define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG))
181#define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK)) 179#define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK))
180/* Large page NAND with SOFT_ECC should support subpage reads */
181#define NAND_SUBPAGE_READ(chip) ((chip->ecc.mode == NAND_ECC_SOFT) \
182 && (chip->page_shift > 9))
182 183
183/* Mask to zero out the chip options, which come from the id table */ 184/* Mask to zero out the chip options, which come from the id table */
184#define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR) 185#define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR)
@@ -276,6 +277,10 @@ struct nand_ecc_ctrl {
276 int (*read_page)(struct mtd_info *mtd, 277 int (*read_page)(struct mtd_info *mtd,
277 struct nand_chip *chip, 278 struct nand_chip *chip,
278 uint8_t *buf); 279 uint8_t *buf);
280 int (*read_subpage)(struct mtd_info *mtd,
281 struct nand_chip *chip,
282 uint32_t offs, uint32_t len,
283 uint8_t *buf);
279 void (*write_page)(struct mtd_info *mtd, 284 void (*write_page)(struct mtd_info *mtd,
280 struct nand_chip *chip, 285 struct nand_chip *chip,
281 const uint8_t *buf); 286 const uint8_t *buf);
diff --git a/include/linux/mtd/nand_ecc.h b/include/linux/mtd/nand_ecc.h
index 12c5bc342ead..090da505425d 100644
--- a/include/linux/mtd/nand_ecc.h
+++ b/include/linux/mtd/nand_ecc.h
@@ -3,8 +3,6 @@
3 * 3 *
4 * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com) 4 * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com)
5 * 5 *
6 * $Id: nand_ecc.h,v 1.4 2004/06/17 02:35:02 dbrown Exp $
7 *
8 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
diff --git a/include/linux/mtd/nftl.h b/include/linux/mtd/nftl.h
index 001eec50cac6..dcaf611ed748 100644
--- a/include/linux/mtd/nftl.h
+++ b/include/linux/mtd/nftl.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: nftl.h,v 1.16 2004/06/30 14:49:00 dbrown Exp $
3 *
4 * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> 2 * (C) 1999-2003 David Woodhouse <dwmw2@infradead.org>
5 */ 3 */
6 4
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index 7c37d7e55abc..5014f7a9f5df 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -4,8 +4,6 @@
4 * (C) 2000 Nicolas Pitre <nico@cam.org> 4 * (C) 2000 Nicolas Pitre <nico@cam.org>
5 * 5 *
6 * This code is GPL 6 * This code is GPL
7 *
8 * $Id: partitions.h,v 1.17 2005/11/07 11:14:55 gleixner Exp $
9 */ 7 */
10 8
11#ifndef MTD_PARTITIONS_H 9#ifndef MTD_PARTITIONS_H
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h
index 0dc07d5f3354..c8e63a5ee72e 100644
--- a/include/linux/mtd/physmap.h
+++ b/include/linux/mtd/physmap.h
@@ -2,8 +2,6 @@
2 * For boards with physically mapped flash and using 2 * For boards with physically mapped flash and using
3 * drivers/mtd/maps/physmap.c mapping driver. 3 * drivers/mtd/maps/physmap.c mapping driver.
4 * 4 *
5 * $Id: physmap.h,v 1.4 2005/11/07 11:14:55 gleixner Exp $
6 *
7 * Copyright (C) 2003 MontaVista Software Inc. 5 * Copyright (C) 2003 MontaVista Software Inc.
8 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net 6 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
9 * 7 *
diff --git a/include/linux/mtd/plat-ram.h b/include/linux/mtd/plat-ram.h
index 0e37ad07bce2..e07890aff1cf 100644
--- a/include/linux/mtd/plat-ram.h
+++ b/include/linux/mtd/plat-ram.h
@@ -6,8 +6,6 @@
6 * 6 *
7 * Generic platform device based RAM map 7 * Generic platform device based RAM map
8 * 8 *
9 * $Id: plat-ram.h,v 1.2 2005/01/24 00:37:40 bjd Exp $
10 *
11 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
diff --git a/include/linux/mtd/pmc551.h b/include/linux/mtd/pmc551.h
index 5cc070c24d88..27ad40aed19f 100644
--- a/include/linux/mtd/pmc551.h
+++ b/include/linux/mtd/pmc551.h
@@ -1,6 +1,4 @@
1/* 1/*
2 * $Id: pmc551.h,v 1.6 2005/11/07 11:14:55 gleixner Exp $
3 *
4 * PMC551 PCI Mezzanine Ram Device 2 * PMC551 PCI Mezzanine Ram Device
5 * 3 *
6 * Author: 4 * Author:
@@ -17,7 +15,7 @@
17 15
18#include <linux/mtd/mtd.h> 16#include <linux/mtd/mtd.h>
19 17
20#define PMC551_VERSION "$Id: pmc551.h,v 1.6 2005/11/07 11:14:55 gleixner Exp $\n"\ 18#define PMC551_VERSION \
21 "Ramix PMC551 PCI Mezzanine Ram Driver. (C) 1999,2000 Nortel Networks.\n" 19 "Ramix PMC551 PCI Mezzanine Ram Driver. (C) 1999,2000 Nortel Networks.\n"
22 20
23/* 21/*
diff --git a/include/linux/mtd/xip.h b/include/linux/mtd/xip.h
index e9d40bdde48c..36efcba15ecd 100644
--- a/include/linux/mtd/xip.h
+++ b/include/linux/mtd/xip.h
@@ -11,8 +11,6 @@
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14 *
15 * $Id: xip.h,v 1.5 2005/11/07 11:14:55 gleixner Exp $
16 */ 14 */
17 15
18#ifndef __LINUX_MTD_XIP_H__ 16#ifndef __LINUX_MTD_XIP_H__
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index 12078577aef6..cbbbe9bfecad 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -17,9 +17,14 @@
17 17
18struct mv643xx_eth_shared_platform_data { 18struct mv643xx_eth_shared_platform_data {
19 struct mbus_dram_target_info *dram; 19 struct mbus_dram_target_info *dram;
20 struct platform_device *shared_smi;
20 unsigned int t_clk; 21 unsigned int t_clk;
21}; 22};
22 23
24#define MV643XX_ETH_PHY_ADDR_DEFAULT 0
25#define MV643XX_ETH_PHY_ADDR(x) (0x80 | (x))
26#define MV643XX_ETH_PHY_NONE 0xff
27
23struct mv643xx_eth_platform_data { 28struct mv643xx_eth_platform_data {
24 /* 29 /*
25 * Pointer back to our parent instance, and our port number. 30 * Pointer back to our parent instance, and our port number.
@@ -30,8 +35,6 @@ struct mv643xx_eth_platform_data {
30 /* 35 /*
31 * Whether a PHY is present, and if yes, at which address. 36 * Whether a PHY is present, and if yes, at which address.
32 */ 37 */
33 struct platform_device *shared_smi;
34 int force_phy_addr;
35 int phy_addr; 38 int phy_addr;
36 39
37 /* 40 /*
@@ -49,10 +52,10 @@ struct mv643xx_eth_platform_data {
49 int duplex; 52 int duplex;
50 53
51 /* 54 /*
52 * Which RX/TX queues to use. 55 * How many RX/TX queues to use.
53 */ 56 */
54 int rx_queue_mask; 57 int rx_queue_count;
55 int tx_queue_mask; 58 int tx_queue_count;
56 59
57 /* 60 /*
58 * Override default RX/TX queue sizes if nonzero. 61 * Override default RX/TX queue sizes if nonzero.
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 24d88e98a626..68f8c3203c89 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -47,27 +47,24 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
47#define LOOKUP_DIRECTORY 2 47#define LOOKUP_DIRECTORY 2
48#define LOOKUP_CONTINUE 4 48#define LOOKUP_CONTINUE 4
49#define LOOKUP_PARENT 16 49#define LOOKUP_PARENT 16
50#define LOOKUP_NOALT 32
51#define LOOKUP_REVAL 64 50#define LOOKUP_REVAL 64
52/* 51/*
53 * Intent data 52 * Intent data
54 */ 53 */
55#define LOOKUP_OPEN (0x0100) 54#define LOOKUP_OPEN (0x0100)
56#define LOOKUP_CREATE (0x0200) 55#define LOOKUP_CREATE (0x0200)
57#define LOOKUP_ACCESS (0x0400) 56
58#define LOOKUP_CHDIR (0x0800) 57extern int user_path_at(int, const char __user *, unsigned, struct path *);
59 58
60extern int __user_walk(const char __user *, unsigned, struct nameidata *); 59#define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path)
61extern int __user_walk_fd(int dfd, const char __user *, unsigned, struct nameidata *); 60#define user_lpath(name, path) user_path_at(AT_FDCWD, name, 0, path)
62#define user_path_walk(name,nd) \ 61#define user_path_dir(name, path) \
63 __user_walk_fd(AT_FDCWD, name, LOOKUP_FOLLOW, nd) 62 user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, path)
64#define user_path_walk_link(name,nd) \ 63
65 __user_walk_fd(AT_FDCWD, name, 0, nd)
66extern int path_lookup(const char *, unsigned, struct nameidata *); 64extern int path_lookup(const char *, unsigned, struct nameidata *);
67extern int vfs_path_lookup(struct dentry *, struct vfsmount *, 65extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
68 const char *, unsigned int, struct nameidata *); 66 const char *, unsigned int, struct nameidata *);
69 67
70extern int __user_path_lookup_open(const char __user *, unsigned lookup_flags, struct nameidata *nd, int open_flags);
71extern int path_lookup_open(int dfd, const char *name, unsigned lookup_flags, struct nameidata *, int open_flags); 68extern int path_lookup_open(int dfd, const char *name, unsigned lookup_flags, struct nameidata *, int open_flags);
72extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry, 69extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry,
73 int (*open)(struct inode *, struct file *)); 70 int (*open)(struct inode *, struct file *));
diff --git a/include/linux/net.h b/include/linux/net.h
index 4a9a30f2d68f..6dc14a240042 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -18,16 +18,9 @@
18#ifndef _LINUX_NET_H 18#ifndef _LINUX_NET_H
19#define _LINUX_NET_H 19#define _LINUX_NET_H
20 20
21#include <linux/wait.h>
22#include <linux/socket.h> 21#include <linux/socket.h>
23#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */
24#include <asm/socket.h> 22#include <asm/socket.h>
25 23
26struct poll_table_struct;
27struct pipe_inode_info;
28struct inode;
29struct net;
30
31#define NPROTO AF_MAX 24#define NPROTO AF_MAX
32 25
33#define SYS_SOCKET 1 /* sys_socket(2) */ 26#define SYS_SOCKET 1 /* sys_socket(2) */
@@ -62,6 +55,13 @@ typedef enum {
62#ifdef __KERNEL__ 55#ifdef __KERNEL__
63#include <linux/stringify.h> 56#include <linux/stringify.h>
64#include <linux/random.h> 57#include <linux/random.h>
58#include <linux/wait.h>
59#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */
60
61struct poll_table_struct;
62struct pipe_inode_info;
63struct inode;
64struct net;
65 65
66#define SOCK_ASYNC_NOSPACE 0 66#define SOCK_ASYNC_NOSPACE 0
67#define SOCK_ASYNC_WAITDATA 1 67#define SOCK_ASYNC_WAITDATA 1
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index b4d056ceab96..d3ea3de70a8a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -42,6 +42,7 @@
42#include <linux/workqueue.h> 42#include <linux/workqueue.h>
43 43
44#include <net/net_namespace.h> 44#include <net/net_namespace.h>
45#include <net/dsa.h>
45 46
46struct vlan_group; 47struct vlan_group;
47struct ethtool_ops; 48struct ethtool_ops;
@@ -61,9 +62,7 @@ struct wireless_dev;
61#define NET_XMIT_DROP 1 /* skb dropped */ 62#define NET_XMIT_DROP 1 /* skb dropped */
62#define NET_XMIT_CN 2 /* congestion notification */ 63#define NET_XMIT_CN 2 /* congestion notification */
63#define NET_XMIT_POLICED 3 /* skb is shot by police */ 64#define NET_XMIT_POLICED 3 /* skb is shot by police */
64#define NET_XMIT_BYPASS 4 /* packet does not leave via dequeue; 65#define NET_XMIT_MASK 0xFFFF /* qdisc flags in net/sch_generic.h */
65 (TC use only - dev_queue_xmit
66 returns this as NET_XMIT_SUCCESS) */
67 66
68/* Backlog congestion levels */ 67/* Backlog congestion levels */
69#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ 68#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
@@ -440,6 +439,7 @@ static inline void napi_synchronize(const struct napi_struct *n)
440enum netdev_queue_state_t 439enum netdev_queue_state_t
441{ 440{
442 __QUEUE_STATE_XOFF, 441 __QUEUE_STATE_XOFF,
442 __QUEUE_STATE_FROZEN,
443}; 443};
444 444
445struct netdev_queue { 445struct netdev_queue {
@@ -472,6 +472,8 @@ struct net_device
472 char name[IFNAMSIZ]; 472 char name[IFNAMSIZ];
473 /* device name hash chain */ 473 /* device name hash chain */
474 struct hlist_node name_hlist; 474 struct hlist_node name_hlist;
475 /* snmp alias */
476 char *ifalias;
475 477
476 /* 478 /*
477 * I/O specific fields 479 * I/O specific fields
@@ -606,6 +608,9 @@ struct net_device
606 608
607 /* Protocol specific pointers */ 609 /* Protocol specific pointers */
608 610
611#ifdef CONFIG_NET_DSA
612 void *dsa_ptr; /* dsa specific data */
613#endif
609 void *atalk_ptr; /* AppleTalk link */ 614 void *atalk_ptr; /* AppleTalk link */
610 void *ip_ptr; /* IPv4 specific data */ 615 void *ip_ptr; /* IPv4 specific data */
611 void *dn_ptr; /* DECnet specific data */ 616 void *dn_ptr; /* DECnet specific data */
@@ -636,7 +641,7 @@ struct net_device
636 unsigned int real_num_tx_queues; 641 unsigned int real_num_tx_queues;
637 642
638 unsigned long tx_queue_len; /* Max frames per queue allowed */ 643 unsigned long tx_queue_len; /* Max frames per queue allowed */
639 644 spinlock_t tx_global_lock;
640/* 645/*
641 * One part is mostly used on xmit path (device) 646 * One part is mostly used on xmit path (device)
642 */ 647 */
@@ -797,6 +802,26 @@ void dev_net_set(struct net_device *dev, struct net *net)
797#endif 802#endif
798} 803}
799 804
805static inline bool netdev_uses_dsa_tags(struct net_device *dev)
806{
807#ifdef CONFIG_NET_DSA_TAG_DSA
808 if (dev->dsa_ptr != NULL)
809 return dsa_uses_dsa_tags(dev->dsa_ptr);
810#endif
811
812 return 0;
813}
814
815static inline bool netdev_uses_trailer_tags(struct net_device *dev)
816{
817#ifdef CONFIG_NET_DSA_TAG_TRAILER
818 if (dev->dsa_ptr != NULL)
819 return dsa_uses_trailer_tags(dev->dsa_ptr);
820#endif
821
822 return 0;
823}
824
800/** 825/**
801 * netdev_priv - access network device private data 826 * netdev_priv - access network device private data
802 * @dev: network device 827 * @dev: network device
@@ -1099,6 +1124,11 @@ static inline int netif_queue_stopped(const struct net_device *dev)
1099 return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0)); 1124 return netif_tx_queue_stopped(netdev_get_tx_queue(dev, 0));
1100} 1125}
1101 1126
1127static inline int netif_tx_queue_frozen(const struct netdev_queue *dev_queue)
1128{
1129 return test_bit(__QUEUE_STATE_FROZEN, &dev_queue->state);
1130}
1131
1102/** 1132/**
1103 * netif_running - test if up 1133 * netif_running - test if up
1104 * @dev: network device 1134 * @dev: network device
@@ -1219,7 +1249,8 @@ extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
1219extern int dev_ethtool(struct net *net, struct ifreq *); 1249extern int dev_ethtool(struct net *net, struct ifreq *);
1220extern unsigned dev_get_flags(const struct net_device *); 1250extern unsigned dev_get_flags(const struct net_device *);
1221extern int dev_change_flags(struct net_device *, unsigned); 1251extern int dev_change_flags(struct net_device *, unsigned);
1222extern int dev_change_name(struct net_device *, char *); 1252extern int dev_change_name(struct net_device *, const char *);
1253extern int dev_set_alias(struct net_device *, const char *, size_t);
1223extern int dev_change_net_namespace(struct net_device *, 1254extern int dev_change_net_namespace(struct net_device *,
1224 struct net *, const char *); 1255 struct net *, const char *);
1225extern int dev_set_mtu(struct net_device *, int); 1256extern int dev_set_mtu(struct net_device *, int);
@@ -1475,6 +1506,26 @@ static inline void __netif_tx_lock_bh(struct netdev_queue *txq)
1475 txq->xmit_lock_owner = smp_processor_id(); 1506 txq->xmit_lock_owner = smp_processor_id();
1476} 1507}
1477 1508
1509static inline int __netif_tx_trylock(struct netdev_queue *txq)
1510{
1511 int ok = spin_trylock(&txq->_xmit_lock);
1512 if (likely(ok))
1513 txq->xmit_lock_owner = smp_processor_id();
1514 return ok;
1515}
1516
1517static inline void __netif_tx_unlock(struct netdev_queue *txq)
1518{
1519 txq->xmit_lock_owner = -1;
1520 spin_unlock(&txq->_xmit_lock);
1521}
1522
1523static inline void __netif_tx_unlock_bh(struct netdev_queue *txq)
1524{
1525 txq->xmit_lock_owner = -1;
1526 spin_unlock_bh(&txq->_xmit_lock);
1527}
1528
1478/** 1529/**
1479 * netif_tx_lock - grab network device transmit lock 1530 * netif_tx_lock - grab network device transmit lock
1480 * @dev: network device 1531 * @dev: network device
@@ -1484,12 +1535,23 @@ static inline void __netif_tx_lock_bh(struct netdev_queue *txq)
1484 */ 1535 */
1485static inline void netif_tx_lock(struct net_device *dev) 1536static inline void netif_tx_lock(struct net_device *dev)
1486{ 1537{
1487 int cpu = smp_processor_id();
1488 unsigned int i; 1538 unsigned int i;
1539 int cpu;
1489 1540
1541 spin_lock(&dev->tx_global_lock);
1542 cpu = smp_processor_id();
1490 for (i = 0; i < dev->num_tx_queues; i++) { 1543 for (i = 0; i < dev->num_tx_queues; i++) {
1491 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); 1544 struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
1545
1546 /* We are the only thread of execution doing a
1547 * freeze, but we have to grab the _xmit_lock in
1548 * order to synchronize with threads which are in
1549 * the ->hard_start_xmit() handler and already
1550 * checked the frozen bit.
1551 */
1492 __netif_tx_lock(txq, cpu); 1552 __netif_tx_lock(txq, cpu);
1553 set_bit(__QUEUE_STATE_FROZEN, &txq->state);
1554 __netif_tx_unlock(txq);
1493 } 1555 }
1494} 1556}
1495 1557
@@ -1499,40 +1561,22 @@ static inline void netif_tx_lock_bh(struct net_device *dev)
1499 netif_tx_lock(dev); 1561 netif_tx_lock(dev);
1500} 1562}
1501 1563
1502static inline int __netif_tx_trylock(struct netdev_queue *txq)
1503{
1504 int ok = spin_trylock(&txq->_xmit_lock);
1505 if (likely(ok))
1506 txq->xmit_lock_owner = smp_processor_id();
1507 return ok;
1508}
1509
1510static inline int netif_tx_trylock(struct net_device *dev)
1511{
1512 return __netif_tx_trylock(netdev_get_tx_queue(dev, 0));
1513}
1514
1515static inline void __netif_tx_unlock(struct netdev_queue *txq)
1516{
1517 txq->xmit_lock_owner = -1;
1518 spin_unlock(&txq->_xmit_lock);
1519}
1520
1521static inline void __netif_tx_unlock_bh(struct netdev_queue *txq)
1522{
1523 txq->xmit_lock_owner = -1;
1524 spin_unlock_bh(&txq->_xmit_lock);
1525}
1526
1527static inline void netif_tx_unlock(struct net_device *dev) 1564static inline void netif_tx_unlock(struct net_device *dev)
1528{ 1565{
1529 unsigned int i; 1566 unsigned int i;
1530 1567
1531 for (i = 0; i < dev->num_tx_queues; i++) { 1568 for (i = 0; i < dev->num_tx_queues; i++) {
1532 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); 1569 struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
1533 __netif_tx_unlock(txq);
1534 }
1535 1570
1571 /* No need to grab the _xmit_lock here. If the
1572 * queue is not stopped for another reason, we
1573 * force a schedule.
1574 */
1575 clear_bit(__QUEUE_STATE_FROZEN, &txq->state);
1576 if (!test_bit(__QUEUE_STATE_XOFF, &txq->state))
1577 __netif_schedule(txq->qdisc);
1578 }
1579 spin_unlock(&dev->tx_global_lock);
1536} 1580}
1537 1581
1538static inline void netif_tx_unlock_bh(struct net_device *dev) 1582static inline void netif_tx_unlock_bh(struct net_device *dev)
@@ -1556,13 +1600,18 @@ static inline void netif_tx_unlock_bh(struct net_device *dev)
1556static inline void netif_tx_disable(struct net_device *dev) 1600static inline void netif_tx_disable(struct net_device *dev)
1557{ 1601{
1558 unsigned int i; 1602 unsigned int i;
1603 int cpu;
1559 1604
1560 netif_tx_lock_bh(dev); 1605 local_bh_disable();
1606 cpu = smp_processor_id();
1561 for (i = 0; i < dev->num_tx_queues; i++) { 1607 for (i = 0; i < dev->num_tx_queues; i++) {
1562 struct netdev_queue *txq = netdev_get_tx_queue(dev, i); 1608 struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
1609
1610 __netif_tx_lock(txq, cpu);
1563 netif_tx_stop_queue(txq); 1611 netif_tx_stop_queue(txq);
1612 __netif_tx_unlock(txq);
1564 } 1613 }
1565 netif_tx_unlock_bh(dev); 1614 local_bh_enable();
1566} 1615}
1567 1616
1568static inline void netif_addr_lock(struct net_device *dev) 1617static inline void netif_addr_lock(struct net_device *dev)
@@ -1645,7 +1694,7 @@ extern void dev_seq_stop(struct seq_file *seq, void *v);
1645extern int netdev_class_create_file(struct class_attribute *class_attr); 1694extern int netdev_class_create_file(struct class_attribute *class_attr);
1646extern void netdev_class_remove_file(struct class_attribute *class_attr); 1695extern void netdev_class_remove_file(struct class_attribute *class_attr);
1647 1696
1648extern char *netdev_drivername(struct net_device *dev, char *buffer, int len); 1697extern char *netdev_drivername(const struct net_device *dev, char *buffer, int len);
1649 1698
1650extern void linkwatch_run_queue(void); 1699extern void linkwatch_run_queue(void);
1651 1700
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 0c5eb7ed8b3f..48cfe51bfddc 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -5,13 +5,11 @@
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/skbuff.h> 6#include <linux/skbuff.h>
7#include <linux/net.h> 7#include <linux/net.h>
8#include <linux/netdevice.h>
9#include <linux/if.h> 8#include <linux/if.h>
10#include <linux/in.h> 9#include <linux/in.h>
11#include <linux/in6.h> 10#include <linux/in6.h>
12#include <linux/wait.h> 11#include <linux/wait.h>
13#include <linux/list.h> 12#include <linux/list.h>
14#include <net/net_namespace.h>
15#endif 13#endif
16#include <linux/types.h> 14#include <linux/types.h>
17#include <linux/compiler.h> 15#include <linux/compiler.h>
@@ -52,6 +50,16 @@ enum nf_inet_hooks {
52 NF_INET_NUMHOOKS 50 NF_INET_NUMHOOKS
53}; 51};
54 52
53enum {
54 NFPROTO_UNSPEC = 0,
55 NFPROTO_IPV4 = 2,
56 NFPROTO_ARP = 3,
57 NFPROTO_BRIDGE = 7,
58 NFPROTO_IPV6 = 10,
59 NFPROTO_DECNET = 12,
60 NFPROTO_NUMPROTO,
61};
62
55union nf_inet_addr { 63union nf_inet_addr {
56 __u32 all[4]; 64 __u32 all[4];
57 __be32 ip; 65 __be32 ip;
@@ -92,8 +100,8 @@ struct nf_hook_ops
92 /* User fills in from here down. */ 100 /* User fills in from here down. */
93 nf_hookfn *hook; 101 nf_hookfn *hook;
94 struct module *owner; 102 struct module *owner;
95 int pf; 103 u_int8_t pf;
96 int hooknum; 104 unsigned int hooknum;
97 /* Hooks are ordered in ascending priority. */ 105 /* Hooks are ordered in ascending priority. */
98 int priority; 106 int priority;
99}; 107};
@@ -102,7 +110,7 @@ struct nf_sockopt_ops
102{ 110{
103 struct list_head list; 111 struct list_head list;
104 112
105 int pf; 113 u_int8_t pf;
106 114
107 /* Non-inclusive ranges: use 0/0/NULL to never get called. */ 115 /* Non-inclusive ranges: use 0/0/NULL to never get called. */
108 int set_optmin; 116 int set_optmin;
@@ -138,9 +146,9 @@ extern struct ctl_path nf_net_netfilter_sysctl_path[];
138extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[]; 146extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[];
139#endif /* CONFIG_SYSCTL */ 147#endif /* CONFIG_SYSCTL */
140 148
141extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS]; 149extern struct list_head nf_hooks[NFPROTO_NUMPROTO][NF_MAX_HOOKS];
142 150
143int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb, 151int nf_hook_slow(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
144 struct net_device *indev, struct net_device *outdev, 152 struct net_device *indev, struct net_device *outdev,
145 int (*okfn)(struct sk_buff *), int thresh); 153 int (*okfn)(struct sk_buff *), int thresh);
146 154
@@ -151,7 +159,7 @@ int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb,
151 * okfn must be invoked by the caller in this case. Any other return 159 * okfn must be invoked by the caller in this case. Any other return
152 * value indicates the packet has been consumed by the hook. 160 * value indicates the packet has been consumed by the hook.
153 */ 161 */
154static inline int nf_hook_thresh(int pf, unsigned int hook, 162static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
155 struct sk_buff *skb, 163 struct sk_buff *skb,
156 struct net_device *indev, 164 struct net_device *indev,
157 struct net_device *outdev, 165 struct net_device *outdev,
@@ -167,7 +175,7 @@ static inline int nf_hook_thresh(int pf, unsigned int hook,
167 return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh); 175 return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh);
168} 176}
169 177
170static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb, 178static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
171 struct net_device *indev, struct net_device *outdev, 179 struct net_device *indev, struct net_device *outdev,
172 int (*okfn)(struct sk_buff *)) 180 int (*okfn)(struct sk_buff *))
173{ 181{
@@ -212,14 +220,14 @@ __ret;})
212 NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN) 220 NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, INT_MIN)
213 221
214/* Call setsockopt() */ 222/* Call setsockopt() */
215int nf_setsockopt(struct sock *sk, int pf, int optval, char __user *opt, 223int nf_setsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt,
216 int len); 224 int len);
217int nf_getsockopt(struct sock *sk, int pf, int optval, char __user *opt, 225int nf_getsockopt(struct sock *sk, u_int8_t pf, int optval, char __user *opt,
218 int *len); 226 int *len);
219 227
220int compat_nf_setsockopt(struct sock *sk, int pf, int optval, 228int compat_nf_setsockopt(struct sock *sk, u_int8_t pf, int optval,
221 char __user *opt, int len); 229 char __user *opt, int len);
222int compat_nf_getsockopt(struct sock *sk, int pf, int optval, 230int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval,
223 char __user *opt, int *len); 231 char __user *opt, int *len);
224 232
225/* Call this before modifying an existing packet: ensures it is 233/* Call this before modifying an existing packet: ensures it is
@@ -247,7 +255,7 @@ struct nf_afinfo {
247 int route_key_size; 255 int route_key_size;
248}; 256};
249 257
250extern const struct nf_afinfo *nf_afinfo[NPROTO]; 258extern const struct nf_afinfo *nf_afinfo[NFPROTO_NUMPROTO];
251static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family) 259static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family)
252{ 260{
253 return rcu_dereference(nf_afinfo[family]); 261 return rcu_dereference(nf_afinfo[family]);
@@ -292,7 +300,7 @@ extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo);
292extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); 300extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
293 301
294static inline void 302static inline void
295nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) 303nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
296{ 304{
297#ifdef CONFIG_NF_NAT_NEEDED 305#ifdef CONFIG_NF_NAT_NEEDED
298 void (*decodefn)(struct sk_buff *, struct flowi *); 306 void (*decodefn)(struct sk_buff *, struct flowi *);
@@ -315,7 +323,7 @@ extern struct proc_dir_entry *proc_net_netfilter;
315#else /* !CONFIG_NETFILTER */ 323#else /* !CONFIG_NETFILTER */
316#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) 324#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb)
317#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb) 325#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb)
318static inline int nf_hook_thresh(int pf, unsigned int hook, 326static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
319 struct sk_buff *skb, 327 struct sk_buff *skb,
320 struct net_device *indev, 328 struct net_device *indev,
321 struct net_device *outdev, 329 struct net_device *outdev,
@@ -324,7 +332,7 @@ static inline int nf_hook_thresh(int pf, unsigned int hook,
324{ 332{
325 return okfn(skb); 333 return okfn(skb);
326} 334}
327static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb, 335static inline int nf_hook(u_int8_t pf, unsigned int hook, struct sk_buff *skb,
328 struct net_device *indev, struct net_device *outdev, 336 struct net_device *indev, struct net_device *outdev,
329 int (*okfn)(struct sk_buff *)) 337 int (*okfn)(struct sk_buff *))
330{ 338{
@@ -332,7 +340,9 @@ static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb,
332} 340}
333struct flowi; 341struct flowi;
334static inline void 342static inline void
335nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) {} 343nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
344{
345}
336#endif /*CONFIG_NETFILTER*/ 346#endif /*CONFIG_NETFILTER*/
337 347
338#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 348#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
@@ -343,56 +353,5 @@ extern void (*nf_ct_destroy)(struct nf_conntrack *);
343static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} 353static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
344#endif 354#endif
345 355
346static inline struct net *nf_pre_routing_net(const struct net_device *in,
347 const struct net_device *out)
348{
349#ifdef CONFIG_NET_NS
350 return in->nd_net;
351#else
352 return &init_net;
353#endif
354}
355
356static inline struct net *nf_local_in_net(const struct net_device *in,
357 const struct net_device *out)
358{
359#ifdef CONFIG_NET_NS
360 return in->nd_net;
361#else
362 return &init_net;
363#endif
364}
365
366static inline struct net *nf_forward_net(const struct net_device *in,
367 const struct net_device *out)
368{
369#ifdef CONFIG_NET_NS
370 BUG_ON(in->nd_net != out->nd_net);
371 return in->nd_net;
372#else
373 return &init_net;
374#endif
375}
376
377static inline struct net *nf_local_out_net(const struct net_device *in,
378 const struct net_device *out)
379{
380#ifdef CONFIG_NET_NS
381 return out->nd_net;
382#else
383 return &init_net;
384#endif
385}
386
387static inline struct net *nf_post_routing_net(const struct net_device *in,
388 const struct net_device *out)
389{
390#ifdef CONFIG_NET_NS
391 return out->nd_net;
392#else
393 return &init_net;
394#endif
395}
396
397#endif /*__KERNEL__*/ 356#endif /*__KERNEL__*/
398#endif /*__LINUX_NETFILTER_H*/ 357#endif /*__LINUX_NETFILTER_H*/
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild
index 3aff513d12c8..5a8af875bce2 100644
--- a/include/linux/netfilter/Kbuild
+++ b/include/linux/netfilter/Kbuild
@@ -32,6 +32,7 @@ header-y += xt_owner.h
32header-y += xt_pkttype.h 32header-y += xt_pkttype.h
33header-y += xt_rateest.h 33header-y += xt_rateest.h
34header-y += xt_realm.h 34header-y += xt_realm.h
35header-y += xt_recent.h
35header-y += xt_sctp.h 36header-y += xt_sctp.h
36header-y += xt_state.h 37header-y += xt_state.h
37header-y += xt_statistic.h 38header-y += xt_statistic.h
diff --git a/include/linux/netfilter/nf_conntrack_proto_gre.h b/include/linux/netfilter/nf_conntrack_proto_gre.h
index 535e4219d2bb..2a10efda17fb 100644
--- a/include/linux/netfilter/nf_conntrack_proto_gre.h
+++ b/include/linux/netfilter/nf_conntrack_proto_gre.h
@@ -87,7 +87,7 @@ int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir,
87/* delete keymap entries */ 87/* delete keymap entries */
88void nf_ct_gre_keymap_destroy(struct nf_conn *ct); 88void nf_ct_gre_keymap_destroy(struct nf_conn *ct);
89 89
90extern void nf_ct_gre_keymap_flush(void); 90extern void nf_ct_gre_keymap_flush(struct net *net);
91extern void nf_nat_need_gre(void); 91extern void nf_nat_need_gre(void);
92 92
93#endif /* __KERNEL__ */ 93#endif /* __KERNEL__ */
diff --git a/include/linux/netfilter/nf_conntrack_tcp.h b/include/linux/netfilter/nf_conntrack_tcp.h
index 22ce29995f13..a049df4f2236 100644
--- a/include/linux/netfilter/nf_conntrack_tcp.h
+++ b/include/linux/netfilter/nf_conntrack_tcp.h
@@ -30,6 +30,9 @@ enum tcp_conntrack {
30/* Be liberal in window checking */ 30/* Be liberal in window checking */
31#define IP_CT_TCP_FLAG_BE_LIBERAL 0x08 31#define IP_CT_TCP_FLAG_BE_LIBERAL 0x08
32 32
33/* Has unacknowledged data */
34#define IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED 0x10
35
33struct nf_ct_tcp_flags { 36struct nf_ct_tcp_flags {
34 u_int8_t flags; 37 u_int8_t flags;
35 u_int8_t mask; 38 u_int8_t mask;
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 2326296b6f25..be41b609c88f 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -173,6 +173,98 @@ struct xt_counters_info
173 173
174#include <linux/netdevice.h> 174#include <linux/netdevice.h>
175 175
176/**
177 * struct xt_match_param - parameters for match extensions' match functions
178 *
179 * @in: input netdevice
180 * @out: output netdevice
181 * @match: struct xt_match through which this function was invoked
182 * @matchinfo: per-match data
183 * @fragoff: packet is a fragment, this is the data offset
184 * @thoff: position of transport header relative to skb->data
185 * @hotdrop: drop packet if we had inspection problems
186 * @family: Actual NFPROTO_* through which the function is invoked
187 * (helpful when match->family == NFPROTO_UNSPEC)
188 */
189struct xt_match_param {
190 const struct net_device *in, *out;
191 const struct xt_match *match;
192 const void *matchinfo;
193 int fragoff;
194 unsigned int thoff;
195 bool *hotdrop;
196 u_int8_t family;
197};
198
199/**
200 * struct xt_mtchk_param - parameters for match extensions'
201 * checkentry functions
202 *
203 * @table: table the rule is tried to be inserted into
204 * @entryinfo: the family-specific rule data
205 * (struct ipt_ip, ip6t_ip, ebt_entry)
206 * @match: struct xt_match through which this function was invoked
207 * @matchinfo: per-match data
208 * @hook_mask: via which hooks the new rule is reachable
209 */
210struct xt_mtchk_param {
211 const char *table;
212 const void *entryinfo;
213 const struct xt_match *match;
214 void *matchinfo;
215 unsigned int hook_mask;
216 u_int8_t family;
217};
218
219/* Match destructor parameters */
220struct xt_mtdtor_param {
221 const struct xt_match *match;
222 void *matchinfo;
223 u_int8_t family;
224};
225
226/**
227 * struct xt_target_param - parameters for target extensions' target functions
228 *
229 * @hooknum: hook through which this target was invoked
230 * @target: struct xt_target through which this function was invoked
231 * @targinfo: per-target data
232 *
233 * Other fields see above.
234 */
235struct xt_target_param {
236 const struct net_device *in, *out;
237 unsigned int hooknum;
238 const struct xt_target *target;
239 const void *targinfo;
240 u_int8_t family;
241};
242
243/**
244 * struct xt_tgchk_param - parameters for target extensions'
245 * checkentry functions
246 *
247 * @entryinfo: the family-specific rule data
248 * (struct ipt_entry, ip6t_entry, arpt_entry, ebt_entry)
249 *
250 * Other fields see above.
251 */
252struct xt_tgchk_param {
253 const char *table;
254 void *entryinfo;
255 const struct xt_target *target;
256 void *targinfo;
257 unsigned int hook_mask;
258 u_int8_t family;
259};
260
261/* Target destructor parameters */
262struct xt_tgdtor_param {
263 const struct xt_target *target;
264 void *targinfo;
265 u_int8_t family;
266};
267
176struct xt_match 268struct xt_match
177{ 269{
178 struct list_head list; 270 struct list_head list;
@@ -185,24 +277,13 @@ struct xt_match
185 non-linear skb, using skb_header_pointer and 277 non-linear skb, using skb_header_pointer and
186 skb_ip_make_writable. */ 278 skb_ip_make_writable. */
187 bool (*match)(const struct sk_buff *skb, 279 bool (*match)(const struct sk_buff *skb,
188 const struct net_device *in, 280 const struct xt_match_param *);
189 const struct net_device *out,
190 const struct xt_match *match,
191 const void *matchinfo,
192 int offset,
193 unsigned int protoff,
194 bool *hotdrop);
195 281
196 /* Called when user tries to insert an entry of this type. */ 282 /* Called when user tries to insert an entry of this type. */
197 /* Should return true or false. */ 283 bool (*checkentry)(const struct xt_mtchk_param *);
198 bool (*checkentry)(const char *tablename,
199 const void *ip,
200 const struct xt_match *match,
201 void *matchinfo,
202 unsigned int hook_mask);
203 284
204 /* Called when entry of this type deleted. */ 285 /* Called when entry of this type deleted. */
205 void (*destroy)(const struct xt_match *match, void *matchinfo); 286 void (*destroy)(const struct xt_mtdtor_param *);
206 287
207 /* Called when userspace align differs from kernel space one */ 288 /* Called when userspace align differs from kernel space one */
208 void (*compat_from_user)(void *dst, void *src); 289 void (*compat_from_user)(void *dst, void *src);
@@ -235,24 +316,16 @@ struct xt_target
235 must now handle non-linear skbs, using skb_copy_bits and 316 must now handle non-linear skbs, using skb_copy_bits and
236 skb_ip_make_writable. */ 317 skb_ip_make_writable. */
237 unsigned int (*target)(struct sk_buff *skb, 318 unsigned int (*target)(struct sk_buff *skb,
238 const struct net_device *in, 319 const struct xt_target_param *);
239 const struct net_device *out,
240 unsigned int hooknum,
241 const struct xt_target *target,
242 const void *targinfo);
243 320
244 /* Called when user tries to insert an entry of this type: 321 /* Called when user tries to insert an entry of this type:
245 hook_mask is a bitmask of hooks from which it can be 322 hook_mask is a bitmask of hooks from which it can be
246 called. */ 323 called. */
247 /* Should return true or false. */ 324 /* Should return true or false. */
248 bool (*checkentry)(const char *tablename, 325 bool (*checkentry)(const struct xt_tgchk_param *);
249 const void *entry,
250 const struct xt_target *target,
251 void *targinfo,
252 unsigned int hook_mask);
253 326
254 /* Called when entry of this type deleted. */ 327 /* Called when entry of this type deleted. */
255 void (*destroy)(const struct xt_target *target, void *targinfo); 328 void (*destroy)(const struct xt_tgdtor_param *);
256 329
257 /* Called when userspace align differs from kernel space one */ 330 /* Called when userspace align differs from kernel space one */
258 void (*compat_from_user)(void *dst, void *src); 331 void (*compat_from_user)(void *dst, void *src);
@@ -292,7 +365,7 @@ struct xt_table
292 /* Set this to THIS_MODULE if you are a module, otherwise NULL */ 365 /* Set this to THIS_MODULE if you are a module, otherwise NULL */
293 struct module *me; 366 struct module *me;
294 367
295 int af; /* address/protocol family */ 368 u_int8_t af; /* address/protocol family */
296}; 369};
297 370
298#include <linux/netfilter_ipv4.h> 371#include <linux/netfilter_ipv4.h>
@@ -328,12 +401,10 @@ extern void xt_unregister_match(struct xt_match *target);
328extern int xt_register_matches(struct xt_match *match, unsigned int n); 401extern int xt_register_matches(struct xt_match *match, unsigned int n);
329extern void xt_unregister_matches(struct xt_match *match, unsigned int n); 402extern void xt_unregister_matches(struct xt_match *match, unsigned int n);
330 403
331extern int xt_check_match(const struct xt_match *match, unsigned short family, 404extern int xt_check_match(struct xt_mtchk_param *,
332 unsigned int size, const char *table, unsigned int hook, 405 unsigned int size, u_int8_t proto, bool inv_proto);
333 unsigned short proto, int inv_proto); 406extern int xt_check_target(struct xt_tgchk_param *,
334extern int xt_check_target(const struct xt_target *target, unsigned short family, 407 unsigned int size, u_int8_t proto, bool inv_proto);
335 unsigned int size, const char *table, unsigned int hook,
336 unsigned short proto, int inv_proto);
337 408
338extern struct xt_table *xt_register_table(struct net *net, 409extern struct xt_table *xt_register_table(struct net *net,
339 struct xt_table *table, 410 struct xt_table *table,
@@ -346,19 +417,19 @@ extern struct xt_table_info *xt_replace_table(struct xt_table *table,
346 struct xt_table_info *newinfo, 417 struct xt_table_info *newinfo,
347 int *error); 418 int *error);
348 419
349extern struct xt_match *xt_find_match(int af, const char *name, u8 revision); 420extern struct xt_match *xt_find_match(u8 af, const char *name, u8 revision);
350extern struct xt_target *xt_find_target(int af, const char *name, u8 revision); 421extern struct xt_target *xt_find_target(u8 af, const char *name, u8 revision);
351extern struct xt_target *xt_request_find_target(int af, const char *name, 422extern struct xt_target *xt_request_find_target(u8 af, const char *name,
352 u8 revision); 423 u8 revision);
353extern int xt_find_revision(int af, const char *name, u8 revision, int target, 424extern int xt_find_revision(u8 af, const char *name, u8 revision,
354 int *err); 425 int target, int *err);
355 426
356extern struct xt_table *xt_find_table_lock(struct net *net, int af, 427extern struct xt_table *xt_find_table_lock(struct net *net, u_int8_t af,
357 const char *name); 428 const char *name);
358extern void xt_table_unlock(struct xt_table *t); 429extern void xt_table_unlock(struct xt_table *t);
359 430
360extern int xt_proto_init(struct net *net, int af); 431extern int xt_proto_init(struct net *net, u_int8_t af);
361extern void xt_proto_fini(struct net *net, int af); 432extern void xt_proto_fini(struct net *net, u_int8_t af);
362 433
363extern struct xt_table_info *xt_alloc_table_info(unsigned int size); 434extern struct xt_table_info *xt_alloc_table_info(unsigned int size);
364extern void xt_free_table_info(struct xt_table_info *info); 435extern void xt_free_table_info(struct xt_table_info *info);
@@ -423,12 +494,12 @@ struct compat_xt_counters_info
423#define COMPAT_XT_ALIGN(s) (((s) + (__alignof__(struct compat_xt_counters)-1)) \ 494#define COMPAT_XT_ALIGN(s) (((s) + (__alignof__(struct compat_xt_counters)-1)) \
424 & ~(__alignof__(struct compat_xt_counters)-1)) 495 & ~(__alignof__(struct compat_xt_counters)-1))
425 496
426extern void xt_compat_lock(int af); 497extern void xt_compat_lock(u_int8_t af);
427extern void xt_compat_unlock(int af); 498extern void xt_compat_unlock(u_int8_t af);
428 499
429extern int xt_compat_add_offset(int af, unsigned int offset, short delta); 500extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, short delta);
430extern void xt_compat_flush_offsets(int af); 501extern void xt_compat_flush_offsets(u_int8_t af);
431extern short xt_compat_calc_jump(int af, unsigned int offset); 502extern short xt_compat_calc_jump(u_int8_t af, unsigned int offset);
432 503
433extern int xt_compat_match_offset(const struct xt_match *match); 504extern int xt_compat_match_offset(const struct xt_match *match);
434extern int xt_compat_match_from_user(struct xt_entry_match *m, 505extern int xt_compat_match_from_user(struct xt_entry_match *m,
diff --git a/include/linux/netfilter/xt_TPROXY.h b/include/linux/netfilter/xt_TPROXY.h
new file mode 100644
index 000000000000..152e8f97132b
--- /dev/null
+++ b/include/linux/netfilter/xt_TPROXY.h
@@ -0,0 +1,14 @@
1#ifndef _XT_TPROXY_H_target
2#define _XT_TPROXY_H_target
3
4/* TPROXY target is capable of marking the packet to perform
5 * redirection. We can get rid of that whenever we get support for
6 * mutliple targets in the same rule. */
7struct xt_tproxy_target_info {
8 u_int32_t mark_mask;
9 u_int32_t mark_value;
10 __be32 laddr;
11 __be16 lport;
12};
13
14#endif /* _XT_TPROXY_H_target */
diff --git a/include/linux/netfilter/xt_recent.h b/include/linux/netfilter/xt_recent.h
new file mode 100644
index 000000000000..5cfeb81c6794
--- /dev/null
+++ b/include/linux/netfilter/xt_recent.h
@@ -0,0 +1,26 @@
1#ifndef _LINUX_NETFILTER_XT_RECENT_H
2#define _LINUX_NETFILTER_XT_RECENT_H 1
3
4enum {
5 XT_RECENT_CHECK = 1 << 0,
6 XT_RECENT_SET = 1 << 1,
7 XT_RECENT_UPDATE = 1 << 2,
8 XT_RECENT_REMOVE = 1 << 3,
9 XT_RECENT_TTL = 1 << 4,
10
11 XT_RECENT_SOURCE = 0,
12 XT_RECENT_DEST = 1,
13
14 XT_RECENT_NAME_LEN = 200,
15};
16
17struct xt_recent_mtinfo {
18 u_int32_t seconds;
19 u_int32_t hit_count;
20 u_int8_t check_set;
21 u_int8_t invert;
22 char name[XT_RECENT_NAME_LEN];
23 u_int8_t side;
24};
25
26#endif /* _LINUX_NETFILTER_XT_RECENT_H */
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index 892f5b7771c7..d45e29cd1cfb 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -31,6 +31,9 @@
31 * The 4 lsb are more than enough to store the verdict. */ 31 * The 4 lsb are more than enough to store the verdict. */
32#define EBT_VERDICT_BITS 0x0000000F 32#define EBT_VERDICT_BITS 0x0000000F
33 33
34struct xt_match;
35struct xt_target;
36
34struct ebt_counter 37struct ebt_counter
35{ 38{
36 uint64_t pcnt; 39 uint64_t pcnt;
@@ -121,7 +124,7 @@ struct ebt_entry_match
121{ 124{
122 union { 125 union {
123 char name[EBT_FUNCTION_MAXNAMELEN]; 126 char name[EBT_FUNCTION_MAXNAMELEN];
124 struct ebt_match *match; 127 struct xt_match *match;
125 } u; 128 } u;
126 /* size of data */ 129 /* size of data */
127 unsigned int match_size; 130 unsigned int match_size;
@@ -132,7 +135,7 @@ struct ebt_entry_watcher
132{ 135{
133 union { 136 union {
134 char name[EBT_FUNCTION_MAXNAMELEN]; 137 char name[EBT_FUNCTION_MAXNAMELEN];
135 struct ebt_watcher *watcher; 138 struct xt_target *watcher;
136 } u; 139 } u;
137 /* size of data */ 140 /* size of data */
138 unsigned int watcher_size; 141 unsigned int watcher_size;
@@ -143,7 +146,7 @@ struct ebt_entry_target
143{ 146{
144 union { 147 union {
145 char name[EBT_FUNCTION_MAXNAMELEN]; 148 char name[EBT_FUNCTION_MAXNAMELEN];
146 struct ebt_target *target; 149 struct xt_target *target;
147 } u; 150 } u;
148 /* size of data */ 151 /* size of data */
149 unsigned int target_size; 152 unsigned int target_size;
@@ -207,14 +210,17 @@ struct ebt_match
207{ 210{
208 struct list_head list; 211 struct list_head list;
209 const char name[EBT_FUNCTION_MAXNAMELEN]; 212 const char name[EBT_FUNCTION_MAXNAMELEN];
210 /* 0 == it matches */ 213 bool (*match)(const struct sk_buff *skb, const struct net_device *in,
211 int (*match)(const struct sk_buff *skb, const struct net_device *in, 214 const struct net_device *out, const struct xt_match *match,
212 const struct net_device *out, const void *matchdata, 215 const void *matchinfo, int offset, unsigned int protoff,
213 unsigned int datalen); 216 bool *hotdrop);
214 /* 0 == let it in */ 217 bool (*checkentry)(const char *table, const void *entry,
215 int (*check)(const char *tablename, unsigned int hookmask, 218 const struct xt_match *match, void *matchinfo,
216 const struct ebt_entry *e, void *matchdata, unsigned int datalen); 219 unsigned int hook_mask);
217 void (*destroy)(void *matchdata, unsigned int datalen); 220 void (*destroy)(const struct xt_match *match, void *matchinfo);
221 unsigned int matchsize;
222 u_int8_t revision;
223 u_int8_t family;
218 struct module *me; 224 struct module *me;
219}; 225};
220 226
@@ -222,13 +228,17 @@ struct ebt_watcher
222{ 228{
223 struct list_head list; 229 struct list_head list;
224 const char name[EBT_FUNCTION_MAXNAMELEN]; 230 const char name[EBT_FUNCTION_MAXNAMELEN];
225 void (*watcher)(const struct sk_buff *skb, unsigned int hooknr, 231 unsigned int (*target)(struct sk_buff *skb,
226 const struct net_device *in, const struct net_device *out, 232 const struct net_device *in, const struct net_device *out,
227 const void *watcherdata, unsigned int datalen); 233 unsigned int hook_num, const struct xt_target *target,
228 /* 0 == let it in */ 234 const void *targinfo);
229 int (*check)(const char *tablename, unsigned int hookmask, 235 bool (*checkentry)(const char *table, const void *entry,
230 const struct ebt_entry *e, void *watcherdata, unsigned int datalen); 236 const struct xt_target *target, void *targinfo,
231 void (*destroy)(void *watcherdata, unsigned int datalen); 237 unsigned int hook_mask);
238 void (*destroy)(const struct xt_target *target, void *targinfo);
239 unsigned int targetsize;
240 u_int8_t revision;
241 u_int8_t family;
232 struct module *me; 242 struct module *me;
233}; 243};
234 244
@@ -236,14 +246,18 @@ struct ebt_target
236{ 246{
237 struct list_head list; 247 struct list_head list;
238 const char name[EBT_FUNCTION_MAXNAMELEN]; 248 const char name[EBT_FUNCTION_MAXNAMELEN];
239 /* returns one of the standard verdicts */ 249 /* returns one of the standard EBT_* verdicts */
240 int (*target)(struct sk_buff *skb, unsigned int hooknr, 250 unsigned int (*target)(struct sk_buff *skb,
241 const struct net_device *in, const struct net_device *out, 251 const struct net_device *in, const struct net_device *out,
242 const void *targetdata, unsigned int datalen); 252 unsigned int hook_num, const struct xt_target *target,
243 /* 0 == let it in */ 253 const void *targinfo);
244 int (*check)(const char *tablename, unsigned int hookmask, 254 bool (*checkentry)(const char *table, const void *entry,
245 const struct ebt_entry *e, void *targetdata, unsigned int datalen); 255 const struct xt_target *target, void *targinfo,
246 void (*destroy)(void *targetdata, unsigned int datalen); 256 unsigned int hook_mask);
257 void (*destroy)(const struct xt_target *target, void *targinfo);
258 unsigned int targetsize;
259 u_int8_t revision;
260 u_int8_t family;
247 struct module *me; 261 struct module *me;
248}; 262};
249 263
@@ -288,12 +302,6 @@ struct ebt_table
288 ~(__alignof__(struct ebt_replace)-1)) 302 ~(__alignof__(struct ebt_replace)-1))
289extern int ebt_register_table(struct ebt_table *table); 303extern int ebt_register_table(struct ebt_table *table);
290extern void ebt_unregister_table(struct ebt_table *table); 304extern void ebt_unregister_table(struct ebt_table *table);
291extern int ebt_register_match(struct ebt_match *match);
292extern void ebt_unregister_match(struct ebt_match *match);
293extern int ebt_register_watcher(struct ebt_watcher *watcher);
294extern void ebt_unregister_watcher(struct ebt_watcher *watcher);
295extern int ebt_register_target(struct ebt_target *target);
296extern void ebt_unregister_target(struct ebt_target *target);
297extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb, 305extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb,
298 const struct net_device *in, const struct net_device *out, 306 const struct net_device *in, const struct net_device *out,
299 struct ebt_table *table); 307 struct ebt_table *table);
@@ -302,9 +310,9 @@ extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb,
302#define FWINV(bool,invflg) ((bool) ^ !!(info->invflags & invflg)) 310#define FWINV(bool,invflg) ((bool) ^ !!(info->invflags & invflg))
303/* True if the hook mask denotes that the rule is in a base chain, 311/* True if the hook mask denotes that the rule is in a base chain,
304 * used in the check() functions */ 312 * used in the check() functions */
305#define BASE_CHAIN (hookmask & (1 << NF_BR_NUMHOOKS)) 313#define BASE_CHAIN (par->hook_mask & (1 << NF_BR_NUMHOOKS))
306/* Clear the bit in the hook mask that tells if the rule is on a base chain */ 314/* Clear the bit in the hook mask that tells if the rule is on a base chain */
307#define CLEAR_BASE_CHAIN_BIT (hookmask &= ~(1 << NF_BR_NUMHOOKS)) 315#define CLEAR_BASE_CHAIN_BIT (par->hook_mask &= ~(1 << NF_BR_NUMHOOKS))
308/* True if the target is not a standard target */ 316/* True if the target is not a standard target */
309#define INVALID_TARGET (info->target < -NUM_STANDARD_TARGETS || info->target >= 0) 317#define INVALID_TARGET (info->target < -NUM_STANDARD_TARGETS || info->target >= 0)
310 318
diff --git a/include/linux/netfilter_ipv4/ipt_recent.h b/include/linux/netfilter_ipv4/ipt_recent.h
index 6508a4592651..d636cca133c2 100644
--- a/include/linux/netfilter_ipv4/ipt_recent.h
+++ b/include/linux/netfilter_ipv4/ipt_recent.h
@@ -1,27 +1,21 @@
1#ifndef _IPT_RECENT_H 1#ifndef _IPT_RECENT_H
2#define _IPT_RECENT_H 2#define _IPT_RECENT_H
3 3
4#define RECENT_NAME "ipt_recent" 4#include <linux/netfilter/xt_recent.h>
5#define RECENT_VER "v0.3.1"
6 5
7#define IPT_RECENT_CHECK 1 6#define ipt_recent_info xt_recent_mtinfo
8#define IPT_RECENT_SET 2
9#define IPT_RECENT_UPDATE 4
10#define IPT_RECENT_REMOVE 8
11#define IPT_RECENT_TTL 16
12 7
13#define IPT_RECENT_SOURCE 0 8enum {
14#define IPT_RECENT_DEST 1 9 IPT_RECENT_CHECK = XT_RECENT_CHECK,
10 IPT_RECENT_SET = XT_RECENT_SET,
11 IPT_RECENT_UPDATE = XT_RECENT_UPDATE,
12 IPT_RECENT_REMOVE = XT_RECENT_REMOVE,
13 IPT_RECENT_TTL = XT_RECENT_TTL,
15 14
16#define IPT_RECENT_NAME_LEN 200 15 IPT_RECENT_SOURCE = XT_RECENT_SOURCE,
16 IPT_RECENT_DEST = XT_RECENT_DEST,
17 17
18struct ipt_recent_info { 18 IPT_RECENT_NAME_LEN = XT_RECENT_NAME_LEN,
19 u_int32_t seconds;
20 u_int32_t hit_count;
21 u_int8_t check_set;
22 u_int8_t invert;
23 char name[IPT_RECENT_NAME_LEN];
24 u_int8_t side;
25}; 19};
26 20
27#endif /*_IPT_RECENT_H*/ 21#endif /*_IPT_RECENT_H*/
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 29d261918734..78a5922a2f11 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -42,7 +42,6 @@
42#include <linux/in.h> 42#include <linux/in.h>
43#include <linux/kref.h> 43#include <linux/kref.h>
44#include <linux/mm.h> 44#include <linux/mm.h>
45#include <linux/namei.h>
46#include <linux/pagemap.h> 45#include <linux/pagemap.h>
47#include <linux/rbtree.h> 46#include <linux/rbtree.h>
48#include <linux/rwsem.h> 47#include <linux/rwsem.h>
@@ -332,7 +331,7 @@ extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *);
332extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); 331extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr);
333extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr); 332extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr);
334extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); 333extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
335extern int nfs_permission(struct inode *, int, struct nameidata *); 334extern int nfs_permission(struct inode *, int);
336extern int nfs_open(struct inode *, struct file *); 335extern int nfs_open(struct inode *, struct file *);
337extern int nfs_release(struct inode *, struct file *); 336extern int nfs_release(struct inode *, struct file *);
338extern int nfs_attribute_timeout(struct inode *inode); 337extern int nfs_attribute_timeout(struct inode *inode);
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 2be7c63bc0f2..9bad65400fba 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -89,6 +89,22 @@
89 * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC 89 * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC
90 * or, if no MAC address given, all mesh paths, on the interface identified 90 * or, if no MAC address given, all mesh paths, on the interface identified
91 * by %NL80211_ATTR_IFINDEX. 91 * by %NL80211_ATTR_IFINDEX.
92 * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by
93 * %NL80211_ATTR_IFINDEX.
94 *
95 * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command
96 * after being queried by the kernel. CRDA replies by sending a regulatory
97 * domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our
98 * current alpha2 if it found a match. It also provides
99 * NL80211_ATTR_REG_RULE_FLAGS, and a set of regulatory rules. Each
100 * regulatory rule is a nested set of attributes given by
101 * %NL80211_ATTR_REG_RULE_FREQ_[START|END] and
102 * %NL80211_ATTR_FREQ_RANGE_MAX_BW with an attached power rule given by
103 * %NL80211_ATTR_REG_RULE_POWER_MAX_ANT_GAIN and
104 * %NL80211_ATTR_REG_RULE_POWER_MAX_EIRP.
105 * @NL80211_CMD_REQ_SET_REG: ask the wireless core to set the regulatory domain
106 * 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.
92 * 108 *
93 * @NL80211_CMD_MAX: highest used command number 109 * @NL80211_CMD_MAX: highest used command number
94 * @__NL80211_CMD_AFTER_LAST: internal use 110 * @__NL80211_CMD_AFTER_LAST: internal use
@@ -127,13 +143,23 @@ enum nl80211_commands {
127 NL80211_CMD_NEW_MPATH, 143 NL80211_CMD_NEW_MPATH,
128 NL80211_CMD_DEL_MPATH, 144 NL80211_CMD_DEL_MPATH,
129 145
130 /* add commands here */ 146 NL80211_CMD_SET_BSS,
147
148 NL80211_CMD_SET_REG,
149 NL80211_CMD_REQ_SET_REG,
150
151 /* add new commands above here */
131 152
132 /* used to define NL80211_CMD_MAX below */ 153 /* used to define NL80211_CMD_MAX below */
133 __NL80211_CMD_AFTER_LAST, 154 __NL80211_CMD_AFTER_LAST,
134 NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 155 NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1
135}; 156};
136 157
158/*
159 * Allow user space programs to use #ifdef on new commands by defining them
160 * here
161 */
162#define NL80211_CMD_SET_BSS NL80211_CMD_SET_BSS
137 163
138/** 164/**
139 * enum nl80211_attrs - nl80211 netlink attributes 165 * enum nl80211_attrs - nl80211 netlink attributes
@@ -188,10 +214,34 @@ enum nl80211_commands {
188 * info given for %NL80211_CMD_GET_MPATH, nested attribute described at 214 * info given for %NL80211_CMD_GET_MPATH, nested attribute described at
189 * &enum nl80211_mpath_info. 215 * &enum nl80211_mpath_info.
190 * 216 *
191 *
192 * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of 217 * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of
193 * &enum nl80211_mntr_flags. 218 * &enum nl80211_mntr_flags.
194 * 219 *
220 * @NL80211_ATTR_REG_ALPHA2: an ISO-3166-alpha2 country code for which the
221 * current regulatory domain should be set to or is already set to.
222 * For example, 'CR', for Costa Rica. This attribute is used by the kernel
223 * to query the CRDA to retrieve one regulatory domain. This attribute can
224 * also be used by userspace to query the kernel for the currently set
225 * regulatory domain. We chose an alpha2 as that is also used by the
226 * IEEE-802.11d country information element to identify a country.
227 * Users can also simply ask the wireless core to set regulatory domain
228 * to a specific alpha2.
229 * @NL80211_ATTR_REG_RULES: a nested array of regulatory domain regulatory
230 * rules.
231 *
232 * @NL80211_ATTR_BSS_CTS_PROT: whether CTS protection is enabled (u8, 0 or 1)
233 * @NL80211_ATTR_BSS_SHORT_PREAMBLE: whether short preamble is enabled
234 * (u8, 0 or 1)
235 * @NL80211_ATTR_BSS_SHORT_SLOT_TIME: whether short slot time enabled
236 * (u8, 0 or 1)
237 *
238 * @NL80211_ATTR_HT_CAPABILITY: HT Capability information element (from
239 * association request when used with NL80211_CMD_NEW_STATION)
240 *
241 * @NL80211_ATTR_SUPPORTED_IFTYPES: nested attribute containing all
242 * supported interface types, each a flag attribute with the number
243 * of the interface mode.
244 *
195 * @NL80211_ATTR_MAX: highest attribute number currently defined 245 * @NL80211_ATTR_MAX: highest attribute number currently defined
196 * @__NL80211_ATTR_AFTER_LAST: internal use 246 * @__NL80211_ATTR_AFTER_LAST: internal use
197 */ 247 */
@@ -235,16 +285,35 @@ enum nl80211_attrs {
235 NL80211_ATTR_MPATH_NEXT_HOP, 285 NL80211_ATTR_MPATH_NEXT_HOP,
236 NL80211_ATTR_MPATH_INFO, 286 NL80211_ATTR_MPATH_INFO,
237 287
288 NL80211_ATTR_BSS_CTS_PROT,
289 NL80211_ATTR_BSS_SHORT_PREAMBLE,
290 NL80211_ATTR_BSS_SHORT_SLOT_TIME,
291
292 NL80211_ATTR_HT_CAPABILITY,
293
294 NL80211_ATTR_SUPPORTED_IFTYPES,
295
296 NL80211_ATTR_REG_ALPHA2,
297 NL80211_ATTR_REG_RULES,
298
238 /* add attributes here, update the policy in nl80211.c */ 299 /* add attributes here, update the policy in nl80211.c */
239 300
240 __NL80211_ATTR_AFTER_LAST, 301 __NL80211_ATTR_AFTER_LAST,
241 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 302 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
242}; 303};
243 304
305/*
306 * Allow user space programs to use #ifdef on new attributes by defining them
307 * here
308 */
309#define NL80211_ATTR_HT_CAPABILITY NL80211_ATTR_HT_CAPABILITY
310
244#define NL80211_MAX_SUPP_RATES 32 311#define NL80211_MAX_SUPP_RATES 32
312#define NL80211_MAX_SUPP_REG_RULES 32
245#define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0 313#define NL80211_TKIP_DATA_OFFSET_ENCR_KEY 0
246#define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16 314#define NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY 16
247#define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24 315#define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24
316#define NL80211_HT_CAPABILITY_LEN 26
248 317
249/** 318/**
250 * enum nl80211_iftype - (virtual) interface types 319 * enum nl80211_iftype - (virtual) interface types
@@ -436,6 +505,66 @@ enum nl80211_bitrate_attr {
436}; 505};
437 506
438/** 507/**
508 * enum nl80211_reg_rule_attr - regulatory rule attributes
509 * @NL80211_ATTR_REG_RULE_FLAGS: a set of flags which specify additional
510 * considerations for a given frequency range. These are the
511 * &enum nl80211_reg_rule_flags.
512 * @NL80211_ATTR_FREQ_RANGE_START: starting frequencry for the regulatory
513 * rule in KHz. This is not a center of frequency but an actual regulatory
514 * band edge.
515 * @NL80211_ATTR_FREQ_RANGE_END: ending frequency for the regulatory rule
516 * in KHz. This is not a center a frequency but an actual regulatory
517 * band edge.
518 * @NL80211_ATTR_FREQ_RANGE_MAX_BW: maximum allowed bandwidth for this
519 * frequency range, in KHz.
520 * @NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN: the maximum allowed antenna gain
521 * for a given frequency range. The value is in mBi (100 * dBi).
522 * If you don't have one then don't send this.
523 * @NL80211_ATTR_POWER_RULE_MAX_EIRP: the maximum allowed EIRP for
524 * a given frequency range. The value is in mBm (100 * dBm).
525 */
526enum nl80211_reg_rule_attr {
527 __NL80211_REG_RULE_ATTR_INVALID,
528 NL80211_ATTR_REG_RULE_FLAGS,
529
530 NL80211_ATTR_FREQ_RANGE_START,
531 NL80211_ATTR_FREQ_RANGE_END,
532 NL80211_ATTR_FREQ_RANGE_MAX_BW,
533
534 NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN,
535 NL80211_ATTR_POWER_RULE_MAX_EIRP,
536
537 /* keep last */
538 __NL80211_REG_RULE_ATTR_AFTER_LAST,
539 NL80211_REG_RULE_ATTR_MAX = __NL80211_REG_RULE_ATTR_AFTER_LAST - 1
540};
541
542/**
543 * enum nl80211_reg_rule_flags - regulatory rule flags
544 *
545 * @NL80211_RRF_NO_OFDM: OFDM modulation not allowed
546 * @NL80211_RRF_NO_CCK: CCK modulation not allowed
547 * @NL80211_RRF_NO_INDOOR: indoor operation not allowed
548 * @NL80211_RRF_NO_OUTDOOR: outdoor operation not allowed
549 * @NL80211_RRF_DFS: DFS support is required to be used
550 * @NL80211_RRF_PTP_ONLY: this is only for Point To Point links
551 * @NL80211_RRF_PTMP_ONLY: this is only for Point To Multi Point links
552 * @NL80211_RRF_PASSIVE_SCAN: passive scan is required
553 * @NL80211_RRF_NO_IBSS: no IBSS is allowed
554 */
555enum nl80211_reg_rule_flags {
556 NL80211_RRF_NO_OFDM = 1<<0,
557 NL80211_RRF_NO_CCK = 1<<1,
558 NL80211_RRF_NO_INDOOR = 1<<2,
559 NL80211_RRF_NO_OUTDOOR = 1<<3,
560 NL80211_RRF_DFS = 1<<4,
561 NL80211_RRF_PTP_ONLY = 1<<5,
562 NL80211_RRF_PTMP_ONLY = 1<<6,
563 NL80211_RRF_PASSIVE_SCAN = 1<<7,
564 NL80211_RRF_NO_IBSS = 1<<8,
565};
566
567/**
439 * enum nl80211_mntr_flags - monitor configuration flags 568 * enum nl80211_mntr_flags - monitor configuration flags
440 * 569 *
441 * Monitor configuration flags. 570 * Monitor configuration flags.
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index da2698b0fdd1..b86fa2ffca0c 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -213,9 +213,16 @@ static inline int notifier_to_errno(int ret)
213#define CPU_DOWN_FAILED 0x0006 /* CPU (unsigned)v NOT going down */ 213#define CPU_DOWN_FAILED 0x0006 /* CPU (unsigned)v NOT going down */
214#define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */ 214#define CPU_DEAD 0x0007 /* CPU (unsigned)v dead */
215#define CPU_DYING 0x0008 /* CPU (unsigned)v not running any task, 215#define CPU_DYING 0x0008 /* CPU (unsigned)v not running any task,
216 * not handling interrupts, soon dead */ 216 * not handling interrupts, soon dead.
217 * Called on the dying cpu, interrupts
218 * are already disabled. Must not
219 * sleep, must not fail */
217#define CPU_POST_DEAD 0x0009 /* CPU (unsigned)v dead, cpu_hotplug 220#define CPU_POST_DEAD 0x0009 /* CPU (unsigned)v dead, cpu_hotplug
218 * lock is dropped */ 221 * lock is dropped */
222#define CPU_STARTING 0x000A /* CPU (unsigned)v soon running.
223 * Called on the new cpu, just before
224 * enabling interrupts. Must not sleep,
225 * must not fail */
219 226
220/* Used for CPU hotplug events occuring while tasks are frozen due to a suspend 227/* Used for CPU hotplug events occuring while tasks are frozen due to a suspend
221 * operation in progress 228 * operation in progress
@@ -229,6 +236,7 @@ static inline int notifier_to_errno(int ret)
229#define CPU_DOWN_FAILED_FROZEN (CPU_DOWN_FAILED | CPU_TASKS_FROZEN) 236#define CPU_DOWN_FAILED_FROZEN (CPU_DOWN_FAILED | CPU_TASKS_FROZEN)
230#define CPU_DEAD_FROZEN (CPU_DEAD | CPU_TASKS_FROZEN) 237#define CPU_DEAD_FROZEN (CPU_DEAD | CPU_TASKS_FROZEN)
231#define CPU_DYING_FROZEN (CPU_DYING | CPU_TASKS_FROZEN) 238#define CPU_DYING_FROZEN (CPU_DYING | CPU_TASKS_FROZEN)
239#define CPU_STARTING_FROZEN (CPU_STARTING | CPU_TASKS_FROZEN)
232 240
233/* Hibernation and suspend events */ 241/* Hibernation and suspend events */
234#define PM_HIBERNATION_PREPARE 0x0001 /* Going to hibernate */ 242#define PM_HIBERNATION_PREPARE 0x0001 /* Going to hibernate */
diff --git a/include/linux/of.h b/include/linux/of.h
index 59a61bdc98b6..79886ade070f 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -70,5 +70,6 @@ extern int of_n_addr_cells(struct device_node *np);
70extern int of_n_size_cells(struct device_node *np); 70extern int of_n_size_cells(struct device_node *np);
71extern const struct of_device_id *of_match_node( 71extern const struct of_device_id *of_match_node(
72 const struct of_device_id *matches, const struct device_node *node); 72 const struct of_device_id *matches, const struct device_node *node);
73extern int of_modalias_node(struct device_node *node, char *modalias, int len);
73 74
74#endif /* _LINUX_OF_H */ 75#endif /* _LINUX_OF_H */
diff --git a/include/linux/of_spi.h b/include/linux/of_spi.h
new file mode 100644
index 000000000000..5f71ee8c0868
--- /dev/null
+++ b/include/linux/of_spi.h
@@ -0,0 +1,18 @@
1/*
2 * OpenFirmware SPI support routines
3 * Copyright (C) 2008 Secret Lab Technologies Ltd.
4 *
5 * Support routines for deriving SPI device attachments from the device
6 * tree.
7 */
8
9#ifndef __LINUX_OF_SPI_H
10#define __LINUX_OF_SPI_H
11
12#include <linux/of.h>
13#include <linux/spi/spi.h>
14
15extern void of_register_spi_devices(struct spi_master *master,
16 struct device_node *np);
17
18#endif /* __LINUX_OF_SPI */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 54590a9a103e..c74d3e875314 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -163,7 +163,7 @@ static inline int Page##uname(struct page *page) \
163 163
164struct page; /* forward declaration */ 164struct page; /* forward declaration */
165 165
166PAGEFLAG(Locked, locked) TESTSCFLAG(Locked, locked) 166TESTPAGEFLAG(Locked, locked)
167PAGEFLAG(Error, error) 167PAGEFLAG(Error, error)
168PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced) 168PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced)
169PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty) 169PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty)
@@ -239,9 +239,6 @@ static inline void __SetPageUptodate(struct page *page)
239{ 239{
240 smp_wmb(); 240 smp_wmb();
241 __set_bit(PG_uptodate, &(page)->flags); 241 __set_bit(PG_uptodate, &(page)->flags);
242#ifdef CONFIG_S390
243 page_clear_dirty(page);
244#endif
245} 242}
246 243
247static inline void SetPageUptodate(struct page *page) 244static inline void SetPageUptodate(struct page *page)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index ee1ec2c7723c..5da31c12101c 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -12,6 +12,7 @@
12#include <asm/uaccess.h> 12#include <asm/uaccess.h>
13#include <linux/gfp.h> 13#include <linux/gfp.h>
14#include <linux/bitops.h> 14#include <linux/bitops.h>
15#include <linux/hardirq.h> /* for in_interrupt() */
15 16
16/* 17/*
17 * Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page 18 * Bits in mapping->flags. The lower __GFP_BITS_SHIFT bits are the page
@@ -19,6 +20,7 @@
19 */ 20 */
20#define AS_EIO (__GFP_BITS_SHIFT + 0) /* IO error on async write */ 21#define AS_EIO (__GFP_BITS_SHIFT + 0) /* IO error on async write */
21#define AS_ENOSPC (__GFP_BITS_SHIFT + 1) /* ENOSPC on async write */ 22#define AS_ENOSPC (__GFP_BITS_SHIFT + 1) /* ENOSPC on async write */
23#define AS_MM_ALL_LOCKS (__GFP_BITS_SHIFT + 2) /* under mm_take_all_locks() */
22 24
23static inline void mapping_set_error(struct address_space *mapping, int error) 25static inline void mapping_set_error(struct address_space *mapping, int error)
24{ 26{
@@ -62,6 +64,121 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask)
62#define page_cache_release(page) put_page(page) 64#define page_cache_release(page) put_page(page)
63void release_pages(struct page **pages, int nr, int cold); 65void release_pages(struct page **pages, int nr, int cold);
64 66
67/*
68 * speculatively take a reference to a page.
69 * If the page is free (_count == 0), then _count is untouched, and 0
70 * is returned. Otherwise, _count is incremented by 1 and 1 is returned.
71 *
72 * This function must be called inside the same rcu_read_lock() section as has
73 * been used to lookup the page in the pagecache radix-tree (or page table):
74 * this allows allocators to use a synchronize_rcu() to stabilize _count.
75 *
76 * Unless an RCU grace period has passed, the count of all pages coming out
77 * of the allocator must be considered unstable. page_count may return higher
78 * than expected, and put_page must be able to do the right thing when the
79 * page has been finished with, no matter what it is subsequently allocated
80 * for (because put_page is what is used here to drop an invalid speculative
81 * reference).
82 *
83 * This is the interesting part of the lockless pagecache (and lockless
84 * get_user_pages) locking protocol, where the lookup-side (eg. find_get_page)
85 * has the following pattern:
86 * 1. find page in radix tree
87 * 2. conditionally increment refcount
88 * 3. check the page is still in pagecache (if no, goto 1)
89 *
90 * Remove-side that cares about stability of _count (eg. reclaim) has the
91 * following (with tree_lock held for write):
92 * A. atomically check refcount is correct and set it to 0 (atomic_cmpxchg)
93 * B. remove page from pagecache
94 * C. free the page
95 *
96 * There are 2 critical interleavings that matter:
97 * - 2 runs before A: in this case, A sees elevated refcount and bails out
98 * - A runs before 2: in this case, 2 sees zero refcount and retries;
99 * subsequently, B will complete and 1 will find no page, causing the
100 * lookup to return NULL.
101 *
102 * It is possible that between 1 and 2, the page is removed then the exact same
103 * page is inserted into the same position in pagecache. That's OK: the
104 * old find_get_page using tree_lock could equally have run before or after
105 * such a re-insertion, depending on order that locks are granted.
106 *
107 * Lookups racing against pagecache insertion isn't a big problem: either 1
108 * will find the page or it will not. Likewise, the old find_get_page could run
109 * either before the insertion or afterwards, depending on timing.
110 */
111static inline int page_cache_get_speculative(struct page *page)
112{
113 VM_BUG_ON(in_interrupt());
114
115#if !defined(CONFIG_SMP) && defined(CONFIG_CLASSIC_RCU)
116# ifdef CONFIG_PREEMPT
117 VM_BUG_ON(!in_atomic());
118# endif
119 /*
120 * Preempt must be disabled here - we rely on rcu_read_lock doing
121 * this for us.
122 *
123 * Pagecache won't be truncated from interrupt context, so if we have
124 * found a page in the radix tree here, we have pinned its refcount by
125 * disabling preempt, and hence no need for the "speculative get" that
126 * SMP requires.
127 */
128 VM_BUG_ON(page_count(page) == 0);
129 atomic_inc(&page->_count);
130
131#else
132 if (unlikely(!get_page_unless_zero(page))) {
133 /*
134 * Either the page has been freed, or will be freed.
135 * In either case, retry here and the caller should
136 * do the right thing (see comments above).
137 */
138 return 0;
139 }
140#endif
141 VM_BUG_ON(PageTail(page));
142
143 return 1;
144}
145
146/*
147 * Same as above, but add instead of inc (could just be merged)
148 */
149static inline int page_cache_add_speculative(struct page *page, int count)
150{
151 VM_BUG_ON(in_interrupt());
152
153#if !defined(CONFIG_SMP) && defined(CONFIG_CLASSIC_RCU)
154# ifdef CONFIG_PREEMPT
155 VM_BUG_ON(!in_atomic());
156# endif
157 VM_BUG_ON(page_count(page) == 0);
158 atomic_add(count, &page->_count);
159
160#else
161 if (unlikely(!atomic_add_unless(&page->_count, count, 0)))
162 return 0;
163#endif
164 VM_BUG_ON(PageCompound(page) && page != compound_head(page));
165
166 return 1;
167}
168
169static inline int page_freeze_refs(struct page *page, int count)
170{
171 return likely(atomic_cmpxchg(&page->_count, count, 0) == count);
172}
173
174static inline void page_unfreeze_refs(struct page *page, int count)
175{
176 VM_BUG_ON(page_count(page) != 0);
177 VM_BUG_ON(count == 0);
178
179 atomic_set(&page->_count, count);
180}
181
65#ifdef CONFIG_NUMA 182#ifdef CONFIG_NUMA
66extern struct page *__page_cache_alloc(gfp_t gfp); 183extern struct page *__page_cache_alloc(gfp_t gfp);
67#else 184#else
@@ -133,13 +250,6 @@ static inline struct page *read_mapping_page(struct address_space *mapping,
133 return read_cache_page(mapping, index, filler, data); 250 return read_cache_page(mapping, index, filler, data);
134} 251}
135 252
136int add_to_page_cache(struct page *page, struct address_space *mapping,
137 pgoff_t index, gfp_t gfp_mask);
138int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
139 pgoff_t index, gfp_t gfp_mask);
140extern void remove_from_page_cache(struct page *page);
141extern void __remove_from_page_cache(struct page *page);
142
143/* 253/*
144 * Return byte-offset into filesystem object for page. 254 * Return byte-offset into filesystem object for page.
145 */ 255 */
@@ -161,13 +271,28 @@ extern int __lock_page_killable(struct page *page);
161extern void __lock_page_nosync(struct page *page); 271extern void __lock_page_nosync(struct page *page);
162extern void unlock_page(struct page *page); 272extern void unlock_page(struct page *page);
163 273
274static inline void set_page_locked(struct page *page)
275{
276 set_bit(PG_locked, &page->flags);
277}
278
279static inline void clear_page_locked(struct page *page)
280{
281 clear_bit(PG_locked, &page->flags);
282}
283
284static inline int trylock_page(struct page *page)
285{
286 return !test_and_set_bit(PG_locked, &page->flags);
287}
288
164/* 289/*
165 * lock_page may only be called if we have the page's inode pinned. 290 * lock_page may only be called if we have the page's inode pinned.
166 */ 291 */
167static inline void lock_page(struct page *page) 292static inline void lock_page(struct page *page)
168{ 293{
169 might_sleep(); 294 might_sleep();
170 if (TestSetPageLocked(page)) 295 if (!trylock_page(page))
171 __lock_page(page); 296 __lock_page(page);
172} 297}
173 298
@@ -179,7 +304,7 @@ static inline void lock_page(struct page *page)
179static inline int lock_page_killable(struct page *page) 304static inline int lock_page_killable(struct page *page)
180{ 305{
181 might_sleep(); 306 might_sleep();
182 if (TestSetPageLocked(page)) 307 if (!trylock_page(page))
183 return __lock_page_killable(page); 308 return __lock_page_killable(page);
184 return 0; 309 return 0;
185} 310}
@@ -191,7 +316,7 @@ static inline int lock_page_killable(struct page *page)
191static inline void lock_page_nosync(struct page *page) 316static inline void lock_page_nosync(struct page *page)
192{ 317{
193 might_sleep(); 318 might_sleep();
194 if (TestSetPageLocked(page)) 319 if (!trylock_page(page))
195 __lock_page_nosync(page); 320 __lock_page_nosync(page);
196} 321}
197 322
@@ -276,4 +401,27 @@ static inline int fault_in_pages_readable(const char __user *uaddr, int size)
276 return ret; 401 return ret;
277} 402}
278 403
404int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
405 pgoff_t index, gfp_t gfp_mask);
406int add_to_page_cache_lru(struct page *page, struct address_space *mapping,
407 pgoff_t index, gfp_t gfp_mask);
408extern void remove_from_page_cache(struct page *page);
409extern void __remove_from_page_cache(struct page *page);
410
411/*
412 * Like add_to_page_cache_locked, but used to add newly allocated pages:
413 * the page is new, so we can just run set_page_locked() against it.
414 */
415static inline int add_to_page_cache(struct page *page,
416 struct address_space *mapping, pgoff_t offset, gfp_t gfp_mask)
417{
418 int error;
419
420 set_page_locked(page);
421 error = add_to_page_cache_locked(page, mapping, offset, gfp_mask);
422 if (unlikely(error))
423 clear_page_locked(page);
424 return error;
425}
426
279#endif /* _LINUX_PAGEMAP_H */ 427#endif /* _LINUX_PAGEMAP_H */
diff --git a/include/linux/parport.h b/include/linux/parport.h
index dcb9e01a69ca..6a0d7cdb5774 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -560,5 +560,8 @@ extern int parport_device_proc_unregister(struct pardevice *device);
560 560
561#endif /* !CONFIG_PARPORT_NOT_PC */ 561#endif /* !CONFIG_PARPORT_NOT_PC */
562 562
563extern unsigned long parport_default_timeslice;
564extern int parport_default_spintime;
565
563#endif /* __KERNEL__ */ 566#endif /* __KERNEL__ */
564#endif /* _PARPORT_H_ */ 567#endif /* _PARPORT_H_ */
diff --git a/include/linux/parser.h b/include/linux/parser.h
index cc554ca8bc78..7dcd05075756 100644
--- a/include/linux/parser.h
+++ b/include/linux/parser.h
@@ -14,7 +14,7 @@ struct match_token {
14 const char *pattern; 14 const char *pattern;
15}; 15};
16 16
17typedef const struct match_token match_table_t[]; 17typedef struct match_token match_table_t[];
18 18
19/* Maximum number of arguments that match_token will find in a pattern */ 19/* Maximum number of arguments that match_token will find in a pattern */
20enum {MAX_OPT_ARGS = 3}; 20enum {MAX_OPT_ARGS = 3};
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
index 3ba25065fa96..8837928fbf33 100644
--- a/include/linux/pci-acpi.h
+++ b/include/linux/pci-acpi.h
@@ -57,6 +57,15 @@ static inline acpi_status pcie_osc_support_set(u32 flags)
57{ 57{
58 return __pci_osc_support_set(flags, PCI_EXPRESS_ROOT_HID_STRING); 58 return __pci_osc_support_set(flags, PCI_EXPRESS_ROOT_HID_STRING);
59} 59}
60static inline acpi_handle acpi_find_root_bridge_handle(struct pci_dev *pdev)
61{
62 /* Find root host bridge */
63 while (pdev->bus->self)
64 pdev = pdev->bus->self;
65
66 return acpi_get_pci_rootbridge_handle(pci_domain_nr(pdev->bus),
67 pdev->bus->number);
68}
60#else 69#else
61#if !defined(AE_ERROR) 70#if !defined(AE_ERROR)
62typedef u32 acpi_status; 71typedef u32 acpi_status;
@@ -66,6 +75,8 @@ static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
66{return AE_ERROR;} 75{return AE_ERROR;}
67static inline acpi_status pci_osc_support_set(u32 flags) {return AE_ERROR;} 76static inline acpi_status pci_osc_support_set(u32 flags) {return AE_ERROR;}
68static inline acpi_status pcie_osc_support_set(u32 flags) {return AE_ERROR;} 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)
79{ return NULL; }
69#endif 80#endif
70 81
71#endif /* _PCI_ACPI_H_ */ 82#endif /* _PCI_ACPI_H_ */
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h
index a1a1e618e996..91ba0b338b47 100644
--- a/include/linux/pci-aspm.h
+++ b/include/linux/pci-aspm.h
@@ -27,6 +27,7 @@ extern void pcie_aspm_init_link_state(struct pci_dev *pdev);
27extern void pcie_aspm_exit_link_state(struct pci_dev *pdev); 27extern void pcie_aspm_exit_link_state(struct pci_dev *pdev);
28extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); 28extern void pcie_aspm_pm_state_change(struct pci_dev *pdev);
29extern void pci_disable_link_state(struct pci_dev *pdev, int state); 29extern void pci_disable_link_state(struct pci_dev *pdev, int state);
30extern void pcie_no_aspm(void);
30#else 31#else
31static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) 32static inline void pcie_aspm_init_link_state(struct pci_dev *pdev)
32{ 33{
@@ -40,6 +41,10 @@ static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev)
40static inline void pci_disable_link_state(struct pci_dev *pdev, int state) 41static inline void pci_disable_link_state(struct pci_dev *pdev, int state)
41{ 42{
42} 43}
44
45static inline void pcie_no_aspm(void)
46{
47}
43#endif 48#endif
44 49
45#ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */ 50#ifdef CONFIG_PCIEASPM_DEBUG /* this depends on CONFIG_PCIEASPM */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 1d296d31abe0..98dc6243a706 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -124,6 +124,8 @@ enum pci_dev_flags {
124 * generation too. 124 * generation too.
125 */ 125 */
126 PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1, 126 PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = (__force pci_dev_flags_t) 1,
127 /* Device configuration is irrevocably lost if disabled into D3 */
128 PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2,
127}; 129};
128 130
129typedef unsigned short __bitwise pci_bus_flags_t; 131typedef unsigned short __bitwise pci_bus_flags_t;
@@ -532,7 +534,7 @@ extern void pci_sort_breadthfirst(void);
532#ifdef CONFIG_PCI_LEGACY 534#ifdef CONFIG_PCI_LEGACY
533struct pci_dev __deprecated *pci_find_device(unsigned int vendor, 535struct pci_dev __deprecated *pci_find_device(unsigned int vendor,
534 unsigned int device, 536 unsigned int device,
535 const struct pci_dev *from); 537 struct pci_dev *from);
536struct pci_dev __deprecated *pci_find_slot(unsigned int bus, 538struct pci_dev __deprecated *pci_find_slot(unsigned int bus,
537 unsigned int devfn); 539 unsigned int devfn);
538#endif /* CONFIG_PCI_LEGACY */ 540#endif /* CONFIG_PCI_LEGACY */
@@ -548,7 +550,7 @@ struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device,
548 struct pci_dev *from); 550 struct pci_dev *from);
549struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, 551struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device,
550 unsigned int ss_vendor, unsigned int ss_device, 552 unsigned int ss_vendor, unsigned int ss_device,
551 const struct pci_dev *from); 553 struct pci_dev *from);
552struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); 554struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn);
553struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn); 555struct pci_dev *pci_get_bus_and_slot(unsigned int bus, unsigned int devfn);
554struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); 556struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from);
@@ -639,6 +641,7 @@ int pci_restore_state(struct pci_dev *dev);
639int pci_set_power_state(struct pci_dev *dev, pci_power_t state); 641int pci_set_power_state(struct pci_dev *dev, pci_power_t state);
640pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state); 642pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state);
641bool pci_pme_capable(struct pci_dev *dev, pci_power_t state); 643bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
644void pci_pme_active(struct pci_dev *dev, bool enable);
642int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable); 645int pci_enable_wake(struct pci_dev *dev, pci_power_t state, int enable);
643pci_power_t pci_target_state(struct pci_dev *dev); 646pci_power_t pci_target_state(struct pci_dev *dev);
644int pci_prepare_to_sleep(struct pci_dev *dev); 647int pci_prepare_to_sleep(struct pci_dev *dev);
@@ -678,10 +681,12 @@ void pci_enable_bridges(struct pci_bus *bus);
678/* Proper probing supporting hot-pluggable devices */ 681/* Proper probing supporting hot-pluggable devices */
679int __must_check __pci_register_driver(struct pci_driver *, struct module *, 682int __must_check __pci_register_driver(struct pci_driver *, struct module *,
680 const char *mod_name); 683 const char *mod_name);
681static inline int __must_check pci_register_driver(struct pci_driver *driver) 684
682{ 685/*
683 return __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); 686 * pci_register_driver must be a macro so that KBUILD_MODNAME can be expanded
684} 687 */
688#define pci_register_driver(driver) \
689 __pci_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
685 690
686void pci_unregister_driver(struct pci_driver *dev); 691void pci_unregister_driver(struct pci_driver *dev);
687void pci_remove_behind_bridge(struct pci_dev *dev); 692void pci_remove_behind_bridge(struct pci_dev *dev);
@@ -811,7 +816,7 @@ _PCI_NOP_ALL(write,)
811 816
812static inline struct pci_dev *pci_find_device(unsigned int vendor, 817static inline struct pci_dev *pci_find_device(unsigned int vendor,
813 unsigned int device, 818 unsigned int device,
814 const struct pci_dev *from) 819 struct pci_dev *from)
815{ 820{
816 return NULL; 821 return NULL;
817} 822}
@@ -833,7 +838,7 @@ static inline struct pci_dev *pci_get_subsys(unsigned int vendor,
833 unsigned int device, 838 unsigned int device,
834 unsigned int ss_vendor, 839 unsigned int ss_vendor,
835 unsigned int ss_device, 840 unsigned int ss_device,
836 const struct pci_dev *from) 841 struct pci_dev *from)
837{ 842{
838 return NULL; 843 return NULL;
839} 844}
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 917d48e5ea06..f63b5455801c 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -502,6 +502,11 @@
502#define PCI_DEVICE_ID_AMD_10H_NB_DRAM 0x1202 502#define PCI_DEVICE_ID_AMD_10H_NB_DRAM 0x1202
503#define PCI_DEVICE_ID_AMD_10H_NB_MISC 0x1203 503#define PCI_DEVICE_ID_AMD_10H_NB_MISC 0x1203
504#define PCI_DEVICE_ID_AMD_10H_NB_LINK 0x1204 504#define PCI_DEVICE_ID_AMD_10H_NB_LINK 0x1204
505#define PCI_DEVICE_ID_AMD_11H_NB_HT 0x1300
506#define PCI_DEVICE_ID_AMD_11H_NB_MAP 0x1301
507#define PCI_DEVICE_ID_AMD_11H_NB_DRAM 0x1302
508#define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303
509#define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304
505#define PCI_DEVICE_ID_AMD_LANCE 0x2000 510#define PCI_DEVICE_ID_AMD_LANCE 0x2000
506#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001 511#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001
507#define PCI_DEVICE_ID_AMD_SCSI 0x2020 512#define PCI_DEVICE_ID_AMD_SCSI 0x2020
@@ -753,6 +758,7 @@
753#define PCI_VENDOR_ID_TI 0x104c 758#define PCI_VENDOR_ID_TI 0x104c
754#define PCI_DEVICE_ID_TI_TVP4020 0x3d07 759#define PCI_DEVICE_ID_TI_TVP4020 0x3d07
755#define PCI_DEVICE_ID_TI_4450 0x8011 760#define PCI_DEVICE_ID_TI_4450 0x8011
761#define PCI_DEVICE_ID_TI_TSB43AB22 0x8023
756#define PCI_DEVICE_ID_TI_XX21_XX11 0x8031 762#define PCI_DEVICE_ID_TI_XX21_XX11 0x8031
757#define PCI_DEVICE_ID_TI_XX21_XX11_FM 0x8033 763#define PCI_DEVICE_ID_TI_XX21_XX11_FM 0x8033
758#define PCI_DEVICE_ID_TI_XX21_XX11_SD 0x8034 764#define PCI_DEVICE_ID_TI_XX21_XX11_SD 0x8034
@@ -1415,6 +1421,8 @@
1415#define PCI_DEVICE_ID_EICON_MAESTRAQ_U 0xe013 1421#define PCI_DEVICE_ID_EICON_MAESTRAQ_U 0xe013
1416#define PCI_DEVICE_ID_EICON_MAESTRAP 0xe014 1422#define PCI_DEVICE_ID_EICON_MAESTRAP 0xe014
1417 1423
1424#define PCI_VENDOR_ID_CISCO 0x1137
1425
1418#define PCI_VENDOR_ID_ZIATECH 0x1138 1426#define PCI_VENDOR_ID_ZIATECH 0x1138
1419#define PCI_DEVICE_ID_ZIATECH_5550_HC 0x5550 1427#define PCI_DEVICE_ID_ZIATECH_5550_HC 0x5550
1420 1428
@@ -1837,7 +1845,13 @@
1837#define PCI_DEVICE_ID_MOXA_C320 0x3200 1845#define PCI_DEVICE_ID_MOXA_C320 0x3200
1838 1846
1839#define PCI_VENDOR_ID_CCD 0x1397 1847#define PCI_VENDOR_ID_CCD 0x1397
1848#define PCI_DEVICE_ID_CCD_HFC4S 0x08B4
1849#define PCI_SUBDEVICE_ID_CCD_PMX2S 0x1234
1850#define PCI_DEVICE_ID_CCD_HFC8S 0x16B8
1840#define PCI_DEVICE_ID_CCD_2BD0 0x2bd0 1851#define PCI_DEVICE_ID_CCD_2BD0 0x2bd0
1852#define PCI_DEVICE_ID_CCD_HFCE1 0x30B1
1853#define PCI_SUBDEVICE_ID_CCD_SPD4S 0x3136
1854#define PCI_SUBDEVICE_ID_CCD_SPDE1 0x3137
1841#define PCI_DEVICE_ID_CCD_B000 0xb000 1855#define PCI_DEVICE_ID_CCD_B000 0xb000
1842#define PCI_DEVICE_ID_CCD_B006 0xb006 1856#define PCI_DEVICE_ID_CCD_B006 0xb006
1843#define PCI_DEVICE_ID_CCD_B007 0xb007 1857#define PCI_DEVICE_ID_CCD_B007 0xb007
@@ -1847,8 +1861,32 @@
1847#define PCI_DEVICE_ID_CCD_B00B 0xb00b 1861#define PCI_DEVICE_ID_CCD_B00B 0xb00b
1848#define PCI_DEVICE_ID_CCD_B00C 0xb00c 1862#define PCI_DEVICE_ID_CCD_B00C 0xb00c
1849#define PCI_DEVICE_ID_CCD_B100 0xb100 1863#define PCI_DEVICE_ID_CCD_B100 0xb100
1864#define PCI_SUBDEVICE_ID_CCD_IOB4ST 0xB520
1865#define PCI_SUBDEVICE_ID_CCD_IOB8STR 0xB521
1866#define PCI_SUBDEVICE_ID_CCD_IOB8ST 0xB522
1867#define PCI_SUBDEVICE_ID_CCD_IOB1E1 0xB523
1868#define PCI_SUBDEVICE_ID_CCD_SWYX4S 0xB540
1869#define PCI_SUBDEVICE_ID_CCD_JH4S20 0xB550
1870#define PCI_SUBDEVICE_ID_CCD_IOB8ST_1 0xB552
1871#define PCI_SUBDEVICE_ID_CCD_BN4S 0xB560
1872#define PCI_SUBDEVICE_ID_CCD_BN8S 0xB562
1873#define PCI_SUBDEVICE_ID_CCD_BNE1 0xB563
1874#define PCI_SUBDEVICE_ID_CCD_BNE1D 0xB564
1875#define PCI_SUBDEVICE_ID_CCD_BNE1DP 0xB565
1876#define PCI_SUBDEVICE_ID_CCD_BN2S 0xB566
1877#define PCI_SUBDEVICE_ID_CCD_BN1SM 0xB567
1878#define PCI_SUBDEVICE_ID_CCD_BN4SM 0xB568
1879#define PCI_SUBDEVICE_ID_CCD_BN2SM 0xB569
1880#define PCI_SUBDEVICE_ID_CCD_BNE1M 0xB56A
1881#define PCI_SUBDEVICE_ID_CCD_BN8SP 0xB56B
1882#define PCI_SUBDEVICE_ID_CCD_HFC4S 0xB620
1883#define PCI_SUBDEVICE_ID_CCD_HFC8S 0xB622
1850#define PCI_DEVICE_ID_CCD_B700 0xb700 1884#define PCI_DEVICE_ID_CCD_B700 0xb700
1851#define PCI_DEVICE_ID_CCD_B701 0xb701 1885#define PCI_DEVICE_ID_CCD_B701 0xb701
1886#define PCI_SUBDEVICE_ID_CCD_HFCE1 0xC523
1887#define PCI_SUBDEVICE_ID_CCD_OV2S 0xE884
1888#define PCI_SUBDEVICE_ID_CCD_OV4S 0xE888
1889#define PCI_SUBDEVICE_ID_CCD_OV8S 0xE998
1852 1890
1853#define PCI_VENDOR_ID_EXAR 0x13a8 1891#define PCI_VENDOR_ID_EXAR 0x13a8
1854#define PCI_DEVICE_ID_EXAR_XR17C152 0x0152 1892#define PCI_DEVICE_ID_EXAR_XR17C152 0x0152
@@ -2151,8 +2189,6 @@
2151#define PCI_DEVICE_ID_HERC_WIN 0x5732 2189#define PCI_DEVICE_ID_HERC_WIN 0x5732
2152#define PCI_DEVICE_ID_HERC_UNI 0x5832 2190#define PCI_DEVICE_ID_HERC_UNI 0x5832
2153 2191
2154#define PCI_VENDOR_ID_RDC 0x17f3
2155
2156#define PCI_VENDOR_ID_SITECOM 0x182d 2192#define PCI_VENDOR_ID_SITECOM 0x182d
2157#define PCI_DEVICE_ID_SITECOM_DC105V2 0x3069 2193#define PCI_DEVICE_ID_SITECOM_DC105V2 0x3069
2158 2194
@@ -2189,6 +2225,7 @@
2189 2225
2190#define PCI_VENDOR_ID_ATTANSIC 0x1969 2226#define PCI_VENDOR_ID_ATTANSIC 0x1969
2191#define PCI_DEVICE_ID_ATTANSIC_L1 0x1048 2227#define PCI_DEVICE_ID_ATTANSIC_L1 0x1048
2228#define PCI_DEVICE_ID_ATTANSIC_L2 0x2048
2192 2229
2193#define PCI_VENDOR_ID_JMICRON 0x197B 2230#define PCI_VENDOR_ID_JMICRON 0x197B
2194#define PCI_DEVICE_ID_JMICRON_JMB360 0x2360 2231#define PCI_DEVICE_ID_JMICRON_JMB360 0x2360
@@ -2220,6 +2257,16 @@
2220#define PCI_DEVICE_ID_3DLABS_PERMEDIA2 0x0007 2257#define PCI_DEVICE_ID_3DLABS_PERMEDIA2 0x0007
2221#define PCI_DEVICE_ID_3DLABS_PERMEDIA2V 0x0009 2258#define PCI_DEVICE_ID_3DLABS_PERMEDIA2V 0x0009
2222 2259
2260#define PCI_VENDOR_ID_NETXEN 0x4040
2261#define PCI_DEVICE_ID_NX2031_10GXSR 0x0001
2262#define PCI_DEVICE_ID_NX2031_10GCX4 0x0002
2263#define PCI_DEVICE_ID_NX2031_4GCU 0x0003
2264#define PCI_DEVICE_ID_NX2031_IMEZ 0x0004
2265#define PCI_DEVICE_ID_NX2031_HMEZ 0x0005
2266#define PCI_DEVICE_ID_NX2031_XG_MGMT 0x0024
2267#define PCI_DEVICE_ID_NX2031_XG_MGMT2 0x0025
2268#define PCI_DEVICE_ID_NX3031 0x0100
2269
2223#define PCI_VENDOR_ID_AKS 0x416c 2270#define PCI_VENDOR_ID_AKS 0x416c
2224#define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100 2271#define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100
2225 2272
@@ -2404,6 +2451,9 @@
2404#define PCI_DEVICE_ID_INTEL_ICH10_3 0x3a1a 2451#define PCI_DEVICE_ID_INTEL_ICH10_3 0x3a1a
2405#define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30 2452#define PCI_DEVICE_ID_INTEL_ICH10_4 0x3a30
2406#define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60 2453#define PCI_DEVICE_ID_INTEL_ICH10_5 0x3a60
2454#define PCI_DEVICE_ID_INTEL_PCH_0 0x3b10
2455#define PCI_DEVICE_ID_INTEL_PCH_1 0x3b11
2456#define PCI_DEVICE_ID_INTEL_PCH_2 0x3b30
2407#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f 2457#define PCI_DEVICE_ID_INTEL_IOAT_SNB 0x402f
2408#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0 2458#define PCI_DEVICE_ID_INTEL_5100_16 0x65f0
2409#define PCI_DEVICE_ID_INTEL_5100_21 0x65f5 2459#define PCI_DEVICE_ID_INTEL_5100_21 0x65f5
@@ -2528,6 +2578,9 @@
2528 2578
2529#define PCI_VENDOR_ID_3COM_2 0xa727 2579#define PCI_VENDOR_ID_3COM_2 0xa727
2530 2580
2581#define PCI_VENDOR_ID_DIGIUM 0xd161
2582#define PCI_DEVICE_ID_DIGIUM_HFC4S 0xb410
2583
2531#define PCI_SUBVENDOR_ID_EXSYS 0xd84d 2584#define PCI_SUBVENDOR_ID_EXSYS 0xd84d
2532#define PCI_SUBDEVICE_ID_EXSYS_4014 0x4014 2585#define PCI_SUBDEVICE_ID_EXSYS_4014 0x4014
2533#define PCI_SUBDEVICE_ID_EXSYS_4055 0x4055 2586#define PCI_SUBDEVICE_ID_EXSYS_4055 0x4055
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index 19958b929905..450684f7eaac 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -374,6 +374,7 @@
374#define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */ 374#define PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */
375#define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */ 375#define PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */
376#define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */ 376#define PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */
377#define PCI_EXP_DEVCAP_RBER 0x8000 /* Role-Based Error Reporting */
377#define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */ 378#define PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */
378#define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */ 379#define PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */
379#define PCI_EXP_DEVCTL 8 /* Device Control */ 380#define PCI_EXP_DEVCTL 8 /* Device Control */
diff --git a/include/linux/percpu.h b/include/linux/percpu.h
index 4cdd393e71e1..9f2a3751873a 100644
--- a/include/linux/percpu.h
+++ b/include/linux/percpu.h
@@ -23,12 +23,19 @@
23 __attribute__((__section__(SHARED_ALIGNED_SECTION))) \ 23 __attribute__((__section__(SHARED_ALIGNED_SECTION))) \
24 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name \ 24 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name \
25 ____cacheline_aligned_in_smp 25 ____cacheline_aligned_in_smp
26
27#define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \
28 __attribute__((__section__(".data.percpu.page_aligned"))) \
29 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
26#else 30#else
27#define DEFINE_PER_CPU(type, name) \ 31#define DEFINE_PER_CPU(type, name) \
28 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name 32 PER_CPU_ATTRIBUTES __typeof__(type) per_cpu__##name
29 33
30#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \ 34#define DEFINE_PER_CPU_SHARED_ALIGNED(type, name) \
31 DEFINE_PER_CPU(type, name) 35 DEFINE_PER_CPU(type, name)
36
37#define DEFINE_PER_CPU_PAGE_ALIGNED(type, name) \
38 DEFINE_PER_CPU(type, name)
32#endif 39#endif
33 40
34#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) 41#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
@@ -74,11 +81,6 @@ struct percpu_data {
74 (__typeof__(ptr))__p->ptrs[(cpu)]; \ 81 (__typeof__(ptr))__p->ptrs[(cpu)]; \
75}) 82})
76 83
77extern void *percpu_populate(void *__pdata, size_t size, gfp_t gfp, int cpu);
78extern void percpu_depopulate(void *__pdata, int cpu);
79extern int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp,
80 cpumask_t *mask);
81extern void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask);
82extern void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask); 84extern void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask);
83extern void percpu_free(void *__pdata); 85extern void percpu_free(void *__pdata);
84 86
@@ -86,26 +88,6 @@ extern void percpu_free(void *__pdata);
86 88
87#define percpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) 89#define percpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); })
88 90
89static inline void percpu_depopulate(void *__pdata, int cpu)
90{
91}
92
93static inline void __percpu_depopulate_mask(void *__pdata, cpumask_t *mask)
94{
95}
96
97static inline void *percpu_populate(void *__pdata, size_t size, gfp_t gfp,
98 int cpu)
99{
100 return percpu_ptr(__pdata, cpu);
101}
102
103static inline int __percpu_populate_mask(void *__pdata, size_t size, gfp_t gfp,
104 cpumask_t *mask)
105{
106 return 0;
107}
108
109static __always_inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask) 91static __always_inline void *__percpu_alloc_mask(size_t size, gfp_t gfp, cpumask_t *mask)
110{ 92{
111 return kzalloc(size, gfp); 93 return kzalloc(size, gfp);
@@ -118,10 +100,6 @@ static inline void percpu_free(void *__pdata)
118 100
119#endif /* CONFIG_SMP */ 101#endif /* CONFIG_SMP */
120 102
121#define percpu_populate_mask(__pdata, size, gfp, mask) \
122 __percpu_populate_mask((__pdata), (size), (gfp), &(mask))
123#define percpu_depopulate_mask(__pdata, mask) \
124 __percpu_depopulate_mask((__pdata), &(mask))
125#define percpu_alloc_mask(size, gfp, mask) \ 103#define percpu_alloc_mask(size, gfp, mask) \
126 __percpu_alloc_mask((size), (gfp), &(mask)) 104 __percpu_alloc_mask((size), (gfp), &(mask))
127 105
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index 208388835357..9007ccdfc112 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -35,7 +35,7 @@ int percpu_counter_init_irq(struct percpu_counter *fbc, s64 amount);
35void percpu_counter_destroy(struct percpu_counter *fbc); 35void percpu_counter_destroy(struct percpu_counter *fbc);
36void percpu_counter_set(struct percpu_counter *fbc, s64 amount); 36void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
37void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); 37void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch);
38s64 __percpu_counter_sum(struct percpu_counter *fbc, int set); 38s64 __percpu_counter_sum(struct percpu_counter *fbc);
39 39
40static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount) 40static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount)
41{ 41{
@@ -44,19 +44,13 @@ static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount)
44 44
45static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc) 45static inline s64 percpu_counter_sum_positive(struct percpu_counter *fbc)
46{ 46{
47 s64 ret = __percpu_counter_sum(fbc, 0); 47 s64 ret = __percpu_counter_sum(fbc);
48 return ret < 0 ? 0 : ret; 48 return ret < 0 ? 0 : ret;
49} 49}
50 50
51static inline s64 percpu_counter_sum_and_set(struct percpu_counter *fbc)
52{
53 return __percpu_counter_sum(fbc, 1);
54}
55
56
57static inline s64 percpu_counter_sum(struct percpu_counter *fbc) 51static inline s64 percpu_counter_sum(struct percpu_counter *fbc)
58{ 52{
59 return __percpu_counter_sum(fbc, 0); 53 return __percpu_counter_sum(fbc);
60} 54}
61 55
62static inline s64 percpu_counter_read(struct percpu_counter *fbc) 56static inline s64 percpu_counter_read(struct percpu_counter *fbc)
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h
index 700725ddcaae..01b262959f2e 100644
--- a/include/linux/pfkeyv2.h
+++ b/include/linux/pfkeyv2.h
@@ -226,6 +226,15 @@ struct sadb_x_sec_ctx {
226} __attribute__((packed)); 226} __attribute__((packed));
227/* sizeof(struct sadb_sec_ctx) = 8 */ 227/* sizeof(struct sadb_sec_ctx) = 8 */
228 228
229/* Used by MIGRATE to pass addresses IKE will use to perform
230 * negotiation with the peer */
231struct sadb_x_kmaddress {
232 uint16_t sadb_x_kmaddress_len;
233 uint16_t sadb_x_kmaddress_exttype;
234 uint32_t sadb_x_kmaddress_reserved;
235} __attribute__((packed));
236/* sizeof(struct sadb_x_kmaddress) == 8 */
237
229/* Message types */ 238/* Message types */
230#define SADB_RESERVED 0 239#define SADB_RESERVED 0
231#define SADB_GETSPI 1 240#define SADB_GETSPI 1
@@ -346,7 +355,9 @@ struct sadb_x_sec_ctx {
346#define SADB_X_EXT_NAT_T_DPORT 22 355#define SADB_X_EXT_NAT_T_DPORT 22
347#define SADB_X_EXT_NAT_T_OA 23 356#define SADB_X_EXT_NAT_T_OA 23
348#define SADB_X_EXT_SEC_CTX 24 357#define SADB_X_EXT_SEC_CTX 24
349#define SADB_EXT_MAX 24 358/* Used with MIGRATE to pass @ to IKE for negotiation */
359#define SADB_X_EXT_KMADDRESS 25
360#define SADB_EXT_MAX 25
350 361
351/* Identity Extension values */ 362/* Identity Extension values */
352#define SADB_IDENTTYPE_RESERVED 0 363#define SADB_IDENTTYPE_RESERVED 0
diff --git a/include/linux/phonet.h b/include/linux/phonet.h
new file mode 100644
index 000000000000..c9609f9aedac
--- /dev/null
+++ b/include/linux/phonet.h
@@ -0,0 +1,170 @@
1/**
2 * file phonet.h
3 *
4 * Phonet sockets kernel interface
5 *
6 * Copyright (C) 2008 Nokia Corporation. All rights reserved.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 */
22
23#ifndef LINUX_PHONET_H
24#define LINUX_PHONET_H
25
26/* Automatic protocol selection */
27#define PN_PROTO_TRANSPORT 0
28/* Phonet datagram socket */
29#define PN_PROTO_PHONET 1
30/* Phonet pipe */
31#define PN_PROTO_PIPE 2
32#define PHONET_NPROTO 3
33
34/* Socket options for SOL_PNPIPE level */
35#define PNPIPE_ENCAP 1
36#define PNPIPE_IFINDEX 2
37
38#define PNADDR_ANY 0
39#define PNPORT_RESOURCE_ROUTING 0
40
41/* Values for PNPIPE_ENCAP option */
42#define PNPIPE_ENCAP_NONE 0
43#define PNPIPE_ENCAP_IP 1
44
45/* ioctls */
46#define SIOCPNGETOBJECT (SIOCPROTOPRIVATE + 0)
47
48/* Phonet protocol header */
49struct phonethdr {
50 __u8 pn_rdev;
51 __u8 pn_sdev;
52 __u8 pn_res;
53 __be16 pn_length;
54 __u8 pn_robj;
55 __u8 pn_sobj;
56} __attribute__((packed));
57
58/* Common Phonet payload header */
59struct phonetmsg {
60 __u8 pn_trans_id; /* transaction ID */
61 __u8 pn_msg_id; /* message type */
62 union {
63 struct {
64 __u8 pn_submsg_id; /* message subtype */
65 __u8 pn_data[5];
66 } base;
67 struct {
68 __u16 pn_e_res_id; /* extended resource ID */
69 __u8 pn_e_submsg_id; /* message subtype */
70 __u8 pn_e_data[3];
71 } ext;
72 } pn_msg_u;
73};
74#define PN_COMMON_MESSAGE 0xF0
75#define PN_PREFIX 0xE0 /* resource for extended messages */
76#define pn_submsg_id pn_msg_u.base.pn_submsg_id
77#define pn_e_submsg_id pn_msg_u.ext.pn_e_submsg_id
78#define pn_e_res_id pn_msg_u.ext.pn_e_res_id
79#define pn_data pn_msg_u.base.pn_data
80#define pn_e_data pn_msg_u.ext.pn_e_data
81
82/* data for unreachable errors */
83#define PN_COMM_SERVICE_NOT_IDENTIFIED_RESP 0x01
84#define PN_COMM_ISA_ENTITY_NOT_REACHABLE_RESP 0x14
85#define pn_orig_msg_id pn_data[0]
86#define pn_status pn_data[1]
87#define pn_e_orig_msg_id pn_e_data[0]
88#define pn_e_status pn_e_data[1]
89
90/* Phonet socket address structure */
91struct sockaddr_pn {
92 sa_family_t spn_family;
93 __u8 spn_obj;
94 __u8 spn_dev;
95 __u8 spn_resource;
96 __u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3];
97} __attribute__ ((packed));
98
99static inline __u16 pn_object(__u8 addr, __u16 port)
100{
101 return (addr << 8) | (port & 0x3ff);
102}
103
104static inline __u8 pn_obj(__u16 handle)
105{
106 return handle & 0xff;
107}
108
109static inline __u8 pn_dev(__u16 handle)
110{
111 return handle >> 8;
112}
113
114static inline __u16 pn_port(__u16 handle)
115{
116 return handle & 0x3ff;
117}
118
119static inline __u8 pn_addr(__u16 handle)
120{
121 return (handle >> 8) & 0xfc;
122}
123
124static inline void pn_sockaddr_set_addr(struct sockaddr_pn *spn, __u8 addr)
125{
126 spn->spn_dev &= 0x03;
127 spn->spn_dev |= addr & 0xfc;
128}
129
130static inline void pn_sockaddr_set_port(struct sockaddr_pn *spn, __u16 port)
131{
132 spn->spn_dev &= 0xfc;
133 spn->spn_dev |= (port >> 8) & 0x03;
134 spn->spn_obj = port & 0xff;
135}
136
137static inline void pn_sockaddr_set_object(struct sockaddr_pn *spn,
138 __u16 handle)
139{
140 spn->spn_dev = pn_dev(handle);
141 spn->spn_obj = pn_obj(handle);
142}
143
144static inline void pn_sockaddr_set_resource(struct sockaddr_pn *spn,
145 __u8 resource)
146{
147 spn->spn_resource = resource;
148}
149
150static inline __u8 pn_sockaddr_get_addr(const struct sockaddr_pn *spn)
151{
152 return spn->spn_dev & 0xfc;
153}
154
155static inline __u16 pn_sockaddr_get_port(const struct sockaddr_pn *spn)
156{
157 return ((spn->spn_dev & 0x03) << 8) | spn->spn_obj;
158}
159
160static inline __u16 pn_sockaddr_get_object(const struct sockaddr_pn *spn)
161{
162 return pn_object(spn->spn_dev, spn->spn_obj);
163}
164
165static inline __u8 pn_sockaddr_get_resource(const struct sockaddr_pn *spn)
166{
167 return spn->spn_resource;
168}
169
170#endif
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 7224c4099a28..77c4ed60b982 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -99,7 +99,14 @@ struct mii_bus {
99 */ 99 */
100 struct mutex mdio_lock; 100 struct mutex mdio_lock;
101 101
102 struct device *dev; 102 struct device *parent;
103 enum {
104 MDIOBUS_ALLOCATED = 1,
105 MDIOBUS_REGISTERED,
106 MDIOBUS_UNREGISTERED,
107 MDIOBUS_RELEASED,
108 } state;
109 struct device dev;
103 110
104 /* list of all PHYs on bus */ 111 /* list of all PHYs on bus */
105 struct phy_device *phy_map[PHY_MAX_ADDR]; 112 struct phy_device *phy_map[PHY_MAX_ADDR];
@@ -113,6 +120,16 @@ struct mii_bus {
113 */ 120 */
114 int *irq; 121 int *irq;
115}; 122};
123#define to_mii_bus(d) container_of(d, struct mii_bus, dev)
124
125struct mii_bus *mdiobus_alloc(void);
126int mdiobus_register(struct mii_bus *bus);
127void mdiobus_unregister(struct mii_bus *bus);
128void mdiobus_free(struct mii_bus *bus);
129struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr);
130int mdiobus_read(struct mii_bus *bus, int addr, u16 regnum);
131int mdiobus_write(struct mii_bus *bus, int addr, u16 regnum, u16 val);
132
116 133
117#define PHY_INTERRUPT_DISABLED 0x0 134#define PHY_INTERRUPT_DISABLED 0x0
118#define PHY_INTERRUPT_ENABLED 0x80000000 135#define PHY_INTERRUPT_ENABLED 0x80000000
@@ -391,8 +408,35 @@ struct phy_fixup {
391 int (*run)(struct phy_device *phydev); 408 int (*run)(struct phy_device *phydev);
392}; 409};
393 410
394int phy_read(struct phy_device *phydev, u16 regnum); 411/**
395int phy_write(struct phy_device *phydev, u16 regnum, u16 val); 412 * phy_read - Convenience function for reading a given PHY register
413 * @phydev: the phy_device struct
414 * @regnum: register number to read
415 *
416 * NOTE: MUST NOT be called from interrupt context,
417 * because the bus read/write functions may wait for an interrupt
418 * to conclude the operation.
419 */
420static inline int phy_read(struct phy_device *phydev, u16 regnum)
421{
422 return mdiobus_read(phydev->bus, phydev->addr, regnum);
423}
424
425/**
426 * phy_write - Convenience function for writing a given PHY register
427 * @phydev: the phy_device struct
428 * @regnum: register number to write
429 * @val: value to write to @regnum
430 *
431 * NOTE: MUST NOT be called from interrupt context,
432 * because the bus read/write functions may wait for an interrupt
433 * to conclude the operation.
434 */
435static inline int phy_write(struct phy_device *phydev, u16 regnum, u16 val)
436{
437 return mdiobus_write(phydev->bus, phydev->addr, regnum, val);
438}
439
396int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id); 440int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id);
397struct phy_device* get_phy_device(struct mii_bus *bus, int addr); 441struct phy_device* get_phy_device(struct mii_bus *bus, int addr);
398int phy_clear_interrupt(struct phy_device *phydev); 442int phy_clear_interrupt(struct phy_device *phydev);
@@ -408,8 +452,6 @@ void phy_start(struct phy_device *phydev);
408void phy_stop(struct phy_device *phydev); 452void phy_stop(struct phy_device *phydev);
409int phy_start_aneg(struct phy_device *phydev); 453int phy_start_aneg(struct phy_device *phydev);
410 454
411int mdiobus_register(struct mii_bus *bus);
412void mdiobus_unregister(struct mii_bus *bus);
413void phy_sanitize_settings(struct phy_device *phydev); 455void phy_sanitize_settings(struct phy_device *phydev);
414int phy_stop_interrupts(struct phy_device *phydev); 456int phy_stop_interrupts(struct phy_device *phydev);
415int phy_enable_interrupts(struct phy_device *phydev); 457int phy_enable_interrupts(struct phy_device *phydev);
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 22921ac4cfd9..d7e98ff8021e 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -161,4 +161,13 @@ pid_t pid_vnr(struct pid *pid);
161 } \ 161 } \
162 } while (0) 162 } while (0)
163 163
164#define do_each_pid_thread(pid, type, task) \
165 do_each_pid_task(pid, type, task) { \
166 struct task_struct *tg___ = task; \
167 do {
168
169#define while_each_pid_thread(pid, type, task) \
170 } while_each_thread(tg___, task); \
171 task = tg___; \
172 } while_each_pid_task(pid, type, task)
164#endif /* _LINUX_PID_H */ 173#endif /* _LINUX_PID_H */
diff --git a/include/linux/pim.h b/include/linux/pim.h
index 236ffd317394..1ba0661561a4 100644
--- a/include/linux/pim.h
+++ b/include/linux/pim.h
@@ -3,22 +3,6 @@
3 3
4#include <asm/byteorder.h> 4#include <asm/byteorder.h>
5 5
6#ifndef __KERNEL__
7struct pim {
8#if defined(__LITTLE_ENDIAN_BITFIELD)
9 __u8 pim_type:4, /* PIM message type */
10 pim_ver:4; /* PIM version */
11#elif defined(__BIG_ENDIAN_BITFIELD)
12 __u8 pim_ver:4; /* PIM version */
13 pim_type:4; /* PIM message type */
14#endif
15 __u8 pim_rsv; /* Reserved */
16 __be16 pim_cksum; /* Checksum */
17};
18
19#define PIM_MINLEN 8
20#endif
21
22/* Message types - V1 */ 6/* Message types - V1 */
23#define PIM_V1_VERSION __constant_htonl(0x10000000) 7#define PIM_V1_VERSION __constant_htonl(0x10000000)
24#define PIM_V1_REGISTER 1 8#define PIM_V1_REGISTER 1
@@ -27,7 +11,6 @@ struct pim {
27#define PIM_VERSION 2 11#define PIM_VERSION 2
28#define PIM_REGISTER 1 12#define PIM_REGISTER 1
29 13
30#if defined(__KERNEL__)
31#define PIM_NULL_REGISTER __constant_htonl(0x40000000) 14#define PIM_NULL_REGISTER __constant_htonl(0x40000000)
32 15
33/* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */ 16/* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */
@@ -42,4 +25,3 @@ struct pimreghdr
42struct sk_buff; 25struct sk_buff;
43extern int pim_rcv_v1(struct sk_buff *); 26extern int pim_rcv_v1(struct sk_buff *);
44#endif 27#endif
45#endif
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index e5de421ac7b4..5d921fa91a5b 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -123,6 +123,13 @@ struct tc_prio_qopt
123 __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */ 123 __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */
124}; 124};
125 125
126/* MULTIQ section */
127
128struct tc_multiq_qopt {
129 __u16 bands; /* Number of bands */
130 __u16 max_bands; /* Maximum number of queues */
131};
132
126/* TBF section */ 133/* TBF section */
127 134
128struct tc_tbf_qopt 135struct tc_tbf_qopt
diff --git a/include/linux/pm_qos_params.h b/include/linux/pm_qos_params.h
index 2e4e97bd19f7..d74f75ed1e47 100644
--- a/include/linux/pm_qos_params.h
+++ b/include/linux/pm_qos_params.h
@@ -1,6 +1,6 @@
1/* interface for the pm_qos_power infrastructure of the linux kernel. 1/* interface for the pm_qos_power infrastructure of the linux kernel.
2 * 2 *
3 * Mark Gross 3 * Mark Gross <mgross@linux.intel.com>
4 */ 4 */
5#include <linux/list.h> 5#include <linux/list.h>
6#include <linux/notifier.h> 6#include <linux/notifier.h>
diff --git a/include/linux/pnp.h b/include/linux/pnp.h
index 1ce54b63085d..be764e514e35 100644
--- a/include/linux/pnp.h
+++ b/include/linux/pnp.h
@@ -21,7 +21,14 @@ struct pnp_dev;
21/* 21/*
22 * Resource Management 22 * Resource Management
23 */ 23 */
24#ifdef CONFIG_PNP
24struct resource *pnp_get_resource(struct pnp_dev *, unsigned int, unsigned int); 25struct resource *pnp_get_resource(struct pnp_dev *, unsigned int, unsigned int);
26#else
27static inline struct resource *pnp_get_resource(struct pnp_dev *dev, unsigned int type, unsigned int num)
28{
29 return NULL;
30}
31#endif
25 32
26static inline int pnp_resource_valid(struct resource *res) 33static inline int pnp_resource_valid(struct resource *res)
27{ 34{
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 68ed19ccf1f7..ea96ead1d39d 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -78,6 +78,7 @@ enum power_supply_property {
78 POWER_SUPPLY_PROP_CHARGE_EMPTY, 78 POWER_SUPPLY_PROP_CHARGE_EMPTY,
79 POWER_SUPPLY_PROP_CHARGE_NOW, 79 POWER_SUPPLY_PROP_CHARGE_NOW,
80 POWER_SUPPLY_PROP_CHARGE_AVG, 80 POWER_SUPPLY_PROP_CHARGE_AVG,
81 POWER_SUPPLY_PROP_CHARGE_COUNTER,
81 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, 82 POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN,
82 POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN, 83 POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN,
83 POWER_SUPPLY_PROP_ENERGY_FULL, 84 POWER_SUPPLY_PROP_ENERGY_FULL,
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index f560d1705afe..fb61850d1cfc 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -282,11 +282,16 @@ union proc_op {
282 struct task_struct *task); 282 struct task_struct *task);
283}; 283};
284 284
285struct ctl_table_header;
286struct ctl_table;
287
285struct proc_inode { 288struct proc_inode {
286 struct pid *pid; 289 struct pid *pid;
287 int fd; 290 int fd;
288 union proc_op op; 291 union proc_op op;
289 struct proc_dir_entry *pde; 292 struct proc_dir_entry *pde;
293 struct ctl_table_header *sysctl;
294 struct ctl_table *sysctl_entry;
290 struct inode vfs_inode; 295 struct inode vfs_inode;
291}; 296};
292 297
diff --git a/include/linux/proportions.h b/include/linux/proportions.h
index 5afc1b23346d..cf793bbbd05e 100644
--- a/include/linux/proportions.h
+++ b/include/linux/proportions.h
@@ -104,8 +104,8 @@ struct prop_local_single {
104 * snapshot of the last seen global state 104 * snapshot of the last seen global state
105 * and a lock protecting this state 105 * and a lock protecting this state
106 */ 106 */
107 int shift;
108 unsigned long period; 107 unsigned long period;
108 int shift;
109 spinlock_t lock; /* protect the snapshot state */ 109 spinlock_t lock; /* protect the snapshot state */
110}; 110};
111 111
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
index c6f5f9dd0cee..ea7416c901d1 100644
--- a/include/linux/ptrace.h
+++ b/include/linux/ptrace.h
@@ -121,6 +121,74 @@ static inline void ptrace_unlink(struct task_struct *child)
121int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data); 121int generic_ptrace_peekdata(struct task_struct *tsk, long addr, long data);
122int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data); 122int generic_ptrace_pokedata(struct task_struct *tsk, long addr, long data);
123 123
124/**
125 * task_ptrace - return %PT_* flags that apply to a task
126 * @task: pointer to &task_struct in question
127 *
128 * Returns the %PT_* flags that apply to @task.
129 */
130static inline int task_ptrace(struct task_struct *task)
131{
132 return task->ptrace;
133}
134
135/**
136 * ptrace_event - possibly stop for a ptrace event notification
137 * @mask: %PT_* bit to check in @current->ptrace
138 * @event: %PTRACE_EVENT_* value to report if @mask is set
139 * @message: value for %PTRACE_GETEVENTMSG to return
140 *
141 * This checks the @mask bit to see if ptrace wants stops for this event.
142 * If so we stop, reporting @event and @message to the ptrace parent.
143 *
144 * Returns nonzero if we did a ptrace notification, zero if not.
145 *
146 * Called without locks.
147 */
148static inline int ptrace_event(int mask, int event, unsigned long message)
149{
150 if (mask && likely(!(current->ptrace & mask)))
151 return 0;
152 current->ptrace_message = message;
153 ptrace_notify((event << 8) | SIGTRAP);
154 return 1;
155}
156
157/**
158 * ptrace_init_task - initialize ptrace state for a new child
159 * @child: new child task
160 * @ptrace: true if child should be ptrace'd by parent's tracer
161 *
162 * This is called immediately after adding @child to its parent's children
163 * list. @ptrace is false in the normal case, and true to ptrace @child.
164 *
165 * Called with current's siglock and write_lock_irq(&tasklist_lock) held.
166 */
167static inline void ptrace_init_task(struct task_struct *child, bool ptrace)
168{
169 INIT_LIST_HEAD(&child->ptrace_entry);
170 INIT_LIST_HEAD(&child->ptraced);
171 child->parent = child->real_parent;
172 child->ptrace = 0;
173 if (unlikely(ptrace)) {
174 child->ptrace = current->ptrace;
175 ptrace_link(child, current->parent);
176 }
177}
178
179/**
180 * ptrace_release_task - final ptrace-related cleanup of a zombie being reaped
181 * @task: task in %EXIT_DEAD state
182 *
183 * Called with write_lock(&tasklist_lock) held.
184 */
185static inline void ptrace_release_task(struct task_struct *task)
186{
187 BUG_ON(!list_empty(&task->ptraced));
188 ptrace_unlink(task);
189 BUG_ON(!list_empty(&task->ptrace_entry));
190}
191
124#ifndef force_successful_syscall_return 192#ifndef force_successful_syscall_return
125/* 193/*
126 * System call handlers that, upon successful completion, need to return a 194 * System call handlers that, upon successful completion, need to return a
@@ -246,6 +314,10 @@ static inline void user_enable_block_step(struct task_struct *task)
246#define arch_ptrace_stop(code, info) do { } while (0) 314#define arch_ptrace_stop(code, info) do { } while (0)
247#endif 315#endif
248 316
317extern int task_current_syscall(struct task_struct *target, long *callno,
318 unsigned long args[6], unsigned int maxargs,
319 unsigned long *sp, unsigned long *pc);
320
249#endif 321#endif
250 322
251#endif 323#endif
diff --git a/include/linux/quicklist.h b/include/linux/quicklist.h
index 39b66713a0bb..bd466439c588 100644
--- a/include/linux/quicklist.h
+++ b/include/linux/quicklist.h
@@ -80,6 +80,13 @@ void quicklist_trim(int nr, void (*dtor)(void *),
80 80
81unsigned long quicklist_total_size(void); 81unsigned long quicklist_total_size(void);
82 82
83#else
84
85static inline unsigned long quicklist_total_size(void)
86{
87 return 0;
88}
89
83#endif 90#endif
84 91
85#endif /* LINUX_QUICKLIST_H */ 92#endif /* LINUX_QUICKLIST_H */
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 742187f7a05c..ca6b9b5c8d52 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -43,6 +43,8 @@ int dquot_mark_dquot_dirty(struct dquot *dquot);
43 43
44int vfs_quota_on(struct super_block *sb, int type, int format_id, 44int vfs_quota_on(struct super_block *sb, int type, int format_id,
45 char *path, int remount); 45 char *path, int remount);
46int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
47 struct path *path);
46int vfs_quota_on_mount(struct super_block *sb, char *qf_name, 48int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
47 int format_id, int type); 49 int format_id, int type);
48int vfs_quota_off(struct super_block *sb, int type, int remount); 50int vfs_quota_off(struct super_block *sb, int type, int remount);
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index b8ce2b444bb5..a916c6660dfa 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -99,12 +99,15 @@ do { \
99 * 99 *
100 * The notable exceptions to this rule are the following functions: 100 * The notable exceptions to this rule are the following functions:
101 * radix_tree_lookup 101 * radix_tree_lookup
102 * radix_tree_lookup_slot
102 * radix_tree_tag_get 103 * radix_tree_tag_get
103 * radix_tree_gang_lookup 104 * radix_tree_gang_lookup
105 * radix_tree_gang_lookup_slot
104 * radix_tree_gang_lookup_tag 106 * radix_tree_gang_lookup_tag
107 * radix_tree_gang_lookup_tag_slot
105 * radix_tree_tagged 108 * radix_tree_tagged
106 * 109 *
107 * The first 4 functions are able to be called locklessly, using RCU. The 110 * The first 7 functions are able to be called locklessly, using RCU. The
108 * caller must ensure calls to these functions are made within rcu_read_lock() 111 * caller must ensure calls to these functions are made within rcu_read_lock()
109 * regions. Other readers (lock-free or otherwise) and modifications may be 112 * regions. Other readers (lock-free or otherwise) and modifications may be
110 * running concurrently. 113 * running concurrently.
@@ -159,6 +162,9 @@ void *radix_tree_delete(struct radix_tree_root *, unsigned long);
159unsigned int 162unsigned int
160radix_tree_gang_lookup(struct radix_tree_root *root, void **results, 163radix_tree_gang_lookup(struct radix_tree_root *root, void **results,
161 unsigned long first_index, unsigned int max_items); 164 unsigned long first_index, unsigned int max_items);
165unsigned int
166radix_tree_gang_lookup_slot(struct radix_tree_root *root, void ***results,
167 unsigned long first_index, unsigned int max_items);
162unsigned long radix_tree_next_hole(struct radix_tree_root *root, 168unsigned long radix_tree_next_hole(struct radix_tree_root *root,
163 unsigned long index, unsigned long max_scan); 169 unsigned long index, unsigned long max_scan);
164int radix_tree_preload(gfp_t gfp_mask); 170int radix_tree_preload(gfp_t gfp_mask);
@@ -173,6 +179,10 @@ unsigned int
173radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, 179radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results,
174 unsigned long first_index, unsigned int max_items, 180 unsigned long first_index, unsigned int max_items,
175 unsigned int tag); 181 unsigned int tag);
182unsigned int
183radix_tree_gang_lookup_tag_slot(struct radix_tree_root *root, void ***results,
184 unsigned long first_index, unsigned int max_items,
185 unsigned int tag);
176int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag); 186int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag);
177 187
178static inline void radix_tree_preload_end(void) 188static inline void radix_tree_preload_end(void)
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index 9f2549ac0e2d..c200b9a34aff 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -128,6 +128,7 @@ struct mddev_s
128#define MD_CHANGE_DEVS 0 /* Some device status has changed */ 128#define MD_CHANGE_DEVS 0 /* Some device status has changed */
129#define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */ 129#define MD_CHANGE_CLEAN 1 /* transition to or from 'clean' */
130#define MD_CHANGE_PENDING 2 /* superblock update in progress */ 130#define MD_CHANGE_PENDING 2 /* superblock update in progress */
131#define MD_NOTIFY_ARRAY_STATE 3 /* atomic context wants to notify userspace */
131 132
132 int ro; 133 int ro;
133 134
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index b160fb18e8d6..37aaf2b39863 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -6,6 +6,7 @@ extern int ramfs_get_sb(struct file_system_type *fs_type,
6 int flags, const char *dev_name, void *data, struct vfsmount *mnt); 6 int flags, const char *dev_name, void *data, struct vfsmount *mnt);
7 7
8#ifndef CONFIG_MMU 8#ifndef CONFIG_MMU
9extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize);
9extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file, 10extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
10 unsigned long addr, 11 unsigned long addr,
11 unsigned long len, 12 unsigned long len,
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h
index 8c774905dcfe..5f89b62e6983 100644
--- a/include/linux/rcuclassic.h
+++ b/include/linux/rcuclassic.h
@@ -40,12 +40,21 @@
40#include <linux/cpumask.h> 40#include <linux/cpumask.h>
41#include <linux/seqlock.h> 41#include <linux/seqlock.h>
42 42
43#ifdef CONFIG_RCU_CPU_STALL_DETECTOR
44#define RCU_SECONDS_TILL_STALL_CHECK ( 3 * HZ) /* for rcp->jiffies_stall */
45#define RCU_SECONDS_TILL_STALL_RECHECK (30 * HZ) /* for rcp->jiffies_stall */
46#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
43 47
44/* Global control variables for rcupdate callback mechanism. */ 48/* Global control variables for rcupdate callback mechanism. */
45struct rcu_ctrlblk { 49struct rcu_ctrlblk {
46 long cur; /* Current batch number. */ 50 long cur; /* Current batch number. */
47 long completed; /* Number of the last completed batch */ 51 long completed; /* Number of the last completed batch */
48 int next_pending; /* Is the next batch already waiting? */ 52 long pending; /* Number of the last pending batch */
53#ifdef CONFIG_RCU_CPU_STALL_DETECTOR
54 unsigned long gp_start; /* Time at which GP started in jiffies. */
55 unsigned long jiffies_stall;
56 /* Time at which to check for CPU stalls. */
57#endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
49 58
50 int signaled; 59 int signaled;
51 60
@@ -66,11 +75,7 @@ static inline int rcu_batch_after(long a, long b)
66 return (a - b) > 0; 75 return (a - b) > 0;
67} 76}
68 77
69/* 78/* Per-CPU data for Read-Copy UPdate. */
70 * Per-CPU data for Read-Copy UPdate.
71 * nxtlist - new callbacks are added here
72 * curlist - current batch for which quiescent cycle started if any
73 */
74struct rcu_data { 79struct rcu_data {
75 /* 1) quiescent state handling : */ 80 /* 1) quiescent state handling : */
76 long quiescbatch; /* Batch # for grace period */ 81 long quiescbatch; /* Batch # for grace period */
@@ -78,12 +83,24 @@ struct rcu_data {
78 int qs_pending; /* core waits for quiesc state */ 83 int qs_pending; /* core waits for quiesc state */
79 84
80 /* 2) batch handling */ 85 /* 2) batch handling */
81 long batch; /* Batch # for current RCU batch */ 86 /*
87 * if nxtlist is not NULL, then:
88 * batch:
89 * The batch # for the last entry of nxtlist
90 * [*nxttail[1], NULL = *nxttail[2]):
91 * Entries that batch # <= batch
92 * [*nxttail[0], *nxttail[1]):
93 * Entries that batch # <= batch - 1
94 * [nxtlist, *nxttail[0]):
95 * Entries that batch # <= batch - 2
96 * The grace period for these entries has completed, and
97 * the other grace-period-completed entries may be moved
98 * here temporarily in rcu_process_callbacks().
99 */
100 long batch;
82 struct rcu_head *nxtlist; 101 struct rcu_head *nxtlist;
83 struct rcu_head **nxttail; 102 struct rcu_head **nxttail[3];
84 long qlen; /* # of queued callbacks */ 103 long qlen; /* # of queued callbacks */
85 struct rcu_head *curlist;
86 struct rcu_head **curtail;
87 struct rcu_head *donelist; 104 struct rcu_head *donelist;
88 struct rcu_head **donetail; 105 struct rcu_head **donetail;
89 long blimit; /* Upper limit on a processed batch */ 106 long blimit; /* Upper limit on a processed batch */
@@ -117,7 +134,7 @@ extern int rcu_needs_cpu(int cpu);
117#ifdef CONFIG_DEBUG_LOCK_ALLOC 134#ifdef CONFIG_DEBUG_LOCK_ALLOC
118extern struct lockdep_map rcu_lock_map; 135extern struct lockdep_map rcu_lock_map;
119# define rcu_read_acquire() \ 136# define rcu_read_acquire() \
120 lock_acquire(&rcu_lock_map, 0, 0, 2, 1, _THIS_IP_) 137 lock_acquire(&rcu_lock_map, 0, 0, 2, 1, NULL, _THIS_IP_)
121# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_) 138# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_)
122#else 139#else
123# define rcu_read_acquire() do { } while (0) 140# define rcu_read_acquire() do { } while (0)
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index b0f39be08b6c..e649bd3f2c97 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -98,6 +98,34 @@ static inline void list_del_rcu(struct list_head *entry)
98} 98}
99 99
100/** 100/**
101 * hlist_del_init_rcu - deletes entry from hash list with re-initialization
102 * @n: the element to delete from the hash list.
103 *
104 * Note: list_unhashed() on the node return true after this. It is
105 * useful for RCU based read lockfree traversal if the writer side
106 * must know if the list entry is still hashed or already unhashed.
107 *
108 * In particular, it means that we can not poison the forward pointers
109 * that may still be used for walking the hash list and we can only
110 * zero the pprev pointer so list_unhashed() will return true after
111 * this.
112 *
113 * The caller must take whatever precautions are necessary (such as
114 * holding appropriate locks) to avoid racing with another
115 * list-mutation primitive, such as hlist_add_head_rcu() or
116 * hlist_del_rcu(), running on this same list. However, it is
117 * perfectly legal to run concurrently with the _rcu list-traversal
118 * primitives, such as hlist_for_each_entry_rcu().
119 */
120static inline void hlist_del_init_rcu(struct hlist_node *n)
121{
122 if (!hlist_unhashed(n)) {
123 __hlist_del(n);
124 n->pprev = NULL;
125 }
126}
127
128/**
101 * list_replace_rcu - replace old entry by new one 129 * list_replace_rcu - replace old entry by new one
102 * @old : the element to be replaced 130 * @old : the element to be replaced
103 * @new : the new element to insert 131 * @new : the new element to insert
@@ -170,20 +198,6 @@ static inline void list_splice_init_rcu(struct list_head *list,
170 at->prev = last; 198 at->prev = last;
171} 199}
172 200
173/**
174 * list_for_each_rcu - iterate over an rcu-protected list
175 * @pos: the &struct list_head to use as a loop cursor.
176 * @head: the head for your list.
177 *
178 * This list-traversal primitive may safely run concurrently with
179 * the _rcu list-mutation primitives such as list_add_rcu()
180 * as long as the traversal is guarded by rcu_read_lock().
181 */
182#define list_for_each_rcu(pos, head) \
183 for (pos = rcu_dereference((head)->next); \
184 prefetch(pos->next), pos != (head); \
185 pos = rcu_dereference(pos->next))
186
187#define __list_for_each_rcu(pos, head) \ 201#define __list_for_each_rcu(pos, head) \
188 for (pos = rcu_dereference((head)->next); \ 202 for (pos = rcu_dereference((head)->next); \
189 pos != (head); \ 203 pos != (head); \
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index e8b4039cfb2f..86f1f5e43e33 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -133,6 +133,26 @@ struct rcu_head {
133#define rcu_read_unlock_bh() __rcu_read_unlock_bh() 133#define rcu_read_unlock_bh() __rcu_read_unlock_bh()
134 134
135/** 135/**
136 * rcu_read_lock_sched - mark the beginning of a RCU-classic critical section
137 *
138 * Should be used with either
139 * - synchronize_sched()
140 * or
141 * - call_rcu_sched() and rcu_barrier_sched()
142 * on the write-side to insure proper synchronization.
143 */
144#define rcu_read_lock_sched() preempt_disable()
145
146/*
147 * rcu_read_unlock_sched - marks the end of a RCU-classic critical section
148 *
149 * See rcu_read_lock_sched for more information.
150 */
151#define rcu_read_unlock_sched() preempt_enable()
152
153
154
155/**
136 * rcu_dereference - fetch an RCU-protected pointer in an 156 * rcu_dereference - fetch an RCU-protected pointer in an
137 * RCU read-side critical section. This pointer may later 157 * RCU read-side critical section. This pointer may later
138 * be safely dereferenced. 158 * be safely dereferenced.
diff --git a/include/linux/rcupreempt.h b/include/linux/rcupreempt.h
index 0967f03b0705..3e05c09b54a2 100644
--- a/include/linux/rcupreempt.h
+++ b/include/linux/rcupreempt.h
@@ -57,7 +57,13 @@ static inline void rcu_qsctr_inc(int cpu)
57 rdssp->sched_qs++; 57 rdssp->sched_qs++;
58} 58}
59#define rcu_bh_qsctr_inc(cpu) 59#define rcu_bh_qsctr_inc(cpu)
60#define call_rcu_bh(head, rcu) call_rcu(head, rcu) 60
61/*
62 * Someone might want to pass call_rcu_bh as a function pointer.
63 * So this needs to just be a rename and not a macro function.
64 * (no parentheses)
65 */
66#define call_rcu_bh call_rcu
61 67
62/** 68/**
63 * call_rcu_sched - Queue RCU callback for invocation after sched grace period. 69 * call_rcu_sched - Queue RCU callback for invocation after sched grace period.
@@ -111,7 +117,6 @@ extern struct rcupreempt_trace *rcupreempt_trace_cpu(int cpu);
111struct softirq_action; 117struct softirq_action;
112 118
113#ifdef CONFIG_NO_HZ 119#ifdef CONFIG_NO_HZ
114DECLARE_PER_CPU(struct rcu_dyntick_sched, rcu_dyntick_sched);
115 120
116static inline void rcu_enter_nohz(void) 121static inline void rcu_enter_nohz(void)
117{ 122{
@@ -126,8 +131,8 @@ static inline void rcu_exit_nohz(void)
126{ 131{
127 static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1); 132 static DEFINE_RATELIMIT_STATE(rs, 10 * HZ, 1);
128 133
129 smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */
130 __get_cpu_var(rcu_dyntick_sched).dynticks++; 134 __get_cpu_var(rcu_dyntick_sched).dynticks++;
135 smp_mb(); /* CPUs seeing ++ must see later RCU read-side crit sects */
131 WARN_ON_RATELIMIT(!(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1), 136 WARN_ON_RATELIMIT(!(__get_cpu_var(rcu_dyntick_sched).dynticks & 0x1),
132 &rs); 137 &rs);
133} 138}
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index b93b541cf111..988e55fe649b 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -59,6 +59,7 @@ extern void machine_crash_shutdown(struct pt_regs *);
59 * Architecture independent implemenations of sys_reboot commands. 59 * Architecture independent implemenations of sys_reboot commands.
60 */ 60 */
61 61
62extern void kernel_restart_prepare(char *cmd);
62extern void kernel_restart(char *cmd); 63extern void kernel_restart(char *cmd);
63extern void kernel_halt(void); 64extern void kernel_halt(void);
64extern void kernel_power_off(void); 65extern void kernel_power_off(void);
diff --git a/include/linux/regulator/bq24022.h b/include/linux/regulator/bq24022.h
new file mode 100644
index 000000000000..e84b0a9feda5
--- /dev/null
+++ b/include/linux/regulator/bq24022.h
@@ -0,0 +1,21 @@
1/*
2 * Support for TI bq24022 (bqTINY-II) Dual Input (USB/AC Adpater)
3 * 1-Cell Li-Ion Charger connected via GPIOs.
4 *
5 * Copyright (c) 2008 Philipp Zabel
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12
13/**
14 * bq24022_mach_info - platform data for bq24022
15 * @gpio_nce: GPIO line connected to the nCE pin, used to enable / disable charging
16 * @gpio_iset2: GPIO line connected to the ISET2 pin, used to limit charging current to 100 mA / 500 mA
17 */
18struct bq24022_mach_info {
19 int gpio_nce;
20 int gpio_iset2;
21};
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
new file mode 100644
index 000000000000..afdc4558bb94
--- /dev/null
+++ b/include/linux/regulator/consumer.h
@@ -0,0 +1,284 @@
1/*
2 * consumer.h -- SoC Regulator consumer support.
3 *
4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
5 *
6 * Author: Liam Girdwood <lg@opensource.wolfsonmicro.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 * Regulator Consumer Interface.
13 *
14 * A Power Management Regulator framework for SoC based devices.
15 * Features:-
16 * o Voltage and current level control.
17 * o Operating mode control.
18 * o Regulator status.
19 * o sysfs entries for showing client devices and status
20 *
21 * EXPERIMENTAL FEATURES:
22 * Dynamic Regulator operating Mode Switching (DRMS) - allows regulators
23 * to use most efficient operating mode depending upon voltage and load and
24 * is transparent to client drivers.
25 *
26 * e.g. Devices x,y,z share regulator r. Device x and y draw 20mA each during
27 * IO and 1mA at idle. Device z draws 100mA when under load and 5mA when
28 * idling. Regulator r has > 90% efficiency in NORMAL mode at loads > 100mA
29 * but this drops rapidly to 60% when below 100mA. Regulator r has > 90%
30 * efficiency in IDLE mode at loads < 10mA. Thus regulator r will operate
31 * in normal mode for loads > 10mA and in IDLE mode for load <= 10mA.
32 *
33 */
34
35#ifndef __LINUX_REGULATOR_CONSUMER_H_
36#define __LINUX_REGULATOR_CONSUMER_H_
37
38/*
39 * Regulator operating modes.
40 *
41 * Regulators can run in a variety of different operating modes depending on
42 * output load. This allows further system power savings by selecting the
43 * best (and most efficient) regulator mode for a desired load.
44 *
45 * Most drivers will only care about NORMAL. The modes below are generic and
46 * will probably not match the naming convention of your regulator data sheet
47 * but should match the use cases in the datasheet.
48 *
49 * In order of power efficiency (least efficient at top).
50 *
51 * Mode Description
52 * FAST Regulator can handle fast changes in it's load.
53 * e.g. useful in CPU voltage & frequency scaling where
54 * load can quickly increase with CPU frequency increases.
55 *
56 * NORMAL Normal regulator power supply mode. Most drivers will
57 * use this mode.
58 *
59 * IDLE Regulator runs in a more efficient mode for light
60 * loads. Can be used for devices that have a low power
61 * requirement during periods of inactivity. This mode
62 * may be more noisy than NORMAL and may not be able
63 * to handle fast load switching.
64 *
65 * STANDBY Regulator runs in the most efficient mode for very
66 * light loads. Can be used by devices when they are
67 * in a sleep/standby state. This mode is likely to be
68 * the most noisy and may not be able to handle fast load
69 * switching.
70 *
71 * NOTE: Most regulators will only support a subset of these modes. Some
72 * will only just support NORMAL.
73 *
74 * These modes can be OR'ed together to make up a mask of valid register modes.
75 */
76
77#define REGULATOR_MODE_FAST 0x1
78#define REGULATOR_MODE_NORMAL 0x2
79#define REGULATOR_MODE_IDLE 0x4
80#define REGULATOR_MODE_STANDBY 0x8
81
82/*
83 * Regulator notifier events.
84 *
85 * UNDER_VOLTAGE Regulator output is under voltage.
86 * OVER_CURRENT Regulator output current is too high.
87 * REGULATION_OUT Regulator output is out of regulation.
88 * FAIL Regulator output has failed.
89 * OVER_TEMP Regulator over temp.
90 * FORCE_DISABLE Regulator shut down by software.
91 *
92 * NOTE: These events can be OR'ed together when passed into handler.
93 */
94
95#define REGULATOR_EVENT_UNDER_VOLTAGE 0x01
96#define REGULATOR_EVENT_OVER_CURRENT 0x02
97#define REGULATOR_EVENT_REGULATION_OUT 0x04
98#define REGULATOR_EVENT_FAIL 0x08
99#define REGULATOR_EVENT_OVER_TEMP 0x10
100#define REGULATOR_EVENT_FORCE_DISABLE 0x20
101
102struct regulator;
103
104/**
105 * struct regulator_bulk_data - Data used for bulk regulator operations.
106 *
107 * @supply The name of the supply. Initialised by the user before
108 * using the bulk regulator APIs.
109 * @consumer The regulator consumer for the supply. This will be managed
110 * by the bulk API.
111 *
112 * The regulator APIs provide a series of regulator_bulk_() API calls as
113 * a convenience to consumers which require multiple supplies. This
114 * structure is used to manage data for these calls.
115 */
116struct regulator_bulk_data {
117 const char *supply;
118 struct regulator *consumer;
119};
120
121#if defined(CONFIG_REGULATOR)
122
123/* regulator get and put */
124struct regulator *__must_check regulator_get(struct device *dev,
125 const char *id);
126void regulator_put(struct regulator *regulator);
127
128/* regulator output control and status */
129int regulator_enable(struct regulator *regulator);
130int regulator_disable(struct regulator *regulator);
131int regulator_force_disable(struct regulator *regulator);
132int regulator_is_enabled(struct regulator *regulator);
133
134int regulator_bulk_get(struct device *dev, int num_consumers,
135 struct regulator_bulk_data *consumers);
136int regulator_bulk_enable(int num_consumers,
137 struct regulator_bulk_data *consumers);
138int regulator_bulk_disable(int num_consumers,
139 struct regulator_bulk_data *consumers);
140void regulator_bulk_free(int num_consumers,
141 struct regulator_bulk_data *consumers);
142
143int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV);
144int regulator_get_voltage(struct regulator *regulator);
145int regulator_set_current_limit(struct regulator *regulator,
146 int min_uA, int max_uA);
147int regulator_get_current_limit(struct regulator *regulator);
148
149int regulator_set_mode(struct regulator *regulator, unsigned int mode);
150unsigned int regulator_get_mode(struct regulator *regulator);
151int regulator_set_optimum_mode(struct regulator *regulator, int load_uA);
152
153/* regulator notifier block */
154int regulator_register_notifier(struct regulator *regulator,
155 struct notifier_block *nb);
156int regulator_unregister_notifier(struct regulator *regulator,
157 struct notifier_block *nb);
158
159/* driver data - core doesn't touch */
160void *regulator_get_drvdata(struct regulator *regulator);
161void regulator_set_drvdata(struct regulator *regulator, void *data);
162
163#else
164
165/*
166 * Make sure client drivers will still build on systems with no software
167 * controllable voltage or current regulators.
168 */
169static inline struct regulator *__must_check regulator_get(struct device *dev,
170 const char *id)
171{
172 /* Nothing except the stubbed out regulator API should be
173 * looking at the value except to check if it is an error
174 * value so the actual return value doesn't matter.
175 */
176 return (struct regulator *)id;
177}
178static inline void regulator_put(struct regulator *regulator)
179{
180}
181
182static inline int regulator_enable(struct regulator *regulator)
183{
184 return 0;
185}
186
187static inline int regulator_disable(struct regulator *regulator)
188{
189 return 0;
190}
191
192static inline int regulator_is_enabled(struct regulator *regulator)
193{
194 return 1;
195}
196
197static inline int regulator_bulk_get(struct device *dev,
198 int num_consumers,
199 struct regulator_bulk_data *consumers)
200{
201 return 0;
202}
203
204static inline int regulator_bulk_enable(int num_consumers,
205 struct regulator_bulk_data *consumers)
206{
207 return 0;
208}
209
210static inline int regulator_bulk_disable(int num_consumers,
211 struct regulator_bulk_data *consumers)
212{
213 return 0;
214}
215
216static inline void regulator_bulk_free(int num_consumers,
217 struct regulator_bulk_data *consumers)
218{
219}
220
221static inline int regulator_set_voltage(struct regulator *regulator,
222 int min_uV, int max_uV)
223{
224 return 0;
225}
226
227static inline int regulator_get_voltage(struct regulator *regulator)
228{
229 return 0;
230}
231
232static inline int regulator_set_current_limit(struct regulator *regulator,
233 int min_uA, int max_uA)
234{
235 return 0;
236}
237
238static inline int regulator_get_current_limit(struct regulator *regulator)
239{
240 return 0;
241}
242
243static inline int regulator_set_mode(struct regulator *regulator,
244 unsigned int mode)
245{
246 return 0;
247}
248
249static inline unsigned int regulator_get_mode(struct regulator *regulator)
250{
251 return REGULATOR_MODE_NORMAL;
252}
253
254static inline int regulator_set_optimum_mode(struct regulator *regulator,
255 int load_uA)
256{
257 return REGULATOR_MODE_NORMAL;
258}
259
260static inline int regulator_register_notifier(struct regulator *regulator,
261 struct notifier_block *nb)
262{
263 return 0;
264}
265
266static inline int regulator_unregister_notifier(struct regulator *regulator,
267 struct notifier_block *nb)
268{
269 return 0;
270}
271
272static inline void *regulator_get_drvdata(struct regulator *regulator)
273{
274 return NULL;
275}
276
277static inline void regulator_set_drvdata(struct regulator *regulator,
278 void *data)
279{
280}
281
282#endif
283
284#endif
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
new file mode 100644
index 000000000000..1d712c7172a2
--- /dev/null
+++ b/include/linux/regulator/driver.h
@@ -0,0 +1,99 @@
1/*
2 * driver.h -- SoC Regulator driver support.
3 *
4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
5 *
6 * Author: Liam Girdwood <lg@opensource.wolfsonmicro.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 * Regulator Driver Interface.
13 */
14
15#ifndef __LINUX_REGULATOR_DRIVER_H_
16#define __LINUX_REGULATOR_DRIVER_H_
17
18#include <linux/device.h>
19#include <linux/regulator/consumer.h>
20
21struct regulator_constraints;
22struct regulator_dev;
23
24/**
25 * struct regulator_ops - regulator operations.
26 *
27 * This struct describes regulator operations.
28 */
29struct regulator_ops {
30
31 /* get/set regulator voltage */
32 int (*set_voltage) (struct regulator_dev *, int min_uV, int max_uV);
33 int (*get_voltage) (struct regulator_dev *);
34
35 /* get/set regulator current */
36 int (*set_current_limit) (struct regulator_dev *,
37 int min_uA, int max_uA);
38 int (*get_current_limit) (struct regulator_dev *);
39
40 /* enable/disable regulator */
41 int (*enable) (struct regulator_dev *);
42 int (*disable) (struct regulator_dev *);
43 int (*is_enabled) (struct regulator_dev *);
44
45 /* get/set regulator operating mode (defined in regulator.h) */
46 int (*set_mode) (struct regulator_dev *, unsigned int mode);
47 unsigned int (*get_mode) (struct regulator_dev *);
48
49 /* get most efficient regulator operating mode for load */
50 unsigned int (*get_optimum_mode) (struct regulator_dev *, int input_uV,
51 int output_uV, int load_uA);
52
53 /* the operations below are for configuration of regulator state when
54 * it's parent PMIC enters a global STANBY/HIBERNATE state */
55
56 /* set regulator suspend voltage */
57 int (*set_suspend_voltage) (struct regulator_dev *, int uV);
58
59 /* enable/disable regulator in suspend state */
60 int (*set_suspend_enable) (struct regulator_dev *);
61 int (*set_suspend_disable) (struct regulator_dev *);
62
63 /* set regulator suspend operating mode (defined in regulator.h) */
64 int (*set_suspend_mode) (struct regulator_dev *, unsigned int mode);
65};
66
67/*
68 * Regulators can either control voltage or current.
69 */
70enum regulator_type {
71 REGULATOR_VOLTAGE,
72 REGULATOR_CURRENT,
73};
74
75/**
76 * struct regulator_desc - Regulator descriptor
77 *
78 */
79struct regulator_desc {
80 const char *name;
81 int id;
82 struct regulator_ops *ops;
83 int irq;
84 enum regulator_type type;
85 struct module *owner;
86};
87
88
89struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
90 void *reg_data);
91void regulator_unregister(struct regulator_dev *rdev);
92
93int regulator_notifier_call_chain(struct regulator_dev *rdev,
94 unsigned long event, void *data);
95
96void *rdev_get_drvdata(struct regulator_dev *rdev);
97int rdev_get_id(struct regulator_dev *rdev);
98
99#endif
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h
new file mode 100644
index 000000000000..1387a5d2190e
--- /dev/null
+++ b/include/linux/regulator/fixed.h
@@ -0,0 +1,22 @@
1/*
2 * fixed.h
3 *
4 * Copyright 2008 Wolfson Microelectronics PLC.
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.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 as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
12 */
13
14#ifndef __REGULATOR_FIXED_H
15#define __REGULATOR_FIXED_H
16
17struct fixed_voltage_config {
18 const char *supply_name;
19 int microvolts;
20};
21
22#endif
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
new file mode 100644
index 000000000000..11e737dbfcf2
--- /dev/null
+++ b/include/linux/regulator/machine.h
@@ -0,0 +1,104 @@
1/*
2 * machine.h -- SoC Regulator support, machine/board driver API.
3 *
4 * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
5 *
6 * Author: Liam Girdwood <lg@opensource.wolfsonmicro.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 * Regulator Machine/Board Interface.
13 */
14
15#ifndef __LINUX_REGULATOR_MACHINE_H_
16#define __LINUX_REGULATOR_MACHINE_H_
17
18#include <linux/regulator/consumer.h>
19#include <linux/suspend.h>
20
21struct regulator;
22
23/*
24 * Regulator operation constraint flags. These flags are used to enable
25 * certain regulator operations and can be OR'ed together.
26 *
27 * VOLTAGE: Regulator output voltage can be changed by software on this
28 * board/machine.
29 * CURRENT: Regulator output current can be changed by software on this
30 * board/machine.
31 * MODE: Regulator operating mode can be changed by software on this
32 * board/machine.
33 * STATUS: Regulator can be enabled and disabled.
34 * DRMS: Dynamic Regulator Mode Switching is enabled for this regulator.
35 */
36
37#define REGULATOR_CHANGE_VOLTAGE 0x1
38#define REGULATOR_CHANGE_CURRENT 0x2
39#define REGULATOR_CHANGE_MODE 0x4
40#define REGULATOR_CHANGE_STATUS 0x8
41#define REGULATOR_CHANGE_DRMS 0x10
42
43/**
44 * struct regulator_state - regulator state during low power syatem states
45 *
46 * This describes a regulators state during a system wide low power state.
47 */
48struct regulator_state {
49 int uV; /* suspend voltage */
50 unsigned int mode; /* suspend regulator operating mode */
51 int enabled; /* is regulator enabled in this suspend state */
52};
53
54/**
55 * struct regulation_constraints - regulator operating constraints.
56 *
57 * This struct describes regulator and board/machine specific constraints.
58 */
59struct regulation_constraints {
60
61 char *name;
62
63 /* voltage output range (inclusive) - for voltage control */
64 int min_uV;
65 int max_uV;
66
67 /* current output range (inclusive) - for current control */
68 int min_uA;
69 int max_uA;
70
71 /* valid regulator operating modes for this machine */
72 unsigned int valid_modes_mask;
73
74 /* valid operations for regulator on this machine */
75 unsigned int valid_ops_mask;
76
77 /* regulator input voltage - only if supply is another regulator */
78 int input_uV;
79
80 /* regulator suspend states for global PMIC STANDBY/HIBERNATE */
81 struct regulator_state state_disk;
82 struct regulator_state state_mem;
83 struct regulator_state state_standby;
84 suspend_state_t initial_state; /* suspend state to set at init */
85
86 /* constriant flags */
87 unsigned always_on:1; /* regulator never off when system is on */
88 unsigned boot_on:1; /* bootloader/firmware enabled regulator */
89 unsigned apply_uV:1; /* apply uV constraint iff min == max */
90};
91
92int regulator_set_supply(const char *regulator, const char *regulator_supply);
93
94const char *regulator_get_supply(const char *regulator);
95
96int regulator_set_machine_constraints(const char *regulator,
97 struct regulation_constraints *constraints);
98
99int regulator_set_device_supply(const char *regulator, struct device *dev,
100 const char *supply);
101
102int regulator_suspend_prepare(suspend_state_t state);
103
104#endif
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index 66a96814d614..af135ae895db 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -55,7 +55,7 @@ int reiserfs_removexattr(struct dentry *dentry, const char *name);
55int reiserfs_delete_xattrs(struct inode *inode); 55int reiserfs_delete_xattrs(struct inode *inode);
56int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs); 56int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
57int reiserfs_xattr_init(struct super_block *sb, int mount_flags); 57int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
58int reiserfs_permission(struct inode *inode, int mask, struct nameidata *nd); 58int reiserfs_permission(struct inode *inode, int mask);
59 59
60int reiserfs_xattr_del(struct inode *, const char *); 60int reiserfs_xattr_del(struct inode *, const char *);
61int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t); 61int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t);
diff --git a/include/linux/relay.h b/include/linux/relay.h
index 6cd8c4425fc7..953fc055e875 100644
--- a/include/linux/relay.h
+++ b/include/linux/relay.h
@@ -48,6 +48,7 @@ struct rchan_buf
48 size_t *padding; /* padding counts per sub-buffer */ 48 size_t *padding; /* padding counts per sub-buffer */
49 size_t prev_padding; /* temporary variable */ 49 size_t prev_padding; /* temporary variable */
50 size_t bytes_consumed; /* bytes consumed in cur read subbuf */ 50 size_t bytes_consumed; /* bytes consumed in cur read subbuf */
51 size_t early_bytes; /* bytes consumed before VFS inited */
51 unsigned int cpu; /* this buf's cpu */ 52 unsigned int cpu; /* this buf's cpu */
52} ____cacheline_aligned; 53} ____cacheline_aligned;
53 54
@@ -68,6 +69,7 @@ struct rchan
68 int is_global; /* One global buffer ? */ 69 int is_global; /* One global buffer ? */
69 struct list_head list; /* for channel list */ 70 struct list_head list; /* for channel list */
70 struct dentry *parent; /* parent dentry passed to open */ 71 struct dentry *parent; /* parent dentry passed to open */
72 int has_base_filename; /* has a filename associated? */
71 char base_filename[NAME_MAX]; /* saved base filename */ 73 char base_filename[NAME_MAX]; /* saved base filename */
72}; 74};
73 75
@@ -169,6 +171,9 @@ struct rchan *relay_open(const char *base_filename,
169 size_t n_subbufs, 171 size_t n_subbufs,
170 struct rchan_callbacks *cb, 172 struct rchan_callbacks *cb,
171 void *private_data); 173 void *private_data);
174extern int relay_late_setup_files(struct rchan *chan,
175 const char *base_filename,
176 struct dentry *parent);
172extern void relay_close(struct rchan *chan); 177extern void relay_close(struct rchan *chan);
173extern void relay_flush(struct rchan *chan); 178extern void relay_flush(struct rchan *chan);
174extern void relay_subbufs_consumed(struct rchan *chan, 179extern void relay_subbufs_consumed(struct rchan *chan,
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index fdeadd9740dc..271c1c2c9f6f 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -166,7 +166,7 @@ static inline int res_counter_set_limit(struct res_counter *cnt,
166 int ret = -EBUSY; 166 int ret = -EBUSY;
167 167
168 spin_lock_irqsave(&cnt->lock, flags); 168 spin_lock_irqsave(&cnt->lock, flags);
169 if (cnt->usage < limit) { 169 if (cnt->usage <= limit) {
170 cnt->limit = limit; 170 cnt->limit = limit;
171 ret = 0; 171 ret = 0;
172 } 172 }
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index c5f6e54ec6ae..4cd64b0d9825 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -49,6 +49,7 @@ enum rfkill_state {
49 RFKILL_STATE_SOFT_BLOCKED = 0, /* Radio output blocked */ 49 RFKILL_STATE_SOFT_BLOCKED = 0, /* Radio output blocked */
50 RFKILL_STATE_UNBLOCKED = 1, /* Radio output allowed */ 50 RFKILL_STATE_UNBLOCKED = 1, /* Radio output allowed */
51 RFKILL_STATE_HARD_BLOCKED = 2, /* Output blocked, non-overrideable */ 51 RFKILL_STATE_HARD_BLOCKED = 2, /* Output blocked, non-overrideable */
52 RFKILL_STATE_MAX, /* marker for last valid state */
52}; 53};
53 54
54/* 55/*
@@ -68,7 +69,8 @@ enum rfkill_state {
68 * @user_claim_unsupported: Whether the hardware supports exclusive 69 * @user_claim_unsupported: Whether the hardware supports exclusive
69 * RF-kill control by userspace. Set this before registering. 70 * RF-kill control by userspace. Set this before registering.
70 * @user_claim: Set when the switch is controlled exlusively by userspace. 71 * @user_claim: Set when the switch is controlled exlusively by userspace.
71 * @mutex: Guards switch state transitions 72 * @mutex: Guards switch state transitions. It serializes callbacks
73 * and also protects the state.
72 * @data: Pointer to the RF button drivers private data which will be 74 * @data: Pointer to the RF button drivers private data which will be
73 * passed along when toggling radio state. 75 * passed along when toggling radio state.
74 * @toggle_radio(): Mandatory handler to control state of the radio. 76 * @toggle_radio(): Mandatory handler to control state of the radio.
@@ -89,12 +91,13 @@ struct rfkill {
89 const char *name; 91 const char *name;
90 enum rfkill_type type; 92 enum rfkill_type type;
91 93
92 enum rfkill_state state;
93 bool user_claim_unsupported; 94 bool user_claim_unsupported;
94 bool user_claim; 95 bool user_claim;
95 96
97 /* the mutex serializes callbacks and also protects
98 * the state */
96 struct mutex mutex; 99 struct mutex mutex;
97 100 enum rfkill_state state;
98 void *data; 101 void *data;
99 int (*toggle_radio)(void *data, enum rfkill_state state); 102 int (*toggle_radio)(void *data, enum rfkill_state state);
100 int (*get_state)(void *data, enum rfkill_state *state); 103 int (*get_state)(void *data, enum rfkill_state *state);
@@ -108,12 +111,14 @@ struct rfkill {
108}; 111};
109#define to_rfkill(d) container_of(d, struct rfkill, dev) 112#define to_rfkill(d) container_of(d, struct rfkill, dev)
110 113
111struct rfkill *rfkill_allocate(struct device *parent, enum rfkill_type type); 114struct rfkill * __must_check rfkill_allocate(struct device *parent,
115 enum rfkill_type type);
112void rfkill_free(struct rfkill *rfkill); 116void rfkill_free(struct rfkill *rfkill);
113int rfkill_register(struct rfkill *rfkill); 117int __must_check rfkill_register(struct rfkill *rfkill);
114void rfkill_unregister(struct rfkill *rfkill); 118void rfkill_unregister(struct rfkill *rfkill);
115 119
116int rfkill_force_state(struct rfkill *rfkill, enum rfkill_state state); 120int rfkill_force_state(struct rfkill *rfkill, enum rfkill_state state);
121int rfkill_set_default(enum rfkill_type type, enum rfkill_state state);
117 122
118/** 123/**
119 * rfkill_state_complement - return complementar state 124 * rfkill_state_complement - return complementar state
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
index 1383692ac5bd..fed6f5e0b411 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
@@ -26,6 +26,14 @@
26 */ 26 */
27struct anon_vma { 27struct anon_vma {
28 spinlock_t lock; /* Serialize access to vma list */ 28 spinlock_t lock; /* Serialize access to vma list */
29 /*
30 * NOTE: the LSB of the head.next is set by
31 * mm_take_all_locks() _after_ taking the above lock. So the
32 * head must only be read/written after taking the above lock
33 * to be sure to see a valid next pointer. The LSB bit itself
34 * is serialized by a system wide lock only visible to
35 * mm_take_all_locks() (mm_all_locks_mutex).
36 */
29 struct list_head head; /* List of private "related" vmas */ 37 struct list_head head; /* List of private "related" vmas */
30}; 38};
31 39
@@ -94,7 +102,7 @@ int try_to_unmap(struct page *, int ignore_refs);
94 * Called from mm/filemap_xip.c to unmap empty zero page 102 * Called from mm/filemap_xip.c to unmap empty zero page
95 */ 103 */
96pte_t *page_check_address(struct page *, struct mm_struct *, 104pte_t *page_check_address(struct page *, struct mm_struct *,
97 unsigned long, spinlock_t **); 105 unsigned long, spinlock_t **, int);
98 106
99/* 107/*
100 * Used by swapoff to help locate where page is expected in vma. 108 * Used by swapoff to help locate where page is expected in vma.
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index b01fe004cb5e..91f597ad6acc 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -225,8 +225,6 @@ typedef struct rtc_task {
225int rtc_register(rtc_task_t *task); 225int rtc_register(rtc_task_t *task);
226int rtc_unregister(rtc_task_t *task); 226int rtc_unregister(rtc_task_t *task);
227int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg); 227int rtc_control(rtc_task_t *t, unsigned int cmd, unsigned long arg);
228void rtc_get_rtc_time(struct rtc_time *rtc_tm);
229irqreturn_t rtc_interrupt(int irq, void *dev_id);
230 228
231#endif /* __KERNEL__ */ 229#endif /* __KERNEL__ */
232 230
diff --git a/include/linux/rtc/m48t59.h b/include/linux/rtc/m48t59.h
index e8c7c21ceb1f..6fc961459b4a 100644
--- a/include/linux/rtc/m48t59.h
+++ b/include/linux/rtc/m48t59.h
@@ -18,40 +18,47 @@
18/* 18/*
19 * M48T59 Register Offset 19 * M48T59 Register Offset
20 */ 20 */
21#define M48T59_YEAR 0x1fff 21#define M48T59_YEAR 0xf
22#define M48T59_MONTH 0x1ffe 22#define M48T59_MONTH 0xe
23#define M48T59_MDAY 0x1ffd /* Day of Month */ 23#define M48T59_MDAY 0xd /* Day of Month */
24#define M48T59_WDAY 0x1ffc /* Day of Week */ 24#define M48T59_WDAY 0xc /* Day of Week */
25#define M48T59_WDAY_CB 0x20 /* Century Bit */ 25#define M48T59_WDAY_CB 0x20 /* Century Bit */
26#define M48T59_WDAY_CEB 0x10 /* Century Enable Bit */ 26#define M48T59_WDAY_CEB 0x10 /* Century Enable Bit */
27#define M48T59_HOUR 0x1ffb 27#define M48T59_HOUR 0xb
28#define M48T59_MIN 0x1ffa 28#define M48T59_MIN 0xa
29#define M48T59_SEC 0x1ff9 29#define M48T59_SEC 0x9
30#define M48T59_CNTL 0x1ff8 30#define M48T59_CNTL 0x8
31#define M48T59_CNTL_READ 0x40 31#define M48T59_CNTL_READ 0x40
32#define M48T59_CNTL_WRITE 0x80 32#define M48T59_CNTL_WRITE 0x80
33#define M48T59_WATCHDOG 0x1ff7 33#define M48T59_WATCHDOG 0x7
34#define M48T59_INTR 0x1ff6 34#define M48T59_INTR 0x6
35#define M48T59_INTR_AFE 0x80 /* Alarm Interrupt Enable */ 35#define M48T59_INTR_AFE 0x80 /* Alarm Interrupt Enable */
36#define M48T59_INTR_ABE 0x20 36#define M48T59_INTR_ABE 0x20
37#define M48T59_ALARM_DATE 0x1ff5 37#define M48T59_ALARM_DATE 0x5
38#define M48T59_ALARM_HOUR 0x1ff4 38#define M48T59_ALARM_HOUR 0x4
39#define M48T59_ALARM_MIN 0x1ff3 39#define M48T59_ALARM_MIN 0x3
40#define M48T59_ALARM_SEC 0x1ff2 40#define M48T59_ALARM_SEC 0x2
41#define M48T59_UNUSED 0x1ff1 41#define M48T59_UNUSED 0x1
42#define M48T59_FLAGS 0x1ff0 42#define M48T59_FLAGS 0x0
43#define M48T59_FLAGS_WDT 0x80 /* watchdog timer expired */ 43#define M48T59_FLAGS_WDT 0x80 /* watchdog timer expired */
44#define M48T59_FLAGS_AF 0x40 /* alarm */ 44#define M48T59_FLAGS_AF 0x40 /* alarm */
45#define M48T59_FLAGS_BF 0x10 /* low battery */ 45#define M48T59_FLAGS_BF 0x10 /* low battery */
46 46
47#define M48T59_NVRAM_SIZE 0x1ff0 47#define M48T59RTC_TYPE_M48T59 0 /* to keep compatibility */
48#define M48T59RTC_TYPE_M48T02 1
49#define M48T59RTC_TYPE_M48T08 2
48 50
49struct m48t59_plat_data { 51struct m48t59_plat_data {
50 /* The method to access M48T59 registers, 52 /* The method to access M48T59 registers */
51 * NOTE: The 'ofs' should be 0x00~0x1fff
52 */
53 void (*write_byte)(struct device *dev, u32 ofs, u8 val); 53 void (*write_byte)(struct device *dev, u32 ofs, u8 val);
54 unsigned char (*read_byte)(struct device *dev, u32 ofs); 54 unsigned char (*read_byte)(struct device *dev, u32 ofs);
55
56 int type; /* RTC model */
57
58 /* ioaddr mapped externally */
59 void __iomem *ioaddr;
60 /* offset to RTC registers, automatically set according to the type */
61 unsigned int offset;
55}; 62};
56 63
57#endif /* _LINUX_RTC_M48T59_H_ */ 64#endif /* _LINUX_RTC_M48T59_H_ */
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index f4d386c191f5..2b3d51c6ec9c 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -582,6 +582,10 @@ enum rtnetlink_groups {
582#define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE 582#define RTNLGRP_IPV6_RULE RTNLGRP_IPV6_RULE
583 RTNLGRP_ND_USEROPT, 583 RTNLGRP_ND_USEROPT,
584#define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT 584#define RTNLGRP_ND_USEROPT RTNLGRP_ND_USEROPT
585 RTNLGRP_PHONET_IFADDR,
586#define RTNLGRP_PHONET_IFADDR RTNLGRP_PHONET_IFADDR
587 RTNLGRP_PHONET_ROUTE,
588#define RTNLGRP_PHONET_ROUTE RTNLGRP_PHONET_ROUTE
585 __RTNLGRP_MAX 589 __RTNLGRP_MAX
586}; 590};
587#define RTNLGRP_MAX (__RTNLGRP_MAX - 1) 591#define RTNLGRP_MAX (__RTNLGRP_MAX - 1)
@@ -755,13 +759,6 @@ extern void __rtnl_unlock(void);
755 } \ 759 } \
756} while(0) 760} while(0)
757 761
758#define BUG_TRAP(x) do { \
759 if (unlikely(!(x))) { \
760 printk(KERN_ERR "KERNEL: assertion (%s) failed at %s (%d)\n", \
761 #x, __FILE__ , __LINE__); \
762 } \
763} while(0)
764
765static inline u32 rtm_get_table(struct rtattr **rta, u8 table) 762static inline u32 rtm_get_table(struct rtattr **rta, u8 table)
766{ 763{
767 return RTA_GET_U32(rta[RTA_TABLE-1]); 764 return RTA_GET_U32(rta[RTA_TABLE-1]);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 42036ffe6b00..c226c7b82946 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -87,6 +87,7 @@ struct sched_param {
87#include <linux/task_io_accounting.h> 87#include <linux/task_io_accounting.h>
88#include <linux/kobject.h> 88#include <linux/kobject.h>
89#include <linux/latencytop.h> 89#include <linux/latencytop.h>
90#include <linux/cred.h>
90 91
91#include <asm/processor.h> 92#include <asm/processor.h>
92 93
@@ -292,7 +293,6 @@ extern void sched_show_task(struct task_struct *p);
292 293
293#ifdef CONFIG_DETECT_SOFTLOCKUP 294#ifdef CONFIG_DETECT_SOFTLOCKUP
294extern void softlockup_tick(void); 295extern void softlockup_tick(void);
295extern void spawn_softlockup_task(void);
296extern void touch_softlockup_watchdog(void); 296extern void touch_softlockup_watchdog(void);
297extern void touch_all_softlockup_watchdogs(void); 297extern void touch_all_softlockup_watchdogs(void);
298extern unsigned int softlockup_panic; 298extern unsigned int softlockup_panic;
@@ -352,7 +352,7 @@ arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
352extern void arch_unmap_area(struct mm_struct *, unsigned long); 352extern void arch_unmap_area(struct mm_struct *, unsigned long);
353extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); 353extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
354 354
355#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS 355#if USE_SPLIT_PTLOCKS
356/* 356/*
357 * The mm counters are not protected by its page_table_lock, 357 * The mm counters are not protected by its page_table_lock,
358 * so must be incremented atomically. 358 * so must be incremented atomically.
@@ -363,7 +363,7 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
363#define inc_mm_counter(mm, member) atomic_long_inc(&(mm)->_##member) 363#define inc_mm_counter(mm, member) atomic_long_inc(&(mm)->_##member)
364#define dec_mm_counter(mm, member) atomic_long_dec(&(mm)->_##member) 364#define dec_mm_counter(mm, member) atomic_long_dec(&(mm)->_##member)
365 365
366#else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ 366#else /* !USE_SPLIT_PTLOCKS */
367/* 367/*
368 * The mm counters are protected by its page_table_lock, 368 * The mm counters are protected by its page_table_lock,
369 * so can be incremented directly. 369 * so can be incremented directly.
@@ -374,7 +374,7 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long);
374#define inc_mm_counter(mm, member) (mm)->_##member++ 374#define inc_mm_counter(mm, member) (mm)->_##member++
375#define dec_mm_counter(mm, member) (mm)->_##member-- 375#define dec_mm_counter(mm, member) (mm)->_##member--
376 376
377#endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */ 377#endif /* !USE_SPLIT_PTLOCKS */
378 378
379#define get_mm_rss(mm) \ 379#define get_mm_rss(mm) \
380 (get_mm_counter(mm, file_rss) + get_mm_counter(mm, anon_rss)) 380 (get_mm_counter(mm, file_rss) + get_mm_counter(mm, anon_rss))
@@ -451,8 +451,8 @@ struct signal_struct {
451 * - everyone except group_exit_task is stopped during signal delivery 451 * - everyone except group_exit_task is stopped during signal delivery
452 * of fatal signals, group_exit_task processes the signal. 452 * of fatal signals, group_exit_task processes the signal.
453 */ 453 */
454 struct task_struct *group_exit_task;
455 int notify_count; 454 int notify_count;
455 struct task_struct *group_exit_task;
456 456
457 /* thread group stop support, overloads group_exit_code too */ 457 /* thread group stop support, overloads group_exit_code too */
458 int group_stop_count; 458 int group_stop_count;
@@ -506,9 +506,6 @@ struct signal_struct {
506 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; 506 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw;
507 unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; 507 unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt;
508 unsigned long inblock, oublock, cinblock, coublock; 508 unsigned long inblock, oublock, cinblock, coublock;
509#ifdef CONFIG_TASK_XACCT
510 u64 rchar, wchar, syscr, syscw;
511#endif
512 struct task_io_accounting ioac; 509 struct task_io_accounting ioac;
513 510
514 /* 511 /*
@@ -827,6 +824,9 @@ struct sched_domain {
827 unsigned int ttwu_move_affine; 824 unsigned int ttwu_move_affine;
828 unsigned int ttwu_move_balance; 825 unsigned int ttwu_move_balance;
829#endif 826#endif
827#ifdef CONFIG_SCHED_DEBUG
828 char *name;
829#endif
830}; 830};
831 831
832extern void partition_sched_domains(int ndoms_new, cpumask_t *doms_new, 832extern void partition_sched_domains(int ndoms_new, cpumask_t *doms_new,
@@ -900,7 +900,7 @@ struct sched_class {
900 void (*yield_task) (struct rq *rq); 900 void (*yield_task) (struct rq *rq);
901 int (*select_task_rq)(struct task_struct *p, int sync); 901 int (*select_task_rq)(struct task_struct *p, int sync);
902 902
903 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p); 903 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p, int sync);
904 904
905 struct task_struct * (*pick_next_task) (struct rq *rq); 905 struct task_struct * (*pick_next_task) (struct rq *rq);
906 void (*put_prev_task) (struct rq *rq, struct task_struct *p); 906 void (*put_prev_task) (struct rq *rq, struct task_struct *p);
@@ -1013,8 +1013,8 @@ struct sched_entity {
1013 1013
1014struct sched_rt_entity { 1014struct sched_rt_entity {
1015 struct list_head run_list; 1015 struct list_head run_list;
1016 unsigned int time_slice;
1017 unsigned long timeout; 1016 unsigned long timeout;
1017 unsigned int time_slice;
1018 int nr_cpus_allowed; 1018 int nr_cpus_allowed;
1019 1019
1020 struct sched_rt_entity *back; 1020 struct sched_rt_entity *back;
@@ -1257,10 +1257,6 @@ struct task_struct {
1257 1257
1258 unsigned long ptrace_message; 1258 unsigned long ptrace_message;
1259 siginfo_t *last_siginfo; /* For ptrace use. */ 1259 siginfo_t *last_siginfo; /* For ptrace use. */
1260#ifdef CONFIG_TASK_XACCT
1261/* i/o counters(bytes read/written, #syscalls */
1262 u64 rchar, wchar, syscr, syscw;
1263#endif
1264 struct task_io_accounting ioac; 1260 struct task_io_accounting ioac;
1265#if defined(CONFIG_TASK_XACCT) 1261#if defined(CONFIG_TASK_XACCT)
1266 u64 acct_rss_mem1; /* accumulated rss usage */ 1262 u64 acct_rss_mem1; /* accumulated rss usage */
@@ -1482,6 +1478,10 @@ static inline void put_task_struct(struct task_struct *t)
1482 __put_task_struct(t); 1478 __put_task_struct(t);
1483} 1479}
1484 1480
1481extern cputime_t task_utime(struct task_struct *p);
1482extern cputime_t task_stime(struct task_struct *p);
1483extern cputime_t task_gtime(struct task_struct *p);
1484
1485/* 1485/*
1486 * Per process flags 1486 * Per process flags
1487 */ 1487 */
@@ -1559,16 +1559,10 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
1559 1559
1560extern unsigned long long sched_clock(void); 1560extern unsigned long long sched_clock(void);
1561 1561
1562#ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK 1562extern void sched_clock_init(void);
1563static inline void sched_clock_init(void) 1563extern u64 sched_clock_cpu(int cpu);
1564{
1565}
1566
1567static inline u64 sched_clock_cpu(int cpu)
1568{
1569 return sched_clock();
1570}
1571 1564
1565#ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
1572static inline void sched_clock_tick(void) 1566static inline void sched_clock_tick(void)
1573{ 1567{
1574} 1568}
@@ -1580,28 +1574,11 @@ static inline void sched_clock_idle_sleep_event(void)
1580static inline void sched_clock_idle_wakeup_event(u64 delta_ns) 1574static inline void sched_clock_idle_wakeup_event(u64 delta_ns)
1581{ 1575{
1582} 1576}
1583 1577#else
1584#ifdef CONFIG_NO_HZ
1585static inline void sched_clock_tick_stop(int cpu)
1586{
1587}
1588
1589static inline void sched_clock_tick_start(int cpu)
1590{
1591}
1592#endif
1593
1594#else /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */
1595extern void sched_clock_init(void);
1596extern u64 sched_clock_cpu(int cpu);
1597extern void sched_clock_tick(void); 1578extern void sched_clock_tick(void);
1598extern void sched_clock_idle_sleep_event(void); 1579extern void sched_clock_idle_sleep_event(void);
1599extern void sched_clock_idle_wakeup_event(u64 delta_ns); 1580extern void sched_clock_idle_wakeup_event(u64 delta_ns);
1600#ifdef CONFIG_NO_HZ
1601extern void sched_clock_tick_stop(int cpu);
1602extern void sched_clock_tick_start(int cpu);
1603#endif 1581#endif
1604#endif /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */
1605 1582
1606/* 1583/*
1607 * For kernel-internal use: high-speed (but slightly incorrect) per-cpu 1584 * For kernel-internal use: high-speed (but slightly incorrect) per-cpu
@@ -1797,7 +1774,7 @@ extern int kill_pid_info_as_uid(int, struct siginfo *, struct pid *, uid_t, uid_
1797extern int kill_pgrp(struct pid *pid, int sig, int priv); 1774extern int kill_pgrp(struct pid *pid, int sig, int priv);
1798extern int kill_pid(struct pid *pid, int sig, int priv); 1775extern int kill_pid(struct pid *pid, int sig, int priv);
1799extern int kill_proc_info(int, struct siginfo *, pid_t); 1776extern int kill_proc_info(int, struct siginfo *, pid_t);
1800extern void do_notify_parent(struct task_struct *, int); 1777extern int do_notify_parent(struct task_struct *, int);
1801extern void force_sig(int, struct task_struct *); 1778extern void force_sig(int, struct task_struct *);
1802extern void force_sig_specific(int, struct task_struct *); 1779extern void force_sig_specific(int, struct task_struct *);
1803extern int send_sig(int, struct task_struct *, int); 1780extern int send_sig(int, struct task_struct *, int);
@@ -1883,9 +1860,13 @@ extern void set_task_comm(struct task_struct *tsk, char *from);
1883extern char *get_task_comm(char *to, struct task_struct *tsk); 1860extern char *get_task_comm(char *to, struct task_struct *tsk);
1884 1861
1885#ifdef CONFIG_SMP 1862#ifdef CONFIG_SMP
1886extern void wait_task_inactive(struct task_struct * p); 1863extern unsigned long wait_task_inactive(struct task_struct *, long match_state);
1887#else 1864#else
1888#define wait_task_inactive(p) do { } while (0) 1865static inline unsigned long wait_task_inactive(struct task_struct *p,
1866 long match_state)
1867{
1868 return 1;
1869}
1889#endif 1870#endif
1890 1871
1891#define next_task(p) list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks) 1872#define next_task(p) list_entry(rcu_dereference((p)->tasks.next), struct task_struct, tasks)
@@ -2139,16 +2120,7 @@ static inline void set_task_cpu(struct task_struct *p, unsigned int cpu)
2139 2120
2140#endif /* CONFIG_SMP */ 2121#endif /* CONFIG_SMP */
2141 2122
2142#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
2143extern void arch_pick_mmap_layout(struct mm_struct *mm); 2123extern void arch_pick_mmap_layout(struct mm_struct *mm);
2144#else
2145static inline void arch_pick_mmap_layout(struct mm_struct *mm)
2146{
2147 mm->mmap_base = TASK_UNMAPPED_BASE;
2148 mm->get_unmapped_area = arch_get_unmapped_area;
2149 mm->unmap_area = arch_unmap_area;
2150}
2151#endif
2152 2124
2153#ifdef CONFIG_TRACING 2125#ifdef CONFIG_TRACING
2154extern void 2126extern void
@@ -2196,22 +2168,22 @@ extern long sched_group_rt_period(struct task_group *tg);
2196#ifdef CONFIG_TASK_XACCT 2168#ifdef CONFIG_TASK_XACCT
2197static inline void add_rchar(struct task_struct *tsk, ssize_t amt) 2169static inline void add_rchar(struct task_struct *tsk, ssize_t amt)
2198{ 2170{
2199 tsk->rchar += amt; 2171 tsk->ioac.rchar += amt;
2200} 2172}
2201 2173
2202static inline void add_wchar(struct task_struct *tsk, ssize_t amt) 2174static inline void add_wchar(struct task_struct *tsk, ssize_t amt)
2203{ 2175{
2204 tsk->wchar += amt; 2176 tsk->ioac.wchar += amt;
2205} 2177}
2206 2178
2207static inline void inc_syscr(struct task_struct *tsk) 2179static inline void inc_syscr(struct task_struct *tsk)
2208{ 2180{
2209 tsk->syscr++; 2181 tsk->ioac.syscr++;
2210} 2182}
2211 2183
2212static inline void inc_syscw(struct task_struct *tsk) 2184static inline void inc_syscw(struct task_struct *tsk)
2213{ 2185{
2214 tsk->syscw++; 2186 tsk->ioac.syscw++;
2215} 2187}
2216#else 2188#else
2217static inline void add_rchar(struct task_struct *tsk, ssize_t amt) 2189static inline void add_rchar(struct task_struct *tsk, ssize_t amt)
@@ -2231,14 +2203,6 @@ static inline void inc_syscw(struct task_struct *tsk)
2231} 2203}
2232#endif 2204#endif
2233 2205
2234#ifdef CONFIG_SMP
2235void migration_init(void);
2236#else
2237static inline void migration_init(void)
2238{
2239}
2240#endif
2241
2242#ifndef TASK_SIZE_OF 2206#ifndef TASK_SIZE_OF
2243#define TASK_SIZE_OF(tsk) TASK_SIZE 2207#define TASK_SIZE_OF(tsk) TASK_SIZE
2244#endif 2208#endif
diff --git a/include/linux/security.h b/include/linux/security.h
index f0e9adb22ac2..f5c4a51eb42e 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -46,8 +46,8 @@ struct audit_krule;
46 */ 46 */
47extern int cap_capable(struct task_struct *tsk, int cap); 47extern int cap_capable(struct task_struct *tsk, int cap);
48extern int cap_settime(struct timespec *ts, struct timezone *tz); 48extern int cap_settime(struct timespec *ts, struct timezone *tz);
49extern int cap_ptrace(struct task_struct *parent, struct task_struct *child, 49extern int cap_ptrace_may_access(struct task_struct *child, unsigned int mode);
50 unsigned int mode); 50extern 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); 51extern 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); 52extern int cap_capset_check(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
53extern void cap_capset_set(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 53extern void cap_capset_set(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
@@ -1157,17 +1157,24 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1157 * @alter contains the flag indicating whether changes are to be made. 1157 * @alter contains the flag indicating whether changes are to be made.
1158 * Return 0 if permission is granted. 1158 * Return 0 if permission is granted.
1159 * 1159 *
1160 * @ptrace: 1160 * @ptrace_may_access:
1161 * Check permission before allowing the @parent process to trace the 1161 * Check permission before allowing the current process to trace the
1162 * @child process. 1162 * @child process.
1163 * Security modules may also want to perform a process tracing check 1163 * Security modules may also want to perform a process tracing check
1164 * during an execve in the set_security or apply_creds hooks of 1164 * during an execve in the set_security or apply_creds hooks of
1165 * binprm_security_ops if the process is being traced and its security 1165 * binprm_security_ops if the process is being traced and its security
1166 * attributes would be changed by the execve. 1166 * attributes would be changed by the execve.
1167 * @parent contains the task_struct structure for parent process. 1167 * @child contains the task_struct structure for the target process.
1168 * @child contains the task_struct structure for child process.
1169 * @mode contains the PTRACE_MODE flags indicating the form of access. 1168 * @mode contains the PTRACE_MODE flags indicating the form of access.
1170 * Return 0 if permission is granted. 1169 * Return 0 if permission is granted.
1170 * @ptrace_traceme:
1171 * Check that the @parent process has sufficient permission to trace the
1172 * current process before allowing the current process to present itself
1173 * to the @parent process for tracing.
1174 * The parent process will still have to undergo the ptrace_may_access
1175 * checks before it is allowed to trace this one.
1176 * @parent contains the task_struct structure for debugger process.
1177 * Return 0 if permission is granted.
1171 * @capget: 1178 * @capget:
1172 * Get the @effective, @inheritable, and @permitted capability sets for 1179 * Get the @effective, @inheritable, and @permitted capability sets for
1173 * the @target process. The hook may also perform permission checking to 1180 * the @target process. The hook may also perform permission checking to
@@ -1287,8 +1294,8 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1287struct security_operations { 1294struct security_operations {
1288 char name[SECURITY_NAME_MAX + 1]; 1295 char name[SECURITY_NAME_MAX + 1];
1289 1296
1290 int (*ptrace) (struct task_struct *parent, struct task_struct *child, 1297 int (*ptrace_may_access) (struct task_struct *child, unsigned int mode);
1291 unsigned int mode); 1298 int (*ptrace_traceme) (struct task_struct *parent);
1292 int (*capget) (struct task_struct *target, 1299 int (*capget) (struct task_struct *target,
1293 kernel_cap_t *effective, 1300 kernel_cap_t *effective,
1294 kernel_cap_t *inheritable, kernel_cap_t *permitted); 1301 kernel_cap_t *inheritable, kernel_cap_t *permitted);
@@ -1362,7 +1369,7 @@ struct security_operations {
1362 struct inode *new_dir, struct dentry *new_dentry); 1369 struct inode *new_dir, struct dentry *new_dentry);
1363 int (*inode_readlink) (struct dentry *dentry); 1370 int (*inode_readlink) (struct dentry *dentry);
1364 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd); 1371 int (*inode_follow_link) (struct dentry *dentry, struct nameidata *nd);
1365 int (*inode_permission) (struct inode *inode, int mask, struct nameidata *nd); 1372 int (*inode_permission) (struct inode *inode, int mask);
1366 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr); 1373 int (*inode_setattr) (struct dentry *dentry, struct iattr *attr);
1367 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry); 1374 int (*inode_getattr) (struct vfsmount *mnt, struct dentry *dentry);
1368 void (*inode_delete) (struct inode *inode); 1375 void (*inode_delete) (struct inode *inode);
@@ -1553,15 +1560,10 @@ struct security_operations {
1553extern int security_init(void); 1560extern int security_init(void);
1554extern int security_module_enable(struct security_operations *ops); 1561extern int security_module_enable(struct security_operations *ops);
1555extern int register_security(struct security_operations *ops); 1562extern int register_security(struct security_operations *ops);
1556extern struct dentry *securityfs_create_file(const char *name, mode_t mode,
1557 struct dentry *parent, void *data,
1558 const struct file_operations *fops);
1559extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent);
1560extern void securityfs_remove(struct dentry *dentry);
1561 1563
1562/* Security operations */ 1564/* Security operations */
1563int security_ptrace(struct task_struct *parent, struct task_struct *child, 1565int security_ptrace_may_access(struct task_struct *child, unsigned int mode);
1564 unsigned int mode); 1566int security_ptrace_traceme(struct task_struct *parent);
1565int security_capget(struct task_struct *target, 1567int security_capget(struct task_struct *target,
1566 kernel_cap_t *effective, 1568 kernel_cap_t *effective,
1567 kernel_cap_t *inheritable, 1569 kernel_cap_t *inheritable,
@@ -1628,7 +1630,7 @@ int security_inode_rename(struct inode *old_dir, struct dentry *old_dentry,
1628 struct inode *new_dir, struct dentry *new_dentry); 1630 struct inode *new_dir, struct dentry *new_dentry);
1629int security_inode_readlink(struct dentry *dentry); 1631int security_inode_readlink(struct dentry *dentry);
1630int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd); 1632int security_inode_follow_link(struct dentry *dentry, struct nameidata *nd);
1631int security_inode_permission(struct inode *inode, int mask, struct nameidata *nd); 1633int security_inode_permission(struct inode *inode, int mask);
1632int security_inode_setattr(struct dentry *dentry, struct iattr *attr); 1634int security_inode_setattr(struct dentry *dentry, struct iattr *attr);
1633int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry); 1635int security_inode_getattr(struct vfsmount *mnt, struct dentry *dentry);
1634void security_inode_delete(struct inode *inode); 1636void security_inode_delete(struct inode *inode);
@@ -1742,11 +1744,15 @@ static inline int security_init(void)
1742 return 0; 1744 return 0;
1743} 1745}
1744 1746
1745static inline int security_ptrace(struct task_struct *parent, 1747static inline int security_ptrace_may_access(struct task_struct *child,
1746 struct task_struct *child, 1748 unsigned int mode)
1747 unsigned int mode)
1748{ 1749{
1749 return cap_ptrace(parent, child, mode); 1750 return cap_ptrace_may_access(child, mode);
1751}
1752
1753static inline int security_ptrace_traceme(struct task_struct *parent)
1754{
1755 return cap_ptrace_traceme(parent);
1750} 1756}
1751 1757
1752static inline int security_capget(struct task_struct *target, 1758static inline int security_capget(struct task_struct *target,
@@ -2021,8 +2027,7 @@ static inline int security_inode_follow_link(struct dentry *dentry,
2021 return 0; 2027 return 0;
2022} 2028}
2023 2029
2024static inline int security_inode_permission(struct inode *inode, int mask, 2030static inline int security_inode_permission(struct inode *inode, int mask)
2025 struct nameidata *nd)
2026{ 2031{
2027 return 0; 2032 return 0;
2028} 2033}
@@ -2414,25 +2419,6 @@ static inline int security_netlink_recv(struct sk_buff *skb, int cap)
2414 return cap_netlink_recv(skb, cap); 2419 return cap_netlink_recv(skb, cap);
2415} 2420}
2416 2421
2417static inline struct dentry *securityfs_create_dir(const char *name,
2418 struct dentry *parent)
2419{
2420 return ERR_PTR(-ENODEV);
2421}
2422
2423static inline struct dentry *securityfs_create_file(const char *name,
2424 mode_t mode,
2425 struct dentry *parent,
2426 void *data,
2427 const struct file_operations *fops)
2428{
2429 return ERR_PTR(-ENODEV);
2430}
2431
2432static inline void securityfs_remove(struct dentry *dentry)
2433{
2434}
2435
2436static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) 2422static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
2437{ 2423{
2438 return -EOPNOTSUPP; 2424 return -EOPNOTSUPP;
@@ -2796,5 +2782,35 @@ static inline void security_audit_rule_free(void *lsmrule)
2796#endif /* CONFIG_SECURITY */ 2782#endif /* CONFIG_SECURITY */
2797#endif /* CONFIG_AUDIT */ 2783#endif /* CONFIG_AUDIT */
2798 2784
2785#ifdef CONFIG_SECURITYFS
2786
2787extern struct dentry *securityfs_create_file(const char *name, mode_t mode,
2788 struct dentry *parent, void *data,
2789 const struct file_operations *fops);
2790extern struct dentry *securityfs_create_dir(const char *name, struct dentry *parent);
2791extern void securityfs_remove(struct dentry *dentry);
2792
2793#else /* CONFIG_SECURITYFS */
2794
2795static inline struct dentry *securityfs_create_dir(const char *name,
2796 struct dentry *parent)
2797{
2798 return ERR_PTR(-ENODEV);
2799}
2800
2801static inline struct dentry *securityfs_create_file(const char *name,
2802 mode_t mode,
2803 struct dentry *parent,
2804 void *data,
2805 const struct file_operations *fops)
2806{
2807 return ERR_PTR(-ENODEV);
2808}
2809
2810static inline void securityfs_remove(struct dentry *dentry)
2811{}
2812
2813#endif
2814
2799#endif /* ! __LINUX_SECURITY_H */ 2815#endif /* ! __LINUX_SECURITY_H */
2800 2816
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index a66304a09955..a1783b229ef4 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -4,6 +4,8 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/string.h> 5#include <linux/string.h>
6#include <linux/mutex.h> 6#include <linux/mutex.h>
7#include <linux/cpumask.h>
8#include <linux/nodemask.h>
7 9
8struct seq_operations; 10struct seq_operations;
9struct file; 11struct file;
@@ -47,6 +49,16 @@ int seq_path(struct seq_file *, struct path *, char *);
47int seq_dentry(struct seq_file *, struct dentry *, char *); 49int seq_dentry(struct seq_file *, struct dentry *, char *);
48int seq_path_root(struct seq_file *m, struct path *path, struct path *root, 50int seq_path_root(struct seq_file *m, struct path *path, struct path *root,
49 char *esc); 51 char *esc);
52int seq_bitmap(struct seq_file *m, unsigned long *bits, unsigned int nr_bits);
53static inline int seq_cpumask(struct seq_file *m, cpumask_t *mask)
54{
55 return seq_bitmap(m, mask->bits, NR_CPUS);
56}
57
58static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask)
59{
60 return seq_bitmap(m, mask->bits, MAX_NUMNODES);
61}
50 62
51int single_open(struct file *, int (*)(struct seq_file *, void *), void *); 63int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
52int single_release(struct inode *, struct file *); 64int single_release(struct inode *, struct file *);
diff --git a/include/linux/serio.h b/include/linux/serio.h
index e72716cca577..25641d9e0ea8 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -87,11 +87,10 @@ void serio_unregister_port(struct serio *serio);
87void serio_unregister_child_port(struct serio *serio); 87void serio_unregister_child_port(struct serio *serio);
88 88
89int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name); 89int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name);
90static inline int serio_register_driver(struct serio_driver *drv) 90static inline int __must_check serio_register_driver(struct serio_driver *drv)
91{ 91{
92 return __serio_register_driver(drv, THIS_MODULE, KBUILD_MODNAME); 92 return __serio_register_driver(drv, THIS_MODULE, KBUILD_MODNAME);
93} 93}
94int serio_register_driver(struct serio_driver *drv);
95void serio_unregister_driver(struct serio_driver *drv); 94void serio_unregister_driver(struct serio_driver *drv);
96 95
97static inline int serio_write(struct serio *serio, unsigned char data) 96static inline int serio_write(struct serio *serio, unsigned char data)
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index f2d12d5a21b8..fd83f2584b15 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -43,7 +43,7 @@ static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
43} 43}
44 44
45#ifdef CONFIG_TMPFS_POSIX_ACL 45#ifdef CONFIG_TMPFS_POSIX_ACL
46int shmem_permission(struct inode *, int, struct nameidata *); 46int shmem_permission(struct inode *, int);
47int shmem_acl_init(struct inode *, struct inode *); 47int shmem_acl_init(struct inode *, struct inode *);
48void shmem_acl_destroy_inode(struct inode *); 48void shmem_acl_destroy_inode(struct inode *);
49 49
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 7ea44f6621f2..2725f4e5a9bf 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -146,8 +146,14 @@ struct skb_shared_info {
146 unsigned short gso_segs; 146 unsigned short gso_segs;
147 unsigned short gso_type; 147 unsigned short gso_type;
148 __be32 ip6_frag_id; 148 __be32 ip6_frag_id;
149#ifdef CONFIG_HAS_DMA
150 unsigned int num_dma_maps;
151#endif
149 struct sk_buff *frag_list; 152 struct sk_buff *frag_list;
150 skb_frag_t frags[MAX_SKB_FRAGS]; 153 skb_frag_t frags[MAX_SKB_FRAGS];
154#ifdef CONFIG_HAS_DMA
155 dma_addr_t dma_maps[MAX_SKB_FRAGS + 1];
156#endif
151}; 157};
152 158
153/* We divide dataref into two halves. The higher 16 bits hold references 159/* We divide dataref into two halves. The higher 16 bits hold references
@@ -243,6 +249,7 @@ typedef unsigned char *sk_buff_data_t;
243 * @tc_index: Traffic control index 249 * @tc_index: Traffic control index
244 * @tc_verd: traffic control verdict 250 * @tc_verd: traffic control verdict
245 * @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
246 * @dma_cookie: a cookie to one of several possible DMA operations 253 * @dma_cookie: a cookie to one of several possible DMA operations
247 * done by skb DMA functions 254 * done by skb DMA functions
248 * @secmark: security marking 255 * @secmark: security marking
@@ -316,7 +323,10 @@ struct sk_buff {
316#ifdef CONFIG_IPV6_NDISC_NODETYPE 323#ifdef CONFIG_IPV6_NDISC_NODETYPE
317 __u8 ndisc_nodetype:2; 324 __u8 ndisc_nodetype:2;
318#endif 325#endif
319 /* 14 bit hole */ 326#if defined(CONFIG_MAC80211) || defined(CONFIG_MAC80211_MODULE)
327 __u8 do_not_encrypt:1;
328#endif
329 /* 0/13/14 bit hole */
320 330
321#ifdef CONFIG_NET_DMA 331#ifdef CONFIG_NET_DMA
322 dma_cookie_t dma_cookie; 332 dma_cookie_t dma_cookie;
@@ -349,6 +359,14 @@ struct sk_buff {
349 359
350#include <asm/system.h> 360#include <asm/system.h>
351 361
362#ifdef CONFIG_HAS_DMA
363#include <linux/dma-mapping.h>
364extern int skb_dma_map(struct device *dev, struct sk_buff *skb,
365 enum dma_data_direction dir);
366extern void skb_dma_unmap(struct device *dev, struct sk_buff *skb,
367 enum dma_data_direction dir);
368#endif
369
352extern void kfree_skb(struct sk_buff *skb); 370extern void kfree_skb(struct sk_buff *skb);
353extern void __kfree_skb(struct sk_buff *skb); 371extern void __kfree_skb(struct sk_buff *skb);
354extern struct sk_buff *__alloc_skb(unsigned int size, 372extern struct sk_buff *__alloc_skb(unsigned int size,
@@ -365,6 +383,8 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
365 return __alloc_skb(size, priority, 1, -1); 383 return __alloc_skb(size, priority, 1, -1);
366} 384}
367 385
386extern int skb_recycle_check(struct sk_buff *skb, int skb_size);
387
368extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); 388extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
369extern struct sk_buff *skb_clone(struct sk_buff *skb, 389extern struct sk_buff *skb_clone(struct sk_buff *skb,
370 gfp_t priority); 390 gfp_t priority);
@@ -455,6 +475,37 @@ static inline int skb_queue_empty(const struct sk_buff_head *list)
455} 475}
456 476
457/** 477/**
478 * skb_queue_is_last - check if skb is the last entry in the queue
479 * @list: queue head
480 * @skb: buffer
481 *
482 * Returns true if @skb is the last buffer on the list.
483 */
484static inline bool skb_queue_is_last(const struct sk_buff_head *list,
485 const struct sk_buff *skb)
486{
487 return (skb->next == (struct sk_buff *) list);
488}
489
490/**
491 * skb_queue_next - return the next packet in the queue
492 * @list: queue head
493 * @skb: current buffer
494 *
495 * Return the next packet in @list after @skb. It is only valid to
496 * call this if skb_queue_is_last() evaluates to false.
497 */
498static inline struct sk_buff *skb_queue_next(const struct sk_buff_head *list,
499 const struct sk_buff *skb)
500{
501 /* This BUG_ON may seem severe, but if we just return then we
502 * are going to dereference garbage.
503 */
504 BUG_ON(skb_queue_is_last(list, skb));
505 return skb->next;
506}
507
508/**
458 * skb_get - reference buffer 509 * skb_get - reference buffer
459 * @skb: buffer to reference 510 * @skb: buffer to reference
460 * 511 *
@@ -642,6 +693,22 @@ static inline __u32 skb_queue_len(const struct sk_buff_head *list_)
642 return list_->qlen; 693 return list_->qlen;
643} 694}
644 695
696/**
697 * __skb_queue_head_init - initialize non-spinlock portions of sk_buff_head
698 * @list: queue to initialize
699 *
700 * This initializes only the list and queue length aspects of
701 * an sk_buff_head object. This allows to initialize the list
702 * aspects of an sk_buff_head without reinitializing things like
703 * the spinlock. It can also be used for on-stack sk_buff_head
704 * objects where the spinlock is known to not be used.
705 */
706static inline void __skb_queue_head_init(struct sk_buff_head *list)
707{
708 list->prev = list->next = (struct sk_buff *)list;
709 list->qlen = 0;
710}
711
645/* 712/*
646 * This function creates a split out lock class for each invocation; 713 * This function creates a split out lock class for each invocation;
647 * this is needed for now since a whole lot of users of the skb-queue 714 * this is needed for now since a whole lot of users of the skb-queue
@@ -653,8 +720,7 @@ static inline __u32 skb_queue_len(const struct sk_buff_head *list_)
653static inline void skb_queue_head_init(struct sk_buff_head *list) 720static inline void skb_queue_head_init(struct sk_buff_head *list)
654{ 721{
655 spin_lock_init(&list->lock); 722 spin_lock_init(&list->lock);
656 list->prev = list->next = (struct sk_buff *)list; 723 __skb_queue_head_init(list);
657 list->qlen = 0;
658} 724}
659 725
660static inline void skb_queue_head_init_class(struct sk_buff_head *list, 726static inline void skb_queue_head_init_class(struct sk_buff_head *list,
@@ -681,6 +747,83 @@ static inline void __skb_insert(struct sk_buff *newsk,
681 list->qlen++; 747 list->qlen++;
682} 748}
683 749
750static inline void __skb_queue_splice(const struct sk_buff_head *list,
751 struct sk_buff *prev,
752 struct sk_buff *next)
753{
754 struct sk_buff *first = list->next;
755 struct sk_buff *last = list->prev;
756
757 first->prev = prev;
758 prev->next = first;
759
760 last->next = next;
761 next->prev = last;
762}
763
764/**
765 * skb_queue_splice - join two skb lists, this is designed for stacks
766 * @list: the new list to add
767 * @head: the place to add it in the first list
768 */
769static inline void skb_queue_splice(const struct sk_buff_head *list,
770 struct sk_buff_head *head)
771{
772 if (!skb_queue_empty(list)) {
773 __skb_queue_splice(list, (struct sk_buff *) head, head->next);
774 head->qlen += list->qlen;
775 }
776}
777
778/**
779 * skb_queue_splice - join two skb lists and reinitialise the emptied list
780 * @list: the new list to add
781 * @head: the place to add it in the first list
782 *
783 * The list at @list is reinitialised
784 */
785static inline void skb_queue_splice_init(struct sk_buff_head *list,
786 struct sk_buff_head *head)
787{
788 if (!skb_queue_empty(list)) {
789 __skb_queue_splice(list, (struct sk_buff *) head, head->next);
790 head->qlen += list->qlen;
791 __skb_queue_head_init(list);
792 }
793}
794
795/**
796 * skb_queue_splice_tail - join two skb lists, each list being a queue
797 * @list: the new list to add
798 * @head: the place to add it in the first list
799 */
800static inline void skb_queue_splice_tail(const struct sk_buff_head *list,
801 struct sk_buff_head *head)
802{
803 if (!skb_queue_empty(list)) {
804 __skb_queue_splice(list, head->prev, (struct sk_buff *) head);
805 head->qlen += list->qlen;
806 }
807}
808
809/**
810 * skb_queue_splice_tail - join two skb lists and reinitialise the emptied list
811 * @list: the new list to add
812 * @head: the place to add it in the first list
813 *
814 * Each of the lists is a queue.
815 * The list at @list is reinitialised
816 */
817static inline void skb_queue_splice_tail_init(struct sk_buff_head *list,
818 struct sk_buff_head *head)
819{
820 if (!skb_queue_empty(list)) {
821 __skb_queue_splice(list, head->prev, (struct sk_buff *) head);
822 head->qlen += list->qlen;
823 __skb_queue_head_init(list);
824 }
825}
826
684/** 827/**
685 * __skb_queue_after - queue a buffer at the list head 828 * __skb_queue_after - queue a buffer at the list head
686 * @list: list to use 829 * @list: list to use
@@ -825,6 +968,9 @@ static inline void skb_fill_page_desc(struct sk_buff *skb, int i,
825 skb_shinfo(skb)->nr_frags = i + 1; 968 skb_shinfo(skb)->nr_frags = i + 1;
826} 969}
827 970
971extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page,
972 int off, int size);
973
828#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags) 974#define SKB_PAGE_ASSERT(skb) BUG_ON(skb_shinfo(skb)->nr_frags)
829#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list) 975#define SKB_FRAG_ASSERT(skb) BUG_ON(skb_shinfo(skb)->frag_list)
830#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb)) 976#define SKB_LINEAR_ASSERT(skb) BUG_ON(skb_is_nonlinear(skb))
@@ -897,7 +1043,7 @@ extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta);
897static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) 1043static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len)
898{ 1044{
899 if (len > skb_headlen(skb) && 1045 if (len > skb_headlen(skb) &&
900 !__pskb_pull_tail(skb, len-skb_headlen(skb))) 1046 !__pskb_pull_tail(skb, len - skb_headlen(skb)))
901 return NULL; 1047 return NULL;
902 skb->len -= len; 1048 skb->len -= len;
903 return skb->data += len; 1049 return skb->data += len;
@@ -914,7 +1060,7 @@ static inline int pskb_may_pull(struct sk_buff *skb, unsigned int len)
914 return 1; 1060 return 1;
915 if (unlikely(len > skb->len)) 1061 if (unlikely(len > skb->len))
916 return 0; 1062 return 0;
917 return __pskb_pull_tail(skb, len-skb_headlen(skb)) != NULL; 1063 return __pskb_pull_tail(skb, len - skb_headlen(skb)) != NULL;
918} 1064}
919 1065
920/** 1066/**
@@ -1239,6 +1385,26 @@ static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
1239 return __netdev_alloc_skb(dev, length, GFP_ATOMIC); 1385 return __netdev_alloc_skb(dev, length, GFP_ATOMIC);
1240} 1386}
1241 1387
1388extern struct page *__netdev_alloc_page(struct net_device *dev, gfp_t gfp_mask);
1389
1390/**
1391 * netdev_alloc_page - allocate a page for ps-rx on a specific device
1392 * @dev: network device to receive on
1393 *
1394 * Allocate a new page node local to the specified device.
1395 *
1396 * %NULL is returned if there is no free memory.
1397 */
1398static inline struct page *netdev_alloc_page(struct net_device *dev)
1399{
1400 return __netdev_alloc_page(dev, GFP_ATOMIC);
1401}
1402
1403static inline void netdev_free_page(struct net_device *dev, struct page *page)
1404{
1405 __free_page(page);
1406}
1407
1242/** 1408/**
1243 * skb_clone_writable - is the header of a clone writable 1409 * skb_clone_writable - is the header of a clone writable
1244 * @skb: buffer to check 1410 * @skb: buffer to check
@@ -1317,7 +1483,7 @@ static inline int skb_padto(struct sk_buff *skb, unsigned int len)
1317 unsigned int size = skb->len; 1483 unsigned int size = skb->len;
1318 if (likely(size >= len)) 1484 if (likely(size >= len))
1319 return 0; 1485 return 0;
1320 return skb_pad(skb, len-size); 1486 return skb_pad(skb, len - size);
1321} 1487}
1322 1488
1323static inline int skb_add_data(struct sk_buff *skb, 1489static inline int skb_add_data(struct sk_buff *skb,
@@ -1430,6 +1596,15 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
1430 skb != (struct sk_buff *)(queue); \ 1596 skb != (struct sk_buff *)(queue); \
1431 skb = tmp, tmp = skb->next) 1597 skb = tmp, tmp = skb->next)
1432 1598
1599#define skb_queue_walk_from(queue, skb) \
1600 for (; prefetch(skb->next), (skb != (struct sk_buff *)(queue)); \
1601 skb = skb->next)
1602
1603#define skb_queue_walk_from_safe(queue, skb, tmp) \
1604 for (tmp = skb->next; \
1605 skb != (struct sk_buff *)(queue); \
1606 skb = tmp, tmp = skb->next)
1607
1433#define skb_queue_reverse_walk(queue, skb) \ 1608#define skb_queue_reverse_walk(queue, skb) \
1434 for (skb = (queue)->prev; \ 1609 for (skb = (queue)->prev; \
1435 prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \ 1610 prefetch(skb->prev), (skb != (struct sk_buff *)(queue)); \
@@ -1448,6 +1623,10 @@ extern int skb_copy_datagram_iovec(const struct sk_buff *from,
1448extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, 1623extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
1449 int hlen, 1624 int hlen,
1450 struct iovec *iov); 1625 struct iovec *iov);
1626extern int skb_copy_datagram_from_iovec(struct sk_buff *skb,
1627 int offset,
1628 struct iovec *from,
1629 int len);
1451extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); 1630extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb);
1452extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, 1631extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb,
1453 unsigned int flags); 1632 unsigned int flags);
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 41103910f8a2..5ff9676c1e2c 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -58,7 +58,7 @@ int slab_is_available(void);
58 58
59struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, 59struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
60 unsigned long, 60 unsigned long,
61 void (*)(struct kmem_cache *, void *)); 61 void (*)(void *));
62void kmem_cache_destroy(struct kmem_cache *); 62void kmem_cache_destroy(struct kmem_cache *);
63int kmem_cache_shrink(struct kmem_cache *); 63int kmem_cache_shrink(struct kmem_cache *);
64void kmem_cache_free(struct kmem_cache *, void *); 64void kmem_cache_free(struct kmem_cache *, void *);
@@ -96,6 +96,7 @@ int kmem_ptr_validate(struct kmem_cache *cachep, const void *ptr);
96/* 96/*
97 * Common kmalloc functions provided by all allocators 97 * Common kmalloc functions provided by all allocators
98 */ 98 */
99void * __must_check __krealloc(const void *, size_t, gfp_t);
99void * __must_check krealloc(const void *, size_t, gfp_t); 100void * __must_check krealloc(const void *, size_t, gfp_t);
100void kfree(const void *); 101void kfree(const void *);
101size_t ksize(const void *); 102size_t ksize(const void *);
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index d117ea2825a9..2f5c16b1aacd 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -46,6 +46,7 @@ struct kmem_cache_cpu {
46struct kmem_cache_node { 46struct kmem_cache_node {
47 spinlock_t list_lock; /* Protect partial list and nr_partial */ 47 spinlock_t list_lock; /* Protect partial list and nr_partial */
48 unsigned long nr_partial; 48 unsigned long nr_partial;
49 unsigned long min_partial;
49 struct list_head partial; 50 struct list_head partial;
50#ifdef CONFIG_SLUB_DEBUG 51#ifdef CONFIG_SLUB_DEBUG
51 atomic_long_t nr_slabs; 52 atomic_long_t nr_slabs;
@@ -85,7 +86,7 @@ struct kmem_cache {
85 struct kmem_cache_order_objects min; 86 struct kmem_cache_order_objects min;
86 gfp_t allocflags; /* gfp flags to use on each alloc */ 87 gfp_t allocflags; /* gfp flags to use on each alloc */
87 int refcount; /* Refcount for slab cache destroy */ 88 int refcount; /* Refcount for slab cache destroy */
88 void (*ctor)(struct kmem_cache *, void *); 89 void (*ctor)(void *);
89 int inuse; /* Offset to metadata */ 90 int inuse; /* Offset to metadata */
90 int align; /* Alignment */ 91 int align; /* Alignment */
91 const char *name; /* Name (only for display!) */ 92 const char *name; /* Name (only for display!) */
diff --git a/include/linux/smb.h b/include/linux/smb.h
index caa43b2370cb..82fefddc5987 100644
--- a/include/linux/smb.h
+++ b/include/linux/smb.h
@@ -11,7 +11,9 @@
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/magic.h> 13#include <linux/magic.h>
14#ifdef __KERNEL__
14#include <linux/time.h> 15#include <linux/time.h>
16#endif
15 17
16enum smb_protocol { 18enum smb_protocol {
17 SMB_PROTOCOL_NONE, 19 SMB_PROTOCOL_NONE,
diff --git a/include/linux/smc91x.h b/include/linux/smc91x.h
index 3827b922ba1f..bc21db598c06 100644
--- a/include/linux/smc91x.h
+++ b/include/linux/smc91x.h
@@ -16,8 +16,19 @@
16 16
17#define SMC91X_USE_DMA (1 << 6) 17#define SMC91X_USE_DMA (1 << 6)
18 18
19#define RPC_LED_100_10 (0x00) /* LED = 100Mbps OR's with 10Mbps link detect */
20#define RPC_LED_RES (0x01) /* LED = Reserved */
21#define RPC_LED_10 (0x02) /* LED = 10Mbps link detect */
22#define RPC_LED_FD (0x03) /* LED = Full Duplex Mode */
23#define RPC_LED_TX_RX (0x04) /* LED = TX or RX packet occurred */
24#define RPC_LED_100 (0x05) /* LED = 100Mbps link dectect */
25#define RPC_LED_TX (0x06) /* LED = TX packet occurred */
26#define RPC_LED_RX (0x07) /* LED = RX packet occurred */
27
19struct smc91x_platdata { 28struct smc91x_platdata {
20 unsigned long flags; 29 unsigned long flags;
30 unsigned char leda;
31 unsigned char ledb;
21}; 32};
22 33
23#endif /* __SMC91X_H__ */ 34#endif /* __SMC91X_H__ */
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 48262f86c969..66484d4a8459 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -74,15 +74,10 @@ void __smp_call_function_single(int cpuid, struct call_single_data *data);
74#ifdef CONFIG_USE_GENERIC_SMP_HELPERS 74#ifdef CONFIG_USE_GENERIC_SMP_HELPERS
75void generic_smp_call_function_single_interrupt(void); 75void generic_smp_call_function_single_interrupt(void);
76void generic_smp_call_function_interrupt(void); 76void generic_smp_call_function_interrupt(void);
77void init_call_single_data(void);
78void ipi_call_lock(void); 77void ipi_call_lock(void);
79void ipi_call_unlock(void); 78void ipi_call_unlock(void);
80void ipi_call_lock_irq(void); 79void ipi_call_lock_irq(void);
81void ipi_call_unlock_irq(void); 80void ipi_call_unlock_irq(void);
82#else
83static inline void init_call_single_data(void)
84{
85}
86#endif 81#endif
87 82
88/* 83/*
diff --git a/include/linux/snmp.h b/include/linux/snmp.h
index 5df62ef1280c..7a6e6bba4a71 100644
--- a/include/linux/snmp.h
+++ b/include/linux/snmp.h
@@ -214,6 +214,8 @@ enum
214 LINUX_MIB_TCPDSACKIGNOREDOLD, /* TCPSACKIgnoredOld */ 214 LINUX_MIB_TCPDSACKIGNOREDOLD, /* TCPSACKIgnoredOld */
215 LINUX_MIB_TCPDSACKIGNOREDNOUNDO, /* TCPSACKIgnoredNoUndo */ 215 LINUX_MIB_TCPDSACKIGNOREDNOUNDO, /* TCPSACKIgnoredNoUndo */
216 LINUX_MIB_TCPSPURIOUSRTOS, /* TCPSpuriousRTOs */ 216 LINUX_MIB_TCPSPURIOUSRTOS, /* TCPSpuriousRTOs */
217 LINUX_MIB_TCPMD5NOTFOUND, /* TCPMD5NotFound */
218 LINUX_MIB_TCPMD5UNEXPECTED, /* TCPMD5Unexpected */
217 __LINUX_MIB_MAX 219 __LINUX_MIB_MAX
218}; 220};
219 221
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 950af631e7fb..20fc4bbfca42 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -189,7 +189,9 @@ struct ucred {
189#define AF_BLUETOOTH 31 /* Bluetooth sockets */ 189#define AF_BLUETOOTH 31 /* Bluetooth sockets */
190#define AF_IUCV 32 /* IUCV sockets */ 190#define AF_IUCV 32 /* IUCV sockets */
191#define AF_RXRPC 33 /* RxRPC sockets */ 191#define AF_RXRPC 33 /* RxRPC sockets */
192#define AF_MAX 34 /* For now.. */ 192#define AF_ISDN 34 /* mISDN sockets */
193#define AF_PHONET 35 /* Phonet sockets */
194#define AF_MAX 36 /* For now.. */
193 195
194/* Protocol families, same as address families. */ 196/* Protocol families, same as address families. */
195#define PF_UNSPEC AF_UNSPEC 197#define PF_UNSPEC AF_UNSPEC
@@ -225,6 +227,8 @@ struct ucred {
225#define PF_BLUETOOTH AF_BLUETOOTH 227#define PF_BLUETOOTH AF_BLUETOOTH
226#define PF_IUCV AF_IUCV 228#define PF_IUCV AF_IUCV
227#define PF_RXRPC AF_RXRPC 229#define PF_RXRPC AF_RXRPC
230#define PF_ISDN AF_ISDN
231#define PF_PHONET AF_PHONET
228#define PF_MAX AF_MAX 232#define PF_MAX AF_MAX
229 233
230/* Maximum queue length specifiable by listen. */ 234/* Maximum queue length specifiable by listen. */
@@ -293,6 +297,7 @@ struct ucred {
293#define SOL_RXRPC 272 297#define SOL_RXRPC 272
294#define SOL_PPPOL2TP 273 298#define SOL_PPPOL2TP 273
295#define SOL_BLUETOOTH 274 299#define SOL_BLUETOOTH 274
300#define SOL_PNPIPE 275
296 301
297/* IPX options */ 302/* IPX options */
298#define IPX_TYPE 1 303#define IPX_TYPE 1
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h
index daf744017a31..05eab2f11e63 100644
--- a/include/linux/spi/ads7846.h
+++ b/include/linux/spi/ads7846.h
@@ -43,6 +43,9 @@ struct ads7846_platform_data {
43 u16 debounce_tol; /* tolerance used for filtering */ 43 u16 debounce_tol; /* tolerance used for filtering */
44 u16 debounce_rep; /* additional consecutive good readings 44 u16 debounce_rep; /* additional consecutive good readings
45 * required after the first two */ 45 * required after the first two */
46 int gpio_pendown; /* the GPIO used to decide the pendown
47 * state if get_pendown_state == NULL
48 */
46 int (*get_pendown_state)(void); 49 int (*get_pendown_state)(void);
47 int (*filter_init) (struct ads7846_platform_data *pdata, 50 int (*filter_init) (struct ads7846_platform_data *pdata,
48 void **filter_data); 51 void **filter_data);
diff --git a/include/linux/spi/corgi_lcd.h b/include/linux/spi/corgi_lcd.h
new file mode 100644
index 000000000000..6692b3418ccf
--- /dev/null
+++ b/include/linux/spi/corgi_lcd.h
@@ -0,0 +1,20 @@
1#ifndef __LINUX_SPI_CORGI_LCD_H
2#define __LINUX_SPI_CORGI_LCD_H
3
4#define CORGI_LCD_MODE_QVGA 1
5#define CORGI_LCD_MODE_VGA 2
6
7struct corgi_lcd_platform_data {
8 int init_mode;
9 int max_intensity;
10 int default_intensity;
11 int limit_mask;
12
13 int gpio_backlight_on; /* -1 if n/a */
14 int gpio_backlight_cont; /* -1 if n/a */
15
16 void (*notify)(int intensity);
17 void (*kick_battery)(void);
18};
19
20#endif /* __LINUX_SPI_CORGI_LCD_H */
diff --git a/include/linux/spi/orion_spi.h b/include/linux/spi/orion_spi.h
new file mode 100644
index 000000000000..b4d9fa6f797c
--- /dev/null
+++ b/include/linux/spi/orion_spi.h
@@ -0,0 +1,17 @@
1/*
2 * orion_spi.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __LINUX_SPI_ORION_SPI_H
10#define __LINUX_SPI_ORION_SPI_H
11
12struct orion_spi_info {
13 u32 tclk; /* no <linux/clk.h> support yet */
14};
15
16
17#endif
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index a9cc29d46653..4be01bb44377 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -778,8 +778,20 @@ spi_register_board_info(struct spi_board_info const *info, unsigned n)
778 * use spi_new_device() to describe each device. You can also call 778 * use spi_new_device() to describe each device. You can also call
779 * spi_unregister_device() to start making that device vanish, but 779 * spi_unregister_device() to start making that device vanish, but
780 * normally that would be handled by spi_unregister_master(). 780 * normally that would be handled by spi_unregister_master().
781 *
782 * You can also use spi_alloc_device() and spi_add_device() to use a two
783 * stage registration sequence for each spi_device. This gives the caller
784 * some more control over the spi_device structure before it is registered,
785 * but requires that caller to initialize fields that would otherwise
786 * be defined using the board info.
781 */ 787 */
782extern struct spi_device * 788extern struct spi_device *
789spi_alloc_device(struct spi_master *master);
790
791extern int
792spi_add_device(struct spi_device *spi);
793
794extern struct spi_device *
783spi_new_device(struct spi_master *, struct spi_board_info *); 795spi_new_device(struct spi_master *, struct spi_board_info *);
784 796
785static inline void 797static inline void
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 61e5610ad165..e0c0fccced46 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -183,8 +183,14 @@ do { \
183 183
184#ifdef CONFIG_DEBUG_LOCK_ALLOC 184#ifdef CONFIG_DEBUG_LOCK_ALLOC
185# define spin_lock_nested(lock, subclass) _spin_lock_nested(lock, subclass) 185# define spin_lock_nested(lock, subclass) _spin_lock_nested(lock, subclass)
186# define spin_lock_nest_lock(lock, nest_lock) \
187 do { \
188 typecheck(struct lockdep_map *, &(nest_lock)->dep_map);\
189 _spin_lock_nest_lock(lock, &(nest_lock)->dep_map); \
190 } while (0)
186#else 191#else
187# define spin_lock_nested(lock, subclass) _spin_lock(lock) 192# define spin_lock_nested(lock, subclass) _spin_lock(lock)
193# define spin_lock_nest_lock(lock, nest_lock) _spin_lock(lock)
188#endif 194#endif
189 195
190#define write_lock(lock) _write_lock(lock) 196#define write_lock(lock) _write_lock(lock)
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
index 8a2307ce7296..d79845d034b5 100644
--- a/include/linux/spinlock_api_smp.h
+++ b/include/linux/spinlock_api_smp.h
@@ -22,6 +22,8 @@ int in_lock_functions(unsigned long addr);
22void __lockfunc _spin_lock(spinlock_t *lock) __acquires(lock); 22void __lockfunc _spin_lock(spinlock_t *lock) __acquires(lock);
23void __lockfunc _spin_lock_nested(spinlock_t *lock, int subclass) 23void __lockfunc _spin_lock_nested(spinlock_t *lock, int subclass)
24 __acquires(lock); 24 __acquires(lock);
25void __lockfunc _spin_lock_nest_lock(spinlock_t *lock, struct lockdep_map *map)
26 __acquires(lock);
25void __lockfunc _read_lock(rwlock_t *lock) __acquires(lock); 27void __lockfunc _read_lock(rwlock_t *lock) __acquires(lock);
26void __lockfunc _write_lock(rwlock_t *lock) __acquires(lock); 28void __lockfunc _write_lock(rwlock_t *lock) __acquires(lock);
27void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(lock); 29void __lockfunc _spin_lock_bh(spinlock_t *lock) __acquires(lock);
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 4bf8cade9dbc..e530026eedf7 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -427,9 +427,9 @@ static inline int ssb_dma_mapping_error(struct ssb_device *dev, dma_addr_t addr)
427{ 427{
428 switch (dev->bus->bustype) { 428 switch (dev->bus->bustype) {
429 case SSB_BUSTYPE_PCI: 429 case SSB_BUSTYPE_PCI:
430 return pci_dma_mapping_error(addr); 430 return pci_dma_mapping_error(dev->bus->host_pci, addr);
431 case SSB_BUSTYPE_SSB: 431 case SSB_BUSTYPE_SSB:
432 return dma_mapping_error(addr); 432 return dma_mapping_error(dev->dev, addr);
433 default: 433 default:
434 __ssb_dma_not_implemented(dev); 434 __ssb_dma_not_implemented(dev);
435 } 435 }
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index ebad0bac9801..99a0f991e850 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -245,8 +245,6 @@
245 245
246/* SPROM Revision 3 (inherits most data from rev 2) */ 246/* SPROM Revision 3 (inherits most data from rev 2) */
247#define SSB_SPROM3_IL0MAC 0x104A /* 6 bytes MAC address for 802.11b/g */ 247#define SSB_SPROM3_IL0MAC 0x104A /* 6 bytes MAC address for 802.11b/g */
248#define SSB_SPROM3_ET0MAC 0x1050 /* 6 bytes MAC address for Ethernet ?? */
249#define SSB_SPROM3_ET1MAC 0x1050 /* 6 bytes MAC address for 802.11a ?? */
250#define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */ 248#define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */
251#define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */ 249#define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */
252#define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */ 250#define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */
@@ -267,8 +265,6 @@
267 265
268/* SPROM Revision 4 */ 266/* SPROM Revision 4 */
269#define SSB_SPROM4_IL0MAC 0x104C /* 6 byte MAC address for a/b/g/n */ 267#define SSB_SPROM4_IL0MAC 0x104C /* 6 byte MAC address for a/b/g/n */
270#define SSB_SPROM4_ET0MAC 0x1018 /* 6 bytes MAC address for Ethernet ?? */
271#define SSB_SPROM4_ET1MAC 0x1018 /* 6 bytes MAC address for 802.11a ?? */
272#define SSB_SPROM4_ETHPHY 0x105A /* Ethernet PHY settings ?? */ 268#define SSB_SPROM4_ETHPHY 0x105A /* Ethernet PHY settings ?? */
273#define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */ 269#define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */
274#define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */ 270#define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */
@@ -316,6 +312,21 @@
316#define SSB_SPROM4_PA1B1 0x1090 312#define SSB_SPROM4_PA1B1 0x1090
317#define SSB_SPROM4_PA1B2 0x1092 313#define SSB_SPROM4_PA1B2 0x1092
318 314
315/* SPROM Revision 5 (inherits most data from rev 4) */
316#define SSB_SPROM5_BFLLO 0x104A /* Boardflags (low 16 bits) */
317#define SSB_SPROM5_BFLHI 0x104C /* Board Flags Hi */
318#define SSB_SPROM5_IL0MAC 0x1052 /* 6 byte MAC address for a/b/g/n */
319#define SSB_SPROM5_CCODE 0x1044 /* Country Code (2 bytes) */
320#define SSB_SPROM5_GPIOA 0x1076 /* Gen. Purpose IO # 0 and 1 */
321#define SSB_SPROM5_GPIOA_P0 0x00FF /* Pin 0 */
322#define SSB_SPROM5_GPIOA_P1 0xFF00 /* Pin 1 */
323#define SSB_SPROM5_GPIOA_P1_SHIFT 8
324#define SSB_SPROM5_GPIOB 0x1078 /* Gen. Purpose IO # 2 and 3 */
325#define SSB_SPROM5_GPIOB_P2 0x00FF /* Pin 2 */
326#define SSB_SPROM5_GPIOB_P3 0xFF00 /* Pin 3 */
327#define SSB_SPROM5_GPIOB_P3_SHIFT 8
328
329
319/* Values for SSB_SPROM1_BINF_CCODE */ 330/* Values for SSB_SPROM1_BINF_CCODE */
320enum { 331enum {
321 SSB_SPROM1CCODE_WORLD = 0, 332 SSB_SPROM1CCODE_WORLD = 0,
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h
index 5da9794b2d78..b106fd8e0d5c 100644
--- a/include/linux/stacktrace.h
+++ b/include/linux/stacktrace.h
@@ -1,6 +1,8 @@
1#ifndef __LINUX_STACKTRACE_H 1#ifndef __LINUX_STACKTRACE_H
2#define __LINUX_STACKTRACE_H 2#define __LINUX_STACKTRACE_H
3 3
4struct task_struct;
5
4#ifdef CONFIG_STACKTRACE 6#ifdef CONFIG_STACKTRACE
5struct stack_trace { 7struct stack_trace {
6 unsigned int nr_entries, max_entries; 8 unsigned int nr_entries, max_entries;
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index 5bfc553bdb21..faf1519b5adc 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -3,43 +3,42 @@
3/* "Bogolock": stop the entire machine, disable interrupts. This is a 3/* "Bogolock": stop the entire machine, disable interrupts. This is a
4 very heavy lock, which is equivalent to grabbing every spinlock 4 very heavy lock, which is equivalent to grabbing every spinlock
5 (and more). So the "read" side to such a lock is anything which 5 (and more). So the "read" side to such a lock is anything which
6 diables preeempt. */ 6 disables preeempt. */
7#include <linux/cpu.h> 7#include <linux/cpu.h>
8#include <linux/cpumask.h>
8#include <asm/system.h> 9#include <asm/system.h>
9 10
10#if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP) 11#if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP)
12
11/** 13/**
12 * stop_machine_run: freeze the machine on all CPUs and run this function 14 * stop_machine: freeze the machine on all CPUs and run this function
13 * @fn: the function to run 15 * @fn: the function to run
14 * @data: the data ptr for the @fn() 16 * @data: the data ptr for the @fn()
15 * @cpu: the cpu to run @fn() on (or any, if @cpu == NR_CPUS. 17 * @cpus: the cpus to run the @fn() on (NULL = any online cpu)
16 * 18 *
17 * Description: This causes a thread to be scheduled on every other cpu, 19 * Description: This causes a thread to be scheduled on every cpu,
18 * each of which disables interrupts, and finally interrupts are disabled 20 * each of which disables interrupts. The result is that noone is
19 * on the current CPU. The result is that noone is holding a spinlock 21 * holding a spinlock or inside any other preempt-disabled region when
20 * or inside any other preempt-disabled region when @fn() runs. 22 * @fn() runs.
21 * 23 *
22 * 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
23 * grabbing every spinlock in the kernel. */ 25 * grabbing every spinlock in the kernel. */
24int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu); 26int stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus);
25 27
26/** 28/**
27 * __stop_machine_run: freeze the machine on all CPUs and run this function 29 * __stop_machine: freeze the machine on all CPUs and run this function
28 * @fn: the function to run 30 * @fn: the function to run
29 * @data: the data ptr for the @fn 31 * @data: the data ptr for the @fn
30 * @cpu: the cpu to run @fn on (or any, if @cpu == NR_CPUS. 32 * @cpus: the cpus to run the @fn() on (NULL = any online cpu)
31 * 33 *
32 * Description: This is a special version of the above, which returns the 34 * Description: This is a special version of the above, which assumes cpus
33 * thread which has run @fn(): kthread_stop will return the return value 35 * won't come or go while it's being called. Used by hotplug cpu.
34 * of @fn(). Used by hotplug cpu.
35 */ 36 */
36struct task_struct *__stop_machine_run(int (*fn)(void *), void *data, 37int __stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus);
37 unsigned int cpu);
38
39#else 38#else
40 39
41static inline int stop_machine_run(int (*fn)(void *), void *data, 40static inline int stop_machine(int (*fn)(void *), void *data,
42 unsigned int cpu) 41 const cpumask_t *cpus)
43{ 42{
44 int ret; 43 int ret;
45 local_irq_disable(); 44 local_irq_disable();
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
new file mode 100644
index 000000000000..a3eb2f65b656
--- /dev/null
+++ b/include/linux/string_helpers.h
@@ -0,0 +1,16 @@
1#ifndef _LINUX_STRING_HELPERS_H_
2#define _LINUX_STRING_HELPERS_H_
3
4#include <linux/types.h>
5
6/* Descriptions of the types of units to
7 * print in */
8enum string_size_units {
9 STRING_UNITS_10, /* use powers of 10^3 (standard SI) */
10 STRING_UNITS_2, /* use binary powers of 2^10 */
11};
12
13int string_get_size(u64 size, enum string_size_units units,
14 char *buf, int len);
15
16#endif
diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
index ef2e3a20bf3b..dc05b54bd3a3 100644
--- a/include/linux/sunrpc/svc_rdma.h
+++ b/include/linux/sunrpc/svc_rdma.h
@@ -143,7 +143,6 @@ struct svcxprt_rdma {
143 unsigned long sc_flags; 143 unsigned long sc_flags;
144 struct list_head sc_dto_q; /* DTO tasklet I/O pending Q */ 144 struct list_head sc_dto_q; /* DTO tasklet I/O pending Q */
145 struct list_head sc_read_complete_q; 145 struct list_head sc_read_complete_q;
146 spinlock_t sc_read_complete_lock;
147 struct work_struct sc_work; 146 struct work_struct sc_work;
148}; 147};
149/* sc_flags */ 148/* sc_flags */
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index e8e69159af71..2ce8207686e2 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -217,11 +217,11 @@ struct platform_hibernation_ops {
217#ifdef CONFIG_HIBERNATION 217#ifdef CONFIG_HIBERNATION
218/* kernel/power/snapshot.c */ 218/* kernel/power/snapshot.c */
219extern void __register_nosave_region(unsigned long b, unsigned long e, int km); 219extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
220static inline void register_nosave_region(unsigned long b, unsigned long e) 220static inline void __init register_nosave_region(unsigned long b, unsigned long e)
221{ 221{
222 __register_nosave_region(b, e, 0); 222 __register_nosave_region(b, e, 0);
223} 223}
224static inline void register_nosave_region_late(unsigned long b, unsigned long e) 224static inline void __init register_nosave_region_late(unsigned long b, unsigned long e)
225{ 225{
226 __register_nosave_region(b, e, 1); 226 __register_nosave_region(b, e, 1);
227} 227}
@@ -278,4 +278,6 @@ static inline void register_nosave_region_late(unsigned long b, unsigned long e)
278} 278}
279#endif 279#endif
280 280
281extern struct mutex pm_mutex;
282
281#endif /* _LINUX_SUSPEND_H */ 283#endif /* _LINUX_SUSPEND_H */
diff --git a/include/linux/swab.h b/include/linux/swab.h
new file mode 100644
index 000000000000..270d5c208a89
--- /dev/null
+++ b/include/linux/swab.h
@@ -0,0 +1,309 @@
1#ifndef _LINUX_SWAB_H
2#define _LINUX_SWAB_H
3
4#include <linux/types.h>
5#include <linux/compiler.h>
6#include <asm/byteorder.h>
7
8/*
9 * casts are necessary for constants, because we never know how for sure
10 * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
11 */
12#define __const_swab16(x) ((__u16)( \
13 (((__u16)(x) & (__u16)0x00ffU) << 8) | \
14 (((__u16)(x) & (__u16)0xff00U) >> 8)))
15
16#define __const_swab32(x) ((__u32)( \
17 (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
18 (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
19 (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
20 (((__u32)(x) & (__u32)0xff000000UL) >> 24)))
21
22#define __const_swab64(x) ((__u64)( \
23 (((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
24 (((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \
25 (((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \
26 (((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \
27 (((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \
28 (((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
29 (((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
30 (((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56)))
31
32#define __const_swahw32(x) ((__u32)( \
33 (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \
34 (((__u32)(x) & (__u32)0xffff0000UL) >> 16)))
35
36#define __const_swahb32(x) ((__u32)( \
37 (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \
38 (((__u32)(x) & (__u32)0xff00ff00UL) >> 8)))
39
40/*
41 * Implement the following as inlines, but define the interface using
42 * macros to allow constant folding when possible:
43 * ___swab16, ___swab32, ___swab64, ___swahw32, ___swahb32
44 */
45
46static inline __attribute_const__ __u16 ___swab16(__u16 val)
47{
48#ifdef __arch_swab16
49 return __arch_swab16(val);
50#elif defined(__arch_swab16p)
51 return __arch_swab16p(&val);
52#else
53 return __const_swab16(val);
54#endif
55}
56
57static inline __attribute_const__ __u32 ___swab32(__u32 val)
58{
59#ifdef __arch_swab32
60 return __arch_swab32(val);
61#elif defined(__arch_swab32p)
62 return __arch_swab32p(&val);
63#else
64 return __const_swab32(val);
65#endif
66}
67
68static inline __attribute_const__ __u64 ___swab64(__u64 val)
69{
70#ifdef __arch_swab64
71 return __arch_swab64(val);
72#elif defined(__arch_swab64p)
73 return __arch_swab64p(&val);
74#elif defined(__SWAB_64_THRU_32__)
75 __u32 h = val >> 32;
76 __u32 l = val & ((1ULL << 32) - 1);
77 return (((__u64)___swab32(l)) << 32) | ((__u64)(___swab32(h)));
78#else
79 return __const_swab64(val);
80#endif
81}
82
83static inline __attribute_const__ __u32 ___swahw32(__u32 val)
84{
85#ifdef __arch_swahw32
86 return __arch_swahw32(val);
87#elif defined(__arch_swahw32p)
88 return __arch_swahw32p(&val);
89#else
90 return __const_swahw32(val);
91#endif
92}
93
94static inline __attribute_const__ __u32 ___swahb32(__u32 val)
95{
96#ifdef __arch_swahb32
97 return __arch_swahb32(val);
98#elif defined(__arch_swahb32p)
99 return __arch_swahb32p(&val);
100#else
101 return __const_swahb32(val);
102#endif
103}
104
105/**
106 * __swab16 - return a byteswapped 16-bit value
107 * @x: value to byteswap
108 */
109#define __swab16(x) \
110 (__builtin_constant_p((__u16)(x)) ? \
111 __const_swab16((x)) : \
112 ___swab16((x)))
113
114/**
115 * __swab32 - return a byteswapped 32-bit value
116 * @x: value to byteswap
117 */
118#define __swab32(x) \
119 (__builtin_constant_p((__u32)(x)) ? \
120 __const_swab32((x)) : \
121 ___swab32((x)))
122
123/**
124 * __swab64 - return a byteswapped 64-bit value
125 * @x: value to byteswap
126 */
127#define __swab64(x) \
128 (__builtin_constant_p((__u64)(x)) ? \
129 __const_swab64((x)) : \
130 ___swab64((x)))
131
132/**
133 * __swahw32 - return a word-swapped 32-bit value
134 * @x: value to wordswap
135 *
136 * __swahw32(0x12340000) is 0x00001234
137 */
138#define __swahw32(x) \
139 (__builtin_constant_p((__u32)(x)) ? \
140 __const_swahw32((x)) : \
141 ___swahw32((x)))
142
143/**
144 * __swahb32 - return a high and low byte-swapped 32-bit value
145 * @x: value to byteswap
146 *
147 * __swahb32(0x12345678) is 0x34127856
148 */
149#define __swahb32(x) \
150 (__builtin_constant_p((__u32)(x)) ? \
151 __const_swahb32((x)) : \
152 ___swahb32((x)))
153
154/**
155 * __swab16p - return a byteswapped 16-bit value from a pointer
156 * @p: pointer to a naturally-aligned 16-bit value
157 */
158static inline __u16 __swab16p(const __u16 *p)
159{
160#ifdef __arch_swab16p
161 return __arch_swab16p(p);
162#else
163 return __swab16(*p);
164#endif
165}
166
167/**
168 * __swab32p - return a byteswapped 32-bit value from a pointer
169 * @p: pointer to a naturally-aligned 32-bit value
170 */
171static inline __u32 __swab32p(const __u32 *p)
172{
173#ifdef __arch_swab32p
174 return __arch_swab32p(p);
175#else
176 return __swab32(*p);
177#endif
178}
179
180/**
181 * __swab64p - return a byteswapped 64-bit value from a pointer
182 * @p: pointer to a naturally-aligned 64-bit value
183 */
184static inline __u64 __swab64p(const __u64 *p)
185{
186#ifdef __arch_swab64p
187 return __arch_swab64p(p);
188#else
189 return __swab64(*p);
190#endif
191}
192
193/**
194 * __swahw32p - return a wordswapped 32-bit value from a pointer
195 * @p: pointer to a naturally-aligned 32-bit value
196 *
197 * See __swahw32() for details of wordswapping.
198 */
199static inline __u32 __swahw32p(const __u32 *p)
200{
201#ifdef __arch_swahw32p
202 return __arch_swahw32p(p);
203#else
204 return __swahw32(*p);
205#endif
206}
207
208/**
209 * __swahb32p - return a high and low byteswapped 32-bit value from a pointer
210 * @p: pointer to a naturally-aligned 32-bit value
211 *
212 * See __swahb32() for details of high/low byteswapping.
213 */
214static inline __u32 __swahb32p(const __u32 *p)
215{
216#ifdef __arch_swahb32p
217 return __arch_swahb32p(p);
218#else
219 return __swahb32(*p);
220#endif
221}
222
223/**
224 * __swab16s - byteswap a 16-bit value in-place
225 * @p: pointer to a naturally-aligned 16-bit value
226 */
227static inline void __swab16s(__u16 *p)
228{
229#ifdef __arch_swab16s
230 __arch_swab16s(p);
231#else
232 *p = __swab16p(p);
233#endif
234}
235/**
236 * __swab32s - byteswap a 32-bit value in-place
237 * @p: pointer to a naturally-aligned 32-bit value
238 */
239static inline void __swab32s(__u32 *p)
240{
241#ifdef __arch_swab32s
242 __arch_swab32s(p);
243#else
244 *p = __swab32p(p);
245#endif
246}
247
248/**
249 * __swab64s - byteswap a 64-bit value in-place
250 * @p: pointer to a naturally-aligned 64-bit value
251 */
252static inline void __swab64s(__u64 *p)
253{
254#ifdef __arch_swab64s
255 __arch_swab64s(p);
256#else
257 *p = __swab64p(p);
258#endif
259}
260
261/**
262 * __swahw32s - wordswap a 32-bit value in-place
263 * @p: pointer to a naturally-aligned 32-bit value
264 *
265 * See __swahw32() for details of wordswapping
266 */
267static inline void __swahw32s(__u32 *p)
268{
269#ifdef __arch_swahw32s
270 __arch_swahw32s(p);
271#else
272 *p = __swahw32p(p);
273#endif
274}
275
276/**
277 * __swahb32s - high and low byteswap a 32-bit value in-place
278 * @p: pointer to a naturally-aligned 32-bit value
279 *
280 * See __swahb32() for details of high and low byte swapping
281 */
282static inline void __swahb32s(__u32 *p)
283{
284#ifdef __arch_swahb32s
285 __arch_swahb32s(p);
286#else
287 *p = __swahb32p(p);
288#endif
289}
290
291#ifdef __KERNEL__
292# define swab16 __swab16
293# define swab32 __swab32
294# define swab64 __swab64
295# define swahw32 __swahw32
296# define swahb32 __swahb32
297# define swab16p __swab16p
298# define swab32p __swab32p
299# define swab64p __swab64p
300# define swahw32p __swahw32p
301# define swahb32p __swahb32p
302# define swab16s __swab16s
303# define swab32s __swab32s
304# define swab64s __swab64s
305# define swahw32s __swahw32s
306# define swahb32s __swahb32s
307#endif /* __KERNEL__ */
308
309#endif /* _LINUX_SWAB_H */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 0b3377650c85..de40f169a4e4 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -237,7 +237,6 @@ extern struct page *swapin_readahead(swp_entry_t, gfp_t,
237 237
238/* linux/mm/swapfile.c */ 238/* linux/mm/swapfile.c */
239extern long total_swap_pages; 239extern long total_swap_pages;
240extern unsigned int nr_swapfiles;
241extern void si_swapinfo(struct sysinfo *); 240extern void si_swapinfo(struct sysinfo *);
242extern swp_entry_t get_swap_page(void); 241extern swp_entry_t get_swap_page(void);
243extern swp_entry_t get_swap_page_of_type(int); 242extern swp_entry_t get_swap_page_of_type(int);
@@ -254,8 +253,6 @@ extern int can_share_swap_page(struct page *);
254extern int remove_exclusive_swap_page(struct page *); 253extern int remove_exclusive_swap_page(struct page *);
255struct backing_dev_info; 254struct backing_dev_info;
256 255
257extern spinlock_t swap_lock;
258
259/* linux/mm/thrash.c */ 256/* linux/mm/thrash.c */
260extern struct mm_struct * swap_token_mm; 257extern struct mm_struct * swap_token_mm;
261extern void grab_swap_token(void); 258extern void grab_swap_token(void);
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 24141b4d1a11..d0437f36921f 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -947,6 +947,22 @@ struct ctl_table;
947struct nsproxy; 947struct nsproxy;
948struct ctl_table_root; 948struct ctl_table_root;
949 949
950struct ctl_table_set {
951 struct list_head list;
952 struct ctl_table_set *parent;
953 int (*is_seen)(struct ctl_table_set *);
954};
955
956extern void setup_sysctl_set(struct ctl_table_set *p,
957 struct ctl_table_set *parent,
958 int (*is_seen)(struct ctl_table_set *));
959
960struct ctl_table_header;
961
962extern void sysctl_head_get(struct ctl_table_header *);
963extern void sysctl_head_put(struct ctl_table_header *);
964extern int sysctl_is_seen(struct ctl_table_header *);
965extern struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *);
950extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev); 966extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev);
951extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces, 967extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces,
952 struct ctl_table_header *prev); 968 struct ctl_table_header *prev);
@@ -1049,8 +1065,8 @@ struct ctl_table
1049 1065
1050struct ctl_table_root { 1066struct ctl_table_root {
1051 struct list_head root_list; 1067 struct list_head root_list;
1052 struct list_head header_list; 1068 struct ctl_table_set default_set;
1053 struct list_head *(*lookup)(struct ctl_table_root *root, 1069 struct ctl_table_set *(*lookup)(struct ctl_table_root *root,
1054 struct nsproxy *namespaces); 1070 struct nsproxy *namespaces);
1055 int (*permissions)(struct ctl_table_root *root, 1071 int (*permissions)(struct ctl_table_root *root,
1056 struct nsproxy *namespaces, struct ctl_table *table); 1072 struct nsproxy *namespaces, struct ctl_table *table);
@@ -1063,9 +1079,14 @@ struct ctl_table_header
1063 struct ctl_table *ctl_table; 1079 struct ctl_table *ctl_table;
1064 struct list_head ctl_entry; 1080 struct list_head ctl_entry;
1065 int used; 1081 int used;
1082 int count;
1066 struct completion *unregistering; 1083 struct completion *unregistering;
1067 struct ctl_table *ctl_table_arg; 1084 struct ctl_table *ctl_table_arg;
1068 struct ctl_table_root *root; 1085 struct ctl_table_root *root;
1086 struct ctl_table_set *set;
1087 struct ctl_table *attached_by;
1088 struct ctl_table *attached_to;
1089 struct ctl_table_header *parent;
1069}; 1090};
1070 1091
1071/* struct ctl_path describes where in the hierarchy a table is added */ 1092/* struct ctl_path describes where in the hierarchy a table is added */
diff --git a/include/linux/task_io_accounting.h b/include/linux/task_io_accounting.h
index 44d00e9cceea..5e88afc9a2fb 100644
--- a/include/linux/task_io_accounting.h
+++ b/include/linux/task_io_accounting.h
@@ -8,8 +8,19 @@
8 * Blame akpm@osdl.org for all this. 8 * Blame akpm@osdl.org for all this.
9 */ 9 */
10 10
11#ifdef CONFIG_TASK_IO_ACCOUNTING
12struct task_io_accounting { 11struct task_io_accounting {
12#ifdef CONFIG_TASK_XACCT
13 /* bytes read */
14 u64 rchar;
15 /* bytes written */
16 u64 wchar;
17 /* # of read syscalls */
18 u64 syscr;
19 /* # of write syscalls */
20 u64 syscw;
21#endif /* CONFIG_TASK_XACCT */
22
23#ifdef CONFIG_TASK_IO_ACCOUNTING
13 /* 24 /*
14 * The number of bytes which this task has caused to be read from 25 * The number of bytes which this task has caused to be read from
15 * storage. 26 * storage.
@@ -30,8 +41,5 @@ struct task_io_accounting {
30 * information loss in doing that. 41 * information loss in doing that.
31 */ 42 */
32 u64 cancelled_write_bytes; 43 u64 cancelled_write_bytes;
44#endif /* CONFIG_TASK_IO_ACCOUNTING */
33}; 45};
34#else
35struct task_io_accounting {
36};
37#endif
diff --git a/include/linux/task_io_accounting_ops.h b/include/linux/task_io_accounting_ops.h
index ff46c6fad79d..4d090f9ee608 100644
--- a/include/linux/task_io_accounting_ops.h
+++ b/include/linux/task_io_accounting_ops.h
@@ -40,9 +40,17 @@ static inline void task_io_account_cancelled_write(size_t bytes)
40 current->ioac.cancelled_write_bytes += bytes; 40 current->ioac.cancelled_write_bytes += bytes;
41} 41}
42 42
43static inline void task_io_accounting_init(struct task_struct *tsk) 43static inline void task_io_accounting_init(struct task_io_accounting *ioac)
44{ 44{
45 memset(&tsk->ioac, 0, sizeof(tsk->ioac)); 45 memset(ioac, 0, sizeof(*ioac));
46}
47
48static inline void task_blk_io_accounting_add(struct task_io_accounting *dst,
49 struct task_io_accounting *src)
50{
51 dst->read_bytes += src->read_bytes;
52 dst->write_bytes += src->write_bytes;
53 dst->cancelled_write_bytes += src->cancelled_write_bytes;
46} 54}
47 55
48#else 56#else
@@ -69,9 +77,37 @@ static inline void task_io_account_cancelled_write(size_t bytes)
69{ 77{
70} 78}
71 79
72static inline void task_io_accounting_init(struct task_struct *tsk) 80static inline void task_io_accounting_init(struct task_io_accounting *ioac)
81{
82}
83
84static inline void task_blk_io_accounting_add(struct task_io_accounting *dst,
85 struct task_io_accounting *src)
73{ 86{
74} 87}
75 88
76#endif /* CONFIG_TASK_IO_ACCOUNTING */ 89#endif /* CONFIG_TASK_IO_ACCOUNTING */
77#endif /* __TASK_IO_ACCOUNTING_OPS_INCLUDED */ 90
91#ifdef CONFIG_TASK_XACCT
92static inline void task_chr_io_accounting_add(struct task_io_accounting *dst,
93 struct task_io_accounting *src)
94{
95 dst->rchar += src->rchar;
96 dst->wchar += src->wchar;
97 dst->syscr += src->syscr;
98 dst->syscw += src->syscw;
99}
100#else
101static inline void task_chr_io_accounting_add(struct task_io_accounting *dst,
102 struct task_io_accounting *src)
103{
104}
105#endif /* CONFIG_TASK_XACCT */
106
107static inline void task_io_accounting_add(struct task_io_accounting *dst,
108 struct task_io_accounting *src)
109{
110 task_chr_io_accounting_add(dst, src);
111 task_blk_io_accounting_add(dst, src);
112}
113#endif /* __TASK_IO_ACCOUNTING_OPS_INCLUDED */
diff --git a/include/linux/tc_act/Kbuild b/include/linux/tc_act/Kbuild
index 6dac0d7365cc..76990937f4c9 100644
--- a/include/linux/tc_act/Kbuild
+++ b/include/linux/tc_act/Kbuild
@@ -3,3 +3,4 @@ header-y += tc_ipt.h
3header-y += tc_mirred.h 3header-y += tc_mirred.h
4header-y += tc_pedit.h 4header-y += tc_pedit.h
5header-y += tc_nat.h 5header-y += tc_nat.h
6header-y += tc_skbedit.h
diff --git a/include/linux/tc_act/tc_skbedit.h b/include/linux/tc_act/tc_skbedit.h
new file mode 100644
index 000000000000..a14e461a7af7
--- /dev/null
+++ b/include/linux/tc_act/tc_skbedit.h
@@ -0,0 +1,44 @@
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: Alexander Duyck <alexander.h.duyck@intel.com>
18 */
19
20#ifndef __LINUX_TC_SKBEDIT_H
21#define __LINUX_TC_SKBEDIT_H
22
23#include <linux/pkt_cls.h>
24
25#define TCA_ACT_SKBEDIT 11
26
27#define SKBEDIT_F_PRIORITY 0x1
28#define SKBEDIT_F_QUEUE_MAPPING 0x2
29
30struct tc_skbedit {
31 tc_gen;
32};
33
34enum {
35 TCA_SKBEDIT_UNSPEC,
36 TCA_SKBEDIT_TM,
37 TCA_SKBEDIT_PARMS,
38 TCA_SKBEDIT_PRIORITY,
39 TCA_SKBEDIT_QUEUE_MAPPING,
40 __TCA_SKBEDIT_MAX
41};
42#define TCA_SKBEDIT_MAX (__TCA_SKBEDIT_MAX - 1)
43
44#endif
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 2e2557388e36..fe77e1499ab7 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -312,8 +312,11 @@ struct tcp_sock {
312 u32 retrans_out; /* Retransmitted packets out */ 312 u32 retrans_out; /* Retransmitted packets out */
313 313
314 u16 urg_data; /* Saved octet of OOB data and control flags */ 314 u16 urg_data; /* Saved octet of OOB data and control flags */
315 u8 urg_mode; /* In urgent mode */
316 u8 ecn_flags; /* ECN status bits. */ 315 u8 ecn_flags; /* ECN status bits. */
316 u8 reordering; /* Packet reordering metric. */
317 u32 snd_up; /* Urgent pointer */
318
319 u8 keepalive_probes; /* num of allowed keep alive probes */
317/* 320/*
318 * Options received (usually on last packet, some only on SYN packets). 321 * Options received (usually on last packet, some only on SYN packets).
319 */ 322 */
@@ -342,7 +345,6 @@ struct tcp_sock {
342 struct sk_buff* lost_skb_hint; 345 struct sk_buff* lost_skb_hint;
343 struct sk_buff *scoreboard_skb_hint; 346 struct sk_buff *scoreboard_skb_hint;
344 struct sk_buff *retransmit_skb_hint; 347 struct sk_buff *retransmit_skb_hint;
345 struct sk_buff *forward_skb_hint;
346 348
347 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ 349 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
348 350
@@ -358,12 +360,10 @@ struct tcp_sock {
358 */ 360 */
359 361
360 int lost_cnt_hint; 362 int lost_cnt_hint;
361 int retransmit_cnt_hint; 363 u32 retransmit_high; /* L-bits may be on up to this seqno */
362 364
363 u32 lost_retrans_low; /* Sent seq after any rxmit (lowest) */ 365 u32 lost_retrans_low; /* Sent seq after any rxmit (lowest) */
364 366
365 u8 reordering; /* Packet reordering metric. */
366 u8 keepalive_probes; /* num of allowed keep alive probes */
367 u32 prior_ssthresh; /* ssthresh saved at recovery start */ 367 u32 prior_ssthresh; /* ssthresh saved at recovery start */
368 u32 high_seq; /* snd_nxt at onset of congestion */ 368 u32 high_seq; /* snd_nxt at onset of congestion */
369 369
@@ -375,8 +375,6 @@ struct tcp_sock {
375 u32 total_retrans; /* Total retransmits for entire connection */ 375 u32 total_retrans; /* Total retransmits for entire connection */
376 376
377 u32 urg_seq; /* Seq of received urgent pointer */ 377 u32 urg_seq; /* Seq of received urgent pointer */
378 u32 snd_up; /* Urgent pointer */
379
380 unsigned int keepalive_time; /* time before keep alive takes place */ 378 unsigned int keepalive_time; /* time before keep alive takes place */
381 unsigned int keepalive_intvl; /* time interval between keep alive probes */ 379 unsigned int keepalive_intvl; /* time interval between keep alive probes */
382 380
diff --git a/include/linux/tick.h b/include/linux/tick.h
index d3c02695dc5d..98921a3e1aa8 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -74,10 +74,13 @@ extern struct tick_device *tick_get_device(int cpu);
74extern int tick_init_highres(void); 74extern int tick_init_highres(void);
75extern int tick_program_event(ktime_t expires, int force); 75extern int tick_program_event(ktime_t expires, int force);
76extern void tick_setup_sched_timer(void); 76extern void tick_setup_sched_timer(void);
77# endif
78
79# if defined CONFIG_NO_HZ || defined CONFIG_HIGH_RES_TIMERS
77extern void tick_cancel_sched_timer(int cpu); 80extern void tick_cancel_sched_timer(int cpu);
78# else 81# else
79static inline void tick_cancel_sched_timer(int cpu) { } 82static inline void tick_cancel_sched_timer(int cpu) { }
80# endif /* HIGHRES */ 83# endif
81 84
82# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST 85# ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
83extern struct tick_device *tick_get_broadcast_device(void); 86extern struct tick_device *tick_get_broadcast_device(void);
@@ -123,7 +126,7 @@ static inline ktime_t tick_nohz_get_sleep_length(void)
123 return len; 126 return len;
124} 127}
125static inline void tick_nohz_stop_idle(int cpu) { } 128static inline void tick_nohz_stop_idle(int cpu) { }
126static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return 0; } 129static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; }
127# endif /* !NO_HZ */ 130# endif /* !NO_HZ */
128 131
129#endif 132#endif
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
new file mode 100644
index 000000000000..6186a789d6c7
--- /dev/null
+++ b/include/linux/tracehook.h
@@ -0,0 +1,582 @@
1/*
2 * Tracing hooks
3 *
4 * Copyright (C) 2008 Red Hat, Inc. All rights reserved.
5 *
6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions
8 * of the GNU General Public License v.2.
9 *
10 * This file defines hook entry points called by core code where
11 * user tracing/debugging support might need to do something. These
12 * entry points are called tracehook_*(). Each hook declared below
13 * has a detailed kerneldoc comment giving the context (locking et
14 * al) from which it is called, and the meaning of its return value.
15 *
16 * Each function here typically has only one call site, so it is ok
17 * to have some nontrivial tracehook_*() inlines. In all cases, the
18 * fast path when no tracing is enabled should be very short.
19 *
20 * The purpose of this file and the tracehook_* layer is to consolidate
21 * the interface that the kernel core and arch code uses to enable any
22 * user debugging or tracing facility (such as ptrace). The interfaces
23 * here are carefully documented so that maintainers of core and arch
24 * code do not need to think about the implementation details of the
25 * tracing facilities. Likewise, maintainers of the tracing code do not
26 * need to understand all the calling core or arch code in detail, just
27 * documented circumstances of each call, such as locking conditions.
28 *
29 * If the calling core code changes so that locking is different, then
30 * it is ok to change the interface documented here. The maintainer of
31 * core code changing should notify the maintainers of the tracing code
32 * that they need to work out the change.
33 *
34 * Some tracehook_*() inlines take arguments that the current tracing
35 * implementations might not necessarily use. These function signatures
36 * are chosen to pass in all the information that is on hand in the
37 * caller and might conceivably be relevant to a tracer, so that the
38 * core code won't have to be updated when tracing adds more features.
39 * If a call site changes so that some of those parameters are no longer
40 * already on hand without extra work, then the tracehook_* interface
41 * can change so there is no make-work burden on the core code. The
42 * maintainer of core code changing should notify the maintainers of the
43 * tracing code that they need to work out the change.
44 */
45
46#ifndef _LINUX_TRACEHOOK_H
47#define _LINUX_TRACEHOOK_H 1
48
49#include <linux/sched.h>
50#include <linux/ptrace.h>
51#include <linux/security.h>
52struct linux_binprm;
53
54/**
55 * tracehook_expect_breakpoints - guess if task memory might be touched
56 * @task: current task, making a new mapping
57 *
58 * Return nonzero if @task is expected to want breakpoint insertion in
59 * its memory at some point. A zero return is no guarantee it won't
60 * be done, but this is a hint that it's known to be likely.
61 *
62 * May be called with @task->mm->mmap_sem held for writing.
63 */
64static inline int tracehook_expect_breakpoints(struct task_struct *task)
65{
66 return (task_ptrace(task) & PT_PTRACED) != 0;
67}
68
69/*
70 * ptrace report for syscall entry and exit looks identical.
71 */
72static inline void ptrace_report_syscall(struct pt_regs *regs)
73{
74 int ptrace = task_ptrace(current);
75
76 if (!(ptrace & PT_PTRACED))
77 return;
78
79 ptrace_notify(SIGTRAP | ((ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
80
81 /*
82 * this isn't the same as continuing with a signal, but it will do
83 * for normal use. strace only continues with a signal if the
84 * stopping signal is not SIGTRAP. -brl
85 */
86 if (current->exit_code) {
87 send_sig(current->exit_code, current, 1);
88 current->exit_code = 0;
89 }
90}
91
92/**
93 * tracehook_report_syscall_entry - task is about to attempt a system call
94 * @regs: user register state of current task
95 *
96 * This will be called if %TIF_SYSCALL_TRACE has been set, when the
97 * current task has just entered the kernel for a system call.
98 * Full user register state is available here. Changing the values
99 * in @regs can affect the system call number and arguments to be tried.
100 * It is safe to block here, preventing the system call from beginning.
101 *
102 * Returns zero normally, or nonzero if the calling arch code should abort
103 * the system call. That must prevent normal entry so no system call is
104 * made. If @task ever returns to user mode after this, its register state
105 * is unspecified, but should be something harmless like an %ENOSYS error
106 * return. It should preserve enough information so that syscall_rollback()
107 * can work (see asm-generic/syscall.h).
108 *
109 * Called without locks, just after entering kernel mode.
110 */
111static inline __must_check int tracehook_report_syscall_entry(
112 struct pt_regs *regs)
113{
114 ptrace_report_syscall(regs);
115 return 0;
116}
117
118/**
119 * tracehook_report_syscall_exit - task has just finished a system call
120 * @regs: user register state of current task
121 * @step: nonzero if simulating single-step or block-step
122 *
123 * This will be called if %TIF_SYSCALL_TRACE has been set, when the
124 * current task has just finished an attempted system call. Full
125 * user register state is available here. It is safe to block here,
126 * preventing signals from being processed.
127 *
128 * If @step is nonzero, this report is also in lieu of the normal
129 * trap that would follow the system call instruction because
130 * user_enable_block_step() or user_enable_single_step() was used.
131 * In this case, %TIF_SYSCALL_TRACE might not be set.
132 *
133 * Called without locks, just before checking for pending signals.
134 */
135static inline void tracehook_report_syscall_exit(struct pt_regs *regs, int step)
136{
137 ptrace_report_syscall(regs);
138}
139
140/**
141 * tracehook_unsafe_exec - check for exec declared unsafe due to tracing
142 * @task: current task doing exec
143 *
144 * Return %LSM_UNSAFE_* bits applied to an exec because of tracing.
145 *
146 * Called with task_lock() held on @task.
147 */
148static inline int tracehook_unsafe_exec(struct task_struct *task)
149{
150 int unsafe = 0;
151 int ptrace = task_ptrace(task);
152 if (ptrace & PT_PTRACED) {
153 if (ptrace & PT_PTRACE_CAP)
154 unsafe |= LSM_UNSAFE_PTRACE_CAP;
155 else
156 unsafe |= LSM_UNSAFE_PTRACE;
157 }
158 return unsafe;
159}
160
161/**
162 * tracehook_tracer_task - return the task that is tracing the given task
163 * @tsk: task to consider
164 *
165 * Returns NULL if noone is tracing @task, or the &struct task_struct
166 * pointer to its tracer.
167 *
168 * Must called under rcu_read_lock(). The pointer returned might be kept
169 * live only by RCU. During exec, this may be called with task_lock()
170 * held on @task, still held from when tracehook_unsafe_exec() was called.
171 */
172static inline struct task_struct *tracehook_tracer_task(struct task_struct *tsk)
173{
174 if (task_ptrace(tsk) & PT_PTRACED)
175 return rcu_dereference(tsk->parent);
176 return NULL;
177}
178
179/**
180 * tracehook_report_exec - a successful exec was completed
181 * @fmt: &struct linux_binfmt that performed the exec
182 * @bprm: &struct linux_binprm containing exec details
183 * @regs: user-mode register state
184 *
185 * An exec just completed, we are shortly going to return to user mode.
186 * The freshly initialized register state can be seen and changed in @regs.
187 * The name, file and other pointers in @bprm are still on hand to be
188 * inspected, but will be freed as soon as this returns.
189 *
190 * Called with no locks, but with some kernel resources held live
191 * and a reference on @fmt->module.
192 */
193static inline void tracehook_report_exec(struct linux_binfmt *fmt,
194 struct linux_binprm *bprm,
195 struct pt_regs *regs)
196{
197 if (!ptrace_event(PT_TRACE_EXEC, PTRACE_EVENT_EXEC, 0) &&
198 unlikely(task_ptrace(current) & PT_PTRACED))
199 send_sig(SIGTRAP, current, 0);
200}
201
202/**
203 * tracehook_report_exit - task has begun to exit
204 * @exit_code: pointer to value destined for @current->exit_code
205 *
206 * @exit_code points to the value passed to do_exit(), which tracing
207 * might change here. This is almost the first thing in do_exit(),
208 * before freeing any resources or setting the %PF_EXITING flag.
209 *
210 * Called with no locks held.
211 */
212static inline void tracehook_report_exit(long *exit_code)
213{
214 ptrace_event(PT_TRACE_EXIT, PTRACE_EVENT_EXIT, *exit_code);
215}
216
217/**
218 * tracehook_prepare_clone - prepare for new child to be cloned
219 * @clone_flags: %CLONE_* flags from clone/fork/vfork system call
220 *
221 * This is called before a new user task is to be cloned.
222 * Its return value will be passed to tracehook_finish_clone().
223 *
224 * Called with no locks held.
225 */
226static inline int tracehook_prepare_clone(unsigned clone_flags)
227{
228 if (clone_flags & CLONE_UNTRACED)
229 return 0;
230
231 if (clone_flags & CLONE_VFORK) {
232 if (current->ptrace & PT_TRACE_VFORK)
233 return PTRACE_EVENT_VFORK;
234 } else if ((clone_flags & CSIGNAL) != SIGCHLD) {
235 if (current->ptrace & PT_TRACE_CLONE)
236 return PTRACE_EVENT_CLONE;
237 } else if (current->ptrace & PT_TRACE_FORK)
238 return PTRACE_EVENT_FORK;
239
240 return 0;
241}
242
243/**
244 * tracehook_finish_clone - new child created and being attached
245 * @child: new child task
246 * @clone_flags: %CLONE_* flags from clone/fork/vfork system call
247 * @trace: return value from tracehook_prepare_clone()
248 *
249 * This is called immediately after adding @child to its parent's children list.
250 * The @trace value is that returned by tracehook_prepare_clone().
251 *
252 * Called with current's siglock and write_lock_irq(&tasklist_lock) held.
253 */
254static inline void tracehook_finish_clone(struct task_struct *child,
255 unsigned long clone_flags, int trace)
256{
257 ptrace_init_task(child, (clone_flags & CLONE_PTRACE) || trace);
258}
259
260/**
261 * tracehook_report_clone - in parent, new child is about to start running
262 * @trace: return value from tracehook_prepare_clone()
263 * @regs: parent's user register state
264 * @clone_flags: flags from parent's system call
265 * @pid: new child's PID in the parent's namespace
266 * @child: new child task
267 *
268 * Called after a child is set up, but before it has been started
269 * running. @trace is the value returned by tracehook_prepare_clone().
270 * This is not a good place to block, because the child has not started
271 * yet. Suspend the child here if desired, and then block in
272 * tracehook_report_clone_complete(). This must prevent the child from
273 * self-reaping if tracehook_report_clone_complete() uses the @child
274 * pointer; otherwise it might have died and been released by the time
275 * tracehook_report_clone_complete() is called.
276 *
277 * Called with no locks held, but the child cannot run until this returns.
278 */
279static inline void tracehook_report_clone(int trace, struct pt_regs *regs,
280 unsigned long clone_flags,
281 pid_t pid, struct task_struct *child)
282{
283 if (unlikely(trace) || unlikely(clone_flags & CLONE_PTRACE)) {
284 /*
285 * The child starts up with an immediate SIGSTOP.
286 */
287 sigaddset(&child->pending.signal, SIGSTOP);
288 set_tsk_thread_flag(child, TIF_SIGPENDING);
289 }
290}
291
292/**
293 * tracehook_report_clone_complete - new child is running
294 * @trace: return value from tracehook_prepare_clone()
295 * @regs: parent's user register state
296 * @clone_flags: flags from parent's system call
297 * @pid: new child's PID in the parent's namespace
298 * @child: child task, already running
299 *
300 * This is called just after the child has started running. This is
301 * just before the clone/fork syscall returns, or blocks for vfork
302 * child completion if @clone_flags has the %CLONE_VFORK bit set.
303 * The @child pointer may be invalid if a self-reaping child died and
304 * tracehook_report_clone() took no action to prevent it from self-reaping.
305 *
306 * Called with no locks held.
307 */
308static inline void tracehook_report_clone_complete(int trace,
309 struct pt_regs *regs,
310 unsigned long clone_flags,
311 pid_t pid,
312 struct task_struct *child)
313{
314 if (unlikely(trace))
315 ptrace_event(0, trace, pid);
316}
317
318/**
319 * tracehook_report_vfork_done - vfork parent's child has exited or exec'd
320 * @child: child task, already running
321 * @pid: new child's PID in the parent's namespace
322 *
323 * Called after a %CLONE_VFORK parent has waited for the child to complete.
324 * The clone/vfork system call will return immediately after this.
325 * The @child pointer may be invalid if a self-reaping child died and
326 * tracehook_report_clone() took no action to prevent it from self-reaping.
327 *
328 * Called with no locks held.
329 */
330static inline void tracehook_report_vfork_done(struct task_struct *child,
331 pid_t pid)
332{
333 ptrace_event(PT_TRACE_VFORK_DONE, PTRACE_EVENT_VFORK_DONE, pid);
334}
335
336/**
337 * tracehook_prepare_release_task - task is being reaped, clean up tracing
338 * @task: task in %EXIT_DEAD state
339 *
340 * This is called in release_task() just before @task gets finally reaped
341 * and freed. This would be the ideal place to remove and clean up any
342 * tracing-related state for @task.
343 *
344 * Called with no locks held.
345 */
346static inline void tracehook_prepare_release_task(struct task_struct *task)
347{
348}
349
350/**
351 * tracehook_finish_release_task - final tracing clean-up
352 * @task: task in %EXIT_DEAD state
353 *
354 * This is called in release_task() when @task is being in the middle of
355 * being reaped. After this, there must be no tracing entanglements.
356 *
357 * Called with write_lock_irq(&tasklist_lock) held.
358 */
359static inline void tracehook_finish_release_task(struct task_struct *task)
360{
361 ptrace_release_task(task);
362}
363
364/**
365 * tracehook_signal_handler - signal handler setup is complete
366 * @sig: number of signal being delivered
367 * @info: siginfo_t of signal being delivered
368 * @ka: sigaction setting that chose the handler
369 * @regs: user register state
370 * @stepping: nonzero if debugger single-step or block-step in use
371 *
372 * Called by the arch code after a signal handler has been set up.
373 * Register and stack state reflects the user handler about to run.
374 * Signal mask changes have already been made.
375 *
376 * Called without locks, shortly before returning to user mode
377 * (or handling more signals).
378 */
379static inline void tracehook_signal_handler(int sig, siginfo_t *info,
380 const struct k_sigaction *ka,
381 struct pt_regs *regs, int stepping)
382{
383 if (stepping)
384 ptrace_notify(SIGTRAP);
385}
386
387/**
388 * tracehook_consider_ignored_signal - suppress short-circuit of ignored signal
389 * @task: task receiving the signal
390 * @sig: signal number being sent
391 * @handler: %SIG_IGN or %SIG_DFL
392 *
393 * Return zero iff tracing doesn't care to examine this ignored signal,
394 * so it can short-circuit normal delivery and never even get queued.
395 * Either @handler is %SIG_DFL and @sig's default is ignore, or it's %SIG_IGN.
396 *
397 * Called with @task->sighand->siglock held.
398 */
399static inline int tracehook_consider_ignored_signal(struct task_struct *task,
400 int sig,
401 void __user *handler)
402{
403 return (task_ptrace(task) & PT_PTRACED) != 0;
404}
405
406/**
407 * tracehook_consider_fatal_signal - suppress special handling of fatal signal
408 * @task: task receiving the signal
409 * @sig: signal number being sent
410 * @handler: %SIG_DFL or %SIG_IGN
411 *
412 * Return nonzero to prevent special handling of this termination signal.
413 * Normally @handler is %SIG_DFL. It can be %SIG_IGN if @sig is ignored,
414 * in which case force_sig() is about to reset it to %SIG_DFL.
415 * When this returns zero, this signal might cause a quick termination
416 * that does not give the debugger a chance to intercept the signal.
417 *
418 * Called with or without @task->sighand->siglock held.
419 */
420static inline int tracehook_consider_fatal_signal(struct task_struct *task,
421 int sig,
422 void __user *handler)
423{
424 return (task_ptrace(task) & PT_PTRACED) != 0;
425}
426
427/**
428 * tracehook_force_sigpending - let tracing force signal_pending(current) on
429 *
430 * Called when recomputing our signal_pending() flag. Return nonzero
431 * to force the signal_pending() flag on, so that tracehook_get_signal()
432 * will be called before the next return to user mode.
433 *
434 * Called with @current->sighand->siglock held.
435 */
436static inline int tracehook_force_sigpending(void)
437{
438 return 0;
439}
440
441/**
442 * tracehook_get_signal - deliver synthetic signal to traced task
443 * @task: @current
444 * @regs: task_pt_regs(@current)
445 * @info: details of synthetic signal
446 * @return_ka: sigaction for synthetic signal
447 *
448 * Return zero to check for a real pending signal normally.
449 * Return -1 after releasing the siglock to repeat the check.
450 * Return a signal number to induce an artifical signal delivery,
451 * setting *@info and *@return_ka to specify its details and behavior.
452 *
453 * The @return_ka->sa_handler value controls the disposition of the
454 * signal, no matter the signal number. For %SIG_DFL, the return value
455 * is a representative signal to indicate the behavior (e.g. %SIGTERM
456 * for death, %SIGQUIT for core dump, %SIGSTOP for job control stop,
457 * %SIGTSTP for stop unless in an orphaned pgrp), but the signal number
458 * reported will be @info->si_signo instead.
459 *
460 * Called with @task->sighand->siglock held, before dequeuing pending signals.
461 */
462static inline int tracehook_get_signal(struct task_struct *task,
463 struct pt_regs *regs,
464 siginfo_t *info,
465 struct k_sigaction *return_ka)
466{
467 return 0;
468}
469
470/**
471 * tracehook_notify_jctl - report about job control stop/continue
472 * @notify: nonzero if this is the last thread in the group to stop
473 * @why: %CLD_STOPPED or %CLD_CONTINUED
474 *
475 * This is called when we might call do_notify_parent_cldstop().
476 * It's called when about to stop for job control; we are already in
477 * %TASK_STOPPED state, about to call schedule(). It's also called when
478 * a delayed %CLD_STOPPED or %CLD_CONTINUED report is ready to be made.
479 *
480 * Return nonzero to generate a %SIGCHLD with @why, which is
481 * normal if @notify is nonzero.
482 *
483 * Called with no locks held.
484 */
485static inline int tracehook_notify_jctl(int notify, int why)
486{
487 return notify || (current->ptrace & PT_PTRACED);
488}
489
490#define DEATH_REAP -1
491#define DEATH_DELAYED_GROUP_LEADER -2
492
493/**
494 * tracehook_notify_death - task is dead, ready to notify parent
495 * @task: @current task now exiting
496 * @death_cookie: value to pass to tracehook_report_death()
497 * @group_dead: nonzero if this was the last thread in the group to die
498 *
499 * A return value >= 0 means call do_notify_parent() with that signal
500 * number. Negative return value can be %DEATH_REAP to self-reap right
501 * now, or %DEATH_DELAYED_GROUP_LEADER to a zombie without notifying our
502 * parent. Note that a return value of 0 means a do_notify_parent() call
503 * that sends no signal, but still wakes up a parent blocked in wait*().
504 *
505 * Called with write_lock_irq(&tasklist_lock) held.
506 */
507static inline int tracehook_notify_death(struct task_struct *task,
508 void **death_cookie, int group_dead)
509{
510 if (task->exit_signal == -1)
511 return task->ptrace ? SIGCHLD : DEATH_REAP;
512
513 /*
514 * If something other than our normal parent is ptracing us, then
515 * send it a SIGCHLD instead of honoring exit_signal. exit_signal
516 * only has special meaning to our real parent.
517 */
518 if (thread_group_empty(task) && !ptrace_reparented(task))
519 return task->exit_signal;
520
521 return task->ptrace ? SIGCHLD : DEATH_DELAYED_GROUP_LEADER;
522}
523
524/**
525 * tracehook_report_death - task is dead and ready to be reaped
526 * @task: @current task now exiting
527 * @signal: return value from tracheook_notify_death()
528 * @death_cookie: value passed back from tracehook_notify_death()
529 * @group_dead: nonzero if this was the last thread in the group to die
530 *
531 * Thread has just become a zombie or is about to self-reap. If positive,
532 * @signal is the signal number just sent to the parent (usually %SIGCHLD).
533 * If @signal is %DEATH_REAP, this thread will self-reap. If @signal is
534 * %DEATH_DELAYED_GROUP_LEADER, this is a delayed_group_leader() zombie.
535 * The @death_cookie was passed back by tracehook_notify_death().
536 *
537 * If normal reaping is not inhibited, @task->exit_state might be changing
538 * in parallel.
539 *
540 * Called without locks.
541 */
542static inline void tracehook_report_death(struct task_struct *task,
543 int signal, void *death_cookie,
544 int group_dead)
545{
546}
547
548#ifdef TIF_NOTIFY_RESUME
549/**
550 * set_notify_resume - cause tracehook_notify_resume() to be called
551 * @task: task that will call tracehook_notify_resume()
552 *
553 * Calling this arranges that @task will call tracehook_notify_resume()
554 * before returning to user mode. If it's already running in user mode,
555 * it will enter the kernel and call tracehook_notify_resume() soon.
556 * If it's blocked, it will not be woken.
557 */
558static inline void set_notify_resume(struct task_struct *task)
559{
560 if (!test_and_set_tsk_thread_flag(task, TIF_NOTIFY_RESUME))
561 kick_process(task);
562}
563
564/**
565 * tracehook_notify_resume - report when about to return to user mode
566 * @regs: user-mode registers of @current task
567 *
568 * This is called when %TIF_NOTIFY_RESUME has been set. Now we are
569 * about to return to user mode, and the user state in @regs can be
570 * inspected or adjusted. The caller in arch code has cleared
571 * %TIF_NOTIFY_RESUME before the call. If the flag gets set again
572 * asynchronously, this will be called again before we return to
573 * user mode.
574 *
575 * Called without locks.
576 */
577static inline void tracehook_notify_resume(struct pt_regs *regs)
578{
579}
580#endif /* TIF_NOTIFY_RESUME */
581
582#endif /* <linux/tracehook.h> */
diff --git a/include/linux/tty.h b/include/linux/tty.h
index e3579cb086e0..0cbec74ec086 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -331,6 +331,8 @@ extern int tty_write_room(struct tty_struct *tty);
331extern void tty_driver_flush_buffer(struct tty_struct *tty); 331extern void tty_driver_flush_buffer(struct tty_struct *tty);
332extern void tty_throttle(struct tty_struct *tty); 332extern void tty_throttle(struct tty_struct *tty);
333extern void tty_unthrottle(struct tty_struct *tty); 333extern void tty_unthrottle(struct tty_struct *tty);
334extern int tty_do_resize(struct tty_struct *tty, struct tty_struct *real_tty,
335 struct winsize *ws);
334 336
335extern int is_current_pgrp_orphaned(void); 337extern int is_current_pgrp_orphaned(void);
336extern struct pid *tty_get_pgrp(struct tty_struct *tty); 338extern struct pid *tty_get_pgrp(struct tty_struct *tty);
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index e1065ac0d922..16d27944c321 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -168,6 +168,18 @@
168 * 168 *
169 * Optional: If not provided then the write method is called under 169 * Optional: If not provided then the write method is called under
170 * the atomic write lock to keep it serialized with the ldisc. 170 * the atomic write lock to keep it serialized with the ldisc.
171 *
172 * int (*resize)(struct tty_struct *tty, struct tty_struct *real_tty,
173 * unsigned int rows, unsigned int cols);
174 *
175 * Called when a termios request is issued which changes the
176 * requested terminal geometry.
177 *
178 * Optional: the default action is to update the termios structure
179 * without error. This is usually the correct behaviour. Drivers should
180 * not force errors here if they are not resizable objects (eg a serial
181 * line). See tty_do_resize() if you need to wrap the standard method
182 * in your own logic - the usual case.
171 */ 183 */
172 184
173#include <linux/fs.h> 185#include <linux/fs.h>
@@ -206,6 +218,8 @@ struct tty_operations {
206 int (*tiocmget)(struct tty_struct *tty, struct file *file); 218 int (*tiocmget)(struct tty_struct *tty, struct file *file);
207 int (*tiocmset)(struct tty_struct *tty, struct file *file, 219 int (*tiocmset)(struct tty_struct *tty, struct file *file,
208 unsigned int set, unsigned int clear); 220 unsigned int set, unsigned int clear);
221 int (*resize)(struct tty_struct *tty, struct tty_struct *real_tty,
222 struct winsize *ws);
209#ifdef CONFIG_CONSOLE_POLL 223#ifdef CONFIG_CONSOLE_POLL
210 int (*poll_init)(struct tty_driver *driver, int line, char *options); 224 int (*poll_init)(struct tty_driver *driver, int line, char *options);
211 int (*poll_get_char)(struct tty_driver *driver, int line); 225 int (*poll_get_char)(struct tty_driver *driver, int line);
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h
new file mode 100644
index 000000000000..970473bf8d5a
--- /dev/null
+++ b/include/linux/ucb1400.h
@@ -0,0 +1,161 @@
1/*
2 * Register definitions and functions for:
3 * Philips UCB1400 driver
4 *
5 * Based on ucb1400_ts:
6 * Author: Nicolas Pitre
7 * Created: September 25, 2006
8 * Copyright: MontaVista Software, Inc.
9 *
10 * Spliting done by: Marek Vasut <marek.vasut@gmail.com>
11 * If something doesnt work and it worked before spliting, e-mail me,
12 * dont bother Nicolas please ;-)
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 *
18 * This code is heavily based on ucb1x00-*.c copyrighted by Russell King
19 * covering the UCB1100, UCB1200 and UCB1300.. Support for the UCB1400 has
20 * been made separate from ucb1x00-core/ucb1x00-ts on Russell's request.
21 */
22
23#ifndef _LINUX__UCB1400_H
24#define _LINUX__UCB1400_H
25
26#include <sound/ac97_codec.h>
27#include <linux/mutex.h>
28#include <linux/platform_device.h>
29
30/*
31 * UCB1400 AC-link registers
32 */
33
34#define UCB_IO_DATA 0x5a
35#define UCB_IO_DIR 0x5c
36#define UCB_IE_RIS 0x5e
37#define UCB_IE_FAL 0x60
38#define UCB_IE_STATUS 0x62
39#define UCB_IE_CLEAR 0x62
40#define UCB_IE_ADC (1 << 11)
41#define UCB_IE_TSPX (1 << 12)
42
43#define UCB_TS_CR 0x64
44#define UCB_TS_CR_TSMX_POW (1 << 0)
45#define UCB_TS_CR_TSPX_POW (1 << 1)
46#define UCB_TS_CR_TSMY_POW (1 << 2)
47#define UCB_TS_CR_TSPY_POW (1 << 3)
48#define UCB_TS_CR_TSMX_GND (1 << 4)
49#define UCB_TS_CR_TSPX_GND (1 << 5)
50#define UCB_TS_CR_TSMY_GND (1 << 6)
51#define UCB_TS_CR_TSPY_GND (1 << 7)
52#define UCB_TS_CR_MODE_INT (0 << 8)
53#define UCB_TS_CR_MODE_PRES (1 << 8)
54#define UCB_TS_CR_MODE_POS (2 << 8)
55#define UCB_TS_CR_BIAS_ENA (1 << 11)
56#define UCB_TS_CR_TSPX_LOW (1 << 12)
57#define UCB_TS_CR_TSMX_LOW (1 << 13)
58
59#define UCB_ADC_CR 0x66
60#define UCB_ADC_SYNC_ENA (1 << 0)
61#define UCB_ADC_VREFBYP_CON (1 << 1)
62#define UCB_ADC_INP_TSPX (0 << 2)
63#define UCB_ADC_INP_TSMX (1 << 2)
64#define UCB_ADC_INP_TSPY (2 << 2)
65#define UCB_ADC_INP_TSMY (3 << 2)
66#define UCB_ADC_INP_AD0 (4 << 2)
67#define UCB_ADC_INP_AD1 (5 << 2)
68#define UCB_ADC_INP_AD2 (6 << 2)
69#define UCB_ADC_INP_AD3 (7 << 2)
70#define UCB_ADC_EXT_REF (1 << 5)
71#define UCB_ADC_START (1 << 7)
72#define UCB_ADC_ENA (1 << 15)
73
74#define UCB_ADC_DATA 0x68
75#define UCB_ADC_DAT_VALID (1 << 15)
76#define UCB_ADC_DAT_MASK 0x3ff
77
78#define UCB_ID 0x7e
79#define UCB_ID_1400 0x4304
80
81struct ucb1400_ts {
82 struct input_dev *ts_idev;
83 struct task_struct *ts_task;
84 int id;
85 wait_queue_head_t ts_wait;
86 unsigned int ts_restart:1;
87 int irq;
88 unsigned int irq_pending; /* not bit field shared */
89 struct snd_ac97 *ac97;
90};
91
92struct ucb1400 {
93 struct platform_device *ucb1400_ts;
94};
95
96static inline u16 ucb1400_reg_read(struct snd_ac97 *ac97, u16 reg)
97{
98 return ac97->bus->ops->read(ac97, reg);
99}
100
101static inline void ucb1400_reg_write(struct snd_ac97 *ac97, u16 reg, u16 val)
102{
103 ac97->bus->ops->write(ac97, reg, val);
104}
105
106static inline u16 ucb1400_gpio_get_value(struct snd_ac97 *ac97, u16 gpio)
107{
108 return ucb1400_reg_read(ac97, UCB_IO_DATA) & (1 << gpio);
109}
110
111static inline void ucb1400_gpio_set_value(struct snd_ac97 *ac97, u16 gpio,
112 u16 val)
113{
114 ucb1400_reg_write(ac97, UCB_IO_DATA, val ?
115 ucb1400_reg_read(ac97, UCB_IO_DATA) | (1 << gpio) :
116 ucb1400_reg_read(ac97, UCB_IO_DATA) & ~(1 << gpio));
117}
118
119static inline u16 ucb1400_gpio_get_direction(struct snd_ac97 *ac97, u16 gpio)
120{
121 return ucb1400_reg_read(ac97, UCB_IO_DIR) & (1 << gpio);
122}
123
124static inline void ucb1400_gpio_set_direction(struct snd_ac97 *ac97, u16 gpio,
125 u16 dir)
126{
127 ucb1400_reg_write(ac97, UCB_IO_DIR, dir ?
128 ucb1400_reg_read(ac97, UCB_IO_DIR) | (1 << gpio) :
129 ucb1400_reg_read(ac97, UCB_IO_DIR) & ~(1 << gpio));
130}
131
132static inline void ucb1400_adc_enable(struct snd_ac97 *ac97)
133{
134 ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA);
135}
136
137static unsigned int ucb1400_adc_read(struct snd_ac97 *ac97, u16 adc_channel,
138 int adcsync)
139{
140 unsigned int val;
141
142 if (adcsync)
143 adc_channel |= UCB_ADC_SYNC_ENA;
144
145 ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel);
146 ucb1400_reg_write(ac97, UCB_ADC_CR, UCB_ADC_ENA | adc_channel |
147 UCB_ADC_START);
148
149 while (!((val = ucb1400_reg_read(ac97, UCB_ADC_DATA))
150 & UCB_ADC_DAT_VALID))
151 schedule_timeout_uninterruptible(1);
152
153 return val & UCB_ADC_DAT_MASK;
154}
155
156static inline void ucb1400_adc_disable(struct snd_ac97 *ac97)
157{
158 ucb1400_reg_write(ac97, UCB_ADC_CR, 0);
159}
160
161#endif
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 5811c5da69f9..94ac74aba6b6 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -110,6 +110,10 @@ enum usb_interface_condition {
110 * @sysfs_files_created: sysfs attributes exist 110 * @sysfs_files_created: sysfs attributes exist
111 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup 111 * @needs_remote_wakeup: flag set when the driver requires remote-wakeup
112 * capability during autosuspend. 112 * capability during autosuspend.
113 * @needs_altsetting0: flag set when a set-interface request for altsetting 0
114 * has been deferred.
115 * @needs_binding: flag set when the driver should be re-probed or unbound
116 * following a reset or suspend operation it doesn't support.
113 * @dev: driver model's view of this device 117 * @dev: driver model's view of this device
114 * @usb_dev: if an interface is bound to the USB major, this will point 118 * @usb_dev: if an interface is bound to the USB major, this will point
115 * to the sysfs representation for that device. 119 * to the sysfs representation for that device.
@@ -160,6 +164,7 @@ struct usb_interface {
160 unsigned is_active:1; /* the interface is not suspended */ 164 unsigned is_active:1; /* the interface is not suspended */
161 unsigned sysfs_files_created:1; /* the sysfs attributes exist */ 165 unsigned sysfs_files_created:1; /* the sysfs attributes exist */
162 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ 166 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
167 unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */
163 unsigned needs_binding:1; /* needs delayed unbind/rebind */ 168 unsigned needs_binding:1; /* needs delayed unbind/rebind */
164 169
165 struct device dev; /* interface specific device info */ 170 struct device dev; /* interface specific device info */
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h
new file mode 100644
index 000000000000..5b88e36c9103
--- /dev/null
+++ b/include/linux/usb/ehci_def.h
@@ -0,0 +1,160 @@
1/*
2 * Copyright (c) 2001-2002 by David Brownell
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * 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 Foundation,
16 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#ifndef __LINUX_USB_EHCI_DEF_H
20#define __LINUX_USB_EHCI_DEF_H
21
22/* EHCI register interface, corresponds to EHCI Revision 0.95 specification */
23
24/* Section 2.2 Host Controller Capability Registers */
25struct ehci_caps {
26 /* these fields are specified as 8 and 16 bit registers,
27 * but some hosts can't perform 8 or 16 bit PCI accesses.
28 */
29 u32 hc_capbase;
30#define HC_LENGTH(p) (((p)>>00)&0x00ff) /* bits 7:0 */
31#define HC_VERSION(p) (((p)>>16)&0xffff) /* bits 31:16 */
32 u32 hcs_params; /* HCSPARAMS - offset 0x4 */
33#define HCS_DEBUG_PORT(p) (((p)>>20)&0xf) /* bits 23:20, debug port? */
34#define HCS_INDICATOR(p) ((p)&(1 << 16)) /* true: has port indicators */
35#define HCS_N_CC(p) (((p)>>12)&0xf) /* bits 15:12, #companion HCs */
36#define HCS_N_PCC(p) (((p)>>8)&0xf) /* bits 11:8, ports per CC */
37#define HCS_PORTROUTED(p) ((p)&(1 << 7)) /* true: port routing */
38#define HCS_PPC(p) ((p)&(1 << 4)) /* true: port power control */
39#define HCS_N_PORTS(p) (((p)>>0)&0xf) /* bits 3:0, ports on HC */
40
41 u32 hcc_params; /* HCCPARAMS - offset 0x8 */
42#define HCC_EXT_CAPS(p) (((p)>>8)&0xff) /* for pci extended caps */
43#define HCC_ISOC_CACHE(p) ((p)&(1 << 7)) /* true: can cache isoc frame */
44#define HCC_ISOC_THRES(p) (((p)>>4)&0x7) /* bits 6:4, uframes cached */
45#define HCC_CANPARK(p) ((p)&(1 << 2)) /* true: can park on async qh */
46#define HCC_PGM_FRAMELISTLEN(p) ((p)&(1 << 1)) /* true: periodic_size changes*/
47#define HCC_64BIT_ADDR(p) ((p)&(1)) /* true: can use 64-bit addr */
48 u8 portroute [8]; /* nibbles for routing - offset 0xC */
49} __attribute__ ((packed));
50
51
52/* Section 2.3 Host Controller Operational Registers */
53struct ehci_regs {
54
55 /* USBCMD: offset 0x00 */
56 u32 command;
57/* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */
58#define CMD_PARK (1<<11) /* enable "park" on async qh */
59#define CMD_PARK_CNT(c) (((c)>>8)&3) /* how many transfers to park for */
60#define CMD_LRESET (1<<7) /* partial reset (no ports, etc) */
61#define CMD_IAAD (1<<6) /* "doorbell" interrupt async advance */
62#define CMD_ASE (1<<5) /* async schedule enable */
63#define CMD_PSE (1<<4) /* periodic schedule enable */
64/* 3:2 is periodic frame list size */
65#define CMD_RESET (1<<1) /* reset HC not bus */
66#define CMD_RUN (1<<0) /* start/stop HC */
67
68 /* USBSTS: offset 0x04 */
69 u32 status;
70#define STS_ASS (1<<15) /* Async Schedule Status */
71#define STS_PSS (1<<14) /* Periodic Schedule Status */
72#define STS_RECL (1<<13) /* Reclamation */
73#define STS_HALT (1<<12) /* Not running (any reason) */
74/* some bits reserved */
75 /* these STS_* flags are also intr_enable bits (USBINTR) */
76#define STS_IAA (1<<5) /* Interrupted on async advance */
77#define STS_FATAL (1<<4) /* such as some PCI access errors */
78#define STS_FLR (1<<3) /* frame list rolled over */
79#define STS_PCD (1<<2) /* port change detect */
80#define STS_ERR (1<<1) /* "error" completion (overflow, ...) */
81#define STS_INT (1<<0) /* "normal" completion (short, ...) */
82
83 /* USBINTR: offset 0x08 */
84 u32 intr_enable;
85
86 /* FRINDEX: offset 0x0C */
87 u32 frame_index; /* current microframe number */
88 /* CTRLDSSEGMENT: offset 0x10 */
89 u32 segment; /* address bits 63:32 if needed */
90 /* PERIODICLISTBASE: offset 0x14 */
91 u32 frame_list; /* points to periodic list */
92 /* ASYNCLISTADDR: offset 0x18 */
93 u32 async_next; /* address of next async queue head */
94
95 u32 reserved [9];
96
97 /* CONFIGFLAG: offset 0x40 */
98 u32 configured_flag;
99#define FLAG_CF (1<<0) /* true: we'll support "high speed" */
100
101 /* PORTSC: offset 0x44 */
102 u32 port_status [0]; /* up to N_PORTS */
103/* 31:23 reserved */
104#define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */
105#define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */
106#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */
107/* 19:16 for port testing */
108#define PORT_LED_OFF (0<<14)
109#define PORT_LED_AMBER (1<<14)
110#define PORT_LED_GREEN (2<<14)
111#define PORT_LED_MASK (3<<14)
112#define PORT_OWNER (1<<13) /* true: companion hc owns this port */
113#define PORT_POWER (1<<12) /* true: has power (see PPC) */
114#define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */
115/* 11:10 for detecting lowspeed devices (reset vs release ownership) */
116/* 9 reserved */
117#define PORT_RESET (1<<8) /* reset port */
118#define PORT_SUSPEND (1<<7) /* suspend port */
119#define PORT_RESUME (1<<6) /* resume it */
120#define PORT_OCC (1<<5) /* over current change */
121#define PORT_OC (1<<4) /* over current active */
122#define PORT_PEC (1<<3) /* port enable change */
123#define PORT_PE (1<<2) /* port enable */
124#define PORT_CSC (1<<1) /* connect status change */
125#define PORT_CONNECT (1<<0) /* device connected */
126#define PORT_RWC_BITS (PORT_CSC | PORT_PEC | PORT_OCC)
127} __attribute__ ((packed));
128
129#define USBMODE 0x68 /* USB Device mode */
130#define USBMODE_SDIS (1<<3) /* Stream disable */
131#define USBMODE_BE (1<<2) /* BE/LE endianness select */
132#define USBMODE_CM_HC (3<<0) /* host controller mode */
133#define USBMODE_CM_IDLE (0<<0) /* idle state */
134
135/* Appendix C, Debug port ... intended for use with special "debug devices"
136 * that can help if there's no serial console. (nonstandard enumeration.)
137 */
138struct ehci_dbg_port {
139 u32 control;
140#define DBGP_OWNER (1<<30)
141#define DBGP_ENABLED (1<<28)
142#define DBGP_DONE (1<<16)
143#define DBGP_INUSE (1<<10)
144#define DBGP_ERRCODE(x) (((x)>>7)&0x07)
145# define DBGP_ERR_BAD 1
146# define DBGP_ERR_SIGNAL 2
147#define DBGP_ERROR (1<<6)
148#define DBGP_GO (1<<5)
149#define DBGP_OUT (1<<4)
150#define DBGP_LEN(x) (((x)>>0)&0x0f)
151 u32 pids;
152#define DBGP_PID_GET(x) (((x)>>16)&0xff)
153#define DBGP_PID_SET(data, tok) (((data)<<8)|(tok))
154 u32 data03;
155 u32 data47;
156 u32 address;
157#define DBGP_EPADDR(dev, ep) (((dev)<<8)|(ep))
158} __attribute__ ((packed));
159
160#endif /* __LINUX_USB_EHCI_DEF_H */
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
new file mode 100644
index 000000000000..630962c04ca4
--- /dev/null
+++ b/include/linux/usb/musb.h
@@ -0,0 +1,98 @@
1/*
2 * This is used to for host and peripheral modes of the driver for
3 * Inventra (Multidrop) Highspeed Dual-Role Controllers: (M)HDRC.
4 *
5 * Board initialization should put one of these into dev->platform_data,
6 * probably on some platform_device named "musb_hdrc". It encapsulates
7 * key configuration differences between boards.
8 */
9
10/* The USB role is defined by the connector used on the board, so long as
11 * standards are being followed. (Developer boards sometimes won't.)
12 */
13enum musb_mode {
14 MUSB_UNDEFINED = 0,
15 MUSB_HOST, /* A or Mini-A connector */
16 MUSB_PERIPHERAL, /* B or Mini-B connector */
17 MUSB_OTG /* Mini-AB connector */
18};
19
20struct clk;
21
22struct musb_hdrc_eps_bits {
23 const char name[16];
24 u8 bits;
25};
26
27struct musb_hdrc_config {
28 /* MUSB configuration-specific details */
29 unsigned multipoint:1; /* multipoint device */
30 unsigned dyn_fifo:1; /* supports dynamic fifo sizing */
31 unsigned soft_con:1; /* soft connect required */
32 unsigned utm_16:1; /* utm data witdh is 16 bits */
33 unsigned big_endian:1; /* true if CPU uses big-endian */
34 unsigned mult_bulk_tx:1; /* Tx ep required for multbulk pkts */
35 unsigned mult_bulk_rx:1; /* Rx ep required for multbulk pkts */
36 unsigned high_iso_tx:1; /* Tx ep required for HB iso */
37 unsigned high_iso_rx:1; /* Rx ep required for HD iso */
38 unsigned dma:1; /* supports DMA */
39 unsigned vendor_req:1; /* vendor registers required */
40
41 u8 num_eps; /* number of endpoints _with_ ep0 */
42 u8 dma_channels; /* number of dma channels */
43 u8 dyn_fifo_size; /* dynamic size in bytes */
44 u8 vendor_ctrl; /* vendor control reg width */
45 u8 vendor_stat; /* vendor status reg witdh */
46 u8 dma_req_chan; /* bitmask for required dma channels */
47 u8 ram_bits; /* ram address size */
48
49 struct musb_hdrc_eps_bits *eps_bits;
50};
51
52struct musb_hdrc_platform_data {
53 /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */
54 u8 mode;
55
56 /* for clk_get() */
57 const char *clock;
58
59 /* (HOST or OTG) switch VBUS on/off */
60 int (*set_vbus)(struct device *dev, int is_on);
61
62 /* (HOST or OTG) mA/2 power supplied on (default = 8mA) */
63 u8 power;
64
65 /* (PERIPHERAL) mA/2 max power consumed (default = 100mA) */
66 u8 min_power;
67
68 /* (HOST or OTG) msec/2 after VBUS on till power good */
69 u8 potpgt;
70
71 /* Power the device on or off */
72 int (*set_power)(int state);
73
74 /* Turn device clock on or off */
75 int (*set_clock)(struct clk *clock, int is_on);
76
77 /* MUSB configuration-specific details */
78 struct musb_hdrc_config *config;
79};
80
81
82/* TUSB 6010 support */
83
84#define TUSB6010_OSCCLK_60 16667 /* psec/clk @ 60.0 MHz */
85#define TUSB6010_REFCLK_24 41667 /* psec/clk @ 24.0 MHz XI */
86#define TUSB6010_REFCLK_19 52083 /* psec/clk @ 19.2 MHz CLKIN */
87
88#ifdef CONFIG_ARCH_OMAP2
89
90extern int __init tusb6010_setup_interface(
91 struct musb_hdrc_platform_data *data,
92 unsigned ps_refclk, unsigned waitpin,
93 unsigned async_cs, unsigned sync_cs,
94 unsigned irq, unsigned dmachan);
95
96extern int tusb6010_platform_retime(unsigned is_refclk);
97
98#endif /* OMAP2 */
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 09a3e6a7518f..655341d0f534 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -17,7 +17,8 @@
17#include <linux/mutex.h> 17#include <linux/mutex.h>
18 18
19#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ 19#define SERIAL_TTY_MAJOR 188 /* Nice legal number now */
20#define SERIAL_TTY_MINORS 255 /* loads of devices :) */ 20#define SERIAL_TTY_MINORS 254 /* loads of devices :) */
21#define SERIAL_TTY_NO_MINOR 255 /* No minor was assigned */
21 22
22/* The maximum number of ports one device can grab at once */ 23/* The maximum number of ports one device can grab at once */
23#define MAX_NUM_PORTS 8 24#define MAX_NUM_PORTS 8
diff --git a/include/linux/videodev.h b/include/linux/videodev.h
index 9385a566aed8..15a653d41132 100644
--- a/include/linux/videodev.h
+++ b/include/linux/videodev.h
@@ -17,6 +17,21 @@
17 17
18#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__) 18#if defined(CONFIG_VIDEO_V4L1_COMPAT) || !defined (__KERNEL__)
19 19
20#define VID_TYPE_CAPTURE 1 /* Can capture */
21#define VID_TYPE_TUNER 2 /* Can tune */
22#define VID_TYPE_TELETEXT 4 /* Does teletext */
23#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */
24#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */
25#define VID_TYPE_CLIPPING 32 /* Can clip */
26#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */
27#define VID_TYPE_SCALES 128 /* Scalable */
28#define VID_TYPE_MONOCHROME 256 /* Monochrome only */
29#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */
30#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */
31#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
32#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
33#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
34
20struct video_capability 35struct video_capability
21{ 36{
22 char name[32]; 37 char name[32];
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 2e66a95e8d32..303d93ffd6b2 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -55,13 +55,13 @@
55 */ 55 */
56#ifndef __LINUX_VIDEODEV2_H 56#ifndef __LINUX_VIDEODEV2_H
57#define __LINUX_VIDEODEV2_H 57#define __LINUX_VIDEODEV2_H
58
58#ifdef __KERNEL__ 59#ifdef __KERNEL__
59#include <linux/time.h> /* need struct timeval */ 60#include <linux/time.h> /* need struct timeval */
60#include <linux/compiler.h> /* need __user */
61#else 61#else
62#define __user
63#include <sys/time.h> 62#include <sys/time.h>
64#endif 63#endif
64#include <linux/compiler.h>
65#include <linux/ioctl.h> 65#include <linux/ioctl.h>
66#include <linux/types.h> 66#include <linux/types.h>
67 67
@@ -71,6 +71,11 @@
71 */ 71 */
72#define VIDEO_MAX_FRAME 32 72#define VIDEO_MAX_FRAME 32
73 73
74#ifndef __KERNEL__
75
76/* These defines are V4L1 specific and should not be used with the V4L2 API!
77 They will be removed from this header in the future. */
78
74#define VID_TYPE_CAPTURE 1 /* Can capture */ 79#define VID_TYPE_CAPTURE 1 /* Can capture */
75#define VID_TYPE_TUNER 2 /* Can tune */ 80#define VID_TYPE_TUNER 2 /* Can tune */
76#define VID_TYPE_TELETEXT 4 /* Does teletext */ 81#define VID_TYPE_TELETEXT 4 /* Does teletext */
@@ -85,14 +90,15 @@
85#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ 90#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */
86#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ 91#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */
87#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ 92#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */
93#endif
88 94
89/* 95/*
90 * M I S C E L L A N E O U S 96 * M I S C E L L A N E O U S
91 */ 97 */
92 98
93/* Four-character-code (FOURCC) */ 99/* Four-character-code (FOURCC) */
94#define v4l2_fourcc(a,b,c,d)\ 100#define v4l2_fourcc(a, b, c, d)\
95 (((__u32)(a)<<0)|((__u32)(b)<<8)|((__u32)(c)<<16)|((__u32)(d)<<24)) 101 ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24))
96 102
97/* 103/*
98 * E N U M S 104 * E N U M S
@@ -226,8 +232,7 @@ struct v4l2_fract {
226/* 232/*
227 * D R I V E R C A P A B I L I T I E S 233 * D R I V E R C A P A B I L I T I E S
228 */ 234 */
229struct v4l2_capability 235struct v4l2_capability {
230{
231 __u8 driver[16]; /* i.e. "bttv" */ 236 __u8 driver[16]; /* i.e. "bttv" */
232 __u8 card[32]; /* i.e. "Hauppauge WinTV" */ 237 __u8 card[32]; /* i.e. "Hauppauge WinTV" */
233 __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */ 238 __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */
@@ -259,8 +264,7 @@ struct v4l2_capability
259/* 264/*
260 * V I D E O I M A G E F O R M A T 265 * V I D E O I M A G E F O R M A T
261 */ 266 */
262struct v4l2_pix_format 267struct v4l2_pix_format {
263{
264 __u32 width; 268 __u32 width;
265 __u32 height; 269 __u32 height;
266 __u32 pixelformat; 270 __u32 pixelformat;
@@ -272,68 +276,71 @@ struct v4l2_pix_format
272}; 276};
273 277
274/* Pixel format FOURCC depth Description */ 278/* Pixel format FOURCC depth Description */
275#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R','G','B','1') /* 8 RGB-3-3-2 */ 279#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */
276#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R','4','4','4') /* 16 xxxxrrrr ggggbbbb */ 280#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */
277#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R','G','B','O') /* 16 RGB-5-5-5 */ 281#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */
278#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R','G','B','P') /* 16 RGB-5-6-5 */ 282#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */
279#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R','G','B','Q') /* 16 RGB-5-5-5 BE */ 283#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */
280#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R','G','B','R') /* 16 RGB-5-6-5 BE */ 284#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */
281#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B','G','R','3') /* 24 BGR-8-8-8 */ 285#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */
282#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R','G','B','3') /* 24 RGB-8-8-8 */ 286#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */
283#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B','G','R','4') /* 32 BGR-8-8-8-8 */ 287#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */
284#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R','G','B','4') /* 32 RGB-8-8-8-8 */ 288#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */
285#define V4L2_PIX_FMT_GREY v4l2_fourcc('G','R','E','Y') /* 8 Greyscale */ 289#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */
286#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y','1','6',' ') /* 16 Greyscale */ 290#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */
287#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P','A','L','8') /* 8 8-bit palette */ 291#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */
288#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y','V','U','9') /* 9 YVU 4:1:0 */ 292#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */
289#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 */
290#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 */
291#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 */
292#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4','2','2','P') /* 16 YVU422 planar */ 296#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */
293#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4','1','1','P') /* 16 YVU411 planar */ 297#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 16 YVU411 planar */
294#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y','4','1','P') /* 12 YUV 4:1:1 */ 298#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */
295#define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y','4','4','4') /* 16 xxxxyyyy uuuuvvvv */ 299#define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y', '4', '4', '4') /* 16 xxxxyyyy uuuuvvvv */
296#define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y','U','V','O') /* 16 YUV-5-5-5 */ 300#define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */
297#define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y','U','V','P') /* 16 YUV-5-6-5 */ 301#define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */
298#define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y','U','V','4') /* 32 YUV-8-8-8-8 */ 302#define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */
299 303
300/* two planes -- one Y, one Cr + Cb interleaved */ 304/* two planes -- one Y, one Cr + Cb interleaved */
301#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N','V','1','2') /* 12 Y/CbCr 4:2:0 */ 305#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */
302#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N','V','2','1') /* 12 Y/CrCb 4:2:0 */ 306#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */
303 307
304/* The following formats are not defined in the V4L2 specification */ 308/* The following formats are not defined in the V4L2 specification */
305#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y','U','V','9') /* 9 YUV 4:1:0 */ 309#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */
306#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y','U','1','2') /* 12 YUV 4:2:0 */ 310#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */
307#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y','Y','U','V') /* 16 YUV 4:2:2 */ 311#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */
308#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H','I','2','4') /* 8 8-bit color */ 312#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */
309#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H','M','1','2') /* 8 YUV 4:2:0 16x16 macroblocks */ 313#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */
310 314
311/* see http://www.siliconimaging.com/RGB%20Bayer.htm */ 315/* see http://www.siliconimaging.com/RGB%20Bayer.htm */
312#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B','A','8','1') /* 8 BGBG.. GRGR.. */ 316#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */
313#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G','B','R','G') /* 8 GBGB.. RGRG.. */ 317#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */
314#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B','Y','R','2') /* 16 BGBG.. GRGR.. */ 318#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */
315 319
316/* compressed formats */ 320/* compressed formats */
317#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M','J','P','G') /* Motion-JPEG */ 321#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */
318#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J','P','E','G') /* JFIF JPEG */ 322#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */
319#define V4L2_PIX_FMT_DV v4l2_fourcc('d','v','s','d') /* 1394 */ 323#define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */
320#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M','P','E','G') /* MPEG-1/2/4 */ 324#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */
321 325
322/* Vendor-specific formats */ 326/* Vendor-specific formats */
323#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W','N','V','A') /* Winnov hw compress */ 327#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */
324#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S','9','1','0') /* SN9C10x compression */ 328#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */
325#define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P','W','C','1') /* pwc older webcam */ 329#define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P', 'W', 'C', '1') /* pwc older webcam */
326#define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P','W','C','2') /* pwc newer webcam */ 330#define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P', 'W', 'C', '2') /* pwc newer webcam */
327#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E','6','2','5') /* ET61X251 compression */ 331#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5') /* ET61X251 compression */
328#define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S','5','0','1') /* YUYV per line */ 332#define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S', '5', '0', '1') /* YUYV per line */
329#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S','5','6','1') /* compressed GBRG bayer */ 333#define V4L2_PIX_FMT_SPCA505 v4l2_fourcc('S', '5', '0', '5') /* YYUV per line */
330#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P','2','0','7') /* compressed BGGR bayer */ 334#define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */
335#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */
336#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */
337#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
338#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */
331 339
332/* 340/*
333 * F O R M A T E N U M E R A T I O N 341 * F O R M A T E N U M E R A T I O N
334 */ 342 */
335struct v4l2_fmtdesc 343struct v4l2_fmtdesc {
336{
337 __u32 index; /* Format number */ 344 __u32 index; /* Format number */
338 enum v4l2_buf_type type; /* buffer type */ 345 enum v4l2_buf_type type; /* buffer type */
339 __u32 flags; 346 __u32 flags;
@@ -349,21 +356,18 @@ struct v4l2_fmtdesc
349/* 356/*
350 * F R A M E S I Z E E N U M E R A T I O N 357 * F R A M E S I Z E E N U M E R A T I O N
351 */ 358 */
352enum v4l2_frmsizetypes 359enum v4l2_frmsizetypes {
353{
354 V4L2_FRMSIZE_TYPE_DISCRETE = 1, 360 V4L2_FRMSIZE_TYPE_DISCRETE = 1,
355 V4L2_FRMSIZE_TYPE_CONTINUOUS = 2, 361 V4L2_FRMSIZE_TYPE_CONTINUOUS = 2,
356 V4L2_FRMSIZE_TYPE_STEPWISE = 3, 362 V4L2_FRMSIZE_TYPE_STEPWISE = 3,
357}; 363};
358 364
359struct v4l2_frmsize_discrete 365struct v4l2_frmsize_discrete {
360{
361 __u32 width; /* Frame width [pixel] */ 366 __u32 width; /* Frame width [pixel] */
362 __u32 height; /* Frame height [pixel] */ 367 __u32 height; /* Frame height [pixel] */
363}; 368};
364 369
365struct v4l2_frmsize_stepwise 370struct v4l2_frmsize_stepwise {
366{
367 __u32 min_width; /* Minimum frame width [pixel] */ 371 __u32 min_width; /* Minimum frame width [pixel] */
368 __u32 max_width; /* Maximum frame width [pixel] */ 372 __u32 max_width; /* Maximum frame width [pixel] */
369 __u32 step_width; /* Frame width step size [pixel] */ 373 __u32 step_width; /* Frame width step size [pixel] */
@@ -372,8 +376,7 @@ struct v4l2_frmsize_stepwise
372 __u32 step_height; /* Frame height step size [pixel] */ 376 __u32 step_height; /* Frame height step size [pixel] */
373}; 377};
374 378
375struct v4l2_frmsizeenum 379struct v4l2_frmsizeenum {
376{
377 __u32 index; /* Frame size number */ 380 __u32 index; /* Frame size number */
378 __u32 pixel_format; /* Pixel format */ 381 __u32 pixel_format; /* Pixel format */
379 __u32 type; /* Frame size type the device supports. */ 382 __u32 type; /* Frame size type the device supports. */
@@ -389,22 +392,19 @@ struct v4l2_frmsizeenum
389/* 392/*
390 * F R A M E R A T E E N U M E R A T I O N 393 * F R A M E R A T E E N U M E R A T I O N
391 */ 394 */
392enum v4l2_frmivaltypes 395enum v4l2_frmivaltypes {
393{
394 V4L2_FRMIVAL_TYPE_DISCRETE = 1, 396 V4L2_FRMIVAL_TYPE_DISCRETE = 1,
395 V4L2_FRMIVAL_TYPE_CONTINUOUS = 2, 397 V4L2_FRMIVAL_TYPE_CONTINUOUS = 2,
396 V4L2_FRMIVAL_TYPE_STEPWISE = 3, 398 V4L2_FRMIVAL_TYPE_STEPWISE = 3,
397}; 399};
398 400
399struct v4l2_frmival_stepwise 401struct v4l2_frmival_stepwise {
400{
401 struct v4l2_fract min; /* Minimum frame interval [s] */ 402 struct v4l2_fract min; /* Minimum frame interval [s] */
402 struct v4l2_fract max; /* Maximum frame interval [s] */ 403 struct v4l2_fract max; /* Maximum frame interval [s] */
403 struct v4l2_fract step; /* Frame interval step size [s] */ 404 struct v4l2_fract step; /* Frame interval step size [s] */
404}; 405};
405 406
406struct v4l2_frmivalenum 407struct v4l2_frmivalenum {
407{
408 __u32 index; /* Frame format index */ 408 __u32 index; /* Frame format index */
409 __u32 pixel_format; /* Pixel format */ 409 __u32 pixel_format; /* Pixel format */
410 __u32 width; /* Frame width */ 410 __u32 width; /* Frame width */
@@ -423,8 +423,7 @@ struct v4l2_frmivalenum
423/* 423/*
424 * T I M E C O D E 424 * T I M E C O D E
425 */ 425 */
426struct v4l2_timecode 426struct v4l2_timecode {
427{
428 __u32 type; 427 __u32 type;
429 __u32 flags; 428 __u32 flags;
430 __u8 frames; 429 __u8 frames;
@@ -449,8 +448,7 @@ struct v4l2_timecode
449#define V4L2_TC_USERBITS_8BITCHARS 0x0008 448#define V4L2_TC_USERBITS_8BITCHARS 0x0008
450/* The above is based on SMPTE timecodes */ 449/* The above is based on SMPTE timecodes */
451 450
452struct v4l2_jpegcompression 451struct v4l2_jpegcompression {
453{
454 int quality; 452 int quality;
455 453
456 int APPn; /* Number of APP segment to be written, 454 int APPn; /* Number of APP segment to be written,
@@ -482,16 +480,14 @@ struct v4l2_jpegcompression
482/* 480/*
483 * M E M O R Y - M A P P I N G B U F F E R S 481 * M E M O R Y - M A P P I N G B U F F E R S
484 */ 482 */
485struct v4l2_requestbuffers 483struct v4l2_requestbuffers {
486{
487 __u32 count; 484 __u32 count;
488 enum v4l2_buf_type type; 485 enum v4l2_buf_type type;
489 enum v4l2_memory memory; 486 enum v4l2_memory memory;
490 __u32 reserved[2]; 487 __u32 reserved[2];
491}; 488};
492 489
493struct v4l2_buffer 490struct v4l2_buffer {
494{
495 __u32 index; 491 __u32 index;
496 enum v4l2_buf_type type; 492 enum v4l2_buf_type type;
497 __u32 bytesused; 493 __u32 bytesused;
@@ -525,13 +521,12 @@ struct v4l2_buffer
525/* 521/*
526 * O V E R L A Y P R E V I E W 522 * O V E R L A Y P R E V I E W
527 */ 523 */
528struct v4l2_framebuffer 524struct v4l2_framebuffer {
529{
530 __u32 capability; 525 __u32 capability;
531 __u32 flags; 526 __u32 flags;
532/* FIXME: in theory we should pass something like PCI device + memory 527/* FIXME: in theory we should pass something like PCI device + memory
533 * region + offset instead of some physical address */ 528 * region + offset instead of some physical address */
534 void* base; 529 void *base;
535 struct v4l2_pix_format fmt; 530 struct v4l2_pix_format fmt;
536}; 531};
537/* Flags for the 'capability' field. Read only */ 532/* Flags for the 'capability' field. Read only */
@@ -550,14 +545,12 @@ struct v4l2_framebuffer
550#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 545#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010
551#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 546#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020
552 547
553struct v4l2_clip 548struct v4l2_clip {
554{
555 struct v4l2_rect c; 549 struct v4l2_rect c;
556 struct v4l2_clip __user *next; 550 struct v4l2_clip __user *next;
557}; 551};
558 552
559struct v4l2_window 553struct v4l2_window {
560{
561 struct v4l2_rect w; 554 struct v4l2_rect w;
562 enum v4l2_field field; 555 enum v4l2_field field;
563 __u32 chromakey; 556 __u32 chromakey;
@@ -570,8 +563,7 @@ struct v4l2_window
570/* 563/*
571 * C A P T U R E P A R A M E T E R S 564 * C A P T U R E P A R A M E T E R S
572 */ 565 */
573struct v4l2_captureparm 566struct v4l2_captureparm {
574{
575 __u32 capability; /* Supported modes */ 567 __u32 capability; /* Supported modes */
576 __u32 capturemode; /* Current mode */ 568 __u32 capturemode; /* Current mode */
577 struct v4l2_fract timeperframe; /* Time per frame in .1us units */ 569 struct v4l2_fract timeperframe; /* Time per frame in .1us units */
@@ -584,8 +576,7 @@ struct v4l2_captureparm
584#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */ 576#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */
585#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */ 577#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */
586 578
587struct v4l2_outputparm 579struct v4l2_outputparm {
588{
589 __u32 capability; /* Supported modes */ 580 __u32 capability; /* Supported modes */
590 __u32 outputmode; /* Current mode */ 581 __u32 outputmode; /* Current mode */
591 struct v4l2_fract timeperframe; /* Time per frame in seconds */ 582 struct v4l2_fract timeperframe; /* Time per frame in seconds */
@@ -702,8 +693,7 @@ typedef __u64 v4l2_std_id;
702#define V4L2_STD_ALL (V4L2_STD_525_60 |\ 693#define V4L2_STD_ALL (V4L2_STD_525_60 |\
703 V4L2_STD_625_50) 694 V4L2_STD_625_50)
704 695
705struct v4l2_standard 696struct v4l2_standard {
706{
707 __u32 index; 697 __u32 index;
708 v4l2_std_id id; 698 v4l2_std_id id;
709 __u8 name[24]; 699 __u8 name[24];
@@ -715,8 +705,7 @@ struct v4l2_standard
715/* 705/*
716 * V I D E O I N P U T S 706 * V I D E O I N P U T S
717 */ 707 */
718struct v4l2_input 708struct v4l2_input {
719{
720 __u32 index; /* Which input */ 709 __u32 index; /* Which input */
721 __u8 name[32]; /* Label */ 710 __u8 name[32]; /* Label */
722 __u32 type; /* Type of input */ 711 __u32 type; /* Type of input */
@@ -753,8 +742,7 @@ struct v4l2_input
753/* 742/*
754 * V I D E O O U T P U T S 743 * V I D E O O U T P U T S
755 */ 744 */
756struct v4l2_output 745struct v4l2_output {
757{
758 __u32 index; /* Which output */ 746 __u32 index; /* Which output */
759 __u8 name[32]; /* Label */ 747 __u8 name[32]; /* Label */
760 __u32 type; /* Type of output */ 748 __u32 type; /* Type of output */
@@ -771,14 +759,12 @@ struct v4l2_output
771/* 759/*
772 * C O N T R O L S 760 * C O N T R O L S
773 */ 761 */
774struct v4l2_control 762struct v4l2_control {
775{
776 __u32 id; 763 __u32 id;
777 __s32 value; 764 __s32 value;
778}; 765};
779 766
780struct v4l2_ext_control 767struct v4l2_ext_control {
781{
782 __u32 id; 768 __u32 id;
783 __u32 reserved2[2]; 769 __u32 reserved2[2];
784 union { 770 union {
@@ -788,8 +774,7 @@ struct v4l2_ext_control
788 }; 774 };
789} __attribute__ ((packed)); 775} __attribute__ ((packed));
790 776
791struct v4l2_ext_controls 777struct v4l2_ext_controls {
792{
793 __u32 ctrl_class; 778 __u32 ctrl_class;
794 __u32 count; 779 __u32 count;
795 __u32 error_idx; 780 __u32 error_idx;
@@ -807,8 +792,7 @@ struct v4l2_ext_controls
807#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) 792#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000)
808 793
809/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ 794/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
810struct v4l2_queryctrl 795struct v4l2_queryctrl {
811{
812 __u32 id; 796 __u32 id;
813 enum v4l2_ctrl_type type; 797 enum v4l2_ctrl_type type;
814 __u8 name[32]; /* Whatever */ 798 __u8 name[32]; /* Whatever */
@@ -821,8 +805,7 @@ struct v4l2_queryctrl
821}; 805};
822 806
823/* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */ 807/* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */
824struct v4l2_querymenu 808struct v4l2_querymenu {
825{
826 __u32 id; 809 __u32 id;
827 __u32 index; 810 __u32 index;
828 __u8 name[32]; /* Whatever */ 811 __u8 name[32]; /* Whatever */
@@ -1104,8 +1087,7 @@ enum v4l2_exposure_auto_type {
1104/* 1087/*
1105 * T U N I N G 1088 * T U N I N G
1106 */ 1089 */
1107struct v4l2_tuner 1090struct v4l2_tuner {
1108{
1109 __u32 index; 1091 __u32 index;
1110 __u8 name[32]; 1092 __u8 name[32];
1111 enum v4l2_tuner_type type; 1093 enum v4l2_tuner_type type;
@@ -1119,8 +1101,7 @@ struct v4l2_tuner
1119 __u32 reserved[4]; 1101 __u32 reserved[4];
1120}; 1102};
1121 1103
1122struct v4l2_modulator 1104struct v4l2_modulator {
1123{
1124 __u32 index; 1105 __u32 index;
1125 __u8 name[32]; 1106 __u8 name[32];
1126 __u32 capability; 1107 __u32 capability;
@@ -1153,8 +1134,7 @@ struct v4l2_modulator
1153#define V4L2_TUNER_MODE_LANG1 0x0003 1134#define V4L2_TUNER_MODE_LANG1 0x0003
1154#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004 1135#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004
1155 1136
1156struct v4l2_frequency 1137struct v4l2_frequency {
1157{
1158 __u32 tuner; 1138 __u32 tuner;
1159 enum v4l2_tuner_type type; 1139 enum v4l2_tuner_type type;
1160 __u32 frequency; 1140 __u32 frequency;
@@ -1172,8 +1152,7 @@ struct v4l2_hw_freq_seek {
1172/* 1152/*
1173 * A U D I O 1153 * A U D I O
1174 */ 1154 */
1175struct v4l2_audio 1155struct v4l2_audio {
1176{
1177 __u32 index; 1156 __u32 index;
1178 __u8 name[32]; 1157 __u8 name[32];
1179 __u32 capability; 1158 __u32 capability;
@@ -1188,8 +1167,7 @@ struct v4l2_audio
1188/* Flags for the 'mode' field */ 1167/* Flags for the 'mode' field */
1189#define V4L2_AUDMODE_AVL 0x00001 1168#define V4L2_AUDMODE_AVL 0x00001
1190 1169
1191struct v4l2_audioout 1170struct v4l2_audioout {
1192{
1193 __u32 index; 1171 __u32 index;
1194 __u8 name[32]; 1172 __u8 name[32];
1195 __u32 capability; 1173 __u32 capability;
@@ -1253,8 +1231,7 @@ struct v4l2_encoder_cmd {
1253 */ 1231 */
1254 1232
1255/* Raw VBI */ 1233/* Raw VBI */
1256struct v4l2_vbi_format 1234struct v4l2_vbi_format {
1257{
1258 __u32 sampling_rate; /* in 1 Hz */ 1235 __u32 sampling_rate; /* in 1 Hz */
1259 __u32 offset; 1236 __u32 offset;
1260 __u32 samples_per_line; 1237 __u32 samples_per_line;
@@ -1266,8 +1243,8 @@ struct v4l2_vbi_format
1266}; 1243};
1267 1244
1268/* VBI flags */ 1245/* VBI flags */
1269#define V4L2_VBI_UNSYNC (1<< 0) 1246#define V4L2_VBI_UNSYNC (1 << 0)
1270#define V4L2_VBI_INTERLACED (1<< 1) 1247#define V4L2_VBI_INTERLACED (1 << 1)
1271 1248
1272/* Sliced VBI 1249/* Sliced VBI
1273 * 1250 *
@@ -1276,8 +1253,7 @@ struct v4l2_vbi_format
1276 * notice in the definitive implementation. 1253 * notice in the definitive implementation.
1277 */ 1254 */
1278 1255
1279struct v4l2_sliced_vbi_format 1256struct v4l2_sliced_vbi_format {
1280{
1281 __u16 service_set; 1257 __u16 service_set;
1282 /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field 1258 /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
1283 service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field 1259 service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
@@ -1301,8 +1277,7 @@ struct v4l2_sliced_vbi_format
1301#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525) 1277#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525)
1302#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) 1278#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625)
1303 1279
1304struct v4l2_sliced_vbi_cap 1280struct v4l2_sliced_vbi_cap {
1305{
1306 __u16 service_set; 1281 __u16 service_set;
1307 /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field 1282 /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field
1308 service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field 1283 service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field
@@ -1313,8 +1288,7 @@ struct v4l2_sliced_vbi_cap
1313 __u32 reserved[3]; /* must be 0 */ 1288 __u32 reserved[3]; /* must be 0 */
1314}; 1289};
1315 1290
1316struct v4l2_sliced_vbi_data 1291struct v4l2_sliced_vbi_data {
1317{
1318 __u32 id; 1292 __u32 id;
1319 __u32 field; /* 0: first field, 1: second field */ 1293 __u32 field; /* 0: first field, 1: second field */
1320 __u32 line; /* 1-23 */ 1294 __u32 line; /* 1-23 */
@@ -1328,27 +1302,23 @@ struct v4l2_sliced_vbi_data
1328 1302
1329/* Stream data format 1303/* Stream data format
1330 */ 1304 */
1331struct v4l2_format 1305struct v4l2_format {
1332{
1333 enum v4l2_buf_type type; 1306 enum v4l2_buf_type type;
1334 union 1307 union {
1335 { 1308 struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */
1336 struct v4l2_pix_format pix; // V4L2_BUF_TYPE_VIDEO_CAPTURE 1309 struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */
1337 struct v4l2_window win; // V4L2_BUF_TYPE_VIDEO_OVERLAY 1310 struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */
1338 struct v4l2_vbi_format vbi; // V4L2_BUF_TYPE_VBI_CAPTURE 1311 struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */
1339 struct v4l2_sliced_vbi_format sliced; // V4L2_BUF_TYPE_SLICED_VBI_CAPTURE 1312 __u8 raw_data[200]; /* user-defined */
1340 __u8 raw_data[200]; // user-defined
1341 } fmt; 1313 } fmt;
1342}; 1314};
1343 1315
1344 1316
1345/* Stream type-dependent parameters 1317/* Stream type-dependent parameters
1346 */ 1318 */
1347struct v4l2_streamparm 1319struct v4l2_streamparm {
1348{
1349 enum v4l2_buf_type type; 1320 enum v4l2_buf_type type;
1350 union 1321 union {
1351 {
1352 struct v4l2_captureparm capture; 1322 struct v4l2_captureparm capture;
1353 struct v4l2_outputparm output; 1323 struct v4l2_outputparm output;
1354 __u8 raw_data[200]; /* user-defined */ 1324 __u8 raw_data[200]; /* user-defined */
@@ -1386,92 +1356,86 @@ struct v4l2_chip_ident {
1386 * I O C T L C O D E S F O R V I D E O D E V I C E S 1356 * I O C T L C O D E S F O R V I D E O D E V I C E S
1387 * 1357 *
1388 */ 1358 */
1389#define VIDIOC_QUERYCAP _IOR ('V', 0, struct v4l2_capability) 1359#define VIDIOC_QUERYCAP _IOR('V', 0, struct v4l2_capability)
1390#define VIDIOC_RESERVED _IO ('V', 1) 1360#define VIDIOC_RESERVED _IO('V', 1)
1391#define VIDIOC_ENUM_FMT _IOWR ('V', 2, struct v4l2_fmtdesc) 1361#define VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc)
1392#define VIDIOC_G_FMT _IOWR ('V', 4, struct v4l2_format) 1362#define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format)
1393#define VIDIOC_S_FMT _IOWR ('V', 5, struct v4l2_format) 1363#define VIDIOC_S_FMT _IOWR('V', 5, struct v4l2_format)
1394#define VIDIOC_REQBUFS _IOWR ('V', 8, struct v4l2_requestbuffers) 1364#define VIDIOC_REQBUFS _IOWR('V', 8, struct v4l2_requestbuffers)
1395#define VIDIOC_QUERYBUF _IOWR ('V', 9, struct v4l2_buffer) 1365#define VIDIOC_QUERYBUF _IOWR('V', 9, struct v4l2_buffer)
1396#define VIDIOC_G_FBUF _IOR ('V', 10, struct v4l2_framebuffer) 1366#define VIDIOC_G_FBUF _IOR('V', 10, struct v4l2_framebuffer)
1397#define VIDIOC_S_FBUF _IOW ('V', 11, struct v4l2_framebuffer) 1367#define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer)
1398#define VIDIOC_OVERLAY _IOW ('V', 14, int) 1368#define VIDIOC_OVERLAY _IOW('V', 14, int)
1399#define VIDIOC_QBUF _IOWR ('V', 15, struct v4l2_buffer) 1369#define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer)
1400#define VIDIOC_DQBUF _IOWR ('V', 17, struct v4l2_buffer) 1370#define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer)
1401#define VIDIOC_STREAMON _IOW ('V', 18, int) 1371#define VIDIOC_STREAMON _IOW('V', 18, int)
1402#define VIDIOC_STREAMOFF _IOW ('V', 19, int) 1372#define VIDIOC_STREAMOFF _IOW('V', 19, int)
1403#define VIDIOC_G_PARM _IOWR ('V', 21, struct v4l2_streamparm) 1373#define VIDIOC_G_PARM _IOWR('V', 21, struct v4l2_streamparm)
1404#define VIDIOC_S_PARM _IOWR ('V', 22, struct v4l2_streamparm) 1374#define VIDIOC_S_PARM _IOWR('V', 22, struct v4l2_streamparm)
1405#define VIDIOC_G_STD _IOR ('V', 23, v4l2_std_id) 1375#define VIDIOC_G_STD _IOR('V', 23, v4l2_std_id)
1406#define VIDIOC_S_STD _IOW ('V', 24, v4l2_std_id) 1376#define VIDIOC_S_STD _IOW('V', 24, v4l2_std_id)
1407#define VIDIOC_ENUMSTD _IOWR ('V', 25, struct v4l2_standard) 1377#define VIDIOC_ENUMSTD _IOWR('V', 25, struct v4l2_standard)
1408#define VIDIOC_ENUMINPUT _IOWR ('V', 26, struct v4l2_input) 1378#define VIDIOC_ENUMINPUT _IOWR('V', 26, struct v4l2_input)
1409#define VIDIOC_G_CTRL _IOWR ('V', 27, struct v4l2_control) 1379#define VIDIOC_G_CTRL _IOWR('V', 27, struct v4l2_control)
1410#define VIDIOC_S_CTRL _IOWR ('V', 28, struct v4l2_control) 1380#define VIDIOC_S_CTRL _IOWR('V', 28, struct v4l2_control)
1411#define VIDIOC_G_TUNER _IOWR ('V', 29, struct v4l2_tuner) 1381#define VIDIOC_G_TUNER _IOWR('V', 29, struct v4l2_tuner)
1412#define VIDIOC_S_TUNER _IOW ('V', 30, struct v4l2_tuner) 1382#define VIDIOC_S_TUNER _IOW('V', 30, struct v4l2_tuner)
1413#define VIDIOC_G_AUDIO _IOR ('V', 33, struct v4l2_audio) 1383#define VIDIOC_G_AUDIO _IOR('V', 33, struct v4l2_audio)
1414#define VIDIOC_S_AUDIO _IOW ('V', 34, struct v4l2_audio) 1384#define VIDIOC_S_AUDIO _IOW('V', 34, struct v4l2_audio)
1415#define VIDIOC_QUERYCTRL _IOWR ('V', 36, struct v4l2_queryctrl) 1385#define VIDIOC_QUERYCTRL _IOWR('V', 36, struct v4l2_queryctrl)
1416#define VIDIOC_QUERYMENU _IOWR ('V', 37, struct v4l2_querymenu) 1386#define VIDIOC_QUERYMENU _IOWR('V', 37, struct v4l2_querymenu)
1417#define VIDIOC_G_INPUT _IOR ('V', 38, int) 1387#define VIDIOC_G_INPUT _IOR('V', 38, int)
1418#define VIDIOC_S_INPUT _IOWR ('V', 39, int) 1388#define VIDIOC_S_INPUT _IOWR('V', 39, int)
1419#define VIDIOC_G_OUTPUT _IOR ('V', 46, int) 1389#define VIDIOC_G_OUTPUT _IOR('V', 46, int)
1420#define VIDIOC_S_OUTPUT _IOWR ('V', 47, int) 1390#define VIDIOC_S_OUTPUT _IOWR('V', 47, int)
1421#define VIDIOC_ENUMOUTPUT _IOWR ('V', 48, struct v4l2_output) 1391#define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output)
1422#define VIDIOC_G_AUDOUT _IOR ('V', 49, struct v4l2_audioout) 1392#define VIDIOC_G_AUDOUT _IOR('V', 49, struct v4l2_audioout)
1423#define VIDIOC_S_AUDOUT _IOW ('V', 50, struct v4l2_audioout) 1393#define VIDIOC_S_AUDOUT _IOW('V', 50, struct v4l2_audioout)
1424#define VIDIOC_G_MODULATOR _IOWR ('V', 54, struct v4l2_modulator) 1394#define VIDIOC_G_MODULATOR _IOWR('V', 54, struct v4l2_modulator)
1425#define VIDIOC_S_MODULATOR _IOW ('V', 55, struct v4l2_modulator) 1395#define VIDIOC_S_MODULATOR _IOW('V', 55, struct v4l2_modulator)
1426#define VIDIOC_G_FREQUENCY _IOWR ('V', 56, struct v4l2_frequency) 1396#define VIDIOC_G_FREQUENCY _IOWR('V', 56, struct v4l2_frequency)
1427#define VIDIOC_S_FREQUENCY _IOW ('V', 57, struct v4l2_frequency) 1397#define VIDIOC_S_FREQUENCY _IOW('V', 57, struct v4l2_frequency)
1428#define VIDIOC_CROPCAP _IOWR ('V', 58, struct v4l2_cropcap) 1398#define VIDIOC_CROPCAP _IOWR('V', 58, struct v4l2_cropcap)
1429#define VIDIOC_G_CROP _IOWR ('V', 59, struct v4l2_crop) 1399#define VIDIOC_G_CROP _IOWR('V', 59, struct v4l2_crop)
1430#define VIDIOC_S_CROP _IOW ('V', 60, struct v4l2_crop) 1400#define VIDIOC_S_CROP _IOW('V', 60, struct v4l2_crop)
1431#define VIDIOC_G_JPEGCOMP _IOR ('V', 61, struct v4l2_jpegcompression) 1401#define VIDIOC_G_JPEGCOMP _IOR('V', 61, struct v4l2_jpegcompression)
1432#define VIDIOC_S_JPEGCOMP _IOW ('V', 62, struct v4l2_jpegcompression) 1402#define VIDIOC_S_JPEGCOMP _IOW('V', 62, struct v4l2_jpegcompression)
1433#define VIDIOC_QUERYSTD _IOR ('V', 63, v4l2_std_id) 1403#define VIDIOC_QUERYSTD _IOR('V', 63, v4l2_std_id)
1434#define VIDIOC_TRY_FMT _IOWR ('V', 64, struct v4l2_format) 1404#define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format)
1435#define VIDIOC_ENUMAUDIO _IOWR ('V', 65, struct v4l2_audio) 1405#define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio)
1436#define VIDIOC_ENUMAUDOUT _IOWR ('V', 66, struct v4l2_audioout) 1406#define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout)
1437#define VIDIOC_G_PRIORITY _IOR ('V', 67, enum v4l2_priority) 1407#define VIDIOC_G_PRIORITY _IOR('V', 67, enum v4l2_priority)
1438#define VIDIOC_S_PRIORITY _IOW ('V', 68, enum v4l2_priority) 1408#define VIDIOC_S_PRIORITY _IOW('V', 68, enum v4l2_priority)
1439#define VIDIOC_G_SLICED_VBI_CAP _IOWR ('V', 69, struct v4l2_sliced_vbi_cap) 1409#define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap)
1440#define VIDIOC_LOG_STATUS _IO ('V', 70) 1410#define VIDIOC_LOG_STATUS _IO('V', 70)
1441#define VIDIOC_G_EXT_CTRLS _IOWR ('V', 71, struct v4l2_ext_controls) 1411#define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls)
1442#define VIDIOC_S_EXT_CTRLS _IOWR ('V', 72, struct v4l2_ext_controls) 1412#define VIDIOC_S_EXT_CTRLS _IOWR('V', 72, struct v4l2_ext_controls)
1443#define VIDIOC_TRY_EXT_CTRLS _IOWR ('V', 73, struct v4l2_ext_controls) 1413#define VIDIOC_TRY_EXT_CTRLS _IOWR('V', 73, struct v4l2_ext_controls)
1444#if 1 1414#if 1
1445#define VIDIOC_ENUM_FRAMESIZES _IOWR ('V', 74, struct v4l2_frmsizeenum) 1415#define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum)
1446#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR ('V', 75, struct v4l2_frmivalenum) 1416#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum)
1447#define VIDIOC_G_ENC_INDEX _IOR ('V', 76, struct v4l2_enc_idx) 1417#define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx)
1448#define VIDIOC_ENCODER_CMD _IOWR ('V', 77, struct v4l2_encoder_cmd) 1418#define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd)
1449#define VIDIOC_TRY_ENCODER_CMD _IOWR ('V', 78, struct v4l2_encoder_cmd) 1419#define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd)
1450 1420
1451/* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ 1421/* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */
1452#define VIDIOC_DBG_S_REGISTER _IOW ('V', 79, struct v4l2_register) 1422#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_register)
1453#define VIDIOC_DBG_G_REGISTER _IOWR ('V', 80, struct v4l2_register) 1423#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_register)
1454 1424
1455#define VIDIOC_G_CHIP_IDENT _IOWR ('V', 81, struct v4l2_chip_ident) 1425#define VIDIOC_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_chip_ident)
1456#endif 1426#endif
1457#define VIDIOC_S_HW_FREQ_SEEK _IOW ('V', 82, struct v4l2_hw_freq_seek) 1427#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek)
1458 1428
1459#ifdef __OLD_VIDIOC_ 1429#ifdef __OLD_VIDIOC_
1460/* for compatibility, will go away some day */ 1430/* for compatibility, will go away some day */
1461#define VIDIOC_OVERLAY_OLD _IOWR ('V', 14, int) 1431#define VIDIOC_OVERLAY_OLD _IOWR('V', 14, int)
1462#define VIDIOC_S_PARM_OLD _IOW ('V', 22, struct v4l2_streamparm) 1432#define VIDIOC_S_PARM_OLD _IOW('V', 22, struct v4l2_streamparm)
1463#define VIDIOC_S_CTRL_OLD _IOW ('V', 28, struct v4l2_control) 1433#define VIDIOC_S_CTRL_OLD _IOW('V', 28, struct v4l2_control)
1464#define VIDIOC_G_AUDIO_OLD _IOWR ('V', 33, struct v4l2_audio) 1434#define VIDIOC_G_AUDIO_OLD _IOWR('V', 33, struct v4l2_audio)
1465#define VIDIOC_G_AUDOUT_OLD _IOWR ('V', 49, struct v4l2_audioout) 1435#define VIDIOC_G_AUDOUT_OLD _IOWR('V', 49, struct v4l2_audioout)
1466#define VIDIOC_CROPCAP_OLD _IOR ('V', 58, struct v4l2_cropcap) 1436#define VIDIOC_CROPCAP_OLD _IOR('V', 58, struct v4l2_cropcap)
1467#endif 1437#endif
1468 1438
1469#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ 1439#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */
1470 1440
1471#endif /* __LINUX_VIDEODEV2_H */ 1441#endif /* __LINUX_VIDEODEV2_H */
1472
1473/*
1474 * Local variables:
1475 * c-basic-offset: 8
1476 * End:
1477 */
diff --git a/include/linux/videotext.h b/include/linux/videotext.h
index 018f92047ff8..3e68c8d1c7f7 100644
--- a/include/linux/videotext.h
+++ b/include/linux/videotext.h
@@ -45,10 +45,10 @@
45#define VTXIOCCLRCACHE_OLD 0x710b /* clear cache on VTX-interface (if avail.) */ 45#define VTXIOCCLRCACHE_OLD 0x710b /* clear cache on VTX-interface (if avail.) */
46#define VTXIOCSETVIRT_OLD 0x710c /* turn on virtual mode (this disables TV-display) */ 46#define VTXIOCSETVIRT_OLD 0x710c /* turn on virtual mode (this disables TV-display) */
47 47
48/* 48/*
49 * Definitions for VTXIOCGETINFO 49 * Definitions for VTXIOCGETINFO
50 */ 50 */
51 51
52#define SAA5243 0 52#define SAA5243 0
53#define SAA5246 1 53#define SAA5246 1
54#define SAA5249 2 54#define SAA5249 2
@@ -57,10 +57,10 @@
57 57
58typedef struct { 58typedef struct {
59 int version_major, version_minor; /* version of driver; if version_major changes, driver */ 59 int version_major, version_minor; /* version of driver; if version_major changes, driver */
60 /* is not backward compatible!!! CHECK THIS!!! */ 60 /* is not backward compatible!!! CHECK THIS!!! */
61 int numpages; /* number of page-buffers of vtx-chipset */ 61 int numpages; /* number of page-buffers of vtx-chipset */
62 int cct_type; /* type of vtx-chipset (SAA5243, SAA5246, SAA5248 or 62 int cct_type; /* type of vtx-chipset (SAA5243, SAA5246, SAA5248 or
63 * SAA5249) */ 63 * SAA5249) */
64} 64}
65vtx_info_t; 65vtx_info_t;
66 66
@@ -81,7 +81,7 @@ vtx_info_t;
81#define PGMASK_HOUR (HR_TEN | HR_UNIT) 81#define PGMASK_HOUR (HR_TEN | HR_UNIT)
82#define PGMASK_MINUTE (MIN_TEN | MIN_UNIT) 82#define PGMASK_MINUTE (MIN_TEN | MIN_UNIT)
83 83
84typedef struct 84typedef struct
85{ 85{
86 int page; /* number of requested page (hexadecimal) */ 86 int page; /* number of requested page (hexadecimal) */
87 int hour; /* requested hour (hexadecimal) */ 87 int hour; /* requested hour (hexadecimal) */
@@ -98,11 +98,11 @@ vtx_pagereq_t;
98/* 98/*
99 * Definitions for VTXIOC{GETSTAT,PUTSTAT} 99 * Definitions for VTXIOC{GETSTAT,PUTSTAT}
100 */ 100 */
101 101
102#define VTX_PAGESIZE (40 * 24) 102#define VTX_PAGESIZE (40 * 24)
103#define VTX_VIRTUALSIZE (40 * 49) 103#define VTX_VIRTUALSIZE (40 * 49)
104 104
105typedef struct 105typedef struct
106{ 106{
107 int pagenum; /* number of page (hexadecimal) */ 107 int pagenum; /* number of page (hexadecimal) */
108 int hour; /* hour (hexadecimal) */ 108 int hour; /* hour (hexadecimal) */
@@ -121,5 +121,5 @@ typedef struct
121 unsigned hamming : 1; /* hamming-error occurred */ 121 unsigned hamming : 1; /* hamming-error occurred */
122} 122}
123vtx_pageinfo_t; 123vtx_pageinfo_t;
124 124
125#endif /* _VTX_H */ 125#endif /* _VTX_H */
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 364789aae9f3..328eb4022727 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -4,9 +4,9 @@
4#include <linux/spinlock.h> 4#include <linux/spinlock.h>
5#include <asm/page.h> /* pgprot_t */ 5#include <asm/page.h> /* pgprot_t */
6 6
7struct vm_area_struct; 7struct vm_area_struct; /* vma defining user mapping in mm_types.h */
8 8
9/* bits in vm_struct->flags */ 9/* bits in flags of vmalloc's vm_struct below */
10#define VM_IOREMAP 0x00000001 /* ioremap() and friends */ 10#define VM_IOREMAP 0x00000001 /* ioremap() and friends */
11#define VM_ALLOC 0x00000002 /* vmalloc() */ 11#define VM_ALLOC 0x00000002 /* vmalloc() */
12#define VM_MAP 0x00000004 /* vmap()ed pages */ 12#define VM_MAP 0x00000004 /* vmap()ed pages */
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h
index 14c0e91be9b5..1cbd0a7db4e6 100644
--- a/include/linux/vt_kern.h
+++ b/include/linux/vt_kern.h
@@ -35,7 +35,6 @@ extern int fg_console, last_console, want_console;
35int vc_allocate(unsigned int console); 35int vc_allocate(unsigned int console);
36int vc_cons_allocated(unsigned int console); 36int vc_cons_allocated(unsigned int console);
37int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines); 37int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines);
38int vc_lock_resize(struct vc_data *vc, unsigned int cols, unsigned int lines);
39void vc_deallocate(unsigned int console); 38void vc_deallocate(unsigned int console);
40void reset_palette(struct vc_data *vc); 39void reset_palette(struct vc_data *vc);
41void do_blank_screen(int entering_gfx); 40void do_blank_screen(int entering_gfx);
@@ -74,7 +73,7 @@ void con_protect_unimap(struct vc_data *vc, int rdonly);
74int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc); 73int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
75 74
76#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \ 75#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \
77 (vc)->vc_toggle_meta ? 0x80 : 0]) 76 ((vc)->vc_toggle_meta ? 0x80 : 0)])
78#else 77#else
79#define con_set_trans_old(arg) (0) 78#define con_set_trans_old(arg) (0)
80#define con_get_trans_old(arg) (-EINVAL) 79#define con_get_trans_old(arg) (-EINVAL)
@@ -86,6 +85,7 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);
86#define con_copy_unimap(d, s) (0) 85#define con_copy_unimap(d, s) (0)
87#define con_get_unimap(vc, ct, uct, list) (-EINVAL) 86#define con_get_unimap(vc, ct, uct, list) (-EINVAL)
88#define con_free_unimap(vc) do { ; } while (0) 87#define con_free_unimap(vc) do { ; } while (0)
88#define con_protect_unimap(vc, rdonly) do { ; } while (0)
89 89
90#define vc_translate(vc, c) (c) 90#define vc_translate(vc, c) (c)
91#endif 91#endif
diff --git a/include/linux/wm97xx_batt.h b/include/linux/wm97xx_batt.h
new file mode 100644
index 000000000000..9681d1ab0e4f
--- /dev/null
+++ b/include/linux/wm97xx_batt.h
@@ -0,0 +1,26 @@
1#ifndef _LINUX_WM97XX_BAT_H
2#define _LINUX_WM97XX_BAT_H
3
4#include <linux/wm97xx.h>
5
6struct wm97xx_batt_info {
7 int batt_aux;
8 int temp_aux;
9 int charge_gpio;
10 int min_voltage;
11 int max_voltage;
12 int batt_div;
13 int batt_mult;
14 int temp_div;
15 int temp_mult;
16 int batt_tech;
17 char *batt_name;
18};
19
20#ifdef CONFIG_BATTERY_WM97XX
21void __init wm97xx_bat_set_pdata(struct wm97xx_batt_info *data);
22#else
23static inline void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data) {}
24#endif
25
26#endif
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index fb0c215a3051..4bc1e6b86cb2 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -279,6 +279,7 @@ enum xfrm_attr_type_t {
279 XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */ 279 XFRMA_POLICY_TYPE, /* struct xfrm_userpolicy_type */
280 XFRMA_MIGRATE, 280 XFRMA_MIGRATE,
281 XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */ 281 XFRMA_ALG_AEAD, /* struct xfrm_algo_aead */
282 XFRMA_KMADDRESS, /* struct xfrm_user_kmaddress */
282 __XFRMA_MAX 283 __XFRMA_MAX
283 284
284#define XFRMA_MAX (__XFRMA_MAX - 1) 285#define XFRMA_MAX (__XFRMA_MAX - 1)
@@ -415,6 +416,15 @@ struct xfrm_user_report {
415 struct xfrm_selector sel; 416 struct xfrm_selector sel;
416}; 417};
417 418
419/* Used by MIGRATE to pass addresses IKE should use to perform
420 * SA negotiation with the peer */
421struct xfrm_user_kmaddress {
422 xfrm_address_t local;
423 xfrm_address_t remote;
424 __u32 reserved;
425 __u16 family;
426};
427
418struct xfrm_user_migrate { 428struct xfrm_user_migrate {
419 xfrm_address_t old_daddr; 429 xfrm_address_t old_daddr;
420 xfrm_address_t old_saddr; 430 xfrm_address_t old_saddr;