aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/arm/memory.txt4
-rw-r--r--arch/arm/kernel/armksyms.c1
-rw-r--r--arch/arm/kernel/entry-common.S3
-rw-r--r--arch/arm/kernel/signal.c25
-rw-r--r--arch/arm/kernel/vmlinux.lds.S6
-rw-r--r--arch/arm/lib/getuser.S11
-rw-r--r--arch/arm/mm/Makefile2
-rw-r--r--arch/arm/mm/blockops.c185
-rw-r--r--arch/arm/mm/init.c24
-rw-r--r--arch/arm/mm/ioremap.c3
-rw-r--r--arch/powerpc/kernel/pci_64.c18
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c3
-rw-r--r--arch/powerpc/kernel/ptrace-common.h (renamed from include/asm-ppc64/ptrace-common.h)0
-rw-r--r--arch/powerpc/kernel/ptrace.c3
-rw-r--r--arch/powerpc/kernel/ptrace32.c3
-rw-r--r--arch/powerpc/mm/imalloc.c3
-rw-r--r--arch/powerpc/mm/init_64.c3
-rw-r--r--arch/powerpc/mm/mmu_decl.h14
-rw-r--r--arch/powerpc/mm/pgtable_64.c3
-rw-r--r--arch/powerpc/platforms/powermac/smp.c6
-rw-r--r--arch/powerpc/sysdev/mpic.c13
-rw-r--r--drivers/i2c/busses/i2c-ixp2000.c6
-rw-r--r--drivers/i2c/busses/i2c-ixp4xx.c7
-rw-r--r--drivers/mtd/maps/ipaq-flash.c6
-rw-r--r--drivers/mtd/maps/ixp2000.c22
-rw-r--r--drivers/mtd/nand/h1910.c2
-rw-r--r--drivers/serial/amba-pl011.c45
-rw-r--r--drivers/serial/sa1100.c1
-rw-r--r--include/asm-arm/arch-ixp4xx/io.h9
-rw-r--r--include/asm-arm/hardware/amba_serial.h5
-rw-r--r--include/asm-arm/io.h21
-rw-r--r--include/asm-arm/uaccess.h8
-rw-r--r--include/asm-powerpc/dma-mapping.h (renamed from include/asm-ppc/dma-mapping.h)138
-rw-r--r--include/asm-powerpc/io.h (renamed from include/asm-ppc64/io.h)12
-rw-r--r--include/asm-powerpc/mmu.h (renamed from include/asm-ppc64/mmu.h)14
-rw-r--r--include/asm-powerpc/mmu_context.h (renamed from include/asm-ppc64/mmu_context.h)12
-rw-r--r--include/asm-powerpc/mmzone.h (renamed from include/asm-ppc64/mmzone.h)0
-rw-r--r--include/asm-powerpc/pci-bridge.h (renamed from include/asm-ppc64/pci-bridge.h)12
-rw-r--r--include/asm-powerpc/pci.h (renamed from include/asm-ppc64/pci.h)110
-rw-r--r--include/asm-powerpc/pgalloc.h (renamed from include/asm-ppc64/pgalloc.h)11
-rw-r--r--include/asm-powerpc/pgtable-4k.h (renamed from include/asm-ppc64/pgtable-4k.h)0
-rw-r--r--include/asm-powerpc/pgtable-64k.h (renamed from include/asm-ppc64/pgtable-64k.h)0
-rw-r--r--include/asm-powerpc/pgtable.h (renamed from include/asm-ppc64/pgtable.h)20
-rw-r--r--include/asm-powerpc/ppc-pci.h2
-rw-r--r--include/asm-powerpc/spinlock.h (renamed from include/asm-ppc64/spinlock.h)72
-rw-r--r--include/asm-ppc/io.h17
-rw-r--r--include/asm-ppc64/dma-mapping.h136
-rw-r--r--include/asm-ppc64/imalloc.h26
48 files changed, 433 insertions, 614 deletions
diff --git a/Documentation/arm/memory.txt b/Documentation/arm/memory.txt
index 4b1c93a8177b..dc6045577a8b 100644
--- a/Documentation/arm/memory.txt
+++ b/Documentation/arm/memory.txt
@@ -1,7 +1,7 @@
1 Kernel Memory Layout on ARM Linux 1 Kernel Memory Layout on ARM Linux
2 2
3 Russell King <rmk@arm.linux.org.uk> 3 Russell King <rmk@arm.linux.org.uk>
4 May 21, 2004 (2.6.6) 4 November 17, 2005 (2.6.15)
5 5
6This document describes the virtual memory layout which the Linux 6This document describes the virtual memory layout which the Linux
7kernel uses for ARM processors. It indicates which regions are 7kernel uses for ARM processors. It indicates which regions are
@@ -37,6 +37,8 @@ ff000000 ffbfffff Reserved for future expansion of DMA
37 mapping region. 37 mapping region.
38 38
39VMALLOC_END feffffff Free for platform use, recommended. 39VMALLOC_END feffffff Free for platform use, recommended.
40 VMALLOC_END must be aligned to a 2MB
41 boundary.
40 42
41VMALLOC_START VMALLOC_END-1 vmalloc() / ioremap() space. 43VMALLOC_START VMALLOC_END-1 vmalloc() / ioremap() space.
42 Memory returned by vmalloc/ioremap will 44 Memory returned by vmalloc/ioremap will
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
index 7a3261f0bf79..9997098009a9 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
@@ -120,7 +120,6 @@ EXPORT_SYMBOL(__arch_strncpy_from_user);
120EXPORT_SYMBOL(__get_user_1); 120EXPORT_SYMBOL(__get_user_1);
121EXPORT_SYMBOL(__get_user_2); 121EXPORT_SYMBOL(__get_user_2);
122EXPORT_SYMBOL(__get_user_4); 122EXPORT_SYMBOL(__get_user_4);
123EXPORT_SYMBOL(__get_user_8);
124 123
125EXPORT_SYMBOL(__put_user_1); 124EXPORT_SYMBOL(__put_user_1);
126EXPORT_SYMBOL(__put_user_2); 125EXPORT_SYMBOL(__put_user_2);
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 066597f4345a..f7f183075237 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -48,8 +48,7 @@ work_pending:
48 mov r0, sp @ 'regs' 48 mov r0, sp @ 'regs'
49 mov r2, why @ 'syscall' 49 mov r2, why @ 'syscall'
50 bl do_notify_resume 50 bl do_notify_resume
51 disable_irq @ disable interrupts 51 b ret_slow_syscall @ Check work again
52 b no_work_pending
53 52
54work_resched: 53work_resched:
55 bl schedule 54 bl schedule
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index a917e3dd3666..765922bcf9e7 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -595,23 +595,22 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
595 */ 595 */
596 ret |= !valid_user_regs(regs); 596 ret |= !valid_user_regs(regs);
597 597
598 /*
599 * Block the signal if we were unsuccessful.
600 */
601 if (ret != 0) { 598 if (ret != 0) {
602 spin_lock_irq(&tsk->sighand->siglock); 599 force_sigsegv(sig, tsk);
603 sigorsets(&tsk->blocked, &tsk->blocked, 600 return;
604 &ka->sa.sa_mask);
605 if (!(ka->sa.sa_flags & SA_NODEFER))
606 sigaddset(&tsk->blocked, sig);
607 recalc_sigpending();
608 spin_unlock_irq(&tsk->sighand->siglock);
609 } 601 }
610 602
611 if (ret == 0) 603 /*
612 return; 604 * Block the signal if we were successful.
605 */
606 spin_lock_irq(&tsk->sighand->siglock);
607 sigorsets(&tsk->blocked, &tsk->blocked,
608 &ka->sa.sa_mask);
609 if (!(ka->sa.sa_flags & SA_NODEFER))
610 sigaddset(&tsk->blocked, sig);
611 recalc_sigpending();
612 spin_unlock_irq(&tsk->sighand->siglock);
613 613
614 force_sigsegv(sig, tsk);
615} 614}
616 615
617/* 616/*
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 80c8e4c8cefa..9a47770114d4 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -172,6 +172,10 @@ SECTIONS
172 .comment 0 : { *(.comment) } 172 .comment 0 : { *(.comment) }
173} 173}
174 174
175/* those must never be empty */ 175/*
176 * These must never be empty
177 * If you have to comment these two assert statements out, your
178 * binutils is too old (for other reasons as well)
179 */
176ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support") 180ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
177ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined") 181ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")
diff --git a/arch/arm/lib/getuser.S b/arch/arm/lib/getuser.S
index d204018070a4..c03ea8e666ba 100644
--- a/arch/arm/lib/getuser.S
+++ b/arch/arm/lib/getuser.S
@@ -54,15 +54,6 @@ __get_user_4:
54 mov r0, #0 54 mov r0, #0
55 mov pc, lr 55 mov pc, lr
56 56
57 .global __get_user_8
58__get_user_8:
595: ldrt r2, [r0], #4
606: ldrt r3, [r0]
61 mov r0, #0
62 mov pc, lr
63
64__get_user_bad_8:
65 mov r3, #0
66__get_user_bad: 57__get_user_bad:
67 mov r2, #0 58 mov r2, #0
68 mov r0, #-EFAULT 59 mov r0, #-EFAULT
@@ -73,6 +64,4 @@ __get_user_bad:
73 .long 2b, __get_user_bad 64 .long 2b, __get_user_bad
74 .long 3b, __get_user_bad 65 .long 3b, __get_user_bad
75 .long 4b, __get_user_bad 66 .long 4b, __get_user_bad
76 .long 5b, __get_user_bad_8
77 .long 6b, __get_user_bad_8
78.previous 67.previous
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile
index 59f47d4c2dfe..ffe73ba2bf17 100644
--- a/arch/arm/mm/Makefile
+++ b/arch/arm/mm/Makefile
@@ -51,4 +51,4 @@ obj-$(CONFIG_CPU_ARM1026) += proc-arm1026.o
51obj-$(CONFIG_CPU_SA110) += proc-sa110.o 51obj-$(CONFIG_CPU_SA110) += proc-sa110.o
52obj-$(CONFIG_CPU_SA1100) += proc-sa1100.o 52obj-$(CONFIG_CPU_SA1100) += proc-sa1100.o
53obj-$(CONFIG_CPU_XSCALE) += proc-xscale.o 53obj-$(CONFIG_CPU_XSCALE) += proc-xscale.o
54obj-$(CONFIG_CPU_V6) += proc-v6.o blockops.o 54obj-$(CONFIG_CPU_V6) += proc-v6.o
diff --git a/arch/arm/mm/blockops.c b/arch/arm/mm/blockops.c
deleted file mode 100644
index 4f5ee2d08996..000000000000
--- a/arch/arm/mm/blockops.c
+++ /dev/null
@@ -1,185 +0,0 @@
1#include <linux/kernel.h>
2#include <linux/init.h>
3#include <linux/errno.h>
4#include <linux/mm.h>
5
6#include <asm/memory.h>
7#include <asm/ptrace.h>
8#include <asm/cacheflush.h>
9#include <asm/traps.h>
10
11extern struct cpu_cache_fns blk_cache_fns;
12
13#define HARVARD_CACHE
14
15/*
16 * blk_flush_kern_dcache_page(kaddr)
17 *
18 * Ensure that the data held in the page kaddr is written back
19 * to the page in question.
20 *
21 * - kaddr - kernel address (guaranteed to be page aligned)
22 */
23static void __attribute__((naked))
24blk_flush_kern_dcache_page(void *kaddr)
25{
26 asm(
27 "add r1, r0, %0 \n\
28 sub r1, r1, %1 \n\
291: .word 0xec401f0e @ mcrr p15, 0, r0, r1, c14, 0 @ blocking \n\
30 mov r0, #0 \n\
31 mcr p15, 0, r0, c7, c5, 0 \n\
32 mcr p15, 0, r0, c7, c10, 4 \n\
33 mov pc, lr"
34 :
35 : "I" (PAGE_SIZE), "I" (L1_CACHE_BYTES));
36}
37
38/*
39 * blk_dma_inv_range(start,end)
40 *
41 * Invalidate the data cache within the specified region; we will
42 * be performing a DMA operation in this region and we want to
43 * purge old data in the cache.
44 *
45 * - start - virtual start address of region
46 * - end - virtual end address of region
47 */
48static void __attribute__((naked))
49blk_dma_inv_range_unified(unsigned long start, unsigned long end)
50{
51 asm(
52 "tst r0, %0 \n\
53 mcrne p15, 0, r0, c7, c11, 1 @ clean unified line \n\
54 tst r1, %0 \n\
55 mcrne p15, 0, r1, c7, c15, 1 @ clean & invalidate unified line\n\
56 .word 0xec401f06 @ mcrr p15, 0, r1, r0, c6, 0 @ blocking \n\
57 mov r0, #0 \n\
58 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer \n\
59 mov pc, lr"
60 :
61 : "I" (L1_CACHE_BYTES - 1));
62}
63
64static void __attribute__((naked))
65blk_dma_inv_range_harvard(unsigned long start, unsigned long end)
66{
67 asm(
68 "tst r0, %0 \n\
69 mcrne p15, 0, r0, c7, c10, 1 @ clean D line \n\
70 tst r1, %0 \n\
71 mcrne p15, 0, r1, c7, c14, 1 @ clean & invalidate D line \n\
72 .word 0xec401f06 @ mcrr p15, 0, r1, r0, c6, 0 @ blocking \n\
73 mov r0, #0 \n\
74 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer \n\
75 mov pc, lr"
76 :
77 : "I" (L1_CACHE_BYTES - 1));
78}
79
80/*
81 * blk_dma_clean_range(start,end)
82 * - start - virtual start address of region
83 * - end - virtual end address of region
84 */
85static void __attribute__((naked))
86blk_dma_clean_range(unsigned long start, unsigned long end)
87{
88 asm(
89 ".word 0xec401f0c @ mcrr p15, 0, r1, r0, c12, 0 @ blocking \n\
90 mov r0, #0 \n\
91 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer \n\
92 mov pc, lr");
93}
94
95/*
96 * blk_dma_flush_range(start,end)
97 * - start - virtual start address of region
98 * - end - virtual end address of region
99 */
100static void __attribute__((naked))
101blk_dma_flush_range(unsigned long start, unsigned long end)
102{
103 asm(
104 ".word 0xec401f0e @ mcrr p15, 0, r1, r0, c14, 0 @ blocking \n\
105 mov pc, lr");
106}
107
108static int blockops_trap(struct pt_regs *regs, unsigned int instr)
109{
110 regs->ARM_r4 |= regs->ARM_r2;
111 regs->ARM_pc += 4;
112 return 0;
113}
114
115static char *func[] = {
116 "Prefetch data range",
117 "Clean+Invalidate data range",
118 "Clean data range",
119 "Invalidate data range",
120 "Invalidate instr range"
121};
122
123static struct undef_hook blockops_hook __initdata = {
124 .instr_mask = 0x0fffffd0,
125 .instr_val = 0x0c401f00,
126 .cpsr_mask = PSR_T_BIT,
127 .cpsr_val = 0,
128 .fn = blockops_trap,
129};
130
131static int __init blockops_check(void)
132{
133 register unsigned int err asm("r4") = 0;
134 unsigned int err_pos = 1;
135 unsigned int cache_type;
136 int i;
137
138 asm("mrc p15, 0, %0, c0, c0, 1" : "=r" (cache_type));
139
140 printk("Checking V6 block cache operations:\n");
141 register_undef_hook(&blockops_hook);
142
143 __asm__ ("mov r0, %0\n\t"
144 "mov r1, %1\n\t"
145 "mov r2, #1\n\t"
146 ".word 0xec401f2c @ mcrr p15, 0, r1, r0, c12, 2\n\t"
147 "mov r2, #2\n\t"
148 ".word 0xec401f0e @ mcrr p15, 0, r1, r0, c14, 0\n\t"
149 "mov r2, #4\n\t"
150 ".word 0xec401f0c @ mcrr p15, 0, r1, r0, c12, 0\n\t"
151 "mov r2, #8\n\t"
152 ".word 0xec401f06 @ mcrr p15, 0, r1, r0, c6, 0\n\t"
153 "mov r2, #16\n\t"
154 ".word 0xec401f05 @ mcrr p15, 0, r1, r0, c5, 0\n\t"
155 :
156 : "r" (PAGE_OFFSET), "r" (PAGE_OFFSET + 128)
157 : "r0", "r1", "r2");
158
159 unregister_undef_hook(&blockops_hook);
160
161 for (i = 0; i < ARRAY_SIZE(func); i++, err_pos <<= 1)
162 printk("%30s: %ssupported\n", func[i], err & err_pos ? "not " : "");
163
164 if ((err & 8) == 0) {
165 printk(" --> Using %s block cache invalidate\n",
166 cache_type & (1 << 24) ? "harvard" : "unified");
167 if (cache_type & (1 << 24))
168 cpu_cache.dma_inv_range = blk_dma_inv_range_harvard;
169 else
170 cpu_cache.dma_inv_range = blk_dma_inv_range_unified;
171 }
172 if ((err & 4) == 0) {
173 printk(" --> Using block cache clean\n");
174 cpu_cache.dma_clean_range = blk_dma_clean_range;
175 }
176 if ((err & 2) == 0) {
177 printk(" --> Using block cache clean+invalidate\n");
178 cpu_cache.dma_flush_range = blk_dma_flush_range;
179 cpu_cache.flush_kern_dcache_page = blk_flush_kern_dcache_page;
180 }
181
182 return 0;
183}
184
185__initcall(blockops_check);
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index c168f322ef8c..8b276ee38acf 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -420,7 +420,8 @@ static void __init bootmem_init(struct meminfo *mi)
420 * Set up device the mappings. Since we clear out the page tables for all 420 * Set up device the mappings. Since we clear out the page tables for all
421 * mappings above VMALLOC_END, we will remove any debug device mappings. 421 * mappings above VMALLOC_END, we will remove any debug device mappings.
422 * This means you have to be careful how you debug this function, or any 422 * This means you have to be careful how you debug this function, or any
423 * called function. (Do it by code inspection!) 423 * called function. This means you can't use any function or debugging
424 * method which may touch any device, otherwise the kernel _will_ crash.
424 */ 425 */
425static void __init devicemaps_init(struct machine_desc *mdesc) 426static void __init devicemaps_init(struct machine_desc *mdesc)
426{ 427{
@@ -428,6 +429,12 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
428 unsigned long addr; 429 unsigned long addr;
429 void *vectors; 430 void *vectors;
430 431
432 /*
433 * Allocate the vector page early.
434 */
435 vectors = alloc_bootmem_low_pages(PAGE_SIZE);
436 BUG_ON(!vectors);
437
431 for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE) 438 for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE)
432 pmd_clear(pmd_off_k(addr)); 439 pmd_clear(pmd_off_k(addr));
433 440
@@ -461,12 +468,6 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
461 create_mapping(&map); 468 create_mapping(&map);
462#endif 469#endif
463 470
464 flush_cache_all();
465 local_flush_tlb_all();
466
467 vectors = alloc_bootmem_low_pages(PAGE_SIZE);
468 BUG_ON(!vectors);
469
470 /* 471 /*
471 * Create a mapping for the machine vectors at the high-vectors 472 * Create a mapping for the machine vectors at the high-vectors
472 * location (0xffff0000). If we aren't using high-vectors, also 473 * location (0xffff0000). If we aren't using high-vectors, also
@@ -491,12 +492,13 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
491 mdesc->map_io(); 492 mdesc->map_io();
492 493
493 /* 494 /*
494 * Finally flush the tlb again - this ensures that we're in a 495 * Finally flush the caches and tlb to ensure that we're in a
495 * consistent state wrt the writebuffer if the writebuffer needs 496 * consistent state wrt the writebuffer. This also ensures that
496 * draining. After this point, we can start to touch devices 497 * any write-allocated cache lines in the vector page are written
497 * again. 498 * back. After this point, we can start to touch devices again.
498 */ 499 */
499 local_flush_tlb_all(); 500 local_flush_tlb_all();
501 flush_cache_all();
500} 502}
501 503
502/* 504/*
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 0f128c28fee4..10901398e4a2 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -130,8 +130,7 @@ remap_area_pages(unsigned long start, unsigned long phys_addr,
130 * mapping. See include/asm-arm/proc-armv/pgtable.h for more information. 130 * mapping. See include/asm-arm/proc-armv/pgtable.h for more information.
131 */ 131 */
132void __iomem * 132void __iomem *
133__ioremap(unsigned long phys_addr, size_t size, unsigned long flags, 133__ioremap(unsigned long phys_addr, size_t size, unsigned long flags)
134 unsigned long align)
135{ 134{
136 void * addr; 135 void * addr;
137 struct vm_struct * area; 136 struct vm_struct * area;
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 5a5b24685081..8b6008ab217d 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -40,7 +40,7 @@
40#endif 40#endif
41 41
42unsigned long pci_probe_only = 1; 42unsigned long pci_probe_only = 1;
43unsigned long pci_assign_all_buses = 0; 43int pci_assign_all_buses = 0;
44 44
45/* 45/*
46 * legal IO pages under MAX_ISA_PORT. This is to ensure we don't touch 46 * legal IO pages under MAX_ISA_PORT. This is to ensure we don't touch
@@ -55,11 +55,6 @@ static void fixup_resource(struct resource *res, struct pci_dev *dev);
55static void do_bus_setup(struct pci_bus *bus); 55static void do_bus_setup(struct pci_bus *bus);
56#endif 56#endif
57 57
58unsigned int pcibios_assign_all_busses(void)
59{
60 return pci_assign_all_buses;
61}
62
63/* pci_io_base -- the base address from which io bars are offsets. 58/* pci_io_base -- the base address from which io bars are offsets.
64 * This is the lowest I/O base address (so bar values are always positive), 59 * This is the lowest I/O base address (so bar values are always positive),
65 * and it *must* be the start of ISA space if an ISA bus exists because 60 * and it *must* be the start of ISA space if an ISA bus exists because
@@ -1186,17 +1181,6 @@ void phbs_remap_io(void)
1186 remap_bus_range(hose->bus); 1181 remap_bus_range(hose->bus);
1187} 1182}
1188 1183
1189/*
1190 * ppc64 can have multifunction devices that do not respond to function 0.
1191 * In this case we must scan all functions.
1192 * XXX this can go now, we use the OF device tree in all the
1193 * cases that caused problems. -- paulus
1194 */
1195int pcibios_scan_all_fns(struct pci_bus *bus, int devfn)
1196{
1197 return 0;
1198}
1199
1200static void __devinit fixup_resource(struct resource *res, struct pci_dev *dev) 1184static void __devinit fixup_resource(struct resource *res, struct pci_dev *dev)
1201{ 1185{
1202 struct pci_controller *hose = pci_bus_to_host(dev->bus); 1186 struct pci_controller *hose = pci_bus_to_host(dev->bus);
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 59846b40d521..af4d1bc9a2eb 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -146,9 +146,6 @@ EXPORT_SYMBOL(pci_bus_io_base);
146EXPORT_SYMBOL(pci_bus_io_base_phys); 146EXPORT_SYMBOL(pci_bus_io_base_phys);
147EXPORT_SYMBOL(pci_bus_mem_base_phys); 147EXPORT_SYMBOL(pci_bus_mem_base_phys);
148EXPORT_SYMBOL(pci_bus_to_hose); 148EXPORT_SYMBOL(pci_bus_to_hose);
149EXPORT_SYMBOL(pci_resource_to_bus);
150EXPORT_SYMBOL(pci_phys_to_bus);
151EXPORT_SYMBOL(pci_bus_to_phys);
152#endif /* CONFIG_PCI */ 149#endif /* CONFIG_PCI */
153 150
154#ifdef CONFIG_NOT_COHERENT_CACHE 151#ifdef CONFIG_NOT_COHERENT_CACHE
diff --git a/include/asm-ppc64/ptrace-common.h b/arch/powerpc/kernel/ptrace-common.h
index b1babb729673..b1babb729673 100644
--- a/include/asm-ppc64/ptrace-common.h
+++ b/arch/powerpc/kernel/ptrace-common.h
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 3d2abd95c7ae..400793c71304 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -36,8 +36,9 @@
36#include <asm/page.h> 36#include <asm/page.h>
37#include <asm/pgtable.h> 37#include <asm/pgtable.h>
38#include <asm/system.h> 38#include <asm/system.h>
39
39#ifdef CONFIG_PPC64 40#ifdef CONFIG_PPC64
40#include <asm/ptrace-common.h> 41#include "ptrace-common.h"
41#endif 42#endif
42 43
43#ifdef CONFIG_PPC32 44#ifdef CONFIG_PPC32
diff --git a/arch/powerpc/kernel/ptrace32.c b/arch/powerpc/kernel/ptrace32.c
index 91eb952e0293..61762640b877 100644
--- a/arch/powerpc/kernel/ptrace32.c
+++ b/arch/powerpc/kernel/ptrace32.c
@@ -33,7 +33,8 @@
33#include <asm/page.h> 33#include <asm/page.h>
34#include <asm/pgtable.h> 34#include <asm/pgtable.h>
35#include <asm/system.h> 35#include <asm/system.h>
36#include <asm/ptrace-common.h> 36
37#include "ptrace-common.h"
37 38
38/* 39/*
39 * does not yet catch signals sent when the child dies. 40 * does not yet catch signals sent when the child dies.
diff --git a/arch/powerpc/mm/imalloc.c b/arch/powerpc/mm/imalloc.c
index f4ca29cf5364..f9587bcc6a48 100644
--- a/arch/powerpc/mm/imalloc.c
+++ b/arch/powerpc/mm/imalloc.c
@@ -14,9 +14,10 @@
14#include <asm/pgalloc.h> 14#include <asm/pgalloc.h>
15#include <asm/pgtable.h> 15#include <asm/pgtable.h>
16#include <asm/semaphore.h> 16#include <asm/semaphore.h>
17#include <asm/imalloc.h>
18#include <asm/cacheflush.h> 17#include <asm/cacheflush.h>
19 18
19#include "mmu_decl.h"
20
20static DECLARE_MUTEX(imlist_sem); 21static DECLARE_MUTEX(imlist_sem);
21struct vm_struct * imlist = NULL; 22struct vm_struct * imlist = NULL;
22 23
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index 1134f70f231d..81cfb0c2ec58 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -64,7 +64,8 @@
64#include <asm/iommu.h> 64#include <asm/iommu.h>
65#include <asm/abs_addr.h> 65#include <asm/abs_addr.h>
66#include <asm/vdso.h> 66#include <asm/vdso.h>
67#include <asm/imalloc.h> 67
68#include "mmu_decl.h"
68 69
69#ifdef DEBUG 70#ifdef DEBUG
70#define DBG(fmt...) printk(fmt) 71#define DBG(fmt...) printk(fmt)
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
index a4d7a327c0e5..bea2d21ac6f7 100644
--- a/arch/powerpc/mm/mmu_decl.h
+++ b/arch/powerpc/mm/mmu_decl.h
@@ -33,7 +33,6 @@ extern void invalidate_tlbcam_entry(int index);
33 33
34extern int __map_without_bats; 34extern int __map_without_bats;
35extern unsigned long ioremap_base; 35extern unsigned long ioremap_base;
36extern unsigned long ioremap_bot;
37extern unsigned int rtas_data, rtas_size; 36extern unsigned int rtas_data, rtas_size;
38 37
39extern PTE *Hash, *Hash_end; 38extern PTE *Hash, *Hash_end;
@@ -42,6 +41,7 @@ extern unsigned long Hash_size, Hash_mask;
42extern unsigned int num_tlbcam_entries; 41extern unsigned int num_tlbcam_entries;
43#endif 42#endif
44 43
44extern unsigned long ioremap_bot;
45extern unsigned long __max_low_memory; 45extern unsigned long __max_low_memory;
46extern unsigned long __initial_memory_limit; 46extern unsigned long __initial_memory_limit;
47extern unsigned long total_memory; 47extern unsigned long total_memory;
@@ -84,4 +84,16 @@ static inline void flush_HPTE(unsigned context, unsigned long va,
84 else 84 else
85 _tlbie(va); 85 _tlbie(va);
86} 86}
87#else /* CONFIG_PPC64 */
88/* imalloc region types */
89#define IM_REGION_UNUSED 0x1
90#define IM_REGION_SUBSET 0x2
91#define IM_REGION_EXISTS 0x4
92#define IM_REGION_OVERLAP 0x8
93#define IM_REGION_SUPERSET 0x10
94
95extern struct vm_struct * im_get_free_area(unsigned long size);
96extern struct vm_struct * im_get_area(unsigned long v_addr, unsigned long size,
97 int region_type);
98extern void im_free(void *addr);
87#endif 99#endif
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index c7f7bb6f30b3..2ffca63602c5 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -64,7 +64,8 @@
64#include <asm/iommu.h> 64#include <asm/iommu.h>
65#include <asm/abs_addr.h> 65#include <asm/abs_addr.h>
66#include <asm/vdso.h> 66#include <asm/vdso.h>
67#include <asm/imalloc.h> 67
68#include "mmu_decl.h"
68 69
69unsigned long ioremap_bot = IMALLOC_BASE; 70unsigned long ioremap_bot = IMALLOC_BASE;
70static unsigned long phbs_io_bot = PHBS_IO_BASE; 71static unsigned long phbs_io_bot = PHBS_IO_BASE;
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index 957b09103422..fb2a7c798e82 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -34,6 +34,7 @@
34#include <linux/errno.h> 34#include <linux/errno.h>
35#include <linux/hardirq.h> 35#include <linux/hardirq.h>
36#include <linux/cpu.h> 36#include <linux/cpu.h>
37#include <linux/compiler.h>
37 38
38#include <asm/ptrace.h> 39#include <asm/ptrace.h>
39#include <asm/atomic.h> 40#include <asm/atomic.h>
@@ -631,8 +632,9 @@ void smp_core99_give_timebase(void)
631 mb(); 632 mb();
632 633
633 /* wait for the secondary to have taken it */ 634 /* wait for the secondary to have taken it */
634 for (t = 100000; t > 0 && sec_tb_reset; --t) 635 /* note: can't use udelay here, since it needs the timebase running */
635 udelay(10); 636 for (t = 10000000; t > 0 && sec_tb_reset; --t)
637 barrier();
636 if (sec_tb_reset) 638 if (sec_tb_reset)
637 /* XXX BUG_ON here? */ 639 /* XXX BUG_ON here? */
638 printk(KERN_WARNING "Timeout waiting sync(2) on second CPU\n"); 640 printk(KERN_WARNING "Timeout waiting sync(2) on second CPU\n");
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 105f05341a41..58d1cc2023c8 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -361,7 +361,8 @@ static void mpic_enable_irq(unsigned int irq)
361 DBG("%p: %s: enable_irq: %d (src %d)\n", mpic, mpic->name, irq, src); 361 DBG("%p: %s: enable_irq: %d (src %d)\n", mpic, mpic->name, irq, src);
362 362
363 mpic_irq_write(src, MPIC_IRQ_VECTOR_PRI, 363 mpic_irq_write(src, MPIC_IRQ_VECTOR_PRI,
364 mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI) & ~MPIC_VECPRI_MASK); 364 mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI) &
365 ~MPIC_VECPRI_MASK);
365 366
366 /* make sure mask gets to controller before we return to user */ 367 /* make sure mask gets to controller before we return to user */
367 do { 368 do {
@@ -381,7 +382,8 @@ static void mpic_disable_irq(unsigned int irq)
381 DBG("%s: disable_irq: %d (src %d)\n", mpic->name, irq, src); 382 DBG("%s: disable_irq: %d (src %d)\n", mpic->name, irq, src);
382 383
383 mpic_irq_write(src, MPIC_IRQ_VECTOR_PRI, 384 mpic_irq_write(src, MPIC_IRQ_VECTOR_PRI,
384 mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI) | MPIC_VECPRI_MASK); 385 mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI) |
386 MPIC_VECPRI_MASK);
385 387
386 /* make sure mask gets to controller before we return to user */ 388 /* make sure mask gets to controller before we return to user */
387 do { 389 do {
@@ -735,12 +737,13 @@ void mpic_irq_set_priority(unsigned int irq, unsigned int pri)
735 737
736 spin_lock_irqsave(&mpic_lock, flags); 738 spin_lock_irqsave(&mpic_lock, flags);
737 if (is_ipi) { 739 if (is_ipi) {
738 reg = mpic_ipi_read(irq - mpic->ipi_offset) & MPIC_VECPRI_PRIORITY_MASK; 740 reg = mpic_ipi_read(irq - mpic->ipi_offset) &
741 ~MPIC_VECPRI_PRIORITY_MASK;
739 mpic_ipi_write(irq - mpic->ipi_offset, 742 mpic_ipi_write(irq - mpic->ipi_offset,
740 reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT)); 743 reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT));
741 } else { 744 } else {
742 reg = mpic_irq_read(irq - mpic->irq_offset, MPIC_IRQ_VECTOR_PRI) 745 reg = mpic_irq_read(irq - mpic->irq_offset,MPIC_IRQ_VECTOR_PRI)
743 & MPIC_VECPRI_PRIORITY_MASK; 746 & ~MPIC_VECPRI_PRIORITY_MASK;
744 mpic_irq_write(irq - mpic->irq_offset, MPIC_IRQ_VECTOR_PRI, 747 mpic_irq_write(irq - mpic->irq_offset, MPIC_IRQ_VECTOR_PRI,
745 reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT)); 748 reg | (pri << MPIC_VECPRI_PRIORITY_SHIFT));
746 } 749 }
diff --git a/drivers/i2c/busses/i2c-ixp2000.c b/drivers/i2c/busses/i2c-ixp2000.c
index cef024a7d048..cd6f45d186ab 100644
--- a/drivers/i2c/busses/i2c-ixp2000.c
+++ b/drivers/i2c/busses/i2c-ixp2000.c
@@ -36,8 +36,6 @@
36#include <asm/hardware.h> /* Pick up IXP2000-specific bits */ 36#include <asm/hardware.h> /* Pick up IXP2000-specific bits */
37#include <asm/arch/gpio.h> 37#include <asm/arch/gpio.h>
38 38
39static struct device_driver ixp2000_i2c_driver;
40
41static inline int ixp2000_scl_pin(void *data) 39static inline int ixp2000_scl_pin(void *data)
42{ 40{
43 return ((struct ixp2000_i2c_pins*)data)->scl_pin; 41 return ((struct ixp2000_i2c_pins*)data)->scl_pin;
@@ -120,7 +118,7 @@ static int ixp2000_i2c_probe(struct platform_device *plat_dev)
120 drv_data->algo_data.timeout = 100; 118 drv_data->algo_data.timeout = 100;
121 119
122 drv_data->adapter.id = I2C_HW_B_IXP2000, 120 drv_data->adapter.id = I2C_HW_B_IXP2000,
123 strlcpy(drv_data->adapter.name, ixp2000_i2c_driver.name, 121 strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name,
124 I2C_NAME_SIZE); 122 I2C_NAME_SIZE);
125 drv_data->adapter.algo_data = &drv_data->algo_data, 123 drv_data->adapter.algo_data = &drv_data->algo_data,
126 124
@@ -132,7 +130,7 @@ static int ixp2000_i2c_probe(struct platform_device *plat_dev)
132 gpio_line_set(gpio->sda_pin, 0); 130 gpio_line_set(gpio->sda_pin, 0);
133 131
134 if ((err = i2c_bit_add_bus(&drv_data->adapter)) != 0) { 132 if ((err = i2c_bit_add_bus(&drv_data->adapter)) != 0) {
135 dev_err(dev, "Could not install, error %d\n", err); 133 dev_err(&plat_dev->dev, "Could not install, error %d\n", err);
136 kfree(drv_data); 134 kfree(drv_data);
137 return err; 135 return err;
138 } 136 }
diff --git a/drivers/i2c/busses/i2c-ixp4xx.c b/drivers/i2c/busses/i2c-ixp4xx.c
index f87220be3c87..e422d8b2d4d6 100644
--- a/drivers/i2c/busses/i2c-ixp4xx.c
+++ b/drivers/i2c/busses/i2c-ixp4xx.c
@@ -35,8 +35,6 @@
35 35
36#include <asm/hardware.h> /* Pick up IXP4xx-specific bits */ 36#include <asm/hardware.h> /* Pick up IXP4xx-specific bits */
37 37
38static struct platform_driver ixp4xx_i2c_driver;
39
40static inline int ixp4xx_scl_pin(void *data) 38static inline int ixp4xx_scl_pin(void *data)
41{ 39{
42 return ((struct ixp4xx_i2c_pins*)data)->scl_pin; 40 return ((struct ixp4xx_i2c_pins*)data)->scl_pin;
@@ -128,7 +126,7 @@ static int ixp4xx_i2c_probe(struct platform_device *plat_dev)
128 drv_data->algo_data.timeout = 100; 126 drv_data->algo_data.timeout = 100;
129 127
130 drv_data->adapter.id = I2C_HW_B_IXP4XX; 128 drv_data->adapter.id = I2C_HW_B_IXP4XX;
131 strlcpy(drv_data->adapter.name, ixp4xx_i2c_driver.driver.name, 129 strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name,
132 I2C_NAME_SIZE); 130 I2C_NAME_SIZE);
133 drv_data->adapter.algo_data = &drv_data->algo_data; 131 drv_data->adapter.algo_data = &drv_data->algo_data;
134 132
@@ -140,8 +138,7 @@ static int ixp4xx_i2c_probe(struct platform_device *plat_dev)
140 gpio_line_set(gpio->sda_pin, 0); 138 gpio_line_set(gpio->sda_pin, 0);
141 139
142 if ((err = i2c_bit_add_bus(&drv_data->adapter) != 0)) { 140 if ((err = i2c_bit_add_bus(&drv_data->adapter) != 0)) {
143 printk(KERN_ERR "ERROR: Could not install %s\n", 141 printk(KERN_ERR "ERROR: Could not install %s\n", plat_dev->dev.bus_id);
144 plat_dev->dev.bus_id);
145 142
146 kfree(drv_data); 143 kfree(drv_data);
147 return err; 144 return err;
diff --git a/drivers/mtd/maps/ipaq-flash.c b/drivers/mtd/maps/ipaq-flash.c
index 35097c9bbf50..b8ccb0a95789 100644
--- a/drivers/mtd/maps/ipaq-flash.c
+++ b/drivers/mtd/maps/ipaq-flash.c
@@ -246,7 +246,7 @@ int __init ipaq_mtd_init(void)
246 ipaq_map[i].size = h3xxx_max_flash_size; 246 ipaq_map[i].size = h3xxx_max_flash_size;
247 ipaq_map[i].set_vpp = h3xxx_set_vpp; 247 ipaq_map[i].set_vpp = h3xxx_set_vpp;
248 ipaq_map[i].phys = cs_phys[i]; 248 ipaq_map[i].phys = cs_phys[i];
249 ipaq_map[i].virt = __ioremap(cs_phys[i], 0x04000000, 0, 1); 249 ipaq_map[i].virt = ioremap(cs_phys[i], 0x04000000);
250 if (machine_is_h3100 () || machine_is_h1900()) 250 if (machine_is_h3100 () || machine_is_h1900())
251 ipaq_map[i].bankwidth = 2; 251 ipaq_map[i].bankwidth = 2;
252 } 252 }
@@ -280,7 +280,7 @@ int __init ipaq_mtd_init(void)
280 nb_parts = ARRAY_SIZE(jornada_partitions); 280 nb_parts = ARRAY_SIZE(jornada_partitions);
281 ipaq_map[0].size = jornada_max_flash_size; 281 ipaq_map[0].size = jornada_max_flash_size;
282 ipaq_map[0].set_vpp = jornada56x_set_vpp; 282 ipaq_map[0].set_vpp = jornada56x_set_vpp;
283 ipaq_map[0].virt = (__u32)__ioremap(0x0, 0x04000000, 0, 1); 283 ipaq_map[0].virt = (__u32)ioremap(0x0, 0x04000000);
284 } 284 }
285#endif 285#endif
286#ifdef CONFIG_SA1100_JORNADA720 286#ifdef CONFIG_SA1100_JORNADA720
@@ -442,7 +442,7 @@ static int __init h1900_special_case(void)
442 ipaq_map[0].size = 0x80000; 442 ipaq_map[0].size = 0x80000;
443 ipaq_map[0].set_vpp = h3xxx_set_vpp; 443 ipaq_map[0].set_vpp = h3xxx_set_vpp;
444 ipaq_map[0].phys = 0x0; 444 ipaq_map[0].phys = 0x0;
445 ipaq_map[0].virt = __ioremap(0x0, 0x04000000, 0, 1); 445 ipaq_map[0].virt = ioremap(0x0, 0x04000000);
446 ipaq_map[0].bankwidth = 2; 446 ipaq_map[0].bankwidth = 2;
447 447
448 printk(KERN_NOTICE "iPAQ flash: probing %d-bit flash bus, window=%lx with JEDEC.\n", ipaq_map[0].bankwidth*8, ipaq_map[0].virt); 448 printk(KERN_NOTICE "iPAQ flash: probing %d-bit flash bus, window=%lx with JEDEC.\n", ipaq_map[0].bankwidth*8, ipaq_map[0].virt);
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c
index fc7a78e31735..2c9cc7f37e92 100644
--- a/drivers/mtd/maps/ixp2000.c
+++ b/drivers/mtd/maps/ixp2000.c
@@ -159,12 +159,12 @@ static int ixp2000_flash_probe(struct platform_device *dev)
159 return -ENODEV; 159 return -ENODEV;
160 160
161 window_size = dev->resource->end - dev->resource->start + 1; 161 window_size = dev->resource->end - dev->resource->start + 1;
162 dev_info(_dev, "Probe of IXP2000 flash(%d banks x %dMiB)\n", 162 dev_info(&dev->dev, "Probe of IXP2000 flash(%d banks x %dMiB)\n",
163 ixp_data->nr_banks, ((u32)window_size >> 20)); 163 ixp_data->nr_banks, ((u32)window_size >> 20));
164 164
165 if (plat->width != 1) { 165 if (plat->width != 1) {
166 dev_err(_dev, "IXP2000 MTD map only supports 8-bit mode, asking for %d\n", 166 dev_err(&dev->dev, "IXP2000 MTD map only supports 8-bit mode, asking for %d\n",
167 plat->width * 8); 167 plat->width * 8);
168 return -EIO; 168 return -EIO;
169 } 169 }
170 170
@@ -202,7 +202,7 @@ static int ixp2000_flash_probe(struct platform_device *dev)
202 dev->resource->end - dev->resource->start + 1, 202 dev->resource->end - dev->resource->start + 1,
203 dev->dev.bus_id); 203 dev->dev.bus_id);
204 if (!info->res) { 204 if (!info->res) {
205 dev_err(_dev, "Could not reserve memory region\n"); 205 dev_err(&dev->dev, "Could not reserve memory region\n");
206 err = -ENOMEM; 206 err = -ENOMEM;
207 goto Error; 207 goto Error;
208 } 208 }
@@ -210,7 +210,7 @@ static int ixp2000_flash_probe(struct platform_device *dev)
210 info->map.map_priv_1 = (unsigned long) ioremap(dev->resource->start, 210 info->map.map_priv_1 = (unsigned long) ioremap(dev->resource->start,
211 dev->resource->end - dev->resource->start + 1); 211 dev->resource->end - dev->resource->start + 1);
212 if (!info->map.map_priv_1) { 212 if (!info->map.map_priv_1) {
213 dev_err(_dev, "Failed to ioremap flash region\n"); 213 dev_err(&dev->dev, "Failed to ioremap flash region\n");
214 err = -EIO; 214 err = -EIO;
215 goto Error; 215 goto Error;
216 } 216 }
@@ -221,13 +221,13 @@ static int ixp2000_flash_probe(struct platform_device *dev)
221 */ 221 */
222 222
223 erratum44_workaround = ixp2000_has_broken_slowport(); 223 erratum44_workaround = ixp2000_has_broken_slowport();
224 dev_info(_dev, "Erratum 44 workaround %s\n", 224 dev_info(&dev->dev, "Erratum 44 workaround %s\n",
225 erratum44_workaround ? "enabled" : "disabled"); 225 erratum44_workaround ? "enabled" : "disabled");
226#endif 226#endif
227 227
228 info->mtd = do_map_probe(plat->map_name, &info->map); 228 info->mtd = do_map_probe(plat->map_name, &info->map);
229 if (!info->mtd) { 229 if (!info->mtd) {
230 dev_err(_dev, "map_probe failed\n"); 230 dev_err(&dev->dev, "map_probe failed\n");
231 err = -ENXIO; 231 err = -ENXIO;
232 goto Error; 232 goto Error;
233 } 233 }
@@ -237,7 +237,7 @@ static int ixp2000_flash_probe(struct platform_device *dev)
237 if (err > 0) { 237 if (err > 0) {
238 err = add_mtd_partitions(info->mtd, info->partitions, err); 238 err = add_mtd_partitions(info->mtd, info->partitions, err);
239 if(err) 239 if(err)
240 dev_err(_dev, "Could not parse partitions\n"); 240 dev_err(&dev->dev, "Could not parse partitions\n");
241 } 241 }
242 242
243 if (err) 243 if (err)
@@ -251,8 +251,8 @@ Error:
251} 251}
252 252
253static struct platform_driver ixp2000_flash_driver = { 253static struct platform_driver ixp2000_flash_driver = {
254 .probe = &ixp2000_flash_probe, 254 .probe = ixp2000_flash_probe,
255 .remove = &ixp2000_flash_remove 255 .remove = ixp2000_flash_remove,
256 .driver = { 256 .driver = {
257 .name = "IXP2000-Flash", 257 .name = "IXP2000-Flash",
258 }, 258 },
diff --git a/drivers/mtd/nand/h1910.c b/drivers/mtd/nand/h1910.c
index 041e4b3358fb..f68f7a99a630 100644
--- a/drivers/mtd/nand/h1910.c
+++ b/drivers/mtd/nand/h1910.c
@@ -112,7 +112,7 @@ static int __init h1910_init (void)
112 if (!machine_is_h1900()) 112 if (!machine_is_h1900())
113 return -ENODEV; 113 return -ENODEV;
114 114
115 nandaddr = __ioremap(0x08000000, 0x1000, 0, 1); 115 nandaddr = ioremap(0x08000000, 0x1000);
116 if (!nandaddr) { 116 if (!nandaddr) {
117 printk("Failed to ioremap nand flash.\n"); 117 printk("Failed to ioremap nand flash.\n");
118 return -ENOMEM; 118 return -ENOMEM;
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index 938d185841c9..89d7bd3eaee3 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -49,7 +49,6 @@
49#include <linux/serial.h> 49#include <linux/serial.h>
50 50
51#include <asm/io.h> 51#include <asm/io.h>
52#include <asm/irq.h>
53#include <asm/sizes.h> 52#include <asm/sizes.h>
54#include <asm/hardware/amba.h> 53#include <asm/hardware/amba.h>
55#include <asm/hardware/clock.h> 54#include <asm/hardware/clock.h>
@@ -63,7 +62,8 @@
63 62
64#define AMBA_ISR_PASS_LIMIT 256 63#define AMBA_ISR_PASS_LIMIT 256
65 64
66#define UART_DUMMY_RSR_RX 256 65#define UART_DR_ERROR (UART011_DR_OE|UART011_DR_BE|UART011_DR_PE|UART011_DR_FE)
66#define UART_DUMMY_DR_RX (1 << 16)
67 67
68/* 68/*
69 * We wrap our port structure around the generic uart_port. 69 * We wrap our port structure around the generic uart_port.
@@ -116,7 +116,7 @@ pl011_rx_chars(struct uart_amba_port *uap)
116#endif 116#endif
117{ 117{
118 struct tty_struct *tty = uap->port.info->tty; 118 struct tty_struct *tty = uap->port.info->tty;
119 unsigned int status, ch, flag, rsr, max_count = 256; 119 unsigned int status, ch, flag, max_count = 256;
120 120
121 status = readw(uap->port.membase + UART01x_FR); 121 status = readw(uap->port.membase + UART01x_FR);
122 while ((status & UART01x_FR_RXFE) == 0 && max_count--) { 122 while ((status & UART01x_FR_RXFE) == 0 && max_count--) {
@@ -129,7 +129,7 @@ pl011_rx_chars(struct uart_amba_port *uap)
129 */ 129 */
130 } 130 }
131 131
132 ch = readw(uap->port.membase + UART01x_DR); 132 ch = readw(uap->port.membase + UART01x_DR) | UART_DUMMY_DR_RX;
133 flag = TTY_NORMAL; 133 flag = TTY_NORMAL;
134 uap->port.icount.rx++; 134 uap->port.icount.rx++;
135 135
@@ -137,34 +137,33 @@ pl011_rx_chars(struct uart_amba_port *uap)
137 * Note that the error handling code is 137 * Note that the error handling code is
138 * out of the main execution path 138 * out of the main execution path
139 */ 139 */
140 rsr = readw(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX; 140 if (unlikely(ch & UART_DR_ERROR)) {
141 if (unlikely(rsr & UART01x_RSR_ANY)) { 141 if (ch & UART011_DR_BE) {
142 if (rsr & UART01x_RSR_BE) { 142 ch &= ~(UART011_DR_FE | UART011_DR_PE);
143 rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE);
144 uap->port.icount.brk++; 143 uap->port.icount.brk++;
145 if (uart_handle_break(&uap->port)) 144 if (uart_handle_break(&uap->port))
146 goto ignore_char; 145 goto ignore_char;
147 } else if (rsr & UART01x_RSR_PE) 146 } else if (ch & UART011_DR_PE)
148 uap->port.icount.parity++; 147 uap->port.icount.parity++;
149 else if (rsr & UART01x_RSR_FE) 148 else if (ch & UART011_DR_FE)
150 uap->port.icount.frame++; 149 uap->port.icount.frame++;
151 if (rsr & UART01x_RSR_OE) 150 if (ch & UART011_DR_OE)
152 uap->port.icount.overrun++; 151 uap->port.icount.overrun++;
153 152
154 rsr &= uap->port.read_status_mask; 153 ch &= uap->port.read_status_mask;
155 154
156 if (rsr & UART01x_RSR_BE) 155 if (ch & UART011_DR_BE)
157 flag = TTY_BREAK; 156 flag = TTY_BREAK;
158 else if (rsr & UART01x_RSR_PE) 157 else if (ch & UART011_DR_PE)
159 flag = TTY_PARITY; 158 flag = TTY_PARITY;
160 else if (rsr & UART01x_RSR_FE) 159 else if (ch & UART011_DR_FE)
161 flag = TTY_FRAME; 160 flag = TTY_FRAME;
162 } 161 }
163 162
164 if (uart_handle_sysrq_char(&uap->port, ch, regs)) 163 if (uart_handle_sysrq_char(&uap->port, ch, regs))
165 goto ignore_char; 164 goto ignore_char;
166 165
167 uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag); 166 uart_insert_char(&uap->port, ch, UART011_DR_OE, ch, flag);
168 167
169 ignore_char: 168 ignore_char:
170 status = readw(uap->port.membase + UART01x_FR); 169 status = readw(uap->port.membase + UART01x_FR);
@@ -476,33 +475,33 @@ pl011_set_termios(struct uart_port *port, struct termios *termios,
476 */ 475 */
477 uart_update_timeout(port, termios->c_cflag, baud); 476 uart_update_timeout(port, termios->c_cflag, baud);
478 477
479 port->read_status_mask = UART01x_RSR_OE; 478 port->read_status_mask = UART011_DR_OE | 255;
480 if (termios->c_iflag & INPCK) 479 if (termios->c_iflag & INPCK)
481 port->read_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE; 480 port->read_status_mask |= UART011_DR_FE | UART011_DR_PE;
482 if (termios->c_iflag & (BRKINT | PARMRK)) 481 if (termios->c_iflag & (BRKINT | PARMRK))
483 port->read_status_mask |= UART01x_RSR_BE; 482 port->read_status_mask |= UART011_DR_BE;
484 483
485 /* 484 /*
486 * Characters to ignore 485 * Characters to ignore
487 */ 486 */
488 port->ignore_status_mask = 0; 487 port->ignore_status_mask = 0;
489 if (termios->c_iflag & IGNPAR) 488 if (termios->c_iflag & IGNPAR)
490 port->ignore_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE; 489 port->ignore_status_mask |= UART011_DR_FE | UART011_DR_PE;
491 if (termios->c_iflag & IGNBRK) { 490 if (termios->c_iflag & IGNBRK) {
492 port->ignore_status_mask |= UART01x_RSR_BE; 491 port->ignore_status_mask |= UART011_DR_BE;
493 /* 492 /*
494 * If we're ignoring parity and break indicators, 493 * If we're ignoring parity and break indicators,
495 * ignore overruns too (for real raw support). 494 * ignore overruns too (for real raw support).
496 */ 495 */
497 if (termios->c_iflag & IGNPAR) 496 if (termios->c_iflag & IGNPAR)
498 port->ignore_status_mask |= UART01x_RSR_OE; 497 port->ignore_status_mask |= UART011_DR_OE;
499 } 498 }
500 499
501 /* 500 /*
502 * Ignore all characters if CREAD is not set. 501 * Ignore all characters if CREAD is not set.
503 */ 502 */
504 if ((termios->c_cflag & CREAD) == 0) 503 if ((termios->c_cflag & CREAD) == 0)
505 port->ignore_status_mask |= UART_DUMMY_RSR_RX; 504 port->ignore_status_mask |= UART_DUMMY_DR_RX;
506 505
507 if (UART_ENABLE_MS(port, termios->c_cflag)) 506 if (UART_ENABLE_MS(port, termios->c_cflag))
508 pl011_enable_ms(port); 507 pl011_enable_ms(port);
diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c
index 0e3daf6d7b50..25a086458ab9 100644
--- a/drivers/serial/sa1100.c
+++ b/drivers/serial/sa1100.c
@@ -161,7 +161,6 @@ static void sa1100_stop_tx(struct uart_port *port)
161static void sa1100_start_tx(struct uart_port *port) 161static void sa1100_start_tx(struct uart_port *port)
162{ 162{
163 struct sa1100_port *sport = (struct sa1100_port *)port; 163 struct sa1100_port *sport = (struct sa1100_port *)port;
164 unsigned long flags;
165 u32 utcr3; 164 u32 utcr3;
166 165
167 utcr3 = UART_GET_UTCR3(sport); 166 utcr3 = UART_GET_UTCR3(sport);
diff --git a/include/asm-arm/arch-ixp4xx/io.h b/include/asm-arm/arch-ixp4xx/io.h
index 688f7f90d93e..942b622455bc 100644
--- a/include/asm-arm/arch-ixp4xx/io.h
+++ b/include/asm-arm/arch-ixp4xx/io.h
@@ -59,11 +59,10 @@ extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data);
59 * fallback to the default. 59 * fallback to the default.
60 */ 60 */
61static inline void __iomem * 61static inline void __iomem *
62__ixp4xx_ioremap(unsigned long addr, size_t size, unsigned long flags, unsigned long align) 62__ixp4xx_ioremap(unsigned long addr, size_t size, unsigned long flags)
63{ 63{
64 extern void __iomem * __ioremap(unsigned long, size_t, unsigned long, unsigned long);
65 if((addr < 0x48000000) || (addr > 0x4fffffff)) 64 if((addr < 0x48000000) || (addr > 0x4fffffff))
66 return __ioremap(addr, size, flags, align); 65 return __ioremap(addr, size, flags);
67 66
68 return (void *)addr; 67 return (void *)addr;
69} 68}
@@ -71,13 +70,11 @@ __ixp4xx_ioremap(unsigned long addr, size_t size, unsigned long flags, unsigned
71static inline void 70static inline void
72__ixp4xx_iounmap(void __iomem *addr) 71__ixp4xx_iounmap(void __iomem *addr)
73{ 72{
74 extern void __iounmap(void __iomem *addr);
75
76 if ((u32)addr >= VMALLOC_START) 73 if ((u32)addr >= VMALLOC_START)
77 __iounmap(addr); 74 __iounmap(addr);
78} 75}
79 76
80#define __arch_ioremap(a, s, f, x) __ixp4xx_ioremap(a, s, f, x) 77#define __arch_ioremap(a, s, f) __ixp4xx_ioremap(a, s, f)
81#define __arch_iounmap(a) __ixp4xx_iounmap(a) 78#define __arch_iounmap(a) __ixp4xx_iounmap(a)
82 79
83#define writeb(v, p) __ixp4xx_writeb(v, p) 80#define writeb(v, p) __ixp4xx_writeb(v, p)
diff --git a/include/asm-arm/hardware/amba_serial.h b/include/asm-arm/hardware/amba_serial.h
index 71770aa6389f..dc726ffccebd 100644
--- a/include/asm-arm/hardware/amba_serial.h
+++ b/include/asm-arm/hardware/amba_serial.h
@@ -50,6 +50,11 @@
50#define UART011_ICR 0x44 /* Interrupt clear register. */ 50#define UART011_ICR 0x44 /* Interrupt clear register. */
51#define UART011_DMACR 0x48 /* DMA control register. */ 51#define UART011_DMACR 0x48 /* DMA control register. */
52 52
53#define UART011_DR_OE (1 << 11)
54#define UART011_DR_BE (1 << 10)
55#define UART011_DR_PE (1 << 9)
56#define UART011_DR_FE (1 << 8)
57
53#define UART01x_RSR_OE 0x08 58#define UART01x_RSR_OE 0x08
54#define UART01x_RSR_BE 0x04 59#define UART01x_RSR_BE 0x04
55#define UART01x_RSR_PE 0x02 60#define UART01x_RSR_PE 0x02
diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h
index 2e6799632f12..ae69db4a1010 100644
--- a/include/asm-arm/io.h
+++ b/include/asm-arm/io.h
@@ -55,6 +55,12 @@ extern void __raw_readsl(void __iomem *addr, void *data, int longlen);
55#define __raw_readl(a) (__chk_io_ptr(a), *(volatile unsigned int __force *)(a)) 55#define __raw_readl(a) (__chk_io_ptr(a), *(volatile unsigned int __force *)(a))
56 56
57/* 57/*
58 * Architecture ioremap implementation.
59 */
60extern void __iomem * __ioremap(unsigned long, size_t, unsigned long);
61extern void __iounmap(void __iomem *addr);
62
63/*
58 * Bad read/write accesses... 64 * Bad read/write accesses...
59 */ 65 */
60extern void __readwrite_bug(const char *fn); 66extern void __readwrite_bug(const char *fn);
@@ -256,18 +262,15 @@ out:
256 * ioremap takes a PCI memory address, as specified in 262 * ioremap takes a PCI memory address, as specified in
257 * Documentation/IO-mapping.txt. 263 * Documentation/IO-mapping.txt.
258 */ 264 */
259extern void __iomem * __ioremap(unsigned long, size_t, unsigned long, unsigned long);
260extern void __iounmap(void __iomem *addr);
261
262#ifndef __arch_ioremap 265#ifndef __arch_ioremap
263#define ioremap(cookie,size) __ioremap(cookie,size,0,1) 266#define ioremap(cookie,size) __ioremap(cookie,size,0)
264#define ioremap_nocache(cookie,size) __ioremap(cookie,size,0,1) 267#define ioremap_nocache(cookie,size) __ioremap(cookie,size,0)
265#define ioremap_cached(cookie,size) __ioremap(cookie,size,L_PTE_CACHEABLE,1) 268#define ioremap_cached(cookie,size) __ioremap(cookie,size,L_PTE_CACHEABLE)
266#define iounmap(cookie) __iounmap(cookie) 269#define iounmap(cookie) __iounmap(cookie)
267#else 270#else
268#define ioremap(cookie,size) __arch_ioremap((cookie),(size),0,1) 271#define ioremap(cookie,size) __arch_ioremap((cookie),(size),0)
269#define ioremap_nocache(cookie,size) __arch_ioremap((cookie),(size),0,1) 272#define ioremap_nocache(cookie,size) __arch_ioremap((cookie),(size),0)
270#define ioremap_cached(cookie,size) __arch_ioremap((cookie),(size),L_PTE_CACHEABLE,1) 273#define ioremap_cached(cookie,size) __arch_ioremap((cookie),(size),L_PTE_CACHEABLE)
271#define iounmap(cookie) __arch_iounmap(cookie) 274#define iounmap(cookie) __arch_iounmap(cookie)
272#endif 275#endif
273 276
diff --git a/include/asm-arm/uaccess.h b/include/asm-arm/uaccess.h
index a2fdad0138b3..064f0f5e8e2b 100644
--- a/include/asm-arm/uaccess.h
+++ b/include/asm-arm/uaccess.h
@@ -100,7 +100,6 @@ static inline void set_fs (mm_segment_t fs)
100extern int __get_user_1(void *); 100extern int __get_user_1(void *);
101extern int __get_user_2(void *); 101extern int __get_user_2(void *);
102extern int __get_user_4(void *); 102extern int __get_user_4(void *);
103extern int __get_user_8(void *);
104extern int __get_user_bad(void); 103extern int __get_user_bad(void);
105 104
106#define __get_user_x(__r2,__p,__e,__s,__i...) \ 105#define __get_user_x(__r2,__p,__e,__s,__i...) \
@@ -114,7 +113,7 @@ extern int __get_user_bad(void);
114#define get_user(x,p) \ 113#define get_user(x,p) \
115 ({ \ 114 ({ \
116 const register typeof(*(p)) __user *__p asm("r0") = (p);\ 115 const register typeof(*(p)) __user *__p asm("r0") = (p);\
117 register typeof(*(p)) __r2 asm("r2"); \ 116 register unsigned int __r2 asm("r2"); \
118 register int __e asm("r0"); \ 117 register int __e asm("r0"); \
119 switch (sizeof(*(__p))) { \ 118 switch (sizeof(*(__p))) { \
120 case 1: \ 119 case 1: \
@@ -126,12 +125,9 @@ extern int __get_user_bad(void);
126 case 4: \ 125 case 4: \
127 __get_user_x(__r2, __p, __e, 4, "lr"); \ 126 __get_user_x(__r2, __p, __e, 4, "lr"); \
128 break; \ 127 break; \
129 case 8: \
130 __get_user_x(__r2, __p, __e, 8, "lr"); \
131 break; \
132 default: __e = __get_user_bad(); break; \ 128 default: __e = __get_user_bad(); break; \
133 } \ 129 } \
134 x = __r2; \ 130 x = (typeof(*(p))) __r2; \
135 __e; \ 131 __e; \
136 }) 132 })
137 133
diff --git a/include/asm-ppc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h
index 6e9635114433..59a80163f75f 100644
--- a/include/asm-ppc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -1,15 +1,22 @@
1/* 1/*
2 * This is based on both include/asm-sh/dma-mapping.h and 2 * Copyright (C) 2004 IBM
3 * include/asm-ppc/pci.h 3 *
4 * Implements the generic device dma API for powerpc.
5 * the pci and vio busses
4 */ 6 */
5#ifndef __ASM_PPC_DMA_MAPPING_H 7#ifndef _ASM_DMA_MAPPING_H
6#define __ASM_PPC_DMA_MAPPING_H 8#define _ASM_DMA_MAPPING_H
7 9
8#include <linux/config.h> 10#include <linux/config.h>
11#include <linux/types.h>
12#include <linux/cache.h>
9/* need struct page definitions */ 13/* need struct page definitions */
10#include <linux/mm.h> 14#include <linux/mm.h>
11#include <asm/scatterlist.h> 15#include <asm/scatterlist.h>
12#include <asm/io.h> 16#include <asm/io.h>
17#include <asm/bug.h>
18
19#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
13 20
14#ifdef CONFIG_NOT_COHERENT_CACHE 21#ifdef CONFIG_NOT_COHERENT_CACHE
15/* 22/*
@@ -24,22 +31,12 @@ extern void __dma_free_coherent(size_t size, void *vaddr);
24extern void __dma_sync(void *vaddr, size_t size, int direction); 31extern void __dma_sync(void *vaddr, size_t size, int direction);
25extern void __dma_sync_page(struct page *page, unsigned long offset, 32extern void __dma_sync_page(struct page *page, unsigned long offset,
26 size_t size, int direction); 33 size_t size, int direction);
27#define dma_cache_inv(_start,_size) \
28 invalidate_dcache_range(_start, (_start + _size))
29#define dma_cache_wback(_start,_size) \
30 clean_dcache_range(_start, (_start + _size))
31#define dma_cache_wback_inv(_start,_size) \
32 flush_dcache_range(_start, (_start + _size))
33 34
34#else /* ! CONFIG_NOT_COHERENT_CACHE */ 35#else /* ! CONFIG_NOT_COHERENT_CACHE */
35/* 36/*
36 * Cache coherent cores. 37 * Cache coherent cores.
37 */ 38 */
38 39
39#define dma_cache_inv(_start,_size) do { } while (0)
40#define dma_cache_wback(_start,_size) do { } while (0)
41#define dma_cache_wback_inv(_start,_size) do { } while (0)
42
43#define __dma_alloc_coherent(gfp, size, handle) NULL 40#define __dma_alloc_coherent(gfp, size, handle) NULL
44#define __dma_free_coherent(size, addr) do { } while (0) 41#define __dma_free_coherent(size, addr) do { } while (0)
45#define __dma_sync(addr, size, rw) do { } while (0) 42#define __dma_sync(addr, size, rw) do { } while (0)
@@ -47,6 +44,30 @@ extern void __dma_sync_page(struct page *page, unsigned long offset,
47 44
48#endif /* ! CONFIG_NOT_COHERENT_CACHE */ 45#endif /* ! CONFIG_NOT_COHERENT_CACHE */
49 46
47#ifdef CONFIG_PPC64
48
49extern int dma_supported(struct device *dev, u64 mask);
50extern int dma_set_mask(struct device *dev, u64 dma_mask);
51extern void *dma_alloc_coherent(struct device *dev, size_t size,
52 dma_addr_t *dma_handle, gfp_t flag);
53extern void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
54 dma_addr_t dma_handle);
55extern dma_addr_t dma_map_single(struct device *dev, void *cpu_addr,
56 size_t size, enum dma_data_direction direction);
57extern void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
58 size_t size, enum dma_data_direction direction);
59extern dma_addr_t dma_map_page(struct device *dev, struct page *page,
60 unsigned long offset, size_t size,
61 enum dma_data_direction direction);
62extern void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
63 size_t size, enum dma_data_direction direction);
64extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
65 enum dma_data_direction direction);
66extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
67 int nhwentries, enum dma_data_direction direction);
68
69#else /* CONFIG_PPC64 */
70
50#define dma_supported(dev, mask) (1) 71#define dma_supported(dev, mask) (1)
51 72
52static inline int dma_set_mask(struct device *dev, u64 dma_mask) 73static inline int dma_set_mask(struct device *dev, u64 dma_mask)
@@ -144,29 +165,27 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
144/* We don't do anything here. */ 165/* We don't do anything here. */
145#define dma_unmap_sg(dev, sg, nents, dir) do { } while (0) 166#define dma_unmap_sg(dev, sg, nents, dir) do { } while (0)
146 167
147static inline void 168#endif /* CONFIG_PPC64 */
148dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, 169
149 size_t size, 170static inline void dma_sync_single_for_cpu(struct device *dev,
150 enum dma_data_direction direction) 171 dma_addr_t dma_handle, size_t size,
172 enum dma_data_direction direction)
151{ 173{
152 BUG_ON(direction == DMA_NONE); 174 BUG_ON(direction == DMA_NONE);
153
154 __dma_sync(bus_to_virt(dma_handle), size, direction); 175 __dma_sync(bus_to_virt(dma_handle), size, direction);
155} 176}
156 177
157static inline void 178static inline void dma_sync_single_for_device(struct device *dev,
158dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, 179 dma_addr_t dma_handle, size_t size,
159 size_t size, 180 enum dma_data_direction direction)
160 enum dma_data_direction direction)
161{ 181{
162 BUG_ON(direction == DMA_NONE); 182 BUG_ON(direction == DMA_NONE);
163
164 __dma_sync(bus_to_virt(dma_handle), size, direction); 183 __dma_sync(bus_to_virt(dma_handle), size, direction);
165} 184}
166 185
167static inline void 186static inline void dma_sync_sg_for_cpu(struct device *dev,
168dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents, 187 struct scatterlist *sg, int nents,
169 enum dma_data_direction direction) 188 enum dma_data_direction direction)
170{ 189{
171 int i; 190 int i;
172 191
@@ -176,9 +195,9 @@ dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
176 __dma_sync_page(sg->page, sg->offset, sg->length, direction); 195 __dma_sync_page(sg->page, sg->offset, sg->length, direction);
177} 196}
178 197
179static inline void 198static inline void dma_sync_sg_for_device(struct device *dev,
180dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents, 199 struct scatterlist *sg, int nents,
181 enum dma_data_direction direction) 200 enum dma_data_direction direction)
182{ 201{
183 int i; 202 int i;
184 203
@@ -188,6 +207,15 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents,
188 __dma_sync_page(sg->page, sg->offset, sg->length, direction); 207 __dma_sync_page(sg->page, sg->offset, sg->length, direction);
189} 208}
190 209
210static inline int dma_mapping_error(dma_addr_t dma_addr)
211{
212#ifdef CONFIG_PPC64
213 return (dma_addr == DMA_ERROR_CODE);
214#else
215 return 0;
216#endif
217}
218
191#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) 219#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
192#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) 220#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
193#ifdef CONFIG_NOT_COHERENT_CACHE 221#ifdef CONFIG_NOT_COHERENT_CACHE
@@ -198,40 +226,60 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents,
198 226
199static inline int dma_get_cache_alignment(void) 227static inline int dma_get_cache_alignment(void)
200{ 228{
229#ifdef CONFIG_PPC64
230 /* no easy way to get cache size on all processors, so return
231 * the maximum possible, to be safe */
232 return (1 << L1_CACHE_SHIFT_MAX);
233#else
201 /* 234 /*
202 * Each processor family will define its own L1_CACHE_SHIFT, 235 * Each processor family will define its own L1_CACHE_SHIFT,
203 * L1_CACHE_BYTES wraps to this, so this is always safe. 236 * L1_CACHE_BYTES wraps to this, so this is always safe.
204 */ 237 */
205 return L1_CACHE_BYTES; 238 return L1_CACHE_BYTES;
239#endif
206} 240}
207 241
208static inline void 242static inline void dma_sync_single_range_for_cpu(struct device *dev,
209dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle, 243 dma_addr_t dma_handle, unsigned long offset, size_t size,
210 unsigned long offset, size_t size, 244 enum dma_data_direction direction)
211 enum dma_data_direction direction)
212{ 245{
213 /* just sync everything for now */ 246 /* just sync everything for now */
214 dma_sync_single_for_cpu(dev, dma_handle, offset + size, direction); 247 dma_sync_single_for_cpu(dev, dma_handle, offset + size, direction);
215} 248}
216 249
217static inline void 250static inline void dma_sync_single_range_for_device(struct device *dev,
218dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle, 251 dma_addr_t dma_handle, unsigned long offset, size_t size,
219 unsigned long offset, size_t size, 252 enum dma_data_direction direction)
220 enum dma_data_direction direction)
221{ 253{
222 /* just sync everything for now */ 254 /* just sync everything for now */
223 dma_sync_single_for_device(dev, dma_handle, offset + size, direction); 255 dma_sync_single_for_device(dev, dma_handle, offset + size, direction);
224} 256}
225 257
226static inline void dma_cache_sync(void *vaddr, size_t size, 258static inline void dma_cache_sync(void *vaddr, size_t size,
227 enum dma_data_direction direction) 259 enum dma_data_direction direction)
228{ 260{
261 BUG_ON(direction == DMA_NONE);
229 __dma_sync(vaddr, size, (int)direction); 262 __dma_sync(vaddr, size, (int)direction);
230} 263}
231 264
232static inline int dma_mapping_error(dma_addr_t dma_addr) 265/*
233{ 266 * DMA operations are abstracted for G5 vs. i/pSeries, PCI vs. VIO
234 return 0; 267 */
235} 268struct dma_mapping_ops {
236 269 void * (*alloc_coherent)(struct device *dev, size_t size,
237#endif /* __ASM_PPC_DMA_MAPPING_H */ 270 dma_addr_t *dma_handle, gfp_t flag);
271 void (*free_coherent)(struct device *dev, size_t size,
272 void *vaddr, dma_addr_t dma_handle);
273 dma_addr_t (*map_single)(struct device *dev, void *ptr,
274 size_t size, enum dma_data_direction direction);
275 void (*unmap_single)(struct device *dev, dma_addr_t dma_addr,
276 size_t size, enum dma_data_direction direction);
277 int (*map_sg)(struct device *dev, struct scatterlist *sg,
278 int nents, enum dma_data_direction direction);
279 void (*unmap_sg)(struct device *dev, struct scatterlist *sg,
280 int nents, enum dma_data_direction direction);
281 int (*dma_supported)(struct device *dev, u64 mask);
282 int (*dac_dma_supported)(struct device *dev, u64 mask);
283};
284
285#endif /* _ASM_DMA_MAPPING_H */
diff --git a/include/asm-ppc64/io.h b/include/asm-powerpc/io.h
index 77fc07c3c6bd..48938d84d055 100644
--- a/include/asm-ppc64/io.h
+++ b/include/asm-powerpc/io.h
@@ -1,5 +1,5 @@
1#ifndef _PPC64_IO_H 1#ifndef _ASM_POWERPC_IO_H
2#define _PPC64_IO_H 2#define _ASM_POWERPC_IO_H
3 3
4/* 4/*
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -8,7 +8,10 @@
8 * 2 of the License, or (at your option) any later version. 8 * 2 of the License, or (at your option) any later version.
9 */ 9 */
10 10
11#include <linux/config.h> 11#ifndef CONFIG_PPC64
12#include <asm-ppc/io.h>
13#else
14
12#include <linux/compiler.h> 15#include <linux/compiler.h>
13#include <asm/page.h> 16#include <asm/page.h>
14#include <asm/byteorder.h> 17#include <asm/byteorder.h>
@@ -455,4 +458,5 @@ extern int check_legacy_ioport(unsigned long base_port);
455 458
456#endif /* __KERNEL__ */ 459#endif /* __KERNEL__ */
457 460
458#endif /* _PPC64_IO_H */ 461#endif /* CONFIG_PPC64 */
462#endif /* _ASM_POWERPC_IO_H */
diff --git a/include/asm-ppc64/mmu.h b/include/asm-powerpc/mmu.h
index 1a7e0afa2dc6..c1b4bbabbe97 100644
--- a/include/asm-ppc64/mmu.h
+++ b/include/asm-powerpc/mmu.h
@@ -1,3 +1,10 @@
1#ifndef _ASM_POWERPC_MMU_H_
2#define _ASM_POWERPC_MMU_H_
3
4#ifndef CONFIG_PPC64
5#include <asm-ppc/mmu.h>
6#else
7
1/* 8/*
2 * PowerPC memory management structures 9 * PowerPC memory management structures
3 * 10 *
@@ -10,10 +17,6 @@
10 * 2 of the License, or (at your option) any later version. 17 * 2 of the License, or (at your option) any later version.
11 */ 18 */
12 19
13#ifndef _PPC64_MMU_H_
14#define _PPC64_MMU_H_
15
16#include <linux/config.h>
17#include <asm/asm-compat.h> 20#include <asm/asm-compat.h>
18#include <asm/page.h> 21#include <asm/page.h>
19 22
@@ -392,4 +395,5 @@ static inline unsigned long get_vsid(unsigned long context, unsigned long ea)
392 395
393#endif /* __ASSEMBLY */ 396#endif /* __ASSEMBLY */
394 397
395#endif /* _PPC64_MMU_H_ */ 398#endif /* CONFIG_PPC64 */
399#endif /* _ASM_POWERPC_MMU_H_ */
diff --git a/include/asm-ppc64/mmu_context.h b/include/asm-powerpc/mmu_context.h
index 4f512e9fa6b8..ea6798c7d5fc 100644
--- a/include/asm-ppc64/mmu_context.h
+++ b/include/asm-powerpc/mmu_context.h
@@ -1,7 +1,10 @@
1#ifndef __PPC64_MMU_CONTEXT_H 1#ifndef __ASM_POWERPC_MMU_CONTEXT_H
2#define __PPC64_MMU_CONTEXT_H 2#define __ASM_POWERPC_MMU_CONTEXT_H
3
4#ifndef CONFIG_PPC64
5#include <asm-ppc/mmu_context.h>
6#else
3 7
4#include <linux/config.h>
5#include <linux/kernel.h> 8#include <linux/kernel.h>
6#include <linux/mm.h> 9#include <linux/mm.h>
7#include <asm/mmu.h> 10#include <asm/mmu.h>
@@ -82,4 +85,5 @@ static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
82 local_irq_restore(flags); 85 local_irq_restore(flags);
83} 86}
84 87
85#endif /* __PPC64_MMU_CONTEXT_H */ 88#endif /* CONFIG_PPC64 */
89#endif /* __ASM_POWERPC_MMU_CONTEXT_H */
diff --git a/include/asm-ppc64/mmzone.h b/include/asm-powerpc/mmzone.h
index 54958d6cae04..54958d6cae04 100644
--- a/include/asm-ppc64/mmzone.h
+++ b/include/asm-powerpc/mmzone.h
diff --git a/include/asm-ppc64/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index cf04327a597a..223ec7bd81da 100644
--- a/include/asm-ppc64/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -1,8 +1,10 @@
1#ifdef __KERNEL__ 1#ifndef _ASM_POWERPC_PCI_BRIDGE_H
2#ifndef _ASM_PCI_BRIDGE_H 2#define _ASM_POWERPC_PCI_BRIDGE_H
3#define _ASM_PCI_BRIDGE_H 3
4#ifndef CONFIG_PPC64
5#include <asm-ppc/pci-bridge.h>
6#else
4 7
5#include <linux/config.h>
6#include <linux/pci.h> 8#include <linux/pci.h>
7#include <linux/list.h> 9#include <linux/list.h>
8 10
@@ -147,5 +149,5 @@ extern void pcibios_free_controller(struct pci_controller *phb);
147#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */ 149#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */
148#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */ 150#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */
149 151
152#endif /* CONFIG_PPC64 */
150#endif 153#endif
151#endif /* __KERNEL__ */
diff --git a/include/asm-ppc64/pci.h b/include/asm-powerpc/pci.h
index fafdf885a3cc..d5934a076bd0 100644
--- a/include/asm-ppc64/pci.h
+++ b/include/asm-powerpc/pci.h
@@ -1,5 +1,5 @@
1#ifndef __PPC64_PCI_H 1#ifndef __ASM_POWERPC_PCI_H
2#define __PPC64_PCI_H 2#define __ASM_POWERPC_PCI_H
3#ifdef __KERNEL__ 3#ifdef __KERNEL__
4 4
5/* 5/*
@@ -18,6 +18,7 @@
18#include <asm/scatterlist.h> 18#include <asm/scatterlist.h>
19#include <asm/io.h> 19#include <asm/io.h>
20#include <asm/prom.h> 20#include <asm/prom.h>
21#include <asm/pci-bridge.h>
21 22
22#include <asm-generic/pci-dma-compat.h> 23#include <asm-generic/pci-dma-compat.h>
23 24
@@ -26,11 +27,21 @@
26 27
27struct pci_dev; 28struct pci_dev;
28 29
29#ifdef CONFIG_PPC_ISERIES 30/* Values for the `which' argument to sys_pciconfig_iobase syscall. */
31#define IOBASE_BRIDGE_NUMBER 0
32#define IOBASE_MEMORY 1
33#define IOBASE_IO 2
34#define IOBASE_ISA_IO 3
35#define IOBASE_ISA_MEM 4
36
37/*
38 * Set this to 1 if you want the kernel to re-assign all PCI
39 * bus numbers
40 */
41extern int pci_assign_all_buses;
42#define pcibios_assign_all_busses() (pci_assign_all_buses)
43
30#define pcibios_scan_all_fns(a, b) 0 44#define pcibios_scan_all_fns(a, b) 0
31#else
32extern int pcibios_scan_all_fns(struct pci_bus *bus, int devfn);
33#endif
34 45
35static inline void pcibios_set_master(struct pci_dev *dev) 46static inline void pcibios_set_master(struct pci_dev *dev)
36{ 47{
@@ -50,6 +61,7 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
50 return channel ? 15 : 14; 61 return channel ? 15 : 14;
51} 62}
52 63
64#ifdef CONFIG_PPC64
53#define HAVE_ARCH_PCI_MWI 1 65#define HAVE_ARCH_PCI_MWI 1
54static inline int pcibios_prep_mwi(struct pci_dev *dev) 66static inline int pcibios_prep_mwi(struct pci_dev *dev)
55{ 67{
@@ -64,12 +76,10 @@ static inline int pcibios_prep_mwi(struct pci_dev *dev)
64 return 0; 76 return 0;
65} 77}
66 78
67extern unsigned int pcibios_assign_all_busses(void);
68
69extern struct dma_mapping_ops pci_dma_ops; 79extern struct dma_mapping_ops pci_dma_ops;
70 80
71/* For DAC DMA, we currently don't support it by default, but 81/* For DAC DMA, we currently don't support it by default, but
72 * we let the platform override this 82 * we let 64-bit platforms override this.
73 */ 83 */
74static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask) 84static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask)
75{ 85{
@@ -102,6 +112,35 @@ extern int pci_domain_nr(struct pci_bus *bus);
102/* Decide whether to display the domain number in /proc */ 112/* Decide whether to display the domain number in /proc */
103extern int pci_proc_domain(struct pci_bus *bus); 113extern int pci_proc_domain(struct pci_bus *bus);
104 114
115#else /* 32-bit */
116
117#ifdef CONFIG_PCI
118static inline void pci_dma_burst_advice(struct pci_dev *pdev,
119 enum pci_dma_burst_strategy *strat,
120 unsigned long *strategy_parameter)
121{
122 *strat = PCI_DMA_BURST_INFINITY;
123 *strategy_parameter = ~0UL;
124}
125#endif
126
127/*
128 * At present there are very few 32-bit PPC machines that can have
129 * memory above the 4GB point, and we don't support that.
130 */
131#define pci_dac_dma_supported(pci_dev, mask) (0)
132
133/* Return the index of the PCI controller for device PDEV. */
134#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
135
136/* Set the name of the bus as it appears in /proc/bus/pci */
137static inline int pci_proc_domain(struct pci_bus *bus)
138{
139 return 0;
140}
141
142#endif /* CONFIG_PPC64 */
143
105struct vm_area_struct; 144struct vm_area_struct;
106/* Map a range of PCI memory or I/O space for a device into user space */ 145/* Map a range of PCI memory or I/O space for a device into user space */
107int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma, 146int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
@@ -110,6 +149,7 @@ int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
110/* Tell drivers/pci/proc.c that we have pci_mmap_page_range() */ 149/* Tell drivers/pci/proc.c that we have pci_mmap_page_range() */
111#define HAVE_PCI_MMAP 1 150#define HAVE_PCI_MMAP 1
112 151
152#ifdef CONFIG_PPC64
113/* pci_unmap_{single,page} is not a nop, thus... */ 153/* pci_unmap_{single,page} is not a nop, thus... */
114#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ 154#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
115 dma_addr_t ADDR_NAME; 155 dma_addr_t ADDR_NAME;
@@ -124,22 +164,40 @@ int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
124#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \ 164#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
125 (((PTR)->LEN_NAME) = (VAL)) 165 (((PTR)->LEN_NAME) = (VAL))
126 166
127/* The PCI address space does equal the physical memory 167/* The PCI address space does not equal the physical memory address
128 * address space. The networking and block device layers use 168 * space (we have an IOMMU). The IDE and SCSI device layers use
129 * this boolean for bounce buffer decisions. 169 * this boolean for bounce buffer decisions.
130 */ 170 */
131#define PCI_DMA_BUS_IS_PHYS (0) 171#define PCI_DMA_BUS_IS_PHYS (0)
172
173#else /* 32-bit */
174
175/* The PCI address space does equal the physical memory
176 * address space (no IOMMU). The IDE and SCSI device layers use
177 * this boolean for bounce buffer decisions.
178 */
179#define PCI_DMA_BUS_IS_PHYS (1)
180
181/* pci_unmap_{page,single} is a nop so... */
182#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
183#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
184#define pci_unmap_addr(PTR, ADDR_NAME) (0)
185#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
186#define pci_unmap_len(PTR, LEN_NAME) (0)
187#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
188
189#endif /* CONFIG_PPC64 */
132 190
133extern void 191extern void pcibios_resource_to_bus(struct pci_dev *dev,
134pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, 192 struct pci_bus_region *region,
135 struct resource *res); 193 struct resource *res);
136 194
137extern void 195extern void pcibios_bus_to_resource(struct pci_dev *dev,
138pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, 196 struct resource *res,
139 struct pci_bus_region *region); 197 struct pci_bus_region *region);
140 198
141static inline struct resource * 199static inline struct resource *pcibios_select_root(struct pci_dev *pdev,
142pcibios_select_root(struct pci_dev *pdev, struct resource *res) 200 struct resource *res)
143{ 201{
144 struct resource *root = NULL; 202 struct resource *root = NULL;
145 203
@@ -151,14 +209,12 @@ pcibios_select_root(struct pci_dev *pdev, struct resource *res)
151 return root; 209 return root;
152} 210}
153 211
154extern int 212extern int unmap_bus_range(struct pci_bus *bus);
155unmap_bus_range(struct pci_bus *bus);
156 213
157extern int 214extern int remap_bus_range(struct pci_bus *bus);
158remap_bus_range(struct pci_bus *bus);
159 215
160extern void 216extern void pcibios_fixup_device_resources(struct pci_dev *dev,
161pcibios_fixup_device_resources(struct pci_dev *dev, struct pci_bus *bus); 217 struct pci_bus *bus);
162 218
163extern struct pci_controller *init_phb_dynamic(struct device_node *dn); 219extern struct pci_controller *init_phb_dynamic(struct device_node *dn);
164 220
@@ -180,14 +236,12 @@ extern pgprot_t pci_phys_mem_access_prot(struct file *file,
180 unsigned long size, 236 unsigned long size,
181 pgprot_t prot); 237 pgprot_t prot);
182 238
183#ifdef CONFIG_PPC_MULTIPLATFORM 239#if defined(CONFIG_PPC_MULTIPLATFORM) || defined(CONFIG_PPC32)
184#define HAVE_ARCH_PCI_RESOURCE_TO_USER 240#define HAVE_ARCH_PCI_RESOURCE_TO_USER
185extern void pci_resource_to_user(const struct pci_dev *dev, int bar, 241extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
186 const struct resource *rsrc, 242 const struct resource *rsrc,
187 u64 *start, u64 *end); 243 u64 *start, u64 *end);
188#endif /* CONFIG_PPC_MULTIPLATFORM */ 244#endif /* CONFIG_PPC_MULTIPLATFORM || CONFIG_PPC32 */
189
190 245
191#endif /* __KERNEL__ */ 246#endif /* __KERNEL__ */
192 247#endif /* __ASM_POWERPC_PCI_H */
193#endif /* __PPC64_PCI_H */
diff --git a/include/asm-ppc64/pgalloc.h b/include/asm-powerpc/pgalloc.h
index dcf3622d1946..bfc2113b3630 100644
--- a/include/asm-ppc64/pgalloc.h
+++ b/include/asm-powerpc/pgalloc.h
@@ -1,5 +1,9 @@
1#ifndef _PPC64_PGALLOC_H 1#ifndef _ASM_POWERPC_PGALLOC_H
2#define _PPC64_PGALLOC_H 2#define _ASM_POWERPC_PGALLOC_H
3
4#ifndef CONFIG_PPC64
5#include <asm-ppc/pgalloc.h>
6#else
3 7
4#include <linux/mm.h> 8#include <linux/mm.h>
5#include <linux/slab.h> 9#include <linux/slab.h>
@@ -148,4 +152,5 @@ extern void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf);
148 152
149#define check_pgt_cache() do { } while (0) 153#define check_pgt_cache() do { } while (0)
150 154
151#endif /* _PPC64_PGALLOC_H */ 155#endif /* CONFIG_PPC64 */
156#endif /* _ASM_POWERPC_PGALLOC_H */
diff --git a/include/asm-ppc64/pgtable-4k.h b/include/asm-powerpc/pgtable-4k.h
index e9590c06ad92..e9590c06ad92 100644
--- a/include/asm-ppc64/pgtable-4k.h
+++ b/include/asm-powerpc/pgtable-4k.h
diff --git a/include/asm-ppc64/pgtable-64k.h b/include/asm-powerpc/pgtable-64k.h
index 154f1840ece4..154f1840ece4 100644
--- a/include/asm-ppc64/pgtable-64k.h
+++ b/include/asm-powerpc/pgtable-64k.h
diff --git a/include/asm-ppc64/pgtable.h b/include/asm-powerpc/pgtable.h
index a9783ba7fe98..0303f57366c1 100644
--- a/include/asm-ppc64/pgtable.h
+++ b/include/asm-powerpc/pgtable.h
@@ -1,5 +1,9 @@
1#ifndef _PPC64_PGTABLE_H 1#ifndef _ASM_POWERPC_PGTABLE_H
2#define _PPC64_PGTABLE_H 2#define _ASM_POWERPC_PGTABLE_H
3
4#ifndef CONFIG_PPC64
5#include <asm-ppc/pgtable.h>
6#else
3 7
4/* 8/*
5 * This file contains the functions and defines necessary to modify and use 9 * This file contains the functions and defines necessary to modify and use
@@ -47,6 +51,13 @@ struct mm_struct;
47#define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE) 51#define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE)
48 52
49/* 53/*
54 * Define the address range of the imalloc VM area.
55 */
56#define PHBS_IO_BASE VMALLOC_END
57#define IMALLOC_BASE (PHBS_IO_BASE + 0x80000000ul) /* Reserve 2 gigs for PHBs */
58#define IMALLOC_END (VMALLOC_START + PGTABLE_RANGE)
59
60/*
50 * Common bits in a linux-style PTE. These match the bits in the 61 * Common bits in a linux-style PTE. These match the bits in the
51 * (hardware-defined) PowerPC PTE as closely as possible. Additional 62 * (hardware-defined) PowerPC PTE as closely as possible. Additional
52 * bits may be defined in pgtable-*.h 63 * bits may be defined in pgtable-*.h
@@ -69,7 +80,7 @@ struct mm_struct;
69 80
70#define _PAGE_WRENABLE (_PAGE_RW | _PAGE_DIRTY) 81#define _PAGE_WRENABLE (_PAGE_RW | _PAGE_DIRTY)
71 82
72/* __pgprot defined in asm-ppc64/page.h */ 83/* __pgprot defined in asm-powerpc/page.h */
73#define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED) 84#define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED)
74 85
75#define PAGE_SHARED __pgprot(_PAGE_BASE | _PAGE_RW | _PAGE_USER) 86#define PAGE_SHARED __pgprot(_PAGE_BASE | _PAGE_RW | _PAGE_USER)
@@ -509,4 +520,5 @@ void pgtable_cache_init(void);
509 520
510#endif /* __ASSEMBLY__ */ 521#endif /* __ASSEMBLY__ */
511 522
512#endif /* _PPC64_PGTABLE_H */ 523#endif /* CONFIG_PPC64 */
524#endif /* _ASM_POWERPC_PGTABLE_H */
diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h
index 2e36e5a7f4f3..36cdc869e580 100644
--- a/include/asm-powerpc/ppc-pci.h
+++ b/include/asm-powerpc/ppc-pci.h
@@ -48,8 +48,6 @@ extern void pSeries_final_fixup(void);
48extern void pSeries_irq_bus_setup(struct pci_bus *bus); 48extern void pSeries_irq_bus_setup(struct pci_bus *bus);
49 49
50extern unsigned long pci_probe_only; 50extern unsigned long pci_probe_only;
51extern unsigned long pci_assign_all_buses;
52extern int pci_read_irq_line(struct pci_dev *pci_dev);
53 51
54/* ---- EEH internal-use-only related routines ---- */ 52/* ---- EEH internal-use-only related routines ---- */
55#ifdef CONFIG_EEH 53#ifdef CONFIG_EEH
diff --git a/include/asm-ppc64/spinlock.h b/include/asm-powerpc/spinlock.h
index 7d84fb5e39f1..caa4b14e0e94 100644
--- a/include/asm-ppc64/spinlock.h
+++ b/include/asm-powerpc/spinlock.h
@@ -18,31 +18,41 @@
18 * 18 *
19 * (the type definitions are in asm/spinlock_types.h) 19 * (the type definitions are in asm/spinlock_types.h)
20 */ 20 */
21#include <linux/config.h> 21#ifdef CONFIG_PPC64
22#include <asm/paca.h> 22#include <asm/paca.h>
23#include <asm/hvcall.h> 23#include <asm/hvcall.h>
24#include <asm/iseries/hv_call.h> 24#include <asm/iseries/hv_call.h>
25#endif
26#include <asm/asm-compat.h>
27#include <asm/synch.h>
25 28
26#define __raw_spin_is_locked(x) ((x)->slock != 0) 29#define __raw_spin_is_locked(x) ((x)->slock != 0)
27 30
31#ifdef CONFIG_PPC64
32/* use 0x800000yy when locked, where yy == CPU number */
33#define LOCK_TOKEN (*(u32 *)(&get_paca()->lock_token))
34#else
35#define LOCK_TOKEN 1
36#endif
37
28/* 38/*
29 * This returns the old value in the lock, so we succeeded 39 * This returns the old value in the lock, so we succeeded
30 * in getting the lock if the return value is 0. 40 * in getting the lock if the return value is 0.
31 */ 41 */
32static __inline__ unsigned long __spin_trylock(raw_spinlock_t *lock) 42static __inline__ unsigned long __spin_trylock(raw_spinlock_t *lock)
33{ 43{
34 unsigned long tmp, tmp2; 44 unsigned long tmp, token;
35 45
46 token = LOCK_TOKEN;
36 __asm__ __volatile__( 47 __asm__ __volatile__(
37" lwz %1,%3(13) # __spin_trylock\n\ 48"1: lwarx %0,0,%2 # __spin_trylock\n\
381: lwarx %0,0,%2\n\
39 cmpwi 0,%0,0\n\ 49 cmpwi 0,%0,0\n\
40 bne- 2f\n\ 50 bne- 2f\n\
41 stwcx. %1,0,%2\n\ 51 stwcx. %1,0,%2\n\
42 bne- 1b\n\ 52 bne- 1b\n\
43 isync\n\ 53 isync\n\
442:" : "=&r" (tmp), "=&r" (tmp2) 542:" : "=&r" (tmp)
45 : "r" (&lock->slock), "i" (offsetof(struct paca_struct, lock_token)) 55 : "r" (token), "r" (&lock->slock)
46 : "cr0", "memory"); 56 : "cr0", "memory");
47 57
48 return tmp; 58 return tmp;
@@ -113,11 +123,17 @@ static void __inline__ __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long
113 123
114static __inline__ void __raw_spin_unlock(raw_spinlock_t *lock) 124static __inline__ void __raw_spin_unlock(raw_spinlock_t *lock)
115{ 125{
116 __asm__ __volatile__("lwsync # __raw_spin_unlock": : :"memory"); 126 __asm__ __volatile__(SYNC_ON_SMP" # __raw_spin_unlock"
127 : : :"memory");
117 lock->slock = 0; 128 lock->slock = 0;
118} 129}
119 130
131#ifdef CONFIG_PPC64
120extern void __raw_spin_unlock_wait(raw_spinlock_t *lock); 132extern void __raw_spin_unlock_wait(raw_spinlock_t *lock);
133#else
134#define __raw_spin_unlock_wait(lock) \
135 do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0)
136#endif
121 137
122/* 138/*
123 * Read-write spinlocks, allowing multiple readers 139 * Read-write spinlocks, allowing multiple readers
@@ -133,6 +149,14 @@ extern void __raw_spin_unlock_wait(raw_spinlock_t *lock);
133#define __raw_read_can_lock(rw) ((rw)->lock >= 0) 149#define __raw_read_can_lock(rw) ((rw)->lock >= 0)
134#define __raw_write_can_lock(rw) (!(rw)->lock) 150#define __raw_write_can_lock(rw) (!(rw)->lock)
135 151
152#ifdef CONFIG_PPC64
153#define __DO_SIGN_EXTEND "extsw %0,%0\n"
154#define WRLOCK_TOKEN LOCK_TOKEN /* it's negative */
155#else
156#define __DO_SIGN_EXTEND
157#define WRLOCK_TOKEN (-1)
158#endif
159
136/* 160/*
137 * This returns the old value in the lock + 1, 161 * This returns the old value in the lock + 1,
138 * so we got a read lock if the return value is > 0. 162 * so we got a read lock if the return value is > 0.
@@ -142,11 +166,12 @@ static long __inline__ __read_trylock(raw_rwlock_t *rw)
142 long tmp; 166 long tmp;
143 167
144 __asm__ __volatile__( 168 __asm__ __volatile__(
145"1: lwarx %0,0,%1 # read_trylock\n\ 169"1: lwarx %0,0,%1 # read_trylock\n"
146 extsw %0,%0\n\ 170 __DO_SIGN_EXTEND
147 addic. %0,%0,1\n\ 171" addic. %0,%0,1\n\
148 ble- 2f\n\ 172 ble- 2f\n"
149 stwcx. %0,0,%1\n\ 173 PPC405_ERR77(0,%1)
174" stwcx. %0,0,%1\n\
150 bne- 1b\n\ 175 bne- 1b\n\
151 isync\n\ 176 isync\n\
1522:" : "=&r" (tmp) 1772:" : "=&r" (tmp)
@@ -162,18 +187,19 @@ static long __inline__ __read_trylock(raw_rwlock_t *rw)
162 */ 187 */
163static __inline__ long __write_trylock(raw_rwlock_t *rw) 188static __inline__ long __write_trylock(raw_rwlock_t *rw)
164{ 189{
165 long tmp, tmp2; 190 long tmp, token;
166 191
192 token = WRLOCK_TOKEN;
167 __asm__ __volatile__( 193 __asm__ __volatile__(
168" lwz %1,%3(13) # write_trylock\n\ 194"1: lwarx %0,0,%2 # write_trylock\n\
1691: lwarx %0,0,%2\n\
170 cmpwi 0,%0,0\n\ 195 cmpwi 0,%0,0\n\
171 bne- 2f\n\ 196 bne- 2f\n"
172 stwcx. %1,0,%2\n\ 197 PPC405_ERR77(0,%1)
198" stwcx. %1,0,%2\n\
173 bne- 1b\n\ 199 bne- 1b\n\
174 isync\n\ 200 isync\n\
1752:" : "=&r" (tmp), "=&r" (tmp2) 2012:" : "=&r" (tmp)
176 : "r" (&rw->lock), "i" (offsetof(struct paca_struct, lock_token)) 202 : "r" (token), "r" (&rw->lock)
177 : "cr0", "memory"); 203 : "cr0", "memory");
178 204
179 return tmp; 205 return tmp;
@@ -224,8 +250,9 @@ static void __inline__ __raw_read_unlock(raw_rwlock_t *rw)
224 __asm__ __volatile__( 250 __asm__ __volatile__(
225 "eieio # read_unlock\n\ 251 "eieio # read_unlock\n\
2261: lwarx %0,0,%1\n\ 2521: lwarx %0,0,%1\n\
227 addic %0,%0,-1\n\ 253 addic %0,%0,-1\n"
228 stwcx. %0,0,%1\n\ 254 PPC405_ERR77(0,%1)
255" stwcx. %0,0,%1\n\
229 bne- 1b" 256 bne- 1b"
230 : "=&r"(tmp) 257 : "=&r"(tmp)
231 : "r"(&rw->lock) 258 : "r"(&rw->lock)
@@ -234,7 +261,8 @@ static void __inline__ __raw_read_unlock(raw_rwlock_t *rw)
234 261
235static __inline__ void __raw_write_unlock(raw_rwlock_t *rw) 262static __inline__ void __raw_write_unlock(raw_rwlock_t *rw)
236{ 263{
237 __asm__ __volatile__("lwsync # write_unlock": : :"memory"); 264 __asm__ __volatile__(SYNC_ON_SMP" # write_unlock"
265 : : :"memory");
238 rw->lock = 0; 266 rw->lock = 0;
239} 267}
240 268
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index 2bfdf9c98459..84ac6e258eef 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -545,6 +545,23 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
545#include <asm/mpc8260_pci9.h> 545#include <asm/mpc8260_pci9.h>
546#endif 546#endif
547 547
548#ifdef CONFIG_NOT_COHERENT_CACHE
549
550#define dma_cache_inv(_start,_size) \
551 invalidate_dcache_range(_start, (_start + _size))
552#define dma_cache_wback(_start,_size) \
553 clean_dcache_range(_start, (_start + _size))
554#define dma_cache_wback_inv(_start,_size) \
555 flush_dcache_range(_start, (_start + _size))
556
557#else
558
559#define dma_cache_inv(_start,_size) do { } while (0)
560#define dma_cache_wback(_start,_size) do { } while (0)
561#define dma_cache_wback_inv(_start,_size) do { } while (0)
562
563#endif
564
548/* 565/*
549 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 566 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
550 * access 567 * access
diff --git a/include/asm-ppc64/dma-mapping.h b/include/asm-ppc64/dma-mapping.h
deleted file mode 100644
index fb68fa23bea8..000000000000
--- a/include/asm-ppc64/dma-mapping.h
+++ /dev/null
@@ -1,136 +0,0 @@
1/* Copyright (C) 2004 IBM
2 *
3 * Implements the generic device dma API for ppc64. Handles
4 * the pci and vio busses
5 */
6
7#ifndef _ASM_DMA_MAPPING_H
8#define _ASM_DMA_MAPPING_H
9
10#include <linux/types.h>
11#include <linux/cache.h>
12/* need struct page definitions */
13#include <linux/mm.h>
14#include <asm/scatterlist.h>
15#include <asm/bug.h>
16
17#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
18
19extern int dma_supported(struct device *dev, u64 mask);
20extern int dma_set_mask(struct device *dev, u64 dma_mask);
21extern void *dma_alloc_coherent(struct device *dev, size_t size,
22 dma_addr_t *dma_handle, gfp_t flag);
23extern void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
24 dma_addr_t dma_handle);
25extern dma_addr_t dma_map_single(struct device *dev, void *cpu_addr,
26 size_t size, enum dma_data_direction direction);
27extern void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
28 size_t size, enum dma_data_direction direction);
29extern dma_addr_t dma_map_page(struct device *dev, struct page *page,
30 unsigned long offset, size_t size,
31 enum dma_data_direction direction);
32extern void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
33 size_t size, enum dma_data_direction direction);
34extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
35 enum dma_data_direction direction);
36extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
37 int nhwentries, enum dma_data_direction direction);
38
39static inline void
40dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
41 enum dma_data_direction direction)
42{
43 BUG_ON(direction == DMA_NONE);
44 /* nothing to do */
45}
46
47static inline void
48dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
49 enum dma_data_direction direction)
50{
51 BUG_ON(direction == DMA_NONE);
52 /* nothing to do */
53}
54
55static inline void
56dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
57 enum dma_data_direction direction)
58{
59 BUG_ON(direction == DMA_NONE);
60 /* nothing to do */
61}
62
63static inline void
64dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
65 enum dma_data_direction direction)
66{
67 BUG_ON(direction == DMA_NONE);
68 /* nothing to do */
69}
70
71static inline int dma_mapping_error(dma_addr_t dma_addr)
72{
73 return (dma_addr == DMA_ERROR_CODE);
74}
75
76/* Now for the API extensions over the pci_ one */
77
78#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
79#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
80#define dma_is_consistent(d) (1)
81
82static inline int
83dma_get_cache_alignment(void)
84{
85 /* no easy way to get cache size on all processors, so return
86 * the maximum possible, to be safe */
87 return (1 << L1_CACHE_SHIFT_MAX);
88}
89
90static inline void
91dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
92 unsigned long offset, size_t size,
93 enum dma_data_direction direction)
94{
95 BUG_ON(direction == DMA_NONE);
96 /* nothing to do */
97}
98
99static inline void
100dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
101 unsigned long offset, size_t size,
102 enum dma_data_direction direction)
103{
104 BUG_ON(direction == DMA_NONE);
105 /* nothing to do */
106}
107
108static inline void
109dma_cache_sync(void *vaddr, size_t size,
110 enum dma_data_direction direction)
111{
112 BUG_ON(direction == DMA_NONE);
113 /* nothing to do */
114}
115
116/*
117 * DMA operations are abstracted for G5 vs. i/pSeries, PCI vs. VIO
118 */
119struct dma_mapping_ops {
120 void * (*alloc_coherent)(struct device *dev, size_t size,
121 dma_addr_t *dma_handle, gfp_t flag);
122 void (*free_coherent)(struct device *dev, size_t size,
123 void *vaddr, dma_addr_t dma_handle);
124 dma_addr_t (*map_single)(struct device *dev, void *ptr,
125 size_t size, enum dma_data_direction direction);
126 void (*unmap_single)(struct device *dev, dma_addr_t dma_addr,
127 size_t size, enum dma_data_direction direction);
128 int (*map_sg)(struct device *dev, struct scatterlist *sg,
129 int nents, enum dma_data_direction direction);
130 void (*unmap_sg)(struct device *dev, struct scatterlist *sg,
131 int nents, enum dma_data_direction direction);
132 int (*dma_supported)(struct device *dev, u64 mask);
133 int (*dac_dma_supported)(struct device *dev, u64 mask);
134};
135
136#endif /* _ASM_DMA_MAPPING_H */
diff --git a/include/asm-ppc64/imalloc.h b/include/asm-ppc64/imalloc.h
deleted file mode 100644
index 42adf7033a81..000000000000
--- a/include/asm-ppc64/imalloc.h
+++ /dev/null
@@ -1,26 +0,0 @@
1#ifndef _PPC64_IMALLOC_H
2#define _PPC64_IMALLOC_H
3
4/*
5 * Define the address range of the imalloc VM area.
6 */
7#define PHBS_IO_BASE VMALLOC_END
8#define IMALLOC_BASE (PHBS_IO_BASE + 0x80000000ul) /* Reserve 2 gigs for PHBs */
9#define IMALLOC_END (VMALLOC_START + PGTABLE_RANGE)
10
11
12/* imalloc region types */
13#define IM_REGION_UNUSED 0x1
14#define IM_REGION_SUBSET 0x2
15#define IM_REGION_EXISTS 0x4
16#define IM_REGION_OVERLAP 0x8
17#define IM_REGION_SUPERSET 0x10
18
19extern struct vm_struct * im_get_free_area(unsigned long size);
20extern struct vm_struct * im_get_area(unsigned long v_addr, unsigned long size,
21 int region_type);
22extern void im_free(void *addr);
23
24extern unsigned long ioremap_bot;
25
26#endif /* _PPC64_IMALLOC_H */