aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/include/asm/8253pit.h7
-rw-r--r--arch/alpha/include/asm/kmap_types.h24
-rw-r--r--arch/alpha/kernel/init_task.c3
-rw-r--r--arch/alpha/kernel/irq_alpha.c2
-rw-r--r--arch/alpha/kernel/irq_i8259.c2
-rw-r--r--arch/alpha/kernel/irq_impl.h2
-rw-r--r--arch/alpha/kernel/irq_pyxis.c2
-rw-r--r--arch/alpha/kernel/irq_srm.c2
-rw-r--r--arch/alpha/kernel/setup.c6
-rw-r--r--arch/alpha/kernel/sys_alcor.c2
-rw-r--r--arch/alpha/kernel/sys_cabriolet.c2
-rw-r--r--arch/alpha/kernel/sys_dp264.c6
-rw-r--r--arch/alpha/kernel/sys_eb64p.c2
-rw-r--r--arch/alpha/kernel/sys_eiger.c2
-rw-r--r--arch/alpha/kernel/sys_jensen.c2
-rw-r--r--arch/alpha/kernel/sys_marvel.c10
-rw-r--r--arch/alpha/kernel/sys_mikasa.c2
-rw-r--r--arch/alpha/kernel/sys_noritake.c2
-rw-r--r--arch/alpha/kernel/sys_rawhide.c2
-rw-r--r--arch/alpha/kernel/sys_ruffian.c1
-rw-r--r--arch/alpha/kernel/sys_rx164.c2
-rw-r--r--arch/alpha/kernel/sys_sable.c2
-rw-r--r--arch/alpha/kernel/sys_takara.c2
-rw-r--r--arch/alpha/kernel/sys_titan.c4
-rw-r--r--arch/alpha/kernel/sys_wildfire.c2
-rw-r--r--arch/alpha/mm/numa.c6
-rw-r--r--arch/arm/kernel/init_task.c4
-rw-r--r--arch/arm/mach-pxa/pcm990-baseboard.c23
-rw-r--r--arch/arm/plat-s3c/include/plat/regs-usb-hsotg-phy.h50
-rw-r--r--arch/arm/plat-s3c/include/plat/regs-usb-hsotg.h377
-rw-r--r--arch/avr32/kernel/init_task.c4
-rw-r--r--arch/blackfin/include/asm/kmap_types.h17
-rw-r--r--arch/blackfin/kernel/init_task.c4
-rw-r--r--arch/cris/include/asm/kmap_types.h17
-rw-r--r--arch/cris/kernel/process.c4
-rw-r--r--arch/frv/kernel/init_task.c4
-rw-r--r--arch/h8300/include/asm/kmap_types.h17
-rw-r--r--arch/h8300/kernel/init_task.c4
-rw-r--r--arch/ia64/hp/common/sba_iommu.c2
-rw-r--r--arch/ia64/include/asm/kmap_types.h24
-rw-r--r--arch/ia64/kernel/init_task.c4
-rw-r--r--arch/ia64/kernel/mca.c3
-rw-r--r--arch/ia64/kernel/perfmon.c2
-rw-r--r--arch/ia64/kernel/uncached.c3
-rw-r--r--arch/ia64/sn/pci/pci_dma.c3
-rw-r--r--arch/m32r/include/asm/kmap_types.h23
-rw-r--r--arch/m32r/kernel/init_task.c4
-rw-r--r--arch/m32r/mm/discontig.c6
-rw-r--r--arch/m32r/platforms/m32104ut/setup.c2
-rw-r--r--arch/m32r/platforms/m32700ut/setup.c8
-rw-r--r--arch/m32r/platforms/mappi/setup.c2
-rw-r--r--arch/m32r/platforms/mappi2/setup.c2
-rw-r--r--arch/m32r/platforms/mappi3/setup.c2
-rw-r--r--arch/m32r/platforms/oaks32r/setup.c2
-rw-r--r--arch/m32r/platforms/opsput/setup.c8
-rw-r--r--arch/m32r/platforms/usrv/setup.c4
-rw-r--r--arch/m68k/include/asm/kmap_types.h17
-rw-r--r--arch/m68k/kernel/process.c4
-rw-r--r--arch/m68knommu/kernel/init_task.c4
-rw-r--r--arch/microblaze/include/asm/kmap_types.h25
-rw-r--r--arch/mips/include/asm/i8253.h2
-rw-r--r--arch/mips/include/asm/kmap_types.h24
-rw-r--r--arch/mips/kernel/init_task.c4
-rw-r--r--arch/mips/sni/eisa.c2
-rw-r--r--arch/mn10300/include/asm/kmap_types.h27
-rw-r--r--arch/mn10300/kernel/init_task.c3
-rw-r--r--arch/parisc/include/asm/kmap_types.h24
-rw-r--r--arch/parisc/kernel/init_task.c4
-rw-r--r--arch/powerpc/include/asm/8253pit.h7
-rw-r--r--arch/powerpc/kernel/init_task.c4
-rw-r--r--arch/powerpc/kernel/prom_init.c3
-rw-r--r--arch/powerpc/platforms/cell/ras.c4
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c11
-rw-r--r--arch/s390/include/asm/kmap_types.h17
-rw-r--r--arch/s390/kernel/init_task.c4
-rw-r--r--arch/sh/Kconfig4
-rw-r--r--arch/sh/Kconfig.debug1
-rw-r--r--arch/sh/boards/board-ap325rxa.c52
-rw-r--r--arch/sh/boards/board-sh7785lcr.c14
-rw-r--r--arch/sh/boards/board-urquell.c7
-rw-r--r--arch/sh/boards/mach-highlander/setup.c64
-rw-r--r--arch/sh/boards/mach-migor/setup.c79
-rw-r--r--arch/sh/boards/mach-rsk/devices-rsk7203.c8
-rw-r--r--arch/sh/boards/mach-se/7780/irq.c1
-rw-r--r--arch/sh/boards/mach-x3proto/setup.c12
-rw-r--r--arch/sh/configs/r7780mp_defconfig143
-rw-r--r--arch/sh/drivers/pci/Makefile1
-rw-r--r--arch/sh/drivers/pci/ops-dreamcast.c1
-rw-r--r--arch/sh/drivers/pci/ops-sh7786.c134
-rw-r--r--arch/sh/drivers/pci/pci.c14
-rw-r--r--arch/sh/drivers/pci/pcie-sh7786.h589
-rw-r--r--arch/sh/include/asm/atomic-irq.h24
-rw-r--r--arch/sh/include/asm/checksum.h2
-rw-r--r--arch/sh/include/asm/checksum_64.h78
-rw-r--r--arch/sh/include/asm/current.h21
-rw-r--r--arch/sh/include/asm/dma.h10
-rw-r--r--arch/sh/include/asm/ipcbuf.h30
-rw-r--r--arch/sh/include/asm/irq.h2
-rw-r--r--arch/sh/include/asm/kmap_types.h24
-rw-r--r--arch/sh/include/asm/mman.h18
-rw-r--r--arch/sh/include/asm/mmu_context.h22
-rw-r--r--arch/sh/include/asm/module.h12
-rw-r--r--arch/sh/include/asm/msgbuf.h32
-rw-r--r--arch/sh/include/asm/param.h23
-rw-r--r--arch/sh/include/asm/parport.h17
-rw-r--r--arch/sh/include/asm/posix_types_32.h119
-rw-r--r--arch/sh/include/asm/posix_types_64.h127
-rw-r--r--arch/sh/include/asm/scatterlist.h24
-rw-r--r--arch/sh/include/asm/sembuf.h26
-rw-r--r--arch/sh/include/asm/serial.h20
-rw-r--r--arch/sh/include/asm/setup.h2
-rw-r--r--arch/sh/include/asm/shmbuf.h43
-rw-r--r--arch/sh/include/asm/signal.h147
-rw-r--r--arch/sh/include/asm/smp.h3
-rw-r--r--arch/sh/include/asm/socket.h61
-rw-r--r--arch/sh/include/asm/swab.h3
-rw-r--r--arch/sh/include/asm/termbits.h199
-rw-r--r--arch/sh/include/asm/termios.h91
-rw-r--r--arch/sh/include/asm/timex.h7
-rw-r--r--arch/sh/include/asm/topology.h3
-rw-r--r--arch/sh/include/asm/types.h16
-rw-r--r--arch/sh/include/asm/ucontext.h13
-rw-r--r--arch/sh/include/asm/unaligned.h14
-rw-r--r--arch/sh/include/asm/unistd_32.h3
-rw-r--r--arch/sh/include/asm/unistd_64.h3
-rw-r--r--arch/sh/include/mach-common/mach/highlander.h3
-rw-r--r--arch/sh/kernel/cpu/clock-cpg.c16
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7366.c10
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7723.c9
-rw-r--r--arch/sh/kernel/cpu/sh4a/smp-shx3.c5
-rw-r--r--arch/sh/kernel/ftrace.c60
-rw-r--r--arch/sh/kernel/init_task.c3
-rw-r--r--arch/sh/kernel/sh_ksyms_64.c7
-rw-r--r--arch/sh/kernel/smp.c10
-rw-r--r--arch/sh/kernel/syscalls_32.S1
-rw-r--r--arch/sh/kernel/syscalls_64.S1
-rw-r--r--arch/sh/kernel/time.c27
-rw-r--r--arch/sh/kernel/traps.c1
-rw-r--r--arch/sh/lib64/Makefile2
-rw-r--r--arch/sh/lib64/c-checksum.c214
-rw-r--r--arch/sparc/include/asm/kmap_types.h17
-rw-r--r--arch/sparc/kernel/init_task.c3
-rw-r--r--arch/um/drivers/net_kern.c4
-rw-r--r--arch/um/drivers/ubd_kern.c4
-rw-r--r--arch/um/include/shared/init.h2
-rw-r--r--arch/um/include/shared/net_user.h2
-rw-r--r--arch/um/kernel/init_task.c3
-rw-r--r--arch/um/kernel/irq.c6
-rw-r--r--arch/um/sys-i386/stub.S2
-rw-r--r--arch/um/sys-x86_64/asm/elf.h44
-rw-r--r--arch/um/sys-x86_64/stub.S2
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--arch/x86/Makefile5
-rw-r--r--arch/x86/include/asm/dma-mapping.h7
-rw-r--r--arch/x86/include/asm/kmap_types.h23
-rw-r--r--arch/x86/include/asm/kmemcheck.h42
-rw-r--r--arch/x86/include/asm/pgtable.h5
-rw-r--r--arch/x86/include/asm/pgtable_types.h9
-rw-r--r--arch/x86/include/asm/string_32.h8
-rw-r--r--arch/x86/include/asm/string_64.h8
-rw-r--r--arch/x86/include/asm/thread_info.h4
-rw-r--r--arch/x86/include/asm/timex.h4
-rw-r--r--arch/x86/include/asm/xor.h5
-rw-r--r--arch/x86/kernel/cpu/common.c11
-rw-r--r--arch/x86/kernel/cpu/intel.c23
-rw-r--r--arch/x86/kernel/cpuid.c6
-rw-r--r--arch/x86/kernel/i8253.c1
-rw-r--r--arch/x86/kernel/init_task.c1
-rw-r--r--arch/x86/kernel/microcode_core.c1
-rw-r--r--arch/x86/kernel/msr.c6
-rw-r--r--arch/x86/kernel/process.c2
-rw-r--r--arch/x86/kernel/stacktrace.c7
-rw-r--r--arch/x86/kernel/traps.c5
-rw-r--r--arch/x86/kernel/tsc.c1
-rw-r--r--arch/x86/kvm/vmx.c2
-rw-r--r--arch/x86/mm/Makefile2
-rw-r--r--arch/x86/mm/fault.c18
-rw-r--r--arch/x86/mm/init.c2
-rw-r--r--arch/x86/mm/init_32.c2
-rw-r--r--arch/x86/mm/init_64.c4
-rw-r--r--arch/x86/mm/kmemcheck/Makefile1
-rw-r--r--arch/x86/mm/kmemcheck/error.c228
-rw-r--r--arch/x86/mm/kmemcheck/error.h15
-rw-r--r--arch/x86/mm/kmemcheck/kmemcheck.c640
-rw-r--r--arch/x86/mm/kmemcheck/opcode.c106
-rw-r--r--arch/x86/mm/kmemcheck/opcode.h9
-rw-r--r--arch/x86/mm/kmemcheck/pte.c22
-rw-r--r--arch/x86/mm/kmemcheck/pte.h10
-rw-r--r--arch/x86/mm/kmemcheck/selftest.c69
-rw-r--r--arch/x86/mm/kmemcheck/selftest.h6
-rw-r--r--arch/x86/mm/kmemcheck/shadow.c162
-rw-r--r--arch/x86/mm/kmemcheck/shadow.h16
-rw-r--r--arch/x86/mm/pageattr.c2
-rw-r--r--arch/x86/mm/pgtable.c12
-rw-r--r--arch/xtensa/include/asm/kmap_types.h27
-rw-r--r--arch/xtensa/kernel/init_task.c4
196 files changed, 3218 insertions, 2067 deletions
diff --git a/arch/alpha/include/asm/8253pit.h b/arch/alpha/include/asm/8253pit.h
index fef5c1450e47..a71c9c1455a7 100644
--- a/arch/alpha/include/asm/8253pit.h
+++ b/arch/alpha/include/asm/8253pit.h
@@ -1,10 +1,3 @@
1/* 1/*
2 * 8253/8254 Programmable Interval Timer 2 * 8253/8254 Programmable Interval Timer
3 */ 3 */
4
5#ifndef _8253PIT_H
6#define _8253PIT_H
7
8#define PIT_TICK_RATE 1193180UL
9
10#endif
diff --git a/arch/alpha/include/asm/kmap_types.h b/arch/alpha/include/asm/kmap_types.h
index 3e6735a34c57..a8d4ec8ea4b6 100644
--- a/arch/alpha/include/asm/kmap_types.h
+++ b/arch/alpha/include/asm/kmap_types.h
@@ -3,30 +3,12 @@
3 3
4/* Dummy header just to define km_type. */ 4/* Dummy header just to define km_type. */
5 5
6
7#ifdef CONFIG_DEBUG_HIGHMEM 6#ifdef CONFIG_DEBUG_HIGHMEM
8# define D(n) __KM_FENCE_##n , 7#define __WITH_KM_FENCE
9#else
10# define D(n)
11#endif 8#endif
12 9
13enum km_type { 10#include <asm-generic/kmap_types.h>
14D(0) KM_BOUNCE_READ,
15D(1) KM_SKB_SUNRPC_DATA,
16D(2) KM_SKB_DATA_SOFTIRQ,
17D(3) KM_USER0,
18D(4) KM_USER1,
19D(5) KM_BIO_SRC_IRQ,
20D(6) KM_BIO_DST_IRQ,
21D(7) KM_PTE0,
22D(8) KM_PTE1,
23D(9) KM_IRQ0,
24D(10) KM_IRQ1,
25D(11) KM_SOFTIRQ0,
26D(12) KM_SOFTIRQ1,
27D(13) KM_TYPE_NR
28};
29 11
30#undef D 12#undef __WITH_KM_FENCE
31 13
32#endif 14#endif
diff --git a/arch/alpha/kernel/init_task.c b/arch/alpha/kernel/init_task.c
index c2938e574a40..19b86328ffd7 100644
--- a/arch/alpha/kernel/init_task.c
+++ b/arch/alpha/kernel/init_task.c
@@ -10,10 +10,7 @@
10 10
11static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 11static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
12static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 12static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
13struct mm_struct init_mm = INIT_MM(init_mm);
14struct task_struct init_task = INIT_TASK(init_task); 13struct task_struct init_task = INIT_TASK(init_task);
15
16EXPORT_SYMBOL(init_mm);
17EXPORT_SYMBOL(init_task); 14EXPORT_SYMBOL(init_task);
18 15
19union thread_union init_thread_union 16union thread_union init_thread_union
diff --git a/arch/alpha/kernel/irq_alpha.c b/arch/alpha/kernel/irq_alpha.c
index 67c19f8a9944..38c805dfc544 100644
--- a/arch/alpha/kernel/irq_alpha.c
+++ b/arch/alpha/kernel/irq_alpha.c
@@ -227,7 +227,7 @@ struct irqaction timer_irqaction = {
227 .name = "timer", 227 .name = "timer",
228}; 228};
229 229
230static struct hw_interrupt_type rtc_irq_type = { 230static struct irq_chip rtc_irq_type = {
231 .typename = "RTC", 231 .typename = "RTC",
232 .startup = rtc_startup, 232 .startup = rtc_startup,
233 .shutdown = rtc_enable_disable, 233 .shutdown = rtc_enable_disable,
diff --git a/arch/alpha/kernel/irq_i8259.c b/arch/alpha/kernel/irq_i8259.c
index 9405bee9894e..50bfec9b588f 100644
--- a/arch/alpha/kernel/irq_i8259.c
+++ b/arch/alpha/kernel/irq_i8259.c
@@ -83,7 +83,7 @@ i8259a_end_irq(unsigned int irq)
83 i8259a_enable_irq(irq); 83 i8259a_enable_irq(irq);
84} 84}
85 85
86struct hw_interrupt_type i8259a_irq_type = { 86struct irq_chip i8259a_irq_type = {
87 .typename = "XT-PIC", 87 .typename = "XT-PIC",
88 .startup = i8259a_startup_irq, 88 .startup = i8259a_startup_irq,
89 .shutdown = i8259a_disable_irq, 89 .shutdown = i8259a_disable_irq,
diff --git a/arch/alpha/kernel/irq_impl.h b/arch/alpha/kernel/irq_impl.h
index cc9a8a7aa279..b63ccd7386f1 100644
--- a/arch/alpha/kernel/irq_impl.h
+++ b/arch/alpha/kernel/irq_impl.h
@@ -36,7 +36,7 @@ extern void i8259a_disable_irq(unsigned int);
36extern void i8259a_mask_and_ack_irq(unsigned int); 36extern void i8259a_mask_and_ack_irq(unsigned int);
37extern unsigned int i8259a_startup_irq(unsigned int); 37extern unsigned int i8259a_startup_irq(unsigned int);
38extern void i8259a_end_irq(unsigned int); 38extern void i8259a_end_irq(unsigned int);
39extern struct hw_interrupt_type i8259a_irq_type; 39extern struct irq_chip i8259a_irq_type;
40extern void init_i8259a_irqs(void); 40extern void init_i8259a_irqs(void);
41 41
42extern void handle_irq(int irq); 42extern void handle_irq(int irq);
diff --git a/arch/alpha/kernel/irq_pyxis.c b/arch/alpha/kernel/irq_pyxis.c
index d53edbccbfe5..69199a76ec4a 100644
--- a/arch/alpha/kernel/irq_pyxis.c
+++ b/arch/alpha/kernel/irq_pyxis.c
@@ -70,7 +70,7 @@ pyxis_mask_and_ack_irq(unsigned int irq)
70 *(vulp)PYXIS_INT_MASK; 70 *(vulp)PYXIS_INT_MASK;
71} 71}
72 72
73static struct hw_interrupt_type pyxis_irq_type = { 73static struct irq_chip pyxis_irq_type = {
74 .typename = "PYXIS", 74 .typename = "PYXIS",
75 .startup = pyxis_startup_irq, 75 .startup = pyxis_startup_irq,
76 .shutdown = pyxis_disable_irq, 76 .shutdown = pyxis_disable_irq,
diff --git a/arch/alpha/kernel/irq_srm.c b/arch/alpha/kernel/irq_srm.c
index a03fbca4940e..85229369a1f8 100644
--- a/arch/alpha/kernel/irq_srm.c
+++ b/arch/alpha/kernel/irq_srm.c
@@ -48,7 +48,7 @@ srm_end_irq(unsigned int irq)
48} 48}
49 49
50/* Handle interrupts from the SRM, assuming no additional weirdness. */ 50/* Handle interrupts from the SRM, assuming no additional weirdness. */
51static struct hw_interrupt_type srm_irq_type = { 51static struct irq_chip srm_irq_type = {
52 .typename = "SRM", 52 .typename = "SRM",
53 .startup = srm_startup_irq, 53 .startup = srm_startup_irq,
54 .shutdown = srm_disable_irq, 54 .shutdown = srm_disable_irq,
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
index 80df86cd746b..d2634e4476b4 100644
--- a/arch/alpha/kernel/setup.c
+++ b/arch/alpha/kernel/setup.c
@@ -252,9 +252,9 @@ reserve_std_resources(void)
252} 252}
253 253
254#define PFN_MAX PFN_DOWN(0x80000000) 254#define PFN_MAX PFN_DOWN(0x80000000)
255#define for_each_mem_cluster(memdesc, cluster, i) \ 255#define for_each_mem_cluster(memdesc, _cluster, i) \
256 for ((cluster) = (memdesc)->cluster, (i) = 0; \ 256 for ((_cluster) = (memdesc)->cluster, (i) = 0; \
257 (i) < (memdesc)->numclusters; (i)++, (cluster)++) 257 (i) < (memdesc)->numclusters; (i)++, (_cluster)++)
258 258
259static unsigned long __init 259static unsigned long __init
260get_mem_size_limit(char *s) 260get_mem_size_limit(char *s)
diff --git a/arch/alpha/kernel/sys_alcor.c b/arch/alpha/kernel/sys_alcor.c
index e53a1e1c2f21..382035ef7394 100644
--- a/arch/alpha/kernel/sys_alcor.c
+++ b/arch/alpha/kernel/sys_alcor.c
@@ -89,7 +89,7 @@ alcor_end_irq(unsigned int irq)
89 alcor_enable_irq(irq); 89 alcor_enable_irq(irq);
90} 90}
91 91
92static struct hw_interrupt_type alcor_irq_type = { 92static struct irq_chip alcor_irq_type = {
93 .typename = "ALCOR", 93 .typename = "ALCOR",
94 .startup = alcor_startup_irq, 94 .startup = alcor_startup_irq,
95 .shutdown = alcor_disable_irq, 95 .shutdown = alcor_disable_irq,
diff --git a/arch/alpha/kernel/sys_cabriolet.c b/arch/alpha/kernel/sys_cabriolet.c
index ace475c124f6..ed349436732b 100644
--- a/arch/alpha/kernel/sys_cabriolet.c
+++ b/arch/alpha/kernel/sys_cabriolet.c
@@ -71,7 +71,7 @@ cabriolet_end_irq(unsigned int irq)
71 cabriolet_enable_irq(irq); 71 cabriolet_enable_irq(irq);
72} 72}
73 73
74static struct hw_interrupt_type cabriolet_irq_type = { 74static struct irq_chip cabriolet_irq_type = {
75 .typename = "CABRIOLET", 75 .typename = "CABRIOLET",
76 .startup = cabriolet_startup_irq, 76 .startup = cabriolet_startup_irq,
77 .shutdown = cabriolet_disable_irq, 77 .shutdown = cabriolet_disable_irq,
diff --git a/arch/alpha/kernel/sys_dp264.c b/arch/alpha/kernel/sys_dp264.c
index 5bd5259324b7..46e70ece5176 100644
--- a/arch/alpha/kernel/sys_dp264.c
+++ b/arch/alpha/kernel/sys_dp264.c
@@ -198,7 +198,7 @@ clipper_set_affinity(unsigned int irq, const struct cpumask *affinity)
198 return 0; 198 return 0;
199} 199}
200 200
201static struct hw_interrupt_type dp264_irq_type = { 201static struct irq_chip dp264_irq_type = {
202 .typename = "DP264", 202 .typename = "DP264",
203 .startup = dp264_startup_irq, 203 .startup = dp264_startup_irq,
204 .shutdown = dp264_disable_irq, 204 .shutdown = dp264_disable_irq,
@@ -209,7 +209,7 @@ static struct hw_interrupt_type dp264_irq_type = {
209 .set_affinity = dp264_set_affinity, 209 .set_affinity = dp264_set_affinity,
210}; 210};
211 211
212static struct hw_interrupt_type clipper_irq_type = { 212static struct irq_chip clipper_irq_type = {
213 .typename = "CLIPPER", 213 .typename = "CLIPPER",
214 .startup = clipper_startup_irq, 214 .startup = clipper_startup_irq,
215 .shutdown = clipper_disable_irq, 215 .shutdown = clipper_disable_irq,
@@ -298,7 +298,7 @@ clipper_srm_device_interrupt(unsigned long vector)
298} 298}
299 299
300static void __init 300static void __init
301init_tsunami_irqs(struct hw_interrupt_type * ops, int imin, int imax) 301init_tsunami_irqs(struct irq_chip * ops, int imin, int imax)
302{ 302{
303 long i; 303 long i;
304 for (i = imin; i <= imax; ++i) { 304 for (i = imin; i <= imax; ++i) {
diff --git a/arch/alpha/kernel/sys_eb64p.c b/arch/alpha/kernel/sys_eb64p.c
index 9c5a306dc0ee..660c23ef661f 100644
--- a/arch/alpha/kernel/sys_eb64p.c
+++ b/arch/alpha/kernel/sys_eb64p.c
@@ -69,7 +69,7 @@ eb64p_end_irq(unsigned int irq)
69 eb64p_enable_irq(irq); 69 eb64p_enable_irq(irq);
70} 70}
71 71
72static struct hw_interrupt_type eb64p_irq_type = { 72static struct irq_chip eb64p_irq_type = {
73 .typename = "EB64P", 73 .typename = "EB64P",
74 .startup = eb64p_startup_irq, 74 .startup = eb64p_startup_irq,
75 .shutdown = eb64p_disable_irq, 75 .shutdown = eb64p_disable_irq,
diff --git a/arch/alpha/kernel/sys_eiger.c b/arch/alpha/kernel/sys_eiger.c
index baf60f36cbd7..b99ea488d844 100644
--- a/arch/alpha/kernel/sys_eiger.c
+++ b/arch/alpha/kernel/sys_eiger.c
@@ -80,7 +80,7 @@ eiger_end_irq(unsigned int irq)
80 eiger_enable_irq(irq); 80 eiger_enable_irq(irq);
81} 81}
82 82
83static struct hw_interrupt_type eiger_irq_type = { 83static struct irq_chip eiger_irq_type = {
84 .typename = "EIGER", 84 .typename = "EIGER",
85 .startup = eiger_startup_irq, 85 .startup = eiger_startup_irq,
86 .shutdown = eiger_disable_irq, 86 .shutdown = eiger_disable_irq,
diff --git a/arch/alpha/kernel/sys_jensen.c b/arch/alpha/kernel/sys_jensen.c
index 2b5caf3d9b15..ef0b83a070ac 100644
--- a/arch/alpha/kernel/sys_jensen.c
+++ b/arch/alpha/kernel/sys_jensen.c
@@ -118,7 +118,7 @@ jensen_local_end(unsigned int irq)
118 i8259a_end_irq(1); 118 i8259a_end_irq(1);
119} 119}
120 120
121static struct hw_interrupt_type jensen_local_irq_type = { 121static struct irq_chip jensen_local_irq_type = {
122 .typename = "LOCAL", 122 .typename = "LOCAL",
123 .startup = jensen_local_startup, 123 .startup = jensen_local_startup,
124 .shutdown = jensen_local_shutdown, 124 .shutdown = jensen_local_shutdown,
diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c
index c5a1a2438c67..bbfc4f20ca72 100644
--- a/arch/alpha/kernel/sys_marvel.c
+++ b/arch/alpha/kernel/sys_marvel.c
@@ -169,7 +169,7 @@ marvel_irq_noop_return(unsigned int irq)
169 return 0; 169 return 0;
170} 170}
171 171
172static struct hw_interrupt_type marvel_legacy_irq_type = { 172static struct irq_chip marvel_legacy_irq_type = {
173 .typename = "LEGACY", 173 .typename = "LEGACY",
174 .startup = marvel_irq_noop_return, 174 .startup = marvel_irq_noop_return,
175 .shutdown = marvel_irq_noop, 175 .shutdown = marvel_irq_noop,
@@ -179,7 +179,7 @@ static struct hw_interrupt_type marvel_legacy_irq_type = {
179 .end = marvel_irq_noop, 179 .end = marvel_irq_noop,
180}; 180};
181 181
182static struct hw_interrupt_type io7_lsi_irq_type = { 182static struct irq_chip io7_lsi_irq_type = {
183 .typename = "LSI", 183 .typename = "LSI",
184 .startup = io7_startup_irq, 184 .startup = io7_startup_irq,
185 .shutdown = io7_disable_irq, 185 .shutdown = io7_disable_irq,
@@ -189,7 +189,7 @@ static struct hw_interrupt_type io7_lsi_irq_type = {
189 .end = io7_end_irq, 189 .end = io7_end_irq,
190}; 190};
191 191
192static struct hw_interrupt_type io7_msi_irq_type = { 192static struct irq_chip io7_msi_irq_type = {
193 .typename = "MSI", 193 .typename = "MSI",
194 .startup = io7_startup_irq, 194 .startup = io7_startup_irq,
195 .shutdown = io7_disable_irq, 195 .shutdown = io7_disable_irq,
@@ -273,8 +273,8 @@ init_one_io7_msi(struct io7 *io7, unsigned int which, unsigned int where)
273 273
274static void __init 274static void __init
275init_io7_irqs(struct io7 *io7, 275init_io7_irqs(struct io7 *io7,
276 struct hw_interrupt_type *lsi_ops, 276 struct irq_chip *lsi_ops,
277 struct hw_interrupt_type *msi_ops) 277 struct irq_chip *msi_ops)
278{ 278{
279 long base = (io7->pe << MARVEL_IRQ_VEC_PE_SHIFT) + 16; 279 long base = (io7->pe << MARVEL_IRQ_VEC_PE_SHIFT) + 16;
280 long i; 280 long i;
diff --git a/arch/alpha/kernel/sys_mikasa.c b/arch/alpha/kernel/sys_mikasa.c
index 8d3e9429c5ee..4e366641a08e 100644
--- a/arch/alpha/kernel/sys_mikasa.c
+++ b/arch/alpha/kernel/sys_mikasa.c
@@ -68,7 +68,7 @@ mikasa_end_irq(unsigned int irq)
68 mikasa_enable_irq(irq); 68 mikasa_enable_irq(irq);
69} 69}
70 70
71static struct hw_interrupt_type mikasa_irq_type = { 71static struct irq_chip mikasa_irq_type = {
72 .typename = "MIKASA", 72 .typename = "MIKASA",
73 .startup = mikasa_startup_irq, 73 .startup = mikasa_startup_irq,
74 .shutdown = mikasa_disable_irq, 74 .shutdown = mikasa_disable_irq,
diff --git a/arch/alpha/kernel/sys_noritake.c b/arch/alpha/kernel/sys_noritake.c
index 538876b62449..35753a173bac 100644
--- a/arch/alpha/kernel/sys_noritake.c
+++ b/arch/alpha/kernel/sys_noritake.c
@@ -73,7 +73,7 @@ noritake_end_irq(unsigned int irq)
73 noritake_enable_irq(irq); 73 noritake_enable_irq(irq);
74} 74}
75 75
76static struct hw_interrupt_type noritake_irq_type = { 76static struct irq_chip noritake_irq_type = {
77 .typename = "NORITAKE", 77 .typename = "NORITAKE",
78 .startup = noritake_startup_irq, 78 .startup = noritake_startup_irq,
79 .shutdown = noritake_disable_irq, 79 .shutdown = noritake_disable_irq,
diff --git a/arch/alpha/kernel/sys_rawhide.c b/arch/alpha/kernel/sys_rawhide.c
index 672cb2df53df..f3aec7e085c8 100644
--- a/arch/alpha/kernel/sys_rawhide.c
+++ b/arch/alpha/kernel/sys_rawhide.c
@@ -135,7 +135,7 @@ rawhide_end_irq(unsigned int irq)
135 rawhide_enable_irq(irq); 135 rawhide_enable_irq(irq);
136} 136}
137 137
138static struct hw_interrupt_type rawhide_irq_type = { 138static struct irq_chip rawhide_irq_type = {
139 .typename = "RAWHIDE", 139 .typename = "RAWHIDE",
140 .startup = rawhide_startup_irq, 140 .startup = rawhide_startup_irq,
141 .shutdown = rawhide_disable_irq, 141 .shutdown = rawhide_disable_irq,
diff --git a/arch/alpha/kernel/sys_ruffian.c b/arch/alpha/kernel/sys_ruffian.c
index f15a329b6011..d9f9cfeb9931 100644
--- a/arch/alpha/kernel/sys_ruffian.c
+++ b/arch/alpha/kernel/sys_ruffian.c
@@ -14,6 +14,7 @@
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/pci.h> 15#include <linux/pci.h>
16#include <linux/ioport.h> 16#include <linux/ioport.h>
17#include <linux/timex.h>
17#include <linux/init.h> 18#include <linux/init.h>
18 19
19#include <asm/ptrace.h> 20#include <asm/ptrace.h>
diff --git a/arch/alpha/kernel/sys_rx164.c b/arch/alpha/kernel/sys_rx164.c
index ce1faa6f1df1..fc9246373452 100644
--- a/arch/alpha/kernel/sys_rx164.c
+++ b/arch/alpha/kernel/sys_rx164.c
@@ -72,7 +72,7 @@ rx164_end_irq(unsigned int irq)
72 rx164_enable_irq(irq); 72 rx164_enable_irq(irq);
73} 73}
74 74
75static struct hw_interrupt_type rx164_irq_type = { 75static struct irq_chip rx164_irq_type = {
76 .typename = "RX164", 76 .typename = "RX164",
77 .startup = rx164_startup_irq, 77 .startup = rx164_startup_irq,
78 .shutdown = rx164_disable_irq, 78 .shutdown = rx164_disable_irq,
diff --git a/arch/alpha/kernel/sys_sable.c b/arch/alpha/kernel/sys_sable.c
index 9e263256a42d..426eb6906d01 100644
--- a/arch/alpha/kernel/sys_sable.c
+++ b/arch/alpha/kernel/sys_sable.c
@@ -501,7 +501,7 @@ sable_lynx_mask_and_ack_irq(unsigned int irq)
501 spin_unlock(&sable_lynx_irq_lock); 501 spin_unlock(&sable_lynx_irq_lock);
502} 502}
503 503
504static struct hw_interrupt_type sable_lynx_irq_type = { 504static struct irq_chip sable_lynx_irq_type = {
505 .typename = "SABLE/LYNX", 505 .typename = "SABLE/LYNX",
506 .startup = sable_lynx_startup_irq, 506 .startup = sable_lynx_startup_irq,
507 .shutdown = sable_lynx_disable_irq, 507 .shutdown = sable_lynx_disable_irq,
diff --git a/arch/alpha/kernel/sys_takara.c b/arch/alpha/kernel/sys_takara.c
index 9bd9a31450c6..830318c21661 100644
--- a/arch/alpha/kernel/sys_takara.c
+++ b/arch/alpha/kernel/sys_takara.c
@@ -74,7 +74,7 @@ takara_end_irq(unsigned int irq)
74 takara_enable_irq(irq); 74 takara_enable_irq(irq);
75} 75}
76 76
77static struct hw_interrupt_type takara_irq_type = { 77static struct irq_chip takara_irq_type = {
78 .typename = "TAKARA", 78 .typename = "TAKARA",
79 .startup = takara_startup_irq, 79 .startup = takara_startup_irq,
80 .shutdown = takara_disable_irq, 80 .shutdown = takara_disable_irq,
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c
index 8dd239ebdb9e..88978fc60f83 100644
--- a/arch/alpha/kernel/sys_titan.c
+++ b/arch/alpha/kernel/sys_titan.c
@@ -185,7 +185,7 @@ titan_srm_device_interrupt(unsigned long vector)
185 185
186 186
187static void __init 187static void __init
188init_titan_irqs(struct hw_interrupt_type * ops, int imin, int imax) 188init_titan_irqs(struct irq_chip * ops, int imin, int imax)
189{ 189{
190 long i; 190 long i;
191 for (i = imin; i <= imax; ++i) { 191 for (i = imin; i <= imax; ++i) {
@@ -194,7 +194,7 @@ init_titan_irqs(struct hw_interrupt_type * ops, int imin, int imax)
194 } 194 }
195} 195}
196 196
197static struct hw_interrupt_type titan_irq_type = { 197static struct irq_chip titan_irq_type = {
198 .typename = "TITAN", 198 .typename = "TITAN",
199 .startup = titan_startup_irq, 199 .startup = titan_startup_irq,
200 .shutdown = titan_disable_irq, 200 .shutdown = titan_disable_irq,
diff --git a/arch/alpha/kernel/sys_wildfire.c b/arch/alpha/kernel/sys_wildfire.c
index 42c3eede4d09..e91b4c3838a8 100644
--- a/arch/alpha/kernel/sys_wildfire.c
+++ b/arch/alpha/kernel/sys_wildfire.c
@@ -157,7 +157,7 @@ wildfire_end_irq(unsigned int irq)
157 wildfire_enable_irq(irq); 157 wildfire_enable_irq(irq);
158} 158}
159 159
160static struct hw_interrupt_type wildfire_irq_type = { 160static struct irq_chip wildfire_irq_type = {
161 .typename = "WILDFIRE", 161 .typename = "WILDFIRE",
162 .startup = wildfire_startup_irq, 162 .startup = wildfire_startup_irq,
163 .shutdown = wildfire_disable_irq, 163 .shutdown = wildfire_disable_irq,
diff --git a/arch/alpha/mm/numa.c b/arch/alpha/mm/numa.c
index a13de49d1265..0eab55749423 100644
--- a/arch/alpha/mm/numa.c
+++ b/arch/alpha/mm/numa.c
@@ -28,9 +28,9 @@ EXPORT_SYMBOL(node_data);
28#define DBGDCONT(args...) 28#define DBGDCONT(args...)
29#endif 29#endif
30 30
31#define for_each_mem_cluster(memdesc, cluster, i) \ 31#define for_each_mem_cluster(memdesc, _cluster, i) \
32 for ((cluster) = (memdesc)->cluster, (i) = 0; \ 32 for ((_cluster) = (memdesc)->cluster, (i) = 0; \
33 (i) < (memdesc)->numclusters; (i)++, (cluster)++) 33 (i) < (memdesc)->numclusters; (i)++, (_cluster)++)
34 34
35static void __init show_mem_layout(void) 35static void __init show_mem_layout(void)
36{ 36{
diff --git a/arch/arm/kernel/init_task.c b/arch/arm/kernel/init_task.c
index e859af349467..3f470866bb89 100644
--- a/arch/arm/kernel/init_task.c
+++ b/arch/arm/kernel/init_task.c
@@ -14,10 +14,6 @@
14 14
15static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 15static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
17struct mm_struct init_mm = INIT_MM(init_mm);
18
19EXPORT_SYMBOL(init_mm);
20
21/* 17/*
22 * Initial thread structure. 18 * Initial thread structure.
23 * 19 *
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c
index 095521e9ee24..01791d74e08e 100644
--- a/arch/arm/mach-pxa/pcm990-baseboard.c
+++ b/arch/arm/mach-pxa/pcm990-baseboard.c
@@ -380,12 +380,12 @@ static struct pca953x_platform_data pca9536_data = {
380 .gpio_base = NR_BUILTIN_GPIO, 380 .gpio_base = NR_BUILTIN_GPIO,
381}; 381};
382 382
383static int gpio_bus_switch; 383static int gpio_bus_switch = -EINVAL;
384 384
385static int pcm990_camera_set_bus_param(struct soc_camera_link *link, 385static int pcm990_camera_set_bus_param(struct soc_camera_link *link,
386 unsigned long flags) 386 unsigned long flags)
387{ 387{
388 if (gpio_bus_switch <= 0) { 388 if (gpio_bus_switch < 0) {
389 if (flags == SOCAM_DATAWIDTH_10) 389 if (flags == SOCAM_DATAWIDTH_10)
390 return 0; 390 return 0;
391 else 391 else
@@ -404,25 +404,34 @@ static unsigned long pcm990_camera_query_bus_param(struct soc_camera_link *link)
404{ 404{
405 int ret; 405 int ret;
406 406
407 if (!gpio_bus_switch) { 407 if (gpio_bus_switch < 0) {
408 ret = gpio_request(NR_BUILTIN_GPIO, "camera"); 408 ret = gpio_request(NR_BUILTIN_GPIO, "camera");
409 if (!ret) { 409 if (!ret) {
410 gpio_bus_switch = NR_BUILTIN_GPIO; 410 gpio_bus_switch = NR_BUILTIN_GPIO;
411 gpio_direction_output(gpio_bus_switch, 0); 411 gpio_direction_output(gpio_bus_switch, 0);
412 } else 412 }
413 gpio_bus_switch = -EINVAL;
414 } 413 }
415 414
416 if (gpio_bus_switch > 0) 415 if (gpio_bus_switch >= 0)
417 return SOCAM_DATAWIDTH_8 | SOCAM_DATAWIDTH_10; 416 return SOCAM_DATAWIDTH_8 | SOCAM_DATAWIDTH_10;
418 else 417 else
419 return SOCAM_DATAWIDTH_10; 418 return SOCAM_DATAWIDTH_10;
420} 419}
421 420
421static void pcm990_camera_free_bus(struct soc_camera_link *link)
422{
423 if (gpio_bus_switch < 0)
424 return;
425
426 gpio_free(gpio_bus_switch);
427 gpio_bus_switch = -EINVAL;
428}
429
422static struct soc_camera_link iclink = { 430static struct soc_camera_link iclink = {
423 .bus_id = 0, /* Must match with the camera ID above */ 431 .bus_id = 0, /* Must match with the camera ID above */
424 .query_bus_param = pcm990_camera_query_bus_param, 432 .query_bus_param = pcm990_camera_query_bus_param,
425 .set_bus_param = pcm990_camera_set_bus_param, 433 .set_bus_param = pcm990_camera_set_bus_param,
434 .free_bus = pcm990_camera_free_bus,
426}; 435};
427 436
428/* Board I2C devices. */ 437/* Board I2C devices. */
diff --git a/arch/arm/plat-s3c/include/plat/regs-usb-hsotg-phy.h b/arch/arm/plat-s3c/include/plat/regs-usb-hsotg-phy.h
new file mode 100644
index 000000000000..36a85f5000c8
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/regs-usb-hsotg-phy.h
@@ -0,0 +1,50 @@
1/* arch/arm/plat-s3c/include/plat/regs-usb-hsotg-phy.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * S3C - USB2.0 Highspeed/OtG device PHY registers
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15/* Note, this is a seperate header file as some of the clock framework
16 * needs to touch this if the clk_48m is used as the USB OHCI or other
17 * peripheral source.
18*/
19
20#ifndef __PLAT_S3C64XX_REGS_USB_HSOTG_PHY_H
21#define __PLAT_S3C64XX_REGS_USB_HSOTG_PHY_H __FILE__
22
23/* S3C64XX_PA_USB_HSPHY */
24
25#define S3C_HSOTG_PHYREG(x) ((x) + S3C_VA_USB_HSPHY)
26
27#define S3C_PHYPWR S3C_HSOTG_PHYREG(0x00)
28#define SRC_PHYPWR_OTG_DISABLE (1 << 4)
29#define SRC_PHYPWR_ANALOG_POWERDOWN (1 << 3)
30#define SRC_PHYPWR_FORCE_SUSPEND (1 << 1)
31
32#define S3C_PHYCLK S3C_HSOTG_PHYREG(0x04)
33#define S3C_PHYCLK_MODE_USB11 (1 << 6)
34#define S3C_PHYCLK_EXT_OSC (1 << 5)
35#define S3C_PHYCLK_CLK_FORCE (1 << 4)
36#define S3C_PHYCLK_ID_PULL (1 << 2)
37#define S3C_PHYCLK_CLKSEL_MASK (0x3 << 0)
38#define S3C_PHYCLK_CLKSEL_SHIFT (0)
39#define S3C_PHYCLK_CLKSEL_48M (0x0 << 0)
40#define S3C_PHYCLK_CLKSEL_12M (0x2 << 0)
41#define S3C_PHYCLK_CLKSEL_24M (0x3 << 0)
42
43#define S3C_RSTCON S3C_HSOTG_PHYREG(0x08)
44#define S3C_RSTCON_PHYCLK (1 << 2)
45#define S3C_RSTCON_HCLK (1 << 2)
46#define S3C_RSTCON_PHY (1 << 0)
47
48#define S3C_PHYTUNE S3C_HSOTG_PHYREG(0x20)
49
50#endif /* __PLAT_S3C64XX_REGS_USB_HSOTG_PHY_H */
diff --git a/arch/arm/plat-s3c/include/plat/regs-usb-hsotg.h b/arch/arm/plat-s3c/include/plat/regs-usb-hsotg.h
new file mode 100644
index 000000000000..8d18d9d4d148
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/regs-usb-hsotg.h
@@ -0,0 +1,377 @@
1/* arch/arm/plat-s3c/include/plat/regs-usb-hsotg.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * S3C - USB2.0 Highspeed/OtG device block registers
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#ifndef __PLAT_S3C64XX_REGS_USB_HSOTG_H
16#define __PLAT_S3C64XX_REGS_USB_HSOTG_H __FILE__
17
18#define S3C_HSOTG_REG(x) (x)
19
20#define S3C_GOTGCTL S3C_HSOTG_REG(0x000)
21#define S3C_GOTGCTL_BSESVLD (1 << 19)
22#define S3C_GOTGCTL_ASESVLD (1 << 18)
23#define S3C_GOTGCTL_DBNC_SHORT (1 << 17)
24#define S3C_GOTGCTL_CONID_B (1 << 16)
25#define S3C_GOTGCTL_DEVHNPEN (1 << 11)
26#define S3C_GOTGCTL_HSSETHNPEN (1 << 10)
27#define S3C_GOTGCTL_HNPREQ (1 << 9)
28#define S3C_GOTGCTL_HSTNEGSCS (1 << 8)
29#define S3C_GOTGCTL_SESREQ (1 << 1)
30#define S3C_GOTGCTL_SESREQSCS (1 << 0)
31
32#define S3C_GOTGINT S3C_HSOTG_REG(0x004)
33#define S3C_GOTGINT_DbnceDone (1 << 19)
34#define S3C_GOTGINT_ADevTOUTChg (1 << 18)
35#define S3C_GOTGINT_HstNegDet (1 << 17)
36#define S3C_GOTGINT_HstnegSucStsChng (1 << 9)
37#define S3C_GOTGINT_SesReqSucStsChng (1 << 8)
38#define S3C_GOTGINT_SesEndDet (1 << 2)
39
40#define S3C_GAHBCFG S3C_HSOTG_REG(0x008)
41#define S3C_GAHBCFG_PTxFEmpLvl (1 << 8)
42#define S3C_GAHBCFG_NPTxFEmpLvl (1 << 7)
43#define S3C_GAHBCFG_DMAEn (1 << 5)
44#define S3C_GAHBCFG_HBstLen_MASK (0xf << 1)
45#define S3C_GAHBCFG_HBstLen_SHIFT (1)
46#define S3C_GAHBCFG_HBstLen_Single (0x0 << 1)
47#define S3C_GAHBCFG_HBstLen_Incr (0x1 << 1)
48#define S3C_GAHBCFG_HBstLen_Incr4 (0x3 << 1)
49#define S3C_GAHBCFG_HBstLen_Incr8 (0x5 << 1)
50#define S3C_GAHBCFG_HBstLen_Incr16 (0x7 << 1)
51#define S3C_GAHBCFG_GlblIntrEn (1 << 0)
52
53#define S3C_GUSBCFG S3C_HSOTG_REG(0x00C)
54#define S3C_GUSBCFG_PHYLPClkSel (1 << 15)
55#define S3C_GUSBCFG_HNPCap (1 << 9)
56#define S3C_GUSBCFG_SRPCap (1 << 8)
57#define S3C_GUSBCFG_PHYIf16 (1 << 3)
58#define S3C_GUSBCFG_TOutCal_MASK (0x7 << 0)
59#define S3C_GUSBCFG_TOutCal_SHIFT (0)
60#define S3C_GUSBCFG_TOutCal_LIMIT (0x7)
61#define S3C_GUSBCFG_TOutCal(_x) ((_x) << 0)
62
63#define S3C_GRSTCTL S3C_HSOTG_REG(0x010)
64
65#define S3C_GRSTCTL_AHBIdle (1 << 31)
66#define S3C_GRSTCTL_DMAReq (1 << 30)
67#define S3C_GRSTCTL_TxFNum_MASK (0x1f << 6)
68#define S3C_GRSTCTL_TxFNum_SHIFT (6)
69#define S3C_GRSTCTL_TxFNum_LIMIT (0x1f)
70#define S3C_GRSTCTL_TxFNum(_x) ((_x) << 6)
71#define S3C_GRSTCTL_TxFFlsh (1 << 5)
72#define S3C_GRSTCTL_RxFFlsh (1 << 4)
73#define S3C_GRSTCTL_INTknQFlsh (1 << 3)
74#define S3C_GRSTCTL_FrmCntrRst (1 << 2)
75#define S3C_GRSTCTL_HSftRst (1 << 1)
76#define S3C_GRSTCTL_CSftRst (1 << 0)
77
78#define S3C_GINTSTS S3C_HSOTG_REG(0x014)
79#define S3C_GINTMSK S3C_HSOTG_REG(0x018)
80
81#define S3C_GINTSTS_WkUpInt (1 << 31)
82#define S3C_GINTSTS_SessReqInt (1 << 30)
83#define S3C_GINTSTS_DisconnInt (1 << 29)
84#define S3C_GINTSTS_ConIDStsChng (1 << 28)
85#define S3C_GINTSTS_PTxFEmp (1 << 26)
86#define S3C_GINTSTS_HChInt (1 << 25)
87#define S3C_GINTSTS_PrtInt (1 << 24)
88#define S3C_GINTSTS_FetSusp (1 << 22)
89#define S3C_GINTSTS_incompIP (1 << 21)
90#define S3C_GINTSTS_IncomplSOIN (1 << 20)
91#define S3C_GINTSTS_OEPInt (1 << 19)
92#define S3C_GINTSTS_IEPInt (1 << 18)
93#define S3C_GINTSTS_EPMis (1 << 17)
94#define S3C_GINTSTS_EOPF (1 << 15)
95#define S3C_GINTSTS_ISOutDrop (1 << 14)
96#define S3C_GINTSTS_EnumDone (1 << 13)
97#define S3C_GINTSTS_USBRst (1 << 12)
98#define S3C_GINTSTS_USBSusp (1 << 11)
99#define S3C_GINTSTS_ErlySusp (1 << 10)
100#define S3C_GINTSTS_GOUTNakEff (1 << 7)
101#define S3C_GINTSTS_GINNakEff (1 << 6)
102#define S3C_GINTSTS_NPTxFEmp (1 << 5)
103#define S3C_GINTSTS_RxFLvl (1 << 4)
104#define S3C_GINTSTS_SOF (1 << 3)
105#define S3C_GINTSTS_OTGInt (1 << 2)
106#define S3C_GINTSTS_ModeMis (1 << 1)
107#define S3C_GINTSTS_CurMod_Host (1 << 0)
108
109#define S3C_GRXSTSR S3C_HSOTG_REG(0x01C)
110#define S3C_GRXSTSP S3C_HSOTG_REG(0x020)
111
112#define S3C_GRXSTS_FN_MASK (0x7f << 25)
113#define S3C_GRXSTS_FN_SHIFT (25)
114
115#define S3C_GRXSTS_PktSts_MASK (0xf << 17)
116#define S3C_GRXSTS_PktSts_SHIFT (17)
117#define S3C_GRXSTS_PktSts_GlobalOutNAK (0x1 << 17)
118#define S3C_GRXSTS_PktSts_OutRX (0x2 << 17)
119#define S3C_GRXSTS_PktSts_OutDone (0x3 << 17)
120#define S3C_GRXSTS_PktSts_SetupDone (0x4 << 17)
121#define S3C_GRXSTS_PktSts_SetupRX (0x6 << 17)
122
123#define S3C_GRXSTS_DPID_MASK (0x3 << 15)
124#define S3C_GRXSTS_DPID_SHIFT (15)
125#define S3C_GRXSTS_ByteCnt_MASK (0x7ff << 4)
126#define S3C_GRXSTS_ByteCnt_SHIFT (4)
127#define S3C_GRXSTS_EPNum_MASK (0xf << 0)
128#define S3C_GRXSTS_EPNum_SHIFT (0)
129
130#define S3C_GRXFSIZ S3C_HSOTG_REG(0x024)
131
132#define S3C_GNPTXFSIZ S3C_HSOTG_REG(0x028)
133
134#define S3C_GNPTXFSIZ_NPTxFDep_MASK (0xffff << 16)
135#define S3C_GNPTXFSIZ_NPTxFDep_SHIFT (16)
136#define S3C_GNPTXFSIZ_NPTxFDep_LIMIT (0xffff)
137#define S3C_GNPTXFSIZ_NPTxFDep(_x) ((_x) << 16)
138#define S3C_GNPTXFSIZ_NPTxFStAddr_MASK (0xffff << 0)
139#define S3C_GNPTXFSIZ_NPTxFStAddr_SHIFT (0)
140#define S3C_GNPTXFSIZ_NPTxFStAddr_LIMIT (0xffff)
141#define S3C_GNPTXFSIZ_NPTxFStAddr(_x) ((_x) << 0)
142
143#define S3C_GNPTXSTS S3C_HSOTG_REG(0x02C)
144
145#define S3C_GNPTXSTS_NPtxQTop_MASK (0x7f << 24)
146#define S3C_GNPTXSTS_NPtxQTop_SHIFT (24)
147
148#define S3C_GNPTXSTS_NPTxQSpcAvail_MASK (0xff << 16)
149#define S3C_GNPTXSTS_NPTxQSpcAvail_SHIFT (16)
150#define S3C_GNPTXSTS_NPTxQSpcAvail_GET(_v) (((_v) >> 16) & 0xff)
151
152#define S3C_GNPTXSTS_NPTxFSpcAvail_MASK (0xffff << 0)
153#define S3C_GNPTXSTS_NPTxFSpcAvail_SHIFT (0)
154#define S3C_GNPTXSTS_NPTxFSpcAvail_GET(_v) (((_v) >> 0) & 0xffff)
155
156
157#define S3C_HPTXFSIZ S3C_HSOTG_REG(0x100)
158
159#define S3C_DPTXFSIZn(_a) S3C_HSOTG_REG(0x104 + (((_a) - 1) * 4))
160
161#define S3C_DPTXFSIZn_DPTxFSize_MASK (0xffff << 16)
162#define S3C_DPTXFSIZn_DPTxFSize_SHIFT (16)
163#define S3C_DPTXFSIZn_DPTxFSize_GET(_v) (((_v) >> 16) & 0xffff)
164#define S3C_DPTXFSIZn_DPTxFSize_LIMIT (0xffff)
165#define S3C_DPTXFSIZn_DPTxFSize(_x) ((_x) << 16)
166
167#define S3C_DPTXFSIZn_DPTxFStAddr_MASK (0xffff << 0)
168#define S3C_DPTXFSIZn_DPTxFStAddr_SHIFT (0)
169
170/* Device mode registers */
171#define S3C_DCFG S3C_HSOTG_REG(0x800)
172
173#define S3C_DCFG_EPMisCnt_MASK (0x1f << 18)
174#define S3C_DCFG_EPMisCnt_SHIFT (18)
175#define S3C_DCFG_EPMisCnt_LIMIT (0x1f)
176#define S3C_DCFG_EPMisCnt(_x) ((_x) << 18)
177
178#define S3C_DCFG_PerFrInt_MASK (0x3 << 11)
179#define S3C_DCFG_PerFrInt_SHIFT (11)
180#define S3C_DCFG_PerFrInt_LIMIT (0x3)
181#define S3C_DCFG_PerFrInt(_x) ((_x) << 11)
182
183#define S3C_DCFG_DevAddr_MASK (0x7f << 4)
184#define S3C_DCFG_DevAddr_SHIFT (4)
185#define S3C_DCFG_DevAddr_LIMIT (0x7f)
186#define S3C_DCFG_DevAddr(_x) ((_x) << 4)
187
188#define S3C_DCFG_NZStsOUTHShk (1 << 2)
189
190#define S3C_DCFG_DevSpd_MASK (0x3 << 0)
191#define S3C_DCFG_DevSpd_SHIFT (0)
192#define S3C_DCFG_DevSpd_HS (0x0 << 0)
193#define S3C_DCFG_DevSpd_FS (0x1 << 0)
194#define S3C_DCFG_DevSpd_LS (0x2 << 0)
195#define S3C_DCFG_DevSpd_FS48 (0x3 << 0)
196
197#define S3C_DCTL S3C_HSOTG_REG(0x804)
198
199#define S3C_DCTL_PWROnPrgDone (1 << 11)
200#define S3C_DCTL_CGOUTNak (1 << 10)
201#define S3C_DCTL_SGOUTNak (1 << 9)
202#define S3C_DCTL_CGNPInNAK (1 << 8)
203#define S3C_DCTL_SGNPInNAK (1 << 7)
204#define S3C_DCTL_TstCtl_MASK (0x7 << 4)
205#define S3C_DCTL_TstCtl_SHIFT (4)
206#define S3C_DCTL_GOUTNakSts (1 << 3)
207#define S3C_DCTL_GNPINNakSts (1 << 2)
208#define S3C_DCTL_SftDiscon (1 << 1)
209#define S3C_DCTL_RmtWkUpSig (1 << 0)
210
211#define S3C_DSTS S3C_HSOTG_REG(0x808)
212
213#define S3C_DSTS_SOFFN_MASK (0x3fff << 8)
214#define S3C_DSTS_SOFFN_SHIFT (8)
215#define S3C_DSTS_SOFFN_LIMIT (0x3fff)
216#define S3C_DSTS_SOFFN(_x) ((_x) << 8)
217#define S3C_DSTS_ErraticErr (1 << 3)
218#define S3C_DSTS_EnumSpd_MASK (0x3 << 1)
219#define S3C_DSTS_EnumSpd_SHIFT (1)
220#define S3C_DSTS_EnumSpd_HS (0x0 << 1)
221#define S3C_DSTS_EnumSpd_FS (0x1 << 1)
222#define S3C_DSTS_EnumSpd_LS (0x2 << 1)
223#define S3C_DSTS_EnumSpd_FS48 (0x3 << 1)
224
225#define S3C_DSTS_SuspSts (1 << 0)
226
227#define S3C_DIEPMSK S3C_HSOTG_REG(0x810)
228
229#define S3C_DIEPMSK_INEPNakEffMsk (1 << 6)
230#define S3C_DIEPMSK_INTknEPMisMsk (1 << 5)
231#define S3C_DIEPMSK_INTknTXFEmpMsk (1 << 4)
232#define S3C_DIEPMSK_TimeOUTMsk (1 << 3)
233#define S3C_DIEPMSK_AHBErrMsk (1 << 2)
234#define S3C_DIEPMSK_EPDisbldMsk (1 << 1)
235#define S3C_DIEPMSK_XferComplMsk (1 << 0)
236
237#define S3C_DOEPMSK S3C_HSOTG_REG(0x814)
238
239#define S3C_DOEPMSK_Back2BackSetup (1 << 6)
240#define S3C_DOEPMSK_OUTTknEPdisMsk (1 << 4)
241#define S3C_DOEPMSK_SetupMsk (1 << 3)
242#define S3C_DOEPMSK_AHBErrMsk (1 << 2)
243#define S3C_DOEPMSK_EPDisbldMsk (1 << 1)
244#define S3C_DOEPMSK_XferComplMsk (1 << 0)
245
246#define S3C_DAINT S3C_HSOTG_REG(0x818)
247#define S3C_DAINTMSK S3C_HSOTG_REG(0x81C)
248
249#define S3C_DAINT_OutEP_SHIFT (16)
250#define S3C_DAINT_OutEP(x) (1 << ((x) + 16))
251#define S3C_DAINT_InEP(x) (1 << (x))
252
253#define S3C_DTKNQR1 S3C_HSOTG_REG(0x820)
254#define S3C_DTKNQR2 S3C_HSOTG_REG(0x824)
255#define S3C_DTKNQR3 S3C_HSOTG_REG(0x830)
256#define S3C_DTKNQR4 S3C_HSOTG_REG(0x834)
257
258#define S3C_DVBUSDIS S3C_HSOTG_REG(0x828)
259#define S3C_DVBUSPULSE S3C_HSOTG_REG(0x82C)
260
261#define S3C_DIEPCTL0 S3C_HSOTG_REG(0x900)
262#define S3C_DOEPCTL0 S3C_HSOTG_REG(0xB00)
263#define S3C_DIEPCTL(_a) S3C_HSOTG_REG(0x900 + ((_a) * 0x20))
264#define S3C_DOEPCTL(_a) S3C_HSOTG_REG(0xB00 + ((_a) * 0x20))
265
266/* EP0 specialness:
267 * bits[29..28] - reserved (no SetD0PID, SetD1PID)
268 * bits[25..22] - should always be zero, this isn't a periodic endpoint
269 * bits[10..0] - MPS setting differenct for EP0
270*/
271#define S3C_D0EPCTL_MPS_MASK (0x3 << 0)
272#define S3C_D0EPCTL_MPS_SHIFT (0)
273#define S3C_D0EPCTL_MPS_64 (0x0 << 0)
274#define S3C_D0EPCTL_MPS_32 (0x1 << 0)
275#define S3C_D0EPCTL_MPS_16 (0x2 << 0)
276#define S3C_D0EPCTL_MPS_8 (0x3 << 0)
277
278#define S3C_DxEPCTL_EPEna (1 << 31)
279#define S3C_DxEPCTL_EPDis (1 << 30)
280#define S3C_DxEPCTL_SetD1PID (1 << 29)
281#define S3C_DxEPCTL_SetOddFr (1 << 29)
282#define S3C_DxEPCTL_SetD0PID (1 << 28)
283#define S3C_DxEPCTL_SetEvenFr (1 << 28)
284#define S3C_DxEPCTL_SNAK (1 << 27)
285#define S3C_DxEPCTL_CNAK (1 << 26)
286#define S3C_DxEPCTL_TxFNum_MASK (0xf << 22)
287#define S3C_DxEPCTL_TxFNum_SHIFT (22)
288#define S3C_DxEPCTL_TxFNum_LIMIT (0xf)
289#define S3C_DxEPCTL_TxFNum(_x) ((_x) << 22)
290
291#define S3C_DxEPCTL_Stall (1 << 21)
292#define S3C_DxEPCTL_Snp (1 << 20)
293#define S3C_DxEPCTL_EPType_MASK (0x3 << 18)
294#define S3C_DxEPCTL_EPType_SHIFT (18)
295#define S3C_DxEPCTL_EPType_Control (0x0 << 18)
296#define S3C_DxEPCTL_EPType_Iso (0x1 << 18)
297#define S3C_DxEPCTL_EPType_Bulk (0x2 << 18)
298#define S3C_DxEPCTL_EPType_Intterupt (0x3 << 18)
299
300#define S3C_DxEPCTL_NAKsts (1 << 17)
301#define S3C_DxEPCTL_DPID (1 << 16)
302#define S3C_DxEPCTL_EOFrNum (1 << 16)
303#define S3C_DxEPCTL_USBActEp (1 << 15)
304#define S3C_DxEPCTL_NextEp_MASK (0xf << 11)
305#define S3C_DxEPCTL_NextEp_SHIFT (11)
306#define S3C_DxEPCTL_NextEp_LIMIT (0xf)
307#define S3C_DxEPCTL_NextEp(_x) ((_x) << 11)
308
309#define S3C_DxEPCTL_MPS_MASK (0x7ff << 0)
310#define S3C_DxEPCTL_MPS_SHIFT (0)
311#define S3C_DxEPCTL_MPS_LIMIT (0x7ff)
312#define S3C_DxEPCTL_MPS(_x) ((_x) << 0)
313
314#define S3C_DIEPINT(_a) S3C_HSOTG_REG(0x908 + ((_a) * 0x20))
315#define S3C_DOEPINT(_a) S3C_HSOTG_REG(0xB08 + ((_a) * 0x20))
316
317#define S3C_DxEPINT_INEPNakEff (1 << 6)
318#define S3C_DxEPINT_Back2BackSetup (1 << 6)
319#define S3C_DxEPINT_INTknEPMis (1 << 5)
320#define S3C_DxEPINT_INTknTXFEmp (1 << 4)
321#define S3C_DxEPINT_OUTTknEPdis (1 << 4)
322#define S3C_DxEPINT_Timeout (1 << 3)
323#define S3C_DxEPINT_Setup (1 << 3)
324#define S3C_DxEPINT_AHBErr (1 << 2)
325#define S3C_DxEPINT_EPDisbld (1 << 1)
326#define S3C_DxEPINT_XferCompl (1 << 0)
327
328#define S3C_DIEPTSIZ0 S3C_HSOTG_REG(0x910)
329
330#define S3C_DIEPTSIZ0_PktCnt_MASK (0x3 << 19)
331#define S3C_DIEPTSIZ0_PktCnt_SHIFT (19)
332#define S3C_DIEPTSIZ0_PktCnt_LIMIT (0x3)
333#define S3C_DIEPTSIZ0_PktCnt(_x) ((_x) << 19)
334
335#define S3C_DIEPTSIZ0_XferSize_MASK (0x7f << 0)
336#define S3C_DIEPTSIZ0_XferSize_SHIFT (0)
337#define S3C_DIEPTSIZ0_XferSize_LIMIT (0x7f)
338#define S3C_DIEPTSIZ0_XferSize(_x) ((_x) << 0)
339
340
341#define DOEPTSIZ0 S3C_HSOTG_REG(0xB10)
342#define S3C_DOEPTSIZ0_SUPCnt_MASK (0x3 << 29)
343#define S3C_DOEPTSIZ0_SUPCnt_SHIFT (29)
344#define S3C_DOEPTSIZ0_SUPCnt_LIMIT (0x3)
345#define S3C_DOEPTSIZ0_SUPCnt(_x) ((_x) << 29)
346
347#define S3C_DOEPTSIZ0_PktCnt (1 << 19)
348#define S3C_DOEPTSIZ0_XferSize_MASK (0x7f << 0)
349#define S3C_DOEPTSIZ0_XferSize_SHIFT (0)
350
351#define S3C_DIEPTSIZ(_a) S3C_HSOTG_REG(0x910 + ((_a) * 0x20))
352#define S3C_DOEPTSIZ(_a) S3C_HSOTG_REG(0xB10 + ((_a) * 0x20))
353
354#define S3C_DxEPTSIZ_MC_MASK (0x3 << 29)
355#define S3C_DxEPTSIZ_MC_SHIFT (29)
356#define S3C_DxEPTSIZ_MC_LIMIT (0x3)
357#define S3C_DxEPTSIZ_MC(_x) ((_x) << 29)
358
359#define S3C_DxEPTSIZ_PktCnt_MASK (0x3ff << 19)
360#define S3C_DxEPTSIZ_PktCnt_SHIFT (19)
361#define S3C_DxEPTSIZ_PktCnt_GET(_v) (((_v) >> 19) & 0x3ff)
362#define S3C_DxEPTSIZ_PktCnt_LIMIT (0x3ff)
363#define S3C_DxEPTSIZ_PktCnt(_x) ((_x) << 19)
364
365#define S3C_DxEPTSIZ_XferSize_MASK (0x7ffff << 0)
366#define S3C_DxEPTSIZ_XferSize_SHIFT (0)
367#define S3C_DxEPTSIZ_XferSize_GET(_v) (((_v) >> 0) & 0x7ffff)
368#define S3C_DxEPTSIZ_XferSize_LIMIT (0x7ffff)
369#define S3C_DxEPTSIZ_XferSize(_x) ((_x) << 0)
370
371
372#define S3C_DIEPDMA(_a) S3C_HSOTG_REG(0x914 + ((_a) * 0x20))
373#define S3C_DOEPDMA(_a) S3C_HSOTG_REG(0xB14 + ((_a) * 0x20))
374
375#define S3C_EPFIFO(_a) S3C_HSOTG_REG(0x1000 + ((_a) * 0x1000))
376
377#endif /* __PLAT_S3C64XX_REGS_USB_HSOTG_H */
diff --git a/arch/avr32/kernel/init_task.c b/arch/avr32/kernel/init_task.c
index 993d56ee3cf3..57ec9f2dcd95 100644
--- a/arch/avr32/kernel/init_task.c
+++ b/arch/avr32/kernel/init_task.c
@@ -15,10 +15,6 @@
15 15
16static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 16static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
17static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 17static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
18struct mm_struct init_mm = INIT_MM(init_mm);
19
20EXPORT_SYMBOL(init_mm);
21
22/* 18/*
23 * Initial thread structure. Must be aligned on an 8192-byte boundary. 19 * Initial thread structure. Must be aligned on an 8192-byte boundary.
24 */ 20 */
diff --git a/arch/blackfin/include/asm/kmap_types.h b/arch/blackfin/include/asm/kmap_types.h
index e215f7104974..0a88622339ee 100644
--- a/arch/blackfin/include/asm/kmap_types.h
+++ b/arch/blackfin/include/asm/kmap_types.h
@@ -1,21 +1,6 @@
1#ifndef _ASM_KMAP_TYPES_H 1#ifndef _ASM_KMAP_TYPES_H
2#define _ASM_KMAP_TYPES_H 2#define _ASM_KMAP_TYPES_H
3 3
4enum km_type { 4#include <asm-generic/kmap_types.h>
5 KM_BOUNCE_READ,
6 KM_SKB_SUNRPC_DATA,
7 KM_SKB_DATA_SOFTIRQ,
8 KM_USER0,
9 KM_USER1,
10 KM_BIO_SRC_IRQ,
11 KM_BIO_DST_IRQ,
12 KM_PTE0,
13 KM_PTE1,
14 KM_IRQ0,
15 KM_IRQ1,
16 KM_SOFTIRQ0,
17 KM_SOFTIRQ1,
18 KM_TYPE_NR
19};
20 5
21#endif 6#endif
diff --git a/arch/blackfin/kernel/init_task.c b/arch/blackfin/kernel/init_task.c
index 2c228c020978..c26c34de9f3c 100644
--- a/arch/blackfin/kernel/init_task.c
+++ b/arch/blackfin/kernel/init_task.c
@@ -35,10 +35,6 @@
35 35
36static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 36static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
37static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 37static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
38
39struct mm_struct init_mm = INIT_MM(init_mm);
40EXPORT_SYMBOL(init_mm);
41
42/* 38/*
43 * Initial task structure. 39 * Initial task structure.
44 * 40 *
diff --git a/arch/cris/include/asm/kmap_types.h b/arch/cris/include/asm/kmap_types.h
index 492988cb9077..d2d643c4ea59 100644
--- a/arch/cris/include/asm/kmap_types.h
+++ b/arch/cris/include/asm/kmap_types.h
@@ -5,21 +5,6 @@
5 * is actually used on cris. 5 * is actually used on cris.
6 */ 6 */
7 7
8enum km_type { 8#include <asm-generic/kmap_types.h>
9 KM_BOUNCE_READ,
10 KM_SKB_SUNRPC_DATA,
11 KM_SKB_DATA_SOFTIRQ,
12 KM_USER0,
13 KM_USER1,
14 KM_BIO_SRC_IRQ,
15 KM_BIO_DST_IRQ,
16 KM_PTE0,
17 KM_PTE1,
18 KM_IRQ0,
19 KM_IRQ1,
20 KM_SOFTIRQ0,
21 KM_SOFTIRQ1,
22 KM_TYPE_NR
23};
24 9
25#endif 10#endif
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index 4df0b320d524..51dcd04d2777 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -38,10 +38,6 @@
38 38
39static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 39static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
40static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 40static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
41struct mm_struct init_mm = INIT_MM(init_mm);
42
43EXPORT_SYMBOL(init_mm);
44
45/* 41/*
46 * Initial thread structure. 42 * Initial thread structure.
47 * 43 *
diff --git a/arch/frv/kernel/init_task.c b/arch/frv/kernel/init_task.c
index 29429a8b7f6a..1d3df1d9495c 100644
--- a/arch/frv/kernel/init_task.c
+++ b/arch/frv/kernel/init_task.c
@@ -12,10 +12,6 @@
12 12
13static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 13static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
14static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 14static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
15struct mm_struct init_mm = INIT_MM(init_mm);
16
17EXPORT_SYMBOL(init_mm);
18
19/* 15/*
20 * Initial thread structure. 16 * Initial thread structure.
21 * 17 *
diff --git a/arch/h8300/include/asm/kmap_types.h b/arch/h8300/include/asm/kmap_types.h
index 1ec8a3427120..be12a7160116 100644
--- a/arch/h8300/include/asm/kmap_types.h
+++ b/arch/h8300/include/asm/kmap_types.h
@@ -1,21 +1,6 @@
1#ifndef _ASM_H8300_KMAP_TYPES_H 1#ifndef _ASM_H8300_KMAP_TYPES_H
2#define _ASM_H8300_KMAP_TYPES_H 2#define _ASM_H8300_KMAP_TYPES_H
3 3
4enum km_type { 4#include <asm-generic/kmap_types.h>
5 KM_BOUNCE_READ,
6 KM_SKB_SUNRPC_DATA,
7 KM_SKB_DATA_SOFTIRQ,
8 KM_USER0,
9 KM_USER1,
10 KM_BIO_SRC_IRQ,
11 KM_BIO_DST_IRQ,
12 KM_PTE0,
13 KM_PTE1,
14 KM_IRQ0,
15 KM_IRQ1,
16 KM_SOFTIRQ0,
17 KM_SOFTIRQ1,
18 KM_TYPE_NR
19};
20 5
21#endif 6#endif
diff --git a/arch/h8300/kernel/init_task.c b/arch/h8300/kernel/init_task.c
index cb5dc552da97..089c65ed6eb3 100644
--- a/arch/h8300/kernel/init_task.c
+++ b/arch/h8300/kernel/init_task.c
@@ -14,10 +14,6 @@
14 14
15static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 15static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
17struct mm_struct init_mm = INIT_MM(init_mm);
18
19EXPORT_SYMBOL(init_mm);
20
21/* 17/*
22 * Initial task structure. 18 * Initial task structure.
23 * 19 *
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 56ceb68eb99d..fe63b2dc9d07 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -1131,7 +1131,7 @@ sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp
1131#ifdef CONFIG_NUMA 1131#ifdef CONFIG_NUMA
1132 { 1132 {
1133 struct page *page; 1133 struct page *page;
1134 page = alloc_pages_node(ioc->node == MAX_NUMNODES ? 1134 page = alloc_pages_exact_node(ioc->node == MAX_NUMNODES ?
1135 numa_node_id() : ioc->node, flags, 1135 numa_node_id() : ioc->node, flags,
1136 get_order(size)); 1136 get_order(size));
1137 1137
diff --git a/arch/ia64/include/asm/kmap_types.h b/arch/ia64/include/asm/kmap_types.h
index 5d1658aa2b3b..05d5f9996105 100644
--- a/arch/ia64/include/asm/kmap_types.h
+++ b/arch/ia64/include/asm/kmap_types.h
@@ -1,30 +1,12 @@
1#ifndef _ASM_IA64_KMAP_TYPES_H 1#ifndef _ASM_IA64_KMAP_TYPES_H
2#define _ASM_IA64_KMAP_TYPES_H 2#define _ASM_IA64_KMAP_TYPES_H
3 3
4
5#ifdef CONFIG_DEBUG_HIGHMEM 4#ifdef CONFIG_DEBUG_HIGHMEM
6# define D(n) __KM_FENCE_##n , 5#define __WITH_KM_FENCE
7#else
8# define D(n)
9#endif 6#endif
10 7
11enum km_type { 8#include <asm-generic/kmap_types.h>
12D(0) KM_BOUNCE_READ,
13D(1) KM_SKB_SUNRPC_DATA,
14D(2) KM_SKB_DATA_SOFTIRQ,
15D(3) KM_USER0,
16D(4) KM_USER1,
17D(5) KM_BIO_SRC_IRQ,
18D(6) KM_BIO_DST_IRQ,
19D(7) KM_PTE0,
20D(8) KM_PTE1,
21D(9) KM_IRQ0,
22D(10) KM_IRQ1,
23D(11) KM_SOFTIRQ0,
24D(12) KM_SOFTIRQ1,
25D(13) KM_TYPE_NR
26};
27 9
28#undef D 10#undef __WITH_KM_FENCE
29 11
30#endif /* _ASM_IA64_KMAP_TYPES_H */ 12#endif /* _ASM_IA64_KMAP_TYPES_H */
diff --git a/arch/ia64/kernel/init_task.c b/arch/ia64/kernel/init_task.c
index 5b0e830c6f33..c475fc281be7 100644
--- a/arch/ia64/kernel/init_task.c
+++ b/arch/ia64/kernel/init_task.c
@@ -19,10 +19,6 @@
19 19
20static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 20static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
21static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 21static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
22struct mm_struct init_mm = INIT_MM(init_mm);
23
24EXPORT_SYMBOL(init_mm);
25
26/* 22/*
27 * Initial task structure. 23 * Initial task structure.
28 * 24 *
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 8f33a8840422..5b17bd402275 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -1829,8 +1829,7 @@ ia64_mca_cpu_init(void *cpu_data)
1829 data = mca_bootmem(); 1829 data = mca_bootmem();
1830 first_time = 0; 1830 first_time = 0;
1831 } else 1831 } else
1832 data = page_address(alloc_pages_node(numa_node_id(), 1832 data = __get_free_pages(GFP_KERNEL, get_order(sz));
1833 GFP_KERNEL, get_order(sz)));
1834 if (!data) 1833 if (!data)
1835 panic("Could not allocate MCA memory for cpu %d\n", 1834 panic("Could not allocate MCA memory for cpu %d\n",
1836 cpu); 1835 cpu);
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 8a06dc480594..bdc176cb5e85 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -5595,7 +5595,7 @@ pfm_interrupt_handler(int irq, void *arg)
5595 (*pfm_alt_intr_handler->handler)(irq, arg, regs); 5595 (*pfm_alt_intr_handler->handler)(irq, arg, regs);
5596 } 5596 }
5597 5597
5598 put_cpu_no_resched(); 5598 put_cpu();
5599 return IRQ_HANDLED; 5599 return IRQ_HANDLED;
5600} 5600}
5601 5601
diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c
index 8eff8c1d40a6..6ba72ab42fcc 100644
--- a/arch/ia64/kernel/uncached.c
+++ b/arch/ia64/kernel/uncached.c
@@ -98,7 +98,8 @@ static int uncached_add_chunk(struct uncached_pool *uc_pool, int nid)
98 98
99 /* attempt to allocate a granule's worth of cached memory pages */ 99 /* attempt to allocate a granule's worth of cached memory pages */
100 100
101 page = alloc_pages_node(nid, GFP_KERNEL | __GFP_ZERO | GFP_THISNODE, 101 page = alloc_pages_exact_node(nid,
102 GFP_KERNEL | __GFP_ZERO | GFP_THISNODE,
102 IA64_GRANULE_SHIFT-PAGE_SHIFT); 103 IA64_GRANULE_SHIFT-PAGE_SHIFT);
103 if (!page) { 104 if (!page) {
104 mutex_unlock(&uc_pool->add_chunk_mutex); 105 mutex_unlock(&uc_pool->add_chunk_mutex);
diff --git a/arch/ia64/sn/pci/pci_dma.c b/arch/ia64/sn/pci/pci_dma.c
index d876423e4e75..98b684928e12 100644
--- a/arch/ia64/sn/pci/pci_dma.c
+++ b/arch/ia64/sn/pci/pci_dma.c
@@ -90,7 +90,8 @@ static void *sn_dma_alloc_coherent(struct device *dev, size_t size,
90 */ 90 */
91 node = pcibus_to_node(pdev->bus); 91 node = pcibus_to_node(pdev->bus);
92 if (likely(node >=0)) { 92 if (likely(node >=0)) {
93 struct page *p = alloc_pages_node(node, flags, get_order(size)); 93 struct page *p = alloc_pages_exact_node(node,
94 flags, get_order(size));
94 95
95 if (likely(p)) 96 if (likely(p))
96 cpuaddr = page_address(p); 97 cpuaddr = page_address(p);
diff --git a/arch/m32r/include/asm/kmap_types.h b/arch/m32r/include/asm/kmap_types.h
index fa94dc6410ea..4cdb5e3a06bf 100644
--- a/arch/m32r/include/asm/kmap_types.h
+++ b/arch/m32r/include/asm/kmap_types.h
@@ -2,28 +2,11 @@
2#define __M32R_KMAP_TYPES_H 2#define __M32R_KMAP_TYPES_H
3 3
4#ifdef CONFIG_DEBUG_HIGHMEM 4#ifdef CONFIG_DEBUG_HIGHMEM
5# define D(n) __KM_FENCE_##n , 5#define __WITH_KM_FENCE
6#else
7# define D(n)
8#endif 6#endif
9 7
10enum km_type { 8#include <asm-generic/kmap_types.h>
11D(0) KM_BOUNCE_READ,
12D(1) KM_SKB_SUNRPC_DATA,
13D(2) KM_SKB_DATA_SOFTIRQ,
14D(3) KM_USER0,
15D(4) KM_USER1,
16D(5) KM_BIO_SRC_IRQ,
17D(6) KM_BIO_DST_IRQ,
18D(7) KM_PTE0,
19D(8) KM_PTE1,
20D(9) KM_IRQ0,
21D(10) KM_IRQ1,
22D(11) KM_SOFTIRQ0,
23D(12) KM_SOFTIRQ1,
24D(13) KM_TYPE_NR
25};
26 9
27#undef D 10#undef __WITH_KM_FENCE
28 11
29#endif /* __M32R_KMAP_TYPES_H */ 12#endif /* __M32R_KMAP_TYPES_H */
diff --git a/arch/m32r/kernel/init_task.c b/arch/m32r/kernel/init_task.c
index 016885c6f260..fce57e5d3f91 100644
--- a/arch/m32r/kernel/init_task.c
+++ b/arch/m32r/kernel/init_task.c
@@ -13,10 +13,6 @@
13 13
14static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 14static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
15static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 15static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
16struct mm_struct init_mm = INIT_MM(init_mm);
17
18EXPORT_SYMBOL(init_mm);
19
20/* 16/*
21 * Initial thread structure. 17 * Initial thread structure.
22 * 18 *
diff --git a/arch/m32r/mm/discontig.c b/arch/m32r/mm/discontig.c
index 7daf897292cf..b7a78ad429b7 100644
--- a/arch/m32r/mm/discontig.c
+++ b/arch/m32r/mm/discontig.c
@@ -154,9 +154,9 @@ unsigned long __init zone_sizes_init(void)
154 * Use all area of internal RAM. 154 * Use all area of internal RAM.
155 * see __alloc_pages() 155 * see __alloc_pages()
156 */ 156 */
157 NODE_DATA(1)->node_zones->pages_min = 0; 157 NODE_DATA(1)->node_zones->watermark[WMARK_MIN] = 0;
158 NODE_DATA(1)->node_zones->pages_low = 0; 158 NODE_DATA(1)->node_zones->watermark[WMARK_LOW] = 0;
159 NODE_DATA(1)->node_zones->pages_high = 0; 159 NODE_DATA(1)->node_zones->watermark[WMARK_HIGH] = 0;
160 160
161 return holes; 161 return holes;
162} 162}
diff --git a/arch/m32r/platforms/m32104ut/setup.c b/arch/m32r/platforms/m32104ut/setup.c
index 98138b4e9220..922fdfdadeaa 100644
--- a/arch/m32r/platforms/m32104ut/setup.c
+++ b/arch/m32r/platforms/m32104ut/setup.c
@@ -63,7 +63,7 @@ static void shutdown_m32104ut_irq(unsigned int irq)
63 outl(M32R_ICUCR_ILEVEL7, port); 63 outl(M32R_ICUCR_ILEVEL7, port);
64} 64}
65 65
66static struct hw_interrupt_type m32104ut_irq_type = 66static struct irq_chip m32104ut_irq_type =
67{ 67{
68 .typename = "M32104UT-IRQ", 68 .typename = "M32104UT-IRQ",
69 .startup = startup_m32104ut_irq, 69 .startup = startup_m32104ut_irq,
diff --git a/arch/m32r/platforms/m32700ut/setup.c b/arch/m32r/platforms/m32700ut/setup.c
index 77b0ae9379e9..9c1bc7487c1e 100644
--- a/arch/m32r/platforms/m32700ut/setup.c
+++ b/arch/m32r/platforms/m32700ut/setup.c
@@ -69,7 +69,7 @@ static void shutdown_m32700ut_irq(unsigned int irq)
69 outl(M32R_ICUCR_ILEVEL7, port); 69 outl(M32R_ICUCR_ILEVEL7, port);
70} 70}
71 71
72static struct hw_interrupt_type m32700ut_irq_type = 72static struct irq_chip m32700ut_irq_type =
73{ 73{
74 .typename = "M32700UT-IRQ", 74 .typename = "M32700UT-IRQ",
75 .startup = startup_m32700ut_irq, 75 .startup = startup_m32700ut_irq,
@@ -146,7 +146,7 @@ static void shutdown_m32700ut_pld_irq(unsigned int irq)
146 outw(PLD_ICUCR_ILEVEL7, port); 146 outw(PLD_ICUCR_ILEVEL7, port);
147} 147}
148 148
149static struct hw_interrupt_type m32700ut_pld_irq_type = 149static struct irq_chip m32700ut_pld_irq_type =
150{ 150{
151 .typename = "M32700UT-PLD-IRQ", 151 .typename = "M32700UT-PLD-IRQ",
152 .startup = startup_m32700ut_pld_irq, 152 .startup = startup_m32700ut_pld_irq,
@@ -215,7 +215,7 @@ static void shutdown_m32700ut_lanpld_irq(unsigned int irq)
215 outw(PLD_ICUCR_ILEVEL7, port); 215 outw(PLD_ICUCR_ILEVEL7, port);
216} 216}
217 217
218static struct hw_interrupt_type m32700ut_lanpld_irq_type = 218static struct irq_chip m32700ut_lanpld_irq_type =
219{ 219{
220 .typename = "M32700UT-PLD-LAN-IRQ", 220 .typename = "M32700UT-PLD-LAN-IRQ",
221 .startup = startup_m32700ut_lanpld_irq, 221 .startup = startup_m32700ut_lanpld_irq,
@@ -284,7 +284,7 @@ static void shutdown_m32700ut_lcdpld_irq(unsigned int irq)
284 outw(PLD_ICUCR_ILEVEL7, port); 284 outw(PLD_ICUCR_ILEVEL7, port);
285} 285}
286 286
287static struct hw_interrupt_type m32700ut_lcdpld_irq_type = 287static struct irq_chip m32700ut_lcdpld_irq_type =
288{ 288{
289 .typename = "M32700UT-PLD-LCD-IRQ", 289 .typename = "M32700UT-PLD-LCD-IRQ",
290 .startup = startup_m32700ut_lcdpld_irq, 290 .startup = startup_m32700ut_lcdpld_irq,
diff --git a/arch/m32r/platforms/mappi/setup.c b/arch/m32r/platforms/mappi/setup.c
index 3ec087ff2214..fb4b17799b66 100644
--- a/arch/m32r/platforms/mappi/setup.c
+++ b/arch/m32r/platforms/mappi/setup.c
@@ -63,7 +63,7 @@ static void shutdown_mappi_irq(unsigned int irq)
63 outl(M32R_ICUCR_ILEVEL7, port); 63 outl(M32R_ICUCR_ILEVEL7, port);
64} 64}
65 65
66static struct hw_interrupt_type mappi_irq_type = 66static struct irq_chip mappi_irq_type =
67{ 67{
68 .typename = "MAPPI-IRQ", 68 .typename = "MAPPI-IRQ",
69 .startup = startup_mappi_irq, 69 .startup = startup_mappi_irq,
diff --git a/arch/m32r/platforms/mappi2/setup.c b/arch/m32r/platforms/mappi2/setup.c
index d87969c6356e..6a65eda0a056 100644
--- a/arch/m32r/platforms/mappi2/setup.c
+++ b/arch/m32r/platforms/mappi2/setup.c
@@ -70,7 +70,7 @@ static void shutdown_mappi2_irq(unsigned int irq)
70 outl(M32R_ICUCR_ILEVEL7, port); 70 outl(M32R_ICUCR_ILEVEL7, port);
71} 71}
72 72
73static struct hw_interrupt_type mappi2_irq_type = 73static struct irq_chip mappi2_irq_type =
74{ 74{
75 .typename = "MAPPI2-IRQ", 75 .typename = "MAPPI2-IRQ",
76 .startup = startup_mappi2_irq, 76 .startup = startup_mappi2_irq,
diff --git a/arch/m32r/platforms/mappi3/setup.c b/arch/m32r/platforms/mappi3/setup.c
index 785b4bd6d9fd..9c337aeac94b 100644
--- a/arch/m32r/platforms/mappi3/setup.c
+++ b/arch/m32r/platforms/mappi3/setup.c
@@ -70,7 +70,7 @@ static void shutdown_mappi3_irq(unsigned int irq)
70 outl(M32R_ICUCR_ILEVEL7, port); 70 outl(M32R_ICUCR_ILEVEL7, port);
71} 71}
72 72
73static struct hw_interrupt_type mappi3_irq_type = 73static struct irq_chip mappi3_irq_type =
74{ 74{
75 .typename = "MAPPI3-IRQ", 75 .typename = "MAPPI3-IRQ",
76 .startup = startup_mappi3_irq, 76 .startup = startup_mappi3_irq,
diff --git a/arch/m32r/platforms/oaks32r/setup.c b/arch/m32r/platforms/oaks32r/setup.c
index 6faa5db68e95..ed865741c38d 100644
--- a/arch/m32r/platforms/oaks32r/setup.c
+++ b/arch/m32r/platforms/oaks32r/setup.c
@@ -61,7 +61,7 @@ static void shutdown_oaks32r_irq(unsigned int irq)
61 outl(M32R_ICUCR_ILEVEL7, port); 61 outl(M32R_ICUCR_ILEVEL7, port);
62} 62}
63 63
64static struct hw_interrupt_type oaks32r_irq_type = 64static struct irq_chip oaks32r_irq_type =
65{ 65{
66 .typename = "OAKS32R-IRQ", 66 .typename = "OAKS32R-IRQ",
67 .startup = startup_oaks32r_irq, 67 .startup = startup_oaks32r_irq,
diff --git a/arch/m32r/platforms/opsput/setup.c b/arch/m32r/platforms/opsput/setup.c
index fab13fd85422..80d680657019 100644
--- a/arch/m32r/platforms/opsput/setup.c
+++ b/arch/m32r/platforms/opsput/setup.c
@@ -70,7 +70,7 @@ static void shutdown_opsput_irq(unsigned int irq)
70 outl(M32R_ICUCR_ILEVEL7, port); 70 outl(M32R_ICUCR_ILEVEL7, port);
71} 71}
72 72
73static struct hw_interrupt_type opsput_irq_type = 73static struct irq_chip opsput_irq_type =
74{ 74{
75 .typename = "OPSPUT-IRQ", 75 .typename = "OPSPUT-IRQ",
76 .startup = startup_opsput_irq, 76 .startup = startup_opsput_irq,
@@ -147,7 +147,7 @@ static void shutdown_opsput_pld_irq(unsigned int irq)
147 outw(PLD_ICUCR_ILEVEL7, port); 147 outw(PLD_ICUCR_ILEVEL7, port);
148} 148}
149 149
150static struct hw_interrupt_type opsput_pld_irq_type = 150static struct irq_chip opsput_pld_irq_type =
151{ 151{
152 .typename = "OPSPUT-PLD-IRQ", 152 .typename = "OPSPUT-PLD-IRQ",
153 .startup = startup_opsput_pld_irq, 153 .startup = startup_opsput_pld_irq,
@@ -216,7 +216,7 @@ static void shutdown_opsput_lanpld_irq(unsigned int irq)
216 outw(PLD_ICUCR_ILEVEL7, port); 216 outw(PLD_ICUCR_ILEVEL7, port);
217} 217}
218 218
219static struct hw_interrupt_type opsput_lanpld_irq_type = 219static struct irq_chip opsput_lanpld_irq_type =
220{ 220{
221 .typename = "OPSPUT-PLD-LAN-IRQ", 221 .typename = "OPSPUT-PLD-LAN-IRQ",
222 .startup = startup_opsput_lanpld_irq, 222 .startup = startup_opsput_lanpld_irq,
@@ -285,7 +285,7 @@ static void shutdown_opsput_lcdpld_irq(unsigned int irq)
285 outw(PLD_ICUCR_ILEVEL7, port); 285 outw(PLD_ICUCR_ILEVEL7, port);
286} 286}
287 287
288static struct hw_interrupt_type opsput_lcdpld_irq_type = 288static struct irq_chip opsput_lcdpld_irq_type =
289{ 289{
290 "OPSPUT-PLD-LCD-IRQ", 290 "OPSPUT-PLD-LCD-IRQ",
291 startup_opsput_lcdpld_irq, 291 startup_opsput_lcdpld_irq,
diff --git a/arch/m32r/platforms/usrv/setup.c b/arch/m32r/platforms/usrv/setup.c
index 89588d649eb7..757302660af8 100644
--- a/arch/m32r/platforms/usrv/setup.c
+++ b/arch/m32r/platforms/usrv/setup.c
@@ -61,7 +61,7 @@ static void shutdown_mappi_irq(unsigned int irq)
61 outl(M32R_ICUCR_ILEVEL7, port); 61 outl(M32R_ICUCR_ILEVEL7, port);
62} 62}
63 63
64static struct hw_interrupt_type mappi_irq_type = 64static struct irq_chip mappi_irq_type =
65{ 65{
66 .typename = "M32700-IRQ", 66 .typename = "M32700-IRQ",
67 .startup = startup_mappi_irq, 67 .startup = startup_mappi_irq,
@@ -134,7 +134,7 @@ static void shutdown_m32700ut_pld_irq(unsigned int irq)
134 outw(PLD_ICUCR_ILEVEL7, port); 134 outw(PLD_ICUCR_ILEVEL7, port);
135} 135}
136 136
137static struct hw_interrupt_type m32700ut_pld_irq_type = 137static struct irq_chip m32700ut_pld_irq_type =
138{ 138{
139 .typename = "USRV-PLD-IRQ", 139 .typename = "USRV-PLD-IRQ",
140 .startup = startup_m32700ut_pld_irq, 140 .startup = startup_m32700ut_pld_irq,
diff --git a/arch/m68k/include/asm/kmap_types.h b/arch/m68k/include/asm/kmap_types.h
index c843c63d3801..3413cc1390ec 100644
--- a/arch/m68k/include/asm/kmap_types.h
+++ b/arch/m68k/include/asm/kmap_types.h
@@ -1,21 +1,6 @@
1#ifndef __ASM_M68K_KMAP_TYPES_H 1#ifndef __ASM_M68K_KMAP_TYPES_H
2#define __ASM_M68K_KMAP_TYPES_H 2#define __ASM_M68K_KMAP_TYPES_H
3 3
4enum km_type { 4#include <asm-generic/kmap_types.h>
5 KM_BOUNCE_READ,
6 KM_SKB_SUNRPC_DATA,
7 KM_SKB_DATA_SOFTIRQ,
8 KM_USER0,
9 KM_USER1,
10 KM_BIO_SRC_IRQ,
11 KM_BIO_DST_IRQ,
12 KM_PTE0,
13 KM_PTE1,
14 KM_IRQ0,
15 KM_IRQ1,
16 KM_SOFTIRQ0,
17 KM_SOFTIRQ1,
18 KM_TYPE_NR
19};
20 5
21#endif /* __ASM_M68K_KMAP_TYPES_H */ 6#endif /* __ASM_M68K_KMAP_TYPES_H */
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index ec37fb56c127..72bad65dba3a 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -42,10 +42,6 @@
42 */ 42 */
43static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 43static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
44static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 44static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
45struct mm_struct init_mm = INIT_MM(init_mm);
46
47EXPORT_SYMBOL(init_mm);
48
49union thread_union init_thread_union 45union thread_union init_thread_union
50__attribute__((section(".data.init_task"), aligned(THREAD_SIZE))) 46__attribute__((section(".data.init_task"), aligned(THREAD_SIZE)))
51 = { INIT_THREAD_INFO(init_task) }; 47 = { INIT_THREAD_INFO(init_task) };
diff --git a/arch/m68knommu/kernel/init_task.c b/arch/m68knommu/kernel/init_task.c
index fe282de1d596..45e97a207fed 100644
--- a/arch/m68knommu/kernel/init_task.c
+++ b/arch/m68knommu/kernel/init_task.c
@@ -14,10 +14,6 @@
14 14
15static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 15static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
17struct mm_struct init_mm = INIT_MM(init_mm);
18
19EXPORT_SYMBOL(init_mm);
20
21/* 17/*
22 * Initial task structure. 18 * Initial task structure.
23 * 19 *
diff --git a/arch/microblaze/include/asm/kmap_types.h b/arch/microblaze/include/asm/kmap_types.h
index 4d7e222f5dd7..25975252d83d 100644
--- a/arch/microblaze/include/asm/kmap_types.h
+++ b/arch/microblaze/include/asm/kmap_types.h
@@ -1,29 +1,6 @@
1/*
2 * Copyright (C) 2006 Atmark Techno, Inc.
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 */
8
9#ifndef _ASM_MICROBLAZE_KMAP_TYPES_H 1#ifndef _ASM_MICROBLAZE_KMAP_TYPES_H
10#define _ASM_MICROBLAZE_KMAP_TYPES_H 2#define _ASM_MICROBLAZE_KMAP_TYPES_H
11 3
12enum km_type { 4#include <asm-generic/kmap_types.h>
13 KM_BOUNCE_READ,
14 KM_SKB_SUNRPC_DATA,
15 KM_SKB_DATA_SOFTIRQ,
16 KM_USER0,
17 KM_USER1,
18 KM_BIO_SRC_IRQ,
19 KM_BIO_DST_IRQ,
20 KM_PTE0,
21 KM_PTE1,
22 KM_IRQ0,
23 KM_IRQ1,
24 KM_SOFTIRQ0,
25 KM_SOFTIRQ1,
26 KM_TYPE_NR,
27};
28 5
29#endif /* _ASM_MICROBLAZE_KMAP_TYPES_H */ 6#endif /* _ASM_MICROBLAZE_KMAP_TYPES_H */
diff --git a/arch/mips/include/asm/i8253.h b/arch/mips/include/asm/i8253.h
index 5dabc870b322..032ca73f181b 100644
--- a/arch/mips/include/asm/i8253.h
+++ b/arch/mips/include/asm/i8253.h
@@ -12,8 +12,6 @@
12#define PIT_CH0 0x40 12#define PIT_CH0 0x40
13#define PIT_CH2 0x42 13#define PIT_CH2 0x42
14 14
15#define PIT_TICK_RATE 1193182UL
16
17extern spinlock_t i8253_lock; 15extern spinlock_t i8253_lock;
18 16
19extern void setup_pit_timer(void); 17extern void setup_pit_timer(void);
diff --git a/arch/mips/include/asm/kmap_types.h b/arch/mips/include/asm/kmap_types.h
index 806aae3c5338..58e91ed0388f 100644
--- a/arch/mips/include/asm/kmap_types.h
+++ b/arch/mips/include/asm/kmap_types.h
@@ -1,30 +1,12 @@
1#ifndef _ASM_KMAP_TYPES_H 1#ifndef _ASM_KMAP_TYPES_H
2#define _ASM_KMAP_TYPES_H 2#define _ASM_KMAP_TYPES_H
3 3
4
5#ifdef CONFIG_DEBUG_HIGHMEM 4#ifdef CONFIG_DEBUG_HIGHMEM
6# define D(n) __KM_FENCE_##n , 5#define __WITH_KM_FENCE
7#else
8# define D(n)
9#endif 6#endif
10 7
11enum km_type { 8#include <asm-generic/kmap_types.h>
12D(0) KM_BOUNCE_READ,
13D(1) KM_SKB_SUNRPC_DATA,
14D(2) KM_SKB_DATA_SOFTIRQ,
15D(3) KM_USER0,
16D(4) KM_USER1,
17D(5) KM_BIO_SRC_IRQ,
18D(6) KM_BIO_DST_IRQ,
19D(7) KM_PTE0,
20D(8) KM_PTE1,
21D(9) KM_IRQ0,
22D(10) KM_IRQ1,
23D(11) KM_SOFTIRQ0,
24D(12) KM_SOFTIRQ1,
25D(13) KM_TYPE_NR
26};
27 9
28#undef D 10#undef __WITH_KM_FENCE
29 11
30#endif 12#endif
diff --git a/arch/mips/kernel/init_task.c b/arch/mips/kernel/init_task.c
index 149cd914526e..5b457a40c784 100644
--- a/arch/mips/kernel/init_task.c
+++ b/arch/mips/kernel/init_task.c
@@ -11,10 +11,6 @@
11 11
12static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 12static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
13static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 13static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
14struct mm_struct init_mm = INIT_MM(init_mm);
15
16EXPORT_SYMBOL(init_mm);
17
18/* 14/*
19 * Initial thread structure. 15 * Initial thread structure.
20 * 16 *
diff --git a/arch/mips/sni/eisa.c b/arch/mips/sni/eisa.c
index 7396cd719900..6827feb4de96 100644
--- a/arch/mips/sni/eisa.c
+++ b/arch/mips/sni/eisa.c
@@ -38,7 +38,7 @@ int __init sni_eisa_root_init(void)
38 if (!r) 38 if (!r)
39 return r; 39 return r;
40 40
41 eisa_root_dev.dev.driver_data = &eisa_bus_root; 41 dev_set_drvdata(&eisa_root_dev.dev, &eisa_bus_root);
42 42
43 if (eisa_root_register(&eisa_bus_root)) { 43 if (eisa_root_register(&eisa_bus_root)) {
44 /* A real bridge may have been registered before 44 /* A real bridge may have been registered before
diff --git a/arch/mn10300/include/asm/kmap_types.h b/arch/mn10300/include/asm/kmap_types.h
index 3398f9f35603..76d093b58d4f 100644
--- a/arch/mn10300/include/asm/kmap_types.h
+++ b/arch/mn10300/include/asm/kmap_types.h
@@ -1,31 +1,6 @@
1/* MN10300 kmap_atomic() slot IDs
2 *
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
10 */
11#ifndef _ASM_KMAP_TYPES_H 1#ifndef _ASM_KMAP_TYPES_H
12#define _ASM_KMAP_TYPES_H 2#define _ASM_KMAP_TYPES_H
13 3
14enum km_type { 4#include <asm-generic/kmap_types.h>
15 KM_BOUNCE_READ,
16 KM_SKB_SUNRPC_DATA,
17 KM_SKB_DATA_SOFTIRQ,
18 KM_USER0,
19 KM_USER1,
20 KM_BIO_SRC_IRQ,
21 KM_BIO_DST_IRQ,
22 KM_PTE0,
23 KM_PTE1,
24 KM_IRQ0,
25 KM_IRQ1,
26 KM_SOFTIRQ0,
27 KM_SOFTIRQ1,
28 KM_TYPE_NR
29};
30 5
31#endif /* _ASM_KMAP_TYPES_H */ 6#endif /* _ASM_KMAP_TYPES_H */
diff --git a/arch/mn10300/kernel/init_task.c b/arch/mn10300/kernel/init_task.c
index 5ac3566f8c98..80d423b80af3 100644
--- a/arch/mn10300/kernel/init_task.c
+++ b/arch/mn10300/kernel/init_task.c
@@ -20,9 +20,6 @@
20 20
21static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 21static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
22static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 22static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
23struct mm_struct init_mm = INIT_MM(init_mm);
24EXPORT_SYMBOL(init_mm);
25
26/* 23/*
27 * Initial thread structure. 24 * Initial thread structure.
28 * 25 *
diff --git a/arch/parisc/include/asm/kmap_types.h b/arch/parisc/include/asm/kmap_types.h
index 806aae3c5338..58e91ed0388f 100644
--- a/arch/parisc/include/asm/kmap_types.h
+++ b/arch/parisc/include/asm/kmap_types.h
@@ -1,30 +1,12 @@
1#ifndef _ASM_KMAP_TYPES_H 1#ifndef _ASM_KMAP_TYPES_H
2#define _ASM_KMAP_TYPES_H 2#define _ASM_KMAP_TYPES_H
3 3
4
5#ifdef CONFIG_DEBUG_HIGHMEM 4#ifdef CONFIG_DEBUG_HIGHMEM
6# define D(n) __KM_FENCE_##n , 5#define __WITH_KM_FENCE
7#else
8# define D(n)
9#endif 6#endif
10 7
11enum km_type { 8#include <asm-generic/kmap_types.h>
12D(0) KM_BOUNCE_READ,
13D(1) KM_SKB_SUNRPC_DATA,
14D(2) KM_SKB_DATA_SOFTIRQ,
15D(3) KM_USER0,
16D(4) KM_USER1,
17D(5) KM_BIO_SRC_IRQ,
18D(6) KM_BIO_DST_IRQ,
19D(7) KM_PTE0,
20D(8) KM_PTE1,
21D(9) KM_IRQ0,
22D(10) KM_IRQ1,
23D(11) KM_SOFTIRQ0,
24D(12) KM_SOFTIRQ1,
25D(13) KM_TYPE_NR
26};
27 9
28#undef D 10#undef __WITH_KM_FENCE
29 11
30#endif 12#endif
diff --git a/arch/parisc/kernel/init_task.c b/arch/parisc/kernel/init_task.c
index 1e25a45d64c1..82974b20fc10 100644
--- a/arch/parisc/kernel/init_task.c
+++ b/arch/parisc/kernel/init_task.c
@@ -36,10 +36,6 @@
36 36
37static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 37static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
38static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 38static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
39struct mm_struct init_mm = INIT_MM(init_mm);
40
41EXPORT_SYMBOL(init_mm);
42
43/* 39/*
44 * Initial task structure. 40 * Initial task structure.
45 * 41 *
diff --git a/arch/powerpc/include/asm/8253pit.h b/arch/powerpc/include/asm/8253pit.h
index b70d6e53b303..a71c9c1455a7 100644
--- a/arch/powerpc/include/asm/8253pit.h
+++ b/arch/powerpc/include/asm/8253pit.h
@@ -1,10 +1,3 @@
1#ifndef _ASM_POWERPC_8253PIT_H
2#define _ASM_POWERPC_8253PIT_H
3
4/* 1/*
5 * 8253/8254 Programmable Interval Timer 2 * 8253/8254 Programmable Interval Timer
6 */ 3 */
7
8#define PIT_TICK_RATE 1193182UL
9
10#endif /* _ASM_POWERPC_8253PIT_H */
diff --git a/arch/powerpc/kernel/init_task.c b/arch/powerpc/kernel/init_task.c
index 688b329800bd..ffc4253fef55 100644
--- a/arch/powerpc/kernel/init_task.c
+++ b/arch/powerpc/kernel/init_task.c
@@ -9,10 +9,6 @@
9 9
10static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 10static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
11static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 11static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
12struct mm_struct init_mm = INIT_MM(init_mm);
13
14EXPORT_SYMBOL(init_mm);
15
16/* 12/*
17 * Initial thread structure. 13 * Initial thread structure.
18 * 14 *
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 2f0e64b53642..ef6f64950e9b 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -44,10 +44,7 @@
44#include <asm/sections.h> 44#include <asm/sections.h>
45#include <asm/machdep.h> 45#include <asm/machdep.h>
46 46
47#ifdef CONFIG_LOGO_LINUX_CLUT224
48#include <linux/linux_logo.h> 47#include <linux/linux_logo.h>
49extern const struct linux_logo logo_linux_clut224;
50#endif
51 48
52/* 49/*
53 * Properties whose value is longer than this get excluded from our 50 * Properties whose value is longer than this get excluded from our
diff --git a/arch/powerpc/platforms/cell/ras.c b/arch/powerpc/platforms/cell/ras.c
index 296b5268754e..5e0a191764fc 100644
--- a/arch/powerpc/platforms/cell/ras.c
+++ b/arch/powerpc/platforms/cell/ras.c
@@ -122,8 +122,8 @@ static int __init cbe_ptcal_enable_on_node(int nid, int order)
122 122
123 area->nid = nid; 123 area->nid = nid;
124 area->order = order; 124 area->order = order;
125 area->pages = alloc_pages_node(area->nid, GFP_KERNEL | GFP_THISNODE, 125 area->pages = alloc_pages_exact_node(area->nid, GFP_KERNEL|GFP_THISNODE,
126 area->order); 126 area->order);
127 127
128 if (!area->pages) { 128 if (!area->pages) {
129 printk(KERN_WARNING "%s: no page on node %d\n", 129 printk(KERN_WARNING "%s: no page on node %d\n",
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index 9abd210d87c1..8547e86bfb42 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -752,17 +752,8 @@ static int __init init_spu_base(void)
752 goto out_unregister_sysdev_class; 752 goto out_unregister_sysdev_class;
753 } 753 }
754 754
755 if (ret > 0) { 755 if (ret > 0)
756 /*
757 * We cannot put the forward declaration in
758 * <linux/linux_logo.h> because of conflicting session type
759 * conflicts for const and __initdata with different compiler
760 * versions
761 */
762 extern const struct linux_logo logo_spe_clut224;
763
764 fb_append_extra_logo(&logo_spe_clut224, ret); 756 fb_append_extra_logo(&logo_spe_clut224, ret);
765 }
766 757
767 mutex_lock(&spu_full_list_mutex); 758 mutex_lock(&spu_full_list_mutex);
768 xmon_register_spus(&spu_full_list); 759 xmon_register_spus(&spu_full_list);
diff --git a/arch/s390/include/asm/kmap_types.h b/arch/s390/include/asm/kmap_types.h
index fd1574648223..94ec3ee07983 100644
--- a/arch/s390/include/asm/kmap_types.h
+++ b/arch/s390/include/asm/kmap_types.h
@@ -2,22 +2,7 @@
2#ifndef _ASM_KMAP_TYPES_H 2#ifndef _ASM_KMAP_TYPES_H
3#define _ASM_KMAP_TYPES_H 3#define _ASM_KMAP_TYPES_H
4 4
5enum km_type { 5#include <asm-generic/kmap_types.h>
6 KM_BOUNCE_READ,
7 KM_SKB_SUNRPC_DATA,
8 KM_SKB_DATA_SOFTIRQ,
9 KM_USER0,
10 KM_USER1,
11 KM_BIO_SRC_IRQ,
12 KM_BIO_DST_IRQ,
13 KM_PTE0,
14 KM_PTE1,
15 KM_IRQ0,
16 KM_IRQ1,
17 KM_SOFTIRQ0,
18 KM_SOFTIRQ1,
19 KM_TYPE_NR
20};
21 6
22#endif 7#endif
23#endif /* __KERNEL__ */ 8#endif /* __KERNEL__ */
diff --git a/arch/s390/kernel/init_task.c b/arch/s390/kernel/init_task.c
index 7db95c0b8693..fe787f9e5f3f 100644
--- a/arch/s390/kernel/init_task.c
+++ b/arch/s390/kernel/init_task.c
@@ -18,10 +18,6 @@
18 18
19static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 19static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
20static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 20static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
21struct mm_struct init_mm = INIT_MM(init_mm);
22
23EXPORT_SYMBOL(init_mm);
24
25/* 21/*
26 * Initial thread structure. 22 * Initial thread structure.
27 * 23 *
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index e487e6d5a4d0..ac1c620d1c7d 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -52,6 +52,10 @@ config GENERIC_BUG
52 def_bool y 52 def_bool y
53 depends on BUG && SUPERH32 53 depends on BUG && SUPERH32
54 54
55config GENERIC_CSUM
56 def_bool y
57 depends on SUPERH64
58
55config GENERIC_FIND_NEXT_BIT 59config GENERIC_FIND_NEXT_BIT
56 def_bool y 60 def_bool y
57 61
diff --git a/arch/sh/Kconfig.debug b/arch/sh/Kconfig.debug
index 8179cc9be9a4..8ece0b5bd028 100644
--- a/arch/sh/Kconfig.debug
+++ b/arch/sh/Kconfig.debug
@@ -39,6 +39,7 @@ config EARLY_SCIF_CONSOLE_PORT
39 CPU_SUBTYPE_SH7722 || CPU_SUBTYPE_SH7366 || \ 39 CPU_SUBTYPE_SH7722 || CPU_SUBTYPE_SH7366 || \
40 CPU_SUBTYPE_SH7343 40 CPU_SUBTYPE_SH7343
41 default "0xffea0000" if CPU_SUBTYPE_SH7785 41 default "0xffea0000" if CPU_SUBTYPE_SH7785
42 default "0xffeb0000" if CPU_SUBTYPE_SH7786
42 default "0xfffe8000" if CPU_SUBTYPE_SH7203 43 default "0xfffe8000" if CPU_SUBTYPE_SH7203
43 default "0xfffe9800" if CPU_SUBTYPE_SH7206 || CPU_SUBTYPE_SH7263 44 default "0xfffe9800" if CPU_SUBTYPE_SH7206 || CPU_SUBTYPE_SH7263
44 default "0xffe80000" if CPU_SH4 45 default "0xffe80000" if CPU_SH4
diff --git a/arch/sh/boards/board-ap325rxa.c b/arch/sh/boards/board-ap325rxa.c
index 1c4d83ef2a47..7ffd1b4315bd 100644
--- a/arch/sh/boards/board-ap325rxa.c
+++ b/arch/sh/boards/board-ap325rxa.c
@@ -349,15 +349,6 @@ static int ov7725_power(struct device *dev, int mode)
349 return 0; 349 return 0;
350} 350}
351 351
352static struct ov772x_camera_info ov7725_info = {
353 .buswidth = SOCAM_DATAWIDTH_8,
354 .flags = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP,
355 .edgectrl = OV772X_AUTO_EDGECTRL(0xf, 0),
356 .link = {
357 .power = ov7725_power,
358 },
359};
360
361static struct sh_mobile_ceu_info sh_mobile_ceu_info = { 352static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
362 .flags = SH_CEU_FLAG_USE_8BIT_BUS, 353 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
363}; 354};
@@ -402,25 +393,48 @@ static struct platform_device sdcard_cn3_device = {
402 }, 393 },
403}; 394};
404 395
405static struct platform_device *ap325rxa_devices[] __initdata = {
406 &smsc9118_device,
407 &ap325rxa_nor_flash_device,
408 &lcdc_device,
409 &ceu_device,
410 &nand_flash_device,
411 &sdcard_cn3_device,
412};
413
414static struct i2c_board_info __initdata ap325rxa_i2c_devices[] = { 396static struct i2c_board_info __initdata ap325rxa_i2c_devices[] = {
415 { 397 {
416 I2C_BOARD_INFO("pcf8563", 0x51), 398 I2C_BOARD_INFO("pcf8563", 0x51),
417 }, 399 },
400};
401
402static struct i2c_board_info ap325rxa_i2c_camera[] = {
418 { 403 {
419 I2C_BOARD_INFO("ov772x", 0x21), 404 I2C_BOARD_INFO("ov772x", 0x21),
420 .platform_data = &ov7725_info,
421 }, 405 },
422}; 406};
423 407
408static struct ov772x_camera_info ov7725_info = {
409 .buswidth = SOCAM_DATAWIDTH_8,
410 .flags = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP,
411 .edgectrl = OV772X_AUTO_EDGECTRL(0xf, 0),
412 .link = {
413 .power = ov7725_power,
414 .board_info = &ap325rxa_i2c_camera[0],
415 .i2c_adapter_id = 0,
416 .module_name = "ov772x",
417 },
418};
419
420static struct platform_device ap325rxa_camera = {
421 .name = "soc-camera-pdrv",
422 .id = 0,
423 .dev = {
424 .platform_data = &ov7725_info.link,
425 },
426};
427
428static struct platform_device *ap325rxa_devices[] __initdata = {
429 &smsc9118_device,
430 &ap325rxa_nor_flash_device,
431 &lcdc_device,
432 &ceu_device,
433 &nand_flash_device,
434 &sdcard_cn3_device,
435 &ap325rxa_camera,
436};
437
424static struct spi_board_info ap325rxa_spi_devices[] = { 438static struct spi_board_info ap325rxa_spi_devices[] = {
425 { 439 {
426 .modalias = "mmc_spi", 440 .modalias = "mmc_spi",
diff --git a/arch/sh/boards/board-sh7785lcr.c b/arch/sh/boards/board-sh7785lcr.c
index 7be56fb06c1f..42410a15d255 100644
--- a/arch/sh/boards/board-sh7785lcr.c
+++ b/arch/sh/boards/board-sh7785lcr.c
@@ -15,16 +15,18 @@
15#include <linux/fb.h> 15#include <linux/fb.h>
16#include <linux/mtd/physmap.h> 16#include <linux/mtd/physmap.h>
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/interrupt.h>
18#include <linux/i2c.h> 19#include <linux/i2c.h>
19#include <linux/i2c-pca-platform.h> 20#include <linux/i2c-pca-platform.h>
20#include <linux/i2c-algo-pca.h> 21#include <linux/i2c-algo-pca.h>
22#include <linux/usb/r8a66597.h>
21#include <linux/irq.h> 23#include <linux/irq.h>
22#include <linux/clk.h> 24#include <linux/clk.h>
23#include <linux/errno.h> 25#include <linux/errno.h>
24#include <mach/sh7785lcr.h> 26#include <mach/sh7785lcr.h>
27#include <cpu/sh7785.h>
25#include <asm/heartbeat.h> 28#include <asm/heartbeat.h>
26#include <asm/clock.h> 29#include <asm/clock.h>
27#include <cpu/sh7785.h>
28 30
29/* 31/*
30 * NOTE: This board has 2 physical memory maps. 32 * NOTE: This board has 2 physical memory maps.
@@ -98,18 +100,21 @@ static struct platform_device nor_flash_device = {
98 .resource = nor_flash_resources, 100 .resource = nor_flash_resources,
99}; 101};
100 102
103static struct r8a66597_platdata r8a66597_data = {
104 .xtal = R8A66597_PLATDATA_XTAL_12MHZ,
105 .vif = 1,
106};
107
101static struct resource r8a66597_usb_host_resources[] = { 108static struct resource r8a66597_usb_host_resources[] = {
102 [0] = { 109 [0] = {
103 .name = "r8a66597_hcd",
104 .start = R8A66597_ADDR, 110 .start = R8A66597_ADDR,
105 .end = R8A66597_ADDR + R8A66597_SIZE - 1, 111 .end = R8A66597_ADDR + R8A66597_SIZE - 1,
106 .flags = IORESOURCE_MEM, 112 .flags = IORESOURCE_MEM,
107 }, 113 },
108 [1] = { 114 [1] = {
109 .name = "r8a66597_hcd",
110 .start = 2, 115 .start = 2,
111 .end = 2, 116 .end = 2,
112 .flags = IORESOURCE_IRQ, 117 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
113 }, 118 },
114}; 119};
115 120
@@ -119,6 +124,7 @@ static struct platform_device r8a66597_usb_host_device = {
119 .dev = { 124 .dev = {
120 .dma_mask = NULL, 125 .dma_mask = NULL,
121 .coherent_dma_mask = 0xffffffff, 126 .coherent_dma_mask = 0xffffffff,
127 .platform_data = &r8a66597_data,
122 }, 128 },
123 .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources), 129 .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources),
124 .resource = r8a66597_usb_host_resources, 130 .resource = r8a66597_usb_host_resources,
diff --git a/arch/sh/boards/board-urquell.c b/arch/sh/boards/board-urquell.c
index beb88c4da2c1..36b8bac9b124 100644
--- a/arch/sh/boards/board-urquell.c
+++ b/arch/sh/boards/board-urquell.c
@@ -2,6 +2,7 @@
2 * Renesas Technology Corp. SH7786 Urquell Support. 2 * Renesas Technology Corp. SH7786 Urquell Support.
3 * 3 *
4 * Copyright (C) 2008 Kuninori Morimoto <morimoto.kuninori@renesas.com> 4 * Copyright (C) 2008 Kuninori Morimoto <morimoto.kuninori@renesas.com>
5 * Copyright (C) 2009 Paul Mundt
5 * 6 *
6 * Based on board-sh7785lcr.c 7 * Based on board-sh7785lcr.c
7 * Copyright (C) 2008 Yoshihiro Shimoda 8 * Copyright (C) 2008 Yoshihiro Shimoda
@@ -178,6 +179,11 @@ static void __init urquell_init_irq(void)
178 plat_irq_setup_pins(IRQ_MODE_IRL3210_MASK); 179 plat_irq_setup_pins(IRQ_MODE_IRL3210_MASK);
179} 180}
180 181
182static int urquell_mode_pins(void)
183{
184 return __raw_readw(UBOARDREG(MDSWMR));
185}
186
181/* Initialize the board */ 187/* Initialize the board */
182static void __init urquell_setup(char **cmdline_p) 188static void __init urquell_setup(char **cmdline_p)
183{ 189{
@@ -193,4 +199,5 @@ static struct sh_machine_vector mv_urquell __initmv = {
193 .mv_name = "Urquell", 199 .mv_name = "Urquell",
194 .mv_setup = urquell_setup, 200 .mv_setup = urquell_setup,
195 .mv_init_irq = urquell_init_irq, 201 .mv_init_irq = urquell_init_irq,
202 .mv_mode_pins = urquell_mode_pins,
196}; 203};
diff --git a/arch/sh/boards/mach-highlander/setup.c b/arch/sh/boards/mach-highlander/setup.c
index 20fe72c515d5..1639f8915000 100644
--- a/arch/sh/boards/mach-highlander/setup.c
+++ b/arch/sh/boards/mach-highlander/setup.c
@@ -17,8 +17,11 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/ata_platform.h> 18#include <linux/ata_platform.h>
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/mtd/physmap.h>
20#include <linux/i2c.h> 21#include <linux/i2c.h>
21#include <linux/irq.h> 22#include <linux/irq.h>
23#include <linux/interrupt.h>
24#include <linux/usb/r8a66597.h>
22#include <net/ax88796.h> 25#include <net/ax88796.h>
23#include <asm/machvec.h> 26#include <asm/machvec.h>
24#include <mach/highlander.h> 27#include <mach/highlander.h>
@@ -27,18 +30,21 @@
27#include <asm/io.h> 30#include <asm/io.h>
28#include <asm/io_trapped.h> 31#include <asm/io_trapped.h>
29 32
33static struct r8a66597_platdata r8a66597_data = {
34 .xtal = R8A66597_PLATDATA_XTAL_12MHZ,
35 .vif = 1,
36};
37
30static struct resource r8a66597_usb_host_resources[] = { 38static struct resource r8a66597_usb_host_resources[] = {
31 [0] = { 39 [0] = {
32 .name = "r8a66597_hcd",
33 .start = 0xA4200000, 40 .start = 0xA4200000,
34 .end = 0xA42000FF, 41 .end = 0xA42000FF,
35 .flags = IORESOURCE_MEM, 42 .flags = IORESOURCE_MEM,
36 }, 43 },
37 [1] = { 44 [1] = {
38 .name = "r8a66597_hcd",
39 .start = IRQ_EXT1, /* irq number */ 45 .start = IRQ_EXT1, /* irq number */
40 .end = IRQ_EXT1, 46 .end = IRQ_EXT1,
41 .flags = IORESOURCE_IRQ, 47 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
42 }, 48 },
43}; 49};
44 50
@@ -48,6 +54,7 @@ static struct platform_device r8a66597_usb_host_device = {
48 .dev = { 54 .dev = {
49 .dma_mask = NULL, /* don't use dma */ 55 .dma_mask = NULL, /* don't use dma */
50 .coherent_dma_mask = 0xffffffff, 56 .coherent_dma_mask = 0xffffffff,
57 .platform_data = &r8a66597_data,
51 }, 58 },
52 .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources), 59 .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources),
53 .resource = r8a66597_usb_host_resources, 60 .resource = r8a66597_usb_host_resources,
@@ -178,6 +185,53 @@ static struct platform_device ax88796_device = {
178 .resource = ax88796_resources, 185 .resource = ax88796_resources,
179}; 186};
180 187
188static struct mtd_partition nor_flash_partitions[] = {
189 {
190 .name = "loader",
191 .offset = 0x00000000,
192 .size = 512 * 1024,
193 },
194 {
195 .name = "bootenv",
196 .offset = MTDPART_OFS_APPEND,
197 .size = 512 * 1024,
198 },
199 {
200 .name = "kernel",
201 .offset = MTDPART_OFS_APPEND,
202 .size = 4 * 1024 * 1024,
203 },
204 {
205 .name = "data",
206 .offset = MTDPART_OFS_APPEND,
207 .size = MTDPART_SIZ_FULL,
208 },
209};
210
211static struct physmap_flash_data nor_flash_data = {
212 .width = 4,
213 .parts = nor_flash_partitions,
214 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
215};
216
217/* This config is flash board for mass production. */
218static struct resource nor_flash_resources[] = {
219 [0] = {
220 .start = PA_NORFLASH_ADDR,
221 .end = PA_NORFLASH_ADDR + PA_NORFLASH_SIZE - 1,
222 .flags = IORESOURCE_MEM,
223 }
224};
225
226static struct platform_device nor_flash_device = {
227 .name = "physmap-flash",
228 .dev = {
229 .platform_data = &nor_flash_data,
230 },
231 .num_resources = ARRAY_SIZE(nor_flash_resources),
232 .resource = nor_flash_resources,
233};
234
181static struct resource smbus_resources[] = { 235static struct resource smbus_resources[] = {
182 [0] = { 236 [0] = {
183 .start = PA_SMCR, 237 .start = PA_SMCR,
@@ -209,6 +263,7 @@ static struct platform_device *r7780rp_devices[] __initdata = {
209 &m66592_usb_peripheral_device, 263 &m66592_usb_peripheral_device,
210 &heartbeat_device, 264 &heartbeat_device,
211 &smbus_device, 265 &smbus_device,
266 &nor_flash_device,
212#ifndef CONFIG_SH_R7780RP 267#ifndef CONFIG_SH_R7780RP
213 &ax88796_device, 268 &ax88796_device,
214#endif 269#endif
@@ -247,9 +302,10 @@ device_initcall(r7780rp_devices_setup);
247/* 302/*
248 * Platform specific clocks 303 * Platform specific clocks
249 */ 304 */
250static void ivdr_clk_enable(struct clk *clk) 305static int ivdr_clk_enable(struct clk *clk)
251{ 306{
252 ctrl_outw(ctrl_inw(PA_IVDRCTL) | (1 << IVDR_CK_ON), PA_IVDRCTL); 307 ctrl_outw(ctrl_inw(PA_IVDRCTL) | (1 << IVDR_CK_ON), PA_IVDRCTL);
308 return 0;
253} 309}
254 310
255static void ivdr_clk_disable(struct clk *clk) 311static void ivdr_clk_disable(struct clk *clk)
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
index 6ed401cd3156..f70f4644deb4 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -381,21 +381,6 @@ static struct platform_device migor_ceu_device = {
381 }, 381 },
382}; 382};
383 383
384static struct ov772x_camera_info ov7725_info = {
385 .buswidth = SOCAM_DATAWIDTH_8,
386 .link = {
387 .power = ov7725_power,
388 },
389};
390
391static struct tw9910_video_info tw9910_info = {
392 .buswidth = SOCAM_DATAWIDTH_8,
393 .mpout = TW9910_MPO_FIELD,
394 .link = {
395 .power = tw9910_power,
396 }
397};
398
399struct spi_gpio_platform_data sdcard_cn9_platform_data = { 384struct spi_gpio_platform_data sdcard_cn9_platform_data = {
400 .sck = GPIO_PTD0, 385 .sck = GPIO_PTD0,
401 .mosi = GPIO_PTD1, 386 .mosi = GPIO_PTD1,
@@ -410,16 +395,6 @@ static struct platform_device sdcard_cn9_device = {
410 }, 395 },
411}; 396};
412 397
413static struct platform_device *migor_devices[] __initdata = {
414 &smc91x_eth_device,
415 &sh_keysc_device,
416 &migor_lcdc_device,
417 &migor_ceu_device,
418 &migor_nor_flash_device,
419 &migor_nand_flash_device,
420 &sdcard_cn9_device,
421};
422
423static struct i2c_board_info migor_i2c_devices[] = { 398static struct i2c_board_info migor_i2c_devices[] = {
424 { 399 {
425 I2C_BOARD_INFO("rs5c372b", 0x32), 400 I2C_BOARD_INFO("rs5c372b", 0x32),
@@ -428,16 +403,66 @@ static struct i2c_board_info migor_i2c_devices[] = {
428 I2C_BOARD_INFO("migor_ts", 0x51), 403 I2C_BOARD_INFO("migor_ts", 0x51),
429 .irq = 38, /* IRQ6 */ 404 .irq = 38, /* IRQ6 */
430 }, 405 },
406};
407
408static struct i2c_board_info migor_i2c_camera[] = {
431 { 409 {
432 I2C_BOARD_INFO("ov772x", 0x21), 410 I2C_BOARD_INFO("ov772x", 0x21),
433 .platform_data = &ov7725_info,
434 }, 411 },
435 { 412 {
436 I2C_BOARD_INFO("tw9910", 0x45), 413 I2C_BOARD_INFO("tw9910", 0x45),
437 .platform_data = &tw9910_info,
438 }, 414 },
439}; 415};
440 416
417static struct ov772x_camera_info ov7725_info = {
418 .buswidth = SOCAM_DATAWIDTH_8,
419 .link = {
420 .power = ov7725_power,
421 .board_info = &migor_i2c_camera[0],
422 .i2c_adapter_id = 0,
423 .module_name = "ov772x",
424 },
425};
426
427static struct tw9910_video_info tw9910_info = {
428 .buswidth = SOCAM_DATAWIDTH_8,
429 .mpout = TW9910_MPO_FIELD,
430 .link = {
431 .power = tw9910_power,
432 .board_info = &migor_i2c_camera[1],
433 .i2c_adapter_id = 0,
434 .module_name = "tw9910",
435 }
436};
437
438static struct platform_device migor_camera[] = {
439 {
440 .name = "soc-camera-pdrv",
441 .id = 0,
442 .dev = {
443 .platform_data = &ov7725_info.link,
444 },
445 }, {
446 .name = "soc-camera-pdrv",
447 .id = 1,
448 .dev = {
449 .platform_data = &tw9910_info.link,
450 },
451 },
452};
453
454static struct platform_device *migor_devices[] __initdata = {
455 &smc91x_eth_device,
456 &sh_keysc_device,
457 &migor_lcdc_device,
458 &migor_ceu_device,
459 &migor_nor_flash_device,
460 &migor_nand_flash_device,
461 &sdcard_cn9_device,
462 &migor_camera[0],
463 &migor_camera[1],
464};
465
441static struct spi_board_info migor_spi_devices[] = { 466static struct spi_board_info migor_spi_devices[] = {
442 { 467 {
443 .modalias = "mmc_spi", 468 .modalias = "mmc_spi",
diff --git a/arch/sh/boards/mach-rsk/devices-rsk7203.c b/arch/sh/boards/mach-rsk/devices-rsk7203.c
index d8a65ea91665..4af3a771c058 100644
--- a/arch/sh/boards/mach-rsk/devices-rsk7203.c
+++ b/arch/sh/boards/mach-rsk/devices-rsk7203.c
@@ -26,13 +26,13 @@ static struct smsc911x_platform_config smsc911x_config = {
26 .phy_interface = PHY_INTERFACE_MODE_MII, 26 .phy_interface = PHY_INTERFACE_MODE_MII,
27 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 27 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
28 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, 28 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
29 .flags = SMSC911X_USE_16BIT, 29 .flags = SMSC911X_USE_32BIT | SMSC911X_SWAP_FIFO,
30}; 30};
31 31
32static struct resource smsc911x_resources[] = { 32static struct resource smsc911x_resources[] = {
33 [0] = { 33 [0] = {
34 .start = 0x24000000, 34 .start = 0x24000000,
35 .end = 0x24000000 + 0x100, 35 .end = 0x240000ff,
36 .flags = IORESOURCE_MEM, 36 .flags = IORESOURCE_MEM,
37 }, 37 },
38 [1] = { 38 [1] = {
@@ -99,6 +99,10 @@ static int __init rsk7203_devices_setup(void)
99 gpio_request(GPIO_FN_TXD0, NULL); 99 gpio_request(GPIO_FN_TXD0, NULL);
100 gpio_request(GPIO_FN_RXD0, NULL); 100 gpio_request(GPIO_FN_RXD0, NULL);
101 101
102 /* Setup LAN9118: CS1 in 16-bit Big Endian Mode, IRQ0 at Port B */
103 ctrl_outl(0x36db0400, 0xfffc0008); /* CS1BCR */
104 gpio_request(GPIO_FN_IRQ0_PB, NULL);
105
102 return platform_add_devices(rsk7203_devices, 106 return platform_add_devices(rsk7203_devices,
103 ARRAY_SIZE(rsk7203_devices)); 107 ARRAY_SIZE(rsk7203_devices));
104} 108}
diff --git a/arch/sh/boards/mach-se/7780/irq.c b/arch/sh/boards/mach-se/7780/irq.c
index b8d43b638fcf..121744c08714 100644
--- a/arch/sh/boards/mach-se/7780/irq.c
+++ b/arch/sh/boards/mach-se/7780/irq.c
@@ -12,7 +12,6 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/irq.h>
16#include <linux/io.h> 15#include <linux/io.h>
17#include <mach-se/mach/se7780.h> 16#include <mach-se/mach/se7780.h>
18 17
diff --git a/arch/sh/boards/mach-x3proto/setup.c b/arch/sh/boards/mach-x3proto/setup.c
index a340492087fa..8913ae39a802 100644
--- a/arch/sh/boards/mach-x3proto/setup.c
+++ b/arch/sh/boards/mach-x3proto/setup.c
@@ -15,6 +15,8 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/smc91x.h> 16#include <linux/smc91x.h>
17#include <linux/irq.h> 17#include <linux/irq.h>
18#include <linux/interrupt.h>
19#include <linux/usb/r8a66597.h>
18#include <asm/ilsel.h> 20#include <asm/ilsel.h>
19 21
20static struct resource heartbeat_resources[] = { 22static struct resource heartbeat_resources[] = {
@@ -58,17 +60,20 @@ static struct platform_device smc91x_device = {
58 }, 60 },
59}; 61};
60 62
63static struct r8a66597_platdata r8a66597_data = {
64 .xtal = R8A66597_PLATDATA_XTAL_12MHZ,
65 .vif = 1,
66};
67
61static struct resource r8a66597_usb_host_resources[] = { 68static struct resource r8a66597_usb_host_resources[] = {
62 [0] = { 69 [0] = {
63 .name = "r8a66597_hcd",
64 .start = 0x18040000, 70 .start = 0x18040000,
65 .end = 0x18080000 - 1, 71 .end = 0x18080000 - 1,
66 .flags = IORESOURCE_MEM, 72 .flags = IORESOURCE_MEM,
67 }, 73 },
68 [1] = { 74 [1] = {
69 .name = "r8a66597_hcd",
70 /* Filled in by ilsel */ 75 /* Filled in by ilsel */
71 .flags = IORESOURCE_IRQ, 76 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
72 }, 77 },
73}; 78};
74 79
@@ -78,6 +83,7 @@ static struct platform_device r8a66597_usb_host_device = {
78 .dev = { 83 .dev = {
79 .dma_mask = NULL, /* don't use dma */ 84 .dma_mask = NULL, /* don't use dma */
80 .coherent_dma_mask = 0xffffffff, 85 .coherent_dma_mask = 0xffffffff,
86 .platform_data = &r8a66597_data,
81 }, 87 },
82 .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources), 88 .num_resources = ARRAY_SIZE(r8a66597_usb_host_resources),
83 .resource = r8a66597_usb_host_resources, 89 .resource = r8a66597_usb_host_resources,
diff --git a/arch/sh/configs/r7780mp_defconfig b/arch/sh/configs/r7780mp_defconfig
index 943da63a3852..d393d9e5bddd 100644
--- a/arch/sh/configs/r7780mp_defconfig
+++ b/arch/sh/configs/r7780mp_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.30-rc3 3# Linux kernel version: 2.6.30
4# Mon Apr 27 12:53:28 2009 4# Tue Jun 16 16:08:44 2009
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -20,6 +20,7 @@ CONFIG_GENERIC_CLOCKEVENTS=y
20# CONFIG_ARCH_SUSPEND_POSSIBLE is not set 20# CONFIG_ARCH_SUSPEND_POSSIBLE is not set
21CONFIG_ARCH_HIBERNATION_POSSIBLE=y 21CONFIG_ARCH_HIBERNATION_POSSIBLE=y
22CONFIG_SYS_SUPPORTS_PCI=y 22CONFIG_SYS_SUPPORTS_PCI=y
23CONFIG_SYS_SUPPORTS_TMU=y
23CONFIG_STACKTRACE_SUPPORT=y 24CONFIG_STACKTRACE_SUPPORT=y
24CONFIG_LOCKDEP_SUPPORT=y 25CONFIG_LOCKDEP_SUPPORT=y
25CONFIG_HAVE_LATENCYTOP_SUPPORT=y 26CONFIG_HAVE_LATENCYTOP_SUPPORT=y
@@ -92,6 +93,10 @@ CONFIG_TIMERFD=y
92CONFIG_EVENTFD=y 93CONFIG_EVENTFD=y
93CONFIG_SHMEM=y 94CONFIG_SHMEM=y
94CONFIG_AIO=y 95CONFIG_AIO=y
96
97#
98# Performance Counters
99#
95CONFIG_VM_EVENT_COUNTERS=y 100CONFIG_VM_EVENT_COUNTERS=y
96CONFIG_PCI_QUIRKS=y 101CONFIG_PCI_QUIRKS=y
97CONFIG_COMPAT_BRK=y 102CONFIG_COMPAT_BRK=y
@@ -100,7 +105,7 @@ CONFIG_SLAB=y
100# CONFIG_SLOB is not set 105# CONFIG_SLOB is not set
101CONFIG_PROFILING=y 106CONFIG_PROFILING=y
102CONFIG_TRACEPOINTS=y 107CONFIG_TRACEPOINTS=y
103# CONFIG_MARKERS is not set 108CONFIG_MARKERS=y
104CONFIG_OPROFILE=m 109CONFIG_OPROFILE=m
105CONFIG_HAVE_OPROFILE=y 110CONFIG_HAVE_OPROFILE=y
106# CONFIG_KPROBES is not set 111# CONFIG_KPROBES is not set
@@ -185,6 +190,7 @@ CONFIG_CPU_SUBTYPE_SH7780=y
185CONFIG_QUICKLIST=y 190CONFIG_QUICKLIST=y
186CONFIG_MMU=y 191CONFIG_MMU=y
187CONFIG_PAGE_OFFSET=0x80000000 192CONFIG_PAGE_OFFSET=0x80000000
193CONFIG_FORCE_MAX_ZONEORDER=11
188CONFIG_MEMORY_START=0x08000000 194CONFIG_MEMORY_START=0x08000000
189CONFIG_MEMORY_SIZE=0x08000000 195CONFIG_MEMORY_SIZE=0x08000000
190# CONFIG_29BIT is not set 196# CONFIG_29BIT is not set
@@ -203,7 +209,6 @@ CONFIG_PAGE_SIZE_4KB=y
203# CONFIG_PAGE_SIZE_8KB is not set 209# CONFIG_PAGE_SIZE_8KB is not set
204# CONFIG_PAGE_SIZE_16KB is not set 210# CONFIG_PAGE_SIZE_16KB is not set
205# CONFIG_PAGE_SIZE_64KB is not set 211# CONFIG_PAGE_SIZE_64KB is not set
206CONFIG_ENTRY_OFFSET=0x00001000
207CONFIG_HUGETLB_PAGE_SIZE_64K=y 212CONFIG_HUGETLB_PAGE_SIZE_64K=y
208# CONFIG_HUGETLB_PAGE_SIZE_256K is not set 213# CONFIG_HUGETLB_PAGE_SIZE_256K is not set
209# CONFIG_HUGETLB_PAGE_SIZE_1MB is not set 214# CONFIG_HUGETLB_PAGE_SIZE_1MB is not set
@@ -225,6 +230,7 @@ CONFIG_NR_QUICK=2
225CONFIG_UNEVICTABLE_LRU=y 230CONFIG_UNEVICTABLE_LRU=y
226CONFIG_HAVE_MLOCK=y 231CONFIG_HAVE_MLOCK=y
227CONFIG_HAVE_MLOCKED_PAGE_BIT=y 232CONFIG_HAVE_MLOCKED_PAGE_BIT=y
233CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
228 234
229# 235#
230# Cache configuration 236# Cache configuration
@@ -258,9 +264,10 @@ CONFIG_SH_R7780MP=y
258# 264#
259# Timer and clock configuration 265# Timer and clock configuration
260# 266#
261CONFIG_SH_TMU=y 267CONFIG_SH_TIMER_TMU=y
262CONFIG_SH_TIMER_IRQ=28
263CONFIG_SH_PCLK_FREQ=33333333 268CONFIG_SH_PCLK_FREQ=33333333
269CONFIG_SH_CLK_CPG=y
270CONFIG_SH_CLK_CPG_LEGACY=y
264# CONFIG_NO_HZ is not set 271# CONFIG_NO_HZ is not set
265# CONFIG_HIGH_RES_TIMERS is not set 272# CONFIG_HIGH_RES_TIMERS is not set
266CONFIG_GENERIC_CLOCKEVENTS_BUILD=y 273CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
@@ -301,12 +308,14 @@ CONFIG_KEXEC=y
301# CONFIG_PREEMPT_VOLUNTARY is not set 308# CONFIG_PREEMPT_VOLUNTARY is not set
302CONFIG_PREEMPT=y 309CONFIG_PREEMPT=y
303CONFIG_GUSA=y 310CONFIG_GUSA=y
311# CONFIG_SPARSE_IRQ is not set
304 312
305# 313#
306# Boot options 314# Boot options
307# 315#
308CONFIG_ZERO_PAGE_OFFSET=0x00001000 316CONFIG_ZERO_PAGE_OFFSET=0x00001000
309CONFIG_BOOT_LINK_OFFSET=0x00800000 317CONFIG_BOOT_LINK_OFFSET=0x00800000
318CONFIG_ENTRY_OFFSET=0x00001000
310CONFIG_CMDLINE_BOOL=y 319CONFIG_CMDLINE_BOOL=y
311CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1" 320CONFIG_CMDLINE="console=ttySC0,115200 root=/dev/sda1"
312 321
@@ -445,7 +454,91 @@ CONFIG_EXTRA_FIRMWARE=""
445# CONFIG_DEBUG_DEVRES is not set 454# CONFIG_DEBUG_DEVRES is not set
446# CONFIG_SYS_HYPERVISOR is not set 455# CONFIG_SYS_HYPERVISOR is not set
447# CONFIG_CONNECTOR is not set 456# CONFIG_CONNECTOR is not set
448# CONFIG_MTD is not set 457CONFIG_MTD=y
458# CONFIG_MTD_DEBUG is not set
459# CONFIG_MTD_CONCAT is not set
460CONFIG_MTD_PARTITIONS=y
461# CONFIG_MTD_TESTS is not set
462# CONFIG_MTD_REDBOOT_PARTS is not set
463# CONFIG_MTD_CMDLINE_PARTS is not set
464# CONFIG_MTD_AR7_PARTS is not set
465
466#
467# User Modules And Translation Layers
468#
469# CONFIG_MTD_CHAR is not set
470# CONFIG_MTD_BLKDEVS is not set
471# CONFIG_MTD_BLOCK is not set
472# CONFIG_MTD_BLOCK_RO is not set
473# CONFIG_FTL is not set
474# CONFIG_NFTL is not set
475# CONFIG_INFTL is not set
476# CONFIG_RFD_FTL is not set
477# CONFIG_SSFDC is not set
478# CONFIG_MTD_OOPS is not set
479
480#
481# RAM/ROM/Flash chip drivers
482#
483CONFIG_MTD_CFI=y
484# CONFIG_MTD_JEDECPROBE is not set
485CONFIG_MTD_GEN_PROBE=y
486# CONFIG_MTD_CFI_ADV_OPTIONS is not set
487CONFIG_MTD_MAP_BANK_WIDTH_1=y
488CONFIG_MTD_MAP_BANK_WIDTH_2=y
489CONFIG_MTD_MAP_BANK_WIDTH_4=y
490# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
491# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
492# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
493CONFIG_MTD_CFI_I1=y
494CONFIG_MTD_CFI_I2=y
495# CONFIG_MTD_CFI_I4 is not set
496# CONFIG_MTD_CFI_I8 is not set
497# CONFIG_MTD_CFI_INTELEXT is not set
498CONFIG_MTD_CFI_AMDSTD=y
499# CONFIG_MTD_CFI_STAA is not set
500CONFIG_MTD_CFI_UTIL=y
501# CONFIG_MTD_RAM is not set
502# CONFIG_MTD_ROM is not set
503# CONFIG_MTD_ABSENT is not set
504
505#
506# Mapping drivers for chip access
507#
508CONFIG_MTD_COMPLEX_MAPPINGS=y
509CONFIG_MTD_PHYSMAP=y
510# CONFIG_MTD_PHYSMAP_COMPAT is not set
511# CONFIG_MTD_PCI is not set
512# CONFIG_MTD_INTEL_VR_NOR is not set
513# CONFIG_MTD_PLATRAM is not set
514
515#
516# Self-contained MTD device drivers
517#
518# CONFIG_MTD_PMC551 is not set
519# CONFIG_MTD_SLRAM is not set
520# CONFIG_MTD_PHRAM is not set
521# CONFIG_MTD_MTDRAM is not set
522# CONFIG_MTD_BLOCK2MTD is not set
523
524#
525# Disk-On-Chip Device Drivers
526#
527# CONFIG_MTD_DOC2000 is not set
528# CONFIG_MTD_DOC2001 is not set
529# CONFIG_MTD_DOC2001PLUS is not set
530# CONFIG_MTD_NAND is not set
531# CONFIG_MTD_ONENAND is not set
532
533#
534# LPDDR flash memory drivers
535#
536# CONFIG_MTD_LPDDR is not set
537
538#
539# UBI - Unsorted block images
540#
541# CONFIG_MTD_UBI is not set
449# CONFIG_PARPORT is not set 542# CONFIG_PARPORT is not set
450CONFIG_BLK_DEV=y 543CONFIG_BLK_DEV=y
451# CONFIG_BLK_CPQ_CISS_DA is not set 544# CONFIG_BLK_CPQ_CISS_DA is not set
@@ -500,10 +593,6 @@ CONFIG_BLK_DEV_SD=y
500# CONFIG_BLK_DEV_SR is not set 593# CONFIG_BLK_DEV_SR is not set
501CONFIG_CHR_DEV_SG=m 594CONFIG_CHR_DEV_SG=m
502# CONFIG_CHR_DEV_SCH is not set 595# CONFIG_CHR_DEV_SCH is not set
503
504#
505# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
506#
507# CONFIG_SCSI_MULTI_LUN is not set 596# CONFIG_SCSI_MULTI_LUN is not set
508# CONFIG_SCSI_CONSTANTS is not set 597# CONFIG_SCSI_CONSTANTS is not set
509# CONFIG_SCSI_LOGGING is not set 598# CONFIG_SCSI_LOGGING is not set
@@ -521,6 +610,7 @@ CONFIG_SCSI_WAIT_SCAN=m
521CONFIG_SCSI_LOWLEVEL=y 610CONFIG_SCSI_LOWLEVEL=y
522# CONFIG_ISCSI_TCP is not set 611# CONFIG_ISCSI_TCP is not set
523# CONFIG_SCSI_CXGB3_ISCSI is not set 612# CONFIG_SCSI_CXGB3_ISCSI is not set
613# CONFIG_SCSI_BNX2_ISCSI is not set
524# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 614# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
525# CONFIG_SCSI_3W_9XXX is not set 615# CONFIG_SCSI_3W_9XXX is not set
526# CONFIG_SCSI_ACARD is not set 616# CONFIG_SCSI_ACARD is not set
@@ -529,6 +619,7 @@ CONFIG_SCSI_LOWLEVEL=y
529# CONFIG_SCSI_AIC7XXX_OLD is not set 619# CONFIG_SCSI_AIC7XXX_OLD is not set
530# CONFIG_SCSI_AIC79XX is not set 620# CONFIG_SCSI_AIC79XX is not set
531# CONFIG_SCSI_AIC94XX is not set 621# CONFIG_SCSI_AIC94XX is not set
622# CONFIG_SCSI_MVSAS is not set
532# CONFIG_SCSI_ARCMSR is not set 623# CONFIG_SCSI_ARCMSR is not set
533# CONFIG_MEGARAID_NEWGEN is not set 624# CONFIG_MEGARAID_NEWGEN is not set
534# CONFIG_MEGARAID_LEGACY is not set 625# CONFIG_MEGARAID_LEGACY is not set
@@ -543,7 +634,6 @@ CONFIG_SCSI_LOWLEVEL=y
543# CONFIG_SCSI_IPS is not set 634# CONFIG_SCSI_IPS is not set
544# CONFIG_SCSI_INITIO is not set 635# CONFIG_SCSI_INITIO is not set
545# CONFIG_SCSI_INIA100 is not set 636# CONFIG_SCSI_INIA100 is not set
546# CONFIG_SCSI_MVSAS is not set
547# CONFIG_SCSI_STEX is not set 637# CONFIG_SCSI_STEX is not set
548# CONFIG_SCSI_SYM53C8XX_2 is not set 638# CONFIG_SCSI_SYM53C8XX_2 is not set
549# CONFIG_SCSI_IPR is not set 639# CONFIG_SCSI_IPR is not set
@@ -1111,6 +1201,7 @@ CONFIG_RTC_DRV_RS5C372=y
1111# on-CPU RTC drivers 1201# on-CPU RTC drivers
1112# 1202#
1113CONFIG_RTC_DRV_SH=y 1203CONFIG_RTC_DRV_SH=y
1204# CONFIG_RTC_DRV_GENERIC is not set
1114# CONFIG_DMADEVICES is not set 1205# CONFIG_DMADEVICES is not set
1115# CONFIG_AUXDISPLAY is not set 1206# CONFIG_AUXDISPLAY is not set
1116# CONFIG_UIO is not set 1207# CONFIG_UIO is not set
@@ -1138,6 +1229,7 @@ CONFIG_FILE_LOCKING=y
1138# CONFIG_XFS_FS is not set 1229# CONFIG_XFS_FS is not set
1139# CONFIG_OCFS2_FS is not set 1230# CONFIG_OCFS2_FS is not set
1140# CONFIG_BTRFS_FS is not set 1231# CONFIG_BTRFS_FS is not set
1232CONFIG_FSNOTIFY=y
1141CONFIG_DNOTIFY=y 1233CONFIG_DNOTIFY=y
1142CONFIG_INOTIFY=y 1234CONFIG_INOTIFY=y
1143CONFIG_INOTIFY_USER=y 1235CONFIG_INOTIFY_USER=y
@@ -1145,6 +1237,7 @@ CONFIG_INOTIFY_USER=y
1145# CONFIG_AUTOFS_FS is not set 1237# CONFIG_AUTOFS_FS is not set
1146# CONFIG_AUTOFS4_FS is not set 1238# CONFIG_AUTOFS4_FS is not set
1147CONFIG_FUSE_FS=m 1239CONFIG_FUSE_FS=m
1240# CONFIG_CUSE is not set
1148 1241
1149# 1242#
1150# Caches 1243# Caches
@@ -1190,6 +1283,7 @@ CONFIG_MISC_FILESYSTEMS=y
1190# CONFIG_BEFS_FS is not set 1283# CONFIG_BEFS_FS is not set
1191# CONFIG_BFS_FS is not set 1284# CONFIG_BFS_FS is not set
1192# CONFIG_EFS_FS is not set 1285# CONFIG_EFS_FS is not set
1286# CONFIG_JFFS2_FS is not set
1193# CONFIG_CRAMFS is not set 1287# CONFIG_CRAMFS is not set
1194# CONFIG_SQUASHFS is not set 1288# CONFIG_SQUASHFS is not set
1195# CONFIG_VXFS_FS is not set 1289# CONFIG_VXFS_FS is not set
@@ -1328,41 +1422,40 @@ CONFIG_HAVE_FUNCTION_TRACER=y
1328CONFIG_HAVE_DYNAMIC_FTRACE=y 1422CONFIG_HAVE_DYNAMIC_FTRACE=y
1329CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y 1423CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
1330CONFIG_RING_BUFFER=y 1424CONFIG_RING_BUFFER=y
1425CONFIG_EVENT_TRACING=y
1426CONFIG_CONTEXT_SWITCH_TRACER=y
1331CONFIG_TRACING=y 1427CONFIG_TRACING=y
1332CONFIG_TRACING_SUPPORT=y 1428CONFIG_TRACING_SUPPORT=y
1333 1429CONFIG_FTRACE=y
1334#
1335# Tracers
1336#
1337# CONFIG_FUNCTION_TRACER is not set 1430# CONFIG_FUNCTION_TRACER is not set
1338# CONFIG_IRQSOFF_TRACER is not set 1431# CONFIG_IRQSOFF_TRACER is not set
1339# CONFIG_PREEMPT_TRACER is not set 1432# CONFIG_PREEMPT_TRACER is not set
1340# CONFIG_SCHED_TRACER is not set 1433# CONFIG_SCHED_TRACER is not set
1341# CONFIG_CONTEXT_SWITCH_TRACER is not set 1434# CONFIG_ENABLE_DEFAULT_TRACERS is not set
1342# CONFIG_EVENT_TRACER is not set
1343# CONFIG_BOOT_TRACER is not set 1435# CONFIG_BOOT_TRACER is not set
1344# CONFIG_TRACE_BRANCH_PROFILING is not set 1436CONFIG_BRANCH_PROFILE_NONE=y
1437# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
1438# CONFIG_PROFILE_ALL_BRANCHES is not set
1345# CONFIG_STACK_TRACER is not set 1439# CONFIG_STACK_TRACER is not set
1346# CONFIG_KMEMTRACE is not set 1440# CONFIG_KMEMTRACE is not set
1347# CONFIG_WORKQUEUE_TRACER is not set 1441# CONFIG_WORKQUEUE_TRACER is not set
1348# CONFIG_BLK_DEV_IO_TRACE is not set 1442# CONFIG_BLK_DEV_IO_TRACE is not set
1349# CONFIG_FTRACE_STARTUP_TEST is not set 1443# CONFIG_RING_BUFFER_BENCHMARK is not set
1350# CONFIG_DYNAMIC_DEBUG is not set 1444# CONFIG_DYNAMIC_DEBUG is not set
1351# CONFIG_DMA_API_DEBUG is not set 1445# CONFIG_DMA_API_DEBUG is not set
1352# CONFIG_SAMPLES is not set 1446# CONFIG_SAMPLES is not set
1353CONFIG_HAVE_ARCH_KGDB=y 1447CONFIG_HAVE_ARCH_KGDB=y
1354# CONFIG_KGDB is not set 1448# CONFIG_KGDB is not set
1355CONFIG_SH_STANDARD_BIOS=y 1449# CONFIG_SH_STANDARD_BIOS is not set
1356# CONFIG_EARLY_SCIF_CONSOLE is not set 1450CONFIG_EARLY_SCIF_CONSOLE=y
1357CONFIG_EARLY_PRINTK=y 1451CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe00000
1452# CONFIG_EARLY_PRINTK is not set
1358# CONFIG_DEBUG_BOOTMEM is not set 1453# CONFIG_DEBUG_BOOTMEM is not set
1359CONFIG_DEBUG_STACKOVERFLOW=y 1454CONFIG_DEBUG_STACKOVERFLOW=y
1360# CONFIG_DEBUG_STACK_USAGE is not set 1455# CONFIG_DEBUG_STACK_USAGE is not set
1361# CONFIG_4KSTACKS is not set 1456# CONFIG_4KSTACKS is not set
1362# CONFIG_IRQSTACKS is not set
1363CONFIG_DUMP_CODE=y 1457CONFIG_DUMP_CODE=y
1364# CONFIG_SH_NO_BSS_INIT is not set 1458# CONFIG_SH_NO_BSS_INIT is not set
1365# CONFIG_MORE_COMPILE_OPTIONS is not set
1366 1459
1367# 1460#
1368# Security options 1461# Security options
diff --git a/arch/sh/drivers/pci/Makefile b/arch/sh/drivers/pci/Makefile
index d2ffc477549a..d6303d0e494e 100644
--- a/arch/sh/drivers/pci/Makefile
+++ b/arch/sh/drivers/pci/Makefile
@@ -8,6 +8,7 @@ obj-$(CONFIG_CPU_SUBTYPE_SH7751R) += pci-sh7751.o ops-sh4.o
8obj-$(CONFIG_CPU_SUBTYPE_SH7763) += pci-sh7780.o ops-sh4.o 8obj-$(CONFIG_CPU_SUBTYPE_SH7763) += pci-sh7780.o ops-sh4.o
9obj-$(CONFIG_CPU_SUBTYPE_SH7780) += pci-sh7780.o ops-sh4.o 9obj-$(CONFIG_CPU_SUBTYPE_SH7780) += pci-sh7780.o ops-sh4.o
10obj-$(CONFIG_CPU_SUBTYPE_SH7785) += pci-sh7780.o ops-sh4.o 10obj-$(CONFIG_CPU_SUBTYPE_SH7785) += pci-sh7780.o ops-sh4.o
11obj-$(CONFIG_CPU_SUBTYPE_SH7786) += ops-sh7786.o
11obj-$(CONFIG_CPU_SH5) += pci-sh5.o ops-sh5.o 12obj-$(CONFIG_CPU_SH5) += pci-sh5.o ops-sh5.o
12 13
13obj-$(CONFIG_SH_DREAMCAST) += ops-dreamcast.o fixups-dreamcast.o \ 14obj-$(CONFIG_SH_DREAMCAST) += ops-dreamcast.o fixups-dreamcast.o \
diff --git a/arch/sh/drivers/pci/ops-dreamcast.c b/arch/sh/drivers/pci/ops-dreamcast.c
index e83d0d3aabe2..16e0a1baad88 100644
--- a/arch/sh/drivers/pci/ops-dreamcast.c
+++ b/arch/sh/drivers/pci/ops-dreamcast.c
@@ -18,7 +18,6 @@
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/irq.h>
22#include <mach/pci.h> 21#include <mach/pci.h>
23 22
24/* 23/*
diff --git a/arch/sh/drivers/pci/ops-sh7786.c b/arch/sh/drivers/pci/ops-sh7786.c
new file mode 100644
index 000000000000..48f594b9582b
--- /dev/null
+++ b/arch/sh/drivers/pci/ops-sh7786.c
@@ -0,0 +1,134 @@
1/*
2 * Generic SH7786 PCI-Express operations.
3 *
4 * Copyright (C) 2009 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License v2. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/pci.h>
13#include <linux/io.h>
14#include <linux/spinlock.h>
15#include "pcie-sh7786.h"
16
17enum {
18 PCI_ACCESS_READ,
19 PCI_ACCESS_WRITE,
20};
21
22static DEFINE_SPINLOCK(sh7786_pcie_lock);
23
24static int sh7786_pcie_config_access(unsigned char access_type,
25 struct pci_bus *bus, unsigned int devfn, int where, u32 *data)
26{
27 struct pci_channel *chan = bus->sysdata;
28 int dev, func;
29
30 dev = PCI_SLOT(devfn);
31 func = PCI_FUNC(devfn);
32
33 if (bus->number > 255 || dev > 31 || func > 7)
34 return PCIBIOS_FUNC_NOT_SUPPORTED;
35 if (devfn)
36 return PCIBIOS_DEVICE_NOT_FOUND;
37
38 /* Set the PIO address */
39 pci_write_reg(chan, (bus->number << 24) | (dev << 19) |
40 (func << 16) | (where & ~3), SH4A_PCIEPAR);
41
42 /* Enable the configuration access */
43 pci_write_reg(chan, (1 << 31), SH4A_PCIEPCTLR);
44
45 if (access_type == PCI_ACCESS_READ)
46 *data = pci_read_reg(chan, SH4A_PCIEPDR);
47 else
48 pci_write_reg(chan, *data, SH4A_PCIEPDR);
49
50 /* Check for master and target aborts */
51 if (pci_read_reg(chan, SH4A_PCIEPCICONF1) & ((1 << 29) | (1 << 28)))
52 return PCIBIOS_DEVICE_NOT_FOUND;
53
54 return PCIBIOS_SUCCESSFUL;
55}
56
57static int sh7786_pcie_read(struct pci_bus *bus, unsigned int devfn,
58 int where, int size, u32 *val)
59{
60 unsigned long flags;
61 int ret;
62 u32 data;
63
64 if ((size == 2) && (where & 1))
65 return PCIBIOS_BAD_REGISTER_NUMBER;
66 else if ((size == 4) && (where & 3))
67 return PCIBIOS_BAD_REGISTER_NUMBER;
68
69 spin_lock_irqsave(&sh7786_pcie_lock, flags);
70 ret = sh7786_pcie_config_access(PCI_ACCESS_READ, bus,
71 devfn, where, &data);
72 if (ret != PCIBIOS_SUCCESSFUL)
73 goto out;
74
75 if (size == 1)
76 *val = (data >> ((where & 3) << 3)) & 0xff;
77 else if (size == 2)
78 *val = (data >> ((where & 2) << 3)) & 0xffff;
79 else
80 *val = data;
81
82 dev_dbg(&bus->dev, "pcie-config-read: bus=%3d devfn=0x%04x "
83 "where=0x%04x size=%d val=0x%08lx\n", bus->number,
84 devfn, where, size, (unsigned long)*val);
85
86out:
87 spin_unlock_irqrestore(&sh7786_pcie_lock, flags);
88 return ret;
89}
90
91static int sh7786_pcie_write(struct pci_bus *bus, unsigned int devfn,
92 int where, int size, u32 val)
93{
94 unsigned long flags;
95 int shift, ret;
96 u32 data;
97
98 if ((size == 2) && (where & 1))
99 return PCIBIOS_BAD_REGISTER_NUMBER;
100 else if ((size == 4) && (where & 3))
101 return PCIBIOS_BAD_REGISTER_NUMBER;
102
103 spin_lock_irqsave(&sh7786_pcie_lock, flags);
104 ret = sh7786_pcie_config_access(PCI_ACCESS_READ, bus,
105 devfn, where, &data);
106 if (ret != PCIBIOS_SUCCESSFUL)
107 goto out;
108
109 dev_dbg(&bus->dev, "pcie-config-write: bus=%3d devfn=0x%04x "
110 "where=0x%04x size=%d val=%08lx\n", bus->number,
111 devfn, where, size, (unsigned long)val);
112
113 if (size == 1) {
114 shift = (where & 3) << 3;
115 data &= ~(0xff << shift);
116 data |= ((val & 0xff) << shift);
117 } else if (size == 2) {
118 shift = (where & 2) << 3;
119 data &= ~(0xffff << shift);
120 data |= ((val & 0xffff) << shift);
121 } else
122 data = val;
123
124 ret = sh7786_pcie_config_access(PCI_ACCESS_WRITE, bus,
125 devfn, where, &data);
126out:
127 spin_unlock_irqrestore(&sh7786_pcie_lock, flags);
128 return ret;
129}
130
131struct pci_ops sh7786_pci_ops = {
132 .read = sh7786_pcie_read,
133 .write = sh7786_pcie_write,
134};
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 54d77cbb8b39..9a1c423ad167 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -53,12 +53,8 @@ static DEFINE_MUTEX(pci_scan_mutex);
53 53
54void __devinit register_pci_controller(struct pci_channel *hose) 54void __devinit register_pci_controller(struct pci_channel *hose)
55{ 55{
56 if (request_resource(&iomem_resource, hose->mem_resource) < 0) 56 request_resource(&iomem_resource, hose->mem_resource);
57 goto out; 57 request_resource(&ioport_resource, hose->io_resource);
58 if (request_resource(&ioport_resource, hose->io_resource) < 0) {
59 release_resource(hose->mem_resource);
60 goto out;
61 }
62 58
63 *hose_tail = hose; 59 *hose_tail = hose;
64 hose_tail = &hose->next; 60 hose_tail = &hose->next;
@@ -80,12 +76,6 @@ void __devinit register_pci_controller(struct pci_channel *hose)
80 pcibios_scanbus(hose); 76 pcibios_scanbus(hose);
81 mutex_unlock(&pci_scan_mutex); 77 mutex_unlock(&pci_scan_mutex);
82 } 78 }
83
84 return;
85
86out:
87 printk(KERN_WARNING
88 "Skipping PCI bus scan due to resource conflict\n");
89} 79}
90 80
91static int __init pcibios_init(void) 81static int __init pcibios_init(void)
diff --git a/arch/sh/drivers/pci/pcie-sh7786.h b/arch/sh/drivers/pci/pcie-sh7786.h
new file mode 100644
index 000000000000..c655290a7750
--- /dev/null
+++ b/arch/sh/drivers/pci/pcie-sh7786.h
@@ -0,0 +1,589 @@
1/*
2 * SH7786 PCI-Express controller definitions.
3 *
4 * Copyright (C) 2008, 2009 Renesas Technology Corp.
5 * All rights reserved.
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#ifndef __PCI_SH7786_H
12#define __PCI_SH7786_H
13
14/* PCIe bus-0(x4) on SH7786 */ // Rev1.171
15#define SH4A_PCIE_SPW_BASE 0xFE000000 /* spw config address for controller 0 */
16#define SH4A_PCIE_SPW_BASE1 0xFE200000 /* spw config address for controller 1 (Rev1.14)*/
17#define SH4A_PCIE_SPW_BASE2 0xFCC00000 /* spw config address for controller 2 (Rev1.171)*/
18#define SH4A_PCIE_SPW_BASE_LEN 0x00080000
19
20#define SH4A_PCI_CNFG_BASE 0xFE040000 /* pci config address for controller 0 */
21#define SH4A_PCI_CNFG_BASE1 0xFE240000 /* pci config address for controller 1 (Rev1.14)*/
22#define SH4A_PCI_CNFG_BASE2 0xFCC40000 /* pci config address for controller 2 (Rev1.171)*/
23#define SH4A_PCI_CNFG_BASE_LEN 0x00040000
24
25#define SH4A_PCIPIO_ADDR_OFFSET 0x000001c0 /* offset to pci config_address */
26#define SH4A_PCIPIO_DATA_OFFSET 0x00000220 /* offset to pci config_data */
27
28/*
29 * for PEX8111(Max Payload Size=128B,PCIIO_SIZE=64K),
30 * for other(Max Payload Size=4096B,PCIIO_SIZE=8M)
31 */
32
33/* PCI0-0: PCI I/O space */
34#define SH4A_PCIIO_BASE 0xFD000000 /* PCI I/O for controller 0 */
35#define SH4A_PCIIO_BASE1 0xFD800000 /* PCI I/O for controller 1 (Rev1.14)*/
36#define SH4A_PCIIO_BASE2 0xFC800000 /* PCI I/O for controller 2 (Rev1.171)*/
37
38#define SH4A_PCIIO_SIZE64 0x00010000 /* PLX allows only 64K */
39#define SH4A_PCIIO_SIZE 0x00800000 /* 8M */
40#define SH4A_PCIIO_SIZE2 0x00400000 /* 4M (Rev1.171)*/
41
42/* PCI0-1: PCI memory space 29-bit address */
43#define SH4A_PCIMEM_BASE 0x10000000
44#define SH4A_PCIMEM_SIZE 0x04000000 /* 64M */
45
46/* PCI0-2: PCI memory space 32-bit address */
47#define SH4A_PCIMEM_BASEA 0xC0000000 /* for controller 0 */
48#define SH4A_PCIMEM_BASEA1 0xA0000000 /* for controller 1 (Rev1.14)*/
49#define SH4A_PCIMEM_BASEA2 0x80000000 /* for controller 2 (Rev1.171)*/
50#define SH4A_PCIMEM_SIZEA 0x20000000 /* 512M */
51
52/* PCI0: PCI memory target transfer 32-bit address translation value(Rev1.11T)*/
53#define SH4A_PCIBMSTR_TRANSLATION 0x20000000
54
55#define SH4A_PCI_DEVICE_ID 0x0002
56#define SH4A_PCI_VENDOR_ID 0x1912
57
58// PCI compatible 000-03f
59#define PCI_CMD 0x004
60#define PCI_RID 0x008
61#define PCI_IBAR 0x010
62#define PCI_MBAR0 0x014
63#define PCI_MBAR1 0x018
64
65/* PCI power management/MSI/capablity 040-0ff */
66/* PCIE extended 100-fff */
67
68/* SH7786 device identification */ // Rev1.171
69#define SH4A_PVR (0xFF000030)
70#define SH4A_PVR_SHX3 (0x10400000)
71#define SH4A_PRR (0xFF000044)
72#define SH4A_PRR_SH7786 (0x00000400) // Rev1.171
73
74/* SPVCR0 */
75#define SH4A_PCIEVCR0 (0x000000) /* R - 0x0000 0000 32 */
76#define BITS_TOP_MB (24)
77#define MASK_TOP_MB (0xff<<BITS_TOP_MB)
78#define BITS_BOT_MB (16)
79#define MASK_BOT_MB (0xff<<BITS_BOT_MB)
80#define BITS_VC_ID (0)
81#define MASK_VC_ID (0xffff<<BITS_VC_ID)
82
83/* SPVCR1 */
84#define SH4A_PCIEVCR1 (0x000004) /* R - 0x0000 0000 32*/
85#define BITS_BADOPC (5) /* 5 BADOPC 0 R/W */
86#define MASK_BADOPC (1<<BITS_BADOPC)
87#define BITS_BADDEST (4) /*4 BADDEST 0 R/W */
88#define MASK_BADDEST (1<<BITS_BADDEST)
89#define BITS_UNSOLRESP (3) /* 3 UNSOLRESP 0 R/W */
90#define MASK_UNSOLRESP (1<<BITS_UNSOLRESP)
91#define BITS_ERRSNT (1) /* 1 ERRSNT 0 */
92#define MASK_ERRSNT (1<<BITS_ERRSNT)
93#define BITS_ERRRCV (0) /* 0 ERRRCV 0 */
94#define MASK_ERRRCV (1<<BITS_ERRRCV)
95
96/* PCIEECR */
97#define SH4A_PCIEECR (0x000008) /* R/W - 0x0000 0000 32 */
98#define BITS_ENBL (0) /* 0 ENBL 0 R/W */
99#define MASK_ENBL (1<<BITS_ENBL)
100
101/* PCIEPAR */
102#define SH4A_PCIEPAR (0x000010) /* R/W - 0x0000 0000 32 */
103#define BITS_BN (24)
104#define MASK_BN (0xff<<BITS_BN)
105#define BITS_DN (19)
106#define MASK_DN (0x1f<<BITS_DN)
107#define BITS_FN (16)
108#define MASK_FN (0x7<<BITS_FN)
109#define BITS_EREGNO (8)
110#define MASK_EREGNO (0xff<<BITS_EREGNO)
111#define BITS_REGNO (2)
112#define MASK_REGNO (0x3f<<BITS_REGNO)
113
114/* PCIEPCTLR */
115#define SH4A_PCIEPCTLR (0x000018) /* R/W - 0x0000 0000 32 */
116#define BITS_CCIE (31) /* 31 CCIE */
117#define MASK_CCIE (1<<BITS_CCIE)
118#define BITS_TYPE (8)
119#define MASK_TYPE (1<<BITS_TYPE)
120#define BITS_C_VC (0)
121#define MASK_C_VC (1<<BITS_C_VC)
122
123/* PCIEPDR */
124#define SH4A_PCIEPDR (0x000020) /* R/W - 0x0000 0000 32 */
125#define BITS_PDR (0)
126#define MASK_PDR (0xffffffff<<BITS_PDR)
127
128/* PCIEMSGALR */
129#define SH4A_PCIEMSGALR (0x000030) /* R/W - 0x0000 0000 32 */
130#define BITS_MSGADRL (0)
131#define MASK_MSGADRL (0xffffffff<<BITS_MSGADRL)
132
133/* PCIEMSGAHR */
134#define SH4A_PCIEMSGAHR (0x000034) /* R/W - 0x0000 0000 32 */
135#define BITS_MSGADRH (0)
136#define MASK_MSGADRH (0xffffffff<<BITS_MSGADRH)
137
138/* PCIEMSGCTLR */
139#define SH4A_PCIEMSGCTLR (0x000038) /* R/W - 0x0000 0000 32 */
140#define BITS_MSGIE (31)
141#define MASK_MSGIE (1<<BITS_MSGIE)
142#define BITS_MROUTE (16)
143#define MASK_MROUTE (0x7<<BITS_MROUTE)
144#define BITS_MCODE (8)
145#define MASK_MCODE (0xff<<BITS_MCODE)
146#define BITS_M_VC (0)
147#define MASK_M_VC (1<<BITS_M_VC)
148
149/* PCIEMSG */
150#define SH4A_PCIEMSG (0x000040) /* W - - 32 */
151#define BITS_MDATA (0)
152#define MASK_MDATA (0xffffffff<<BITS_MDATA)
153
154/* PCIEPHYCTLR */
155#define SH4A_PCIEPHYCTLR (0x010000) /* R/W - 0x0000 0000 32 */
156#define BITS_CKE (0)
157#define MASK_CKE (1<<BITS_CKE)
158
159/* PCIERMSGIER */
160#define SH4A_PCIERMSGIER (0x004040) /* R/W - 0x0000 0000 32 */
161
162/* PCIEPHYADRR */
163#define SH4A_PCIEPHYADRR (0x010004) /* R/W - 0x0000 0000 32 */
164#define BITS_ACK (24) // Rev1.171
165#define MASK_ACK (1<<BITS_ACK) // Rev1.171
166#define BITS_CMD (16) // Rev1.171
167#define MASK_CMD (0x03<<BITS_CMD) // Rev1.171
168#define BITS_LANE (8)
169#define MASK_LANE (0x0f<<BITS_LANE)
170#define BITS_ADR (0)
171#define MASK_ADR (0xff<<BITS_ADR)
172
173/* PCIEPHYDINR */ // Rev1.171 start.
174#define SH4A_PCIEPHYDINR (0x010008) /* R/W - 0x0000 0000 32 */
175
176/* PCIEPHYDOUTR */
177#define SH4A_PCIEPHYDOUTR (0x01000C) /* R/W - 0x0000 0000 32 */
178
179/* PCIEPHYSR */
180#define SH4A_PCIEPHYSR (0x010010) /* R/W - 0x0000 0000 32 */ // Rev1.171 end.
181
182/* PCIEPHYDATAR */
183#define SH4A_PCIEPHYDATAR (0x00008) /* R/W - 0xxxxx xxxx 32 */
184#define BITS_DATA (0)
185#define MASK_DATA (0xffffffff<<BITS_DATA)
186
187/* PCIETCTLR */
188#define SH4A_PCIETCTLR (0x020000) /* R/W R/W 0x0000 0000 32 */
189#define BITS_CFINT (0)
190#define MASK_CFINT (1<<BITS_CFINT)
191
192/* PCIETSTR */
193#define SH4A_PCIETSTR (0x020004) /* R/W R/W 0x0000 0000 32 */
194
195/* PCIEINTR */
196#define SH4A_PCIEINTR (0x020008) /* R/W R/W 0x0000 0000 32 */
197#define BITS_INT_RX_ERP (31)
198#define MASK_INT_RX_ERP (1<<BITS_INT_RX_ERP)
199#define BITS_INT_RX_VCX_Posted (30)
200#define MASK_INT_RX_VCX_Posted (1<<BITS_INT_RX_VCX_Posted)
201#define BITS_INT_RX_VCX_NonPosted (29)
202#define MASK_INT_RX_VCX_NonPosted (1<<BITS_INT_RX_VCX_NonPosted)
203#define BITS_INT_RX_VCX_CPL (28)
204#define MASK_INT_RX_VCX_CPL (1<<BITS_INT_RX_VCX_CPL)
205#define BITS_INT_TX_VCX_Posted (26)
206#define MASK_INT_TX_VCX_Posted (1<<BITS_INT_TX_VCX_Posted)
207#define BITS_INT_TX_VCX_NonPosted (25)
208#define MASK_INT_TX_VCX_NonPosted (1<<BITS_INT_TX_VCX_NonPosted)
209#define BITS_INT_TX_VCX_CPL (24)
210#define MASK_INT_TX_VCX_CPL (1<<BITS_INT_TX_VCX_CPL)
211#define BITS_INT_RX_VC0_Posted (22)
212#define MASK_INT_RX_VC0_Posted (1<<BITS_INT_RX_VC0_Posted)
213#define BITS_INT_RX_VC0_NonPosted (21)
214#define MASK_INT_RX_VC0_NonPosted (1<<BITS_INT_RX_VC0_NonPosted)
215#define BITS_INT_RX_VC0_CPL (20)
216#define MASK_INT_RX_VC0_CPL (1<<BITS_INT_RX_VC0_CPL)
217#define BITS_INT_TX_VC0_Posted (18)
218#define MASK_INT_TX_VC0_Posted (1<<BITS_INT_TX_VC0_Posted)
219#define BITS_INT_TX_VC0_NonPosted (17)
220#define MASK_INT_TX_VC0_NonPosted (1<<BITS_INT_TX_VC0_NonPosted)
221#define BITS_INT_TX_VC0_CPL (16)
222#define MASK_INT_TX_VC0_CPL (1<<BITS_INT_TX_VC0_CPL)
223#define BITS_INT_RX_CTRL (15)
224#define MASK_INT_RX_CTRL (1<<BITS_INT_RX_CTRL)
225#define BITS_INT_TX_CTRL (14)
226#define MASK_INT_TX_CTRL (1<<BITS_INT_TX_CTRL)
227#define BITS_INTTL (11)
228#define MASK_INTTL (1<<BITS_INTTL)
229#define BITS_INTDL (10)
230#define MASK_INTDL (1<<BITS_INTDL)
231#define BITS_INTMAC (9)
232#define MASK_INTMAC (1<<BITS_INTMAC)
233#define BITS_INTPM (8)
234#define MASK_INTPM (1<<BITS_INTPM)
235
236/* PCIEINTER */
237#define SH4A_PCIEINTER (0x02000C) /* R/W R/W 0x0000 0000 32 */
238#define BITS_INT_RX_ERP (31)
239#define MASK_INT_RX_ERP (1<<BITS_INT_RX_ERP)
240#define BITS_INT_RX_VCX_Posted (30)
241#define MASK_INT_RX_VCX_Posted (1<<BITS_INT_RX_VCX_Posted)
242#define BITS_INT_RX_VCX_NonPosted (29)
243#define MASK_INT_RX_VCX_NonPosted (1<<BITS_INT_RX_VCX_NonPosted)
244#define BITS_INT_RX_VCX_CPL (28)
245#define MASK_INT_RX_VCX_CPL (1<<BITS_INT_RX_VCX_CPL)
246#define BITS_INT_TX_VCX_Posted (26)
247#define MASK_INT_TX_VCX_Posted (1<<BITS_INT_TX_VCX_Posted)
248#define BITS_INT_TX_VCX_NonPosted (25)
249#define MASK_INT_TX_VCX_NonPosted (1<<BITS_INT_TX_VCX_NonPosted)
250#define BITS_INT_TX_VCX_CPL (24)
251#define MASK_INT_TX_VCX_CPL (1<<BITS_INT_TX_VCX_CPL)
252#define BITS_INT_RX_VC0_Posted (22)
253#define MASK_INT_RX_VC0_Posted (1<<BITS_INT_RX_VC0_Posted)
254#define BITS_INT_RX_VC0_NonPosted (21)
255#define MASK_INT_RX_VC0_NonPosted (1<<BITS_INT_RX_VC0_NonPosted)
256#define BITS_INT_RX_VC0_CPL (20)
257#define MASK_INT_RX_VC0_CPL (1<<BITS_INT_RX_VC0_CPL)
258#define BITS_INT_TX_VC0_Posted (18)
259#define MASK_INT_TX_VC0_Posted (1<<BITS_INT_TX_VC0_Posted)
260#define BITS_INT_TX_VC0_NonPosted (17)
261#define MASK_INT_TX_VC0_NonPosted (1<<BITS_INT_TX_VC0_NonPosted)
262#define BITS_INT_TX_VC0_CPL (16)
263#define MASK_INT_TX_VC0_CPL (1<<BITS_INT_TX_VC0_CPL)
264#define BITS_INT_RX_CTRL (15)
265#define MASK_INT_RX_CTRL (1<<BITS_INT_RX_CTRL)
266#define BITS_INT_TX_CTRL (14)
267#define MASK_INT_TX_CTRL (1<<BITS_INT_TX_CTRL)
268#define BITS_INTTL (11)
269#define MASK_INTTL (1<<BITS_INTTL)
270#define BITS_INTDL (10)
271#define MASK_INTDL (1<<BITS_INTDL)
272#define BITS_INTMAC (9)
273#define MASK_INTMAC (1<<BITS_INTMAC)
274#define BITS_INTPM (8)
275#define MASK_INTPM (1<<BITS_INTPM)
276
277/* PCIEAIR */
278#define SH4A_PCIEAIR (SH4A_PCIE_BASE + 0x020010) /* R/W R/W 0xxxxx xxxx 32 */
279
280/* PCIECIR */
281#define SH4A_PCIECIR (SH4A_PCIE_BASE) /* R/W R/W 0xxxxx xxxx 32 */
282
283/* PCIEERRFR */ // Rev1.18
284#define SH4A_PCIEERRFR (0x020020) /* R/W R/W 0xxxxx xxxx 32 */ // Rev1.18
285 // Rev1.18
286/* PCIELAR0 */
287#define SH4A_PCIELAR0 (0x020200) /* R/W R/W 0x0000 0000 32 */
288#define BITS_LARn (20)
289#define MASK_LARn (0xfff<<BITS_LARn)
290
291#define SH4A_PCIE_020204 (0x020204) /* R/W R/W 0x0000 0000 32 */
292
293/* PCIELAMR0 */
294#define SH4A_PCIELAMR0 (0x020208) /* R/W R/W 0x0000 0000 32 */
295#define BITS_LAMRn (20)
296#define MASK_LAMRn (0x1ff<<BITS_LAMRn)
297#define BITS_LAREn (0)
298#define MASK_LAREn (0x1<<BITS_LAREn)
299
300/* PCIECSCR0 */
301#define SH4A_PCIECSCR0 (0x020210) /* R/W R/W 0x0000 0000 32 */
302#define BITS_RANGE (2)
303#define MASK_RANGE (0x7<<BITS_RANGE)
304#define BITS_SNPMD (0)
305#define MASK_SNPMD (0x3<<BITS_SNPMD)
306
307/* PCIECSAR0 */
308#define SH4A_PCIECSAR0 (0x020214) /* R/W R/W 0x0000 0000 32 */
309#define BITS_CSADR (0)
310#define MASK_CSADR (0xffffffff<<BITS_CSADR)
311
312/* PCIESTCTLR0 */
313#define SH4A_PCIESTCTLR0 (0x020218) /* R/W R/W 0x0000 0000 32 */
314#define BITS_SHPRI (8)
315#define MASK_SHPRI (0x0f<<BITS_SHPRI)
316
317#define SH4A_PCIE_020224 (0x020224) /* R/W R/W 0x0000 0000 32 */
318
319#define SH4A_PCIELAR1 (0x020220) /* R/W R/W 0x0000 0000 32 */
320#define SH4A_PCIELAMR1 (0x020228) /* R/W R/W 0x0000 0000 32 */
321#define SH4A_PCIECSCR1 (0x020230) /* R/W R/W 0x0000 0000 32 */
322#define SH4A_PCIECSAR1 (0x020234) /* R/W R/W 0x0000 0000 32 */
323#define SH4A_PCIESTCTLR1 (0x020238) /* R/W R/W 0x0000 0000 32 */
324
325#define SH4A_PCIELAR2 (0x020240) /* R/W R/W 0x0000 0000 32 */
326#define SH4A_PCIE_020244 (0x020244) /* R/W R/W 0x0000 0000 32 */
327#define SH4A_PCIELAMR2 (0x020248) /* R/W R/W 0x0000 0000 32 */
328#define SH4A_PCIECSCR2 (0x020250) /* R/W R/W 0x0000 0000 32 */
329#define SH4A_PCIECSAR2 (0x020254) /* R/W R/W 0x0000 0000 32 */
330#define SH4A_PCIESTCTLR2 (0x020258) /* R/W R/W 0x0000 0000 32 */
331
332#define SH4A_PCIELAR3 (0x020260) /* R/W R/W 0x0000 0000 32 */
333#define SH4A_PCIE_020264 (0x020264) /* R/W R/W 0x0000 0000 32 */
334#define SH4A_PCIELAMR3 (0x020268) /* R/W R/W 0x0000 0000 32 */
335#define SH4A_PCIECSCR3 (0x020270) /* R/W R/W 0x0000 0000 32 */
336#define SH4A_PCIECSAR3 (0x020274) /* R/W R/W 0x0000 0000 32 */
337#define SH4A_PCIESTCTLR3 (0x020278) /* R/W R/W 0x0000 0000 32 */
338
339#define SH4A_PCIELAR4 (0x020280) /* R/W R/W 0x0000 0000 32 */
340#define SH4A_PCIE_020284 (0x020284) /* R/W R/W 0x0000 0000 32 */
341#define SH4A_PCIELAMR4 (0x020288) /* R/W R/W 0x0000 0000 32 */
342#define SH4A_PCIECSCR4 (0x020290) /* R/W R/W 0x0000 0000 32 */
343#define SH4A_PCIECSAR4 (0x020294) /* R/W R/W 0x0000 0000 32 */
344#define SH4A_PCIESTCTLR4 (0x020298) /* R/W R/W 0x0000 0000 32 */
345
346#define SH4A_PCIELAR5 (0x0202A0) /* R/W R/W 0x0000 0000 32 */
347#define SH4A_PCIE_0202A4 (0x0202A4) /* R/W R/W 0x0000 0000 32 */
348#define SH4A_PCIELAMR5 (0x0202A8) /* R/W R/W 0x0000 0000 32 */
349#define SH4A_PCIECSCR5 (0x0202B0) /* R/W R/W 0x0000 0000 32 */
350#define SH4A_PCIECSAR5 (0x0202B4) /* R/W R/W 0x0000 0000 32 */
351#define SH4A_PCIESTCTLR5 (0x0202B8) /* R/W R/W 0x0000 0000 32 */
352
353/* PCIEPARL0 */
354#define SH4A_PCIEPARL0 (0x020400) /* R/W R/W 0x0000 0000 32 */
355#define BITS_PAL (18)
356#define MASK_PAL (0x3fff<<BITS_PAL)
357
358/* PCIEPARH0 */
359#define SH4A_PCIEPARH0 (0x020404) /* R/W R/W 0x0000 0000 32 */
360#define BITS_PAH (0)
361#define MASK_PAH (0xffffffff<<BITS_PAH)
362
363/* PCIEPAMR0 */
364#define SH4A_PCIEPAMR0 (0x020408) /* R/W R/W 0x0000 0000 32 */
365#define BITS_PAM (18)
366#define MASK_PAM (0x3fff<<BITS_PAM)
367
368/* PCIEPTCTLR0 */
369#define SH4A_PCIEPTCTLR0 (0x02040C) /* R/W R/W 0x0000 0000 32 */
370#define BITS_PARE (31)
371#define MASK_PARE (0x1<<BITS_PARE)
372#define BITS_TC (20)
373#define MASK_TC (0x7<<BITS_TC)
374#define BITS_T_VC (16)
375#define MASK_T_VC (0x1<<BITS_T_VC)
376#define BITS_LOCK (12)
377#define MASK_LOCK (0x1<<BITS_LOCK)
378#define BITS_SPC (8)
379#define MASK_SPC (0x1<<BITS_SPC)
380
381#define SH4A_PCIEPARL1 (0x020420) /* R/W R/W 0x0000 0000 32 */
382#define SH4A_PCIEPARH1 (0x020424) /* R/W R/W 0x0000 0000 32 */
383#define SH4A_PCIEPAMR1 (0x020428) /* R/W R/W 0x0000 0000 32 */
384#define SH4A_PCIEPTCTLR1 (0x02042C) /* R/W R/W 0x0000 0000 32 */
385#define SH4A_PCIEPARL2 (0x020440) /* R/W R/W 0x0000 0000 32 */
386#define SH4A_PCIEPARH2 (0x020444) /* R/W R/W 0x0000 0000 32 */
387#define SH4A_PCIEPAMR2 (0x020448) /* R/W R/W 0x0000 0000 32 */
388#define SH4A_PCIEPTCTLR2 (0x02044C) /* R/W R/W 0x0000 0000 32 */
389#define SH4A_PCIEPARL3 (0x020460) /* R/W R/W 0x0000 0000 32 */
390#define SH4A_PCIEPARH3 (0x020464) /* R/W R/W 0x0000 0000 32 */
391#define SH4A_PCIEPAMR3 (0x020468) /* R/W R/W 0x0000 0000 32 */
392#define SH4A_PCIEPTCTLR3 (0x02046C) /* R/W R/W 0x0000 0000 32 */
393#define SH4A_PCIEPARL4 (0x020480) /* R/W R/W 0x0000 0000 32 */
394#define SH4A_PCIEPARH4 (0x020484) /* R/W R/W 0x0000 0000 32 */
395#define SH4A_PCIEPAMR4 (0x020488) /* R/W R/W 0x0000 0000 32 */
396#define SH4A_PCIEPTCTLR4 (0x02048C) /* R/W R/W 0x0000 0000 32 */
397#define SH4A_PCIEPARL5 (0x0204A0) /* R/W R/W 0x0000 0000 32 */
398#define SH4A_PCIEPARH5 (0x0204A4) /* R/W R/W 0x0000 0000 32 */
399#define SH4A_PCIEPAMR5 (0x0204A8) /* R/W R/W 0x0000 0000 32 */
400#define SH4A_PCIEPTCTLR5 (0x0204AC) /* R/W R/W 0x0000 0000 32 */
401#define SH4A_PCIEDMAOR (0x021000) /* R/W R/W 0x0000 0000 32 */
402#define SH4A_PCIEDMSAR0 (0x021100) /* R/W R/W 0x0000 0000 32 */
403#define SH4A_PCIEDMSAHR0 (0x021104) /* R/W R/W 0x0000 0000 32 */
404#define SH4A_PCIEDMDAR0 (0x021108) /* R/W R/W 0x0000 0000 32 */
405#define SH4A_PCIEDMDAHR0 (0x02110C) /* R/W R/W 0x0000 0000 32 */
406#define SH4A_PCIEDMBCNTR0 (0x021110) /* R/W R/W 0x0000 0000 32 */
407#define SH4A_PCIEDMSBCNTR0 (0x021114) /* R/W R/W 0x0000 0000 32 */
408#define SH4A_PCIEDMSTRR0 (0x021118) /* R/W R/W 0x0000 0000 32 */
409#define SH4A_PCIEDMCCAR0 (0x02111C) /* R/W R/W 0x0000 0000 32 */
410#define SH4A_PCIEDMCCR0 (0x021120) /* R/W R/W 0x0000 0000 32 */
411#define SH4A_PCIEDMCC2R0 (0x021124) /* R/W R/W 0x0000 0000 - */
412#define SH4A_PCIEDMCCCR0 (0x021128) /* R/W R/W 0x0000 0000 32 */
413#define SH4A_PCIEDMSAR1 (0x021140) /* R/W R/W 0x0000 0000 32 */
414#define SH4A_PCIEDMSAHR1 (0x021144) /* R/W R/W 0x0000 0000 32 */
415#define SH4A_PCIEDMDAR1 (0x021148) /* R/W R/W 0x0000 0000 32 */
416#define SH4A_PCIEDMDAHR1 (0x02114C) /* R/W R/W 0x0000 0000 32 */
417#define SH4A_PCIEDMBCNTR1 (0x021150) /* R/W R/W 0x0000 0000 32 */
418#define SH4A_PCIEDMSBCNTR1 (0x021154) /* R/W R/W 0x0000 0000 32 */
419#define SH4A_PCIEDMSTRR1 (0x021158) /* R/W R/W 0x0000 0000 32 */
420#define SH4A_PCIEDMCCAR1 (0x02115C) /* R/W R/W 0x0000 0000 32 */
421#define SH4A_PCIEDMCCR1 (0x021160) /* R/W R/W 0x0000 0000 32 */
422#define SH4A_PCIEDMCC2R1 (0x021164) /* R/W R/W 0x0000 0000 - */
423#define SH4A_PCIEDMCCCR1 (0x021168) /* R/W R/W 0x0000 0000 32 */
424#define SH4A_PCIEDMSAR2 (0x021180) /* R/W R/W 0x0000 0000 32 */
425#define SH4A_PCIEDMSAHR2 (0x021184) /* R/W R/W 0x0000 0000 32 */
426#define SH4A_PCIEDMDAR2 (0x021188) /* R/W R/W 0x0000 0000 32 */
427#define SH4A_PCIEDMDAHR2 (0x02118C) /* R/W R/W 0x0000 0000 32 */
428#define SH4A_PCIEDMBCNTR2 (0x021190) /* R/W R/W 0x0000 0000 32 */
429#define SH4A_PCIEDMSBCNTR2 (0x021194) /* R/W R/W 0x0000 0000 32 */
430#define SH4A_PCIEDMSTRR2 (0x021198) /* R/W R/W 0x0000 0000 32 */
431#define SH4A_PCIEDMCCAR2 (0x02119C) /* R/W R/W 0x0000 0000 32 */
432#define SH4A_PCIEDMCCR2 (0x0211A0) /* R/W R/W 0x0000 0000 32 */
433#define SH4A_PCIEDMCC2R2 (0x0211A4) /* R/W R/W 0x0000 0000 - */
434#define SH4A_PCIEDMCCCR2 (0x0211A8) /* R/W R/W 0x0000 0000 32 */
435#define SH4A_PCIEDMSAR3 (0x0211C0) /* R/W R/W 0x0000 0000 32 */
436#define SH4A_PCIEDMSAHR3 (0x0211C4) /* R/W R/W 0x0000 0000 32 */
437#define SH4A_PCIEDMDAR3 (0x0211C8) /* R/W R/W 0x0000 0000 32 */
438#define SH4A_PCIEDMDAHR3 (0x0211CC) /* R/W R/W 0x0000 0000 32 */
439#define SH4A_PCIEDMBCNTR3 (0x0211D0) /* R/W R/W 0x0000 0000 32 */
440#define SH4A_PCIEDMSBCNTR3 (0x0211D4) /* R/W R/W 0x0000 0000 32 */
441#define SH4A_PCIEDMSTRR3 (0x0211D8) /* R/W R/W 0x0000 0000 32 */
442#define SH4A_PCIEDMCCAR3 (0x0211DC) /* R/W R/W 0x0000 0000 32 */
443#define SH4A_PCIEDMCCR3 (0x0211E0) /* R/W R/W 0x0000 0000 32 */
444#define SH4A_PCIEDMCC2R3 (0x0211E4) /* R/W R/W 0x0000 0000 - */
445#define SH4A_PCIEDMCCCR3 (0x0211E8) /* R/W R/W 0x0000 0000 32 */
446#define SH4A_PCIEPCICONF0 (0x040000) /* R R - 8/16/32 */
447#define SH4A_PCIEPCICONF1 (0x040004) /* R/W R/W 0x0008 0000 8/16/32 */
448#define SH4A_PCIEPCICONF2 (0x040008) /* R/W R/W 0xFF00 0000 8/16/32 */
449#define SH4A_PCIEPCICONF3 (0x04000C) /* R/W R/W 0x0000 0000 8/16/32 */
450#define SH4A_PCIEPCICONF4 (0x040010) /* - R/W - 8/16/32 */
451#define SH4A_PCIEPCICONF5 (0x040014) /* - R/W - 8/16/32 */
452#define SH4A_PCIEPCICONF6 (0x040018) /* - R/W - 8/16/32 */
453#define SH4A_PCIEPCICONF7 (0x04001C) /* - R/W - 8/16/32 */
454#define SH4A_PCIEPCICONF8 (0x040020) /* - R/W - 8/16/32 */
455#define SH4A_PCIEPCICONF9 (0x040024) /* - R/W - 8/16/32 */
456#define SH4A_PCIEPCICONF10 (0x040028) /* R/W R/W 0x0000 0000 8/16/32 */
457#define SH4A_PCIEPCICONF11 (0x04002C) /* R/W R/W 0x0000 0000 8/16/32 */
458#define SH4A_PCIEPCICONF12 (0x040030) /* R/W R/W 0x0000 0000 8/16/32 */
459#define SH4A_PCIEPCICONF13 (0x040034) /* R/W R/W 0x0000 0040 8/16/32 */
460#define SH4A_PCIEPCICONF14 (0x040038) /* R/W R/W 0x0000 0000 8/16/32 */
461#define SH4A_PCIEPCICONF15 (0x04003C) /* R/W R/W 0x0000 00FF 8/16/32 */
462#define SH4A_PCIEPMCAP0 (0x040040) /* R/W R 0x0003 5001 8/16/32 */
463#define SH4A_PCIEPMCAP1 (0x040044) /* R/W R/W 0x0000 0000 8/16/32 */
464#define SH4A_PCIEMSICAP0 (0x040050) /* R/W R/W 0x0180 7005 8/16/32 */
465#define SH4A_PCIEMSICAP1 (0x040054) /* R/W R/W 0x0000 0000 8/16/32 */
466#define SH4A_PCIEMSICAP2 (0x040058) /* R/W R/W 0x0000 0000 8/16/32 */
467#define SH4A_PCIEMSICAP3 (0x04005C) /* R/W R/W 0x0000 0000 8/16/32 */
468#define SH4A_PCIEMSICAP4 (0x040060) /* R/W R/W 0x0000 0000 8/16/32 */
469#define SH4A_PCIEMSICAP5 (0x040064) /* R/W R/W 0x0000 0000 8/16/32 */
470#define SH4A_PCIEEXPCAP0 (0x040070) /* R/W R/W 0x0001 0010 8/16/32 */
471#define SH4A_PCIEEXPCAP1 (0x040074) /* R/W R 0x0000 0005 8/16/32 */
472#define SH4A_PCIEEXPCAP2 (0x040078) /* R/W R/W 0x0000 0801 8/16/32 */
473#define SH4A_PCIEEXPCAP3 (0x04007C) /* R/W R 0x0003 F421 8/16/32 */
474#define SH4A_PCIEEXPCAP4 (0x040080) /* R/W R/W 0x0041 0000 8/16/32 */
475#define SH4A_PCIEEXPCAP5 (0x040084) /* R/W R/W 0x0000 0000 8/16/32 */
476#define SH4A_PCIEEXPCAP6 (0x040088) /* R/W R/W 0x0000 03C0 8/16/32 */
477#define SH4A_PCIEEXPCAP7 (0x04008C) /* R/W R/W 0x0000 0000 8/16/32 */
478#define SH4A_PCIEEXPCAP8 (0x040090) /* R/W R/W 0x0000 0000 8/16/32 */
479#define SH4A_PCIEVCCAP0 (0x040100) /* R/W R 0x1B01 0002 8/16/32 */
480#define SH4A_PCIEVCCAP1 (0x040104) /* R R 0x0000 0001 8/16/32 */
481#define SH4A_PCIEVCCAP2 (0x040108) /* R R 0x0000 0000 8/16/32 */
482#define SH4A_PCIEVCCAP3 (0x04010C) /* R R/W 0x0000 0000 8/16/32 */
483#define SH4A_PCIEVCCAP4 (0x040110) /* R/W R/W 0x0000 0000 8/16/32 */
484#define SH4A_PCIEVCCAP5 (0x040114) /* R/W R/W 0x8000 00FF 8/16/32 */
485#define SH4A_PCIEVCCAP6 (0x040118) /* R/W R 0x0002 0000 8/16/32 */
486#define SH4A_PCIEVCCAP7 (0x04011C) /* R/W R/W 0x0000 0000 8/16/32 */
487#define SH4A_PCIEVCCAP8 (0x040120) /* R/W R/W 0x0000 0000 8/16/32 */
488#define SH4A_PCIEVCCAP9 (0x040124) /* R/W R 0x0002 0000 8/16/32 */
489#define SH4A_PCIENUMCAP0 (0x0001B0) /* RW R 0x0001 0003 8/16/32 */
490#define SH4A_PCIENUMCAP1 (0x0001B4) /* R R 0x0000 0000 8/16/32 */
491#define SH4A_PCIENUMCAP2 (0x0001B8) /* R R 0x0000 0000 8/16/32 */
492#define SH4A_PCIEIDSETR0 (0x041000) /* R/W R 0x0000 FFFF 16/32 */
493#define SH4A_PCIEIDSETR1 (0x041004) /* R/W R 0xFF00 0000 16/32 */
494#define SH4A_PCIEBAR0SETR (0x041008) /* R/W R 0x0000 0000 16/32 */
495#define SH4A_PCIEBAR1SETR (0x04100C) /* R/W R 0x0000 0000 16/32 */
496#define SH4A_PCIEBAR2SETR (0x041010) /* R/W R 0x0000 0000 16/32 */
497#define SH4A_PCIEBAR3SETR (0x041014) /* R/W R 0x0000 0000 16/32 */
498#define SH4A_PCIEBAR4SETR (0x041018) /* R/W R 0x0000 0000 16/32 */
499#define SH4A_PCIEBAR5SETR (0x04101C) /* R/W R 0x0000 0000 16/32 */
500#define SH4A_PCIECISSETR (0x041020) /* R/W R 0x0000 0000 16/32 */
501#define SH4A_PCIEIDSETR2 (0x041024) /* R/W R 0x0000 0000 16/32 */
502#define SH4A_PCIEEROMSETR (0x041028) /* R/W R 0x0000 0000 16/32 */
503#define SH4A_PCIEDSERSETR0 (0x04102C) /* R/W R 0x0000 0000 16/32 */
504#define SH4A_PCIEDSERSETR1 (0x041030) /* R/W R 0x0000 0000 16/32 */
505#define SH4A_PCIECTLR (0x041040) /* R/W R 0x0000 0000 16/32 */
506#define SH4A_PCIETLSR (0x041044) /* R/W1C R 0x0000 0000 16/32 */
507#define SH4A_PCIETLCTLR (0x041048) /* R/W R 0x0000 0000 16/32 */
508#define SH4A_PCIEDLSR (0x04104C) /* R/W1C R 0x4003 0000 16/32 */
509#define SH4A_PCIEDLCTLR (0x041050) /* R R 0x0000 0000 16/32 */
510#define SH4A_PCIEMACSR (0x041054) /* R/W1C R 0x0041 0000 16/32 */
511#define SH4A_PCIEMACCTLR (0x041058) /* R/W R 0x0000 0000 16/32 */
512#define PCIEMACCTLR_SCR_DIS (1 << 27) /* scramble disable */
513#define SH4A_PCIEPMSTR (0x04105C) /* R/W1C R 0x0000 0000 16/32 */
514#define SH4A_PCIEPMCTLR (0x041060) /* R/W R 0x0000 0000 16/32 */
515#define SH4A_PCIETLINTENR (0x041064) /* R/W R 0x0000 0000 16/32 */
516#define SH4A_PCIEDLINTENR (0x041068) /* R/W R 0x0000 0000 16/32 */
517#define PCIEDLINTENR_DLL_ACT_ENABLE (1 << 31) /* DL active irq */
518#define SH4A_PCIEMACINTENR (0x04106C) /* R/W R 0x0000 0000 16/32 */
519#define SH4A_PCIEPMINTENR (0x041070) /* R/W R 0x0000 0000 16/32 */
520#define SH4A_PCIETXDCTLR (0x044000) /* R/W - H'00000000_00000000 32/64 */
521#define SH4A_PCIETXCTLR (0x044020) /* R/W - H'00000000_00000000 32/64 */
522#define SH4A_PCIETXSR (0x044028) /* R - H'00000000_00000000 32/64 */
523#define SH4A_PCIETXVC0DCTLR (0x044100) /* R/W - H'00000000_00000000 32/64 */
524#define SH4A_PCIETXVC0SR (0x044108) /* R/W - H'00888000_00000000 32/64 */
525#define SH4A_PCIEVC0PDTXR (0x044110) /* W - H'00000000_00000000 32/64 */
526#define SH4A_PCIEVC0PHTXR (0x044118) /* W - H'00000000_00000000 32/64 */
527#define SH4A_PCIEVC0NPDTXR (0x044120) /* W - H'00000000_00000000 32/64 */
528#define SH4A_PCIEVC0NPHTXR (0x044128) /* W - H'00000000_00000000 32/64 */
529#define SH4A_PCIEVC0CDTXR (0x044130) /* W - H'00000000_00000000 32/64 */
530#define SH4A_PCIEVC0CHTXR (0x044138) /* W - H'00000000_00000000 32/64 */
531#define SH4A_PCIETXVCXDCTLR (0x044200) /* R/W - H'00000000_00000000 32/64 */
532#define SH4A_PCIETXVCXSR (0x044208) /* R/W - H'00000000_00000000 32/64 */
533#define SH4A_PCIEVCXPDTXR (0x044210) /* W - H'00000000_00000000 32/64 */
534#define SH4A_PCIEVCXPHTXR (0x044218) /* W - H'00000000_00000000 32/64 */
535#define SH4A_PCIEVCXNPDTXR (0x044220) /* W - H'00000000_00000000 32/64 */
536#define SH4A_PCIEVCXNPHTXR (0x044228) /* W - H'00000000_00000000 32/64 */
537#define SH4A_PCIEVCXCDTXR (0x044230) /* W - H'00000000_00000000 32/64 */
538#define SH4A_PCIEVCXCHTXR (0x044238) /* W - H'00000000_00000000 32/64 */
539#define SH4A_PCIERDCTLR (0x046000) /* RW - H'00000000_00000000 32/64 */
540#define SH4A_PCIEERPCTLR (0x046008) /* RW - H'00000000_00000000 32/64 */
541#define SH4A_PCIEERPHR (0x046010) /* R - H'00000000_00000000 32/64 */
542#define SH4A_PCIEERPERR (0x046018) /* R - H'00000000_00000000 32/64 */
543#define SH4A_PCIERXVC0DCTLR (0x046100) /* RW - H'00000000_00000000 32/64 */
544#define SH4A_PCIERXVC0SR (0x046108) /* RW - H'00000000_00000000 32/64 */
545#define SH4A_PCIEVC0PDRXR (0x046140) /* R - H'00000000_00000000 32/64 */
546#define SH4A_PCIEVC0PHRXR (0x046148) /* R - H'00000000_00000000 32/64 */
547#define SH4A_PCIEVC0PERR (0x046150) /* R - H'00000000_00000000 32/64 */
548#define SH4A_PCIEVC0NPDRXR (0x046158) /* R - H'00000000_00000000 32/64 */
549#define SH4A_PCIEVC0NPHRXR (0x046160) /* R - H'00000000_00000000 32/64 */
550#define SH4A_PCIEVC0NPERR (0x046168) /* R - H'00000000_00000000 32/64 */
551#define SH4A_PCIEVC0CDRXR (0x046170) /* R - H'00000000_00000000 32/64 */
552#define SH4A_PCIEVC0CHRXR (0x046178) /* R - H'00000000_00000000 32/64 */
553#define SH4A_PCIEVC0CERR (0x046180) /* R - H'00000000_00000000 32/64 */
554#define SH4A_PCIERXVCXDCTLR (0x046200) /* RW - H'00000000_00000000 32/64 */
555#define SH4A_PCIERXVCXSR (0x046208) /* RW - H'00000000_00000000 32/64 */
556#define SH4A_PCIEVCXPDRXR (0x046240) /* R - H'00000000_00000000 32/64 */
557#define SH4A_PCIEVCXPHRXR (0x046248) /* R H'00000000_00000000 32/64 */
558#define SH4A_PCIEVCXPERR (0x046250) /* R H'00000000_00000000 32/64 */
559#define SH4A_PCIEVCXNPDRXR (0x046258) /* R H'00000000_00000000 32/64 */
560#define SH4A_PCIEVCXNPHRXR (0x046260) /* R H'00000000_00000000 32/64 */
561#define SH4A_PCIEVCXNPERR (0x046268) /* R H'00000000_00000000 32/64 */
562#define SH4A_PCIEVCXCDRXR (0x046270) /* R H'00000000_00000000 32/64 */
563#define SH4A_PCIEVCXCHRXR (0x046278) /* R H'00000000_00000000 32/64 */
564#define SH4A_PCIEVCXCERR (0x046280) /* R H'00000000_00000000 32/64 */
565
566/* SSI Register Definition for MSI WORK AROUND --hamada */
567#define SH4A_PCI_SSI_BASE 0xFFE00000 /* spw config address */
568#define SH4A_PCI_SSI_BASE_LEN 0x00100000 /* 1MB */
569
570#define SH4A_SSICR0 (0x000000)
571#define SH4A_SSICR1 (0x010000)
572#define SH4A_SSICR2 (0x020000)
573#define SH4A_SSICR3 (0x030000)
574
575#define PCI_REG(x) ((x) + 0x40000)
576
577static inline void
578pci_write_reg(struct pci_channel *chan, unsigned long val, unsigned long reg)
579{
580 __raw_writel(val, chan->reg_base + reg);
581}
582
583static inline unsigned long
584pci_read_reg(struct pci_channel *chan, unsigned long reg)
585{
586 return __raw_readl(chan->reg_base + reg);
587}
588
589#endif /* __PCI_SH7786_H */
diff --git a/arch/sh/include/asm/atomic-irq.h b/arch/sh/include/asm/atomic-irq.h
index a0b348068cae..467d9415a32e 100644
--- a/arch/sh/include/asm/atomic-irq.h
+++ b/arch/sh/include/asm/atomic-irq.h
@@ -10,29 +10,29 @@ static inline void atomic_add(int i, atomic_t *v)
10{ 10{
11 unsigned long flags; 11 unsigned long flags;
12 12
13 local_irq_save(flags); 13 raw_local_irq_save(flags);
14 v->counter += i; 14 v->counter += i;
15 local_irq_restore(flags); 15 raw_local_irq_restore(flags);
16} 16}
17 17
18static inline void atomic_sub(int i, atomic_t *v) 18static inline void atomic_sub(int i, atomic_t *v)
19{ 19{
20 unsigned long flags; 20 unsigned long flags;
21 21
22 local_irq_save(flags); 22 raw_local_irq_save(flags);
23 v->counter -= i; 23 v->counter -= i;
24 local_irq_restore(flags); 24 raw_local_irq_restore(flags);
25} 25}
26 26
27static inline int atomic_add_return(int i, atomic_t *v) 27static inline int atomic_add_return(int i, atomic_t *v)
28{ 28{
29 unsigned long temp, flags; 29 unsigned long temp, flags;
30 30
31 local_irq_save(flags); 31 raw_local_irq_save(flags);
32 temp = v->counter; 32 temp = v->counter;
33 temp += i; 33 temp += i;
34 v->counter = temp; 34 v->counter = temp;
35 local_irq_restore(flags); 35 raw_local_irq_restore(flags);
36 36
37 return temp; 37 return temp;
38} 38}
@@ -41,11 +41,11 @@ static inline int atomic_sub_return(int i, atomic_t *v)
41{ 41{
42 unsigned long temp, flags; 42 unsigned long temp, flags;
43 43
44 local_irq_save(flags); 44 raw_local_irq_save(flags);
45 temp = v->counter; 45 temp = v->counter;
46 temp -= i; 46 temp -= i;
47 v->counter = temp; 47 v->counter = temp;
48 local_irq_restore(flags); 48 raw_local_irq_restore(flags);
49 49
50 return temp; 50 return temp;
51} 51}
@@ -54,18 +54,18 @@ static inline void atomic_clear_mask(unsigned int mask, atomic_t *v)
54{ 54{
55 unsigned long flags; 55 unsigned long flags;
56 56
57 local_irq_save(flags); 57 raw_local_irq_save(flags);
58 v->counter &= ~mask; 58 v->counter &= ~mask;
59 local_irq_restore(flags); 59 raw_local_irq_restore(flags);
60} 60}
61 61
62static inline void atomic_set_mask(unsigned int mask, atomic_t *v) 62static inline void atomic_set_mask(unsigned int mask, atomic_t *v)
63{ 63{
64 unsigned long flags; 64 unsigned long flags;
65 65
66 local_irq_save(flags); 66 raw_local_irq_save(flags);
67 v->counter |= mask; 67 v->counter |= mask;
68 local_irq_restore(flags); 68 raw_local_irq_restore(flags);
69} 69}
70 70
71#endif /* __ASM_SH_ATOMIC_IRQ_H */ 71#endif /* __ASM_SH_ATOMIC_IRQ_H */
diff --git a/arch/sh/include/asm/checksum.h b/arch/sh/include/asm/checksum.h
index 67496ab0ef04..fc26d1f4b590 100644
--- a/arch/sh/include/asm/checksum.h
+++ b/arch/sh/include/asm/checksum.h
@@ -1,5 +1,5 @@
1#ifdef CONFIG_SUPERH32 1#ifdef CONFIG_SUPERH32
2# include "checksum_32.h" 2# include "checksum_32.h"
3#else 3#else
4# include "checksum_64.h" 4# include <asm-generic/checksum.h>
5#endif 5#endif
diff --git a/arch/sh/include/asm/checksum_64.h b/arch/sh/include/asm/checksum_64.h
deleted file mode 100644
index 9c62a031a8f5..000000000000
--- a/arch/sh/include/asm/checksum_64.h
+++ /dev/null
@@ -1,78 +0,0 @@
1#ifndef __ASM_SH_CHECKSUM_64_H
2#define __ASM_SH_CHECKSUM_64_H
3
4/*
5 * include/asm-sh/checksum_64.h
6 *
7 * Copyright (C) 2000, 2001 Paolo Alberelli
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
12 */
13
14/*
15 * computes the checksum of a memory block at buff, length len,
16 * and adds in "sum" (32-bit)
17 *
18 * returns a 32-bit number suitable for feeding into itself
19 * or csum_tcpudp_magic
20 *
21 * this function must be called with even lengths, except
22 * for the last fragment, which may be odd
23 *
24 * it's best to have buff aligned on a 32-bit boundary
25 */
26asmlinkage __wsum csum_partial(const void *buff, int len, __wsum sum);
27
28/*
29 * Note: when you get a NULL pointer exception here this means someone
30 * passed in an incorrect kernel address to one of these functions.
31 *
32 * If you use these functions directly please don't forget the
33 * access_ok().
34 */
35
36
37__wsum csum_partial_copy_nocheck(const void *src, void *dst, int len,
38 __wsum sum);
39
40__wsum csum_partial_copy_from_user(const void __user *src, void *dst,
41 int len, __wsum sum, int *err_ptr);
42
43static inline __sum16 csum_fold(__wsum csum)
44{
45 u32 sum = (__force u32)csum;
46 sum = (sum & 0xffff) + (sum >> 16);
47 sum = (sum & 0xffff) + (sum >> 16);
48 return (__force __sum16)~sum;
49}
50
51__sum16 ip_fast_csum(const void *iph, unsigned int ihl);
52
53__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
54 unsigned short len, unsigned short proto,
55 __wsum sum);
56
57/*
58 * computes the checksum of the TCP/UDP pseudo-header
59 * returns a 16-bit checksum, already complemented
60 */
61static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
62 unsigned short len,
63 unsigned short proto,
64 __wsum sum)
65{
66 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
67}
68
69/*
70 * this routine is used for miscellaneous IP-like checksums, mainly
71 * in icmp.c
72 */
73static inline __sum16 ip_compute_csum(const void *buff, int len)
74{
75 return csum_fold(csum_partial(buff, len, 0));
76}
77
78#endif /* __ASM_SH_CHECKSUM_64_H */
diff --git a/arch/sh/include/asm/current.h b/arch/sh/include/asm/current.h
index 62b63880b333..4c51401b5537 100644
--- a/arch/sh/include/asm/current.h
+++ b/arch/sh/include/asm/current.h
@@ -1,20 +1 @@
1#ifndef __ASM_SH_CURRENT_H #include <asm-generic/current.h>
2#define __ASM_SH_CURRENT_H
3
4/*
5 * Copyright (C) 1999 Niibe Yutaka
6 *
7 */
8
9#include <linux/thread_info.h>
10
11struct task_struct;
12
13static __inline__ struct task_struct * get_current(void)
14{
15 return current_thread_info()->task;
16}
17
18#define current get_current()
19
20#endif /* __ASM_SH_CURRENT_H */
diff --git a/arch/sh/include/asm/dma.h b/arch/sh/include/asm/dma.h
index 6bd178473878..04ad0e1e637e 100644
--- a/arch/sh/include/asm/dma.h
+++ b/arch/sh/include/asm/dma.h
@@ -16,13 +16,7 @@
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/sysdev.h> 17#include <linux/sysdev.h>
18#include <cpu/dma.h> 18#include <cpu/dma.h>
19 19#include <asm-generic/dma.h>
20/* The maximum address that we can perform a DMA transfer to on this platform */
21/* Don't define MAX_DMA_ADDRESS; it's useless on the SuperH and any
22 occurrence should be flagged as an error. */
23/* But... */
24/* XXX: This is not applicable to SuperH, just needed for alloc_bootmem */
25#define MAX_DMA_ADDRESS (PAGE_OFFSET+0x10000000)
26 20
27#ifdef CONFIG_NR_DMA_CHANNELS 21#ifdef CONFIG_NR_DMA_CHANNELS
28# define MAX_DMA_CHANNELS (CONFIG_NR_DMA_CHANNELS) 22# define MAX_DMA_CHANNELS (CONFIG_NR_DMA_CHANNELS)
@@ -137,8 +131,6 @@ extern int dma_xfer(unsigned int chan, unsigned long from,
137 131
138extern int request_dma_bycap(const char **dmac, const char **caps, 132extern int request_dma_bycap(const char **dmac, const char **caps,
139 const char *dev_id); 133 const char *dev_id);
140extern int request_dma(unsigned int chan, const char *dev_id);
141extern void free_dma(unsigned int chan);
142extern int get_dma_residue(unsigned int chan); 134extern int get_dma_residue(unsigned int chan);
143extern struct dma_info *get_dma_info(unsigned int chan); 135extern struct dma_info *get_dma_info(unsigned int chan);
144extern struct dma_channel *get_dma_channel(unsigned int chan); 136extern struct dma_channel *get_dma_channel(unsigned int chan);
diff --git a/arch/sh/include/asm/ipcbuf.h b/arch/sh/include/asm/ipcbuf.h
index 5ffc9972a7ea..84c7e51cb6d0 100644
--- a/arch/sh/include/asm/ipcbuf.h
+++ b/arch/sh/include/asm/ipcbuf.h
@@ -1,29 +1 @@
1#ifndef __ASM_SH_IPCBUF_H__ #include <asm-generic/ipcbuf.h>
2#define __ASM_SH_IPCBUF_H__
3
4/*
5 * The ipc64_perm structure for i386 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit mode_t and seq
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid32_t uid;
18 __kernel_gid32_t gid;
19 __kernel_uid32_t cuid;
20 __kernel_gid32_t cgid;
21 __kernel_mode_t mode;
22 unsigned short __pad1;
23 unsigned short seq;
24 unsigned short __pad2;
25 unsigned long __unused1;
26 unsigned long __unused2;
27};
28
29#endif /* __ASM_SH_IPCBUF_H__ */
diff --git a/arch/sh/include/asm/irq.h b/arch/sh/include/asm/irq.h
index a2b8c99cc06f..df8e1500527c 100644
--- a/arch/sh/include/asm/irq.h
+++ b/arch/sh/include/asm/irq.h
@@ -39,7 +39,6 @@ static inline int generic_irq_demux(int irq)
39 return irq; 39 return irq;
40} 40}
41 41
42#define irq_canonicalize(irq) (irq)
43#define irq_demux(irq) sh_mv.mv_irq_demux(irq) 42#define irq_demux(irq) sh_mv.mv_irq_demux(irq)
44 43
45void init_IRQ(void); 44void init_IRQ(void);
@@ -54,6 +53,7 @@ extern void irq_ctx_exit(int cpu);
54# define irq_ctx_exit(cpu) do { } while (0) 53# define irq_ctx_exit(cpu) do { } while (0)
55#endif 54#endif
56 55
56#include <asm-generic/irq.h>
57#ifdef CONFIG_CPU_SH5 57#ifdef CONFIG_CPU_SH5
58#include <cpu/irq.h> 58#include <cpu/irq.h>
59#endif 59#endif
diff --git a/arch/sh/include/asm/kmap_types.h b/arch/sh/include/asm/kmap_types.h
index 84d565c696be..5962b08b6dd8 100644
--- a/arch/sh/include/asm/kmap_types.h
+++ b/arch/sh/include/asm/kmap_types.h
@@ -3,30 +3,12 @@
3 3
4/* Dummy header just to define km_type. */ 4/* Dummy header just to define km_type. */
5 5
6
7#ifdef CONFIG_DEBUG_HIGHMEM 6#ifdef CONFIG_DEBUG_HIGHMEM
8# define D(n) __KM_FENCE_##n , 7#define __WITH_KM_FENCE
9#else
10# define D(n)
11#endif 8#endif
12 9
13enum km_type { 10#include <asm-generic/kmap_types.h>
14D(0) KM_BOUNCE_READ,
15D(1) KM_SKB_SUNRPC_DATA,
16D(2) KM_SKB_DATA_SOFTIRQ,
17D(3) KM_USER0,
18D(4) KM_USER1,
19D(5) KM_BIO_SRC_IRQ,
20D(6) KM_BIO_DST_IRQ,
21D(7) KM_PTE0,
22D(8) KM_PTE1,
23D(9) KM_IRQ0,
24D(10) KM_IRQ1,
25D(11) KM_SOFTIRQ0,
26D(12) KM_SOFTIRQ1,
27D(13) KM_TYPE_NR
28};
29 11
30#undef D 12#undef __WITH_KM_FENCE
31 13
32#endif 14#endif
diff --git a/arch/sh/include/asm/mman.h b/arch/sh/include/asm/mman.h
index 7d8b72c91a5f..8eebf89f5ab1 100644
--- a/arch/sh/include/asm/mman.h
+++ b/arch/sh/include/asm/mman.h
@@ -1,17 +1 @@
1#ifndef __ASM_SH_MMAN_H #include <asm-generic/mman.h>
2#define __ASM_SH_MMAN_H
3
4#include <asm-generic/mman-common.h>
5
6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
8#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
9#define MAP_LOCKED 0x2000 /* pages are locked */
10#define MAP_NORESERVE 0x4000 /* don't check for reservations */
11#define MAP_POPULATE 0x8000 /* populate (prefault) page tables */
12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
13
14#define MCL_CURRENT 1 /* lock all current mappings */
15#define MCL_FUTURE 2 /* lock all future mappings */
16
17#endif /* __ASM_SH_MMAN_H */
diff --git a/arch/sh/include/asm/mmu_context.h b/arch/sh/include/asm/mmu_context.h
index 2a9c55f1a83f..67d8946db193 100644
--- a/arch/sh/include/asm/mmu_context.h
+++ b/arch/sh/include/asm/mmu_context.h
@@ -122,30 +122,30 @@ static inline void switch_mm(struct mm_struct *prev,
122 unsigned int cpu = smp_processor_id(); 122 unsigned int cpu = smp_processor_id();
123 123
124 if (likely(prev != next)) { 124 if (likely(prev != next)) {
125 cpu_set(cpu, next->cpu_vm_mask); 125 cpumask_set_cpu(cpu, mm_cpumask(next));
126 set_TTB(next->pgd); 126 set_TTB(next->pgd);
127 activate_context(next, cpu); 127 activate_context(next, cpu);
128 } else 128 } else
129 if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) 129 if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)))
130 activate_context(next, cpu); 130 activate_context(next, cpu);
131} 131}
132
133#define activate_mm(prev, next) switch_mm((prev),(next),NULL)
134#define deactivate_mm(tsk,mm) do { } while (0)
135#define enter_lazy_tlb(mm,tsk) do { } while (0)
136
132#else 137#else
133#define get_mmu_context(mm) do { } while (0) 138
134#define init_new_context(tsk,mm) (0)
135#define destroy_context(mm) do { } while (0)
136#define set_asid(asid) do { } while (0) 139#define set_asid(asid) do { } while (0)
137#define get_asid() (0) 140#define get_asid() (0)
138#define cpu_asid(cpu, mm) ({ (void)cpu; NO_CONTEXT; }) 141#define cpu_asid(cpu, mm) ({ (void)cpu; NO_CONTEXT; })
139#define switch_and_save_asid(asid) (0) 142#define switch_and_save_asid(asid) (0)
140#define set_TTB(pgd) do { } while (0) 143#define set_TTB(pgd) do { } while (0)
141#define get_TTB() (0) 144#define get_TTB() (0)
142#define activate_context(mm,cpu) do { } while (0)
143#define switch_mm(prev,next,tsk) do { } while (0)
144#endif /* CONFIG_MMU */
145 145
146#define activate_mm(prev, next) switch_mm((prev),(next),NULL) 146#include <asm-generic/mmu_context.h>
147#define deactivate_mm(tsk,mm) do { } while (0) 147
148#define enter_lazy_tlb(mm,tsk) do { } while (0) 148#endif /* CONFIG_MMU */
149 149
150#if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4) 150#if defined(CONFIG_CPU_SH3) || defined(CONFIG_CPU_SH4)
151/* 151/*
diff --git a/arch/sh/include/asm/module.h b/arch/sh/include/asm/module.h
index 46eccd331660..068bf1659750 100644
--- a/arch/sh/include/asm/module.h
+++ b/arch/sh/include/asm/module.h
@@ -1,17 +1,7 @@
1#ifndef _ASM_SH_MODULE_H 1#ifndef _ASM_SH_MODULE_H
2#define _ASM_SH_MODULE_H 2#define _ASM_SH_MODULE_H
3 3
4/* 4#include <asm-generic/module.h>
5 * This file contains the SH architecture specific module code.
6 */
7
8struct mod_arch_specific {
9 /* Nothing to see here .. */
10};
11
12#define Elf_Shdr Elf32_Shdr
13#define Elf_Sym Elf32_Sym
14#define Elf_Ehdr Elf32_Ehdr
15 5
16#ifdef CONFIG_CPU_LITTLE_ENDIAN 6#ifdef CONFIG_CPU_LITTLE_ENDIAN
17# ifdef CONFIG_CPU_SH2 7# ifdef CONFIG_CPU_SH2
diff --git a/arch/sh/include/asm/msgbuf.h b/arch/sh/include/asm/msgbuf.h
index 517432343fb5..809134c644a6 100644
--- a/arch/sh/include/asm/msgbuf.h
+++ b/arch/sh/include/asm/msgbuf.h
@@ -1,31 +1 @@
1#ifndef __ASM_SH_MSGBUF_H #include <asm-generic/msgbuf.h>
2#define __ASM_SH_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for i386 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct msqid64_ds {
15 struct ipc64_perm msg_perm;
16 __kernel_time_t msg_stime; /* last msgsnd time */
17 unsigned long __unused1;
18 __kernel_time_t msg_rtime; /* last msgrcv time */
19 unsigned long __unused2;
20 __kernel_time_t msg_ctime; /* last change time */
21 unsigned long __unused3;
22 unsigned long msg_cbytes; /* current number of bytes on queue */
23 unsigned long msg_qnum; /* number of messages in queue */
24 unsigned long msg_qbytes; /* max number of bytes on queue */
25 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
26 __kernel_pid_t msg_lrpid; /* last receive pid */
27 unsigned long __unused4;
28 unsigned long __unused5;
29};
30
31#endif /* __ASM_SH_MSGBUF_H */
diff --git a/arch/sh/include/asm/param.h b/arch/sh/include/asm/param.h
index ae245afdfd6a..965d45427975 100644
--- a/arch/sh/include/asm/param.h
+++ b/arch/sh/include/asm/param.h
@@ -1,22 +1 @@
1#ifndef __ASM_SH_PARAM_H #include <asm-generic/param.h>
2#define __ASM_SH_PARAM_H
3
4#ifdef __KERNEL__
5# define HZ CONFIG_HZ
6# define USER_HZ 100 /* User interfaces are in "ticks" */
7# define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */
8#endif
9
10#ifndef HZ
11#define HZ 100
12#endif
13
14#define EXEC_PAGESIZE 4096
15
16#ifndef NOGROUP
17#define NOGROUP (-1)
18#endif
19
20#define MAXHOSTNAMELEN 64 /* max length of hostname */
21
22#endif /* __ASM_SH_PARAM_H */
diff --git a/arch/sh/include/asm/parport.h b/arch/sh/include/asm/parport.h
index f67ba60a2acd..cf252af64590 100644
--- a/arch/sh/include/asm/parport.h
+++ b/arch/sh/include/asm/parport.h
@@ -1,16 +1 @@
1/* #include <asm-generic/parport.h>
2 * Copyright (C) 1999, 2000 Tim Waugh <tim@cyberelk.demon.co.uk>
3 *
4 * This file should only be included by drivers/parport/parport_pc.c.
5 */
6#ifndef __ASM_SH_PARPORT_H
7#define __ASM_SH_PARPORT_H
8
9static int __devinit parport_pc_find_isa_ports(int autoirq, int autodma);
10
11static int __devinit parport_pc_find_nonpci_ports(int autoirq, int autodma)
12{
13 return parport_pc_find_isa_ports(autoirq, autodma);
14}
15
16#endif /* __ASM_SH_PARPORT_H */
diff --git a/arch/sh/include/asm/posix_types_32.h b/arch/sh/include/asm/posix_types_32.h
index 2172732c55c8..6a9ceaaf1aea 100644
--- a/arch/sh/include/asm/posix_types_32.h
+++ b/arch/sh/include/asm/posix_types_32.h
@@ -1,118 +1,29 @@
1#ifndef __ASM_SH_POSIX_TYPES_H 1#ifndef __ASM_SH_POSIX_TYPES_32_H
2#define __ASM_SH_POSIX_TYPES_H 2#define __ASM_SH_POSIX_TYPES_32_H
3 3
4/*
5 * This file is generally used by user-level software, so you need to
6 * be a little careful about namespace pollution etc. Also, we cannot
7 * assume GCC is being used.
8 */
9
10typedef unsigned long __kernel_ino_t;
11typedef unsigned short __kernel_mode_t; 4typedef unsigned short __kernel_mode_t;
5#define __kernel_mode_t __kernel_mode_t
12typedef unsigned short __kernel_nlink_t; 6typedef unsigned short __kernel_nlink_t;
13typedef long __kernel_off_t; 7#define __kernel_nlink_t __kernel_nlink_t
14typedef int __kernel_pid_t;
15typedef unsigned short __kernel_ipc_pid_t; 8typedef unsigned short __kernel_ipc_pid_t;
9#define __kernel_ipc_pid_t __kernel_ipc_pid_t
16typedef unsigned short __kernel_uid_t; 10typedef unsigned short __kernel_uid_t;
11#define __kernel_uid_t __kernel_uid_t
17typedef unsigned short __kernel_gid_t; 12typedef unsigned short __kernel_gid_t;
18typedef unsigned int __kernel_size_t; 13#define __kernel_gid_t __kernel_gid_t
19typedef int __kernel_ssize_t; 14
20typedef int __kernel_ptrdiff_t;
21typedef long __kernel_time_t;
22typedef long __kernel_suseconds_t;
23typedef long __kernel_clock_t;
24typedef int __kernel_timer_t;
25typedef int __kernel_clockid_t;
26typedef int __kernel_daddr_t;
27typedef char * __kernel_caddr_t;
28typedef unsigned short __kernel_uid16_t;
29typedef unsigned short __kernel_gid16_t;
30typedef unsigned int __kernel_uid32_t; 15typedef unsigned int __kernel_uid32_t;
16#define __kernel_uid32_t __kernel_uid32_t
31typedef unsigned int __kernel_gid32_t; 17typedef unsigned int __kernel_gid32_t;
18#define __kernel_gid32_t __kernel_gid32_t
32 19
33typedef unsigned short __kernel_old_uid_t; 20typedef unsigned short __kernel_old_uid_t;
21#define __kernel_old_uid_t __kernel_old_uid_t
34typedef unsigned short __kernel_old_gid_t; 22typedef unsigned short __kernel_old_gid_t;
23#define __kernel_old_gid_t __kernel_old_gid_t
35typedef unsigned short __kernel_old_dev_t; 24typedef unsigned short __kernel_old_dev_t;
25#define __kernel_old_dev_t __kernel_old_dev_t
36 26
37#ifdef __GNUC__ 27#include <asm-generic/posix_types.h>
38typedef long long __kernel_loff_t;
39#endif
40
41typedef struct {
42 int val[2];
43} __kernel_fsid_t;
44
45#if defined(__KERNEL__)
46
47#undef __FD_SET
48static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
49{
50 unsigned long __tmp = __fd / __NFDBITS;
51 unsigned long __rem = __fd % __NFDBITS;
52 __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
53}
54
55#undef __FD_CLR
56static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
57{
58 unsigned long __tmp = __fd / __NFDBITS;
59 unsigned long __rem = __fd % __NFDBITS;
60 __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
61}
62
63
64#undef __FD_ISSET
65static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
66{
67 unsigned long __tmp = __fd / __NFDBITS;
68 unsigned long __rem = __fd % __NFDBITS;
69 return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
70}
71
72/*
73 * This will unroll the loop for the normal constant case (8 ints,
74 * for a 256-bit fd_set)
75 */
76#undef __FD_ZERO
77static __inline__ void __FD_ZERO(__kernel_fd_set *__p)
78{
79 unsigned long *__tmp = __p->fds_bits;
80 int __i;
81
82 if (__builtin_constant_p(__FDSET_LONGS)) {
83 switch (__FDSET_LONGS) {
84 case 16:
85 __tmp[ 0] = 0; __tmp[ 1] = 0;
86 __tmp[ 2] = 0; __tmp[ 3] = 0;
87 __tmp[ 4] = 0; __tmp[ 5] = 0;
88 __tmp[ 6] = 0; __tmp[ 7] = 0;
89 __tmp[ 8] = 0; __tmp[ 9] = 0;
90 __tmp[10] = 0; __tmp[11] = 0;
91 __tmp[12] = 0; __tmp[13] = 0;
92 __tmp[14] = 0; __tmp[15] = 0;
93 return;
94
95 case 8:
96 __tmp[ 0] = 0; __tmp[ 1] = 0;
97 __tmp[ 2] = 0; __tmp[ 3] = 0;
98 __tmp[ 4] = 0; __tmp[ 5] = 0;
99 __tmp[ 6] = 0; __tmp[ 7] = 0;
100 return;
101
102 case 4:
103 __tmp[ 0] = 0; __tmp[ 1] = 0;
104 __tmp[ 2] = 0; __tmp[ 3] = 0;
105 return;
106 }
107 }
108 __i = __FDSET_LONGS;
109 while (__i) {
110 __i--;
111 *__tmp = 0;
112 __tmp++;
113 }
114}
115
116#endif /* defined(__KERNEL__) */
117 28
118#endif /* __ASM_SH_POSIX_TYPES_H */ 29#endif /* __ASM_SH_POSIX_TYPES_32_H */
diff --git a/arch/sh/include/asm/posix_types_64.h b/arch/sh/include/asm/posix_types_64.h
index f83e9bd463d8..8cd11485c06b 100644
--- a/arch/sh/include/asm/posix_types_64.h
+++ b/arch/sh/include/asm/posix_types_64.h
@@ -1,127 +1,34 @@
1#ifndef __ASM_SH64_POSIX_TYPES_H 1#ifndef __ASM_SH_POSIX_TYPES_64_H
2#define __ASM_SH64_POSIX_TYPES_H 2#define __ASM_SH_POSIX_TYPES_64_H
3 3
4/*
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 *
9 * include/asm-sh64/posix_types.h
10 *
11 * Copyright (C) 2000, 2001 Paolo Alberelli
12 * Copyright (C) 2003 Paul Mundt
13 *
14 * This file is generally used by user-level software, so you need to
15 * be a little careful about namespace pollution etc. Also, we cannot
16 * assume GCC is being used.
17 */
18
19typedef unsigned long __kernel_ino_t;
20typedef unsigned short __kernel_mode_t; 4typedef unsigned short __kernel_mode_t;
5#define __kernel_mode_t __kernel_mode_t
21typedef unsigned short __kernel_nlink_t; 6typedef unsigned short __kernel_nlink_t;
22typedef long __kernel_off_t; 7#define __kernel_nlink_t __kernel_nlink_t
23typedef int __kernel_pid_t;
24typedef unsigned short __kernel_ipc_pid_t; 8typedef unsigned short __kernel_ipc_pid_t;
9#define __kernel_ipc_pid_t __kernel_ipc_pid_t
25typedef unsigned short __kernel_uid_t; 10typedef unsigned short __kernel_uid_t;
11#define __kernel_uid_t __kernel_uid_t
26typedef unsigned short __kernel_gid_t; 12typedef unsigned short __kernel_gid_t;
13#define __kernel_gid_t __kernel_gid_t
27typedef long unsigned int __kernel_size_t; 14typedef long unsigned int __kernel_size_t;
15#define __kernel_size_t __kernel_size_t
28typedef int __kernel_ssize_t; 16typedef int __kernel_ssize_t;
17#define __kernel_ssize_t __kernel_ssize_t
29typedef int __kernel_ptrdiff_t; 18typedef int __kernel_ptrdiff_t;
30typedef long __kernel_time_t; 19#define __kernel_ptrdiff_t __kernel_ptrdiff_t
31typedef long __kernel_suseconds_t;
32typedef long __kernel_clock_t;
33typedef int __kernel_timer_t;
34typedef int __kernel_clockid_t;
35typedef int __kernel_daddr_t;
36typedef char * __kernel_caddr_t;
37typedef unsigned short __kernel_uid16_t;
38typedef unsigned short __kernel_gid16_t;
39typedef unsigned int __kernel_uid32_t; 20typedef unsigned int __kernel_uid32_t;
21#define __kernel_uid32_t __kernel_uid32_t
40typedef unsigned int __kernel_gid32_t; 22typedef unsigned int __kernel_gid32_t;
23#define __kernel_gid32_t __kernel_gid32_t
41 24
42typedef unsigned short __kernel_old_uid_t; 25typedef unsigned short __kernel_old_uid_t;
26#define __kernel_old_uid_t __kernel_old_uid_t
43typedef unsigned short __kernel_old_gid_t; 27typedef unsigned short __kernel_old_gid_t;
28#define __kernel_old_gid_t __kernel_old_gid_t
44typedef unsigned short __kernel_old_dev_t; 29typedef unsigned short __kernel_old_dev_t;
30#define __kernel_old_dev_t __kernel_old_dev_t
45 31
46#ifdef __GNUC__ 32#include <asm-generic/posix_types.h>
47typedef long long __kernel_loff_t;
48#endif
49
50typedef struct {
51 int val[2];
52} __kernel_fsid_t;
53
54#if defined(__KERNEL__)
55
56#undef __FD_SET
57static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
58{
59 unsigned long __tmp = __fd / __NFDBITS;
60 unsigned long __rem = __fd % __NFDBITS;
61 __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
62}
63
64#undef __FD_CLR
65static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
66{
67 unsigned long __tmp = __fd / __NFDBITS;
68 unsigned long __rem = __fd % __NFDBITS;
69 __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
70}
71
72
73#undef __FD_ISSET
74static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
75{
76 unsigned long __tmp = __fd / __NFDBITS;
77 unsigned long __rem = __fd % __NFDBITS;
78 return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
79}
80
81/*
82 * This will unroll the loop for the normal constant case (8 ints,
83 * for a 256-bit fd_set)
84 */
85#undef __FD_ZERO
86static __inline__ void __FD_ZERO(__kernel_fd_set *__p)
87{
88 unsigned long *__tmp = __p->fds_bits;
89 int __i;
90
91 if (__builtin_constant_p(__FDSET_LONGS)) {
92 switch (__FDSET_LONGS) {
93 case 16:
94 __tmp[ 0] = 0; __tmp[ 1] = 0;
95 __tmp[ 2] = 0; __tmp[ 3] = 0;
96 __tmp[ 4] = 0; __tmp[ 5] = 0;
97 __tmp[ 6] = 0; __tmp[ 7] = 0;
98 __tmp[ 8] = 0; __tmp[ 9] = 0;
99 __tmp[10] = 0; __tmp[11] = 0;
100 __tmp[12] = 0; __tmp[13] = 0;
101 __tmp[14] = 0; __tmp[15] = 0;
102 return;
103
104 case 8:
105 __tmp[ 0] = 0; __tmp[ 1] = 0;
106 __tmp[ 2] = 0; __tmp[ 3] = 0;
107 __tmp[ 4] = 0; __tmp[ 5] = 0;
108 __tmp[ 6] = 0; __tmp[ 7] = 0;
109 return;
110
111 case 4:
112 __tmp[ 0] = 0; __tmp[ 1] = 0;
113 __tmp[ 2] = 0; __tmp[ 3] = 0;
114 return;
115 }
116 }
117 __i = __FDSET_LONGS;
118 while (__i) {
119 __i--;
120 *__tmp = 0;
121 __tmp++;
122 }
123}
124
125#endif /* defined(__KERNEL__) */
126 33
127#endif /* __ASM_SH64_POSIX_TYPES_H */ 34#endif /* __ASM_SH_POSIX_TYPES_64_H */
diff --git a/arch/sh/include/asm/scatterlist.h b/arch/sh/include/asm/scatterlist.h
index c693d268a413..327cc2e4c97b 100644
--- a/arch/sh/include/asm/scatterlist.h
+++ b/arch/sh/include/asm/scatterlist.h
@@ -1,28 +1,8 @@
1#ifndef __ASM_SH_SCATTERLIST_H 1#ifndef __ASM_SH_SCATTERLIST_H
2#define __ASM_SH_SCATTERLIST_H 2#define __ASM_SH_SCATTERLIST_H
3 3
4#include <asm/types.h>
5
6struct scatterlist {
7#ifdef CONFIG_DEBUG_SG
8 unsigned long sg_magic;
9#endif
10 unsigned long page_link;
11 unsigned int offset; /* for highmem, page offset */
12 unsigned int length;
13 dma_addr_t dma_address;
14 unsigned int dma_length;
15};
16
17#define ISA_DMA_THRESHOLD PHYS_ADDR_MASK 4#define ISA_DMA_THRESHOLD PHYS_ADDR_MASK
18 5
19/* These macros should be used after a pci_map_sg call has been done 6#include <asm-generic/scatterlist.h>
20 * to get bus addresses of each of the SG entries and their lengths.
21 * You should only work with the number of sg entries pci_map_sg
22 * returns, or alternatively stop on the first sg_dma_len(sg) which
23 * is 0.
24 */
25#define sg_dma_address(sg) ((sg)->dma_address)
26#define sg_dma_len(sg) ((sg)->length)
27 7
28#endif /* !(__ASM_SH_SCATTERLIST_H) */ 8#endif /* __ASM_SH_SCATTERLIST_H */
diff --git a/arch/sh/include/asm/sembuf.h b/arch/sh/include/asm/sembuf.h
index d79f3bd570b2..7673b83cfef7 100644
--- a/arch/sh/include/asm/sembuf.h
+++ b/arch/sh/include/asm/sembuf.h
@@ -1,25 +1 @@
1#ifndef __ASM_SH_SEMBUF_H #include <asm-generic/sembuf.h>
2#define __ASM_SH_SEMBUF_H
3
4/*
5 * The semid64_ds structure for i386 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct semid64_ds {
15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
16 __kernel_time_t sem_otime; /* last semop time */
17 unsigned long __unused1;
18 __kernel_time_t sem_ctime; /* last change time */
19 unsigned long __unused2;
20 unsigned long sem_nsems; /* no. of semaphores in array */
21 unsigned long __unused3;
22 unsigned long __unused4;
23};
24
25#endif /* __ASM_SH_SEMBUF_H */
diff --git a/arch/sh/include/asm/serial.h b/arch/sh/include/asm/serial.h
index 11f854dd1363..a0cb0caff152 100644
--- a/arch/sh/include/asm/serial.h
+++ b/arch/sh/include/asm/serial.h
@@ -1,19 +1 @@
1/* #include <asm-generic/serial.h>
2 * include/asm-sh/serial.h
3 *
4 * Configuration details for 8250, 16450, 16550, etc. serial ports
5 */
6
7#ifndef _ASM_SERIAL_H
8#define _ASM_SERIAL_H
9
10/*
11 * This assumes you have a 1.8432 MHz clock for your UART.
12 *
13 * It'd be nice if someone built a serial card with a 24.576 MHz
14 * clock, since the 16550A is capable of handling a top speed of 1.5
15 * megabits/second; but this requires the faster clock.
16 */
17#define BASE_BAUD ( 1843200 / 16 )
18
19#endif /* _ASM_SERIAL_H */
diff --git a/arch/sh/include/asm/setup.h b/arch/sh/include/asm/setup.h
index d450bcf59ee2..ce3743599b27 100644
--- a/arch/sh/include/asm/setup.h
+++ b/arch/sh/include/asm/setup.h
@@ -1,7 +1,7 @@
1#ifndef _SH_SETUP_H 1#ifndef _SH_SETUP_H
2#define _SH_SETUP_H 2#define _SH_SETUP_H
3 3
4#define COMMAND_LINE_SIZE 256 4#include <asm-generic/setup.h>
5 5
6#ifdef __KERNEL__ 6#ifdef __KERNEL__
7/* 7/*
diff --git a/arch/sh/include/asm/shmbuf.h b/arch/sh/include/asm/shmbuf.h
index b2101f490521..83c05fc2de38 100644
--- a/arch/sh/include/asm/shmbuf.h
+++ b/arch/sh/include/asm/shmbuf.h
@@ -1,42 +1 @@
1#ifndef __ASM_SH_SHMBUF_H #include <asm-generic/shmbuf.h>
2#define __ASM_SH_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for i386 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct shmid64_ds {
15 struct ipc64_perm shm_perm; /* operation perms */
16 size_t shm_segsz; /* size of segment (bytes) */
17 __kernel_time_t shm_atime; /* last attach time */
18 unsigned long __unused1;
19 __kernel_time_t shm_dtime; /* last detach time */
20 unsigned long __unused2;
21 __kernel_time_t shm_ctime; /* last change time */
22 unsigned long __unused3;
23 __kernel_pid_t shm_cpid; /* pid of creator */
24 __kernel_pid_t shm_lpid; /* pid of last operator */
25 unsigned long shm_nattch; /* no. of current attaches */
26 unsigned long __unused4;
27 unsigned long __unused5;
28};
29
30struct shminfo64 {
31 unsigned long shmmax;
32 unsigned long shmmin;
33 unsigned long shmmni;
34 unsigned long shmseg;
35 unsigned long shmall;
36 unsigned long __unused1;
37 unsigned long __unused2;
38 unsigned long __unused3;
39 unsigned long __unused4;
40};
41
42#endif /* __ASM_SH_SHMBUF_H */
diff --git a/arch/sh/include/asm/signal.h b/arch/sh/include/asm/signal.h
index 9cc5f0144689..9ac530a90bce 100644
--- a/arch/sh/include/asm/signal.h
+++ b/arch/sh/include/asm/signal.h
@@ -1,114 +1,10 @@
1#ifndef __ASM_SH_SIGNAL_H 1#ifndef __ASM_SH_SIGNAL_H
2#define __ASM_SH_SIGNAL_H 2#define __ASM_SH_SIGNAL_H
3 3
4#include <linux/types.h>
5
6/* Avoid too many header ordering problems. */
7struct pt_regs;
8struct siginfo;
9
10#ifdef __KERNEL__
11/* Most things should be clean enough to redefine this at will, if care
12 is taken to make libc match. */
13
14#define _NSIG 64
15#define _NSIG_BPW 32
16#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
17
18typedef unsigned long old_sigset_t; /* at least 32 bits */
19
20typedef struct {
21 unsigned long sig[_NSIG_WORDS];
22} sigset_t;
23
24#else
25/* Here we must cater to libcs that poke about in kernel headers. */
26
27#define NSIG 32
28typedef unsigned long sigset_t;
29
30#endif /* __KERNEL__ */
31
32#define SIGHUP 1
33#define SIGINT 2
34#define SIGQUIT 3
35#define SIGILL 4
36#define SIGTRAP 5
37#define SIGABRT 6
38#define SIGIOT 6
39#define SIGBUS 7
40#define SIGFPE 8
41#define SIGKILL 9
42#define SIGUSR1 10
43#define SIGSEGV 11
44#define SIGUSR2 12
45#define SIGPIPE 13
46#define SIGALRM 14
47#define SIGTERM 15
48#define SIGSTKFLT 16
49#define SIGCHLD 17
50#define SIGCONT 18
51#define SIGSTOP 19
52#define SIGTSTP 20
53#define SIGTTIN 21
54#define SIGTTOU 22
55#define SIGURG 23
56#define SIGXCPU 24
57#define SIGXFSZ 25
58#define SIGVTALRM 26
59#define SIGPROF 27
60#define SIGWINCH 28
61#define SIGIO 29
62#define SIGPOLL SIGIO
63/*
64#define SIGLOST 29
65*/
66#define SIGPWR 30
67#define SIGSYS 31
68#define SIGUNUSED 31
69
70/* These should not be considered constants from userland. */
71#define SIGRTMIN 32
72#define SIGRTMAX _NSIG
73
74/*
75 * SA_FLAGS values:
76 *
77 * SA_ONSTACK indicates that a registered stack_t will be used.
78 * SA_RESTART flag to get restarting signals (which were the default long ago)
79 * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
80 * SA_RESETHAND clears the handler when the signal is delivered.
81 * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
82 * SA_NODEFER prevents the current signal from being masked in the handler.
83 *
84 * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
85 * Unix names RESETHAND and NODEFER respectively.
86 */
87#define SA_NOCLDSTOP 0x00000001
88#define SA_NOCLDWAIT 0x00000002
89#define SA_SIGINFO 0x00000004
90#define SA_ONSTACK 0x08000000
91#define SA_RESTART 0x10000000
92#define SA_NODEFER 0x40000000
93#define SA_RESETHAND 0x80000000
94
95#define SA_NOMASK SA_NODEFER
96#define SA_ONESHOT SA_RESETHAND
97
98#define SA_RESTORER 0x04000000 4#define SA_RESTORER 0x04000000
99 5
100/* 6#include <asm-generic/signal.h>
101 * sigaltstack controls
102 */
103#define SS_ONSTACK 1
104#define SS_DISABLE 2
105
106#define MINSIGSTKSZ 2048
107#define SIGSTKSZ 8192
108 7
109#include <asm-generic/signal-defs.h>
110
111#ifdef __KERNEL__
112struct old_sigaction { 8struct old_sigaction {
113 __sighandler_t sa_handler; 9 __sighandler_t sa_handler;
114 old_sigset_t sa_mask; 10 old_sigset_t sa_mask;
@@ -116,45 +12,4 @@ struct old_sigaction {
116 void (*sa_restorer)(void); 12 void (*sa_restorer)(void);
117}; 13};
118 14
119struct sigaction {
120 __sighandler_t sa_handler;
121 unsigned long sa_flags;
122 void (*sa_restorer)(void);
123 sigset_t sa_mask; /* mask last for extensibility */
124};
125
126struct k_sigaction {
127 struct sigaction sa;
128};
129#else
130/* Here we must cater to libcs that poke about in kernel headers. */
131
132struct sigaction {
133 union {
134 __sighandler_t _sa_handler;
135 void (*_sa_sigaction)(int, struct siginfo *, void *);
136 } _u;
137 sigset_t sa_mask;
138 unsigned long sa_flags;
139 void (*sa_restorer)(void);
140};
141
142#define sa_handler _u._sa_handler
143#define sa_sigaction _u._sa_sigaction
144
145#endif /* __KERNEL__ */
146
147typedef struct sigaltstack {
148 void *ss_sp;
149 int ss_flags;
150 size_t ss_size;
151} stack_t;
152
153#ifdef __KERNEL__
154#include <asm/sigcontext.h>
155
156#define ptrace_signal_deliver(regs, cookie) do { } while (0)
157
158#endif /* __KERNEL__ */
159
160#endif /* __ASM_SH_SIGNAL_H */ 15#endif /* __ASM_SH_SIGNAL_H */
diff --git a/arch/sh/include/asm/smp.h b/arch/sh/include/asm/smp.h
index c24e9c6a1736..ca64f43abe67 100644
--- a/arch/sh/include/asm/smp.h
+++ b/arch/sh/include/asm/smp.h
@@ -43,7 +43,8 @@ void plat_start_cpu(unsigned int cpu, unsigned long entry_point);
43void plat_send_ipi(unsigned int cpu, unsigned int message); 43void plat_send_ipi(unsigned int cpu, unsigned int message);
44 44
45void arch_send_call_function_single_ipi(int cpu); 45void arch_send_call_function_single_ipi(int cpu);
46void arch_send_call_function_ipi(cpumask_t mask); 46extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
47#define arch_send_call_function_ipi_mask arch_send_call_function_ipi_mask
47 48
48#else 49#else
49 50
diff --git a/arch/sh/include/asm/socket.h b/arch/sh/include/asm/socket.h
index 345653b96826..6b71384b9d8b 100644
--- a/arch/sh/include/asm/socket.h
+++ b/arch/sh/include/asm/socket.h
@@ -1,60 +1 @@
1#ifndef __ASM_SH_SOCKET_H #include <asm-generic/socket.h>
2#define __ASM_SH_SOCKET_H
3
4#include <asm/sockios.h>
5
6/* For setsockopt(2) */
7#define SOL_SOCKET 1
8
9#define SO_DEBUG 1
10#define SO_REUSEADDR 2
11#define SO_TYPE 3
12#define SO_ERROR 4
13#define SO_DONTROUTE 5
14#define SO_BROADCAST 6
15#define SO_SNDBUF 7
16#define SO_RCVBUF 8
17#define SO_RCVBUFFORCE 32
18#define SO_SNDBUFFORCE 33
19#define SO_KEEPALIVE 9
20#define SO_OOBINLINE 10
21#define SO_NO_CHECK 11
22#define SO_PRIORITY 12
23#define SO_LINGER 13
24#define SO_BSDCOMPAT 14
25/* To add :#define SO_REUSEPORT 15 */
26#define SO_PASSCRED 16
27#define SO_PEERCRED 17
28#define SO_RCVLOWAT 18
29#define SO_SNDLOWAT 19
30#define SO_RCVTIMEO 20
31#define SO_SNDTIMEO 21
32
33/* Security levels - as per NRL IPv6 - don't actually do anything */
34#define SO_SECURITY_AUTHENTICATION 22
35#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
36#define SO_SECURITY_ENCRYPTION_NETWORK 24
37
38#define SO_BINDTODEVICE 25
39
40/* Socket filtering */
41#define SO_ATTACH_FILTER 26
42#define SO_DETACH_FILTER 27
43
44#define SO_PEERNAME 28
45#define SO_TIMESTAMP 29
46#define SCM_TIMESTAMP SO_TIMESTAMP
47
48#define SO_ACCEPTCONN 30
49
50#define SO_PEERSEC 31
51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54
55#define SO_MARK 36
56
57#define SO_TIMESTAMPING 37
58#define SCM_TIMESTAMPING SO_TIMESTAMPING
59
60#endif /* __ASM_SH_SOCKET_H */
diff --git a/arch/sh/include/asm/swab.h b/arch/sh/include/asm/swab.h
index 0e08fe54ad71..1cd09767a7a3 100644
--- a/arch/sh/include/asm/swab.h
+++ b/arch/sh/include/asm/swab.h
@@ -7,8 +7,7 @@
7 */ 7 */
8#include <linux/compiler.h> 8#include <linux/compiler.h>
9#include <linux/types.h> 9#include <linux/types.h>
10 10#include <asm-generic/swab.h>
11#define __SWAB_64_THRU_32__
12 11
13static inline __attribute_const__ __u32 __arch_swab32(__u32 x) 12static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
14{ 13{
diff --git a/arch/sh/include/asm/termbits.h b/arch/sh/include/asm/termbits.h
index 77db116948cf..3935b106de79 100644
--- a/arch/sh/include/asm/termbits.h
+++ b/arch/sh/include/asm/termbits.h
@@ -1,198 +1 @@
1#ifndef __ASM_SH_TERMBITS_H #include <asm-generic/termbits.h>
2#define __ASM_SH_TERMBITS_H
3
4#include <linux/posix_types.h>
5
6typedef unsigned char cc_t;
7typedef unsigned int speed_t;
8typedef unsigned int tcflag_t;
9
10#define NCCS 19
11struct termios {
12 tcflag_t c_iflag; /* input mode flags */
13 tcflag_t c_oflag; /* output mode flags */
14 tcflag_t c_cflag; /* control mode flags */
15 tcflag_t c_lflag; /* local mode flags */
16 cc_t c_line; /* line discipline */
17 cc_t c_cc[NCCS]; /* control characters */
18};
19
20struct termios2 {
21 tcflag_t c_iflag; /* input mode flags */
22 tcflag_t c_oflag; /* output mode flags */
23 tcflag_t c_cflag; /* control mode flags */
24 tcflag_t c_lflag; /* local mode flags */
25 cc_t c_line; /* line discipline */
26 cc_t c_cc[NCCS]; /* control characters */
27 speed_t c_ispeed; /* input speed */
28 speed_t c_ospeed; /* output speed */
29};
30
31struct ktermios {
32 tcflag_t c_iflag; /* input mode flags */
33 tcflag_t c_oflag; /* output mode flags */
34 tcflag_t c_cflag; /* control mode flags */
35 tcflag_t c_lflag; /* local mode flags */
36 cc_t c_line; /* line discipline */
37 cc_t c_cc[NCCS]; /* control characters */
38 speed_t c_ispeed; /* input speed */
39 speed_t c_ospeed; /* output speed */
40};
41
42/* c_cc characters */
43#define VINTR 0
44#define VQUIT 1
45#define VERASE 2
46#define VKILL 3
47#define VEOF 4
48#define VTIME 5
49#define VMIN 6
50#define VSWTC 7
51#define VSTART 8
52#define VSTOP 9
53#define VSUSP 10
54#define VEOL 11
55#define VREPRINT 12
56#define VDISCARD 13
57#define VWERASE 14
58#define VLNEXT 15
59#define VEOL2 16
60
61/* c_iflag bits */
62#define IGNBRK 0000001
63#define BRKINT 0000002
64#define IGNPAR 0000004
65#define PARMRK 0000010
66#define INPCK 0000020
67#define ISTRIP 0000040
68#define INLCR 0000100
69#define IGNCR 0000200
70#define ICRNL 0000400
71#define IUCLC 0001000
72#define IXON 0002000
73#define IXANY 0004000
74#define IXOFF 0010000
75#define IMAXBEL 0020000
76#define IUTF8 0040000
77
78/* c_oflag bits */
79#define OPOST 0000001
80#define OLCUC 0000002
81#define ONLCR 0000004
82#define OCRNL 0000010
83#define ONOCR 0000020
84#define ONLRET 0000040
85#define OFILL 0000100
86#define OFDEL 0000200
87#define NLDLY 0000400
88#define NL0 0000000
89#define NL1 0000400
90#define CRDLY 0003000
91#define CR0 0000000
92#define CR1 0001000
93#define CR2 0002000
94#define CR3 0003000
95#define TABDLY 0014000
96#define TAB0 0000000
97#define TAB1 0004000
98#define TAB2 0010000
99#define TAB3 0014000
100#define XTABS 0014000
101#define BSDLY 0020000
102#define BS0 0000000
103#define BS1 0020000
104#define VTDLY 0040000
105#define VT0 0000000
106#define VT1 0040000
107#define FFDLY 0100000
108#define FF0 0000000
109#define FF1 0100000
110
111/* c_cflag bit meaning */
112#define CBAUD 0010017
113#define B0 0000000 /* hang up */
114#define B50 0000001
115#define B75 0000002
116#define B110 0000003
117#define B134 0000004
118#define B150 0000005
119#define B200 0000006
120#define B300 0000007
121#define B600 0000010
122#define B1200 0000011
123#define B1800 0000012
124#define B2400 0000013
125#define B4800 0000014
126#define B9600 0000015
127#define B19200 0000016
128#define B38400 0000017
129#define EXTA B19200
130#define EXTB B38400
131#define CSIZE 0000060
132#define CS5 0000000
133#define CS6 0000020
134#define CS7 0000040
135#define CS8 0000060
136#define CSTOPB 0000100
137#define CREAD 0000200
138#define PARENB 0000400
139#define PARODD 0001000
140#define HUPCL 0002000
141#define CLOCAL 0004000
142#define CBAUDEX 0010000
143#define BOTHER 0010000
144#define B57600 0010001
145#define B115200 0010002
146#define B230400 0010003
147#define B460800 0010004
148#define B500000 0010005
149#define B576000 0010006
150#define B921600 0010007
151#define B1000000 0010010
152#define B1152000 0010011
153#define B1500000 0010012
154#define B2000000 0010013
155#define B2500000 0010014
156#define B3000000 0010015
157#define B3500000 0010016
158#define B4000000 0010017
159#define CIBAUD 002003600000 /* input baud rate */
160#define CMSPAR 010000000000 /* mark or space (stick) parity */
161#define CRTSCTS 020000000000 /* flow control */
162
163#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
164
165/* c_lflag bits */
166#define ISIG 0000001
167#define ICANON 0000002
168#define XCASE 0000004
169#define ECHO 0000010
170#define ECHOE 0000020
171#define ECHOK 0000040
172#define ECHONL 0000100
173#define NOFLSH 0000200
174#define TOSTOP 0000400
175#define ECHOCTL 0001000
176#define ECHOPRT 0002000
177#define ECHOKE 0004000
178#define FLUSHO 0010000
179#define PENDIN 0040000
180#define IEXTEN 0100000
181
182/* tcflow() and TCXONC use these */
183#define TCOOFF 0
184#define TCOON 1
185#define TCIOFF 2
186#define TCION 3
187
188/* tcflush() and TCFLSH use these */
189#define TCIFLUSH 0
190#define TCOFLUSH 1
191#define TCIOFLUSH 2
192
193/* tcsetattr uses these */
194#define TCSANOW 0
195#define TCSADRAIN 1
196#define TCSAFLUSH 2
197
198#endif /* __ASM_SH_TERMBITS_H */
diff --git a/arch/sh/include/asm/termios.h b/arch/sh/include/asm/termios.h
index 0a8c793c76f2..280d78a9d966 100644
--- a/arch/sh/include/asm/termios.h
+++ b/arch/sh/include/asm/termios.h
@@ -1,90 +1 @@
1#ifndef __ASM_SH_TERMIOS_H #include <asm-generic/termios.h>
2#define __ASM_SH_TERMIOS_H
3
4#include <asm/termbits.h>
5#include <asm/ioctls.h>
6
7struct winsize {
8 unsigned short ws_row;
9 unsigned short ws_col;
10 unsigned short ws_xpixel;
11 unsigned short ws_ypixel;
12};
13
14#define NCC 8
15struct termio {
16 unsigned short c_iflag; /* input mode flags */
17 unsigned short c_oflag; /* output mode flags */
18 unsigned short c_cflag; /* control mode flags */
19 unsigned short c_lflag; /* local mode flags */
20 unsigned char c_line; /* line discipline */
21 unsigned char c_cc[NCC]; /* control characters */
22};
23
24/* modem lines */
25#define TIOCM_LE 0x001
26#define TIOCM_DTR 0x002
27#define TIOCM_RTS 0x004
28#define TIOCM_ST 0x008
29#define TIOCM_SR 0x010
30#define TIOCM_CTS 0x020
31#define TIOCM_CAR 0x040
32#define TIOCM_RNG 0x080
33#define TIOCM_DSR 0x100
34#define TIOCM_CD TIOCM_CAR
35#define TIOCM_RI TIOCM_RNG
36#define TIOCM_OUT1 0x2000
37#define TIOCM_OUT2 0x4000
38#define TIOCM_LOOP 0x8000
39
40/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
41
42#ifdef __KERNEL__
43
44/* intr=^C quit=^\ erase=del kill=^U
45 eof=^D vtime=\0 vmin=\1 sxtc=\0
46 start=^Q stop=^S susp=^Z eol=\0
47 reprint=^R discard=^U werase=^W lnext=^V
48 eol2=\0
49*/
50#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
51
52/*
53 * Translate a "termio" structure into a "termios". Ugh.
54 */
55#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
56 unsigned short __tmp; \
57 get_user(__tmp,&(termio)->x); \
58 *(unsigned short *) &(termios)->x = __tmp; \
59}
60
61#define user_termio_to_kernel_termios(termios, termio) \
62({ \
63 SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
64 SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
65 SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
66 SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
67 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
68})
69
70/*
71 * Translate a "termios" structure into a "termio". Ugh.
72 */
73#define kernel_termios_to_user_termio(termio, termios) \
74({ \
75 put_user((termios)->c_iflag, &(termio)->c_iflag); \
76 put_user((termios)->c_oflag, &(termio)->c_oflag); \
77 put_user((termios)->c_cflag, &(termio)->c_cflag); \
78 put_user((termios)->c_lflag, &(termio)->c_lflag); \
79 put_user((termios)->c_line, &(termio)->c_line); \
80 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
81})
82
83#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
84#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
85#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
86#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
87
88#endif /* __KERNEL__ */
89
90#endif /* __ASM_SH_TERMIOS_H */
diff --git a/arch/sh/include/asm/timex.h b/arch/sh/include/asm/timex.h
index a873e24113cf..b556d49e5f2b 100644
--- a/arch/sh/include/asm/timex.h
+++ b/arch/sh/include/asm/timex.h
@@ -8,11 +8,6 @@
8 8
9#define CLOCK_TICK_RATE (CONFIG_SH_PCLK_FREQ / 4) /* Underlying HZ */ 9#define CLOCK_TICK_RATE (CONFIG_SH_PCLK_FREQ / 4) /* Underlying HZ */
10 10
11typedef unsigned long long cycles_t; 11#include <asm-generic/timex.h>
12
13static __inline__ cycles_t get_cycles (void)
14{
15 return 0;
16}
17 12
18#endif /* __ASM_SH_TIMEX_H */ 13#endif /* __ASM_SH_TIMEX_H */
diff --git a/arch/sh/include/asm/topology.h b/arch/sh/include/asm/topology.h
index 8489a0905a87..b69ee850906d 100644
--- a/arch/sh/include/asm/topology.h
+++ b/arch/sh/include/asm/topology.h
@@ -35,9 +35,6 @@
35#define cpumask_of_node(node) ((void)node, cpu_online_mask) 35#define cpumask_of_node(node) ((void)node, cpu_online_mask)
36 36
37#define pcibus_to_node(bus) ((void)(bus), -1) 37#define pcibus_to_node(bus) ((void)(bus), -1)
38#define pcibus_to_cpumask(bus) (pcibus_to_node(bus) == -1 ? \
39 CPU_MASK_ALL : \
40 node_to_cpumask(pcibus_to_node(bus)))
41#define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \ 38#define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \
42 CPU_MASK_ALL_PTR : \ 39 CPU_MASK_ALL_PTR : \
43 cpumask_of_node(pcibus_to_node(bus))) 40 cpumask_of_node(pcibus_to_node(bus)))
diff --git a/arch/sh/include/asm/types.h b/arch/sh/include/asm/types.h
index b13caca62a76..c7f3c94837dd 100644
--- a/arch/sh/include/asm/types.h
+++ b/arch/sh/include/asm/types.h
@@ -1,27 +1,14 @@
1#ifndef __ASM_SH_TYPES_H 1#ifndef __ASM_SH_TYPES_H
2#define __ASM_SH_TYPES_H 2#define __ASM_SH_TYPES_H
3 3
4#include <asm-generic/int-ll64.h> 4#include <asm-generic/types.h>
5
6#ifndef __ASSEMBLY__
7
8typedef unsigned short umode_t;
9
10#endif /* __ASSEMBLY__ */
11 5
12/* 6/*
13 * These aren't exported outside the kernel to avoid name space clashes 7 * These aren't exported outside the kernel to avoid name space clashes
14 */ 8 */
15#ifdef __KERNEL__ 9#ifdef __KERNEL__
16
17#define BITS_PER_LONG 32
18
19#ifndef __ASSEMBLY__ 10#ifndef __ASSEMBLY__
20 11
21/* Dma addresses are 32-bits wide. */
22
23typedef u32 dma_addr_t;
24
25#ifdef CONFIG_SUPERH32 12#ifdef CONFIG_SUPERH32
26typedef u16 insn_size_t; 13typedef u16 insn_size_t;
27#else 14#else
@@ -29,7 +16,6 @@ typedef u32 insn_size_t;
29#endif 16#endif
30 17
31#endif /* __ASSEMBLY__ */ 18#endif /* __ASSEMBLY__ */
32
33#endif /* __KERNEL__ */ 19#endif /* __KERNEL__ */
34 20
35#endif /* __ASM_SH_TYPES_H */ 21#endif /* __ASM_SH_TYPES_H */
diff --git a/arch/sh/include/asm/ucontext.h b/arch/sh/include/asm/ucontext.h
index 202ef1d5a3c4..9bc07b9f30fb 100644
--- a/arch/sh/include/asm/ucontext.h
+++ b/arch/sh/include/asm/ucontext.h
@@ -1,12 +1 @@
1#ifndef __ASM_SH_UCONTEXT_H #include <asm-generic/ucontext.h>
2#define __ASM_SH_UCONTEXT_H
3
4struct ucontext {
5 unsigned long uc_flags;
6 struct ucontext *uc_link;
7 stack_t uc_stack;
8 struct sigcontext uc_mcontext;
9 sigset_t uc_sigmask; /* mask last for extensibility */
10};
11
12#endif /* __ASM_SH_UCONTEXT_H */
diff --git a/arch/sh/include/asm/unaligned.h b/arch/sh/include/asm/unaligned.h
index 8c0ad5e4487a..7d14e0669961 100644
--- a/arch/sh/include/asm/unaligned.h
+++ b/arch/sh/include/asm/unaligned.h
@@ -6,19 +6,7 @@
6#include <asm/unaligned-sh4a.h> 6#include <asm/unaligned-sh4a.h>
7#else 7#else
8/* Otherwise, SH can't handle unaligned accesses. */ 8/* Otherwise, SH can't handle unaligned accesses. */
9#ifdef __LITTLE_ENDIAN__ 9#include <asm-generic/unaligned.h>
10# include <linux/unaligned/le_struct.h>
11# include <linux/unaligned/be_byteshift.h>
12# include <linux/unaligned/generic.h>
13# define get_unaligned __get_unaligned_le
14# define put_unaligned __put_unaligned_le
15#else
16# include <linux/unaligned/be_struct.h>
17# include <linux/unaligned/le_byteshift.h>
18# include <linux/unaligned/generic.h>
19# define get_unaligned __get_unaligned_be
20# define put_unaligned __put_unaligned_be
21#endif
22#endif 10#endif
23 11
24#endif /* _ASM_SH_UNALIGNED_H */ 12#endif /* _ASM_SH_UNALIGNED_H */
diff --git a/arch/sh/include/asm/unistd_32.h b/arch/sh/include/asm/unistd_32.h
index 65197086a1c5..61d6ad93d786 100644
--- a/arch/sh/include/asm/unistd_32.h
+++ b/arch/sh/include/asm/unistd_32.h
@@ -344,8 +344,9 @@
344#define __NR_preadv 333 344#define __NR_preadv 333
345#define __NR_pwritev 334 345#define __NR_pwritev 334
346#define __NR_rt_tgsigqueueinfo 335 346#define __NR_rt_tgsigqueueinfo 335
347#define __NR_perf_counter_open 336
347 348
348#define NR_syscalls 336 349#define NR_syscalls 337
349 350
350#ifdef __KERNEL__ 351#ifdef __KERNEL__
351 352
diff --git a/arch/sh/include/asm/unistd_64.h b/arch/sh/include/asm/unistd_64.h
index 8014aea88ec3..a751699afda3 100644
--- a/arch/sh/include/asm/unistd_64.h
+++ b/arch/sh/include/asm/unistd_64.h
@@ -384,10 +384,11 @@
384#define __NR_preadv 361 384#define __NR_preadv 361
385#define __NR_pwritev 362 385#define __NR_pwritev 362
386#define __NR_rt_tgsigqueueinfo 363 386#define __NR_rt_tgsigqueueinfo 363
387#define __NR_perf_counter_open 364
387 388
388#ifdef __KERNEL__ 389#ifdef __KERNEL__
389 390
390#define NR_syscalls 364 391#define NR_syscalls 365
391 392
392#define __ARCH_WANT_IPC_PARSE_VERSION 393#define __ARCH_WANT_IPC_PARSE_VERSION
393#define __ARCH_WANT_OLD_READDIR 394#define __ARCH_WANT_OLD_READDIR
diff --git a/arch/sh/include/mach-common/mach/highlander.h b/arch/sh/include/mach-common/mach/highlander.h
index bd26a848cb0b..5d9d4d5154be 100644
--- a/arch/sh/include/mach-common/mach/highlander.h
+++ b/arch/sh/include/mach-common/mach/highlander.h
@@ -2,6 +2,9 @@
2#define __ASM_SH_RENESAS_R7780RP_H 2#define __ASM_SH_RENESAS_R7780RP_H
3 3
4/* Box specific addresses. */ 4/* Box specific addresses. */
5#define PA_NORFLASH_ADDR 0x00000000
6#define PA_NORFLASH_SIZE 0x04000000
7
5#if defined(CONFIG_SH_R7780MP) 8#if defined(CONFIG_SH_R7780MP)
6#define PA_BCR 0xa4000000 /* FPGA */ 9#define PA_BCR 0xa4000000 /* FPGA */
7#define PA_SDPOW (-1) 10#define PA_SDPOW (-1)
diff --git a/arch/sh/kernel/cpu/clock-cpg.c b/arch/sh/kernel/cpu/clock-cpg.c
index 275942e58e4f..6dfe2cced3fc 100644
--- a/arch/sh/kernel/cpu/clock-cpg.c
+++ b/arch/sh/kernel/cpu/clock-cpg.c
@@ -1,6 +1,6 @@
1#include <linux/clk.h> 1#include <linux/clk.h>
2#include <linux/compiler.h> 2#include <linux/compiler.h>
3#include <linux/bootmem.h> 3#include <linux/slab.h>
4#include <linux/io.h> 4#include <linux/io.h>
5#include <asm/clock.h> 5#include <asm/clock.h>
6 6
@@ -127,10 +127,11 @@ int __init sh_clk_div6_register(struct clk *clks, int nr)
127 int k; 127 int k;
128 128
129 freq_table_size *= (nr_divs + 1); 129 freq_table_size *= (nr_divs + 1);
130 130 freq_table = kzalloc(freq_table_size * nr, GFP_KERNEL);
131 freq_table = alloc_bootmem(freq_table_size * nr); 131 if (!freq_table) {
132 if (!freq_table) 132 pr_err("sh_clk_div6_register: unable to alloc memory\n");
133 return -ENOMEM; 133 return -ENOMEM;
134 }
134 135
135 for (k = 0; !ret && (k < nr); k++) { 136 for (k = 0; !ret && (k < nr); k++) {
136 clkp = clks + k; 137 clkp = clks + k;
@@ -175,10 +176,11 @@ int __init sh_clk_div4_register(struct clk *clks, int nr,
175 int k; 176 int k;
176 177
177 freq_table_size *= (nr_divs + 1); 178 freq_table_size *= (nr_divs + 1);
178 179 freq_table = kzalloc(freq_table_size * nr, GFP_KERNEL);
179 freq_table = alloc_bootmem(freq_table_size * nr); 180 if (!freq_table) {
180 if (!freq_table) 181 pr_err("sh_clk_div4_register: unable to alloc memory\n");
181 return -ENOMEM; 182 return -ENOMEM;
183 }
182 184
183 for (k = 0; !ret && (k < nr); k++) { 185 for (k = 0; !ret && (k < nr); k++) {
184 clkp = clks + k; 186 clkp = clks + k;
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
index 318516f6bfad..c18f7d09281b 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
@@ -15,6 +15,7 @@
15#include <linux/serial_sci.h> 15#include <linux/serial_sci.h>
16#include <linux/uio_driver.h> 16#include <linux/uio_driver.h>
17#include <linux/sh_timer.h> 17#include <linux/sh_timer.h>
18#include <linux/usb/r8a66597.h>
18#include <asm/clock.h> 19#include <asm/clock.h>
19 20
20static struct resource iic_resources[] = { 21static struct resource iic_resources[] = {
@@ -38,18 +39,20 @@ static struct platform_device iic_device = {
38 .resource = iic_resources, 39 .resource = iic_resources,
39}; 40};
40 41
42static struct r8a66597_platdata r8a66597_data = {
43 /* This set zero to all members */
44};
45
41static struct resource usb_host_resources[] = { 46static struct resource usb_host_resources[] = {
42 [0] = { 47 [0] = {
43 .name = "r8a66597_hcd",
44 .start = 0xa4d80000, 48 .start = 0xa4d80000,
45 .end = 0xa4d800ff, 49 .end = 0xa4d800ff,
46 .flags = IORESOURCE_MEM, 50 .flags = IORESOURCE_MEM,
47 }, 51 },
48 [1] = { 52 [1] = {
49 .name = "r8a66597_hcd",
50 .start = 65, 53 .start = 65,
51 .end = 65, 54 .end = 65,
52 .flags = IORESOURCE_IRQ, 55 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
53 }, 56 },
54}; 57};
55 58
@@ -59,6 +62,7 @@ static struct platform_device usb_host_device = {
59 .dev = { 62 .dev = {
60 .dma_mask = NULL, 63 .dma_mask = NULL,
61 .coherent_dma_mask = 0xffffffff, 64 .coherent_dma_mask = 0xffffffff,
65 .platform_data = &r8a66597_data,
62 }, 66 },
63 .num_resources = ARRAY_SIZE(usb_host_resources), 67 .num_resources = ARRAY_SIZE(usb_host_resources),
64 .resource = usb_host_resources, 68 .resource = usb_host_resources,
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
index d8f4a13aeff9..e1bb80b2a27b 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
@@ -13,6 +13,7 @@
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <linux/serial_sci.h> 14#include <linux/serial_sci.h>
15#include <linux/uio_driver.h> 15#include <linux/uio_driver.h>
16#include <linux/usb/r8a66597.h>
16#include <linux/sh_timer.h> 17#include <linux/sh_timer.h>
17#include <linux/io.h> 18#include <linux/io.h>
18#include <asm/clock.h> 19#include <asm/clock.h>
@@ -396,9 +397,12 @@ static struct platform_device rtc_device = {
396 .resource = rtc_resources, 397 .resource = rtc_resources,
397}; 398};
398 399
400static struct r8a66597_platdata r8a66597_data = {
401 /* This set zero to all members */
402};
403
399static struct resource sh7723_usb_host_resources[] = { 404static struct resource sh7723_usb_host_resources[] = {
400 [0] = { 405 [0] = {
401 .name = "r8a66597_hcd",
402 .start = 0xa4d80000, 406 .start = 0xa4d80000,
403 .end = 0xa4d800ff, 407 .end = 0xa4d800ff,
404 .flags = IORESOURCE_MEM, 408 .flags = IORESOURCE_MEM,
@@ -406,7 +410,7 @@ static struct resource sh7723_usb_host_resources[] = {
406 [1] = { 410 [1] = {
407 .start = 65, 411 .start = 65,
408 .end = 65, 412 .end = 65,
409 .flags = IORESOURCE_IRQ, 413 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
410 }, 414 },
411}; 415};
412 416
@@ -416,6 +420,7 @@ static struct platform_device sh7723_usb_host_device = {
416 .dev = { 420 .dev = {
417 .dma_mask = NULL, /* not use dma */ 421 .dma_mask = NULL, /* not use dma */
418 .coherent_dma_mask = 0xffffffff, 422 .coherent_dma_mask = 0xffffffff,
423 .platform_data = &r8a66597_data,
419 }, 424 },
420 .num_resources = ARRAY_SIZE(sh7723_usb_host_resources), 425 .num_resources = ARRAY_SIZE(sh7723_usb_host_resources),
421 .resource = sh7723_usb_host_resources, 426 .resource = sh7723_usb_host_resources,
diff --git a/arch/sh/kernel/cpu/sh4a/smp-shx3.c b/arch/sh/kernel/cpu/sh4a/smp-shx3.c
index b8869aa20dec..2b6b0d50c576 100644
--- a/arch/sh/kernel/cpu/sh4a/smp-shx3.c
+++ b/arch/sh/kernel/cpu/sh4a/smp-shx3.c
@@ -35,8 +35,7 @@ void __init plat_smp_setup(void)
35 unsigned int cpu = 0; 35 unsigned int cpu = 0;
36 int i, num; 36 int i, num;
37 37
38 cpus_clear(cpu_possible_map); 38 init_cpu_possible(cpumask_of(cpu));
39 cpu_set(cpu, cpu_possible_map);
40 39
41 __cpu_number_map[0] = 0; 40 __cpu_number_map[0] = 0;
42 __cpu_logical_map[0] = 0; 41 __cpu_logical_map[0] = 0;
@@ -46,7 +45,7 @@ void __init plat_smp_setup(void)
46 * for the total number of cores. 45 * for the total number of cores.
47 */ 46 */
48 for (i = 1, num = 0; i < NR_CPUS; i++) { 47 for (i = 1, num = 0; i < NR_CPUS; i++) {
49 cpu_set(i, cpu_possible_map); 48 set_cpu_possible(i, true);
50 __cpu_number_map[i] = ++num; 49 __cpu_number_map[i] = ++num;
51 __cpu_logical_map[num] = i; 50 __cpu_logical_map[num] = i;
52 } 51 }
diff --git a/arch/sh/kernel/ftrace.c b/arch/sh/kernel/ftrace.c
index 4c3247477aa3..066f37dc32a9 100644
--- a/arch/sh/kernel/ftrace.c
+++ b/arch/sh/kernel/ftrace.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2008 Matt Fleming <mjf@gentoo.org> 2 * Copyright (C) 2008 Matt Fleming <matt@console-pimps.org>
3 * Copyright (C) 2008 Paul Mundt <lethal@linux-sh.org> 3 * Copyright (C) 2008 Paul Mundt <lethal@linux-sh.org>
4 * 4 *
5 * Code for replacing ftrace calls with jumps. 5 * Code for replacing ftrace calls with jumps.
@@ -19,30 +19,37 @@
19#include <asm/ftrace.h> 19#include <asm/ftrace.h>
20#include <asm/cacheflush.h> 20#include <asm/cacheflush.h>
21 21
22static unsigned char ftrace_nop[] = {
23 0x09, 0x00, /* nop */
24 0x09, 0x00, /* nop */
25};
26
27static unsigned char ftrace_replaced_code[MCOUNT_INSN_SIZE]; 22static unsigned char ftrace_replaced_code[MCOUNT_INSN_SIZE];
28 23
29unsigned char *ftrace_nop_replace(void) 24static unsigned char ftrace_nop[4];
25/*
26 * If we're trying to nop out a call to a function, we instead
27 * place a call to the address after the memory table.
28 *
29 * 8c011060 <a>:
30 * 8c011060: 02 d1 mov.l 8c01106c <a+0xc>,r1
31 * 8c011062: 22 4f sts.l pr,@-r15
32 * 8c011064: 02 c7 mova 8c011070 <a+0x10>,r0
33 * 8c011066: 2b 41 jmp @r1
34 * 8c011068: 2a 40 lds r0,pr
35 * 8c01106a: 09 00 nop
36 * 8c01106c: 68 24 .word 0x2468 <--- ip
37 * 8c01106e: 1d 8c .word 0x8c1d
38 * 8c011070: 26 4f lds.l @r15+,pr <--- ip + MCOUNT_INSN_SIZE
39 *
40 * We write 0x8c011070 to 0x8c01106c so that on entry to a() we branch
41 * past the _mcount call and continue executing code like normal.
42 */
43static unsigned char *ftrace_nop_replace(unsigned long ip)
30{ 44{
45 __raw_writel(ip + MCOUNT_INSN_SIZE, ftrace_nop);
31 return ftrace_nop; 46 return ftrace_nop;
32} 47}
33 48
34static int is_sh_nop(unsigned char *ip) 49static unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
35{
36 return strncmp(ip, ftrace_nop, sizeof(ftrace_nop));
37}
38
39unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
40{ 50{
41 /* Place the address in the memory table. */ 51 /* Place the address in the memory table. */
42 if (addr == CALLER_ADDR) 52 __raw_writel(addr, ftrace_replaced_code);
43 __raw_writel(addr + MCOUNT_INSN_OFFSET, ftrace_replaced_code);
44 else
45 __raw_writel(addr, ftrace_replaced_code);
46 53
47 /* 54 /*
48 * No locking needed, this must be called via kstop_machine 55 * No locking needed, this must be called via kstop_machine
@@ -51,7 +58,7 @@ unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr)
51 return ftrace_replaced_code; 58 return ftrace_replaced_code;
52} 59}
53 60
54int ftrace_modify_code(unsigned long ip, unsigned char *old_code, 61static int ftrace_modify_code(unsigned long ip, unsigned char *old_code,
55 unsigned char *new_code) 62 unsigned char *new_code)
56{ 63{
57 unsigned char replaced[MCOUNT_INSN_SIZE]; 64 unsigned char replaced[MCOUNT_INSN_SIZE];
@@ -66,13 +73,6 @@ int ftrace_modify_code(unsigned long ip, unsigned char *old_code,
66 * kstop_machine, or before SMP starts. 73 * kstop_machine, or before SMP starts.
67 */ 74 */
68 75
69 /*
70 * If we're trying to nop out a call to a function, we instead
71 * place a call to the address after the memory table.
72 */
73 if (is_sh_nop(new_code) == 0)
74 __raw_writel(ip + MCOUNT_INSN_SIZE, (unsigned long)new_code);
75
76 /* read the text we want to modify */ 76 /* read the text we want to modify */
77 if (probe_kernel_read(replaced, (void *)ip, MCOUNT_INSN_SIZE)) 77 if (probe_kernel_read(replaced, (void *)ip, MCOUNT_INSN_SIZE))
78 return -EFAULT; 78 return -EFAULT;
@@ -92,13 +92,13 @@ int ftrace_modify_code(unsigned long ip, unsigned char *old_code,
92 92
93int ftrace_update_ftrace_func(ftrace_func_t func) 93int ftrace_update_ftrace_func(ftrace_func_t func)
94{ 94{
95 unsigned long ip = (unsigned long)(&ftrace_call); 95 unsigned long ip = (unsigned long)(&ftrace_call) + MCOUNT_INSN_OFFSET;
96 unsigned char old[MCOUNT_INSN_SIZE], *new; 96 unsigned char old[MCOUNT_INSN_SIZE], *new;
97 97
98 memcpy(old, (unsigned char *)(ip + MCOUNT_INSN_OFFSET), MCOUNT_INSN_SIZE); 98 memcpy(old, (unsigned char *)ip, MCOUNT_INSN_SIZE);
99 new = ftrace_call_replace(ip, (unsigned long)func); 99 new = ftrace_call_replace(ip, (unsigned long)func);
100 100
101 return ftrace_modify_code(ip + MCOUNT_INSN_OFFSET, old, new); 101 return ftrace_modify_code(ip, old, new);
102} 102}
103 103
104int ftrace_make_nop(struct module *mod, 104int ftrace_make_nop(struct module *mod,
@@ -108,7 +108,7 @@ int ftrace_make_nop(struct module *mod,
108 unsigned long ip = rec->ip; 108 unsigned long ip = rec->ip;
109 109
110 old = ftrace_call_replace(ip, addr); 110 old = ftrace_call_replace(ip, addr);
111 new = ftrace_nop_replace(); 111 new = ftrace_nop_replace(ip);
112 112
113 return ftrace_modify_code(rec->ip, old, new); 113 return ftrace_modify_code(rec->ip, old, new);
114} 114}
@@ -118,7 +118,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
118 unsigned char *new, *old; 118 unsigned char *new, *old;
119 unsigned long ip = rec->ip; 119 unsigned long ip = rec->ip;
120 120
121 old = ftrace_nop_replace(); 121 old = ftrace_nop_replace(ip);
122 new = ftrace_call_replace(ip, addr); 122 new = ftrace_call_replace(ip, addr);
123 123
124 return ftrace_modify_code(rec->ip, old, new); 124 return ftrace_modify_code(rec->ip, old, new);
diff --git a/arch/sh/kernel/init_task.c b/arch/sh/kernel/init_task.c
index 80c35ff71d56..1719957c0a69 100644
--- a/arch/sh/kernel/init_task.c
+++ b/arch/sh/kernel/init_task.c
@@ -10,9 +10,6 @@
10static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 10static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
11static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 11static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
12struct pt_regs fake_swapper_regs; 12struct pt_regs fake_swapper_regs;
13struct mm_struct init_mm = INIT_MM(init_mm);
14EXPORT_SYMBOL(init_mm);
15
16/* 13/*
17 * Initial thread structure. 14 * Initial thread structure.
18 * 15 *
diff --git a/arch/sh/kernel/sh_ksyms_64.c b/arch/sh/kernel/sh_ksyms_64.c
index 8f54ef0cfbca..f5bd156ea504 100644
--- a/arch/sh/kernel/sh_ksyms_64.c
+++ b/arch/sh/kernel/sh_ksyms_64.c
@@ -38,13 +38,6 @@ EXPORT_SYMBOL(clear_user_page);
38EXPORT_SYMBOL(flush_dcache_page); 38EXPORT_SYMBOL(flush_dcache_page);
39#endif 39#endif
40 40
41/* Networking helper routines. */
42EXPORT_SYMBOL(csum_partial);
43EXPORT_SYMBOL(csum_partial_copy_nocheck);
44#ifdef CONFIG_IPV6
45EXPORT_SYMBOL(csum_ipv6_magic);
46#endif
47
48#ifdef CONFIG_VT 41#ifdef CONFIG_VT
49EXPORT_SYMBOL(screen_info); 42EXPORT_SYMBOL(screen_info);
50#endif 43#endif
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c
index 8f4027412614..442d8d47a41e 100644
--- a/arch/sh/kernel/smp.c
+++ b/arch/sh/kernel/smp.c
@@ -47,7 +47,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
47 plat_prepare_cpus(max_cpus); 47 plat_prepare_cpus(max_cpus);
48 48
49#ifndef CONFIG_HOTPLUG_CPU 49#ifndef CONFIG_HOTPLUG_CPU
50 cpu_present_map = cpu_possible_map; 50 init_cpu_present(&cpu_possible_map);
51#endif 51#endif
52} 52}
53 53
@@ -58,8 +58,8 @@ void __devinit smp_prepare_boot_cpu(void)
58 __cpu_number_map[0] = cpu; 58 __cpu_number_map[0] = cpu;
59 __cpu_logical_map[0] = cpu; 59 __cpu_logical_map[0] = cpu;
60 60
61 cpu_set(cpu, cpu_online_map); 61 set_cpu_online(cpu, true);
62 cpu_set(cpu, cpu_possible_map); 62 set_cpu_possible(cpu, true);
63} 63}
64 64
65asmlinkage void __cpuinit start_secondary(void) 65asmlinkage void __cpuinit start_secondary(void)
@@ -171,11 +171,11 @@ void smp_send_stop(void)
171 smp_call_function(stop_this_cpu, 0, 0); 171 smp_call_function(stop_this_cpu, 0, 0);
172} 172}
173 173
174void arch_send_call_function_ipi(cpumask_t mask) 174void arch_send_call_function_ipi_mask(const struct cpumask *mask)
175{ 175{
176 int cpu; 176 int cpu;
177 177
178 for_each_cpu_mask(cpu, mask) 178 for_each_cpu(cpu, mask)
179 plat_send_ipi(cpu, SMP_MSG_FUNCTION); 179 plat_send_ipi(cpu, SMP_MSG_FUNCTION);
180} 180}
181 181
diff --git a/arch/sh/kernel/syscalls_32.S b/arch/sh/kernel/syscalls_32.S
index a9fff9f731ec..f9e21fa2f592 100644
--- a/arch/sh/kernel/syscalls_32.S
+++ b/arch/sh/kernel/syscalls_32.S
@@ -352,3 +352,4 @@ ENTRY(sys_call_table)
352 .long sys_preadv 352 .long sys_preadv
353 .long sys_pwritev 353 .long sys_pwritev
354 .long sys_rt_tgsigqueueinfo /* 335 */ 354 .long sys_rt_tgsigqueueinfo /* 335 */
355 .long sys_perf_counter_open
diff --git a/arch/sh/kernel/syscalls_64.S b/arch/sh/kernel/syscalls_64.S
index 75c1889af1ed..bf420b616ae0 100644
--- a/arch/sh/kernel/syscalls_64.S
+++ b/arch/sh/kernel/syscalls_64.S
@@ -390,3 +390,4 @@ sys_call_table:
390 .long sys_preadv 390 .long sys_preadv
391 .long sys_pwritev 391 .long sys_pwritev
392 .long sys_rt_tgsigqueueinfo 392 .long sys_rt_tgsigqueueinfo
393 .long sys_perf_counter_open
diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c
index 2edde32c764b..9b352a1e3fb4 100644
--- a/arch/sh/kernel/time.c
+++ b/arch/sh/kernel/time.c
@@ -91,21 +91,6 @@ module_init(rtc_generic_init);
91 91
92void (*board_time_init)(void); 92void (*board_time_init)(void);
93 93
94unsigned long long sched_clock(void)
95{
96 return (jiffies_64 - INITIAL_JIFFIES) * (NSEC_PER_SEC / HZ);
97}
98
99static void __init sh_late_time_init(void)
100{
101 /*
102 * Make sure all compiled-in early timers register themselves.
103 * Run probe() for one "earlytimer" device.
104 */
105 early_platform_driver_register_all("earlytimer");
106 early_platform_driver_probe("earlytimer", 1, 0);
107}
108
109void __init time_init(void) 94void __init time_init(void)
110{ 95{
111 if (board_time_init) 96 if (board_time_init)
@@ -121,5 +106,15 @@ void __init time_init(void)
121 local_timer_setup(smp_processor_id()); 106 local_timer_setup(smp_processor_id());
122#endif 107#endif
123 108
124 late_time_init = sh_late_time_init; 109 /*
110 * Make sure all compiled-in early timers register themselves.
111 *
112 * Run probe() for two "earlytimer" devices, these will be the
113 * clockevents and clocksource devices respectively. In the event
114 * that only a clockevents device is available, we -ENODEV on the
115 * clocksource and the jiffies clocksource is used transparently
116 * instead. No error handling is necessary here.
117 */
118 early_platform_driver_register_all("earlytimer");
119 early_platform_driver_probe("earlytimer", 2, 0);
125} 120}
diff --git a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c
index 46348ed07cc3..b3e0067db358 100644
--- a/arch/sh/kernel/traps.c
+++ b/arch/sh/kernel/traps.c
@@ -69,6 +69,7 @@ BUILD_TRAP_HANDLER(bug)
69 insn_size_t insn = *(insn_size_t *)instruction_pointer(regs); 69 insn_size_t insn = *(insn_size_t *)instruction_pointer(regs);
70 if (insn == TRAPA_BUG_OPCODE) 70 if (insn == TRAPA_BUG_OPCODE)
71 handle_BUG(regs); 71 handle_BUG(regs);
72 return;
72 } 73 }
73#endif 74#endif
74 75
diff --git a/arch/sh/lib64/Makefile b/arch/sh/lib64/Makefile
index 4bacb9e83478..334bb2da36ea 100644
--- a/arch/sh/lib64/Makefile
+++ b/arch/sh/lib64/Makefile
@@ -10,7 +10,7 @@
10# 10#
11 11
12# Panic should really be compiled as PIC 12# Panic should really be compiled as PIC
13lib-y := udelay.o c-checksum.o dbg.o panic.o memcpy.o memset.o \ 13lib-y := udelay.o dbg.o panic.o memcpy.o memset.o \
14 copy_user_memcpy.o copy_page.o clear_page.o strcpy.o strlen.o 14 copy_user_memcpy.o copy_page.o clear_page.o strcpy.o strlen.o
15 15
16# Extracted from libgcc 16# Extracted from libgcc
diff --git a/arch/sh/lib64/c-checksum.c b/arch/sh/lib64/c-checksum.c
deleted file mode 100644
index 73c0877e3a29..000000000000
--- a/arch/sh/lib64/c-checksum.c
+++ /dev/null
@@ -1,214 +0,0 @@
1/*
2 * arch/sh/lib64/c-checksum.c
3 *
4 * This file contains network checksum routines that are better done
5 * in an architecture-specific manner due to speed..
6 */
7#include <linux/string.h>
8#include <linux/errno.h>
9#include <linux/kernel.h>
10#include <linux/module.h>
11#include <asm/byteorder.h>
12#include <asm/uaccess.h>
13
14static inline unsigned short from64to16(unsigned long long x)
15{
16 /* add up 32-bit words for 33 bits */
17 x = (x & 0xffffffff) + (x >> 32);
18 /* add up 16-bit and 17-bit words for 17+c bits */
19 x = (x & 0xffff) + (x >> 16);
20 /* add up 16-bit and 2-bit for 16+c bit */
21 x = (x & 0xffff) + (x >> 16);
22 /* add up carry.. */
23 x = (x & 0xffff) + (x >> 16);
24 return x;
25}
26
27static inline unsigned short foldto16(unsigned long x)
28{
29 /* add up 16-bit for 17 bits */
30 x = (x & 0xffff) + (x >> 16);
31 /* add up carry.. */
32 x = (x & 0xffff) + (x >> 16);
33 return x;
34}
35
36static inline unsigned short myfoldto16(unsigned long long x)
37{
38 /* Fold down to 32-bits so we don't lose in the typedef-less
39 network stack. */
40 /* 64 to 33 */
41 x = (x & 0xffffffff) + (x >> 32);
42 /* 33 to 32 */
43 x = (x & 0xffffffff) + (x >> 32);
44
45 /* add up 16-bit for 17 bits */
46 x = (x & 0xffff) + (x >> 16);
47 /* add up carry.. */
48 x = (x & 0xffff) + (x >> 16);
49 return x;
50}
51
52#define odd(x) ((x)&1)
53#define U16(x) ntohs(x)
54
55static unsigned long do_csum(const unsigned char *buff, int len)
56{
57 int odd, count;
58 unsigned long result = 0;
59
60 pr_debug("do_csum buff %p, len %d (0x%x)\n", buff, len, len);
61#ifdef DEBUG
62 for (i = 0; i < len; i++) {
63 if ((i % 26) == 0)
64 printk("\n");
65 printk("%02X ", buff[i]);
66 }
67#endif
68
69 if (len <= 0)
70 goto out;
71
72 odd = 1 & (unsigned long) buff;
73 if (odd) {
74 result = *buff << 8;
75 len--;
76 buff++;
77 }
78 count = len >> 1; /* nr of 16-bit words.. */
79 if (count) {
80 if (2 & (unsigned long) buff) {
81 result += *(unsigned short *) buff;
82 count--;
83 len -= 2;
84 buff += 2;
85 }
86 count >>= 1; /* nr of 32-bit words.. */
87 if (count) {
88 unsigned long carry = 0;
89 do {
90 unsigned long w = *(unsigned long *) buff;
91 buff += 4;
92 count--;
93 result += carry;
94 result += w;
95 carry = (w > result);
96 } while (count);
97 result += carry;
98 result = (result & 0xffff) + (result >> 16);
99 }
100 if (len & 2) {
101 result += *(unsigned short *) buff;
102 buff += 2;
103 }
104 }
105 if (len & 1)
106 result += *buff;
107 result = foldto16(result);
108 if (odd)
109 result = ((result >> 8) & 0xff) | ((result & 0xff) << 8);
110
111 pr_debug("\nCHECKSUM is 0x%lx\n", result);
112
113 out:
114 return result;
115}
116
117/* computes the checksum of a memory block at buff, length len,
118 and adds in "sum" (32-bit) */
119__wsum csum_partial(const void *buff, int len, __wsum sum)
120{
121 unsigned long long result = do_csum(buff, len);
122
123 /* add in old sum, and carry.. */
124 result += (__force u32)sum;
125 /* 32+c bits -> 32 bits */
126 result = (result & 0xffffffff) + (result >> 32);
127
128 pr_debug("csum_partial, buff %p len %d sum 0x%x result=0x%016Lx\n",
129 buff, len, sum, result);
130
131 return (__force __wsum)result;
132}
133
134/* Copy while checksumming, otherwise like csum_partial. */
135__wsum
136csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
137{
138 sum = csum_partial(src, len, sum);
139 memcpy(dst, src, len);
140
141 return sum;
142}
143
144/* Copy from userspace and compute checksum. If we catch an exception
145 then zero the rest of the buffer. */
146__wsum
147csum_partial_copy_from_user(const void __user *src, void *dst, int len,
148 __wsum sum, int *err_ptr)
149{
150 int missing;
151
152 pr_debug
153 ("csum_partial_copy_from_user src %p, dest %p, len %d, sum %08x, err_ptr %p\n",
154 src, dst, len, sum, err_ptr);
155 missing = copy_from_user(dst, src, len);
156 pr_debug(" access_ok %d\n", __access_ok((unsigned long) src, len));
157 pr_debug(" missing %d\n", missing);
158 if (missing) {
159 memset(dst + len - missing, 0, missing);
160 *err_ptr = -EFAULT;
161 }
162
163 return csum_partial(dst, len, sum);
164}
165
166/* Copy to userspace and compute checksum. */
167__wsum
168csum_partial_copy_to_user(const unsigned char *src, unsigned char *dst, int len,
169 __wsum sum, int *err_ptr)
170{
171 sum = csum_partial(src, len, sum);
172
173 if (copy_to_user(dst, src, len))
174 *err_ptr = -EFAULT;
175
176 return sum;
177}
178
179/*
180 * This is a version of ip_compute_csum() optimized for IP headers,
181 * which always checksum on 4 octet boundaries.
182 */
183__sum16 ip_fast_csum(const void *iph, unsigned int ihl)
184{
185 pr_debug("ip_fast_csum %p,%d\n", iph, ihl);
186
187 return (__force __sum16)~do_csum(iph, ihl * 4);
188}
189
190__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
191 unsigned short len,
192 unsigned short proto, __wsum sum)
193{
194 unsigned long long result;
195
196 pr_debug("ntohs(0x%x)=0x%x\n", 0xdead, ntohs(0xdead));
197 pr_debug("htons(0x%x)=0x%x\n", 0xdead, htons(0xdead));
198
199 result = (__force u64) saddr + (__force u64) daddr +
200 (__force u64) sum + ((len + proto) << 8);
201
202 /* Fold down to 32-bits so we don't lose in the typedef-less
203 network stack. */
204 /* 64 to 33 */
205 result = (result & 0xffffffff) + (result >> 32);
206 /* 33 to 32 */
207 result = (result & 0xffffffff) + (result >> 32);
208
209 pr_debug("%s saddr %x daddr %x len %x proto %x sum %x result %08Lx\n",
210 __func__, saddr, daddr, len, proto, sum, result);
211
212 return (__wsum)result;
213}
214EXPORT_SYMBOL(csum_tcpudp_nofold);
diff --git a/arch/sparc/include/asm/kmap_types.h b/arch/sparc/include/asm/kmap_types.h
index 602f5e034f7a..aad21745fbb9 100644
--- a/arch/sparc/include/asm/kmap_types.h
+++ b/arch/sparc/include/asm/kmap_types.h
@@ -5,21 +5,6 @@
5 * is actually used on sparc. -DaveM 5 * is actually used on sparc. -DaveM
6 */ 6 */
7 7
8enum km_type { 8#include <asm-generic/kmap_types.h>
9 KM_BOUNCE_READ,
10 KM_SKB_SUNRPC_DATA,
11 KM_SKB_DATA_SOFTIRQ,
12 KM_USER0,
13 KM_USER1,
14 KM_BIO_SRC_IRQ,
15 KM_BIO_DST_IRQ,
16 KM_PTE0,
17 KM_PTE1,
18 KM_IRQ0,
19 KM_IRQ1,
20 KM_SOFTIRQ0,
21 KM_SOFTIRQ1,
22 KM_TYPE_NR
23};
24 9
25#endif 10#endif
diff --git a/arch/sparc/kernel/init_task.c b/arch/sparc/kernel/init_task.c
index f28cb8278e98..28125c5b3d3c 100644
--- a/arch/sparc/kernel/init_task.c
+++ b/arch/sparc/kernel/init_task.c
@@ -10,10 +10,7 @@
10 10
11static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 11static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
12static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 12static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
13struct mm_struct init_mm = INIT_MM(init_mm);
14struct task_struct init_task = INIT_TASK(init_task); 13struct task_struct init_task = INIT_TASK(init_task);
15
16EXPORT_SYMBOL(init_mm);
17EXPORT_SYMBOL(init_task); 14EXPORT_SYMBOL(init_task);
18 15
19/* .text section in head.S is aligned at 8k boundary and this gets linked 16/* .text section in head.S is aligned at 8k boundary and this gets linked
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 434ba121e3c5..3b44b47c7e1d 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -360,7 +360,7 @@ static struct platform_driver uml_net_driver = {
360 360
361static void net_device_release(struct device *dev) 361static void net_device_release(struct device *dev)
362{ 362{
363 struct uml_net *device = dev->driver_data; 363 struct uml_net *device = dev_get_drvdata(dev);
364 struct net_device *netdev = device->dev; 364 struct net_device *netdev = device->dev;
365 struct uml_net_private *lp = netdev_priv(netdev); 365 struct uml_net_private *lp = netdev_priv(netdev);
366 366
@@ -440,7 +440,7 @@ static void eth_configure(int n, void *init, char *mac,
440 device->pdev.id = n; 440 device->pdev.id = n;
441 device->pdev.name = DRIVER_NAME; 441 device->pdev.name = DRIVER_NAME;
442 device->pdev.dev.release = net_device_release; 442 device->pdev.dev.release = net_device_release;
443 device->pdev.dev.driver_data = device; 443 dev_set_drvdata(&device->pdev.dev, device);
444 if (platform_device_register(&device->pdev)) 444 if (platform_device_register(&device->pdev))
445 goto out_free_netdev; 445 goto out_free_netdev;
446 SET_NETDEV_DEV(dev,&device->pdev.dev); 446 SET_NETDEV_DEV(dev,&device->pdev.dev);
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index aa9e926e13d7..8f05d4d9da12 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -778,7 +778,7 @@ static int ubd_open_dev(struct ubd *ubd_dev)
778 778
779static void ubd_device_release(struct device *dev) 779static void ubd_device_release(struct device *dev)
780{ 780{
781 struct ubd *ubd_dev = dev->driver_data; 781 struct ubd *ubd_dev = dev_get_drvdata(dev);
782 782
783 blk_cleanup_queue(ubd_dev->queue); 783 blk_cleanup_queue(ubd_dev->queue);
784 *ubd_dev = ((struct ubd) DEFAULT_UBD); 784 *ubd_dev = ((struct ubd) DEFAULT_UBD);
@@ -807,7 +807,7 @@ static int ubd_disk_register(int major, u64 size, int unit,
807 ubd_devs[unit].pdev.id = unit; 807 ubd_devs[unit].pdev.id = unit;
808 ubd_devs[unit].pdev.name = DRIVER_NAME; 808 ubd_devs[unit].pdev.name = DRIVER_NAME;
809 ubd_devs[unit].pdev.dev.release = ubd_device_release; 809 ubd_devs[unit].pdev.dev.release = ubd_device_release;
810 ubd_devs[unit].pdev.dev.driver_data = &ubd_devs[unit]; 810 dev_set_drvdata(&ubd_devs[unit].pdev.dev, &ubd_devs[unit]);
811 platform_device_register(&ubd_devs[unit].pdev); 811 platform_device_register(&ubd_devs[unit].pdev);
812 disk->driverfs_dev = &ubd_devs[unit].pdev.dev; 812 disk->driverfs_dev = &ubd_devs[unit].pdev.dev;
813 } 813 }
diff --git a/arch/um/include/shared/init.h b/arch/um/include/shared/init.h
index 37dd097c16c0..b3906f860a87 100644
--- a/arch/um/include/shared/init.h
+++ b/arch/um/include/shared/init.h
@@ -27,7 +27,7 @@
27 * sign followed by value, e.g.: 27 * sign followed by value, e.g.:
28 * 28 *
29 * static int init_variable __initdata = 0; 29 * static int init_variable __initdata = 0;
30 * static char linux_logo[] __initdata = { 0x32, 0x36, ... }; 30 * static const char linux_logo[] __initconst = { 0x32, 0x36, ... };
31 * 31 *
32 * Don't forget to initialize data not at file scope, i.e. within a function, 32 * Don't forget to initialize data not at file scope, i.e. within a function,
33 * as gcc otherwise puts the data into the bss section and not into the init 33 * as gcc otherwise puts the data into the bss section and not into the init
diff --git a/arch/um/include/shared/net_user.h b/arch/um/include/shared/net_user.h
index 63bee158cd8e..3dabbe128e40 100644
--- a/arch/um/include/shared/net_user.h
+++ b/arch/um/include/shared/net_user.h
@@ -8,7 +8,7 @@
8 8
9#define ETH_ADDR_LEN (6) 9#define ETH_ADDR_LEN (6)
10#define ETH_HEADER_ETHERTAP (16) 10#define ETH_HEADER_ETHERTAP (16)
11#define ETH_HEADER_OTHER (14) 11#define ETH_HEADER_OTHER (26) /* 14 for ethernet + VLAN + MPLS for crazy people */
12#define ETH_MAX_PACKET (1500) 12#define ETH_MAX_PACKET (1500)
13 13
14#define UML_NET_VERSION (4) 14#define UML_NET_VERSION (4)
diff --git a/arch/um/kernel/init_task.c b/arch/um/kernel/init_task.c
index 806d381947bf..b25121b537d8 100644
--- a/arch/um/kernel/init_task.c
+++ b/arch/um/kernel/init_task.c
@@ -10,11 +10,8 @@
10#include "linux/mqueue.h" 10#include "linux/mqueue.h"
11#include "asm/uaccess.h" 11#include "asm/uaccess.h"
12 12
13struct mm_struct init_mm = INIT_MM(init_mm);
14static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 13static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
15static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 14static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
16EXPORT_SYMBOL(init_mm);
17
18/* 15/*
19 * Initial task structure. 16 * Initial task structure.
20 * 17 *
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index 336b61569072..454cdb43e351 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -358,7 +358,7 @@ EXPORT_SYMBOL(um_request_irq);
358EXPORT_SYMBOL(reactivate_fd); 358EXPORT_SYMBOL(reactivate_fd);
359 359
360/* 360/*
361 * hw_interrupt_type must define (startup || enable) && 361 * irq_chip must define (startup || enable) &&
362 * (shutdown || disable) && end 362 * (shutdown || disable) && end
363 */ 363 */
364static void dummy(unsigned int irq) 364static void dummy(unsigned int irq)
@@ -366,7 +366,7 @@ static void dummy(unsigned int irq)
366} 366}
367 367
368/* This is used for everything else than the timer. */ 368/* This is used for everything else than the timer. */
369static struct hw_interrupt_type normal_irq_type = { 369static struct irq_chip normal_irq_type = {
370 .typename = "SIGIO", 370 .typename = "SIGIO",
371 .release = free_irq_by_irq_and_dev, 371 .release = free_irq_by_irq_and_dev,
372 .disable = dummy, 372 .disable = dummy,
@@ -375,7 +375,7 @@ static struct hw_interrupt_type normal_irq_type = {
375 .end = dummy 375 .end = dummy
376}; 376};
377 377
378static struct hw_interrupt_type SIGVTALRM_irq_type = { 378static struct irq_chip SIGVTALRM_irq_type = {
379 .typename = "SIGVTALRM", 379 .typename = "SIGVTALRM",
380 .release = free_irq_by_irq_and_dev, 380 .release = free_irq_by_irq_and_dev,
381 .shutdown = dummy, /* never called */ 381 .shutdown = dummy, /* never called */
diff --git a/arch/um/sys-i386/stub.S b/arch/um/sys-i386/stub.S
index c41b04bf5fa0..54a36ec20cb7 100644
--- a/arch/um/sys-i386/stub.S
+++ b/arch/um/sys-i386/stub.S
@@ -1,7 +1,7 @@
1#include "as-layout.h" 1#include "as-layout.h"
2 2
3 .globl syscall_stub 3 .globl syscall_stub
4.section .__syscall_stub, "x" 4.section .__syscall_stub, "ax"
5 5
6 .globl batch_syscall_stub 6 .globl batch_syscall_stub
7batch_syscall_stub: 7batch_syscall_stub:
diff --git a/arch/um/sys-x86_64/asm/elf.h b/arch/um/sys-x86_64/asm/elf.h
index 6e8a9195e952..04b9e87c8dad 100644
--- a/arch/um/sys-x86_64/asm/elf.h
+++ b/arch/um/sys-x86_64/asm/elf.h
@@ -66,28 +66,28 @@ typedef struct user_i387_struct elf_fpregset_t;
66 PT_REGS_R15(regs) = 0; \ 66 PT_REGS_R15(regs) = 0; \
67} while (0) 67} while (0)
68 68
69#define ELF_CORE_COPY_REGS(pr_reg, regs) \ 69#define ELF_CORE_COPY_REGS(pr_reg, _regs) \
70 (pr_reg)[0] = (regs)->regs.gp[0]; \ 70 (pr_reg)[0] = (_regs)->regs.gp[0]; \
71 (pr_reg)[1] = (regs)->regs.gp[1]; \ 71 (pr_reg)[1] = (_regs)->regs.gp[1]; \
72 (pr_reg)[2] = (regs)->regs.gp[2]; \ 72 (pr_reg)[2] = (_regs)->regs.gp[2]; \
73 (pr_reg)[3] = (regs)->regs.gp[3]; \ 73 (pr_reg)[3] = (_regs)->regs.gp[3]; \
74 (pr_reg)[4] = (regs)->regs.gp[4]; \ 74 (pr_reg)[4] = (_regs)->regs.gp[4]; \
75 (pr_reg)[5] = (regs)->regs.gp[5]; \ 75 (pr_reg)[5] = (_regs)->regs.gp[5]; \
76 (pr_reg)[6] = (regs)->regs.gp[6]; \ 76 (pr_reg)[6] = (_regs)->regs.gp[6]; \
77 (pr_reg)[7] = (regs)->regs.gp[7]; \ 77 (pr_reg)[7] = (_regs)->regs.gp[7]; \
78 (pr_reg)[8] = (regs)->regs.gp[8]; \ 78 (pr_reg)[8] = (_regs)->regs.gp[8]; \
79 (pr_reg)[9] = (regs)->regs.gp[9]; \ 79 (pr_reg)[9] = (_regs)->regs.gp[9]; \
80 (pr_reg)[10] = (regs)->regs.gp[10]; \ 80 (pr_reg)[10] = (_regs)->regs.gp[10]; \
81 (pr_reg)[11] = (regs)->regs.gp[11]; \ 81 (pr_reg)[11] = (_regs)->regs.gp[11]; \
82 (pr_reg)[12] = (regs)->regs.gp[12]; \ 82 (pr_reg)[12] = (_regs)->regs.gp[12]; \
83 (pr_reg)[13] = (regs)->regs.gp[13]; \ 83 (pr_reg)[13] = (_regs)->regs.gp[13]; \
84 (pr_reg)[14] = (regs)->regs.gp[14]; \ 84 (pr_reg)[14] = (_regs)->regs.gp[14]; \
85 (pr_reg)[15] = (regs)->regs.gp[15]; \ 85 (pr_reg)[15] = (_regs)->regs.gp[15]; \
86 (pr_reg)[16] = (regs)->regs.gp[16]; \ 86 (pr_reg)[16] = (_regs)->regs.gp[16]; \
87 (pr_reg)[17] = (regs)->regs.gp[17]; \ 87 (pr_reg)[17] = (_regs)->regs.gp[17]; \
88 (pr_reg)[18] = (regs)->regs.gp[18]; \ 88 (pr_reg)[18] = (_regs)->regs.gp[18]; \
89 (pr_reg)[19] = (regs)->regs.gp[19]; \ 89 (pr_reg)[19] = (_regs)->regs.gp[19]; \
90 (pr_reg)[20] = (regs)->regs.gp[20]; \ 90 (pr_reg)[20] = (_regs)->regs.gp[20]; \
91 (pr_reg)[21] = current->thread.arch.fs; \ 91 (pr_reg)[21] = current->thread.arch.fs; \
92 (pr_reg)[22] = 0; \ 92 (pr_reg)[22] = 0; \
93 (pr_reg)[23] = 0; \ 93 (pr_reg)[23] = 0; \
diff --git a/arch/um/sys-x86_64/stub.S b/arch/um/sys-x86_64/stub.S
index 6d9edf9fabce..20e4a96a6dcb 100644
--- a/arch/um/sys-x86_64/stub.S
+++ b/arch/um/sys-x86_64/stub.S
@@ -1,7 +1,7 @@
1#include "as-layout.h" 1#include "as-layout.h"
2 2
3 .globl syscall_stub 3 .globl syscall_stub
4.section .__syscall_stub, "x" 4.section .__syscall_stub, "ax"
5syscall_stub: 5syscall_stub:
6 syscall 6 syscall
7 /* We don't have 64-bit constants, so this constructs the address 7 /* We don't have 64-bit constants, so this constructs the address
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 356d2ec8e2fb..cf42fc305419 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -46,6 +46,7 @@ config X86
46 select HAVE_KERNEL_GZIP 46 select HAVE_KERNEL_GZIP
47 select HAVE_KERNEL_BZIP2 47 select HAVE_KERNEL_BZIP2
48 select HAVE_KERNEL_LZMA 48 select HAVE_KERNEL_LZMA
49 select HAVE_ARCH_KMEMCHECK
49 50
50config OUTPUT_FORMAT 51config OUTPUT_FORMAT
51 string 52 string
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index edbd0ca62067..1b68659c41b4 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -81,6 +81,11 @@ ifdef CONFIG_CC_STACKPROTECTOR
81 endif 81 endif
82endif 82endif
83 83
84# Don't unroll struct assignments with kmemcheck enabled
85ifeq ($(CONFIG_KMEMCHECK),y)
86 KBUILD_CFLAGS += $(call cc-option,-fno-builtin-memcpy)
87endif
88
84# Stackpointer is addressed different for 32 bit and 64 bit x86 89# Stackpointer is addressed different for 32 bit and 64 bit x86
85sp-$(CONFIG_X86_32) := esp 90sp-$(CONFIG_X86_32) := esp
86sp-$(CONFIG_X86_64) := rsp 91sp-$(CONFIG_X86_64) := rsp
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index f82fdc412c64..b93405b228b4 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -6,6 +6,7 @@
6 * Documentation/DMA-API.txt for documentation. 6 * Documentation/DMA-API.txt for documentation.
7 */ 7 */
8 8
9#include <linux/kmemcheck.h>
9#include <linux/scatterlist.h> 10#include <linux/scatterlist.h>
10#include <linux/dma-debug.h> 11#include <linux/dma-debug.h>
11#include <linux/dma-attrs.h> 12#include <linux/dma-attrs.h>
@@ -60,6 +61,7 @@ dma_map_single(struct device *hwdev, void *ptr, size_t size,
60 dma_addr_t addr; 61 dma_addr_t addr;
61 62
62 BUG_ON(!valid_dma_direction(dir)); 63 BUG_ON(!valid_dma_direction(dir));
64 kmemcheck_mark_initialized(ptr, size);
63 addr = ops->map_page(hwdev, virt_to_page(ptr), 65 addr = ops->map_page(hwdev, virt_to_page(ptr),
64 (unsigned long)ptr & ~PAGE_MASK, size, 66 (unsigned long)ptr & ~PAGE_MASK, size,
65 dir, NULL); 67 dir, NULL);
@@ -87,8 +89,12 @@ dma_map_sg(struct device *hwdev, struct scatterlist *sg,
87{ 89{
88 struct dma_map_ops *ops = get_dma_ops(hwdev); 90 struct dma_map_ops *ops = get_dma_ops(hwdev);
89 int ents; 91 int ents;
92 struct scatterlist *s;
93 int i;
90 94
91 BUG_ON(!valid_dma_direction(dir)); 95 BUG_ON(!valid_dma_direction(dir));
96 for_each_sg(sg, s, nents, i)
97 kmemcheck_mark_initialized(sg_virt(s), s->length);
92 ents = ops->map_sg(hwdev, sg, nents, dir, NULL); 98 ents = ops->map_sg(hwdev, sg, nents, dir, NULL);
93 debug_dma_map_sg(hwdev, sg, nents, ents, dir); 99 debug_dma_map_sg(hwdev, sg, nents, ents, dir);
94 100
@@ -200,6 +206,7 @@ static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
200 dma_addr_t addr; 206 dma_addr_t addr;
201 207
202 BUG_ON(!valid_dma_direction(dir)); 208 BUG_ON(!valid_dma_direction(dir));
209 kmemcheck_mark_initialized(page_address(page) + offset, size);
203 addr = ops->map_page(dev, page, offset, size, dir, NULL); 210 addr = ops->map_page(dev, page, offset, size, dir, NULL);
204 debug_dma_map_page(dev, page, offset, size, dir, addr, false); 211 debug_dma_map_page(dev, page, offset, size, dir, addr, false);
205 212
diff --git a/arch/x86/include/asm/kmap_types.h b/arch/x86/include/asm/kmap_types.h
index 5759c165a5cf..9e00a731a7fb 100644
--- a/arch/x86/include/asm/kmap_types.h
+++ b/arch/x86/include/asm/kmap_types.h
@@ -2,28 +2,11 @@
2#define _ASM_X86_KMAP_TYPES_H 2#define _ASM_X86_KMAP_TYPES_H
3 3
4#if defined(CONFIG_X86_32) && defined(CONFIG_DEBUG_HIGHMEM) 4#if defined(CONFIG_X86_32) && defined(CONFIG_DEBUG_HIGHMEM)
5# define D(n) __KM_FENCE_##n , 5#define __WITH_KM_FENCE
6#else
7# define D(n)
8#endif 6#endif
9 7
10enum km_type { 8#include <asm-generic/kmap_types.h>
11D(0) KM_BOUNCE_READ,
12D(1) KM_SKB_SUNRPC_DATA,
13D(2) KM_SKB_DATA_SOFTIRQ,
14D(3) KM_USER0,
15D(4) KM_USER1,
16D(5) KM_BIO_SRC_IRQ,
17D(6) KM_BIO_DST_IRQ,
18D(7) KM_PTE0,
19D(8) KM_PTE1,
20D(9) KM_IRQ0,
21D(10) KM_IRQ1,
22D(11) KM_SOFTIRQ0,
23D(12) KM_SOFTIRQ1,
24D(13) KM_TYPE_NR
25};
26 9
27#undef D 10#undef __WITH_KM_FENCE
28 11
29#endif /* _ASM_X86_KMAP_TYPES_H */ 12#endif /* _ASM_X86_KMAP_TYPES_H */
diff --git a/arch/x86/include/asm/kmemcheck.h b/arch/x86/include/asm/kmemcheck.h
new file mode 100644
index 000000000000..ed01518f297e
--- /dev/null
+++ b/arch/x86/include/asm/kmemcheck.h
@@ -0,0 +1,42 @@
1#ifndef ASM_X86_KMEMCHECK_H
2#define ASM_X86_KMEMCHECK_H
3
4#include <linux/types.h>
5#include <asm/ptrace.h>
6
7#ifdef CONFIG_KMEMCHECK
8bool kmemcheck_active(struct pt_regs *regs);
9
10void kmemcheck_show(struct pt_regs *regs);
11void kmemcheck_hide(struct pt_regs *regs);
12
13bool kmemcheck_fault(struct pt_regs *regs,
14 unsigned long address, unsigned long error_code);
15bool kmemcheck_trap(struct pt_regs *regs);
16#else
17static inline bool kmemcheck_active(struct pt_regs *regs)
18{
19 return false;
20}
21
22static inline void kmemcheck_show(struct pt_regs *regs)
23{
24}
25
26static inline void kmemcheck_hide(struct pt_regs *regs)
27{
28}
29
30static inline bool kmemcheck_fault(struct pt_regs *regs,
31 unsigned long address, unsigned long error_code)
32{
33 return false;
34}
35
36static inline bool kmemcheck_trap(struct pt_regs *regs)
37{
38 return false;
39}
40#endif /* CONFIG_KMEMCHECK */
41
42#endif
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 18ef7ebf2631..3cc06e3fceb8 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -317,6 +317,11 @@ static inline int pte_present(pte_t a)
317 return pte_flags(a) & (_PAGE_PRESENT | _PAGE_PROTNONE); 317 return pte_flags(a) & (_PAGE_PRESENT | _PAGE_PROTNONE);
318} 318}
319 319
320static inline int pte_hidden(pte_t pte)
321{
322 return pte_flags(pte) & _PAGE_HIDDEN;
323}
324
320static inline int pmd_present(pmd_t pmd) 325static inline int pmd_present(pmd_t pmd)
321{ 326{
322 return pmd_flags(pmd) & _PAGE_PRESENT; 327 return pmd_flags(pmd) & _PAGE_PRESENT;
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
index 4d258ad76a0f..54cb697f4900 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -18,7 +18,7 @@
18#define _PAGE_BIT_GLOBAL 8 /* Global TLB entry PPro+ */ 18#define _PAGE_BIT_GLOBAL 8 /* Global TLB entry PPro+ */
19#define _PAGE_BIT_UNUSED1 9 /* available for programmer */ 19#define _PAGE_BIT_UNUSED1 9 /* available for programmer */
20#define _PAGE_BIT_IOMAP 10 /* flag used to indicate IO mapping */ 20#define _PAGE_BIT_IOMAP 10 /* flag used to indicate IO mapping */
21#define _PAGE_BIT_UNUSED3 11 21#define _PAGE_BIT_HIDDEN 11 /* hidden by kmemcheck */
22#define _PAGE_BIT_PAT_LARGE 12 /* On 2MB or 1GB pages */ 22#define _PAGE_BIT_PAT_LARGE 12 /* On 2MB or 1GB pages */
23#define _PAGE_BIT_SPECIAL _PAGE_BIT_UNUSED1 23#define _PAGE_BIT_SPECIAL _PAGE_BIT_UNUSED1
24#define _PAGE_BIT_CPA_TEST _PAGE_BIT_UNUSED1 24#define _PAGE_BIT_CPA_TEST _PAGE_BIT_UNUSED1
@@ -41,13 +41,18 @@
41#define _PAGE_GLOBAL (_AT(pteval_t, 1) << _PAGE_BIT_GLOBAL) 41#define _PAGE_GLOBAL (_AT(pteval_t, 1) << _PAGE_BIT_GLOBAL)
42#define _PAGE_UNUSED1 (_AT(pteval_t, 1) << _PAGE_BIT_UNUSED1) 42#define _PAGE_UNUSED1 (_AT(pteval_t, 1) << _PAGE_BIT_UNUSED1)
43#define _PAGE_IOMAP (_AT(pteval_t, 1) << _PAGE_BIT_IOMAP) 43#define _PAGE_IOMAP (_AT(pteval_t, 1) << _PAGE_BIT_IOMAP)
44#define _PAGE_UNUSED3 (_AT(pteval_t, 1) << _PAGE_BIT_UNUSED3)
45#define _PAGE_PAT (_AT(pteval_t, 1) << _PAGE_BIT_PAT) 44#define _PAGE_PAT (_AT(pteval_t, 1) << _PAGE_BIT_PAT)
46#define _PAGE_PAT_LARGE (_AT(pteval_t, 1) << _PAGE_BIT_PAT_LARGE) 45#define _PAGE_PAT_LARGE (_AT(pteval_t, 1) << _PAGE_BIT_PAT_LARGE)
47#define _PAGE_SPECIAL (_AT(pteval_t, 1) << _PAGE_BIT_SPECIAL) 46#define _PAGE_SPECIAL (_AT(pteval_t, 1) << _PAGE_BIT_SPECIAL)
48#define _PAGE_CPA_TEST (_AT(pteval_t, 1) << _PAGE_BIT_CPA_TEST) 47#define _PAGE_CPA_TEST (_AT(pteval_t, 1) << _PAGE_BIT_CPA_TEST)
49#define __HAVE_ARCH_PTE_SPECIAL 48#define __HAVE_ARCH_PTE_SPECIAL
50 49
50#ifdef CONFIG_KMEMCHECK
51#define _PAGE_HIDDEN (_AT(pteval_t, 1) << _PAGE_BIT_HIDDEN)
52#else
53#define _PAGE_HIDDEN (_AT(pteval_t, 0))
54#endif
55
51#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE) 56#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
52#define _PAGE_NX (_AT(pteval_t, 1) << _PAGE_BIT_NX) 57#define _PAGE_NX (_AT(pteval_t, 1) << _PAGE_BIT_NX)
53#else 58#else
diff --git a/arch/x86/include/asm/string_32.h b/arch/x86/include/asm/string_32.h
index 0e0e3ba827f7..c86f452256de 100644
--- a/arch/x86/include/asm/string_32.h
+++ b/arch/x86/include/asm/string_32.h
@@ -177,10 +177,18 @@ static inline void *__memcpy3d(void *to, const void *from, size_t len)
177 * No 3D Now! 177 * No 3D Now!
178 */ 178 */
179 179
180#ifndef CONFIG_KMEMCHECK
180#define memcpy(t, f, n) \ 181#define memcpy(t, f, n) \
181 (__builtin_constant_p((n)) \ 182 (__builtin_constant_p((n)) \
182 ? __constant_memcpy((t), (f), (n)) \ 183 ? __constant_memcpy((t), (f), (n)) \
183 : __memcpy((t), (f), (n))) 184 : __memcpy((t), (f), (n)))
185#else
186/*
187 * kmemcheck becomes very happy if we use the REP instructions unconditionally,
188 * because it means that we know both memory operands in advance.
189 */
190#define memcpy(t, f, n) __memcpy((t), (f), (n))
191#endif
184 192
185#endif 193#endif
186 194
diff --git a/arch/x86/include/asm/string_64.h b/arch/x86/include/asm/string_64.h
index 2afe164bf1e6..19e2c468fc2c 100644
--- a/arch/x86/include/asm/string_64.h
+++ b/arch/x86/include/asm/string_64.h
@@ -27,6 +27,7 @@ static __always_inline void *__inline_memcpy(void *to, const void *from, size_t
27 function. */ 27 function. */
28 28
29#define __HAVE_ARCH_MEMCPY 1 29#define __HAVE_ARCH_MEMCPY 1
30#ifndef CONFIG_KMEMCHECK
30#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4 31#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4
31extern void *memcpy(void *to, const void *from, size_t len); 32extern void *memcpy(void *to, const void *from, size_t len);
32#else 33#else
@@ -42,6 +43,13 @@ extern void *__memcpy(void *to, const void *from, size_t len);
42 __ret; \ 43 __ret; \
43}) 44})
44#endif 45#endif
46#else
47/*
48 * kmemcheck becomes very happy if we use the REP instructions unconditionally,
49 * because it means that we know both memory operands in advance.
50 */
51#define memcpy(dst, src, len) __inline_memcpy((dst), (src), (len))
52#endif
45 53
46#define __HAVE_ARCH_MEMSET 54#define __HAVE_ARCH_MEMSET
47void *memset(void *s, int c, size_t n); 55void *memset(void *s, int c, size_t n);
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index 602c769fc98c..b0783520988b 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -154,9 +154,9 @@ struct thread_info {
154 154
155/* thread information allocation */ 155/* thread information allocation */
156#ifdef CONFIG_DEBUG_STACK_USAGE 156#ifdef CONFIG_DEBUG_STACK_USAGE
157#define THREAD_FLAGS (GFP_KERNEL | __GFP_ZERO) 157#define THREAD_FLAGS (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO)
158#else 158#else
159#define THREAD_FLAGS GFP_KERNEL 159#define THREAD_FLAGS (GFP_KERNEL | __GFP_NOTRACK)
160#endif 160#endif
161 161
162#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR 162#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
diff --git a/arch/x86/include/asm/timex.h b/arch/x86/include/asm/timex.h
index b5c9d45c981f..1375cfc93960 100644
--- a/arch/x86/include/asm/timex.h
+++ b/arch/x86/include/asm/timex.h
@@ -4,9 +4,7 @@
4#include <asm/processor.h> 4#include <asm/processor.h>
5#include <asm/tsc.h> 5#include <asm/tsc.h>
6 6
7/* The PIT ticks at this frequency (in HZ): */ 7/* Assume we use the PIT time source for the clock tick */
8#define PIT_TICK_RATE 1193182
9
10#define CLOCK_TICK_RATE PIT_TICK_RATE 8#define CLOCK_TICK_RATE PIT_TICK_RATE
11 9
12#define ARCH_HAS_READ_CURRENT_TIMER 10#define ARCH_HAS_READ_CURRENT_TIMER
diff --git a/arch/x86/include/asm/xor.h b/arch/x86/include/asm/xor.h
index 11b3bb86e17b..7fcf6f3dbcc3 100644
--- a/arch/x86/include/asm/xor.h
+++ b/arch/x86/include/asm/xor.h
@@ -1,5 +1,10 @@
1#ifdef CONFIG_KMEMCHECK
2/* kmemcheck doesn't handle MMX/SSE/SSE2 instructions */
3# include <asm-generic/xor.h>
4#else
1#ifdef CONFIG_X86_32 5#ifdef CONFIG_X86_32
2# include "xor_32.h" 6# include "xor_32.h"
3#else 7#else
4# include "xor_64.h" 8# include "xor_64.h"
5#endif 9#endif
10#endif
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 3ffdcfa9abdf..9fa33886c0d7 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -487,7 +487,6 @@ out:
487static void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c) 487static void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c)
488{ 488{
489 char *v = c->x86_vendor_id; 489 char *v = c->x86_vendor_id;
490 static int printed;
491 int i; 490 int i;
492 491
493 for (i = 0; i < X86_VENDOR_NUM; i++) { 492 for (i = 0; i < X86_VENDOR_NUM; i++) {
@@ -504,13 +503,9 @@ static void __cpuinit get_cpu_vendor(struct cpuinfo_x86 *c)
504 } 503 }
505 } 504 }
506 505
507 if (!printed) { 506 printk_once(KERN_ERR
508 printed++; 507 "CPU: vendor_id '%s' unknown, using generic init.\n" \
509 printk(KERN_ERR 508 "CPU: Your system may be unstable.\n", v);
510 "CPU: vendor_id '%s' unknown, using generic init.\n", v);
511
512 printk(KERN_ERR "CPU: Your system may be unstable.\n");
513 }
514 509
515 c->x86_vendor = X86_VENDOR_UNKNOWN; 510 c->x86_vendor = X86_VENDOR_UNKNOWN;
516 this_cpu = &default_cpu; 511 this_cpu = &default_cpu;
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index daed39ba2614..3260ab044996 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -86,6 +86,29 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
86 */ 86 */
87 if (c->x86 == 6 && c->x86_model < 15) 87 if (c->x86 == 6 && c->x86_model < 15)
88 clear_cpu_cap(c, X86_FEATURE_PAT); 88 clear_cpu_cap(c, X86_FEATURE_PAT);
89
90#ifdef CONFIG_KMEMCHECK
91 /*
92 * P4s have a "fast strings" feature which causes single-
93 * stepping REP instructions to only generate a #DB on
94 * cache-line boundaries.
95 *
96 * Ingo Molnar reported a Pentium D (model 6) and a Xeon
97 * (model 2) with the same problem.
98 */
99 if (c->x86 == 15) {
100 u64 misc_enable;
101
102 rdmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
103
104 if (misc_enable & MSR_IA32_MISC_ENABLE_FAST_STRING) {
105 printk(KERN_INFO "kmemcheck: Disabling fast string operations\n");
106
107 misc_enable &= ~MSR_IA32_MISC_ENABLE_FAST_STRING;
108 wrmsrl(MSR_IA32_MISC_ENABLE, misc_enable);
109 }
110 }
111#endif
89} 112}
90 113
91#ifdef CONFIG_X86_32 114#ifdef CONFIG_X86_32
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
index 2ac1f0c2beb3..b07af8861244 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
@@ -182,6 +182,11 @@ static struct notifier_block __refdata cpuid_class_cpu_notifier =
182 .notifier_call = cpuid_class_cpu_callback, 182 .notifier_call = cpuid_class_cpu_callback,
183}; 183};
184 184
185static char *cpuid_nodename(struct device *dev)
186{
187 return kasprintf(GFP_KERNEL, "cpu/%u/cpuid", MINOR(dev->devt));
188}
189
185static int __init cpuid_init(void) 190static int __init cpuid_init(void)
186{ 191{
187 int i, err = 0; 192 int i, err = 0;
@@ -198,6 +203,7 @@ static int __init cpuid_init(void)
198 err = PTR_ERR(cpuid_class); 203 err = PTR_ERR(cpuid_class);
199 goto out_chrdev; 204 goto out_chrdev;
200 } 205 }
206 cpuid_class->nodename = cpuid_nodename;
201 for_each_online_cpu(i) { 207 for_each_online_cpu(i) {
202 err = cpuid_device_create(i); 208 err = cpuid_device_create(i);
203 if (err != 0) 209 if (err != 0)
diff --git a/arch/x86/kernel/i8253.c b/arch/x86/kernel/i8253.c
index c2e0bb0890d4..5cf36c053ac4 100644
--- a/arch/x86/kernel/i8253.c
+++ b/arch/x86/kernel/i8253.c
@@ -7,6 +7,7 @@
7#include <linux/spinlock.h> 7#include <linux/spinlock.h>
8#include <linux/jiffies.h> 8#include <linux/jiffies.h>
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/timex.h>
10#include <linux/delay.h> 11#include <linux/delay.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/io.h> 13#include <linux/io.h>
diff --git a/arch/x86/kernel/init_task.c b/arch/x86/kernel/init_task.c
index df3bf269beab..270ff83efc11 100644
--- a/arch/x86/kernel/init_task.c
+++ b/arch/x86/kernel/init_task.c
@@ -12,7 +12,6 @@
12 12
13static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 13static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
14static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 14static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
15struct mm_struct init_mm = INIT_MM(init_mm);
16 15
17/* 16/*
18 * Initial thread structure. 17 * Initial thread structure.
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index 9c4461501fcb..9371448290ac 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -236,6 +236,7 @@ static const struct file_operations microcode_fops = {
236static struct miscdevice microcode_dev = { 236static struct miscdevice microcode_dev = {
237 .minor = MICROCODE_MINOR, 237 .minor = MICROCODE_MINOR,
238 .name = "microcode", 238 .name = "microcode",
239 .devnode = "cpu/microcode",
239 .fops = &microcode_fops, 240 .fops = &microcode_fops,
240}; 241};
241 242
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index 3cf3413ec626..98fd6cd4e3a4 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -196,6 +196,11 @@ static struct notifier_block __refdata msr_class_cpu_notifier = {
196 .notifier_call = msr_class_cpu_callback, 196 .notifier_call = msr_class_cpu_callback,
197}; 197};
198 198
199static char *msr_nodename(struct device *dev)
200{
201 return kasprintf(GFP_KERNEL, "cpu/%u/msr", MINOR(dev->devt));
202}
203
199static int __init msr_init(void) 204static int __init msr_init(void)
200{ 205{
201 int i, err = 0; 206 int i, err = 0;
@@ -212,6 +217,7 @@ static int __init msr_init(void)
212 err = PTR_ERR(msr_class); 217 err = PTR_ERR(msr_class);
213 goto out_chrdev; 218 goto out_chrdev;
214 } 219 }
220 msr_class->nodename = msr_nodename;
215 for_each_online_cpu(i) { 221 for_each_online_cpu(i) {
216 err = msr_device_create(i); 222 err = msr_device_create(i);
217 if (err != 0) 223 if (err != 0)
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 3bb2be1649bd..994dd6a4a2a0 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -63,7 +63,7 @@ void arch_task_cache_init(void)
63 task_xstate_cachep = 63 task_xstate_cachep =
64 kmem_cache_create("task_xstate", xstate_size, 64 kmem_cache_create("task_xstate", xstate_size,
65 __alignof__(union thread_xstate), 65 __alignof__(union thread_xstate),
66 SLAB_PANIC, NULL); 66 SLAB_PANIC | SLAB_NOTRACK, NULL);
67} 67}
68 68
69/* 69/*
diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c
index 4aaf7e48394f..c3eb207181fe 100644
--- a/arch/x86/kernel/stacktrace.c
+++ b/arch/x86/kernel/stacktrace.c
@@ -77,6 +77,13 @@ void save_stack_trace(struct stack_trace *trace)
77} 77}
78EXPORT_SYMBOL_GPL(save_stack_trace); 78EXPORT_SYMBOL_GPL(save_stack_trace);
79 79
80void save_stack_trace_bp(struct stack_trace *trace, unsigned long bp)
81{
82 dump_trace(current, NULL, NULL, bp, &save_stack_ops, trace);
83 if (trace->nr_entries < trace->max_entries)
84 trace->entries[trace->nr_entries++] = ULONG_MAX;
85}
86
80void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) 87void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
81{ 88{
82 dump_trace(tsk, NULL, NULL, 0, &save_stack_ops_nosched, trace); 89 dump_trace(tsk, NULL, NULL, 0, &save_stack_ops_nosched, trace);
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 1e1e27b7d438..5f935f0d5861 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -45,6 +45,7 @@
45#include <linux/edac.h> 45#include <linux/edac.h>
46#endif 46#endif
47 47
48#include <asm/kmemcheck.h>
48#include <asm/stacktrace.h> 49#include <asm/stacktrace.h>
49#include <asm/processor.h> 50#include <asm/processor.h>
50#include <asm/debugreg.h> 51#include <asm/debugreg.h>
@@ -534,6 +535,10 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
534 535
535 get_debugreg(condition, 6); 536 get_debugreg(condition, 6);
536 537
538 /* Catch kmemcheck conditions first of all! */
539 if (condition & DR_STEP && kmemcheck_trap(regs))
540 return;
541
537 /* 542 /*
538 * The processor cleared BTF, so don't mark that we need it set. 543 * The processor cleared BTF, so don't mark that we need it set.
539 */ 544 */
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 3e1c057e98fe..ae3180c506a6 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -9,6 +9,7 @@
9#include <linux/delay.h> 9#include <linux/delay.h>
10#include <linux/clocksource.h> 10#include <linux/clocksource.h>
11#include <linux/percpu.h> 11#include <linux/percpu.h>
12#include <linux/timex.h>
12 13
13#include <asm/hpet.h> 14#include <asm/hpet.h>
14#include <asm/timer.h> 15#include <asm/timer.h>
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 32d6ae8fb60e..e770bf349ec4 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -1277,7 +1277,7 @@ static struct vmcs *alloc_vmcs_cpu(int cpu)
1277 struct page *pages; 1277 struct page *pages;
1278 struct vmcs *vmcs; 1278 struct vmcs *vmcs;
1279 1279
1280 pages = alloc_pages_node(node, GFP_KERNEL, vmcs_config.order); 1280 pages = alloc_pages_exact_node(node, GFP_KERNEL, vmcs_config.order);
1281 if (!pages) 1281 if (!pages)
1282 return NULL; 1282 return NULL;
1283 vmcs = page_address(pages); 1283 vmcs = page_address(pages);
diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile
index fdd30d08ab52..eefdeee8a871 100644
--- a/arch/x86/mm/Makefile
+++ b/arch/x86/mm/Makefile
@@ -10,6 +10,8 @@ obj-$(CONFIG_X86_PTDUMP) += dump_pagetables.o
10 10
11obj-$(CONFIG_HIGHMEM) += highmem_32.o 11obj-$(CONFIG_HIGHMEM) += highmem_32.o
12 12
13obj-$(CONFIG_KMEMCHECK) += kmemcheck/
14
13obj-$(CONFIG_MMIOTRACE) += mmiotrace.o 15obj-$(CONFIG_MMIOTRACE) += mmiotrace.o
14mmiotrace-y := kmmio.o pf_in.o mmio-mod.o 16mmiotrace-y := kmmio.o pf_in.o mmio-mod.o
15obj-$(CONFIG_MMIOTRACE_TEST) += testmmiotrace.o 17obj-$(CONFIG_MMIOTRACE_TEST) += testmmiotrace.o
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index c6acc6326374..baa0e86adfbc 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -14,6 +14,7 @@
14 14
15#include <asm/traps.h> /* dotraplinkage, ... */ 15#include <asm/traps.h> /* dotraplinkage, ... */
16#include <asm/pgalloc.h> /* pgd_*(), ... */ 16#include <asm/pgalloc.h> /* pgd_*(), ... */
17#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */
17 18
18/* 19/*
19 * Page fault error code bits: 20 * Page fault error code bits:
@@ -956,6 +957,13 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code)
956 /* Get the faulting address: */ 957 /* Get the faulting address: */
957 address = read_cr2(); 958 address = read_cr2();
958 959
960 /*
961 * Detect and handle instructions that would cause a page fault for
962 * both a tracked kernel page and a userspace page.
963 */
964 if (kmemcheck_active(regs))
965 kmemcheck_hide(regs);
966
959 if (unlikely(kmmio_fault(regs, address))) 967 if (unlikely(kmmio_fault(regs, address)))
960 return; 968 return;
961 969
@@ -973,9 +981,13 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code)
973 * protection error (error_code & 9) == 0. 981 * protection error (error_code & 9) == 0.
974 */ 982 */
975 if (unlikely(fault_in_kernel_space(address))) { 983 if (unlikely(fault_in_kernel_space(address))) {
976 if (!(error_code & (PF_RSVD|PF_USER|PF_PROT)) && 984 if (!(error_code & (PF_RSVD | PF_USER | PF_PROT))) {
977 vmalloc_fault(address) >= 0) 985 if (vmalloc_fault(address) >= 0)
978 return; 986 return;
987
988 if (kmemcheck_fault(regs, address, error_code))
989 return;
990 }
979 991
980 /* Can handle a stale RO->RW TLB: */ 992 /* Can handle a stale RO->RW TLB: */
981 if (spurious_fault(error_code, address)) 993 if (spurious_fault(error_code, address))
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 34c1bfb64f1c..f53b57e4086f 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -213,7 +213,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
213 if (!after_bootmem) 213 if (!after_bootmem)
214 init_gbpages(); 214 init_gbpages();
215 215
216#ifdef CONFIG_DEBUG_PAGEALLOC 216#if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KMEMCHECK)
217 /* 217 /*
218 * For CONFIG_DEBUG_PAGEALLOC, identity mapping will use small pages. 218 * For CONFIG_DEBUG_PAGEALLOC, identity mapping will use small pages.
219 * This will simplify cpa(), which otherwise needs to support splitting 219 * This will simplify cpa(), which otherwise needs to support splitting
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 9ff3c0816d15..3cd7711bb949 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -111,7 +111,7 @@ static pte_t * __init one_page_table_init(pmd_t *pmd)
111 pte_t *page_table = NULL; 111 pte_t *page_table = NULL;
112 112
113 if (after_bootmem) { 113 if (after_bootmem) {
114#ifdef CONFIG_DEBUG_PAGEALLOC 114#if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KMEMCHECK)
115 page_table = (pte_t *) alloc_bootmem_pages(PAGE_SIZE); 115 page_table = (pte_t *) alloc_bootmem_pages(PAGE_SIZE);
116#endif 116#endif
117 if (!page_table) 117 if (!page_table)
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 52bb9519bb86..9c543290a813 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -104,7 +104,7 @@ static __ref void *spp_getpage(void)
104 void *ptr; 104 void *ptr;
105 105
106 if (after_bootmem) 106 if (after_bootmem)
107 ptr = (void *) get_zeroed_page(GFP_ATOMIC); 107 ptr = (void *) get_zeroed_page(GFP_ATOMIC | __GFP_NOTRACK);
108 else 108 else
109 ptr = alloc_bootmem_pages(PAGE_SIZE); 109 ptr = alloc_bootmem_pages(PAGE_SIZE);
110 110
@@ -281,7 +281,7 @@ static __ref void *alloc_low_page(unsigned long *phys)
281 void *adr; 281 void *adr;
282 282
283 if (after_bootmem) { 283 if (after_bootmem) {
284 adr = (void *)get_zeroed_page(GFP_ATOMIC); 284 adr = (void *)get_zeroed_page(GFP_ATOMIC | __GFP_NOTRACK);
285 *phys = __pa(adr); 285 *phys = __pa(adr);
286 286
287 return adr; 287 return adr;
diff --git a/arch/x86/mm/kmemcheck/Makefile b/arch/x86/mm/kmemcheck/Makefile
new file mode 100644
index 000000000000..520b3bce4095
--- /dev/null
+++ b/arch/x86/mm/kmemcheck/Makefile
@@ -0,0 +1 @@
obj-y := error.o kmemcheck.o opcode.o pte.o selftest.o shadow.o
diff --git a/arch/x86/mm/kmemcheck/error.c b/arch/x86/mm/kmemcheck/error.c
new file mode 100644
index 000000000000..4901d0dafda6
--- /dev/null
+++ b/arch/x86/mm/kmemcheck/error.c
@@ -0,0 +1,228 @@
1#include <linux/interrupt.h>
2#include <linux/kdebug.h>
3#include <linux/kmemcheck.h>
4#include <linux/kernel.h>
5#include <linux/types.h>
6#include <linux/ptrace.h>
7#include <linux/stacktrace.h>
8#include <linux/string.h>
9
10#include "error.h"
11#include "shadow.h"
12
13enum kmemcheck_error_type {
14 KMEMCHECK_ERROR_INVALID_ACCESS,
15 KMEMCHECK_ERROR_BUG,
16};
17
18#define SHADOW_COPY_SIZE (1 << CONFIG_KMEMCHECK_SHADOW_COPY_SHIFT)
19
20struct kmemcheck_error {
21 enum kmemcheck_error_type type;
22
23 union {
24 /* KMEMCHECK_ERROR_INVALID_ACCESS */
25 struct {
26 /* Kind of access that caused the error */
27 enum kmemcheck_shadow state;
28 /* Address and size of the erroneous read */
29 unsigned long address;
30 unsigned int size;
31 };
32 };
33
34 struct pt_regs regs;
35 struct stack_trace trace;
36 unsigned long trace_entries[32];
37
38 /* We compress it to a char. */
39 unsigned char shadow_copy[SHADOW_COPY_SIZE];
40 unsigned char memory_copy[SHADOW_COPY_SIZE];
41};
42
43/*
44 * Create a ring queue of errors to output. We can't call printk() directly
45 * from the kmemcheck traps, since this may call the console drivers and
46 * result in a recursive fault.
47 */
48static struct kmemcheck_error error_fifo[CONFIG_KMEMCHECK_QUEUE_SIZE];
49static unsigned int error_count;
50static unsigned int error_rd;
51static unsigned int error_wr;
52static unsigned int error_missed_count;
53
54static struct kmemcheck_error *error_next_wr(void)
55{
56 struct kmemcheck_error *e;
57
58 if (error_count == ARRAY_SIZE(error_fifo)) {
59 ++error_missed_count;
60 return NULL;
61 }
62
63 e = &error_fifo[error_wr];
64 if (++error_wr == ARRAY_SIZE(error_fifo))
65 error_wr = 0;
66 ++error_count;
67 return e;
68}
69
70static struct kmemcheck_error *error_next_rd(void)
71{
72 struct kmemcheck_error *e;
73
74 if (error_count == 0)
75 return NULL;
76
77 e = &error_fifo[error_rd];
78 if (++error_rd == ARRAY_SIZE(error_fifo))
79 error_rd = 0;
80 --error_count;
81 return e;
82}
83
84void kmemcheck_error_recall(void)
85{
86 static const char *desc[] = {
87 [KMEMCHECK_SHADOW_UNALLOCATED] = "unallocated",
88 [KMEMCHECK_SHADOW_UNINITIALIZED] = "uninitialized",
89 [KMEMCHECK_SHADOW_INITIALIZED] = "initialized",
90 [KMEMCHECK_SHADOW_FREED] = "freed",
91 };
92
93 static const char short_desc[] = {
94 [KMEMCHECK_SHADOW_UNALLOCATED] = 'a',
95 [KMEMCHECK_SHADOW_UNINITIALIZED] = 'u',
96 [KMEMCHECK_SHADOW_INITIALIZED] = 'i',
97 [KMEMCHECK_SHADOW_FREED] = 'f',
98 };
99
100 struct kmemcheck_error *e;
101 unsigned int i;
102
103 e = error_next_rd();
104 if (!e)
105 return;
106
107 switch (e->type) {
108 case KMEMCHECK_ERROR_INVALID_ACCESS:
109 printk(KERN_ERR "WARNING: kmemcheck: Caught %d-bit read "
110 "from %s memory (%p)\n",
111 8 * e->size, e->state < ARRAY_SIZE(desc) ?
112 desc[e->state] : "(invalid shadow state)",
113 (void *) e->address);
114
115 printk(KERN_INFO);
116 for (i = 0; i < SHADOW_COPY_SIZE; ++i)
117 printk("%02x", e->memory_copy[i]);
118 printk("\n");
119
120 printk(KERN_INFO);
121 for (i = 0; i < SHADOW_COPY_SIZE; ++i) {
122 if (e->shadow_copy[i] < ARRAY_SIZE(short_desc))
123 printk(" %c", short_desc[e->shadow_copy[i]]);
124 else
125 printk(" ?");
126 }
127 printk("\n");
128 printk(KERN_INFO "%*c\n", 2 + 2
129 * (int) (e->address & (SHADOW_COPY_SIZE - 1)), '^');
130 break;
131 case KMEMCHECK_ERROR_BUG:
132 printk(KERN_EMERG "ERROR: kmemcheck: Fatal error\n");
133 break;
134 }
135
136 __show_regs(&e->regs, 1);
137 print_stack_trace(&e->trace, 0);
138}
139
140static void do_wakeup(unsigned long data)
141{
142 while (error_count > 0)
143 kmemcheck_error_recall();
144
145 if (error_missed_count > 0) {
146 printk(KERN_WARNING "kmemcheck: Lost %d error reports because "
147 "the queue was too small\n", error_missed_count);
148 error_missed_count = 0;
149 }
150}
151
152static DECLARE_TASKLET(kmemcheck_tasklet, &do_wakeup, 0);
153
154/*
155 * Save the context of an error report.
156 */
157void kmemcheck_error_save(enum kmemcheck_shadow state,
158 unsigned long address, unsigned int size, struct pt_regs *regs)
159{
160 static unsigned long prev_ip;
161
162 struct kmemcheck_error *e;
163 void *shadow_copy;
164 void *memory_copy;
165
166 /* Don't report several adjacent errors from the same EIP. */
167 if (regs->ip == prev_ip)
168 return;
169 prev_ip = regs->ip;
170
171 e = error_next_wr();
172 if (!e)
173 return;
174
175 e->type = KMEMCHECK_ERROR_INVALID_ACCESS;
176
177 e->state = state;
178 e->address = address;
179 e->size = size;
180
181 /* Save regs */
182 memcpy(&e->regs, regs, sizeof(*regs));
183
184 /* Save stack trace */
185 e->trace.nr_entries = 0;
186 e->trace.entries = e->trace_entries;
187 e->trace.max_entries = ARRAY_SIZE(e->trace_entries);
188 e->trace.skip = 0;
189 save_stack_trace_bp(&e->trace, regs->bp);
190
191 /* Round address down to nearest 16 bytes */
192 shadow_copy = kmemcheck_shadow_lookup(address
193 & ~(SHADOW_COPY_SIZE - 1));
194 BUG_ON(!shadow_copy);
195
196 memcpy(e->shadow_copy, shadow_copy, SHADOW_COPY_SIZE);
197
198 kmemcheck_show_addr(address);
199 memory_copy = (void *) (address & ~(SHADOW_COPY_SIZE - 1));
200 memcpy(e->memory_copy, memory_copy, SHADOW_COPY_SIZE);
201 kmemcheck_hide_addr(address);
202
203 tasklet_hi_schedule_first(&kmemcheck_tasklet);
204}
205
206/*
207 * Save the context of a kmemcheck bug.
208 */
209void kmemcheck_error_save_bug(struct pt_regs *regs)
210{
211 struct kmemcheck_error *e;
212
213 e = error_next_wr();
214 if (!e)
215 return;
216
217 e->type = KMEMCHECK_ERROR_BUG;
218
219 memcpy(&e->regs, regs, sizeof(*regs));
220
221 e->trace.nr_entries = 0;
222 e->trace.entries = e->trace_entries;
223 e->trace.max_entries = ARRAY_SIZE(e->trace_entries);
224 e->trace.skip = 1;
225 save_stack_trace(&e->trace);
226
227 tasklet_hi_schedule_first(&kmemcheck_tasklet);
228}
diff --git a/arch/x86/mm/kmemcheck/error.h b/arch/x86/mm/kmemcheck/error.h
new file mode 100644
index 000000000000..0efc2e8d0a20
--- /dev/null
+++ b/arch/x86/mm/kmemcheck/error.h
@@ -0,0 +1,15 @@
1#ifndef ARCH__X86__MM__KMEMCHECK__ERROR_H
2#define ARCH__X86__MM__KMEMCHECK__ERROR_H
3
4#include <linux/ptrace.h>
5
6#include "shadow.h"
7
8void kmemcheck_error_save(enum kmemcheck_shadow state,
9 unsigned long address, unsigned int size, struct pt_regs *regs);
10
11void kmemcheck_error_save_bug(struct pt_regs *regs);
12
13void kmemcheck_error_recall(void);
14
15#endif
diff --git a/arch/x86/mm/kmemcheck/kmemcheck.c b/arch/x86/mm/kmemcheck/kmemcheck.c
new file mode 100644
index 000000000000..2c55ed098654
--- /dev/null
+++ b/arch/x86/mm/kmemcheck/kmemcheck.c
@@ -0,0 +1,640 @@
1/**
2 * kmemcheck - a heavyweight memory checker for the linux kernel
3 * Copyright (C) 2007, 2008 Vegard Nossum <vegardno@ifi.uio.no>
4 * (With a lot of help from Ingo Molnar and Pekka Enberg.)
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License (version 2) as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/init.h>
12#include <linux/interrupt.h>
13#include <linux/kallsyms.h>
14#include <linux/kernel.h>
15#include <linux/kmemcheck.h>
16#include <linux/mm.h>
17#include <linux/module.h>
18#include <linux/page-flags.h>
19#include <linux/percpu.h>
20#include <linux/ptrace.h>
21#include <linux/string.h>
22#include <linux/types.h>
23
24#include <asm/cacheflush.h>
25#include <asm/kmemcheck.h>
26#include <asm/pgtable.h>
27#include <asm/tlbflush.h>
28
29#include "error.h"
30#include "opcode.h"
31#include "pte.h"
32#include "selftest.h"
33#include "shadow.h"
34
35
36#ifdef CONFIG_KMEMCHECK_DISABLED_BY_DEFAULT
37# define KMEMCHECK_ENABLED 0
38#endif
39
40#ifdef CONFIG_KMEMCHECK_ENABLED_BY_DEFAULT
41# define KMEMCHECK_ENABLED 1
42#endif
43
44#ifdef CONFIG_KMEMCHECK_ONESHOT_BY_DEFAULT
45# define KMEMCHECK_ENABLED 2
46#endif
47
48int kmemcheck_enabled = KMEMCHECK_ENABLED;
49
50int __init kmemcheck_init(void)
51{
52#ifdef CONFIG_SMP
53 /*
54 * Limit SMP to use a single CPU. We rely on the fact that this code
55 * runs before SMP is set up.
56 */
57 if (setup_max_cpus > 1) {
58 printk(KERN_INFO
59 "kmemcheck: Limiting number of CPUs to 1.\n");
60 setup_max_cpus = 1;
61 }
62#endif
63
64 if (!kmemcheck_selftest()) {
65 printk(KERN_INFO "kmemcheck: self-tests failed; disabling\n");
66 kmemcheck_enabled = 0;
67 return -EINVAL;
68 }
69
70 printk(KERN_INFO "kmemcheck: Initialized\n");
71 return 0;
72}
73
74early_initcall(kmemcheck_init);
75
76/*
77 * We need to parse the kmemcheck= option before any memory is allocated.
78 */
79static int __init param_kmemcheck(char *str)
80{
81 if (!str)
82 return -EINVAL;
83
84 sscanf(str, "%d", &kmemcheck_enabled);
85 return 0;
86}
87
88early_param("kmemcheck", param_kmemcheck);
89
90int kmemcheck_show_addr(unsigned long address)
91{
92 pte_t *pte;
93
94 pte = kmemcheck_pte_lookup(address);
95 if (!pte)
96 return 0;
97
98 set_pte(pte, __pte(pte_val(*pte) | _PAGE_PRESENT));
99 __flush_tlb_one(address);
100 return 1;
101}
102
103int kmemcheck_hide_addr(unsigned long address)
104{
105 pte_t *pte;
106
107 pte = kmemcheck_pte_lookup(address);
108 if (!pte)
109 return 0;
110
111 set_pte(pte, __pte(pte_val(*pte) & ~_PAGE_PRESENT));
112 __flush_tlb_one(address);
113 return 1;
114}
115
116struct kmemcheck_context {
117 bool busy;
118 int balance;
119
120 /*
121 * There can be at most two memory operands to an instruction, but
122 * each address can cross a page boundary -- so we may need up to
123 * four addresses that must be hidden/revealed for each fault.
124 */
125 unsigned long addr[4];
126 unsigned long n_addrs;
127 unsigned long flags;
128
129 /* Data size of the instruction that caused a fault. */
130 unsigned int size;
131};
132
133static DEFINE_PER_CPU(struct kmemcheck_context, kmemcheck_context);
134
135bool kmemcheck_active(struct pt_regs *regs)
136{
137 struct kmemcheck_context *data = &__get_cpu_var(kmemcheck_context);
138
139 return data->balance > 0;
140}
141
142/* Save an address that needs to be shown/hidden */
143static void kmemcheck_save_addr(unsigned long addr)
144{
145 struct kmemcheck_context *data = &__get_cpu_var(kmemcheck_context);
146
147 BUG_ON(data->n_addrs >= ARRAY_SIZE(data->addr));
148 data->addr[data->n_addrs++] = addr;
149}
150
151static unsigned int kmemcheck_show_all(void)
152{
153 struct kmemcheck_context *data = &__get_cpu_var(kmemcheck_context);
154 unsigned int i;
155 unsigned int n;
156
157 n = 0;
158 for (i = 0; i < data->n_addrs; ++i)
159 n += kmemcheck_show_addr(data->addr[i]);
160
161 return n;
162}
163
164static unsigned int kmemcheck_hide_all(void)
165{
166 struct kmemcheck_context *data = &__get_cpu_var(kmemcheck_context);
167 unsigned int i;
168 unsigned int n;
169
170 n = 0;
171 for (i = 0; i < data->n_addrs; ++i)
172 n += kmemcheck_hide_addr(data->addr[i]);
173
174 return n;
175}
176
177/*
178 * Called from the #PF handler.
179 */
180void kmemcheck_show(struct pt_regs *regs)
181{
182 struct kmemcheck_context *data = &__get_cpu_var(kmemcheck_context);
183
184 BUG_ON(!irqs_disabled());
185
186 if (unlikely(data->balance != 0)) {
187 kmemcheck_show_all();
188 kmemcheck_error_save_bug(regs);
189 data->balance = 0;
190 return;
191 }
192
193 /*
194 * None of the addresses actually belonged to kmemcheck. Note that
195 * this is not an error.
196 */
197 if (kmemcheck_show_all() == 0)
198 return;
199
200 ++data->balance;
201
202 /*
203 * The IF needs to be cleared as well, so that the faulting
204 * instruction can run "uninterrupted". Otherwise, we might take
205 * an interrupt and start executing that before we've had a chance
206 * to hide the page again.
207 *
208 * NOTE: In the rare case of multiple faults, we must not override
209 * the original flags:
210 */
211 if (!(regs->flags & X86_EFLAGS_TF))
212 data->flags = regs->flags;
213
214 regs->flags |= X86_EFLAGS_TF;
215 regs->flags &= ~X86_EFLAGS_IF;
216}
217
218/*
219 * Called from the #DB handler.
220 */
221void kmemcheck_hide(struct pt_regs *regs)
222{
223 struct kmemcheck_context *data = &__get_cpu_var(kmemcheck_context);
224 int n;
225
226 BUG_ON(!irqs_disabled());
227
228 if (data->balance == 0)
229 return;
230
231 if (unlikely(data->balance != 1)) {
232 kmemcheck_show_all();
233 kmemcheck_error_save_bug(regs);
234 data->n_addrs = 0;
235 data->balance = 0;
236
237 if (!(data->flags & X86_EFLAGS_TF))
238 regs->flags &= ~X86_EFLAGS_TF;
239 if (data->flags & X86_EFLAGS_IF)
240 regs->flags |= X86_EFLAGS_IF;
241 return;
242 }
243
244 if (kmemcheck_enabled)
245 n = kmemcheck_hide_all();
246 else
247 n = kmemcheck_show_all();
248
249 if (n == 0)
250 return;
251
252 --data->balance;
253
254 data->n_addrs = 0;
255
256 if (!(data->flags & X86_EFLAGS_TF))
257 regs->flags &= ~X86_EFLAGS_TF;
258 if (data->flags & X86_EFLAGS_IF)
259 regs->flags |= X86_EFLAGS_IF;
260}
261
262void kmemcheck_show_pages(struct page *p, unsigned int n)
263{
264 unsigned int i;
265
266 for (i = 0; i < n; ++i) {
267 unsigned long address;
268 pte_t *pte;
269 unsigned int level;
270
271 address = (unsigned long) page_address(&p[i]);
272 pte = lookup_address(address, &level);
273 BUG_ON(!pte);
274 BUG_ON(level != PG_LEVEL_4K);
275
276 set_pte(pte, __pte(pte_val(*pte) | _PAGE_PRESENT));
277 set_pte(pte, __pte(pte_val(*pte) & ~_PAGE_HIDDEN));
278 __flush_tlb_one(address);
279 }
280}
281
282bool kmemcheck_page_is_tracked(struct page *p)
283{
284 /* This will also check the "hidden" flag of the PTE. */
285 return kmemcheck_pte_lookup((unsigned long) page_address(p));
286}
287
288void kmemcheck_hide_pages(struct page *p, unsigned int n)
289{
290 unsigned int i;
291
292 for (i = 0; i < n; ++i) {
293 unsigned long address;
294 pte_t *pte;
295 unsigned int level;
296
297 address = (unsigned long) page_address(&p[i]);
298 pte = lookup_address(address, &level);
299 BUG_ON(!pte);
300 BUG_ON(level != PG_LEVEL_4K);
301
302 set_pte(pte, __pte(pte_val(*pte) & ~_PAGE_PRESENT));
303 set_pte(pte, __pte(pte_val(*pte) | _PAGE_HIDDEN));
304 __flush_tlb_one(address);
305 }
306}
307
308/* Access may NOT cross page boundary */
309static void kmemcheck_read_strict(struct pt_regs *regs,
310 unsigned long addr, unsigned int size)
311{
312 void *shadow;
313 enum kmemcheck_shadow status;
314
315 shadow = kmemcheck_shadow_lookup(addr);
316 if (!shadow)
317 return;
318
319 kmemcheck_save_addr(addr);
320 status = kmemcheck_shadow_test(shadow, size);
321 if (status == KMEMCHECK_SHADOW_INITIALIZED)
322 return;
323
324 if (kmemcheck_enabled)
325 kmemcheck_error_save(status, addr, size, regs);
326
327 if (kmemcheck_enabled == 2)
328 kmemcheck_enabled = 0;
329
330 /* Don't warn about it again. */
331 kmemcheck_shadow_set(shadow, size);
332}
333
334/* Access may cross page boundary */
335static void kmemcheck_read(struct pt_regs *regs,
336 unsigned long addr, unsigned int size)
337{
338 unsigned long page = addr & PAGE_MASK;
339 unsigned long next_addr = addr + size - 1;
340 unsigned long next_page = next_addr & PAGE_MASK;
341
342 if (likely(page == next_page)) {
343 kmemcheck_read_strict(regs, addr, size);
344 return;
345 }
346
347 /*
348 * What we do is basically to split the access across the
349 * two pages and handle each part separately. Yes, this means
350 * that we may now see reads that are 3 + 5 bytes, for
351 * example (and if both are uninitialized, there will be two
352 * reports), but it makes the code a lot simpler.
353 */
354 kmemcheck_read_strict(regs, addr, next_page - addr);
355 kmemcheck_read_strict(regs, next_page, next_addr - next_page);
356}
357
358static void kmemcheck_write_strict(struct pt_regs *regs,
359 unsigned long addr, unsigned int size)
360{
361 void *shadow;
362
363 shadow = kmemcheck_shadow_lookup(addr);
364 if (!shadow)
365 return;
366
367 kmemcheck_save_addr(addr);
368 kmemcheck_shadow_set(shadow, size);
369}
370
371static void kmemcheck_write(struct pt_regs *regs,
372 unsigned long addr, unsigned int size)
373{
374 unsigned long page = addr & PAGE_MASK;
375 unsigned long next_addr = addr + size - 1;
376 unsigned long next_page = next_addr & PAGE_MASK;
377
378 if (likely(page == next_page)) {
379 kmemcheck_write_strict(regs, addr, size);
380 return;
381 }
382
383 /* See comment in kmemcheck_read(). */
384 kmemcheck_write_strict(regs, addr, next_page - addr);
385 kmemcheck_write_strict(regs, next_page, next_addr - next_page);
386}
387
388/*
389 * Copying is hard. We have two addresses, each of which may be split across
390 * a page (and each page will have different shadow addresses).
391 */
392static void kmemcheck_copy(struct pt_regs *regs,
393 unsigned long src_addr, unsigned long dst_addr, unsigned int size)
394{
395 uint8_t shadow[8];
396 enum kmemcheck_shadow status;
397
398 unsigned long page;
399 unsigned long next_addr;
400 unsigned long next_page;
401
402 uint8_t *x;
403 unsigned int i;
404 unsigned int n;
405
406 BUG_ON(size > sizeof(shadow));
407
408 page = src_addr & PAGE_MASK;
409 next_addr = src_addr + size - 1;
410 next_page = next_addr & PAGE_MASK;
411
412 if (likely(page == next_page)) {
413 /* Same page */
414 x = kmemcheck_shadow_lookup(src_addr);
415 if (x) {
416 kmemcheck_save_addr(src_addr);
417 for (i = 0; i < size; ++i)
418 shadow[i] = x[i];
419 } else {
420 for (i = 0; i < size; ++i)
421 shadow[i] = KMEMCHECK_SHADOW_INITIALIZED;
422 }
423 } else {
424 n = next_page - src_addr;
425 BUG_ON(n > sizeof(shadow));
426
427 /* First page */
428 x = kmemcheck_shadow_lookup(src_addr);
429 if (x) {
430 kmemcheck_save_addr(src_addr);
431 for (i = 0; i < n; ++i)
432 shadow[i] = x[i];
433 } else {
434 /* Not tracked */
435 for (i = 0; i < n; ++i)
436 shadow[i] = KMEMCHECK_SHADOW_INITIALIZED;
437 }
438
439 /* Second page */
440 x = kmemcheck_shadow_lookup(next_page);
441 if (x) {
442 kmemcheck_save_addr(next_page);
443 for (i = n; i < size; ++i)
444 shadow[i] = x[i - n];
445 } else {
446 /* Not tracked */
447 for (i = n; i < size; ++i)
448 shadow[i] = KMEMCHECK_SHADOW_INITIALIZED;
449 }
450 }
451
452 page = dst_addr & PAGE_MASK;
453 next_addr = dst_addr + size - 1;
454 next_page = next_addr & PAGE_MASK;
455
456 if (likely(page == next_page)) {
457 /* Same page */
458 x = kmemcheck_shadow_lookup(dst_addr);
459 if (x) {
460 kmemcheck_save_addr(dst_addr);
461 for (i = 0; i < size; ++i) {
462 x[i] = shadow[i];
463 shadow[i] = KMEMCHECK_SHADOW_INITIALIZED;
464 }
465 }
466 } else {
467 n = next_page - dst_addr;
468 BUG_ON(n > sizeof(shadow));
469
470 /* First page */
471 x = kmemcheck_shadow_lookup(dst_addr);
472 if (x) {
473 kmemcheck_save_addr(dst_addr);
474 for (i = 0; i < n; ++i) {
475 x[i] = shadow[i];
476 shadow[i] = KMEMCHECK_SHADOW_INITIALIZED;
477 }
478 }
479
480 /* Second page */
481 x = kmemcheck_shadow_lookup(next_page);
482 if (x) {
483 kmemcheck_save_addr(next_page);
484 for (i = n; i < size; ++i) {
485 x[i - n] = shadow[i];
486 shadow[i] = KMEMCHECK_SHADOW_INITIALIZED;
487 }
488 }
489 }
490
491 status = kmemcheck_shadow_test(shadow, size);
492 if (status == KMEMCHECK_SHADOW_INITIALIZED)
493 return;
494
495 if (kmemcheck_enabled)
496 kmemcheck_error_save(status, src_addr, size, regs);
497
498 if (kmemcheck_enabled == 2)
499 kmemcheck_enabled = 0;
500}
501
502enum kmemcheck_method {
503 KMEMCHECK_READ,
504 KMEMCHECK_WRITE,
505};
506
507static void kmemcheck_access(struct pt_regs *regs,
508 unsigned long fallback_address, enum kmemcheck_method fallback_method)
509{
510 const uint8_t *insn;
511 const uint8_t *insn_primary;
512 unsigned int size;
513
514 struct kmemcheck_context *data = &__get_cpu_var(kmemcheck_context);
515
516 /* Recursive fault -- ouch. */
517 if (data->busy) {
518 kmemcheck_show_addr(fallback_address);
519 kmemcheck_error_save_bug(regs);
520 return;
521 }
522
523 data->busy = true;
524
525 insn = (const uint8_t *) regs->ip;
526 insn_primary = kmemcheck_opcode_get_primary(insn);
527
528 kmemcheck_opcode_decode(insn, &size);
529
530 switch (insn_primary[0]) {
531#ifdef CONFIG_KMEMCHECK_BITOPS_OK
532 /* AND, OR, XOR */
533 /*
534 * Unfortunately, these instructions have to be excluded from
535 * our regular checking since they access only some (and not
536 * all) bits. This clears out "bogus" bitfield-access warnings.
537 */
538 case 0x80:
539 case 0x81:
540 case 0x82:
541 case 0x83:
542 switch ((insn_primary[1] >> 3) & 7) {
543 /* OR */
544 case 1:
545 /* AND */
546 case 4:
547 /* XOR */
548 case 6:
549 kmemcheck_write(regs, fallback_address, size);
550 goto out;
551
552 /* ADD */
553 case 0:
554 /* ADC */
555 case 2:
556 /* SBB */
557 case 3:
558 /* SUB */
559 case 5:
560 /* CMP */
561 case 7:
562 break;
563 }
564 break;
565#endif
566
567 /* MOVS, MOVSB, MOVSW, MOVSD */
568 case 0xa4:
569 case 0xa5:
570 /*
571 * These instructions are special because they take two
572 * addresses, but we only get one page fault.
573 */
574 kmemcheck_copy(regs, regs->si, regs->di, size);
575 goto out;
576
577 /* CMPS, CMPSB, CMPSW, CMPSD */
578 case 0xa6:
579 case 0xa7:
580 kmemcheck_read(regs, regs->si, size);
581 kmemcheck_read(regs, regs->di, size);
582 goto out;
583 }
584
585 /*
586 * If the opcode isn't special in any way, we use the data from the
587 * page fault handler to determine the address and type of memory
588 * access.
589 */
590 switch (fallback_method) {
591 case KMEMCHECK_READ:
592 kmemcheck_read(regs, fallback_address, size);
593 goto out;
594 case KMEMCHECK_WRITE:
595 kmemcheck_write(regs, fallback_address, size);
596 goto out;
597 }
598
599out:
600 data->busy = false;
601}
602
603bool kmemcheck_fault(struct pt_regs *regs, unsigned long address,
604 unsigned long error_code)
605{
606 pte_t *pte;
607
608 /*
609 * XXX: Is it safe to assume that memory accesses from virtual 86
610 * mode or non-kernel code segments will _never_ access kernel
611 * memory (e.g. tracked pages)? For now, we need this to avoid
612 * invoking kmemcheck for PnP BIOS calls.
613 */
614 if (regs->flags & X86_VM_MASK)
615 return false;
616 if (regs->cs != __KERNEL_CS)
617 return false;
618
619 pte = kmemcheck_pte_lookup(address);
620 if (!pte)
621 return false;
622
623 if (error_code & 2)
624 kmemcheck_access(regs, address, KMEMCHECK_WRITE);
625 else
626 kmemcheck_access(regs, address, KMEMCHECK_READ);
627
628 kmemcheck_show(regs);
629 return true;
630}
631
632bool kmemcheck_trap(struct pt_regs *regs)
633{
634 if (!kmemcheck_active(regs))
635 return false;
636
637 /* We're done. */
638 kmemcheck_hide(regs);
639 return true;
640}
diff --git a/arch/x86/mm/kmemcheck/opcode.c b/arch/x86/mm/kmemcheck/opcode.c
new file mode 100644
index 000000000000..63c19e27aa6f
--- /dev/null
+++ b/arch/x86/mm/kmemcheck/opcode.c
@@ -0,0 +1,106 @@
1#include <linux/types.h>
2
3#include "opcode.h"
4
5static bool opcode_is_prefix(uint8_t b)
6{
7 return
8 /* Group 1 */
9 b == 0xf0 || b == 0xf2 || b == 0xf3
10 /* Group 2 */
11 || b == 0x2e || b == 0x36 || b == 0x3e || b == 0x26
12 || b == 0x64 || b == 0x65 || b == 0x2e || b == 0x3e
13 /* Group 3 */
14 || b == 0x66
15 /* Group 4 */
16 || b == 0x67;
17}
18
19#ifdef CONFIG_X86_64
20static bool opcode_is_rex_prefix(uint8_t b)
21{
22 return (b & 0xf0) == 0x40;
23}
24#else
25static bool opcode_is_rex_prefix(uint8_t b)
26{
27 return false;
28}
29#endif
30
31#define REX_W (1 << 3)
32
33/*
34 * This is a VERY crude opcode decoder. We only need to find the size of the
35 * load/store that caused our #PF and this should work for all the opcodes
36 * that we care about. Moreover, the ones who invented this instruction set
37 * should be shot.
38 */
39void kmemcheck_opcode_decode(const uint8_t *op, unsigned int *size)
40{
41 /* Default operand size */
42 int operand_size_override = 4;
43
44 /* prefixes */
45 for (; opcode_is_prefix(*op); ++op) {
46 if (*op == 0x66)
47 operand_size_override = 2;
48 }
49
50 /* REX prefix */
51 if (opcode_is_rex_prefix(*op)) {
52 uint8_t rex = *op;
53
54 ++op;
55 if (rex & REX_W) {
56 switch (*op) {
57 case 0x63:
58 *size = 4;
59 return;
60 case 0x0f:
61 ++op;
62
63 switch (*op) {
64 case 0xb6:
65 case 0xbe:
66 *size = 1;
67 return;
68 case 0xb7:
69 case 0xbf:
70 *size = 2;
71 return;
72 }
73
74 break;
75 }
76
77 *size = 8;
78 return;
79 }
80 }
81
82 /* escape opcode */
83 if (*op == 0x0f) {
84 ++op;
85
86 /*
87 * This is move with zero-extend and sign-extend, respectively;
88 * we don't have to think about 0xb6/0xbe, because this is
89 * already handled in the conditional below.
90 */
91 if (*op == 0xb7 || *op == 0xbf)
92 operand_size_override = 2;
93 }
94
95 *size = (*op & 1) ? operand_size_override : 1;
96}
97
98const uint8_t *kmemcheck_opcode_get_primary(const uint8_t *op)
99{
100 /* skip prefixes */
101 while (opcode_is_prefix(*op))
102 ++op;
103 if (opcode_is_rex_prefix(*op))
104 ++op;
105 return op;
106}
diff --git a/arch/x86/mm/kmemcheck/opcode.h b/arch/x86/mm/kmemcheck/opcode.h
new file mode 100644
index 000000000000..6956aad66b5b
--- /dev/null
+++ b/arch/x86/mm/kmemcheck/opcode.h
@@ -0,0 +1,9 @@
1#ifndef ARCH__X86__MM__KMEMCHECK__OPCODE_H
2#define ARCH__X86__MM__KMEMCHECK__OPCODE_H
3
4#include <linux/types.h>
5
6void kmemcheck_opcode_decode(const uint8_t *op, unsigned int *size);
7const uint8_t *kmemcheck_opcode_get_primary(const uint8_t *op);
8
9#endif
diff --git a/arch/x86/mm/kmemcheck/pte.c b/arch/x86/mm/kmemcheck/pte.c
new file mode 100644
index 000000000000..4ead26eeaf96
--- /dev/null
+++ b/arch/x86/mm/kmemcheck/pte.c
@@ -0,0 +1,22 @@
1#include <linux/mm.h>
2
3#include <asm/pgtable.h>
4
5#include "pte.h"
6
7pte_t *kmemcheck_pte_lookup(unsigned long address)
8{
9 pte_t *pte;
10 unsigned int level;
11
12 pte = lookup_address(address, &level);
13 if (!pte)
14 return NULL;
15 if (level != PG_LEVEL_4K)
16 return NULL;
17 if (!pte_hidden(*pte))
18 return NULL;
19
20 return pte;
21}
22
diff --git a/arch/x86/mm/kmemcheck/pte.h b/arch/x86/mm/kmemcheck/pte.h
new file mode 100644
index 000000000000..9f5966456492
--- /dev/null
+++ b/arch/x86/mm/kmemcheck/pte.h
@@ -0,0 +1,10 @@
1#ifndef ARCH__X86__MM__KMEMCHECK__PTE_H
2#define ARCH__X86__MM__KMEMCHECK__PTE_H
3
4#include <linux/mm.h>
5
6#include <asm/pgtable.h>
7
8pte_t *kmemcheck_pte_lookup(unsigned long address);
9
10#endif
diff --git a/arch/x86/mm/kmemcheck/selftest.c b/arch/x86/mm/kmemcheck/selftest.c
new file mode 100644
index 000000000000..036efbea8b28
--- /dev/null
+++ b/arch/x86/mm/kmemcheck/selftest.c
@@ -0,0 +1,69 @@
1#include <linux/kernel.h>
2
3#include "opcode.h"
4#include "selftest.h"
5
6struct selftest_opcode {
7 unsigned int expected_size;
8 const uint8_t *insn;
9 const char *desc;
10};
11
12static const struct selftest_opcode selftest_opcodes[] = {
13 /* REP MOVS */
14 {1, "\xf3\xa4", "rep movsb <mem8>, <mem8>"},
15 {4, "\xf3\xa5", "rep movsl <mem32>, <mem32>"},
16
17 /* MOVZX / MOVZXD */
18 {1, "\x66\x0f\xb6\x51\xf8", "movzwq <mem8>, <reg16>"},
19 {1, "\x0f\xb6\x51\xf8", "movzwq <mem8>, <reg32>"},
20
21 /* MOVSX / MOVSXD */
22 {1, "\x66\x0f\xbe\x51\xf8", "movswq <mem8>, <reg16>"},
23 {1, "\x0f\xbe\x51\xf8", "movswq <mem8>, <reg32>"},
24
25#ifdef CONFIG_X86_64
26 /* MOVZX / MOVZXD */
27 {1, "\x49\x0f\xb6\x51\xf8", "movzbq <mem8>, <reg64>"},
28 {2, "\x49\x0f\xb7\x51\xf8", "movzbq <mem16>, <reg64>"},
29
30 /* MOVSX / MOVSXD */
31 {1, "\x49\x0f\xbe\x51\xf8", "movsbq <mem8>, <reg64>"},
32 {2, "\x49\x0f\xbf\x51\xf8", "movsbq <mem16>, <reg64>"},
33 {4, "\x49\x63\x51\xf8", "movslq <mem32>, <reg64>"},
34#endif
35};
36
37static bool selftest_opcode_one(const struct selftest_opcode *op)
38{
39 unsigned size;
40
41 kmemcheck_opcode_decode(op->insn, &size);
42
43 if (size == op->expected_size)
44 return true;
45
46 printk(KERN_WARNING "kmemcheck: opcode %s: expected size %d, got %d\n",
47 op->desc, op->expected_size, size);
48 return false;
49}
50
51static bool selftest_opcodes_all(void)
52{
53 bool pass = true;
54 unsigned int i;
55
56 for (i = 0; i < ARRAY_SIZE(selftest_opcodes); ++i)
57 pass = pass && selftest_opcode_one(&selftest_opcodes[i]);
58
59 return pass;
60}
61
62bool kmemcheck_selftest(void)
63{
64 bool pass = true;
65
66 pass = pass && selftest_opcodes_all();
67
68 return pass;
69}
diff --git a/arch/x86/mm/kmemcheck/selftest.h b/arch/x86/mm/kmemcheck/selftest.h
new file mode 100644
index 000000000000..8fed4fe11f95
--- /dev/null
+++ b/arch/x86/mm/kmemcheck/selftest.h
@@ -0,0 +1,6 @@
1#ifndef ARCH_X86_MM_KMEMCHECK_SELFTEST_H
2#define ARCH_X86_MM_KMEMCHECK_SELFTEST_H
3
4bool kmemcheck_selftest(void);
5
6#endif
diff --git a/arch/x86/mm/kmemcheck/shadow.c b/arch/x86/mm/kmemcheck/shadow.c
new file mode 100644
index 000000000000..e773b6bd0079
--- /dev/null
+++ b/arch/x86/mm/kmemcheck/shadow.c
@@ -0,0 +1,162 @@
1#include <linux/kmemcheck.h>
2#include <linux/module.h>
3#include <linux/mm.h>
4#include <linux/module.h>
5
6#include <asm/page.h>
7#include <asm/pgtable.h>
8
9#include "pte.h"
10#include "shadow.h"
11
12/*
13 * Return the shadow address for the given address. Returns NULL if the
14 * address is not tracked.
15 *
16 * We need to be extremely careful not to follow any invalid pointers,
17 * because this function can be called for *any* possible address.
18 */
19void *kmemcheck_shadow_lookup(unsigned long address)
20{
21 pte_t *pte;
22 struct page *page;
23
24 if (!virt_addr_valid(address))
25 return NULL;
26
27 pte = kmemcheck_pte_lookup(address);
28 if (!pte)
29 return NULL;
30
31 page = virt_to_page(address);
32 if (!page->shadow)
33 return NULL;
34 return page->shadow + (address & (PAGE_SIZE - 1));
35}
36
37static void mark_shadow(void *address, unsigned int n,
38 enum kmemcheck_shadow status)
39{
40 unsigned long addr = (unsigned long) address;
41 unsigned long last_addr = addr + n - 1;
42 unsigned long page = addr & PAGE_MASK;
43 unsigned long last_page = last_addr & PAGE_MASK;
44 unsigned int first_n;
45 void *shadow;
46
47 /* If the memory range crosses a page boundary, stop there. */
48 if (page == last_page)
49 first_n = n;
50 else
51 first_n = page + PAGE_SIZE - addr;
52
53 shadow = kmemcheck_shadow_lookup(addr);
54 if (shadow)
55 memset(shadow, status, first_n);
56
57 addr += first_n;
58 n -= first_n;
59
60 /* Do full-page memset()s. */
61 while (n >= PAGE_SIZE) {
62 shadow = kmemcheck_shadow_lookup(addr);
63 if (shadow)
64 memset(shadow, status, PAGE_SIZE);
65
66 addr += PAGE_SIZE;
67 n -= PAGE_SIZE;
68 }
69
70 /* Do the remaining page, if any. */
71 if (n > 0) {
72 shadow = kmemcheck_shadow_lookup(addr);
73 if (shadow)
74 memset(shadow, status, n);
75 }
76}
77
78void kmemcheck_mark_unallocated(void *address, unsigned int n)
79{
80 mark_shadow(address, n, KMEMCHECK_SHADOW_UNALLOCATED);
81}
82
83void kmemcheck_mark_uninitialized(void *address, unsigned int n)
84{
85 mark_shadow(address, n, KMEMCHECK_SHADOW_UNINITIALIZED);
86}
87
88/*
89 * Fill the shadow memory of the given address such that the memory at that
90 * address is marked as being initialized.
91 */
92void kmemcheck_mark_initialized(void *address, unsigned int n)
93{
94 mark_shadow(address, n, KMEMCHECK_SHADOW_INITIALIZED);
95}
96EXPORT_SYMBOL_GPL(kmemcheck_mark_initialized);
97
98void kmemcheck_mark_freed(void *address, unsigned int n)
99{
100 mark_shadow(address, n, KMEMCHECK_SHADOW_FREED);
101}
102
103void kmemcheck_mark_unallocated_pages(struct page *p, unsigned int n)
104{
105 unsigned int i;
106
107 for (i = 0; i < n; ++i)
108 kmemcheck_mark_unallocated(page_address(&p[i]), PAGE_SIZE);
109}
110
111void kmemcheck_mark_uninitialized_pages(struct page *p, unsigned int n)
112{
113 unsigned int i;
114
115 for (i = 0; i < n; ++i)
116 kmemcheck_mark_uninitialized(page_address(&p[i]), PAGE_SIZE);
117}
118
119void kmemcheck_mark_initialized_pages(struct page *p, unsigned int n)
120{
121 unsigned int i;
122
123 for (i = 0; i < n; ++i)
124 kmemcheck_mark_initialized(page_address(&p[i]), PAGE_SIZE);
125}
126
127enum kmemcheck_shadow kmemcheck_shadow_test(void *shadow, unsigned int size)
128{
129 uint8_t *x;
130 unsigned int i;
131
132 x = shadow;
133
134#ifdef CONFIG_KMEMCHECK_PARTIAL_OK
135 /*
136 * Make sure _some_ bytes are initialized. Gcc frequently generates
137 * code to access neighboring bytes.
138 */
139 for (i = 0; i < size; ++i) {
140 if (x[i] == KMEMCHECK_SHADOW_INITIALIZED)
141 return x[i];
142 }
143#else
144 /* All bytes must be initialized. */
145 for (i = 0; i < size; ++i) {
146 if (x[i] != KMEMCHECK_SHADOW_INITIALIZED)
147 return x[i];
148 }
149#endif
150
151 return x[0];
152}
153
154void kmemcheck_shadow_set(void *shadow, unsigned int size)
155{
156 uint8_t *x;
157 unsigned int i;
158
159 x = shadow;
160 for (i = 0; i < size; ++i)
161 x[i] = KMEMCHECK_SHADOW_INITIALIZED;
162}
diff --git a/arch/x86/mm/kmemcheck/shadow.h b/arch/x86/mm/kmemcheck/shadow.h
new file mode 100644
index 000000000000..af46d9ab9d86
--- /dev/null
+++ b/arch/x86/mm/kmemcheck/shadow.h
@@ -0,0 +1,16 @@
1#ifndef ARCH__X86__MM__KMEMCHECK__SHADOW_H
2#define ARCH__X86__MM__KMEMCHECK__SHADOW_H
3
4enum kmemcheck_shadow {
5 KMEMCHECK_SHADOW_UNALLOCATED,
6 KMEMCHECK_SHADOW_UNINITIALIZED,
7 KMEMCHECK_SHADOW_INITIALIZED,
8 KMEMCHECK_SHADOW_FREED,
9};
10
11void *kmemcheck_shadow_lookup(unsigned long address);
12
13enum kmemcheck_shadow kmemcheck_shadow_test(void *shadow, unsigned int size);
14void kmemcheck_shadow_set(void *shadow, unsigned int size);
15
16#endif
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 6ce9518fe2ac..3cfe9ced8a4c 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -470,7 +470,7 @@ static int split_large_page(pte_t *kpte, unsigned long address)
470 470
471 if (!debug_pagealloc) 471 if (!debug_pagealloc)
472 spin_unlock(&cpa_lock); 472 spin_unlock(&cpa_lock);
473 base = alloc_pages(GFP_KERNEL, 0); 473 base = alloc_pages(GFP_KERNEL | __GFP_NOTRACK, 0);
474 if (!debug_pagealloc) 474 if (!debug_pagealloc)
475 spin_lock(&cpa_lock); 475 spin_lock(&cpa_lock);
476 if (!base) 476 if (!base)
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
index 7aa03a5389f5..8e43bdd45456 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -4,9 +4,11 @@
4#include <asm/tlb.h> 4#include <asm/tlb.h>
5#include <asm/fixmap.h> 5#include <asm/fixmap.h>
6 6
7#define PGALLOC_GFP GFP_KERNEL | __GFP_NOTRACK | __GFP_REPEAT | __GFP_ZERO
8
7pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) 9pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
8{ 10{
9 return (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO); 11 return (pte_t *)__get_free_page(PGALLOC_GFP);
10} 12}
11 13
12pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) 14pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
@@ -14,9 +16,9 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
14 struct page *pte; 16 struct page *pte;
15 17
16#ifdef CONFIG_HIGHPTE 18#ifdef CONFIG_HIGHPTE
17 pte = alloc_pages(GFP_KERNEL|__GFP_HIGHMEM|__GFP_REPEAT|__GFP_ZERO, 0); 19 pte = alloc_pages(PGALLOC_GFP | __GFP_HIGHMEM, 0);
18#else 20#else
19 pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); 21 pte = alloc_pages(PGALLOC_GFP, 0);
20#endif 22#endif
21 if (pte) 23 if (pte)
22 pgtable_page_ctor(pte); 24 pgtable_page_ctor(pte);
@@ -161,7 +163,7 @@ static int preallocate_pmds(pmd_t *pmds[])
161 bool failed = false; 163 bool failed = false;
162 164
163 for(i = 0; i < PREALLOCATED_PMDS; i++) { 165 for(i = 0; i < PREALLOCATED_PMDS; i++) {
164 pmd_t *pmd = (pmd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT); 166 pmd_t *pmd = (pmd_t *)__get_free_page(PGALLOC_GFP);
165 if (pmd == NULL) 167 if (pmd == NULL)
166 failed = true; 168 failed = true;
167 pmds[i] = pmd; 169 pmds[i] = pmd;
@@ -228,7 +230,7 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
228 pmd_t *pmds[PREALLOCATED_PMDS]; 230 pmd_t *pmds[PREALLOCATED_PMDS];
229 unsigned long flags; 231 unsigned long flags;
230 232
231 pgd = (pgd_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO); 233 pgd = (pgd_t *)__get_free_page(PGALLOC_GFP);
232 234
233 if (pgd == NULL) 235 if (pgd == NULL)
234 goto out; 236 goto out;
diff --git a/arch/xtensa/include/asm/kmap_types.h b/arch/xtensa/include/asm/kmap_types.h
index 9e822d2e3bce..11c687e527f1 100644
--- a/arch/xtensa/include/asm/kmap_types.h
+++ b/arch/xtensa/include/asm/kmap_types.h
@@ -1,31 +1,6 @@
1/*
2 * include/asm-xtensa/kmap_types.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
10
11#ifndef _XTENSA_KMAP_TYPES_H 1#ifndef _XTENSA_KMAP_TYPES_H
12#define _XTENSA_KMAP_TYPES_H 2#define _XTENSA_KMAP_TYPES_H
13 3
14enum km_type { 4#include <asm-generic/kmap_types.h>
15 KM_BOUNCE_READ,
16 KM_SKB_SUNRPC_DATA,
17 KM_SKB_DATA_SOFTIRQ,
18 KM_USER0,
19 KM_USER1,
20 KM_BIO_SRC_IRQ,
21 KM_BIO_DST_IRQ,
22 KM_PTE0,
23 KM_PTE1,
24 KM_IRQ0,
25 KM_IRQ1,
26 KM_SOFTIRQ0,
27 KM_SOFTIRQ1,
28 KM_TYPE_NR
29};
30 5
31#endif /* _XTENSA_KMAP_TYPES_H */ 6#endif /* _XTENSA_KMAP_TYPES_H */
diff --git a/arch/xtensa/kernel/init_task.c b/arch/xtensa/kernel/init_task.c
index e07f5c9fcd35..c4302f0e4ba0 100644
--- a/arch/xtensa/kernel/init_task.c
+++ b/arch/xtensa/kernel/init_task.c
@@ -23,10 +23,6 @@
23 23
24static struct signal_struct init_signals = INIT_SIGNALS(init_signals); 24static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
25static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); 25static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
26struct mm_struct init_mm = INIT_MM(init_mm);
27
28EXPORT_SYMBOL(init_mm);
29
30union thread_union init_thread_union 26union thread_union init_thread_union
31 __attribute__((__section__(".data.init_task"))) = 27 __attribute__((__section__(".data.init_task"))) =
32{ INIT_THREAD_INFO(init_task) }; 28{ INIT_THREAD_INFO(init_task) };