mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
a8ec1516a7
c6x doesn't have a barrier.h and completely relies on asm-generic/barrier.h. Therefore its smp_mb() is barrier() and we can use the default versions that are smp_mb(). Signed-off-by: Peter Zijlstra <peterz@infradead.org> Acked-by: Mark Salter <msalter@redhat.com> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Link: http://lkml.kernel.org/n/tip-kl53k3pyj0rbd80jq8ralpf3@git.kernel.org Cc: Aurelien Jacquiot <a-jacquiot@ti.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mark Salter <msalter@redhat.com> Cc: linux-c6x-dev@linux-c6x.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
99 lines
2.2 KiB
C
99 lines
2.2 KiB
C
/*
|
|
* Port on Texas Instruments TMS320C6x architecture
|
|
*
|
|
* Copyright (C) 2004, 2009, 2010 Texas Instruments Incorporated
|
|
* Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
#ifndef _ASM_C6X_BITOPS_H
|
|
#define _ASM_C6X_BITOPS_H
|
|
|
|
#ifdef __KERNEL__
|
|
|
|
#include <linux/bitops.h>
|
|
#include <asm/byteorder.h>
|
|
#include <asm/barrier.h>
|
|
|
|
/*
|
|
* We are lucky, DSP is perfect for bitops: do it in 3 cycles
|
|
*/
|
|
|
|
/**
|
|
* __ffs - find first bit in word.
|
|
* @word: The word to search
|
|
*
|
|
* Undefined if no bit exists, so code should check against 0 first.
|
|
* Note __ffs(0) = undef, __ffs(1) = 0, __ffs(0x80000000) = 31.
|
|
*
|
|
*/
|
|
static inline unsigned long __ffs(unsigned long x)
|
|
{
|
|
asm (" bitr .M1 %0,%0\n"
|
|
" nop\n"
|
|
" lmbd .L1 1,%0,%0\n"
|
|
: "+a"(x));
|
|
|
|
return x;
|
|
}
|
|
|
|
/*
|
|
* ffz - find first zero in word.
|
|
* @word: The word to search
|
|
*
|
|
* Undefined if no zero exists, so code should check against ~0UL first.
|
|
*/
|
|
#define ffz(x) __ffs(~(x))
|
|
|
|
/**
|
|
* fls - find last (most-significant) bit set
|
|
* @x: the word to search
|
|
*
|
|
* This is defined the same way as ffs.
|
|
* Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
|
|
*/
|
|
static inline int fls(int x)
|
|
{
|
|
if (!x)
|
|
return 0;
|
|
|
|
asm (" lmbd .L1 1,%0,%0\n" : "+a"(x));
|
|
|
|
return 32 - x;
|
|
}
|
|
|
|
/**
|
|
* ffs - find first bit set
|
|
* @x: the word to search
|
|
*
|
|
* This is defined the same way as
|
|
* the libc and compiler builtin ffs routines, therefore
|
|
* differs in spirit from the above ffz (man ffs).
|
|
* Note ffs(0) = 0, ffs(1) = 1, ffs(0x80000000) = 32.
|
|
*/
|
|
static inline int ffs(int x)
|
|
{
|
|
if (!x)
|
|
return 0;
|
|
|
|
return __ffs(x) + 1;
|
|
}
|
|
|
|
#include <asm-generic/bitops/__fls.h>
|
|
#include <asm-generic/bitops/fls64.h>
|
|
#include <asm-generic/bitops/find.h>
|
|
|
|
#include <asm-generic/bitops/sched.h>
|
|
#include <asm-generic/bitops/hweight.h>
|
|
#include <asm-generic/bitops/lock.h>
|
|
|
|
#include <asm-generic/bitops/atomic.h>
|
|
#include <asm-generic/bitops/non-atomic.h>
|
|
#include <asm-generic/bitops/le.h>
|
|
#include <asm-generic/bitops/ext2-atomic.h>
|
|
|
|
#endif /* __KERNEL__ */
|
|
#endif /* _ASM_C6X_BITOPS_H */
|