aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-arm/arch-davinci/i2c.h21
-rw-r--r--include/asm-arm/io.h8
-rw-r--r--include/asm-blackfin/mach-bf548/bf54x_keys.h17
-rw-r--r--include/asm-blackfin/mach-bf548/dma.h1
-rw-r--r--include/asm-blackfin/nand.h47
-rw-r--r--include/asm-frv/system.h5
-rw-r--r--include/asm-generic/libata-portmap.h5
-rw-r--r--include/asm-generic/vmlinux.lds.h3
-rw-r--r--include/asm-ia64/dma-mapping.h1
-rw-r--r--include/asm-ia64/mca.h2
-rw-r--r--include/asm-ia64/sal.h15
-rw-r--r--include/asm-m68k/Kbuild1
-rw-r--r--include/asm-m68k/unistd.h3
-rw-r--r--include/asm-mips/fw/cfe/cfe_api.h2
-rw-r--r--include/asm-mips/mach-au1x00/prom.h13
-rw-r--r--include/asm-powerpc/dcr-mmio.h6
-rw-r--r--include/asm-powerpc/dcr-native.h6
-rw-r--r--include/asm-powerpc/io.h4
-rw-r--r--include/asm-powerpc/of_device.h2
-rw-r--r--include/asm-s390/cache.h2
-rw-r--r--include/asm-s390/ccwdev.h77
-rw-r--r--include/asm-s390/ccwgroup.h32
-rw-r--r--include/asm-s390/cio.h288
-rw-r--r--include/asm-s390/cmb.h73
-rw-r--r--include/asm-s390/page.h3
-rw-r--r--include/asm-s390/pgtable.h13
-rw-r--r--include/asm-s390/s390_ext.h8
-rw-r--r--include/asm-s390/system.h24
-rw-r--r--include/asm-s390/zcrypt.h4
-rw-r--r--include/asm-sh/cacheflush.h33
-rw-r--r--include/asm-sh/cpu-sh3/cache.h4
-rw-r--r--include/asm-sh/cpu-sh3/dma.h13
-rw-r--r--include/asm-sh/cpu-sh3/gpio.h66
-rw-r--r--include/asm-sh/cpu-sh3/mmu_context.h9
-rw-r--r--include/asm-sh/cpu-sh3/timer.h9
-rw-r--r--include/asm-sh/cpu-sh3/ubc.h3
-rw-r--r--include/asm-sh/cpu-sh4/dma.h2
-rw-r--r--include/asm-sh/cpu-sh4/mmu_context.h14
-rw-r--r--include/asm-sh/dma.h5
-rw-r--r--include/asm-sh/dreamcast/maple.h37
-rw-r--r--include/asm-sh/gpio.h19
-rw-r--r--include/asm-sh/hd64461.h1
-rw-r--r--include/asm-sh/heartbeat.h17
-rw-r--r--include/asm-sh/hw_irq.h53
-rw-r--r--include/asm-sh/ilsel.h45
-rw-r--r--include/asm-sh/io.h26
-rw-r--r--include/asm-sh/kgdb.h24
-rw-r--r--include/asm-sh/magicpanelr2.h67
-rw-r--r--include/asm-sh/page.h10
-rw-r--r--include/asm-sh/pgtable.h115
-rw-r--r--include/asm-sh/processor.h11
-rw-r--r--include/asm-sh/r7780rp.h33
-rw-r--r--include/asm-sh/rtc.h6
-rw-r--r--include/asm-sh/rts7751r2d.h65
-rw-r--r--include/asm-sh/sections.h1
-rw-r--r--include/asm-sh/sh03/io.h9
-rw-r--r--include/asm-sh/smp.h34
-rw-r--r--include/asm-sh/snapgear.h12
-rw-r--r--include/asm-sh/spinlock.h181
-rw-r--r--include/asm-sh/spinlock_types.h11
-rw-r--r--include/asm-sh/system.h1
-rw-r--r--include/asm-sh/voyagergx.h39
-rw-r--r--include/asm-sh64/gpio.h8
-rw-r--r--include/asm-sh64/io.h7
-rw-r--r--include/asm-sparc/irqflags.h39
-rw-r--r--include/asm-sparc/system.h22
-rw-r--r--include/asm-sparc64/cpudata.h21
-rw-r--r--include/asm-sparc64/irq.h13
-rw-r--r--include/asm-x86/8253pit.h5
-rw-r--r--include/asm-x86/8253pit_32.h12
-rw-r--r--include/asm-x86/8253pit_64.h10
-rw-r--r--include/asm-x86/apic_64.h8
-rw-r--r--include/asm-x86/cpufeature_64.h2
-rw-r--r--include/asm-x86/geode.h50
-rw-r--r--include/asm-x86/hardirq_32.h1
-rw-r--r--include/asm-x86/hpet.h96
-rw-r--r--include/asm-x86/hpet_32.h90
-rw-r--r--include/asm-x86/hpet_64.h18
-rw-r--r--include/asm-x86/i8253.h20
-rw-r--r--include/asm-x86/i8253_32.h17
-rw-r--r--include/asm-x86/i8253_64.h6
-rw-r--r--include/asm-x86/io_apic_32.h16
-rw-r--r--include/asm-x86/irqflags_32.h13
-rw-r--r--include/asm-x86/irqflags_64.h14
-rw-r--r--include/asm-x86/pci.h90
-rw-r--r--include/asm-x86/pci_32.h58
-rw-r--r--include/asm-x86/pci_64.h56
-rw-r--r--include/asm-x86/pda.h1
-rw-r--r--include/asm-x86/processor-flags.h2
-rw-r--r--include/asm-x86/proto.h7
-rw-r--r--include/asm-x86/system_32.h19
-rw-r--r--include/asm-x86/system_64.h10
-rw-r--r--include/asm-x86/timex.h19
-rw-r--r--include/asm-x86/timex_32.h22
-rw-r--r--include/asm-x86/timex_64.h31
-rw-r--r--include/asm-x86/tsc.h15
-rw-r--r--include/asm-x86/vsyscall.h3
-rw-r--r--include/linux/agpgart.h2
-rw-r--r--include/linux/ata.h116
-rw-r--r--include/linux/blkdev.h14
-rw-r--r--include/linux/blktrace_api.h7
-rw-r--r--include/linux/clockchips.h10
-rw-r--r--include/linux/cpufreq.h39
-rw-r--r--include/linux/debugfs.h27
-rw-r--r--include/linux/device.h17
-rw-r--r--include/linux/fs.h28
-rw-r--r--include/linux/gfs2_ondisk.h30
-rw-r--r--include/linux/gpio_keys.h1
-rw-r--r--include/linux/hdlcdrv.h2
-rw-r--r--include/linux/hid.h27
-rw-r--r--include/linux/hidraw.h86
-rw-r--r--include/linux/hwmon.h4
-rw-r--r--include/linux/i2c-dev.h31
-rw-r--r--include/linux/i2c.h102
-rw-r--r--include/linux/ide.h35
-rw-r--r--include/linux/if_bridge.h2
-rw-r--r--include/linux/inet_lro.h8
-rw-r--r--include/linux/input.h118
-rw-r--r--include/linux/isdn.h1
-rw-r--r--include/linux/jbd.h5
-rw-r--r--include/linux/jffs2.h1
-rw-r--r--include/linux/jiffies.h10
-rw-r--r--include/linux/kernel.h14
-rw-r--r--include/linux/kernel_stat.h1
-rw-r--r--include/linux/keyboard.h4
-rw-r--r--include/linux/kobject.h125
-rw-r--r--include/linux/kvm.h128
-rw-r--r--include/linux/libata.h320
-rw-r--r--include/linux/lockdep.h9
-rw-r--r--include/linux/maple.h80
-rw-r--r--include/linux/mod_devicetable.h5
-rw-r--r--include/linux/mtd/cfi.h9
-rw-r--r--include/linux/mtd/flashchip.h1
-rw-r--r--include/linux/mtd/map.h10
-rw-r--r--include/linux/mtd/mtd.h7
-rw-r--r--include/linux/mtd/nand.h1
-rw-r--r--include/linux/mtd/onenand.h12
-rw-r--r--include/linux/mtd/onenand_regs.h4
-rw-r--r--include/linux/mutex.h9
-rw-r--r--include/linux/netdevice.h1
-rw-r--r--include/linux/netfilter.h26
-rw-r--r--include/linux/netfilter/nf_conntrack_amanda.h2
-rw-r--r--include/linux/netfilter/nf_conntrack_ftp.h2
-rw-r--r--include/linux/netfilter/nf_conntrack_h323.h18
-rw-r--r--include/linux/netfilter/nf_conntrack_irc.h2
-rw-r--r--include/linux/netfilter/nf_conntrack_pptp.h4
-rw-r--r--include/linux/netfilter/nf_conntrack_sip.h4
-rw-r--r--include/linux/netfilter/nf_conntrack_tftp.h2
-rw-r--r--include/linux/netfilter/x_tables.h2
-rw-r--r--include/linux/netfilter_arp/arp_tables.h2
-rw-r--r--include/linux/netfilter_bridge/ebtables.h4
-rw-r--r--include/linux/netfilter_ipv4.h4
-rw-r--r--include/linux/netfilter_ipv4/ip_tables.h2
-rw-r--r--include/linux/netfilter_ipv6/ip6_tables.h2
-rw-r--r--include/linux/nfs_fs.h78
-rw-r--r--include/linux/nfs_page.h1
-rw-r--r--include/linux/nfs_xdr.h6
-rw-r--r--include/linux/nfsd/nfsd.h18
-rw-r--r--include/linux/nfsd/nfsfh.h42
-rw-r--r--include/linux/nfsd/xdr4.h4
-rw-r--r--include/linux/pci.h7
-rw-r--r--include/linux/pci_ids.h9
-rw-r--r--include/linux/pci_regs.h8
-rw-r--r--include/linux/platform_device.h7
-rw-r--r--include/linux/rcupdate.h14
-rw-r--r--include/linux/reiserfs_fs_sb.h4
-rw-r--r--include/linux/sched.h99
-rw-r--r--include/linux/scx200_gpio.h8
-rw-r--r--include/linux/skbuff.h6
-rw-r--r--include/linux/stallion.h2
-rw-r--r--include/linux/sunrpc/cache.h10
-rw-r--r--include/linux/sunrpc/clnt.h2
-rw-r--r--include/linux/sunrpc/debug.h5
-rw-r--r--include/linux/sunrpc/msg_prot.h13
-rw-r--r--include/linux/sunrpc/rpc_rdma.h116
-rw-r--r--include/linux/sunrpc/xdr.h5
-rw-r--r--include/linux/sunrpc/xprt.h42
-rw-r--r--include/linux/sunrpc/xprtrdma.h85
-rw-r--r--include/linux/sunrpc/xprtsock.h51
-rw-r--r--include/linux/sysfs.h147
-rw-r--r--include/linux/tcp.h2
-rw-r--r--include/linux/topology.h5
-rw-r--r--include/linux/tty.h1
-rw-r--r--include/linux/usb.h79
-rw-r--r--include/linux/usb/gadget.h (renamed from include/linux/usb_gadget.h)97
-rw-r--r--include/linux/usb/quirks.h7
-rw-r--r--include/linux/usb/serial.h20
-rw-r--r--include/linux/usb_sl811.h26
-rw-r--r--include/linux/video_output.h4
-rw-r--r--include/linux/writeback.h2
-rw-r--r--include/media/videobuf-core.h2
-rw-r--r--include/net/inet_frag.h60
-rw-r--r--include/net/ip.h13
-rw-r--r--include/net/ip_vs.h13
-rw-r--r--include/net/ipv6.h21
-rw-r--r--include/net/netfilter/ipv6/nf_conntrack_ipv6.h5
-rw-r--r--include/net/netfilter/nf_conntrack_core.h10
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h2
-rw-r--r--include/net/netfilter/nf_nat_core.h4
-rw-r--r--include/net/netfilter/nf_nat_helper.h6
-rw-r--r--include/net/netfilter/nf_nat_protocol.h2
-rw-r--r--include/net/netfilter/nf_nat_rule.h2
-rw-r--r--include/net/protocol.h2
-rw-r--r--include/net/xfrm.h2
-rw-r--r--include/scsi/libsrp.h2
-rw-r--r--include/scsi/scsi_cmnd.h13
-rw-r--r--include/scsi/scsi_dbg.h2
-rw-r--r--include/scsi/scsi_driver.h10
-rw-r--r--include/scsi/scsi_eh.h23
-rw-r--r--include/scsi/scsi_host.h14
-rw-r--r--include/scsi/scsi_tgt.h8
-rw-r--r--include/scsi/scsi_tgt_if.h35
-rw-r--r--include/scsi/scsi_transport.h12
-rw-r--r--include/scsi/scsi_transport_fc.h6
-rw-r--r--include/scsi/scsi_transport_iscsi.h2
-rw-r--r--include/scsi/scsi_transport_srp.h39
-rw-r--r--include/scsi/sd.h14
217 files changed, 3613 insertions, 1764 deletions
diff --git a/include/asm-arm/arch-davinci/i2c.h b/include/asm-arm/arch-davinci/i2c.h
new file mode 100644
index 000000000000..e2f54168abd1
--- /dev/null
+++ b/include/asm-arm/arch-davinci/i2c.h
@@ -0,0 +1,21 @@
1/*
2 * DaVinci I2C controller platfrom_device info
3 *
4 * Author: Vladimir Barinov, MontaVista Software, Inc. <source@mvista.com>
5 *
6 * 2007 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10*/
11
12#ifndef __ASM_ARCH_I2C_H
13#define __ASM_ARCH_I2C_H
14
15/* All frequencies are expressed in kHz */
16struct davinci_i2c_platform_data {
17 unsigned int bus_freq; /* standard bus frequency */
18 unsigned int bus_delay; /* transaction delay */
19};
20
21#endif /* __ASM_ARCH_I2C_H */
diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h
index 1d3caa42a386..eebe56e74d6d 100644
--- a/include/asm-arm/io.h
+++ b/include/asm-arm/io.h
@@ -228,12 +228,12 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
228 */ 228 */
229#ifndef ioread8 229#ifndef ioread8
230#define ioread8(p) ({ unsigned int __v = __raw_readb(p); __v; }) 230#define ioread8(p) ({ unsigned int __v = __raw_readb(p); __v; })
231#define ioread16(p) ({ unsigned int __v = le16_to_cpu(__raw_readw(p)); __v; }) 231#define ioread16(p) ({ unsigned int __v = le16_to_cpu((__force __le16)__raw_readw(p)); __v; })
232#define ioread32(p) ({ unsigned int __v = le32_to_cpu(__raw_readl(p)); __v; }) 232#define ioread32(p) ({ unsigned int __v = le32_to_cpu((__force __le32)__raw_readl(p)); __v; })
233 233
234#define iowrite8(v,p) __raw_writeb(v, p) 234#define iowrite8(v,p) __raw_writeb(v, p)
235#define iowrite16(v,p) __raw_writew(cpu_to_le16(v), p) 235#define iowrite16(v,p) __raw_writew((__force __u16)cpu_to_le16(v), p)
236#define iowrite32(v,p) __raw_writel(cpu_to_le32(v), p) 236#define iowrite32(v,p) __raw_writel((__force __u32)cpu_to_le32(v), p)
237 237
238#define ioread8_rep(p,d,c) __raw_readsb(p,d,c) 238#define ioread8_rep(p,d,c) __raw_readsb(p,d,c)
239#define ioread16_rep(p,d,c) __raw_readsw(p,d,c) 239#define ioread16_rep(p,d,c) __raw_readsw(p,d,c)
diff --git a/include/asm-blackfin/mach-bf548/bf54x_keys.h b/include/asm-blackfin/mach-bf548/bf54x_keys.h
new file mode 100644
index 000000000000..1fb4ec77cc25
--- /dev/null
+++ b/include/asm-blackfin/mach-bf548/bf54x_keys.h
@@ -0,0 +1,17 @@
1#ifndef _BFIN_KPAD_H
2#define _BFIN_KPAD_H
3
4struct bfin_kpad_platform_data {
5 int rows;
6 int cols;
7 const unsigned int *keymap;
8 unsigned short keymapsize;
9 unsigned short repeat;
10 u32 debounce_time; /* in ns */
11 u32 coldrive_time; /* in ns */
12 u32 keyup_test_interval; /* in ms */
13};
14
15#define KEYVAL(col, row, val) (((1 << col) << 24) | ((1 << row) << 16) | (val))
16
17#endif
diff --git a/include/asm-blackfin/mach-bf548/dma.h b/include/asm-blackfin/mach-bf548/dma.h
index fcc8b4c34c6a..14cb10cc24ae 100644
--- a/include/asm-blackfin/mach-bf548/dma.h
+++ b/include/asm-blackfin/mach-bf548/dma.h
@@ -55,6 +55,7 @@
55#define CH_SPORT3_RX 20 55#define CH_SPORT3_RX 20
56#define CH_SPORT3_TX 21 56#define CH_SPORT3_TX 21
57#define CH_SDH 22 57#define CH_SDH 22
58#define CH_NFC 22
58#define CH_SPI2 23 59#define CH_SPI2 23
59 60
60#define CH_MEM_STREAM0_DEST 24 61#define CH_MEM_STREAM0_DEST 24
diff --git a/include/asm-blackfin/nand.h b/include/asm-blackfin/nand.h
new file mode 100644
index 000000000000..afbaafa793f1
--- /dev/null
+++ b/include/asm-blackfin/nand.h
@@ -0,0 +1,47 @@
1/* linux/include/asm-blackfin/nand.h
2 *
3 * Copyright (c) 2007 Analog Devices, Inc.
4 * Bryan Wu <bryan.wu@analog.com>
5 *
6 * BF5XX - NAND flash controller platfrom_device info
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13/* struct bf5xx_nand_platform
14 *
15 * define a interface between platfrom board specific code and
16 * bf54x NFC driver.
17 *
18 * nr_partitions = number of partitions pointed to be partitoons (or zero)
19 * partitions = mtd partition list
20 */
21
22#define NFC_PG_SIZE_256 0
23#define NFC_PG_SIZE_512 1
24#define NFC_PG_SIZE_OFFSET 9
25
26#define NFC_NWIDTH_8 0
27#define NFC_NWIDTH_16 1
28#define NFC_NWIDTH_OFFSET 8
29
30#define NFC_RDDLY_OFFSET 4
31#define NFC_WRDLY_OFFSET 0
32
33#define NFC_STAT_NBUSY 1
34
35struct bf5xx_nand_platform {
36 /* NAND chip information */
37 unsigned short page_size;
38 unsigned short data_width;
39
40 /* RD/WR strobe delay timing information, all times in SCLK cycles */
41 unsigned short rd_dly;
42 unsigned short wr_dly;
43
44 /* NAND MTD partition information */
45 int nr_partitions;
46 struct mtd_partition *partitions;
47};
diff --git a/include/asm-frv/system.h b/include/asm-frv/system.h
index 6931af525da3..9f5663ba19f8 100644
--- a/include/asm-frv/system.h
+++ b/include/asm-frv/system.h
@@ -253,7 +253,10 @@ extern uint32_t __cmpxchg_32(uint32_t *v, uint32_t test, uint32_t new);
253 __typeof__(*(ptr)) __xg_new = (new); \ 253 __typeof__(*(ptr)) __xg_new = (new); \
254 \ 254 \
255 switch (sizeof(__xg_orig)) { \ 255 switch (sizeof(__xg_orig)) { \
256 case 4: __xg_orig = __cmpxchg_32(__xg_ptr, __xg_test, __xg_new); break; \ 256 case 4: __xg_orig = (__force __typeof__(*ptr)) \
257 __cmpxchg_32((__force uint32_t *)__xg_ptr, \
258 (__force uint32_t)__xg_test, \
259 (__force uint32_t)__xg_new); break; \
257 default: \ 260 default: \
258 __xg_orig = 0; \ 261 __xg_orig = 0; \
259 asm volatile("break"); \ 262 asm volatile("break"); \
diff --git a/include/asm-generic/libata-portmap.h b/include/asm-generic/libata-portmap.h
index 62fb3618293d..cf14f2ff40b6 100644
--- a/include/asm-generic/libata-portmap.h
+++ b/include/asm-generic/libata-portmap.h
@@ -1,12 +1,7 @@
1#ifndef __ASM_GENERIC_LIBATA_PORTMAP_H 1#ifndef __ASM_GENERIC_LIBATA_PORTMAP_H
2#define __ASM_GENERIC_LIBATA_PORTMAP_H 2#define __ASM_GENERIC_LIBATA_PORTMAP_H
3 3
4#define ATA_PRIMARY_CMD 0x1F0
5#define ATA_PRIMARY_CTL 0x3F6
6#define ATA_PRIMARY_IRQ(dev) 14 4#define ATA_PRIMARY_IRQ(dev) 14
7
8#define ATA_SECONDARY_CMD 0x170
9#define ATA_SECONDARY_CTL 0x376
10#define ATA_SECONDARY_IRQ(dev) 15 5#define ATA_SECONDARY_IRQ(dev) 15
11 6
12#endif 7#endif
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 0240e0506a07..5615440027ec 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -153,7 +153,8 @@
153#define TEXT_TEXT \ 153#define TEXT_TEXT \
154 ALIGN_FUNCTION(); \ 154 ALIGN_FUNCTION(); \
155 *(.text) \ 155 *(.text) \
156 *(.text.init.refok) 156 *(.text.init.refok) \
157 *(.exit.text.refok)
157 158
158/* sched.text is aling to function alignment to secure we have same 159/* sched.text is aling to function alignment to secure we have same
159 * address even at second ld pass when generating System.map */ 160 * address even at second ld pass when generating System.map */
diff --git a/include/asm-ia64/dma-mapping.h b/include/asm-ia64/dma-mapping.h
index 6299b51575bb..3ca6d5c14b2e 100644
--- a/include/asm-ia64/dma-mapping.h
+++ b/include/asm-ia64/dma-mapping.h
@@ -6,6 +6,7 @@
6 * David Mosberger-Tang <davidm@hpl.hp.com> 6 * David Mosberger-Tang <davidm@hpl.hp.com>
7 */ 7 */
8#include <asm/machvec.h> 8#include <asm/machvec.h>
9#include <asm/scatterlist.h>
9 10
10#define dma_alloc_coherent platform_dma_alloc_coherent 11#define dma_alloc_coherent platform_dma_alloc_coherent
11/* coherent mem. is cheap */ 12/* coherent mem. is cheap */
diff --git a/include/asm-ia64/mca.h b/include/asm-ia64/mca.h
index edd5d01028df..823553bf12e6 100644
--- a/include/asm-ia64/mca.h
+++ b/include/asm-ia64/mca.h
@@ -151,6 +151,8 @@ extern void ia64_mca_cmc_vector_setup(void);
151extern int ia64_reg_MCA_extension(int (*fn)(void *, struct ia64_sal_os_state *)); 151extern int ia64_reg_MCA_extension(int (*fn)(void *, struct ia64_sal_os_state *));
152extern void ia64_unreg_MCA_extension(void); 152extern void ia64_unreg_MCA_extension(void);
153extern u64 ia64_get_rnat(u64 *); 153extern u64 ia64_get_rnat(u64 *);
154extern void ia64_mca_printk(const char * fmt, ...)
155 __attribute__ ((format (printf, 1, 2)));
154 156
155struct ia64_mca_notify_die { 157struct ia64_mca_notify_die {
156 struct ia64_sal_os_state *sos; 158 struct ia64_sal_os_state *sos;
diff --git a/include/asm-ia64/sal.h b/include/asm-ia64/sal.h
index 46cadf5aaac5..1f5412d6f9bb 100644
--- a/include/asm-ia64/sal.h
+++ b/include/asm-ia64/sal.h
@@ -46,25 +46,28 @@
46extern spinlock_t sal_lock; 46extern spinlock_t sal_lock;
47 47
48/* SAL spec _requires_ eight args for each call. */ 48/* SAL spec _requires_ eight args for each call. */
49#define __SAL_CALL(result,a0,a1,a2,a3,a4,a5,a6,a7) \ 49#define __IA64_FW_CALL(entry,result,a0,a1,a2,a3,a4,a5,a6,a7) \
50 result = (*ia64_sal)(a0,a1,a2,a3,a4,a5,a6,a7) 50 result = (*entry)(a0,a1,a2,a3,a4,a5,a6,a7)
51 51
52# define SAL_CALL(result,args...) do { \ 52# define IA64_FW_CALL(entry,result,args...) do { \
53 unsigned long __ia64_sc_flags; \ 53 unsigned long __ia64_sc_flags; \
54 struct ia64_fpreg __ia64_sc_fr[6]; \ 54 struct ia64_fpreg __ia64_sc_fr[6]; \
55 ia64_save_scratch_fpregs(__ia64_sc_fr); \ 55 ia64_save_scratch_fpregs(__ia64_sc_fr); \
56 spin_lock_irqsave(&sal_lock, __ia64_sc_flags); \ 56 spin_lock_irqsave(&sal_lock, __ia64_sc_flags); \
57 __SAL_CALL(result, args); \ 57 __IA64_FW_CALL(entry, result, args); \
58 spin_unlock_irqrestore(&sal_lock, __ia64_sc_flags); \ 58 spin_unlock_irqrestore(&sal_lock, __ia64_sc_flags); \
59 ia64_load_scratch_fpregs(__ia64_sc_fr); \ 59 ia64_load_scratch_fpregs(__ia64_sc_fr); \
60} while (0) 60} while (0)
61 61
62# define SAL_CALL(result,args...) \
63 IA64_FW_CALL(ia64_sal, result, args);
64
62# define SAL_CALL_NOLOCK(result,args...) do { \ 65# define SAL_CALL_NOLOCK(result,args...) do { \
63 unsigned long __ia64_scn_flags; \ 66 unsigned long __ia64_scn_flags; \
64 struct ia64_fpreg __ia64_scn_fr[6]; \ 67 struct ia64_fpreg __ia64_scn_fr[6]; \
65 ia64_save_scratch_fpregs(__ia64_scn_fr); \ 68 ia64_save_scratch_fpregs(__ia64_scn_fr); \
66 local_irq_save(__ia64_scn_flags); \ 69 local_irq_save(__ia64_scn_flags); \
67 __SAL_CALL(result, args); \ 70 __IA64_FW_CALL(ia64_sal, result, args); \
68 local_irq_restore(__ia64_scn_flags); \ 71 local_irq_restore(__ia64_scn_flags); \
69 ia64_load_scratch_fpregs(__ia64_scn_fr); \ 72 ia64_load_scratch_fpregs(__ia64_scn_fr); \
70} while (0) 73} while (0)
@@ -73,7 +76,7 @@ extern spinlock_t sal_lock;
73 struct ia64_fpreg __ia64_scs_fr[6]; \ 76 struct ia64_fpreg __ia64_scs_fr[6]; \
74 ia64_save_scratch_fpregs(__ia64_scs_fr); \ 77 ia64_save_scratch_fpregs(__ia64_scs_fr); \
75 preempt_disable(); \ 78 preempt_disable(); \
76 __SAL_CALL(result, args); \ 79 __IA64_FW_CALL(ia64_sal, result, args); \
77 preempt_enable(); \ 80 preempt_enable(); \
78 ia64_load_scratch_fpregs(__ia64_scs_fr); \ 81 ia64_load_scratch_fpregs(__ia64_scs_fr); \
79} while (0) 82} while (0)
diff --git a/include/asm-m68k/Kbuild b/include/asm-m68k/Kbuild
index c68e1680da01..1a922fad76f7 100644
--- a/include/asm-m68k/Kbuild
+++ b/include/asm-m68k/Kbuild
@@ -1 +1,2 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2header-y += cachectl.h
diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h
index a30fe9c64143..87f77b119317 100644
--- a/include/asm-m68k/unistd.h
+++ b/include/asm-m68k/unistd.h
@@ -351,6 +351,9 @@
351#define __ARCH_WANT_SYS_SIGPROCMASK 351#define __ARCH_WANT_SYS_SIGPROCMASK
352#define __ARCH_WANT_SYS_RT_SIGACTION 352#define __ARCH_WANT_SYS_RT_SIGACTION
353 353
354/* whitelist for checksyscalls */
355#define __IGNORE_restart_syscall
356
354/* 357/*
355 * "Conditional" syscalls 358 * "Conditional" syscalls
356 * 359 *
diff --git a/include/asm-mips/fw/cfe/cfe_api.h b/include/asm-mips/fw/cfe/cfe_api.h
index 41cf050b6810..1003e7156bfc 100644
--- a/include/asm-mips/fw/cfe/cfe_api.h
+++ b/include/asm-mips/fw/cfe/cfe_api.h
@@ -154,7 +154,7 @@ int64_t cfe_getticks(void);
154#define cfe_readblk(a, b, c, d) __cfe_readblk(a, b, c, d) 154#define cfe_readblk(a, b, c, d) __cfe_readblk(a, b, c, d)
155#define cfe_setenv(a, b) __cfe_setenv(a, b) 155#define cfe_setenv(a, b) __cfe_setenv(a, b)
156#define cfe_write(a, b, c) __cfe_write(a, b, c) 156#define cfe_write(a, b, c) __cfe_write(a, b, c)
157#define cfe_writeblk(a, b, c, d __cfe_writeblk(a, b, c, d) 157#define cfe_writeblk(a, b, c, d) __cfe_writeblk(a, b, c, d)
158#endif /* CFE_API_IMPL_NAMESPACE */ 158#endif /* CFE_API_IMPL_NAMESPACE */
159 159
160int cfe_close(int handle); 160int cfe_close(int handle);
diff --git a/include/asm-mips/mach-au1x00/prom.h b/include/asm-mips/mach-au1x00/prom.h
new file mode 100644
index 000000000000..e38715577c51
--- /dev/null
+++ b/include/asm-mips/mach-au1x00/prom.h
@@ -0,0 +1,13 @@
1#ifndef __AU1X00_PROM_H
2#define __AU1X00_PROM_H
3
4extern int prom_argc;
5extern char **prom_argv;
6extern char **prom_envp;
7
8extern void prom_init_cmdline(void);
9extern char *prom_getcmdline(void);
10extern char *prom_getenv(char *envname);
11extern int prom_get_ethernet_addr(char *ethernet_addr);
12
13#endif
diff --git a/include/asm-powerpc/dcr-mmio.h b/include/asm-powerpc/dcr-mmio.h
index 6b82c3ba495a..08532ff1899c 100644
--- a/include/asm-powerpc/dcr-mmio.h
+++ b/include/asm-powerpc/dcr-mmio.h
@@ -33,16 +33,16 @@ typedef struct {
33 33
34extern dcr_host_t dcr_map(struct device_node *dev, unsigned int dcr_n, 34extern dcr_host_t dcr_map(struct device_node *dev, unsigned int dcr_n,
35 unsigned int dcr_c); 35 unsigned int dcr_c);
36extern void dcr_unmap(dcr_host_t host, unsigned int dcr_n, unsigned int dcr_c); 36extern void dcr_unmap(dcr_host_t host, unsigned int dcr_c);
37 37
38static inline u32 dcr_read(dcr_host_t host, unsigned int dcr_n) 38static inline u32 dcr_read(dcr_host_t host, unsigned int dcr_n)
39{ 39{
40 return in_be32(host.token + dcr_n * host.stride); 40 return in_be32(host.token + ((host.base + dcr_n) * host.stride));
41} 41}
42 42
43static inline void dcr_write(dcr_host_t host, unsigned int dcr_n, u32 value) 43static inline void dcr_write(dcr_host_t host, unsigned int dcr_n, u32 value)
44{ 44{
45 out_be32(host.token + dcr_n * host.stride, value); 45 out_be32(host.token + ((host.base + dcr_n) * host.stride), value);
46} 46}
47 47
48extern u64 of_translate_dcr_address(struct device_node *dev, 48extern u64 of_translate_dcr_address(struct device_node *dev,
diff --git a/include/asm-powerpc/dcr-native.h b/include/asm-powerpc/dcr-native.h
index f41058c0f6cb..8dbb1ab0aa04 100644
--- a/include/asm-powerpc/dcr-native.h
+++ b/include/asm-powerpc/dcr-native.h
@@ -29,9 +29,9 @@ typedef struct {
29#define DCR_MAP_OK(host) (1) 29#define DCR_MAP_OK(host) (1)
30 30
31#define dcr_map(dev, dcr_n, dcr_c) ((dcr_host_t){ .base = (dcr_n) }) 31#define dcr_map(dev, dcr_n, dcr_c) ((dcr_host_t){ .base = (dcr_n) })
32#define dcr_unmap(host, dcr_n, dcr_c) do {} while (0) 32#define dcr_unmap(host, dcr_c) do {} while (0)
33#define dcr_read(host, dcr_n) mfdcr(dcr_n) 33#define dcr_read(host, dcr_n) mfdcr(dcr_n + host.base)
34#define dcr_write(host, dcr_n, value) mtdcr(dcr_n, value) 34#define dcr_write(host, dcr_n, value) mtdcr(dcr_n + host.base, value)
35 35
36/* Device Control Registers */ 36/* Device Control Registers */
37void __mtdcr(int reg, unsigned int val); 37void __mtdcr(int reg, unsigned int val);
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h
index affba7052fb6..0d0589ef8ea6 100644
--- a/include/asm-powerpc/io.h
+++ b/include/asm-powerpc/io.h
@@ -138,12 +138,12 @@ DEF_MMIO_IN_BE(in_be64, 64, ld);
138/* There is no asm instructions for 64 bits reverse loads and stores */ 138/* There is no asm instructions for 64 bits reverse loads and stores */
139static inline u64 in_le64(const volatile u64 __iomem *addr) 139static inline u64 in_le64(const volatile u64 __iomem *addr)
140{ 140{
141 return le64_to_cpu(in_be64(addr)); 141 return swab64(in_be64(addr));
142} 142}
143 143
144static inline void out_le64(volatile u64 __iomem *addr, u64 val) 144static inline void out_le64(volatile u64 __iomem *addr, u64 val)
145{ 145{
146 out_be64(addr, cpu_to_le64(val)); 146 out_be64(addr, swab64(val));
147} 147}
148#endif /* __powerpc64__ */ 148#endif /* __powerpc64__ */
149 149
diff --git a/include/asm-powerpc/of_device.h b/include/asm-powerpc/of_device.h
index ec2a8a2c737c..93262f2546ad 100644
--- a/include/asm-powerpc/of_device.h
+++ b/include/asm-powerpc/of_device.h
@@ -20,7 +20,7 @@ struct of_device
20extern ssize_t of_device_get_modalias(struct of_device *ofdev, 20extern ssize_t of_device_get_modalias(struct of_device *ofdev,
21 char *str, ssize_t len); 21 char *str, ssize_t len);
22extern int of_device_uevent(struct device *dev, 22extern int of_device_uevent(struct device *dev,
23 char **envp, int num_envp, char *buffer, int buffer_size); 23 struct kobj_uevent_env *env);
24 24
25/* This is just here during the transition */ 25/* This is just here during the transition */
26#include <linux/of_device.h> 26#include <linux/of_device.h>
diff --git a/include/asm-s390/cache.h b/include/asm-s390/cache.h
index cdf431b061bb..9b866816863c 100644
--- a/include/asm-s390/cache.h
+++ b/include/asm-s390/cache.h
@@ -14,8 +14,6 @@
14#define L1_CACHE_BYTES 256 14#define L1_CACHE_BYTES 256
15#define L1_CACHE_SHIFT 8 15#define L1_CACHE_SHIFT 8
16 16
17#define ARCH_KMALLOC_MINALIGN 8
18
19#define __read_mostly __attribute__((__section__(".data.read_mostly"))) 17#define __read_mostly __attribute__((__section__(".data.read_mostly")))
20 18
21#endif 19#endif
diff --git a/include/asm-s390/ccwdev.h b/include/asm-s390/ccwdev.h
index 1aeda27d5a8b..066aa70518ce 100644
--- a/include/asm-s390/ccwdev.h
+++ b/include/asm-s390/ccwdev.h
@@ -67,36 +67,55 @@ ccw_device_id_match(const struct ccw_device_id *array,
67 return NULL; 67 return NULL;
68} 68}
69 69
70/* The struct ccw device is our replacement for the globally accessible 70/**
71 * ioinfo array. ioinfo will mutate into a subchannel device later. 71 * struct ccw_device - channel attached device
72 * @ccwlock: pointer to device lock
73 * @id: id of this device
74 * @drv: ccw driver for this device
75 * @dev: embedded device structure
76 * @online: online status of device
77 * @handler: interrupt handler
72 * 78 *
73 * Reference: Documentation/s390/driver-model.txt */ 79 * @handler is a member of the device rather than the driver since a driver
80 * can have different interrupt handlers for different ccw devices
81 * (multi-subchannel drivers).
82 */
74struct ccw_device { 83struct ccw_device {
75 spinlock_t *ccwlock; 84 spinlock_t *ccwlock;
85/* private: */
76 struct ccw_device_private *private; /* cio private information */ 86 struct ccw_device_private *private; /* cio private information */
77 struct ccw_device_id id; /* id of this device, driver_info is 87/* public: */
78 set by ccw_find_driver */ 88 struct ccw_device_id id;
79 struct ccw_driver *drv; /* */ 89 struct ccw_driver *drv;
80 struct device dev; /* */ 90 struct device dev;
81 int online; 91 int online;
82 /* This is sick, but a driver can have different interrupt handlers
83 for different ccw_devices (multi-subchannel drivers)... */
84 void (*handler) (struct ccw_device *, unsigned long, struct irb *); 92 void (*handler) (struct ccw_device *, unsigned long, struct irb *);
85}; 93};
86 94
87 95
88/* Each ccw driver registers with the ccw root bus */ 96/**
97 * struct ccw driver - device driver for channel attached devices
98 * @owner: owning module
99 * @ids: ids supported by this driver
100 * @probe: function called on probe
101 * @remove: function called on remove
102 * @set_online: called when setting device online
103 * @set_offline: called when setting device offline
104 * @notify: notify driver of device state changes
105 * @shutdown: called at device shutdown
106 * @driver: embedded device driver structure
107 * @name: device driver name
108 */
89struct ccw_driver { 109struct ccw_driver {
90 struct module *owner; /* for automatic MOD_INC_USE_COUNT */ 110 struct module *owner;
91 struct ccw_device_id *ids; /* probe driver with these devs */ 111 struct ccw_device_id *ids;
92 int (*probe) (struct ccw_device *); /* ask driver to probe dev */ 112 int (*probe) (struct ccw_device *);
93 void (*remove) (struct ccw_device *); 113 void (*remove) (struct ccw_device *);
94 /* device is no longer available */
95 int (*set_online) (struct ccw_device *); 114 int (*set_online) (struct ccw_device *);
96 int (*set_offline) (struct ccw_device *); 115 int (*set_offline) (struct ccw_device *);
97 int (*notify) (struct ccw_device *, int); 116 int (*notify) (struct ccw_device *, int);
98 struct device_driver driver; /* higher level structure, don't init 117 void (*shutdown) (struct ccw_device *);
99 this from your driver */ 118 struct device_driver driver;
100 char *name; 119 char *name;
101}; 120};
102 121
@@ -124,36 +143,10 @@ extern void ccw_device_clear_options(struct ccw_device *, unsigned long);
124/* Allow forced onlining of boxed devices. */ 143/* Allow forced onlining of boxed devices. */
125#define CCWDEV_ALLOW_FORCE 0x0008 144#define CCWDEV_ALLOW_FORCE 0x0008
126 145
127/*
128 * ccw_device_start()
129 *
130 * Start a S/390 channel program. When the interrupt arrives, the
131 * IRQ handler is called, either immediately, delayed (dev-end missing,
132 * or sense required) or never (no IRQ handler registered).
133 * Depending on the action taken, ccw_device_start() returns:
134 * 0 - Success
135 * -EBUSY - Device busy, or status pending
136 * -ENODEV - Device not operational
137 * -EINVAL - Device invalid for operation
138 */
139extern int ccw_device_start(struct ccw_device *, struct ccw1 *, 146extern int ccw_device_start(struct ccw_device *, struct ccw1 *,
140 unsigned long, __u8, unsigned long); 147 unsigned long, __u8, unsigned long);
141/*
142 * ccw_device_start_timeout()
143 *
144 * This function notifies the device driver if the channel program has not
145 * completed during the specified time. If a timeout occurs, the channel
146 * program is terminated via xsch(), hsch() or csch().
147 */
148extern int ccw_device_start_timeout(struct ccw_device *, struct ccw1 *, 148extern int ccw_device_start_timeout(struct ccw_device *, struct ccw1 *,
149 unsigned long, __u8, unsigned long, int); 149 unsigned long, __u8, unsigned long, int);
150/*
151 * ccw_device_start_key()
152 * ccw_device_start_key_timeout()
153 *
154 * Same as ccw_device_start() and ccw_device_start_timeout(), except a
155 * storage key != default key can be provided for the I/O.
156 */
157extern int ccw_device_start_key(struct ccw_device *, struct ccw1 *, 150extern int ccw_device_start_key(struct ccw_device *, struct ccw1 *,
158 unsigned long, __u8, __u8, unsigned long); 151 unsigned long, __u8, __u8, unsigned long);
159extern int ccw_device_start_timeout_key(struct ccw_device *, struct ccw1 *, 152extern int ccw_device_start_timeout_key(struct ccw_device *, struct ccw1 *,
diff --git a/include/asm-s390/ccwgroup.h b/include/asm-s390/ccwgroup.h
index 925b3ddfa141..7109c7cab87e 100644
--- a/include/asm-s390/ccwgroup.h
+++ b/include/asm-s390/ccwgroup.h
@@ -4,19 +4,41 @@
4struct ccw_device; 4struct ccw_device;
5struct ccw_driver; 5struct ccw_driver;
6 6
7/**
8 * struct ccwgroup_device - ccw group device
9 * @creator_id: unique number of the driver
10 * @state: online/offline state
11 * @count: number of attached slave devices
12 * @dev: embedded device structure
13 * @cdev: variable number of slave devices, allocated as needed
14 */
7struct ccwgroup_device { 15struct ccwgroup_device {
8 unsigned long creator_id; /* unique number of the driver */ 16 unsigned long creator_id;
9 enum { 17 enum {
10 CCWGROUP_OFFLINE, 18 CCWGROUP_OFFLINE,
11 CCWGROUP_ONLINE, 19 CCWGROUP_ONLINE,
12 } state; 20 } state;
21/* private: */
13 atomic_t onoff; 22 atomic_t onoff;
14 struct mutex reg_mutex; 23 struct mutex reg_mutex;
15 unsigned int count; /* number of attached slave devices */ 24/* public: */
16 struct device dev; /* master device */ 25 unsigned int count;
17 struct ccw_device *cdev[0]; /* variable number, allocate as needed */ 26 struct device dev;
27 struct ccw_device *cdev[0];
18}; 28};
19 29
30/**
31 * struct ccwgroup_driver - driver for ccw group devices
32 * @owner: driver owner
33 * @name: driver name
34 * @max_slaves: maximum number of slave devices
35 * @driver_id: unique id
36 * @probe: function called on probe
37 * @remove: function called on remove
38 * @set_online: function called when device is set online
39 * @set_offline: function called when device is set offline
40 * @driver: embedded driver structure
41 */
20struct ccwgroup_driver { 42struct ccwgroup_driver {
21 struct module *owner; 43 struct module *owner;
22 char *name; 44 char *name;
@@ -28,7 +50,7 @@ struct ccwgroup_driver {
28 int (*set_online) (struct ccwgroup_device *); 50 int (*set_online) (struct ccwgroup_device *);
29 int (*set_offline) (struct ccwgroup_device *); 51 int (*set_offline) (struct ccwgroup_device *);
30 52
31 struct device_driver driver; /* this driver */ 53 struct device_driver driver;
32}; 54};
33 55
34extern int ccwgroup_driver_register (struct ccwgroup_driver *cdriver); 56extern int ccwgroup_driver_register (struct ccwgroup_driver *cdriver);
diff --git a/include/asm-s390/cio.h b/include/asm-s390/cio.h
index 1982fb344164..2f08c16e44ad 100644
--- a/include/asm-s390/cio.h
+++ b/include/asm-s390/cio.h
@@ -15,30 +15,50 @@
15#define LPM_ANYPATH 0xff 15#define LPM_ANYPATH 0xff
16#define __MAX_CSSID 0 16#define __MAX_CSSID 0
17 17
18/* 18/**
19 * subchannel status word 19 * struct scsw - subchannel status word
20 * @key: subchannel key
21 * @sctl: suspend control
22 * @eswf: esw format
23 * @cc: deferred condition code
24 * @fmt: format
25 * @pfch: prefetch
26 * @isic: initial-status interruption control
27 * @alcc: adress-limit checking control
28 * @ssi: supress-suspended interruption
29 * @zcc: zero condition code
30 * @ectl: extended control
31 * @pno: path not operational
32 * @res: reserved
33 * @fctl: function control
34 * @actl: activity control
35 * @stctl: status control
36 * @cpa: channel program address
37 * @dstat: device status
38 * @cstat: subchannel status
39 * @count: residual count
20 */ 40 */
21struct scsw { 41struct scsw {
22 __u32 key : 4; /* subchannel key */ 42 __u32 key : 4;
23 __u32 sctl : 1; /* suspend control */ 43 __u32 sctl : 1;
24 __u32 eswf : 1; /* ESW format */ 44 __u32 eswf : 1;
25 __u32 cc : 2; /* deferred condition code */ 45 __u32 cc : 2;
26 __u32 fmt : 1; /* format */ 46 __u32 fmt : 1;
27 __u32 pfch : 1; /* prefetch */ 47 __u32 pfch : 1;
28 __u32 isic : 1; /* initial-status interruption control */ 48 __u32 isic : 1;
29 __u32 alcc : 1; /* address-limit checking control */ 49 __u32 alcc : 1;
30 __u32 ssi : 1; /* supress-suspended interruption */ 50 __u32 ssi : 1;
31 __u32 zcc : 1; /* zero condition code */ 51 __u32 zcc : 1;
32 __u32 ectl : 1; /* extended control */ 52 __u32 ectl : 1;
33 __u32 pno : 1; /* path not operational */ 53 __u32 pno : 1;
34 __u32 res : 1; /* reserved */ 54 __u32 res : 1;
35 __u32 fctl : 3; /* function control */ 55 __u32 fctl : 3;
36 __u32 actl : 7; /* activity control */ 56 __u32 actl : 7;
37 __u32 stctl : 5; /* status control */ 57 __u32 stctl : 5;
38 __u32 cpa; /* channel program address */ 58 __u32 cpa;
39 __u32 dstat : 8; /* device status */ 59 __u32 dstat : 8;
40 __u32 cstat : 8; /* subchannel status */ 60 __u32 cstat : 8;
41 __u32 count : 16; /* residual count */ 61 __u32 count : 16;
42} __attribute__ ((packed)); 62} __attribute__ ((packed));
43 63
44#define SCSW_FCTL_CLEAR_FUNC 0x1 64#define SCSW_FCTL_CLEAR_FUNC 0x1
@@ -110,11 +130,22 @@ struct scsw {
110#define SNS2_ENV_DATA_PRESENT 0x10 130#define SNS2_ENV_DATA_PRESENT 0x10
111#define SNS2_INPRECISE_END 0x04 131#define SNS2_INPRECISE_END 0x04
112 132
133/**
134 * struct ccw1 - channel command word
135 * @cmd_code: command code
136 * @flags: flags, like IDA adressing, etc.
137 * @count: byte count
138 * @cda: data address
139 *
140 * The ccw is the basic structure to build channel programs that perform
141 * operations with the device or the control unit. Only Format-1 channel
142 * command words are supported.
143 */
113struct ccw1 { 144struct ccw1 {
114 __u8 cmd_code; /* command code */ 145 __u8 cmd_code;
115 __u8 flags; /* flags, like IDA addressing, etc. */ 146 __u8 flags;
116 __u16 count; /* byte count */ 147 __u16 count;
117 __u32 cda; /* data address */ 148 __u32 cda;
118} __attribute__ ((packed,aligned(8))); 149} __attribute__ ((packed,aligned(8)));
119 150
120#define CCW_FLAG_DC 0x80 151#define CCW_FLAG_DC 0x80
@@ -140,102 +171,162 @@ struct ccw1 {
140 171
141#define SENSE_MAX_COUNT 0x20 172#define SENSE_MAX_COUNT 0x20
142 173
174/**
175 * struct erw - extended report word
176 * @res0: reserved
177 * @auth: authorization check
178 * @pvrf: path-verification-required flag
179 * @cpt: channel-path timeout
180 * @fsavf: failing storage address validity flag
181 * @cons: concurrent sense
182 * @scavf: secondary ccw address validity flag
183 * @fsaf: failing storage address format
184 * @scnt: sense count, if @cons == %1
185 * @res16: reserved
186 */
143struct erw { 187struct erw {
144 __u32 res0 : 3; /* reserved */ 188 __u32 res0 : 3;
145 __u32 auth : 1; /* Authorization check */ 189 __u32 auth : 1;
146 __u32 pvrf : 1; /* path-verification-required flag */ 190 __u32 pvrf : 1;
147 __u32 cpt : 1; /* channel-path timeout */ 191 __u32 cpt : 1;
148 __u32 fsavf : 1; /* Failing storage address validity flag */ 192 __u32 fsavf : 1;
149 __u32 cons : 1; /* concurrent-sense */ 193 __u32 cons : 1;
150 __u32 scavf : 1; /* Secondary ccw address validity flag */ 194 __u32 scavf : 1;
151 __u32 fsaf : 1; /* Failing storage address format */ 195 __u32 fsaf : 1;
152 __u32 scnt : 6; /* sense count if cons == 1 */ 196 __u32 scnt : 6;
153 __u32 res16 : 16; /* reserved */ 197 __u32 res16 : 16;
154} __attribute__ ((packed)); 198} __attribute__ ((packed));
155 199
156/* 200/**
157 * subchannel logout area 201 * struct sublog - subchannel logout area
202 * @res0: reserved
203 * @esf: extended status flags
204 * @lpum: last path used mask
205 * @arep: ancillary report
206 * @fvf: field-validity flags
207 * @sacc: storage access code
208 * @termc: termination code
209 * @devsc: device-status check
210 * @serr: secondary error
211 * @ioerr: i/o-error alert
212 * @seqc: sequence code
158 */ 213 */
159struct sublog { 214struct sublog {
160 __u32 res0 : 1; /* reserved */ 215 __u32 res0 : 1;
161 __u32 esf : 7; /* extended status flags */ 216 __u32 esf : 7;
162 __u32 lpum : 8; /* last path used mask */ 217 __u32 lpum : 8;
163 __u32 arep : 1; /* ancillary report */ 218 __u32 arep : 1;
164 __u32 fvf : 5; /* field-validity flags */ 219 __u32 fvf : 5;
165 __u32 sacc : 2; /* storage access code */ 220 __u32 sacc : 2;
166 __u32 termc : 2; /* termination code */ 221 __u32 termc : 2;
167 __u32 devsc : 1; /* device-status check */ 222 __u32 devsc : 1;
168 __u32 serr : 1; /* secondary error */ 223 __u32 serr : 1;
169 __u32 ioerr : 1; /* i/o-error alert */ 224 __u32 ioerr : 1;
170 __u32 seqc : 3; /* sequence code */ 225 __u32 seqc : 3;
171} __attribute__ ((packed)); 226} __attribute__ ((packed));
172 227
173/* 228/**
174 * Format 0 Extended Status Word (ESW) 229 * struct esw0 - Format 0 Extended Status Word (ESW)
230 * @sublog: subchannel logout
231 * @erw: extended report word
232 * @faddr: failing storage address
233 * @saddr: secondary ccw address
175 */ 234 */
176struct esw0 { 235struct esw0 {
177 struct sublog sublog; /* subchannel logout */ 236 struct sublog sublog;
178 struct erw erw; /* extended report word */ 237 struct erw erw;
179 __u32 faddr[2]; /* failing storage address */ 238 __u32 faddr[2];
180 __u32 saddr; /* secondary ccw address */ 239 __u32 saddr;
181} __attribute__ ((packed)); 240} __attribute__ ((packed));
182 241
183/* 242/**
184 * Format 1 Extended Status Word (ESW) 243 * struct esw1 - Format 1 Extended Status Word (ESW)
244 * @zero0: reserved zeros
245 * @lpum: last path used mask
246 * @zero16: reserved zeros
247 * @erw: extended report word
248 * @zeros: three fullwords of zeros
185 */ 249 */
186struct esw1 { 250struct esw1 {
187 __u8 zero0; /* reserved zeros */ 251 __u8 zero0;
188 __u8 lpum; /* last path used mask */ 252 __u8 lpum;
189 __u16 zero16; /* reserved zeros */ 253 __u16 zero16;
190 struct erw erw; /* extended report word */ 254 struct erw erw;
191 __u32 zeros[3]; /* 2 fullwords of zeros */ 255 __u32 zeros[3];
192} __attribute__ ((packed)); 256} __attribute__ ((packed));
193 257
194/* 258/**
195 * Format 2 Extended Status Word (ESW) 259 * struct esw2 - Format 2 Extended Status Word (ESW)
260 * @zero0: reserved zeros
261 * @lpum: last path used mask
262 * @dcti: device-connect-time interval
263 * @erw: extended report word
264 * @zeros: three fullwords of zeros
196 */ 265 */
197struct esw2 { 266struct esw2 {
198 __u8 zero0; /* reserved zeros */ 267 __u8 zero0;
199 __u8 lpum; /* last path used mask */ 268 __u8 lpum;
200 __u16 dcti; /* device-connect-time interval */ 269 __u16 dcti;
201 struct erw erw; /* extended report word */ 270 struct erw erw;
202 __u32 zeros[3]; /* 2 fullwords of zeros */ 271 __u32 zeros[3];
203} __attribute__ ((packed)); 272} __attribute__ ((packed));
204 273
205/* 274/**
206 * Format 3 Extended Status Word (ESW) 275 * struct esw3 - Format 3 Extended Status Word (ESW)
276 * @zero0: reserved zeros
277 * @lpum: last path used mask
278 * @res: reserved
279 * @erw: extended report word
280 * @zeros: three fullwords of zeros
207 */ 281 */
208struct esw3 { 282struct esw3 {
209 __u8 zero0; /* reserved zeros */ 283 __u8 zero0;
210 __u8 lpum; /* last path used mask */ 284 __u8 lpum;
211 __u16 res; /* reserved */ 285 __u16 res;
212 struct erw erw; /* extended report word */ 286 struct erw erw;
213 __u32 zeros[3]; /* 2 fullwords of zeros */ 287 __u32 zeros[3];
214} __attribute__ ((packed)); 288} __attribute__ ((packed));
215 289
216/* 290/**
217 * interruption response block 291 * struct irb - interruption response block
292 * @scsw: subchannel status word
293 * @esw: extened status word, 4 formats
294 * @ecw: extended control word
295 *
296 * The irb that is handed to the device driver when an interrupt occurs. For
297 * solicited interrupts, the common I/O layer already performs checks whether
298 * a field is valid; a field not being valid is always passed as %0.
299 * If a unit check occured, @ecw may contain sense data; this is retrieved
300 * by the common I/O layer itself if the device doesn't support concurrent
301 * sense (so that the device driver never needs to perform basic sene itself).
302 * For unsolicited interrupts, the irb is passed as-is (expect for sense data,
303 * if applicable).
218 */ 304 */
219struct irb { 305struct irb {
220 struct scsw scsw; /* subchannel status word */ 306 struct scsw scsw;
221 union { /* extended status word, 4 formats */ 307 union {
222 struct esw0 esw0; 308 struct esw0 esw0;
223 struct esw1 esw1; 309 struct esw1 esw1;
224 struct esw2 esw2; 310 struct esw2 esw2;
225 struct esw3 esw3; 311 struct esw3 esw3;
226 } esw; 312 } esw;
227 __u8 ecw[32]; /* extended control word */ 313 __u8 ecw[32];
228} __attribute__ ((packed,aligned(4))); 314} __attribute__ ((packed,aligned(4)));
229 315
230/* 316/**
231 * command information word (CIW) layout 317 * struct ciw - command information word (CIW) layout
318 * @et: entry type
319 * @reserved: reserved bits
320 * @ct: command type
321 * @cmd: command code
322 * @count: command count
232 */ 323 */
233struct ciw { 324struct ciw {
234 __u32 et : 2; /* entry type */ 325 __u32 et : 2;
235 __u32 reserved : 2; /* reserved */ 326 __u32 reserved : 2;
236 __u32 ct : 4; /* command type */ 327 __u32 ct : 4;
237 __u32 cmd : 8; /* command */ 328 __u32 cmd : 8;
238 __u32 count : 16; /* coun */ 329 __u32 count : 16;
239} __attribute__ ((packed)); 330} __attribute__ ((packed));
240 331
241#define CIW_TYPE_RCD 0x0 /* read configuration data */ 332#define CIW_TYPE_RCD 0x0 /* read configuration data */
@@ -258,11 +349,32 @@ struct ciw {
258/* Sick revalidation of device. */ 349/* Sick revalidation of device. */
259#define CIO_REVALIDATE 0x0008 350#define CIO_REVALIDATE 0x0008
260 351
352/**
353 * struct ccw_dev_id - unique identifier for ccw devices
354 * @ssid: subchannel set id
355 * @devno: device number
356 *
357 * This structure is not directly based on any hardware structure. The
358 * hardware identifies a device by its device number and its subchannel,
359 * which is in turn identified by its id. In order to get a unique identifier
360 * for ccw devices across subchannel sets, @struct ccw_dev_id has been
361 * introduced.
362 */
261struct ccw_dev_id { 363struct ccw_dev_id {
262 u8 ssid; 364 u8 ssid;
263 u16 devno; 365 u16 devno;
264}; 366};
265 367
368/**
369 * ccw_device_id_is_equal() - compare two ccw_dev_ids
370 * @dev_id1: a ccw_dev_id
371 * @dev_id2: another ccw_dev_id
372 * Returns:
373 * %1 if the two structures are equal field-by-field,
374 * %0 if not.
375 * Context:
376 * any
377 */
266static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1, 378static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1,
267 struct ccw_dev_id *dev_id2) 379 struct ccw_dev_id *dev_id2)
268{ 380{
diff --git a/include/asm-s390/cmb.h b/include/asm-s390/cmb.h
index 021e7c3223ec..50196857d27a 100644
--- a/include/asm-s390/cmb.h
+++ b/include/asm-s390/cmb.h
@@ -1,29 +1,29 @@
1#ifndef S390_CMB_H 1#ifndef S390_CMB_H
2#define S390_CMB_H 2#define S390_CMB_H
3/** 3/**
4 * struct cmbdata -- channel measurement block data for user space 4 * struct cmbdata - channel measurement block data for user space
5 * @size: size of the stored data
6 * @elapsed_time: time since last sampling
7 * @ssch_rsch_count: number of ssch and rsch
8 * @sample_count: number of samples
9 * @device_connect_time: time of device connect
10 * @function_pending_time: time of function pending
11 * @device_disconnect_time: time of device disconnect
12 * @control_unit_queuing_time: time of control unit queuing
13 * @device_active_only_time: time of device active only
14 * @device_busy_time: time of device busy (ext. format)
15 * @initial_command_response_time: initial command response time (ext. format)
5 * 16 *
6 * @size: size of the stored data 17 * All values are stored as 64 bit for simplicity, especially
7 * @ssch_rsch_count: XXX
8 * @sample_count:
9 * @device_connect_time:
10 * @function_pending_time:
11 * @device_disconnect_time:
12 * @control_unit_queuing_time:
13 * @device_active_only_time:
14 * @device_busy_time:
15 * @initial_command_response_time:
16 *
17 * all values are stored as 64 bit for simplicity, especially
18 * in 32 bit emulation mode. All time values are normalized to 18 * in 32 bit emulation mode. All time values are normalized to
19 * nanoseconds. 19 * nanoseconds.
20 * Currently, two formats are known, which differ by the size of 20 * Currently, two formats are known, which differ by the size of
21 * this structure, i.e. the last two members are only set when 21 * this structure, i.e. the last two members are only set when
22 * the extended channel measurement facility (first shipped in 22 * the extended channel measurement facility (first shipped in
23 * z990 machines) is activated. 23 * z990 machines) is activated.
24 * Potentially, more fields could be added, which results in a 24 * Potentially, more fields could be added, which would result in a
25 * new ioctl number. 25 * new ioctl number.
26 **/ 26 */
27struct cmbdata { 27struct cmbdata {
28 __u64 size; 28 __u64 size;
29 __u64 elapsed_time; 29 __u64 elapsed_time;
@@ -41,53 +41,18 @@ struct cmbdata {
41}; 41};
42 42
43/* enable channel measurement */ 43/* enable channel measurement */
44#define BIODASDCMFENABLE _IO(DASD_IOCTL_LETTER,32) 44#define BIODASDCMFENABLE _IO(DASD_IOCTL_LETTER, 32)
45/* enable channel measurement */ 45/* enable channel measurement */
46#define BIODASDCMFDISABLE _IO(DASD_IOCTL_LETTER,33) 46#define BIODASDCMFDISABLE _IO(DASD_IOCTL_LETTER, 33)
47/* read channel measurement data */ 47/* read channel measurement data */
48#define BIODASDREADALLCMB _IOWR(DASD_IOCTL_LETTER,33,struct cmbdata) 48#define BIODASDREADALLCMB _IOWR(DASD_IOCTL_LETTER, 33, struct cmbdata)
49 49
50#ifdef __KERNEL__ 50#ifdef __KERNEL__
51struct ccw_device; 51struct ccw_device;
52/**
53 * enable_cmf() - switch on the channel measurement for a specific device
54 * @cdev: The ccw device to be enabled
55 * returns 0 for success or a negative error value.
56 *
57 * Context:
58 * non-atomic
59 **/
60extern int enable_cmf(struct ccw_device *cdev); 52extern int enable_cmf(struct ccw_device *cdev);
61
62/**
63 * disable_cmf() - switch off the channel measurement for a specific device
64 * @cdev: The ccw device to be disabled
65 * returns 0 for success or a negative error value.
66 *
67 * Context:
68 * non-atomic
69 **/
70extern int disable_cmf(struct ccw_device *cdev); 53extern int disable_cmf(struct ccw_device *cdev);
71
72/**
73 * cmf_read() - read one value from the current channel measurement block
74 * @cmf: the channel to be read
75 * @index: the name of the value that is read
76 *
77 * Context:
78 * any
79 **/
80
81extern u64 cmf_read(struct ccw_device *cdev, int index); 54extern u64 cmf_read(struct ccw_device *cdev, int index);
82/** 55extern int cmf_readall(struct ccw_device *cdev, struct cmbdata *data);
83 * cmf_readall() - read one value from the current channel measurement block
84 * @cmf: the channel to be read
85 * @data: a pointer to a data block that will be filled
86 *
87 * Context:
88 * any
89 **/
90extern int cmf_readall(struct ccw_device *cdev, struct cmbdata*data);
91 56
92#endif /* __KERNEL__ */ 57#endif /* __KERNEL__ */
93#endif /* S390_CMB_H */ 58#endif /* S390_CMB_H */
diff --git a/include/asm-s390/page.h b/include/asm-s390/page.h
index f326451ed6ec..ceec3826a67c 100644
--- a/include/asm-s390/page.h
+++ b/include/asm-s390/page.h
@@ -9,11 +9,12 @@
9#ifndef _S390_PAGE_H 9#ifndef _S390_PAGE_H
10#define _S390_PAGE_H 10#define _S390_PAGE_H
11 11
12#include <linux/const.h>
12#include <asm/types.h> 13#include <asm/types.h>
13 14
14/* PAGE_SHIFT determines the page size */ 15/* PAGE_SHIFT determines the page size */
15#define PAGE_SHIFT 12 16#define PAGE_SHIFT 12
16#define PAGE_SIZE (1UL << PAGE_SHIFT) 17#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
17#define PAGE_MASK (~(PAGE_SIZE-1)) 18#define PAGE_MASK (~(PAGE_SIZE-1))
18#define PAGE_DEFAULT_ACC 0 19#define PAGE_DEFAULT_ACC 0
19#define PAGE_DEFAULT_KEY (PAGE_DEFAULT_ACC << 4) 20#define PAGE_DEFAULT_KEY (PAGE_DEFAULT_ACC << 4)
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index 3208dc6c412c..39bb5192dc31 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -107,11 +107,18 @@ extern char empty_zero_page[PAGE_SIZE];
107 * any out-of-bounds memory accesses will hopefully be caught. 107 * any out-of-bounds memory accesses will hopefully be caught.
108 * The vmalloc() routines leaves a hole of 4kB between each vmalloced 108 * The vmalloc() routines leaves a hole of 4kB between each vmalloced
109 * area for the same reason. ;) 109 * area for the same reason. ;)
110 * vmalloc area starts at 4GB to prevent syscall table entry exchanging
111 * from modules.
110 */ 112 */
111extern unsigned long vmalloc_end; 113extern unsigned long vmalloc_end;
112#define VMALLOC_OFFSET (8*1024*1024) 114
113#define VMALLOC_START (((unsigned long) high_memory + VMALLOC_OFFSET) \ 115#ifdef CONFIG_64BIT
114 & ~(VMALLOC_OFFSET-1)) 116#define VMALLOC_ADDR (max(0x100000000UL, (unsigned long) high_memory))
117#else
118#define VMALLOC_ADDR ((unsigned long) high_memory)
119#endif
120#define VMALLOC_OFFSET (8*1024*1024)
121#define VMALLOC_START ((VMALLOC_ADDR + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
115#define VMALLOC_END vmalloc_end 122#define VMALLOC_END vmalloc_end
116 123
117/* 124/*
diff --git a/include/asm-s390/s390_ext.h b/include/asm-s390/s390_ext.h
index 1e72362cad78..2afc060266a2 100644
--- a/include/asm-s390/s390_ext.h
+++ b/include/asm-s390/s390_ext.h
@@ -5,7 +5,7 @@
5 * include/asm-s390/s390_ext.h 5 * include/asm-s390/s390_ext.h
6 * 6 *
7 * S390 version 7 * S390 version
8 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation 8 * Copyright IBM Corp. 1999,2007
9 * Author(s): Holger Smolinski (Holger.Smolinski@de.ibm.com), 9 * Author(s): Holger Smolinski (Holger.Smolinski@de.ibm.com),
10 * Martin Schwidefsky (schwidefsky@de.ibm.com) 10 * Martin Schwidefsky (schwidefsky@de.ibm.com)
11 */ 11 */
@@ -14,15 +14,11 @@
14 14
15typedef void (*ext_int_handler_t)(__u16 code); 15typedef void (*ext_int_handler_t)(__u16 code);
16 16
17/*
18 * Warning: if you change ext_int_info_t you have to change the
19 * external interrupt handler in entry.S too.
20 */
21typedef struct ext_int_info_t { 17typedef struct ext_int_info_t {
22 struct ext_int_info_t *next; 18 struct ext_int_info_t *next;
23 ext_int_handler_t handler; 19 ext_int_handler_t handler;
24 __u16 code; 20 __u16 code;
25} __attribute__ ((packed)) ext_int_info_t; 21} ext_int_info_t;
26 22
27extern ext_int_info_t *ext_int_hash[]; 23extern ext_int_info_t *ext_int_hash[];
28 24
diff --git a/include/asm-s390/system.h b/include/asm-s390/system.h
index 64a3cd05cae1..d866d3385556 100644
--- a/include/asm-s390/system.h
+++ b/include/asm-s390/system.h
@@ -130,6 +130,8 @@ extern void pfault_fini(void);
130 __ret; \ 130 __ret; \
131}) 131})
132 132
133extern void __xchg_called_with_bad_pointer(void);
134
133static inline unsigned long __xchg(unsigned long x, void * ptr, int size) 135static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
134{ 136{
135 unsigned long addr, old; 137 unsigned long addr, old;
@@ -150,8 +152,7 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
150 : "=&d" (old), "=m" (*(int *) addr) 152 : "=&d" (old), "=m" (*(int *) addr)
151 : "d" (x << shift), "d" (~(255 << shift)), "a" (addr), 153 : "d" (x << shift), "d" (~(255 << shift)), "a" (addr),
152 "m" (*(int *) addr) : "memory", "cc", "0"); 154 "m" (*(int *) addr) : "memory", "cc", "0");
153 x = old >> shift; 155 return old >> shift;
154 break;
155 case 2: 156 case 2:
156 addr = (unsigned long) ptr; 157 addr = (unsigned long) ptr;
157 shift = (2 ^ (addr & 2)) << 3; 158 shift = (2 ^ (addr & 2)) << 3;
@@ -166,8 +167,7 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
166 : "=&d" (old), "=m" (*(int *) addr) 167 : "=&d" (old), "=m" (*(int *) addr)
167 : "d" (x << shift), "d" (~(65535 << shift)), "a" (addr), 168 : "d" (x << shift), "d" (~(65535 << shift)), "a" (addr),
168 "m" (*(int *) addr) : "memory", "cc", "0"); 169 "m" (*(int *) addr) : "memory", "cc", "0");
169 x = old >> shift; 170 return old >> shift;
170 break;
171 case 4: 171 case 4:
172 asm volatile( 172 asm volatile(
173 " l %0,0(%3)\n" 173 " l %0,0(%3)\n"
@@ -176,8 +176,7 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
176 : "=&d" (old), "=m" (*(int *) ptr) 176 : "=&d" (old), "=m" (*(int *) ptr)
177 : "d" (x), "a" (ptr), "m" (*(int *) ptr) 177 : "d" (x), "a" (ptr), "m" (*(int *) ptr)
178 : "memory", "cc"); 178 : "memory", "cc");
179 x = old; 179 return old;
180 break;
181#ifdef __s390x__ 180#ifdef __s390x__
182 case 8: 181 case 8:
183 asm volatile( 182 asm volatile(
@@ -187,11 +186,11 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
187 : "=&d" (old), "=m" (*(long *) ptr) 186 : "=&d" (old), "=m" (*(long *) ptr)
188 : "d" (x), "a" (ptr), "m" (*(long *) ptr) 187 : "d" (x), "a" (ptr), "m" (*(long *) ptr)
189 : "memory", "cc"); 188 : "memory", "cc");
190 x = old; 189 return old;
191 break;
192#endif /* __s390x__ */ 190#endif /* __s390x__ */
193 } 191 }
194 return x; 192 __xchg_called_with_bad_pointer();
193 return x;
195} 194}
196 195
197/* 196/*
@@ -206,6 +205,8 @@ static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
206 ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ 205 ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\
207 (unsigned long)(n),sizeof(*(ptr)))) 206 (unsigned long)(n),sizeof(*(ptr))))
208 207
208extern void __cmpxchg_called_with_bad_pointer(void);
209
209static inline unsigned long 210static inline unsigned long
210__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) 211__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
211{ 212{
@@ -270,7 +271,8 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
270 return prev; 271 return prev;
271#endif /* __s390x__ */ 272#endif /* __s390x__ */
272 } 273 }
273 return old; 274 __cmpxchg_called_with_bad_pointer();
275 return old;
274} 276}
275 277
276/* 278/*
diff --git a/include/asm-s390/zcrypt.h b/include/asm-s390/zcrypt.h
index b90e55888a55..a5dada617751 100644
--- a/include/asm-s390/zcrypt.h
+++ b/include/asm-s390/zcrypt.h
@@ -91,7 +91,7 @@ struct ica_rsa_modexpo_crt {
91 * VUD block 91 * VUD block
92 * key block 92 * key block
93 */ 93 */
94struct ica_CPRBX { 94struct CPRBX {
95 unsigned short cprb_len; /* CPRB length 220 */ 95 unsigned short cprb_len; /* CPRB length 220 */
96 unsigned char cprb_ver_id; /* CPRB version id. 0x02 */ 96 unsigned char cprb_ver_id; /* CPRB version id. 0x02 */
97 unsigned char pad_000[3]; /* Alignment pad bytes */ 97 unsigned char pad_000[3]; /* Alignment pad bytes */
@@ -130,7 +130,7 @@ struct ica_CPRBX {
130 unsigned char cntrl_domain[4];/* Control domain */ 130 unsigned char cntrl_domain[4];/* Control domain */
131 unsigned char S390enf_mask[4];/* S/390 enforcement mask */ 131 unsigned char S390enf_mask[4];/* S/390 enforcement mask */
132 unsigned char pad_004[36]; /* reserved */ 132 unsigned char pad_004[36]; /* reserved */
133}; 133} __attribute__((packed));
134 134
135/** 135/**
136 * xcRB 136 * xcRB
diff --git a/include/asm-sh/cacheflush.h b/include/asm-sh/cacheflush.h
index 07f62ec9ff0c..aa558da08471 100644
--- a/include/asm-sh/cacheflush.h
+++ b/include/asm-sh/cacheflush.h
@@ -1,16 +1,47 @@
1#ifndef __ASM_SH_CACHEFLUSH_H 1#ifndef __ASM_SH_CACHEFLUSH_H
2#define __ASM_SH_CACHEFLUSH_H 2#define __ASM_SH_CACHEFLUSH_H
3
3#ifdef __KERNEL__ 4#ifdef __KERNEL__
4 5
5#include <linux/mm.h> 6#ifdef CONFIG_CACHE_OFF
7/*
8 * Nothing to do when the cache is disabled, initial flush and explicit
9 * disabling is handled at CPU init time.
10 *
11 * See arch/sh/kernel/cpu/init.c:cache_init().
12 */
13#define p3_cache_init() do { } while (0)
14#define flush_cache_all() do { } while (0)
15#define flush_cache_mm(mm) do { } while (0)
16#define flush_cache_dup_mm(mm) do { } while (0)
17#define flush_cache_range(vma, start, end) do { } while (0)
18#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
19#define flush_dcache_page(page) do { } while (0)
20#define flush_icache_range(start, end) do { } while (0)
21#define flush_icache_page(vma,pg) do { } while (0)
22#define flush_dcache_mmap_lock(mapping) do { } while (0)
23#define flush_dcache_mmap_unlock(mapping) do { } while (0)
24#define flush_cache_sigtramp(vaddr) do { } while (0)
25#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
26#define __flush_wback_region(start, size) do { (void)(start); } while (0)
27#define __flush_purge_region(start, size) do { (void)(start); } while (0)
28#define __flush_invalidate_region(start, size) do { (void)(start); } while (0)
29#else
6#include <asm/cpu/cacheflush.h> 30#include <asm/cpu/cacheflush.h>
7 31
32/*
33 * Consistent DMA requires that the __flush_xxx() primitives must be set
34 * for any of the enabled non-coherent caches (most of the UP CPUs),
35 * regardless of PIPT or VIPT cache configurations.
36 */
37
8/* Flush (write-back only) a region (smaller than a page) */ 38/* Flush (write-back only) a region (smaller than a page) */
9extern void __flush_wback_region(void *start, int size); 39extern void __flush_wback_region(void *start, int size);
10/* Flush (write-back & invalidate) a region (smaller than a page) */ 40/* Flush (write-back & invalidate) a region (smaller than a page) */
11extern void __flush_purge_region(void *start, int size); 41extern void __flush_purge_region(void *start, int size);
12/* Flush (invalidate only) a region (smaller than a page) */ 42/* Flush (invalidate only) a region (smaller than a page) */
13extern void __flush_invalidate_region(void *start, int size); 43extern void __flush_invalidate_region(void *start, int size);
44#endif
14 45
15#define flush_cache_vmap(start, end) flush_cache_all() 46#define flush_cache_vmap(start, end) flush_cache_all()
16#define flush_cache_vunmap(start, end) flush_cache_all() 47#define flush_cache_vunmap(start, end) flush_cache_all()
diff --git a/include/asm-sh/cpu-sh3/cache.h b/include/asm-sh/cpu-sh3/cache.h
index ffe08d2813f9..255016fc91f0 100644
--- a/include/asm-sh/cpu-sh3/cache.h
+++ b/include/asm-sh/cpu-sh3/cache.h
@@ -26,7 +26,9 @@
26#define CCR_CACHE_ENABLE CCR_CACHE_CE 26#define CCR_CACHE_ENABLE CCR_CACHE_CE
27#define CCR_CACHE_INVALIDATE CCR_CACHE_CF 27#define CCR_CACHE_INVALIDATE CCR_CACHE_CF
28 28
29#if defined(CONFIG_CPU_SUBTYPE_SH7705) || defined(CONFIG_CPU_SUBTYPE_SH7710) 29#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
30 defined(CONFIG_CPU_SUBTYPE_SH7710) || \
31 defined(CONFIG_CPU_SUBTYPE_SH7720)
30#define CCR3 0xa40000b4 32#define CCR3 0xa40000b4
31#define CCR_CACHE_16KB 0x00010000 33#define CCR_CACHE_16KB 0x00010000
32#define CCR_CACHE_32KB 0x00020000 34#define CCR_CACHE_32KB 0x00020000
diff --git a/include/asm-sh/cpu-sh3/dma.h b/include/asm-sh/cpu-sh3/dma.h
index 3a66dc458023..54bfece328c2 100644
--- a/include/asm-sh/cpu-sh3/dma.h
+++ b/include/asm-sh/cpu-sh3/dma.h
@@ -1,7 +1,20 @@
1#ifndef __ASM_CPU_SH3_DMA_H 1#ifndef __ASM_CPU_SH3_DMA_H
2#define __ASM_CPU_SH3_DMA_H 2#define __ASM_CPU_SH3_DMA_H
3 3
4
5#if defined(CONFIG_CPU_SUBTYPE_SH7720) || defined(CONFIG_CPU_SUBTYPE_SH7709)
6#define SH_DMAC_BASE 0xa4010020
7
8#define DMTE0_IRQ 48
9#define DMTE1_IRQ 49
10#define DMTE2_IRQ 50
11#define DMTE3_IRQ 51
12#define DMTE4_IRQ 76
13#define DMTE5_IRQ 77
14
15#else
4#define SH_DMAC_BASE 0xa4000020 16#define SH_DMAC_BASE 0xa4000020
17#endif
5 18
6/* Definitions for the SuperH DMAC */ 19/* Definitions for the SuperH DMAC */
7#define TM_BURST 0x00000020 20#define TM_BURST 0x00000020
diff --git a/include/asm-sh/cpu-sh3/gpio.h b/include/asm-sh/cpu-sh3/gpio.h
new file mode 100644
index 000000000000..48770c1c7bdf
--- /dev/null
+++ b/include/asm-sh/cpu-sh3/gpio.h
@@ -0,0 +1,66 @@
1/*
2 * include/asm-sh/cpu-sh3/gpio.h
3 *
4 * Copyright (C) 2007 Markus Brunner, Mark Jonas
5 *
6 * Addresses for the Pin Function Controller
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#ifndef _CPU_SH3_GPIO_H
13#define _CPU_SH3_GPIO_H
14
15#if defined(CONFIG_CPU_SUBTYPE_SH7720)
16
17/* Control registers */
18#define PORT_PACR 0xA4050100UL
19#define PORT_PBCR 0xA4050102UL
20#define PORT_PCCR 0xA4050104UL
21#define PORT_PDCR 0xA4050106UL
22#define PORT_PECR 0xA4050108UL
23#define PORT_PFCR 0xA405010AUL
24#define PORT_PGCR 0xA405010CUL
25#define PORT_PHCR 0xA405010EUL
26#define PORT_PJCR 0xA4050110UL
27#define PORT_PKCR 0xA4050112UL
28#define PORT_PLCR 0xA4050114UL
29#define PORT_PMCR 0xA4050116UL
30#define PORT_PPCR 0xA4050118UL
31#define PORT_PRCR 0xA405011AUL
32#define PORT_PSCR 0xA405011CUL
33#define PORT_PTCR 0xA405011EUL
34#define PORT_PUCR 0xA4050120UL
35#define PORT_PVCR 0xA4050122UL
36
37/* Data registers */
38#define PORT_PADR 0xA4050140UL
39/* Address of PORT_PBDR is wrong in the datasheet, see errata 2005-09-21 */
40#define PORT_PBDR 0xA4050142UL
41#define PORT_PCDR 0xA4050144UL
42#define PORT_PDDR 0xA4050146UL
43#define PORT_PEDR 0xA4050148UL
44#define PORT_PFDR 0xA405014AUL
45#define PORT_PGDR 0xA405014CUL
46#define PORT_PHDR 0xA405014EUL
47#define PORT_PJDR 0xA4050150UL
48#define PORT_PKDR 0xA4050152UL
49#define PORT_PLDR 0xA4050154UL
50#define PORT_PMDR 0xA4050156UL
51#define PORT_PPDR 0xA4050158UL
52#define PORT_PRDR 0xA405015AUL
53#define PORT_PSDR 0xA405015CUL
54#define PORT_PTDR 0xA405015EUL
55#define PORT_PUDR 0xA4050160UL
56#define PORT_PVDR 0xA4050162UL
57
58/* Pin Select Registers */
59#define PORT_PSELA 0xA4050124UL
60#define PORT_PSELB 0xA4050126UL
61#define PORT_PSELC 0xA4050128UL
62#define PORT_PSELD 0xA405012AUL
63
64#endif
65
66#endif
diff --git a/include/asm-sh/cpu-sh3/mmu_context.h b/include/asm-sh/cpu-sh3/mmu_context.h
index b20786d42d09..16c2d63b7e39 100644
--- a/include/asm-sh/cpu-sh3/mmu_context.h
+++ b/include/asm-sh/cpu-sh3/mmu_context.h
@@ -27,12 +27,13 @@
27#define TRA 0xffffffd0 27#define TRA 0xffffffd0
28#define EXPEVT 0xffffffd4 28#define EXPEVT 0xffffffd4
29 29
30#if defined(CONFIG_CPU_SUBTYPE_SH7707) || \ 30#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
31 defined(CONFIG_CPU_SUBTYPE_SH7709) || \
32 defined(CONFIG_CPU_SUBTYPE_SH7706) || \ 31 defined(CONFIG_CPU_SUBTYPE_SH7706) || \
33 defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 32 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
33 defined(CONFIG_CPU_SUBTYPE_SH7709) || \
34 defined(CONFIG_CPU_SUBTYPE_SH7710) || \
34 defined(CONFIG_CPU_SUBTYPE_SH7712) || \ 35 defined(CONFIG_CPU_SUBTYPE_SH7712) || \
35 defined(CONFIG_CPU_SUBTYPE_SH7710) 36 defined(CONFIG_CPU_SUBTYPE_SH7720)
36#define INTEVT 0xa4000000 /* INTEVTE2(0xa4000000) */ 37#define INTEVT 0xa4000000 /* INTEVTE2(0xa4000000) */
37#else 38#else
38#define INTEVT 0xffffffd8 39#define INTEVT 0xffffffd8
diff --git a/include/asm-sh/cpu-sh3/timer.h b/include/asm-sh/cpu-sh3/timer.h
index b6c2020a2ad3..3880ce047fe0 100644
--- a/include/asm-sh/cpu-sh3/timer.h
+++ b/include/asm-sh/cpu-sh3/timer.h
@@ -23,11 +23,13 @@
23 * --------------------------------------------------------------------------- 23 * ---------------------------------------------------------------------------
24 */ 24 */
25 25
26#if !defined(CONFIG_CPU_SUBTYPE_SH7727) 26#if !defined(CONFIG_CPU_SUBTYPE_SH7720) && \
27 !defined(CONFIG_CPU_SUBTYPE_SH7727)
27#define TMU_TOCR 0xfffffe90 /* Byte access */ 28#define TMU_TOCR 0xfffffe90 /* Byte access */
28#endif 29#endif
29 30
30#if defined(CONFIG_CPU_SUBTYPE_SH7710) 31#if defined(CONFIG_CPU_SUBTYPE_SH7710) || \
32 defined(CONFIG_CPU_SUBTYPE_SH7720)
31#define TMU_012_TSTR 0xa412fe92 /* Byte access */ 33#define TMU_012_TSTR 0xa412fe92 /* Byte access */
32 34
33#define TMU0_TCOR 0xa412fe94 /* Long access */ 35#define TMU0_TCOR 0xa412fe94 /* Long access */
@@ -56,7 +58,8 @@
56#define TMU2_TCOR 0xfffffeac /* Long access */ 58#define TMU2_TCOR 0xfffffeac /* Long access */
57#define TMU2_TCNT 0xfffffeb0 /* Long access */ 59#define TMU2_TCNT 0xfffffeb0 /* Long access */
58#define TMU2_TCR 0xfffffeb4 /* Word access */ 60#define TMU2_TCR 0xfffffeb4 /* Word access */
59#if !defined(CONFIG_CPU_SUBTYPE_SH7727) 61#if !defined(CONFIG_CPU_SUBTYPE_SH7720) && \
62 !defined(CONFIG_CPU_SUBTYPE_SH7727)
60#define TMU2_TCPR2 0xfffffeb8 /* Long access */ 63#define TMU2_TCPR2 0xfffffeb8 /* Long access */
61#endif 64#endif
62#endif 65#endif
diff --git a/include/asm-sh/cpu-sh3/ubc.h b/include/asm-sh/cpu-sh3/ubc.h
index 9d308cbe9b29..18467c574534 100644
--- a/include/asm-sh/cpu-sh3/ubc.h
+++ b/include/asm-sh/cpu-sh3/ubc.h
@@ -11,7 +11,8 @@
11#ifndef __ASM_CPU_SH3_UBC_H 11#ifndef __ASM_CPU_SH3_UBC_H
12#define __ASM_CPU_SH3_UBC_H 12#define __ASM_CPU_SH3_UBC_H
13 13
14#if defined(CONFIG_CPU_SUBTYPE_SH7710) 14#if defined(CONFIG_CPU_SUBTYPE_SH7710) || \
15 defined(CONFIG_CPU_SUBTYPE_SH7720)
15#define UBC_BARA 0xa4ffffb0 16#define UBC_BARA 0xa4ffffb0
16#define UBC_BAMRA 0xa4ffffb4 17#define UBC_BAMRA 0xa4ffffb4
17#define UBC_BBRA 0xa4ffffb8 18#define UBC_BBRA 0xa4ffffb8
diff --git a/include/asm-sh/cpu-sh4/dma.h b/include/asm-sh/cpu-sh4/dma.h
index 36e26a964765..aaf71b018c28 100644
--- a/include/asm-sh/cpu-sh4/dma.h
+++ b/include/asm-sh/cpu-sh4/dma.h
@@ -31,7 +31,7 @@
31#define TS_32 0x00000030 31#define TS_32 0x00000030
32#define TS_64 0x00000000 32#define TS_64 0x00000000
33 33
34#define CHCR_TS_MASK 0x30 34#define CHCR_TS_MASK 0x70
35#define CHCR_TS_SHIFT 4 35#define CHCR_TS_SHIFT 4
36 36
37#define DMAOR_COD 0x00000008 37#define DMAOR_COD 0x00000008
diff --git a/include/asm-sh/cpu-sh4/mmu_context.h b/include/asm-sh/cpu-sh4/mmu_context.h
index ff4c5fbbfaf0..979acddc0f8e 100644
--- a/include/asm-sh/cpu-sh4/mmu_context.h
+++ b/include/asm-sh/cpu-sh4/mmu_context.h
@@ -22,13 +22,21 @@
22#define MMU_UTLB_ADDRESS_ARRAY 0xF6000000 22#define MMU_UTLB_ADDRESS_ARRAY 0xF6000000
23#define MMU_PAGE_ASSOC_BIT 0x80 23#define MMU_PAGE_ASSOC_BIT 0x80
24 24
25#define MMU_NTLB_ENTRIES 64 /* for 7750 */ 25#ifdef CONFIG_X2TLB
26#define MMUCR_ME (1 << 7)
27#else
28#define MMUCR_ME (0)
29#endif
30
26#ifdef CONFIG_SH_STORE_QUEUES 31#ifdef CONFIG_SH_STORE_QUEUES
27#define MMU_CONTROL_INIT 0x05 /* SQMD=0, SV=0, TI=1, AT=1 */ 32#define MMUCR_SQMD (1 << 9)
28#else 33#else
29#define MMU_CONTROL_INIT 0x205 /* SQMD=1, SV=0, TI=1, AT=1 */ 34#define MMUCR_SQMD (0)
30#endif 35#endif
31 36
37#define MMU_NTLB_ENTRIES 64
38#define MMU_CONTROL_INIT (0x05|MMUCR_SQMD|MMUCR_ME)
39
32#define MMU_ITLB_DATA_ARRAY 0xF3000000 40#define MMU_ITLB_DATA_ARRAY 0xF3000000
33#define MMU_UTLB_DATA_ARRAY 0xF7000000 41#define MMU_UTLB_DATA_ARRAY 0xF7000000
34 42
diff --git a/include/asm-sh/dma.h b/include/asm-sh/dma.h
index 4c75b70b6414..a65b02fd186e 100644
--- a/include/asm-sh/dma.h
+++ b/include/asm-sh/dma.h
@@ -152,14 +152,9 @@ extern struct dma_info *get_dma_info_by_name(const char *dmac_name);
152extern int dma_extend(unsigned int chan, unsigned long op, void *param); 152extern int dma_extend(unsigned int chan, unsigned long op, void *param);
153extern int register_chan_caps(const char *dmac, struct dma_chan_caps *capslist); 153extern int register_chan_caps(const char *dmac, struct dma_chan_caps *capslist);
154 154
155#ifdef CONFIG_SYSFS
156/* arch/sh/drivers/dma/dma-sysfs.c */ 155/* arch/sh/drivers/dma/dma-sysfs.c */
157extern int dma_create_sysfs_files(struct dma_channel *, struct dma_info *); 156extern int dma_create_sysfs_files(struct dma_channel *, struct dma_info *);
158extern void dma_remove_sysfs_files(struct dma_channel *, struct dma_info *); 157extern void dma_remove_sysfs_files(struct dma_channel *, struct dma_info *);
159#else
160#define dma_create_sysfs_file(channel, info) do { } while (0)
161#define dma_remove_sysfs_file(channel, info) do { } while (0)
162#endif
163 158
164#ifdef CONFIG_PCI 159#ifdef CONFIG_PCI
165extern int isa_dma_bridge_buggy; 160extern int isa_dma_bridge_buggy;
diff --git a/include/asm-sh/dreamcast/maple.h b/include/asm-sh/dreamcast/maple.h
new file mode 100644
index 000000000000..51f6a87f1f11
--- /dev/null
+++ b/include/asm-sh/dreamcast/maple.h
@@ -0,0 +1,37 @@
1#ifndef __ASM_MAPLE_H
2#define __ASM_MAPLE_H
3
4#define MAPLE_PORTS 4
5#define MAPLE_PNP_INTERVAL HZ
6#define MAPLE_MAXPACKETS 8
7#define MAPLE_DMA_ORDER 14
8#define MAPLE_DMA_SIZE (1 << MAPLE_DMA_ORDER)
9#define MAPLE_DMA_PAGES ((MAPLE_DMA_ORDER > PAGE_SHIFT) ? \
10 MAPLE_DMA_ORDER - PAGE_SHIFT : 0)
11
12/* Maple Bus registers */
13#define MAPLE_BASE 0xa05f6c00
14#define MAPLE_DMAADDR (MAPLE_BASE+0x04)
15#define MAPLE_TRIGTYPE (MAPLE_BASE+0x10)
16#define MAPLE_ENABLE (MAPLE_BASE+0x14)
17#define MAPLE_STATE (MAPLE_BASE+0x18)
18#define MAPLE_SPEED (MAPLE_BASE+0x80)
19#define MAPLE_RESET (MAPLE_BASE+0x8c)
20
21#define MAPLE_MAGIC 0x6155404f
22#define MAPLE_2MBPS 0
23#define MAPLE_TIMEOUT(n) ((n)<<15)
24
25/* Function codes */
26#define MAPLE_FUNC_CONTROLLER 0x001
27#define MAPLE_FUNC_MEMCARD 0x002
28#define MAPLE_FUNC_LCD 0x004
29#define MAPLE_FUNC_CLOCK 0x008
30#define MAPLE_FUNC_MICROPHONE 0x010
31#define MAPLE_FUNC_ARGUN 0x020
32#define MAPLE_FUNC_KEYBOARD 0x040
33#define MAPLE_FUNC_LIGHTGUN 0x080
34#define MAPLE_FUNC_PURUPURU 0x100
35#define MAPLE_FUNC_MOUSE 0x200
36
37#endif /* __ASM_MAPLE_H */
diff --git a/include/asm-sh/gpio.h b/include/asm-sh/gpio.h
new file mode 100644
index 000000000000..9bb27e0f11a4
--- /dev/null
+++ b/include/asm-sh/gpio.h
@@ -0,0 +1,19 @@
1/*
2 * include/asm-sh/gpio.h
3 *
4 * Copyright (C) 2007 Markus Brunner, Mark Jonas
5 *
6 * Addresses for the Pin Function Controller
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#ifndef __ASM_SH_GPIO_H
13#define __ASM_SH_GPIO_H
14
15#if defined(CONFIG_CPU_SH3)
16#include <asm/cpu/gpio.h>
17#endif
18
19#endif /* __ASM_SH_GPIO_H */
diff --git a/include/asm-sh/hd64461.h b/include/asm-sh/hd64461.h
index 4dd8592ca014..342ca55a266a 100644
--- a/include/asm-sh/hd64461.h
+++ b/include/asm-sh/hd64461.h
@@ -226,6 +226,7 @@
226#define HD64461_NIMR (CONFIG_HD64461_IOBASE + 0x5002) 226#define HD64461_NIMR (CONFIG_HD64461_IOBASE + 0x5002)
227 227
228#define HD64461_IRQBASE OFFCHIP_IRQ_BASE 228#define HD64461_IRQBASE OFFCHIP_IRQ_BASE
229#define OFFCHIP_IRQ_BASE 64
229#define HD64461_IRQ_NUM 16 230#define HD64461_IRQ_NUM 16
230 231
231#define HD64461_IRQ_UART (HD64461_IRQBASE+5) 232#define HD64461_IRQ_UART (HD64461_IRQBASE+5)
diff --git a/include/asm-sh/heartbeat.h b/include/asm-sh/heartbeat.h
new file mode 100644
index 000000000000..724a43ed245e
--- /dev/null
+++ b/include/asm-sh/heartbeat.h
@@ -0,0 +1,17 @@
1#ifndef __ASM_SH_HEARTBEAT_H
2#define __ASM_SH_HEARTBEAT_H
3
4#include <linux/timer.h>
5
6#define HEARTBEAT_INVERTED (1 << 0)
7
8struct heartbeat_data {
9 void __iomem *base;
10 unsigned char *bit_pos;
11 unsigned int nr_bits;
12 struct timer_list timer;
13 unsigned int regsize;
14 unsigned long flags;
15};
16
17#endif /* __ASM_SH_HEARTBEAT_H */
diff --git a/include/asm-sh/hw_irq.h b/include/asm-sh/hw_irq.h
index 20d42959f52a..cb0b6c9f7020 100644
--- a/include/asm-sh/hw_irq.h
+++ b/include/asm-sh/hw_irq.h
@@ -6,24 +6,6 @@
6 6
7extern atomic_t irq_err_count; 7extern atomic_t irq_err_count;
8 8
9struct intc2_data {
10 unsigned short irq;
11 unsigned char ipr_offset, ipr_shift;
12 unsigned char msk_offset, msk_shift;
13 unsigned char priority;
14};
15
16struct intc2_desc {
17 unsigned long prio_base;
18 unsigned long msk_base;
19 unsigned long mskclr_base;
20 struct intc2_data *intc2_data;
21 unsigned int nr_irqs;
22 struct irq_chip chip;
23};
24
25void register_intc2_controller(struct intc2_desc *);
26
27struct ipr_data { 9struct ipr_data {
28 unsigned char irq; 10 unsigned char irq;
29 unsigned char ipr_idx; /* Index for the IPR registered */ 11 unsigned char ipr_idx; /* Index for the IPR registered */
@@ -41,11 +23,6 @@ struct ipr_desc {
41 23
42void register_ipr_controller(struct ipr_desc *); 24void register_ipr_controller(struct ipr_desc *);
43 25
44/*
45 * Enable individual interrupt mode for external IPR IRQs.
46 */
47void __init ipr_irq_enable_irlm(void);
48
49typedef unsigned char intc_enum; 26typedef unsigned char intc_enum;
50 27
51struct intc_vect { 28struct intc_vect {
@@ -54,6 +31,7 @@ struct intc_vect {
54}; 31};
55 32
56#define INTC_VECT(enum_id, vect) { enum_id, vect } 33#define INTC_VECT(enum_id, vect) { enum_id, vect }
34#define INTC_IRQ(enum_id, irq) INTC_VECT(enum_id, irq2evt(irq))
57 35
58struct intc_prio { 36struct intc_prio {
59 intc_enum enum_id; 37 intc_enum enum_id;
@@ -64,19 +42,25 @@ struct intc_prio {
64 42
65struct intc_group { 43struct intc_group {
66 intc_enum enum_id; 44 intc_enum enum_id;
67 intc_enum *enum_ids; 45 intc_enum enum_ids[32];
68}; 46};
69 47
70#define INTC_GROUP(enum_id, ids...) { enum_id, (intc_enum []) { ids, 0 } } 48#define INTC_GROUP(enum_id, ids...) { enum_id, { ids } }
71 49
72struct intc_mask_reg { 50struct intc_mask_reg {
73 unsigned long set_reg, clr_reg, reg_width; 51 unsigned long set_reg, clr_reg, reg_width;
74 intc_enum enum_ids[32]; 52 intc_enum enum_ids[32];
53#ifdef CONFIG_SMP
54 unsigned long smp;
55#endif
75}; 56};
76 57
77struct intc_prio_reg { 58struct intc_prio_reg {
78 unsigned long reg, reg_width, field_width; 59 unsigned long set_reg, clr_reg, reg_width, field_width;
79 intc_enum enum_ids[16]; 60 intc_enum enum_ids[16];
61#ifdef CONFIG_SMP
62 unsigned long smp;
63#endif
80}; 64};
81 65
82struct intc_sense_reg { 66struct intc_sense_reg {
@@ -84,6 +68,12 @@ struct intc_sense_reg {
84 intc_enum enum_ids[16]; 68 intc_enum enum_ids[16];
85}; 69};
86 70
71#ifdef CONFIG_SMP
72#define INTC_SMP(stride, nr) .smp = (stride) | ((nr) << 8)
73#else
74#define INTC_SMP(stride, nr)
75#endif
76
87struct intc_desc { 77struct intc_desc {
88 struct intc_vect *vectors; 78 struct intc_vect *vectors;
89 unsigned int nr_vectors; 79 unsigned int nr_vectors;
@@ -97,25 +87,28 @@ struct intc_desc {
97 unsigned int nr_prio_regs; 87 unsigned int nr_prio_regs;
98 struct intc_sense_reg *sense_regs; 88 struct intc_sense_reg *sense_regs;
99 unsigned int nr_sense_regs; 89 unsigned int nr_sense_regs;
100 struct irq_chip chip; 90 char *name;
101}; 91};
102 92
103#define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a) 93#define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a)
104#define DECLARE_INTC_DESC(symbol, chipname, vectors, groups, \ 94#define DECLARE_INTC_DESC(symbol, chipname, vectors, groups, \
105 priorities, mask_regs, prio_regs, sense_regs) \ 95 priorities, mask_regs, prio_regs, sense_regs) \
106struct intc_desc symbol = { \ 96struct intc_desc symbol __initdata = { \
107 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \ 97 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \
108 _INTC_ARRAY(priorities), \ 98 _INTC_ARRAY(priorities), \
109 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \ 99 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \
110 _INTC_ARRAY(sense_regs), \ 100 _INTC_ARRAY(sense_regs), \
111 .chip.name = chipname, \ 101 chipname, \
112} 102}
113 103
114void __init register_intc_controller(struct intc_desc *desc); 104void __init register_intc_controller(struct intc_desc *desc);
105int intc_set_priority(unsigned int irq, unsigned int prio);
115 106
116void __init plat_irq_setup(void); 107void __init plat_irq_setup(void);
117 108
118enum { IRQ_MODE_IRQ, IRQ_MODE_IRL7654, IRQ_MODE_IRL3210 }; 109enum { IRQ_MODE_IRQ, IRQ_MODE_IRQ7654, IRQ_MODE_IRQ3210,
110 IRQ_MODE_IRL7654_MASK, IRQ_MODE_IRL3210_MASK,
111 IRQ_MODE_IRL7654, IRQ_MODE_IRL3210 };
119void __init plat_irq_setup_pins(int mode); 112void __init plat_irq_setup_pins(int mode);
120 113
121#endif /* __ASM_SH_HW_IRQ_H */ 114#endif /* __ASM_SH_HW_IRQ_H */
diff --git a/include/asm-sh/ilsel.h b/include/asm-sh/ilsel.h
new file mode 100644
index 000000000000..e3d304b280f6
--- /dev/null
+++ b/include/asm-sh/ilsel.h
@@ -0,0 +1,45 @@
1#ifndef __ASM_SH_ILSEL_H
2#define __ASM_SH_ILSEL_H
3
4typedef enum {
5 ILSEL_NONE,
6 ILSEL_LAN,
7 ILSEL_USBH_I,
8 ILSEL_USBH_S,
9 ILSEL_USBH_V,
10 ILSEL_RTC,
11 ILSEL_USBP_I,
12 ILSEL_USBP_S,
13 ILSEL_USBP_V,
14 ILSEL_KEY,
15
16 /*
17 * ILSEL Aliases - corner cases for interleaved level tables.
18 *
19 * Someone thought this was a good idea and less hassle than
20 * demuxing a shared vector, really.
21 */
22
23 /* ILSEL0 and 2 */
24 ILSEL_FPGA0,
25 ILSEL_FPGA1,
26 ILSEL_EX1,
27 ILSEL_EX2,
28 ILSEL_EX3,
29 ILSEL_EX4,
30
31 /* ILSEL1 and 3 */
32 ILSEL_FPGA2 = ILSEL_FPGA0,
33 ILSEL_FPGA3 = ILSEL_FPGA1,
34 ILSEL_EX5 = ILSEL_EX1,
35 ILSEL_EX6 = ILSEL_EX2,
36 ILSEL_EX7 = ILSEL_EX3,
37 ILSEL_EX8 = ILSEL_EX4,
38} ilsel_source_t;
39
40/* arch/sh/boards/renesas/x3proto/ilsel.c */
41int ilsel_enable(ilsel_source_t set);
42int ilsel_enable_fixed(ilsel_source_t set, unsigned int level);
43void ilsel_disable(unsigned int irq);
44
45#endif /* __ASM_SH_ILSEL_H */
diff --git a/include/asm-sh/io.h b/include/asm-sh/io.h
index e6a1877dcb20..1a336cdc75fe 100644
--- a/include/asm-sh/io.h
+++ b/include/asm-sh/io.h
@@ -135,6 +135,32 @@ void __raw_readsl(unsigned long addr, void *data, int longlen);
135# define writel(v,a) ({ __raw_writel((v),(a)); mb(); }) 135# define writel(v,a) ({ __raw_writel((v),(a)); mb(); })
136#endif 136#endif
137 137
138#define __BUILD_MEMORY_STRING(bwlq, type) \
139 \
140static inline void writes##bwlq(volatile void __iomem *mem, \
141 const void *addr, unsigned int count) \
142{ \
143 const volatile type *__addr = addr; \
144 \
145 while (count--) { \
146 __raw_write##bwlq(*__addr, mem); \
147 __addr++; \
148 } \
149} \
150 \
151static inline void reads##bwlq(volatile void __iomem *mem, void *addr, \
152 unsigned int count) \
153{ \
154 volatile type *__addr = addr; \
155 \
156 while (count--) { \
157 *__addr = __raw_read##bwlq(mem); \
158 __addr++; \
159 } \
160}
161
162__BUILD_MEMORY_STRING(b, u8)
163__BUILD_MEMORY_STRING(w, u16)
138#define writesl __raw_writesl 164#define writesl __raw_writesl
139#define readsl __raw_readsl 165#define readsl __raw_readsl
140 166
diff --git a/include/asm-sh/kgdb.h b/include/asm-sh/kgdb.h
index 74bd0953e5ce..4bc8cb187d11 100644
--- a/include/asm-sh/kgdb.h
+++ b/include/asm-sh/kgdb.h
@@ -17,9 +17,6 @@
17#define __KGDB_H 17#define __KGDB_H
18 18
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20#include <asm/cacheflush.h>
21
22struct console;
23 20
24/* Same as pt_regs but has vbr in place of syscall_nr */ 21/* Same as pt_regs but has vbr in place of syscall_nr */
25struct kgdb_regs { 22struct kgdb_regs {
@@ -35,10 +32,7 @@ struct kgdb_regs {
35 32
36/* State info */ 33/* State info */
37extern char kgdb_in_gdb_mode; 34extern char kgdb_in_gdb_mode;
38extern int kgdb_done_init;
39extern int kgdb_enabled;
40extern int kgdb_nofault; /* Ignore bus errors (in gdb mem access) */ 35extern int kgdb_nofault; /* Ignore bus errors (in gdb mem access) */
41extern int kgdb_halt; /* Execute initial breakpoint at startup */
42extern char in_nmi; /* Debounce flag to prevent NMI reentry*/ 36extern char in_nmi; /* Debounce flag to prevent NMI reentry*/
43 37
44/* SCI */ 38/* SCI */
@@ -59,6 +53,7 @@ extern kgdb_debug_hook_t *kgdb_debug_hook;
59extern kgdb_bus_error_hook_t *kgdb_bus_err_hook; 53extern kgdb_bus_error_hook_t *kgdb_bus_err_hook;
60 54
61/* Console */ 55/* Console */
56struct console;
62void kgdb_console_write(struct console *co, const char *s, unsigned count); 57void kgdb_console_write(struct console *co, const char *s, unsigned count);
63extern int kgdb_console_setup(struct console *, char *); 58extern int kgdb_console_setup(struct console *, char *);
64 59
@@ -69,22 +64,7 @@ extern void longjmp(jmp_buf __jmpb, int __retval);
69extern int setjmp(jmp_buf __jmpb); 64extern int setjmp(jmp_buf __jmpb);
70 65
71/* Forced breakpoint */ 66/* Forced breakpoint */
72#define breakpoint() \ 67#define breakpoint() __asm__ __volatile__("trapa #0x3c")
73do { \
74 if (kgdb_enabled) \
75 __asm__ __volatile__("trapa #0x3c"); \
76} while (0)
77
78/* KGDB should be able to flush all kernel text space */
79#if defined(CONFIG_CPU_SH4)
80#define kgdb_flush_icache_range(start, end) \
81{ \
82 __flush_purge_region((void*)(start), (int)(end) - (int)(start));\
83 flush_icache_range((start), (end)); \
84}
85#else
86#define kgdb_flush_icache_range(start, end) do { } while (0)
87#endif
88 68
89/* Taken from sh-stub.c of GDB 4.18 */ 69/* Taken from sh-stub.c of GDB 4.18 */
90static const char hexchars[] = "0123456789abcdef"; 70static const char hexchars[] = "0123456789abcdef";
diff --git a/include/asm-sh/magicpanelr2.h b/include/asm-sh/magicpanelr2.h
new file mode 100644
index 000000000000..c644a77ee357
--- /dev/null
+++ b/include/asm-sh/magicpanelr2.h
@@ -0,0 +1,67 @@
1/*
2 * include/asm-sh/magicpanelr2.h
3 *
4 * Copyright (C) 2007 Markus Brunner, Mark Jonas
5 *
6 * I/O addresses and bitmasks for Magic Panel Release 2 board
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12
13#ifndef __ASM_SH_MAGICPANELR2_H
14#define __ASM_SH_MAGICPANELR2_H
15
16#include <asm/gpio.h>
17
18#define __IO_PREFIX mpr2
19#include <asm/io_generic.h>
20
21
22#define SETBITS_OUTB(mask, reg) ctrl_outb(ctrl_inb(reg) | mask, reg)
23#define SETBITS_OUTW(mask, reg) ctrl_outw(ctrl_inw(reg) | mask, reg)
24#define SETBITS_OUTL(mask, reg) ctrl_outl(ctrl_inl(reg) | mask, reg)
25#define CLRBITS_OUTB(mask, reg) ctrl_outb(ctrl_inb(reg) & ~mask, reg)
26#define CLRBITS_OUTW(mask, reg) ctrl_outw(ctrl_inw(reg) & ~mask, reg)
27#define CLRBITS_OUTL(mask, reg) ctrl_outl(ctrl_inl(reg) & ~mask, reg)
28
29
30#define PA_LED PORT_PADR /* LED */
31
32
33/* BSC */
34#define CMNCR 0xA4FD0000UL
35#define CS0BCR 0xA4FD0004UL
36#define CS2BCR 0xA4FD0008UL
37#define CS3BCR 0xA4FD000CUL
38#define CS4BCR 0xA4FD0010UL
39#define CS5ABCR 0xA4FD0014UL
40#define CS5BBCR 0xA4FD0018UL
41#define CS6ABCR 0xA4FD001CUL
42#define CS6BBCR 0xA4FD0020UL
43#define CS0WCR 0xA4FD0024UL
44#define CS2WCR 0xA4FD0028UL
45#define CS3WCR 0xA4FD002CUL
46#define CS4WCR 0xA4FD0030UL
47#define CS5AWCR 0xA4FD0034UL
48#define CS5BWCR 0xA4FD0038UL
49#define CS6AWCR 0xA4FD003CUL
50#define CS6BWCR 0xA4FD0040UL
51
52
53/* usb */
54
55#define PORT_UTRCTL 0xA405012CUL
56#define PORT_UCLKCR_W 0xA40A0008UL
57
58#define INTC_ICR0 0xA414FEE0UL
59#define INTC_ICR1 0xA4140010UL
60#define INTC_ICR2 0xA4140012UL
61
62/* MTD */
63
64#define MPR2_MTD_BOOTLOADER_SIZE 0x00060000UL
65#define MPR2_MTD_KERNEL_SIZE 0x00200000UL
66
67#endif /* __ASM_SH_MAGICPANELR2_H */
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h
index 6bc9bba10105..cb3d46c59eab 100644
--- a/include/asm-sh/page.h
+++ b/include/asm-sh/page.h
@@ -70,14 +70,14 @@ extern void clear_page_nommu(void *to);
70extern void copy_page_nommu(void *to, void *from); 70extern void copy_page_nommu(void *to, void *from);
71#endif 71#endif
72 72
73#if defined(CONFIG_MMU) && (defined(CONFIG_CPU_SH4) || \ 73#if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_MMU) && \
74 defined(CONFIG_SH7705_CACHE_32KB)) 74 (defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB))
75struct page; 75struct page;
76extern void clear_user_page(void *to, unsigned long address, struct page *pg); 76extern void clear_user_page(void *to, unsigned long address, struct page *pg);
77extern void copy_user_page(void *to, void *from, unsigned long address, struct page *pg); 77extern void copy_user_page(void *to, void *from, unsigned long address, struct page *pg);
78extern void __clear_user_page(void *to, void *orig_to); 78extern void __clear_user_page(void *to, void *orig_to);
79extern void __copy_user_page(void *to, void *from, void *orig_to); 79extern void __copy_user_page(void *to, void *from, void *orig_to);
80#elif defined(CONFIG_CPU_SH2) || defined(CONFIG_CPU_SH3) || !defined(CONFIG_MMU) 80#else
81#define clear_user_page(page, vaddr, pg) clear_page(page) 81#define clear_user_page(page, vaddr, pg) clear_page(page)
82#define copy_user_page(to, from, vaddr, pg) copy_page(to, from) 82#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
83#endif 83#endif
@@ -88,6 +88,7 @@ extern void __copy_user_page(void *to, void *from, void *orig_to);
88#ifdef CONFIG_X2TLB 88#ifdef CONFIG_X2TLB
89typedef struct { unsigned long pte_low, pte_high; } pte_t; 89typedef struct { unsigned long pte_low, pte_high; } pte_t;
90typedef struct { unsigned long long pgprot; } pgprot_t; 90typedef struct { unsigned long long pgprot; } pgprot_t;
91typedef struct { unsigned long long pgd; } pgd_t;
91#define pte_val(x) \ 92#define pte_val(x) \
92 ((x).pte_low | ((unsigned long long)(x).pte_high << 32)) 93 ((x).pte_low | ((unsigned long long)(x).pte_high << 32))
93#define __pte(x) \ 94#define __pte(x) \
@@ -95,12 +96,11 @@ typedef struct { unsigned long long pgprot; } pgprot_t;
95#else 96#else
96typedef struct { unsigned long pte_low; } pte_t; 97typedef struct { unsigned long pte_low; } pte_t;
97typedef struct { unsigned long pgprot; } pgprot_t; 98typedef struct { unsigned long pgprot; } pgprot_t;
99typedef struct { unsigned long pgd; } pgd_t;
98#define pte_val(x) ((x).pte_low) 100#define pte_val(x) ((x).pte_low)
99#define __pte(x) ((pte_t) { (x) } ) 101#define __pte(x) ((pte_t) { (x) } )
100#endif 102#endif
101 103
102typedef struct { unsigned long pgd; } pgd_t;
103
104#define pgd_val(x) ((x).pgd) 104#define pgd_val(x) ((x).pgd)
105#define pgprot_val(x) ((x).pgprot) 105#define pgprot_val(x) ((x).pgprot)
106 106
diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h
index e3fae12c0e49..cf0dd2b648c2 100644
--- a/include/asm-sh/pgtable.h
+++ b/include/asm-sh/pgtable.h
@@ -42,13 +42,12 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
42 42
43/* PGD bits */ 43/* PGD bits */
44#define PGDIR_SHIFT (PTE_SHIFT + PTE_BITS) 44#define PGDIR_SHIFT (PTE_SHIFT + PTE_BITS)
45#define PGDIR_BITS (32 - PGDIR_SHIFT)
46#define PGDIR_SIZE (1UL << PGDIR_SHIFT) 45#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
47#define PGDIR_MASK (~(PGDIR_SIZE-1)) 46#define PGDIR_MASK (~(PGDIR_SIZE-1))
48 47
49/* Entries per level */ 48/* Entries per level */
50#define PTRS_PER_PTE (PAGE_SIZE / (1 << PTE_MAGNITUDE)) 49#define PTRS_PER_PTE (PAGE_SIZE / (1 << PTE_MAGNITUDE))
51#define PTRS_PER_PGD (PAGE_SIZE / 4) 50#define PTRS_PER_PGD (PAGE_SIZE / sizeof(pgd_t))
52 51
53#define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE) 52#define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE)
54#define FIRST_USER_ADDRESS 0 53#define FIRST_USER_ADDRESS 0
@@ -100,17 +99,18 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
100#define _PAGE_HW_SHARED 0x002 /* SH-bit : shared among processes */ 99#define _PAGE_HW_SHARED 0x002 /* SH-bit : shared among processes */
101#define _PAGE_DIRTY 0x004 /* D-bit : page changed */ 100#define _PAGE_DIRTY 0x004 /* D-bit : page changed */
102#define _PAGE_CACHABLE 0x008 /* C-bit : cachable */ 101#define _PAGE_CACHABLE 0x008 /* C-bit : cachable */
103#ifndef CONFIG_X2TLB 102#define _PAGE_SZ0 0x010 /* SZ0-bit : Size of page */
104# define _PAGE_SZ0 0x010 /* SZ0-bit : Size of page */ 103#define _PAGE_RW 0x020 /* PR0-bit : write access allowed */
105# define _PAGE_RW 0x020 /* PR0-bit : write access allowed */ 104#define _PAGE_USER 0x040 /* PR1-bit : user space access allowed*/
106# define _PAGE_USER 0x040 /* PR1-bit : user space access allowed*/ 105#define _PAGE_SZ1 0x080 /* SZ1-bit : Size of page (on SH-4) */
107# define _PAGE_SZ1 0x080 /* SZ1-bit : Size of page (on SH-4) */
108#endif
109#define _PAGE_PRESENT 0x100 /* V-bit : page is valid */ 106#define _PAGE_PRESENT 0x100 /* V-bit : page is valid */
110#define _PAGE_PROTNONE 0x200 /* software: if not present */ 107#define _PAGE_PROTNONE 0x200 /* software: if not present */
111#define _PAGE_ACCESSED 0x400 /* software: page referenced */ 108#define _PAGE_ACCESSED 0x400 /* software: page referenced */
112#define _PAGE_FILE _PAGE_WT /* software: pagecache or swap? */ 109#define _PAGE_FILE _PAGE_WT /* software: pagecache or swap? */
113 110
111#define _PAGE_SZ_MASK (_PAGE_SZ0 | _PAGE_SZ1)
112#define _PAGE_PR_MASK (_PAGE_RW | _PAGE_USER)
113
114/* Extended mode bits */ 114/* Extended mode bits */
115#define _PAGE_EXT_ESZ0 0x0010 /* ESZ0-bit: Size of page */ 115#define _PAGE_EXT_ESZ0 0x0010 /* ESZ0-bit: Size of page */
116#define _PAGE_EXT_ESZ1 0x0020 /* ESZ1-bit: Size of page */ 116#define _PAGE_EXT_ESZ1 0x0020 /* ESZ1-bit: Size of page */
@@ -126,11 +126,7 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
126#define _PAGE_EXT_KERN_READ 0x2000 /* EPR5-bit: Kernel space readable */ 126#define _PAGE_EXT_KERN_READ 0x2000 /* EPR5-bit: Kernel space readable */
127 127
128/* Wrapper for extended mode pgprot twiddling */ 128/* Wrapper for extended mode pgprot twiddling */
129#ifdef CONFIG_X2TLB 129#define _PAGE_EXT(x) ((unsigned long long)(x) << 32)
130# define _PAGE_EXT(x) ((unsigned long long)(x) << 32)
131#else
132# define _PAGE_EXT(x) (0)
133#endif
134 130
135/* software: moves to PTEA.TC (Timing Control) */ 131/* software: moves to PTEA.TC (Timing Control) */
136#define _PAGE_PCC_AREA5 0x00000000 /* use BSC registers for area5 */ 132#define _PAGE_PCC_AREA5 0x00000000 /* use BSC registers for area5 */
@@ -146,10 +142,14 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
146#define _PAGE_PCC_ATR16 0x60000001 /* Attribute Memory space, 6 bit bus */ 142#define _PAGE_PCC_ATR16 0x60000001 /* Attribute Memory space, 6 bit bus */
147 143
148/* Mask which drops unused bits from the PTEL value */ 144/* Mask which drops unused bits from the PTEL value */
149#ifdef CONFIG_CPU_SH3 145#if defined(CONFIG_CPU_SH3)
150#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED| \ 146#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED| \
151 _PAGE_FILE | _PAGE_SZ1 | \ 147 _PAGE_FILE | _PAGE_SZ1 | \
152 _PAGE_HW_SHARED) 148 _PAGE_HW_SHARED)
149#elif defined(CONFIG_X2TLB)
150/* Get rid of the legacy PR/SZ bits when using extended mode */
151#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED | \
152 _PAGE_FILE | _PAGE_PR_MASK | _PAGE_SZ_MASK)
153#else 153#else
154#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED | _PAGE_FILE) 154#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED | _PAGE_FILE)
155#endif 155#endif
@@ -212,27 +212,36 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
212 212
213#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \ 213#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
214 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \ 214 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
215 _PAGE_EXT(_PAGE_EXT_USER_READ | \ 215 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
216 _PAGE_EXT_KERN_WRITE | \
217 _PAGE_EXT_USER_READ | \
216 _PAGE_EXT_USER_WRITE)) 218 _PAGE_EXT_USER_WRITE))
217 219
218#define PAGE_EXECREAD __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \ 220#define PAGE_EXECREAD __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
219 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \ 221 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
220 _PAGE_EXT(_PAGE_EXT_USER_EXEC | \ 222 _PAGE_EXT(_PAGE_EXT_KERN_EXEC | \
223 _PAGE_EXT_KERN_READ | \
224 _PAGE_EXT_USER_EXEC | \
221 _PAGE_EXT_USER_READ)) 225 _PAGE_EXT_USER_READ))
222 226
223#define PAGE_COPY PAGE_EXECREAD 227#define PAGE_COPY PAGE_EXECREAD
224 228
225#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \ 229#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
226 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \ 230 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
227 _PAGE_EXT(_PAGE_EXT_USER_READ)) 231 _PAGE_EXT(_PAGE_EXT_KERN_READ | \
232 _PAGE_EXT_USER_READ))
228 233
229#define PAGE_WRITEONLY __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \ 234#define PAGE_WRITEONLY __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
230 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \ 235 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
231 _PAGE_EXT(_PAGE_EXT_USER_WRITE)) 236 _PAGE_EXT(_PAGE_EXT_KERN_WRITE | \
237 _PAGE_EXT_USER_WRITE))
232 238
233#define PAGE_RWX __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \ 239#define PAGE_RWX __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \
234 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \ 240 _PAGE_CACHABLE | _PAGE_FLAGS_HARD | \
235 _PAGE_EXT(_PAGE_EXT_USER_WRITE | \ 241 _PAGE_EXT(_PAGE_EXT_KERN_WRITE | \
242 _PAGE_EXT_KERN_READ | \
243 _PAGE_EXT_KERN_EXEC | \
244 _PAGE_EXT_USER_WRITE | \
236 _PAGE_EXT_USER_READ | \ 245 _PAGE_EXT_USER_READ | \
237 _PAGE_EXT_USER_EXEC)) 246 _PAGE_EXT_USER_EXEC))
238 247
@@ -373,11 +382,15 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
373#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) 382#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval)
374 383
375#define pte_pfn(x) ((unsigned long)(((x).pte_low >> PAGE_SHIFT))) 384#define pte_pfn(x) ((unsigned long)(((x).pte_low >> PAGE_SHIFT)))
376#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
377#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
378 385
379#define pte_none(x) (!pte_val(x)) 386#define pfn_pte(pfn, prot) \
380#define pte_present(x) (pte_val(x) & (_PAGE_PRESENT | _PAGE_PROTNONE)) 387 __pte(((unsigned long long)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
388#define pfn_pmd(pfn, prot) \
389 __pmd(((unsigned long long)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
390
391#define pte_none(x) (!pte_val(x))
392#define pte_present(x) ((x).pte_low & (_PAGE_PRESENT | _PAGE_PROTNONE))
393
381#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0) 394#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
382 395
383#define pmd_none(x) (!pmd_val(x)) 396#define pmd_none(x) (!pmd_val(x))
@@ -392,15 +405,15 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
392 * The following only work if pte_present() is true. 405 * The following only work if pte_present() is true.
393 * Undefined behaviour if not.. 406 * Undefined behaviour if not..
394 */ 407 */
395#define pte_not_present(pte) (!(pte_val(pte) & _PAGE_PRESENT)) 408#define pte_not_present(pte) (!((pte).pte_low & _PAGE_PRESENT))
396#define pte_dirty(pte) (pte_val(pte) & _PAGE_DIRTY) 409#define pte_dirty(pte) ((pte).pte_low & _PAGE_DIRTY)
397#define pte_young(pte) (pte_val(pte) & _PAGE_ACCESSED) 410#define pte_young(pte) ((pte).pte_low & _PAGE_ACCESSED)
398#define pte_file(pte) (pte_val(pte) & _PAGE_FILE) 411#define pte_file(pte) ((pte).pte_low & _PAGE_FILE)
399 412
400#ifdef CONFIG_X2TLB 413#ifdef CONFIG_X2TLB
401#define pte_write(pte) ((pte).pte_high & _PAGE_EXT_USER_WRITE) 414#define pte_write(pte) ((pte).pte_high & _PAGE_EXT_USER_WRITE)
402#else 415#else
403#define pte_write(pte) (pte_val(pte) & _PAGE_RW) 416#define pte_write(pte) ((pte).pte_low & _PAGE_RW)
404#endif 417#endif
405 418
406#define PTE_BIT_FUNC(h,fn,op) \ 419#define PTE_BIT_FUNC(h,fn,op) \
@@ -429,17 +442,10 @@ PTE_BIT_FUNC(low, mkyoung, |= _PAGE_ACCESSED);
429/* 442/*
430 * Macro and implementation to make a page protection as uncachable. 443 * Macro and implementation to make a page protection as uncachable.
431 */ 444 */
432#define pgprot_noncached pgprot_noncached 445#define pgprot_writecombine(prot) \
446 __pgprot(pgprot_val(prot) & ~_PAGE_CACHABLE)
433 447
434static inline pgprot_t pgprot_noncached(pgprot_t _prot) 448#define pgprot_noncached pgprot_writecombine
435{
436 unsigned long prot = pgprot_val(_prot);
437
438 prot &= ~_PAGE_CACHABLE;
439 return __pgprot(prot);
440}
441
442#define pgprot_writecombine(prot) __pgprot(pgprot_val(prot) & ~_PAGE_CACHABLE)
443 449
444/* 450/*
445 * Conversion functions: convert a page and protection to a page entry, 451 * Conversion functions: convert a page and protection to a page entry,
@@ -451,28 +457,33 @@ static inline pgprot_t pgprot_noncached(pgprot_t _prot)
451 457
452static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 458static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
453{ 459{
454 set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) | 460 pte.pte_low &= _PAGE_CHG_MASK;
455 pgprot_val(newprot))); 461 pte.pte_low |= pgprot_val(newprot);
462
463#ifdef CONFIG_X2TLB
464 pte.pte_high |= pgprot_val(newprot) >> 32;
465#endif
466
456 return pte; 467 return pte;
457} 468}
458 469
459#define pmd_page_vaddr(pmd) pmd_val(pmd) 470#define pmd_page_vaddr(pmd) ((unsigned long)pmd_val(pmd))
460#define pmd_page(pmd) (virt_to_page(pmd_val(pmd))) 471#define pmd_page(pmd) (virt_to_page(pmd_val(pmd)))
461 472
462/* to find an entry in a page-table-directory. */ 473/* to find an entry in a page-table-directory. */
463#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) 474#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
464#define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address)) 475#define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address))
465 476
466/* to find an entry in a kernel page-table-directory */ 477/* to find an entry in a kernel page-table-directory */
467#define pgd_offset_k(address) pgd_offset(&init_mm, address) 478#define pgd_offset_k(address) pgd_offset(&init_mm, address)
468 479
469/* Find an entry in the third-level page table.. */ 480/* Find an entry in the third-level page table.. */
470#define pte_index(address) \ 481#define pte_index(address) ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
471 ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
472#define pte_offset_kernel(dir, address) \ 482#define pte_offset_kernel(dir, address) \
473 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) 483 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
474#define pte_offset_map(dir, address) pte_offset_kernel(dir, address) 484#define pte_offset_map(dir, address) pte_offset_kernel(dir, address)
475#define pte_offset_map_nested(dir, address) pte_offset_kernel(dir, address) 485#define pte_offset_map_nested(dir, address) pte_offset_kernel(dir, address)
486
476#define pte_unmap(pte) do { } while (0) 487#define pte_unmap(pte) do { } while (0)
477#define pte_unmap_nested(pte) do { } while (0) 488#define pte_unmap_nested(pte) do { } while (0)
478 489
@@ -480,13 +491,14 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
480#define pte_ERROR(e) \ 491#define pte_ERROR(e) \
481 printk("%s:%d: bad pte %p(%08lx%08lx).\n", __FILE__, __LINE__, \ 492 printk("%s:%d: bad pte %p(%08lx%08lx).\n", __FILE__, __LINE__, \
482 &(e), (e).pte_high, (e).pte_low) 493 &(e), (e).pte_high, (e).pte_low)
494#define pgd_ERROR(e) \
495 printk("%s:%d: bad pgd %016llx.\n", __FILE__, __LINE__, pgd_val(e))
483#else 496#else
484#define pte_ERROR(e) \ 497#define pte_ERROR(e) \
485 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) 498 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e))
486#endif
487
488#define pgd_ERROR(e) \ 499#define pgd_ERROR(e) \
489 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) 500 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
501#endif
490 502
491struct vm_area_struct; 503struct vm_area_struct;
492extern void update_mmu_cache(struct vm_area_struct * vma, 504extern void update_mmu_cache(struct vm_area_struct * vma,
@@ -563,7 +575,8 @@ struct mm_struct;
563extern unsigned int kobjsize(const void *objp); 575extern unsigned int kobjsize(const void *objp);
564#endif /* !CONFIG_MMU */ 576#endif /* !CONFIG_MMU */
565 577
566#if defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB) 578#if !defined(CONFIG_CACHE_OFF) && (defined(CONFIG_CPU_SH4) || \
579 defined(CONFIG_SH7705_CACHE_32KB))
567#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 580#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
568extern pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep); 581extern pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
569#endif 582#endif
diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h
index 26d52174f4b4..4f2922a1979c 100644
--- a/include/asm-sh/processor.h
+++ b/include/asm-sh/processor.h
@@ -45,7 +45,7 @@ enum cpu_type {
45 CPU_SH7705, CPU_SH7706, CPU_SH7707, 45 CPU_SH7705, CPU_SH7706, CPU_SH7707,
46 CPU_SH7708, CPU_SH7708S, CPU_SH7708R, 46 CPU_SH7708, CPU_SH7708S, CPU_SH7708R,
47 CPU_SH7709, CPU_SH7709A, CPU_SH7710, CPU_SH7712, 47 CPU_SH7709, CPU_SH7709A, CPU_SH7710, CPU_SH7712,
48 CPU_SH7729, 48 CPU_SH7720, CPU_SH7729,
49 49
50 /* SH-4 types */ 50 /* SH-4 types */
51 CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R, 51 CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R,
@@ -73,15 +73,10 @@ struct sh_cpuinfo {
73 unsigned long flags; 73 unsigned long flags;
74} __attribute__ ((aligned(SMP_CACHE_BYTES))); 74} __attribute__ ((aligned(SMP_CACHE_BYTES)));
75 75
76extern struct sh_cpuinfo boot_cpu_data;
77
78#ifdef CONFIG_SMP
79extern struct sh_cpuinfo cpu_data[]; 76extern struct sh_cpuinfo cpu_data[];
77#define boot_cpu_data cpu_data[0]
80#define current_cpu_data cpu_data[smp_processor_id()] 78#define current_cpu_data cpu_data[smp_processor_id()]
81#else 79#define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
82#define cpu_data (&boot_cpu_data)
83#define current_cpu_data boot_cpu_data
84#endif
85 80
86/* 81/*
87 * User space process size: 2GB. 82 * User space process size: 2GB.
diff --git a/include/asm-sh/r7780rp.h b/include/asm-sh/r7780rp.h
index 4083b5949928..de37f933aa42 100644
--- a/include/asm-sh/r7780rp.h
+++ b/include/asm-sh/r7780rp.h
@@ -65,24 +65,6 @@
65#define PA_PMR (PA_BCR+0x0900) /* */ 65#define PA_PMR (PA_BCR+0x0900) /* */
66 66
67#define IRLCNTR1 (PA_BCR + 0) /* Interrupt Control Register1 */ 67#define IRLCNTR1 (PA_BCR + 0) /* Interrupt Control Register1 */
68
69#define IRQ_PCISLOT1 65 /* PCI Slot #1 IRQ */
70#define IRQ_PCISLOT2 66 /* PCI Slot #2 IRQ */
71#define IRQ_PCISLOT3 67 /* PCI Slot #3 IRQ */
72#define IRQ_PCISLOT4 68 /* PCI Slot #4 IRQ */
73#define IRQ_TP 2 /* Touch Panel IRQ */
74#define IRQ_SCI1 3 /* SCI1 IRQ */
75#define IRQ_SCI0 4 /* SCI0 IRQ */
76#define IRQ_2SERIAL 5 /* Serial IRQ */
77#define IRQ_RTC 6 /* RTC A / B IRQ */
78#define IRQ_EXTENTION6 7 /* EXT6n IRQ */
79#define IRQ_EXTENTION5 8 /* EXT5n IRQ */
80#define IRQ_EXTENTION4 9 /* EXT4n IRQ */
81#define IRQ_EXTENTION2 10 /* EXT2n IRQ */
82#define IRQ_EXTENTION1 11 /* EXT1n IRQ */
83#define IRQ_ONETH 13 /* On board Ethernet IRQ */
84#define IRQ_PSW 14 /* Push Switch IRQ */
85
86#define IVDR_CK_ON 8 /* iVDR Clock ON */ 68#define IVDR_CK_ON 8 /* iVDR Clock ON */
87 69
88#elif defined(CONFIG_SH_R7780RP) 70#elif defined(CONFIG_SH_R7780RP)
@@ -203,11 +185,24 @@
203#define PA_MMSR (PA_BCR+0x0400) 185#define PA_MMSR (PA_BCR+0x0400)
204 186
205#define IVDR_CK_ON 4 /* iVDR Clock ON */ 187#define IVDR_CK_ON 4 /* iVDR Clock ON */
188#endif
206 189
190#define HL_FPGA_IRQ_BASE 200
191#define HL_NR_IRL 15
192
193#define IRQ_AX88796 (HL_FPGA_IRQ_BASE + 0)
194#define IRQ_CF (HL_FPGA_IRQ_BASE + 1)
195#ifndef IRQ_PSW
196#define IRQ_PSW (HL_FPGA_IRQ_BASE + 2)
207#endif 197#endif
198#define IRQ_EXT1 (HL_FPGA_IRQ_BASE + 3)
199#define IRQ_EXT4 (HL_FPGA_IRQ_BASE + 4)
208 200
209void make_r7780rp_irq(unsigned int irq); 201void make_r7780rp_irq(unsigned int irq);
210void highlander_init_irq(void); 202
203unsigned char *highlander_init_irq_r7780mp(void);
204unsigned char *highlander_init_irq_r7780rp(void);
205unsigned char *highlander_init_irq_r7785rp(void);
211 206
212#define __IO_PREFIX r7780rp 207#define __IO_PREFIX r7780rp
213#include <asm/io_generic.h> 208#include <asm/io_generic.h>
diff --git a/include/asm-sh/rtc.h b/include/asm-sh/rtc.h
index 91aacc96151b..858da99d37e0 100644
--- a/include/asm-sh/rtc.h
+++ b/include/asm-sh/rtc.h
@@ -5,4 +5,10 @@ extern void (*board_time_init)(void);
5extern void (*rtc_sh_get_time)(struct timespec *); 5extern void (*rtc_sh_get_time)(struct timespec *);
6extern int (*rtc_sh_set_time)(const time_t); 6extern int (*rtc_sh_set_time)(const time_t);
7 7
8#define RTC_CAP_4_DIGIT_YEAR (1 << 0)
9
10struct sh_rtc_platform_info {
11 unsigned long capabilities;
12};
13
8#endif /* _ASM_RTC_H */ 14#endif /* _ASM_RTC_H */
diff --git a/include/asm-sh/rts7751r2d.h b/include/asm-sh/rts7751r2d.h
index 5d7800aa31b5..83b9c111f171 100644
--- a/include/asm-sh/rts7751r2d.h
+++ b/include/asm-sh/rts7751r2d.h
@@ -9,7 +9,7 @@
9 * Renesas Technology Sales RTS7751R2D support 9 * Renesas Technology Sales RTS7751R2D support
10 */ 10 */
11 11
12/* Box specific addresses. */ 12/* Board specific addresses. */
13 13
14#define PA_BCR 0xa4000000 /* FPGA */ 14#define PA_BCR 0xa4000000 /* FPGA */
15#define PA_IRLMON 0xa4000002 /* Interrupt Status control */ 15#define PA_IRLMON 0xa4000002 /* Interrupt Status control */
@@ -20,19 +20,19 @@
20#define PA_RTCCE 0xa400000c /* RTC(9701) Enable control */ 20#define PA_RTCCE 0xa400000c /* RTC(9701) Enable control */
21#define PA_PCICD 0xa400000e /* PCI Extention detect control */ 21#define PA_PCICD 0xa400000e /* PCI Extention detect control */
22#define PA_VOYAGERRTS 0xa4000020 /* VOYAGER Reset control */ 22#define PA_VOYAGERRTS 0xa4000020 /* VOYAGER Reset control */
23#if defined(CONFIG_RTS7751R2D_REV11) 23
24#define PA_AXRST 0xa4000022 /* AX_LAN Reset control */ 24#define PA_R2D1_AXRST 0xa4000022 /* AX_LAN Reset control */
25#define PA_CFRST 0xa4000024 /* CF Reset control */ 25#define PA_R2D1_CFRST 0xa4000024 /* CF Reset control */
26#define PA_ADMRTS 0xa4000026 /* SD Reset control */ 26#define PA_R2D1_ADMRTS 0xa4000026 /* SD Reset control */
27#define PA_EXTRST 0xa4000028 /* Extention Reset control */ 27#define PA_R2D1_EXTRST 0xa4000028 /* Extention Reset control */
28#define PA_CFCDINTCLR 0xa400002a /* CF Insert Interrupt clear */ 28#define PA_R2D1_CFCDINTCLR 0xa400002a /* CF Insert Interrupt clear */
29#else 29
30#define PA_CFRST 0xa4000022 /* CF Reset control */ 30#define PA_R2DPLUS_CFRST 0xa4000022 /* CF Reset control */
31#define PA_ADMRTS 0xa4000024 /* SD Reset control */ 31#define PA_R2DPLUS_ADMRTS 0xa4000024 /* SD Reset control */
32#define PA_EXTRST 0xa4000026 /* Extention Reset control */ 32#define PA_R2DPLUS_EXTRST 0xa4000026 /* Extention Reset control */
33#define PA_CFCDINTCLR 0xa4000028 /* CF Insert Interrupt clear */ 33#define PA_R2DPLUS_CFCDINTCLR 0xa4000028 /* CF Insert Interrupt clear */
34#define PA_KEYCTLCLR 0xa400002a /* Key Interrupt clear */ 34#define PA_R2DPLUS_KEYCTLCLR 0xa400002a /* Key Interrupt clear */
35#endif 35
36#define PA_POWOFF 0xa4000030 /* Board Power OFF control */ 36#define PA_POWOFF 0xa4000030 /* Board Power OFF control */
37#define PA_VERREG 0xa4000032 /* FPGA Version Register */ 37#define PA_VERREG 0xa4000032 /* FPGA Version Register */
38#define PA_INPORT 0xa4000034 /* KEY Input Port control */ 38#define PA_INPORT 0xa4000034 /* KEY Input Port control */
@@ -46,27 +46,22 @@
46 46
47#define IRLCNTR1 (PA_BCR + 0) /* Interrupt Control Register1 */ 47#define IRLCNTR1 (PA_BCR + 0) /* Interrupt Control Register1 */
48 48
49#if defined(CONFIG_RTS7751R2D_REV11) 49#define R2D_FPGA_IRQ_BASE 100
50#define IRQ_PCIETH 0 /* PCI Ethernet IRQ */ 50
51#define IRQ_CFCARD 1 /* CF Card IRQ */ 51#define IRQ_VOYAGER (R2D_FPGA_IRQ_BASE + 0)
52#define IRQ_CFINST 2 /* CF Card Insert IRQ */ 52#define IRQ_EXT (R2D_FPGA_IRQ_BASE + 1)
53#define IRQ_PCMCIA 3 /* PCMCIA IRQ */ 53#define IRQ_TP (R2D_FPGA_IRQ_BASE + 2)
54#define IRQ_VOYAGER 4 /* VOYAGER IRQ */ 54#define IRQ_RTC_T (R2D_FPGA_IRQ_BASE + 3)
55#define IRQ_ONETH 5 /* On board Ethernet IRQ */ 55#define IRQ_RTC_A (R2D_FPGA_IRQ_BASE + 4)
56#else 56#define IRQ_SDCARD (R2D_FPGA_IRQ_BASE + 5)
57#define IRQ_KEYIN 0 /* Key Input IRQ */ 57#define IRQ_CF_CD (R2D_FPGA_IRQ_BASE + 6)
58#define IRQ_PCIETH 1 /* PCI Ethernet IRQ */ 58#define IRQ_CF_IDE (R2D_FPGA_IRQ_BASE + 7)
59#define IRQ_CFCARD 2 /* CF Card IRQ */ 59#define IRQ_AX88796 (R2D_FPGA_IRQ_BASE + 8)
60#define IRQ_CFINST 3 /* CF Card Insert IRQ */ 60#define IRQ_KEY (R2D_FPGA_IRQ_BASE + 9)
61#define IRQ_PCMCIA 4 /* PCMCIA IRQ */ 61#define IRQ_PCI_INTA (R2D_FPGA_IRQ_BASE + 10)
62#define IRQ_VOYAGER 5 /* VOYAGER IRQ */ 62#define IRQ_PCI_INTB (R2D_FPGA_IRQ_BASE + 11)
63#endif 63#define IRQ_PCI_INTC (R2D_FPGA_IRQ_BASE + 12)
64#define IRQ_RTCALM 6 /* RTC Alarm IRQ */ 64#define IRQ_PCI_INTD (R2D_FPGA_IRQ_BASE + 13)
65#define IRQ_RTCTIME 7 /* RTC Timer IRQ */
66#define IRQ_SDCARD 8 /* SD Card IRQ */
67#define IRQ_PCISLOT1 9 /* PCI Slot #1 IRQ */
68#define IRQ_PCISLOT2 10 /* PCI Slot #2 IRQ */
69#define IRQ_EXTENTION 11 /* EXTn IRQ */
70 65
71/* arch/sh/boards/renesas/rts7751r2d/irq.c */ 66/* arch/sh/boards/renesas/rts7751r2d/irq.c */
72void init_rts7751r2d_IRQ(void); 67void init_rts7751r2d_IRQ(void);
diff --git a/include/asm-sh/sections.h b/include/asm-sh/sections.h
index 2a696b8ee4f5..bd9cbc967c2a 100644
--- a/include/asm-sh/sections.h
+++ b/include/asm-sh/sections.h
@@ -4,6 +4,7 @@
4#include <asm-generic/sections.h> 4#include <asm-generic/sections.h>
5 5
6extern long __machvec_start, __machvec_end; 6extern long __machvec_start, __machvec_end;
7extern char _ebss[];
7 8
8#endif /* __ASM_SH_SECTIONS_H */ 9#endif /* __ASM_SH_SECTIONS_H */
9 10
diff --git a/include/asm-sh/sh03/io.h b/include/asm-sh/sh03/io.h
index 4ff1eb900301..c39c785bba94 100644
--- a/include/asm-sh/sh03/io.h
+++ b/include/asm-sh/sh03/io.h
@@ -11,22 +11,13 @@
11 11
12#include <linux/time.h> 12#include <linux/time.h>
13 13
14#define INTC_IPRD 0xffd00010UL
15
16#define IRL0_IRQ 2 14#define IRL0_IRQ 2
17#define IRL0_IPR_POS 3
18#define IRL0_PRIORITY 13 15#define IRL0_PRIORITY 13
19
20#define IRL1_IRQ 5 16#define IRL1_IRQ 5
21#define IRL1_IPR_POS 2
22#define IRL1_PRIORITY 10 17#define IRL1_PRIORITY 10
23
24#define IRL2_IRQ 8 18#define IRL2_IRQ 8
25#define IRL2_IPR_POS 1
26#define IRL2_PRIORITY 7 19#define IRL2_PRIORITY 7
27
28#define IRL3_IRQ 11 20#define IRL3_IRQ 11
29#define IRL3_IPR_POS 0
30#define IRL3_PRIORITY 4 21#define IRL3_PRIORITY 4
31 22
32void heartbeat_sh03(void); 23void heartbeat_sh03(void);
diff --git a/include/asm-sh/smp.h b/include/asm-sh/smp.h
index b99ca786c0c1..9c8d34b07ebf 100644
--- a/include/asm-sh/smp.h
+++ b/include/asm-sh/smp.h
@@ -1,12 +1,3 @@
1/*
2 * include/asm-sh/smp.h
3 *
4 * Copyright (C) 2002, 2003 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive for
8 * more details.
9 */
10#ifndef __ASM_SH_SMP_H 1#ifndef __ASM_SH_SMP_H
11#define __ASM_SH_SMP_H 2#define __ASM_SH_SMP_H
12 3
@@ -20,6 +11,15 @@
20#include <asm/current.h> 11#include <asm/current.h>
21 12
22#define raw_smp_processor_id() (current_thread_info()->cpu) 13#define raw_smp_processor_id() (current_thread_info()->cpu)
14#define hard_smp_processor_id() plat_smp_processor_id()
15
16/* Map from cpu id to sequential logical cpu number. */
17extern int __cpu_number_map[NR_CPUS];
18#define cpu_number_map(cpu) __cpu_number_map[cpu]
19
20/* The reverse map from sequential logical cpu number to cpu id. */
21extern int __cpu_logical_map[NR_CPUS];
22#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
23 23
24/* I've no idea what the real meaning of this is */ 24/* I've no idea what the real meaning of this is */
25#define PROC_CHANGE_PENALTY 20 25#define PROC_CHANGE_PENALTY 20
@@ -35,10 +35,22 @@ struct smp_fn_call_struct {
35 35
36extern struct smp_fn_call_struct smp_fn_call; 36extern struct smp_fn_call_struct smp_fn_call;
37 37
38#define SMP_MSG_RESCHEDULE 0x0001 38#define SMP_MSG_FUNCTION 0
39#define SMP_MSG_RESCHEDULE 1
40#define SMP_MSG_NR 2
39 41
40#endif /* CONFIG_SMP */ 42void plat_smp_setup(void);
43void plat_prepare_cpus(unsigned int max_cpus);
44int plat_smp_processor_id(void);
45void plat_start_cpu(unsigned int cpu, unsigned long entry_point);
46void plat_send_ipi(unsigned int cpu, unsigned int message);
47int plat_register_ipi_handler(unsigned int message,
48 void (*handler)(void *), void *arg);
49
50#else
41 51
42#define hard_smp_processor_id() (0) 52#define hard_smp_processor_id() (0)
43 53
54#endif /* CONFIG_SMP */
55
44#endif /* __ASM_SH_SMP_H */ 56#endif /* __ASM_SH_SMP_H */
diff --git a/include/asm-sh/snapgear.h b/include/asm-sh/snapgear.h
index 3554e3a74e99..042d95f51c4d 100644
--- a/include/asm-sh/snapgear.h
+++ b/include/asm-sh/snapgear.h
@@ -19,20 +19,16 @@
19 * is the interrupt :-) 19 * is the interrupt :-)
20 */ 20 */
21 21
22#define IRL0_IRQ 2 22#define IRL0_IRQ 2
23#define IRL0_IPR_POS 3
24#define IRL0_PRIORITY 13 23#define IRL0_PRIORITY 13
25 24
26#define IRL1_IRQ 5 25#define IRL1_IRQ 5
27#define IRL1_IPR_POS 2
28#define IRL1_PRIORITY 10 26#define IRL1_PRIORITY 10
29 27
30#define IRL2_IRQ 8 28#define IRL2_IRQ 8
31#define IRL2_IPR_POS 1
32#define IRL2_PRIORITY 7 29#define IRL2_PRIORITY 7
33 30
34#define IRL3_IRQ 11 31#define IRL3_IRQ 11
35#define IRL3_IPR_POS 0
36#define IRL3_PRIORITY 4 32#define IRL3_PRIORITY 4
37#endif 33#endif
38 34
diff --git a/include/asm-sh/spinlock.h b/include/asm-sh/spinlock.h
index 92f6e2008b2e..e793181d64da 100644
--- a/include/asm-sh/spinlock.h
+++ b/include/asm-sh/spinlock.h
@@ -2,6 +2,7 @@
2 * include/asm-sh/spinlock.h 2 * include/asm-sh/spinlock.h
3 * 3 *
4 * Copyright (C) 2002, 2003 Paul Mundt 4 * Copyright (C) 2002, 2003 Paul Mundt
5 * Copyright (C) 2006, 2007 Akio Idehara
5 * 6 *
6 * This file is subject to the terms and conditions of the GNU General Public 7 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive 8 * License. See the file "COPYING" in the main directory of this archive
@@ -10,17 +11,22 @@
10#ifndef __ASM_SH_SPINLOCK_H 11#ifndef __ASM_SH_SPINLOCK_H
11#define __ASM_SH_SPINLOCK_H 12#define __ASM_SH_SPINLOCK_H
12 13
13#include <asm/atomic.h> 14/*
14#include <asm/spinlock_types.h> 15 * The only locking implemented here uses SH-4A opcodes. For others,
16 * split this out as per atomic-*.h.
17 */
18#ifndef CONFIG_CPU_SH4A
19#error "Need movli.l/movco.l for spinlocks"
20#endif
15 21
16/* 22/*
17 * Your basic SMP spinlocks, allowing only a single CPU anywhere 23 * Your basic SMP spinlocks, allowing only a single CPU anywhere
18 */ 24 */
19 25
20#define __raw_spin_is_locked(x) ((x)->lock != 0) 26#define __raw_spin_is_locked(x) ((x)->lock <= 0)
21#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock) 27#define __raw_spin_lock_flags(lock, flags) __raw_spin_lock(lock)
22#define __raw_spin_unlock_wait(x) \ 28#define __raw_spin_unlock_wait(x) \
23 do { cpu_relax(); } while (__raw_spin_is_locked(x)) 29 do { cpu_relax(); } while ((x)->lock)
24 30
25/* 31/*
26 * Simple spin lock operations. There are two variants, one clears IRQ's 32 * Simple spin lock operations. There are two variants, one clears IRQ's
@@ -30,12 +36,19 @@
30 */ 36 */
31static inline void __raw_spin_lock(raw_spinlock_t *lock) 37static inline void __raw_spin_lock(raw_spinlock_t *lock)
32{ 38{
39 unsigned long tmp;
40 unsigned long oldval;
41
33 __asm__ __volatile__ ( 42 __asm__ __volatile__ (
34 "1:\n\t" 43 "1: \n\t"
35 "tas.b @%0\n\t" 44 "movli.l @%2, %0 ! __raw_spin_lock \n\t"
36 "bf/s 1b\n\t" 45 "mov %0, %1 \n\t"
37 "nop\n\t" 46 "mov #0, %0 \n\t"
38 : "=r" (lock->lock) 47 "movco.l %0, @%2 \n\t"
48 "bf 1b \n\t"
49 "cmp/pl %1 \n\t"
50 "bf 1b \n\t"
51 : "=&z" (tmp), "=&r" (oldval)
39 : "r" (&lock->lock) 52 : "r" (&lock->lock)
40 : "t", "memory" 53 : "t", "memory"
41 ); 54 );
@@ -43,12 +56,36 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock)
43 56
44static inline void __raw_spin_unlock(raw_spinlock_t *lock) 57static inline void __raw_spin_unlock(raw_spinlock_t *lock)
45{ 58{
46 //assert_spin_locked(lock); 59 unsigned long tmp;
47 60
48 lock->lock = 0; 61 __asm__ __volatile__ (
62 "mov #1, %0 ! __raw_spin_unlock \n\t"
63 "mov.l %0, @%1 \n\t"
64 : "=&z" (tmp)
65 : "r" (&lock->lock)
66 : "t", "memory"
67 );
49} 68}
50 69
51#define __raw_spin_trylock(x) (!test_and_set_bit(0, &(x)->lock)) 70static inline int __raw_spin_trylock(raw_spinlock_t *lock)
71{
72 unsigned long tmp, oldval;
73
74 __asm__ __volatile__ (
75 "1: \n\t"
76 "movli.l @%2, %0 ! __raw_spin_trylock \n\t"
77 "mov %0, %1 \n\t"
78 "mov #0, %0 \n\t"
79 "movco.l %0, @%2 \n\t"
80 "bf 1b \n\t"
81 "synco \n\t"
82 : "=&z" (tmp), "=&r" (oldval)
83 : "r" (&lock->lock)
84 : "t", "memory"
85 );
86
87 return oldval;
88}
52 89
53/* 90/*
54 * Read-write spinlocks, allowing multiple readers but only one writer. 91 * Read-write spinlocks, allowing multiple readers but only one writer.
@@ -59,58 +96,124 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock)
59 * read-locks. 96 * read-locks.
60 */ 97 */
61 98
99/**
100 * read_can_lock - would read_trylock() succeed?
101 * @lock: the rwlock in question.
102 */
103#define __raw_read_can_lock(x) ((x)->lock > 0)
104
105/**
106 * write_can_lock - would write_trylock() succeed?
107 * @lock: the rwlock in question.
108 */
109#define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS)
110
62static inline void __raw_read_lock(raw_rwlock_t *rw) 111static inline void __raw_read_lock(raw_rwlock_t *rw)
63{ 112{
64 __raw_spin_lock(&rw->lock); 113 unsigned long tmp;
65
66 atomic_inc(&rw->counter);
67 114
68 __raw_spin_unlock(&rw->lock); 115 __asm__ __volatile__ (
116 "1: \n\t"
117 "movli.l @%1, %0 ! __raw_read_lock \n\t"
118 "cmp/pl %0 \n\t"
119 "bf 1b \n\t"
120 "add #-1, %0 \n\t"
121 "movco.l %0, @%1 \n\t"
122 "bf 1b \n\t"
123 : "=&z" (tmp)
124 : "r" (&rw->lock)
125 : "t", "memory"
126 );
69} 127}
70 128
71static inline void __raw_read_unlock(raw_rwlock_t *rw) 129static inline void __raw_read_unlock(raw_rwlock_t *rw)
72{ 130{
73 __raw_spin_lock(&rw->lock); 131 unsigned long tmp;
74
75 atomic_dec(&rw->counter);
76 132
77 __raw_spin_unlock(&rw->lock); 133 __asm__ __volatile__ (
134 "1: \n\t"
135 "movli.l @%1, %0 ! __raw_read_unlock \n\t"
136 "add #1, %0 \n\t"
137 "movco.l %0, @%1 \n\t"
138 "bf 1b \n\t"
139 : "=&z" (tmp)
140 : "r" (&rw->lock)
141 : "t", "memory"
142 );
78} 143}
79 144
80static inline void __raw_write_lock(raw_rwlock_t *rw) 145static inline void __raw_write_lock(raw_rwlock_t *rw)
81{ 146{
82 __raw_spin_lock(&rw->lock); 147 unsigned long tmp;
83 atomic_set(&rw->counter, -1); 148
149 __asm__ __volatile__ (
150 "1: \n\t"
151 "movli.l @%1, %0 ! __raw_write_lock \n\t"
152 "cmp/hs %2, %0 \n\t"
153 "bf 1b \n\t"
154 "sub %2, %0 \n\t"
155 "movco.l %0, @%1 \n\t"
156 "bf 1b \n\t"
157 : "=&z" (tmp)
158 : "r" (&rw->lock), "r" (RW_LOCK_BIAS)
159 : "t", "memory"
160 );
84} 161}
85 162
86static inline void __raw_write_unlock(raw_rwlock_t *rw) 163static inline void __raw_write_unlock(raw_rwlock_t *rw)
87{ 164{
88 atomic_set(&rw->counter, 0); 165 __asm__ __volatile__ (
89 __raw_spin_unlock(&rw->lock); 166 "mov.l %1, @%0 ! __raw_write_unlock \n\t"
167 :
168 : "r" (&rw->lock), "r" (RW_LOCK_BIAS)
169 : "t", "memory"
170 );
90} 171}
91 172
92static inline int __raw_write_can_lock(raw_rwlock_t *rw) 173static inline int __raw_read_trylock(raw_rwlock_t *rw)
93{ 174{
94 return (atomic_read(&rw->counter) == RW_LOCK_BIAS); 175 unsigned long tmp, oldval;
95}
96 176
97static inline int __raw_read_trylock(raw_rwlock_t *lock) 177 __asm__ __volatile__ (
98{ 178 "1: \n\t"
99 atomic_t *count = (atomic_t*)lock; 179 "movli.l @%2, %0 ! __raw_read_trylock \n\t"
100 if (atomic_dec_return(count) >= 0) 180 "mov %0, %1 \n\t"
101 return 1; 181 "cmp/pl %0 \n\t"
102 atomic_inc(count); 182 "bf 2f \n\t"
103 return 0; 183 "add #-1, %0 \n\t"
184 "movco.l %0, @%2 \n\t"
185 "bf 1b \n\t"
186 "2: \n\t"
187 "synco \n\t"
188 : "=&z" (tmp), "=&r" (oldval)
189 : "r" (&rw->lock)
190 : "t", "memory"
191 );
192
193 return (oldval > 0);
104} 194}
105 195
106static inline int __raw_write_trylock(raw_rwlock_t *rw) 196static inline int __raw_write_trylock(raw_rwlock_t *rw)
107{ 197{
108 if (atomic_sub_and_test(RW_LOCK_BIAS, &rw->counter)) 198 unsigned long tmp, oldval;
109 return 1; 199
110 200 __asm__ __volatile__ (
111 atomic_add(RW_LOCK_BIAS, &rw->counter); 201 "1: \n\t"
202 "movli.l @%2, %0 ! __raw_write_trylock \n\t"
203 "mov %0, %1 \n\t"
204 "cmp/hs %3, %0 \n\t"
205 "bf 2f \n\t"
206 "sub %3, %0 \n\t"
207 "2: \n\t"
208 "movco.l %0, @%2 \n\t"
209 "bf 1b \n\t"
210 "synco \n\t"
211 : "=&z" (tmp), "=&r" (oldval)
212 : "r" (&rw->lock), "r" (RW_LOCK_BIAS)
213 : "t", "memory"
214 );
112 215
113 return 0; 216 return (oldval > (RW_LOCK_BIAS - 1));
114} 217}
115 218
116#define _raw_spin_relax(lock) cpu_relax() 219#define _raw_spin_relax(lock) cpu_relax()
diff --git a/include/asm-sh/spinlock_types.h b/include/asm-sh/spinlock_types.h
index 5c58134f2c4e..b4d244e7b60c 100644
--- a/include/asm-sh/spinlock_types.h
+++ b/include/asm-sh/spinlock_types.h
@@ -6,19 +6,16 @@
6#endif 6#endif
7 7
8typedef struct { 8typedef struct {
9 volatile unsigned long lock; 9 volatile unsigned int lock;
10} raw_spinlock_t; 10} raw_spinlock_t;
11 11
12#define __RAW_SPIN_LOCK_UNLOCKED { 1 } 12#define __RAW_SPIN_LOCK_UNLOCKED { 1 }
13
14#include <asm/atomic.h>
15 13
16typedef struct { 14typedef struct {
17 raw_spinlock_t lock; 15 volatile unsigned int lock;
18 atomic_t counter;
19} raw_rwlock_t; 16} raw_rwlock_t;
20 17
21#define RW_LOCK_BIAS 0x01000000 18#define RW_LOCK_BIAS 0x01000000
22#define __RAW_RW_LOCK_UNLOCKED { { 0 }, { RW_LOCK_BIAS } } 19#define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS }
23 20
24#endif 21#endif
diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h
index 245042537205..9d849e6df268 100644
--- a/include/asm-sh/system.h
+++ b/include/asm-sh/system.h
@@ -266,6 +266,7 @@ void disable_hlt(void);
266void enable_hlt(void); 266void enable_hlt(void);
267 267
268void default_idle(void); 268void default_idle(void);
269void per_cpu_trap_init(void);
269 270
270asmlinkage void break_point_trap(void); 271asmlinkage void break_point_trap(void);
271asmlinkage void debug_trap_handler(unsigned long r4, unsigned long r5, 272asmlinkage void debug_trap_handler(unsigned long r4, unsigned long r5,
diff --git a/include/asm-sh/voyagergx.h b/include/asm-sh/voyagergx.h
index 64c936b22715..d825596562df 100644
--- a/include/asm-sh/voyagergx.h
+++ b/include/asm-sh/voyagergx.h
@@ -27,13 +27,35 @@
27#define VOYAGER_UART_BASE (0x30000 + VOYAGER_BASE) 27#define VOYAGER_UART_BASE (0x30000 + VOYAGER_BASE)
28#define VOYAGER_AC97_BASE (0xa0000 + VOYAGER_BASE) 28#define VOYAGER_AC97_BASE (0xa0000 + VOYAGER_BASE)
29 29
30#define VOYAGER_IRQ_NUM 32 30#define VOYAGER_IRQ_NUM 26
31#define VOYAGER_IRQ_BASE 50 31#define VOYAGER_IRQ_BASE 200
32#define VOYAGER_USBH_IRQ VOYAGER_IRQ_BASE + 6 32
33#define VOYAGER_8051_IRQ VOYAGER_IRQ_BASE + 10 33#define IRQ_SM501_UP (VOYAGER_IRQ_BASE + 0)
34#define VOYAGER_UART0_IRQ VOYAGER_IRQ_BASE + 12 34#define IRQ_SM501_G54 (VOYAGER_IRQ_BASE + 1)
35#define VOYAGER_UART1_IRQ VOYAGER_IRQ_BASE + 13 35#define IRQ_SM501_G53 (VOYAGER_IRQ_BASE + 2)
36#define VOYAGER_AC97_IRQ VOYAGER_IRQ_BASE + 17 36#define IRQ_SM501_G52 (VOYAGER_IRQ_BASE + 3)
37#define IRQ_SM501_G51 (VOYAGER_IRQ_BASE + 4)
38#define IRQ_SM501_G50 (VOYAGER_IRQ_BASE + 5)
39#define IRQ_SM501_G49 (VOYAGER_IRQ_BASE + 6)
40#define IRQ_SM501_G48 (VOYAGER_IRQ_BASE + 7)
41#define IRQ_SM501_I2C (VOYAGER_IRQ_BASE + 8)
42#define IRQ_SM501_PW (VOYAGER_IRQ_BASE + 9)
43#define IRQ_SM501_DMA (VOYAGER_IRQ_BASE + 10)
44#define IRQ_SM501_PCI (VOYAGER_IRQ_BASE + 11)
45#define IRQ_SM501_I2S (VOYAGER_IRQ_BASE + 12)
46#define IRQ_SM501_AC (VOYAGER_IRQ_BASE + 13)
47#define IRQ_SM501_US (VOYAGER_IRQ_BASE + 14)
48#define IRQ_SM501_U1 (VOYAGER_IRQ_BASE + 15)
49#define IRQ_SM501_U0 (VOYAGER_IRQ_BASE + 16)
50#define IRQ_SM501_CV (VOYAGER_IRQ_BASE + 17)
51#define IRQ_SM501_MC (VOYAGER_IRQ_BASE + 18)
52#define IRQ_SM501_S1 (VOYAGER_IRQ_BASE + 19)
53#define IRQ_SM501_S0 (VOYAGER_IRQ_BASE + 20)
54#define IRQ_SM501_UH (VOYAGER_IRQ_BASE + 21)
55#define IRQ_SM501_2D (VOYAGER_IRQ_BASE + 22)
56#define IRQ_SM501_ZD (VOYAGER_IRQ_BASE + 23)
57#define IRQ_SM501_PV (VOYAGER_IRQ_BASE + 24)
58#define IRQ_SM501_CI (VOYAGER_IRQ_BASE + 25)
37 59
38/* ----- MISC controle register ------------------------------ */ 60/* ----- MISC controle register ------------------------------ */
39#define MISC_CTRL (0x000004 + VOYAGER_BASE) 61#define MISC_CTRL (0x000004 + VOYAGER_BASE)
@@ -313,4 +335,7 @@
313void *voyagergx_consistent_alloc(struct device *, size_t, dma_addr_t *, gfp_t); 335void *voyagergx_consistent_alloc(struct device *, size_t, dma_addr_t *, gfp_t);
314int voyagergx_consistent_free(struct device *, size_t, void *, dma_addr_t); 336int voyagergx_consistent_free(struct device *, size_t, void *, dma_addr_t);
315 337
338/* arch/sh/cchips/voyagergx/irq.c */
339void setup_voyagergx_irq(void);
340
316#endif /* _VOYAGER_GX_REG_H */ 341#endif /* _VOYAGER_GX_REG_H */
diff --git a/include/asm-sh64/gpio.h b/include/asm-sh64/gpio.h
new file mode 100644
index 000000000000..6bc5a13d8415
--- /dev/null
+++ b/include/asm-sh64/gpio.h
@@ -0,0 +1,8 @@
1#ifndef __ASM_SH64_GPIO_H
2#define __ASM_SH64_GPIO_H
3
4/*
5 * This is just a stub, so that every arch using sh-sci has a gpio.h
6 */
7
8#endif /* __ASM_SH64_GPIO_H */
diff --git a/include/asm-sh64/io.h b/include/asm-sh64/io.h
index 1f37b6931922..3de3ad99f457 100644
--- a/include/asm-sh64/io.h
+++ b/include/asm-sh64/io.h
@@ -119,6 +119,13 @@ void insw(unsigned long port, void *addr, unsigned long count);
119void outsl(unsigned long port, const void *addr, unsigned long count); 119void outsl(unsigned long port, const void *addr, unsigned long count);
120void insl(unsigned long port, void *addr, unsigned long count); 120void insl(unsigned long port, void *addr, unsigned long count);
121 121
122#define inb_p(addr) inb(addr)
123#define inw_p(addr) inw(addr)
124#define inl_p(addr) inl(addr)
125#define outb_p(x,addr) outb(x,addr)
126#define outw_p(x,addr) outw(x,addr)
127#define outl_p(x,addr) outl(x,addr)
128
122#define __raw_readb readb 129#define __raw_readb readb
123#define __raw_readw readw 130#define __raw_readw readw
124#define __raw_readl readl 131#define __raw_readl readl
diff --git a/include/asm-sparc/irqflags.h b/include/asm-sparc/irqflags.h
new file mode 100644
index 000000000000..db398fb32826
--- /dev/null
+++ b/include/asm-sparc/irqflags.h
@@ -0,0 +1,39 @@
1/*
2 * include/asm-sparc/irqflags.h
3 *
4 * IRQ flags handling
5 *
6 * This file gets included from lowlevel asm headers too, to provide
7 * wrapped versions of the local_irq_*() APIs, based on the
8 * raw_local_irq_*() functions from the lowlevel headers.
9 */
10#ifndef _ASM_IRQFLAGS_H
11#define _ASM_IRQFLAGS_H
12
13#ifndef __ASSEMBLY__
14
15extern void raw_local_irq_restore(unsigned long);
16extern unsigned long __raw_local_irq_save(void);
17extern void raw_local_irq_enable(void);
18
19static inline unsigned long getipl(void)
20{
21 unsigned long retval;
22
23 __asm__ __volatile__("rd %%psr, %0" : "=r" (retval));
24 return retval;
25}
26
27#define raw_local_save_flags(flags) ((flags) = getipl())
28#define raw_local_irq_save(flags) ((flags) = __raw_local_irq_save())
29#define raw_local_irq_disable() ((void) __raw_local_irq_save())
30#define raw_irqs_disabled() ((getipl() & PSR_PIL) != 0)
31
32static inline int raw_irqs_disabled_flags(unsigned long flags)
33{
34 return ((flags & PSR_PIL) != 0);
35}
36
37#endif /* (__ASSEMBLY__) */
38
39#endif /* !(_ASM_IRQFLAGS_H) */
diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h
index d1a2572e3f55..8c259de02614 100644
--- a/include/asm-sparc/system.h
+++ b/include/asm-sparc/system.h
@@ -15,6 +15,8 @@
15 15
16#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
17 17
18#include <linux/irqflags.h>
19
18/* 20/*
19 * Sparc (general) CPU types 21 * Sparc (general) CPU types
20 */ 22 */
@@ -164,26 +166,6 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
164 "o0", "o1", "o2", "o3", "o7"); \ 166 "o0", "o1", "o2", "o3", "o7"); \
165 } while(0) 167 } while(0)
166 168
167/*
168 * Changing the IRQ level on the Sparc.
169 */
170extern void local_irq_restore(unsigned long);
171extern unsigned long __local_irq_save(void);
172extern void local_irq_enable(void);
173
174static inline unsigned long getipl(void)
175{
176 unsigned long retval;
177
178 __asm__ __volatile__("rd %%psr, %0" : "=r" (retval));
179 return retval;
180}
181
182#define local_save_flags(flags) ((flags) = getipl())
183#define local_irq_save(flags) ((flags) = __local_irq_save())
184#define local_irq_disable() ((void) __local_irq_save())
185#define irqs_disabled() ((getipl() & PSR_PIL) != 0)
186
187/* XXX Change this if we ever use a PSO mode kernel. */ 169/* XXX Change this if we ever use a PSO mode kernel. */
188#define mb() __asm__ __volatile__ ("" : : : "memory") 170#define mb() __asm__ __volatile__ ("" : : : "memory")
189#define rmb() mb() 171#define rmb() mb()
diff --git a/include/asm-sparc64/cpudata.h b/include/asm-sparc64/cpudata.h
index 98a6e609163e..542421460a12 100644
--- a/include/asm-sparc64/cpudata.h
+++ b/include/asm-sparc64/cpudata.h
@@ -75,12 +75,11 @@ struct trap_per_cpu {
75 unsigned long tsb_huge_temp; 75 unsigned long tsb_huge_temp;
76 76
77/* Dcache line 8: IRQ work list, and keep trap_block a power-of-2 in size. */ 77/* Dcache line 8: IRQ work list, and keep trap_block a power-of-2 in size. */
78 unsigned int irq_worklist; 78 unsigned long irq_worklist_pa;
79 unsigned int cpu_mondo_qmask; 79 unsigned int cpu_mondo_qmask;
80 unsigned int dev_mondo_qmask; 80 unsigned int dev_mondo_qmask;
81 unsigned int resum_qmask; 81 unsigned int resum_qmask;
82 unsigned int nonresum_qmask; 82 unsigned int nonresum_qmask;
83 unsigned int __pad2[1];
84 void *hdesc; 83 void *hdesc;
85} __attribute__((aligned(64))); 84} __attribute__((aligned(64)));
86extern struct trap_per_cpu trap_block[NR_CPUS]; 85extern struct trap_per_cpu trap_block[NR_CPUS];
@@ -128,11 +127,11 @@ extern struct sun4v_2insn_patch_entry __sun4v_2insn_patch,
128#define TRAP_PER_CPU_CPU_LIST_PA 0xc8 127#define TRAP_PER_CPU_CPU_LIST_PA 0xc8
129#define TRAP_PER_CPU_TSB_HUGE 0xd0 128#define TRAP_PER_CPU_TSB_HUGE 0xd0
130#define TRAP_PER_CPU_TSB_HUGE_TEMP 0xd8 129#define TRAP_PER_CPU_TSB_HUGE_TEMP 0xd8
131#define TRAP_PER_CPU_IRQ_WORKLIST 0xe0 130#define TRAP_PER_CPU_IRQ_WORKLIST_PA 0xe0
132#define TRAP_PER_CPU_CPU_MONDO_QMASK 0xe4 131#define TRAP_PER_CPU_CPU_MONDO_QMASK 0xe8
133#define TRAP_PER_CPU_DEV_MONDO_QMASK 0xe8 132#define TRAP_PER_CPU_DEV_MONDO_QMASK 0xec
134#define TRAP_PER_CPU_RESUM_QMASK 0xec 133#define TRAP_PER_CPU_RESUM_QMASK 0xf0
135#define TRAP_PER_CPU_NONRESUM_QMASK 0xf0 134#define TRAP_PER_CPU_NONRESUM_QMASK 0xf4
136 135
137#define TRAP_BLOCK_SZ_SHIFT 8 136#define TRAP_BLOCK_SZ_SHIFT 8
138 137
@@ -184,9 +183,9 @@ extern struct sun4v_2insn_patch_entry __sun4v_2insn_patch,
184 ldx [DEST + TRAP_PER_CPU_PGD_PADDR], DEST; 183 ldx [DEST + TRAP_PER_CPU_PGD_PADDR], DEST;
185 184
186/* Clobbers TMP, loads local processor's IRQ work area into DEST. */ 185/* Clobbers TMP, loads local processor's IRQ work area into DEST. */
187#define TRAP_LOAD_IRQ_WORK(DEST, TMP) \ 186#define TRAP_LOAD_IRQ_WORK_PA(DEST, TMP) \
188 TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \ 187 TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
189 add DEST, TRAP_PER_CPU_IRQ_WORKLIST, DEST; 188 add DEST, TRAP_PER_CPU_IRQ_WORKLIST_PA, DEST;
190 189
191/* Clobbers TMP, loads DEST with current thread info pointer. */ 190/* Clobbers TMP, loads DEST with current thread info pointer. */
192#define TRAP_LOAD_THREAD_REG(DEST, TMP) \ 191#define TRAP_LOAD_THREAD_REG(DEST, TMP) \
@@ -223,9 +222,9 @@ extern struct sun4v_2insn_patch_entry __sun4v_2insn_patch,
223 ldx [DEST + TRAP_PER_CPU_PGD_PADDR], DEST; 222 ldx [DEST + TRAP_PER_CPU_PGD_PADDR], DEST;
224 223
225/* Clobbers TMP, loads local processor's IRQ work area into DEST. */ 224/* Clobbers TMP, loads local processor's IRQ work area into DEST. */
226#define TRAP_LOAD_IRQ_WORK(DEST, TMP) \ 225#define TRAP_LOAD_IRQ_WORK_PA(DEST, TMP) \
227 TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \ 226 TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
228 add DEST, TRAP_PER_CPU_IRQ_WORKLIST, DEST; 227 add DEST, TRAP_PER_CPU_IRQ_WORKLIST_PA, DEST;
229 228
230#define TRAP_LOAD_THREAD_REG(DEST, TMP) \ 229#define TRAP_LOAD_THREAD_REG(DEST, TMP) \
231 TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \ 230 TRAP_LOAD_TRAP_BLOCK(DEST, TMP) \
diff --git a/include/asm-sparc64/irq.h b/include/asm-sparc64/irq.h
index c00ad152771b..182dba05c702 100644
--- a/include/asm-sparc64/irq.h
+++ b/include/asm-sparc64/irq.h
@@ -51,10 +51,19 @@ extern unsigned int sun4v_build_msi(u32 devhandle, unsigned int *virt_irq_p,
51 unsigned int msi_devino_start, 51 unsigned int msi_devino_start,
52 unsigned int msi_devino_end); 52 unsigned int msi_devino_end);
53extern void sun4v_destroy_msi(unsigned int virt_irq); 53extern void sun4v_destroy_msi(unsigned int virt_irq);
54extern unsigned int sun4u_build_msi(u32 portid, unsigned int *virt_irq_p,
55 unsigned int msi_devino_start,
56 unsigned int msi_devino_end,
57 unsigned long imap_base,
58 unsigned long iclr_base);
59extern void sun4u_destroy_msi(unsigned int virt_irq);
54extern unsigned int sbus_build_irq(void *sbus, unsigned int ino); 60extern unsigned int sbus_build_irq(void *sbus, unsigned int ino);
55 61
56extern void sparc64_set_msi(unsigned int virt_irq, u32 msi); 62extern unsigned char virt_irq_alloc(unsigned int dev_handle,
57extern u32 sparc64_get_msi(unsigned int virt_irq); 63 unsigned int dev_ino);
64#ifdef CONFIG_PCI_MSI
65extern void virt_irq_free(unsigned int virt_irq);
66#endif
58 67
59extern void fixup_irqs(void); 68extern void fixup_irqs(void);
60 69
diff --git a/include/asm-x86/8253pit.h b/include/asm-x86/8253pit.h
deleted file mode 100644
index d3c2b38a6618..000000000000
--- a/include/asm-x86/8253pit.h
+++ /dev/null
@@ -1,5 +0,0 @@
1#ifdef CONFIG_X86_32
2# include "8253pit_32.h"
3#else
4# include "8253pit_64.h"
5#endif
diff --git a/include/asm-x86/8253pit_32.h b/include/asm-x86/8253pit_32.h
deleted file mode 100644
index 96c7c3592daf..000000000000
--- a/include/asm-x86/8253pit_32.h
+++ /dev/null
@@ -1,12 +0,0 @@
1/*
2 * 8253/8254 Programmable Interval Timer
3 */
4
5#ifndef _8253PIT_H
6#define _8253PIT_H
7
8#include <asm/timex.h>
9
10#define PIT_TICK_RATE CLOCK_TICK_RATE
11
12#endif
diff --git a/include/asm-x86/8253pit_64.h b/include/asm-x86/8253pit_64.h
deleted file mode 100644
index 285f78488ccb..000000000000
--- a/include/asm-x86/8253pit_64.h
+++ /dev/null
@@ -1,10 +0,0 @@
1/*
2 * 8253/8254 Programmable Interval Timer
3 */
4
5#ifndef _8253PIT_H
6#define _8253PIT_H
7
8#define PIT_TICK_RATE 1193182UL
9
10#endif
diff --git a/include/asm-x86/apic_64.h b/include/asm-x86/apic_64.h
index 85125ef3c414..3c8f21eef0be 100644
--- a/include/asm-x86/apic_64.h
+++ b/include/asm-x86/apic_64.h
@@ -19,7 +19,7 @@
19extern int apic_verbosity; 19extern int apic_verbosity;
20extern int apic_runs_main_timer; 20extern int apic_runs_main_timer;
21extern int ioapic_force; 21extern int ioapic_force;
22extern int apic_mapped; 22extern int disable_apic_timer;
23 23
24/* 24/*
25 * Define the default level of output to be very little 25 * Define the default level of output to be very little
@@ -79,8 +79,6 @@ extern void smp_local_timer_interrupt (void);
79extern void setup_boot_APIC_clock (void); 79extern void setup_boot_APIC_clock (void);
80extern void setup_secondary_APIC_clock (void); 80extern void setup_secondary_APIC_clock (void);
81extern int APIC_init_uniprocessor (void); 81extern int APIC_init_uniprocessor (void);
82extern void disable_APIC_timer(void);
83extern void enable_APIC_timer(void);
84extern void setup_apic_routing(void); 82extern void setup_apic_routing(void);
85 83
86extern void setup_APIC_extended_lvt(unsigned char lvt_off, unsigned char vector, 84extern void setup_APIC_extended_lvt(unsigned char lvt_off, unsigned char vector,
@@ -95,10 +93,6 @@ extern int apic_is_clustered_box(void);
95#define K8_APIC_EXT_INT_MSG_EXT 0x7 93#define K8_APIC_EXT_INT_MSG_EXT 0x7
96#define K8_APIC_EXT_LVT_ENTRY_THRESHOLD 0 94#define K8_APIC_EXT_LVT_ENTRY_THRESHOLD 0
97 95
98void smp_send_timer_broadcast_ipi(void);
99void switch_APIC_timer_to_ipi(void *cpumask);
100void switch_ipi_to_APIC_timer(void *cpumask);
101
102#define ARCH_APICTIMER_STOPS_ON_C3 1 96#define ARCH_APICTIMER_STOPS_ON_C3 1
103 97
104extern unsigned boot_cpu_id; 98extern unsigned boot_cpu_id;
diff --git a/include/asm-x86/cpufeature_64.h b/include/asm-x86/cpufeature_64.h
index 2983501e8b3e..e18496b7b850 100644
--- a/include/asm-x86/cpufeature_64.h
+++ b/include/asm-x86/cpufeature_64.h
@@ -7,7 +7,7 @@
7#ifndef __ASM_X8664_CPUFEATURE_H 7#ifndef __ASM_X8664_CPUFEATURE_H
8#define __ASM_X8664_CPUFEATURE_H 8#define __ASM_X8664_CPUFEATURE_H
9 9
10#include <asm/cpufeature_32.h> 10#include "cpufeature_32.h"
11 11
12#undef cpu_has_vme 12#undef cpu_has_vme
13#define cpu_has_vme 0 13#define cpu_has_vme 0
diff --git a/include/asm-x86/geode.h b/include/asm-x86/geode.h
index 6da4bbbea3dc..d94898831bac 100644
--- a/include/asm-x86/geode.h
+++ b/include/asm-x86/geode.h
@@ -156,4 +156,54 @@ static inline int is_geode(void)
156 return (is_geode_gx() || is_geode_lx()); 156 return (is_geode_gx() || is_geode_lx());
157} 157}
158 158
159/* MFGPTs */
160
161#define MFGPT_MAX_TIMERS 8
162#define MFGPT_TIMER_ANY -1
163
164#define MFGPT_DOMAIN_WORKING 1
165#define MFGPT_DOMAIN_STANDBY 2
166#define MFGPT_DOMAIN_ANY (MFGPT_DOMAIN_WORKING | MFGPT_DOMAIN_STANDBY)
167
168#define MFGPT_CMP1 0
169#define MFGPT_CMP2 1
170
171#define MFGPT_EVENT_IRQ 0
172#define MFGPT_EVENT_NMI 1
173#define MFGPT_EVENT_RESET 3
174
175#define MFGPT_REG_CMP1 0
176#define MFGPT_REG_CMP2 2
177#define MFGPT_REG_COUNTER 4
178#define MFGPT_REG_SETUP 6
179
180#define MFGPT_SETUP_CNTEN (1 << 15)
181#define MFGPT_SETUP_CMP2 (1 << 14)
182#define MFGPT_SETUP_CMP1 (1 << 13)
183#define MFGPT_SETUP_SETUP (1 << 12)
184#define MFGPT_SETUP_STOPEN (1 << 11)
185#define MFGPT_SETUP_EXTEN (1 << 10)
186#define MFGPT_SETUP_REVEN (1 << 5)
187#define MFGPT_SETUP_CLKSEL (1 << 4)
188
189static inline void geode_mfgpt_write(int timer, u16 reg, u16 value)
190{
191 u32 base = geode_get_dev_base(GEODE_DEV_MFGPT);
192 outw(value, base + reg + (timer * 8));
193}
194
195static inline u16 geode_mfgpt_read(int timer, u16 reg)
196{
197 u32 base = geode_get_dev_base(GEODE_DEV_MFGPT);
198 return inw(base + reg + (timer * 8));
199}
200
201extern int __init geode_mfgpt_detect(void);
202extern int geode_mfgpt_toggle_event(int timer, int cmp, int event, int enable);
203extern int geode_mfgpt_set_irq(int timer, int cmp, int irq, int enable);
204extern int geode_mfgpt_alloc_timer(int timer, int domain, struct module *owner);
205
206#define geode_mfgpt_setup_irq(t, c, i) geode_mfgpt_set_irq((t), (c), (i), 1)
207#define geode_mfgpt_release_irq(t, c, i) geode_mfgpt_set_irq((t), (c), (i), 0)
208
159#endif 209#endif
diff --git a/include/asm-x86/hardirq_32.h b/include/asm-x86/hardirq_32.h
index 0e358dc405f8..34649585bb59 100644
--- a/include/asm-x86/hardirq_32.h
+++ b/include/asm-x86/hardirq_32.h
@@ -9,6 +9,7 @@ typedef struct {
9 unsigned long idle_timestamp; 9 unsigned long idle_timestamp;
10 unsigned int __nmi_count; /* arch dependent */ 10 unsigned int __nmi_count; /* arch dependent */
11 unsigned int apic_timer_irqs; /* arch dependent */ 11 unsigned int apic_timer_irqs; /* arch dependent */
12 unsigned int irq0_irqs;
12} ____cacheline_aligned irq_cpustat_t; 13} ____cacheline_aligned irq_cpustat_t;
13 14
14DECLARE_PER_CPU(irq_cpustat_t, irq_stat); 15DECLARE_PER_CPU(irq_cpustat_t, irq_stat);
diff --git a/include/asm-x86/hpet.h b/include/asm-x86/hpet.h
index 9eff48601254..d4ab6db050b6 100644
--- a/include/asm-x86/hpet.h
+++ b/include/asm-x86/hpet.h
@@ -1,5 +1,93 @@
1#ifdef CONFIG_X86_32 1#ifndef ASM_X86_HPET_H
2# include "hpet_32.h" 2#define ASM_X86_HPET_H
3
4#ifdef CONFIG_HPET_TIMER
5
6/*
7 * Documentation on HPET can be found at:
8 * http://www.intel.com/ial/home/sp/pcmmspec.htm
9 * ftp://download.intel.com/ial/home/sp/mmts098.pdf
10 */
11
12#define HPET_MMAP_SIZE 1024
13
14#define HPET_ID 0x000
15#define HPET_PERIOD 0x004
16#define HPET_CFG 0x010
17#define HPET_STATUS 0x020
18#define HPET_COUNTER 0x0f0
19#define HPET_T0_CFG 0x100
20#define HPET_T0_CMP 0x108
21#define HPET_T0_ROUTE 0x110
22#define HPET_T1_CFG 0x120
23#define HPET_T1_CMP 0x128
24#define HPET_T1_ROUTE 0x130
25#define HPET_T2_CFG 0x140
26#define HPET_T2_CMP 0x148
27#define HPET_T2_ROUTE 0x150
28
29#define HPET_ID_REV 0x000000ff
30#define HPET_ID_NUMBER 0x00001f00
31#define HPET_ID_64BIT 0x00002000
32#define HPET_ID_LEGSUP 0x00008000
33#define HPET_ID_VENDOR 0xffff0000
34#define HPET_ID_NUMBER_SHIFT 8
35#define HPET_ID_VENDOR_SHIFT 16
36
37#define HPET_ID_VENDOR_8086 0x8086
38
39#define HPET_CFG_ENABLE 0x001
40#define HPET_CFG_LEGACY 0x002
41#define HPET_LEGACY_8254 2
42#define HPET_LEGACY_RTC 8
43
44#define HPET_TN_LEVEL 0x0002
45#define HPET_TN_ENABLE 0x0004
46#define HPET_TN_PERIODIC 0x0008
47#define HPET_TN_PERIODIC_CAP 0x0010
48#define HPET_TN_64BIT_CAP 0x0020
49#define HPET_TN_SETVAL 0x0040
50#define HPET_TN_32BIT 0x0100
51#define HPET_TN_ROUTE 0x3e00
52#define HPET_TN_FSB 0x4000
53#define HPET_TN_FSB_CAP 0x8000
54#define HPET_TN_ROUTE_SHIFT 9
55
56/* Max HPET Period is 10^8 femto sec as in HPET spec */
57#define HPET_MAX_PERIOD 100000000UL
58/*
59 * Min HPET period is 10^5 femto sec just for safety. If it is less than this,
60 * then 32 bit HPET counter wrapsaround in less than 0.5 sec.
61 */
62#define HPET_MIN_PERIOD 100000UL
63
64/* hpet memory map physical address */
65extern unsigned long hpet_address;
66extern unsigned long force_hpet_address;
67extern int is_hpet_enabled(void);
68extern int hpet_enable(void);
69extern unsigned long hpet_readl(unsigned long a);
70extern void force_hpet_resume(void);
71
72#ifdef CONFIG_HPET_EMULATE_RTC
73
74#include <linux/interrupt.h>
75
76extern int hpet_mask_rtc_irq_bit(unsigned long bit_mask);
77extern int hpet_set_rtc_irq_bit(unsigned long bit_mask);
78extern int hpet_set_alarm_time(unsigned char hrs, unsigned char min,
79 unsigned char sec);
80extern int hpet_set_periodic_freq(unsigned long freq);
81extern int hpet_rtc_dropped_irq(void);
82extern int hpet_rtc_timer_init(void);
83extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id);
84
85#endif /* CONFIG_HPET_EMULATE_RTC */
86
3#else 87#else
4# include "hpet_64.h" 88
5#endif 89static inline int hpet_enable(void) { return 0; }
90static inline unsigned long hpet_readl(unsigned long a) { return 0; }
91
92#endif /* CONFIG_HPET_TIMER */
93#endif /* ASM_X86_HPET_H */
diff --git a/include/asm-x86/hpet_32.h b/include/asm-x86/hpet_32.h
deleted file mode 100644
index c82dc7ed96b3..000000000000
--- a/include/asm-x86/hpet_32.h
+++ /dev/null
@@ -1,90 +0,0 @@
1
2#ifndef _I386_HPET_H
3#define _I386_HPET_H
4
5#ifdef CONFIG_HPET_TIMER
6
7/*
8 * Documentation on HPET can be found at:
9 * http://www.intel.com/ial/home/sp/pcmmspec.htm
10 * ftp://download.intel.com/ial/home/sp/mmts098.pdf
11 */
12
13#define HPET_MMAP_SIZE 1024
14
15#define HPET_ID 0x000
16#define HPET_PERIOD 0x004
17#define HPET_CFG 0x010
18#define HPET_STATUS 0x020
19#define HPET_COUNTER 0x0f0
20#define HPET_T0_CFG 0x100
21#define HPET_T0_CMP 0x108
22#define HPET_T0_ROUTE 0x110
23#define HPET_T1_CFG 0x120
24#define HPET_T1_CMP 0x128
25#define HPET_T1_ROUTE 0x130
26#define HPET_T2_CFG 0x140
27#define HPET_T2_CMP 0x148
28#define HPET_T2_ROUTE 0x150
29
30#define HPET_ID_REV 0x000000ff
31#define HPET_ID_NUMBER 0x00001f00
32#define HPET_ID_64BIT 0x00002000
33#define HPET_ID_LEGSUP 0x00008000
34#define HPET_ID_VENDOR 0xffff0000
35#define HPET_ID_NUMBER_SHIFT 8
36#define HPET_ID_VENDOR_SHIFT 16
37
38#define HPET_ID_VENDOR_8086 0x8086
39
40#define HPET_CFG_ENABLE 0x001
41#define HPET_CFG_LEGACY 0x002
42#define HPET_LEGACY_8254 2
43#define HPET_LEGACY_RTC 8
44
45#define HPET_TN_LEVEL 0x0002
46#define HPET_TN_ENABLE 0x0004
47#define HPET_TN_PERIODIC 0x0008
48#define HPET_TN_PERIODIC_CAP 0x0010
49#define HPET_TN_64BIT_CAP 0x0020
50#define HPET_TN_SETVAL 0x0040
51#define HPET_TN_32BIT 0x0100
52#define HPET_TN_ROUTE 0x3e00
53#define HPET_TN_FSB 0x4000
54#define HPET_TN_FSB_CAP 0x8000
55#define HPET_TN_ROUTE_SHIFT 9
56
57/* Max HPET Period is 10^8 femto sec as in HPET spec */
58#define HPET_MAX_PERIOD 100000000UL
59/*
60 * Min HPET period is 10^5 femto sec just for safety. If it is less than this,
61 * then 32 bit HPET counter wrapsaround in less than 0.5 sec.
62 */
63#define HPET_MIN_PERIOD 100000UL
64
65/* hpet memory map physical address */
66extern unsigned long hpet_address;
67extern int is_hpet_enabled(void);
68extern int hpet_enable(void);
69
70#ifdef CONFIG_HPET_EMULATE_RTC
71
72#include <linux/interrupt.h>
73
74extern int hpet_mask_rtc_irq_bit(unsigned long bit_mask);
75extern int hpet_set_rtc_irq_bit(unsigned long bit_mask);
76extern int hpet_set_alarm_time(unsigned char hrs, unsigned char min,
77 unsigned char sec);
78extern int hpet_set_periodic_freq(unsigned long freq);
79extern int hpet_rtc_dropped_irq(void);
80extern int hpet_rtc_timer_init(void);
81extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id);
82
83#endif /* CONFIG_HPET_EMULATE_RTC */
84
85#else
86
87static inline int hpet_enable(void) { return 0; }
88
89#endif /* CONFIG_HPET_TIMER */
90#endif /* _I386_HPET_H */
diff --git a/include/asm-x86/hpet_64.h b/include/asm-x86/hpet_64.h
deleted file mode 100644
index fd4decac93a8..000000000000
--- a/include/asm-x86/hpet_64.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef _ASM_X8664_HPET_H
2#define _ASM_X8664_HPET_H 1
3
4#include <asm/hpet_32.h>
5
6#define HPET_TICK_RATE (HZ * 100000UL)
7
8extern int hpet_rtc_timer_init(void);
9extern int hpet_arch_init(void);
10extern int hpet_timer_stop_set_go(unsigned long tick);
11extern int hpet_reenable(void);
12extern unsigned int hpet_calibrate_tsc(void);
13
14extern int hpet_use_timer;
15extern unsigned long hpet_period;
16extern unsigned long hpet_tick;
17
18#endif
diff --git a/include/asm-x86/i8253.h b/include/asm-x86/i8253.h
index b2a4f995a33f..747548ec5d1d 100644
--- a/include/asm-x86/i8253.h
+++ b/include/asm-x86/i8253.h
@@ -1,5 +1,15 @@
1#ifdef CONFIG_X86_32 1#ifndef __ASM_I8253_H__
2# include "i8253_32.h" 2#define __ASM_I8253_H__
3#else 3
4# include "i8253_64.h" 4/* i8253A PIT registers */
5#endif 5#define PIT_MODE 0x43
6#define PIT_CH0 0x40
7#define PIT_CH2 0x42
8
9extern spinlock_t i8253_lock;
10
11extern struct clock_event_device *global_clock_event;
12
13extern void setup_pit_timer(void);
14
15#endif /* __ASM_I8253_H__ */
diff --git a/include/asm-x86/i8253_32.h b/include/asm-x86/i8253_32.h
deleted file mode 100644
index 7577d058d86e..000000000000
--- a/include/asm-x86/i8253_32.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef __ASM_I8253_H__
2#define __ASM_I8253_H__
3
4#include <linux/clockchips.h>
5
6/* i8253A PIT registers */
7#define PIT_MODE 0x43
8#define PIT_CH0 0x40
9#define PIT_CH2 0x42
10
11extern spinlock_t i8253_lock;
12
13extern struct clock_event_device *global_clock_event;
14
15extern void setup_pit_timer(void);
16
17#endif /* __ASM_I8253_H__ */
diff --git a/include/asm-x86/i8253_64.h b/include/asm-x86/i8253_64.h
deleted file mode 100644
index 015d8df07690..000000000000
--- a/include/asm-x86/i8253_64.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_I8253_H__
2#define __ASM_I8253_H__
3
4extern spinlock_t i8253_lock;
5
6#endif /* __ASM_I8253_H__ */
diff --git a/include/asm-x86/io_apic_32.h b/include/asm-x86/io_apic_32.h
index dbe734ddf2af..3f087883ea48 100644
--- a/include/asm-x86/io_apic_32.h
+++ b/include/asm-x86/io_apic_32.h
@@ -11,8 +11,6 @@
11 * Copyright (C) 1997, 1998, 1999, 2000 Ingo Molnar 11 * Copyright (C) 1997, 1998, 1999, 2000 Ingo Molnar
12 */ 12 */
13 13
14#ifdef CONFIG_X86_IO_APIC
15
16/* 14/*
17 * The structure of the IO-APIC: 15 * The structure of the IO-APIC:
18 */ 16 */
@@ -55,12 +53,6 @@ union IO_APIC_reg_03 {
55 } __attribute__ ((packed)) bits; 53 } __attribute__ ((packed)) bits;
56}; 54};
57 55
58/*
59 * # of IO-APICs and # of IRQ routing registers
60 */
61extern int nr_ioapics;
62extern int nr_ioapic_registers[MAX_IO_APICS];
63
64enum ioapic_irq_destination_types { 56enum ioapic_irq_destination_types {
65 dest_Fixed = 0, 57 dest_Fixed = 0,
66 dest_LowestPrio = 1, 58 dest_LowestPrio = 1,
@@ -100,6 +92,14 @@ struct IO_APIC_route_entry {
100 92
101} __attribute__ ((packed)); 93} __attribute__ ((packed));
102 94
95#ifdef CONFIG_X86_IO_APIC
96
97/*
98 * # of IO-APICs and # of IRQ routing registers
99 */
100extern int nr_ioapics;
101extern int nr_ioapic_registers[MAX_IO_APICS];
102
103/* 103/*
104 * MP-BIOS irq configuration table structures: 104 * MP-BIOS irq configuration table structures:
105 */ 105 */
diff --git a/include/asm-x86/irqflags_32.h b/include/asm-x86/irqflags_32.h
index eff8585cb741..d058b04e0083 100644
--- a/include/asm-x86/irqflags_32.h
+++ b/include/asm-x86/irqflags_32.h
@@ -160,4 +160,17 @@ static inline int raw_irqs_disabled(void)
160# define TRACE_IRQS_OFF 160# define TRACE_IRQS_OFF
161#endif 161#endif
162 162
163#ifdef CONFIG_DEBUG_LOCK_ALLOC
164# define LOCKDEP_SYS_EXIT \
165 pushl %eax; \
166 pushl %ecx; \
167 pushl %edx; \
168 call lockdep_sys_exit; \
169 popl %edx; \
170 popl %ecx; \
171 popl %eax;
172#else
173# define LOCKDEP_SYS_EXIT
174#endif
175
163#endif 176#endif
diff --git a/include/asm-x86/irqflags_64.h b/include/asm-x86/irqflags_64.h
index 86e70fe23659..5341ea1f815a 100644
--- a/include/asm-x86/irqflags_64.h
+++ b/include/asm-x86/irqflags_64.h
@@ -137,6 +137,20 @@ static inline void halt(void)
137# define TRACE_IRQS_ON 137# define TRACE_IRQS_ON
138# define TRACE_IRQS_OFF 138# define TRACE_IRQS_OFF
139# endif 139# endif
140# ifdef CONFIG_DEBUG_LOCK_ALLOC
141# define LOCKDEP_SYS_EXIT call lockdep_sys_exit_thunk
142# define LOCKDEP_SYS_EXIT_IRQ \
143 TRACE_IRQS_ON; \
144 sti; \
145 SAVE_REST; \
146 LOCKDEP_SYS_EXIT; \
147 RESTORE_REST; \
148 cli; \
149 TRACE_IRQS_OFF;
150# else
151# define LOCKDEP_SYS_EXIT
152# define LOCKDEP_SYS_EXIT_IRQ
153# endif
140#endif 154#endif
141 155
142#endif 156#endif
diff --git a/include/asm-x86/pci.h b/include/asm-x86/pci.h
index a8cac8c2cde7..e88361966347 100644
--- a/include/asm-x86/pci.h
+++ b/include/asm-x86/pci.h
@@ -1,5 +1,95 @@
1#ifndef __x86_PCI_H
2#define __x86_PCI_H
3
4#include <linux/mm.h> /* for struct page */
5#include <linux/types.h>
6#include <linux/slab.h>
7#include <linux/string.h>
8#include <asm/scatterlist.h>
9#include <asm/io.h>
10
11
12#ifdef __KERNEL__
13
14struct pci_sysdata {
15 int domain; /* PCI domain */
16 int node; /* NUMA node */
17#ifdef CONFIG_X86_64
18 void* iommu; /* IOMMU private data */
19#endif
20};
21
22/* scan a bus after allocating a pci_sysdata for it */
23extern struct pci_bus *pci_scan_bus_with_sysdata(int busno);
24
25static inline int pci_domain_nr(struct pci_bus *bus)
26{
27 struct pci_sysdata *sd = bus->sysdata;
28 return sd->domain;
29}
30
31static inline int pci_proc_domain(struct pci_bus *bus)
32{
33 return pci_domain_nr(bus);
34}
35
36
37/* Can be used to override the logic in pci_scan_bus for skipping
38 already-configured bus numbers - to be used for buggy BIOSes
39 or architectures with incomplete PCI setup by the loader */
40
41#ifdef CONFIG_PCI
42extern unsigned int pcibios_assign_all_busses(void);
43#else
44#define pcibios_assign_all_busses() 0
45#endif
46#define pcibios_scan_all_fns(a, b) 0
47
48extern unsigned long pci_mem_start;
49#define PCIBIOS_MIN_IO 0x1000
50#define PCIBIOS_MIN_MEM (pci_mem_start)
51
52#define PCIBIOS_MIN_CARDBUS_IO 0x4000
53
54void pcibios_config_init(void);
55struct pci_bus * pcibios_scan_root(int bus);
56
57void pcibios_set_master(struct pci_dev *dev);
58void pcibios_penalize_isa_irq(int irq, int active);
59struct irq_routing_table *pcibios_get_irq_routing_table(void);
60int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
61
62
63#define HAVE_PCI_MMAP
64extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
65 enum pci_mmap_state mmap_state, int write_combine);
66
67
68#ifdef CONFIG_PCI
69static inline void pci_dma_burst_advice(struct pci_dev *pdev,
70 enum pci_dma_burst_strategy *strat,
71 unsigned long *strategy_parameter)
72{
73 *strat = PCI_DMA_BURST_INFINITY;
74 *strategy_parameter = ~0UL;
75}
76#endif
77
78
79#endif /* __KERNEL__ */
80
1#ifdef CONFIG_X86_32 81#ifdef CONFIG_X86_32
2# include "pci_32.h" 82# include "pci_32.h"
3#else 83#else
4# include "pci_64.h" 84# include "pci_64.h"
5#endif 85#endif
86
87/* implement the pci_ DMA API in terms of the generic device dma_ one */
88#include <asm-generic/pci-dma-compat.h>
89
90/* generic pci stuff */
91#include <asm-generic/pci.h>
92
93
94
95#endif
diff --git a/include/asm-x86/pci_32.h b/include/asm-x86/pci_32.h
index 4fcacc711385..8c4c3a0368e2 100644
--- a/include/asm-x86/pci_32.h
+++ b/include/asm-x86/pci_32.h
@@ -4,50 +4,11 @@
4 4
5#ifdef __KERNEL__ 5#ifdef __KERNEL__
6 6
7struct pci_sysdata {
8 int node; /* NUMA node */
9};
10
11/* scan a bus after allocating a pci_sysdata for it */
12extern struct pci_bus *pci_scan_bus_with_sysdata(int busno);
13
14#include <linux/mm.h> /* for struct page */
15
16/* Can be used to override the logic in pci_scan_bus for skipping
17 already-configured bus numbers - to be used for buggy BIOSes
18 or architectures with incomplete PCI setup by the loader */
19
20#ifdef CONFIG_PCI
21extern unsigned int pcibios_assign_all_busses(void);
22#else
23#define pcibios_assign_all_busses() 0
24#endif
25#define pcibios_scan_all_fns(a, b) 0
26
27extern unsigned long pci_mem_start;
28#define PCIBIOS_MIN_IO 0x1000
29#define PCIBIOS_MIN_MEM (pci_mem_start)
30
31#define PCIBIOS_MIN_CARDBUS_IO 0x4000
32
33void pcibios_config_init(void);
34struct pci_bus * pcibios_scan_root(int bus);
35
36void pcibios_set_master(struct pci_dev *dev);
37void pcibios_penalize_isa_irq(int irq, int active);
38struct irq_routing_table *pcibios_get_irq_routing_table(void);
39int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
40 7
41/* Dynamic DMA mapping stuff. 8/* Dynamic DMA mapping stuff.
42 * i386 has everything mapped statically. 9 * i386 has everything mapped statically.
43 */ 10 */
44 11
45#include <linux/types.h>
46#include <linux/slab.h>
47#include <asm/scatterlist.h>
48#include <linux/string.h>
49#include <asm/io.h>
50
51struct pci_dev; 12struct pci_dev;
52 13
53/* The PCI address space does equal the physical memory 14/* The PCI address space does equal the physical memory
@@ -64,27 +25,8 @@ struct pci_dev;
64#define pci_unmap_len(PTR, LEN_NAME) (0) 25#define pci_unmap_len(PTR, LEN_NAME) (0)
65#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) 26#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
66 27
67#define HAVE_PCI_MMAP
68extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
69 enum pci_mmap_state mmap_state, int write_combine);
70
71
72#ifdef CONFIG_PCI
73static inline void pci_dma_burst_advice(struct pci_dev *pdev,
74 enum pci_dma_burst_strategy *strat,
75 unsigned long *strategy_parameter)
76{
77 *strat = PCI_DMA_BURST_INFINITY;
78 *strategy_parameter = ~0UL;
79}
80#endif
81 28
82#endif /* __KERNEL__ */ 29#endif /* __KERNEL__ */
83 30
84/* implement the pci_ DMA API in terms of the generic device dma_ one */
85#include <asm-generic/pci-dma-compat.h>
86
87/* generic pci stuff */
88#include <asm-generic/pci.h>
89 31
90#endif /* __i386_PCI_H */ 32#endif /* __i386_PCI_H */
diff --git a/include/asm-x86/pci_64.h b/include/asm-x86/pci_64.h
index 5da8cb0c0599..9baa46d9f594 100644
--- a/include/asm-x86/pci_64.h
+++ b/include/asm-x86/pci_64.h
@@ -1,16 +1,9 @@
1#ifndef __x8664_PCI_H 1#ifndef __x8664_PCI_H
2#define __x8664_PCI_H 2#define __x8664_PCI_H
3 3
4#include <asm/io.h>
5 4
6#ifdef __KERNEL__ 5#ifdef __KERNEL__
7 6
8struct pci_sysdata {
9 int node; /* NUMA node */
10 void* iommu; /* IOMMU private data */
11};
12
13extern struct pci_bus *pci_scan_bus_with_sysdata(int busno);
14 7
15#ifdef CONFIG_CALGARY_IOMMU 8#ifdef CONFIG_CALGARY_IOMMU
16static inline void* pci_iommu(struct pci_bus *bus) 9static inline void* pci_iommu(struct pci_bus *bus)
@@ -26,40 +19,11 @@ static inline void set_pci_iommu(struct pci_bus *bus, void *val)
26} 19}
27#endif /* CONFIG_CALGARY_IOMMU */ 20#endif /* CONFIG_CALGARY_IOMMU */
28 21
29#include <linux/mm.h> /* for struct page */
30
31/* Can be used to override the logic in pci_scan_bus for skipping
32 already-configured bus numbers - to be used for buggy BIOSes
33 or architectures with incomplete PCI setup by the loader */
34
35#ifdef CONFIG_PCI
36extern unsigned int pcibios_assign_all_busses(void);
37#else
38#define pcibios_assign_all_busses() 0
39#endif
40#define pcibios_scan_all_fns(a, b) 0
41
42extern unsigned long pci_mem_start;
43#define PCIBIOS_MIN_IO 0x1000
44#define PCIBIOS_MIN_MEM (pci_mem_start)
45
46#define PCIBIOS_MIN_CARDBUS_IO 0x4000
47 22
48void pcibios_config_init(void);
49struct pci_bus * pcibios_scan_root(int bus);
50extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value); 23extern int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value);
51extern int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32 value); 24extern int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32 value);
52 25
53void pcibios_set_master(struct pci_dev *dev);
54void pcibios_penalize_isa_irq(int irq, int active);
55struct irq_routing_table *pcibios_get_irq_routing_table(void);
56int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
57 26
58#include <linux/types.h>
59#include <linux/slab.h>
60#include <asm/scatterlist.h>
61#include <linux/string.h>
62#include <asm/page.h>
63 27
64extern void pci_iommu_alloc(void); 28extern void pci_iommu_alloc(void);
65extern int iommu_setup(char *opt); 29extern int iommu_setup(char *opt);
@@ -100,27 +64,7 @@ extern int iommu_setup(char *opt);
100 64
101#endif 65#endif
102 66
103#include <asm-generic/pci-dma-compat.h>
104
105#ifdef CONFIG_PCI
106static inline void pci_dma_burst_advice(struct pci_dev *pdev,
107 enum pci_dma_burst_strategy *strat,
108 unsigned long *strategy_parameter)
109{
110 *strat = PCI_DMA_BURST_INFINITY;
111 *strategy_parameter = ~0UL;
112}
113#endif
114
115#define HAVE_PCI_MMAP
116extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
117 enum pci_mmap_state mmap_state, int write_combine);
118
119#endif /* __KERNEL__ */ 67#endif /* __KERNEL__ */
120 68
121/* generic pci stuff */
122#ifdef CONFIG_PCI
123#include <asm-generic/pci.h>
124#endif
125 69
126#endif /* __x8664_PCI_H */ 70#endif /* __x8664_PCI_H */
diff --git a/include/asm-x86/pda.h b/include/asm-x86/pda.h
index 5642634843c4..fb49f80eb94f 100644
--- a/include/asm-x86/pda.h
+++ b/include/asm-x86/pda.h
@@ -29,6 +29,7 @@ struct x8664_pda {
29 short isidle; 29 short isidle;
30 struct mm_struct *active_mm; 30 struct mm_struct *active_mm;
31 unsigned apic_timer_irqs; 31 unsigned apic_timer_irqs;
32 unsigned irq0_irqs;
32} ____cacheline_aligned_in_smp; 33} ____cacheline_aligned_in_smp;
33 34
34extern struct x8664_pda *_cpu_pda[]; 35extern struct x8664_pda *_cpu_pda[];
diff --git a/include/asm-x86/processor-flags.h b/include/asm-x86/processor-flags.h
index 5404e90edd57..199cab107d85 100644
--- a/include/asm-x86/processor-flags.h
+++ b/include/asm-x86/processor-flags.h
@@ -63,7 +63,7 @@
63/* 63/*
64 * x86-64 Task Priority Register, CR8 64 * x86-64 Task Priority Register, CR8
65 */ 65 */
66#define X86_CR8_TPR 0x00000007 /* task priority register */ 66#define X86_CR8_TPR 0x0000000F /* task priority register */
67 67
68/* 68/*
69 * AMD and Transmeta use MSRs for configuration; see <asm/msr-index.h> 69 * AMD and Transmeta use MSRs for configuration; see <asm/msr-index.h>
diff --git a/include/asm-x86/proto.h b/include/asm-x86/proto.h
index 31f20ad65876..c44a3a93b5a4 100644
--- a/include/asm-x86/proto.h
+++ b/include/asm-x86/proto.h
@@ -51,9 +51,6 @@ extern void reserve_bootmem_generic(unsigned long phys, unsigned len);
51 51
52extern void load_gs_index(unsigned gs); 52extern void load_gs_index(unsigned gs);
53 53
54extern void stop_timer_interrupt(void);
55extern void main_timer_handler(void);
56
57extern unsigned long end_pfn_map; 54extern unsigned long end_pfn_map;
58 55
59extern void show_trace(struct task_struct *, struct pt_regs *, unsigned long * rsp); 56extern void show_trace(struct task_struct *, struct pt_regs *, unsigned long * rsp);
@@ -90,14 +87,10 @@ extern int timer_over_8254;
90 87
91extern int gsi_irq_sharing(int gsi); 88extern int gsi_irq_sharing(int gsi);
92 89
93extern void smp_local_timer_interrupt(void);
94
95extern int force_mwait; 90extern int force_mwait;
96 91
97long do_arch_prctl(struct task_struct *task, int code, unsigned long addr); 92long do_arch_prctl(struct task_struct *task, int code, unsigned long addr);
98 93
99void i8254_timer_resume(void);
100
101#define round_up(x,y) (((x) + (y) - 1) & ~((y)-1)) 94#define round_up(x,y) (((x) + (y) - 1) & ~((y)-1))
102#define round_down(x,y) ((x) & ~((y)-1)) 95#define round_down(x,y) ((x) & ~((y)-1))
103 96
diff --git a/include/asm-x86/system_32.h b/include/asm-x86/system_32.h
index d69ba937e092..e7e5d426fef5 100644
--- a/include/asm-x86/system_32.h
+++ b/include/asm-x86/system_32.h
@@ -216,6 +216,7 @@ static inline unsigned long get_limit(unsigned long segment)
216 216
217#define mb() alternative("lock; addl $0,0(%%esp)", "mfence", X86_FEATURE_XMM2) 217#define mb() alternative("lock; addl $0,0(%%esp)", "mfence", X86_FEATURE_XMM2)
218#define rmb() alternative("lock; addl $0,0(%%esp)", "lfence", X86_FEATURE_XMM2) 218#define rmb() alternative("lock; addl $0,0(%%esp)", "lfence", X86_FEATURE_XMM2)
219#define wmb() alternative("lock; addl $0,0(%%esp)", "sfence", X86_FEATURE_XMM)
219 220
220/** 221/**
221 * read_barrier_depends - Flush all pending reads that subsequents reads 222 * read_barrier_depends - Flush all pending reads that subsequents reads
@@ -271,18 +272,18 @@ static inline unsigned long get_limit(unsigned long segment)
271 272
272#define read_barrier_depends() do { } while(0) 273#define read_barrier_depends() do { } while(0)
273 274
275#ifdef CONFIG_SMP
276#define smp_mb() mb()
277#ifdef CONFIG_X86_PPRO_FENCE
278# define smp_rmb() rmb()
279#else
280# define smp_rmb() barrier()
281#endif
274#ifdef CONFIG_X86_OOSTORE 282#ifdef CONFIG_X86_OOSTORE
275/* Actually there are no OOO store capable CPUs for now that do SSE, 283# define smp_wmb() wmb()
276 but make it already an possibility. */
277#define wmb() alternative("lock; addl $0,0(%%esp)", "sfence", X86_FEATURE_XMM)
278#else 284#else
279#define wmb() __asm__ __volatile__ ("": : :"memory") 285# define smp_wmb() barrier()
280#endif 286#endif
281
282#ifdef CONFIG_SMP
283#define smp_mb() mb()
284#define smp_rmb() rmb()
285#define smp_wmb() wmb()
286#define smp_read_barrier_depends() read_barrier_depends() 287#define smp_read_barrier_depends() read_barrier_depends()
287#define set_mb(var, value) do { (void) xchg(&var, value); } while (0) 288#define set_mb(var, value) do { (void) xchg(&var, value); } while (0)
288#else 289#else
diff --git a/include/asm-x86/system_64.h b/include/asm-x86/system_64.h
index 02175aa1d16a..5022aecc333d 100644
--- a/include/asm-x86/system_64.h
+++ b/include/asm-x86/system_64.h
@@ -141,8 +141,8 @@ static inline void write_cr8(unsigned long val)
141 141
142#ifdef CONFIG_SMP 142#ifdef CONFIG_SMP
143#define smp_mb() mb() 143#define smp_mb() mb()
144#define smp_rmb() rmb() 144#define smp_rmb() barrier()
145#define smp_wmb() wmb() 145#define smp_wmb() barrier()
146#define smp_read_barrier_depends() do {} while(0) 146#define smp_read_barrier_depends() do {} while(0)
147#else 147#else
148#define smp_mb() barrier() 148#define smp_mb() barrier()
@@ -159,12 +159,8 @@ static inline void write_cr8(unsigned long val)
159 */ 159 */
160#define mb() asm volatile("mfence":::"memory") 160#define mb() asm volatile("mfence":::"memory")
161#define rmb() asm volatile("lfence":::"memory") 161#define rmb() asm volatile("lfence":::"memory")
162
163#ifdef CONFIG_UNORDERED_IO
164#define wmb() asm volatile("sfence" ::: "memory") 162#define wmb() asm volatile("sfence" ::: "memory")
165#else 163
166#define wmb() asm volatile("" ::: "memory")
167#endif
168#define read_barrier_depends() do {} while(0) 164#define read_barrier_depends() do {} while(0)
169#define set_mb(var, value) do { (void) xchg(&var, value); } while (0) 165#define set_mb(var, value) do { (void) xchg(&var, value); } while (0)
170 166
diff --git a/include/asm-x86/timex.h b/include/asm-x86/timex.h
index d01c18cfccef..39a21ab030f0 100644
--- a/include/asm-x86/timex.h
+++ b/include/asm-x86/timex.h
@@ -1,5 +1,18 @@
1#ifdef CONFIG_X86_32 1/* x86 architecture timex specifications */
2# include "timex_32.h" 2#ifndef _ASM_X86_TIMEX_H
3#define _ASM_X86_TIMEX_H
4
5#include <asm/processor.h>
6#include <asm/tsc.h>
7
8#ifdef CONFIG_X86_ELAN
9# define PIT_TICK_RATE 1189200 /* AMD Elan has different frequency! */
3#else 10#else
4# include "timex_64.h" 11# define PIT_TICK_RATE 1193182 /* Underlying HZ */
12#endif
13#define CLOCK_TICK_RATE PIT_TICK_RATE
14
15extern int read_current_timer(unsigned long *timer_value);
16#define ARCH_HAS_READ_CURRENT_TIMER 1
17
5#endif 18#endif
diff --git a/include/asm-x86/timex_32.h b/include/asm-x86/timex_32.h
deleted file mode 100644
index 3666044409f0..000000000000
--- a/include/asm-x86/timex_32.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * linux/include/asm-i386/timex.h
3 *
4 * i386 architecture timex specifications
5 */
6#ifndef _ASMi386_TIMEX_H
7#define _ASMi386_TIMEX_H
8
9#include <asm/processor.h>
10#include <asm/tsc.h>
11
12#ifdef CONFIG_X86_ELAN
13# define CLOCK_TICK_RATE 1189200 /* AMD Elan has different frequency! */
14#else
15# define CLOCK_TICK_RATE 1193182 /* Underlying HZ */
16#endif
17
18
19extern int read_current_timer(unsigned long *timer_value);
20#define ARCH_HAS_READ_CURRENT_TIMER 1
21
22#endif
diff --git a/include/asm-x86/timex_64.h b/include/asm-x86/timex_64.h
deleted file mode 100644
index 6ed21f44d308..000000000000
--- a/include/asm-x86/timex_64.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * linux/include/asm-x86_64/timex.h
3 *
4 * x86-64 architecture timex specifications
5 */
6#ifndef _ASMx8664_TIMEX_H
7#define _ASMx8664_TIMEX_H
8
9#include <asm/8253pit.h>
10#include <asm/msr.h>
11#include <asm/vsyscall.h>
12#include <asm/system.h>
13#include <asm/processor.h>
14#include <asm/tsc.h>
15#include <linux/compiler.h>
16
17#define CLOCK_TICK_RATE PIT_TICK_RATE /* Underlying HZ */
18
19extern int read_current_timer(unsigned long *timer_value);
20#define ARCH_HAS_READ_CURRENT_TIMER 1
21
22#define USEC_PER_TICK (USEC_PER_SEC / HZ)
23#define NSEC_PER_TICK (NSEC_PER_SEC / HZ)
24#define FSEC_PER_TICK (FSEC_PER_SEC / HZ)
25
26#define NS_SCALE 10 /* 2^10, carefully chosen */
27#define US_SCALE 32 /* 2^32, arbitralrily chosen */
28
29extern void mark_tsc_unstable(char *msg);
30extern void set_cyc2ns_scale(unsigned long khz);
31#endif
diff --git a/include/asm-x86/tsc.h b/include/asm-x86/tsc.h
index a4d806610b7f..6baab30dc2c8 100644
--- a/include/asm-x86/tsc.h
+++ b/include/asm-x86/tsc.h
@@ -1,13 +1,14 @@
1/* 1/*
2 * linux/include/asm-i386/tsc.h 2 * x86 TSC related functions
3 *
4 * i386 TSC related functions
5 */ 3 */
6#ifndef _ASM_i386_TSC_H 4#ifndef _ASM_X86_TSC_H
7#define _ASM_i386_TSC_H 5#define _ASM_X86_TSC_H
8 6
9#include <asm/processor.h> 7#include <asm/processor.h>
10 8
9#define NS_SCALE 10 /* 2^10, carefully chosen */
10#define US_SCALE 32 /* 2^32, arbitralrily chosen */
11
11/* 12/*
12 * Standard way to access the cycle counter. 13 * Standard way to access the cycle counter.
13 */ 14 */
@@ -72,4 +73,8 @@ int check_tsc_unstable(void);
72extern void check_tsc_sync_source(int cpu); 73extern void check_tsc_sync_source(int cpu);
73extern void check_tsc_sync_target(void); 74extern void check_tsc_sync_target(void);
74 75
76#ifdef CONFIG_X86_64
77extern void tsc_calibrate(void);
78#endif
79
75#endif 80#endif
diff --git a/include/asm-x86/vsyscall.h b/include/asm-x86/vsyscall.h
index 3b8ceb4af2cf..f01c49f5d108 100644
--- a/include/asm-x86/vsyscall.h
+++ b/include/asm-x86/vsyscall.h
@@ -29,9 +29,6 @@ enum vsyscall_num {
29#define VGETCPU_RDTSCP 1 29#define VGETCPU_RDTSCP 1
30#define VGETCPU_LSL 2 30#define VGETCPU_LSL 2
31 31
32#define hpet_readl(a) readl((const void __iomem *)fix_to_virt(FIX_HPET_BASE) + a)
33#define hpet_writel(d,a) writel(d, (void __iomem *)fix_to_virt(FIX_HPET_BASE) + a)
34
35extern int __vgetcpu_mode; 32extern int __vgetcpu_mode;
36extern volatile unsigned long __jiffies; 33extern volatile unsigned long __jiffies;
37 34
diff --git a/include/linux/agpgart.h b/include/linux/agpgart.h
index bfb8ec791b7b..09fbf7e5a6cb 100644
--- a/include/linux/agpgart.h
+++ b/include/linux/agpgart.h
@@ -197,7 +197,7 @@ struct agp_file_private {
197 struct agp_file_private *next; 197 struct agp_file_private *next;
198 struct agp_file_private *prev; 198 struct agp_file_private *prev;
199 pid_t my_pid; 199 pid_t my_pid;
200 long access_flags; /* long req'd for set_bit --RR */ 200 unsigned long access_flags; /* long req'd for set_bit --RR */
201}; 201};
202 202
203struct agp_front_data { 203struct agp_front_data {
diff --git a/include/linux/ata.h b/include/linux/ata.h
index c043c1ccf1c5..a4f373f8b798 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -230,6 +230,12 @@ enum {
230 230
231 SETFEATURES_SPINUP = 0x07, /* Spin-up drive */ 231 SETFEATURES_SPINUP = 0x07, /* Spin-up drive */
232 232
233 SETFEATURES_SATA_ENABLE = 0x10, /* Enable use of SATA feature */
234 SETFEATURES_SATA_DISABLE = 0x90, /* Disable use of SATA feature */
235
236 /* SETFEATURE Sector counts for SATA features */
237 SATA_AN = 0x05, /* Asynchronous Notification */
238
233 /* ATAPI stuff */ 239 /* ATAPI stuff */
234 ATAPI_PKT_DMA = (1 << 0), 240 ATAPI_PKT_DMA = (1 << 0),
235 ATAPI_DMADIR = (1 << 2), /* ATAPI data dir: 241 ATAPI_DMADIR = (1 << 2), /* ATAPI data dir:
@@ -281,6 +287,15 @@ enum {
281 SERR_PROTOCOL = (1 << 10), /* protocol violation */ 287 SERR_PROTOCOL = (1 << 10), /* protocol violation */
282 SERR_INTERNAL = (1 << 11), /* host internal error */ 288 SERR_INTERNAL = (1 << 11), /* host internal error */
283 SERR_PHYRDY_CHG = (1 << 16), /* PHY RDY changed */ 289 SERR_PHYRDY_CHG = (1 << 16), /* PHY RDY changed */
290 SERR_PHY_INT_ERR = (1 << 17), /* PHY internal error */
291 SERR_COMM_WAKE = (1 << 18), /* Comm wake */
292 SERR_10B_8B_ERR = (1 << 19), /* 10b to 8b decode error */
293 SERR_DISPARITY = (1 << 20), /* Disparity */
294 SERR_CRC = (1 << 21), /* CRC error */
295 SERR_HANDSHAKE = (1 << 22), /* Handshake error */
296 SERR_LINK_SEQ_ERR = (1 << 23), /* Link sequence error */
297 SERR_TRANS_ST_ERROR = (1 << 24), /* Transport state trans. error */
298 SERR_UNRECOG_FIS = (1 << 25), /* Unrecognized FIS */
284 SERR_DEV_XCHG = (1 << 26), /* device exchanged */ 299 SERR_DEV_XCHG = (1 << 26), /* device exchanged */
285 300
286 /* struct ata_taskfile flags */ 301 /* struct ata_taskfile flags */
@@ -341,24 +356,17 @@ struct ata_taskfile {
341}; 356};
342 357
343#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) 358#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0)
344#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6))
345#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5))
346#define ata_id_hpa_enabled(id) ((id)[85] & (1 << 10))
347#define ata_id_has_fua(id) ((id)[84] & (1 << 6))
348#define ata_id_has_flush(id) ((id)[83] & (1 << 12))
349#define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13))
350#define ata_id_has_lba48(id) ((id)[83] & (1 << 10))
351#define ata_id_has_hpa(id) ((id)[82] & (1 << 10))
352#define ata_id_has_wcache(id) ((id)[82] & (1 << 5))
353#define ata_id_has_pm(id) ((id)[82] & (1 << 3))
354#define ata_id_has_lba(id) ((id)[49] & (1 << 9)) 359#define ata_id_has_lba(id) ((id)[49] & (1 << 9))
355#define ata_id_has_dma(id) ((id)[49] & (1 << 8)) 360#define ata_id_has_dma(id) ((id)[49] & (1 << 8))
356#define ata_id_has_ncq(id) ((id)[76] & (1 << 8)) 361#define ata_id_has_ncq(id) ((id)[76] & (1 << 8))
357#define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1) 362#define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1)
358#define ata_id_removeable(id) ((id)[0] & (1 << 7)) 363#define ata_id_removeable(id) ((id)[0] & (1 << 7))
359#define ata_id_has_dword_io(id) ((id)[50] & (1 << 0)) 364#define ata_id_has_dword_io(id) ((id)[48] & (1 << 0))
365#define ata_id_has_atapi_AN(id) \
366 ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \
367 ((id)[78] & (1 << 5)) )
360#define ata_id_iordy_disable(id) ((id)[49] & (1 << 10)) 368#define ata_id_iordy_disable(id) ((id)[49] & (1 << 10))
361#define ata_id_has_iordy(id) ((id)[49] & (1 << 9)) 369#define ata_id_has_iordy(id) ((id)[49] & (1 << 11))
362#define ata_id_u32(id,n) \ 370#define ata_id_u32(id,n) \
363 (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)])) 371 (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)]))
364#define ata_id_u64(id,n) \ 372#define ata_id_u64(id,n) \
@@ -369,6 +377,90 @@ struct ata_taskfile {
369 377
370#define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20) 378#define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20)
371 379
380static inline int ata_id_has_fua(const u16 *id)
381{
382 if ((id[84] & 0xC000) != 0x4000)
383 return 0;
384 return id[84] & (1 << 6);
385}
386
387static inline int ata_id_has_flush(const u16 *id)
388{
389 if ((id[83] & 0xC000) != 0x4000)
390 return 0;
391 return id[83] & (1 << 12);
392}
393
394static inline int ata_id_has_flush_ext(const u16 *id)
395{
396 if ((id[83] & 0xC000) != 0x4000)
397 return 0;
398 return id[83] & (1 << 13);
399}
400
401static inline int ata_id_has_lba48(const u16 *id)
402{
403 if ((id[83] & 0xC000) != 0x4000)
404 return 0;
405 return id[83] & (1 << 10);
406}
407
408static inline int ata_id_hpa_enabled(const u16 *id)
409{
410 /* Yes children, word 83 valid bits cover word 82 data */
411 if ((id[83] & 0xC000) != 0x4000)
412 return 0;
413 /* And 87 covers 85-87 */
414 if ((id[87] & 0xC000) != 0x4000)
415 return 0;
416 /* Check command sets enabled as well as supported */
417 if ((id[85] & ( 1 << 10)) == 0)
418 return 0;
419 return id[82] & (1 << 10);
420}
421
422static inline int ata_id_has_wcache(const u16 *id)
423{
424 /* Yes children, word 83 valid bits cover word 82 data */
425 if ((id[83] & 0xC000) != 0x4000)
426 return 0;
427 return id[82] & (1 << 5);
428}
429
430static inline int ata_id_has_pm(const u16 *id)
431{
432 if ((id[83] & 0xC000) != 0x4000)
433 return 0;
434 return id[82] & (1 << 3);
435}
436
437static inline int ata_id_rahead_enabled(const u16 *id)
438{
439 if ((id[87] & 0xC000) != 0x4000)
440 return 0;
441 return id[85] & (1 << 6);
442}
443
444static inline int ata_id_wcache_enabled(const u16 *id)
445{
446 if ((id[87] & 0xC000) != 0x4000)
447 return 0;
448 return id[85] & (1 << 5);
449}
450
451/**
452 * ata_id_major_version - get ATA level of drive
453 * @id: Identify data
454 *
455 * Caveats:
456 * ATA-1 considers identify optional
457 * ATA-2 introduces mandatory identify
458 * ATA-3 introduces word 80 and accurate reporting
459 *
460 * The practical impact of this is that ata_id_major_version cannot
461 * reliably report on drives below ATA3.
462 */
463
372static inline unsigned int ata_id_major_version(const u16 *id) 464static inline unsigned int ata_id_major_version(const u16 *id)
373{ 465{
374 unsigned int mver; 466 unsigned int mver;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 95be0ac57e76..5ed888b04b29 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -20,20 +20,6 @@
20 20
21#include <asm/scatterlist.h> 21#include <asm/scatterlist.h>
22 22
23#ifdef CONFIG_LBD
24# include <asm/div64.h>
25# define sector_div(a, b) do_div(a, b)
26#else
27# define sector_div(n, b)( \
28{ \
29 int _res; \
30 _res = (n) % (b); \
31 (n) /= (b); \
32 _res; \
33} \
34)
35#endif
36
37struct scsi_ioctl_command; 23struct scsi_ioctl_command;
38 24
39struct request_queue; 25struct request_queue;
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h
index 2e105a12fe29..7e11d23ac36a 100644
--- a/include/linux/blktrace_api.h
+++ b/include/linux/blktrace_api.h
@@ -290,12 +290,7 @@ static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
290#define blk_add_trace_generic(q, rq, rw, what) do { } while (0) 290#define blk_add_trace_generic(q, rq, rw, what) do { } while (0)
291#define blk_add_trace_pdu_int(q, what, bio, pdu) do { } while (0) 291#define blk_add_trace_pdu_int(q, what, bio, pdu) do { } while (0)
292#define blk_add_trace_remap(q, bio, dev, f, t) do {} while (0) 292#define blk_add_trace_remap(q, bio, dev, f, t) do {} while (0)
293static inline int do_blk_trace_setup(struct request_queue *q, 293#define do_blk_trace_setup(q, bdev, buts) (-ENOTTY)
294 struct block_device *bdev,
295 struct blk_user_trace_setup *buts)
296{
297 return 0;
298}
299#endif /* CONFIG_BLK_DEV_IO_TRACE */ 294#endif /* CONFIG_BLK_DEV_IO_TRACE */
300#endif /* __KERNEL__ */ 295#endif /* __KERNEL__ */
301#endif 296#endif
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index def5a659b8a5..c33b0dc28e4d 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -8,7 +8,7 @@
8#ifndef _LINUX_CLOCKCHIPS_H 8#ifndef _LINUX_CLOCKCHIPS_H
9#define _LINUX_CLOCKCHIPS_H 9#define _LINUX_CLOCKCHIPS_H
10 10
11#ifdef CONFIG_GENERIC_CLOCKEVENTS 11#ifdef CONFIG_GENERIC_CLOCKEVENTS_BUILD
12 12
13#include <linux/clocksource.h> 13#include <linux/clocksource.h>
14#include <linux/cpumask.h> 14#include <linux/cpumask.h>
@@ -31,6 +31,7 @@ enum clock_event_nofitiers {
31 CLOCK_EVT_NOTIFY_ADD, 31 CLOCK_EVT_NOTIFY_ADD,
32 CLOCK_EVT_NOTIFY_BROADCAST_ON, 32 CLOCK_EVT_NOTIFY_BROADCAST_ON,
33 CLOCK_EVT_NOTIFY_BROADCAST_OFF, 33 CLOCK_EVT_NOTIFY_BROADCAST_OFF,
34 CLOCK_EVT_NOTIFY_BROADCAST_FORCE,
34 CLOCK_EVT_NOTIFY_BROADCAST_ENTER, 35 CLOCK_EVT_NOTIFY_BROADCAST_ENTER,
35 CLOCK_EVT_NOTIFY_BROADCAST_EXIT, 36 CLOCK_EVT_NOTIFY_BROADCAST_EXIT,
36 CLOCK_EVT_NOTIFY_SUSPEND, 37 CLOCK_EVT_NOTIFY_SUSPEND,
@@ -126,11 +127,14 @@ extern int clockevents_register_notifier(struct notifier_block *nb);
126extern int clockevents_program_event(struct clock_event_device *dev, 127extern int clockevents_program_event(struct clock_event_device *dev,
127 ktime_t expires, ktime_t now); 128 ktime_t expires, ktime_t now);
128 129
130#ifdef CONFIG_GENERIC_CLOCKEVENTS
129extern void clockevents_notify(unsigned long reason, void *arg); 131extern void clockevents_notify(unsigned long reason, void *arg);
130
131#else 132#else
133# define clockevents_notify(reason, arg) do { } while (0)
134#endif
135
136#else /* CONFIG_GENERIC_CLOCKEVENTS_BUILD */
132 137
133static inline void clockevents_resume_events(void) { }
134#define clockevents_notify(reason, arg) do { } while (0) 138#define clockevents_notify(reason, arg) do { } while (0)
135 139
136#endif 140#endif
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 3ec6e7ff5fbd..23932d7741a9 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -32,12 +32,24 @@
32 * CPUFREQ NOTIFIER INTERFACE * 32 * CPUFREQ NOTIFIER INTERFACE *
33 *********************************************************************/ 33 *********************************************************************/
34 34
35int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
36int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
37
38#define CPUFREQ_TRANSITION_NOTIFIER (0) 35#define CPUFREQ_TRANSITION_NOTIFIER (0)
39#define CPUFREQ_POLICY_NOTIFIER (1) 36#define CPUFREQ_POLICY_NOTIFIER (1)
40 37
38#ifdef CONFIG_CPU_FREQ
39int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list);
40int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list);
41#else /* CONFIG_CPU_FREQ */
42static inline int cpufreq_register_notifier(struct notifier_block *nb,
43 unsigned int list)
44{
45 return 0;
46}
47static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
48 unsigned int list)
49{
50 return 0;
51}
52#endif /* CONFIG_CPU_FREQ */
41 53
42/* if (cpufreq_driver->target) exists, the ->governor decides what frequency 54/* if (cpufreq_driver->target) exists, the ->governor decides what frequency
43 * within the limits is used. If (cpufreq_driver->setpolicy> exists, these 55 * within the limits is used. If (cpufreq_driver->setpolicy> exists, these
@@ -155,6 +167,9 @@ struct cpufreq_governor {
155 char name[CPUFREQ_NAME_LEN]; 167 char name[CPUFREQ_NAME_LEN];
156 int (*governor) (struct cpufreq_policy *policy, 168 int (*governor) (struct cpufreq_policy *policy,
157 unsigned int event); 169 unsigned int event);
170 unsigned int max_transition_latency; /* HW must be able to switch to
171 next freq faster than this value in nano secs or we
172 will fallback to performance governor */
158 struct list_head governor_list; 173 struct list_head governor_list;
159 struct module *owner; 174 struct module *owner;
160}; 175};
@@ -279,12 +294,24 @@ static inline unsigned int cpufreq_quick_get(unsigned int cpu)
279 *********************************************************************/ 294 *********************************************************************/
280 295
281 296
282#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE 297/*
298 Performance governor is fallback governor if any other gov failed to
299 auto load due latency restrictions
300*/
301#ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE
283extern struct cpufreq_governor cpufreq_gov_performance; 302extern struct cpufreq_governor cpufreq_gov_performance;
284#define CPUFREQ_DEFAULT_GOVERNOR &cpufreq_gov_performance 303#endif
304#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE
305#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_performance)
285#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE) 306#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE)
286extern struct cpufreq_governor cpufreq_gov_userspace; 307extern struct cpufreq_governor cpufreq_gov_userspace;
287#define CPUFREQ_DEFAULT_GOVERNOR &cpufreq_gov_userspace 308#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_userspace)
309#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND)
310extern struct cpufreq_governor cpufreq_gov_ondemand;
311#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_ondemand)
312#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE)
313extern struct cpufreq_governor cpufreq_gov_conservative;
314#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_conservative)
288#endif 315#endif
289 316
290 317
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 104e51e20e14..f592d6de3b97 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -49,6 +49,12 @@ struct dentry *debugfs_create_u32(const char *name, mode_t mode,
49 struct dentry *parent, u32 *value); 49 struct dentry *parent, u32 *value);
50struct dentry *debugfs_create_u64(const char *name, mode_t mode, 50struct dentry *debugfs_create_u64(const char *name, mode_t mode,
51 struct dentry *parent, u64 *value); 51 struct dentry *parent, u64 *value);
52struct dentry *debugfs_create_x8(const char *name, mode_t mode,
53 struct dentry *parent, u8 *value);
54struct dentry *debugfs_create_x16(const char *name, mode_t mode,
55 struct dentry *parent, u16 *value);
56struct dentry *debugfs_create_x32(const char *name, mode_t mode,
57 struct dentry *parent, u32 *value);
52struct dentry *debugfs_create_bool(const char *name, mode_t mode, 58struct dentry *debugfs_create_bool(const char *name, mode_t mode,
53 struct dentry *parent, u32 *value); 59 struct dentry *parent, u32 *value);
54 60
@@ -122,6 +128,27 @@ static inline struct dentry *debugfs_create_u64(const char *name, mode_t mode,
122 return ERR_PTR(-ENODEV); 128 return ERR_PTR(-ENODEV);
123} 129}
124 130
131static inline struct dentry *debugfs_create_x8(const char *name, mode_t mode,
132 struct dentry *parent,
133 u8 *value)
134{
135 return ERR_PTR(-ENODEV);
136}
137
138static inline struct dentry *debugfs_create_x16(const char *name, mode_t mode,
139 struct dentry *parent,
140 u16 *value)
141{
142 return ERR_PTR(-ENODEV);
143}
144
145static inline struct dentry *debugfs_create_x32(const char *name, mode_t mode,
146 struct dentry *parent,
147 u32 *value)
148{
149 return ERR_PTR(-ENODEV);
150}
151
125static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode, 152static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode,
126 struct dentry *parent, 153 struct dentry *parent,
127 u32 *value) 154 u32 *value)
diff --git a/include/linux/device.h b/include/linux/device.h
index 3a38d1f70cb7..2e15822fe409 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -64,12 +64,9 @@ struct bus_type {
64 struct bus_attribute * bus_attrs; 64 struct bus_attribute * bus_attrs;
65 struct device_attribute * dev_attrs; 65 struct device_attribute * dev_attrs;
66 struct driver_attribute * drv_attrs; 66 struct driver_attribute * drv_attrs;
67 struct bus_attribute drivers_autoprobe_attr;
68 struct bus_attribute drivers_probe_attr;
69 67
70 int (*match)(struct device * dev, struct device_driver * drv); 68 int (*match)(struct device * dev, struct device_driver * drv);
71 int (*uevent)(struct device *dev, char **envp, 69 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
72 int num_envp, char *buffer, int buffer_size);
73 int (*probe)(struct device * dev); 70 int (*probe)(struct device * dev);
74 int (*remove)(struct device * dev); 71 int (*remove)(struct device * dev);
75 void (*shutdown)(struct device * dev); 72 void (*shutdown)(struct device * dev);
@@ -189,10 +186,8 @@ struct class {
189 struct class_device_attribute * class_dev_attrs; 186 struct class_device_attribute * class_dev_attrs;
190 struct device_attribute * dev_attrs; 187 struct device_attribute * dev_attrs;
191 188
192 int (*uevent)(struct class_device *dev, char **envp, 189 int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env);
193 int num_envp, char *buffer, int buffer_size); 190 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
194 int (*dev_uevent)(struct device *dev, char **envp, int num_envp,
195 char *buffer, int buffer_size);
196 191
197 void (*release)(struct class_device *dev); 192 void (*release)(struct class_device *dev);
198 void (*class_release)(struct class *class); 193 void (*class_release)(struct class *class);
@@ -268,8 +263,7 @@ struct class_device {
268 struct attribute_group ** groups; /* optional groups */ 263 struct attribute_group ** groups; /* optional groups */
269 264
270 void (*release)(struct class_device *dev); 265 void (*release)(struct class_device *dev);
271 int (*uevent)(struct class_device *dev, char **envp, 266 int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env);
272 int num_envp, char *buffer, int buffer_size);
273 char class_id[BUS_ID_SIZE]; /* unique to this class */ 267 char class_id[BUS_ID_SIZE]; /* unique to this class */
274}; 268};
275 269
@@ -337,8 +331,7 @@ extern void class_device_destroy(struct class *cls, dev_t devt);
337struct device_type { 331struct device_type {
338 const char *name; 332 const char *name;
339 struct attribute_group **groups; 333 struct attribute_group **groups;
340 int (*uevent)(struct device *dev, char **envp, int num_envp, 334 int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
341 char *buffer, int buffer_size);
342 void (*release)(struct device *dev); 335 void (*release)(struct device *dev);
343 int (*suspend)(struct device * dev, pm_message_t state); 336 int (*suspend)(struct device * dev, pm_message_t state);
344 int (*resume)(struct device * dev); 337 int (*resume)(struct device * dev);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 16421f662a7a..4a6a21077bae 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -883,6 +883,7 @@ extern int vfs_setlease(struct file *, long, struct file_lock **);
883extern int lease_modify(struct file_lock **, int); 883extern int lease_modify(struct file_lock **, int);
884extern int lock_may_read(struct inode *, loff_t start, unsigned long count); 884extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
885extern int lock_may_write(struct inode *, loff_t start, unsigned long count); 885extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
886extern struct seq_operations locks_seq_operations;
886 887
887struct fasync_struct { 888struct fasync_struct {
888 int magic; 889 int magic;
@@ -1302,8 +1303,14 @@ struct file_system_type {
1302 struct module *owner; 1303 struct module *owner;
1303 struct file_system_type * next; 1304 struct file_system_type * next;
1304 struct list_head fs_supers; 1305 struct list_head fs_supers;
1306
1305 struct lock_class_key s_lock_key; 1307 struct lock_class_key s_lock_key;
1306 struct lock_class_key s_umount_key; 1308 struct lock_class_key s_umount_key;
1309
1310 struct lock_class_key i_lock_key;
1311 struct lock_class_key i_mutex_key;
1312 struct lock_class_key i_mutex_dir_key;
1313 struct lock_class_key i_alloc_sem_key;
1307}; 1314};
1308 1315
1309extern int get_sb_bdev(struct file_system_type *fs_type, 1316extern int get_sb_bdev(struct file_system_type *fs_type,
@@ -1369,12 +1376,25 @@ extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size
1369 * Candidates for mandatory locking have the setgid bit set 1376 * Candidates for mandatory locking have the setgid bit set
1370 * but no group execute bit - an otherwise meaningless combination. 1377 * but no group execute bit - an otherwise meaningless combination.
1371 */ 1378 */
1372#define MANDATORY_LOCK(inode) \ 1379
1373 (IS_MANDLOCK(inode) && ((inode)->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID) 1380static inline int __mandatory_lock(struct inode *ino)
1381{
1382 return (ino->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID;
1383}
1384
1385/*
1386 * ... and these candidates should be on MS_MANDLOCK mounted fs,
1387 * otherwise these will be advisory locks
1388 */
1389
1390static inline int mandatory_lock(struct inode *ino)
1391{
1392 return IS_MANDLOCK(ino) && __mandatory_lock(ino);
1393}
1374 1394
1375static inline int locks_verify_locked(struct inode *inode) 1395static inline int locks_verify_locked(struct inode *inode)
1376{ 1396{
1377 if (MANDATORY_LOCK(inode)) 1397 if (mandatory_lock(inode))
1378 return locks_mandatory_locked(inode); 1398 return locks_mandatory_locked(inode);
1379 return 0; 1399 return 0;
1380} 1400}
@@ -1385,7 +1405,7 @@ static inline int locks_verify_truncate(struct inode *inode,
1385 struct file *filp, 1405 struct file *filp,
1386 loff_t size) 1406 loff_t size)
1387{ 1407{
1388 if (inode->i_flock && MANDATORY_LOCK(inode)) 1408 if (inode->i_flock && mandatory_lock(inode))
1389 return locks_mandatory_area( 1409 return locks_mandatory_area(
1390 FLOCK_VERIFY_WRITE, inode, filp, 1410 FLOCK_VERIFY_WRITE, inode, filp,
1391 size < inode->i_size ? size : inode->i_size, 1411 size < inode->i_size ? size : inode->i_size,
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h
index a44a6a078f0a..c3c19f926e6f 100644
--- a/include/linux/gfs2_ondisk.h
+++ b/include/linux/gfs2_ondisk.h
@@ -170,6 +170,33 @@ struct gfs2_rgrp {
170}; 170};
171 171
172/* 172/*
173 * quota linked list: user quotas and group quotas form two separate
174 * singly linked lists. ll_next stores uids or gids of next quotas in the
175 * linked list.
176
177Given the uid/gid, how to calculate the quota file offsets for the corresponding
178gfs2_quota structures on disk:
179
180for user quotas, given uid,
181offset = uid * sizeof(struct gfs2_quota);
182
183for group quotas, given gid,
184offset = (gid * sizeof(struct gfs2_quota)) + sizeof(struct gfs2_quota);
185
186
187 uid:0 gid:0 uid:12 gid:12 uid:17 gid:17 uid:5142 gid:5142
188+-------+-------+ +-------+-------+ +-------+- - - -+ +- - - -+-------+
189| valid | valid | :: | valid | valid | :: | valid | inval | :: | inval | valid |
190+-------+-------+ +-------+-------+ +-------+- - - -+ +- - - -+-------+
191next:12 next:12 next:17 next:5142 next:NULL next:NULL
192 | | | | |<-- user quota list |
193 \______|___________/ \______|___________/ group quota list -->|
194 | | |
195 \__________________/ \_______________________________________/
196
197*/
198
199/*
173 * quota structure 200 * quota structure
174 */ 201 */
175 202
@@ -177,7 +204,8 @@ struct gfs2_quota {
177 __be64 qu_limit; 204 __be64 qu_limit;
178 __be64 qu_warn; 205 __be64 qu_warn;
179 __be64 qu_value; 206 __be64 qu_value;
180 __u8 qu_reserved[64]; 207 __be32 qu_ll_next; /* location of next quota in list */
208 __u8 qu_reserved[60];
181}; 209};
182 210
183/* 211/*
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index 265d17830a0f..c6d3a9de5634 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -8,6 +8,7 @@ struct gpio_keys_button {
8 int active_low; 8 int active_low;
9 char *desc; 9 char *desc;
10 int type; /* input event type (EV_KEY, EV_SW) */ 10 int type; /* input event type (EV_KEY, EV_SW) */
11 int wakeup; /* configure the button as a wake-up source */
11}; 12};
12 13
13struct gpio_keys_platform_data { 14struct gpio_keys_platform_data {
diff --git a/include/linux/hdlcdrv.h b/include/linux/hdlcdrv.h
index 4f6ee3b267fa..bf6302f6b5f8 100644
--- a/include/linux/hdlcdrv.h
+++ b/include/linux/hdlcdrv.h
@@ -200,7 +200,7 @@ struct hdlcdrv_state {
200 200
201 struct hdlcdrv_hdlcrx { 201 struct hdlcdrv_hdlcrx {
202 struct hdlcdrv_hdlcbuffer hbuf; 202 struct hdlcdrv_hdlcbuffer hbuf;
203 long in_hdlc_rx; 203 unsigned long in_hdlc_rx;
204 /* 0 = sync hunt, != 0 receiving */ 204 /* 0 = sync hunt, != 0 receiving */
205 int rx_state; 205 int rx_state;
206 unsigned int bitstream; 206 unsigned int bitstream;
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 898103b401f1..edb8024d744b 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -29,13 +29,6 @@
29 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic 29 * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
30 */ 30 */
31 31
32#include <linux/types.h>
33#include <linux/slab.h>
34#include <linux/list.h>
35#include <linux/timer.h>
36#include <linux/workqueue.h>
37#include <linux/input.h>
38
39/* 32/*
40 * USB HID (Human Interface Device) interface class code 33 * USB HID (Human Interface Device) interface class code
41 */ 34 */
@@ -69,6 +62,17 @@
69#define HID_DT_REPORT (USB_TYPE_CLASS | 0x02) 62#define HID_DT_REPORT (USB_TYPE_CLASS | 0x02)
70#define HID_DT_PHYSICAL (USB_TYPE_CLASS | 0x03) 63#define HID_DT_PHYSICAL (USB_TYPE_CLASS | 0x03)
71 64
65#define HID_MAX_DESCRIPTOR_SIZE 4096
66
67#ifdef __KERNEL__
68
69#include <linux/types.h>
70#include <linux/slab.h>
71#include <linux/list.h>
72#include <linux/timer.h>
73#include <linux/workqueue.h>
74#include <linux/input.h>
75
72/* 76/*
73 * We parse each description item into this structure. Short items data 77 * We parse each description item into this structure. Short items data
74 * values are expanded to 32-bit signed int, long items contain a pointer 78 * values are expanded to 32-bit signed int, long items contain a pointer
@@ -276,6 +280,7 @@ struct hid_item {
276#define HID_QUIRK_HIDINPUT 0x00200000 280#define HID_QUIRK_HIDINPUT 0x00200000
277#define HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL 0x00400000 281#define HID_QUIRK_LOGITECH_IGNORE_DOUBLED_WHEEL 0x00400000
278#define HID_QUIRK_LOGITECH_EXPANDED_KEYMAP 0x00800000 282#define HID_QUIRK_LOGITECH_EXPANDED_KEYMAP 0x00800000
283#define HID_QUIRK_IGNORE_HIDINPUT 0x01000000
279 284
280/* 285/*
281 * Separate quirks for runtime report descriptor fixup 286 * Separate quirks for runtime report descriptor fixup
@@ -285,6 +290,7 @@ struct hid_item {
285#define HID_QUIRK_RDESC_LOGITECH 0x00000002 290#define HID_QUIRK_RDESC_LOGITECH 0x00000002
286#define HID_QUIRK_RDESC_SWAPPED_MIN_MAX 0x00000004 291#define HID_QUIRK_RDESC_SWAPPED_MIN_MAX 0x00000004
287#define HID_QUIRK_RDESC_PETALYNX 0x00000008 292#define HID_QUIRK_RDESC_PETALYNX 0x00000008
293#define HID_QUIRK_RDESC_MACBOOK_JIS 0x00000010
288 294
289/* 295/*
290 * This is the global environment of the parser. This information is 296 * This is the global environment of the parser. This information is
@@ -309,7 +315,6 @@ struct hid_global {
309 * This is the local environment. It is persistent up the next main-item. 315 * This is the local environment. It is persistent up the next main-item.
310 */ 316 */
311 317
312#define HID_MAX_DESCRIPTOR_SIZE 4096
313#define HID_MAX_USAGES 8192 318#define HID_MAX_USAGES 8192
314#define HID_DEFAULT_NUM_COLLECTIONS 16 319#define HID_DEFAULT_NUM_COLLECTIONS 16
315 320
@@ -403,6 +408,7 @@ struct hid_control_fifo {
403 408
404#define HID_CLAIMED_INPUT 1 409#define HID_CLAIMED_INPUT 1
405#define HID_CLAIMED_HIDDEV 2 410#define HID_CLAIMED_HIDDEV 2
411#define HID_CLAIMED_HIDRAW 4
406 412
407#define HID_CTRL_RUNNING 1 413#define HID_CTRL_RUNNING 1
408#define HID_OUT_RUNNING 2 414#define HID_OUT_RUNNING 2
@@ -438,6 +444,7 @@ struct hid_device { /* device report descriptor */
438 444
439 struct list_head inputs; /* The list of inputs */ 445 struct list_head inputs; /* The list of inputs */
440 void *hiddev; /* The hiddev structure */ 446 void *hiddev; /* The hiddev structure */
447 void *hidraw;
441 int minor; /* Hiddev minor number */ 448 int minor; /* Hiddev minor number */
442 449
443 wait_queue_head_t wait; /* For sleeping */ 450 wait_queue_head_t wait; /* For sleeping */
@@ -458,6 +465,9 @@ struct hid_device { /* device report descriptor */
458 void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field, 465 void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field,
459 struct hid_usage *, __s32); 466 struct hid_usage *, __s32);
460 void (*hiddev_report_event) (struct hid_device *, struct hid_report *); 467 void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
468
469 /* handler for raw output data, used by hidraw */
470 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t);
461#ifdef CONFIG_USB_HIDINPUT_POWERBOOK 471#ifdef CONFIG_USB_HIDINPUT_POWERBOOK
462 unsigned long pb_pressed_fn[NBITS(KEY_MAX)]; 472 unsigned long pb_pressed_fn[NBITS(KEY_MAX)];
463 unsigned long pb_pressed_numlock[NBITS(KEY_MAX)]; 473 unsigned long pb_pressed_numlock[NBITS(KEY_MAX)];
@@ -553,4 +563,5 @@ static inline int hid_ff_init(struct hid_device *hid) { return -1; }
553#define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ 563#define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \
554 __FILE__ , ## arg) 564 __FILE__ , ## arg)
555#endif 565#endif
566#endif
556 567
diff --git a/include/linux/hidraw.h b/include/linux/hidraw.h
new file mode 100644
index 000000000000..0536f299f7ff
--- /dev/null
+++ b/include/linux/hidraw.h
@@ -0,0 +1,86 @@
1#ifndef _HIDRAW_H
2#define _HIDRAW_H
3
4/*
5 * Copyright (c) 2007 Jiri Kosina
6 */
7
8/*
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms and conditions of the GNU General Public License,
11 * version 2, as published by the Free Software Foundation.
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.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 */
17
18#include <linux/hid.h>
19
20struct hidraw_report_descriptor {
21 __u32 size;
22 __u8 value[HID_MAX_DESCRIPTOR_SIZE];
23};
24
25struct hidraw_devinfo {
26 __u32 bustype;
27 __s16 vendor;
28 __s16 product;
29};
30
31/* ioctl interface */
32#define HIDIOCGRDESCSIZE _IOR('H', 0x01, int)
33#define HIDIOCGRDESC _IOR('H', 0x02, struct hidraw_report_descriptor)
34#define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo)
35
36#define HIDRAW_FIRST_MINOR 0
37#define HIDRAW_MAX_DEVICES 64
38/* number of reports to buffer */
39#define HIDRAW_BUFFER_SIZE 64
40
41
42/* kernel-only API declarations */
43#ifdef __KERNEL__
44
45struct hidraw {
46 unsigned int minor;
47 int exist;
48 int open;
49 wait_queue_head_t wait;
50 struct hid_device *hid;
51 struct device *dev;
52 struct list_head list;
53};
54
55struct hidraw_report {
56 __u8 *value;
57 int len;
58};
59
60struct hidraw_list {
61 struct hidraw_report buffer[HIDRAW_BUFFER_SIZE];
62 int head;
63 int tail;
64 struct fasync_struct *fasync;
65 struct hidraw *hidraw;
66 struct list_head node;
67 struct mutex read_mutex;
68};
69
70#ifdef CONFIG_HIDRAW
71int hidraw_init(void);
72void hidraw_exit(void);
73void hidraw_report_event(struct hid_device *, u8 *, int);
74int hidraw_connect(struct hid_device *);
75void hidraw_disconnect(struct hid_device *);
76#else
77static inline int hidraw_init(void) { return 0; }
78static inline void hidraw_exit(void) { }
79static inline void hidraw_report_event(struct hid_device *hid, u8 *data, int len) { }
80static inline int hidraw_connect(struct hid_device *hid) { return -1; }
81static inline void hidraw_disconnect(struct hid_device *hid) { }
82#endif
83
84#endif
85
86#endif
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index 0efd994c37f1..6b6ee702b007 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -16,9 +16,9 @@
16 16
17#include <linux/device.h> 17#include <linux/device.h>
18 18
19struct class_device *hwmon_device_register(struct device *dev); 19struct device *hwmon_device_register(struct device *dev);
20 20
21void hwmon_device_unregister(struct class_device *cdev); 21void hwmon_device_unregister(struct device *dev);
22 22
23/* Scale user input to sensible values */ 23/* Scale user input to sensible values */
24static inline int SENSORS_LIMIT(long value, long low, long high) 24static inline int SENSORS_LIMIT(long value, long low, long high)
diff --git a/include/linux/i2c-dev.h b/include/linux/i2c-dev.h
index 81c229a0fbca..311315b56b61 100644
--- a/include/linux/i2c-dev.h
+++ b/include/linux/i2c-dev.h
@@ -25,8 +25,31 @@
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/compiler.h> 26#include <linux/compiler.h>
27 27
28/* Some IOCTL commands are defined in <linux/i2c.h> */ 28/* /dev/i2c-X ioctl commands. The ioctl's parameter is always an
29/* Note: 10-bit addresses are NOT supported! */ 29 * unsigned long, except for:
30 * - I2C_FUNCS, takes pointer to an unsigned long
31 * - I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data
32 * - I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data
33 */
34#define I2C_RETRIES 0x0701 /* number of times a device address should
35 be polled when not acknowledging */
36#define I2C_TIMEOUT 0x0702 /* set timeout in jiffies - call with int */
37
38/* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses
39 * are NOT supported! (due to code brokenness)
40 */
41#define I2C_SLAVE 0x0703 /* Use this slave address */
42#define I2C_SLAVE_FORCE 0x0706 /* Use this slave address, even if it
43 is already in use by a driver! */
44#define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */
45
46#define I2C_FUNCS 0x0705 /* Get the adapter functionality mask */
47
48#define I2C_RDWR 0x0707 /* Combined R/W transfer (one STOP only) */
49
50#define I2C_PEC 0x0708 /* != 0 to use PEC with SMBus */
51#define I2C_SMBUS 0x0720 /* SMBus transfer */
52
30 53
31/* This is the structure as used in the I2C_SMBUS ioctl call */ 54/* This is the structure as used in the I2C_SMBUS ioctl call */
32struct i2c_smbus_ioctl_data { 55struct i2c_smbus_ioctl_data {
@@ -44,4 +67,8 @@ struct i2c_rdwr_ioctl_data {
44 67
45#define I2C_RDRW_IOCTL_MAX_MSGS 42 68#define I2C_RDRW_IOCTL_MAX_MSGS 42
46 69
70#ifdef __KERNEL__
71#define I2C_MAJOR 89 /* Device major number */
72#endif
73
47#endif /* _LINUX_I2C_DEV_H */ 74#endif /* _LINUX_I2C_DEV_H */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 2a32f2fd940d..8033e6b33271 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -35,8 +35,6 @@
35#include <linux/sched.h> /* for completion */ 35#include <linux/sched.h> /* for completion */
36#include <linux/mutex.h> 36#include <linux/mutex.h>
37 37
38extern struct bus_type i2c_bus_type;
39
40/* --- General options ------------------------------------------------ */ 38/* --- General options ------------------------------------------------ */
41 39
42struct i2c_msg; 40struct i2c_msg;
@@ -292,9 +290,6 @@ struct i2c_algorithm {
292 unsigned short flags, char read_write, 290 unsigned short flags, char read_write,
293 u8 command, int size, union i2c_smbus_data * data); 291 u8 command, int size, union i2c_smbus_data * data);
294 292
295 /* --- ioctl like call to set div. parameters. */
296 int (*algo_control)(struct i2c_adapter *, unsigned int, unsigned long);
297
298 /* To determine what the adapter supports */ 293 /* To determine what the adapter supports */
299 u32 (*functionality) (struct i2c_adapter *); 294 u32 (*functionality) (struct i2c_adapter *);
300}; 295};
@@ -342,9 +337,10 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data)
342} 337}
343 338
344/*flags for the client struct: */ 339/*flags for the client struct: */
345#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ 340#define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */
346#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */ 341#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */
347 /* Must equal I2C_M_TEN below */ 342 /* Must equal I2C_M_TEN below */
343#define I2C_CLIENT_WAKE 0x80 /* for board_info; true iff can wake */
348 344
349/* i2c adapter classes (bitmask) */ 345/* i2c adapter classes (bitmask) */
350#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ 346#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */
@@ -417,10 +413,6 @@ extern int i2c_probe(struct i2c_adapter *adapter,
417 struct i2c_client_address_data *address_data, 413 struct i2c_client_address_data *address_data,
418 int (*found_proc) (struct i2c_adapter *, int, int)); 414 int (*found_proc) (struct i2c_adapter *, int, int));
419 415
420/* An ioctl like call to set div. parameters of the adapter.
421 */
422extern int i2c_control(struct i2c_client *,unsigned int, unsigned long);
423
424extern struct i2c_adapter* i2c_get_adapter(int id); 416extern struct i2c_adapter* i2c_get_adapter(int id);
425extern void i2c_put_adapter(struct i2c_adapter *adap); 417extern void i2c_put_adapter(struct i2c_adapter *adap);
426 418
@@ -444,19 +436,52 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap)
444} 436}
445#endif /* __KERNEL__ */ 437#endif /* __KERNEL__ */
446 438
447/* 439/**
448 * I2C Message - used for pure i2c transaction, also from /dev interface 440 * struct i2c_msg - an I2C transaction segment beginning with START
441 * @addr: Slave address, either seven or ten bits. When this is a ten
442 * bit address, I2C_M_TEN must be set in @flags and the adapter
443 * must support I2C_FUNC_10BIT_ADDR.
444 * @flags: I2C_M_RD is handled by all adapters. No other flags may be
445 * provided unless the adapter exported the relevant I2C_FUNC_*
446 * flags through i2c_check_functionality().
447 * @len: Number of data bytes in @buf being read from or written to the
448 * I2C slave address. For read transactions where I2C_M_RECV_LEN
449 * is set, the caller guarantees that this buffer can hold up to
450 * 32 bytes in addition to the initial length byte sent by the
451 * slave (plus, if used, the SMBus PEC); and this value will be
452 * incremented by the number of block data bytes received.
453 * @buf: The buffer into which data is read, or from which it's written.
454 *
455 * An i2c_msg is the low level representation of one segment of an I2C
456 * transaction. It is visible to drivers in the @i2c_transfer() procedure,
457 * to userspace from i2c-dev, and to I2C adapter drivers through the
458 * @i2c_adapter.@master_xfer() method.
459 *
460 * Except when I2C "protocol mangling" is used, all I2C adapters implement
461 * the standard rules for I2C transactions. Each transaction begins with a
462 * START. That is followed by the slave address, and a bit encoding read
463 * versus write. Then follow all the data bytes, possibly including a byte
464 * with SMBus PEC. The transfer terminates with a NAK, or when all those
465 * bytes have been transferred and ACKed. If this is the last message in a
466 * group, it is followed by a STOP. Otherwise it is followed by the next
467 * @i2c_msg transaction segment, beginning with a (repeated) START.
468 *
469 * Alternatively, when the adapter supports I2C_FUNC_PROTOCOL_MANGLING then
470 * passing certain @flags may have changed those standard protocol behaviors.
471 * Those flags are only for use with broken/nonconforming slaves, and with
472 * adapters which are known to support the specific mangling options they
473 * need (one or more of IGNORE_NAK, NO_RD_ACK, NOSTART, and REV_DIR_ADDR).
449 */ 474 */
450struct i2c_msg { 475struct i2c_msg {
451 __u16 addr; /* slave address */ 476 __u16 addr; /* slave address */
452 __u16 flags; 477 __u16 flags;
453#define I2C_M_TEN 0x10 /* we have a ten bit chip address */ 478#define I2C_M_TEN 0x0010 /* this is a ten bit chip address */
454#define I2C_M_RD 0x01 479#define I2C_M_RD 0x0001 /* read data, from slave to master */
455#define I2C_M_NOSTART 0x4000 480#define I2C_M_NOSTART 0x4000 /* if I2C_FUNC_PROTOCOL_MANGLING */
456#define I2C_M_REV_DIR_ADDR 0x2000 481#define I2C_M_REV_DIR_ADDR 0x2000 /* if I2C_FUNC_PROTOCOL_MANGLING */
457#define I2C_M_IGNORE_NAK 0x1000 482#define I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */
458#define I2C_M_NO_RD_ACK 0x0800 483#define I2C_M_NO_RD_ACK 0x0800 /* if I2C_FUNC_PROTOCOL_MANGLING */
459#define I2C_M_RECV_LEN 0x0400 /* length will be first received byte */ 484#define I2C_M_RECV_LEN 0x0400 /* length will be first received byte */
460 __u16 len; /* msg length */ 485 __u16 len; /* msg length */
461 __u8 *buf; /* pointer to msg data */ 486 __u8 *buf; /* pointer to msg data */
462}; 487};
@@ -466,7 +491,7 @@ struct i2c_msg {
466#define I2C_FUNC_I2C 0x00000001 491#define I2C_FUNC_I2C 0x00000001
467#define I2C_FUNC_10BIT_ADDR 0x00000002 492#define I2C_FUNC_10BIT_ADDR 0x00000002
468#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */ 493#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */
469#define I2C_FUNC_SMBUS_HWPEC_CALC 0x00000008 /* SMBus 2.0 */ 494#define I2C_FUNC_SMBUS_PEC 0x00000008
470#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ 495#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */
471#define I2C_FUNC_SMBUS_QUICK 0x00010000 496#define I2C_FUNC_SMBUS_QUICK 0x00010000
472#define I2C_FUNC_SMBUS_READ_BYTE 0x00020000 497#define I2C_FUNC_SMBUS_READ_BYTE 0x00020000
@@ -502,7 +527,8 @@ struct i2c_msg {
502 I2C_FUNC_SMBUS_WORD_DATA | \ 527 I2C_FUNC_SMBUS_WORD_DATA | \
503 I2C_FUNC_SMBUS_PROC_CALL | \ 528 I2C_FUNC_SMBUS_PROC_CALL | \
504 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \ 529 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \
505 I2C_FUNC_SMBUS_I2C_BLOCK) 530 I2C_FUNC_SMBUS_I2C_BLOCK | \
531 I2C_FUNC_SMBUS_PEC)
506 532
507/* 533/*
508 * Data for SMBus Messages 534 * Data for SMBus Messages
@@ -532,38 +558,8 @@ union i2c_smbus_data {
532#define I2C_SMBUS_I2C_BLOCK_DATA 8 558#define I2C_SMBUS_I2C_BLOCK_DATA 8
533 559
534 560
535/* ----- commands for the ioctl like i2c_command call:
536 * note that additional calls are defined in the algorithm and hw
537 * dependent layers - these can be listed here, or see the
538 * corresponding header files.
539 */
540 /* -> bit-adapter specific ioctls */
541#define I2C_RETRIES 0x0701 /* number of times a device address */
542 /* should be polled when not */
543 /* acknowledging */
544#define I2C_TIMEOUT 0x0702 /* set timeout - call with int */
545
546
547/* this is for i2c-dev.c */
548#define I2C_SLAVE 0x0703 /* Change slave address */
549 /* Attn.: Slave address is 7 or 10 bits */
550#define I2C_SLAVE_FORCE 0x0706 /* Change slave address */
551 /* Attn.: Slave address is 7 or 10 bits */
552 /* This changes the address, even if it */
553 /* is already taken! */
554#define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */
555
556#define I2C_FUNCS 0x0705 /* Get the adapter functionality */
557#define I2C_RDWR 0x0707 /* Combined R/W transfer (one stop only)*/
558#define I2C_PEC 0x0708 /* != 0 for SMBus PEC */
559
560#define I2C_SMBUS 0x0720 /* SMBus-level access */
561
562/* ----- I2C-DEV: char device interface stuff ------------------------- */
563#ifdef __KERNEL__ 561#ifdef __KERNEL__
564 562
565#define I2C_MAJOR 89 /* Device major number */
566
567/* These defines are used for probing i2c client addresses */ 563/* These defines are used for probing i2c client addresses */
568/* The length of the option lists */ 564/* The length of the option lists */
569#define I2C_CLIENT_MAX_OPTS 48 565#define I2C_CLIENT_MAX_OPTS 48
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 85d448b4abec..02a27e8cbad2 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -681,7 +681,7 @@ typedef struct hwif_s {
681 u8 straight8; /* Alan's straight 8 check */ 681 u8 straight8; /* Alan's straight 8 check */
682 u8 bus_state; /* power state of the IDE bus */ 682 u8 bus_state; /* power state of the IDE bus */
683 683
684 u8 host_flags; 684 u16 host_flags;
685 685
686 u8 pio_mask; 686 u8 pio_mask;
687 687
@@ -702,10 +702,10 @@ typedef struct hwif_s {
702#if 0 702#if 0
703 ide_hwif_ops_t *hwifops; 703 ide_hwif_ops_t *hwifops;
704#else 704#else
705 /* routine to set PIO mode for drives */ 705 /* routine to program host for PIO mode */
706 void (*set_pio_mode)(ide_drive_t *, const u8); 706 void (*set_pio_mode)(ide_drive_t *, const u8);
707 /* routine to retune DMA modes for drives */ 707 /* routine to program host for DMA mode */
708 int (*speedproc)(ide_drive_t *, const u8); 708 void (*set_dma_mode)(ide_drive_t *, const u8);
709 /* tweaks hardware to select drive */ 709 /* tweaks hardware to select drive */
710 void (*selectproc)(ide_drive_t *); 710 void (*selectproc)(ide_drive_t *);
711 /* chipset polling based on hba specifics */ 711 /* chipset polling based on hba specifics */
@@ -1079,16 +1079,7 @@ extern void ide_fix_driveid(struct hd_driveid *);
1079 */ 1079 */
1080extern void ide_fixstring(u8 *, const int, const int); 1080extern void ide_fixstring(u8 *, const int, const int);
1081 1081
1082/* 1082int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
1083 * This routine busy-waits for the drive status to be not "busy".
1084 * It then checks the status for all of the "good" bits and none
1085 * of the "bad" bits, and if all is okay it returns 0. All other
1086 * cases return 1 after doing "*startstop = ide_error()", and the
1087 * caller should return the updated value of "startstop" in this case.
1088 * "startstop" is unchanged when the function returns 0;
1089 * (startstop, drive, good, bad, timeout)
1090 */
1091extern int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long);
1092 1083
1093/* 1084/*
1094 * Start a reset operation for an IDE interface. 1085 * Start a reset operation for an IDE interface.
@@ -1162,7 +1153,6 @@ extern void SELECT_MASK(ide_drive_t *, int);
1162extern void QUIRK_LIST(ide_drive_t *); 1153extern void QUIRK_LIST(ide_drive_t *);
1163 1154
1164extern int drive_is_ready(ide_drive_t *); 1155extern int drive_is_ready(ide_drive_t *);
1165extern int wait_for_ready(ide_drive_t *, int /* timeout */);
1166 1156
1167/* 1157/*
1168 * taskfile io for disks for now...and builds request from ide_ioctl 1158 * taskfile io for disks for now...and builds request from ide_ioctl
@@ -1262,6 +1252,15 @@ enum {
1262 IDE_HFLAG_ABUSE_FAST_DEVSEL = (1 << 5), 1252 IDE_HFLAG_ABUSE_FAST_DEVSEL = (1 << 5),
1263 /* use 100-102 and 200-202 PIO values to set DMA modes */ 1253 /* use 100-102 and 200-202 PIO values to set DMA modes */
1264 IDE_HFLAG_ABUSE_DMA_MODES = (1 << 6), 1254 IDE_HFLAG_ABUSE_DMA_MODES = (1 << 6),
1255 /*
1256 * keep DMA setting when programming PIO mode, may be used only
1257 * for hosts which have separate PIO and DMA timings (ie. PMAC)
1258 */
1259 IDE_HFLAG_SET_PIO_MODE_KEEP_DMA = (1 << 7),
1260 /* program host for the transfer mode after programming device */
1261 IDE_HFLAG_POST_SET_MODE = (1 << 8),
1262 /* don't program host/device for the transfer mode ("smart" hosts) */
1263 IDE_HFLAG_NO_SET_MODE = (1 << 9),
1265}; 1264};
1266 1265
1267typedef struct ide_pci_device_s { 1266typedef struct ide_pci_device_s {
@@ -1278,7 +1277,7 @@ typedef struct ide_pci_device_s {
1278 u8 bootable; 1277 u8 bootable;
1279 unsigned int extra; 1278 unsigned int extra;
1280 struct ide_pci_device_s *next; 1279 struct ide_pci_device_s *next;
1281 u8 host_flags; 1280 u16 host_flags;
1282 u8 pio_mask; 1281 u8 pio_mask;
1283 u8 udma_mask; 1282 u8 udma_mask;
1284} ide_pci_device_t; 1283} ide_pci_device_t;
@@ -1301,7 +1300,6 @@ int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *);
1301 1300
1302#ifdef CONFIG_BLK_DEV_IDEDMA 1301#ifdef CONFIG_BLK_DEV_IDEDMA
1303int __ide_dma_bad_drive(ide_drive_t *); 1302int __ide_dma_bad_drive(ide_drive_t *);
1304int __ide_dma_good_drive(ide_drive_t *);
1305 1303
1306u8 ide_find_dma_mode(ide_drive_t *, u8); 1304u8 ide_find_dma_mode(ide_drive_t *, u8);
1307 1305
@@ -1420,6 +1418,9 @@ unsigned int ide_pio_cycle_time(ide_drive_t *, u8);
1420u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); 1418u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8);
1421extern const ide_pio_timings_t ide_pio_timings[6]; 1419extern const ide_pio_timings_t ide_pio_timings[6];
1422 1420
1421int ide_set_pio_mode(ide_drive_t *, u8);
1422int ide_set_dma_mode(ide_drive_t *, u8);
1423
1423void ide_set_pio(ide_drive_t *, u8); 1424void ide_set_pio(ide_drive_t *, u8);
1424 1425
1425static inline void ide_set_max_pio(ide_drive_t *drive) 1426static inline void ide_set_max_pio(ide_drive_t *drive)
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index 99e3a1a00099..58e43e566457 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -107,7 +107,7 @@ struct __fdb_entry
107extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *)); 107extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
108extern struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p, 108extern struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p,
109 struct sk_buff *skb); 109 struct sk_buff *skb);
110extern int (*br_should_route_hook)(struct sk_buff **pskb); 110extern int (*br_should_route_hook)(struct sk_buff *skb);
111 111
112#endif 112#endif
113 113
diff --git a/include/linux/inet_lro.h b/include/linux/inet_lro.h
index e1fc1d16d3cd..1246d46abbc0 100644
--- a/include/linux/inet_lro.h
+++ b/include/linux/inet_lro.h
@@ -52,14 +52,14 @@ struct net_lro_desc {
52 struct tcphdr *tcph; 52 struct tcphdr *tcph;
53 struct vlan_group *vgrp; 53 struct vlan_group *vgrp;
54 __wsum data_csum; 54 __wsum data_csum;
55 u32 tcp_rcv_tsecr; 55 __be32 tcp_rcv_tsecr;
56 u32 tcp_rcv_tsval; 56 __be32 tcp_rcv_tsval;
57 u32 tcp_ack; 57 __be32 tcp_ack;
58 u32 tcp_next_seq; 58 u32 tcp_next_seq;
59 u32 skb_tot_frags_len; 59 u32 skb_tot_frags_len;
60 u16 ip_tot_len; 60 u16 ip_tot_len;
61 u16 tcp_saw_tstamp; /* timestamps enabled */ 61 u16 tcp_saw_tstamp; /* timestamps enabled */
62 u16 tcp_window; 62 __be16 tcp_window;
63 u16 vlan_tag; 63 u16 vlan_tag;
64 int pkt_aggr_cnt; /* counts aggregated packets */ 64 int pkt_aggr_cnt; /* counts aggregated packets */
65 int vlan_packet; 65 int vlan_packet;
diff --git a/include/linux/input.h b/include/linux/input.h
index 6eb3aead7f1d..f30da6fc08e3 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -523,6 +523,8 @@ struct input_absinfo {
523#define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */ 523#define KEY_ADDRESSBOOK 0x1ad /* AL Contacts/Address Book */
524#define KEY_MESSENGER 0x1ae /* AL Instant Messaging */ 524#define KEY_MESSENGER 0x1ae /* AL Instant Messaging */
525#define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */ 525#define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */
526#define KEY_SPELLCHECK 0x1b0 /* AL Spell Check */
527#define KEY_LOGOFF 0x1b1 /* AL Logoff */
526 528
527#define KEY_DEL_EOL 0x1c0 529#define KEY_DEL_EOL 0x1c0
528#define KEY_DEL_EOS 0x1c1 530#define KEY_DEL_EOS 0x1c1
@@ -854,7 +856,7 @@ struct ff_rumble_effect {
854 * defining effect parameters 856 * defining effect parameters
855 * 857 *
856 * This structure is sent through ioctl from the application to the driver. 858 * This structure is sent through ioctl from the application to the driver.
857 * To create a new effect aplication should set its @id to -1; the kernel 859 * To create a new effect application should set its @id to -1; the kernel
858 * will return assigned @id which can later be used to update or delete 860 * will return assigned @id which can later be used to update or delete
859 * this effect. 861 * this effect.
860 * 862 *
@@ -934,9 +936,82 @@ struct ff_effect {
934#define BIT(x) (1UL<<((x)%BITS_PER_LONG)) 936#define BIT(x) (1UL<<((x)%BITS_PER_LONG))
935#define LONG(x) ((x)/BITS_PER_LONG) 937#define LONG(x) ((x)/BITS_PER_LONG)
936 938
939/**
940 * struct input_dev - represents an input device
941 * @name: name of the device
942 * @phys: physical path to the device in the system hierarchy
943 * @uniq: unique identification code for the device (if device has it)
944 * @id: id of the device (struct input_id)
945 * @evbit: bitmap of types of events supported by the device (EV_KEY,
946 * EV_REL, etc.)
947 * @keybit: bitmap of keys/buttons this device has
948 * @relbit: bitmap of relative axes for the device
949 * @absbit: bitmap of absolute axes for the device
950 * @mscbit: bitmap of miscellaneous events supported by the device
951 * @ledbit: bitmap of leds present on the device
952 * @sndbit: bitmap of sound effects supported by the device
953 * @ffbit: bitmap of force feedback effects supported by the device
954 * @swbit: bitmap of switches present on the device
955 * @keycodemax: size of keycode table
956 * @keycodesize: size of elements in keycode table
957 * @keycode: map of scancodes to keycodes for this device
958 * @setkeycode: optional method to alter current keymap, used to implement
959 * sparse keymaps. If not supplied default mechanism will be used
960 * @getkeycode: optional method to retrieve current keymap. If not supplied
961 * default mechanism will be used
962 * @ff: force feedback structure associated with the device if device
963 * supports force feedback effects
964 * @repeat_key: stores key code of the last key pressed; used to implement
965 * software autorepeat
966 * @timer: timer for software autorepeat
967 * @sync: set to 1 when there were no new events since last EV_SYNC
968 * @abs: current values for reports from absolute axes
969 * @rep: current values for autorepeat parameters (delay, rate)
970 * @key: reflects current state of device's keys/buttons
971 * @led: reflects current state of device's LEDs
972 * @snd: reflects current state of sound effects
973 * @sw: reflects current state of device's switches
974 * @absmax: maximum values for events coming from absolute axes
975 * @absmin: minimum values for events coming from absolute axes
976 * @absfuzz: describes noisiness for axes
977 * @absflat: size of the center flat position (used by joydev)
978 * @open: this method is called when the very first user calls
979 * input_open_device(). The driver must prepare the device
980 * to start generating events (start polling thread,
981 * request an IRQ, submit URB, etc.)
982 * @close: this method is called when the very last user calls
983 * input_close_device().
984 * @flush: purges the device. Most commonly used to get rid of force
985 * feedback effects loaded into the device when disconnecting
986 * from it
987 * @event: event handler for events sent _to_ the device, like EV_LED
988 * or EV_SND. The device is expected to carry out the requested
989 * action (turn on a LED, play sound, etc.) The call is protected
990 * by @event_lock and must not sleep
991 * @grab: input handle that currently has the device grabbed (via
992 * EVIOCGRAB ioctl). When a handle grabs a device it becomes sole
993 * recipient for all input events coming from the device
994 * @event_lock: this spinlock is is taken when input core receives
995 * and processes a new event for the device (in input_event()).
996 * Code that accesses and/or modifies parameters of a device
997 * (such as keymap or absmin, absmax, absfuzz, etc.) after device
998 * has been registered with input core must take this lock.
999 * @mutex: serializes calls to open(), close() and flush() methods
1000 * @users: stores number of users (input handlers) that opened this
1001 * device. It is used by input_open_device() and input_close_device()
1002 * to make sure that dev->open() is only called when the first
1003 * user opens device and dev->close() is called when the very
1004 * last user closes the device
1005 * @going_away: marks devices that are in a middle of unregistering and
1006 * causes input_open_device*() fail with -ENODEV.
1007 * @dev: driver model's view of this device
1008 * @h_list: list of input handles associated with the device. When
1009 * accessing the list dev->mutex must be held
1010 * @node: used to place the device onto input_dev_list
1011 */
937struct input_dev { 1012struct input_dev {
938 1013
939 void *private; 1014 void *private; /* do not use */
940 1015
941 const char *name; 1016 const char *name;
942 const char *phys; 1017 const char *phys;
@@ -964,8 +1039,6 @@ struct input_dev {
964 unsigned int repeat_key; 1039 unsigned int repeat_key;
965 struct timer_list timer; 1040 struct timer_list timer;
966 1041
967 int state;
968
969 int sync; 1042 int sync;
970 1043
971 int abs[ABS_MAX + 1]; 1044 int abs[ABS_MAX + 1];
@@ -988,8 +1061,11 @@ struct input_dev {
988 1061
989 struct input_handle *grab; 1062 struct input_handle *grab;
990 1063
991 struct mutex mutex; /* serializes open and close operations */ 1064 spinlock_t event_lock;
1065 struct mutex mutex;
1066
992 unsigned int users; 1067 unsigned int users;
1068 int going_away;
993 1069
994 struct device dev; 1070 struct device dev;
995 union { /* temporarily so while we switching to struct device */ 1071 union { /* temporarily so while we switching to struct device */
@@ -1055,7 +1131,9 @@ struct input_handle;
1055/** 1131/**
1056 * struct input_handler - implements one of interfaces for input devices 1132 * struct input_handler - implements one of interfaces for input devices
1057 * @private: driver-specific data 1133 * @private: driver-specific data
1058 * @event: event handler 1134 * @event: event handler. This method is being called by input core with
1135 * interrupts disabled and dev->event_lock spinlock held and so
1136 * it may not sleep
1059 * @connect: called when attaching a handler to an input device 1137 * @connect: called when attaching a handler to an input device
1060 * @disconnect: disconnects a handler from input device 1138 * @disconnect: disconnects a handler from input device
1061 * @start: starts handler for given handle. This function is called by 1139 * @start: starts handler for given handle. This function is called by
@@ -1067,10 +1145,18 @@ struct input_handle;
1067 * @name: name of the handler, to be shown in /proc/bus/input/handlers 1145 * @name: name of the handler, to be shown in /proc/bus/input/handlers
1068 * @id_table: pointer to a table of input_device_ids this driver can 1146 * @id_table: pointer to a table of input_device_ids this driver can
1069 * handle 1147 * handle
1070 * @blacklist: prointer to a table of input_device_ids this driver should 1148 * @blacklist: pointer to a table of input_device_ids this driver should
1071 * ignore even if they match @id_table 1149 * ignore even if they match @id_table
1072 * @h_list: list of input handles associated with the handler 1150 * @h_list: list of input handles associated with the handler
1073 * @node: for placing the driver onto input_handler_list 1151 * @node: for placing the driver onto input_handler_list
1152 *
1153 * Input handlers attach to input devices and create input handles. There
1154 * are likely several handlers attached to any given input device at the
1155 * same time. All of them will get their copy of input event generated by
1156 * the device.
1157 *
1158 * Note that input core serializes calls to connect() and disconnect()
1159 * methods.
1074 */ 1160 */
1075struct input_handler { 1161struct input_handler {
1076 1162
@@ -1092,6 +1178,18 @@ struct input_handler {
1092 struct list_head node; 1178 struct list_head node;
1093}; 1179};
1094 1180
1181/**
1182 * struct input_handle - links input device with an input handler
1183 * @private: handler-specific data
1184 * @open: counter showing whether the handle is 'open', i.e. should deliver
1185 * events from its device
1186 * @name: name given to the handle by handler that created it
1187 * @dev: input device the handle is attached to
1188 * @handler: handler that works with the device through this handle
1189 * @d_node: used to put the handle on device's list of attached handles
1190 * @h_node: used to put the handle on handler's list of handles from which
1191 * it gets events
1192 */
1095struct input_handle { 1193struct input_handle {
1096 1194
1097 void *private; 1195 void *private;
@@ -1134,10 +1232,10 @@ static inline void input_set_drvdata(struct input_dev *dev, void *data)
1134 dev->private = data; 1232 dev->private = data;
1135} 1233}
1136 1234
1137int input_register_device(struct input_dev *); 1235int __must_check input_register_device(struct input_dev *);
1138void input_unregister_device(struct input_dev *); 1236void input_unregister_device(struct input_dev *);
1139 1237
1140int input_register_handler(struct input_handler *); 1238int __must_check input_register_handler(struct input_handler *);
1141void input_unregister_handler(struct input_handler *); 1239void input_unregister_handler(struct input_handler *);
1142 1240
1143int input_register_handle(struct input_handle *); 1241int input_register_handle(struct input_handle *);
@@ -1214,7 +1312,7 @@ extern struct class input_class;
1214 * @max_effects: maximum number of effects supported by device 1312 * @max_effects: maximum number of effects supported by device
1215 * @effects: pointer to an array of effects currently loaded into device 1313 * @effects: pointer to an array of effects currently loaded into device
1216 * @effect_owners: array of effect owners; when file handle owning 1314 * @effect_owners: array of effect owners; when file handle owning
1217 * an effect gets closed the effcet is automatically erased 1315 * an effect gets closed the effect is automatically erased
1218 * 1316 *
1219 * Every force-feedback device must implement upload() and playback() 1317 * Every force-feedback device must implement upload() and playback()
1220 * methods; erase() is optional. set_gain() and set_autocenter() need 1318 * methods; erase() is optional. set_gain() and set_autocenter() need
diff --git a/include/linux/isdn.h b/include/linux/isdn.h
index ad09506554a3..d5dda4b643ac 100644
--- a/include/linux/isdn.h
+++ b/include/linux/isdn.h
@@ -286,7 +286,6 @@ typedef struct {
286/* Local interface-data */ 286/* Local interface-data */
287typedef struct isdn_net_local_s { 287typedef struct isdn_net_local_s {
288 ulong magic; 288 ulong magic;
289 char name[10]; /* Name of device */
290 struct net_device_stats stats; /* Ethernet Statistics */ 289 struct net_device_stats stats; /* Ethernet Statistics */
291 int isdn_device; /* Index to isdn-device */ 290 int isdn_device; /* Index to isdn-device */
292 int isdn_channel; /* Index to isdn-channel */ 291 int isdn_channel; /* Index to isdn-channel */
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index 452737551260..700a93b79189 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -30,6 +30,7 @@
30#include <linux/bit_spinlock.h> 30#include <linux/bit_spinlock.h>
31#include <linux/mutex.h> 31#include <linux/mutex.h>
32#include <linux/timer.h> 32#include <linux/timer.h>
33#include <linux/lockdep.h>
33 34
34#include <asm/semaphore.h> 35#include <asm/semaphore.h>
35#endif 36#endif
@@ -396,6 +397,10 @@ struct handle_s
396 unsigned int h_sync: 1; /* sync-on-close */ 397 unsigned int h_sync: 1; /* sync-on-close */
397 unsigned int h_jdata: 1; /* force data journaling */ 398 unsigned int h_jdata: 1; /* force data journaling */
398 unsigned int h_aborted: 1; /* fatal error on handle */ 399 unsigned int h_aborted: 1; /* fatal error on handle */
400
401#ifdef CONFIG_DEBUG_LOCK_ALLOC
402 struct lockdep_map h_lockdep_map;
403#endif
399}; 404};
400 405
401 406
diff --git a/include/linux/jffs2.h b/include/linux/jffs2.h
index 840631fa5ff1..6b563cae23df 100644
--- a/include/linux/jffs2.h
+++ b/include/linux/jffs2.h
@@ -46,6 +46,7 @@
46#define JFFS2_COMPR_COPY 0x04 46#define JFFS2_COMPR_COPY 0x04
47#define JFFS2_COMPR_DYNRUBIN 0x05 47#define JFFS2_COMPR_DYNRUBIN 0x05
48#define JFFS2_COMPR_ZLIB 0x06 48#define JFFS2_COMPR_ZLIB 0x06
49#define JFFS2_COMPR_LZO 0x07
49/* Compatibility flags. */ 50/* Compatibility flags. */
50#define JFFS2_COMPAT_MASK 0xc000 /* What do to if an unknown nodetype is found */ 51#define JFFS2_COMPAT_MASK 0xc000 /* What do to if an unknown nodetype is found */
51#define JFFS2_NODE_ACCURATE 0x2000 52#define JFFS2_NODE_ACCURATE 0x2000
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index c080f61fb024..e757a74b9d17 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -36,8 +36,6 @@
36/* LATCH is used in the interval timer and ftape setup. */ 36/* LATCH is used in the interval timer and ftape setup. */
37#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */ 37#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider */
38 38
39#define LATCH_HPET ((HPET_TICK_RATE + HZ/2) / HZ)
40
41/* Suppose we want to devide two numbers NOM and DEN: NOM/DEN, the we can 39/* Suppose we want to devide two numbers NOM and DEN: NOM/DEN, the we can
42 * improve accuracy by shifting LSH bits, hence calculating: 40 * improve accuracy by shifting LSH bits, hence calculating:
43 * (NOM << LSH) / DEN 41 * (NOM << LSH) / DEN
@@ -53,13 +51,9 @@
53/* HZ is the requested value. ACTHZ is actual HZ ("<< 8" is for accuracy) */ 51/* HZ is the requested value. ACTHZ is actual HZ ("<< 8" is for accuracy) */
54#define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8)) 52#define ACTHZ (SH_DIV (CLOCK_TICK_RATE, LATCH, 8))
55 53
56#define ACTHZ_HPET (SH_DIV (HPET_TICK_RATE, LATCH_HPET, 8))
57
58/* TICK_NSEC is the time between ticks in nsec assuming real ACTHZ */ 54/* TICK_NSEC is the time between ticks in nsec assuming real ACTHZ */
59#define TICK_NSEC (SH_DIV (1000000UL * 1000, ACTHZ, 8)) 55#define TICK_NSEC (SH_DIV (1000000UL * 1000, ACTHZ, 8))
60 56
61#define TICK_NSEC_HPET (SH_DIV(1000000UL * 1000, ACTHZ_HPET, 8))
62
63/* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */ 57/* TICK_USEC is the time between ticks in usec assuming fake USER_HZ */
64#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ) 58#define TICK_USEC ((1000000UL + USER_HZ/2) / USER_HZ)
65 59
@@ -115,6 +109,10 @@ static inline u64 get_jiffies_64(void)
115 ((long)(a) - (long)(b) >= 0)) 109 ((long)(a) - (long)(b) >= 0))
116#define time_before_eq(a,b) time_after_eq(b,a) 110#define time_before_eq(a,b) time_after_eq(b,a)
117 111
112#define time_in_range(a,b,c) \
113 (time_after_eq(a,b) && \
114 time_before_eq(a,c))
115
118/* Same as above, but does so with platform independent 64bit types. 116/* Same as above, but does so with platform independent 64bit types.
119 * These must be used when utilizing jiffies_64 (i.e. return value of 117 * These must be used when utilizing jiffies_64 (i.e. return value of
120 * get_jiffies_64() */ 118 * get_jiffies_64() */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 47160fe378c9..d9725a28a265 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -42,6 +42,20 @@ extern const char linux_proc_banner[];
42#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) 42#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
43#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) 43#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
44 44
45#ifdef CONFIG_LBD
46# include <asm/div64.h>
47# define sector_div(a, b) do_div(a, b)
48#else
49# define sector_div(n, b)( \
50{ \
51 int _res; \
52 _res = (n) % (b); \
53 (n) /= (b); \
54 _res; \
55} \
56)
57#endif
58
45/** 59/**
46 * upper_32_bits - return bits 32-63 of a number 60 * upper_32_bits - return bits 32-63 of a number
47 * @n: the number we're accessing 61 * @n: the number we're accessing
diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h
index 43e895f1cabe..12bf44f083f5 100644
--- a/include/linux/kernel_stat.h
+++ b/include/linux/kernel_stat.h
@@ -23,6 +23,7 @@ struct cpu_usage_stat {
23 cputime64_t idle; 23 cputime64_t idle;
24 cputime64_t iowait; 24 cputime64_t iowait;
25 cputime64_t steal; 25 cputime64_t steal;
26 cputime64_t guest;
26}; 27};
27 28
28struct kernel_stat { 29struct kernel_stat {
diff --git a/include/linux/keyboard.h b/include/linux/keyboard.h
index 7ddbc30aa8e7..33b5c2e325b9 100644
--- a/include/linux/keyboard.h
+++ b/include/linux/keyboard.h
@@ -416,6 +416,7 @@ extern unsigned short plain_map[NR_KEYS];
416#define K_SHIFTRLOCK K(KT_LOCK,KG_SHIFTR) 416#define K_SHIFTRLOCK K(KT_LOCK,KG_SHIFTR)
417#define K_CTRLLLOCK K(KT_LOCK,KG_CTRLL) 417#define K_CTRLLLOCK K(KT_LOCK,KG_CTRLL)
418#define K_CTRLRLOCK K(KT_LOCK,KG_CTRLR) 418#define K_CTRLRLOCK K(KT_LOCK,KG_CTRLR)
419#define K_CAPSSHIFTLOCK K(KT_LOCK,KG_CAPSSHIFT)
419 420
420#define K_SHIFT_SLOCK K(KT_SLOCK,KG_SHIFT) 421#define K_SHIFT_SLOCK K(KT_SLOCK,KG_SHIFT)
421#define K_CTRL_SLOCK K(KT_SLOCK,KG_CTRL) 422#define K_CTRL_SLOCK K(KT_SLOCK,KG_CTRL)
@@ -425,8 +426,9 @@ extern unsigned short plain_map[NR_KEYS];
425#define K_SHIFTR_SLOCK K(KT_SLOCK,KG_SHIFTR) 426#define K_SHIFTR_SLOCK K(KT_SLOCK,KG_SHIFTR)
426#define K_CTRLL_SLOCK K(KT_SLOCK,KG_CTRLL) 427#define K_CTRLL_SLOCK K(KT_SLOCK,KG_CTRLL)
427#define K_CTRLR_SLOCK K(KT_SLOCK,KG_CTRLR) 428#define K_CTRLR_SLOCK K(KT_SLOCK,KG_CTRLR)
429#define K_CAPSSHIFT_SLOCK K(KT_SLOCK,KG_CAPSSHIFT)
428 430
429#define NR_LOCK 8 431#define NR_LOCK 9
430 432
431#define K_BRL_BLANK K(KT_BRL, 0) 433#define K_BRL_BLANK K(KT_BRL, 0)
432#define K_BRL_DOT1 K(KT_BRL, 1) 434#define K_BRL_DOT1 K(KT_BRL, 1)
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 949706c33622..4a0d27f475d7 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -1,8 +1,10 @@
1/* 1/*
2 * kobject.h - generic kernel object infrastructure. 2 * kobject.h - generic kernel object infrastructure.
3 * 3 *
4 * Copyright (c) 2002-2003 Patrick Mochel 4 * Copyright (c) 2002-2003 Patrick Mochel
5 * Copyright (c) 2002-2003 Open Source Development Labs 5 * Copyright (c) 2002-2003 Open Source Development Labs
6 * Copyright (c) 2006-2007 Greg Kroah-Hartman <greg@kroah.com>
7 * Copyright (c) 2006-2007 Novell Inc.
6 * 8 *
7 * This file is released under the GPLv2. 9 * This file is released under the GPLv2.
8 * 10 *
@@ -29,6 +31,8 @@
29 31
30#define KOBJ_NAME_LEN 20 32#define KOBJ_NAME_LEN 20
31#define UEVENT_HELPER_PATH_LEN 256 33#define UEVENT_HELPER_PATH_LEN 256
34#define UEVENT_NUM_ENVP 32 /* number of env pointers */
35#define UEVENT_BUFFER_SIZE 2048 /* buffer for the variables */
32 36
33/* path to the userspace helper executed on an event */ 37/* path to the userspace helper executed on an event */
34extern char uevent_helper[]; 38extern char uevent_helper[];
@@ -56,19 +60,14 @@ enum kobject_action {
56 KOBJ_MAX 60 KOBJ_MAX
57}; 61};
58 62
59/* The list of strings defining the valid kobject actions as specified above */
60extern const char *kobject_actions[];
61
62struct kobject { 63struct kobject {
63 const char * k_name; 64 const char * k_name;
64 char name[KOBJ_NAME_LEN];
65 struct kref kref; 65 struct kref kref;
66 struct list_head entry; 66 struct list_head entry;
67 struct kobject * parent; 67 struct kobject * parent;
68 struct kset * kset; 68 struct kset * kset;
69 struct kobj_type * ktype; 69 struct kobj_type * ktype;
70 struct sysfs_dirent * sd; 70 struct sysfs_dirent * sd;
71 wait_queue_head_t poll;
72}; 71};
73 72
74extern int kobject_set_name(struct kobject *, const char *, ...) 73extern int kobject_set_name(struct kobject *, const char *, ...)
@@ -83,14 +82,9 @@ extern void kobject_init(struct kobject *);
83extern void kobject_cleanup(struct kobject *); 82extern void kobject_cleanup(struct kobject *);
84 83
85extern int __must_check kobject_add(struct kobject *); 84extern int __must_check kobject_add(struct kobject *);
86extern int __must_check kobject_shadow_add(struct kobject *kobj,
87 struct sysfs_dirent *shadow_parent);
88extern void kobject_del(struct kobject *); 85extern void kobject_del(struct kobject *);
89 86
90extern int __must_check kobject_rename(struct kobject *, const char *new_name); 87extern int __must_check kobject_rename(struct kobject *, const char *new_name);
91extern int __must_check kobject_shadow_rename(struct kobject *kobj,
92 struct sysfs_dirent *new_parent,
93 const char *new_name);
94extern int __must_check kobject_move(struct kobject *, struct kobject *); 88extern int __must_check kobject_move(struct kobject *, struct kobject *);
95 89
96extern int __must_check kobject_register(struct kobject *); 90extern int __must_check kobject_register(struct kobject *);
@@ -111,36 +105,44 @@ struct kobj_type {
111 struct attribute ** default_attrs; 105 struct attribute ** default_attrs;
112}; 106};
113 107
108struct kobj_uevent_env {
109 char *envp[UEVENT_NUM_ENVP];
110 int envp_idx;
111 char buf[UEVENT_BUFFER_SIZE];
112 int buflen;
113};
114
114struct kset_uevent_ops { 115struct kset_uevent_ops {
115 int (*filter)(struct kset *kset, struct kobject *kobj); 116 int (*filter)(struct kset *kset, struct kobject *kobj);
116 const char *(*name)(struct kset *kset, struct kobject *kobj); 117 const char *(*name)(struct kset *kset, struct kobject *kobj);
117 int (*uevent)(struct kset *kset, struct kobject *kobj, char **envp, 118 int (*uevent)(struct kset *kset, struct kobject *kobj,
118 int num_envp, char *buffer, int buffer_size); 119 struct kobj_uevent_env *env);
119}; 120};
120 121
121/* 122/**
122 * struct kset - a set of kobjects of a specific type, belonging 123 * struct kset - a set of kobjects of a specific type, belonging to a specific subsystem.
123 * to a specific subsystem.
124 *
125 * All kobjects of a kset should be embedded in an identical
126 * type. This type may have a descriptor, which the kset points
127 * to. This allows there to exist sets of objects of the same
128 * type in different subsystems.
129 * 124 *
130 * A subsystem does not have to be a list of only one type 125 * A kset defines a group of kobjects. They can be individually
131 * of object; multiple ksets can belong to one subsystem. All 126 * different "types" but overall these kobjects all want to be grouped
132 * ksets of a subsystem share the subsystem's lock. 127 * together and operated on in the same manner. ksets are used to
128 * define the attribute callbacks and other common events that happen to
129 * a kobject.
133 * 130 *
134 * Each kset can support specific event variables; it can 131 * @ktype: the struct kobj_type for this specific kset
135 * supress the event generation or add subsystem specific 132 * @list: the list of all kobjects for this kset
136 * variables carried with the event. 133 * @list_lock: a lock for iterating over the kobjects
134 * @kobj: the embedded kobject for this kset (recursion, isn't it fun...)
135 * @uevent_ops: the set of uevent operations for this kset. These are
136 * called whenever a kobject has something happen to it so that the kset
137 * can add new environment variables, or filter out the uevents if so
138 * desired.
137 */ 139 */
138struct kset { 140struct kset {
139 struct kobj_type * ktype; 141 struct kobj_type *ktype;
140 struct list_head list; 142 struct list_head list;
141 spinlock_t list_lock; 143 spinlock_t list_lock;
142 struct kobject kobj; 144 struct kobject kobj;
143 struct kset_uevent_ops * uevent_ops; 145 struct kset_uevent_ops *uevent_ops;
144}; 146};
145 147
146 148
@@ -179,18 +181,18 @@ extern struct kobject * kset_find_obj(struct kset *, const char *);
179 * Use this when initializing an embedded kset with no other 181 * Use this when initializing an embedded kset with no other
180 * fields to initialize. 182 * fields to initialize.
181 */ 183 */
182#define set_kset_name(str) .kset = { .kobj = { .name = str } } 184#define set_kset_name(str) .kset = { .kobj = { .k_name = str } }
183 185
184 186
185#define decl_subsys(_name,_type,_uevent_ops) \ 187#define decl_subsys(_name,_type,_uevent_ops) \
186struct kset _name##_subsys = { \ 188struct kset _name##_subsys = { \
187 .kobj = { .name = __stringify(_name) }, \ 189 .kobj = { .k_name = __stringify(_name) }, \
188 .ktype = _type, \ 190 .ktype = _type, \
189 .uevent_ops =_uevent_ops, \ 191 .uevent_ops =_uevent_ops, \
190} 192}
191#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \ 193#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \
192struct kset _varname##_subsys = { \ 194struct kset _varname##_subsys = { \
193 .kobj = { .name = __stringify(_name) }, \ 195 .kobj = { .k_name = __stringify(_name) }, \
194 .ktype = _type, \ 196 .ktype = _type, \
195 .uevent_ops =_uevent_ops, \ 197 .uevent_ops =_uevent_ops, \
196} 198}
@@ -218,49 +220,9 @@ extern struct kset hypervisor_subsys;
218#define kobj_set_kset_s(obj,subsys) \ 220#define kobj_set_kset_s(obj,subsys) \
219 (obj)->kobj.kset = &(subsys) 221 (obj)->kobj.kset = &(subsys)
220 222
221/**
222 * kset_set_kset_s(obj,subsys) - set kset for embedded kset.
223 * @obj: ptr to some object type.
224 * @subsys: a subsystem object (not a ptr).
225 *
226 * Can be used for any object type with an embedded ->kset.
227 * Sets the kset of @obj's embedded kobject (via its embedded
228 * kset) to @subsys.kset. This makes @obj a member of that
229 * kset.
230 */
231
232#define kset_set_kset_s(obj,subsys) \
233 (obj)->kset.kobj.kset = &(subsys)
234
235/**
236 * subsys_set_kset(obj,subsys) - set kset for subsystem
237 * @obj: ptr to some object type.
238 * @_subsys: a subsystem object (not a ptr).
239 *
240 * Can be used for any object type with an embedded ->subsys.
241 * Sets the kset of @obj's kobject to @subsys.kset. This makes
242 * the object a member of that kset.
243 */
244
245#define subsys_set_kset(obj,_subsys) \
246 (obj)->subsys.kobj.kset = &(_subsys)
247
248extern void subsystem_init(struct kset *);
249extern int __must_check subsystem_register(struct kset *); 223extern int __must_check subsystem_register(struct kset *);
250extern void subsystem_unregister(struct kset *); 224extern void subsystem_unregister(struct kset *);
251 225
252static inline struct kset *subsys_get(struct kset *s)
253{
254 if (s)
255 return kset_get(s);
256 return NULL;
257}
258
259static inline void subsys_put(struct kset *s)
260{
261 kset_put(s);
262}
263
264struct subsys_attribute { 226struct subsys_attribute {
265 struct attribute attr; 227 struct attribute attr;
266 ssize_t (*show)(struct kset *, char *); 228 ssize_t (*show)(struct kset *, char *);
@@ -275,10 +237,11 @@ int kobject_uevent(struct kobject *kobj, enum kobject_action action);
275int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, 237int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
276 char *envp[]); 238 char *envp[]);
277 239
278int add_uevent_var(char **envp, int num_envp, int *cur_index, 240int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
279 char *buffer, int buffer_size, int *cur_len, 241 __attribute__((format (printf, 2, 3)));
280 const char *format, ...) 242
281 __attribute__((format (printf, 7, 8))); 243int kobject_action_type(const char *buf, size_t count,
244 enum kobject_action *type);
282#else 245#else
283static inline int kobject_uevent(struct kobject *kobj, enum kobject_action action) 246static inline int kobject_uevent(struct kobject *kobj, enum kobject_action action)
284{ return 0; } 247{ return 0; }
@@ -287,10 +250,12 @@ static inline int kobject_uevent_env(struct kobject *kobj,
287 char *envp[]) 250 char *envp[])
288{ return 0; } 251{ return 0; }
289 252
290static inline int add_uevent_var(char **envp, int num_envp, int *cur_index, 253static inline int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
291 char *buffer, int buffer_size, int *cur_len,
292 const char *format, ...)
293{ return 0; } 254{ return 0; }
255
256static inline int kobject_action_type(const char *buf, size_t count,
257 enum kobject_action *type)
258{ return -EINVAL; }
294#endif 259#endif
295 260
296#endif /* __KERNEL__ */ 261#endif /* __KERNEL__ */
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index e6edca81ab84..057a7f34ee36 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -4,8 +4,7 @@
4/* 4/*
5 * Userspace interface for /dev/kvm - kernel based virtual machine 5 * Userspace interface for /dev/kvm - kernel based virtual machine
6 * 6 *
7 * Note: this interface is considered experimental and may change without 7 * Note: you must update KVM_API_VERSION if you change this interface.
8 * notice.
9 */ 8 */
10 9
11#include <asm/types.h> 10#include <asm/types.h>
@@ -13,14 +12,8 @@
13 12
14#define KVM_API_VERSION 12 13#define KVM_API_VERSION 12
15 14
16/* 15/* Architectural interrupt line count. */
17 * Architectural interrupt line count, and the size of the bitmap needed
18 * to hold them.
19 */
20#define KVM_NR_INTERRUPTS 256 16#define KVM_NR_INTERRUPTS 256
21#define KVM_IRQ_BITMAP_SIZE_BYTES ((KVM_NR_INTERRUPTS + 7) / 8)
22#define KVM_IRQ_BITMAP_SIZE(type) (KVM_IRQ_BITMAP_SIZE_BYTES / sizeof(type))
23
24 17
25/* for KVM_CREATE_MEMORY_REGION */ 18/* for KVM_CREATE_MEMORY_REGION */
26struct kvm_memory_region { 19struct kvm_memory_region {
@@ -41,20 +34,89 @@ struct kvm_memory_alias {
41 __u64 target_phys_addr; 34 __u64 target_phys_addr;
42}; 35};
43 36
44enum kvm_exit_reason { 37/* for KVM_IRQ_LINE */
45 KVM_EXIT_UNKNOWN = 0, 38struct kvm_irq_level {
46 KVM_EXIT_EXCEPTION = 1, 39 /*
47 KVM_EXIT_IO = 2, 40 * ACPI gsi notion of irq.
48 KVM_EXIT_HYPERCALL = 3, 41 * For IA-64 (APIC model) IOAPIC0: irq 0-23; IOAPIC1: irq 24-47..
49 KVM_EXIT_DEBUG = 4, 42 * For X86 (standard AT mode) PIC0/1: irq 0-15. IOAPIC0: 0-23..
50 KVM_EXIT_HLT = 5, 43 */
51 KVM_EXIT_MMIO = 6, 44 __u32 irq;
52 KVM_EXIT_IRQ_WINDOW_OPEN = 7, 45 __u32 level;
53 KVM_EXIT_SHUTDOWN = 8, 46};
54 KVM_EXIT_FAIL_ENTRY = 9, 47
55 KVM_EXIT_INTR = 10, 48/* for KVM_GET_IRQCHIP and KVM_SET_IRQCHIP */
49struct kvm_pic_state {
50 __u8 last_irr; /* edge detection */
51 __u8 irr; /* interrupt request register */
52 __u8 imr; /* interrupt mask register */
53 __u8 isr; /* interrupt service register */
54 __u8 priority_add; /* highest irq priority */
55 __u8 irq_base;
56 __u8 read_reg_select;
57 __u8 poll;
58 __u8 special_mask;
59 __u8 init_state;
60 __u8 auto_eoi;
61 __u8 rotate_on_auto_eoi;
62 __u8 special_fully_nested_mode;
63 __u8 init4; /* true if 4 byte init */
64 __u8 elcr; /* PIIX edge/trigger selection */
65 __u8 elcr_mask;
66};
67
68#define KVM_IOAPIC_NUM_PINS 24
69struct kvm_ioapic_state {
70 __u64 base_address;
71 __u32 ioregsel;
72 __u32 id;
73 __u32 irr;
74 __u32 pad;
75 union {
76 __u64 bits;
77 struct {
78 __u8 vector;
79 __u8 delivery_mode:3;
80 __u8 dest_mode:1;
81 __u8 delivery_status:1;
82 __u8 polarity:1;
83 __u8 remote_irr:1;
84 __u8 trig_mode:1;
85 __u8 mask:1;
86 __u8 reserve:7;
87 __u8 reserved[4];
88 __u8 dest_id;
89 } fields;
90 } redirtbl[KVM_IOAPIC_NUM_PINS];
56}; 91};
57 92
93#define KVM_IRQCHIP_PIC_MASTER 0
94#define KVM_IRQCHIP_PIC_SLAVE 1
95#define KVM_IRQCHIP_IOAPIC 2
96
97struct kvm_irqchip {
98 __u32 chip_id;
99 __u32 pad;
100 union {
101 char dummy[512]; /* reserving space */
102 struct kvm_pic_state pic;
103 struct kvm_ioapic_state ioapic;
104 } chip;
105};
106
107#define KVM_EXIT_UNKNOWN 0
108#define KVM_EXIT_EXCEPTION 1
109#define KVM_EXIT_IO 2
110#define KVM_EXIT_HYPERCALL 3
111#define KVM_EXIT_DEBUG 4
112#define KVM_EXIT_HLT 5
113#define KVM_EXIT_MMIO 6
114#define KVM_EXIT_IRQ_WINDOW_OPEN 7
115#define KVM_EXIT_SHUTDOWN 8
116#define KVM_EXIT_FAIL_ENTRY 9
117#define KVM_EXIT_INTR 10
118#define KVM_EXIT_SET_TPR 11
119
58/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ 120/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */
59struct kvm_run { 121struct kvm_run {
60 /* in */ 122 /* in */
@@ -106,11 +168,14 @@ struct kvm_run {
106 } mmio; 168 } mmio;
107 /* KVM_EXIT_HYPERCALL */ 169 /* KVM_EXIT_HYPERCALL */
108 struct { 170 struct {
171 __u64 nr;
109 __u64 args[6]; 172 __u64 args[6];
110 __u64 ret; 173 __u64 ret;
111 __u32 longmode; 174 __u32 longmode;
112 __u32 pad; 175 __u32 pad;
113 } hypercall; 176 } hypercall;
177 /* Fix the size of the union. */
178 char padding[256];
114 }; 179 };
115}; 180};
116 181
@@ -139,6 +204,12 @@ struct kvm_fpu {
139 __u32 pad2; 204 __u32 pad2;
140}; 205};
141 206
207/* for KVM_GET_LAPIC and KVM_SET_LAPIC */
208#define KVM_APIC_REG_SIZE 0x400
209struct kvm_lapic_state {
210 char regs[KVM_APIC_REG_SIZE];
211};
212
142struct kvm_segment { 213struct kvm_segment {
143 __u64 base; 214 __u64 base;
144 __u32 limit; 215 __u32 limit;
@@ -164,7 +235,7 @@ struct kvm_sregs {
164 __u64 cr0, cr2, cr3, cr4, cr8; 235 __u64 cr0, cr2, cr3, cr4, cr8;
165 __u64 efer; 236 __u64 efer;
166 __u64 apic_base; 237 __u64 apic_base;
167 __u64 interrupt_bitmap[KVM_IRQ_BITMAP_SIZE(__u64)]; 238 __u64 interrupt_bitmap[(KVM_NR_INTERRUPTS + 63) / 64];
168}; 239};
169 240
170struct kvm_msr_entry { 241struct kvm_msr_entry {
@@ -272,6 +343,12 @@ struct kvm_signal_mask {
272#define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) /* in bytes */ 343#define KVM_GET_VCPU_MMAP_SIZE _IO(KVMIO, 0x04) /* in bytes */
273 344
274/* 345/*
346 * Extension capability list.
347 */
348#define KVM_CAP_IRQCHIP 0
349#define KVM_CAP_HLT 1
350
351/*
275 * ioctls for VM fds 352 * ioctls for VM fds
276 */ 353 */
277#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region) 354#define KVM_SET_MEMORY_REGION _IOW(KVMIO, 0x40, struct kvm_memory_region)
@@ -282,6 +359,11 @@ struct kvm_signal_mask {
282#define KVM_CREATE_VCPU _IO(KVMIO, 0x41) 359#define KVM_CREATE_VCPU _IO(KVMIO, 0x41)
283#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log) 360#define KVM_GET_DIRTY_LOG _IOW(KVMIO, 0x42, struct kvm_dirty_log)
284#define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias) 361#define KVM_SET_MEMORY_ALIAS _IOW(KVMIO, 0x43, struct kvm_memory_alias)
362/* Device model IOC */
363#define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60)
364#define KVM_IRQ_LINE _IOW(KVMIO, 0x61, struct kvm_irq_level)
365#define KVM_GET_IRQCHIP _IOWR(KVMIO, 0x62, struct kvm_irqchip)
366#define KVM_SET_IRQCHIP _IOR(KVMIO, 0x63, struct kvm_irqchip)
285 367
286/* 368/*
287 * ioctls for vcpu fds 369 * ioctls for vcpu fds
@@ -300,5 +382,7 @@ struct kvm_signal_mask {
300#define KVM_SET_SIGNAL_MASK _IOW(KVMIO, 0x8b, struct kvm_signal_mask) 382#define KVM_SET_SIGNAL_MASK _IOW(KVMIO, 0x8b, struct kvm_signal_mask)
301#define KVM_GET_FPU _IOR(KVMIO, 0x8c, struct kvm_fpu) 383#define KVM_GET_FPU _IOR(KVMIO, 0x8c, struct kvm_fpu)
302#define KVM_SET_FPU _IOW(KVMIO, 0x8d, struct kvm_fpu) 384#define KVM_SET_FPU _IOW(KVMIO, 0x8d, struct kvm_fpu)
385#define KVM_GET_LAPIC _IOR(KVMIO, 0x8e, struct kvm_lapic_state)
386#define KVM_SET_LAPIC _IOW(KVMIO, 0x8f, struct kvm_lapic_state)
303 387
304#endif 388#endif
diff --git a/include/linux/libata.h b/include/linux/libata.h
index a67bb9075e9b..229a9ff9f924 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -28,7 +28,6 @@
28 28
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31#include <linux/pci.h>
32#include <linux/dma-mapping.h> 31#include <linux/dma-mapping.h>
33#include <asm/scatterlist.h> 32#include <asm/scatterlist.h>
34#include <linux/io.h> 33#include <linux/io.h>
@@ -107,12 +106,6 @@ static inline u32 ata_msg_init(int dval, int default_msg_enable_bits)
107/* defines only for the constants which don't work well as enums */ 106/* defines only for the constants which don't work well as enums */
108#define ATA_TAG_POISON 0xfafbfcfdU 107#define ATA_TAG_POISON 0xfafbfcfdU
109 108
110/* move to PCI layer? */
111static inline struct device *pci_dev_to_dev(struct pci_dev *pdev)
112{
113 return &pdev->dev;
114}
115
116enum { 109enum {
117 /* various global constants */ 110 /* various global constants */
118 LIBATA_MAX_PRD = ATA_MAX_PRD / 2, 111 LIBATA_MAX_PRD = ATA_MAX_PRD / 2,
@@ -139,11 +132,12 @@ enum {
139 ATA_DFLAG_FLUSH_EXT = (1 << 4), /* do FLUSH_EXT instead of FLUSH */ 132 ATA_DFLAG_FLUSH_EXT = (1 << 4), /* do FLUSH_EXT instead of FLUSH */
140 ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */ 133 ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */
141 ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */ 134 ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */
142 ATA_DFLAG_CFG_MASK = (1 << 8) - 1, 135 ATA_DFLAG_AN = (1 << 7), /* AN configured */
136 ATA_DFLAG_CFG_MASK = (1 << 12) - 1,
143 137
144 ATA_DFLAG_PIO = (1 << 8), /* device limited to PIO mode */ 138 ATA_DFLAG_PIO = (1 << 12), /* device limited to PIO mode */
145 ATA_DFLAG_NCQ_OFF = (1 << 9), /* device limited to non-NCQ mode */ 139 ATA_DFLAG_NCQ_OFF = (1 << 13), /* device limited to non-NCQ mode */
146 ATA_DFLAG_SPUNDOWN = (1 << 10), /* XXX: for spindown_compat */ 140 ATA_DFLAG_SPUNDOWN = (1 << 14), /* XXX: for spindown_compat */
147 ATA_DFLAG_INIT_MASK = (1 << 16) - 1, 141 ATA_DFLAG_INIT_MASK = (1 << 16) - 1,
148 142
149 ATA_DFLAG_DETACH = (1 << 16), 143 ATA_DFLAG_DETACH = (1 << 16),
@@ -154,7 +148,22 @@ enum {
154 ATA_DEV_ATA_UNSUP = 2, /* ATA device (unsupported) */ 148 ATA_DEV_ATA_UNSUP = 2, /* ATA device (unsupported) */
155 ATA_DEV_ATAPI = 3, /* ATAPI device */ 149 ATA_DEV_ATAPI = 3, /* ATAPI device */
156 ATA_DEV_ATAPI_UNSUP = 4, /* ATAPI device (unsupported) */ 150 ATA_DEV_ATAPI_UNSUP = 4, /* ATAPI device (unsupported) */
157 ATA_DEV_NONE = 5, /* no device */ 151 ATA_DEV_PMP = 5, /* SATA port multiplier */
152 ATA_DEV_PMP_UNSUP = 6, /* SATA port multiplier (unsupported) */
153 ATA_DEV_SEMB = 7, /* SEMB */
154 ATA_DEV_SEMB_UNSUP = 8, /* SEMB (unsupported) */
155 ATA_DEV_NONE = 9, /* no device */
156
157 /* struct ata_link flags */
158 ATA_LFLAG_HRST_TO_RESUME = (1 << 0), /* hardreset to resume link */
159 ATA_LFLAG_SKIP_D2H_BSY = (1 << 1), /* can't wait for the first D2H
160 * Register FIS clearing BSY */
161 ATA_LFLAG_NO_SRST = (1 << 2), /* avoid softreset */
162 ATA_LFLAG_ASSUME_ATA = (1 << 3), /* assume ATA class */
163 ATA_LFLAG_ASSUME_SEMB = (1 << 4), /* assume SEMB class */
164 ATA_LFLAG_ASSUME_CLASS = ATA_LFLAG_ASSUME_ATA | ATA_LFLAG_ASSUME_SEMB,
165 ATA_LFLAG_NO_RETRY = (1 << 5), /* don't retry this link */
166 ATA_LFLAG_DISABLED = (1 << 6), /* link is disabled */
158 167
159 /* struct ata_port flags */ 168 /* struct ata_port flags */
160 ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */ 169 ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */
@@ -170,13 +179,12 @@ enum {
170 ATA_FLAG_PIO_POLLING = (1 << 9), /* use polling PIO if LLD 179 ATA_FLAG_PIO_POLLING = (1 << 9), /* use polling PIO if LLD
171 * doesn't handle PIO interrupts */ 180 * doesn't handle PIO interrupts */
172 ATA_FLAG_NCQ = (1 << 10), /* host supports NCQ */ 181 ATA_FLAG_NCQ = (1 << 10), /* host supports NCQ */
173 ATA_FLAG_HRST_TO_RESUME = (1 << 11), /* hardreset to resume phy */
174 ATA_FLAG_SKIP_D2H_BSY = (1 << 12), /* can't wait for the first D2H
175 * Register FIS clearing BSY */
176 ATA_FLAG_DEBUGMSG = (1 << 13), 182 ATA_FLAG_DEBUGMSG = (1 << 13),
177 ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */ 183 ATA_FLAG_IGN_SIMPLEX = (1 << 15), /* ignore SIMPLEX */
178 ATA_FLAG_NO_IORDY = (1 << 16), /* controller lacks iordy */ 184 ATA_FLAG_NO_IORDY = (1 << 16), /* controller lacks iordy */
179 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */ 185 ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */
186 ATA_FLAG_AN = (1 << 18), /* controller supports AN */
187 ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */
180 188
181 /* The following flag belongs to ap->pflags but is kept in 189 /* The following flag belongs to ap->pflags but is kept in
182 * ap->flags because it's referenced in many LLDs and will be 190 * ap->flags because it's referenced in many LLDs and will be
@@ -195,6 +203,7 @@ enum {
195 ATA_PFLAG_UNLOADING = (1 << 5), /* module is unloading */ 203 ATA_PFLAG_UNLOADING = (1 << 5), /* module is unloading */
196 ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */ 204 ATA_PFLAG_SCSI_HOTPLUG = (1 << 6), /* SCSI hotplug scheduled */
197 ATA_PFLAG_INITIALIZING = (1 << 7), /* being initialized, don't touch */ 205 ATA_PFLAG_INITIALIZING = (1 << 7), /* being initialized, don't touch */
206 ATA_PFLAG_RESETTING = (1 << 8), /* reset in progress */
198 207
199 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */ 208 ATA_PFLAG_SUSPENDED = (1 << 17), /* port is suspended (power) */
200 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */ 209 ATA_PFLAG_PM_PENDING = (1 << 18), /* PM operation pending */
@@ -207,6 +216,7 @@ enum {
207 ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE, 216 ATA_QCFLAG_DMAMAP = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE,
208 ATA_QCFLAG_IO = (1 << 3), /* standard IO command */ 217 ATA_QCFLAG_IO = (1 << 3), /* standard IO command */
209 ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */ 218 ATA_QCFLAG_RESULT_TF = (1 << 4), /* result TF requested */
219 ATA_QCFLAG_CLEAR_EXCL = (1 << 5), /* clear excl_link on completion */
210 220
211 ATA_QCFLAG_FAILED = (1 << 16), /* cmd failed and is owned by EH */ 221 ATA_QCFLAG_FAILED = (1 << 16), /* cmd failed and is owned by EH */
212 ATA_QCFLAG_SENSE_VALID = (1 << 17), /* sense data valid */ 222 ATA_QCFLAG_SENSE_VALID = (1 << 17), /* sense data valid */
@@ -263,6 +273,10 @@ enum {
263 /* ering size */ 273 /* ering size */
264 ATA_ERING_SIZE = 32, 274 ATA_ERING_SIZE = 32,
265 275
276 /* return values for ->qc_defer */
277 ATA_DEFER_LINK = 1,
278 ATA_DEFER_PORT = 2,
279
266 /* desc_len for ata_eh_info and context */ 280 /* desc_len for ata_eh_info and context */
267 ATA_EH_DESC_LEN = 80, 281 ATA_EH_DESC_LEN = 80,
268 282
@@ -270,6 +284,7 @@ enum {
270 ATA_EH_REVALIDATE = (1 << 0), 284 ATA_EH_REVALIDATE = (1 << 0),
271 ATA_EH_SOFTRESET = (1 << 1), 285 ATA_EH_SOFTRESET = (1 << 1),
272 ATA_EH_HARDRESET = (1 << 2), 286 ATA_EH_HARDRESET = (1 << 2),
287 ATA_EH_ENABLE_LINK = (1 << 3),
273 288
274 ATA_EH_RESET_MASK = ATA_EH_SOFTRESET | ATA_EH_HARDRESET, 289 ATA_EH_RESET_MASK = ATA_EH_SOFTRESET | ATA_EH_HARDRESET,
275 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE, 290 ATA_EH_PERDEV_MASK = ATA_EH_REVALIDATE,
@@ -289,12 +304,16 @@ enum {
289 ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET, 304 ATA_EHI_DID_RESET = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET,
290 ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK, 305 ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK,
291 306
292 /* max repeat if error condition is still set after ->error_handler */ 307 /* max tries if error condition is still set after ->error_handler */
293 ATA_EH_MAX_REPEAT = 5, 308 ATA_EH_MAX_TRIES = 5,
294 309
295 /* how hard are we gonna try to probe/recover devices */ 310 /* how hard are we gonna try to probe/recover devices */
296 ATA_PROBE_MAX_TRIES = 3, 311 ATA_PROBE_MAX_TRIES = 3,
297 ATA_EH_DEV_TRIES = 3, 312 ATA_EH_DEV_TRIES = 3,
313 ATA_EH_PMP_TRIES = 5,
314 ATA_EH_PMP_LINK_TRIES = 3,
315
316 SATA_PMP_SCR_TIMEOUT = 250,
298 317
299 /* Horkage types. May be set by libata or controller on drives 318 /* Horkage types. May be set by libata or controller on drives
300 (some horkage may be drive/controller pair dependant */ 319 (some horkage may be drive/controller pair dependant */
@@ -304,6 +323,14 @@ enum {
304 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */ 323 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */
305 ATA_HORKAGE_MAX_SEC_128 = (1 << 3), /* Limit max sects to 128 */ 324 ATA_HORKAGE_MAX_SEC_128 = (1 << 3), /* Limit max sects to 128 */
306 ATA_HORKAGE_BROKEN_HPA = (1 << 4), /* Broken HPA */ 325 ATA_HORKAGE_BROKEN_HPA = (1 << 4), /* Broken HPA */
326 ATA_HORKAGE_SKIP_PM = (1 << 5), /* Skip PM operations */
327 ATA_HORKAGE_HPA_SIZE = (1 << 6), /* native size off by one */
328
329 /* DMA mask for user DMA control: User visible values; DO NOT
330 renumber */
331 ATA_DMA_MASK_ATA = (1 << 0), /* DMA on ATA Disk */
332 ATA_DMA_MASK_ATAPI = (1 << 1), /* DMA on ATAPI */
333 ATA_DMA_MASK_CFA = (1 << 2), /* DMA on CF Card */
307}; 334};
308 335
309enum hsm_task_states { 336enum hsm_task_states {
@@ -333,14 +360,15 @@ enum ata_completion_errors {
333struct scsi_device; 360struct scsi_device;
334struct ata_port_operations; 361struct ata_port_operations;
335struct ata_port; 362struct ata_port;
363struct ata_link;
336struct ata_queued_cmd; 364struct ata_queued_cmd;
337 365
338/* typedefs */ 366/* typedefs */
339typedef void (*ata_qc_cb_t) (struct ata_queued_cmd *qc); 367typedef void (*ata_qc_cb_t) (struct ata_queued_cmd *qc);
340typedef int (*ata_prereset_fn_t)(struct ata_port *ap, unsigned long deadline); 368typedef int (*ata_prereset_fn_t)(struct ata_link *link, unsigned long deadline);
341typedef int (*ata_reset_fn_t)(struct ata_port *ap, unsigned int *classes, 369typedef int (*ata_reset_fn_t)(struct ata_link *link, unsigned int *classes,
342 unsigned long deadline); 370 unsigned long deadline);
343typedef void (*ata_postreset_fn_t)(struct ata_port *ap, unsigned int *classes); 371typedef void (*ata_postreset_fn_t)(struct ata_link *link, unsigned int *classes);
344 372
345struct ata_ioports { 373struct ata_ioports {
346 void __iomem *cmd_addr; 374 void __iomem *cmd_addr;
@@ -363,8 +391,6 @@ struct ata_ioports {
363struct ata_host { 391struct ata_host {
364 spinlock_t lock; 392 spinlock_t lock;
365 struct device *dev; 393 struct device *dev;
366 unsigned long irq;
367 unsigned long irq2;
368 void __iomem * const *iomap; 394 void __iomem * const *iomap;
369 unsigned int n_ports; 395 unsigned int n_ports;
370 void *private_data; 396 void *private_data;
@@ -436,7 +462,7 @@ struct ata_ering {
436}; 462};
437 463
438struct ata_device { 464struct ata_device {
439 struct ata_port *ap; 465 struct ata_link *link;
440 unsigned int devno; /* 0 or 1 */ 466 unsigned int devno; /* 0 or 1 */
441 unsigned long flags; /* ATA_DFLAG_xxx */ 467 unsigned long flags; /* ATA_DFLAG_xxx */
442 unsigned int horkage; /* List of broken features */ 468 unsigned int horkage; /* List of broken features */
@@ -447,7 +473,12 @@ struct ata_device {
447 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */ 473 /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */
448 u64 n_sectors; /* size of device, if ATA */ 474 u64 n_sectors; /* size of device, if ATA */
449 unsigned int class; /* ATA_DEV_xxx */ 475 unsigned int class; /* ATA_DEV_xxx */
450 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */ 476
477 union {
478 u16 id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */
479 u32 gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */
480 };
481
451 u8 pio_mode; 482 u8 pio_mode;
452 u8 dma_mode; 483 u8 dma_mode;
453 u8 xfer_mode; 484 u8 xfer_mode;
@@ -510,6 +541,27 @@ struct ata_acpi_gtm {
510 u32 flags; 541 u32 flags;
511} __packed; 542} __packed;
512 543
544struct ata_link {
545 struct ata_port *ap;
546 int pmp; /* port multiplier port # */
547
548 unsigned int active_tag; /* active tag on this link */
549 u32 sactive; /* active NCQ commands */
550
551 unsigned int flags; /* ATA_LFLAG_xxx */
552
553 unsigned int hw_sata_spd_limit;
554 unsigned int sata_spd_limit;
555 unsigned int sata_spd; /* current SATA PHY speed */
556
557 /* record runtime error info, protected by host_set lock */
558 struct ata_eh_info eh_info;
559 /* EH context */
560 struct ata_eh_context eh_context;
561
562 struct ata_device device[ATA_MAX_DEVICES];
563};
564
513struct ata_port { 565struct ata_port {
514 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */ 566 struct Scsi_Host *scsi_host; /* our co-allocated scsi host */
515 const struct ata_port_operations *ops; 567 const struct ata_port_operations *ops;
@@ -533,23 +585,17 @@ struct ata_port {
533 unsigned int mwdma_mask; 585 unsigned int mwdma_mask;
534 unsigned int udma_mask; 586 unsigned int udma_mask;
535 unsigned int cbl; /* cable type; ATA_CBL_xxx */ 587 unsigned int cbl; /* cable type; ATA_CBL_xxx */
536 unsigned int hw_sata_spd_limit;
537 unsigned int sata_spd_limit; /* SATA PHY speed limit */
538 unsigned int sata_spd; /* current SATA PHY speed */
539
540 /* record runtime error info, protected by host lock */
541 struct ata_eh_info eh_info;
542 /* EH context owned by EH */
543 struct ata_eh_context eh_context;
544
545 struct ata_device device[ATA_MAX_DEVICES];
546 588
547 struct ata_queued_cmd qcmd[ATA_MAX_QUEUE]; 589 struct ata_queued_cmd qcmd[ATA_MAX_QUEUE];
548 unsigned long qc_allocated; 590 unsigned long qc_allocated;
549 unsigned int qc_active; 591 unsigned int qc_active;
592 int nr_active_links; /* #links with active qcs */
593
594 struct ata_link link; /* host default link */
550 595
551 unsigned int active_tag; 596 int nr_pmp_links; /* nr of available PMP links */
552 u32 sactive; 597 struct ata_link *pmp_link; /* array of PMP links */
598 struct ata_link *excl_link; /* for PMP qc exclusion */
553 599
554 struct ata_port_stats stats; 600 struct ata_port_stats stats;
555 struct ata_host *host; 601 struct ata_host *host;
@@ -565,6 +611,7 @@ struct ata_port {
565 u32 msg_enable; 611 u32 msg_enable;
566 struct list_head eh_done_q; 612 struct list_head eh_done_q;
567 wait_queue_head_t eh_wait_q; 613 wait_queue_head_t eh_wait_q;
614 int eh_tries;
568 615
569 pm_message_t pm_mesg; 616 pm_message_t pm_mesg;
570 int *pm_result; 617 int *pm_result;
@@ -582,8 +629,6 @@ struct ata_port {
582}; 629};
583 630
584struct ata_port_operations { 631struct ata_port_operations {
585 void (*port_disable) (struct ata_port *);
586
587 void (*dev_config) (struct ata_device *); 632 void (*dev_config) (struct ata_device *);
588 633
589 void (*set_piomode) (struct ata_port *, struct ata_device *); 634 void (*set_piomode) (struct ata_port *, struct ata_device *);
@@ -599,7 +644,7 @@ struct ata_port_operations {
599 void (*dev_select)(struct ata_port *ap, unsigned int device); 644 void (*dev_select)(struct ata_port *ap, unsigned int device);
600 645
601 void (*phy_reset) (struct ata_port *ap); /* obsolete */ 646 void (*phy_reset) (struct ata_port *ap); /* obsolete */
602 int (*set_mode) (struct ata_port *ap, struct ata_device **r_failed_dev); 647 int (*set_mode) (struct ata_link *link, struct ata_device **r_failed_dev);
603 648
604 int (*cable_detect) (struct ata_port *ap); 649 int (*cable_detect) (struct ata_port *ap);
605 650
@@ -610,9 +655,14 @@ struct ata_port_operations {
610 655
611 void (*data_xfer) (struct ata_device *, unsigned char *, unsigned int, int); 656 void (*data_xfer) (struct ata_device *, unsigned char *, unsigned int, int);
612 657
658 int (*qc_defer) (struct ata_queued_cmd *qc);
613 void (*qc_prep) (struct ata_queued_cmd *qc); 659 void (*qc_prep) (struct ata_queued_cmd *qc);
614 unsigned int (*qc_issue) (struct ata_queued_cmd *qc); 660 unsigned int (*qc_issue) (struct ata_queued_cmd *qc);
615 661
662 /* port multiplier */
663 void (*pmp_attach) (struct ata_port *ap);
664 void (*pmp_detach) (struct ata_port *ap);
665
616 /* Error handlers. ->error_handler overrides ->eng_timeout and 666 /* Error handlers. ->error_handler overrides ->eng_timeout and
617 * indicates that new-style EH is in place. 667 * indicates that new-style EH is in place.
618 */ 668 */
@@ -626,7 +676,6 @@ struct ata_port_operations {
626 irq_handler_t irq_handler; 676 irq_handler_t irq_handler;
627 void (*irq_clear) (struct ata_port *); 677 void (*irq_clear) (struct ata_port *);
628 u8 (*irq_on) (struct ata_port *); 678 u8 (*irq_on) (struct ata_port *);
629 u8 (*irq_ack) (struct ata_port *ap, unsigned int chk_drq);
630 679
631 int (*scr_read) (struct ata_port *ap, unsigned int sc_reg, u32 *val); 680 int (*scr_read) (struct ata_port *ap, unsigned int sc_reg, u32 *val);
632 int (*scr_write) (struct ata_port *ap, unsigned int sc_reg, u32 val); 681 int (*scr_write) (struct ata_port *ap, unsigned int sc_reg, u32 val);
@@ -646,6 +695,7 @@ struct ata_port_operations {
646struct ata_port_info { 695struct ata_port_info {
647 struct scsi_host_template *sht; 696 struct scsi_host_template *sht;
648 unsigned long flags; 697 unsigned long flags;
698 unsigned long link_flags;
649 unsigned long pio_mask; 699 unsigned long pio_mask;
650 unsigned long mwdma_mask; 700 unsigned long mwdma_mask;
651 unsigned long udma_mask; 701 unsigned long udma_mask;
@@ -689,38 +739,27 @@ static inline int ata_port_is_dummy(struct ata_port *ap)
689 return ap->ops == &ata_dummy_port_ops; 739 return ap->ops == &ata_dummy_port_ops;
690} 740}
691 741
692extern void sata_print_link_status(struct ata_port *ap); 742extern void sata_print_link_status(struct ata_link *link);
693extern void ata_port_probe(struct ata_port *); 743extern void ata_port_probe(struct ata_port *);
694extern void __sata_phy_reset(struct ata_port *ap); 744extern void __sata_phy_reset(struct ata_port *ap);
695extern void sata_phy_reset(struct ata_port *ap); 745extern void sata_phy_reset(struct ata_port *ap);
696extern void ata_bus_reset(struct ata_port *ap); 746extern void ata_bus_reset(struct ata_port *ap);
697extern int sata_set_spd(struct ata_port *ap); 747extern int sata_set_spd(struct ata_link *link);
698extern int sata_phy_debounce(struct ata_port *ap, const unsigned long *param, 748extern int sata_link_debounce(struct ata_link *link,
699 unsigned long deadline); 749 const unsigned long *params, unsigned long deadline);
700extern int sata_phy_resume(struct ata_port *ap, const unsigned long *param, 750extern int sata_link_resume(struct ata_link *link, const unsigned long *params,
701 unsigned long deadline); 751 unsigned long deadline);
702extern int ata_std_prereset(struct ata_port *ap, unsigned long deadline); 752extern int ata_std_prereset(struct ata_link *link, unsigned long deadline);
703extern int ata_std_softreset(struct ata_port *ap, unsigned int *classes, 753extern int ata_std_softreset(struct ata_link *link, unsigned int *classes,
704 unsigned long deadline); 754 unsigned long deadline);
705extern int sata_port_hardreset(struct ata_port *ap, const unsigned long *timing, 755extern int sata_link_hardreset(struct ata_link *link,
706 unsigned long deadline); 756 const unsigned long *timing, unsigned long deadline);
707extern int sata_std_hardreset(struct ata_port *ap, unsigned int *class, 757extern int sata_std_hardreset(struct ata_link *link, unsigned int *class,
708 unsigned long deadline); 758 unsigned long deadline);
709extern void ata_std_postreset(struct ata_port *ap, unsigned int *classes); 759extern void ata_std_postreset(struct ata_link *link, unsigned int *classes);
710extern void ata_port_disable(struct ata_port *); 760extern void ata_port_disable(struct ata_port *);
711extern void ata_std_ports(struct ata_ioports *ioaddr); 761extern void ata_std_ports(struct ata_ioports *ioaddr);
712#ifdef CONFIG_PCI 762
713extern int ata_pci_init_one (struct pci_dev *pdev,
714 const struct ata_port_info * const * ppi);
715extern void ata_pci_remove_one (struct pci_dev *pdev);
716#ifdef CONFIG_PM
717extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg);
718extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev);
719extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
720extern int ata_pci_device_resume(struct pci_dev *pdev);
721#endif
722extern int ata_pci_clear_simplex(struct pci_dev *pdev);
723#endif /* CONFIG_PCI */
724extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); 763extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports);
725extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, 764extern struct ata_host *ata_host_alloc_pinfo(struct device *dev,
726 const struct ata_port_info * const * ppi, int n_ports); 765 const struct ata_port_info * const * ppi, int n_ports);
@@ -746,12 +785,12 @@ extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *);
746extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), 785extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *),
747 struct ata_port *ap); 786 struct ata_port *ap);
748extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); 787extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
749extern int sata_scr_valid(struct ata_port *ap); 788extern int sata_scr_valid(struct ata_link *link);
750extern int sata_scr_read(struct ata_port *ap, int reg, u32 *val); 789extern int sata_scr_read(struct ata_link *link, int reg, u32 *val);
751extern int sata_scr_write(struct ata_port *ap, int reg, u32 val); 790extern int sata_scr_write(struct ata_link *link, int reg, u32 val);
752extern int sata_scr_write_flush(struct ata_port *ap, int reg, u32 val); 791extern int sata_scr_write_flush(struct ata_link *link, int reg, u32 val);
753extern int ata_port_online(struct ata_port *ap); 792extern int ata_link_online(struct ata_link *link);
754extern int ata_port_offline(struct ata_port *ap); 793extern int ata_link_offline(struct ata_link *link);
755#ifdef CONFIG_PM 794#ifdef CONFIG_PM
756extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg); 795extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
757extern void ata_host_resume(struct ata_host *host); 796extern void ata_host_resume(struct ata_host *host);
@@ -765,7 +804,8 @@ extern void ata_port_queue_task(struct ata_port *ap, work_func_t fn,
765extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, 804extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
766 unsigned long interval_msec, 805 unsigned long interval_msec,
767 unsigned long timeout_msec); 806 unsigned long timeout_msec);
768extern unsigned int ata_dev_try_classify(struct ata_port *, unsigned int, u8 *); 807extern unsigned int ata_dev_try_classify(struct ata_device *dev, int present,
808 u8 *r_err);
769 809
770/* 810/*
771 * Default driver ops implementations 811 * Default driver ops implementations
@@ -787,6 +827,7 @@ extern void ata_data_xfer(struct ata_device *adev, unsigned char *buf,
787 unsigned int buflen, int write_data); 827 unsigned int buflen, int write_data);
788extern void ata_data_xfer_noirq(struct ata_device *adev, unsigned char *buf, 828extern void ata_data_xfer_noirq(struct ata_device *adev, unsigned char *buf,
789 unsigned int buflen, int write_data); 829 unsigned int buflen, int write_data);
830extern int ata_std_qc_defer(struct ata_queued_cmd *qc);
790extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc); 831extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc);
791extern void ata_qc_prep(struct ata_queued_cmd *qc); 832extern void ata_qc_prep(struct ata_queued_cmd *qc);
792extern void ata_noop_qc_prep(struct ata_queued_cmd *qc); 833extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
@@ -830,11 +871,8 @@ extern void ata_scsi_slave_destroy(struct scsi_device *sdev);
830extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, 871extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
831 int queue_depth); 872 int queue_depth);
832extern struct ata_device *ata_dev_pair(struct ata_device *adev); 873extern struct ata_device *ata_dev_pair(struct ata_device *adev);
833extern int ata_do_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev); 874extern int ata_do_set_mode(struct ata_link *link, struct ata_device **r_failed_dev);
834extern u8 ata_irq_on(struct ata_port *ap); 875extern u8 ata_irq_on(struct ata_port *ap);
835extern u8 ata_dummy_irq_on(struct ata_port *ap);
836extern u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq);
837extern u8 ata_dummy_irq_ack(struct ata_port *ap, unsigned int chk_drq);
838 876
839extern int ata_cable_40wire(struct ata_port *ap); 877extern int ata_cable_40wire(struct ata_port *ap);
840extern int ata_cable_80wire(struct ata_port *ap); 878extern int ata_cable_80wire(struct ata_port *ap);
@@ -869,8 +907,29 @@ enum {
869 ATA_TIMING_CYCLE | ATA_TIMING_UDMA, 907 ATA_TIMING_CYCLE | ATA_TIMING_UDMA,
870}; 908};
871 909
910/* libata-acpi.c */
911#ifdef CONFIG_ATA_ACPI
912extern int ata_acpi_cbl_80wire(struct ata_port *ap);
913int ata_acpi_stm(const struct ata_port *ap, struct ata_acpi_gtm *stm);
914int ata_acpi_gtm(const struct ata_port *ap, struct ata_acpi_gtm *stm);
915#else
916static inline int ata_acpi_cbl_80wire(struct ata_port *ap) { return 0; }
917#endif
872 918
873#ifdef CONFIG_PCI 919#ifdef CONFIG_PCI
920struct pci_dev;
921
922extern int ata_pci_init_one (struct pci_dev *pdev,
923 const struct ata_port_info * const * ppi);
924extern void ata_pci_remove_one (struct pci_dev *pdev);
925#ifdef CONFIG_PM
926extern void ata_pci_device_do_suspend(struct pci_dev *pdev, pm_message_t mesg);
927extern int __must_check ata_pci_device_do_resume(struct pci_dev *pdev);
928extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
929extern int ata_pci_device_resume(struct pci_dev *pdev);
930#endif
931extern int ata_pci_clear_simplex(struct pci_dev *pdev);
932
874struct pci_bits { 933struct pci_bits {
875 unsigned int reg; /* PCI config register to read */ 934 unsigned int reg; /* PCI config register to read */
876 unsigned int width; /* 1 (8 bit), 2 (16 bit), 4 (32 bit) */ 935 unsigned int width; /* 1 (8 bit), 2 (16 bit), 4 (32 bit) */
@@ -888,13 +947,29 @@ extern unsigned long ata_pci_default_filter(struct ata_device *, unsigned long);
888#endif /* CONFIG_PCI */ 947#endif /* CONFIG_PCI */
889 948
890/* 949/*
950 * PMP
951 */
952extern int sata_pmp_qc_defer_cmd_switch(struct ata_queued_cmd *qc);
953extern int sata_pmp_std_prereset(struct ata_link *link, unsigned long deadline);
954extern int sata_pmp_std_hardreset(struct ata_link *link, unsigned int *class,
955 unsigned long deadline);
956extern void sata_pmp_std_postreset(struct ata_link *link, unsigned int *class);
957extern void sata_pmp_do_eh(struct ata_port *ap,
958 ata_prereset_fn_t prereset, ata_reset_fn_t softreset,
959 ata_reset_fn_t hardreset, ata_postreset_fn_t postreset,
960 ata_prereset_fn_t pmp_prereset, ata_reset_fn_t pmp_softreset,
961 ata_reset_fn_t pmp_hardreset, ata_postreset_fn_t pmp_postreset);
962
963/*
891 * EH 964 * EH
892 */ 965 */
893extern void ata_eng_timeout(struct ata_port *ap); 966extern void ata_eng_timeout(struct ata_port *ap);
894 967
895extern void ata_port_schedule_eh(struct ata_port *ap); 968extern void ata_port_schedule_eh(struct ata_port *ap);
969extern int ata_link_abort(struct ata_link *link);
896extern int ata_port_abort(struct ata_port *ap); 970extern int ata_port_abort(struct ata_port *ap);
897extern int ata_port_freeze(struct ata_port *ap); 971extern int ata_port_freeze(struct ata_port *ap);
972extern int sata_async_notification(struct ata_port *ap);
898 973
899extern void ata_eh_freeze_port(struct ata_port *ap); 974extern void ata_eh_freeze_port(struct ata_port *ap);
900extern void ata_eh_thaw_port(struct ata_port *ap); 975extern void ata_eh_thaw_port(struct ata_port *ap);
@@ -912,14 +987,25 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
912#define ata_port_printk(ap, lv, fmt, args...) \ 987#define ata_port_printk(ap, lv, fmt, args...) \
913 printk(lv"ata%u: "fmt, (ap)->print_id , ##args) 988 printk(lv"ata%u: "fmt, (ap)->print_id , ##args)
914 989
990#define ata_link_printk(link, lv, fmt, args...) do { \
991 if ((link)->ap->nr_pmp_links) \
992 printk(lv"ata%u.%02u: "fmt, (link)->ap->print_id, \
993 (link)->pmp , ##args); \
994 else \
995 printk(lv"ata%u: "fmt, (link)->ap->print_id , ##args); \
996 } while(0)
997
915#define ata_dev_printk(dev, lv, fmt, args...) \ 998#define ata_dev_printk(dev, lv, fmt, args...) \
916 printk(lv"ata%u.%02u: "fmt, (dev)->ap->print_id, (dev)->devno , ##args) 999 printk(lv"ata%u.%02u: "fmt, (dev)->link->ap->print_id, \
1000 (dev)->link->pmp + (dev)->devno , ##args)
917 1001
918/* 1002/*
919 * ata_eh_info helpers 1003 * ata_eh_info helpers
920 */ 1004 */
921extern void __ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...); 1005extern void __ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...)
922extern void ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...); 1006 __attribute__ ((format (printf, 2, 3)));
1007extern void ata_ehi_push_desc(struct ata_eh_info *ehi, const char *fmt, ...)
1008 __attribute__ ((format (printf, 2, 3)));
923extern void ata_ehi_clear_desc(struct ata_eh_info *ehi); 1009extern void ata_ehi_clear_desc(struct ata_eh_info *ehi);
924 1010
925static inline void ata_ehi_schedule_probe(struct ata_eh_info *ehi) 1011static inline void ata_ehi_schedule_probe(struct ata_eh_info *ehi)
@@ -933,10 +1019,21 @@ static inline void ata_ehi_hotplugged(struct ata_eh_info *ehi)
933{ 1019{
934 ata_ehi_schedule_probe(ehi); 1020 ata_ehi_schedule_probe(ehi);
935 ehi->flags |= ATA_EHI_HOTPLUGGED; 1021 ehi->flags |= ATA_EHI_HOTPLUGGED;
1022 ehi->action |= ATA_EH_ENABLE_LINK;
936 ehi->err_mask |= AC_ERR_ATA_BUS; 1023 ehi->err_mask |= AC_ERR_ATA_BUS;
937} 1024}
938 1025
939/* 1026/*
1027 * port description helpers
1028 */
1029extern void ata_port_desc(struct ata_port *ap, const char *fmt, ...)
1030 __attribute__ ((format (printf, 2, 3)));
1031#ifdef CONFIG_PCI
1032extern void ata_port_pbar_desc(struct ata_port *ap, int bar, ssize_t offset,
1033 const char *name);
1034#endif
1035
1036/*
940 * qc helpers 1037 * qc helpers
941 */ 1038 */
942static inline int 1039static inline int
@@ -991,12 +1088,14 @@ static inline unsigned int ata_tag_internal(unsigned int tag)
991 */ 1088 */
992static inline unsigned int ata_class_enabled(unsigned int class) 1089static inline unsigned int ata_class_enabled(unsigned int class)
993{ 1090{
994 return class == ATA_DEV_ATA || class == ATA_DEV_ATAPI; 1091 return class == ATA_DEV_ATA || class == ATA_DEV_ATAPI ||
1092 class == ATA_DEV_PMP || class == ATA_DEV_SEMB;
995} 1093}
996 1094
997static inline unsigned int ata_class_disabled(unsigned int class) 1095static inline unsigned int ata_class_disabled(unsigned int class)
998{ 1096{
999 return class == ATA_DEV_ATA_UNSUP || class == ATA_DEV_ATAPI_UNSUP; 1097 return class == ATA_DEV_ATA_UNSUP || class == ATA_DEV_ATAPI_UNSUP ||
1098 class == ATA_DEV_PMP_UNSUP || class == ATA_DEV_SEMB_UNSUP;
1000} 1099}
1001 1100
1002static inline unsigned int ata_class_absent(unsigned int class) 1101static inline unsigned int ata_class_absent(unsigned int class)
@@ -1020,15 +1119,62 @@ static inline unsigned int ata_dev_absent(const struct ata_device *dev)
1020} 1119}
1021 1120
1022/* 1121/*
1023 * port helpers 1122 * link helpers
1024 */ 1123 */
1025static inline int ata_port_max_devices(const struct ata_port *ap) 1124static inline int ata_is_host_link(const struct ata_link *link)
1125{
1126 return link == &link->ap->link;
1127}
1128
1129static inline int ata_link_max_devices(const struct ata_link *link)
1026{ 1130{
1027 if (ap->flags & ATA_FLAG_SLAVE_POSS) 1131 if (ata_is_host_link(link) && link->ap->flags & ATA_FLAG_SLAVE_POSS)
1028 return 2; 1132 return 2;
1029 return 1; 1133 return 1;
1030} 1134}
1031 1135
1136static inline int ata_link_active(struct ata_link *link)
1137{
1138 return ata_tag_valid(link->active_tag) || link->sactive;
1139}
1140
1141static inline struct ata_link *ata_port_first_link(struct ata_port *ap)
1142{
1143 if (ap->nr_pmp_links)
1144 return ap->pmp_link;
1145 return &ap->link;
1146}
1147
1148static inline struct ata_link *ata_port_next_link(struct ata_link *link)
1149{
1150 struct ata_port *ap = link->ap;
1151
1152 if (link == &ap->link) {
1153 if (!ap->nr_pmp_links)
1154 return NULL;
1155 return ap->pmp_link;
1156 }
1157
1158 if (++link - ap->pmp_link < ap->nr_pmp_links)
1159 return link;
1160 return NULL;
1161}
1162
1163#define __ata_port_for_each_link(lk, ap) \
1164 for ((lk) = &(ap)->link; (lk); (lk) = ata_port_next_link(lk))
1165
1166#define ata_port_for_each_link(link, ap) \
1167 for ((link) = ata_port_first_link(ap); (link); \
1168 (link) = ata_port_next_link(link))
1169
1170#define ata_link_for_each_dev(dev, link) \
1171 for ((dev) = (link)->device; \
1172 (dev) < (link)->device + ata_link_max_devices(link) || ((dev) = NULL); \
1173 (dev)++)
1174
1175#define ata_link_for_each_dev_reverse(dev, link) \
1176 for ((dev) = (link)->device + ata_link_max_devices(link) - 1; \
1177 (dev) >= (link)->device || ((dev) = NULL); (dev)--)
1032 1178
1033static inline u8 ata_chk_status(struct ata_port *ap) 1179static inline u8 ata_chk_status(struct ata_port *ap)
1034{ 1180{
@@ -1110,9 +1256,11 @@ static inline u8 ata_wait_idle(struct ata_port *ap)
1110{ 1256{
1111 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); 1257 u8 status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
1112 1258
1259#ifdef ATA_DEBUG
1113 if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ))) 1260 if (status != 0xff && (status & (ATA_BUSY | ATA_DRQ)))
1114 DPRINTK("ATA: abnormal status 0x%X on port 0x%p\n", 1261 ata_port_printk(ap, KERN_DEBUG, "abnormal Status 0x%X\n",
1115 status, ap->ioaddr.status_addr); 1262 status);
1263#endif
1116 1264
1117 return status; 1265 return status;
1118} 1266}
@@ -1149,7 +1297,7 @@ static inline void ata_tf_init(struct ata_device *dev, struct ata_taskfile *tf)
1149{ 1297{
1150 memset(tf, 0, sizeof(*tf)); 1298 memset(tf, 0, sizeof(*tf));
1151 1299
1152 tf->ctl = dev->ap->ctl; 1300 tf->ctl = dev->link->ap->ctl;
1153 if (dev->devno == 0) 1301 if (dev->devno == 0)
1154 tf->device = ATA_DEVICE_OBS; 1302 tf->device = ATA_DEVICE_OBS;
1155 else 1303 else
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h
index 0e843bf65877..f6279f68a827 100644
--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -238,6 +238,7 @@ extern void lockdep_info(void);
238extern void lockdep_reset(void); 238extern void lockdep_reset(void);
239extern void lockdep_reset_lock(struct lockdep_map *lock); 239extern void lockdep_reset_lock(struct lockdep_map *lock);
240extern void lockdep_free_key_range(void *start, unsigned long size); 240extern void lockdep_free_key_range(void *start, unsigned long size);
241extern void lockdep_sys_exit(void);
241 242
242extern void lockdep_off(void); 243extern void lockdep_off(void);
243extern void lockdep_on(void); 244extern void lockdep_on(void);
@@ -252,6 +253,13 @@ extern void lockdep_init_map(struct lockdep_map *lock, const char *name,
252 struct lock_class_key *key, int subclass); 253 struct lock_class_key *key, int subclass);
253 254
254/* 255/*
256 * To initialize a lockdep_map statically use this macro.
257 * Note that _name must not be NULL.
258 */
259#define STATIC_LOCKDEP_MAP_INIT(_name, _key) \
260 { .name = (_name), .key = (void *)(_key), }
261
262/*
255 * Reinitialize a lock key - for cases where there is special locking or 263 * Reinitialize a lock key - for cases where there is special locking or
256 * special initialization of locks so that the validator gets the scope 264 * special initialization of locks so that the validator gets the scope
257 * of dependencies wrong: they are either too broad (they need a class-split) 265 * of dependencies wrong: they are either too broad (they need a class-split)
@@ -317,6 +325,7 @@ static inline void lockdep_on(void)
317# define INIT_LOCKDEP 325# define INIT_LOCKDEP
318# define lockdep_reset() do { debug_locks = 1; } while (0) 326# define lockdep_reset() do { debug_locks = 1; } while (0)
319# define lockdep_free_key_range(start, size) do { } while (0) 327# define lockdep_free_key_range(start, size) do { } while (0)
328# define lockdep_sys_exit() do { } while (0)
320/* 329/*
321 * The class key takes no space if lockdep is disabled: 330 * The class key takes no space if lockdep is disabled:
322 */ 331 */
diff --git a/include/linux/maple.h b/include/linux/maple.h
new file mode 100644
index 000000000000..bad9a7b319de
--- /dev/null
+++ b/include/linux/maple.h
@@ -0,0 +1,80 @@
1#ifndef __LINUX_MAPLE_H
2#define __LINUX_MAPLE_H
3
4#include <linux/device.h>
5
6extern struct bus_type maple_bus_type;
7
8/* Maple Bus command and response codes */
9enum maple_code {
10 MAPLE_RESPONSE_FILEERR = -5,
11 MAPLE_RESPONSE_AGAIN = -4, /* request should be retransmitted */
12 MAPLE_RESPONSE_BADCMD = -3,
13 MAPLE_RESPONSE_BADFUNC = -2,
14 MAPLE_RESPONSE_NONE = -1, /* unit didn't respond at all */
15 MAPLE_COMMAND_DEVINFO = 1,
16 MAPLE_COMMAND_ALLINFO = 2,
17 MAPLE_COMMAND_RESET = 3,
18 MAPLE_COMMAND_KILL = 4,
19 MAPLE_RESPONSE_DEVINFO = 5,
20 MAPLE_RESPONSE_ALLINFO = 6,
21 MAPLE_RESPONSE_OK = 7,
22 MAPLE_RESPONSE_DATATRF = 8,
23 MAPLE_COMMAND_GETCOND = 9,
24 MAPLE_COMMAND_GETMINFO = 10,
25 MAPLE_COMMAND_BREAD = 11,
26 MAPLE_COMMAND_BWRITE = 12,
27 MAPLE_COMMAND_SETCOND = 14
28};
29
30struct mapleq {
31 struct list_head list;
32 struct maple_device *dev;
33 void *sendbuf, *recvbuf, *recvbufdcsp;
34 unsigned char length;
35 enum maple_code command;
36};
37
38struct maple_devinfo {
39 unsigned long function;
40 unsigned long function_data[3];
41 unsigned char area_code;
42 unsigned char connector_directon;
43 char product_name[31];
44 char product_licence[61];
45 unsigned short standby_power;
46 unsigned short max_power;
47};
48
49struct maple_device {
50 struct maple_driver *driver;
51 struct mapleq *mq;
52 void *private_data;
53 void (*callback) (struct mapleq * mq);
54 unsigned long when, interval, function;
55 struct maple_devinfo devinfo;
56 unsigned char port, unit;
57 char product_name[32];
58 char product_licence[64];
59 int registered;
60 struct device dev;
61};
62
63struct maple_driver {
64 unsigned long function;
65 int (*connect) (struct maple_device * dev);
66 void (*disconnect) (struct maple_device * dev);
67 struct device_driver drv;
68};
69
70void maple_getcond_callback(struct maple_device *dev,
71 void (*callback) (struct mapleq * mq),
72 unsigned long interval,
73 unsigned long function);
74int maple_driver_register(struct device_driver *drv);
75void maple_add_packet(struct mapleq *mq);
76
77#define to_maple_dev(n) container_of(n, struct maple_device, dev)
78#define to_maple_driver(n) container_of(n, struct maple_driver, drv)
79
80#endif /* __LINUX_MAPLE_H */
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index 74523d999f7a..522b0dd836cf 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -262,11 +262,6 @@ struct pcmcia_device_id {
262#define PCMCIA_DEV_ID_MATCH_FAKE_CIS 0x0200 262#define PCMCIA_DEV_ID_MATCH_FAKE_CIS 0x0200
263#define PCMCIA_DEV_ID_MATCH_ANONYMOUS 0x0400 263#define PCMCIA_DEV_ID_MATCH_ANONYMOUS 0x0400
264 264
265/* I2C */
266struct i2c_device_id {
267 __u16 id;
268};
269
270/* Input */ 265/* Input */
271#define INPUT_DEVICE_ID_EV_MAX 0x1f 266#define INPUT_DEVICE_ID_EV_MAX 0x1f
272#define INPUT_DEVICE_ID_KEY_MIN_INTERESTING 0x71 267#define INPUT_DEVICE_ID_KEY_MIN_INTERESTING 0x71
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index 123948b14547..e17c5343cf51 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -57,6 +57,15 @@
57#define cfi_interleave_is_8(cfi) (0) 57#define cfi_interleave_is_8(cfi) (0)
58#endif 58#endif
59 59
60#ifndef cfi_interleave
61#warning No CONFIG_MTD_CFI_Ix selected. No NOR chip support can work.
62static inline int cfi_interleave(void *cfi)
63{
64 BUG();
65 return 0;
66}
67#endif
68
60static inline int cfi_interleave_supported(int i) 69static inline int cfi_interleave_supported(int i)
61{ 70{
62 switch (i) { 71 switch (i) {
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h
index a293a3b78e05..39e7d2a1be9a 100644
--- a/include/linux/mtd/flashchip.h
+++ b/include/linux/mtd/flashchip.h
@@ -40,6 +40,7 @@ typedef enum {
40 FL_POINT, 40 FL_POINT,
41 FL_XIP_WHILE_ERASING, 41 FL_XIP_WHILE_ERASING,
42 FL_XIP_WHILE_WRITING, 42 FL_XIP_WHILE_WRITING,
43 FL_SHUTDOWN,
43 FL_UNKNOWN 44 FL_UNKNOWN
44} flstate_t; 45} flstate_t;
45 46
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
index 81f3a314dd76..a9fae032ba81 100644
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -125,7 +125,15 @@
125#endif 125#endif
126 126
127#ifndef map_bankwidth 127#ifndef map_bankwidth
128#error "No bus width supported. What's the point?" 128#warning "No CONFIG_MTD_MAP_BANK_WIDTH_xx selected. No NOR chip support can work"
129static inline int map_bankwidth(void *map)
130{
131 BUG();
132 return 0;
133}
134#define map_bankwidth_is_large(map) (0)
135#define map_words(map) (0)
136#define MAX_MAP_BANKWIDTH 1
129#endif 137#endif
130 138
131static inline int map_bankwidth_supported(int w) 139static inline int map_bankwidth_supported(int w)
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index fd64ccfbce02..783fc983417c 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -133,6 +133,13 @@ struct mtd_info {
133 int numeraseregions; 133 int numeraseregions;
134 struct mtd_erase_region_info *eraseregions; 134 struct mtd_erase_region_info *eraseregions;
135 135
136 /*
137 * Erase is an asynchronous operation. Device drivers are supposed
138 * to call instr->callback() whenever the operation completes, even
139 * if it completes with a failure.
140 * Callers are supposed to pass a callback function and wait for it
141 * to be called before writing to the block.
142 */
136 int (*erase) (struct mtd_info *mtd, struct erase_info *instr); 143 int (*erase) (struct mtd_info *mtd, struct erase_info *instr);
137 144
138 /* This stuff for eXecute-In-Place */ 145 /* This stuff for eXecute-In-Place */
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index d2365c8dcacc..c42bc7f533a5 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -432,6 +432,7 @@ struct nand_chip {
432#define NAND_MFR_STMICRO 0x20 432#define NAND_MFR_STMICRO 0x20
433#define NAND_MFR_HYNIX 0xad 433#define NAND_MFR_HYNIX 0xad
434#define NAND_MFR_MICRON 0x2c 434#define NAND_MFR_MICRON 0x2c
435#define NAND_MFR_AMD 0x01
435 436
436/** 437/**
437 * struct nand_flash_dev - NAND Flash Device ID Structure 438 * struct nand_flash_dev - NAND Flash Device ID Structure
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index a56d24ada505..fd0a260e070b 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -60,6 +60,7 @@ struct onenand_bufferram {
60 * @erase_shift: [INTERN] number of address bits in a block 60 * @erase_shift: [INTERN] number of address bits in a block
61 * @page_shift: [INTERN] number of address bits in a page 61 * @page_shift: [INTERN] number of address bits in a page
62 * @page_mask: [INTERN] a page per block mask 62 * @page_mask: [INTERN] a page per block mask
63 * @writesize: [INTERN] a real page size
63 * @bufferram_index: [INTERN] BufferRAM index 64 * @bufferram_index: [INTERN] BufferRAM index
64 * @bufferram: [INTERN] BufferRAM info 65 * @bufferram: [INTERN] BufferRAM info
65 * @readw: [REPLACEABLE] hardware specific function for read short 66 * @readw: [REPLACEABLE] hardware specific function for read short
@@ -100,6 +101,7 @@ struct onenand_chip {
100 unsigned int erase_shift; 101 unsigned int erase_shift;
101 unsigned int page_shift; 102 unsigned int page_shift;
102 unsigned int page_mask; 103 unsigned int page_mask;
104 unsigned int writesize;
103 105
104 unsigned int bufferram_index; 106 unsigned int bufferram_index;
105 struct onenand_bufferram bufferram[MAX_BUFFERRAM]; 107 struct onenand_bufferram bufferram[MAX_BUFFERRAM];
@@ -140,6 +142,8 @@ struct onenand_chip {
140#define ONENAND_NEXT_BUFFERRAM(this) (this->bufferram_index ^ 1) 142#define ONENAND_NEXT_BUFFERRAM(this) (this->bufferram_index ^ 1)
141#define ONENAND_SET_NEXT_BUFFERRAM(this) (this->bufferram_index ^= 1) 143#define ONENAND_SET_NEXT_BUFFERRAM(this) (this->bufferram_index ^= 1)
142#define ONENAND_SET_PREV_BUFFERRAM(this) (this->bufferram_index ^= 1) 144#define ONENAND_SET_PREV_BUFFERRAM(this) (this->bufferram_index ^= 1)
145#define ONENAND_SET_BUFFERRAM0(this) (this->bufferram_index = 0)
146#define ONENAND_SET_BUFFERRAM1(this) (this->bufferram_index = 1)
143 147
144#define ONENAND_GET_SYS_CFG1(this) \ 148#define ONENAND_GET_SYS_CFG1(this) \
145 (this->read_word(this->base + ONENAND_REG_SYS_CFG1)) 149 (this->read_word(this->base + ONENAND_REG_SYS_CFG1))
@@ -149,6 +153,13 @@ struct onenand_chip {
149#define ONENAND_IS_DDP(this) \ 153#define ONENAND_IS_DDP(this) \
150 (this->device_id & ONENAND_DEVICE_IS_DDP) 154 (this->device_id & ONENAND_DEVICE_IS_DDP)
151 155
156#ifdef CONFIG_MTD_ONENAND_2X_PROGRAM
157#define ONENAND_IS_2PLANE(this) \
158 (this->options & ONENAND_HAS_2PLANE)
159#else
160#define ONENAND_IS_2PLANE(this) (0)
161#endif
162
152/* Check byte access in OneNAND */ 163/* Check byte access in OneNAND */
153#define ONENAND_CHECK_BYTE_ACCESS(addr) (addr & 0x1) 164#define ONENAND_CHECK_BYTE_ACCESS(addr) (addr & 0x1)
154 165
@@ -157,6 +168,7 @@ struct onenand_chip {
157 */ 168 */
158#define ONENAND_HAS_CONT_LOCK (0x0001) 169#define ONENAND_HAS_CONT_LOCK (0x0001)
159#define ONENAND_HAS_UNLOCK_ALL (0x0002) 170#define ONENAND_HAS_UNLOCK_ALL (0x0002)
171#define ONENAND_HAS_2PLANE (0x0004)
160#define ONENAND_PAGEBUF_ALLOC (0x1000) 172#define ONENAND_PAGEBUF_ALLOC (0x1000)
161#define ONENAND_OOBBUF_ALLOC (0x2000) 173#define ONENAND_OOBBUF_ALLOC (0x2000)
162 174
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h
index af94719890e7..c46161f4eee3 100644
--- a/include/linux/mtd/onenand_regs.h
+++ b/include/linux/mtd/onenand_regs.h
@@ -74,6 +74,8 @@
74 74
75#define ONENAND_DEVICE_DENSITY_512Mb (0x002) 75#define ONENAND_DEVICE_DENSITY_512Mb (0x002)
76#define ONENAND_DEVICE_DENSITY_1Gb (0x003) 76#define ONENAND_DEVICE_DENSITY_1Gb (0x003)
77#define ONENAND_DEVICE_DENSITY_2Gb (0x004)
78#define ONENAND_DEVICE_DENSITY_4Gb (0x005)
77 79
78/* 80/*
79 * Version ID Register F002h (R) 81 * Version ID Register F002h (R)
@@ -111,6 +113,8 @@
111#define ONENAND_CMD_READOOB (0x13) 113#define ONENAND_CMD_READOOB (0x13)
112#define ONENAND_CMD_PROG (0x80) 114#define ONENAND_CMD_PROG (0x80)
113#define ONENAND_CMD_PROGOOB (0x1A) 115#define ONENAND_CMD_PROGOOB (0x1A)
116#define ONENAND_CMD_2X_PROG (0x7D)
117#define ONENAND_CMD_2X_CACHE_PROG (0x7F)
114#define ONENAND_CMD_UNLOCK (0x23) 118#define ONENAND_CMD_UNLOCK (0x23)
115#define ONENAND_CMD_LOCK (0x2A) 119#define ONENAND_CMD_LOCK (0x2A)
116#define ONENAND_CMD_LOCK_TIGHT (0x2C) 120#define ONENAND_CMD_LOCK_TIGHT (0x2C)
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 0d50ea3df689..6a735c72f23f 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -120,14 +120,17 @@ static inline int fastcall mutex_is_locked(struct mutex *lock)
120 * See kernel/mutex.c for detailed documentation of these APIs. 120 * See kernel/mutex.c for detailed documentation of these APIs.
121 * Also see Documentation/mutex-design.txt. 121 * Also see Documentation/mutex-design.txt.
122 */ 122 */
123extern void fastcall mutex_lock(struct mutex *lock);
124extern int __must_check fastcall mutex_lock_interruptible(struct mutex *lock);
125
126#ifdef CONFIG_DEBUG_LOCK_ALLOC 123#ifdef CONFIG_DEBUG_LOCK_ALLOC
127extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass); 124extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass);
128extern int __must_check mutex_lock_interruptible_nested(struct mutex *lock, 125extern int __must_check mutex_lock_interruptible_nested(struct mutex *lock,
129 unsigned int subclass); 126 unsigned int subclass);
127
128#define mutex_lock(lock) mutex_lock_nested(lock, 0)
129#define mutex_lock_interruptible(lock) mutex_lock_interruptible_nested(lock, 0)
130#else 130#else
131extern void fastcall mutex_lock(struct mutex *lock);
132extern int __must_check fastcall mutex_lock_interruptible(struct mutex *lock);
133
131# define mutex_lock_nested(lock, subclass) mutex_lock(lock) 134# define mutex_lock_nested(lock, subclass) mutex_lock(lock)
132# define mutex_lock_interruptible_nested(lock, subclass) mutex_lock_interruptible(lock) 135# define mutex_lock_interruptible_nested(lock, subclass) mutex_lock_interruptible(lock)
133#endif 136#endif
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5a11f889e56a..39dd83b183a9 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1294,6 +1294,7 @@ static inline void netif_rx_complete(struct net_device *dev,
1294/** 1294/**
1295 * netif_tx_lock - grab network device transmit lock 1295 * netif_tx_lock - grab network device transmit lock
1296 * @dev: network device 1296 * @dev: network device
1297 * @cpu: cpu number of lock owner
1297 * 1298 *
1298 * Get network device transmit lock 1299 * Get network device transmit lock
1299 */ 1300 */
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 1dd075eda595..16adac688af5 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -51,7 +51,7 @@ struct sk_buff;
51struct net_device; 51struct net_device;
52 52
53typedef unsigned int nf_hookfn(unsigned int hooknum, 53typedef unsigned int nf_hookfn(unsigned int hooknum,
54 struct sk_buff **skb, 54 struct sk_buff *skb,
55 const struct net_device *in, 55 const struct net_device *in,
56 const struct net_device *out, 56 const struct net_device *out,
57 int (*okfn)(struct sk_buff *)); 57 int (*okfn)(struct sk_buff *));
@@ -183,7 +183,7 @@ void nf_log_packet(int pf,
183 struct nf_loginfo *li, 183 struct nf_loginfo *li,
184 const char *fmt, ...); 184 const char *fmt, ...);
185 185
186int nf_hook_slow(int pf, unsigned int hook, struct sk_buff **pskb, 186int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb,
187 struct net_device *indev, struct net_device *outdev, 187 struct net_device *indev, struct net_device *outdev,
188 int (*okfn)(struct sk_buff *), int thresh); 188 int (*okfn)(struct sk_buff *), int thresh);
189 189
@@ -195,7 +195,7 @@ int nf_hook_slow(int pf, unsigned int hook, struct sk_buff **pskb,
195 * value indicates the packet has been consumed by the hook. 195 * value indicates the packet has been consumed by the hook.
196 */ 196 */
197static inline int nf_hook_thresh(int pf, unsigned int hook, 197static inline int nf_hook_thresh(int pf, unsigned int hook,
198 struct sk_buff **pskb, 198 struct sk_buff *skb,
199 struct net_device *indev, 199 struct net_device *indev,
200 struct net_device *outdev, 200 struct net_device *outdev,
201 int (*okfn)(struct sk_buff *), int thresh, 201 int (*okfn)(struct sk_buff *), int thresh,
@@ -207,14 +207,14 @@ static inline int nf_hook_thresh(int pf, unsigned int hook,
207 if (list_empty(&nf_hooks[pf][hook])) 207 if (list_empty(&nf_hooks[pf][hook]))
208 return 1; 208 return 1;
209#endif 209#endif
210 return nf_hook_slow(pf, hook, pskb, indev, outdev, okfn, thresh); 210 return nf_hook_slow(pf, hook, skb, indev, outdev, okfn, thresh);
211} 211}
212 212
213static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb, 213static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb,
214 struct net_device *indev, struct net_device *outdev, 214 struct net_device *indev, struct net_device *outdev,
215 int (*okfn)(struct sk_buff *)) 215 int (*okfn)(struct sk_buff *))
216{ 216{
217 return nf_hook_thresh(pf, hook, pskb, indev, outdev, okfn, INT_MIN, 1); 217 return nf_hook_thresh(pf, hook, skb, indev, outdev, okfn, INT_MIN, 1);
218} 218}
219 219
220/* Activate hook; either okfn or kfree_skb called, unless a hook 220/* Activate hook; either okfn or kfree_skb called, unless a hook
@@ -241,13 +241,13 @@ static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb,
241 241
242#define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \ 242#define NF_HOOK_THRESH(pf, hook, skb, indev, outdev, okfn, thresh) \
243({int __ret; \ 243({int __ret; \
244if ((__ret=nf_hook_thresh(pf, hook, &(skb), indev, outdev, okfn, thresh, 1)) == 1)\ 244if ((__ret=nf_hook_thresh(pf, hook, (skb), indev, outdev, okfn, thresh, 1)) == 1)\
245 __ret = (okfn)(skb); \ 245 __ret = (okfn)(skb); \
246__ret;}) 246__ret;})
247 247
248#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) \ 248#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) \
249({int __ret; \ 249({int __ret; \
250if ((__ret=nf_hook_thresh(pf, hook, &(skb), indev, outdev, okfn, INT_MIN, cond)) == 1)\ 250if ((__ret=nf_hook_thresh(pf, hook, (skb), indev, outdev, okfn, INT_MIN, cond)) == 1)\
251 __ret = (okfn)(skb); \ 251 __ret = (okfn)(skb); \
252__ret;}) 252__ret;})
253 253
@@ -287,7 +287,7 @@ extern void nf_invalidate_cache(int pf);
287/* Call this before modifying an existing packet: ensures it is 287/* Call this before modifying an existing packet: ensures it is
288 modifiable and linear to the point you care about (writable_len). 288 modifiable and linear to the point you care about (writable_len).
289 Returns true or false. */ 289 Returns true or false. */
290extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len); 290extern int skb_make_writable(struct sk_buff *skb, unsigned int writable_len);
291 291
292static inline void nf_csum_replace4(__sum16 *sum, __be32 from, __be32 to) 292static inline void nf_csum_replace4(__sum16 *sum, __be32 from, __be32 to)
293{ 293{
@@ -317,7 +317,7 @@ struct nf_afinfo {
317 unsigned int dataoff, u_int8_t protocol); 317 unsigned int dataoff, u_int8_t protocol);
318 void (*saveroute)(const struct sk_buff *skb, 318 void (*saveroute)(const struct sk_buff *skb,
319 struct nf_info *info); 319 struct nf_info *info);
320 int (*reroute)(struct sk_buff **skb, 320 int (*reroute)(struct sk_buff *skb,
321 const struct nf_info *info); 321 const struct nf_info *info);
322 int route_key_size; 322 int route_key_size;
323}; 323};
@@ -371,15 +371,15 @@ extern struct proc_dir_entry *proc_net_netfilter;
371#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb) 371#define NF_HOOK(pf, hook, skb, indev, outdev, okfn) (okfn)(skb)
372#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb) 372#define NF_HOOK_COND(pf, hook, skb, indev, outdev, okfn, cond) (okfn)(skb)
373static inline int nf_hook_thresh(int pf, unsigned int hook, 373static inline int nf_hook_thresh(int pf, unsigned int hook,
374 struct sk_buff **pskb, 374 struct sk_buff *skb,
375 struct net_device *indev, 375 struct net_device *indev,
376 struct net_device *outdev, 376 struct net_device *outdev,
377 int (*okfn)(struct sk_buff *), int thresh, 377 int (*okfn)(struct sk_buff *), int thresh,
378 int cond) 378 int cond)
379{ 379{
380 return okfn(*pskb); 380 return okfn(skb);
381} 381}
382static inline int nf_hook(int pf, unsigned int hook, struct sk_buff **pskb, 382static inline int nf_hook(int pf, unsigned int hook, struct sk_buff *skb,
383 struct net_device *indev, struct net_device *outdev, 383 struct net_device *indev, struct net_device *outdev,
384 int (*okfn)(struct sk_buff *)) 384 int (*okfn)(struct sk_buff *))
385{ 385{
diff --git a/include/linux/netfilter/nf_conntrack_amanda.h b/include/linux/netfilter/nf_conntrack_amanda.h
index 26c223544ae8..0bb5a6976bf3 100644
--- a/include/linux/netfilter/nf_conntrack_amanda.h
+++ b/include/linux/netfilter/nf_conntrack_amanda.h
@@ -2,7 +2,7 @@
2#define _NF_CONNTRACK_AMANDA_H 2#define _NF_CONNTRACK_AMANDA_H
3/* AMANDA tracking. */ 3/* AMANDA tracking. */
4 4
5extern unsigned int (*nf_nat_amanda_hook)(struct sk_buff **pskb, 5extern unsigned int (*nf_nat_amanda_hook)(struct sk_buff *skb,
6 enum ip_conntrack_info ctinfo, 6 enum ip_conntrack_info ctinfo,
7 unsigned int matchoff, 7 unsigned int matchoff,
8 unsigned int matchlen, 8 unsigned int matchlen,
diff --git a/include/linux/netfilter/nf_conntrack_ftp.h b/include/linux/netfilter/nf_conntrack_ftp.h
index b7c360ffd0d0..47727d7546ea 100644
--- a/include/linux/netfilter/nf_conntrack_ftp.h
+++ b/include/linux/netfilter/nf_conntrack_ftp.h
@@ -32,7 +32,7 @@ struct nf_conntrack_expect;
32 32
33/* For NAT to hook in when we find a packet which describes what other 33/* For NAT to hook in when we find a packet which describes what other
34 * connection we should expect. */ 34 * connection we should expect. */
35extern unsigned int (*nf_nat_ftp_hook)(struct sk_buff **pskb, 35extern unsigned int (*nf_nat_ftp_hook)(struct sk_buff *skb,
36 enum ip_conntrack_info ctinfo, 36 enum ip_conntrack_info ctinfo,
37 enum nf_ct_ftp_type type, 37 enum nf_ct_ftp_type type,
38 unsigned int matchoff, 38 unsigned int matchoff,
diff --git a/include/linux/netfilter/nf_conntrack_h323.h b/include/linux/netfilter/nf_conntrack_h323.h
index 08e2f4977c2e..aabd24ac7631 100644
--- a/include/linux/netfilter/nf_conntrack_h323.h
+++ b/include/linux/netfilter/nf_conntrack_h323.h
@@ -36,27 +36,27 @@ extern void nf_conntrack_h245_expect(struct nf_conn *new,
36 struct nf_conntrack_expect *this); 36 struct nf_conntrack_expect *this);
37extern void nf_conntrack_q931_expect(struct nf_conn *new, 37extern void nf_conntrack_q931_expect(struct nf_conn *new,
38 struct nf_conntrack_expect *this); 38 struct nf_conntrack_expect *this);
39extern int (*set_h245_addr_hook) (struct sk_buff **pskb, 39extern int (*set_h245_addr_hook) (struct sk_buff *skb,
40 unsigned char **data, int dataoff, 40 unsigned char **data, int dataoff,
41 H245_TransportAddress *taddr, 41 H245_TransportAddress *taddr,
42 union nf_conntrack_address *addr, 42 union nf_conntrack_address *addr,
43 __be16 port); 43 __be16 port);
44extern int (*set_h225_addr_hook) (struct sk_buff **pskb, 44extern int (*set_h225_addr_hook) (struct sk_buff *skb,
45 unsigned char **data, int dataoff, 45 unsigned char **data, int dataoff,
46 TransportAddress *taddr, 46 TransportAddress *taddr,
47 union nf_conntrack_address *addr, 47 union nf_conntrack_address *addr,
48 __be16 port); 48 __be16 port);
49extern int (*set_sig_addr_hook) (struct sk_buff **pskb, 49extern int (*set_sig_addr_hook) (struct sk_buff *skb,
50 struct nf_conn *ct, 50 struct nf_conn *ct,
51 enum ip_conntrack_info ctinfo, 51 enum ip_conntrack_info ctinfo,
52 unsigned char **data, 52 unsigned char **data,
53 TransportAddress *taddr, int count); 53 TransportAddress *taddr, int count);
54extern int (*set_ras_addr_hook) (struct sk_buff **pskb, 54extern int (*set_ras_addr_hook) (struct sk_buff *skb,
55 struct nf_conn *ct, 55 struct nf_conn *ct,
56 enum ip_conntrack_info ctinfo, 56 enum ip_conntrack_info ctinfo,
57 unsigned char **data, 57 unsigned char **data,
58 TransportAddress *taddr, int count); 58 TransportAddress *taddr, int count);
59extern int (*nat_rtp_rtcp_hook) (struct sk_buff **pskb, 59extern int (*nat_rtp_rtcp_hook) (struct sk_buff *skb,
60 struct nf_conn *ct, 60 struct nf_conn *ct,
61 enum ip_conntrack_info ctinfo, 61 enum ip_conntrack_info ctinfo,
62 unsigned char **data, int dataoff, 62 unsigned char **data, int dataoff,
@@ -64,24 +64,24 @@ extern int (*nat_rtp_rtcp_hook) (struct sk_buff **pskb,
64 __be16 port, __be16 rtp_port, 64 __be16 port, __be16 rtp_port,
65 struct nf_conntrack_expect *rtp_exp, 65 struct nf_conntrack_expect *rtp_exp,
66 struct nf_conntrack_expect *rtcp_exp); 66 struct nf_conntrack_expect *rtcp_exp);
67extern int (*nat_t120_hook) (struct sk_buff **pskb, struct nf_conn *ct, 67extern int (*nat_t120_hook) (struct sk_buff *skb, struct nf_conn *ct,
68 enum ip_conntrack_info ctinfo, 68 enum ip_conntrack_info ctinfo,
69 unsigned char **data, int dataoff, 69 unsigned char **data, int dataoff,
70 H245_TransportAddress *taddr, __be16 port, 70 H245_TransportAddress *taddr, __be16 port,
71 struct nf_conntrack_expect *exp); 71 struct nf_conntrack_expect *exp);
72extern int (*nat_h245_hook) (struct sk_buff **pskb, struct nf_conn *ct, 72extern int (*nat_h245_hook) (struct sk_buff *skb, struct nf_conn *ct,
73 enum ip_conntrack_info ctinfo, 73 enum ip_conntrack_info ctinfo,
74 unsigned char **data, int dataoff, 74 unsigned char **data, int dataoff,
75 TransportAddress *taddr, __be16 port, 75 TransportAddress *taddr, __be16 port,
76 struct nf_conntrack_expect *exp); 76 struct nf_conntrack_expect *exp);
77extern int (*nat_callforwarding_hook) (struct sk_buff **pskb, 77extern int (*nat_callforwarding_hook) (struct sk_buff *skb,
78 struct nf_conn *ct, 78 struct nf_conn *ct,
79 enum ip_conntrack_info ctinfo, 79 enum ip_conntrack_info ctinfo,
80 unsigned char **data, int dataoff, 80 unsigned char **data, int dataoff,
81 TransportAddress *taddr, 81 TransportAddress *taddr,
82 __be16 port, 82 __be16 port,
83 struct nf_conntrack_expect *exp); 83 struct nf_conntrack_expect *exp);
84extern int (*nat_q931_hook) (struct sk_buff **pskb, struct nf_conn *ct, 84extern int (*nat_q931_hook) (struct sk_buff *skb, struct nf_conn *ct,
85 enum ip_conntrack_info ctinfo, 85 enum ip_conntrack_info ctinfo,
86 unsigned char **data, TransportAddress *taddr, 86 unsigned char **data, TransportAddress *taddr,
87 int idx, __be16 port, 87 int idx, __be16 port,
diff --git a/include/linux/netfilter/nf_conntrack_irc.h b/include/linux/netfilter/nf_conntrack_irc.h
index 2ab6b8255911..36282bf71b63 100644
--- a/include/linux/netfilter/nf_conntrack_irc.h
+++ b/include/linux/netfilter/nf_conntrack_irc.h
@@ -5,7 +5,7 @@
5 5
6#define IRC_PORT 6667 6#define IRC_PORT 6667
7 7
8extern unsigned int (*nf_nat_irc_hook)(struct sk_buff **pskb, 8extern unsigned int (*nf_nat_irc_hook)(struct sk_buff *skb,
9 enum ip_conntrack_info ctinfo, 9 enum ip_conntrack_info ctinfo,
10 unsigned int matchoff, 10 unsigned int matchoff,
11 unsigned int matchlen, 11 unsigned int matchlen,
diff --git a/include/linux/netfilter/nf_conntrack_pptp.h b/include/linux/netfilter/nf_conntrack_pptp.h
index c93061f33144..23435496d24a 100644
--- a/include/linux/netfilter/nf_conntrack_pptp.h
+++ b/include/linux/netfilter/nf_conntrack_pptp.h
@@ -301,13 +301,13 @@ struct nf_conn;
301struct nf_conntrack_expect; 301struct nf_conntrack_expect;
302 302
303extern int 303extern int
304(*nf_nat_pptp_hook_outbound)(struct sk_buff **pskb, 304(*nf_nat_pptp_hook_outbound)(struct sk_buff *skb,
305 struct nf_conn *ct, enum ip_conntrack_info ctinfo, 305 struct nf_conn *ct, enum ip_conntrack_info ctinfo,
306 struct PptpControlHeader *ctlh, 306 struct PptpControlHeader *ctlh,
307 union pptp_ctrl_union *pptpReq); 307 union pptp_ctrl_union *pptpReq);
308 308
309extern int 309extern int
310(*nf_nat_pptp_hook_inbound)(struct sk_buff **pskb, 310(*nf_nat_pptp_hook_inbound)(struct sk_buff *skb,
311 struct nf_conn *ct, enum ip_conntrack_info ctinfo, 311 struct nf_conn *ct, enum ip_conntrack_info ctinfo,
312 struct PptpControlHeader *ctlh, 312 struct PptpControlHeader *ctlh,
313 union pptp_ctrl_union *pptpReq); 313 union pptp_ctrl_union *pptpReq);
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h
index bb7f2041db74..9fff19779bd5 100644
--- a/include/linux/netfilter/nf_conntrack_sip.h
+++ b/include/linux/netfilter/nf_conntrack_sip.h
@@ -21,11 +21,11 @@ enum sip_header_pos {
21 POS_SDP_HEADER, 21 POS_SDP_HEADER,
22}; 22};
23 23
24extern unsigned int (*nf_nat_sip_hook)(struct sk_buff **pskb, 24extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb,
25 enum ip_conntrack_info ctinfo, 25 enum ip_conntrack_info ctinfo,
26 struct nf_conn *ct, 26 struct nf_conn *ct,
27 const char **dptr); 27 const char **dptr);
28extern unsigned int (*nf_nat_sdp_hook)(struct sk_buff **pskb, 28extern unsigned int (*nf_nat_sdp_hook)(struct sk_buff *skb,
29 enum ip_conntrack_info ctinfo, 29 enum ip_conntrack_info ctinfo,
30 struct nf_conntrack_expect *exp, 30 struct nf_conntrack_expect *exp,
31 const char *dptr); 31 const char *dptr);
diff --git a/include/linux/netfilter/nf_conntrack_tftp.h b/include/linux/netfilter/nf_conntrack_tftp.h
index 0d79b7ae051f..c78d38fdb050 100644
--- a/include/linux/netfilter/nf_conntrack_tftp.h
+++ b/include/linux/netfilter/nf_conntrack_tftp.h
@@ -13,7 +13,7 @@ struct tftphdr {
13#define TFTP_OPCODE_ACK 4 13#define TFTP_OPCODE_ACK 4
14#define TFTP_OPCODE_ERROR 5 14#define TFTP_OPCODE_ERROR 5
15 15
16extern unsigned int (*nf_nat_tftp_hook)(struct sk_buff **pskb, 16extern unsigned int (*nf_nat_tftp_hook)(struct sk_buff *skb,
17 enum ip_conntrack_info ctinfo, 17 enum ip_conntrack_info ctinfo,
18 struct nf_conntrack_expect *exp); 18 struct nf_conntrack_expect *exp);
19 19
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index 64f425a855bb..03e6ce979eaa 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -191,7 +191,7 @@ struct xt_target
191 /* Returns verdict. Argument order changed since 2.6.9, as this 191 /* Returns verdict. Argument order changed since 2.6.9, as this
192 must now handle non-linear skbs, using skb_copy_bits and 192 must now handle non-linear skbs, using skb_copy_bits and
193 skb_ip_make_writable. */ 193 skb_ip_make_writable. */
194 unsigned int (*target)(struct sk_buff **pskb, 194 unsigned int (*target)(struct sk_buff *skb,
195 const struct net_device *in, 195 const struct net_device *in,
196 const struct net_device *out, 196 const struct net_device *out,
197 unsigned int hooknum, 197 unsigned int hooknum,
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index 584cd1b18f12..2fc73fa8e37f 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -287,7 +287,7 @@ struct arpt_error
287extern int arpt_register_table(struct arpt_table *table, 287extern int arpt_register_table(struct arpt_table *table,
288 const struct arpt_replace *repl); 288 const struct arpt_replace *repl);
289extern void arpt_unregister_table(struct arpt_table *table); 289extern void arpt_unregister_table(struct arpt_table *table);
290extern unsigned int arpt_do_table(struct sk_buff **pskb, 290extern unsigned int arpt_do_table(struct sk_buff *skb,
291 unsigned int hook, 291 unsigned int hook,
292 const struct net_device *in, 292 const struct net_device *in,
293 const struct net_device *out, 293 const struct net_device *out,
diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
index 94e0a7dc0cb2..892f5b7771c7 100644
--- a/include/linux/netfilter_bridge/ebtables.h
+++ b/include/linux/netfilter_bridge/ebtables.h
@@ -237,7 +237,7 @@ struct ebt_target
237 struct list_head list; 237 struct list_head list;
238 const char name[EBT_FUNCTION_MAXNAMELEN]; 238 const char name[EBT_FUNCTION_MAXNAMELEN];
239 /* returns one of the standard verdicts */ 239 /* returns one of the standard verdicts */
240 int (*target)(struct sk_buff **pskb, unsigned int hooknr, 240 int (*target)(struct sk_buff *skb, unsigned int hooknr,
241 const struct net_device *in, const struct net_device *out, 241 const struct net_device *in, const struct net_device *out,
242 const void *targetdata, unsigned int datalen); 242 const void *targetdata, unsigned int datalen);
243 /* 0 == let it in */ 243 /* 0 == let it in */
@@ -294,7 +294,7 @@ extern int ebt_register_watcher(struct ebt_watcher *watcher);
294extern void ebt_unregister_watcher(struct ebt_watcher *watcher); 294extern void ebt_unregister_watcher(struct ebt_watcher *watcher);
295extern int ebt_register_target(struct ebt_target *target); 295extern int ebt_register_target(struct ebt_target *target);
296extern void ebt_unregister_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 **pskb, 297extern unsigned int ebt_do_table(unsigned int hook, struct sk_buff *skb,
298 const struct net_device *in, const struct net_device *out, 298 const struct net_device *in, const struct net_device *out,
299 struct ebt_table *table); 299 struct ebt_table *table);
300 300
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index ceae87a4c891..1a63adf5c4c1 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -75,8 +75,8 @@ enum nf_ip_hook_priorities {
75#define SO_ORIGINAL_DST 80 75#define SO_ORIGINAL_DST 80
76 76
77#ifdef __KERNEL__ 77#ifdef __KERNEL__
78extern int ip_route_me_harder(struct sk_buff **pskb, unsigned addr_type); 78extern int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type);
79extern int ip_xfrm_me_harder(struct sk_buff **pskb); 79extern int ip_xfrm_me_harder(struct sk_buff *skb);
80extern __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook, 80extern __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
81 unsigned int dataoff, u_int8_t protocol); 81 unsigned int dataoff, u_int8_t protocol);
82#endif /*__KERNEL__*/ 82#endif /*__KERNEL__*/
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h
index e992cd6b28f5..d79ed69cbc1f 100644
--- a/include/linux/netfilter_ipv4/ip_tables.h
+++ b/include/linux/netfilter_ipv4/ip_tables.h
@@ -337,7 +337,7 @@ struct ipt_error
337 .target.errorname = "ERROR", \ 337 .target.errorname = "ERROR", \
338} 338}
339 339
340extern unsigned int ipt_do_table(struct sk_buff **pskb, 340extern unsigned int ipt_do_table(struct sk_buff *skb,
341 unsigned int hook, 341 unsigned int hook,
342 const struct net_device *in, 342 const struct net_device *in,
343 const struct net_device *out, 343 const struct net_device *out,
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h
index 9a720f05888f..7dc481ce7cba 100644
--- a/include/linux/netfilter_ipv6/ip6_tables.h
+++ b/include/linux/netfilter_ipv6/ip6_tables.h
@@ -336,7 +336,7 @@ extern void ip6t_init(void) __init;
336extern int ip6t_register_table(struct xt_table *table, 336extern int ip6t_register_table(struct xt_table *table,
337 const struct ip6t_replace *repl); 337 const struct ip6t_replace *repl);
338extern void ip6t_unregister_table(struct xt_table *table); 338extern void ip6t_unregister_table(struct xt_table *table);
339extern unsigned int ip6t_do_table(struct sk_buff **pskb, 339extern unsigned int ip6t_do_table(struct sk_buff *skb,
340 unsigned int hook, 340 unsigned int hook,
341 const struct net_device *in, 341 const struct net_device *in,
342 const struct net_device *out, 342 const struct net_device *out,
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 7250eeadd7b5..c5164c257f71 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -47,10 +47,8 @@
47#include <linux/nfs3.h> 47#include <linux/nfs3.h>
48#include <linux/nfs4.h> 48#include <linux/nfs4.h>
49#include <linux/nfs_xdr.h> 49#include <linux/nfs_xdr.h>
50
51#include <linux/nfs_fs_sb.h> 50#include <linux/nfs_fs_sb.h>
52 51
53#include <linux/rwsem.h>
54#include <linux/mempool.h> 52#include <linux/mempool.h>
55 53
56/* 54/*
@@ -77,6 +75,9 @@ struct nfs_open_context {
77 struct nfs4_state *state; 75 struct nfs4_state *state;
78 fl_owner_t lockowner; 76 fl_owner_t lockowner;
79 int mode; 77 int mode;
78
79 unsigned long flags;
80#define NFS_CONTEXT_ERROR_WRITE (0)
80 int error; 81 int error;
81 82
82 struct list_head list; 83 struct list_head list;
@@ -133,11 +134,6 @@ struct nfs_inode {
133 * server. 134 * server.
134 */ 135 */
135 unsigned long cache_change_attribute; 136 unsigned long cache_change_attribute;
136 /*
137 * Counter indicating the number of outstanding requests that
138 * will cause a file data update.
139 */
140 atomic_t data_updates;
141 137
142 struct rb_root access_cache; 138 struct rb_root access_cache;
143 struct list_head access_cache_entry_lru; 139 struct list_head access_cache_entry_lru;
@@ -205,27 +201,18 @@ static inline struct nfs_inode *NFS_I(struct inode *inode)
205#define NFS_CLIENT(inode) (NFS_SERVER(inode)->client) 201#define NFS_CLIENT(inode) (NFS_SERVER(inode)->client)
206#define NFS_PROTO(inode) (NFS_SERVER(inode)->nfs_client->rpc_ops) 202#define NFS_PROTO(inode) (NFS_SERVER(inode)->nfs_client->rpc_ops)
207#define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf) 203#define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf)
208#define NFS_READTIME(inode) (NFS_I(inode)->read_cache_jiffies)
209#define NFS_CHANGE_ATTR(inode) (NFS_I(inode)->change_attr)
210#define NFS_ATTRTIMEO(inode) (NFS_I(inode)->attrtimeo)
211#define NFS_MINATTRTIMEO(inode) \ 204#define NFS_MINATTRTIMEO(inode) \
212 (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmin \ 205 (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmin \
213 : NFS_SERVER(inode)->acregmin) 206 : NFS_SERVER(inode)->acregmin)
214#define NFS_MAXATTRTIMEO(inode) \ 207#define NFS_MAXATTRTIMEO(inode) \
215 (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmax \ 208 (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmax \
216 : NFS_SERVER(inode)->acregmax) 209 : NFS_SERVER(inode)->acregmax)
217#define NFS_ATTRTIMEO_UPDATE(inode) (NFS_I(inode)->attrtimeo_timestamp)
218 210
219#define NFS_FLAGS(inode) (NFS_I(inode)->flags) 211#define NFS_FLAGS(inode) (NFS_I(inode)->flags)
220#define NFS_STALE(inode) (test_bit(NFS_INO_STALE, &NFS_FLAGS(inode))) 212#define NFS_STALE(inode) (test_bit(NFS_INO_STALE, &NFS_FLAGS(inode)))
221 213
222#define NFS_FILEID(inode) (NFS_I(inode)->fileid) 214#define NFS_FILEID(inode) (NFS_I(inode)->fileid)
223 215
224static inline int nfs_caches_unstable(struct inode *inode)
225{
226 return atomic_read(&NFS_I(inode)->data_updates) != 0;
227}
228
229static inline void nfs_mark_for_revalidate(struct inode *inode) 216static inline void nfs_mark_for_revalidate(struct inode *inode)
230{ 217{
231 struct nfs_inode *nfsi = NFS_I(inode); 218 struct nfs_inode *nfsi = NFS_I(inode);
@@ -237,12 +224,6 @@ static inline void nfs_mark_for_revalidate(struct inode *inode)
237 spin_unlock(&inode->i_lock); 224 spin_unlock(&inode->i_lock);
238} 225}
239 226
240static inline void NFS_CACHEINV(struct inode *inode)
241{
242 if (!nfs_caches_unstable(inode))
243 nfs_mark_for_revalidate(inode);
244}
245
246static inline int nfs_server_capable(struct inode *inode, int cap) 227static inline int nfs_server_capable(struct inode *inode, int cap)
247{ 228{
248 return NFS_SERVER(inode)->caps & cap; 229 return NFS_SERVER(inode)->caps & cap;
@@ -253,28 +234,33 @@ static inline int NFS_USE_READDIRPLUS(struct inode *inode)
253 return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_FLAGS(inode)); 234 return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_FLAGS(inode));
254} 235}
255 236
237static inline void nfs_set_verifier(struct dentry * dentry, unsigned long verf)
238{
239 dentry->d_time = verf;
240}
241
256/** 242/**
257 * nfs_save_change_attribute - Returns the inode attribute change cookie 243 * nfs_save_change_attribute - Returns the inode attribute change cookie
258 * @inode - pointer to inode 244 * @dir - pointer to parent directory inode
259 * The "change attribute" is updated every time we finish an operation 245 * The "change attribute" is updated every time we finish an operation
260 * that will result in a metadata change on the server. 246 * that will result in a metadata change on the server.
261 */ 247 */
262static inline long nfs_save_change_attribute(struct inode *inode) 248static inline unsigned long nfs_save_change_attribute(struct inode *dir)
263{ 249{
264 return NFS_I(inode)->cache_change_attribute; 250 return NFS_I(dir)->cache_change_attribute;
265} 251}
266 252
267/** 253/**
268 * nfs_verify_change_attribute - Detects NFS inode cache updates 254 * nfs_verify_change_attribute - Detects NFS remote directory changes
269 * @inode - pointer to inode 255 * @dir - pointer to parent directory inode
270 * @chattr - previously saved change attribute 256 * @chattr - previously saved change attribute
271 * Return "false" if metadata has been updated (or is in the process of 257 * Return "false" if the verifiers doesn't match the change attribute.
272 * being updated) since the change attribute was saved. 258 * This would usually indicate that the directory contents have changed on
259 * the server, and that any dentries need revalidating.
273 */ 260 */
274static inline int nfs_verify_change_attribute(struct inode *inode, unsigned long chattr) 261static inline int nfs_verify_change_attribute(struct inode *dir, unsigned long chattr)
275{ 262{
276 return !nfs_caches_unstable(inode) 263 return chattr == NFS_I(dir)->cache_change_attribute;
277 && time_after_eq(chattr, NFS_I(inode)->cache_change_attribute);
278} 264}
279 265
280/* 266/*
@@ -283,15 +269,14 @@ static inline int nfs_verify_change_attribute(struct inode *inode, unsigned long
283extern int nfs_sync_mapping(struct address_space *mapping); 269extern int nfs_sync_mapping(struct address_space *mapping);
284extern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping); 270extern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping);
285extern void nfs_zap_caches(struct inode *); 271extern void nfs_zap_caches(struct inode *);
272extern void nfs_invalidate_atime(struct inode *);
286extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, 273extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *,
287 struct nfs_fattr *); 274 struct nfs_fattr *);
288extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); 275extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *);
289extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); 276extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr);
277extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr);
290extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); 278extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
291extern int nfs_permission(struct inode *, int, struct nameidata *); 279extern int nfs_permission(struct inode *, int, struct nameidata *);
292extern int nfs_access_get_cached(struct inode *, struct rpc_cred *, struct nfs_access_entry *);
293extern void nfs_access_add_cache(struct inode *, struct nfs_access_entry *);
294extern void nfs_access_zap_cache(struct inode *inode);
295extern int nfs_open(struct inode *, struct file *); 280extern int nfs_open(struct inode *, struct file *);
296extern int nfs_release(struct inode *, struct file *); 281extern int nfs_release(struct inode *, struct file *);
297extern int nfs_attribute_timeout(struct inode *inode); 282extern int nfs_attribute_timeout(struct inode *inode);
@@ -301,13 +286,10 @@ extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *map
301extern int nfs_revalidate_mapping_nolock(struct inode *inode, struct address_space *mapping); 286extern int nfs_revalidate_mapping_nolock(struct inode *inode, struct address_space *mapping);
302extern int nfs_setattr(struct dentry *, struct iattr *); 287extern int nfs_setattr(struct dentry *, struct iattr *);
303extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); 288extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
304extern void nfs_begin_attr_update(struct inode *);
305extern void nfs_end_attr_update(struct inode *);
306extern void nfs_begin_data_update(struct inode *);
307extern void nfs_end_data_update(struct inode *);
308extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 289extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
309extern void put_nfs_open_context(struct nfs_open_context *ctx); 290extern void put_nfs_open_context(struct nfs_open_context *ctx);
310extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); 291extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode);
292extern u64 nfs_compat_user_ino64(u64 fileid);
311 293
312/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ 294/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */
313extern __be32 root_nfs_parse_addr(char *name); /*__init*/ 295extern __be32 root_nfs_parse_addr(char *name); /*__init*/
@@ -328,14 +310,15 @@ extern const struct inode_operations nfs3_file_inode_operations;
328extern const struct file_operations nfs_file_operations; 310extern const struct file_operations nfs_file_operations;
329extern const struct address_space_operations nfs_file_aops; 311extern const struct address_space_operations nfs_file_aops;
330 312
331static inline struct rpc_cred *nfs_file_cred(struct file *file) 313static inline struct nfs_open_context *nfs_file_open_context(struct file *filp)
332{ 314{
333 if (file != NULL) { 315 return filp->private_data;
334 struct nfs_open_context *ctx; 316}
335 317
336 ctx = (struct nfs_open_context*)file->private_data; 318static inline struct rpc_cred *nfs_file_cred(struct file *file)
337 return ctx->cred; 319{
338 } 320 if (file != NULL)
321 return nfs_file_open_context(file)->cred;
339 return NULL; 322 return NULL;
340} 323}
341 324
@@ -378,6 +361,8 @@ extern const struct file_operations nfs_dir_operations;
378extern struct dentry_operations nfs_dentry_operations; 361extern struct dentry_operations nfs_dentry_operations;
379 362
380extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); 363extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr);
364extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags);
365extern void nfs_access_zap_cache(struct inode *inode);
381 366
382/* 367/*
383 * linux/fs/nfs/symlink.c 368 * linux/fs/nfs/symlink.c
@@ -420,15 +405,14 @@ extern int nfs_flush_incompatible(struct file *file, struct page *page);
420extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); 405extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int);
421extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *); 406extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *);
422extern void nfs_writedata_release(void *); 407extern void nfs_writedata_release(void *);
423extern int nfs_set_page_dirty(struct page *);
424 408
425/* 409/*
426 * Try to write back everything synchronously (but check the 410 * Try to write back everything synchronously (but check the
427 * return value!) 411 * return value!)
428 */ 412 */
429extern long nfs_sync_mapping_wait(struct address_space *, struct writeback_control *, int); 413extern long nfs_sync_mapping_wait(struct address_space *, struct writeback_control *, int);
430extern int nfs_sync_mapping_range(struct address_space *, loff_t, loff_t, int);
431extern int nfs_wb_all(struct inode *inode); 414extern int nfs_wb_all(struct inode *inode);
415extern int nfs_wb_nocommit(struct inode *inode);
432extern int nfs_wb_page(struct inode *inode, struct page* page); 416extern int nfs_wb_page(struct inode *inode, struct page* page);
433extern int nfs_wb_page_priority(struct inode *inode, struct page* page, int how); 417extern int nfs_wb_page_priority(struct inode *inode, struct page* page, int how);
434extern int nfs_wb_page_cancel(struct inode *inode, struct page* page); 418extern int nfs_wb_page_cancel(struct inode *inode, struct page* page);
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 78e60798d10e..30dbcc185e69 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -30,7 +30,6 @@
30#define PG_BUSY 0 30#define PG_BUSY 0
31#define PG_NEED_COMMIT 1 31#define PG_NEED_COMMIT 1
32#define PG_NEED_RESCHED 2 32#define PG_NEED_RESCHED 2
33#define PG_NEED_FLUSH 3
34 33
35struct nfs_inode; 34struct nfs_inode;
36struct nfs_page { 35struct nfs_page {
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index cf74a4db84a5..daab252f2e5c 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -62,7 +62,8 @@ struct nfs_fattr {
62#define NFS_ATTR_FATTR 0x0002 /* post-op attributes */ 62#define NFS_ATTR_FATTR 0x0002 /* post-op attributes */
63#define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */ 63#define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */
64#define NFS_ATTR_FATTR_V4 0x0008 /* NFSv4 change attribute */ 64#define NFS_ATTR_FATTR_V4 0x0008 /* NFSv4 change attribute */
65#define NFS_ATTR_FATTR_V4_REFERRAL 0x0010 /* NFSv4 referral */ 65#define NFS_ATTR_WCC_V4 0x0010 /* pre-op change attribute */
66#define NFS_ATTR_FATTR_V4_REFERRAL 0x0020 /* NFSv4 referral */
66 67
67/* 68/*
68 * Info on the file system 69 * Info on the file system
@@ -538,10 +539,13 @@ typedef u64 clientid4;
538 539
539struct nfs4_accessargs { 540struct nfs4_accessargs {
540 const struct nfs_fh * fh; 541 const struct nfs_fh * fh;
542 const u32 * bitmask;
541 u32 access; 543 u32 access;
542}; 544};
543 545
544struct nfs4_accessres { 546struct nfs4_accessres {
547 const struct nfs_server * server;
548 struct nfs_fattr * fattr;
545 u32 supported; 549 u32 supported;
546 u32 access; 550 u32 access;
547}; 551};
diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
index e452256d3f72..604a0d786bc6 100644
--- a/include/linux/nfsd/nfsd.h
+++ b/include/linux/nfsd/nfsd.h
@@ -153,19 +153,21 @@ extern int nfsd_max_blksize;
153 */ 153 */
154#ifdef CONFIG_NFSD_V4 154#ifdef CONFIG_NFSD_V4
155extern unsigned int max_delegations; 155extern unsigned int max_delegations;
156void nfs4_state_init(void); 156int nfs4_state_init(void);
157int nfs4_state_start(void); 157void nfsd4_free_slabs(void);
158void nfs4_state_start(void);
158void nfs4_state_shutdown(void); 159void nfs4_state_shutdown(void);
159time_t nfs4_lease_time(void); 160time_t nfs4_lease_time(void);
160void nfs4_reset_lease(time_t leasetime); 161void nfs4_reset_lease(time_t leasetime);
161int nfs4_reset_recoverydir(char *recdir); 162int nfs4_reset_recoverydir(char *recdir);
162#else 163#else
163static inline void nfs4_state_init(void){}; 164static inline int nfs4_state_init(void) { return 0; }
164static inline int nfs4_state_start(void){return 0;} 165static inline void nfsd4_free_slabs(void) { }
165static inline void nfs4_state_shutdown(void){} 166static inline void nfs4_state_start(void) { }
166static inline time_t nfs4_lease_time(void){return 0;} 167static inline void nfs4_state_shutdown(void) { }
167static inline void nfs4_reset_lease(time_t leasetime){} 168static inline time_t nfs4_lease_time(void) { return 0; }
168static inline int nfs4_reset_recoverydir(char *recdir) {return 0;} 169static inline void nfs4_reset_lease(time_t leasetime) { }
170static inline int nfs4_reset_recoverydir(char *recdir) { return 0; }
169#endif 171#endif
170 172
171/* 173/*
diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h
index 11e568ee0eeb..d1941cb965e9 100644
--- a/include/linux/nfsd/nfsfh.h
+++ b/include/linux/nfsd/nfsfh.h
@@ -150,17 +150,7 @@ typedef struct svc_fh {
150 struct timespec fh_pre_ctime; /* ctime before oper */ 150 struct timespec fh_pre_ctime; /* ctime before oper */
151 151
152 /* Post-op attributes saved in fh_unlock */ 152 /* Post-op attributes saved in fh_unlock */
153 umode_t fh_post_mode; /* i_mode */ 153 struct kstat fh_post_attr; /* full attrs after operation */
154 nlink_t fh_post_nlink; /* i_nlink */
155 uid_t fh_post_uid; /* i_uid */
156 gid_t fh_post_gid; /* i_gid */
157 __u64 fh_post_size; /* i_size */
158 unsigned long fh_post_blocks; /* i_blocks */
159 unsigned long fh_post_blksize;/* i_blksize */
160 __be32 fh_post_rdev[2];/* i_rdev */
161 struct timespec fh_post_atime; /* i_atime */
162 struct timespec fh_post_mtime; /* i_mtime */
163 struct timespec fh_post_ctime; /* i_ctime */
164#endif /* CONFIG_NFSD_V3 */ 154#endif /* CONFIG_NFSD_V3 */
165 155
166} svc_fh; 156} svc_fh;
@@ -297,36 +287,12 @@ fill_pre_wcc(struct svc_fh *fhp)
297 if (!fhp->fh_pre_saved) { 287 if (!fhp->fh_pre_saved) {
298 fhp->fh_pre_mtime = inode->i_mtime; 288 fhp->fh_pre_mtime = inode->i_mtime;
299 fhp->fh_pre_ctime = inode->i_ctime; 289 fhp->fh_pre_ctime = inode->i_ctime;
300 fhp->fh_pre_size = inode->i_size; 290 fhp->fh_pre_size = inode->i_size;
301 fhp->fh_pre_saved = 1; 291 fhp->fh_pre_saved = 1;
302 } 292 }
303} 293}
304 294
305/* 295extern void fill_post_wcc(struct svc_fh *);
306 * Fill in the post_op attr for the wcc data
307 */
308static inline void
309fill_post_wcc(struct svc_fh *fhp)
310{
311 struct inode *inode = fhp->fh_dentry->d_inode;
312
313 if (fhp->fh_post_saved)
314 printk("nfsd: inode locked twice during operation.\n");
315
316 fhp->fh_post_mode = inode->i_mode;
317 fhp->fh_post_nlink = inode->i_nlink;
318 fhp->fh_post_uid = inode->i_uid;
319 fhp->fh_post_gid = inode->i_gid;
320 fhp->fh_post_size = inode->i_size;
321 fhp->fh_post_blksize = BLOCK_SIZE;
322 fhp->fh_post_blocks = inode->i_blocks;
323 fhp->fh_post_rdev[0] = htonl((u32)imajor(inode));
324 fhp->fh_post_rdev[1] = htonl((u32)iminor(inode));
325 fhp->fh_post_atime = inode->i_atime;
326 fhp->fh_post_mtime = inode->i_mtime;
327 fhp->fh_post_ctime = inode->i_ctime;
328 fhp->fh_post_saved = 1;
329}
330#else 296#else
331#define fill_pre_wcc(ignored) 297#define fill_pre_wcc(ignored)
332#define fill_post_wcc(notused) 298#define fill_post_wcc(notused)
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
index 1b653267133a..b0ddfb41c790 100644
--- a/include/linux/nfsd/xdr4.h
+++ b/include/linux/nfsd/xdr4.h
@@ -428,8 +428,8 @@ set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
428 cinfo->atomic = 1; 428 cinfo->atomic = 1;
429 cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec; 429 cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec;
430 cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec; 430 cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec;
431 cinfo->after_ctime_sec = fhp->fh_post_ctime.tv_sec; 431 cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec;
432 cinfo->after_ctime_nsec = fhp->fh_post_ctime.tv_nsec; 432 cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec;
433} 433}
434 434
435int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *); 435int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 038a0dc7273a..768b93359f90 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -685,13 +685,16 @@ extern void pci_unblock_user_cfg_access(struct pci_dev *dev);
685 * a PCI domain is defined to be a set of PCI busses which share 685 * a PCI domain is defined to be a set of PCI busses which share
686 * configuration space. 686 * configuration space.
687 */ 687 */
688#ifndef CONFIG_PCI_DOMAINS 688#ifdef CONFIG_PCI_DOMAINS
689extern int pci_domains_supported;
690#else
691enum { pci_domains_supported = 0 };
689static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } 692static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
690static inline int pci_proc_domain(struct pci_bus *bus) 693static inline int pci_proc_domain(struct pci_bus *bus)
691{ 694{
692 return 0; 695 return 0;
693} 696}
694#endif 697#endif /* CONFIG_PCI_DOMAINS */
695 698
696#else /* CONFIG_PCI is not enabled */ 699#else /* CONFIG_PCI is not enabled */
697 700
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 2bcb02d555e8..2c49561f9b45 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -829,6 +829,9 @@
829#define PCI_DEVICE_ID_UMC_UM8886BF 0x673a 829#define PCI_DEVICE_ID_UMC_UM8886BF 0x673a
830#define PCI_DEVICE_ID_UMC_UM8886A 0x886a 830#define PCI_DEVICE_ID_UMC_UM8886A 0x886a
831 831
832#define PCI_VENDOR_ID_PICOPOWER 0x1066
833#define PCI_DEVICE_ID_PICOPOWER_PT86C523 0x0002
834#define PCI_DEVICE_ID_PICOPOWER_PT86C523BBP 0x8002
832 835
833#define PCI_VENDOR_ID_MYLEX 0x1069 836#define PCI_VENDOR_ID_MYLEX 0x1069
834#define PCI_DEVICE_ID_MYLEX_DAC960_P 0x0001 837#define PCI_DEVICE_ID_MYLEX_DAC960_P 0x0001
@@ -1464,6 +1467,8 @@
1464#define PCI_DEVICE_ID_TOSHIBA_TC86C001_MISC 0x0108 1467#define PCI_DEVICE_ID_TOSHIBA_TC86C001_MISC 0x0108
1465#define PCI_DEVICE_ID_TOSHIBA_SPIDER_NET 0x01b3 1468#define PCI_DEVICE_ID_TOSHIBA_SPIDER_NET 0x01b3
1466 1469
1470#define PCI_VENDOR_ID_ATTO 0x117c
1471
1467#define PCI_VENDOR_ID_RICOH 0x1180 1472#define PCI_VENDOR_ID_RICOH 0x1180
1468#define PCI_DEVICE_ID_RICOH_RL5C465 0x0465 1473#define PCI_DEVICE_ID_RICOH_RL5C465 0x0465
1469#define PCI_DEVICE_ID_RICOH_RL5C466 0x0466 1474#define PCI_DEVICE_ID_RICOH_RL5C466 0x0466
@@ -2073,6 +2078,9 @@
2073#define PCI_DEVICE_ID_ARECA_1130 0x1130 2078#define PCI_DEVICE_ID_ARECA_1130 0x1130
2074#define PCI_DEVICE_ID_ARECA_1160 0x1160 2079#define PCI_DEVICE_ID_ARECA_1160 0x1160
2075#define PCI_DEVICE_ID_ARECA_1170 0x1170 2080#define PCI_DEVICE_ID_ARECA_1170 0x1170
2081#define PCI_DEVICE_ID_ARECA_1200 0x1200
2082#define PCI_DEVICE_ID_ARECA_1201 0x1201
2083#define PCI_DEVICE_ID_ARECA_1202 0x1202
2076#define PCI_DEVICE_ID_ARECA_1210 0x1210 2084#define PCI_DEVICE_ID_ARECA_1210 0x1210
2077#define PCI_DEVICE_ID_ARECA_1220 0x1220 2085#define PCI_DEVICE_ID_ARECA_1220 0x1220
2078#define PCI_DEVICE_ID_ARECA_1230 0x1230 2086#define PCI_DEVICE_ID_ARECA_1230 0x1230
@@ -2243,6 +2251,7 @@
2243#define PCI_DEVICE_ID_INTEL_82801EB_5 0x24d5 2251#define PCI_DEVICE_ID_INTEL_82801EB_5 0x24d5
2244#define PCI_DEVICE_ID_INTEL_82801EB_6 0x24d6 2252#define PCI_DEVICE_ID_INTEL_82801EB_6 0x24d6
2245#define PCI_DEVICE_ID_INTEL_82801EB_11 0x24db 2253#define PCI_DEVICE_ID_INTEL_82801EB_11 0x24db
2254#define PCI_DEVICE_ID_INTEL_82801EB_12 0x24dc
2246#define PCI_DEVICE_ID_INTEL_82801EB_13 0x24dd 2255#define PCI_DEVICE_ID_INTEL_82801EB_13 0x24dd
2247#define PCI_DEVICE_ID_INTEL_ESB_1 0x25a1 2256#define PCI_DEVICE_ID_INTEL_ESB_1 0x25a1
2248#define PCI_DEVICE_ID_INTEL_ESB_2 0x25a2 2257#define PCI_DEVICE_ID_INTEL_ESB_2 0x25a2
diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
index 423d592c55d5..c1914a8b94a9 100644
--- a/include/linux/pci_regs.h
+++ b/include/linux/pci_regs.h
@@ -147,7 +147,7 @@
147#define PCI_BRIDGE_CONTROL 0x3e 147#define PCI_BRIDGE_CONTROL 0x3e
148#define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */ 148#define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */
149#define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */ 149#define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */
150#define PCI_BRIDGE_CTL_NO_ISA 0x04 /* Disable bridging of ISA ports */ 150#define PCI_BRIDGE_CTL_ISA 0x04 /* Enable ISA mode */
151#define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */ 151#define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */
152#define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */ 152#define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */
153#define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */ 153#define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */
@@ -202,8 +202,12 @@
202#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */ 202#define PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */
203#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */ 203#define PCI_CAP_ID_PCIX 0x07 /* PCI-X */
204#define PCI_CAP_ID_HT 0x08 /* HyperTransport */ 204#define PCI_CAP_ID_HT 0x08 /* HyperTransport */
205#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific capability */ 205#define PCI_CAP_ID_VNDR 0x09 /* Vendor specific */
206#define PCI_CAP_ID_DBG 0x0A /* Debug port */
207#define PCI_CAP_ID_CCRC 0x0B /* CompactPCI Central Resource Control */
206#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */ 208#define PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */
209#define PCI_CAP_ID_SSVID 0x0D /* Bridge subsystem vendor/device ID */
210#define PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */
207#define PCI_CAP_ID_EXP 0x10 /* PCI Express */ 211#define PCI_CAP_ID_EXP 0x10 /* PCI Express */
208#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ 212#define PCI_CAP_ID_MSIX 0x11 /* MSI-X */
209#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */ 213#define PCI_CAP_LIST_NEXT 1 /* Next capability in the list */
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 8bbd459eafdc..e80804316cdb 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -15,7 +15,7 @@
15 15
16struct platform_device { 16struct platform_device {
17 const char * name; 17 const char * name;
18 u32 id; 18 int id;
19 struct device dev; 19 struct device dev;
20 u32 num_resources; 20 u32 num_resources;
21 struct resource * resource; 21 struct resource * resource;
@@ -35,9 +35,10 @@ extern struct resource *platform_get_resource_byname(struct platform_device *, u
35extern int platform_get_irq_byname(struct platform_device *, char *); 35extern int platform_get_irq_byname(struct platform_device *, char *);
36extern int platform_add_devices(struct platform_device **, int); 36extern int platform_add_devices(struct platform_device **, int);
37 37
38extern struct platform_device *platform_device_register_simple(char *, unsigned int, struct resource *, unsigned int); 38extern struct platform_device *platform_device_register_simple(char *, int id,
39 struct resource *, unsigned int);
39 40
40extern struct platform_device *platform_device_alloc(const char *name, unsigned int id); 41extern struct platform_device *platform_device_alloc(const char *name, int id);
41extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num); 42extern int platform_device_add_resources(struct platform_device *pdev, struct resource *res, unsigned int num);
42extern int platform_device_add_data(struct platform_device *pdev, const void *data, size_t size); 43extern int platform_device_add_data(struct platform_device *pdev, const void *data, size_t size);
43extern int platform_device_add(struct platform_device *pdev); 44extern int platform_device_add(struct platform_device *pdev);
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index fe17d7d750c2..76c1a530edc5 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -41,6 +41,7 @@
41#include <linux/percpu.h> 41#include <linux/percpu.h>
42#include <linux/cpumask.h> 42#include <linux/cpumask.h>
43#include <linux/seqlock.h> 43#include <linux/seqlock.h>
44#include <linux/lockdep.h>
44 45
45/** 46/**
46 * struct rcu_head - callback structure for use with RCU 47 * struct rcu_head - callback structure for use with RCU
@@ -133,6 +134,15 @@ static inline void rcu_bh_qsctr_inc(int cpu)
133extern int rcu_pending(int cpu); 134extern int rcu_pending(int cpu);
134extern int rcu_needs_cpu(int cpu); 135extern int rcu_needs_cpu(int cpu);
135 136
137#ifdef CONFIG_DEBUG_LOCK_ALLOC
138extern struct lockdep_map rcu_lock_map;
139# define rcu_read_acquire() lock_acquire(&rcu_lock_map, 0, 0, 2, 1, _THIS_IP_)
140# define rcu_read_release() lock_release(&rcu_lock_map, 1, _THIS_IP_)
141#else
142# define rcu_read_acquire() do { } while (0)
143# define rcu_read_release() do { } while (0)
144#endif
145
136/** 146/**
137 * rcu_read_lock - mark the beginning of an RCU read-side critical section. 147 * rcu_read_lock - mark the beginning of an RCU read-side critical section.
138 * 148 *
@@ -166,6 +176,7 @@ extern int rcu_needs_cpu(int cpu);
166 do { \ 176 do { \
167 preempt_disable(); \ 177 preempt_disable(); \
168 __acquire(RCU); \ 178 __acquire(RCU); \
179 rcu_read_acquire(); \
169 } while(0) 180 } while(0)
170 181
171/** 182/**
@@ -175,6 +186,7 @@ extern int rcu_needs_cpu(int cpu);
175 */ 186 */
176#define rcu_read_unlock() \ 187#define rcu_read_unlock() \
177 do { \ 188 do { \
189 rcu_read_release(); \
178 __release(RCU); \ 190 __release(RCU); \
179 preempt_enable(); \ 191 preempt_enable(); \
180 } while(0) 192 } while(0)
@@ -204,6 +216,7 @@ extern int rcu_needs_cpu(int cpu);
204 do { \ 216 do { \
205 local_bh_disable(); \ 217 local_bh_disable(); \
206 __acquire(RCU_BH); \ 218 __acquire(RCU_BH); \
219 rcu_read_acquire(); \
207 } while(0) 220 } while(0)
208 221
209/* 222/*
@@ -213,6 +226,7 @@ extern int rcu_needs_cpu(int cpu);
213 */ 226 */
214#define rcu_read_unlock_bh() \ 227#define rcu_read_unlock_bh() \
215 do { \ 228 do { \
229 rcu_read_release(); \
216 __release(RCU_BH); \ 230 __release(RCU_BH); \
217 local_bh_enable(); \ 231 local_bh_enable(); \
218 } while(0) 232 } while(0)
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h
index 1e5488ede037..ff9e9234f8ba 100644
--- a/include/linux/reiserfs_fs_sb.h
+++ b/include/linux/reiserfs_fs_sb.h
@@ -120,7 +120,7 @@ struct reiserfs_journal_cnode {
120 struct buffer_head *bh; /* real buffer head */ 120 struct buffer_head *bh; /* real buffer head */
121 struct super_block *sb; /* dev of real buffer head */ 121 struct super_block *sb; /* dev of real buffer head */
122 __u32 blocknr; /* block number of real buffer head, == 0 when buffer on disk */ 122 __u32 blocknr; /* block number of real buffer head, == 0 when buffer on disk */
123 long state; 123 unsigned long state;
124 struct reiserfs_journal_list *jlist; /* journal list this cnode lives in */ 124 struct reiserfs_journal_list *jlist; /* journal list this cnode lives in */
125 struct reiserfs_journal_cnode *next; /* next in transaction list */ 125 struct reiserfs_journal_cnode *next; /* next in transaction list */
126 struct reiserfs_journal_cnode *prev; /* prev in transaction list */ 126 struct reiserfs_journal_cnode *prev; /* prev in transaction list */
@@ -181,7 +181,7 @@ struct reiserfs_journal {
181 struct block_device *j_dev_bd; 181 struct block_device *j_dev_bd;
182 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */ 182 int j_1st_reserved_block; /* first block on s_dev of reserved area journal */
183 183
184 long j_state; 184 unsigned long j_state;
185 unsigned long j_trans_id; 185 unsigned long j_trans_id;
186 unsigned long j_mount_id; 186 unsigned long j_mount_id;
187 unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */ 187 unsigned long j_start; /* start of current waiting commit (index into j_ap_blocks) */
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 833f7dc2b8de..228e0a8ce248 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -87,6 +87,7 @@ struct sched_param {
87#include <linux/timer.h> 87#include <linux/timer.h>
88#include <linux/hrtimer.h> 88#include <linux/hrtimer.h>
89#include <linux/task_io_accounting.h> 89#include <linux/task_io_accounting.h>
90#include <linux/kobject.h>
90 91
91#include <asm/processor.h> 92#include <asm/processor.h>
92 93
@@ -136,6 +137,7 @@ extern unsigned long weighted_cpuload(const int cpu);
136 137
137struct seq_file; 138struct seq_file;
138struct cfs_rq; 139struct cfs_rq;
140struct task_group;
139#ifdef CONFIG_SCHED_DEBUG 141#ifdef CONFIG_SCHED_DEBUG
140extern void proc_sched_show_task(struct task_struct *p, struct seq_file *m); 142extern void proc_sched_show_task(struct task_struct *p, struct seq_file *m);
141extern void proc_sched_set_task(struct task_struct *p); 143extern void proc_sched_set_task(struct task_struct *p);
@@ -174,8 +176,7 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
174#define EXIT_ZOMBIE 16 176#define EXIT_ZOMBIE 16
175#define EXIT_DEAD 32 177#define EXIT_DEAD 32
176/* in tsk->state again */ 178/* in tsk->state again */
177#define TASK_NONINTERACTIVE 64 179#define TASK_DEAD 64
178#define TASK_DEAD 128
179 180
180#define __set_task_state(tsk, state_value) \ 181#define __set_task_state(tsk, state_value) \
181 do { (tsk)->state = (state_value); } while (0) 182 do { (tsk)->state = (state_value); } while (0)
@@ -516,6 +517,8 @@ struct signal_struct {
516 * in __exit_signal, except for the group leader. 517 * in __exit_signal, except for the group leader.
517 */ 518 */
518 cputime_t utime, stime, cutime, cstime; 519 cputime_t utime, stime, cutime, cstime;
520 cputime_t gtime;
521 cputime_t cgtime;
519 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw; 522 unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw;
520 unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt; 523 unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt;
521 unsigned long inblock, oublock, cinblock, coublock; 524 unsigned long inblock, oublock, cinblock, coublock;
@@ -596,8 +599,21 @@ struct user_struct {
596 /* Hash table maintenance information */ 599 /* Hash table maintenance information */
597 struct hlist_node uidhash_node; 600 struct hlist_node uidhash_node;
598 uid_t uid; 601 uid_t uid;
602
603#ifdef CONFIG_FAIR_USER_SCHED
604 struct task_group *tg;
605 struct kset kset;
606 struct subsys_attribute user_attr;
607 struct work_struct work;
608#endif
599}; 609};
600 610
611#ifdef CONFIG_FAIR_USER_SCHED
612extern int uids_kobject_init(void);
613#else
614static inline int uids_kobject_init(void) { return 0; }
615#endif
616
601extern struct user_struct *find_user(uid_t); 617extern struct user_struct *find_user(uid_t);
602 618
603extern struct user_struct root_user; 619extern struct user_struct root_user;
@@ -609,13 +625,17 @@ struct reclaim_state;
609#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) 625#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
610struct sched_info { 626struct sched_info {
611 /* cumulative counters */ 627 /* cumulative counters */
612 unsigned long pcnt; /* # of times run on this cpu */ 628 unsigned long pcount; /* # of times run on this cpu */
613 unsigned long long cpu_time, /* time spent on the cpu */ 629 unsigned long long cpu_time, /* time spent on the cpu */
614 run_delay; /* time spent waiting on a runqueue */ 630 run_delay; /* time spent waiting on a runqueue */
615 631
616 /* timestamps */ 632 /* timestamps */
617 unsigned long long last_arrival,/* when we last ran on a cpu */ 633 unsigned long long last_arrival,/* when we last ran on a cpu */
618 last_queued; /* when we were last queued to run */ 634 last_queued; /* when we were last queued to run */
635#ifdef CONFIG_SCHEDSTATS
636 /* BKL stats */
637 unsigned long bkl_count;
638#endif
619}; 639};
620#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ 640#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */
621 641
@@ -750,7 +770,7 @@ struct sched_domain {
750 770
751#ifdef CONFIG_SCHEDSTATS 771#ifdef CONFIG_SCHEDSTATS
752 /* load_balance() stats */ 772 /* load_balance() stats */
753 unsigned long lb_cnt[CPU_MAX_IDLE_TYPES]; 773 unsigned long lb_count[CPU_MAX_IDLE_TYPES];
754 unsigned long lb_failed[CPU_MAX_IDLE_TYPES]; 774 unsigned long lb_failed[CPU_MAX_IDLE_TYPES];
755 unsigned long lb_balanced[CPU_MAX_IDLE_TYPES]; 775 unsigned long lb_balanced[CPU_MAX_IDLE_TYPES];
756 unsigned long lb_imbalance[CPU_MAX_IDLE_TYPES]; 776 unsigned long lb_imbalance[CPU_MAX_IDLE_TYPES];
@@ -760,17 +780,17 @@ struct sched_domain {
760 unsigned long lb_nobusyq[CPU_MAX_IDLE_TYPES]; 780 unsigned long lb_nobusyq[CPU_MAX_IDLE_TYPES];
761 781
762 /* Active load balancing */ 782 /* Active load balancing */
763 unsigned long alb_cnt; 783 unsigned long alb_count;
764 unsigned long alb_failed; 784 unsigned long alb_failed;
765 unsigned long alb_pushed; 785 unsigned long alb_pushed;
766 786
767 /* SD_BALANCE_EXEC stats */ 787 /* SD_BALANCE_EXEC stats */
768 unsigned long sbe_cnt; 788 unsigned long sbe_count;
769 unsigned long sbe_balanced; 789 unsigned long sbe_balanced;
770 unsigned long sbe_pushed; 790 unsigned long sbe_pushed;
771 791
772 /* SD_BALANCE_FORK stats */ 792 /* SD_BALANCE_FORK stats */
773 unsigned long sbf_cnt; 793 unsigned long sbf_count;
774 unsigned long sbf_balanced; 794 unsigned long sbf_balanced;
775 unsigned long sbf_pushed; 795 unsigned long sbf_pushed;
776 796
@@ -854,11 +874,11 @@ struct rq;
854struct sched_domain; 874struct sched_domain;
855 875
856struct sched_class { 876struct sched_class {
857 struct sched_class *next; 877 const struct sched_class *next;
858 878
859 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup); 879 void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup);
860 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep); 880 void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep);
861 void (*yield_task) (struct rq *rq, struct task_struct *p); 881 void (*yield_task) (struct rq *rq);
862 882
863 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p); 883 void (*check_preempt_curr) (struct rq *rq, struct task_struct *p);
864 884
@@ -888,31 +908,22 @@ struct load_weight {
888 * 4 se->block_start 908 * 4 se->block_start
889 * 4 se->run_node 909 * 4 se->run_node
890 * 4 se->sleep_start 910 * 4 se->sleep_start
891 * 4 se->sleep_start_fair
892 * 6 se->load.weight 911 * 6 se->load.weight
893 * 7 se->delta_fair
894 * 15 se->wait_runtime
895 */ 912 */
896struct sched_entity { 913struct sched_entity {
897 long wait_runtime;
898 unsigned long delta_fair_run;
899 unsigned long delta_fair_sleep;
900 unsigned long delta_exec;
901 s64 fair_key;
902 struct load_weight load; /* for load-balancing */ 914 struct load_weight load; /* for load-balancing */
903 struct rb_node run_node; 915 struct rb_node run_node;
904 unsigned int on_rq; 916 unsigned int on_rq;
917 int peer_preempt;
905 918
906 u64 exec_start; 919 u64 exec_start;
907 u64 sum_exec_runtime; 920 u64 sum_exec_runtime;
921 u64 vruntime;
908 u64 prev_sum_exec_runtime; 922 u64 prev_sum_exec_runtime;
909 u64 wait_start_fair;
910 u64 sleep_start_fair;
911 923
912#ifdef CONFIG_SCHEDSTATS 924#ifdef CONFIG_SCHEDSTATS
913 u64 wait_start; 925 u64 wait_start;
914 u64 wait_max; 926 u64 wait_max;
915 s64 sum_wait_runtime;
916 927
917 u64 sleep_start; 928 u64 sleep_start;
918 u64 sleep_max; 929 u64 sleep_max;
@@ -921,9 +932,25 @@ struct sched_entity {
921 u64 block_start; 932 u64 block_start;
922 u64 block_max; 933 u64 block_max;
923 u64 exec_max; 934 u64 exec_max;
924 935 u64 slice_max;
925 unsigned long wait_runtime_overruns; 936
926 unsigned long wait_runtime_underruns; 937 u64 nr_migrations;
938 u64 nr_migrations_cold;
939 u64 nr_failed_migrations_affine;
940 u64 nr_failed_migrations_running;
941 u64 nr_failed_migrations_hot;
942 u64 nr_forced_migrations;
943 u64 nr_forced2_migrations;
944
945 u64 nr_wakeups;
946 u64 nr_wakeups_sync;
947 u64 nr_wakeups_migrate;
948 u64 nr_wakeups_local;
949 u64 nr_wakeups_remote;
950 u64 nr_wakeups_affine;
951 u64 nr_wakeups_affine_attempts;
952 u64 nr_wakeups_passive;
953 u64 nr_wakeups_idle;
927#endif 954#endif
928 955
929#ifdef CONFIG_FAIR_GROUP_SCHED 956#ifdef CONFIG_FAIR_GROUP_SCHED
@@ -952,7 +979,7 @@ struct task_struct {
952 979
953 int prio, static_prio, normal_prio; 980 int prio, static_prio, normal_prio;
954 struct list_head run_list; 981 struct list_head run_list;
955 struct sched_class *sched_class; 982 const struct sched_class *sched_class;
956 struct sched_entity se; 983 struct sched_entity se;
957 984
958#ifdef CONFIG_PREEMPT_NOTIFIERS 985#ifdef CONFIG_PREEMPT_NOTIFIERS
@@ -1023,6 +1050,7 @@ struct task_struct {
1023 1050
1024 unsigned int rt_priority; 1051 unsigned int rt_priority;
1025 cputime_t utime, stime; 1052 cputime_t utime, stime;
1053 cputime_t gtime;
1026 unsigned long nvcsw, nivcsw; /* context switch counts */ 1054 unsigned long nvcsw, nivcsw; /* context switch counts */
1027 struct timespec start_time; /* monotonic time */ 1055 struct timespec start_time; /* monotonic time */
1028 struct timespec real_start_time; /* boot based time */ 1056 struct timespec real_start_time; /* boot based time */
@@ -1314,6 +1342,7 @@ static inline void put_task_struct(struct task_struct *t)
1314#define PF_STARTING 0x00000002 /* being created */ 1342#define PF_STARTING 0x00000002 /* being created */
1315#define PF_EXITING 0x00000004 /* getting shut down */ 1343#define PF_EXITING 0x00000004 /* getting shut down */
1316#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */ 1344#define PF_EXITPIDONE 0x00000008 /* pi exit done on shut down */
1345#define PF_VCPU 0x00000010 /* I'm a virtual CPU */
1317#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */ 1346#define PF_FORKNOEXEC 0x00000040 /* forked but didn't exec */
1318#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */ 1347#define PF_SUPERPRIV 0x00000100 /* used super-user privileges */
1319#define PF_DUMPCORE 0x00000200 /* dumped core */ 1348#define PF_DUMPCORE 0x00000200 /* dumped core */
@@ -1401,15 +1430,17 @@ static inline void idle_task_exit(void) {}
1401 1430
1402extern void sched_idle_next(void); 1431extern void sched_idle_next(void);
1403 1432
1433#ifdef CONFIG_SCHED_DEBUG
1404extern unsigned int sysctl_sched_latency; 1434extern unsigned int sysctl_sched_latency;
1405extern unsigned int sysctl_sched_min_granularity; 1435extern unsigned int sysctl_sched_nr_latency;
1406extern unsigned int sysctl_sched_wakeup_granularity; 1436extern unsigned int sysctl_sched_wakeup_granularity;
1407extern unsigned int sysctl_sched_batch_wakeup_granularity; 1437extern unsigned int sysctl_sched_batch_wakeup_granularity;
1408extern unsigned int sysctl_sched_stat_granularity;
1409extern unsigned int sysctl_sched_runtime_limit;
1410extern unsigned int sysctl_sched_compat_yield;
1411extern unsigned int sysctl_sched_child_runs_first; 1438extern unsigned int sysctl_sched_child_runs_first;
1412extern unsigned int sysctl_sched_features; 1439extern unsigned int sysctl_sched_features;
1440extern unsigned int sysctl_sched_migration_cost;
1441#endif
1442
1443extern unsigned int sysctl_sched_compat_yield;
1413 1444
1414#ifdef CONFIG_RT_MUTEXES 1445#ifdef CONFIG_RT_MUTEXES
1415extern int rt_mutex_getprio(struct task_struct *p); 1446extern int rt_mutex_getprio(struct task_struct *p);
@@ -1843,6 +1874,18 @@ extern int sched_mc_power_savings, sched_smt_power_savings;
1843 1874
1844extern void normalize_rt_tasks(void); 1875extern void normalize_rt_tasks(void);
1845 1876
1877#ifdef CONFIG_FAIR_GROUP_SCHED
1878
1879extern struct task_group init_task_group;
1880
1881extern struct task_group *sched_create_group(void);
1882extern void sched_destroy_group(struct task_group *tg);
1883extern void sched_move_task(struct task_struct *tsk);
1884extern int sched_group_set_shares(struct task_group *tg, unsigned long shares);
1885extern unsigned long sched_group_shares(struct task_group *tg);
1886
1887#endif
1888
1846#ifdef CONFIG_TASK_XACCT 1889#ifdef CONFIG_TASK_XACCT
1847static inline void add_rchar(struct task_struct *tsk, ssize_t amt) 1890static inline void add_rchar(struct task_struct *tsk, ssize_t amt)
1848{ 1891{
diff --git a/include/linux/scx200_gpio.h b/include/linux/scx200_gpio.h
index d2b058130eb1..ece4e553e9ac 100644
--- a/include/linux/scx200_gpio.h
+++ b/include/linux/scx200_gpio.h
@@ -1,7 +1,7 @@
1u32 scx200_gpio_configure(unsigned index, u32 set, u32 clear); 1u32 scx200_gpio_configure(unsigned index, u32 set, u32 clear);
2 2
3extern unsigned scx200_gpio_base; 3extern unsigned scx200_gpio_base;
4extern long scx200_gpio_shadow[2]; 4extern unsigned long scx200_gpio_shadow[2];
5extern struct nsc_gpio_ops scx200_gpio_ops; 5extern struct nsc_gpio_ops scx200_gpio_ops;
6 6
7#define scx200_gpio_present() (scx200_gpio_base!=0) 7#define scx200_gpio_present() (scx200_gpio_base!=0)
@@ -9,7 +9,7 @@ extern struct nsc_gpio_ops scx200_gpio_ops;
9/* Definitions to make sure I do the same thing in all functions */ 9/* Definitions to make sure I do the same thing in all functions */
10#define __SCx200_GPIO_BANK unsigned bank = index>>5 10#define __SCx200_GPIO_BANK unsigned bank = index>>5
11#define __SCx200_GPIO_IOADDR unsigned short ioaddr = scx200_gpio_base+0x10*bank 11#define __SCx200_GPIO_IOADDR unsigned short ioaddr = scx200_gpio_base+0x10*bank
12#define __SCx200_GPIO_SHADOW long *shadow = scx200_gpio_shadow+bank 12#define __SCx200_GPIO_SHADOW unsigned long *shadow = scx200_gpio_shadow+bank
13#define __SCx200_GPIO_INDEX index &= 31 13#define __SCx200_GPIO_INDEX index &= 31
14 14
15#define __SCx200_GPIO_OUT __asm__ __volatile__("outsl":"=mS" (shadow):"d" (ioaddr), "0" (shadow)) 15#define __SCx200_GPIO_OUT __asm__ __volatile__("outsl":"=mS" (shadow):"d" (ioaddr), "0" (shadow))
@@ -42,7 +42,7 @@ static inline void scx200_gpio_set_high(unsigned index) {
42 __SCx200_GPIO_IOADDR; 42 __SCx200_GPIO_IOADDR;
43 __SCx200_GPIO_SHADOW; 43 __SCx200_GPIO_SHADOW;
44 __SCx200_GPIO_INDEX; 44 __SCx200_GPIO_INDEX;
45 set_bit(index, shadow); 45 set_bit(index, shadow); /* __set_bit()? */
46 __SCx200_GPIO_OUT; 46 __SCx200_GPIO_OUT;
47} 47}
48 48
@@ -53,7 +53,7 @@ static inline void scx200_gpio_set_low(unsigned index) {
53 __SCx200_GPIO_IOADDR; 53 __SCx200_GPIO_IOADDR;
54 __SCx200_GPIO_SHADOW; 54 __SCx200_GPIO_SHADOW;
55 __SCx200_GPIO_INDEX; 55 __SCx200_GPIO_INDEX;
56 clear_bit(index, shadow); 56 clear_bit(index, shadow); /* __clear_bit()? */
57 __SCx200_GPIO_OUT; 57 __SCx200_GPIO_OUT;
58} 58}
59 59
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index a656cecd373c..f93f22b3d2ff 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -357,6 +357,7 @@ static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
357} 357}
358 358
359extern void kfree_skbmem(struct sk_buff *skb); 359extern void kfree_skbmem(struct sk_buff *skb);
360extern struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src);
360extern struct sk_buff *skb_clone(struct sk_buff *skb, 361extern struct sk_buff *skb_clone(struct sk_buff *skb,
361 gfp_t priority); 362 gfp_t priority);
362extern struct sk_buff *skb_copy(const struct sk_buff *skb, 363extern struct sk_buff *skb_copy(const struct sk_buff *skb,
@@ -1781,6 +1782,11 @@ static inline int skb_is_gso(const struct sk_buff *skb)
1781 return skb_shinfo(skb)->gso_size; 1782 return skb_shinfo(skb)->gso_size;
1782} 1783}
1783 1784
1785static inline int skb_is_gso_v6(const struct sk_buff *skb)
1786{
1787 return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6;
1788}
1789
1784static inline void skb_forward_csum(struct sk_buff *skb) 1790static inline void skb_forward_csum(struct sk_buff *skb)
1785{ 1791{
1786 /* Unfortunately we don't support this one. Any brave souls? */ 1792 /* Unfortunately we don't support this one. Any brave souls? */
diff --git a/include/linux/stallion.h b/include/linux/stallion.h
index 4a0a329beafb..94b4a10b912f 100644
--- a/include/linux/stallion.h
+++ b/include/linux/stallion.h
@@ -75,7 +75,7 @@ struct stlport {
75 int ioaddr; 75 int ioaddr;
76 int uartaddr; 76 int uartaddr;
77 unsigned int pagenr; 77 unsigned int pagenr;
78 long istate; 78 unsigned long istate;
79 int flags; 79 int flags;
80 int baud_base; 80 int baud_base;
81 int custom_divisor; 81 int custom_divisor;
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 3699dff7db8f..bd7a6b0a87af 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -136,16 +136,6 @@ sunrpc_cache_update(struct cache_detail *detail,
136 struct cache_head *new, struct cache_head *old, int hash); 136 struct cache_head *new, struct cache_head *old, int hash);
137 137
138 138
139#define cache_for_each(pos, detail, index, member) \
140 for (({read_lock(&(detail)->hash_lock); index = (detail)->hash_size;}) ; \
141 ({if (index==0)read_unlock(&(detail)->hash_lock); index--;}); \
142 ) \
143 for (pos = container_of((detail)->hash_table[index], typeof(*pos), member); \
144 &pos->member; \
145 pos = container_of(pos->member.next, typeof(*pos), member))
146
147
148
149extern void cache_clean_deferred(void *owner); 139extern void cache_clean_deferred(void *owner);
150 140
151static inline struct cache_head *cache_get(struct cache_head *h) 141static inline struct cache_head *cache_get(struct cache_head *h)
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index c0d9d14983b3..d9d5c5ad826c 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -117,7 +117,7 @@ struct rpc_create_args {
117 117
118struct rpc_clnt *rpc_create(struct rpc_create_args *args); 118struct rpc_clnt *rpc_create(struct rpc_create_args *args);
119struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, 119struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
120 struct rpc_program *, int); 120 struct rpc_program *, u32);
121struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); 121struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
122void rpc_shutdown_client(struct rpc_clnt *); 122void rpc_shutdown_client(struct rpc_clnt *);
123void rpc_release_client(struct rpc_clnt *); 123void rpc_release_client(struct rpc_clnt *);
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index 3912cf16361e..3347c72b848a 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -88,6 +88,11 @@ enum {
88 CTL_SLOTTABLE_TCP, 88 CTL_SLOTTABLE_TCP,
89 CTL_MIN_RESVPORT, 89 CTL_MIN_RESVPORT,
90 CTL_MAX_RESVPORT, 90 CTL_MAX_RESVPORT,
91 CTL_SLOTTABLE_RDMA,
92 CTL_RDMA_MAXINLINEREAD,
93 CTL_RDMA_MAXINLINEWRITE,
94 CTL_RDMA_WRITEPADDING,
95 CTL_RDMA_MEMREG,
91}; 96};
92 97
93#endif /* _LINUX_SUNRPC_DEBUG_H_ */ 98#endif /* _LINUX_SUNRPC_DEBUG_H_ */
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h
index 784d4c3ef651..c4beb5775111 100644
--- a/include/linux/sunrpc/msg_prot.h
+++ b/include/linux/sunrpc/msg_prot.h
@@ -138,6 +138,19 @@ typedef __be32 rpc_fraghdr;
138#define RPC_MAX_HEADER_WITH_AUTH \ 138#define RPC_MAX_HEADER_WITH_AUTH \
139 (RPC_CALLHDRSIZE + 2*(2+RPC_MAX_AUTH_SIZE/4)) 139 (RPC_CALLHDRSIZE + 2*(2+RPC_MAX_AUTH_SIZE/4))
140 140
141/*
142 * RFC1833/RFC3530 rpcbind (v3+) well-known netid's.
143 */
144#define RPCBIND_NETID_UDP "udp"
145#define RPCBIND_NETID_TCP "tcp"
146#define RPCBIND_NETID_UDP6 "udp6"
147#define RPCBIND_NETID_TCP6 "tcp6"
148
149/*
150 * Note that RFC 1833 does not put any size restrictions on the
151 * netid string, but all currently defined netid's fit in 4 bytes.
152 */
153#define RPCBIND_MAXNETIDLEN (4u)
141 154
142#endif /* __KERNEL__ */ 155#endif /* __KERNEL__ */
143#endif /* _LINUX_SUNRPC_MSGPROT_H_ */ 156#endif /* _LINUX_SUNRPC_MSGPROT_H_ */
diff --git a/include/linux/sunrpc/rpc_rdma.h b/include/linux/sunrpc/rpc_rdma.h
new file mode 100644
index 000000000000..0013a0d8dc6b
--- /dev/null
+++ b/include/linux/sunrpc/rpc_rdma.h
@@ -0,0 +1,116 @@
1/*
2 * Copyright (c) 2003-2007 Network Appliance, Inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the BSD-type
8 * license below:
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 *
17 * Redistributions in binary form must reproduce the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer in the documentation and/or other materials provided
20 * with the distribution.
21 *
22 * Neither the name of the Network Appliance, Inc. nor the names of
23 * its contributors may be used to endorse or promote products
24 * derived from this software without specific prior written
25 * permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 */
39
40#ifndef _LINUX_SUNRPC_RPC_RDMA_H
41#define _LINUX_SUNRPC_RPC_RDMA_H
42
43struct rpcrdma_segment {
44 uint32_t rs_handle; /* Registered memory handle */
45 uint32_t rs_length; /* Length of the chunk in bytes */
46 uint64_t rs_offset; /* Chunk virtual address or offset */
47};
48
49/*
50 * read chunk(s), encoded as a linked list.
51 */
52struct rpcrdma_read_chunk {
53 uint32_t rc_discrim; /* 1 indicates presence */
54 uint32_t rc_position; /* Position in XDR stream */
55 struct rpcrdma_segment rc_target;
56};
57
58/*
59 * write chunk, and reply chunk.
60 */
61struct rpcrdma_write_chunk {
62 struct rpcrdma_segment wc_target;
63};
64
65/*
66 * write chunk(s), encoded as a counted array.
67 */
68struct rpcrdma_write_array {
69 uint32_t wc_discrim; /* 1 indicates presence */
70 uint32_t wc_nchunks; /* Array count */
71 struct rpcrdma_write_chunk wc_array[0];
72};
73
74struct rpcrdma_msg {
75 uint32_t rm_xid; /* Mirrors the RPC header xid */
76 uint32_t rm_vers; /* Version of this protocol */
77 uint32_t rm_credit; /* Buffers requested/granted */
78 uint32_t rm_type; /* Type of message (enum rpcrdma_proc) */
79 union {
80
81 struct { /* no chunks */
82 uint32_t rm_empty[3]; /* 3 empty chunk lists */
83 } rm_nochunks;
84
85 struct { /* no chunks and padded */
86 uint32_t rm_align; /* Padding alignment */
87 uint32_t rm_thresh; /* Padding threshold */
88 uint32_t rm_pempty[3]; /* 3 empty chunk lists */
89 } rm_padded;
90
91 uint32_t rm_chunks[0]; /* read, write and reply chunks */
92
93 } rm_body;
94};
95
96#define RPCRDMA_HDRLEN_MIN 28
97
98enum rpcrdma_errcode {
99 ERR_VERS = 1,
100 ERR_CHUNK = 2
101};
102
103struct rpcrdma_err_vers {
104 uint32_t rdma_vers_low; /* Version range supported by peer */
105 uint32_t rdma_vers_high;
106};
107
108enum rpcrdma_proc {
109 RDMA_MSG = 0, /* An RPC call or reply msg */
110 RDMA_NOMSG = 1, /* An RPC call or reply msg - separate body */
111 RDMA_MSGP = 2, /* An RPC call or reply msg with padding */
112 RDMA_DONE = 3, /* Client signals reply completion */
113 RDMA_ERROR = 4 /* An RPC RDMA encoding error */
114};
115
116#endif /* _LINUX_SUNRPC_RPC_RDMA_H */
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index c6b53d181bfa..0751c9464d0f 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -70,7 +70,10 @@ struct xdr_buf {
70 70
71 struct page ** pages; /* Array of contiguous pages */ 71 struct page ** pages; /* Array of contiguous pages */
72 unsigned int page_base, /* Start of page data */ 72 unsigned int page_base, /* Start of page data */
73 page_len; /* Length of page data */ 73 page_len, /* Length of page data */
74 flags; /* Flags for data disposition */
75#define XDRBUF_READ 0x01 /* target of file read */
76#define XDRBUF_WRITE 0x02 /* source of file write */
74 77
75 unsigned int buflen, /* Total length of storage buffer */ 78 unsigned int buflen, /* Total length of storage buffer */
76 len; /* Length of XDR encoded message */ 79 len; /* Length of XDR encoded message */
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index d11cedd14f0f..30b17b3bc1a9 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -19,25 +19,11 @@
19 19
20#ifdef __KERNEL__ 20#ifdef __KERNEL__
21 21
22extern unsigned int xprt_udp_slot_table_entries;
23extern unsigned int xprt_tcp_slot_table_entries;
24
25#define RPC_MIN_SLOT_TABLE (2U) 22#define RPC_MIN_SLOT_TABLE (2U)
26#define RPC_DEF_SLOT_TABLE (16U) 23#define RPC_DEF_SLOT_TABLE (16U)
27#define RPC_MAX_SLOT_TABLE (128U) 24#define RPC_MAX_SLOT_TABLE (128U)
28 25
29/* 26/*
30 * Parameters for choosing a free port
31 */
32extern unsigned int xprt_min_resvport;
33extern unsigned int xprt_max_resvport;
34
35#define RPC_MIN_RESVPORT (1U)
36#define RPC_MAX_RESVPORT (65535U)
37#define RPC_DEF_MIN_RESVPORT (665U)
38#define RPC_DEF_MAX_RESVPORT (1023U)
39
40/*
41 * This describes a timeout strategy 27 * This describes a timeout strategy
42 */ 28 */
43struct rpc_timeout { 29struct rpc_timeout {
@@ -53,6 +39,10 @@ enum rpc_display_format_t {
53 RPC_DISPLAY_PORT, 39 RPC_DISPLAY_PORT,
54 RPC_DISPLAY_PROTO, 40 RPC_DISPLAY_PROTO,
55 RPC_DISPLAY_ALL, 41 RPC_DISPLAY_ALL,
42 RPC_DISPLAY_HEX_ADDR,
43 RPC_DISPLAY_HEX_PORT,
44 RPC_DISPLAY_UNIVERSAL_ADDR,
45 RPC_DISPLAY_NETID,
56 RPC_DISPLAY_MAX, 46 RPC_DISPLAY_MAX,
57}; 47};
58 48
@@ -196,14 +186,22 @@ struct rpc_xprt {
196 char * address_strings[RPC_DISPLAY_MAX]; 186 char * address_strings[RPC_DISPLAY_MAX];
197}; 187};
198 188
199struct rpc_xprtsock_create { 189struct xprt_create {
200 int proto; /* IPPROTO_UDP or IPPROTO_TCP */ 190 int ident; /* XPRT_TRANSPORT identifier */
201 struct sockaddr * srcaddr; /* optional local address */ 191 struct sockaddr * srcaddr; /* optional local address */
202 struct sockaddr * dstaddr; /* remote peer address */ 192 struct sockaddr * dstaddr; /* remote peer address */
203 size_t addrlen; 193 size_t addrlen;
204 struct rpc_timeout * timeout; /* optional timeout parameters */ 194 struct rpc_timeout * timeout; /* optional timeout parameters */
205}; 195};
206 196
197struct xprt_class {
198 struct list_head list;
199 int ident; /* XPRT_TRANSPORT identifier */
200 struct rpc_xprt * (*setup)(struct xprt_create *);
201 struct module *owner;
202 char name[32];
203};
204
207/* 205/*
208 * Transport operations used by ULPs 206 * Transport operations used by ULPs
209 */ 207 */
@@ -212,7 +210,7 @@ void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long
212/* 210/*
213 * Generic internal transport functions 211 * Generic internal transport functions
214 */ 212 */
215struct rpc_xprt * xprt_create_transport(struct rpc_xprtsock_create *args); 213struct rpc_xprt *xprt_create_transport(struct xprt_create *args);
216void xprt_connect(struct rpc_task *task); 214void xprt_connect(struct rpc_task *task);
217void xprt_reserve(struct rpc_task *task); 215void xprt_reserve(struct rpc_task *task);
218int xprt_reserve_xprt(struct rpc_task *task); 216int xprt_reserve_xprt(struct rpc_task *task);
@@ -235,6 +233,8 @@ static inline __be32 *xprt_skip_transport_header(struct rpc_xprt *xprt, __be32 *
235/* 233/*
236 * Transport switch helper functions 234 * Transport switch helper functions
237 */ 235 */
236int xprt_register_transport(struct xprt_class *type);
237int xprt_unregister_transport(struct xprt_class *type);
238void xprt_set_retrans_timeout_def(struct rpc_task *task); 238void xprt_set_retrans_timeout_def(struct rpc_task *task);
239void xprt_set_retrans_timeout_rtt(struct rpc_task *task); 239void xprt_set_retrans_timeout_rtt(struct rpc_task *task);
240void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status); 240void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status);
@@ -248,14 +248,6 @@ void xprt_release_rqst_cong(struct rpc_task *task);
248void xprt_disconnect(struct rpc_xprt *xprt); 248void xprt_disconnect(struct rpc_xprt *xprt);
249 249
250/* 250/*
251 * Socket transport setup operations
252 */
253struct rpc_xprt * xs_setup_udp(struct rpc_xprtsock_create *args);
254struct rpc_xprt * xs_setup_tcp(struct rpc_xprtsock_create *args);
255int init_socket_xprt(void);
256void cleanup_socket_xprt(void);
257
258/*
259 * Reserved bit positions in xprt->state 251 * Reserved bit positions in xprt->state
260 */ 252 */
261#define XPRT_LOCKED (0) 253#define XPRT_LOCKED (0)
diff --git a/include/linux/sunrpc/xprtrdma.h b/include/linux/sunrpc/xprtrdma.h
new file mode 100644
index 000000000000..4de56b1d372b
--- /dev/null
+++ b/include/linux/sunrpc/xprtrdma.h
@@ -0,0 +1,85 @@
1/*
2 * Copyright (c) 2003-2007 Network Appliance, Inc. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the BSD-type
8 * license below:
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 *
14 * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 *
17 * Redistributions in binary form must reproduce the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer in the documentation and/or other materials provided
20 * with the distribution.
21 *
22 * Neither the name of the Network Appliance, Inc. nor the names of
23 * its contributors may be used to endorse or promote products
24 * derived from this software without specific prior written
25 * permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 */
39
40#ifndef _LINUX_SUNRPC_XPRTRDMA_H
41#define _LINUX_SUNRPC_XPRTRDMA_H
42
43/*
44 * RPC transport identifier for RDMA
45 */
46#define XPRT_TRANSPORT_RDMA 256
47
48/*
49 * rpcbind (v3+) RDMA netid.
50 */
51#define RPCBIND_NETID_RDMA "rdma"
52
53/*
54 * Constants. Max RPC/NFS header is big enough to account for
55 * additional marshaling buffers passed down by Linux client.
56 *
57 * RDMA header is currently fixed max size, and is big enough for a
58 * fully-chunked NFS message (read chunks are the largest). Note only
59 * a single chunk type per message is supported currently.
60 */
61#define RPCRDMA_MIN_SLOT_TABLE (2U)
62#define RPCRDMA_DEF_SLOT_TABLE (32U)
63#define RPCRDMA_MAX_SLOT_TABLE (256U)
64
65#define RPCRDMA_DEF_INLINE (1024) /* default inline max */
66
67#define RPCRDMA_INLINE_PAD_THRESH (512)/* payload threshold to pad (bytes) */
68
69#define RDMA_RESOLVE_TIMEOUT (5*HZ) /* TBD 5 seconds */
70#define RDMA_CONNECT_RETRY_MAX (2) /* retries if no listener backlog */
71
72/* memory registration strategies */
73#define RPCRDMA_PERSISTENT_REGISTRATION (1)
74
75enum rpcrdma_memreg {
76 RPCRDMA_BOUNCEBUFFERS = 0,
77 RPCRDMA_REGISTER,
78 RPCRDMA_MEMWINDOWS,
79 RPCRDMA_MEMWINDOWS_ASYNC,
80 RPCRDMA_MTHCAFMR,
81 RPCRDMA_ALLPHYSICAL,
82 RPCRDMA_LAST
83};
84
85#endif /* _LINUX_SUNRPC_XPRTRDMA_H */
diff --git a/include/linux/sunrpc/xprtsock.h b/include/linux/sunrpc/xprtsock.h
new file mode 100644
index 000000000000..2c6c2c2783d8
--- /dev/null
+++ b/include/linux/sunrpc/xprtsock.h
@@ -0,0 +1,51 @@
1/*
2 * linux/include/linux/sunrpc/xprtsock.h
3 *
4 * Declarations for the RPC transport socket provider.
5 */
6
7#ifndef _LINUX_SUNRPC_XPRTSOCK_H
8#define _LINUX_SUNRPC_XPRTSOCK_H
9
10#ifdef __KERNEL__
11
12/*
13 * Socket transport setup operations
14 */
15struct rpc_xprt *xs_setup_udp(struct xprt_create *args);
16struct rpc_xprt *xs_setup_tcp(struct xprt_create *args);
17
18int init_socket_xprt(void);
19void cleanup_socket_xprt(void);
20
21/*
22 * RPC transport identifiers for UDP, TCP
23 *
24 * To preserve compatibility with the historical use of raw IP protocol
25 * id's for transport selection, these are specified with the previous
26 * values. No such restriction exists for new transports, except that
27 * they may not collide with these values (17 and 6, respectively).
28 */
29#define XPRT_TRANSPORT_UDP IPPROTO_UDP
30#define XPRT_TRANSPORT_TCP IPPROTO_TCP
31
32/*
33 * RPC slot table sizes for UDP, TCP transports
34 */
35extern unsigned int xprt_udp_slot_table_entries;
36extern unsigned int xprt_tcp_slot_table_entries;
37
38/*
39 * Parameters for choosing a free port
40 */
41extern unsigned int xprt_min_resvport;
42extern unsigned int xprt_max_resvport;
43
44#define RPC_MIN_RESVPORT (1U)
45#define RPC_MAX_RESVPORT (65535U)
46#define RPC_DEF_MIN_RESVPORT (665U)
47#define RPC_DEF_MAX_RESVPORT (1023U)
48
49#endif /* __KERNEL__ */
50
51#endif /* _LINUX_SUNRPC_XPRTSOCK_H */
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index be8228e50a27..149ab62329e2 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -3,6 +3,8 @@
3 * 3 *
4 * Copyright (c) 2001,2002 Patrick Mochel 4 * Copyright (c) 2001,2002 Patrick Mochel
5 * Copyright (c) 2004 Silicon Graphics, Inc. 5 * Copyright (c) 2004 Silicon Graphics, Inc.
6 * Copyright (c) 2007 SUSE Linux Products GmbH
7 * Copyright (c) 2007 Tejun Heo <teheo@suse.de>
6 * 8 *
7 * Please see Documentation/filesystems/sysfs.txt for more information. 9 * Please see Documentation/filesystems/sysfs.txt for more information.
8 */ 10 */
@@ -17,23 +19,20 @@
17 19
18struct kobject; 20struct kobject;
19struct module; 21struct module;
20struct nameidata;
21struct dentry;
22struct sysfs_dirent;
23 22
24/* FIXME 23/* FIXME
25 * The *owner field is no longer used, but leave around 24 * The *owner field is no longer used, but leave around
26 * until the tree gets cleaned up fully. 25 * until the tree gets cleaned up fully.
27 */ 26 */
28struct attribute { 27struct attribute {
29 const char * name; 28 const char *name;
30 struct module * owner; 29 struct module *owner;
31 mode_t mode; 30 mode_t mode;
32}; 31};
33 32
34struct attribute_group { 33struct attribute_group {
35 const char * name; 34 const char *name;
36 struct attribute ** attrs; 35 struct attribute **attrs;
37}; 36};
38 37
39 38
@@ -77,72 +76,41 @@ struct sysfs_ops {
77 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); 76 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t);
78}; 77};
79 78
80#define SYSFS_TYPE_MASK 0x00ff
81#define SYSFS_ROOT 0x0001
82#define SYSFS_DIR 0x0002
83#define SYSFS_KOBJ_ATTR 0x0004
84#define SYSFS_KOBJ_BIN_ATTR 0x0008
85#define SYSFS_KOBJ_LINK 0x0020
86#define SYSFS_COPY_NAME (SYSFS_DIR | SYSFS_KOBJ_LINK)
87
88#define SYSFS_FLAG_MASK ~SYSFS_TYPE_MASK
89#define SYSFS_FLAG_REMOVED 0x0100
90
91#ifdef CONFIG_SYSFS 79#ifdef CONFIG_SYSFS
92 80
93extern int sysfs_schedule_callback(struct kobject *kobj, 81int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *),
94 void (*func)(void *), void *data, struct module *owner); 82 void *data, struct module *owner);
95
96extern int __must_check
97sysfs_create_dir(struct kobject *kobj, struct sysfs_dirent *shadow_parent_sd);
98
99extern void
100sysfs_remove_dir(struct kobject *);
101
102extern int __must_check
103sysfs_rename_dir(struct kobject *kobj, struct sysfs_dirent *new_parent_sd,
104 const char *new_name);
105
106extern int __must_check
107sysfs_move_dir(struct kobject *, struct kobject *);
108
109extern int __must_check
110sysfs_create_file(struct kobject *, const struct attribute *);
111 83
112extern int __must_check 84int __must_check sysfs_create_dir(struct kobject *kobj);
113sysfs_update_file(struct kobject *, const struct attribute *); 85void sysfs_remove_dir(struct kobject *kobj);
86int __must_check sysfs_rename_dir(struct kobject *kobj, const char *new_name);
87int __must_check sysfs_move_dir(struct kobject *kobj,
88 struct kobject *new_parent_kobj);
114 89
115extern int __must_check 90int __must_check sysfs_create_file(struct kobject *kobj,
116sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode); 91 const struct attribute *attr);
117 92int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr,
118extern void 93 mode_t mode);
119sysfs_remove_file(struct kobject *, const struct attribute *); 94void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr);
120
121extern int __must_check
122sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name);
123
124extern void
125sysfs_remove_link(struct kobject *, const char * name);
126 95
127int __must_check sysfs_create_bin_file(struct kobject *kobj, 96int __must_check sysfs_create_bin_file(struct kobject *kobj,
128 struct bin_attribute *attr); 97 struct bin_attribute *attr);
129void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr); 98void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr);
130 99
131int __must_check sysfs_create_group(struct kobject *, 100int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target,
132 const struct attribute_group *); 101 const char *name);
133void sysfs_remove_group(struct kobject *, const struct attribute_group *); 102void sysfs_remove_link(struct kobject *kobj, const char *name);
103
104int __must_check sysfs_create_group(struct kobject *kobj,
105 const struct attribute_group *grp);
106void sysfs_remove_group(struct kobject *kobj,
107 const struct attribute_group *grp);
134int sysfs_add_file_to_group(struct kobject *kobj, 108int sysfs_add_file_to_group(struct kobject *kobj,
135 const struct attribute *attr, const char *group); 109 const struct attribute *attr, const char *group);
136void sysfs_remove_file_from_group(struct kobject *kobj, 110void sysfs_remove_file_from_group(struct kobject *kobj,
137 const struct attribute *attr, const char *group); 111 const struct attribute *attr, const char *group);
138
139void sysfs_notify(struct kobject * k, char *dir, char *attr);
140
141 112
142extern int sysfs_make_shadowed_dir(struct kobject *kobj, 113void sysfs_notify(struct kobject *kobj, char *dir, char *attr);
143 void * (*follow_link)(struct dentry *, struct nameidata *));
144extern struct sysfs_dirent *sysfs_create_shadow_dir(struct kobject *kobj);
145extern void sysfs_remove_shadow_dir(struct sysfs_dirent *shadow_sd);
146 114
147extern int __must_check sysfs_init(void); 115extern int __must_check sysfs_init(void);
148 116
@@ -154,75 +122,76 @@ static inline int sysfs_schedule_callback(struct kobject *kobj,
154 return -ENOSYS; 122 return -ENOSYS;
155} 123}
156 124
157static inline int sysfs_create_dir(struct kobject *kobj, 125static inline int sysfs_create_dir(struct kobject *kobj)
158 struct sysfs_dirent *shadow_parent_sd)
159{ 126{
160 return 0; 127 return 0;
161} 128}
162 129
163static inline void sysfs_remove_dir(struct kobject * k) 130static inline void sysfs_remove_dir(struct kobject *kobj)
164{ 131{
165 ; 132 ;
166} 133}
167 134
168static inline int sysfs_rename_dir(struct kobject *kobj, 135static inline int sysfs_rename_dir(struct kobject *kobj, const char *new_name)
169 struct sysfs_dirent *new_parent_sd,
170 const char *new_name)
171{ 136{
172 return 0; 137 return 0;
173} 138}
174 139
175static inline int sysfs_move_dir(struct kobject * k, struct kobject * new_parent) 140static inline int sysfs_move_dir(struct kobject *kobj,
141 struct kobject *new_parent_kobj)
176{ 142{
177 return 0; 143 return 0;
178} 144}
179 145
180static inline int sysfs_create_file(struct kobject * k, const struct attribute * a) 146static inline int sysfs_create_file(struct kobject *kobj,
147 const struct attribute *attr)
181{ 148{
182 return 0; 149 return 0;
183} 150}
184 151
185static inline int sysfs_update_file(struct kobject * k, const struct attribute * a) 152static inline int sysfs_chmod_file(struct kobject *kobj,
186{ 153 struct attribute *attr, mode_t mode)
187 return 0;
188}
189static inline int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode)
190{ 154{
191 return 0; 155 return 0;
192} 156}
193 157
194static inline void sysfs_remove_file(struct kobject * k, const struct attribute * a) 158static inline void sysfs_remove_file(struct kobject *kobj,
159 const struct attribute *attr)
195{ 160{
196 ; 161 ;
197} 162}
198 163
199static inline int sysfs_create_link(struct kobject * k, struct kobject * t, const char * n) 164static inline int sysfs_create_bin_file(struct kobject *kobj,
165 struct bin_attribute *attr)
200{ 166{
201 return 0; 167 return 0;
202} 168}
203 169
204static inline void sysfs_remove_link(struct kobject * k, const char * name) 170static inline int sysfs_remove_bin_file(struct kobject *kobj,
171 struct bin_attribute *attr)
205{ 172{
206 ; 173 return 0;
207} 174}
208 175
209 176static inline int sysfs_create_link(struct kobject *kobj,
210static inline int sysfs_create_bin_file(struct kobject * k, struct bin_attribute * a) 177 struct kobject *target, const char *name)
211{ 178{
212 return 0; 179 return 0;
213} 180}
214 181
215static inline int sysfs_remove_bin_file(struct kobject * k, struct bin_attribute * a) 182static inline void sysfs_remove_link(struct kobject *kobj, const char *name)
216{ 183{
217 return 0; 184 ;
218} 185}
219 186
220static inline int sysfs_create_group(struct kobject * k, const struct attribute_group *g) 187static inline int sysfs_create_group(struct kobject *kobj,
188 const struct attribute_group *grp)
221{ 189{
222 return 0; 190 return 0;
223} 191}
224 192
225static inline void sysfs_remove_group(struct kobject * k, const struct attribute_group * g) 193static inline void sysfs_remove_group(struct kobject *kobj,
194 const struct attribute_group *grp)
226{ 195{
227 ; 196 ;
228} 197}
@@ -238,14 +207,8 @@ static inline void sysfs_remove_file_from_group(struct kobject *kobj,
238{ 207{
239} 208}
240 209
241static inline void sysfs_notify(struct kobject * k, char *dir, char *attr) 210static inline void sysfs_notify(struct kobject *kobj, char *dir, char *attr)
242{
243}
244
245static inline int sysfs_make_shadowed_dir(struct kobject *kobj,
246 void * (*follow_link)(struct dentry *, struct nameidata *))
247{ 211{
248 return 0;
249} 212}
250 213
251static inline int __must_check sysfs_init(void) 214static inline int __must_check sysfs_init(void)
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index c5b94c1a5ee2..bac17c59b24e 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -315,7 +315,7 @@ struct tcp_sock {
315 */ 315 */
316 u32 snd_ssthresh; /* Slow start size threshold */ 316 u32 snd_ssthresh; /* Slow start size threshold */
317 u32 snd_cwnd; /* Sending congestion window */ 317 u32 snd_cwnd; /* Sending congestion window */
318 u16 snd_cwnd_cnt; /* Linear increase counter */ 318 u32 snd_cwnd_cnt; /* Linear increase counter */
319 u32 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */ 319 u32 snd_cwnd_clamp; /* Do not allow snd_cwnd to grow above this */
320 u32 snd_cwnd_used; 320 u32 snd_cwnd_used;
321 u32 snd_cwnd_stamp; 321 u32 snd_cwnd_stamp;
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 525d437b1253..47729f18bfdf 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -159,15 +159,14 @@
159 .imbalance_pct = 125, \ 159 .imbalance_pct = 125, \
160 .cache_nice_tries = 1, \ 160 .cache_nice_tries = 1, \
161 .busy_idx = 2, \ 161 .busy_idx = 2, \
162 .idle_idx = 0, \ 162 .idle_idx = 1, \
163 .newidle_idx = 0, \ 163 .newidle_idx = 2, \
164 .wake_idx = 1, \ 164 .wake_idx = 1, \
165 .forkexec_idx = 1, \ 165 .forkexec_idx = 1, \
166 .flags = SD_LOAD_BALANCE \ 166 .flags = SD_LOAD_BALANCE \
167 | SD_BALANCE_NEWIDLE \ 167 | SD_BALANCE_NEWIDLE \
168 | SD_BALANCE_EXEC \ 168 | SD_BALANCE_EXEC \
169 | SD_WAKE_AFFINE \ 169 | SD_WAKE_AFFINE \
170 | SD_WAKE_IDLE \
171 | BALANCE_FOR_PKG_POWER,\ 170 | BALANCE_FOR_PKG_POWER,\
172 .last_balance = jiffies, \ 171 .last_balance = jiffies, \
173 .balance_interval = 1, \ 172 .balance_interval = 1, \
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 6570719eafdf..60478f6e5dc6 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -21,7 +21,6 @@
21 * (Note: the *_driver.minor_start values 1, 64, 128, 192 are 21 * (Note: the *_driver.minor_start values 1, 64, 128, 192 are
22 * hardcoded at present.) 22 * hardcoded at present.)
23 */ 23 */
24#define NR_PTYS CONFIG_LEGACY_PTY_COUNT /* Number of legacy ptys */
25#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ 24#define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */
26#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ 25#define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */
27#define NR_LDISCS 17 26#define NR_LDISCS 17
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 4f33a58fa9d1..c5c8f169d3cf 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -52,6 +52,7 @@ struct ep_device;
52 * @ep_dev: ep_device for sysfs info 52 * @ep_dev: ep_device for sysfs info
53 * @extra: descriptors following this endpoint in the configuration 53 * @extra: descriptors following this endpoint in the configuration
54 * @extralen: how many bytes of "extra" are valid 54 * @extralen: how many bytes of "extra" are valid
55 * @enabled: URBs may be submitted to this endpoint
55 * 56 *
56 * USB requests are always queued to a given endpoint, identified by a 57 * USB requests are always queued to a given endpoint, identified by a
57 * descriptor within an active interface in a given USB configuration. 58 * descriptor within an active interface in a given USB configuration.
@@ -64,6 +65,7 @@ struct usb_host_endpoint {
64 65
65 unsigned char *extra; /* Extra descriptors */ 66 unsigned char *extra; /* Extra descriptors */
66 int extralen; 67 int extralen;
68 int enabled;
67}; 69};
68 70
69/* host-side wrapper for one interface setting's parsed descriptors */ 71/* host-side wrapper for one interface setting's parsed descriptors */
@@ -344,6 +346,11 @@ struct usb_tt;
344 * 346 *
345 * Usbcore drivers should not set usbdev->state directly. Instead use 347 * Usbcore drivers should not set usbdev->state directly. Instead use
346 * usb_set_device_state(). 348 * usb_set_device_state().
349 *
350 * @authorized: (user space) policy determines if we authorize this
351 * device to be used or not. By default, wired USB
352 * devices are authorized. WUSB devices are not, until we
353 * authorize them from user space. FIXME -- complete doc
347 */ 354 */
348struct usb_device { 355struct usb_device {
349 int devnum; /* Address on USB bus */ 356 int devnum; /* Address on USB bus */
@@ -376,8 +383,11 @@ struct usb_device {
376 u8 portnum; /* Parent port number (origin 1) */ 383 u8 portnum; /* Parent port number (origin 1) */
377 u8 level; /* Number of USB hub ancestors */ 384 u8 level; /* Number of USB hub ancestors */
378 385
386 unsigned can_submit:1; /* URBs may be submitted */
379 unsigned discon_suspended:1; /* Disconnected while suspended */ 387 unsigned discon_suspended:1; /* Disconnected while suspended */
380 unsigned have_langid:1; /* whether string_langid is valid */ 388 unsigned have_langid:1; /* whether string_langid is valid */
389 unsigned authorized:1; /* Policy has determined we can use it */
390 unsigned wusb:1; /* Device is Wireless USB */
381 int string_langid; /* language ID for strings */ 391 int string_langid; /* language ID for strings */
382 392
383 /* static strings from the device */ 393 /* static strings from the device */
@@ -405,6 +415,7 @@ struct usb_device {
405 415
406 int pm_usage_cnt; /* usage counter for autosuspend */ 416 int pm_usage_cnt; /* usage counter for autosuspend */
407 u32 quirks; /* quirks of the whole device */ 417 u32 quirks; /* quirks of the whole device */
418 atomic_t urbnum; /* number of URBs submitted for the whole device */
408 419
409#ifdef CONFIG_PM 420#ifdef CONFIG_PM
410 struct delayed_work autosuspend; /* for delayed autosuspends */ 421 struct delayed_work autosuspend; /* for delayed autosuspends */
@@ -419,6 +430,7 @@ struct usb_device {
419 unsigned persist_enabled:1; /* USB_PERSIST enabled for this dev */ 430 unsigned persist_enabled:1; /* USB_PERSIST enabled for this dev */
420 unsigned autosuspend_disabled:1; /* autosuspend and autoresume */ 431 unsigned autosuspend_disabled:1; /* autosuspend and autoresume */
421 unsigned autoresume_disabled:1; /* disabled by the user */ 432 unsigned autoresume_disabled:1; /* disabled by the user */
433 unsigned skip_sys_resume:1; /* skip the next system resume */
422#endif 434#endif
423}; 435};
424#define to_usb_device(d) container_of(d, struct usb_device, dev) 436#define to_usb_device(d) container_of(d, struct usb_device, dev)
@@ -555,6 +567,29 @@ static inline int usb_make_path (struct usb_device *dev, char *buf,
555/*-------------------------------------------------------------------------*/ 567/*-------------------------------------------------------------------------*/
556 568
557/** 569/**
570 * usb_endpoint_num - get the endpoint's number
571 * @epd: endpoint to be checked
572 *
573 * Returns @epd's number: 0 to 15.
574 */
575static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
576{
577 return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
578}
579
580/**
581 * usb_endpoint_type - get the endpoint's transfer type
582 * @epd: endpoint to be checked
583 *
584 * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according
585 * to @epd's transfer type.
586 */
587static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
588{
589 return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
590}
591
592/**
558 * usb_endpoint_dir_in - check if the endpoint has IN direction 593 * usb_endpoint_dir_in - check if the endpoint has IN direction
559 * @epd: endpoint to be checked 594 * @epd: endpoint to be checked
560 * 595 *
@@ -996,6 +1031,8 @@ extern int usb_disabled(void);
996 1031
997/* 1032/*
998 * urb->transfer_flags: 1033 * urb->transfer_flags:
1034 *
1035 * Note: URB_DIR_IN/OUT is automatically set in usb_submit_urb().
999 */ 1036 */
1000#define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */ 1037#define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */
1001#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame 1038#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame
@@ -1008,6 +1045,10 @@ extern int usb_disabled(void);
1008 * needed */ 1045 * needed */
1009#define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */ 1046#define URB_FREE_BUFFER 0x0100 /* Free transfer buffer with the URB */
1010 1047
1048#define URB_DIR_IN 0x0200 /* Transfer from device to host */
1049#define URB_DIR_OUT 0
1050#define URB_DIR_MASK URB_DIR_IN
1051
1011struct usb_iso_packet_descriptor { 1052struct usb_iso_packet_descriptor {
1012 unsigned int offset; 1053 unsigned int offset;
1013 unsigned int length; /* expected length */ 1054 unsigned int length; /* expected length */
@@ -1037,6 +1078,8 @@ typedef void (*usb_complete_t)(struct urb *);
1037 * @urb_list: For use by current owner of the URB. 1078 * @urb_list: For use by current owner of the URB.
1038 * @anchor_list: membership in the list of an anchor 1079 * @anchor_list: membership in the list of an anchor
1039 * @anchor: to anchor URBs to a common mooring 1080 * @anchor: to anchor URBs to a common mooring
1081 * @ep: Points to the endpoint's data structure. Will eventually
1082 * replace @pipe.
1040 * @pipe: Holds endpoint number, direction, type, and more. 1083 * @pipe: Holds endpoint number, direction, type, and more.
1041 * Create these values with the eight macros available; 1084 * Create these values with the eight macros available;
1042 * usb_{snd,rcv}TYPEpipe(dev,endpoint), where the TYPE is "ctrl" 1085 * usb_{snd,rcv}TYPEpipe(dev,endpoint), where the TYPE is "ctrl"
@@ -1201,10 +1244,10 @@ struct urb
1201{ 1244{
1202 /* private: usb core and host controller only fields in the urb */ 1245 /* private: usb core and host controller only fields in the urb */
1203 struct kref kref; /* reference count of the URB */ 1246 struct kref kref; /* reference count of the URB */
1204 spinlock_t lock; /* lock for the URB */
1205 void *hcpriv; /* private data for host controller */ 1247 void *hcpriv; /* private data for host controller */
1206 atomic_t use_count; /* concurrent submissions counter */ 1248 atomic_t use_count; /* concurrent submissions counter */
1207 u8 reject; /* submissions will fail */ 1249 u8 reject; /* submissions will fail */
1250 int unlinked; /* unlink error code */
1208 1251
1209 /* public: documented fields in the urb that can be used by drivers */ 1252 /* public: documented fields in the urb that can be used by drivers */
1210 struct list_head urb_list; /* list head for use by the urb's 1253 struct list_head urb_list; /* list head for use by the urb's
@@ -1212,6 +1255,7 @@ struct urb
1212 struct list_head anchor_list; /* the URB may be anchored by the driver */ 1255 struct list_head anchor_list; /* the URB may be anchored by the driver */
1213 struct usb_anchor *anchor; 1256 struct usb_anchor *anchor;
1214 struct usb_device *dev; /* (in) pointer to associated device */ 1257 struct usb_device *dev; /* (in) pointer to associated device */
1258 struct usb_host_endpoint *ep; /* (internal) pointer to endpoint struct */
1215 unsigned int pipe; /* (in) pipe information */ 1259 unsigned int pipe; /* (in) pipe information */
1216 int status; /* (return) non-ISO status */ 1260 int status; /* (return) non-ISO status */
1217 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ 1261 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/
@@ -1257,7 +1301,6 @@ static inline void usb_fill_control_urb (struct urb *urb,
1257 usb_complete_t complete_fn, 1301 usb_complete_t complete_fn,
1258 void *context) 1302 void *context)
1259{ 1303{
1260 spin_lock_init(&urb->lock);
1261 urb->dev = dev; 1304 urb->dev = dev;
1262 urb->pipe = pipe; 1305 urb->pipe = pipe;
1263 urb->setup_packet = setup_packet; 1306 urb->setup_packet = setup_packet;
@@ -1288,7 +1331,6 @@ static inline void usb_fill_bulk_urb (struct urb *urb,
1288 usb_complete_t complete_fn, 1331 usb_complete_t complete_fn,
1289 void *context) 1332 void *context)
1290{ 1333{
1291 spin_lock_init(&urb->lock);
1292 urb->dev = dev; 1334 urb->dev = dev;
1293 urb->pipe = pipe; 1335 urb->pipe = pipe;
1294 urb->transfer_buffer = transfer_buffer; 1336 urb->transfer_buffer = transfer_buffer;
@@ -1324,7 +1366,6 @@ static inline void usb_fill_int_urb (struct urb *urb,
1324 void *context, 1366 void *context,
1325 int interval) 1367 int interval)
1326{ 1368{
1327 spin_lock_init(&urb->lock);
1328 urb->dev = dev; 1369 urb->dev = dev;
1329 urb->pipe = pipe; 1370 urb->pipe = pipe;
1330 urb->transfer_buffer = transfer_buffer; 1371 urb->transfer_buffer = transfer_buffer;
@@ -1352,6 +1393,30 @@ extern void usb_unanchor_urb(struct urb *urb);
1352extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, 1393extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor,
1353 unsigned int timeout); 1394 unsigned int timeout);
1354 1395
1396/**
1397 * usb_urb_dir_in - check if an URB describes an IN transfer
1398 * @urb: URB to be checked
1399 *
1400 * Returns 1 if @urb describes an IN transfer (device-to-host),
1401 * otherwise 0.
1402 */
1403static inline int usb_urb_dir_in(struct urb *urb)
1404{
1405 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_IN;
1406}
1407
1408/**
1409 * usb_urb_dir_out - check if an URB describes an OUT transfer
1410 * @urb: URB to be checked
1411 *
1412 * Returns 1 if @urb describes an OUT transfer (host-to-device),
1413 * otherwise 0.
1414 */
1415static inline int usb_urb_dir_out(struct urb *urb)
1416{
1417 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT;
1418}
1419
1355void *usb_buffer_alloc (struct usb_device *dev, size_t size, 1420void *usb_buffer_alloc (struct usb_device *dev, size_t size,
1356 gfp_t mem_flags, dma_addr_t *dma); 1421 gfp_t mem_flags, dma_addr_t *dma);
1357void usb_buffer_free (struct usb_device *dev, size_t size, 1422void usb_buffer_free (struct usb_device *dev, size_t size,
@@ -1364,13 +1429,13 @@ void usb_buffer_unmap (struct urb *urb);
1364#endif 1429#endif
1365 1430
1366struct scatterlist; 1431struct scatterlist;
1367int usb_buffer_map_sg(const struct usb_device *dev, unsigned pipe, 1432int usb_buffer_map_sg(const struct usb_device *dev, int is_in,
1368 struct scatterlist *sg, int nents); 1433 struct scatterlist *sg, int nents);
1369#if 0 1434#if 0
1370void usb_buffer_dmasync_sg(const struct usb_device *dev, unsigned pipe, 1435void usb_buffer_dmasync_sg(const struct usb_device *dev, int is_in,
1371 struct scatterlist *sg, int n_hw_ents); 1436 struct scatterlist *sg, int n_hw_ents);
1372#endif 1437#endif
1373void usb_buffer_unmap_sg(const struct usb_device *dev, unsigned pipe, 1438void usb_buffer_unmap_sg(const struct usb_device *dev, int is_in,
1374 struct scatterlist *sg, int n_hw_ents); 1439 struct scatterlist *sg, int n_hw_ents);
1375 1440
1376/*-------------------------------------------------------------------* 1441/*-------------------------------------------------------------------*
diff --git a/include/linux/usb_gadget.h b/include/linux/usb/gadget.h
index 4f59b2aa8a9e..46705e91573d 100644
--- a/include/linux/usb_gadget.h
+++ b/include/linux/usb/gadget.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * <linux/usb_gadget.h> 2 * <linux/usb/gadget.h>
3 * 3 *
4 * We call the USB code inside a Linux-based peripheral device a "gadget" 4 * We call the USB code inside a Linux-based peripheral device a "gadget"
5 * driver, except for the hardware-specific bus glue. One USB host can 5 * driver, except for the hardware-specific bus glue. One USB host can
@@ -22,10 +22,10 @@ struct usb_ep;
22/** 22/**
23 * struct usb_request - describes one i/o request 23 * struct usb_request - describes one i/o request
24 * @buf: Buffer used for data. Always provide this; some controllers 24 * @buf: Buffer used for data. Always provide this; some controllers
25 * only use PIO, or don't use DMA for some endpoints. 25 * only use PIO, or don't use DMA for some endpoints.
26 * @dma: DMA address corresponding to 'buf'. If you don't set this 26 * @dma: DMA address corresponding to 'buf'. If you don't set this
27 * field, and the usb controller needs one, it is responsible 27 * field, and the usb controller needs one, it is responsible
28 * for mapping and unmapping the buffer. 28 * for mapping and unmapping the buffer.
29 * @length: Length of that data 29 * @length: Length of that data
30 * @no_interrupt: If true, hints that no completion irq is needed. 30 * @no_interrupt: If true, hints that no completion irq is needed.
31 * Helpful sometimes with deep request queues that are handled 31 * Helpful sometimes with deep request queues that are handled
@@ -45,16 +45,16 @@ struct usb_ep;
45 * @context: For use by the completion callback 45 * @context: For use by the completion callback
46 * @list: For use by the gadget driver. 46 * @list: For use by the gadget driver.
47 * @status: Reports completion code, zero or a negative errno. 47 * @status: Reports completion code, zero or a negative errno.
48 * Normally, faults block the transfer queue from advancing until 48 * Normally, faults block the transfer queue from advancing until
49 * the completion callback returns. 49 * the completion callback returns.
50 * Code "-ESHUTDOWN" indicates completion caused by device disconnect, 50 * Code "-ESHUTDOWN" indicates completion caused by device disconnect,
51 * or when the driver disabled the endpoint. 51 * or when the driver disabled the endpoint.
52 * @actual: Reports bytes transferred to/from the buffer. For reads (OUT 52 * @actual: Reports bytes transferred to/from the buffer. For reads (OUT
53 * transfers) this may be less than the requested length. If the 53 * transfers) this may be less than the requested length. If the
54 * short_not_ok flag is set, short reads are treated as errors 54 * short_not_ok flag is set, short reads are treated as errors
55 * even when status otherwise indicates successful completion. 55 * even when status otherwise indicates successful completion.
56 * Note that for writes (IN transfers) some data bytes may still 56 * Note that for writes (IN transfers) some data bytes may still
57 * reside in a device-side FIFO when the request is reported as 57 * reside in a device-side FIFO when the request is reported as
58 * complete. 58 * complete.
59 * 59 *
60 * These are allocated/freed through the endpoint they're used with. The 60 * These are allocated/freed through the endpoint they're used with. The
@@ -128,7 +128,7 @@ struct usb_ep_ops {
128 * value can sometimes be reduced (hardware allowing), according to 128 * value can sometimes be reduced (hardware allowing), according to
129 * the endpoint descriptor used to configure the endpoint. 129 * the endpoint descriptor used to configure the endpoint.
130 * @driver_data:for use by the gadget driver. all other fields are 130 * @driver_data:for use by the gadget driver. all other fields are
131 * read-only to gadget drivers. 131 * read-only to gadget drivers.
132 * 132 *
133 * the bus controller driver lists all the general purpose endpoints in 133 * the bus controller driver lists all the general purpose endpoints in
134 * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list, 134 * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list,
@@ -148,10 +148,10 @@ struct usb_ep {
148/** 148/**
149 * usb_ep_enable - configure endpoint, making it usable 149 * usb_ep_enable - configure endpoint, making it usable
150 * @ep:the endpoint being configured. may not be the endpoint named "ep0". 150 * @ep:the endpoint being configured. may not be the endpoint named "ep0".
151 * drivers discover endpoints through the ep_list of a usb_gadget. 151 * drivers discover endpoints through the ep_list of a usb_gadget.
152 * @desc:descriptor for desired behavior. caller guarantees this pointer 152 * @desc:descriptor for desired behavior. caller guarantees this pointer
153 * remains valid until the endpoint is disabled; the data byte order 153 * remains valid until the endpoint is disabled; the data byte order
154 * is little-endian (usb-standard). 154 * is little-endian (usb-standard).
155 * 155 *
156 * when configurations are set, or when interface settings change, the driver 156 * when configurations are set, or when interface settings change, the driver
157 * will enable or disable the relevant endpoints. while it is enabled, an 157 * will enable or disable the relevant endpoints. while it is enabled, an
@@ -232,7 +232,7 @@ usb_ep_free_request (struct usb_ep *ep, struct usb_request *req)
232 * @ep:the endpoint associated with the request 232 * @ep:the endpoint associated with the request
233 * @req:the request being submitted 233 * @req:the request being submitted
234 * @gfp_flags: GFP_* flags to use in case the lower level driver couldn't 234 * @gfp_flags: GFP_* flags to use in case the lower level driver couldn't
235 * pre-allocate all necessary memory with the request. 235 * pre-allocate all necessary memory with the request.
236 * 236 *
237 * This tells the device controller to perform the specified request through 237 * This tells the device controller to perform the specified request through
238 * that endpoint (reading or writing a buffer). When the request completes, 238 * that endpoint (reading or writing a buffer). When the request completes,
@@ -415,7 +415,7 @@ struct usb_gadget_ops {
415 * struct usb_gadget - represents a usb slave device 415 * struct usb_gadget - represents a usb slave device
416 * @ops: Function pointers used to access hardware-specific operations. 416 * @ops: Function pointers used to access hardware-specific operations.
417 * @ep0: Endpoint zero, used when reading or writing responses to 417 * @ep0: Endpoint zero, used when reading or writing responses to
418 * driver setup() requests 418 * driver setup() requests
419 * @ep_list: List of other endpoints supported by the device. 419 * @ep_list: List of other endpoints supported by the device.
420 * @speed: Speed of current connection to USB host. 420 * @speed: Speed of current connection to USB host.
421 * @is_dualspeed: True if the controller supports both high and full speed 421 * @is_dualspeed: True if the controller supports both high and full speed
@@ -432,7 +432,7 @@ struct usb_gadget_ops {
432 * @b_hnp_enable: OTG device feature flag, indicating that the A-Host 432 * @b_hnp_enable: OTG device feature flag, indicating that the A-Host
433 * enabled HNP support. 433 * enabled HNP support.
434 * @name: Identifies the controller hardware type. Used in diagnostics 434 * @name: Identifies the controller hardware type. Used in diagnostics
435 * and sometimes configuration. 435 * and sometimes configuration.
436 * @dev: Driver model state for this abstract device. 436 * @dev: Driver model state for this abstract device.
437 * 437 *
438 * Gadgets have a mostly-portable "gadget driver" implementing device 438 * Gadgets have a mostly-portable "gadget driver" implementing device
@@ -480,6 +480,39 @@ static inline void *get_gadget_data (struct usb_gadget *gadget)
480 480
481 481
482/** 482/**
483 * gadget_is_dualspeed - return true iff the hardware handles high speed
484 * @gadget: controller that might support both high and full speeds
485 */
486static inline int gadget_is_dualspeed(struct usb_gadget *g)
487{
488#ifdef CONFIG_USB_GADGET_DUALSPEED
489 /* runtime test would check "g->is_dualspeed" ... that might be
490 * useful to work around hardware bugs, but is mostly pointless
491 */
492 return 1;
493#else
494 return 0;
495#endif
496}
497
498/**
499 * gadget_is_otg - return true iff the hardware is OTG-ready
500 * @gadget: controller that might have a Mini-AB connector
501 *
502 * This is a runtime test, since kernels with a USB-OTG stack sometimes
503 * run on boards which only have a Mini-B (or Mini-A) connector.
504 */
505static inline int gadget_is_otg(struct usb_gadget *g)
506{
507#ifdef CONFIG_USB_OTG
508 return g->is_otg;
509#else
510 return 0;
511#endif
512}
513
514
515/**
483 * usb_gadget_frame_number - returns the current frame number 516 * usb_gadget_frame_number - returns the current frame number
484 * @gadget: controller that reports the frame number 517 * @gadget: controller that reports the frame number
485 * 518 *
@@ -655,23 +688,23 @@ usb_gadget_disconnect (struct usb_gadget *gadget)
655 * @function: String describing the gadget's function 688 * @function: String describing the gadget's function
656 * @speed: Highest speed the driver handles. 689 * @speed: Highest speed the driver handles.
657 * @bind: Invoked when the driver is bound to a gadget, usually 690 * @bind: Invoked when the driver is bound to a gadget, usually
658 * after registering the driver. 691 * after registering the driver.
659 * At that point, ep0 is fully initialized, and ep_list holds 692 * At that point, ep0 is fully initialized, and ep_list holds
660 * the currently-available endpoints. 693 * the currently-available endpoints.
661 * Called in a context that permits sleeping. 694 * Called in a context that permits sleeping.
662 * @setup: Invoked for ep0 control requests that aren't handled by 695 * @setup: Invoked for ep0 control requests that aren't handled by
663 * the hardware level driver. Most calls must be handled by 696 * the hardware level driver. Most calls must be handled by
664 * the gadget driver, including descriptor and configuration 697 * the gadget driver, including descriptor and configuration
665 * management. The 16 bit members of the setup data are in 698 * management. The 16 bit members of the setup data are in
666 * USB byte order. Called in_interrupt; this may not sleep. Driver 699 * USB byte order. Called in_interrupt; this may not sleep. Driver
667 * queues a response to ep0, or returns negative to stall. 700 * queues a response to ep0, or returns negative to stall.
668 * @disconnect: Invoked after all transfers have been stopped, 701 * @disconnect: Invoked after all transfers have been stopped,
669 * when the host is disconnected. May be called in_interrupt; this 702 * when the host is disconnected. May be called in_interrupt; this
670 * may not sleep. Some devices can't detect disconnect, so this might 703 * may not sleep. Some devices can't detect disconnect, so this might
671 * not be called except as part of controller shutdown. 704 * not be called except as part of controller shutdown.
672 * @unbind: Invoked when the driver is unbound from a gadget, 705 * @unbind: Invoked when the driver is unbound from a gadget,
673 * usually from rmmod (after a disconnect is reported). 706 * usually from rmmod (after a disconnect is reported).
674 * Called in a context that permits sleeping. 707 * Called in a context that permits sleeping.
675 * @suspend: Invoked on USB suspend. May be called in_interrupt. 708 * @suspend: Invoked on USB suspend. May be called in_interrupt.
676 * @resume: Invoked on USB resume. May be called in_interrupt. 709 * @resume: Invoked on USB resume. May be called in_interrupt.
677 * @driver: Driver model state for this driver. 710 * @driver: Driver model state for this driver.
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 8da374caf582..2692ec9389ca 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -4,11 +4,8 @@
4 * belong here. 4 * belong here.
5 */ 5 */
6 6
7/* device must not be autosuspended */
8#define USB_QUIRK_NO_AUTOSUSPEND 0x00000001
9
10/* string descriptors must not be fetched using a 255-byte read */ 7/* string descriptors must not be fetched using a 255-byte read */
11#define USB_QUIRK_STRING_FETCH_255 0x00000002 8#define USB_QUIRK_STRING_FETCH_255 0x00000001
12 9
13/* device can't resume correctly so reset it instead */ 10/* device can't resume correctly so reset it instead */
14#define USB_QUIRK_RESET_RESUME 0x00000004 11#define USB_QUIRK_RESET_RESUME 0x00000002
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index e8b8928232c8..488ce128885c 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -141,7 +141,7 @@ struct usb_serial {
141}; 141};
142#define to_usb_serial(d) container_of(d, struct usb_serial, kref) 142#define to_usb_serial(d) container_of(d, struct usb_serial, kref)
143 143
144#define NUM_DONT_CARE (-1) 144#define NUM_DONT_CARE 99
145 145
146/* get and set the serial private data pointer helper functions */ 146/* get and set the serial private data pointer helper functions */
147static inline void *usb_get_serial_data (struct usb_serial *serial) 147static inline void *usb_get_serial_data (struct usb_serial *serial)
@@ -160,12 +160,18 @@ static inline void usb_set_serial_data (struct usb_serial *serial, void *data)
160 * in the syslog messages when a device is inserted or removed. 160 * in the syslog messages when a device is inserted or removed.
161 * @id_table: pointer to a list of usb_device_id structures that define all 161 * @id_table: pointer to a list of usb_device_id structures that define all
162 * of the devices this structure can support. 162 * of the devices this structure can support.
163 * @num_interrupt_in: the number of interrupt in endpoints this device will 163 * @num_interrupt_in: If a device doesn't have this many interrupt-in
164 * have. 164 * endpoints, it won't be sent to the driver's attach() method.
165 * @num_interrupt_out: the number of interrupt out endpoints this device will 165 * (But it might still be sent to the probe() method.)
166 * have. 166 * @num_interrupt_out: If a device doesn't have this many interrupt-out
167 * @num_bulk_in: the number of bulk in endpoints this device will have. 167 * endpoints, it won't be sent to the driver's attach() method.
168 * @num_bulk_out: the number of bulk out endpoints this device will have. 168 * (But it might still be sent to the probe() method.)
169 * @num_bulk_in: If a device doesn't have this many bulk-in
170 * endpoints, it won't be sent to the driver's attach() method.
171 * (But it might still be sent to the probe() method.)
172 * @num_bulk_out: If a device doesn't have this many bulk-out
173 * endpoints, it won't be sent to the driver's attach() method.
174 * (But it might still be sent to the probe() method.)
169 * @num_ports: the number of different ports this device will have. 175 * @num_ports: the number of different ports this device will have.
170 * @calc_num_ports: pointer to a function to determine how many ports this 176 * @calc_num_ports: pointer to a function to determine how many ports this
171 * device has dynamically. It will be called after the probe() 177 * device has dynamically. It will be called after the probe()
diff --git a/include/linux/usb_sl811.h b/include/linux/usb_sl811.h
deleted file mode 100644
index 4f2d012d7309..000000000000
--- a/include/linux/usb_sl811.h
+++ /dev/null
@@ -1,26 +0,0 @@
1
2/*
3 * board initialization should put one of these into dev->platform_data
4 * and place the sl811hs onto platform_bus named "sl811-hcd".
5 */
6
7struct sl811_platform_data {
8 unsigned can_wakeup:1;
9
10 /* given port_power, msec/2 after power on till power good */
11 u8 potpg;
12
13 /* mA/2 power supplied on this port (max = default = 250) */
14 u8 power;
15
16 /* sl811 relies on an external source of VBUS current */
17 void (*port_power)(struct device *dev, int is_on);
18
19 /* pulse sl811 nRST (probably with a GPIO) */
20 void (*reset)(struct device *dev);
21
22 // some boards need something like these:
23 // int (*check_overcurrent)(struct device *dev);
24 // void (*clock_enable)(struct device *dev, int is_on);
25};
26
diff --git a/include/linux/video_output.h b/include/linux/video_output.h
index e63e0c03ee0d..2fb46bc9340d 100644
--- a/include/linux/video_output.h
+++ b/include/linux/video_output.h
@@ -31,9 +31,9 @@ struct output_properties {
31struct output_device { 31struct output_device {
32 int request_state; 32 int request_state;
33 struct output_properties *props; 33 struct output_properties *props;
34 struct class_device class_dev; 34 struct device dev;
35}; 35};
36#define to_output_device(obj) container_of(obj, struct output_device, class_dev) 36#define to_output_device(obj) container_of(obj, struct output_device, dev)
37struct output_device *video_output_register(const char *name, 37struct output_device *video_output_register(const char *name,
38 struct device *dev, 38 struct device *dev,
39 void *devdata, 39 void *devdata,
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index c7c3337c3a88..d1321a81c9c4 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -62,8 +62,6 @@ struct writeback_control {
62 unsigned for_reclaim:1; /* Invoked from the page allocator */ 62 unsigned for_reclaim:1; /* Invoked from the page allocator */
63 unsigned for_writepages:1; /* This is a writepages() call */ 63 unsigned for_writepages:1; /* This is a writepages() call */
64 unsigned range_cyclic:1; /* range_start is cyclic */ 64 unsigned range_cyclic:1; /* range_start is cyclic */
65
66 void *fs_private; /* For use by ->writepages() */
67}; 65};
68 66
69/* 67/*
diff --git a/include/media/videobuf-core.h b/include/media/videobuf-core.h
index 9fa09fb800a1..0fa5d5912555 100644
--- a/include/media/videobuf-core.h
+++ b/include/media/videobuf-core.h
@@ -133,7 +133,7 @@ struct videobuf_qtype_ops {
133 enum v4l2_memory memory); 133 enum v4l2_memory memory);
134 int (*sync) (struct videobuf_queue* q, 134 int (*sync) (struct videobuf_queue* q,
135 struct videobuf_buffer *buf); 135 struct videobuf_buffer *buf);
136 int (*copy_to_user) (struct videobuf_queue *q, 136 int (*video_copy_to_user)(struct videobuf_queue *q,
137 char __user *data, 137 char __user *data,
138 size_t count, 138 size_t count,
139 int nonblocking); 139 int nonblocking);
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
new file mode 100644
index 000000000000..911c2cd02941
--- /dev/null
+++ b/include/net/inet_frag.h
@@ -0,0 +1,60 @@
1#ifndef __NET_FRAG_H__
2#define __NET_FRAG_H__
3
4struct inet_frag_queue {
5 struct hlist_node list;
6 struct list_head lru_list; /* lru list member */
7 spinlock_t lock;
8 atomic_t refcnt;
9 struct timer_list timer; /* when will this queue expire? */
10 struct sk_buff *fragments; /* list of received fragments */
11 ktime_t stamp;
12 int len; /* total length of orig datagram */
13 int meat;
14 __u8 last_in; /* first/last segment arrived? */
15
16#define COMPLETE 4
17#define FIRST_IN 2
18#define LAST_IN 1
19};
20
21#define INETFRAGS_HASHSZ 64
22
23struct inet_frags_ctl {
24 int high_thresh;
25 int low_thresh;
26 int timeout;
27 int secret_interval;
28};
29
30struct inet_frags {
31 struct list_head lru_list;
32 struct hlist_head hash[INETFRAGS_HASHSZ];
33 rwlock_t lock;
34 u32 rnd;
35 int nqueues;
36 int qsize;
37 atomic_t mem;
38 struct timer_list secret_timer;
39 struct inet_frags_ctl *ctl;
40
41 unsigned int (*hashfn)(struct inet_frag_queue *);
42 void (*destructor)(struct inet_frag_queue *);
43 void (*skb_free)(struct sk_buff *);
44};
45
46void inet_frags_init(struct inet_frags *);
47void inet_frags_fini(struct inet_frags *);
48
49void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f);
50void inet_frag_destroy(struct inet_frag_queue *q,
51 struct inet_frags *f, int *work);
52int inet_frag_evictor(struct inet_frags *f);
53
54static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f)
55{
56 if (atomic_dec_and_test(&q->refcnt))
57 inet_frag_destroy(q, f, NULL);
58}
59
60#endif
diff --git a/include/net/ip.h b/include/net/ip.h
index 3af3ed9d320b..840dd91b513b 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -160,6 +160,7 @@ DECLARE_SNMP_STAT(struct ipstats_mib, ip_statistics);
160#define IP_INC_STATS(field) SNMP_INC_STATS(ip_statistics, field) 160#define IP_INC_STATS(field) SNMP_INC_STATS(ip_statistics, field)
161#define IP_INC_STATS_BH(field) SNMP_INC_STATS_BH(ip_statistics, field) 161#define IP_INC_STATS_BH(field) SNMP_INC_STATS_BH(ip_statistics, field)
162#define IP_INC_STATS_USER(field) SNMP_INC_STATS_USER(ip_statistics, field) 162#define IP_INC_STATS_USER(field) SNMP_INC_STATS_USER(ip_statistics, field)
163#define IP_ADD_STATS_BH(field, val) SNMP_ADD_STATS_BH(ip_statistics, field, val)
163DECLARE_SNMP_STAT(struct linux_mib, net_statistics); 164DECLARE_SNMP_STAT(struct linux_mib, net_statistics);
164#define NET_INC_STATS(field) SNMP_INC_STATS(net_statistics, field) 165#define NET_INC_STATS(field) SNMP_INC_STATS(net_statistics, field)
165#define NET_INC_STATS_BH(field) SNMP_INC_STATS_BH(net_statistics, field) 166#define NET_INC_STATS_BH(field) SNMP_INC_STATS_BH(net_statistics, field)
@@ -177,10 +178,8 @@ extern int sysctl_ip_default_ttl;
177extern int sysctl_ip_nonlocal_bind; 178extern int sysctl_ip_nonlocal_bind;
178 179
179/* From ip_fragment.c */ 180/* From ip_fragment.c */
180extern int sysctl_ipfrag_high_thresh; 181struct inet_frags_ctl;
181extern int sysctl_ipfrag_low_thresh; 182extern struct inet_frags_ctl ip4_frags_ctl;
182extern int sysctl_ipfrag_time;
183extern int sysctl_ipfrag_secret_interval;
184extern int sysctl_ipfrag_max_dist; 183extern int sysctl_ipfrag_max_dist;
185 184
186/* From inetpeer.c */ 185/* From inetpeer.c */
@@ -332,9 +331,9 @@ enum ip_defrag_users
332 IP_DEFRAG_VS_FWD 331 IP_DEFRAG_VS_FWD
333}; 332};
334 333
335struct sk_buff *ip_defrag(struct sk_buff *skb, u32 user); 334int ip_defrag(struct sk_buff *skb, u32 user);
336extern int ip_frag_nqueues; 335int ip_frag_mem(void);
337extern atomic_t ip_frag_mem; 336int ip_frag_nqueues(void);
338 337
339/* 338/*
340 * Functions provided by ip_forward.c 339 * Functions provided by ip_forward.c
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 672564e5a81d..41870564df8e 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -464,10 +464,10 @@ struct ip_vs_protocol {
464 unsigned int proto_off, 464 unsigned int proto_off,
465 int inverse); 465 int inverse);
466 466
467 int (*snat_handler)(struct sk_buff **pskb, 467 int (*snat_handler)(struct sk_buff *skb,
468 struct ip_vs_protocol *pp, struct ip_vs_conn *cp); 468 struct ip_vs_protocol *pp, struct ip_vs_conn *cp);
469 469
470 int (*dnat_handler)(struct sk_buff **pskb, 470 int (*dnat_handler)(struct sk_buff *skb,
471 struct ip_vs_protocol *pp, struct ip_vs_conn *cp); 471 struct ip_vs_protocol *pp, struct ip_vs_conn *cp);
472 472
473 int (*csum_check)(struct sk_buff *skb, struct ip_vs_protocol *pp); 473 int (*csum_check)(struct sk_buff *skb, struct ip_vs_protocol *pp);
@@ -654,11 +654,11 @@ struct ip_vs_app
654 654
655 /* output hook: return false if can't linearize. diff set for TCP. */ 655 /* output hook: return false if can't linearize. diff set for TCP. */
656 int (*pkt_out)(struct ip_vs_app *, struct ip_vs_conn *, 656 int (*pkt_out)(struct ip_vs_app *, struct ip_vs_conn *,
657 struct sk_buff **, int *diff); 657 struct sk_buff *, int *diff);
658 658
659 /* input hook: return false if can't linearize. diff set for TCP. */ 659 /* input hook: return false if can't linearize. diff set for TCP. */
660 int (*pkt_in)(struct ip_vs_app *, struct ip_vs_conn *, 660 int (*pkt_in)(struct ip_vs_app *, struct ip_vs_conn *,
661 struct sk_buff **, int *diff); 661 struct sk_buff *, int *diff);
662 662
663 /* ip_vs_app initializer */ 663 /* ip_vs_app initializer */
664 int (*init_conn)(struct ip_vs_app *, struct ip_vs_conn *); 664 int (*init_conn)(struct ip_vs_app *, struct ip_vs_conn *);
@@ -832,8 +832,8 @@ register_ip_vs_app_inc(struct ip_vs_app *app, __u16 proto, __u16 port);
832extern int ip_vs_app_inc_get(struct ip_vs_app *inc); 832extern int ip_vs_app_inc_get(struct ip_vs_app *inc);
833extern void ip_vs_app_inc_put(struct ip_vs_app *inc); 833extern void ip_vs_app_inc_put(struct ip_vs_app *inc);
834 834
835extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff **pskb); 835extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb);
836extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff **pskb); 836extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb);
837extern int ip_vs_skb_replace(struct sk_buff *skb, gfp_t pri, 837extern int ip_vs_skb_replace(struct sk_buff *skb, gfp_t pri,
838 char *o_buf, int o_len, char *n_buf, int n_len); 838 char *o_buf, int o_len, char *n_buf, int n_len);
839extern int ip_vs_app_init(void); 839extern int ip_vs_app_init(void);
@@ -984,7 +984,6 @@ static inline char ip_vs_fwd_tag(struct ip_vs_conn *cp)
984 return fwd; 984 return fwd;
985} 985}
986 986
987extern int ip_vs_make_skb_writable(struct sk_buff **pskb, int len);
988extern void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp, 987extern void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp,
989 struct ip_vs_conn *cp, int dir); 988 struct ip_vs_conn *cp, int dir);
990 989
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 31b3f1b45a2b..cc796cbc1b26 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -120,12 +120,21 @@ extern int sysctl_mld_max_msf;
120 SNMP_INC_STATS##modifier(statname##_statistics, (field)); \ 120 SNMP_INC_STATS##modifier(statname##_statistics, (field)); \
121}) 121})
122 122
123#define _DEVADD(statname, modifier, idev, field, val) \
124({ \
125 struct inet6_dev *_idev = (idev); \
126 if (likely(_idev != NULL)) \
127 SNMP_ADD_STATS##modifier((_idev)->stats.statname, (field), (val)); \
128 SNMP_ADD_STATS##modifier(statname##_statistics, (field), (val));\
129})
130
123/* MIBs */ 131/* MIBs */
124DECLARE_SNMP_STAT(struct ipstats_mib, ipv6_statistics); 132DECLARE_SNMP_STAT(struct ipstats_mib, ipv6_statistics);
125 133
126#define IP6_INC_STATS(idev,field) _DEVINC(ipv6, , idev, field) 134#define IP6_INC_STATS(idev,field) _DEVINC(ipv6, , idev, field)
127#define IP6_INC_STATS_BH(idev,field) _DEVINC(ipv6, _BH, idev, field) 135#define IP6_INC_STATS_BH(idev,field) _DEVINC(ipv6, _BH, idev, field)
128#define IP6_INC_STATS_USER(idev,field) _DEVINC(ipv6, _USER, idev, field) 136#define IP6_INC_STATS_USER(idev,field) _DEVINC(ipv6, _USER, idev, field)
137#define IP6_ADD_STATS_BH(idev,field,val) _DEVADD(ipv6, _BH, idev, field, val)
129 138
130DECLARE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics); 139DECLARE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics);
131DECLARE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics); 140DECLARE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics);
@@ -240,7 +249,7 @@ extern int ip6_ra_control(struct sock *sk, int sel,
240 void (*destructor)(struct sock *)); 249 void (*destructor)(struct sock *));
241 250
242 251
243extern int ipv6_parse_hopopts(struct sk_buff **skbp); 252extern int ipv6_parse_hopopts(struct sk_buff *skb);
244 253
245extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt); 254extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt);
246extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt, 255extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt,
@@ -252,8 +261,8 @@ struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
252 261
253extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb); 262extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb);
254 263
255extern int ip6_frag_nqueues; 264int ip6_frag_nqueues(void);
256extern atomic_t ip6_frag_mem; 265int ip6_frag_mem(void);
257 266
258#define IPV6_FRAG_TIMEOUT (60*HZ) /* 60 seconds */ 267#define IPV6_FRAG_TIMEOUT (60*HZ) /* 60 seconds */
259 268
@@ -565,10 +574,8 @@ extern int inet6_hash_connect(struct inet_timewait_death_row *death_row,
565/* 574/*
566 * reassembly.c 575 * reassembly.c
567 */ 576 */
568extern int sysctl_ip6frag_high_thresh; 577struct inet_frags_ctl;
569extern int sysctl_ip6frag_low_thresh; 578extern struct inet_frags_ctl ip6_frags_ctl;
570extern int sysctl_ip6frag_time;
571extern int sysctl_ip6frag_secret_interval;
572 579
573extern const struct proto_ops inet6_stream_ops; 580extern const struct proto_ops inet6_stream_ops;
574extern const struct proto_ops inet6_dgram_ops; 581extern const struct proto_ops inet6_dgram_ops;
diff --git a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
index 070d12cb4634..f703533fb4db 100644
--- a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
+++ b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
@@ -15,8 +15,7 @@ extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb,
15 struct net_device *out, 15 struct net_device *out,
16 int (*okfn)(struct sk_buff *)); 16 int (*okfn)(struct sk_buff *));
17 17
18extern unsigned int nf_ct_frag6_timeout; 18struct inet_frags_ctl;
19extern unsigned int nf_ct_frag6_low_thresh; 19extern struct inet_frags_ctl nf_frags_ctl;
20extern unsigned int nf_ct_frag6_high_thresh;
21 20
22#endif /* _NF_CONNTRACK_IPV6_H*/ 21#endif /* _NF_CONNTRACK_IPV6_H*/
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index 4056f5f08da1..a532e7b5ed6a 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -22,7 +22,7 @@
22 of connection tracking. */ 22 of connection tracking. */
23extern unsigned int nf_conntrack_in(int pf, 23extern unsigned int nf_conntrack_in(int pf,
24 unsigned int hooknum, 24 unsigned int hooknum,
25 struct sk_buff **pskb); 25 struct sk_buff *skb);
26 26
27extern int nf_conntrack_init(void); 27extern int nf_conntrack_init(void);
28extern void nf_conntrack_cleanup(void); 28extern void nf_conntrack_cleanup(void);
@@ -60,17 +60,17 @@ nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
60extern struct nf_conntrack_tuple_hash * 60extern struct nf_conntrack_tuple_hash *
61nf_conntrack_find_get(const struct nf_conntrack_tuple *tuple); 61nf_conntrack_find_get(const struct nf_conntrack_tuple *tuple);
62 62
63extern int __nf_conntrack_confirm(struct sk_buff **pskb); 63extern int __nf_conntrack_confirm(struct sk_buff *skb);
64 64
65/* Confirm a connection: returns NF_DROP if packet must be dropped. */ 65/* Confirm a connection: returns NF_DROP if packet must be dropped. */
66static inline int nf_conntrack_confirm(struct sk_buff **pskb) 66static inline int nf_conntrack_confirm(struct sk_buff *skb)
67{ 67{
68 struct nf_conn *ct = (struct nf_conn *)(*pskb)->nfct; 68 struct nf_conn *ct = (struct nf_conn *)skb->nfct;
69 int ret = NF_ACCEPT; 69 int ret = NF_ACCEPT;
70 70
71 if (ct) { 71 if (ct) {
72 if (!nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct)) 72 if (!nf_ct_is_confirmed(ct) && !nf_ct_is_dying(ct))
73 ret = __nf_conntrack_confirm(pskb); 73 ret = __nf_conntrack_confirm(skb);
74 nf_ct_deliver_cached_events(ct); 74 nf_ct_deliver_cached_events(ct);
75 } 75 }
76 return ret; 76 return ret;
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 0dcc4c828ce9..d7b2d5483a71 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -29,7 +29,7 @@ struct nf_conntrack_helper
29 29
30 /* Function to call when data passes; return verdict, or -1 to 30 /* Function to call when data passes; return verdict, or -1 to
31 invalidate. */ 31 invalidate. */
32 int (*help)(struct sk_buff **pskb, 32 int (*help)(struct sk_buff *skb,
33 unsigned int protoff, 33 unsigned int protoff,
34 struct nf_conn *ct, 34 struct nf_conn *ct,
35 enum ip_conntrack_info conntrackinfo); 35 enum ip_conntrack_info conntrackinfo);
diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h
index c3cd127ba4bb..f29eeb9777e0 100644
--- a/include/net/netfilter/nf_nat_core.h
+++ b/include/net/netfilter/nf_nat_core.h
@@ -10,12 +10,12 @@
10extern unsigned int nf_nat_packet(struct nf_conn *ct, 10extern unsigned int nf_nat_packet(struct nf_conn *ct,
11 enum ip_conntrack_info ctinfo, 11 enum ip_conntrack_info ctinfo,
12 unsigned int hooknum, 12 unsigned int hooknum,
13 struct sk_buff **pskb); 13 struct sk_buff *skb);
14 14
15extern int nf_nat_icmp_reply_translation(struct nf_conn *ct, 15extern int nf_nat_icmp_reply_translation(struct nf_conn *ct,
16 enum ip_conntrack_info ctinfo, 16 enum ip_conntrack_info ctinfo,
17 unsigned int hooknum, 17 unsigned int hooknum,
18 struct sk_buff **pskb); 18 struct sk_buff *skb);
19 19
20static inline int nf_nat_initialized(struct nf_conn *ct, 20static inline int nf_nat_initialized(struct nf_conn *ct,
21 enum nf_nat_manip_type manip) 21 enum nf_nat_manip_type manip)
diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h
index ec98ecf95fc8..58dd22687949 100644
--- a/include/net/netfilter/nf_nat_helper.h
+++ b/include/net/netfilter/nf_nat_helper.h
@@ -7,21 +7,21 @@
7struct sk_buff; 7struct sk_buff;
8 8
9/* These return true or false. */ 9/* These return true or false. */
10extern int nf_nat_mangle_tcp_packet(struct sk_buff **skb, 10extern int nf_nat_mangle_tcp_packet(struct sk_buff *skb,
11 struct nf_conn *ct, 11 struct nf_conn *ct,
12 enum ip_conntrack_info ctinfo, 12 enum ip_conntrack_info ctinfo,
13 unsigned int match_offset, 13 unsigned int match_offset,
14 unsigned int match_len, 14 unsigned int match_len,
15 const char *rep_buffer, 15 const char *rep_buffer,
16 unsigned int rep_len); 16 unsigned int rep_len);
17extern int nf_nat_mangle_udp_packet(struct sk_buff **skb, 17extern int nf_nat_mangle_udp_packet(struct sk_buff *skb,
18 struct nf_conn *ct, 18 struct nf_conn *ct,
19 enum ip_conntrack_info ctinfo, 19 enum ip_conntrack_info ctinfo,
20 unsigned int match_offset, 20 unsigned int match_offset,
21 unsigned int match_len, 21 unsigned int match_len,
22 const char *rep_buffer, 22 const char *rep_buffer,
23 unsigned int rep_len); 23 unsigned int rep_len);
24extern int nf_nat_seq_adjust(struct sk_buff **pskb, 24extern int nf_nat_seq_adjust(struct sk_buff *skb,
25 struct nf_conn *ct, 25 struct nf_conn *ct,
26 enum ip_conntrack_info ctinfo); 26 enum ip_conntrack_info ctinfo);
27 27
diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h
index 14c7b2d7263c..04578bfe23e1 100644
--- a/include/net/netfilter/nf_nat_protocol.h
+++ b/include/net/netfilter/nf_nat_protocol.h
@@ -18,7 +18,7 @@ struct nf_nat_protocol
18 18
19 /* Translate a packet to the target according to manip type. 19 /* Translate a packet to the target according to manip type.
20 Return true if succeeded. */ 20 Return true if succeeded. */
21 int (*manip_pkt)(struct sk_buff **pskb, 21 int (*manip_pkt)(struct sk_buff *skb,
22 unsigned int iphdroff, 22 unsigned int iphdroff,
23 const struct nf_conntrack_tuple *tuple, 23 const struct nf_conntrack_tuple *tuple,
24 enum nf_nat_manip_type maniptype); 24 enum nf_nat_manip_type maniptype);
diff --git a/include/net/netfilter/nf_nat_rule.h b/include/net/netfilter/nf_nat_rule.h
index f9743187d57f..75d1825031d7 100644
--- a/include/net/netfilter/nf_nat_rule.h
+++ b/include/net/netfilter/nf_nat_rule.h
@@ -6,7 +6,7 @@
6 6
7extern int nf_nat_rule_init(void) __init; 7extern int nf_nat_rule_init(void) __init;
8extern void nf_nat_rule_cleanup(void); 8extern void nf_nat_rule_cleanup(void);
9extern int nf_nat_rule_find(struct sk_buff **pskb, 9extern int nf_nat_rule_find(struct sk_buff *skb,
10 unsigned int hooknum, 10 unsigned int hooknum,
11 const struct net_device *in, 11 const struct net_device *in,
12 const struct net_device *out, 12 const struct net_device *out,
diff --git a/include/net/protocol.h b/include/net/protocol.h
index 105bf12b0c79..1166ffb4b3ec 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -45,7 +45,7 @@ struct net_protocol {
45#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 45#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
46struct inet6_protocol 46struct inet6_protocol
47{ 47{
48 int (*handler)(struct sk_buff **skb); 48 int (*handler)(struct sk_buff *skb);
49 49
50 void (*err_handler)(struct sk_buff *skb, 50 void (*err_handler)(struct sk_buff *skb,
51 struct inet6_skb_parm *opt, 51 struct inet6_skb_parm *opt,
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 77be396ca633..0e844845f3f4 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1051,7 +1051,7 @@ extern int xfrm4_output(struct sk_buff *skb);
1051extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); 1051extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family);
1052extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); 1052extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family);
1053extern int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi); 1053extern int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi);
1054extern int xfrm6_rcv(struct sk_buff **pskb); 1054extern int xfrm6_rcv(struct sk_buff *skb);
1055extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, 1055extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
1056 xfrm_address_t *saddr, u8 proto); 1056 xfrm_address_t *saddr, u8 proto);
1057extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); 1057extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family);
diff --git a/include/scsi/libsrp.h b/include/scsi/libsrp.h
index d143171896ae..ba615e4c1d7c 100644
--- a/include/scsi/libsrp.h
+++ b/include/scsi/libsrp.h
@@ -59,7 +59,7 @@ extern void srp_target_free(struct srp_target *);
59extern struct iu_entry *srp_iu_get(struct srp_target *); 59extern struct iu_entry *srp_iu_get(struct srp_target *);
60extern void srp_iu_put(struct iu_entry *); 60extern void srp_iu_put(struct iu_entry *);
61 61
62extern int srp_cmd_queue(struct Scsi_Host *, struct srp_cmd *, void *, u64); 62extern int srp_cmd_queue(struct Scsi_Host *, struct srp_cmd *, void *, u64, u64);
63extern int srp_transfer_data(struct scsi_cmnd *, struct srp_cmd *, 63extern int srp_transfer_data(struct scsi_cmnd *, struct srp_cmd *,
64 srp_rdma_t, int, int); 64 srp_rdma_t, int, int);
65 65
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 53e170586c26..65ab5145a09b 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -33,20 +33,17 @@ struct scsi_cmnd {
33 struct list_head list; /* scsi_cmnd participates in queue lists */ 33 struct list_head list; /* scsi_cmnd participates in queue lists */
34 struct list_head eh_entry; /* entry for the host eh_cmd_q */ 34 struct list_head eh_entry; /* entry for the host eh_cmd_q */
35 int eh_eflags; /* Used by error handlr */ 35 int eh_eflags; /* Used by error handlr */
36 void (*done) (struct scsi_cmnd *); /* Mid-level done function */
37 36
38 /* 37 /*
39 * A SCSI Command is assigned a nonzero serial_number before passed 38 * A SCSI Command is assigned a nonzero serial_number before passed
40 * to the driver's queue command function. The serial_number is 39 * to the driver's queue command function. The serial_number is
41 * cleared when scsi_done is entered indicating that the command 40 * cleared when scsi_done is entered indicating that the command
42 * has been completed. It currently doesn't have much use other 41 * has been completed. It is a bug for LLDDs to use this number
43 * than printk's. Some lldd's use this number for other purposes. 42 * for purposes other than printk (and even that is only useful
44 * It's almost certain that such usages are either incorrect or 43 * for debugging).
45 * meaningless. Please kill all usages other than printk's. Also,
46 * as this number is always identical to ->pid, please convert
47 * printk's to use ->pid, so that we can kill this field.
48 */ 44 */
49 unsigned long serial_number; 45 unsigned long serial_number;
46
50 /* 47 /*
51 * This is set to jiffies as it was when the command was first 48 * This is set to jiffies as it was when the command was first
52 * allocated. It is used to time how long the command has 49 * allocated. It is used to time how long the command has
@@ -116,7 +113,6 @@ struct scsi_cmnd {
116 int result; /* Status code from lower level driver */ 113 int result; /* Status code from lower level driver */
117 114
118 unsigned char tag; /* SCSI-II queued command tag */ 115 unsigned char tag; /* SCSI-II queued command tag */
119 unsigned long pid; /* Process ID, starts at 0. Unique per host. */
120}; 116};
121 117
122extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t); 118extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t);
@@ -124,7 +120,6 @@ extern struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *, gfp_t);
124extern void scsi_put_command(struct scsi_cmnd *); 120extern void scsi_put_command(struct scsi_cmnd *);
125extern void __scsi_put_command(struct Scsi_Host *, struct scsi_cmnd *, 121extern void __scsi_put_command(struct Scsi_Host *, struct scsi_cmnd *,
126 struct device *); 122 struct device *);
127extern void scsi_io_completion(struct scsi_cmnd *, unsigned int);
128extern void scsi_finish_command(struct scsi_cmnd *cmd); 123extern void scsi_finish_command(struct scsi_cmnd *cmd);
129extern void scsi_req_abort_cmd(struct scsi_cmnd *cmd); 124extern void scsi_req_abort_cmd(struct scsi_cmnd *cmd);
130 125
diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h
index 5a43a4cd96c6..e89844cc2cd3 100644
--- a/include/scsi/scsi_dbg.h
+++ b/include/scsi/scsi_dbg.h
@@ -9,6 +9,8 @@ extern void __scsi_print_command(unsigned char *);
9extern void scsi_show_extd_sense(unsigned char, unsigned char); 9extern void scsi_show_extd_sense(unsigned char, unsigned char);
10extern void scsi_show_sense_hdr(struct scsi_sense_hdr *); 10extern void scsi_show_sense_hdr(struct scsi_sense_hdr *);
11extern void scsi_print_sense_hdr(const char *, struct scsi_sense_hdr *); 11extern void scsi_print_sense_hdr(const char *, struct scsi_sense_hdr *);
12extern void scsi_cmd_print_sense_hdr(struct scsi_cmnd *, const char *,
13 struct scsi_sense_hdr *);
12extern void scsi_print_sense(char *, struct scsi_cmnd *); 14extern void scsi_print_sense(char *, struct scsi_cmnd *);
13extern void __scsi_print_sense(const char *name, 15extern void __scsi_print_sense(const char *name,
14 const unsigned char *sense_buffer, 16 const unsigned char *sense_buffer,
diff --git a/include/scsi/scsi_driver.h b/include/scsi/scsi_driver.h
index 3465f31a21c4..1f5ca7f62116 100644
--- a/include/scsi/scsi_driver.h
+++ b/include/scsi/scsi_driver.h
@@ -5,14 +5,17 @@
5 5
6struct module; 6struct module;
7struct scsi_cmnd; 7struct scsi_cmnd;
8struct scsi_device;
9struct request;
10struct request_queue;
8 11
9 12
10struct scsi_driver { 13struct scsi_driver {
11 struct module *owner; 14 struct module *owner;
12 struct device_driver gendrv; 15 struct device_driver gendrv;
13 16
14 int (*init_command)(struct scsi_cmnd *);
15 void (*rescan)(struct device *); 17 void (*rescan)(struct device *);
18 int (*done)(struct scsi_cmnd *);
16}; 19};
17#define to_scsi_driver(drv) \ 20#define to_scsi_driver(drv) \
18 container_of((drv), struct scsi_driver, gendrv) 21 container_of((drv), struct scsi_driver, gendrv)
@@ -25,4 +28,9 @@ extern int scsi_register_interface(struct class_interface *);
25#define scsi_unregister_interface(intf) \ 28#define scsi_unregister_interface(intf) \
26 class_interface_unregister(intf) 29 class_interface_unregister(intf)
27 30
31int scsi_setup_blk_pc_cmnd(struct scsi_device *sdev, struct request *req);
32int scsi_setup_fs_cmnd(struct scsi_device *sdev, struct request *req);
33int scsi_prep_state_check(struct scsi_device *sdev, struct request *req);
34int scsi_prep_return(struct request_queue *q, struct request *req, int ret);
35
28#endif /* _SCSI_SCSI_DRIVER_H */ 36#endif /* _SCSI_SCSI_DRIVER_H */
diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
index c5c0f6762a01..44224ba4dd90 100644
--- a/include/scsi/scsi_eh.h
+++ b/include/scsi/scsi_eh.h
@@ -1,7 +1,7 @@
1#ifndef _SCSI_SCSI_EH_H 1#ifndef _SCSI_SCSI_EH_H
2#define _SCSI_SCSI_EH_H 2#define _SCSI_SCSI_EH_H
3 3
4struct scsi_cmnd; 4#include <scsi/scsi_cmnd.h>
5struct scsi_device; 5struct scsi_device;
6struct Scsi_Host; 6struct Scsi_Host;
7 7
@@ -65,4 +65,25 @@ extern int scsi_get_sense_info_fld(const u8 * sense_buffer, int sb_len,
65 65
66extern int scsi_reset_provider(struct scsi_device *, int); 66extern int scsi_reset_provider(struct scsi_device *, int);
67 67
68struct scsi_eh_save {
69 int result;
70 enum dma_data_direction data_direction;
71 unsigned char cmd_len;
72 unsigned char cmnd[MAX_COMMAND_SIZE];
73
74 void *buffer;
75 unsigned bufflen;
76 unsigned short use_sg;
77 int resid;
78
79 struct scatterlist sense_sgl;
80};
81
82extern void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd,
83 struct scsi_eh_save *ses, unsigned char *cmnd,
84 int cmnd_size, unsigned sense_bytes);
85
86extern void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd,
87 struct scsi_eh_save *ses);
88
68#endif /* _SCSI_SCSI_EH_H */ 89#endif /* _SCSI_SCSI_EH_H */
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 3b8a6a85c2f8..7d210cd6c38d 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -32,6 +32,9 @@ struct blk_queue_tags;
32#define SG_NONE 0 32#define SG_NONE 0
33#define SG_ALL 0xff 33#define SG_ALL 0xff
34 34
35#define MODE_UNKNOWN 0x00
36#define MODE_INITIATOR 0x01
37#define MODE_TARGET 0x02
35 38
36#define DISABLE_CLUSTERING 0 39#define DISABLE_CLUSTERING 0
37#define ENABLE_CLUSTERING 1 40#define ENABLE_CLUSTERING 1
@@ -145,9 +148,6 @@ struct scsi_host_template {
145 int (* transfer_response)(struct scsi_cmnd *, 148 int (* transfer_response)(struct scsi_cmnd *,
146 void (*done)(struct scsi_cmnd *)); 149 void (*done)(struct scsi_cmnd *));
147 150
148 /* Used as callback for the completion of task management request. */
149 int (* tsk_mgmt_response)(u64 mid, int result);
150
151 /* 151 /*
152 * This is an error handling strategy routine. You don't need to 152 * This is an error handling strategy routine. You don't need to
153 * define one of these if you don't want to - there is a default 153 * define one of these if you don't want to - there is a default
@@ -408,6 +408,11 @@ struct scsi_host_template {
408 unsigned char present; 408 unsigned char present;
409 409
410 /* 410 /*
411 * This specifies the mode that a LLD supports.
412 */
413 unsigned supported_mode:2;
414
415 /*
411 * true if this host adapter uses unchecked DMA onto an ISA bus. 416 * true if this host adapter uses unchecked DMA onto an ISA bus.
412 */ 417 */
413 unsigned unchecked_isa_dma:1; 418 unsigned unchecked_isa_dma:1;
@@ -575,8 +580,9 @@ struct Scsi_Host {
575 * Used to assign serial numbers to the cmds. 580 * Used to assign serial numbers to the cmds.
576 * Protected by the host lock. 581 * Protected by the host lock.
577 */ 582 */
578 unsigned long cmd_serial_number, cmd_pid; 583 unsigned long cmd_serial_number;
579 584
585 unsigned active_mode:2;
580 unsigned unchecked_isa_dma:1; 586 unsigned unchecked_isa_dma:1;
581 unsigned use_clustering:1; 587 unsigned use_clustering:1;
582 unsigned use_blk_tcq:1; 588 unsigned use_blk_tcq:1;
diff --git a/include/scsi/scsi_tgt.h b/include/scsi/scsi_tgt.h
index 4f4427937af2..d0fefb96158f 100644
--- a/include/scsi/scsi_tgt.h
+++ b/include/scsi/scsi_tgt.h
@@ -11,9 +11,11 @@ struct scsi_lun;
11extern struct Scsi_Host *scsi_tgt_cmd_to_host(struct scsi_cmnd *); 11extern struct Scsi_Host *scsi_tgt_cmd_to_host(struct scsi_cmnd *);
12extern int scsi_tgt_alloc_queue(struct Scsi_Host *); 12extern int scsi_tgt_alloc_queue(struct Scsi_Host *);
13extern void scsi_tgt_free_queue(struct Scsi_Host *); 13extern void scsi_tgt_free_queue(struct Scsi_Host *);
14extern int scsi_tgt_queue_command(struct scsi_cmnd *, struct scsi_lun *, u64); 14extern int scsi_tgt_queue_command(struct scsi_cmnd *, u64, struct scsi_lun *, u64);
15extern int scsi_tgt_tsk_mgmt_request(struct Scsi_Host *, int, u64, struct scsi_lun *, 15extern int scsi_tgt_tsk_mgmt_request(struct Scsi_Host *, u64, int, u64,
16 void *); 16 struct scsi_lun *, void *);
17extern struct scsi_cmnd *scsi_host_get_command(struct Scsi_Host *, 17extern struct scsi_cmnd *scsi_host_get_command(struct Scsi_Host *,
18 enum dma_data_direction, gfp_t); 18 enum dma_data_direction, gfp_t);
19extern void scsi_host_put_command(struct Scsi_Host *, struct scsi_cmnd *); 19extern void scsi_host_put_command(struct Scsi_Host *, struct scsi_cmnd *);
20extern int scsi_tgt_it_nexus_create(struct Scsi_Host *, u64, char *);
21extern int scsi_tgt_it_nexus_destroy(struct Scsi_Host *, u64);
diff --git a/include/scsi/scsi_tgt_if.h b/include/scsi/scsi_tgt_if.h
index 4cf9dff29a2f..f2ee7c238a45 100644
--- a/include/scsi/scsi_tgt_if.h
+++ b/include/scsi/scsi_tgt_if.h
@@ -23,13 +23,15 @@
23#define __SCSI_TARGET_IF_H 23#define __SCSI_TARGET_IF_H
24 24
25/* user -> kernel */ 25/* user -> kernel */
26#define TGT_UEVENT_CMD_RSP 0x0001 26#define TGT_UEVENT_CMD_RSP 0x0001
27#define TGT_UEVENT_TSK_MGMT_RSP 0x0002 27#define TGT_UEVENT_IT_NEXUS_RSP 0x0002
28#define TGT_UEVENT_TSK_MGMT_RSP 0x0003
28 29
29/* kernel -> user */ 30/* kernel -> user */
30#define TGT_KEVENT_CMD_REQ 0x1001 31#define TGT_KEVENT_CMD_REQ 0x1001
31#define TGT_KEVENT_CMD_DONE 0x1002 32#define TGT_KEVENT_CMD_DONE 0x1002
32#define TGT_KEVENT_TSK_MGMT_REQ 0x1003 33#define TGT_KEVENT_IT_NEXUS_REQ 0x1003
34#define TGT_KEVENT_TSK_MGMT_REQ 0x1004
33 35
34struct tgt_event_hdr { 36struct tgt_event_hdr {
35 uint16_t version; 37 uint16_t version;
@@ -46,6 +48,7 @@ struct tgt_event {
46 struct { 48 struct {
47 int host_no; 49 int host_no;
48 int result; 50 int result;
51 aligned_u64 itn_id;
49 aligned_u64 tag; 52 aligned_u64 tag;
50 aligned_u64 uaddr; 53 aligned_u64 uaddr;
51 aligned_u64 sense_uaddr; 54 aligned_u64 sense_uaddr;
@@ -55,15 +58,22 @@ struct tgt_event {
55 } cmd_rsp; 58 } cmd_rsp;
56 struct { 59 struct {
57 int host_no; 60 int host_no;
58 aligned_u64 mid;
59 int result; 61 int result;
62 aligned_u64 itn_id;
63 aligned_u64 mid;
60 } tsk_mgmt_rsp; 64 } tsk_mgmt_rsp;
61 65 struct {
66 __s32 host_no;
67 __s32 result;
68 aligned_u64 itn_id;
69 __u32 function;
70 } it_nexus_rsp;
62 71
63 /* kernel -> user */ 72 /* kernel -> user */
64 struct { 73 struct {
65 int host_no; 74 int host_no;
66 uint32_t data_len; 75 uint32_t data_len;
76 aligned_u64 itn_id;
67 uint8_t scb[16]; 77 uint8_t scb[16];
68 uint8_t lun[8]; 78 uint8_t lun[8];
69 int attribute; 79 int attribute;
@@ -71,16 +81,25 @@ struct tgt_event {
71 } cmd_req; 81 } cmd_req;
72 struct { 82 struct {
73 int host_no; 83 int host_no;
74 aligned_u64 tag;
75 int result; 84 int result;
85 aligned_u64 itn_id;
86 aligned_u64 tag;
76 } cmd_done; 87 } cmd_done;
77 struct { 88 struct {
78 int host_no; 89 int host_no;
79 int function; 90 int function;
91 aligned_u64 itn_id;
80 aligned_u64 tag; 92 aligned_u64 tag;
81 uint8_t lun[8]; 93 uint8_t lun[8];
82 aligned_u64 mid; 94 aligned_u64 mid;
83 } tsk_mgmt_req; 95 } tsk_mgmt_req;
96 struct {
97 __s32 host_no;
98 __u32 function;
99 aligned_u64 itn_id;
100 __u32 max_cmds;
101 __u8 initiator_id[16];
102 } it_nexus_req;
84 } p; 103 } p;
85} __attribute__ ((aligned (sizeof(uint64_t)))); 104} __attribute__ ((aligned (sizeof(uint64_t))));
86 105
diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h
index 3c18baa65a72..0dfef752f0e2 100644
--- a/include/scsi/scsi_transport.h
+++ b/include/scsi/scsi_transport.h
@@ -65,6 +65,18 @@ struct scsi_transport_template {
65 * EH_NOT_HANDLED Begin normal error recovery 65 * EH_NOT_HANDLED Begin normal error recovery
66 */ 66 */
67 enum scsi_eh_timer_return (* eh_timed_out)(struct scsi_cmnd *); 67 enum scsi_eh_timer_return (* eh_timed_out)(struct scsi_cmnd *);
68
69 /*
70 * Used as callback for the completion of i_t_nexus request
71 * for target drivers.
72 */
73 int (* it_nexus_response)(struct Scsi_Host *, u64, int);
74
75 /*
76 * Used as callback for the completion of task management
77 * request for target drivers.
78 */
79 int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64, int);
68}; 80};
69 81
70#define transport_class_to_shost(tc) \ 82#define transport_class_to_shost(tc) \
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index a0d80bcaa93d..e466d886e192 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -589,6 +589,10 @@ struct fc_function_template {
589 int (*vport_disable)(struct fc_vport *, bool); 589 int (*vport_disable)(struct fc_vport *, bool);
590 int (*vport_delete)(struct fc_vport *); 590 int (*vport_delete)(struct fc_vport *);
591 591
592 /* target-mode drivers' functions */
593 int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64, int);
594 int (* it_nexus_response)(struct Scsi_Host *, u64, int);
595
592 /* allocation lengths for host-specific data */ 596 /* allocation lengths for host-specific data */
593 u32 dd_fcrport_size; 597 u32 dd_fcrport_size;
594 u32 dd_fcvport_size; 598 u32 dd_fcvport_size;
@@ -632,6 +636,8 @@ struct fc_function_template {
632 unsigned long show_host_fabric_name:1; 636 unsigned long show_host_fabric_name:1;
633 unsigned long show_host_symbolic_name:1; 637 unsigned long show_host_symbolic_name:1;
634 unsigned long show_host_system_hostname:1; 638 unsigned long show_host_system_hostname:1;
639
640 unsigned long disable_target_scan:1;
635}; 641};
636 642
637 643
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 706c0cd36c14..7ff6199cbd55 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -24,6 +24,8 @@
24#define SCSI_TRANSPORT_ISCSI_H 24#define SCSI_TRANSPORT_ISCSI_H
25 25
26#include <linux/device.h> 26#include <linux/device.h>
27#include <linux/list.h>
28#include <linux/mutex.h>
27#include <scsi/iscsi_if.h> 29#include <scsi/iscsi_if.h>
28 30
29struct scsi_transport_template; 31struct scsi_transport_template;
diff --git a/include/scsi/scsi_transport_srp.h b/include/scsi/scsi_transport_srp.h
new file mode 100644
index 000000000000..9c60ca1c08c5
--- /dev/null
+++ b/include/scsi/scsi_transport_srp.h
@@ -0,0 +1,39 @@
1#ifndef SCSI_TRANSPORT_SRP_H
2#define SCSI_TRANSPORT_SRP_H
3
4#include <linux/transport_class.h>
5#include <linux/types.h>
6#include <linux/mutex.h>
7
8#define SRP_RPORT_ROLE_INITIATOR 0
9#define SRP_RPORT_ROLE_TARGET 1
10
11struct srp_rport_identifiers {
12 u8 port_id[16];
13 u8 roles;
14};
15
16struct srp_rport {
17 struct device dev;
18
19 u8 port_id[16];
20 u8 roles;
21};
22
23struct srp_function_template {
24 /* for target drivers */
25 int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64, int);
26 int (* it_nexus_response)(struct Scsi_Host *, u64, int);
27};
28
29extern struct scsi_transport_template *
30srp_attach_transport(struct srp_function_template *);
31extern void srp_release_transport(struct scsi_transport_template *);
32
33extern struct srp_rport *srp_rport_add(struct Scsi_Host *,
34 struct srp_rport_identifiers *);
35extern void srp_rport_del(struct srp_rport *);
36
37extern void srp_remove_host(struct Scsi_Host *);
38
39#endif
diff --git a/include/scsi/sd.h b/include/scsi/sd.h
index ce02ad1f5185..f7513313ef0d 100644
--- a/include/scsi/sd.h
+++ b/include/scsi/sd.h
@@ -47,20 +47,6 @@ struct scsi_disk {
47}; 47};
48#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,cdev) 48#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,cdev)
49 49
50static int sd_revalidate_disk(struct gendisk *disk);
51static void sd_rw_intr(struct scsi_cmnd * SCpnt);
52static int sd_probe(struct device *);
53static int sd_remove(struct device *);
54static void sd_shutdown(struct device *dev);
55static int sd_suspend(struct device *dev, pm_message_t state);
56static int sd_resume(struct device *dev);
57static void sd_rescan(struct device *);
58static int sd_init_command(struct scsi_cmnd *);
59static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer);
60static void scsi_disk_release(struct class_device *cdev);
61static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
62static void sd_print_result(struct scsi_disk *, int);
63
64#define sd_printk(prefix, sdsk, fmt, a...) \ 50#define sd_printk(prefix, sdsk, fmt, a...) \
65 (sdsk)->disk ? \ 51 (sdsk)->disk ? \
66 sdev_printk(prefix, (sdsk)->device, "[%s] " fmt, \ 52 sdev_printk(prefix, (sdsk)->device, "[%s] " fmt, \