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/dma.h1
-rw-r--r--include/asm-blackfin/nand.h47
-rw-r--r--include/asm-frv/system.h5
-rw-r--r--include/asm-generic/vmlinux.lds.h3
-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-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/cpufeature_64.h2
-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/processor-flags.h2
-rw-r--r--include/asm-x86/system_32.h19
-rw-r--r--include/asm-x86/system_64.h10
-rw-r--r--include/linux/agpgart.h2
-rw-r--r--include/linux/clockchips.h1
-rw-r--r--include/linux/fs.h6
-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/inet_lro.h8
-rw-r--r--include/linux/input.h2
-rw-r--r--include/linux/jbd.h5
-rw-r--r--include/linux/jffs2.h1
-rw-r--r--include/linux/jiffies.h4
-rw-r--r--include/linux/kernel_stat.h1
-rw-r--r--include/linux/kvm.h128
-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/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_ids.h5
-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.h5
-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/topology.h5
-rw-r--r--include/linux/writeback.h2
-rw-r--r--include/media/videobuf-core.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
128 files changed, 2010 insertions, 685 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/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/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/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-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/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/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/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/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/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/clockchips.h b/include/linux/clockchips.h
index d2ddea926895..c33b0dc28e4d 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.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,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 16421f662a7a..6d760f1ad875 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1302,8 +1302,14 @@ struct file_system_type {
1302 struct module *owner; 1302 struct module *owner;
1303 struct file_system_type * next; 1303 struct file_system_type * next;
1304 struct list_head fs_supers; 1304 struct list_head fs_supers;
1305
1305 struct lock_class_key s_lock_key; 1306 struct lock_class_key s_lock_key;
1306 struct lock_class_key s_umount_key; 1307 struct lock_class_key s_umount_key;
1308
1309 struct lock_class_key i_lock_key;
1310 struct lock_class_key i_mutex_key;
1311 struct lock_class_key i_mutex_dir_key;
1312 struct lock_class_key i_alloc_sem_key;
1307}; 1313};
1308 1314
1309extern int get_sb_bdev(struct file_system_type *fs_type, 1315extern int get_sb_bdev(struct file_system_type *fs_type,
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/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 125e925320fd..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
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 d7a5e034c3a2..e757a74b9d17 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -109,6 +109,10 @@ static inline u64 get_jiffies_64(void)
109 ((long)(a) - (long)(b) >= 0)) 109 ((long)(a) - (long)(b) >= 0))
110#define time_before_eq(a,b) time_after_eq(b,a) 110#define time_before_eq(a,b) time_after_eq(b,a)
111 111
112#define time_in_range(a,b,c) \
113 (time_after_eq(a,b) && \
114 time_before_eq(a,c))
115
112/* Same as above, but does so with platform independent 64bit types. 116/* Same as above, but does so with platform independent 64bit types.
113 * 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
114 * get_jiffies_64() */ 118 * get_jiffies_64() */
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/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/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/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_ids.h b/include/linux/pci_ids.h
index 87439ad94685..2aaf1c16ce98 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1467,6 +1467,8 @@
1467#define PCI_DEVICE_ID_TOSHIBA_TC86C001_MISC 0x0108 1467#define PCI_DEVICE_ID_TOSHIBA_TC86C001_MISC 0x0108
1468#define PCI_DEVICE_ID_TOSHIBA_SPIDER_NET 0x01b3 1468#define PCI_DEVICE_ID_TOSHIBA_SPIDER_NET 0x01b3
1469 1469
1470#define PCI_VENDOR_ID_ATTO 0x117c
1471
1470#define PCI_VENDOR_ID_RICOH 0x1180 1472#define PCI_VENDOR_ID_RICOH 0x1180
1471#define PCI_DEVICE_ID_RICOH_RL5C465 0x0465 1473#define PCI_DEVICE_ID_RICOH_RL5C465 0x0465
1472#define PCI_DEVICE_ID_RICOH_RL5C466 0x0466 1474#define PCI_DEVICE_ID_RICOH_RL5C466 0x0466
@@ -2075,6 +2077,9 @@
2075#define PCI_DEVICE_ID_ARECA_1130 0x1130 2077#define PCI_DEVICE_ID_ARECA_1130 0x1130
2076#define PCI_DEVICE_ID_ARECA_1160 0x1160 2078#define PCI_DEVICE_ID_ARECA_1160 0x1160
2077#define PCI_DEVICE_ID_ARECA_1170 0x1170 2079#define PCI_DEVICE_ID_ARECA_1170 0x1170
2080#define PCI_DEVICE_ID_ARECA_1200 0x1200
2081#define PCI_DEVICE_ID_ARECA_1201 0x1201
2082#define PCI_DEVICE_ID_ARECA_1202 0x1202
2078#define PCI_DEVICE_ID_ARECA_1210 0x1210 2083#define PCI_DEVICE_ID_ARECA_1210 0x1210
2079#define PCI_DEVICE_ID_ARECA_1220 0x1220 2084#define PCI_DEVICE_ID_ARECA_1220 0x1220
2080#define PCI_DEVICE_ID_ARECA_1230 0x1230 2085#define PCI_DEVICE_ID_ARECA_1230 0x1230
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..8101e8b0d7ba 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1781,6 +1781,11 @@ static inline int skb_is_gso(const struct sk_buff *skb)
1781 return skb_shinfo(skb)->gso_size; 1781 return skb_shinfo(skb)->gso_size;
1782} 1782}
1783 1783
1784static inline int skb_is_gso_v6(const struct sk_buff *skb)
1785{
1786 return skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6;
1787}
1788
1784static inline void skb_forward_csum(struct sk_buff *skb) 1789static inline void skb_forward_csum(struct sk_buff *skb)
1785{ 1790{
1786 /* Unfortunately we don't support this one. Any brave souls? */ 1791 /* 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/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/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/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, \