18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
38c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
48c2ecf20Sopenharmony_ci * for more details.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Macros for 32/64-bit neutral inline assembler
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef __ASM_LLSC_H
108c2ecf20Sopenharmony_ci#define __ASM_LLSC_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <asm/isa-rev.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#if _MIPS_SZLONG == 32
158c2ecf20Sopenharmony_ci#define __LL		"ll	"
168c2ecf20Sopenharmony_ci#define __SC		"sc	"
178c2ecf20Sopenharmony_ci#define __INS		"ins	"
188c2ecf20Sopenharmony_ci#define __EXT		"ext	"
198c2ecf20Sopenharmony_ci#elif _MIPS_SZLONG == 64
208c2ecf20Sopenharmony_ci#define __LL		"lld	"
218c2ecf20Sopenharmony_ci#define __SC		"scd	"
228c2ecf20Sopenharmony_ci#define __INS		"dins	"
238c2ecf20Sopenharmony_ci#define __EXT		"dext	"
248c2ecf20Sopenharmony_ci#endif
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/*
278c2ecf20Sopenharmony_ci * Using a branch-likely instruction to check the result of an sc instruction
288c2ecf20Sopenharmony_ci * works around a bug present in R10000 CPUs prior to revision 3.0 that could
298c2ecf20Sopenharmony_ci * cause ll-sc sequences to execute non-atomically.
308c2ecf20Sopenharmony_ci */
318c2ecf20Sopenharmony_ci#ifdef CONFIG_WAR_R10000_LLSC
328c2ecf20Sopenharmony_ci# define __SC_BEQZ "beqzl	"
338c2ecf20Sopenharmony_ci#elif MIPS_ISA_REV >= 6
348c2ecf20Sopenharmony_ci# define __SC_BEQZ "beqzc	"
358c2ecf20Sopenharmony_ci#else
368c2ecf20Sopenharmony_ci# define __SC_BEQZ "beqz	"
378c2ecf20Sopenharmony_ci#endif
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#endif /* __ASM_LLSC_H  */
40