Go to the documentation of this file.
47 #ifndef __ASM_REGOPS_H__
48 #define __ASM_REGOPS_H__
50 #include <linux/types.h>
54 #ifndef R10000_LLSC_WAR
55 #define R10000_LLSC_WAR 0
58 #if R10000_LLSC_WAR == 1
59 #define __beqz "beqzl "
61 #define __beqz "beqz "
64 #ifndef _LINUX_TYPES_H
65 typedef unsigned int u32;
71 static inline void set_value_reg32(
volatile u32 *
const addr,
80 "1: ll %0, %1 # set_value_reg32 \n"
87 :
"=&r" (temp),
"=m" (*addr)
88 :
"ir" (~mask),
"ir" (value),
"m" (*addr));
94 static inline void set_reg32(
volatile u32 *
const addr,
102 "1: ll %0, %1 # set_reg32 \n"
108 :
"=&r" (temp),
"=m" (*addr)
109 :
"ir" (mask),
"m" (*addr));
115 static inline void clear_reg32(
volatile u32 *
const addr,
123 "1: ll %0, %1 # clear_reg32 \n"
129 :
"=&r" (temp),
"=m" (*addr)
130 :
"ir" (~mask),
"m" (*addr));
136 static inline void toggle_reg32(
volatile u32 *
const addr,
144 "1: ll %0, %1 # toggle_reg32 \n"
150 :
"=&r" (temp),
"=m" (*addr)
151 :
"ir" (mask),
"m" (*addr));
157 static inline u32 read_reg32(
volatile u32 *
const addr,
165 " lw %0, %1 # read \n"
166 " and %0, %2 # mask \n"
169 :
"m" (*addr),
"ir" (mask));
181 static inline u32 blocking_read_reg32(
volatile u32 *
const addr)
188 " lw %0, %1 # read \n"
189 " move %0, %0 # block \n"
216 #define custom_read_reg32(address, tmp) \
217 __asm__ __volatile__( \
220 "1: ll %0, %1 #custom_read_reg32 \n" \
222 : "=r" (tmp), "=m" (*address) \
225 #define custom_write_reg32(address, tmp) \
226 __asm__ __volatile__( \
229 " sc %0, %1 #custom_write_reg32 \n" \
230 " "__beqz"%0, 1b \n" \
233 : "=&r" (tmp), "=m" (*address) \
234 : "0" (tmp), "m" (*address))