| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 | 
							- /* bitops.h: bit operations for the Fujitsu FR-V CPUs
 
-  *
 
-  * For an explanation of how atomic ops work in this arch, see:
 
-  *   Documentation/frv/atomic-ops.txt
 
-  *
 
-  * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
 
-  * Written by David Howells (dhowells@redhat.com)
 
-  *
 
-  * This program is free software; you can redistribute it and/or
 
-  * modify it under the terms of the GNU General Public License
 
-  * as published by the Free Software Foundation; either version
 
-  * 2 of the License, or (at your option) any later version.
 
-  */
 
- #ifndef _ASM_BITOPS_H
 
- #define _ASM_BITOPS_H
 
- #include <linux/compiler.h>
 
- #include <asm/byteorder.h>
 
- #ifdef __KERNEL__
 
- #ifndef _LINUX_BITOPS_H
 
- #error only <linux/bitops.h> can be included directly
 
- #endif
 
- #include <asm-generic/bitops/ffz.h>
 
- /*
 
-  * clear_bit() doesn't provide any barrier for the compiler.
 
-  */
 
- #define smp_mb__before_clear_bit()	barrier()
 
- #define smp_mb__after_clear_bit()	barrier()
 
- #ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS
 
- static inline
 
- unsigned long atomic_test_and_ANDNOT_mask(unsigned long mask, volatile unsigned long *v)
 
- {
 
- 	unsigned long old, tmp;
 
- 	asm volatile(
 
- 		"0:						\n"
 
- 		"	orcc		gr0,gr0,gr0,icc3	\n"	/* set ICC3.Z */
 
- 		"	ckeq		icc3,cc7		\n"
 
- 		"	ld.p		%M0,%1			\n"	/* LD.P/ORCR are atomic */
 
- 		"	orcr		cc7,cc7,cc3		\n"	/* set CC3 to true */
 
- 		"	and%I3		%1,%3,%2		\n"
 
- 		"	cst.p		%2,%M0		,cc3,#1	\n"	/* if store happens... */
 
- 		"	corcc		gr29,gr29,gr0	,cc3,#1	\n"	/* ... clear ICC3.Z */
 
- 		"	beq		icc3,#0,0b		\n"
 
- 		: "+U"(*v), "=&r"(old), "=r"(tmp)
 
- 		: "NPr"(~mask)
 
- 		: "memory", "cc7", "cc3", "icc3"
 
- 		);
 
- 	return old;
 
- }
 
- static inline
 
- unsigned long atomic_test_and_OR_mask(unsigned long mask, volatile unsigned long *v)
 
- {
 
- 	unsigned long old, tmp;
 
- 	asm volatile(
 
- 		"0:						\n"
 
- 		"	orcc		gr0,gr0,gr0,icc3	\n"	/* set ICC3.Z */
 
 
  |