1 /******************************************************************************
2 * Copyright (c) 2004, 2008 IBM Corporation
4 * This program and the accompanying materials
5 * are made available under the terms of the BSD License
6 * which accompanies this distribution, and is available at
7 * http://www.opensource.org/licenses/bsd-license.php
10 * IBM Corporation - initial implementation
11 *****************************************************************************/
30 #define SETCI(r) sync; \
42 #define CLRCI(r) sync; \
55 /* This macro uses r0 */
56 #define FLUSH_CACHE(r, n) add n, n, r; \
58 rlwinm r, r, 0,0,24; \
59 rlwinm n, n, 0,0,24; \
72 #define STRINGIFY(x...) #x
73 #define EXPAND(x) STRINGIFY(x)
79 asm volatile(EXPAND(SETCI(%0)) : "=r"(tmp) :: "memory", "cc");
86 asm volatile(EXPAND(CLRCI(%0)) : "=r"(tmp) :: "memory", "cc");
89 static inline void eieio(void)
91 asm volatile ("eieio":::"memory");
94 static inline void barrier(void)
96 asm volatile("" : : : "memory");
98 #define cpu_relax() barrier()
100 static inline void sync(void)
102 asm volatile ("sync" ::: "memory");
106 static inline void flush_cache(void* r, long n)
108 asm volatile(EXPAND(FLUSH_CACHE(%0, %1)) : "+r"(r), "+r"(n) :: "memory", "cc", "r0", "ctr");
111 #endif /* __ASSEMBLER__ */