aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ppc64/eeh.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-ppc64/eeh.h')
-rw-r--r--include/asm-ppc64/eeh.h39
1 files changed, 20 insertions, 19 deletions
diff --git a/include/asm-ppc64/eeh.h b/include/asm-ppc64/eeh.h
index 94298b106a4b..40c8eb57493e 100644
--- a/include/asm-ppc64/eeh.h
+++ b/include/asm-ppc64/eeh.h
@@ -219,23 +219,24 @@ static inline void eeh_raw_writeq(u64 val, volatile void __iomem *addr)
219static inline void eeh_memset_io(volatile void __iomem *addr, int c, 219static inline void eeh_memset_io(volatile void __iomem *addr, int c,
220 unsigned long n) 220 unsigned long n)
221{ 221{
222 void *p = (void __force *)addr;
222 u32 lc = c; 223 u32 lc = c;
223 lc |= lc << 8; 224 lc |= lc << 8;
224 lc |= lc << 16; 225 lc |= lc << 16;
225 226
226 while(n && !EEH_CHECK_ALIGN(addr, 4)) { 227 while(n && !EEH_CHECK_ALIGN(p, 4)) {
227 *((volatile u8 *)addr) = c; 228 *((volatile u8 *)p) = c;
228 addr = (void *)((unsigned long)addr + 1); 229 p++;
229 n--; 230 n--;
230 } 231 }
231 while(n >= 4) { 232 while(n >= 4) {
232 *((volatile u32 *)addr) = lc; 233 *((volatile u32 *)p) = lc;
233 addr = (void *)((unsigned long)addr + 4); 234 p += 4;
234 n -= 4; 235 n -= 4;
235 } 236 }
236 while(n) { 237 while(n) {
237 *((volatile u8 *)addr) = c; 238 *((volatile u8 *)p) = c;
238 addr = (void *)((unsigned long)addr + 1); 239 p++;
239 n--; 240 n--;
240 } 241 }
241 __asm__ __volatile__ ("sync" : : : "memory"); 242 __asm__ __volatile__ ("sync" : : : "memory");
@@ -250,22 +251,22 @@ static inline void eeh_memcpy_fromio(void *dest, const volatile void __iomem *sr
250 while(n && (!EEH_CHECK_ALIGN(vsrc, 4) || !EEH_CHECK_ALIGN(dest, 4))) { 251 while(n && (!EEH_CHECK_ALIGN(vsrc, 4) || !EEH_CHECK_ALIGN(dest, 4))) {
251 *((u8 *)dest) = *((volatile u8 *)vsrc); 252 *((u8 *)dest) = *((volatile u8 *)vsrc);
252 __asm__ __volatile__ ("eieio" : : : "memory"); 253 __asm__ __volatile__ ("eieio" : : : "memory");
253 vsrc = (void *)((unsigned long)vsrc + 1); 254 vsrc++;
254 dest = (void *)((unsigned long)dest + 1); 255 dest++;
255 n--; 256 n--;
256 } 257 }
257 while(n > 4) { 258 while(n > 4) {
258 *((u32 *)dest) = *((volatile u32 *)vsrc); 259 *((u32 *)dest) = *((volatile u32 *)vsrc);
259 __asm__ __volatile__ ("eieio" : : : "memory"); 260 __asm__ __volatile__ ("eieio" : : : "memory");
260 vsrc = (void *)((unsigned long)vsrc + 4); 261 vsrc += 4;
261 dest = (void *)((unsigned long)dest + 4); 262 dest += 4;
262 n -= 4; 263 n -= 4;
263 } 264 }
264 while(n) { 265 while(n) {
265 *((u8 *)dest) = *((volatile u8 *)vsrc); 266 *((u8 *)dest) = *((volatile u8 *)vsrc);
266 __asm__ __volatile__ ("eieio" : : : "memory"); 267 __asm__ __volatile__ ("eieio" : : : "memory");
267 vsrc = (void *)((unsigned long)vsrc + 1); 268 vsrc++;
268 dest = (void *)((unsigned long)dest + 1); 269 dest++;
269 n--; 270 n--;
270 } 271 }
271 __asm__ __volatile__ ("sync" : : : "memory"); 272 __asm__ __volatile__ ("sync" : : : "memory");
@@ -286,20 +287,20 @@ static inline void eeh_memcpy_toio(volatile void __iomem *dest, const void *src,
286 287
287 while(n && (!EEH_CHECK_ALIGN(vdest, 4) || !EEH_CHECK_ALIGN(src, 4))) { 288 while(n && (!EEH_CHECK_ALIGN(vdest, 4) || !EEH_CHECK_ALIGN(src, 4))) {
288 *((volatile u8 *)vdest) = *((u8 *)src); 289 *((volatile u8 *)vdest) = *((u8 *)src);
289 src = (void *)((unsigned long)src + 1); 290 src++;
290 vdest = (void *)((unsigned long)vdest + 1); 291 vdest++;
291 n--; 292 n--;
292 } 293 }
293 while(n > 4) { 294 while(n > 4) {
294 *((volatile u32 *)vdest) = *((volatile u32 *)src); 295 *((volatile u32 *)vdest) = *((volatile u32 *)src);
295 src = (void *)((unsigned long)src + 4); 296 src += 4;
296 vdest = (void *)((unsigned long)vdest + 4); 297 vdest += 4;
297 n-=4; 298 n-=4;
298 } 299 }
299 while(n) { 300 while(n) {
300 *((volatile u8 *)vdest) = *((u8 *)src); 301 *((volatile u8 *)vdest) = *((u8 *)src);
301 src = (void *)((unsigned long)src + 1); 302 src++;
302 vdest = (void *)((unsigned long)vdest + 1); 303 vdest++;
303 n--; 304 n--;
304 } 305 }
305 __asm__ __volatile__ ("sync" : : : "memory"); 306 __asm__ __volatile__ ("sync" : : : "memory");