2005-04-16 15:20:36 -07:00
/* $Id: bitops.h,v 1.39 2002/01/30 01:40:00 davem Exp $
* bitops . h : Bit string operations on the V9 .
*
* Copyright 1996 , 1997 David S . Miller ( davem @ caip . rutgers . edu )
*/
# ifndef _SPARC64_BITOPS_H
# define _SPARC64_BITOPS_H
# include <linux/compiler.h>
# include <asm/byteorder.h>
extern int test_and_set_bit ( unsigned long nr , volatile unsigned long * addr ) ;
extern int test_and_clear_bit ( unsigned long nr , volatile unsigned long * addr ) ;
extern int test_and_change_bit ( unsigned long nr , volatile unsigned long * addr ) ;
extern void set_bit ( unsigned long nr , volatile unsigned long * addr ) ;
extern void clear_bit ( unsigned long nr , volatile unsigned long * addr ) ;
extern void change_bit ( unsigned long nr , volatile unsigned long * addr ) ;
[PATCH] bitops: sparc64: use generic bitops
- remove __{,test_and_}{set,clear,change}_bit() and test_bit()
- remove ffz()
- remove __ffs()
- remove generic_fls()
- remove generic_fls64()
- remove sched_find_first_bit()
- remove ffs()
- unless defined(ULTRA_HAS_POPULATION_COUNT)
- remove generic_hweight{64,32,16,8}()
- remove find_{next,first}{,_zero}_bit()
- remove ext2_{set,clear,test,find_first_zero,find_next_zero}_bit()
- remove minix_{test,set,test_and_clear,test,find_first_zero}_bit()
Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-26 01:39:40 -08:00
# include <asm-generic/bitops/non-atomic.h>
2005-04-16 15:20:36 -07:00
# ifdef CONFIG_SMP
2005-08-29 12:46:22 -07:00
# define smp_mb__before_clear_bit() membar_storeload_loadload()
# define smp_mb__after_clear_bit() membar_storeload_storestore()
2005-04-16 15:20:36 -07:00
# else
# define smp_mb__before_clear_bit() barrier()
# define smp_mb__after_clear_bit() barrier()
# endif
[PATCH] bitops: sparc64: use generic bitops
- remove __{,test_and_}{set,clear,change}_bit() and test_bit()
- remove ffz()
- remove __ffs()
- remove generic_fls()
- remove generic_fls64()
- remove sched_find_first_bit()
- remove ffs()
- unless defined(ULTRA_HAS_POPULATION_COUNT)
- remove generic_hweight{64,32,16,8}()
- remove find_{next,first}{,_zero}_bit()
- remove ext2_{set,clear,test,find_first_zero,find_next_zero}_bit()
- remove minix_{test,set,test_and_clear,test,find_first_zero}_bit()
Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-26 01:39:40 -08:00
# include <asm-generic/bitops/ffz.h>
# include <asm-generic/bitops/__ffs.h>
# include <asm-generic/bitops/fls.h>
# include <asm-generic/bitops/fls64.h>
2005-04-16 15:20:36 -07:00
# ifdef __KERNEL__
[PATCH] bitops: sparc64: use generic bitops
- remove __{,test_and_}{set,clear,change}_bit() and test_bit()
- remove ffz()
- remove __ffs()
- remove generic_fls()
- remove generic_fls64()
- remove sched_find_first_bit()
- remove ffs()
- unless defined(ULTRA_HAS_POPULATION_COUNT)
- remove generic_hweight{64,32,16,8}()
- remove find_{next,first}{,_zero}_bit()
- remove ext2_{set,clear,test,find_first_zero,find_next_zero}_bit()
- remove minix_{test,set,test_and_clear,test,find_first_zero}_bit()
Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-26 01:39:40 -08:00
# include <asm-generic/bitops/sched.h>
# include <asm-generic/bitops/ffs.h>
2005-04-16 15:20:36 -07:00
/*
* hweightN : returns the hamming weight ( i . e . the number
* of bits set ) of a N - bit word
*/
# ifdef ULTRA_HAS_POPULATION_COUNT
2005-07-24 19:35:28 -07:00
static inline unsigned int hweight64 ( unsigned long w )
2005-04-16 15:20:36 -07:00
{
unsigned int res ;
__asm__ ( " popc %1,%0 " : " =r " ( res ) : " r " ( w ) ) ;
return res ;
}
2005-07-24 19:35:28 -07:00
static inline unsigned int hweight32 ( unsigned int w )
2005-04-16 15:20:36 -07:00
{
unsigned int res ;
__asm__ ( " popc %1,%0 " : " =r " ( res ) : " r " ( w & 0xffffffff ) ) ;
return res ;
}
2005-07-24 19:35:28 -07:00
static inline unsigned int hweight16 ( unsigned int w )
2005-04-16 15:20:36 -07:00
{
unsigned int res ;
__asm__ ( " popc %1,%0 " : " =r " ( res ) : " r " ( w & 0xffff ) ) ;
return res ;
}
2005-07-24 19:35:28 -07:00
static inline unsigned int hweight8 ( unsigned int w )
2005-04-16 15:20:36 -07:00
{
unsigned int res ;
__asm__ ( " popc %1,%0 " : " =r " ( res ) : " r " ( w & 0xff ) ) ;
return res ;
}
# else
[PATCH] bitops: sparc64: use generic bitops
- remove __{,test_and_}{set,clear,change}_bit() and test_bit()
- remove ffz()
- remove __ffs()
- remove generic_fls()
- remove generic_fls64()
- remove sched_find_first_bit()
- remove ffs()
- unless defined(ULTRA_HAS_POPULATION_COUNT)
- remove generic_hweight{64,32,16,8}()
- remove find_{next,first}{,_zero}_bit()
- remove ext2_{set,clear,test,find_first_zero,find_next_zero}_bit()
- remove minix_{test,set,test_and_clear,test,find_first_zero}_bit()
Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-26 01:39:40 -08:00
# include <asm-generic/bitops/hweight.h>
2005-04-16 15:20:36 -07:00
# endif
# endif /* __KERNEL__ */
[PATCH] bitops: sparc64: use generic bitops
- remove __{,test_and_}{set,clear,change}_bit() and test_bit()
- remove ffz()
- remove __ffs()
- remove generic_fls()
- remove generic_fls64()
- remove sched_find_first_bit()
- remove ffs()
- unless defined(ULTRA_HAS_POPULATION_COUNT)
- remove generic_hweight{64,32,16,8}()
- remove find_{next,first}{,_zero}_bit()
- remove ext2_{set,clear,test,find_first_zero,find_next_zero}_bit()
- remove minix_{test,set,test_and_clear,test,find_first_zero}_bit()
Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-26 01:39:40 -08:00
# include <asm-generic/bitops/find.h>
2005-04-16 15:20:36 -07:00
# ifdef __KERNEL__
[PATCH] bitops: sparc64: use generic bitops
- remove __{,test_and_}{set,clear,change}_bit() and test_bit()
- remove ffz()
- remove __ffs()
- remove generic_fls()
- remove generic_fls64()
- remove sched_find_first_bit()
- remove ffs()
- unless defined(ULTRA_HAS_POPULATION_COUNT)
- remove generic_hweight{64,32,16,8}()
- remove find_{next,first}{,_zero}_bit()
- remove ext2_{set,clear,test,find_first_zero,find_next_zero}_bit()
- remove minix_{test,set,test_and_clear,test,find_first_zero}_bit()
Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-26 01:39:40 -08:00
# include <asm-generic/bitops/ext2-non-atomic.h>
2005-04-16 15:20:36 -07:00
# define ext2_set_bit_atomic(lock,nr,addr) \
[PATCH] bitops: sparc64: use generic bitops
- remove __{,test_and_}{set,clear,change}_bit() and test_bit()
- remove ffz()
- remove __ffs()
- remove generic_fls()
- remove generic_fls64()
- remove sched_find_first_bit()
- remove ffs()
- unless defined(ULTRA_HAS_POPULATION_COUNT)
- remove generic_hweight{64,32,16,8}()
- remove find_{next,first}{,_zero}_bit()
- remove ext2_{set,clear,test,find_first_zero,find_next_zero}_bit()
- remove minix_{test,set,test_and_clear,test,find_first_zero}_bit()
Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-26 01:39:40 -08:00
test_and_set_bit ( ( nr ) ^ 0x38 , ( unsigned long * ) ( addr ) )
2005-04-16 15:20:36 -07:00
# define ext2_clear_bit_atomic(lock,nr,addr) \
[PATCH] bitops: sparc64: use generic bitops
- remove __{,test_and_}{set,clear,change}_bit() and test_bit()
- remove ffz()
- remove __ffs()
- remove generic_fls()
- remove generic_fls64()
- remove sched_find_first_bit()
- remove ffs()
- unless defined(ULTRA_HAS_POPULATION_COUNT)
- remove generic_hweight{64,32,16,8}()
- remove find_{next,first}{,_zero}_bit()
- remove ext2_{set,clear,test,find_first_zero,find_next_zero}_bit()
- remove minix_{test,set,test_and_clear,test,find_first_zero}_bit()
Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-26 01:39:40 -08:00
test_and_clear_bit ( ( nr ) ^ 0x38 , ( unsigned long * ) ( addr ) )
2005-04-16 15:20:36 -07:00
[PATCH] bitops: sparc64: use generic bitops
- remove __{,test_and_}{set,clear,change}_bit() and test_bit()
- remove ffz()
- remove __ffs()
- remove generic_fls()
- remove generic_fls64()
- remove sched_find_first_bit()
- remove ffs()
- unless defined(ULTRA_HAS_POPULATION_COUNT)
- remove generic_hweight{64,32,16,8}()
- remove find_{next,first}{,_zero}_bit()
- remove ext2_{set,clear,test,find_first_zero,find_next_zero}_bit()
- remove minix_{test,set,test_and_clear,test,find_first_zero}_bit()
Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-03-26 01:39:40 -08:00
# include <asm-generic/bitops/minix.h>
2005-04-16 15:20:36 -07:00
# endif /* __KERNEL__ */
# endif /* defined(_SPARC64_BITOPS_H) */