diff options
-rw-r--r-- | arch/powerpc/kernel/Makefile | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/io.c | 117 | ||||
-rw-r--r-- | arch/powerpc/kernel/misc.S | 95 | ||||
-rw-r--r-- | arch/powerpc/kernel/ppc_ksyms.c | 7 | ||||
-rw-r--r-- | include/asm-powerpc/io.h | 12 | ||||
-rw-r--r-- | include/asm-ppc/io.h | 12 |
6 files changed, 130 insertions, 115 deletions
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index 8b3f4faf5768..8b133afbdc20 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile | |||
@@ -51,7 +51,7 @@ extra-$(CONFIG_8xx) := head_8xx.o | |||
51 | extra-y += vmlinux.lds | 51 | extra-y += vmlinux.lds |
52 | 52 | ||
53 | obj-y += time.o prom.o traps.o setup-common.o \ | 53 | obj-y += time.o prom.o traps.o setup-common.o \ |
54 | udbg.o misc.o | 54 | udbg.o misc.o io.o |
55 | obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o | 55 | obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o |
56 | obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o | 56 | obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o |
57 | obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o | 57 | obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o |
diff --git a/arch/powerpc/kernel/io.c b/arch/powerpc/kernel/io.c new file mode 100644 index 000000000000..80a3209acef4 --- /dev/null +++ b/arch/powerpc/kernel/io.c | |||
@@ -0,0 +1,117 @@ | |||
1 | /* | ||
2 | * I/O string operations | ||
3 | * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) | ||
4 | * Copyright (C) 2006 IBM Corporation | ||
5 | * | ||
6 | * Largely rewritten by Cort Dougan (cort@cs.nmt.edu) | ||
7 | * and Paul Mackerras. | ||
8 | * | ||
9 | * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com) | ||
10 | * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com) | ||
11 | * | ||
12 | * Rewritten in C by Stephen Rothwell. | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version | ||
17 | * 2 of the License, or (at your option) any later version. | ||
18 | */ | ||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/types.h> | ||
21 | #include <linux/compiler.h> | ||
22 | #include <linux/module.h> | ||
23 | |||
24 | #include <asm/io.h> | ||
25 | |||
26 | void _insb(volatile u8 __iomem *port, void *buf, long count) | ||
27 | { | ||
28 | u8 *tbuf = buf; | ||
29 | u8 tmp; | ||
30 | |||
31 | if (unlikely(count <= 0)) | ||
32 | return; | ||
33 | asm volatile("sync"); | ||
34 | do { | ||
35 | tmp = *port; | ||
36 | asm volatile("eieio"); | ||
37 | *tbuf++ = tmp; | ||
38 | } while (--count != 0); | ||
39 | asm volatile("twi 0,%0,0; isync" : : "r" (tmp)); | ||
40 | } | ||
41 | EXPORT_SYMBOL(_insb); | ||
42 | |||
43 | void _outsb(volatile u8 __iomem *port, const void *buf, long count) | ||
44 | { | ||
45 | const u8 *tbuf = buf; | ||
46 | |||
47 | if (unlikely(count <= 0)) | ||
48 | return; | ||
49 | asm volatile("sync"); | ||
50 | do { | ||
51 | *port = *tbuf++; | ||
52 | } while (--count != 0); | ||
53 | asm volatile("sync"); | ||
54 | } | ||
55 | EXPORT_SYMBOL(_outsb); | ||
56 | |||
57 | void _insw_ns(volatile u16 __iomem *port, void *buf, long count) | ||
58 | { | ||
59 | u16 *tbuf = buf; | ||
60 | u16 tmp; | ||
61 | |||
62 | if (unlikely(count <= 0)) | ||
63 | return; | ||
64 | asm volatile("sync"); | ||
65 | do { | ||
66 | tmp = *port; | ||
67 | asm volatile("eieio"); | ||
68 | *tbuf++ = tmp; | ||
69 | } while (--count != 0); | ||
70 | asm volatile("twi 0,%0,0; isync" : : "r" (tmp)); | ||
71 | } | ||
72 | EXPORT_SYMBOL(_insw_ns); | ||
73 | |||
74 | void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count) | ||
75 | { | ||
76 | const u16 *tbuf = buf; | ||
77 | |||
78 | if (unlikely(count <= 0)) | ||
79 | return; | ||
80 | asm volatile("sync"); | ||
81 | do { | ||
82 | *port = *tbuf++; | ||
83 | } while (--count != 0); | ||
84 | asm volatile("sync"); | ||
85 | } | ||
86 | EXPORT_SYMBOL(_outsw_ns); | ||
87 | |||
88 | void _insl_ns(volatile u32 __iomem *port, void *buf, long count) | ||
89 | { | ||
90 | u32 *tbuf = buf; | ||
91 | u32 tmp; | ||
92 | |||
93 | if (unlikely(count <= 0)) | ||
94 | return; | ||
95 | asm volatile("sync"); | ||
96 | do { | ||
97 | tmp = *port; | ||
98 | asm volatile("eieio"); | ||
99 | *tbuf++ = tmp; | ||
100 | } while (--count != 0); | ||
101 | asm volatile("twi 0,%0,0; isync" : : "r" (tmp)); | ||
102 | } | ||
103 | EXPORT_SYMBOL(_insl_ns); | ||
104 | |||
105 | void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count) | ||
106 | { | ||
107 | const u32 *tbuf = buf; | ||
108 | |||
109 | if (unlikely(count <= 0)) | ||
110 | return; | ||
111 | asm volatile("sync"); | ||
112 | do { | ||
113 | *port = *tbuf++; | ||
114 | } while (--count != 0); | ||
115 | asm volatile("sync"); | ||
116 | } | ||
117 | EXPORT_SYMBOL(_outsl_ns); | ||
diff --git a/arch/powerpc/kernel/misc.S b/arch/powerpc/kernel/misc.S index 6feb391422ec..330c9dc7db86 100644 --- a/arch/powerpc/kernel/misc.S +++ b/arch/powerpc/kernel/misc.S | |||
@@ -43,98 +43,3 @@ _GLOBAL(add_reloc_offset) | |||
43 | add r3,r3,r5 | 43 | add r3,r3,r5 |
44 | mtlr r0 | 44 | mtlr r0 |
45 | blr | 45 | blr |
46 | |||
47 | /* | ||
48 | * I/O string operations | ||
49 | * | ||
50 | * insb(port, buf, len) | ||
51 | * outsb(port, buf, len) | ||
52 | * insw(port, buf, len) | ||
53 | * outsw(port, buf, len) | ||
54 | * insl(port, buf, len) | ||
55 | * outsl(port, buf, len) | ||
56 | * insw_ns(port, buf, len) | ||
57 | * outsw_ns(port, buf, len) | ||
58 | * insl_ns(port, buf, len) | ||
59 | * outsl_ns(port, buf, len) | ||
60 | * | ||
61 | * The *_ns versions don't do byte-swapping. | ||
62 | */ | ||
63 | _GLOBAL(_insb) | ||
64 | sync | ||
65 | cmpwi 0,r5,0 | ||
66 | mtctr r5 | ||
67 | subi r4,r4,1 | ||
68 | blelr- | ||
69 | 00: lbz r5,0(r3) | ||
70 | eieio | ||
71 | stbu r5,1(r4) | ||
72 | bdnz 00b | ||
73 | twi 0,r5,0 | ||
74 | isync | ||
75 | blr | ||
76 | |||
77 | _GLOBAL(_outsb) | ||
78 | cmpwi 0,r5,0 | ||
79 | mtctr r5 | ||
80 | subi r4,r4,1 | ||
81 | blelr- | ||
82 | sync | ||
83 | 00: lbzu r5,1(r4) | ||
84 | stb r5,0(r3) | ||
85 | bdnz 00b | ||
86 | sync | ||
87 | blr | ||
88 | |||
89 | _GLOBAL(_insw_ns) | ||
90 | sync | ||
91 | cmpwi 0,r5,0 | ||
92 | mtctr r5 | ||
93 | subi r4,r4,2 | ||
94 | blelr- | ||
95 | 00: lhz r5,0(r3) | ||
96 | eieio | ||
97 | sthu r5,2(r4) | ||
98 | bdnz 00b | ||
99 | twi 0,r5,0 | ||
100 | isync | ||
101 | blr | ||
102 | |||
103 | _GLOBAL(_outsw_ns) | ||
104 | cmpwi 0,r5,0 | ||
105 | mtctr r5 | ||
106 | subi r4,r4,2 | ||
107 | blelr- | ||
108 | sync | ||
109 | 00: lhzu r5,2(r4) | ||
110 | sth r5,0(r3) | ||
111 | bdnz 00b | ||
112 | sync | ||
113 | blr | ||
114 | |||
115 | _GLOBAL(_insl_ns) | ||
116 | sync | ||
117 | cmpwi 0,r5,0 | ||
118 | mtctr r5 | ||
119 | subi r4,r4,4 | ||
120 | blelr- | ||
121 | 00: lwz r5,0(r3) | ||
122 | eieio | ||
123 | stwu r5,4(r4) | ||
124 | bdnz 00b | ||
125 | twi 0,r5,0 | ||
126 | isync | ||
127 | blr | ||
128 | |||
129 | _GLOBAL(_outsl_ns) | ||
130 | cmpwi 0,r5,0 | ||
131 | mtctr r5 | ||
132 | subi r4,r4,4 | ||
133 | blelr- | ||
134 | sync | ||
135 | 00: lwzu r5,4(r4) | ||
136 | stw r5,0(r3) | ||
137 | bdnz 00b | ||
138 | sync | ||
139 | blr | ||
140 | |||
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c index 75429e580518..807193a3c784 100644 --- a/arch/powerpc/kernel/ppc_ksyms.c +++ b/arch/powerpc/kernel/ppc_ksyms.c | |||
@@ -95,13 +95,6 @@ EXPORT_SYMBOL(__strnlen_user); | |||
95 | EXPORT_SYMBOL(copy_4K_page); | 95 | EXPORT_SYMBOL(copy_4K_page); |
96 | #endif | 96 | #endif |
97 | 97 | ||
98 | EXPORT_SYMBOL(_insb); | ||
99 | EXPORT_SYMBOL(_outsb); | ||
100 | EXPORT_SYMBOL(_insw_ns); | ||
101 | EXPORT_SYMBOL(_outsw_ns); | ||
102 | EXPORT_SYMBOL(_insl_ns); | ||
103 | EXPORT_SYMBOL(_outsl_ns); | ||
104 | |||
105 | #if defined(CONFIG_PPC32) && (defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)) | 98 | #if defined(CONFIG_PPC32) && (defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)) |
106 | EXPORT_SYMBOL(ppc_ide_md); | 99 | EXPORT_SYMBOL(ppc_ide_md); |
107 | #endif | 100 | #endif |
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h index 51a598747367..57e7d14d6563 100644 --- a/include/asm-powerpc/io.h +++ b/include/asm-powerpc/io.h | |||
@@ -143,12 +143,12 @@ static inline void __raw_writeq(unsigned long v, volatile void __iomem *addr) | |||
143 | #define readl_relaxed(addr) readl(addr) | 143 | #define readl_relaxed(addr) readl(addr) |
144 | #define readq_relaxed(addr) readq(addr) | 144 | #define readq_relaxed(addr) readq(addr) |
145 | 145 | ||
146 | extern void _insb(volatile u8 __iomem *port, void *buf, int ns); | 146 | extern void _insb(volatile u8 __iomem *port, void *buf, long count); |
147 | extern void _outsb(volatile u8 __iomem *port, const void *buf, int ns); | 147 | extern void _outsb(volatile u8 __iomem *port, const void *buf, long count); |
148 | extern void _insw_ns(volatile u16 __iomem *port, void *buf, int ns); | 148 | extern void _insw_ns(volatile u16 __iomem *port, void *buf, long count); |
149 | extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, int ns); | 149 | extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count); |
150 | extern void _insl_ns(volatile u32 __iomem *port, void *buf, int nl); | 150 | extern void _insl_ns(volatile u32 __iomem *port, void *buf, long count); |
151 | extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl); | 151 | extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count); |
152 | 152 | ||
153 | static inline void mmiowb(void) | 153 | static inline void mmiowb(void) |
154 | { | 154 | { |
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h index 9fac420f1648..3d9a9e6f3321 100644 --- a/include/asm-ppc/io.h +++ b/include/asm-ppc/io.h | |||
@@ -327,12 +327,12 @@ __do_out_asm(outl, "stwbrx") | |||
327 | #define inl_p(port) inl((port)) | 327 | #define inl_p(port) inl((port)) |
328 | #define outl_p(val, port) outl((val), (port)) | 328 | #define outl_p(val, port) outl((val), (port)) |
329 | 329 | ||
330 | extern void _insb(volatile u8 __iomem *port, void *buf, int ns); | 330 | extern void _insb(volatile u8 __iomem *port, void *buf, long count); |
331 | extern void _outsb(volatile u8 __iomem *port, const void *buf, int ns); | 331 | extern void _outsb(volatile u8 __iomem *port, const void *buf, long count); |
332 | extern void _insw_ns(volatile u16 __iomem *port, void *buf, int ns); | 332 | extern void _insw_ns(volatile u16 __iomem *port, void *buf, long count); |
333 | extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, int ns); | 333 | extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count); |
334 | extern void _insl_ns(volatile u32 __iomem *port, void *buf, int nl); | 334 | extern void _insl_ns(volatile u32 __iomem *port, void *buf, long count); |
335 | extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl); | 335 | extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count); |
336 | 336 | ||
337 | 337 | ||
338 | #define IO_SPACE_LIMIT ~0 | 338 | #define IO_SPACE_LIMIT ~0 |