diff options
author | Linus Torvalds <torvalds@evo.osdl.org> | 2005-09-05 03:12:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@evo.osdl.org> | 2005-09-05 03:12:58 -0400 |
commit | e766f1cc596078b1603ac2c96617660c4c7e2d81 (patch) | |
tree | 86f24a621dbe39fd25dcec539c2f969f50bfbcab /arch/sparc64/lib | |
parent | 48467641bcc057f7cba3b6cbbe66cb834d64cc81 (diff) | |
parent | ebede60741e2cec6d210f137fd22a30e37abc0be (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
Diffstat (limited to 'arch/sparc64/lib')
-rw-r--r-- | arch/sparc64/lib/PeeCeeI.c | 77 | ||||
-rw-r--r-- | arch/sparc64/lib/copy_page.S | 13 |
2 files changed, 56 insertions, 34 deletions
diff --git a/arch/sparc64/lib/PeeCeeI.c b/arch/sparc64/lib/PeeCeeI.c index 3008d536e8c2..3c6cfbb20360 100644 --- a/arch/sparc64/lib/PeeCeeI.c +++ b/arch/sparc64/lib/PeeCeeI.c | |||
@@ -7,28 +7,31 @@ | |||
7 | #include <asm/io.h> | 7 | #include <asm/io.h> |
8 | #include <asm/byteorder.h> | 8 | #include <asm/byteorder.h> |
9 | 9 | ||
10 | void outsb(void __iomem *addr, const void *src, unsigned long count) | 10 | void outsb(unsigned long __addr, const void *src, unsigned long count) |
11 | { | 11 | { |
12 | void __iomem *addr = (void __iomem *) __addr; | ||
12 | const u8 *p = src; | 13 | const u8 *p = src; |
13 | 14 | ||
14 | while(count--) | 15 | while (count--) |
15 | outb(*p++, addr); | 16 | outb(*p++, addr); |
16 | } | 17 | } |
17 | 18 | ||
18 | void outsw(void __iomem *addr, const void *src, unsigned long count) | 19 | void outsw(unsigned long __addr, const void *src, unsigned long count) |
19 | { | 20 | { |
20 | if(count) { | 21 | void __iomem *addr = (void __iomem *) __addr; |
22 | |||
23 | if (count) { | ||
21 | u16 *ps = (u16 *)src; | 24 | u16 *ps = (u16 *)src; |
22 | u32 *pi; | 25 | u32 *pi; |
23 | 26 | ||
24 | if(((u64)src) & 0x2) { | 27 | if (((u64)src) & 0x2) { |
25 | u16 val = le16_to_cpup(ps); | 28 | u16 val = le16_to_cpup(ps); |
26 | outw(val, addr); | 29 | outw(val, addr); |
27 | ps++; | 30 | ps++; |
28 | count--; | 31 | count--; |
29 | } | 32 | } |
30 | pi = (u32 *)ps; | 33 | pi = (u32 *)ps; |
31 | while(count >= 2) { | 34 | while (count >= 2) { |
32 | u32 w = le32_to_cpup(pi); | 35 | u32 w = le32_to_cpup(pi); |
33 | 36 | ||
34 | pi++; | 37 | pi++; |
@@ -37,19 +40,21 @@ void outsw(void __iomem *addr, const void *src, unsigned long count) | |||
37 | count -= 2; | 40 | count -= 2; |
38 | } | 41 | } |
39 | ps = (u16 *)pi; | 42 | ps = (u16 *)pi; |
40 | if(count) { | 43 | if (count) { |
41 | u16 val = le16_to_cpup(ps); | 44 | u16 val = le16_to_cpup(ps); |
42 | outw(val, addr); | 45 | outw(val, addr); |
43 | } | 46 | } |
44 | } | 47 | } |
45 | } | 48 | } |
46 | 49 | ||
47 | void outsl(void __iomem *addr, const void *src, unsigned long count) | 50 | void outsl(unsigned long __addr, const void *src, unsigned long count) |
48 | { | 51 | { |
49 | if(count) { | 52 | void __iomem *addr = (void __iomem *) __addr; |
50 | if((((u64)src) & 0x3) == 0) { | 53 | |
54 | if (count) { | ||
55 | if ((((u64)src) & 0x3) == 0) { | ||
51 | u32 *p = (u32 *)src; | 56 | u32 *p = (u32 *)src; |
52 | while(count--) { | 57 | while (count--) { |
53 | u32 val = cpu_to_le32p(p); | 58 | u32 val = cpu_to_le32p(p); |
54 | outl(val, addr); | 59 | outl(val, addr); |
55 | p++; | 60 | p++; |
@@ -60,13 +65,13 @@ void outsl(void __iomem *addr, const void *src, unsigned long count) | |||
60 | u32 l = 0, l2; | 65 | u32 l = 0, l2; |
61 | u32 *pi; | 66 | u32 *pi; |
62 | 67 | ||
63 | switch(((u64)src) & 0x3) { | 68 | switch (((u64)src) & 0x3) { |
64 | case 0x2: | 69 | case 0x2: |
65 | count -= 1; | 70 | count -= 1; |
66 | l = cpu_to_le16p(ps) << 16; | 71 | l = cpu_to_le16p(ps) << 16; |
67 | ps++; | 72 | ps++; |
68 | pi = (u32 *)ps; | 73 | pi = (u32 *)ps; |
69 | while(count--) { | 74 | while (count--) { |
70 | l2 = cpu_to_le32p(pi); | 75 | l2 = cpu_to_le32p(pi); |
71 | pi++; | 76 | pi++; |
72 | outl(((l >> 16) | (l2 << 16)), addr); | 77 | outl(((l >> 16) | (l2 << 16)), addr); |
@@ -86,7 +91,7 @@ void outsl(void __iomem *addr, const void *src, unsigned long count) | |||
86 | ps++; | 91 | ps++; |
87 | l |= (l2 << 16); | 92 | l |= (l2 << 16); |
88 | pi = (u32 *)ps; | 93 | pi = (u32 *)ps; |
89 | while(count--) { | 94 | while (count--) { |
90 | l2 = cpu_to_le32p(pi); | 95 | l2 = cpu_to_le32p(pi); |
91 | pi++; | 96 | pi++; |
92 | outl(((l >> 8) | (l2 << 24)), addr); | 97 | outl(((l >> 8) | (l2 << 24)), addr); |
@@ -101,7 +106,7 @@ void outsl(void __iomem *addr, const void *src, unsigned long count) | |||
101 | pb = (u8 *)src; | 106 | pb = (u8 *)src; |
102 | l = (*pb++ << 24); | 107 | l = (*pb++ << 24); |
103 | pi = (u32 *)pb; | 108 | pi = (u32 *)pb; |
104 | while(count--) { | 109 | while (count--) { |
105 | l2 = cpu_to_le32p(pi); | 110 | l2 = cpu_to_le32p(pi); |
106 | pi++; | 111 | pi++; |
107 | outl(((l >> 24) | (l2 << 8)), addr); | 112 | outl(((l >> 24) | (l2 << 8)), addr); |
@@ -119,16 +124,18 @@ void outsl(void __iomem *addr, const void *src, unsigned long count) | |||
119 | } | 124 | } |
120 | } | 125 | } |
121 | 126 | ||
122 | void insb(void __iomem *addr, void *dst, unsigned long count) | 127 | void insb(unsigned long __addr, void *dst, unsigned long count) |
123 | { | 128 | { |
124 | if(count) { | 129 | void __iomem *addr = (void __iomem *) __addr; |
130 | |||
131 | if (count) { | ||
125 | u32 *pi; | 132 | u32 *pi; |
126 | u8 *pb = dst; | 133 | u8 *pb = dst; |
127 | 134 | ||
128 | while((((unsigned long)pb) & 0x3) && count--) | 135 | while ((((unsigned long)pb) & 0x3) && count--) |
129 | *pb++ = inb(addr); | 136 | *pb++ = inb(addr); |
130 | pi = (u32 *)pb; | 137 | pi = (u32 *)pb; |
131 | while(count >= 4) { | 138 | while (count >= 4) { |
132 | u32 w; | 139 | u32 w; |
133 | 140 | ||
134 | w = (inb(addr) << 24); | 141 | w = (inb(addr) << 24); |
@@ -139,23 +146,25 @@ void insb(void __iomem *addr, void *dst, unsigned long count) | |||
139 | count -= 4; | 146 | count -= 4; |
140 | } | 147 | } |
141 | pb = (u8 *)pi; | 148 | pb = (u8 *)pi; |
142 | while(count--) | 149 | while (count--) |
143 | *pb++ = inb(addr); | 150 | *pb++ = inb(addr); |
144 | } | 151 | } |
145 | } | 152 | } |
146 | 153 | ||
147 | void insw(void __iomem *addr, void *dst, unsigned long count) | 154 | void insw(unsigned long __addr, void *dst, unsigned long count) |
148 | { | 155 | { |
149 | if(count) { | 156 | void __iomem *addr = (void __iomem *) __addr; |
157 | |||
158 | if (count) { | ||
150 | u16 *ps = dst; | 159 | u16 *ps = dst; |
151 | u32 *pi; | 160 | u32 *pi; |
152 | 161 | ||
153 | if(((unsigned long)ps) & 0x2) { | 162 | if (((unsigned long)ps) & 0x2) { |
154 | *ps++ = le16_to_cpu(inw(addr)); | 163 | *ps++ = le16_to_cpu(inw(addr)); |
155 | count--; | 164 | count--; |
156 | } | 165 | } |
157 | pi = (u32 *)ps; | 166 | pi = (u32 *)ps; |
158 | while(count >= 2) { | 167 | while (count >= 2) { |
159 | u32 w; | 168 | u32 w; |
160 | 169 | ||
161 | w = (le16_to_cpu(inw(addr)) << 16); | 170 | w = (le16_to_cpu(inw(addr)) << 16); |
@@ -164,31 +173,33 @@ void insw(void __iomem *addr, void *dst, unsigned long count) | |||
164 | count -= 2; | 173 | count -= 2; |
165 | } | 174 | } |
166 | ps = (u16 *)pi; | 175 | ps = (u16 *)pi; |
167 | if(count) | 176 | if (count) |
168 | *ps = le16_to_cpu(inw(addr)); | 177 | *ps = le16_to_cpu(inw(addr)); |
169 | } | 178 | } |
170 | } | 179 | } |
171 | 180 | ||
172 | void insl(void __iomem *addr, void *dst, unsigned long count) | 181 | void insl(unsigned long __addr, void *dst, unsigned long count) |
173 | { | 182 | { |
174 | if(count) { | 183 | void __iomem *addr = (void __iomem *) __addr; |
175 | if((((unsigned long)dst) & 0x3) == 0) { | 184 | |
185 | if (count) { | ||
186 | if ((((unsigned long)dst) & 0x3) == 0) { | ||
176 | u32 *pi = dst; | 187 | u32 *pi = dst; |
177 | while(count--) | 188 | while (count--) |
178 | *pi++ = le32_to_cpu(inl(addr)); | 189 | *pi++ = le32_to_cpu(inl(addr)); |
179 | } else { | 190 | } else { |
180 | u32 l = 0, l2, *pi; | 191 | u32 l = 0, l2, *pi; |
181 | u16 *ps; | 192 | u16 *ps; |
182 | u8 *pb; | 193 | u8 *pb; |
183 | 194 | ||
184 | switch(((unsigned long)dst) & 3) { | 195 | switch (((unsigned long)dst) & 3) { |
185 | case 0x2: | 196 | case 0x2: |
186 | ps = dst; | 197 | ps = dst; |
187 | count -= 1; | 198 | count -= 1; |
188 | l = le32_to_cpu(inl(addr)); | 199 | l = le32_to_cpu(inl(addr)); |
189 | *ps++ = l; | 200 | *ps++ = l; |
190 | pi = (u32 *)ps; | 201 | pi = (u32 *)ps; |
191 | while(count--) { | 202 | while (count--) { |
192 | l2 = le32_to_cpu(inl(addr)); | 203 | l2 = le32_to_cpu(inl(addr)); |
193 | *pi++ = (l << 16) | (l2 >> 16); | 204 | *pi++ = (l << 16) | (l2 >> 16); |
194 | l = l2; | 205 | l = l2; |
@@ -205,7 +216,7 @@ void insl(void __iomem *addr, void *dst, unsigned long count) | |||
205 | ps = (u16 *)pb; | 216 | ps = (u16 *)pb; |
206 | *ps++ = ((l >> 8) & 0xffff); | 217 | *ps++ = ((l >> 8) & 0xffff); |
207 | pi = (u32 *)ps; | 218 | pi = (u32 *)ps; |
208 | while(count--) { | 219 | while (count--) { |
209 | l2 = le32_to_cpu(inl(addr)); | 220 | l2 = le32_to_cpu(inl(addr)); |
210 | *pi++ = (l << 24) | (l2 >> 8); | 221 | *pi++ = (l << 24) | (l2 >> 8); |
211 | l = l2; | 222 | l = l2; |
@@ -220,7 +231,7 @@ void insl(void __iomem *addr, void *dst, unsigned long count) | |||
220 | l = le32_to_cpu(inl(addr)); | 231 | l = le32_to_cpu(inl(addr)); |
221 | *pb++ = l >> 24; | 232 | *pb++ = l >> 24; |
222 | pi = (u32 *)pb; | 233 | pi = (u32 *)pb; |
223 | while(count--) { | 234 | while (count--) { |
224 | l2 = le32_to_cpu(inl(addr)); | 235 | l2 = le32_to_cpu(inl(addr)); |
225 | *pi++ = (l << 8) | (l2 >> 24); | 236 | *pi++ = (l << 8) | (l2 >> 24); |
226 | l = l2; | 237 | l = l2; |
diff --git a/arch/sparc64/lib/copy_page.S b/arch/sparc64/lib/copy_page.S index 23ebf2c970b7..feebb14fd27a 100644 --- a/arch/sparc64/lib/copy_page.S +++ b/arch/sparc64/lib/copy_page.S | |||
@@ -87,7 +87,7 @@ copy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */ | |||
87 | membar #Sync | 87 | membar #Sync |
88 | wrpr %o2, 0x0, %pstate | 88 | wrpr %o2, 0x0, %pstate |
89 | 89 | ||
90 | BRANCH_IF_ANY_CHEETAH(g3,o2,1f) | 90 | cheetah_copy_page_insn: |
91 | ba,pt %xcc, 9f | 91 | ba,pt %xcc, 9f |
92 | nop | 92 | nop |
93 | 93 | ||
@@ -240,3 +240,14 @@ copy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */ | |||
240 | stw %o4, [%g6 + TI_PRE_COUNT] | 240 | stw %o4, [%g6 + TI_PRE_COUNT] |
241 | 241 | ||
242 | .size copy_user_page, .-copy_user_page | 242 | .size copy_user_page, .-copy_user_page |
243 | |||
244 | .globl cheetah_patch_copy_page | ||
245 | cheetah_patch_copy_page: | ||
246 | sethi %hi(0x01000000), %o1 ! NOP | ||
247 | sethi %hi(cheetah_copy_page_insn), %o0 | ||
248 | or %o0, %lo(cheetah_copy_page_insn), %o0 | ||
249 | stw %o1, [%o0] | ||
250 | membar #StoreStore | ||
251 | flush %o0 | ||
252 | retl | ||
253 | nop | ||