staging: brcm80211: decreased indentation level of brcms_c_wme_setparams function
[zen-stable.git] / arch / powerpc / boot / io.h
blob7c09f4861fe18b32eba553dc3a72679726142f7b
1 #ifndef _IO_H
2 #define __IO_H
4 #include "types.h"
6 /*
7 * Low-level I/O routines.
9 * Copied from <file:arch/powerpc/include/asm/io.h> (which has no copyright)
11 static inline int in_8(const volatile unsigned char *addr)
13 int ret;
15 __asm__ __volatile__("lbz%U1%X1 %0,%1; twi 0,%0,0; isync"
16 : "=r" (ret) : "m" (*addr));
17 return ret;
20 static inline void out_8(volatile unsigned char *addr, int val)
22 __asm__ __volatile__("stb%U0%X0 %1,%0; sync"
23 : "=m" (*addr) : "r" (val));
26 static inline unsigned in_le16(const volatile u16 *addr)
28 unsigned ret;
30 __asm__ __volatile__("lhbrx %0,0,%1; twi 0,%0,0; isync"
31 : "=r" (ret) : "r" (addr), "m" (*addr));
33 return ret;
36 static inline unsigned in_be16(const volatile u16 *addr)
38 unsigned ret;
40 __asm__ __volatile__("lhz%U1%X1 %0,%1; twi 0,%0,0; isync"
41 : "=r" (ret) : "m" (*addr));
42 return ret;
45 static inline void out_le16(volatile u16 *addr, int val)
47 __asm__ __volatile__("sthbrx %1,0,%2; sync" : "=m" (*addr)
48 : "r" (val), "r" (addr));
51 static inline void out_be16(volatile u16 *addr, int val)
53 __asm__ __volatile__("sth%U0%X0 %1,%0; sync"
54 : "=m" (*addr) : "r" (val));
57 static inline unsigned in_le32(const volatile unsigned *addr)
59 unsigned ret;
61 __asm__ __volatile__("lwbrx %0,0,%1; twi 0,%0,0; isync"
62 : "=r" (ret) : "r" (addr), "m" (*addr));
63 return ret;
66 static inline unsigned in_be32(const volatile unsigned *addr)
68 unsigned ret;
70 __asm__ __volatile__("lwz%U1%X1 %0,%1; twi 0,%0,0; isync"
71 : "=r" (ret) : "m" (*addr));
72 return ret;
75 static inline void out_le32(volatile unsigned *addr, int val)
77 __asm__ __volatile__("stwbrx %1,0,%2; sync" : "=m" (*addr)
78 : "r" (val), "r" (addr));
81 static inline void out_be32(volatile unsigned *addr, int val)
83 __asm__ __volatile__("stw%U0%X0 %1,%0; sync"
84 : "=m" (*addr) : "r" (val));
87 static inline void sync(void)
89 asm volatile("sync" : : : "memory");
92 static inline void eieio(void)
94 asm volatile("eieio" : : : "memory");
97 static inline void barrier(void)
99 asm volatile("" : : : "memory");
102 #endif /* _IO_H */