2008-05-19 17:52:27 -06:00
|
|
|
/*
|
2005-04-16 16:20:36 -06:00
|
|
|
* 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
|
|
|
|
|
2007-10-19 00:40:26 -06:00
|
|
|
#ifndef _LINUX_BITOPS_H
|
|
|
|
#error only <linux/bitops.h> can be included directly
|
|
|
|
#endif
|
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
#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 02:39:40 -07:00
|
|
|
#include <asm-generic/bitops/non-atomic.h>
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
2005-08-29 13:46:22 -06:00
|
|
|
#define smp_mb__before_clear_bit() membar_storeload_loadload()
|
|
|
|
#define smp_mb__after_clear_bit() membar_storeload_storestore()
|
2005-04-16 16:20:36 -06: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 02:39:40 -07:00
|
|
|
#include <asm-generic/bitops/ffz.h>
|
|
|
|
#include <asm-generic/bitops/__ffs.h>
|
|
|
|
#include <asm-generic/bitops/fls.h>
|
2008-03-15 11:31:49 -06:00
|
|
|
#include <asm-generic/bitops/__fls.h>
|
[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 02:39:40 -07:00
|
|
|
#include <asm-generic/bitops/fls64.h>
|
2005-04-16 16:20:36 -06: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 02:39:40 -07:00
|
|
|
#include <asm-generic/bitops/sched.h>
|
|
|
|
#include <asm-generic/bitops/ffs.h>
|
2005-04-16 16:20:36 -06: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 20:35:28 -06:00
|
|
|
static inline unsigned int hweight64(unsigned long w)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
|
|
|
unsigned int res;
|
|
|
|
|
|
|
|
__asm__ ("popc %1,%0" : "=r" (res) : "r" (w));
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2005-07-24 20:35:28 -06:00
|
|
|
static inline unsigned int hweight32(unsigned int w)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
|
|
|
unsigned int res;
|
|
|
|
|
|
|
|
__asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xffffffff));
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2005-07-24 20:35:28 -06:00
|
|
|
static inline unsigned int hweight16(unsigned int w)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
|
|
|
unsigned int res;
|
|
|
|
|
|
|
|
__asm__ ("popc %1,%0" : "=r" (res) : "r" (w & 0xffff));
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2005-07-24 20:35:28 -06:00
|
|
|
static inline unsigned int hweight8(unsigned int w)
|
2005-04-16 16:20:36 -06: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 02:39:40 -07:00
|
|
|
#include <asm-generic/bitops/hweight.h>
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
#endif
|
2007-10-18 04:06:39 -06:00
|
|
|
#include <asm-generic/bitops/lock.h>
|
2005-04-16 16:20:36 -06:00
|
|
|
#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 02:39:40 -07:00
|
|
|
#include <asm-generic/bitops/find.h>
|
2005-04-16 16:20:36 -06: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 02:39:40 -07:00
|
|
|
#include <asm-generic/bitops/ext2-non-atomic.h>
|
2005-04-16 16:20:36 -06: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 02:39:40 -07:00
|
|
|
test_and_set_bit((nr) ^ 0x38,(unsigned long *)(addr))
|
2005-04-16 16:20:36 -06: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 02:39:40 -07:00
|
|
|
test_and_clear_bit((nr) ^ 0x38,(unsigned long *)(addr))
|
2005-04-16 16:20:36 -06: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 02:39:40 -07:00
|
|
|
#include <asm-generic/bitops/minix.h>
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
#endif /* __KERNEL__ */
|
|
|
|
|
|
|
|
#endif /* defined(_SPARC64_BITOPS_H) */
|